@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
@@ -9,6 +9,41 @@ export const {
9
9
  inject: injectButtonGroup,
10
10
  provide: provideButtonGroup
11
11
  } = defineInjection("ui.button-group");
12
+ export const {
13
+ InjectionKey: InjectionKeyFormOptions,
14
+ inject: injectFormOptions,
15
+ provide: provideFormOptions
16
+ } = defineInjection("ui.form-options");
17
+ export const {
18
+ InjectionKey: InjectionKeyFormBus,
19
+ inject: injectFormBus,
20
+ provide: provideFormBus
21
+ } = defineInjection("ui.form-bus");
22
+ export const {
23
+ InjectionKey: InjectionKeyFormItem,
24
+ inject: injectFormItem,
25
+ provide: provideFormItem
26
+ } = defineInjection("ui.form-item");
27
+ export const {
28
+ InjectionKey: InjectionKeyFormInputId,
29
+ inject: injectFormInputId,
30
+ provide: provideFormInputId
31
+ } = defineInjection("ui.form-input-id");
32
+ export const {
33
+ InjectionKey: InjectionKeyFormInputs,
34
+ inject: injectFormInputs,
35
+ provide: provideFormInputs
36
+ } = defineInjection("ui.form-inputs");
37
+ export const {
38
+ InjectionKey: InjectionKeyFormLoading,
39
+ inject: injectFormLoading,
40
+ provide: provideFormLoading
41
+ } = defineInjection("ui.form-loading");
42
+ export const {
43
+ InjectionKey: InjectionKeyFormErrors,
44
+ inject: injectFormErrors,
45
+ provide: provideFormErrors
46
+ } = defineInjection("ui.form-errors", null);
12
47
  export const {
13
48
  InjectionKey: InjectionKeyLocaleContext,
14
49
  inject: injectLocaleContext,
@@ -1,71 +1,36 @@
1
- <script lang="ts">
2
- import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
3
- import type { accordion } from '../theme'
4
- import type { ComponentAttrs } from '../types'
1
+ <script>
5
2
 
6
- export interface AccordionEmits extends AccordionRootEmits {}
7
-
8
- type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
9
-
10
- type DynamicSlots<T extends { slot?: string }, SlotProps, Slot = T['slot']> =
11
- Slot extends string
12
- ? Record<Slot | `${Slot}-body`, SlotProps>
13
- : Record<string, never>
14
-
15
- export type AccordionSlots<T extends { slot?: string }> = {
16
- default?: SlotProps<T>
17
- leading?: SlotProps<T>
18
- trailing?: SlotProps<T>
19
- content?: SlotProps<T>
20
- body?: SlotProps<T>
21
- } & DynamicSlots<T, SlotProps<T>>
22
-
23
- export interface AccordionItem {
24
- label?: string
25
- icon?: string
26
- trailingIcon?: string
27
- slot?: string
28
- content?: string
29
- /** A unique value for the accordion item. Defaults to the index. */
30
- value?: string
31
- disabled?: boolean
32
- }
33
-
34
- export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
35
- items?: T[]
36
- /**
37
- * The icon displayed on the right side of the trigger.
38
- * @default app.icons.chevronDown
39
- */
40
- trailingIcon?: string
41
- labelKey?: string
42
- }
43
3
  </script>
44
4
 
