@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
@@ -1,97 +1,75 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { CheckboxRootProps, PrimitiveProps } from 'reka-ui'
4
- import type { checkbox } from '../theme'
5
- import type { ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface CheckboxEmits {
8
- (event: 'change', payload: Event): void
9
- }
10
-
11
- export interface CheckboxSlots {
12
- label?: (props: { label?: string }) => any
13
- description?: (props: { description?: string }) => any
14
- }
15
-
16
- type CheckboxVariants = VariantProps<typeof checkbox>
17
-
18
- export interface CheckboxProps extends ComponentAttrs<typeof checkbox>, Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
19
- /**
20
- * The element or component this component should render as.
21
- * @default "div"
22
- */
23
- as?: PrimitiveProps['as']
24
- label?: string
25
- description?: string
26
- size?: CheckboxVariants['size']
27
- /**
28
- * The icon displayed when checked.
29
- * @default app.icons.check
30
- */
31
- icon?: string
32
- /**
33
- * The icon displayed when the checkbox is indeterminate.
34
- * @default app.icons.indeterminate
35
- */
36
- indeterminateIcon?: string
37
- }
38
3
  </script>
39
4
 
40
- <script lang="ts" setup>
41
- import { reactivePick } from '@vueuse/core'
42
- import { CheckboxIndicator, CheckboxRoot, Label, Primitive, useForwardProps } from 'reka-ui'
43
- import { computed, useId } from 'vue'
44
- import { useTheme } from '../composables/useTheme'
45
-
46
- const props = withDefaults(defineProps<CheckboxProps>(), {
47
- required: false,
48
- disabled: false,
49
- })
50
- const emit = defineEmits<CheckboxEmits>()
51
- const slots = defineSlots<CheckboxSlots>()
52
-
53
- const innerValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
54
- const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
55
-
56
- const id = props.id ?? useId()
57
-
58
- const { theme, generateStyle } = useTheme()
59
- const style = computed(() => generateStyle('checkbox', props))
60
-
61
- function onUpdate(value: any) {
62
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
63
- const event = new Event('change', { target: value })
64
- emit('change', event)
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { CheckboxIndicator, CheckboxRoot, Label, Primitive, useForwardProps } from "reka-ui";
8
+ import { computed, useId } from "vue";
9
+ import { useFormItem } from "../composables/useFormItem";
10
+ import { useTheme } from "../composables/useTheme";
11
+ const props = defineProps({
12
+ as: { type: null, required: false },
13
+ label: { type: String, required: false },
14
+ description: { type: String, required: false },
15
+ size: { type: null, required: false },
16
+ icon: { type: String, required: false },
17
+ indeterminateIcon: { type: String, required: false },
18
+ class: { type: null, required: false },
19
+ ui: { type: null, required: false },
20
+ disabled: { type: Boolean, required: false, default: false },
21
+ required: { type: Boolean, required: false, default: false },
22
+ name: { type: String, required: false },
23
+ value: { type: null, required: false },
24
+ id: { type: String, required: false },
25
+ defaultValue: { type: [Boolean, String], required: false }
26
+ });
27
+ const emit = defineEmits(["change"]);
28
+ const slots = defineSlots();
29
+ const innerValue = defineModel({ type: [Boolean, String], ...{ default: void 0 } });
30
+ const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
31
+ const { id: _id, size, name, disabled, ariaAttrs, emitFormChange, emitFormInput } = useFormItem(props);
32
+ const id = _id.value ?? useId();
33
+ const { theme, generateStyle } = useTheme();
34
+ const style = computed(() => generateStyle("checkbox", {
35
+ ...props,
36
+ size: size.value,
37
+ disabled: disabled.value
38
+ }));
39
+ function onUpdate(value) {
40
+ const event = new Event("change", { target: value });
41
+ emit("change", event);
42
+ emitFormChange();
43
+ emitFormInput();
65
44
  }
66
45
  </script>
67
46
 
68
47
  <template>
69
- <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
70
- <div :class="style.container({ class: props.ui?.container })">
48
+ <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
49
+ <div :class="style.container({ class: props.ui?.container })" data-part="container">
71
50
  <CheckboxRoot
72
- :id="id"
73
- v-bind="rootProps"
74
51
  v-slot="{ modelValue }"
52
+ v-bind="{ ...rootProps, ...ariaAttrs, id, name, disabled }"
75
53
  v-model="innerValue"
76
- :name="props.name"
77
- :disabled="props.disabled"
78
54
  :class="style.base({ class: props.ui?.base })"
55
+ data-part="base"
79
56
  @update:model-value="onUpdate"
80
57
  >
81
58
  <CheckboxIndicator as-child force-mount>
82
59
  <span
83
60
  v-if="modelValue === 'indeterminate'"
84
61
  :class="style.icon({ class: [props.indeterminateIcon || theme.app.icons.indeterminate, props.ui?.icon] })"
62
+ data-part="icon"
85
63
  ></span>
86
- <span v-else :class="style.icon({ class: [props.icon, theme.app.icons.check, props.ui?.icon] })"></span>
64
+ <span v-else :class="style.icon({ class: [props.icon, theme.app.icons.check, props.ui?.icon] })" data-part="icon"></span>
87
65
  </CheckboxIndicator>
88
66
  </CheckboxRoot>
89
67
  </div>
90
- <div v-if="props.label || slots.label || props.description || slots.description" :class="style.wrapper({ class: props.ui?.wrapper })">
91
- <Label v-if="props.label || slots.label" :for="id" :class="style.label({ class: props.ui?.label })">
68
+ <div v-if="props.label || slots.label || props.description || slots.description" :class="style.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
69
+ <Label v-if="props.label || slots.label" :for="id" :class="style.label({ class: props.ui?.label })" data-part="label">
92
70
  <slot name="label" :label="props.label">{{ props.label }}</slot>
93
71
  </Label>
94
- <p v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })">
72
+ <p v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })" data-part="description">
95
73
  <slot name="description" :description="props.description">
