@witchcraft/ui 0.1.0 → 0.1.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 (138) hide show
  1. package/dist/module.json +2 -2
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Aria/Aria.vue +5 -9
  4. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  5. package/dist/runtime/components/Icon/Icon.vue +10 -31
  6. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  7. package/dist/runtime/components/LibButton/LibButton.vue +58 -77
  8. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  9. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
  10. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  11. package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
  12. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  13. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
  14. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  15. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
  16. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  17. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
  18. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  19. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
  20. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  21. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
  22. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  23. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
  24. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  25. package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
  26. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  27. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
  28. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  29. package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
  30. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  31. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
  32. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  33. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  34. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  35. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
  36. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  37. package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
  38. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  39. package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
  40. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  41. package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
  42. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  43. package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
  44. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  45. package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
  46. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  47. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
  48. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  49. package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
  50. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  51. package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
  52. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  53. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
  54. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  55. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
  56. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  57. package/dist/runtime/components/LibTable/LibTable.vue +63 -100
  58. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  59. package/dist/runtime/components/Template/NAME.vue +15 -36
  60. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  61. package/dist/runtime/components/TestControls/TestControls.vue +6 -9
  62. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  63. package/dist/runtime/directives/vResizableCols.js +89 -83
  64. package/dist/types.d.mts +2 -6
  65. package/package.json +11 -11
  66. package/src/runtime/components/Focus.stories.ts +3 -2
  67. package/src/runtime/components/Icon/Icon.vue +0 -1
  68. package/src/runtime/components/LibButton/LibButton.vue +0 -1
  69. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
  70. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
  71. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
  72. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
  73. package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
  74. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
  75. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
  76. package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
  77. package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
  78. package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
  79. package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
  80. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
  81. package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
  82. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
  83. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
  84. package/src/runtime/components/LibTable/LibTable.vue +0 -1
  85. package/src/runtime/directives/vResizableCols.ts +79 -73
  86. package/dist/module.cjs +0 -5
  87. package/dist/module.d.ts +0 -36
  88. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  89. package/dist/runtime/components/Focus.stories.js +0 -53
  90. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  91. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  92. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  93. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  94. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  95. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  96. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
  97. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
  98. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  101. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  102. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  103. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  104. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  105. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  106. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
  108. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  109. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  110. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  111. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
  112. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  113. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  114. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  115. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  116. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  117. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  118. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  119. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  120. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  121. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  122. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  123. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  124. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  125. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  126. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  127. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  128. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  129. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  130. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  131. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  132. package/dist/runtime/components/Reset.stories.d.ts +0 -5
  133. package/dist/runtime/components/Reset.stories.js +0 -19
  134. package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
  135. package/dist/runtime/components/Scrolling.stories.js +0 -44
  136. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  137. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  138. package/dist/types.d.ts +0 -7
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <!-- todo aria errors -->
3
- <div :class="twMerge(`file-input
3
+ <div :class="twMerge(
4
+ `file-input
4
5
  justify-center
5
6
  border-2
6
7
  border-dashed
@@ -8,25 +9,26 @@
8
9
  focus-outline-within
9
10
  transition-[border-color,box-shadow]
10
11
  ease-out`,
11
- compact && `rounded-sm`,
12
- !compact && `flex w-full flex-col items-center gap-2 rounded-xl p-2 `,
13
- errors.length > 0 && errorFlashing && `border-danger-400`,
14
- ( $.wrapperAttrs as any ).class
15
- )"
16
- v-bind="{...$.wrapperAttrs, class:undefined}"
12
+ compact && `rounded-sm`,
13
+ !compact && `flex w-full flex-col items-center gap-2 rounded-xl p-2 `,
14
+ errors.length > 0 && errorFlashing && `border-danger-400`,
15
+ $.wrapperAttrs.class
16
+ )"
17
+ v-bind="{ ...$.wrapperAttrs, class: void 0 }"
17
18
  >
18
- <div :class="twMerge( `
19
+ <div :class="twMerge(
20
+ `
19
21
  file-input--wrapper
20
22
  relative justify-center`,
21
- compact && `flex gap-2`,
22
- !compact && `input-wrapper
23
+ compact && `flex gap-2`,
24
+ !compact && `input-wrapper
23
25
  flex flex-col items-center
24
26
  `
25
- )"
27
+ )"
26
28
  >
27
29
  <label
28
30
  :for="id ?? fallbackId"
29
- :class="twMerge( `
31
+ :class="twMerge(`
30
32
  file-input--label
31
33
  pointer-events-none
32
34
  flex
@@ -40,14 +42,7 @@
40
42
  </slot>
41
43
  <slot name="label">
42
44
  {{
43
- (compact
44
- ? multiple
45
- ? t("file-input.compact-choose-file-plural")
46
- : t("file-input.compact-choose-file")
47
- : multiple
48
- ? t("file-input.non-compact-choose-file-plural")
49
- : t("file-input.non-compact-choose-file")
50
- )
45
+ compact ? multiple ? t("file-input.compact-choose-file-plural") : t("file-input.compact-choose-file") : multiple ? t("file-input.non-compact-choose-file-plural") : t("file-input.non-compact-choose-file")
51
46
  }}
52
47
  </slot>
53
48
  <span
@@ -65,7 +60,8 @@
65
60
  </label>
66
61
  <input
67
62
  :id="id ?? fallbackId"
68
- :class="twMerge(`
63
+ :class="twMerge(
64
+ `
69
65
  file-input--input
70
66
  absolute
71
67
  inset-0
@@ -74,27 +70,28 @@
74
70
  text-[0]
75
71
  opacity-0
76
72
  `,
77
- ($.inputAttrs as any)?.class
78
- )"
73
+ $.inputAttrs?.class
74
+ )"
79
75
  type="file"
80
76
  :accept="formats.join(', ')"
81
77
  :multiple="multiple"
82
78
  ref="el"
83
- v-bind="{...$.inputAttrs, class:undefined}"
84
- @input="(inputFile as any)"
85
- @click="($event.target! as any).value = null"
79
+ v-bind="{ ...$.inputAttrs, class: void 0 }"
80
+ @input="inputFile"
81
+ @click="$event.target.value = null"
86
82
  >
87
83
  <!-- click event allows event to fire even if the user picks the same file -->
88
84
  </div>
89
85
  <div v-if="!compact && files.length > 0"
90
- :class="twMerge(`file-input--previews
86
+ :class="twMerge(
87
+ `file-input--previews
91
88
  flex items-stretch justify-center gap-2 flex-wrap
92
89
  `,
93
- multiple && `
90
+ multiple && `
94
91
  w-full
95
92
  `,
96
- ($.previewsAttrs as any)?.class
97
- )"
93
+ $.previewsAttrs?.class
94
+ )"
98
95
  >
99
96
  <div class="file-input--preview-spacer flex-1"/>
100
97
  <div class="file-input--preview-wrapper
@@ -163,137 +160,96 @@
163
160
  </div>
164
161
  </div>
165
162
  </template>
166
- <script setup lang="ts">
167
- import { computed, type HTMLAttributes, type InputHTMLAttributes,ref, shallowReactive, watch } from "vue"
168
-
169
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
170
- import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
171
- import { type FileInputError } from "../../types/index.js"
172
- import { twMerge } from "../../utils/twMerge.js"
173
- import Icon from "../Icon/Icon.vue"
174
- import LibButton from "../LibButton/LibButton.vue"
175
- import { getFallbackId,type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
176
-
177
- const t = useInjectedI18n()
178
- const el = ref<null | HTMLInputElement>(null)
179
- type Entry = { file: File, isImg: boolean }
180
-
181
- const files = shallowReactive<(Entry)[]>([])
182
- const errors = shallowReactive<(FileInputError)[]>([])
183
- const errorFlashing = ref(false)
184
163
 
164
+ <script setup>
165
+ import { computed, ref, shallowReactive, watch } from "vue";
166
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
167
+ import { useInjectedI18n } from "../../composables/useInjectedI18n.js";
168
+ import {} from "../../types/index.js";
169
+ import { twMerge } from "../../utils/twMerge.js";
170
+ import Icon from "../Icon/Icon.vue";
171
+ import LibButton from "../LibButton/LibButton.vue";
172
+ import { getFallbackId } from "../shared/props.js";
173
+ const t = useInjectedI18n();
174
+ const el = ref(null);
175
+ const files = shallowReactive([]);
176
+ const errors = shallowReactive([]);
177
+ const errorFlashing = ref(false);
185
178
  watch(files, () => {
186
- emits("input", files.map(entry => entry.file))
187
- })
179
+ emits("input", files.map((entry) => entry.file));
180
+ });
188
181
  watch(errors, () => {
189
- if (errors.length > 0) {
190
- errorFlashing.value = true
191
- setTimeout(() => {
192
- errorFlashing.value = false
193
- }, 500)
194
- emits("errors", errors)
195
- }
196
- })
197
-
182
+ if (errors.length > 0) {
183
+ errorFlashing.value = true;
184
+ setTimeout(() => {
185
+ errorFlashing.value = false;
186
+ }, 500);
187
+ emits("errors", errors);
188
+ }
189
+ });
198
190
  defineOptions({
199
- name: "lib-file-input",
200
- inheritAttrs: false,
201
- })
202
- const $ = useDivideAttrs(["wrapper", "input", "previews"] as const)
203
-
204
- const emits = defineEmits<{
205
- (e: "input", val: File[]): void
206
- (e: "errors", val: FileInputError[]): void
207
- }>()
208
-
209
- const fallbackId = getFallbackId()
210
- // eslint-disable-next-line no-use-before-define
211
- const props = withDefaults(defineProps<Props>(), {
212
- multiple: false,
213
- formats: () => ["image/*", ".jpeg", ".jpg", ".png"],
214
- compact: false,
215
- })
216
-
217
- const mimeTypes = computed(() => props.formats?.filter(_ => !_.startsWith(".")) ?? [])
218
- const extensions = computed(() => props.formats?.filter(_ => _.startsWith(".")) ?? [])
219
-
220
- const getSrc = (file: File) => {
221
- const src = URL.createObjectURL(file)
222
- return src
223
- }
224
-
225
- const removeFile = (entry: Entry) => {
226
- const index = files.indexOf(entry)
227
- files.splice(index, 1)
228
- }
229
- const extensionsList = computed(() => extensions.value.join(", "))
230
- const inputFile = async (e: InputEvent): Promise<void | boolean> => {
231
- e.preventDefault()
232
- if (el.value!.files) {
233
- const errs = []
234
- for (const file of el.value!.files) {
235
- const isImg = file.type.startsWith("image")
236
-
237
- const byPassValidation = props.formats.length === 0
238
- const isValidMimeType = mimeTypes.value.find(_ => _.endsWith("/*") ? file.type.startsWith(_.slice(0, -2)) : _ === file.type) !== undefined
239
- const isValidExtension = extensions.value.find(_ => file.name.endsWith(_)) !== undefined
240
- if (!byPassValidation && (!isValidMimeType || !isValidExtension)) {
241
- const extension = file.name.match(/.*(\..*)/)?.[1] ?? "Unknown"
242
- const type = file.type === "" ? "" : ` (${file.type})`
243
- const message = `File type ${extension}${type} is not allowed. Allowed file types are: ${extensionsList.value}.`
244
- const err = new Error(message) as FileInputError
245
- err.file = file
246
- err.isValidExtension = isValidExtension
247
- err.isValidMimeType = isValidMimeType
248
- errs.push(err)
249
- continue
250
- }
251
- if (errs.length > 0) continue
252
- if (!files.find(_ => _.file === file)) {
253
- if ((props.multiple || files.length < 1)
254
- ) {
255
- files.push({ file, isImg })
256
- } else {
257
- files.splice(0, files.length, { file, isImg })
258
- }
259
- }
260
- }
261
- if (errs.length > 0) {
262
- errors.splice(0, errors.length, ...errs)
263
- return false
264
- } else if (errors.length > 0) {
265
- errors.splice(0, errors.length)
266
- }
267
- }
268
- }
269
-
191
+ name: "lib-file-input",
192
+ inheritAttrs: false
193
+ });
194
+ const $ = useDivideAttrs(["wrapper", "input", "previews"]);
195
+ const emits = defineEmits(["input", "errors"]);
196
+ const fallbackId = getFallbackId();
197
+ const props = defineProps({
198
+ id: { type: String, required: false },
199
+ multiple: { type: Boolean, required: false, default: false },
200
+ formats: { type: Array, required: false, default: () => ["image/*", ".jpeg", ".jpg", ".png"] },
201
+ compact: { type: Boolean, required: false, default: false }
202
+ });
203
+ const mimeTypes = computed(() => props.formats?.filter((_) => !_.startsWith(".")) ?? []);
204
+ const extensions = computed(() => props.formats?.filter((_) => _.startsWith(".")) ?? []);
205
+ const getSrc = (file) => {
206
+ const src = URL.createObjectURL(file);
207
+ return src;
208
+ };
209
+ const removeFile = (entry) => {
210
+ const index = files.indexOf(entry);
211
+ files.splice(index, 1);
212
+ };
213
+ const extensionsList = computed(() => extensions.value.join(", "));
214
+ const inputFile = async (e) => {
215
+ e.preventDefault();
216
+ if (el.value.files) {
217
+ const errs = [];
218
+ for (const file of el.value.files) {
219
+ const isImg = file.type.startsWith("image");
220
+ const byPassValidation = props.formats.length === 0;
221
+ const isValidMimeType = mimeTypes.value.find((_) => _.endsWith("/*") ? file.type.startsWith(_.slice(0, -2)) : _ === file.type) !== void 0;
222
+ const isValidExtension = extensions.value.find((_) => file.name.endsWith(_)) !== void 0;
223
+ if (!byPassValidation && (!isValidMimeType || !isValidExtension)) {
224
+ const extension = file.name.match(/.*(\..*)/)?.[1] ?? "Unknown";
225
+ const type = file.type === "" ? "" : ` (${file.type})`;
226
+ const message = `File type ${extension}${type} is not allowed. Allowed file types are: ${extensionsList.value}.`;
227
+ const err = new Error(message);
228
+ err.file = file;
229
+ err.isValidExtension = isValidExtension;
230
+ err.isValidMimeType = isValidMimeType;
231
+ errs.push(err);
232
+ continue;
233
+ }
234
+ if (errs.length > 0) continue;
235
+ if (!files.find((_) => _.file === file)) {
236
+ if (props.multiple || files.length < 1) {
237
+ files.push({ file, isImg });
238
+ } else {
239
+ files.splice(0, files.length, { file, isImg });
240
+ }
241
+ }
242
+ }
243
+ if (errs.length > 0) {
244
+ errors.splice(0, errors.length, ...errs);
245
+ return false;
246
+ } else if (errors.length > 0) {
247
+ errors.splice(0, errors.length);
248
+ }
249
+ }
250
+ };
270
251
  </script>
271
- <script lang="ts">
272
- export default { name: "lib-file-input" }
273
-
274
- type WrapperTypes =
275
- & WrapperProps<"input", InputHTMLAttributes >
276
- & WrapperProps<"wrapper", HTMLAttributes >
277
- & WrapperProps<"previews",HTMLAttributes >
278
-
279
- type RealProps =
280
- & LinkableByIdProps
281
- & {
282
- multiple?: boolean
283
- /**
284
- * A list of extensions or mime types to add to the input's accept. Basic validations are done so that files match an extension and mimeType, but note that a file could still be lying, all files should be validated server side.
285
- *
286
- * Pass an empty array to allow any filetype.
287
- */
288
- formats?: string[]
289
- compact?: boolean
290
- }
291
252
 
292
- interface Props
293
- extends
294
- /** @vue-ignore */
295
- Partial<Omit<InputHTMLAttributes,"class" | "multiple" | "formats" | "compact"> & TailwindClassProp>,
296
- /** @vue-ignore */
297
- Partial<WrapperTypes>,
298
- RealProps { }
253
+ <script>
254
+ export default { name: "lib-file-input" };
299
255
  </script>
@@ -0,0 +1,43 @@
1
+ import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
2
+ import { type FileInputError } from "../../types/index.js.js";
3
+ import { type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js.js";
4
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ input: (val: File[]) => any;
6
+ errors: (val: FileInputError[]) => any;
7
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
8
+ onInput?: ((val: File[]) => any) | undefined;
9
+ onErrors?: ((val: FileInputError[]) => any) | undefined;
10
+ }>, {
11
+ multiple: boolean;
12
+ formats: string[];
13
+ compact: boolean;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
15
+ icon?: (props: {}) => any;
16
+ } & {
17
+ label?: (props: {}) => any;
18
+ } & {
19
+ formats?: (props: {}) => any;
20
+ }>;
21
+ export default _default;
22
+ type WrapperTypes = WrapperProps<"input", InputHTMLAttributes> & WrapperProps<"wrapper", HTMLAttributes> & WrapperProps<"previews", HTMLAttributes>;
23
+ type RealProps = LinkableByIdProps & {
24
+ multiple?: boolean;
25
+ /**
26
+ * A list of extensions or mime types to add to the input's accept. Basic validations are done so that files match an extension and mimeType, but note that a file could still be lying, all files should be validated server side.
27
+ *
28
+ * Pass an empty array to allow any filetype.
29
+ */
30
+ formats?: string[];
31
+ compact?: boolean;
32
+ };
33
+ interface Props extends
34
+ /** @vue-ignore */
35
+ Partial<Omit<InputHTMLAttributes, "class" | "multiple" | "formats" | "compact"> & TailwindClassProp>,
36
+ /** @vue-ignore */
37
+ Partial<WrapperTypes>, RealProps {
38
+ }
39
+ type __VLS_WithSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };