@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,14 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
3
- import type { ToastProviderProps } from 'radix-vue'
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { ToastProviderProps } 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/toaster'
7
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
+ import { tv } from '../utils/tv'
8
8
 
9
- const appConfig = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
9
+ const appConfigToaster = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
10
10
 
11
- const toaster = tv({ extend: tv(theme), ...(appConfig.ui?.toaster || {}) })
11
+ const toaster = tv({ extend: tv(theme), ...(appConfigToaster.ui?.toaster || {}) })
12
12
 
13
13
  type ToasterVariants = VariantProps<typeof toaster>
14
14
 
@@ -35,13 +35,11 @@ export interface ToasterSlots {
35
35
  export default {
36
36
  name: 'Toaster'
37
37
  }
38
-
39
- extendDevtoolsMeta({ example: 'ToasterExample' })
40
38
  </script>
41
39
 
42
40
  <script setup lang="ts">
43
41
  import { ref, computed } from 'vue'
44
- import { ToastProvider, ToastViewport, ToastPortal, useForwardProps } from 'radix-vue'
42
+ import { ToastProvider, ToastViewport, ToastPortal, useForwardProps } from 'reka-ui'
45
43
  import { reactivePick } from '@vueuse/core'
46
44
  import { useToast } from '../composables/useToast'
47
45
  import { omit } from '../utils'
@@ -108,7 +106,8 @@ function getOffset(index: number) {
108
106
  v-for="(toast, index) of toasts"
109
107
  :key="toast.id"
110
108
  ref="refs"
111
- v-bind="omit(toast, ['id'])"
109
+ v-bind="omit(toast, ['id', 'close'])"
110
+ :close="(toast.close as boolean)"
112
111
  :data-expanded="expanded"
113
112
  :data-front="!expanded && index === toasts.length - 1"
114
113
  :style="{
@@ -120,10 +119,10 @@ function getOffset(index: number) {
120
119
  '--transform': 'translateY(var(--translate)) scale(var(--scale))'
121
120
  }"
122
121
  :class="[ui.base(), {
123
- 'cursor-pointer': !!toast.click
122
+ 'cursor-pointer': !!toast.onClick
124
123
  }]"
125
124
  @update:open="onUpdateOpen($event, toast.id)"
126
- @click="toast.click && toast.click(toast)"
125
+ @click="toast.onClick && toast.onClick(toast)"
127
126
  />
128
127
 
129
128
  <ToastPortal :disabled="!portal">
@@ -1,15 +1,14 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
- import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipArrowProps } from 'radix-vue'
2
+ import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipArrowProps } 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/tooltip'
7
- import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
8
7
  import type { KbdProps } from '../types'
9
8
 
10
- const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
9
+ const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
11
10
 
12
- const tooltip = tv({ extend: tv(theme), ...(appConfig.ui?.tooltip || {}) })
11
+ const tooltip = tv({ extend: tv(theme), ...(appConfigTooltip.ui?.tooltip || {}) })
13
12
 
