@nuxt/ui 3.0.0-alpha.9 → 3.0.0-beta.2

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 +29 -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 +71 -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,15 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/ui/badge'
6
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
6
  import type { UseComponentIconsProps } from '../composables/useComponentIcons'
7
+ import { tv } from '../utils/tv'
8
8
  import type { AvatarProps } from '../types'
9
9
 
10
- const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
10
+ const appConfigBadge = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
11
11
 
12
- const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
12
+ const badge = tv({ extend: tv(theme), ...(appConfigBadge.ui?.badge || {}) })
13
13
 
14
14
  type BadgeVariants = VariantProps<typeof badge>
15
15
 
@@ -36,24 +36,26 @@ export interface BadgeSlots {
36
36
 
37
37
  <script setup lang="ts">
38
38
  import { computed } from 'vue'
39
- import { Primitive } from 'radix-vue'
39
+ import { Primitive } from 'reka-ui'
40
+ import { useButtonGroup } from '../composables/useButtonGroup'
40
41
  import { useComponentIcons } from '../composables/useComponentIcons'
41
42
  import UIcon from './Icon.vue'
43
+ import UAvatar from './Avatar.vue'
42
44
 
43
45
  const props = withDefaults(defineProps<BadgeProps>(), {
44
46
  as: 'span'
45
47
  })
46
48
  defineSlots<BadgeSlots>()
47
49
 
50
+ const { orientation, size: buttonGroupSize } = useButtonGroup<BadgeProps>(props)
48
51
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
49
52
 
50
53
  const ui = computed(() => badge({
51
54
  color: props.color,
52
55
  variant: props.variant,
53
- size: props.size
56
+ size: buttonGroupSize.value || props.size,
57
+ buttonGroup: orientation.value
54
58
  }))
55
-
56
- extendDevtoolsMeta({ defaultProps: { label: 'Badge' } })
57
59
  </script>
58
60
 
59
61
  <template>
@@ -1,15 +1,14 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { AppConfig } from '@nuxt/schema'
4
3
  import _appConfig from '#build/app.config'
5
4
  import theme from '#build/ui/breadcrumb'
6
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
5
+ import { tv } from '../utils/tv'
7
6
  import type { AvatarProps, LinkProps } from '../types'
8
7
  import type { DynamicSlots, PartialString } from '../types/utils'
9
8
 
10
- const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
9
+ const appConfigBreadcrumb = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
11
10
 
12
- const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) })
11
+ const breadcrumb = tv({ extend: tv(theme), ...(appConfigBreadcrumb.ui?.breadcrumb || {}) })
13
12
 
14
13
  export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
15
14
  label?: string
@@ -48,36 +47,11 @@ export type BreadcrumbSlots<T extends { slot?: string }> = {
48
47
  'item-trailing': SlotProps<T>
49
48
  'separator'(props?: {}): any
50
49
  } & DynamicSlots<T, SlotProps<T>>
51
-
52
- extendDevtoolsMeta({
53
- defaultProps: {
54
- items: [
55
- { label: 'Home', to: '/' },
56
- {
57
- slot: 'dropdown',
58
- icon: 'i-lucide-ellipsis',
59
- children: [{
60
- label: 'Documentation'
61
- }, {
62
- label: 'Themes'
63
- }, {
64
- label: 'GitHub'
65
- }]
66
- }, {
67
- label: 'Components',
68
- disabled: true
69
- }, {
70
- label: 'Breadcrumb',
71
- to: '/components/breadcrumb'
72
- }
73
- ]
74
- }
75
- })
76
50
  </script>
77
51
 
78
52
  <script setup lang="ts" generic="T extends BreadcrumbItem">
79
53
  import { computed } from 'vue'
80
- import { Primitive } from 'radix-vue'
54
+ import { Primitive } from 'reka-ui'
81
55
  import { useAppConfig } from '#imports'
82
56
  import { useLocale } from '../composables/useLocale'
83
57
  import { get } from '../utils'
@@ -126,7 +100,7 @@ const ui = breadcrumb()
126
100
  </ULink>
127
101
  </li>
128
102
 
129
- <li v-if="index < items!.length - 1" role="presentation" :class="ui.separator({ class: props.ui?.separator })">
103
+ <li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
130
104
  <slot name="separator">
131
105
  <UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: props.ui?.separatorIcon })" />
132
106
  </slot>
@@ -1,17 +1,17 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/ui/button'
6
6
  import type { LinkProps } from './Link.vue'
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 } from '../types'
10
10
  import type { PartialString } from '../types/utils'
11
11
 
12
- const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
12
+ const appConfigButton = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
13
13
 
