@voicenter-team/voicenter-ui-plus 3.4.1 → 3.4.3

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 (39) hide show
  1. package/library/assets/assets/sass/main.css +1 -1
  2. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -0
  3. package/library/assets/components/VcFileUploader/{VcFileUploader.css → VcFileUploaderSimple.css} +1 -1
  4. package/library/components/VcFileUploader/VcFileUploader.vue.mjs +87 -5
  5. package/library/components/VcFileUploader/VcFileUploader.vue2.mjs +1 -381
  6. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +338 -0
  7. package/library/components/VcFileUploader/VcFileUploaderArea.vue3.mjs +5 -0
  8. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +7 -0
  9. package/library/components/VcFileUploader/VcFileUploaderSimple.vue2.mjs +200 -0
  10. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue.mjs +62 -0
  11. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue2.mjs +4 -0
  12. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue.mjs +75 -0
  13. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue2.mjs +4 -0
  14. package/library/components/VcTree/VcTree.vue.mjs +8 -2
  15. package/library/components/VcTree/VcTreeSelect.vue.mjs +7 -1
  16. package/library/composables/input/useFileUploader.mjs +163 -0
  17. package/library/index.mjs +151 -146
  18. package/library/index.mjs.br +0 -0
  19. package/library/index.mjs.gz +0 -0
  20. package/library/localization/locales/en.json.mjs +2 -0
  21. package/library/plugin-components.gen.mjs +157 -152
  22. package/library/plugin.mjs +149 -144
  23. package/library/plugin.mjs.br +0 -0
  24. package/library/plugin.mjs.gz +0 -0
  25. package/library/style.css +4 -2
  26. package/library/style.css.br +0 -0
  27. package/library/style.css.gz +0 -0
  28. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +29 -139
  29. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +122 -0
  30. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +127 -0
  31. package/library/types/components/VcFileUploader/VcSimpleUploaderAction.vue.d.ts +38 -0
  32. package/library/types/components/VcFileUploader/VcSimpleUploaderFileList.vue.d.ts +41 -0
  33. package/library/types/components/VcTree/VcTree.vue.d.ts +9 -0
  34. package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +9 -0
  35. package/library/types/components/exports.d.ts +5 -1
  36. package/library/types/components.gen.d.ts +2 -0
  37. package/library/types/composables/input/useFileUploader.d.ts +82 -0
  38. package/library/types/localization/locales/en.json.d.ts +2 -0
  39. package/package.json +1 -1
@@ -0,0 +1,338 @@
1
+ import '../../assets/components/VcFileUploader/VcFileUploaderArea.css';
2
+ import { defineComponent, ref, computed, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeStyle, unref, createBlock, createCommentVNode, createElementVNode, withModifiers, normalizeClass, renderSlot, createVNode, toDisplayString, createTextVNode, Fragment, renderList } from "vue";
3
+ import _sfc_main$1 from "../VcForm/UiComponents/VcInputLabel.vue.mjs";
4
+ import '../../assets/components/VcButton/VcButtonIcon.css';import '../../assets/components/VcIcon/VcIcon.css';import '../../assets/components/VcForm/UiComponents/VcInputLabel.css';/* empty css */
5
+ import _sfc_main$2 from "../VcIcon/VcIcon.vue.mjs";
6
+ /* empty css */
7
+ import _sfc_main$3 from "../VcButton/VcButtonIcon.vue.mjs";
8
+ /* empty css */
9
+ import useInputBase from "../../composables/input/useInputBase.mjs";
10
+ import useFileUploader from "../../composables/input/useFileUploader.mjs";
11
+ import { convertToUnit, getFileSize } from "../../utils/helpers.mjs";
12
+ import { tVU } from "../../localization/index.mjs";
13
+ import { UploadCloud, X, FileArchive, FileSpreadsheet, FileText } from "@lucide/vue";
14
+ const _hoisted_1 = ["data-test"];
15
+ const _hoisted_2 = { class: "vc-file-uploader-area__text" };
16
+ const _hoisted_3 = { class: "vc-file-uploader-area__link" };
17
+ const _hoisted_4 = {
18
+ key: 0,
19
+ class: "vc-file-uploader-area__hint"
20
+ };
21
+ const _hoisted_5 = ["id", "name", "accept", "multiple", "data-test", "disabled", "maxlength"];
22
+ const _hoisted_6 = {
23
+ key: 1,
24
+ class: "vc-input__error-wrapper"
25
+ };
26
+ const _hoisted_7 = { class: "vc-input__error-wrapper--text" };
27
+ const _hoisted_8 = ["src", "alt"];
28
+ const _hoisted_9 = { class: "vc-file-uploader-area__item-info" };
29
+ const _hoisted_10 = { class: "vc-file-uploader-area__item-name" };
30
+ const _hoisted_11 = { class: "vc-file-uploader-area__item-meta" };
31
+ const DEFAULT_BUTTON_COLOR = "primary";
32
+ const _sfc_main = /* @__PURE__ */ defineComponent({
33
+ __name: "VcFileUploaderArea",
34
+ props: {
35
+ files: { default: () => [] },
36
+ modelValue: { default: () => [] },
37
+ maxLength: { default: 5 },
38
+ fileSizeLimit: { default: void 0 },
39
+ fileListSizeLimit: { default: void 0 },
40
+ accept: { default: "*" },
41
+ buttonType: { default: "default" },
42
+ buttonIcon: { default: "" },
43
+ buttonText: { default: "" },
44
+ buttonColor: { default: DEFAULT_BUTTON_COLOR },
45
+ buttonSize: { default: "middle" },
46
+ tagIcon: { default: "vc-icon-confirm-action" },
47
+ noDataText: { default: "" },
48
+ fileType: { default: "file" },
49
+ tagMaxContentWidth: { default: "200" },
50
+ multiple: { type: Boolean, default: false },
51
+ showFileName: { type: Boolean, default: true },
52
+ hideClearAction: { type: Boolean, default: false },
53
+ useArea: { type: Boolean, default: true },
54
+ areaHintText: { default: "" },
55
+ areaListHeight: { default: void 0 },
56
+ fileTypeMap: { default: void 0 },
57
+ id: {},
58
+ disabled: { type: Boolean, default: false },
59
+ clearable: { type: Boolean },
60
+ isError: { type: Boolean },
61
+ emptyText: {},
62
+ prefixIcon: {},
63
+ dataTestName: { default: "vc-file-uploader" },
64
+ prefixIconSize: {},
65
+ name: {},
66
+ placeholder: {},
67
+ maxWidth: {},
68
+ prefixIconColor: {},
69
+ color: {},
70
+ error: {},
71
+ dynamicErrorSpace: { type: Boolean },
72
+ required: { type: Boolean },
73
+ label: {},
74
+ icon: {},
75
+ infoText: {},
76
+ infoTooltipWidth: {}
77
+ },
78
+ emits: ["update:modelValue", "input"],
79
+ setup(__props, { expose: __expose, emit: __emit }) {
80
+ const DEFAULT_FILE_TYPE = {
81
+ icon: FileText,
82
+ color: "var(--secondary-actions)"
83
+ };
84
+ const DEFAULT_FILE_TYPE_MAP = {
85
+ pdf: {
86
+ icon: FileText,
87
+ color: "#D34C4C"
88
+ },
89
+ doc: {
90
+ icon: FileText,
91
+ color: "var(--secondary-text)"
92
+ },
93
+ docx: {
94
+ icon: FileText,
95
+ color: "var(--secondary-text)"
96
+ },
97
+ txt: {
98
+ icon: FileText,
99
+ color: "var(--secondary-text)"
100
+ },
101
+ xls: {
102
+ icon: FileSpreadsheet,
103
+ color: "var(--success-actions)"
104
+ },
105
+ xlsx: {
106
+ icon: FileSpreadsheet,
107
+ color: "var(--success-actions)"
108
+ },
109
+ csv: {
110
+ icon: FileSpreadsheet,
111
+ color: "var(--success-actions)"
112
+ },
113
+ zip: {
114
+ icon: FileArchive,
115
+ color: "var(--warning-actions)"
116
+ },
117
+ rar: {
118
+ icon: FileArchive,
119
+ color: "var(--warning-actions)"
120
+ },
121
+ "7z": {
122
+ icon: FileArchive,
123
+ color: "var(--warning-actions)"
124
+ }
125
+ };
126
+ const props = __props;
127
+ const emit = __emit;
128
+ const { maxWidthStyle } = useInputBase(props, {
129
+ colorClass: DEFAULT_BUTTON_COLOR
130
+ });
131
+ const { items, errorText, onTagClose, onClear, processFiles } = useFileUploader(props, emit);
132
+ const inputUploader = ref();
133
+ const isDragOver = ref(false);
134
+ const browseText = computed(() => tVU.t("voicenterUi.uploader.area.browse"));
135
+ const dropInstructionsText = computed(() => tVU.t("voicenterUi.uploader.area.dropInstructions"));
136
+ const listStyle = computed(() => ({ maxHeight: convertToUnit(props.areaListHeight) }));
137
+ function triggerInputClick() {
138
+ var _a;
139
+ if (props.disabled) return;
140
+ (_a = inputUploader.value) == null ? void 0 : _a.click();
141
+ }
142
+ async function selectFiles(fileList) {
143
+ if (props.disabled || !fileList) return;
144
+ const files = Array.from(fileList);
145
+ await processFiles(props.multiple ? files : files.slice(0, 1));
146
+ }
147
+ async function onFileChange() {
148
+ var _a;
149
+ await selectFiles(((_a = inputUploader.value) == null ? void 0 : _a.files) ?? null);
150
+ if (inputUploader.value) {
151
+ inputUploader.value.value = "";
152
+ }
153
+ }
154
+ function onDragEnter() {
155
+ if (props.disabled) return;
156
+ isDragOver.value = true;
157
+ }
158
+ function onDragLeave() {
159
+ isDragOver.value = false;
160
+ }
161
+ async function onDrop(event) {
162
+ var _a;
163
+ isDragOver.value = false;
164
+ await selectFiles(((_a = event.dataTransfer) == null ? void 0 : _a.files) ?? null);
165
+ }
166
+ const previewCache = /* @__PURE__ */ new Map();
167
+ function isImageFile(item) {
168
+ return item.type.startsWith("image/");
169
+ }
170
+ function previewUrl(item) {
171
+ if (typeof item.File === "string") {
172
+ return item.File;
173
+ }
174
+ if (!(item.File instanceof File)) return void 0;
175
+ let url = previewCache.get(item.File);
176
+ if (!url) {
177
+ url = URL.createObjectURL(item.File);
178
+ previewCache.set(item.File, url);
179
+ }
180
+ return url;
181
+ }
182
+ function pruneStalePreviews() {
183
+ const active = new Set(items.value.map((item) => item.File).filter((file) => file instanceof File));
184
+ previewCache.forEach((url, file) => {
185
+ if (!active.has(file)) {
186
+ URL.revokeObjectURL(url);
187
+ previewCache.delete(file);
188
+ }
189
+ });
190
+ }
191
+ watch(items, pruneStalePreviews);
192
+ onBeforeUnmount(() => {
193
+ previewCache.forEach((url) => URL.revokeObjectURL(url));
194
+ previewCache.clear();
195
+ });
196
+ function resolveFileType(item) {
197
+ var _a, _b, _c;
198
+ const extension = ((_a = item.name.split(".").pop()) == null ? void 0 : _a.toLowerCase()) ?? "";
199
+ const fallback = ((_b = props.fileTypeMap) == null ? void 0 : _b.default) ?? DEFAULT_FILE_TYPE;
200
+ const base = DEFAULT_FILE_TYPE_MAP[extension] ?? fallback;
201
+ const override = (_c = props.fileTypeMap) == null ? void 0 : _c[extension];
202
+ return {
203
+ icon: (override == null ? void 0 : override.icon) ?? base.icon,
204
+ color: (override == null ? void 0 : override.color) ?? base.color
205
+ };
206
+ }
207
+ function fileTypeIcon(item) {
208
+ return resolveFileType(item).icon;
209
+ }
210
+ function fileTypeIconStyle(item) {
211
+ const { color } = resolveFileType(item);
212
+ return {
213
+ color,
214
+ backgroundColor: `color-mix(in srgb, ${color} 15%, transparent)`
215
+ };
216
+ }
217
+ function fileMeta(item) {
218
+ var _a;
219
+ const extension = (_a = item.name.split(".").pop()) == null ? void 0 : _a.toUpperCase();
220
+ const [value, measure] = getFileSize(item.size);
221
+ return extension ? `${extension} · ${value}${measure}` : `${value}${measure}`;
222
+ }
223
+ __expose({
224
+ clear: onClear,
225
+ click: triggerInputClick,
226
+ inputUploader,
227
+ triggerInputClick,
228
+ onFileChange,
229
+ onTagClose
230
+ });
231
+ return (_ctx, _cache) => {
232
+ return openBlock(), createElementBlock("div", {
233
+ style: normalizeStyle(unref(maxWidthStyle)),
234
+ class: "vc-file-uploader-area__container"
235
+ }, [
236
+ __props.label ? (openBlock(), createBlock(_sfc_main$1, {
237
+ key: 0,
238
+ label: __props.label,
239
+ required: __props.required,
240
+ icon: __props.icon,
241
+ "info-text": __props.infoText,
242
+ "info-tooltip-width": __props.infoTooltipWidth,
243
+ class: "mb-2"
244
+ }, null, 8, ["label", "required", "icon", "info-text", "info-tooltip-width"])) : createCommentVNode("", true),
245
+ createElementVNode("div", {
246
+ class: normalizeClass(["vc-file-uploader-area", {
247
+ "vc-file-uploader-area--drag": isDragOver.value,
248
+ "vc-file-uploader-area--disabled": __props.disabled
249
+ }]),
250
+ "data-test": __props.dataTestName,
251
+ onClick: triggerInputClick,
252
+ onDrop: withModifiers(onDrop, ["prevent"]),
253
+ onDragover: _cache[0] || (_cache[0] = withModifiers(() => {
254
+ }, ["prevent"])),
255
+ onDragenter: withModifiers(onDragEnter, ["prevent"]),
256
+ onDragleave: withModifiers(onDragLeave, ["prevent"])
257
+ }, [
258
+ renderSlot(_ctx.$slots, "area", {}, () => [
259
+ createVNode(_sfc_main$2, {
260
+ icon: unref(UploadCloud),
261
+ size: 24,
262
+ class: "vc-file-uploader-area__icon"
263
+ }, null, 8, ["icon"]),
264
+ createElementVNode("p", _hoisted_2, [
265
+ createElementVNode("span", _hoisted_3, toDisplayString(browseText.value), 1),
266
+ createTextVNode(" " + toDisplayString(dropInstructionsText.value), 1)
267
+ ]),
268
+ __props.areaHintText ? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString(__props.areaHintText), 1)) : createCommentVNode("", true)
269
+ ]),
270
+ createElementVNode("input", {
271
+ id: __props.id,
272
+ ref_key: "inputUploader",
273
+ ref: inputUploader,
274
+ hidden: "",
275
+ name: __props.id,
276
+ accept: __props.accept,
277
+ multiple: __props.multiple,
278
+ "data-test": __props.dataTestName && `${__props.dataTestName}-input`,
279
+ disabled: __props.disabled,
280
+ maxlength: __props.maxLength,
281
+ class: "vc-file-uploader-area__input",
282
+ type: "file",
283
+ onChange: onFileChange
284
+ }, null, 40, _hoisted_5)
285
+ ], 42, _hoisted_1),
286
+ unref(errorText) ? (openBlock(), createElementBlock("div", _hoisted_6, [
287
+ createElementVNode("span", _hoisted_7, toDisplayString(unref(errorText)), 1)
288
+ ])) : createCommentVNode("", true),
289
+ unref(items).length ? (openBlock(), createElementBlock("div", {
290
+ key: 2,
291
+ class: "vc-file-uploader-area__list",
292
+ style: normalizeStyle(listStyle.value)
293
+ }, [
294
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
295
+ return openBlock(), createElementBlock("div", {
296
+ key: item.id,
297
+ class: "vc-file-uploader-area__item"
298
+ }, [
299
+ renderSlot(_ctx.$slots, "item", {
300
+ data: item,
301
+ close: unref(onTagClose)
302
+ }, () => [
303
+ isImageFile(item) && previewUrl(item) ? (openBlock(), createElementBlock("img", {
304
+ key: 0,
305
+ src: previewUrl(item),
306
+ alt: item.name,
307
+ class: "vc-file-uploader-area__item-preview"
308
+ }, null, 8, _hoisted_8)) : (openBlock(), createElementBlock("div", {
309
+ key: 1,
310
+ class: "vc-file-uploader-area__item-icon",
311
+ style: normalizeStyle(fileTypeIconStyle(item))
312
+ }, [
313
+ createVNode(_sfc_main$2, {
314
+ icon: fileTypeIcon(item),
315
+ size: 20
316
+ }, null, 8, ["icon"])
317
+ ], 4)),
318
+ createElementVNode("div", _hoisted_9, [
319
+ createElementVNode("span", _hoisted_10, toDisplayString(item.name), 1),
320
+ createElementVNode("span", _hoisted_11, toDisplayString(fileMeta(item)), 1)
321
+ ]),
322
+ createVNode(_sfc_main$3, {
323
+ icon: unref(X),
324
+ color: "destructive",
325
+ class: "vc-file-uploader-area__item-close",
326
+ onClick: ($event) => unref(onTagClose)(item.id)
327
+ }, null, 8, ["icon", "onClick"])
328
+ ])
329
+ ]);
330
+ }), 128))
331
+ ], 4)) : createCommentVNode("", true)
332
+ ], 4);
333
+ };
334
+ }
335
+ });
336
+ export {
337
+ _sfc_main as default
338
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcFileUploaderArea.vue.mjs";
2
+ import '../../assets/components/VcFileUploader/VcFileUploaderArea.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./VcFileUploaderSimple.vue2.mjs";
2
+ import '../../assets/components/VcFileUploader/VcFileUploaderSimple.css';/* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const VcFileUploaderSimple = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b70649fc"]]);
5
+ export {
6
+ VcFileUploaderSimple as default
7
+ };
@@ -0,0 +1,200 @@
1
+ import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle, unref, createBlock, createCommentVNode, createElementVNode, renderSlot, createVNode, toDisplayString, createSlots, withCtx } from "vue";
2
+ import _sfc_main$1 from "../VcForm/UiComponents/VcInputLabel.vue.mjs";
3
+ import '../../assets/components/VcForm/UiComponents/VcInputLabel.css';/* empty css */
4
+ import useInputBase from "../../composables/input/useInputBase.mjs";
5
+ import useFileUploader from "../../composables/input/useFileUploader.mjs";
6
+ import { tVU } from "../../localization/index.mjs";
7
+ import _sfc_main$2 from "./VcSimpleUploaderAction.vue.mjs";
8
+ import _sfc_main$3 from "./VcSimpleUploaderFileList.vue.mjs";
9
+ const _hoisted_1 = { class: "vc-input___file-uploader-wrapper" };
10
+ const _hoisted_2 = ["id", "name", "accept", "multiple", "data-test", "disabled", "maxlength"];
11
+ const _hoisted_3 = {
12
+ key: 1,
13
+ class: "vc-input__message-wrapper"
14
+ };
15
+ const _hoisted_4 = { class: "vc-input__message-wrapper--text" };
16
+ const _hoisted_5 = {
17
+ key: 2,
18
+ class: "vc-input__error-wrapper"
19
+ };
20
+ const _hoisted_6 = { class: "vc-input__error-wrapper--text" };
21
+ const _hoisted_7 = {
22
+ key: 3,
23
+ class: "mt-1"
24
+ };
25
+ const DEFAULT_BUTTON_SIZE = "middle";
26
+ const DEFAULT_BUTTON_TYPE = "default";
27
+ const DEFAULT_BUTTON_COLOR = "primary";
28
+ const _sfc_main = /* @__PURE__ */ defineComponent({
29
+ __name: "VcFileUploaderSimple",
30
+ props: {
31
+ files: { default: () => [] },
32
+ modelValue: { default: () => [] },
33
+ maxLength: { default: 5 },
34
+ fileSizeLimit: { default: void 0 },
35
+ fileListSizeLimit: { default: void 0 },
36
+ accept: { default: "*" },
37
+ buttonType: { default: DEFAULT_BUTTON_TYPE },
38
+ buttonIcon: { default: "" },
39
+ buttonText: { default: "" },
40
+ buttonColor: { default: DEFAULT_BUTTON_COLOR },
41
+ buttonSize: { default: DEFAULT_BUTTON_SIZE },
42
+ tagIcon: { default: "vc-icon-confirm-action" },
43
+ noDataText: { default: "" },
44
+ fileType: { default: "file" },
45
+ tagMaxContentWidth: { default: "200" },
46
+ multiple: { type: Boolean, default: false },
47
+ showFileName: { type: Boolean, default: true },
48
+ hideClearAction: { type: Boolean, default: false },
49
+ useArea: { type: Boolean, default: false },
50
+ areaHintText: { default: "" },
51
+ areaListHeight: { default: void 0 },
52
+ fileTypeMap: { default: void 0 },
53
+ id: {},
54
+ disabled: { type: Boolean, default: false },
55
+ clearable: { type: Boolean },
56
+ isError: { type: Boolean },
57
+ emptyText: {},
58
+ prefixIcon: {},
59
+ dataTestName: { default: "vc-file-uploader" },
60
+ prefixIconSize: {},
61
+ name: {},
62
+ placeholder: {},
63
+ maxWidth: {},
64
+ prefixIconColor: {},
65
+ color: {},
66
+ error: {},
67
+ dynamicErrorSpace: { type: Boolean },
68
+ required: { type: Boolean },
69
+ label: {},
70
+ icon: {},
71
+ infoText: {},
72
+ infoTooltipWidth: {}
73
+ },
74
+ emits: ["update:modelValue", "input"],
75
+ setup(__props, { expose: __expose, emit: __emit }) {
76
+ const props = __props;
77
+ const emit = __emit;
78
+ const { maxWidthStyle } = useInputBase(props, {
79
+ colorClass: DEFAULT_BUTTON_COLOR
80
+ });
81
+ const { items, errorText, onTagClose, onClear, processFiles } = useFileUploader(props, emit);
82
+ const inputUploader = ref();
83
+ const noFilesSelectedText = computed(() => {
84
+ return props.noDataText ? props.noDataText : tVU.t("voicenterUi.uploader.no.files.selected");
85
+ });
86
+ const uploadButtonText = computed(() => {
87
+ return props.buttonText ? props.buttonText : tVU.t("voicenterUi.uploader.upload.file");
88
+ });
89
+ const uploadedButtonText = computed(() => {
90
+ return props.buttonText ? props.buttonText : tVU.t("voicenterUi.uploader.uploaded.files", { count: items.value.length });
91
+ });
92
+ async function onFileChange() {
93
+ var _a;
94
+ const rawFiles = Array.from(((_a = inputUploader.value) == null ? void 0 : _a.files) || []);
95
+ await processFiles(rawFiles);
96
+ if (inputUploader.value) {
97
+ inputUploader.value.value = "";
98
+ }
99
+ }
100
+ function triggerInputClick() {
101
+ if (inputUploader.value) {
102
+ inputUploader.value.click();
103
+ }
104
+ }
105
+ __expose({
106
+ clear: onClear,
107
+ click: triggerInputClick,
108
+ inputUploader,
109
+ triggerInputClick,
110
+ onFileChange,
111
+ onTagClose
112
+ });
113
+ return (_ctx, _cache) => {
114
+ return openBlock(), createElementBlock("div", {
115
+ style: normalizeStyle(unref(maxWidthStyle))
116
+ }, [
117
+ __props.label ? (openBlock(), createBlock(_sfc_main$1, {
118
+ key: 0,
119
+ label: __props.label,
120
+ required: __props.required,
121
+ icon: __props.icon,
122
+ "info-text": __props.infoText,
123
+ "info-tooltip-width": __props.infoTooltipWidth,
124
+ class: "mb-2"
125
+ }, null, 8, ["label", "required", "icon", "info-text", "info-tooltip-width"])) : createCommentVNode("", true),
126
+ createElementVNode("div", _hoisted_1, [
127
+ renderSlot(_ctx.$slots, "action", { click: triggerInputClick }, () => [
128
+ createVNode(_sfc_main$2, {
129
+ "button-type": __props.buttonType,
130
+ "button-color": __props.buttonColor,
131
+ "button-size": __props.buttonSize,
132
+ "button-icon": __props.buttonIcon,
133
+ "upload-button-text": uploadButtonText.value,
134
+ "uploaded-button-text": uploadedButtonText.value,
135
+ "hide-clear-action": __props.hideClearAction,
136
+ "show-file-name": __props.showFileName,
137
+ items: unref(items),
138
+ "onInput:click": triggerInputClick,
139
+ onClear: unref(onClear)
140
+ }, null, 8, ["button-type", "button-color", "button-size", "button-icon", "upload-button-text", "uploaded-button-text", "hide-clear-action", "show-file-name", "items", "onClear"])
141
+ ], true),
142
+ createElementVNode("input", {
143
+ id: __props.id,
144
+ ref_key: "inputUploader",
145
+ ref: inputUploader,
146
+ hidden: "",
147
+ name: __props.id,
148
+ accept: __props.accept,
149
+ multiple: __props.multiple,
150
+ "data-test": __props.dataTestName,
151
+ disabled: __props.disabled,
152
+ maxlength: __props.maxLength,
153
+ class: "vc-input__file-uploader-wrapper-input",
154
+ type: "file",
155
+ onChange: onFileChange
156
+ }, null, 40, _hoisted_2)
157
+ ]),
158
+ !unref(items).length ? (openBlock(), createElementBlock("div", _hoisted_3, [
159
+ createElementVNode("span", _hoisted_4, toDisplayString(noFilesSelectedText.value), 1)
160
+ ])) : createCommentVNode("", true),
161
+ unref(errorText) ? (openBlock(), createElementBlock("div", _hoisted_5, [
162
+ createElementVNode("span", _hoisted_6, toDisplayString(unref(errorText)), 1)
163
+ ])) : createCommentVNode("", true),
164
+ __props.showFileName && unref(items).length ? (openBlock(), createElementBlock("div", _hoisted_7, [
165
+ createVNode(_sfc_main$3, {
166
+ "max-length": __props.maxLength,
167
+ "tag-max-content-width": __props.tagMaxContentWidth,
168
+ "tag-icon": __props.tagIcon,
169
+ items: unref(items),
170
+ onOnClose: unref(onTagClose)
171
+ }, createSlots({ _: 2 }, [
172
+ _ctx.$slots["tag-item"] ? {
173
+ name: "tag-item",
174
+ fn: withCtx(({ data, close }) => [
175
+ renderSlot(_ctx.$slots, "tag-item", {
176
+ data,
177
+ close
178
+ }, void 0, true)
179
+ ]),
180
+ key: "0"
181
+ } : void 0,
182
+ _ctx.$slots["tag-item-other"] ? {
183
+ name: "tag-item-other",
184
+ fn: withCtx(({ data, close }) => [
185
+ renderSlot(_ctx.$slots, "tag-item-other", {
186
+ data,
187
+ close
188
+ }, void 0, true)
189
+ ]),
190
+ key: "1"
191
+ } : void 0
192
+ ]), 1032, ["max-length", "tag-max-content-width", "tag-icon", "items", "onOnClose"])
193
+ ])) : createCommentVNode("", true)
194
+ ], 4);
195
+ };
196
+ }
197
+ });
198
+ export {
199
+ _sfc_main as default
200
+ };
@@ -0,0 +1,62 @@
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, createTextVNode, toDisplayString, createBlock, createCommentVNode } from "vue";
2
+ import _sfc_main$2 from "../VcButton/VcButtonIcon.vue.mjs";
3
+ import '../../assets/components/VcButton/VcButton.css';import '../../assets/components/VcButton/VcButtonIcon.css';/* empty css */
4
+ import _sfc_main$1 from "../VcButton/VcButton.vue.mjs";
5
+ /* empty css */
6
+ const _hoisted_1 = { class: "vc-input__file-uploader-wrapper-action" };
7
+ const _hoisted_2 = { class: "flex items-center w-max gap-2" };
8
+ const _sfc_main = /* @__PURE__ */ defineComponent({
9
+ __name: "VcSimpleUploaderAction",
10
+ props: {
11
+ buttonType: {},
12
+ buttonColor: {},
13
+ buttonIcon: {},
14
+ buttonSize: {},
15
+ uploadButtonText: {},
16
+ uploadedButtonText: {},
17
+ showFileName: { type: Boolean },
18
+ hideClearAction: { type: Boolean },
19
+ items: {}
20
+ },
21
+ emits: ["input:click", "clear"],
22
+ setup(__props, { emit: __emit }) {
23
+ const emit = __emit;
24
+ function triggerInputClick() {
25
+ emit("input:click");
26
+ }
27
+ function onClear() {
28
+ emit("clear");
29
+ }
30
+ return (_ctx, _cache) => {
31
+ var _a;
32
+ return openBlock(), createElementBlock("div", _hoisted_1, [
33
+ createElementVNode("div", _hoisted_2, [
34
+ createVNode(_sfc_main$1, {
35
+ type: __props.buttonType,
36
+ color: __props.buttonColor,
37
+ icon: __props.buttonIcon,
38
+ size: __props.buttonSize,
39
+ onClick: triggerInputClick
40
+ }, {
41
+ default: withCtx(() => {
42
+ var _a2;
43
+ return [
44
+ createTextVNode(toDisplayString(!((_a2 = __props.items) == null ? void 0 : _a2.length) ? __props.uploadButtonText : __props.uploadedButtonText), 1)
45
+ ];
46
+ }),
47
+ _: 1
48
+ }, 8, ["type", "color", "icon", "size"]),
49
+ !__props.showFileName && ((_a = __props.items) == null ? void 0 : _a.length) && !__props.hideClearAction ? (openBlock(), createBlock(_sfc_main$2, {
50
+ key: 0,
51
+ color: "destructive",
52
+ icon: "vc-icon-recycle-bin",
53
+ onClick: onClear
54
+ })) : createCommentVNode("", true)
55
+ ])
56
+ ]);
57
+ };
58
+ }
59
+ });
60
+ export {
61
+ _sfc_main as default
62
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./VcSimpleUploaderAction.vue.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };