@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,143 +1,49 @@
1
- <script lang="ts">
2
- import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui'
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/pagination'
6
- import { tv } from '../utils/tv'
7
- import type { ButtonProps } from '../types'
8
-
9
- const appConfigPagination = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }
10
-
11
- const pagination = tv({ extend: tv(theme), ...(appConfigPagination.ui?.pagination || {}) })
12
-
13
- export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'>> {
14
- /**
15
- * The element or component this component should render as.
16
- * @defaultValue 'div'
17
- */
18
- as?: any
19
- /**
20
- * The icon to use for the first page control.
21
- * @defaultValue appConfig.ui.icons.chevronDoubleLeft
22
- * @IconifyIcon
23
- */
24
- firstIcon?: string
25
- /**
26
- * The icon to use for the previous page control.
27
- * @defaultValue appConfig.ui.icons.chevronLeft
28
- * @IconifyIcon
29
- */
30
- prevIcon?: string
31
- /**
32
- * The icon to use for the next page control.
33
- * @defaultValue appConfig.ui.icons.chevronRight
34
- * @IconifyIcon
35
- */
36
- nextIcon?: string
37
- /**
38
- * The icon to use for the last page control.
39
- * @defaultValue appConfig.ui.icons.chevronDoubleRight
40
- * @IconifyIcon
41
- */
42
- lastIcon?: string
43
- /**
44
- * The icon to use for the ellipsis control.
45
- * @defaultValue appConfig.ui.icons.ellipsis
46
- * @IconifyIcon
47
- */
48
- ellipsisIcon?: string
49
- /**
50
- * The color of the pagination controls.
51
- * @defaultValue 'neutral'
52
- * @IconifyIcon
53
- */
54
- color?: ButtonProps['color']
55
- /**
56
- * The variant of the pagination controls.
57
- * @defaultValue 'outline'
58
- */
59
- variant?: ButtonProps['variant']
60
- /**
61
- * The color of the active pagination control.
62
- * @defaultValue 'primary'
63
- */
64
- activeColor?: ButtonProps['color']
65
- /**
66
- * The variant of the active pagination control.
67
- * @defaultValue 'solid'
68
- */
69
- activeVariant?: ButtonProps['variant']
70
- /**
71
- * Whether to show the first, previous, next, and last controls.
72
- * @defaultValue true
73
- */
74
- showControls?: boolean
75
- size?: ButtonProps['size']
76
- /**
77
- * A function to render page controls as links.
78
- * @param page The page number to navigate to.
79
- */
80
- to?: (page: number) => ButtonProps['to']
81
- class?: any
82
- ui?: Partial<typeof pagination.slots>
83
- }
84
-
85
- export interface PaginationEmits extends PaginationRootEmits {}
86
-
87
- export interface PaginationSlots {
88
- first(props?: {}): any
89
- prev(props?: {}): any
90
- next(props?: {}): any
91
- last(props?: {}): any
92
- ellipsis(props?: {}): any
93
- item(props: {
94
- page: number
95
- pageCount: number
96
- item: {
97
- type: 'ellipsis'
98
- } | {
99
- type: 'page'
100
- value: number
101
- }
102
- index: number
103
- }): any
104
- }
1
+ <script>
2
+ import theme from "#build/ui/pagination";
105
3
  </script>
106
4
 
107
- <script setup lang="ts">
108
- import { computed } from 'vue'
109
- import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from 'reka-ui'
110
- import { reactivePick } from '@vueuse/core'
111
- import { useAppConfig } from '#imports'
112
- import { useLocale } from '../composables/useLocale'
113
- import UButton from './Button.vue'
114
-
115
- const props = withDefaults(defineProps<PaginationProps>(), {
116
- size: 'md',
117
- color: 'neutral',
118
- variant: 'outline',
119
- activeColor: 'primary',
120
- activeVariant: 'solid',
121
- showControls: true,
122
- showEdges: false,
123
- itemsPerPage: 10,
124
- siblingCount: 2,
125
- total: 0
126
- })
127
- const emits = defineEmits<PaginationEmits>()
128
- const slots = defineSlots<PaginationSlots>()
129
-
130
- const appConfig = useAppConfig()
131
- const { dir } = useLocale()
132
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emits)
133
-
134
- const firstIcon = computed(() => props.firstIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
135
- const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
136
- const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
137
- const lastIcon = computed(() => props.lastIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
138
-
139
- // eslint-disable-next-line vue/no-dupe-keys
140
- const ui = pagination()
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useLocale } from "../composables/useLocale";
11
+ import { tv } from "../utils/tv";
12
+ import UButton from "./Button.vue";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ firstIcon: { type: String, required: false },
16
+ prevIcon: { type: String, required: false },
17
+ nextIcon: { type: String, required: false },
18
+ lastIcon: { type: String, required: false },
19
+ ellipsisIcon: { type: String, required: false },
20
+ color: { type: null, required: false, default: "neutral" },
21
+ variant: { type: null, required: false, default: "outline" },
22
+ activeColor: { type: null, required: false, default: "primary" },
23
+ activeVariant: { type: null, required: false, default: "solid" },
24
+ showControls: { type: Boolean, required: false, default: true },
25
+ size: { type: null, required: false, default: "md" },
26
+ to: { type: Function, required: false },
27
+ class: { type: null, required: false },
28
+ ui: { type: null, required: false },
29
+ defaultPage: { type: Number, required: false },
30
+ disabled: { type: Boolean, required: false },
31
+ itemsPerPage: { type: Number, required: false, default: 10 },
32
+ page: { type: Number, required: false },
33
+ showEdges: { type: Boolean, required: false, default: false },
34
+ siblingCount: { type: Number, required: false, default: 2 },
35
+ total: { type: Number, required: false, default: 0 }
36
+ });
37
+ const emits = defineEmits(["update:page"]);
38
+ const slots = defineSlots();
39
+ const { dir } = useLocale();
40
+ const appConfig = useAppConfig();
41
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "defaultPage", "disabled", "itemsPerPage", "page", "showEdges", "siblingCount", "total"), emits);
42
+ const firstIcon = computed(() => props.firstIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft));
43
+ const prevIcon = computed(() => props.prevIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft));
44
+ const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
45
+ const lastIcon = computed(() => props.lastIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight));
46
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.pagination || {} })());
141
47
  </script>
142
48
 
143
49
  <template>
@@ -150,7 +56,7 @@ const ui = pagination()
150
56
  </PaginationFirst>
151
57
  <PaginationPrev v-if="showControls || !!slots.prev" as-child :class="ui.prev({ class: props.ui?.prev })">
152
58
  <slot name="prev">
153
- <UButton :color="color" :variant="variant" :size="size" :icon="prevIcon" :to="page > 1 ? to?.(page - 1) : undefined" />
59
+ <UButton :color="color" :variant="variant" :size="size" :icon="prevIcon" :to="page > 1 ? to?.(page - 1) : void 0" />
154
60
  </slot>
155
61
  </PaginationPrev>
156
62
 
@@ -178,7 +84,7 @@ const ui = pagination()
178
84
 
179
85
  <PaginationNext v-if="showControls || !!slots.next" as-child :class="ui.next({ class: props.ui?.next })">
180
86
  <slot name="next">
181
- <UButton :color="color" :variant="variant" :size="size" :icon="nextIcon" :to="page < pageCount ? to?.(page + 1) : undefined" />
87
+ <UButton :color="color" :variant="variant" :size="size" :icon="nextIcon" :to="page < pageCount ? to?.(page + 1) : void 0" />
182
88
  </slot>
183
89
  </PaginationNext>
184
90
  <PaginationLast v-if="showControls || !!slots.last" as-child :class="ui.last({ class: props.ui?.last })">
