@nuxt/ui 3.0.0-alpha.7 → 3.0.0-alpha.8
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/.nuxt/ui/accordion.ts +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/command-palette.ts +40 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +43 -0
- package/.nuxt/ui/input-menu.ts +411 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +321 -0
- package/.nuxt/ui/select.ts +314 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +128 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/cli/templates.mjs +1 -1
- package/dist/chunks/component-meta.cjs +73264 -0
- package/dist/chunks/component-meta.mjs +73262 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/Bj9hdafK.js +1 -0
- package/dist/client/devtools/_nuxt/DM3_wAgz.js +62 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +24 -0
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +1 -0
- package/dist/client/devtools/_nuxt/hKiujHsR.js +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +53 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +222 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +10 -0
- package/dist/module.d.ts +10 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +157 -2763
- package/dist/runtime/components/Accordion.vue +32 -1
- package/dist/runtime/components/Alert.vue +4 -0
- package/dist/runtime/components/App.vue +8 -0
- package/dist/runtime/components/Avatar.vue +23 -5
- package/dist/runtime/components/AvatarGroup.vue +3 -0
- package/dist/runtime/components/Badge.vue +33 -3
- package/dist/runtime/components/Breadcrumb.vue +25 -1
- package/dist/runtime/components/Button.vue +6 -1
- package/dist/runtime/components/ButtonGroup.vue +4 -1
- package/dist/runtime/components/Card.vue +3 -0
- package/dist/runtime/components/Carousel.vue +7 -2
- package/dist/runtime/components/Checkbox.vue +4 -0
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +3 -0
- package/dist/runtime/components/CommandPalette.vue +3 -1
- package/dist/runtime/components/Container.vue +3 -0
- package/dist/runtime/components/ContextMenu.vue +64 -3
- package/dist/runtime/components/ContextMenuContent.vue +8 -8
- package/dist/runtime/components/Drawer.vue +3 -0
- package/dist/runtime/components/DropdownMenu.vue +52 -3
- package/dist/runtime/components/DropdownMenuContent.vue +8 -8
- package/dist/runtime/components/Form.vue +3 -0
- package/dist/runtime/components/FormField.vue +3 -0
- package/dist/runtime/components/Input.vue +1 -0
- package/dist/runtime/components/InputMenu.vue +23 -12
- package/dist/runtime/components/Kbd.vue +2 -0
- package/dist/runtime/components/Link.vue +50 -1
- package/dist/runtime/components/Modal.vue +3 -0
- package/dist/runtime/components/NavigationMenu.vue +91 -44
- package/dist/runtime/components/Pagination.vue +5 -1
- package/dist/runtime/components/Popover.vue +3 -0
- package/dist/runtime/components/Progress.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +4 -1
- package/dist/runtime/components/Select.vue +24 -13
- package/dist/runtime/components/SelectMenu.vue +29 -17
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Skeleton.vue +3 -0
- package/dist/runtime/components/Slideover.vue +3 -0
- package/dist/runtime/components/Slider.vue +1 -1
- package/dist/runtime/components/Switch.vue +5 -1
- package/dist/runtime/components/Table.vue +16 -7
- package/dist/runtime/components/Tabs.vue +20 -1
- package/dist/runtime/components/Toast.vue +4 -0
- package/dist/runtime/components/Toaster.vue +7 -0
- package/dist/runtime/components/Tooltip.vue +3 -0
- package/dist/runtime/composables/defineShortcuts.js +0 -6
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/types/utils.d.ts +7 -0
- package/dist/runtime/utils/index.js +1 -1
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +195 -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 +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.BU7wzH0D.cjs +2872 -0
- package/dist/shared/ui.BufKhDiD.mjs +2865 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +47 -0
- package/dist/unplugin.d.mts +47 -0
- package/dist/unplugin.d.ts +47 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +68 -30
- package/vue-plugin.d.ts +5 -0
- package/cli/node_modules/.ignored/citty/LICENSE +0 -36
- package/cli/node_modules/.ignored/citty/README.md +0 -134
- package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
- package/cli/node_modules/.ignored/citty/package.json +0 -49
- package/cli/node_modules/.ignored/consola/LICENSE +0 -47
- package/cli/node_modules/.ignored/consola/README.md +0 -318
- package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
- package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
- package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
- package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
- package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
- package/cli/node_modules/.ignored/consola/package.json +0 -101
- package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
- package/cli/node_modules/.ignored/pathe/README.md +0 -69
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
- package/cli/node_modules/.ignored/pathe/package.json +0 -48
- package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/scule/LICENSE +0 -21
- package/cli/node_modules/.ignored/scule/README.md +0 -149
- package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
- package/cli/node_modules/.ignored/scule/package.json +0 -43
- package/cli/node_modules/.package-lock.json +0 -33
|
@@ -0,0 +1,2865 @@
|
|
|
1
|
+
import { pick } from '../../dist/runtime/utils/index.js';
|
|
2
|
+
import 'node:url';
|
|
3
|
+
import { kebabCase } from 'scule';
|
|
4
|
+
import { addTypeTemplate, addTemplate } from '@nuxt/kit';
|
|
5
|
+
import { defuFn, defu } from 'defu';
|
|
6
|
+
|
|
7
|
+
const icons = {
|
|
8
|
+
chevronDoubleLeft: "i-lucide-chevrons-left",
|
|
9
|
+
chevronDoubleRight: "i-lucide-chevrons-right",
|
|
10
|
+
chevronDown: "i-lucide-chevron-down",
|
|
11
|
+
chevronLeft: "i-lucide-chevron-left",
|
|
12
|
+
chevronRight: "i-lucide-chevron-right",
|
|
13
|
+
arrowLeft: "i-lucide-arrow-left",
|
|
14
|
+
arrowRight: "i-lucide-arrow-right",
|
|
15
|
+
check: "i-lucide-check",
|
|
16
|
+
close: "i-lucide-x",
|
|
17
|
+
ellipsis: "i-lucide-ellipsis",
|
|
18
|
+
external: "i-lucide-arrow-up-right",
|
|
19
|
+
loading: "i-lucide-refresh-ccw",
|
|
20
|
+
minus: "i-lucide-minus",
|
|
21
|
+
search: "i-lucide-search"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getDefaultUiConfig = (colors) => ({
|
|
25
|
+
colors: pick({
|
|
26
|
+
primary: "green",
|
|
27
|
+
secondary: "blue",
|
|
28
|
+
success: "green",
|
|
29
|
+
info: "blue",
|
|
30
|
+
warning: "yellow",
|
|
31
|
+
error: "red",
|
|
32
|
+
neutral: "slate"
|
|
33
|
+
}, [...colors || [], "neutral"]),
|
|
34
|
+
icons
|
|
35
|
+
});
|
|
36
|
+
const defaultOptions = {
|
|
37
|
+
prefix: "U",
|
|
38
|
+
fonts: true,
|
|
39
|
+
colorMode: true,
|
|
40
|
+
theme: {
|
|
41
|
+
colors: void 0,
|
|
42
|
+
transitions: true
|
|
43
|
+
},
|
|
44
|
+
devtools: {
|
|
45
|
+
enabled: true
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const resolveColors = (colors) => {
|
|
49
|
+
return colors?.length ? [.../* @__PURE__ */ new Set(["primary", ...colors])] : ["primary", "secondary", "success", "info", "warning", "error"];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const accordion = {
|
|
53
|
+
slots: {
|
|
54
|
+
root: "w-full",
|
|
55
|
+
item: "border-b border-[var(--ui-border)] last:border-b-0",
|
|
56
|
+
header: "flex",
|
|
57
|
+
trigger: "group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-[var(--ui-primary)] min-w-0",
|
|
58
|
+
content: "data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none",
|
|
59
|
+
body: "text-sm pb-3.5",
|
|
60
|
+
leadingIcon: "shrink-0 size-5",
|
|
61
|
+
trailingIcon: "shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
62
|
+
label: "text-start break-words"
|
|
63
|
+
},
|
|
64
|
+
variants: {
|
|
65
|
+
disabled: {
|
|
66
|
+
true: {
|
|
67
|
+
trigger: "cursor-not-allowed opacity-75"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const alert = (options) => ({
|
|
74
|
+
slots: {
|
|
75
|
+
root: "relative overflow-hidden w-full rounded-[calc(var(--ui-radius)*2)] p-4 flex gap-2.5",
|
|
76
|
+
wrapper: "min-w-0 flex-1 flex flex-col gap-1",
|
|
77
|
+
title: "text-sm font-medium",
|
|
78
|
+
description: "text-sm opacity-90",
|
|
79
|
+
icon: "shrink-0 size-5",
|
|
80
|
+
avatar: "shrink-0",
|
|
81
|
+
avatarSize: "2xl",
|
|
82
|
+
actions: "flex gap-1.5 shrink-0",
|
|
83
|
+
close: "p-0.5"
|
|
84
|
+
},
|
|
85
|
+
variants: {
|
|
86
|
+
color: {
|
|
87
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
88
|
+
neutral: ""
|
|
89
|
+
},
|
|
90
|
+
variant: {
|
|
91
|
+
solid: "",
|
|
92
|
+
outline: "",
|
|
93
|
+
soft: "",
|
|
94
|
+
subtle: ""
|
|
95
|
+
},
|
|
96
|
+
multiline: {
|
|
97
|
+
true: {
|
|
98
|
+
root: "items-start",
|
|
99
|
+
actions: "items-start mt-1"
|
|
100
|
+
},
|
|
101
|
+
false: {
|
|
102
|
+
root: "items-center",
|
|
103
|
+
actions: "items-center"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
108
|
+
color,
|
|
109
|
+
variant: "solid",
|
|
110
|
+
class: {
|
|
111
|
+
root: `bg-[var(--ui-${color})] text-[var(--ui-bg)]`
|
|
112
|
+
}
|
|
113
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
114
|
+
color,
|
|
115
|
+
variant: "outline",
|
|
116
|
+
class: {
|
|
117
|
+
root: `text-[var(--ui-${color})] ring ring-inset ring-[var(--ui-${color})]/25`
|
|
118
|
+
}
|
|
119
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
120
|
+
color,
|
|
121
|
+
variant: "soft",
|
|
122
|
+
class: {
|
|
123
|
+
root: `bg-[var(--ui-${color})]/10 text-[var(--ui-${color})]`
|
|
124
|
+
}
|
|
125
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
126
|
+
color,
|
|
127
|
+
variant: "subtle",
|
|
128
|
+
class: {
|
|
129
|
+
root: `bg-[var(--ui-${color})]/10 text-[var(--ui-${color})] ring ring-inset ring-[var(--ui-${color})]/25`
|
|
130
|
+
}
|
|
131
|
+
})), {
|
|
132
|
+
color: "neutral",
|
|
133
|
+
variant: "solid",
|
|
134
|
+
class: {
|
|
135
|
+
root: "text-[var(--ui-bg)] bg-[var(--ui-bg-inverted)]"
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
color: "neutral",
|
|
139
|
+
variant: "outline",
|
|
140
|
+
class: {
|
|
141
|
+
root: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg)] ring ring-inset ring-[var(--ui-border)]"
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
color: "neutral",
|
|
145
|
+
variant: "soft",
|
|
146
|
+
class: {
|
|
147
|
+
root: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg-elevated)]/50"
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
color: "neutral",
|
|
151
|
+
variant: "subtle",
|
|
152
|
+
class: {
|
|
153
|
+
root: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg-elevated)]/50 ring ring-inset ring-[var(--ui-border-accented)]"
|
|
154
|
+
}
|
|
155
|
+
}],
|
|
156
|
+
defaultVariants: {
|
|
157
|
+
color: "primary",
|
|
158
|
+
variant: "solid"
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const avatar = {
|
|
163
|
+
slots: {
|
|
164
|
+
root: "inline-flex items-center justify-center shrink-0 select-none overflow-hidden rounded-full align-middle bg-[var(--ui-bg-elevated)]",
|
|
165
|
+
image: "h-full w-full rounded-[inherit] object-cover",
|
|
166
|
+
fallback: "font-medium leading-none text-[var(--ui-text-muted)] truncate",
|
|
167
|
+
icon: "text-[var(--ui-text-muted)] shrink-0"
|
|
168
|
+
},
|
|
169
|
+
variants: {
|
|
170
|
+
size: {
|
|
171
|
+
"3xs": {
|
|
172
|
+
root: "size-4 text-[8px]"
|
|
173
|
+
},
|
|
174
|
+
"2xs": {
|
|
175
|
+
root: "size-5 text-[10px]"
|
|
176
|
+
},
|
|
177
|
+
"xs": {
|
|
178
|
+
root: "size-6 text-xs"
|
|
179
|
+
},
|
|
180
|
+
"sm": {
|
|
181
|
+
root: "size-7 text-sm"
|
|
182
|
+
},
|
|
183
|
+
"md": {
|
|
184
|
+
root: "size-8 text-base"
|
|
185
|
+
},
|
|
186
|
+
"lg": {
|
|
187
|
+
root: "size-9 text-lg"
|
|
188
|
+
},
|
|
189
|
+
"xl": {
|
|
190
|
+
root: "size-10 text-xl"
|
|
191
|
+
},
|
|
192
|
+
"2xl": {
|
|
193
|
+
root: "size-11 text-[22px]"
|
|
194
|
+
},
|
|
195
|
+
"3xl": {
|
|
196
|
+
root: "size-12 text-2xl"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
defaultVariants: {
|
|
201
|
+
size: "md"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const avatarGroup = {
|
|
206
|
+
slots: {
|
|
207
|
+
root: "inline-flex flex-row-reverse justify-end",
|
|
208
|
+
base: "relative rounded-full ring-[var(--ui-bg)] first:me-0"
|
|
209
|
+
},
|
|
210
|
+
variants: {
|
|
211
|
+
size: {
|
|
212
|
+
"3xs": {
|
|
213
|
+
base: "ring -me-0.5"
|
|
214
|
+
},
|
|
215
|
+
"2xs": {
|
|
216
|
+
base: "ring -me-0.5"
|
|
217
|
+
},
|
|
218
|
+
"xs": {
|
|
219
|
+
base: "ring -me-0.5"
|
|
220
|
+
},
|
|
221
|
+
"sm": {
|
|
222
|
+
base: "ring-2 -me-1.5"
|
|
223
|
+
},
|
|
224
|
+
"md": {
|
|
225
|
+
base: "ring-2 -me-1.5"
|
|
226
|
+
},
|
|
227
|
+
"lg": {
|
|
228
|
+
base: "ring-2 -me-1.5"
|
|
229
|
+
},
|
|
230
|
+
"xl": {
|
|
231
|
+
base: "ring-3 -me-2"
|
|
232
|
+
},
|
|
233
|
+
"2xl": {
|
|
234
|
+
base: "ring-3 -me-2"
|
|
235
|
+
},
|
|
236
|
+
"3xl": {
|
|
237
|
+
base: "ring-3 -me-2"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
defaultVariants: {
|
|
242
|
+
size: "md"
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const badge = (options) => ({
|
|
247
|
+
slots: {
|
|
248
|
+
base: "rounded-[calc(var(--ui-radius)*1.5)] font-medium inline-flex items-center",
|
|
249
|
+
label: "truncate",
|
|
250
|
+
leadingIcon: "shrink-0",
|
|
251
|
+
leadingAvatar: "shrink-0",
|
|
252
|
+
leadingAvatarSize: "",
|
|
253
|
+
trailingIcon: "shrink-0"
|
|
254
|
+
},
|
|
255
|
+
variants: {
|
|
256
|
+
color: {
|
|
257
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
258
|
+
neutral: ""
|
|
259
|
+
},
|
|
260
|
+
variant: {
|
|
261
|
+
solid: "",
|
|
262
|
+
outline: "",
|
|
263
|
+
soft: "",
|
|
264
|
+
subtle: ""
|
|
265
|
+
},
|
|
266
|
+
size: {
|
|
267
|
+
sm: {
|
|
268
|
+
base: "text-xs px-1.5 py-0.5 gap-1",
|
|
269
|
+
leadingIcon: "size-4",
|
|
270
|
+
leadingAvatarSize: "3xs",
|
|
271
|
+
trailingIcon: "size-4"
|
|
272
|
+
},
|
|
273
|
+
md: {
|
|
274
|
+
base: "text-xs px-2 py-1 gap-1",
|
|
275
|
+
leadingIcon: "size-4",
|
|
276
|
+
leadingAvatarSize: "3xs",
|
|
277
|
+
trailingIcon: "size-4"
|
|
278
|
+
},
|
|
279
|
+
lg: {
|
|
280
|
+
base: "text-sm px-2 py-1 gap-1.5",
|
|
281
|
+
leadingIcon: "size-5",
|
|
282
|
+
leadingAvatarSize: "2xs",
|
|
283
|
+
trailingIcon: "size-5"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
288
|
+
color,
|
|
289
|
+
variant: "solid",
|
|
290
|
+
class: `bg-[var(--ui-${color})] text-[var(--ui-bg)]`
|
|
291
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
292
|
+
color,
|
|
293
|
+
variant: "outline",
|
|
294
|
+
class: `text-[var(--ui-${color})] ring ring-inset ring-[var(--ui-${color})]/50`
|
|
295
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
296
|
+
color,
|
|
297
|
+
variant: "soft",
|
|
298
|
+
class: `bg-[var(--ui-${color})]/10 text-[var(--ui-${color})]`
|
|
299
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
300
|
+
color,
|
|
301
|
+
variant: "subtle",
|
|
302
|
+
class: `bg-[var(--ui-${color})]/10 text-[var(--ui-${color})] ring ring-inset ring-[var(--ui-${color})]/25`
|
|
303
|
+
})), {
|
|
304
|
+
color: "neutral",
|
|
305
|
+
variant: "solid",
|
|
306
|
+
class: "text-[var(--ui-bg)] bg-[var(--ui-bg-inverted)]"
|
|
307
|
+
}, {
|
|
308
|
+
color: "neutral",
|
|
309
|
+
variant: "outline",
|
|
310
|
+
class: "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg)]"
|
|
311
|
+
}, {
|
|
312
|
+
color: "neutral",
|
|
313
|
+
variant: "soft",
|
|
314
|
+
class: "text-[var(--ui-text)] bg-[var(--ui-bg-elevated)]"
|
|
315
|
+
}, {
|
|
316
|
+
color: "neutral",
|
|
317
|
+
variant: "subtle",
|
|
318
|
+
class: "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg-elevated)]"
|
|
319
|
+
}],
|
|
320
|
+
defaultVariants: {
|
|
321
|
+
color: "primary",
|
|
322
|
+
variant: "solid",
|
|
323
|
+
size: "md"
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
const breadcrumb = (options) => ({
|
|
328
|
+
slots: {
|
|
329
|
+
root: "relative min-w-0",
|
|
330
|
+
list: "flex items-center gap-1.5",
|
|
331
|
+
item: "flex min-w-0",
|
|
332
|
+
link: "group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-[var(--ui-primary)]",
|
|
333
|
+
linkLeadingIcon: "shrink-0 size-5",
|
|
334
|
+
linkLeadingAvatar: "shrink-0",
|
|
335
|
+
linkLeadingAvatarSize: "2xs",
|
|
336
|
+
linkLabel: "truncate",
|
|
337
|
+
separator: "flex",
|
|
338
|
+
separatorIcon: "shrink-0 size-5 text-[var(--ui-text-muted)]"
|
|
339
|
+
},
|
|
340
|
+
variants: {
|
|
341
|
+
active: {
|
|
342
|
+
true: {
|
|
343
|
+
link: "text-[var(--ui-primary)] font-semibold"
|
|
344
|
+
},
|
|
345
|
+
false: {
|
|
346
|
+
link: "text-[var(--ui-text-muted)] font-medium"
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
disabled: {
|
|
350
|
+
true: {
|
|
351
|
+
link: "cursor-not-allowed opacity-75"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
to: {
|
|
355
|
+
true: ""
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
compoundVariants: [{
|
|
359
|
+
disabled: false,
|
|
360
|
+
active: false,
|
|
361
|
+
to: true,
|
|
362
|
+
class: {
|
|
363
|
+
link: ["hover:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
364
|
+
}
|
|
365
|
+
}]
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
const buttonGroupVariant = {
|
|
369
|
+
buttonGroup: {
|
|
370
|
+
horizontal: "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none",
|
|
371
|
+
vertical: "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none"
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const buttonGroupVariantWithRoot = {
|
|
375
|
+
buttonGroup: {
|
|
376
|
+
horizontal: {
|
|
377
|
+
root: "group",
|
|
378
|
+
base: "group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"
|
|
379
|
+
},
|
|
380
|
+
vertical: {
|
|
381
|
+
root: "group",
|
|
382
|
+
base: "group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const buttonGroup = {
|
|
387
|
+
base: "relative",
|
|
388
|
+
variants: {
|
|
389
|
+
size: {
|
|
390
|
+
xs: "",
|
|
391
|
+
sm: "",
|
|
392
|
+
md: "",
|
|
393
|
+
lg: "",
|
|
394
|
+
xl: ""
|
|
395
|
+
},
|
|
396
|
+
orientation: {
|
|
397
|
+
horizontal: "inline-flex -space-x-px",
|
|
398
|
+
vertical: "flex flex-col -space-y-px"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const button = (options) => ({
|
|
404
|
+
slots: {
|
|
405
|
+
base: ["rounded-[calc(var(--ui-radius)*1.5)] font-medium inline-flex items-center focus:outline-none disabled:cursor-not-allowed aria-disabled:cursor-not-allowed disabled:opacity-75 aria-disabled:opacity-75", options.theme.transitions && "transition-colors"],
|
|
406
|
+
label: "truncate",
|
|
407
|
+
leadingIcon: "shrink-0",
|
|
408
|
+
leadingAvatar: "shrink-0",
|
|
409
|
+
leadingAvatarSize: "",
|
|
410
|
+
trailingIcon: "shrink-0"
|
|
411
|
+
},
|
|
412
|
+
variants: {
|
|
413
|
+
...buttonGroupVariant,
|
|
414
|
+
color: {
|
|
415
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
416
|
+
neutral: ""
|
|
417
|
+
},
|
|
418
|
+
variant: {
|
|
419
|
+
solid: "",
|
|
420
|
+
outline: "",
|
|
421
|
+
soft: "",
|
|
422
|
+
subtle: "",
|
|
423
|
+
ghost: "",
|
|
424
|
+
link: ""
|
|
425
|
+
},
|
|
426
|
+
size: {
|
|
427
|
+
xs: {
|
|
428
|
+
base: "px-2 py-1 text-xs gap-1",
|
|
429
|
+
leadingIcon: "size-4",
|
|
430
|
+
leadingAvatarSize: "3xs",
|
|
431
|
+
trailingIcon: "size-4"
|
|
432
|
+
},
|
|
433
|
+
sm: {
|
|
434
|
+
base: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
435
|
+
leadingIcon: "size-4",
|
|
436
|
+
leadingAvatarSize: "3xs",
|
|
437
|
+
trailingIcon: "size-4"
|
|
438
|
+
},
|
|
439
|
+
md: {
|
|
440
|
+
base: "px-2.5 py-1.5 text-sm gap-1.5",
|
|
441
|
+
leadingIcon: "size-5",
|
|
442
|
+
leadingAvatarSize: "2xs",
|
|
443
|
+
trailingIcon: "size-5"
|
|
444
|
+
},
|
|
445
|
+
lg: {
|
|
446
|
+
base: "px-3 py-2 text-sm gap-2",
|
|
447
|
+
leadingIcon: "size-5",
|
|
448
|
+
leadingAvatarSize: "2xs",
|
|
449
|
+
trailingIcon: "size-5"
|
|
450
|
+
},
|
|
451
|
+
xl: {
|
|
452
|
+
base: "px-3 py-2 text-base gap-2",
|
|
453
|
+
leadingIcon: "size-6",
|
|
454
|
+
leadingAvatarSize: "xs",
|
|
455
|
+
trailingIcon: "size-6"
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
block: {
|
|
459
|
+
true: {
|
|
460
|
+
base: "w-full justify-center",
|
|
461
|
+
leadingAvatarSize: "xs",
|
|
462
|
+
trailingIcon: "ms-auto"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
square: {
|
|
466
|
+
true: ""
|
|
467
|
+
},
|
|
468
|
+
leading: {
|
|
469
|
+
true: ""
|
|
470
|
+
},
|
|
471
|
+
trailing: {
|
|
472
|
+
true: ""
|
|
473
|
+
},
|
|
474
|
+
loading: {
|
|
475
|
+
true: ""
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
479
|
+
color,
|
|
480
|
+
variant: "solid",
|
|
481
|
+
class: `text-[var(--ui-bg)] bg-[var(--ui-${color})] hover:bg-[var(--ui-${color})]/75 disabled:bg-[var(--ui-${color})] aria-disabled:bg-[var(--ui-${color})] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-${color})]`
|
|
482
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
483
|
+
color,
|
|
484
|
+
variant: "outline",
|
|
485
|
+
class: `ring ring-inset ring-[var(--ui-${color})]/50 text-[var(--ui-${color})] hover:bg-[var(--ui-${color})]/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent focus-visible:ring-2 focus-visible:ring-[var(--ui-${color})]`
|
|
486
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
487
|
+
color,
|
|
488
|
+
variant: "soft",
|
|
489
|
+
class: `text-[var(--ui-${color})] bg-[var(--ui-${color})]/10 hover:bg-[var(--ui-${color})]/15 focus-visible:bg-[var(--ui-${color})]/15 disabled:bg-[var(--ui-${color})]/10 aria-disabled:bg-[var(--ui-${color})]/10`
|
|
490
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
491
|
+
color,
|
|
492
|
+
variant: "subtle",
|
|
493
|
+
class: `text-[var(--ui-${color})] ring ring-inset ring-[var(--ui-${color})]/25 bg-[var(--ui-${color})]/10 hover:bg-[var(--ui-${color})]/15 disabled:bg-[var(--ui-${color})]/10 aria-disabled:bg-[var(--ui-${color})]/10 focus-visible:ring-2 focus-visible:ring-[var(--ui-${color})]`
|
|
494
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
495
|
+
color,
|
|
496
|
+
variant: "ghost",
|
|
497
|
+
class: `text-[var(--ui-${color})] hover:bg-[var(--ui-${color})]/10 focus-visible:bg-[var(--ui-${color})]/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent`
|
|
498
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
499
|
+
color,
|
|
500
|
+
variant: "link",
|
|
501
|
+
class: `text-[var(--ui-${color})] hover:text-[var(--ui-${color})]/75 disabled:text-[var(--ui-${color})] aria-disabled:text-[var(--ui-${color})] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-${color})]`
|
|
502
|
+
})), {
|
|
503
|
+
color: "neutral",
|
|
504
|
+
variant: "solid",
|
|
505
|
+
class: "text-[var(--ui-bg)] bg-[var(--ui-bg-inverted)] hover:bg-[var(--ui-bg-inverted)]/80 disabled:bg-[var(--ui-bg-inverted)] aria-disabled:bg-[var(--ui-bg-inverted)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-border-inverted)]"
|
|
506
|
+
}, {
|
|
507
|
+
color: "neutral",
|
|
508
|
+
variant: "outline",
|
|
509
|
+
class: "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg)] hover:bg-[var(--ui-bg-elevated)] disabled:bg-[var(--ui-bg)] aria-disabled:bg-[var(--ui-bg)] focus-visible:ring-2 focus-visible:ring-[var(--ui-border-inverted)]"
|
|
510
|
+
}, {
|
|
511
|
+
color: "neutral",
|
|
512
|
+
variant: "soft",
|
|
513
|
+
class: "text-[var(--ui-text)] bg-[var(--ui-bg-elevated)] hover:bg-[var(--ui-bg-accented)]/75 focus-visible:bg-[var(--ui-bg-accented)]/75 disabled:bg-[var(--ui-bg-elevated)] aria-disabled:bg-[var(--ui-bg-elevated)]"
|
|
514
|
+
}, {
|
|
515
|
+
color: "neutral",
|
|
516
|
+
variant: "subtle",
|
|
517
|
+
class: "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg-elevated)] hover:bg-[var(--ui-bg-accented)]/75 disabled:bg-[var(--ui-bg-elevated)] aria-disabled:bg-[var(--ui-bg-elevated)] focus-visible:ring-2 focus-visible:ring-[var(--ui-border-inverted)]"
|
|
518
|
+
}, {
|
|
519
|
+
color: "neutral",
|
|
520
|
+
variant: "ghost",
|
|
521
|
+
class: "text-[var(--ui-text)] hover:bg-[var(--ui-bg-elevated)] focus-visible:bg-[var(--ui-bg-elevated)] hover:disabled:bg-transparent dark:hover:disabled:bg-transparent hover:aria-disabled:bg-transparent dark:hover:aria-disabled:bg-transparent"
|
|
522
|
+
}, {
|
|
523
|
+
color: "neutral",
|
|
524
|
+
variant: "link",
|
|
525
|
+
class: "text-[var(--ui-text-muted)] hover:text-[var(--ui-text)] disabled:text-[var(--ui-text-muted)] aria-disabled:text-[var(--ui-text-muted)] focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-[var(--ui-border-inverted)]"
|
|
526
|
+
}, {
|
|
527
|
+
size: "xs",
|
|
528
|
+
square: true,
|
|
529
|
+
class: "p-1"
|
|
530
|
+
}, {
|
|
531
|
+
size: "sm",
|
|
532
|
+
square: true,
|
|
533
|
+
class: "p-1.5"
|
|
534
|
+
}, {
|
|
535
|
+
size: "md",
|
|
536
|
+
square: true,
|
|
537
|
+
class: "p-1.5"
|
|
538
|
+
}, {
|
|
539
|
+
size: "lg",
|
|
540
|
+
square: true,
|
|
541
|
+
class: "p-2"
|
|
542
|
+
}, {
|
|
543
|
+
size: "xl",
|
|
544
|
+
square: true,
|
|
545
|
+
class: "p-2"
|
|
546
|
+
}, {
|
|
547
|
+
loading: true,
|
|
548
|
+
leading: true,
|
|
549
|
+
class: {
|
|
550
|
+
leadingIcon: "animate-spin"
|
|
551
|
+
}
|
|
552
|
+
}, {
|
|
553
|
+
loading: true,
|
|
554
|
+
leading: false,
|
|
555
|
+
trailing: true,
|
|
556
|
+
class: {
|
|
557
|
+
trailingIcon: "animate-spin"
|
|
558
|
+
}
|
|
559
|
+
}],
|
|
560
|
+
defaultVariants: {
|
|
561
|
+
color: "primary",
|
|
562
|
+
variant: "solid",
|
|
563
|
+
size: "md"
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
const card = {
|
|
568
|
+
slots: {
|
|
569
|
+
root: "bg-[var(--ui-bg)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] rounded-[calc(var(--ui-radius)*2)] shadow",
|
|
570
|
+
header: "p-4 sm:px-6",
|
|
571
|
+
body: "p-4 sm:p-6",
|
|
572
|
+
footer: "p-4 sm:px-6"
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
const carousel = (options) => ({
|
|
577
|
+
slots: {
|
|
578
|
+
root: "relative focus:outline-none",
|
|
579
|
+
viewport: "overflow-hidden",
|
|
580
|
+
container: "flex items-start",
|
|
581
|
+
item: "min-w-0 shrink-0 basis-full",
|
|
582
|
+
controls: "",
|
|
583
|
+
arrows: "",
|
|
584
|
+
prev: "absolute rounded-full",
|
|
585
|
+
next: "absolute rounded-full",
|
|
586
|
+
dots: "absolute inset-x-0 -bottom-7 flex flex-wrap items-center justify-center gap-3",
|
|
587
|
+
dot: ["cursor-pointer size-3 bg-[var(--ui-border-accented)] rounded-full", options.theme.transitions && "transition"]
|
|
588
|
+
},
|
|
589
|
+
variants: {
|
|
590
|
+
orientation: {
|
|
591
|
+
vertical: {
|
|
592
|
+
container: "flex-col -mt-4",
|
|
593
|
+
item: "pt-4",
|
|
594
|
+
prev: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
595
|
+
next: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90"
|
|
596
|
+
},
|
|
597
|
+
horizontal: {
|
|
598
|
+
container: "flex-row -ms-4",
|
|
599
|
+
item: "ps-4",
|
|
600
|
+
prev: "-start-12 top-1/2 -translate-y-1/2",
|
|
601
|
+
next: "-end-12 top-1/2 -translate-y-1/2"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
active: {
|
|
605
|
+
true: {
|
|
606
|
+
dot: "bg-[var(--ui-border-inverted)]"
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
defaultVariants: {
|
|
611
|
+
orientation: "horizontal"
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
const checkbox = (options) => ({
|
|
616
|
+
slots: {
|
|
617
|
+
root: "relative flex items-start",
|
|
618
|
+
base: "shrink-0 flex items-center justify-center rounded-[var(--ui-radius)] text-[var(--ui-bg)] ring ring-inset ring-[var(--ui-border-accented)] focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
619
|
+
container: "flex items-center",
|
|
620
|
+
wrapper: "ms-2",
|
|
621
|
+
icon: "shrink-0 size-full",
|
|
622
|
+
label: "block font-medium text-[var(--ui-text)]",
|
|
623
|
+
description: "text-[var(--ui-text-muted)]"
|
|
624
|
+
},
|
|
625
|
+
variants: {
|
|
626
|
+
color: {
|
|
627
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, `focus-visible:outline-[var(--ui-${color})]`])),
|
|
628
|
+
neutral: "focus-visible:outline-[var(--ui-border-inverted)]"
|
|
629
|
+
},
|
|
630
|
+
size: {
|
|
631
|
+
xs: {
|
|
632
|
+
base: "size-3",
|
|
633
|
+
container: "h-4",
|
|
634
|
+
wrapper: "text-xs"
|
|
635
|
+
},
|
|
636
|
+
sm: {
|
|
637
|
+
base: "size-3.5",
|
|
638
|
+
container: "h-4",
|
|
639
|
+
wrapper: "text-xs"
|
|
640
|
+
},
|
|
641
|
+
md: {
|
|
642
|
+
base: "size-4",
|
|
643
|
+
container: "h-5",
|
|
644
|
+
wrapper: "text-sm"
|
|
645
|
+
},
|
|
646
|
+
lg: {
|
|
647
|
+
base: "size-4.5",
|
|
648
|
+
container: "h-5",
|
|
649
|
+
wrapper: "text-sm"
|
|
650
|
+
},
|
|
651
|
+
xl: {
|
|
652
|
+
base: "size-5",
|
|
653
|
+
container: "h-6",
|
|
654
|
+
wrapper: "text-base"
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
required: {
|
|
658
|
+
true: {
|
|
659
|
+
label: "after:content-['*'] after:ms-0.5 after:text-[var(--ui-error)]"
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
disabled: {
|
|
663
|
+
true: {
|
|
664
|
+
base: "cursor-not-allowed opacity-75",
|
|
665
|
+
label: "cursor-not-allowed opacity-75",
|
|
666
|
+
description: "cursor-not-allowed opacity-75"
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
checked: {
|
|
670
|
+
true: ""
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
674
|
+
color,
|
|
675
|
+
checked: true,
|
|
676
|
+
class: `ring-2 ring-[var(--ui-${color})] bg-[var(--ui-${color})]`
|
|
677
|
+
})), {
|
|
678
|
+
color: "neutral",
|
|
679
|
+
checked: true,
|
|
680
|
+
class: "ring-2 ring-[var(--ui-border-inverted)] bg-[var(--ui-bg-inverted)]"
|
|
681
|
+
}],
|
|
682
|
+
defaultVariants: {
|
|
683
|
+
size: "md",
|
|
684
|
+
color: "primary"
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
const chip = (options) => ({
|
|
689
|
+
slots: {
|
|
690
|
+
root: "relative inline-flex items-center justify-center shrink-0",
|
|
691
|
+
base: "rounded-full ring ring-[var(--ui-bg)] flex items-center justify-center text-[var(--ui-bg)] font-medium whitespace-nowrap"
|
|
692
|
+
},
|
|
693
|
+
variants: {
|
|
694
|
+
color: {
|
|
695
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, `bg-[var(--ui-${color})]`])),
|
|
696
|
+
neutral: "bg-[var(--ui-text-muted)]"
|
|
697
|
+
},
|
|
698
|
+
size: {
|
|
699
|
+
"3xs": "h-[4px] min-w-[4px] text-[4px]",
|
|
700
|
+
"2xs": "h-[5px] min-w-[5px] text-[5px]",
|
|
701
|
+
"xs": "h-[6px] min-w-[6px] text-[6px]",
|
|
702
|
+
"sm": "h-[7px] min-w-[7px] text-[7px]",
|
|
703
|
+
"md": "h-[8px] min-w-[8px] text-[8px]",
|
|
704
|
+
"lg": "h-[9px] min-w-[9px] text-[9px]",
|
|
705
|
+
"xl": "h-[10px] min-w-[10px] text-[10px]",
|
|
706
|
+
"2xl": "h-[11px] min-w-[11px] text-[11px]",
|
|
707
|
+
"3xl": "h-[12px] min-w-[12px] text-[12px]"
|
|
708
|
+
},
|
|
709
|
+
position: {
|
|
710
|
+
"top-right": "top-0 right-0",
|
|
711
|
+
"bottom-right": "bottom-0 right-0",
|
|
712
|
+
"top-left": "top-0 left-0",
|
|
713
|
+
"bottom-left": "bottom-0 left-0"
|
|
714
|
+
},
|
|
715
|
+
inset: {
|
|
716
|
+
false: ""
|
|
717
|
+
},
|
|
718
|
+
standalone: {
|
|
719
|
+
false: "absolute"
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
compoundVariants: [{
|
|
723
|
+
position: "top-right",
|
|
724
|
+
inset: false,
|
|
725
|
+
class: "-translate-y-1/2 translate-x-1/2 transform"
|
|
726
|
+
}, {
|
|
727
|
+
position: "bottom-right",
|
|
728
|
+
inset: false,
|
|
729
|
+
class: "translate-y-1/2 translate-x-1/2 transform"
|
|
730
|
+
}, {
|
|
731
|
+
position: "top-left",
|
|
732
|
+
inset: false,
|
|
733
|
+
class: "-translate-y-1/2 -translate-x-1/2 transform"
|
|
734
|
+
}, {
|
|
735
|
+
position: "bottom-left",
|
|
736
|
+
inset: false,
|
|
737
|
+
class: "translate-y-1/2 -translate-x-1/2 transform"
|
|
738
|
+
}],
|
|
739
|
+
defaultVariants: {
|
|
740
|
+
size: "md",
|
|
741
|
+
color: "primary",
|
|
742
|
+
position: "top-right"
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
const collapsible = {
|
|
747
|
+
slots: {
|
|
748
|
+
root: "",
|
|
749
|
+
content: "data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
const commandPalette = (options) => ({
|
|
754
|
+
slots: {
|
|
755
|
+
root: "flex flex-col min-h-0 min-w-0 divide-y divide-[var(--ui-border)]",
|
|
756
|
+
input: "[&>input]:h-12",
|
|
757
|
+
close: "",
|
|
758
|
+
content: "relative overflow-hidden",
|
|
759
|
+
viewport: "divide-y divide-[var(--ui-border)] scroll-py-1",
|
|
760
|
+
group: "p-1 isolate",
|
|
761
|
+
empty: "py-6 text-center text-sm text-[var(--ui-text-muted)]",
|
|
762
|
+
label: "px-2 py-1.5 text-xs font-semibold text-[var(--ui-text-highlighted)]",
|
|
763
|
+
item: ["group relative w-full flex items-center gap-2 px-2 py-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[var(--ui-text)] data-highlighted:text-[var(--ui-text-highlighted)] data-highlighted:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
764
|
+
itemLeadingIcon: ["shrink-0 size-5 text-[var(--ui-text-dimmed)] group-data-highlighted:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"],
|
|
765
|
+
itemLeadingAvatar: "shrink-0",
|
|
766
|
+
itemLeadingAvatarSize: "2xs",
|
|
767
|
+
itemLeadingChip: "shrink-0 size-5",
|
|
768
|
+
itemLeadingChipSize: "md",
|
|
769
|
+
itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
770
|
+
itemTrailingIcon: "shrink-0 size-5",
|
|
771
|
+
itemTrailingHighlightedIcon: "shrink-0 size-5 text-[var(--ui-text-dimmed)] hidden group-data-highlighted:inline-flex",
|
|
772
|
+
itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0 gap-0.5",
|
|
773
|
+
itemTrailingKbdsSize: "md",
|
|
774
|
+
itemLabel: "truncate space-x-1 rtl:space-x-reverse",
|
|
775
|
+
itemLabelBase: "text-[var(--ui-text-highlighted)] [&>mark]:text-[var(--ui-bg)] [&>mark]:bg-[var(--ui-primary)]",
|
|
776
|
+
itemLabelPrefix: "text-[var(--ui-text)]",
|
|
777
|
+
itemLabelSuffix: "text-[var(--ui-text-dimmed)] [&>mark]:text-[var(--ui-bg)] [&>mark]:bg-[var(--ui-primary)]"
|
|
778
|
+
},
|
|
779
|
+
variants: {
|
|
780
|
+
loading: {
|
|
781
|
+
true: {
|
|
782
|
+
itemLeadingIcon: "animate-spin"
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
const container = {
|
|
789
|
+
base: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const contextMenu = (options) => ({
|
|
793
|
+
slots: {
|
|
794
|
+
content: "min-w-32 bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
795
|
+
group: "p-1 isolate",
|
|
796
|
+
label: "w-full flex items-center font-semibold text-[var(--ui-text-highlighted)]",
|
|
797
|
+
separator: "-mx-1 my-1 h-px bg-[var(--ui-border)]",
|
|
798
|
+
item: "group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75",
|
|
799
|
+
itemLeadingIcon: "shrink-0",
|
|
800
|
+
itemLeadingAvatar: "shrink-0",
|
|
801
|
+
itemLeadingAvatarSize: "",
|
|
802
|
+
itemTrailing: "ms-auto inline-flex",
|
|
803
|
+
itemTrailingIcon: "shrink-0",
|
|
804
|
+
itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0",
|
|
805
|
+
itemTrailingKbdsSize: "",
|
|
806
|
+
itemLabel: "truncate",
|
|
807
|
+
itemLabelExternalIcon: "inline-block size-3 align-top text-[var(--ui-text-dimmed)]"
|
|
808
|
+
},
|
|
809
|
+
variants: {
|
|
810
|
+
color: {
|
|
811
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
812
|
+
neutral: ""
|
|
813
|
+
},
|
|
814
|
+
active: {
|
|
815
|
+
true: {
|
|
816
|
+
item: "text-[var(--ui-text-highlighted)] before:bg-[var(--ui-bg-elevated)]",
|
|
817
|
+
itemLeadingIcon: "text-[var(--ui-text)]"
|
|
818
|
+
},
|
|
819
|
+
false: {
|
|
820
|
+
item: ["text-[var(--ui-text)] data-highlighted:text-[var(--ui-text-highlighted)] data-[state=open]:text-[var(--ui-text-highlighted)] data-highlighted:before:bg-[var(--ui-bg-elevated)]/50 data-[state=open]:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
821
|
+
itemLeadingIcon: ["text-[var(--ui-text-dimmed)] group-data-highlighted:text-[var(--ui-text)] group-data-[state=open]:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
loading: {
|
|
825
|
+
true: {
|
|
826
|
+
itemLeadingIcon: "animate-spin"
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
size: {
|
|
830
|
+
xs: {
|
|
831
|
+
label: "p-1 text-xs gap-1",
|
|
832
|
+
item: "p-1 text-xs gap-1",
|
|
833
|
+
itemLeadingIcon: "size-4",
|
|
834
|
+
itemLeadingAvatarSize: "3xs",
|
|
835
|
+
itemTrailingIcon: "size-4",
|
|
836
|
+
itemTrailingKbds: "gap-0.5",
|
|
837
|
+
itemTrailingKbdsSize: "sm"
|
|
838
|
+
},
|
|
839
|
+
sm: {
|
|
840
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
841
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
842
|
+
itemLeadingIcon: "size-4",
|
|
843
|
+
itemLeadingAvatarSize: "3xs",
|
|
844
|
+
itemTrailingIcon: "size-4",
|
|
845
|
+
itemTrailingKbds: "gap-0.5",
|
|
846
|
+
itemTrailingKbdsSize: "sm"
|
|
847
|
+
},
|
|
848
|
+
md: {
|
|
849
|
+
label: "p-1.5 text-sm gap-1.5",
|
|
850
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
851
|
+
itemLeadingIcon: "size-5",
|
|
852
|
+
itemLeadingAvatarSize: "2xs",
|
|
853
|
+
itemTrailingIcon: "size-5",
|
|
854
|
+
itemTrailingKbds: "gap-0.5",
|
|
855
|
+
itemTrailingKbdsSize: "md"
|
|
856
|
+
},
|
|
857
|
+
lg: {
|
|
858
|
+
label: "p-2 text-sm gap-2",
|
|
859
|
+
item: "p-2 text-sm gap-2",
|
|
860
|
+
itemLeadingIcon: "size-5",
|
|
861
|
+
itemLeadingAvatarSize: "2xs",
|
|
862
|
+
itemTrailingIcon: "size-5",
|
|
863
|
+
itemTrailingKbds: "gap-1",
|
|
864
|
+
itemTrailingKbdsSize: "md"
|
|
865
|
+
},
|
|
866
|
+
xl: {
|
|
867
|
+
label: "p-2 text-base gap-2",
|
|
868
|
+
item: "p-2 text-base gap-2",
|
|
869
|
+
itemLeadingIcon: "size-6",
|
|
870
|
+
itemLeadingAvatarSize: "xs",
|
|
871
|
+
itemTrailingIcon: "size-6",
|
|
872
|
+
itemTrailingKbds: "gap-1",
|
|
873
|
+
itemTrailingKbdsSize: "lg"
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
878
|
+
color,
|
|
879
|
+
active: false,
|
|
880
|
+
class: {
|
|
881
|
+
item: `text-[var(--ui-${color})] data-highlighted:text-[var(--ui-${color})] data-highlighted:before:bg-[var(--ui-${color})]/10 data-[state=open]:before:bg-[var(--ui-${color})]/10`,
|
|
882
|
+
itemLeadingIcon: `text-[var(--ui-${color})]/75 group-data-highlighted:text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
|
883
|
+
}
|
|
884
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
885
|
+
color,
|
|
886
|
+
active: true,
|
|
887
|
+
class: {
|
|
888
|
+
item: `text-[var(--ui-${color})] before:bg-[var(--ui-${color})]/10`,
|
|
889
|
+
itemLeadingIcon: `text-[var(--ui-${color})]`
|
|
890
|
+
}
|
|
891
|
+
}))],
|
|
892
|
+
defaultVariants: {
|
|
893
|
+
size: "md"
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
const drawer = {
|
|
898
|
+
slots: {
|
|
899
|
+
overlay: "fixed inset-0 bg-[var(--ui-bg-elevated)]/75",
|
|
900
|
+
content: "fixed bg-[var(--ui-bg)] ring ring-[var(--ui-border)] flex focus:outline-none",
|
|
901
|
+
handle: "shrink-0 rounded-full bg-[var(--ui-bg-accented)]",
|
|
902
|
+
container: "w-full flex flex-col gap-4 p-4 overflow-y-auto",
|
|
903
|
+
header: "",
|
|
904
|
+
title: "text-[var(--ui-text-highlighted)] font-semibold",
|
|
905
|
+
description: "mt-1 text-[var(--ui-text-muted)] text-sm",
|
|
906
|
+
body: "flex-1",
|
|
907
|
+
footer: "flex flex-col gap-1.5"
|
|
908
|
+
},
|
|
909
|
+
variants: {
|
|
910
|
+
direction: {
|
|
911
|
+
top: {
|
|
912
|
+
content: "top-0 mb-24 flex-col-reverse rounded-b-[calc(var(--ui-radius)*2)]",
|
|
913
|
+
handle: "mb-4"
|
|
914
|
+
},
|
|
915
|
+
right: {
|
|
916
|
+
content: "right-4 flex-row",
|
|
917
|
+
handle: "ml-4"
|
|
918
|
+
},
|
|
919
|
+
bottom: {
|
|
920
|
+
content: "bottom-0 mt-24 flex-col rounded-t-[calc(var(--ui-radius)*2)]",
|
|
921
|
+
handle: "mt-4"
|
|
922
|
+
},
|
|
923
|
+
left: {
|
|
924
|
+
content: "left-4 flex-row-reverse",
|
|
925
|
+
handle: "mr-4"
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
compoundVariants: [{
|
|
930
|
+
direction: ["top", "bottom"],
|
|
931
|
+
class: {
|
|
932
|
+
content: "inset-x-0 h-auto max-h-[96%]",
|
|
933
|
+
handle: "w-12 h-1.5 mx-auto"
|
|
934
|
+
}
|
|
935
|
+
}, {
|
|
936
|
+
direction: ["right", "left"],
|
|
937
|
+
class: {
|
|
938
|
+
content: "inset-y-4 w-auto max-w-[calc(100%-2rem)] rounded-[calc(var(--ui-radius)*2)] after:hidden",
|
|
939
|
+
handle: "h-12 w-1.5 mt-auto mb-auto"
|
|
940
|
+
}
|
|
941
|
+
}]
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
const dropdownMenu = (options) => ({
|
|
945
|
+
slots: {
|
|
946
|
+
content: "min-w-32 bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
947
|
+
arrow: "fill-[var(--ui-border)]",
|
|
948
|
+
group: "p-1 isolate",
|
|
949
|
+
label: "w-full flex items-center font-semibold text-[var(--ui-text-highlighted)]",
|
|
950
|
+
separator: "-mx-1 my-1 h-px bg-[var(--ui-border)]",
|
|
951
|
+
item: "group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75",
|
|
952
|
+
itemLeadingIcon: "shrink-0",
|
|
953
|
+
itemLeadingAvatar: "shrink-0",
|
|
954
|
+
itemLeadingAvatarSize: "",
|
|
955
|
+
itemTrailing: "ms-auto inline-flex",
|
|
956
|
+
itemTrailingIcon: "shrink-0",
|
|
957
|
+
itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0",
|
|
958
|
+
itemTrailingKbdsSize: "",
|
|
959
|
+
itemLabel: "truncate",
|
|
960
|
+
itemLabelExternalIcon: "inline-block size-3 align-top text-[var(--ui-text-dimmed)]"
|
|
961
|
+
},
|
|
962
|
+
variants: {
|
|
963
|
+
color: {
|
|
964
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
965
|
+
neutral: ""
|
|
966
|
+
},
|
|
967
|
+
active: {
|
|
968
|
+
true: {
|
|
969
|
+
item: "text-[var(--ui-text-highlighted)] before:bg-[var(--ui-bg-elevated)]",
|
|
970
|
+
itemLeadingIcon: "text-[var(--ui-text)]"
|
|
971
|
+
},
|
|
972
|
+
false: {
|
|
973
|
+
item: ["text-[var(--ui-text)] data-highlighted:text-[var(--ui-text-highlighted)] data-[state=open]:text-[var(--ui-text-highlighted)] data-highlighted:before:bg-[var(--ui-bg-elevated)]/50 data-[state=open]:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
974
|
+
itemLeadingIcon: ["text-[var(--ui-text-dimmed)] group-data-highlighted:text-[var(--ui-text)] group-data-[state=open]:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
loading: {
|
|
978
|
+
true: {
|
|
979
|
+
itemLeadingIcon: "animate-spin"
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
size: {
|
|
983
|
+
xs: {
|
|
984
|
+
label: "p-1 text-xs gap-1",
|
|
985
|
+
item: "p-1 text-xs gap-1",
|
|
986
|
+
itemLeadingIcon: "size-4",
|
|
987
|
+
itemLeadingAvatarSize: "3xs",
|
|
988
|
+
itemTrailingIcon: "size-4",
|
|
989
|
+
itemTrailingKbds: "gap-0.5",
|
|
990
|
+
itemTrailingKbdsSize: "sm"
|
|
991
|
+
},
|
|
992
|
+
sm: {
|
|
993
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
994
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
995
|
+
itemLeadingIcon: "size-4",
|
|
996
|
+
itemLeadingAvatarSize: "3xs",
|
|
997
|
+
itemTrailingIcon: "size-4",
|
|
998
|
+
itemTrailingKbds: "gap-0.5",
|
|
999
|
+
itemTrailingKbdsSize: "sm"
|
|
1000
|
+
},
|
|
1001
|
+
md: {
|
|
1002
|
+
label: "p-1.5 text-sm gap-1.5",
|
|
1003
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
1004
|
+
itemLeadingIcon: "size-5",
|
|
1005
|
+
itemLeadingAvatarSize: "2xs",
|
|
1006
|
+
itemTrailingIcon: "size-5",
|
|
1007
|
+
itemTrailingKbds: "gap-0.5",
|
|
1008
|
+
itemTrailingKbdsSize: "md"
|
|
1009
|
+
},
|
|
1010
|
+
lg: {
|
|
1011
|
+
label: "p-2 text-sm gap-2",
|
|
1012
|
+
item: "p-2 text-sm gap-2",
|
|
1013
|
+
itemLeadingIcon: "size-5",
|
|
1014
|
+
itemLeadingAvatarSize: "2xs",
|
|
1015
|
+
itemTrailingIcon: "size-5",
|
|
1016
|
+
itemTrailingKbds: "gap-1",
|
|
1017
|
+
itemTrailingKbdsSize: "md"
|
|
1018
|
+
},
|
|
1019
|
+
xl: {
|
|
1020
|
+
label: "p-2 text-base gap-2",
|
|
1021
|
+
item: "p-2 text-base gap-2",
|
|
1022
|
+
itemLeadingIcon: "size-6",
|
|
1023
|
+
itemLeadingAvatarSize: "xs",
|
|
1024
|
+
itemTrailingIcon: "size-6",
|
|
1025
|
+
itemTrailingKbds: "gap-1",
|
|
1026
|
+
itemTrailingKbdsSize: "lg"
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
1031
|
+
color,
|
|
1032
|
+
active: false,
|
|
1033
|
+
class: {
|
|
1034
|
+
item: `text-[var(--ui-${color})] data-highlighted:text-[var(--ui-${color})] data-highlighted:before:bg-[var(--ui-${color})]/10 data-[state=open]:before:bg-[var(--ui-${color})]/10`,
|
|
1035
|
+
itemLeadingIcon: `text-[var(--ui-${color})]/75 group-data-highlighted:text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
|
1036
|
+
}
|
|
1037
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
1038
|
+
color,
|
|
1039
|
+
active: true,
|
|
1040
|
+
class: {
|
|
1041
|
+
item: `text-[var(--ui-${color})] before:bg-[var(--ui-${color})]/10`,
|
|
1042
|
+
itemLeadingIcon: `text-[var(--ui-${color})]`
|
|
1043
|
+
}
|
|
1044
|
+
}))],
|
|
1045
|
+
defaultVariants: {
|
|
1046
|
+
size: "md"
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
const form = {
|
|
1051
|
+
base: ""
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
const formField = {
|
|
1055
|
+
slots: {
|
|
1056
|
+
root: "",
|
|
1057
|
+
wrapper: "",
|
|
1058
|
+
labelWrapper: "flex content-center items-center justify-between",
|
|
1059
|
+
label: "block font-medium text-[var(--ui-text)]",
|
|
1060
|
+
container: "mt-1 relative",
|
|
1061
|
+
description: "text-[var(--ui-text-muted)]",
|
|
1062
|
+
error: "mt-2 text-[var(--ui-error)]",
|
|
1063
|
+
hint: "text-[var(--ui-text-muted)]",
|
|
1064
|
+
help: "mt-2 text-[var(--ui-text-muted)]"
|
|
1065
|
+
},
|
|
1066
|
+
variants: {
|
|
1067
|
+
size: {
|
|
1068
|
+
xs: { root: "text-xs" },
|
|
1069
|
+
sm: { root: "text-xs" },
|
|
1070
|
+
md: { root: "text-sm" },
|
|
1071
|
+
lg: { root: "text-sm" },
|
|
1072
|
+
xl: { root: "text-base" }
|
|
1073
|
+
},
|
|
1074
|
+
required: {
|
|
1075
|
+
true: {
|
|
1076
|
+
label: `after:content-['*'] after:ms-0.5 after:text-[var(--ui-error)]`
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
defaultVariants: {
|
|
1081
|
+
size: "md"
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
const input = (options) => ({
|
|
1086
|
+
slots: {
|
|
1087
|
+
root: "relative inline-flex items-center",
|
|
1088
|
+
base: ["w-full rounded-[calc(var(--ui-radius)*1.5)] border-0 placeholder:text-[var(--ui-text-dimmed)] focus:outline-none disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
|
|
1089
|
+
leading: "absolute inset-y-0 start-0 flex items-center",
|
|
1090
|
+
leadingIcon: "shrink-0 text-[var(--ui-text-dimmed)]",
|
|
1091
|
+
leadingAvatar: "shrink-0",
|
|
1092
|
+
leadingAvatarSize: "",
|
|
1093
|
+
trailing: "absolute inset-y-0 end-0 flex items-center",
|
|
1094
|
+
trailingIcon: "shrink-0 text-[var(--ui-text-dimmed)]"
|
|
1095
|
+
},
|
|
1096
|
+
variants: {
|
|
1097
|
+
...buttonGroupVariantWithRoot,
|
|
1098
|
+
size: {
|
|
1099
|
+
xs: {
|
|
1100
|
+
base: "px-2 py-1 text-xs gap-1",
|
|
1101
|
+
leading: "ps-2",
|
|
1102
|
+
trailing: "pe-2",
|
|
1103
|
+
leadingIcon: "size-4",
|
|
1104
|
+
leadingAvatarSize: "3xs",
|
|
1105
|
+
trailingIcon: "size-4"
|
|
1106
|
+
},
|
|
1107
|
+
sm: {
|
|
1108
|
+
base: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
1109
|
+
leading: "ps-2.5",
|
|
1110
|
+
trailing: "pe-2.5",
|
|
1111
|
+
leadingIcon: "size-4",
|
|
1112
|
+
leadingAvatarSize: "3xs",
|
|
1113
|
+
trailingIcon: "size-4"
|
|
1114
|
+
},
|
|
1115
|
+
md: {
|
|
1116
|
+
base: "px-2.5 py-1.5 text-sm gap-1.5",
|
|
1117
|
+
leading: "ps-2.5",
|
|
1118
|
+
trailing: "pe-2.5",
|
|
1119
|
+
leadingIcon: "size-5",
|
|
1120
|
+
leadingAvatarSize: "2xs",
|
|
1121
|
+
trailingIcon: "size-5"
|
|
1122
|
+
},
|
|
1123
|
+
lg: {
|
|
1124
|
+
base: "px-3 py-2 text-sm gap-2",
|
|
1125
|
+
leading: "ps-3",
|
|
1126
|
+
trailing: "pe-3",
|
|
1127
|
+
leadingIcon: "size-5",
|
|
1128
|
+
leadingAvatarSize: "2xs",
|
|
1129
|
+
trailingIcon: "size-5"
|
|
1130
|
+
},
|
|
1131
|
+
xl: {
|
|
1132
|
+
base: "px-3 py-2 text-base gap-2",
|
|
1133
|
+
leading: "ps-3",
|
|
1134
|
+
trailing: "pe-3",
|
|
1135
|
+
leadingIcon: "size-6",
|
|
1136
|
+
leadingAvatarSize: "xs",
|
|
1137
|
+
trailingIcon: "size-6"
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
variant: {
|
|
1141
|
+
outline: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg)] ring ring-inset ring-[var(--ui-border-accented)]",
|
|
1142
|
+
soft: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg-elevated)]/50 hover:bg-[var(--ui-bg-elevated)] focus:bg-[var(--ui-bg-elevated)] disabled:bg-[var(--ui-bg-elevated)]/50",
|
|
1143
|
+
subtle: "text-[var(--ui-text-highlighted)] bg-[var(--ui-bg-elevated)] ring ring-inset ring-[var(--ui-border-accented)]",
|
|
1144
|
+
ghost: "text-[var(--ui-text-highlighted)] hover:bg-[var(--ui-bg-elevated)] focus:bg-[var(--ui-bg-elevated)] disabled:bg-transparent dark:disabled:bg-transparent",
|
|
1145
|
+
none: "text-[var(--ui-text-highlighted)]"
|
|
1146
|
+
},
|
|
1147
|
+
color: {
|
|
1148
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1149
|
+
neutral: ""
|
|
1150
|
+
},
|
|
1151
|
+
leading: {
|
|
1152
|
+
true: ""
|
|
1153
|
+
},
|
|
1154
|
+
trailing: {
|
|
1155
|
+
true: ""
|
|
1156
|
+
},
|
|
1157
|
+
loading: {
|
|
1158
|
+
true: ""
|
|
1159
|
+
},
|
|
1160
|
+
highlight: {
|
|
1161
|
+
true: ""
|
|
1162
|
+
},
|
|
1163
|
+
type: {
|
|
1164
|
+
file: "file:me-1.5 file:font-medium file:text-[var(--ui-text-muted)] file:outline-none"
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
1168
|
+
color,
|
|
1169
|
+
variant: ["outline", "subtle"],
|
|
1170
|
+
class: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-${color})]`
|
|
1171
|
+
})), ...(options.theme.colors || []).map((color) => ({
|
|
1172
|
+
color,
|
|
1173
|
+
highlight: true,
|
|
1174
|
+
class: `ring ring-inset ring-[var(--ui-${color})]`
|
|
1175
|
+
})), {
|
|
1176
|
+
color: "neutral",
|
|
1177
|
+
variant: ["outline", "subtle"],
|
|
1178
|
+
class: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-border-inverted)]"
|
|
1179
|
+
}, {
|
|
1180
|
+
color: "neutral",
|
|
1181
|
+
highlight: true,
|
|
1182
|
+
class: "ring ring-inset ring-[var(--ui-border-inverted)]"
|
|
1183
|
+
}, {
|
|
1184
|
+
leading: true,
|
|
1185
|
+
size: "xs",
|
|
1186
|
+
class: "ps-7"
|
|
1187
|
+
}, {
|
|
1188
|
+
leading: true,
|
|
1189
|
+
size: "sm",
|
|
1190
|
+
class: "ps-8"
|
|
1191
|
+
}, {
|
|
1192
|
+
leading: true,
|
|
1193
|
+
size: "md",
|
|
1194
|
+
class: "ps-9"
|
|
1195
|
+
}, {
|
|
1196
|
+
leading: true,
|
|
1197
|
+
size: "lg",
|
|
1198
|
+
class: "ps-10"
|
|
1199
|
+
}, {
|
|
1200
|
+
leading: true,
|
|
1201
|
+
size: "xl",
|
|
1202
|
+
class: "ps-11"
|
|
1203
|
+
}, {
|
|
1204
|
+
trailing: true,
|
|
1205
|
+
size: "xs",
|
|
1206
|
+
class: "pe-7"
|
|
1207
|
+
}, {
|
|
1208
|
+
trailing: true,
|
|
1209
|
+
size: "sm",
|
|
1210
|
+
class: "pe-8"
|
|
1211
|
+
}, {
|
|
1212
|
+
trailing: true,
|
|
1213
|
+
size: "md",
|
|
1214
|
+
class: "pe-9"
|
|
1215
|
+
}, {
|
|
1216
|
+
trailing: true,
|
|
1217
|
+
size: "lg",
|
|
1218
|
+
class: "pe-10"
|
|
1219
|
+
}, {
|
|
1220
|
+
trailing: true,
|
|
1221
|
+
size: "xl",
|
|
1222
|
+
class: "pe-11"
|
|
1223
|
+
}, {
|
|
1224
|
+
loading: true,
|
|
1225
|
+
leading: true,
|
|
1226
|
+
class: {
|
|
1227
|
+
leadingIcon: "animate-spin"
|
|
1228
|
+
}
|
|
1229
|
+
}, {
|
|
1230
|
+
loading: true,
|
|
1231
|
+
leading: false,
|
|
1232
|
+
trailing: true,
|
|
1233
|
+
class: {
|
|
1234
|
+
trailingIcon: "animate-spin"
|
|
1235
|
+
}
|
|
1236
|
+
}],
|
|
1237
|
+
defaultVariants: {
|
|
1238
|
+
size: "md",
|
|
1239
|
+
color: "primary",
|
|
1240
|
+
variant: "outline"
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
const inputMenu = (options) => {
|
|
1245
|
+
return defuFn({
|
|
1246
|
+
slots: {
|
|
1247
|
+
base: () => ["rounded-[calc(var(--ui-radius)*1.5)]", options.theme.transitions && "transition-colors"],
|
|
1248
|
+
trailing: "group absolute inset-y-0 end-0 flex items-center disabled:cursor-not-allowed disabled:opacity-75",
|
|
1249
|
+
arrow: "fill-[var(--ui-border)]",
|
|
1250
|
+
content: "max-h-60 w-[var(--radix-popper-anchor-width)] bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1251
|
+
viewport: "divide-y divide-[var(--ui-border)] scroll-py-1",
|
|
1252
|
+
group: "p-1 isolate",
|
|
1253
|
+
empty: "py-2 text-center text-sm text-[var(--ui-text-muted)]",
|
|
1254
|
+
label: "font-semibold text-[var(--ui-text-highlighted)]",
|
|
1255
|
+
separator: "-mx-1 my-1 h-px bg-[var(--ui-border)]",
|
|
1256
|
+
item: ["group relative w-full flex items-center gap-1.5 p-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[var(--ui-text)] data-highlighted:text-[var(--ui-text-highlighted)] data-highlighted:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
1257
|
+
itemLeadingIcon: ["shrink-0 text-[var(--ui-text-dimmed)] group-data-highlighted:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"],
|
|
1258
|
+
itemLeadingAvatar: "shrink-0",
|
|
1259
|
+
itemLeadingAvatarSize: "",
|
|
1260
|
+
itemLeadingChip: "shrink-0",
|
|
1261
|
+
itemLeadingChipSize: "",
|
|
1262
|
+
itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
1263
|
+
itemTrailingIcon: "shrink-0",
|
|
1264
|
+
itemLabel: "truncate",
|
|
1265
|
+
tagsItem: "px-1.5 py-0.5 rounded-[var(--ui-radius)] font-medium inline-flex items-center gap-0.5 ring ring-inset ring-[var(--ui-border-accented)] bg-[var(--ui-bg-elevated)] text-[var(--ui-text)] data-disabled:cursor-not-allowed data-disabled:opacity-75",
|
|
1266
|
+
tagsItemText: "truncate",
|
|
1267
|
+
tagsItemDelete: ["inline-flex items-center rounded-[calc(var(--ui-radius)/2)] text-[var(--ui-text-dimmed)] hover:text-[var(--ui-text)] hover:bg-[var(--ui-bg-accented)]/75 disabled:pointer-events-none", options.theme.transitions && "transition-colors"],
|
|
1268
|
+
tagsItemDeleteIcon: "",
|
|
1269
|
+
tagsInput: ""
|
|
1270
|
+
},
|
|
1271
|
+
variants: {
|
|
1272
|
+
multiple: {
|
|
1273
|
+
true: {
|
|
1274
|
+
root: "flex-wrap",
|
|
1275
|
+
base: "",
|
|
1276
|
+
tagsInput: "border-0 placeholder:text-[var(--ui-text-dimmed)] focus:outline-none disabled:cursor-not-allowed disabled:opacity-75"
|
|
1277
|
+
},
|
|
1278
|
+
false: {
|
|
1279
|
+
base: "w-full border-0 placeholder:text-[var(--ui-text-dimmed)] focus:outline-none disabled:cursor-not-allowed disabled:opacity-75"
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
size: {
|
|
1283
|
+
xs: {
|
|
1284
|
+
label: "p-1 text-[10px]/3 gap-1",
|
|
1285
|
+
item: "p-1 text-xs gap-1",
|
|
1286
|
+
itemLeadingIcon: "size-4",
|
|
1287
|
+
itemLeadingAvatarSize: "3xs",
|
|
1288
|
+
itemLeadingChip: "size-4",
|
|
1289
|
+
itemLeadingChipSize: "sm",
|
|
1290
|
+
itemTrailingIcon: "size-4",
|
|
1291
|
+
tagsItem: "text-[10px]/3",
|
|
1292
|
+
tagsItemDeleteIcon: "size-3"
|
|
1293
|
+
},
|
|
1294
|
+
sm: {
|
|
1295
|
+
label: "p-1.5 text-[10px]/3 gap-1.5",
|
|
1296
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
1297
|
+
itemLeadingIcon: "size-4",
|
|
1298
|
+
itemLeadingAvatarSize: "3xs",
|
|
1299
|
+
itemLeadingChip: "size-4",
|
|
1300
|
+
itemLeadingChipSize: "sm",
|
|
1301
|
+
itemTrailingIcon: "size-4",
|
|
1302
|
+
tagsItem: "text-[10px]/3",
|
|
1303
|
+
tagsItemDeleteIcon: "size-3"
|
|
1304
|
+
},
|
|
1305
|
+
md: {
|
|
1306
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
1307
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
1308
|
+
itemLeadingIcon: "size-5",
|
|
1309
|
+
itemLeadingAvatarSize: "2xs",
|
|
1310
|
+
itemLeadingChip: "size-5",
|
|
1311
|
+
itemLeadingChipSize: "md",
|
|
1312
|
+
itemTrailingIcon: "size-5",
|
|
1313
|
+
tagsItem: "text-xs",
|
|
1314
|
+
tagsItemDeleteIcon: "size-3.5"
|
|
1315
|
+
},
|
|
1316
|
+
lg: {
|
|
1317
|
+
label: "p-2 text-xs gap-2",
|
|
1318
|
+
item: "p-2 text-sm gap-2",
|
|
1319
|
+
itemLeadingIcon: "size-5",
|
|
1320
|
+
itemLeadingAvatarSize: "2xs",
|
|
1321
|
+
itemLeadingChip: "size-5",
|
|
1322
|
+
itemLeadingChipSize: "md",
|
|
1323
|
+
itemTrailingIcon: "size-5",
|
|
1324
|
+
tagsItem: "text-xs",
|
|
1325
|
+
tagsItemDeleteIcon: "size-3.5"
|
|
1326
|
+
},
|
|
1327
|
+
xl: {
|
|
1328
|
+
label: "p-2 text-sm gap-2",
|
|
1329
|
+
item: "p-2 text-base gap-2",
|
|
1330
|
+
itemLeadingIcon: "size-6",
|
|
1331
|
+
itemLeadingAvatarSize: "xs",
|
|
1332
|
+
itemLeadingChip: "size-6",
|
|
1333
|
+
itemLeadingChipSize: "lg",
|
|
1334
|
+
itemTrailingIcon: "size-6",
|
|
1335
|
+
tagsItem: "text-sm",
|
|
1336
|
+
tagsItemDeleteIcon: "size-4"
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
compoundVariants: [...(options.theme.colors || []).map((color) => ({
|
|
1341
|
+
color,
|
|
1342
|
+
multiple: true,
|
|
1343
|
+
variant: ["outline", "subtle"],
|
|
1344
|
+
class: `has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-[var(--${color})]`
|
|
1345
|
+
})), {
|
|
1346
|
+
color: "neutral",
|
|
1347
|
+
multiple: true,
|
|
1348
|
+
variant: ["outline", "subtle"],
|
|
1349
|
+
class: "has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-[var(--ui-border-inverted)]"
|
|
1350
|
+
}]
|
|
1351
|
+
}, input(options));
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
const kbd = {
|
|
1355
|
+
base: "inline-flex items-center justify-center px-1 rounded-[var(--ui-radius)] font-medium font-sans",
|
|
1356
|
+
variants: {
|
|
1357
|
+
variant: {
|
|
1358
|
+
solid: "bg-[var(--ui-bg-inverted)] text-[var(--ui-bg)]",
|
|
1359
|
+
outline: "bg-[var(--ui-bg)] text-[var(--ui-text-highlighted)] ring ring-inset ring-[var(--ui-border-accented)]",
|
|
1360
|
+
subtle: "bg-[var(--ui-bg-elevated)] text-[var(--ui-text)] ring ring-inset ring-[var(--ui-border-accented)]"
|
|
1361
|
+
},
|
|
1362
|
+
size: {
|
|
1363
|
+
sm: "h-4 min-w-[16px] text-[10px]",
|
|
1364
|
+
md: "h-5 min-w-[20px] text-[11px]",
|
|
1365
|
+
lg: "h-6 min-w-[24px] text-[12px]"
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
defaultVariants: {
|
|
1369
|
+
variant: "outline",
|
|
1370
|
+
size: "md"
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
const link = (options) => ({
|
|
1375
|
+
base: "focus-visible:outline-[var(--ui-primary)]",
|
|
1376
|
+
variants: {
|
|
1377
|
+
active: {
|
|
1378
|
+
true: "text-[var(--ui-primary)]",
|
|
1379
|
+
false: ["text-[var(--ui-text-muted)] hover:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1380
|
+
},
|
|
1381
|
+
disabled: {
|
|
1382
|
+
true: "cursor-not-allowed opacity-75"
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
const modal = {
|
|
1388
|
+
slots: {
|
|
1389
|
+
overlay: "fixed inset-0 bg-[var(--ui-bg-elevated)]/75",
|
|
1390
|
+
content: "fixed w-full h-dvh bg-[var(--ui-bg)] divide-y divide-[var(--ui-border)] flex flex-col focus:outline-none",
|
|
1391
|
+
header: "px-4 py-5 sm:px-6",
|
|
1392
|
+
body: "flex-1 p-4 sm:p-6",
|
|
1393
|
+
footer: "flex items-center gap-1.5 p-4 sm:px-6",
|
|
1394
|
+
title: "text-[var(--ui-text-highlighted)] font-semibold",
|
|
1395
|
+
description: "mt-1 text-[var(--ui-text-muted)] text-sm",
|
|
1396
|
+
close: "absolute top-4 end-4"
|
|
1397
|
+
},
|
|
1398
|
+
variants: {
|
|
1399
|
+
transition: {
|
|
1400
|
+
true: {
|
|
1401
|
+
overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]",
|
|
1402
|
+
content: "data-[state=open]:animate-[scale-in_200ms_ease-out] data-[state=closed]:animate-[scale-out_200ms_ease-in]"
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
fullscreen: {
|
|
1406
|
+
true: {
|
|
1407
|
+
content: "inset-0"
|
|
1408
|
+
},
|
|
1409
|
+
false: {
|
|
1410
|
+
content: "top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] sm:max-w-lg sm:h-auto sm:my-8 sm:rounded-[calc(var(--ui-radius)*2)] sm:shadow-lg sm:ring ring-[var(--ui-border)]"
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
const navigationMenu = (options) => ({
|
|
1417
|
+
slots: {
|
|
1418
|
+
root: "relative flex gap-1.5 [&>div]:min-w-0",
|
|
1419
|
+
list: "isolate min-w-0",
|
|
1420
|
+
item: "min-w-0",
|
|
1421
|
+
link: "group relative w-full flex items-center gap-1.5 font-medium text-sm before:absolute before:z-[-1] before:rounded-[calc(var(--ui-radius)*1.5)] focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",
|
|
1422
|
+
linkLeadingIcon: "shrink-0 size-5",
|
|
1423
|
+
linkLeadingAvatar: "shrink-0",
|
|
1424
|
+
linkLeadingAvatarSize: "2xs",
|
|
1425
|
+
linkTrailing: "ms-auto inline-flex",
|
|
1426
|
+
linkTrailingBadge: "shrink-0 rounded",
|
|
1427
|
+
linkTrailingBadgeSize: "sm",
|
|
1428
|
+
linkTrailingIcon: "size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
1429
|
+
linkLabel: "truncate",
|
|
1430
|
+
linkLabelExternalIcon: "inline-block size-3 align-top text-[var(--ui-text-dimmed)]",
|
|
1431
|
+
childList: "",
|
|
1432
|
+
childItem: "",
|
|
1433
|
+
childLink: "group size-full px-3 py-2 rounded-[calc(var(--ui-radius)*1.5)] flex items-start gap-2 text-start",
|
|
1434
|
+
childLinkWrapper: "flex flex-col items-start",
|
|
1435
|
+
childLinkIcon: "size-5 shrink-0",
|
|
1436
|
+
childLinkLabel: "font-semibold text-sm relative inline-flex",
|
|
1437
|
+
childLinkLabelExternalIcon: "inline-block size-3 align-top text-[var(--ui-text-dimmed)]",
|
|
1438
|
+
childLinkDescription: "text-sm text-[var(--ui-text-muted)]",
|
|
1439
|
+
separator: "px-2 h-px bg-[var(--ui-border)]",
|
|
1440
|
+
viewportWrapper: "absolute top-full left-0 flex w-full justify-center",
|
|
1441
|
+
viewport: "relative overflow-hidden bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] h-[var(--radix-navigation-menu-viewport-height)] w-full transition-[width,height] origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1442
|
+
content: "absolute top-0 left-0 w-full 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]",
|
|
1443
|
+
indicator: "data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] bottom-0 z-[1] flex h-2.5 items-end justify-center overflow-hidden transition-transform duration-200 ease-out",
|
|
1444
|
+
arrow: "relative top-[50%] size-2.5 rotate-45 border border-[var(--ui-border)] bg-[var(--ui-bg)] z-[1] rounded-[calc(var(--ui-radius)/2)]"
|
|
1445
|
+
},
|
|
1446
|
+
variants: {
|
|
1447
|
+
color: {
|
|
1448
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
1449
|
+
link: `focus-visible:before:ring-[var(--ui-${color})]`,
|
|
1450
|
+
childLink: `focus-visible:outline-[var(--ui-${color})]`
|
|
1451
|
+
}])),
|
|
1452
|
+
neutral: {
|
|
1453
|
+
link: "focus-visible:before:ring-[var(--ui-border-inverted)]",
|
|
1454
|
+
childLink: "focus-visible:outline-[var(--ui-border-inverted)]"
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
highlightColor: {
|
|
1458
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
1459
|
+
neutral: ""
|
|
1460
|
+
},
|
|
1461
|
+
variant: {
|
|
1462
|
+
pill: "",
|
|
1463
|
+
link: ""
|
|
1464
|
+
},
|
|
1465
|
+
orientation: {
|
|
1466
|
+
horizontal: {
|
|
1467
|
+
root: "w-full items-center justify-between",
|
|
1468
|
+
list: "flex items-center",
|
|
1469
|
+
item: "py-2",
|
|
1470
|
+
link: "px-2.5 py-1.5 before:inset-x-px before:inset-y-0",
|
|
1471
|
+
childList: "grid grid-cols-2 gap-2 p-2"
|
|
1472
|
+
},
|
|
1473
|
+
vertical: {
|
|
1474
|
+
root: "flex-col",
|
|
1475
|
+
link: "flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0",
|
|
1476
|
+
childList: "ms-5 border-s border-[var(--ui-border)]",
|
|
1477
|
+
childItem: "ps-1.5 -ms-px"
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
active: {
|
|
1481
|
+
true: {
|
|
1482
|
+
childLink: "bg-[var(--ui-bg-elevated)] text-[var(--ui-text-highlighted)]",
|
|
1483
|
+
childLinkIcon: "text-[var(--ui-text)]"
|
|
1484
|
+
},
|
|
1485
|
+
false: {
|
|
1486
|
+
link: "text-[var(--ui-text-muted)]",
|
|
1487
|
+
linkLeadingIcon: "text-[var(--ui-text-dimmed)]",
|
|
1488
|
+
childLink: ["hover:bg-[var(--ui-bg-elevated)]/50 text-[var(--ui-text)] hover:text-[var(--ui-text-highlighted)]", options.theme.transitions && "transition-colors"],
|
|
1489
|
+
childLinkIcon: ["text-[var(--ui-text-dimmed)] group-hover:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
disabled: {
|
|
1493
|
+
true: {
|
|
1494
|
+
link: "cursor-not-allowed opacity-75"
|
|
1495
|
+
}
|
|
1496
|
+
},
|
|
1497
|
+
highlight: {
|
|
1498
|
+
true: ""
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
compoundVariants: [{
|
|
1502
|
+
highlight: true,
|
|
1503
|
+
orientation: "horizontal",
|
|
1504
|
+
class: {
|
|
1505
|
+
item: "-mb-px",
|
|
1506
|
+
link: "after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full"
|
|
1507
|
+
}
|
|
1508
|
+
}, {
|
|
1509
|
+
highlight: true,
|
|
1510
|
+
orientation: "vertical",
|
|
1511
|
+
class: {
|
|
1512
|
+
item: "px-1.5 -ms-px",
|
|
1513
|
+
link: "after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full"
|
|
1514
|
+
}
|
|
1515
|
+
}, {
|
|
1516
|
+
disabled: false,
|
|
1517
|
+
active: false,
|
|
1518
|
+
variant: "pill",
|
|
1519
|
+
class: {
|
|
1520
|
+
link: ["hover:text-[var(--ui-text-highlighted)] hover:before:bg-[var(--ui-bg-elevated)]/50 data-[state=open]:text-[var(--ui-text-highlighted)]", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
1521
|
+
linkLeadingIcon: ["group-hover:text-[var(--ui-text)] group-data-[state=open]:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1522
|
+
}
|
|
1523
|
+
}, {
|
|
1524
|
+
disabled: false,
|
|
1525
|
+
variant: "pill",
|
|
1526
|
+
highlight: true,
|
|
1527
|
+
orientation: "horizontal",
|
|
1528
|
+
class: {
|
|
1529
|
+
link: "data-[state=open]:before:bg-[var(--ui-bg-elevated)]/50"
|
|
1530
|
+
}
|
|
1531
|
+
}, {
|
|
1532
|
+
disabled: false,
|
|
1533
|
+
variant: "pill",
|
|
1534
|
+
highlight: false,
|
|
1535
|
+
active: false,
|
|
1536
|
+
orientation: "horizontal",
|
|
1537
|
+
class: {
|
|
1538
|
+
link: "data-[state=open]:before:bg-[var(--ui-bg-elevated)]/50"
|
|
1539
|
+
}
|
|
1540
|
+
}, ...(options.theme.colors || []).map((color) => ({
|
|
1541
|
+
color,
|
|
1542
|
+
variant: "pill",
|
|
1543
|
+
active: true,
|
|
1544
|
+
class: {
|
|
1545
|
+
link: `text-[var(--ui-${color})]`,
|
|
1546
|
+
linkLeadingIcon: `text-[var(--ui-${color})]`
|
|
1547
|
+
}
|
|
1548
|
+
})), {
|
|
1549
|
+
color: "neutral",
|
|
1550
|
+
variant: "pill",
|
|
1551
|
+
active: true,
|
|
1552
|
+
class: {
|
|
1553
|
+
link: "text-[var(--ui-text-highlighted)]",
|
|
1554
|
+
linkLeadingIcon: "text-[var(--ui-text-highlighted)]"
|
|
1555
|
+
}
|
|
1556
|
+
}, {
|
|
1557
|
+
variant: "pill",
|
|
1558
|
+
active: true,
|
|
1559
|
+
highlight: false,
|
|
1560
|
+
class: {
|
|
1561
|
+
link: "before:bg-[var(--ui-bg-elevated)]"
|
|
1562
|
+
}
|
|
1563
|
+
}, {
|
|
1564
|
+
variant: "pill",
|
|
1565
|
+
active: true,
|
|
1566
|
+
highlight: true,
|
|
1567
|
+
class: {
|
|
1568
|
+
link: ["hover:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "before:transition-colors"]
|
|
1569
|
+
}
|
|
1570
|
+
}, {
|
|
1571
|
+
disabled: false,
|
|
1572
|
+
active: false,
|
|
1573
|
+
variant: "link",
|
|
1574
|
+
class: {
|
|
1575
|
+
link: ["hover:text-[var(--ui-text-highlighted)] data-[state=open]:text-[var(--ui-text-highlighted)]", options.theme.transitions && "transition-colors"],
|
|
1576
|
+
linkLeadingIcon: ["group-hover:text-[var(--ui-text)] group-data-[state=open]:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1577
|
+
}
|
|
1578
|
+
}, ...(options.theme.colors || []).map((color) => ({
|
|
1579
|
+
color,
|
|
1580
|
+
variant: "link",
|
|
1581
|
+
active: true,
|
|
1582
|
+
class: {
|
|
1583
|
+
link: `text-[var(--ui-${color})]`,
|
|
1584
|
+
linkLeadingIcon: `text-[var(--ui-${color})]`
|
|
1585
|
+
}
|
|
1586
|
+
})), {
|
|
1587
|
+
color: "neutral",
|
|
1588
|
+
variant: "link",
|
|
1589
|
+
active: true,
|
|
1590
|
+
class: {
|
|
1591
|
+
link: "text-[var(--ui-text-highlighted)]",
|
|
1592
|
+
linkLeadingIcon: "text-[var(--ui-text-highlighted)]"
|
|
1593
|
+
}
|
|
1594
|
+
}, ...(options.theme.colors || []).map((highlightColor) => ({
|
|
1595
|
+
highlightColor,
|
|
1596
|
+
highlight: true,
|
|
1597
|
+
active: true,
|
|
1598
|
+
class: {
|
|
1599
|
+
link: `after:bg-[var(--ui-${highlightColor})]`
|
|
1600
|
+
}
|
|
1601
|
+
})), {
|
|
1602
|
+
highlightColor: "neutral",
|
|
1603
|
+
highlight: true,
|
|
1604
|
+
active: true,
|
|
1605
|
+
class: {
|
|
1606
|
+
link: "after:bg-[var(--ui-bg-inverted)]"
|
|
1607
|
+
}
|
|
1608
|
+
}],
|
|
1609
|
+
defaultVariants: {
|
|
1610
|
+
color: "primary",
|
|
1611
|
+
highlightColor: "primary",
|
|
1612
|
+
variant: "pill"
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
|
|
1616
|
+
const pagination = {
|
|
1617
|
+
slots: {
|
|
1618
|
+
root: "",
|
|
1619
|
+
list: "flex items-center gap-1",
|
|
1620
|
+
ellipsis: "pointer-events-none",
|
|
1621
|
+
label: "min-w-5 text-center"
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
const popover = {
|
|
1626
|
+
slots: {
|
|
1627
|
+
content: "bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] focus:outline-none",
|
|
1628
|
+
arrow: "fill-[var(--ui-border)]"
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
const progress = (options) => ({
|
|
1633
|
+
slots: {
|
|
1634
|
+
root: "gap-2",
|
|
1635
|
+
base: "relative overflow-hidden rounded-full bg-[var(--ui-bg-accented)]",
|
|
1636
|
+
indicator: "rounded-full size-full transition-transform duration-200 ease-out",
|
|
1637
|
+
status: "flex justify-end text-[var(--ui-text-dimmed)] transition-[width] duration-200",
|
|
1638
|
+
steps: "grid items-end",
|
|
1639
|
+
step: "truncate text-end row-start-1 col-start-1 transition-opacity"
|
|
1640
|
+
},
|
|
1641
|
+
variants: {
|
|
1642
|
+
animation: {
|
|
1643
|
+
"carousel": "",
|
|
1644
|
+
"carousel-inverse": "",
|
|
1645
|
+
"swing": "",
|
|
1646
|
+
"elastic": ""
|
|
1647
|
+
},
|
|
1648
|
+
color: {
|
|
1649
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
1650
|
+
indicator: `bg-[var(--ui-${color})]`,
|
|
1651
|
+
steps: `text-[var(--ui-${color})]`
|
|
1652
|
+
}])),
|
|
1653
|
+
neutral: {
|
|
1654
|
+
indicator: "bg-[var(--ui-bg-inverted)]",
|
|
1655
|
+
steps: "text-[var(--ui-bg)]"
|
|
1656
|
+
}
|
|
1657
|
+
},
|
|
1658
|
+
size: {
|
|
1659
|
+
"2xs": {
|
|
1660
|
+
status: "text-xs",
|
|
1661
|
+
steps: "text-xs"
|
|
1662
|
+
},
|
|
1663
|
+
"xs": {
|
|
1664
|
+
status: "text-xs",
|
|
1665
|
+
steps: "text-xs"
|
|
1666
|
+
},
|
|
1667
|
+
"sm": {
|
|
1668
|
+
status: "text-sm",
|
|
1669
|
+
steps: "text-sm"
|
|
1670
|
+
},
|
|
1671
|
+
"md": {
|
|
1672
|
+
status: "text-sm",
|
|
1673
|
+
steps: "text-sm"
|
|
1674
|
+
},
|
|
1675
|
+
"lg": {
|
|
1676
|
+
status: "text-sm",
|
|
1677
|
+
steps: "text-sm"
|
|
1678
|
+
},
|
|
1679
|
+
"xl": {
|
|
1680
|
+
status: "text-base",
|
|
1681
|
+
steps: "text-base"
|
|
1682
|
+
},
|
|
1683
|
+
"2xl": {
|
|
1684
|
+
status: "text-base",
|
|
1685
|
+
steps: "text-base"
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
step: {
|
|
1689
|
+
active: {
|
|
1690
|
+
step: "opacity-100"
|
|
1691
|
+
},
|
|
1692
|
+
first: {
|
|
1693
|
+
step: "opacity-100 text-[var(--ui-text-muted)]"
|
|
1694
|
+
},
|
|
1695
|
+
other: {
|
|
1696
|
+
step: "opacity-0"
|
|
1697
|
+
},
|
|
1698
|
+
last: {
|
|
1699
|
+
step: ""
|
|
1700
|
+
}
|
|
1701
|
+
},
|
|
1702
|
+
orientation: {
|
|
1703
|
+
horizontal: {
|
|
1704
|
+
root: "w-full flex flex-col",
|
|
1705
|
+
base: "w-full",
|
|
1706
|
+
status: "flex-row"
|
|
1707
|
+
},
|
|
1708
|
+
vertical: {
|
|
1709
|
+
root: "h-full flex flex-row-reverse",
|
|
1710
|
+
base: "h-full",
|
|
1711
|
+
status: "flex-col"
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
inverted: {
|
|
1715
|
+
true: {
|
|
1716
|
+
status: "self-end"
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
},
|
|
1720
|
+
compoundVariants: [{
|
|
1721
|
+
inverted: true,
|
|
1722
|
+
orientation: "horizontal",
|
|
1723
|
+
class: {
|
|
1724
|
+
step: "text-start",
|
|
1725
|
+
status: "flex-row-reverse"
|
|
1726
|
+
}
|
|
1727
|
+
}, {
|
|
1728
|
+
inverted: true,
|
|
1729
|
+
orientation: "vertical",
|
|
1730
|
+
class: {
|
|
1731
|
+
steps: "items-start",
|
|
1732
|
+
status: "flex-col-reverse"
|
|
1733
|
+
}
|
|
1734
|
+
}, {
|
|
1735
|
+
orientation: "horizontal",
|
|
1736
|
+
size: "2xs",
|
|
1737
|
+
class: "h-px"
|
|
1738
|
+
}, {
|
|
1739
|
+
orientation: "horizontal",
|
|
1740
|
+
size: "xs",
|
|
1741
|
+
class: "h-0.5"
|
|
1742
|
+
}, {
|
|
1743
|
+
orientation: "horizontal",
|
|
1744
|
+
size: "sm",
|
|
1745
|
+
class: "h-1"
|
|
1746
|
+
}, {
|
|
1747
|
+
orientation: "horizontal",
|
|
1748
|
+
size: "md",
|
|
1749
|
+
class: "h-2"
|
|
1750
|
+
}, {
|
|
1751
|
+
orientation: "horizontal",
|
|
1752
|
+
size: "lg",
|
|
1753
|
+
class: "h-3"
|
|
1754
|
+
}, {
|
|
1755
|
+
orientation: "horizontal",
|
|
1756
|
+
size: "xl",
|
|
1757
|
+
class: "h-4"
|
|
1758
|
+
}, {
|
|
1759
|
+
orientation: "horizontal",
|
|
1760
|
+
size: "2xl",
|
|
1761
|
+
class: "h-5"
|
|
1762
|
+
}, {
|
|
1763
|
+
orientation: "vertical",
|
|
1764
|
+
size: "2xs",
|
|
1765
|
+
class: "w-px"
|
|
1766
|
+
}, {
|
|
1767
|
+
orientation: "vertical",
|
|
1768
|
+
size: "xs",
|
|
1769
|
+
class: "w-0.5"
|
|
1770
|
+
}, {
|
|
1771
|
+
orientation: "vertical",
|
|
1772
|
+
size: "sm",
|
|
1773
|
+
class: "w-1"
|
|
1774
|
+
}, {
|
|
1775
|
+
orientation: "vertical",
|
|
1776
|
+
size: "md",
|
|
1777
|
+
class: "w-2"
|
|
1778
|
+
}, {
|
|
1779
|
+
orientation: "vertical",
|
|
1780
|
+
size: "lg",
|
|
1781
|
+
class: "w-3"
|
|
1782
|
+
}, {
|
|
1783
|
+
orientation: "vertical",
|
|
1784
|
+
size: "xl",
|
|
1785
|
+
class: "w-4"
|
|
1786
|
+
}, {
|
|
1787
|
+
orientation: "vertical",
|
|
1788
|
+
size: "2xl",
|
|
1789
|
+
class: "w-5"
|
|
1790
|
+
}, {
|
|
1791
|
+
orientation: "horizontal",
|
|
1792
|
+
animation: "carousel",
|
|
1793
|
+
class: {
|
|
1794
|
+
indicator: "data-[state=indeterminate]:animate-[carousel_2s_ease-in-out_infinite]"
|
|
1795
|
+
}
|
|
1796
|
+
}, {
|
|
1797
|
+
orientation: "vertical",
|
|
1798
|
+
animation: "carousel",
|
|
1799
|
+
class: {
|
|
1800
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-vertical_2s_ease-in-out_infinite]"
|
|
1801
|
+
}
|
|
1802
|
+
}, {
|
|
1803
|
+
orientation: "horizontal",
|
|
1804
|
+
animation: "carousel-inverse",
|
|
1805
|
+
class: {
|
|
1806
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-inverse_2s_ease-in-out_infinite]"
|
|
1807
|
+
}
|
|
1808
|
+
}, {
|
|
1809
|
+
orientation: "vertical",
|
|
1810
|
+
animation: "carousel-inverse",
|
|
1811
|
+
class: {
|
|
1812
|
+
indicator: "data-[state=indeterminate]:animate-[carousel-inverse-vertical_2s_ease-in-out_infinite]"
|
|
1813
|
+
}
|
|
1814
|
+
}, {
|
|
1815
|
+
orientation: "horizontal",
|
|
1816
|
+
animation: "swing",
|
|
1817
|
+
class: {
|
|
1818
|
+
indicator: "data-[state=indeterminate]:animate-[swing_2s_ease-in-out_infinite]"
|
|
1819
|
+
}
|
|
1820
|
+
}, {
|
|
1821
|
+
orientation: "vertical",
|
|
1822
|
+
animation: "swing",
|
|
1823
|
+
class: {
|
|
1824
|
+
indicator: "data-[state=indeterminate]:animate-[swing-vertical_2s_ease-in-out_infinite]"
|
|
1825
|
+
}
|
|
1826
|
+
}, {
|
|
1827
|
+
orientation: "horizontal",
|
|
1828
|
+
animation: "elastic",
|
|
1829
|
+
class: {
|
|
1830
|
+
indicator: "data-[state=indeterminate]:animate-[elastic_2s_ease-in-out_infinite]"
|
|
1831
|
+
}
|
|
1832
|
+
}, {
|
|
1833
|
+
orientation: "vertical",
|
|
1834
|
+
animation: "elastic",
|
|
1835
|
+
class: {
|
|
1836
|
+
indicator: "data-[state=indeterminate]:animate-[elastic-vertical_2s_ease-in-out_infinite]"
|
|
1837
|
+
}
|
|
1838
|
+
}],
|
|
1839
|
+
defaultVariants: {
|
|
1840
|
+
animation: "carousel",
|
|
1841
|
+
color: "primary",
|
|
1842
|
+
size: "md"
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1845
|
+
|
|
1846
|
+
const radioGroup = (options) => ({
|
|
1847
|
+
slots: {
|
|
1848
|
+
root: "relative",
|
|
1849
|
+
fieldset: "flex",
|
|
1850
|
+
legend: "mb-1 block font-medium text-[var(--ui-text)]",
|
|
1851
|
+
item: "flex items-start",
|
|
1852
|
+
base: "rounded-full ring ring-inset ring-[var(--ui-border-accented)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-offset-[var(--ui-bg)]",
|
|
1853
|
+
indicator: "flex items-center justify-center size-full rounded-full after:bg-[var(--ui-bg)] after:rounded-full",
|
|
1854
|
+
container: "flex items-center",
|
|
1855
|
+
wrapper: "ms-2",
|
|
1856
|
+
label: "block font-medium text-[var(--ui-text)]",
|
|
1857
|
+
description: "text-[var(--ui-text-muted)]"
|
|
1858
|
+
},
|
|
1859
|
+
variants: {
|
|
1860
|
+
color: {
|
|
1861
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
1862
|
+
base: `focus-visible:outline-[var(--ui-${color})]`,
|
|
1863
|
+
indicator: `bg-[var(--ui-${color})]`
|
|
1864
|
+
}])),
|
|
1865
|
+
neutral: {
|
|
1866
|
+
base: "focus-visible:outline-[var(--ui-border-inverted)]",
|
|
1867
|
+
indicator: "bg-[var(--ui-bg-inverted)]"
|
|
1868
|
+
}
|
|
1869
|
+
},
|
|
1870
|
+
orientation: {
|
|
1871
|
+
horizontal: {
|
|
1872
|
+
fieldset: "flex-row",
|
|
1873
|
+
wrapper: "me-2"
|
|
1874
|
+
},
|
|
1875
|
+
vertical: {
|
|
1876
|
+
fieldset: "flex-col"
|
|
1877
|
+
}
|
|
1878
|
+
},
|
|
1879
|
+
size: {
|
|
1880
|
+
xs: {
|
|
1881
|
+
fieldset: "gap-0.5",
|
|
1882
|
+
legend: "text-xs",
|
|
1883
|
+
base: "size-3",
|
|
1884
|
+
item: "text-xs",
|
|
1885
|
+
container: "h-4",
|
|
1886
|
+
indicator: "after:size-1"
|
|
1887
|
+
},
|
|
1888
|
+
sm: {
|
|
1889
|
+
fieldset: "gap-0.5",
|
|
1890
|
+
legend: "text-xs",
|
|
1891
|
+
base: "size-3.5",
|
|
1892
|
+
item: "text-xs",
|
|
1893
|
+
container: "h-4",
|
|
1894
|
+
indicator: "after:size-1"
|
|
1895
|
+
},
|
|
1896
|
+
md: {
|
|
1897
|
+
fieldset: "gap-1",
|
|
1898
|
+
legend: "text-sm",
|
|
1899
|
+
base: "size-4",
|
|
1900
|
+
item: "text-sm",
|
|
1901
|
+
container: "h-5",
|
|
1902
|
+
indicator: "after:size-1.5"
|
|
1903
|
+
},
|
|
1904
|
+
lg: {
|
|
1905
|
+
fieldset: "gap-1",
|
|
1906
|
+
legend: "text-sm",
|
|
1907
|
+
base: "size-4.5",
|
|
1908
|
+
item: "text-sm",
|
|
1909
|
+
container: "h-5",
|
|
1910
|
+
indicator: "after:size-1.5"
|
|
1911
|
+
},
|
|
1912
|
+
xl: {
|
|
1913
|
+
fieldset: "gap-1.5",
|
|
1914
|
+
legend: "text-base",
|
|
1915
|
+
base: "size-5",
|
|
1916
|
+
item: "text-base",
|
|
1917
|
+
container: "h-6",
|
|
1918
|
+
indicator: "after:size-2"
|
|
1919
|
+
}
|
|
1920
|
+
},
|
|
1921
|
+
disabled: {
|
|
1922
|
+
true: {
|
|
1923
|
+
base: "cursor-not-allowed opacity-75",
|
|
1924
|
+
label: "cursor-not-allowed opacity-75"
|
|
1925
|
+
}
|
|
1926
|
+
},
|
|
1927
|
+
required: {
|
|
1928
|
+
true: {
|
|
1929
|
+
legend: "after:content-['*'] after:ms-0.5 after:text-[var(--ui-error)]"
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
defaultVariants: {
|
|
1934
|
+
size: "md",
|
|
1935
|
+
color: "primary"
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
const select = (options) => {
|
|
1940
|
+
return defuFn({
|
|
1941
|
+
slots: {
|
|
1942
|
+
root: () => void 0,
|
|
1943
|
+
base: () => ["relative group rounded-[calc(var(--ui-radius)*1.5)] inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
|
|
1944
|
+
value: "truncate group-data-placeholder:text-[var(--ui-text-dimmed)]",
|
|
1945
|
+
arrow: "fill-[var(--ui-border)]",
|
|
1946
|
+
content: "max-h-60 w-[var(--radix-popper-anchor-width)] bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1947
|
+
viewport: "divide-y divide-[var(--ui-border)] scroll-py-1",
|
|
1948
|
+
group: "p-1 isolate",
|
|
1949
|
+
empty: "py-2 text-center text-sm text-[var(--ui-text-muted)]",
|
|
1950
|
+
label: "font-semibold text-[var(--ui-text-highlighted)]",
|
|
1951
|
+
separator: "-mx-1 my-1 h-px bg-[var(--ui-border)]",
|
|
1952
|
+
item: ["group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[var(--ui-text)] data-highlighted:text-[var(--ui-text-highlighted)] data-highlighted:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
1953
|
+
itemLeadingIcon: ["shrink-0 text-[var(--ui-text-dimmed)] group-data-highlighted:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"],
|
|
1954
|
+
itemLeadingAvatar: "shrink-0",
|
|
1955
|
+
itemLeadingAvatarSize: "",
|
|
1956
|
+
itemLeadingChip: "shrink-0",
|
|
1957
|
+
itemLeadingChipSize: "",
|
|
1958
|
+
itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
1959
|
+
itemTrailingIcon: "shrink-0",
|
|
1960
|
+
itemLabel: "truncate"
|
|
1961
|
+
},
|
|
1962
|
+
variants: {
|
|
1963
|
+
...buttonGroupVariant,
|
|
1964
|
+
size: {
|
|
1965
|
+
xs: {
|
|
1966
|
+
label: "p-1 text-[10px]/3 gap-1",
|
|
1967
|
+
item: "p-1 text-xs gap-1",
|
|
1968
|
+
itemLeadingIcon: "size-4",
|
|
1969
|
+
itemLeadingAvatarSize: "3xs",
|
|
1970
|
+
itemLeadingChip: "size-4",
|
|
1971
|
+
itemLeadingChipSize: "sm",
|
|
1972
|
+
itemTrailingIcon: "size-4"
|
|
1973
|
+
},
|
|
1974
|
+
sm: {
|
|
1975
|
+
label: "p-1.5 text-[10px]/3 gap-1.5",
|
|
1976
|
+
item: "p-1.5 text-xs gap-1.5",
|
|
1977
|
+
itemLeadingIcon: "size-4",
|
|
1978
|
+
itemLeadingAvatarSize: "3xs",
|
|
1979
|
+
itemLeadingChip: "size-4",
|
|
1980
|
+
itemLeadingChipSize: "sm",
|
|
1981
|
+
itemTrailingIcon: "size-4"
|
|
1982
|
+
},
|
|
1983
|
+
md: {
|
|
1984
|
+
label: "p-1.5 text-xs gap-1.5",
|
|
1985
|
+
item: "p-1.5 text-sm gap-1.5",
|
|
1986
|
+
itemLeadingIcon: "size-5",
|
|
1987
|
+
itemLeadingAvatarSize: "2xs",
|
|
1988
|
+
itemLeadingChip: "size-5",
|
|
1989
|
+
itemLeadingChipSize: "md",
|
|
1990
|
+
itemTrailingIcon: "size-5"
|
|
1991
|
+
},
|
|
1992
|
+
lg: {
|
|
1993
|
+
label: "p-2 text-xs gap-2",
|
|
1994
|
+
item: "p-2 text-sm gap-2",
|
|
1995
|
+
itemLeadingIcon: "size-5",
|
|
1996
|
+
itemLeadingAvatarSize: "2xs",
|
|
1997
|
+
itemLeadingChip: "size-5",
|
|
1998
|
+
itemLeadingChipSize: "md",
|
|
1999
|
+
itemTrailingIcon: "size-5"
|
|
2000
|
+
},
|
|
2001
|
+
xl: {
|
|
2002
|
+
label: "p-2 text-sm gap-2",
|
|
2003
|
+
item: "p-2 text-base gap-2",
|
|
2004
|
+
itemLeadingIcon: "size-6",
|
|
2005
|
+
itemLeadingAvatarSize: "xs",
|
|
2006
|
+
itemLeadingChip: "size-6",
|
|
2007
|
+
itemLeadingChipSize: "lg",
|
|
2008
|
+
itemTrailingIcon: "size-6"
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}, input(options));
|
|
2013
|
+
};
|
|
2014
|
+
|
|
2015
|
+
const selectMenu = (options) => {
|
|
2016
|
+
return defu({
|
|
2017
|
+
slots: {
|
|
2018
|
+
value: "truncate",
|
|
2019
|
+
placeholder: "truncate text-[var(--ui-text-dimmed)]",
|
|
2020
|
+
input: "placeholder:text-[var(--ui-text-dimmed)] border-0 border-b border-[var(--ui-border)] focus:outline-none"
|
|
2021
|
+
},
|
|
2022
|
+
variants: {
|
|
2023
|
+
size: {
|
|
2024
|
+
xs: {
|
|
2025
|
+
input: "text-xs px-2 py-1"
|
|
2026
|
+
},
|
|
2027
|
+
sm: {
|
|
2028
|
+
input: "text-xs px-2.5 py-1.5"
|
|
2029
|
+
},
|
|
2030
|
+
md: {
|
|
2031
|
+
input: "text-sm px-2.5 py-1.5"
|
|
2032
|
+
},
|
|
2033
|
+
lg: {
|
|
2034
|
+
input: "text-sm px-3 py-2"
|
|
2035
|
+
},
|
|
2036
|
+
xl: {
|
|
2037
|
+
input: "text-base px-3 py-2"
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}, select(options));
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
const separator = (options) => ({
|
|
2045
|
+
slots: {
|
|
2046
|
+
root: "flex items-center align-center text-center",
|
|
2047
|
+
border: "",
|
|
2048
|
+
container: "font-medium text-[var(--ui-text)] flex",
|
|
2049
|
+
icon: "shrink-0 size-5",
|
|
2050
|
+
avatar: "shrink-0",
|
|
2051
|
+
avatarSize: "2xs",
|
|
2052
|
+
label: "text-sm"
|
|
2053
|
+
},
|
|
2054
|
+
variants: {
|
|
2055
|
+
color: {
|
|
2056
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, { border: `border-[var(--ui-${color})]` }])),
|
|
2057
|
+
neutral: { border: "border-[var(--ui-border)]" }
|
|
2058
|
+
},
|
|
2059
|
+
orientation: {
|
|
2060
|
+
horizontal: {
|
|
2061
|
+
root: "w-full flex-row",
|
|
2062
|
+
border: "w-full",
|
|
2063
|
+
container: "mx-3 whitespace-nowrap"
|
|
2064
|
+
},
|
|
2065
|
+
vertical: {
|
|
2066
|
+
root: "h-full flex-col",
|
|
2067
|
+
border: "h-full",
|
|
2068
|
+
container: "my-2"
|
|
2069
|
+
}
|
|
2070
|
+
},
|
|
2071
|
+
size: {
|
|
2072
|
+
xs: "",
|
|
2073
|
+
sm: "",
|
|
2074
|
+
md: "",
|
|
2075
|
+
lg: "",
|
|
2076
|
+
xl: ""
|
|
2077
|
+
},
|
|
2078
|
+
type: {
|
|
2079
|
+
solid: {
|
|
2080
|
+
border: "border-solid"
|
|
2081
|
+
},
|
|
2082
|
+
dashed: {
|
|
2083
|
+
border: "border-dashed"
|
|
2084
|
+
},
|
|
2085
|
+
dotted: {
|
|
2086
|
+
border: "border-dotted"
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
compoundVariants: [{
|
|
2091
|
+
orientation: "horizontal",
|
|
2092
|
+
size: "xs",
|
|
2093
|
+
class: { border: "border-t" }
|
|
2094
|
+
}, {
|
|
2095
|
+
orientation: "horizontal",
|
|
2096
|
+
size: "sm",
|
|
2097
|
+
class: { border: "border-t-[2px]" }
|
|
2098
|
+
}, {
|
|
2099
|
+
orientation: "horizontal",
|
|
2100
|
+
size: "md",
|
|
2101
|
+
class: { border: "border-t-[3px]" }
|
|
2102
|
+
}, {
|
|
2103
|
+
orientation: "horizontal",
|
|
2104
|
+
size: "lg",
|
|
2105
|
+
class: { border: "border-t-[4px]" }
|
|
2106
|
+
}, {
|
|
2107
|
+
orientation: "horizontal",
|
|
2108
|
+
size: "xl",
|
|
2109
|
+
class: { border: "border-t-[5px]" }
|
|
2110
|
+
}, {
|
|
2111
|
+
orientation: "vertical",
|
|
2112
|
+
size: "xs",
|
|
2113
|
+
class: { border: "border-s" }
|
|
2114
|
+
}, {
|
|
2115
|
+
orientation: "vertical",
|
|
2116
|
+
size: "sm",
|
|
2117
|
+
class: { border: "border-s-[2px]" }
|
|
2118
|
+
}, {
|
|
2119
|
+
orientation: "vertical",
|
|
2120
|
+
size: "md",
|
|
2121
|
+
class: { border: "border-s-[3px]" }
|
|
2122
|
+
}, {
|
|
2123
|
+
orientation: "vertical",
|
|
2124
|
+
size: "lg",
|
|
2125
|
+
class: { border: "border-s-[4px]" }
|
|
2126
|
+
}, {
|
|
2127
|
+
orientation: "vertical",
|
|
2128
|
+
size: "xl",
|
|
2129
|
+
class: { border: "border-s-[5px]" }
|
|
2130
|
+
}],
|
|
2131
|
+
defaultVariants: {
|
|
2132
|
+
color: "neutral",
|
|
2133
|
+
size: "xs",
|
|
2134
|
+
type: "solid"
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
|
|
2138
|
+
const skeleton = {
|
|
2139
|
+
base: "animate-pulse rounded-[calc(var(--ui-radius)*1.5)] bg-[var(--ui-bg-elevated)]"
|
|
2140
|
+
};
|
|
2141
|
+
|
|
2142
|
+
const slideover = {
|
|
2143
|
+
slots: {
|
|
2144
|
+
overlay: "fixed inset-0 bg-[var(--ui-bg-elevated)]/75",
|
|
2145
|
+
content: "fixed bg-[var(--ui-bg)] divide-y divide-[var(--ui-border)] sm:ring ring-[var(--ui-border)] sm:shadow-lg flex flex-col focus:outline-none",
|
|
2146
|
+
header: "px-4 py-5 sm:px-6",
|
|
2147
|
+
body: "flex-1 overflow-y-auto p-4 sm:p-6",
|
|
2148
|
+
footer: "flex items-center gap-1.5 p-4 sm:px-6",
|
|
2149
|
+
title: "text-[var(--ui-text-highlighted)] font-semibold",
|
|
2150
|
+
description: "mt-1 text-[var(--ui-text-muted)] text-sm",
|
|
2151
|
+
close: "absolute top-4 end-4"
|
|
2152
|
+
},
|
|
2153
|
+
variants: {
|
|
2154
|
+
side: {
|
|
2155
|
+
top: {
|
|
2156
|
+
content: "inset-x-0 top-0 max-h-full"
|
|
2157
|
+
},
|
|
2158
|
+
right: {
|
|
2159
|
+
content: "right-0 inset-y-0 w-full max-w-md"
|
|
2160
|
+
},
|
|
2161
|
+
bottom: {
|
|
2162
|
+
content: "inset-x-0 bottom-0 max-h-full"
|
|
2163
|
+
},
|
|
2164
|
+
left: {
|
|
2165
|
+
content: "left-0 inset-y-0 w-full max-w-md"
|
|
2166
|
+
}
|
|
2167
|
+
},
|
|
2168
|
+
transition: {
|
|
2169
|
+
true: {
|
|
2170
|
+
overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
},
|
|
2174
|
+
compoundVariants: [{
|
|
2175
|
+
transition: true,
|
|
2176
|
+
side: "top",
|
|
2177
|
+
class: {
|
|
2178
|
+
content: "data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-top_200ms_ease-in-out]"
|
|
2179
|
+
}
|
|
2180
|
+
}, {
|
|
2181
|
+
transition: true,
|
|
2182
|
+
side: "right",
|
|
2183
|
+
class: {
|
|
2184
|
+
content: "data-[state=open]:animate-[slide-in-from-right_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-right_200ms_ease-in-out]"
|
|
2185
|
+
}
|
|
2186
|
+
}, {
|
|
2187
|
+
transition: true,
|
|
2188
|
+
side: "bottom",
|
|
2189
|
+
class: {
|
|
2190
|
+
content: "data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-bottom_200ms_ease-in-out]"
|
|
2191
|
+
}
|
|
2192
|
+
}, {
|
|
2193
|
+
transition: true,
|
|
2194
|
+
side: "left",
|
|
2195
|
+
class: {
|
|
2196
|
+
content: "data-[state=open]:animate-[slide-in-from-left_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-left_200ms_ease-in-out]"
|
|
2197
|
+
}
|
|
2198
|
+
}]
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
const slider = (options) => ({
|
|
2202
|
+
slots: {
|
|
2203
|
+
root: "relative flex items-center select-none touch-none",
|
|
2204
|
+
track: "relative bg-[var(--ui-bg-accented)] overflow-hidden rounded-full grow",
|
|
2205
|
+
range: "absolute rounded-full",
|
|
2206
|
+
thumb: "rounded-full bg-[var(--ui-bg)] ring-2 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
2207
|
+
},
|
|
2208
|
+
variants: {
|
|
2209
|
+
color: {
|
|
2210
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2211
|
+
range: `bg-[var(--ui-${color})]`,
|
|
2212
|
+
thumb: `ring-[var(--ui-${color})] focus-visible:outline-[var(--ui-${color})]`
|
|
2213
|
+
}])),
|
|
2214
|
+
neutral: {
|
|
2215
|
+
range: "bg-[var(--ui-bg-inverted)]",
|
|
2216
|
+
thumb: "ring-[var(--ui-border-inverted)] focus-visible:outline-[var(--ui-border-inverted)]/50"
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2219
|
+
size: {
|
|
2220
|
+
xs: {
|
|
2221
|
+
thumb: "size-3"
|
|
2222
|
+
},
|
|
2223
|
+
sm: {
|
|
2224
|
+
thumb: "size-3.5"
|
|
2225
|
+
},
|
|
2226
|
+
md: {
|
|
2227
|
+
thumb: "size-4"
|
|
2228
|
+
},
|
|
2229
|
+
lg: {
|
|
2230
|
+
thumb: "size-4.5"
|
|
2231
|
+
},
|
|
2232
|
+
xl: {
|
|
2233
|
+
thumb: "size-5"
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
orientation: {
|
|
2237
|
+
horizontal: {
|
|
2238
|
+
root: "w-full",
|
|
2239
|
+
range: "h-full"
|
|
2240
|
+
},
|
|
2241
|
+
vertical: {
|
|
2242
|
+
root: "flex-col h-full",
|
|
2243
|
+
range: "w-full"
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
disabled: {
|
|
2247
|
+
true: {
|
|
2248
|
+
root: "opacity-75 cursor-not-allowed"
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
},
|
|
2252
|
+
compoundVariants: [{
|
|
2253
|
+
orientation: "horizontal",
|
|
2254
|
+
size: "xs",
|
|
2255
|
+
class: {
|
|
2256
|
+
track: "h-[6px]"
|
|
2257
|
+
}
|
|
2258
|
+
}, {
|
|
2259
|
+
orientation: "horizontal",
|
|
2260
|
+
size: "sm",
|
|
2261
|
+
class: {
|
|
2262
|
+
track: "h-[7px]"
|
|
2263
|
+
}
|
|
2264
|
+
}, {
|
|
2265
|
+
orientation: "horizontal",
|
|
2266
|
+
size: "md",
|
|
2267
|
+
class: {
|
|
2268
|
+
track: "h-[8px]"
|
|
2269
|
+
}
|
|
2270
|
+
}, {
|
|
2271
|
+
orientation: "horizontal",
|
|
2272
|
+
size: "lg",
|
|
2273
|
+
class: {
|
|
2274
|
+
track: "h-[9px]"
|
|
2275
|
+
}
|
|
2276
|
+
}, {
|
|
2277
|
+
orientation: "horizontal",
|
|
2278
|
+
size: "xl",
|
|
2279
|
+
class: {
|
|
2280
|
+
track: "h-[10px]"
|
|
2281
|
+
}
|
|
2282
|
+
}, {
|
|
2283
|
+
orientation: "vertical",
|
|
2284
|
+
size: "xs",
|
|
2285
|
+
class: {
|
|
2286
|
+
track: "w-[6px]"
|
|
2287
|
+
}
|
|
2288
|
+
}, {
|
|
2289
|
+
orientation: "vertical",
|
|
2290
|
+
size: "sm",
|
|
2291
|
+
class: {
|
|
2292
|
+
track: "w-[7px]"
|
|
2293
|
+
}
|
|
2294
|
+
}, {
|
|
2295
|
+
orientation: "vertical",
|
|
2296
|
+
size: "md",
|
|
2297
|
+
class: {
|
|
2298
|
+
track: "w-[8px]"
|
|
2299
|
+
}
|
|
2300
|
+
}, {
|
|
2301
|
+
orientation: "vertical",
|
|
2302
|
+
size: "lg",
|
|
2303
|
+
class: {
|
|
2304
|
+
track: "w-[9px]"
|
|
2305
|
+
}
|
|
2306
|
+
}, {
|
|
2307
|
+
orientation: "vertical",
|
|
2308
|
+
size: "xl",
|
|
2309
|
+
class: {
|
|
2310
|
+
track: "w-[10px]"
|
|
2311
|
+
}
|
|
2312
|
+
}],
|
|
2313
|
+
defaultVariants: {
|
|
2314
|
+
size: "md",
|
|
2315
|
+
color: "primary"
|
|
2316
|
+
}
|
|
2317
|
+
});
|
|
2318
|
+
|
|
2319
|
+
const _switch = (options) => ({
|
|
2320
|
+
slots: {
|
|
2321
|
+
root: "relative flex items-start",
|
|
2322
|
+
base: ["inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--ui-bg)] data-[state=unchecked]:bg-[var(--ui-bg-accented)]", options.theme.transitions && "transition-colors duration-200"],
|
|
2323
|
+
container: "flex items-center",
|
|
2324
|
+
thumb: "group pointer-events-none block rounded-full bg-[var(--ui-bg)] 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",
|
|
2325
|
+
icon: ["absolute shrink-0 group-data-[state=unchecked]:text-[var(--ui-text-dimmed)] opacity-0 size-10/12", options.theme.transitions && "transition-[color,opacity] duration-200"],
|
|
2326
|
+
wrapper: "ms-2",
|
|
2327
|
+
label: "block font-medium text-[var(--ui-text)]",
|
|
2328
|
+
description: "text-[var(--ui-text-muted)]"
|
|
2329
|
+
},
|
|
2330
|
+
variants: {
|
|
2331
|
+
color: {
|
|
2332
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2333
|
+
base: `data-[state=checked]:bg-[var(--ui-${color})] focus-visible:ring-[var(--ui-${color})]`,
|
|
2334
|
+
icon: `group-data-[state=checked]:text-[var(--ui-${color})]`
|
|
2335
|
+
}])),
|
|
2336
|
+
neutral: {
|
|
2337
|
+
base: "data-[state=checked]:bg-[var(--ui-bg-inverted)] focus-visible:ring-[var(--ui-border-inverted)]",
|
|
2338
|
+
icon: "group-data-[state=checked]:text-[var(--ui-text-highlighted)]"
|
|
2339
|
+
}
|
|
2340
|
+
},
|
|
2341
|
+
size: {
|
|
2342
|
+
xs: {
|
|
2343
|
+
base: "w-7",
|
|
2344
|
+
container: "h-4",
|
|
2345
|
+
thumb: "size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",
|
|
2346
|
+
wrapper: "text-xs"
|
|
2347
|
+
},
|
|
2348
|
+
sm: {
|
|
2349
|
+
base: "w-8",
|
|
2350
|
+
container: "h-4",
|
|
2351
|
+
thumb: "size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5",
|
|
2352
|
+
wrapper: "text-xs"
|
|
2353
|
+
},
|
|
2354
|
+
md: {
|
|
2355
|
+
base: "w-9",
|
|
2356
|
+
container: "h-5",
|
|
2357
|
+
thumb: "size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",
|
|
2358
|
+
wrapper: "text-sm"
|
|
2359
|
+
},
|
|
2360
|
+
lg: {
|
|
2361
|
+
base: "w-10",
|
|
2362
|
+
container: "h-5",
|
|
2363
|
+
thumb: "size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5",
|
|
2364
|
+
wrapper: "text-sm"
|
|
2365
|
+
},
|
|
2366
|
+
xl: {
|
|
2367
|
+
base: "w-11",
|
|
2368
|
+
container: "h-6",
|
|
2369
|
+
thumb: "size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5",
|
|
2370
|
+
wrapper: "text-base"
|
|
2371
|
+
}
|
|
2372
|
+
},
|
|
2373
|
+
checked: {
|
|
2374
|
+
true: {
|
|
2375
|
+
icon: "group-data-[state=checked]:opacity-100"
|
|
2376
|
+
}
|
|
2377
|
+
},
|
|
2378
|
+
unchecked: {
|
|
2379
|
+
true: {
|
|
2380
|
+
icon: "group-data-[state=unchecked]:opacity-100"
|
|
2381
|
+
}
|
|
2382
|
+
},
|
|
2383
|
+
loading: {
|
|
2384
|
+
true: {
|
|
2385
|
+
icon: "animate-spin"
|
|
2386
|
+
}
|
|
2387
|
+
},
|
|
2388
|
+
required: {
|
|
2389
|
+
true: {
|
|
2390
|
+
label: "after:content-['*'] after:ms-0.5 after:text-[var(--ui-error)]"
|
|
2391
|
+
}
|
|
2392
|
+
},
|
|
2393
|
+
disabled: {
|
|
2394
|
+
true: {
|
|
2395
|
+
base: "cursor-not-allowed opacity-75",
|
|
2396
|
+
label: "cursor-not-allowed opacity-75",
|
|
2397
|
+
description: "cursor-not-allowed opacity-75"
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
},
|
|
2401
|
+
defaultVariants: {
|
|
2402
|
+
color: "primary",
|
|
2403
|
+
size: "md"
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
|
|
2407
|
+
const table = (options) => ({
|
|
2408
|
+
slots: {
|
|
2409
|
+
root: "relative overflow-auto",
|
|
2410
|
+
base: "min-w-full overflow-clip",
|
|
2411
|
+
thead: "relative [&>tr]:after:absolute [&>tr]:after:inset-x-0 [&>tr]:after:bottom-0 [&>tr]:after:h-px [&>tr]:after:bg-[var(--ui-border-accented)]",
|
|
2412
|
+
tbody: "divide-y divide-[var(--ui-border)]",
|
|
2413
|
+
tr: "data-[selected=true]:bg-[var(--ui-bg-elevated)]/50",
|
|
2414
|
+
th: "px-4 py-3.5 text-sm text-[var(--ui-text-highlighted)] text-left rtl:text-right font-semibold [&:has([role=checkbox])]:pe-0",
|
|
2415
|
+
td: "p-4 text-sm text-[var(--ui-text-muted)] whitespace-nowrap [&:has([role=checkbox])]:pe-0",
|
|
2416
|
+
empty: "py-6 text-center text-sm text-[var(--ui-text-muted)]"
|
|
2417
|
+
},
|
|
2418
|
+
variants: {
|
|
2419
|
+
pinned: {
|
|
2420
|
+
true: {
|
|
2421
|
+
th: "sticky bg-[var(--ui-bg)]/75 data-[pinned=left]:left-0 data-[pinned=right]:right-0",
|
|
2422
|
+
td: "sticky bg-[var(--ui-bg)]/75 data-[pinned=left]:left-0 data-[pinned=right]:right-0"
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
sticky: {
|
|
2426
|
+
true: {
|
|
2427
|
+
thead: "sticky top-0 inset-x-0 bg-[var(--ui-bg)]/75 z-[1] backdrop-blur"
|
|
2428
|
+
}
|
|
2429
|
+
},
|
|
2430
|
+
loading: {
|
|
2431
|
+
true: {
|
|
2432
|
+
thead: "after:absolute after:bottom-0 after:inset-x-0 after:h-px"
|
|
2433
|
+
}
|
|
2434
|
+
},
|
|
2435
|
+
loadingAnimation: {
|
|
2436
|
+
"carousel": "",
|
|
2437
|
+
"carousel-inverse": "",
|
|
2438
|
+
"swing": "",
|
|
2439
|
+
"elastic": ""
|
|
2440
|
+
},
|
|
2441
|
+
loadingColor: {
|
|
2442
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
2443
|
+
neutral: ""
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
compoundVariants: [...(options.theme.colors || []).map((loadingColor) => ({
|
|
2447
|
+
loading: true,
|
|
2448
|
+
loadingColor,
|
|
2449
|
+
class: {
|
|
2450
|
+
thead: `after:bg-[var(--ui-${loadingColor})]`
|
|
2451
|
+
}
|
|
2452
|
+
})), {
|
|
2453
|
+
loading: true,
|
|
2454
|
+
loadingColor: "neutral",
|
|
2455
|
+
class: {
|
|
2456
|
+
thead: "after:bg-[var(--ui-bg-inverted)]"
|
|
2457
|
+
}
|
|
2458
|
+
}, {
|
|
2459
|
+
loading: true,
|
|
2460
|
+
loadingAnimation: "carousel",
|
|
2461
|
+
class: {
|
|
2462
|
+
thead: "after:animate-[carousel_2s_ease-in-out_infinite]"
|
|
2463
|
+
}
|
|
2464
|
+
}, {
|
|
2465
|
+
loading: true,
|
|
2466
|
+
loadingAnimation: "carousel-inverse",
|
|
2467
|
+
class: {
|
|
2468
|
+
thead: "after:animate-[carousel-inverse_2s_ease-in-out_infinite]"
|
|
2469
|
+
}
|
|
2470
|
+
}, {
|
|
2471
|
+
loading: true,
|
|
2472
|
+
loadingAnimation: "swing",
|
|
2473
|
+
class: {
|
|
2474
|
+
thead: "after:animate-[swing_2s_ease-in-out_infinite]"
|
|
2475
|
+
}
|
|
2476
|
+
}, {
|
|
2477
|
+
loading: true,
|
|
2478
|
+
loadingAnimation: "elastic",
|
|
2479
|
+
class: {
|
|
2480
|
+
thead: "after:animate-[elastic_2s_ease-in-out_infinite]"
|
|
2481
|
+
}
|
|
2482
|
+
}],
|
|
2483
|
+
defaultVariants: {
|
|
2484
|
+
loadingColor: "primary",
|
|
2485
|
+
loadingAnimation: "carousel"
|
|
2486
|
+
}
|
|
2487
|
+
});
|
|
2488
|
+
|
|
2489
|
+
const tabs = (options) => ({
|
|
2490
|
+
slots: {
|
|
2491
|
+
root: "flex items-center gap-2",
|
|
2492
|
+
list: "relative flex p-1 group",
|
|
2493
|
+
indicator: "absolute transition-[translate,width] duration-200",
|
|
2494
|
+
trigger: ["relative inline-flex items-center shrink-0 data-[state=inactive]:text-[var(--ui-text-muted)] hover:data-[state=inactive]:text-[var(--ui-text)] font-medium rounded-[calc(var(--ui-radius)*1.5)] disabled:cursor-not-allowed disabled:opacity-75 focus:outline-none", options.theme.transitions && "transition-colors"],
|
|
2495
|
+
content: "focus:outline-none w-full",
|
|
2496
|
+
leadingIcon: "shrink-0",
|
|
2497
|
+
leadingAvatar: "shrink-0",
|
|
2498
|
+
leadingAvatarSize: "",
|
|
2499
|
+
label: "truncate"
|
|
2500
|
+
},
|
|
2501
|
+
variants: {
|
|
2502
|
+
color: {
|
|
2503
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
|
|
2504
|
+
neutral: ""
|
|
2505
|
+
},
|
|
2506
|
+
variant: {
|
|
2507
|
+
pill: {
|
|
2508
|
+
list: "bg-[var(--ui-bg-elevated)] rounded-[calc(var(--ui-radius)*2)]",
|
|
2509
|
+
trigger: "flex-1 w-full",
|
|
2510
|
+
indicator: "rounded-[calc(var(--ui-radius)*1.5)] shadow-sm"
|
|
2511
|
+
},
|
|
2512
|
+
link: {
|
|
2513
|
+
list: "border-[var(--ui-border)]",
|
|
2514
|
+
indicator: "rounded-full"
|
|
2515
|
+
}
|
|
2516
|
+
},
|
|
2517
|
+
orientation: {
|
|
2518
|
+
horizontal: {
|
|
2519
|
+
root: "flex-col",
|
|
2520
|
+
list: "w-full",
|
|
2521
|
+
indicator: "left-0 w-[var(--radix-tabs-indicator-size)] translate-x-[var(--radix-tabs-indicator-position)]",
|
|
2522
|
+
trigger: "justify-center"
|
|
2523
|
+
},
|
|
2524
|
+
vertical: {
|
|
2525
|
+
list: "flex-col",
|
|
2526
|
+
indicator: "top-0 h-[var(--radix-tabs-indicator-size)] translate-y-[var(--radix-tabs-indicator-position)]"
|
|
2527
|
+
}
|
|
2528
|
+
},
|
|
2529
|
+
size: {
|
|
2530
|
+
xs: {
|
|
2531
|
+
trigger: "px-2 py-1 text-xs gap-1",
|
|
2532
|
+
leadingIcon: "size-4",
|
|
2533
|
+
leadingAvatarSize: "3xs"
|
|
2534
|
+
},
|
|
2535
|
+
sm: {
|
|
2536
|
+
trigger: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
2537
|
+
leadingIcon: "size-4",
|
|
2538
|
+
leadingAvatarSize: "3xs"
|
|
2539
|
+
},
|
|
2540
|
+
md: {
|
|
2541
|
+
trigger: "px-3 py-1.5 text-sm gap-1.5",
|
|
2542
|
+
leadingIcon: "size-5",
|
|
2543
|
+
leadingAvatarSize: "2xs"
|
|
2544
|
+
},
|
|
2545
|
+
lg: {
|
|
2546
|
+
trigger: "px-3 py-2 text-sm gap-2",
|
|
2547
|
+
leadingIcon: "size-5",
|
|
2548
|
+
leadingAvatarSize: "2xs"
|
|
2549
|
+
},
|
|
2550
|
+
xl: {
|
|
2551
|
+
trigger: "px-3 py-2 text-base gap-2",
|
|
2552
|
+
leadingIcon: "size-6",
|
|
2553
|
+
leadingAvatarSize: "xs"
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
compoundVariants: [{
|
|
2558
|
+
orientation: "horizontal",
|
|
2559
|
+
variant: "pill",
|
|
2560
|
+
class: {
|
|
2561
|
+
indicator: "inset-y-1"
|
|
2562
|
+
}
|
|
2563
|
+
}, {
|
|
2564
|
+
orientation: "horizontal",
|
|
2565
|
+
variant: "link",
|
|
2566
|
+
class: {
|
|
2567
|
+
list: "border-b -mb-px",
|
|
2568
|
+
indicator: "-bottom-px h-px"
|
|
2569
|
+
}
|
|
2570
|
+
}, {
|
|
2571
|
+
orientation: "vertical",
|
|
2572
|
+
variant: "pill",
|
|
2573
|
+
class: {
|
|
2574
|
+
indicator: "inset-x-1",
|
|
2575
|
+
list: "items-center"
|
|
2576
|
+
}
|
|
2577
|
+
}, {
|
|
2578
|
+
orientation: "vertical",
|
|
2579
|
+
variant: "link",
|
|
2580
|
+
class: {
|
|
2581
|
+
list: "border-s -ms-px",
|
|
2582
|
+
indicator: "-start-px w-px"
|
|
2583
|
+
}
|
|
2584
|
+
}, ...(options.theme.colors || []).map((color) => ({
|
|
2585
|
+
color,
|
|
2586
|
+
variant: "pill",
|
|
2587
|
+
class: {
|
|
2588
|
+
indicator: `bg-[var(--ui-${color})]`,
|
|
2589
|
+
trigger: `data-[state=active]:text-[var(--ui-bg)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-${color})]`
|
|
2590
|
+
}
|
|
2591
|
+
})), {
|
|
2592
|
+
color: "neutral",
|
|
2593
|
+
variant: "pill",
|
|
2594
|
+
class: {
|
|
2595
|
+
indicator: "bg-[var(--ui-bg-inverted)]",
|
|
2596
|
+
trigger: "data-[state=active]:text-[var(--ui-bg)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ui-border-inverted)]"
|
|
2597
|
+
}
|
|
2598
|
+
}, ...(options.theme.colors || []).map((color) => ({
|
|
2599
|
+
color,
|
|
2600
|
+
variant: "link",
|
|
2601
|
+
class: {
|
|
2602
|
+
indicator: `bg-[var(--ui-${color})]`,
|
|
2603
|
+
trigger: `data-[state=active]:text-[var(--ui-${color})] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-${color})]`
|
|
2604
|
+
}
|
|
2605
|
+
})), {
|
|
2606
|
+
color: "neutral",
|
|
2607
|
+
variant: "link",
|
|
2608
|
+
class: {
|
|
2609
|
+
indicator: "bg-[var(--ui-bg-inverted)]",
|
|
2610
|
+
trigger: "data-[state=active]:text-[var(--ui-text-highlighted)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-border-inverted)]"
|
|
2611
|
+
}
|
|
2612
|
+
}],
|
|
2613
|
+
defaultVariants: {
|
|
2614
|
+
color: "primary",
|
|
2615
|
+
variant: "pill",
|
|
2616
|
+
size: "md"
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2619
|
+
|
|
2620
|
+
const textarea = (options) => {
|
|
2621
|
+
return input(options);
|
|
2622
|
+
};
|
|
2623
|
+
|
|
2624
|
+
const toast = (options) => ({
|
|
2625
|
+
slots: {
|
|
2626
|
+
root: "relative group overflow-hidden bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*2)] ring ring-[var(--ui-border)] p-4 flex gap-2.5 focus:outline-none",
|
|
2627
|
+
wrapper: "w-0 flex-1 flex flex-col gap-1",
|
|
2628
|
+
title: "text-sm font-medium text-[var(--ui-text-highlighted)]",
|
|
2629
|
+
description: "text-sm text-[var(--ui-text-muted)]",
|
|
2630
|
+
icon: "shrink-0 size-5",
|
|
2631
|
+
avatar: "shrink-0",
|
|
2632
|
+
avatarSize: "2xl",
|
|
2633
|
+
actions: "flex gap-1.5 shrink-0",
|
|
2634
|
+
progress: "absolute inset-x-0 bottom-0 h-1 z-[-1]",
|
|
2635
|
+
close: "p-0.5"
|
|
2636
|
+
},
|
|
2637
|
+
variants: {
|
|
2638
|
+
color: {
|
|
2639
|
+
...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
|
|
2640
|
+
root: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-${color})]`,
|
|
2641
|
+
icon: `text-[var(--ui-${color})]`,
|
|
2642
|
+
progress: `bg-[var(--ui-${color})]`
|
|
2643
|
+
}])),
|
|
2644
|
+
neutral: {
|
|
2645
|
+
root: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ui-border-inverted)]",
|
|
2646
|
+
icon: "text-[var(--ui-text-highlighted)]",
|
|
2647
|
+
progress: "bg-[var(--ui-bg-inverted)]"
|
|
2648
|
+
}
|
|
2649
|
+
},
|
|
2650
|
+
multiline: {
|
|
2651
|
+
true: {
|
|
2652
|
+
root: "items-start",
|
|
2653
|
+
actions: "items-start mt-1"
|
|
2654
|
+
},
|
|
2655
|
+
false: {
|
|
2656
|
+
root: "items-center",
|
|
2657
|
+
actions: "items-center"
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
},
|
|
2661
|
+
defaultVariants: {
|
|
2662
|
+
color: "primary"
|
|
2663
|
+
}
|
|
2664
|
+
});
|
|
2665
|
+
|
|
2666
|
+
const toaster = {
|
|
2667
|
+
slots: {
|
|
2668
|
+
viewport: "fixed flex flex-col w-[calc(100%-2rem)] sm:w-96 z-[100] data-[expanded=true]:h-[var(--height)] focus:outline-none",
|
|
2669
|
+
base: "absolute inset-x-0 z-[var(--index)] transform-[var(--transform)] data-[expanded=false]:data-[front=false]:h-[var(--front-height)] data-[expanded=false]:data-[front=false]:*:invisible data-[state=closed]:animate-[toast-closed_200ms_ease-in-out] data-[state=closed]:data-[expanded=false]:data-[front=false]:animate-[toast-collapsed-closed_200ms_ease-in-out] data-[swipe=move]:transition-none transition-[transform,translate,height] duration-200 ease-out"
|
|
2670
|
+
},
|
|
2671
|
+
variants: {
|
|
2672
|
+
position: {
|
|
2673
|
+
"top-left": {
|
|
2674
|
+
viewport: "left-4"
|
|
2675
|
+
},
|
|
2676
|
+
"top-center": {
|
|
2677
|
+
viewport: "left-1/2 transform -translate-x-1/2"
|
|
2678
|
+
},
|
|
2679
|
+
"top-right": {
|
|
2680
|
+
viewport: "right-4"
|
|
2681
|
+
},
|
|
2682
|
+
"bottom-left": {
|
|
2683
|
+
viewport: "left-4"
|
|
2684
|
+
},
|
|
2685
|
+
"bottom-center": {
|
|
2686
|
+
viewport: "left-1/2 transform -translate-x-1/2"
|
|
2687
|
+
},
|
|
2688
|
+
"bottom-right": {
|
|
2689
|
+
viewport: "right-4"
|
|
2690
|
+
}
|
|
2691
|
+
},
|
|
2692
|
+
swipeDirection: {
|
|
2693
|
+
up: "data-[swipe=end]:animate-[toast-slide-up_200ms_ease-out]",
|
|
2694
|
+
right: "data-[swipe=end]:animate-[toast-slide-right_200ms_ease-out]",
|
|
2695
|
+
down: "data-[swipe=end]:animate-[toast-slide-down_200ms_ease-out]",
|
|
2696
|
+
left: "data-[swipe=end]:animate-[toast-slide-left_200ms_ease-out]"
|
|
2697
|
+
}
|
|
2698
|
+
},
|
|
2699
|
+
compoundVariants: [{
|
|
2700
|
+
position: ["top-left", "top-center", "top-right"],
|
|
2701
|
+
class: {
|
|
2702
|
+
viewport: "top-4",
|
|
2703
|
+
base: "top-0 data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out]"
|
|
2704
|
+
}
|
|
2705
|
+
}, {
|
|
2706
|
+
position: ["bottom-left", "bottom-center", "bottom-right"],
|
|
2707
|
+
class: {
|
|
2708
|
+
viewport: "bottom-4",
|
|
2709
|
+
base: "bottom-0 data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out]"
|
|
2710
|
+
}
|
|
2711
|
+
}, {
|
|
2712
|
+
swipeDirection: ["left", "right"],
|
|
2713
|
+
class: "data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=cancel]:translate-x-0"
|
|
2714
|
+
}, {
|
|
2715
|
+
swipeDirection: ["up", "down"],
|
|
2716
|
+
class: "data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] data-[swipe=cancel]:translate-y-0"
|
|
2717
|
+
}],
|
|
2718
|
+
defaultVariants: {
|
|
2719
|
+
position: "bottom-right"
|
|
2720
|
+
}
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
const tooltip = {
|
|
2724
|
+
slots: {
|
|
2725
|
+
content: "flex items-center gap-1 bg-[var(--ui-bg)] text-[var(--ui-text-highlighted)] shadow rounded-[var(--ui-radius)] ring ring-[var(--ui-border)] h-6 px-2 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]",
|
|
2726
|
+
arrow: "fill-[var(--ui-border)]",
|
|
2727
|
+
text: "truncate",
|
|
2728
|
+
kbds: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['\xB7'] before:me-0.5`,
|
|
2729
|
+
kbdsSize: "sm"
|
|
2730
|
+
}
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
const theme = {
|
|
2734
|
+
__proto__: null,
|
|
2735
|
+
accordion: accordion,
|
|
2736
|
+
alert: alert,
|
|
2737
|
+
avatar: avatar,
|
|
2738
|
+
avatarGroup: avatarGroup,
|
|
2739
|
+
badge: badge,
|
|
2740
|
+
breadcrumb: breadcrumb,
|
|
2741
|
+
button: button,
|
|
2742
|
+
buttonGroup: buttonGroup,
|
|
2743
|
+
card: card,
|
|
2744
|
+
carousel: carousel,
|
|
2745
|
+
checkbox: checkbox,
|
|
2746
|
+
chip: chip,
|
|
2747
|
+
collapsible: collapsible,
|
|
2748
|
+
commandPalette: commandPalette,
|
|
2749
|
+
container: container,
|
|
2750
|
+
contextMenu: contextMenu,
|
|
2751
|
+
drawer: drawer,
|
|
2752
|
+
dropdownMenu: dropdownMenu,
|
|
2753
|
+
form: form,
|
|
2754
|
+
formField: formField,
|
|
2755
|
+
input: input,
|
|
2756
|
+
inputMenu: inputMenu,
|
|
2757
|
+
kbd: kbd,
|
|
2758
|
+
link: link,
|
|
2759
|
+
modal: modal,
|
|
2760
|
+
navigationMenu: navigationMenu,
|
|
2761
|
+
pagination: pagination,
|
|
2762
|
+
popover: popover,
|
|
2763
|
+
progress: progress,
|
|
2764
|
+
radioGroup: radioGroup,
|
|
2765
|
+
select: select,
|
|
2766
|
+
selectMenu: selectMenu,
|
|
2767
|
+
separator: separator,
|
|
2768
|
+
skeleton: skeleton,
|
|
2769
|
+
slideover: slideover,
|
|
2770
|
+
slider: slider,
|
|
2771
|
+
switch: _switch,
|
|
2772
|
+
table: table,
|
|
2773
|
+
tabs: tabs,
|
|
2774
|
+
textarea: textarea,
|
|
2775
|
+
toast: toast,
|
|
2776
|
+
toaster: toaster,
|
|
2777
|
+
tooltip: tooltip
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
function buildTemplates(options) {
|
|
2781
|
+
return Object.entries(theme).reduce((acc, [key, component]) => {
|
|
2782
|
+
acc[key] = typeof component === "function" ? component(options) : component;
|
|
2783
|
+
return acc;
|
|
2784
|
+
}, {});
|
|
2785
|
+
}
|
|
2786
|
+
function getTemplates(options, uiConfig) {
|
|
2787
|
+
const templates = [];
|
|
2788
|
+
for (const component in theme) {
|
|
2789
|
+
templates.push({
|
|
2790
|
+
filename: `ui/${kebabCase(component)}.ts`,
|
|
2791
|
+
write: true,
|
|
2792
|
+
getContents: async () => {
|
|
2793
|
+
const template = theme[component];
|
|
2794
|
+
const result = typeof template === "function" ? template(options) : template;
|
|
2795
|
+
const variants = Object.keys(result.variants || {});
|
|
2796
|
+
let json = JSON.stringify(result, null, 2);
|
|
2797
|
+
for (const variant of variants) {
|
|
2798
|
+
json = json.replace(new RegExp(`("${variant}": "[^"]+")`, "g"), "$1 as const");
|
|
2799
|
+
json = json.replace(new RegExp(`("${variant}": \\[\\s*)((?:"[^"]+",?\\s*)+)(\\])`, "g"), (_, before, match, after) => {
|
|
2800
|
+
const replaced = match.replace(/("[^"]+")/g, "$1 as const");
|
|
2801
|
+
return `${before}${replaced}${after}`;
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
return `export default ${json}`;
|
|
2805
|
+
}
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
templates.push({
|
|
2809
|
+
filename: "ui/index.ts",
|
|
2810
|
+
write: true,
|
|
2811
|
+
getContents: () => Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
|
|
2812
|
+
});
|
|
2813
|
+
templates.push({
|
|
2814
|
+
filename: "types/ui.d.ts",
|
|
2815
|
+
getContents: () => `import * as ui from '#build/ui'
|
|
2816
|
+
import type { DeepPartial } from '#ui/types/utils'
|
|
2817
|
+
import colors from 'tailwindcss/colors'
|
|
2818
|
+
|
|
2819
|
+
const icons = ${JSON.stringify(uiConfig.icons)};
|
|
2820
|
+
|
|
2821
|
+
type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'
|
|
2822
|
+
type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor>
|
|
2823
|
+
|
|
2824
|
+
type AppConfigUI = {
|
|
2825
|
+
colors?: {
|
|
2826
|
+
${options.theme?.colors?.map((color) => `${color}?: Color`).join("\n ")}
|
|
2827
|
+
neutral?: NeutralColor
|
|
2828
|
+
}
|
|
2829
|
+
icons?: Partial<typeof icons>
|
|
2830
|
+
} & DeepPartial<typeof ui>
|
|
2831
|
+
|
|
2832
|
+
declare module '@nuxt/schema' {
|
|
2833
|
+
interface AppConfigInput {
|
|
2834
|
+
ui?: AppConfigUI
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
export {}
|
|
2839
|
+
`
|
|
2840
|
+
});
|
|
2841
|
+
templates.push({
|
|
2842
|
+
filename: "ui-image-component.ts",
|
|
2843
|
+
write: true,
|
|
2844
|
+
getContents: ({ app }) => {
|
|
2845
|
+
const image = app?.components?.find((c) => c.pascalName === "NuxtImg" && !c.filePath.includes("nuxt/dist/app"));
|
|
2846
|
+
return image ? `export { default } from "${image.filePath}"` : 'export default "img"';
|
|
2847
|
+
}
|
|
2848
|
+
});
|
|
2849
|
+
return templates;
|
|
2850
|
+
}
|
|
2851
|
+
function addTemplates(options, nuxt, resolve) {
|
|
2852
|
+
const templates = getTemplates(options, nuxt.options.appConfig.ui);
|
|
2853
|
+
for (const template of templates) {
|
|
2854
|
+
if (template.filename.endsWith(".d.ts")) {
|
|
2855
|
+
addTypeTemplate(template);
|
|
2856
|
+
} else {
|
|
2857
|
+
addTemplate(template);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
nuxt.hook("prepare:types", ({ references }) => {
|
|
2861
|
+
references.push({ path: resolve("./runtime/types/app.config.d.ts") });
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
export { getDefaultUiConfig as a, addTemplates as b, buildTemplates as c, defaultOptions as d, getTemplates as g, resolveColors as r };
|