@witchcraft/ui 0.2.1-beta.3 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +20 -4
  3. package/dist/runtime/build/WitchcraftUiResolver.d.ts +2 -2
  4. package/dist/runtime/build/generateTheme.js +2 -2
  5. package/dist/runtime/components/Aria/Aria.d.vue.ts +5 -0
  6. package/dist/runtime/components/Aria/Aria.vue +4 -2
  7. package/dist/runtime/components/Aria/Aria.vue.d.ts +1 -1
  8. package/dist/runtime/components/Icon/Icon.d.vue.ts +21 -0
  9. package/dist/runtime/components/Icon/Icon.vue +3 -3
  10. package/dist/runtime/components/Icon/Icon.vue.d.ts +1 -1
  11. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +36 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +9 -4
  13. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +42 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +3 -4
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
  17. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +63 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +15 -8
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +1 -1
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +61 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +10 -6
  22. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +1 -1
  23. package/dist/runtime/components/LibColorPicker/utils/truncate.js +1 -1
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts +22 -0
  25. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -2
  26. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +40 -0
  28. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
  29. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +34 -0
  30. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -6
  31. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
  32. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.d.vue.ts +34 -0
  33. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +7 -5
  34. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
  35. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +22 -0
  36. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +1 -1
  37. package/dist/runtime/components/LibDebug/LibDebug.d.vue.ts +32 -0
  38. package/dist/runtime/components/LibDebug/LibDebug.vue +9 -4
  39. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +1 -1
  40. package/dist/runtime/components/LibDevOnly/LibDevOnly.d.vue.ts +25 -0
  41. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +2 -1
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +4 -1
  43. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +43 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +29 -13
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +165 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +42 -12
  48. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +26 -0
  49. package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
  50. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -3
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +29 -0
  52. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +1 -2
  53. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +2 -2
  54. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +17 -0
  55. package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -8
  56. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +13 -0
  57. package/dist/runtime/components/LibNotifications/LibNotifications.vue +10 -6
  58. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
  59. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +104 -0
  60. package/dist/runtime/components/LibPagination/LibPagination.vue +25 -12
  61. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +2 -2
  62. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +14 -0
  63. package/dist/runtime/components/LibPalette/LibPalette.vue +6 -5
  64. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +5 -5
  65. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +46 -0
  66. package/dist/runtime/components/LibPopup/LibPopup.vue +6 -4
  67. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +3 -3
  68. package/dist/runtime/components/LibProgressBar/LibProgressBar.d.vue.ts +41 -0
  69. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +5 -3
  70. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +9 -9
  71. package/dist/runtime/components/LibRecorder/LibRecorder.d.vue.ts +77 -0
  72. package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
  73. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +2 -2
  74. package/dist/runtime/components/LibRoot/LibRoot.d.vue.ts +41 -0
  75. package/dist/runtime/components/LibRoot/LibRoot.vue +11 -6
  76. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +1 -1
  77. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +35 -0
  78. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
  79. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
  80. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +94 -0
  81. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +6 -4
  82. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
  83. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +45 -0
  84. package/dist/runtime/components/LibTable/LibTable.vue +23 -8
  85. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +1 -1
  86. package/dist/runtime/components/Template/NAME.d.vue.ts +17 -0
  87. package/dist/runtime/components/Template/NAME.vue +2 -3
  88. package/dist/runtime/components/Template/NAME.vue.d.ts +1 -1
  89. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +5 -0
  90. package/dist/runtime/components/TestControls/TestControls.vue +4 -2
  91. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +1 -1
  92. package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
  93. package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
  94. package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
  95. package/dist/runtime/composables/useSetupI18n.d.ts +1 -1
  96. package/dist/runtime/composables/useSuggestions.d.ts +2 -2
  97. package/dist/runtime/helpers/NotificationHandler.d.ts +1 -1
  98. package/dist/runtime/helpers/base64ToImg.js +2 -2
  99. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
  100. package/dist/runtime/types/index.d.ts +1 -1
  101. package/dist/runtime/utils/notifyIfError.d.ts +1 -1
  102. package/package.json +9 -10
  103. package/src/module.ts +41 -33
  104. package/src/runtime/build/WitchcraftUiResolver.ts +3 -3
  105. package/src/runtime/build/generateTheme.ts +3 -2
  106. package/src/runtime/build/unpluginIconViteOptions.ts +1 -1
  107. package/src/runtime/components/Aria/Aria.vue +5 -6
  108. package/src/runtime/components/Focus.stories.ts +11 -12
  109. package/src/runtime/components/Icon/Icon.vue +5 -9
  110. package/src/runtime/components/LibButton/LibButton.stories.ts +21 -22
  111. package/src/runtime/components/LibButton/LibButton.vue +23 -21
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +6 -10
  113. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +17 -19
  114. package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +8 -13
  115. package/src/runtime/components/LibColorInput/LibColorInput.vue +49 -45
  116. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +14 -18
  117. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +50 -52
  118. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -2
  119. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -2
  120. package/src/runtime/components/LibColorPicker/utils/truncate.ts +1 -2
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +5 -8
  122. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  123. package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +14 -15
  124. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +1 -2
  125. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +13 -13
  126. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +9 -8
  127. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +2 -1
  128. package/src/runtime/components/LibDatePicker/helpers.ts +0 -2
  129. package/src/runtime/components/LibDebug/LibDebug.stories.ts +11 -15
  130. package/src/runtime/components/LibDebug/LibDebug.vue +14 -11
  131. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +8 -4
  132. package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +12 -15
  133. package/src/runtime/components/LibFileInput/LibFileInput.vue +65 -47
  134. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +77 -84
  135. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +73 -48
  136. package/src/runtime/components/LibLabel/LibLabel.stories.ts +4 -8
  137. package/src/runtime/components/LibLabel/LibLabel.vue +8 -8
  138. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +10 -15
  139. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +14 -18
  140. package/src/runtime/components/LibNotifications/LibNotification.stories.ts +30 -34
  141. package/src/runtime/components/LibNotifications/LibNotification.vue +27 -17
  142. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +11 -15
  143. package/src/runtime/components/LibNotifications/LibNotifications.vue +21 -16
  144. package/src/runtime/components/LibPagination/LibPagination.stories.ts +5 -9
  145. package/src/runtime/components/LibPagination/LibPagination.vue +46 -32
  146. package/src/runtime/components/LibPalette/LibPalette.stories.ts +3 -7
  147. package/src/runtime/components/LibPalette/LibPalette.vue +13 -12
  148. package/src/runtime/components/LibPopup/LibPopup.stories.ts +19 -23
  149. package/src/runtime/components/LibPopup/LibPopup.vue +31 -35
  150. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +13 -17
  151. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +36 -33
  152. package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +11 -12
  153. package/src/runtime/components/LibRecorder/LibRecorder.vue +34 -34
  154. package/src/runtime/components/LibRoot/LibRoot.vue +16 -12
  155. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +20 -24
  156. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +17 -21
  157. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +16 -19
  158. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +28 -30
  159. package/src/runtime/components/LibTable/LibTable.stories.ts +30 -33
  160. package/src/runtime/components/LibTable/LibTable.vue +38 -24
  161. package/src/runtime/components/Reset.stories.ts +3 -6
  162. package/src/runtime/components/Scrolling.stories.ts +5 -8
  163. package/src/runtime/components/Template/NAME.vue +11 -11
  164. package/src/runtime/components/Template/TemplateStory.ts +9 -10
  165. package/src/runtime/components/TestControls/TestControls.vue +5 -5
  166. package/src/runtime/components/shared/props.ts +4 -6
  167. package/src/runtime/components/shared/storyHelpers/playInput.ts +2 -3
  168. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +5 -9
  169. package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
  170. package/src/runtime/composables/useAriaLabel.ts +1 -1
  171. package/src/runtime/composables/useDarkMode.ts +15 -19
  172. package/src/runtime/composables/useDragWithThreshold.ts +6 -8
  173. package/src/runtime/composables/useGlobalResizeObserver.ts +0 -1
  174. package/src/runtime/composables/useInjectedDarkMode.ts +2 -2
  175. package/src/runtime/composables/useInjectedI18n.ts +1 -1
  176. package/src/runtime/composables/useInjectedLocale.ts +3 -4
  177. package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +4 -4
  178. package/src/runtime/composables/useScrollNearContainerEdges.ts +12 -13
  179. package/src/runtime/composables/useSetupI18n.ts +4 -7
  180. package/src/runtime/composables/useSetupLocale.ts +3 -5
  181. package/src/runtime/composables/useSuggestions.ts +25 -30
  182. package/src/runtime/directives/vDetectFlex.ts +5 -8
  183. package/src/runtime/directives/vExtractRootEl.ts +1 -1
  184. package/src/runtime/directives/vResizableCols.ts +3 -7
  185. package/src/runtime/directives/vResizeObserver.ts +1 -2
  186. package/src/runtime/globalResizeObserver.ts +0 -1
  187. package/src/runtime/helpers/NotificationHandler.ts +8 -12
  188. package/src/runtime/helpers/base64ToImg.ts +2 -3
  189. package/src/runtime/helpers/createNoonUtcDate.ts +0 -1
  190. package/src/runtime/helpers/defaultTranslationFunction.ts +0 -1
  191. package/src/runtime/helpers/getTimeZoneList.ts +0 -1
  192. package/src/runtime/helpers/readFile.ts +2 -2
  193. package/src/runtime/helpers/resizeObserverWrapper.ts +0 -1
  194. package/src/runtime/helpers/storybook.ts +2 -3
  195. package/src/runtime/main.lib.ts +0 -2
  196. package/src/runtime/nuxt/plugins/vue-plugin.ts +4 -5
  197. package/src/runtime/tailwind/themeConvertionOpts.ts +3 -4
  198. package/src/runtime/theme.ts +0 -1
  199. package/src/runtime/types/index.ts +3 -4
  200. package/src/runtime/utils/notifyIfError.ts +2 -2
  201. package/src/runtime/utils/twMerge.ts +2 -2
  202. package/src/runtime/vue/VueComponentsPlugin.ts +1 -2
  203. package/src/runtime/vue/registerComponents.ts +0 -1
@@ -4,22 +4,19 @@ import { ref } from "vue"
4
4
 
5
5
  import LibFileInput from "./LibFileInput.vue"
6
6
 
7
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
7
  import * as components from "../index.js"
9
8
 
10
-
11
9
  const meta: Meta<typeof LibFileInput> = {
12
10
  component: LibFileInput,
13
11
  title: "Components/FileInput",
14
12
  args: {
15
13
 
16
- },
14
+ }
17
15
  }
18
16
 
19
17
  export default meta
20
18
  type Story = StoryObj<typeof LibFileInput>
21
19
 
22
-
23
20
  export const SingleFile: Story = {
24
21
  render: args => ({
25
22
  components,
@@ -32,16 +29,16 @@ export const SingleFile: Story = {
32
29
  },
33
30
  template: `
34
31
  <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
35
- `,
36
- }),
32
+ `
33
+ })
37
34
  }
38
35
 
39
36
  export const MultipleFile: Story = {
40
37
  ...SingleFile,
41
38
  args: {
42
39
  ...SingleFile.args,
43
- multiple: true,
44
- },
40
+ multiple: true
41
+ }
45
42
  }
46
43
 
47
44
  export const AnyFormat: Story = {
@@ -49,16 +46,16 @@ export const AnyFormat: Story = {
49
46
  args: {
50
47
  ...SingleFile.args,
51
48
  multiple: true,
52
- formats: [],
53
- },
49
+ formats: []
50
+ }
54
51
  }
55
52
 
56
53
  export const Compact: Story = {
57
54
  ...SingleFile,
58
55
  args: {
59
56
  ...SingleFile.args,
60
- compact: true,
61
- },
57
+ compact: true
58
+ }
62
59
  }
63
60
 
64
61
  export const ErrorHandling: Story = {
@@ -68,12 +65,12 @@ export const ErrorHandling: Story = {
68
65
  const errors = ref([])
69
66
  const errorHandler = (e: any) => errors.value = e
70
67
  return {
71
- args, errors, errorHandler,
68
+ args, errors, errorHandler
72
69
  }
73
70
  },
74
71
  template: `
75
72
  <lib-debug :title="'Errors'">{{errors}}</lib-debug>
76
73
  <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
77
- `,
78
- }),
74
+ `
75
+ })
79
76
  }
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <!-- todo aria errors -->
3
- <div :class="twMerge(`file-input
3
+ <div
4
+ :class="twMerge(`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
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 as any).class
15
16
  )"
16
- v-bind="{...$.wrapperAttrs, class:undefined}"
17
+ v-bind="{ ...$.wrapperAttrs, class: undefined }"
17
18
  >
18
- <div :class="twMerge( `
19
+ <div
20
+ :class="twMerge(`
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
@@ -35,7 +37,10 @@
35
37
  whitespace-nowrap
36
38
  `)"
37
39
  >
38
- <slot v-if="compact || multiple || files.length === 0" name="icon">
40
+ <slot
41
+ v-if="compact || multiple || files.length === 0"
42
+ name="icon"
43
+ >
39
44
  <icon><i-fa6-solid-arrow-up-from-bracket/></icon>
40
45
  </slot>
41
46
  <slot name="label">
@@ -57,7 +62,10 @@
57
62
  {{ ` (${files.length})` }}
58
63
  </span>
59
64
  </label>
60
- <label v-if="!compact && formats?.length > 0" class="file-input--formats-label flex flex-col items-center text-sm">
65
+ <label
66
+ v-if="!compact && formats?.length > 0"
67
+ class="file-input--formats-label flex flex-col items-center text-sm"
68
+ >
61
69
  <slot name="formats">{{ t("file-input.accepted-formats") }}: </slot>
62
70
  <div class="file-input--formats-list">
63
71
  {{ extensions.join(", ") }}
@@ -80,13 +88,14 @@
80
88
  :accept="formats.join(', ')"
81
89
  :multiple="multiple"
82
90
  ref="el"
83
- v-bind="{...$.inputAttrs, class:undefined}"
91
+ v-bind="{ ...$.inputAttrs, class: undefined }"
84
92
  @input="(inputFile as any)"
85
93
  @click="($event.target! as any).value = null"
86
94
  >
87
95
  <!-- click event allows event to fire even if the user picks the same file -->
88
96
  </div>
89
- <div v-if="!compact && files.length > 0"
97
+ <div
98
+ v-if="!compact && files.length > 0"
90
99
  :class="twMerge(`file-input--previews
91
100
  flex items-stretch justify-center gap-2 flex-wrap
92
101
  `,
@@ -97,7 +106,8 @@
97
106
  )"
98
107
  >
99
108
  <div class="file-input--preview-spacer flex-1"/>
100
- <div class="file-input--preview-wrapper
109
+ <div
110
+ class="file-input--preview-wrapper
101
111
  z-1
102
112
  relative
103
113
  flex
@@ -124,16 +134,21 @@
124
134
  </div>
125
135
 
126
136
  <div class="file-input--preview flex flex-initial basis-full justify-center">
127
- <div v-if="entry.isImg"
137
+ <div
138
+ v-if="entry.isImg"
128
139
  class="file-input--preview-image
129
140
  bg-transparency-squares flex
130
141
  h-[80px] flex-wrap items-center
131
142
  justify-center
132
143
  "
133
144
  >
134
- <img class="max-h-full w-auto" :src="getSrc(entry.file)">
145
+ <img
146
+ class="max-h-full w-auto"
147
+ :src="getSrc(entry.file)"
148
+ >
135
149
  </div>
136
- <div v-if="!entry.isImg"
150
+ <div
151
+ v-if="!entry.isImg"
137
152
  class="file-input--preview-no-image
138
153
  flex h-[80px]
139
154
  flex-1 basis-full flex-wrap items-center justify-center
@@ -142,7 +157,8 @@
142
157
  <icon><i-fa6-regular-file class="text-4xl opacity-50"/></icon>
143
158
  </div>
144
159
  </div>
145
- <div class="
160
+ <div
161
+ class="
146
162
  file-input--preview-filename
147
163
  min-w-0
148
164
  flex-1
@@ -163,8 +179,9 @@
163
179
  </div>
164
180
  </div>
165
181
  </template>
182
+
166
183
  <script setup lang="ts">
167
- import { computed, type HTMLAttributes, type InputHTMLAttributes,ref, shallowReactive, watch } from "vue"
184
+ import { computed, type HTMLAttributes, type InputHTMLAttributes, ref, shallowReactive, watch } from "vue"
168
185
 
169
186
  import IFa6RegularFile from "~icons/fa6-regular/file"
170
187
  import IFa6SolidArrowUpFromBracket from "~icons/fa6-solid/arrow-up-from-bracket"
@@ -172,11 +189,11 @@ import IFa6SolidXmark from "~icons/fa6-solid/xmark"
172
189
 
173
190
  import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
174
191
  import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
175
- import { type FileInputError } from "../../types/index.js"
192
+ import type { FileInputError } from "../../types/index.js"
176
193
  import { twMerge } from "../../utils/twMerge.js"
177
194
  import Icon from "../Icon/Icon.vue"
178
195
  import LibButton from "../LibButton/LibButton.vue"
179
- import { getFallbackId,type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
196
+ import { getFallbackId, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
180
197
 
181
198
  const t = useInjectedI18n()
182
199
  const el = ref<null | HTMLInputElement>(null)
@@ -200,11 +217,11 @@ watch(errors, () => {
200
217
  })
201
218
 
202
219
  defineOptions({
203
- name: "lib-file-input",
204
- inheritAttrs: false,
220
+ name: "LibFileInput",
221
+ inheritAttrs: false
205
222
  })
206
223
  const $ = useDivideAttrs(["wrapper", "input", "previews"] as const)
207
-
224
+
208
225
  const emits = defineEmits<{
209
226
  (e: "input", val: File[]): void
210
227
  (e: "errors", val: FileInputError[]): void
@@ -214,7 +231,7 @@ const fallbackId = getFallbackId()
214
231
  const props = withDefaults(defineProps<Props>(), {
215
232
  multiple: false,
216
233
  formats: () => ["image/*", ".jpeg", ".jpg", ".png"],
217
- compact: false,
234
+ compact: false
218
235
  })
219
236
 
220
237
  const mimeTypes = computed(() => props.formats?.filter(_ => !_.startsWith(".")) ?? [])
@@ -230,7 +247,7 @@ const removeFile = (entry: Entry) => {
230
247
  files.splice(index, 1)
231
248
  }
232
249
  const extensionsList = computed(() => extensions.value.join(", "))
233
- const inputFile = async (e: InputEvent): Promise<void | boolean> => {
250
+ const inputFile = async (e: InputEvent): Promise<undefined | boolean> => {
234
251
  e.preventDefault()
235
252
  if (el.value!.files) {
236
253
  const errs = []
@@ -268,34 +285,35 @@ const inputFile = async (e: InputEvent): Promise<void | boolean> => {
268
285
  errors.splice(0, errors.length)
269
286
  }
270
287
  }
288
+ return undefined
271
289
  }
272
-
273
290
  </script>
291
+
274
292
  <script lang="ts">
275
- export default { name: "lib-file-input" }
293
+ export default { name: "LibFileInput" }
276
294
 
277
- type WrapperTypes =
278
- & WrapperProps<"input", InputHTMLAttributes >
279
- & WrapperProps<"wrapper", HTMLAttributes >
280
- & WrapperProps<"previews",HTMLAttributes >
295
+ type WrapperTypes
296
+ = & WrapperProps<"input", InputHTMLAttributes>
297
+ & WrapperProps<"wrapper", HTMLAttributes>
298
+ & WrapperProps<"previews", HTMLAttributes>
281
299
 
282
- type RealProps =
283
- & LinkableByIdProps
284
- & {
285
- multiple?: boolean
286
- /**
287
- * 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.
288
- *
289
- * Pass an empty array to allow any filetype.
290
- */
291
- formats?: string[]
292
- compact?: boolean
293
- }
300
+ type RealProps
301
+ = & LinkableByIdProps
302
+ & {
303
+ multiple?: boolean
304
+ /**
305
+ * 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.
306
+ *
307
+ * Pass an empty array to allow any filetype.
308
+ */
309
+ formats?: string[]
310
+ compact?: boolean
311
+ }
294
312
 
295
313
  interface Props
296
314
  extends
297
315
  /** @vue-ignore */
298
- Partial<Omit<InputHTMLAttributes,"class" | "multiple" | "formats" | "compact"> & TailwindClassProp>,
316
+ Partial<Omit<InputHTMLAttributes, "class" | "multiple" | "formats" | "compact"> & TailwindClassProp>,
299
317
  /** @vue-ignore */
300
318
  Partial<WrapperTypes>,
301
319
  RealProps { }