@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,55 +1,62 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { UseComponentIconsProps } from '../composables/useComponentIcons'
4
- import type { button } from '../theme'
5
- import type { ComponentAttrs } from '../types'
6
- import type { LinkProps } from './Link.vue'
1
+ <script>
7
2
 
8
- export interface ButtonSlots {
9
- default?: (props?: {}) => any
10
- leading?: (props?: {}) => any
11
- trailing?: (props?: {}) => any
12
- }
13
-
14
- type ButtonVariants = VariantProps<typeof button>
15
-
16
- export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom' | 'underline'> {
17
- icon?: string
18
- label?: string
19
- variant?: ButtonVariants['variant']
20
- size?: ButtonVariants['size']
21
- loading?: boolean
22
- active?: boolean
23
- disabled?: boolean
24
- }
25
3
  </script>
26
4
 
27
- <script lang="ts" setup>
28
- import { useForwardProps } from 'reka-ui'
29
- import { computed } from 'vue'
30
- import { useButtonGroup } from '../composables/useButtonGroup'
31
- import { useComponentIcons } from '../composables/useComponentIcons'
32
- import { useTheme } from '../composables/useTheme'
33
- import { omit, pickLinkProps } from '../utils'
34
- import Link from './Link.vue'
35
-
36
- const props = withDefaults(defineProps<ButtonProps>(), {
37
- variant: 'solid',
38
- })
39
-
40
- const slots = defineSlots<ButtonSlots>()
41
-
42
- const { size, orientation } = useButtonGroup(props)
5
+ <script setup>
6
+ import { useForwardProps } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { useButtonGroup } from "../composables/useButtonGroup";
9
+ import { useComponentIcons } from "../composables/useComponentIcons";
10
+ import { useTheme } from "../composables/useTheme";
11
+ import { omit, pickLinkProps } from "../utils";
12
+ import Link from "./Link.vue";
13
+ const props = defineProps({
14
+ icon: { type: String, required: false },
15
+ label: { type: String, required: false },
16
+ variant: { type: null, required: false, default: "solid" },
17
+ size: { type: null, required: false },
18
+ loading: { type: Boolean, required: false },
19
+ active: { type: Boolean, required: false },
20
+ disabled: { type: Boolean, required: false },
21
+ class: { type: null, required: false },
22
+ ui: { type: null, required: false },
23
+ leading: { type: Boolean, required: false },
24
+ leadingIcon: { type: String, required: false },
25
+ trailing: { type: Boolean, required: false },
26
+ trailingIcon: { type: String, required: false },
27
+ loadingIcon: { type: String, required: false },
28
+ as: { type: null, required: false },
29
+ type: { type: null, required: false },
30
+ exact: { type: Boolean, required: false },
31
+ exactQuery: { type: [Boolean, String], required: false },
32
+ exactHash: { type: Boolean, required: false },
33
+ inactiveClass: { type: String, required: false },
34
+ disableClass: { type: String, required: false },
35
+ to: { type: null, required: false },
36
+ href: { type: null, required: false },
37
+ external: { type: Boolean, required: false },
38
+ target: { type: [String, Object, null], required: false },
39
+ rel: { type: [String, Object, null], required: false },
40
+ noRel: { type: Boolean, required: false },
41
+ prefetchedClass: { type: String, required: false },
42
+ prefetch: { type: Boolean, required: false },
43
+ prefetchOn: { type: [String, Object], required: false },
44
+ noPrefetch: { type: Boolean, required: false },
45
+ activeClass: { type: String, required: false },
46
+ exactActiveClass: { type: String, required: false },
47
+ ariaCurrentValue: { type: String, required: false },
48
+ viewTransition: { type: Boolean, required: false },
49
+ replace: { type: Boolean, required: false }
50
+ });
51
+ const slots = defineSlots();
52
+ const { size, orientation } = useButtonGroup(props);
43
53
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
44
- computed(() => ({ ...props, loading: props.loading })),
45
- )
46
-
47
- const linkProps = useForwardProps(pickLinkProps(props))
48
-
49
- const { generateStyle } = useTheme()
50
-
54
+ computed(() => ({ ...props, loading: props.loading }))
55
+ );
56
+ const linkProps = useForwardProps(pickLinkProps(props));
57
+ const { generateStyle } = useTheme();
51
58
  const style = computed(() => {
52
- return generateStyle('button', {
59
+ return generateStyle("button", {
53
60
  ...props,
54
61
  size: size.value,
55
62
  groupOrientation: orientation.value,
@@ -58,10 +65,10 @@ const style = computed(() => {
58
65
  class: [
59
66
  props.class,
60
67
  props.active ? props.activeClass : props.inactiveClass,
61
- props.disabled ? props.disableClass : undefined,
62
- ],
63
- })
64
- })
68
+ props.disabled ? props.disableClass : void 0
69
+ ]
70
+ });
71
+ });
65
72
  </script>
