@nuxt/ui 3.0.0-alpha.0 → 3.0.0-alpha.10

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 (322) hide show
  1. package/.nuxt/ui/accordion.ts +20 -0
  2. package/.nuxt/ui/alert.ts +242 -0
  3. package/.nuxt/ui/avatar-group.ts +40 -0
  4. package/.nuxt/ui/avatar.ts +42 -0
  5. package/.nuxt/ui/badge.ts +194 -0
  6. package/.nuxt/ui/breadcrumb.ts +45 -0
  7. package/.nuxt/ui/button-group.ts +16 -0
  8. package/.nuxt/ui/button.ts +344 -0
  9. package/.nuxt/ui/calendar.ts +85 -0
  10. package/.nuxt/ui/card.ts +8 -0
  11. package/.nuxt/ui/carousel.ts +41 -0
  12. package/.nuxt/ui/checkbox.ts +105 -0
  13. package/.nuxt/ui/chip.ts +67 -0
  14. package/.nuxt/ui/collapsible.ts +6 -0
  15. package/.nuxt/ui/color-picker.ts +39 -0
  16. package/.nuxt/ui/command-palette.ts +50 -0
  17. package/.nuxt/ui/container.ts +3 -0
  18. package/.nuxt/ui/context-menu.ts +198 -0
  19. package/.nuxt/ui/drawer.ts +55 -0
  20. package/.nuxt/ui/dropdown-menu.ts +199 -0
  21. package/.nuxt/ui/form-field.ts +40 -0
  22. package/.nuxt/ui/form.ts +3 -0
  23. package/.nuxt/ui/index.ts +48 -0
  24. package/.nuxt/ui/input-menu.ts +410 -0
  25. package/.nuxt/ui/input-number.ts +204 -0
  26. package/.nuxt/ui/input.ts +263 -0
  27. package/.nuxt/ui/kbd.ts +19 -0
  28. package/.nuxt/ui/link.ts +15 -0
  29. package/.nuxt/ui/modal.ts +28 -0
  30. package/.nuxt/ui/navigation-menu.ts +390 -0
  31. package/.nuxt/ui/pagination.ts +8 -0
  32. package/.nuxt/ui/pin-input.ts +145 -0
  33. package/.nuxt/ui/popover.ts +6 -0
  34. package/.nuxt/ui/progress.ts +258 -0
  35. package/.nuxt/ui/radio-group.ts +112 -0
  36. package/.nuxt/ui/select-menu.ts +316 -0
  37. package/.nuxt/ui/select.ts +315 -0
  38. package/.nuxt/ui/separator.ts +143 -0
  39. package/.nuxt/ui/skeleton.ts +3 -0
  40. package/.nuxt/ui/slideover.ts +63 -0
  41. package/.nuxt/ui/slider.ts +148 -0
  42. package/.nuxt/ui/stepper.ts +180 -0
  43. package/.nuxt/ui/switch.ts +113 -0
  44. package/.nuxt/ui/table.ts +129 -0
  45. package/.nuxt/ui/tabs.ts +227 -0
  46. package/.nuxt/ui/textarea.ts +263 -0
  47. package/.nuxt/ui/toast.ts +66 -0
  48. package/.nuxt/ui/toaster.ts +75 -0
  49. package/.nuxt/ui/tooltip.ts +9 -0
  50. package/README.md +75 -54
  51. package/cli/commands/{init.mjs → make/component.mjs} +5 -5
  52. package/cli/commands/make/index.mjs +14 -0
  53. package/cli/commands/make/locale.mjs +64 -0
  54. package/cli/index.mjs +2 -2
  55. package/cli/templates.mjs +52 -7
  56. package/cli/utils.mjs +14 -0
  57. package/dist/chunks/component-meta.cjs +82802 -0
  58. package/dist/chunks/component-meta.mjs +82800 -0
  59. package/dist/client/devtools/200.html +1 -0
  60. package/dist/client/devtools/404.html +1 -0
  61. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
  62. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
  63. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
  64. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
  65. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
  66. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
  67. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
  68. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
  69. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
  70. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
  71. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
  72. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
  73. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
  74. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
  75. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
  76. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
  77. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
  78. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
  79. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
  80. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
  81. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
  82. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
  83. package/dist/client/devtools/_nuxt/B1fTd_Rf.js +1 -0
  84. package/dist/client/devtools/_nuxt/CSUxkedg.js +1 -0
  85. package/dist/client/devtools/_nuxt/CbRTGpb7.js +1 -0
  86. package/dist/client/devtools/_nuxt/YQTlxbcT.js +53 -0
  87. package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
  88. package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +1 -0
  89. package/dist/client/devtools/_nuxt/entry.DXXceQev.css +1 -0
  90. package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +1 -0
  91. package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +1 -0
  92. package/dist/client/devtools/favicon.svg +1 -0
  93. package/dist/client/devtools/index.html +1 -0
  94. package/dist/devtools/runtime/DevtoolsRenderer.vue +54 -0
  95. package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
  96. package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
  97. package/dist/devtools/runtime/examples/CardExample.vue +13 -0
  98. package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
  99. package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
  100. package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
  101. package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
  102. package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
  103. package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
  104. package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
  105. package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
  106. package/dist/devtools/runtime/examples/FormExample.vue +30 -0
  107. package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
  108. package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
  109. package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
  110. package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
  111. package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
  112. package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
  113. package/dist/devtools/runtime/examples/StepperExample.vue +44 -0
  114. package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
  115. package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
  116. package/dist/module.cjs +223 -4
  117. package/dist/module.d.cts +54 -0
  118. package/dist/module.d.mts +38 -7
  119. package/dist/module.d.ts +38 -7
  120. package/dist/module.json +4 -3
  121. package/dist/module.mjs +180 -2617
  122. package/dist/runtime/components/Accordion.vue +95 -11
  123. package/dist/runtime/components/Alert.vue +69 -10
  124. package/dist/runtime/components/App.vue +28 -5
  125. package/dist/runtime/components/Avatar.vue +57 -12
  126. package/dist/runtime/components/AvatarGroup.vue +34 -7
  127. package/dist/runtime/components/Badge.vue +61 -9
  128. package/dist/runtime/components/Breadcrumb.vue +93 -16
  129. package/dist/runtime/components/Button.vue +78 -12
  130. package/dist/runtime/components/ButtonGroup.vue +35 -8
  131. package/dist/runtime/components/Calendar.vue +190 -0
  132. package/dist/runtime/components/Card.vue +29 -7
  133. package/dist/runtime/components/Carousel.vue +322 -0
  134. package/dist/runtime/components/Checkbox.vue +64 -30
  135. package/dist/runtime/components/Chip.vue +48 -8
  136. package/dist/runtime/components/Collapsible.vue +32 -8
  137. package/dist/runtime/components/ColorPicker.vue +265 -0
  138. package/dist/runtime/components/CommandPalette.vue +207 -88
  139. package/dist/runtime/components/Container.vue +26 -7
  140. package/dist/runtime/components/ContextMenu.vue +150 -11
  141. package/dist/runtime/components/ContextMenuContent.vue +63 -19
  142. package/dist/runtime/components/Drawer.vue +68 -15
  143. package/dist/runtime/components/DropdownMenu.vue +147 -12
  144. package/dist/runtime/components/DropdownMenuContent.vue +69 -19
  145. package/dist/runtime/components/Form.vue +80 -42
  146. package/dist/runtime/components/FormField.vue +58 -21
  147. package/dist/runtime/components/Icon.vue +13 -3
  148. package/dist/runtime/components/Input.vue +61 -12
  149. package/dist/runtime/components/InputMenu.vue +247 -53
  150. package/dist/runtime/components/InputNumber.vue +192 -0
  151. package/dist/runtime/components/Kbd.vue +31 -7
  152. package/dist/runtime/components/Link.vue +148 -21
  153. package/dist/runtime/components/LinkBase.vue +21 -8
  154. package/dist/runtime/components/Modal.vue +90 -15
  155. package/dist/runtime/components/NavigationMenu.vue +234 -69
  156. package/dist/runtime/components/Pagination.vue +124 -15
  157. package/dist/runtime/components/PinInput.vue +96 -0
  158. package/dist/runtime/components/Popover.vue +66 -11
  159. package/dist/runtime/components/Progress.vue +67 -12
  160. package/dist/runtime/components/RadioGroup.vue +78 -9
  161. package/dist/runtime/components/Select.vue +155 -26
  162. package/dist/runtime/components/SelectMenu.vue +245 -63
  163. package/dist/runtime/components/Separator.vue +42 -7
  164. package/dist/runtime/components/Skeleton.vue +22 -7
  165. package/dist/runtime/components/Slideover.vue +88 -15
  166. package/dist/runtime/components/Slider.vue +37 -7
  167. package/dist/runtime/components/Stepper.vue +171 -0
  168. package/dist/runtime/components/Switch.vue +58 -14
  169. package/dist/runtime/components/Table.vue +262 -0
  170. package/dist/runtime/components/Tabs.vue +97 -17
  171. package/dist/runtime/components/Textarea.vue +55 -9
  172. package/dist/runtime/components/Toast.vue +66 -9
  173. package/dist/runtime/components/Toaster.vue +57 -21
  174. package/dist/runtime/components/Tooltip.vue +49 -10
  175. package/dist/runtime/composables/defineLocale.d.ts +9 -0
  176. package/dist/runtime/composables/defineLocale.js +4 -0
  177. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  178. package/dist/runtime/composables/defineShortcuts.js +2 -8
  179. package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
  180. package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
  181. package/dist/runtime/composables/useAvatarGroup.d.ts +2 -2
  182. package/dist/runtime/composables/useButtonGroup.d.ts +5 -5
  183. package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
  184. package/dist/runtime/composables/useFormField.d.ts +13 -6
  185. package/dist/runtime/composables/useFormField.js +12 -7
  186. package/dist/runtime/composables/useKbd.d.ts +10 -3
  187. package/dist/runtime/composables/useKbd.js +14 -8
  188. package/dist/runtime/composables/useLocale.d.ts +4 -0
  189. package/dist/runtime/composables/useLocale.js +10 -0
  190. package/dist/runtime/composables/useModal.d.ts +2 -2
  191. package/dist/runtime/composables/useSlideover.d.ts +2 -2
  192. package/dist/runtime/composables/useToast.d.ts +2 -2
  193. package/dist/runtime/index.css +1 -0
  194. package/dist/runtime/keyframes.css +1 -0
  195. package/dist/runtime/locale/ar.d.ts +2 -0
  196. package/dist/runtime/locale/ar.js +53 -0
  197. package/dist/runtime/locale/cs.d.ts +2 -0
  198. package/dist/runtime/locale/cs.js +52 -0
  199. package/dist/runtime/locale/de.d.ts +2 -0
  200. package/dist/runtime/locale/de.js +52 -0
  201. package/dist/runtime/locale/en.d.ts +2 -0
  202. package/dist/runtime/locale/en.js +52 -0
  203. package/dist/runtime/locale/es.d.ts +2 -0
  204. package/dist/runtime/locale/es.js +52 -0
  205. package/dist/runtime/locale/fa_ir.d.ts +2 -0
  206. package/dist/runtime/locale/fa_ir.js +53 -0
  207. package/dist/runtime/locale/fr.d.ts +2 -0
  208. package/dist/runtime/locale/fr.js +52 -0
  209. package/dist/runtime/locale/index.d.ts +19 -0
  210. package/dist/runtime/locale/index.js +19 -0
  211. package/dist/runtime/locale/it.d.ts +2 -0
  212. package/dist/runtime/locale/it.js +52 -0
  213. package/dist/runtime/locale/ja.d.ts +2 -0
  214. package/dist/runtime/locale/ja.js +52 -0
  215. package/dist/runtime/locale/ko.d.ts +2 -0
  216. package/dist/runtime/locale/ko.js +52 -0
  217. package/dist/runtime/locale/nl.d.ts +2 -0
  218. package/dist/runtime/locale/nl.js +52 -0
  219. package/dist/runtime/locale/pl.d.ts +2 -0
  220. package/dist/runtime/locale/pl.js +52 -0
  221. package/dist/runtime/locale/pt.d.ts +2 -0
  222. package/dist/runtime/locale/pt.js +52 -0
  223. package/dist/runtime/locale/pt_br.d.ts +2 -0
  224. package/dist/runtime/locale/pt_br.js +52 -0
  225. package/dist/runtime/locale/ru.d.ts +2 -0
  226. package/dist/runtime/locale/ru.js +52 -0
  227. package/dist/runtime/locale/sk.d.ts +2 -0
  228. package/dist/runtime/locale/sk.js +52 -0
  229. package/dist/runtime/locale/tr.d.ts +2 -0
  230. package/dist/runtime/locale/tr.js +52 -0
  231. package/dist/runtime/locale/zh_hans.d.ts +2 -0
  232. package/dist/runtime/locale/zh_hans.js +52 -0
  233. package/dist/runtime/locale/zh_hant.d.ts +2 -0
  234. package/dist/runtime/locale/zh_hant.js +52 -0
  235. package/dist/runtime/plugins/colors.d.ts +2 -0
  236. package/dist/runtime/plugins/colors.js +12 -8
  237. package/dist/runtime/plugins/modal.d.ts +2 -0
  238. package/dist/runtime/plugins/slideover.d.ts +2 -0
  239. package/dist/runtime/types/form.d.ts +10 -4
  240. package/dist/runtime/types/index.d.ts +50 -42
  241. package/dist/runtime/types/index.js +8 -0
  242. package/dist/runtime/types/locale.d.ts +54 -0
  243. package/dist/runtime/types/utils.d.ts +8 -3
  244. package/dist/runtime/utils/form.d.ts +7 -5
  245. package/dist/runtime/utils/form.js +117 -28
  246. package/dist/runtime/utils/index.d.ts +2 -1
  247. package/dist/runtime/utils/index.js +16 -0
  248. package/dist/runtime/utils/link.d.ts +25 -55
  249. package/dist/runtime/utils/link.js +1 -1
  250. package/dist/runtime/utils/locale.d.ts +15 -0
  251. package/dist/runtime/utils/locale.js +25 -0
  252. package/dist/runtime/vue/components/Icon.vue +15 -0
  253. package/dist/runtime/vue/components/Link.vue +208 -0
  254. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  255. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  256. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  257. package/dist/runtime/vue/plugins/head.js +6 -0
  258. package/dist/runtime/vue/stubs.d.ts +15 -0
  259. package/dist/runtime/vue/stubs.js +27 -0
  260. package/dist/shared/ui.CwmIkD_Y.cjs +3269 -0
  261. package/dist/shared/ui.D_93iuwH.mjs +3262 -0
  262. package/dist/unplugin.cjs +192 -0
  263. package/dist/unplugin.d.cts +49 -0
  264. package/dist/unplugin.d.mts +49 -0
  265. package/dist/unplugin.d.ts +49 -0
  266. package/dist/unplugin.mjs +181 -0
  267. package/dist/vite.cjs +22 -0
  268. package/dist/vite.d.cts +13 -0
  269. package/dist/vite.d.mts +13 -0
  270. package/dist/vite.d.ts +13 -0
  271. package/dist/vite.mjs +20 -0
  272. package/package.json +103 -37
  273. package/vue-plugin.d.ts +5 -0
  274. package/dist/runtime/assets/css/animations.css +0 -1
  275. package/dist/runtime/components/Accordion.vue.d.ts +0 -492
  276. package/dist/runtime/components/Alert.vue.d.ts +0 -548
  277. package/dist/runtime/components/App.vue.d.ts +0 -25
  278. package/dist/runtime/components/Avatar.vue.d.ts +0 -384
  279. package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -381
  280. package/dist/runtime/components/Badge.vue.d.ts +0 -422
  281. package/dist/runtime/components/Breadcrumb.vue.d.ts +0 -307
  282. package/dist/runtime/components/Button.vue.d.ts +0 -949
  283. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -182
  284. package/dist/runtime/components/Card.vue.d.ts +0 -191
  285. package/dist/runtime/components/Checkbox.vue.d.ts +0 -819
  286. package/dist/runtime/components/Chip.vue.d.ts +0 -590
  287. package/dist/runtime/components/Collapsible.vue.d.ts +0 -159
  288. package/dist/runtime/components/CommandPalette.vue.d.ts +0 -684
  289. package/dist/runtime/components/Container.vue.d.ts +0 -27
  290. package/dist/runtime/components/ContextMenu.vue.d.ts +0 -796
  291. package/dist/runtime/components/Drawer.vue.d.ts +0 -343
  292. package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -815
  293. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
  294. package/dist/runtime/components/Form.vue.d.ts +0 -39
  295. package/dist/runtime/components/FormField.vue.d.ts +0 -356
  296. package/dist/runtime/components/Icon.vue.d.ts +0 -17
  297. package/dist/runtime/components/Input.vue.d.ts +0 -1137
  298. package/dist/runtime/components/InputMenu.vue.d.ts +0 -2121
  299. package/dist/runtime/components/Kbd.vue.d.ts +0 -169
  300. package/dist/runtime/components/Link.vue.d.ts +0 -76
  301. package/dist/runtime/components/LinkBase.vue.d.ts +0 -49
  302. package/dist/runtime/components/Modal.vue.d.ts +0 -319
  303. package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -1789
  304. package/dist/runtime/components/Pagination.vue.d.ts +0 -295
  305. package/dist/runtime/components/Popover.vue.d.ts +0 -197
  306. package/dist/runtime/components/Progress.vue.d.ts +0 -1781
  307. package/dist/runtime/components/RadioGroup.vue.d.ts +0 -1715
  308. package/dist/runtime/components/Select.vue.d.ts +0 -1569
  309. package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1661
  310. package/dist/runtime/components/Separator.vue.d.ts +0 -0
  311. package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
  312. package/dist/runtime/components/Slideover.vue.d.ts +0 -375
  313. package/dist/runtime/components/Slider.vue.d.ts +0 -0
  314. package/dist/runtime/components/Switch.vue.d.ts +0 -1676
  315. package/dist/runtime/components/Tabs.vue.d.ts +0 -934
  316. package/dist/runtime/components/Textarea.vue.d.ts +0 -1133
  317. package/dist/runtime/components/Toast.vue.d.ts +0 -0
  318. package/dist/runtime/components/Toaster.vue.d.ts +0 -362
  319. package/dist/runtime/components/Tooltip.vue.d.ts +0 -248
  320. package/dist/runtime/types/component.d.ts +0 -17
  321. package/dist/runtime/types/component.js +0 -0
  322. /package/dist/runtime/{components/ContextMenuContent.vue.d.ts → types/locale.js} +0 -0
@@ -0,0 +1,262 @@
1
+ <!-- eslint-disable vue/block-tag-newline -->
2
+ <script lang="ts">
3
+ import type { Ref } from 'vue'
4
+ import { tv, type VariantProps } from 'tailwind-variants'
5
+ import type { AppConfig } from '@nuxt/schema'
6
+ import type { RowData } from '@tanstack/table-core'
7
+ import type {
8
+ Row,
9
+ ColumnDef,
10
+ ColumnFiltersState,
11
+ ColumnPinningState,
12
+ RowSelectionState,
13
+ SortingState,
14
+ ExpandedState,
15
+ VisibilityState,
16
+ GlobalFilterOptions,
17
+ ColumnFiltersOptions,
18
+ ColumnPinningOptions,
19
+ VisibilityOptions,
20
+ ExpandedOptions,
21
+ SortingOptions,
22
+ RowSelectionOptions,
23
+ Updater,
24
+ CellContext,
25
+ HeaderContext
26
+ } from '@tanstack/vue-table'
27
+ import _appConfig from '#build/app.config'
28
+ import theme from '#build/ui/table'
29
+
30
+ declare module '@tanstack/table-core' {
31
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
+ interface ColumnMeta<TData extends RowData, TValue> {
33
+ class?: {
34
+ th?: string
35
+ td?: string
36
+ }
37
+ }
38
+ }
39
+
40
+ const appConfig = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
41
+
42
+ const table = tv({ extend: tv(theme), ...(appConfig.ui?.table || {}) })
43
+
44
+ type TableVariants = VariantProps<typeof table>
45
+
46
+ export type TableColumn<T> = ColumnDef<T>
47
+
48
+ export interface TableData {
49
+ [key: string]: any
50
+ }
51
+
52
+ export interface TableProps<T> {
53
+ /**
54
+ * The element or component this component should render as.
55
+ * @defaultValue 'div'
56
+ */
57
+ as?: any
58
+ data?: T[]
59
+ columns?: TableColumn<T>[]
60
+ caption?: string
61
+ /**
62
+ * Whether the table should have a sticky header.
63
+ * @defaultValue false
64
+ */
65
+ sticky?: boolean
66
+ /** Whether the table should be in loading state. */
67
+ loading?: boolean
68
+ loadingColor?: TableVariants['loadingColor']
69
+ loadingAnimation?: TableVariants['loadingAnimation']
70
+ /**
71
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
72
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
73
+ */
74
+ globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>
75
+ /**
76
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
77
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
78
+ */
79
+ columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>
80
+ /**
81
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
82
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
83
+ */
84
+ columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>
85
+ /**
86
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
87
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
88
+ */
89
+ visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>
90
+ /**
91
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
92
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
93
+ */
94
+ sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>
95
+ /**
96
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
97
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
98
+ */
99
+ expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>
100
+ /**
101
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
102
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
103
+ */
104
+ rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>
105
+ class?: any
106
+ ui?: Partial<typeof table.slots>
107
+ }
108
+
109
+ type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>
110
+ type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>
111
+
112
+ export type TableSlots<T> = {
113
+ expanded: (props: { row: Row<T> }) => any
114
+ empty: (props?: {}) => any
115
+ caption: (props?: {}) => any
116
+ } & DynamicHeaderSlots<T> & DynamicCellSlots<T>
117
+
118
+ </script>
119
+
120
+ <script setup lang="ts" generic="T extends TableData">
121
+ import { computed } from 'vue'
122
+ import { Primitive } from 'reka-ui'
123
+ import { FlexRender, getCoreRowModel, getFilteredRowModel, getSortedRowModel, getExpandedRowModel, useVueTable } from '@tanstack/vue-table'
124
+ import { upperFirst } from 'scule'
125
+ import { useLocale } from '../composables/useLocale'
126
+
127
+ const props = defineProps<TableProps<T>>()
128
+ defineSlots<TableSlots<T>>()
129
+
130
+ const { t } = useLocale()
131
+
132
+ const data = computed(() => props.data ?? [])
133
+ const columns = computed<TableColumn<T>[]>(() => props.columns ?? Object.keys(data.value[0] ?? {}).map((accessorKey: string) => ({ accessorKey, header: upperFirst(accessorKey) })))
134
+
135
+ const ui = computed(() => table({
136
+ sticky: props.sticky,
137
+ loading: props.loading,
138
+ loadingColor: props.loadingColor,
139
+ loadingAnimation: props.loadingAnimation
140
+ }))
141
+
142
+ const globalFilterState = defineModel<string>('globalFilter', { default: undefined })
143
+ const columnFiltersState = defineModel<ColumnFiltersState>('columnFilters', { default: [] })
144
+ const columnVisibilityState = defineModel<VisibilityState>('columnVisibility', { default: {} })
145
+ const columnPinningState = defineModel<ColumnPinningState>('columnPinning', { default: {} })
146
+ const rowSelectionState = defineModel<RowSelectionState>('rowSelection', { default: {} })
147
+ const sortingState = defineModel<SortingState>('sorting', { default: [] })
148
+ const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
149
+
150
+ const tableApi = useVueTable({
151
+ data,
152
+ columns: columns.value,
153
+ getCoreRowModel: getCoreRowModel(),
154
+ ...(props.globalFilterOptions || {}),
155
+ onGlobalFilterChange: updaterOrValue => valueUpdater(updaterOrValue, globalFilterState),
156
+ ...(props.columnFiltersOptions || {}),
157
+ getFilteredRowModel: getFilteredRowModel(),
158
+ onColumnFiltersChange: updaterOrValue => valueUpdater(updaterOrValue, columnFiltersState),
159
+ ...(props.visibilityOptions || {}),
160
+ onColumnVisibilityChange: updaterOrValue => valueUpdater(updaterOrValue, columnVisibilityState),
161
+ ...(props.columnPinningOptions || {}),
162
+ onColumnPinningChange: updaterOrValue => valueUpdater(updaterOrValue, columnPinningState),
163
+ ...(props.rowSelectionOptions || {}),
164
+ onRowSelectionChange: updaterOrValue => valueUpdater(updaterOrValue, rowSelectionState),
165
+ ...(props.sortingOptions || {}),
166
+ getSortedRowModel: getSortedRowModel(),
167
+ onSortingChange: updaterOrValue => valueUpdater(updaterOrValue, sortingState),
168
+ ...(props.expandedOptions || {}),
169
+ getExpandedRowModel: getExpandedRowModel(),
170
+ onExpandedChange: updaterOrValue => valueUpdater(updaterOrValue, expandedState),
171
+ state: {
172
+ get globalFilter() {
173
+ return globalFilterState.value
174
+ },
175
+ get columnFilters() {
176
+ return columnFiltersState.value
177
+ },
178
+ get columnVisibility() {
179
+ return columnVisibilityState.value
180
+ },
181
+ get columnPinning() {
182
+ return columnPinningState.value
183
+ },
184
+ get expanded() {
185
+ return expandedState.value
186
+ },
187
+ get rowSelection() {
188
+ return rowSelectionState.value
189
+ },
190
+ get sorting() {
191
+ return sortingState.value
192
+ }
193
+ }
194
+ })
195
+
196
+ function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
197
+ ref.value = typeof updaterOrValue === 'function' ? updaterOrValue(ref.value) : updaterOrValue
198
+ }
199
+
200
+ defineExpose({
201
+ tableApi
202
+ })
203
+ </script>
204
+
205
+ <template>
206
+ <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
207
+ <table :class="ui.base({ class: [props.ui?.base] })">
208
+ <caption v-if="caption" :class="ui.caption({ class: [props.ui?.caption] })">
209
+ <slot name="caption">
210
+ {{ caption }}
211
+ </slot>
212
+ </caption>
213
+
214
+ <thead :class="ui.thead({ class: [props.ui?.thead] })">
215
+ <tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })">
216
+ <th
217
+ v-for="header in headerGroup.headers"
218
+ :key="header.id"
219
+ :data-pinned="header.column.getIsPinned()"
220
+ :class="ui.th({ class: [props.ui?.th, header.column.columnDef.meta?.class?.th], pinned: !!header.column.getIsPinned() })"
221
+ >
222
+ <slot :name="`${header.id}-header`" v-bind="header.getContext()">
223
+ <FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext()" />
224
+ </slot>
225
+ </th>
226
+ </tr>
227
+ </thead>
228
+
229
+ <tbody :class="ui.tbody({ class: [props.ui?.tbody] })">
230
+ <template v-if="tableApi.getRowModel().rows?.length">
231
+ <template v-for="row in tableApi.getRowModel().rows" :key="row.id">
232
+ <tr :data-selected="row.getIsSelected()" :data-expanded="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
233
+ <td
234
+ v-for="cell in row.getVisibleCells()"
235
+ :key="cell.id"
236
+ :data-pinned="cell.column.getIsPinned()"
237
+ :class="ui.td({ class: [props.ui?.td, cell.column.columnDef.meta?.class?.td], pinned: !!cell.column.getIsPinned() })"
238
+ >
239
+ <slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
240
+ <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
241
+ </slot>
242
+ </td>
243
+ </tr>
244
+ <tr v-if="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
245
+ <td :colspan="row.getAllCells().length" :class="ui.td({ class: [props.ui?.td] })">
246
+ <slot name="expanded" :row="row" />
247
+ </td>
248
+ </tr>
249
+ </template>
250
+ </template>
251
+
252
+ <tr v-else :class="ui.tr({ class: [props.ui?.tr] })">
253
+ <td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })">
254
+ <slot name="empty">
255
+ {{ t('table.noData') }}
256
+ </slot>
257
+ </td>
258
+ </tr>
259
+ </tbody>
260
+ </table>
261
+ </Primitive>
262
+ </template>
@@ -1,27 +1,107 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/tabs";
5
- const appConfig = _appConfig;
6
- const tabs = tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { TabsRootProps, TabsRootEmits } from 'reka-ui'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/tabs'
7
+ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import type { AvatarProps } from '../types'
9
+ import type { DynamicSlots, PartialString } from '../types/utils'
10
+
11
+ const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
12
+
13
+ const tabs = tv({ extend: tv(theme), ...(appConfig.ui?.tabs || {}) })
14
+
15
+ export interface TabsItem {
16
+ label?: string
17
+ icon?: string
18
+ avatar?: AvatarProps
19
+ slot?: string
20
+ content?: string
21
+ /** A unique value for the tab item. Defaults to the index. */
22
+ value?: string | number
23
+ disabled?: boolean
24
+ }
25
+
26
+ type TabsVariants = VariantProps<typeof tabs>
27
+
28
+ export interface TabsProps<T> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
29
+ /**
30
+ * The element or component this component should render as.
31
+ * @defaultValue 'div'
32
+ */
33
+ as?: any
34
+ items?: T[]
35
+ color?: TabsVariants['color']
36
+ variant?: TabsVariants['variant']
37
+ size?: TabsVariants['size']
38
+ /**
39
+ * The orientation of the tabs.
40
+ * @defaultValue 'horizontal'
41
+ */
42
+ orientation?: TabsRootProps['orientation']
43
+ /**
44
+ * The content of the tabs, can be disabled to prevent rendering the content.
45
+ * @defaultValue true
46
+ */
47
+ content?: boolean
48
+ /**
49
+ * The key used to get the label from the item.
50
+ * @defaultValue 'label'
51
+ */
52
+ labelKey?: string
53
+ class?: any
54
+ ui?: PartialString<typeof tabs.slots>
55
+ }
56
+
57
+ export interface TabsEmits extends TabsRootEmits<string | number> {}
58
+
59
+ type SlotProps<T> = (props: { item: T, index: number }) => any
60
+
61
+ export type TabsSlots<T extends { slot?: string }> = {
62
+ leading: SlotProps<T>
63
+ default: SlotProps<T>
64
+ trailing: SlotProps<T>
65
+ content: SlotProps<T>
66
+ } & DynamicSlots<T, SlotProps<T>>
67
+
68
+ extendDevtoolsMeta({
69
+ defaultProps: {
70
+ items: [{
71
+ label: 'Tab1',
72
+ avatar: { src: 'https://avatars.githubusercontent.com/u/739984?v=4' },
73
+ content: 'This is the content shown for Tab1'
74
+ }, {
75
+ label: 'Tab2',
76
+ icon: 'i-lucide-user',
77
+ content: 'And, this is the content for Tab2'
78
+ }, {
79
+ label: 'Tab3',
80
+ icon: 'i-lucide-bell',
81
+ content: 'Finally, this is the content for Tab3'
82
+ }]
83
+ }
84
+ })
7
85
  </script>
8
86
 
9
87
  <script setup lang="ts" generic="T extends TabsItem">
10
- import { computed, toRef } from 'vue'
11
- import { defu } from 'defu'
12
- import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from 'radix-vue'
88
+ import { computed } from 'vue'
89
+ import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from 'reka-ui'
13
90
  import { reactivePick } from '@vueuse/core'
91
+ import { get } from '../utils'
92
+ import UIcon from './Icon.vue'
93
+ import UAvatar from './Avatar.vue'
14
94
 
15
95
  const props = withDefaults(defineProps<TabsProps<T>>(), {
16
96
  content: true,
17
97
  defaultValue: '0',
18
- orientation: 'horizontal'
98
+ orientation: 'horizontal',
99
+ labelKey: 'label'
19
100
  })
20
101
  const emits = defineEmits<TabsEmits>()
21
102
  const slots = defineSlots<TabsSlots<T>>()
22
103
 
23
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultValue', 'orientation', 'activationMode', 'modelValue'), emits)
24
- const contentProps = toRef(() => defu(props.content || {}, { forceMount: true }) as TabsContentProps)
104
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'activationMode', 'unmountOnHide'), emits)
25
105
 
26
106
  const ui = computed(() => tabs({
27
107
  color: props.color,
@@ -38,12 +118,12 @@ const ui = computed(() => tabs({
38
118
 
39
119
  <TabsTrigger v-for="(item, index) of items" :key="index" :value="item.value || String(index)" :disabled="item.disabled" :class="ui.trigger({ class: props.ui?.trigger })">
40
120
  <slot name="leading" :item="item" :index="index">
41
- <UAvatar v-if="item.avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
42
- <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
121
+ <UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
122
+ <UAvatar v-else-if="item.avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
43
123
  </slot>
44
124
 
45
- <span v-if="item.label || !!slots.default" :class="ui.label({ class: props.ui?.label })">
46
- <slot :item="item" :index="index">{{ item.label }}</slot>
125
+ <span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: props.ui?.label })">
126
+ <slot :item="item" :index="index">{{ get(item, props.labelKey as string) }}</slot>
47
127
  </span>
48
128
 
49
129
  <slot name="trailing" :item="item" :index="index" />
@@ -51,7 +131,7 @@ const ui = computed(() => tabs({
51
131
  </TabsList>
52
132
 
53
133
  <template v-if="!!content">
54
- <TabsContent v-for="(item, index) of items" :key="index" v-bind="contentProps" :value="item.value || String(index)" :class="ui.content({ class: props.ui?.content })">
134
+ <TabsContent v-for="(item, index) of items" :key="index" :value="item.value || String(index)" :class="ui.content({ class: props.ui?.content })">
55
135
  <slot :name="item.slot || 'content'" :item="item" :index="index">
56
136
  {{ item.content }}
57
137
  </slot>
@@ -1,13 +1,55 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/textarea";
5
- const appConfig = _appConfig;
6
- const textarea = tv({ extend: tv(theme), ...appConfig.ui?.textarea || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/ui/textarea'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { textarea: Partial<typeof theme> } }
8
+
9
+ const textarea = tv({ extend: tv(theme), ...(appConfig.ui?.textarea || {}) })
10
+
11
+ type TextareaVariants = VariantProps<typeof textarea>
12
+
13
+ export interface TextareaProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @defaultValue 'div'
17
+ */
18
+ as?: any
19
+ id?: string
20
+ name?: string
21
+ /** The placeholder text when the textarea is empty. */
22
+ placeholder?: string
23
+ color?: TextareaVariants['color']
24
+ variant?: TextareaVariants['variant']
25
+ size?: TextareaVariants['size']
26
+ required?: boolean
27
+ autofocus?: boolean
28
+ autofocusDelay?: number
29
+ disabled?: boolean
30
+ class?: any
31
+ rows?: number
32
+ maxrows?: number
33
+ autoresize?: boolean
34
+ /** Highlight the ring color like a focus state. */
35
+ highlight?: boolean
36
+ ui?: Partial<typeof textarea.slots>
37
+ }
38
+
39
+ export interface TextareaEmits {
40
+ (e: 'update:modelValue', payload: string | number): void
41
+ (e: 'blur', event: FocusEvent): void
42
+ (e: 'change', event: Event): void
43
+ }
44
+
45
+ export interface TextareaSlots {
46
+ default(props?: {}): any
47
+ }
7
48
  </script>
8
49
 
9
50
  <script setup lang="ts">
10
51
  import { ref, computed, onMounted, nextTick, watch } from 'vue'
52
+ import { Primitive } from 'reka-ui'
11
53
  import { useFormField } from '../composables/useFormField'
12
54
  import { looseToNumber } from '../utils'
13
55
 
@@ -96,6 +138,8 @@ function autoResize() {
96
138
  }
97
139
 
98
140
  textareaRef.value.rows = props.rows
141
+ const overflow = textareaRef.value.style.overflow
142
+ textareaRef.value.style.overflow = 'hidden'
99
143
 
100
144
  const styles = window.getComputedStyle(textareaRef.value)
101
145
  const paddingTop = Number.parseInt(styles.paddingTop)
@@ -108,10 +152,12 @@ function autoResize() {
108
152
  if (newRows > props.rows) {
109
153
  textareaRef.value.rows = props.maxrows ? Math.min(newRows, props.maxrows) : newRows
110
154
  }
155
+
156
+ textareaRef.value.style.overflow = overflow
111
157
  }
112
158
  }
113
159
 
114
- watch(() => modelValue, () => {
160
+ watch(modelValue, () => {
115
161
  nextTick(autoResize)
116
162
  })
117
163
 
@@ -127,7 +173,7 @@ onMounted(() => {
127
173
  </script>
128
174
 
129
175
  <template>
130
- <div :class="ui.root({ class: [props.class, props.ui?.root] })">
176
+ <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
131
177
  <textarea
132
178
  :id="id"
133
179
  ref="textareaRef"
@@ -145,5 +191,5 @@ onMounted(() => {
145
191
  />
146
192
 
147
193
  <slot />
148
- </div>
194
+ </Primitive>
149
195
  </template>
@@ -1,18 +1,73 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/toast";
5
- const appConfig = _appConfig;
6
- const toast = tv({ extend: tv(theme), ...appConfig.ui?.toast || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { ToastRootProps, ToastRootEmits } from 'reka-ui'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/toast'
7
+ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import type { AvatarProps, ButtonProps } from '../types'
9
+
10
+ const appConfig = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
11
+
12
+ const toast = tv({ extend: tv(theme), ...(appConfig.ui?.toast || {}) })
13
+
14
+ type ToastVariants = VariantProps<typeof toast>
15
+
16
+ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
17
+ /**
18
+ * The element or component this component should render as.
19
+ * @defaultValue 'li'
20
+ */
21
+ as?: any
22
+ title?: string
23
+ description?: string
24
+ icon?: string
25
+ avatar?: AvatarProps
26
+ color?: ToastVariants['color']
27
+ /**
28
+ * Display a list of actions:
29
+ * - under the title and description if multiline
30
+ * - next to the close button if not multiline
31
+ * `{ size: 'xs' }`{lang="ts-type"}
32
+ */
33
+ actions?: ButtonProps[]
34
+ /**
35
+ * Display a close button to dismiss the toast.
36
+ * `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
37
+ * @defaultValue true
38
+ */
39
+ close?: ButtonProps | boolean
40
+ /**
41
+ * The icon displayed in the close button.
42
+ * @defaultValue appConfig.ui.icons.close
43
+ */
44
+ closeIcon?: string
45
+ class?: any
46
+ ui?: Partial<typeof toast.slots>
47
+ }
48
+
49
+ export interface ToastEmits extends ToastRootEmits {}
50
+
51
+ export interface ToastSlots {
52
+ leading(props?: {}): any
53
+ title(props?: {}): any
54
+ description(props?: {}): any
55
+ actions(props?: {}): any
56
+ close(props: { ui: any }): any
57
+ }
58
+
59
+ extendDevtoolsMeta<ToastProps>({ ignore: true })
7
60
  </script>
8
61
 
9
62
  <script setup lang="ts">
10
63
  import { ref, computed, onMounted } from 'vue'
11
- import { ToastRoot, ToastTitle, ToastDescription, ToastAction, ToastClose, useForwardPropsEmits } from 'radix-vue'
64
+ import { ToastRoot, ToastTitle, ToastDescription, ToastAction, ToastClose, useForwardPropsEmits } from 'reka-ui'
12
65
  import { reactivePick } from '@vueuse/core'
13
66
  import { useAppConfig } from '#imports'
67
+ import { useLocale } from '../composables/useLocale'
14
68
  import UIcon from './Icon.vue'
15
69
  import UAvatar from './Avatar.vue'
70
+ import UButton from './Button.vue'
16
71
 
17
72
  const props = withDefaults(defineProps<ToastProps>(), {
18
73
  close: true
@@ -20,7 +75,9 @@ const props = withDefaults(defineProps<ToastProps>(), {
20
75
  const emits = defineEmits<ToastEmits>()
21
76
  const slots = defineSlots<ToastSlots>()
22
77
 
78
+ const { t } = useLocale()
23
79
  const appConfig = useAppConfig()
80
+
24
81
  const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'duration', 'type'), emits)
25
82
 
26
83
  const multiline = computed(() => !!props.title && !!props.description)
@@ -96,9 +153,9 @@ defineExpose({
96
153
  v-if="close"
97
154
  :icon="closeIcon || appConfig.ui.icons.close"
98
155
  size="md"
99
- color="gray"
156
+ color="neutral"
100
157
  variant="link"
101
- aria-label="Close"
158
+ :aria-label="t('toast.close')"
102
159
  v-bind="typeof close === 'object' ? close : undefined"
103
160
  :class="ui.close({ class: props.ui?.close })"
104
161
  @click.stop