@@ -0,0 +1,143 @@
1
+ import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/pagination';
4
+ import type { ButtonProps } from '../types';
5
+ import type { ComponentConfig } from '../types/utils';
6
+ type Pagination = ComponentConfig<typeof theme, AppConfig, 'pagination'>;
7
+ export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'>> {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @defaultValue 'div'
11
+ */
12
+ as?: any;
13
+ /**
14
+ * The icon to use for the first page control.
15
+ * @defaultValue appConfig.ui.icons.chevronDoubleLeft
16
+ * @IconifyIcon
17
+ */
18
+ firstIcon?: string;
19
+ /**
20
+ * The icon to use for the previous page control.
21
+ * @defaultValue appConfig.ui.icons.chevronLeft
22
+ * @IconifyIcon
23
+ */
24
+ prevIcon?: string;
25
+ /**
26
+ * The icon to use for the next page control.
27
+ * @defaultValue appConfig.ui.icons.chevronRight
28
+ * @IconifyIcon
29
+ */
30
+ nextIcon?: string;
31
+ /**
32
+ * The icon to use for the last page control.
33
+ * @defaultValue appConfig.ui.icons.chevronDoubleRight
34
+ * @IconifyIcon
35
+ */
36
+ lastIcon?: string;
37
+ /**
38
+ * The icon to use for the ellipsis control.
39
+ * @defaultValue appConfig.ui.icons.ellipsis
40
+ * @IconifyIcon
41
+ */
42
+ ellipsisIcon?: string;
43
+ /**
44
+ * The color of the pagination controls.
45
+ * @defaultValue 'neutral'
46
+ * @IconifyIcon
47
+ */
48
+ color?: ButtonProps['color'];
49
+ /**
50
+ * The variant of the pagination controls.
51
+ * @defaultValue 'outline'
52
+ */
53
+ variant?: ButtonProps['variant'];
54
+ /**
55
+ * The color of the active pagination control.
56
+ * @defaultValue 'primary'
57
+ */
58
+ activeColor?: ButtonProps['color'];
59
+ /**
60
+ * The variant of the active pagination control.
61
+ * @defaultValue 'solid'
62
+ */
63
+ activeVariant?: ButtonProps['variant'];
64
+ /**
65
+ * Whether to show the first, previous, next, and last controls.
66
+ * @defaultValue true
67
+ */
68
+ showControls?: boolean;
69
+ size?: ButtonProps['size'];
70
+ /**
71
+ * A function to render page controls as links.
72
+ * @param page The page number to navigate to.
73
+ */
74
+ to?: (page: number) => ButtonProps['to'];
75
+ class?: any;
76
+ ui?: Pagination['slots'];
77
+ }
78
+ export interface PaginationEmits extends PaginationRootEmits {
79
+ }
80
+ export interface PaginationSlots {
81
+ first(props?: {}): any;
82
+ prev(props?: {}): any;
83
+ next(props?: {}): any;
84
+ last(props?: {}): any;
85
+ ellipsis(props?: {}): any;
86
+ item(props: {
87
+ page: number;
88
+ pageCount: number;
89
+ item: {
90
+ type: 'ellipsis';
91
+ } | {
92
+ type: 'page';
93
+ value: number;
94
+ };
95
+ index: number;
96
+ }): any;
97
+ }
98
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<PaginationProps>, {
99
+ size: string;
100
+ color: string;
101
+ variant: string;
102
+ activeColor: string;
103
+ activeVariant: string;
104
+ showControls: boolean;
105
+ showEdges: boolean;
106
+ itemsPerPage: number;
107
+ siblingCount: number;
108
+ total: number;
109
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
110
+ size: "md" | "xs" | "sm" | "lg" | "xl";
111
+ color: "error" | "info" | "primary" | "secondary" | "success" | "warning" | "neutral";
112
+ variant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
113
+ activeColor: "error" | "info" | "primary" | "secondary" | "success" | "warning" | "neutral";
114
+ activeVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
115
+ itemsPerPage: number;
116
+ showEdges: boolean;
117
+ siblingCount: number;
118
+ total: number;
119
+ showControls: boolean;
120
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<PaginationSlots> & PaginationSlots>;
121
+ export default _default;
122
+ type __VLS_WithDefaults<P, D> = {
123
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
124
+ default: D[K];
125
+ }> : P[K];
126
+ };
127
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
128
+ type __VLS_TypePropsToOption<T> = {
129
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
130
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
131
+ } : {
132
+ type: import('vue').PropType<T[K]>;
133
+ required: true;
134
+ };
135
+ };
136
+ type __VLS_WithTemplateSlots<T, S> = T & {
137
+ new (): {
138
+ $slots: S;
139
+ };
140
+ };
141
+ type __VLS_PrettifyLocal<T> = {
142
+ [K in keyof T]: T[K];
143
+ } & {};
@@ -1,91 +1,73 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { VariantProps } from 'tailwind-variants'
4
- import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui'
5
- import type { AppConfig } from '@nuxt/schema'
6
- import _appConfig from '#build/app.config'
7
- import theme from '#build/ui/pin-input'
8
- import { tv } from '../utils/tv'
9
- import type { PartialString } from '../types/utils'
10
-
11
- const appConfigPinInput = _appConfig as AppConfig & { ui: { pinInput: Partial<typeof theme> } }
12
-
13
- const pinInput = tv({ extend: tv(theme), ...(appConfigPinInput.ui?.pinInput || {}) })
14
-
15
- type PinInputVariants = VariantProps<typeof pinInput>
16
-
17
- export interface PinInputProps extends Pick<PinInputRootProps, 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
18
- /**
19
- * The element or component this component should render as.
20
- * @defaultValue 'div'
21
- */
22
- as?: any
23
- /**
24
- * @defaultValue 'primary'
25
- */
26
- color?: PinInputVariants['color']
27
- /**
28
- * @defaultValue 'outline'
29
- */
30
- variant?: PinInputVariants['variant']
31
- /**
32
- * @defaultValue 'md'
33
- */
34
- size?: PinInputVariants['size']
35
- /**
36
- * The number of input fields.
37
- * @defaultValue 5
38
- */
39
- length?: number | string
40
- highlight?: boolean
41
- class?: any
42
- ui?: PartialString<typeof pinInput.slots>
43
- }
44
-
45
- export type PinInputEmits = PinInputRootEmits & {
46
- change: [payload: Event]
47
- blur: [payload: Event]
48
- }
49
-
1
+ <script>
2
+ import theme from "#build/ui/pin-input";
50
3
  </script>
