@nuxt/ui 3.0.2 → 3.1.1

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 (221) hide show
  1. package/.nuxt/ui/accordion.ts +2 -2
  2. package/.nuxt/ui/alert.ts +29 -29
  3. package/.nuxt/ui/avatar-group.ts +1 -1
  4. package/.nuxt/ui/avatar.ts +3 -3
  5. package/.nuxt/ui/badge.ts +33 -33
  6. package/.nuxt/ui/breadcrumb.ts +5 -5
  7. package/.nuxt/ui/button.ts +43 -43
  8. package/.nuxt/ui/calendar.ts +17 -17
  9. package/.nuxt/ui/card.ts +5 -5
  10. package/.nuxt/ui/carousel.ts +6 -6
  11. package/.nuxt/ui/checkbox-group.ts +61 -0
  12. package/.nuxt/ui/checkbox.ts +140 -27
  13. package/.nuxt/ui/chip.ts +8 -8
  14. package/.nuxt/ui/color-picker.ts +3 -3
  15. package/.nuxt/ui/command-palette.ts +14 -14
  16. package/.nuxt/ui/context-menu.ts +33 -33
  17. package/.nuxt/ui/drawer.ts +10 -10
  18. package/.nuxt/ui/dropdown-menu.ts +34 -34
  19. package/.nuxt/ui/form-field.ts +6 -6
  20. package/.nuxt/ui/index.ts +1 -0
  21. package/.nuxt/ui/input-menu.ts +42 -42
  22. package/.nuxt/ui/input-number.ts +20 -20
  23. package/.nuxt/ui/input.ts +23 -23
  24. package/.nuxt/ui/kbd.ts +4 -4
  25. package/.nuxt/ui/link.ts +3 -3
  26. package/.nuxt/ui/modal.ts +5 -5
  27. package/.nuxt/ui/navigation-menu.ts +78 -80
  28. package/.nuxt/ui/pin-input.ts +20 -20
  29. package/.nuxt/ui/popover.ts +2 -2
  30. package/.nuxt/ui/progress.ts +17 -17
  31. package/.nuxt/ui/radio-group.ts +250 -35
  32. package/.nuxt/ui/select-menu.ts +36 -33
  33. package/.nuxt/ui/select.ts +32 -32
  34. package/.nuxt/ui/separator.ts +8 -8
  35. package/.nuxt/ui/skeleton.ts +1 -1
  36. package/.nuxt/ui/slideover.ts +4 -4
  37. package/.nuxt/ui/slider.ts +16 -16
  38. package/.nuxt/ui/stepper.ts +18 -18
  39. package/.nuxt/ui/switch.ts +20 -20
  40. package/.nuxt/ui/table.ts +15 -15
  41. package/.nuxt/ui/tabs.ts +32 -32
  42. package/.nuxt/ui/textarea.ts +40 -35
  43. package/.nuxt/ui/toast.ts +24 -24
  44. package/.nuxt/ui/tooltip.ts +2 -2
  45. package/.nuxt/ui/tree.ts +18 -18
  46. package/.nuxt/ui.css +63 -12
  47. package/README.md +15 -0
  48. package/cli/templates.mjs +18 -17
  49. package/dist/module.json +5 -5
  50. package/dist/module.mjs +12 -7
  51. package/dist/runtime/components/Accordion.vue +36 -93
  52. package/dist/runtime/components/Accordion.vue.d.ts +75 -0
  53. package/dist/runtime/components/Alert.vue +37 -100
  54. package/dist/runtime/components/Alert.vue.d.ts +81 -0
  55. package/dist/runtime/components/App.vue +28 -34
  56. package/dist/runtime/components/App.vue.d.ts +24 -0
  57. package/dist/runtime/components/Avatar.vue +42 -75
  58. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  59. package/dist/runtime/components/AvatarGroup.vue +40 -77
  60. package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
  61. package/dist/runtime/components/Badge.vue +33 -62
  62. package/dist/runtime/components/Badge.vue.d.ts +41 -0
  63. package/dist/runtime/components/Breadcrumb.vue +37 -90
  64. package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
  65. package/dist/runtime/components/Button.vue +95 -104
  66. package/dist/runtime/components/Button.vue.d.ts +48 -0
  67. package/dist/runtime/components/ButtonGroup.vue +20 -46
  68. package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
  69. package/dist/runtime/components/Calendar.vue +67 -150
  70. package/dist/runtime/components/Calendar.vue.d.ts +111 -0
  71. package/dist/runtime/components/Card.vue +18 -40
  72. package/dist/runtime/components/Card.vue.d.ts +29 -0
  73. package/dist/runtime/components/Carousel.vue +112 -234
  74. package/dist/runtime/components/Carousel.vue.d.ts +122 -0
  75. package/dist/runtime/components/Checkbox.vue +52 -93
  76. package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
  77. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  78. package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
  79. package/dist/runtime/components/Chip.vue +26 -69
  80. package/dist/runtime/components/Chip.vue.d.ts +57 -0
  81. package/dist/runtime/components/Collapsible.vue +22 -41
  82. package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
  83. package/dist/runtime/components/ColorPicker.vue +111 -197
  84. package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
  85. package/dist/runtime/components/CommandPalette.vue +96 -237
  86. package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
  87. package/dist/runtime/components/Container.vue +15 -28
  88. package/dist/runtime/components/Container.vue.d.ts +18 -0
  89. package/dist/runtime/components/ContextMenu.vue +34 -133
  90. package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
  91. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  92. package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
  93. package/dist/runtime/components/Drawer.vue +49 -83
  94. package/dist/runtime/components/Drawer.vue.d.ts +78 -0
  95. package/dist/runtime/components/DropdownMenu.vue +39 -142
  96. package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
  97. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  98. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
  99. package/dist/runtime/components/Form.vue +135 -220
  100. package/dist/runtime/components/Form.vue.d.ts +69 -0
  101. package/dist/runtime/components/FormField.vue +35 -77
  102. package/dist/runtime/components/FormField.vue.d.ts +61 -0
  103. package/dist/runtime/components/Icon.vue +12 -19
  104. package/dist/runtime/components/Icon.vue.d.ts +8 -0
  105. package/dist/runtime/components/Input.vue +82 -140
  106. package/dist/runtime/components/Input.vue.d.ts +76 -0
  107. package/dist/runtime/components/InputMenu.vue +185 -332
  108. package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
  109. package/dist/runtime/components/InputNumber.vue +71 -133
  110. package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
  111. package/dist/runtime/components/Kbd.vue +20 -46
  112. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  113. package/dist/runtime/components/Link.vue +98 -176
  114. package/dist/runtime/components/Link.vue.d.ts +93 -0
  115. package/dist/runtime/components/LinkBase.vue +33 -42
  116. package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
  117. package/dist/runtime/components/Modal.vue +53 -116
  118. package/dist/runtime/components/Modal.vue.d.ts +93 -0
  119. package/dist/runtime/components/NavigationMenu.vue +77 -209
  120. package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -0
  121. package/dist/runtime/components/OverlayProvider.vue +14 -18
  122. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  123. package/dist/runtime/components/Pagination.vue +46 -140
  124. package/dist/runtime/components/Pagination.vue.d.ts +119 -0
  125. package/dist/runtime/components/PinInput.vue +61 -78
  126. package/dist/runtime/components/PinInput.vue.d.ts +57 -0
  127. package/dist/runtime/components/Popover.vue +47 -84
  128. package/dist/runtime/components/Popover.vue.d.ts +63 -0
  129. package/dist/runtime/components/Progress.vue +70 -131
  130. package/dist/runtime/components/Progress.vue.d.ts +66 -0
  131. package/dist/runtime/components/RadioGroup.vue +70 -132
  132. package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
  133. package/dist/runtime/components/Select.vue +110 -224
  134. package/dist/runtime/components/Select.vue.d.ts +145 -0
  135. package/dist/runtime/components/SelectMenu.vue +161 -310
  136. package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
  137. package/dist/runtime/components/Separator.vue +29 -71
  138. package/dist/runtime/components/Separator.vue.d.ts +54 -0
  139. package/dist/runtime/components/Skeleton.vue +21 -23
  140. package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
  141. package/dist/runtime/components/Slideover.vue +53 -120
  142. package/dist/runtime/components/Slideover.vue.d.ts +94 -0
  143. package/dist/runtime/components/Slider.vue +46 -84
  144. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  145. package/dist/runtime/components/Stepper.vue +45 -115
  146. package/dist/runtime/components/Stepper.vue.d.ts +83 -0
  147. package/dist/runtime/components/Switch.vue +45 -93
  148. package/dist/runtime/components/Switch.vue.d.ts +70 -0
  149. package/dist/runtime/components/Table.vue +163 -267
  150. package/dist/runtime/components/Table.vue.d.ts +183 -0
  151. package/dist/runtime/components/Tabs.vue +41 -107
  152. package/dist/runtime/components/Tabs.vue.d.ts +88 -0
  153. package/dist/runtime/components/Textarea.vue +113 -158
  154. package/dist/runtime/components/Textarea.vue.d.ts +78 -0
  155. package/dist/runtime/components/Toast.vue +49 -110
  156. package/dist/runtime/components/Toast.vue.d.ts +157 -0
  157. package/dist/runtime/components/Toaster.vue +70 -107
  158. package/dist/runtime/components/Toaster.vue.d.ts +38 -0
  159. package/dist/runtime/components/Tooltip.vue +38 -65
  160. package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
  161. package/dist/runtime/components/Tree.vue +59 -166
  162. package/dist/runtime/components/Tree.vue.d.ts +111 -0
  163. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  164. package/dist/runtime/composables/defineShortcuts.js +6 -0
  165. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  166. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  167. package/dist/runtime/composables/useFormField.d.ts +2 -2
  168. package/dist/runtime/composables/useKbd.d.ts +1 -0
  169. package/dist/runtime/composables/useKbd.js +4 -3
  170. package/dist/runtime/composables/useOverlay.d.ts +14 -8
  171. package/dist/runtime/composables/useOverlay.js +20 -7
  172. package/dist/runtime/composables/usePortal.d.ts +6 -0
  173. package/dist/runtime/composables/usePortal.js +17 -0
  174. package/dist/runtime/index.css +1 -1
  175. package/dist/runtime/inertia/components/Link.vue +146 -0
  176. package/dist/runtime/inertia/components/Link.vue.d.ts +63 -0
  177. package/dist/runtime/inertia/stubs.d.ts +43 -0
  178. package/dist/runtime/inertia/stubs.js +82 -0
  179. package/dist/runtime/locale/bg.d.ts +3 -0
  180. package/dist/runtime/locale/bg.js +54 -0
  181. package/dist/runtime/locale/index.d.ts +5 -1
  182. package/dist/runtime/locale/index.js +5 -1
  183. package/dist/runtime/locale/kk.d.ts +3 -0
  184. package/dist/runtime/locale/kk.js +54 -0
  185. package/dist/runtime/locale/tj.d.ts +3 -0
  186. package/dist/runtime/locale/tj.js +54 -0
  187. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  188. package/dist/runtime/locale/ug_cn.js +55 -0
  189. package/dist/runtime/types/form.d.ts +4 -1
  190. package/dist/runtime/types/index.d.ts +1 -0
  191. package/dist/runtime/types/index.js +1 -0
  192. package/dist/runtime/types/tv.d.ts +53 -0
  193. package/dist/runtime/types/tv.js +0 -0
  194. package/dist/runtime/types/utils.d.ts +7 -17
  195. package/dist/runtime/types/utils.js +1 -0
  196. package/dist/runtime/utils/link.d.ts +3 -3
  197. package/dist/runtime/utils/link.js +1 -0
  198. package/dist/runtime/utils/tv.js +2 -2
  199. package/dist/runtime/vue/components/Icon.vue +7 -8
  200. package/dist/runtime/vue/components/Icon.vue.d.ts +5 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +6 -2
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.d.mts +1 -1
  209. package/dist/vite.mjs +2 -2
  210. package/package.json +96 -54
  211. package/dist/module.cjs +0 -62
  212. package/dist/module.d.cts +0 -45
  213. package/dist/module.d.ts +0 -45
  214. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  215. package/dist/types.d.ts +0 -7
  216. package/dist/unplugin.cjs +0 -232
  217. package/dist/unplugin.d.cts +0 -62
  218. package/dist/unplugin.d.ts +0 -62
  219. package/dist/vite.cjs +0 -23
  220. package/dist/vite.d.cts +0 -15
  221. package/dist/vite.d.ts +0 -15
@@ -1,270 +1,148 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { VariantProps } from 'tailwind-variants'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import type { AcceptableValue } from 'reka-ui'
6
- import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
7
- import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
8
- import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
9
- import type { AutoHeightOptionsType } from 'embla-carousel-auto-height'
10
- import type { ClassNamesOptionsType } from 'embla-carousel-class-names'
11
- import type { FadeOptionsType } from 'embla-carousel-fade'
12
- import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
13
- import _appConfig from '#build/app.config'
14
- import theme from '#build/ui/carousel'
15
- import { tv } from '../utils/tv'
16
- import type { ButtonProps } from '../types'
17
- import type { PartialString } from '../types/utils'
18
-
19
- const appConfigCarousel = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
20
-
21
- const carousel = tv({ extend: tv(theme), ...(appConfigCarousel.ui?.carousel || {}) })
22
-
23
- type CarouselVariants = VariantProps<typeof carousel>
24
-
25
- export type CarouselItem = AcceptableValue
26
-
27
- export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
28
- /**
29
- * The element or component this component should render as.
30
- * @defaultValue 'div'
31
- */
32
- as?: any
33
- /**
34
- * Configure the prev button when arrows are enabled.
35
- * @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
36
- */
37
- prev?: ButtonProps
38
- /**
39
- * The icon displayed in the prev button.
40
- * @defaultValue appConfig.ui.icons.arrowLeft
41
- * @IconifyIcon
42
- */
43
- prevIcon?: string
44
- /**
45
- * Configure the next button when arrows are enabled.
46
- * @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
47
- */
48
- next?: ButtonProps
49
- /**
50
- * The icon displayed in the next button.
51
- * @defaultValue appConfig.ui.icons.arrowRight
52
- * @IconifyIcon
53
- */
54
- nextIcon?: string
55
- /**
56
- * Display prev and next buttons to scroll the carousel.
57
- * @defaultValue false
58
- */
59
- arrows?: boolean
60
- /**
61
- * Display dots to scroll to a specific slide.
62
- * @defaultValue false
63
- */
64
- dots?: boolean
65
- /**
66
- * The orientation of the carousel.
67
- * @defaultValue 'horizontal'
68
- */
69
- orientation?: CarouselVariants['orientation']
70
- items?: T[]
71
- /**
72
- * Enable Autoplay plugin
73
- * @link https://www.embla-carousel.com/plugins/autoplay/
74
- */
75
- autoplay?: boolean | AutoplayOptionsType
76
- /**
77
- * Enable Auto Scroll plugin
78
- * @link https://www.embla-carousel.com/plugins/auto-scroll/
79
- */
80
- autoScroll?: boolean | AutoScrollOptionsType
81
- /**
82
- * Enable Auto Height plugin
83
- * @link https://www.embla-carousel.com/plugins/auto-height/
84
- */
85
- autoHeight?: boolean | AutoHeightOptionsType
86
- /**
87
- * Enable Class Names plugin
88
- * @link https://www.embla-carousel.com/plugins/class-names/
89
- */
90
- classNames?: boolean | ClassNamesOptionsType
91
- /**
92
- * Enable Fade plugin
93
- * @link https://www.embla-carousel.com/plugins/fade/
94
- */
95
- fade?: boolean | FadeOptionsType
96
- /**
97
- * Enable Wheel Gestures plugin
98
- * @link https://www.embla-carousel.com/plugins/wheel-gestures/
99
- */
100
- wheelGestures?: boolean | WheelGesturesPluginOptions
101
- class?: any
102
- ui?: PartialString<typeof carousel.slots>
103
- }
104
-
105
- export type CarouselSlots<T extends CarouselItem = CarouselItem> = {
106
- default(props: { item: T, index: number }): any
107
- }
108
-
1
+ <script>
2
+ import theme from "#build/ui/carousel";
109
3
  </script>
110
4
 
111
- <script setup lang="ts" generic="T extends CarouselItem">
112
- import { computed, ref, watch, onMounted } from 'vue'
113
- import useEmblaCarousel from 'embla-carousel-vue'
114
- import { Primitive, useForwardProps } from 'reka-ui'
115
- import { reactivePick, computedAsync } from '@vueuse/core'
116
- import { useAppConfig } from '#imports'
117
- import { useLocale } from '../composables/useLocale'
118
- import UButton from './Button.vue'
119
-
120
- const props = withDefaults(defineProps<CarouselProps<T>>(), {
121
- orientation: 'horizontal',
122
- arrows: false,
123
- dots: false,
124
- // Embla Options
125
- active: true,
126
- align: 'center',
127
- breakpoints: () => ({}),
128
- containScroll: 'trimSnaps',
129
- dragFree: false,
130
- dragThreshold: 10,
131
- duration: 25,
132
- inViewThreshold: 0,
133
- loop: false,
134
- skipSnaps: false,
135
- slidesToScroll: 1,
136
- startIndex: 0,
137
- watchDrag: true,
138
- watchResize: true,
139
- watchSlides: true,
140
- watchFocus: true,
141
- // Embla Plugins
142
- autoplay: false,
143
- autoScroll: false,
144
- autoHeight: false,
145
- classNames: false,
146
- fade: false,
147
- wheelGestures: false
148
- })
149
- defineSlots<CarouselSlots<T>>()
150
-
151
- const appConfig = useAppConfig()
152
- const { dir, t } = useLocale()
153
- const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
154
-
155
- const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft))
156
- const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight))
157
-
158
- const ui = computed(() => carousel({
5
+ <script setup>
6
+ import { computed, ref, watch, onMounted } from "vue";
7
+ import useEmblaCarousel from "embla-carousel-vue";
8
+ import { Primitive, useForwardProps } from "reka-ui";
9
+ import { reactivePick, computedAsync } from "@vueuse/core";
10
+ import { useAppConfig } from "#imports";
11
+ import { useLocale } from "../composables/useLocale";
12
+ import { tv } from "../utils/tv";
13
+ import UButton from "./Button.vue";
14
+ const props = defineProps({
15
+ as: { type: null, required: false },
16
+ prev: { type: Object, required: false },
17
+ prevIcon: { type: String, required: false },
18
+ next: { type: Object, required: false },
19
+ nextIcon: { type: String, required: false },
20
+ arrows: { type: Boolean, required: false, default: false },
21
+ dots: { type: Boolean, required: false, default: false },
22
+ orientation: { type: null, required: false, default: "horizontal" },
23
+ items: { type: Array, required: false },
24
+ autoplay: { type: [Boolean, Object], required: false, default: false },
25
+ autoScroll: { type: [Boolean, Object], required: false, default: false },
26
+ autoHeight: { type: [Boolean, Object], required: false, default: false },
27
+ classNames: { type: [Boolean, Object], required: false, default: false },
28
+ fade: { type: [Boolean, Object], required: false, default: false },
29
+ wheelGestures: { type: Boolean, required: false, skipCheck: true, default: false },
30
+ class: { type: null, required: false },
31
+ ui: { type: null, required: false },
32
+ align: { type: [String, Function], required: false, default: "center" },
33
+ containScroll: { type: [Boolean, String], required: false, default: "trimSnaps" },
34
+ slidesToScroll: { type: [String, Number], required: false, default: 1 },
35
+ dragFree: { type: Boolean, required: false, default: false },
36
+ dragThreshold: { type: Number, required: false, default: 10 },
37
+ inViewThreshold: { type: null, required: false, default: 0 },
38
+ loop: { type: Boolean, required: false, default: false },
39
+ skipSnaps: { type: Boolean, required: false, default: false },
40
+ duration: { type: Number, required: false, default: 25 },
41
+ startIndex: { type: Number, required: false, default: 0 },
42
+ watchDrag: { type: [Boolean, Function], required: false, default: true },
43
+ watchResize: { type: [Boolean, Function], required: false, default: true },
44
+ watchSlides: { type: [Boolean, Function], required: false, default: true },
45
+ watchFocus: { type: [Boolean, Function], required: false, default: true },
46
+ active: { type: Boolean, required: false, default: true },
47
+ breakpoints: { type: Object, required: false, default: () => ({}) }
48
+ });
49
+ defineSlots();
50
+ const emits = defineEmits(["select"]);
51
+ const { dir, t } = useLocale();
52
+ const appConfig = useAppConfig();
53
+ const rootProps = useForwardProps(reactivePick(props, "active", "align", "breakpoints", "containScroll", "dragFree", "dragThreshold", "duration", "inViewThreshold", "loop", "skipSnaps", "slidesToScroll", "startIndex", "watchDrag", "watchResize", "watchSlides", "watchFocus"));
54
+ const prevIcon = computed(() => props.prevIcon || (dir.value === "rtl" ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft));
55
+ const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight));
56
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.carousel || {} })({
159
57
  orientation: props.orientation
160
- }))
161
-
162
- const options = computed<EmblaOptionsType>(() => ({
163
- ...(props.fade ? { align: 'center', containScroll: false } : {}),
58
+ }));
59
+ const options = computed(() => ({
60
+ ...props.fade ? { align: "center", containScroll: false } : {},
164
61
  ...rootProps.value,
165
- axis: props.orientation === 'horizontal' ? 'x' : 'y',
166
- direction: dir.value === 'rtl' ? 'rtl' : 'ltr'
167
- }))
168
-
169
- const plugins = computedAsync<EmblaPluginType[]>(async () => {
170
- const plugins = []
171
-
62
+ axis: props.orientation === "horizontal" ? "x" : "y",
63
+ direction: dir.value === "rtl" ? "rtl" : "ltr"
64
+ }));
65
+ const plugins = computedAsync(async () => {
66
+ const plugins2 = [];
172
67
  if (props.autoplay) {
173
- const AutoplayPlugin = await import('embla-carousel-autoplay').then(r => r.default)
174
- plugins.push(AutoplayPlugin(typeof props.autoplay === 'boolean' ? {} : props.autoplay))
68
+ const AutoplayPlugin = await import("embla-carousel-autoplay").then((r) => r.default);
69
+ plugins2.push(AutoplayPlugin(typeof props.autoplay === "boolean" ? {} : props.autoplay));
175
70
  }
176
-
177
71
  if (props.autoScroll) {
178
- const AutoScrollPlugin = await import('embla-carousel-auto-scroll').then(r => r.default)
179
- plugins.push(AutoScrollPlugin(typeof props.autoScroll === 'boolean' ? {} : props.autoScroll))
72
+ const AutoScrollPlugin = await import("embla-carousel-auto-scroll").then((r) => r.default);
73
+ plugins2.push(AutoScrollPlugin(typeof props.autoScroll === "boolean" ? {} : props.autoScroll));
180
74
  }
181
-
182
75
  if (props.autoHeight) {
183
- const AutoHeightPlugin = await import('embla-carousel-auto-height').then(r => r.default)
184
- plugins.push(AutoHeightPlugin(typeof props.autoHeight === 'boolean' ? {} : props.autoHeight))
76
+ const AutoHeightPlugin = await import("embla-carousel-auto-height").then((r) => r.default);
77
+ plugins2.push(AutoHeightPlugin(typeof props.autoHeight === "boolean" ? {} : props.autoHeight));
185
78
  }
186
-
187
79
  if (props.classNames) {
188
- const ClassNamesPlugin = await import('embla-carousel-class-names').then(r => r.default)
189
- plugins.push(ClassNamesPlugin(typeof props.classNames === 'boolean' ? {} : props.classNames))
80
+ const ClassNamesPlugin = await import("embla-carousel-class-names").then((r) => r.default);
81
+ plugins2.push(ClassNamesPlugin(typeof props.classNames === "boolean" ? {} : props.classNames));
190
82
  }
191
-
192
83
  if (props.fade) {
193
- const FadePlugin = await import('embla-carousel-fade').then(r => r.default)
194
- plugins.push(FadePlugin(typeof props.fade === 'boolean' ? {} : props.fade))
84
+ const FadePlugin = await import("embla-carousel-fade").then((r) => r.default);
85
+ plugins2.push(FadePlugin(typeof props.fade === "boolean" ? {} : props.fade));
195
86
  }
196
-
197
87
  if (props.wheelGestures) {
198
- const { WheelGesturesPlugin } = await import('embla-carousel-wheel-gestures')
199
- plugins.push(WheelGesturesPlugin(typeof props.wheelGestures === 'boolean' ? {} : props.wheelGestures))
88
+ const { WheelGesturesPlugin } = await import("embla-carousel-wheel-gestures");
89
+ plugins2.push(WheelGesturesPlugin(typeof props.wheelGestures === "boolean" ? {} : props.wheelGestures));
200
90
  }
201
-
202
- return plugins
203
- })
204
-
205
- const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value)
206
-
91
+ return plugins2;
92
+ });
93
+ const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value);
207
94
  watch([options, plugins], () => {
208
- emblaApi.value?.reInit(options.value, plugins.value)
209
- })
210
-
95
+ emblaApi.value?.reInit(options.value, plugins.value);
96
+ });
211
97
  function scrollPrev() {
212
- emblaApi.value?.scrollPrev()
98
+ emblaApi.value?.scrollPrev();
213
99
  }
214
100
  function scrollNext() {
215
- emblaApi.value?.scrollNext()
101
+ emblaApi.value?.scrollNext();
216
102
  }
217
- function scrollTo(index: number) {
218
- emblaApi.value?.scrollTo(index)
103
+ function scrollTo(index) {
104
+ emblaApi.value?.scrollTo(index);
219
105
  }
220
-
221
- function onKeyDown(event: KeyboardEvent) {
222
- const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
223
- const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
224
-
106
+ function onKeyDown(event) {
107
+ const prevKey = props.orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
108
+ const nextKey = props.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
225
109
  if (event.key === prevKey) {
226
- event.preventDefault()
227
- scrollPrev()
228
-
229
- return
110
+ event.preventDefault();
111
+ scrollPrev();
112
+ return;
230
113
  }
231
-
232
114
  if (event.key === nextKey) {
233
- event.preventDefault()
234
- scrollNext()
115
+ event.preventDefault();
116
+ scrollNext();
235
117
  }
236
118
  }
237
-
238
- const canScrollNext = ref(false)
239
- const canScrollPrev = ref(false)
240
- const selectedIndex = ref<number>(0)
241
- const scrollSnaps = ref<number[]>([])
242
-
243
- function onInit(api: EmblaCarouselType) {
244
- scrollSnaps.value = api?.scrollSnapList() || []
119
+ const canScrollNext = ref(false);
120
+ const canScrollPrev = ref(false);
121
+ const selectedIndex = ref(0);
122
+ const scrollSnaps = ref([]);
123
+ function onInit(api) {
124
+ scrollSnaps.value = api?.scrollSnapList() || [];
245
125
  }
246
- function onSelect(api: EmblaCarouselType) {
247
- canScrollNext.value = api?.canScrollNext() || false
248
- canScrollPrev.value = api?.canScrollPrev() || false
249
- selectedIndex.value = api?.selectedScrollSnap() || 0
126
+ function onSelect(api) {
127
+ canScrollNext.value = api?.canScrollNext() || false;
128
+ canScrollPrev.value = api?.canScrollPrev() || false;
129
+ selectedIndex.value = api?.selectedScrollSnap() || 0;
130
+ emits("select", selectedIndex.value);
250
131
  }
251
-
252
132
  onMounted(() => {
253
133
  if (!emblaApi.value) {
254
- return
134
+ return;
255
135
  }
256
-
257
- emblaApi.value?.on('init', onInit)
258
- emblaApi.value?.on('init', onSelect)
259
- emblaApi.value?.on('reInit', onInit)
260
- emblaApi.value?.on('reInit', onSelect)
261
- emblaApi.value?.on('select', onSelect)
262
- })
263
-
136
+ emblaApi.value?.on("init", onInit);
137
+ emblaApi.value?.on("init", onSelect);
138
+ emblaApi.value?.on("reInit", onInit);
139
+ emblaApi.value?.on("reInit", onSelect);
140
+ emblaApi.value?.on("select", onSelect);
141
+ });
264
142
  defineExpose({
265
143
  emblaRef,
266
144
  emblaApi
267
- })
145
+ });
268
146
  </script>
269
147
 
270
148
  <template>
@@ -299,7 +177,7 @@ defineExpose({
299
177
  color="neutral"
300
178
  variant="outline"
301
179
  :aria-label="t('carousel.prev')"
302
- v-bind="typeof prev === 'object' ? prev : undefined"
180
+ v-bind="typeof prev === 'object' ? prev : void 0"
303
181
  :class="ui.prev({ class: props.ui?.prev })"
304
182
  @click="scrollPrev"
305
183
  />
@@ -310,7 +188,7 @@ defineExpose({
310
188
  color="neutral"
311
189
  variant="outline"
312
190
  :aria-label="t('carousel.next')"
313
- v-bind="typeof next === 'object' ? next : undefined"
191
+ v-bind="typeof next === 'object' ? next : void 0"
314
192
  :class="ui.next({ class: props.ui?.next })"
315
193
  @click="scrollNext"
316
194
  />
@@ -0,0 +1,122 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { AcceptableValue } from 'reka-ui';
3
+ import type { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
4
+ import type { AutoplayOptionsType } from 'embla-carousel-autoplay';
5
+ import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll';
6
+ import type { AutoHeightOptionsType } from 'embla-carousel-auto-height';
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 theme from '#build/ui/carousel';
11
+ import type { ButtonProps } from '../types';
12
+ import type { ComponentConfig } from '../types/utils';
13
+ type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>;
14
+ export type CarouselItem = AcceptableValue;
15
+ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue 'div'
19
+ */
20
+ as?: any;
21
+ /**
22
+ * Configure the prev button when arrows are enabled.
23
+ * @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
24
+ */
25
+ prev?: ButtonProps;
26
+ /**
27
+ * The icon displayed in the prev button.
28
+ * @defaultValue appConfig.ui.icons.arrowLeft
29
+ * @IconifyIcon
30
+ */
31
+ prevIcon?: string;
32
+ /**
33
+ * Configure the next button when arrows are enabled.
34
+ * @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
35
+ */
36
+ next?: ButtonProps;
37
+ /**
38
+ * The icon displayed in the next button.
39
+ * @defaultValue appConfig.ui.icons.arrowRight
40
+ * @IconifyIcon
41
+ */
42
+ nextIcon?: string;
43
+ /**
44
+ * Display prev and next buttons to scroll the carousel.
45
+ * @defaultValue false
46
+ */
47
+ arrows?: boolean;
48
+ /**
49
+ * Display dots to scroll to a specific slide.
50
+ * @defaultValue false
51
+ */
52
+ dots?: boolean;
53
+ /**
54
+ * The orientation of the carousel.
55
+ * @defaultValue 'horizontal'
56
+ */
57
+ orientation?: Carousel['variants']['orientation'];
58
+ items?: T[];
59
+ /**
60
+ * Enable Autoplay plugin
61
+ * @link https://www.embla-carousel.com/plugins/autoplay/
62
+ */
63
+ autoplay?: boolean | AutoplayOptionsType;
64
+ /**
65
+ * Enable Auto Scroll plugin
66
+ * @link https://www.embla-carousel.com/plugins/auto-scroll/
67
+ */
68
+ autoScroll?: boolean | AutoScrollOptionsType;
69
+ /**
70
+ * Enable Auto Height plugin
71
+ * @link https://www.embla-carousel.com/plugins/auto-height/
72
+ */
73
+ autoHeight?: boolean | AutoHeightOptionsType;
74
+ /**
75
+ * Enable Class Names plugin
76
+ * @link https://www.embla-carousel.com/plugins/class-names/
77
+ */
78
+ classNames?: boolean | ClassNamesOptionsType;
79
+ /**
80
+ * Enable Fade plugin
81
+ * @link https://www.embla-carousel.com/plugins/fade/
82
+ */
83
+ fade?: boolean | FadeOptionsType;
84
+ /**
85
+ * Enable Wheel Gestures plugin
86
+ * @link https://www.embla-carousel.com/plugins/wheel-gestures/
87
+ */
88
+ wheelGestures?: boolean | WheelGesturesPluginOptions;
89
+ class?: any;
90
+ ui?: Carousel['slots'];
91
+ }
92
+ export type CarouselSlots<T extends CarouselItem = CarouselItem> = {
93
+ default(props: {
94
+ item: T;
95
+ index: number;
96
+ }): any;
97
+ };
98
+ export interface CarouselEmits {
99
+ /**
100
+ * Emitted when the selected slide changes
101
+ * @param selectedIndex The index of the selected slide
102
+ */
103
+ select: [selectedIndex: number];
104
+ }
105
+ 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<{
106
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
107
+ readonly onSelect?: ((selectedIndex: number) => any) | undefined;
108
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSelect"> & CarouselProps<T> & Partial<{}>> & import("vue").PublicProps;
109
+ expose(exposed: import("vue").ShallowUnwrapRef<{
110
+ emblaRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
111
+ emblaApi: import("vue").Ref<EmblaCarouselType | undefined, EmblaCarouselType | undefined>;
112
+ }>): void;
113
+ attrs: any;
114
+ slots: CarouselSlots<T>;
115
+ emit: (evt: "select", selectedIndex: number) => void;
116
+ }>) => import("vue").VNode & {
117
+ __ctx?: Awaited<typeof __VLS_setup>;
118
+ };
119
+ export default _default;
120
+ type __VLS_PrettifyLocal<T> = {
121
+ [K in keyof T]: T[K];
122
+ } & {};