@byyuurin/ui 0.0.10 → 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 +48 -72
  6. package/dist/runtime/components/Accordion.vue.d.ts +74 -0
  7. package/dist/runtime/components/Alert.vue +65 -83
  8. package/dist/runtime/components/Alert.vue.d.ts +71 -0
  9. package/dist/runtime/components/App.vue +28 -42
  10. package/dist/runtime/components/App.vue.d.ts +26 -0
  11. package/dist/runtime/components/Avatar.vue +82 -58
  12. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  13. package/dist/runtime/components/AvatarGroup.vue +43 -70
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +30 -0
  15. package/dist/runtime/components/Badge.vue +70 -64
  16. package/dist/runtime/components/Badge.vue.d.ts +45 -0
  17. package/dist/runtime/components/Breadcrumb.vue +56 -76
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +79 -0
  19. package/dist/runtime/components/Button.vue +150 -78
  20. package/dist/runtime/components/Button.vue.d.ts +45 -0
  21. package/dist/runtime/components/Calendar.vue +99 -125
  22. package/dist/runtime/components/Calendar.vue.d.ts +102 -0
  23. package/dist/runtime/components/Card.vue +33 -46
  24. package/dist/runtime/components/Card.vue.d.ts +34 -0
  25. package/dist/runtime/components/Carousel.vue +164 -237
  26. package/dist/runtime/components/Carousel.vue.d.ts +125 -0
  27. package/dist/runtime/components/Checkbox.vue +86 -88
  28. package/dist/runtime/components/Checkbox.vue.d.ts +63 -0
  29. package/dist/runtime/components/Chip.vue +44 -58
  30. package/dist/runtime/components/Chip.vue.d.ts +48 -0
  31. package/dist/runtime/components/Collapsible.vue +29 -33
  32. package/dist/runtime/components/Collapsible.vue.d.ts +34 -0
  33. package/dist/runtime/components/Drawer.vue +110 -150
  34. package/dist/runtime/components/Drawer.vue.d.ts +103 -0
  35. package/dist/runtime/components/DropdownMenu.vue +49 -120
  36. package/dist/runtime/components/DropdownMenu.vue.d.ts +140 -0
  37. package/dist/runtime/components/DropdownMenuContent.vue +177 -143
  38. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
  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 +245 -275
  42. package/dist/runtime/components/Form.vue.d.ts +103 -0
  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 +125 -156
  48. package/dist/runtime/components/Input.vue.d.ts +76 -0
  49. package/dist/runtime/components/InputNumber.vue +103 -130
  50. package/dist/runtime/components/InputNumber.vue.d.ts +191 -0
  51. package/dist/runtime/components/Kbd.vue +24 -39
  52. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  53. package/dist/runtime/components/Link.vue +105 -337
  54. package/dist/runtime/components/Link.vue.d.ts +95 -0
  55. package/dist/runtime/components/LinkBase.vue +31 -71
  56. package/dist/runtime/components/LinkBase.vue.d.ts +33 -0
  57. package/dist/runtime/components/Modal.vue +82 -103
  58. package/dist/runtime/components/Modal.vue.d.ts +96 -0
  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 +12 -16
  62. package/dist/runtime/components/OverlayProvider.vue.d.ts +3 -0
  63. package/dist/runtime/components/Pagination.vue +65 -139
  64. package/dist/runtime/components/Pagination.vue.d.ts +116 -0
  65. package/dist/runtime/components/PinInput.vue +78 -73
  66. package/dist/runtime/components/PinInput.vue.d.ts +54 -0
  67. package/dist/runtime/components/Popover.vue +60 -75
  68. package/dist/runtime/components/Popover.vue.d.ts +70 -0
  69. package/dist/runtime/components/Progress.vue +79 -126
  70. package/dist/runtime/components/Progress.vue.d.ts +63 -0
  71. package/dist/runtime/components/RadioGroup.vue +109 -140
  72. package/dist/runtime/components/RadioGroup.vue.d.ts +96 -0
  73. package/dist/runtime/components/ScrollArea.vue +50 -48
  74. package/dist/runtime/components/ScrollArea.vue.d.ts +21 -0
  75. package/dist/runtime/components/Select.vue +221 -221
  76. package/dist/runtime/components/Select.vue.d.ts +260 -0
  77. package/dist/runtime/components/Separator.vue +55 -47
  78. package/dist/runtime/components/Separator.vue.d.ts +48 -0
  79. package/dist/runtime/components/Skeleton.vue +25 -22
  80. package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
  81. package/dist/runtime/components/Slider.vue +73 -77
  82. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  83. package/dist/runtime/components/Switch.vue +66 -77
  84. package/dist/runtime/components/Switch.vue.d.ts +58 -0
  85. package/dist/runtime/components/Table.vue +357 -215
  86. package/dist/runtime/components/Table.vue.d.ts +234 -0
  87. package/dist/runtime/components/Tabs.vue +90 -88
  88. package/dist/runtime/components/Tabs.vue.d.ts +97 -0
  89. package/dist/runtime/components/Textarea.vue +147 -146
  90. package/dist/runtime/components/Textarea.vue.d.ts +76 -0
  91. package/dist/runtime/components/Toast.vue +108 -90
  92. package/dist/runtime/components/Toast.vue.d.ts +152 -0
  93. package/dist/runtime/components/ToastProvider.vue +82 -109
  94. package/dist/runtime/components/ToastProvider.vue.d.ts +51 -0
  95. package/dist/runtime/components/Tooltip.vue +54 -53
  96. package/dist/runtime/components/Tooltip.vue.d.ts +53 -0
  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 +5 -6
  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 -253
  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 +156 -87
  172. package/vue-plugin.d.ts +5 -0
  173. package/dist/module.cjs +0 -5
  174. package/dist/module.d.ts +0 -13
  175. package/dist/module.mjs.map +0 -1
  176. package/dist/runtime/app/injections.d.ts +0 -9307
  177. package/dist/runtime/app/injections.js +0 -61
  178. package/dist/runtime/components/ButtonGroup.vue +0 -46
  179. package/dist/runtime/components/FormItem.vue +0 -129
  180. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  181. package/dist/runtime/composables/useButtonGroup.js +0 -9
  182. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  183. package/dist/runtime/composables/useFormItem.js +0 -64
  184. package/dist/runtime/composables/useTheme.d.ts +0 -9
  185. package/dist/runtime/composables/useTheme.js +0 -23
  186. package/dist/runtime/index.d.ts +0 -44
  187. package/dist/runtime/index.js +0 -44
  188. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  189. package/dist/runtime/theme/accordion.d.ts +0 -56
  190. package/dist/runtime/theme/accordion.js +0 -28
  191. package/dist/runtime/theme/alert.d.ts +0 -125
  192. package/dist/runtime/theme/alert.js +0 -47
  193. package/dist/runtime/theme/app.d.ts +0 -19
  194. package/dist/runtime/theme/app.js +0 -19
  195. package/dist/runtime/theme/avatar-group.d.ts +0 -52
  196. package/dist/runtime/theme/avatar-group.js +0 -32
  197. package/dist/runtime/theme/avatar.d.ts +0 -56
  198. package/dist/runtime/theme/avatar.js +0 -34
  199. package/dist/runtime/theme/badge.d.ts +0 -82
  200. package/dist/runtime/theme/badge.js +0 -92
  201. package/dist/runtime/theme/breadcrumb.d.ts +0 -67
  202. package/dist/runtime/theme/breadcrumb.js +0 -44
  203. package/dist/runtime/theme/button-group.d.ts +0 -66
  204. package/dist/runtime/theme/button-group.js +0 -42
  205. package/dist/runtime/theme/button.d.ts +0 -190
  206. package/dist/runtime/theme/button.js +0 -164
  207. package/dist/runtime/theme/calendar.d.ts +0 -56
  208. package/dist/runtime/theme/calendar.js +0 -69
  209. package/dist/runtime/theme/card.d.ts +0 -62
  210. package/dist/runtime/theme/card.js +0 -37
  211. package/dist/runtime/theme/carousel.d.ts +0 -113
  212. package/dist/runtime/theme/carousel.js +0 -43
  213. package/dist/runtime/theme/checkbox.d.ts +0 -88
  214. package/dist/runtime/theme/checkbox.js +0 -54
  215. package/dist/runtime/theme/chip.d.ts +0 -67
  216. package/dist/runtime/theme/chip.js +0 -66
  217. package/dist/runtime/theme/collapsible.d.ts +0 -38
  218. package/dist/runtime/theme/collapsible.js +0 -10
  219. package/dist/runtime/theme/drawer.d.ts +0 -148
  220. package/dist/runtime/theme/drawer.js +0 -113
  221. package/dist/runtime/theme/dropdown-menu.d.ts +0 -71
  222. package/dist/runtime/theme/dropdown-menu.js +0 -83
  223. package/dist/runtime/theme/form-item.d.ts +0 -76
  224. package/dist/runtime/theme/form-item.js +0 -34
  225. package/dist/runtime/theme/form.d.ts +0 -8
  226. package/dist/runtime/theme/form.js +0 -7
  227. package/dist/runtime/theme/index.d.ts +0 -41
  228. package/dist/runtime/theme/index.js +0 -41
  229. package/dist/runtime/theme/input-number.d.ts +0 -121
  230. package/dist/runtime/theme/input-number.js +0 -95
  231. package/dist/runtime/theme/input.d.ts +0 -178
  232. package/dist/runtime/theme/input.js +0 -151
  233. package/dist/runtime/theme/kbd.d.ts +0 -39
  234. package/dist/runtime/theme/kbd.js +0 -26
  235. package/dist/runtime/theme/link.d.ts +0 -44
  236. package/dist/runtime/theme/link.js +0 -26
  237. package/dist/runtime/theme/modal.d.ts +0 -48
  238. package/dist/runtime/theme/modal.js +0 -55
  239. package/dist/runtime/theme/pagination.d.ts +0 -80
  240. package/dist/runtime/theme/pagination.js +0 -17
  241. package/dist/runtime/theme/pinInput.d.ts +0 -100
  242. package/dist/runtime/theme/pinInput.js +0 -111
  243. package/dist/runtime/theme/popover.d.ts +0 -38
  244. package/dist/runtime/theme/popover.js +0 -13
  245. package/dist/runtime/theme/progress.d.ts +0 -186
  246. package/dist/runtime/theme/progress.js +0 -95
  247. package/dist/runtime/theme/radio-group.d.ts +0 -110
  248. package/dist/runtime/theme/radio-group.js +0 -61
  249. package/dist/runtime/theme/scroll-area.d.ts +0 -73
  250. package/dist/runtime/theme/scroll-area.js +0 -33
  251. package/dist/runtime/theme/select.d.ts +0 -192
  252. package/dist/runtime/theme/select.js +0 -173
  253. package/dist/runtime/theme/separator.d.ts +0 -80
  254. package/dist/runtime/theme/separator.js +0 -53
  255. package/dist/runtime/theme/skeleton.d.ts +0 -8
  256. package/dist/runtime/theme/skeleton.js +0 -7
  257. package/dist/runtime/theme/slider.d.ts +0 -76
  258. package/dist/runtime/theme/slider.js +0 -52
  259. package/dist/runtime/theme/switch.d.ts +0 -122
  260. package/dist/runtime/theme/switch.js +0 -78
  261. package/dist/runtime/theme/table.d.ts +0 -92
  262. package/dist/runtime/theme/table.js +0 -36
  263. package/dist/runtime/theme/tabs.d.ts +0 -135
  264. package/dist/runtime/theme/tabs.js +0 -146
  265. package/dist/runtime/theme/textarea.d.ts +0 -96
  266. package/dist/runtime/theme/textarea.js +0 -116
  267. package/dist/runtime/theme/toast-provider.d.ts +0 -122
  268. package/dist/runtime/theme/toast-provider.js +0 -97
  269. package/dist/runtime/theme/toast.d.ts +0 -89
  270. package/dist/runtime/theme/toast.js +0 -35
  271. package/dist/runtime/theme/tooltip.d.ts +0 -44
  272. package/dist/runtime/theme/tooltip.js +0 -11
  273. package/dist/runtime/types/components.d.ts +0 -42
  274. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  275. package/dist/runtime/utils/extend-theme.js +0 -27
  276. package/dist/runtime/utils/styler.d.ts +0 -4
  277. package/dist/runtime/utils/styler.js +0 -10
  278. package/dist/runtime/utils/translator.d.ts +0 -18
  279. package/dist/runtime/utils/translator.js +0 -8
  280. package/dist/shared/ui.3e7fad19.mjs +0 -5
  281. package/dist/shared/ui.3e7fad19.mjs.map +0 -1
  282. package/dist/types.d.ts +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
