@knime/kds-components 0.17.1 → 0.18.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.
Files changed (33) hide show
  1. package/dist/buttons/KdsMenuButton/KdsMenuButton.vue.d.ts.map +1 -1
  2. package/dist/forms/_helper/InfoPopover/KdsInfoToggleButton.vue.d.ts +8 -2
  3. package/dist/forms/_helper/InfoPopover/KdsInfoToggleButton.vue.d.ts.map +1 -1
  4. package/dist/forms/_helper/List/ListContainer/KdsListContainer.vue.d.ts +3 -2
  5. package/dist/forms/_helper/List/ListContainer/KdsListContainer.vue.d.ts.map +1 -1
  6. package/dist/forms/_helper/List/ListContainer/types.d.ts +2 -0
  7. package/dist/forms/_helper/List/ListContainer/types.d.ts.map +1 -1
  8. package/dist/forms/_helper/VariablePopover/KdsVariableToggleButton.vue.d.ts +8 -2
  9. package/dist/forms/_helper/VariablePopover/KdsVariableToggleButton.vue.d.ts.map +1 -1
  10. package/dist/forms/inputs/BaseInput.vue.d.ts +17 -0
  11. package/dist/forms/inputs/BaseInput.vue.d.ts.map +1 -1
  12. package/dist/forms/inputs/DateInput/KdsDateInput.vue.d.ts +20 -2
  13. package/dist/forms/inputs/DateInput/KdsDateInput.vue.d.ts.map +1 -1
  14. package/dist/forms/inputs/NumberInput/KdsNumberInput.vue.d.ts.map +1 -1
  15. package/dist/forms/inputs/SearchInput/KdsSearchInput.vue.d.ts.map +1 -1
  16. package/dist/forms/inputs/SearchInput/types.d.ts +31 -1
  17. package/dist/forms/inputs/SearchInput/types.d.ts.map +1 -1
  18. package/dist/forms/selects/Dropdown/DropdownContainer.vue.d.ts +21 -4
  19. package/dist/forms/selects/Dropdown/DropdownContainer.vue.d.ts.map +1 -1
  20. package/dist/forms/selects/Dropdown/MultiSelectDropdownContainer.vue.d.ts +21 -4
  21. package/dist/forms/selects/Dropdown/MultiSelectDropdownContainer.vue.d.ts.map +1 -1
  22. package/dist/index.css +55 -49
  23. package/dist/index.js +235 -62
  24. package/dist/index.js.map +1 -1
  25. package/dist/overlays/Popover/KdsPopover.vue.d.ts +1 -0
  26. package/dist/overlays/Popover/KdsPopover.vue.d.ts.map +1 -1
  27. package/dist/overlays/Popover/enums.d.ts +5 -0
  28. package/dist/overlays/Popover/enums.d.ts.map +1 -1
  29. package/dist/overlays/Popover/index.d.ts +1 -1
  30. package/dist/overlays/Popover/index.d.ts.map +1 -1
  31. package/dist/overlays/Popover/types.d.ts +8 -1
  32. package/dist/overlays/Popover/types.d.ts.map +1 -1
  33. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, createCommentVNode, normalizeStyle, useTemplateRef, createVNode, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, useId, nextTick, Fragment, renderList, watchEffect, useAttrs, defineAsyncComponent, onBeforeUpdate, withModifiers, normalizeProps, guardReactiveProps, reactive, onMounted, onUnmounted, toRefs, inject, withKeys, withDirectives, provide, createTextVNode, isRef, resolveComponent, Transition, resolveDirective, toHandlers, vModelText, useCssVars, mergeDefaults, createSlots } from 'vue';
1
+ import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, createCommentVNode, normalizeStyle, useTemplateRef, createVNode, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, useId, nextTick, Fragment, renderList, watchEffect, useAttrs, defineAsyncComponent, onBeforeUpdate, withModifiers, normalizeProps, guardReactiveProps, reactive, onMounted, onUnmounted, toRefs, inject, withKeys, withDirectives, provide, createTextVNode, isRef, resolveComponent, Transition, resolveDirective, toHandlers, onBeforeUnmount, vModelText, useCssVars, mergeDefaults, createSlots } from 'vue';
2
2
  import { useLocalStorage, useDark, usePreferredDark, useResizeObserver, useMutationObserver, useElementSize } from '@vueuse/core';
