@knime/kds-components 0.24.1 → 0.25.1

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 (28) hide show
  1. package/dist/index.css +80 -83
  2. package/dist/index.js +146 -126
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/buttons/BaseButton.vue.d.ts.map +1 -1
  5. package/dist/src/containers/ContextMenu/KdsContextMenu.vue.d.ts +22 -1
  6. package/dist/src/containers/ContextMenu/KdsContextMenu.vue.d.ts.map +1 -1
  7. package/dist/src/containers/ListContainer/KdsListContainer.vue.d.ts.map +1 -1
  8. package/dist/src/containers/ListContainer/types.d.ts +10 -5
  9. package/dist/src/containers/ListContainer/types.d.ts.map +1 -1
  10. package/dist/src/containers/MenuContainer/KdsMenuContainer.vue.d.ts.map +1 -1
  11. package/dist/src/containers/MenuContainer/types.d.ts +6 -0
  12. package/dist/src/containers/MenuContainer/types.d.ts.map +1 -1
  13. package/dist/src/containers/_helpers/types.d.ts +20 -0
  14. package/dist/src/containers/_helpers/types.d.ts.map +1 -0
  15. package/dist/src/containers/_helpers/useListItemKeyboardNav.d.ts +3 -1
  16. package/dist/src/containers/_helpers/useListItemKeyboardNav.d.ts.map +1 -1
  17. package/dist/src/forms/inputs/BaseInput.vue.d.ts.map +1 -1
  18. package/dist/src/forms/inputs/DateInput/KdsDateInput.vue.d.ts.map +1 -1
  19. package/dist/src/forms/inputs/DateInput/types.d.ts +4 -2
  20. package/dist/src/forms/inputs/DateInput/types.d.ts.map +1 -1
  21. package/dist/src/forms/inputs/NumberInput/KdsNumberInput.vue.d.ts.map +1 -1
  22. package/dist/src/forms/inputs/PasswordInput/KdsPasswordInput.vue.d.ts.map +1 -1
  23. package/dist/src/forms/inputs/SearchInput/KdsSearchInput.vue.d.ts.map +1 -1
  24. package/dist/src/forms/inputs/TimeInput/KdsTimeInput.vue.d.ts.map +1 -1
  25. package/dist/src/layouts/PanelHeader/KdsPanelHeader.vue.d.ts.map +1 -1
  26. package/package.json +2 -2
  27. package/dist/src/containers/ListContainer/enums.d.ts +0 -6
  28. package/dist/src/containers/ListContainer/enums.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, createPropsRestProxy, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, createCommentVNode, normalizeStyle, useTemplateRef, createVNode, withCtx, renderSlot, mergeProps, h as h$1, useSlots, getCurrentInstance, useModel, mergeModels, nextTick, onMounted, onUnmounted, readonly, toValue, useId, Fragment, renderList, watchEffect, useAttrs, withKeys, withModifiers, defineAsyncComponent, onBeforeUpdate, onBeforeUnmount, useCssVars, isRef, withDirectives, vModelText, createTextVNode, normalizeProps, createSlots, guardReactiveProps } from 'vue';
1
+ import { defineComponent, createPropsRestProxy, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, createCommentVNode, normalizeStyle, useTemplateRef, createVNode, withCtx, renderSlot, mergeProps, h as h$1, useSlots, getCurrentInstance, useModel, mergeModels, onMounted, onUnmounted, readonly, nextTick, useId, Fragment, renderList, watchEffect, useAttrs, withKeys, withModifiers, defineAsyncComponent, onBeforeUpdate, onBeforeUnmount, useCssVars, isRef, withDirectives, vModelText, createTextVNode, normalizeProps, createSlots, guardReactiveProps } from 'vue';
2
2
  import { useLocalStorage, useDark, usePreferredDark, useResizeObserver, useMutationObserver, useElementSize, useMousePressed, useVirtualList, useTemplateRefsList } from '@vueuse/core';
3
3
 
4
4
  import './index.css';const kdsAvatarSize = {
@@ -10,7 +10,7 @@ import './index.css';const kdsAvatarSize = {
10
10
  const kdsAvatarSizes = Object.values(kdsAvatarSize);
11
11
 
12
12
  const _hoisted_1$X = ["role", "title", "aria-hidden", "aria-label"];
13
- const _hoisted_2$y = ["src"];
13
+ const _hoisted_2$x = ["src"];
14
14
  const _hoisted_3$o = {
15
15
  key: 1,
16
16
  class: "kds-avatar-initials",
@@ -59,7 +59,7 @@ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
59
59
  alt: "",
60
60
  "aria-hidden": "true",
61
61
  onError: onImageError
62
- }, null, 40, _hoisted_2$y)) : (openBlock(), createElementBlock("div", _hoisted_3$o, [
62
+ }, null, 40, _hoisted_2$x)) : (openBlock(), createElementBlock("div", _hoisted_3$o, [
63
63
  createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)
64
64
  ]))
