@byyuurin/ui 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +5 -3
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +2 -2
  4. package/dist/runtime/components/Accordion.vue +2 -2
  5. package/dist/runtime/components/Accordion.vue.d.ts +11 -7
  6. package/dist/runtime/components/Alert.vue +2 -1
  7. package/dist/runtime/components/Alert.vue.d.ts +4 -4
  8. package/dist/runtime/components/App.vue +2 -1
  9. package/dist/runtime/components/App.vue.d.ts +11 -7
  10. package/dist/runtime/components/Avatar.vue +2 -1
  11. package/dist/runtime/components/Avatar.vue.d.ts +4 -3
  12. package/dist/runtime/components/AvatarGroup.vue +2 -1
  13. package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
  14. package/dist/runtime/components/Badge.vue +4 -3
  15. package/dist/runtime/components/Badge.vue.d.ts +2 -2
  16. package/dist/runtime/components/Breadcrumb.vue +2 -2
  17. package/dist/runtime/components/Breadcrumb.vue.d.ts +10 -6
  18. package/dist/runtime/components/Button.vue +8 -8
  19. package/dist/runtime/components/Button.vue.d.ts +1 -1
  20. package/dist/runtime/components/Calendar.vue +2 -1
  21. package/dist/runtime/components/Calendar.vue.d.ts +16 -12
  22. package/dist/runtime/components/Card.vue +2 -1
  23. package/dist/runtime/components/Card.vue.d.ts +1 -1
  24. package/dist/runtime/components/Carousel.vue +2 -1
  25. package/dist/runtime/components/Carousel.vue.d.ts +14 -10
  26. package/dist/runtime/components/Checkbox.vue +4 -2
  27. package/dist/runtime/components/Checkbox.vue.d.ts +4 -3
  28. package/dist/runtime/components/CheckboxGroup.vue +4 -3
  29. package/dist/runtime/components/CheckboxGroup.vue.d.ts +11 -7
  30. package/dist/runtime/components/Chip.vue +5 -1
  31. package/dist/runtime/components/Chip.vue.d.ts +2 -2
  32. package/dist/runtime/components/Collapsible.vue +2 -1
  33. package/dist/runtime/components/Collapsible.vue.d.ts +2 -2
  34. package/dist/runtime/components/Drawer.vue +2 -1
  35. package/dist/runtime/components/Drawer.vue.d.ts +6 -6
  36. package/dist/runtime/components/DropdownMenu.vue +3 -3
  37. package/dist/runtime/components/DropdownMenu.vue.d.ts +17 -9
  38. package/dist/runtime/components/DropdownMenuContent.vue +11 -12
  39. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +11 -7
  40. package/dist/runtime/components/FieldGroup.vue +2 -1
  41. package/dist/runtime/components/FieldGroup.vue.d.ts +2 -2
  42. package/dist/runtime/components/FileUpload.vue +267 -0
  43. package/dist/runtime/components/FileUpload.vue.d.ts +178 -0
  44. package/dist/runtime/components/Form.vue +2 -1
  45. package/dist/runtime/components/Form.vue.d.ts +13 -8
  46. package/dist/runtime/components/FormField.vue +6 -4
  47. package/dist/runtime/components/FormField.vue.d.ts +7 -2
  48. package/dist/runtime/components/Icon.vue.d.ts +1 -1
  49. package/dist/runtime/components/Input.vue +4 -4
  50. package/dist/runtime/components/Input.vue.d.ts +16 -12
  51. package/dist/runtime/components/InputNumber.vue +3 -2
  52. package/dist/runtime/components/InputNumber.vue.d.ts +128 -124
  53. package/dist/runtime/components/InputTags.vue +2 -1
  54. package/dist/runtime/components/InputTags.vue.d.ts +16 -11
  55. package/dist/runtime/components/Kbd.vue +2 -1
  56. package/dist/runtime/components/Kbd.vue.d.ts +2 -2
  57. package/dist/runtime/components/Link.vue +5 -3
  58. package/dist/runtime/components/Link.vue.d.ts +16 -6
  59. package/dist/runtime/components/LinkBase.vue.d.ts +2 -2
  60. package/dist/runtime/components/Marquee.vue +2 -1
  61. package/dist/runtime/components/Marquee.vue.d.ts +3 -3
  62. package/dist/runtime/components/Modal.vue +3 -2
  63. package/dist/runtime/components/Modal.vue.d.ts +6 -6
  64. package/dist/runtime/components/NavigationMenu.vue +2 -2
  65. package/dist/runtime/components/NavigationMenu.vue.d.ts +11 -7
  66. package/dist/runtime/components/Pagination.vue +2 -1
  67. package/dist/runtime/components/Pagination.vue.d.ts +4 -4
  68. package/dist/runtime/components/PinInput.vue +4 -4
  69. package/dist/runtime/components/PinInput.vue.d.ts +14 -10
  70. package/dist/runtime/components/Popover.vue +1 -1
  71. package/dist/runtime/components/Popover.vue.d.ts +11 -7
  72. package/dist/runtime/components/Progress.vue +2 -1
  73. package/dist/runtime/components/Progress.vue.d.ts +2 -2
  74. package/dist/runtime/components/RadioGroup.vue +3 -3
  75. package/dist/runtime/components/RadioGroup.vue.d.ts +11 -7
  76. package/dist/runtime/components/ScrollArea.vue +2 -1
  77. package/dist/runtime/components/ScrollArea.vue.d.ts +2 -2
  78. package/dist/runtime/components/Select.vue +282 -131
  79. package/dist/runtime/components/Select.vue.d.ts +103 -123
  80. package/dist/runtime/components/Separator.vue +2 -1
  81. package/dist/runtime/components/Separator.vue.d.ts +2 -2
  82. package/dist/runtime/components/Skeleton.vue +2 -1
  83. package/dist/runtime/components/Skeleton.vue.d.ts +2 -2
  84. package/dist/runtime/components/Slider.vue +2 -1
  85. package/dist/runtime/components/Slider.vue.d.ts +11 -7
  86. package/dist/runtime/components/Stepper.vue +117 -0
  87. package/dist/runtime/components/Stepper.vue.d.ts +83 -0
  88. package/dist/runtime/components/Switch.vue +3 -4
  89. package/dist/runtime/components/Switch.vue.d.ts +4 -3
  90. package/dist/runtime/components/Table.vue +2 -1
  91. package/dist/runtime/components/Table.vue.d.ts +13 -8
  92. package/dist/runtime/components/Tabs.vue +2 -2
  93. package/dist/runtime/components/Tabs.vue.d.ts +12 -8
  94. package/dist/runtime/components/Textarea.vue +3 -3
  95. package/dist/runtime/components/Textarea.vue.d.ts +16 -11
  96. package/dist/runtime/components/Timeline.vue +2 -1
  97. package/dist/runtime/components/Timeline.vue.d.ts +11 -7
  98. package/dist/runtime/components/Toast.vue +2 -1
  99. package/dist/runtime/components/Toast.vue.d.ts +5 -5
  100. package/dist/runtime/components/ToastProvider.vue +2 -2
  101. package/dist/runtime/components/ToastProvider.vue.d.ts +3 -3
  102. package/dist/runtime/components/Tooltip.vue +4 -4
  103. package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
  104. package/dist/runtime/components/Tree.vue +241 -0
  105. package/dist/runtime/components/Tree.vue.d.ts +121 -0
  106. package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
  107. package/dist/runtime/composables/defineShortcuts.js +44 -8
  108. package/dist/runtime/composables/useFileUpload.d.ts +19 -0
  109. package/dist/runtime/composables/useFileUpload.js +79 -0
  110. package/dist/runtime/composables/useLocale.d.ts +18 -0
  111. package/dist/runtime/locale/en.d.ts +9 -0
  112. package/dist/runtime/locale/en.js +9 -0
  113. package/dist/runtime/locale/zh_tw.d.ts +9 -0
  114. package/dist/runtime/locale/zh_tw.js +9 -0
  115. package/dist/runtime/types/html.d.ts +8 -0
  116. package/dist/runtime/types/html.js +0 -0
  117. package/dist/runtime/types/index.d.ts +3 -0
  118. package/dist/runtime/types/index.js +3 -0
  119. package/dist/runtime/types/input.d.ts +5 -5
  120. package/dist/runtime/types/locale.d.ts +9 -0
  121. package/dist/runtime/types/utils.d.ts +4 -4
  122. package/dist/runtime/utils/index.d.ts +3 -3
  123. package/dist/runtime/utils/link.d.ts +2 -1
  124. package/dist/runtime/utils/link.js +40 -29
  125. package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
  126. package/dist/runtime/vue/components/Link.vue +7 -12
  127. package/dist/runtime/vue/components/Link.vue.d.ts +11 -40
  128. package/dist/setup.d.mts +1 -1
  129. package/dist/shared/{ui.DpbffTXs.d.mts → ui.CGCKYv7g.d.mts} +6 -2
  130. package/dist/shared/{ui.CzIlLITK.mjs → ui.DYMXCXO6.mjs} +9 -5
  131. package/dist/shared/{ui.DLOxhmP0.mjs → ui.DcEKQd0n.mjs} +490 -20
  132. package/dist/unocss.mjs +1 -1
  133. package/dist/unplugin.d.mts +1 -1
  134. package/dist/unplugin.mjs +2 -2
  135. package/dist/vite.d.mts +1 -1
  136. package/dist/vite.mjs +2 -2
  137. package/package.json +31 -31
@@ -1,9 +1,11 @@
1
1
  import type { VariantProps } from '@byyuurin/ui-kit';
2
- import type { SelectArrowProps, SelectContentEmits, SelectContentProps, SelectRootEmits, SelectRootProps } from 'reka-ui';
2
+ import type { ComboboxArrowProps, ComboboxContentEmits, ComboboxContentProps, ComboboxRootEmits, ComboboxRootProps } from 'reka-ui';
3
3
  import theme from '#build/ui/select';
4
4
  import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
- import type { AvatarProps, ChipProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
6
- import type { AcceptableValue, ArrayOrNested, EmitsToProps, GetItemKeys, GetModelValue, GetModelValueEmits, MaybeNull, NestedItem, StaticSlot } from '../types/utils';
5
+ import type { AvatarProps, ButtonProps, ChipProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps, InputProps, LinkPropsKeys } from '../types';
6
+ import type { ButtonHTMLAttributes } from '../types/html';
7
+ import type { ModelModifiers } from '../types/input';
8
+ import type { AcceptableValue, ArrayOrNested, EmitsToProps, GetItemKeys, GetModelValue, GetModelValueEmits, MaybeNull, NestedItem, Nullable, StaticSlot } from '../types/utils';
7
9
  export type SelectValue = Exclude<AcceptableValue, boolean>;
8
10
  export type SelectItem = SelectValue | {
9
11
  label?: string;
@@ -24,10 +26,22 @@ export type SelectItem = SelectValue | {
24
26
  [key: string]: any;
25
27
  };
26
28
  type ThemeVariants = VariantProps<typeof theme>;
27
- export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends ComponentBaseProps, UseComponentIconsProps, Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'> {
29
+ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends Nullable<GetItemKeys<T>> = 'value', M extends boolean = false> extends ComponentBaseProps, UseComponentIconsProps, Pick<ComboboxRootProps, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'resetSearchTermOnSelect' | 'resetModelValueOnClear' | 'highlightOnHover'>, /** @vue-ignore */ Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'value' | 'name'> {
28
30
  id?: string;
29
31
  /** The placeholder text when the select is empty. */
30
32
  placeholder?: string;
33
+ /**
34
+ * Whether to display the search input or not.
35
+ *
36
+ * Can be an object to pass additional props to the input.
37
+ *
38
+ * `{ placeholder: "Search...", variant: "none" }`
39
+ *
40
+ * @default false
41
+ */
42
+ searchInput?: boolean | InputProps;
43
+ searchTerm?: string;
44
+ required?: boolean;
31
45
  /** @default "outline" */
32
46
  variant?: ThemeVariants['variant'];
33
47
  /** @default "md" */
@@ -44,16 +58,27 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
44
58
  * @default app.icons.check
45
59
  */
46
60
  selectedIcon?: IconProps['name'];
61
+ /**
62
+ * Display a clear button to reset the model value.
63
+ * Can be an object to pass additional props to the Button.
64
+ * @default false
65
+ */
66
+ clear?: boolean | Partial<Omit<ButtonProps, LinkPropsKeys>>;
67
+ /**
68
+ * The icon displayed in the clear button.
69
+ * @default app.icons.close
70
+ */
71
+ clearIcon?: IconProps['name'];
47
72
  /**
48
73
  * The content of the menu.
49
74
  * @default { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
50
75
  */
51
- content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<SelectContentEmits>>;
76
+ content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>;
52
77
  /**
53
78
  * Display an arrow alongside the menu.
54
79
  * @default false
55
80
  */
56
- arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>;
81
+ arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>;
57
82
  /**
58
83
  * Render the menu in a portal.
59
84
  * @default true
@@ -79,20 +104,49 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
79
104
  defaultValue?: MaybeNull<GetModelValue<T, VK, M>>;
80
105
  /** The controlled value of the Select. Can be bind as `v-model`. */
81
106
  modelValue?: MaybeNull<GetModelValue<T, VK, M>>;
107
+ modelModifiers?: Omit<ModelModifiers<GetModelValue<T, VK, M>>, 'lazy'>;
82
108
  /** Whether multiple options can be selected or not. */
83
109
  multiple?: M & boolean;
84
110
  /** Highlight the ring color like a focus state. */
85
111
  highlight?: boolean;
112
+ /**
113
+ * Determines if custom user input that does not exist in options can be added.
114
+ * @default false
115
+ */
116
+ createItem?: boolean | 'always' | {
117
+ position?: 'top' | 'bottom';
118
+ when?: 'empty' | 'always';
119
+ };
120
+ /**
121
+ * Fields to filter items by.
122
+ * @default [labelKey]
123
+ */
124
+ filterFields?: string[];
125
+ /**
126
+ * When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
127
+ * @default false
128
+ */
129
+ ignoreFilter?: boolean;
86
130
  autofocus?: boolean;
87
131
  autofocusDelay?: number;
88
132
  ui?: ComponentUIProps<typeof theme>;
89
133
  }
90
- export type SelectEmits<A extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Omit<SelectRootEmits, 'update:modelValue'> & {
91
- change: [event: Event];
92
- blur: [event: FocusEvent];
93
- focus: [event: FocusEvent];
134
+ export type SelectEmits<A extends ArrayOrNested<SelectItem>, VK extends Nullable<GetItemKeys<A>>, M extends boolean> = Omit<ComboboxRootEmits, 'update:modelValue'> & {
135
+ 'change': [event: Event];
136
+ 'blur': [event: FocusEvent];
137
+ 'focus': [event: FocusEvent];
138
+ 'create': [item: string];
139
+ 'clear': [];
140
+ /** Event handler when highlighted element changes. */
141
+ 'highlight': [
142
+ payload: {
143
+ ref: HTMLElement;
144
+ value: GetModelValue<A, VK, M>;
145
+ } | undefined
146
+ ];
147
+ 'update:searchTerm': [value: string];
94
148
  } & GetModelValueEmits<A, VK, M>;
95
- export interface SelectSlots<A extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined = undefined, M extends boolean = false, T extends NestedItem<A> = NestedItem<A>> {
149
+ export interface SelectSlots<A extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends Nullable<GetItemKeys<A>> = undefined, M extends boolean = false, T extends NestedItem<A> = NestedItem<A>> {
96
150
  'leading': StaticSlot<{
97
151
  modelValue?: MaybeNull<GetModelValue<A, VK, M>>;
98
152
  open: boolean;
@@ -108,6 +162,9 @@ export interface SelectSlots<A extends ArrayOrNested<SelectItem> = ArrayOrNested
108
162
  open: boolean;
109
163
  ui: ComponentStyler<typeof theme>;
110
164
  }>;
165
+ 'empty': StaticSlot<{
166
+ searchTerm?: string;
167
+ }>;
111
168
  'item': StaticSlot<{
112
169
  item: T;
113
170
  index: number;
@@ -133,128 +190,51 @@ export interface SelectSlots<A extends ArrayOrNested<SelectItem> = ArrayOrNested
133
190
  }>;
134
191
  'content-top': StaticSlot;
135
192
  'content-bottom': StaticSlot;
193
+ 'create-item-label': StaticSlot<{
194
+ item: string;
195
+ }>;
136
196
  }
137
- declare const __VLS_export: <T extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = "value", M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
138
- props: __VLS_PrettifyLocal<SelectProps<T, VK, M> & {
139
- onChange?: ((event: Event) => any) | undefined;
197
+ declare const _default: typeof __VLS_export;
198
+ export default _default;
199
+ declare const __VLS_export: <T extends ArrayOrNested<SelectItem>, VK extends Nullable<GetItemKeys<T>> = "value", M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
200
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(SelectProps<T, VK, M> & {
201
+ searchTerm?: string;
202
+ }) & {
140
203
  onBlur?: ((event: FocusEvent) => any) | undefined;
204
+ onChange?: ((event: Event) => any) | undefined;
141
205
  onFocus?: ((event: FocusEvent) => any) | undefined;
206
+ onHighlight?: ((...args: (({
207
+ ref: HTMLElement;
208
+ value: import("reka-ui").AcceptableValue;
209
+ } & {
210
+ ref: HTMLElement;
211
+ value: GetModelValue<T, VK, M>;
212
+ }) | undefined)[]) => any) | undefined;
213
+ onCreate?: ((item: string) => any) | undefined;
214
+ onClear?: (() => any) | undefined;
142
215
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
143
216
  "onUpdate:modelValue"?: ((value: GetModelValue<T, VK, M>) => any) | undefined;
144
- }> & import("vue").PublicProps;
217
+ "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
218
+ }> & (typeof globalThis extends {
219
+ __VLS_PROPS_FALLBACK: infer P;
220
+ } ? P : {});
145
221
  expose: (exposed: import("vue").ShallowUnwrapRef<{
146
- triggerRef: import("vue").ShallowRef<MaybeNull<{
147
- $: import("vue").ComponentInternalInstance;
148
- $data: {};
149
- $props: {
150
- readonly disabled?: boolean | undefined;
151
- readonly reference?: import("reka-ui").ReferenceElement | undefined;
152
- readonly asChild?: boolean | undefined;
153
- readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
154
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
155
- $attrs: {
156
- [x: string]: unknown;
157
- };
158
- $refs: {
159
- [x: string]: unknown;
160
- };
161
- $slots: Readonly<{
162
- [name: string]: import("vue").Slot<any> | undefined;
163
- }>;
164
- $root: import("vue").ComponentPublicInstance | null;
165
- $parent: import("vue").ComponentPublicInstance | null;
166
- $host: Element | null;
167
- $emit: (event: string, ...args: any[]) => void;
168
- $el: any;
169
- $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
170
- as: import("reka-ui").AsTag | import("vue").Component;
171
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
172
- beforeCreate?: (() => void) | (() => void)[];
173
- created?: (() => void) | (() => void)[];
174
- beforeMount?: (() => void) | (() => void)[];
175
- mounted?: (() => void) | (() => void)[];
176
- beforeUpdate?: (() => void) | (() => void)[];
177
- updated?: (() => void) | (() => void)[];
178
- activated?: (() => void) | (() => void)[];
179
- deactivated?: (() => void) | (() => void)[];
180
- beforeDestroy?: (() => void) | (() => void)[];
181
- beforeUnmount?: (() => void) | (() => void)[];
182
- destroyed?: (() => void) | (() => void)[];
183
- unmounted?: (() => void) | (() => void)[];
184
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
185
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
186
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
187
- };
188
- $forceUpdate: () => void;
189
- $nextTick: typeof import("vue").nextTick;
190
- $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
191
- } & Readonly<{
192
- as: import("reka-ui").AsTag | import("vue").Component;
193
- }> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
194
- $slots: {
195
- default?: (props: {}) => any;
196
- };
197
- }>, MaybeNull<{
198
- $: import("vue").ComponentInternalInstance;
199
- $data: {};
200
- $props: {
201
- readonly disabled?: boolean | undefined;
202
- readonly reference?: import("reka-ui").ReferenceElement | undefined;
203
- readonly asChild?: boolean | undefined;
204
- readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
205
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
206
- $attrs: {
207
- [x: string]: unknown;
208
- };
209
- $refs: {
210
- [x: string]: unknown;
211
- };
212
- $slots: Readonly<{
213
- [name: string]: import("vue").Slot<any> | undefined;
214
- }>;
215
- $root: import("vue").ComponentPublicInstance | null;
216
- $parent: import("vue").ComponentPublicInstance | null;
217
- $host: Element | null;
218
- $emit: (event: string, ...args: any[]) => void;
219
- $el: any;
220
- $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
221
- as: import("reka-ui").AsTag | import("vue").Component;
222
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
223
- beforeCreate?: (() => void) | (() => void)[];
224
- created?: (() => void) | (() => void)[];
225
- beforeMount?: (() => void) | (() => void)[];
226
- mounted?: (() => void) | (() => void)[];
227
- beforeUpdate?: (() => void) | (() => void)[];
228
- updated?: (() => void) | (() => void)[];
229
- activated?: (() => void) | (() => void)[];
230
- deactivated?: (() => void) | (() => void)[];
231
- beforeDestroy?: (() => void) | (() => void)[];
232
- beforeUnmount?: (() => void) | (() => void)[];
233
- destroyed?: (() => void) | (() => void)[];
234
- unmounted?: (() => void) | (() => void)[];
235
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
236
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
237
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
238
- };
239
- $forceUpdate: () => void;
240
- $nextTick: typeof import("vue").nextTick;
241
- $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
242
- } & Readonly<{
243
- as: import("reka-ui").AsTag | import("vue").Component;
244
- }> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
245
- $slots: {
246
- default?: (props: {}) => any;
247
- };
248
- }>>;
222
+ triggerRef: Readonly<import("vue").Ref<HTMLButtonElement, HTMLButtonElement>>;
249
223
  }>) => void;
250
224
  attrs: any;
251
225
  slots: SelectSlots<T, VK, M, NestedItem<T>>;
252
- emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M>) => void);
226
+ emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "highlight", ...args: [payload: {
227
+ ref: HTMLElement;
228
+ value: import("reka-ui").AcceptableValue;
229
+ } | undefined] & [payload: {
230
+ ref: HTMLElement;
231
+ value: GetModelValue<T, VK, M>;
232
+ } | undefined]) => void) & ((evt: "create", item: string) => void) & ((evt: "clear") => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M>) => void) & ((evt: "update:searchTerm", value: string) => void)) & ((evt: "update:searchTerm", value: string) => void);
253
233
  }>) => import("vue").VNode & {
254
234
  __ctx?: Awaited<typeof __VLS_setup>;
255
235
  };
256
- declare const _default: typeof __VLS_export;
257
- export default _default;
258
- type __VLS_PrettifyLocal<T> = {
236
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
237
+ [K in keyof T]: T[K];
238
+ } : {
259
239
  [K in keyof T as K]: T[K];
260
- } & {};
240
+ }) & {};
@@ -7,6 +7,7 @@ import { reactivePick } from "@vueuse/core";
7
7
  import { Separator, useForwardProps } from "reka-ui";
8
8
  import { computed } from "vue";
9
9
  import { useAppConfig } from "#imports";
10
+ import { pick } from "../utils";
10
11
  import { cv, merge } from "../utils/style";
11
12
  import Avatar from "./Avatar.vue";
12
13
  import Icon from "./Icon.vue";
@@ -29,7 +30,7 @@ const rootProps = useForwardProps(reactivePick(props, "as", "decorative", "orien
29
30
  const appConfig = useAppConfig();
30
31
  const ui = computed(() => {
31
32
  const styler = cv(merge(theme, appConfig.ui.separator));
32
- return styler(props);
33
+ return styler(pick(props, ["color", "orientation", "size", "type"]));
33
34
  });
34
35
  </script>
35
36
 
@@ -35,12 +35,12 @@ export interface SeparatorSlots {
35
35
  ui: ComponentStyler<typeof theme>;
36
36
  }>;
37
37
  }
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
38
40
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<SeparatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SeparatorProps> & Readonly<{}>, {
39
41
  orientation: "horizontal" | "vertical";
40
42
  align: "start" | "end" | "center";
41
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SeparatorSlots>;
42
- declare const _default: typeof __VLS_export;
43
- export default _default;
44
44
  type __VLS_WithSlots<T, S> = T & {
45
45
  new (): {
46
46
  $slots: S;
@@ -6,6 +6,7 @@ import { useAppConfig } from "#imports";
6
6
  import { Primitive } from "reka-ui";
7
7
  import { computed } from "vue";
8
8
  import theme from "#build/ui/skeleton";
9
+ import { pick } from "../utils";
9
10
  import { cv, merge } from "../utils/style";
10
11
  const props = defineProps({
11
12
  as: { type: null, required: false },
@@ -14,7 +15,7 @@ const props = defineProps({
14
15
  const appConfig = useAppConfig();
15
16
  const ui = computed(() => {
16
17
  const styler = cv(merge(theme, appConfig.ui.skeleton));
17
- return styler(props);
18
+ return styler(pick(props, []));
18
19
  });
19
20
  </script>
20
21
 
@@ -7,11 +7,11 @@ export interface SkeletonProps extends ComponentBaseProps {
7
7
  */
8
8
  as?: PrimitiveProps['as'];
9
9
  }
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
10
12
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<SkeletonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SkeletonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
13
  default?: (props: {}) => any;
12
14
  }>;
13
- declare const _default: typeof __VLS_export;
14
- export default _default;
15
15
  type __VLS_WithSlots<T, S> = T & {
16
16
  new (): {
17
17
  $slots: S;
@@ -8,6 +8,7 @@ import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits
8
8
  import { computed } from "vue";
9
9
  import { useAppConfig } from "#imports";
10
10
  import { useFormField } from "../composables/useFormField";
11
+ import { pick } from "../utils";
11
12
  import { cv, merge } from "../utils/style";
12
13
  import Tooltip from "./Tooltip.vue";
13
14
  const props = defineProps({
@@ -52,7 +53,7 @@ const appConfig = useAppConfig();
52
53
  const ui = computed(() => {
53
54
  const styler = cv(merge(theme, appConfig.ui.slider));
54
55
  return styler({
55
- ...props,
56
+ ...pick(props, ["orientation"]),
56
57
  size: size.value,
57
58
  color: color.value,
58
59
  disabled: disabled.value
@@ -33,11 +33,15 @@ export interface SliderEmits<T extends MaybeArray<number>> {
33
33
  'update:modelValue': [value: T];
34
34
  'change': [event: Event];
35
35
  }
36
- declare const __VLS_export: <T extends MaybeArray<number>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
37
- props: __VLS_PrettifyLocal<SliderProps<T> & {
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
38
+ declare const __VLS_export: <T extends MaybeArray<number>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
39
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<SliderProps<T> & {
38
40
  onChange?: ((event: Event) => any) | undefined;
39
41
  "onUpdate:modelValue"?: ((value: T) => any) | undefined;
40
- }> & import("vue").PublicProps;
42
+ }> & (typeof globalThis extends {
43
+ __VLS_PROPS_FALLBACK: infer P;
44
+ } ? P : {});
41
45
  expose: (exposed: {}) => void;
42
46
  attrs: any;
43
47
  slots: {};
@@ -45,8 +49,8 @@ declare const __VLS_export: <T extends MaybeArray<number>>(__VLS_props: NonNulla
45
49
  }>) => import("vue").VNode & {
46
50
  __ctx?: Awaited<typeof __VLS_setup>;
47
51
  };
48
- declare const _default: typeof __VLS_export;
49
- export default _default;
50
- type __VLS_PrettifyLocal<T> = {
52
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
53
+ [K in keyof T]: T[K];
54
+ } : {
51
55
  [K in keyof T as K]: T[K];
52
- } & {};
56
+ }) & {};
@@ -0,0 +1,117 @@
1
+ <script>
2
+ import theme from "#build/ui/stepper";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperSeparator, StepperTitle, StepperTrigger, useForwardProps } from "reka-ui";
8
+ import { computed } from "vue";
9
+ import { useAppConfig } from "#imports";
10
+ import { pick } from "../utils";
11
+ import { cv, merge } from "../utils/style";
12
+ import Icon from "./Icon.vue";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ items: { type: Array, required: false },
16
+ size: { type: null, required: false },
17
+ color: { type: null, required: false },
18
+ orientation: { type: null, required: false, default: "horizontal" },
19
+ defaultValue: { type: [String, Number], required: false },
20
+ modelValue: { type: [String, Number], required: false },
21
+ disabled: { type: Boolean, required: false },
22
+ ui: { type: null, required: false },
23
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
24
+ linear: { type: Boolean, required: false, default: true }
25
+ });
26
+ const emit = defineEmits(["next", "prev"]);
27
+ const slots = defineSlots();
28
+ const modelValue = defineModel({ type: [String, Number] });
29
+ const appConfig = useAppConfig();
30
+ const ui = computed(() => {
31
+ const styler = cv(merge(theme, appConfig.ui.stepper));
32
+ return styler(pick(props, ["orientation", "size", "color"]));
33
+ });
34
+ const rootProps = useForwardProps(reactivePick(props, "as", "orientation", "linear"));
35
+ const currentStepIndex = computed({
36
+ get() {
37
+ const value = modelValue.value ?? props.defaultValue;
38
+ return (typeof value === "string" ? props.items?.findIndex((item) => item.value === value) : value) ?? 0;
39
+ },
40
+ set(value) {
41
+ modelValue.value = props.items?.[value]?.value ?? value;
42
+ }
43
+ });
44
+ const currentStep = computed(() => props.items?.[currentStepIndex.value]);
45
+ const hasNext = computed(() => currentStepIndex.value < (props.items?.length ?? 0) - 1);
46
+ const hasPrev = computed(() => currentStepIndex.value > 0);
47
+ defineExpose({
48
+ next() {
49
+ if (!props.disabled && hasNext.value) {
50
+ currentStepIndex.value += 1;
51
+ emit("next", currentStep.value);
52
+ }
53
+ },
54
+ prev() {
55
+ if (!props.disabled && hasPrev.value) {
56
+ currentStepIndex.value -= 1;
57
+ emit("prev", currentStep.value);
58
+ }
59
+ },
60
+ hasNext,
61
+ hasPrev
62
+ });
63
+ </script>
64
+
65
+ <template>
66
+ <StepperRoot v-bind="rootProps" v-model="currentStepIndex" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
67
+ <div :class="ui.header({ class: props.ui?.header })" data-part="header">
68
+ <StepperItem
69
+ v-for="(item, count) in props.items"
70
+ :key="item.value ?? count"
71
+ :step="count"
72
+ :disabled="item.disabled || props.disabled"
73
+ :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
74
+ data-part="item"
75
+ >
76
+ <div :class="ui.container({ class: [props.ui?.container, item.ui?.container] })" data-part="container">
77
+ <StepperTrigger :class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger] })" data-part="trigger">
78
+ <StepperIndicator :class="ui.indicator({ class: [props.ui?.indicator, item.ui?.indicator] })" data-part="indicator">
79
+ <slot name="indicator" :item="item" :ui="ui">
80
+ <Icon v-if="item.icon" :name="item.icon" :class="ui.icon({ class: [props.ui?.icon, item.ui?.icon] })" data-part="icon" />
81
+ <template v-else>
82
+ {{ count + 1 }}
83
+ </template>
84
+ </slot>
85
+ </StepperIndicator>
86
+ </StepperTrigger>
87
+
88
+ <StepperSeparator
89
+ v-if="count < props.items.length - 1"
90
+ :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })"
91
+ data-part="separator"
92
+ />
93
+ </div>
94
+
95
+ <div :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })" data-part="wrapper">
96
+ <StepperTitle as="div" :class="ui.title({ class: [props.ui?.title, item.ui?.title] })" data-part="title">
97
+ <slot name="title" :item="item">
98
+ {{ item.title }}
99
+ </slot>
100
+ </StepperTitle>
101
+
102
+ <StepperDescription as="div" :class="ui.description({ class: [props.ui?.description, item.ui?.description] })" data-part="description">
103
+ <slot name="description" :item="item">
104
+ {{ item.description }}
105
+ </slot>
106
+ </StepperDescription>
107
+ </div>
108
+ </StepperItem>
109
+ </div>
110
+
111
+ <div v-if="currentStep?.content || !!slots.content || currentStep?.slot" :class="ui.content({ class: props.ui?.content })" data-part="content">
112
+ <slot :name="currentStep?.slot || 'content'" :item="currentStep">
113
+ {{ currentStep?.content }}
114
+ </slot>
115
+ </div>
116
+ </StepperRoot>
117
+ </template>
@@ -0,0 +1,83 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { StepperRootEmits, StepperRootProps } from 'reka-ui';
3
+ import theme from '#build/ui/stepper';
4
+ import type { ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
5
+ import type { DynamicSlots, StaticSlot } from '../types/utils';
6
+ export interface StepperItem extends ComponentBaseProps {
7
+ slot?: string;
8
+ value?: string | number;
9
+ title?: string;
10
+ description?: string;
11
+ icon?: IconProps['name'];
12
+ content?: string;
13
+ disabled?: boolean;
14
+ ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'>;
15
+ [key: string]: any;
16
+ }
17
+ type ThemeVariants = VariantProps<typeof theme>;
18
+ export interface StepperProps<T extends StepperItem = StepperItem> extends ComponentBaseProps, Pick<StepperRootProps, 'linear'> {
19
+ /**
20
+ * The element or component this component should render as.
21
+ * @default "div"
22
+ */
23
+ as?: StepperRootProps['as'];
24
+ items?: T[];
25
+ /** @default "md" */
26
+ size?: ThemeVariants['size'];
27
+ /** @default "primary" */
28
+ color?: ThemeVariants['color'];
29
+ /** @default "horizontal" */
30
+ orientation?: ThemeVariants['orientation'];
31
+ defaultValue?: string | number;
32
+ modelValue?: string | number;
33
+ disabled?: boolean;
34
+ ui?: ComponentUIProps<typeof theme>;
35
+ }
36
+ export type StepperEmits<T extends StepperItem = StepperItem> = Omit<StepperRootEmits, 'update:modelValue'> & {
37
+ next: [value: T];
38
+ prev: [value: T];
39
+ };
40
+ export type StepperSlots<T extends StepperItem = StepperItem> = {
41
+ indicator: StaticSlot<{
42
+ item: T;
43
+ ui: ComponentStyler<typeof theme>;
44
+ }>;
45
+ title: StaticSlot<{
46
+ item: T;
47
+ }>;
48
+ description: StaticSlot<{
49
+ item: T;
50
+ }>;
51
+ content: StaticSlot<{
52
+ item: T;
53
+ }>;
54
+ } & DynamicSlots<T>;
55
+ declare const _default: typeof __VLS_export;
56
+ export default _default;
57
+ declare const __VLS_export: <T extends StepperItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
58
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(StepperProps<T> & {
59
+ modelValue?: string | number;
60
+ }) & {
61
+ onPrev?: ((value: T) => any) | undefined;
62
+ onNext?: ((value: T) => any) | undefined;
63
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
64
+ }> & (typeof globalThis extends {
65
+ __VLS_PROPS_FALLBACK: infer P;
66
+ } ? P : {});
67
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
68
+ next(): void;
69
+ prev(): void;
70
+ hasNext: import("vue").ComputedRef<boolean>;
71
+ hasPrev: import("vue").ComputedRef<boolean>;
72
+ }>) => void;
73
+ attrs: any;
74
+ slots: StepperSlots<T>;
75
+ emit: (((evt: "prev", value: T) => void) & ((evt: "next", value: T) => void)) & ((evt: "update:modelValue", value: string | number | undefined) => void);
76
+ }>) => import("vue").VNode & {
77
+ __ctx?: Awaited<typeof __VLS_setup>;
78
+ };
79
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
80
+ [K in keyof T]: T[K];
81
+ } : {
82
+ [K in keyof T as K]: T[K];
83
+ }) & {};
@@ -8,6 +8,7 @@ import { Label, Primitive, SwitchRoot, SwitchThumb, useForwardProps } from "reka
8
8
  import { computed, useId } from "vue";
9
9
  import { useAppConfig } from "#imports";
10
10
  import { useFormField } from "../composables/useFormField";
11
+ import { pick } from "../utils";
11
12
  import { cv, merge } from "../utils/style";
12
13
  import Icon from "./Icon.vue";
13
14
  defineOptions({ inheritAttrs: false });
@@ -41,12 +42,10 @@ const appConfig = useAppConfig();
41
42
  const ui = computed(() => {
42
43
  const styler = cv(merge(theme, appConfig.ui.switch));
43
44
  return styler({
44
- ...props,
45
+ ...pick(props, ["required", "loading"]),
45
46
  size: size.value,
46
47
  color: color.value,
47
- disabled: disabled.value || props.loading,
48
- checked: false,
49
- unchecked: false
48
+ disabled: disabled.value || props.loading
50
49
  });
51
50
  });
52
51
  function onUpdate(value) {