3
3
 
4
4
  import './index.css';const kdsAvatarSize = {
@@ -1468,6 +1468,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1468
1468
  loading: { type: Boolean, default: false },
1469
1469
  ariaLabel: {},
1470
1470
  controlledExternally: { type: Boolean },
1471
+ allowNoSelection: { type: Boolean, default: false },
1471
1472
  role: { default: "listbox" }
1472
1473
  },
1473
1474
  emits: ["itemClick"],
@@ -1475,8 +1476,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1475
1476
  const props = __props;
1476
1477
  const emit = __emit;
1477
1478
  const idPrefix = useId();
1478
- const toOptionId = (elementId) => elementId.slice(idPrefix.length + 1);
1479
1479
  const emptyOptionId = `${idPrefix}-empty`;
1480
+ function toOptionId(elementId) {
1481
+ if (elementId === emptyOptionId) {
1482
+ return void 0;
1483
+ }
1484
+ return elementId?.slice(idPrefix.length + 1);
1485
+ }
1480
1486
  const prefixedValues = computed(
1481
1487
  () => (props.loading ? [] : props.possibleValues).map((o) => ({
1482
1488
  ...o,
@@ -1548,7 +1554,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1548
1554
  const findEnabledIndex = (id) => id === void 0 ? -1 : enabledValues.value.findIndex((o) => o.id === id);
1549
1555
  const handleFocus = () => {
1550
1556
  isFocused.value = true;
1551
- if (activeId.value === void 0) {
1557
+ if (activeId.value === void 0 && !props.allowNoSelection) {
1552
1558
  activeId.value = lastActiveId.value ?? enabledValues.value[0]?.id;
1553
1559
  }
1554
1560
  };
@@ -1557,46 +1563,52 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1557
1563
  lastActiveId.value = activeId.value;
1558
1564
  activeId.value = void 0;
1559
1565
  };
1566
+ const moveDown = (currentIndex) => {
1567
+ if (currentIndex < 0) {
1568
+ return enabledValues.value[0].id;
1569
+ }
1570
+ if (currentIndex >= enabledValues.value.length - 1) {
1571
+ return props.allowNoSelection ? void 0 : enabledValues.value[0].id;
1572
+ }
1573
+ return enabledValues.value[currentIndex + 1].id;
1574
+ };
1575
+ const moveUp = (currentIndex) => {
1576
+ if (props.allowNoSelection && currentIndex === 0) {
1577
+ return void 0;
1578
+ }
1579
+ if (currentIndex <= 0) {
1580
+ return enabledValues.value[enabledValues.value.length - 1].id;
1581
+ }
1582
+ return enabledValues.value[currentIndex - 1].id;
1583
+ };
1584
+ const isTextInput = (target) => target instanceof HTMLElement && ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName);
1560
1585
  const handleKeydown = (event) => {
1561
1586
  if (enabledValues.value.length === 0) {
1587
+ activeId.value = selectableValues.value.length === 0 ? emptyOptionId : void 0;
1562
1588
  return;
1563
1589
  }
1564
1590
  const currentIndex = findEnabledIndex(activeId.value);
1565
1591
  switch (event.key) {
1566
- case "ArrowDown": {
1567
- const nextIndex = currentIndex < 0 || currentIndex >= enabledValues.value.length - 1 ? 0 : currentIndex + 1;
1568
- activeId.value = enabledValues.value[nextIndex].id;
1592
+ case "ArrowDown":
1593
+ activeId.value = moveDown(currentIndex);
1569
1594
  scrollToView();
1570
1595
  event.preventDefault();
1571
1596
  break;
1572
- }
1573
- case "ArrowUp": {
1574
- const nextIndex = currentIndex <= 0 ? enabledValues.value.length - 1 : currentIndex - 1;
1575
- activeId.value = enabledValues.value[nextIndex].id;
1597
+ case "ArrowUp":
1598
+ activeId.value = moveUp(currentIndex);
1576
1599
  scrollToView();
1577
1600
  event.preventDefault();
1578
1601
  break;
1579
- }
1580
1602
  case "Enter":
1581
- if (event.target instanceof HTMLElement && ["BUTTON"].includes(event.target.tagName) && event.target.ariaExpanded === "false") {
1582
- break;
1583
- }
1584
- if (activeId.value) {
1585
- emit("itemClick", toOptionId(activeId.value));
1586
- event.preventDefault();
1587
- }
1603
+ emit("itemClick", toOptionId(activeId.value));
1604
+ event.preventDefault();
1588
1605
  break;
1589
1606
  case " ":
1590
- if (event.target instanceof HTMLElement && ["INPUT", "TEXTAREA", "SELECT"].includes(event.target.tagName)) {
1591
- break;
1592
- }
1593
- if (event.target instanceof HTMLElement && ["BUTTON"].includes(event.target.tagName) && event.target.ariaExpanded === "false") {
1607
+ if (isTextInput(event.target)) {
1594
1608
  break;
1595
1609
  }
1596
- if (activeId.value) {
1597
- emit("itemClick", toOptionId(activeId.value));
1598
- event.preventDefault();
1599
- }
1610
+ emit("itemClick", toOptionId(activeId.value));
1611
+ event.preventDefault();
1600
1612
  break;
1601
1613
  case "Home":
1602
1614
  activeId.value = enabledValues.value[0].id;
@@ -1687,9 +1699,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1687
1699
  }
1688
1700
  });
1689
1701
 
1690
- const KdsListContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["__scopeId", "data-v-e3d86a4e"]]);
1702
+ const KdsListContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["__scopeId", "data-v-9b505d0b"]]);
1703
+
1704
+ const KdsListContainer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1705
+ __proto__: null,
1706
+ default: KdsListContainer
1707
+ }, Symbol.toStringTag, { value: 'Module' }));
1691
1708
 
1692
- const _hoisted_1$p = ["id", "role", "aria-label"];
1709
+ const _hoisted_1$p = ["id", "popover", "role", "aria-label"];
1693
1710
  const _hoisted_2$f = {
1694
1711
  key: 0,
1695
1712
  class: "kds-popover-default-content"
@@ -1699,6 +1716,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1699
1716
  props: /* @__PURE__ */ mergeModels({
1700
1717
  placement: { default: "bottom-left" },
1701
1718
  role: { default: void 0 },
1719
+ popoverType: { default: "auto" },
1702
1720
  fullWidth: { type: Boolean, default: false },
1703
1721
  popoverAriaLabel: {},
1704
1722
  content: {}
@@ -1721,6 +1739,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1721
1739
  }
1722
1740
  });
1723
1741
  const anchorStyle = { "anchor-name": anchorName };
1742
+ const onToggle = (event) => {
1743
+ open.value = event.newState === "open";
1744
+ };
1724
1745
  __expose({ anchorStyle, popoverId });
1725
1746
  return (_ctx, _cache) => {
1726
1747
  return openBlock(), createElementBlock("div", {
@@ -1728,11 +1749,11 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1728
1749
  ref_key: "popoverEl",
1729
1750
  ref: popoverEl,
1730
1751
  class: normalizeClass(["kds-popover", ["floating", props.placement, { "full-width": props.fullWidth }]]),
1731
- popover: "auto",
1752
+ popover: props.popoverType,
1732
1753
  style: normalizeStyle({ "position-anchor": anchorName }),
1733
1754
  role: props.role,
1734
1755
  "aria-label": props.popoverAriaLabel,
1735
- onToggle: _cache[0] || (_cache[0] = ($event) => open.value = $event.newState === "open")
1756
+ onToggle
1736
1757
  }, [
1737
1758
  renderSlot(_ctx.$slots, "default", {}, () => [
1738
1759
  props.content?.trim().length ? (openBlock(), createElementBlock("div", _hoisted_2$f, toDisplayString(props.content), 1)) : createCommentVNode("", true)
@@ -1742,7 +1763,12 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1742
1763
  }
1743
1764
  });
1744
1765
 
1745
- const KdsPopover = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__scopeId", "data-v-09124386"]]);
1766
+ const KdsPopover = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__scopeId", "data-v-786e523e"]]);
1767
+
1768
+ const KdsPopover$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1769
+ __proto__: null,
1770
+ default: KdsPopover
1771
+ }, Symbol.toStringTag, { value: 'Module' }));
1746
1772
 
1747
1773
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
1748
1774
  ...{
@@ -1789,6 +1815,9 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1789
1815
  };
1790
1816
  });