65
65
  ], 10, _hoisted_1$X);
@@ -802,7 +802,7 @@ function useKdsIsTruncated(elementRef) {
802
802
  }
803
803
 
804
804
  const _hoisted_1$T = ["title", "aria-label"];
805
- const _hoisted_2$x = ["title"];
805
+ const _hoisted_2$w = ["title"];
806
806
  const _sfc_main$1l = /* @__PURE__ */ defineComponent({
807
807
  __name: "KdsLiveStatus",
808
808
  props: {
@@ -832,7 +832,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
832
832
  ref: labelEl,
833
833
  class: "label",
834
834
  title: unref(isTruncated) ? __props.label : void 0
835
- }, toDisplayString(__props.label), 9, _hoisted_2$x)) : createCommentVNode("", true)
835
+ }, toDisplayString(__props.label), 9, _hoisted_2$w)) : createCommentVNode("", true)
836
836
  ], 10, _hoisted_1$T);
837
837
  };
838
838
  }
@@ -896,7 +896,7 @@ const kdsLoadingSpinnerVariants = Object.values(
896
896
  );
897
897
 
898
898
  const _hoisted_1$R = ["role"];
899
- const _hoisted_2$w = { class: "header" };
899
+ const _hoisted_2$v = { class: "header" };
900
900
  const _hoisted_3$n = { class: "headline" };
901
901
  const _hoisted_4$i = {
902
902
  key: 0,
@@ -933,7 +933,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
933
933
  class: normalizeClass(classes.value),
934
934
  role: role.value
935
935
  }, [
936
- createElementVNode("div", _hoisted_2$w, [
936
+ createElementVNode("div", _hoisted_2$v, [
937
937
  createVNode(KdsIcon, {
938
938
  class: "icon",
939
939
  name: iconName.value,
@@ -958,7 +958,7 @@ const kdsInlineMessageVariant = {
958
958
  const kdsInlineMessageVariants = Object.values(kdsInlineMessageVariant);
959
959
 
960
960
  const _hoisted_1$Q = { class: "donut-container" };
961
- const _hoisted_2$v = ["height", "width", "viewBox"];
961
+ const _hoisted_2$u = ["height", "width", "viewBox"];
962
962
  const _hoisted_3$m = ["r", "stroke-width"];
963
963
  const _hoisted_4$h = ["r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"];
964
964
  const _hoisted_5$8 = ["r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"];
@@ -1061,7 +1061,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
1061
1061
  fill: "transparent",
1062
1062
  transform: transformWedge.value
1063
1063
  }, null, 10, _hoisted_5$8)) : createCommentVNode("", true)
1064
- ], 8, _hoisted_2$v)),
1064
+ ], 8, _hoisted_2$u)),
1065
1065
  __props.title ? (openBlock(), createElementBlock("div", _hoisted_6$7, [
1066
1066
  createElementVNode("div", _hoisted_7$3, toDisplayString(__props.title), 1),
1067
1067
  __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$2, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)
@@ -1133,6 +1133,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
1133
1133
  }
1134
1134
  return (_ctx, _cache) => {
1135
1135
  return openBlock(), createBlock(resolveDynamicComponent(__props.component), {
1136
+ type: __props.component === "button" ? "button" : void 0,
1136
1137
  class: normalizeClass(classes.value),
1137
1138
  disabled: __props.disabled,
1138
1139
  title: props.title,
@@ -1155,12 +1156,12 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
1155
1156
  }, null, 8, ["name", "size"])) : createCommentVNode("", true)
1156
1157
  ]),
1157
1158
  _: 3
1158
- }, 8, ["class", "disabled", "title", "aria-label"]);
1159
+ }, 8, ["type", "class", "disabled", "title", "aria-label"]);
1159
1160
  };
1160
1161
  }
1161
1162
  });
1162
1163
 
1163
- const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__scopeId", "data-v-a696a1ec"]]);
1164
+ const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__scopeId", "data-v-80e22f2e"]]);
1164
1165
 
1165
1166
  const _sfc_main$1f = /* @__PURE__ */ defineComponent({
1166
1167
  __name: "KdsButton",
@@ -1457,7 +1458,7 @@ function prettyBytes(number, options) {
1457
1458
  }
1458
1459
 
1459
1460
  const _hoisted_1$N = { class: "label" };
1460
- const _hoisted_2$u = {
1461
+ const _hoisted_2$t = {
1461
1462
  key: 1,
1462
1463
  class: "file-size"
1463
1464
  };
@@ -1557,7 +1558,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
1557
1558
  name: "external-link",
1558
1559
  size: "xsmall"
1559
1560
  })) : createCommentVNode("", true),