66
73
 
67
74
  <template>
@@ -70,17 +77,20 @@ const style = computed(() => {
70
77
  :type="props.type"
71
78
  :disabled="props.disabled || props.loading"
72
79
  v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
80
+ data-part="base"
73
81
  raw
74
82
  >
75
83
  <slot name="leading">
76
84
  <span
77
85
  v-if="isLeading && leadingIconName"
78
86
  :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"
87
+ data-part="leading-icon"
79
88
  ></span>
80
89
  </slot>
81
90
  <span
82
91
  v-if="props.label || slots.default"
83
92
  :class="style.label({ class: props.ui?.label })"
93
+ data-part="label"
84
94
  >
85
95
  <slot>{{ label }}</slot>
86
96
  </span>
@@ -88,6 +98,7 @@ const style = computed(() => {
88
98
  <span
89
99
  v-if="isTrailing && trailingIconName"
90
100
  :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"
101
+ data-part="trailing-icon"
91
102
  ></span>
92
103
  </slot>
93
104
  </Link>
@@ -0,0 +1,29 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons.js';
3
+ import type { button } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ import type { LinkProps } from './Link.vue.js';
6
+ export interface ButtonSlots {
7
+ default?: (props?: {}) => any;
8
+ leading?: (props?: {}) => any;
9
+ trailing?: (props?: {}) => any;
10
+ }
11
+ type ButtonVariants = VariantProps<typeof button>;
12
+ export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom' | 'underline'> {
13
+ icon?: string;
14
+ label?: string;
15
+ variant?: ButtonVariants['variant'];
16
+ size?: ButtonVariants['size'];
17
+ loading?: boolean;
18
+ active?: boolean;
19
+ disabled?: boolean;
20
+ }
21
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
22
+ variant: "solid" | "outline" | "soft" | "soft-outline" | "link" | "ghost";
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
24
+ export default _default;
25
+ type __VLS_WithSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
@@ -1,46 +1,26 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps } from 'reka-ui'
4
- import type { buttonGroup } from '../theme'
5
- import type { ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface ButtonGroupSlots {
8
- default?: (props?: {}) => any
9
- }
10
-
11
- type ButtonGroupVariant = VariantProps<typeof buttonGroup>
12
-
13
- export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'> {
14
- /**
15
- * The element or component this component should render as.
16
- * @default "div"
17
- */
18
- as?: PrimitiveProps['as']
19
- size?: ButtonGroupVariant['size']
20
- orientation?: ButtonGroupVariant['orientation']
21
- }
22
3
  </script>
23
4
 
24
- <script setup lang="ts">
25
- import { Primitive } from 'reka-ui'
26
- import { computed } from 'vue'
27
- import { provideButtonGroup } from '../app/injections'
28
- import { useTheme } from '../composables/useTheme'
29
-
30
- const props = withDefaults(defineProps<ButtonGroupProps>(), {
31
- orientation: 'horizontal',
32
- })
33
-
34
- defineSlots<ButtonGroupSlots>()
35
-
36
- provideButtonGroup(computed(() => props))
37
-
38
- const { generateStyle } = useTheme()
39
- const style = computed(() => generateStyle('buttonGroup', props))
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ import { provideButtonGroup } from "../app/injections";
9
+ import { useTheme } from "../composables/useTheme";
10
+ const props = defineProps({
11
+ as: { type: null, required: false },
12
+ size: { type: null, required: false },
13
+ orientation: { type: null, required: false, default: "horizontal" },
14
+ class: { type: null, required: false }
15
+ });
16
+ defineSlots();
17
+ provideButtonGroup(computed(() => props));
18
+ const { generateStyle } = useTheme();
19
+ const style = computed(() => generateStyle("buttonGroup", props));
40
20
  </script>
41
21
 
42
22
  <template>
43
- <Primitive :as="props.as" :class="style">
23
+ <Primitive :as="props.as" :class="style.base()" data-part="base">
44
24
  <slot></slot>
45
25
  </Primitive>
46
26
  </template>
@@ -0,0 +1,26 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { buttonGroup } from '../theme/index.js';
4
+ import type { ComponentAttrs } from '../types/index.js';
5
+ export interface ButtonGroupSlots {
6
+ default?: (props?: {}) => any;
7
+ }
8
+ type ButtonGroupVariant = VariantProps<typeof buttonGroup>;
9
+ export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'> {
10
+ /**
11
+ * The element or component this component should render as.
12
+ * @default "div"
13
+ */
14
+ as?: PrimitiveProps['as'];
15
+ size?: ButtonGroupVariant['size'];
16
+ orientation?: ButtonGroupVariant['orientation'];
17
+ }
18
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ButtonGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonGroupProps> & Readonly<{}>, {
19
+ orientation: "horizontal" | "vertical";
20
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonGroupSlots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,101 +1,71 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { DateValue } from '@internationalized/date'
4
- import type { CalendarCellTriggerProps, CalendarRootEmits, CalendarRootProps, DateRange, RangeCalendarRootEmits } from 'reka-ui'
5
- import type { calendar } from '../theme'
6
- import type { ComponentAttrs } from '../types'
1
+ <script>
7
2
 
8
- export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
9
- 'update:modelValue': [date: CalendarModelValue<R, M>]
10
- }
11
-
12
- export interface CalendarSlots {
13
- 'heading'?: (props: { value: string }) => any
14
- 'day'?: (props: Pick<CalendarCellTriggerProps, 'day'>) => any
15
- 'week-day'?: (props: { day: string }) => any
16
- }
17
-
18
- type CalendarVariants = VariantProps<typeof calendar>
19
-
20
- type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
21
- ? DateRange
22
- : M extends true ? DateValue[] : DateValue
23
-
24
- export interface CalendarProps<R extends boolean, M extends boolean> extends ComponentAttrs<typeof calendar>, Omit<CalendarRootProps, 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'> {
25
- /**
26
- * The icon to use for the next year control.
27
- * @default app.icons.chevronDoubleRight
28
- */
29
- nextYearIcon?: string
30
- /**
31
- * The icon to use for the next month control.
32
- * @default app.icons.chevronRight
33
- */
34
- nextMonthIcon?: string
35
- /**
36
- * The icon to use for the previous year control.
37
- * @default app.icons.chevronDoubleLeft
38
- */
39
- prevYearIcon?: string
40
- /**
41
- * The icon to use for the previous month control.
42
- * @default app.icons.chevronLeft
43
- */
44
- prevMonthIcon?: string
45
- /**
46
- * @default "md"
47
- */
48
- size?: CalendarVariants['size']
49
- /** Whether or not a range of dates can be selected */
50
- range?: R & boolean
51
- /** Whether or not multiple dates can be selected */
52
- multiple?: M & boolean
53
- /** Show month controls */
54
- monthControls?: boolean
55
- /** Show year controls */
56
- yearControls?: boolean
57
- defaultValue?: CalendarModelValue<R, M>
58
- modelValue?: CalendarModelValue<R, M>
59
- }
60
3
  </script>