1791
1817
  const onItemClick = (itemId) => {
1818
+ if (!itemId) {
1819
+ return;
1820
+ }
1792
1821
  isMenuOpen.value = false;
1793
1822
  emit("itemClick", itemId);
1794
1823
  };
@@ -1803,14 +1832,14 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1803
1832
  "aria-controls": unref(menuId),
1804
1833
  style: popoverEl.value?.anchorStyle,
1805
1834
  onFocus: listContainerEl.value?.handleFocus,
1806
- onKeydown: listContainerEl.value?.handleKeydown,
1807
- onBlur: _cache[1] || (_cache[1] = ($event) => isMenuOpen.value = false)
1808
- }), null, 16, ["modelValue", "aria-expanded", "aria-controls", "style", "onFocus", "onKeydown"]),
1835
+ onKeydown: _cache[1] || (_cache[1] = ($event) => isMenuOpen.value && listContainerEl.value?.handleKeydown),
1836
+ onBlur: _cache[2] || (_cache[2] = ($event) => isMenuOpen.value = false)
1837
+ }), null, 16, ["modelValue", "aria-expanded", "aria-controls", "style", "onFocus"]),
1809
1838
  createVNode(KdsPopover, {
1810
1839
  ref_key: "popoverEl",
1811
1840
  ref: popoverEl,
1812
1841
  modelValue: isMenuOpen.value,
1813
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isMenuOpen.value = $event),
1842
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isMenuOpen.value = $event),
1814
1843
  placement: "bottom-left",
1815
1844
  "popover-aria-label": "Menu"
1816
1845
  }, {
@@ -1839,7 +1868,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1839
1868
  }
1840
1869
  });
1841
1870
 
1842
- const KdsMenuButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__scopeId", "data-v-23e9404d"]]);
1871
+ const KdsMenuButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__scopeId", "data-v-be36bcd4"]]);
1843
1872
 
1844
1873
  const kdsButtonSize = {
1845
1874
  XSMALL: "xsmall",
@@ -2762,7 +2791,7 @@ const _hoisted_2$a = {
2762
2791
  key: 1,
2763
2792
  class: "leading-slot"
2764
2793
  };
2765
- const _hoisted_3$8 = ["id", "value", "type", "inputmode", "placeholder", "disabled", "autocomplete", "min", "max", "step", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "role", "pattern", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext", "aria-activedescendant"];
2794
+ const _hoisted_3$8 = ["id", "value", "type", "inputmode", "placeholder", "disabled", "autocomplete", "min", "max", "step", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "role", "pattern", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext", "aria-activedescendant", "aria-haspopup", "aria-controls", "aria-expanded"];
2766
2795
  const _hoisted_4$5 = ["aria-disabled"];
2767
2796
  const _hoisted_5$3 = {
2768
2797
  key: 4,
@@ -2779,6 +2808,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2779
2808
  type: { default: "text" },
2780
2809
  min: { default: void 0 },
2781
2810
  max: { default: void 0 },
2811
+ ariaExpanded: { type: Boolean, default: void 0 },
2782
2812
  step: { default: void 0 },
2783
2813
  placeholder: { default: void 0 },
2784
2814
  disabled: { type: Boolean, default: false },
@@ -2796,6 +2826,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2796
2826
  ariaValuemax: { default: void 0 },
2797
2827
  ariaValuetext: { default: void 0 },
2798
2828
  ariaActivedescendant: { default: void 0 },
2829
+ ariaHaspopup: { default: void 0 },
2830
+ ariaControls: { default: void 0 },
2799
2831
  unit: { default: void 0 },
2800
2832
  inputmode: { default: void 0 },
2801
2833
  clearable: { type: Boolean, default: false },
@@ -2879,6 +2911,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2879
2911
  "aria-valuemax": props.ariaValuemax,
2880
2912
  "aria-valuetext": props.ariaValuetext,
2881
2913
  "aria-activedescendant": props.ariaActivedescendant,
2914
+ "aria-haspopup": props.ariaHaspopup,
2915
+ "aria-controls": props.ariaControls,
2916
+ "aria-expanded": props.ariaExpanded,
2882
2917
  class: normalizeClass({ "input-field": true, "has-value": hasValue.value }),
2883
2918
  onInput: handleInput,
2884
2919
  onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
@@ -2919,7 +2954,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2919
2954
  }
2920
2955
  });
2921
2956
 
2922
- const BaseInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__scopeId", "data-v-8815d034"]]);
2957
+ const BaseInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__scopeId", "data-v-d8e771c0"]]);
2923
2958
 
2924
2959
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
2925
2960
  __name: "KdsTextInput",
@@ -13866,14 +13901,14 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13866
13901
  variant: "large",
13867
13902
  "possible-values": possibleFormats.value,
13868
13903
  "empty-text": "No recently used formats",
13869
- onItemClick: _cache[2] || (_cache[2] = ($event) => selection.value = decodeURIComponent($event))
13904
+ onItemClick: _cache[2] || (_cache[2] = ($event) => $event && (selection.value = decodeURIComponent($event)))
13870
13905
  }, null, 8, ["possible-values"])
