@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,254 +1,142 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
4
- import type { AutoHeightOptionsType } from 'embla-carousel-auto-height'
5
- import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
6
- import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
7
- import type { ClassNamesOptionsType } from 'embla-carousel-class-names'
8
- import type { FadeOptionsType } from 'embla-carousel-fade'
9
- import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
10
- import type { AcceptableValue, PrimitiveProps } from 'reka-ui'
11
- import type { carousel } from '../theme'
12
- import type { ButtonProps, ComponentAttrs } from '../types'
1
+ <script>
13
2
 
14
- export type CarouselItem = AcceptableValue
15
-
16
- export interface CarouselSlots<T extends CarouselItem = CarouselItem> {
17
- default?: (props: { item: T, index: number }) => any
18
- }
19
-
20
- type CarouselVariants = VariantProps<typeof carousel>
21
-
22
- export interface CarouselProps<T extends CarouselItem = CarouselItem> extends ComponentAttrs<typeof carousel>, Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
23
- /**
24
- * The element or component this component should render as.
25
- * @default "div"
26
- */
27
- as?: PrimitiveProps['as']
28
- /**
29
- * Configure the prev button when arrows are enabled.
30
- * @default { size: 'md', variant: 'link' }
31
- */
32
- prev?: ButtonProps
33
- /**
34
- * The icon displayed in the prev button.
35
- * @default app.icons.chevronLeft
36
- */
37
- prevIcon?: string
38
- /**
39
- * Configure the next button when arrows are enabled.
40
- * @default { size: 'md', variant: 'link' }
41
- */
42
- next?: ButtonProps
43
- /**
44
- * The icon displayed in the next button.
45
- * @default app.icons.chevronRight
46
- */
47
- nextIcon?: string
48
- /**
49
- * Display prev and next buttons to scroll the carousel.
50
- * @default false
51
- */
52
- arrows?: boolean
53
- /**
54
- * Display dots to scroll to a specific slide.
55
- * @default false
56
- */
57
- dots?: boolean
58
- orientation?: CarouselVariants['orientation']
59
- items?: T[]
60
- /**
61
- * Enable Autoplay plugin
62
- * @link https://www.embla-carousel.com/plugins/autoplay/
63
- */
64
- autoplay?: boolean | AutoplayOptionsType
65
- /**
66
- * Enable Auto Scroll plugin
67
- * @link https://www.embla-carousel.com/plugins/auto-scroll/
68
- */
69
- autoScroll?: boolean | AutoScrollOptionsType
70
- /**
71
- * Enable Auto Height plugin
72
- * @link https://www.embla-carousel.com/plugins/auto-height/
73
- */
74
- autoHeight?: boolean | AutoHeightOptionsType
75
- /**
76
- * Enable Class Names plugin
77
- * @link https://www.embla-carousel.com/plugins/class-names/
78
- */
79
- classNames?: boolean | ClassNamesOptionsType
80
- /**
81
- * Enable Fade plugin
82
- * @link https://www.embla-carousel.com/plugins/fade/
83
- */
84
- fade?: boolean | FadeOptionsType
85
- /**
86
- * Enable Wheel Gestures plugin
87
- * @link https://www.embla-carousel.com/plugins/wheel-gestures/
88
- */
89
- wheelGestures?: boolean | WheelGesturesPluginOptions
90
- }
91
3
  </script>
92
4
 
93
- <script setup lang="ts" generic="T extends CarouselItem">
94
- import { computedAsync, reactivePick } from '@vueuse/core'
95
- import useEmblaCarousel from 'embla-carousel-vue'
96
- import { Primitive, useForwardProps } from 'reka-ui'
97
- import { computed, onMounted, ref, watch } from 'vue'
98
- import { useLocale } from '../composables/useLocale'
99
- import { useTheme } from '../composables/useTheme'
100
- import Button from './Button.vue'
101
-
102
- const props = withDefaults(defineProps<CarouselProps<T>>(), {
103
- orientation: 'horizontal',
104
- arrows: false,
105
- dots: false,
106
-
107
- // Embla Options
108
- active: true,
109
- align: 'center',
110
- breakpoints: () => ({}),
111
- containScroll: 'trimSnaps',
112
- dragFree: false,
113
- dragThreshold: 10,
114
- duration: 25,
115
- inViewThreshold: 0,
116
- loop: false,
117
- skipSnaps: false,
118
- slidesToScroll: 1,
119
- startIndex: 0,
120
- watchDrag: true,
121
- watchResize: true,
122
- watchSlides: true,
123
- watchFocus: true,
124
-
125
- // Embla Plugins
126
- autoplay: false,
127
- autoScroll: false,
128
- autoHeight: false,
129
- classNames: false,
130
- fade: false,
131
- wheelGestures: false,
132
- })
133
- defineSlots<CarouselSlots<T>>()
134
-
135
- const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
136
-
137
- const { t, dir } = useLocale()
138
- const { theme, generateStyle } = useTheme()
139
- const style = computed(() => generateStyle('carousel', props))
140
-
141
- const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft))
142
- const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
143
-
144
- const options = computed<EmblaOptionsType>(() => ({
145
- ...(props.fade ? { align: 'center', containScroll: false } : {}),
5
+ <script setup>
6
+ import { computedAsync, reactivePick } from "@vueuse/core";
7
+ import useEmblaCarousel from "embla-carousel-vue";
8
+ import { Primitive, useForwardProps } from "reka-ui";
9
+ import { computed, onMounted, ref, watch } 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
+ as: { type: null, required: false },
15
+ prev: { type: Object, required: false },
16
+ prevIcon: { type: String, required: false },
17
+ next: { type: Object, required: false },
18
+ nextIcon: { type: String, required: false },
19
+ arrows: { type: Boolean, required: false, default: false },
20
+ dots: { type: Boolean, required: false, default: false },
21
+ orientation: { type: null, required: false, default: "horizontal" },
22
+ items: { type: Array, required: false },
23
+ autoplay: { type: [Boolean, Object], required: false, default: false },
24
+ autoScroll: { type: [Boolean, Object], required: false, default: false },
25
+ autoHeight: { type: [Boolean, Object], required: false, default: false },
26
+ classNames: { type: [Boolean, Object], required: false, default: false },
27
+ fade: { type: [Boolean, Object], required: false, default: false },
28
+ wheelGestures: { type: Boolean, required: false, skipCheck: true, default: false },
29
+ class: { type: null, required: false },
30
+ ui: { type: null, required: false },
31
+ align: { type: [String, Function], required: false, default: "center" },
32
+ containScroll: { type: [Boolean, String], required: false, default: "trimSnaps" },
33
+ slidesToScroll: { type: [String, Number], required: false, default: 1 },
34
+ dragFree: { type: Boolean, required: false, default: false },
35
+ dragThreshold: { type: Number, required: false, default: 10 },
36
+ inViewThreshold: { type: null, required: false, default: 0 },
37
+ loop: { type: Boolean, required: false, default: false },
38
+ skipSnaps: { type: Boolean, required: false, default: false },
39
+ duration: { type: Number, required: false, default: 25 },
40
+ startIndex: { type: Number, required: false, default: 0 },
41
+ watchDrag: { type: [Boolean, Function], required: false, default: true },
42
+ watchResize: { type: [Boolean, Function], required: false, default: true },
43
+ watchSlides: { type: [Boolean, Function], required: false, default: true },
44
+ watchFocus: { type: [Boolean, Function], required: false, default: true },
45
+ active: { type: Boolean, required: false, default: true },
46
+ breakpoints: { type: Object, required: false, default: () => ({}) }
47
+ });
48
+ defineSlots();
49
+ const rootProps = useForwardProps(reactivePick(props, "active", "align", "breakpoints", "containScroll", "dragFree", "dragThreshold", "duration", "inViewThreshold", "loop", "skipSnaps", "slidesToScroll", "startIndex", "watchDrag", "watchResize", "watchSlides", "watchFocus"));
50
+ const { t, dir } = useLocale();
51
+ const { theme, generateStyle } = useTheme();
52
+ const style = computed(() => generateStyle("carousel", props));
53
+ const prevIcon = computed(() => props.prevIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft));
54
+ const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight));
55
+ const options = computed(() => ({
56
+ ...props.fade ? { align: "center", containScroll: false } : {},
146
57
  ...rootProps.value,
147
- axis: props.orientation === 'horizontal' ? 'x' : 'y',
148
- direction: dir.value === 'rtl' ? 'rtl' : 'ltr',
149
- }))
150
-
151
- const plugins = computedAsync<EmblaPluginType[]>(async () => {
152
- const plugins: EmblaPluginType[] = []
153
-
58
+ axis: props.orientation === "horizontal" ? "x" : "y",
59
+ direction: dir.value === "rtl" ? "rtl" : "ltr"
60
+ }));
61
+ const plugins = computedAsync(async () => {
62
+ const plugins2 = [];
154
63
  if (props.autoplay) {
155
- const AutoplayPlugin = await import('embla-carousel-autoplay').then((r) => r.default)
156
- plugins.push(AutoplayPlugin(typeof props.autoplay === 'boolean' ? {} : props.autoplay))
64
+ const AutoplayPlugin = await import("embla-carousel-autoplay").then((r) => r.default);
65
+ plugins2.push(AutoplayPlugin(typeof props.autoplay === "boolean" ? {} : props.autoplay));
157
66
  }
158
-
159
67
  if (props.autoScroll) {
160
- const AutoScrollPlugin = await import('embla-carousel-auto-scroll').then((r) => r.default)
161
- plugins.push(AutoScrollPlugin(typeof props.autoScroll === 'boolean' ? {} : props.autoScroll))
68
+ const AutoScrollPlugin = await import("embla-carousel-auto-scroll").then((r) => r.default);
69
+ plugins2.push(AutoScrollPlugin(typeof props.autoScroll === "boolean" ? {} : props.autoScroll));
162
70
  }
163
-
164
71
  if (props.autoHeight) {
165
- const AutoHeightPlugin = await import('embla-carousel-auto-height').then((r) => r.default)
166
- plugins.push(AutoHeightPlugin(typeof props.autoHeight === 'boolean' ? {} : props.autoHeight))
72
+ const AutoHeightPlugin = await import("embla-carousel-auto-height").then((r) => r.default);
73
+ plugins2.push(AutoHeightPlugin(typeof props.autoHeight === "boolean" ? {} : props.autoHeight));
167
74
  }
168
-
169
75
  if (props.classNames) {
170
- const ClassNamesPlugin = await import('embla-carousel-class-names').then((r) => r.default)
171
- plugins.push(ClassNamesPlugin(typeof props.classNames === 'boolean' ? {} : props.classNames))
76
+ const ClassNamesPlugin = await import("embla-carousel-class-names").then((r) => r.default);
77
+ plugins2.push(ClassNamesPlugin(typeof props.classNames === "boolean" ? {} : props.classNames));
172
78
  }
173
-
174
79
  if (props.fade) {
175
- const FadePlugin = await import('embla-carousel-fade').then((r) => r.default)
176
- plugins.push(FadePlugin(typeof props.fade === 'boolean' ? {} : props.fade))
80
+ const FadePlugin = await import("embla-carousel-fade").then((r) => r.default);
81
+ plugins2.push(FadePlugin(typeof props.fade === "boolean" ? {} : props.fade));
177
82
  }
178
-
179
83
  if (props.wheelGestures) {
180
- const { WheelGesturesPlugin } = await import('embla-carousel-wheel-gestures')
181
- plugins.push(WheelGesturesPlugin(typeof props.wheelGestures === 'boolean' ? {} : props.wheelGestures))
84
+ const { WheelGesturesPlugin } = await import("embla-carousel-wheel-gestures");
85
+ plugins2.push(WheelGesturesPlugin(typeof props.wheelGestures === "boolean" ? {} : props.wheelGestures));
182
86
  }
183
-
184
- return plugins
185
- })
186
-
187
- const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value)
188
-
87
+ return plugins2;
88
+ });
89
+ const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value);
189
90
  watch([options, plugins], () => {
190
- emblaApi.value?.reInit(options.value, plugins.value)
191
- })
192
-
91
+ emblaApi.value?.reInit(options.value, plugins.value);
92
+ });
193
93
  function scrollPrev() {
194
- emblaApi.value?.scrollPrev()
94
+ emblaApi.value?.scrollPrev();
195
95
  }