14
- const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
14
+ const button = tv({ extend: tv(theme), ...(appConfigButton.ui?.button || {}) })
15
15
 
16
16
  type ButtonVariants = VariantProps<typeof button>
17
17
 
@@ -31,9 +31,6 @@ export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'ra
31
31
  ui?: PartialString<typeof button.slots>
32
32
  }
33
33
 
34
- // Injects props to use as default in the devtools playground.
35
- extendDevtoolsMeta<ButtonProps>({ defaultProps: { label: 'Click me!' } })
36
-
37
34
  export interface ButtonSlots {
38
35
  leading(props?: {}): any
39
36
  default(props?: {}): any
@@ -43,7 +40,7 @@ export interface ButtonSlots {
43
40
 
44
41
  <script setup lang="ts">
45
42
  import { type Ref, computed, ref, inject } from 'vue'
46
- import { useForwardProps } from 'radix-vue'
43
+ import { useForwardProps } from 'reka-ui'
47
44
  import { useComponentIcons } from '../composables/useComponentIcons'
48
45
  import { useButtonGroup } from '../composables/useButtonGroup'
49
46
  import { formLoadingInjectionKey } from '../composables/useFormField'
@@ -1,13 +1,13 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/ui/button-group'
6
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
7
7
 
8
- const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
8
+ const appConfigButtonGroup = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
9
9
 
10
- const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) })
10
+ const buttonGroup = tv({ extend: tv(theme), ...(appConfigButtonGroup.ui?.buttonGroup) })
11
11
 
12
12
  type ButtonGroupVariants = VariantProps<typeof buttonGroup>
13
13
 
