@nuxt/ui 3.0.0-alpha.9 → 3.0.0-beta.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 (289) hide show
  1. package/.nuxt/ui/accordion.ts +2 -2
  2. package/.nuxt/ui/alert.ts +122 -95
  3. package/.nuxt/ui/avatar-group.ts +14 -2
  4. package/.nuxt/ui/avatar.ts +16 -4
  5. package/.nuxt/ui/badge.ts +139 -93
  6. package/.nuxt/ui/breadcrumb.ts +5 -5
  7. package/.nuxt/ui/button-group.ts +13 -0
  8. package/.nuxt/ui/button.ts +167 -136
  9. package/.nuxt/ui/calendar.ts +103 -0
  10. package/.nuxt/ui/card.ts +27 -1
  11. package/.nuxt/ui/carousel.ts +7 -5
  12. package/.nuxt/ui/checkbox.ts +45 -27
  13. package/.nuxt/ui/chip.ts +44 -15
  14. package/.nuxt/ui/color-picker.ts +47 -0
  15. package/.nuxt/ui/command-palette.ts +28 -18
  16. package/.nuxt/ui/container.ts +1 -1
  17. package/.nuxt/ui/context-menu.ts +64 -46
  18. package/.nuxt/ui/drawer.ts +83 -15
  19. package/.nuxt/ui/dropdown-menu.ts +65 -47
  20. package/.nuxt/ui/form-field.ts +15 -7
  21. package/.nuxt/ui/index.ts +5 -1
  22. package/.nuxt/ui/input-menu.ts +150 -116
  23. package/.nuxt/ui/input-number.ts +102 -71
  24. package/.nuxt/ui/input.ts +111 -76
  25. package/.nuxt/ui/kbd.ts +18 -6
  26. package/.nuxt/ui/link.ts +3 -3
  27. package/.nuxt/ui/modal.ts +8 -7
  28. package/.nuxt/ui/navigation-menu.ts +244 -131
  29. package/.nuxt/ui/pin-input.ts +77 -51
  30. package/.nuxt/ui/popover.ts +2 -2
  31. package/.nuxt/ui/progress.ts +111 -72
  32. package/.nuxt/ui/radio-group.ts +45 -22
  33. package/.nuxt/ui/select-menu.ts +122 -86
  34. package/.nuxt/ui/select.ts +120 -84
  35. package/.nuxt/ui/separator.ts +60 -31
  36. package/.nuxt/ui/skeleton.ts +1 -1
  37. package/.nuxt/ui/slideover.ts +17 -9
  38. package/.nuxt/ui/slider.ts +61 -38
  39. package/.nuxt/ui/stepper.ts +202 -0
  40. package/.nuxt/ui/switch.ts +40 -22
  41. package/.nuxt/ui/table.ts +48 -31
  42. package/.nuxt/ui/tabs.ts +100 -72
  43. package/.nuxt/ui/textarea.ts +111 -76
  44. package/.nuxt/ui/toast.ts +53 -33
  45. package/.nuxt/ui/toaster.ts +31 -15
  46. package/.nuxt/ui/tooltip.ts +2 -2
  47. package/.nuxt/ui/tree.ts +154 -0
  48. package/.nuxt/ui.css +92 -0
  49. package/README.md +19 -8
  50. package/cli/commands/make/component.mjs +12 -0
  51. package/cli/package.json +2 -2
  52. package/cli/templates.mjs +27 -22
  53. package/dist/module.cjs +9 -171
  54. package/dist/module.d.cts +5 -15
  55. package/dist/module.d.mts +5 -15
  56. package/dist/module.d.ts +5 -15
  57. package/dist/module.json +2 -2
  58. package/dist/module.mjs +12 -168
  59. package/dist/runtime/components/Accordion.vue +8 -39
  60. package/dist/runtime/components/Alert.vue +22 -21
  61. package/dist/runtime/components/App.vue +9 -15
  62. package/dist/runtime/components/Avatar.vue +33 -21
  63. package/dist/runtime/components/AvatarGroup.vue +5 -7
  64. package/dist/runtime/components/Badge.vue +10 -8
  65. package/dist/runtime/components/Breadcrumb.vue +5 -31
  66. package/dist/runtime/components/Button.vue +5 -8
  67. package/dist/runtime/components/ButtonGroup.vue +5 -7
  68. package/dist/runtime/components/Calendar.vue +194 -0
  69. package/dist/runtime/components/Card.vue +10 -9
  70. package/dist/runtime/components/Carousel.vue +15 -10
  71. package/dist/runtime/components/Checkbox.vue +32 -38
  72. package/dist/runtime/components/Chip.vue +6 -8
  73. package/dist/runtime/components/Collapsible.vue +10 -11
  74. package/dist/runtime/components/ColorPicker.vue +297 -0
  75. package/dist/runtime/components/CommandPalette.vue +111 -97
  76. package/dist/runtime/components/Container.vue +4 -7
  77. package/dist/runtime/components/ContextMenu.vue +16 -69
  78. package/dist/runtime/components/ContextMenuContent.vue +12 -10
  79. package/dist/runtime/components/Drawer.vue +23 -12
  80. package/dist/runtime/components/DropdownMenu.vue +18 -59
  81. package/dist/runtime/components/DropdownMenuContent.vue +12 -10
  82. package/dist/runtime/components/Form.vue +65 -34
  83. package/dist/runtime/components/FormField.vue +22 -13
  84. package/dist/runtime/components/Icon.vue +1 -1
  85. package/dist/runtime/components/Input.vue +15 -7
  86. package/dist/runtime/components/InputMenu.vue +95 -104
  87. package/dist/runtime/components/InputNumber.vue +14 -9
  88. package/dist/runtime/components/Kbd.vue +5 -6
  89. package/dist/runtime/components/Link.vue +5 -8
  90. package/dist/runtime/components/LinkBase.vue +1 -1
  91. package/dist/runtime/components/Modal.vue +51 -38
  92. package/dist/runtime/components/NavigationMenu.vue +129 -114
  93. package/dist/runtime/components/OverlayProvider.vue +28 -0
  94. package/dist/runtime/components/Pagination.vue +6 -9
  95. package/dist/runtime/components/PinInput.vue +10 -11
  96. package/dist/runtime/components/Popover.vue +16 -18
  97. package/dist/runtime/components/Progress.vue +28 -12
  98. package/dist/runtime/components/RadioGroup.vue +9 -12
  99. package/dist/runtime/components/Select.vue +60 -34
  100. package/dist/runtime/components/SelectMenu.vue +160 -165
  101. package/dist/runtime/components/Separator.vue +6 -5
  102. package/dist/runtime/components/Skeleton.vue +4 -7
  103. package/dist/runtime/components/Slideover.vue +51 -37
  104. package/dist/runtime/components/Slider.vue +8 -7
  105. package/dist/runtime/components/Stepper.vue +170 -0
  106. package/dist/runtime/components/Switch.vue +19 -23
  107. package/dist/runtime/components/Table.vue +146 -31
  108. package/dist/runtime/components/Tabs.vue +12 -31
  109. package/dist/runtime/components/Textarea.vue +17 -8
  110. package/dist/runtime/components/Toast.vue +36 -25
  111. package/dist/runtime/components/Toaster.vue +10 -11
  112. package/dist/runtime/components/Tooltip.vue +9 -12
  113. package/dist/runtime/components/Tree.vue +196 -0
  114. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  115. package/dist/runtime/composables/defineShortcuts.js +2 -2
  116. package/dist/runtime/composables/useFormField.d.ts +7 -3
  117. package/dist/runtime/composables/useFormField.js +18 -8
  118. package/dist/runtime/composables/useLocale.js +1 -1
  119. package/dist/runtime/composables/useOverlay.d.ts +30 -0
  120. package/dist/runtime/composables/useOverlay.js +70 -0
  121. package/dist/runtime/composables/useToast.d.ts +4 -3
  122. package/dist/runtime/composables/useToast.js +20 -6
  123. package/dist/runtime/index.css +1 -1
  124. package/dist/runtime/keyframes.css +1 -1
  125. package/dist/runtime/locale/ar.js +9 -1
  126. package/dist/runtime/locale/az.js +54 -0
  127. package/dist/runtime/locale/bn.js +54 -0
  128. package/dist/runtime/locale/cs.js +9 -1
  129. package/dist/runtime/locale/da.d.ts +2 -0
  130. package/dist/runtime/locale/da.js +54 -0
  131. package/dist/runtime/locale/de.js +11 -3
  132. package/dist/runtime/locale/el.d.ts +2 -0
  133. package/dist/runtime/locale/el.js +54 -0
  134. package/dist/runtime/locale/en.js +9 -1
  135. package/dist/runtime/locale/es.js +9 -1
  136. package/dist/runtime/locale/et.d.ts +2 -0
  137. package/dist/runtime/locale/et.js +54 -0
  138. package/dist/runtime/locale/fa_ir.js +9 -1
  139. package/dist/runtime/locale/fi.d.ts +2 -0
  140. package/dist/runtime/locale/fi.js +54 -0
  141. package/dist/runtime/locale/fr.js +9 -1
  142. package/dist/runtime/locale/he.d.ts +2 -0
  143. package/dist/runtime/locale/he.js +53 -0
  144. package/dist/runtime/locale/hi.d.ts +2 -0
  145. package/dist/runtime/locale/hi.js +54 -0
  146. package/dist/runtime/locale/hu.d.ts +2 -0
  147. package/dist/runtime/locale/hu.js +54 -0
  148. package/dist/runtime/locale/id.d.ts +2 -0
  149. package/dist/runtime/locale/id.js +54 -0
  150. package/dist/runtime/locale/index.d.ts +25 -3
  151. package/dist/runtime/locale/index.js +25 -3
  152. package/dist/runtime/locale/it.js +9 -1
  153. package/dist/runtime/locale/ja.d.ts +2 -0
  154. package/dist/runtime/locale/ja.js +54 -0
  155. package/dist/runtime/locale/km.d.ts +2 -0
  156. package/dist/runtime/locale/km.js +54 -0
  157. package/dist/runtime/locale/ko.d.ts +2 -0
  158. package/dist/runtime/locale/ko.js +54 -0
  159. package/dist/runtime/locale/nb_no.d.ts +2 -0
  160. package/dist/runtime/locale/nb_no.js +54 -0
  161. package/dist/runtime/locale/nl.d.ts +2 -0
  162. package/dist/runtime/locale/nl.js +54 -0
  163. package/dist/runtime/locale/pl.js +9 -1
  164. package/dist/runtime/locale/pt.d.ts +2 -0
  165. package/dist/runtime/locale/pt.js +54 -0
  166. package/dist/runtime/locale/pt_br.d.ts +2 -0
  167. package/dist/runtime/locale/pt_br.js +54 -0
  168. package/dist/runtime/locale/ru.js +9 -1
  169. package/dist/runtime/locale/sk.d.ts +2 -0
  170. package/dist/runtime/locale/sk.js +54 -0
  171. package/dist/runtime/locale/sv.d.ts +2 -0
  172. package/dist/runtime/locale/sv.js +54 -0
  173. package/dist/runtime/locale/th.d.ts +2 -0
  174. package/dist/runtime/locale/th.js +54 -0
  175. package/dist/runtime/locale/tr.d.ts +2 -0
  176. package/dist/runtime/locale/tr.js +54 -0
  177. package/dist/runtime/locale/uk.d.ts +2 -0
  178. package/dist/runtime/locale/uk.js +54 -0
  179. package/dist/runtime/locale/vi.d.ts +2 -0
  180. package/dist/runtime/locale/vi.js +54 -0
  181. package/dist/runtime/locale/zh_cn.d.ts +2 -0
  182. package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +10 -2
  183. package/dist/runtime/locale/zh_tw.d.ts +2 -0
  184. package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +16 -8
  185. package/dist/runtime/plugins/colors.js +8 -5
  186. package/dist/runtime/types/form.d.ts +24 -15
  187. package/dist/runtime/types/form.js +2 -2
  188. package/dist/runtime/types/index.d.ts +5 -0
  189. package/dist/runtime/types/index.js +5 -0
  190. package/dist/runtime/types/locale.d.ts +8 -0
  191. package/dist/runtime/types/utils.d.ts +7 -3
  192. package/dist/runtime/utils/form.d.ts +4 -4
  193. package/dist/runtime/utils/form.js +6 -8
  194. package/dist/runtime/utils/index.d.ts +1 -1
  195. package/dist/runtime/utils/index.js +15 -2
  196. package/dist/runtime/utils/tv.d.ts +1 -0
  197. package/dist/runtime/utils/tv.js +4 -0
  198. package/dist/runtime/vue/components/Icon.vue +2 -2
  199. package/dist/runtime/vue/components/Link.vue +87 -23
  200. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  201. package/dist/runtime/vue/composables/useAppConfig.js +2 -0
  202. package/dist/runtime/vue/plugins/head.d.ts +1 -1
  203. package/dist/runtime/vue/plugins/head.js +3 -3
  204. package/dist/runtime/vue/stubs.d.ts +19 -0
  205. package/dist/runtime/vue/stubs.js +37 -0
  206. package/dist/shared/{ui.d52SSCwA.mjs → ui.DSPu6Y8j.mjs} +905 -401
  207. package/dist/shared/{ui.BPnAe4QS.cjs → ui.DfK2RX6G.cjs} +908 -401
  208. package/dist/unplugin.cjs +62 -26
  209. package/dist/unplugin.d.cts +13 -1
  210. package/dist/unplugin.d.mts +13 -1
  211. package/dist/unplugin.d.ts +13 -1
  212. package/dist/unplugin.mjs +61 -25
  213. package/dist/vite.cjs +3 -2
  214. package/dist/vite.d.cts +2 -0
  215. package/dist/vite.d.mts +2 -0
  216. package/dist/vite.d.ts +2 -0
  217. package/dist/vite.mjs +3 -2
  218. package/package.json +103 -67
  219. package/dist/chunks/component-meta.cjs +0 -77249
  220. package/dist/chunks/component-meta.mjs +0 -77247
  221. package/dist/client/devtools/200.html +0 -1
  222. package/dist/client/devtools/404.html +0 -1
  223. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
  224. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
  225. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
  226. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
  227. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
  228. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
  229. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
  230. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
  231. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
  232. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
  233. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
  234. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
  235. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
  236. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
  237. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
  238. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
  239. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
  240. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
  241. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
  242. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
  243. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
  244. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
  245. package/dist/client/devtools/_nuxt/BDC8ywlR.js +0 -1
  246. package/dist/client/devtools/_nuxt/BT004Uxp.js +0 -53
  247. package/dist/client/devtools/_nuxt/C1H2Soz3.js +0 -1
  248. package/dist/client/devtools/_nuxt/builds/latest.json +0 -1
  249. package/dist/client/devtools/_nuxt/builds/meta/f98c13ea-d751-4b37-8ce3-94e99708745f.json +0 -1
  250. package/dist/client/devtools/_nuxt/entry.Bx6WJjrx.css +0 -1
  251. package/dist/client/devtools/_nuxt/error-404.Cq4qshcf.css +0 -1
  252. package/dist/client/devtools/_nuxt/error-500.ax1aM34m.css +0 -1
  253. package/dist/client/devtools/favicon.svg +0 -1
  254. package/dist/client/devtools/index.html +0 -1
  255. package/dist/devtools/runtime/DevtoolsRenderer.vue +0 -53
  256. package/dist/devtools/runtime/examples/AvatarGroupExample.vue +0 -7
  257. package/dist/devtools/runtime/examples/ButtonGroupExample.vue +0 -8
  258. package/dist/devtools/runtime/examples/CardExample.vue +0 -13
  259. package/dist/devtools/runtime/examples/CarouselExample.vue +0 -13
  260. package/dist/devtools/runtime/examples/ChipExample.vue +0 -5
  261. package/dist/devtools/runtime/examples/CollapsibleExample.vue +0 -8
  262. package/dist/devtools/runtime/examples/CommandPaletteExample.vue +0 -29
  263. package/dist/devtools/runtime/examples/ContainerExample.vue +0 -5
  264. package/dist/devtools/runtime/examples/ContextMenuExample.vue +0 -5
  265. package/dist/devtools/runtime/examples/DrawerExample.vue +0 -8
  266. package/dist/devtools/runtime/examples/DropdownMenuExample.vue +0 -5
  267. package/dist/devtools/runtime/examples/FormExample.vue +0 -30
  268. package/dist/devtools/runtime/examples/FormFieldExample.vue +0 -5
  269. package/dist/devtools/runtime/examples/LinkExample.vue +0 -5
  270. package/dist/devtools/runtime/examples/ModalExample.vue +0 -8
  271. package/dist/devtools/runtime/examples/PopoverExample.vue +0 -8
  272. package/dist/devtools/runtime/examples/SkeletonExample.vue +0 -3
  273. package/dist/devtools/runtime/examples/SlideoverExample.vue +0 -8
  274. package/dist/devtools/runtime/examples/ToasterExample.vue +0 -11
  275. package/dist/devtools/runtime/examples/TooltipExample.vue +0 -5
  276. package/dist/runtime/components/ModalProvider.vue +0 -12
  277. package/dist/runtime/components/SlideoverProvider.vue +0 -12
  278. package/dist/runtime/composables/extendDevtoolsMeta.d.ts +0 -7
  279. package/dist/runtime/composables/extendDevtoolsMeta.js +0 -2
  280. package/dist/runtime/composables/useModal.d.ts +0 -17
  281. package/dist/runtime/composables/useModal.js +0 -46
  282. package/dist/runtime/composables/useSlideover.d.ts +0 -17
  283. package/dist/runtime/composables/useSlideover.js +0 -46
  284. package/dist/runtime/plugins/modal.d.ts +0 -2
  285. package/dist/runtime/plugins/modal.js +0 -10
  286. package/dist/runtime/plugins/slideover.d.ts +0 -2
  287. package/dist/runtime/plugins/slideover.js +0 -10
  288. /package/dist/runtime/locale/{zh_hans.d.ts → az.d.ts} +0 -0
  289. /package/dist/runtime/locale/{zh_hant.d.ts → bn.d.ts} +0 -0
@@ -1,14 +1,15 @@
1
1
  <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui'
4
+ import type { AppConfig } from '@nuxt/schema'
2
5
  import _appConfig from '#build/app.config'
3
6
  import theme from '#build/ui/pin-input'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import type { PinInputRootEmits, PinInputRootProps } from 'radix-vue'
6
- import { tv, type VariantProps } from 'tailwind-variants'
7
+ import { tv } from '../utils/tv'
7
8
  import type { PartialString } from '../types/utils'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { pinInput: Partial<typeof theme> } }
10
+ const appConfigPinInput = _appConfig as AppConfig & { ui: { pinInput: Partial<typeof theme> } }
10
11
 
11
- const pinInput = tv({ extend: tv(theme), ...(appConfig.ui?.pinInput || {}) })
12
+ const pinInput = tv({ extend: tv(theme), ...(appConfigPinInput.ui?.pinInput || {}) })
12
13
 
13
14
  type PinInputVariants = VariantProps<typeof pinInput>
14
15
 
@@ -35,13 +36,11 @@ export type PinInputEmits = PinInputRootEmits & {
35
36
 
36
37
  <script setup lang="ts">
37
38
  import { ref, computed } from 'vue'
38
- import { PinInputInput, PinInputRoot, useForwardPropsEmits } from 'radix-vue'
39
+ import { PinInputInput, PinInputRoot, useForwardPropsEmits } from 'reka-ui'
39
40
  import { reactivePick } from '@vueuse/core'
40
41
  import { useFormField } from '../composables/useFormField'
41
42
  import { looseToNumber } from '../utils'
42
43
 
43
- defineOptions({ inheritAttrs: false })
44
-
45
44
  const props = withDefaults(defineProps<PinInputProps>(), {
46
45
  type: 'text',
47
46
  length: 5
@@ -49,7 +48,7 @@ const props = withDefaults(defineProps<PinInputProps>(), {
49
48
  const emits = defineEmits<PinInputEmits>()
50
49
 
51
50
  const rootProps = useForwardPropsEmits(reactivePick(props, 'defaultValue', 'disabled', 'id', 'mask', 'modelValue', 'name', 'otp', 'placeholder', 'required', 'type'), emits)
52
- const { emitFormInput, emitFormChange, emitFormBlur, size, color, id, name, highlight, disabled } = useFormField<PinInputProps>(props)
51
+ const { emitFormInput, emitFormFocus, emitFormChange, emitFormBlur, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField<PinInputProps>(props)
53
52
 
54
53
  const ui = computed(() => pinInput({
55
54
  color: color.value,
@@ -76,7 +75,7 @@ function onBlur(event: FocusEvent) {
76
75
 
77
76
  <template>
78
77
  <PinInputRoot
79
- v-bind="rootProps"
78
+ v-bind="{ ...rootProps, ...ariaAttrs }"
80
79
  :id="id"
81
80
  :name="name"
82
81
  :class="ui.root({ class: [props.class, props.ui?.root] })"
@@ -88,9 +87,9 @@ function onBlur(event: FocusEvent) {
88
87
  :key="ids"
89
88
  :index="index"
90
89
  :class="ui.base({ class: props.ui?.base })"
91
- v-bind="$attrs"
92
90
  :disabled="disabled"
93
91
  @blur="onBlur"
92
+ @focus="emitFormFocus"
94
93
  />
95
94
  </PinInputRoot>
96
95
  </template>
@@ -1,14 +1,13 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
- import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'radix-vue'
2
+ import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'reka-ui'
4
3
  import type { AppConfig } from '@nuxt/schema'
5
4
  import _appConfig from '#build/app.config'
6
5
  import theme from '#build/ui/popover'
7
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
8
7
 
9
- const appConfig = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
8
+ const appConfigPopover = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
10
9
 
11
- const popover = tv({ extend: tv(theme), ...(appConfig.ui?.popover || {}) })
10
+ const popover = tv({ extend: tv(theme), ...(appConfigPopover.ui?.popover || {}) })
12
11
 
13
12
  export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
14
13
  /**
@@ -18,7 +17,7 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
18
17
  mode?: 'click' | 'hover'
19
18
  /**
20
19
  * The content of the popover.
21
- * @defaultValue { side: 'bottom', sideOffset: 8 }
20
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
22
21
  */
23
22
  content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
24
23
  /**
@@ -32,10 +31,10 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
32
31
  */
33
32
  portal?: boolean
34
33
  /**
35
- * When `true`, the popover will not close when clicking outside.
36
- * @defaultValue false
34
+ * When `false`, the popover will not close when clicking outside or pressing escape.
35
+ * @defaultValue true
37
36
  */
38
- preventClose?: boolean
37
+ dismissible?: boolean
39
38
  class?: any
40
39
  ui?: Partial<typeof popover.slots>
41
40
  }
@@ -46,31 +45,30 @@ export interface PopoverSlots {
46
45
  default(props: { open: boolean }): any
47
46
  content(props?: {}): any
48
47
  }
49
-
50
- extendDevtoolsMeta({ example: 'PopoverExample' })
51
48
  </script>
52
49
 
53
50
  <script setup lang="ts">
54
51
  import { computed, toRef } from 'vue'
55
52
  import { defu } from 'defu'
56
- import { useForwardPropsEmits } from 'radix-vue'
57
- import { Popover, HoverCard } from 'radix-vue/namespaced'
53
+ import { useForwardPropsEmits } from 'reka-ui'
54
+ import { Popover, HoverCard } from 'reka-ui/namespaced'
58
55
  import { reactivePick } from '@vueuse/core'
59
56
 
60
57
  const props = withDefaults(defineProps<PopoverProps>(), {
61
58
  portal: true,
62
59
  mode: 'click',
63
60
  openDelay: 0,
64
- closeDelay: 0
61
+ closeDelay: 0,
62
+ dismissible: true
65
63
  })
66
64
  const emits = defineEmits<PopoverEmits>()
67
65
  const slots = defineSlots<PopoverSlots>()
68
66
 
69
67
  const pick = props.mode === 'hover' ? reactivePick(props, 'defaultOpen', 'open', 'openDelay', 'closeDelay') : reactivePick(props, 'defaultOpen', 'open', 'modal')
70
68
  const rootProps = useForwardPropsEmits(pick, emits)
71
- const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8 }) as PopoverContentProps)
69
+ const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as PopoverContentProps)
72
70
  const contentEvents = computed(() => {
73
- if (props.preventClose) {
71
+ if (!props.dismissible) {
74
72
  return {
75
73
  pointerDownOutside: (e: Event) => e.preventDefault(),
76
74
  interactOutside: (e: Event) => e.preventDefault(),
@@ -92,12 +90,12 @@ const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
92
90
 
93
91
  <template>
94
92
  <Component.Root v-slot="{ open }" v-bind="rootProps">
95
- <Component.Trigger v-if="!!slots.default" as-child>
93
+ <Component.Trigger v-if="!!slots.default" as-child :class="props.class">
96
94
  <slot :open="open" />
97
95
  </Component.Trigger>
98
96
 
99
97
  <Component.Portal :disabled="!portal">
100
- <Component.Content v-bind="contentProps" :class="ui.content({ class: [props.class, props.ui?.content] })" v-on="contentEvents">
98
+ <Component.Content v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-on="contentEvents">
101
99
  <slot name="content" />
102
100
 
103
101
  <Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
@@ -1,14 +1,15 @@
1
1
  <!-- eslint-disable vue/block-tag-newline -->
2
2
  <script lang="ts">
3
- import { tv, type VariantProps } from 'tailwind-variants'
4
- import type { ProgressRootProps, ProgressRootEmits } from 'radix-vue'
3
+ import type { VariantProps } from 'tailwind-variants'
4
+ import type { ProgressRootProps, ProgressRootEmits } from 'reka-ui'
5
5
  import type { AppConfig } from '@nuxt/schema'
6
6
  import _appConfig from '#build/app.config'
7
7
  import theme from '#build/ui/progress'
8
+ import { tv } from '../utils/tv'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { progress: Partial<typeof theme> } }
10
+ const appConfigProgress = _appConfig as AppConfig & { ui: { progress: Partial<typeof theme> } }
10
11
 
11
- const progress = tv({ extend: tv(theme), ...(appConfig.ui?.progress || {}) })
12
+ const progress = tv({ extend: tv(theme), ...(appConfigProgress.ui?.progress || {}) })
12
13
 
13
14
  type ProgressVariants = VariantProps<typeof progress>
14
15
 
@@ -48,8 +49,9 @@ export type ProgressSlots = {
48
49
 
49
50
  <script setup lang="ts">
50
51
  import { computed } from 'vue'
51
- import { ProgressIndicator, ProgressRoot, useForwardPropsEmits } from 'radix-vue'
52
+ import { Primitive, ProgressRoot, ProgressIndicator, useForwardPropsEmits } from 'reka-ui'
52
53
  import { reactivePick } from '@vueuse/core'
54
+ import { useLocale } from '../composables/useLocale'
53
55
 
54
56
  const props = withDefaults(defineProps<ProgressProps>(), {
55
57
  inverted: false,
@@ -57,9 +59,11 @@ const props = withDefaults(defineProps<ProgressProps>(), {
57
59
  orientation: 'horizontal'
58
60
  })
59
61
  const emits = defineEmits<ProgressEmits>()
60
- defineSlots<ProgressSlots>()
62
+ const slots = defineSlots<ProgressSlots>()
61
63
 
62
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'getValueLabel', 'modelValue'), emits)
64
+ const { dir } = useLocale()
65
+
66
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'getValueLabel', 'modelValue'), emits)
63
67
 
64
68
  const isIndeterminate = computed(() => rootProps.value.modelValue === null)
65
69
  const hasSteps = computed(() => Array.isArray(props.max))
@@ -93,8 +97,20 @@ const indicatorStyle = computed(() => {
93
97
  return
94
98
  }
95
99
 
96
- return {
97
- transform: `translate${props.orientation === 'vertical' ? 'Y' : 'X'}(${props.inverted ? '' : '-'}${100 - percent.value}%)`
100
+ if (props.orientation === 'vertical') {
101
+ return {
102
+ transform: `translateY(${props.inverted ? '' : '-'}${100 - percent.value}%)`
103
+ }
104
+ } else {
105
+ if (dir.value === 'rtl') {
106
+ return {
107
+ transform: `translateX(${props.inverted ? '-' : ''}${100 - percent.value}%)`
108
+ }
109
+ } else {
110
+ return {
111
+ transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)`
112
+ }
113
+ }
98
114
  }
99
115
  })
100
116
 
@@ -144,8 +160,8 @@ const ui = computed(() => progress({
144
160
  </script>
145
161
 
146
162
  <template>
147
- <div :class="ui.root({ class: [props.class, props.ui?.root] })">
148
- <div v-if="!isIndeterminate && (status || $slots.status)" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
163
+ <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
164
+ <div v-if="!isIndeterminate && (status || !!slots.status)" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
149
165
  <slot name="status" :percent="percent">
150
166
  {{ percent }}%
151
167
  </slot>
@@ -162,5 +178,5 @@ const ui = computed(() => progress({
162
178
  </slot>
163
179
  </div>
164
180
  </div>
165
- </div>
181
+ </Primitive>
166
182
  </template>
@@ -1,15 +1,14 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
3
- import type { RadioGroupRootProps, RadioGroupRootEmits } from 'radix-vue'
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { RadioGroupRootProps, RadioGroupRootEmits, AcceptableValue } from 'reka-ui'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/radio-group'
7
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
- import type { AcceptableValue } from '../types/utils'
7
+ import { tv } from '../utils/tv'
9
8
 
10
- const appConfig = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } }
9
+ const appConfigRadioGroup = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } }
11
10
 
12
- const radioGroup = tv({ extend: tv(theme), ...(appConfig.ui?.radioGroup || {}) })
11
+ const radioGroup = tv({ extend: tv(theme), ...(appConfigRadioGroup.ui?.radioGroup || {}) })
13
12
 
14
13
  type RadioGroupVariants = VariantProps<typeof radioGroup>
15
14
 
@@ -58,20 +57,18 @@ export type RadioGroupEmits = RadioGroupRootEmits & {
58
57
  change: [payload: Event]
59
58
  }
60
59
 
61
- type SlotProps<T> = (props: { item: T, modelValue?: string }) => any
60
+ type SlotProps<T> = (props: { item: T, modelValue?: AcceptableValue }) => any
62
61
 
63
62
  export interface RadioGroupSlots<T> {
64
63
  legend(props?: {}): any
65
64
  label: SlotProps<T>
66
65
  description: SlotProps<T>
67
66
  }
68
-
69
- extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3'] } })
70
67
  </script>
71
68
 
72
69
  <script setup lang="ts" generic="T extends RadioGroupItem | AcceptableValue">
73
70
  import { computed, useId } from 'vue'
74
- import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, Label, useForwardPropsEmits } from 'radix-vue'
71
+ import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, Label, useForwardPropsEmits } from 'reka-ui'
75
72
  import { reactivePick } from '@vueuse/core'
76
73
  import { useFormField } from '../composables/useFormField'
77
74
  import { get } from '../utils'
@@ -87,7 +84,7 @@ const slots = defineSlots<RadioGroupSlots<T>>()
87
84
 
88
85
  const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'loop', 'required'), emits)
89
86
 
90
- const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled } = useFormField<RadioGroupProps<T>>(props, { bind: false })
87
+ const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled, ariaAttrs } = useFormField<RadioGroupProps<T>>(props, { bind: false })
91
88
  const id = _id.value ?? useId()
92
89
 
93
90
  const ui = computed(() => radioGroup({
@@ -147,7 +144,7 @@ function onUpdate(value: any) {
147
144
  :class="ui.root({ class: [props.class, props.ui?.root] })"
148
145
  @update:model-value="onUpdate"
149
146
  >
150
- <fieldset :class="ui.fieldset({ class: props.ui?.fieldset })">
147
+ <fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
151
148
  <legend v-if="legend || !!slots.legend" :class="ui.legend({ class: props.ui?.legend })">
152
149
  <slot name="legend">
153
150
  {{ legend }}
@@ -1,17 +1,17 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
3
- import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectArrowProps } from 'radix-vue'
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectArrowProps, AcceptableValue } from 'reka-ui'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/select'
7
7
  import type { UseComponentIconsProps } from '../composables/useComponentIcons'
8
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
9
9
  import type { AvatarProps, ChipProps, InputProps } from '../types'
10
- import type { AcceptableValue, PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
10
+ import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
11
11
 
12
- const appConfig = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
12
+ const appConfigSelect = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
13
13
 
14
- const select = tv({ extend: tv(theme), ...(appConfig.ui?.select || {}) })
14
+ const select = tv({ extend: tv(theme), ...(appConfigSelect.ui?.select || {}) })
15
15
 
16
16
  export interface SelectItem {
17
17
  label?: string
@@ -29,7 +29,7 @@ export interface SelectItem {
29
29
 
30
30
  type SelectVariants = VariantProps<typeof select>
31
31
 
32
- export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectItem | AcceptableValue> = MaybeArrayOfArray<SelectItem | AcceptableValue>, V extends SelectItemKey<T> | undefined = undefined> extends Omit<SelectRootProps, 'dir' | 'modelValue'>, UseComponentIconsProps {
32
+ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectItem | AcceptableValue | boolean> = MaybeArrayOfArray<SelectItem | AcceptableValue | boolean>, V extends SelectItemKey<T> | undefined = undefined, M extends boolean = false> extends Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, UseComponentIconsProps {
33
33
  id?: string
34
34
  /** The placeholder text when the select is empty. */
35
35
  placeholder?: string
@@ -48,7 +48,7 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
48
48
  selectedIcon?: string
49
49
  /**
50
50
  * The content of the menu.
51
- * @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
51
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
52
52
  */
53
53
  content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'>
54
54
  /**
@@ -72,62 +72,67 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
72
72
  */
73
73
  labelKey?: V
74
74
  items?: I
75
+ /** The value of the Select when initially rendered. Use when you do not need to control the state of the Select. */
76
+ defaultValue?: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>
77
+ /** The controlled value of the Select. Can be bind as `v-model`. */
78
+ modelValue?: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>
79
+ /** Whether multiple options can be selected or not. */
80
+ multiple?: M & boolean
75
81
  /** Highlight the ring color like a focus state. */
76
82
  highlight?: boolean
77
83
  class?: any
78
84
  ui?: PartialString<typeof select.slots>
79
- /** The controlled value of the Select. Can be bind as `v-model`. */
80
- modelValue?: SelectModelValue<T, V, false, T extends { value: infer U } ? U : never>
81
85
  }
82
86
 
83
- export type SelectEmits<T, V> = Omit<SelectRootEmits, 'update:modelValue'> & {
87
+ export type SelectEmits<T, V, M extends boolean> = Omit<SelectRootEmits<T>, 'update:modelValue'> & {
84
88
  change: [payload: Event]
85
89
  blur: [payload: FocusEvent]
86
90
  focus: [payload: FocusEvent]
87
- } & SelectModelValueEmits<T, V, false, T extends { value: infer U } ? U : never>
91
+ } & SelectModelValueEmits<T, V, M, T extends { value: infer U } ? U : never>
88
92
 
89
93
  type SlotProps<T> = (props: { item: T, index: number }) => any
90
94
 
91
- export interface SelectSlots<T> {
92
- 'leading'(props: { modelValue: string, open: boolean, ui: any }): any
93
- 'trailing'(props: { modelValue: string, open: boolean, ui: any }): any
95
+ export interface SelectSlots<T, M extends boolean> {
96
+ 'leading'(props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: any }): any
97
+ 'default'(props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean }): any
98
+ 'trailing'(props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: any }): any
94
99
  'item': SlotProps<T>
95
100
  'item-leading': SlotProps<T>
96
101
  'item-label': SlotProps<T>
97
102
  'item-trailing': SlotProps<T>
98
103
  }
99
-
100
- extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3'] } })
101
104
  </script>
102
105
 
103
- <script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectItem | AcceptableValue> = MaybeArrayOfArray<SelectItem | AcceptableValue>, V extends SelectItemKey<T> | undefined = undefined">
106
+ <script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectItem | AcceptableValue | boolean> = MaybeArrayOfArray<SelectItem | AcceptableValue | boolean>, V extends SelectItemKey<T> | undefined = undefined, M extends boolean = false">
104
107
  import { computed, toRef } from 'vue'
105
- import { SelectRoot, SelectArrow, SelectTrigger, SelectValue, SelectPortal, SelectContent, SelectViewport, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from 'radix-vue'
108
+ import { SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from 'reka-ui'
106
109
  import { defu } from 'defu'
107
110
  import { reactivePick } from '@vueuse/core'
108
111
  import { useAppConfig } from '#imports'
109
112
  import { useButtonGroup } from '../composables/useButtonGroup'
110
113
  import { useComponentIcons } from '../composables/useComponentIcons'
111
114
  import { useFormField } from '../composables/useFormField'
112
- import { get } from '../utils'
115
+ import { get, compare } from '../utils'
113
116
  import UIcon from './Icon.vue'
114
117
  import UAvatar from './Avatar.vue'
115
118
  import UChip from './Chip.vue'
116
119
 
117
- const props = withDefaults(defineProps<SelectProps<T, I, V>>(), {
120
+ defineOptions({ inheritAttrs: false })
121
+
122
+ const props = withDefaults(defineProps<SelectProps<T, I, V, M>>(), {
118
123
  valueKey: 'value' as never,
119
124
  labelKey: 'label' as never,
120
125
  portal: true
121
126
  })
122
- const emits = defineEmits<SelectEmits<T, V>>()
123
- const slots = defineSlots<SelectSlots<T>>()
127
+ const emits = defineEmits<SelectEmits<T, V, M>>()
128
+ const slots = defineSlots<SelectSlots<T, M>>()
124
129
 
125
130
  const appConfig = useAppConfig()
126
- const rootProps = useForwardPropsEmits(reactivePick(props, 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required'), emits)
127
- const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, position: 'popper' }) as SelectContentProps)
131
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required', 'multiple'), emits)
132
+ const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as SelectContentProps)
128
133
  const arrowProps = toRef(() => props.arrow as SelectArrowProps)
129
134
 
130
- const { emitFormChange, emitFormInput, emitFormBlur, size: formGroupSize, color, id, name, highlight, disabled } = useFormField<InputProps>(props)
135
+ const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField<InputProps>(props)
131
136
  const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
132
137
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })))
133
138
 
@@ -145,6 +150,17 @@ const ui = computed(() => select({
145
150
  }))
146
151
 
147
152
  const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0]) ? props.items : [props.items]) as SelectItem[][] : [])
153
+ // eslint-disable-next-line vue/no-dupe-keys
154
+ const items = computed(() => groups.value.flatMap(group => group) as T[])
155
+
156
+ function displayValue(value?: AcceptableValue | AcceptableValue[]): string | undefined {
157
+ if (props.multiple && Array.isArray(value)) {
158
+ return value.map(v => displayValue(v)).filter(Boolean).join(', ')
159
+ }
160
+
161
+ const item = items.value.find(item => compare(typeof item === 'object' ? get(item as Record<string, any>, props.valueKey as string) : item, value))
162
+ return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
163
+ }
148
164
 
149
165
  function onUpdate(value: any) {
150
166
  // @ts-expect-error - 'target' does not exist in type 'EventInit'
@@ -162,35 +178,45 @@ function onUpdateOpen(value: boolean) {
162
178
  } else {
163
179
  const event = new FocusEvent('focus')
164
180
  emits('focus', event)
181
+ emitFormFocus()
165
182
  }
166
183
  }
167
184
  </script>
168
185
 
186
+ <!-- eslint-disable vue/no-template-shadow -->
169
187
  <template>
170
188
  <SelectRoot
171
- :id="id"
172
189
  v-slot="{ modelValue, open }"
173
- v-bind="rootProps"
174
190
  :name="name"
175
- :default-value="(defaultValue as string)"
176
- :model-value="(modelValue as string)"
191
+ v-bind="rootProps"
177
192
  :autocomplete="autocomplete"
178
193
  :disabled="disabled"
194
+ :default-value="(defaultValue as (AcceptableValue | AcceptableValue[] | undefined))"
195
+ :model-value="(modelValue as (AcceptableValue | AcceptableValue[] | undefined))"
179
196
  @update:model-value="onUpdate"
180
197
  @update:open="onUpdateOpen"
181
198
  >
182
- <SelectTrigger :class="ui.base({ class: [props.class, props.ui?.base] })">
199
+ <SelectTrigger :id="id" :class="ui.base({ class: [props.class, props.ui?.base] })" v-bind="{ ...$attrs, ...ariaAttrs }">
183
200
  <span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
184
- <slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
201
+ <slot name="leading" :model-value="(modelValue as M extends true ? AcceptableValue[] : AcceptableValue)" :open="open" :ui="ui">
185
202
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
186
203
  <UAvatar v-else-if="!!avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
187
204
  </slot>
188
205
  </span>
189
206
 
190
- <SelectValue :placeholder="placeholder ?? '&nbsp;'" :class="ui.value({ class: props.ui?.value })" />
207
+ <slot :model-value="(modelValue as M extends true ? AcceptableValue[] : AcceptableValue)" :open="open">
208
+ <template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
209
+ <span v-if="displayedModelValue" :class="ui.value({ class: props.ui?.value })">
210
+ {{ displayedModelValue }}
211
+ </span>
212
+ <span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
213
+ {{ placeholder ?? '&nbsp;' }}
214
+ </span>
215
+ </template>
216
+ </slot>
191
217
 
192
218
  <span v-if="isTrailing || !!slots.trailing" :class="ui.trailing({ class: props.ui?.trailing })">
193
- <slot name="trailing" :model-value="modelValue" :open="open" :ui="ui">
219
+ <slot name="trailing" :model-value="(modelValue as M extends true ? AcceptableValue[] : AcceptableValue)" :open="open" :ui="ui">
194
220
  <UIcon v-if="trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
195
221
  </slot>
196
222
  </span>