@@ -1,94 +1,166 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { UseComponentIconsProps } from '../composables/useComponentIcons'
4
- import type { button } from '../theme'
5
- import type { ComponentAttrs } from '../types'
6
- import type { LinkProps } from './Link.vue'
7
-
8
- export interface ButtonSlots {
9
- default?: (props?: {}) => any
10
- leading?: (props?: {}) => any
11
- trailing?: (props?: {}) => any
12
- }
13
-
14
- type ButtonVariants = VariantProps<typeof button>
15
-
16
- export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom' | 'underline'> {
17
- icon?: string
18
- label?: string
19
- variant?: ButtonVariants['variant']
20
- size?: ButtonVariants['size']
21
- loading?: boolean
22
- active?: boolean
23
- disabled?: boolean
24
- }
1
+ <script>
2
+ import theme from "#build/ui/button";
25
3
  </script>
26
4
 
27
- <script lang="ts" setup>
28
- import { useForwardProps } from 'reka-ui'
29
- import { computed } from 'vue'
30
- import { useButtonGroup } from '../composables/useButtonGroup'
31
- import { useComponentIcons } from '../composables/useComponentIcons'
32
- import { useTheme } from '../composables/useTheme'
33
- import { omit, pickLinkProps } from '../utils'
34
- import Link from './Link.vue'
35
-
36
- const props = withDefaults(defineProps<ButtonProps>(), {
37
- variant: 'solid',
38
- })
39
-
40
- const slots = defineSlots<ButtonSlots>()
41
-
42
- const { size, orientation } = useButtonGroup(props)
5
+ <script setup>
6
+ import { useForwardProps } from "reka-ui";
7
+ import { computed, shallowRef } from "vue";
8
+ import { useAppConfig } from "#imports";
9
+ import { useComponentIcons } from "../composables/useComponentIcons";
10
+ import { useFieldGroup } from "../composables/useFieldGroup";
11
+ import { injectFormLoading } from "../composables/useFormField";
12
+ import { omit, pickLinkProps } from "../utils";
13
+ import { cv, merge } from "../utils/style";
14
+ import Avatar from "./Avatar.vue";
15
+ import Icon from "./Icon.vue";
16
+ import Link from "./Link.vue";
17
+ import LinkBase from "./LinkBase.vue";
18
+ const props = defineProps({
19
+ icon: { type: [String, Object], required: false },
20
+ label: { type: String, required: false },
21
+ variant: { type: null, required: false },
22
+ activeVariant: { type: null, required: false },
23
+ size: { type: null, required: false },
24
+ color: { type: null, required: false },
25
+ activeColor: { type: null, required: false },
26
+ square: { type: Boolean, required: false },
27
+ block: { type: Boolean, required: false },
28
+ loadingAuto: { type: Boolean, required: false },
29
+ onClick: { type: [Function, Array], required: false },
30
+ ui: { type: null, required: false },
31
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
32
+ avatar: { type: Object, required: false },
33
+ leading: { type: Boolean, required: false },
34
+ leadingIcon: { type: [String, Object], required: false },
35
+ trailing: { type: Boolean, required: false },
36
+ trailingIcon: { type: [String, Object], required: false },
37
+ loading: { type: Boolean, required: false },
38
+ loadingIcon: { type: [String, Object], required: false },
39
+ as: { type: null, required: false },
40
+ type: { type: null, required: false },
41
+ disabled: { type: Boolean, required: false },
42
+ active: { type: Boolean, required: false },
43
+ exact: { type: Boolean, required: false },
44
+ exactQuery: { type: [Boolean, String], required: false },
45
+ exactHash: { type: Boolean, required: false },
46
+ inactiveClass: { type: String, required: false },
47
+ to: { type: null, required: false },
48
+ href: { type: null, required: false },
49
+ external: { type: Boolean, required: false },
50
+ target: { type: [String, Object], required: false },
51
+ rel: { type: [String, Object], required: false },
52
+ noRel: { type: Boolean, required: false },
53
+ prefetchedClass: { type: String, required: false },
54
+ prefetch: { type: Boolean, required: false },
55
+ prefetchOn: { type: [String, Object], required: false },
56
+ noPrefetch: { type: Boolean, required: false },
57
+ activeClass: { type: String, required: false },
58
+ exactActiveClass: { type: String, required: false },
59
+ ariaCurrentValue: { type: String, required: false },
60
+ viewTransition: { type: Boolean, required: false },
61
+ replace: { type: Boolean, required: false }
62
+ });
63
+ const slots = defineSlots();
64
+ const linkProps = useForwardProps(pickLinkProps(props));
65
+ const loadingAutoState = shallowRef(false);
66
+ const formLoading = injectFormLoading();
67
+ async function onClickWrapper(event) {
68
+ loadingAutoState.value = true;
69
+ const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick];
70
+ try {
71
+ await Promise.all(callbacks.map((fn) => fn?.(event)));
72
+ } finally {
73
+ loadingAutoState.value = false;
74
+ }
75
+ }
76
+ const isLoading = computed(() => props.loading || props.loadingAuto && (loadingAutoState.value || formLoading?.value && props.type === "submit"));
77
+ const { size, orientation } = useFieldGroup(props);
43
78
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
44
- computed(() => ({ ...props, loading: props.loading })),
45
- )
46
-
47
- const linkProps = useForwardProps(pickLinkProps(props))
48
-
49
- const { generateStyle } = useTheme()
50
-
51
- const style = computed(() => {
52
- return generateStyle('button', {
79
+ computed(() => ({ ...props, loading: isLoading.value }))
80
+ );
81
+ const appConfig = useAppConfig();
82
+ const ui = computed(() => {
83
+ const uiConfig = {
84
+ ...appConfig.ui.button,
85
+ variants: {
86
+ ...appConfig.ui.button?.variants,
87
+ active: {
88
+ true: {
89
+ base: [appConfig.ui.button?.variants?.active?.true?.base, props.activeClass].filter(Boolean).join(" ")
90
+ },
91
+ false: {
92
+ base: [appConfig.ui.button?.variants?.active?.false?.base, props.inactiveClass].filter(Boolean).join(" ")
93
+ }
94
+ }
95
+ }
96
+ };
97
+ const styler = cv(merge(theme, uiConfig));
98
+ return styler({
53
99
  ...props,
100
+ loading: isLoading.value,
54
101
  size: size.value,
55
- groupOrientation: orientation.value,
102
+ fieldGroup: orientation.value,
103
+ block: props.block,
104
+ square: props.square || !slots.default && !props.label,
56
105
  leading: isLeading.value,
57
- trailing: isTrailing.value,
58
- class: [
59
- props.class,
60
- props.active ? props.activeClass : props.inactiveClass,
61
- props.disabled ? props.disableClass : undefined,
62
- ],
63
- })
64
- })
106
+ trailing: isTrailing.value
107
+ });
108
+ });
65
109
  </script>