13871
13906
  ]);
13872
13907
  };
13873
13908
  }
13874
13909
  });
13875
13910
 
13876
- const DateTimeFormatPopover = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-892448f6"]]);
13911
+ const DateTimeFormatPopover = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-f75ebe1b"]]);
13877
13912
 
13878
13913
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
13879
13914
  __name: "KdsDateTimeFormatInput",
@@ -14109,6 +14144,8 @@ const createKdsNumberParser = (params) => {
14109
14144
  };
14110
14145
  };
14111
14146
 
14147
+ const REPEAT_INITIAL_DELAY_MS = 400;
14148
+ const REPEAT_INTERVAL_MS = 100;
14112
14149
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
14113
14150
  __name: "KdsNumberInput",
14114
14151
  props: /* @__PURE__ */ mergeModels({
@@ -14225,14 +14262,43 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14225
14262
  localValue.value = value;
14226
14263
  modelValue.value = numberParser.value.parseFromInput(value);
14227
14264
  };
14265
+ const baseInput = useTemplateRef("baseInput");
14266
+ let repeatTimer = null;
14267
+ let isStepping = false;
14228
14268
  const handleBlur = () => {
14269
+ if (isStepping) {
14270
+ baseInput.value?.focus();
14271
+ return;
14272
+ }
14229
14273
  isFocused.value = false;
14230
14274
  const parsed = numberParser.value.parseFromInput(localValue.value);
14231
14275
  const normalized = clamp(parsed);
14232
14276
  modelValue.value = normalized;
14233
14277
  localValue.value = numberParser.value.formatForDisplay(normalized);
14234
14278
  };
14235
- const baseInput = useTemplateRef("baseInput");
14279
+ const stopRepeating = () => {
14280
+ if (repeatTimer !== null) {
14281
+ clearTimeout(repeatTimer);
14282
+ repeatTimer = null;
14283
+ }
14284
+ isStepping = false;
14285
+ };
14286
+ const startRepeating = (direction) => {
14287
+ stopRepeating();
14288
+ isStepping = true;
14289
+ adjustByStep(direction);
14290
+ repeatTimer = setTimeout(function tick() {
14291
+ adjustByStep(direction);
14292
+ repeatTimer = setTimeout(tick, REPEAT_INTERVAL_MS);
14293
+ }, REPEAT_INITIAL_DELAY_MS);
14294
+ };
14295
+ onBeforeUnmount(stopRepeating);
14296
+ const handleButtonClick = (direction, event) => {
14297
+ if (event.detail !== 0) {
14298
+ return;
14299
+ }
14300
+ adjustByStep(direction);
14301
+ };
14236
14302
  __expose({
14237
14303
  focus: () => baseInput.value?.focus()
14238
14304
  });
@@ -14245,7 +14311,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14245
14311
  }, slotProps, {
14246
14312
  "model-value": localValue.value,
14247
14313
  type: "text",
14248
- inputmode: props.step >= 1 ? "numeric" : "decimal",
14314
+ inputmode: Number.isInteger(props.step) ? "numeric" : "decimal",
14249
14315
  placeholder: props.placeholder,
14250
14316
  disabled: props.disabled,
14251
14317
  error: props.error,
@@ -14258,7 +14324,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14258
14324
  "aria-valuetext": ariaValuetext.value,
14259
14325
  "onUpdate:modelValue": handleUpdateModelValue,
14260
14326
  onKeydown: handleKeydown,
14261
- onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
14327
+ onFocus: _cache[4] || (_cache[4] = ($event) => isFocused.value = true),
14262
14328
  onBlur: handleBlur
14263
14329
  }), {
14264
14330
  trailing: withCtx(() => [
@@ -14269,7 +14335,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14269
14335
  "leading-icon": "minus",
14270
14336
  "aria-label": `Decrease ${props.label ?? props.ariaLabel}`,
14271
14337
  disabled: !canDecrease.value,
14272
- onClick: _cache[0] || (_cache[0] = ($event) => adjustByStep(-1))
14338
+ onClick: _cache[0] || (_cache[0] = ($event) => handleButtonClick(-1, $event)),
14339
+ onPointerdown: _cache[1] || (_cache[1] = ($event) => startRepeating(-1)),
14340
+ onPointerup: stopRepeating,
14341
+ onPointerleave: stopRepeating,
14342
+ onPointercancel: stopRepeating
14273
14343
  }, null, 8, ["aria-label", "disabled"]),
14274
14344
  createVNode(_sfc_main$L, {
14275
14345
  type: "button",
@@ -14278,7 +14348,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14278
14348
  "leading-icon": "plus",
14279
14349
  "aria-label": `Increase ${props.label ?? props.ariaLabel}`,
14280
14350
  disabled: !canIncrease.value,
14281
- onClick: _cache[1] || (_cache[1] = ($event) => adjustByStep(1))
14351
+ onClick: _cache[2] || (_cache[2] = ($event) => handleButtonClick(1, $event)),
14352
+ onPointerdown: _cache[3] || (_cache[3] = ($event) => startRepeating(1)),
14353
+ onPointerup: stopRepeating,
14354
+ onPointerleave: stopRepeating,
14355
+ onPointercancel: stopRepeating
14282
14356
  }, null, 8, ["aria-label", "disabled"])
14283
14357
  ]),
14284
14358
  _: 1
@@ -14517,22 +14591,83 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14517
14591
  preserveSubTextSpace: { type: Boolean, default: false },
14518
14592
  placeholder: { default: "Search" },
14519
14593
  disabled: { type: Boolean, default: false },
14520
- autocomplete: {}
14594
+ autocomplete: {},
14595
+ results: {},
14596
+ resultsMaxHeight: {}
14521
14597
  }, {
14522
14598
  "modelValue": { default: "" },
14523
14599
  "modelModifiers": {}
14524
14600
  }),
14525
- emits: /* @__PURE__ */ mergeModels(["focus", "blur", "keydown"], ["update:modelValue"]),
14601
+ emits: /* @__PURE__ */ mergeModels(["focus", "blur", "keydown", "resultClick"], ["update:modelValue"]),
14526
14602
  setup(__props, { expose: __expose, emit: __emit }) {
14603
+ const KdsPopover = defineAsyncComponent(
14604
+ () => Promise.resolve().then(() => KdsPopover$1)
14605
+ );
14606
+ const KdsListContainer = defineAsyncComponent(
14607
+ () => Promise.resolve().then(() => KdsListContainer$1)
14608
+ );
14527
14609
  const props = __props;
14528
14610
  const modelValue = useModel(__props, "modelValue");
14529
14611
  const emit = __emit;
14530
14612
  const baseInput = useTemplateRef("baseInput");
14613
+ const popoverEl = useTemplateRef("popover");
14614
+ const listContainerEl = useTemplateRef("listContainer");
14615
+ const resultsOpen = ref(false);
14616
+ const resultsId = useId();
14617
+ const onKeyDown = (event) => {
14618
+ if (resultsOpen.value) {
14619
+ listContainerEl.value?.handleKeydown(event);
14620
+ }
14621
+ emit("keydown", event);
14622
+ };
14623
+ const onFocus = (event) => {
14624
+ if (props.results) {
14625
+ resultsOpen.value = true;
14626
+ listContainerEl.value?.handleFocus();
14627
+ }
14628
+ emit("focus", event);
14629
+ };
14630
+ const onBlur = (event) => {
14631
+ if (resultsOpen.value) {
14632
+ resultsOpen.value = false;
14633
+ listContainerEl.value?.handleBlur();
14634
+ }
14635
+ emit("blur", event);
14636
+ };
14637
+ const onClick = () => {
14638
+ if (props.results && !resultsOpen.value) {
14639
+ resultsOpen.value = true;
14640
+ listContainerEl.value?.handleFocus();
14641
+ }
14642
+ };
14643
+ const maxHeightStyle = computed(() => {
14644
+ if (!props.resultsMaxHeight) {
14645
+ return {};
14646
+ }
14647
+ return {
14648
+ maxHeight: props.resultsMaxHeight,
14649
+ overflowY: "auto"
14650
+ };
14651
+ });
14652
+ const onResultClick = (itemId) => {
14653
+ resultsOpen.value = false;
14654
+ listContainerEl.value?.handleBlur();
14655
+ emit("resultClick", itemId);
14656
+ };
14531
14657
  __expose({
14532
14658
  focus: () => baseInput.value?.focus()
14533
14659
  });
14534
14660
  return (_ctx, _cache) => {
14535
- return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
14661
+ return openBlock(), createBlock(BaseFormFieldWrapper, {
14662
+ id: __props.id,
14663
+ label: __props.label,
14664
+ "aria-label": __props.ariaLabel,
14665
+ description: __props.description,
14666
+ "sub-text": __props.subText,
14667
+ error: __props.error,
14668
+ validating: __props.validating,
14669
+ "preserve-sub-text-space": __props.preserveSubTextSpace
14670
+ }, {
14536
14671
  default: withCtx((slotProps) => [
14537
14672
  createVNode(BaseInput, mergeProps({
14538
14673
  ref_key: "baseInput",
@@ -14541,23 +14676,61 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14541
14676
  modelValue: modelValue.value,
14542
14677
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
14543
14678
  type: "search",
14544
- placeholder: props.placeholder,
14545
- disabled: props.disabled,
14546
- error: props.error,
14547
- autocomplete: props.autocomplete,
14679
+ placeholder: __props.placeholder,
14680
+ disabled: __props.disabled,
14681
+ error: __props.error,
14682
+ autocomplete: __props.autocomplete,
14548
14683
  "leading-icon": "search",
14549
14684
  clearable: true,
14550
- onFocus: _cache[1] || (_cache[1] = ($event) => emit("focus", $event)),
14551
- onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event)),
14552
- onKeydown: _cache[3] || (_cache[3] = ($event) => emit("keydown", $event))
14553
- }), null, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete"])
14685
+ style: popoverEl.value?.anchorStyle,
14686
+ role: __props.results ? "combobox" : void 0,
14687
+ "aria-activedescendant": resultsOpen.value ? listContainerEl.value?.activeDescendant : void 0,
14688
+ "aria-haspopup": __props.results ? "listbox" : void 0,
14689
+ "aria-controls": __props.results ? unref(resultsId) : void 0,
14690
+ "aria-expanded": __props.results ? resultsOpen.value : void 0,
14691
+ onKeydown: onKeyDown,
14692
+ onFocus,
14693
+ onBlur,
14694
+ onClick
14695
+ }), null, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete", "style", "role", "aria-activedescendant", "aria-haspopup", "aria-controls", "aria-expanded"]),
14696
+ __props.results ? (openBlock(), createBlock(unref(KdsPopover), {
14697
+ key: 0,
14698
+ ref: "popover",
14699
+ modelValue: resultsOpen.value,
14700
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => resultsOpen.value = $event),
14701
+ "full-width": "",
14702
+ "popover-type": "manual",
14703
+ "popover-aria-label": "Search results container"
14704
+ }, {
14705
+ default: withCtx(() => [
14706
+ createElementVNode("div", {
14707
+ class: "kds-search-results-container",
14708
+ style: normalizeStyle(maxHeightStyle.value)
14709
+ }, [
14710
+ createVNode(unref(KdsListContainer), {
14711
+ id: unref(resultsId),
14712
+ ref: "listContainer",
14713
+ variant: "large",
14714
+ "possible-values": __props.results,
14715
+ "controlled-externally": "",
14716
+ "allow-no-selection": "",
14717
+ "empty-text": "No search results",
14718
+ "aria-label": "Search results list",
14719
+ onItemClick: onResultClick
14720
+ }, null, 8, ["id", "possible-values"])
14721
+ ], 4)
14722
+ ]),
14723
+ _: 1
14724
+ }, 8, ["modelValue"])) : createCommentVNode("", true)
14554
14725
  ]),
