@nuxt/ui 3.0.2 → 3.1.0

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 (220) hide show
  1. package/.nuxt/ui/accordion.ts +25 -4
  2. package/.nuxt/ui/alert.ts +52 -31
  3. package/.nuxt/ui/avatar-group.ts +24 -3
  4. package/.nuxt/ui/avatar.ts +26 -5
  5. package/.nuxt/ui/badge.ts +56 -35
  6. package/.nuxt/ui/breadcrumb.ts +28 -7
  7. package/.nuxt/ui/button-group.ts +23 -2
  8. package/.nuxt/ui/button.ts +66 -45
  9. package/.nuxt/ui/calendar.ts +39 -18
  10. package/.nuxt/ui/card.ts +28 -7
  11. package/.nuxt/ui/carousel.ts +29 -8
  12. package/.nuxt/ui/checkbox-group.ts +82 -0
  13. package/.nuxt/ui/checkbox.ts +163 -29
  14. package/.nuxt/ui/chip.ts +31 -10
  15. package/.nuxt/ui/collapsible.ts +23 -2
  16. package/.nuxt/ui/color-picker.ts +26 -5
  17. package/.nuxt/ui/command-palette.ts +37 -16
  18. package/.nuxt/ui/container.ts +23 -2
  19. package/.nuxt/ui/context-menu.ts +56 -35
  20. package/.nuxt/ui/drawer.ts +33 -12
  21. package/.nuxt/ui/dropdown-menu.ts +57 -36
  22. package/.nuxt/ui/form-field.ts +29 -8
  23. package/.nuxt/ui/form.ts +23 -2
  24. package/.nuxt/ui/index.ts +1 -0
  25. package/.nuxt/ui/input-menu.ts +65 -44
  26. package/.nuxt/ui/input-number.ts +43 -22
  27. package/.nuxt/ui/input.ts +46 -25
  28. package/.nuxt/ui/kbd.ts +27 -6
  29. package/.nuxt/ui/link.ts +26 -5
  30. package/.nuxt/ui/modal.ts +28 -7
  31. package/.nuxt/ui/navigation-menu.ts +102 -83
  32. package/.nuxt/ui/pagination.ts +23 -2
  33. package/.nuxt/ui/pin-input.ts +43 -22
  34. package/.nuxt/ui/popover.ts +25 -4
  35. package/.nuxt/ui/progress.ts +40 -19
  36. package/.nuxt/ui/radio-group.ts +273 -37
  37. package/.nuxt/ui/select-menu.ts +59 -35
  38. package/.nuxt/ui/select.ts +55 -34
  39. package/.nuxt/ui/separator.ts +31 -10
  40. package/.nuxt/ui/skeleton.ts +24 -3
  41. package/.nuxt/ui/slideover.ts +27 -6
  42. package/.nuxt/ui/slider.ts +39 -18
  43. package/.nuxt/ui/stepper.ts +41 -20
  44. package/.nuxt/ui/switch.ts +43 -22
  45. package/.nuxt/ui/table.ts +38 -17
  46. package/.nuxt/ui/tabs.ts +55 -34
  47. package/.nuxt/ui/textarea.ts +63 -37
  48. package/.nuxt/ui/toast.ts +47 -26
  49. package/.nuxt/ui/toaster.ts +23 -2
  50. package/.nuxt/ui/tooltip.ts +25 -4
  51. package/.nuxt/ui/tree.ts +41 -20
  52. package/.nuxt/ui.css +56 -12
  53. package/README.md +11 -0
  54. package/cli/templates.mjs +18 -17
  55. package/dist/module.json +5 -5
  56. package/dist/module.mjs +11 -7
  57. package/dist/runtime/components/Accordion.vue +36 -93
  58. package/dist/runtime/components/Accordion.vue.d.ts +91 -0
  59. package/dist/runtime/components/Alert.vue +37 -100
  60. package/dist/runtime/components/Alert.vue.d.ts +96 -0
  61. package/dist/runtime/components/App.vue +28 -34
  62. package/dist/runtime/components/App.vue.d.ts +24 -0
  63. package/dist/runtime/components/Avatar.vue +42 -75
  64. package/dist/runtime/components/Avatar.vue.d.ts +60 -0
  65. package/dist/runtime/components/AvatarGroup.vue +40 -77
  66. package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
  67. package/dist/runtime/components/Badge.vue +33 -62
  68. package/dist/runtime/components/Badge.vue.d.ts +62 -0
  69. package/dist/runtime/components/Breadcrumb.vue +37 -90
  70. package/dist/runtime/components/Breadcrumb.vue.d.ts +82 -0
  71. package/dist/runtime/components/Button.vue +95 -104
  72. package/dist/runtime/components/Button.vue.d.ts +73 -0
  73. package/dist/runtime/components/ButtonGroup.vue +20 -46
  74. package/dist/runtime/components/ButtonGroup.vue.d.ts +55 -0
  75. package/dist/runtime/components/Calendar.vue +67 -150
  76. package/dist/runtime/components/Calendar.vue.d.ts +107 -0
  77. package/dist/runtime/components/Card.vue +18 -40
  78. package/dist/runtime/components/Card.vue.d.ts +38 -0
  79. package/dist/runtime/components/Carousel.vue +112 -234
  80. package/dist/runtime/components/Carousel.vue.d.ts +120 -0
  81. package/dist/runtime/components/Checkbox.vue +52 -93
  82. package/dist/runtime/components/Checkbox.vue.d.ts +76 -0
  83. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  84. package/dist/runtime/components/CheckboxGroup.vue.d.ts +75 -0
  85. package/dist/runtime/components/Chip.vue +26 -69
  86. package/dist/runtime/components/Chip.vue.d.ts +71 -0
  87. package/dist/runtime/components/Collapsible.vue +22 -41
  88. package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
  89. package/dist/runtime/components/ColorPicker.vue +111 -197
  90. package/dist/runtime/components/ColorPicker.vue.d.ts +63 -0
  91. package/dist/runtime/components/CommandPalette.vue +96 -237
  92. package/dist/runtime/components/CommandPalette.vue.d.ts +173 -0
  93. package/dist/runtime/components/Container.vue +15 -28
  94. package/dist/runtime/components/Container.vue.d.ts +27 -0
  95. package/dist/runtime/components/ContextMenu.vue +34 -133
  96. package/dist/runtime/components/ContextMenu.vue.d.ts +127 -0
  97. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  98. package/dist/runtime/components/ContextMenuContent.vue.d.ts +105 -0
  99. package/dist/runtime/components/Drawer.vue +49 -83
  100. package/dist/runtime/components/Drawer.vue.d.ts +88 -0
  101. package/dist/runtime/components/DropdownMenu.vue +39 -142
  102. package/dist/runtime/components/DropdownMenu.vue.d.ts +141 -0
  103. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  104. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +55 -0
  105. package/dist/runtime/components/Form.vue +135 -220
  106. package/dist/runtime/components/Form.vue.d.ts +66 -0
  107. package/dist/runtime/components/FormField.vue +35 -77
  108. package/dist/runtime/components/FormField.vue.d.ts +70 -0
  109. package/dist/runtime/components/Icon.vue +12 -19
  110. package/dist/runtime/components/Icon.vue.d.ts +17 -0
  111. package/dist/runtime/components/Input.vue +82 -140
  112. package/dist/runtime/components/Input.vue.d.ts +91 -0
  113. package/dist/runtime/components/InputMenu.vue +185 -332
  114. package/dist/runtime/components/InputMenu.vue.d.ts +312 -0
  115. package/dist/runtime/components/InputNumber.vue +71 -133
  116. package/dist/runtime/components/InputNumber.vue.d.ts +193 -0
  117. package/dist/runtime/components/Kbd.vue +20 -46
  118. package/dist/runtime/components/Kbd.vue.d.ts +55 -0
  119. package/dist/runtime/components/Link.vue +98 -176
  120. package/dist/runtime/components/Link.vue.d.ts +124 -0
  121. package/dist/runtime/components/LinkBase.vue +33 -42
  122. package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
  123. package/dist/runtime/components/Modal.vue +53 -116
  124. package/dist/runtime/components/Modal.vue.d.ts +109 -0
  125. package/dist/runtime/components/NavigationMenu.vue +77 -209
  126. package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
  127. package/dist/runtime/components/OverlayProvider.vue +14 -18
  128. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  129. package/dist/runtime/components/Pagination.vue +46 -140
  130. package/dist/runtime/components/Pagination.vue.d.ts +143 -0
  131. package/dist/runtime/components/PinInput.vue +61 -78
  132. package/dist/runtime/components/PinInput.vue.d.ts +68 -0
  133. package/dist/runtime/components/Popover.vue +47 -84
  134. package/dist/runtime/components/Popover.vue.d.ts +80 -0
  135. package/dist/runtime/components/Progress.vue +70 -131
  136. package/dist/runtime/components/Progress.vue.d.ts +97 -0
  137. package/dist/runtime/components/RadioGroup.vue +70 -132
  138. package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
  139. package/dist/runtime/components/Select.vue +110 -224
  140. package/dist/runtime/components/Select.vue.d.ts +139 -0
  141. package/dist/runtime/components/SelectMenu.vue +161 -310
  142. package/dist/runtime/components/SelectMenu.vue.d.ts +184 -0
  143. package/dist/runtime/components/Separator.vue +29 -71
  144. package/dist/runtime/components/Separator.vue.d.ts +75 -0
  145. package/dist/runtime/components/Skeleton.vue +21 -23
  146. package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
  147. package/dist/runtime/components/Slideover.vue +53 -120
  148. package/dist/runtime/components/Slideover.vue.d.ts +111 -0
  149. package/dist/runtime/components/Slider.vue +46 -84
  150. package/dist/runtime/components/Slider.vue.d.ts +71 -0
  151. package/dist/runtime/components/Stepper.vue +45 -115
  152. package/dist/runtime/components/Stepper.vue.d.ts +89 -0
  153. package/dist/runtime/components/Switch.vue +45 -93
  154. package/dist/runtime/components/Switch.vue.d.ts +73 -0
  155. package/dist/runtime/components/Table.vue +163 -267
  156. package/dist/runtime/components/Table.vue.d.ts +183 -0
  157. package/dist/runtime/components/Tabs.vue +41 -107
  158. package/dist/runtime/components/Tabs.vue.d.ts +104 -0
  159. package/dist/runtime/components/Textarea.vue +113 -158
  160. package/dist/runtime/components/Textarea.vue.d.ts +95 -0
  161. package/dist/runtime/components/Toast.vue +49 -110
  162. package/dist/runtime/components/Toast.vue.d.ts +95 -0
  163. package/dist/runtime/components/Toaster.vue +70 -107
  164. package/dist/runtime/components/Toaster.vue.d.ts +63 -0
  165. package/dist/runtime/components/Tooltip.vue +38 -65
  166. package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
  167. package/dist/runtime/components/Tree.vue +59 -166
  168. package/dist/runtime/components/Tree.vue.d.ts +128 -0
  169. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  170. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  171. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  172. package/dist/runtime/composables/useFormField.d.ts +2 -2
  173. package/dist/runtime/composables/useOverlay.d.ts +14 -7
  174. package/dist/runtime/composables/useOverlay.js +14 -6
  175. package/dist/runtime/composables/usePortal.d.ts +6 -0
  176. package/dist/runtime/composables/usePortal.js +17 -0
  177. package/dist/runtime/index.css +1 -1
  178. package/dist/runtime/inertia/components/Link.vue +146 -0
  179. package/dist/runtime/inertia/components/Link.vue.d.ts +92 -0
  180. package/dist/runtime/inertia/stubs.d.ts +43 -0
  181. package/dist/runtime/inertia/stubs.js +82 -0
  182. package/dist/runtime/locale/bg.d.ts +3 -0
  183. package/dist/runtime/locale/bg.js +54 -0
  184. package/dist/runtime/locale/index.d.ts +5 -1
  185. package/dist/runtime/locale/index.js +5 -1
  186. package/dist/runtime/locale/kk.d.ts +3 -0
  187. package/dist/runtime/locale/kk.js +54 -0
  188. package/dist/runtime/locale/tj.d.ts +3 -0
  189. package/dist/runtime/locale/tj.js +54 -0
  190. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  191. package/dist/runtime/locale/ug_cn.js +55 -0
  192. package/dist/runtime/types/form.d.ts +4 -1
  193. package/dist/runtime/types/index.d.ts +1 -0
  194. package/dist/runtime/types/index.js +1 -0
  195. package/dist/runtime/types/utils.d.ts +47 -7
  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 +14 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +124 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.D7lOOabO.mjs} +621 -362
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +4 -0
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.mjs +1 -1
  209. package/package.json +94 -53
  210. package/dist/module.cjs +0 -62
  211. package/dist/module.d.cts +0 -45
  212. package/dist/module.d.ts +0 -45
  213. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  214. package/dist/types.d.ts +0 -7
  215. package/dist/unplugin.cjs +0 -232
  216. package/dist/unplugin.d.cts +0 -62
  217. package/dist/unplugin.d.ts +0 -62
  218. package/dist/vite.cjs +0 -23
  219. package/dist/vite.d.cts +0 -15
  220. package/dist/vite.d.ts +0 -15
