@byyuurin/ui 0.0.9 → 0.0.11

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 (215) hide show
  1. package/README.md +2 -5
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +1 -1
  4. package/dist/module.mjs.map +1 -1
  5. package/dist/runtime/app/injections.d.ts +9323 -3
  6. package/dist/runtime/app/injections.js +35 -0
  7. package/dist/runtime/components/Accordion.vue +36 -69
  8. package/dist/runtime/components/Accordion.vue.d.ts +52 -0
  9. package/dist/runtime/components/Alert.vue +37 -75
  10. package/dist/runtime/components/Alert.vue.d.ts +59 -0
  11. package/dist/runtime/components/App.vue +25 -40
  12. package/dist/runtime/components/App.vue.d.ts +24 -0
  13. package/dist/runtime/components/Avatar.vue +31 -51
  14. package/dist/runtime/components/Avatar.vue.d.ts +25 -0
  15. package/dist/runtime/components/AvatarGroup.vue +38 -69
  16. package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
  17. package/dist/runtime/components/Badge.vue +25 -51
  18. package/dist/runtime/components/Badge.vue.d.ts +44 -0
  19. package/dist/runtime/components/Breadcrumb.vue +35 -77
  20. package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
  21. package/dist/runtime/components/Button.vue +62 -51
  22. package/dist/runtime/components/Button.vue.d.ts +29 -0
  23. package/dist/runtime/components/ButtonGroup.vue +17 -37
  24. package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
  25. package/dist/runtime/components/Calendar.vue +75 -101
  26. package/dist/runtime/components/Calendar.vue.d.ts +75 -0
  27. package/dist/runtime/components/Card.vue +25 -42
  28. package/dist/runtime/components/Card.vue.d.ts +30 -0
  29. package/dist/runtime/components/Carousel.vue +118 -223
  30. package/dist/runtime/components/Carousel.vue.d.ts +104 -0
  31. package/dist/runtime/components/Checkbox.vue +49 -71
  32. package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
  33. package/dist/runtime/components/Chip.vue +31 -48
  34. package/dist/runtime/components/Chip.vue.d.ts +30 -0
  35. package/dist/runtime/components/Collapsible.vue +22 -30
  36. package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
  37. package/dist/runtime/components/Drawer.vue +52 -102
  38. package/dist/runtime/components/Drawer.vue.d.ts +80 -0
  39. package/dist/runtime/components/DropdownMenu.vue +65 -0
  40. package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
  41. package/dist/runtime/components/DropdownMenuContent.vue +192 -0
  42. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
  43. package/dist/runtime/components/Form.vue +197 -0
  44. package/dist/runtime/components/Form.vue.d.ts +78 -0
  45. package/dist/runtime/components/FormItem.vue +90 -0
  46. package/dist/runtime/components/FormItem.vue.d.ts +60 -0
  47. package/dist/runtime/components/Input.vue +93 -115
  48. package/dist/runtime/components/Input.vue.d.ts +64 -0
  49. package/dist/runtime/components/InputNumber.vue +81 -116
  50. package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
  51. package/dist/runtime/components/Kbd.vue +18 -39
  52. package/dist/runtime/components/Kbd.vue.d.ts +28 -0
  53. package/dist/runtime/components/Link.vue +170 -244
  54. package/dist/runtime/components/Link.vue.d.ts +95 -0
  55. package/dist/runtime/components/LinkBase.vue +36 -54
  56. package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
  57. package/dist/runtime/components/Modal.vue +50 -85
  58. package/dist/runtime/components/Modal.vue.d.ts +66 -0
  59. package/dist/runtime/components/OverlayProvider.vue +10 -14
  60. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  61. package/dist/runtime/components/Pagination.vue +55 -121
  62. package/dist/runtime/components/Pagination.vue.d.ts +93 -0
  63. package/dist/runtime/components/PinInput.vue +57 -57
  64. package/dist/runtime/components/PinInput.vue.d.ts +35 -0
  65. package/dist/runtime/components/Popover.vue +39 -68
  66. package/dist/runtime/components/Popover.vue.d.ts +45 -0
  67. package/dist/runtime/components/Progress.vue +68 -120
  68. package/dist/runtime/components/Progress.vue.d.ts +54 -0
  69. package/dist/runtime/components/RadioGroup.vue +75 -129
  70. package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
  71. package/dist/runtime/components/ScrollArea.vue +31 -31
  72. package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
  73. package/dist/runtime/components/Select.vue +119 -199
  74. package/dist/runtime/components/Select.vue.d.ts +119 -0
  75. package/dist/runtime/components/Separator.vue +26 -44
  76. package/dist/runtime/components/Separator.vue.d.ts +27 -0
  77. package/dist/runtime/components/Skeleton.vue +12 -21
  78. package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
  79. package/dist/runtime/components/Slider.vue +54 -71
  80. package/dist/runtime/components/Slider.vue.d.ts +36 -0
  81. package/dist/runtime/components/Switch.vue +54 -68
  82. package/dist/runtime/components/Switch.vue.d.ts +49 -0
  83. package/dist/runtime/components/Table.vue +113 -186
  84. package/dist/runtime/components/Table.vue.d.ts +148 -0
  85. package/dist/runtime/components/Tabs.vue +35 -79
  86. package/dist/runtime/components/Tabs.vue.d.ts +65 -0
  87. package/dist/runtime/components/Textarea.vue +82 -123
  88. package/dist/runtime/components/Textarea.vue.d.ts +60 -0
  89. package/dist/runtime/components/Toast.vue +51 -76
  90. package/dist/runtime/components/Toast.vue.d.ts +131 -0
  91. package/dist/runtime/components/ToastProvider.vue +65 -101
  92. package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
  93. package/dist/runtime/components/Tooltip.vue +36 -47
  94. package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
  95. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  96. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  97. package/dist/runtime/composables/useFormItem.d.ts +27 -0
  98. package/dist/runtime/composables/useFormItem.js +64 -0
  99. package/dist/runtime/composables/useKbd.d.ts +1 -1
  100. package/dist/runtime/composables/useLocale.d.ts +3 -3
  101. package/dist/runtime/composables/useTheme.d.ts +1 -1
  102. package/dist/runtime/composables/useTheme.js +2 -1
  103. package/dist/runtime/composables/useToast.d.ts +1 -1
  104. package/dist/runtime/index.d.ts +3 -0
  105. package/dist/runtime/index.js +3 -0
  106. package/dist/runtime/locale/en.d.ts +1 -1
  107. package/dist/runtime/locale/zh-tw.d.ts +1 -1
  108. package/dist/runtime/theme/accordion.d.ts +45 -51
  109. package/dist/runtime/theme/accordion.js +1 -1
  110. package/dist/runtime/theme/alert.d.ts +115 -121
  111. package/dist/runtime/theme/alert.js +1 -1
  112. package/dist/runtime/theme/app.d.ts +1 -0
  113. package/dist/runtime/theme/app.js +2 -1
  114. package/dist/runtime/theme/avatar-group.d.ts +42 -48
  115. package/dist/runtime/theme/avatar-group.js +1 -1
  116. package/dist/runtime/theme/avatar.d.ts +46 -52
  117. package/dist/runtime/theme/avatar.js +1 -1
  118. package/dist/runtime/theme/badge.d.ts +63 -93
  119. package/dist/runtime/theme/badge.js +1 -1
  120. package/dist/runtime/theme/breadcrumb.d.ts +52 -58
  121. package/dist/runtime/theme/breadcrumb.js +1 -1
  122. package/dist/runtime/theme/button-group.d.ts +36 -42
  123. package/dist/runtime/theme/button.d.ts +165 -117
  124. package/dist/runtime/theme/button.js +1 -1
  125. package/dist/runtime/theme/calendar.d.ts +52 -50
  126. package/dist/runtime/theme/calendar.js +20 -3
  127. package/dist/runtime/theme/card.d.ts +52 -58
  128. package/dist/runtime/theme/card.js +1 -1
  129. package/dist/runtime/theme/carousel.d.ts +98 -104
  130. package/dist/runtime/theme/carousel.js +1 -1
  131. package/dist/runtime/theme/checkbox.d.ts +77 -83
  132. package/dist/runtime/theme/checkbox.js +1 -1
  133. package/dist/runtime/theme/chip.d.ts +50 -89
  134. package/dist/runtime/theme/chip.js +1 -1
  135. package/dist/runtime/theme/collapsible.d.ts +29 -35
  136. package/dist/runtime/theme/collapsible.js +1 -1
  137. package/dist/runtime/theme/drawer.d.ts +131 -102
  138. package/dist/runtime/theme/drawer.js +1 -1
  139. package/dist/runtime/theme/dropdown-menu.d.ts +65 -0
  140. package/dist/runtime/theme/dropdown-menu.js +83 -0
  141. package/dist/runtime/theme/form-item.d.ts +70 -0
  142. package/dist/runtime/theme/form-item.js +34 -0
  143. package/dist/runtime/theme/form.d.ts +2 -0
  144. package/dist/runtime/theme/form.js +7 -0
  145. package/dist/runtime/theme/index.d.ts +3 -0
  146. package/dist/runtime/theme/index.js +3 -0
  147. package/dist/runtime/theme/input-number.d.ts +100 -126
  148. package/dist/runtime/theme/input-number.js +1 -1
  149. package/dist/runtime/theme/input.d.ts +153 -131
  150. package/dist/runtime/theme/input.js +3 -3
  151. package/dist/runtime/theme/kbd.d.ts +30 -36
  152. package/dist/runtime/theme/link.d.ts +37 -43
  153. package/dist/runtime/theme/modal.d.ts +35 -69
  154. package/dist/runtime/theme/modal.js +1 -1
  155. package/dist/runtime/theme/pagination.d.ts +71 -77
  156. package/dist/runtime/theme/pagination.js +1 -1
  157. package/dist/runtime/theme/pinInput.d.ts +82 -88
  158. package/dist/runtime/theme/pinInput.js +2 -2
  159. package/dist/runtime/theme/popover.d.ts +29 -35
  160. package/dist/runtime/theme/popover.js +1 -1
  161. package/dist/runtime/theme/progress.d.ts +167 -109
  162. package/dist/runtime/theme/progress.js +1 -1
  163. package/dist/runtime/theme/radio-group.d.ts +99 -105
  164. package/dist/runtime/theme/radio-group.js +1 -1
  165. package/dist/runtime/theme/scroll-area.d.ts +62 -68
  166. package/dist/runtime/theme/scroll-area.js +1 -1
  167. package/dist/runtime/theme/select.d.ts +168 -158
  168. package/dist/runtime/theme/select.js +3 -2
  169. package/dist/runtime/theme/separator.d.ts +64 -85
  170. package/dist/runtime/theme/separator.js +1 -1
  171. package/dist/runtime/theme/skeleton.d.ts +1 -7
  172. package/dist/runtime/theme/slider.d.ts +62 -68
  173. package/dist/runtime/theme/slider.js +1 -1
  174. package/dist/runtime/theme/switch.d.ts +111 -117
  175. package/dist/runtime/theme/switch.js +1 -1
  176. package/dist/runtime/theme/table.d.ts +75 -78
  177. package/dist/runtime/theme/table.js +3 -2
  178. package/dist/runtime/theme/tabs.d.ts +116 -139
  179. package/dist/runtime/theme/tabs.js +1 -1
  180. package/dist/runtime/theme/textarea.d.ts +78 -90
  181. package/dist/runtime/theme/textarea.js +2 -2
  182. package/dist/runtime/theme/toast-provider.d.ts +110 -131
  183. package/dist/runtime/theme/toast-provider.js +1 -1
  184. package/dist/runtime/theme/toast.d.ts +74 -80
  185. package/dist/runtime/theme/toast.js +1 -1
  186. package/dist/runtime/theme/tooltip.d.ts +35 -41
  187. package/dist/runtime/theme/tooltip.js +1 -1
  188. package/dist/runtime/types/components.d.ts +3 -0
  189. package/dist/runtime/types/form.d.ts +45 -0
  190. package/dist/runtime/types/form.js +0 -0
  191. package/dist/runtime/types/index.d.ts +5 -2
  192. package/dist/runtime/types/index.js +1 -0
  193. package/dist/runtime/types/utils.d.ts +37 -16
  194. package/dist/runtime/utils/extend-theme.js +15 -4
  195. package/dist/runtime/utils/form.d.ts +5 -0
  196. package/dist/runtime/utils/form.js +24 -0
  197. package/dist/runtime/utils/index.d.ts +2 -0
  198. package/dist/runtime/utils/index.js +4 -0
  199. package/dist/runtime/utils/link.d.ts +4 -28
  200. package/dist/runtime/utils/link.js +10 -3
  201. package/dist/runtime/utils/styler.d.ts +2 -2
  202. package/dist/runtime/utils/styler.js +2 -2
  203. package/dist/shared/ui.D1BTWZFB.mjs +5 -0
  204. package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
  205. package/dist/types.d.mts +1 -1
  206. package/dist/unocss.mjs +7 -6
  207. package/dist/unocss.mjs.map +1 -1
  208. package/dist/unplugin.mjs +1 -1
  209. package/dist/unplugin.mjs.map +1 -1
  210. package/dist/vite.mjs +1 -1
  211. package/package.json +78 -74
  212. package/dist/module.cjs +0 -5
  213. package/dist/shared/ui.1a1f119c.mjs +0 -5
  214. package/dist/shared/ui.1a1f119c.mjs.map +0 -1
  215. package/dist/types.d.ts +0 -1
@@ -0,0 +1,25 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { AvatarRootProps } from 'reka-ui';
3
+ import type { avatar } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ export interface AvatarSlots {
6
+ default?: (props?: {}) => any;
7
+ }
8
+ type AvatarVariants = VariantProps<typeof avatar>;
9
+ export interface AvatarProps extends ComponentAttrs<typeof avatar> {
10
+ /**
11
+ * The element or component this component should render as.
12
+ * @default "span"
13
+ */
14
+ as?: AvatarRootProps['as'];
15
+ src?: string;
16
+ alt?: string;
17
+ icon?: string;
18
+ text?: string;
19
+ size?: AvatarVariants['size'];
20
+ style?: string | HTMLElement['style'];
21
+ }
22
+ declare const _default: import("vue").DefineComponent<AvatarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarProps> & Readonly<{}>, {
23
+ src: string;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ export default _default;
@@ -1,87 +1,56 @@
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'
1
+ <script>
6
2
 
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
- }
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 { provideAvatarGroup } from "../app/injections";
9
+ import { useTheme } from "../composables/useTheme";
10
+ import Avatar from "./Avatar.vue";
11
+ const props = defineProps({
12
+ as: { type: null, required: false },
13
+ size: { type: null, required: false },
14
+ max: { type: [Number, String], required: false },
15
+ class: { type: null, required: false },
16
+ ui: { type: null, required: false }
17
+ });
18
+ const slots = defineSlots();
19
+ const max = computed(() => typeof props.max === "string" ? Number.parseInt(props.max, 10) : props.max);
39
20
  const children = computed(() => {
40
- let nodes = slots.default?.()
41
-
21
+ let nodes = slots.default?.();
42
22
  if (Array.isArray(nodes) && nodes?.length) {
43
23
  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
24
+ if (typeof child.type === "symbol") {
25
+ if (typeof child.children === "string")
26
+ return null;
27
+ return child.children;
50
28
  }
51
-
52
- return child
53
- }).filter(Boolean)
29
+ return child;
30
+ }).filter(Boolean);
54
31
  }
55
-
56
- return nodes || []
57
- })
58
-
32
+ return nodes || [];
33
+ });
59
34
  const visibleAvatars = computed(() => {
60
35
  if (children.value.length === 0)
61
- return []
62
-
36
+ return [];
63
37
  if (!max.value || max.value <= 0)
64
- return [...children.value].reverse()
65
-
66
- return [...children.value].slice(0, max.value).reverse()
67
- })
68
-
38
+ return [...children.value].reverse();
39
+ return [...children.value].slice(0, max.value).reverse();
40
+ });
69
41
  const hiddenCount = computed(() => {
70
42
  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))
43
+ return 0;
44
+ return children.value.length - visibleAvatars.value.length;
45
+ });
46
+ const { generateStyle } = useTheme();
47
+ const style = computed(() => generateStyle("avatarGroup", props));
48
+ provideAvatarGroup(computed(() => props));
80
49
  </script>
81
50
 
82
51
  <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 })" />
52
+ <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
53
+ <Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="style.base({ class: props.ui?.base })" data-part="base" />
54
+ <component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="style.base({ class: props.ui?.base })" data-part="base" />
86
55
  </Primitive>
87
56
  </template>
@@ -0,0 +1,27 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { avatarGroup } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ export interface AvatarGroupSlots {
6
+ default?: (props?: {}) => any;
7
+ }
8
+ type AvatarGroupVariants = VariantProps<typeof avatarGroup>;
9
+ export interface AvatarGroupProps extends ComponentAttrs<typeof avatarGroup> {
10
+ /**
11
+ * The element or component this component should render as.
12
+ * @default "div"
13
+ */
14
+ as?: PrimitiveProps['as'];
15
+ size?: AvatarGroupVariants['size'];
16
+ /**
17
+ * The maximum number of avatars to display.
18
+ */
19
+ max?: number | string;
20
+ }
21
+ declare const _default: __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>;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -1,69 +1,43 @@
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'
1
+ <script>
6
2
 
7
- export interface BadgeEmits {
8
- (e: 'update:show', payload: boolean): void
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
- }
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
-
5
+ <script setup>
6
+ import { Primitive, Slot } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useTheme } from "../composables/useTheme";
40
9
  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))
10
+ inheritAttrs: false
11
+ });
12
+ const props = defineProps({
13
+ as: { type: null, required: false },
14
+ text: { type: [String, Number], required: false },
15
+ size: { type: null, required: false },
16
+ position: { type: null, required: false, default: "top-right" },
17
+ show: { type: Boolean, required: false },
18
+ inset: { type: Boolean, required: false },
19
+ standalone: { type: Boolean, required: false },
20
+ class: { type: null, required: false },
21
+ ui: { type: null, required: false }
22
+ });
23
+ defineEmits(["update:show"]);
24
+ defineSlots();
25
+ const show = defineModel("show", { type: Boolean, ...{ default: true } });
26
+ const { generateStyle } = useTheme();
27
+ const style = computed(() => generateStyle("badge", props));
55
28
  </script>
56
29
 
57
30
  <template>
58
31
  <Primitive
59
32
  :as="props.as"
60
33
  :class="style.root({ class: [props.class, props.ui?.root] })"
34
+ :data-part="$attrs['data-part'] ?? 'root'"
61
35
  >
62
36
  <Slot v-bind="$attrs">
63
37
  <slot></slot>
64
38
  </Slot>
65
39
 
66
- <span v-if="show" :class="style.base({ class: props.ui?.base })">
40
+ <span v-if="show" :class="style.base({ class: props.ui?.base })" data-part="base">
67
41
  <slot name="content">
68
42
  {{ props.text }}
69
43
  </slot>
@@ -0,0 +1,44 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { badge } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ export interface BadgeEmits {
6
+ 'update:show': [payload: boolean];
7
+ }
8
+ export interface BadgeSlots {
9
+ default?: (props?: {}) => any;
10
+ content?: (props?: {}) => any;
11
+ }
12
+ type BadgeVariants = VariantProps<typeof badge>;
13
+ export interface BadgeProps extends ComponentAttrs<typeof badge> {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @default "div"
17
+ */
18
+ as?: PrimitiveProps['as'];
19
+ text?: string | number;
20
+ size?: BadgeVariants['size'];
21
+ position?: BadgeVariants['position'];
22
+ show?: boolean;
23
+ /** When `true`, keep the badge inside the component for rounded elements. */
24
+ inset?: boolean;
25
+ /** When `true`, render the badge relatively to the parent. */
26
+ standalone?: boolean;
27
+ }
28
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<BadgeProps & {
29
+ show?: boolean;
30
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ "update:show": (...args: unknown[]) => any;
32
+ }, string, import("vue").PublicProps, Readonly<BadgeProps & {
33
+ show?: boolean;
34
+ }> & Readonly<{
35
+ "onUpdate:show"?: ((...args: unknown[]) => any) | undefined;
36
+ }>, {
37
+ position: "top-right" | "bottom-right" | "top-left" | "bottom-left";
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, BadgeSlots>;
39
+ export default _default;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -1,105 +1,63 @@
1
- <script lang="ts">
2
- import type { PrimitiveProps } from 'reka-ui'
3
- import type { breadcrumb } from '../theme'
4
- import type { ComponentAttrs, LinkProps } from '../types'
1
+ <script>
5
2
 
6
- type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
7
-
8
- type DynamicSlots<T extends { slot?: string }, SlotProps, Slot = T['slot']> =
9
- Slot extends string
10
- ? Record<Slot | `${Slot}-${'leading' | 'label' | 'trailing'}`, SlotProps>
11
- : Record<string, never>
12
-
13
- export type BreadcrumbSlots<T extends { slot?: string }> = {
14
- 'item'?: SlotProps<T>
15
- 'item-leading'?: SlotProps<T>
16
- 'item-label'?: SlotProps<T>
17
- 'item-trailing'?: SlotProps<T>
18
- 'separator'?: (props?: {}) => any
19
- } & DynamicSlots<T, SlotProps<T>>
20
-
21
- export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
22
- label?: string
23
- icon?: string
24
- slot?: string
25
- }
26
-
27
- export interface BreadcrumbProps<T> extends ComponentAttrs<typeof breadcrumb> {
28
- /**
29
- * The element or component this component should render as.
30
- * @default "nav"
31
- */
32
- as?: PrimitiveProps['as']
33
- items?: T[]
34
- /**
35
- * The icon to use as a separator.
36
- * @default app.icons.chevronRight
37
- */
38
- separatorIcon?: string
39
- /**
40
- * The key used to get the label from the item.
41
- * @default "label"
42
- */
43
- labelKey?: string
44
- }
45
3
  </script>
46
4
 
47
- <script setup lang="ts" generic="T extends BreadcrumbItem">
48
- import { Primitive } from 'reka-ui'
49
- import { computed } from 'vue'
50
- import { useLocale } from '../composables/useLocale'
51
- import { useTheme } from '../composables/useTheme'
52
- import { get, pickLinkProps } from '../utils'
53
- import Link from './Link.vue'
54
- import LinkBase from './LinkBase.vue'
55
-
56
- const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
57
- as: 'nav',
58
- labelKey: 'label',
59
- })
60
-
61
- const slots = defineSlots<BreadcrumbSlots<T>>()
62
-
63
- const { dir } = useLocale()
64
- const { theme, generateStyle } = useTheme()
65
-
66
- const separatorIcon = computed(() => props.separatorIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
67
-
68
- const style = computed(() => generateStyle('breadcrumb', props))
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useLocale } from "../composables/useLocale";
9
+ import { useTheme } from "../composables/useTheme";
10
+ import { get, pickLinkProps } from "../utils";
11
+ import Link from "./Link.vue";
12
+ import LinkBase from "./LinkBase.vue";
13
+ const props = defineProps({
14
+ as: { type: null, required: false, default: "nav" },
15
+ items: { type: Array, required: false },
16
+ separatorIcon: { type: String, required: false },
17
+ labelKey: { type: String, required: false, default: "label" },
18
+ class: { type: null, required: false },
19
+ ui: { type: null, required: false }
20
+ });
21
+ const slots = defineSlots();
22
+ const { dir } = useLocale();
23
+ const { theme, generateStyle } = useTheme();
24
+ const separatorIcon = computed(() => props.separatorIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight));
25
+ const style = computed(() => generateStyle("breadcrumb", props));
69
26
  </script>
70
27
 
71
28
  <template>
72
- <Primitive :as="props.as" aria-label="breadcrumb" :class="style.root({ class: [props.class, props.ui?.root] })">
73
- <ol :class="style.list({ class: props.ui?.list })">
29
+ <Primitive :as="props.as" aria-label="breadcrumb" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
30
+ <ol :class="style.list({ class: props.ui?.list })" data-part="list">
74
31
  <template v-for="(item, index) in props.items" :key="index">
75
- <li :class="style.item({ class: props.ui?.item })">
32
+ <li :class="style.item({ class: props.ui?.item })" data-part="item">
76
33
  <Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
77
34
  <LinkBase
78
35
  v-bind="slotProps"