14555
14726
  _: 1
14556
- }, 16);
14727
+ }, 8, ["id", "label", "aria-label", "description", "sub-text", "error", "validating", "preserve-sub-text-space"]);
14557
14728
  };
14558
14729
  }
14559
14730
  });
14560
14731
 
14732
+ const KdsSearchInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__scopeId", "data-v-df327342"]]);
14733
+
14561
14734
  const _hoisted_1$c = ["rows", "placeholder", "disabled", "autocomplete"];
14562
14735
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
14563
14736
  __name: "KdsTextarea",
@@ -14832,14 +15005,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
14832
15005
  "empty-text": props.emptyText,
14833
15006
  "controlled-externally": "",
14834
15007
  "aria-label": "Dropdown options",
14835
- onItemClick: _cache[4] || (_cache[4] = ($event) => modelValue.value = $event)
15008
+ onItemClick: _cache[4] || (_cache[4] = ($event) => $event && (modelValue.value = $event))
14836
15009
  }, null, 8, ["class", "possible-values", "loading", "empty-text"])
14837
15010
  ]);
14838
15011
  };
14839
15012
  }
14840
15013
  });
14841
15014
 
14842
- const DropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__scopeId", "data-v-9e62fb49"]]);
15015
+ const DropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__scopeId", "data-v-ceeaf8b9"]]);
14843
15016
 
