@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,87 +1,60 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps } from 'reka-ui'
4
- import type { avatarGroup } from '../theme'
5
- import type { ComponentAttrs } from '../types'
6
-
7
- export interface AvatarGroupSlots {
8
- default?: (props?: {}) => any
9
- }
10
-
11
- type AvatarGroupVariants = VariantProps<typeof avatarGroup>
12
-
13
- export interface AvatarGroupProps extends ComponentAttrs<typeof avatarGroup> {
14
- /**
15
- * The element or component this component should render as.
16
- * @default "div"
17
- */
18
- as?: PrimitiveProps['as']
19
- size?: AvatarGroupVariants['size']
20
- /**
21
- * The maximum number of avatars to display.
22
- */
23
- max?: number | string
24
- }
1
+ <script>
2
+ import theme from "#build/ui/avatar-group";
25
3
  </script>
26
4
 
27
- <script setup lang="ts">
28
- import { Primitive } from 'reka-ui'
29
- import { computed } from 'vue'
30
- import { provideAvatarGroup } from '../app/injections'
31
- import { useTheme } from '../composables/useTheme'
32
- import Avatar from './Avatar.vue'
33
-
34
- const props = defineProps<AvatarGroupProps>()
35
- const slots = defineSlots<AvatarGroupSlots>()
36
-
37
- const max = computed(() => typeof props.max === 'string' ? Number.parseInt(props.max, 10) : props.max)
38
-
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useAppConfig } from "#imports";
9
+ import { provideAvatarGroup } from "../composables/useAvatarGroup";
10
+ import { cv, merge } from "../utils/style";
11
+ import Avatar from "./Avatar.vue";
12
+ const props = defineProps({
13
+ as: { type: null, required: false },
14
+ size: { type: null, required: false },
15
+ max: { type: [Number, String], required: false },
16
+ ui: { type: null, required: false },
17
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true }
18
+ });
19
+ const slots = defineSlots();
20
+ const max = computed(() => typeof props.max === "string" ? Number.parseInt(props.max, 10) : props.max);
39
21
  const children = computed(() => {
40
- let nodes = slots.default?.()
41
-
22
+ let nodes = slots.default?.();
42
23
  if (Array.isArray(nodes) && nodes?.length) {
43
24
  nodes = nodes.flatMap((child) => {
44
- if (typeof child.type === 'symbol') {
45
- // `v-if="false"` or commented node
46
- if (typeof child.children === 'string')
47
- return null
48
-
49
- return child.children
25
+ if (typeof child.type === "symbol") {
26
+ if (typeof child.children === "string")
27
+ return null;
28
+ return child.children;
50
29
  }
51
-
52
- return child
53
- }).filter(Boolean)
30
+ return child;
31
+ }).filter(Boolean);
54
32
  }
55
-
56
- return nodes || []
57
- })
58
-
33
+ return nodes || [];
34
+ });
59
35
  const visibleAvatars = computed(() => {
60
36
  if (children.value.length === 0)
61
- return []
62
-
37
+ return [];
63
38
  if (!max.value || max.value <= 0)
64
- return [...children.value].reverse()
65
-
66
- return [...children.value].slice(0, max.value).reverse()
67
- })
68
-
39
+ return [...children.value].reverse();
40
+ return [...children.value].slice(0, max.value).reverse();
41
+ });
69
42
  const hiddenCount = computed(() => {
70
43
  if (children.value.length === 0)
71
- return 0
72
-
73
- return children.value.length - visibleAvatars.value.length
74
- })
75
-
76
- const { generateStyle } = useTheme()
77
- const style = computed(() => generateStyle('avatarGroup', props))
78
-
79
- provideAvatarGroup(computed(() => props))
44
+ return 0;
45
+ return children.value.length - visibleAvatars.value.length;
46
+ });
47
+ const appConfig = useAppConfig();
48
+ const ui = computed(() => {
49
+ const styler = cv(merge(theme, appConfig.ui.avatarGroup));
50
+ return styler(props);
51
+ });
52
+ provideAvatarGroup(computed(() => props));
80
53
  </script>
81
54
 
82
55
  <template>
83
- <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
84
- <Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="style.base({ class: props.ui?.base })" />
85
- <component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="style.base({ class: props.ui?.base })" />
56
+ <Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
57
+ <Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" data-part="base" />
58
+ <component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="ui.base({ class: props.ui?.base })" data-part="base" />
86
59
  </Primitive>
