@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,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,119 @@
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_WithSlots<import("vue").DefineComponent<PaginationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
99
+ "update:page": (value: number) => any;
100
+ }, string, import("vue").PublicProps, Readonly<PaginationProps> & Readonly<{
101
+ "onUpdate:page"?: ((value: number) => any) | undefined;
102
+ }>, {
103
+ size: "xs" | "sm" | "md" | "lg" | "xl";
104
+ color: "error" | "info" | "primary" | "secondary" | "success" | "warning" | "neutral";
105
+ activeColor: "error" | "info" | "primary" | "secondary" | "success" | "warning" | "neutral";
106
+ variant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
107
+ activeVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
108
+ itemsPerPage: number;
109
+ showEdges: boolean;
110
+ siblingCount: number;
111
+ total: number;
112
+ showControls: boolean;
113
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, PaginationSlots>;
114
+ export default _default;
115
+ type __VLS_WithSlots<T, S> = T & {
116
+ new (): {
117
+ $slots: S;
118
+ };
119
+ };
@@ -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,57 @@
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<PinInputProps, {
41
+ inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
42
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
+ blur: (payload: Event) => any;
44
+ complete: (value: string[]) => any;
45
+ change: (payload: Event) => any;
46
+ "update:modelValue": (value: string[]) => any;
47
+ }, string, import("vue").PublicProps, Readonly<PinInputProps> & Readonly<{
48
+ onBlur?: ((payload: Event) => any) | undefined;
49
+ onComplete?: ((value: string[]) => any) | undefined;
50
+ onChange?: ((payload: Event) => any) | undefined;
51
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
52
+ }>, {
53
+ length: number | string;
54
+ type: "text" | "number";
55
+ autofocusDelay: number;
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
+ export default _default;