@byyuurin/ui 0.0.10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -58
- package/dist/module.d.mts +4 -13
- package/dist/module.json +4 -4
- package/dist/module.mjs +54 -20
- package/dist/runtime/components/Accordion.vue +48 -72
- package/dist/runtime/components/Accordion.vue.d.ts +74 -0
- package/dist/runtime/components/Alert.vue +65 -83
- package/dist/runtime/components/Alert.vue.d.ts +71 -0
- package/dist/runtime/components/App.vue +28 -42
- package/dist/runtime/components/App.vue.d.ts +26 -0
- package/dist/runtime/components/Avatar.vue +82 -58
- package/dist/runtime/components/Avatar.vue.d.ts +39 -0
- package/dist/runtime/components/AvatarGroup.vue +43 -70
- package/dist/runtime/components/AvatarGroup.vue.d.ts +30 -0
- package/dist/runtime/components/Badge.vue +70 -64
- package/dist/runtime/components/Badge.vue.d.ts +45 -0
- package/dist/runtime/components/Breadcrumb.vue +56 -76
- package/dist/runtime/components/Breadcrumb.vue.d.ts +79 -0
- package/dist/runtime/components/Button.vue +150 -78
- package/dist/runtime/components/Button.vue.d.ts +45 -0
- package/dist/runtime/components/Calendar.vue +99 -125
- package/dist/runtime/components/Calendar.vue.d.ts +102 -0
- package/dist/runtime/components/Card.vue +33 -46
- package/dist/runtime/components/Card.vue.d.ts +34 -0
- package/dist/runtime/components/Carousel.vue +164 -237
- package/dist/runtime/components/Carousel.vue.d.ts +125 -0
- package/dist/runtime/components/Checkbox.vue +86 -88
- package/dist/runtime/components/Checkbox.vue.d.ts +63 -0
- package/dist/runtime/components/Chip.vue +44 -58
- package/dist/runtime/components/Chip.vue.d.ts +48 -0
- package/dist/runtime/components/Collapsible.vue +29 -33
- package/dist/runtime/components/Collapsible.vue.d.ts +34 -0
- package/dist/runtime/components/Drawer.vue +110 -150
- package/dist/runtime/components/Drawer.vue.d.ts +103 -0
- package/dist/runtime/components/DropdownMenu.vue +49 -120
- package/dist/runtime/components/DropdownMenu.vue.d.ts +140 -0
- package/dist/runtime/components/DropdownMenuContent.vue +177 -143
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +245 -275
- package/dist/runtime/components/Form.vue.d.ts +103 -0
- package/dist/runtime/components/FormField.vue +108 -0
- package/dist/runtime/components/FormField.vue.d.ts +63 -0
- package/dist/runtime/components/Icon.vue +20 -0
- package/dist/runtime/components/Icon.vue.d.ts +9 -0
- package/dist/runtime/components/Input.vue +125 -156
- package/dist/runtime/components/Input.vue.d.ts +76 -0
- package/dist/runtime/components/InputNumber.vue +103 -130
- package/dist/runtime/components/InputNumber.vue.d.ts +191 -0
- package/dist/runtime/components/Kbd.vue +24 -39
- package/dist/runtime/components/Kbd.vue.d.ts +34 -0
- package/dist/runtime/components/Link.vue +105 -337
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +31 -71
- package/dist/runtime/components/LinkBase.vue.d.ts +33 -0
- package/dist/runtime/components/Modal.vue +82 -103
- package/dist/runtime/components/Modal.vue.d.ts +96 -0
- package/dist/runtime/components/NavigationMenu.vue +336 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +181 -0
- package/dist/runtime/components/OverlayProvider.vue +12 -16
- package/dist/runtime/components/OverlayProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Pagination.vue +65 -139
- package/dist/runtime/components/Pagination.vue.d.ts +116 -0
- package/dist/runtime/components/PinInput.vue +78 -73
- package/dist/runtime/components/PinInput.vue.d.ts +54 -0
- package/dist/runtime/components/Popover.vue +60 -75
- package/dist/runtime/components/Popover.vue.d.ts +70 -0
- package/dist/runtime/components/Progress.vue +79 -126
- package/dist/runtime/components/Progress.vue.d.ts +63 -0
- package/dist/runtime/components/RadioGroup.vue +109 -140
- package/dist/runtime/components/RadioGroup.vue.d.ts +96 -0
- package/dist/runtime/components/ScrollArea.vue +50 -48
- package/dist/runtime/components/ScrollArea.vue.d.ts +21 -0
- package/dist/runtime/components/Select.vue +221 -221
- package/dist/runtime/components/Select.vue.d.ts +260 -0
- package/dist/runtime/components/Separator.vue +55 -47
- package/dist/runtime/components/Separator.vue.d.ts +48 -0
- package/dist/runtime/components/Skeleton.vue +25 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +73 -77
- package/dist/runtime/components/Slider.vue.d.ts +52 -0
- package/dist/runtime/components/Switch.vue +66 -77
- package/dist/runtime/components/Switch.vue.d.ts +58 -0
- package/dist/runtime/components/Table.vue +357 -215
- package/dist/runtime/components/Table.vue.d.ts +234 -0
- package/dist/runtime/components/Tabs.vue +90 -88
- package/dist/runtime/components/Tabs.vue.d.ts +97 -0
- package/dist/runtime/components/Textarea.vue +147 -146
- package/dist/runtime/components/Textarea.vue.d.ts +76 -0
- package/dist/runtime/components/Toast.vue +108 -90
- package/dist/runtime/components/Toast.vue.d.ts +152 -0
- package/dist/runtime/components/ToastProvider.vue +82 -109
- package/dist/runtime/components/ToastProvider.vue.d.ts +51 -0
- package/dist/runtime/components/Tooltip.vue +54 -53
- package/dist/runtime/components/Tooltip.vue.d.ts +53 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
- package/dist/runtime/composables/defineShortcuts.js +129 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
- package/dist/runtime/composables/useAvatarGroup.js +10 -3
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
- package/dist/runtime/composables/useComponentIcons.js +4 -4
- package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
- package/dist/runtime/composables/useFieldGroup.js +14 -0
- package/dist/runtime/composables/useFormField.d.ts +62 -0
- package/dist/runtime/composables/useFormField.js +99 -0
- package/dist/runtime/composables/useKbd.d.ts +3 -2
- package/dist/runtime/composables/useKbd.js +3 -2
- package/dist/runtime/composables/useLocale.d.ts +68 -5
- package/dist/runtime/composables/useLocale.js +11 -11
- package/dist/runtime/composables/useOverlay.d.ts +51 -15
- package/dist/runtime/composables/useOverlay.js +44 -30
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/composables/useToast.d.ts +12 -5
- package/dist/runtime/composables/useToast.js +12 -7
- package/dist/runtime/locale/en.d.ts +30 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/index.d.ts +2 -2
- package/dist/runtime/locale/index.js +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +31 -0
- package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +50 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +58 -17
- package/dist/runtime/types/form.js +11 -0
- package/dist/runtime/types/index.d.ts +51 -8
- package/dist/runtime/types/index.js +45 -2
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/locale.d.ts +5 -0
- package/dist/runtime/types/style.d.ts +33 -0
- package/dist/runtime/types/style.js +0 -0
- package/dist/runtime/types/unocss.d.ts +4 -0
- package/dist/runtime/types/utils.d.ts +38 -37
- package/dist/runtime/utils/form.d.ts +5 -1
- package/dist/runtime/utils/form.js +49 -0
- package/dist/runtime/utils/index.d.ts +10 -13
- package/dist/runtime/utils/index.js +41 -48
- package/dist/runtime/utils/link.d.ts +5 -6
- package/dist/runtime/utils/link.js +16 -2
- package/dist/runtime/utils/locale.d.ts +5 -0
- package/dist/runtime/utils/locale.js +10 -0
- package/dist/runtime/utils/style.d.ts +94 -0
- package/dist/runtime/utils/style.js +37 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
- package/dist/runtime/vue/components/Link.vue +163 -0
- package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +4 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +9 -0
- package/dist/runtime/vue/stubs.d.ts +16 -1
- package/dist/runtime/vue/stubs.js +32 -1
- package/dist/setup.d.mts +13 -0
- package/dist/setup.mjs +12 -0
- package/dist/shared/ui.CzIlLITK.mjs +51 -0
- package/dist/shared/ui.DSyJHSTk.mjs +3787 -0
- package/dist/shared/ui.DpbffTXs.d.mts +84 -0
- package/dist/shared/ui.IulR-OYx.d.mts +64 -0
- package/dist/types.d.mts +3 -1
- package/dist/unocss.d.mts +12 -52
- package/dist/unocss.mjs +144 -253
- package/dist/unplugin.d.mts +13 -26
- package/dist/unplugin.mjs +193 -18
- package/dist/vite.d.mts +10 -1
- package/dist/vite.mjs +12 -3
- package/package.json +156 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9307
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -46
- package/dist/runtime/components/FormItem.vue +0 -129
- package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
- package/dist/runtime/composables/useButtonGroup.js +0 -9
- package/dist/runtime/composables/useFormItem.d.ts +0 -27
- package/dist/runtime/composables/useFormItem.js +0 -64
- package/dist/runtime/composables/useTheme.d.ts +0 -9
- package/dist/runtime/composables/useTheme.js +0 -23
- package/dist/runtime/index.d.ts +0 -44
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/locale/zh-tw.d.ts +0 -2
- package/dist/runtime/theme/accordion.d.ts +0 -56
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -125
- package/dist/runtime/theme/alert.js +0 -47
- package/dist/runtime/theme/app.d.ts +0 -19
- package/dist/runtime/theme/app.js +0 -19
- package/dist/runtime/theme/avatar-group.d.ts +0 -52
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -56
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -82
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -67
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -66
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -190
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -56
- package/dist/runtime/theme/calendar.js +0 -69
- package/dist/runtime/theme/card.d.ts +0 -62
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -113
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -88
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -67
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -38
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -148
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -71
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -76
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -8
- package/dist/runtime/theme/form.js +0 -7
- package/dist/runtime/theme/index.d.ts +0 -41
- package/dist/runtime/theme/index.js +0 -41
- package/dist/runtime/theme/input-number.d.ts +0 -121
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -178
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -39
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -44
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -48
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -80
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -100
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -38
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -186
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -110
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -73
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -192
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -80
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -8
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -76
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -122
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -92
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -135
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -96
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -122
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -89
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -44
- package/dist/runtime/theme/tooltip.js +0 -11
- package/dist/runtime/types/components.d.ts +0 -42
- package/dist/runtime/utils/extend-theme.d.ts +0 -9
- package/dist/runtime/utils/extend-theme.js +0 -27
- package/dist/runtime/utils/styler.d.ts +0 -4
- package/dist/runtime/utils/styler.js +0 -10
- package/dist/runtime/utils/translator.d.ts +0 -18
- package/dist/runtime/utils/translator.js +0 -8
- package/dist/shared/ui.3e7fad19.mjs +0 -5
- package/dist/shared/ui.3e7fad19.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/unocss.d.ts +0 -52
- package/dist/unocss.mjs.map +0 -1
- package/dist/unplugin.d.ts +0 -26
- package/dist/unplugin.mjs.map +0 -1
- package/dist/vite.d.ts +0 -9
- package/dist/vite.mjs.map +0 -1
- /package/dist/runtime/types/{components.js → input.js} +0 -0
|
@@ -0,0 +1,3787 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { findPath, addTypeTemplate, addTemplate } from '@nuxt/kit';
|
|
4
|
+
import { loadConfig } from '@unocss/config';
|
|
5
|
+
import { genExport } from 'knitwork';
|
|
6
|
+
import { kebabCase } from 'scule';
|
|
7
|
+
import { n as neutralColors } from './ui.CzIlLITK.mjs';
|
|
8
|
+
import { ct } from '@byyuurin/ui-kit';
|
|
9
|
+
import { defu } from 'defu';
|
|
10
|
+
|
|
11
|
+
const name = "@byyuurin/ui";
|
|
12
|
+
const version = "0.1.0";
|
|
13
|
+
|
|
14
|
+
const accordion = ct({
|
|
15
|
+
parts: {
|
|
16
|
+
root: "w-full",
|
|
17
|
+
item: "border-b border-default last:border-b-0",
|
|
18
|
+
header: "flex",
|
|
19
|
+
trigger: "group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-primary min-w-0 cursor-pointer",
|
|
20
|
+
content: [
|
|
21
|
+
"overflow-hidden focus:outline-none",
|
|
22
|
+
"data-[state=open]:animate-[accordion-down_200ms_ease-out]",
|
|
23
|
+
"data-[state=closed]:animate-[accordion-up_200ms_ease-out]"
|
|
24
|
+
],
|
|
25
|
+
body: "text-sm pb-3.5",
|
|
26
|
+
leadingIcon: "shrink-0 size-5",
|
|
27
|
+
trailingIcon: "shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
28
|
+
label: "text-start break-words"
|
|
29
|
+
},
|
|
30
|
+
variants: {
|
|
31
|
+
disabled: {
|
|
32
|
+
true: {
|
|
33
|
+
trigger: "cursor-not-allowed opacity-75"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const alert = (options) => ct({
|
|
40
|
+
parts: {
|
|
41
|
+
root: "relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5",
|
|
42
|
+
wrapper: "min-w-0 flex-1 flex flex-col",
|
|
43
|
+
title: "text-sm font-medium",
|
|
44
|
+
description: "text-sm opacity-90",
|
|
45
|
+
icon: "shrink-0 size-5",
|
|
46
|
+
avatar: "shrink-0",
|
|
47
|
+
avatarSize: "2xl",
|
|
48
|
+
actions: "flex flex-wrap gap-1.5 shrink-0",
|
|
49
|
+
close: "p-0"
|
|
50
|
+
},
|
|
51
|
+
variants: {
|
|
52
|
+
color: {
|
|
53
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
54
|
+
neutral: ""
|
|
55
|
+
},
|
|
56
|
+
variant: {
|
|
57
|
+
solid: "",
|
|
58
|
+
outline: "",
|
|
59
|
+
soft: "",
|
|
60
|
+
subtle: ""
|
|
61
|
+
},
|
|
62
|
+
orientation: {
|
|
63
|
+
horizontal: {
|
|
64
|
+
root: "items-center",
|
|
65
|
+
actions: "items-center"
|
|
66
|
+
},
|
|
67
|
+
vertical: {
|
|
68
|
+
root: "items-start",
|
|
69
|
+
actions: "items-start mt-2.5"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
title: {
|
|
73
|
+
true: {
|
|
74
|
+
description: "mt-1"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
compoundVariants: [
|
|
79
|
+
...(options.theme.colors || []).map((color) => ({
|
|
80
|
+
color,
|
|
81
|
+
variant: "solid",
|
|
82
|
+
class: {
|
|
83
|
+
root: `bg-${color} text-inverted`
|
|
84
|
+
}
|
|
85
|
+
})),
|
|
86
|
+
...(options.theme.colors || []).map((color) => ({
|
|
87
|
+
color,
|
|
88
|
+
variant: "outline",
|
|
89
|
+
class: {
|
|
90
|
+
root: `text-${color} ring ring-inset ring-${color}/25`
|
|
91
|
+
}
|
|
92
|
+
})),
|
|
93
|
+
...(options.theme.colors || []).map((color) => ({
|
|
94
|
+
color,
|
|
95
|
+
variant: "soft",
|
|
96
|
+
class: {
|
|
97
|
+
root: `bg-${color}/10 text-${color}`
|
|
98
|
+
}
|
|
99
|
+
})),
|
|
100
|
+
...(options.theme.colors || []).map((color) => ({
|
|
101
|
+
color,
|
|
102
|
+
variant: "subtle",
|
|
103
|
+
class: {
|
|
104
|
+
root: `bg-${color}/10 text-${color} ring ring-inset ring-${color}/25`
|
|
105
|
+
}
|
|
106
|
+
})),
|
|
107
|
+
{
|
|
108
|
+
color: "neutral",
|
|
109
|
+
variant: "solid",
|
|
110
|
+
class: {
|
|
111
|
+
root: "text-inverted bg-inverted"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
color: "neutral",
|
|
116
|
+
variant: "outline",
|
|
117
|
+
class: {
|
|
118
|
+
root: "text-highlighted bg-default ring ring-inset ring-default"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
color: "neutral",
|
|
123
|
+
variant: "soft",
|
|
124
|
+
class: {
|
|
125
|
+
root: "text-highlighted bg-elevated/50"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
color: "neutral",
|
|
130
|
+
variant: "subtle",
|
|
131
|
+
class: {
|
|
132
|
+
root: "text-highlighted bg-elevated/50 ring ring-inset ring-accented"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
defaultVariants: {
|
|
137
|
+
color: "primary",
|
|
138
|
+
variant: "solid"
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const avatar = ct({
|
|
143
|
+
parts: {
|
|
144
|
+
root: "inline-flex items-center justify-center shrink-0 select-none rounded-full align-middle bg-elevated",
|
|
145
|
+
image: "h-full w-full rounded-[inherit] object-cover",
|
|
146
|
+
fallback: "font-medium leading-none text-muted truncate",
|
|
147
|
+
icon: "text-muted shrink-0"
|
|
148
|
+
},
|
|
149
|
+
variants: {
|
|
150
|
+
size: {
|
|
151
|
+
"3xs": {
|
|
152
|
+
root: "size-4 text-[0.5rem]"
|
|
153
|
+
},
|
|
154
|
+
"2xs": {
|
|
155
|
+
root: "size-5 text-[0.625rem]"
|
|
156
|
+
},
|
|
157
|
+
"xs": {
|
|
158
|
+
root: "size-6 text-xs"
|
|
159
|
+
},
|
|
160
|
+
"sm": {
|
|
161
|
+
root: "size-7 text-sm"
|
|
162
|
+
},
|
|
163
|
+
"md": {
|
|
164
|
+
root: "size-8 text-base"
|
|
165
|
+
},
|
|
166
|
+
"lg": {
|
|
167
|
+
root: "size-9 text-lg"
|
|
168
|
+
},
|
|
169
|
+
"xl": {
|
|
170
|
+
root: "size-10 text-xl"
|
|
171
|
+
},
|
|
172
|
+
"2xl": {
|
|
173
|
+
root: "size-11 text-[1.375rem]"
|
|
174
|
+
},
|
|
175
|
+
"3xl": {
|
|
176
|
+
root: "size-12 text-2xl"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
defaultVariants: {
|
|
181
|
+
size: "md"
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const avatarGroup = ct({
|
|
186
|
+
parts: {
|
|
187
|
+
root: "inline-flex flex-row-reverse justify-end",
|
|
188
|
+
base: "relative rounded-full ring-bg first:me-0"
|
|
189
|
+
},
|
|
190
|
+
variants: {
|
|
191
|
+
size: {
|
|
192
|
+
"3xs": {
|
|
193
|
+
base: "ring -me-0.5"
|
|
194
|
+
},
|
|
195
|
+
"2xs": {
|
|
196
|
+
base: "ring -me-0.5"
|
|
197
|
+
},
|
|
198
|
+
"xs": {
|
|
199
|
+
base: "ring -me-0.5"
|
|
200
|
+
},
|
|
201
|
+
"sm": {
|
|
202
|
+
base: "ring-2 -me-1.5"
|
|
203
|
+
},
|
|
204
|
+
"md": {
|
|
205
|
+
base: "ring-2 -me-1.5"
|
|
206
|
+
},
|
|
207
|
+
"lg": {
|
|
208
|
+
base: "ring-2 -me-1.5"
|
|
209
|
+
},
|
|
210
|
+
"xl": {
|
|
211
|
+
base: "ring-3 -me-2"
|
|
212
|
+
},
|
|
213
|
+
"2xl": {
|
|
214
|
+
base: "ring-3 -me-2"
|
|
215
|
+
},
|
|
216
|
+
"3xl": {
|
|
217
|
+
base: "ring-3 -me-2"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
defaultVariants: {
|
|
222
|
+
size: "md"
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const fieldGroup = ct(
|
|
227
|
+
/* @unocss-include */
|
|
228
|
+
{
|
|
229
|
+
base: "relative",
|
|
230
|
+
variants: {
|
|
231
|
+
size: {
|
|
232
|
+
xs: "",
|
|
233
|
+
sm: "",
|
|
234
|
+
md: "",
|
|
235
|
+
lg: "",
|
|
236
|
+
xl: ""
|
|
237
|
+
},
|
|
238
|
+
orientation: {
|
|
239
|
+
horizontal: "inline-flex -space-x-px",
|
|
240
|
+
vertical: "flex flex-col -space-y-px"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
const fieldGroupVariant = {
|
|
246
|
+
fieldGroup: {
|
|
247
|
+
horizontal: {
|
|
248
|
+
base: "not-only-child:first:rounded-e-none not-only-child:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]"
|
|
249
|
+
},
|
|
250
|
+
vertical: {
|
|
251
|
+
base: "not-only-child:first:rounded-b-none not-only-child:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const fieldGroupVariantWithRoot = {
|
|
256
|
+
fieldGroup: {
|
|
257
|
+
horizontal: {
|
|
258
|
+
root: "group has-focus-visible:z-[1]",
|
|
259
|
+
base: "group-not-only-child:group-first:rounded-e-none group-not-only-child:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"
|
|
260
|
+
},
|
|
261
|
+
vertical: {
|
|
262
|
+
root: "group has-focus-visible:z-[1]",
|
|
263
|
+
base: "group-not-only-child:group-first:rounded-b-none group-not-only-child:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const badge = (options) => ct({
|
|
269
|
+
parts: {
|
|
270
|
+
base: "font-medium inline-flex items-center",
|
|
271
|
+
label: "truncate",
|
|
272
|
+
leadingIcon: "shrink-0",
|
|
273
|
+
leadingAvatar: "shrink-0",
|
|
274
|
+
leadingAvatarSize: "",
|
|
275
|
+
trailingIcon: "shrink-0"
|
|
276
|
+
},
|
|
277
|
+
variants: {
|
|
278
|
+
...fieldGroupVariant,
|
|
279
|
+
color: {
|
|
280
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
281
|
+
neutral: ""
|
|
282
|
+
},
|
|
283
|
+
variant: {
|
|
284
|
+
solid: "",
|
|
285
|
+
outline: "",
|
|
286
|
+
soft: "",
|
|
287
|
+
subtle: ""
|
|
288
|
+
},
|
|
289
|
+
size: {
|
|
290
|
+
xs: {
|
|
291
|
+
base: "text-[0.5rem]/3 px-1 py-0.5 gap-1 rounded-sm",
|
|
292
|
+
leadingIcon: "size-3",
|
|
293
|
+
leadingAvatarSize: "3xs",
|
|
294
|
+
trailingIcon: "size-3"
|
|
295
|
+
},
|
|
296
|
+
sm: {
|
|
297
|
+
base: "text-[0.625rem]/3 px-1.5 py-1 gap-1 rounded-sm",
|
|
298
|
+
leadingIcon: "size-3",
|
|
299
|
+
leadingAvatarSize: "3xs",
|
|
300
|
+
trailingIcon: "size-3"
|
|
301
|
+
},
|
|
302
|
+
md: {
|
|
303
|
+
base: "text-xs px-2 py-1 gap-1 rounded-md",
|
|
304
|
+
leadingIcon: "size-4",
|
|
305
|
+
leadingAvatarSize: "3xs",
|
|
306
|
+
trailingIcon: "size-4"
|
|
307
|
+
},
|
|
308
|
+
lg: {
|
|
309
|
+
base: "text-sm px-2 py-1 gap-1.5 rounded-md",
|
|
310
|
+
leadingIcon: "size-5",
|
|
311
|
+
leadingAvatarSize: "2xs",
|
|
312
|
+
trailingIcon: "size-5"
|
|
313
|
+
},
|
|
314
|
+
xl: {
|
|
315
|
+
base: "text-base px-2.5 py-1 gap-1.5 rounded-md",
|
|
316
|
+
leadingIcon: "size-6",
|
|
317
|
+
leadingAvatarSize: "2xs",
|
|
318
|
+
trailingIcon: "size-6"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
square: {
|
|
322
|
+
true: ""
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
compoundVariants: [
|
|
326
|
+
...(options.theme.colors || []).map((color) => ({
|
|
327
|
+
color,
|
|
328
|
+
variant: "solid",
|
|
329
|
+
class: { base: `bg-${color} text-inverted` }
|
|
330
|
+
})),
|
|
331
|
+
...(options.theme.colors || []).map((color) => ({
|
|
332
|
+
color,
|
|
333
|
+
variant: "outline",
|
|
334
|
+
class: { base: `text-${color} ring ring-inset ring-${color}/50` }
|
|
335
|
+
})),
|
|
336
|
+
...(options.theme.colors || []).map((color) => ({
|
|
337
|
+
color,
|
|
338
|
+
variant: "soft",
|
|
339
|
+
class: { base: `bg-${color}/10 text-${color}` }
|
|
340
|
+
})),
|
|
341
|
+
...(options.theme.colors || []).map((color) => ({
|
|
342
|
+
color,
|
|
343
|
+
variant: "subtle",
|
|
344
|
+
class: { base: `bg-${color}/10 text-${color} ring ring-inset ring-${color}/25` }
|
|
345
|
+
})),
|
|
346
|
+
{
|
|
347
|
+
color: "neutral",
|
|
348
|
+
variant: "solid",
|
|
349
|
+
class: { base: "text-inverted bg-inverted" }
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
color: "neutral",
|
|
353
|
+
variant: "outline",
|
|
354
|
+
class: { base: "ring ring-inset ring-accented text-default bg-default" }
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
color: "neutral",
|
|
358
|
+
variant: "soft",
|
|
359
|
+
class: { base: "text-default bg-elevated" }
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
color: "neutral",
|
|
363
|
+
variant: "subtle",
|
|
364
|
+
class: { base: "ring ring-inset ring-accented text-default bg-elevated" }
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
size: "xs",
|
|
368
|
+
square: true,
|
|
369
|
+
class: { base: "p-0.5" }
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
size: "sm",
|
|
373
|
+
square: true,
|
|
374
|
+
class: { base: "p-1" }
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
size: "md",
|
|
378
|
+
square: true,
|
|
379
|
+
class: { base: "p-1" }
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
size: "lg",
|
|
383
|
+
square: true,
|
|
384
|
+
class: { base: "p-1" }
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
size: "xl",
|
|
388
|
+
square: true,
|
|
389
|
+
class: { base: "p-1" }
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
defaultVariants: {
|
|
393
|
+
color: "primary",
|
|
394
|
+
variant: "solid",
|
|
395
|
+
size: "md"
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
const breadcrumb = (options) => ct({
|
|
400
|
+
parts: {
|
|
401
|
+
root: "relative min-w-0",
|
|
402
|
+
list: "flex items-center gap-1.5",
|
|
403
|
+
item: "flex min-w-0",
|
|
404
|
+
link: "group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary",
|
|
405
|
+
linkLeadingIcon: "shrink-0 size-5",
|
|
406
|
+
linkLeadingAvatar: "shrink-0",
|
|
407
|
+
linkLeadingAvatarSize: "2xs",
|
|
408
|
+
linkLabel: "truncate",
|
|
409
|
+
separator: "flex",
|
|
410
|
+
separatorIcon: "shrink-0 size-5 text-muted"
|
|
411
|
+
},
|
|
412
|
+
variants: {
|
|
413
|
+
active: {
|
|
414
|
+
true: {
|
|
415
|
+
link: "text-primary font-semibold"
|
|
416
|
+
},
|
|
417
|
+
false: {
|
|
418
|
+
link: "text-muted font-medium"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
disabled: {
|
|
422
|
+
true: {
|
|
423
|
+
link: "cursor-not-allowed opacity-75"
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
to: {
|
|
427
|
+
true: ""
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
compoundVariants: [
|
|
431
|
+
{
|
|
432
|
+
disabled: false,
|
|
433
|
+
active: false,
|
|
434
|
+
to: true,
|
|
435
|
+
class: {
|
|
436
|
+
link: [
|
|
437
|
+
"hover:text-default",
|
|
438
|
+
options.theme.transitions && "transition-colors"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
]
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
const button = (options) => ct({
|
|
446
|
+
parts: {
|
|
447
|
+
base: [
|
|
448
|
+
"rounded-md font-medium inline-flex items-center",
|
|
449
|
+
options.theme.transitions && "transition-colors",
|
|
450
|
+
"cursor-pointer disabled:cursor-not-allowed aria-disabled:cursor-not-allowed disabled:opacity-75 aria-disabled:opacity-75"
|
|
451
|
+
],
|
|
452
|
+
label: "truncate",
|
|
453
|
+
leadingIcon: "shrink-0",
|
|
454
|
+
leadingAvatar: "shrink-0",
|
|
455
|
+
leadingAvatarSize: "",
|
|
456
|
+
trailingIcon: "shrink-0"
|
|
457
|
+
},
|
|
458
|
+
variants: {
|
|
459
|
+
...fieldGroupVariant,
|
|
460
|
+
color: {
|
|
461
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
462
|
+
neutral: ""
|
|
463
|
+
},
|
|
464
|
+
variant: {
|
|
465
|
+
solid: "",
|
|
466
|
+
outline: "",
|
|
467
|
+
soft: "",
|
|
468
|
+
subtle: "",
|
|
469
|
+
ghost: "",
|
|
470
|
+
link: ""
|
|
471
|
+
},
|
|
472
|
+
size: {
|
|
473
|
+
xs: {
|
|
474
|
+
base: "px-2 py-1 text-xs gap-1",
|
|
475
|
+
leadingIcon: "size-4",
|
|
476
|
+
leadingAvatarSize: "3xs",
|
|
477
|
+
trailingIcon: "size-4"
|
|
478
|
+
},
|
|
479
|
+
sm: {
|
|
480
|
+
base: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
481
|
+
leadingIcon: "size-4",
|
|
482
|
+
leadingAvatarSize: "3xs",
|
|
483
|
+
trailingIcon: "size-4"
|
|
484
|
+
},
|
|
485
|
+
md: {
|
|
486
|
+
base: "px-2.5 py-1.5 text-sm gap-1.5",
|
|
487
|
+
leadingIcon: "size-5",
|
|
488
|
+
leadingAvatarSize: "2xs",
|
|
489
|
+
trailingIcon: "size-5"
|
|
490
|
+
},
|
|
491
|
+
lg: {
|
|
492
|
+
base: "px-3 py-2 text-sm gap-2",
|
|
493
|
+
leadingIcon: "size-5",
|
|
494
|
+
leadingAvatarSize: "2xs",
|
|
495
|
+
trailingIcon: "size-5"
|
|
496
|
+
},
|
|
497
|
+
xl: {
|
|
498
|
+
base: "px-3 py-2 text-base gap-2",
|
|
499
|
+
leadingIcon: "size-6",
|
|
500
|
+
leadingAvatarSize: "xs",
|
|
501
|
+
trailingIcon: "size-6"
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
block: {
|
|
505
|
+
true: {
|
|
506
|
+
base: "w-full justify-center",
|
|
507
|
+
trailingIcon: "ms-auto"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
square: {
|
|
511
|
+
true: ""
|
|
512
|
+
},
|
|
513
|
+
leading: {
|
|
514
|
+
true: ""
|
|
515
|
+
},
|
|
516
|
+
trailing: {
|
|
517
|
+
true: ""
|
|
518
|
+
},
|
|
519
|
+
loading: {
|
|
520
|
+
true: ""
|
|
521
|
+
},
|
|
522
|
+
active: {
|
|
523
|
+
true: {
|
|
524
|
+
base: ""
|
|
525
|
+
},
|
|
526
|
+
false: {
|
|
527
|
+
base: ""
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
compoundVariants: [
|
|
532
|
+
...(options.theme.colors || []).map((color) => ({
|
|
533
|
+
color,
|
|
534
|
+
variant: "solid",
|
|
535
|
+
class: {
|
|
536
|
+
base: `text-inverted bg-${color} hover:bg-${color}/75 active:bg-${color}/75 disabled:bg-${color} aria-disabled:bg-${color} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-${color}`
|
|
537
|
+
}
|
|
538
|
+
})),
|
|
539
|
+
...(options.theme.colors || []).map((color) => ({
|
|
540
|
+
color,
|
|
541
|
+
variant: "outline",
|
|
542
|
+
class: {
|
|
543
|
+
base: `ring ring-inset ring-${color}/50 text-${color} hover:bg-${color}/10 active:bg-${color}/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent focus:outline-none focus-visible:ring-2 } focus-visible:ring-${color}`
|
|
544
|
+
}
|
|
545
|
+
})),
|
|
546
|
+
...(options.theme.colors || []).map((color) => ({
|
|
547
|
+
color,
|
|
548
|
+
variant: "soft",
|
|
549
|
+
class: {
|
|
550
|
+
base: `text-${color} bg-${color}/10 hover:bg-${color}/15 active:bg-${color}/15 focus:outline-none focus-visible:bg-${color}/15 disabled:bg-${color}/10 aria-disabled:bg-${color}/10`
|
|
551
|
+
}
|
|
552
|
+
})),
|
|
553
|
+
...(options.theme.colors || []).map((color) => ({
|
|
554
|
+
color,
|
|
555
|
+
variant: "subtle",
|
|
556
|
+
class: {
|
|
557
|
+
base: `text-${color} ring ring-inset ring-${color}/25 bg-${color}/10 hover:bg-${color}/15 active:bg-${color}/15 disabled:bg-${color}/10 aria-disabled:bg-${color}/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-${color}`
|
|
558
|
+
}
|
|
559
|
+
})),
|
|
560
|
+
...(options.theme.colors || []).map((color) => ({
|
|
561
|
+
color,
|
|
562
|
+
variant: "ghost",
|
|
563
|
+
class: {
|
|
564
|
+
base: `text-${color} hover:bg-${color}/10 active:bg-${color}/10 focus:outline-none focus-visible:bg-${color}/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent`
|
|
565
|
+
}
|
|
566
|
+
})),
|
|
567
|
+
...(options.theme.colors || []).map((color) => ({
|
|
568
|
+
color,
|
|
569
|
+
variant: "link",
|
|
570
|
+
class: {
|
|
571
|
+
base: `text-${color} hover:text-${color}/75 active:text-${color}/75 disabled:text-${color} aria-disabled:text-${color} focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}`
|
|
572
|
+
}
|
|
573
|
+
})),
|
|
574
|
+
{
|
|
575
|
+
color: "neutral",
|
|
576
|
+
variant: "solid",
|
|
577
|
+
class: {
|
|
578
|
+
base: "text-inverted bg-inverted hover:bg-inverted/90 active:bg-inverted/90 disabled:bg-inverted aria-disabled:bg-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-inverted"
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
color: "neutral",
|
|
583
|
+
variant: "outline",
|
|
584
|
+
class: {
|
|
585
|
+
base: "ring ring-inset ring-accented text-default bg-default hover:bg-elevated active:bg-elevated disabled:bg-default aria-disabled:bg-default focus:outline-none focus-visible:ring-2 focus-visible:ring-inverted"
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
color: "neutral",
|
|
590
|
+
variant: "soft",
|
|
591
|
+
class: {
|
|
592
|
+
base: "text-default bg-elevated hover:bg-accented/75 active:bg-accented/75 focus:outline-none focus-visible:bg-accented/75 disabled:bg-elevated aria-disabled:bg-elevated"
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
color: "neutral",
|
|
597
|
+
variant: "subtle",
|
|
598
|
+
class: {
|
|
599
|
+
base: "ring ring-inset ring-accented text-default bg-elevated hover:bg-accented/75 active:bg-accented/75 disabled:bg-elevated aria-disabled:bg-elevated focus:outline-none focus-visible:ring-2 focus-visible:ring-inverted"
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
color: "neutral",
|
|
604
|
+
variant: "ghost",
|
|
605
|
+
class: {
|
|
606
|
+
base: "text-default hover:bg-elevated active:bg-elevated focus:outline-none focus-visible:bg-elevated hover:disabled:bg-transparent dark:hover:disabled:bg-transparent hover:aria-disabled:bg-transparent dark:hover:aria-disabled:bg-transparent"
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
color: "neutral",
|
|
611
|
+
variant: "link",
|
|
612
|
+
class: {
|
|
613
|
+
base: "text-muted hover:text-default active:text-default disabled:text-muted aria-disabled:text-muted focus:outline-none focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-inverted"
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
size: "xs",
|
|
618
|
+
square: true,
|
|
619
|
+
class: { base: "p-1" }
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
size: "sm",
|
|
623
|
+
square: true,
|
|
624
|
+
class: { base: "p-1.5" }
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
size: "md",
|
|
628
|
+
square: true,
|
|
629
|
+
class: { base: "p-1.5" }
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
size: "lg",
|
|
633
|
+
square: true,
|
|
634
|
+
class: { base: "p-2" }
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
size: "xl",
|
|
638
|
+
square: true,
|
|
639
|
+
class: { base: "p-2" }
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
loading: true,
|
|
643
|
+
leading: true,
|
|
644
|
+
class: {
|
|
645
|
+
leadingIcon: "animate-spin"
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
loading: true,
|
|
650
|
+
leading: false,
|
|
651
|
+
trailing: true,
|
|
652
|
+
class: {
|
|
653
|
+
trailingIcon: "animate-spin"
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
],
|
|
657
|
+
defaultVariants: {
|
|
658
|
+
color: "primary",
|
|
659
|
+
variant: "solid",
|
|
660
|
+
size: "md"
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
const calendar = (options) => ct({
|
|
665
|
+
parts: {
|
|
666
|
+
root: "",
|
|
667
|
+
header: "flex items-center justify-between",
|
|
668
|
+
body: "flex flex-col space-y-4 pt-4 sm:flex-row sm:space-x-4 sm:space-y-0",
|
|
669
|
+
heading: "text-center font-medium truncate mx-auto",
|
|
670
|
+
grid: "w-full border-collapse select-none space-y-1 focus:outline-none",
|
|
671
|
+
gridRow: "grid grid-cols-7 place-items-center",
|
|
672
|
+
gridWeekDaysRow: "mb-1 grid w-full grid-cols-7",
|
|
673
|
+
gridBody: "grid",
|
|
674
|
+
headCell: "rounded-md",
|
|
675
|
+
cell: "relative text-center",
|
|
676
|
+
cellTrigger: [
|
|
677
|
+
"m-0.5 relative flex items-center justify-center rounded-full whitespace-nowrap cursor-pointer focus-visible:ring-2 focus:outline-none",
|
|
678
|
+
"data-[today]:font-semibold",
|
|
679
|
+
"data-[unavailable]:line-through data-[unavailable]:text-muted data-[unavailable]:pointer-events-none",
|
|
680
|
+
"data-[outside-view]:text-muted",
|
|
681
|
+
"data-[disabled]:not-[[data-selected]]:text-muted data-[disabled]:cursor-not-allowed",
|
|
682
|
+
options.theme.transitions && "transition"
|
|
683
|
+
]
|
|
684
|
+
},
|
|
685
|
+
variants: {
|
|
686
|
+
color: {
|
|
687
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
688
|
+
headCell: `text-${color}`,
|
|
689
|
+
cellTrigger: `focus-visible:ring-${color}`
|
|
690
|
+
}])),
|
|
691
|
+
neutral: {
|
|
692
|
+
headCell: "text-highlighted",
|
|
693
|
+
cellTrigger: "focus-visible:ring-inverted"
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
variant: {
|
|
697
|
+
solid: "",
|
|
698
|
+
outline: "",
|
|
699
|
+
soft: "",
|
|
700
|
+
subtle: ""
|
|
701
|
+
},
|
|
702
|
+
size: {
|
|
703
|
+
xs: {
|
|
704
|
+
heading: "text-xs",
|
|
705
|
+
cell: "text-xs",
|
|
706
|
+
headCell: "text-[0.625rem]",
|
|
707
|
+
cellTrigger: "size-7",
|
|
708
|
+
body: "space-y-2 pt-2"
|
|
709
|
+
},
|
|
710
|
+
sm: {
|
|
711
|
+
heading: "text-xs",
|
|
712
|
+
headCell: "text-xs",
|
|
713
|
+
cell: "text-xs",
|
|
714
|
+
cellTrigger: "size-7"
|
|
715
|
+
},
|
|
716
|
+
md: {
|
|
717
|
+
heading: "text-sm",
|
|
718
|
+
headCell: "text-xs",
|
|
719
|
+
cell: "text-sm",
|
|
720
|
+
cellTrigger: "size-8"
|
|
721
|
+
},
|
|
722
|
+
lg: {
|
|
723
|
+
heading: "text-base",
|
|
724
|
+
headCell: "text-base",
|
|
725
|
+
cellTrigger: "size-9 text-base"
|
|
726
|
+
},
|
|
727
|
+
xl: {
|
|
728
|
+
heading: "text-lg",
|
|
729
|
+
headCell: "text-lg",
|
|
730
|
+
cellTrigger: "size-10 text-lg"
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
outsideView: {
|
|
734
|
+
false: {
|
|
735
|
+
cellTrigger: "not-hover:data-[outside-view]:data-[selected]:bg-default not-hover:data-[outside-view]:data-[selected]:text-muted not-hover:data-[outside-view]:data-[selected]:ring-0"
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
compoundVariants: [
|
|
740
|
+
...(options.theme.colors || []).map((color) => ({
|
|
741
|
+
color,
|
|
742
|
+
variant: "solid",
|
|
743
|
+
class: {
|
|
744
|
+
cellTrigger: `data-[selected]:bg-${color} data-[selected]:text-inverted data-[today]:not-[[data-selected]]:text-${color} data-[highlighted]:bg-${color}/20 hover:not-[[data-selected]]:bg-${color}/20`
|
|
745
|
+
}
|
|
746
|
+
})),
|
|
747
|
+
...(options.theme.colors || []).map((color) => ({
|
|
748
|
+
color,
|
|
749
|
+
variant: "solid",
|
|
750
|
+
outsideView: false,
|
|
751
|
+
class: {
|
|
752
|
+
cellTrigger: `hover:data-[outside-view]:data-[selected]:bg-${color}/20`
|
|
753
|
+
}
|
|
754
|
+
})),
|
|
755
|
+
{
|
|
756
|
+
color: "neutral",
|
|
757
|
+
variant: "solid",
|
|
758
|
+
class: {
|
|
759
|
+
cellTrigger: "data-[selected]:bg-inverted data-[selected]:text-inverted data-[today]:not-[[data-selected]]:text-highlighted data-[highlighted]:bg-inverted/20 hover:not-[[data-selected]]:bg-inverted/10"
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
color: "neutral",
|
|
764
|
+
variant: "solid",
|
|
765
|
+
outsideView: false,
|
|
766
|
+
class: {
|
|
767
|
+
cellTrigger: "hover:data-[outside-view]:data-[selected]:bg-inverted/10"
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
...(options.theme.colors || []).map((color) => ({
|
|
771
|
+
color,
|
|
772
|
+
variant: "outline",
|
|
773
|
+
class: {
|
|
774
|
+
cellTrigger: `data-[selected]:ring data-[selected]:ring-inset data-[selected]:ring-${color}/50 data-[selected]:text-${color} data-[today]:not-[[data-selected]]:text-${color} data-[highlighted]:bg-${color}/10 hover:not-[[data-selected]]:bg-${color}/10`
|
|
775
|
+
}
|
|
776
|
+
})),
|
|
777
|
+
{
|
|
778
|
+
color: "neutral",
|
|
779
|
+
variant: "outline",
|
|
780
|
+
class: {
|
|
781
|
+
cellTrigger: "data-[selected]:ring data-[selected]:ring-inset data-[selected]:ring-accented data-[selected]:text-default data-[selected]:bg-default data-[today]:not-[[data-selected]]:text-highlighted data-[highlighted]:bg-inverted/10 hover:not-[[data-selected]]:bg-inverted/10"
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
...(options.theme.colors || []).map((color) => ({
|
|
785
|
+
color,
|
|
786
|
+
variant: "soft",
|
|
787
|
+
class: {
|
|
788
|
+
cellTrigger: `data-[selected]:bg-${color}/10 data-[selected]:text-${color} data-[today]:not-[[data-selected]]:text-${color} data-[highlighted]:bg-${color}/20 hover:not-[[data-selected]]:bg-${color}/20`
|
|
789
|
+
}
|
|
790
|
+
})),
|
|
791
|
+
{
|
|
792
|
+
color: "neutral",
|
|
793
|
+
variant: "soft",
|
|
794
|
+
class: {
|
|
795
|
+
cellTrigger: "data-[selected]:bg-elevated data-[selected]:text-default data-[today]:not-[[data-selected]]:text-highlighted data-[highlighted]:bg-inverted/20 hover:not-[[data-selected]]:bg-inverted/10"
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
...(options.theme.colors || []).map((color) => ({
|
|
799
|
+
color,
|
|
800
|
+
variant: "subtle",
|
|
801
|
+
class: {
|
|
802
|
+
cellTrigger: `data-[selected]:bg-${color}/10 data-[selected]:text-${color} data-[selected]:ring data-[selected]:ring-inset data-[selected]:ring-${color}/25 data-[today]:not-[[data-selected]]:text-${color} data-[highlighted]:bg-${color}/20 hover:not-[[data-selected]]:bg-${color}/20`
|
|
803
|
+
}
|
|
804
|
+
})),
|
|
805
|
+
{
|
|
806
|
+
color: "neutral",
|
|
807
|
+
variant: "subtle",
|
|
808
|
+
class: {
|
|
809
|
+
cellTrigger: "data-[selected]:bg-elevated data-[selected]:text-default data-[selected]:ring data-[selected]:ring-inset data-[selected]:ring-accented data-[today]:not-[[data-selected]]:text-highlighted data-[highlighted]:bg-inverted/20 hover:not-[[data-selected]]:bg-inverted/10"
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
],
|
|
813
|
+
defaultVariants: {
|
|
814
|
+
color: "primary",
|
|
815
|
+
variant: "solid",
|
|
816
|
+
size: "md",
|
|
817
|
+
outsideView: true
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
const card = ct({
|
|
822
|
+
parts: {
|
|
823
|
+
root: "rounded divide-y",
|
|
824
|
+
header: "flex flex-wrap items-center gap-1 p-4 sm:px-6",
|
|
825
|
+
body: "flex-1 overflow-y-auto p-4 sm:p-6 empty:hidden",
|
|
826
|
+
footer: "flex items-center gap-1.5 p-4 sm:px-6",
|
|
827
|
+
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
828
|
+
description: "w-full text-muted text-sm"
|
|
829
|
+
},
|
|
830
|
+
variants: {
|
|
831
|
+
variant: {
|
|
832
|
+
solid: {
|
|
833
|
+
root: "bg-inverted text-inverted"
|
|
834
|
+
},
|
|
835
|
+
outline: {
|
|
836
|
+
root: "bg-default ring ring-default divide-y divide-default"
|
|
837
|
+
},
|
|
838
|
+
soft: {
|
|
839
|
+
root: "bg-elevated/50 divide-y divide-default"
|
|
840
|
+
},
|
|
841
|
+
subtle: {
|
|
842
|
+
root: "bg-elevated/50 ring ring-default divide-y divide-default"
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
defaultVariants: {
|
|
847
|
+
variant: "outline"
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
const carousel = (options) => ct({
|
|
852
|
+
parts: {
|
|
853
|
+
root: "relative focus:outline-none",
|
|
854
|
+
viewport: "overflow-hidden",
|
|
855
|
+
container: "flex items-start",
|
|
856
|
+
item: "min-w-0 shrink-0 basis-full",
|
|
857
|
+
controls: "",
|
|
858
|
+
arrows: "",
|
|
859
|
+
prev: "absolute rounded-full",
|
|
860
|
+
next: "absolute rounded-full",
|
|
861
|
+
dots: "absolute inset-x-0 -bottom-7 flex flex-wrap items-center justify-center gap-3",
|
|
862
|
+
dot: [
|
|
863
|
+
"cursor-pointer size-3 bg-accented rounded-full",
|
|
864
|
+
options.theme.transitions && "transition"
|
|
865
|
+
]
|
|
866
|
+
},
|
|
867
|
+
variants: {
|
|
868
|
+
orientation: {
|
|
869
|
+
vertical: {
|
|
870
|
+
container: "flex-col -mt-4",
|
|
871
|
+
item: "pt-4",
|
|
872
|
+
prev: "top-4 sm:-top-12 left-1/2 -translate-x-1/2 rotate-90 rtl:-rotate-90",
|
|
873
|
+
next: "bottom-4 sm:-bottom-12 left-1/2 -translate-x-1/2 rotate-90 rtl:-rotate-90"
|
|
874
|
+
},
|
|
875
|
+
horizontal: {
|
|
876
|
+
container: "flex-row -ms-4",
|
|
877
|
+
item: "ps-4",
|
|
878
|
+
prev: "start-4 sm:-start-12 top-1/2 -translate-y-1/2",
|
|
879
|
+
next: "end-4 sm:-end-12 top-1/2 -translate-y-1/2"
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
active: {
|
|
883
|
+
true: {
|
|
884
|
+
dot: "data-[state=active]:bg-inverted"
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
const checkbox = (options) => ct({
|
|
891
|
+
parts: {
|
|
892
|
+
root: "relative flex items-start",
|
|
893
|
+
container: "flex items-center",
|
|
894
|
+
base: "rounded-sm ring ring-inset ring-accented overflow-hidden cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
895
|
+
indicator: "flex items-center justify-center size-full text-inverted data-[state=checked]:animate-[scale-in_100ms_ease-in-out]",
|
|
896
|
+
icon: "shrink-0 size-full",
|
|
897
|
+
wrapper: "w-full",
|
|
898
|
+
label: "block font-medium text-default cursor-pointer",
|
|
899
|
+
description: "text-muted"
|
|
900
|
+
},
|
|
901
|
+
variants: {
|
|
902
|
+
color: {
|
|
903
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
904
|
+
base: `focus-visible:outline-${color}`,
|
|
905
|
+
indicator: `bg-${color}`
|
|
906
|
+
}])),
|
|
907
|
+
neutral: {
|
|
908
|
+
base: "focus-visible:outline-inverted",
|
|
909
|
+
indicator: "bg-inverted"
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
variant: {
|
|
913
|
+
list: {
|
|
914
|
+
root: ""
|
|
915
|
+
},
|
|
916
|
+
card: {
|
|
917
|
+
root: "border border-muted rounded-lg"
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
indicator: {
|
|
921
|
+
start: {
|
|
922
|
+
root: "flex-row",
|
|
923
|
+
wrapper: "ms-2"
|
|
924
|
+
},
|
|
925
|
+
end: {
|
|
926
|
+
root: "flex-row-reverse",
|
|
927
|
+
wrapper: "me-2"
|
|
928
|
+
},
|
|
929
|
+
hidden: {
|
|
930
|
+
base: "sr-only",
|
|
931
|
+
wrapper: "text-center"
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
size: {
|
|
935
|
+
xs: {
|
|
936
|
+
base: "size-3",
|
|
937
|
+
container: "h-4",
|
|
938
|
+
wrapper: "text-xs"
|
|
939
|
+
},
|
|
940
|
+
sm: {
|
|
941
|
+
base: "size-3.5",
|
|
942
|
+
container: "h-4",
|
|
943
|
+
wrapper: "text-xs"
|
|
944
|
+
},
|
|
945
|
+
md: {
|
|
946
|
+
base: "size-4",
|
|
947
|
+
container: "h-5",
|
|
948
|
+
wrapper: "text-sm"
|
|
949
|
+
},
|
|
950
|
+
lg: {
|
|
951
|
+
base: "size-4.5",
|
|
952
|
+
container: "h-5",
|
|
953
|
+
wrapper: "text-sm"
|
|
954
|
+
},
|
|
955
|
+
xl: {
|
|
956
|
+
base: "size-5",
|
|
957
|
+
container: "h-6",
|
|
958
|
+
wrapper: "text-base"
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
required: {
|
|
962
|
+
true: {
|
|
963
|
+
label: `after:content-['*'] after:ms-0.5 after:text-error`
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
disabled: {
|
|
967
|
+
true: {
|
|
968
|
+
base: "cursor-not-allowed opacity-75",
|
|
969
|
+
label: "cursor-not-allowed opacity-75",
|
|
970
|
+
description: "cursor-not-allowed opacity-75"
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
checked: {
|
|
974
|
+
true: ""
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
compoundVariants: [
|
|
978
|
+
{ size: "xs", variant: "card", class: { root: "p-2.5" } },
|
|
979
|
+
{ size: "sm", variant: "card", class: { root: "p-3" } },
|
|
980
|
+
{ size: "md", variant: "card", class: { root: "p-3.5" } },
|
|
981
|
+
{ size: "lg", variant: "card", class: { root: "p-4" } },
|
|
982
|
+
{ size: "xl", variant: "card", class: { root: "p-4.5" } },
|
|
983
|
+
...(options.theme.colors || []).map((color) => ({
|
|
984
|
+
color,
|
|
985
|
+
variant: "card",
|
|
986
|
+
class: {
|
|
987
|
+
root: `has-data-[state=checked]:border-${color}`
|
|
988
|
+
}
|
|
989
|
+
})),
|
|
990
|
+
{
|
|
991
|
+
color: "neutral",
|
|
992
|
+
variant: "card",
|
|
993
|
+
class: {
|
|
994
|
+
root: "has-data-[state=checked]:border-inverted"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
variant: "card",
|
|
999
|
+
disabled: true,
|
|
1000
|
+
class: {
|
|
1001
|
+
root: "cursor-not-allowed opacity-75"
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
],
|
|
1005
|
+
defaultVariants: {
|
|
1006
|
+
size: "md",
|
|
1007
|
+
color: "primary",
|
|
1008
|
+
variant: "list",
|
|
1009
|
+
indicator: "start"
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
const chip = (options) => ct({
|
|
1014
|
+
parts: {
|
|
1015
|
+
root: "relative inline-flex items-center justify-center shrink-0",
|
|
1016
|
+
base: "rounded-full ring ring-bg flex items-center justify-center text-inverted font-medium whitespace-nowrap"
|
|
1017
|
+
},
|
|
1018
|
+
variants: {
|
|
1019
|
+
color: {
|
|
1020
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, { base: `bg-${color}` }])),
|
|
1021
|
+
neutral: { base: "bg-inverted" }
|
|
1022
|
+
},
|
|
1023
|
+
size: {
|
|
1024
|
+
"3xs": { base: "h-[4px] min-w-[4px] text-[4px]" },
|
|
1025
|
+
"2xs": { base: "h-[5px] min-w-[5px] text-[5px]" },
|
|
1026
|
+
"xs": { base: "h-[6px] min-w-[6px] text-[6px]" },
|
|
1027
|
+
"sm": { base: "h-[7px] min-w-[7px] text-[7px]" },
|
|
1028
|
+
"md": { base: "h-[8px] min-w-[8px] text-[8px]" },
|
|
1029
|
+
"lg": { base: "h-[9px] min-w-[9px] text-[9px]" },
|
|
1030
|
+
"xl": { base: "h-[10px] min-w-[10px] text-[10px]" },
|
|
1031
|
+
"2xl": { base: "h-[11px] min-w-[11px] text-[11px]" },
|
|
1032
|
+
"3xl": { base: "h-[12px] min-w-[12px] text-[12px]" }
|
|
1033
|
+
},
|
|
1034
|
+
position: {
|
|
1035
|
+
"top-right": { base: "top-0 right-0" },
|
|
1036
|
+
"bottom-right": { base: "bottom-0 right-0" },
|
|
1037
|
+
"top-left": { base: "top-0 left-0" },
|
|
1038
|
+
"bottom-left": { base: "bottom-0 left-0" }
|
|
1039
|
+
},
|
|
1040
|
+
show: {
|
|
1041
|
+
true: {
|
|
1042
|
+
base: "animate-[scale-in_200ms_ease-out]"
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
inset: {
|
|
1046
|
+
false: ""
|
|
1047
|
+
},
|
|
1048
|
+
standalone: {
|
|
1049
|
+
false: { base: "absolute" }
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
compoundVariants: [
|
|
1053
|
+
{
|
|
1054
|
+
position: "top-right",
|
|
1055
|
+
inset: false,
|
|
1056
|
+
class: {
|
|
1057
|
+
base: "-translate-y-1/2 translate-x-1/2 transform"
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
position: "bottom-right",
|
|
1062
|
+
inset: false,
|
|
1063
|
+
class: {
|
|
1064
|
+
base: "translate-y-1/2 translate-x-1/2 transform"
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
position: "top-left",
|
|
1069
|
+
inset: false,
|
|
1070
|
+
class: {
|
|
1071
|
+
base: "-translate-y-1/2 -translate-x-1/2 transform"
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
position: "bottom-left",
|
|
1076
|
+
inset: false,
|
|
1077
|
+
class: {
|
|
1078
|
+
base: "translate-y-1/2 -translate-x-1/2 transform"
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
],
|
|
1082
|
+
defaultVariants: {
|
|
1083
|
+
size: "md",
|
|
1084
|
+
color: "primary",
|
|
1085
|
+
position: "top-right"
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
const collapsible = ct({
|
|
1090
|
+
parts: {
|
|
1091
|
+
root: "",
|
|
1092
|
+
content: "data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
const drawer = ct({
|
|
1097
|
+
parts: {
|
|
1098
|
+
overlay: "fixed inset-0 bg-elevated/75",
|
|
1099
|
+
content: "fixed bg-default divide-y divide-default flex flex-col focus:outline-none",
|
|
1100
|
+
header: "flex flex-wrap items-center gap-1 p-4 sm:px-6",
|
|
1101
|
+
body: "flex-1 overflow-y-auto p-4 sm:p-6",
|
|
1102
|
+
footer: "flex items-center gap-1 p-4 sm:p-6",
|
|
1103
|
+
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
1104
|
+
description: "w-full text-muted text-sm",
|
|
1105
|
+
close: "ms-auto"
|
|
1106
|
+
},
|
|
1107
|
+
variants: {
|
|
1108
|
+
direction: {
|
|
1109
|
+
top: {
|
|
1110
|
+
content: "inset-x-0 top-0 max-h-full"
|
|
1111
|
+
},
|
|
1112
|
+
right: {
|
|
1113
|
+
content: "right-0 inset-y-0 w-full max-w-md"
|
|
1114
|
+
},
|
|
1115
|
+
bottom: {
|
|
1116
|
+
content: "inset-x-0 bottom-0 max-h-full"
|
|
1117
|
+
},
|
|
1118
|
+
left: {
|
|
1119
|
+
content: "left-0 inset-y-0 w-full max-w-md"
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
transition: {
|
|
1123
|
+
true: {
|
|
1124
|
+
overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
inset: {
|
|
1128
|
+
true: {
|
|
1129
|
+
content: "rounded-lg after:hidden overflow-hidden [--initial-transform:calc(100%+1.5rem)]"
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
compoundVariants: [
|
|
1134
|
+
{
|
|
1135
|
+
direction: ["top", "bottom"],
|
|
1136
|
+
class: {
|
|
1137
|
+
content: "h-auto max-h-[96%]"
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
direction: ["left", "right"],
|
|
1142
|
+
class: {
|
|
1143
|
+
content: "w-auto max-w-[calc(100%-2rem)]"
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
direction: "top",
|
|
1148
|
+
inset: true,
|
|
1149
|
+
class: {
|
|
1150
|
+
content: "inset-x-4 top-4"
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
direction: "top",
|
|
1155
|
+
inset: false,
|
|
1156
|
+
class: {
|
|
1157
|
+
content: "inset-x-0 top-0 rounded-b-lg"
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
direction: ["top"],
|
|
1162
|
+
transition: true,
|
|
1163
|
+
class: {
|
|
1164
|
+
content: "data-[state=open]:animate-[slide-in-from-top_500ms_cubic-bezier(0.32,0.72,0,1)] data-[state=closed]:animate-[slide-out-to-top_500ms_cubic-bezier(0.32,0.72,0,1)]"
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
direction: "bottom",
|
|
1169
|
+
inset: true,
|
|
1170
|
+
class: {
|
|
1171
|
+
content: "inset-x-4 bottom-4"
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
direction: "bottom",
|
|
1176
|
+
inset: false,
|
|
1177
|
+
class: {
|
|
1178
|
+
content: "inset-x-0 bottom-0 rounded-t-lg"
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
direction: ["bottom"],
|
|
1183
|
+
transition: true,
|
|
1184
|
+
class: {
|
|
1185
|
+
content: "data-[state=open]:animate-[slide-in-from-bottom_500ms_cubic-bezier(0.32,0.72,0,1)] data-[state=closed]:animate-[slide-out-to-bottom_500ms_cubic-bezier(0.32,0.72,0,1)]"
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
direction: "left",
|
|
1190
|
+
inset: true,
|
|
1191
|
+
class: {
|
|
1192
|
+
content: "inset-y-4 left-4"
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
direction: "left",
|
|
1197
|
+
inset: false,
|
|
1198
|
+
class: {
|
|
1199
|
+
content: "inset-y-0 left-0 rounded-r-lg"
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
direction: ["left"],
|
|
1204
|
+
transition: true,
|
|
1205
|
+
class: {
|
|
1206
|
+
content: "data-[state=open]:animate-[slide-in-from-left_500ms_cubic-bezier(0.32,0.72,0,1)] data-[state=closed]:animate-[slide-out-to-left_500ms_cubic-bezier(0.32,0.72,0,1)]"
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
direction: "right",
|
|
1211
|
+
inset: true,
|
|
1212
|
+
class: {
|
|
1213
|
+
content: "inset-y-4 right-4"
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
direction: "right",
|
|
1218
|
+
inset: false,
|
|
1219
|
+
class: {
|
|
1220
|
+
content: "inset-y-0 right-0 rounded-l-lg"
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
direction: ["right"],
|
|
1225
|
+
transition: true,
|
|
1226
|
+
class: {
|
|
1227
|
+
content: "data-[state=open]:animate-[slide-in-from-right_500ms_cubic-bezier(0.32,0.72,0,1)] data-[state=closed]:animate-[slide-out-to-right_500ms_cubic-bezier(0.32,0.72,0,1)]"
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
]
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
const dropdownMenu = (options) => ct({
|
|
1234
|
+
parts: {
|
|
1235
|
+
content: "min-w-32 bg-default shadow-lg rounded-md ring ring-default overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-[--reka-dropdown-menu-content-transform-origin] flex flex-col",
|
|
1236
|
+
viewport: "relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1",
|
|
1237
|
+
arrow: "fill-default",
|
|
1238
|
+
group: "p-1 isolate",
|
|
1239
|
+
label: "w-full flex items-center font-semibold text-highlighted",
|
|
1240
|
+
separator: "-mx-1 my-1 h-px bg-border",
|
|
1241
|
+
item: "group relative w-full flex items-start select-none outline-none before:content-empty before:absolute before:z-[-1] before:inset-px before:rounded-md data-[disabled]:cursor-not-allowed data-[disabled]:opacity-75",
|
|
1242
|
+
itemLeadingIcon: "shrink-0",
|
|
1243
|
+
itemLeadingAvatar: "shrink-0",
|
|
1244
|
+
itemLeadingAvatarSize: "",
|
|
1245
|
+
itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
1246
|
+
itemTrailingIcon: "shrink-0",
|
|
1247
|
+
itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0",
|
|
1248
|
+
itemTrailingKbdsSize: "",
|
|
1249
|
+
itemWrapper: "flex-1 flex flex-col items-start min-w-0",
|
|
1250
|
+
itemLabel: "truncate",
|
|
1251
|
+
itemDescription: "truncate text-muted",
|
|
1252
|
+
itemLabelExternalIcon: "inline-block size-3 align-top text-dimmed"
|
|
1253
|
+
},
|
|
1254
|
+
variants: {
|
|
1255
|
+
color: {
|
|
1256
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1257
|
+
neutral: ""
|
|
1258
|
+
},
|
|
1259
|
+
active: {
|
|
1260
|
+
true: {
|
|
1261
|
+
item: "text-highlighted before:bg-elevated",
|
|
1262
|
+
itemLeadingIcon: "text-default"
|
|
1263
|
+
},
|
|
1264
|
+
false: {
|
|
1265
|
+
item: [
|
|
1266
|
+
"text-default data-[highlighted]:text-highlighted data-[state=open]:text-highlighted data-[highlighted]:before:bg-elevated/50 data-[state=open]:before:bg-elevated/50",
|
|
1267
|
+
options.theme.transitions && "transition-colors before:transition-colors"
|
|
1268
|
+
],
|
|
1269
|
+
itemLeadingIcon: [
|
|
1270
|
+
"text-dimmed group-data-[highlighted]:text-default group-data-[state=open]:text-default",
|
|
1271
|
+
options.theme.transitions && "transition-colors"
|
|
1272
|
+
]
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
loading: {
|
|
1276
|
+
true: {
|
|
1277
|
+
itemLeadingIcon: "animate-spin"
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
size: {
|
|
1281
|
+
xs: {
|
|
1282
|
+
label: "p-1 text-xs gap-1",
|
|
1283
|
+
item: "p-1 text-xs gap-1",
|
|
1284
|
+
itemLeadingIcon: "size-4",
|
|
1285
|
+
itemLeadingAvatarSize: "3xs",
|
|
1286
|
+
itemTrailingIcon: "size-4",
|
|
1287
|
+
itemTrailingKbds: "gap-0.5",
|
|
1288
|
+
itemTrailingKbdsSize: "sm"
|
|
1289
|
+
},
|
|
1290
|
+
sm: {
|
|
1291
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
1292
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
1293
|
+
itemLeadingIcon: "size-4",
|
|
1294
|
+
itemLeadingAvatarSize: "3xs",
|
|
1295
|
+
itemTrailingIcon: "size-4",
|
|
1296
|
+
itemTrailingKbds: "gap-0.5",
|
|
1297
|
+
itemTrailingKbdsSize: "sm"
|
|
1298
|
+
},
|
|
1299
|
+
md: {
|
|
1300
|
+
label: "p-1.5 text-sm gap-1.5",
|
|
1301
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
1302
|
+
itemLeadingIcon: "size-5",
|
|
1303
|
+
itemLeadingAvatarSize: "2xs",
|
|
1304
|
+
itemTrailingIcon: "size-5",
|
|
1305
|
+
itemTrailingKbds: "gap-0.5",
|
|
1306
|
+
itemTrailingKbdsSize: "md"
|
|
1307
|
+
},
|
|
1308
|
+
lg: {
|
|
1309
|
+
label: "p-2 text-sm gap-2",
|
|
1310
|
+
item: "p-2 text-sm gap-2",
|
|
1311
|
+
itemLeadingIcon: "size-5",
|
|
1312
|
+
itemLeadingAvatarSize: "2xs",
|
|
1313
|
+
itemTrailingIcon: "size-5",
|
|
1314
|
+
itemTrailingKbds: "gap-1",
|
|
1315
|
+
itemTrailingKbdsSize: "md"
|
|
1316
|
+
},
|
|
1317
|
+
xl: {
|
|
1318
|
+
label: "p-2 text-base gap-2",
|
|
1319
|
+
item: "p-2 text-base gap-2",
|
|
1320
|
+
itemLeadingIcon: "size-6",
|
|
1321
|
+
itemLeadingAvatarSize: "xs",
|
|
1322
|
+
itemTrailingIcon: "size-6",
|
|
1323
|
+
itemTrailingKbds: "gap-1",
|
|
1324
|
+
itemTrailingKbdsSize: "lg"
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
compoundVariants: [
|
|
1329
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1330
|
+
color,
|
|
1331
|
+
active: false,
|
|
1332
|
+
class: {
|
|
1333
|
+
item: `text-${color} data-[highlighted]:text-${color} data-[highlighted]:before:bg-${color}/10 data-[state=open]:before:bg-${color}/10`,
|
|
1334
|
+
itemLeadingIcon: `text-${color}/75 group-data-[highlighted]:text-${color} group-data-[state=open]:text-${color}`
|
|
1335
|
+
}
|
|
1336
|
+
})),
|
|
1337
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1338
|
+
color,
|
|
1339
|
+
active: true,
|
|
1340
|
+
class: {
|
|
1341
|
+
item: `text-${color} before:bg-${color}/10`,
|
|
1342
|
+
itemLeadingIcon: `text-${color}`
|
|
1343
|
+
}
|
|
1344
|
+
}))
|
|
1345
|
+
],
|
|
1346
|
+
defaultVariants: {
|
|
1347
|
+
size: "md"
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
const form = ct({
|
|
1352
|
+
base: ""
|
|
1353
|
+
});
|
|
1354
|
+
|
|
1355
|
+
const formField = ct({
|
|
1356
|
+
parts: {
|
|
1357
|
+
root: "",
|
|
1358
|
+
wrapper: "",
|
|
1359
|
+
labelWrapper: "flex content-center items-center justify-between",
|
|
1360
|
+
label: "block font-medium text-default",
|
|
1361
|
+
container: "mt-1 relative",
|
|
1362
|
+
description: "text-muted",
|
|
1363
|
+
error: "mt-2 text-error",
|
|
1364
|
+
hint: "text-muted",
|
|
1365
|
+
help: "mt-2 text-muted"
|
|
1366
|
+
},
|
|
1367
|
+
variants: {
|
|
1368
|
+
size: {
|
|
1369
|
+
xs: { root: "text-xs" },
|
|
1370
|
+
sm: { root: "text-xs" },
|
|
1371
|
+
md: { root: "text-sm" },
|
|
1372
|
+
lg: { root: "text-sm" },
|
|
1373
|
+
xl: { root: "text-base" }
|
|
1374
|
+
},
|
|
1375
|
+
required: {
|
|
1376
|
+
true: {
|
|
1377
|
+
label: `after:content-['*'] after:ms-0.5 after:text-error`
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
defaultVariants: {
|
|
1382
|
+
size: "md"
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
const inputTheme = (options) => ct({
|
|
1387
|
+
parts: {
|
|
1388
|
+
root: "relative inline-flex items-center",
|
|
1389
|
+
base: [
|
|
1390
|
+
"w-full rounded-md border-0 appearance-none placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
|
|
1391
|
+
options.theme.transitions && "transition-colors"
|
|
1392
|
+
],
|
|
1393
|
+
leading: "absolute inset-y-0 start-0 flex items-center",
|
|
1394
|
+
leadingIcon: "shrink-0 text-dimmed",
|
|
1395
|
+
leadingAvatar: "shrink-0",
|
|
1396
|
+
leadingAvatarSize: "",
|
|
1397
|
+
trailing: "absolute inset-y-0 end-0 flex items-center",
|
|
1398
|
+
trailingIcon: "shrink-0 text-dimmed"
|
|
1399
|
+
},
|
|
1400
|
+
variants: {
|
|
1401
|
+
...fieldGroupVariantWithRoot,
|
|
1402
|
+
size: {
|
|
1403
|
+
xs: {
|
|
1404
|
+
base: "px-2 py-1 text-xs gap-1",
|
|
1405
|
+
leading: "ps-2",
|
|
1406
|
+
trailing: "pe-2",
|
|
1407
|
+
leadingIcon: "size-4",
|
|
1408
|
+
leadingAvatarSize: "3xs",
|
|
1409
|
+
trailingIcon: "size-4"
|
|
1410
|
+
},
|
|
1411
|
+
sm: {
|
|
1412
|
+
base: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
1413
|
+
leading: "ps-2.5",
|
|
1414
|
+
trailing: "pe-2.5",
|
|
1415
|
+
leadingIcon: "size-4",
|
|
1416
|
+
leadingAvatarSize: "3xs",
|
|
1417
|
+
trailingIcon: "size-4"
|
|
1418
|
+
},
|
|
1419
|
+
md: {
|
|
1420
|
+
base: "px-2.5 py-1.5 text-sm gap-1.5",
|
|
1421
|
+
leading: "ps-2.5",
|
|
1422
|
+
trailing: "pe-2.5",
|
|
1423
|
+
leadingIcon: "size-5",
|
|
1424
|
+
leadingAvatarSize: "2xs",
|
|
1425
|
+
trailingIcon: "size-5"
|
|
1426
|
+
},
|
|
1427
|
+
lg: {
|
|
1428
|
+
base: "px-3 py-2 text-sm gap-2",
|
|
1429
|
+
leading: "ps-3",
|
|
1430
|
+
trailing: "pe-3",
|
|
1431
|
+
leadingIcon: "size-5",
|
|
1432
|
+
leadingAvatarSize: "2xs",
|
|
1433
|
+
trailingIcon: "size-5"
|
|
1434
|
+
},
|
|
1435
|
+
xl: {
|
|
1436
|
+
base: "px-3 py-2 text-base gap-2",
|
|
1437
|
+
leading: "ps-3",
|
|
1438
|
+
trailing: "pe-3",
|
|
1439
|
+
leadingIcon: "size-6",
|
|
1440
|
+
leadingAvatarSize: "xs",
|
|
1441
|
+
trailingIcon: "size-6"
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
variant: {
|
|
1445
|
+
outline: { base: "text-highlighted bg-default ring ring-inset ring-accented" },
|
|
1446
|
+
soft: { base: "text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50" },
|
|
1447
|
+
subtle: { base: "text-highlighted bg-elevated ring ring-inset ring-accented" },
|
|
1448
|
+
ghost: { base: "text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent" },
|
|
1449
|
+
none: { base: "text-highlighted bg-transparent" }
|
|
1450
|
+
},
|
|
1451
|
+
color: {
|
|
1452
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1453
|
+
neutral: ""
|
|
1454
|
+
},
|
|
1455
|
+
leading: {
|
|
1456
|
+
true: ""
|
|
1457
|
+
},
|
|
1458
|
+
trailing: {
|
|
1459
|
+
true: ""
|
|
1460
|
+
},
|
|
1461
|
+
loading: {
|
|
1462
|
+
true: ""
|
|
1463
|
+
},
|
|
1464
|
+
highlight: {
|
|
1465
|
+
true: ""
|
|
1466
|
+
},
|
|
1467
|
+
type: {
|
|
1468
|
+
file: { base: "file:me-1.5 file:font-medium file:text-muted file:outline-none" }
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
compoundVariants: [
|
|
1472
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1473
|
+
color,
|
|
1474
|
+
variant: ["outline", "subtle"],
|
|
1475
|
+
class: { base: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}` }
|
|
1476
|
+
})),
|
|
1477
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1478
|
+
color,
|
|
1479
|
+
highlight: true,
|
|
1480
|
+
class: { base: `ring ring-inset ring-${color}` }
|
|
1481
|
+
})),
|
|
1482
|
+
{
|
|
1483
|
+
color: "neutral",
|
|
1484
|
+
variant: ["outline", "subtle"],
|
|
1485
|
+
class: { base: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted" }
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
color: "neutral",
|
|
1489
|
+
highlight: true,
|
|
1490
|
+
class: { base: "ring ring-inset ring-inverted" }
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
leading: true,
|
|
1494
|
+
size: "xs",
|
|
1495
|
+
class: { base: "ps-7" }
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
leading: true,
|
|
1499
|
+
size: "sm",
|
|
1500
|
+
class: { base: "ps-8" }
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
leading: true,
|
|
1504
|
+
size: "md",
|
|
1505
|
+
class: { base: "ps-9" }
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
leading: true,
|
|
1509
|
+
size: "lg",
|
|
1510
|
+
class: { base: "ps-10" }
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
leading: true,
|
|
1514
|
+
size: "xl",
|
|
1515
|
+
class: { base: "ps-11" }
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
trailing: true,
|
|
1519
|
+
size: "xs",
|
|
1520
|
+
class: { base: "pe-7" }
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
trailing: true,
|
|
1524
|
+
size: "sm",
|
|
1525
|
+
class: { base: "pe-8" }
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
trailing: true,
|
|
1529
|
+
size: "md",
|
|
1530
|
+
class: { base: "pe-9" }
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
trailing: true,
|
|
1534
|
+
size: "lg",
|
|
1535
|
+
class: { base: "pe-10" }
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
trailing: true,
|
|
1539
|
+
size: "xl",
|
|
1540
|
+
class: { base: "pe-11" }
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
loading: true,
|
|
1544
|
+
leading: true,
|
|
1545
|
+
class: {
|
|
1546
|
+
leadingIcon: "animate-spin"
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
{
|
|
1550
|
+
loading: true,
|
|
1551
|
+
leading: false,
|
|
1552
|
+
trailing: true,
|
|
1553
|
+
class: {
|
|
1554
|
+
trailingIcon: "animate-spin"
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
],
|
|
1558
|
+
defaultVariants: {
|
|
1559
|
+
size: "md",
|
|
1560
|
+
color: "primary",
|
|
1561
|
+
variant: "outline"
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
const inputNumber = (options) => {
|
|
1566
|
+
const input = inputTheme(options);
|
|
1567
|
+
return ct({
|
|
1568
|
+
parts: {
|
|
1569
|
+
root: "relative inline-flex items-center",
|
|
1570
|
+
base: [
|
|
1571
|
+
"w-full rounded-md border-0 placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
|
|
1572
|
+
options.theme.transitions && "transition-colors"
|
|
1573
|
+
],
|
|
1574
|
+
increment: "absolute flex items-center",
|
|
1575
|
+
decrement: "absolute flex items-center"
|
|
1576
|
+
},
|
|
1577
|
+
variants: {
|
|
1578
|
+
...fieldGroupVariantWithRoot,
|
|
1579
|
+
color: {
|
|
1580
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1581
|
+
neutral: ""
|
|
1582
|
+
},
|
|
1583
|
+
size: {
|
|
1584
|
+
xs: { base: "px-2 py-1 text-xs gap-1" },
|
|
1585
|
+
sm: { base: "px-2.5 py-1.5 text-xs gap-1.5" },
|
|
1586
|
+
md: { base: "px-2.5 py-1.5 text-sm gap-1.5" },
|
|
1587
|
+
lg: { base: "px-3 py-2 text-sm gap-2" },
|
|
1588
|
+
xl: { base: "px-3 py-2 text-base gap-2" }
|
|
1589
|
+
},
|
|
1590
|
+
variant: {
|
|
1591
|
+
...input.variants.variant
|
|
1592
|
+
},
|
|
1593
|
+
disabled: {
|
|
1594
|
+
true: {
|
|
1595
|
+
increment: "opacity-75 cursor-not-allowed",
|
|
1596
|
+
decrement: "opacity-75 cursor-not-allowed"
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
orientation: {
|
|
1600
|
+
horizontal: {
|
|
1601
|
+
base: "text-center",
|
|
1602
|
+
increment: "inset-y-0 end-0 pe-1",
|
|
1603
|
+
decrement: "inset-y-0 start-0 ps-1"
|
|
1604
|
+
},
|
|
1605
|
+
vertical: {
|
|
1606
|
+
increment: "top-0 end-0 pe-1 [&>button]:py-0 scale-80",
|
|
1607
|
+
decrement: "bottom-0 end-0 pe-1 [&>button]:py-0 scale-80"
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
highlight: {
|
|
1611
|
+
true: ""
|
|
1612
|
+
},
|
|
1613
|
+
increment: {
|
|
1614
|
+
false: ""
|
|
1615
|
+
},
|
|
1616
|
+
decrement: {
|
|
1617
|
+
false: ""
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
compoundVariants: [
|
|
1621
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1622
|
+
color,
|
|
1623
|
+
variant: ["outline", "subtle"],
|
|
1624
|
+
class: { base: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}` }
|
|
1625
|
+
})),
|
|
1626
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1627
|
+
color,
|
|
1628
|
+
highlight: true,
|
|
1629
|
+
class: { base: `ring ring-inset ring-${color}` }
|
|
1630
|
+
})),
|
|
1631
|
+
{
|
|
1632
|
+
color: "neutral",
|
|
1633
|
+
variant: ["outline", "subtle"],
|
|
1634
|
+
class: { base: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted" }
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
color: "neutral",
|
|
1638
|
+
highlight: true,
|
|
1639
|
+
class: { base: "ring ring-inset ring-inverted" }
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
orientation: "horizontal",
|
|
1643
|
+
decrement: false,
|
|
1644
|
+
class: { base: "text-start" }
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
decrement: true,
|
|
1648
|
+
size: "xs",
|
|
1649
|
+
class: { base: "ps-7" }
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
decrement: true,
|
|
1653
|
+
size: "sm",
|
|
1654
|
+
class: { base: "ps-8" }
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
decrement: true,
|
|
1658
|
+
size: "md",
|
|
1659
|
+
class: { base: "ps-9" }
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
decrement: true,
|
|
1663
|
+
size: "lg",
|
|
1664
|
+
class: { base: "ps-10" }
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
decrement: true,
|
|
1668
|
+
size: "xl",
|
|
1669
|
+
class: { base: "ps-11" }
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
increment: true,
|
|
1673
|
+
size: "xs",
|
|
1674
|
+
class: { base: "pe-7" }
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
increment: true,
|
|
1678
|
+
size: "sm",
|
|
1679
|
+
class: { base: "pe-8" }
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
increment: true,
|
|
1683
|
+
size: "md",
|
|
1684
|
+
class: { base: "pe-9" }
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
increment: true,
|
|
1688
|
+
size: "lg",
|
|
1689
|
+
class: { base: "pe-10" }
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
increment: true,
|
|
1693
|
+
size: "xl",
|
|
1694
|
+
class: { base: "pe-11" }
|
|
1695
|
+
}
|
|
1696
|
+
],
|
|
1697
|
+
defaultVariants: {
|
|
1698
|
+
size: "md",
|
|
1699
|
+
color: "primary",
|
|
1700
|
+
variant: "outline"
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
};
|
|
1704
|
+
|
|
1705
|
+
const kbd = (options) => ct({
|
|
1706
|
+
base: "inline-flex items-center justify-center p-1 rounded-sm font-medium font-sans",
|
|
1707
|
+
variants: {
|
|
1708
|
+
color: {
|
|
1709
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1710
|
+
neutral: ""
|
|
1711
|
+
},
|
|
1712
|
+
variant: {
|
|
1713
|
+
solid: "",
|
|
1714
|
+
outline: "",
|
|
1715
|
+
soft: "",
|
|
1716
|
+
subtle: ""
|
|
1717
|
+
},
|
|
1718
|
+
size: {
|
|
1719
|
+
sm: "h-4 min-w-4 text-[0.5rem]",
|
|
1720
|
+
md: "h-5 min-w-5 text-[0.75rem]",
|
|
1721
|
+
lg: "h-6 min-w-6 text-[1rem]"
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
compoundVariants: [
|
|
1725
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1726
|
+
color,
|
|
1727
|
+
variant: "solid",
|
|
1728
|
+
class: `text-inverted bg-${color}`
|
|
1729
|
+
})),
|
|
1730
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1731
|
+
color,
|
|
1732
|
+
variant: "outline",
|
|
1733
|
+
class: `ring ring-inset ring-${color}/50 text-${color}`
|
|
1734
|
+
})),
|
|
1735
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1736
|
+
color,
|
|
1737
|
+
variant: "soft",
|
|
1738
|
+
class: `text-${color} bg-${color}/10`
|
|
1739
|
+
})),
|
|
1740
|
+
...(options.theme.colors || []).map((color) => ({
|
|
1741
|
+
color,
|
|
1742
|
+
variant: "subtle",
|
|
1743
|
+
class: `text-${color} ring ring-inset ring-${color}/25 bg-${color}/10`
|
|
1744
|
+
})),
|
|
1745
|
+
{
|
|
1746
|
+
color: "neutral",
|
|
1747
|
+
variant: "solid",
|
|
1748
|
+
class: "text-inverted bg-inverted"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
color: "neutral",
|
|
1752
|
+
variant: "outline",
|
|
1753
|
+
class: "ring ring-inset ring-accented text-default bg-default"
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
color: "neutral",
|
|
1757
|
+
variant: "soft",
|
|
1758
|
+
class: "text-default bg-elevated"
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
color: "neutral",
|
|
1762
|
+
variant: "subtle",
|
|
1763
|
+
class: "ring ring-inset ring-accented text-default bg-elevated"
|
|
1764
|
+
}
|
|
1765
|
+
],
|
|
1766
|
+
defaultVariants: {
|
|
1767
|
+
variant: "outline",
|
|
1768
|
+
color: "neutral",
|
|
1769
|
+
size: "md"
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
|
|
1773
|
+
const link = (options) => ct({
|
|
1774
|
+
base: "focus-visible:outline-primary",
|
|
1775
|
+
variants: {
|
|
1776
|
+
active: {
|
|
1777
|
+
true: "text-primary",
|
|
1778
|
+
false: "text-muted"
|
|
1779
|
+
},
|
|
1780
|
+
disabled: {
|
|
1781
|
+
true: "cursor-not-allowed opacity-75"
|
|
1782
|
+
}
|
|
1783
|
+
},
|
|
1784
|
+
compoundVariants: [
|
|
1785
|
+
{
|
|
1786
|
+
active: false,
|
|
1787
|
+
disabled: false,
|
|
1788
|
+
class: [
|
|
1789
|
+
"hover:text-default",
|
|
1790
|
+
options.theme.transitions && "transition-colors"
|
|
1791
|
+
]
|
|
1792
|
+
}
|
|
1793
|
+
]
|
|
1794
|
+
});
|
|
1795
|
+
|
|
1796
|
+
const modal = ct({
|
|
1797
|
+
parts: {
|
|
1798
|
+
overlay: "fixed inset-0 bg-elevated/75",
|
|
1799
|
+
content: "fixed bg-default divide-y divide-default flex flex-col focus:outline-none",
|
|
1800
|
+
header: "flex flex-wrap items-center gap-1 p-4 sm:px-6",
|
|
1801
|
+
body: "flex-1 overflow-y-auto p-4 sm:p-6",
|
|
1802
|
+
footer: "flex items-center gap-1 p-4 sm:px-6",
|
|
1803
|
+
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
1804
|
+
description: "w-full text-muted text-sm",
|
|
1805
|
+
close: "ms-auto"
|
|
1806
|
+
},
|
|
1807
|
+
variants: {
|
|
1808
|
+
transition: {
|
|
1809
|
+
true: {
|
|
1810
|
+
overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]",
|
|
1811
|
+
content: "data-[state=open]:animate-[scale-in_200ms_ease-out] data-[state=closed]:animate-[scale-out_200ms_ease-in]"
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
fullscreen: {
|
|
1815
|
+
true: {
|
|
1816
|
+
content: "inset-0"
|
|
1817
|
+
},
|
|
1818
|
+
false: {
|
|
1819
|
+
content: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[calc(100vw-2rem)] max-w-lg max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] rounded-lg shadow-lg ring ring-default overflow-hidden"
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
});
|
|
1824
|
+
|
|
1825
|
+
const navigationMenu = (options) => ct({
|
|
1826
|
+
parts: {
|
|
1827
|
+
root: "relative flex gap-1.5 [&>div]:min-w-0",
|
|
1828
|
+
list: "isolate min-w-0",
|
|
1829
|
+
label: "w-full flex items-center gap-1.5 font-semibold text-xs/5 text-highlighted px-2.5 py-1.5",
|
|
1830
|
+
item: "min-w-0",
|
|
1831
|
+
link: "group relative w-full flex items-center gap-1.5 font-medium text-sm before:content-empty before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",
|
|
1832
|
+
linkLeadingIcon: "shrink-0 size-5",
|
|
1833
|
+
linkLeadingAvatar: "shrink-0",
|
|
1834
|
+
linkLeadingAvatarSize: "2xs",
|
|
1835
|
+
linkTrailing: "group ms-auto inline-flex gap-1.5 items-center",
|
|
1836
|
+
linkTrailingBadge: "shrink-0",
|
|
1837
|
+
linkTrailingBadgeSize: "sm",
|
|
1838
|
+
linkTrailingIcon: "size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
1839
|
+
linkLabel: "truncate",
|
|
1840
|
+
linkLabelExternalIcon: "inline-block size-3 align-top text-dimmed",
|
|
1841
|
+
childList: "isolate",
|
|
1842
|
+
childLabel: "text-xs text-highlighted",
|
|
1843
|
+
childItem: "",
|
|
1844
|
+
childLink: "group relative size-full flex items-start text-start text-sm before:content-empty before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",
|
|
1845
|
+
childLinkWrapper: "min-w-0",
|
|
1846
|
+
childLinkIcon: "size-5 shrink-0",
|
|
1847
|
+
childLinkLabel: "truncate",
|
|
1848
|
+
childLinkLabelExternalIcon: "inline-block size-3 align-top text-dimmed",
|
|
1849
|
+
childLinkDescription: "text-muted",
|
|
1850
|
+
separator: "px-2 h-px bg-border",
|
|
1851
|
+
viewportWrapper: "absolute top-full left-0 flex w-full",
|
|
1852
|
+
viewport: "relative overflow-hidden bg-default shadow-lg rounded-md ring ring-default h-[--reka-navigation-menu-viewport-height] w-full transition-[width,height,left] duration-200 origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] z-[1]",
|
|
1853
|
+
content: "",
|
|
1854
|
+
indicator: "absolute data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] data-[state=hidden]:opacity-0 bottom-0 z-[2] w-[--reka-navigation-menu-indicator-size] translate-x-[--reka-navigation-menu-indicator-position] flex h-2.5 items-end justify-center overflow-hidden transition-[translate,width] duration-200",
|
|
1855
|
+
arrow: "relative top-[50%] size-2.5 rotate-45 border border-default bg-default z-[1] rounded-xs"
|
|
1856
|
+
},
|
|
1857
|
+
variants: {
|
|
1858
|
+
color: {
|
|
1859
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
1860
|
+
link: `focus-visible:before:ring-${color}`,
|
|
1861
|
+
childLink: `focus-visible:before:ring-${color}`
|
|
1862
|
+
}])),
|
|
1863
|
+
neutral: {
|
|
1864
|
+
link: "focus-visible:before:ring-inverted",
|
|
1865
|
+
childLink: "focus-visible:before:ring-inverted"
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1868
|
+
highlightColor: {
|
|
1869
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1870
|
+
neutral: ""
|
|
1871
|
+
},
|
|
1872
|
+
variant: {
|
|
1873
|
+
pill: "",
|
|
1874
|
+
link: ""
|
|
1875
|
+
},
|
|
1876
|
+
orientation: {
|
|
1877
|
+
horizontal: {
|
|
1878
|
+
root: "items-center justify-between",
|
|
1879
|
+
list: "flex items-center",
|
|
1880
|
+
item: "py-2",
|
|
1881
|
+
link: "px-2.5 py-1.5 before:inset-x-px before:inset-y-0",
|
|
1882
|
+
childList: "grid p-2",
|
|
1883
|
+
childLink: "px-3 py-2 gap-2 before:inset-x-px before:inset-y-0",
|
|
1884
|
+
childLinkLabel: "font-medium",
|
|
1885
|
+
content: "absolute top-0 left-0 w-full max-h-[70vh] overflow-y-auto"
|
|
1886
|
+
},
|
|
1887
|
+
vertical: {
|
|
1888
|
+
root: "flex-col",
|
|
1889
|
+
link: "flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0",
|
|
1890
|
+
childLabel: "px-1.5 py-0.5",
|
|
1891
|
+
childLink: "p-1.5 gap-1.5 before:inset-y-px before:inset-x-0"
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
contentOrientation: {
|
|
1895
|
+
horizontal: {
|
|
1896
|
+
viewportWrapper: "justify-center",
|
|
1897
|
+
content: "data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]"
|
|
1898
|
+
},
|
|
1899
|
+
vertical: {
|
|
1900
|
+
viewport: "sm:w-[--reka-navigation-menu-viewport-width] left-[--reka-navigation-menu-viewport-left]"
|
|
1901
|
+
}
|
|
1902
|
+
},
|
|
1903
|
+
active: {
|
|
1904
|
+
true: {
|
|
1905
|
+
childLink: "before:bg-elevated text-highlighted",
|
|
1906
|
+
childLinkIcon: "text-default"
|
|
1907
|
+
},
|
|
1908
|
+
false: {
|
|
1909
|
+
link: "text-muted",
|
|
1910
|
+
linkLeadingIcon: "text-dimmed",
|
|
1911
|
+
childLink: [
|
|
1912
|
+
"hover:before:bg-elevated/50 text-default hover:text-highlighted",
|
|
1913
|
+
options.theme.transitions && "transition-colors before:transition-colors"
|
|
1914
|
+
],
|
|
1915
|
+
childLinkIcon: [
|
|
1916
|
+
"text-dimmed group-hover:text-default",
|
|
1917
|
+
options.theme.transitions && "transition-colors"
|
|
1918
|
+
]
|
|
1919
|
+
}
|
|
1920
|
+
},
|
|
1921
|
+
disabled: {
|
|
1922
|
+
true: {
|
|
1923
|
+
link: "cursor-not-allowed opacity-75"
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
highlight: {
|
|
1927
|
+
true: ""
|
|
1928
|
+
},
|
|
1929
|
+
level: {
|
|
1930
|
+
true: ""
|
|
1931
|
+
},
|
|
1932
|
+
collapsed: {
|
|
1933
|
+
true: ""
|
|
1934
|
+
}
|
|
1935
|
+
},
|
|
1936
|
+
compoundVariants: [
|
|
1937
|
+
{
|
|
1938
|
+
orientation: "horizontal",
|
|
1939
|
+
contentOrientation: "horizontal",
|
|
1940
|
+
class: {
|
|
1941
|
+
childList: "grid-cols-2 gap-2"
|
|
1942
|
+
}
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
orientation: "horizontal",
|
|
1946
|
+
contentOrientation: "vertical",
|
|
1947
|
+
class: {
|
|
1948
|
+
childList: "gap-1",
|
|
1949
|
+
content: "w-60"
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
orientation: "vertical",
|
|
1954
|
+
collapsed: false,
|
|
1955
|
+
class: {
|
|
1956
|
+
childList: "ms-5 border-s border-default",
|
|
1957
|
+
childItem: "ps-1.5 -ms-px",
|
|
1958
|
+
content: "data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
orientation: "vertical",
|
|
1963
|
+
collapsed: true,
|
|
1964
|
+
class: {
|
|
1965
|
+
link: "px-1.5",
|
|
1966
|
+
content: "shadow-sm rounded-sm min-h-6 p-1"
|
|
1967
|
+
}
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
orientation: "horizontal",
|
|
1971
|
+
highlight: true,
|
|
1972
|
+
class: {
|
|
1973
|
+
link: [
|
|
1974
|
+
"after:content-empty after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full",
|
|
1975
|
+
options.theme.transitions && "after:transition-colors"
|
|
1976
|
+
]
|
|
1977
|
+
}
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
orientation: "vertical",
|
|
1981
|
+
highlight: true,
|
|
1982
|
+
level: true,
|
|
1983
|
+
class: {
|
|
1984
|
+
link: [
|
|
1985
|
+
"after:content-empty after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full",
|
|
1986
|
+
options.theme.transitions && "after:transition-colors"
|
|
1987
|
+
]
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
disabled: false,
|
|
1992
|
+
active: false,
|
|
1993
|
+
variant: "pill",
|
|
1994
|
+
class: {
|
|
1995
|
+
link: [
|
|
1996
|
+
"hover:text-highlighted hover:before:bg-elevated/50",
|
|
1997
|
+
options.theme.transitions && "transition-colors before:transition-colors"
|
|
1998
|
+
],
|
|
1999
|
+
linkLeadingIcon: [
|
|
2000
|
+
"group-hover:text-default",
|
|
2001
|
+
options.theme.transitions && "transition-colors"
|
|
2002
|
+
]
|
|
2003
|
+
}
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
disabled: false,
|
|
2007
|
+
active: false,
|
|
2008
|
+
variant: "pill",
|
|
2009
|
+
orientation: "horizontal",
|
|
2010
|
+
class: {
|
|
2011
|
+
link: "data-[state=open]:text-highlighted",
|
|
2012
|
+
linkLeadingIcon: "group-data-[state=open]:text-default"
|
|
2013
|
+
}
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
disabled: false,
|
|
2017
|
+
variant: "pill",
|
|
2018
|
+
highlight: true,
|
|
2019
|
+
orientation: "horizontal",
|
|
2020
|
+
class: {
|
|
2021
|
+
link: "data-[state=open]:before:bg-elevated/50"
|
|
2022
|
+
}
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
disabled: false,
|
|
2026
|
+
variant: "pill",
|
|
2027
|
+
highlight: false,
|
|
2028
|
+
active: false,
|
|
2029
|
+
orientation: "horizontal",
|
|
2030
|
+
class: {
|
|
2031
|
+
link: "data-[state=open]:before:bg-elevated/50"
|
|
2032
|
+
}
|
|
2033
|
+
},
|
|
2034
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2035
|
+
color,
|
|
2036
|
+
variant: "pill",
|
|
2037
|
+
active: true,
|
|
2038
|
+
class: {
|
|
2039
|
+
link: `text-${color}`,
|
|
2040
|
+
linkLeadingIcon: `text-${color} group-data-[state=open]:text-${color}`
|
|
2041
|
+
}
|
|
2042
|
+
})),
|
|
2043
|
+
{
|
|
2044
|
+
color: "neutral",
|
|
2045
|
+
variant: "pill",
|
|
2046
|
+
active: true,
|
|
2047
|
+
class: {
|
|
2048
|
+
link: "text-highlighted",
|
|
2049
|
+
linkLeadingIcon: "text-highlighted group-data-[state=open]:text-highlighted"
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
variant: "pill",
|
|
2054
|
+
active: true,
|
|
2055
|
+
highlight: false,
|
|
2056
|
+
class: {
|
|
2057
|
+
link: "before:bg-elevated"
|
|
2058
|
+
}
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
variant: "pill",
|
|
2062
|
+
active: true,
|
|
2063
|
+
highlight: true,
|
|
2064
|
+
disabled: false,
|
|
2065
|
+
class: {
|
|
2066
|
+
link: ["hover:before:bg-elevated/50", options.theme.transitions && "before:transition-colors"]
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
disabled: false,
|
|
2071
|
+
active: false,
|
|
2072
|
+
variant: "link",
|
|
2073
|
+
class: {
|
|
2074
|
+
link: ["hover:text-highlighted", options.theme.transitions && "transition-colors"],
|
|
2075
|
+
linkLeadingIcon: ["group-hover:text-default", options.theme.transitions && "transition-colors"]
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
disabled: false,
|
|
2080
|
+
active: false,
|
|
2081
|
+
variant: "link",
|
|
2082
|
+
orientation: "horizontal",
|
|
2083
|
+
class: {
|
|
2084
|
+
link: "data-[state=open]:text-highlighted",
|
|
2085
|
+
linkLeadingIcon: "group-data-[state=open]:text-default"
|
|
2086
|
+
}
|
|
2087
|
+
},
|
|
2088
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2089
|
+
color,
|
|
2090
|
+
variant: "link",
|
|
2091
|
+
active: true,
|
|
2092
|
+
class: {
|
|
2093
|
+
link: `text-${color}`,
|
|
2094
|
+
linkLeadingIcon: `text-${color} group-data-[state=open]:text-${color}`
|
|
2095
|
+
}
|
|
2096
|
+
})),
|
|
2097
|
+
{
|
|
2098
|
+
color: "neutral",
|
|
2099
|
+
variant: "link",
|
|
2100
|
+
active: true,
|
|
2101
|
+
class: {
|
|
2102
|
+
link: "text-highlighted",
|
|
2103
|
+
linkLeadingIcon: "text-highlighted group-data-[state=open]:text-highlighted"
|
|
2104
|
+
}
|
|
2105
|
+
},
|
|
2106
|
+
...(options.theme.colors || []).map((highlightColor) => ({
|
|
2107
|
+
highlightColor,
|
|
2108
|
+
highlight: true,
|
|
2109
|
+
level: true,
|
|
2110
|
+
active: true,
|
|
2111
|
+
class: {
|
|
2112
|
+
link: `after:bg-${highlightColor}`
|
|
2113
|
+
}
|
|
2114
|
+
})),
|
|
2115
|
+
{
|
|
2116
|
+
highlightColor: "neutral",
|
|
2117
|
+
highlight: true,
|
|
2118
|
+
level: true,
|
|
2119
|
+
active: true,
|
|
2120
|
+
class: {
|
|
2121
|
+
link: "after:bg-inverted"
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
],
|
|
2125
|
+
defaultVariants: {
|
|
2126
|
+
color: "primary",
|
|
2127
|
+
highlightColor: "primary",
|
|
2128
|
+
variant: "pill"
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
|
|
2132
|
+
const pagination = ct({
|
|
2133
|
+
parts: {
|
|
2134
|
+
root: "",
|
|
2135
|
+
list: "flex items-center gap-1",
|
|
2136
|
+
ellipsis: "pointer-events-none",
|
|
2137
|
+
label: "min-w-5 text-center",
|
|
2138
|
+
item: "",
|
|
2139
|
+
first: "",
|
|
2140
|
+
prev: "",
|
|
2141
|
+
next: "",
|
|
2142
|
+
last: ""
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
|
|
2146
|
+
const pinInput = (options) => ct({
|
|
2147
|
+
parts: {
|
|
2148
|
+
root: "relative inline-flex items-center gap-1.5",
|
|
2149
|
+
base: [
|
|
2150
|
+
"rounded-md border-0 placeholder:text-dimmed text-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
|
|
2151
|
+
options.theme.transitions && "transition-colors"
|
|
2152
|
+
]
|
|
2153
|
+
},
|
|
2154
|
+
variants: {
|
|
2155
|
+
size: {
|
|
2156
|
+
xs: {
|
|
2157
|
+
base: "size-6 text-xs"
|
|
2158
|
+
},
|
|
2159
|
+
sm: {
|
|
2160
|
+
base: "size-7 text-xs"
|
|
2161
|
+
},
|
|
2162
|
+
md: {
|
|
2163
|
+
base: "size-8 text-sm"
|
|
2164
|
+
},
|
|
2165
|
+
lg: {
|
|
2166
|
+
base: "size-9 text-sm"
|
|
2167
|
+
},
|
|
2168
|
+
xl: {
|
|
2169
|
+
base: "size-10 text-base"
|
|
2170
|
+
}
|
|
2171
|
+
},
|
|
2172
|
+
variant: {
|
|
2173
|
+
outline: {
|
|
2174
|
+
base: "text-highlighted bg-default ring ring-inset ring-accented"
|
|
2175
|
+
},
|
|
2176
|
+
soft: {
|
|
2177
|
+
base: "text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50"
|
|
2178
|
+
},
|
|
2179
|
+
subtle: {
|
|
2180
|
+
base: "text-highlighted bg-elevated ring ring-inset ring-accented"
|
|
2181
|
+
},
|
|
2182
|
+
ghost: {
|
|
2183
|
+
base: "text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent"
|
|
2184
|
+
},
|
|
2185
|
+
none: {
|
|
2186
|
+
base: "text-highlighted bg-transparent"
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
2189
|
+
color: {
|
|
2190
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
2191
|
+
neutral: ""
|
|
2192
|
+
},
|
|
2193
|
+
highlight: {
|
|
2194
|
+
true: ""
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
compoundVariants: [
|
|
2198
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2199
|
+
color,
|
|
2200
|
+
variant: ["outline", "subtle"],
|
|
2201
|
+
class: { base: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}` }
|
|
2202
|
+
})),
|
|
2203
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2204
|
+
color,
|
|
2205
|
+
highlight: true,
|
|
2206
|
+
class: { base: `ring ring-inset ring-${color}` }
|
|
2207
|
+
})),
|
|
2208
|
+
{
|
|
2209
|
+
color: "neutral",
|
|
2210
|
+
variant: ["outline", "subtle"],
|
|
2211
|
+
class: { base: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted" }
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
color: "neutral",
|
|
2215
|
+
highlight: true,
|
|
2216
|
+
class: { base: "ring ring-inset ring-inverted" }
|
|
2217
|
+
}
|
|
2218
|
+
],
|
|
2219
|
+
defaultVariants: {
|
|
2220
|
+
size: "md",
|
|
2221
|
+
color: "primary",
|
|
2222
|
+
variant: "outline"
|
|
2223
|
+
}
|
|
2224
|
+
});
|
|
2225
|
+
|
|
2226
|
+
const popover = ct({
|
|
2227
|
+
parts: {
|
|
2228
|
+
content: [
|
|
2229
|
+
"z-1 bg-default shadow-lg rounded-md ring ring-default focus:outline-none pointer-events-auto",
|
|
2230
|
+
"data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-[--reka-popover-content-transform-origin]"
|
|
2231
|
+
],
|
|
2232
|
+
arrow: "fill-default"
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
|
|
2236
|
+
const progress = (options) => ct({
|
|
2237
|
+
parts: {
|
|
2238
|
+
root: "gap-2",
|
|
2239
|
+
base: "relative overflow-hidden rounded-full bg-accented",
|
|
2240
|
+
indicator: "rounded-full size-full transition-transform duration-200 ease-out",
|
|
2241
|
+
status: "flex text-dimmed transition-[width] duration-200",
|
|
2242
|
+
steps: "grid items-end",
|
|
2243
|
+
step: "truncate text-end row-start-1 col-start-1 transition-opacity"
|
|
2244
|
+
},
|
|
2245
|
+
variants: {
|
|
2246
|
+
animation: {
|
|
2247
|
+
"carousel": "",
|
|
2248
|
+
"carousel-inverse": "",
|
|
2249
|
+
"swing": "",
|
|
2250
|
+
"elastic": ""
|
|
2251
|
+
},
|
|
2252
|
+
color: {
|
|
2253
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2254
|
+
indicator: `bg-${color}`,
|
|
2255
|
+
steps: `text-${color}`
|
|
2256
|
+
}])),
|
|
2257
|
+
neutral: {
|
|
2258
|
+
indicator: "bg-inverted",
|
|
2259
|
+
steps: "text-inverted"
|
|
2260
|
+
}
|
|
2261
|
+
},
|
|
2262
|
+
size: {
|
|
2263
|
+
"2xs": {
|
|
2264
|
+
status: "text-xs",
|
|
2265
|
+
steps: "text-xs"
|
|
2266
|
+
},
|
|
2267
|
+
"xs": {
|
|
2268
|
+
status: "text-xs",
|
|
2269
|
+
steps: "text-xs"
|
|
2270
|
+
},
|
|
2271
|
+
"sm": {
|
|
2272
|
+
status: "text-sm",
|
|
2273
|
+
steps: "text-sm"
|
|
2274
|
+
},
|
|
2275
|
+
"md": {
|
|
2276
|
+
status: "text-sm",
|
|
2277
|
+
steps: "text-sm"
|
|
2278
|
+
},
|
|
2279
|
+
"lg": {
|
|
2280
|
+
status: "text-sm",
|
|
2281
|
+
steps: "text-sm"
|
|
2282
|
+
},
|
|
2283
|
+
"xl": {
|
|
2284
|
+
status: "text-base",
|
|
2285
|
+
steps: "text-base"
|
|
2286
|
+
},
|
|
2287
|
+
"2xl": {
|
|
2288
|
+
status: "text-base",
|
|
2289
|
+
steps: "text-base"
|
|
2290
|
+
}
|
|
2291
|
+
},
|
|
2292
|
+
step: {
|
|
2293
|
+
active: {
|
|
2294
|
+
step: "opacity-100"
|
|
2295
|
+
},
|
|
2296
|
+
first: {
|
|
2297
|
+
step: "opacity-100 text-muted"
|
|
2298
|
+
},
|
|
2299
|
+
other: {
|
|
2300
|
+
step: "opacity-0"
|
|
2301
|
+
},
|
|
2302
|
+
last: {
|
|
2303
|
+
step: ""
|
|
2304
|
+
}
|
|
2305
|
+
},
|
|
2306
|
+
orientation: {
|
|
2307
|
+
horizontal: {
|
|
2308
|
+
root: "w-full flex flex-col",
|
|
2309
|
+
base: "w-full",
|
|
2310
|
+
status: "flex-row items-center justify-end min-w-fit"
|
|
2311
|
+
},
|
|
2312
|
+
vertical: {
|
|
2313
|
+
root: "h-full flex flex-row-reverse",
|
|
2314
|
+
base: "h-full",
|
|
2315
|
+
status: "flex-col justify-end min-h-fit"
|
|
2316
|
+
}
|
|
2317
|
+
},
|
|
2318
|
+
inverted: {
|
|
2319
|
+
true: {
|
|
2320
|
+
status: "self-end"
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
compoundVariants: [
|
|
2325
|
+
{
|
|
2326
|
+
inverted: true,
|
|
2327
|
+
orientation: "horizontal",
|
|
2328
|
+
class: {
|
|
2329
|
+
step: "text-start",
|
|
2330
|
+
status: "flex-row-reverse"
|
|
2331
|
+
}
|
|
2332
|
+
},
|
|
2333
|
+
{
|
|
2334
|
+
inverted: true,
|
|
2335
|
+
orientation: "vertical",
|
|
2336
|
+
class: {
|
|
2337
|
+
steps: "items-start",
|
|
2338
|
+
status: "flex-col-reverse"
|
|
2339
|
+
}
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
orientation: "horizontal",
|
|
2343
|
+
size: "2xs",
|
|
2344
|
+
class: { base: "h-px" }
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
orientation: "horizontal",
|
|
2348
|
+
size: "xs",
|
|
2349
|
+
class: { base: "h-0.5" }
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
orientation: "horizontal",
|
|
2353
|
+
size: "sm",
|
|
2354
|
+
class: { base: "h-1" }
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
orientation: "horizontal",
|
|
2358
|
+
size: "md",
|
|
2359
|
+
class: { base: "h-2" }
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
orientation: "horizontal",
|
|
2363
|
+
size: "lg",
|
|
2364
|
+
class: { base: "h-3" }
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
orientation: "horizontal",
|
|
2368
|
+
size: "xl",
|
|
2369
|
+
class: { base: "h-4" }
|
|
2370
|
+
},
|
|
2371
|
+
{
|
|
2372
|
+
orientation: "horizontal",
|
|
2373
|
+
size: "2xl",
|
|
2374
|
+
class: { base: "h-5" }
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
orientation: "vertical",
|
|
2378
|
+
size: "2xs",
|
|
2379
|
+
class: { base: "w-px" }
|
|
2380
|
+
},
|
|
2381
|
+
{
|
|
2382
|
+
orientation: "vertical",
|
|
2383
|
+
size: "xs",
|
|
2384
|
+
class: { base: "w-0.5" }
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
orientation: "vertical",
|
|
2388
|
+
size: "sm",
|
|
2389
|
+
class: { base: "w-1" }
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
orientation: "vertical",
|
|
2393
|
+
size: "md",
|
|
2394
|
+
class: { base: "w-2" }
|
|
2395
|
+
},
|
|
2396
|
+
{
|
|
2397
|
+
orientation: "vertical",
|
|
2398
|
+
size: "lg",
|
|
2399
|
+
class: { base: "w-3" }
|
|
2400
|
+
},
|
|
2401
|
+
{
|
|
2402
|
+
orientation: "vertical",
|
|
2403
|
+
size: "xl",
|
|
2404
|
+
class: { base: "w-4" }
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
orientation: "vertical",
|
|
2408
|
+
size: "2xl",
|
|
2409
|
+
class: { base: "w-5" }
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
orientation: "horizontal",
|
|
2413
|
+
animation: "carousel",
|
|
2414
|
+
class: {
|
|
2415
|
+
indicator: "data-[state=indeterminate]:animate-[carousel_2s_ease-in-out_infinite] data-[state=indeterminate]:rtl:animate-[carousel-rtl_2s_ease-in-out_infinite]"
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
orientation: "vertical",
|
|
2420
|
+
animation: "carousel",
|
|
2421
|
+
class: {
|
|
2422
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-vertical_2s_ease-in-out_infinite]"
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
orientation: "horizontal",
|
|
2427
|
+
animation: "carousel-inverse",
|
|
2428
|
+
class: {
|
|
2429
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-inverse_2s_ease-in-out_infinite] data-[state=indeterminate]:rtl:animate-[carousel-inverse-rtl_2s_ease-in-out_infinite]"
|
|
2430
|
+
}
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
orientation: "vertical",
|
|
2434
|
+
animation: "carousel-inverse",
|
|
2435
|
+
class: {
|
|
2436
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-inverse-vertical_2s_ease-in-out_infinite]"
|
|
2437
|
+
}
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
orientation: "horizontal",
|
|
2441
|
+
animation: "swing",
|
|
2442
|
+
class: {
|
|
2443
|
+
indicator: "data-[state=indeterminate]:animate-[swing_2s_ease-in-out_infinite]"
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
orientation: "vertical",
|
|
2448
|
+
animation: "swing",
|
|
2449
|
+
class: {
|
|
2450
|
+
indicator: "data-[state=indeterminate]:animate-[swing-vertical_2s_ease-in-out_infinite]"
|
|
2451
|
+
}
|
|
2452
|
+
},
|
|
2453
|
+
{
|
|
2454
|
+
orientation: "horizontal",
|
|
2455
|
+
animation: "elastic",
|
|
2456
|
+
class: {
|
|
2457
|
+
indicator: "data-[state=indeterminate]:animate-[elastic_2s_ease-in-out_infinite]"
|
|
2458
|
+
}
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
orientation: "vertical",
|
|
2462
|
+
animation: "elastic",
|
|
2463
|
+
class: {
|
|
2464
|
+
indicator: "data-[state=indeterminate]:animate-[elastic-vertical_2s_ease-in-out_infinite]"
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
],
|
|
2468
|
+
defaultVariants: {
|
|
2469
|
+
animation: "carousel",
|
|
2470
|
+
color: "primary",
|
|
2471
|
+
size: "md"
|
|
2472
|
+
}
|
|
2473
|
+
});
|
|
2474
|
+
|
|
2475
|
+
const radioGroup = (options) => ct({
|
|
2476
|
+
parts: {
|
|
2477
|
+
root: "relative",
|
|
2478
|
+
fieldset: "flex gap-x-2",
|
|
2479
|
+
legend: "mb-1 block font-medium text-default",
|
|
2480
|
+
item: "flex items-start",
|
|
2481
|
+
container: "flex items-center",
|
|
2482
|
+
base: "rounded-full ring ring-inset ring-accented overflow-hidden cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
2483
|
+
indicator: [
|
|
2484
|
+
"flex items-center justify-center size-full rounded-full scale-0 data-[state=checked]:scale-65",
|
|
2485
|
+
options.theme.transitions && "transition-transform"
|
|
2486
|
+
],
|
|
2487
|
+
wrapper: "w-full",
|
|
2488
|
+
label: "block font-medium text-default cursor-pointer",
|
|
2489
|
+
description: "text-muted"
|
|
2490
|
+
},
|
|
2491
|
+
variants: {
|
|
2492
|
+
color: {
|
|
2493
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2494
|
+
base: `focus-visible:outline-${color} data-[state=checked]:ring-${color}/50`,
|
|
2495
|
+
indicator: `bg-${color}`
|
|
2496
|
+
}])),
|
|
2497
|
+
neutral: {
|
|
2498
|
+
base: "focus-visible:outline-inverted data-[state=checked]:ring-[--ui-text]/50",
|
|
2499
|
+
indicator: "bg-inverted"
|
|
2500
|
+
}
|
|
2501
|
+
},
|
|
2502
|
+
variant: {
|
|
2503
|
+
list: {
|
|
2504
|
+
item: ""
|
|
2505
|
+
},
|
|
2506
|
+
card: {
|
|
2507
|
+
item: "border border-muted rounded-lg"
|
|
2508
|
+
},
|
|
2509
|
+
table: {
|
|
2510
|
+
item: "border border-muted"
|
|
2511
|
+
}
|
|
2512
|
+
},
|
|
2513
|
+
orientation: {
|
|
2514
|
+
horizontal: {
|
|
2515
|
+
fieldset: "flex-row"
|
|
2516
|
+
},
|
|
2517
|
+
vertical: {
|
|
2518
|
+
fieldset: "flex-col"
|
|
2519
|
+
}
|
|
2520
|
+
},
|
|
2521
|
+
indicator: {
|
|
2522
|
+
start: {
|
|
2523
|
+
item: "flex-row",
|
|
2524
|
+
wrapper: "ms-2"
|
|
2525
|
+
},
|
|
2526
|
+
end: {
|
|
2527
|
+
item: "flex-row-reverse",
|
|
2528
|
+
wrapper: "me-2"
|
|
2529
|
+
},
|
|
2530
|
+
hidden: {
|
|
2531
|
+
base: "sr-only",
|
|
2532
|
+
wrapper: "text-center"
|
|
2533
|
+
}
|
|
2534
|
+
},
|
|
2535
|
+
size: {
|
|
2536
|
+
xs: {
|
|
2537
|
+
fieldset: "gap-y-0.5",
|
|
2538
|
+
legend: "text-xs",
|
|
2539
|
+
base: "size-3",
|
|
2540
|
+
item: "text-xs",
|
|
2541
|
+
container: "h-4",
|
|
2542
|
+
indicator: ""
|
|
2543
|
+
},
|
|
2544
|
+
sm: {
|
|
2545
|
+
fieldset: "gap-y-0.5",
|
|
2546
|
+
legend: "text-xs",
|
|
2547
|
+
base: "size-3.5",
|
|
2548
|
+
item: "text-xs",
|
|
2549
|
+
container: "h-4",
|
|
2550
|
+
indicator: ""
|
|
2551
|
+
},
|
|
2552
|
+
md: {
|
|
2553
|
+
fieldset: "gap-y-1",
|
|
2554
|
+
legend: "text-sm",
|
|
2555
|
+
base: "size-4",
|
|
2556
|
+
item: "text-sm",
|
|
2557
|
+
container: "h-5",
|
|
2558
|
+
indicator: ""
|
|
2559
|
+
},
|
|
2560
|
+
lg: {
|
|
2561
|
+
fieldset: "gap-y-1",
|
|
2562
|
+
legend: "text-sm",
|
|
2563
|
+
base: "size-4.5",
|
|
2564
|
+
item: "text-sm",
|
|
2565
|
+
container: "h-5",
|
|
2566
|
+
indicator: ""
|
|
2567
|
+
},
|
|
2568
|
+
xl: {
|
|
2569
|
+
fieldset: "gap-y-1.5",
|
|
2570
|
+
legend: "text-base",
|
|
2571
|
+
base: "size-5",
|
|
2572
|
+
item: "text-base",
|
|
2573
|
+
container: "h-6",
|
|
2574
|
+
indicator: ""
|
|
2575
|
+
}
|
|
2576
|
+
},
|
|
2577
|
+
disabled: {
|
|
2578
|
+
true: {
|
|
2579
|
+
base: "cursor-not-allowed opacity-75",
|
|
2580
|
+
label: "cursor-not-allowed opacity-75",
|
|
2581
|
+
description: "opacity-75"
|
|
2582
|
+
}
|
|
2583
|
+
},
|
|
2584
|
+
required: {
|
|
2585
|
+
true: {
|
|
2586
|
+
legend: `after:content-['*'] after:ms-0.5 after:text-error`
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
},
|
|
2590
|
+
compoundVariants: [
|
|
2591
|
+
{ variant: ["card", "table"], disabled: true, class: { item: "cursor-not-allowed" } },
|
|
2592
|
+
{ variant: ["card", "table"], disabled: false, class: { item: "cursor-pointer" } },
|
|
2593
|
+
{ size: "xs", variant: ["card", "table"], class: { item: "p-2.5" } },
|
|
2594
|
+
{ size: "sm", variant: ["card", "table"], class: { item: "p-3" } },
|
|
2595
|
+
{ size: "md", variant: ["card", "table"], class: { item: "p-3.5" } },
|
|
2596
|
+
{ size: "lg", variant: ["card", "table"], class: { item: "p-4" } },
|
|
2597
|
+
{ size: "xl", variant: ["card", "table"], class: { item: "p-4.5" } },
|
|
2598
|
+
{
|
|
2599
|
+
orientation: "horizontal",
|
|
2600
|
+
variant: "table",
|
|
2601
|
+
class: {
|
|
2602
|
+
item: "first-of-type:rounded-s-lg last-of-type:rounded-e-lg",
|
|
2603
|
+
fieldset: "gap-0 -space-x-px"
|
|
2604
|
+
}
|
|
2605
|
+
},
|
|
2606
|
+
{
|
|
2607
|
+
orientation: "vertical",
|
|
2608
|
+
variant: "table",
|
|
2609
|
+
class: {
|
|
2610
|
+
item: "first-of-type:rounded-t-lg last-of-type:rounded-b-lg",
|
|
2611
|
+
fieldset: "gap-0 -space-y-px"
|
|
2612
|
+
}
|
|
2613
|
+
},
|
|
2614
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2615
|
+
color,
|
|
2616
|
+
variant: "card",
|
|
2617
|
+
class: {
|
|
2618
|
+
item: `has-data-[state=checked]:border-${color}`
|
|
2619
|
+
}
|
|
2620
|
+
})),
|
|
2621
|
+
{
|
|
2622
|
+
color: "neutral",
|
|
2623
|
+
variant: "card",
|
|
2624
|
+
class: {
|
|
2625
|
+
item: "has-data-[state=checked]:border-inverted"
|
|
2626
|
+
}
|
|
2627
|
+
},
|
|
2628
|
+
...(options.theme.colors || []).map((color) => ({
|
|
2629
|
+
color,
|
|
2630
|
+
variant: "table",
|
|
2631
|
+
class: {
|
|
2632
|
+
item: `has-data-[state=checked]:bg-${color}/10 has-data-[state=checked]:border-${color}/50 has-data-[state=checked]:z-[1]`
|
|
2633
|
+
}
|
|
2634
|
+
})),
|
|
2635
|
+
{
|
|
2636
|
+
color: "neutral",
|
|
2637
|
+
variant: "table",
|
|
2638
|
+
class: {
|
|
2639
|
+
item: "has-data-[state=checked]:bg-elevated has-data-[state=checked]:border-inverted/50 has-data-[state=checked]:z-[1]"
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
],
|
|
2643
|
+
defaultVariants: {
|
|
2644
|
+
size: "md",
|
|
2645
|
+
color: "primary",
|
|
2646
|
+
variant: "list",
|
|
2647
|
+
orientation: "vertical",
|
|
2648
|
+
indicator: "start"
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
|
|
2652
|
+
const scrollArea = ct({
|
|
2653
|
+
parts: {
|
|
2654
|
+
root: "relative overflow-hidden",
|
|
2655
|
+
viewport: "size-full rounded outline-none",
|
|
2656
|
+
scrollbar: [
|
|
2657
|
+
"flex select-none touch-none p-0.5 duration-160 ease-out",
|
|
2658
|
+
"data-[orientation=vertical]:w-3 data-[orientation=vertical]:my-2",
|
|
2659
|
+
"data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-3 data-[orientation=horizontal]:mx-2"
|
|
2660
|
+
],
|
|
2661
|
+
thumb: [
|
|
2662
|
+
"relative flex-1 bg-[--ui-border-accented] opacity-80 rounded cursor-pointer transition-colors",
|
|
2663
|
+
"hover:bg-[--ui-text-dimmed]",
|
|
2664
|
+
"before:content-empty before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full before:min-w-10 before:min-h-10 "
|
|
2665
|
+
],
|
|
2666
|
+
corner: ""
|
|
2667
|
+
}
|
|
2668
|
+
});
|
|
2669
|
+
|
|
2670
|
+
const select = (options) => {
|
|
2671
|
+
const input = inputTheme(options);
|
|
2672
|
+
return ct({
|
|
2673
|
+
parts: {
|
|
2674
|
+
...input.parts,
|
|
2675
|
+
root: void 0,
|
|
2676
|
+
base: [
|
|
2677
|
+
"relative group rounded-md inline-flex items-center focus:outline-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-75",
|
|
2678
|
+
options.theme.transitions && "transition-colors"
|
|
2679
|
+
],
|
|
2680
|
+
value: "truncate pointer-events-none",
|
|
2681
|
+
placeholder: "truncate text-dimmed",
|
|
2682
|
+
arrow: "fill-default",
|
|
2683
|
+
content: [
|
|
2684
|
+
"z-1 max-h-60 w-[--reka-select-trigger-width] bg-default shadow-lg rounded-md ring ring-default overflow-hidden origin-[--reka-select-content-transform-origin] pointer-events-auto flex flex-col",
|
|
2685
|
+
"data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]"
|
|
2686
|
+
],
|
|
2687
|
+
viewport: "relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1",
|
|
2688
|
+
group: "p-1 isolate",
|
|
2689
|
+
empty: "text-center text-muted",
|
|
2690
|
+
label: "font-semibold text-highlighted",
|
|
2691
|
+
separator: "-mx-1 my-1 h-px bg-border",
|
|
2692
|
+
item: [
|
|
2693
|
+
"group relative w-full flex items-start select-none outline-none before:content-empty before:absolute before:z-[-1] before:inset-px before:rounded-md cursor-pointer data-[disabled]:cursor-not-allowed data-[disabled]:opacity-75 text-default data-[highlighted]:not-[[data-disabled]]:text-highlighted data-[highlighted]:not-[[data-disabled]]:before:bg-elevated/50",
|
|
2694
|
+
options.theme.transitions && "transition-colors before:transition-colors"
|
|
2695
|
+
],
|
|
2696
|
+
itemLeadingIcon: [
|
|
2697
|
+
"shrink-0 text-dimmed group-data-[highlighted]:group-not-[[data-disabled]]:text-default group-not-[[data-disabled]]:text-default",
|
|
2698
|
+
options.theme.transitions && "transition-colors"
|
|
2699
|
+
],
|
|
2700
|
+
itemLeadingAvatar: "shrink-0",
|
|
2701
|
+
itemLeadingAvatarSize: "",
|
|
2702
|
+
itemLeadingChip: "shrink-0",
|
|
2703
|
+
itemLeadingChipSize: "",
|
|
2704
|
+
itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
2705
|
+
itemTrailingIcon: "shrink-0",
|
|
2706
|
+
itemWrapper: "flex-1 flex flex-col min-w-0",
|
|
2707
|
+
itemLabel: "truncate",
|
|
2708
|
+
itemDescription: "truncate text-muted"
|
|
2709
|
+
},
|
|
2710
|
+
variants: {
|
|
2711
|
+
...input.variants,
|
|
2712
|
+
...fieldGroupVariant,
|
|
2713
|
+
size: {
|
|
2714
|
+
xs: {
|
|
2715
|
+
...input.variants.size.xs,
|
|
2716
|
+
label: "p-1 text-[0.625rem]/3 gap-1",
|
|
2717
|
+
item: "p-1 text-xs gap-1",
|
|
2718
|
+
itemLeadingIcon: "size-4",
|
|
2719
|
+
itemLeadingAvatarSize: "3xs",
|
|
2720
|
+
itemLeadingChip: "size-4",
|
|
2721
|
+
itemLeadingChipSize: "sm",
|
|
2722
|
+
itemTrailingIcon: "size-4",
|
|
2723
|
+
empty: "p-1 text-xs"
|
|
2724
|
+
},
|
|
2725
|
+
sm: {
|
|
2726
|
+
...input.variants.size.sm,
|
|
2727
|
+
label: "p-1.5 text-[0.625rem]/3 gap-1.5",
|
|
2728
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
2729
|
+
itemLeadingIcon: "size-4",
|
|
2730
|
+
itemLeadingAvatarSize: "3xs",
|
|
2731
|
+
itemLeadingChip: "size-4",
|
|
2732
|
+
itemLeadingChipSize: "sm",
|
|
2733
|
+
itemTrailingIcon: "size-4",
|
|
2734
|
+
empty: "p-1.5 text-xs"
|
|
2735
|
+
},
|
|
2736
|
+
md: {
|
|
2737
|
+
...input.variants.size.md,
|
|
2738
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
2739
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
2740
|
+
itemLeadingIcon: "size-5",
|
|
2741
|
+
itemLeadingAvatarSize: "2xs",
|
|
2742
|
+
itemLeadingChip: "size-5",
|
|
2743
|
+
itemLeadingChipSize: "md",
|
|
2744
|
+
itemTrailingIcon: "size-5",
|
|
2745
|
+
empty: "p-1.5 text-sm"
|
|
2746
|
+
},
|
|
2747
|
+
lg: {
|
|
2748
|
+
...input.variants.size.lg,
|
|
2749
|
+
label: "p-2 text-xs gap-2",
|
|
2750
|
+
item: "p-2 text-sm gap-2",
|
|
2751
|
+
itemLeadingIcon: "size-5",
|
|
2752
|
+
itemLeadingAvatarSize: "2xs",
|
|
2753
|
+
itemLeadingChip: "size-5",
|
|
2754
|
+
itemLeadingChipSize: "md",
|
|
2755
|
+
itemTrailingIcon: "size-5",
|
|
2756
|
+
empty: "p-2 text-sm"
|
|
2757
|
+
},
|
|
2758
|
+
xl: {
|
|
2759
|
+
...input.variants.size.xl,
|
|
2760
|
+
label: "p-2 text-sm gap-2",
|
|
2761
|
+
item: "p-2 text-base gap-2",
|
|
2762
|
+
itemLeadingIcon: "size-6",
|
|
2763
|
+
itemLeadingAvatarSize: "xs",
|
|
2764
|
+
itemLeadingChip: "size-6",
|
|
2765
|
+
itemLeadingChipSize: "lg",
|
|
2766
|
+
itemTrailingIcon: "size-6",
|
|
2767
|
+
empty: "p-2 text-base"
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
},
|
|
2771
|
+
compoundVariants: [
|
|
2772
|
+
...input.compoundVariants.map((item) => {
|
|
2773
|
+
return {
|
|
2774
|
+
...item,
|
|
2775
|
+
class: {
|
|
2776
|
+
...item.class,
|
|
2777
|
+
base: typeof item.class.base === "string" ? item.class.base.replace(/focus-visible:/g, "focus:") : item.class.base
|
|
2778
|
+
}
|
|
2779
|
+
};
|
|
2780
|
+
})
|
|
2781
|
+
],
|
|
2782
|
+
defaultVariants: {
|
|
2783
|
+
...input.defaultVariants
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2786
|
+
};
|
|
2787
|
+
|
|
2788
|
+
const separator = (options) => ct({
|
|
2789
|
+
parts: {
|
|
2790
|
+
root: "flex items-center align-middle text-center",
|
|
2791
|
+
border: "",
|
|
2792
|
+
container: "font-medium text-default flex",
|
|
2793
|
+
icon: "shrink-0 size-5",
|
|
2794
|
+
avatar: "shrink-0",
|
|
2795
|
+
avatarSize: "2xs",
|
|
2796
|
+
label: "text-sm"
|
|
2797
|
+
},
|
|
2798
|
+
variants: {
|
|
2799
|
+
color: {
|
|
2800
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, { border: `border-${color}` }])),
|
|
2801
|
+
neutral: { border: "border-default" }
|
|
2802
|
+
},
|
|
2803
|
+
orientation: {
|
|
2804
|
+
horizontal: {
|
|
2805
|
+
root: "w-full flex-row",
|
|
2806
|
+
border: "",
|
|
2807
|
+
container: "mx-3 whitespace-nowrap"
|
|
2808
|
+
},
|
|
2809
|
+
vertical: {
|
|
2810
|
+
root: "h-full flex-col",
|
|
2811
|
+
border: "",
|
|
2812
|
+
container: "my-2"
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
start: {
|
|
2816
|
+
true: {
|
|
2817
|
+
border: "flex-grow data-[orientation=horizontal]:w-auto data-[orientation=vertical]:h-auto"
|
|
2818
|
+
}
|
|
2819
|
+
},
|
|
2820
|
+
end: {
|
|
2821
|
+
true: {
|
|
2822
|
+
border: "flex-grow data-[orientation=horizontal]:w-auto data-[orientation=vertical]:h-auto"
|
|
2823
|
+
}
|
|
2824
|
+
},
|
|
2825
|
+
size: {
|
|
2826
|
+
xs: "",
|
|
2827
|
+
sm: "",
|
|
2828
|
+
md: "",
|
|
2829
|
+
lg: "",
|
|
2830
|
+
xl: ""
|
|
2831
|
+
},
|
|
2832
|
+
type: {
|
|
2833
|
+
solid: {
|
|
2834
|
+
border: "border-solid"
|
|
2835
|
+
},
|
|
2836
|
+
dashed: {
|
|
2837
|
+
border: "border-dashed"
|
|
2838
|
+
},
|
|
2839
|
+
dotted: {
|
|
2840
|
+
border: "border-dotted"
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
},
|
|
2844
|
+
compoundVariants: [
|
|
2845
|
+
{
|
|
2846
|
+
orientation: "horizontal",
|
|
2847
|
+
start: false,
|
|
2848
|
+
end: false,
|
|
2849
|
+
class: { border: "w-full" }
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
orientation: "vertical",
|
|
2853
|
+
start: false,
|
|
2854
|
+
end: false,
|
|
2855
|
+
class: { border: "h-full" }
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
orientation: "horizontal",
|
|
2859
|
+
size: "xs",
|
|
2860
|
+
class: { border: "border-t" }
|
|
2861
|
+
},
|
|
2862
|
+
{
|
|
2863
|
+
orientation: "horizontal",
|
|
2864
|
+
size: "sm",
|
|
2865
|
+
class: { border: "border-t-[2px]" }
|
|
2866
|
+
},
|
|
2867
|
+
{
|
|
2868
|
+
orientation: "horizontal",
|
|
2869
|
+
size: "md",
|
|
2870
|
+
class: { border: "border-t-[3px]" }
|
|
2871
|
+
},
|
|
2872
|
+
{
|
|
2873
|
+
orientation: "horizontal",
|
|
2874
|
+
size: "lg",
|
|
2875
|
+
class: { border: "border-t-[4px]" }
|
|
2876
|
+
},
|
|
2877
|
+
{
|
|
2878
|
+
orientation: "horizontal",
|
|
2879
|
+
size: "xl",
|
|
2880
|
+
class: { border: "border-t-[5px]" }
|
|
2881
|
+
},
|
|
2882
|
+
{
|
|
2883
|
+
orientation: "vertical",
|
|
2884
|
+
size: "xs",
|
|
2885
|
+
class: { border: "border-s" }
|
|
2886
|
+
},
|
|
2887
|
+
{
|
|
2888
|
+
orientation: "vertical",
|
|
2889
|
+
size: "sm",
|
|
2890
|
+
class: { border: "border-s-[2px]" }
|
|
2891
|
+
},
|
|
2892
|
+
{
|
|
2893
|
+
orientation: "vertical",
|
|
2894
|
+
size: "md",
|
|
2895
|
+
class: { border: "border-s-[3px]" }
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
orientation: "vertical",
|
|
2899
|
+
size: "lg",
|
|
2900
|
+
class: { border: "border-s-[4px]" }
|
|
2901
|
+
},
|
|
2902
|
+
{
|
|
2903
|
+
orientation: "vertical",
|
|
2904
|
+
size: "xl",
|
|
2905
|
+
class: { border: "border-s-[5px]" }
|
|
2906
|
+
}
|
|
2907
|
+
],
|
|
2908
|
+
defaultVariants: {
|
|
2909
|
+
color: "neutral",
|
|
2910
|
+
size: "xs",
|
|
2911
|
+
type: "solid"
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
const skeleton = ct({
|
|
2916
|
+
base: "animate-pulse rounded-md bg-elevated"
|
|
2917
|
+
});
|
|
2918
|
+
|
|
2919
|
+
const slider = (options) => ct({
|
|
2920
|
+
parts: {
|
|
2921
|
+
root: "relative flex items-center select-none touch-none",
|
|
2922
|
+
track: "relative bg-accented overflow-hidden rounded-full grow",
|
|
2923
|
+
range: "absolute rounded-full",
|
|
2924
|
+
thumb: "rounded-full ring-2 ring-bg/10 focus-visible:ring-bg focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
2925
|
+
},
|
|
2926
|
+
variants: {
|
|
2927
|
+
color: {
|
|
2928
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2929
|
+
range: `bg-${color}`,
|
|
2930
|
+
thumb: `bg-${color} focus-visible:outline-${color}`
|
|
2931
|
+
}])),
|
|
2932
|
+
neutral: {
|
|
2933
|
+
range: "bg-inverted",
|
|
2934
|
+
thumb: "bg-inverted focus-visible:outline-inverted"
|
|
2935
|
+
}
|
|
2936
|
+
},
|
|
2937
|
+
size: {
|
|
2938
|
+
xs: {
|
|
2939
|
+
thumb: "size-3"
|
|
2940
|
+
},
|
|
2941
|
+
sm: {
|
|
2942
|
+
thumb: "size-3.5"
|
|
2943
|
+
},
|
|
2944
|
+
md: {
|
|
2945
|
+
thumb: "size-4"
|
|
2946
|
+
},
|
|
2947
|
+
lg: {
|
|
2948
|
+
thumb: "size-4.5"
|
|
2949
|
+
},
|
|
2950
|
+
xl: {
|
|
2951
|
+
thumb: "size-5"
|
|
2952
|
+
}
|
|
2953
|
+
},
|
|
2954
|
+
orientation: {
|
|
2955
|
+
horizontal: {
|
|
2956
|
+
root: "w-full",
|
|
2957
|
+
range: "h-full"
|
|
2958
|
+
},
|
|
2959
|
+
vertical: {
|
|
2960
|
+
root: "flex-col h-full",
|
|
2961
|
+
range: "w-full"
|
|
2962
|
+
}
|
|
2963
|
+
},
|
|
2964
|
+
disabled: {
|
|
2965
|
+
true: {
|
|
2966
|
+
root: "opacity-75 cursor-not-allowed"
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
},
|
|
2970
|
+
compoundVariants: [
|
|
2971
|
+
{
|
|
2972
|
+
orientation: "horizontal",
|
|
2973
|
+
size: "xs",
|
|
2974
|
+
class: {
|
|
2975
|
+
track: "h-[6px]"
|
|
2976
|
+
}
|
|
2977
|
+
},
|
|
2978
|
+
{
|
|
2979
|
+
orientation: "horizontal",
|
|
2980
|
+
size: "sm",
|
|
2981
|
+
class: {
|
|
2982
|
+
track: "h-[7px]"
|
|
2983
|
+
}
|
|
2984
|
+
},
|
|
2985
|
+
{
|
|
2986
|
+
orientation: "horizontal",
|
|
2987
|
+
size: "md",
|
|
2988
|
+
class: {
|
|
2989
|
+
track: "h-[8px]"
|
|
2990
|
+
}
|
|
2991
|
+
},
|
|
2992
|
+
{
|
|
2993
|
+
orientation: "horizontal",
|
|
2994
|
+
size: "lg",
|
|
2995
|
+
class: {
|
|
2996
|
+
track: "h-[9px]"
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
orientation: "horizontal",
|
|
3001
|
+
size: "xl",
|
|
3002
|
+
class: {
|
|
3003
|
+
track: "h-[10px]"
|
|
3004
|
+
}
|
|
3005
|
+
},
|
|
3006
|
+
{
|
|
3007
|
+
orientation: "vertical",
|
|
3008
|
+
size: "xs",
|
|
3009
|
+
class: {
|
|
3010
|
+
track: "w-[6px]"
|
|
3011
|
+
}
|
|
3012
|
+
},
|
|
3013
|
+
{
|
|
3014
|
+
orientation: "vertical",
|
|
3015
|
+
size: "sm",
|
|
3016
|
+
class: {
|
|
3017
|
+
track: "w-[7px]"
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
3020
|
+
{
|
|
3021
|
+
orientation: "vertical",
|
|
3022
|
+
size: "md",
|
|
3023
|
+
class: {
|
|
3024
|
+
track: "w-[8px]"
|
|
3025
|
+
}
|
|
3026
|
+
},
|
|
3027
|
+
{
|
|
3028
|
+
orientation: "vertical",
|
|
3029
|
+
size: "lg",
|
|
3030
|
+
class: {
|
|
3031
|
+
track: "w-[9px]"
|
|
3032
|
+
}
|
|
3033
|
+
},
|
|
3034
|
+
{
|
|
3035
|
+
orientation: "vertical",
|
|
3036
|
+
size: "xl",
|
|
3037
|
+
class: {
|
|
3038
|
+
track: "w-[10px]"
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
],
|
|
3042
|
+
defaultVariants: {
|
|
3043
|
+
size: "md",
|
|
3044
|
+
color: "primary"
|
|
3045
|
+
}
|
|
3046
|
+
});
|
|
3047
|
+
|
|
3048
|
+
const _switch = (options) => ct({
|
|
3049
|
+
parts: {
|
|
3050
|
+
root: "relative flex items-start",
|
|
3051
|
+
base: [
|
|
3052
|
+
"inline-flex items-center shrink-0 rounded-full border-2 border-transparent cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 data-[state=unchecked]:bg-accented",
|
|
3053
|
+
options.theme.transitions && "transition-colors duration-200"
|
|
3054
|
+
],
|
|
3055
|
+
container: "flex items-center",
|
|
3056
|
+
thumb: "group pointer-events-none rounded-full bg-default shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center",
|
|
3057
|
+
icon: [
|
|
3058
|
+
"absolute shrink-0 group-data-[state=unchecked]:text-dimmed opacity-0 size-10/12",
|
|
3059
|
+
options.theme.transitions && "transition-[color,opacity] duration-200"
|
|
3060
|
+
],
|
|
3061
|
+
wrapper: "ms-2",
|
|
3062
|
+
label: "block font-medium text-default cursor-pointer",
|
|
3063
|
+
description: "text-muted"
|
|
3064
|
+
},
|
|
3065
|
+
variants: {
|
|
3066
|
+
color: {
|
|
3067
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
3068
|
+
base: `data-[state=checked]:bg-${color} focus-visible:outline-${color}`,
|
|
3069
|
+
icon: `group-data-[state=checked]:text-${color}`
|
|
3070
|
+
}])),
|
|
3071
|
+
neutral: {
|
|
3072
|
+
base: "data-[state=checked]:bg-inverted focus-visible:outline-inverted",
|
|
3073
|
+
icon: "group-data-[state=checked]:text-highlighted"
|
|
3074
|
+
}
|
|
3075
|
+
},
|
|
3076
|
+
size: {
|
|
3077
|
+
xs: {
|
|
3078
|
+
base: "w-7",
|
|
3079
|
+
container: "h-4",
|
|
3080
|
+
thumb: "size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",
|
|
3081
|
+
wrapper: "text-xs"
|
|
3082
|
+
},
|
|
3083
|
+
sm: {
|
|
3084
|
+
base: "w-8",
|
|
3085
|
+
container: "h-4",
|
|
3086
|
+
thumb: "size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5",
|
|
3087
|
+
wrapper: "text-xs"
|
|
3088
|
+
},
|
|
3089
|
+
md: {
|
|
3090
|
+
base: "w-9",
|
|
3091
|
+
container: "h-5",
|
|
3092
|
+
thumb: "size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",
|
|
3093
|
+
wrapper: "text-sm"
|
|
3094
|
+
},
|
|
3095
|
+
lg: {
|
|
3096
|
+
base: "w-10",
|
|
3097
|
+
container: "h-5",
|
|
3098
|
+
thumb: "size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5",
|
|
3099
|
+
wrapper: "text-sm"
|
|
3100
|
+
},
|
|
3101
|
+
xl: {
|
|
3102
|
+
base: "w-11",
|
|
3103
|
+
container: "h-6",
|
|
3104
|
+
thumb: "size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5",
|
|
3105
|
+
wrapper: "text-base"
|
|
3106
|
+
}
|
|
3107
|
+
},
|
|
3108
|
+
checked: {
|
|
3109
|
+
true: {
|
|
3110
|
+
icon: "group-data-[state=checked]:opacity-100"
|
|
3111
|
+
}
|
|
3112
|
+
},
|
|
3113
|
+
unchecked: {
|
|
3114
|
+
true: {
|
|
3115
|
+
icon: "group-data-[state=unchecked]:opacity-100"
|
|
3116
|
+
}
|
|
3117
|
+
},
|
|
3118
|
+
loading: {
|
|
3119
|
+
true: {
|
|
3120
|
+
icon: "animate-spin"
|
|
3121
|
+
}
|
|
3122
|
+
},
|
|
3123
|
+
required: {
|
|
3124
|
+
true: {
|
|
3125
|
+
label: `after:content-['*'] after:ms-0.5 after:text-error`
|
|
3126
|
+
}
|
|
3127
|
+
},
|
|
3128
|
+
disabled: {
|
|
3129
|
+
true: {
|
|
3130
|
+
base: "cursor-not-allowed opacity-75",
|
|
3131
|
+
label: "cursor-not-allowed opacity-75",
|
|
3132
|
+
description: "cursor-not-allowed opacity-75"
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
},
|
|
3136
|
+
defaultVariants: {
|
|
3137
|
+
color: "primary",
|
|
3138
|
+
size: "md"
|
|
3139
|
+
}
|
|
3140
|
+
});
|
|
3141
|
+
|
|
3142
|
+
const table = (options) => ct({
|
|
3143
|
+
parts: {
|
|
3144
|
+
root: "relative overflow-auto",
|
|
3145
|
+
base: "min-w-full",
|
|
3146
|
+
caption: "sr-only",
|
|
3147
|
+
thead: "relative",
|
|
3148
|
+
tbody: "[&>tr]:data-[selectable=true]:hover:bg-elevated/50 [&>tr]:data-[selectable=true]:focus-visible:outline-primary",
|
|
3149
|
+
tfoot: "relative",
|
|
3150
|
+
tr: "data-[selected=true]:bg-elevated/50",
|
|
3151
|
+
th: "px-4 py-3.5 text-sm text-highlighted text-left rtl:text-right font-semibold [&:has([role=checkbox])]:pe-0",
|
|
3152
|
+
td: "p-4 text-sm text-muted whitespace-nowrap [&:has([role=checkbox])]:pe-0",
|
|
3153
|
+
separator: "absolute z-[1] left-0 w-full h-px bg-[--ui-border-accented]",
|
|
3154
|
+
empty: "py-6 text-center text-sm text-muted",
|
|
3155
|
+
loading: "py-6 text-center"
|
|
3156
|
+
},
|
|
3157
|
+
variants: {
|
|
3158
|
+
virtualize: {
|
|
3159
|
+
false: {
|
|
3160
|
+
base: "overflow-clip",
|
|
3161
|
+
tbody: "divide-y divide-default"
|
|
3162
|
+
}
|
|
3163
|
+
},
|
|
3164
|
+
pinned: {
|
|
3165
|
+
true: {
|
|
3166
|
+
th: "sticky bg-default/75 data-[pinned=left]:left-0 data-[pinned=right]:right-0",
|
|
3167
|
+
td: "sticky bg-default/75 data-[pinned=left]:left-0 data-[pinned=right]:right-0"
|
|
3168
|
+
}
|
|
3169
|
+
},
|
|
3170
|
+
sticky: {
|
|
3171
|
+
true: {
|
|
3172
|
+
thead: "sticky top-0 inset-x-0 bg-default/75 z-[1] backdrop-blur",
|
|
3173
|
+
tfoot: "sticky bottom-0 inset-x-0 bg-default/75 z-[1] backdrop-blur"
|
|
3174
|
+
},
|
|
3175
|
+
header: {
|
|
3176
|
+
thead: "sticky top-0 inset-x-0 bg-default/75 z-[1] backdrop-blur"
|
|
3177
|
+
},
|
|
3178
|
+
footer: {
|
|
3179
|
+
tfoot: "sticky bottom-0 inset-x-0 bg-default/75 z-[1] backdrop-blur"
|
|
3180
|
+
}
|
|
3181
|
+
},
|
|
3182
|
+
loading: {
|
|
3183
|
+
true: {
|
|
3184
|
+
thead: "after:content-empty after:absolute after:z-[1] after:h-px"
|
|
3185
|
+
}
|
|
3186
|
+
},
|
|
3187
|
+
loadingAnimation: {
|
|
3188
|
+
"carousel": "",
|
|
3189
|
+
"carousel-inverse": "",
|
|
3190
|
+
"swing": "",
|
|
3191
|
+
"elastic": ""
|
|
3192
|
+
},
|
|
3193
|
+
loadingColor: {
|
|
3194
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
3195
|
+
neutral: ""
|
|
3196
|
+
}
|
|
3197
|
+
},
|
|
3198
|
+
compoundVariants: [
|
|
3199
|
+
...(options.theme.colors || []).map((loadingColor) => ({
|
|
3200
|
+
loading: true,
|
|
3201
|
+
loadingColor,
|
|
3202
|
+
class: {
|
|
3203
|
+
thead: `after:bg-${loadingColor}`
|
|
3204
|
+
}
|
|
3205
|
+
})),
|
|
3206
|
+
{
|
|
3207
|
+
loading: true,
|
|
3208
|
+
loadingColor: "neutral",
|
|
3209
|
+
class: {
|
|
3210
|
+
thead: "after:bg-inverted"
|
|
3211
|
+
}
|
|
3212
|
+
},
|
|
3213
|
+
{
|
|
3214
|
+
loading: true,
|
|
3215
|
+
loadingAnimation: "carousel",
|
|
3216
|
+
class: {
|
|
3217
|
+
thead: "after:animate-[carousel_2s_ease-in-out_infinite] rtl:after:animate-[carousel-rtl_2s_ease-in-out_infinite]"
|
|
3218
|
+
}
|
|
3219
|
+
},
|
|
3220
|
+
{
|
|
3221
|
+
loading: true,
|
|
3222
|
+
loadingAnimation: "carousel-inverse",
|
|
3223
|
+
class: {
|
|
3224
|
+
thead: "after:animate-[carousel-inverse_2s_ease-in-out_infinite] rtl:after:animate-[carousel-inverse-rtl_2s_ease-in-out_infinite]"
|
|
3225
|
+
}
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
loading: true,
|
|
3229
|
+
loadingAnimation: "swing",
|
|
3230
|
+
class: {
|
|
3231
|
+
thead: "after:animate-[swing_2s_ease-in-out_infinite]"
|
|
3232
|
+
}
|
|
3233
|
+
},
|
|
3234
|
+
{
|
|
3235
|
+
loading: true,
|
|
3236
|
+
loadingAnimation: "elastic",
|
|
3237
|
+
class: {
|
|
3238
|
+
thead: "after:animate-[elastic_2s_ease-in-out_infinite]"
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
],
|
|
3242
|
+
defaultVariants: {
|
|
3243
|
+
loadingColor: "primary",
|
|
3244
|
+
loadingAnimation: "carousel"
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
|
|
3248
|
+
const tabs = (options) => ct({
|
|
3249
|
+
parts: {
|
|
3250
|
+
root: "flex items-center gap-2",
|
|
3251
|
+
list: "relative flex p-1",
|
|
3252
|
+
indicator: "absolute transition duration-200",
|
|
3253
|
+
trigger: [
|
|
3254
|
+
"relative inline-flex items-center min-w-0 font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75",
|
|
3255
|
+
"data-[state=inactive]:text-muted data-[state=inactive]:not-disabled:cursor-pointer hover:data-[state=inactive]:not-disabled:text-default",
|
|
3256
|
+
options.theme.transitions && "transition-colors"
|
|
3257
|
+
],
|
|
3258
|
+
leadingIcon: "shrink-0",
|
|
3259
|
+
leadingAvatar: "shrink-0",
|
|
3260
|
+
leadingAvatarSize: "",
|
|
3261
|
+
label: "truncate",
|
|
3262
|
+
trailingBadge: "shrink-0",
|
|
3263
|
+
trailingBadgeSize: "sm",
|
|
3264
|
+
content: "focus:outline-none w-full"
|
|
3265
|
+
},
|
|
3266
|
+
variants: {
|
|
3267
|
+
color: {
|
|
3268
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
3269
|
+
neutral: ""
|
|
3270
|
+
},
|
|
3271
|
+
variant: {
|
|
3272
|
+
pill: {
|
|
3273
|
+
list: "bg-elevated rounded-lg",
|
|
3274
|
+
trigger: "grow",
|
|
3275
|
+
indicator: "rounded-md shadow-xs"
|
|
3276
|
+
},
|
|
3277
|
+
link: {
|
|
3278
|
+
list: "border-default",
|
|
3279
|
+
indicator: "rounded-full",
|
|
3280
|
+
trigger: "focus:outline-none"
|
|
3281
|
+
}
|
|
3282
|
+
},
|
|
3283
|
+
orientation: {
|
|
3284
|
+
horizontal: {
|
|
3285
|
+
root: "flex-col",
|
|
3286
|
+
list: "w-full",
|
|
3287
|
+
indicator: "left-0 w-[--reka-tabs-indicator-size] translate-x-[--reka-tabs-indicator-position]",
|
|
3288
|
+
trigger: "justify-center"
|
|
3289
|
+
},
|
|
3290
|
+
vertical: {
|
|
3291
|
+
list: "flex-col",
|
|
3292
|
+
indicator: "top-0 h-[--reka-tabs-indicator-size] translate-y-[--reka-tabs-indicator-position]"
|
|
3293
|
+
}
|
|
3294
|
+
},
|
|
3295
|
+
size: {
|
|
3296
|
+
xs: {
|
|
3297
|
+
trigger: "px-2 py-1 text-xs gap-1",
|
|
3298
|
+
leadingIcon: "size-4",
|
|
3299
|
+
leadingAvatarSize: "3xs"
|
|
3300
|
+
},
|
|
3301
|
+
sm: {
|
|
3302
|
+
trigger: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
3303
|
+
leadingIcon: "size-4",
|
|
3304
|
+
leadingAvatarSize: "3xs"
|
|
3305
|
+
},
|
|
3306
|
+
md: {
|
|
3307
|
+
trigger: "px-3 py-1.5 text-sm gap-1.5",
|
|
3308
|
+
leadingIcon: "size-5",
|
|
3309
|
+
leadingAvatarSize: "2xs"
|
|
3310
|
+
},
|
|
3311
|
+
lg: {
|
|
3312
|
+
trigger: "px-3 py-2 text-sm gap-2",
|
|
3313
|
+
leadingIcon: "size-5",
|
|
3314
|
+
leadingAvatarSize: "2xs"
|
|
3315
|
+
},
|
|
3316
|
+
xl: {
|
|
3317
|
+
trigger: "px-3 py-2 text-base gap-2",
|
|
3318
|
+
leadingIcon: "size-6",
|
|
3319
|
+
leadingAvatarSize: "xs"
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
},
|
|
3323
|
+
compoundVariants: [
|
|
3324
|
+
{
|
|
3325
|
+
orientation: "horizontal",
|
|
3326
|
+
variant: "pill",
|
|
3327
|
+
class: {
|
|
3328
|
+
indicator: "inset-y-1"
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
orientation: "horizontal",
|
|
3333
|
+
variant: "link",
|
|
3334
|
+
class: {
|
|
3335
|
+
list: "border-b -mb-px",
|
|
3336
|
+
indicator: "-bottom-px h-px"
|
|
3337
|
+
}
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
orientation: "vertical",
|
|
3341
|
+
variant: "pill",
|
|
3342
|
+
class: {
|
|
3343
|
+
indicator: "inset-x-1",
|
|
3344
|
+
list: "items-center"
|
|
3345
|
+
}
|
|
3346
|
+
},
|
|
3347
|
+
{
|
|
3348
|
+
orientation: "vertical",
|
|
3349
|
+
variant: "link",
|
|
3350
|
+
class: {
|
|
3351
|
+
list: "border-s -ms-px",
|
|
3352
|
+
indicator: "-start-px w-px"
|
|
3353
|
+
}
|
|
3354
|
+
},
|
|
3355
|
+
...(options.theme.colors || []).map((color) => ({
|
|
3356
|
+
color,
|
|
3357
|
+
variant: "pill",
|
|
3358
|
+
class: {
|
|
3359
|
+
indicator: `bg-${color}`,
|
|
3360
|
+
trigger: `data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-${color}`
|
|
3361
|
+
}
|
|
3362
|
+
})),
|
|
3363
|
+
{
|
|
3364
|
+
color: "neutral",
|
|
3365
|
+
variant: "pill",
|
|
3366
|
+
class: {
|
|
3367
|
+
indicator: "bg-inverted",
|
|
3368
|
+
trigger: "data-[state=active]:text-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-inverted"
|
|
3369
|
+
}
|
|
3370
|
+
},
|
|
3371
|
+
...(options.theme.colors || []).map((color) => ({
|
|
3372
|
+
color,
|
|
3373
|
+
variant: "link",
|
|
3374
|
+
class: {
|
|
3375
|
+
indicator: `bg-${color}`,
|
|
3376
|
+
trigger: `data-[state=active]:text-${color} focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}`
|
|
3377
|
+
}
|
|
3378
|
+
})),
|
|
3379
|
+
{
|
|
3380
|
+
color: "neutral",
|
|
3381
|
+
variant: "link",
|
|
3382
|
+
class: {
|
|
3383
|
+
indicator: "bg-inverted",
|
|
3384
|
+
trigger: "data-[state=active]:text-highlighted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted"
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
],
|
|
3388
|
+
defaultVariants: {
|
|
3389
|
+
color: "primary",
|
|
3390
|
+
variant: "pill",
|
|
3391
|
+
size: "md"
|
|
3392
|
+
}
|
|
3393
|
+
});
|
|
3394
|
+
|
|
3395
|
+
const textarea = (options) => {
|
|
3396
|
+
const input = inputTheme(options);
|
|
3397
|
+
return ct(defu({
|
|
3398
|
+
parts: {
|
|
3399
|
+
leading: "absolute start-0 flex items-start",
|
|
3400
|
+
trailing: "absolute end-0 flex items-start"
|
|
3401
|
+
},
|
|
3402
|
+
variants: {
|
|
3403
|
+
autoresize: {
|
|
3404
|
+
true: {
|
|
3405
|
+
base: "resize-none"
|
|
3406
|
+
}
|
|
3407
|
+
},
|
|
3408
|
+
size: {
|
|
3409
|
+
xs: {
|
|
3410
|
+
leading: "ps-2 inset-y-1",
|
|
3411
|
+
trailing: "pe-2 inset-y-1"
|
|
3412
|
+
},
|
|
3413
|
+
sm: {
|
|
3414
|
+
leading: "ps-2.5 inset-y-1.5",
|
|
3415
|
+
trailing: "pe-2.5 inset-y-1.5"
|
|
3416
|
+
},
|
|
3417
|
+
md: {
|
|
3418
|
+
leading: "ps-2.5 inset-y-1.5",
|
|
3419
|
+
trailing: "pe-2.5 inset-y-1.5"
|
|
3420
|
+
},
|
|
3421
|
+
lg: {
|
|
3422
|
+
leading: "ps-3 inset-y-2",
|
|
3423
|
+
trailing: "pe-3 inset-y-2"
|
|
3424
|
+
},
|
|
3425
|
+
xl: {
|
|
3426
|
+
leading: "ps-3 inset-y-2",
|
|
3427
|
+
trailing: "pe-3 inset-y-2"
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
}, input));
|
|
3432
|
+
};
|
|
3433
|
+
|
|
3434
|
+
const toast = (options) => ct({
|
|
3435
|
+
parts: {
|
|
3436
|
+
root: "relative group overflow-hidden bg-default shadow-lg rounded-lg ring ring-default p-4 flex gap-2.5 focus:outline-none",
|
|
3437
|
+
wrapper: "w-0 flex-1 flex flex-col",
|
|
3438
|
+
title: "text-sm font-medium text-highlighted",
|
|
3439
|
+
description: "text-sm text-muted",
|
|
3440
|
+
icon: "shrink-0 size-5",
|
|
3441
|
+
avatar: "shrink-0",
|
|
3442
|
+
avatarSize: "2xl",
|
|
3443
|
+
actions: "flex gap-1.5 shrink-0",
|
|
3444
|
+
progress: "absolute inset-x-0 bottom-0",
|
|
3445
|
+
close: "p-0"
|
|
3446
|
+
},
|
|
3447
|
+
variants: {
|
|
3448
|
+
color: {
|
|
3449
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
3450
|
+
root: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}`,
|
|
3451
|
+
icon: `text-${color}`
|
|
3452
|
+
}])),
|
|
3453
|
+
neutral: {
|
|
3454
|
+
root: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted",
|
|
3455
|
+
icon: "text-highlighted"
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
orientation: {
|
|
3459
|
+
horizontal: {
|
|
3460
|
+
root: "items-center",
|
|
3461
|
+
actions: "items-center"
|
|
3462
|
+
},
|
|
3463
|
+
vertical: {
|
|
3464
|
+
root: "items-start",
|
|
3465
|
+
actions: "items-start mt-1"
|
|
3466
|
+
}
|
|
3467
|
+
},
|
|
3468
|
+
title: {
|
|
3469
|
+
true: {
|
|
3470
|
+
description: "mt-1"
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
},
|
|
3474
|
+
defaultVariants: {
|
|
3475
|
+
color: "primary"
|
|
3476
|
+
}
|
|
3477
|
+
});
|
|
3478
|
+
|
|
3479
|
+
const toastProvider = ct({
|
|
3480
|
+
parts: {
|
|
3481
|
+
viewport: [
|
|
3482
|
+
"fixed flex flex-col w-[calc(100%-2rem)] sm:w-96 z-[100] focus:outline-none",
|
|
3483
|
+
"data-[expanded=true]:h-[--height]"
|
|
3484
|
+
],
|
|
3485
|
+
base: [
|
|
3486
|
+
"pointer-events-auto absolute inset-x-0 z-[--index] [transform:var(--transform)] transition-all duration-200 ease-out",
|
|
3487
|
+
"data-[expanded=false]:data-[front=false]:h-[--front-height]",
|
|
3488
|
+
"data-[expanded=false]:data-[front=false]:*:opacity-0 data-[front=false]:*:transition-opacity data-[front=false]:*:duration-100 data-[state=closed]:animate-[toast-closed_200ms_ease-in-out]",
|
|
3489
|
+
"data-[state=closed]:data-[expanded=false]:data-[front=false]:animate-[toast-collapsed-closed_200ms_ease-in-out]",
|
|
3490
|
+
"data-[swipe=move]:transition-none"
|
|
3491
|
+
]
|
|
3492
|
+
},
|
|
3493
|
+
variants: {
|
|
3494
|
+
position: {
|
|
3495
|
+
"top-left": {
|
|
3496
|
+
viewport: "left-4"
|
|
3497
|
+
},
|
|
3498
|
+
"top-center": {
|
|
3499
|
+
viewport: "left-1/2 transform -translate-x-1/2"
|
|
3500
|
+
},
|
|
3501
|
+
"top-right": {
|
|
3502
|
+
viewport: "right-4"
|
|
3503
|
+
},
|
|
3504
|
+
"bottom-left": {
|
|
3505
|
+
viewport: "left-4"
|
|
3506
|
+
},
|
|
3507
|
+
"bottom-center": {
|
|
3508
|
+
viewport: "left-1/2 transform -translate-x-1/2"
|
|
3509
|
+
},
|
|
3510
|
+
"bottom-right": {
|
|
3511
|
+
viewport: "right-4"
|
|
3512
|
+
}
|
|
3513
|
+
},
|
|
3514
|
+
swipeDirection: {
|
|
3515
|
+
up: {
|
|
3516
|
+
base: "data-[swipe=end]:animate-[toast-slide-up_200ms_ease-out]"
|
|
3517
|
+
},
|
|
3518
|
+
right: {
|
|
3519
|
+
base: "data-[swipe=end]:animate-[toast-slide-right_200ms_ease-out]"
|
|
3520
|
+
},
|
|
3521
|
+
down: {
|
|
3522
|
+
base: "data-[swipe=end]:animate-[toast-slide-down_200ms_ease-out]"
|
|
3523
|
+
},
|
|
3524
|
+
left: {
|
|
3525
|
+
base: "data-[swipe=end]:animate-[toast-slide-left_200ms_ease-out]"
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
},
|
|
3529
|
+
compoundVariants: [
|
|
3530
|
+
{
|
|
3531
|
+
position: ["top-left", "top-center", "top-right"],
|
|
3532
|
+
class: {
|
|
3533
|
+
viewport: "top-4",
|
|
3534
|
+
base: "top-0 data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out]"
|
|
3535
|
+
}
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
position: ["bottom-left", "bottom-center", "bottom-right"],
|
|
3539
|
+
class: {
|
|
3540
|
+
viewport: "bottom-4",
|
|
3541
|
+
base: "bottom-0 data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out]"
|
|
3542
|
+
}
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
swipeDirection: ["left", "right"],
|
|
3546
|
+
class: {
|
|
3547
|
+
base: [
|
|
3548
|
+
"data-[swipe=move]:translate-x-[--reka-toast-swipe-move-x]",
|
|
3549
|
+
"data-[swipe=end]:translate-x-[--reka-toast-swipe-end-x]",
|
|
3550
|
+
"data-[swipe=cancel]:translate-x-0"
|
|
3551
|
+
]
|
|
3552
|
+
}
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
swipeDirection: ["up", "down"],
|
|
3556
|
+
class: {
|
|
3557
|
+
base: [
|
|
3558
|
+
"data-[swipe=move]:translate-y-[--reka-toast-swipe-move-y]",
|
|
3559
|
+
"data-[swipe=end]:translate-y-[--reka-toast-swipe-end-y]",
|
|
3560
|
+
"data-[swipe=cancel]:translate-y-0"
|
|
3561
|
+
]
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
],
|
|
3565
|
+
defaultVariants: {
|
|
3566
|
+
position: "bottom-right"
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
|
|
3570
|
+
const tooltip = ct({
|
|
3571
|
+
parts: {
|
|
3572
|
+
content: "flex items-center gap-1 bg-default text-highlighted shadow-sm rounded-sm ring ring-default h-6 px-2.5 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-[--reka-tooltip-content-transform-origin] pointer-events-auto",
|
|
3573
|
+
arrow: "fill-default",
|
|
3574
|
+
text: "truncate",
|
|
3575
|
+
kbds: `hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-['\xB7'] not-first-of-type:before:me-0.5`,
|
|
3576
|
+
kbdsSize: "sm"
|
|
3577
|
+
}
|
|
3578
|
+
});
|
|
3579
|
+
|
|
3580
|
+
const theme = {
|
|
3581
|
+
__proto__: null,
|
|
3582
|
+
accordion: accordion,
|
|
3583
|
+
alert: alert,
|
|
3584
|
+
avatar: avatar,
|
|
3585
|
+
avatarGroup: avatarGroup,
|
|
3586
|
+
badge: badge,
|
|
3587
|
+
breadcrumb: breadcrumb,
|
|
3588
|
+
button: button,
|
|
3589
|
+
calendar: calendar,
|
|
3590
|
+
card: card,
|
|
3591
|
+
carousel: carousel,
|
|
3592
|
+
checkbox: checkbox,
|
|
3593
|
+
chip: chip,
|
|
3594
|
+
collapsible: collapsible,
|
|
3595
|
+
drawer: drawer,
|
|
3596
|
+
dropdownMenu: dropdownMenu,
|
|
3597
|
+
fieldGroup: fieldGroup,
|
|
3598
|
+
form: form,
|
|
3599
|
+
formField: formField,
|
|
3600
|
+
input: inputTheme,
|
|
3601
|
+
inputNumber: inputNumber,
|
|
3602
|
+
kbd: kbd,
|
|
3603
|
+
link: link,
|
|
3604
|
+
modal: modal,
|
|
3605
|
+
navigationMenu: navigationMenu,
|
|
3606
|
+
pagination: pagination,
|
|
3607
|
+
pinInput: pinInput,
|
|
3608
|
+
popover: popover,
|
|
3609
|
+
progress: progress,
|
|
3610
|
+
radioGroup: radioGroup,
|
|
3611
|
+
scrollArea: scrollArea,
|
|
3612
|
+
select: select,
|
|
3613
|
+
separator: separator,
|
|
3614
|
+
skeleton: skeleton,
|
|
3615
|
+
slider: slider,
|
|
3616
|
+
switch: _switch,
|
|
3617
|
+
table: table,
|
|
3618
|
+
tabs: tabs,
|
|
3619
|
+
textarea: textarea,
|
|
3620
|
+
toast: toast,
|
|
3621
|
+
toastProvider: toastProvider,
|
|
3622
|
+
tooltip: tooltip
|
|
3623
|
+
};
|
|
3624
|
+
|
|
3625
|
+
function getTemplates(options, uiConfig, nuxt) {
|
|
3626
|
+
const templates = [];
|
|
3627
|
+
const isDev = process.argv.includes("--uiDev");
|
|
3628
|
+
function writeThemeTemplate(theme2, path) {
|
|
3629
|
+
for (const component in theme2) {
|
|
3630
|
+
templates.push({
|
|
3631
|
+
filename: `ui/${""}${kebabCase(component)}.ts`,
|
|
3632
|
+
write: true,
|
|
3633
|
+
getContents: () => {
|
|
3634
|
+
const template = theme2[component];
|
|
3635
|
+
const result = typeof template === "function" ? template(options) : template;
|
|
3636
|
+
const json = JSON.stringify(result, null, 2);
|
|
3637
|
+
if (isDev) {
|
|
3638
|
+
const templatePath = fileURLToPath(new URL(`theme/${""}${kebabCase(component)}`, import.meta.url));
|
|
3639
|
+
return [
|
|
3640
|
+
[
|
|
3641
|
+
`// @unocss-include`,
|
|
3642
|
+
`import type { ModuleOptions } from '@byyuurin/ui'`,
|
|
3643
|
+
`import { ct } from '@byyuurin/ui-kit'`,
|
|
3644
|
+
`import template from ${JSON.stringify(templatePath)}`
|
|
3645
|
+
].join("\n"),
|
|
3646
|
+
`const options: ModuleOptions = ${JSON.stringify(options, null, 2)}`,
|
|
3647
|
+
`const result = typeof template === 'function' ? (template as Function)(options) : template`,
|
|
3648
|
+
`if (result?.defaultVariants?.color && options.theme?.defaultVariants?.color)
|
|
3649
|
+
result.defaultVariants.color = options.theme.defaultVariants.color`,
|
|
3650
|
+
`if (result?.defaultVariants?.size && options.theme?.defaultVariants?.size)
|
|
3651
|
+
result.defaultVariants.size = options.theme.defaultVariants.size`,
|
|
3652
|
+
`const theme = ct(${json})`,
|
|
3653
|
+
`export default result as typeof theme`
|
|
3654
|
+
].join("\n\n");
|
|
3655
|
+
}
|
|
3656
|
+
return [
|
|
3657
|
+
`// @unocss-include
|
|
3658
|
+
import { ct } from '@byyuurin/ui-kit'`,
|
|
3659
|
+
`export default ct(${json})`
|
|
3660
|
+
].join("\n\n");
|
|
3661
|
+
}
|
|
3662
|
+
});
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
function writeUnoTemplate() {
|
|
3666
|
+
templates.push({
|
|
3667
|
+
filename: "uno-merge.ts",
|
|
3668
|
+
write: true,
|
|
3669
|
+
async getContents() {
|
|
3670
|
+
const { config } = await loadConfig();
|
|
3671
|
+
const configPath = await findPath(["uno.config", "unocss.config"], { extensions: [".ts", ".mjs"] });
|
|
3672
|
+
const userConfigSource = [];
|
|
3673
|
+
if (configPath) {
|
|
3674
|
+
if (nuxt && isDev) {
|
|
3675
|
+
userConfigSource.push(
|
|
3676
|
+
`import config from ${JSON.stringify(configPath.replace(/\.ts$/, ""))}`,
|
|
3677
|
+
``,
|
|
3678
|
+
`const userConfig: UserConfig = { theme: config.theme, shortcuts: config.shortcuts }`
|
|
3679
|
+
);
|
|
3680
|
+
} else {
|
|
3681
|
+
let shortcuts;
|
|
3682
|
+
if (config.shortcuts) {
|
|
3683
|
+
shortcuts = Array.isArray(config.shortcuts) ? config.shortcuts : [config.shortcuts];
|
|
3684
|
+
shortcuts = shortcuts.filter((s) => {
|
|
3685
|
+
if (Array.isArray(s))
|
|
3686
|
+
return !(s[0] instanceof RegExp);
|
|
3687
|
+
return true;
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
userConfigSource.push(
|
|
3691
|
+
``,
|
|
3692
|
+
`const userConfig: UserConfig = ${JSON.stringify({ theme: config.theme, shortcuts }, null, 2)}`
|
|
3693
|
+
);
|
|
3694
|
+
}
|
|
3695
|
+
} else {
|
|
3696
|
+
userConfigSource.push(
|
|
3697
|
+
``,
|
|
3698
|
+
`const userConfig: UserConfig = {}`
|
|
3699
|
+
);
|
|
3700
|
+
}
|
|
3701
|
+
return `import { createUnoMerge } from '@byyuurin/uno-merge'
|
|
3702
|
+
import { createUnoPreset } from '@byyuurin/ui/unocss'
|
|
3703
|
+
import type { UserConfig } from '@unocss/core'
|
|
3704
|
+
import { mergeConfigs } from '@unocss/core'
|
|
3705
|
+
import { presetWind4 } from '@unocss/preset-wind4'
|
|
3706
|
+
${userConfigSource.join("\n")}
|
|
3707
|
+
|
|
3708
|
+
export const { merge: unoMerge } = await createUnoMerge(mergeConfigs([
|
|
3709
|
+
{
|
|
3710
|
+
presets: [
|
|
3711
|
+
presetWind4(),
|
|
3712
|
+
createUnoPreset(${JSON.stringify({ colors: options.theme?.colors })})
|
|
3713
|
+
]
|
|
3714
|
+
},
|
|
3715
|
+
userConfig,
|
|
3716
|
+
]))`;
|
|
3717
|
+
}
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
writeThemeTemplate(theme);
|
|
3721
|
+
writeUnoTemplate();
|
|
3722
|
+
templates.push({
|
|
3723
|
+
filename: "ui/index.ts",
|
|
3724
|
+
write: true,
|
|
3725
|
+
getContents() {
|
|
3726
|
+
const contents = Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n");
|
|
3727
|
+
return contents;
|
|
3728
|
+
}
|
|
3729
|
+
});
|
|
3730
|
+
templates.push({
|
|
3731
|
+
filename: "types/ui.d.ts",
|
|
3732
|
+
getContents() {
|
|
3733
|
+
const appIcon = Object.keys(uiConfig.icons ?? {}).map((s) => `'${s}'`).join(" | ");
|
|
3734
|
+
const appNeutralColor = neutralColors.map((s) => `'${s}'`).join(" | ");
|
|
3735
|
+
return `import * as ui from '#build/ui'
|
|
3736
|
+
import type { UIConfig } from '@byyuurin/ui'
|
|
3737
|
+
import type { colors } from '@unocss/preset-wind4/colors'
|
|
3738
|
+
|
|
3739
|
+
type NeutralColor = ${appNeutralColor}
|
|
3740
|
+
type Color = keyof Omit<typeof colors, NeutralColor | 'black' | 'white'> | (string & {})
|
|
3741
|
+
|
|
3742
|
+
type AppConfigIcons = Record<${appIcon} | (string & {}), string>
|
|
3743
|
+
|
|
3744
|
+
export type AppConfigUI = {
|
|
3745
|
+
colors?: {
|
|
3746
|
+
${options.theme?.colors?.map((color) => `'${color}'?: Color`).join("\n ")}
|
|
3747
|
+
neutral?: NeutralColor | (string & {})
|
|
3748
|
+
}
|
|
3749
|
+
icons?: Partial<AppConfigIcons>
|
|
3750
|
+
} & UIConfig<typeof ui>
|
|
3751
|
+
|
|
3752
|
+
declare module '@nuxt/schema' {
|
|
3753
|
+
interface AppConfigInput {
|
|
3754
|
+
/** UI theme configuration */
|
|
3755
|
+
ui?: AppConfigUI
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
export {}
|
|
3760
|
+
`;
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3763
|
+
templates.push({
|
|
3764
|
+
filename: "ui-image-component.ts",
|
|
3765
|
+
write: true,
|
|
3766
|
+
getContents: ({ app }) => {
|
|
3767
|
+
const image = app?.components?.find((c) => c.pascalName === "NuxtImg" && !/nuxt(?:-nightly)?\/dist\/app/.test(c.filePath));
|
|
3768
|
+
return image ? genExport(image.filePath, [{ name: image.export, as: "default" }]) : 'export default "img"';
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3771
|
+
return templates;
|
|
3772
|
+
}
|
|
3773
|
+
function addTemplates(options, nuxt, resolve) {
|
|
3774
|
+
const templates = getTemplates(options, nuxt.options.appConfig.ui, nuxt);
|
|
3775
|
+
for (const template of templates) {
|
|
3776
|
+
if (template.filename.endsWith(".d.ts"))
|
|
3777
|
+
addTypeTemplate(template);
|
|
3778
|
+
else
|
|
3779
|
+
addTemplate(template);
|
|
3780
|
+
}
|
|
3781
|
+
nuxt.hook("prepare:types", ({ references }) => {
|
|
3782
|
+
references.push({ path: resolve("./runtime/types/app.config.d.ts") });
|
|
3783
|
+
references.push({ path: resolve("./runtime/types/unocss.d.ts") });
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
export { addTemplates as a, getTemplates as g, name as n, version as v };
|