61
4
 
62
- <script setup lang="ts" generic="R extends boolean = false, M extends boolean = false">
63
- import { reactiveOmit } from '@vueuse/core'
64
- import { useForwardPropsEmits } from 'reka-ui'
65
- import { Calendar as BaseCalendar, RangeCalendar } from 'reka-ui/namespaced'
66
- import { computed } from 'vue'
67
- import { useLocale } from '../composables/useLocale'
68
- import { useTheme } from '../composables/useTheme'
69
- import Button from './Button.vue'
70
-
71
- const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
72
- fixedWeeks: true,
73
- monthControls: true,
74
- yearControls: true,
75
- })
76
- const emit = defineEmits<CalendarEmits<R, M>>()
77
- defineSlots<CalendarSlots>()
78
-
79
- const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emit)
80
-
81
- const { code: locale, dir, t } = useLocale()
82
- const { theme, generateStyle } = useTheme()
83
-
84
- const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight))
85
- const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
86
- const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft))
87
- const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft))
88
-
89
- function paginateYear(date: DateValue, sign: -1 | 1) {
5
+ <script setup>
6
+ import { reactiveOmit } from "@vueuse/core";
7
+ import { useForwardPropsEmits } from "reka-ui";
8
+ import { Calendar as BaseCalendar, RangeCalendar } from "reka-ui/namespaced";
9
+ import { computed } from "vue";
10
+ import { useLocale } from "../composables/useLocale";
11
+ import { useTheme } from "../composables/useTheme";
12
+ import Button from "./Button.vue";
13
+ const props = defineProps({
14
+ nextYearIcon: { type: String, required: false },
15
+ nextMonthIcon: { type: String, required: false },
16
+ prevYearIcon: { type: String, required: false },
17
+ prevMonthIcon: { type: String, required: false },
18
+ size: { type: null, required: false },
19
+ range: { type: Boolean, required: false },
20
+ multiple: { type: Boolean, required: false },
21
+ monthControls: { type: Boolean, required: false, default: true },
22
+ yearControls: { type: Boolean, required: false, default: true },
23
+ defaultValue: { type: null, required: false },
24
+ modelValue: { type: null, required: false },
25
+ class: { type: null, required: false },
26
+ ui: { type: null, required: false },
27
+ defaultPlaceholder: { type: null, required: false },
28
+ placeholder: { type: null, required: false },
29
+ pagedNavigation: { type: Boolean, required: false },
30
+ preventDeselect: { type: Boolean, required: false },
31
+ weekStartsOn: { type: Number, required: false },
32
+ weekdayFormat: { type: String, required: false },
33
+ fixedWeeks: { type: Boolean, required: false, default: true },
34
+ maxValue: { type: null, required: false },
35
+ minValue: { type: null, required: false },
36
+ numberOfMonths: { type: Number, required: false, default: 1 },
37
+ disabled: { type: Boolean, required: false },
38
+ readonly: { type: Boolean, required: false },
39
+ initialFocus: { type: Boolean, required: false },
40
+ isDateDisabled: { type: Function, required: false },
41
+ isDateUnavailable: { type: Function, required: false },
42
+ nextPage: { type: Function, required: false },
43
+ prevPage: { type: Function, required: false },
44
+ disableDaysOutsideCurrentView: { type: Boolean, required: false },
45
+ allowNonContiguousRanges: { type: Boolean, required: false },
46
+ maximumDays: { type: Number, required: false },
47
+ isDateHighlightable: { type: Function, required: false },
48
+ fixedDate: { type: String, required: false }
49
+ });
50
+ const emit = defineEmits(["update:modelValue", "update:placeholder", "update:startValue"]);
51
+ defineSlots();
52
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "size", "monthControls", "yearControls", "class", "ui"), emit);
53
+ const { code: locale, dir, t } = useLocale();
54
+ const { theme, generateStyle } = useTheme();
55
+ const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight));
56
+ const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight));
57
+ const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft));
58
+ const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft));
59
+ function paginateYear(date, sign) {
90
60
  if (sign === -1)
91
- return date.subtract({ years: 1 })
92
-
93
- return date.add({ years: 1 })
61
+ return date.subtract({ years: 1 });
62
+ return date.add({ years: 1 });
94
63
  }
