@knime/kds-components 0.29.2 → 0.30.0

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, createPropsRestProxy, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, Fragment, renderList, createBlock, normalizeStyle, createCommentVNode, shallowRef, markRaw, readonly, toRef, unref, resolveDynamicComponent, useTemplateRef, createVNode, withCtx, renderSlot, mergeProps, h as h$1, useSlots, getCurrentInstance, useModel, mergeModels, onMounted, onUnmounted, nextTick, useId, withModifiers, watchEffect, useAttrs, withKeys, isRef, getCurrentScope, onScopeDispose, defineAsyncComponent, toRefs, useCssVars, createSlots, normalizeProps, withDirectives, vShow, onBeforeUpdate, onBeforeUnmount, vModelText, createTextVNode, guardReactiveProps } from 'vue';
1
+ import { defineComponent, createPropsRestProxy, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, Fragment, renderList, createBlock, normalizeStyle, createCommentVNode, shallowRef, markRaw, readonly, toRef, unref, resolveDynamicComponent, mergeProps, useTemplateRef, createVNode, withCtx, renderSlot, h as h$1, useSlots, getCurrentInstance, useModel, mergeModels, onMounted, onUnmounted, nextTick, useId, withModifiers, inject, provide, resolveComponent, withKeys, watchEffect, useAttrs, isRef, getCurrentScope, onScopeDispose, defineAsyncComponent, toRefs, useCssVars, createSlots, normalizeProps, withDirectives, vShow, onBeforeUpdate, onBeforeUnmount, vModelText, createTextVNode, guardReactiveProps } from 'vue';
2
2
  import { useLocalStorage, useDark, usePreferredDark, useResizeObserver, useMutationObserver, onClickOutside, useElementSize, useMousePressed, useVirtualList, useTemplateRefsList } from '@vueuse/core';
3
3
 
4
4
  import './index.css';const kdsAvatarSize = {
@@ -9,14 +9,14 @@ import './index.css';const kdsAvatarSize = {
9
9
  };
10
10
  const kdsAvatarSizes = Object.values(kdsAvatarSize);
11
11
 
12
- const _hoisted_1$14 = ["role", "title", "aria-hidden", "aria-label", "data-color"];
13
- const _hoisted_2$F = ["src"];
12
+ const _hoisted_1$15 = ["role", "title", "aria-hidden", "aria-label", "data-color"];
13
+ const _hoisted_2$H = ["src"];
14
14
  const _hoisted_3$u = {
15
15
  key: 1,
16
16
  class: "kds-avatar-initials",
17
17
  "aria-hidden": "true"
18
18
  };
19
- const _sfc_main$1F = /* @__PURE__ */ defineComponent({
19
+ const _sfc_main$1G = /* @__PURE__ */ defineComponent({
20
20
  __name: "KdsAvatar",
21
21
  props: {
22
22
  initials: {},
@@ -80,10 +80,10 @@ const _sfc_main$1F = /* @__PURE__ */ defineComponent({
80
80
  alt: "",
81
81
  "aria-hidden": "true",
82
82
  onError: onImageError
83
- }, null, 40, _hoisted_2$F)) : (openBlock(), createElementBlock("div", _hoisted_3$u, [
83
+ }, null, 40, _hoisted_2$H)) : (openBlock(), createElementBlock("div", _hoisted_3$u, [
84
84
  createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)
85
85
  ]))
86
- ], 10, _hoisted_1$14);
86
+ ], 10, _hoisted_1$15);
87
87
  };
88
88
  }
89
89
  });
@@ -96,16 +96,16 @@ const _export_sfc = (sfc, props) => {
96
96
  return target;
97
97
  };
98
98
 
99
- const KdsAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["__scopeId", "data-v-9e1a5abe"]]);
99
+ const KdsAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__scopeId", "data-v-9e1a5abe"]]);
100
100
 
101
- const _hoisted_1$13 = ["aria-label"];
102
- const _hoisted_2$E = { class: "avatars" };
101
+ const _hoisted_1$14 = ["aria-label"];
102
+ const _hoisted_2$G = { class: "avatars" };
103
103
  const _hoisted_3$t = {
104
104
  key: 0,
105
105
  class: "more-count",
106
106
  "aria-hidden": "true"
107
107
  };