196
-
197
96
  function scrollNext() {
198
- emblaApi.value?.scrollNext()
97
+ emblaApi.value?.scrollNext();
199
98
  }
200
-
201
- function scrollTo(index: number) {
202
- emblaApi.value?.scrollTo(index)
99
+ function scrollTo(index) {
100
+ emblaApi.value?.scrollTo(index);
203
101
  }
204
-
205
- function onKeyDown(event: KeyboardEvent) {
206
- const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
207
- const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
208
-
102
+ function onKeyDown(event) {
103
+ const prevKey = props.orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
104
+ const nextKey = props.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
209
105
  if (event.key === prevKey) {
210
- event.preventDefault()
211
- scrollPrev()
212
-
213
- return
106
+ event.preventDefault();
107
+ scrollPrev();
108
+ return;
214
109
  }
215
-
216
110
  if (event.key === nextKey) {
217
- event.preventDefault()
218
- scrollNext()
111
+ event.preventDefault();
112
+ scrollNext();
219
113
  }
220
114
  }
221
-
222
- const canScrollNext = ref(false)
223
- const canScrollPrev = ref(false)
224
- const selectedIndex = ref<number>(0)
225
- const scrollSnaps = ref<number[]>([])
226
-
227
- function onInit(api: EmblaCarouselType) {
228
- scrollSnaps.value = api?.scrollSnapList() || []
115
+ const canScrollNext = ref(false);
116
+ const canScrollPrev = ref(false);
117
+ const selectedIndex = ref(0);
118
+ const scrollSnaps = ref([]);
119
+ function onInit(api) {
120
+ scrollSnaps.value = api?.scrollSnapList() || [];
229
121
  }
230
-
231
- function onSelect(api: EmblaCarouselType) {
232
- canScrollNext.value = api?.canScrollNext() || false
233
- canScrollPrev.value = api?.canScrollPrev() || false
234
- selectedIndex.value = api?.selectedScrollSnap() || 0
122
+ function onSelect(api) {
123
+ canScrollNext.value = api?.canScrollNext() || false;
124
+ canScrollPrev.value = api?.canScrollPrev() || false;
125
+ selectedIndex.value = api?.selectedScrollSnap() || 0;
235
126
  }
236
-
237
127
  onMounted(() => {
238
128
  if (!emblaApi.value)
239
- return
240
-
241
- emblaApi.value?.on('init', onInit)
242
- emblaApi.value?.on('init', onSelect)
243
- emblaApi.value?.on('reInit', onInit)
244
- emblaApi.value?.on('reInit', onSelect)
245
- emblaApi.value?.on('select', onSelect)
246
- })
247
-
129
+ return;
130
+ emblaApi.value?.on("init", onInit);
131
+ emblaApi.value?.on("init", onSelect);
132
+ emblaApi.value?.on("reInit", onInit);
133
+ emblaApi.value?.on("reInit", onSelect);
134
+ emblaApi.value?.on("select", onSelect);
135
+ });
248
136
  defineExpose({
249
137
  emblaRef,
250
- emblaApi,
251
- })
138
+ emblaApi
139
+ });
252
140
  </script>
253
141
 
254
142
  <template>
@@ -258,32 +146,35 @@ defineExpose({
258
146
  aria-roledescription="carousel"
259
147
  tabindex="0"
260
148
  :class="style.root({ class: [props.class, props.ui?.root] })"
149
+ data-part="root"
261
150
  @keydown="onKeyDown"
262
151
  >
263
- <div ref="emblaRef" :class="style.viewport({ class: props.ui?.viewport })">
264
- <div :class="style.container({ class: props.ui?.container })">
152
+ <div ref="emblaRef" :class="style.viewport({ class: props.ui?.viewport })" data-part="viewport">
153
+ <div :class="style.container({ class: props.ui?.container })" data-part="container">
265
154
  <div
266
155
  v-for="(item, index) in props.items"
267
156
  :key="index"
268
157
  role="group"
269
158
  aria-roledescription="slide"
270
159
  :class="style.item({ class: props.ui?.item })"
160
+ data-part="item"
271
161
  >
272
162
  <slot :item="item" :index="index"></slot>
273
163
  </div>
274
164
  </div>
275
165
  </div>
276
166
 
277
- <div v-if="props.arrows || props.dots" :class="style.controls({ class: props.ui?.controls })">
278
- <div v-if="props.arrows" :class="style.arrows({ class: props.ui?.arrows })">
167
+ <div v-if="props.arrows || props.dots" :class="style.controls({ class: props.ui?.controls })" data-part="controls">
168
+ <div v-if="props.arrows" :class="style.arrows({ class: props.ui?.arrows })" data-part="arrows">
279
169
  <Button
280
170
  :disabled="!canScrollPrev"
281
171
  :icon="prevIcon"
282
172
  size="md"
283
173
  variant="outline"
284
174
  :aria-label="t('carousel.prev')"
285
- v-bind="typeof props.prev === 'object' ? props.prev : undefined"
175
+ v-bind="typeof props.prev === 'object' ? props.prev : void 0"
286
176
  :class="style.prev({ class: props.ui?.prev })"
177
+ data-part="prev"
287
178
  @click="scrollPrev"
288
179
  />
289
180
  <Button
@@ -292,17 +183,19 @@ defineExpose({
292
183
  size="md"
293
184
  variant="outline"
294
185
  :aria-label="t('carousel.next')"
295
- v-bind="typeof props.next === 'object' ? props.next : undefined"
186
+ v-bind="typeof props.next === 'object' ? props.next : void 0"
296
187
  :class="style.next({ class: props.ui?.next })"
188
+ data-part="next"
297
189
  @click="scrollNext"
298
190
  />
299
191
  </div>
300
192
 
301
- <div v-if="props.dots" :class="style.dots({ class: props.ui?.dots })">
193
+ <div v-if="props.dots" :class="style.dots({ class: props.ui?.dots })" data-part="dots">
302
194
  <template v-for="(_, index) in scrollSnaps" :key="index">
303
195
  <button
304
196
  :aria-label="t('carousel.goto', { page: index + 1 })"
305
197
  :class="style.dot({ class: props.ui?.dot, active: selectedIndex === index })"
198
+ data-part="dot"
306
199
  @click="scrollTo(index)"
307
200
  ></button>
308
201
  </template>
@@ -0,0 +1,104 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
3
+ import type { AutoHeightOptionsType } from 'embla-carousel-auto-height';
4
+ import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll';
5
+ import type { AutoplayOptionsType } from 'embla-carousel-autoplay';
6
+ import type { ClassNamesOptionsType } from 'embla-carousel-class-names';
7
+ import type { FadeOptionsType } from 'embla-carousel-fade';
8
+ import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures';
9
+ import type { AcceptableValue, PrimitiveProps } from 'reka-ui';
10
+ import type { carousel } from '../theme/index.js';
11
+ import type { ButtonProps, ComponentAttrs } from '../types/index.js';
12
+ export type CarouselItem = AcceptableValue;
13
+ export interface CarouselSlots<T extends CarouselItem = CarouselItem> {
14
+ default?: (props: {
15
+ item: T;
16
+ index: number;
17
+ }) => any;
18
+ }
19
+ type CarouselVariants = VariantProps<typeof carousel>;
20
+ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends ComponentAttrs<typeof carousel>, Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
21
+ /**
22
+ * The element or component this component should render as.
23
+ * @default "div"
24
+ */
25
+ as?: PrimitiveProps['as'];
26
+ /**
27
+ * Configure the prev button when arrows are enabled.
28
+ * @default { size: 'md', variant: 'link' }
29
+ */
30
+ prev?: ButtonProps;
31
+ /**
32
+ * The icon displayed in the prev button.
33
+ * @default app.icons.chevronLeft
34
+ */
35
+ prevIcon?: string;
36
+ /**
37
+ * Configure the next button when arrows are enabled.
38
+ * @default { size: 'md', variant: 'link' }
39
+ */
40
+ next?: ButtonProps;
41
+ /**
42
+ * The icon displayed in the next button.
43
+ * @default app.icons.chevronRight
44
+ */
45
+ nextIcon?: string;
46
+ /**
47
+ * Display prev and next buttons to scroll the carousel.
48
+ * @default false
49
+ */
50
+ arrows?: boolean;
51
+ /**
52
+ * Display dots to scroll to a specific slide.
53
+ * @default false
54
+ */
55
+ dots?: boolean;
56
+ orientation?: CarouselVariants['orientation'];
57
+ items?: T[];
58
+ /**
59
+ * Enable Autoplay plugin
60
+ * @link https://www.embla-carousel.com/plugins/autoplay/
61
+ */
62
+ autoplay?: boolean | AutoplayOptionsType;
63
+ /**
64
+ * Enable Auto Scroll plugin
65
+ * @link https://www.embla-carousel.com/plugins/auto-scroll/
66
+ */
67
+ autoScroll?: boolean | AutoScrollOptionsType;
68
+ /**
69
+ * Enable Auto Height plugin
70
+ * @link https://www.embla-carousel.com/plugins/auto-height/
71
+ */
72
+ autoHeight?: boolean | AutoHeightOptionsType;
73
+ /**
74
+ * Enable Class Names plugin
75
+ * @link https://www.embla-carousel.com/plugins/class-names/
76
+ */
77
+ classNames?: boolean | ClassNamesOptionsType;
78
+ /**
79
+ * Enable Fade plugin
80
+ * @link https://www.embla-carousel.com/plugins/fade/
81
+ */
82
+ fade?: boolean | FadeOptionsType;
83
+ /**
84
+ * Enable Wheel Gestures plugin
85
+ * @link https://www.embla-carousel.com/plugins/wheel-gestures/
86
+ */
87
+ wheelGestures?: boolean | WheelGesturesPluginOptions;
88
+ }
89
+ declare const _default: <T extends CarouselItem>(__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<{
90
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & CarouselProps<T> & Partial<{}>> & import("vue").PublicProps;
91
+ expose(exposed: import("vue").ShallowUnwrapRef<{
92
+ emblaRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
93
+ emblaApi: import("vue").Ref<EmblaCarouselType | undefined, EmblaCarouselType | undefined>;
94
+ }>): void;
95
+ attrs: any;
96
+ slots: CarouselSlots<T>;
97
+ emit: {};
98
+ }>) => import("vue").VNode & {
99
+ __ctx?: Awaited<typeof __VLS_setup>;
100
+ };
101
+ export default _default;
102
+ type __VLS_PrettifyLocal<T> = {
103
+ [K in keyof T]: T[K];
104
+ } & {};