From 008ed4dfcfe3f4a99c5cbd8026a3f2b433e789c9 Mon Sep 17 00:00:00 2001 From: "Irsyad A. Panjaitan" Date: Fri, 16 Aug 2024 22:38:59 +0700 Subject: [PATCH 1/6] temp --- app/(app)/colors/(colors)/color-generator.tsx | 2 - app/(app)/colors/(colors)/color-item.tsx | 59 ++++----- app/(app)/colors/(colors)/color-palette.tsx | 4 +- app/(app)/colors/(colors)/color-row.tsx | 9 +- app/(app)/themes/blocks.tsx | 14 +- app/(app)/themes/blocks/buttons.tsx | 26 ++++ app/(app)/themes/blocks/forms/login-form.tsx | 31 ----- .../themes/blocks/forms/login-root-form.tsx | 32 ----- .../themes/blocks/forms/login-social.tsx | 38 ------ app/(app)/themes/blocks/forms/toggle-form.tsx | 29 ----- app/(app)/themes/blocks/login-form.tsx | 27 ++++ .../themes/blocks/range-calendar-blocks.tsx | 24 ++++ app/(app)/themes/page.tsx | 7 +- app/(app)/themes/themes-list.ts | 122 ++++++++++++++++++ app/(app)/themes/themes.tsx | 55 +++++++- components/ui/button.tsx | 4 +- components/ui/field.tsx | 4 +- components/ui/input-otp.tsx | 2 +- components/ui/link.tsx | 8 +- components/ui/primitive.tsx | 6 +- .../docs/getting-started/installation.mdx | 3 +- resources/styles/app.css | 8 +- 22 files changed, 303 insertions(+), 211 deletions(-) create mode 100644 app/(app)/themes/blocks/buttons.tsx delete mode 100644 app/(app)/themes/blocks/forms/login-form.tsx delete mode 100644 app/(app)/themes/blocks/forms/login-root-form.tsx delete mode 100644 app/(app)/themes/blocks/forms/login-social.tsx delete mode 100644 app/(app)/themes/blocks/forms/toggle-form.tsx create mode 100644 app/(app)/themes/blocks/login-form.tsx create mode 100644 app/(app)/themes/blocks/range-calendar-blocks.tsx create mode 100644 app/(app)/themes/themes-list.ts diff --git a/app/(app)/colors/(colors)/color-generator.tsx b/app/(app)/colors/(colors)/color-generator.tsx index c45ab104..16afbb8e 100644 --- a/app/(app)/colors/(colors)/color-generator.tsx +++ b/app/(app)/colors/(colors)/color-generator.tsx @@ -36,8 +36,6 @@ export function ColorGenerator() {
{ setCopied(false) }, 2000) - toast('Copied to clipboard!') + toast.success(`Copy ${toCopy} to clipboard.`, { + classNames: { + toast: '[&:has([data-icon])_[data-content]]:ml-0', + icon: 'hidden' + } + }) } return ( handleCopy(parseColor(item.color as string)?.toString(selectedFormat))} style={{ - color: textColorBasedOnBg(item.color) + color: textColorBasedOnBg(item.color), + backgroundColor: item.color }} > - -
+
- - {showItem && ( -
- {item.shade} - - - {isForTailwindVariable && - selectedFormat !== 'hexa' && - selectedFormat !== 'hex' && - 'tw/'} - {selectedFormat === 'hex' - ? parseColor(item.color as string)?.toString(selectedFormat) - : selectedFormat} - - - {parseColor(item.color as string)?.toString(selectedFormat)} - - -
- )} + + + {item.shade} +
) } diff --git a/app/(app)/colors/(colors)/color-palette.tsx b/app/(app)/colors/(colors)/color-palette.tsx index 98a6b797..1b2f438a 100644 --- a/app/(app)/colors/(colors)/color-palette.tsx +++ b/app/(app)/colors/(colors)/color-palette.tsx @@ -28,7 +28,7 @@ export function ColorPalette() { useEffect(() => { if (inView && hasMore) { - const nextPage = colors.length + 9 + const nextPage = colors.length + 8 const newColors = filteredColors.slice(0, nextPage) setColors(newColors) if (newColors.length >= filteredColors.length) { @@ -43,7 +43,7 @@ export function ColorPalette() {
diff --git a/app/(app)/colors/(colors)/color-row.tsx b/app/(app)/colors/(colors)/color-row.tsx index a5f52451..c94a070f 100644 --- a/app/(app)/colors/(colors)/color-row.tsx +++ b/app/(app)/colors/(colors)/color-row.tsx @@ -12,7 +12,7 @@ import { IconBrandTailwindcss } from 'justd-icons' import { ListBox, Text, ToggleButton } from 'react-aria-components' import type { ColorItemProps, FormatOnlyForTailwindVariableType } from 'resources/types' import { toast } from 'sonner' -import { buttonStyles, gridStyles, Heading, Select, Tooltip } from 'ui' +import { buttonStyles, gridStyles, Select, Tooltip } from 'ui' import { ColorItem } from './color-item' @@ -31,14 +31,11 @@ export function ColorRow({ showItem = false, swatchClassName, item }: ColorRowPr return (
- +

{tailwindColorNames.includes(item.name) ? item.name : getColorName(item.children[4].color)} - +

<> +
- - + +
) } diff --git a/app/(app)/themes/blocks/buttons.tsx b/app/(app)/themes/blocks/buttons.tsx new file mode 100644 index 00000000..7c153349 --- /dev/null +++ b/app/(app)/themes/blocks/buttons.tsx @@ -0,0 +1,26 @@ +'use client' + +import { Button, Card, Checkbox, Switch } from 'ui' + +export function Buttons() { + return ( +
+ +
+ + +
+
+ + +
+
+ + Remember me + + + Toggle Theme + +
+ ) +} diff --git a/app/(app)/themes/blocks/forms/login-form.tsx b/app/(app)/themes/blocks/forms/login-form.tsx deleted file mode 100644 index 0ceaae86..00000000 --- a/app/(app)/themes/blocks/forms/login-form.tsx +++ /dev/null @@ -1,31 +0,0 @@ -'use client' - -import { Button, Card, Checkbox, Form, Link, TextField } from 'ui' - -export function LoginForm() { - return ( - - -
{}}> - - - -
- Remember me - - Forgot password? - -
-
- - - -
-
- ) -} diff --git a/app/(app)/themes/blocks/forms/login-root-form.tsx b/app/(app)/themes/blocks/forms/login-root-form.tsx deleted file mode 100644 index 1236e024..00000000 --- a/app/(app)/themes/blocks/forms/login-root-form.tsx +++ /dev/null @@ -1,32 +0,0 @@ -'use client' - -import { Button, Card, Choicebox, Form, TextField } from 'ui' - -export function LoginRootForm() { - return ( - - -
{}}> - - - - - - - - -
-
- ) -} diff --git a/app/(app)/themes/blocks/forms/login-social.tsx b/app/(app)/themes/blocks/forms/login-social.tsx deleted file mode 100644 index afc137c1..00000000 --- a/app/(app)/themes/blocks/forms/login-social.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { IconBrandGithub, IconBrandThreads, IconBrandX } from 'justd-icons' -import { Button, Card, Link, ShowMore } from 'ui' - -export function LoginSocial() { - return ( - - Log in - - - - - - - - - - - - - Continue with Email - - - - ) -} diff --git a/app/(app)/themes/blocks/forms/toggle-form.tsx b/app/(app)/themes/blocks/forms/toggle-form.tsx deleted file mode 100644 index ea77314e..00000000 --- a/app/(app)/themes/blocks/forms/toggle-form.tsx +++ /dev/null @@ -1,29 +0,0 @@ -'use client' - -import { Button, Card, Checkbox, Link, TextField } from 'ui' - -export function ToggleForm() { - return ( - - - -
- - -
-
- Remember me - - Forgot password? - -
-
- - - -
- ) -} diff --git a/app/(app)/themes/blocks/login-form.tsx b/app/(app)/themes/blocks/login-form.tsx new file mode 100644 index 00000000..85c41771 --- /dev/null +++ b/app/(app)/themes/blocks/login-form.tsx @@ -0,0 +1,27 @@ +'use client' + +import { Button, Card, Checkbox, Link, TextField } from 'ui' + +export function LoginForm() { + return ( + + + Login + Don't loose the level, just keep on going. + + + + +
+ Remember me + + Forgot password? + +
+
+ + + +
+ ) +} diff --git a/app/(app)/themes/blocks/range-calendar-blocks.tsx b/app/(app)/themes/blocks/range-calendar-blocks.tsx new file mode 100644 index 00000000..069b03f5 --- /dev/null +++ b/app/(app)/themes/blocks/range-calendar-blocks.tsx @@ -0,0 +1,24 @@ +'use client' + +import { Button, Calendar, Card, Checkbox, Link, RangeCalendar, TextField } from 'ui' +import React from 'react' +import { getLocalTimeZone, parseDate, today } from '@internationalized/date' +import { useDateFormatter } from '@react-aria/i18n' + +export function RangeCalendarBlocks() { + const now = today(getLocalTimeZone()) + const tomorrowWeek = today(getLocalTimeZone()).add({ days: 12 }) + + const [value, setValue] = React.useState({ + start: now, + end: tomorrowWeek + }) + return ( + + + + ) +} diff --git a/app/(app)/themes/page.tsx b/app/(app)/themes/page.tsx index d85bfae0..5a0cddf1 100644 --- a/app/(app)/themes/page.tsx +++ b/app/(app)/themes/page.tsx @@ -1,6 +1,7 @@ -import { Header } from '@/components/header' -import { siteConfig } from '@/resources/config/site' +import { Header } from '@/components/header'; +import { siteConfig } from '@/resources/config/site'; import type { Metadata } from 'next' +import { Themes } from '@/app/(app)/themes/themes' export const metadata: Metadata = { title: 'Themes / ' + siteConfig.name, @@ -17,7 +18,7 @@ export default function Page() { es - {/**/} +
) } diff --git a/app/(app)/themes/themes-list.ts b/app/(app)/themes/themes-list.ts new file mode 100644 index 00000000..20d3e41b --- /dev/null +++ b/app/(app)/themes/themes-list.ts @@ -0,0 +1,122 @@ +type ThemeProps = 'default' | 'zinc' | 'slate' +type ThemeVariables = { + [key: string]: string; +}; +const themesList: Record = { + default: { + root: { + '--light': '0 0% 98.04%', + '--dark': '240 10% 6%', + '--background': '0 0% 100%', + '--fg': '240 10% 3.9%', + '--overlay': '0 0% 100%', + '--overlay-fg': '240 10% 3.9%', + '--primary': '216 98% 52%', + '--primary-fg': '0 0% 100%', + '--secondary': '240 4.8% 95.9%', + '--secondary-fg': '240 5.9% 10%', + '--tertiary': '0 0% 100%', + '--tertiary-fg': '240 4% 16%', + '--success': '152 69% 31%', + '--success-fg': '0 0% 100%', + '--info': '81.97 84.52% 67.06%', + '--info-fg': '89.27 80.39% 10%', + '--muted': '240 4.8% 95.9%', + '--muted-fg': '240 3.8% 46.1%', + '--danger': '0 72.22% 50.59%', + '--danger-fg': '0 85.71% 97.25%', + '--warning': '43.26 96.41% 56.27%', + '--warning-fg': '20.91 91.67% 14.12%', + '--border': '240 5.9% 90%', + '--input': '240 5.9% 90%', + '--ring': 'var(--primary)', + '--toggle': '240 5% 84%', + '--radius': '0.55rem', + }, + dark: { + '--background': '0 0% 0%', + '--fg': '0 0% 98%', + '--overlay': '240 6% 6%', + '--overlay-fg': '0 0% 98%', + '--secondary': '240 3.7% 15.9%', + '--secondary-fg': '0 0% 98%', + '--info': '84.91 100% 66.47%', + '--info-fg': '120 100% 13.14%', + '--tertiary': '240 10% 5.5%', + '--tertiary-fg': '240 5% 96%', + '--ring': 'var(--primary)', + '--muted': '240 3.7% 15.9%', + '--muted-fg': '240 5% 64.9%', + '--toggle': '240 5% 26%', + '--border': '240 7% 15%', + '--input': '240 3.7% 15.9%', + }, + }, + zinc: { + root: { + '--light': '0 0% 98.04%', + '--dark': '240 10% 6%', + '--background': '0 0% 100%', + '--fg': '240 10% 3.9%', + '--overlay': '0 0% 100%', + '--overlay-fg': '240 10% 3.9%', + '--primary': '240 10% 3.92%', + '--primary-fg': '0 0% 98.04%', + '--secondary': '240 4.8% 95.9%', + '--secondary-fg': '240 5.9% 10%', + '--tertiary': '0 0% 100%', + '--tertiary-fg': '240 4% 16%', + '--success': '152 69% 31%', + '--success-fg': '0 0% 100%', + '--muted': '240 4.8% 95.9%', + '--muted-fg': '240 3.8% 46.1%', + '--border': '240 5.9% 90%', + '--input': '240 5.9% 90%', + '--ring': 'var(--primary)', + '--toggle': '240 5% 84%', + }, + dark: { + '--background': '0 0% 0%', + '--fg': '0 0% 98%', + '--overlay': '240 6% 6%', + '--overlay-fg': '0 0% 98%', + '--secondary': '240 3.7% 15.9%', + '--secondary-fg': '0 0% 98%', + '--tertiary': '240 10% 5.5%', + '--tertiary-fg': '240 5% 96%', + '--ring': 'var(--primary)', + '--muted': '240 3.7% 15.9%', + '--muted-fg': '240 5% 64.9%', + '--toggle': '240 5% 26%', + '--border': '240 7% 15%', + '--input': '240 3.7% 15.9%', + }, + }, + slate: { + root: { + '--light': '228.57 84% 4.9%', + '--dark': '210 40% 98.04%', + '--background': '0 0% 100%', + '--fg': '228.57 84% 4.9%', + '--overlay': '210 40% 98.04%', + '--overlay-fg': '228.57 84% 4.9%', + '--secondary': '210 40% 96.08%', + '--secondary-fg': '228.57 84% 4.9%', + '--border': '215.38 16.32% 46.86%', + '--input': '212.73 26.83% 83.92%', + }, + dark: { + '--background': '228.57 84% 4.9%', + '--fg': '210 40% 98.04%', + '--overlay': '222.22 47.37% 11.18%', + '--overlay-fg': '210 40% 96.08%', + '--secondary': '222.22 47.37% 11.18%', + '--secondary-fg': '210 40% 96.08%', + '--border': '215 20.22% 65.1%', + '--input': '215.29 25% 26.67%', + }, + }, +}; + +export type {ThemeProps} +export {themesList} diff --git a/app/(app)/themes/themes.tsx b/app/(app)/themes/themes.tsx index 3a19d3d5..aba171f0 100644 --- a/app/(app)/themes/themes.tsx +++ b/app/(app)/themes/themes.tsx @@ -1,13 +1,54 @@ -import { Container } from 'ui' +'use client'; + +import React from 'react'; + + + +import { Button, Container } from 'ui'; + + + +import { Blocks } from './blocks'; +import type { ThemeProps } from './themes-list' +import { themesList } from './themes-list'; -import { Blocks } from './blocks' -import { Controller } from './controller' export function Themes() { + const themeContainerRef = React.useRef(null) + const applyTheme = (theme: ThemeProps) => { + const themeVars = themesList[theme].root + const darkThemeVars = themesList[theme].dark + + const themeElement = themeContainerRef.current + if (themeElement) { + Object.keys(themeVars).forEach((key) => { + themeElement.style.setProperty(key, themeVars[key]) + }) + + if (document.documentElement.classList.contains('dark')) { + Object.keys(darkThemeVars).forEach((key) => { + themeElement.style.setProperty(key, darkThemeVars[key]) + }) + } + } + localStorage.setItem('theme-id', theme); + } + React.useEffect(() => { + const savedTheme = localStorage.getItem('theme-id') as ThemeProps; + if (savedTheme) { + applyTheme(savedTheme); + } + }, []); return ( - - - - +
+ +
+ + + +
+ +
+
) } diff --git a/components/ui/button.tsx b/components/ui/button.tsx index 9a07cbc8..ba9b5846 100644 --- a/components/ui/button.tsx +++ b/components/ui/button.tsx @@ -61,9 +61,9 @@ const buttonStyles = tv( solid: 'border-transparent bg-[--btn-border] dark:bg-[--btn-bg] before:absolute before:inset-0 before:-z-10 before:bg-[--btn-bg] before:shadow dark:before:hidden dark:border-white/5 after:absolute after:inset-0 after:-z-10 after:shadow-[shadow:inset_0_1px_theme(colors.white/15%)] after:active:bg-[--btn-hover-overlay] after:hover:bg-[--btn-hover-overlay] dark:after:-inset-px before:data-[disabled]:shadow-none after:data-[disabled]:shadow-none', outline: - 'border-border hover:bg-secondary/90 active:bg-secondary/90 text-fg [--btn-icon:theme(colors.zinc.400)] active:[--btn-icon:theme(colors.zinc.500)] hover:[--btn-icon:theme(colors.zinc.500)] dark:active:[--btn-icon:theme(colors.zinc.300)] dark:hover:[--btn-icon:theme(colors.zinc.300)]', + 'border-border hover:bg-secondary/90 active:bg-secondary/90 text-fg [--btn-icon:theme(colors.zinc.400)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]', plain: - 'border-transparent text-fg pressed:bg-secondary/90 active:bg-fg/5 hover:bg-fg/5 [--btn-icon:theme(colors.zinc.500)] active:[--btn-icon:theme(colors.zinc.700)] hover:[--btn-icon:theme(colors.zinc.700)] dark:[--btn-icon:theme(colors.zinc.500)] dark:active:[--btn-icon:theme(colors.zinc.400)] dark:hover:[--btn-icon:theme(colors.zinc.400)]' + 'border-transparent text-fg pressed:bg-secondary/90 active:bg-secondary/90 hover:bg-secondary/90 [--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]' }, size: { 'extra-small': diff --git a/components/ui/field.tsx b/components/ui/field.tsx index 3700e7bb..9e2df5ae 100644 --- a/components/ui/field.tsx +++ b/components/ui/field.tsx @@ -33,7 +33,7 @@ interface FieldProps { // primitive styles const fieldBorderStyles = tv({ - base: 'group-focus-within:border-primary forced-colors:border-[Highlight]', + base: 'group-focus-within:border-ring forced-colors:border-[Highlight]', variants: { isInvalid: { true: 'border-danger/70 group-focus-within:border-danger/70 forced-colors:border-[Mark]' @@ -78,7 +78,7 @@ const FieldError = ({ className, ...props }: FieldErrorProps) => { const fieldGroupStyles = tv({ base: [ 'group flex h-10 items-center overflow-hidden rounded-lg border border-input bg-background transition disabled:opacity-50 disabled:bg-secondary forced-colors:bg-[Field]', - 'focus-within:border-primary focus-within:ring-4 focus-within:ring-primary/20', + 'focus-within:border-ring focus-within:ring-4 focus-within:ring-ring/20', 'focus-within:invalid:border-danger focus-within:invalid:ring-4 focus-within:invalid:ring-danger/20', 'invalid:border-danger', 'has-[.isPfx]:pl-2.5 has-[.isSfx]:pr-2.5 [&_[data-slot=icon]]:size-4 has-[.atrs]:shrink-0 has-[.atrs]:text-muted-fg' diff --git a/components/ui/input-otp.tsx b/components/ui/input-otp.tsx index 2cd2d40b..6621c37a 100644 --- a/components/ui/input-otp.tsx +++ b/components/ui/input-otp.tsx @@ -44,7 +44,7 @@ const InputOTPSlot = React.forwardRef< ref={ref} className={cn( 'relative flex size-10 items-center justify-center rounded-md border border-input text-sm transition-all', - isActive && 'z-10 border-primary/70 ring-4 ring-primary/20', + isActive && 'z-10 border-ring/70 ring-4 ring-ring/20', className )} {...props} diff --git a/components/ui/link.tsx b/components/ui/link.tsx index faff68ef..2daba1e3 100644 --- a/components/ui/link.tsx +++ b/components/ui/link.tsx @@ -11,12 +11,12 @@ const linkStyles = tv({ intent: { unstyled: 'text-fg', primary: - 'text-primary-600 hover:text-primary-500 dark:text-primary-500 dark:hover:text-primary-400 forced-colors:disabled:text-[GrayText]', + 'text-primary hover:text-primary/80 forced-colors:disabled:text-[GrayText]', danger: - 'text-red-600 hover:text-red-500 dark:text-red-500 dark:hover:text-red-400 forced-colors:disabled:text-[GrayText]', + 'text-danger hover:text-danger/80 forced-colors:disabled:text-[GrayText]', 'lad/primary': - 'text-fg hover:text-primary-500 dark:hover:text-primary-400 forced-colors:disabled:text-[GrayText]', - secondary: 'text-zinc-800 dark:text-zinc-300 hover:text-zinc-700 dark:hover:text-zinc-white' + 'text-fg hover:text-primary dark:hover:text-primary/80 forced-colors:disabled:text-[GrayText]', + secondary: 'text-secondary-fg hover:text-secondary-fg/80' } }, defaultVariants: { diff --git a/components/ui/primitive.tsx b/components/ui/primitive.tsx index 7660452a..bd037e74 100644 --- a/components/ui/primitive.tsx +++ b/components/ui/primitive.tsx @@ -19,7 +19,7 @@ const composeTailwindRenderProps = ( const focusRing = tv({ base: 'outline-none focus:outline-none forced-colors:outline-[Highlight]', variants: { - isFocused: { true: 'ring-4 ring-primary/20' }, + isFocused: { true: 'ring-4 ring-ring/20' }, isInvalid: { true: 'ring-4 ring-danger/20' } } }) @@ -43,13 +43,13 @@ const isIos = (userAgent?: string): boolean => { const focusStyles = tv({ extend: focusRing, variants: { - isFocused: { true: 'border-primary' }, + isFocused: { true: 'border-ring' }, isInvalid: { true: 'border-danger' } } }) const focusButtonStyles = tv({ - base: 'outline outline-primary forced-colors:outline-[Highlight] outline-offset-2', + base: 'outline outline-ring forced-colors:outline-[Highlight] outline-offset-2', variants: { isFocusVisible: { false: 'outline-0', diff --git a/resources/content/docs/getting-started/installation.mdx b/resources/content/docs/getting-started/installation.mdx index 6f539a3f..038402e7 100644 --- a/resources/content/docs/getting-started/installation.mdx +++ b/resources/content/docs/getting-started/installation.mdx @@ -191,7 +191,7 @@ Below that, insert the following code: --border: 240 5.9% 90%; --input: 240 5.9% 90%; - --ring: 211 100% 58%; + --ring: var(--primary); --toggle: 240 5% 84%; --radius: 0.55rem; } @@ -214,6 +214,7 @@ Below that, insert the following code: --muted: 240 3.7% 15.9%; --muted-fg: 240 5% 64.9%; + --ring: var(--primary); --toggle: 240 5% 26%; --border: 240 7% 15%; --input: 240 3.7% 15.9%; diff --git a/resources/styles/app.css b/resources/styles/app.css index 0ffc52fe..80f58de0 100644 --- a/resources/styles/app.css +++ b/resources/styles/app.css @@ -38,7 +38,7 @@ --border: 240 5.9% 90%; --input: 240 5.9% 90%; - --ring: 211 100% 58%; + --ring: var(--primary); --toggle: 240 5% 84%; --radius: 0.55rem; } @@ -58,7 +58,7 @@ --tertiary: 240 10% 5.5%; --tertiary-fg: 240 5% 96%; - + --ring: var(--primary); --muted: 240 3.7% 15.9%; --muted-fg: 240 5% 64.9%; --toggle: 240 5% 26%; @@ -132,10 +132,6 @@ outline: 1px solid hsl(var(--primary)); } -.recharts-rectangle.recharts-tooltip-cursor { - @apply fill-zinc-300/10; -} - @layer components { .no-scrollbar { -ms-overflow-style: none; /* Internet Explorer and Edge */ From 88f28d19381c8b582296c3bf7bd540940470ba8a Mon Sep 17 00:00:00 2001 From: "Irsyad A. Panjaitan" Date: Fri, 16 Aug 2024 22:39:44 +0700 Subject: [PATCH 2/6] ff --- app/(app)/colors/(colors)/color-item.tsx | 7 +--- app/(app)/themes/blocks.tsx | 4 +-- app/(app)/themes/blocks/buttons.tsx | 8 +++-- .../themes/blocks/range-calendar-blocks.tsx | 8 ++--- app/(app)/themes/page.tsx | 8 ++--- app/(app)/themes/themes-list.ts | 30 ++++++++-------- app/(app)/themes/themes.tsx | 35 ++++++++++--------- components/docs/generated/previews.json | 10 +++--- components/ui/link.tsx | 6 ++-- 9 files changed, 56 insertions(+), 60 deletions(-) diff --git a/app/(app)/colors/(colors)/color-item.tsx b/app/(app)/colors/(colors)/color-item.tsx index 13730d8f..c378cd44 100644 --- a/app/(app)/colors/(colors)/color-item.tsx +++ b/app/(app)/colors/(colors)/color-item.tsx @@ -18,12 +18,7 @@ interface ColorItemProps extends ListBoxItemProps { selectedFormat: FormatOnlyForTailwindVariableType | ColorFormat } -const ColorItem = ({ - item, - name, - isForTailwindVariable, - selectedFormat -}: ColorItemProps) => { +const ColorItem = ({ item, name, isForTailwindVariable, selectedFormat }: ColorItemProps) => { const [copied, setCopied] = React.useState(false) const handleCopy = async (selectedColor: string) => { const toCopy = isForTailwindVariable diff --git a/app/(app)/themes/blocks.tsx b/app/(app)/themes/blocks.tsx index 74539043..e6ea0542 100644 --- a/app/(app)/themes/blocks.tsx +++ b/app/(app)/themes/blocks.tsx @@ -1,9 +1,9 @@ 'use client' -import { LoginForm } from './blocks/login-form' -import { RangeCalendarBlocks } from '@/app/(app)/themes/blocks/range-calendar-blocks' import { Buttons } from '@/app/(app)/themes/blocks/buttons' +import { RangeCalendarBlocks } from '@/app/(app)/themes/blocks/range-calendar-blocks' +import { LoginForm } from './blocks/login-form' export function Blocks() { return ( diff --git a/app/(app)/themes/blocks/buttons.tsx b/app/(app)/themes/blocks/buttons.tsx index 7c153349..d8f270e0 100644 --- a/app/(app)/themes/blocks/buttons.tsx +++ b/app/(app)/themes/blocks/buttons.tsx @@ -16,10 +16,14 @@ export function Buttons() {
- Remember me + + Remember me + - Toggle Theme + + Toggle Theme +
) diff --git a/app/(app)/themes/blocks/range-calendar-blocks.tsx b/app/(app)/themes/blocks/range-calendar-blocks.tsx index 069b03f5..f0963f9e 100644 --- a/app/(app)/themes/blocks/range-calendar-blocks.tsx +++ b/app/(app)/themes/blocks/range-calendar-blocks.tsx @@ -1,9 +1,10 @@ 'use client' -import { Button, Calendar, Card, Checkbox, Link, RangeCalendar, TextField } from 'ui' import React from 'react' + import { getLocalTimeZone, parseDate, today } from '@internationalized/date' import { useDateFormatter } from '@react-aria/i18n' +import { Button, Calendar, Card, Checkbox, Link, RangeCalendar, TextField } from 'ui' export function RangeCalendarBlocks() { const now = today(getLocalTimeZone()) @@ -15,10 +16,7 @@ export function RangeCalendarBlocks() { }) return ( - + ) } diff --git a/app/(app)/themes/page.tsx b/app/(app)/themes/page.tsx index 5a0cddf1..0ac39e77 100644 --- a/app/(app)/themes/page.tsx +++ b/app/(app)/themes/page.tsx @@ -1,7 +1,7 @@ -import { Header } from '@/components/header'; -import { siteConfig } from '@/resources/config/site'; -import type { Metadata } from 'next' import { Themes } from '@/app/(app)/themes/themes' +import { Header } from '@/components/header' +import { siteConfig } from '@/resources/config/site' +import type { Metadata } from 'next' export const metadata: Metadata = { title: 'Themes / ' + siteConfig.name, @@ -18,7 +18,7 @@ export default function Page() { es - +
) } diff --git a/app/(app)/themes/themes-list.ts b/app/(app)/themes/themes-list.ts index 20d3e41b..16abc9c1 100644 --- a/app/(app)/themes/themes-list.ts +++ b/app/(app)/themes/themes-list.ts @@ -1,7 +1,7 @@ type ThemeProps = 'default' | 'zinc' | 'slate' type ThemeVariables = { - [key: string]: string; -}; + [key: string]: string +} const themesList: Record = { default: { root: { @@ -31,7 +31,7 @@ const themesList: Record(null) @@ -31,21 +26,27 @@ export function Themes() { }) } } - localStorage.setItem('theme-id', theme); + localStorage.setItem('theme-id', theme) } React.useEffect(() => { - const savedTheme = localStorage.getItem('theme-id') as ThemeProps; + const savedTheme = localStorage.getItem('theme-id') as ThemeProps if (savedTheme) { - applyTheme(savedTheme); + applyTheme(savedTheme) } - }, []); + }, []) return (
- - - + + +
diff --git a/components/docs/generated/previews.json b/components/docs/generated/previews.json index 69ad3b30..af830d1c 100644 --- a/components/docs/generated/previews.json +++ b/components/docs/generated/previews.json @@ -1706,7 +1706,7 @@ }, "link": { "component": "@/components/ui/link", - "raw": "'use client'\n\nimport { Link as LinkPrimitive, type LinkProps as LinkPrimitiveProps } from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr } from './primitive'\n\nconst linkStyles = tv({\n base: 'forced-colors:outline-[Highlight] focus-visible:outline-2 outline outline-offset-2 disabled:focus-visible:outline-0 outline-0 outline-primary rounded disabled:opacity-60 forced-colors:disabled:text-[GrayText] border-transparent transition-colors disabled:cursor-default',\n variants: {\n intent: {\n unstyled: 'text-fg',\n primary:\n 'text-primary-600 hover:text-primary-500 dark:text-primary-500 dark:hover:text-primary-400 forced-colors:disabled:text-[GrayText]',\n danger:\n 'text-red-600 hover:text-red-500 dark:text-red-500 dark:hover:text-red-400 forced-colors:disabled:text-[GrayText]',\n 'lad/primary':\n 'text-fg hover:text-primary-500 dark:hover:text-primary-400 forced-colors:disabled:text-[GrayText]',\n secondary: 'text-zinc-800 dark:text-zinc-300 hover:text-zinc-700 dark:hover:text-zinc-white'\n }\n },\n defaultVariants: {\n intent: 'unstyled'\n }\n})\n\ninterface LinkProps extends LinkPrimitiveProps {\n intent?: 'primary' | 'secondary' | 'danger' | 'lad/primary' | 'unstyled'\n}\n\nconst Link = ({ className, ...props }: LinkProps) => {\n return (\n \n linkStyles({ ...renderProps, intent: props.intent, className })\n )}\n />\n )\n}\n\nexport { Link, LinkPrimitive, type LinkPrimitiveProps, type LinkProps }\n", + "raw": "'use client'\n\nimport { Link as LinkPrimitive, type LinkProps as LinkPrimitiveProps } from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr } from './primitive'\n\nconst linkStyles = tv({\n base: 'forced-colors:outline-[Highlight] focus-visible:outline-2 outline outline-offset-2 disabled:focus-visible:outline-0 outline-0 outline-primary rounded disabled:opacity-60 forced-colors:disabled:text-[GrayText] border-transparent transition-colors disabled:cursor-default',\n variants: {\n intent: {\n unstyled: 'text-fg',\n primary: 'text-primary hover:text-primary/80 forced-colors:disabled:text-[GrayText]',\n danger: 'text-danger hover:text-danger/80 forced-colors:disabled:text-[GrayText]',\n 'lad/primary':\n 'text-fg hover:text-primary dark:hover:text-primary/80 forced-colors:disabled:text-[GrayText]',\n secondary: 'text-secondary-fg hover:text-secondary-fg/80'\n }\n },\n defaultVariants: {\n intent: 'unstyled'\n }\n})\n\ninterface LinkProps extends LinkPrimitiveProps {\n intent?: 'primary' | 'secondary' | 'danger' | 'lad/primary' | 'unstyled'\n}\n\nconst Link = ({ className, ...props }: LinkProps) => {\n return (\n \n linkStyles({ ...renderProps, intent: props.intent, className })\n )}\n />\n )\n}\n\nexport { Link, LinkPrimitive, type LinkPrimitiveProps, type LinkProps }\n", "type": "ui" }, "tabs": { @@ -1751,7 +1751,7 @@ }, "primitive": { "component": "@/components/ui/primitive", - "raw": "'use client'\n\nimport * as React from 'react'\n\nimport { type ClassValue, clsx } from 'clsx'\nimport { composeRenderProps } from 'react-aria-components'\nimport { twMerge } from 'tailwind-merge'\nimport { tv } from 'tailwind-variants'\n\nconst cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs))\n\nconst composeTailwindRenderProps = (\n className: string | ((v: T) => string) | undefined,\n tw: string\n): string | ((v: T) => string) => {\n return composeRenderProps(className, (className) => twMerge(tw, className))\n}\n\nconst focusRing = tv({\n base: 'outline-none focus:outline-none forced-colors:outline-[Highlight]',\n variants: {\n isFocused: { true: 'ring-4 ring-primary/20' },\n isInvalid: { true: 'ring-4 ring-danger/20' }\n }\n})\n\nconst isServerSide = (): boolean => {\n if (typeof window !== 'undefined') {\n return false\n }\n if (typeof process !== 'undefined' && process.versions && process.versions.node) {\n return true\n }\n return true\n}\n\nconst isIos = (userAgent?: string): boolean => {\n if (isServerSide() && !userAgent) return false\n const result = userAgent || navigator.userAgent\n return /iPad|iPhone|iPod|iPadOS|iPhoneOS/.test(result)\n}\n\nconst focusStyles = tv({\n extend: focusRing,\n variants: {\n isFocused: { true: 'border-primary' },\n isInvalid: { true: 'border-danger' }\n }\n})\n\nconst focusButtonStyles = tv({\n base: 'outline outline-primary forced-colors:outline-[Highlight] outline-offset-2',\n variants: {\n isFocusVisible: {\n false: 'outline-0',\n true: 'outline-2'\n }\n }\n})\n\nconst useMediaQuery = (query: string) => {\n const [value, setValue] = React.useState(false)\n\n React.useEffect(() => {\n const onChange = (event: MediaQueryListEvent) => {\n setValue(event.matches)\n }\n\n const result = matchMedia(query)\n result.addEventListener('change', onChange)\n setValue(result.matches)\n\n return () => result.removeEventListener('change', onChange)\n }, [query])\n\n return value\n}\n\nconst ctr = composeTailwindRenderProps\nconst tm = twMerge\nconst cr = composeRenderProps\n\nexport {\n cn,\n composeTailwindRenderProps,\n cr,\n ctr,\n focusRing,\n focusStyles,\n focusButtonStyles,\n tm,\n twMerge,\n useMediaQuery,\n isIos\n}\n", + "raw": "'use client'\n\nimport * as React from 'react'\n\nimport { type ClassValue, clsx } from 'clsx'\nimport { composeRenderProps } from 'react-aria-components'\nimport { twMerge } from 'tailwind-merge'\nimport { tv } from 'tailwind-variants'\n\nconst cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs))\n\nconst composeTailwindRenderProps = (\n className: string | ((v: T) => string) | undefined,\n tw: string\n): string | ((v: T) => string) => {\n return composeRenderProps(className, (className) => twMerge(tw, className))\n}\n\nconst focusRing = tv({\n base: 'outline-none focus:outline-none forced-colors:outline-[Highlight]',\n variants: {\n isFocused: { true: 'ring-4 ring-ring/20' },\n isInvalid: { true: 'ring-4 ring-danger/20' }\n }\n})\n\nconst isServerSide = (): boolean => {\n if (typeof window !== 'undefined') {\n return false\n }\n if (typeof process !== 'undefined' && process.versions && process.versions.node) {\n return true\n }\n return true\n}\n\nconst isIos = (userAgent?: string): boolean => {\n if (isServerSide() && !userAgent) return false\n const result = userAgent || navigator.userAgent\n return /iPad|iPhone|iPod|iPadOS|iPhoneOS/.test(result)\n}\n\nconst focusStyles = tv({\n extend: focusRing,\n variants: {\n isFocused: { true: 'border-ring' },\n isInvalid: { true: 'border-danger' }\n }\n})\n\nconst focusButtonStyles = tv({\n base: 'outline outline-ring forced-colors:outline-[Highlight] outline-offset-2',\n variants: {\n isFocusVisible: {\n false: 'outline-0',\n true: 'outline-2'\n }\n }\n})\n\nconst useMediaQuery = (query: string) => {\n const [value, setValue] = React.useState(false)\n\n React.useEffect(() => {\n const onChange = (event: MediaQueryListEvent) => {\n setValue(event.matches)\n }\n\n const result = matchMedia(query)\n result.addEventListener('change', onChange)\n setValue(result.matches)\n\n return () => result.removeEventListener('change', onChange)\n }, [query])\n\n return value\n}\n\nconst ctr = composeTailwindRenderProps\nconst tm = twMerge\nconst cr = composeRenderProps\n\nexport {\n cn,\n composeTailwindRenderProps,\n cr,\n ctr,\n focusRing,\n focusStyles,\n focusButtonStyles,\n tm,\n twMerge,\n useMediaQuery,\n isIos\n}\n", "type": "ui" }, "visually-hidden": { @@ -1771,7 +1771,7 @@ }, "input-otp": { "component": "@/components/ui/input-otp", - "raw": "'use client'\n\nimport * as React from 'react'\n\nimport { OTPInput, OTPInputContext } from 'input-otp'\nimport { IconBulletFill } from 'justd-icons'\n\nimport { cn } from './primitive'\n\nconst InputOTP = React.forwardRef<\n React.ElementRef,\n React.ComponentPropsWithoutRef\n>(({ className, containerClassName, ...props }, ref) => (\n \n))\nInputOTP.displayName = 'InputOTP'\n\nconst InputOTPGroup = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n
\n))\nInputOTPGroup.displayName = 'InputOTPGroup'\n\nconst InputOTPSlot = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'> & { index: number }\n>(({ index, className, ...props }, ref) => {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]\n\n return (\n \n {char}\n {hasFakeCaret && (\n
\n
\n
\n )}\n
\n )\n})\nInputOTPSlot.displayName = 'InputOTPSlot'\n\nconst InputOTPSeparator = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'>\n>(({ ...props }, ref) => (\n
\n \n
\n))\nInputOTPSeparator.displayName = 'InputOTPSeparator'\n\nexport { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot }\n", + "raw": "'use client'\n\nimport * as React from 'react'\n\nimport { OTPInput, OTPInputContext } from 'input-otp'\nimport { IconBulletFill } from 'justd-icons'\n\nimport { cn } from './primitive'\n\nconst InputOTP = React.forwardRef<\n React.ElementRef,\n React.ComponentPropsWithoutRef\n>(({ className, containerClassName, ...props }, ref) => (\n \n))\nInputOTP.displayName = 'InputOTP'\n\nconst InputOTPGroup = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n
\n))\nInputOTPGroup.displayName = 'InputOTPGroup'\n\nconst InputOTPSlot = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'> & { index: number }\n>(({ index, className, ...props }, ref) => {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]\n\n return (\n \n {char}\n {hasFakeCaret && (\n
\n
\n
\n )}\n
\n )\n})\nInputOTPSlot.displayName = 'InputOTPSlot'\n\nconst InputOTPSeparator = React.forwardRef<\n React.ElementRef<'div'>,\n React.ComponentPropsWithoutRef<'div'>\n>(({ ...props }, ref) => (\n
\n \n
\n))\nInputOTPSeparator.displayName = 'InputOTPSeparator'\n\nexport { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot }\n", "type": "ui" }, "tag-group": { @@ -1786,7 +1786,7 @@ }, "field": { "component": "@/components/ui/field", - "raw": "'use client'\n\nimport * as React from 'react'\n\nimport {\n FieldError as FieldErrorPrimitive,\n type FieldErrorProps,\n Group,\n type GroupProps,\n Input as InputPrimitive,\n type InputProps,\n Label as LabelPrimitive,\n type LabelProps,\n Text,\n type TextFieldProps as TextFieldPrimitiveProps,\n type TextProps,\n type ValidationResult\n} from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr, ctr } from './primitive'\n\n// primitive styles\n\ninterface FieldProps {\n label?: string\n placeholder?: string\n description?: string\n errorMessage?: string | ((validation: ValidationResult) => string)\n 'aria-label'?: TextFieldPrimitiveProps['aria-label']\n 'aria-labelledby'?: TextFieldPrimitiveProps['aria-labelledby']\n}\n\n// primitive styles\nconst fieldBorderStyles = tv({\n base: 'group-focus-within:border-primary forced-colors:border-[Highlight]',\n variants: {\n isInvalid: {\n true: 'border-danger/70 group-focus-within:border-danger/70 forced-colors:border-[Mark]'\n }\n }\n})\n\nconst fieldGroupPrefixStyles = tv({\n base: [\n 'flex group-invalid:border-danger group-disabled:bg-secondary group-disabled:opacity-50 items-center group-invalid:focus-within:ring-danger/20',\n '[&>.x2e2>.kbt32x]:size-7 [&>.x2e2>.kbt32x]:rounded-sm [&>.x2e2:has(.kbt32x)]:size-9 [&>.x2e2:has(.kbt32x)]:grid [&>.x2e2:has(.kbt32x)]:place-items-center',\n '[&>.x2e2>.kbt32x]:before:rounded-[calc(theme(borderRadius.sm)-1px)] [&>.x2e2>.kbt32x]:after:rounded-[calc(theme(borderRadius.sm)-1px)] dark:[&>.x2e2>.kbt32x]:after:rounded-sm',\n '[&>.isSfx:has(.kbt32x)]:-mr-2 [&>.isPfx:has(.kbt32x)]:-ml-2 [&>.isSfx>.kbt32x]:mr-0.5 [&>.isPfx>.kbt32x]:ml-0.5'\n ]\n})\n\nconst fieldStyles = tv({\n slots: {\n description: 'text-pretty text-base/6 text-muted-fg sm:text-sm/6',\n label: 'w-fit cursor-default font-medium text-secondary-fg text-sm',\n fieldError: 'text-sm text-danger forced-colors:text-[Mark]',\n input: [\n 'w-full min-w-0 bg-transparent p-2 text-base text-fg placeholder-muted-fg outline-none focus:outline-none lg:text-sm'\n ]\n }\n})\n\nconst { description, label, fieldError, input } = fieldStyles()\n\nconst Label = ({ className, ...props }: LabelProps) => {\n return \n}\n\nconst Description = ({ className, ...props }: TextProps) => {\n return \n}\n\nconst FieldError = ({ className, ...props }: FieldErrorProps) => {\n return \n}\n\nconst fieldGroupStyles = tv({\n base: [\n 'group flex h-10 items-center overflow-hidden rounded-lg border border-input bg-background transition disabled:opacity-50 disabled:bg-secondary forced-colors:bg-[Field]',\n 'focus-within:border-primary focus-within:ring-4 focus-within:ring-primary/20',\n 'focus-within:invalid:border-danger focus-within:invalid:ring-4 focus-within:invalid:ring-danger/20',\n 'invalid:border-danger',\n 'has-[.isPfx]:pl-2.5 has-[.isSfx]:pr-2.5 [&_[data-slot=icon]]:size-4 has-[.atrs]:shrink-0 has-[.atrs]:text-muted-fg'\n ]\n})\n\nconst FieldGroup = ({ className, ...props }: GroupProps) => {\n return (\n \n fieldGroupStyles({ ...renderProps, className })\n )}\n />\n )\n}\n\nconst Input = React.forwardRef(({ className, ...props }, ref) => {\n return \n})\nInput.displayName = 'Input'\n\nexport {\n Description,\n fieldBorderStyles,\n FieldError,\n FieldGroup,\n fieldGroupPrefixStyles,\n fieldGroupStyles,\n Input,\n InputPrimitive,\n Label,\n type FieldProps\n}\n", + "raw": "'use client'\n\nimport * as React from 'react'\n\nimport {\n FieldError as FieldErrorPrimitive,\n type FieldErrorProps,\n Group,\n type GroupProps,\n Input as InputPrimitive,\n type InputProps,\n Label as LabelPrimitive,\n type LabelProps,\n Text,\n type TextFieldProps as TextFieldPrimitiveProps,\n type TextProps,\n type ValidationResult\n} from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr, ctr } from './primitive'\n\n// primitive styles\n\ninterface FieldProps {\n label?: string\n placeholder?: string\n description?: string\n errorMessage?: string | ((validation: ValidationResult) => string)\n 'aria-label'?: TextFieldPrimitiveProps['aria-label']\n 'aria-labelledby'?: TextFieldPrimitiveProps['aria-labelledby']\n}\n\n// primitive styles\nconst fieldBorderStyles = tv({\n base: 'group-focus-within:border-ring forced-colors:border-[Highlight]',\n variants: {\n isInvalid: {\n true: 'border-danger/70 group-focus-within:border-danger/70 forced-colors:border-[Mark]'\n }\n }\n})\n\nconst fieldGroupPrefixStyles = tv({\n base: [\n 'flex group-invalid:border-danger group-disabled:bg-secondary group-disabled:opacity-50 items-center group-invalid:focus-within:ring-danger/20',\n '[&>.x2e2>.kbt32x]:size-7 [&>.x2e2>.kbt32x]:rounded-sm [&>.x2e2:has(.kbt32x)]:size-9 [&>.x2e2:has(.kbt32x)]:grid [&>.x2e2:has(.kbt32x)]:place-items-center',\n '[&>.x2e2>.kbt32x]:before:rounded-[calc(theme(borderRadius.sm)-1px)] [&>.x2e2>.kbt32x]:after:rounded-[calc(theme(borderRadius.sm)-1px)] dark:[&>.x2e2>.kbt32x]:after:rounded-sm',\n '[&>.isSfx:has(.kbt32x)]:-mr-2 [&>.isPfx:has(.kbt32x)]:-ml-2 [&>.isSfx>.kbt32x]:mr-0.5 [&>.isPfx>.kbt32x]:ml-0.5'\n ]\n})\n\nconst fieldStyles = tv({\n slots: {\n description: 'text-pretty text-base/6 text-muted-fg sm:text-sm/6',\n label: 'w-fit cursor-default font-medium text-secondary-fg text-sm',\n fieldError: 'text-sm text-danger forced-colors:text-[Mark]',\n input: [\n 'w-full min-w-0 bg-transparent p-2 text-base text-fg placeholder-muted-fg outline-none focus:outline-none lg:text-sm'\n ]\n }\n})\n\nconst { description, label, fieldError, input } = fieldStyles()\n\nconst Label = ({ className, ...props }: LabelProps) => {\n return \n}\n\nconst Description = ({ className, ...props }: TextProps) => {\n return \n}\n\nconst FieldError = ({ className, ...props }: FieldErrorProps) => {\n return \n}\n\nconst fieldGroupStyles = tv({\n base: [\n 'group flex h-10 items-center overflow-hidden rounded-lg border border-input bg-background transition disabled:opacity-50 disabled:bg-secondary forced-colors:bg-[Field]',\n 'focus-within:border-ring focus-within:ring-4 focus-within:ring-ring/20',\n 'focus-within:invalid:border-danger focus-within:invalid:ring-4 focus-within:invalid:ring-danger/20',\n 'invalid:border-danger',\n 'has-[.isPfx]:pl-2.5 has-[.isSfx]:pr-2.5 [&_[data-slot=icon]]:size-4 has-[.atrs]:shrink-0 has-[.atrs]:text-muted-fg'\n ]\n})\n\nconst FieldGroup = ({ className, ...props }: GroupProps) => {\n return (\n \n fieldGroupStyles({ ...renderProps, className })\n )}\n />\n )\n}\n\nconst Input = React.forwardRef(({ className, ...props }, ref) => {\n return \n})\nInput.displayName = 'Input'\n\nexport {\n Description,\n fieldBorderStyles,\n FieldError,\n FieldGroup,\n fieldGroupPrefixStyles,\n fieldGroupStyles,\n Input,\n InputPrimitive,\n Label,\n type FieldProps\n}\n", "type": "ui" }, "drop-zone": { @@ -1946,7 +1946,7 @@ }, "button": { "component": "@/components/ui/button", - "raw": "'use client'\n\nimport * as React from 'react'\n\nimport {\n Button as ButtonPrimitive,\n type ButtonProps as ButtonPrimitiveProps\n} from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr, focusButtonStyles } from './primitive'\n\nconst buttonStyles = tv(\n {\n extend: focusButtonStyles,\n base: [\n 'kbt32x relative no-underline isolate inline-flex items-center justify-center gap-x-2 border font-medium',\n 'forced-colors:[--btn-icon:ButtonText] forced-colors:hover:[--btn-icon:ButtonText] [&>[data-slot=icon]]:-mx-0.5 [&>[data-slot=icon]]:my-1 [&>[data-slot=icon]]:size-4 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[--btn-icon]'\n ],\n variants: {\n intent: {\n primary: [\n 'text-white [--btn-bg:theme(colors.primary.DEFAULT)] [--btn-border:theme(colors.primary.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.primary.fg/60%)] active:[--btn-icon:theme(colors.primary.fg/80%)] hover:[--btn-icon:theme(colors.primary.fg/80%)]'\n ],\n secondary: [\n 'text-secondary-fg [--btn-bg:white] dark:[--btn-bg:theme(colors.secondary.DEFAULT)] [--btn-border:theme(colors.secondary.fg/10%)] [--btn-hover-overlay:theme(colors.secondary.fg/2.5%)] data-[active]:[--btn-border:theme(colors.secondary.fg/15%)] hover:[--btn-border:theme(colors.secondary.fg/15%)]',\n '[--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]'\n ],\n success: [\n 'text-white [--btn-bg:theme(colors.success.DEFAULT)] [--btn-border:theme(colors.success.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.white/60%)] active:[--btn-icon:theme(colors.white/80%)] hover:[--btn-icon:theme(colors.white/80%)]'\n ],\n 'light/dark': [\n 'text-background [--btn-bg:theme(colors.dark)] [--btn-border:theme(colors.dark/90%)] [--btn-hover-overlay:theme(colors.white/10%)]',\n 'dark:[--btn-bg:white] dark:[--btn-hover-overlay:theme(colors.dark/5%)]',\n '[--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.background/85%)] hover:[--btn-icon:theme(colors.background/85%)]'\n ],\n dark: [\n 'text-light [--btn-bg:theme(colors.dark)] [--btn-border:theme(colors.dark)] [--btn-hover-overlay:theme(colors.light/2.5%)]',\n '[--btn-icon:theme(colors.light/60%)] active:[--btn-icon:theme(colors.light/80%)] hover:[--btn-icon:theme(colors.light/80%)]'\n ],\n light: [\n 'text-dark [--btn-bg:white] [--btn-border:theme(colors.dark/10%)] [--btn-hover-overlay:theme(colors.dark/2.5%)] active:[--btn-border:theme(colors.dark/15%)] hover:[--btn-border:theme(colors.dark/15%)]',\n '[--btn-icon:theme(colors.dark/60%)] active:[--btn-icon:theme(colors.dark/80%)] hover:[--btn-icon:theme(colors.dark/80%)]'\n ],\n info: [\n 'text-info-fg [--btn-bg:theme(colors.info.DEFAULT)] [--btn-border:theme(colors.info.DEFAULT/80%)] [--btn-hover-overlay:theme(colors.white/25%)]',\n '[--btn-icon:theme(colors.info.fg/60%)] active:[--btn-icon:theme(colors.info.fg/80%)] hover:[--btn-icon:theme(colors.info.fg/80%)]'\n ],\n warning: [\n 'text-warning-fg [--btn-bg:theme(colors.warning.DEFAULT)] [--btn-border:theme(colors.warning.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.warning.fg/60%)] active:[--btn-icon:theme(colors.warning.fg/80%)] hover:[--btn-icon:theme(colors.warning.fg/80%)]'\n ],\n danger: [\n 'text-white [--btn-bg:theme(colors.danger.DEFAULT)] [--btn-border:theme(colors.danger.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.white/60%)] active:[--btn-icon:theme(colors.white/80%)] hover:[--btn-icon:theme(colors.white/80%)]'\n ]\n },\n appearance: {\n solid:\n 'border-transparent bg-[--btn-border] dark:bg-[--btn-bg] before:absolute before:inset-0 before:-z-10 before:bg-[--btn-bg] before:shadow dark:before:hidden dark:border-white/5 after:absolute after:inset-0 after:-z-10 after:shadow-[shadow:inset_0_1px_theme(colors.white/15%)] after:active:bg-[--btn-hover-overlay] after:hover:bg-[--btn-hover-overlay] dark:after:-inset-px before:data-[disabled]:shadow-none after:data-[disabled]:shadow-none',\n outline:\n 'border-border hover:bg-secondary/90 active:bg-secondary/90 text-fg [--btn-icon:theme(colors.zinc.400)] active:[--btn-icon:theme(colors.zinc.500)] hover:[--btn-icon:theme(colors.zinc.500)] dark:active:[--btn-icon:theme(colors.zinc.300)] dark:hover:[--btn-icon:theme(colors.zinc.300)]',\n plain:\n 'border-transparent text-fg pressed:bg-secondary/90 active:bg-fg/5 hover:bg-fg/5 [--btn-icon:theme(colors.zinc.500)] active:[--btn-icon:theme(colors.zinc.700)] hover:[--btn-icon:theme(colors.zinc.700)] dark:[--btn-icon:theme(colors.zinc.500)] dark:active:[--btn-icon:theme(colors.zinc.400)] dark:hover:[--btn-icon:theme(colors.zinc.400)]'\n },\n size: {\n 'extra-small':\n 'h-8 px-[calc(theme(spacing.3)-1px)] py-[calc(theme(spacing.1)-1px)] text-xs/4 lg:text-[0.800rem]/4',\n small:\n 'h-9 px-[calc(theme(spacing.4)-1px)] py-[calc(theme(spacing[1.5])-1px)] text-sm/5 lg:text-sm/5',\n medium:\n 'h-10 px-[calc(theme(spacing.4)-1px)] py-[calc(theme(spacing.2)-1px)] text-base lg:text-sm/6',\n large:\n 'h-10 sm:h-11 px-[calc(theme(spacing.4)-1px)] sm:px-[calc(theme(spacing.5)-1px)] py-[calc(theme(spacing[2.5])-1px)] text-base lg:text-base/7 sm:[&>[data-slot=icon]]:size-5',\n 'square-petite': 'size-9 shrink-0 [&_[data-slot=icon]]:text-current'\n },\n shape: {\n square:\n 'rounded-lg before:rounded-[calc(theme(borderRadius.lg)-1px)] after:rounded-[calc(theme(borderRadius.lg)-1px)] dark:after:rounded-lg',\n circle:\n 'rounded-[9999px] before:rounded-[9998px] after:rounded-[9998px] dark:after:rounded-[9999px]'\n },\n isDisabled: {\n false: 'forced-colors:disabled:text-[GrayText]',\n true: 'cursor-default opacity-60 forced-colors:disabled:text-[GrayText]'\n }\n },\n defaultVariants: {\n intent: 'primary',\n appearance: 'solid',\n size: 'medium',\n shape: 'square'\n },\n compoundVariants: [\n {\n appearance: ['outline', 'plain'],\n className: 'px-1',\n size: 'extra-small'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.1)-1px)]',\n size: 'small'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.2)-1px)]',\n size: 'medium'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.3)-1px)]',\n size: 'large'\n }\n ]\n },\n {\n responsiveVariants: ['sm', 'md', 'lg', 'xl']\n }\n)\n\ninterface ButtonProps extends ButtonPrimitiveProps {\n intent?:\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'warning'\n | 'info'\n | 'light/dark'\n | 'success'\n | 'light'\n | 'dark'\n size?: 'medium' | 'large' | 'square-petite' | 'extra-small' | 'small'\n shape?: 'square' | 'circle'\n appearance?: 'solid' | 'outline' | 'plain'\n}\n\nconst Button = React.forwardRef(\n ({ className, intent, appearance, size, shape, ...props }, ref) => {\n return (\n \n buttonStyles({\n ...renderProps,\n intent,\n appearance,\n size,\n shape,\n className\n })\n )}\n />\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport { Button, ButtonPrimitive, buttonStyles, type ButtonProps }\n", + "raw": "'use client'\n\nimport * as React from 'react'\n\nimport {\n Button as ButtonPrimitive,\n type ButtonProps as ButtonPrimitiveProps\n} from 'react-aria-components'\nimport { tv } from 'tailwind-variants'\n\nimport { cr, focusButtonStyles } from './primitive'\n\nconst buttonStyles = tv(\n {\n extend: focusButtonStyles,\n base: [\n 'kbt32x relative no-underline isolate inline-flex items-center justify-center gap-x-2 border font-medium',\n 'forced-colors:[--btn-icon:ButtonText] forced-colors:hover:[--btn-icon:ButtonText] [&>[data-slot=icon]]:-mx-0.5 [&>[data-slot=icon]]:my-1 [&>[data-slot=icon]]:size-4 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[--btn-icon]'\n ],\n variants: {\n intent: {\n primary: [\n 'text-white [--btn-bg:theme(colors.primary.DEFAULT)] [--btn-border:theme(colors.primary.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.primary.fg/60%)] active:[--btn-icon:theme(colors.primary.fg/80%)] hover:[--btn-icon:theme(colors.primary.fg/80%)]'\n ],\n secondary: [\n 'text-secondary-fg [--btn-bg:white] dark:[--btn-bg:theme(colors.secondary.DEFAULT)] [--btn-border:theme(colors.secondary.fg/10%)] [--btn-hover-overlay:theme(colors.secondary.fg/2.5%)] data-[active]:[--btn-border:theme(colors.secondary.fg/15%)] hover:[--btn-border:theme(colors.secondary.fg/15%)]',\n '[--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]'\n ],\n success: [\n 'text-white [--btn-bg:theme(colors.success.DEFAULT)] [--btn-border:theme(colors.success.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.white/60%)] active:[--btn-icon:theme(colors.white/80%)] hover:[--btn-icon:theme(colors.white/80%)]'\n ],\n 'light/dark': [\n 'text-background [--btn-bg:theme(colors.dark)] [--btn-border:theme(colors.dark/90%)] [--btn-hover-overlay:theme(colors.white/10%)]',\n 'dark:[--btn-bg:white] dark:[--btn-hover-overlay:theme(colors.dark/5%)]',\n '[--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.background/85%)] hover:[--btn-icon:theme(colors.background/85%)]'\n ],\n dark: [\n 'text-light [--btn-bg:theme(colors.dark)] [--btn-border:theme(colors.dark)] [--btn-hover-overlay:theme(colors.light/2.5%)]',\n '[--btn-icon:theme(colors.light/60%)] active:[--btn-icon:theme(colors.light/80%)] hover:[--btn-icon:theme(colors.light/80%)]'\n ],\n light: [\n 'text-dark [--btn-bg:white] [--btn-border:theme(colors.dark/10%)] [--btn-hover-overlay:theme(colors.dark/2.5%)] active:[--btn-border:theme(colors.dark/15%)] hover:[--btn-border:theme(colors.dark/15%)]',\n '[--btn-icon:theme(colors.dark/60%)] active:[--btn-icon:theme(colors.dark/80%)] hover:[--btn-icon:theme(colors.dark/80%)]'\n ],\n info: [\n 'text-info-fg [--btn-bg:theme(colors.info.DEFAULT)] [--btn-border:theme(colors.info.DEFAULT/80%)] [--btn-hover-overlay:theme(colors.white/25%)]',\n '[--btn-icon:theme(colors.info.fg/60%)] active:[--btn-icon:theme(colors.info.fg/80%)] hover:[--btn-icon:theme(colors.info.fg/80%)]'\n ],\n warning: [\n 'text-warning-fg [--btn-bg:theme(colors.warning.DEFAULT)] [--btn-border:theme(colors.warning.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.warning.fg/60%)] active:[--btn-icon:theme(colors.warning.fg/80%)] hover:[--btn-icon:theme(colors.warning.fg/80%)]'\n ],\n danger: [\n 'text-white [--btn-bg:theme(colors.danger.DEFAULT)] [--btn-border:theme(colors.danger.DEFAULT)] [--btn-hover-overlay:theme(colors.white/10%)]',\n '[--btn-icon:theme(colors.white/60%)] active:[--btn-icon:theme(colors.white/80%)] hover:[--btn-icon:theme(colors.white/80%)]'\n ]\n },\n appearance: {\n solid:\n 'border-transparent bg-[--btn-border] dark:bg-[--btn-bg] before:absolute before:inset-0 before:-z-10 before:bg-[--btn-bg] before:shadow dark:before:hidden dark:border-white/5 after:absolute after:inset-0 after:-z-10 after:shadow-[shadow:inset_0_1px_theme(colors.white/15%)] after:active:bg-[--btn-hover-overlay] after:hover:bg-[--btn-hover-overlay] dark:after:-inset-px before:data-[disabled]:shadow-none after:data-[disabled]:shadow-none',\n outline:\n 'border-border hover:bg-secondary/90 active:bg-secondary/90 text-fg [--btn-icon:theme(colors.zinc.400)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]',\n plain:\n 'border-transparent text-fg pressed:bg-secondary/90 active:bg-secondary/90 hover:bg-secondary/90 [--btn-icon:theme(colors.muted.fg)] active:[--btn-icon:theme(colors.fg)] hover:[--btn-icon:theme(colors.fg)]'\n },\n size: {\n 'extra-small':\n 'h-8 px-[calc(theme(spacing.3)-1px)] py-[calc(theme(spacing.1)-1px)] text-xs/4 lg:text-[0.800rem]/4',\n small:\n 'h-9 px-[calc(theme(spacing.4)-1px)] py-[calc(theme(spacing[1.5])-1px)] text-sm/5 lg:text-sm/5',\n medium:\n 'h-10 px-[calc(theme(spacing.4)-1px)] py-[calc(theme(spacing.2)-1px)] text-base lg:text-sm/6',\n large:\n 'h-10 sm:h-11 px-[calc(theme(spacing.4)-1px)] sm:px-[calc(theme(spacing.5)-1px)] py-[calc(theme(spacing[2.5])-1px)] text-base lg:text-base/7 sm:[&>[data-slot=icon]]:size-5',\n 'square-petite': 'size-9 shrink-0 [&_[data-slot=icon]]:text-current'\n },\n shape: {\n square:\n 'rounded-lg before:rounded-[calc(theme(borderRadius.lg)-1px)] after:rounded-[calc(theme(borderRadius.lg)-1px)] dark:after:rounded-lg',\n circle:\n 'rounded-[9999px] before:rounded-[9998px] after:rounded-[9998px] dark:after:rounded-[9999px]'\n },\n isDisabled: {\n false: 'forced-colors:disabled:text-[GrayText]',\n true: 'cursor-default opacity-60 forced-colors:disabled:text-[GrayText]'\n }\n },\n defaultVariants: {\n intent: 'primary',\n appearance: 'solid',\n size: 'medium',\n shape: 'square'\n },\n compoundVariants: [\n {\n appearance: ['outline', 'plain'],\n className: 'px-1',\n size: 'extra-small'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.1)-1px)]',\n size: 'small'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.2)-1px)]',\n size: 'medium'\n },\n {\n appearance: ['outline', 'plain'],\n className: 'px-[calc(theme(spacing.3)-1px)]',\n size: 'large'\n }\n ]\n },\n {\n responsiveVariants: ['sm', 'md', 'lg', 'xl']\n }\n)\n\ninterface ButtonProps extends ButtonPrimitiveProps {\n intent?:\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'warning'\n | 'info'\n | 'light/dark'\n | 'success'\n | 'light'\n | 'dark'\n size?: 'medium' | 'large' | 'square-petite' | 'extra-small' | 'small'\n shape?: 'square' | 'circle'\n appearance?: 'solid' | 'outline' | 'plain'\n}\n\nconst Button = React.forwardRef(\n ({ className, intent, appearance, size, shape, ...props }, ref) => {\n return (\n \n buttonStyles({\n ...renderProps,\n intent,\n appearance,\n size,\n shape,\n className\n })\n )}\n />\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport { Button, ButtonPrimitive, buttonStyles, type ButtonProps }\n", "type": "ui" }, "toggle": { diff --git a/components/ui/link.tsx b/components/ui/link.tsx index 2daba1e3..034882c7 100644 --- a/components/ui/link.tsx +++ b/components/ui/link.tsx @@ -10,10 +10,8 @@ const linkStyles = tv({ variants: { intent: { unstyled: 'text-fg', - primary: - 'text-primary hover:text-primary/80 forced-colors:disabled:text-[GrayText]', - danger: - 'text-danger hover:text-danger/80 forced-colors:disabled:text-[GrayText]', + primary: 'text-primary hover:text-primary/80 forced-colors:disabled:text-[GrayText]', + danger: 'text-danger hover:text-danger/80 forced-colors:disabled:text-[GrayText]', 'lad/primary': 'text-fg hover:text-primary dark:hover:text-primary/80 forced-colors:disabled:text-[GrayText]', secondary: 'text-secondary-fg hover:text-secondary-fg/80' From 4537bdac34e286600725d725a4b47226408414b1 Mon Sep 17 00:00:00 2001 From: "Irsyad A. Panjaitan" Date: Sat, 17 Aug 2024 02:42:05 +0700 Subject: [PATCH 3/6] fix everything --- .gitignore | 1 + .prettierrc | 2 +- app/(app)/colors/(colors)/color-generator.tsx | 24 +- app/(app)/colors/(colors)/color-item.tsx | 36 +- app/(app)/colors/(colors)/color-palette.tsx | 18 +- app/(app)/colors/(colors)/color-row.tsx | 38 +- .../(colors)/copy-json-color-shades.tsx | 22 +- app/(app)/colors/page.tsx | 22 +- app/(app)/components/page.tsx | 18 +- .../components/partials/card-list-box.tsx | 14 +- .../components/partials/on-this-page.tsx | 24 +- app/(app)/d/[slug]/page.tsx | 6 +- app/(app)/docs/[...slug]/page.tsx | 86 +- app/(app)/docs/layout.tsx | 4 +- app/(app)/docs/page.tsx | 4 +- app/(app)/icons/page.tsx | 18 +- app/(app)/icons/partials/controller/index.tsx | 32 +- .../icons/partials/controller/install.tsx | 32 +- .../icons/partials/controller/search.tsx | 14 +- .../icons/partials/controller/select-size.tsx | 32 +- app/(app)/icons/partials/icons-list.tsx | 48 +- app/(app)/icons/partials/styles.ts | 16 +- app/(app)/sink/layout.tsx | 2 +- app/(app)/sink/page.tsx | 4 +- app/(app)/themes/blocks.tsx | 10 +- app/(app)/themes/blocks/buttons.tsx | 18 +- app/(app)/themes/blocks/login-form.tsx | 4 +- .../themes/blocks/range-calendar-blocks.tsx | 11 +- app/(app)/themes/controller.tsx | 96 + app/(app)/themes/controller/index.tsx | 3 - app/(app)/themes/page.tsx | 14 +- app/(app)/themes/themes-list.ts | 98 +- app/(app)/themes/themes.tsx | 82 +- app/layout.tsx | 120 +- app/page.tsx | 10 +- app/robots.ts | 8 +- app/sitemap.ts | 14 +- components/aside.tsx | 112 +- components/blocks.tsx | 36 +- components/blocks/buttons.tsx | 6 +- components/blocks/check-radio-block.tsx | 14 +- components/blocks/grid-list-drag-block.tsx | 26 +- components/blocks/login-form.tsx | 6 +- components/blocks/menus.tsx | 8 +- components/blocks/overlays.tsx | 6 +- components/blocks/slider-on-popover-block.tsx | 10 +- components/blocks/table-demo.tsx | 6 +- components/blocks/toolbar-block.tsx | 8 +- components/cta.tsx | 10 +- components/docs/buttons/button-icon-demo.tsx | 6 +- components/docs/buttons/button-link-demo.tsx | 6 +- components/docs/buttons/button-size-demo.tsx | 4 +- components/docs/buttons/toggle-demo.tsx | 6 +- .../collections/choicebox-columns-demo.tsx | 18 +- .../collections/choicebox-controlled-demo.tsx | 34 +- .../docs/collections/choicebox-demo.tsx | 22 +- .../collections/choicebox-disabled-demo.tsx | 32 +- .../choicebox-single-selection-demo.tsx | 30 +- .../docs/collections/command-basic-demo.tsx | 10 +- .../collections/grid-list-controlled-demo.tsx | 20 +- .../docs/collections/grid-list-demo.tsx | 14 +- .../collections/grid-list-disabled-demo.tsx | 14 +- .../grid-list-drag-between-item-demo.tsx | 30 +- .../docs/collections/grid-list-drag-demo.tsx | 30 +- .../collections/grid-list-multiple-demo.tsx | 14 +- .../grid-list-render-empty-state-demo.tsx | 4 +- .../collections/list-box-controlled-demo.tsx | 24 +- components/docs/collections/list-box-demo.tsx | 14 +- .../collections/list-box-disabled-demo.tsx | 18 +- .../list-box-item-details-demo.tsx | 14 +- .../collections/list-box-multiple-demo.tsx | 26 +- .../collections/list-box-rearrange-demo.tsx | 24 +- .../collections/list-box-section-demo.tsx | 106 +- .../docs/collections/menu-basic-demo.tsx | 4 +- .../docs/collections/menu-collection-demo.tsx | 46 +- .../docs/collections/menu-danger-demo.tsx | 6 +- .../docs/collections/menu-disabled-demo.tsx | 6 +- .../collections/menu-item-details-demo.tsx | 12 +- .../collections/menu-respect-screen-demo.tsx | 8 +- .../docs/collections/menu-section-demo.tsx | 104 +- components/docs/collections/menu-sub-demo.tsx | 8 +- .../docs/collections/menu-with-arrow-demo.tsx | 8 +- .../docs/collections/menu-with-icon-demo.tsx | 20 +- .../docs/collections/multiple-menu-demo.tsx | 38 +- .../docs/collections/single-menu-demo.tsx | 56 +- .../docs/collections/table-bulk-demo.tsx | 60 +- components/docs/collections/table-demo.tsx | 42 +- .../docs/collections/table-drag-demo.tsx | 72 +- .../docs/collections/table-sorting-demo.tsx | 10 +- .../collections/tag-group-controlled-demo.tsx | 16 +- .../docs/collections/tag-group-demo.tsx | 12 +- .../collections/tag-group-disabled-demo.tsx | 4 +- .../docs/collections/tag-group-href-demo.tsx | 10 +- .../collections/tag-group-intent-demo.tsx | 16 +- .../docs/collections/tag-group-shape-demo.tsx | 14 +- .../tag-group-with-remove-demo.tsx | 26 +- .../docs/colors/color-area-channel-demo.tsx | 4 +- .../colors/color-area-controlled-demo.tsx | 12 +- components/docs/colors/color-area-demo.tsx | 4 +- .../docs/colors/color-area-disabled-demo.tsx | 4 +- .../docs/colors/color-area-space-demo.tsx | 4 +- .../colors/color-field-controlled-demo.tsx | 12 +- components/docs/colors/color-field-demo.tsx | 4 +- .../docs/colors/color-field-disabled-demo.tsx | 4 +- .../colors/color-field-with-prefix-demo.tsx | 6 +- .../colors/color-field-with-suffix-demo.tsx | 6 +- .../colors/color-picker-combination-demo.tsx | 10 +- .../colors/color-picker-controlled-demo.tsx | 10 +- .../color-picker-custom-colors-demo.tsx | 28 +- components/docs/colors/color-picker-demo.tsx | 6 +- .../colors/color-picker-disabled-demo.tsx | 10 +- ...or-picker-enable-selection-format-demo.tsx | 6 +- .../color-picker-enable-swatch-demo.tsx | 8 +- .../color-picker-with-description-demo.tsx | 6 +- .../colors/color-picker-with-label-demo.tsx | 6 +- .../color-picker-with-placeholder-demo.tsx | 6 +- .../colors/color-slider-controlled-demo.tsx | 8 +- components/docs/colors/color-slider-demo.tsx | 4 +- .../colors/color-slider-disabled-demo.tsx | 4 +- .../colors/color-slider-with-label-demo.tsx | 2 +- .../color-slider-without-output-demo.tsx | 4 +- .../colors/color-swatch-controlled-demo.tsx | 12 +- components/docs/colors/color-swatch-demo.tsx | 4 +- .../docs/colors/color-swatch-picker-demo.tsx | 10 +- ...color-swatch-picker-item-disabled-demo.tsx | 12 +- .../colors/color-wheel-controlled-demo.tsx | 12 +- components/docs/colors/color-wheel-demo.tsx | 4 +- .../docs/colors/color-wheel-disabled-demo.tsx | 4 +- components/docs/colors/controlled-values.tsx | 12 +- .../controls/accordion-border-hidden-demo.tsx | 32 +- .../accordion-default-expand-demo.tsx | 22 +- components/docs/controls/accordion-demo.tsx | 6 +- .../docs/controls/accordion-disabled-demo.tsx | 30 +- .../accordion-hide-indicator-demo.tsx | 18 +- .../controls/command-menu-controlled-demo.tsx | 34 +- .../command-menu-danger-item-demo.tsx | 6 +- .../docs/controls/command-menu-demo.tsx | 20 +- .../command-menu-description-demo.tsx | 8 +- .../controls/command-menu-disabled-demo.tsx | 6 +- .../controls/command-menu-keyboard-demo.tsx | 6 +- .../controls/command-menu-section-demo.tsx | 30 +- .../controls/command-menu-separator-demo.tsx | 6 +- .../command-menu-trigger-by-keyboard-demo.tsx | 16 +- .../controls/context-menu-danger-demo.tsx | 6 +- .../docs/controls/context-menu-demo.tsx | 6 +- .../controls/context-menu-disabled-demo.tsx | 6 +- .../context-menu-item-details-demo.tsx | 12 +- .../controls/context-menu-separator-demo.tsx | 6 +- .../controls/context-menu-with-icon-demo.tsx | 8 +- .../docs/controls/slider-controlled-demo.tsx | 10 +- .../docs/controls/slider-disabled-demo.tsx | 4 +- .../docs/controls/slider-orientation-demo.tsx | 20 +- .../controls/slider-prefix-suffix-demo.tsx | 8 +- .../docs/controls/slider-range-demo.tsx | 4 +- components/docs/controls/slider-step-demo.tsx | 4 +- .../docs/controls/switch-controlled-demo.tsx | 8 +- .../docs/controls/switch-disabled-demo.tsx | 4 +- .../docs/controls/switch-variant-demo.tsx | 12 +- components/docs/controls/toolbar-demo.tsx | 8 +- .../docs/controls/toolbar-disabled-demo.tsx | 8 +- .../controls/toolbar-orientation-demo.tsx | 8 +- .../docs/date-and-time/calendar-demo.tsx | 4 +- .../date-field-controlled-demo.tsx | 16 +- .../docs/date-and-time/date-field-demo.tsx | 4 +- .../date-field-disabled-demo.tsx | 4 +- .../date-field-validation-demo.tsx | 4 +- .../date-picker-controlled-demo.tsx | 16 +- .../date-picker-custom-validation-demo.tsx | 10 +- .../docs/date-and-time/date-picker-demo.tsx | 4 +- .../date-picker-disabled-demo.tsx | 4 +- .../date-picker-required-demo.tsx | 6 +- .../date-range-picker-controlled-demo.tsx | 16 +- ...te-range-picker-custom-validation-demo.tsx | 8 +- .../date-and-time/date-range-picker-demo.tsx | 4 +- .../date-range-picker-disabled-demo.tsx | 4 +- .../date-range-picker-time-demo.tsx | 8 +- .../date-range-picker-validation-demo.tsx | 4 +- .../docs/date-and-time/date-time-demo.tsx | 8 +- .../date-and-time/date-time-field-demo.tsx | 8 +- .../date-and-time/range-calendar-demo.tsx | 4 +- .../time-field-controlled-demo.tsx | 10 +- .../docs/date-and-time/time-field-demo.tsx | 6 +- .../time-field-disabled-demo.tsx | 4 +- .../docs/date-and-time/time-field-hc-demo.tsx | 10 +- .../time-field-validation-demo.tsx | 4 +- .../drop-zone-and-file-trigger-demo.tsx | 18 +- .../docs/drag-and-drop/drop-zone-demo.tsx | 8 +- .../docs/forms/checkbox-controlled-demo.tsx | 8 +- .../docs/forms/checkbox-description-demo.tsx | 4 +- .../docs/forms/checkbox-disabled-demo.tsx | 4 +- .../forms/checkbox-group-controlled-demo.tsx | 10 +- components/docs/forms/checkbox-group-demo.tsx | 6 +- .../forms/checkbox-group-description-demo.tsx | 4 +- .../forms/checkbox-group-disabled-demo.tsx | 6 +- .../forms/checkbox-indeterminate-demo.tsx | 4 +- .../docs/forms/checkbox-invalid-demo.tsx | 4 +- .../docs/forms/form-validation-demo.tsx | 4 +- .../docs/forms/input-otp-controlled-demo.tsx | 8 +- components/docs/forms/input-otp-demo.tsx | 4 +- .../docs/forms/input-otp-separator-demo.tsx | 4 +- .../forms/number-field-controlled-demo.tsx | 8 +- components/docs/forms/number-field-demo.tsx | 4 +- .../docs/forms/number-field-disabled-demo.tsx | 4 +- .../docs/forms/number-field-invalid-demo.tsx | 4 +- .../radio-group-children-description-demo.tsx | 4 +- .../forms/radio-group-controlled-demo.tsx | 10 +- components/docs/forms/radio-group-demo.tsx | 4 +- .../forms/radio-group-description-demo.tsx | 4 +- .../docs/forms/radio-group-disabled-demo.tsx | 4 +- .../docs/forms/radio-group-invalid-demo.tsx | 4 +- .../forms/radio-group-orientation-demo.tsx | 4 +- .../forms/search-field-controlled-demo.tsx | 10 +- components/docs/forms/search-field-demo.tsx | 4 +- .../docs/forms/search-field-disabled-demo.tsx | 4 +- .../forms/search-field-validation-demo.tsx | 4 +- .../forms/search-field-with-label-demo.tsx | 4 +- .../docs/forms/tag-field-appearance-demo.tsx | 8 +- .../docs/forms/tag-field-controlled-demo.tsx | 14 +- components/docs/forms/tag-field-demo.tsx | 10 +- .../docs/forms/tag-field-disabled-demo.tsx | 8 +- .../docs/forms/tag-field-intent-demo.tsx | 16 +- components/docs/forms/tag-field-max-demo.tsx | 8 +- .../docs/forms/tag-field-shape-demo.tsx | 12 +- .../docs/forms/text-field-controlled-demo.tsx | 10 +- components/docs/forms/text-field-demo.tsx | 4 +- .../docs/forms/text-field-disabled-demo.tsx | 4 +- .../docs/forms/text-field-loading-demo.tsx | 4 +- .../forms/text-field-prefix-suffix-demo.tsx | 6 +- .../docs/forms/text-field-readonly-demo.tsx | 4 +- .../forms/text-field-suffix-button-demo.tsx | 8 +- .../docs/forms/text-field-validation-demo.tsx | 4 +- .../docs/forms/textarea-controlled-demo.tsx | 10 +- .../docs/forms/textarea-disabled-demo.tsx | 4 +- .../docs/forms/textarea-readonly-demo.tsx | 4 +- .../docs/forms/textarea-validation-demo.tsx | 8 +- components/docs/generated/previews.json | 2017 ----------------- components/docs/media/avatar-demo.tsx | 4 +- .../docs/media/avatar-fallback-demo.tsx | 4 +- components/docs/media/avatar-group-demo.tsx | 4 +- .../docs/media/avatar-initials-demo.tsx | 4 +- components/docs/media/avatar-shape-demo.tsx | 4 +- components/docs/media/avatar-size-demo.tsx | 4 +- components/docs/media/avatar-status-demo.tsx | 4 +- components/docs/media/carousel-api-demo.tsx | 18 +- .../docs/media/carousel-autoplay-demo.tsx | 50 +- components/docs/media/carousel-demo.tsx | 8 +- .../docs/media/carousel-options-demo.tsx | 6 +- .../docs/media/carousel-orientation-demo.tsx | 46 +- .../media/carousel-with-collection-demo.tsx | 36 +- .../docs/navigation/breadcrumbs-demo.tsx | 4 +- .../docs/navigation/link-button-demo.tsx | 8 +- components/docs/navigation/link-demo.tsx | 4 +- .../docs/navigation/link-disabled-demo.tsx | 4 +- .../docs/navigation/link-intent-demo.tsx | 4 +- .../docs/navigation/link-unstyled-demo.tsx | 4 +- .../docs/navigation/pagination-demo.tsx | 4 +- .../navigation/pagination-dynamic-demo.tsx | 4 +- .../navigation/simple-pagination-demo.tsx | 4 +- .../docs/navigation/tabs-collections-demo.tsx | 16 +- components/docs/navigation/tabs-demo.tsx | 4 +- .../docs/navigation/tabs-disabled-demo.tsx | 6 +- .../docs/navigation/tabs-icons-demo.tsx | 6 +- components/docs/navigation/tabs-link-demo.tsx | 12 +- .../docs/navigation/tabs-orientation-demo.tsx | 4 +- .../docs/navigation/tabs-responsive-demo.tsx | 26 +- .../docs/overlays/alert-dialog-demo.tsx | 6 +- .../docs/overlays/drawer-basic-demo.tsx | 8 +- .../docs/overlays/drawer-controlled-demo.tsx | 6 +- .../docs/overlays/drawer-nested-demo.tsx | 12 +- .../docs/overlays/drawer-sticky-demo.tsx | 10 +- .../overlays/drawer-without-notch-demo.tsx | 8 +- components/docs/overlays/modal-blur-demo.tsx | 4 +- .../docs/overlays/modal-controlled-demo.tsx | 6 +- .../overlays/modal-custom-classnames-demo.tsx | 8 +- .../docs/overlays/modal-custom-style-demo.tsx | 4 +- components/docs/overlays/modal-demo.tsx | 4 +- .../docs/overlays/modal-nested-demo.tsx | 12 +- components/docs/overlays/modal-size-demo.tsx | 12 +- .../docs/overlays/modal-sticky-demo.tsx | 6 +- .../overlays/modal-triggered-by-menu-demo.tsx | 44 +- .../docs/overlays/popover-arrow-demo.tsx | 6 +- .../docs/overlays/popover-controlled-demo.tsx | 26 +- .../docs/overlays/popover-custom-close.tsx | 6 +- components/docs/overlays/popover-demo.tsx | 4 +- .../docs/overlays/popover-placement-demo.tsx | 10 +- .../docs/overlays/popover-trigger-demo.tsx | 4 +- .../docs/overlays/sheet-classnames-demo.tsx | 8 +- .../docs/overlays/sheet-controlled-demo.tsx | 6 +- .../docs/overlays/sheet-custom-close-demo.tsx | 6 +- .../docs/overlays/sheet-custom-style-demo.tsx | 4 +- components/docs/overlays/sheet-demo.tsx | 4 +- components/docs/overlays/sheet-menu-demo.tsx | 10 +- .../docs/overlays/sheet-position-demo.tsx | 14 +- components/docs/overlays/sheet-stack-demo.tsx | 6 +- .../docs/overlays/sheet-sticky-demo.tsx | 6 +- .../docs/overlays/tooltip-delay-demo.tsx | 10 +- components/docs/overlays/tooltip-demo.tsx | 10 +- .../docs/overlays/tooltip-placement-demo.tsx | 10 +- components/docs/rehype/code.tsx | 76 +- components/docs/rehype/plain-code.tsx | 8 +- components/docs/rehype/source-code.tsx | 26 +- components/docs/statuses/badge-demo.tsx | 4 +- .../docs/statuses/badge-intent-demo.tsx | 6 +- components/docs/statuses/badge-shape-demo.tsx | 4 +- .../indeterminate-progress-bar-demo.tsx | 6 +- components/docs/statuses/loader-demo.tsx | 2 +- .../docs/statuses/loader-intent-demo.tsx | 2 +- components/docs/statuses/loader-size-demo.tsx | 2 +- .../docs/statuses/loader-variant-demo.tsx | 2 +- .../statuses/meter-currency-format-demo.tsx | 8 +- .../statuses/meter-decimal-format-demo.tsx | 8 +- components/docs/statuses/meter-demo.tsx | 6 +- components/docs/statuses/note-demo.tsx | 8 +- .../statuses/note-hide-indicator-demo.tsx | 6 +- components/docs/statuses/note-intent-demo.tsx | 12 +- .../docs/statuses/progress-bar-demo.tsx | 6 +- components/docs/statuses/skeleton-demo.tsx | 2 +- .../docs/statuses/skeleton-intent-demo.tsx | 2 +- .../docs/statuses/skeleton-shape-demo.tsx | 2 +- .../docs/statuses/toast-action-demo.tsx | 28 +- components/docs/statuses/toast-demo.tsx | 8 +- .../docs/statuses/toast-description-demo.tsx | 10 +- .../docs/statuses/toast-positions-demo.tsx | 22 +- .../docs/statuses/toast-status-demo.tsx | 20 +- components/docs/surfaces/card-demo.tsx | 4 +- .../docs/surfaces/card-login-form-demo.tsx | 4 +- components/docs/surfaces/card-table-demo.tsx | 66 +- components/docs/surfaces/grid-basic-demo.tsx | 4 +- components/docs/surfaces/grid-debug-demo.tsx | 4 +- components/docs/surfaces/grid-gap-demo.tsx | 2 +- .../docs/surfaces/grid-gap-x-y-demo.tsx | 4 +- components/docs/surfaces/grid-item-demo.tsx | 4 +- .../docs/surfaces/grid-responsive-demo.tsx | 4 +- components/docs/surfaces/heading-demo.tsx | 2 +- .../docs/surfaces/heading-level-demo.tsx | 2 +- components/docs/surfaces/separator-demo.tsx | 4 +- components/docs/surfaces/show-more-demo.tsx | 14 +- components/footer.tsx | 22 +- components/hero.tsx | 30 +- components/logo.tsx | 2 +- components/pager.tsx | 18 +- components/ui/accordion.tsx | 46 +- components/ui/avatar.tsx | 66 +- components/ui/badge.tsx | 32 +- components/ui/breadcrumbs.tsx | 18 +- components/ui/button.tsx | 140 +- components/ui/calendar.tsx | 35 +- components/ui/card.tsx | 26 +- components/ui/carousel.tsx | 70 +- components/ui/checkbox.tsx | 42 +- components/ui/choicebox.tsx | 58 +- components/ui/color-field.tsx | 22 +- components/ui/color-picker.tsx | 56 +- components/ui/color.tsx | 58 +- components/ui/combo-box.tsx | 36 +- components/ui/command-menu.tsx | 106 +- components/ui/container.tsx | 10 +- components/ui/context-menu.tsx | 22 +- components/ui/date-field.tsx | 26 +- components/ui/date-picker.tsx | 44 +- components/ui/date-range-picker.tsx | 24 +- components/ui/dialog.tsx | 52 +- components/ui/drawer.tsx | 72 +- components/ui/drop-zone.tsx | 14 +- components/ui/dropdown.tsx | 44 +- components/ui/field.tsx | 38 +- components/ui/file-trigger.tsx | 48 +- components/ui/form.tsx | 6 +- components/ui/grid-list.tsx | 32 +- components/ui/grid.tsx | 376 +-- components/ui/heading.tsx | 38 +- components/ui/input-otp.tsx | 40 +- components/ui/keyboard.tsx | 16 +- components/ui/link.tsx | 28 +- components/ui/list-box.tsx | 42 +- components/ui/loader.tsx | 54 +- components/ui/loading-dots.tsx | 12 +- components/ui/menu.tsx | 52 +- components/ui/meter.tsx | 34 +- components/ui/modal.tsx | 80 +- components/ui/multiple-select.tsx | 114 +- components/ui/note.tsx | 46 +- components/ui/number-field.tsx | 34 +- components/ui/pagination.tsx | 108 +- components/ui/popover.tsx | 74 +- components/ui/primitive.tsx | 36 +- components/ui/progress-bar.tsx | 24 +- components/ui/radio.tsx | 34 +- components/ui/range-calendar.tsx | 48 +- components/ui/search-field.tsx | 24 +- components/ui/select.tsx | 32 +- components/ui/separator.tsx | 16 +- components/ui/sheet.tsx | 84 +- components/ui/show-more.tsx | 36 +- components/ui/skeleton.tsx | 22 +- components/ui/slider.tsx | 54 +- components/ui/snippet.tsx | 26 +- components/ui/switch.tsx | 49 +- components/ui/table.tsx | 36 +- components/ui/tabs.tsx | 54 +- components/ui/tag-field.tsx | 74 +- components/ui/tag-group.tsx | 80 +- components/ui/text-field.tsx | 24 +- components/ui/textarea.tsx | 16 +- components/ui/time-field.tsx | 18 +- components/ui/toast.tsx | 58 +- components/ui/toggle.tsx | 46 +- components/ui/toolbar.tsx | 36 +- components/ui/tooltip.tsx | 20 +- components/ui/visually-hidden.tsx | 6 +- resources/styles/app.css | 9 +- 411 files changed, 4043 insertions(+), 5902 deletions(-) create mode 100644 app/(app)/themes/controller.tsx delete mode 100644 app/(app)/themes/controller/index.tsx delete mode 100644 components/docs/generated/previews.json diff --git a/.gitignore b/.gitignore index 3bdf8f4f..61f2ca64 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ ignore # testing /coverage +/components/docs/generated/previews.json # next.js /.next/ /out/ diff --git a/.prettierrc b/.prettierrc index c2ab25bb..6740fab4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -20,7 +20,7 @@ "^[./]" ], "importOrderSeparation": true, - "singleQuote": true, + "singleQuote": false, "trailingComma": "none", "tabWidth": 2, "semi": false, diff --git a/app/(app)/colors/(colors)/color-generator.tsx b/app/(app)/colors/(colors)/color-generator.tsx index 16afbb8e..4236f31f 100644 --- a/app/(app)/colors/(colors)/color-generator.tsx +++ b/app/(app)/colors/(colors)/color-generator.tsx @@ -1,21 +1,21 @@ -'use client' +"use client" -import React, { useState } from 'react' +import React, { useState } from "react" -import { ColorRow } from '@/app/(app)/colors/(colors)/color-row' -import { generateColorScale, getColorName } from '@/resources/lib/colors' -import { parseColor } from '@react-stately/color' -import { IconArrowWallRight } from 'justd-icons' -import { ColorField, defaultColor, useMediaQuery } from 'ui' +import { ColorRow } from "@/app/(app)/colors/(colors)/color-row" +import { generateColorScale, getColorName } from "@/resources/lib/colors" +import { parseColor } from "@react-stately/color" +import { IconArrowWallRight } from "justd-icons" +import { ColorField, defaultColor, useMediaQuery } from "ui" export function ColorGenerator() { - const [colorObj, setColorObj] = useState(defaultColor.toString('hex')) + const [colorObj, setColorObj] = useState(defaultColor.toString("hex")) const handleChange = (newColor: any) => { - setColorObj(newColor.toString('hex')) + setColorObj(newColor.toString("hex")) } const colorScales = generateColorScale(colorObj) - const isDesktop = useMediaQuery('(min-width: 1024px)') + const isDesktop = useMediaQuery("(min-width: 1024px)") return (
@@ -24,7 +24,7 @@ export function ColorGenerator() { className="relative" value={parseColor(colorObj)} onChange={handleChange} - placeholder={defaultColor.toString('hex')} + placeholder={defaultColor.toString("hex")} suffix={ @@ -37,7 +37,7 @@ export function ColorGenerator() {
diff --git a/app/(app)/colors/(colors)/color-item.tsx b/app/(app)/colors/(colors)/color-item.tsx index c378cd44..4e296761 100644 --- a/app/(app)/colors/(colors)/color-item.tsx +++ b/app/(app)/colors/(colors)/color-item.tsx @@ -1,15 +1,15 @@ -import * as React from 'react' +import * as React from "react" -import { formatColorForTailwind, textColorBasedOnBg } from '@/resources/lib/colors' -import { parseColor } from '@react-stately/color' -import type { ColorFormat } from '@react-types/color' -import { IconCheck, IconDuplicate } from 'justd-icons' -import type { ListBoxItemProps } from 'react-aria-components' -import { ListBoxItem } from 'react-aria-components' -import type { ColorShade, FormatOnlyForTailwindVariableType } from 'resources/types' -import { toast } from 'sonner' -import { cn, isBrightColor } from 'ui' -import { copyToClipboard } from 'usemods' +import { formatColorForTailwind, textColorBasedOnBg } from "@/resources/lib/colors" +import { parseColor } from "@react-stately/color" +import type { ColorFormat } from "@react-types/color" +import { IconCheck, IconDuplicate } from "justd-icons" +import type { ListBoxItemProps } from "react-aria-components" +import { ListBoxItem } from "react-aria-components" +import type { ColorShade, FormatOnlyForTailwindVariableType } from "resources/types" +import { toast } from "sonner" +import { cn, isBrightColor } from "ui" +import { copyToClipboard } from "usemods" interface ColorItemProps extends ListBoxItemProps { item: ColorShade @@ -31,8 +31,8 @@ const ColorItem = ({ item, name, isForTailwindVariable, selectedFormat }: ColorI }, 2000) toast.success(`Copy ${toCopy} to clipboard.`, { classNames: { - toast: '[&:has([data-icon])_[data-content]]:ml-0', - icon: 'hidden' + toast: "[&:has([data-icon])_[data-content]]:ml-0", + icon: "hidden" } }) } @@ -40,10 +40,10 @@ const ColorItem = ({ item, name, isForTailwindVariable, selectedFormat }: ColorI handleCopy(parseColor(item.color as string)?.toString(selectedFormat))} style={{ @@ -53,8 +53,8 @@ const ColorItem = ({ item, name, isForTailwindVariable, selectedFormat }: ColorI >