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

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 (116) hide show
  1. package/library/assets/assets/sass/main.css +1 -1
  2. package/library/assets/components/VcAvatar/VcAvatar.css +1 -0
  3. package/library/assets/components/VcBadgeTag/VcBadgeTag.css +1 -0
  4. package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -0
  5. package/library/assets/components/VcEmojiPicker/VcEmojiPicker.css +1 -0
  6. package/library/assets/components/VcFileUploader/VcFileItem.css +1 -0
  7. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -1
  8. package/library/assets/components/VcMessage/VcMessage.css +1 -0
  9. package/library/assets/components/VcMessage/content/VcMessageAudioBlock.css +1 -0
  10. package/library/assets/components/VcMessage/content/VcMessageFileBlock.css +1 -0
  11. package/library/assets/components/VcMessage/content/VcMessageImageBlock.css +1 -0
  12. package/library/assets/components/VcMessage/content/VcMessageTextBlock.css +1 -0
  13. package/library/assets/components/VcMessage/reactions/VcMessageEmojiPicker.css +1 -0
  14. package/library/assets/components/VcMessage/reactions/VcMessageReactionBar.css +1 -0
  15. package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -0
  16. package/library/components/VcAvatar/VcAvatar.vue.mjs +62 -0
  17. package/library/components/VcAvatar/VcAvatar.vue3.mjs +5 -0
  18. package/library/components/VcBadgeTag/VcBadgeTag.vue.mjs +31 -0
  19. package/library/components/VcBadgeTag/VcBadgeTag.vue3.mjs +5 -0
  20. package/library/components/VcChatComposer/VcChatComposer.vue.mjs +554 -0
  21. package/library/components/VcChatComposer/VcChatComposer.vue3.mjs +5 -0
  22. package/library/components/VcChatComposer/richText.mjs +320 -0
  23. package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +387 -0
  24. package/library/components/VcEmojiPicker/VcEmojiPicker.vue3.mjs +5 -0
  25. package/library/components/VcEmojiPicker/emojiData.mjs +26 -0
  26. package/library/components/VcFileUploader/VcFileItem.vue.mjs +146 -0
  27. package/library/components/VcFileUploader/VcFileItem.vue3.mjs +5 -0
  28. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +24 -147
  29. package/library/components/VcMessage/VcMessage.vue.mjs +212 -0
  30. package/library/components/VcMessage/VcMessage.vue3.mjs +5 -0
  31. package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +53 -0
  32. package/library/components/VcMessage/content/VcMessageAudioBlock.vue3.mjs +5 -0
  33. package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +80 -0
  34. package/library/components/VcMessage/content/VcMessageFileBlock.vue3.mjs +5 -0
  35. package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +57 -0
  36. package/library/components/VcMessage/content/VcMessageImageBlock.vue3.mjs +5 -0
  37. package/library/components/VcMessage/content/VcMessageTextBlock.vue.mjs +19 -0
  38. package/library/components/VcMessage/content/VcMessageTextBlock.vue3.mjs +5 -0
  39. package/library/components/VcMessage/content/messageContentComponents.mjs +17 -0
  40. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue.mjs +167 -0
  41. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue3.mjs +5 -0
  42. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +82 -0
  43. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue3.mjs +5 -0
  44. package/library/components/VcMessage/reactions/emojis.mjs +4 -0
  45. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +243 -0
  46. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue3.mjs +5 -0
  47. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.mjs +33 -25
  48. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.mjs +31 -0
  49. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue2.mjs +4 -0
  50. package/library/components/VcSoundplayer/useSoundPlayerProvideInject.mjs +1 -1
  51. package/library/composables/option/useOptionMethods.mjs +14 -0
  52. package/library/composables/useAudioRecorder.mjs +120 -0
  53. package/library/enum/fileTypes.mjs +51 -0
  54. package/library/index.mjs +237 -216
  55. package/library/index.mjs.br +0 -0
  56. package/library/index.mjs.gz +0 -0
  57. package/library/localization/locales/en.json.mjs +24 -1
  58. package/library/plugin-components.gen.mjs +171 -150
  59. package/library/plugin.mjs +235 -214
  60. package/library/plugin.mjs.br +0 -0
  61. package/library/plugin.mjs.gz +0 -0
  62. package/library/style.css +28 -2
  63. package/library/style.css.br +0 -0
  64. package/library/style.css.gz +0 -0
  65. package/library/types/components/VcAvatar/VcAvatar.vue.d.ts +47 -0
  66. package/library/types/components/VcBadgeTag/VcBadgeTag.vue.d.ts +42 -0
  67. package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +81 -0
  68. package/library/types/components/VcChatComposer/richText.d.ts +12 -0
  69. package/library/types/components/VcCollapse/VcCollapseItem.vue.d.ts +1 -1
  70. package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +63 -0
  71. package/library/types/components/VcEmojiPicker/emojiData.d.ts +16 -0
  72. package/library/types/components/VcExcelUploader/VcExcelFileUploadBlock.vue.d.ts +1 -1
  73. package/library/types/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +2 -2
  74. package/library/types/components/VcFileUploader/VcFileItem.vue.d.ts +85 -0
  75. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +3 -3
  76. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +17 -18
  77. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +3 -3
  78. package/library/types/components/VcForm/VcForm.vue.d.ts +1 -1
  79. package/library/types/components/VcMessage/VcMessage.vue.d.ts +66 -0
  80. package/library/types/components/VcMessage/content/VcMessageAudioBlock.vue.d.ts +24 -0
  81. package/library/types/components/VcMessage/content/VcMessageFileBlock.vue.d.ts +24 -0
  82. package/library/types/components/VcMessage/content/VcMessageImageBlock.vue.d.ts +28 -0
  83. package/library/types/components/VcMessage/content/VcMessageTextBlock.vue.d.ts +24 -0
  84. package/library/types/components/VcMessage/content/messageContentComponents.d.ts +3 -0
  85. package/library/types/components/VcMessage/reactions/VcMessageEmojiPicker.vue.d.ts +68 -0
  86. package/library/types/components/VcMessage/reactions/VcMessageReactionBar.vue.d.ts +28 -0
  87. package/library/types/components/VcMessage/reactions/emojis.d.ts +1 -0
  88. package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +71 -0
  89. package/library/types/components/VcProgress/VcProgress.vue.d.ts +1 -1
  90. package/library/types/components/VcRadioGroup/VcRadioGroup.vue.d.ts +3 -3
  91. package/library/types/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.d.ts +36 -0
  92. package/library/types/components/VcSelect/VcInfiniteScrollSelect.vue.d.ts +6 -6
  93. package/library/types/components/VcSelect/VcSelect.vue.d.ts +6 -6
  94. package/library/types/components/VcSelect/VcSelectGrouped.vue.d.ts +6 -6
  95. package/library/types/components/VcSelect/VcSelectOption.vue.d.ts +3 -3
  96. package/library/types/components/VcTree/VcTree.vue.d.ts +6 -6
  97. package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +3 -3
  98. package/library/types/components/VcWizard/VcSummaryStep.vue.d.ts +1 -1
  99. package/library/types/components/VcWizard/VcWizardSummary.vue.d.ts +1 -1
  100. package/library/types/components/exports.d.ts +15 -1
  101. package/library/types/components.gen.d.ts +7 -0
  102. package/library/types/composables/option/useOptionMethods.d.ts +9 -8
  103. package/library/types/composables/useAudioRecorder.d.ts +18 -0
  104. package/library/types/entity/components/Button/VcEntityDeleteIconButton.vue.d.ts +3 -3
  105. package/library/types/enum/fileTypes.d.ts +3 -0
  106. package/library/types/localization/locales/en.json.d.ts +24 -1
  107. package/library/types/types/OptionAndConfig.types.d.ts +4 -0
  108. package/library/types/types/VcAvatar.types.d.ts +35 -0
  109. package/library/types/types/VcBadgeTag.types.d.ts +19 -0
  110. package/library/types/types/VcChatComposer.types.d.ts +112 -0
  111. package/library/types/types/VcEmojiPicker.types.d.ts +20 -0
  112. package/library/types/types/VcFileUploader.types.d.ts +4 -0
  113. package/library/types/types/VcMessage.types.d.ts +131 -0
  114. package/library/types/types/VcMessagesWrapper.types.d.ts +61 -0
  115. package/library/types/types/index.d.ts +6 -0
  116. package/package.json +31 -1
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcEmojiPicker.vue.mjs";
2
+ import '../../assets/components/VcEmojiPicker/VcEmojiPicker.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,26 @@
1
+ const EXCLUDED_GROUP_KEYS = ["component"];
2
+ let groupsPromise;
3
+ function loadEmojiGroups() {
4
+ groupsPromise ?? (groupsPromise = Promise.all([
5
+ import("emojibase-data/en/data.json"),
6
+ import("emojibase-data/en/messages.json")
7
+ ]).then(([{ default: data }, { default: messages }]) => {
8
+ return [...messages.groups].sort((a, b) => a.order - b.order).filter((group) => !EXCLUDED_GROUP_KEYS.includes(group.key)).map((group) => ({
9
+ key: group.key,
10
+ label: group.message,
11
+ emojis: data.filter((emoji) => emoji.group === group.order).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map((emoji) => ({
12
+ emoji: emoji.emoji,
13
+ label: emoji.label,
14
+ tags: emoji.tags ?? [],
15
+ version: emoji.version
16
+ }))
17
+ }));
18
+ }).catch((error) => {
19
+ groupsPromise = void 0;
20
+ throw error;
21
+ }));
22
+ return groupsPromise;
23
+ }
24
+ export {
25
+ loadEmojiGroups
26
+ };
@@ -0,0 +1,146 @@
1
+ import '../../assets/components/VcFileUploader/VcFileItem.css';
2
+ import { defineComponent, computed, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode, toDisplayString, Fragment, createBlock, unref, createCommentVNode } from "vue";
3
+ import { RefreshCw, X } from "@lucide/vue";
4
+ import _sfc_main$1 from "../VcIcon/VcIcon.vue.mjs";
5
+ import '../../assets/components/VcButton/VcButtonIcon.css';import '../../assets/components/VcIcon/VcIcon.css';/* empty css */
6
+ import _sfc_main$2 from "../VcButton/VcButtonIcon.vue.mjs";
7
+ /* empty css */
8
+ import { DEFAULT_FILE_TYPE, DEFAULT_FILE_TYPE_MAP } from "../../enum/fileTypes.mjs";
9
+ import { getFileSize } from "../../utils/helpers.mjs";
10
+ import { tVU } from "../../localization/index.mjs";
11
+ const _hoisted_1 = ["src", "alt"];
12
+ const _hoisted_2 = { class: "vc-file-item__info" };
13
+ const _hoisted_3 = { class: "vc-file-item__name" };
14
+ const _hoisted_4 = {
15
+ key: 0,
16
+ class: "vc-file-item__meta vc-file-item__error"
17
+ };
18
+ const _hoisted_5 = { class: "vc-file-item__meta" };
19
+ const _hoisted_6 = ["aria-valuenow"];
20
+ const _hoisted_7 = {
21
+ key: 2,
22
+ class: "vc-file-item__meta"
23
+ };
24
+ const _sfc_main = /* @__PURE__ */ defineComponent({
25
+ __name: "VcFileItem",
26
+ props: {
27
+ file: {},
28
+ fileTypeMap: { default: void 0 },
29
+ removable: { type: Boolean, default: true },
30
+ disabled: { type: Boolean, default: false },
31
+ status: { default: void 0 },
32
+ progress: { default: 0 }
33
+ },
34
+ emits: ["remove", "retry"],
35
+ setup(__props, { emit: __emit }) {
36
+ const props = __props;
37
+ const emit = __emit;
38
+ const uploadFailedText = computed(() => tVU.t("voicenterUi.fileItem.uploadFailed"));
39
+ const retryText = computed(() => tVU.t("voicenterUi.fileItem.retry"));
40
+ const progressPercent = computed(() => Math.round(Math.min(Math.max(props.progress, 0), 100)));
41
+ const extension = computed(() => {
42
+ var _a;
43
+ const parts = props.file.name.split(".");
44
+ return parts.length > 1 ? ((_a = parts.pop()) == null ? void 0 : _a.toLowerCase()) ?? "" : "";
45
+ });
46
+ const fileType = computed(() => {
47
+ var _a, _b;
48
+ const fallback = ((_a = props.fileTypeMap) == null ? void 0 : _a.default) ?? DEFAULT_FILE_TYPE;
49
+ const base = DEFAULT_FILE_TYPE_MAP[extension.value] ?? fallback;
50
+ const override = (_b = props.fileTypeMap) == null ? void 0 : _b[extension.value];
51
+ return {
52
+ icon: (override == null ? void 0 : override.icon) ?? base.icon,
53
+ color: (override == null ? void 0 : override.color) ?? base.color
54
+ };
55
+ });
56
+ const iconStyle = computed(() => ({
57
+ color: fileType.value.color,
58
+ backgroundColor: `color-mix(in srgb, ${fileType.value.color} 15%, transparent)`
59
+ }));
60
+ const meta = computed(() => {
61
+ const [value, measure] = getFileSize(props.file.size);
62
+ const size = `${value}${measure}`;
63
+ return extension.value ? `${extension.value.toUpperCase()} · ${size}` : size;
64
+ });
65
+ const objectUrl = ref();
66
+ function revokeObjectUrl() {
67
+ if (objectUrl.value) {
68
+ URL.revokeObjectURL(objectUrl.value);
69
+ objectUrl.value = void 0;
70
+ }
71
+ }
72
+ watch(() => props.file.File, (source) => {
73
+ revokeObjectUrl();
74
+ if (source instanceof File && props.file.type.startsWith("image/")) {
75
+ objectUrl.value = URL.createObjectURL(source);
76
+ }
77
+ }, { immediate: true });
78
+ onBeforeUnmount(revokeObjectUrl);
79
+ const previewUrl = computed(() => {
80
+ if (!props.file.type.startsWith("image/")) {
81
+ return void 0;
82
+ }
83
+ return typeof props.file.File === "string" ? props.file.File : objectUrl.value;
84
+ });
85
+ return (_ctx, _cache) => {
86
+ return openBlock(), createElementBlock("div", {
87
+ class: normalizeClass([{ "is--disabled": __props.disabled, [`is--${__props.status}`]: __props.status }, "vc-file-item"])
88
+ }, [
89
+ previewUrl.value ? (openBlock(), createElementBlock("img", {
90
+ key: 0,
91
+ src: previewUrl.value,
92
+ alt: __props.file.name,
93
+ class: "vc-file-item__preview"
94
+ }, null, 8, _hoisted_1)) : (openBlock(), createElementBlock("div", {
95
+ key: 1,
96
+ class: "vc-file-item__icon",
97
+ style: normalizeStyle(iconStyle.value)
98
+ }, [
99
+ createVNode(_sfc_main$1, {
100
+ icon: fileType.value.icon,
101
+ size: 20
102
+ }, null, 8, ["icon"])
103
+ ], 4)),
104
+ createElementVNode("div", _hoisted_2, [
105
+ createElementVNode("span", _hoisted_3, toDisplayString(__props.file.name), 1),
106
+ __props.status === "error" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(uploadFailedText.value), 1)) : __props.status === "uploading" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
107
+ createElementVNode("span", _hoisted_5, toDisplayString(meta.value) + " · " + toDisplayString(progressPercent.value) + "%", 1),
108
+ createElementVNode("span", {
109
+ role: "progressbar",
110
+ "aria-valuenow": progressPercent.value,
111
+ "aria-valuemin": "0",
112
+ "aria-valuemax": "100",
113
+ class: "vc-file-item__progress"
114
+ }, [
115
+ createElementVNode("span", {
116
+ class: "vc-file-item__progress-value",
117
+ style: normalizeStyle({ width: `${progressPercent.value}%` })
118
+ }, null, 4)
119
+ ], 8, _hoisted_6)
120
+ ], 64)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(meta.value), 1))
121
+ ]),
122
+ __props.status === "error" ? (openBlock(), createBlock(_sfc_main$2, {
123
+ key: 2,
124
+ icon: unref(RefreshCw),
125
+ disabled: __props.disabled,
126
+ title: retryText.value,
127
+ "aria-label": retryText.value,
128
+ color: "primary-alternative",
129
+ class: "vc-file-item__retry",
130
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("retry"))
131
+ }, null, 8, ["icon", "disabled", "title", "aria-label"])) : createCommentVNode("", true),
132
+ __props.removable ? (openBlock(), createBlock(_sfc_main$2, {
133
+ key: 3,
134
+ icon: unref(X),
135
+ disabled: __props.disabled,
136
+ color: "destructive",
137
+ class: "vc-file-item__remove",
138
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("remove"))
139
+ }, null, 8, ["icon", "disabled"])) : createCommentVNode("", true)
140
+ ], 2);
141
+ };
142
+ }
143
+ });
144
+ export {
145
+ _sfc_main as default
146
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcFileItem.vue.mjs";
2
+ import '../../assets/components/VcFileUploader/VcFileItem.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -1,16 +1,16 @@
1
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";
2
+ import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle, unref, createBlock, createCommentVNode, createElementVNode, withModifiers, normalizeClass, renderSlot, createVNode, toDisplayString, createTextVNode, Fragment, renderList } from "vue";
3
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 */
4
+ import '../../assets/components/VcFileUploader/VcFileItem.css';import '../../assets/components/VcIcon/VcIcon.css';import '../../assets/components/VcForm/UiComponents/VcInputLabel.css';/* empty css */
5
5
  import _sfc_main$2 from "../VcIcon/VcIcon.vue.mjs";
6
6
  /* empty css */
7
- import _sfc_main$3 from "../VcButton/VcButtonIcon.vue.mjs";
8
- /* empty css */
7
+ import _sfc_main$3 from "./VcFileItem.vue.mjs";
8
+ /* empty css */
9
9
  import useInputBase from "../../composables/input/useInputBase.mjs";
10
10
  import useFileUploader from "../../composables/input/useFileUploader.mjs";
11
- import { convertToUnit, getFileSize } from "../../utils/helpers.mjs";
11
+ import { convertToUnit } from "../../utils/helpers.mjs";
12
12
  import { tVU } from "../../localization/index.mjs";
13
- import { UploadCloud, X, FileArchive, FileSpreadsheet, FileText } from "@lucide/vue";
13
+ import { UploadCloud } from "@lucide/vue";
14
14
  const _hoisted_1 = ["data-test"];
15
15
  const _hoisted_2 = { class: "vc-file-uploader-area__text" };
16
16
  const _hoisted_3 = { class: "vc-file-uploader-area__link" };
@@ -24,10 +24,10 @@ const _hoisted_6 = {
24
24
  class: "vc-input__error-wrapper"
25
25
  };
26
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" };
27
+ const _hoisted_8 = {
28
+ key: 0,
29
+ class: "vc-file-uploader-area__item"
30
+ };
31
31
  const DEFAULT_BUTTON_COLOR = "primary";
