From 47a20256ef9bf2e3e451f8f0c25edd19856475fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 8 Aug 2023 12:42:56 +0300 Subject: [PATCH] Tailwind doc updates --- doc/speeddial/theming/TailwindDoc.vue | 79 ++++++++++++++- doc/splitbutton/theming/TailwindDoc.vue | 126 +++++++++++++++++++++++- doc/treeselect/theming/TailwindDoc.vue | 63 ++++++++++++ 3 files changed, 264 insertions(+), 4 deletions(-) diff --git a/doc/speeddial/theming/TailwindDoc.vue b/doc/speeddial/theming/TailwindDoc.vue index a9966797b..b6459d5ed 100644 --- a/doc/speeddial/theming/TailwindDoc.vue +++ b/doc/speeddial/theming/TailwindDoc.vue @@ -4,8 +4,10 @@ PrimeVue offers a built-in Tailwind theme to get you started quickly. The default values related to the component are displayed below. The component can easily be styled with your own design based on Tailwind utilities, see the Tailwind Customization section for an example.

- -

A playground sample with the pre-built Tailwind theme.

+
+ +
+

A playground sample with the pre-built Tailwind theme.

@@ -58,6 +60,79 @@ export default { } ] }) + }, + button: { + root: ({ props, context }) => ({ + class: [ + 'items-center cursor-pointer inline-flex overflow-hidden relative select-none text-center align-bottom h-full', + 'transition duration-200 ease-in-out', + 'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_4px_rgba(157,193,251,1),0_1px_2px_0_rgba(0,0,0,1)] dark:focus:shadow-[0_0_0_2px_rgba(28,33,39,1),0_0_0_4px_rgba(147,197,253,0.7),0_1px_2px_0_rgba(0,0,0,0)]', // Primary button focus + { + 'text-white bg-blue-500 border border-blue-500 hover:bg-blue-600 hover:border-blue-600': !props.link && props.severity === null && !props.text && !props.outlined && !props.plain, + 'text-blue-600 bg-transparent border-transparent': props.link + }, + { + 'text-white bg-gray-500 border border-gray-500 hover:bg-gray-600 hover:border-gray-600': props.severity === 'secondary' && !props.text && !props.outlined && !props.plain, + 'text-white bg-green-500 border border-green-500 hover:bg-green-600 hover:border-green-600': props.severity === 'success' && !props.text && !props.outlined && !props.plain, + 'text-white bg-blue-500 border border-blue-500 hover:bg-blue-600 hover:border-blue-600': props.severity === 'info' && !props.text && !props.outlined && !props.plain, + 'text-white bg-orange-500 border border-orange-500 hover:bg-orange-600 hover:border-orange-600': props.severity === 'warning' && !props.text && !props.outlined && !props.plain, + 'text-white bg-purple-500 border border-purple-500 hover:bg-purple-600 hover:border-purple-600': props.severity === 'help' && !props.text && !props.outlined && !props.plain, + 'text-white bg-red-500 border border-red-500 hover:bg-red-600 hover:border-red-600': props.severity === 'danger' && !props.text && !props.outlined && !props.plain + }, + { 'shadow-lg': props.raised }, + { 'rounded-md': !props.rounded, 'rounded-full': props.rounded }, + { + 'bg-transparent border-transparent': props.text && !props.plain, + 'text-blue-500 hover:bg-blue-300/20': props.text && (props.severity === null || props.severity === 'info') && !props.plain, + 'text-gray-500 hover:bg-gray-300/20': props.text && props.severity === 'secondary' && !props.plain, + 'text-green-500 hover:bg-green-300/20': props.text && props.severity === 'success' && !props.plain, + 'text-orange-500 hover:bg-orange-300/20': props.text && props.severity === 'warning' && !props.plain, + 'text-purple-500 hover:bg-purple-300/20': props.text && props.severity === 'help' && !props.plain, + 'text-red-500 hover:bg-red-300/20': props.text && props.severity === 'danger' && !props.plain + }, + { 'shadow-lg': props.raised && props.text }, + { + 'text-gray-500 hover:bg-gray-300/20': props.plain & props.text, + 'text-gray-500 border border-gray-500 hover:bg-gray-300/20': props.plain & props.outlined, + 'text-white bg-gray-500 border border-gray-500 hover:bg-gray-600 hover:border-gray-600': props.plain & !props.outlined & !props.text + }, + { + 'bg-transparent border': props.outlined && !props.plain, + 'text-blue-500 border border-blue-500 hover:bg-blue-300/20': props.outlined && (props.severity === null || props.severity === 'info') && !props.plain, + 'text-gray-500 border border-gray-500 hover:bg-gray-300/20': props.outlined && props.severity === 'secondary' && !props.plain, + 'text-green-500 border border-green-500 hover:bg-green-300/20': props.outlined && props.severity === 'success' && !props.plain, + 'text-orange-500 border border-orange-500 hover:bg-orange-300/20': props.outlined && props.severity === 'warning' && !props.plain, + 'text-purple-500 border border-purple-500 hover:bg-purple-300/20': props.outlined && props.severity === 'help' && !props.plain, + 'text-red-500 border border-red-500 hover:bg-red-300/20': props.outlined && props.severity === 'danger' && !props.plain + }, + { 'px-4 py-3 text-base': props.size === null, 'text-xs py-2 px-3': props.size === 'small', 'text-xl py-3 px-4': props.size === 'large' }, + { 'opacity-60 pointer-events-none cursor-default': context.disabled } + ] + }), + label: ({ props }) => ({ + class: [ + 'flex-1', + 'duration-200', + 'font-bold', + { + 'hover:underline': props.link + } + ] + }), + icon: ({ props }) => ({ + class: [ + 'mx-0', + { + 'mr-2': props.iconPos == 'left' && props.label != null, + 'ml-2': props.iconPos == 'right' && props.label != null, + 'mb-2': props.iconPos == 'top' && props.label != null, + 'mt-2': props.iconPos == 'bottom' && props.label != null + } + ] + }), + badge: ({ props }) => ({ + class: [{ 'ml-2 w-4 h-4 leading-none flex items-center justify-center': props.badge }] + }) } } ` diff --git a/doc/splitbutton/theming/TailwindDoc.vue b/doc/splitbutton/theming/TailwindDoc.vue index e0400d0aa..42a105913 100644 --- a/doc/splitbutton/theming/TailwindDoc.vue +++ b/doc/splitbutton/theming/TailwindDoc.vue @@ -4,8 +4,10 @@ PrimeVue offers a built-in Tailwind theme to get you started quickly. The default values related to the component are displayed below. The component can easily be styled with your own design based on Tailwind utilities, see the Tailwind Customization section for an example.

- -

A playground sample with the pre-built Tailwind theme.

+
+ +
+

A playground sample with the pre-built Tailwind theme.

@@ -16,6 +18,15 @@ export default { return { code1: { basic: ` +export const TRANSITIONS = { + overlay: { + enterFromClass: 'opacity-0 scale-75', + enterActiveClass: 'transition-transform transition-opacity duration-150 ease-in', + leaveActiveClass: 'transition-opacity duration-150 ease-linear', + leaveToClass: 'opacity-0' + } +}; + export default { splitbutton: { root: ({ props }) => ({ @@ -33,6 +44,117 @@ export default { }), label: 'hidden' } + }, + button: { + root: ({ props, context }) => ({ + class: [ + 'items-center cursor-pointer inline-flex overflow-hidden relative select-none text-center align-bottom h-full', + 'transition duration-200 ease-in-out', + 'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_4px_rgba(157,193,251,1),0_1px_2px_0_rgba(0,0,0,1)] dark:focus:shadow-[0_0_0_2px_rgba(28,33,39,1),0_0_0_4px_rgba(147,197,253,0.7),0_1px_2px_0_rgba(0,0,0,0)]', // Primary button focus + { + 'text-white bg-blue-500 border border-blue-500 hover:bg-blue-600 hover:border-blue-600': !props.link && props.severity === null && !props.text && !props.outlined && !props.plain, + 'text-blue-600 bg-transparent border-transparent': props.link + }, + { + 'text-white bg-gray-500 border border-gray-500 hover:bg-gray-600 hover:border-gray-600': props.severity === 'secondary' && !props.text && !props.outlined && !props.plain, + 'text-white bg-green-500 border border-green-500 hover:bg-green-600 hover:border-green-600': props.severity === 'success' && !props.text && !props.outlined && !props.plain, + 'text-white bg-blue-500 border border-blue-500 hover:bg-blue-600 hover:border-blue-600': props.severity === 'info' && !props.text && !props.outlined && !props.plain, + 'text-white bg-orange-500 border border-orange-500 hover:bg-orange-600 hover:border-orange-600': props.severity === 'warning' && !props.text && !props.outlined && !props.plain, + 'text-white bg-purple-500 border border-purple-500 hover:bg-purple-600 hover:border-purple-600': props.severity === 'help' && !props.text && !props.outlined && !props.plain, + 'text-white bg-red-500 border border-red-500 hover:bg-red-600 hover:border-red-600': props.severity === 'danger' && !props.text && !props.outlined && !props.plain + }, + { 'shadow-lg': props.raised }, + { 'rounded-md': !props.rounded, 'rounded-full': props.rounded }, + { + 'bg-transparent border-transparent': props.text && !props.plain, + 'text-blue-500 hover:bg-blue-300/20': props.text && (props.severity === null || props.severity === 'info') && !props.plain, + 'text-gray-500 hover:bg-gray-300/20': props.text && props.severity === 'secondary' && !props.plain, + 'text-green-500 hover:bg-green-300/20': props.text && props.severity === 'success' && !props.plain, + 'text-orange-500 hover:bg-orange-300/20': props.text && props.severity === 'warning' && !props.plain, + 'text-purple-500 hover:bg-purple-300/20': props.text && props.severity === 'help' && !props.plain, + 'text-red-500 hover:bg-red-300/20': props.text && props.severity === 'danger' && !props.plain + }, + { 'shadow-lg': props.raised && props.text }, + { + 'text-gray-500 hover:bg-gray-300/20': props.plain & props.text, + 'text-gray-500 border border-gray-500 hover:bg-gray-300/20': props.plain & props.outlined, + 'text-white bg-gray-500 border border-gray-500 hover:bg-gray-600 hover:border-gray-600': props.plain & !props.outlined & !props.text + }, + { + 'bg-transparent border': props.outlined && !props.plain, + 'text-blue-500 border border-blue-500 hover:bg-blue-300/20': props.outlined && (props.severity === null || props.severity === 'info') && !props.plain, + 'text-gray-500 border border-gray-500 hover:bg-gray-300/20': props.outlined && props.severity === 'secondary' && !props.plain, + 'text-green-500 border border-green-500 hover:bg-green-300/20': props.outlined && props.severity === 'success' && !props.plain, + 'text-orange-500 border border-orange-500 hover:bg-orange-300/20': props.outlined && props.severity === 'warning' && !props.plain, + 'text-purple-500 border border-purple-500 hover:bg-purple-300/20': props.outlined && props.severity === 'help' && !props.plain, + 'text-red-500 border border-red-500 hover:bg-red-300/20': props.outlined && props.severity === 'danger' && !props.plain + }, + { 'px-4 py-3 text-base': props.size === null, 'text-xs py-2 px-3': props.size === 'small', 'text-xl py-3 px-4': props.size === 'large' }, + { 'opacity-60 pointer-events-none cursor-default': context.disabled } + ] + }), + label: ({ props }) => ({ + class: [ + 'flex-1', + 'duration-200', + 'font-bold', + { + 'hover:underline': props.link + } + ] + }), + icon: ({ props }) => ({ + class: [ + 'mx-0', + { + 'mr-2': props.iconPos == 'left' && props.label != null, + 'ml-2': props.iconPos == 'right' && props.label != null, + 'mb-2': props.iconPos == 'top' && props.label != null, + 'mt-2': props.iconPos == 'bottom' && props.label != null + } + ] + }), + badge: ({ props }) => ({ + class: [{ 'ml-2 w-4 h-4 leading-none flex items-center justify-center': props.badge }] + }) + }, + tieredmenu: { + root: { + class: ['py-1 bg-white border border-gray-300 rounded-lg w-[12.5rem]', 'dark:border-blue-900/40 dark:bg-gray-900'] + }, + menu: { + class: ['outline-none', 'm-0 p-0 list-none'] + }, + menuitem: 'relative', + content: ({ context }) => ({ + class: [ + 'transition-shadow duration-200 border-none rounded-none', + 'hover:bg-gray-200 hover:text-gray-700 dark:hover:text-white/80 dark:hover:bg-gray-800/80', //Hover + { + 'text-gray-700': !context.focused && !context.active, + 'bg-gray-300 text-gray-700 dark:text-white/80 dark:bg-gray-800/90': context.focused && !context.active, + 'bg-blue-100 text-blue-700 dark:bg-blue-400 dark:text-white/80': context.focused && context.active, + 'bg-blue-50 text-blue-700 dark:bg-blue-300 dark:text-white/80': !context.focused && context.active + } + ] + }), + action: ({ context }) => ({ + class: [ + 'py-3 px-5 select-none', + 'flex items-center cursor-pointer no-underline relative overflow-hidden', + { + 'text-gray-700 dark:text-white/80 hover:text-gray-700 dark:hover:text-white/80 hover:bg-gray-200 dark:hover:bg-gray-800/80': !context.active, + 'text-blue-600 bg-blue-100': context.active + } + ] + }), + icon: 'mr-2', + submenuicon: 'ml-auto', + separator: 'border-t border-gray-300 my-1 dark:border-blue-900/40', + submenu: { + class: ['py-1 bg-white dark:bg-gray-900 border-0 shadow-md min-w-full', 'absolute z-10', 'left-full top-0'] + }, + transition: TRANSITIONS.overlay } } ` diff --git a/doc/treeselect/theming/TailwindDoc.vue b/doc/treeselect/theming/TailwindDoc.vue index d1a1d8ef4..506925d36 100644 --- a/doc/treeselect/theming/TailwindDoc.vue +++ b/doc/treeselect/theming/TailwindDoc.vue @@ -52,6 +52,69 @@ export default { }, transition: TRANSITIONS.overlay }, + tree: { + root: { + class: ['max-w-[30rem] md:w-full', 'border border-solid border-gray-300 dark:border-blue-900/40 bg-white dark:bg-gray-900 text-gray-700 dark:text-white/80 p-5 rounded-md'] + }, + wrapper: 'overflow-auto', + container: 'm-0 p-0 list-none overflow-auto', + node: 'p-1 outline-none', + content: ({ context, props }) => ({ + class: [ + 'flex items-center', + 'rounded-lg transition-shadow duration-200 p-2', + 'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]', + { 'bg-blue-50 text-blue-600': context.selected }, + { 'cursor-pointer select-none': props.selectionMode == 'single' || props.selectionMode == 'multiple' } + ] + }), + toggler: ({ context }) => ({ + class: [ + 'cursor-pointer select-none inline-flex items-center justify-center overflow-hidden relative shrink-0', + 'mr-2 w-8 h-8 border-0 bg-transparent rounded-full transition duration-200', + 'hover:border-transparent focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]', + { + 'text-gray-500 dark:text-white/80 hover:bg-gray-200 dark:hover:bg-gray-800/80 hover:text-gray-800 dark:hover:text-white/80': !context.selected, + 'text-blue-600 hover:bg-white/30': context.selected + }, + { + hidden: context.leaf + } + ] + }), + checkboxcontainer: 'mr-2', + checkbox: ({ context, props }) => ({ + class: [ + 'cursor-pointer inline-flex relative select-none align-bottom', + 'w-6 h-6', + 'flex items-center justify-center', + 'border-2 w-6 h-6 rounded-lg transition-colors duration-200 text-white text-base dark:text-gray-900', + { + 'border-gray-300 bg-white dark:border-blue-900/40 dark:bg-gray-900': !context.checked, + 'border-blue-500 text-white bg-blue-500 dark:border-blue-400 dark:bg-blue-400': context.checked + }, + { + 'hover:border-blue-500 dark:hover:border-blue-400 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[inset_0_0_0_0.2rem_rgba(147,197,253,0.5)]': !props.disabled, + 'cursor-default opacity-60': props.disabled + } + ] + }), + nodeicon: 'mr-2 text-gray-600 dark:text-white/70', + subgroup: { + class: ['m-0 list-none', 'p-0 pl-4'] + }, + filtercontainer: { + class: ['mb-2', 'relative block w-full'] + }, + input: { + class: [ + 'm-0 p-3 text-base w-full pr-7', + 'font-sans text-gray-600 dark:text-white/70 bg-white dark:bg-gray-900 border border-gray-300 dark:border-blue-900/40 transition-colors duration-200 appearance-none rounded-lg', + 'hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]' + ] + }, + searchicon: 'absolute top-1/2 -mt-2 right-3 text-gray-600 dark:hover:text-white/70' + }, } ` },