87
60
  </template>
@@ -0,0 +1,30 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import theme from '#build/ui/avatar-group';
4
+ import type { ComponentBaseProps, ComponentUIProps } from '../types';
5
+ import type { StaticSlot } from '../types/utils';
6
+ type ThemeVariants = VariantProps<typeof theme>;
7
+ export interface AvatarGroupProps extends ComponentBaseProps {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @default "div"
11
+ */
12
+ as?: PrimitiveProps['as'];
13
+ size?: ThemeVariants['size'];
14
+ /**
15
+ * The maximum number of avatars to display.
16
+ */
17
+ max?: number | string;
18
+ ui?: ComponentUIProps<typeof theme>;
19
+ }
20
+ export interface AvatarGroupSlots {
21
+ default: StaticSlot;
22
+ }
23
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AvatarGroupSlots>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -1,72 +1,78 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps } from 'reka-ui'
4
- import type { badge } from '../theme'
5
- import type { ComponentAttrs } from '../types'
6
-
7
- export interface BadgeEmits {
8
- 'update:show': [payload: boolean]
9
- }
10
-
11
- export interface BadgeSlots {
12
- default?: (props?: {}) => any
13
- content?: (props?: {}) => any
14
- }
15
-
16
- type BadgeVariants = VariantProps<typeof badge>
17
-
18
- export interface BadgeProps extends ComponentAttrs<typeof badge> {
19
- /**
20
- * The element or component this component should render as.
21
- * @default "div"
22
- */
23
- as?: PrimitiveProps['as']
24
- text?: string | number
25
- size?: BadgeVariants['size']
26
- position?: BadgeVariants['position']
27
- show?: boolean
28
- /** When `true`, keep the badge inside the component for rounded elements. */
29
- inset?: boolean
30
- /** When `true`, render the badge relatively to the parent. */
31
- standalone?: boolean
32
- }
1
+ <script>
2
+ import theme from "#build/ui/badge";
33
3
  </script>
34
4
 
35
- <script setup lang="ts">
36
- import { Primitive, Slot } from 'reka-ui'
37
- import { computed } from 'vue'
38
- import { useTheme } from '../composables/useTheme'
39
-
40
- defineOptions({
41
- inheritAttrs: false,
42
- })
43
-
44
- const props = withDefaults(defineProps<BadgeProps>(), {
45
- position: 'top-right',
46
- })
47
-
48
- defineEmits<BadgeEmits>()
49
- defineSlots<BadgeSlots>()
50
-
51
- const show = defineModel<boolean>('show', { default: true })
52
-
53
- const { generateStyle } = useTheme()
54
- const style = computed(() => generateStyle('badge', props))
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useAppConfig } from "#imports";
9
+ import { useComponentIcons } from "../composables/useComponentIcons";
10
+ import { useFieldGroup } from "../composables/useFieldGroup";
11
+ import { cv, merge } from "../utils/style";
12
+ import Avatar from "./Avatar.vue";
13
+ import Icon from "./Icon.vue";
14
+ const props = defineProps({
15
+ as: { type: null, required: false, default: "span" },
16
+ variant: { type: null, required: false },
17
+ size: { type: null, required: false },
18
+ color: { type: null, required: false },
19
+ square: { type: Boolean, required: false },
20
+ label: { type: [String, Number], required: false },
21
+ ui: { type: null, required: false },
22
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
23
+ icon: { type: [String, Object], required: false },
24
+ avatar: { type: Object, required: false },
25
+ leading: { type: Boolean, required: false },
26
+ leadingIcon: { type: [String, Object], required: false },
27
+ trailing: { type: Boolean, required: false },
28
+ trailingIcon: { type: [String, Object], required: false }
29
+ });
30
+ const slots = defineSlots();
31
+ const { size, orientation } = useFieldGroup(props);
32
+ const { isLeading, leadingIconName, isTrailing, trailingIconName } = useComponentIcons(props);
33
+ const appConfig = useAppConfig();
34
+ const ui = computed(() => {
35
+ const styler = cv(merge(theme, appConfig.ui.badge));
36
+ return styler({
37
+ ...props,
38
+ size: size.value,
39
+ fieldGroup: orientation.value,
40
+ square: props.square || !slots.default && !props.label
41
+ });
42
+ });
55
43
  </script>
56
44
 
57
45
  <template>