@@ -29,13 +29,11 @@ export interface ButtonGroupProps {
29
29
  export interface ButtonGroupSlots {
30
30
  default(props?: {}): any
31
31
  }
32
-
33
- extendDevtoolsMeta({ example: 'ButtonGroupExample' })
34
32
  </script>
35
33
 
36
34
  <script setup lang="ts">
37
35
  import { provide, computed } from 'vue'
38
- import { Primitive } from 'radix-vue'
36
+ import { Primitive } from 'reka-ui'
39
37
  import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
40
38
 
41
39
  const props = withDefaults(defineProps<ButtonGroupProps>(), {
@@ -0,0 +1,194 @@
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
4
+ import type { DateValue } from '@internationalized/date'
5
+ import type { AppConfig } from '@nuxt/schema'
6
+ import _appConfig from '#build/app.config'
7
+ import theme from '#build/ui/calendar'
8
+ import { tv } from '../utils/tv'
9
+ import type { PartialString } from '../types/utils'
10
+
11
+ const appConfigCalendar = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
12
+
13
+ const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.ui?.calendar || {}) })
14
+
15
+ type CalendarVariants = VariantProps<typeof calendar>
16
+
17
+ type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
18
+ ? DateRange
19
+ : M extends true
20
+ ? DateValue[]
21
+ : DateValue
22
+
23
+ export interface CalendarProps<R extends boolean, M extends boolean> extends Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'> {
24
+ /**
25
+ * The element or component this component should render as.
26
+ * @defaultValue 'div'
27
+ */
28
+ as?: any
29
+ /**
30
+ * The icon to use for the next year control.
31
+ * @defaultValue appConfig.ui.icons.chevronDoubleRight
32
+ */
33
+ nextYearIcon?: string
34
+ /**
35
+ * The icon to use for the next month control.
36
+ * @defaultValue appConfig.ui.icons.chevronRight
37
+ */
38
+ nextMonthIcon?: string
39
+ /**
40
+ * The icon to use for the previous year control.
41
+ * @defaultValue appConfig.ui.icons.chevronDoubleLeft
42
+ */
43
+ prevYearIcon?: string
44
+ /**
45
+ * The icon to use for the previous month control.
46
+ * @defaultValue appConfig.ui.icons.chevronLeft
47
+ */
48
+ prevMonthIcon?: string
49
+ color?: CalendarVariants['color']
50
+ size?: CalendarVariants['size']
51
+ /** Whether or not a range of dates can be selected */
52
+ range?: R & boolean
53
+ /** Whether or not multiple dates can be selected */
54
+ multiple?: M & boolean
55
+ /** Show month controls */
56
+ monthControls?: boolean
57
+ /** Show year controls */
58
+ yearControls?: boolean
59
+ defaultValue?: CalendarModelValue<R, M>
60
+ modelValue?: CalendarModelValue<R, M>
61
+ class?: any
62
+ ui?: PartialString<typeof calendar.slots>
63
+ }
64
+
65
+ export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
66
+ 'update:modelValue': [date: CalendarModelValue<R, M>]
67
+ }
68
+
69
+ export interface CalendarSlots {
70
+ 'heading': (props: { value: string }) => any
71
+ 'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
72
+ 'week-day': (props: { day: string }) => any
73
+ }
74
+ </script>
75
+
76
+ <script setup lang="ts" generic="R extends boolean = false, M extends boolean = false">
77
+ import { computed } from 'vue'
78
+ import { useForwardPropsEmits } from 'reka-ui'
79
+ import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
80
+ import { reactiveOmit } from '@vueuse/core'
81
+ import { useAppConfig } from '#imports'
82
+ import { useLocale } from '../composables/useLocale'
83
+ import UButton from './Button.vue'
84
+
85
+ const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
86
+ fixedWeeks: true,
87
+ monthControls: true,
88
+ yearControls: true
89
+ })
90
+ const emits = defineEmits<CalendarEmits<R, M>>()
91
+ defineSlots<CalendarSlots>()
92
+
93
+ const appConfig = useAppConfig()
94
+ const { code: locale, dir, t } = useLocale()
95
+
96
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits)
97
+
98
+ const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
99
+ const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
100
+ const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
101
+ const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
102
+
103
+ const ui = computed(() => calendar({
104
+ color: props.color,
105
+ size: props.size
106
+ }))
107
+
108
+ function paginateYear(date: DateValue, sign: -1 | 1) {
109
+ if (sign === -1) {
110
+ return date.subtract({ years: 1 })
111
+ }
112
+
113
+ return date.add({ years: 1 })
114
+ }
115
+
116
+ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
117
+ </script>
118
+
119
+ <template>
120
+ <Calendar.Root
121
+ v-slot="{ weekDays, grid }"
122
+ v-bind="rootProps"
123
+ :model-value="(modelValue as CalendarModelValue<true & false>)"
124
+ :default-value="(defaultValue as CalendarModelValue<true & false>)"
125
+ :locale="locale"
126
+ :dir="dir"
127
+ :class="ui.root({ class: [props.class, props.ui?.root] })"
128
+ >
129
+ <Calendar.Header :class="ui.header({ class: props.ui?.header })">
130
+ <Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
131
+ <UButton :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" />
132
+ </Calendar.Prev>
133
+ <Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
134
+ <UButton :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" />
135
+ </Calendar.Prev>
136
+ <Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })">
137
+ <slot name="heading" :value="headingValue">
138
+ {{ headingValue }}
139
+ </slot>
140
+ </Calendar.Heading>
141
+ <Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
142
+ <UButton :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" />
143
+ </Calendar.Next>
144
+ <Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
145
+ <UButton :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" />
146
+ </Calendar.Next>
147
+ </Calendar.Header>
148
+ <div :class="ui.body({ class: props.ui?.body })">
149
+ <Calendar.Grid
150
+ v-for="month in grid"
151
+ :key="month.value.toString()"
152
+ :class="ui.grid({ class: props.ui?.grid })"
153
+ >
154
+ <Calendar.GridHead>
155
+ <Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
156
+ <Calendar.HeadCell
157
+ v-for="day in weekDays"
158
+ :key="day"
159
+ :class="ui.headCell({ class: props.ui?.headCell })"
160
+ >
161
+ <slot name="week-day" :day="day">
162
+ {{ day }}
163
+ </slot>
164
+ </Calendar.HeadCell>
165
+ </Calendar.GridRow>
166
+ </Calendar.GridHead>
167
+ <Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })">
168
+ <Calendar.GridRow
169
+ v-for="(weekDates, index) in month.rows"
170
+ :key="`weekDate-${index}`"
171
+ :class="ui.gridRow({ class: props.ui?.gridRow })"
172
+ >
173
+ <Calendar.Cell
174
+ v-for="weekDate in weekDates"
175
+ :key="weekDate.toString()"
176
+ :date="weekDate"
177
+ :class="ui.cell({ class: props.ui?.cell })"
178
+ >
179
+ <Calendar.CellTrigger
180
+ :day="weekDate"
181
+ :month="month.value"
182
+ :class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
183
+ >
184
+ <slot name="day" :day="weekDate">
185
+ {{ weekDate.day }}
186
+ </slot>
187
+ </Calendar.CellTrigger>
188
+ </Calendar.Cell>
189
+ </Calendar.GridRow>
190
+ </Calendar.GridBody>
191
+ </Calendar.Grid>
192
+ </div>
193
+ </Calendar.Root>
194
+ </template>
@@ -1,13 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/ui/card'
6
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
7
7
 