95
-
96
- const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar)
97
-
98
- const style = computed(() => generateStyle('calendar', props))
64
+ const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar);
65
+ const style = computed(() => generateStyle("calendar", {
66
+ ...props,
67
+ multipleMonths: props.numberOfMonths > 1
68
+ }));
99
69
  </script>
100
70
 
101
71
  <template>
@@ -107,16 +77,17 @@ const style = computed(() => generateStyle('calendar', props))
107
77
  :locale="locale"
108
78
  :dir="dir"
109
79
  :class="style.root({ class: [props.class, props.ui?.root] })"
80
+ data-part="root"
110
81
  >
111
- <Calendar.Header :class="style.header({ class: props.ui?.header })">
112
- <Calendar.Prev v-if="props.yearControls" :prev-page="date => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
82
+ <Calendar.Header :class="style.header({ class: props.ui?.header })" data-part="header">
83
+ <Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
113
84
  <Button :icon="prevYearIcon" :size="props.size" variant="ghost" />
114
85
  </Calendar.Prev>
115
86
  <Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
116
87
  <Button :icon="prevMonthIcon" :size="props.size" variant="ghost" />
117
88
  </Calendar.Prev>
118
89
 
119
- <Calendar.Heading v-slot="{ headingValue }" :class="style.heading({ class: props.ui?.heading })">
90
+ <Calendar.Heading v-slot="{ headingValue }" :class="style.heading({ class: props.ui?.heading })" data-part="heading">
120
91
  <slot name="heading" :value="headingValue">