@@ -1,158 +1,75 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootProps, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
4
- import type { DateValue } from '@internationalized/date'
5
- import type { AppConfig } from '@nuxt/schema'
6
- import type { ButtonProps } from '../types'
7
- import _appConfig from '#build/app.config'
8
- import theme from '#build/ui/calendar'
9
- import { tv } from '../utils/tv'
10
- import type { PartialString } from '../types/utils'
11
-
12
- const appConfigCalendar = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
13
-
14
- const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.ui?.calendar || {}) })
15
-
16
- type CalendarVariants = VariantProps<typeof calendar>
17
-
18
- type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true
19
- ? DateRange
20
- : M extends true
21
- ? DateValue[]
22
- : DateValue
23
- type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
24
- ? (DateRange | null)
25
- : M extends true
26
- ? (DateValue[] | undefined)
27
- : (DateValue | undefined)
28
-
29
- type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
30
- type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
31
-
32
- export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends _RangeCalendarRootProps, _CalendarRootProps {
33
- /**
34
- * The element or component this component should render as.
35
- * @defaultValue 'div'
36
- */
37
- as?: any
38
- /**
39
- * The icon to use for the next year control.
40
- * @defaultValue appConfig.ui.icons.chevronDoubleRight
41
- * @IconifyIcon
42
- */
43
- nextYearIcon?: string
44
- /**
45
- * Configure the next year button.
46
- * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
47
- */
48
- nextYear?: ButtonProps
49
- /**
50
- * The icon to use for the next month control.
51
- * @defaultValue appConfig.ui.icons.chevronRight
52
- * @IconifyIcon
53
- */
54
- nextMonthIcon?: string
55
- /**
56
- * Configure the next month button.
57
- * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
58
- */
59
- nextMonth?: ButtonProps
60
- /**
61
- * The icon to use for the previous year control.
62
- * @defaultValue appConfig.ui.icons.chevronDoubleLeft
63
- * @IconifyIcon
64
- */
65
- prevYearIcon?: string
66
- /**
67
- * Configure the prev year button.
68
- * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
69
- */
70
- prevYear?: ButtonProps
71
- /**
72
- * The icon to use for the previous month control.
73
- * @defaultValue appConfig.ui.icons.chevronLeft
74
- * @IconifyIcon
75
- */
76
- prevMonthIcon?: string
77
- /**
78
- * Configure the prev month button.
79
- * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
80
- */
81
- prevMonth?: ButtonProps
82
- /**
83
- * @defaultValue 'primary'
84
- */
85
- color?: CalendarVariants['color']
86
- /**
87
- * @defaultValue 'md'
88
- */
89
- size?: CalendarVariants['size']
90
- /** Whether or not a range of dates can be selected */
91
- range?: R & boolean
92
- /** Whether or not multiple dates can be selected */
93
- multiple?: M & boolean
94
- /** Show month controls */
95
- monthControls?: boolean
96
- /** Show year controls */
97
- yearControls?: boolean
98
- defaultValue?: CalendarDefaultValue<R, M>
99
- modelValue?: CalendarModelValue<R, M>
100
- class?: any
101
- ui?: PartialString<typeof calendar.slots>
102
- }
103
-
104
- export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
105
- 'update:modelValue': [date: CalendarModelValue<R, M>]
106
- }
107
-
108
- export interface CalendarSlots {
109
- 'heading': (props: { value: string }) => any
110
- 'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
111
- 'week-day': (props: { day: string }) => any
112
- }
1
+ <script>
2
+ import theme from "#build/ui/calendar";
113
3
  </script>