1560
- normalizedFileSize.value ? (openBlock(), createElementBlock("span", _hoisted_2$u, toDisplayString(normalizedFileSize.value), 1)) : createCommentVNode("", true)
1561
+ normalizedFileSize.value ? (openBlock(), createElementBlock("span", _hoisted_2$t, toDisplayString(normalizedFileSize.value), 1)) : createCommentVNode("", true)
1561
1562
  ]),
1562
1563
  _: 1
1563
1564
  }, 8, ["class", "to", "download", "target", "rel", "title", "aria-disabled"]);
@@ -1604,7 +1605,7 @@ const kdsToggleButtonVariant = {
1604
1605
  const kdsToggleButtonVariants = Object.values(kdsToggleButtonVariant);
1605
1606
 
1606
1607
  const _hoisted_1$M = ["data-visible"];
1607
- const _hoisted_2$t = ["data-visible"];
1608
+ const _hoisted_2$s = ["data-visible"];
1608
1609
  const _sfc_main$1b = /* @__PURE__ */ defineComponent({
1609
1610
  __name: "KdsProgressButton",
1610
1611
  props: /* @__PURE__ */ mergeModels({
@@ -1675,7 +1676,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
1675
1676
  size: iconSize.value,
1676
1677
  variant: __props.variant === "filled" ? "onPrimary" : "onSurface"
1677
1678
  }, null, 8, ["size", "variant"])
1678
- ], 8, _hoisted_2$t)
1679
+ ], 8, _hoisted_2$s)
1679
1680
  ], 2)
1680
1681
  ]),
1681
1682
  _: 1
@@ -1700,10 +1701,14 @@ const kdsListItemVariant = {
1700
1701
  };
1701
1702
 
1702
1703
  const isTextInput = (target) => target instanceof HTMLElement && ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName);