32
32
  const _sfc_main = /* @__PURE__ */ defineComponent({
33
33
  __name: "VcFileUploaderArea",
@@ -77,52 +77,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
77
77
  },
78
78
  emits: ["update:modelValue", "input"],
79
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
80
  const props = __props;
127
81
  const emit = __emit;
128
82
  const { maxWidthStyle } = useInputBase(props, {
@@ -163,63 +117,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
163
117
  isDragOver.value = false;
164
118
  await selectFiles(((_a = event.dataTransfer) == null ? void 0 : _a.files) ?? null);
165
119
  }
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
120
  __expose({
224
121
  clear: onClear,
225
122
  click: triggerInputClick,
@@ -292,41 +189,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
292
189
  style: normalizeStyle(listStyle.value)
293
190
  }, [
294
191
  (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"
192
+ return openBlock(), createElementBlock(Fragment, {
193
+ key: item.id
298
194
  }, [
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
- ]);
195
+ _ctx.$slots.item ? (openBlock(), createElementBlock("div", _hoisted_8, [
196
+ renderSlot(_ctx.$slots, "item", {
197
+ data: item,
198
+ close: unref(onTagClose)
199
+ })
200
+ ])) : (openBlock(), createBlock(_sfc_main$3, {
201
+ key: 1,
202
+ file: item,
203
+ "file-type-map": __props.fileTypeMap,
204
+ onRemove: ($event) => unref(onTagClose)(item.id)
205
+ }, null, 8, ["file", "file-type-map", "onRemove"]))
206
+ ], 64);
330
207
  }), 128))
331
208
  ], 4)) : createCommentVNode("", true)
332
209
  ], 4);
@@ -0,0 +1,212 @@
1
+ import '../../assets/components/VcMessage/VcMessage.css';
2
+ import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, unref, Fragment, renderList, withCtx, createVNode } from "vue";
3
+ import { Ellipsis } from "@lucide/vue";
4
+ import _sfc_main$3 from "../VcButton/VcButtonIcon.vue.mjs";
5
+ import '../../assets/components/VcMessage/reactions/VcMessageReactionBar.css';import '../../assets/components/VcMessage/reactions/VcMessageEmojiPicker.css';import '../../assets/components/VcIcon/VcIcon.css';import '../../assets/components/VcDropdown/VcDropdown.css';import '../../assets/components/VcButton/VcButtonIcon.css';/* empty css */
6
+ import _sfc_main$4 from "../VcDropdown/VcDropdown.vue.mjs";
7
+ /* empty css */
8
+ import _sfc_main$5 from "../VcIcon/VcIcon.vue.mjs";
9
+ /* empty css */
10
+ import { messageContentComponents } from "./content/messageContentComponents.mjs";
11
+ import _sfc_main$2 from "./reactions/VcMessageEmojiPicker.vue.mjs";
12
+ /* empty css */
13
+ import _sfc_main$1 from "./reactions/VcMessageReactionBar.vue.mjs";
14
+ /* empty css */
15
+ import { DEFAULT_REACTION_EMOJIS } from "./reactions/emojis.mjs";
16
+ import { tVU } from "../../localization/index.mjs";
17
+ const _hoisted_1 = {
18
+ key: 0,
19
+ class: "vc-message__deleted"
20
+ };
21
+ const _hoisted_2 = { class: "vc-message__reply-author" };
22
+ const _hoisted_3 = {
23
+ key: 2,
24
+ class: "vc-message__content"
25
+ };
26
+ const _hoisted_4 = {
27
+ key: 0,
28
+ class: "vc-message__edited"
29
+ };
30
+ const _hoisted_5 = {
31
+ key: 3,
32
+ class: "vc-message__edited"
33
+ };
34
+ const _hoisted_6 = {
35
+ key: 5,
36
+ class: "vc-message__toolbar"
37
+ };
38
+ const _hoisted_7 = { class: "vc-dropdown-item__content-inner vc-message__menu-item" };
39
+ const _hoisted_8 = {
40
+ key: 1,
41
+ class: "vc-message__menu-shortcut"
42
+ };
43
+ const _sfc_main = /* @__PURE__ */ defineComponent({
44
+ __name: "VcMessage",
45
+ props: {
46
+ content: { default: void 0 },
47
+ align: { default: "start" },
48
+ reply: { default: void 0 },
49
+ options: { default: () => [] },
50
+ additionalOptions: { default: () => [] },
51
+ reactions: { default: () => [] },
52
+ reactionEmojis: { default: () => DEFAULT_REACTION_EMOJIS },
53
+ edited: { type: Boolean, default: false },
54
+ deleted: { type: Boolean, default: false },
55
+ editedLabel: { default: void 0 },
56
+ deletedLabel: { default: void 0 }
57
+ },
58
+ emits: ["option-click", "reply-click", "content-click", "reaction-toggle"],
59
+ setup(__props, { emit: __emit }) {
60
+ const props = __props;
61
+ const emit = __emit;
62
+ const isMenuOpen = ref(false);
63
+ const isPickerOpen = ref(false);
64
+ const isMedia = computed(() => {
65
+ var _a;
66
+ return !props.deleted && ((_a = props.content) == null ? void 0 : _a.type) === "image";
67
+ });
68
+ const moreOptionsLabel = computed(() => tVU.t("voicenterUi.message.moreOptions"));
69
+ const editedText = computed(() => props.editedLabel || tVU.t("voicenterUi.message.edited"));
70
+ const deletedText = computed(() => props.deletedLabel || tVU.t("voicenterUi.message.deleted"));
71
+ const additionalOptionsFlat = computed(() => props.additionalOptions.flat());
72
+ const hasAdditionalOptions = computed(() => additionalOptionsFlat.value.length > 0);
73
+ const hasToolbar = computed(() => props.options.length > 0 || hasAdditionalOptions.value);
74
+ const dropdownOptions = computed(() => {
75
+ return props.additionalOptions.filter((group) => group.length > 0).flatMap((group, groupIndex) => group.map((option, index) => ({
76
+ value: option.event,
77
+ label: option.label,
78
+ icon: option.icon,
79
+ color: option.color,
80
+ disabled: option.disabled,
81
+ divided: groupIndex > 0 && index === 0,
82
+ iconClass: option.color ? `text-${option.color}-actions` : void 0,
83
+ labelClass: option.color ? `text-${option.color}-actions` : void 0
84
+ })));
85
+ });
86
+ function findAdditionalOption(event) {
87
+ return additionalOptionsFlat.value.find((option) => option.event === event);
88
+ }
89
+ function getShortcut(event) {
90
+ var _a;
91
+ return (_a = findAdditionalOption(event)) == null ? void 0 : _a.shortcut;
92
+ }
93
+ function onOptionClick(option) {
94
+ emit("option-click", option.event, option);
95
+ }
96
+ function onCommand(event) {
97
+ const option = findAdditionalOption(event);
98
+ if (option) {
99
+ onOptionClick(option);
100
+ }
101
+ }
102
+ return (_ctx, _cache) => {
103
+ return openBlock(), createElementBlock("div", {
104
+ class: normalizeClass([[`vc-message--align-${__props.align}`, { "is--menu-open": isMenuOpen.value || isPickerOpen.value, "is--deleted": __props.deleted, "is--media": isMedia.value }], "vc-message"])
105
+ }, [
106
+ __props.deleted ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(deletedText.value), 1)) : createCommentVNode("", true),
107
+ __props.reply && !__props.deleted ? (openBlock(), createElementBlock("button", {
108
+ key: 1,
109
+ type: "button",
110
+ class: "vc-message__reply",
111
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("reply-click"))
112
+ }, [
113
+ createElementVNode("span", _hoisted_2, toDisplayString(__props.reply.author), 1),
114
+ (openBlock(), createBlock(resolveDynamicComponent(unref(messageContentComponents)[__props.reply.content.type]), {
115
+ content: __props.reply.content,
116
+ preview: "",
117
+ class: "vc-message__reply-content"
118
+ }, null, 8, ["content"]))
119
+ ])) : createCommentVNode("", true),
120
+ __props.content && !__props.deleted ? (openBlock(), createElementBlock("div", _hoisted_3, [
121
+ (openBlock(), createBlock(resolveDynamicComponent(unref(messageContentComponents)[__props.content.type]), {
122
+ content: __props.content,
123
+ onContentClick: _cache[1] || (_cache[1] = ($event) => emit("content-click", __props.content))
124
+ }, null, 40, ["content"])),
125
+ __props.edited && isMedia.value ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(editedText.value), 1)) : createCommentVNode("", true)
126
+ ])) : createCommentVNode("", true),
127
+ __props.edited && !__props.deleted && !isMedia.value ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(editedText.value), 1)) : createCommentVNode("", true),
128
+ __props.reactions.length && !__props.deleted ? (openBlock(), createBlock(_sfc_main$1, {
129
+ key: 4,
130
+ reactions: __props.reactions,
131
+ emojis: __props.reactionEmojis,
132
+ class: "vc-message__reactions",
133
+ onToggle: _cache[2] || (_cache[2] = ($event) => emit("reaction-toggle", $event))
134
+ }, null, 8, ["reactions", "emojis"])) : createCommentVNode("", true),
135
+ hasToolbar.value && !__props.deleted ? (openBlock(), createElementBlock("div", _hoisted_6, [
136
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
137
+ return openBlock(), createElementBlock(Fragment, {
138
+ key: option.event
139
+ }, [
140
+ option.emojiPicker ? (openBlock(), createBlock(_sfc_main$2, {
141
+ key: 0,
142
+ emojis: __props.reactionEmojis,
143
+ disabled: option.disabled,
144
+ onSelect: _cache[3] || (_cache[3] = ($event) => emit("reaction-toggle", $event)),
145
+ onOpen: _cache[4] || (_cache[4] = ($event) => isPickerOpen.value = true),
146
+ onClose: _cache[5] || (_cache[5] = ($event) => isPickerOpen.value = false)
147
+ }, {
148
+ trigger: withCtx(({ isOpen }) => [
149
+ createVNode(_sfc_main$3, {
150
+ icon: option.icon,
151
+ color: option.color || "secondary",
152
+ disabled: option.disabled,
153
+ title: option.label,
154
+ "aria-label": option.label,
155
+ "aria-expanded": isOpen,
156
+ "aria-haspopup": "true"
157
+ }, null, 8, ["icon", "color", "disabled", "title", "aria-label", "aria-expanded"])
158
+ ]),
159
+ _: 2
160
+ }, 1032, ["emojis", "disabled"])) : (openBlock(), createBlock(_sfc_main$3, {
161
+ key: 1,
162
+ icon: option.icon,
163
+ color: option.color || "secondary",
164
+ disabled: option.disabled,
165
+ title: option.label,
166
+ "aria-label": option.label,
167
+ onClick: ($event) => onOptionClick(option)
168
+ }, null, 8, ["icon", "color", "disabled", "title", "aria-label", "onClick"]))
169
+ ], 64);
170
+ }), 128)),
171
+ hasAdditionalOptions.value ? (openBlock(), createBlock(_sfc_main$4, {
172
+ key: 0,
173
+ options: dropdownOptions.value,
174
+ placement: __props.align === "end" ? "bottom-end" : "bottom-start",
175
+ "show-arrow": false,
176
+ persistent: false,
177
+ trigger: "click",
178
+ "popper-class": "vc-message__menu",
179
+ onCommand,
180
+ onVisibleChange: _cache[6] || (_cache[6] = ($event) => isMenuOpen.value = $event)
181
+ }, {
182
+ "dropdown-item": withCtx(({ item }) => [
183
+ createElementVNode("div", _hoisted_7, [
184
+ item.icon ? (openBlock(), createBlock(_sfc_main$5, {
185
+ key: 0,
186
+ icon: item.icon,
187
+ class: normalizeClass(item.iconClass)
188
+ }, null, 8, ["icon", "class"])) : createCommentVNode("", true),
189
+ createElementVNode("span", {
190
+ class: normalizeClass([item.labelClass, "vc-message__menu-label"])
191
+ }, toDisplayString(item.label), 3),
192
+ getShortcut(item.value) ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(getShortcut(item.value)), 1)) : createCommentVNode("", true)
193
+ ])
194
+ ]),
195
+ default: withCtx(() => [
196
+ createVNode(_sfc_main$3, {
197
+ icon: unref(Ellipsis),
198
+ title: moreOptionsLabel.value,
199
+ "aria-label": moreOptionsLabel.value,
200
+ color: "secondary"
201
+ }, null, 8, ["icon", "title", "aria-label"])
202
+ ]),
203
+ _: 1
204
+ }, 8, ["options", "placement"])) : createCommentVNode("", true)
205
+ ])) : createCommentVNode("", true)
206
+ ], 2);
207
+ };
208
+ }
209
+ });
210
+ export {
211
+ _sfc_main as default
212
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcMessage.vue.mjs";
2
+ import '../../assets/components/VcMessage/VcMessage.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,53 @@
1
+ import '../../../assets/components/VcMessage/content/VcMessageAudioBlock.css';
2
+ import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString, createCommentVNode, createBlock } from "vue";
3
+ import { Mic } from "@lucide/vue";
4
+ import _sfc_main$1 from "../../VcIcon/VcIcon.vue.mjs";
5
+ import '../../../assets/components/VcSoundplayer/VcSoundPlayer.css';import '../../../assets/components/VcIcon/VcIcon.css';/* empty css */
6
+ import _sfc_main$2 from "../../VcSoundplayer/VcSoundPlayer.vue.mjs";
7
+ /* empty css */
8
+ import { tVU } from "../../../localization/index.mjs";
9
+ const _hoisted_1 = {
10
+ key: 0,
11
+ class: "vc-message-audio-block is--preview"
12
+ };
13
+ const _hoisted_2 = {
14
+ key: 0,
15
+ class: "vc-message-audio-block__duration"
16
+ };
17
+ const _sfc_main = /* @__PURE__ */ defineComponent({
18
+ __name: "VcMessageAudioBlock",
19
+ props: {
20
+ content: {},
21
+ preview: { type: Boolean }
22
+ },
23
+ setup(__props) {
24
+ const props = __props;
25
+ const label = computed(() => tVU.t("voicenterUi.message.audio"));
26
+ const duration = computed(() => {
27
+ const seconds = props.content.duration;
28
+ if (!seconds) {
29
+ return "";
30
+ }
31
+ const rounded = Math.round(seconds);
32
+ return `${Math.floor(rounded / 60)}:${String(rounded % 60).padStart(2, "0")}`;
33
+ });
34
+ return (_ctx, _cache) => {
35
+ return __props.preview ? (openBlock(), createElementBlock("div", _hoisted_1, [
36
+ createVNode(_sfc_main$1, {
37
+ icon: unref(Mic),
38
+ class: "vc-message-audio-block__icon"
39
+ }, null, 8, ["icon"]),
40
+ createElementVNode("span", null, toDisplayString(label.value), 1),
41
+ duration.value ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(duration.value), 1)) : createCommentVNode("", true)
42
+ ])) : (openBlock(), createBlock(_sfc_main$2, {
43
+ key: 1,
44
+ src: __props.content.url,
45
+ size: "sm",
46
+ class: "vc-message-audio-block"
47
+ }, null, 8, ["src"]));
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ _sfc_main as default
53
+ };