@byyuurin/ui 0.0.10 → 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 (194) hide show
  1. package/README.md +2 -2
  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 +388 -364
  6. package/dist/runtime/components/Accordion.vue +38 -67
  7. package/dist/runtime/components/Accordion.vue.d.ts +52 -0
  8. package/dist/runtime/components/Alert.vue +37 -75
  9. package/dist/runtime/components/Alert.vue.d.ts +59 -0
  10. package/dist/runtime/components/App.vue +25 -40
  11. package/dist/runtime/components/App.vue.d.ts +24 -0
  12. package/dist/runtime/components/Avatar.vue +31 -51
  13. package/dist/runtime/components/Avatar.vue.d.ts +25 -0
  14. package/dist/runtime/components/AvatarGroup.vue +38 -69
  15. package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
  16. package/dist/runtime/components/Badge.vue +25 -51
  17. package/dist/runtime/components/Badge.vue.d.ts +44 -0
  18. package/dist/runtime/components/Breadcrumb.vue +36 -74
  19. package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
  20. package/dist/runtime/components/Button.vue +62 -51
  21. package/dist/runtime/components/Button.vue.d.ts +29 -0
  22. package/dist/runtime/components/ButtonGroup.vue +17 -37
  23. package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
  24. package/dist/runtime/components/Calendar.vue +75 -110
  25. package/dist/runtime/components/Calendar.vue.d.ts +75 -0
  26. package/dist/runtime/components/Card.vue +25 -42
  27. package/dist/runtime/components/Card.vue.d.ts +30 -0
  28. package/dist/runtime/components/Carousel.vue +118 -225
  29. package/dist/runtime/components/Carousel.vue.d.ts +104 -0
  30. package/dist/runtime/components/Checkbox.vue +46 -73
  31. package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
  32. package/dist/runtime/components/Chip.vue +31 -48
  33. package/dist/runtime/components/Chip.vue.d.ts +30 -0
  34. package/dist/runtime/components/Collapsible.vue +22 -30
  35. package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
  36. package/dist/runtime/components/Drawer.vue +51 -101
  37. package/dist/runtime/components/Drawer.vue.d.ts +80 -0
  38. package/dist/runtime/components/DropdownMenu.vue +37 -115
  39. package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
  40. package/dist/runtime/components/DropdownMenuContent.vue +81 -77
  41. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
  42. package/dist/runtime/components/Form.vue +140 -254
  43. package/dist/runtime/components/Form.vue.d.ts +78 -0
  44. package/dist/runtime/components/FormItem.vue +50 -89
  45. package/dist/runtime/components/FormItem.vue.d.ts +60 -0
  46. package/dist/runtime/components/Input.vue +79 -115
  47. package/dist/runtime/components/Input.vue.d.ts +64 -0
  48. package/dist/runtime/components/InputNumber.vue +74 -117
  49. package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
  50. package/dist/runtime/components/Kbd.vue +18 -39
  51. package/dist/runtime/components/Kbd.vue.d.ts +28 -0
  52. package/dist/runtime/components/Link.vue +168 -257
  53. package/dist/runtime/components/Link.vue.d.ts +95 -0
  54. package/dist/runtime/components/LinkBase.vue +36 -54
  55. package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
  56. package/dist/runtime/components/Modal.vue +49 -84
  57. package/dist/runtime/components/Modal.vue.d.ts +66 -0
  58. package/dist/runtime/components/OverlayProvider.vue +10 -14
  59. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  60. package/dist/runtime/components/Pagination.vue +55 -121
  61. package/dist/runtime/components/Pagination.vue.d.ts +93 -0
  62. package/dist/runtime/components/PinInput.vue +49 -58
  63. package/dist/runtime/components/PinInput.vue.d.ts +35 -0
  64. package/dist/runtime/components/Popover.vue +39 -68
  65. package/dist/runtime/components/Popover.vue.d.ts +45 -0
  66. package/dist/runtime/components/Progress.vue +68 -120
  67. package/dist/runtime/components/Progress.vue.d.ts +54 -0
  68. package/dist/runtime/components/RadioGroup.vue +67 -125
  69. package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
  70. package/dist/runtime/components/ScrollArea.vue +31 -31
  71. package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
  72. package/dist/runtime/components/Select.vue +114 -204
  73. package/dist/runtime/components/Select.vue.d.ts +119 -0
  74. package/dist/runtime/components/Separator.vue +26 -44
  75. package/dist/runtime/components/Separator.vue.d.ts +27 -0
  76. package/dist/runtime/components/Skeleton.vue +12 -21
  77. package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
  78. package/dist/runtime/components/Slider.vue +52 -74
  79. package/dist/runtime/components/Slider.vue.d.ts +36 -0
  80. package/dist/runtime/components/Switch.vue +51 -71
  81. package/dist/runtime/components/Switch.vue.d.ts +49 -0
  82. package/dist/runtime/components/Table.vue +108 -194
  83. package/dist/runtime/components/Table.vue.d.ts +148 -0
  84. package/dist/runtime/components/Tabs.vue +36 -81
  85. package/dist/runtime/components/Tabs.vue.d.ts +65 -0
  86. package/dist/runtime/components/Textarea.vue +77 -124
  87. package/dist/runtime/components/Textarea.vue.d.ts +60 -0
  88. package/dist/runtime/components/Toast.vue +47 -75
  89. package/dist/runtime/components/Toast.vue.d.ts +131 -0
  90. package/dist/runtime/components/ToastProvider.vue +65 -101
  91. package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
  92. package/dist/runtime/components/Tooltip.vue +36 -47
  93. package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
  94. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  95. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  96. package/dist/runtime/composables/useFormItem.d.ts +2 -2
  97. package/dist/runtime/composables/useKbd.d.ts +1 -1
  98. package/dist/runtime/composables/useLocale.d.ts +3 -3
  99. package/dist/runtime/composables/useTheme.d.ts +1 -1
  100. package/dist/runtime/composables/useToast.d.ts +1 -1
  101. package/dist/runtime/locale/en.d.ts +1 -1
  102. package/dist/runtime/locale/zh-tw.d.ts +1 -1
  103. package/dist/runtime/theme/accordion.d.ts +45 -51
  104. package/dist/runtime/theme/accordion.js +1 -1
  105. package/dist/runtime/theme/alert.d.ts +115 -121
  106. package/dist/runtime/theme/alert.js +1 -1
  107. package/dist/runtime/theme/avatar-group.d.ts +42 -48
  108. package/dist/runtime/theme/avatar-group.js +1 -1
  109. package/dist/runtime/theme/avatar.d.ts +46 -52
  110. package/dist/runtime/theme/avatar.js +1 -1
  111. package/dist/runtime/theme/badge.d.ts +60 -66
  112. package/dist/runtime/theme/badge.js +1 -1
  113. package/dist/runtime/theme/breadcrumb.d.ts +52 -58
  114. package/dist/runtime/theme/breadcrumb.js +1 -1
  115. package/dist/runtime/theme/button-group.d.ts +36 -42
  116. package/dist/runtime/theme/button.d.ts +162 -168
  117. package/dist/runtime/theme/button.js +1 -1
  118. package/dist/runtime/theme/calendar.d.ts +52 -50
  119. package/dist/runtime/theme/calendar.js +20 -3
  120. package/dist/runtime/theme/card.d.ts +52 -58
  121. package/dist/runtime/theme/card.js +1 -1
  122. package/dist/runtime/theme/carousel.d.ts +98 -104
  123. package/dist/runtime/theme/carousel.js +1 -1
  124. package/dist/runtime/theme/checkbox.d.ts +77 -83
  125. package/dist/runtime/theme/checkbox.js +1 -1
  126. package/dist/runtime/theme/chip.d.ts +50 -56
  127. package/dist/runtime/theme/chip.js +1 -1
  128. package/dist/runtime/theme/collapsible.d.ts +29 -35
  129. package/dist/runtime/theme/collapsible.js +1 -1
  130. package/dist/runtime/theme/drawer.d.ts +120 -126
  131. package/dist/runtime/theme/drawer.js +1 -1
  132. package/dist/runtime/theme/dropdown-menu.d.ts +55 -61
  133. package/dist/runtime/theme/dropdown-menu.js +1 -1
  134. package/dist/runtime/theme/form-item.d.ts +63 -69
  135. package/dist/runtime/theme/form-item.js +1 -1
  136. package/dist/runtime/theme/form.d.ts +1 -7
  137. package/dist/runtime/theme/input-number.d.ts +98 -104
  138. package/dist/runtime/theme/input-number.js +1 -1
  139. package/dist/runtime/theme/input.d.ts +153 -159
  140. package/dist/runtime/theme/input.js +1 -1
  141. package/dist/runtime/theme/kbd.d.ts +30 -36
  142. package/dist/runtime/theme/link.d.ts +37 -43
  143. package/dist/runtime/theme/modal.d.ts +36 -42
  144. package/dist/runtime/theme/modal.js +1 -1
  145. package/dist/runtime/theme/pagination.d.ts +71 -77
  146. package/dist/runtime/theme/pagination.js +1 -1
  147. package/dist/runtime/theme/pinInput.d.ts +80 -86
  148. package/dist/runtime/theme/pinInput.js +1 -1
  149. package/dist/runtime/theme/popover.d.ts +29 -35
  150. package/dist/runtime/theme/popover.js +1 -1
  151. package/dist/runtime/theme/progress.d.ts +163 -169
  152. package/dist/runtime/theme/progress.js +1 -1
  153. package/dist/runtime/theme/radio-group.d.ts +99 -105
  154. package/dist/runtime/theme/radio-group.js +1 -1
  155. package/dist/runtime/theme/scroll-area.d.ts +62 -68
  156. package/dist/runtime/theme/scroll-area.js +1 -1
  157. package/dist/runtime/theme/select.d.ts +165 -171
  158. package/dist/runtime/theme/select.js +1 -1
  159. package/dist/runtime/theme/separator.d.ts +62 -68
  160. package/dist/runtime/theme/separator.js +1 -1
  161. package/dist/runtime/theme/skeleton.d.ts +1 -7
  162. package/dist/runtime/theme/slider.d.ts +62 -68
  163. package/dist/runtime/theme/slider.js +1 -1
  164. package/dist/runtime/theme/switch.d.ts +111 -117
  165. package/dist/runtime/theme/switch.js +1 -1
  166. package/dist/runtime/theme/table.d.ts +75 -81
  167. package/dist/runtime/theme/table.js +1 -1
  168. package/dist/runtime/theme/tabs.d.ts +114 -120
  169. package/dist/runtime/theme/tabs.js +1 -1
  170. package/dist/runtime/theme/textarea.d.ts +76 -82
  171. package/dist/runtime/theme/textarea.js +1 -1
  172. package/dist/runtime/theme/toast-provider.d.ts +106 -112
  173. package/dist/runtime/theme/toast-provider.js +1 -1
  174. package/dist/runtime/theme/toast.d.ts +74 -80
  175. package/dist/runtime/theme/toast.js +1 -1
  176. package/dist/runtime/theme/tooltip.d.ts +35 -41
  177. package/dist/runtime/theme/tooltip.js +1 -1
  178. package/dist/runtime/types/utils.d.ts +5 -5
  179. package/dist/runtime/utils/link.d.ts +3 -5
  180. package/dist/runtime/utils/styler.d.ts +2 -2
  181. package/dist/runtime/utils/styler.js +2 -2
  182. package/dist/shared/ui.D1BTWZFB.mjs +5 -0
  183. package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
  184. package/dist/types.d.mts +1 -1
  185. package/dist/unocss.mjs +5 -4
  186. package/dist/unocss.mjs.map +1 -1
  187. package/dist/unplugin.mjs +1 -1
  188. package/dist/unplugin.mjs.map +1 -1
  189. package/dist/vite.mjs +1 -1
  190. package/package.json +77 -75
  191. package/dist/module.cjs +0 -5
  192. package/dist/shared/ui.3e7fad19.mjs +0 -5
  193. package/dist/shared/ui.3e7fad19.mjs.map +0 -1
  194. package/dist/types.d.ts +0 -1