108
- const _sfc_main$1E = /* @__PURE__ */ defineComponent({
108
+ const _sfc_main$1F = /* @__PURE__ */ defineComponent({
109
109
  __name: "KdsAvatarCounter",
110
110
  props: {
111
111
  moreCount: { default: 0 },
@@ -125,7 +125,7 @@ const _sfc_main$1E = /* @__PURE__ */ defineComponent({
125
125
  role: "group",
126
126
  "aria-label": ariaLabel.value
127
127
  }, [
128
- createElementVNode("div", _hoisted_2$E, [
128
+ createElementVNode("div", _hoisted_2$G, [
129
129
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.avatars, (avatar, index) => {
130
130
  return openBlock(), createBlock(KdsAvatar, {
131
131
  key: index,
@@ -140,12 +140,12 @@ const _sfc_main$1E = /* @__PURE__ */ defineComponent({
140
140
  }), 128))
141
141
  ]),
142
142
  __props.moreCount > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$t, " +" + toDisplayString(__props.moreCount), 1)) : createCommentVNode("", true)
143
- ], 8, _hoisted_1$13);
143
+ ], 8, _hoisted_1$14);
144
144
  };
145
145
  }
146
146
  });
147
147
 
148
- const KdsAvatarCounter = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__scopeId", "data-v-1aef516d"]]);
148
+ const KdsAvatarCounter = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["__scopeId", "data-v-1aef516d"]]);
149
149
 
150
150
  const __variableDynamicImportRuntimeHelper = (glob$1, path$13, segs) => {
151
151
  const v = glob$1[path$13];
@@ -202,7 +202,7 @@ function useIcon({
202
202
  };
203
203
  }
204
204
 
205
- const _sfc_main$1D = /* @__PURE__ */ defineComponent({
205
+ const _sfc_main$1E = /* @__PURE__ */ defineComponent({
206
206
  __name: "KdsIcon",
207
207
  props: {
208
208
  name: {},
@@ -232,7 +232,7 @@ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
232
232
  }
233
233
  });
234
234
 
235
- const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-bff4f419"]]);
235
+ const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__scopeId", "data-v-bff4f419"]]);
236
236
 
237
237
  const ID_TO_ICON_MAP = {
238
238
  // Flow Variables
@@ -584,8 +584,8 @@ const kdsDataTypeSize = {
584
584
  };
585
585
  const kdsDataTypeSizes = Object.values(kdsDataTypeSize);
586
586
 
587
- const _hoisted_1$12 = ["title"];
588
- const _sfc_main$1C = /* @__PURE__ */ defineComponent({
587
+ const _hoisted_1$13 = ["title"];
588
+ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
589
589
  __name: "KdsDataType",
590
590
  props: {
591
591
  iconName: { default: "unknown-datatype" },
@@ -626,12 +626,12 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
626
626
  "aria-hidden": "true",
627
627
  focusable: "false"
628
628
  }, null, 8, ["class"]))
629
- ], 10, _hoisted_1$12);
629
+ ], 10, _hoisted_1$13);
630
630
  };
631
631
  }
632
632
  });
633
633
 
634
- const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-38e9537f"]]);
634
+ const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-38e9537f"]]);
635
635
 
636
636
  const kdsBadgeVariant = {
637
637
  NEUTRAL: "neutral",
@@ -648,8 +648,8 @@ const kdsBadgeSize = {
648
648
  };
649
649
  const kdsBadgeSizes = Object.values(kdsBadgeSize);
650
650
 
651
- const _hoisted_1$11 = { class: "label-wrapper" };
652
- const _sfc_main$1B = /* @__PURE__ */ defineComponent({
651
+ const _hoisted_1$12 = { class: "label-wrapper" };
652
+ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
653
653
  __name: "KdsBadge",
654
654
  props: {
655
655
  label: {},
@@ -671,13 +671,70 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
671
671
  name: __props.leadingIcon,
672
672
  size: sizeToIconSize[__props.size]
673
673
  }, null, 8, ["name", "size"])) : createCommentVNode("", true),
674
- createElementVNode("span", _hoisted_1$11, toDisplayString(__props.label), 1)
674
+ createElementVNode("span", _hoisted_1$12, toDisplayString(__props.label), 1)
675
675
  ], 2);
676
676
  };
677
677
  }
678
678
  });
679
679
 