1703
- const idsChanged = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
1704
+ const diffIds = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
1704
1705
  const useListItemKeyboardNav = (options) => {
1705
- const { containerEl, selectableItems, enabledItems } = options;
1706
- const isFocused = ref(false);
1706
+ const {
1707
+ containerEl,
1708
+ selectableItems,
1709
+ enabledItems,
1710
+ itemFocusStrategy = "persistent"
1711
+ } = options;
1707
1712
  const activeId = ref(void 0);
1708
1713
  function scrollToView() {
1709
1714
  if (!activeId.value || !containerEl.value) {
@@ -1711,42 +1716,6 @@ const useListItemKeyboardNav = (options) => {
1711
1716
  }
1712
1717
  containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
1713
1718
  }
1714
- function scrollSelectedIntoView() {
1715
- nextTick(() => {
1716
- const selected = containerEl.value?.querySelector(
1717
- '[aria-selected="true"]'
1718
- );
1719
- selected?.scrollIntoView({ block: "center" });
1720
- });
1721
- }
1722
- const lastActiveId = ref(void 0);
1723
- const enabledIds = computed(() => enabledItems.value.map(({ id }) => id));
1724
- let prevEnabledIds = [];
1725
- const firstEnabledOrEmpty = (values) => {
1726
- if (values.length > 0) {
1727
- return values[0].id;
1728
- }
1729
- return selectableItems.value.length === 0 ? options.emptyOptionId : void 0;
1730
- };
1731
- const getResetActiveId = (values) => {
1732
- if (activeId.value === void 0) {
1733
- return activeId.value;
1734
- }
1735
- if (isFocused.value && idsChanged(enabledIds.value, prevEnabledIds)) {
1736
- return firstEnabledOrEmpty(values);
1737
- }
1738
- const stillValid = values.some((o) => o.id === activeId.value);
1739
- return stillValid ? activeId.value : firstEnabledOrEmpty(values);
1740
- };
1741
- watch([enabledItems, () => options.loading], ([values, isLoading]) => {
1742
- activeId.value = isLoading ? options.emptyOptionId : getResetActiveId(values);
1743
- const lastIdStillValid = values.some((o) => o.id === lastActiveId.value);
1744
- if (!lastIdStillValid) {
1745
- lastActiveId.value = void 0;
1746
- }
1747
- prevEnabledIds = enabledIds.value;
1748
- nextTick(scrollToView);
1749
- });
1750
1719
  const findEnabledIndex = (id) => id === void 0 ? -1 : enabledItems.value.findIndex((o) => o.id === id);
1751
1720
  const moveDown = (currentIndex) => {
1752
1721
  if (currentIndex < 0) {
@@ -1813,53 +1782,87 @@ const useListItemKeyboardNav = (options) => {
1813
1782
  break;
1814
1783
  }
1815
1784
  };
1816
- const focus = () => {
1785
+ const isFocused = ref(false);
1786
+ const lastActiveId = ref(void 0);
1787
+ const updateActiveItemId = (didIdsChange = false) => {
1788
+ function assertUnreachable(_) {
1789
+ throw new Error("Exhaustive check not met");
1790
+ }
1817
1791
  isFocused.value = true;
1818
- if (activeId.value === void 0 && !options.allowNoSelection) {
1819
- activeId.value = lastActiveId.value ?? enabledItems.value[0]?.id;
1792
+ switch (itemFocusStrategy) {
1793
+ case "always-first": {
1794
+ activeId.value = enabledItems.value.at(0)?.id;
1795
+ return;
1796
+ }
1797
+ case "persistent": {
1798
+ const hasActiveId = activeId.value !== void 0;
1799
+ if (!didIdsChange && hasActiveId) {
1800
+ return;
1801
+ }
1802
+ const isStillAvailable = enabledItems.value.find(
1803
+ ({ id }) => lastActiveId.value === id
1804
+ );
1805
+ activeId.value = isStillAvailable ? lastActiveId.value : enabledItems.value.at(0)?.id;
1806
+ lastActiveId.value = activeId.value;
1807
+ return;
1808
+ }
1809
+ case "noop": {
1810
+ activeId.value = void 0;
1811
+ lastActiveId.value = void 0;
1812
+ return;
1813
+ }
1814
+ default:
1815
+ assertUnreachable();
1820
1816
  }
1821
1817
  };
1818
+ watch(
1819
+ [enabledItems, () => options.loading],
1820
+ ([currentValues, isLoading], [prevValues]) => {
1821
+ if (!isFocused.value) {
1822
+ return;
1823
+ }
1824
+ if (isLoading && options.emptyOptionId) {
1825
+ activeId.value = options.emptyOptionId;
1826
+ return;
1827
+ }
1828
+ const didIdsChange = diffIds(
1829
+ currentValues.map(({ id }) => id),
1830
+ prevValues.map(({ id }) => id)
1831
+ );
1832
+ updateActiveItemId(didIdsChange);
1833
+ }
1834
+ );
1822
1835
  const blur = () => {
1823
- isFocused.value = false;
1824
1836
  lastActiveId.value = activeId.value;
1825
1837
  activeId.value = void 0;
1838
+ isFocused.value = false;
1826
1839
  };
1827
1840
  const setActiveId = (id) => {
1828
1841
  activeId.value = id;
1829
1842
  };
1830
- const onMouseLeave = () => {
1831
- if (!isFocused.value) {
1832
- setActiveId(void 0);
1833
- }
1834
- };
1835
- const onMousemove = (event) => {
1836
- const target = event.target?.closest?.(
1837
- `[role="${toValue(options.listItemRole)}"]`
1838
- );
1839
- if (target instanceof HTMLElement && target.id && target.getAttribute("aria-disabled") !== "true") {
1840
- setActiveId(target.id);
1841
- } else if (!isFocused.value) {
1842
- setActiveId(void 0);
1843
- }
1844
- };
1843
+ const focus = () => updateActiveItemId();
1845
1844
  onMounted(() => {
1846
1845
  containerEl.value?.addEventListener("keydown", handleKeydown);
1847
1846
  containerEl.value?.addEventListener("focus", focus);
1848
1847
  containerEl.value?.addEventListener("blur", blur);
1849
- containerEl.value?.addEventListener("mousemove", onMousemove);
1850
- containerEl.value?.addEventListener("mouseleave", onMouseLeave);
1851
1848
  });
1852
1849
  onUnmounted(() => {
1853
1850
  containerEl.value?.removeEventListener("keydown", handleKeydown);
1854
1851
  containerEl.value?.removeEventListener("focus", focus);
1855
1852
  containerEl.value?.removeEventListener("blur", blur);
1856
- containerEl.value?.removeEventListener("mousemove", onMousemove);
1857
- containerEl.value?.removeEventListener("mouseleave", onMouseLeave);
1858
1853
  });
1854
+ function scrollSelectedIntoView() {
1855
+ nextTick(() => {
1856
+ const selected = containerEl.value?.querySelector(
1857
+ '[aria-selected="true"]'
1858
+ );
1859
+ selected?.scrollIntoView({ block: "center" });
1860
+ });
1861
+ }
1859
1862
  return {
1860
1863
  handleKeydown,
1861
1864
  activeId: readonly(activeId),
1862
- focus,
1865
+ focus: updateActiveItemId,
1863
1866
  blur,
1864
1867
  setActiveId,
1865
1868
  scrollSelectedIntoView
@@ -1957,7 +1960,7 @@ const kdsListItemAccessorySize = {
1957
1960
  };
1958
1961
 
1959
1962
  const _hoisted_1$L = ["id", "role", "aria-selected", "aria-disabled"];
1960
- const _hoisted_2$s = {
1963
+ const _hoisted_2$r = {
1961
1964
  key: 0,
1962
1965
  class: "accessory"
1963
1966
  };
@@ -2035,7 +2038,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
2035
2038
  ]),
2036
2039
  onClick
2037
2040
  }, [
2038
- props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$s, [
2041
+ props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$r, [
2039
2042
  createVNode(_sfc_main$1a, {
2040
2043
  accessory: props.accessory,
2041
2044
  size: accessorySize.value,
@@ -2084,7 +2087,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
2084
2087
  const KdsListItem = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__scopeId", "data-v-def6165b"]]);
2085
2088
 
2086
2089
  const _hoisted_1$K = { class: "kds-list-item-section-title" };
2087
- const _hoisted_2$r = {
2090
+ const _hoisted_2$q = {
2088
2091
  key: 0,
2089
2092
  class: "icon"
2090
2093
  };
@@ -2101,7 +2104,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
2101
2104
  const { isTruncated } = useKdsIsTruncated(labelEl);
2102
2105
  return (_ctx, _cache) => {
2103
2106
  return openBlock(), createElementBlock("div", _hoisted_1$K, [
2104
- props.leadingIcon ? (openBlock(), createElementBlock("span", _hoisted_2$r, [
2107
+ props.leadingIcon ? (openBlock(), createElementBlock("span", _hoisted_2$q, [
2105
2108
  createVNode(KdsIcon, {
2106
2109
  name: props.leadingIcon,
2107
2110
  size: "small"
@@ -2172,11 +2175,12 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
2172
2175
  ariaLabel: { default: "Menu" },
2173
2176
  items: {},
2174
2177
  menuMaxHeight: {},
2175
- variant: { default: () => kdsListItemVariant.SMALL }
2178
+ variant: { default: () => kdsListItemVariant.SMALL },
2179
+ itemFocusStrategy: { default: "noop" }
2176
2180
  },
2177
2181
  emits: ["itemClick"],
2178
2182
  setup(__props, { expose: __expose, emit: __emit }) {
2179
- const props = createPropsRestProxy(__props, ["ariaLabel", "menuMaxHeight", "variant"]);
2183
+ const props = createPropsRestProxy(__props, ["ariaLabel", "menuMaxHeight", "variant", "itemFocusStrategy"]);
2180
2184
  const emit = __emit;
2181
2185
  const { itemsWithPrefix, toUnprefixedId } = useStableItemIds({
2182
2186
  items: computed(() => props.items)
@@ -2190,15 +2194,19 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
2190
2194
  const handleItemInteraction = (item, event) => {
2191
2195
  const id = toUnprefixedId(item.id);
2192
2196
  const originalItem = props.items.find((i) => i.id === id);
2193
- originalItem?.handler?.(originalItem, event);
2197
+ try {
2198
+ originalItem?.handler?.(originalItem, event);
2199
+ } catch (error) {
2200
+ console.error("Failed while calling item handler", { item, error });
2201
+ }
2194
2202
  emit("itemClick", id);
2195
2203
  };
2196
2204
  const containerEl = useTemplateRef("containerEl");
2197
- const { activeId, focus } = useListItemKeyboardNav({
2205
+ const { activeId } = useListItemKeyboardNav({
2198
2206
  containerEl,
2199
2207
  enabledItems,
2200
2208
  selectableItems,
2201
- listItemRole: "menuitem",
2209
+ itemFocusStrategy: __props.itemFocusStrategy,
2202
2210
  triggers: {
2203
2211
  onEnter: (_activeId, item, event) => {
2204
2212
  handleItemInteraction(item, event);
@@ -2210,11 +2218,11 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
2210
2218
  });
2211
2219
  __expose({
2212
2220
  /**
2213
- * Function to focus the outer container of the menu. Also sets programmatic focus (with correct aria attributes) to the first item in the list
2221
+ * Function to focus the outer container of the menu.
2222
+ * It will follow the behavior defined by the `itemFocusStrategy` prop.
2214
2223
  */
2215
2224
  focus: () => {
2216
2225
  containerEl.value?.focus();
2217
- focus();
2218
2226
  }
2219
2227
  });
2220
2228
  return (_ctx, _cache) => {
@@ -2244,7 +2252,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
2244
2252
  }
2245
2253
  });
2246
2254
 
2247
- const KdsMenuContainer = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-68200614"]]);
2255
+ const KdsMenuContainer = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-69149ee8"]]);
2248
2256
 
2249
2257
  const kdsPopoverPlacement = {
2250
2258
  CUSTOM: "custom"
@@ -2253,7 +2261,7 @@ const kdsPopoverType = {
2253
2261
  AUTO: "auto"};
2254
2262
 
2255
2263
  const _hoisted_1$I = ["id", "popover", "role"];
2256
- const _hoisted_2$q = {
2264
+ const _hoisted_2$p = {
2257
2265
  key: 0,
2258
2266
  class: "kds-popover-default-content"
2259
2267
  };
@@ -2315,7 +2323,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
2315
2323
  onToggle
2316
2324
  }, [
2317
2325
  renderSlot(_ctx.$slots, "default", {}, () => [
2318
- props.content?.trim().length ? (openBlock(), createElementBlock("div", _hoisted_2$q, toDisplayString(props.content), 1)) : createCommentVNode("", true)
2326
+ props.content?.trim().length ? (openBlock(), createElementBlock("div", _hoisted_2$p, toDisplayString(props.content), 1)) : createCommentVNode("", true)
2319
2327
  ], true)
2320
2328
  ], 46, _hoisted_1$I);
2321
2329
  };
@@ -2516,7 +2524,7 @@ const kdsButtonVariant = {
2516
2524
  const kdsButtonVariants = Object.values(kdsButtonVariant);
2517
2525
 
2518
2526
  const _hoisted_1$H = ["aria-disabled"];
2519
- const _hoisted_2$p = { class: "kds-empty-state-headline" };
2527
+ const _hoisted_2$o = { class: "kds-empty-state-headline" };
2520
2528
  const _hoisted_3$j = {
2521
2529
  key: 1,
2522
2530
  class: "kds-empty-state-description"
@@ -2563,7 +2571,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
2563
2571
  variant: "onSurface",
2564
2572
  "aria-hidden": "true"
2565
2573
  })) : createCommentVNode("", true),
2566
- createElementVNode("p", _hoisted_2$p, toDisplayString(props.headline), 1),
2574
+ createElementVNode("p", _hoisted_2$o, toDisplayString(props.headline), 1),
2567
2575
  props.description ? (openBlock(), createElementBlock("p", _hoisted_3$j, toDisplayString(props.description), 1)) : createCommentVNode("", true),
2568
2576
  props.button ? (openBlock(), createElementBlock("div", _hoisted_4$f, [
2569
2577
  (openBlock(), createBlock(resolveDynamicComponent(buttonComponent.value), mergeProps(props.button, {
@@ -2582,8 +2590,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
2582
2590
 
2583
2591
  const KdsEmptyState = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-e913660a"]]);
2584
2592
 
2585
- const _hoisted_1$G = ["role", "aria-busy", "aria-label", "aria-activedescendant", "tabindex"];
2586
- const _hoisted_2$o = ["role"];
2593
+ const _hoisted_1$G = ["aria-busy", "aria-label", "aria-activedescendant", "tabindex"];
2587
2594
  const loadingStateText = "Loading entries";
2588
2595
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2589
2596
  __name: "KdsListContainer",
@@ -2595,11 +2602,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2595
2602
  ariaLabel: {},
2596
2603
  controlledExternally: { type: Boolean },
2597
2604
  allowNoSelection: { type: Boolean, default: false },
2598
- role: { default: "listbox" }
2605
+ itemFocusStrategy: { default: "persistent" }
2599
2606
  },
2600
2607
  emits: ["itemClick"],
2601
2608
  setup(__props, { expose: __expose, emit: __emit }) {
2602
- const props = createPropsRestProxy(__props, ["emptyText", "variant", "loading", "role", "allowNoSelection"]);
2609
+ const props = createPropsRestProxy(__props, ["emptyText", "variant", "loading", "allowNoSelection", "itemFocusStrategy"]);
2603
2610
  const emit = __emit;
2604
2611
  const { itemsWithPrefix, idPrefix, toUnprefixedId } = useStableItemIds({
2605
2612
  items: computed(() => __props.loading ? [] : props.possibleValues)
@@ -2615,9 +2622,6 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2615
2622
  () => itemsWithPrefix.value.filter((item) => !item.sectionHeadline)
2616
2623
  );
2617
2624
  const containerEl = useTemplateRef("containerEl");
2618
- const listItemRole = computed(() => {
2619
- return __props.role === "listbox" ? "option" : "menuitem";
2620
- });
2621
2625
  const enabledValues = computed(
2622
2626
  () => selectableValues.value.filter((o) => !o.disabled)
2623
2627
  );
@@ -2628,7 +2632,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2628
2632
  allowNoSelection: __props.allowNoSelection,
2629
2633
  emptyOptionId,
2630
2634
  loading: __props.loading,
2631
- listItemRole,
2635
+ itemFocusStrategy: __props.itemFocusStrategy,
2632
2636
  triggers: {
2633
2637
  onEnter: () => {
2634
2638
  emit("itemClick", toOptionId(activeId.value));
@@ -2656,14 +2660,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2656
2660
  return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
2657
2661
  ref_key: "containerEl",
2658
2662
  ref: containerEl,
2659
- role: __props.role,
2663
+ role: "listbox",
2660
2664
  "aria-busy": __props.loading,
2661
2665
  "aria-label": props.ariaLabel,
2662
2666
  "aria-activedescendant": !props.controlledExternally && unref(activeId) ? unref(activeId) : void 0,
2663
- class: [
2664
- "kds-list-container",
2665
- { standalone: !props.controlledExternally, menu: __props.role === "menu" }
2666
- ],
2667
+ class: ["kds-list-container", { standalone: !props.controlledExternally }],
2667
2668
  tabindex: props.controlledExternally ? void 0 : 0
2668
2669
  }), [
2669
2670
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
@@ -2689,10 +2690,10 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2689
2690
  missing: item.missing,
2690
2691
  variant: __props.variant,
2691
2692
  "trailing-icon": item.missing && !item.disabled ? "trash" : item.selected ? "checkmark" : void 0,
2692
- role: listItemRole.value,
2693
+ role: "option",
2693
2694
  onMousedown: _cache[0] || (_cache[0] = ($event) => props.controlledExternally && $event.preventDefault()),
2694
2695
  onClick: ($event) => !item.disabled && emit("itemClick", toOptionId(item.id))
2695
- }, null, 8, ["id", "accessory", "label", "sub-text", "selected", "disabled", "active", "special", "missing", "variant", "trailing-icon", "role", "onClick"])),
2696
+ }, null, 8, ["id", "accessory", "label", "sub-text", "selected", "disabled", "active", "special", "missing", "variant", "trailing-icon", "onClick"])),
2696
2697
  item.separator && index < unref(itemsWithPrefix).length - 1 ? (openBlock(), createBlock(unref(KdsDivider), {
2697
2698
  key: 2,
2698
2699
  class: "kds-list-item-divider",
@@ -2704,7 +2705,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2704
2705
  selectableValues.value.length === 0 ? (openBlock(), createElementBlock("div", {
2705
2706
  key: 0,
2706
2707
  id: emptyOptionId,
2707
- role: listItemRole.value,
2708
+ role: "option",
2708
2709
  "aria-disabled": "true",
2709
2710
  "aria-selected": "false",
2710
2711
  class: "kds-list-container-empty"
@@ -2713,13 +2714,13 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
2713
2714
  headline: __props.loading ? loadingStateText : __props.emptyText,
2714
2715
  "loading-spinner": __props.loading
2715
2716
  }, null, 8, ["headline", "loading-spinner"])
2716
- ], 8, _hoisted_2$o)) : createCommentVNode("", true)
2717
+ ])) : createCommentVNode("", true)
2717
2718
  ], 16, _hoisted_1$G);
2718
2719
  };
2719
2720
  }
2720
2721
  });
2721
2722
 
2722
- const KdsListContainer = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-5e1d539e"]]);
2723
+ const KdsListContainer = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-570992f0"]]);
2723
2724
 
2724
2725
  const KdsListContainer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2725
2726
  __proto__: null,
@@ -2743,8 +2744,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
2743
2744
  const popoverEl = useTemplateRef("popover");
2744
2745
  const menuContainerEl = useTemplateRef("menuContainer");
2745
2746
  const menuId = useId();
2746
- watch(isMenuOpen, async (menuOpen) => {
2747
- if (!menuOpen) {
2747
+ watch(isMenuOpen, async () => {
2748
+ if (!isMenuOpen.value) {
2748
2749
  return;
2749
2750
  }
2750
2751
  await nextTick();
@@ -2839,6 +2840,14 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
2839
2840
  open.value = false;
2840
2841
  emit("itemClick", itemId);
2841
2842
  };
2843
+ const menuContainerEl = useTemplateRef("menuContainer");
2844
+ watch(open, async (isOpen) => {
2845
+ if (!isOpen) {
2846
+ return;
2847
+ }
2848
+ await nextTick();
2849
+ menuContainerEl.value?.focus();
2850
+ });
2842
2851
  return (_ctx, _cache) => {
2843
2852
  return openBlock(), createBlock(KdsPopover, {
2844
2853
  modelValue: open.value,
@@ -2851,6 +2860,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
2851
2860
  default: withCtx(() => [
2852
2861
  createVNode(KdsMenuContainer, {
2853
2862
  id: props.id,
2863
+ ref: "menuContainer",
2854
2864
  "aria-label": props.ariaLabel,
2855
2865
  items: props.items,
2856
2866
  "menu-max-height": __props.menuMaxHeight,
@@ -4715,7 +4725,6 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
4715
4725
  __props.clearable && hasValue.value && !__props.disabled ? (openBlock(), createBlock(_sfc_main$1f, {
4716
4726
  key: 3,
4717
4727
  class: "clear-button",
4718
- type: "button",
4719
4728
  size: "xsmall",
4720
4729
  variant: "transparent",
4721
4730
  "leading-icon": "x-close",
@@ -4736,7 +4745,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
4736
4745
  }
4737
4746
  });
4738
4747
 
4739
- const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-69242818"]]);
4748
+ const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-b8ccb955"]]);
4740
4749
 
4741
4750
  const usePointerHandler = (updateFromEvent) => {
4742
4751
  const activePointerId = ref(null);
@@ -5096,7 +5105,6 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
5096
5105
  }), {
5097
5106
  trailing: withCtx(() => [
5098
5107
  createVNode(_sfc_main$1f, {
5099
- type: "button",
5100
5108
  size: "xsmall",
5101
5109
  variant: "outlined",
5102
5110
  "leading-icon": "minus",
@@ -5109,7 +5117,6 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
5109
5117
  onPointercancel: stopRepeating
5110
5118
  }, null, 8, ["ariaLabel", "disabled"]),
5111
5119
  createVNode(_sfc_main$1f, {
5112
- type: "button",
5113
5120
  size: "xsmall",
5114
5121
  variant: "outlined",
5115
5122
  "leading-icon": "plus",
@@ -6032,7 +6039,6 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
6032
6039
  key: 0,
6033
6040
  modelValue: showValue.value,
6034
6041
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showValue.value = $event),
6035
- type: "button",
6036
6042
  variant: "outlined",
6037
6043
  size: "xsmall",
6038
6044
  "leading-icon": "eye",
@@ -11241,7 +11247,16 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
11241
11247
  const popoverIsVisible = ref(false);
11242
11248
  const popoverRef = useTemplateRef("popoverRef");
11243
11249
  const datePickerRef = useTemplateRef("datePickerRef");
11244
- const { displayValue, isEmpty, isComplete, isValidDate, segments } = useDateInputMask(modelValue);
11250
+ const { displayValue, isEmpty, isComplete, isValidDate, parsedDate, segments } = useDateInputMask(modelValue);
11251
+ const clampToRange = (date) => {
11252
+ if (__props.minDate && Un.PlainDate.compare(date, __props.minDate) < 0) {
11253
+ return __props.minDate;
11254
+ }
11255
+ if (__props.maxDate && Un.PlainDate.compare(date, __props.maxDate) > 0) {
11256
+ return __props.maxDate;
11257
+ }
11258
+ return date;
11259
+ };
11245
11260
  const inputError = ref(false);
11246
11261
  const monthFormatter = new Intl.DateTimeFormat("en-US", {
11247
11262
  month: "long",
@@ -11295,7 +11310,14 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
11295
11310
  inputError.value = false;
11296
11311
  return;
11297
11312
  }
11298
- inputError.value = !isComplete.value || !isValidDate.value;
11313
+ const valid = isComplete.value && isValidDate.value;
11314
+ inputError.value = !valid;
11315
+ if (valid && parsedDate.value) {
11316
+ const clamped = clampToRange(parsedDate.value);
11317
+ if (!parsedDate.value.equals(clamped)) {
11318
+ displayValue.value = clamped.toString({ calendarName: "never" });
11319
+ }
11320
+ }
11299
11321
  };
11300
11322
  watch([isEmpty, isComplete, isValidDate], () => {
11301
11323
  if (inputError.value && (isEmpty.value || isComplete.value && isValidDate.value)) {
@@ -11331,7 +11353,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
11331
11353
  createVNode(_sfc_main$1c, {
11332
11354
  modelValue: popoverIsVisible.value,
11333
11355
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => popoverIsVisible.value = $event),
11334
- type: "button",
11335
11356
  size: "xsmall",
11336
11357
  variant: "outlined",
11337
11358
  "leading-icon": "calendar",
@@ -11944,6 +11965,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
11944
11965
  "possible-values": __props.results,
11945
11966
  "controlled-externally": "",
11946
11967
  "allow-no-selection": "",
11968
+ "item-focus-strategy": "noop",
11947
11969
  "empty-text": "No search results",
11948
11970
  "aria-label": "Search results list",
11949
11971
  onItemClick: onResultClick
@@ -11959,7 +11981,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
11959
11981
  }
11960
11982
  });
11961
11983
 
11962
- const KdsSearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-3094963a"]]);
11984
+ const KdsSearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-3e274ed2"]]);
11963
11985
 
11964
11986
  const _hoisted_1$r = ["rows", "placeholder", "disabled", "autocomplete"];
11965
11987
  const DEFAULT_ROWS = 3;
@@ -12578,7 +12600,6 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
12578
12600
  createVNode(_sfc_main$1c, {
12579
12601
  modelValue: popoverIsVisible.value,
12580
12602
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => popoverIsVisible.value = $event),
12581
- type: "button",
12582
12603
  size: "xsmall",
12583
12604
  variant: "outlined",
12584
12605
  "leading-icon": "time",
@@ -15712,7 +15733,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15712
15733
  createElementVNode("h6", null, toDisplayString(__props.headline), 1),
15713
15734
  createVNode(_sfc_main$1f, {
15714
15735
  class: "kds-close-button",
15715
- type: "button",
15716
15736
  "leading-icon": "x-close",
15717
15737
  size: "small",
15718
15738
  ariaLabel: "Close panel",
@@ -15724,7 +15744,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15724
15744
  }
15725
15745
  });
15726
15746
 
15727
- const KdsPanelHeader = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-be5bccc5"]]);
15747
+ const KdsPanelHeader = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-dd28904c"]]);
15728
15748
 
15729
15749
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
15730
15750
  __name: "TabBarItemAccessory",