@@ -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
- '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
- }
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,101 +1,63 @@
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'
1
+ <script>
5
2
 
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
- }
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 { 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));
65
26
  </script>
66
27
 
67
28
  <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 })">
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">
70
31
  <template v-for="(item, index) in props.items" :key="index">
71
- <li :class="style.item({ class: props.ui?.item })">
32
+ <li :class="style.item({ class: props.ui?.item })" data-part="item">
72
33
  <Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
73
34
  <LinkBase
74
35
  v-bind="slotProps"
75
36
  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 })"
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"
78
40
  >
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>
41
+ <slot :name="item.slot || 'item'" :item="item" :index="index">
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>
82
44
  </slot>
83
45
 
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">
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">
86
48
  {{ get(item, props.labelKey) }}
87
49
  </slot>
88
50
  </span>
89
51
 
90
- <slot :name="(`${item.slot || 'item'}-trailing` as keyof BreadcrumbSlots<T>)" :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>
91
53
  </slot>
92
54
  </LinkBase>
93
55
  </Link>
94
56
  </li>
95
57
 
96
- <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">
97
59
  <slot name="separator">
98
- <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>
99
61
  </slot>
100
62
  </li>
101
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
+ } & {};
@@ -1,55 +1,62 @@
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'
1
+ <script>
7
2
 
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
- }
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 } from "vue";
8
+ import { useButtonGroup } from "../composables/useButtonGroup";
9
+ import { useComponentIcons } from "../composables/useComponentIcons";
10
+ import { useTheme } from "../composables/useTheme";
11
+ import { omit, pickLinkProps } from "../utils";
12
+ import Link from "./Link.vue";
13
+ const props = defineProps({
14
+ icon: { type: String, required: false },
15
+ label: { type: String, required: false },
16
+ variant: { type: null, required: false, default: "solid" },
17
+ size: { type: null, required: false },
18
+ loading: { type: Boolean, required: false },
19
+ active: { type: Boolean, required: false },
20
+ disabled: { type: Boolean, required: false },
21
+ class: { type: null, required: false },
22
+ ui: { type: null, required: false },
23
+ leading: { type: Boolean, required: false },
24
+ leadingIcon: { type: String, required: false },
25
+ trailing: { type: Boolean, required: false },
26
+ trailingIcon: { type: String, required: false },
27
+ loadingIcon: { type: String, required: false },
28
+ as: { type: null, required: false },
29
+ type: { type: null, required: false },
30
+ exact: { type: Boolean, required: false },
31
+ exactQuery: { type: [Boolean, String], required: false },
32
+ exactHash: { type: Boolean, required: false },
33
+ inactiveClass: { type: String, required: false },
34
+ disableClass: { type: String, required: false },
35
+ to: { type: null, required: false },
36
+ href: { type: null, required: false },
37
+ external: { type: Boolean, required: false },
38
+ target: { type: [String, Object, null], required: false },
39
+ rel: { type: [String, Object, null], required: false },
40
+ noRel: { type: Boolean, required: false },
41
+ prefetchedClass: { type: String, required: false },
42
+ prefetch: { type: Boolean, required: false },
43
+ prefetchOn: { type: [String, Object], required: false },
44
+ noPrefetch: { type: Boolean, required: false },
45
+ activeClass: { type: String, required: false },
46
+ exactActiveClass: { type: String, required: false },
47
+ ariaCurrentValue: { type: String, required: false },
48
+ viewTransition: { type: Boolean, required: false },
49
+ replace: { type: Boolean, required: false }
50
+ });
51
+ const slots = defineSlots();
52
+ const { size, orientation } = useButtonGroup(props);
43
53
  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