14844
15017
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
14845
15018
  __name: "KdsDropdown",
@@ -15125,7 +15298,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15125
15298
  "empty-text": props.emptyText,
15126
15299
  "controlled-externally": "",
15127
15300
  "aria-label": "Dropdown options",
15128
- onItemClick
15301
+ onItemClick: _cache[4] || (_cache[4] = ($event) => $event && onItemClick($event))
15129
15302
  }, null, 8, ["class", "possible-values", "loading", "empty-text"]),
15130
15303
  !props.loading && visibleEnabledIds.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
15131
15304
  createVNode(unref(KdsListItemButton), {
@@ -15140,7 +15313,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15140
15313
  }
15141
15314
  });
15142
15315
 
15143
- const MultiSelectDropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-361c57bf"]]);
15316
+ const MultiSelectDropdownContainer = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-bb63f252"]]);
15144
15317
 
15145
15318
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15146
15319
  __name: "KdsMultiSelectDropdown",
@@ -15959,5 +16132,5 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15959
16132
 
15960
16133
  const KdsDynamicModalProvider = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-41fc8d84"]]);
15961
16134
 
15962
- export { KdsAvatar, KdsBadge, _sfc_main$L as KdsButton, KdsCardClickable, _sfc_main$w as KdsCheckbox, KdsCheckboxGroup, _sfc_main$m as KdsColorInput, KdsColorSwatch, KdsDataType, _sfc_main$k as KdsDateInput, _sfc_main$i as KdsDateTimeFormatInput, _sfc_main$b as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, KdsLabel, _sfc_main$K as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsMenuButton, KdsModal, KdsModalLayout, _sfc_main$8 as KdsMultiSelectDropdown, _sfc_main$h as KdsNumberInput, _sfc_main$g as KdsPatternInput, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, _sfc_main$f as KdsSearchInput, KdsSubText, _sfc_main$o as KdsTextInput, KdsTextarea, _sfc_main$J as KdsToggleButton, 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, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsTemporalType, kdsTemporalTypes, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
16135
+ export { KdsAvatar, KdsBadge, _sfc_main$L as KdsButton, KdsCardClickable, _sfc_main$w as KdsCheckbox, KdsCheckboxGroup, _sfc_main$m as KdsColorInput, KdsColorSwatch, KdsDataType, _sfc_main$k as KdsDateInput, _sfc_main$i as KdsDateTimeFormatInput, _sfc_main$b as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, KdsLabel, _sfc_main$K as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsMenuButton, KdsModal, KdsModalLayout, _sfc_main$8 as KdsMultiSelectDropdown, _sfc_main$h as KdsNumberInput, _sfc_main$g as KdsPatternInput, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, KdsSearchInput, KdsSubText, _sfc_main$o as KdsTextInput, KdsTextarea, _sfc_main$J as KdsToggleButton, 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, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsTemporalType, kdsTemporalTypes, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
15963
16136
  //# sourceMappingURL=index.js.map