8
- const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
8
+ const appConfigCard = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
9
9
 
10
- const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
10
+ const card = tv({ extend: tv(theme), ...(appConfigCard.ui?.card || {}) })
11
+
12
+ type CardVariants = VariantProps<typeof card>
11
13
 
12
14
  export interface CardProps {
13
15
  /**
@@ -15,6 +17,7 @@ export interface CardProps {
15
17
  * @defaultValue 'div'
16
18
  */
17
19
  as?: any
20
+ variant?: CardVariants['variant']
18
21
  class?: any
19
22
  ui?: Partial<typeof card.slots>
20
23
  }
@@ -24,18 +27,16 @@ export interface CardSlots {
24
27
  default(props?: {}): any
25
28
  footer(props?: {}): any
26
29
  }
27
-
28
- extendDevtoolsMeta({ example: 'CardExample' })
29
30
  </script>
30
31
 
31
32
  <script setup lang="ts">
32
- import { Primitive } from 'radix-vue'
33
+ import { computed } from 'vue'
34
+ import { Primitive } from 'reka-ui'
33
35
 
34
36
  const props = defineProps<CardProps>()
35
37
  const slots = defineSlots<CardSlots>()
36
38
 
37
- // eslint-disable-next-line vue/no-dupe-keys
38
- const ui = card()
39
+ const ui = computed(() => card({ variant: props.variant }))
39
40
  </script>
40
41
 
41
42
  <template>
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
+ import type { AcceptableValue } from 'reka-ui'
4
5
  import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
5
6
  import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
6
7
  import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
@@ -10,17 +11,22 @@ import type { FadeOptionsType } from 'embla-carousel-fade'
10
11
  import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
11
12
  import _appConfig from '#build/app.config'
12
13
  import theme from '#build/ui/carousel'
13
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
14
+ import { tv } from '../utils/tv'
14
15
  import type { ButtonProps } from '../types'
15
- import type { AcceptableValue, PartialString } from '../types/utils'
16
+ import type { PartialString } from '../types/utils'
16
17
 
17
- const appConfig = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
18
+ const appConfigCarousel = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
18
19
 
19
- const carousel = tv({ extend: tv(theme), ...(appConfig.ui?.carousel || {}) })
20
+ const carousel = tv({ extend: tv(theme), ...(appConfigCarousel.ui?.carousel || {}) })
20
21
 
21
22
  type CarouselVariants = VariantProps<typeof carousel>
22
23
 
23
24
  export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
25
+ /**
26
+ * The element or component this component should render as.
27
+ * @defaultValue 'div'
28
+ */
29
+ as?: any
24
30
  /**
25
31
  * Configure the prev button when arrows are enabled.
26
32
  * @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
@@ -90,14 +96,12 @@ export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'conta
90
96
  export type CarouselSlots<T> = {
91
97
  default(props: { item: T, index: number }): any
92
98
  }
93
-
94
- extendDevtoolsMeta({ example: 'CarouselExample' })
95
99
  </script>
96
100
 
97
101
  <script setup lang="ts" generic="T extends AcceptableValue">
98
102
  import { computed, ref, watch, onMounted } from 'vue'
99
103
  import useEmblaCarousel from 'embla-carousel-vue'
100
- import { useForwardProps } from 'radix-vue'
104
+ import { Primitive, useForwardProps } from 'reka-ui'
101
105
  import { reactivePick, computedAsync } from '@vueuse/core'
102
106
  import { useAppConfig } from '#imports'
103
107
  import { useLocale } from '../composables/useLocale'
@@ -254,7 +258,8 @@ defineExpose({
254
258
  </script>
255
259
 
256
260
  <template>
257
- <div
261
+ <Primitive
262
+ :as="as"
258
263
  role="region"
259
264
  aria-roledescription="carousel"
260
265
  tabindex="0"
@@ -311,5 +316,5 @@ defineExpose({
311
316
  </template>
312
317
  </div>
313
318
  </div>
314
- </div>
319
+ </Primitive>
315
320
  </template>
@@ -1,18 +1,23 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
3
- import type { CheckboxRootProps } from 'radix-vue'
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { CheckboxRootProps } 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/checkbox'
7
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
+ import { tv } from '../utils/tv'
8
8
 
9
- const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
9
+ const appConfigCheckbox = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
10
10
 
11
- const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
11
+ const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.ui?.checkbox || {}) })
12
12
 
13
13
  type CheckboxVariants = VariantProps<typeof checkbox>
14
14
 
15
- export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id'> {
15
+ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue 'div'
19
+ */
20
+ as?: any
16
21
  label?: string
17
22
  description?: string
18
23
  color?: CheckboxVariants['color']
@@ -22,66 +27,53 @@ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'req
22
27
  * @defaultValue appConfig.ui.icons.check
23
28
  */
24
29
  icon?: string
25
- indeterminate?: boolean
26
30
  /**
27
31
  * The icon displayed when the checkbox is indeterminate.
28
32
  * @defaultValue appConfig.ui.icons.minus
29
33
  */
30
34
  indeterminateIcon?: string
31
- /** The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. */
32
- defaultValue?: boolean
33
35
  class?: any
34
36
  ui?: Partial<typeof checkbox.slots>
35
37
  }
36
38
 
37
- export interface CheckboxEmits {
38
- (e: 'update:modelValue', payload: boolean): void
39
- (e: 'change', payload: Event): void
39
+ export type CheckboxEmits = {
40
+ change: [payload: Event]
40
41
  }
41
42
 
42
43
  export interface CheckboxSlots {
43
44
  label(props: { label?: string }): any
44
45
  description(props: { description?: string }): any
45
46
  }
46
-
47
- extendDevtoolsMeta({ defaultProps: { label: 'Check me!' } })
48
47
  </script>
49
48
 
50
49
  <script setup lang="ts">
51
50
  import { computed, useId } from 'vue'
52
- import { CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'radix-vue'
51
+ import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'reka-ui'
53
52
  import { reactivePick } from '@vueuse/core'
54
53
  import { useAppConfig } from '#imports'
55
54
  import { useFormField } from '../composables/useFormField'
56
55
  import UIcon from './Icon.vue'
57
56
 
57
+ defineOptions({ inheritAttrs: false })
58
+
58
59
  const props = defineProps<CheckboxProps>()
59
60
  const slots = defineSlots<CheckboxSlots>()
60
61
  const emits = defineEmits<CheckboxEmits>()
61
62
 
62
- const modelValue = defineModel<boolean | undefined>({ default: undefined })
63
+ const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
63
64
 
64
- const rootProps = useForwardProps(reactivePick(props, 'required', 'value'))
65
+ const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
65
66
 
66
67
  const appConfig = useAppConfig()
67
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<CheckboxProps>(props)
68
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<CheckboxProps>(props)
68
69
  const id = _id.value ?? useId()
69
70
 
70
- const checked = computed({
71
- get() {
72
- return props.indeterminate ? 'indeterminate' : modelValue.value
73
- },
74
- set(value) {
75
- modelValue.value = value === 'indeterminate' ? undefined : value
76
- }
77
- })
78
-
79
71
  const ui = computed(() => checkbox({
80
72
  size: size.value,
81
73
  color: color.value,
82
74
  required: props.required,
83
75
  disabled: disabled.value,
84
- checked: (modelValue.value ?? props.defaultValue) || props.indeterminate
76
+ checked: Boolean(modelValue.value ?? props.defaultValue)
85
77
  }))
86
78
 
87
79
  function onUpdate(value: any) {
@@ -93,23 +85,25 @@ function onUpdate(value: any) {
93
85
  }
94
86
  </script>
95
87
 
88
+ <!-- eslint-disable vue/no-template-shadow -->
96
89
  <template>
97
- <div :class="ui.root({ class: [props.class, props.ui?.root] })">
90
+ <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
98
91
  <div :class="ui.container({ class: props.ui?.container })">
99
92
  <CheckboxRoot
100
93
  :id="id"
101
- v-model:checked="checked"
102
- :default-checked="defaultValue"
103
- v-bind="rootProps"
94
+ v-bind="{ ...rootProps, ...$attrs, ...ariaAttrs }"
95
+ v-model="modelValue"
104
96
  :name="name"
105
97
  :disabled="disabled"
106
98
  :class="ui.base({ class: props.ui?.base })"
107
- @update:checked="onUpdate"
99
+ @update:model-value="onUpdate"
108
100
  >
109
- <CheckboxIndicator as-child>
110
- <UIcon v-if="indeterminate" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
111
- <UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
112
- </CheckboxIndicator>
101
+ <template #default="{ modelValue }">
102
+ <CheckboxIndicator as-child>
103
+ <UIcon v-if="modelValue === 'indeterminate'" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
104
+ <UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
105
+ </CheckboxIndicator>
106
+ </template>
113
107
  </CheckboxRoot>
114
108
  </div>
115
109
 
@@ -125,5 +119,5 @@ function onUpdate(value: any) {
125
119
  </slot>
126
120
  </p>
127
121
  </div>
128
- </div>
122
+ </Primitive>
129
123
  </template>