51
4
 
52
- <script setup lang="ts">
53
- import { ref, computed } from 'vue'
54
- import { PinInputInput, PinInputRoot, useForwardPropsEmits } from 'reka-ui'
55
- import { reactivePick } from '@vueuse/core'
56
- import { useFormField } from '../composables/useFormField'
57
- import { looseToNumber } from '../utils'
58
-
59
- const props = withDefaults(defineProps<PinInputProps>(), {
60
- type: 'text',
61
- length: 5
62
- })
63
- const emits = defineEmits<PinInputEmits>()
64
-
65
- const rootProps = useForwardPropsEmits(reactivePick(props, 'defaultValue', 'disabled', 'id', 'mask', 'modelValue', 'name', 'otp', 'placeholder', 'required', 'type'), emits)
66
- const { emitFormInput, emitFormFocus, emitFormChange, emitFormBlur, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField<PinInputProps>(props)
67
-
68
- const ui = computed(() => pinInput({
5
+ <script setup>
6
+ import { ref, computed, onMounted } from "vue";
7
+ import { PinInputInput, PinInputRoot, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { looseToNumber } from "../utils";
12
+ import { tv } from "../utils/tv";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ color: { type: null, required: false },
16
+ variant: { type: null, required: false },
17
+ size: { type: null, required: false },
18
+ length: { type: [Number, String], required: false, default: 5 },
19
+ autofocus: { type: Boolean, required: false },
20
+ autofocusDelay: { type: Number, required: false, default: 0 },
21
+ highlight: { type: Boolean, required: false },
22
+ class: { type: null, required: false },
23
+ ui: { type: null, required: false },
24
+ defaultValue: { type: Array, required: false },
25
+ disabled: { type: Boolean, required: false },
26
+ id: { type: String, required: false },
27
+ mask: { type: Boolean, required: false },
28
+ modelValue: { type: [Array, null], required: false },
29
+ name: { type: String, required: false },
30
+ otp: { type: Boolean, required: false },
31
+ placeholder: { type: String, required: false },
32
+ required: { type: Boolean, required: false },
33
+ type: { type: String, required: false, default: "text" }
34
+ });
35
+ const emits = defineEmits(["update:modelValue", "complete", "change", "blur"]);
36
+ const appConfig = useAppConfig();
37
+ const rootProps = useForwardPropsEmits(reactivePick(props, "defaultValue", "disabled", "id", "mask", "modelValue", "name", "otp", "placeholder", "required", "type"), emits);
38
+ const { emitFormInput, emitFormFocus, emitFormChange, emitFormBlur, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
39
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.pinInput || {} })({
69
40
  color: color.value,
70
41
  variant: props.variant,
71
42
  size: size.value,
72
43
  highlight: highlight.value
73
- }))
74
-
75
- const completed = ref(false)
76
- function onComplete(value: string[]) {
77
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
78
- const event = new Event('change', { target: { value } })
79
- emits('change', event)
80
- emitFormChange()
44
+ }));
45
+ const inputsRef = ref([]);
46
+ const completed = ref(false);
47
+ function onComplete(value) {
48
+ const event = new Event("change", { target: { value } });
49
+ emits("change", event);
50
+ emitFormChange();
81
51
  }
82
-
83
- function onBlur(event: FocusEvent) {
52
+ function onBlur(event) {
84
53
  if (!event.relatedTarget || completed.value) {
85
- emits('blur', event)
86
- emitFormBlur()
54
+ emits("blur", event);
55
+ emitFormBlur();
56
+ }
57
+ }
58
+ function autoFocus() {
59
+ if (props.autofocus) {
60
+ inputsRef.value[0]?.$el?.focus();
87
61
  }
88
62
  }
63
+ onMounted(() => {
64
+ setTimeout(() => {
65
+ autoFocus();
66
+ }, props.autofocusDelay);
67
+ });
68
+ defineExpose({
69
+ inputsRef
70
+ });
89
71
  </script>
90
72
 
91
73
  <template>
@@ -100,6 +82,7 @@ function onBlur(event: FocusEvent) {
100
82
  <PinInputInput
101
83
  v-for="(ids, index) in looseToNumber(props.length)"
102
84
  :key="ids"
85
+ :ref="(el) => inputsRef[index] = el"
103
86
  :index="index"
104
87
  :class="ui.base({ class: props.ui?.base })"
105
88
  :disabled="disabled"
@@ -0,0 +1,68 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/pin-input';
5
+ import type { ComponentConfig } from '../types/utils';
6
+ type PinInput = ComponentConfig<typeof theme, AppConfig, 'pinInput'>;
7
+ export interface PinInputProps extends Pick<PinInputRootProps, 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @defaultValue 'div'
11
+ */
12
+ as?: any;
13
+ /**
14
+ * @defaultValue 'primary'
15
+ */
16
+ color?: PinInput['variants']['color'];
17
+ /**
18
+ * @defaultValue 'outline'
19
+ */
20
+ variant?: PinInput['variants']['variant'];
21
+ /**
22
+ * @defaultValue 'md'
23
+ */
24
+ size?: PinInput['variants']['size'];
25
+ /**
26
+ * The number of input fields.
27
+ * @defaultValue 5
28
+ */
29
+ length?: number | string;
30
+ autofocus?: boolean;
31
+ autofocusDelay?: number;
32
+ highlight?: boolean;
33
+ class?: any;
34
+ ui?: PinInput['slots'];
35
+ }
36
+ export type PinInputEmits = PinInputRootEmits & {
37
+ change: [payload: Event];
38
+ blur: [payload: Event];
39
+ };
40
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<PinInputProps>, {
41
+ type: string;
42
+ length: number;
43
+ autofocusDelay: number;
44
+ }>>, {
45
+ inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
46
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
47
+ length: number | string;
48
+ type: "text" | "number";
49
+ autofocusDelay: number;
50
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
51
+ export default _default;
52
+ type __VLS_WithDefaults<P, D> = {
53
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
54
+ default: D[K];
55
+ }> : P[K];
56
+ };
57
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
58
+ type __VLS_TypePropsToOption<T> = {
59
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
60
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
61
+ } : {
62
+ type: import('vue').PropType<T[K]>;
63
+ required: true;
64
+ };
65
+ };
66
+ type __VLS_PrettifyLocal<T> = {
67
+ [K in keyof T]: T[K];
68
+ } & {};