114
4
 
115
- <script setup lang="ts" generic="R extends boolean, M extends boolean">
116
- import { computed } from 'vue'
117
- import { useForwardPropsEmits } from 'reka-ui'
118
- import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
119
- import { reactiveOmit } from '@vueuse/core'
120
- import { useAppConfig } from '#imports'
121
- import { useLocale } from '../composables/useLocale'
122
- import UButton from './Button.vue'
123
-
124
- const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
125
- fixedWeeks: true,
126
- monthControls: true,
127
- yearControls: true
128
- })
129
- const emits = defineEmits<CalendarEmits<R, M>>()
130
- defineSlots<CalendarSlots>()
131
-
132
- const appConfig = useAppConfig()
133
- const { code: locale, dir, t } = useLocale()
134
-
135
- const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits)
136
-
137
- const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
138
- const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
139
- const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
140
- const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
141
-
142
- const ui = computed(() => calendar({
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { useForwardPropsEmits } from "reka-ui";
8
+ import { Calendar as SingleCalendar, RangeCalendar } from "reka-ui/namespaced";
9
+ import { reactiveOmit } 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
+ nextYearIcon: { type: String, required: false },
17
+ nextYear: { type: Object, required: false },
18
+ nextMonthIcon: { type: String, required: false },
19
+ nextMonth: { type: Object, required: false },
20
+ prevYearIcon: { type: String, required: false },
21
+ prevYear: { type: Object, required: false },
22
+ prevMonthIcon: { type: String, required: false },
23
+ prevMonth: { type: Object, required: false },
24
+ color: { type: null, required: false },
25
+ size: { type: null, required: false },
26
+ range: { type: Boolean, required: false },
27
+ multiple: { type: Boolean, required: false },
28
+ monthControls: { type: Boolean, required: false, default: true },
29
+ yearControls: { type: Boolean, required: false, default: true },
30
+ defaultValue: { type: null, required: false },
31
+ modelValue: { type: null, required: false },
32
+ class: { type: null, required: false },
33
+ ui: { type: null, required: false },
34
+ defaultPlaceholder: { type: null, required: false },
35
+ placeholder: { type: null, required: false },
36
+ allowNonContiguousRanges: { type: Boolean, required: false },
37
+ pagedNavigation: { type: Boolean, required: false },
38
+ preventDeselect: { type: Boolean, required: false },
39
+ weekStartsOn: { type: Number, required: false },
40
+ weekdayFormat: { type: String, required: false },
41
+ fixedWeeks: { type: Boolean, required: false, default: true },
42
+ maxValue: { type: null, required: false },
43
+ minValue: { type: null, required: false },
44
+ numberOfMonths: { type: Number, required: false },
45
+ disabled: { type: Boolean, required: false },
46
+ readonly: { type: Boolean, required: false },
47
+ initialFocus: { type: Boolean, required: false },
48
+ isDateDisabled: { type: Function, required: false },
49
+ isDateUnavailable: { type: Function, required: false },
50
+ nextPage: { type: Function, required: false },
51
+ prevPage: { type: Function, required: false }
52
+ });
53
+ const emits = defineEmits(["update:modelValue", "update:placeholder", "update:startValue"]);
54
+ defineSlots();
55
+ const { code: locale, dir, t } = useLocale();
56
+ const appConfig = useAppConfig();
57
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "color", "size", "monthControls", "yearControls", "class", "ui"), emits);
58
+ const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight));
59
+ const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
60
+ const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft));
61
+ const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft));
62
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.calendar || {} })({
143
63
  color: props.color,
144
64
  size: props.size
145
- }))
146
-
147
- function paginateYear(date: DateValue, sign: -1 | 1) {
65
+ }));
66
+ function paginateYear(date, sign) {
148
67
  if (sign === -1) {
149
- return date.subtract({ years: 1 })
68
+ return date.subtract({ years: 1 });
150
69
  }
151
-
152
- return date.add({ years: 1 })
70
+ return date.add({ years: 1 });
153
71
  }
154
-
155
- const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
72
+ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar);
156
73
  </script>
157
74
 
158
75
  <template>
@@ -166,7 +83,7 @@ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
166
83
  :class="ui.root({ class: [props.class, props.ui?.root] })"
167
84
  >
168
85
  <Calendar.Header :class="ui.header({ class: props.ui?.header })">
169
- <Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
86
+ <Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
170
87
  <UButton :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevYear" />
171
88
  </Calendar.Prev>
172
89
  <Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
@@ -180,7 +97,7 @@ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
180
97
  <Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
181
98
  <UButton :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextMonth" />
182
99
  </Calendar.Next>
183
- <Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
100
+ <Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
184
101
  <UButton :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextYear" />
185
102
  </Calendar.Next>
186
103
  </Calendar.Header>
@@ -0,0 +1,107 @@
1
+ import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootProps, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/calendar';
5
+ import type { ButtonProps } from '../types';
6
+ import type { ComponentConfig } from '../types/utils';
7
+ type Calendar = ComponentConfig<typeof theme, AppConfig, 'calendar'>;
8
+ type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true ? DateRange : M extends true ? DateValue[] : DateValue;
9
+ type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true ? (DateRange | null) : M extends true ? (DateValue[] | undefined) : (DateValue | undefined);
10
+ type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
11
+ type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
12
+ export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends _RangeCalendarRootProps, _CalendarRootProps {
13
+ /**
14
+ * The element or component this component should render as.
15
+ * @defaultValue 'div'
16
+ */
17
+ as?: any;
18
+ /**
19
+ * The icon to use for the next year control.
20
+ * @defaultValue appConfig.ui.icons.chevronDoubleRight
21
+ * @IconifyIcon
22
+ */
23
+ nextYearIcon?: string;
24
+ /**
25
+ * Configure the next year button.
26
+ * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
27
+ */
28
+ nextYear?: ButtonProps;
29
+ /**
30
+ * The icon to use for the next month control.
31
+ * @defaultValue appConfig.ui.icons.chevronRight
32
+ * @IconifyIcon
33
+ */
34
+ nextMonthIcon?: string;
35
+ /**
36
+ * Configure the next month button.
37
+ * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
38
+ */
39
+ nextMonth?: ButtonProps;
40
+ /**
41
+ * The icon to use for the previous year control.
42
+ * @defaultValue appConfig.ui.icons.chevronDoubleLeft
43
+ * @IconifyIcon
44
+ */
45
+ prevYearIcon?: string;
46
+ /**
47
+ * Configure the prev year button.
48
+ * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
49
+ */
50
+ prevYear?: ButtonProps;
51
+ /**
52
+ * The icon to use for the previous month control.
53
+ * @defaultValue appConfig.ui.icons.chevronLeft
54
+ * @IconifyIcon
55
+ */
56
+ prevMonthIcon?: string;
57
+ /**
58
+ * Configure the prev month button.
59
+ * `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
60
+ */
61
+ prevMonth?: ButtonProps;
62
+ /**
63
+ * @defaultValue 'primary'
64
+ */
65
+ color?: Calendar['variants']['color'];
66
+ /**
67
+ * @defaultValue 'md'
68
+ */
69
+ size?: Calendar['variants']['size'];
70
+ /** Whether or not a range of dates can be selected */
71
+ range?: R & boolean;
72
+ /** Whether or not multiple dates can be selected */
73
+ multiple?: M & boolean;
74
+ /** Show month controls */
75
+ monthControls?: boolean;
76
+ /** Show year controls */
77
+ yearControls?: boolean;
78
+ defaultValue?: CalendarDefaultValue<R, M>;
79
+ modelValue?: CalendarModelValue<R, M>;
80
+ class?: any;
81
+ ui?: Calendar['slots'];
82
+ }
83
+ export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
84
+ 'update:modelValue': [date: CalendarModelValue<R, M>];
85
+ }
86
+ export interface CalendarSlots {
87
+ 'heading': (props: {
88
+ value: string;
89
+ }) => any;
90
+ 'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any;
91
+ 'week-day': (props: {
92
+ day: string;
93
+ }) => any;
94
+ }
95
+ 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<{
96
+ props: __VLS_PrettifyLocal<any & CalendarProps<R, M> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
97
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
98
+ attrs: any;
99
+ slots: Readonly<CalendarSlots> & CalendarSlots;
100
+ 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);
101
+ }>) => import("vue").VNode & {
102
+ __ctx?: Awaited<typeof __VLS_setup>;
103
+ };
104
+ export default _default;
105
+ type __VLS_PrettifyLocal<T> = {
106
+ [K in keyof T]: T[K];
107
+ } & {};
@@ -1,45 +1,23 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/card'
6
- import { tv } from '../utils/tv'
7
-
8
- const appConfigCard = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
9
-
10
- const card = tv({ extend: tv(theme), ...(appConfigCard.ui?.card || {}) })
11
-
12
- type CardVariants = VariantProps<typeof card>
13
-
14
- export interface CardProps {
15
- /**
16
- * The element or component this component should render as.
17
- * @defaultValue 'div'
18
- */
19
- as?: any
20
- /**
21
- * @defaultValue 'outline'
22
- */
23
- variant?: CardVariants['variant']
24
- class?: any
25
- ui?: Partial<typeof card.slots>
26
- }
27
-
28
- export interface CardSlots {
29
- header(props?: {}): any
30
- default(props?: {}): any
31
- footer(props?: {}): any
32
- }
1
+ <script>
2
+ import theme from "#build/ui/card";
33
3
  </script>
34
4
 
35
- <script setup lang="ts">
36
- import { computed } from 'vue'
37
- import { Primitive } from 'reka-ui'
38
-
39
- const props = defineProps<CardProps>()
40
- const slots = defineSlots<CardSlots>()
41
-
42
- const ui = computed(() => card({ variant: props.variant }))
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive } from "reka-ui";
8
+ import { useAppConfig } from "#imports";
9
+ import { tv } from "../utils/tv";
10
+ const props = defineProps({
11
+ as: { type: null, required: false },
12
+ variant: { type: null, required: false },
13
+ class: { type: null, required: false },
14
+ ui: { type: null, required: false }
15
+ });
16
+ const slots = defineSlots();
17
+ const appConfig = useAppConfig();
18
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.card || {} })({
19
+ variant: props.variant
20
+ }));
43
21
  </script>
44
22
 
45
23
  <template>
@@ -0,0 +1,38 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import theme from '#build/ui/card';
3
+ import type { ComponentConfig } from '../types/utils';
4
+ type Card = ComponentConfig<typeof theme, AppConfig, 'card'>;
5
+ export interface CardProps {
6
+ /**
7
+ * The element or component this component should render as.
8
+ * @defaultValue 'div'
9
+ */
10
+ as?: any;
11
+ /**
12
+ * @defaultValue 'outline'
13
+ */
14
+ variant?: Card['variants']['variant'];
15
+ class?: any;
16
+ ui?: Card['slots'];
17
+ }
18
+ export interface CardSlots {
19
+ header(props?: {}): any;
20
+ default(props?: {}): any;
21
+ footer(props?: {}): any;
22
+ }
23
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<CardProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<CardProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<CardSlots> & CardSlots>;
24
+ export default _default;
25
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
26
+ type __VLS_TypePropsToOption<T> = {
27
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
28
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
29
+ } : {
30
+ type: import('vue').PropType<T[K]>;
31
+ required: true;
32
+ };
33
+ };
34
+ type __VLS_WithTemplateSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };