@nuxt/ui 3.0.0-alpha.10 → 3.0.0-alpha.12
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/alert.ts +76 -59
- package/.nuxt/ui/avatar-group.ts +13 -1
- package/.nuxt/ui/avatar.ts +14 -2
- package/.nuxt/ui/badge.ts +102 -65
- package/.nuxt/ui/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +124 -93
- package/.nuxt/ui/calendar.ts +20 -2
- package/.nuxt/ui/carousel.ts +5 -3
- package/.nuxt/ui/checkbox.ts +27 -9
- package/.nuxt/ui/chip.ts +36 -7
- package/.nuxt/ui/color-picker.ts +9 -1
- package/.nuxt/ui/context-menu.ts +31 -13
- package/.nuxt/ui/drawer.ts +11 -4
- package/.nuxt/ui/dropdown-menu.ts +31 -13
- package/.nuxt/ui/form-field.ts +9 -1
- package/.nuxt/ui/input-menu.ts +110 -75
- package/.nuxt/ui/input-number.ts +82 -51
- package/.nuxt/ui/input.ts +88 -53
- package/.nuxt/ui/kbd.ts +14 -2
- package/.nuxt/ui/navigation-menu.ts +193 -79
- package/.nuxt/ui/pin-input.ts +57 -31
- package/.nuxt/ui/popover.ts +1 -1
- package/.nuxt/ui/progress.ts +93 -54
- package/.nuxt/ui/radio-group.ts +25 -2
- package/.nuxt/ui/select-menu.ts +89 -54
- package/.nuxt/ui/select.ts +89 -54
- package/.nuxt/ui/separator.ts +52 -23
- package/.nuxt/ui/slideover.ts +11 -4
- package/.nuxt/ui/slider.ts +45 -22
- package/.nuxt/ui/stepper.ts +45 -23
- package/.nuxt/ui/switch.ts +20 -2
- package/.nuxt/ui/table.ts +30 -13
- package/.nuxt/ui/tabs.ts +67 -39
- package/.nuxt/ui/textarea.ts +88 -53
- package/.nuxt/ui/toast.ts +11 -1
- package/.nuxt/ui/toaster.ts +27 -11
- package/.nuxt/ui/tooltip.ts +1 -1
- package/README.md +8 -1
- package/cli/commands/make/component.mjs +12 -0
- package/cli/package.json +2 -2
- package/cli/templates.mjs +21 -16
- package/dist/chunks/component-meta.cjs +2590 -2511
- package/dist/chunks/component-meta.mjs +2590 -2511
- package/dist/client/devtools/200.html +1 -1
- package/dist/client/devtools/404.html +1 -1
- package/dist/client/devtools/_nuxt/CgoQwOTV.js +57 -0
- package/dist/client/devtools/_nuxt/DLmPhbaq.js +1 -0
- package/dist/client/devtools/_nuxt/DYuJNiSW.js +1 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/client/devtools/_nuxt/builds/meta/3184ffe2-7577-4441-af98-fe6e81c30e3a.json +1 -0
- package/dist/client/devtools/_nuxt/entry.ChJczkiN.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.DyY3rYaL.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.D_1PCaJh.css +1 -0
- package/dist/client/devtools/index.html +1 -1
- package/dist/module.cjs +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Accordion.vue +4 -3
- package/dist/runtime/components/Alert.vue +5 -4
- package/dist/runtime/components/Avatar.vue +35 -13
- package/dist/runtime/components/AvatarGroup.vue +4 -3
- package/dist/runtime/components/Badge.vue +4 -3
- package/dist/runtime/components/Breadcrumb.vue +3 -3
- package/dist/runtime/components/Button.vue +4 -3
- package/dist/runtime/components/ButtonGroup.vue +4 -3
- package/dist/runtime/components/Calendar.vue +6 -3
- package/dist/runtime/components/Card.vue +3 -3
- package/dist/runtime/components/Carousel.vue +4 -3
- package/dist/runtime/components/Checkbox.vue +6 -5
- package/dist/runtime/components/Chip.vue +5 -4
- package/dist/runtime/components/Collapsible.vue +6 -4
- package/dist/runtime/components/ColorPicker.vue +48 -16
- package/dist/runtime/components/CommandPalette.vue +14 -7
- package/dist/runtime/components/Container.vue +3 -3
- package/dist/runtime/components/ContextMenu.vue +4 -3
- package/dist/runtime/components/ContextMenuContent.vue +4 -4
- package/dist/runtime/components/Drawer.vue +9 -4
- package/dist/runtime/components/DropdownMenu.vue +4 -3
- package/dist/runtime/components/DropdownMenuContent.vue +4 -4
- package/dist/runtime/components/Form.vue +59 -29
- package/dist/runtime/components/FormField.vue +14 -7
- package/dist/runtime/components/Input.vue +7 -5
- package/dist/runtime/components/InputMenu.vue +19 -7
- package/dist/runtime/components/InputNumber.vue +9 -5
- package/dist/runtime/components/Kbd.vue +4 -3
- package/dist/runtime/components/Link.vue +3 -3
- package/dist/runtime/components/Modal.vue +10 -15
- package/dist/runtime/components/NavigationMenu.vue +97 -69
- package/dist/runtime/components/Pagination.vue +3 -3
- package/dist/runtime/components/PinInput.vue +9 -7
- package/dist/runtime/components/Popover.vue +9 -8
- package/dist/runtime/components/Progress.vue +6 -5
- package/dist/runtime/components/RadioGroup.vue +6 -5
- package/dist/runtime/components/Select.vue +12 -9
- package/dist/runtime/components/SelectMenu.vue +25 -8
- package/dist/runtime/components/Separator.vue +4 -3
- package/dist/runtime/components/Skeleton.vue +3 -3
- package/dist/runtime/components/Slideover.vue +10 -14
- package/dist/runtime/components/Slider.vue +6 -5
- package/dist/runtime/components/Stepper.vue +8 -6
- package/dist/runtime/components/Switch.vue +6 -5
- package/dist/runtime/components/Table.vue +4 -3
- package/dist/runtime/components/Tabs.vue +5 -3
- package/dist/runtime/components/Textarea.vue +7 -5
- package/dist/runtime/components/Toast.vue +4 -3
- package/dist/runtime/components/Toaster.vue +4 -3
- package/dist/runtime/components/Tooltip.vue +3 -3
- package/dist/runtime/composables/defineShortcuts.js +1 -1
- package/dist/runtime/composables/useFormField.d.ts +7 -3
- package/dist/runtime/composables/useFormField.js +18 -8
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/composables/useToast.js +21 -7
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/locale/ar.js +3 -1
- package/dist/runtime/locale/cs.js +3 -1
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.js +3 -1
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.js +3 -1
- package/dist/runtime/locale/es.js +5 -3
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.js +3 -1
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.js +3 -1
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +14 -2
- package/dist/runtime/locale/index.js +14 -2
- package/dist/runtime/locale/it.js +3 -1
- package/dist/runtime/locale/ja.js +3 -1
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/ko.js +3 -1
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/nl.js +3 -1
- package/dist/runtime/locale/pl.js +3 -1
- package/dist/runtime/locale/pt.js +3 -1
- package/dist/runtime/locale/pt_br.js +3 -1
- package/dist/runtime/locale/ru.js +3 -1
- package/dist/runtime/locale/sk.js +3 -1
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.js +3 -1
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +4 -2
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +12 -10
- package/dist/runtime/plugins/colors.js +7 -4
- package/dist/runtime/types/form.d.ts +23 -14
- package/dist/runtime/types/form.js +2 -2
- package/dist/runtime/types/locale.d.ts +2 -0
- package/dist/runtime/utils/form.d.ts +2 -2
- package/dist/runtime/utils/form.js +5 -7
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Link.vue +2 -2
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +3 -3
- package/dist/shared/{ui.D_93iuwH.mjs → ui.CENZ17mM.mjs} +131 -48
- package/dist/shared/{ui.CwmIkD_Y.cjs → ui.ClMXjgLK.cjs} +131 -48
- package/dist/unplugin.cjs +5 -5
- package/dist/unplugin.mjs +5 -5
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +55 -51
- package/dist/client/devtools/_nuxt/B1fTd_Rf.js +0 -1
- package/dist/client/devtools/_nuxt/CSUxkedg.js +0 -1
- package/dist/client/devtools/_nuxt/CbRTGpb7.js +0 -1
- package/dist/client/devtools/_nuxt/YQTlxbcT.js +0 -53
- package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +0 -1
- package/dist/client/devtools/_nuxt/entry.DXXceQev.css +0 -1
- package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +0 -1
- /package/dist/runtime/locale/{zh_hans.d.ts → da.d.ts} +0 -0
- /package/dist/runtime/locale/{zh_hant.d.ts → el.d.ts} +0 -0
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { ComputedRef, DeepReadonly, Ref } from 'vue';
|
|
3
3
|
import type { ZodSchema } from 'zod';
|
|
4
4
|
import type { Schema as JoiSchema } from 'joi';
|
|
5
5
|
import type { ObjectSchema as YupObjectSchema } from 'yup';
|
|
6
6
|
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
7
7
|
import type { GetObjectField } from './utils';
|
|
8
8
|
import type { Struct as SuperstructSchema } from 'superstruct';
|
|
9
|
-
export interface Form<T> {
|
|
9
|
+
export interface Form<T extends object> {
|
|
10
10
|
validate(opts?: {
|
|
11
|
-
name
|
|
12
|
-
silent?:
|
|
11
|
+
name?: keyof T | (keyof T)[];
|
|
12
|
+
silent?: boolean;
|
|
13
13
|
nested?: boolean;
|
|
14
|
+
transform?: boolean;
|
|
14
15
|
}): Promise<T | false>;
|
|
15
16
|
clear(path?: string): void;
|
|
16
17
|
errors: Ref<FormError[]>;
|
|
17
|
-
setErrors(errs: FormError[],
|
|
18
|
-
getErrors(
|
|
18
|
+
setErrors(errs: FormError[], name?: keyof T): void;
|
|
19
|
+
getErrors(name?: keyof T): FormError[];
|
|
19
20
|
submit(): Promise<void>;
|
|
20
21
|
disabled: ComputedRef<boolean>;
|
|
22
|
+
dirty: ComputedRef<boolean>;
|
|
23
|
+
dirtyFields: DeepReadonly<Set<keyof T>>;
|
|
24
|
+
touchedFields: DeepReadonly<Set<keyof T>>;
|
|
25
|
+
blurredFields: DeepReadonly<Set<keyof T>>;
|
|
21
26
|
}
|
|
22
|
-
export type FormSchema<T extends
|
|
23
|
-
export type FormInputEvents = 'input' | 'blur' | 'change';
|
|
27
|
+
export type FormSchema<T extends object> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
|
|
28
|
+
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
24
29
|
export interface FormError<P extends string = string> {
|
|
25
30
|
name: P;
|
|
26
31
|
message: string;
|
|
@@ -33,7 +38,7 @@ export type FormSubmitEvent<T> = SubmitEvent & {
|
|
|
33
38
|
};
|
|
34
39
|
export type FormValidationError = {
|
|
35
40
|
errors: FormErrorWithId[];
|
|
36
|
-
|
|
41
|
+
children?: FormValidationError[];
|
|
37
42
|
};
|
|
38
43
|
export type FormErrorEvent = SubmitEvent & FormValidationError;
|
|
39
44
|
export type FormEventType = FormInputEvents;
|
|
@@ -46,11 +51,12 @@ export type FormChildDetachEvent = {
|
|
|
46
51
|
type: 'detach';
|
|
47
52
|
formId: string | number;
|
|
48
53
|
};
|
|
49
|
-
export type FormInputEvent = {
|
|
54
|
+
export type FormInputEvent<T extends object> = {
|
|
50
55
|
type: FormEventType;
|
|
51
|
-
name
|
|
56
|
+
name: keyof T;
|
|
57
|
+
eager?: boolean;
|
|
52
58
|
};
|
|
53
|
-
export type FormEvent = FormInputEvent | FormChildAttachEvent | FormChildDetachEvent;
|
|
59
|
+
export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
|
|
54
60
|
export interface FormInjectedOptions {
|
|
55
61
|
disabled?: boolean;
|
|
56
62
|
validateOnInputDelay?: number;
|
|
@@ -62,6 +68,9 @@ export interface FormFieldInjectedOptions<T> {
|
|
|
62
68
|
eagerValidation?: boolean;
|
|
63
69
|
validateOnInputDelay?: number;
|
|
64
70
|
errorPattern?: RegExp;
|
|
71
|
+
hint?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
ariaId: string;
|
|
65
74
|
}
|
|
66
75
|
export interface ValidateReturnSchema<T> {
|
|
67
76
|
result: T;
|
|
@@ -70,6 +79,6 @@ export interface ValidateReturnSchema<T> {
|
|
|
70
79
|
export declare class FormValidationException extends Error {
|
|
71
80
|
formId: string | number;
|
|
72
81
|
errors: FormErrorWithId[];
|
|
73
|
-
|
|
74
|
-
constructor(formId: string | number, errors: FormErrorWithId[], childErrors
|
|
82
|
+
children?: FormValidationException[];
|
|
83
|
+
constructor(formId: string | number, errors: FormErrorWithId[], childErrors?: FormValidationException[]);
|
|
75
84
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export class FormValidationException extends Error {
|
|
2
2
|
formId;
|
|
3
3
|
errors;
|
|
4
|
-
|
|
4
|
+
children;
|
|
5
5
|
constructor(formId, errors, childErrors) {
|
|
6
6
|
super("Form validation exception");
|
|
7
7
|
this.formId = formId;
|
|
8
8
|
this.errors = errors;
|
|
9
|
-
this.
|
|
9
|
+
this.children = childErrors;
|
|
10
10
|
Object.setPrototypeOf(this, FormValidationException.prototype);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -15,6 +15,7 @@ export type Messages = {
|
|
|
15
15
|
decrement: string;
|
|
16
16
|
};
|
|
17
17
|
commandPalette: {
|
|
18
|
+
placeholder: string;
|
|
18
19
|
noMatch: string;
|
|
19
20
|
noData: string;
|
|
20
21
|
close: string;
|
|
@@ -23,6 +24,7 @@ export type Messages = {
|
|
|
23
24
|
noMatch: string;
|
|
24
25
|
noData: string;
|
|
25
26
|
create: string;
|
|
27
|
+
search: string;
|
|
26
28
|
};
|
|
27
29
|
toast: {
|
|
28
30
|
close: string;
|
|
@@ -13,5 +13,5 @@ export declare function isJoiSchema(schema: any): schema is JoiSchema;
|
|
|
13
13
|
export declare function isJoiError(error: any): error is JoiError;
|
|
14
14
|
export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
|
|
15
15
|
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
16
|
+
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
17
|
+
export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -22,10 +22,8 @@ export function isValibotSchema(schema) {
|
|
|
22
22
|
export function isStandardSchema(schema) {
|
|
23
23
|
return "~standard" in schema;
|
|
24
24
|
}
|
|
25
|
-
export async function
|
|
26
|
-
const result = await schema["~standard"].validate(
|
|
27
|
-
value: state
|
|
28
|
-
});
|
|
25
|
+
export async function validateStandardSchema(state, schema) {
|
|
26
|
+
const result = await schema["~standard"].validate(state);
|
|
29
27
|
if (result.issues) {
|
|
30
28
|
return {
|
|
31
29
|
errors: result.issues?.map((issue) => ({
|
|
@@ -136,19 +134,19 @@ async function validateValibotSchema(state, schema) {
|
|
|
136
134
|
result: null
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
|
-
export function
|
|
137
|
+
export function validateSchema(state, schema) {
|
|
140
138
|
if (isZodSchema(schema)) {
|
|
141
139
|
return validateZodSchema(state, schema);
|
|
142
140
|
} else if (isJoiSchema(schema)) {
|
|
143
141
|
return validateJoiSchema(state, schema);
|
|
142
|
+
} else if (isStandardSchema(schema)) {
|
|
143
|
+
return validateStandardSchema(state, schema);
|
|
144
144
|
} else if (isValibotSchema(schema)) {
|
|
145
145
|
return validateValibotSchema(state, schema);
|
|
146
146
|
} else if (isYupSchema(schema)) {
|
|
147
147
|
return validateYupSchema(state, schema);
|
|
148
148
|
} else if (isSuperStructSchema(schema)) {
|
|
149
149
|
return validateSuperstructSchema(state, schema);
|
|
150
|
-
} else if (isStandardSchema(schema)) {
|
|
151
|
-
return validateStandarSchema(state, schema);
|
|
152
150
|
} else {
|
|
153
151
|
throw new Error("Form validation failed: Unsupported form schema");
|
|
154
152
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tv: import("tailwind-variants").CreateTV<boolean | (string | number | symbol)[] | {} | undefined>;
|
|
@@ -5,11 +5,11 @@ export interface IconProps {
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { Icon } from '@iconify/vue'
|
|
8
|
+
import { Icon as IconifyIcon } from '@iconify/vue'
|
|
9
9
|
|
|
10
10
|
defineProps<IconProps>()
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<
|
|
14
|
+
<IconifyIcon :icon="name.replace(/^i-/, '')" />
|
|
15
15
|
</template>
|
|
@@ -52,9 +52,9 @@ interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
|
52
52
|
noPrefetch?: boolean
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
56
56
|
|
|
57
|
-
const link = tv({ extend: tv(theme), ...(
|
|
57
|
+
const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) })
|
|
58
58
|
|
|
59
59
|
export interface LinkProps extends NuxtLinkProps {
|
|
60
60
|
/**
|
|
@@ -40,7 +40,7 @@ const defaultOptions = {
|
|
|
40
40
|
fonts: true,
|
|
41
41
|
colorMode: true,
|
|
42
42
|
theme: {
|
|
43
|
-
colors:
|
|
43
|
+
colors: undefined,
|
|
44
44
|
transitions: true
|
|
45
45
|
},
|
|
46
46
|
devtools: {
|
|
@@ -81,7 +81,7 @@ const alert = (options) => ({
|
|
|
81
81
|
icon: "shrink-0 size-5",
|
|
82
82
|
avatar: "shrink-0",
|
|
83
83
|
avatarSize: "2xl",
|
|
84
|
-
actions: "flex gap-1.5 shrink-0",
|
|
84
|
+
actions: "flex flex-wrap gap-1.5 shrink-0",
|
|
85
85
|
close: "p-0.5"
|
|
86
86
|
},
|
|
87
87
|
variants: {
|
|
@@ -164,7 +164,7 @@ const alert = (options) => ({
|
|
|
164
164
|
const avatar = {
|
|
165
165
|
slots: {
|
|
166
166
|
root: "inline-flex items-center justify-center shrink-0 select-none overflow-hidden rounded-full align-middle bg-[var(--ui-bg-elevated)]",
|
|
167
|
-
image: "h-full w-full rounded-[inherit] object-cover",
|
|
167
|
+
image: "h-full w-full rounded-[inherit] object-cover data-[error]:hidden",
|
|
168
168
|
fallback: "font-medium leading-none text-[var(--ui-text-muted)] truncate",
|
|
169
169
|
icon: "text-[var(--ui-text-muted)] shrink-0"
|
|
170
170
|
},
|
|
@@ -247,7 +247,7 @@ const avatarGroup = {
|
|
|
247
247
|
|
|
248
248
|
const badge = (options) => ({
|
|
249
249
|
slots: {
|
|
250
|
-
base: "
|
|
250
|
+
base: "font-medium inline-flex items-center",
|
|
251
251
|
label: "truncate",
|
|
252
252
|
leadingIcon: "shrink-0",
|
|
253
253
|
leadingAvatar: "shrink-0",
|
|
@@ -266,23 +266,35 @@ const badge = (options) => ({
|
|
|
266
266
|
subtle: ""
|
|
267
267
|
},
|
|
268
268
|
size: {
|
|
269
|
+
xs: {
|
|
270
|
+
base: "text-[8px]/3 px-1 py-0.5 gap-1 rounded-[calc(var(--ui-radius))]",
|
|
271
|
+
leadingIcon: "size-3",
|
|
272
|
+
leadingAvatarSize: "3xs",
|
|
273
|
+
trailingIcon: "size-3"
|
|
274
|
+
},
|
|
269
275
|
sm: {
|
|
270
|
-
base: "text-
|
|
271
|
-
leadingIcon: "size-
|
|
276
|
+
base: "text-[10px]/3 px-1.5 py-1 gap-1 rounded-[calc(var(--ui-radius))]",
|
|
277
|
+
leadingIcon: "size-3",
|
|
272
278
|
leadingAvatarSize: "3xs",
|
|
273
|
-
trailingIcon: "size-
|
|
279
|
+
trailingIcon: "size-3"
|
|
274
280
|
},
|
|
275
281
|
md: {
|
|
276
|
-
base: "text-xs px-2 py-1 gap-1",
|
|
282
|
+
base: "text-xs px-2 py-1 gap-1 rounded-[calc(var(--ui-radius)*1.5)]",
|
|
277
283
|
leadingIcon: "size-4",
|
|
278
284
|
leadingAvatarSize: "3xs",
|
|
279
285
|
trailingIcon: "size-4"
|
|
280
286
|
},
|
|
281
287
|
lg: {
|
|
282
|
-
base: "text-sm px-2 py-1 gap-1.5",
|
|
288
|
+
base: "text-sm px-2 py-1 gap-1.5 rounded-[calc(var(--ui-radius)*1.5)]",
|
|
283
289
|
leadingIcon: "size-5",
|
|
284
290
|
leadingAvatarSize: "2xs",
|
|
285
291
|
trailingIcon: "size-5"
|
|
292
|
+
},
|
|
293
|
+
xl: {
|
|
294
|
+
base: "text-base px-2.5 py-1 gap-1.5 rounded-[calc(var(--ui-radius)*1.5)]",
|
|
295
|
+
leadingIcon: "size-6",
|
|
296
|
+
leadingAvatarSize: "2xs",
|
|
297
|
+
trailingIcon: "size-6"
|
|
286
298
|
}
|
|
287
299
|
}
|
|
288
300
|
},
|
|
@@ -460,7 +472,6 @@ const button = (options) => ({
|
|
|
460
472
|
block: {
|
|
461
473
|
true: {
|
|
462
474
|
base: "w-full justify-center",
|
|
463
|
-
leadingAvatarSize: "xs",
|
|
464
475
|
trailingIcon: "ms-auto"
|
|
465
476
|
}
|
|
466
477
|
},
|
|
@@ -671,9 +682,6 @@ const carousel = (options) => ({
|
|
|
671
682
|
dot: "bg-[var(--ui-border-inverted)]"
|
|
672
683
|
}
|
|
673
684
|
}
|
|
674
|
-
},
|
|
675
|
-
defaultVariants: {
|
|
676
|
-
orientation: "horizontal"
|
|
677
685
|
}
|
|
678
686
|
});
|
|
679
687
|
|
|
@@ -1362,7 +1370,7 @@ const inputMenu = (options) => {
|
|
|
1362
1370
|
base: () => ["rounded-[calc(var(--ui-radius)*1.5)]", options.theme.transitions && "transition-colors"],
|
|
1363
1371
|
trailing: "group absolute inset-y-0 end-0 flex items-center disabled:cursor-not-allowed disabled:opacity-75",
|
|
1364
1372
|
arrow: "fill-[var(--ui-border)]",
|
|
1365
|
-
content: "max-h-60 w-[var(--reka-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]",
|
|
1373
|
+
content: "max-h-60 w-[var(--reka-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] pointer-events-auto",
|
|
1366
1374
|
viewport: "divide-y divide-[var(--ui-border)] scroll-py-1",
|
|
1367
1375
|
group: "p-1 isolate",
|
|
1368
1376
|
empty: "py-2 text-center text-sm text-[var(--ui-text-muted)]",
|
|
@@ -1641,13 +1649,14 @@ const navigationMenu = (options) => ({
|
|
|
1641
1649
|
slots: {
|
|
1642
1650
|
root: "relative flex gap-1.5 [&>div]:min-w-0",
|
|
1643
1651
|
list: "isolate min-w-0",
|
|
1652
|
+
label: "w-full flex items-center gap-1.5 font-semibold text-xs/5 text-[var(--ui-text-highlighted)] px-2.5 py-1.5",
|
|
1644
1653
|
item: "min-w-0",
|
|
1645
1654
|
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",
|
|
1646
1655
|
linkLeadingIcon: "shrink-0 size-5",
|
|
1647
1656
|
linkLeadingAvatar: "shrink-0",
|
|
1648
1657
|
linkLeadingAvatarSize: "2xs",
|
|
1649
1658
|
linkTrailing: "ms-auto inline-flex gap-1.5 items-center",
|
|
1650
|
-
linkTrailingBadge: "shrink-0
|
|
1659
|
+
linkTrailingBadge: "shrink-0",
|
|
1651
1660
|
linkTrailingBadgeSize: "sm",
|
|
1652
1661
|
linkTrailingIcon: "size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",
|
|
1653
1662
|
linkLabel: "truncate",
|
|
@@ -1661,10 +1670,10 @@ const navigationMenu = (options) => ({
|
|
|
1661
1670
|
childLinkLabelExternalIcon: "inline-block size-3 align-top text-[var(--ui-text-dimmed)]",
|
|
1662
1671
|
childLinkDescription: "text-sm text-[var(--ui-text-muted)]",
|
|
1663
1672
|
separator: "px-2 h-px bg-[var(--ui-border)]",
|
|
1664
|
-
viewportWrapper: "absolute top-full left-0 flex w-full
|
|
1665
|
-
viewport: "relative overflow-hidden bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] h-[var(--reka-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]",
|
|
1666
|
-
content: "absolute top-0 left-0 w-full
|
|
1667
|
-
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-
|
|
1673
|
+
viewportWrapper: "absolute top-full left-0 flex w-full",
|
|
1674
|
+
viewport: "relative overflow-hidden bg-[var(--ui-bg)] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[var(--ui-border)] h-[var(--reka-navigation-menu-viewport-height)] w-full transition-[width,height,left] duration-200 origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1675
|
+
content: "absolute top-0 left-0 w-full",
|
|
1676
|
+
indicator: "absolute data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] data-[state=hidden]:opacity-0 bottom-0 z-[1] w-[var(--reka-navigation-menu-indicator-size)] translate-x-[var(--reka-navigation-menu-indicator-position)] flex h-2.5 items-end justify-center overflow-hidden transition-[translate,width] duration-200",
|
|
1668
1677
|
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)]"
|
|
1669
1678
|
},
|
|
1670
1679
|
variants: {
|
|
@@ -1688,17 +1697,26 @@ const navigationMenu = (options) => ({
|
|
|
1688
1697
|
},
|
|
1689
1698
|
orientation: {
|
|
1690
1699
|
horizontal: {
|
|
1691
|
-
root: "
|
|
1700
|
+
root: "items-center justify-between",
|
|
1692
1701
|
list: "flex items-center",
|
|
1693
1702
|
item: "py-2",
|
|
1694
1703
|
link: "px-2.5 py-1.5 before:inset-x-px before:inset-y-0",
|
|
1695
|
-
childList: "grid
|
|
1704
|
+
childList: "grid p-2"
|
|
1696
1705
|
},
|
|
1697
1706
|
vertical: {
|
|
1698
1707
|
root: "flex-col",
|
|
1699
|
-
link: "flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0"
|
|
1700
|
-
|
|
1701
|
-
|
|
1708
|
+
link: "flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0"
|
|
1709
|
+
}
|
|
1710
|
+
},
|
|
1711
|
+
contentOrientation: {
|
|
1712
|
+
horizontal: {
|
|
1713
|
+
viewport: "",
|
|
1714
|
+
viewportWrapper: "justify-center",
|
|
1715
|
+
content: "data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]"
|
|
1716
|
+
},
|
|
1717
|
+
vertical: {
|
|
1718
|
+
viewport: "sm:w-[var(--reka-navigation-menu-viewport-width)] left-[var(--reka-navigation-menu-viewport-left)]",
|
|
1719
|
+
content: ""
|
|
1702
1720
|
}
|
|
1703
1721
|
},
|
|
1704
1722
|
active: {
|
|
@@ -1720,29 +1738,57 @@ const navigationMenu = (options) => ({
|
|
|
1720
1738
|
},
|
|
1721
1739
|
highlight: {
|
|
1722
1740
|
true: ""
|
|
1741
|
+
},
|
|
1742
|
+
level: {
|
|
1743
|
+
true: ""
|
|
1744
|
+
},
|
|
1745
|
+
collapsed: {
|
|
1746
|
+
true: ""
|
|
1723
1747
|
}
|
|
1724
1748
|
},
|
|
1725
1749
|
compoundVariants: [{
|
|
1726
|
-
highlight: true,
|
|
1727
1750
|
orientation: "horizontal",
|
|
1751
|
+
contentOrientation: "horizontal",
|
|
1728
1752
|
class: {
|
|
1729
|
-
|
|
1730
|
-
link: "after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full"
|
|
1753
|
+
childList: "grid-cols-2 gap-2"
|
|
1731
1754
|
}
|
|
1732
1755
|
}, {
|
|
1756
|
+
orientation: "horizontal",
|
|
1757
|
+
contentOrientation: "vertical",
|
|
1758
|
+
class: {
|
|
1759
|
+
childList: "gap-1",
|
|
1760
|
+
content: "w-60"
|
|
1761
|
+
}
|
|
1762
|
+
}, {
|
|
1763
|
+
orientation: "horizontal",
|
|
1733
1764
|
highlight: true,
|
|
1765
|
+
class: {
|
|
1766
|
+
item: "-mb-px",
|
|
1767
|
+
link: ["after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full", options.theme.transitions && "after:transition-colors"]
|
|
1768
|
+
}
|
|
1769
|
+
}, {
|
|
1734
1770
|
orientation: "vertical",
|
|
1771
|
+
highlight: true,
|
|
1772
|
+
level: true,
|
|
1735
1773
|
class: {
|
|
1736
|
-
|
|
1737
|
-
link: "after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full"
|
|
1774
|
+
link: ["after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full", options.theme.transitions && "after:transition-colors"]
|
|
1738
1775
|
}
|
|
1739
1776
|
}, {
|
|
1740
1777
|
disabled: false,
|
|
1741
1778
|
active: false,
|
|
1742
1779
|
variant: "pill",
|
|
1743
1780
|
class: {
|
|
1744
|
-
link: ["hover:text-[var(--ui-text-highlighted)] hover:before:bg-[var(--ui-bg-elevated)]/50
|
|
1745
|
-
linkLeadingIcon: ["group-hover:text-[var(--ui-text)]
|
|
1781
|
+
link: ["hover:text-[var(--ui-text-highlighted)] hover:before:bg-[var(--ui-bg-elevated)]/50", options.theme.transitions && "transition-colors before:transition-colors"],
|
|
1782
|
+
linkLeadingIcon: ["group-hover:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1783
|
+
}
|
|
1784
|
+
}, {
|
|
1785
|
+
disabled: false,
|
|
1786
|
+
active: false,
|
|
1787
|
+
variant: "pill",
|
|
1788
|
+
orientation: "horizontal",
|
|
1789
|
+
class: {
|
|
1790
|
+
link: "data-[state=open]:text-[var(--ui-text-highlighted)]",
|
|
1791
|
+
linkLeadingIcon: "group-data-[state=open]:text-[var(--ui-text)]"
|
|
1746
1792
|
}
|
|
1747
1793
|
}, {
|
|
1748
1794
|
disabled: false,
|
|
@@ -1767,7 +1813,7 @@ const navigationMenu = (options) => ({
|
|
|
1767
1813
|
active: true,
|
|
1768
1814
|
class: {
|
|
1769
1815
|
link: `text-[var(--ui-${color})]`,
|
|
1770
|
-
linkLeadingIcon: `text-[var(--ui-${color})]`
|
|
1816
|
+
linkLeadingIcon: `text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
|
1771
1817
|
}
|
|
1772
1818
|
})), {
|
|
1773
1819
|
color: "neutral",
|
|
@@ -1775,7 +1821,7 @@ const navigationMenu = (options) => ({
|
|
|
1775
1821
|
active: true,
|
|
1776
1822
|
class: {
|
|
1777
1823
|
link: "text-[var(--ui-text-highlighted)]",
|
|
1778
|
-
linkLeadingIcon: "text-[var(--ui-text-highlighted)]"
|
|
1824
|
+
linkLeadingIcon: "text-[var(--ui-text-highlighted)] group-data-[state=open]:text-[var(--ui-text-highlighted)]"
|
|
1779
1825
|
}
|
|
1780
1826
|
}, {
|
|
1781
1827
|
variant: "pill",
|
|
@@ -1796,8 +1842,17 @@ const navigationMenu = (options) => ({
|
|
|
1796
1842
|
active: false,
|
|
1797
1843
|
variant: "link",
|
|
1798
1844
|
class: {
|
|
1799
|
-
link: ["hover:text-[var(--ui-text-highlighted)]
|
|
1800
|
-
linkLeadingIcon: ["group-hover:text-[var(--ui-text)]
|
|
1845
|
+
link: ["hover:text-[var(--ui-text-highlighted)]", options.theme.transitions && "transition-colors"],
|
|
1846
|
+
linkLeadingIcon: ["group-hover:text-[var(--ui-text)]", options.theme.transitions && "transition-colors"]
|
|
1847
|
+
}
|
|
1848
|
+
}, {
|
|
1849
|
+
disabled: false,
|
|
1850
|
+
active: false,
|
|
1851
|
+
variant: "link",
|
|
1852
|
+
orientation: "horizontal",
|
|
1853
|
+
class: {
|
|
1854
|
+
link: "data-[state=open]:text-[var(--ui-text-highlighted)]",
|
|
1855
|
+
linkLeadingIcon: "group-data-[state=open]:text-[var(--ui-text)]"
|
|
1801
1856
|
}
|
|
1802
1857
|
}, ...(options.theme.colors || []).map((color) => ({
|
|
1803
1858
|
color,
|
|
@@ -1805,7 +1860,7 @@ const navigationMenu = (options) => ({
|
|
|
1805
1860
|
active: true,
|
|
1806
1861
|
class: {
|
|
1807
1862
|
link: `text-[var(--ui-${color})]`,
|
|
1808
|
-
linkLeadingIcon: `text-[var(--ui-${color})]`
|
|
1863
|
+
linkLeadingIcon: `text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
|
1809
1864
|
}
|
|
1810
1865
|
})), {
|
|
1811
1866
|
color: "neutral",
|
|
@@ -1813,11 +1868,12 @@ const navigationMenu = (options) => ({
|
|
|
1813
1868
|
active: true,
|
|
1814
1869
|
class: {
|
|
1815
1870
|
link: "text-[var(--ui-text-highlighted)]",
|
|
1816
|
-
linkLeadingIcon: "text-[var(--ui-text-highlighted)]"
|
|
1871
|
+
linkLeadingIcon: "text-[var(--ui-text-highlighted)] group-data-[state=open]:text-[var(--ui-text-highlighted)]"
|
|
1817
1872
|
}
|
|
1818
1873
|
}, ...(options.theme.colors || []).map((highlightColor) => ({
|
|
1819
1874
|
highlightColor,
|
|
1820
1875
|
highlight: true,
|
|
1876
|
+
level: true,
|
|
1821
1877
|
active: true,
|
|
1822
1878
|
class: {
|
|
1823
1879
|
link: `after:bg-[var(--ui-${highlightColor})]`
|
|
@@ -1825,10 +1881,24 @@ const navigationMenu = (options) => ({
|
|
|
1825
1881
|
})), {
|
|
1826
1882
|
highlightColor: "neutral",
|
|
1827
1883
|
highlight: true,
|
|
1884
|
+
level: true,
|
|
1828
1885
|
active: true,
|
|
1829
1886
|
class: {
|
|
1830
1887
|
link: "after:bg-[var(--ui-bg-inverted)]"
|
|
1831
1888
|
}
|
|
1889
|
+
}, {
|
|
1890
|
+
orientation: "vertical",
|
|
1891
|
+
collapsed: false,
|
|
1892
|
+
class: {
|
|
1893
|
+
childList: "ms-5 border-s border-[var(--ui-border)]",
|
|
1894
|
+
childItem: "ps-1.5 -ms-px"
|
|
1895
|
+
}
|
|
1896
|
+
}, {
|
|
1897
|
+
orientation: "vertical",
|
|
1898
|
+
collapsed: true,
|
|
1899
|
+
class: {
|
|
1900
|
+
link: "px-1.5"
|
|
1901
|
+
}
|
|
1832
1902
|
}],
|
|
1833
1903
|
defaultVariants: {
|
|
1834
1904
|
color: "primary",
|
|
@@ -1910,7 +1980,7 @@ const pinInput = (options) => ({
|
|
|
1910
1980
|
|
|
1911
1981
|
const popover = {
|
|
1912
1982
|
slots: {
|
|
1913
|
-
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",
|
|
1983
|
+
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 pointer-events-auto",
|
|
1914
1984
|
arrow: "fill-[var(--ui-border)]"
|
|
1915
1985
|
}
|
|
1916
1986
|
};
|
|
@@ -2225,12 +2295,12 @@ const radioGroup = (options) => ({
|
|
|
2225
2295
|
const select = (options) => {
|
|
2226
2296
|
return defuFn({
|
|
2227
2297
|
slots: {
|
|
2228
|
-
root: () =>
|
|
2298
|
+
root: () => undefined,
|
|
2229
2299
|
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"],
|
|
2230
2300
|
value: "truncate pointer-events-none",
|
|
2231
2301
|
placeholder: "truncate text-[var(--ui-text-dimmed)]",
|
|
2232
2302
|
arrow: "fill-[var(--ui-border)]",
|
|
2233
|
-
content: "max-h-60 w-[var(--reka-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]",
|
|
2303
|
+
content: "max-h-60 w-[var(--reka-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] pointer-events-auto",
|
|
2234
2304
|
viewport: "divide-y divide-[var(--ui-border)] scroll-py-1",
|
|
2235
2305
|
group: "p-1 isolate",
|
|
2236
2306
|
empty: "py-2 text-center text-sm text-[var(--ui-text-muted)]",
|
|
@@ -2701,7 +2771,6 @@ const stepper = (options) => ({
|
|
|
2701
2771
|
class: { separator: "top-[62px]", item: "gap-3.5" }
|
|
2702
2772
|
}],
|
|
2703
2773
|
defaultVariants: {
|
|
2704
|
-
orientation: "horizontal",
|
|
2705
2774
|
size: "md",
|
|
2706
2775
|
color: "primary"
|
|
2707
2776
|
}
|
|
@@ -3114,7 +3183,7 @@ const toaster = {
|
|
|
3114
3183
|
|
|
3115
3184
|
const tooltip = {
|
|
3116
3185
|
slots: {
|
|
3117
|
-
content: "flex items-center gap-1 bg-[var(--ui-bg)] text-[var(--ui-text-highlighted)] shadow-sm 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]",
|
|
3186
|
+
content: "flex items-center gap-1 bg-[var(--ui-bg)] text-[var(--ui-text-highlighted)] shadow-sm 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] pointer-events-auto",
|
|
3118
3187
|
arrow: "fill-[var(--ui-border)]",
|
|
3119
3188
|
text: "truncate",
|
|
3120
3189
|
kbds: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['\xB7'] before:me-0.5`,
|
|
@@ -3189,16 +3258,28 @@ function getTemplates(options, uiConfig) {
|
|
|
3189
3258
|
getContents: async () => {
|
|
3190
3259
|
const template = theme[component];
|
|
3191
3260
|
const result = typeof template === "function" ? template(options) : template;
|
|
3192
|
-
const variants = Object.
|
|
3261
|
+
const variants = Object.entries(result.variants || {}).filter(([_, values]) => {
|
|
3262
|
+
const keys = Object.keys(values);
|
|
3263
|
+
return keys.some((key) => key !== "true" && key !== "false");
|
|
3264
|
+
}).map(([key]) => key);
|
|
3193
3265
|
let json = JSON.stringify(result, null, 2);
|
|
3194
3266
|
for (const variant of variants) {
|
|
3195
|
-
json = json.replace(new RegExp(`("${variant}": "[^"]+")`, "g"),
|
|
3267
|
+
json = json.replace(new RegExp(`("${variant}": "[^"]+")`, "g"), `$1 as typeof ${variant}[number]`);
|
|
3196
3268
|
json = json.replace(new RegExp(`("${variant}": \\[\\s*)((?:"[^"]+",?\\s*)+)(\\])`, "g"), (_, before, match, after) => {
|
|
3197
|
-
const replaced = match.replace(/("[^"]+")/g,
|
|
3269
|
+
const replaced = match.replace(/("[^"]+")/g, `$1 as typeof ${variant}[number]`);
|
|
3198
3270
|
return `${before}${replaced}${after}`;
|
|
3199
3271
|
});
|
|
3200
3272
|
}
|
|
3201
|
-
|
|
3273
|
+
function generateVariantDeclarations(variants2) {
|
|
3274
|
+
return variants2.map((variant) => {
|
|
3275
|
+
const keys = Object.keys(result.variants[variant]);
|
|
3276
|
+
return `const ${variant} = ${JSON.stringify(keys, null, 2)} as const`;
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
return [
|
|
3280
|
+
...generateVariantDeclarations(variants),
|
|
3281
|
+
`export default ${json}`
|
|
3282
|
+
].join("\n\n");
|
|
3202
3283
|
}
|
|
3203
3284
|
});
|
|
3204
3285
|
}
|
|
@@ -3211,12 +3292,13 @@ function getTemplates(options, uiConfig) {
|
|
|
3211
3292
|
filename: "types/ui.d.ts",
|
|
3212
3293
|
getContents: () => `import * as ui from '#build/ui'
|
|
3213
3294
|
import type { DeepPartial } from '#ui/types/utils'
|
|
3295
|
+
import type { defaultConfig } from 'tailwind-variants'
|
|
3214
3296
|
import colors from 'tailwindcss/colors'
|
|
3215
3297
|
|
|
3216
3298
|
const icons = ${JSON.stringify(uiConfig.icons)};
|
|
3217
3299
|
|
|
3218
|
-
type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'
|
|
3219
|
-
type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor>
|
|
3300
|
+
type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | (string & {})
|
|
3301
|
+
type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor> | (string & {})
|
|
3220
3302
|
|
|
3221
3303
|
type AppConfigUI = {
|
|
3222
3304
|
colors?: {
|
|
@@ -3224,6 +3306,7 @@ type AppConfigUI = {
|
|
|
3224
3306
|
neutral?: NeutralColor
|
|
3225
3307
|
}
|
|
3226
3308
|
icons?: Partial<typeof icons>
|
|
3309
|
+
tv?: typeof defaultConfig
|
|
3227
3310
|
} & DeepPartial<typeof ui>
|
|
3228
3311
|
|
|
3229
3312
|
declare module '@nuxt/schema' {
|