96
74
  {{ props.description }}
97
75
  </slot>
@@ -0,0 +1,56 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { CheckboxRootProps, PrimitiveProps } from 'reka-ui';
3
+ import type { checkbox } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ export interface CheckboxEmits {
6
+ change: [payload: Event];
7
+ }
8
+ export interface CheckboxSlots {
9
+ label?: (props: {
10
+ label?: string;
11
+ }) => any;
12
+ description?: (props: {
13
+ description?: string;
14
+ }) => any;
15
+ }
16
+ type CheckboxVariants = VariantProps<typeof checkbox>;
17
+ export interface CheckboxProps extends ComponentAttrs<typeof checkbox>, Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
18
+ /**
19
+ * The element or component this component should render as.
20
+ * @default "div"
21
+ */
22
+ as?: PrimitiveProps['as'];
23
+ label?: string;
24
+ description?: string;
25
+ size?: CheckboxVariants['size'];
26
+ /**
27
+ * The icon displayed when checked.
28
+ * @default app.icons.check
29
+ */
30
+ icon?: string;
31
+ /**
32
+ * The icon displayed when the checkbox is indeterminate.
33
+ * @default app.icons.indeterminate
34
+ */
35
+ indeterminateIcon?: string;
36
+ }
37
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<CheckboxProps & {
38
+ modelValue?: boolean | "indeterminate";
39
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ change: (payload: Event) => any;
41
+ "update:modelValue": (value: boolean | "indeterminate") => any;
42
+ }, string, import("vue").PublicProps, Readonly<CheckboxProps & {
43
+ modelValue?: boolean | "indeterminate";
44
+ }> & Readonly<{
45
+ onChange?: ((payload: Event) => any) | undefined;
46
+ "onUpdate:modelValue"?: ((value: boolean | "indeterminate") => any) | undefined;
47
+ }>, {
48
+ disabled: boolean;
49
+ required: boolean;
50
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CheckboxSlots>;
51
+ export default _default;
52
+ type __VLS_WithSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
@@ -1,66 +1,49 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps } from 'reka-ui'
4
- import type { UseComponentIconsProps } from '../composables/useComponentIcons'
5
- import type { chip } from '../theme'
6
- import type { ComponentAttrs } from '../types'
1
+ <script>
7
2
 
8
- export interface ChipSlots {
9
- leading?: (props?: {}) => any
10
- default?: (props?: {}) => any
11
- trailing?: (props?: {}) => any
12
- }
13
-
14
- type ChipVariants = VariantProps<typeof chip>
15
-
16
- export interface ChipProps extends ComponentAttrs<typeof chip>, Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
17
- /**
18
- * The element or component this component should render as.
19
- * @default "div"
20
- */
21
- as?: PrimitiveProps['as']
22
- variant?: ChipVariants['variant']
23
- size?: ChipVariants['size']
24
- label?: string
25
- }
26
3
  </script>
27
4
 
28
- <script setup lang="ts">
29
- import { Primitive } from 'reka-ui'
30
- import { computed } from 'vue'
31
- import { useButtonGroup } from '../composables/useButtonGroup'
32
- import { useComponentIcons } from '../composables/useComponentIcons'
33
- import { useTheme } from '../composables/useTheme'
34
-
35
- const props = withDefaults(defineProps<ChipProps>(), {
36
- variant: 'solid',
37
- })
38
-
39
- const slots = defineSlots<ChipSlots>()
40
-
41
- const { size, orientation } = useButtonGroup(props)
42
- const { isLeading, leadingIconName, isTrailing, trailingIconName } = useComponentIcons(props)
43
-
44
- const { generateStyle } = useTheme()
45
- const style = computed(() => generateStyle('chip', {
5
+ <script setup>
6
+ import { Primitive } 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
+ const props = defineProps({
12
+ as: { type: null, required: false },
13
+ variant: { type: null, required: false, default: "solid" },
14
+ size: { type: null, required: false },
15
+ label: { type: String, required: false },
16
+ class: { type: null, required: false },
17
+ ui: { type: null, required: false },
18
+ icon: { type: String, required: false },
19
+ leading: { type: Boolean, required: false },
20
+ leadingIcon: { type: String, required: false },
21
+ trailing: { type: Boolean, required: false },
22
+ trailingIcon: { type: String, required: false }
23
+ });
24
+ const slots = defineSlots();
25
+ const { size, orientation } = useButtonGroup(props);
26
+ const { isLeading, leadingIconName, isTrailing, trailingIconName } = useComponentIcons(props);
27
+ const { generateStyle } = useTheme();
28
+ const style = computed(() => generateStyle("chip", {
46
29
  ...props,
47
30
  size: size.value,
48
- groupOrientation: orientation.value,
49
- }))
31
+ groupOrientation: orientation.value
32
+ }));
50
33
  </script>
51
34
 
52
35
  <template>
53
- <Primitive :as="props.as" :class="style.base({ class: [props.class, props.ui?.base] })">
36
+ <Primitive :as="props.as" :class="style.base({ class: [props.class, props.ui?.base] })" data-part="base">
54
37
  <slot name="leading">
55
- <span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"></span>
38
+ <span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })" data-part="leading-icon"></span>
56
39
  </slot>
57
40
 
58
- <span v-if="props.label || slots.default" :class="style.label({ class: props.ui?.label })">
41
+ <span v-if="props.label || slots.default" :class="style.label({ class: props.ui?.label })" data-part="label">
59
42
  <slot>{{ props.label }}</slot>
60
43
  </span>
61
44
 
62
45
  <slot name="trailing">
63
- <span v-if="isTrailing && trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"></span>
46
+ <span v-if="isTrailing && trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })" data-part="trailing-icon"></span>
64
47
  </slot>
65
48
  </Primitive>
66
49
  </template>
@@ -0,0 +1,30 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons.js';
4
+ import type { chip } from '../theme/index.js';
5
+ import type { ComponentAttrs } from '../types/index.js';
6
+ export interface ChipSlots {
7
+ leading?: (props?: {}) => any;
8
+ default?: (props?: {}) => any;
9
+ trailing?: (props?: {}) => any;
10
+ }
11
+ type ChipVariants = VariantProps<typeof chip>;
12
+ export interface ChipProps extends ComponentAttrs<typeof chip>, Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
13
+ /**
14
+ * The element or component this component should render as.
15
+ * @default "div"
16
+ */
17
+ as?: PrimitiveProps['as'];
18
+ variant?: ChipVariants['variant'];
19
+ size?: ChipVariants['size'];
20
+ label?: string;
21
+ }
22
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ChipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ChipProps> & Readonly<{}>, {
23
+ variant: "solid" | "outline" | "soft" | "soft-outline";
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ChipSlots>;
25
+ export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -1,35 +1,26 @@
1
- <script lang="ts">
2
- import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui'
3
- import type { collapsible } from '../theme'
4
- import type { ComponentAttrs } from '../types'
1
+ <script>
5
2
 
6
- export interface CollapsibleEmits extends CollapsibleRootEmits {}
7
-
8
- export interface CollapsibleSlots {
9
- default?: (props: { open: boolean }) => any
10
- content?: (props?: {}) => any
11
- }
12
-
13
- export interface CollapsibleProps extends ComponentAttrs<typeof collapsible>, Pick<CollapsibleRootProps, 'as' | 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
14
- }
15
3
  </script>