121
92
  {{ headingValue }}
122
93
  </slot>
@@ -128,32 +99,35 @@ const style = computed(() => generateStyle('calendar', props))
128
99
  <Button :icon="nextYearIcon" :size="props.size" variant="ghost" />
129
100
  </Calendar.Next>
130
101
  </Calendar.Header>
131
- <div :class="style.body({ class: props.ui?.body })">
102
+ <div :class="style.body({ class: props.ui?.body })" data-part="body">
132
103
  <Calendar.Grid
133
104
  v-for="month in grid"
134
105
  :key="month.value.toString()"
135
106
  :class="style.grid({ class: props.ui?.grid })"
107
+ data-part="grid"
136
108
  >
137
109
  <Calendar.GridHead>
138
- <Calendar.GridRow :class="style.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
139
- <Calendar.HeadCell v-for="day in weekDays" :key="day" :class="style.headCell({ class: props.ui?.headCell })">
110
+ <Calendar.GridRow :class="style.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })" data-part="grid-week-day-row">
111
+ <Calendar.HeadCell v-for="day in weekDays" :key="day" :class="style.headCell({ class: props.ui?.headCell })" data-part="head-cell">
140
112
  <slot name="week-day" :day="day">
141
113
  {{ day }}
142
114
  </slot>
143
115
  </Calendar.HeadCell>
144
116
  </Calendar.GridRow>
145
117
  </Calendar.GridHead>
146
- <Calendar.GridBody :class="style.gridBody({ class: props.ui?.gridBody })">
118
+ <Calendar.GridBody :class="style.gridBody({ class: props.ui?.gridBody })" data-part="grid-body">
147
119
  <Calendar.GridRow
148
120
  v-for="(weekDates, index) in month.rows"
149
121
  :key="`weekDates-${index}`"
150
122
  :class="style.gridRow({ class: props.ui?.gridRow })"
123
+ data-part="grid-row"
151
124
  >
152
125
  <Calendar.Cell
153
126
  v-for="weekDate in weekDates"
154
127
  :key="weekDate.toString()"
155
128
  :date="weekDate"
156
129
  :class="style.cell({ class: props.ui?.cell })"
130
+ data-part="cell"
157
131
  >