66
110
 
67
111
  <template>
68
112
  <Link
69
- :class="style.base({ class: [props.class, props.ui?.base] })"
113
+ v-slot="{ active, ...slotProps }"
70
114
  :type="props.type"
71
115
  :disabled="props.disabled || props.loading"
72
- v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
73
- raw
116
+ v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
117
+ data-part="base"
118
+ custom
74
119
  >
75
- <slot name="leading">
76
- <span
77
- v-if="isLeading && leadingIconName"
78
- :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"
79
- ></span>
80
- </slot>
81
- <span
82
- v-if="props.label || slots.default"
83
- :class="style.label({ class: props.ui?.label })"
120
+ <LinkBase
121
+ v-bind="slotProps"
122
+ :class="ui.base({
123
+ class: [props.ui?.base, props.class],
124
+ active,
125
+ ...props.active && props.activeVariant ? { variant: props.activeVariant } : {},
126
+ ...props.active && props.activeColor ? { color: props.activeColor } : {}
127
+ })"
128
+ @click="onClickWrapper"
84
129
  >
85
- <slot>{{ label }}</slot>
86
- </span>
87
- <slot name="trailing">
88
- <span
89
- v-if="isTrailing && trailingIconName"
90
- :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"
91
- ></span>
92
- </slot>
130
+ <slot name="leading" :ui="ui">
131
+ <Icon
132
+ v-if="isLeading && leadingIconName"
133
+ :name="leadingIconName"
134
+ :class="ui.leadingIcon({ class: props.ui?.leadingIcon, active })"
135
+ data-part="leading-icon"
136
+ />
137
+ <Avatar
138
+ v-else-if="props.avatar"
139
+ :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
140
+ v-bind="props.avatar"
141
+ :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })"
142
+ data-part="leading-avatar"
143
+ />
144
+ </slot>
145
+
146
+ <slot :ui="ui">
147
+ <span
148
+ v-if="props.label"
149
+ :class="ui.label({ class: props.ui?.label, active })"
150
+ data-part="label"
151
+ >
152
+ {{ label }}
153
+ </span>
154
+ </slot>
155
+
156
+ <slot name="trailing" :ui="ui">
157
+ <Icon
158
+ v-if="isTrailing && trailingIconName"
159
+ :name="trailingIconName"
160
+ :class="ui.trailingIcon({ class: props.ui?.trailingIcon, active })"
161
+ data-part="trailing-icon"
162
+ />
163
+ </slot>
164
+ </LinkBase>
93
165
  </Link>
94
166
  </template>
@@ -0,0 +1,45 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import theme from '#build/ui/button';
3
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons';
4
+ import type { ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps, LinkProps } from '../types';
5
+ import type { StaticSlot } from '../types/utils';
6
+ type ThemeVariants = VariantProps<typeof theme>;
7
+ export interface ButtonProps extends ComponentBaseProps, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
8
+ icon?: IconProps['name'];
9
+ label?: string;
10
+ /** @default "solid" */
11
+ variant?: ThemeVariants['variant'];
12
+ activeVariant?: ThemeVariants['variant'];
13
+ /** @default "md" */
14
+ size?: ThemeVariants['size'];
15
+ /** @default "primary" */
16
+ color?: ThemeVariants['color'];
17
+ activeColor?: ThemeVariants['color'];
18
+ /** Render the button with equal padding on all sides. */
19
+ square?: boolean;
20
+ /** Render the button full width. */
21
+ block?: boolean;
22
+ /** Set loading state automatically based on the `@click` promise state */
23
+ loadingAuto?: boolean;
24
+ onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>;
25
+ ui?: ComponentUIProps<typeof theme>;
26
+ }
27
+ export interface ButtonSlots {
28
+ default: StaticSlot<{
29
+ ui: ComponentStyler<typeof theme>;
30
+ }>;
31
+ leading: StaticSlot<{
32
+ ui: ComponentStyler<typeof theme>;
33
+ }>;
34
+ trailing: StaticSlot<{
35
+ ui: ComponentStyler<typeof theme>;
36
+ }>;
37
+ }
38
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
39
+ declare const _default: typeof __VLS_export;
40
+ export default _default;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -1,110 +1,82 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { DateValue } from '@internationalized/date'
4
- import type { CalendarCellTriggerProps, CalendarRootEmits, CalendarRootProps, DateRange, RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui'
5
- import type { calendar } from '../theme'
6
- import type { ComponentAttrs } from '../types'
7
-
8
- export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
9
- 'update:modelValue': [date: CalendarModelValue<R, M>]
10
- }
11
-
12
- export interface CalendarSlots {
13
- 'heading'?: (props: { value: string }) => any
14
- 'day'?: (props: Pick<CalendarCellTriggerProps, 'day'>) => any
15
- 'week-day'?: (props: { day: string }) => any
16
- }
17
-
18
- type CalendarVariants = VariantProps<typeof calendar>
19
-
20
- type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true
21
- ? DateRange
22
- : M extends true ? DateValue[] : DateValue
23
-
24
- type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
25
- ? (DateRange | null)
26
- : M extends true
27
- ? (DateValue[] | undefined)
28
- : (DateValue | undefined)
29
-
30
- type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
31
- type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
32
-
33
- export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends ComponentAttrs<typeof calendar>, _CalendarRootProps, _RangeCalendarRootProps {
34
- /**
35
- * The icon to use for the next year control.
36
- * @default app.icons.chevronDoubleRight
37
- */
38
- nextYearIcon?: string
39
- /**
40
- * The icon to use for the next month control.
41
- * @default app.icons.chevronRight
42
- */
43
- nextMonthIcon?: string
44
- /**
45
- * The icon to use for the previous year control.
46
- * @default app.icons.chevronDoubleLeft
47
- */
48
- prevYearIcon?: string
49
- /**
50
- * The icon to use for the previous month control.
51
- * @default app.icons.chevronLeft
52
- */
53
- prevMonthIcon?: string
54
- /**
55
- * @default "md"
56
- */
57
- size?: CalendarVariants['size']
58
- /** Whether or not a range of dates can be selected */
59
- range?: R & boolean
60
- /** Whether or not multiple dates can be selected */
61
- multiple?: M & boolean
62
- /** Show month controls */
63
- monthControls?: boolean
64
- /** Show year controls */
65
- yearControls?: boolean
66
- defaultValue?: CalendarDefaultValue<R, M>
67
- modelValue?: CalendarDefaultValue<R, M>
68
- }
1
+ <script>
2
+ import theme from "#build/ui/calendar";
69
3
  </script>
