diff --git a/docs/components/content/examples/CommandPaletteExampleThemeRaycast.vue b/docs/components/content/examples/CommandPaletteExampleThemeRaycast.vue index db4cb64423..86264bca30 100644 --- a/docs/components/content/examples/CommandPaletteExampleThemeRaycast.vue +++ b/docs/components/content/examples/CommandPaletteExampleThemeRaycast.vue @@ -45,7 +45,7 @@ const ui = { inactive: 'text-gray-400 dark:text-gray-500' }, avatar: { - size: '2xs' as const + size: '2xs' } } } diff --git a/src/runtime/types/checkbox.d.ts b/src/runtime/types/checkbox.d.ts new file mode 100644 index 0000000000..7639689427 --- /dev/null +++ b/src/runtime/types/checkbox.d.ts @@ -0,0 +1,3 @@ +import type colors from '#ui-colors' + +export type CheckboxColor = typeof colors[number] diff --git a/src/runtime/types/divider.d.ts b/src/runtime/types/divider.d.ts index e61d5103d4..c14ee3524a 100644 --- a/src/runtime/types/divider.d.ts +++ b/src/runtime/types/divider.d.ts @@ -1,3 +1,3 @@ -import type { divider } from '#ui/ui.config' +import type { divider } from '../ui.config' export type DividerSize = keyof typeof divider.border.size.horizontal | keyof typeof divider.border.size.vertical diff --git a/src/runtime/types/index.ts b/src/runtime/types/index.ts index 3b759f862f..3b13b0482f 100644 --- a/src/runtime/types/index.ts +++ b/src/runtime/types/index.ts @@ -4,6 +4,7 @@ export * from './avatar' export * from './badge' export * from './breadcrumb' export * from './button' +export * from './checkbox' export * from './chip' export * from './clipboard' export * from './command-palette' diff --git a/src/runtime/ui.config/data/table.ts b/src/runtime/ui.config/data/table.ts index 3aacd00bcf..aa7d3c7437 100644 --- a/src/runtime/ui.config/data/table.ts +++ b/src/runtime/ui.config/data/table.ts @@ -1,3 +1,5 @@ +import type { ButtonColor, ButtonSize, ButtonVariant, CheckboxColor, ProgressAnimation, ProgressColor } from '../../types' + export default { wrapper: 'relative overflow-x-auto', base: 'min-w-full table-fixed', @@ -51,23 +53,23 @@ export default { icon: 'i-heroicons-arrows-up-down-20-solid', trailing: true, square: true, - color: 'gray' as const, - variant: 'ghost' as const, + color: 'gray' as ButtonColor, + variant: 'ghost' as ButtonVariant, class: '-m-1.5' }, expandButton: { icon: 'i-heroicons-chevron-down', - color: 'gray' as const, - variant: 'ghost' as const, - size: 'xs' as const, + color: 'gray' as ButtonColor, + variant: 'ghost' as ButtonVariant, + size: 'xs' as ButtonSize, class: '-my-1.5 align-middle' }, checkbox: { - color: 'primary' as const + color: 'primary' as CheckboxColor }, progress: { - color: 'primary' as const, - animation: 'carousel' as const + color: 'primary' as ProgressColor, + animation: 'carousel' as ProgressAnimation }, loadingState: { icon: 'i-heroicons-arrow-path-20-solid', diff --git a/src/runtime/ui.config/elements/accordion.ts b/src/runtime/ui.config/elements/accordion.ts index 5454f90760..38399917c5 100644 --- a/src/runtime/ui.config/elements/accordion.ts +++ b/src/runtime/ui.config/elements/accordion.ts @@ -16,7 +16,7 @@ export default { openIcon: 'i-heroicons-chevron-down-20-solid', closeIcon: '', class: 'mb-1.5 w-full', - variant: 'soft' as const, + variant: 'soft', truncate: true } } diff --git a/src/runtime/ui.config/elements/alert.ts b/src/runtime/ui.config/elements/alert.ts index 2a503eceb4..62745a975e 100644 --- a/src/runtime/ui.config/elements/alert.ts +++ b/src/runtime/ui.config/elements/alert.ts @@ -1,3 +1,5 @@ +import type { AvatarSize, ButtonColor, ButtonSize, ButtonVariant } from '../../types' + export default { wrapper: 'w-full relative overflow-hidden', inner: 'w-0 flex-1', @@ -13,7 +15,7 @@ export default { }, avatar: { base: 'flex-shrink-0 self-center', - size: 'md' as const + size: 'md' as AvatarSize }, color: { white: { @@ -32,9 +34,9 @@ export default { icon: null, closeButton: null, actionButton: { - size: 'xs' as const, - color: 'primary' as const, - variant: 'link' as const + size: 'xs' as ButtonSize, + color: 'primary' as ButtonColor, + variant: 'link' as ButtonVariant } } } diff --git a/src/runtime/ui.config/elements/carousel.ts b/src/runtime/ui.config/elements/carousel.ts index 00d8f860dd..7a7f7eb746 100644 --- a/src/runtime/ui.config/elements/carousel.ts +++ b/src/runtime/ui.config/elements/carousel.ts @@ -1,3 +1,5 @@ +import type { ButtonColor } from '../../types' + export default { wrapper: 'relative', container: 'relative w-full flex overflow-x-auto snap-x snap-mandatory scroll-smooth', @@ -13,12 +15,12 @@ export default { }, default: { prevButton: { - color: 'black' as const, + color: 'black' as ButtonColor, class: 'rtl:[&_span:first-child]:rotate-180 absolute start-4 top-1/2 transform -translate-y-1/2 rounded-full', icon: 'i-heroicons-chevron-left-20-solid' }, nextButton: { - color: 'black' as const, + color: 'black' as ButtonColor, class: 'rtl:[&_span:last-child]:rotate-180 absolute end-4 top-1/2 transform -translate-y-1/2 rounded-full', icon: 'i-heroicons-chevron-right-20-solid' } diff --git a/src/runtime/ui.config/elements/dropdown.ts b/src/runtime/ui.config/elements/dropdown.ts index 160c34c196..e29cbde952 100644 --- a/src/runtime/ui.config/elements/dropdown.ts +++ b/src/runtime/ui.config/elements/dropdown.ts @@ -1,3 +1,4 @@ +import type { AvatarSize } from '../../types' import { arrow } from '../popper' export default { @@ -28,7 +29,7 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, label: 'truncate', shortcuts: 'hidden md:inline-flex flex-shrink-0 gap-0.5 ms-auto' diff --git a/src/runtime/ui.config/forms/inputMenu.ts b/src/runtime/ui.config/forms/inputMenu.ts index dfee6189fb..72368f28bb 100644 --- a/src/runtime/ui.config/forms/inputMenu.ts +++ b/src/runtime/ui.config/forms/inputMenu.ts @@ -1,3 +1,4 @@ +import type { AvatarSize } from '../../types' import { arrow } from '../popper' export default { @@ -36,7 +37,7 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, chip: { base: 'flex-shrink-0 w-2 h-2 mx-1 rounded-full' diff --git a/src/runtime/ui.config/layout/divider.ts b/src/runtime/ui.config/layout/divider.ts index cbc062e822..3c5c9b5332 100644 --- a/src/runtime/ui.config/layout/divider.ts +++ b/src/runtime/ui.config/layout/divider.ts @@ -1,3 +1,5 @@ +import type { AvatarSize } from '../../types' + export default { wrapper: { base: 'flex items-center align-center text-center', @@ -42,11 +44,11 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, label: 'text-sm', default: { - size: '2xs' as const, - type: 'solid' as const + size: '2xs', + type: 'solid' } } diff --git a/src/runtime/ui.config/navigation/commandPalette.ts b/src/runtime/ui.config/navigation/commandPalette.ts index 588529e5a6..f781621580 100644 --- a/src/runtime/ui.config/navigation/commandPalette.ts +++ b/src/runtime/ui.config/navigation/commandPalette.ts @@ -1,3 +1,5 @@ +import type { AvatarSize } from '../../types' + export default { wrapper: 'flex flex-col flex-1 min-h-0 divide-y divide-gray-100 dark:divide-gray-800', container: 'relative flex-1 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800 scroll-py-2', @@ -46,7 +48,7 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, chip: { base: 'flex-shrink-0 w-2 h-2 mx-1 rounded-full' diff --git a/src/runtime/ui.config/navigation/horizontalNavigation.ts b/src/runtime/ui.config/navigation/horizontalNavigation.ts index c32d90587b..e438b48d64 100644 --- a/src/runtime/ui.config/navigation/horizontalNavigation.ts +++ b/src/runtime/ui.config/navigation/horizontalNavigation.ts @@ -1,3 +1,5 @@ +import type { AvatarSize, BadgeColor, BadgeSize, BadgeVariant } from '../../types' + export default { wrapper: 'relative w-full flex items-center justify-between', container: 'flex items-center min-w-0', @@ -15,12 +17,12 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, badge: { base: 'flex-shrink-0 ms-auto relative rounded', - color: 'gray' as const, - variant: 'solid' as const, - size: 'xs' as const + color: 'gray' as BadgeColor, + variant: 'solid' as BadgeVariant, + size: 'xs' as BadgeSize } } diff --git a/src/runtime/ui.config/navigation/pagination.ts b/src/runtime/ui.config/navigation/pagination.ts index a95be9b215..8e0dfea796 100644 --- a/src/runtime/ui.config/navigation/pagination.ts +++ b/src/runtime/ui.config/navigation/pagination.ts @@ -1,3 +1,5 @@ +import type { ButtonColor } from '../../types' + export default { wrapper: 'flex items-center -space-x-px', base: '', @@ -5,28 +7,28 @@ export default { default: { size: 'sm', activeButton: { - color: 'primary' as const + color: 'primary' as ButtonColor }, inactiveButton: { - color: 'white' as const + color: 'white' as ButtonColor }, firstButton: { - color: 'white' as const, + color: 'white' as ButtonColor, class: 'rtl:[&_span:first-child]:rotate-180', icon: 'i-heroicons-chevron-double-left-20-solid' }, lastButton: { - color: 'white' as const, + color: 'white' as ButtonColor, class: 'rtl:[&_span:last-child]:rotate-180', icon: 'i-heroicons-chevron-double-right-20-solid' }, prevButton: { - color: 'white' as const, + color: 'white' as ButtonColor, class: 'rtl:[&_span:first-child]:rotate-180', icon: 'i-heroicons-chevron-left-20-solid' }, nextButton: { - color: 'white' as const, + color: 'white' as ButtonColor, class: 'rtl:[&_span:last-child]:rotate-180', icon: 'i-heroicons-chevron-right-20-solid' } diff --git a/src/runtime/ui.config/navigation/verticalNavigation.ts b/src/runtime/ui.config/navigation/verticalNavigation.ts index d5cb50f81f..75f9ec9750 100644 --- a/src/runtime/ui.config/navigation/verticalNavigation.ts +++ b/src/runtime/ui.config/navigation/verticalNavigation.ts @@ -1,3 +1,5 @@ +import type { AvatarSize, BadgeColor, BadgeSize, BadgeVariant } from '../../types' + export default { wrapper: 'relative', base: 'group relative flex items-center gap-1.5 focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-1 focus-visible:before:ring-primary-500 dark:focus-visible:before:ring-primary-400 before:absolute before:inset-px before:rounded-md disabled:cursor-not-allowed disabled:opacity-75', @@ -17,13 +19,13 @@ export default { }, avatar: { base: 'flex-shrink-0', - size: '2xs' as const + size: '2xs' as AvatarSize }, badge: { base: 'flex-shrink-0 ms-auto relative rounded', - color: 'gray' as const, - variant: 'solid' as const, - size: 'xs' as const + color: 'gray' as BadgeColor, + variant: 'solid' as BadgeVariant, + size: 'xs' as BadgeSize }, divider: { wrapper: { diff --git a/src/runtime/ui.config/overlays/notification.ts b/src/runtime/ui.config/overlays/notification.ts index 789abc355f..ce20c2a4f0 100644 --- a/src/runtime/ui.config/overlays/notification.ts +++ b/src/runtime/ui.config/overlays/notification.ts @@ -1,3 +1,5 @@ +import type { AvatarSize, ButtonColor, ButtonSize, ButtonVariant } from '../../types' + export default { wrapper: 'w-full pointer-events-auto', container: 'relative overflow-hidden', @@ -17,7 +19,7 @@ export default { }, avatar: { base: 'flex-shrink-0 self-center', - size: 'md' as const + size: 'md' as AvatarSize }, progress: { base: 'absolute bottom-0 end-0 start-0 h-1', @@ -38,13 +40,13 @@ export default { timeout: 5000, closeButton: { icon: 'i-heroicons-x-mark-20-solid', - color: 'gray' as const, - variant: 'link' as const, + color: 'gray' as ButtonColor, + variant: 'link' as ButtonVariant, padded: false }, actionButton: { - size: 'xs' as const, - color: 'white' as const + size: 'xs' as ButtonSize, + color: 'white' as ButtonColor } } }