@voicenter-team/voicenter-ui-plus 4.3.0 → 4.3.2

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 (92) hide show
  1. package/MIGRATION_v3.md +196 -196
  2. package/README.md +1058 -1057
  3. package/library/assets/assets/sass/main.css +1 -1
  4. package/library/assets/components/VcCodeBlock/VcCodeBlock.css +1 -1
  5. package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
  6. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  7. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  8. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  9. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  10. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  11. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  12. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  13. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  14. package/library/assets/components/VcNavigationSidebar/VcNavigationSidebar.css +1 -0
  15. package/library/assets/components/VcSegmented/VcSegmented.css +1 -1
  16. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  17. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  18. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  19. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  20. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  21. package/library/assets/components/VcSkeletonLoader/VcSkeletonItem.css +1 -0
  22. package/library/assets/components/VcTag/VcTag.css +1 -1
  23. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
  24. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  25. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  26. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  27. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  28. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  29. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  30. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  31. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  32. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  33. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  34. package/library/components/VcNavigationSidebar/NavigationSidebarLink.vue.mjs +154 -0
  35. package/library/components/VcNavigationSidebar/NavigationSidebarLink.vue2.mjs +4 -0
  36. package/library/components/VcNavigationSidebar/NavigationSidebarMobileList.vue.mjs +128 -0
  37. package/library/components/VcNavigationSidebar/NavigationSidebarMobileList.vue2.mjs +4 -0
  38. package/library/components/VcNavigationSidebar/NavigationSidebarMore.vue.mjs +94 -0
  39. package/library/components/VcNavigationSidebar/NavigationSidebarMore.vue2.mjs +4 -0
  40. package/library/components/VcNavigationSidebar/NavigationSidebarPanel.vue.mjs +179 -0
  41. package/library/components/VcNavigationSidebar/NavigationSidebarPanel.vue2.mjs +4 -0
  42. package/library/components/VcNavigationSidebar/VcNavigationSidebar.vue.mjs +737 -0
  43. package/library/components/VcNavigationSidebar/VcNavigationSidebar.vue3.mjs +5 -0
  44. package/library/components/VcNavigationSidebar/navigationSidebarModel.mjs +51 -0
  45. package/library/components/VcSegmented/VcSegmented.vue.mjs +1 -1
  46. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  47. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  48. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  49. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  50. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  51. package/library/components/VcSkeletonLoader/VcSkeletonItem.vue.mjs +7 -0
  52. package/library/components/VcSkeletonLoader/VcSkeletonItem.vue2.mjs +39 -0
  53. package/library/components/VcSkeletonLoader/VcSkeletonLoader.vue.mjs +19 -6
  54. package/library/docs/guides/migration/migrating-from-4.0.md +88 -87
  55. package/library/index.mjs +121 -116
  56. package/library/index.mjs.br +0 -0
  57. package/library/index.mjs.gz +0 -0
  58. package/library/localization/index.mjs.gz +0 -0
  59. package/library/localization/locales/en.json.mjs +9 -1
  60. package/library/plugin-components.gen.mjs +165 -160
  61. package/library/plugin.mjs +119 -114
  62. package/library/plugin.mjs.br +0 -0
  63. package/library/plugin.mjs.gz +0 -0
  64. package/library/style.css +22 -18
  65. package/library/style.css.br +0 -0
  66. package/library/style.css.gz +0 -0
  67. package/library/theme/index.mjs.gz +0 -0
  68. package/library/types/components/VcFilterBar/VcFilterBar.vue.d.ts +1 -1
  69. package/library/types/components/VcNavigationSidebar/NavigationSidebarLink.vue.d.ts +17 -0
  70. package/library/types/components/VcNavigationSidebar/NavigationSidebarMobileList.vue.d.ts +15 -0
  71. package/library/types/components/VcNavigationSidebar/NavigationSidebarMore.vue.d.ts +15 -0
  72. package/library/types/components/VcNavigationSidebar/NavigationSidebarPanel.vue.d.ts +33 -0
  73. package/library/types/components/VcNavigationSidebar/VcNavigationSidebar.vue.d.ts +121 -0
  74. package/library/types/components/VcNavigationSidebar/navigationSidebarModel.d.ts +42 -0
  75. package/library/types/components/VcSkeletonLoader/VcSkeletonItem.vue.d.ts +16 -0
  76. package/library/types/components/VcSkeletonLoader/VcSkeletonLoader.vue.d.ts +19 -1
  77. package/library/types/components/exports.d.ts +5 -1
  78. package/library/types/components.gen.d.ts +2 -0
  79. package/library/types/localization/locales/en.json.d.ts +9 -1
  80. package/library/types/theme/themes.json.d.ts +72 -72
  81. package/library/types/types/VcNavigationSidebar.types.d.ts +66 -0
  82. package/library/types/types/VcSkeletonLoader.types.d.ts +1 -0
  83. package/library/types/types/index.d.ts +1 -0
  84. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  85. package/package.json +310 -310
  86. package/src/theme/index.ts +101 -101
  87. package/src/theme/tailwindScheme.js +78 -78
  88. package/src/theme/theme.types.ts +31 -31
  89. package/src/theme/themeMerge.ts +63 -63
  90. package/src/theme/themes.json +72 -72
  91. package/tailwind.config.d.ts +5 -5
  92. package/tailwind.config.js +178 -178
@@ -0,0 +1,737 @@
1
+ import { defineComponent, useSlots, computed, ref, watch, nextTick, reactive, provide, onMounted, onBeforeUnmount, openBlock, createElementBlock, withKeys, unref, normalizeStyle, normalizeClass, createElementVNode, renderSlot, createVNode, createCommentVNode, Fragment, renderList, toDisplayString, createBlock, withCtx, withModifiers, createSlots } from "vue";
2
+ import { ElPopover } from "element-plus";
3
+ import '../../assets/components/VcPopover/VcPopover.css';import '../../assets/components/VcIcon/VcIcon.css';import '../../assets/node_modules/element-plus/theme-chalk/src/popover.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/VcNavigationSidebar/VcNavigationSidebar.css';/* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ import { useVModel, useMediaQuery, useResizeObserver, onClickOutside } from "@vueuse/core";
8
+ import { PanelRightClose, PanelLeftClose, PanelRightOpen, PanelLeftOpen, X, Ellipsis, BookOpen } from "@lucide/vue";
9
+ import _sfc_main$1 from "../VcIcon/VcIcon.vue.mjs";
10
+ /* empty css */
11
+ import _sfc_main$4 from "../VcPopover/VcPopover.vue.mjs";
12
+ /* empty css */
13
+ import { tVU } from "../../localization/index.mjs";
14
+ import { useRTL } from "../../composables/useRTL.mjs";
15
+ import UniqueComponentId from "../../utils/UniqueComponentId.mjs";
16
+ import _sfc_main$3 from "./NavigationSidebarLink.vue.mjs";
17
+ import _sfc_main$6 from "./NavigationSidebarPanel.vue.mjs";
18
+ import _sfc_main$2 from "./NavigationSidebarMobileList.vue.mjs";
19
+ import _sfc_main$5 from "./NavigationSidebarMore.vue.mjs";
20
+ import { toActiveKeys, isNavigationGroup, isItemActive, activeLinkKey, NAVIGATION_SIDEBAR_KEY } from "./navigationSidebarModel.mjs";
21
+ const _hoisted_1 = ["aria-label", "data-test", "inert"];
22
+ const _hoisted_2 = {
23
+ key: 0,
24
+ class: "vc-nav-sidebar__header"
25
+ };
26
+ const _hoisted_3 = { class: "vc-nav-sidebar__header-content" };
27
+ const _hoisted_4 = ["aria-label", "aria-expanded"];
28
+ const _hoisted_5 = ["aria-label"];
29
+ const _hoisted_6 = { class: "vc-nav-sidebar__mobile-body" };
30
+ const _hoisted_7 = {
31
+ key: 0,
32
+ class: "vc-nav-sidebar__footer vc-nav-sidebar__mobile-footer"
33
+ };
34
+ const _hoisted_8 = {
35
+ key: 2,
36
+ class: "vc-nav-sidebar__body"
37
+ };
38
+ const _hoisted_9 = { class: "vc-nav-sidebar__rail" };
39
+ const _hoisted_10 = ["aria-expanded", "aria-controls", "data-test", "onMouseenter", "onClick"];
40
+ const _hoisted_11 = {
41
+ key: 0,
42
+ class: "vc-nav-sidebar__indicator",
43
+ "aria-hidden": "true"
44
+ };
45
+ const _hoisted_12 = {
46
+ key: 0,
47
+ class: "vc-nav-sidebar__group-icon"
48
+ };
49
+ const _hoisted_13 = {
50
+ key: 0,
51
+ class: "vc-nav-sidebar__indicator",
52
+ "aria-hidden": "true"
53
+ };
54
+ const _hoisted_14 = { class: "vc-nav-sidebar__group-label" };
55
+ const _hoisted_15 = ["aria-expanded"];
56
+ const _hoisted_16 = { class: "vc-nav-sidebar__group-icon" };
57
+ const _hoisted_17 = {
58
+ key: 0,
59
+ class: "vc-nav-sidebar__indicator",
60
+ "aria-hidden": "true"
61
+ };
62
+ const _hoisted_18 = { class: "vc-nav-sidebar__group-label" };
63
+ const _hoisted_19 = {
64
+ key: 1,
65
+ class: "vc-nav-sidebar__footer"
66
+ };
67
+ const _hoisted_20 = ["aria-label"];
68
+ const _hoisted_21 = ["data-test"];
69
+ const _hoisted_22 = { class: "vc-nav-sidebar-tooltip__head" };
70
+ const _hoisted_23 = { class: "vc-nav-sidebar-tooltip__title" };
71
+ const _hoisted_24 = ["href", "aria-label", "title"];
72
+ const _hoisted_25 = {
73
+ key: 0,
74
+ class: "vc-nav-sidebar-tooltip__text"
75
+ };
76
+ const CLOSE_DELAY = 200;
77
+ const RAIL_ITEM_HEIGHT = 72;
78
+ const WIDE_ITEM_HEIGHT = 40;
79
+ const _sfc_main = /* @__PURE__ */ defineComponent({
80
+ __name: "VcNavigationSidebar",
81
+ props: {
82
+ items: { default: () => [] },
83
+ active: { default: void 0 },
84
+ expanded: { type: Boolean, default: false },
85
+ collapsible: { type: Boolean, default: true },
86
+ tooltips: { type: Boolean, default: true },
87
+ railWidth: { default: 84 },
88
+ panelWidth: { default: 288 },
89
+ expandedWidth: { default: 240 },
90
+ mobileBreakpoint: { default: 680 },
91
+ mobile: { type: Boolean, default: void 0 },
92
+ mobileOpen: { type: Boolean, default: false },
93
+ ariaLabel: { default: void 0 },
94
+ panelClass: { default: void 0 },
95
+ popoverClass: { default: void 0 },
96
+ dataTestName: { default: "vc-navigation-sidebar" }
97
+ },
98
+ emits: ["update:active", "update:expanded", "update:mobileOpen", "select", "info-action", "docs"],
99
+ setup(__props, { expose: __expose, emit: __emit }) {
100
+ const props = __props;
101
+ const emit = __emit;
102
+ const slots = useSlots();
103
+ const { isRTL } = useRTL();
104
+ const panelId = UniqueComponentId("vc-nav-sidebar-panel-");
105
+ const expandedModel = useVModel(props, "expanded", emit, { passive: true });
106
+ const mediaMobile = useMediaQuery(computed(() => props.mobileBreakpoint > 0 ? `(max-width: ${props.mobileBreakpoint - 0.02}px)` : "not all"));
107
+ const isMobile = computed(() => props.mobile ?? mediaMobile.value);
108
+ const mobileOpenModel = useVModel(props, "mobileOpen", emit, { passive: true });
109
+ const isExpanded = computed(() => expandedModel.value || isMobile.value);
110
+ const rootRef = ref();
111
+ const listRef = ref();
112
+ const moreButtonRef = ref();
113
+ const moreRef = ref();
114
+ const moreContentRef = computed(() => {
115
+ var _a;
116
+ return ((_a = moreRef.value) == null ? void 0 : _a.$el) instanceof HTMLElement ? moreRef.value.$el : void 0;
117
+ });
118
+ const tooltipRef = ref();
119
+ const groupButtons = /* @__PURE__ */ new Map();
120
+ const activeKeys = computed(() => toActiveKeys(props.active));
121
+ const hasGroups = computed(() => props.items.some(isNavigationGroup));
122
+ const groups = computed(() => props.items.filter(isNavigationGroup));
123
+ const activeGroup = computed(() => groups.value.find((group) => isItemActive(group, activeKeys.value)));
124
+ const railLinks = computed(() => props.items.filter((item) => !isNavigationGroup(item)));
125
+ const activeRailLink = computed(() => activeLinkKey(railLinks.value, props.active));
126
+ const isWide = computed(() => isExpanded.value && !hasGroups.value);
127
+ const viewedKey = ref(null);
128
+ watch(() => {
129
+ var _a;
130
+ return (_a = activeGroup.value) == null ? void 0 : _a.key;
131
+ }, () => {
132
+ viewedKey.value = null;
133
+ });
134
+ const dockedGroup = computed(() => {
135
+ if (!isExpanded.value || !hasGroups.value) {
136
+ return void 0;
137
+ }
138
+ return groups.value.find((group) => group.key === viewedKey.value) ?? activeGroup.value ?? groups.value[0];
139
+ });
140
+ const rootStyle = computed(() => {
141
+ let width = props.railWidth;
142
+ if (isWide.value) {
143
+ width = props.expandedWidth;
144
+ } else if (dockedGroup.value) {
145
+ width = props.railWidth + props.panelWidth;
146
+ }
147
+ return {
148
+ "--vc-nav-sidebar-rail-width": `${props.railWidth}px`,
149
+ "--vc-nav-sidebar-panel-width": `${props.panelWidth}px`,
150
+ width: isMobile.value ? "100%" : `${width}px`
151
+ };
152
+ });
153
+ const toggleIcon = computed(() => {
154
+ if (expandedModel.value) {
155
+ return isRTL.value ? PanelRightClose : PanelLeftClose;
156
+ }
157
+ return isRTL.value ? PanelRightOpen : PanelLeftOpen;
158
+ });
159
+ function toggleExpanded() {
160
+ closeFlyout();
161
+ closeTooltip(true);
162
+ expandedModel.value = !expandedModel.value;
163
+ }
164
+ const availableHeight = ref(0);
165
+ const itemHeight = ref(0);
166
+ function measureList(listContentHeight = ((_a) => (_a = listRef.value) == null ? void 0 : _a.clientHeight)() ?? 0) {
167
+ var _a2, _b, _c;
168
+ availableHeight.value = listContentHeight + (((_a2 = moreButtonRef.value) == null ? void 0 : _a2.offsetHeight) ?? 0);
169
+ const first = (_b = listRef.value) == null ? void 0 : _b.firstElementChild;
170
+ itemHeight.value = first instanceof HTMLElement ? first.offsetHeight : ((_c = moreButtonRef.value) == null ? void 0 : _c.offsetHeight) ?? 0;
171
+ }
172
+ useResizeObserver(listRef, (entries) => {
173
+ var _a;
174
+ measureList((_a = entries[0]) == null ? void 0 : _a.contentRect.height);
175
+ });
176
+ const visibleCount = computed(() => {
177
+ const total = props.items.length;
178
+ if (!availableHeight.value) {
179
+ return total;
180
+ }
181
+ const height = itemHeight.value || (isWide.value ? WIDE_ITEM_HEIGHT : RAIL_ITEM_HEIGHT);
182
+ if (total * height <= availableHeight.value) {
183
+ return total;
184
+ }
185
+ return Math.max(Math.floor(availableHeight.value / height) - 1, 0);
186
+ });
187
+ const visibleItems = computed(() => props.items.slice(0, visibleCount.value));
188
+ const overflowItems = computed(() => props.items.slice(visibleCount.value));
189
+ const overflowActive = computed(() => overflowItems.value.some((item) => isItemActive(item, activeKeys.value)));
190
+ const moreWidth = computed(() => Math.max(props.panelWidth, 280));
191
+ const flyoutKey = ref(null);
192
+ const flyoutGroup = computed(() => {
193
+ if (dockedGroup.value || !flyoutKey.value) {
194
+ return void 0;
195
+ }
196
+ return groups.value.find((group) => group.key === flyoutKey.value);
197
+ });
198
+ const openGroupKey = computed(() => {
199
+ var _a, _b;
200
+ return ((_a = dockedGroup.value) == null ? void 0 : _a.key) ?? ((_b = flyoutGroup.value) == null ? void 0 : _b.key) ?? null;
201
+ });
202
+ let flyoutTimer;
203
+ function setGroupButton(key, el) {
204
+ if (el instanceof HTMLElement) {
205
+ groupButtons.set(key, el);
206
+ } else {
207
+ groupButtons.delete(key);
208
+ }
209
+ }
210
+ function cancelFlyoutClose() {
211
+ clearTimeout(flyoutTimer);
212
+ }
213
+ function scheduleFlyoutClose() {
214
+ clearTimeout(flyoutTimer);
215
+ if (!flyoutKey.value) {
216
+ return;
217
+ }
218
+ flyoutTimer = setTimeout(() => {
219
+ if (!pointerInTooltip) {
220
+ closeFlyout();
221
+ }
222
+ }, CLOSE_DELAY);
223
+ }
224
+ function closeFlyout() {
225
+ clearTimeout(flyoutTimer);
226
+ flyoutKey.value = null;
227
+ }
228
+ function onGroupEnter(group) {
229
+ cancelFlyoutClose();
230
+ if (dockedGroup.value) {
231
+ return;
232
+ }
233
+ closeMore();
234
+ if (flyoutKey.value !== group.key) {
235
+ closeTooltip(true);
236
+ }
237
+ flyoutKey.value = group.key;
238
+ }
239
+ function onGroupClick(group, event) {
240
+ if (dockedGroup.value) {
241
+ viewedKey.value = group.key;
242
+ return;
243
+ }
244
+ const fromKeyboard = event.detail === 0;
245
+ if (fromKeyboard && flyoutKey.value === group.key) {
246
+ closeFlyout();
247
+ return;
248
+ }
249
+ flyoutKey.value = group.key;
250
+ if (fromKeyboard) {
251
+ nextTick(() => {
252
+ var _a, _b;
253
+ (_b = (_a = rootRef.value) == null ? void 0 : _a.querySelector(`#${panelId} .vc-nav-sidebar-link`)) == null ? void 0 : _b.focus();
254
+ });
255
+ }
256
+ }
257
+ function pinFlyout() {
258
+ if (flyoutKey.value) {
259
+ viewedKey.value = flyoutKey.value;
260
+ }
261
+ closeFlyout();
262
+ closeTooltip(true);
263
+ expandedModel.value = true;
264
+ }
265
+ function onFocusOut(event) {
266
+ var _a, _b;
267
+ const next = event.relatedTarget instanceof Node ? event.relatedTarget : null;
268
+ if (!next || ((_a = rootRef.value) == null ? void 0 : _a.contains(next)) || ((_b = tooltipRef.value) == null ? void 0 : _b.contains(next))) {
269
+ return;
270
+ }
271
+ closeFlyout();
272
+ }
273
+ function onEscape() {
274
+ var _a;
275
+ if (isMobile.value && mobileOpenModel.value) {
276
+ closeMobile();
277
+ return;
278
+ }
279
+ if (moreOpen.value) {
280
+ closeMore(true);
281
+ return;
282
+ }
283
+ if (flyoutKey.value) {
284
+ const key = flyoutKey.value;
285
+ closeFlyout();
286
+ closeTooltip(true);
287
+ (_a = groupButtons.get(key)) == null ? void 0 : _a.focus();
288
+ }
289
+ }
290
+ const mobileCloseRef = ref();
291
+ let focusBeforeOpen = null;
292
+ function closeMobile() {
293
+ mobileOpenModel.value = false;
294
+ }
295
+ watch(() => isMobile.value && mobileOpenModel.value, (open) => {
296
+ if (open) {
297
+ focusBeforeOpen = document.activeElement instanceof HTMLElement ? document.activeElement : null;
298
+ nextTick(() => {
299
+ var _a;
300
+ return (_a = mobileCloseRef.value) == null ? void 0 : _a.focus();
301
+ });
302
+ } else if (focusBeforeOpen) {
303
+ focusBeforeOpen.focus();
304
+ focusBeforeOpen = null;
305
+ }
306
+ });
307
+ const moreOpen = ref(false);
308
+ let moreTimer;
309
+ function onMoreEnter() {
310
+ closeFlyout();
311
+ closeTooltip(true);
312
+ cancelMoreClose();
313
+ moreOpen.value = true;
314
+ }
315
+ function onMoreClick(event) {
316
+ closeFlyout();
317
+ cancelMoreClose();
318
+ const fromKeyboard = event.detail === 0;
319
+ moreOpen.value = fromKeyboard ? !moreOpen.value : true;
320
+ if (moreOpen.value && fromKeyboard) {
321
+ nextTick(() => {
322
+ var _a, _b;
323
+ return (_b = (_a = moreContentRef.value) == null ? void 0 : _a.querySelector(".vc-nav-sidebar-link")) == null ? void 0 : _b.focus();
324
+ });
325
+ }
326
+ }
327
+ function cancelMoreClose() {
328
+ clearTimeout(moreTimer);
329
+ }
330
+ function scheduleMoreClose() {
331
+ clearTimeout(moreTimer);
332
+ moreTimer = setTimeout(() => {
333
+ var _a;
334
+ const focused = document.activeElement;
335
+ if (focused && ((_a = moreContentRef.value) == null ? void 0 : _a.contains(focused))) {
336
+ return;
337
+ }
338
+ moreOpen.value = false;
339
+ }, CLOSE_DELAY);
340
+ }
341
+ function closeMore(refocus = false) {
342
+ var _a;
343
+ clearTimeout(moreTimer);
344
+ moreOpen.value = false;
345
+ if (refocus) {
346
+ (_a = moreButtonRef.value) == null ? void 0 : _a.focus();
347
+ }
348
+ }
349
+ const tooltip = reactive({
350
+ open: false,
351
+ target: null,
352
+ link: null
353
+ });
354
+ let tooltipTimer;
355
+ let pointerInTooltip = false;
356
+ function openTooltip(target, link) {
357
+ clearTimeout(tooltipTimer);
358
+ tooltip.target = target;
359
+ tooltip.link = link;
360
+ tooltip.open = true;
361
+ }
362
+ function cancelTooltipClose() {
363
+ clearTimeout(tooltipTimer);
364
+ }
365
+ function closeTooltip(immediately = false, refocus = false) {
366
+ clearTimeout(tooltipTimer);
367
+ const close = () => {
368
+ const target = tooltip.target;
369
+ tooltip.open = false;
370
+ if (refocus) {
371
+ target == null ? void 0 : target.focus();
372
+ }
373
+ };
374
+ if (immediately) {
375
+ close();
376
+ return;
377
+ }
378
+ tooltipTimer = setTimeout(() => {
379
+ var _a;
380
+ const focused = document.activeElement;
381
+ if (pointerInTooltip || focused && ((_a = tooltipRef.value) == null ? void 0 : _a.contains(focused))) {
382
+ return;
383
+ }
384
+ close();
385
+ }, CLOSE_DELAY);
386
+ }
387
+ function onTooltipEnter() {
388
+ pointerInTooltip = true;
389
+ cancelTooltipClose();
390
+ cancelFlyoutClose();
391
+ }
392
+ function onTooltipLeave(event) {
393
+ var _a;
394
+ pointerInTooltip = false;
395
+ closeTooltip();
396
+ const next = event.relatedTarget instanceof Node ? event.relatedTarget : null;
397
+ if (!next || !((_a = rootRef.value) == null ? void 0 : _a.contains(next))) {
398
+ scheduleFlyoutClose();
399
+ }
400
+ }
401
+ function onTooltipFocusOut(event) {
402
+ var _a, _b;
403
+ const next = event.relatedTarget instanceof Node ? event.relatedTarget : null;
404
+ if (next && ((_a = tooltipRef.value) == null ? void 0 : _a.contains(next))) {
405
+ return;
406
+ }
407
+ closeTooltip();
408
+ if (!next || !((_b = rootRef.value) == null ? void 0 : _b.contains(next))) {
409
+ scheduleFlyoutClose();
410
+ }
411
+ }
412
+ provide(NAVIGATION_SIDEBAR_KEY, {
413
+ slots,
414
+ // No hover on a phone: the tooltips stay closed.
415
+ tooltips: () => props.tooltips && !isMobile.value,
416
+ openTooltip,
417
+ closeTooltip,
418
+ select(link, event) {
419
+ emit("select", link, event);
420
+ emit("update:active", link.key);
421
+ }
422
+ });
423
+ onClickOutside(rootRef, () => {
424
+ if (!pointerInTooltip) {
425
+ closeFlyout();
426
+ }
427
+ }, { ignore: [tooltipRef] });
428
+ onClickOutside(moreContentRef, () => {
429
+ if (moreOpen.value) {
430
+ moreOpen.value = false;
431
+ }
432
+ }, { ignore: [moreButtonRef] });
433
+ onMounted(() => {
434
+ measureList();
435
+ });
436
+ onBeforeUnmount(() => {
437
+ clearTimeout(flyoutTimer);
438
+ clearTimeout(moreTimer);
439
+ clearTimeout(tooltipTimer);
440
+ });
441
+ __expose({
442
+ /** Closes the flyout panel, More and the tooltip */
443
+ close() {
444
+ closeFlyout();
445
+ closeMore();
446
+ closeTooltip(true);
447
+ },
448
+ /** Expands or collapses the sidebar */
449
+ toggle: toggleExpanded,
450
+ /** Shows the pages of a group: in the docked panel when expanded, else in the flyout panel */
451
+ openGroup(key) {
452
+ if (!groups.value.some((group) => group.key === key)) {
453
+ return;
454
+ }
455
+ closeMore();
456
+ if (dockedGroup.value) {
457
+ viewedKey.value = key;
458
+ } else {
459
+ flyoutKey.value = key;
460
+ }
461
+ }
462
+ });
463
+ return (_ctx, _cache) => {
464
+ return openBlock(), createElementBlock("aside", {
465
+ ref_key: "rootRef",
466
+ ref: rootRef,
467
+ class: normalizeClass(["vc-nav-sidebar", {
468
+ "is--expanded": isExpanded.value,
469
+ "is--mobile": isMobile.value,
470
+ "is--open": isMobile.value && unref(mobileOpenModel),
471
+ "is--wide": isWide.value,
472
+ "is--docked": Boolean(dockedGroup.value),
473
+ "is--flyout": Boolean(flyoutGroup.value)
474
+ }]),
475
+ style: normalizeStyle(rootStyle.value),
476
+ "aria-label": __props.ariaLabel || unref(tVU).t("voicenterUi.navigationSidebar.label"),
477
+ "data-test": __props.dataTestName,
478
+ inert: isMobile.value && !unref(mobileOpenModel),
479
+ onMouseenter: cancelFlyoutClose,
480
+ onMouseleave: scheduleFlyoutClose,
481
+ onFocusout: onFocusOut,
482
+ onKeydown: withKeys(onEscape, ["esc"])
483
+ }, [
484
+ _ctx.$slots.header || __props.collapsible || isMobile.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
485
+ createElementVNode("div", _hoisted_3, [
486
+ renderSlot(_ctx.$slots, "header", {
487
+ expanded: isExpanded.value,
488
+ toggle: toggleExpanded
489
+ })
490
+ ]),
491
+ __props.collapsible && !isMobile.value ? (openBlock(), createElementBlock("button", {
492
+ key: 0,
493
+ type: "button",
494
+ class: "vc-nav-sidebar__toggle",
495
+ "aria-label": unref(expandedModel) ? unref(tVU).t("voicenterUi.navigationSidebar.collapse") : unref(tVU).t("voicenterUi.navigationSidebar.expand"),
496
+ "aria-expanded": unref(expandedModel),
497
+ "data-test": "vc-nav-sidebar-toggle",
498
+ onClick: toggleExpanded
499
+ }, [
500
+ createVNode(_sfc_main$1, { icon: toggleIcon.value }, null, 8, ["icon"])
501
+ ], 8, _hoisted_4)) : createCommentVNode("", true),
502
+ isMobile.value ? (openBlock(), createElementBlock("button", {
503
+ key: 1,
504
+ ref_key: "mobileCloseRef",
505
+ ref: mobileCloseRef,
506
+ type: "button",
507
+ class: "vc-nav-sidebar__close",
508
+ "aria-label": unref(tVU).t("voicenterUi.navigationSidebar.close"),
509
+ "data-test": "vc-nav-sidebar-close",
510
+ onClick: closeMobile
511
+ }, [
512
+ createVNode(_sfc_main$1, { icon: unref(X) }, null, 8, ["icon"])
513
+ ], 8, _hoisted_5)) : createCommentVNode("", true)
514
+ ])) : createCommentVNode("", true),
515
+ isMobile.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
516
+ createElementVNode("div", _hoisted_6, [
517
+ createVNode(_sfc_main$2, {
518
+ id: unref(panelId),
519
+ items: __props.items,
520
+ active: __props.active,
521
+ onNavigate: closeMobile
522
+ }, null, 8, ["id", "items", "active"])
523
+ ]),
524
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_7, [
525
+ renderSlot(_ctx.$slots, "footer", { expanded: true })
526
+ ])) : createCommentVNode("", true)
527
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_8, [
528
+ createElementVNode("div", _hoisted_9, [
529
+ createElementVNode("ul", {
530
+ ref_key: "listRef",
531
+ ref: listRef,
532
+ class: "vc-nav-sidebar__list"
533
+ }, [
534
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
535
+ return openBlock(), createElementBlock("li", {
536
+ key: item.key,
537
+ class: "vc-nav-sidebar__list-item"
538
+ }, [
539
+ unref(isNavigationGroup)(item) ? (openBlock(), createElementBlock("button", {
540
+ key: 0,
541
+ ref_for: true,
542
+ ref: (el) => setGroupButton(item.key, el),
543
+ type: "button",
544
+ class: normalizeClass(["vc-nav-sidebar__group", {
545
+ "is--active": unref(isItemActive)(item, activeKeys.value),
546
+ "is--open": openGroupKey.value === item.key
547
+ }]),
548
+ "aria-expanded": openGroupKey.value === item.key,
549
+ "aria-controls": openGroupKey.value === item.key ? unref(panelId) : void 0,
550
+ "data-test": `vc-nav-sidebar-group-${item.key}`,
551
+ onMouseenter: ($event) => onGroupEnter(item),
552
+ onClick: ($event) => onGroupClick(item, $event)
553
+ }, [
554
+ unref(isItemActive)(item, activeKeys.value) && (!item.icon || _ctx.$slots.item) ? (openBlock(), createElementBlock("span", _hoisted_11)) : createCommentVNode("", true),
555
+ renderSlot(_ctx.$slots, "item", {
556
+ item,
557
+ active: unref(isItemActive)(item, activeKeys.value),
558
+ open: openGroupKey.value === item.key,
559
+ expanded: isExpanded.value
560
+ }, () => [
561
+ item.icon ? (openBlock(), createElementBlock("span", _hoisted_12, [
562
+ unref(isItemActive)(item, activeKeys.value) ? (openBlock(), createElementBlock("span", _hoisted_13)) : createCommentVNode("", true),
563
+ createVNode(_sfc_main$1, {
564
+ icon: item.icon
565
+ }, null, 8, ["icon"])
566
+ ])) : createCommentVNode("", true),
567
+ createElementVNode("span", _hoisted_14, toDisplayString(item.label), 1)
568
+ ])
569
+ ], 42, _hoisted_10)) : (openBlock(), createBlock(_sfc_main$3, {
570
+ key: 1,
571
+ link: item,
572
+ active: item.key === activeRailLink.value,
573
+ layout: isWide.value ? "row" : "rail",
574
+ onMouseenter: closeFlyout
575
+ }, null, 8, ["link", "active", "layout"]))
576
+ ]);
577
+ }), 128))
578
+ ], 512),
579
+ overflowItems.value.length ? (openBlock(), createBlock(_sfc_main$4, {
580
+ key: 0,
581
+ open: moreOpen.value,
582
+ trigger: "manual",
583
+ placement: unref(isRTL) ? "left-start" : "right-start",
584
+ "popover-width": moreWidth.value,
585
+ "popover-class": ["vc-nav-sidebar-more", __props.popoverClass].filter(Boolean).join(" "),
586
+ offset: 4
587
+ }, {
588
+ reference: withCtx(() => [
589
+ createElementVNode("button", {
590
+ ref_key: "moreButtonRef",
591
+ ref: moreButtonRef,
592
+ type: "button",
593
+ class: normalizeClass(["vc-nav-sidebar__group vc-nav-sidebar__more", { "is--active": overflowActive.value, "is--open": moreOpen.value }]),
594
+ "aria-expanded": moreOpen.value,
595
+ "aria-haspopup": "true",
596
+ "data-test": "vc-nav-sidebar-more",
597
+ onMouseenter: onMoreEnter,
598
+ onMouseleave: scheduleMoreClose,
599
+ onClick: onMoreClick
600
+ }, [
601
+ createElementVNode("span", _hoisted_16, [
602
+ overflowActive.value ? (openBlock(), createElementBlock("span", _hoisted_17)) : createCommentVNode("", true),
603
+ createVNode(_sfc_main$1, { icon: unref(Ellipsis) }, null, 8, ["icon"])
604
+ ]),
605
+ createElementVNode("span", _hoisted_18, toDisplayString(unref(tVU).t("voicenterUi.navigationSidebar.more")), 1)
606
+ ], 42, _hoisted_15)
607
+ ]),
608
+ default: withCtx(() => [
609
+ createVNode(_sfc_main$5, {
610
+ ref_key: "moreRef",
611
+ ref: moreRef,
612
+ items: overflowItems.value,
613
+ active: __props.active,
614
+ onMouseenter: cancelMoreClose,
615
+ onMouseleave: scheduleMoreClose,
616
+ onKeydown: _cache[0] || (_cache[0] = withKeys(withModifiers(($event) => closeMore(true), ["stop"]), ["esc"])),
617
+ onNavigate: _cache[1] || (_cache[1] = ($event) => closeMore())
618
+ }, null, 8, ["items", "active"])
619
+ ]),
620
+ _: 1
621
+ }, 8, ["open", "placement", "popover-width", "popover-class"])) : createCommentVNode("", true),
622
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_19, [
623
+ renderSlot(_ctx.$slots, "footer", { expanded: isExpanded.value })
624
+ ])) : createCommentVNode("", true)
625
+ ]),
626
+ dockedGroup.value ? (openBlock(), createBlock(_sfc_main$6, {
627
+ id: unref(panelId),
628
+ key: dockedGroup.value.key,
629
+ class: normalizeClass(["vc-nav-sidebar__docked", __props.panelClass]),
630
+ group: dockedGroup.value,
631
+ active: __props.active,
632
+ onInfoAction: _cache[2] || (_cache[2] = ($event) => emit("info-action", $event))
633
+ }, createSlots({ _: 2 }, [
634
+ _ctx.$slots["panel-footer"] ? {
635
+ name: "footer",
636
+ fn: withCtx(() => [
637
+ renderSlot(_ctx.$slots, "panel-footer", { group: dockedGroup.value })
638
+ ]),
639
+ key: "0"
640
+ } : void 0
641
+ ]), 1032, ["id", "class", "group", "active"])) : createCommentVNode("", true)
642
+ ])),
643
+ flyoutGroup.value ? (openBlock(), createBlock(_sfc_main$6, {
644
+ id: unref(panelId),
645
+ key: flyoutGroup.value.key,
646
+ class: normalizeClass(["vc-nav-sidebar__flyout", __props.panelClass]),
647
+ group: flyoutGroup.value,
648
+ active: __props.active,
649
+ onInfoAction: _cache[3] || (_cache[3] = ($event) => emit("info-action", $event)),
650
+ onNavigate: closeFlyout
651
+ }, createSlots({
652
+ "header-action": withCtx(() => [
653
+ __props.collapsible ? (openBlock(), createElementBlock("button", {
654
+ key: 0,
655
+ type: "button",
656
+ class: "vc-nav-sidebar__pin",
657
+ "aria-label": unref(tVU).t("voicenterUi.navigationSidebar.expand"),
658
+ "data-test": "vc-nav-sidebar-pin",
659
+ onClick: pinFlyout
660
+ }, [
661
+ createVNode(_sfc_main$1, {
662
+ icon: unref(isRTL) ? unref(PanelRightOpen) : unref(PanelLeftOpen)
663
+ }, null, 8, ["icon"])
664
+ ], 8, _hoisted_20)) : createCommentVNode("", true)
665
+ ]),
666
+ _: 2
667
+ }, [
668
+ _ctx.$slots["panel-footer"] ? {
669
+ name: "footer",
670
+ fn: withCtx(() => [
671
+ renderSlot(_ctx.$slots, "panel-footer", { group: flyoutGroup.value })
672
+ ]),
673
+ key: "0"
674
+ } : void 0
675
+ ]), 1032, ["id", "class", "group", "active"])) : createCommentVNode("", true),
676
+ tooltip.target ? (openBlock(), createBlock(unref(ElPopover), {
677
+ key: 4,
678
+ visible: tooltip.open,
679
+ "virtual-ref": tooltip.target,
680
+ "virtual-triggering": "",
681
+ placement: unref(isRTL) ? "left-start" : "right-start",
682
+ "fallback-placements": unref(isRTL) ? ["right-start"] : ["left-start"],
683
+ "popper-class": ["vc-popover vc-nav-sidebar-tooltip", __props.popoverClass].filter(Boolean).join(" "),
684
+ teleported: true,
685
+ persistent: false,
686
+ "gpu-acceleration": false,
687
+ offset: 6,
688
+ "show-arrow": false,
689
+ width: "auto",
690
+ pure: ""
691
+ }, {
692
+ default: withCtx(() => [
693
+ tooltip.link ? (openBlock(), createElementBlock("div", {
694
+ key: 0,
695
+ ref_key: "tooltipRef",
696
+ ref: tooltipRef,
697
+ class: "vc-nav-sidebar-tooltip__content",
698
+ role: "tooltip",
699
+ "data-test": `vc-nav-sidebar-tooltip-${tooltip.link.key}`,
700
+ onMouseenter: onTooltipEnter,
701
+ onMouseleave: onTooltipLeave,
702
+ onFocusin: cancelTooltipClose,
703
+ onFocusout: onTooltipFocusOut,
704
+ onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => closeTooltip(true, true), ["stop"]), ["esc"]))
705
+ }, [
706
+ renderSlot(_ctx.$slots, "tooltip", {
707
+ link: tooltip.link
708
+ }, () => [
709
+ createElementVNode("div", _hoisted_22, [
710
+ createElementVNode("span", _hoisted_23, toDisplayString(tooltip.link.label), 1),
711
+ tooltip.link.docsUrl ? (openBlock(), createElementBlock("a", {
712
+ key: 0,
713
+ href: tooltip.link.docsUrl,
714
+ target: "_blank",
715
+ rel: "noopener noreferrer",
716
+ class: "vc-nav-sidebar-tooltip__docs",
717
+ "aria-label": `${unref(tVU).t("voicenterUi.navigationSidebar.openDocs")}: ${tooltip.link.label}`,
718
+ title: unref(tVU).t("voicenterUi.navigationSidebar.openDocs"),
719
+ "data-test": "vc-nav-sidebar-tooltip-docs",
720
+ onClick: _cache[4] || (_cache[4] = ($event) => emit("docs", tooltip.link))
721
+ }, [
722
+ createVNode(_sfc_main$1, { icon: unref(BookOpen) }, null, 8, ["icon"])
723
+ ], 8, _hoisted_24)) : createCommentVNode("", true)
724
+ ]),
725
+ tooltip.link.description ? (openBlock(), createElementBlock("p", _hoisted_25, toDisplayString(tooltip.link.description), 1)) : createCommentVNode("", true)
726
+ ])
727
+ ], 40, _hoisted_21)) : createCommentVNode("", true)
728
+ ]),
729
+ _: 3
730
+ }, 8, ["visible", "virtual-ref", "placement", "fallback-placements", "popper-class"])) : createCommentVNode("", true)
731
+ ], 46, _hoisted_1);
732
+ };
733
+ }
734
+ });
735
+ export {
736
+ _sfc_main as default
737
+ };