70
4
 
71
- <script setup lang="ts" generic="R extends boolean, M extends boolean">
72
- import { reactiveOmit } from '@vueuse/core'
73
- import { useForwardPropsEmits } from 'reka-ui'
74
- import { Calendar as BaseCalendar, RangeCalendar } from 'reka-ui/namespaced'
75
- import { computed } from 'vue'
76
- import { useLocale } from '../composables/useLocale'
77
- import { useTheme } from '../composables/useTheme'
78
- import Button from './Button.vue'
79
-
80
- const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
81
- fixedWeeks: true,
82
- monthControls: true,
83
- yearControls: true,
84
- })
85
- const emit = defineEmits<CalendarEmits<R, M>>()
86
- defineSlots<CalendarSlots>()
87
-
88
- const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emit)
89
-
90
- const { code: locale, dir, t } = useLocale()
91
- const { theme, generateStyle } = useTheme()
92
-
93
- const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight))
94
- const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
95
- const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft))
96
- const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft))
97
-
98
- function paginateYear(date: DateValue, sign: -1 | 1) {
5
+ <script setup>
6
+ import { reactiveOmit } from "@vueuse/core";
7
+ import { useForwardPropsEmits } from "reka-ui";
8
+ import { Calendar as BaseCalendar, RangeCalendar } from "reka-ui/namespaced";
9
+ import { computed } from "vue";
10
+ import { useAppConfig } from "#imports";
11
+ import { useLocale } from "../composables/useLocale";
12
+ import { cv, merge } from "../utils/style";
13
+ import Button from "./Button.vue";
14
+ const props = defineProps({
15
+ as: { type: null, required: false },
16
+ nextYearIcon: { type: [String, Object], required: false },
17
+ nextYear: { type: Object, required: false },
18
+ nextMonthIcon: { type: [String, Object], required: false },
19
+ nextMonth: { type: Object, required: false },
20
+ prevYearIcon: { type: [String, Object], required: false },
21
+ prevYear: { type: Object, required: false },
22
+ prevMonthIcon: { type: [String, Object], required: false },
23
+ prevMonth: { type: Object, required: false },
24
+ size: { type: null, required: false },
25
+ color: { type: null, required: false },
26
+ variant: { type: null, required: false },
27
+ range: { type: Boolean, required: false },
28
+ multiple: { type: Boolean, required: false },
29
+ monthControls: { type: Boolean, required: false, default: true },
30
+ yearControls: { type: Boolean, required: false, default: true },
31
+ defaultValue: { type: null, required: false },
32
+ modelValue: { type: null, required: false },
33
+ ui: { type: null, required: false },
34
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
35
+ defaultPlaceholder: { type: null, required: false },
36
+ placeholder: { type: null, required: false },
37
+ pagedNavigation: { type: Boolean, required: false },
38
+ preventDeselect: { type: Boolean, required: false },
39
+ weekStartsOn: { type: Number, required: false },
40
+ weekdayFormat: { type: String, required: false },
41
+ fixedWeeks: { type: Boolean, required: false, default: true },
42
+ maxValue: { type: null, required: false },
43
+ minValue: { type: null, required: false },
44
+ numberOfMonths: { type: Number, required: false, default: 1 },
45
+ disabled: { type: Boolean, required: false },
46
+ readonly: { type: Boolean, required: false },
47
+ initialFocus: { type: Boolean, required: false },
48
+ isDateDisabled: { type: Function, required: false },
49
+ isDateUnavailable: { type: Function, required: false },
50
+ nextPage: { type: Function, required: false },
51
+ prevPage: { type: Function, required: false },
52
+ disableDaysOutsideCurrentView: { type: Boolean, required: false },
53
+ allowNonContiguousRanges: { type: Boolean, required: false },
54
+ maximumDays: { type: Number, required: false },
55
+ isDateHighlightable: { type: Function, required: false },
56
+ fixedDate: { type: String, required: false }
57
+ });
58
+ const emit = defineEmits(["update:modelValue", "update:placeholder", "update:validModelValue", "update:startValue"]);
59
+ defineSlots();
60
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "size", "color", "variant", "monthControls", "yearControls", "class", "ui"), emit);
61
+ const { code: locale, dir, t } = useLocale();
62
+ const appConfig = useAppConfig();
63
+ const ui = computed(() => {
64
+ const styler = cv(merge(theme, appConfig.ui.calendar));
65
+ return styler({
66
+ ...props,
67
+ outsideView: props.numberOfMonths === 1
68
+ });
69
+ });
70
+ const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight));
71
+ const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
72
+ const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft));
73
+ const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft));
74
+ function paginateYear(date, sign) {
99
75
  if (sign === -1)
100
- return date.subtract({ years: 1 })
101
-
102
- return date.add({ years: 1 })
76
+ return date.subtract({ years: 1 });
77
+ return date.add({ years: 1 });
103
78
  }
104
-
105
- const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar)
106
-
107
- const style = computed(() => generateStyle('calendar', props))
79
+ const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar);
108
80
  </script>
109
81
 
110
82
  <template>
@@ -115,66 +87,68 @@ const style = computed(() => generateStyle('calendar', props))
115
87
  :default-value="props.defaultValue"
116
88
  :locale="locale"
117
89
  :dir="dir"
118
- :class="style.root({ class: [props.class, props.ui?.root] })"
90
+ :class="ui.root({ class: [props.class, props.ui?.root] })"
91
+ data-part="root"
119
92
  >
120
- <Calendar.Header :class="style.header({ class: props.ui?.header })">
121
- <Calendar.Prev v-if="props.yearControls" :prev-page="date => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
122
- <Button :icon="prevYearIcon" :size="props.size" variant="ghost" />
93
+ <Calendar.Header :class="ui.header({ class: props.ui?.header })" data-part="header">
94
+ <Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
95
+ <Button :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevYear" />
123
96
  </Calendar.Prev>
124
97
  <Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
125
- <Button :icon="prevMonthIcon" :size="props.size" variant="ghost" />
98
+ <Button :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevMonth" />
126
99
  </Calendar.Prev>
127
100
 
128
- <Calendar.Heading v-slot="{ headingValue }" :class="style.heading({ class: props.ui?.heading })">
101
+ <Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })" data-part="heading">
129
102
  <slot name="heading" :value="headingValue">
130
103
  {{ headingValue }}
131
104
  </slot>
132
105
  </Calendar.Heading>
133
106
  <Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
134
- <Button :icon="nextMonthIcon" :size="props.size" variant="ghost" />
107
+ <Button :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextMonth" />
135
108
  </Calendar.Next>
136
109
  <Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
137
- <Button :icon="nextYearIcon" :size="props.size" variant="ghost" />
110
+ <Button :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextYear" />
138
111
  </Calendar.Next>
139
112
  </Calendar.Header>
140
- <div :class="style.body({ class: props.ui?.body })">
113
+ <div :class="ui.body({ class: props.ui?.body })" data-part="body">
141
114
  <Calendar.Grid
142
115
  v-for="month in grid"
143
116
  :key="month.value.toString()"
144
- :class="style.grid({ class: props.ui?.grid })"
117
+ :class="ui.grid({ class: props.ui?.grid })"
118
+ data-part="grid"
145
119
  >
146
120
  <Calendar.GridHead>
147
- <Calendar.GridRow :class="style.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
148
- <Calendar.HeadCell v-for="day in weekDays" :key="day" :class="style.headCell({ class: props.ui?.headCell })">
121
+ <Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })" data-part="grid-week-day-row">
122
+ <Calendar.HeadCell v-for="day in weekDays" :key="day" :class="ui.headCell({ class: props.ui?.headCell })" data-part="head-cell">
149
123
  <slot name="week-day" :day="day">
150
124
  {{ day }}
151
125
  </slot>
152
126
  </Calendar.HeadCell>
153
127
  </Calendar.GridRow>
154
128
  </Calendar.GridHead>
155
- <Calendar.GridBody :class="style.gridBody({ class: props.ui?.gridBody })">
129
+ <Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })" data-part="grid-body">
156
130
  <Calendar.GridRow
157
131
  v-for="(weekDates, index) in month.rows"
158
132
  :key="`weekDates-${index}`"
159
- :class="style.gridRow({ class: props.ui?.gridRow })"
133
+ :class="ui.gridRow({ class: props.ui?.gridRow })"
134
+ data-part="grid-row"
160
135
  >
161
136
  <Calendar.Cell
162
137
  v-for="weekDate in weekDates"
163
138
  :key="weekDate.toString()"
164
139
  :date="weekDate"
165
- :class="style.cell({ class: props.ui?.cell })"
140
+ :class="ui.cell({ class: props.ui?.cell })"
141
+ data-part="cell"
166
142
  >
167
143
  <Calendar.CellTrigger
168
- v-slot="{ disabled, unavailable }"
169
144
  :day="weekDate"
170
145
  :month="month.value"
171
- as-child
146
+ :class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
147
+ data-part="cell-trigger"
172
148
  >
173
- <div :class="style.cellTrigger({ class: props.ui?.cellTrigger, disabled: disabled || unavailable })">
174
- <slot name="day" :day="weekDate">
175
- {{ weekDate.day }}
176
- </slot>
177
- </div>
149
+ <slot name="day" :day="weekDate">
150
+ {{ weekDate.day }}
151
+ </slot>
178
152
  </Calendar.CellTrigger>
179
153
  </Calendar.Cell>
180
154
  </Calendar.GridRow>