158
132
  <Calendar.CellTrigger
159
133
  v-slot="{ disabled, unavailable }"
@@ -161,7 +135,7 @@ const style = computed(() => generateStyle('calendar', props))
161
135
  :month="month.value"
162
136
  as-child
163
137
  >
164
- <div :class="style.cellTrigger({ class: props.ui?.cellTrigger, disabled: disabled || unavailable })">
138
+ <div :class="style.cellTrigger({ class: props.ui?.cellTrigger, disabled: disabled || unavailable })" data-part="cell-trigger">
165
139
  <slot name="day" :day="weekDate">
166
140
  {{ weekDate.day }}
167
141
  </slot>
@@ -0,0 +1,75 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { CalendarCellTriggerProps, CalendarRootEmits, CalendarRootProps, DateRange, RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui';
4
+ import type { calendar } from '../theme/index.js';
5
+ import type { ComponentAttrs } from '../types/index.js';
6
+ export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
7
+ 'update:modelValue': [date: CalendarModelValue<R, M>];
8
+ }
9
+ export interface CalendarSlots {
10
+ 'heading'?: (props: {
11
+ value: string;
12
+ }) => any;
13
+ 'day'?: (props: Pick<CalendarCellTriggerProps, 'day'>) => any;
14
+ 'week-day'?: (props: {
15
+ day: string;
16
+ }) => any;
17
+ }
18
+ type CalendarVariants = VariantProps<typeof calendar>;
19
+ type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true ? DateRange : M extends true ? DateValue[] : DateValue;
20
+ type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true ? (DateRange | null) : M extends true ? (DateValue[] | undefined) : (DateValue | undefined);
21
+ type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
22
+ type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
23
+ export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends ComponentAttrs<typeof calendar>, _CalendarRootProps, _RangeCalendarRootProps {
24
+ /**
25
+ * The icon to use for the next year control.
26
+ * @default app.icons.chevronDoubleRight
27
+ */
28
+ nextYearIcon?: string;
29
+ /**
30
+ * The icon to use for the next month control.
31
+ * @default app.icons.chevronRight
32
+ */
33
+ nextMonthIcon?: string;
34
+ /**
35
+ * The icon to use for the previous year control.
36
+ * @default app.icons.chevronDoubleLeft
37
+ */
38
+ prevYearIcon?: string;
39
+ /**
40
+ * The icon to use for the previous month control.
41
+ * @default app.icons.chevronLeft
42
+ */
43
+ prevMonthIcon?: string;
44
+ /**
45
+ * @default "md"
46
+ */
47
+ size?: CalendarVariants['size'];
48
+ /** Whether or not a range of dates can be selected */
49
+ range?: R & boolean;
50
+ /** Whether or not multiple dates can be selected */
51
+ multiple?: M & boolean;
52
+ /** Show month controls */
53
+ monthControls?: boolean;
54
+ /** Show year controls */
55
+ yearControls?: boolean;
56
+ defaultValue?: CalendarDefaultValue<R, M>;
57
+ modelValue?: CalendarDefaultValue<R, M>;
58
+ }
59
+ declare const _default: <R extends boolean, M extends boolean>(__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<{
60
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
61
+ readonly "onUpdate:modelValue"?: ((date: CalendarModelValue<R, M>) => any) | undefined;
62
+ readonly "onUpdate:placeholder"?: ((...args: unknown[]) => any) | undefined;
63
+ readonly "onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
64
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:placeholder" | "onUpdate:startValue"> & CalendarProps<R, M> & Partial<{}>> & import("vue").PublicProps;
65
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
66
+ attrs: any;
67
+ slots: CalendarSlots;
68
+ emit: ((evt: "update:modelValue", date: CalendarModelValue<R, M>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void);
69
+ }>) => import("vue").VNode & {
70
+ __ctx?: Awaited<typeof __VLS_setup>;
71
+ };
72
+ export default _default;
73
+ type __VLS_PrettifyLocal<T> = {
74
+ [K in keyof T]: T[K];
75
+ } & {};