@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,67 +1,36 @@
1
- <script lang="ts">
2
- import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
3
- import type { accordion } from '../theme'
4
- import type { ComponentAttrs, DynamicSlots } from '../types'
1
+ <script>
5
2
 
6
- export interface AccordionEmits extends AccordionRootEmits {}
7
-
8
- export interface AccordionItem {
9
- label?: string
10
- icon?: string
11
- trailingIcon?: string
12
- slot?: string
13
- content?: string
14
- /** A unique value for the accordion item. Defaults to the index. */
15
- value?: string
16
- disabled?: boolean
17
- [key: string]: any
18
- }
19
-
20
- type SlotProps<T extends AccordionItem> = (props: { item: T, index: number, open: boolean }) => any
21
-
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
-
30
- export interface AccordionProps<T extends AccordionItem = AccordionItem> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
31
- items?: T[]
32
- /**
33
- * The icon displayed on the right side of the trigger.
34
- * @default app.icons.chevronDown
35
- */
36
- trailingIcon?: string
37
- labelKey?: string
38
- }
39
3
  </script>
40
4
 
41
- <script setup lang="ts" generic="T extends AccordionItem">
42
- import { reactivePick } from '@vueuse/core'
43
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from 'reka-ui'
44
- import { computed } from 'vue'
45
- import { useTheme } from '../composables/useTheme'
46
- import { get } from '../utils'
47
-
48
- const props = withDefaults(defineProps<AccordionProps<T>>(), {
49
- type: 'single',
50
- collapsible: true,
51
- unmountOnHide: true,
52
- labelKey: 'label',
53
- })
54
-
55
- const emit = defineEmits<AccordionEmits>()
56
- const slots = defineSlots<AccordionSlots<T>>()
57
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
58
-
59
- const { theme, generateStyle } = useTheme()
60
- 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));
61
30
  </script>
62
31
 
63
32
  <template>
64
- <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">
65
34
  <AccordionItem
66
35
  v-for="(item, index) in props.items"
67
36
  v-slot="{ open }"
@@ -69,30 +38,32 @@ const style = computed(() => generateStyle('accordion', props))
69
38
  :value="item.value || String(index)"
70
39
  :disabled="item.disabled"
71
40
  :class="style.item({ class: props.ui?.item })"
41
+ data-part="item"
72
42
  >
73
- <AccordionHeader :class="style.header({ class: props.ui?.header })">
74
- <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">
75
45
  <slot name="leading" v-bind="{ item, index, open }">
76
- <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>
77
47
  </slot>
78
48
 
79
- <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">
80
50
  <slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
81
51
  </span>
82
52
 
83
53
  <slot name="trailing" v-bind="{ item, index, open }">
84
- <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>
85
55
  </slot>
86
56
  </AccordionTrigger>
87
57
  </AccordionHeader>
88
58
 
89
59
  <AccordionContent
90
- v-if="item.content || slots.content || (item.slot && slots[item.slot as keyof AccordionSlots<T>]) || slots.body || (item.slot && slots[`${item.slot}-body` as keyof AccordionSlots<T>])"
60
+ v-if="item.content || slots.content || item.slot && slots[item.slot] || slots.body || item.slot && slots[`${item.slot}-body`]"
91
61
  :class="style.content({ class: props.ui?.content })"
62
+ data-part="content"
92
63
  >
93
- <slot :name="((item.slot || 'content') as keyof AccordionSlots<T>)" v-bind="{ item, index, open }">
94
- <div :class="style.body({ class: props.ui?.body })">
95
- <slot :name="((item.slot ? `${item.slot}-body` : 'body') as keyof AccordionSlots<T>)" v-bind="{ item, index, open }">
64
+ <slot :name="item.slot || 'content'" v-bind="{ item, index, open }">
65
+ <div :class="style.body({ class: props.ui?.body })" data-part="body">
66
+ <slot :name="item.slot ? `${item.slot}-body` : 'body'" v-bind="{ item, index, open }">
96
67
  {{ item.content }}
97
68
  </slot>
98
69
  </div>
@@ -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
- 'update:open': [value: boolean]
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>
@@ -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;