@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,243 @@
1
+ import '../../assets/components/VcMessagesWrapper/VcMessagesWrapper.css';
2
+ import { defineComponent, ref, computed, watch, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, Fragment, renderList, toDisplayString, normalizeClass, createVNode } from "vue";
3
+ import dayjs from "dayjs";
4
+ import _sfc_main$1 from "../VcMessage/VcMessage.vue.mjs";
5
+ import '../../assets/components/VcMessage/VcMessage.css';/* empty css */
6
+ import { tVU } from "../../localization/index.mjs";
7
+ const _hoisted_1 = {
8
+ key: 0,
9
+ class: "vc-messages-wrapper__date"
10
+ };
11
+ const _hoisted_2 = { class: "vc-messages-wrapper__date-label" };
12
+ const _hoisted_3 = ["data-message-id"];
13
+ const _hoisted_4 = {
14
+ key: 0,
15
+ class: "vc-messages-wrapper__header"
16
+ };
17
+ const _hoisted_5 = { class: "vc-messages-wrapper__sender" };
18
+ const _hoisted_6 = { class: "vc-messages-wrapper__time" };
19
+ const _sfc_main = /* @__PURE__ */ defineComponent({
20
+ __name: "VcMessagesWrapper",
21
+ props: {
22
+ messages: {},
23
+ options: { type: Function, default: void 0 },
24
+ additionalOptions: { type: Function, default: void 0 },
25
+ reactionEmojis: { default: void 0 },
26
+ scrollThreshold: { default: 50 },
27
+ dateFormat: { default: "dddd, MMM D" },
28
+ timeFormat: { default: "HH:mm" }
29
+ },
30
+ emits: ["reached-top", "reached-bottom", "option-click", "reply-click", "content-click", "reaction-toggle"],
31
+ setup(__props, { expose: __expose, emit: __emit }) {
32
+ const props = __props;
33
+ const emit = __emit;
34
+ const containerRef = ref();
35
+ const listRef = ref();
36
+ const renderItems = computed(() => {
37
+ const items = [];
38
+ let previous;
39
+ for (const message of props.messages) {
40
+ const createdAt = dayjs(message.createdAt);
41
+ const previousCreatedAt = previous ? dayjs(previous.createdAt) : void 0;
42
+ const isNewDay = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "day");
43
+ if (isNewDay) {
44
+ items.push({
45
+ kind: "date",
46
+ key: `date-${createdAt.format("YYYY-MM-DD")}`,
47
+ date: createdAt.toDate(),
48
+ label: formatDateLabel(createdAt)
49
+ });
50
+ }
51
+ const isGroupStart = isNewDay || (previous == null ? void 0 : previous.sender.id) !== message.sender.id;
52
+ const isNewMinute = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "minute");
53
+ items.push({
54
+ kind: "message",
55
+ key: message.id,
56
+ message,
57
+ isGroupStart,
58
+ showTime: isGroupStart || isNewMinute,
59
+ time: createdAt.format(props.timeFormat)
60
+ });
61
+ previous = message;
62
+ }
63
+ return items;
64
+ });
65
+ function formatDateLabel(date) {
66
+ const today = dayjs();
67
+ if (date.isSame(today, "day")) {
68
+ return tVU.t("voicenterUi.messagesWrapper.today");
69
+ }
70
+ if (date.isSame(today.subtract(1, "day"), "day")) {
71
+ return tVU.t("voicenterUi.messagesWrapper.yesterday");
72
+ }
73
+ return date.format(props.dateFormat);
74
+ }
75
+ let isAtTop = false;
76
+ let isAtBottom = false;
77
+ function getEdges() {
78
+ const el = containerRef.value;
79
+ if (!el) {
80
+ return {
81
+ top: false,
82
+ bottom: false
83
+ };
84
+ }
85
+ return {
86
+ top: el.scrollTop <= props.scrollThreshold,
87
+ bottom: el.scrollHeight - el.scrollTop - el.clientHeight <= props.scrollThreshold
88
+ };
89
+ }
90
+ function syncEdges() {
91
+ const edges = getEdges();
92
+ isAtTop = edges.top;
93
+ isAtBottom = edges.bottom;
94
+ }
95
+ function onScroll() {
96
+ const edges = getEdges();
97
+ if (edges.top && !isAtTop) {
98
+ emit("reached-top");
99
+ }
100
+ if (edges.bottom && !isAtBottom) {
101
+ emit("reached-bottom");
102
+ }
103
+ isAtTop = edges.top;
104
+ isAtBottom = edges.bottom;
105
+ }
106
+ function scrollToBottom(behavior = "auto") {
107
+ const el = containerRef.value;
108
+ if (!el) {
109
+ return;
110
+ }
111
+ el.scrollTo({
112
+ top: el.scrollHeight,
113
+ behavior
114
+ });
115
+ syncEdges();
116
+ }
117
+ function scrollToMessage(id, behavior = "smooth") {
118
+ var _a;
119
+ const target = (_a = containerRef.value) == null ? void 0 : _a.querySelector(`[data-message-id="${CSS.escape(String(id))}"]`);
120
+ if (!target) {
121
+ return false;
122
+ }
123
+ target.scrollIntoView({
124
+ block: "center",
125
+ behavior
126
+ });
127
+ return true;
128
+ }
129
+ function onReplyClick(message) {
130
+ var _a;
131
+ if (((_a = message.replyTo) == null ? void 0 : _a.id) !== void 0) {
132
+ scrollToMessage(message.replyTo.id);
133
+ }
134
+ emit("reply-click", message);
135
+ }
136
+ watch(
137
+ () => {
138
+ var _a, _b;
139
+ return [props.messages.length, (_a = props.messages[0]) == null ? void 0 : _a.id, (_b = props.messages[props.messages.length - 1]) == null ? void 0 : _b.id];
140
+ },
141
+ async (_, [, previousFirstId]) => {
142
+ const el = containerRef.value;
143
+ if (!el) {
144
+ return;
145
+ }
146
+ const wasAtBottom = getEdges().bottom;
147
+ const previousScrollHeight = el.scrollHeight;
148
+ const previousScrollTop = el.scrollTop;
149
+ const previousFirstIndex = props.messages.findIndex((message) => message.id === previousFirstId);
150
+ await nextTick();
151
+ if (previousFirstIndex > 0) {
152
+ el.scrollTop = previousScrollTop + (el.scrollHeight - previousScrollHeight);
153
+ syncEdges();
154
+ } else if (wasAtBottom) {
155
+ scrollToBottom();
156
+ }
157
+ }
158
+ );
159
+ let resizeObserver;
160
+ onMounted(() => {
161
+ scrollToBottom();
162
+ resizeObserver = new ResizeObserver(() => {
163
+ if (isAtBottom) {
164
+ scrollToBottom();
165
+ }
166
+ });
167
+ if (listRef.value) {
168
+ resizeObserver.observe(listRef.value);
169
+ }
170
+ });
171
+ onBeforeUnmount(() => {
172
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
173
+ });
174
+ __expose({
175
+ scrollToBottom,
176
+ scrollToMessage
177
+ });
178
+ return (_ctx, _cache) => {
179
+ return openBlock(), createElementBlock("div", {
180
+ ref_key: "containerRef",
181
+ ref: containerRef,
182
+ class: "vc-messages-wrapper",
183
+ onScroll
184
+ }, [
185
+ createElementVNode("div", {
186
+ ref_key: "listRef",
187
+ ref: listRef,
188
+ class: "vc-messages-wrapper__list"
189
+ }, [
190
+ !__props.messages.length ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : createCommentVNode("", true),
191
+ (openBlock(true), createElementBlock(Fragment, null, renderList(renderItems.value, (item) => {
192
+ var _a, _b;
193
+ return openBlock(), createElementBlock(Fragment, {
194
+ key: item.key
195
+ }, [
196
+ item.kind === "date" ? (openBlock(), createElementBlock("div", _hoisted_1, [
197
+ renderSlot(_ctx.$slots, "date-divider", {
198
+ date: item.date,
199
+ label: item.label
200
+ }, () => [
201
+ createElementVNode("span", _hoisted_2, toDisplayString(item.label), 1)
202
+ ])
203
+ ])) : (openBlock(), createElementBlock("div", {
204
+ key: 1,
205
+ "data-message-id": item.message.id,
206
+ class: normalizeClass([{
207
+ "is--own": item.message.isOwn,
208
+ "is--group-start": item.isGroupStart
209
+ }, "vc-messages-wrapper__row"])
210
+ }, [
211
+ item.showTime ? (openBlock(), createElementBlock("div", _hoisted_4, [
212
+ item.isGroupStart ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
213
+ createElementVNode("span", _hoisted_5, toDisplayString(item.message.sender.name), 1),
214
+ _cache[0] || (_cache[0] = createElementVNode("span", { class: "vc-messages-wrapper__dot" }, "·", -1))
215
+ ], 64)) : createCommentVNode("", true),
216
+ createElementVNode("span", _hoisted_6, toDisplayString(item.time), 1)
217
+ ])) : createCommentVNode("", true),
218
+ createVNode(_sfc_main$1, {
219
+ content: item.message.content,
220
+ align: item.message.isOwn ? "end" : "start",
221
+ reply: item.message.replyTo,
222
+ reactions: item.message.reactions,
223
+ "reaction-emojis": __props.reactionEmojis,
224
+ edited: item.message.isEdited,
225
+ deleted: item.message.isDeleted,
226
+ options: ((_a = __props.options) == null ? void 0 : _a.call(__props, item.message)) ?? [],
227
+ "additional-options": ((_b = __props.additionalOptions) == null ? void 0 : _b.call(__props, item.message)) ?? [],
228
+ onOptionClick: (event, option) => emit("option-click", event, item.message, option),
229
+ onReplyClick: ($event) => onReplyClick(item.message),
230
+ onContentClick: ($event) => emit("content-click", item.message),
231
+ onReactionToggle: ($event) => emit("reaction-toggle", $event, item.message)
232
+ }, null, 8, ["content", "align", "reply", "reactions", "reaction-emojis", "edited", "deleted", "options", "additional-options", "onOptionClick", "onReplyClick", "onContentClick", "onReactionToggle"])
233
+ ], 10, _hoisted_3))
234
+ ], 64);
235
+ }), 128))
236
+ ], 512)
237
+ ], 544);
238
+ };
239
+ }
240
+ });
241
+ export {
242
+ _sfc_main as default
243
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcMessagesWrapper.vue.mjs";
2
+ import '../../assets/components/VcMessagesWrapper/VcMessagesWrapper.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -1,9 +1,10 @@
1
1
  import '../../../assets/components/VcRadioTabs/UiComponents/VcRadioTabsNav.css';
2
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, withKeys, renderSlot, createElementVNode, normalizeStyle, createVNode, toDisplayString } from "vue";
2
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, withCtx, createElementVNode, withKeys, renderSlot, normalizeStyle, createVNode, toDisplayString } from "vue";
3
3
  import { convertToUnit } from "../../../utils/helpers.mjs";
4
4
  import useOptionMethods from "../../../composables/option/useOptionMethods.mjs";
5
- import _sfc_main$1 from "../../VcIcon/VcIcon.vue.mjs";
5
+ import _sfc_main$2 from "../../VcIcon/VcIcon.vue.mjs";
6
6
  import '../../../assets/components/VcIcon/VcIcon.css';/* empty css */
7
+ import _sfc_main$1 from "./VcRadioTabsNavHint.vue.mjs";
7
8
  const _hoisted_1 = ["tabindex", "onClick", "onKeyup"];
8
9
  const _hoisted_2 = { class: "radio-tab-nav-name" };
9
10
  const DEFAULT_GAP_CLASSES = "gap-x-2 sm:gap-x-3 md:gap-x-6 lg:gap-x-12";
@@ -48,32 +49,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
48
49
  class: normalizeClass([`justify-${__props.position} ${__props.headerClasses}`, "vc-radio-tabs-nav"])
49
50
  }, [
50
51
  (openBlock(true), createElementBlock(Fragment, null, renderList(optionsMapped.value, (option, index) => {
51
- return openBlock(), createElementBlock("div", {
52
+ return openBlock(), createBlock(_sfc_main$1, {
52
53
  key: `tab-${index}`,
53
- class: normalizeClass([[{
54
- "is--active": isActiveTab(option),
55
- "is--disabled": option.disabled
56
- }, borderPositionClass.value], "vc-radio-tabs-nav__item"]),
57
- tabindex: option.disabled ? -1 : 0,
58
- onClick: ($event) => onClick(option, index),
59
- onKeyup: withKeys(($event) => onClick(option, index), ["enter"])
60
- }, [
61
- renderSlot(_ctx.$slots, "tab-item", {
62
- option,
63
- index
64
- }, () => [
54
+ hint: option.disabledHint
55
+ }, {
56
+ default: withCtx(() => [
65
57
  createElementVNode("div", {
66
- class: normalizeClass([__props.tabItemClasses, "vc-radio-tabs-nav__item-content"]),
67
- style: normalizeStyle(contentWidthStyle.value)
58
+ class: normalizeClass([[{
59
+ "is--active": isActiveTab(option),
60
+ "is--disabled": option.disabled
61
+ }, borderPositionClass.value], "vc-radio-tabs-nav__item"]),
62
+ tabindex: option.disabled ? -1 : 0,
63
+ onClick: ($event) => onClick(option, index),
64
+ onKeyup: withKeys(($event) => onClick(option, index), ["enter"])
68
65
  }, [
69
- createVNode(_sfc_main$1, {
70
- icon: option.icon,
71
- class: "radio-tab-nav-icon icon-base"
72
- }, null, 8, ["icon"]),
73
- createElementVNode("span", _hoisted_2, toDisplayString(option.label), 1)
74
- ], 6)
75
- ])
76
- ], 42, _hoisted_1);
66
+ renderSlot(_ctx.$slots, "tab-item", {
67
+ option,
68
+ index
69
+ }, () => [
70
+ createElementVNode("div", {
71
+ class: normalizeClass([__props.tabItemClasses, "vc-radio-tabs-nav__item-content"]),
72
+ style: normalizeStyle(contentWidthStyle.value)
73
+ }, [
74
+ createVNode(_sfc_main$2, {
75
+ icon: option.icon,
76
+ class: "radio-tab-nav-icon icon-base"
77
+ }, null, 8, ["icon"]),
78
+ createElementVNode("span", _hoisted_2, toDisplayString(option.label), 1)
79
+ ], 6)
80
+ ])
81
+ ], 42, _hoisted_1)
82
+ ]),
83
+ _: 2
84
+ }, 1032, ["hint"]);
77
85
  }), 128))