45
- <script setup lang="ts" generic="T extends AccordionItem">
46
- import { reactivePick } from '@vueuse/core'
47
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from 'reka-ui'
48
- import { computed } from 'vue'
49
- import { useTheme } from '../composables/useTheme'
50
- import { get } from '../utils'
51
-
52
- const props = withDefaults(defineProps<AccordionProps<T>>(), {
53
- type: 'single',
54
- collapsible: true,
55
- unmountOnHide: true,
56
- labelKey: 'label',
57
- })
58
-
59
- const emit = defineEmits<AccordionEmits>()
60
- const slots = defineSlots<AccordionSlots<T>>()
61
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
62
-
63
- const { theme, generateStyle } = useTheme()
64
- const style = computed(() => generateStyle('accordion', props))
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from "reka-ui";
8
+ import { computed } from "vue";
9
+ import { useTheme } from "../composables/useTheme";
10
+ import { get } from "../utils";
11
+ const props = defineProps({
12
+ items: { type: Array, required: false },
13
+ trailingIcon: { type: String, required: false },
14
+ labelKey: { type: String, required: false, default: "label" },
15
+ class: { type: null, required: false },
16
+ ui: { type: null, required: false },
17
+ as: { type: null, required: false },
18
+ collapsible: { type: Boolean, required: false, default: true },
19
+ defaultValue: { type: null, required: false },
20
+ modelValue: { type: null, required: false },
21
+ type: { type: String, required: false, default: "single" },
22
+ disabled: { type: Boolean, required: false },
23
+ unmountOnHide: { type: Boolean, required: false, default: true }
24
+ });
25
+ const emit = defineEmits(["update:modelValue"]);
26
+ const slots = defineSlots();
27
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "collapsible", "defaultValue", "disabled", "modelValue", "type", "unmountOnHide"), emit);
28
+ const { theme, generateStyle } = useTheme();
29
+ const style = computed(() => generateStyle("accordion", props));
65
30
  </script>
66
31
 
67
32
  <template>
68
- <AccordionRoot v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
33
+ <AccordionRoot v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
69
34
  <AccordionItem
70
35
  v-for="(item, index) in props.items"
71
36
  v-slot="{ open }"
@@ -73,29 +38,31 @@ const style = computed(() => generateStyle('accordion', props))
73
38
  :value="item.value || String(index)"
74
39
  :disabled="item.disabled"
75
40
  :class="style.item({ class: props.ui?.item })"
41
+ data-part="item"
76
42
  >
77
- <AccordionHeader :class="style.header({ class: props.ui?.header })">
78
- <AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
43
+ <AccordionHeader :class="style.header({ class: props.ui?.header })" data-part="header">
44
+ <AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })" data-part="trigger">
79
45
  <slot name="leading" v-bind="{ item, index, open }">
80
- <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></span>
46
+ <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })" data-part="leading-icon"></span>
81
47
  </slot>
82
48
 
83
- <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
49
+ <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })" data-part="label">
84
50
  <slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
85
51
  </span>
86
52
 
87
53
  <slot name="trailing" v-bind="{ item, index, open }">
88
- <span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })"></span>
54
+ <span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })" data-part="trailing-icon"></span>
89
55
  </slot>
90
56
  </AccordionTrigger>
91
57
  </AccordionHeader>
92
58
 
93
59
  <AccordionContent
94
- v-if="item.content || slots.content || (item.slot && slots[item.slot]) || slots.body || (item.slot && slots[`${item.slot}-body`])"
60
+ v-if="item.content || slots.content || item.slot && slots[item.slot] || slots.body || item.slot && slots[`${item.slot}-body`]"
95
61
  :class="style.content({ class: props.ui?.content })"
62
+ data-part="content"
96
63
  >
97
64
  <slot :name="item.slot || 'content'" v-bind="{ item, index, open }">
98
- <div :class="style.body({ class: props.ui?.body })">
65
+ <div :class="style.body({ class: props.ui?.body })" data-part="body">
99
66
  <slot :name="item.slot ? `${item.slot}-body` : 'body'" v-bind="{ item, index, open }">
100
67
  {{ item.content }}
101
68
  </slot>