680
- const KdsBadge = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-df64f7cf"]]);
680
+ const KdsBadge = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-df64f7cf"]]);
681
+
682
+ const kdsProgressBarSize = {
683
+ MEDIUM: "medium",
684
+ LARGE: "large"
685
+ };
686
+ const kdsProgressBarSizes = Object.values(kdsProgressBarSize);
687
+
688
+ const _hoisted_1$11 = ["title", "aria-label"];
689
+ const _hoisted_2$F = {
690
+ key: 0,
691
+ class: "indeterminate-bar",
692
+ "aria-hidden": "true"
693
+ };
694
+ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
695
+ __name: "KdsProgressBar",
696
+ props: {
697
+ size: { default: () => kdsProgressBarSize.MEDIUM },
698
+ title: { default: "" },
699
+ percentage: { default: 0 },
700
+ indeterminate: { type: Boolean, default: false }
701
+ },
702
+ setup(__props) {
703
+ const progressValue = computed(() => {
704
+ if (Number.isNaN(__props.percentage)) {
705
+ return 0;
706
+ }
707
+ return Math.min(Math.max(__props.percentage, 0), 100);
708
+ });
709
+ const title = computed(() => {
710
+ const customTitle = (__props.title ?? "").trim();
711
+ if (customTitle) {
712
+ return customTitle;
713
+ }
714
+ return __props.indeterminate ? "Loading" : `Progress: ${progressValue.value}%`;
715
+ });
716
+ return (_ctx, _cache) => {
717
+ return openBlock(), createElementBlock("div", {
718
+ class: normalizeClass([
719
+ "kds-progress-bar",
720
+ {
721
+ "kds-progress-bar-large": __props.size === unref(kdsProgressBarSize).LARGE,
722
+ "kds-progress-bar-medium": __props.size !== unref(kdsProgressBarSize).LARGE
723
+ }
724
+ ])
725
+ }, [
726
+ createElementVNode("progress", mergeProps({
727
+ title: title.value,
728
+ "aria-label": title.value,
729
+ class: "progress"
730
+ }, __props.indeterminate ? {} : { value: progressValue.value, max: 100 }), null, 16, _hoisted_1$11),
731
+ __props.indeterminate ? (openBlock(), createElementBlock("span", _hoisted_2$F)) : createCommentVNode("", true)
732
+ ], 2);
733
+ };
734
+ }
735
+ });
736
+
737
+ const KdsProgressBar = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-5fdfbce2"]]);
681
738
 
682
739
  const kdsColorSwatchType = {
683
740
  LEARNER: "learner",
@@ -904,7 +961,7 @@ function useKdsIsTruncated(elementRef) {
904
961
  }
905
962
 
906
963
  const _hoisted_1$$ = ["title", "aria-label"];
907
- const _hoisted_2$D = ["title"];
964
+ const _hoisted_2$E = ["title"];
908
965
  const _sfc_main$1z = /* @__PURE__ */ defineComponent({
909
966
  __name: "KdsLiveStatus",
910
967
  props: {
@@ -934,7 +991,7 @@ const _sfc_main$1z = /* @__PURE__ */ defineComponent({
934
991
  ref: labelEl,
935
992
  class: "label",
936
993
  title: unref(isTruncated) ? __props.label : void 0
937
- }, toDisplayString(__props.label), 9, _hoisted_2$D)) : createCommentVNode("", true)
994
+ }, toDisplayString(__props.label), 9, _hoisted_2$E)) : createCommentVNode("", true)
938
995
  ], 10, _hoisted_1$$);
939
996
  };
940
997
  }
@@ -998,7 +1055,7 @@ const kdsLoadingSpinnerVariants = Object.values(
998
1055
  );
999
1056
 
1000
1057
  const _hoisted_1$Z = ["role"];
1001
- const _hoisted_2$C = { class: "header" };
1058
+ const _hoisted_2$D = { class: "header" };
1002
1059
  const _hoisted_3$s = { class: "headline" };
1003
1060
  const _hoisted_4$o = {
1004
1061
  key: 0,
@@ -1035,7 +1092,7 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
1035
1092
  class: normalizeClass(classes.value),
1036
1093
  role: role.value
1037
1094
  }, [
1038
- createElementVNode("div", _hoisted_2$C, [
1095
+ createElementVNode("div", _hoisted_2$D, [
1039
1096
  createVNode(KdsIcon, {
1040
1097
  class: "icon",
1041
1098
  name: iconName.value,
@@ -1078,7 +1135,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
1078
1135
  const KdsMissingValueIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-df682150"]]);
1079
1136
 
1080
1137
  const _hoisted_1$Y = { class: "donut-container" };
1081
- const _hoisted_2$B = ["height", "width", "viewBox"];
1138
+ const _hoisted_2$C = ["height", "width", "viewBox"];
1082
1139
  const _hoisted_3$r = ["r", "stroke-width"];
1083
1140
  const _hoisted_4$n = ["r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"];
1084
1141
  const _hoisted_5$d = ["r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"];
@@ -1176,7 +1233,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
1176
1233
  fill: "transparent",
1177
1234
  transform: transformWedge.value
1178
1235
  }, null, 10, _hoisted_5$d)) : createCommentVNode("", true)
1179
- ], 8, _hoisted_2$B)),
1236
+ ], 8, _hoisted_2$C)),
1180
1237
  __props.title ? (openBlock(), createElementBlock("div", _hoisted_6$b, [
1181
1238
  createElementVNode("div", _hoisted_7$4, toDisplayString(__props.title), 1),
1182
1239
  __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$3, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)
@@ -1577,7 +1634,7 @@ function prettyBytes(number, options) {
1577
1634
  }
1578
1635
 
1579
1636
  const _hoisted_1$V = { class: "label" };
1580
- const _hoisted_2$A = {
1637
+ const _hoisted_2$B = {
1581
1638
  key: 1,
1582
1639
  class: "file-size"
1583
1640
  };
@@ -1677,7 +1734,7 @@ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
1677
1734
  name: "external-link",
1678
1735
  size: "xsmall"
1679
1736
  })) : createCommentVNode("", true),
1680
- normalizedFileSize.value ? (openBlock(), createElementBlock("span", _hoisted_2$A, toDisplayString(normalizedFileSize.value), 1)) : createCommentVNode("", true)
1737
+ normalizedFileSize.value ? (openBlock(), createElementBlock("span", _hoisted_2$B, toDisplayString(normalizedFileSize.value), 1)) : createCommentVNode("", true)
1681
1738
  ]),
1682
1739
  _: 1
1683
1740
  }, 8, ["class", "to", "download", "target", "rel", "title", "aria-disabled"]);
@@ -1725,7 +1782,7 @@ const kdsToggleButtonVariant = {
1725
1782
  const kdsToggleButtonVariants = Object.values(kdsToggleButtonVariant);
1726
1783
 
1727
1784
  const _hoisted_1$U = ["data-visible"];
1728
- const _hoisted_2$z = ["data-visible"];
1785
+ const _hoisted_2$A = ["data-visible"];
1729
1786
  const _sfc_main$1o = /* @__PURE__ */ defineComponent({
1730
1787
  __name: "KdsProgressButton",
1731
1788
  props: /* @__PURE__ */ mergeModels({
@@ -1797,7 +1854,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
1797
1854
  size: iconSize.value,
1798
1855
  variant: __props.variant === "filled" ? "onPrimary" : "onSurface"
1799
1856
  }, null, 8, ["size", "variant"])
1800
- ], 8, _hoisted_2$z)
1857
+ ], 8, _hoisted_2$A)
1801
1858
  ], 2)
1802
1859
  ]),
1803
1860
  _: 1
@@ -1828,7 +1885,8 @@ const useListItemKeyboardNav = (options) => {
1828
1885
  containerEl,
1829
1886
  selectableItems,
1830
1887
  enabledItems,
1831
- itemFocusStrategy = "persistent"
1888
+ itemFocusStrategy = "persistent",
1889
+ shouldNavigate = () => true
1832
1890
  } = options;
1833
1891
  const activeId = ref(void 0);
