@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.
- package/library/assets/assets/sass/main.css +1 -1
- package/library/assets/components/VcAvatar/VcAvatar.css +1 -0
- package/library/assets/components/VcBadgeTag/VcBadgeTag.css +1 -0
- package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -0
- package/library/assets/components/VcEmojiPicker/VcEmojiPicker.css +1 -0
- package/library/assets/components/VcFileUploader/VcFileItem.css +1 -0
- package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -1
- package/library/assets/components/VcMessage/VcMessage.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageAudioBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageFileBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageImageBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageTextBlock.css +1 -0
- package/library/assets/components/VcMessage/reactions/VcMessageEmojiPicker.css +1 -0
- package/library/assets/components/VcMessage/reactions/VcMessageReactionBar.css +1 -0
- package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -0
- package/library/components/VcAvatar/VcAvatar.vue.mjs +62 -0
- package/library/components/VcAvatar/VcAvatar.vue3.mjs +5 -0
- package/library/components/VcBadgeTag/VcBadgeTag.vue.mjs +31 -0
- package/library/components/VcBadgeTag/VcBadgeTag.vue3.mjs +5 -0
- package/library/components/VcChatComposer/VcChatComposer.vue.mjs +554 -0
- package/library/components/VcChatComposer/VcChatComposer.vue3.mjs +5 -0
- package/library/components/VcChatComposer/richText.mjs +320 -0
- package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +387 -0
- package/library/components/VcEmojiPicker/VcEmojiPicker.vue3.mjs +5 -0
- package/library/components/VcEmojiPicker/emojiData.mjs +26 -0
- package/library/components/VcFileUploader/VcFileItem.vue.mjs +146 -0
- package/library/components/VcFileUploader/VcFileItem.vue3.mjs +5 -0
- package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +24 -147
- package/library/components/VcMessage/VcMessage.vue.mjs +212 -0
- package/library/components/VcMessage/VcMessage.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +53 -0
- package/library/components/VcMessage/content/VcMessageAudioBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +80 -0
- package/library/components/VcMessage/content/VcMessageFileBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +57 -0
- package/library/components/VcMessage/content/VcMessageImageBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageTextBlock.vue.mjs +19 -0
- package/library/components/VcMessage/content/VcMessageTextBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/messageContentComponents.mjs +17 -0
- package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue.mjs +167 -0
- package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue3.mjs +5 -0
- package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +82 -0
- package/library/components/VcMessage/reactions/VcMessageReactionBar.vue3.mjs +5 -0
- package/library/components/VcMessage/reactions/emojis.mjs +4 -0
- package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +243 -0
- package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue3.mjs +5 -0
- package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.mjs +33 -25
- package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.mjs +31 -0
- package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue2.mjs +4 -0
- package/library/components/VcSoundplayer/useSoundPlayerProvideInject.mjs +1 -1
- package/library/composables/option/useOptionMethods.mjs +14 -0
- package/library/composables/useAudioRecorder.mjs +120 -0
- package/library/enum/fileTypes.mjs +51 -0
- package/library/index.mjs +237 -216
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/localization/locales/en.json.mjs +24 -1
- package/library/plugin-components.gen.mjs +171 -150
- package/library/plugin.mjs +235 -214
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +28 -2
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/types/components/VcAvatar/VcAvatar.vue.d.ts +47 -0
- package/library/types/components/VcBadgeTag/VcBadgeTag.vue.d.ts +42 -0
- package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +81 -0
- package/library/types/components/VcChatComposer/richText.d.ts +12 -0
- package/library/types/components/VcCollapse/VcCollapseItem.vue.d.ts +1 -1
- package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +63 -0
- package/library/types/components/VcEmojiPicker/emojiData.d.ts +16 -0
- package/library/types/components/VcExcelUploader/VcExcelFileUploadBlock.vue.d.ts +1 -1
- package/library/types/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +2 -2
- package/library/types/components/VcFileUploader/VcFileItem.vue.d.ts +85 -0
- package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +3 -3
- package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +17 -18
- package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +3 -3
- package/library/types/components/VcForm/VcForm.vue.d.ts +1 -1
- package/library/types/components/VcMessage/VcMessage.vue.d.ts +66 -0
- package/library/types/components/VcMessage/content/VcMessageAudioBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/VcMessageFileBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/VcMessageImageBlock.vue.d.ts +28 -0
- package/library/types/components/VcMessage/content/VcMessageTextBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/messageContentComponents.d.ts +3 -0
- package/library/types/components/VcMessage/reactions/VcMessageEmojiPicker.vue.d.ts +68 -0
- package/library/types/components/VcMessage/reactions/VcMessageReactionBar.vue.d.ts +28 -0
- package/library/types/components/VcMessage/reactions/emojis.d.ts +1 -0
- package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +71 -0
- package/library/types/components/VcProgress/VcProgress.vue.d.ts +1 -1
- package/library/types/components/VcRadioGroup/VcRadioGroup.vue.d.ts +3 -3
- package/library/types/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.d.ts +36 -0
- package/library/types/components/VcSelect/VcInfiniteScrollSelect.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelect.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelectGrouped.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelectOption.vue.d.ts +3 -3
- package/library/types/components/VcTree/VcTree.vue.d.ts +6 -6
- package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +3 -3
- package/library/types/components/VcWizard/VcSummaryStep.vue.d.ts +1 -1
- package/library/types/components/VcWizard/VcWizardSummary.vue.d.ts +1 -1
- package/library/types/components/exports.d.ts +15 -1
- package/library/types/components.gen.d.ts +7 -0
- package/library/types/composables/option/useOptionMethods.d.ts +9 -8
- package/library/types/composables/useAudioRecorder.d.ts +18 -0
- package/library/types/entity/components/Button/VcEntityDeleteIconButton.vue.d.ts +3 -3
- package/library/types/enum/fileTypes.d.ts +3 -0
- package/library/types/localization/locales/en.json.d.ts +24 -1
- package/library/types/types/OptionAndConfig.types.d.ts +4 -0
- package/library/types/types/VcAvatar.types.d.ts +35 -0
- package/library/types/types/VcBadgeTag.types.d.ts +19 -0
- package/library/types/types/VcChatComposer.types.d.ts +112 -0
- package/library/types/types/VcEmojiPicker.types.d.ts +20 -0
- package/library/types/types/VcFileUploader.types.d.ts +4 -0
- package/library/types/types/VcMessage.types.d.ts +131 -0
- package/library/types/types/VcMessagesWrapper.types.d.ts +61 -0
- package/library/types/types/index.d.ts +6 -0
- package/package.json +31 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import '../../../assets/components/VcMessage/content/VcMessageFileBlock.css';
|
|
2
|
+
import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString, createCommentVNode } from "vue";
|
|
3
|
+
import { FileText, Download } from "@lucide/vue";
|
|
4
|
+
import _sfc_main$1 from "../../VcIcon/VcIcon.vue.mjs";
|
|
5
|
+
import '../../../assets/components/VcIcon/VcIcon.css';/* empty css */
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "vc-message-file-block is--preview"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_2 = { class: "vc-message-file-block__name" };
|
|
11
|
+
const _hoisted_3 = ["href", "download"];
|
|
12
|
+
const _hoisted_4 = { class: "vc-message-file-block__icon" };
|
|
13
|
+
const _hoisted_5 = { class: "vc-message-file-block__info" };
|
|
14
|
+
const _hoisted_6 = { class: "vc-message-file-block__name" };
|
|
15
|
+
const _hoisted_7 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "vc-message-file-block__meta"
|
|
18
|
+
};
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "VcMessageFileBlock",
|
|
21
|
+
props: {
|
|
22
|
+
content: {},
|
|
23
|
+
preview: { type: Boolean }
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const SIZE_UNITS = ["B", "KB", "MB", "GB"];
|
|
28
|
+
const extension = computed(() => {
|
|
29
|
+
if (props.content.extension) {
|
|
30
|
+
return props.content.extension;
|
|
31
|
+
}
|
|
32
|
+
const dotIndex = props.content.name.lastIndexOf(".");
|
|
33
|
+
return dotIndex > 0 ? props.content.name.slice(dotIndex + 1) : "";
|
|
34
|
+
});
|
|
35
|
+
const size = computed(() => {
|
|
36
|
+
let value = props.content.size;
|
|
37
|
+
if (!value) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
let unitIndex = 0;
|
|
41
|
+
while (value >= 1024 && unitIndex < SIZE_UNITS.length - 1) {
|
|
42
|
+
value /= 1024;
|
|
43
|
+
unitIndex++;
|
|
44
|
+
}
|
|
45
|
+
return `${unitIndex ? value.toFixed(1) : value} ${SIZE_UNITS[unitIndex]}`;
|
|
46
|
+
});
|
|
47
|
+
const meta = computed(() => [extension.value.toUpperCase(), size.value].filter(Boolean).join(" · "));
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return __props.preview ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
50
|
+
createVNode(_sfc_main$1, {
|
|
51
|
+
icon: unref(FileText),
|
|
52
|
+
class: "vc-message-file-block__preview-icon"
|
|
53
|
+
}, null, 8, ["icon"]),
|
|
54
|
+
createElementVNode("span", _hoisted_2, toDisplayString(__props.content.name), 1)
|
|
55
|
+
])) : (openBlock(), createElementBlock("a", {
|
|
56
|
+
key: 1,
|
|
57
|
+
href: __props.content.url,
|
|
58
|
+
download: __props.content.name,
|
|
59
|
+
target: "_blank",
|
|
60
|
+
rel: "noopener noreferrer",
|
|
61
|
+
class: "vc-message-file-block"
|
|
62
|
+
}, [
|
|
63
|
+
createElementVNode("span", _hoisted_4, [
|
|
64
|
+
createVNode(_sfc_main$1, { icon: unref(FileText) }, null, 8, ["icon"])
|
|
65
|
+
]),
|
|
66
|
+
createElementVNode("span", _hoisted_5, [
|
|
67
|
+
createElementVNode("span", _hoisted_6, toDisplayString(__props.content.name), 1),
|
|
68
|
+
meta.value ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(meta.value), 1)) : createCommentVNode("", true)
|
|
69
|
+
]),
|
|
70
|
+
createVNode(_sfc_main$1, {
|
|
71
|
+
icon: unref(Download),
|
|
72
|
+
class: "vc-message-file-block__download"
|
|
73
|
+
}, null, 8, ["icon"])
|
|
74
|
+
], 8, _hoisted_3));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export {
|
|
79
|
+
_sfc_main as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import '../../../assets/components/VcMessage/content/VcMessageImageBlock.css';
|
|
2
|
+
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, normalizeStyle } from "vue";
|
|
3
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "vc-message-image-block is--preview"
|
|
7
|
+
};
|
|
8
|
+
const _hoisted_2 = ["src", "alt"];
|
|
9
|
+
const _hoisted_3 = ["src", "alt", "width", "height"];
|
|
10
|
+
const MAX_WIDTH = "20rem";
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "VcMessageImageBlock",
|
|
13
|
+
props: {
|
|
14
|
+
content: {},
|
|
15
|
+
preview: { type: Boolean }
|
|
16
|
+
},
|
|
17
|
+
emits: ["content-click"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const emit = __emit;
|
|
21
|
+
const label = computed(() => props.content.alt || tVU.t("voicenterUi.message.image"));
|
|
22
|
+
const sizeStyle = computed(() => {
|
|
23
|
+
const { width, height } = props.content;
|
|
24
|
+
return {
|
|
25
|
+
width: width ? `min(${width}px, ${MAX_WIDTH})` : MAX_WIDTH,
|
|
26
|
+
aspectRatio: width && height ? `${width} / ${height}` : void 0
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return __props.preview ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
31
|
+
createElementVNode("img", {
|
|
32
|
+
src: __props.content.url,
|
|
33
|
+
alt: __props.content.alt,
|
|
34
|
+
class: "vc-message-image-block__thumbnail"
|
|
35
|
+
}, null, 8, _hoisted_2),
|
|
36
|
+
createElementVNode("span", null, toDisplayString(label.value), 1)
|
|
37
|
+
])) : (openBlock(), createElementBlock("button", {
|
|
38
|
+
key: 1,
|
|
39
|
+
type: "button",
|
|
40
|
+
class: "vc-message-image-block",
|
|
41
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("content-click", __props.content))
|
|
42
|
+
}, [
|
|
43
|
+
createElementVNode("img", {
|
|
44
|
+
src: __props.content.url,
|
|
45
|
+
alt: __props.content.alt,
|
|
46
|
+
width: __props.content.width,
|
|
47
|
+
height: __props.content.height,
|
|
48
|
+
style: normalizeStyle(sizeStyle.value),
|
|
49
|
+
class: "vc-message-image-block__image"
|
|
50
|
+
}, null, 12, _hoisted_3)
|
|
51
|
+
]));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
_sfc_main as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '../../../assets/components/VcMessage/content/VcMessageTextBlock.css';
|
|
2
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, toDisplayString } from "vue";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "VcMessageTextBlock",
|
|
5
|
+
props: {
|
|
6
|
+
content: {},
|
|
7
|
+
preview: { type: Boolean }
|
|
8
|
+
},
|
|
9
|
+
setup(__props) {
|
|
10
|
+
return (_ctx, _cache) => {
|
|
11
|
+
return openBlock(), createElementBlock("div", {
|
|
12
|
+
class: normalizeClass([{ "is--preview": __props.preview }, "vc-message-text-block"])
|
|
13
|
+
}, toDisplayString(__props.content.text), 3);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
_sfc_main as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _sfc_main$3 from "./VcMessageTextBlock.vue.mjs";
|
|
2
|
+
import '../../../assets/components/VcMessage/content/VcMessageFileBlock.css';import '../../../assets/components/VcMessage/content/VcMessageAudioBlock.css';import '../../../assets/components/VcMessage/content/VcMessageImageBlock.css';import '../../../assets/components/VcMessage/content/VcMessageTextBlock.css';/* empty css */
|
|
3
|
+
import _sfc_main$2 from "./VcMessageImageBlock.vue.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import _sfc_main$1 from "./VcMessageAudioBlock.vue.mjs";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import _sfc_main from "./VcMessageFileBlock.vue.mjs";
|
|
8
|
+
/* empty css */
|
|
9
|
+
const messageContentComponents = {
|
|
10
|
+
text: _sfc_main$3,
|
|
11
|
+
image: _sfc_main$2,
|
|
12
|
+
audio: _sfc_main$1,
|
|
13
|
+
file: _sfc_main
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
messageContentComponents
|
|
17
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import '../../../assets/components/VcMessage/reactions/VcMessageEmojiPicker.css';
|
|
2
|
+
import { defineComponent, ref, computed, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString, renderSlot, withKeys, createVNode, unref, nextTick } from "vue";
|
|
3
|
+
import { onClickOutside } from "@vueuse/core";
|
|
4
|
+
import { Smile } from "@lucide/vue";
|
|
5
|
+
import _sfc_main$1 from "../../VcPopover/VcPopover.vue.mjs";
|
|
6
|
+
import '../../../assets/components/VcButton/VcButtonIcon.css';import '../../../assets/components/VcPopover/VcPopover.css';/* empty css */
|
|
7
|
+
import _sfc_main$2 from "../../VcButton/VcButtonIcon.vue.mjs";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { useRTL } from "../../../composables/useRTL.mjs";
|
|
10
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
11
|
+
import { DEFAULT_REACTION_EMOJIS } from "./emojis.mjs";
|
|
12
|
+
const _hoisted_1 = ["tabindex", "onClick", "onFocus"];
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "VcMessageEmojiPicker",
|
|
15
|
+
props: {
|
|
16
|
+
emojis: { default: () => DEFAULT_REACTION_EMOJIS },
|
|
17
|
+
placement: { default: "top" },
|
|
18
|
+
disabled: { type: Boolean, default: false },
|
|
19
|
+
teleported: { type: Boolean, default: true }
|
|
20
|
+
},
|
|
21
|
+
emits: ["select", "open", "close"],
|
|
22
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const emit = __emit;
|
|
25
|
+
const { isRTL } = useRTL();
|
|
26
|
+
const isOpen = ref(false);
|
|
27
|
+
const activeIndex = ref(0);
|
|
28
|
+
const triggerRef = ref();
|
|
29
|
+
const panelRef = ref();
|
|
30
|
+
const itemRefs = [];
|
|
31
|
+
const triggerLabel = computed(() => tVU.t("voicenterUi.message.react"));
|
|
32
|
+
const RTL_PLACEMENTS = {
|
|
33
|
+
"top-start": "top-end",
|
|
34
|
+
"top-end": "top-start",
|
|
35
|
+
"bottom-start": "bottom-end",
|
|
36
|
+
"bottom-end": "bottom-start"
|
|
37
|
+
};
|
|
38
|
+
const resolvedPlacement = computed(() => {
|
|
39
|
+
return isRTL.value ? RTL_PLACEMENTS[props.placement] ?? props.placement : props.placement;
|
|
40
|
+
});
|
|
41
|
+
function setItemRef(element, index) {
|
|
42
|
+
itemRefs[index] = element instanceof HTMLButtonElement ? element : void 0;
|
|
43
|
+
}
|
|
44
|
+
function focusItem(index) {
|
|
45
|
+
var _a;
|
|
46
|
+
(_a = itemRefs[index]) == null ? void 0 : _a.focus();
|
|
47
|
+
}
|
|
48
|
+
function open() {
|
|
49
|
+
if (props.disabled || isOpen.value) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
activeIndex.value = 0;
|
|
53
|
+
isOpen.value = true;
|
|
54
|
+
emit("open");
|
|
55
|
+
nextTick(() => focusItem(activeIndex.value));
|
|
56
|
+
}
|
|
57
|
+
function close(returnFocus = false) {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
if (!isOpen.value) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
isOpen.value = false;
|
|
63
|
+
emit("close");
|
|
64
|
+
if (returnFocus) {
|
|
65
|
+
(_b = (_a = triggerRef.value) == null ? void 0 : _a.querySelector("button, [tabindex]")) == null ? void 0 : _b.focus();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function toggle() {
|
|
69
|
+
if (isOpen.value) {
|
|
70
|
+
close();
|
|
71
|
+
} else {
|
|
72
|
+
open();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function select(emoji) {
|
|
76
|
+
emit("select", emoji);
|
|
77
|
+
close(true);
|
|
78
|
+
}
|
|
79
|
+
function onKeydown(event) {
|
|
80
|
+
const last = props.emojis.length - 1;
|
|
81
|
+
const forward = isRTL.value ? "ArrowLeft" : "ArrowRight";
|
|
82
|
+
const backward = isRTL.value ? "ArrowRight" : "ArrowLeft";
|
|
83
|
+
const nextIndex = {
|
|
84
|
+
[forward]: activeIndex.value >= last ? 0 : activeIndex.value + 1,
|
|
85
|
+
[backward]: activeIndex.value <= 0 ? last : activeIndex.value - 1,
|
|
86
|
+
Home: 0,
|
|
87
|
+
End: last
|
|
88
|
+
};
|
|
89
|
+
if (event.key === "Escape") {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
close(true);
|
|
92
|
+
} else if (event.key in nextIndex) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
activeIndex.value = nextIndex[event.key];
|
|
95
|
+
focusItem(activeIndex.value);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
onClickOutside(panelRef, () => close(), { ignore: [triggerRef] });
|
|
99
|
+
__expose({
|
|
100
|
+
open,
|
|
101
|
+
close
|
|
102
|
+
});
|
|
103
|
+
return (_ctx, _cache) => {
|
|
104
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
105
|
+
open: isOpen.value,
|
|
106
|
+
placement: resolvedPlacement.value,
|
|
107
|
+
teleported: __props.teleported,
|
|
108
|
+
disabled: __props.disabled,
|
|
109
|
+
"delay-close": 0,
|
|
110
|
+
offset: 6,
|
|
111
|
+
trigger: "manual",
|
|
112
|
+
"popover-width": "auto",
|
|
113
|
+
"popover-class": "vc-message-emoji-picker__popover"
|
|
114
|
+
}, {
|
|
115
|
+
reference: withCtx(() => [
|
|
116
|
+
createElementVNode("span", {
|
|
117
|
+
ref_key: "triggerRef",
|
|
118
|
+
ref: triggerRef,
|
|
119
|
+
class: "vc-message-emoji-picker__trigger",
|
|
120
|
+
onClick: toggle,
|
|
121
|
+
onKeydown: _cache[0] || (_cache[0] = withKeys(($event) => close(true), ["esc"]))
|
|
122
|
+
}, [
|
|
123
|
+
renderSlot(_ctx.$slots, "trigger", { isOpen: isOpen.value }, () => [
|
|
124
|
+
createVNode(_sfc_main$2, {
|
|
125
|
+
icon: unref(Smile),
|
|
126
|
+
disabled: __props.disabled,
|
|
127
|
+
title: triggerLabel.value,
|
|
128
|
+
"aria-label": triggerLabel.value,
|
|
129
|
+
"aria-expanded": isOpen.value,
|
|
130
|
+
"aria-haspopup": "true",
|
|
131
|
+
color: "secondary"
|
|
132
|
+
}, null, 8, ["icon", "disabled", "title", "aria-label", "aria-expanded"])
|
|
133
|
+
])
|
|
134
|
+
], 544)
|
|
135
|
+
]),
|
|
136
|
+
default: withCtx(() => [
|
|
137
|
+
createElementVNode("div", {
|
|
138
|
+
ref_key: "panelRef",
|
|
139
|
+
ref: panelRef,
|
|
140
|
+
role: "menu",
|
|
141
|
+
class: "vc-message-emoji-picker",
|
|
142
|
+
onKeydown
|
|
143
|
+
}, [
|
|
144
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.emojis, (emoji, index) => {
|
|
145
|
+
return openBlock(), createElementBlock("button", {
|
|
146
|
+
key: emoji,
|
|
147
|
+
ref_for: true,
|
|
148
|
+
ref: (element) => setItemRef(element, index),
|
|
149
|
+
tabindex: index === activeIndex.value ? 0 : -1,
|
|
150
|
+
type: "button",
|
|
151
|
+
role: "menuitem",
|
|
152
|
+
class: "vc-message-emoji-picker__item",
|
|
153
|
+
onClick: ($event) => select(emoji),
|
|
154
|
+
onFocus: ($event) => activeIndex.value = index
|
|
155
|
+
}, toDisplayString(emoji), 41, _hoisted_1);
|
|
156
|
+
}), 128)),
|
|
157
|
+
renderSlot(_ctx.$slots, "append")
|
|
158
|
+
], 544)
|
|
159
|
+
]),
|
|
160
|
+
_: 3
|
|
161
|
+
}, 8, ["open", "placement", "teleported", "disabled"]);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
export {
|
|
166
|
+
_sfc_main as default
|
|
167
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, withCtx, createElementVNode, normalizeClass, toDisplayString, createVNode } from "vue";
|
|
2
|
+
import { ElTooltip } from "element-plus";
|
|
3
|
+
import '../../../assets/components/VcMessage/reactions/VcMessageEmojiPicker.css';import '../../../assets/components/VcIcon/VcIcon.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/tooltip.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/popper.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/base.css';
|
|
4
|
+
import '../../../assets/components/VcMessage/reactions/VcMessageReactionBar.css';/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Plus } from "@lucide/vue";
|
|
8
|
+
import _sfc_main$2 from "../../VcIcon/VcIcon.vue.mjs";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
11
|
+
import _sfc_main$1 from "./VcMessageEmojiPicker.vue.mjs";
|
|
12
|
+
/* empty css */
|
|
13
|
+
const _hoisted_1 = { class: "vc-message-reaction-bar" };
|
|
14
|
+
const _hoisted_2 = ["aria-pressed", "onClick"];
|
|
15
|
+
const _hoisted_3 = { class: "vc-message-reaction-bar__emoji" };
|
|
16
|
+
const _hoisted_4 = { class: "vc-message-reaction-bar__count" };
|
|
17
|
+
const _hoisted_5 = ["aria-label", "title", "aria-expanded"];
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "VcMessageReactionBar",
|
|
20
|
+
props: {
|
|
21
|
+
reactions: {},
|
|
22
|
+
emojis: {}
|
|
23
|
+
},
|
|
24
|
+
emits: ["toggle"],
|
|
25
|
+
setup(__props, { emit: __emit }) {
|
|
26
|
+
const emit = __emit;
|
|
27
|
+
const addReactionLabel = computed(() => tVU.t("voicenterUi.message.addReaction"));
|
|
28
|
+
function getUsersText(reaction) {
|
|
29
|
+
const users = reaction.users ?? [];
|
|
30
|
+
const rest = reaction.count - users.length;
|
|
31
|
+
const names = users.join(", ");
|
|
32
|
+
return rest > 0 ? `${names} ${tVU.t("voicenterUi.message.reactionUsersMore", { count: rest })}` : names;
|
|
33
|
+
}
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
36
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.reactions, (reaction) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return openBlock(), createBlock(unref(ElTooltip), {
|
|
39
|
+
key: reaction.emoji,
|
|
40
|
+
content: getUsersText(reaction),
|
|
41
|
+
disabled: !((_a = reaction.users) == null ? void 0 : _a.length),
|
|
42
|
+
placement: "top"
|
|
43
|
+
}, {
|
|
44
|
+
default: withCtx(() => [
|
|
45
|
+
createElementVNode("button", {
|
|
46
|
+
class: normalizeClass([{ "is--own": reaction.isOwn }, "vc-message-reaction-bar__chip"]),
|
|
47
|
+
"aria-pressed": !!reaction.isOwn,
|
|
48
|
+
type: "button",
|
|
49
|
+
onClick: ($event) => emit("toggle", reaction.emoji)
|
|
50
|
+
}, [
|
|
51
|
+
createElementVNode("span", _hoisted_3, toDisplayString(reaction.emoji), 1),
|
|
52
|
+
createElementVNode("span", _hoisted_4, toDisplayString(reaction.count), 1)
|
|
53
|
+
], 10, _hoisted_2)
|
|
54
|
+
]),
|
|
55
|
+
_: 2
|
|
56
|
+
}, 1032, ["content", "disabled"]);
|
|
57
|
+
}), 128)),
|
|
58
|
+
createVNode(_sfc_main$1, {
|
|
59
|
+
emojis: __props.emojis,
|
|
60
|
+
onSelect: _cache[0] || (_cache[0] = (emoji) => emit("toggle", emoji))
|
|
61
|
+
}, {
|
|
62
|
+
trigger: withCtx(({ isOpen }) => [
|
|
63
|
+
createElementVNode("button", {
|
|
64
|
+
"aria-label": addReactionLabel.value,
|
|
65
|
+
title: addReactionLabel.value,
|
|
66
|
+
"aria-expanded": isOpen,
|
|
67
|
+
"aria-haspopup": "true",
|
|
68
|
+
type: "button",
|
|
69
|
+
class: "vc-message-reaction-bar__chip vc-message-reaction-bar__add"
|
|
70
|
+
}, [
|
|
71
|
+
createVNode(_sfc_main$2, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
72
|
+
], 8, _hoisted_5)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["emojis"])
|
|
76
|
+
]);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
export {
|
|
81
|
+
_sfc_main as default
|
|
82
|
+
};
|