14
13
  export interface TooltipProps extends TooltipRootProps {
15
14
  /** The text content of the tooltip. */
@@ -18,7 +17,7 @@ export interface TooltipProps extends TooltipRootProps {
18
17
  kbds?: KbdProps['value'][] | KbdProps[]
19
18
  /**
20
19
  * The content of the tooltip.
21
- * @defaultValue { side: 'bottom', sideOffset: 8 }
20
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
22
21
  */
23
22
  content?: Omit<TooltipContentProps, 'as' | 'asChild'>
24
23
  /**
@@ -41,14 +40,12 @@ export interface TooltipSlots {
41
40
  default(props: { open: boolean }): any
42
41
  content(props?: {}): any
43
42
  }
44
-
45
- extendDevtoolsMeta({ example: 'TooltipExample', defaultProps: { text: 'Hello world!' } })
46
43
  </script>
47
44
 
48
45
  <script setup lang="ts">
49
46
  import { computed, toRef } from 'vue'
50
47
  import { defu } from 'defu'
51
- import { TooltipRoot, TooltipTrigger, TooltipPortal, TooltipContent, TooltipArrow, useForwardPropsEmits } from 'radix-vue'
48
+ import { TooltipRoot, TooltipTrigger, TooltipPortal, TooltipContent, TooltipArrow, useForwardPropsEmits } from 'reka-ui'
52
49
  import { reactivePick } from '@vueuse/core'
53
50
  import UKbd from './Kbd.vue'
54
51
 
@@ -59,7 +56,7 @@ const emits = defineEmits<TooltipEmits>()
59
56
  const slots = defineSlots<TooltipSlots>()
60
57
 
61
58
  const rootProps = useForwardPropsEmits(reactivePick(props, 'defaultOpen', 'open', 'delayDuration', 'disableHoverableContent', 'disableClosingTrigger', 'disabled', 'ignoreNonKeyboardFocus'), emits)
62
- const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8 }) as TooltipContentProps)
59
+ const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as TooltipContentProps)
63
60
  const arrowProps = toRef(() => props.arrow as TooltipArrowProps)
64
61
 
65
62
  // eslint-disable-next-line vue/no-dupe-keys
@@ -70,12 +67,12 @@ const ui = computed(() => tooltip({
70
67
 
71
68
  <template>
72
69
  <TooltipRoot v-slot="{ open }" v-bind="rootProps">
73
- <TooltipTrigger v-if="!!slots.default" as-child>
70
+ <TooltipTrigger v-if="!!slots.default" v-bind="$attrs" as-child :class="props.class">
74
71
  <slot :open="open" />
75
72
  </TooltipTrigger>
76
73
 
77
74
  <TooltipPortal :disabled="!portal">
78
- <TooltipContent v-bind="contentProps" :class="ui.content({ class: [props.class, props.ui?.content] })">
75
+ <TooltipContent v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })">
79
76
  <slot name="content">
80
77
  <span v-if="text" :class="ui.text({ class: props.ui?.text })">{{ text }}</span>
81
78
 
@@ -0,0 +1,196 @@
1
+ <script lang="ts">
2
+ import type { VariantProps } from 'tailwind-variants'
3
+ import type { TreeRootProps, TreeRootEmits } from 'reka-ui'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/tree'
7
+ import { tv } from '../utils/tv'
8
+ import type { PartialString, DynamicSlots, MaybeMultipleModelValue, SelectItemKey } from '../types/utils'
9
+
10
+ const appConfig = _appConfig as AppConfig & { ui: { tree: Partial<typeof theme> } }
11
+
12
+ const tree = tv({ extend: tv(theme), ...(appConfig.ui?.tree || {}) })
13
+
14
+ type TreeVariants = VariantProps<typeof tree>
15
+
16
+ export type TreeItem = {
17
+ icon?: string
18
+ label?: string
19
+ trailingIcon?: string
20
+ defaultExpanded?: boolean
21
+ disabled?: boolean
22
+ value?: string
23
+ slot?: string
24
+ children?: TreeItem[]
25
+ onToggle?(e: Event): void
26
+ onSelect?(e?: Event): void
27
+ }
28
+
29
+ export interface TreeProps<T extends TreeItem, M extends boolean = false, K extends SelectItemKey<T> | undefined = undefined> extends Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled'> {
30
+ /**
31
+ * The element or component this component should render as.
32
+ * @defaultValue 'ul'
33
+ */
34
+ as?: any
35
+ color?: TreeVariants['color']
36
+ size?: TreeVariants['size']
37
+ /**
38
+ * The key used to get the value from the item.
39
+ * @defaultValue 'value'
40
+ */
41
+ valueKey?: K
42
+ /**
43
+ * The key used to get the label from the item.
44
+ * @defaultValue 'label'
45
+ */
46
+ labelKey?: K
47
+ /**
48
+ * The icon displayed on the right side of a parent node.
49
+ * @defaultValue appConfig.ui.icons.chevronDown
50
+ */
51
+ trailingIcon?: string
52
+ /**
53
+ * The icon displayed when a parent node is expanded.
54
+ * @defaultValue appConfig.ui.icons.folderOpen
55
+ */
56
+ expandedIcon?: string
57
+ /**
58
+ * The icon displayed when a parent node is collapsed.
59
+ * @defaultValue appConfig.ui.icons.folder
60
+ */
61
+ collapsedIcon?: string
62
+ items?: T[]
63
+ /** The controlled value of the Tree. Can be bind as `v-model`. */
64
+ modelValue?: MaybeMultipleModelValue<T, M>
65
+ /** The value of the Tree when initially rendered. Use when you do not need to control the state of the Tree. */
66
+ defaultValue?: MaybeMultipleModelValue<T, M>
67
+ /** Whether multiple options can be selected or not. */
68
+ multiple?: M & boolean
69
+ class?: any
70
+ ui?: PartialString<typeof tree.slots>
71
+ }
72
+
73
+ export type TreeEmits<T, M extends boolean = false> = Omit<TreeRootEmits, 'update:modelValue'> & {
74
+ 'update:modelValue': [payload: MaybeMultipleModelValue<T, M>]
75
+ }
76
+
77
+ type SlotProps<T> = (props: { item: T, index: number, level: number, expanded: boolean, selected: boolean }) => any
78
+
79
+ export type TreeSlots<T extends { slot?: string }> = {
80
+ 'item': SlotProps<T>
81
+ 'item-leading': SlotProps<T>
82
+ 'item-label': SlotProps<T>
83
+ 'item-trailing': SlotProps<T>
84
+ } & DynamicSlots<T, SlotProps<T>>
85
+ </script>
86
+
87
+ <script setup lang="ts" generic="T extends TreeItem, M extends boolean = false, K extends SelectItemKey<T> | undefined = undefined">
88
+ import { computed } from 'vue'
89
+ import type { PropType } from 'vue'
90
+ import { TreeRoot, TreeItem, useForwardPropsEmits } from 'reka-ui'
91
+ import { reactivePick, createReusableTemplate } from '@vueuse/core'
92
+ import { get } from '../utils'
93
+ import UIcon from './Icon.vue'
94
+
95
+ const props = withDefaults(defineProps<TreeProps<T, M, K>>(), {
96
+ labelKey: 'label' as never,
97
+ valueKey: 'value' as never
98
+ })
99
+ const emits = defineEmits<TreeEmits<T, M>>()
100
+ const slots = defineSlots<TreeSlots<T>>()
101
+
102
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'items', 'multiple', 'expanded', 'disabled', 'propagateSelect'), emits)
103
+
104
+ const [DefineTreeTemplate, ReuseTreeTemplate] = createReusableTemplate<{ items?: T[], level: number }>({
105
+ props: {
106
+ items: Array as PropType<T[]>,
107
+ level: Number
108
+ }
109
+ })
110
+
111
+ const ui = computed(() => tree({
112
+ color: props.color,
113
+ size: props.size
114
+ }))
115
+
116
+ function getItemLabel(item: T) {
117
+ return get(item, props.labelKey as string)
118
+ }
119
+
120
+ function getItemValue(item?: T) {
121
+ return get(item, props.valueKey as string) ?? get(item, props.labelKey as string)
122
+ }
123
+
124
+ function getDefaultOpenedItems(item: T): string[] {
125
+ const currentItem = item.defaultExpanded ? getItemValue(item) : null
126
+ const childItems = item.children?.flatMap(child => getDefaultOpenedItems(child as T)) ?? []
127
+
128
+ return [currentItem, ...childItems].filter(Boolean) as string[]
129
+ }
130
+
131
+ const defaultExpanded = computed(() => props.defaultExpanded ?? props.items?.flatMap(getDefaultOpenedItems))
132
+ </script>
133
+
134
+ <!-- eslint-disable vue/no-template-shadow -->
135
+ <template>
136
+ <DefineTreeTemplate v-slot="{ items, level }">
137
+ <li
138
+ v-for="(item, index) in items"
139
+ :key="`${level}-${index}`"
140
+ :class="level > 0 ? ui.itemWithChildren({ class: props.ui?.itemWithChildren }) : ui.item({ class: props.ui?.item })"
141
+ >
142
+ <TreeItem
143
+ v-slot="{ isExpanded, isSelected }"
144
+ as-child
145
+ :level="level"
146
+ :value="item"
147
+ @toggle="item.onToggle"
148
+ @select="item.onSelect"
149
+ >
150
+ <button :disabled="item.disabled || disabled" :class="ui.link({ class: props.ui?.link, selected: isSelected, disabled: item.disabled || disabled })">
151
+ <slot :name="item.slot || 'item'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }">
152
+ <slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }">
153
+ <UIcon
154
+ v-if="item.icon"
155
+ :name="item.icon"
156
+ :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon })"
157
+ />
158
+ <UIcon
159
+ v-else-if="item.children?.length"
160
+ :name="isExpanded ? (expandedIcon ?? appConfig.ui.icons.folderOpen) : (collapsedIcon ?? appConfig.ui.icons.folder)"
161
+ :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon })"
162
+ />
163
+ </slot>
164
+
165
+ <span v-if="getItemLabel(item) || !!slots[item.slot ? `${item.slot}-label`: 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
166
+ <slot :name="item.slot ? `${item.slot}-label`: 'item-label'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }">
167
+ {{ getItemLabel(item) }}
168
+ </slot>
169
+ </span>
170
+
171
+ <span v-if="item.trailingIcon || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing`: 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
172
+ <slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }">
173
+ <UIcon v-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon })" />
174
+ <UIcon v-else-if="item.children?.length" :name="trailingIcon ?? appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon })" />
175
+ </slot>
176
+ </span>
177
+ </slot>
178
+ </button>
179
+
180
+ <ul v-if="item.children?.length && isExpanded" :class="ui.listWithChildren({ class: props.ui?.listWithChildren })">
181
+ <ReuseTreeTemplate :items="(item.children as T[])" :level="level + 1" />
182
+ </ul>
183
+ </TreeItem>
184
+ </li>
185
+ </DefineTreeTemplate>
186
+
187
+ <TreeRoot
188
+ v-bind="rootProps"
189
+ :class="ui.root({ class: [props.class, props.ui?.root] })"
190
+ :get-key="getItemValue"
191
+ :default-expanded="defaultExpanded"
192
+ :selection-behavior="selectionBehavior"
193
+ >
194
+ <ReuseTreeTemplate :items="items" :level="0" />
195
+ </TreeRoot>
196
+ </template>
@@ -11,5 +11,5 @@ export interface ShortcutsOptions {
11
11
  chainDelay?: number;
12
12
  }
13
13
  export declare function extractShortcuts(items: any[] | any[][]): Record<string, Handler>;
14
- export declare function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options?: ShortcutsOptions): void;
14
+ export declare function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options?: ShortcutsOptions): import("@vueuse/core").Fn;
15
15
  export {};
@@ -6,7 +6,7 @@ export function extractShortcuts(items) {
6
6
  const shortcuts = {};
7
7
  function traverse(items2) {
8
8
  items2.forEach((item) => {
9
- if (item.kbds?.length && (item.select || item.click)) {
9
+ if (item.kbds?.length && (item.onSelect || item.onClick)) {
10
10
  const shortcutKey = item.kbds.join("_");
11
11
  shortcuts[shortcutKey] = item.onSelect || item.onClick;
12
12
  }
@@ -131,5 +131,5 @@ export function defineShortcuts(config, options = {}) {
131
131
  return shortcut;
132
132
  }).filter(Boolean);
133
133
  });
134
- useEventListener("keydown", onKeyDown);
134
+ return useEventListener("keydown", onKeyDown);
135
135
  }
@@ -8,13 +8,11 @@ type Props<T> = {
8
8
  name?: string;
9
9
  size?: GetObjectField<T, 'size'>;
10
10
  color?: GetObjectField<T, 'color'>;
11
- eagerValidation?: boolean;
12
- legend?: string;
13
11
  highlight?: boolean;
14
12
  disabled?: boolean;
15
13
  };
16
14
  export declare const formOptionsInjectionKey: InjectionKey<ComputedRef<FormInjectedOptions>>;
17
- export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent, string>>;
15
+ export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent<any>, string>>;
18
16
  export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps>>>;
19
17
  export declare const inputIdInjectionKey: InjectionKey<Ref<string | undefined>>;
20
18
  export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
@@ -24,6 +22,7 @@ export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
24
22
  export declare const formLoadingInjectionKey: InjectionKey<Readonly<Ref<boolean>>>;
25
23
  export declare function useFormField<T>(props?: Props<T>, opts?: {
26
24
  bind?: boolean;
25
+ deferInputValidation?: boolean;
27
26
  }): {
28
27
  id: ComputedRef<string | undefined>;
29
28
  name: ComputedRef<string | undefined>;
@@ -34,5 +33,10 @@ export declare function useFormField<T>(props?: Props<T>, opts?: {
34
33
  emitFormBlur: () => void;
35
34
  emitFormInput: import("@vueuse/core").PromisifyFn<() => void>;
36
35
  emitFormChange: () => void;
36
+ emitFormFocus: () => void;
37
+ ariaAttrs: ComputedRef<{
38
+ 'aria-describedby': string;
39
+ 'aria-invalid': boolean;
40
+ } | undefined>;
37
41
  };
38
42
  export {};
@@ -1,4 +1,4 @@
1
- import { inject, ref, computed } from "vue";
1
+ import { inject, computed } from "vue";
2
2
  import { useDebounceFn } from "@vueuse/core";
3
3
  export const formOptionsInjectionKey = Symbol("nuxt-ui.form-options");
4
4
  export const formBusInjectionKey = Symbol("nuxt-ui.form-events");
@@ -13,7 +13,7 @@ export function useFormField(props, opts) {
13
13
  const formInputs = inject(formInputsInjectionKey, void 0);
14
14
  const inputId = inject(inputIdInjectionKey, void 0);
15
15
  if (formField && inputId) {
16
- if (opts?.bind === false || props?.legend) {
16
+ if (opts?.bind === false) {
17
17
  inputId.value = void 0;
18
18
  } else if (props?.id) {
19
19
  inputId.value = props?.id;
@@ -22,22 +22,23 @@ export function useFormField(props, opts) {
22
22
  formInputs.value[formField.value.name] = { id: inputId.value, pattern: formField.value.errorPattern };
23
23
  }
24
24
  }
25
- const blurred = ref(false);
26
- function emitFormEvent(type, name) {
25
+ function emitFormEvent(type, name, eager) {
27
26
  if (formBus && formField && name) {
28
- formBus.emit({ type, name });
27
+ formBus.emit({ type, name, eager });
29
28
  }
30
29
  }
31
30
  function emitFormBlur() {
32
31
  emitFormEvent("blur", formField?.value.name);
33
- blurred.value = true;
32
+ }
33
+ function emitFormFocus() {
34
+ emitFormEvent("focus", formField?.value.name);
34
35
  }
35
36
  function emitFormChange() {
36
37
  emitFormEvent("change", formField?.value.name);
37
38
  }
38
39
  const emitFormInput = useDebounceFn(
39
40
  () => {
40
- emitFormEvent("input", formField?.value.name);
41
+ emitFormEvent("input", formField?.value.name, !opts?.deferInputValidation || formField?.value.eagerValidation);
41
42
  },
42
43
  formField?.value.validateOnInputDelay ?? formOptions?.value.validateOnInputDelay ?? 0
43
44
  );
@@ -50,6 +51,15 @@ export function useFormField(props, opts) {
50
51
  disabled: computed(() => formOptions?.value.disabled || props?.disabled),
51
52
  emitFormBlur,
52
53
  emitFormInput,
53
- emitFormChange
54
+ emitFormChange,
55
+ emitFormFocus,
56
+ ariaAttrs: computed(() => {
57
+ if (!formField?.value) return;
58
+ const descriptiveAttrs = ["error", "hint", "description"].filter((type) => formField?.value?.[type]).map((type) => `${formField?.value.ariaId}-${type}`) || [];
59
+ return {
60
+ "aria-describedby": descriptiveAttrs.join(" "),
61
+ "aria-invalid": !!formField?.value.error
62
+ };
63
+ })
54
64
  };
55
65
  }
@@ -1,6 +1,6 @@
1
1
  import { computed, inject, ref } from "vue";
2
2
  import { buildLocaleContext } from "../utils/locale.js";
3
- import { en } from "../locale/index.js";
3
+ import en from "../locale/en.js";
4
4
  import { createSharedComposable } from "@vueuse/core";
5
5
  export const localeContextInjectionKey = Symbol("nuxt-ui.locale-context");
6
6
  const _useLocale = (localeOverrides) => {
@@ -0,0 +1,30 @@
1
+ import type { Component } from 'vue';
2
+ import type { ComponentProps } from 'vue-component-type-helpers';
3
+ export type OverlayOptions<OverlayAttrs = Record<string, any>> = {
4
+ defaultOpen?: boolean;
5
+ props?: OverlayAttrs;
6
+ destroyOnClose?: boolean;
7
+ };
8
+ type ManagedOverlayOptionsPrivate<T extends Component> = {
9
+ component?: T;
10
+ id: symbol;
11
+ isMounted: boolean;
12
+ modelValue: boolean;
13
+ resolvePromise?: (value: unknown) => void;
14
+ };
15
+ export type Overlay = OverlayOptions<Component> & ManagedOverlayOptionsPrivate<Component>;
16
+ interface OverlayInstance<T> {
17
+ open: (props?: ComponentProps<T>) => Promise<any>;
18
+ close: (value?: any) => void;
19
+ patch: (props: Partial<ComponentProps<T>>) => void;
20
+ }
21
+ declare function _useOverlay(): {
22
+ overlays: any;
23
+ open: <T extends Component>(id: symbol, props?: ComponentProps<T>) => Promise<any>;
24
+ close: (id: symbol, value?: any) => void;
25
+ create: <T extends Component>(component: T, _options?: OverlayOptions<ComponentProps<T>>) => OverlayInstance<T>;
26
+ patch: <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>) => void;
27
+ unMount: (id: symbol) => void;
28
+ };
29
+ export declare const useOverlay: typeof _useOverlay;
30
+ export {};
@@ -0,0 +1,70 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ function _useOverlay() {
3
+ const overlays = shallowReactive([]);
4
+ const create = (component, _options) => {
5
+ const { props, defaultOpen, destroyOnClose } = _options || {};
6
+ const options = reactive({
7
+ id: Symbol(import.meta.dev ? "useOverlay" : ""),
8
+ modelValue: !!defaultOpen,
9
+ component: markRaw(component),
10
+ isMounted: !!defaultOpen,
11
+ destroyOnClose: !!destroyOnClose,
12
+ props: props || {}
13
+ });
14
+ overlays.push(options);
15
+ return {
16
+ open: (props2) => open(options.id, props2),
17
+ close: (value) => close(options.id, value),
18
+ patch: (props2) => patch(options.id, props2)
19
+ };
20
+ };
21
+ const open = (id, props) => {
22
+ const overlay = getOverlay(id);
23
+ if (props) {
24
+ patch(overlay.id, props);
25
+ }
26
+ overlay.modelValue = true;
27
+ overlay.isMounted = true;
28
+ return new Promise((resolve) => {
29
+ overlay.resolvePromise = resolve;
30
+ });
31
+ };
32
+ const close = (id, value) => {
33
+ const overlay = getOverlay(id);
34
+ overlay.modelValue = false;
35
+ if (overlay.resolvePromise) {
36
+ overlay.resolvePromise(value);
37
+ overlay.resolvePromise = void 0;
38
+ }
39
+ };
40
+ const unMount = (id) => {
41
+ const overlay = getOverlay(id);
42
+ overlay.isMounted = false;
43
+ if (overlay.destroyOnClose) {
44
+ const index = overlays.findIndex((overlay2) => overlay2.id === id);
45
+ overlays.splice(index, 1);
46
+ }
47
+ };
48
+ const patch = (id, props) => {
49
+ const overlay = getOverlay(id);
50
+ Object.entries(props).forEach(([key, value]) => {
51
+ overlay.props[key] = value;
52
+ });
53
+ };
54
+ const getOverlay = (id) => {
55
+ const overlay = overlays.find((overlay2) => overlay2.id === id);
56
+ if (!overlay) {
57
+ throw new Error("Overlay not found");
58
+ }
59
+ return overlay;
60
+ };
61
+ return {
62
+ overlays,
63
+ open,
64
+ close,
65
+ create,
66
+ patch,
67
+ unMount
68
+ };
69
+ }
70
+ export const useOverlay = createSharedComposable(_useOverlay);
@@ -1,7 +1,8 @@
1
- import type { ToastProps } from '../types';
2
- export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
1
+ import type { ToastProps, ToastEmits } from '../types';
2
+ import type { EmitsToProps } from '../types/utils';
3
+ export interface Toast extends Omit<ToastProps, 'defaultOpen'>, EmitsToProps<ToastEmits> {
3
4
  id: string | number;
4
- click?: (toast: Toast) => void;
5
+ onClick?: (toast: Toast) => void;
5
6
  }
6
7
  export declare function useToast(): {
7
8
  toasts: import("vue").Ref<Toast[], Toast[]>;
@@ -1,17 +1,31 @@
1
+ import { ref, nextTick } from "vue";
1
2
  import { useState } from "#imports";
2
3
  export function useToast() {
3
4
  const toasts = useState("toasts", () => []);
5
+ const maxToasts = 5;
6
+ const running = ref(false);
7
+ const queue = [];
8
+ const generateId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
9
+ async function processQueue() {
10
+ if (running.value || queue.length === 0) {
11
+ return;
12
+ }
13
+ running.value = true;
14
+ while (queue.length > 0) {
15
+ const toast = queue.shift();
16
+ await nextTick();
17
+ toasts.value = [...toasts.value, toast].slice(-maxToasts);
18
+ }
19
+ running.value = false;
20
+ }
4
21
  function add(toast) {
5
22
  const body = {
6
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
23
+ id: generateId(),
7
24
  open: true,
8
25
  ...toast
9
26
  };
10
- const index = toasts.value.findIndex((t) => t.id === body.id);
11
- if (index === -1) {
12
- toasts.value.push(body);
13
- }
14
- toasts.value = toasts.value.slice(-5);
27
+ queue.push(body);
28
+ processQueue();
15
29
  return body;
16
30
  }
17
31
  function update(id, toast) {
@@ -1 +1 @@
1
- @import "./keyframes.css";@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased text-[var(--ui-text)] bg-[var(--ui-bg)]}:root{color-scheme:light;--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-bg:var(--color-white);--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900);--ui-radius:var(--radius-sm);--ui-container:var(--container-7xl)}.dark{color-scheme:dark;--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:var(--color-white);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:var(--color-white);--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:var(--color-white)}}
1
+ @import "#build/ui.css";@import "./keyframes.css";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased text-(--ui-text) bg-(--ui-bg) scheme-light dark:scheme-dark}.light,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-bg:var(--color-white);--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900);--ui-radius:var(--radius-sm);--ui-container:var(--container-7xl)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:var(--color-white);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:var(--color-white);--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:var(--color-white)}}
@@ -1 +1 @@
1
- @keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}@keyframes collapsible-up{0%{height:var(--radix-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slide-in-from-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-out-to-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slide-out-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-to-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes slide-in-from-top-and-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-top-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes slide-in-from-right-and-fade{0%{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-right-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(4px)}}@keyframes slide-in-from-bottom-and-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-bottom-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}@keyframes slide-in-from-left-and-fade{0%{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-left-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-4px)}}@keyframes enter-from-right{0%{opacity:0;transform:translateX(200px)}to{opacity:1;transform:translateX(0)}}@keyframes enter-from-left{0%{opacity:0;transform:translateX(-200px)}to{opacity:1;transform:translateX(0)}}@keyframes exit-to-right{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(200px)}}@keyframes exit-to-left{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-200px)}}@keyframes carousel{0%,to{width:50%}0%{transform:translateX(-100%)}to{transform:translateX(200%)}}@keyframes carousel-vertical{0%,to{height:50%}0%{transform:translateY(-100%)}to{transform:translateY(200%)}}@keyframes carousel-inverse{0%,to{width:50%}0%{transform:translateX(200%)}to{transform:translateX(-100%)}}@keyframes carousel-inverse-vertical{0%,to{height:50%}0%{transform:translateY(200%)}to{transform:translateY(-100%)}}@keyframes swing{0%,to{width:50%}0%,to{transform:translateX(-25%)}50%{transform:translateX(125%)}}@keyframes swing-vertical{0%,to{height:50%}0%,to{transform:translateY(-25%)}50%{transform:translateY(125%)}}@keyframes elastic{0%,to{margin-left:25%;width:50%}50%{margin-left:5%;width:90%}}@keyframes elastic-vertical{0%,to{height:50%;margin-top:25%}50%{height:90%;margin-top:5%}}
1
+ @keyframes accordion-up{0%{height:var(--reka-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--reka-accordion-content-height)}}@keyframes collapsible-up{0%{height:var(--reka-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--reka-collapsible-content-height)}}@keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slide-in-from-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-out-to-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slide-out-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-to-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes slide-in-from-top-and-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-top-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes slide-in-from-right-and-fade{0%{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-right-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(4px)}}@keyframes slide-in-from-bottom-and-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-bottom-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}@keyframes slide-in-from-left-and-fade{0%{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-left-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-4px)}}@keyframes enter-from-right{0%{opacity:0;transform:translateX(200px)}to{opacity:1;transform:translateX(0)}}@keyframes enter-from-left{0%{opacity:0;transform:translateX(-200px)}to{opacity:1;transform:translateX(0)}}@keyframes exit-to-right{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(200px)}}@keyframes exit-to-left{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-200px)}}@keyframes carousel{0%,to{width:50%}0%{transform:translateX(-100%)}to{transform:translateX(200%)}}@keyframes carousel-rtl{0%,to{width:50%}0%{transform:translateX(100%)}to{transform:translateX(-200%)}}@keyframes carousel-vertical{0%,to{height:50%}0%{transform:translateY(-100%)}to{transform:translateY(200%)}}@keyframes carousel-inverse{0%,to{width:50%}0%{transform:translateX(200%)}to{transform:translateX(-100%)}}@keyframes carousel-inverse-rtl{0%,to{width:50%}0%{transform:translateX(-200%)}to{transform:translateX(100%)}}@keyframes carousel-inverse-vertical{0%,to{height:50%}0%{transform:translateY(200%)}to{transform:translateY(-100%)}}@keyframes swing{0%,to{width:50%}0%,to{transform:translateX(-25%)}50%{transform:translateX(125%)}}@keyframes swing-vertical{0%,to{height:50%}0%,to{transform:translateY(-25%)}50%{transform:translateY(125%)}}@keyframes elastic{0%,to{margin-left:25%;width:50%}50%{margin-left:5%;width:90%}}@keyframes elastic-vertical{0%,to{height:50%;margin-top:25%}50%{height:90%;margin-top:5%}}