@@ -0,0 +1,52 @@
1
+ import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui';
2
+ import type { accordion } from '../theme/index.js';
3
+ import type { ComponentAttrs, DynamicSlots } from '../types/index.js';
4
+ export interface AccordionEmits extends AccordionRootEmits {
5
+ }
6
+ export interface AccordionItem {
7
+ label?: string;
8
+ icon?: string;
9
+ trailingIcon?: string;
10
+ slot?: string;
11
+ content?: string;
12
+ /** A unique value for the accordion item. Defaults to the index. */
13
+ value?: string;
14
+ disabled?: boolean;
15
+ [key: string]: any;
16
+ }
17
+ type SlotProps<T extends AccordionItem> = (props: {
18
+ item: T;
19
+ index: number;
20
+ open: boolean;
21
+ }) => any;
22
+ export type AccordionSlots<T extends AccordionItem = AccordionItem> = {
23
+ default?: SlotProps<T>;
24
+ leading?: SlotProps<T>;
25
+ trailing?: SlotProps<T>;
26
+ content?: SlotProps<T>;
27
+ body?: SlotProps<T>;
28
+ } & DynamicSlots<T, 'body', SlotProps<T>>;
29
+ export interface AccordionProps<T extends AccordionItem = AccordionItem> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
30
+ items?: T[];
31
+ /**
32
+ * The icon displayed on the right side of the trigger.
33
+ * @default app.icons.chevronDown
34
+ */
35
+ trailingIcon?: string;
36
+ labelKey?: string;
37
+ }
38
+ declare const _default: <T extends AccordionItem>(__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<{
39
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
40
+ readonly "onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
41
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & AccordionProps<T> & Partial<{}>> & import("vue").PublicProps;
42
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
43
+ attrs: any;
44
+ slots: AccordionSlots<T>;
45
+ emit: (evt: "update:modelValue", value: string | string[] | undefined) => void;
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,106 +1,67 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps } from 'reka-ui'
4
- import type { alert } from '../theme'
5
- import type { ButtonProps, ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface AlertEmits {
8
- (event: 'update:open', value: boolean): void
9
- }
10
-
11
- export interface AlertSlots {
12
- leading?: (props?: {}) => any
13
- title?: (props?: {}) => any
14
- description?: (props?: {}) => any
15
- actions?: (props?: {}) => any
16
- close?: (props: { ui: ComponentAttrs<typeof alert>['ui'] }) => any
17
- }
18
-
19
- type AlertVariants = VariantProps<typeof alert>
20
-
21
- export interface AlertProps extends ComponentAttrs<typeof alert> {
22
- /**
23
- * The element or component this component should render as.
24
- * @default "div"
25
- */
26
- as?: PrimitiveProps['as']
27
- title?: string
28
- description?: string
29
- icon?: string
30
- variant?: AlertVariants['variant']
31
- orientation?: AlertVariants['orientation']
32
- /**
33
- * Display a list of actions:
34
- * - under the title and description when orientation is `vertical`
35
- * - next to the close button when orientation is `horizontal`
36
- */
37
- actions?: ButtonProps[]
38
- /**
39
- * Display a close button to dismiss the alert.
40
- * @default false
41
- */
42
- close?: ButtonProps | boolean
43
- /**
44
- * The icon displayed in the close button.
45
- * @default app.icons.close
46
- */
47
- closeIcon?: string
48
- }
49
3
  </script>
50
4
 
51
- <script setup lang="ts">
52
- import { Primitive } from 'reka-ui'
53
- import { computed } from 'vue'
54
- import { useLocale } from '../composables/useLocale'
55
- import { useTheme } from '../composables/useTheme'
56
- import Button from './Button.vue'
57
-
58
- const props = withDefaults(defineProps<AlertProps>(), {
59
- variant: 'solid',
60
- orientation: 'vertical',
61
- })
62
-
63
- const emit = defineEmits<AlertEmits>()
64
- const slots = defineSlots<AlertSlots>()
65
-
66
- const { t } = useLocale()
67
- const { theme, generateStyle } = useTheme()
68
- const style = computed(() => generateStyle('alert', {
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 Button from "./Button.vue";
11
+ const props = defineProps({
12
+ as: { type: null, required: false },
13
+ title: { type: String, required: false },
14
+ description: { type: String, required: false },
15
+ icon: { type: String, required: false },
16
+ variant: { type: null, required: false, default: "solid" },
17
+ orientation: { type: null, required: false, default: "vertical" },
18
+ actions: { type: Array, required: false },
19
+ close: { type: [Object, Boolean], required: false },
20
+ closeIcon: { type: String, required: false },
21
+ class: { type: null, required: false },
22
+ ui: { type: null, required: false }
23
+ });
24
+ const emit = defineEmits(["update:open"]);
25
+ const slots = defineSlots();
26
+ const { t } = useLocale();
27
+ const { theme, generateStyle } = useTheme();
28
+ const style = computed(() => generateStyle("alert", {
69
29
  ...props,
70
- title: !!props.title || !!slots.title,
71
- }))
30
+ title: !!props.title || !!slots.title
31
+ }));
72
32
  </script>
73
33
 
74
34
  <template>
75
35
  <Primitive
76
36
  :as="props.as"
77
- :data-orientation="props.orientation"
78
37
  :class="style.root({ class: [props.class, props.ui?.root] })"
38
+ :data-orientation="props.orientation"
39
+ data-part="root"
79
40
  >
80
41
  <slot name="leading">
81
- <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
42
+ <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })" data-part="icon"></span>
82
43
  </slot>
