@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,102 +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
- change: [payload: Event]
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 { useFormItem } from '../composables/useFormItem'
45
- import { useTheme } from '../composables/useTheme'
46
-
47
- const props = withDefaults(defineProps<CheckboxProps>(), {
48
- required: false,
49
- disabled: false,
50
- })
51
- const emit = defineEmits<CheckboxEmits>()
52
- const slots = defineSlots<CheckboxSlots>()
53
-
54
- const innerValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
55
- const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
56
-
57
- const { id: _id, size, name, disabled, ariaAttrs, emitFormChange, emitFormInput } = useFormItem<CheckboxProps>(props)
58
- const id = _id.value ?? useId()
59
-
60
- const { theme, generateStyle } = useTheme()
61
- const style = computed(() => generateStyle('checkbox', {
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", {
62
35
  ...props,
63
36
  size: size.value,
64
- disabled: disabled.value,
65
- }))
66
-
67
- function onUpdate(value: any) {
68
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
69
- const event = new Event('change', { target: value })
70
- emit('change', event)
71
- emitFormChange()
72
- emitFormInput()
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();
73
44
  }
74
45
  </script>
75
46
 
76
47
  <template>
77
- <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
78
- <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">
79
50
  <CheckboxRoot
80
51
  v-slot="{ modelValue }"
81
52
  v-bind="{ ...rootProps, ...ariaAttrs, id, name, disabled }"
82
53
  v-model="innerValue"
83
54
  :class="style.base({ class: props.ui?.base })"
55
+ data-part="base"
84
56
  @update:model-value="onUpdate"
85
57
  >
86
58
  <CheckboxIndicator as-child force-mount>
87
59
  <span
88
60
  v-if="modelValue === 'indeterminate'"
89
61
  :class="style.icon({ class: [props.indeterminateIcon || theme.app.icons.indeterminate, props.ui?.icon] })"
62
+ data-part="icon"
90
63
  ></span>
91
- <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>
92
65
  </CheckboxIndicator>
93
66
  </CheckboxRoot>
94
67
  </div>
95
- <div v-if="props.label || slots.label || props.description || slots.description" :class="style.wrapper({ class: props.ui?.wrapper })">
96
- <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">
97
70
  <slot name="label" :label="props.label">{{ props.label }}</slot>
98
71
  </Label>
99
- <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">
100
73
  <slot name="description" :description="props.description">
101
74
  {{ props.description }}
102
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 { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui'
4
- import type { drawer } from '../theme'
5
- import type { ButtonProps, ComponentAttrs, EmitsToProps } from '../types'
1
+ <script>
6
2
 
7
- export interface DrawerEmits extends DialogRootEmits {
8
- 'after-leave': []
9
- }
10
-
11
- export interface DrawerSlots {
12
- default?: any
13
- content?: any
14
- header?: any
15
- title?: any
16
- description?: any
17
- close?: (props: { ui: ComponentAttrs<typeof drawer>['ui'] }) => any
18
- body?: any
19
- footer?: 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'> & Partial<EmitsToProps<DialogContentEmits>>
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 }}
@@ -145,8 +93,9 @@ const style = computed(() => generateStyle('drawer', props))
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>