@voicenter-team/voicenter-ui-plus 3.4.2 → 3.4.4

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 (82) hide show
  1. package/README.md +502 -502
  2. package/library/assets/assets/sass/main.css +1 -1
  3. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -0
  4. package/library/assets/components/VcFileUploader/{VcFileUploader.css → VcFileUploaderSimple.css} +1 -1
  5. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  6. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  7. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  8. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  9. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  10. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  11. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  12. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  13. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  14. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  15. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  16. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  17. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  18. package/library/components/VcFileUploader/VcFileUploader.vue.mjs +87 -5
  19. package/library/components/VcFileUploader/VcFileUploader.vue2.mjs +1 -381
  20. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +338 -0
  21. package/library/components/VcFileUploader/VcFileUploaderArea.vue3.mjs +5 -0
  22. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +7 -0
  23. package/library/components/VcFileUploader/VcFileUploaderSimple.vue2.mjs +200 -0
  24. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue.mjs +62 -0
  25. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue2.mjs +4 -0
  26. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue.mjs +75 -0
  27. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue2.mjs +4 -0
  28. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  29. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  30. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  31. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  32. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  33. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  34. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  35. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  36. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  37. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  38. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.mjs +33 -25
  39. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.mjs +31 -0
  40. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue2.mjs +4 -0
  41. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  42. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  43. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  44. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  45. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  46. package/library/composables/input/useFileUploader.mjs +163 -0
  47. package/library/composables/option/useOptionMethods.mjs +14 -0
  48. package/library/index.mjs +151 -146
  49. package/library/index.mjs.br +0 -0
  50. package/library/index.mjs.gz +0 -0
  51. package/library/localization/index.mjs.gz +0 -0
  52. package/library/localization/locales/en.json.mjs +2 -0
  53. package/library/plugin-components.gen.mjs +157 -152
  54. package/library/plugin.mjs +149 -144
  55. package/library/plugin.mjs.br +0 -0
  56. package/library/plugin.mjs.gz +0 -0
  57. package/library/style.css +17 -15
  58. package/library/style.css.br +0 -0
  59. package/library/style.css.gz +0 -0
  60. package/library/theme/index.mjs.gz +0 -0
  61. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +29 -139
  62. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +122 -0
  63. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +127 -0
  64. package/library/types/components/VcFileUploader/VcSimpleUploaderAction.vue.d.ts +38 -0
  65. package/library/types/components/VcFileUploader/VcSimpleUploaderFileList.vue.d.ts +41 -0
  66. package/library/types/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.d.ts +36 -0
  67. package/library/types/components/exports.d.ts +5 -1
  68. package/library/types/components.gen.d.ts +2 -0
  69. package/library/types/composables/input/useFileUploader.d.ts +82 -0
  70. package/library/types/composables/option/useOptionMethods.d.ts +9 -8
  71. package/library/types/localization/locales/en.json.d.ts +164 -162
  72. package/library/types/theme/themes.json.d.ts +227 -227
  73. package/library/types/types/OptionAndConfig.types.d.ts +4 -0
  74. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  75. package/package.json +185 -185
  76. package/src/theme/index.ts +101 -101
  77. package/src/theme/tailwindScheme.js +37 -37
  78. package/src/theme/theme.types.ts +31 -31
  79. package/src/theme/themeMerge.ts +40 -40
  80. package/src/theme/themes.json +227 -227
  81. package/tailwind.config.d.ts +5 -5
  82. package/tailwind.config.js +192 -192
@@ -1,384 +1,4 @@
1
- import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeStyle, unref, createBlock, createCommentVNode, createElementVNode, renderSlot, createVNode, withCtx, createTextVNode, toDisplayString, Fragment, renderList } from "vue";
2
- import _sfc_main$2 from "../VcButton/VcButton.vue.mjs";
3
- import '../../assets/components/VcButton/VcButtonIcon.css';import '../../assets/components/VcForm/UiComponents/VcInputLabel.css';import '../../assets/components/VcTag/VcTag.css';import '../../assets/components/VcDelimitedList/VcDelimitedList.css';import '../../assets/components/VcButton/VcButton.css';/* empty css */
4
- import _sfc_main$4 from "../VcDelimitedList/VcDelimitedList.vue.mjs";
5
- /* empty css */
6
- import _sfc_main$5 from "../VcTag/VcTag.vue.mjs";
7
- /* empty css */
8
- import { getFileSize } from "../../utils/helpers.mjs";
9
- import _sfc_main$1 from "../VcForm/UiComponents/VcInputLabel.vue.mjs";
10
- /* empty css */
11
- import useInputBase from "../../composables/input/useInputBase.mjs";
12
- import { tVU } from "../../localization/index.mjs";
13
- import _sfc_main$3 from "../VcButton/VcButtonIcon.vue.mjs";
14
- /* empty css */
15
- const _hoisted_1 = { class: "vc-input___file-uploader-wrapper" };
16
- const _hoisted_2 = { class: "vc-input__file-uploader-wrapper-label" };
17
- const _hoisted_3 = { class: "flex items-center w-max gap-2" };
18
- const _hoisted_4 = ["id", "name", "accept", "multiple", "data-test", "disabled", "maxlength"];
19
- const _hoisted_5 = {
20
- key: 1,
21
- class: "vc-input__message-wrapper"
22
- };
23
- const _hoisted_6 = { class: "vc-input__message-wrapper--text" };
24
- const _hoisted_7 = {
25
- key: 2,
26
- class: "vc-input__error-wrapper"
27
- };
28
- const _hoisted_8 = { class: "vc-input__error-wrapper--text" };
29
- const _hoisted_9 = {
30
- key: 3,
31
- class: "mt-1"
32
- };
33
- const DEFAULT_BUTTON_SIZE = "middle";
34
- const DEFAULT_BUTTON_TYPE = "default";
35
- const DEFAULT_BUTTON_COLOR = "primary";
36
- const _sfc_main = /* @__PURE__ */ defineComponent({
37
- __name: "VcFileUploader",
38
- props: {
39
- files: { default: () => [] },
40
- modelValue: { default: () => [] },
41
- maxLength: { default: 5 },
42
- fileSizeLimit: { default: void 0 },
43
- fileListSizeLimit: { default: void 0 },
44
- accept: { default: "*" },
45
- buttonType: { default: DEFAULT_BUTTON_TYPE },
46
- buttonIcon: { default: "" },
47
- buttonText: { default: "" },
48
- buttonColor: { default: DEFAULT_BUTTON_COLOR },
49
- buttonSize: { default: DEFAULT_BUTTON_SIZE },
50
- tagIcon: { default: "vc-icon-confirm-action" },
51
- noDataText: { default: "" },
52
- fileType: { default: "file" },
53
- tagMaxContentWidth: { default: "200" },
54
- multiple: { type: Boolean, default: false },
55
- showFileName: { type: Boolean, default: true },
56
- hideClearAction: { type: Boolean, default: false },
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 props = __props;
81
- const emit = __emit;
82
- const { maxWidthStyle } = useInputBase(props, {
83
- colorClass: DEFAULT_BUTTON_COLOR
84
- });
85
- const items = ref([]);
86
- const innerErrorText = ref("");
87
- const inputUploader = ref();
88
- const errorText = computed(() => {
89
- if (innerErrorText.value) {
90
- return innerErrorText.value;
91
- }
92
- return props.error;
93
- });
94
- const noFilesSelectedText = computed(() => {
95
- return props.noDataText ? props.noDataText : tVU.t("voicenterUi.uploader.no.files.selected");
96
- });
97
- const uploadButtonText = computed(() => {
98
- return props.buttonText ? props.buttonText : tVU.t("voicenterUi.uploader.upload.file");
99
- });
100
- const uploadedButtonText = computed(() => {
101
- return props.buttonText ? props.buttonText : tVU.t("voicenterUi.uploader.uploaded.files", { count: items.value.length });
102
- });
103
- function parseFiles(files) {
104
- let _files = Array.from(files);
105
- if (_files.length && _files.length > props.maxLength) {
106
- _files = files.slice(0, props.maxLength);
107
- }
108
- items.value = _files.map((item, index) => {
109
- item.id = index;
110
- return item;
111
- });
112
- }
113
- function convertFilesToBase64(file, id) {
114
- return new Promise((resolve) => {
115
- const reader = new FileReader();
116
- reader.readAsDataURL(file);
117
- reader.onload = () => {
118
- resolve({
119
- id,
120
- lastModified: file.lastModified,
121
- name: file.name,
122
- size: file.size,
123
- type: file.type,
124
- File: reader.result
125
- });
126
- };
127
- });
128
- }
129
- async function getFilesInBase64(files) {
130
- const _arr = [];
131
- let id = 0;
132
- for (const file of files) {
133
- const contents = await convertFilesToBase64(file, id);
134
- _arr.push(contents);
135
- id++;
136
- }
137
- return _arr;
138
- }
139
- async function getFileArray(inputFiles) {
140
- let files = [];
141
- files = processFilesLength(inputFiles);
142
- files = processFileSize(files);
143
- if (props.fileType === "base64") {
144
- return await getFilesInBase64(files);
145
- }
146
- return files;
147
- }
148
- function toFileUploaded(file) {
149
- const augmented = Object.assign(file, { File: file });
150
- return augmented;
151
- }
152
- function fromBase64Result(item) {
153
- const blob = new File([], item.name, {
154
- lastModified: item.lastModified,
155
- type: item.type
156
- });
157
- return Object.assign(blob, {
158
- id: item.id,
159
- File: item.File
160
- });
161
- }
162
- async function onFileChange() {
163
- var _a;
164
- innerErrorText.value = "";
165
- const rawFiles = Array.from(((_a = inputUploader.value) == null ? void 0 : _a.files) || []);
166
- const inputFiles = rawFiles.map(toFileUploaded);
167
- if (inputFiles.length) {
168
- const files = await getFileArray(inputFiles);
169
- if (inputUploader.value) {
170
- inputUploader.value.value = "";
171
- }
172
- const out = files.map((item) => {
173
- if (item instanceof File) {
174
- return toFileUploaded(item);
175
- }
176
- return fromBase64Result(item);
177
- });
178
- emit("input", out);
179
- emit("update:modelValue", out);
180
- }
181
- }
182
- function processFilesLength(files) {
183
- if (props.multiple && files.length > props.maxLength) {
184
- innerErrorText.value = tVU.t("voicenterUi.uploader.some.file.were.concat.files.limit");
185
- return files.slice(0, props.maxLength);
186
- }
187
- return files;
188
- }
189
- function processFileSize(files) {
190
- if (props.multiple) {
191
- const filesSizeSum = files.map((file) => file.size).reduce((sizeSum, a) => sizeSum + a, 0);
192
- if (props.fileListSizeLimit && filesSizeSum > props.fileListSizeLimit) {
193
- const sizeToExceed = getFileSize(props.fileListSizeLimit);
194
- innerErrorText.value = tVU.t("voicenterUi.uploader.file.size.sum.should.not.exceed", {
195
- value: sizeToExceed[0],
196
- measure: sizeToExceed[1]
197
- });
198
- return [];
199
- }
200
- const _fileSizeLimit = props.fileSizeLimit;
201
- if (_fileSizeLimit) {
202
- files = files.filter((file) => {
203
- if (file.size > _fileSizeLimit) {
204
- innerErrorText.value = tVU.t("voicenterUi.uploader.some.files.were.concat.size.limit");
205
- return false;
206
- }
207
- return true;
208
- });
209
- }
210
- return files;
211
- } else {
212
- if (!props.fileSizeLimit) return files;
213
- const limitSize = getFileSize(props.fileSizeLimit);
214
- const file = files[0];
215
- if (file && file.size > props.fileSizeLimit) {
216
- const fileSize = getFileSize(file.size);
217
- innerErrorText.value = tVU.t("voicenterUi.uploader.file.size.is.but.limit.is", {
218
- fileSize: fileSize[0],
219
- fileMeasure: fileSize[1],
220
- limitSize: limitSize[0],
221
- limitMeasure: limitSize[1]
222
- });
223
- return [];
224
- }
225
- return files;
226
- }
227
- }
228
- function onTagClose(index) {
229
- innerErrorText.value = "";
230
- const files = items.value.filter((item) => item.id !== index);
231
- emit("input", files);
232
- emit("update:modelValue", files);
233
- }
234
- function triggerInputClick() {
235
- if (inputUploader.value) {
236
- inputUploader.value.click();
237
- }
238
- }
239
- function onClear() {
240
- items.value = [];
241
- emit("input", []);
242
- emit("update:modelValue", []);
243
- }
244
- watch(
245
- () => props.modelValue,
246
- (val) => {
247
- parseFiles(val);
248
- }
249
- );
250
- watch(
251
- () => props.files,
252
- (val) => {
253
- parseFiles(val);
254
- },
255
- {
256
- immediate: true
257
- }
258
- );
259
- __expose({
260
- clear: onClear,
261
- click: triggerInputClick,
262
- inputUploader,
263
- triggerInputClick,
264
- onFileChange,
265
- onTagClose
266
- });
267
- return (_ctx, _cache) => {
268
- return openBlock(), createElementBlock("div", {
269
- style: normalizeStyle(unref(maxWidthStyle))
270
- }, [
271
- __props.label ? (openBlock(), createBlock(_sfc_main$1, {
272
- key: 0,
273
- label: __props.label,
274
- required: __props.required,
275
- icon: __props.icon,
276
- "info-text": __props.infoText,
277
- "info-tooltip-width": __props.infoTooltipWidth,
278
- class: "mb-2"
279
- }, null, 8, ["label", "required", "icon", "info-text", "info-tooltip-width"])) : createCommentVNode("", true),
280
- createElementVNode("div", _hoisted_1, [
281
- createElementVNode("div", _hoisted_2, [
282
- renderSlot(_ctx.$slots, "action", { click: triggerInputClick }, () => [
283
- createElementVNode("div", _hoisted_3, [
284
- createVNode(_sfc_main$2, {
285
- type: __props.buttonType,
286
- color: __props.buttonColor,
287
- icon: __props.buttonIcon,
288
- size: __props.buttonSize,
289
- onClick: triggerInputClick
290
- }, {
291
- default: withCtx(() => [
292
- createTextVNode(toDisplayString(!items.value.length ? uploadButtonText.value : uploadedButtonText.value), 1)
293
- ]),
294
- _: 1
295
- }, 8, ["type", "color", "icon", "size"]),
296
- !__props.showFileName && items.value.length && !__props.hideClearAction ? (openBlock(), createBlock(_sfc_main$3, {
297
- key: 0,
298
- color: "destructive",
299
- icon: "vc-icon-recycle-bin",
300
- onClick: onClear
301
- })) : createCommentVNode("", true)
302
- ])
303
- ], true)
304
- ]),
305
- createElementVNode("input", {
306
- id: __props.id,
307
- ref_key: "inputUploader",
308
- ref: inputUploader,
309
- hidden: "",
310
- name: __props.id,
311
- accept: __props.accept,
312
- multiple: __props.multiple,
313
- "data-test": __props.dataTestName,
314
- disabled: __props.disabled,
315
- maxlength: __props.maxLength,
316
- class: "vc-input__file-uploader-wrapper-input",
317
- type: "file",
318
- onChange: onFileChange
319
- }, null, 40, _hoisted_4)
320
- ]),
321
- !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_5, [
322
- createElementVNode("span", _hoisted_6, toDisplayString(noFilesSelectedText.value), 1)
323
- ])) : createCommentVNode("", true),
324
- errorText.value ? (openBlock(), createElementBlock("div", _hoisted_7, [
325
- createElementVNode("span", _hoisted_8, toDisplayString(errorText.value), 1)
326
- ])) : createCommentVNode("", true),
327
- __props.showFileName && items.value.length ? (openBlock(), createElementBlock("div", _hoisted_9, [
328
- createVNode(_sfc_main$4, {
329
- list: items.value,
330
- limit: __props.maxLength,
331
- trigger: "hover",
332
- "popover-max-width": "400",
333
- separator: ""
334
- }, {
335
- "list-item": withCtx(({ item }) => [
336
- renderSlot(_ctx.$slots, "tag-item", {
337
- data: item,
338
- close: onTagClose
339
- }, () => [
340
- createVNode(_sfc_main$5, {
341
- label: item.name,
342
- "max-content": __props.tagMaxContentWidth,
343
- icon: __props.tagIcon,
344
- closable: "",
345
- onOnClose: ($event) => onTagClose(item.id)
346
- }, null, 8, ["label", "max-content", "icon", "onOnClose"])
347
- ], true)
348
- ]),
349
- reference: withCtx(({ listLength }) => [
350
- createVNode(_sfc_main$5, {
351
- label: `+ ${listLength}`
352
- }, null, 8, ["label"])
353
- ]),
354
- "other-content": withCtx(({ list }) => [
355
- (openBlock(true), createElementBlock(Fragment, null, renderList(list, (item, index) => {
356
- return openBlock(), createElementBlock("div", {
357
- key: index,
358
- class: "flex items-center justify-start p-2"
359
- }, [
360
- renderSlot(_ctx.$slots, "tag-item-other", {
361
- data: item,
362
- close: onTagClose
363
- }, () => [
364
- createVNode(_sfc_main$5, {
365
- label: item.name,
366
- icon: __props.tagIcon,
367
- "max-content": __props.tagMaxContentWidth,
368
- closable: "",
369
- onOnClose: ($event) => onTagClose(item.id)
370
- }, null, 8, ["label", "icon", "max-content", "onOnClose"])
371
- ], true)
372
- ]);
373
- }), 128))
374
- ]),
375
- _: 3
376
- }, 8, ["list", "limit"])
377
- ])) : createCommentVNode("", true)
378
- ], 4);
379
- };
380
- }
381
- });
1
+ import _sfc_main from "./VcFileUploader.vue.mjs";
382
2
  export {
383
3
  _sfc_main as default
384
4
  };