@byyuurin/ui 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -3
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +9299 -8
- package/dist/runtime/app/injections.js +35 -5
- package/dist/runtime/components/Accordion.vue +17 -19
- package/dist/runtime/components/Alert.vue +6 -9
- package/dist/runtime/components/App.vue +14 -19
- package/dist/runtime/components/Avatar.vue +5 -8
- package/dist/runtime/components/AvatarGroup.vue +2 -5
- package/dist/runtime/components/Badge.vue +3 -6
- package/dist/runtime/components/Breadcrumb.vue +22 -23
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/ButtonGroup.vue +2 -5
- package/dist/runtime/components/Calendar.vue +185 -0
- package/dist/runtime/components/Card.vue +2 -5
- package/dist/runtime/components/Carousel.vue +11 -16
- package/dist/runtime/components/Checkbox.vue +13 -11
- package/dist/runtime/components/Chip.vue +6 -9
- package/dist/runtime/components/Collapsible.vue +2 -5
- package/dist/runtime/components/Drawer.vue +88 -45
- package/dist/runtime/components/DropdownMenu.vue +143 -0
- package/dist/runtime/components/DropdownMenuContent.vue +188 -0
- package/dist/runtime/components/Form.vue +311 -0
- package/dist/runtime/components/FormItem.vue +129 -0
- package/dist/runtime/components/Input.vue +34 -23
- package/dist/runtime/components/InputNumber.vue +23 -18
- package/dist/runtime/components/Kbd.vue +2 -6
- package/dist/runtime/components/Link.vue +25 -7
- package/dist/runtime/components/Modal.vue +31 -22
- package/dist/runtime/components/OverlayProvider.vue +29 -0
- package/dist/runtime/components/Pagination.vue +34 -27
- package/dist/runtime/components/PinInput.vue +23 -17
- package/dist/runtime/components/Popover.vue +5 -8
- package/dist/runtime/components/Progress.vue +2 -5
- package/dist/runtime/components/RadioGroup.vue +52 -49
- package/dist/runtime/components/ScrollArea.vue +2 -6
- package/dist/runtime/components/Select.vue +96 -89
- package/dist/runtime/components/Separator.vue +2 -6
- package/dist/runtime/components/Skeleton.vue +2 -5
- package/dist/runtime/components/Slider.vue +13 -11
- package/dist/runtime/components/Switch.vue +18 -11
- package/dist/runtime/components/Table.vue +23 -13
- package/dist/runtime/components/Tabs.vue +14 -16
- package/dist/runtime/components/Textarea.vue +20 -17
- package/dist/runtime/components/Toast.vue +12 -13
- package/dist/runtime/components/{Toaster.vue → ToastProvider.vue} +18 -16
- package/dist/runtime/components/Tooltip.vue +5 -8
- package/dist/runtime/composables/useFormItem.d.ts +27 -0
- package/dist/runtime/composables/useFormItem.js +64 -0
- package/dist/runtime/composables/useKbd.d.ts +1 -1
- package/dist/runtime/composables/useOverlay.d.ts +29 -0
- package/dist/runtime/composables/useOverlay.js +69 -0
- package/dist/runtime/composables/useTheme.d.ts +6 -2
- package/dist/runtime/composables/useTheme.js +10 -3
- package/dist/runtime/composables/useToast.d.ts +4 -20
- package/dist/runtime/composables/useToast.js +6 -5
- package/dist/runtime/index.d.ts +6 -2
- package/dist/runtime/index.js +6 -2
- package/dist/runtime/locale/en.js +6 -0
- package/dist/runtime/locale/zh-tw.js +6 -0
- package/dist/runtime/theme/accordion.js +3 -3
- package/dist/runtime/theme/alert.js +3 -3
- package/dist/runtime/theme/app.d.ts +1 -0
- package/dist/runtime/theme/app.js +2 -1
- package/dist/runtime/theme/avatar.js +2 -2
- package/dist/runtime/theme/badge.d.ts +21 -45
- package/dist/runtime/theme/breadcrumb.d.ts +3 -3
- package/dist/runtime/theme/breadcrumb.js +5 -5
- package/dist/runtime/theme/button.d.ts +111 -57
- package/dist/runtime/theme/button.js +13 -13
- package/dist/runtime/theme/calendar.d.ts +56 -0
- package/dist/runtime/theme/calendar.js +69 -0
- package/dist/runtime/theme/card.js +6 -6
- package/dist/runtime/theme/carousel.js +1 -1
- package/dist/runtime/theme/checkbox.js +5 -5
- package/dist/runtime/theme/chip.d.ts +11 -44
- package/dist/runtime/theme/chip.js +3 -3
- package/dist/runtime/theme/drawer.d.ts +85 -47
- package/dist/runtime/theme/drawer.js +46 -19
- package/dist/runtime/theme/dropdown-menu.d.ts +71 -0
- package/dist/runtime/theme/dropdown-menu.js +83 -0
- package/dist/runtime/theme/form-item.d.ts +76 -0
- package/dist/runtime/theme/form-item.js +34 -0
- package/dist/runtime/theme/form.d.ts +8 -0
- package/dist/runtime/theme/form.js +7 -0
- package/dist/runtime/theme/index.d.ts +5 -1
- package/dist/runtime/theme/index.js +5 -1
- package/dist/runtime/theme/input-number.d.ts +41 -61
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.d.ts +99 -71
- package/dist/runtime/theme/input.js +15 -15
- package/dist/runtime/theme/kbd.d.ts +2 -2
- package/dist/runtime/theme/kbd.js +1 -1
- package/dist/runtime/theme/link.d.ts +1 -1
- package/dist/runtime/theme/link.js +3 -3
- package/dist/runtime/theme/modal.d.ts +5 -33
- package/dist/runtime/theme/modal.js +4 -4
- package/dist/runtime/theme/pagination.d.ts +27 -3
- package/dist/runtime/theme/pagination.js +6 -2
- package/dist/runtime/theme/pinInput.d.ts +42 -42
- package/dist/runtime/theme/pinInput.js +13 -13
- package/dist/runtime/theme/progress.d.ts +117 -53
- package/dist/runtime/theme/progress.js +4 -4
- package/dist/runtime/theme/radio-group.d.ts +2 -2
- package/dist/runtime/theme/radio-group.js +7 -7
- package/dist/runtime/theme/select.d.ts +100 -84
- package/dist/runtime/theme/select.js +21 -20
- package/dist/runtime/theme/separator.d.ts +13 -28
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/skeleton.d.ts +1 -1
- package/dist/runtime/theme/skeleton.js +1 -1
- package/dist/runtime/theme/slider.js +1 -1
- package/dist/runtime/theme/switch.js +5 -5
- package/dist/runtime/theme/table.d.ts +3 -0
- package/dist/runtime/theme/table.js +8 -7
- package/dist/runtime/theme/tabs.d.ts +51 -68
- package/dist/runtime/theme/tabs.js +10 -10
- package/dist/runtime/theme/textarea.d.ts +37 -43
- package/dist/runtime/theme/textarea.js +13 -13
- package/dist/runtime/theme/{toaster.d.ts → toast-provider.d.ts} +26 -41
- package/dist/runtime/theme/toast.js +5 -5
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +6 -1
- package/dist/runtime/types/form.d.ts +45 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/index.d.ts +5 -2
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +6 -0
- package/dist/runtime/types/utils.d.ts +35 -12
- package/dist/runtime/utils/extend-theme.js +15 -4
- package/dist/runtime/utils/form.d.ts +5 -0
- package/dist/runtime/utils/form.js +24 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/link.d.ts +4 -26
- package/dist/runtime/utils/link.js +10 -3
- package/dist/shared/ui.3e7fad19.mjs +5 -0
- package/dist/shared/ui.3e7fad19.mjs.map +1 -0
- package/dist/unocss.mjs +21 -16
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +20 -18
- package/dist/runtime/components/ModalProvider.vue +0 -11
- package/dist/runtime/composables/useModal.d.ts +0 -10
- package/dist/runtime/composables/useModal.js +0 -47
- package/dist/shared/ui.ba24b380.mjs +0 -4
- package/dist/shared/ui.ba24b380.mjs.map +0 -1
- /package/dist/runtime/theme/{toaster.js → toast-provider.js} +0 -0
|
@@ -48,53 +48,47 @@ declare const _default: {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
compoundVariants:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
root: string;
|
|
58
|
-
};
|
|
59
|
-
md: {
|
|
60
|
-
root: string;
|
|
61
|
-
};
|
|
62
|
-
lg: {
|
|
63
|
-
root: string;
|
|
64
|
-
};
|
|
65
|
-
xl: {
|
|
66
|
-
root: string;
|
|
67
|
-
};
|
|
51
|
+
compoundVariants: ({
|
|
52
|
+
variant: ("soft" | "ghost" | "none")[];
|
|
53
|
+
highlight: false;
|
|
54
|
+
underline: true;
|
|
55
|
+
class: {
|
|
56
|
+
root: string[];
|
|
68
57
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
root: string[];
|
|
75
|
-
};
|
|
76
|
-
'soft-outline': {
|
|
77
|
-
root: string[];
|
|
78
|
-
};
|
|
79
|
-
ghost: {
|
|
80
|
-
root: string[];
|
|
81
|
-
};
|
|
82
|
-
none: {
|
|
83
|
-
root: string;
|
|
84
|
-
};
|
|
58
|
+
size?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
size: ("xs" | "sm" | "md")[];
|
|
61
|
+
class: {
|
|
62
|
+
root: string;
|
|
85
63
|
};
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
variant?: undefined;
|
|
65
|
+
highlight?: undefined;
|
|
66
|
+
underline?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
size: ("lg" | "xl")[];
|
|
69
|
+
class: {
|
|
70
|
+
root: string;
|
|
88
71
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
variant?: undefined;
|
|
73
|
+
highlight?: undefined;
|
|
74
|
+
underline?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
variant: ("soft" | "soft-outline" | "ghost" | "none")[];
|
|
77
|
+
highlight: true;
|
|
78
|
+
class: {
|
|
79
|
+
root: string;
|
|
93
80
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
underline?: undefined;
|
|
82
|
+
size?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
variant: "outline"[];
|
|
85
|
+
highlight: true;
|
|
86
|
+
class: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
underline?: undefined;
|
|
90
|
+
size?: undefined;
|
|
91
|
+
})[];
|
|
98
92
|
defaultVariants: {
|
|
99
93
|
size: "md";
|
|
100
94
|
};
|
|
@@ -5,7 +5,7 @@ export default ct(
|
|
|
5
5
|
slots: {
|
|
6
6
|
root: "rounded-ui-base transition-colors aria-disabled:opacity-50",
|
|
7
7
|
base: [
|
|
8
|
-
"w-full color-inherit bg-transparent border-0 resize-none placeholder:color-ui-
|
|
8
|
+
"w-full color-inherit bg-transparent border-0 resize-none placeholder:color-ui-base/50",
|
|
9
9
|
"focus:outline-none",
|
|
10
10
|
"disabled:cursor-not-allowed"
|
|
11
11
|
]
|
|
@@ -31,34 +31,34 @@ export default ct(
|
|
|
31
31
|
variant: {
|
|
32
32
|
"outline": {
|
|
33
33
|
root: [
|
|
34
|
-
"color-ui-
|
|
35
|
-
"focus-within:ring-2 focus-within:ring-ui-
|
|
36
|
-
"aria-disabled:ring-ui-
|
|
34
|
+
"color-ui-base/80 bg-ui-base ring ring-inset ring-ui-base/30",
|
|
35
|
+
"focus-within:ring-2 focus-within:ring-ui-base/50",
|
|
36
|
+
"aria-disabled:ring-ui-base/15 hover:aria-disabled:ring-ui-base/15"
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"soft": {
|
|
40
40
|
root: [
|
|
41
|
-
"color-ui-
|
|
42
|
-
"hover:bg-soft-ui-cb/6 hover:color-ui-
|
|
43
|
-
"aria-disabled:color-ui-
|
|
41
|
+
"color-ui-base/80 bg-soft-ui-cb/4",
|
|
42
|
+
"hover:bg-soft-ui-cb/6 hover:color-ui-base/80 focus-within:bg-soft-ui-cb/8 focus-within:hover:bg-soft-ui-cb/8 focus-within:color-ui-base/85",
|
|
43
|
+
"aria-disabled:color-ui-fill/80 aria-disabled:bg-soft-ui-fill/5 hover:aria-disabled:color-ui-fill/80 hover:aria-disabled:bg-soft-ui-fill/5"
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"soft-outline": {
|
|
47
47
|
root: [
|
|
48
|
-
"color-ui-
|
|
49
|
-
"hover:bg-soft-ui-cb/6 hover:color-ui-
|
|
50
|
-
"aria-disabled:color-ui-
|
|
48
|
+
"color-ui-base/80 bg-soft-ui-cb/4 ring ring-inset ring-ui-base/30",
|
|
49
|
+
"hover:bg-soft-ui-cb/6 hover:color-ui-base/80 focus-within:bg-soft-ui-cb/8 focus-within:hover:bg-soft-ui-cb/8 focus-within:color-ui-base/85",
|
|
50
|
+
"aria-disabled:color-ui-fill/80 aria-disabled:bg-soft-ui-fill/5 hover:aria-disabled:color-ui-fill/80 hover:aria-disabled:bg-soft-ui-fill/5"
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
53
|
"ghost": {
|
|
54
54
|
root: [
|
|
55
|
-
"color-ui-
|
|
56
|
-
"hover:bg-soft-ui-cb/6 hover:color-ui-
|
|
55
|
+
"color-ui-base/80 bg-transparent",
|
|
56
|
+
"hover:bg-soft-ui-cb/6 hover:color-ui-base/80 focus-within:bg-soft-ui-cb/8 focus-within:hover:bg-soft-ui-cb/8 focus-within:color-ui-base/85",
|
|
57
57
|
"aria-disabled:color-ui-fill/80 aria-disabled:bg-transparent hover:aria-disabled:color-ui-fill/80 hover:aria-disabled:bg-transparent"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"none": {
|
|
61
|
-
root: "color-ui-
|
|
61
|
+
root: "color-ui-base bg-transparent"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
underline: {
|
|
@@ -45,50 +45,35 @@ declare const _default: {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
compoundVariants:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
compoundVariants: ({
|
|
49
|
+
position: ("top-right" | "top-left" | "top-center")[];
|
|
50
|
+
class: {
|
|
51
|
+
viewport: string;
|
|
52
|
+
base: string;
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
'top-right': {
|
|
62
|
-
viewport: string;
|
|
63
|
-
};
|
|
64
|
-
'bottom-left': {
|
|
65
|
-
viewport: string;
|
|
66
|
-
};
|
|
67
|
-
'bottom-center': {
|
|
68
|
-
viewport: string;
|
|
69
|
-
};
|
|
70
|
-
'bottom-right': {
|
|
71
|
-
viewport: string;
|
|
72
|
-
};
|
|
54
|
+
swipeDirection?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
position: ("bottom-right" | "bottom-left" | "bottom-center")[];
|
|
57
|
+
class: {
|
|
58
|
+
viewport: string;
|
|
59
|
+
base: string;
|
|
73
60
|
};
|
|
74
|
-
swipeDirection
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
down: {
|
|
82
|
-
base: string;
|
|
83
|
-
};
|
|
84
|
-
left: {
|
|
85
|
-
base: string;
|
|
86
|
-
};
|
|
61
|
+
swipeDirection?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
swipeDirection: ("left" | "right")[];
|
|
64
|
+
class: {
|
|
65
|
+
base: string[];
|
|
66
|
+
viewport?: undefined;
|
|
87
67
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
position?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
swipeDirection: ("up" | "down")[];
|
|
71
|
+
class: {
|
|
72
|
+
base: string[];
|
|
73
|
+
viewport?: undefined;
|
|
74
|
+
};
|
|
75
|
+
position?: undefined;
|
|
76
|
+
})[];
|
|
92
77
|
defaultVariants: import("@byyuurin/ui-kit").CVDefaultVariants<{
|
|
93
78
|
clickable: {
|
|
94
79
|
true: {
|
|
@@ -3,15 +3,15 @@ export default ct(
|
|
|
3
3
|
/* @unocss-include */
|
|
4
4
|
{
|
|
5
5
|
slots: {
|
|
6
|
-
root: "group relative overflow-hidden bg-ui-
|
|
6
|
+
root: "group relative overflow-hidden bg-ui-base shadow-lg rounded-ui-box ring ring-ui-base/5 p-4 flex gap-2.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ui-base/5",
|
|
7
7
|
wrapper: "w-0 flex-1 flex flex-col gap-1",
|
|
8
|
-
title: "text-base font-medium color-ui-
|
|
9
|
-
description: "text-sm color-ui-
|
|
10
|
-
icon: "shrink-0 size-1.25em color-ui-
|
|
8
|
+
title: "text-base font-medium color-ui-base",
|
|
9
|
+
description: "text-sm color-ui-base/80",
|
|
10
|
+
icon: "shrink-0 size-1.25em color-ui-base",
|
|
11
11
|
avatar: "shrink-0",
|
|
12
12
|
avatarSize: "2xl",
|
|
13
13
|
actions: "flex flex-wrap gap-1.5 shrink-0",
|
|
14
|
-
progress: "absolute inset-x-[var(--ui-radius-box)] bottom-0 h-1 z-[-1] color-ui-
|
|
14
|
+
progress: "absolute inset-x-[var(--ui-radius-box)] bottom-0 h-1 z-[-1] color-ui-fill/80 bg-current rounded-ui-base",
|
|
15
15
|
close: "p-0.5"
|
|
16
16
|
},
|
|
17
17
|
variants: {
|
|
@@ -3,7 +3,7 @@ export default ct(
|
|
|
3
3
|
/* @unocss-include */
|
|
4
4
|
{
|
|
5
5
|
slots: {
|
|
6
|
-
content: "z-1 flex items-center gap-1 bg-ui-
|
|
6
|
+
content: "z-1 flex items-center gap-1 bg-ui-base color-ui-base shadow-sm rounded-ui-base ring ring-ui-base/10 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]",
|
|
7
7
|
arrow: "fill-ui-cx stroke-ui-cb/10",
|
|
8
8
|
text: "truncate"
|
|
9
9
|
}
|
|
@@ -7,17 +7,22 @@ export type * from '../components/Badge.vue';
|
|
|
7
7
|
export type * from '../components/Breadcrumb.vue';
|
|
8
8
|
export type * from '../components/Button.vue';
|
|
9
9
|
export type * from '../components/ButtonGroup.vue';
|
|
10
|
+
export type * from '../components/Calendar.vue';
|
|
10
11
|
export type * from '../components/Card.vue';
|
|
11
12
|
export type * from '../components/Carousel.vue';
|
|
12
13
|
export type * from '../components/Checkbox.vue';
|
|
13
14
|
export type * from '../components/Chip.vue';
|
|
14
15
|
export type * from '../components/Collapsible.vue';
|
|
15
16
|
export type * from '../components/Drawer.vue';
|
|
17
|
+
export type * from '../components/DropdownMenu.vue';
|
|
18
|
+
export type * from '../components/Form.vue';
|
|
19
|
+
export type * from '../components/FormItem.vue';
|
|
16
20
|
export type * from '../components/Input.vue';
|
|
17
21
|
export type * from '../components/InputNumber.vue';
|
|
18
22
|
export type * from '../components/Kbd.vue';
|
|
19
23
|
export type * from '../components/Link.vue';
|
|
20
24
|
export type * from '../components/Modal.vue';
|
|
25
|
+
export type * from '../components/OverlayProvider.vue';
|
|
21
26
|
export type * from '../components/Pagination.vue';
|
|
22
27
|
export type * from '../components/PinInput.vue';
|
|
23
28
|
export type * from '../components/Popover.vue';
|
|
@@ -33,5 +38,5 @@ export type * from '../components/Table.vue';
|
|
|
33
38
|
export type * from '../components/Tabs.vue';
|
|
34
39
|
export type * from '../components/Textarea.vue';
|
|
35
40
|
export type * from '../components/Toast.vue';
|
|
36
|
-
export type * from '../components/
|
|
41
|
+
export type * from '../components/ToastProvider.vue';
|
|
37
42
|
export type * from '../components/Tooltip.vue';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { FormExpose } from './components.js';
|
|
3
|
+
export type FormSchema<_T> = StandardSchemaV1;
|
|
4
|
+
export interface FormError<P extends string = string> {
|
|
5
|
+
name?: P;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FormErrorWithId extends FormError {
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
12
|
+
export type FormEventType = FormInputEvents;
|
|
13
|
+
export type FormSubmitEvent<T> = SubmitEvent & {
|
|
14
|
+
data: T;
|
|
15
|
+
};
|
|
16
|
+
export interface FormChildAttachEvent {
|
|
17
|
+
type: 'attach';
|
|
18
|
+
formId: string | number;
|
|
19
|
+
validate: FormExpose<any>['validate'];
|
|
20
|
+
}
|
|
21
|
+
export interface FormChildDetachEvent {
|
|
22
|
+
type: 'detach';
|
|
23
|
+
formId: string | number;
|
|
24
|
+
}
|
|
25
|
+
export interface FormInputEvent<T extends object> {
|
|
26
|
+
type: FormEventType;
|
|
27
|
+
name: keyof T;
|
|
28
|
+
eager?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
|
|
31
|
+
export interface FormValidationError {
|
|
32
|
+
errors: FormErrorWithId[];
|
|
33
|
+
children?: FormValidationError[];
|
|
34
|
+
}
|
|
35
|
+
export type FormErrorEvent = SubmitEvent & FormValidationError;
|
|
36
|
+
export interface ValidateReturnSchema<T> {
|
|
37
|
+
result: T;
|
|
38
|
+
errors: FormError[] | null;
|
|
39
|
+
}
|
|
40
|
+
export interface FormValidateOptions<T extends object> {
|
|
41
|
+
name?: keyof T | (keyof T)[];
|
|
42
|
+
silent?: boolean;
|
|
43
|
+
nested?: boolean;
|
|
44
|
+
transform?: boolean;
|
|
45
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type * as theme from '../theme/index.js';
|
|
2
|
-
import type { PartialTheme } from './utils.js';
|
|
3
2
|
export * from './components.js';
|
|
3
|
+
export * from './form.js';
|
|
4
4
|
export * from './locale.js';
|
|
5
5
|
export * from './utils.js';
|
|
6
|
-
|
|
6
|
+
type MergeThemes<T> = {
|
|
7
|
+
[P in keyof T as T[P] extends undefined ? never : P]?: T[P] extends Array<infer V> ? V extends string ? string : V[] : T[P] extends object ? MergeThemes<T[P]> : T[P] extends string ? string : T[P];
|
|
8
|
+
};
|
|
9
|
+
export type ThemeExtension = MergeThemes<typeof theme>;
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import type { ClassValue, CVReturnType, VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
-
|
|
1
|
+
import type { ClassValue, CTReturn, CVReturnType, VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { AcceptableValue as RekaAcceptableValue } from 'reka-ui';
|
|
3
3
|
export type MaybeArray<T> = T | T[];
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export type AcceptableValue = Exclude<RekaAcceptableValue, Record<string, any>>;
|
|
5
|
+
export type EmitsToProps<T> = {
|
|
6
|
+
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
7
|
+
};
|
|
8
|
+
type AllKeys<T> = T extends any ? keyof T : never;
|
|
9
|
+
type NonCommonKeys<T extends object> = Exclude<AllKeys<T>, keyof T>;
|
|
10
|
+
type PickTypeOf<T, K extends string | number | symbol> = K extends AllKeys<T> ? T extends {
|
|
11
|
+
[k in K]?: any;
|
|
12
|
+
} ? T[K] : undefined : never;
|
|
13
|
+
export type MergeTypes<T extends object> = {
|
|
14
|
+
[TK in keyof T]: PickTypeOf<T, TK>;
|
|
15
|
+
} & {
|
|
16
|
+
[TK in NonCommonKeys<T>]?: PickTypeOf<T, TK>;
|
|
8
17
|
};
|
|
9
18
|
export type DynamicSlots<T extends {
|
|
10
19
|
slot?: string;
|
|
11
|
-
},
|
|
20
|
+
}, SlotExtra extends string | undefined = undefined, SlotProps extends object = Record<string, never>> = {
|
|
21
|
+
[K in T['slot'] as K extends string ? SlotExtra extends string ? (K | `${K}-${SlotExtra}`) : K : never]?: (props: {
|
|
22
|
+
item: Extract<T, {
|
|
23
|
+
slot: K extends `${infer Base}-${SlotExtra}` ? Base : K;
|
|
24
|
+
}>;
|
|
25
|
+
} & Omit<SlotProps, 'item'>) => any;
|
|
26
|
+
};
|
|
27
|
+
export type ArrayOrNested<T> = T[] | T[][];
|
|
28
|
+
export type NestedItem<T> = T extends Array<infer I> ? NestedItem<I> : T;
|
|
29
|
+
export type GetItemKeys<T> = keyof Extract<NestedItem<T>, object>;
|
|
30
|
+
export type GetItemValue<I, VK extends GetItemKeys<I> | undefined, T extends NestedItem<I> = NestedItem<I>> = T extends object ? VK extends undefined ? T : VK extends keyof T ? T[VK] : never : T;
|
|
31
|
+
export type GetModelValue<T, VK extends GetItemKeys<T> | undefined, M extends boolean> = M extends true ? GetItemValue<T, VK>[] : GetItemValue<T, VK>;
|
|
32
|
+
export interface GetModelValueEmits<T, VK extends GetItemKeys<T> | undefined, M extends boolean> {
|
|
33
|
+
/** Event handler called when the value changes. */
|
|
34
|
+
'update:modelValue': [payload: GetModelValue<T, VK, M>];
|
|
35
|
+
}
|
|
36
|
+
export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
|
|
12
37
|
export interface ComponentAttrs<T> {
|
|
13
38
|
class?: MaybeArray<string | Record<string, boolean>>;
|
|
14
39
|
ui?: T extends {
|
|
@@ -17,13 +42,11 @@ export interface ComponentAttrs<T> {
|
|
|
17
42
|
[Slot in keyof S]?: string;
|
|
18
43
|
} : never;
|
|
19
44
|
}
|
|
45
|
+
export type StylerTheme<T> = T extends CTReturn<infer V, any, any, infer B, infer S> ? CVReturnType<V, S, B> : never;
|
|
20
46
|
export interface StylerBaseProps {
|
|
21
47
|
class?: ClassValue;
|
|
22
48
|
}
|
|
49
|
+
export type StylerProps<T> = T extends CTReturn<infer V, any, any, infer B, infer S> ? Parameters<Styler<CVReturnType<V, S, B>>>[0] : never;
|
|
23
50
|
export type StylerReturnType<T> = T extends CVReturnType<infer V, infer S, infer B> ? ReturnType<CVReturnType<V, S, B>> : never;
|
|
24
51
|
export type Styler<T> = T extends CVReturnType<infer V, any, any> ? [keyof V] extends string[] ? (props: VariantProps<T> & StylerBaseProps) => StylerReturnType<T> : (props?: StylerBaseProps) => StylerReturnType<T> : never;
|
|
25
|
-
export
|
|
26
|
-
(event: 'update:modelValue', payload: SelectModelValue<T, V, M, DV>): void;
|
|
27
|
-
}
|
|
28
|
-
export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T extends Record<string, any> ? V extends keyof T ? T[V] : DV : T) extends infer U ? M extends true ? U[] : U : never;
|
|
29
|
-
export type SelectOptionKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
52
|
+
export {};
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { createDefu } from "defu";
|
|
1
|
+
import { createDefu, defu } from "defu";
|
|
2
2
|
export const extendTheme = createDefu((obj, key, value) => {
|
|
3
|
+
if (typeof obj[key] === "string" && typeof value !== "string") {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (key === "compoundVariants" && Array.isArray(value)) {
|
|
7
|
+
obj[key] = [...obj[key], ...value];
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
3
13
|
if (key === "app") {
|
|
4
|
-
obj[key] =
|
|
14
|
+
obj[key] = defu(value, obj[key]);
|
|
5
15
|
return true;
|
|
6
16
|
}
|
|
7
17
|
if (typeof obj[key] === "string" && typeof value === "string") {
|
|
@@ -9,8 +19,9 @@ export const extendTheme = createDefu((obj, key, value) => {
|
|
|
9
19
|
obj[key] += ` ${value}`;
|
|
10
20
|
return true;
|
|
11
21
|
}
|
|
12
|
-
if (Array.isArray(obj[key]) && typeof value === "string") {
|
|
13
|
-
|
|
22
|
+
if (Array.isArray(obj[key]) && typeof obj[key][0] === "string" && typeof value === "string") {
|
|
23
|
+
if (value.trim())
|
|
24
|
+
obj[key].push(value);
|
|
14
25
|
return true;
|
|
15
26
|
}
|
|
16
27
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { FormSchema, ValidateReturnSchema } from '../types/form.js';
|
|
3
|
+
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
4
|
+
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
5
|
+
export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isStandardSchema(schema) {
|
|
2
|
+
return "~standard" in schema;
|
|
3
|
+
}
|
|
4
|
+
export async function validateStandardSchema(state, schema) {
|
|
5
|
+
const result = await schema["~standard"].validate(state);
|
|
6
|
+
if (result.issues) {
|
|
7
|
+
return {
|
|
8
|
+
errors: result.issues?.map((issue) => ({
|
|
9
|
+
name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
|
|
10
|
+
message: issue.message
|
|
11
|
+
})) || [],
|
|
12
|
+
result: null
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
errors: null,
|
|
17
|
+
result: result.value
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function validateSchema(state, schema) {
|
|
21
|
+
if (isStandardSchema(schema))
|
|
22
|
+
return validateStandardSchema(state, schema);
|
|
23
|
+
throw new Error("Form validation failed: Unsupported form schema");
|
|
24
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Messages } from '../types/index.js';
|
|
2
2
|
import type { Locale } from './translator.js';
|
|
3
3
|
export * from './extend-theme.js';
|
|
4
|
+
export * from './form.js';
|
|
4
5
|
export * from './link.js';
|
|
5
6
|
export * from './styler.js';
|
|
6
7
|
export * from './translator.js';
|
|
@@ -12,3 +13,4 @@ export declare function omit<Data extends object, Keys extends keyof Data>(data:
|
|
|
12
13
|
export declare function get(object: Record<string, any> | undefined, path: (string | number)[] | string, defaultValue?: any): any;
|
|
13
14
|
export declare function set(object: Record<string, any>, path: (string | number)[] | string, value: any): void;
|
|
14
15
|
export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
|
|
16
|
+
export declare function isArrayOfArray<T>(item: T[] | T[][]): item is T[][];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isEqual } from "ohash";
|
|
2
2
|
export * from "./extend-theme.js";
|
|
3
|
+
export * from "./form.js";
|
|
3
4
|
export * from "./link.js";
|
|
4
5
|
export * from "./styler.js";
|
|
5
6
|
export * from "./translator.js";
|
|
@@ -61,3 +62,6 @@ export function compare(value, currentValue, comparator) {
|
|
|
61
62
|
return get(value, comparator) === get(currentValue, comparator);
|
|
62
63
|
return isEqual(value, currentValue);
|
|
63
64
|
}
|
|
65
|
+
export function isArrayOfArray(item) {
|
|
66
|
+
return Array.isArray(item[0]);
|
|
67
|
+
}
|
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import type { LinkProps } from '../types/index.js';
|
|
2
2
|
export declare function pickLinkProps(link: LinkProps & {
|
|
3
|
-
|
|
4
|
-
title?: string;
|
|
3
|
+
[key: string]: any;
|
|
5
4
|
}): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
to: any;
|
|
10
|
-
type: any;
|
|
11
|
-
replace: any;
|
|
12
|
-
activeClass: any;
|
|
13
|
-
ariaCurrentValue: any;
|
|
14
|
-
ariaLabel: any;
|
|
15
|
-
as: any;
|
|
16
|
-
disableClass: any;
|
|
17
|
-
exact: any;
|
|
18
|
-
exactActiveClass: any;
|
|
19
|
-
exactHash: any;
|
|
20
|
-
exactQuery: any;
|
|
21
|
-
external: any;
|
|
22
|
-
href: any;
|
|
23
|
-
inactiveClass: any;
|
|
24
|
-
noPrefetch: any;
|
|
25
|
-
noRel: any;
|
|
26
|
-
prefetch: any;
|
|
27
|
-
prefetchedClass: any;
|
|
28
|
-
rel: any;
|
|
29
|
-
target: any;
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
[x: number]: any;
|
|
7
|
+
[x: symbol]: any;
|
|
30
8
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
2
|
export function pickLinkProps(link) {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const keys = Object.keys(link);
|
|
4
|
+
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
5
|
+
const dataKeys = keys.filter((key) => key.startsWith("data-"));
|
|
6
|
+
const pickProps = [
|
|
5
7
|
"active",
|
|
6
8
|
"activeClass",
|
|
7
9
|
"ariaCurrentValue",
|
|
8
|
-
"ariaLabel",
|
|
9
10
|
"as",
|
|
10
11
|
"disabled",
|
|
11
12
|
"disableClass",
|
|
@@ -26,5 +27,11 @@ export function pickLinkProps(link) {
|
|
|
26
27
|
"to",
|
|
27
28
|
"type",
|
|
28
29
|
"title"
|
|
30
|
+
];
|
|
31
|
+
return reactivePick(
|
|
32
|
+
link,
|
|
33
|
+
...pickProps,
|
|
34
|
+
...ariaKeys,
|
|
35
|
+
...dataKeys
|
|
29
36
|
);
|
|
30
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.3e7fad19.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|