79
36
  as="span"
80
- :aria-current="active && (index === items!.length - 1) ? 'page' : undefined"
81
- :class="style.link({ class: props.ui?.link, active: index === items!.length - 1, disabled: item.disabled, to: !!item.to })"
37
+ :aria-current="active && index === items.length - 1 ? 'page' : void 0"
38
+ :class="style.link({ class: props.ui?.link, active: index === items.length - 1, disabled: item.disabled, to: !!item.to })"
39
+ data-part="link"
82
40
  >
83
41
  <slot :name="item.slot || 'item'" :item="item" :index="index">
84
- <slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="index === items!.length - 1" :index="index">
85
- <span v-if="item.icon" :class="style.linkLeadingIcon({ class: [item.icon, props.ui?.linkLeadingIcon] })"></span>
42
+ <slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="index === items.length - 1" :index="index">
43
+ <span v-if="item.icon" :class="style.linkLeadingIcon({ class: [item.icon, props.ui?.linkLeadingIcon] })" data-part="link-leading-icon"></span>
86
44
  </slot>
87
45
 
88
- <span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="style.linkLabel({ class: props.ui?.linkLabel })">
89
- <slot :name="`${item.slot || 'item'}-label`" :item="item" :active="index === items!.length - 1" :index="index">
46
+ <span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="style.linkLabel({ class: props.ui?.linkLabel })" data-part="link-label">
47
+ <slot :name="`${item.slot || 'item'}-label`" :item="item" :active="index === items.length - 1" :index="index">
90
48
  {{ get(item, props.labelKey) }}
91
49
  </slot>
92
50
  </span>
93
51
 
94
- <slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="index === items!.length - 1" :index="index"></slot>
52
+ <slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="index === items.length - 1" :index="index"></slot>
95
53
  </slot>
96
54
  </LinkBase>
97
55
  </Link>
98
56
  </li>
99
57
 
100
- <li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="style.separator({ class: props.ui?.separator })">
58
+ <li v-if="index < items.length - 1" role="presentation" aria-hidden="true" :class="style.separator({ class: props.ui?.separator })" data-part="separator">
101
59
  <slot name="separator">
102
- <span :class="style.separatorIcon({ class: [separatorIcon, props.ui?.separatorIcon] })"></span>
60
+ <span :class="style.separatorIcon({ class: [separatorIcon, props.ui?.separatorIcon] })" data-part="separator-icon"></span>
103
61
  </slot>
104
62
  </li>
105
63
  </template>
@@ -0,0 +1,52 @@
1
+ import type { PrimitiveProps } from 'reka-ui';
2
+ import type { breadcrumb } from '../theme/index.js';
3
+ import type { ComponentAttrs, DynamicSlots, LinkProps } from '../types/index.js';
4
+ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
5
+ label?: string;
6
+ icon?: string;
7
+ slot?: string;
8
+ [key: string]: any;
9
+ }
10
+ type SlotProps<T extends BreadcrumbItem> = (props: {
11
+ item: T;
12
+ index: number;
13
+ active?: boolean;
14
+ }) => any;
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
+ export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> extends ComponentAttrs<typeof breadcrumb> {
23
+ /**
24
+ * The element or component this component should render as.
25
+ * @default "nav"
26
+ */
27
+ as?: PrimitiveProps['as'];
28
+ items?: T[];
29
+ /**
30
+ * The icon to use as a separator.
31
+ * @default app.icons.chevronRight
32
+ */
33
+ separatorIcon?: string;
34
+ /**
35
+ * The key used to get the label from the item.
36
+ * @default "label"
37
+ */
38
+ labelKey?: string;
39
+ }
40
+ declare const _default: <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<{
41
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & BreadcrumbProps<T> & Partial<{}>> & import("vue").PublicProps;
42
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
43
+ attrs: any;
44
+ slots: BreadcrumbSlots<T>;
45
+ emit: {};
46
+ }>) => import("vue").VNode & {
47
+ __ctx?: Awaited<typeof __VLS_setup>;
48
+ };
49
+ export default _default;
50
+ type __VLS_PrettifyLocal<T> = {
51
+ [K in keyof T]: T[K];
52
+ } & {};