16
4
 
17
- <script setup lang="ts">
18
- import { reactivePick } from '@vueuse/core'
19
- import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, useForwardPropsEmits } from 'reka-ui'
20
- import { computed } from 'vue'
21
- import { useTheme } from '../composables/useTheme'
22
-
23
- const props = withDefaults(defineProps<CollapsibleProps>(), {
24
- unmountOnHide: true,
25
- })
26
- const emit = defineEmits<CollapsibleEmits>()
27
- const slots = defineSlots<CollapsibleSlots>()
28
-
29
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled', 'unmountOnHide'), emit)
30
-
31
- const { generateStyle } = useTheme()
32
- const style = computed(() => generateStyle('collapsible', props))
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, useForwardPropsEmits } from "reka-ui";
8
+ import { computed } from "vue";
9
+ import { useTheme } from "../composables/useTheme";
10
+ const props = defineProps({
11
+ class: { type: null, required: false },
12
+ ui: { type: null, required: false },
13
+ as: { type: null, required: false },
14
+ defaultOpen: { type: Boolean, required: false },
15
+ open: { type: Boolean, required: false },
16
+ disabled: { type: Boolean, required: false },
17
+ unmountOnHide: { type: Boolean, required: false, default: true }
18
+ });
19
+ const emit = defineEmits(["update:open"]);
20
+ const slots = defineSlots();
21
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "defaultOpen", "open", "disabled", "unmountOnHide"), emit);
22
+ const { generateStyle } = useTheme();
23
+ const style = computed(() => generateStyle("collapsible", props));
33
24
  </script>
34
25
 
35
26
  <template>
@@ -37,12 +28,13 @@ const style = computed(() => generateStyle('collapsible', props))
37
28
  v-slot="{ open }"
38
29
  v-bind="rootProps"
39
30
  :class="style.root({ class: [props.class, props.ui?.root] })"
31
+ data-part="root"
40
32
  >
41
33
  <CollapsibleTrigger v-if="slots.default" as-child>
42
34
  <slot :open="open"></slot>
43
35
  </CollapsibleTrigger>
44
36
 
45
- <CollapsibleContent :class="style.content({ class: props.ui?.content })">
37
+ <CollapsibleContent :class="style.content({ class: props.ui?.content })" data-part="content">
46
38
  <slot name="content"></slot>
47
39
  </CollapsibleContent>
48
40
  </CollapsibleRoot>
@@ -0,0 +1,26 @@
1
+ import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui';
2
+ import type { collapsible } from '../theme/index.js';
3
+ import type { ComponentAttrs } from '../types/index.js';
4
+ export interface CollapsibleEmits extends CollapsibleRootEmits {
5
+ }
6
+ export interface CollapsibleSlots {
7
+ default?: (props: {
8
+ open: boolean;
9
+ }) => any;
10
+ content?: (props?: {}) => any;
11
+ }
12
+ export interface CollapsibleProps extends ComponentAttrs<typeof collapsible>, Pick<CollapsibleRootProps, 'as' | 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
13
+ }
14
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:open": (value: boolean) => any;
16
+ }, string, import("vue").PublicProps, Readonly<CollapsibleProps> & Readonly<{
17
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
18
+ }>, {
19
+ unmountOnHide: boolean;
20
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CollapsibleSlots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,106 +1,51 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui'
4
- import type { drawer } from '../theme'
5
- import type { ButtonProps, ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface DrawerEmits extends DialogRootEmits {
8
- 'after-leave': []
9
- }
10
-
11
- export interface DrawerSlots {
12
- default?: (props?: {}) => any
13
- content?: (props?: {}) => any
14
- header?: (props?: {}) => any
15
- title?: (props?: {}) => any
16
- description?: (props?: {}) => any
17
- close?: (props?: {}) => any
18
- body?: (props?: {}) => any
19
- footer?: (props?: {}) => any
20
- }
21
-
22
- type DrawerVariants = VariantProps<typeof drawer>
23
-
24
- export interface DrawerProps extends ComponentAttrs<typeof drawer>, DialogRootProps {
25
- title?: string
26
- description?: string
27
- /** The content of the drawer. */
28
- content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
29
- /**
30
- * Render an overlay behind the drawer.
31
- * @default true
32
- */
33
- overlay?: boolean
34
- /** @default true */
35
- transition?: boolean
36
- /**
37
- * The direction of the drawer.
38
- * @default "bottom"
39
- */
40
- direction?: DrawerVariants['direction']
41
- /**
42
- * Whether to inset the drawer from the edges.
43
- */
44
- inset?: boolean
45
- /**
46
- * Render the drawer in a portal.
47
- * @default true
48
- */
49
- portal?: boolean
50
- /**
51
- * Display a close button to dismiss the drawer.
52
- * @default true
53
- */
54
- close?: ButtonProps | boolean
55
- /** @default app.icons.close */
56
- closeIcon?: string
57
- /**
58
- * When `false`, the drawer will not close when clicking outside or pressing escape.
59
- * @default true
60
- */
61
- dismissible?: boolean
62
- }
63
3
  </script>
64
4
 
65
- <script setup lang="ts">
66
- import { reactivePick } from '@vueuse/core'
67
- import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits, VisuallyHidden } from 'reka-ui'
68
- import { computed, toRef } from 'vue'
69
- import { useLocale } from '../composables/useLocale'
70
- import { useTheme } from '../composables/useTheme'
71
- import Button from './Button.vue'
72
-
73
- const props = withDefaults(defineProps<DrawerProps>(), {
74
- direction: 'bottom',
75
- modal: true,
76
- portal: true,
77
- overlay: true,
78
- transition: true,
79
- dismissible: true,
80
- close: true,
81
- })
82
- const emit = defineEmits<DrawerEmits>()
83
- const slots = defineSlots<DrawerSlots>()
84
-
85
- const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emit)
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits, VisuallyHidden } from "reka-ui";
8
+ import { computed, toRef } from "vue";
9
+ import { useLocale } from "../composables/useLocale";
10
+ import { useTheme } from "../composables/useTheme";
11
+ import Button from "./Button.vue";
12
+ const props = defineProps({
13
+ title: { type: String, required: false },
14
+ description: { type: String, required: false },
15
+ content: { type: Object, required: false },
16
+ overlay: { type: Boolean, required: false, default: true },
17
+ transition: { type: Boolean, required: false, default: true },
18
+ direction: { type: null, required: false, default: "bottom" },
19
+ inset: { type: Boolean, required: false },
20
+ portal: { type: Boolean, required: false, default: true },
21
+ close: { type: [Object, Boolean], required: false, default: true },
22
+ closeIcon: { type: String, required: false },
23
+ dismissible: { type: Boolean, required: false, default: true },
24
+ class: { type: null, required: false },
25
+ ui: { type: null, required: false },
26
+ open: { type: Boolean, required: false },
27
+ defaultOpen: { type: Boolean, required: false },
28
+ modal: { type: Boolean, required: false, default: true }
29
+ });
30
+ const emit = defineEmits(["after-leave", "update:open"]);
31
+ const slots = defineSlots();
32
+ const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "modal"), emit);
86
33
  const contentProps = toRef(() => ({
87
34
  ...props.content,
88
- ...(slots.content || slots.header || (!props.description && !slots.description)) ? { 'aria-describedby': undefined } : {},
89
- }))
35
+ ...slots.content || slots.header || !props.description && !slots.description ? { "aria-describedby": void 0 } : {}
36
+ }));
90
37
  const contentEvents = computed(() => {
91
38
  if (props.dismissible)
92
- return {}
93
-
39
+ return {};
94
40
  return {
95
- pointerDownOutside: (e: Event) => e.preventDefault(),
96
- interactOutside: (e: Event) => e.preventDefault(),
97
- escapeKeyDown: (e: Event) => e.preventDefault(),
98
- }
99
- })
100
-
101
- const { t } = useLocale()
102
- const { theme, generateStyle } = useTheme()
103
- const style = computed(() => generateStyle('drawer', props))
41
+ pointerDownOutside: (e) => e.preventDefault(),
42
+ interactOutside: (e) => e.preventDefault(),
43
+ escapeKeyDown: (e) => e.preventDefault()
44
+ };
45
+ });
46
+ const { t } = useLocale();
47
+ const { theme, generateStyle } = useTheme();
48
+ const style = computed(() => generateStyle("drawer", props));
104
49
  </script>
105
50
 
106
51
  <template>
@@ -110,29 +55,32 @@ const style = computed(() => generateStyle('drawer', props))
110
55
  </DialogTrigger>
111
56
 
112
57
  <DialogPortal :disabled="!props.portal">
113
- <DialogOverlay v-if="props.overlay" :class="style.overlay({ class: props.ui?.overlay })" />
58
+ <DialogOverlay v-if="props.overlay" :class="style.overlay({ class: props.ui?.overlay })" data-part="overlay" />
114
59
 
115
60
  <DialogContent
116
61
  :class="style.content({ class: [!slots.default && props.class, props.ui?.content] })"
117
62
  :data-direction="props.direction"
63
+ data-part="content"
118
64
  v-bind="contentProps"
119
65
  v-on="contentEvents"
120
66
  @after-leave="emit('after-leave')"
121
67
  >
122
- <VisuallyHidden v-if="slots.content || slots.header || (!props.title && !slots.title)">
68
+ <VisuallyHidden v-if="slots.content || slots.header || !props.title && !slots.title">
123
69
  <DialogTitle />
124
70
  </VisuallyHidden>
125
71
 
126
72
  <slot name="content">
127
- <div :class="style.container({ class: props.ui?.container })">
73
+ <div :class="style.container({ class: props.ui?.container })" data-part="container">
128
74
  <div
129
75
  v-if="slots.header || props.title || slots.title || props.description || slots.description || props.close || slots.close"
130
76
  :class="style.header({ class: props.ui?.header })"
77
+ data-part="header"
131
78
  >
132
79
  <slot name="header">
133
80
  <DialogTitle
134
81
  v-if="props.title || slots.title"
135
82
  :class="style.title({ class: props.ui?.title })"
83
+ data-part="title"
136
84
  >
137
85
  <slot name="title">
138
86
  {{ props.title }}
@@ -140,13 +88,14 @@ const style = computed(() => generateStyle('drawer', props))
140
88
  </DialogTitle>
141
89
 
142
90
  <DialogClose v-if="props.close || slots.close" as-child>
143
- <slot name="close">
91
+ <slot name="close" :ui="props.ui">
144
92
  <Button
145
93
  variant="ghost"
146
94
  :icon="props.closeIcon || theme.app.icons.close"
147
95
  v-bind="typeof props.close === 'boolean' ? {} : props.close"
148
- :class="style.close({ class: props.ui?.close })"
149
96
  :aria-label="t('modal.close')"
97
+ :class="style.close({ class: props.ui?.close })"
98
+ data-part="close"
150
99
  />
151
100
  </slot>
152
101
  </DialogClose>
@@ -154,6 +103,7 @@ const style = computed(() => generateStyle('drawer', props))
154
103
  <DialogDescription
155
104
  v-if="props.description || slots.description"
156
105
  :class="style.description({ class: props.ui?.description })"
106
+ data-part="description"
157
107
  >
158
108
  <slot name="description">
159
109
  {{ props.description }}
@@ -162,11 +112,11 @@ const style = computed(() => generateStyle('drawer', props))
162
112
  </slot>
163
113
  </div>
164
114
 
165
- <div v-if="slots.body" :class="style.body({ class: props.ui?.body })">
115
+ <div v-if="slots.body" :class="style.body({ class: props.ui?.body })" data-part="body">
166
116
  <slot name="body"></slot>
167
117
  </div>
168
118
 
169
- <div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })">
119
+ <div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })" data-part="footer">
170
120
  <slot name="footer"></slot>
171
121
  </div>
172
122
  </div>