83
44
 
84
- <div :class="style.wrapper({ class: props.ui?.wrapper })">
85
- <div v-if="props.title || slots.title" :class="style.title({ class: props.ui?.title })">
45
+ <div :class="style.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
46
+ <div v-if="props.title || slots.title" :class="style.title({ class: props.ui?.title })" data-part="title">
86
47
  <slot name="title">
87
48
  {{ props.title }}
88
49
  </slot>
89
50
  </div>
90
- <div v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })">
51
+ <div v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })" data-part="description">
91
52
  <slot name="description">
92
53
  {{ props.description }}
93
54
  </slot>
94
55
  </div>
95
56
 
96
- <div v-if="props.orientation === 'vertical' && props.actions?.length" :class="style.actions({ class: props.ui?.actions })">
57
+ <div v-if="props.orientation === 'vertical' && props.actions?.length" :class="style.actions({ class: props.ui?.actions })" data-part="actions">
97
58
  <slot name="actions">
98
59
  <Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
99
60
  </slot>
100
61
  </div>
101
62
  </div>
102
63
 
103
- <div v-if="(props.orientation === 'horizontal' && props.actions?.length) || props.close" :class="style.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
64
+ <div v-if="props.orientation === 'horizontal' && props.actions?.length || props.close" :class="style.actions({ class: props.ui?.actions, orientation: 'horizontal' })" data-part="actions">
104
65
  <template v-if="props.orientation === 'horizontal' && props.actions?.length">
105
66
  <slot name="actions">
106
67
  <Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