1834
1892
  function scrollToView() {
@@ -1857,6 +1915,9 @@ const useListItemKeyboardNav = (options) => {
1857
1915
  return enabledItems.value[currentIndex - 1].id;
1858
1916
  };
1859
1917
  const handleKeydown = (event) => {
1918
+ if (!shouldNavigate(event)) {
1919
+ return;
1920
+ }
1860
1921
  if (enabledItems.value.length === 0) {
1861
1922
  activeId.value = selectableItems.value.length === 0 ? options.emptyOptionId : void 0;
1862
1923
  return;
@@ -1876,6 +1937,14 @@ const useListItemKeyboardNav = (options) => {
1876
1937
  scrollToView();
1877
1938
  event.preventDefault();
1878
1939
  break;
1940
+ case "ArrowLeft":
1941
+ options.triggers?.onArrowLeft?.(activeId.value, targetItem);
1942
+ event.preventDefault();
1943
+ break;
1944
+ case "ArrowRight":
1945
+ options.triggers?.onArrowRight?.(activeId.value, targetItem);
1946
+ event.preventDefault();
1947
+ break;
1879
1948
  case "Enter":
1880
1949
  options.triggers?.onEnter?.(activeId.value, targetItem, event);
1881
1950
  event.preventDefault();
@@ -2077,7 +2146,7 @@ const kdsListItemAccessorySize = {
2077
2146
  };
2078
2147
 
2079
2148
  const _hoisted_1$T = ["id", "role", "aria-selected", "aria-disabled"];
2080
- const _hoisted_2$y = {
2149
+ const _hoisted_2$z = {
2081
2150
  key: 0,
2082
2151
  class: "accessory"
2083
2152
  };
@@ -2155,7 +2224,7 @@ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
2155
2224
  ]),
2156
2225
  onClick
2157
2226
  }, [
2158
- props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$y, [
2227
+ props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$z, [
2159
2228
  createVNode(_sfc_main$1n, {
2160
2229
  accessory: props.accessory,
2161
2230
  size: accessorySize.value,
@@ -2204,7 +2273,7 @@ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
2204
2273
  const KdsListItem = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__scopeId", "data-v-a3d6c86f"]]);
2205
2274
 
2206
2275
  const _hoisted_1$S = { class: "kds-list-item-section-title" };
2207
- const _hoisted_2$x = {
2276
+ const _hoisted_2$y = {
2208
2277
  key: 0,
2209
2278
  class: "icon"
2210
2279
  };
@@ -2221,7 +2290,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
2221
2290
  const { isTruncated } = useKdsIsTruncated(labelEl);
2222
2291
  return (_ctx, _cache) => {
2223
2292
  return openBlock(), createElementBlock("div", _hoisted_1$S, [
2224
- props.leadingIcon ? (openBlock(), createElementBlock("span", _hoisted_2$x, [
2293
+ props.leadingIcon ? (openBlock(), createElementBlock("span", _hoisted_2$y, [
2225
2294
  createVNode(KdsIcon, {
2226
2295
  name: props.leadingIcon,
2227
2296
  size: "small"
@@ -2248,7 +2317,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
2248
2317
  isLast: { type: Boolean },
2249
2318
  variant: {}
2250
2319
  },
2251
- emits: ["click"],
2320
+ emits: ["click", "mouseenter"],
2252
2321
  setup(__props, { expose: __expose }) {
2253
2322
  const props = __props;
2254
2323
  const linkEl = useTemplateRef(
@@ -2313,6 +2382,14 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
2313
2382
  const effectiveTo = computed(
2314
2383
  () => props.item.disabled ? void 0 : props.item.to
2315
2384
  );
2385
+ const hasChildren = computed(
2386
+ () => props.item.children && props.item.children.length > 0
2387
+ );
2388
+ const anchorId = useId();
2389
+ const anchorName = `--anchor-${anchorId}`;
2390
+ const anchorRootStyle = computed(
2391
+ () => hasChildren.value ? { anchorName } : {}
2392
+ );
2316
2393
  return (_ctx, _cache) => {
2317
2394
  return openBlock(), createElementBlock(Fragment, null, [
2318
2395
  __props.item.sectionHeadline ? (openBlock(), createBlock(unref(ListItemSectionTitle), mergeProps({
@@ -2336,7 +2413,8 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
2336
2413
  class: "kds-menu-item-link",
2337
2414
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
2338
2415
  }, ["prevent"])),
2339
- onClick: _cache[1] || (_cache[1] = ($event) => !__props.item.disabled && _ctx.$emit("click", $event))
2416
+ onClick: _cache[1] || (_cache[1] = ($event) => !__props.item.disabled && _ctx.$emit("click", $event)),
2417
+ onMouseenter: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("mouseenter", $event))
2340
2418
  }, {
2341
2419
  default: withCtx(() => [
2342
2420
  createVNode(unref(KdsListItem), mergeProps({
@@ -2354,7 +2432,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
2354
2432
  }, _ctx.$attrs), null, 16, ["id", "accessory", "text", "sub-text", "disabled", "active", "variant", "badge", "shortcut", "trailing-icon"])
2355
2433
  ]),
2356
2434
  _: 1
2357
- }, 40, ["id", "to", "download", "target", "rel", "aria-disabled"])) : (openBlock(), createBlock(unref(KdsListItem), mergeProps({
2435
+ }, 40, ["id", "to", "download", "target", "rel", "aria-disabled"])) : !hasChildren.value ? (openBlock(), createBlock(unref(KdsListItem), mergeProps({
2358
2436
  key: 2,
2359
2437
  id: __props.item.id,
2360
2438
  accessory: __props.item.accessory,
@@ -2368,22 +2446,46 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
2368
2446
  shortcut: __props.item.shortcut,
2369
2447
  role: "menuitem"
2370
2448
  }, _ctx.$attrs, {
2371
- onClick: _cache[2] || (_cache[2] = ($event) => !__props.item.disabled && _ctx.$emit("click", $event))
2372
- }), null, 16, ["id", "accessory", "text", "sub-text", "disabled", "active", "variant", "badge", "trailing-icon", "shortcut"])),
2373
- __props.item.separator && !__props.isLast ? (openBlock(), createBlock(unref(KdsDivider), {
2449
+ onClick: _cache[3] || (_cache[3] = ($event) => !__props.item.disabled && _ctx.$emit("click", $event)),
2450
+ onMouseenter: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("mouseenter", $event))
2451
+ }), null, 16, ["id", "accessory", "text", "sub-text", "disabled", "active", "variant", "badge", "trailing-icon", "shortcut"])) : (openBlock(), createBlock(unref(KdsListItem), mergeProps({
2374
2452
  key: 3,
2453
+ id: __props.item.id,
2454
+ accessory: __props.item.accessory,
2455
+ text: __props.item.text,
2456
+ "sub-text": __props.item.subText,
2457
+ disabled: __props.item.disabled,
2458
+ active: __props.activeId === __props.item.id,
2459
+ variant: __props.variant,
2460
+ "trailing-icon": "chevron-right",
2461
+ style: anchorRootStyle.value,
2462
+ role: "menuitem",
2463
+ "aria-haspopup": "menu"
2464
+ }, _ctx.$attrs, {
2465
+ onMouseenter: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("mouseenter", $event))
2466
+ }), null, 16, ["id", "accessory", "text", "sub-text", "disabled", "active", "variant", "style"])),
2467
+ __props.item.separator && !__props.isLast ? (openBlock(), createBlock(unref(KdsDivider), {
2468
+ key: 4,
2375
2469
  class: "kds-list-item-divider",
2376
2470
  role: "presentation",
2377
2471
  "aria-hidden": "true"
2378
- })) : createCommentVNode("", true)
2472
+ })) : createCommentVNode("", true),
2473
+ hasChildren.value ? renderSlot(_ctx.$slots, "children", {
2474
+ key: 5,
2475
+ anchor: { id: unref(anchorId), name: anchorName }
2476
+ }, void 0, true) : createCommentVNode("", true)
2379
2477
  ], 64);
2380
2478
  };
2381
2479
  }
2382
2480
  });
2383
2481
 
2384
- const KdsMenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-677d6ca6"]]);
2482
+ const KdsMenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-96d9cfba"]]);
2483
+
2484
+ const ContainerDepthKey = /* @__PURE__ */ Symbol("ContainerDepth");
2485
+ const ChildItemKey = /* @__PURE__ */ Symbol("ChildItem");
2385
2486
 
2386
2487
  const _hoisted_1$R = ["id", "aria-label", "aria-activedescendant"];
2488
+ const _hoisted_2$x = ["id"];
2387
2489
  const _sfc_main$1j = /* @__PURE__ */ defineComponent({
2388
2490
  __name: "KdsMenuContainer",
2389
2491
  props: {
@@ -2440,20 +2542,95 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
2440
2542
  }
2441
2543
  handleItemInteraction(item, event);
2442
2544
  };
2443
- const { activeId } = useListItemKeyboardNav({
2545
+ const activePopoverId = ref();
2546
+ const popovers = shallowRef({});
2547
+ const showPopover = (itemId) => {
2548
+ if (!itemId) {
2549
+ return void 0;
2550
+ }
2551
+ if (popovers.value[itemId]) {
2552
+ activePopoverId.value = itemId;
2553
+ popovers.value[itemId].showPopover?.();
2554
+ return popovers.value[itemId];
2555
+ }
2556
+ return void 0;
2557
+ };
2558
+ const closePopover = () => {
2559
+ if (activePopoverId.value) {
2560
+ popovers.value[activePopoverId.value]?.hidePopover?.();
2561
+ activePopoverId.value = void 0;
2562
+ }
2563
+ };
2564
+ const depth = inject(ContainerDepthKey, 0);
2565
+ const providedDepth = computed(() => depth + 1);
2566
+ const canRenderSubmenus = computed(() => depth < 2);
2567
+ provide(ContainerDepthKey, providedDepth.value);
2568
+ const parentList = inject(ChildItemKey, null);
2569
+ const validateItemChildren = (item) => {
2570
+ if (item.children) {
2571
+ return canRenderSubmenus.value ? item : { ...item, children: [] };
2572
+ }
2573
+ return item;
2574
+ };
2575
+ const hasChildren = (item) => {
2576
+ return item.children && item.children.length > 0;
2577
+ };
2578
+ const showPopoverByKeyboard = (activeId2) => {
2579
+ if (activeId2) {
2580
+ const activePopover = showPopover(activeId2);
2581
+ const containerComponent = activePopover?.querySelector(
2582
+ "[data-submenu-container]"
2583
+ );
2584
+ containerComponent?.focus();
2585
+ }
2586
+ };
2587
+ const { activeId, setActiveId } = useListItemKeyboardNav({
2444
2588
  containerEl,
2445
2589
  enabledItems,
2446
2590
  selectableItems,
2447
2591
  itemFocusStrategy: __props.itemFocusStrategy,
2592
+ // only allow navigation when the current menu has the focus
2593
+ shouldNavigate: (event) => {
2594
+ const rootNode = containerEl.value?.getRootNode();
2595
+ if (!rootNode) {
2596
+ return false;
2597
+ }
2598
+ const activeElement = rootNode.activeElement;
2599
+ return activeElement === event.target && activeElement === containerEl.value;
2600
+ },
2448
2601
  triggers: {
2449
- onEnter: (_activeId, item, event) => {
2450
- onKeyboardActivate(item, event);
2602
+ onEnter: (activeId2, item, event) => {
2603
+ if (item && hasChildren(validateItemChildren(item))) {
2604
+ showPopoverByKeyboard(activeId2);
2605
+ } else {
2606
+ onKeyboardActivate(item, event);
2607
+ }
2451
2608
  },
2452
2609
  onSpace: (_activeId, item, event) => {
2453
2610
  onKeyboardActivate(item, event);
2611
+ },
2612
+ // In this type of navigation
2613
+ // LEFT is treated as -> CLOSE
2614
+ onArrowLeft: () => {
2615
+ parentList?.closeActiveSubmenu({ requester: props.id });
2616
+ },
2617
+ // RIGHT is treated as -> OPEN
2618
+ onArrowRight: (activeId2, item) => {
2619
+ if (item && !hasChildren(validateItemChildren(item))) {
2620
+ return;
2621
+ }
2622
+ showPopoverByKeyboard(activeId2);
2454
2623
  }
2455
2624
  }
2456
2625
  });
2626
+ provide(ChildItemKey, {
2627
+ closeActiveSubmenu: () => {
2628
+ const lastActiveId = activePopoverId.value;
2629
+ closePopover();
2630
+ containerEl.value?.focus();
2631
+ setActiveId(lastActiveId);
2632
+ }
2633
+ });
2457
2634
  __expose({
2458
2635
  /**
2459
2636
  * Function to focus the outer container of the menu.
@@ -2463,7 +2640,18 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
2463
2640
  containerEl.value?.focus();
2464
2641
  }
2465
2642
  });
2643
+ const handleFocusOut = (event) => {
2644
+ if (event.relatedTarget && containerEl.value?.contains(event.relatedTarget)) {
2645
+ event.stopPropagation();
2646
+ if (containerEl.value === event.relatedTarget) {
2647
+ const lastActiveId = activePopoverId.value;
2648
+ closePopover();
2649
+ setActiveId(lastActiveId);
2650
+ }
2651
+ }
2652
+ };
2466
2653
  return (_ctx, _cache) => {
2654
+ const _component_KdsMenuContainer = resolveComponent("KdsMenuContainer", true);
2467
2655
  return openBlock(), createElementBlock("div", {
2468
2656
  id: props.id,
2469
2657
  ref_key: "containerEl",
@@ -2473,26 +2661,68 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
2473
2661
  "aria-label": __props.ariaLabel,
2474
2662
  tabindex: 0,
2475
2663
  style: normalizeStyle({ maxHeight: __props.menuMaxHeight }),
2476
- "aria-activedescendant": unref(activeId)
2664
+ "aria-activedescendant": unref(activeId) ?? activePopoverId.value,
2665
+ onMouseleave: closePopover,
2666
+ onFocusin: _cache[3] || (_cache[3] = withModifiers(($event) => activePopoverId.value = void 0, ["stop"])),
2667
+ onFocusout: handleFocusOut,
2668
+ onKeydown: _cache[4] || (_cache[4] = withKeys(
2669
+ () => {
2670
+ unref(parentList)?.closeActiveSubmenu({ requester: props.id });
2671
+ },
2672
+ ["esc"]
2673
+ ))
2477
2674
  }, [
2478
2675
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
2479
2676
  return openBlock(), createBlock(KdsMenuItem, {
2480
2677
  key: item.id,
2481
2678
  ref_for: true,
2482
2679
  ref: (el) => setItemRef(el, index),
2483
- item,
2680
+ item: validateItemChildren(item),
2484
2681
  "is-last": index === unref(itemsWithPrefix).length - 1,
2485
- "active-id": unref(activeId),
2682
+ "active-id": unref(activeId) ?? activePopoverId.value,
2486
2683
  variant: __props.variant,
2487
- onClick: ($event) => handleItemInteraction(item, $event)
2488
- }, null, 8, ["item", "is-last", "active-id", "variant", "onClick"]);
2684
+ onClick: ($event) => handleItemInteraction(item, $event),
2685
+ onMouseenter: () => {
2686
+ if (activePopoverId.value) {
2687
+ closePopover();
2688
+ }
2689
+ if (!item.disabled && hasChildren(item)) {
2690
+ showPopover(item.id);
2691
+ }
2692
+ }
2693
+ }, {
2694
+ children: withCtx(({ anchor }) => [
2695
+ createElementVNode("div", {
2696
+ id: anchor.id,
2697
+ ref_for: true,
2698
+ ref: (el) => {
2699
+ popovers.value[item.id] = el;
2700
+ },
2701
+ popover: "",
2702
+ class: "submenu-popover",
2703
+ style: normalizeStyle({ positionAnchor: anchor.name }),
2704
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => closePopover()),
2705
+ onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers(() => {
2706
+ }, ["stop", "prevent"]), ["esc"]))
2707
+ }, [
2708
+ createVNode(_component_KdsMenuContainer, {
2709
+ id: `${__props.id}:${item.id}`,
2710
+ "data-submenu-container": "",
2711
+ ariaLabel: `Submenu for item ${item.text}`,
2712
+ items: item.children ?? [],
2713
+ onItemClick: _cache[0] || (_cache[0] = ($event) => emit("itemClick", $event))
2714
+ }, null, 8, ["id", "ariaLabel", "items"])
2715
+ ], 44, _hoisted_2$x)
2716
+ ]),
2717
+ _: 2
2718
+ }, 1032, ["item", "is-last", "active-id", "variant", "onClick", "onMouseenter"]);
2489
2719
  }), 128))
2490
- ], 12, _hoisted_1$R);
2720
+ ], 44, _hoisted_1$R);
2491
2721
  };
2492
2722
  }
2493
2723
  });
2494
2724
 
2495
- const KdsMenuContainer = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__scopeId", "data-v-cce3fc40"]]);
2725
+ const KdsMenuContainer = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__scopeId", "data-v-9dc6d3f6"]]);
2496
2726
 
2497
2727
  const kdsPopoverPlacement = {
2498
2728
  TOP_LEFT: "top-left",
@@ -26006,5 +26236,5 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26006
26236
 
26007
26237
  const KdsDescription = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ed6ba7bb"]]);
26008
26238
 
26009
- export { KdsAccordion, KdsAvatar, KdsAvatarCounter, KdsBadge, KdsBreadcrumb, _sfc_main$1s as KdsButton, _sfc_main$h as KdsCard, _sfc_main$10 as KdsCheckbox, KdsCheckboxGroup, KdsClickableCard, _sfc_main$S as KdsColorInput, KdsColorSwatch, _sfc_main$1c as KdsContextMenu, KdsDataType, _sfc_main$L as KdsDateInput, _sfc_main$J as KdsDateTimeFormatInput, KdsDescription, KdsDivider, KdsDonutChart, _sfc_main$z as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsFileExplorer, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, _sfc_main$C as KdsIntervalInput, KdsLabel, KdsLink, _sfc_main$1r as KdsLinkButton, KdsLinkCard, KdsListContainer, KdsLiveStatus, KdsLoadingSkeleton, KdsLoadingSpinner, _sfc_main$1d as KdsMenu, _sfc_main$1h as KdsMenuButton, KdsMissingValueIcon, KdsModal, KdsModalLayout, _sfc_main$w as KdsMultiSelectDropdown, KdsNavItem, KdsNavigation, _sfc_main$V as KdsNumberInput, KdsPanel, _sfc_main$R as KdsPasswordInput, _sfc_main$I as KdsPatternInput, KdsPopover, KdsPreviewList, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, KdsResponsiveButtonGroup, KdsSearchInput, KdsSelectableCard, KdsSortableListBox, KdsSplitButton, KdsSubText, KdsTabBar, KdsTextInput, KdsTextarea, _sfc_main$E as KdsTimeInput, _sfc_main$1p as KdsToggleButton, KdsTwinList, _sfc_main$Q as KdsUsernameInput, KdsValueSwitch, KdsVariableToggleButton, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
26239
+ export { KdsAccordion, KdsAvatar, KdsAvatarCounter, KdsBadge, KdsBreadcrumb, _sfc_main$1s as KdsButton, _sfc_main$h as KdsCard, _sfc_main$10 as KdsCheckbox, KdsCheckboxGroup, KdsClickableCard, _sfc_main$S as KdsColorInput, KdsColorSwatch, _sfc_main$1c as KdsContextMenu, KdsDataType, _sfc_main$L as KdsDateInput, _sfc_main$J as KdsDateTimeFormatInput, KdsDescription, KdsDivider, KdsDonutChart, _sfc_main$z as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsFileExplorer, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, _sfc_main$C as KdsIntervalInput, KdsLabel, KdsLink, _sfc_main$1r as KdsLinkButton, KdsLinkCard, KdsListContainer, KdsLiveStatus, KdsLoadingSkeleton, KdsLoadingSpinner, _sfc_main$1d as KdsMenu, _sfc_main$1h as KdsMenuButton, KdsMissingValueIcon, KdsModal, KdsModalLayout, _sfc_main$w as KdsMultiSelectDropdown, KdsNavItem, KdsNavigation, _sfc_main$V as KdsNumberInput, KdsPanel, _sfc_main$R as KdsPasswordInput, _sfc_main$I as KdsPatternInput, KdsPopover, KdsPreviewList, KdsProgressBar, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, KdsResponsiveButtonGroup, KdsSearchInput, KdsSelectableCard, KdsSortableListBox, KdsSplitButton, KdsSubText, KdsTabBar, KdsTextInput, KdsTextarea, _sfc_main$E as KdsTimeInput, _sfc_main$1p as KdsToggleButton, KdsTwinList, _sfc_main$Q as KdsUsernameInput, KdsValueSwitch, KdsVariableToggleButton, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
26010
26240
  //# sourceMappingURL=index.js.map