@eslamdevui/ui 3.3.0 → 3.3.2-beta.0

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 (288) hide show
  1. package/.nuxt/ui/button.ts +42 -42
  2. package/.nuxt/ui/command-palette.ts +2 -1
  3. package/.nuxt/ui/file-upload.ts +295 -0
  4. package/.nuxt/ui/index.ts +2 -0
  5. package/.nuxt/ui/kbd.ts +167 -3
  6. package/.nuxt/ui/scroll-to-section.ts +3 -0
  7. package/.nuxt/ui/table.ts +14 -0
  8. package/.nuxt/ui/tabs.ts +4 -2
  9. package/.nuxt/ui/toast.ts +8 -15
  10. package/.nuxt/ui/tooltip.ts +1 -1
  11. package/cli/templates.mjs +4 -3
  12. package/dist/module.d.mts +15 -1
  13. package/dist/module.json +2 -2
  14. package/dist/module.mjs +3 -3
  15. package/dist/runtime/components/Accordion.vue.d.ts +1 -1
  16. package/dist/runtime/components/Alert.vue.d.ts +2 -2
  17. package/dist/runtime/components/App.vue.d.ts +1 -1
  18. package/dist/runtime/components/Avatar.vue.d.ts +1 -1
  19. package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
  20. package/dist/runtime/components/Badge.vue.d.ts +1 -1
  21. package/dist/runtime/components/Banner.vue.d.ts +1 -5
  22. package/dist/runtime/components/BlogPost.vue.d.ts +1 -1
  23. package/dist/runtime/components/BlogPosts.vue.d.ts +1 -1
  24. package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
  25. package/dist/runtime/components/Button.vue +6 -6
  26. package/dist/runtime/components/Button.vue.d.ts +1 -5
  27. package/dist/runtime/components/ButtonGroup.vue.d.ts +1 -1
  28. package/dist/runtime/components/Calendar.vue.d.ts +1 -1
  29. package/dist/runtime/components/Card.vue.d.ts +1 -1
  30. package/dist/runtime/components/Carousel.vue +18 -14
  31. package/dist/runtime/components/Carousel.vue.d.ts +1 -1
  32. package/dist/runtime/components/ChangelogVersion.vue.d.ts +1 -1
  33. package/dist/runtime/components/ChangelogVersions.vue.d.ts +1 -1
  34. package/dist/runtime/components/ChatMessage.vue.d.ts +4 -8
  35. package/dist/runtime/components/ChatMessages.vue.d.ts +1 -1
  36. package/dist/runtime/components/ChatPalette.vue.d.ts +1 -1
  37. package/dist/runtime/components/ChatPrompt.vue.d.ts +1 -1
  38. package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +1 -1
  39. package/dist/runtime/components/Checkbox.vue.d.ts +1 -1
  40. package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
  41. package/dist/runtime/components/Chip.vue.d.ts +2 -2
  42. package/dist/runtime/components/Collapsible.vue.d.ts +1 -1
  43. package/dist/runtime/components/ColorPicker.vue +1 -2
  44. package/dist/runtime/components/ColorPicker.vue.d.ts +1 -1
  45. package/dist/runtime/components/CommandPalette.vue +4 -0
  46. package/dist/runtime/components/CommandPalette.vue.d.ts +9 -4
  47. package/dist/runtime/components/Container.vue.d.ts +1 -1
  48. package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
  49. package/dist/runtime/components/ContextMenuContent.vue.d.ts +1 -1
  50. package/dist/runtime/components/DashboardGroup.vue.d.ts +1 -1
  51. package/dist/runtime/components/DashboardNavbar.vue.d.ts +1 -1
  52. package/dist/runtime/components/DashboardPanel.vue.d.ts +1 -1
  53. package/dist/runtime/components/DashboardResizeHandle.vue.d.ts +1 -1
  54. package/dist/runtime/components/DashboardSearchButton.vue.d.ts +1 -1
  55. package/dist/runtime/components/DashboardSidebar.vue.d.ts +1 -1
  56. package/dist/runtime/components/DashboardSidebarCollapse.vue.d.ts +1 -1
  57. package/dist/runtime/components/DashboardSidebarToggle.vue +5 -2
  58. package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -1
  59. package/dist/runtime/components/DashboardToolbar.vue.d.ts +3 -3
  60. package/dist/runtime/components/Drawer.vue +4 -4
  61. package/dist/runtime/components/Drawer.vue.d.ts +6 -1
  62. package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
  63. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +8 -5
  64. package/dist/runtime/components/Error.vue.d.ts +1 -1
  65. package/dist/runtime/components/FileUpload.vue +242 -0
  66. package/dist/runtime/components/FileUpload.vue.d.ts +167 -0
  67. package/dist/runtime/components/Footer.vue.d.ts +1 -1
  68. package/dist/runtime/components/FooterColumns.vue.d.ts +1 -1
  69. package/dist/runtime/components/Form.vue.d.ts +5 -4
  70. package/dist/runtime/components/FormField.vue +2 -2
  71. package/dist/runtime/components/FormField.vue.d.ts +4 -4
  72. package/dist/runtime/components/Header.vue.d.ts +1 -1
  73. package/dist/runtime/components/Icon.vue.d.ts +1 -1
  74. package/dist/runtime/components/Input.vue +10 -7
  75. package/dist/runtime/components/Input.vue.d.ts +9 -9
  76. package/dist/runtime/components/InputMenu.vue +17 -10
  77. package/dist/runtime/components/InputMenu.vue.d.ts +17 -14
  78. package/dist/runtime/components/InputNumber.vue.d.ts +4 -4
  79. package/dist/runtime/components/InputTags.vue +2 -0
  80. package/dist/runtime/components/InputTags.vue.d.ts +5 -3
  81. package/dist/runtime/components/Kbd.vue +2 -1
  82. package/dist/runtime/components/Kbd.vue.d.ts +5 -1
  83. package/dist/runtime/components/Link.vue +6 -5
  84. package/dist/runtime/components/Link.vue.d.ts +1 -3
  85. package/dist/runtime/components/LinkBase.vue.d.ts +1 -1
  86. package/dist/runtime/components/Main.vue.d.ts +1 -1
  87. package/dist/runtime/components/Modal.vue.d.ts +2 -2
  88. package/dist/runtime/components/NavigationMenu.vue +3 -2
  89. package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
  90. package/dist/runtime/components/OverlayProvider.vue.d.ts +1 -1
  91. package/dist/runtime/components/Page.vue.d.ts +1 -1
  92. package/dist/runtime/components/PageAccordion.vue.d.ts +1 -1
  93. package/dist/runtime/components/PageAnchors.vue.d.ts +1 -1
  94. package/dist/runtime/components/PageAside.vue.d.ts +1 -1
  95. package/dist/runtime/components/PageBody.vue.d.ts +1 -1
  96. package/dist/runtime/components/PageCTA.vue.d.ts +1 -1
  97. package/dist/runtime/components/PageCard.vue.d.ts +1 -1
  98. package/dist/runtime/components/PageColumns.vue.d.ts +1 -1
  99. package/dist/runtime/components/PageFeature.vue.d.ts +1 -1
  100. package/dist/runtime/components/PageGrid.vue.d.ts +1 -1
  101. package/dist/runtime/components/PageHeader.vue.d.ts +1 -1
  102. package/dist/runtime/components/PageHero.vue.d.ts +1 -1
  103. package/dist/runtime/components/PageLinks.vue.d.ts +1 -1
  104. package/dist/runtime/components/PageList.vue.d.ts +1 -1
  105. package/dist/runtime/components/PageLogos.vue.d.ts +1 -1
  106. package/dist/runtime/components/PageMarquee.vue.d.ts +1 -1
  107. package/dist/runtime/components/PageSection.vue.d.ts +1 -1
  108. package/dist/runtime/components/Pagination.vue.d.ts +1 -1
  109. package/dist/runtime/components/PinInput.vue.d.ts +1 -1
  110. package/dist/runtime/components/Popover.vue +2 -1
  111. package/dist/runtime/components/Popover.vue.d.ts +8 -2
  112. package/dist/runtime/components/PricingPlan.vue.d.ts +1 -1
  113. package/dist/runtime/components/PricingPlans.vue.d.ts +1 -1
  114. package/dist/runtime/components/PricingTable.vue +90 -33
  115. package/dist/runtime/components/PricingTable.vue.d.ts +1 -1
  116. package/dist/runtime/components/Progress.vue.d.ts +1 -1
  117. package/dist/runtime/components/RadioGroup.vue +1 -1
  118. package/dist/runtime/components/RadioGroup.vue.d.ts +5 -4
  119. package/dist/runtime/components/ScrollToSection.vue +62 -0
  120. package/dist/runtime/components/ScrollToSection.vue.d.ts +36 -0
  121. package/dist/runtime/components/Select.vue.d.ts +1 -1
  122. package/dist/runtime/components/SelectMenu.vue +9 -6
  123. package/dist/runtime/components/SelectMenu.vue.d.ts +4 -4
  124. package/dist/runtime/components/Separator.vue.d.ts +1 -1
  125. package/dist/runtime/components/Skeleton.vue.d.ts +1 -1
  126. package/dist/runtime/components/Slideover.vue.d.ts +2 -2
  127. package/dist/runtime/components/Slider.vue.d.ts +5 -5
  128. package/dist/runtime/components/Stepper.vue.d.ts +1 -1
  129. package/dist/runtime/components/Switch.vue.d.ts +1 -1
  130. package/dist/runtime/components/Table.vue +83 -8
  131. package/dist/runtime/components/Table.vue.d.ts +20 -4
  132. package/dist/runtime/components/Tabs.vue +26 -5
  133. package/dist/runtime/components/Tabs.vue.d.ts +8 -3
  134. package/dist/runtime/components/Textarea.vue +10 -7
  135. package/dist/runtime/components/Textarea.vue.d.ts +10 -9
  136. package/dist/runtime/components/Timeline.vue.d.ts +1 -1
  137. package/dist/runtime/components/Toast.vue +12 -4
  138. package/dist/runtime/components/Toast.vue.d.ts +14 -13
  139. package/dist/runtime/components/Toaster.vue.d.ts +1 -1
  140. package/dist/runtime/components/Tooltip.vue +2 -1
  141. package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
  142. package/dist/runtime/components/Tree.vue +3 -2
  143. package/dist/runtime/components/Tree.vue.d.ts +1 -1
  144. package/dist/runtime/components/User.vue.d.ts +1 -1
  145. package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +1 -1
  146. package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +1 -1
  147. package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +1 -1
  148. package/dist/runtime/components/color-mode/ColorModeSelect.vue +1 -1
  149. package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +1 -1
  150. package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
  151. package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -1
  152. package/dist/runtime/components/content/ContentSearch.vue +17 -7
  153. package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +1 -1
  154. package/dist/runtime/components/content/ContentSurround.vue +10 -4
  155. package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -1
  156. package/dist/runtime/components/content/ContentToc.vue.d.ts +1 -1
  157. package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +1 -1
  158. package/dist/runtime/components/prose/A.vue.d.ts +1 -1
  159. package/dist/runtime/components/prose/Accordion.vue.d.ts +1 -1
  160. package/dist/runtime/components/prose/AccordionItem.vue.d.ts +1 -1
  161. package/dist/runtime/components/prose/Badge.vue.d.ts +1 -1
  162. package/dist/runtime/components/prose/Blockquote.vue.d.ts +1 -1
  163. package/dist/runtime/components/prose/Callout.vue.d.ts +1 -1
  164. package/dist/runtime/components/prose/Card.vue.d.ts +1 -1
  165. package/dist/runtime/components/prose/CardGroup.vue.d.ts +1 -1
  166. package/dist/runtime/components/prose/Code.vue.d.ts +1 -1
  167. package/dist/runtime/components/prose/CodeCollapse.vue.d.ts +1 -1
  168. package/dist/runtime/components/prose/CodeGroup.vue.d.ts +1 -1
  169. package/dist/runtime/components/prose/CodeIcon.vue.d.ts +1 -1
  170. package/dist/runtime/components/prose/CodePreview.vue.d.ts +1 -1
  171. package/dist/runtime/components/prose/CodeTree.vue.d.ts +1 -1
  172. package/dist/runtime/components/prose/Collapsible.vue.d.ts +1 -1
  173. package/dist/runtime/components/prose/Em.vue.d.ts +1 -1
  174. package/dist/runtime/components/prose/Field.vue.d.ts +1 -1
  175. package/dist/runtime/components/prose/FieldGroup.vue.d.ts +1 -1
  176. package/dist/runtime/components/prose/H1.vue.d.ts +1 -1
  177. package/dist/runtime/components/prose/H2.vue.d.ts +1 -1
  178. package/dist/runtime/components/prose/H3.vue.d.ts +1 -1
  179. package/dist/runtime/components/prose/H4.vue.d.ts +1 -1
  180. package/dist/runtime/components/prose/Hr.vue.d.ts +1 -1
  181. package/dist/runtime/components/prose/Icon.vue.d.ts +1 -1
  182. package/dist/runtime/components/prose/Img.vue.d.ts +1 -1
  183. package/dist/runtime/components/prose/Kbd.vue.d.ts +1 -1
  184. package/dist/runtime/components/prose/Li.vue.d.ts +1 -1
  185. package/dist/runtime/components/prose/Ol.vue.d.ts +1 -1
  186. package/dist/runtime/components/prose/P.vue.d.ts +1 -1
  187. package/dist/runtime/components/prose/Pre.vue.d.ts +1 -1
  188. package/dist/runtime/components/prose/Script.vue.d.ts +1 -1
  189. package/dist/runtime/components/prose/Steps.vue.d.ts +1 -1
  190. package/dist/runtime/components/prose/Strong.vue.d.ts +1 -1
  191. package/dist/runtime/components/prose/Table.vue.d.ts +1 -1
  192. package/dist/runtime/components/prose/Tabs.vue.d.ts +1 -1
  193. package/dist/runtime/components/prose/TabsItem.vue.d.ts +1 -1
  194. package/dist/runtime/components/prose/Tbody.vue.d.ts +1 -1
  195. package/dist/runtime/components/prose/Td.vue.d.ts +1 -1
  196. package/dist/runtime/components/prose/Th.vue.d.ts +1 -1
  197. package/dist/runtime/components/prose/Thead.vue.d.ts +1 -1
  198. package/dist/runtime/components/prose/Tr.vue.d.ts +1 -1
  199. package/dist/runtime/components/prose/Ul.vue.d.ts +1 -1
  200. package/dist/runtime/components/prose/callout/Caution.vue.d.ts +3 -3
  201. package/dist/runtime/components/prose/callout/Note.vue.d.ts +3 -3
  202. package/dist/runtime/components/prose/callout/Tip.vue.d.ts +3 -3
  203. package/dist/runtime/components/prose/callout/Warning.vue.d.ts +3 -3
  204. package/dist/runtime/composables/defineShortcuts.js +5 -3
  205. package/dist/runtime/composables/useBreakpoint.js +8 -8
  206. package/dist/runtime/composables/useFileUpload.d.ts +19 -0
  207. package/dist/runtime/composables/useFileUpload.js +63 -0
  208. package/dist/runtime/composables/useFormField.d.ts +1 -4
  209. package/dist/runtime/composables/useFormField.js +5 -2
  210. package/dist/runtime/composables/useKbd.d.ts +1 -1
  211. package/dist/runtime/composables/useLocale.js +2 -2
  212. package/dist/runtime/composables/useOverlay.d.ts +28 -1
  213. package/dist/runtime/composables/useOverlay.js +4 -4
  214. package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
  215. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +1 -1
  216. package/dist/runtime/inertia/stubs.d.ts +1 -0
  217. package/dist/runtime/inertia/stubs.js +4 -2
  218. package/dist/runtime/locale/ar.js +2 -1
  219. package/dist/runtime/locale/az.js +1 -0
  220. package/dist/runtime/locale/bg.js +1 -0
  221. package/dist/runtime/locale/bn.js +1 -0
  222. package/dist/runtime/locale/ca.js +1 -0
  223. package/dist/runtime/locale/ckb.js +2 -1
  224. package/dist/runtime/locale/cs.js +1 -0
  225. package/dist/runtime/locale/da.js +1 -0
  226. package/dist/runtime/locale/de.js +1 -0
  227. package/dist/runtime/locale/el.js +1 -0
  228. package/dist/runtime/locale/en.js +1 -0
  229. package/dist/runtime/locale/es.js +1 -0
  230. package/dist/runtime/locale/et.js +1 -0
  231. package/dist/runtime/locale/fa_ir.js +1 -0
  232. package/dist/runtime/locale/fi.js +1 -0
  233. package/dist/runtime/locale/fr.js +1 -0
  234. package/dist/runtime/locale/he.js +1 -0
  235. package/dist/runtime/locale/hi.js +2 -1
  236. package/dist/runtime/locale/hu.js +1 -0
  237. package/dist/runtime/locale/hy.js +1 -0
  238. package/dist/runtime/locale/id.js +1 -0
  239. package/dist/runtime/locale/it.js +1 -0
  240. package/dist/runtime/locale/ja.js +1 -0
  241. package/dist/runtime/locale/kk.js +1 -0
  242. package/dist/runtime/locale/km.js +2 -1
  243. package/dist/runtime/locale/ko.js +1 -0
  244. package/dist/runtime/locale/ky.js +1 -0
  245. package/dist/runtime/locale/lb.js +1 -0
  246. package/dist/runtime/locale/lt.js +1 -0
  247. package/dist/runtime/locale/mn.js +1 -0
  248. package/dist/runtime/locale/ms.js +1 -0
  249. package/dist/runtime/locale/nb_no.js +1 -0
  250. package/dist/runtime/locale/nl.js +1 -0
  251. package/dist/runtime/locale/pl.js +1 -0
  252. package/dist/runtime/locale/pt.js +1 -0
  253. package/dist/runtime/locale/pt_br.js +1 -0
  254. package/dist/runtime/locale/ro.js +1 -0
  255. package/dist/runtime/locale/ru.js +1 -0
  256. package/dist/runtime/locale/sk.js +1 -0
  257. package/dist/runtime/locale/sl.js +1 -0
  258. package/dist/runtime/locale/sv.js +1 -0
  259. package/dist/runtime/locale/th.js +1 -0
  260. package/dist/runtime/locale/tj.js +1 -0
  261. package/dist/runtime/locale/tr.js +1 -0
  262. package/dist/runtime/locale/ug_cn.js +1 -0
  263. package/dist/runtime/locale/uk.js +1 -0
  264. package/dist/runtime/locale/ur.js +1 -0
  265. package/dist/runtime/locale/uz.js +1 -0
  266. package/dist/runtime/locale/vi.js +1 -0
  267. package/dist/runtime/locale/zh_cn.js +1 -0
  268. package/dist/runtime/locale/zh_tw.js +1 -0
  269. package/dist/runtime/types/index.d.ts +2 -0
  270. package/dist/runtime/types/index.js +2 -0
  271. package/dist/runtime/types/locale.d.ts +1 -0
  272. package/dist/runtime/utils/content.d.ts +18 -6
  273. package/dist/runtime/utils/content.js +51 -25
  274. package/dist/runtime/utils/index.d.ts +1 -0
  275. package/dist/runtime/utils/index.js +9 -0
  276. package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
  277. package/dist/runtime/vue/components/Link.vue.d.ts +1 -1
  278. package/dist/runtime/vue/components/color-mode/ColorModeButton.vue.d.ts +1 -1
  279. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -1
  280. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +1 -1
  281. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
  282. package/dist/runtime/vue/stubs.d.ts +1 -0
  283. package/dist/runtime/vue/stubs.js +3 -1
  284. package/dist/shared/{ui.i6pGHFq6.mjs → ui.CgUuvRXi.mjs} +282 -29
  285. package/dist/unplugin.d.mts +2 -1
  286. package/dist/unplugin.mjs +6 -3
  287. package/dist/vite.mjs +1 -1
  288. package/package.json +57 -41
@@ -0,0 +1,242 @@
1
+ <script>
2
+ import theme from "#build/ui/file-upload";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed, watch } from "vue";
7
+ import { Primitive } from "reka-ui";
8
+ import { createReusableTemplate } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { useFileUpload } from "../composables/useFileUpload";
12
+ import { tv } from "../utils/tv";
13
+ import UAvatar from "./Avatar.vue";
14
+ import UButton from "./Button.vue";
15
+ import UIcon from "./Icon.vue";
16
+ defineOptions({ inheritAttrs: false });
17
+ const props = defineProps({
18
+ as: { type: null, required: false },
19
+ id: { type: String, required: false },
20
+ name: { type: String, required: false },
21
+ icon: { type: String, required: false },
22
+ label: { type: String, required: false },
23
+ description: { type: String, required: false },
24
+ color: { type: null, required: false },
25
+ variant: { type: null, required: false },
26
+ size: { type: null, required: false },
27
+ layout: { type: null, required: false, default: "grid" },
28
+ position: { type: null, required: false, default: "outside" },
29
+ highlight: { type: Boolean, required: false },
30
+ accept: { type: String, required: false, default: "*" },
31
+ multiple: { type: Boolean, required: false, default: false },
32
+ reset: { type: Boolean, required: false, default: false },
33
+ dropzone: { type: Boolean, required: false, default: true },
34
+ interactive: { type: Boolean, required: false, default: true },
35
+ required: { type: Boolean, required: false },
36
+ disabled: { type: Boolean, required: false },
37
+ fileIcon: { type: String, required: false },
38
+ fileDelete: { type: [Boolean, Object], required: false },
39
+ fileDeleteIcon: { type: String, required: false },
40
+ class: { type: null, required: false },
41
+ ui: { type: null, required: false }
42
+ });
43
+ const emits = defineEmits(["update:modelValue", "change"]);
44
+ const slots = defineSlots();
45
+ const modelValue = defineModel({ type: null });
46
+ const appConfig = useAppConfig();
47
+ const [DefineFilesTemplate, ReuseFilesTemplate] = createReusableTemplate();
48
+ const { isDragging, open, inputRef, dropzoneRef } = useFileUpload({
49
+ accept: props.accept,
50
+ reset: props.reset,
51
+ multiple: props.multiple,
52
+ dropzone: props.dropzone,
53
+ onUpdate
54
+ });
55
+ const { emitFormInput, emitFormChange, id, name, disabled, ariaAttrs } = useFormField(props);
56
+ const variant = computed(() => props.multiple ? "area" : props.variant);
57
+ const layout = computed(() => props.variant === "button" && !props.multiple ? "grid" : props.layout);
58
+ const position = computed(() => {
59
+ if (layout.value === "grid" && props.multiple) {
60
+ return "inside";
61
+ }
62
+ if (variant.value === "button") {
63
+ return "outside";
64
+ }
65
+ return props.position;
66
+ });
67
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.fileUpload || {} })({
68
+ dropzone: props.dropzone,
69
+ interactive: props.interactive,
70
+ color: props.color,
71
+ size: props.size,
72
+ variant: variant.value,
73
+ layout: layout.value,
74
+ position: position.value,
75
+ multiple: props.multiple,
76
+ highlight: props.highlight,
77
+ disabled: props.disabled
78
+ }));
79
+ function createObjectUrl(file) {
80
+ return URL.createObjectURL(file);
81
+ }
82
+ function formatFileSize(bytes) {
83
+ if (bytes === 0) {
84
+ return "0B";
85
+ }
86
+ const k = 1024;
87
+ const sizes = ["B", "KB", "MB", "GB"];
88
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
89
+ const size = bytes / Math.pow(k, i);
90
+ const formattedSize = i === 0 ? size.toString() : size.toFixed(0);
91
+ return `${formattedSize}${sizes[i]}`;
92
+ }
93
+ function onUpdate(files, reset = false) {
94
+ if (props.multiple) {
95
+ if (reset) {
96
+ modelValue.value = files;
97
+ } else {
98
+ const existingFiles = modelValue.value || [];
99
+ modelValue.value = [...existingFiles, ...files || []];
100
+ }
101
+ } else {
102
+ modelValue.value = files?.[0];
103
+ }
104
+ const event = new Event("change", { target: { value: modelValue.value } });
105
+ emits("change", event);
106
+ emitFormChange();
107
+ emitFormInput();
108
+ }
109
+ function removeFile(index) {
110
+ if (!modelValue.value) {
111
+ return;
112
+ }
113
+ if (!props.multiple || index === void 0) {
114
+ onUpdate([], true);
115
+ return;
116
+ }
117
+ const files = [...modelValue.value];
118
+ files.splice(index, 1);
119
+ onUpdate(files, true);
120
+ }
121
+ watch(modelValue, (newValue) => {
122
+ const hasModelReset = !Array.isArray(newValue) || !newValue.length;
123
+ if (hasModelReset && inputRef.value) {
124
+ inputRef.value.value = "";
125
+ }
126
+ });
127
+ defineExpose({
128
+ inputRef,
129
+ dropzoneRef
130
+ });
131
+ </script>
132
+
133
+ <template>
134
+ <DefineFilesTemplate>
135
+ <template v-if="modelValue && (Array.isArray(modelValue) ? modelValue.length : true)">
136
+ <slot name="files-top" :files="modelValue" :open="open" :remove-file="removeFile" />
137
+
138
+ <div :class="ui.files({ class: props.ui?.files })">
139
+ <slot name="files" :files="modelValue">
140
+ <div v-for="(file, index) in Array.isArray(modelValue) ? modelValue : [modelValue]" :key="file.name" :class="ui.file({ class: props.ui?.file })">
141
+ <slot name="file" :file="file" :index="index">
142
+ <slot name="file-leading" :file="file" :index="index">
143
+ <UAvatar :src="createObjectUrl(file)" :icon="fileIcon || appConfig.ui.icons.file" :size="props.size" :class="ui.fileLeadingAvatar({ class: props.ui?.fileLeadingAvatar })" />
144
+ </slot>
145
+
146
+ <div :class="ui.fileWrapper({ class: props.ui?.fileWrapper })">
147
+ <span :class="ui.fileName({ class: props.ui?.fileName })">
148
+ <slot name="file-name" :file="file" :index="index">
149
+ {{ file.name }}
150
+ </slot>
151
+ </span>
152
+
153
+ <span :class="ui.fileSize({ class: props.ui?.fileSize })">
154
+ <slot name="file-size" :file="file" :index="index">
155
+ {{ formatFileSize(file.size) }}
156
+ </slot>
157
+ </span>
158
+ </div>
159
+
160
+ <slot name="file-trailing" :file="file" :index="index">
161
+ <UButton
162
+ color="neutral"
163
+ v-bind="{
164
+ ...layout === 'grid' ? {
165
+ variant: 'solid',
166
+ size: 'xs'
167
+ } : {
168
+ variant: 'link',
169
+ size
170
+ },
171
+ ...typeof fileDelete === 'object' ? fileDelete : void 0
172
+ }"
173
+ :trailing-icon="fileDeleteIcon || appConfig.ui.icons.close"
174
+ :class="ui.fileTrailingButton({ class: props.ui?.fileTrailingButton })"
175
+ @click.stop.prevent="removeFile(index)"
176
+ />
177
+ </slot>
178
+ </slot>
179
+ </div>
180
+ </slot>
181
+ </div>
182
+
183
+ <slot name="files-bottom" :files="modelValue" :open="open" :remove-file="removeFile" />
184
+ </template>
185
+ </DefineFilesTemplate>
186
+
187
+ <Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
188
+ <slot :open="open" :remove-file="removeFile">
189
+ <component
190
+ :is="variant === 'button' ? 'button' : 'div'"
191
+ ref="dropzoneRef"
192
+ :role="variant === 'button' ? void 0 : 'button'"
193
+ :data-dragging="isDragging"
194
+ :class="ui.base({ class: props.ui?.base })"
195
+ :tabindex="interactive && !disabled ? 0 : -1"
196
+ @click="interactive && !disabled && open()"
197
+ >
198
+ <ReuseFilesTemplate v-if="position === 'inside'" />
199
+
200
+ <div v-if="position === 'inside' ? multiple ? !modelValue?.length : !modelValue : true" :class="ui.wrapper({ class: props.ui?.wrapper })">
201
+ <slot name="leading">
202
+ <UIcon v-if="variant === 'button'" :name="icon || appConfig.ui.icons.upload" :class="ui.icon({ class: props.ui?.icon })" />
203
+ <UAvatar v-else :icon="icon || appConfig.ui.icons.upload" :size="props.size" :class="ui.avatar({ class: props.ui?.avatar })" />
204
+ </slot>
205
+
206
+ <template v-if="variant !== 'button'">
207
+ <div v-if="label || !!slots.label" :class="ui.label({ class: props.ui?.label })">
208
+ <slot name="label">
209
+ {{ label }}
210
+ </slot>
211
+ </div>
212
+ <div v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
213
+ <slot name="description">
214
+ {{ description }}
215
+ </slot>
216
+ </div>
217
+
218
+ <div v-if="!!slots.actions" :class="ui.actions({ class: props.ui?.actions })">
219
+ <slot name="actions" :files="modelValue" :open="open" :remove-file="removeFile" />
220
+ </div>
221
+ </template>
222
+ </div>
223
+ </component>
224
+
225
+ <ReuseFilesTemplate v-if="position === 'outside'" />
226
+ </slot>
227
+
228
+ <input
229
+ :id="id"
230
+ ref="inputRef"
231
+ type="file"
232
+ :name="name"
233
+ :accept="accept"
234
+ :multiple="multiple"
235
+ :required="required"
236
+ :disabled="disabled"
237
+ v-bind="{ ...$attrs, ...ariaAttrs }"
238
+ class="sr-only"
239
+ tabindex="-1"
240
+ >
241
+ </Primitive>
242
+ </template>
@@ -0,0 +1,167 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { UseFileDialogReturn } from '@vueuse/core';
3
+ import theme from '#build/ui/file-upload';
4
+ import type { ButtonProps } from '../types';
5
+ import type { ComponentConfig } from '../types/utils';
6
+ type FileUpload = ComponentConfig<typeof theme, AppConfig, 'fileUpload'>;
7
+ export interface FileUploadProps<M extends boolean = false> {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @defaultValue 'div'
11
+ */
12
+ as?: any;
13
+ id?: string;
14
+ name?: string;
15
+ /**
16
+ * The icon to display.
17
+ * @defaultValue appConfig.ui.icons.upload
18
+ * @IconifyIcon
19
+ */
20
+ icon?: string;
21
+ label?: string;
22
+ description?: string;
23
+ /**
24
+ * @defaultValue 'primary'
25
+ */
26
+ color?: FileUpload['variants']['color'];
27
+ /**
28
+ * The `button` variant is only available when `multiple` is `false`.
29
+ * @defaultValue 'area'
30
+ */
31
+ variant?: FileUpload['variants']['variant'];
32
+ /**
33
+ * @defaultValue 'md'
34
+ */
35
+ size?: FileUpload['variants']['size'];
36
+ /**
37
+ * The layout of how files are displayed.
38
+ * Only works when `variant` is `area`.
39
+ * @defaultValue 'list'
40
+ */
41
+ layout?: FileUpload['variants']['layout'];
42
+ /**
43
+ * The position of the files.
44
+ * Only works when `variant` is `area` and when `layout` is `list`.
45
+ * @defaultValue 'outside'
46
+ */
47
+ position?: FileUpload['variants']['position'];
48
+ /** Highlight the ring color like a focus state. */
49
+ highlight?: boolean;
50
+ /**
51
+ * Specifies the allowed file types for the input. Provide a comma-separated list of MIME types or file extensions (e.g., "image/png,application/pdf,.jpg").
52
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept
53
+ * @defaultValue '*'
54
+ */
55
+ accept?: string;
56
+ multiple?: M & boolean;
57
+ /**
58
+ * Reset the file input when the dialog is opened.
59
+ * @defaultValue false
60
+ */
61
+ reset?: boolean;
62
+ /**
63
+ * Create a zone that allows the user to drop files onto it.
64
+ * @defaultValue true
65
+ */
66
+ dropzone?: boolean;
67
+ /**
68
+ * Make the dropzone interactive when the user is clicking on it.
69
+ * @defaultValue true
70
+ */
71
+ interactive?: boolean;
72
+ required?: boolean;
73
+ disabled?: boolean;
74
+ /**
75
+ * The icon to display for the file.
76
+ * @defaultValue appConfig.ui.icons.file
77
+ * @IconifyIcon
78
+ */
79
+ fileIcon?: string;
80
+ /**
81
+ * Configure the delete button for the file.
82
+ * When `layout` is `grid`, the default is `{ color: 'neutral', variant: 'solid', size: 'xs' }`{lang="ts-type"}
83
+ * When `layout` is `list`, the default is `{ color: 'neutral', variant: 'link' }`{lang="ts-type"}
84
+ */
85
+ fileDelete?: boolean | Partial<ButtonProps>;
86
+ /**
87
+ * The icon displayed to delete a file.
88
+ * @defaultValue appConfig.ui.icons.close
89
+ * @IconifyIcon
90
+ */
91
+ fileDeleteIcon?: string;
92
+ class?: any;
93
+ ui?: FileUpload['slots'];
94
+ }
95
+ export interface FileUploadEmits<M extends boolean = false> {
96
+ 'update:modelValue': [payload: M extends true ? File[] : File | null];
97
+ 'change': [event: Event];
98
+ }
99
+ type FileUploadFiles<M> = (M extends true ? File[] : File) | null;
100
+ export interface FileUploadSlots<M extends boolean = false> {
101
+ 'default'(props: {
102
+ open: UseFileDialogReturn['open'];
103
+ removeFile: (index?: number) => void;
104
+ }): any;
105
+ 'leading'(props?: {}): any;
106
+ 'label'(props?: {}): any;
107
+ 'description'(props?: {}): any;
108
+ 'actions'(props: {
109
+ files?: FileUploadFiles<M>;
110
+ open: UseFileDialogReturn['open'];
111
+ removeFile: (index?: number) => void;
112
+ }): any;
113
+ 'files'(props: {
114
+ files?: FileUploadFiles<M>;
115
+ }): any;
116
+ 'files-top'(props: {
117
+ files?: FileUploadFiles<M>;
118
+ open: UseFileDialogReturn['open'];
119
+ removeFile: (index?: number) => void;
120
+ }): any;
121
+ 'files-bottom'(props: {
122
+ files?: FileUploadFiles<M>;
123
+ open: UseFileDialogReturn['open'];
124
+ removeFile: (index?: number) => void;
125
+ }): any;
126
+ 'file'(props: {
127
+ file: File;
128
+ index: number;
129
+ }): any;
130
+ 'file-leading'(props: {
131
+ file: File;
132
+ index: number;
133
+ }): any;
134
+ 'file-name'(props: {
135
+ file: File;
136
+ index: number;
137
+ }): any;
138
+ 'file-size'(props: {
139
+ file: File;
140
+ index: number;
141
+ }): any;
142
+ 'file-trailing'(props: {
143
+ file: File;
144
+ index: number;
145
+ }): any;
146
+ }
147
+ declare const _default: <M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
148
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
149
+ readonly onChange?: ((event: Event) => any) | undefined;
150
+ readonly "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
151
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue"> & (FileUploadProps<M> & {
152
+ modelValue?: (M extends true ? File[] : File) | null;
153
+ }) & Partial<{}>> & import("vue").PublicProps;
154
+ expose(exposed: import("vue").ShallowUnwrapRef<{
155
+ inputRef: import("vue").Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
156
+ dropzoneRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
157
+ }>): void;
158
+ attrs: any;
159
+ slots: FileUploadSlots<M>;
160
+ emit: (((evt: "change", event: Event) => void) & ((evt: "update:modelValue", payload: M extends true ? File[] : File | null) => void)) & ((evt: "update:modelValue", value: (M extends true ? File[] : File) | null | undefined) => void);
161
+ }>) => import("vue").VNode & {
162
+ __ctx?: Awaited<typeof __VLS_setup>;
163
+ };
164
+ export default _default;
165
+ type __VLS_PrettifyLocal<T> = {
166
+ [K in keyof T as K]: T[K];
167
+ } & {};
@@ -18,7 +18,7 @@ export interface FooterSlots {
18
18
  top(props?: {}): any;
19
19
  bottom(props?: {}): any;
20
20
  }
21
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FooterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FooterProps> & Readonly<{}>, {
21
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FooterProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FooterProps> & Readonly<{}>, {
22
22
  as: any;
23
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FooterSlots>;
24
24
  export default _default;
@@ -41,7 +41,7 @@ export interface FooterColumnsSlots<T extends FooterColumnLink = FooterColumnLin
41
41
  'link-label': SlotProps<T>;
42
42
  'link-trailing': SlotProps<T>;
43
43
  }
44
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FooterColumnsProps<FooterColumnLink>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FooterColumnsProps<FooterColumnLink>> & Readonly<{}>, {
44
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FooterColumnsProps<FooterColumnLink>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FooterColumnsProps<FooterColumnLink>> & Readonly<{}>, {
45
45
  as: any;
46
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FooterColumnsSlots<FooterColumnLink>>;
47
47
  export default _default;
@@ -13,6 +13,7 @@ export interface FormProps<S extends FormSchema, T extends boolean = true> {
13
13
  validate?: (state: Partial<InferInput<S>>) => Promise<FormError[]> | FormError[];
14
14
  /**
15
15
  * The list of input events that trigger the form validation.
16
+ * @remarks The form always validates on submit.
16
17
  * @defaultValue `['blur', 'change', 'input']`
17
18
  */
18
19
  validateOn?: FormInputEvents[];
@@ -43,8 +44,8 @@ export interface FormProps<S extends FormSchema, T extends boolean = true> {
43
44
  onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => void | Promise<void>) | (() => void | Promise<void>);
44
45
  }
45
46
  export interface FormEmits<S extends FormSchema, T extends boolean = true> {
46
- (e: 'submit', payload: FormSubmitEvent<FormData<S, T>>): void;
47
- (e: 'error', payload: FormErrorEvent): void;
47
+ submit: [payload: FormSubmitEvent<FormData<S, T>>];
48
+ error: [payload: FormErrorEvent];
48
49
  }
49
50
  export interface FormSlots {
50
51
  default(props?: {
@@ -60,11 +61,11 @@ declare const _default: <S extends FormSchema, T extends boolean = true>(__VLS_p
60
61
  expose(exposed: import("vue").ShallowUnwrapRef<Form<S>>): void;
61
62
  attrs: any;
62
63
  slots: FormSlots;
63
- emit: FormEmits<S, T>;
64
+ emit: ((evt: "error", payload: FormErrorEvent) => void) & ((evt: "submit", payload: FormSubmitEvent<FormData<S, T>>) => void);
64
65
  }>) => import("vue").VNode & {
65
66
  __ctx?: Awaited<typeof __VLS_setup>;
66
67
  };
67
68
  export default _default;
68
69
  type __VLS_PrettifyLocal<T> = {
69
- [K in keyof T]: T[K];
70
+ [K in keyof T as K]: T[K];
70
71
  } & {};
@@ -15,7 +15,7 @@ const props = defineProps({
15
15
  label: { type: String, required: false },
16
16
  description: { type: String, required: false },
17
17
  help: { type: String, required: false },
18
- error: { type: [String, Boolean], required: false },
18
+ error: { type: [Boolean, String], required: false },
19
19
  hint: { type: String, required: false },
20
20
  size: { type: null, required: false },
21
21
  required: { type: Boolean, required: false },
@@ -80,7 +80,7 @@ provide(formFieldInjectionKey, computed(() => ({
80
80
  {{ error }}
81
81
  </slot>
82
82
  </div>
83
- <div v-else-if="help || !!slots.help" :class="ui.help({ class: props.ui?.help })">
83
+ <div v-else-if="help || !!slots.help" :id="`${ariaId}-help`" :class="ui.help({ class: props.ui?.help })">
84
84
  <slot name="help" :help="help">
85
85
  {{ help }}
86
86
  </slot>
@@ -15,7 +15,7 @@ export interface FormFieldProps {
15
15
  label?: string;
16
16
  description?: string;
17
17
  help?: string;
18
- error?: string | boolean;
18
+ error?: boolean | string;
19
19
  hint?: string;
20
20
  /**
21
21
  * @defaultValue 'md'
@@ -46,13 +46,13 @@ export interface FormFieldSlots {
46
46
  help?: string;
47
47
  }): any;
48
48
  error(props: {
49
- error?: string | boolean;
49
+ error?: boolean | string;
50
50
  }): any;
51
51
  default(props: {
52
- error?: string | boolean;
52
+ error?: boolean | string;
53
53
  }): any;
54
54
  }
55
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FormFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FormFieldSlots>;
55
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<FormFieldProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FormFieldSlots>;
56
56
  export default _default;
57
57
  type __VLS_WithSlots<T, S> = T & {
58
58
  new (): {
@@ -50,7 +50,7 @@ export interface HeaderSlots {
50
50
  }
51
51
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<HeaderProps<HeaderMode> & {
52
52
  open?: boolean;
53
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
53
+ }, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
54
54
  "update:open": (value: boolean | undefined) => any;
55
55
  }, string, import("vue").PublicProps, Readonly<HeaderProps<HeaderMode> & {
56
56
  open?: boolean;
@@ -4,5 +4,5 @@ export interface IconProps {
4
4
  size?: string | number;
5
5
  customize?: (content: string, name?: string, prefix?: string, provider?: string) => string;
6
6
  }
7
- declare const _default: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: import("vue").DefineComponent<IconProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
8
  export default _default;
@@ -5,6 +5,7 @@ import theme from "#build/ui/input";
5
5
  <script setup>
6
6
  import { ref, computed, onMounted } from "vue";
7
7
  import { Primitive } from "reka-ui";
8
+ import { useVModel } from "@vueuse/core";
8
9
  import { useAppConfig } from "#imports";
9
10
  import { useButtonGroup } from "../composables/useButtonGroup";
10
11
  import { useComponentIcons } from "../composables/useComponentIcons";
@@ -29,6 +30,8 @@ const props = defineProps({
29
30
  autofocusDelay: { type: Number, required: false, default: 0 },
30
31
  disabled: { type: Boolean, required: false },
31
32
  highlight: { type: Boolean, required: false },
33
+ modelValue: { type: null, required: false },
34
+ defaultValue: { type: null, required: false },
32
35
  modelModifiers: { type: Object, required: false },
33
36
  class: { type: null, required: false },
34
37
  ui: { type: null, required: false },
@@ -43,7 +46,7 @@ const props = defineProps({
43
46
  });
44
47
  const emits = defineEmits(["update:modelValue", "blur", "change"]);
45
48
  const slots = defineSlots();
46
- const [modelValue, modelModifiers] = defineModel({ type: null });
49
+ const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
47
50
  const appConfig = useAppConfig();
48
51
  const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField(props, { deferInputValidation: true });
49
52
  const { orientation, size: buttonGroupSize } = useButtonGroup(props);
@@ -62,29 +65,29 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.input || {} }
62
65
  }));
63
66
  const inputRef = ref(null);
64
67
  function updateInput(value) {
65
- if (modelModifiers.trim) {
68
+ if (props.modelModifiers?.trim) {
66
69
  value = value?.trim() ?? null;
67
70
  }
68
- if (modelModifiers.number || props.type === "number") {
71
+ if (props.modelModifiers?.number || props.type === "number") {
69
72
  value = looseToNumber(value);
70
73
  }
71
- if (modelModifiers.nullify) {
74
+ if (props.modelModifiers?.nullify) {
72
75
  value ||= null;
73
76
  }
74
77
  modelValue.value = value;
75
78
  emitFormInput();
76
79
  }
77
80
  function onInput(event) {
78
- if (!modelModifiers.lazy) {
81
+ if (!props.modelModifiers?.lazy) {
79
82
  updateInput(event.target.value);
80
83
  }
81
84
  }
82
85
  function onChange(event) {
83
86
  const value = event.target.value;
84
- if (modelModifiers.lazy) {
87
+ if (props.modelModifiers?.lazy) {
85
88
  updateInput(value);
86
89
  }
87
- if (modelModifiers.trim) {
90
+ if (props.modelModifiers?.trim) {
88
91
  event.target.value = value.trim();
89
92
  }
90
93
  emitFormChange();
@@ -4,7 +4,7 @@ import theme from '#build/ui/input';
4
4
  import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
5
  import type { AcceptableValue, ComponentConfig } from '../types/utils';
6
6
  type Input = ComponentConfig<typeof theme, AppConfig, 'input'>;
7
- export interface InputProps extends UseComponentIconsProps {
7
+ export interface InputProps<T extends AcceptableValue = AcceptableValue> extends UseComponentIconsProps {
8
8
  /**
9
9
  * The element or component this component should render as.
10
10
  * @defaultValue 'div'
@@ -34,6 +34,8 @@ export interface InputProps extends UseComponentIconsProps {
34
34
  disabled?: boolean;
35
35
  /** Highlight the ring color like a focus state. */
36
36
  highlight?: boolean;
37
+ modelValue?: T;
38
+ defaultValue?: T;
37
39
  modelModifiers?: {
38
40
  string?: boolean;
39
41
  number?: boolean;
@@ -45,9 +47,9 @@ export interface InputProps extends UseComponentIconsProps {
45
47
  ui?: Input['slots'];
46
48
  }
47
49
  export interface InputEmits<T extends AcceptableValue = AcceptableValue> {
48
- (e: 'update:modelValue', payload: T): void;
49
- (e: 'blur', event: FocusEvent): void;
50
- (e: 'change', event: Event): void;
50
+ 'update:modelValue': [payload: T];
51
+ 'blur': [event: FocusEvent];
52
+ 'change': [event: Event];
51
53
  }
52
54
  export interface InputSlots {
53
55
  leading(props?: {}): any;
@@ -59,19 +61,17 @@ declare const _default: <T extends AcceptableValue>(__VLS_props: NonNullable<Awa
59
61
  readonly onBlur?: ((event: FocusEvent) => any) | undefined;
60
62
  readonly onChange?: ((event: Event) => any) | undefined;
61
63
  readonly "onUpdate:modelValue"?: ((payload: T) => any) | undefined;
62
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue"> & (InputProps & {
63
- modelValue?: T;
64
- }) & Partial<{}>> & import("vue").PublicProps;
64
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue"> & InputProps<T> & Partial<{}>> & import("vue").PublicProps;
65
65
  expose(exposed: import("vue").ShallowUnwrapRef<{
66
66
  inputRef: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
67
67
  }>): void;
68
68
  attrs: any;
69
69
  slots: InputSlots;
70
- emit: InputEmits<T> & ((evt: "update:modelValue", value: T | undefined) => void);
70
+ emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", payload: T) => void);
71
71
  }>) => import("vue").VNode & {
72
72
  __ctx?: Awaited<typeof __VLS_setup>;
73
73
  };
74
74
  export default _default;
75
75
  type __VLS_PrettifyLocal<T> = {
76
- [K in keyof T]: T[K];
76
+ [K in keyof T as K]: T[K];
77
77
  } & {};