58
- <Primitive
59
- :as="props.as"
60
- :class="style.root({ class: [props.class, props.ui?.root] })"
61
- >
62
- <Slot v-bind="$attrs">
63
- <slot></slot>
64
- </Slot>
46
+ <Primitive :as="props.as" :class="ui.base({ class: [props.ui?.base, props.class] })" data-part="base">
47
+ <slot name="leading" :ui="ui">
48
+ <Icon
49
+ v-if="isLeading && leadingIconName"
50
+ :name="leadingIconName"
51
+ :class="ui.leadingIcon({ class: props.ui?.leadingIcon })"
52
+ data-part="leading-icon"
53
+ />
54
+ <Avatar
55
+ v-else-if="props.avatar"
56
+ :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
57
+ v-bind="props.avatar"
58
+ :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })"
59
+ data-part="leading-avatar"
60
+ />
61
+ </slot>
62
+
63
+ <slot :ui="ui">
64
+ <span v-if="props.label" :class="ui.label({ class: props.ui?.label })" data-part="label">
65
+ {{ props.label }}
66
+ </span>
67
+ </slot>
65
68
 
66
- <span v-if="show" :class="style.base({ class: props.ui?.base })">
67
- <slot name="content">
68
- {{ props.text }}
69
- </slot>
70
- </span>
69
+ <slot name="trailing" :ui="ui">
70
+ <Icon
71
+ v-if="isTrailing && trailingIconName"
72
+ :name="trailingIconName"
73
+ :class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
74
+ data-part="trailing-icon"
75
+ />
76
+ </slot>
71
77
  </Primitive>
72
78
  </template>
@@ -0,0 +1,45 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import theme from '#build/ui/badge';
4
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
+ import type { ComponentBaseProps, ComponentStyler, ComponentUIProps } from '../types';
6
+ import type { StaticSlot } from '../types/utils';
7
+ type ThemeVariants = VariantProps<typeof theme>;
8
+ export interface BadgeProps extends ComponentBaseProps, Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
9
+ /**
10
+ * The element or component this component should render as.
11
+ * @default "div"
12
+ */
13
+ as?: PrimitiveProps['as'];
14
+ /** @default "solid" */
15
+ variant?: ThemeVariants['variant'];
16
+ /** @default "md" */
17
+ size?: ThemeVariants['size'];
18
+ /** @default "primary" */
19
+ color?: ThemeVariants['color'];
20
+ /** Render the badge with equal padding on all sides. */
21
+ square?: boolean;
22
+ label?: string | number;
23
+ ui?: ComponentUIProps<typeof theme>;
24
+ }
25
+ export interface BadgeSlots {
26
+ leading: StaticSlot<{
27
+ ui: ComponentStyler<typeof theme>;
28
+ }>;
29
+ default: StaticSlot<{
30
+ ui: ComponentStyler<typeof theme>;
31
+ }>;
32
+ trailing: StaticSlot<{
33
+ ui: ComponentStyler<typeof theme>;
34
+ }>;
35
+ }
36
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<BadgeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BadgeProps> & Readonly<{}>, {
37
+ as: import("reka-ui").AsTag | import("vue").Component;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, BadgeSlots>;
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,101 +1,81 @@
1
- <script lang="ts">
2
- import type { PrimitiveProps } from 'reka-ui'
3
- import type { breadcrumb } from '../theme'
4
- import type { ComponentAttrs, DynamicSlots, LinkProps } from '../types'
5
-
6
- export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
7
- label?: string
8
- icon?: string
9
- slot?: string
10
- [key: string]: any
11
- }
12
-
13
- type SlotProps<T extends BreadcrumbItem> = (props: { item: T, index: number, active?: boolean }) => any
14
-
15
- export type BreadcrumbSlots<T extends BreadcrumbItem = BreadcrumbItem> = {
16
- 'item'?: SlotProps<T>
17
- 'item-leading'?: SlotProps<T>
18
- 'item-label'?: SlotProps<T>
19
- 'item-trailing'?: SlotProps<T>
20
- 'separator'?: any
21
- } & DynamicSlots<T, 'leading' | 'label' | 'trailing', SlotProps<T>>
22
-
23
- export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> extends ComponentAttrs<typeof breadcrumb> {
24
- /**
25
- * The element or component this component should render as.
26
- * @default "nav"
27
- */
28
- as?: PrimitiveProps['as']
29
- items?: T[]
30
- /**
31
- * The icon to use as a separator.
32
- * @default app.icons.chevronRight
33
- */
34
- separatorIcon?: string
35
- /**
36
- * The key used to get the label from the item.
37
- * @default "label"
38
- */
39
- labelKey?: string
40
- }
1
+ <script>
2
+ import theme from "#build/ui/breadcrumb";
41
3
  </script>
42
4
 
43
- <script setup lang="ts" generic="T extends BreadcrumbItem">
44
- import { Primitive } from 'reka-ui'
45
- import { computed } from 'vue'
46
- import { useLocale } from '../composables/useLocale'
47
- import { useTheme } from '../composables/useTheme'
48
- import { get, pickLinkProps } from '../utils'
49
- import Link from './Link.vue'
50
- import LinkBase from './LinkBase.vue'
51
-
52
- const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
53
- as: 'nav',
54
- labelKey: 'label',
55
- })
56
-
57
- const slots = defineSlots<BreadcrumbSlots<T>>()
58
-
59
- const { dir } = useLocale()
60
- const { theme, generateStyle } = useTheme()
61
-
62
- const separatorIcon = computed(() => props.separatorIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
63
-
64
- const style = computed(() => generateStyle('breadcrumb', props))
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useAppConfig } from "#imports";
9
+ import { useLocale } from "../composables/useLocale";
10
+ import { get, pickLinkProps } from "../utils";
11
+ import { cv, merge } from "../utils/style";
12
+ import Avatar from "./Avatar.vue";
13
+ import Icon from "./Icon.vue";
14
+ import Link from "./Link.vue";
15
+ import LinkBase from "./LinkBase.vue";
16
+ const props = defineProps({
17
+ as: { type: null, required: false, default: "nav" },
18
+ items: { type: Array, required: false },
19
+ separatorIcon: { type: String, required: false },
20
+ labelKey: { type: null, required: false, default: "label" },
21
+ ui: { type: null, required: false },
22
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true }
23
+ });
24
+ const slots = defineSlots();
25
+ const { dir } = useLocale();
26
+ const appConfig = useAppConfig();
27
+ const separatorIcon = computed(() => props.separatorIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
28
+ const ui = computed(() => {
29
+ const styler = cv(merge(theme, appConfig.ui.breadcrumb));
30
+ return styler(props);
31
+ });
65
32
  </script>
66
33
 
67
34
  <template>
68
- <Primitive :as="props.as" aria-label="breadcrumb" :class="style.root({ class: [props.class, props.ui?.root] })">
69
- <ol :class="style.list({ class: props.ui?.list })">
35
+ <Primitive :as="props.as" aria-label="breadcrumb" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
36
+ <ol :class="ui.list({ class: props.ui?.list })" data-part="list">
70
37
  <template v-for="(item, index) in props.items" :key="index">
71
- <li :class="style.item({ class: props.ui?.item })">
38
+ <li :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item">
72
39
  <Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
73
40
  <LinkBase
74
41
  v-bind="slotProps"
75
42
  as="span"
76
- :aria-current="active && (index === items!.length - 1) ? 'page' : undefined"
77
- :class="style.link({ class: props.ui?.link, active: index === items!.length - 1, disabled: item.disabled, to: !!item.to })"
43
+ :aria-current="(item.active ?? active) && index === items.length - 1 ? 'page' : void 0"
44
+ :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: item.active ?? index === items.length - 1, disabled: item.disabled, to: !!item.to })"
45
+ data-part="link"
78
46
  >
79
- <slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="item" :index="index">
80
- <slot :name="(`${item.slot || 'item'}-leading` as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
81
- <span v-if="item.icon" :class="style.linkLeadingIcon({ class: [item.icon, props.ui?.linkLeadingIcon] })"></span>
47
+ <slot :name="item.slot || 'item'" :item="item" :index="index" :active="item.active ?? index === items.length - 1" :ui="ui">
48
+ <slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="item.active ?? index === items.length - 1" :index="index" :ui="ui">
49
+ <Icon
50
+ v-if="item.icon"
51
+ :name="item.icon"
52
+ :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: item.active ?? index === items.length - 1 })"
53
+ data-part="link-leading-icon"
54
+ />
55
+ <Avatar
56
+ v-else-if="item.avatar"
57
+ :size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
58
+ v-bind="item.avatar"
59
+ :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: item.active ?? index === items.length - 1 })"
60
+ data-part="link-leading-avatar"
61
+ />
82
62
  </slot>
83
63
 