@@ -114,8 +75,9 @@ const style = computed(() => generateStyle('alert', {
114
75
  size="md"
115
76
  variant="link"
116
77
  :aria-label="t('alert.close')"
117
- v-bind="typeof props.close === 'object' ? props.close : undefined"
78
+ v-bind="typeof props.close === 'object' ? props.close : void 0"
118
79
  :class="style.close({ class: props.ui?.close })"
80
+ data-part="close"
119
81
  @click="emit('update:open', false)"
120
82
  />
121
83
  </slot>
@@ -0,0 +1,59 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { alert } from '../theme/index.js';
4
+ import type { ButtonProps, ComponentAttrs } from '../types/index.js';
5
+ export interface AlertEmits {
6
+ 'update:open': [value: boolean];
7
+ }
8
+ export interface AlertSlots {
9
+ leading?: (props?: {}) => any;
10
+ title?: (props?: {}) => any;
11
+ description?: (props?: {}) => any;
12
+ actions?: (props?: {}) => any;
13
+ close?: (props: {
14
+ ui: ComponentAttrs<typeof alert>['ui'];
15
+ }) => any;
16
+ }
17
+ type AlertVariants = VariantProps<typeof alert>;
18
+ export interface AlertProps extends ComponentAttrs<typeof alert> {
19
+ /**
20
+ * The element or component this component should render as.
21
+ * @default "div"
22
+ */
23
+ as?: PrimitiveProps['as'];
24
+ title?: string;
25
+ description?: string;
26
+ icon?: string;
27
+ variant?: AlertVariants['variant'];
28
+ orientation?: AlertVariants['orientation'];
29
+ /**
30
+ * Display a list of actions:
31
+ * - under the title and description when orientation is `vertical`
32
+ * - next to the close button when orientation is `horizontal`
33
+ */
34
+ actions?: ButtonProps[];
35
+ /**
36
+ * Display a close button to dismiss the alert.
37
+ * @default false
38
+ */
39
+ close?: ButtonProps | boolean;
40
+ /**
41
+ * The icon displayed in the close button.
42
+ * @default app.icons.close
43
+ */
44
+ closeIcon?: string;
45
+ }
46
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
47
+ "update:open": (value: boolean) => any;
48
+ }, string, import("vue").PublicProps, Readonly<AlertProps> & Readonly<{
49
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
50
+ }>, {
51
+ variant: "solid" | "outline" | "soft" | "soft-outline";
52
+ orientation: "horizontal" | "vertical";
53
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AlertSlots>;
54
+ export default _default;
55
+ type __VLS_WithSlots<T, S> = T & {
56
+ new (): {
57
+ $slots: S;
58
+ };
59
+ };
@@ -1,46 +1,31 @@
1
- <script lang="ts">
2
- import type { UserConfig } from '@unocss/core'
3
- import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
4
- import type { Messages, ThemeExtension, ToastProviderProps } from '../types'
5
- import type { Locale } from '../utils'
1
+ <script>
6
2
 
7
- export interface AppSlots {
8
- default: (props?: {}) => any
9
- }
10
-
11
- export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
12
- unoConfig?: UserConfig
13
- ui?: ThemeExtension
14
- toaster?: ToastProviderProps
15
- tooltip?: TooltipProviderProps
16
- locale?: Locale<Messages>
17
- }
18
3
  </script>
19
4
 
20
- <script setup lang="ts">
21
- import { reactivePick } from '@vueuse/core'
22
- import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
23
- import { toRef, useId } from 'vue'
24
- import { provideLocaleContext, provideThemeExtension, provideUnoConfig } from '../app/injections'
25
- import OverlayProvider from './OverlayProvider.vue'
26
- import ToastProvider from './ToastProvider.vue'
27
-
28
- const props = withDefaults(defineProps<AppProps>(), {
29
- unoConfig: () => ({}),
30
- ui: () => ({}),
31
- })
32
-
33
- defineSlots<AppSlots>()
34
-
35
- const configProviderProps = useForwardProps(reactivePick(props, 'scrollBody'))
36
- const tooltipProps = toRef(() => props.tooltip)
37
- const toastProviderProps = toRef(() => props.toaster)
38
-
39
- provideUnoConfig(() => props.unoConfig)
40
- provideThemeExtension(() => props.ui)
41
-
42
- const locale = toRef(() => props.locale)
43
- provideLocaleContext(locale)
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { ConfigProvider, TooltipProvider, useForwardProps } from "reka-ui";
8
+ import { toRef, useId } from "vue";
9
+ import { provideLocaleContext, provideThemeExtension, provideUnoConfig } from "../app/injections";
10
+ import OverlayProvider from "./OverlayProvider.vue";
11
+ import ToastProvider from "./ToastProvider.vue";
12
+ const props = defineProps({
13
+ unoConfig: { type: Object, required: false, default: () => ({}) },
14
+ ui: { type: null, required: false, default: () => ({}) },
15
+ toaster: { type: Object, required: false },
16
+ tooltip: { type: Object, required: false },
17
+ locale: { type: Object, required: false },
18
+ scrollBody: { type: [Boolean, Object], required: false },
19
+ nonce: { type: String, required: false }
20
+ });
21
+ defineSlots();
22
+ const configProviderProps = useForwardProps(reactivePick(props, "scrollBody"));
23
+ const tooltipProps = toRef(() => props.tooltip);
24
+ const toastProviderProps = toRef(() => props.toaster);
25
+ provideUnoConfig(() => props.unoConfig);
26
+ provideThemeExtension(() => props.ui);
27
+ const locale = toRef(() => props.locale);
28
+ provideLocaleContext(locale);
44
29
  </script>
45
30
 
46
31
  <template>
@@ -0,0 +1,24 @@
1
+ import type { UserConfig } from '@unocss/core';
2
+ import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui';
3
+ import type { Messages, ThemeExtension, ToastProviderProps } from '../types/index.js';
4
+ import type { Locale } from '../utils/index.js';
5
+ export interface AppSlots {
6
+ default: (props?: {}) => any;
7
+ }
8
+ export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
9
+ unoConfig?: UserConfig;
10
+ ui?: ThemeExtension;
11
+ toaster?: ToastProviderProps;
12
+ tooltip?: TooltipProviderProps;
13
+ locale?: Locale<Messages>;
14
+ }
15
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AppProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AppProps> & Readonly<{}>, {
16
+ ui: ThemeExtension;
17
+ unoConfig: UserConfig;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AppSlots>;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -1,70 +1,50 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { AvatarRootProps } from 'reka-ui'
4
- import type { avatar } from '../theme'
5
- import type { ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface AvatarSlots {
8
- default?: (props?: {}) => any
9
- }
10
-
11
- type AvatarVariants = VariantProps<typeof avatar>
12
-
13
- export interface AvatarProps extends ComponentAttrs<typeof avatar> {
14
- /**
15
- * The element or component this component should render as.
16
- * @default "span"
17
- */
18
- as?: AvatarRootProps['as']
19
- src?: string
20
- alt?: string
21
- icon?: string
22
- text?: string
23
- size?: AvatarVariants['size']
24
- style?: string | HTMLElement['style']
25
- }
26
3
  </script>
27
4
 
28
- <script setup lang="ts">
29
- import { AvatarFallback, AvatarImage, AvatarRoot } from 'reka-ui'
30
- import { computed, shallowRef, watch } from 'vue'
31
- import { useAvatarGroup } from '../composables/useAvatarGroup'
32
- import { useTheme } from '../composables/useTheme'
33
-
34
- defineOptions({ inheritAttrs: false })
35
-
36
- const props = withDefaults(defineProps<AvatarProps>(), {
37
- src: '',
38
- })
39
-
40
- const { size } = useAvatarGroup(props)
41
- const fallback = computed(() => props.text || (props.alt || '').split(' ').map((word) => word.charAt(0)).join('').slice(0, 2))
42
-
43
- const { generateStyle } = useTheme()
44
- const style = computed(() => generateStyle('avatar', {
5
+ <script setup>
6
+ import { AvatarFallback, AvatarImage, AvatarRoot } from "reka-ui";
7
+ import { computed, shallowRef, watch } from "vue";
8
+ import { useAvatarGroup } from "../composables/useAvatarGroup";
9
+ import { useTheme } from "../composables/useTheme";
10
+ defineOptions({ inheritAttrs: false });
11
+ const props = defineProps({
12
+ as: { type: null, required: false },
13
+ src: { type: String, required: false, default: "" },
14
+ alt: { type: String, required: false },
15
+ icon: { type: String, required: false },
16
+ text: { type: String, required: false },
17
+ size: { type: null, required: false },
18
+ style: { type: null, required: false },
19
+ class: { type: null, required: false },
20
+ ui: { type: null, required: false }
21
+ });
22
+ const { size } = useAvatarGroup(props);
23
+ const fallback = computed(() => props.text || (props.alt || "").split(" ").map((word) => word.charAt(0)).join("").slice(0, 2));
24
+ const { generateStyle } = useTheme();
25
+ const style = computed(() => generateStyle("avatar", {
45
26
  ...props,
46
- size: size.value,
47
- }))
48
-
49
- const error = shallowRef(false)
50
-
27
+ size: size.value
28
+ }));
29
+ const error = shallowRef(false);
51
30
  watch(() => props.src, () => {
52
31
  if (error.value)
53
- error.value = false
54
- })
32
+ error.value = false;
33
+ });
55
34
  </script>
56
35
 
57
36
  <template>
58
- <AvatarRoot :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" :style="props.style">
37
+ <AvatarRoot :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" :data-part="$attrs['data-part'] ?? 'root'" :style="props.style">
59
38
  <AvatarImage
60
39
  :src="props.src"
61
40
  :alt="props.alt"
62
41
  :class="style.image({ class: props.ui?.image })"
42
+ data-part="image"
63
43
  />
64
44
 
65
45
  <AvatarFallback as-child>
66
- <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
67
- <span v-else :class="style.fallback({ class: props.ui?.fallback })">{{ fallback || '&nbsp;' }}</span>
46
+ <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })" data-part="icon"></span>
47
+ <span v-else :class="style.fallback({ class: props.ui?.fallback })" data-part="fallback">{{ fallback || "\xA0" }}</span>
68
48
  </AvatarFallback>
69
49
  </AvatarRoot>
70
50
  </template>