78
86
  ], 2);
79
87
  };
@@ -0,0 +1,31 @@
1
+ import { defineComponent, openBlock, createBlock, withCtx, createElementVNode, toDisplayString, renderSlot } from "vue";
2
+ import _sfc_main$1 from "../../VcPopover/VcPopover.vue.mjs";
3
+ import '../../../assets/components/VcPopover/VcPopover.css';/* empty css */
4
+ const _hoisted_1 = { class: "vc-radio-tabs-nav__disabled-hint break-normal p-2 text-xs" };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "VcRadioTabsNavHint",
7
+ props: {
8
+ hint: { default: void 0 }
9
+ },
10
+ setup(__props) {
11
+ return (_ctx, _cache) => {
12
+ return __props.hint ? (openBlock(), createBlock(_sfc_main$1, {
13
+ key: 0,
14
+ trigger: "hover",
15
+ placement: "top",
16
+ teleported: ""
17
+ }, {
18
+ reference: withCtx(() => [
19
+ renderSlot(_ctx.$slots, "default")
20
+ ]),
21
+ default: withCtx(() => [
22
+ createElementVNode("div", _hoisted_1, toDisplayString(__props.hint), 1)
23
+ ]),
24
+ _: 3
25
+ })) : renderSlot(_ctx.$slots, "default", { key: 1 });
26
+ };
27
+ }
28
+ });
29
+ export {
30
+ _sfc_main as default
31
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./VcRadioTabsNavHint.vue.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -1,4 +1,4 @@
1
- import { inject, provide } from "vue";
1
+ import { provide, inject } from "vue";
2
2
  import { VcSoundPlayerProvideKey } from "../../tokens/tokens.mjs";
3
3
  function useSoundPlayerProvide(param) {
4
4
  provide(VcSoundPlayerProvideKey, param);
@@ -57,6 +57,17 @@ function useOptionMethods() {
57
57
  }
58
58
  return false;
59
59
  }
60
+ function optionDisabledHint(option, config) {
61
+ if (isOptionObjectValueType(option) && config !== void 0 && "disabledHintKey" in config) {
62
+ const key = config.disabledHintKey;
63
+ if (key === void 0 || !optionDisabled(option, config)) {
64
+ return void 0;
65
+ }
66
+ const value = getValueByPath(option, key);
67
+ return typeof value === "string" && value !== "" ? value : void 0;
68
+ }
69
+ return void 0;
70
+ }
60
71
  function optionIconColorHex(option, config) {
61
72
  if (isOptionObjectValueType(option) && config !== void 0 && "iconColorHex" in config) {
62
73
  const key = config.iconColorHex;
@@ -116,6 +127,7 @@ function useOptionMethods() {
116
127
  const value = optionValue(item, config);
117
128
  const label = optionLabel(item, config);
118
129
  const disabled = optionDisabled(item, config);
130
+ const disabledHint = optionDisabledHint(item, config);
119
131
  const icon = optionIcon(item, config);
120
132
  const iconStyle = optionIconStyle(item, config);
121
133
  const color = optionColor(item, config);
@@ -126,6 +138,7 @@ function useOptionMethods() {
126
138
  iconStyle,
127
139
  label,
128
140
  disabled,
141
+ disabledHint,
129
142
  color,
130
143
  key: String(value)
131
144
  };
@@ -160,6 +173,7 @@ function useOptionMethods() {
160
173
  optionLabel,
161
174
  optionIcon,
162
175
  optionDisabled,
176
+ optionDisabledHint,
163
177
  optionIconColorHex,
164
178
  optionClass,
165
179
  optionStyle,
@@ -0,0 +1,120 @@
1
+ import { ref, shallowRef, computed, onBeforeUnmount } from "vue";
2
+ const PREFERRED_MIME_TYPES = ["audio/webm;codecs=opus", "audio/webm", "audio/mp4"];
3
+ function getSupportedMimeType() {
4
+ return PREFERRED_MIME_TYPES.find((type) => MediaRecorder.isTypeSupported(type));
5
+ }
6
+ function useAudioRecorder() {
7
+ const state = ref("idle");
8
+ const blob = shallowRef();
9
+ const url = ref();
10
+ const duration = ref(0);
11
+ const error = shallowRef();
12
+ let recorder;
13
+ let stream;
14
+ let chunks = [];
15
+ let timer;
16
+ let startedAt = 0;
17
+ let isCancelled = false;
18
+ const isSupported = computed(() => {
19
+ var _a;
20
+ return typeof window !== "undefined" && typeof MediaRecorder !== "undefined" && !!((_a = navigator.mediaDevices) == null ? void 0 : _a.getUserMedia);
21
+ });
22
+ function releaseMicrophone() {
23
+ stream == null ? void 0 : stream.getTracks().forEach((track) => track.stop());
24
+ stream = void 0;
25
+ if (timer) {
26
+ clearInterval(timer);
27
+ timer = void 0;
28
+ }
29
+ }
30
+ function revokeUrl() {
31
+ if (url.value) {
32
+ URL.revokeObjectURL(url.value);
33
+ url.value = void 0;
34
+ }
35
+ }
36
+ async function start() {
37
+ if (state.value === "recording" || !isSupported.value) {
38
+ return;
39
+ }
40
+ reset();
41
+ try {
42
+ stream = await navigator.mediaDevices.getUserMedia({ audio: true });
43
+ } catch (cause) {
44
+ error.value = cause instanceof Error ? cause : new Error(String(cause));
45
+ return;
46
+ }
47
+ chunks = [];
48
+ isCancelled = false;
49
+ recorder = new MediaRecorder(stream, { mimeType: getSupportedMimeType() });
50
+ recorder.addEventListener("dataavailable", (event) => {
51
+ if (event.data.size) {
52
+ chunks.push(event.data);
53
+ }
54
+ });
55
+ recorder.addEventListener("stop", () => {
56
+ releaseMicrophone();
57
+ if (isCancelled || !chunks.length) {
58
+ state.value = "idle";
59
+ return;
60
+ }
61
+ blob.value = new Blob(chunks, { type: (recorder == null ? void 0 : recorder.mimeType) || chunks[0].type });
62
+ url.value = URL.createObjectURL(blob.value);
63
+ state.value = "recorded";
64
+ });
65
+ recorder.start();
66
+ startedAt = Date.now();
67
+ duration.value = 0;
68
+ timer = setInterval(() => {
69
+ duration.value = Math.floor((Date.now() - startedAt) / 1e3);
70
+ }, 250);
71
+ state.value = "recording";
72
+ }
73
+ function stop() {
74
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
75
+ recorder.stop();
76
+ }
77
+ }
78
+ function cancel() {
79
+ isCancelled = true;
80
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
81
+ recorder.stop();
82
+ } else {
83
+ releaseMicrophone();
84
+ state.value = "idle";
85
+ }
86
+ }
87
+ function reset() {
88
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
89
+ cancel();
90
+ }
91
+ revokeUrl();
92
+ blob.value = void 0;
93
+ error.value = void 0;
94
+ duration.value = 0;
95
+ state.value = "idle";
96
+ }
97
+ onBeforeUnmount(() => {
98
+ isCancelled = true;
99
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
100
+ recorder.stop();
101
+ }
102
+ releaseMicrophone();
103
+ revokeUrl();
104
+ });
105
+ return {
106
+ state,
107
+ blob,
108
+ url,
109
+ duration,
110
+ error,
111
+ isSupported,
112
+ start,
113
+ stop,
114
+ cancel,
115
+ reset
116
+ };
117
+ }
118
+ export {
119
+ useAudioRecorder as default
120
+ };
@@ -0,0 +1,51 @@
1
+ import { FileArchive, FileSpreadsheet, FileText } from "@lucide/vue";
2
+ const DEFAULT_FILE_TYPE = {
3
+ icon: FileText,
4
+ color: "var(--secondary-actions)"
5
+ };
6
+ const DEFAULT_FILE_TYPE_MAP = {
7
+ pdf: {
8
+ icon: FileText,
9
+ color: "#D34C4C"
10
+ },
11
+ doc: {
12
+ icon: FileText,
13
+ color: "var(--secondary-text)"
14
+ },
15
+ docx: {
16
+ icon: FileText,
17
+ color: "var(--secondary-text)"
18
+ },
19
+ txt: {
20
+ icon: FileText,
21
+ color: "var(--secondary-text)"
22
+ },
23
+ xls: {
24
+ icon: FileSpreadsheet,
25
+ color: "var(--success-actions)"
26
+ },
27
+ xlsx: {
28
+ icon: FileSpreadsheet,
29
+ color: "var(--success-actions)"
30
+ },
31
+ csv: {
32
+ icon: FileSpreadsheet,
33
+ color: "var(--success-actions)"
34
+ },
35
+ zip: {
36
+ icon: FileArchive,
37
+ color: "var(--warning-actions)"
38
+ },
39
+ rar: {
40
+ icon: FileArchive,
41
+ color: "var(--warning-actions)"
42
+ },
43
+ "7z": {
44
+ icon: FileArchive,
45
+ color: "var(--warning-actions)"
46
+ }
47
+ };
48
+ export {
49
+ DEFAULT_FILE_TYPE,
50
+ DEFAULT_FILE_TYPE_MAP
51
+ };