@byyuurin/ui 0.0.11 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/README.md +170 -58
  2. package/dist/module.d.mts +4 -13
  3. package/dist/module.json +4 -4
  4. package/dist/module.mjs +54 -20
  5. package/dist/runtime/components/Accordion.vue +28 -23
  6. package/dist/runtime/components/Accordion.vue.d.ts +51 -29
  7. package/dist/runtime/components/Alert.vue +47 -27
  8. package/dist/runtime/components/Alert.vue.d.ts +37 -25
  9. package/dist/runtime/components/App.vue +9 -8
  10. package/dist/runtime/components/App.vue.d.ts +22 -20
  11. package/dist/runtime/components/Avatar.vue +65 -21
  12. package/dist/runtime/components/Avatar.vue.d.ts +27 -13
  13. package/dist/runtime/components/AvatarGroup.vue +14 -10
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
  15. package/dist/runtime/components/Badge.vue +64 -32
  16. package/dist/runtime/components/Badge.vue.d.ts +30 -29
  17. package/dist/runtime/components/Breadcrumb.vue +40 -22
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
  19. package/dist/runtime/components/Button.vue +113 -52
  20. package/dist/runtime/components/Button.vue.d.ts +36 -20
  21. package/dist/runtime/components/Calendar.vue +48 -39
  22. package/dist/runtime/components/Calendar.vue.d.ts +58 -31
  23. package/dist/runtime/components/Card.vue +18 -14
  24. package/dist/runtime/components/Card.vue.d.ts +18 -14
  25. package/dist/runtime/components/Carousel.vue +80 -46
  26. package/dist/runtime/components/Carousel.vue.d.ts +46 -25
  27. package/dist/runtime/components/Checkbox.vue +60 -35
  28. package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
  29. package/dist/runtime/components/Chip.vue +35 -32
  30. package/dist/runtime/components/Chip.vue.d.ts +33 -15
  31. package/dist/runtime/components/Collapsible.vue +13 -9
  32. package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
  33. package/dist/runtime/components/Drawer.vue +80 -70
  34. package/dist/runtime/components/Drawer.vue.d.ts +51 -28
  35. package/dist/runtime/components/DropdownMenu.vue +23 -16
  36. package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
  37. package/dist/runtime/components/DropdownMenuContent.vue +133 -103
  38. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
  39. package/dist/runtime/components/FieldGroup.vue +33 -0
  40. package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
  41. package/dist/runtime/components/Form.vue +172 -88
  42. package/dist/runtime/components/Form.vue.d.ts +69 -44
  43. package/dist/runtime/components/FormField.vue +108 -0
  44. package/dist/runtime/components/FormField.vue.d.ts +63 -0
  45. package/dist/runtime/components/Icon.vue +20 -0
  46. package/dist/runtime/components/Icon.vue.d.ts +9 -0
  47. package/dist/runtime/components/Input.vue +82 -77
  48. package/dist/runtime/components/Input.vue.d.ts +55 -43
  49. package/dist/runtime/components/InputNumber.vue +65 -49
  50. package/dist/runtime/components/InputNumber.vue.d.ts +51 -105
  51. package/dist/runtime/components/Kbd.vue +11 -5
  52. package/dist/runtime/components/Kbd.vue.d.ts +17 -11
  53. package/dist/runtime/components/Link.vue +54 -197
  54. package/dist/runtime/components/Link.vue.d.ts +17 -17
  55. package/dist/runtime/components/LinkBase.vue +11 -33
  56. package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
  57. package/dist/runtime/components/Modal.vue +53 -39
  58. package/dist/runtime/components/Modal.vue.d.ts +64 -34
  59. package/dist/runtime/components/NavigationMenu.vue +336 -0
  60. package/dist/runtime/components/NavigationMenu.vue.d.ts +181 -0
  61. package/dist/runtime/components/OverlayProvider.vue +3 -3
  62. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
  63. package/dist/runtime/components/Pagination.vue +39 -47
  64. package/dist/runtime/components/Pagination.vue.d.ts +54 -31
  65. package/dist/runtime/components/PinInput.vue +46 -32
  66. package/dist/runtime/components/PinInput.vue.d.ts +40 -21
  67. package/dist/runtime/components/Popover.vue +33 -19
  68. package/dist/runtime/components/Popover.vue.d.ts +57 -32
  69. package/dist/runtime/components/Progress.vue +31 -26
  70. package/dist/runtime/components/Progress.vue.d.ts +32 -23
  71. package/dist/runtime/components/RadioGroup.vue +75 -48
  72. package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
  73. package/dist/runtime/components/ScrollArea.vue +33 -31
  74. package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
  75. package/dist/runtime/components/Select.vue +166 -76
  76. package/dist/runtime/components/Select.vue.d.ts +206 -65
  77. package/dist/runtime/components/Separator.vue +42 -16
  78. package/dist/runtime/components/Separator.vue.d.ts +35 -14
  79. package/dist/runtime/components/Skeleton.vue +18 -6
  80. package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
  81. package/dist/runtime/components/Slider.vue +42 -24
  82. package/dist/runtime/components/Slider.vue.d.ts +43 -27
  83. package/dist/runtime/components/Switch.vue +40 -31
  84. package/dist/runtime/components/Switch.vue.d.ts +36 -27
  85. package/dist/runtime/components/Table.vue +279 -51
  86. package/dist/runtime/components/Table.vue.d.ts +151 -65
  87. package/dist/runtime/components/Tabs.vue +70 -23
  88. package/dist/runtime/components/Tabs.vue.d.ts +61 -29
  89. package/dist/runtime/components/Textarea.vue +102 -54
  90. package/dist/runtime/components/Textarea.vue.d.ts +57 -41
  91. package/dist/runtime/components/Toast.vue +84 -38
  92. package/dist/runtime/components/Toast.vue.d.ts +48 -27
  93. package/dist/runtime/components/ToastProvider.vue +31 -22
  94. package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
  95. package/dist/runtime/components/Tooltip.vue +33 -21
  96. package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
  97. package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
  98. package/dist/runtime/composables/defineShortcuts.js +129 -0
  99. package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
  100. package/dist/runtime/composables/useAvatarGroup.js +10 -3
  101. package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
  102. package/dist/runtime/composables/useComponentIcons.js +4 -4
  103. package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
  104. package/dist/runtime/composables/useFieldGroup.js +14 -0
  105. package/dist/runtime/composables/useFormField.d.ts +62 -0
  106. package/dist/runtime/composables/useFormField.js +99 -0
  107. package/dist/runtime/composables/useKbd.d.ts +3 -2
  108. package/dist/runtime/composables/useKbd.js +3 -2
  109. package/dist/runtime/composables/useLocale.d.ts +68 -5
  110. package/dist/runtime/composables/useLocale.js +11 -11
  111. package/dist/runtime/composables/useOverlay.d.ts +51 -15
  112. package/dist/runtime/composables/useOverlay.js +44 -30
  113. package/dist/runtime/composables/usePortal.d.ts +6 -0
  114. package/dist/runtime/composables/usePortal.js +17 -0
  115. package/dist/runtime/composables/useToast.d.ts +12 -5
  116. package/dist/runtime/composables/useToast.js +12 -7
  117. package/dist/runtime/locale/en.d.ts +30 -1
  118. package/dist/runtime/locale/en.js +2 -1
  119. package/dist/runtime/locale/index.d.ts +2 -2
  120. package/dist/runtime/locale/index.js +1 -1
  121. package/dist/runtime/locale/zh_tw.d.ts +31 -0
  122. package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
  123. package/dist/runtime/plugins/colors.d.ts +2 -0
  124. package/dist/runtime/plugins/colors.js +50 -0
  125. package/dist/runtime/types/app.config.d.ts +6 -0
  126. package/dist/runtime/types/form.d.ts +58 -17
  127. package/dist/runtime/types/form.js +11 -0
  128. package/dist/runtime/types/index.d.ts +51 -8
  129. package/dist/runtime/types/index.js +45 -2
  130. package/dist/runtime/types/input.d.ts +8 -0
  131. package/dist/runtime/types/locale.d.ts +5 -0
  132. package/dist/runtime/types/style.d.ts +33 -0
  133. package/dist/runtime/types/style.js +0 -0
  134. package/dist/runtime/types/unocss.d.ts +4 -0
  135. package/dist/runtime/types/utils.d.ts +38 -37
  136. package/dist/runtime/utils/form.d.ts +5 -1
  137. package/dist/runtime/utils/form.js +49 -0
  138. package/dist/runtime/utils/index.d.ts +10 -13
  139. package/dist/runtime/utils/index.js +41 -48
  140. package/dist/runtime/utils/link.d.ts +3 -2
  141. package/dist/runtime/utils/link.js +16 -2
  142. package/dist/runtime/utils/locale.d.ts +5 -0
  143. package/dist/runtime/utils/locale.js +10 -0
  144. package/dist/runtime/utils/style.d.ts +94 -0
  145. package/dist/runtime/utils/style.js +37 -0
  146. package/dist/runtime/vue/components/Icon.vue +15 -0
  147. package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
  148. package/dist/runtime/vue/components/Link.vue +163 -0
  149. package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
  150. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  151. package/dist/runtime/vue/composables/useAppConfig.js +4 -0
  152. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  153. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  154. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  155. package/dist/runtime/vue/plugins/head.js +9 -0
  156. package/dist/runtime/vue/stubs.d.ts +16 -1
  157. package/dist/runtime/vue/stubs.js +32 -1
  158. package/dist/setup.d.mts +13 -0
  159. package/dist/setup.mjs +12 -0
  160. package/dist/shared/ui.CzIlLITK.mjs +51 -0
  161. package/dist/shared/ui.DSyJHSTk.mjs +3787 -0
  162. package/dist/shared/ui.DpbffTXs.d.mts +84 -0
  163. package/dist/shared/ui.IulR-OYx.d.mts +64 -0
  164. package/dist/types.d.mts +3 -1
  165. package/dist/unocss.d.mts +12 -52
  166. package/dist/unocss.mjs +144 -254
  167. package/dist/unplugin.d.mts +13 -26
  168. package/dist/unplugin.mjs +193 -18
  169. package/dist/vite.d.mts +10 -1
  170. package/dist/vite.mjs +12 -3
  171. package/package.json +154 -87
  172. package/vue-plugin.d.ts +5 -0
  173. package/dist/module.d.ts +0 -13
  174. package/dist/module.mjs.map +0 -1
  175. package/dist/runtime/app/injections.d.ts +0 -9331
  176. package/dist/runtime/app/injections.js +0 -61
  177. package/dist/runtime/components/ButtonGroup.vue +0 -26
  178. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
  179. package/dist/runtime/components/FormItem.vue +0 -90
  180. package/dist/runtime/components/FormItem.vue.d.ts +0 -60
  181. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  182. package/dist/runtime/composables/useButtonGroup.js +0 -9
  183. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  184. package/dist/runtime/composables/useFormItem.js +0 -64
  185. package/dist/runtime/composables/useTheme.d.ts +0 -9
  186. package/dist/runtime/composables/useTheme.js +0 -23
  187. package/dist/runtime/index.d.ts +0 -44
  188. package/dist/runtime/index.js +0 -44
  189. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  190. package/dist/runtime/theme/accordion.d.ts +0 -50
  191. package/dist/runtime/theme/accordion.js +0 -28
  192. package/dist/runtime/theme/alert.d.ts +0 -119
  193. package/dist/runtime/theme/alert.js +0 -47
  194. package/dist/runtime/theme/app.d.ts +0 -19
  195. package/dist/runtime/theme/app.js +0 -19
  196. package/dist/runtime/theme/avatar-group.d.ts +0 -46
  197. package/dist/runtime/theme/avatar-group.js +0 -32
  198. package/dist/runtime/theme/avatar.d.ts +0 -50
  199. package/dist/runtime/theme/avatar.js +0 -34
  200. package/dist/runtime/theme/badge.d.ts +0 -76
  201. package/dist/runtime/theme/badge.js +0 -92
  202. package/dist/runtime/theme/breadcrumb.d.ts +0 -61
  203. package/dist/runtime/theme/breadcrumb.js +0 -44
  204. package/dist/runtime/theme/button-group.d.ts +0 -60
  205. package/dist/runtime/theme/button-group.js +0 -42
  206. package/dist/runtime/theme/button.d.ts +0 -184
  207. package/dist/runtime/theme/button.js +0 -164
  208. package/dist/runtime/theme/calendar.d.ts +0 -58
  209. package/dist/runtime/theme/calendar.js +0 -86
  210. package/dist/runtime/theme/card.d.ts +0 -56
  211. package/dist/runtime/theme/card.js +0 -37
  212. package/dist/runtime/theme/carousel.d.ts +0 -107
  213. package/dist/runtime/theme/carousel.js +0 -43
  214. package/dist/runtime/theme/checkbox.d.ts +0 -82
  215. package/dist/runtime/theme/checkbox.js +0 -54
  216. package/dist/runtime/theme/chip.d.ts +0 -61
  217. package/dist/runtime/theme/chip.js +0 -66
  218. package/dist/runtime/theme/collapsible.d.ts +0 -32
  219. package/dist/runtime/theme/collapsible.js +0 -10
  220. package/dist/runtime/theme/drawer.d.ts +0 -142
  221. package/dist/runtime/theme/drawer.js +0 -113
  222. package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
  223. package/dist/runtime/theme/dropdown-menu.js +0 -83
  224. package/dist/runtime/theme/form-item.d.ts +0 -70
  225. package/dist/runtime/theme/form-item.js +0 -34
  226. package/dist/runtime/theme/form.d.ts +0 -2
  227. package/dist/runtime/theme/form.js +0 -7
  228. package/dist/runtime/theme/index.d.ts +0 -41
  229. package/dist/runtime/theme/index.js +0 -41
  230. package/dist/runtime/theme/input-number.d.ts +0 -115
  231. package/dist/runtime/theme/input-number.js +0 -95
  232. package/dist/runtime/theme/input.d.ts +0 -172
  233. package/dist/runtime/theme/input.js +0 -151
  234. package/dist/runtime/theme/kbd.d.ts +0 -33
  235. package/dist/runtime/theme/kbd.js +0 -26
  236. package/dist/runtime/theme/link.d.ts +0 -38
  237. package/dist/runtime/theme/link.js +0 -26
  238. package/dist/runtime/theme/modal.d.ts +0 -42
  239. package/dist/runtime/theme/modal.js +0 -55
  240. package/dist/runtime/theme/pagination.d.ts +0 -74
  241. package/dist/runtime/theme/pagination.js +0 -17
  242. package/dist/runtime/theme/pinInput.d.ts +0 -94
  243. package/dist/runtime/theme/pinInput.js +0 -111
  244. package/dist/runtime/theme/popover.d.ts +0 -32
  245. package/dist/runtime/theme/popover.js +0 -13
  246. package/dist/runtime/theme/progress.d.ts +0 -180
  247. package/dist/runtime/theme/progress.js +0 -95
  248. package/dist/runtime/theme/radio-group.d.ts +0 -104
  249. package/dist/runtime/theme/radio-group.js +0 -61
  250. package/dist/runtime/theme/scroll-area.d.ts +0 -67
  251. package/dist/runtime/theme/scroll-area.js +0 -33
  252. package/dist/runtime/theme/select.d.ts +0 -186
  253. package/dist/runtime/theme/select.js +0 -173
  254. package/dist/runtime/theme/separator.d.ts +0 -74
  255. package/dist/runtime/theme/separator.js +0 -53
  256. package/dist/runtime/theme/skeleton.d.ts +0 -2
  257. package/dist/runtime/theme/skeleton.js +0 -7
  258. package/dist/runtime/theme/slider.d.ts +0 -70
  259. package/dist/runtime/theme/slider.js +0 -52
  260. package/dist/runtime/theme/switch.d.ts +0 -116
  261. package/dist/runtime/theme/switch.js +0 -78
  262. package/dist/runtime/theme/table.d.ts +0 -86
  263. package/dist/runtime/theme/table.js +0 -36
  264. package/dist/runtime/theme/tabs.d.ts +0 -129
  265. package/dist/runtime/theme/tabs.js +0 -146
  266. package/dist/runtime/theme/textarea.d.ts +0 -90
  267. package/dist/runtime/theme/textarea.js +0 -116
  268. package/dist/runtime/theme/toast-provider.d.ts +0 -116
  269. package/dist/runtime/theme/toast-provider.js +0 -97
  270. package/dist/runtime/theme/toast.d.ts +0 -83
  271. package/dist/runtime/theme/toast.js +0 -35
  272. package/dist/runtime/theme/tooltip.d.ts +0 -38
  273. package/dist/runtime/theme/tooltip.js +0 -11
  274. package/dist/runtime/types/components.d.ts +0 -42
  275. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  276. package/dist/runtime/utils/extend-theme.js +0 -27
  277. package/dist/runtime/utils/styler.d.ts +0 -4
  278. package/dist/runtime/utils/styler.js +0 -10
  279. package/dist/runtime/utils/translator.d.ts +0 -18
  280. package/dist/runtime/utils/translator.js +0 -8
  281. package/dist/shared/ui.D1BTWZFB.mjs +0 -5
  282. package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
  283. package/dist/unocss.d.ts +0 -52
  284. package/dist/unocss.mjs.map +0 -1
  285. package/dist/unplugin.d.ts +0 -26
  286. package/dist/unplugin.mjs.map +0 -1
  287. package/dist/vite.d.ts +0 -9
  288. package/dist/vite.mjs.map +0 -1
  289. /package/dist/runtime/types/{components.js → input.js} +0 -0
@@ -0,0 +1,62 @@
1
+ import type { UseEventBusReturn } from '@vueuse/core';
2
+ import type { ComputedRef, Ref } from 'vue';
3
+ import type { FormErrorWithId, FormEvent, FormFieldProps } from '../types';
4
+ import type { GetObjectField, MaybeNull } from '../types/utils';
5
+ export interface FormOptionsProvideValue {
6
+ disabled: boolean;
7
+ validateOnInputDelay: number;
8
+ }
9
+ export declare const InjectionKeyFormOptions: import("vue").InjectionKey<ComputedRef<FormOptionsProvideValue>>, injectFormOptions: () => ComputedRef<FormOptionsProvideValue> | undefined, provideFormOptions: (value: ComputedRef<FormOptionsProvideValue>) => void;
10
+ export type FormBusProvideValue = UseEventBusReturn<FormEvent<any>, string>;
11
+ export declare const InjectionKeyFormBus: import("vue").InjectionKey<FormBusProvideValue>, injectFormBus: () => FormBusProvideValue | undefined, provideFormBus: (value: FormBusProvideValue) => void;
12
+ export type FormStateProvideValue = Record<string, any>;
13
+ export declare const InjectionKeyFormState: import("vue").InjectionKey<ComputedRef<FormStateProvideValue>>, injectFormState: () => ComputedRef<FormStateProvideValue> | undefined, provideFormState: (value: ComputedRef<FormStateProvideValue>) => void;
14
+ export interface FormFieldProvideValue<T> {
15
+ name?: string;
16
+ size?: GetObjectField<T, 'size'>;
17
+ error?: string | boolean;
18
+ eagerValidation?: boolean;
19
+ validateOnInputDelay?: number;
20
+ errorPattern?: RegExp;
21
+ hint?: string;
22
+ help?: string;
23
+ description?: string;
24
+ ariaId: string;
25
+ }
26
+ export declare const InjectionKeyFormField: import("vue").InjectionKey<ComputedRef<FormFieldProvideValue<FormFieldProps>>>, injectFormField: () => ComputedRef<FormFieldProvideValue<FormFieldProps>> | undefined, provideFormField: (value: ComputedRef<FormFieldProvideValue<FormFieldProps>>) => void;
27
+ export declare const InjectionKeyFormInputId: import("vue").InjectionKey<Ref<string | undefined, string | undefined>>, injectFormInputId: () => Ref<string | undefined, string | undefined> | undefined, provideFormInputId: (value: Ref<string | undefined, string | undefined>) => void;
28
+ export type FormInputsProvideValue = Record<string, {
29
+ id?: string;
30
+ pattern?: RegExp;
31
+ }>;
32
+ export declare const InjectionKeyFormInputs: import("vue").InjectionKey<Ref<FormInputsProvideValue, FormInputsProvideValue>>, injectFormInputs: () => Ref<FormInputsProvideValue, FormInputsProvideValue> | undefined, provideFormInputs: (value: Ref<FormInputsProvideValue, FormInputsProvideValue>) => void;
33
+ export declare const InjectionKeyFormLoading: import("vue").InjectionKey<Readonly<Ref<boolean, boolean>>>, injectFormLoading: () => Readonly<Ref<boolean, boolean>> | undefined, provideFormLoading: (value: Readonly<Ref<boolean, boolean>>) => void;
34
+ export declare const InjectionKeyFormErrors: import("vue").InjectionKey<MaybeNull<Ref<FormErrorWithId[], FormErrorWithId[]>>>, injectFormErrors: () => MaybeNull<Ref<FormErrorWithId[], FormErrorWithId[]>>, provideFormErrors: (value: MaybeNull<Ref<FormErrorWithId[], FormErrorWithId[]>>) => void;
35
+ interface Props<T> {
36
+ id?: string;
37
+ name?: string;
38
+ size?: GetObjectField<T, 'size'>;
39
+ color?: GetObjectField<T, 'color'>;
40
+ highlight?: boolean;
41
+ disabled?: boolean;
42
+ }
43
+ export declare function useFormField<T>(props?: Props<T>, options?: {
44
+ bind?: boolean;
45
+ deferInputValidation?: boolean;
46
+ }): {
47
+ id: ComputedRef<string | undefined>;
48
+ name: ComputedRef<string | undefined>;
49
+ size: ComputedRef<"xs" | "sm" | "md" | "lg" | "xl" | NonNullable<GetObjectField<T, "size">> | undefined>;
50
+ color: ComputedRef<"error" | GetObjectField<T, "color"> | undefined>;
51
+ highlight: ComputedRef<boolean | undefined>;
52
+ disabled: ComputedRef<boolean | undefined>;
53
+ emitFormBlur: () => void;
54
+ emitFormInput: import("@vueuse/core").UseDebounceFnReturn<() => void>;
55
+ emitFormChange: () => void;
56
+ emitFormFocus: () => void;
57
+ ariaAttrs: ComputedRef<{
58
+ 'aria-describedby': string;
59
+ 'aria-invalid': boolean;
60
+ } | undefined>;
61
+ };
62
+ export {};
@@ -0,0 +1,99 @@
1
+ import { useDebounceFn } from "@vueuse/core";
2
+ import { computed } from "vue";
3
+ import { defineInjection } from "../utils/index.js";
4
+ export const {
5
+ InjectionKey: InjectionKeyFormOptions,
6
+ inject: injectFormOptions,
7
+ provide: provideFormOptions
8
+ } = defineInjection("ui.form-options");
9
+ export const {
10
+ InjectionKey: InjectionKeyFormBus,
11
+ inject: injectFormBus,
12
+ provide: provideFormBus
13
+ } = defineInjection("ui.form-bus");
14
+ export const {
15
+ InjectionKey: InjectionKeyFormState,
16
+ inject: injectFormState,
17
+ provide: provideFormState
18
+ } = defineInjection("ui.form-state");
19
+ export const {
20
+ InjectionKey: InjectionKeyFormField,
21
+ inject: injectFormField,
22
+ provide: provideFormField
23
+ } = defineInjection("ui.form-field");
24
+ export const {
25
+ InjectionKey: InjectionKeyFormInputId,
26
+ inject: injectFormInputId,
27
+ provide: provideFormInputId
28
+ } = defineInjection("ui.form-input-id");
29
+ export const {
30
+ InjectionKey: InjectionKeyFormInputs,
31
+ inject: injectFormInputs,
32
+ provide: provideFormInputs
33
+ } = defineInjection("ui.form-inputs");
34
+ export const {
35
+ InjectionKey: InjectionKeyFormLoading,
36
+ inject: injectFormLoading,
37
+ provide: provideFormLoading
38
+ } = defineInjection("ui.form-loading");
39
+ export const {
40
+ InjectionKey: InjectionKeyFormErrors,
41
+ inject: injectFormErrors,
42
+ provide: provideFormErrors
43
+ } = defineInjection("ui.form-errors", null);
44
+ export function useFormField(props, options) {
45
+ const formOptions = injectFormOptions();
46
+ const formBus = injectFormBus();
47
+ const formField = injectFormField();
48
+ const formInputs = injectFormInputs();
49
+ const inputId = injectFormInputId();
50
+ if (formField && inputId) {
51
+ if (options?.bind === false) {
52
+ inputId.value = void 0;
53
+ } else if (props?.id) {
54
+ inputId.value = props?.id;
55
+ }
56
+ if (formInputs && formField.value.name && inputId.value)
57
+ formInputs.value[formField.value.name] = { id: inputId.value, pattern: formField.value.errorPattern };
58
+ }
59
+ function emitFormEvent(type, name, eager) {
60
+ if (formBus && formField && name)
61
+ formBus.emit({ type, name, eager });
62
+ }
63
+ function emitFormBlur() {
64
+ emitFormEvent("blur", formField?.value.name);
65
+ }
66
+ function emitFormFocus() {
67
+ emitFormEvent("focus", formField?.value.name);
68
+ }
69
+ function emitFormChange() {
70
+ emitFormEvent("change", formField?.value.name);
71
+ }
72
+ const emitFormInput = useDebounceFn(
73
+ () => {
74
+ emitFormEvent("input", formField?.value.name, !options?.deferInputValidation || formField?.value.eagerValidation);
75
+ },
76
+ formField?.value.validateOnInputDelay ?? formOptions?.value.validateOnInputDelay ?? 0
77
+ );
78
+ return {
79
+ id: computed(() => props?.id ?? inputId?.value),
80
+ name: computed(() => props?.name ?? formField?.value.name),
81
+ size: computed(() => props?.size ?? formField?.value.size),
82
+ color: computed(() => formField?.value.error ? "error" : props?.color),
83
+ highlight: computed(() => formField?.value.error ? true : props?.highlight),
84
+ disabled: computed(() => formOptions?.value.disabled || props?.disabled),
85
+ emitFormBlur,
86
+ emitFormInput,
87
+ emitFormChange,
88
+ emitFormFocus,
89
+ ariaAttrs: computed(() => {
90
+ if (!formField?.value)
91
+ return;
92
+ const descriptiveAttrs = ["error", "hint", "help", "description"].filter((type) => formField?.value?.[type]).map((type) => `${formField?.value.ariaId}-${type}`) || [];
93
+ return {
94
+ "aria-describedby": descriptiveAttrs.join(" "),
95
+ "aria-invalid": !!formField?.value.error
96
+ };
97
+ })
98
+ };
99
+ }
@@ -28,8 +28,9 @@ export declare const kbdKeysMap: {
28
28
  };
29
29
  export type KbdKey = keyof typeof kbdKeysMap;
30
30
  export type KbdKeySpecific = keyof KbdKeysSpecificMap;
31
- export declare const useKbd: () => {
32
- macOS: import("vue").ComputedRef<any>;
31
+ declare function _useKbd(): {
32
+ macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null>;
33
33
  getKbdKey: (value?: KbdKey | (string & {})) => string | undefined;
34
34
  };
35
+ export declare const useKbd: typeof _useKbd;
35
36
  export {};
@@ -23,7 +23,7 @@ export const kbdKeysMap = {
23
23
  home: "\u2196",
24
24
  end: "\u2198"
25
25
  };
26
- export const useKbd = createSharedComposable(() => {
26
+ function _useKbd() {
27
27
  const macOS = computed(() => import.meta.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/));
28
28
  const kbdKeysSpecificMap = reactive({
29
29
  meta: " ",
@@ -46,4 +46,5 @@ export const useKbd = createSharedComposable(() => {
46
46
  macOS,
47
47
  getKbdKey
48
48
  };
49
- });
49
+ }
50
+ export const useKbd = /* @__PURE__ */ createSharedComposable(_useKbd);
@@ -1,8 +1,71 @@
1
- import type { Translator } from '../utils/translator.js';
2
- export declare const useLocale: () => {
3
- locale: import("vue").ComputedRef<import("../utils/index.js").Locale<import("../types/index.js").Messages>>;
1
+ import type { Translator } from '@byyuurin/ui-kit';
2
+ import type { MaybeRefOrGetter } from 'vue';
3
+ import type { Messages } from '../types';
4
+ export declare const InjectionKeyLocaleContext: import("vue").InjectionKey<MaybeRefOrGetter<Required<import("@byyuurin/ui-kit").Locale<Messages>> | undefined>>, injectLocaleContext: () => MaybeRefOrGetter<Required<import("@byyuurin/ui-kit").Locale<Messages>> | undefined>, provideLocaleContext: (value: MaybeRefOrGetter<Required<import("@byyuurin/ui-kit").Locale<Messages>> | undefined>) => void;
5
+ declare function _useLocale(): {
6
+ locale: import("vue").ComputedRef<Required<import("@byyuurin/ui-kit").Locale<{
7
+ alert: {
8
+ close: string;
9
+ };
10
+ calendar: {
11
+ prevYear: string;
12
+ nextYear: string;
13
+ prevMonth: string;
14
+ nextMonth: string;
15
+ };
16
+ carousel: {
17
+ dots: string;
18
+ prev: string;
19
+ next: string;
20
+ goto: string;
21
+ };
22
+ inputNumber: {
23
+ increment: string;
24
+ decrement: string;
25
+ };
26
+ modal: {
27
+ close: string;
28
+ };
29
+ table: {
30
+ noData: string;
31
+ };
32
+ toast: {
33
+ close: string;
34
+ };
35
+ }>>>;
4
36
  lang: import("vue").ComputedRef<string>;
5
37
  code: import("vue").ComputedRef<string>;
6
- dir: import("vue").ComputedRef<import("../utils/index.js").Direction>;
7
- t: Translator<import("../types/index.js").Messages>;
38
+ dir: import("vue").ComputedRef<import("@byyuurin/ui-kit").LocaleDirection>;
39
+ t: Translator<{
40
+ alert: {
41
+ close: string;
42
+ };
43
+ calendar: {
44
+ prevYear: string;
45
+ nextYear: string;
46
+ prevMonth: string;
47
+ nextMonth: string;
48
+ };
49
+ carousel: {
50
+ dots: string;
51
+ prev: string;
52
+ next: string;
53
+ goto: string;
54
+ };
55
+ inputNumber: {
56
+ increment: string;
57
+ decrement: string;
58
+ };
59
+ modal: {
60
+ close: string;
61
+ };
62
+ table: {
63
+ noData: string;
64
+ };
65
+ toast: {
66
+ close: string;
67
+ };
68
+ }>;
8
69
  };
70
+ export declare const useLocale: typeof _useLocale;
71
+ export {};
@@ -1,9 +1,14 @@
1
1
  import { createSharedComposable } from "@vueuse/core";
2
2
  import { computed, toValue } from "vue";
3
- import { injectLocaleContext } from "../app/injections.js";
4
3
  import localeDefault from "../locale/en.js";
5
- import { createTranslator } from "../utils/index.js";
6
- export const useLocale = createSharedComposable(() => {
4
+ import { defineInjection } from "../utils/index.js";
5
+ import { createTranslator } from "../utils/locale.js";
6
+ export const {
7
+ InjectionKey: InjectionKeyLocaleContext,
8
+ inject: injectLocaleContext,
9
+ provide: provideLocaleContext
10
+ } = defineInjection("ui.locale-context");
11
+ function _useLocale() {
7
12
  const _locale = injectLocaleContext();
8
13
  const locale = computed(() => toValue(_locale) ?? localeDefault);
9
14
  const lang = computed(() => locale.value.name);
@@ -12,11 +17,6 @@ export const useLocale = createSharedComposable(() => {
12
17
  const t = (path, options) => {
13
18
  return createTranslator(toValue(locale))(path, options);
14
19
  };
15
- return {
16
- locale,
17
- lang,
18
- code,
19
- dir,
20
- t
21
- };
22
- });
20
+ return { locale, lang, code, dir, t };
21
+ }
22
+ export const useLocale = import.meta.client ? createSharedComposable(_useLocale) : _useLocale;
@@ -1,29 +1,65 @@
1
1
  import type { Component } from 'vue';
2
- import type { ComponentProps } from 'vue-component-type-helpers';
2
+ import type { ComponentEmit, ComponentProps } from 'vue-component-type-helpers';
3
+ /**
4
+ * This is a workaround for a design limitation in TypeScript.
5
+ *
6
+ * Conditional types only match the last function overload, not a union of all possible
7
+ * parameter types. This workaround forces TypeScript to properly extract the 'close'
8
+ * event argument type from component emits with multiple event signatures.
9
+ *
10
+ * @see https://github.com/microsoft/TypeScript/issues/32164
11
+ */
12
+ type CloseEventArgType<T> = T extends {
13
+ (event: 'close', arg_0: infer Arg, ...args: any[]): void;
14
+ (...args: any[]): void;
15
+ (...args: any[]): void;
16
+ (...args: any[]): void;
17
+ (...args: any[]): void;
18
+ (...args: any[]): void;
19
+ (...args: any[]): void;
20
+ (...args: any[]): void;
21
+ (...args: any[]): void;
22
+ (...args: any[]): void;
23
+ (...args: any[]): void;
24
+ (...args: any[]): void;
25
+ (...args: any[]): void;
26
+ (...args: any[]): void;
27
+ (...args: any[]): void;
28
+ (...args: any[]): void;
29
+ (...args: any[]): void;
30
+ } ? Arg : never;
3
31
  export interface OverlayOptions<ComponentProps = Record<string, any>> {
4
32
  defaultOpen?: boolean;
5
33
  props?: ComponentProps;
6
34
  unmountOnHide?: boolean;
7
35
  }
8
- interface _ComponentState<T extends Component> {
36
+ interface OverlayOptionsPrivate<T extends Component> {
9
37
  component?: T;
10
- id: string | number;
38
+ id: symbol;
11
39
  isMounted: boolean;
12
- modelValue: boolean;
13
- resolve?: (value: unknown) => void;
40
+ isOpen: boolean;
41
+ originalProps?: ComponentProps<T>;
42
+ resolvePromise?: (value: unknown) => void;
14
43
  }
15
- export type OverlayComponentState = OverlayOptions<Component> & _ComponentState<Component>;
16
- export interface OverlayComponentInstance<T> {
17
- open: (props?: ComponentProps<T>) => Promise<any>;
44
+ export type Overlay = OverlayOptions<Component> & OverlayOptionsPrivate<Component>;
45
+ type OpenedOverlay<T extends Component> = Omit<OverlayInstance<T>, 'open' | 'close' | 'patch' | 'modelValue' | 'resolvePromise'> & {
46
+ result: Promise<CloseEventArgType<ComponentEmit<T>>>;
47
+ } & Promise<CloseEventArgType<ComponentEmit<T>>>;
48
+ export interface OverlayInstance<T extends Component> {
49
+ id: symbol;
50
+ open: (props?: ComponentProps<T>) => OpenedOverlay<T>;
18
51
  close: (value?: any) => void;
19
52
  patch: (props: Partial<ComponentProps<T>>) => void;
20
53
  }
21
- export declare const useOverlay: () => {
22
- overlays: import("vue").ShallowReactive<OverlayComponentState[]>;
23
- open: <T extends Component>(id: OverlayComponentState["id"], props?: ComponentProps<T>) => Promise<any>;
24
- close: (id: OverlayComponentState["id"], value?: any) => void;
25
- create: <T extends Component>(component: T, options?: OverlayOptions<ComponentProps<T>>) => OverlayComponentInstance<T>;
26
- patch: <T extends Component>(id: OverlayComponentState["id"], props: Partial<ComponentProps<T>>) => void;
27
- unmount: (id: OverlayComponentState["id"]) => void;
54
+ declare function _useOverlay(): {
55
+ overlays: import("vue").ShallowReactive<Overlay[]>;
56
+ open: <T extends Component>(id: Overlay["id"], props?: ComponentProps<T>) => OpenedOverlay<T>;
57
+ close: (id: symbol, value?: any) => void;
58
+ closeAll: () => void;
59
+ create: <T extends Component>(component: T, options?: OverlayOptions<ComponentProps<T>>) => OverlayInstance<T>;
60
+ patch: <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>) => void;
61
+ unmount: (id: symbol) => void;
62
+ isOpen: (id: symbol) => boolean;
28
63
  };
64
+ export declare const useOverlay: typeof _useOverlay;
29
65
  export {};
@@ -1,43 +1,52 @@
1
1
  import { createSharedComposable } from "@vueuse/core";
2
2
  import { markRaw, reactive, shallowReactive } from "vue";
3
- export const useOverlay = createSharedComposable(() => {
3
+ function _useOverlay() {
4
4
  const overlays = shallowReactive([]);
5
- const generateId = () => `overlay-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
6
- function create(component, options = {}) {
7
- const { props = {}, defaultOpen = false, unmountOnHide = true } = options;
8
- const state = reactive({
9
- id: generateId(),
10
- modelValue: defaultOpen,
11
- component: markRaw(component),
5
+ function create(component, options) {
6
+ const { props = {}, defaultOpen = false, unmountOnHide = true } = options || {};
7
+ const optionsPrivate = reactive({
8
+ id: Symbol(import.meta.dev ? "useOverlay" : ""),
9
+ isOpen: defaultOpen,
12
10
  isMounted: defaultOpen,
11
+ component: markRaw(component),
12
+ originalProps: props,
13
13
  unmountOnHide,
14
- props
14
+ props: { ...props }
15
15
  });
16
- overlays.push(state);
16
+ overlays.push(optionsPrivate);
17
17
  return {
18
- open: (props2) => open(state.id, props2),
19
- close: (value) => close(state.id, value),
20
- patch: (props2) => patch(state.id, props2)
18
+ ...optionsPrivate,
19
+ open: (props2) => open(optionsPrivate.id, props2),
20
+ close: (value) => close(optionsPrivate.id, value),
21
+ patch: (props2) => patch(optionsPrivate.id, props2)
21
22
  };
22
23
  }
23
24
  function open(id, props) {
24
25
  const overlay = getOverlay(id);
25
- if (props)
26
- patch(id, props);
27
- overlay.modelValue = true;
26
+ overlay.props = props ? { ...overlay.originalProps, ...props } : { ...overlay.originalProps };
27
+ overlay.isOpen = true;
28
28
  overlay.isMounted = true;
29
- return new Promise((resolve) => {
30
- overlay.resolve = resolve;
29
+ const result = new Promise((resolve) => {
30
+ overlay.resolvePromise = resolve;
31
+ });
32
+ return Object.assign(result, {
33
+ id,
34
+ isMounted: overlay.isMounted,
35
+ isOpen: overlay.isOpen,
36
+ result
31
37
  });
32
38
  }
33
39
  function close(id, value) {
34
40
  const overlay = getOverlay(id);
35
- overlay.modelValue = false;
36
- if (overlay.resolve) {
37
- overlay.resolve(value);
38
- overlay.resolve = void 0;
41
+ overlay.isOpen = false;
42
+ if (overlay.resolvePromise) {
43
+ overlay.resolvePromise(value);
44
+ overlay.resolvePromise = void 0;
39
45
  }
40
46
  }
47
+ function closeAll() {
48
+ overlays.forEach((overlay) => close(overlay.id));
49
+ }
41
50
  function unmount(id) {
42
51
  const overlay = getOverlay(id);
43
52
  overlay.isMounted = false;
@@ -48,22 +57,27 @@ export const useOverlay = createSharedComposable(() => {
48
57
  }
49
58
  function patch(id, props) {
50
59
  const overlay = getOverlay(id);
51
- Object.entries(props).forEach(([key, value]) => {
52
- overlay.props[key] = value;
53
- });
60
+ overlay.props = { ...overlay.props, ...props };
54
61
  }
55
62
  function getOverlay(id) {
56
- const item = overlays.find((item2) => item2.id === id);
57
- if (!item)
63
+ const overlay = overlays.find((item) => item.id === id);
64
+ if (!overlay)
58
65
  throw new Error("Overlay not found");
59
- return item;
66
+ return overlay;
67
+ }
68
+ function isOpen(id) {
69
+ const overlay = getOverlay(id);
70
+ return overlay.isOpen;
60
71
  }
61
72
  return {
62
73
  overlays,
63
74
  open,
64
75
  close,
76
+ closeAll,
65
77
  create,
66
78
  patch,
67
- unmount
79
+ unmount,
80
+ isOpen
68
81
  };
69
- });
82
+ }
83
+ export const useOverlay = /* @__PURE__ */ createSharedComposable(_useOverlay);
@@ -0,0 +1,6 @@
1
+ import { type Ref } from 'vue';
2
+ export declare const InjectionKeyPortalTarget: import("vue").InjectionKey<Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined>>, injectPortalTarget: () => Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined> | undefined, providePortalTarget: (value: Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined>) => void;
3
+ export declare function usePortal(portal: Ref<boolean | string | HTMLElement | undefined>): import("vue").ComputedRef<{
4
+ to: string | HTMLElement | undefined;
5
+ disabled: boolean;
6
+ }>;
@@ -0,0 +1,17 @@
1
+ import { computed } from "vue";
2
+ import { defineInjection } from "../utils/index.js";
3
+ export const {
4
+ InjectionKey: InjectionKeyPortalTarget,
5
+ inject: injectPortalTarget,
6
+ provide: providePortalTarget
7
+ } = defineInjection("ui.portal-target");
8
+ export function usePortal(portal) {
9
+ const globalPortal = injectPortalTarget();
10
+ const value = computed(() => portal.value === true ? globalPortal?.value : portal.value);
11
+ const disabled = computed(() => typeof value.value === "boolean" ? !value.value : false);
12
+ const to = computed(() => typeof value.value === "boolean" ? "body" : value.value);
13
+ return computed(() => ({
14
+ to: to.value,
15
+ disabled: disabled.value
16
+ }));
17
+ }
@@ -1,8 +1,15 @@
1
- import type { ToastState } from '../types/index.js';
2
- export declare const useToast: () => {
3
- toasts: any;
4
- add: (toast: Partial<ToastState>) => ToastState;
5
- update: (id: string | number, toast: Partial<Omit<ToastState, "id">>) => void;
1
+ import type { Ref } from 'vue';
2
+ import type { ToastEmits, ToastProps } from '../types';
3
+ import type { EmitsToProps } from '../types/utils';
4
+ export declare const InjectionKeyToastMax: import("vue").InjectionKey<Ref<number, number>>, injectToastMax: () => Ref<number, number> | undefined, provideToastMax: (value: Ref<number, number>) => void;
5
+ export interface Toast extends Omit<ToastProps, 'defaultOpen'>, EmitsToProps<ToastEmits> {
6
+ id: string | number;
7
+ onClick?: (toast: Toast) => void;
8
+ }
9
+ export declare function useToast(): {
10
+ toasts: Ref<Toast[], Toast[]>;
11
+ add: (toast: Partial<Toast>) => Toast;
12
+ update: (id: string | number, toast: Partial<Omit<Toast, "id">>) => void;
6
13
  remove: (id: string | number) => void;
7
14
  clear: () => void;
8
15
  };
@@ -1,11 +1,16 @@
1
- import { createSharedComposable } from "@vueuse/core";
2
- import { nextTick, ref } from "vue";
1
+ import { nextTick, shallowRef } from "vue";
3
2
  import { useState } from "#imports";
4
- export const useToast = createSharedComposable(() => {
3
+ import { defineInjection } from "../utils/index.js";
4
+ export const {
5
+ InjectionKey: InjectionKeyToastMax,
6
+ inject: injectToastMax,
7
+ provide: provideToastMax
8
+ } = defineInjection("ui.toast-max");
9
+ export function useToast() {
5
10
  const toasts = useState("toasts", () => []);
6
- const running = ref(false);
7
- const maxToasts = 5;
11
+ const max = injectToastMax();
8
12
  const queue = [];
13
+ const running = shallowRef(false);
9
14
  const generateId = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
10
15
  async function processQueue() {
11
16
  if (running.value || queue.length === 0)
@@ -14,7 +19,7 @@ export const useToast = createSharedComposable(() => {
14
19
  while (queue.length > 0) {
15
20
  const toast = queue.shift();
16
21
  await nextTick();
17
- toasts.value = [...toasts.value, toast].slice(-maxToasts);
22
+ toasts.value = [...toasts.value, toast].slice(-(max?.value ?? 5));
18
23
  }
19
24
  running.value = false;
20
25
  }
@@ -59,4 +64,4 @@ export const useToast = createSharedComposable(() => {
59
64
  remove,
60
65
  clear
61
66
  };
62
- });
67
+ }
@@ -1,2 +1,31 @@
1
- declare const _default: import("../utils/index.js").Locale<import("../types/index.js").Messages>;
1
+ declare const _default: Required<import("@byyuurin/ui-kit").Locale<{
2
+ alert: {
3
+ close: string;
4
+ };
5
+ calendar: {
6
+ prevYear: string;
7
+ nextYear: string;
8
+ prevMonth: string;
9
+ nextMonth: string;
10
+ };
11
+ carousel: {
12
+ dots: string;
13
+ prev: string;
14
+ next: string;
15
+ goto: string;
16
+ };
17
+ inputNumber: {
18
+ increment: string;
19
+ decrement: string;
20
+ };
21
+ modal: {
22
+ close: string;
23
+ };
24
+ table: {
25
+ noData: string;
26
+ };
27
+ toast: {
28
+ close: string;
29
+ };
30
+ }>>;
2
31
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineLocale } from "../utils/index.js";
1
+ import { defineLocale } from "../utils/locale.js";
2
2
  export default defineLocale({
3
3
  name: "English",
4
4
  code: "en",
@@ -13,6 +13,7 @@ export default defineLocale({
13
13
  nextMonth: "Next month"
14
14
  },
15
15
  carousel: {
16
+ dots: "Choose slide to display",
16
17
  prev: "Prev",
17
18
  next: "Next",
18
19
  goto: "Go to slide {page}"
@@ -1,2 +1,2 @@
1
- export { default as en } from './en.js';
2
- export { default as zhTW } from './zh-tw.js';
1
+ export { default as en } from './en';
2
+ export { default as zh_tw } from './zh_tw';
@@ -1,2 +1,2 @@
1
1
  export { default as en } from "./en.js";
2
- export { default as zhTW } from "./zh-tw.js";
2
+ export { default as zh_tw } from "./zh_tw.js";