-
54
+ computed(() => ({ ...props, loading: props.loading }))
55
+ );
56
+ const linkProps = useForwardProps(pickLinkProps(props));
57
+ const { generateStyle } = useTheme();
51
58
  const style = computed(() => {
52
- return generateStyle('button', {
59
+ return generateStyle("button", {
53
60
  ...props,
54
61
  size: size.value,
55
62
  groupOrientation: orientation.value,
@@ -58,10 +65,10 @@ const style = computed(() => {
58
65
  class: [
59
66
  props.class,
60
67
  props.active ? props.activeClass : props.inactiveClass,
61
- props.disabled ? props.disableClass : undefined,
62
- ],
63
- })
64
- })
68
+ props.disabled ? props.disableClass : void 0
69
+ ]
70
+ });
71
+ });
65
72
  </script>
66
73
 
67
74
  <template>
@@ -70,17 +77,20 @@ const style = computed(() => {
70
77
  :type="props.type"
71
78
  :disabled="props.disabled || props.loading"
72
79
  v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
80
+ data-part="base"
73
81
  raw
74
82
  >
75
83
  <slot name="leading">
76
84
  <span
77
85
  v-if="isLeading && leadingIconName"
78
86
  :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"
87
+ data-part="leading-icon"
79
88
  ></span>
80
89
  </slot>
81
90
  <span
82
91
  v-if="props.label || slots.default"
83
92
  :class="style.label({ class: props.ui?.label })"
93
+ data-part="label"
84
94
  >
85
95
  <slot>{{ label }}</slot>
86
96
  </span>
@@ -88,6 +98,7 @@ const style = computed(() => {
88
98
  <span
89
99
  v-if="isTrailing && trailingIconName"
90
100
  :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"
101
+ data-part="trailing-icon"
91
102
  ></span>
92
103
  </slot>
93
104
  </Link>