84
- <span v-if="get(item, props.labelKey) || slots[(`${item.slot || 'item'}-label` as keyof BreadcrumbSlots<T>)]" :class="style.linkLabel({ class: props.ui?.linkLabel })">
85
- <slot :name="(`${item.slot || 'item'}-label` as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
64
+ <span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })" data-part="link-label">
65
+ <slot :name="`${item.slot || 'item'}-label`" :item="item" :active="item.active ?? index === items.length - 1" :index="index">
86
66
  {{ get(item, props.labelKey) }}
87
67
  </slot>
88
68
  </span>
89
69
 
90
- <slot :name="(`${item.slot || 'item'}-trailing` as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index"></slot>
70
+ <slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="item.active ?? index === items.length - 1" :index="index"></slot>
91
71
  </slot>
92
72
  </LinkBase>
93
73
  </Link>
94
74
  </li>
95
75
 
96
- <li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="style.separator({ class: props.ui?.separator })">
97
- <slot name="separator">
98
- <span :class="style.separatorIcon({ class: [separatorIcon, props.ui?.separatorIcon] })"></span>
76
+ <li v-if="index < items.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })" data-part="separator">
77
+ <slot name="separator" :ui="ui">
78
+ <Icon :name="separatorIcon" :class="ui.separatorIcon({ class: [props.ui?.separatorIcon, item.ui?.separatorIcon] })" data-part="separator-icon" />
99
79
  </slot>
100
80
  </li>
101
81
  </template>
@@ -0,0 +1,79 @@
1
+ import type { PrimitiveProps } from 'reka-ui';
2
+ import theme from '#build/ui/breadcrumb';
3
+ import type { AvatarProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps, LinkProps } from '../types';
4
+ import type { DynamicSlots, GetItemKeys, StaticSlot } from '../types/utils';
5
+ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
6
+ label?: string;
7
+ icon?: IconProps['name'];
8
+ avatar?: AvatarProps;
9
+ slot?: string;
10
+ ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'>;
11
+ [key: string]: any;
12
+ }
13
+ export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> extends ComponentBaseProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @default "nav"
17
+ */
18
+ as?: PrimitiveProps['as'];
19
+ items?: T[];
20
+ /**
21
+ * The icon to use as a separator.
22
+ * @default app.icons.chevronRight
23
+ */
24
+ separatorIcon?: string;
25
+ /**
26
+ * The key used to get the label from the item.
27
+ * @default "label"
28
+ */
29
+ labelKey?: GetItemKeys<T>;
30
+ ui?: ComponentUIProps<typeof theme>;
31
+ }
32
+ export type BreadcrumbSlots<T extends BreadcrumbItem = BreadcrumbItem> = {
33
+ 'item': StaticSlot<{
34
+ item: T;
35
+ index: number;
36
+ active: boolean;
37
+ ui: ComponentStyler<typeof theme>;
38
+ }>;
39
+ 'item-leading': StaticSlot<{
40
+ item: T;
41
+ index: number;
42
+ active: boolean;
43
+ ui: ComponentStyler<typeof theme>;
44
+ }>;
45
+ 'item-label': StaticSlot<{
46
+ item: T;
47
+ index: number;
48
+ active: boolean;
49
+ }>;
50
+ 'item-trailing': StaticSlot<{
51
+ item: T;
52
+ index: number;
53
+ active: boolean;
54
+ }>;
55
+ 'separator': StaticSlot<{
56
+ ui: ComponentStyler<typeof theme>;
57
+ }>;
58
+ } & DynamicSlots<T, 'label' | 'trailing', {
59
+ index: number;
60
+ active: boolean;
61
+ }> & DynamicSlots<T, 'leading', {
62
+ index: number;
63
+ active?: boolean;
64
+ ui: ComponentStyler<typeof theme>;
65
+ }>;
66
+ declare const __VLS_export: <T extends BreadcrumbItem>(__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<{
67
+ props: __VLS_PrettifyLocal<BreadcrumbProps<T>> & import("vue").PublicProps;
68
+ expose: (exposed: {}) => void;
69
+ attrs: any;
70
+ slots: BreadcrumbSlots<T>;
71
+ emit: {};
72
+ }>) => import("vue").VNode & {
73
+ __ctx?: Awaited<typeof __VLS_setup>;
74
+ };
75
+ declare const _default: typeof __VLS_export;
76
+ export default _default;
77
+ type __VLS_PrettifyLocal<T> = {
78
+ [K in keyof T as K]: T[K];
79
+ } & {};