@knime/kds-components 0.13.2 → 0.15.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 (97) hide show
  1. package/dist/accessories/Badge/KdsBadge.vue.d.ts +1 -1
  2. package/dist/accessories/Icon/KdsDataType.vue.d.ts +3 -7
  3. package/dist/accessories/Icon/KdsDataType.vue.d.ts.map +1 -1
  4. package/dist/accessories/Icon/KdsIcon.vue.d.ts +4 -7
  5. package/dist/accessories/Icon/KdsIcon.vue.d.ts.map +1 -1
  6. package/dist/accessories/Icon/types.d.ts +40 -2
  7. package/dist/accessories/Icon/types.d.ts.map +1 -1
  8. package/dist/accessories/LiveStatus/enums.d.ts +1 -1
  9. package/dist/forms/Checkbox/KdsCheckboxGroup.vue.d.ts +1 -1
  10. package/dist/forms/RadioButton/KdsRadioButton.vue.d.ts +1 -1
  11. package/dist/forms/RadioButton/KdsValueSwitch.vue.d.ts +1 -1
  12. package/dist/forms/_helper/InfoPopover/KdsInfoToggleButton.vue.d.ts.map +1 -1
  13. package/dist/forms/_helper/List/KdsListItem/KdsListItem.vue.d.ts +7 -4
  14. package/dist/forms/_helper/List/KdsListItem/KdsListItem.vue.d.ts.map +1 -1
  15. package/dist/forms/_helper/List/KdsListItem/enums.d.ts +6 -0
  16. package/dist/forms/_helper/List/KdsListItem/enums.d.ts.map +1 -0
  17. package/dist/forms/_helper/List/KdsListItem/types.d.ts +11 -2
  18. package/dist/forms/_helper/List/KdsListItem/types.d.ts.map +1 -1
  19. package/dist/forms/_helper/List/ListContainer/KdsListContainer.vue.d.ts +17 -0
  20. package/dist/forms/_helper/List/ListContainer/KdsListContainer.vue.d.ts.map +1 -0
  21. package/dist/forms/_helper/List/ListContainer/index.d.ts +3 -0
  22. package/dist/forms/_helper/List/ListContainer/index.d.ts.map +1 -0
  23. package/dist/forms/_helper/List/ListContainer/types.d.ts +39 -0
  24. package/dist/forms/_helper/List/ListContainer/types.d.ts.map +1 -0
  25. package/dist/forms/_helper/List/ListItemAccessory/ListItemAccessory.vue.d.ts +6 -3
  26. package/dist/forms/_helper/List/ListItemAccessory/ListItemAccessory.vue.d.ts.map +1 -1
  27. package/dist/forms/_helper/List/ListItemAccessory/enums.d.ts +7 -0
  28. package/dist/forms/_helper/List/ListItemAccessory/enums.d.ts.map +1 -0
  29. package/dist/forms/_helper/List/ListItemAccessory/types.d.ts +2 -0
  30. package/dist/forms/_helper/List/ListItemAccessory/types.d.ts.map +1 -1
  31. package/dist/forms/_helper/VariablePopover/KdsVariableToggleButton.vue.d.ts.map +1 -1
  32. package/dist/forms/index.d.ts +2 -0
  33. package/dist/forms/index.d.ts.map +1 -1
  34. package/dist/forms/inputs/BaseInput.vue.d.ts +10 -17
  35. package/dist/forms/inputs/BaseInput.vue.d.ts.map +1 -1
  36. package/dist/forms/inputs/ColorInput/ColorPicker.vue.d.ts +13 -0
  37. package/dist/forms/inputs/ColorInput/ColorPicker.vue.d.ts.map +1 -0
  38. package/dist/forms/inputs/ColorInput/KdsColorInput.vue.d.ts +3 -0
  39. package/dist/forms/inputs/ColorInput/KdsColorInput.vue.d.ts.map +1 -0
  40. package/dist/forms/inputs/ColorInput/colorUtils.d.ts +21 -0
  41. package/dist/forms/inputs/ColorInput/colorUtils.d.ts.map +1 -0
  42. package/dist/forms/inputs/ColorInput/index.d.ts +3 -0
  43. package/dist/forms/inputs/ColorInput/index.d.ts.map +1 -0
  44. package/dist/forms/inputs/ColorInput/types.d.ts +3 -0
  45. package/dist/forms/inputs/ColorInput/types.d.ts.map +1 -0
  46. package/dist/forms/inputs/ColorInput/useColorInputValidationOnFocusOut.d.ts +5 -0
  47. package/dist/forms/inputs/ColorInput/useColorInputValidationOnFocusOut.d.ts.map +1 -0
  48. package/dist/forms/inputs/ColorInput/usePointerHandler.d.ts +7 -0
  49. package/dist/forms/inputs/ColorInput/usePointerHandler.d.ts.map +1 -0
  50. package/dist/forms/inputs/NumberInput/KdsNumberInput.vue.d.ts.map +1 -1
  51. package/dist/forms/inputs/NumberInput/index.d.ts +1 -0
  52. package/dist/forms/inputs/NumberInput/index.d.ts.map +1 -1
  53. package/dist/forms/inputs/NumberInput/types.d.ts +23 -0
  54. package/dist/forms/inputs/NumberInput/types.d.ts.map +1 -0
  55. package/dist/forms/inputs/PatternInput/KdsPatternInput.vue.d.ts.map +1 -1
  56. package/dist/forms/inputs/PatternInput/index.d.ts +1 -0
  57. package/dist/forms/inputs/PatternInput/index.d.ts.map +1 -1
  58. package/dist/forms/inputs/PatternInput/types.d.ts +3 -0
  59. package/dist/forms/inputs/PatternInput/types.d.ts.map +1 -0
  60. package/dist/forms/inputs/SearchInput/KdsSearchInput.vue.d.ts.map +1 -1
  61. package/dist/forms/inputs/SearchInput/index.d.ts +1 -0
  62. package/dist/forms/inputs/SearchInput/index.d.ts.map +1 -1
  63. package/dist/forms/inputs/SearchInput/types.d.ts +3 -0
  64. package/dist/forms/inputs/SearchInput/types.d.ts.map +1 -0
  65. package/dist/forms/inputs/TextInput/KdsTextInput.vue.d.ts.map +1 -1
  66. package/dist/forms/inputs/TextInput/index.d.ts +1 -0
  67. package/dist/forms/inputs/TextInput/index.d.ts.map +1 -1
  68. package/dist/forms/inputs/TextInput/types.d.ts +3 -0
  69. package/dist/forms/inputs/TextInput/types.d.ts.map +1 -0
  70. package/dist/forms/inputs/Textarea/KdsTextarea.vue.d.ts.map +1 -1
  71. package/dist/forms/inputs/Textarea/index.d.ts +1 -0
  72. package/dist/forms/inputs/Textarea/index.d.ts.map +1 -1
  73. package/dist/forms/inputs/Textarea/types.d.ts +8 -0
  74. package/dist/forms/inputs/Textarea/types.d.ts.map +1 -0
  75. package/dist/forms/inputs/index.d.ts +7 -1
  76. package/dist/forms/inputs/index.d.ts.map +1 -1
  77. package/dist/forms/inputs/types.d.ts +1 -43
  78. package/dist/forms/inputs/types.d.ts.map +1 -1
  79. package/dist/forms/selects/Dropdown/BaseDropdown.vue.d.ts +28 -0
  80. package/dist/forms/selects/Dropdown/BaseDropdown.vue.d.ts.map +1 -0
  81. package/dist/forms/selects/Dropdown/DropdownContainer.vue.d.ts +252 -0
  82. package/dist/forms/selects/Dropdown/DropdownContainer.vue.d.ts.map +1 -0
  83. package/dist/forms/selects/Dropdown/KdsDropdown.vue.d.ts +3 -0
  84. package/dist/forms/selects/Dropdown/KdsDropdown.vue.d.ts.map +1 -0
  85. package/dist/forms/selects/Dropdown/index.d.ts +3 -0
  86. package/dist/forms/selects/Dropdown/index.d.ts.map +1 -0
  87. package/dist/forms/selects/Dropdown/types.d.ts +62 -0
  88. package/dist/forms/selects/Dropdown/types.d.ts.map +1 -0
  89. package/dist/forms/selects/index.d.ts +3 -0
  90. package/dist/forms/selects/index.d.ts.map +1 -0
  91. package/dist/index.css +471 -149
  92. package/dist/index.js +1992 -815
  93. package/dist/index.js.map +1 -1
  94. package/dist/overlays/Modal/KdsModal.vue.d.ts +2 -2
  95. package/dist/overlays/Modal/KdsModalLayout.vue.d.ts +1 -1
  96. package/dist/overlays/Modal/useKdsDynamicModal.d.ts +3 -3
  97. package/package.json +4 -4
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, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, createVNode, defineAsyncComponent, useId, Fragment, renderList, onBeforeUpdate, nextTick, withModifiers, normalizeProps, guardReactiveProps, withDirectives, vModelText, watchEffect, createTextVNode, useCssVars, mergeDefaults, createSlots } from 'vue';
1
+ import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, shallowRef, toRef, unref, createBlock, resolveDynamicComponent, createCommentVNode, normalizeStyle, useTemplateRef, withCtx, renderSlot, mergeProps, h, useSlots, getCurrentInstance, useModel, mergeModels, createVNode, defineAsyncComponent, useId, Fragment, renderList, onBeforeUpdate, nextTick, watchEffect, withModifiers, normalizeProps, guardReactiveProps, withDirectives, vModelText, toHandlers, createTextVNode, 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 = {
@@ -9,14 +9,14 @@ import './index.css';const kdsAvatarSize = {
9
9
  };
10
10
  const kdsAvatarSizes = Object.values(kdsAvatarSize);
11
11
 
12
- const _hoisted_1$r = ["role", "title", "aria-hidden", "aria-label"];
13
- const _hoisted_2$b = ["src"];
14
- const _hoisted_3$6 = {
12
+ const _hoisted_1$w = ["role", "title", "aria-hidden", "aria-label"];
13
+ const _hoisted_2$f = ["src"];
14
+ const _hoisted_3$9 = {
15
15
  key: 1,
16
16
  class: "kds-avatar-initials",
17
17
  "aria-hidden": "true"
18
18
  };
19
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
19
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
20
20
  __name: "KdsAvatar",
21
21
  props: {
22
22
  initials: {},
@@ -59,10 +59,10 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
59
59
  alt: "",
60
60
  "aria-hidden": "true",
61
61
  onError: onImageError
62
- }, null, 40, _hoisted_2$b)) : (openBlock(), createElementBlock("div", _hoisted_3$6, [
62
+ }, null, 40, _hoisted_2$f)) : (openBlock(), createElementBlock("div", _hoisted_3$9, [
63
63
  createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)
64
64
  ]))
65
- ], 10, _hoisted_1$r);
65
+ ], 10, _hoisted_1$w);
66
66
  };
67
67
  }
68
68
  });
@@ -75,7 +75,7 @@ const _export_sfc = (sfc, props) => {
75
75
  return target;
76
76
  };
77
77
 
78
- const KdsAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-d6a313f1"]]);
78
+ const KdsAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-d6a313f1"]]);
79
79
 
80
80
  const __variableDynamicImportRuntimeHelper = (glob$1, path$13, segs) => {
81
81
  const v = glob$1[path$13];
@@ -111,11 +111,12 @@ const useIcon = ({
111
111
  return iconComponent;
112
112
  };
113
113
 
114
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
114
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
115
115
  __name: "KdsIcon",
116
116
  props: {
117
117
  name: {},
118
- size: { default: "medium" }
118
+ size: { default: "medium" },
119
+ disabled: { type: Boolean, default: false }
119
120
  },
120
121
  setup(__props) {
121
122
  const props = __props;
@@ -123,12 +124,12 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
123
124
  return (_ctx, _cache) => {
124
125
  return unref(iconComponent) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent)), {
125
126
  key: 0,
126
- class: normalizeClass(["kds-icon", props.size]),
127
+ class: normalizeClass(["kds-icon", props.size, { disabled: __props.disabled }]),
127
128
  "aria-hidden": "true",
128
129
  focusable: "false"
129
130
  }, null, 8, ["class"])) : (openBlock(), createElementBlock("span", {
130
131
  key: 1,
131
- class: normalizeClass(["kds-icon", props.size]),
132
+ class: normalizeClass(["kds-icon", props.size, { disabled: __props.disabled }]),
132
133
  "aria-hidden": "true",
133
134
  focusable: "false"
134
135
  }, null, 2));
@@ -136,7 +137,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
136
137
  }
137
138
  });
138
139
 
139
- const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-3a57d423"]]);
140
+ const KdsIcon = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-4da5bf3e"]]);
140
141
 
141
142
  const ID_TO_ICON_MAP = {
142
143
  // Flow Variables
@@ -462,13 +463,14 @@ const kdsDataTypeSize = {
462
463
  };
463
464
  const kdsDataTypeSizes = Object.values(kdsDataTypeSize);
464
465
 
465
- const _hoisted_1$q = ["title"];
466
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
466
+ const _hoisted_1$v = ["title"];
467
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
467
468
  __name: "KdsDataType",
468
469
  props: {
469
470
  iconName: { default: "unknown-datatype" },
470
471
  iconTitle: { default: "Unknown Data Type" },
471
- size: { default: "medium" }
472
+ size: { default: "medium" },
473
+ disabled: { type: Boolean, default: false }
472
474
  },
473
475
  setup(__props) {
474
476
  const DATA_TYPE_SIZE_TO_ICON_SIZE = {
@@ -495,7 +497,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
495
497
  });
496
498
  return (_ctx, _cache) => {
497
499
  return openBlock(), createElementBlock("div", {
498
- class: normalizeClass(["kds-data-type-icon-container", __props.size]),
500
+ class: normalizeClass(["kds-data-type-icon-container", __props.size, { disabled: __props.disabled }]),
499
501
  title: props.iconTitle
500
502
  }, [
501
503
  (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent)), {
@@ -503,12 +505,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
503
505
  "aria-hidden": "true",
504
506
  focusable: "false"
505
507
  }, null, 8, ["class"]))
506
- ], 10, _hoisted_1$q);
508
+ ], 10, _hoisted_1$v);
507
509
  };
508
510
  }
509
511
  });
510
512
 
511
- const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-d7166d18"]]);
513
+ const KdsDataType = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-806087da"]]);
512
514
 
513
515
  const kdsBadgeVariant = {
514
516
  NEUTRAL: "neutral",
@@ -525,8 +527,8 @@ const kdsBadgeSize = {
525
527
  };
526
528
  const kdsBadgeSizes = Object.values(kdsBadgeSize);
527
529
 
528
- const _hoisted_1$p = { class: "label-wrapper" };
529
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
530
+ const _hoisted_1$u = { class: "label-wrapper" };
531
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
530
532
  __name: "KdsBadge",
531
533
  props: {
532
534
  label: {},
@@ -548,13 +550,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
548
550
  name: __props.icon,
549
551
  size: sizeToIconSize[__props.size]
550
552
  }, null, 8, ["name", "size"])) : createCommentVNode("", true),
551
- createElementVNode("span", _hoisted_1$p, toDisplayString(__props.label), 1)
553
+ createElementVNode("span", _hoisted_1$u, toDisplayString(__props.label), 1)
552
554
  ], 2);
553
555
  };
554
556
  }
555
557
  });
556
558
 
557
- const KdsBadge = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-5c6c74a8"]]);
559
+ const KdsBadge = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-5c6c74a8"]]);
558
560
 
559
561
  const kdsColorSwatchType = {
560
562
  LEARNER: "learner",
@@ -573,8 +575,8 @@ const kdsColorSwatchSize = {
573
575
  };
574
576
  const kdsColorSwatchSizes = Object.values(kdsColorSwatchSize);
575
577
 
576
- const _hoisted_1$o = ["role", "title", "aria-hidden", "aria-label"];
577
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
578
+ const _hoisted_1$t = ["role", "title", "aria-hidden", "aria-label"];
579
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
578
580
  __name: "KdsColorSwatch",
579
581
  props: {
580
582
  color: {},
@@ -609,12 +611,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
609
611
  style: normalizeStyle({ backgroundColor: backgroundColor.value }),
610
612
  "aria-hidden": hasTitle.value ? void 0 : "true",
611
613
  "aria-label": hasTitle.value ? accessibleTitle.value : void 0
612
- }, null, 14, _hoisted_1$o);
614
+ }, null, 14, _hoisted_1$t);
613
615
  };
614
616
  }
615
617
  });
616
618
 
617
- const KdsColorSwatch = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-bdb3dd24"]]);
619
+ const KdsColorSwatch = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-bdb3dd24"]]);
618
620
 
619
621
  const kdsDarkModeType = {
620
622
  LIGHT: "light",
@@ -734,9 +736,9 @@ function useKdsIsTruncated(elementRef) {
734
736
  return { isTruncated };
735
737
  }
736
738
 
737
- const _hoisted_1$n = ["title", "aria-label"];
738
- const _hoisted_2$a = ["title"];
739
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
739
+ const _hoisted_1$s = ["title", "aria-label"];
740
+ const _hoisted_2$e = ["title"];
741
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
740
742
  __name: "KdsLiveStatus",
741
743
  props: {
742
744
  status: { default: "red" },
@@ -765,13 +767,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
765
767
  ref: labelEl,
766
768
  class: "label",
767
769
  title: unref(isTruncated) ? props.label : void 0
768
- }, toDisplayString(props.label), 9, _hoisted_2$a)) : createCommentVNode("", true)
769
- ], 10, _hoisted_1$n);
770
+ }, toDisplayString(props.label), 9, _hoisted_2$e)) : createCommentVNode("", true)
771
+ ], 10, _hoisted_1$s);
770
772
  };
771
773
  }
772
774
  });
773
775
 
774
- const KdsLiveStatus = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-4dec8e94"]]);
776
+ const KdsLiveStatus = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-4dec8e94"]]);
775
777
 
776
778
  const kdsLiveStatusStatus = {
777
779
  RED: "red",
@@ -787,8 +789,8 @@ const kdsLiveStatusSize = {
787
789
  };
788
790
  const kdsLiveStatusSizes = Object.values(kdsLiveStatusSize);
789
791
 
790
- const _hoisted_1$m = ["data-style"];
791
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
792
+ const _hoisted_1$r = ["data-style"];
793
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
792
794
  __name: "KdsLoadingSpinner",
793
795
  props: {
794
796
  size: { default: "medium" },
@@ -813,12 +815,12 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
813
815
  cy: "60",
814
816
  r: "50"
815
817
  }, null, -1)
816
- ])], 10, _hoisted_1$m);
818
+ ])], 10, _hoisted_1$r);
817
819
  };
818
820
  }
819
821
  });
820
822
 
821
- const KdsLoadingSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-74bb7c3d"]]);
823
+ const KdsLoadingSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-74bb7c3d"]]);
822
824
 
823
825
  const kdsLoadingSpinnerVariant = {
824
826
  ON_PRIMARY: "onPrimary",
@@ -828,11 +830,11 @@ const kdsLoadingSpinnerVariants = Object.values(
828
830
  kdsLoadingSpinnerVariant
829
831
  );
830
832
 
831
- const _hoisted_1$l = {
833
+ const _hoisted_1$q = {
832
834
  key: 0,
833
835
  class: "label"
834
836
  };
835
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
837
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
836
838
  __name: "BaseButton",
837
839
  props: {
838
840
  size: { default: "medium" },
@@ -891,7 +893,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
891
893
  size: iconSize.value
892
894
  }, null, 8, ["name", "size"])) : createCommentVNode("", true)
893
895
  ], true),
894
- props.label ? (openBlock(), createElementBlock("span", _hoisted_1$l, toDisplayString(props.label), 1)) : createCommentVNode("", true),
896
+ props.label ? (openBlock(), createElementBlock("span", _hoisted_1$q, toDisplayString(props.label), 1)) : createCommentVNode("", true),
895
897
  props.trailingIcon && props.label ? (openBlock(), createBlock(KdsIcon, {
896
898
  key: 1,
897
899
  name: props.trailingIcon,
@@ -904,9 +906,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
904
906
  }
905
907
  });
906
908
 
907
- const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-b0f9559f"]]);
909
+ const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-b0f9559f"]]);
908
910
 
909
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
911
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
910
912
  __name: "KdsButton",
911
913
  props: {
912
914
  size: {},
@@ -959,7 +961,7 @@ const resolveNuxtLinkComponent = () => {
959
961
  return fallbackComponent;
960
962
  };
961
963
 
962
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
964
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
963
965
  __name: "KdsLinkButton",
964
966
  props: {
965
967
  size: {},
@@ -995,7 +997,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
995
997
  }
996
998
  });
997
999
 
998
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1000
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
999
1001
  __name: "KdsToggleButton",
1000
1002
  props: /* @__PURE__ */ mergeModels({
1001
1003
  size: {},
@@ -1030,9 +1032,9 @@ const kdsToggleButtonVariant = {
1030
1032
  };
1031
1033
  const kdsToggleButtonVariants = Object.values(kdsToggleButtonVariant);
1032
1034
 
1033
- const _hoisted_1$k = ["data-visible"];
1034
- const _hoisted_2$9 = ["data-visible"];
1035
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1035
+ const _hoisted_1$p = ["data-visible"];
1036
+ const _hoisted_2$d = ["data-visible"];
1037
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1036
1038
  __name: "KdsProgressButton",
1037
1039
  props: /* @__PURE__ */ mergeModels({
1038
1040
  size: { default: "medium" },
@@ -1095,7 +1097,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1095
1097
  name: props.leadingIcon,
1096
1098
  size: iconSize.value
1097
1099
  }, null, 8, ["name", "size"])
1098
- ], 8, _hoisted_1$k),
1100
+ ], 8, _hoisted_1$p),
1099
1101
  createElementVNode("span", {
1100
1102
  class: "spinner",
1101
1103
  "data-visible": state.value === "progress"
@@ -1104,7 +1106,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1104
1106
  size: iconSize.value,
1105
1107
  variant: props.variant === "filled" ? "onPrimary" : "onSurface"
1106
1108
  }, null, 8, ["size", "variant"])
1107
- ], 8, _hoisted_2$9)
1109
+ ], 8, _hoisted_2$d)
1108
1110
  ], 2)
1109
1111
  ]),
1110
1112
  _: 1
@@ -1113,7 +1115,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1113
1115
  }
1114
1116
  });
1115
1117
 
1116
- const KdsProgressButton = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-ec08a9ba"]]);
1118
+ const KdsProgressButton = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-ec08a9ba"]]);
1117
1119
 
1118
1120
  const kdsProgressButtonState = {
1119
1121
  DEFAULT: "default",
@@ -1137,9 +1139,9 @@ const kdsButtonVariant = {
1137
1139
  };
1138
1140
  const kdsButtonVariants = Object.values(kdsButtonVariant);
1139
1141
 
1140
- const _hoisted_1$j = { class: "kds-label-wrapper" };
1141
- const _hoisted_2$8 = ["id", "for", "title"];
1142
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
1142
+ const _hoisted_1$o = { class: "kds-label-wrapper" };
1143
+ const _hoisted_2$c = ["id", "for", "title"];
1144
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1143
1145
  __name: "KdsLabel",
1144
1146
  props: {
1145
1147
  label: {},
@@ -1156,7 +1158,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1156
1158
  const labelEl = useTemplateRef("labelEl");
1157
1159
  const { isTruncated } = useKdsIsTruncated(labelEl);
1158
1160
  return (_ctx, _cache) => {
1159
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
1161
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [
1160
1162
  createElementVNode("label", {
1161
1163
  id: props.id,
1162
1164
  ref_key: "labelEl",
@@ -1164,7 +1166,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1164
1166
  for: props.for,
1165
1167
  class: "label",
1166
1168
  title: unref(isTruncated) ? props.label : void 0
1167
- }, toDisplayString(props.label), 9, _hoisted_2$8),
1169
+ }, toDisplayString(props.label), 9, _hoisted_2$c),
1168
1170
  props.description ? (openBlock(), createBlock(unref(KdsInfoToggleButton), {
1169
1171
  key: 0,
1170
1172
  content: props.description,
@@ -1175,11 +1177,11 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1175
1177
  }
1176
1178
  });
1177
1179
 
1178
- const KdsLabel = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-1a5dc1ba"]]);
1180
+ const KdsLabel = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-1a5dc1ba"]]);
1179
1181
 
1180
- const _hoisted_1$i = ["id"];
1181
- const _hoisted_2$7 = { class: "subtext-text" };
1182
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
1182
+ const _hoisted_1$n = ["id"];
1183
+ const _hoisted_2$b = { class: "subtext-text" };
1184
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1183
1185
  __name: "KdsSubText",
1184
1186
  props: {
1185
1187
  id: {},
@@ -1210,27 +1212,27 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1210
1212
  variant: "onSurface",
1211
1213
  "aria-hidden": "true"
1212
1214
  })) : createCommentVNode("", true),
1213
- createElementVNode("span", _hoisted_2$7, toDisplayString(props.subText), 1)
1214
- ], 10, _hoisted_1$i)) : createCommentVNode("", true);
1215
+ createElementVNode("span", _hoisted_2$b, toDisplayString(props.subText), 1)
1216
+ ], 10, _hoisted_1$n)) : createCommentVNode("", true);
1215
1217
  };
1216
1218
  }
1217
1219
  });
1218
1220
 
1219
- const KdsSubText = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-df9a85a4"]]);
1221
+ const KdsSubText = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-df9a85a4"]]);
1220
1222
 
1221
- const _hoisted_1$h = ["disabled", "title", "aria-label", "aria-checked", "aria-describedby", "aria-invalid"];
1222
- const _hoisted_2$6 = { class: "control" };
1223
- const _hoisted_3$5 = {
1223
+ const _hoisted_1$m = ["disabled", "title", "aria-label", "aria-checked", "aria-describedby", "aria-invalid"];
1224
+ const _hoisted_2$a = { class: "control" };
1225
+ const _hoisted_3$8 = {
1224
1226
  key: 0,
1225
1227
  class: "content"
1226
1228
  };
1227
- const _hoisted_4$4 = { class: "label" };
1228
- const _hoisted_5$2 = ["id"];
1229
- const _hoisted_6$1 = {
1229
+ const _hoisted_4$6 = { class: "label" };
1230
+ const _hoisted_5$3 = ["id"];
1231
+ const _hoisted_6$3 = {
1230
1232
  key: 0,
1231
1233
  class: "subtext-wrapper"
1232
1234
  };
1233
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
1235
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1234
1236
  __name: "BaseCheckbox",
1235
1237
  props: /* @__PURE__ */ mergeModels({
1236
1238
  disabled: { type: Boolean, default: false },
@@ -1303,7 +1305,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1303
1305
  role: "checkbox",
1304
1306
  onClick: handleClick
1305
1307
  }, [
1306
- createElementVNode("div", _hoisted_2$6, [
1308
+ createElementVNode("div", _hoisted_2$a, [
1307
1309
  icon.value ? (openBlock(), createBlock(KdsIcon, {
1308
1310
  key: 0,
1309
1311
  name: icon.value,
@@ -1311,16 +1313,16 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1311
1313
  size: "xsmall"
1312
1314
  }, null, 8, ["name"])) : createCommentVNode("", true)
1313
1315
  ]),
1314
- props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$5, [
1315
- createElementVNode("div", _hoisted_4$4, toDisplayString(props.label), 1),
1316
+ props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
1317
+ createElementVNode("div", _hoisted_4$6, toDisplayString(props.label), 1),
1316
1318
  props.helperText ? (openBlock(), createElementBlock("div", {
1317
1319
  key: 0,
1318
1320
  id: unref(helperId),
1319
1321
  class: "helper-text"
1320
- }, toDisplayString(props.helperText), 9, _hoisted_5$2)) : createCommentVNode("", true)
1322
+ }, toDisplayString(props.helperText), 9, _hoisted_5$3)) : createCommentVNode("", true)
1321
1323
  ])) : createCommentVNode("", true)
1322
- ], 10, _hoisted_1$h),
1323
- props.subText || props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
1324
+ ], 10, _hoisted_1$m),
1325
+ props.subText || props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
1324
1326
  createVNode(KdsSubText, {
1325
1327
  id: unref(descriptionId),
1326
1328
  "sub-text": props.subText,
@@ -1333,9 +1335,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1333
1335
  }
1334
1336
  });
1335
1337
 
1336
- const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-32f17780"]]);
1338
+ const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-32f17780"]]);
1337
1339
 
1338
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
1340
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1339
1341
  __name: "KdsCheckbox",
1340
1342
  props: /* @__PURE__ */ mergeModels({
1341
1343
  disabled: { type: Boolean, default: false },
@@ -1367,8 +1369,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
1367
1369
  }
1368
1370
  });
1369
1371
 
1370
- const _hoisted_1$g = ["id", "aria-labelledby", "aria-describedby"];
1371
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
1372
+ const _hoisted_1$l = ["id", "aria-labelledby", "aria-describedby"];
1373
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1372
1374
  __name: "KdsCheckboxGroup",
1373
1375
  props: /* @__PURE__ */ mergeModels({
1374
1376
  id: {},
@@ -1452,12 +1454,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
1452
1454
  "preserve-sub-text-space": props.preserveSubTextSpace,
1453
1455
  error: hasError.value
1454
1456
  }, null, 8, ["id", "sub-text", "preserve-sub-text-space", "error"])
1455
- ], 8, _hoisted_1$g);
1457
+ ], 8, _hoisted_1$l);
1456
1458
  };
1457
1459
  }
1458
1460
  });
1459
1461
 
1460
- const KdsCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-c38eeda5"]]);
1462
+ const KdsCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-c38eeda5"]]);
1461
1463
 
1462
1464
  const kdsCheckboxGroupAlignment = {
1463
1465
  VERTICAL: "vertical",
@@ -1473,19 +1475,19 @@ const kdsCheckboxValue = {
1473
1475
  };
1474
1476
  const kdsCheckboxValues = Object.values(kdsCheckboxValue);
1475
1477
 
1476
- const _hoisted_1$f = ["aria-checked", "aria-describedby", "aria-invalid", "disabled"];
1477
- const _hoisted_2$5 = { class: "control" };
1478
- const _hoisted_3$4 = {
1478
+ const _hoisted_1$k = ["aria-checked", "aria-describedby", "aria-invalid", "disabled"];
1479
+ const _hoisted_2$9 = { class: "control" };
1480
+ const _hoisted_3$7 = {
1479
1481
  key: 0,
1480
1482
  class: "dot",
1481
1483
  viewBox: "0 0 2 2",
1482
1484
  "aria-hidden": "true",
1483
1485
  focusable: "false"
1484
1486
  };
1485
- const _hoisted_4$3 = { class: "content" };
1486
- const _hoisted_5$1 = { class: "label" };
1487
- const _hoisted_6 = ["id"];
1488
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
1487
+ const _hoisted_4$5 = { class: "content" };
1488
+ const _hoisted_5$2 = { class: "label" };
1489
+ const _hoisted_6$2 = ["id"];
1490
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1489
1491
  __name: "KdsRadioButton",
1490
1492
  props: /* @__PURE__ */ mergeModels({
1491
1493
  text: {},
@@ -1525,8 +1527,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1525
1527
  type: "button",
1526
1528
  onClick: handleClick
1527
1529
  }, [
1528
- createElementVNode("div", _hoisted_2$5, [
1529
- modelValue.value ? (openBlock(), createElementBlock("svg", _hoisted_3$4, [..._cache[0] || (_cache[0] = [
1530
+ createElementVNode("div", _hoisted_2$9, [
1531
+ modelValue.value ? (openBlock(), createElementBlock("svg", _hoisted_3$7, [..._cache[0] || (_cache[0] = [
1530
1532
  createElementVNode("circle", {
1531
1533
  cx: "1",
1532
1534
  cy: "1",
@@ -1534,20 +1536,20 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1534
1536
  }, null, -1)
1535
1537
  ])])) : createCommentVNode("", true)
1536
1538
  ]),
1537
- createElementVNode("div", _hoisted_4$3, [
1538
- createElementVNode("div", _hoisted_5$1, toDisplayString(props.text), 1),
1539
+ createElementVNode("div", _hoisted_4$5, [
1540
+ createElementVNode("div", _hoisted_5$2, toDisplayString(props.text), 1),
1539
1541
  props.helperText ? (openBlock(), createElementBlock("div", {
1540
1542
  key: 0,
1541
1543
  id: `${unref(id)}-helper`,
1542
1544
  class: "helper-text"
1543
- }, toDisplayString(props.helperText), 9, _hoisted_6)) : createCommentVNode("", true)
1545
+ }, toDisplayString(props.helperText), 9, _hoisted_6$2)) : createCommentVNode("", true)
1544
1546
  ])
1545
- ], 10, _hoisted_1$f);
1547
+ ], 10, _hoisted_1$k);
1546
1548
  };
1547
1549
  }
1548
1550
  });
1549
1551
 
1550
- const KdsRadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-27c361e4"]]);
1552
+ const KdsRadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-27c361e4"]]);
1551
1553
 
1552
1554
  const useRadioSelection = ({
1553
1555
  selectedId,
@@ -1669,8 +1671,8 @@ const useRadioSelection = ({
1669
1671
  };
1670
1672
  };
1671
1673
 
1672
- const _hoisted_1$e = ["id", "aria-labelledby", "aria-describedby"];
1673
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
1674
+ const _hoisted_1$j = ["id", "aria-labelledby", "aria-describedby"];
1675
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1674
1676
  __name: "KdsRadioButtonGroup",
1675
1677
  props: /* @__PURE__ */ mergeModels({
1676
1678
  id: {},
@@ -1749,15 +1751,15 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1749
1751
  "preserve-sub-text-space": props.preserveSubTextSpace,
1750
1752
  error: unref(hasError)
1751
1753
  }, null, 8, ["id", "sub-text", "preserve-sub-text-space", "error"])
1752
- ], 8, _hoisted_1$e);
1754
+ ], 8, _hoisted_1$j);
1753
1755
  };
1754
1756
  }
1755
1757
  });
1756
1758
 
1757
- const KdsRadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-9cc4dcdd"]]);
1759
+ const KdsRadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-9cc4dcdd"]]);
1758
1760
 
1759
- const _hoisted_1$d = ["aria-checked", "aria-label", "disabled", "tabindex", "title"];
1760
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
1761
+ const _hoisted_1$i = ["aria-checked", "aria-label", "disabled", "tabindex", "title"];
1762
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1761
1763
  __name: "ValueSwitchItem",
1762
1764
  props: {
1763
1765
  selected: { type: Boolean },
@@ -1807,12 +1809,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
1807
1809
  name: props.trailingIcon,
1808
1810
  size: props.size
1809
1811
  }, null, 8, ["name", "size"])) : createCommentVNode("", true)
1810
- ], 10, _hoisted_1$d);
1812
+ ], 10, _hoisted_1$i);
1811
1813
  };
1812
1814
  }
1813
1815
  });
1814
1816
 
1815
- const ValueSwitchItem = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-93f3f577"]]);
1817
+ const ValueSwitchItem = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-93f3f577"]]);
1816
1818
 
1817
1819
  const useValueSwitchIconHiding = ({
1818
1820
  width,
@@ -1863,8 +1865,8 @@ const useValueSwitchIconHiding = ({
1863
1865
  };
1864
1866
  };
1865
1867
 
1866
- const _hoisted_1$c = ["id", "aria-invalid", "aria-labelledby", "aria-describedby"];
1867
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
1868
+ const _hoisted_1$h = ["id", "aria-invalid", "aria-labelledby", "aria-describedby"];
1869
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1868
1870
  __name: "KdsValueSwitch",
1869
1871
  props: /* @__PURE__ */ mergeModels({
1870
1872
  id: {},
@@ -1957,12 +1959,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
1957
1959
  "preserve-sub-text-space": props.preserveSubTextSpace,
1958
1960
  error: props.error
1959
1961
  }, null, 8, ["id", "sub-text", "preserve-sub-text-space", "error"])
1960
- ], 10, _hoisted_1$c);
1962
+ ], 10, _hoisted_1$h);
1961
1963
  };
1962
1964
  }
1963
1965
  });
1964
1966
 
1965
- const KdsValueSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-666d4c10"]]);
1967
+ const KdsValueSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-666d4c10"]]);
1966
1968
 
1967
1969
  const kdsRadioButtonGroupAlignment = {
1968
1970
  VERTICAL: "vertical",
@@ -1982,7 +1984,62 @@ const kdsValueSwitchVariant = {
1982
1984
  };
1983
1985
  const kdsValueSwitchVariants = Object.values(kdsValueSwitchVariant);
1984
1986
 
1985
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
1987
+ const _hoisted_1$g = ["id", "role", "aria-label"];
1988
+ const _hoisted_2$8 = {
1989
+ key: 0,
1990
+ class: "kds-popover-default-content"
1991
+ };
1992
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1993
+ __name: "KdsPopover",
1994
+ props: /* @__PURE__ */ mergeModels({
1995
+ placement: { default: "bottom-left" },
1996
+ role: { default: "dialog" },
1997
+ fullWidth: { type: Boolean, default: false },
1998
+ popoverAriaLabel: {},
1999
+ content: {}
2000
+ }, {
2001
+ "modelValue": { type: Boolean, ...{ default: false } },
2002
+ "modelModifiers": {}
2003
+ }),
2004
+ emits: ["update:modelValue"],
2005
+ setup(__props, { expose: __expose }) {
2006
+ const props = __props;
2007
+ const open = useModel(__props, "modelValue");
2008
+ const popoverEl = useTemplateRef("popoverEl");
2009
+ const popoverId = useId();
2010
+ const anchorName = `--anchor-${popoverId}`;
2011
+ watchEffect(() => {
2012
+ if (open.value) {
2013
+ popoverEl.value?.showPopover?.();
2014
+ } else {
2015
+ popoverEl.value?.hidePopover?.();
2016
+ }
2017
+ });
2018
+ const anchorStyle = { "anchor-name": anchorName };
2019
+ __expose({ anchorStyle, popoverId });
2020
+ return (_ctx, _cache) => {
2021
+ return openBlock(), createElementBlock("div", {
2022
+ id: unref(popoverId),
2023
+ ref_key: "popoverEl",
2024
+ ref: popoverEl,
2025
+ class: normalizeClass(["kds-popover", ["floating", props.placement, { "full-width": props.fullWidth }]]),
2026
+ popover: "auto",
2027
+ style: normalizeStyle({ "position-anchor": anchorName }),
2028
+ role: props.role,
2029
+ "aria-label": props.popoverAriaLabel,
2030
+ onToggle: _cache[0] || (_cache[0] = ($event) => open.value = $event.newState === "open")
2031
+ }, [
2032
+ open.value ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
2033
+ props.content?.trim().length ? (openBlock(), createElementBlock("div", _hoisted_2$8, toDisplayString(props.content), 1)) : createCommentVNode("", true)
2034
+ ], true) : createCommentVNode("", true)
2035
+ ], 46, _hoisted_1$g);
2036
+ };
2037
+ }
2038
+ });
2039
+
2040
+ const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-9125d023"]]);
2041
+
2042
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1986
2043
  __name: "BaseFormFieldWrapper",
1987
2044
  props: {
1988
2045
  id: {},
@@ -2034,38 +2091,39 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2034
2091
  }
2035
2092
  });
2036
2093
 
2037
- const BaseFormFieldWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-5d99c134"]]);
2094
+ const BaseFormFieldWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-5d99c134"]]);
2038
2095
 
2039
- const _hoisted_1$b = {
2096
+ const _hoisted_1$f = {
2040
2097
  key: 0,
2041
2098
  class: "icon-wrapper leading"
2042
2099
  };
2043
- const _hoisted_2$4 = ["id", "value", "type", "inputmode", "placeholder", "disabled", "readonly", "required", "name", "autocomplete", "min", "max", "step", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "role", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext"];
2044
- const _hoisted_3$3 = ["aria-disabled"];
2045
- const _hoisted_4$2 = {
2046
- key: 3,
2047
- class: "trailing-slot"
2100
+ const _hoisted_2$7 = {
2101
+ key: 1,
2102
+ class: "leading-slot"
2048
2103
  };
2049
- const _hoisted_5 = {
2104
+ const _hoisted_3$6 = ["id", "value", "type", "inputmode", "placeholder", "disabled", "autocomplete", "min", "max", "step", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "role", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext", "aria-activedescendant"];
2105
+ const _hoisted_4$4 = ["aria-disabled"];
2106
+ const _hoisted_5$1 = {
2050
2107
  key: 4,
2108
+ class: "trailing-slot"
2109
+ };
2110
+ const _hoisted_6$1 = {
2111
+ key: 5,
2051
2112
  class: "icon-wrapper trailing"
2052
2113
  };
2053
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2114
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2054
2115
  __name: "BaseInput",
2055
2116
  props: /* @__PURE__ */ mergeModels({
2056
- id: {},
2117
+ id: { default: void 0 },
2057
2118
  type: { default: "text" },
2058
2119
  min: { default: void 0 },
2059
2120
  max: { default: void 0 },
2060
2121
  step: { default: void 0 },
2061
2122
  placeholder: { default: void 0 },
2062
2123
  disabled: { type: Boolean, default: false },
2063
- readonly: { type: Boolean, default: false },
2064
- required: { type: Boolean, default: false },
2065
2124
  leadingIcon: { default: void 0 },
2066
2125
  trailingIcon: { default: void 0 },
2067
2126
  error: { type: Boolean, default: false },
2068
- name: { default: void 0 },
2069
2127
  autocomplete: { default: void 0 },
2070
2128
  ariaLabel: { default: void 0 },
2071
2129
  ariaLabelledby: { default: void 0 },
@@ -2076,6 +2134,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2076
2134
  ariaValuemin: { default: void 0 },
2077
2135
  ariaValuemax: { default: void 0 },
2078
2136
  ariaValuetext: { default: void 0 },
2137
+ ariaActivedescendant: { default: void 0 },
2079
2138
  unit: { default: void 0 },
2080
2139
  inputmode: { default: void 0 },
2081
2140
  clearable: { type: Boolean, default: false }
@@ -2126,12 +2185,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2126
2185
  }),
2127
2186
  onClick: handleContainerClick
2128
2187
  }, [
2129
- props.leadingIcon ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
2188
+ props.leadingIcon ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
2130
2189
  props.leadingIcon ? (openBlock(), createBlock(KdsIcon, {
2131
2190
  key: 0,
2132
2191
  name: props.leadingIcon
2133
2192
  }, null, 8, ["name"])) : createCommentVNode("", true)
2134
2193
  ])) : createCommentVNode("", true),
2194
+ _ctx.$slots.leading ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
2195
+ renderSlot(_ctx.$slots, "leading", {}, void 0, true)
2196
+ ])) : createCommentVNode("", true),
2135
2197
  createElementVNode("input", {
2136
2198
  id: props.id,
2137
2199
  ref: "input",
@@ -2140,9 +2202,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2140
2202
  inputmode: props.inputmode,
2141
2203
  placeholder: props.placeholder,
2142
2204
  disabled: props.disabled,
2143
- readonly: props.readonly,
2144
- required: props.required,
2145
- name: props.name,
2146
2205
  autocomplete: props.autocomplete,
2147
2206
  min: props.min,
2148
2207
  max: props.max,
@@ -2156,24 +2215,25 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2156
2215
  "aria-valuemin": props.ariaValuemin,
2157
2216
  "aria-valuemax": props.ariaValuemax,
2158
2217
  "aria-valuetext": props.ariaValuetext,
2218
+ "aria-activedescendant": props.ariaActivedescendant,
2159
2219
  class: normalizeClass({ "input-field": true, "has-value": hasValue.value }),
2160
2220
  onInput: handleInput,
2161
2221
  onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
2162
2222
  onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event)),
2163
2223
  onKeydown: _cache[2] || (_cache[2] = ($event) => emit("keydown", $event)),
2164
2224
  onClick: _cache[3] || (_cache[3] = ($event) => emit("click", $event))
2165
- }, null, 42, _hoisted_2$4),
2225
+ }, null, 42, _hoisted_3$6),
2166
2226
  props.unit ? (openBlock(), createElementBlock("span", {
2167
- key: 1,
2227
+ key: 2,
2168
2228
  class: normalizeClass({
2169
2229
  unit: true,
2170
2230
  placeholder: showUnitPlaceholder.value,
2171
2231
  disabled: props.disabled
2172
2232
  }),
2173
2233
  "aria-disabled": props.disabled || void 0
2174
- }, toDisplayString(props.unit), 11, _hoisted_3$3)) : createCommentVNode("", true),
2175
- props.clearable && hasValue.value && !props.disabled && !props.readonly ? (openBlock(), createBlock(_sfc_main$t, {
2176
- key: 2,
2234
+ }, toDisplayString(props.unit), 11, _hoisted_4$4)) : createCommentVNode("", true),
2235
+ props.clearable && hasValue.value && !props.disabled ? (openBlock(), createBlock(_sfc_main$B, {
2236
+ key: 3,
2177
2237
  class: "clear-button",
2178
2238
  type: "button",
2179
2239
  size: "xsmall",
@@ -2183,10 +2243,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2183
2243
  title: "Clear",
2184
2244
  onClick: withModifiers(clearAndFocusInput, ["stop"])
2185
2245
  })) : createCommentVNode("", true),
2186
- _ctx.$slots.trailing ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
2246
+ _ctx.$slots.trailing ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
2187
2247
  renderSlot(_ctx.$slots, "trailing", {}, void 0, true)
2188
2248
  ])) : createCommentVNode("", true),
2189
- props.trailingIcon ? (openBlock(), createElementBlock("div", _hoisted_5, [
2249
+ props.trailingIcon ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
2190
2250
  createVNode(KdsIcon, {
2191
2251
  name: props.trailingIcon
2192
2252
  }, null, 8, ["name"])
@@ -2196,132 +2256,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2196
2256
  }
2197
2257
  });
2198
2258
 
2199
- const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-375bc2d8"]]);
2200
-
2201
- const additionalGroupSeparators = [" ", " ", " "];
2202
- const decimalSeparatorSample = 1.1;
2203
- const groupSeparatorSample = 1000.1;
2204
- const countFractionDigits = (value) => {
2205
- if (!Number.isFinite(value)) {
2206
- return 0;
2207
- }
2208
- const exp = value.toExponential();
2209
- const match = exp.match(/^[-+]?(\d+)(?:\.(\d+))?e([+-]?\d+)$/i);
2210
- if (!match) {
2211
- return 0;
2212
- }
2213
- const fractionDigitsInMantissa = match[2]?.length ?? 0;
2214
- const exponent = Number.parseInt(match[3], 10);
2215
- if (exponent >= 0) {
2216
- return Math.max(0, fractionDigitsInMantissa - exponent);
2217
- }
2218
- return fractionDigitsInMantissa + Math.abs(exponent);
2219
- };
2220
- const createKdsNumberParser = (params) => {
2221
- const formatter = new Intl.NumberFormat(params.locale);
2222
- const decimalSeparator = formatter.formatToParts(decimalSeparatorSample).find((part) => part.type === "decimal")?.value ?? ".";
2223
- const groupSeparator = formatter.formatToParts(groupSeparatorSample).find((part) => part.type === "group")?.value ?? ",";
2224
- const removeGroupingSeparators = (input) => [groupSeparator, ...additionalGroupSeparators].reduce(
2225
- (acc, groupSep) => groupSep.length > 0 ? acc.split(groupSep).join("") : acc,
2226
- input
2227
- );
2228
- const formattersByMaxDecimals = /* @__PURE__ */ new Map();
2229
- const getFormatterForMaxDecimals = (maxDecimals) => {
2230
- const cached = formattersByMaxDecimals.get(maxDecimals);
2231
- if (cached) {
2232
- return cached;
2233
- }
2234
- const created = new Intl.NumberFormat(params.locale, {
2235
- useGrouping: false,
2236
- minimumFractionDigits: 0,
2237
- maximumFractionDigits: maxDecimals
2238
- });
2239
- formattersByMaxDecimals.set(maxDecimals, created);
2240
- return created;
2241
- };
2242
- const stepFractionDigits = countFractionDigits(params.step);
2243
- const precisionFactor = Number(`1e${stepFractionDigits}`);
2244
- const formatForDisplay = (value) => {
2245
- if (!Number.isFinite(value)) {
2246
- return "";
2247
- }
2248
- const valueDecimals = countFractionDigits(value);
2249
- const maxDecimals = Math.max(stepFractionDigits, valueDecimals);
2250
- return getFormatterForMaxDecimals(maxDecimals).format(value);
2251
- };
2252
- const roundToStep = (value) => {
2253
- if (!Number.isFinite(value)) {
2254
- return NaN;
2255
- }
2256
- const step = params.step;
2257
- if (!Number.isFinite(step) || step <= 0) {
2258
- return value;
2259
- }
2260
- if (!Number.isFinite(precisionFactor) || precisionFactor <= 0) {
2261
- return value;
2262
- }
2263
- const scaledNext = Math.round(value * precisionFactor);
2264
- const scaledStep = Math.round(step * precisionFactor);
2265
- if (scaledStep === 0) {
2266
- return value;
2267
- }
2268
- const roundedScaled = Math.round(scaledNext / scaledStep) * scaledStep;
2269
- return roundedScaled / precisionFactor;
2270
- };
2271
- const isValidNormalizedNumber = (normalized) => (
2272
- // Accept plain decimals as well as scientific notation.
2273
- // Note: whitespace is removed earlier; we don't accept grouping separators here.
2274
- /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(normalized)
2275
- );
2276
- const parseFromInput = (value) => {
2277
- const trimmed = value.trim();
2278
- if (trimmed.length === 0) {
2279
- return NaN;
2280
- }
2281
- const localeDecimal = decimalSeparator;
2282
- const hasLocaleDecimal = localeDecimal.length > 0 && trimmed.includes(localeDecimal);
2283
- if (hasLocaleDecimal) {
2284
- const withoutGrouping = removeGroupingSeparators(trimmed);
2285
- const normalized2 = withoutGrouping.split(localeDecimal).join(".");
2286
- if (!isValidNormalizedNumber(normalized2)) {
2287
- return NaN;
2288
- }
2289
- const parsed2 = Number.parseFloat(normalized2);
2290
- return Number.isFinite(parsed2) ? parsed2 : NaN;
2291
- }
2292
- if (localeDecimal !== "." && trimmed.includes(".")) {
2293
- const lastDotIndex = trimmed.lastIndexOf(".");
2294
- const digitsAfterDot = trimmed.slice(lastDotIndex + 1);
2295
- const looksLikeDecimal = digitsAfterDot.length > 0 && digitsAfterDot.length <= 2;
2296
- const normalized2 = looksLikeDecimal ? `${removeGroupingSeparators(trimmed.slice(0, lastDotIndex))}.${removeGroupingSeparators(
2297
- digitsAfterDot
2298
- )}` : removeGroupingSeparators(trimmed);
2299
- if (!isValidNormalizedNumber(normalized2)) {
2300
- return NaN;
2301
- }
2302
- const parsed2 = Number.parseFloat(normalized2);
2303
- return Number.isFinite(parsed2) ? parsed2 : NaN;
2304
- }
2305
- const normalized = removeGroupingSeparators(trimmed);
2306
- if (!isValidNormalizedNumber(normalized)) {
2307
- return NaN;
2308
- }
2309
- const parsed = Number.parseFloat(normalized);
2310
- return Number.isFinite(parsed) ? parsed : NaN;
2311
- };
2312
- return {
2313
- locale: params.locale,
2314
- decimalSeparator,
2315
- groupSeparator,
2316
- stepFractionDigits,
2317
- formatForDisplay,
2318
- parseFromInput,
2319
- roundToStep
2320
- };
2321
- };
2259
+ const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-fad4fd1f"]]);
2322
2260
 
2323
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
2324
- __name: "KdsNumberInput",
2261
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2262
+ __name: "KdsTextInput",
2325
2263
  props: /* @__PURE__ */ mergeModels({
2326
2264
  description: {},
2327
2265
  label: {},
@@ -2333,173 +2271,583 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2333
2271
  preserveSubTextSpace: { type: Boolean, default: false },
2334
2272
  placeholder: {},
2335
2273
  disabled: { type: Boolean, default: false },
2336
- readonly: { type: Boolean, default: false },
2337
- required: { type: Boolean, default: false },
2338
- name: {},
2339
- autocomplete: {},
2340
- unit: { default: "" },
2341
- min: {},
2342
- max: {},
2343
- step: { default: 1 }
2274
+ autocomplete: {}
2344
2275
  }, {
2345
- "modelValue": { default: NaN },
2276
+ "modelValue": { default: "" },
2346
2277
  "modelModifiers": {}
2347
2278
  }),
2348
2279
  emits: ["update:modelValue"],
2349
2280
  setup(__props, { expose: __expose }) {
2350
2281
  const props = __props;
2351
2282
  const modelValue = useModel(__props, "modelValue");
2352
- const isFocused = ref(false);
2353
- const localValue = ref("");
2354
- const numberParser = computed(
2355
- () => createKdsNumberParser({ locale: "en-US", step: props.step })
2356
- );
2357
- const ariaValuenow = computed(
2358
- () => Number.isFinite(modelValue.value) ? modelValue.value : void 0
2359
- );
2360
- const ariaValuetext = computed(() => {
2361
- if (!Number.isFinite(modelValue.value)) {
2362
- return void 0;
2363
- }
2364
- return numberParser.value.formatForDisplay(modelValue.value);
2283
+ const baseInput = useTemplateRef("baseInput");
2284
+ __expose({
2285
+ focus: () => baseInput.value?.focus()
2365
2286
  });
2366
- const clamp = (value) => {
2367
- if (!Number.isFinite(value)) {
2368
- return NaN;
2369
- }
2370
- let result = value;
2371
- if (props.min !== void 0 && !Number.isNaN(props.min)) {
2372
- result = Math.max(props.min, result);
2373
- }
2374
- if (props.max !== void 0 && !Number.isNaN(props.max)) {
2375
- result = Math.min(props.max, result);
2287
+ return (_ctx, _cache) => {
2288
+ return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
2289
+ default: withCtx((slotProps) => [
2290
+ createVNode(BaseInput, mergeProps({
2291
+ ref_key: "baseInput",
2292
+ ref: baseInput
2293
+ }, slotProps, {
2294
+ modelValue: modelValue.value,
2295
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2296
+ type: "text",
2297
+ placeholder: props.placeholder,
2298
+ disabled: props.disabled,
2299
+ error: props.error,
2300
+ autocomplete: props.autocomplete
2301
+ }), null, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete"])
2302
+ ]),
2303
+ _: 1
2304
+ }, 16);
2305
+ };
2306
+ }
2307
+ });
2308
+
2309
+ const HEX_RADIX = 16;
2310
+ const RGB_MAX = 255;
2311
+ const HUE_MAX_DEG$1 = 360;
2312
+ const HUE_SECTOR_DEG = 60;
2313
+ const HUE_SECTOR_COUNT = 6;
2314
+ const HUE_OFFSET_FOR_MAX_G = 2;
2315
+ const HUE_OFFSET_FOR_MAX_B = 4;
2316
+ const HUE_SECTOR_INDEX_2 = 2;
2317
+ const HUE_SECTOR_INDEX_3 = 3;
2318
+ const HUE_SECTOR_INDEX_4 = 4;
2319
+ const HUE_SECTOR_INDEX_5 = 5;
2320
+ const HEX_PAIR_LENGTH = 2;
2321
+ const HEX_RED_START = 1;
2322
+ const HEX_GREEN_START = HEX_RED_START + HEX_PAIR_LENGTH;
2323
+ const HEX_BLUE_START = HEX_GREEN_START + HEX_PAIR_LENGTH;
2324
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
2325
+ const round = (value) => Math.round(value);
2326
+ const padHex = (value) => value.toString(HEX_RADIX).padStart(2, "0");
2327
+ const normalizeHexColor = (value) => {
2328
+ const trimmed = value.trim();
2329
+ if (trimmed.length === 0) {
2330
+ return null;
2331
+ }
2332
+ const withoutHash = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
2333
+ if (/^[0-9a-fA-F]{3}$/.test(withoutHash)) {
2334
+ const [r, g, b] = withoutHash.split("");
2335
+ return `#${r}${r}${g}${g}${b}${b}`.toUpperCase();
2336
+ }
2337
+ if (/^[0-9a-fA-F]{6}$/.test(withoutHash)) {
2338
+ return `#${withoutHash}`.toUpperCase();
2339
+ }
2340
+ return null;
2341
+ };
2342
+ const hexToRgb = (hex) => {
2343
+ const normalized = normalizeHexColor(hex);
2344
+ if (!normalized) {
2345
+ return null;
2346
+ }
2347
+ const r = Number.parseInt(
2348
+ normalized.slice(HEX_RED_START, HEX_RED_START + HEX_PAIR_LENGTH),
2349
+ HEX_RADIX
2350
+ );
2351
+ const g = Number.parseInt(
2352
+ normalized.slice(HEX_GREEN_START, HEX_GREEN_START + HEX_PAIR_LENGTH),
2353
+ HEX_RADIX
2354
+ );
2355
+ const b = Number.parseInt(
2356
+ normalized.slice(HEX_BLUE_START, HEX_BLUE_START + HEX_PAIR_LENGTH),
2357
+ HEX_RADIX
2358
+ );
2359
+ return { r, g, b };
2360
+ };
2361
+ const rgbToHex = ({ r, g, b }) => {
2362
+ const rr = clamp(round(r), 0, RGB_MAX);
2363
+ const gg = clamp(round(g), 0, RGB_MAX);
2364
+ const bb = clamp(round(b), 0, RGB_MAX);
2365
+ return `#${padHex(rr)}${padHex(gg)}${padHex(bb)}`.toUpperCase();
2366
+ };
2367
+ const rgbToHsv = ({ r, g, b }) => {
2368
+ const rr = clamp(r / RGB_MAX, 0, 1);
2369
+ const gg = clamp(g / RGB_MAX, 0, 1);
2370
+ const bb = clamp(b / RGB_MAX, 0, 1);
2371
+ const max = Math.max(rr, gg, bb);
2372
+ const min = Math.min(rr, gg, bb);
2373
+ const delta = max - min;
2374
+ const v = max;
2375
+ const s = max === 0 ? 0 : delta / max;
2376
+ let h = 0;
2377
+ if (delta !== 0) {
2378
+ if (max === rr) {
2379
+ h = (gg - bb) / delta % HUE_SECTOR_COUNT;
2380
+ } else if (max === gg) {
2381
+ h = (bb - rr) / delta + HUE_OFFSET_FOR_MAX_G;
2382
+ } else {
2383
+ h = (rr - gg) / delta + HUE_OFFSET_FOR_MAX_B;
2384
+ }
2385
+ h *= HUE_SECTOR_DEG;
2386
+ if (h < 0) {
2387
+ h += HUE_MAX_DEG$1;
2388
+ }
2389
+ }
2390
+ return { h, s, v };
2391
+ };
2392
+ const hsvToRgb = ({ h, s, v }) => {
2393
+ const hh = (h % HUE_MAX_DEG$1 + HUE_MAX_DEG$1) % HUE_MAX_DEG$1;
2394
+ const ss = clamp(s, 0, 1);
2395
+ const vv = clamp(v, 0, 1);
2396
+ const c = vv * ss;
2397
+ const x = c * (1 - Math.abs(hh / HUE_SECTOR_DEG % 2 - 1));
2398
+ const m = vv - c;
2399
+ let rPrime = 0;
2400
+ let gPrime = 0;
2401
+ let bPrime = 0;
2402
+ if (hh < HUE_SECTOR_DEG) {
2403
+ rPrime = c;
2404
+ gPrime = x;
2405
+ } else if (hh < HUE_SECTOR_INDEX_2 * HUE_SECTOR_DEG) {
2406
+ rPrime = x;
2407
+ gPrime = c;
2408
+ } else if (hh < HUE_SECTOR_INDEX_3 * HUE_SECTOR_DEG) {
2409
+ gPrime = c;
2410
+ bPrime = x;
2411
+ } else if (hh < HUE_SECTOR_INDEX_4 * HUE_SECTOR_DEG) {
2412
+ gPrime = x;
2413
+ bPrime = c;
2414
+ } else if (hh < HUE_SECTOR_INDEX_5 * HUE_SECTOR_DEG) {
2415
+ rPrime = x;
2416
+ bPrime = c;
2417
+ } else {
2418
+ rPrime = c;
2419
+ bPrime = x;
2420
+ }
2421
+ return {
2422
+ r: round((rPrime + m) * RGB_MAX),
2423
+ g: round((gPrime + m) * RGB_MAX),
2424
+ b: round((bPrime + m) * RGB_MAX)
2425
+ };
2426
+ };
2427
+ const hsvToHex = (hsv) => rgbToHex(hsvToRgb(hsv));
2428
+
2429
+ const usePointerHandler = (updateFromEvent) => {
2430
+ const activePointerId = ref(null);
2431
+ const onPointerDown = (event) => {
2432
+ if (event.button !== 0) {
2433
+ return;
2434
+ }
2435
+ const target = event.currentTarget;
2436
+ if (!(target instanceof HTMLElement)) {
2437
+ return;
2438
+ }
2439
+ activePointerId.value = event.pointerId;
2440
+ target.setPointerCapture(event.pointerId);
2441
+ updateFromEvent(event);
2442
+ };
2443
+ const onPointerMove = (event) => {
2444
+ if (activePointerId.value !== event.pointerId) {
2445
+ return;
2446
+ }
2447
+ updateFromEvent(event);
2448
+ };
2449
+ const endPointerInteraction = (event) => {
2450
+ if (activePointerId.value !== event.pointerId) {
2451
+ return;
2452
+ }
2453
+ const target = event.currentTarget;
2454
+ if (target instanceof HTMLElement && target.hasPointerCapture(event.pointerId)) {
2455
+ target.releasePointerCapture(event.pointerId);
2456
+ }
2457
+ activePointerId.value = null;
2458
+ };
2459
+ return {
2460
+ activePointerId,
2461
+ onPointerDown,
2462
+ onPointerMove,
2463
+ onPointerUp: endPointerInteraction
2464
+ };
2465
+ };
2466
+
2467
+ const _hoisted_1$e = { class: "kds-color-picker" };
2468
+ const _hoisted_2$6 = ["aria-valuetext"];
2469
+ const _hoisted_3$5 = ["aria-valuenow", "aria-valuetext"];
2470
+ const DEFAULT_HUE_DEG = 270;
2471
+ const DEFAULT_SATURATION = 0.8;
2472
+ const DEFAULT_VALUE = 0.9;
2473
+ const HUE_MAX_DEG = 360;
2474
+ const HUE_MAX_EXCLUSIVE_DEG = 359.999;
2475
+ const PERCENT = 100;
2476
+ const KEYBOARD_STEP = 0.01;
2477
+ const KEYBOARD_LARGE_STEP = 0.1;
2478
+ const HUE_KEYBOARD_STEP_DEG = 1;
2479
+ const HUE_KEYBOARD_LARGE_STEP_DEG = 10;
2480
+ const TO_BOTTOM_GRADIENT = "linear-gradient(to bottom, transparent, black)";
2481
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2482
+ __name: "ColorPicker",
2483
+ props: {
2484
+ "modelValue": { default: "" },
2485
+ "modelModifiers": {}
2486
+ },
2487
+ emits: ["update:modelValue"],
2488
+ setup(__props) {
2489
+ const modelValue = useModel(__props, "modelValue");
2490
+ const colorspaceEl = ref(null);
2491
+ const hueEl = ref(null);
2492
+ const hue = ref(DEFAULT_HUE_DEG);
2493
+ const saturation = ref(DEFAULT_SATURATION);
2494
+ const value = ref(DEFAULT_VALUE);
2495
+ const hasPendingInternalModelUpdate = ref(false);
2496
+ const syncFromModelValue = (next) => {
2497
+ const rgb = hexToRgb(next);
2498
+ if (!rgb) {
2499
+ return;
2376
2500
  }
2377
- return result;
2501
+ const hsv = rgbToHsv(rgb);
2502
+ hue.value = hsv.h;
2503
+ saturation.value = hsv.s;
2504
+ value.value = hsv.v;
2378
2505
  };
2379
2506
  watch(
2380
2507
  () => modelValue.value,
2381
2508
  (next) => {
2382
- if (isFocused.value) {
2509
+ if (hasPendingInternalModelUpdate.value) {
2510
+ hasPendingInternalModelUpdate.value = false;
2383
2511
  return;
2384
2512
  }
2385
- localValue.value = numberParser.value.formatForDisplay(next);
2513
+ syncFromModelValue(next);
2386
2514
  },
2387
2515
  { immediate: true }
2388
2516
  );
2389
- const canDecrease = computed(() => {
2390
- if (props.disabled || props.readonly) {
2391
- return false;
2392
- }
2393
- if (props.min === void 0 || Number.isNaN(props.min)) {
2394
- return true;
2395
- }
2396
- if (Number.isNaN(modelValue.value)) {
2397
- return true;
2398
- }
2399
- return modelValue.value > props.min;
2517
+ const currentHex = computed(
2518
+ () => hsvToHex({
2519
+ h: hue.value,
2520
+ s: saturation.value,
2521
+ v: value.value
2522
+ })
2523
+ );
2524
+ const hueRgb = computed(() => hsvToRgb({ h: hue.value, s: 1, v: 1 }));
2525
+ const colorspaceBackground = computed(() => {
2526
+ const { r, g, b } = hueRgb.value;
2527
+ return {
2528
+ background: `${TO_BOTTOM_GRADIENT}, linear-gradient(to right, white, rgb(${r}, ${g}, ${b}))`
2529
+ };
2400
2530
  });
2401
- const canIncrease = computed(() => {
2402
- if (props.disabled || props.readonly) {
2403
- return false;
2404
- }
2405
- if (props.max === void 0 || Number.isNaN(props.max)) {
2406
- return true;
2407
- }
2408
- if (Number.isNaN(modelValue.value)) {
2409
- return true;
2531
+ const colorspaceHandleStyle = computed(() => ({
2532
+ left: `${saturation.value * 100}%`,
2533
+ top: `${(1 - value.value) * 100}%`
2534
+ }));
2535
+ const hueHandleStyle = computed(() => ({
2536
+ left: `${hue.value / HUE_MAX_DEG * PERCENT}%`
2537
+ }));
2538
+ const setModelValueFromHsv = () => {
2539
+ hasPendingInternalModelUpdate.value = true;
2540
+ modelValue.value = currentHex.value;
2541
+ };
2542
+ const updateFromColorspaceEvent = (event) => {
2543
+ const el = colorspaceEl.value;
2544
+ if (!el) {
2545
+ return;
2410
2546
  }
2411
- return modelValue.value < props.max;
2412
- });
2413
- const adjustByStep = (direction) => {
2414
- if (props.step <= 0) {
2547
+ const rect = el.getBoundingClientRect();
2548
+ const x = (event.clientX - rect.left) / rect.width;
2549
+ const y = (event.clientY - rect.top) / rect.height;
2550
+ saturation.value = Math.min(1, Math.max(0, x));
2551
+ value.value = 1 - Math.min(1, Math.max(0, y));
2552
+ setModelValueFromHsv();
2553
+ };
2554
+ const updateFromHueEvent = (event) => {
2555
+ const el = hueEl.value;
2556
+ if (!el) {
2415
2557
  return;
2416
2558
  }
2417
- const base = Number.isFinite(modelValue.value) ? modelValue.value : numberParser.value.parseFromInput(localValue.value);
2418
- const nextRaw = Number.isFinite(base) ? base + direction * props.step : 0;
2419
- const rounded = numberParser.value.roundToStep(nextRaw);
2420
- const next = clamp(rounded);
2559
+ const rect = el.getBoundingClientRect();
2560
+ const x = (event.clientX - rect.left) / rect.width;
2561
+ hue.value = Math.min(HUE_MAX_EXCLUSIVE_DEG, Math.max(0, x * HUE_MAX_DEG));
2562
+ setModelValueFromHsv();
2563
+ };
2564
+ const {
2565
+ onPointerDown: onColorspacePointerDown,
2566
+ onPointerMove: onColorspacePointerMove,
2567
+ onPointerUp: onColorspacePointerUp
2568
+ } = usePointerHandler(updateFromColorspaceEvent);
2569
+ const {
2570
+ onPointerDown: onHuePointerDown,
2571
+ onPointerMove: onHuePointerMove,
2572
+ onPointerUp: onHuePointerUp
2573
+ } = usePointerHandler(updateFromHueEvent);
2574
+ const updateFromTextValue = (next) => {
2421
2575
  modelValue.value = next;
2422
- localValue.value = numberParser.value.formatForDisplay(next);
2576
+ const normalized = normalizeHexColor(next);
2577
+ if (normalized) {
2578
+ syncFromModelValue(normalized);
2579
+ }
2423
2580
  };
2424
- const handleKeydown = (event) => {
2425
- if (props.disabled || props.readonly) {
2426
- return;
2581
+ const saturationPercent = computed(
2582
+ () => Math.round(saturation.value * PERCENT)
2583
+ );
2584
+ const valuePercent = computed(() => Math.round(value.value * PERCENT));
2585
+ const colorspaceValueText = computed(
2586
+ () => `Saturation ${saturationPercent.value} percent, brightness ${valuePercent.value} percent`
2587
+ );
2588
+ const hueValueText = computed(() => `${Math.round(hue.value)} degrees`);
2589
+ const onColorspaceKeyDown = (event) => {
2590
+ const step = event.shiftKey ? KEYBOARD_LARGE_STEP : KEYBOARD_STEP;
2591
+ let handled = true;
2592
+ switch (event.key) {
2593
+ case "ArrowLeft":
2594
+ saturation.value = clamp(saturation.value - step, 0, 1);
2595
+ break;
2596
+ case "ArrowRight":
2597
+ saturation.value = clamp(saturation.value + step, 0, 1);
2598
+ break;
2599
+ case "ArrowUp":
2600
+ value.value = clamp(value.value + step, 0, 1);
2601
+ break;
2602
+ case "ArrowDown":
2603
+ value.value = clamp(value.value - step, 0, 1);
2604
+ break;
2605
+ default:
2606
+ handled = false;
2427
2607
  }
2428
- if (event.key === "ArrowUp" && canIncrease.value) {
2608
+ if (handled) {
2429
2609
  event.preventDefault();
2430
- adjustByStep(1);
2431
- return;
2610
+ setModelValueFromHsv();
2432
2611
  }
2433
- if (event.key === "ArrowDown" && canDecrease.value) {
2612
+ };
2613
+ const onHueKeyDown = (event) => {
2614
+ const step = event.shiftKey ? HUE_KEYBOARD_LARGE_STEP_DEG : HUE_KEYBOARD_STEP_DEG;
2615
+ let handled = true;
2616
+ switch (event.key) {
2617
+ case "ArrowLeft":
2618
+ hue.value = clamp(hue.value - step, 0, HUE_MAX_EXCLUSIVE_DEG);
2619
+ break;
2620
+ case "ArrowRight":
2621
+ hue.value = clamp(hue.value + step, 0, HUE_MAX_EXCLUSIVE_DEG);
2622
+ break;
2623
+ default:
2624
+ handled = false;
2625
+ }
2626
+ if (handled) {
2434
2627
  event.preventDefault();
2435
- adjustByStep(-1);
2628
+ setModelValueFromHsv();
2436
2629
  }
2437
2630
  };
2438
- const handleUpdateModelValue = (value) => {
2439
- localValue.value = value;
2440
- modelValue.value = numberParser.value.parseFromInput(value);
2631
+ return (_ctx, _cache) => {
2632
+ return openBlock(), createElementBlock("div", _hoisted_1$e, [
2633
+ createElementVNode("div", {
2634
+ ref_key: "colorspaceEl",
2635
+ ref: colorspaceEl,
2636
+ class: "colorspace",
2637
+ role: "slider",
2638
+ "aria-label": "Color selection",
2639
+ "aria-roledescription": "2D color slider",
2640
+ "aria-valuetext": colorspaceValueText.value,
2641
+ style: normalizeStyle(colorspaceBackground.value),
2642
+ tabindex: "0",
2643
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(
2644
+ //@ts-ignore
2645
+ (...args) => unref(onColorspacePointerDown) && unref(onColorspacePointerDown)(...args),
2646
+ ["prevent"]
2647
+ )),
2648
+ onPointermove: _cache[1] || (_cache[1] = withModifiers(
2649
+ //@ts-ignore
2650
+ (...args) => unref(onColorspacePointerMove) && unref(onColorspacePointerMove)(...args),
2651
+ ["prevent"]
2652
+ )),
2653
+ onPointerup: _cache[2] || (_cache[2] = //@ts-ignore
2654
+ (...args) => unref(onColorspacePointerUp) && unref(onColorspacePointerUp)(...args)),
2655
+ onPointercancel: _cache[3] || (_cache[3] = //@ts-ignore
2656
+ (...args) => unref(onColorspacePointerUp) && unref(onColorspacePointerUp)(...args)),
2657
+ onKeydown: onColorspaceKeyDown
2658
+ }, [
2659
+ createElementVNode("div", {
2660
+ class: "handle",
2661
+ style: normalizeStyle(colorspaceHandleStyle.value)
2662
+ }, null, 4)
2663
+ ], 44, _hoisted_2$6),
2664
+ createElementVNode("div", {
2665
+ ref_key: "hueEl",
2666
+ ref: hueEl,
2667
+ class: "hue",
2668
+ role: "slider",
2669
+ "aria-label": "Hue",
2670
+ "aria-valuenow": Math.round(hue.value),
2671
+ "aria-valuemin": "0",
2672
+ "aria-valuemax": HUE_MAX_DEG,
2673
+ "aria-valuetext": hueValueText.value,
2674
+ tabindex: "0",
2675
+ onPointerdown: _cache[4] || (_cache[4] = withModifiers(
2676
+ //@ts-ignore
2677
+ (...args) => unref(onHuePointerDown) && unref(onHuePointerDown)(...args),
2678
+ ["prevent"]
2679
+ )),
2680
+ onPointermove: _cache[5] || (_cache[5] = withModifiers(
2681
+ //@ts-ignore
2682
+ (...args) => unref(onHuePointerMove) && unref(onHuePointerMove)(...args),
2683
+ ["prevent"]
2684
+ )),
2685
+ onPointerup: _cache[6] || (_cache[6] = //@ts-ignore
2686
+ (...args) => unref(onHuePointerUp) && unref(onHuePointerUp)(...args)),
2687
+ onPointercancel: _cache[7] || (_cache[7] = //@ts-ignore
2688
+ (...args) => unref(onHuePointerUp) && unref(onHuePointerUp)(...args)),
2689
+ onKeydown: onHueKeyDown
2690
+ }, [
2691
+ createElementVNode("div", {
2692
+ class: "handle",
2693
+ style: normalizeStyle(hueHandleStyle.value)
2694
+ }, null, 4)
2695
+ ], 40, _hoisted_3$5),
2696
+ createVNode(_sfc_main$l, {
2697
+ "model-value": modelValue.value,
2698
+ "aria-label": "Color hex value",
2699
+ placeholder: "#FFFFFF",
2700
+ "onUpdate:modelValue": updateFromTextValue
2701
+ }, null, 8, ["model-value"])
2702
+ ]);
2441
2703
  };
2442
- const handleBlur = () => {
2443
- isFocused.value = false;
2444
- const parsed = numberParser.value.parseFromInput(localValue.value);
2445
- const normalized = clamp(parsed);
2704
+ }
2705
+ });
2706
+
2707
+ const ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-180fafdd"]]);
2708
+
2709
+ const HEX_LENGTH_1 = 1;
2710
+ const HEX_LENGTH_2 = 2;
2711
+ const HEX_LENGTH_3 = 3;
2712
+ const HEX_LENGTH_4 = 4;
2713
+ const HEX_LENGTH_6 = 6;
2714
+ const normalize = (value, fallbackValue) => {
2715
+ const trimmed = value.trim();
2716
+ if (trimmed.length === 0) {
2717
+ return fallbackValue;
2718
+ }
2719
+ const withoutHash = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
2720
+ if (!/^[0-9a-fA-F]+$/.test(withoutHash)) {
2721
+ return fallbackValue;
2722
+ }
2723
+ if (withoutHash.length === HEX_LENGTH_1) {
2724
+ return `#${withoutHash.repeat(HEX_LENGTH_6)}`.toUpperCase();
2725
+ }
2726
+ if (withoutHash.length === HEX_LENGTH_2) {
2727
+ return `#${withoutHash.repeat(HEX_LENGTH_3)}`.toUpperCase();
2728
+ }
2729
+ if (withoutHash.length === HEX_LENGTH_3 || withoutHash.length === HEX_LENGTH_4) {
2730
+ const [r, g, b] = withoutHash;
2731
+ return `#${r}${r}${g}${g}${b}${b}`.toUpperCase();
2732
+ }
2733
+ if (withoutHash.length === HEX_LENGTH_6) {
2734
+ return `#${withoutHash}`.toUpperCase();
2735
+ }
2736
+ return fallbackValue;
2737
+ };
2738
+ const useColorInputValidationOnFocusOut = (modelValue) => {
2739
+ const lastValidHexColor = ref("");
2740
+ watch(
2741
+ modelValue,
2742
+ (value) => {
2743
+ const withoutHash = value.startsWith("#") ? value.slice(1) : value;
2744
+ if (/^[0-9a-fA-F]{6}$/.test(withoutHash)) {
2745
+ lastValidHexColor.value = `#${withoutHash.toUpperCase()}`;
2746
+ }
2747
+ },
2748
+ { immediate: true }
2749
+ );
2750
+ const handleFocusOut = (event) => {
2751
+ const currentTarget = event.currentTarget;
2752
+ if (!(currentTarget instanceof HTMLElement)) {
2753
+ return;
2754
+ }
2755
+ const nextFocusedElement = event.relatedTarget;
2756
+ if (nextFocusedElement instanceof Node && currentTarget.contains(nextFocusedElement)) {
2757
+ return;
2758
+ }
2759
+ const normalized = normalize(modelValue.value, lastValidHexColor.value);
2760
+ if (normalized !== void 0) {
2446
2761
  modelValue.value = normalized;
2447
- localValue.value = numberParser.value.formatForDisplay(normalized);
2448
- };
2449
- const baseInput = useTemplateRef("baseInput");
2450
- __expose({
2451
- focus: () => baseInput.value?.focus()
2452
- });
2762
+ }
2763
+ };
2764
+ return { handleFocusOut };
2765
+ };
2766
+
2767
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2768
+ __name: "KdsColorInput",
2769
+ props: /* @__PURE__ */ mergeModels({
2770
+ description: {},
2771
+ label: {},
2772
+ ariaLabel: {},
2773
+ id: {},
2774
+ subText: {},
2775
+ error: { type: Boolean, default: false },
2776
+ validating: { type: Boolean, default: false },
2777
+ preserveSubTextSpace: { type: Boolean, default: false },
2778
+ placeholder: { default: "#FFFFFF" },
2779
+ disabled: { type: Boolean, default: false },
2780
+ autocomplete: { default: void 0 }
2781
+ }, {
2782
+ "modelValue": { default: "" },
2783
+ "modelModifiers": {}
2784
+ }),
2785
+ emits: ["update:modelValue"],
2786
+ setup(__props) {
2787
+ const props = __props;
2788
+ const modelValue = useModel(__props, "modelValue");
2789
+ const open = ref(false);
2790
+ const popoverEl = useTemplateRef("popoverEl");
2791
+ const swatchColor = computed(
2792
+ () => normalizeHexColor(modelValue.value) ?? "#FFFFFF"
2793
+ );
2794
+ const { handleFocusOut } = useColorInputValidationOnFocusOut(modelValue);
2453
2795
  return (_ctx, _cache) => {
2454
2796
  return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
2455
2797
  default: withCtx((slotProps) => [
2456
- createVNode(BaseInput, mergeProps({
2457
- ref_key: "baseInput",
2458
- ref: baseInput
2459
- }, slotProps, {
2460
- "model-value": localValue.value,
2461
- type: "text",
2462
- inputmode: props.step >= 1 ? "numeric" : "decimal",
2463
- placeholder: props.placeholder,
2464
- disabled: props.disabled,
2465
- readonly: props.readonly,
2466
- required: props.required,
2467
- error: props.error,
2468
- name: props.name,
2469
- autocomplete: props.autocomplete,
2470
- unit: props.unit,
2471
- role: "spinbutton",
2472
- "aria-valuenow": ariaValuenow.value,
2473
- "aria-valuemin": props.min,
2474
- "aria-valuemax": props.max,
2475
- "aria-valuetext": ariaValuetext.value,
2476
- "onUpdate:modelValue": handleUpdateModelValue,
2477
- onKeydown: handleKeydown,
2478
- onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
2479
- onBlur: handleBlur
2480
- }), {
2481
- trailing: withCtx(() => [
2482
- createVNode(_sfc_main$t, {
2483
- type: "button",
2484
- size: "xsmall",
2485
- variant: "outlined",
2486
- "leading-icon": "minus",
2487
- "aria-label": `Decrease ${props.label ?? props.ariaLabel}`,
2488
- disabled: !canDecrease.value,
2489
- onClick: _cache[0] || (_cache[0] = ($event) => adjustByStep(-1))
2490
- }, null, 8, ["aria-label", "disabled"]),
2491
- createVNode(_sfc_main$t, {
2492
- type: "button",
2493
- size: "xsmall",
2494
- variant: "outlined",
2495
- "leading-icon": "plus",
2496
- "aria-label": `Increase ${props.label ?? props.ariaLabel}`,
2497
- disabled: !canIncrease.value,
2498
- onClick: _cache[1] || (_cache[1] = ($event) => adjustByStep(1))
2499
- }, null, 8, ["aria-label", "disabled"])
2500
- ]),
2501
- _: 1
2502
- }, 16, ["model-value", "inputmode", "placeholder", "disabled", "readonly", "required", "error", "name", "autocomplete", "unit", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext"])
2798
+ createElementVNode("div", {
2799
+ style: normalizeStyle(popoverEl.value?.anchorStyle),
2800
+ onFocusout: _cache[4] || (_cache[4] = //@ts-ignore
2801
+ (...args) => unref(handleFocusOut) && unref(handleFocusOut)(...args))
2802
+ }, [
2803
+ createVNode(BaseInput, mergeProps(slotProps, {
2804
+ modelValue: modelValue.value,
2805
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue.value = $event),
2806
+ placeholder: props.placeholder,
2807
+ disabled: props.disabled,
2808
+ error: props.error,
2809
+ autocomplete: props.autocomplete
2810
+ }), {
2811
+ leading: withCtx(() => [
2812
+ createVNode(KdsColorSwatch, {
2813
+ size: "large",
2814
+ color: swatchColor.value,
2815
+ "aria-hidden": true
2816
+ }, null, 8, ["color"])
2817
+ ]),
2818
+ trailing: withCtx(() => [
2819
+ createVNode(unref(_sfc_main$z), {
2820
+ modelValue: open.value,
2821
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => open.value = $event),
2822
+ size: "xsmall",
2823
+ variant: "outlined",
2824
+ "leading-icon": "color-picker",
2825
+ "aria-label": "Open color picker",
2826
+ "aria-controls": popoverEl.value?.popoverId,
2827
+ "aria-haspopup": "dialog",
2828
+ disabled: props.disabled,
2829
+ title: open.value ? "Close color picker" : "Open color picker"
2830
+ }, null, 8, ["modelValue", "aria-controls", "disabled", "title"])
2831
+ ]),
2832
+ _: 1
2833
+ }, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete"]),
2834
+ createVNode(KdsPopover, {
2835
+ ref_key: "popoverEl",
2836
+ ref: popoverEl,
2837
+ modelValue: open.value,
2838
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => open.value = $event),
2839
+ placement: "bottom-right",
2840
+ "popover-aria-label": "Color picker"
2841
+ }, {
2842
+ default: withCtx(() => [
2843
+ createVNode(ColorPicker, {
2844
+ modelValue: modelValue.value,
2845
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => modelValue.value = $event)
2846
+ }, null, 8, ["modelValue"])
2847
+ ]),
2848
+ _: 1
2849
+ }, 8, ["modelValue"])
2850
+ ], 36)
2503
2851
  ]),
2504
2852
  _: 1
2505
2853
  }, 16);
@@ -2507,95 +2855,130 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2507
2855
  }
2508
2856
  });
2509
2857
 
2510
- const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2511
- const wildcardToRegexBody = (pattern) => {
2512
- let body = "";
2513
- for (const char of pattern) {
2514
- if (char === "*") {
2515
- body += ".*";
2516
- continue;
2517
- }
2518
- if (char === "?") {
2519
- body += ".";
2520
- continue;
2521
- }
2522
- body += escapeRegex(char);
2858
+ const additionalGroupSeparators = [" ", " ", ""];
2859
+ const decimalSeparatorSample = 1.1;
2860
+ const groupSeparatorSample = 1000.1;
2861
+ const countFractionDigits = (value) => {
2862
+ if (!Number.isFinite(value)) {
2863
+ return 0;
2523
2864
  }
2524
- return body;
2865
+ const exp = value.toExponential();
2866
+ const match = exp.match(/^[-+]?(\d+)(?:\.(\d+))?e([+-]?\d+)$/i);
2867
+ if (!match) {
2868
+ return 0;
2869
+ }
2870
+ const fractionDigitsInMantissa = match[2]?.length ?? 0;
2871
+ const exponent = Number.parseInt(match[3], 10);
2872
+ if (exponent >= 0) {
2873
+ return Math.max(0, fractionDigitsInMantissa - exponent);
2874
+ }
2875
+ return fractionDigitsInMantissa + Math.abs(exponent);
2525
2876
  };
2526
- const regexBodyToWildcard = (regexBody) => {
2527
- let wildcard = "";
2528
- for (let i = 0; i < regexBody.length; i += 1) {
2529
- const char = regexBody[i];
2530
- if (char === "\\") {
2531
- const next = regexBody[i + 1];
2532
- if (next === void 0) {
2533
- return void 0;
2877
+ const createKdsNumberParser = (params) => {
2878
+ const formatter = new Intl.NumberFormat(params.locale);
2879
+ const decimalSeparator = formatter.formatToParts(decimalSeparatorSample).find((part) => part.type === "decimal")?.value ?? ".";
2880
+ const groupSeparator = formatter.formatToParts(groupSeparatorSample).find((part) => part.type === "group")?.value ?? ",";
2881
+ const removeGroupingSeparators = (input) => [groupSeparator, ...additionalGroupSeparators].reduce(
2882
+ (acc, groupSep) => groupSep.length > 0 ? acc.split(groupSep).join("") : acc,
2883
+ input
2884
+ );
2885
+ const formattersByMaxDecimals = /* @__PURE__ */ new Map();
2886
+ const getFormatterForMaxDecimals = (maxDecimals) => {
2887
+ const cached = formattersByMaxDecimals.get(maxDecimals);
2888
+ if (cached) {
2889
+ return cached;
2890
+ }
2891
+ const created = new Intl.NumberFormat(params.locale, {
2892
+ useGrouping: false,
2893
+ minimumFractionDigits: 0,
2894
+ maximumFractionDigits: maxDecimals
2895
+ });
2896
+ formattersByMaxDecimals.set(maxDecimals, created);
2897
+ return created;
2898
+ };
2899
+ const stepFractionDigits = countFractionDigits(params.step);
2900
+ const precisionFactor = Number(`1e${stepFractionDigits}`);
2901
+ const formatForDisplay = (value) => {
2902
+ if (!Number.isFinite(value)) {
2903
+ return "";
2904
+ }
2905
+ const valueDecimals = countFractionDigits(value);
2906
+ const maxDecimals = Math.max(stepFractionDigits, valueDecimals);
2907
+ return getFormatterForMaxDecimals(maxDecimals).format(value);
2908
+ };
2909
+ const roundToStep = (value) => {
2910
+ if (!Number.isFinite(value)) {
2911
+ return NaN;
2912
+ }
2913
+ const step = params.step;
2914
+ if (!Number.isFinite(step) || step <= 0) {
2915
+ return value;
2916
+ }
2917
+ if (!Number.isFinite(precisionFactor) || precisionFactor <= 0) {
2918
+ return value;
2919
+ }
2920
+ const scaledNext = Math.round(value * precisionFactor);
2921
+ const scaledStep = Math.round(step * precisionFactor);
2922
+ if (scaledStep === 0) {
2923
+ return value;
2924
+ }
2925
+ const roundedScaled = Math.round(scaledNext / scaledStep) * scaledStep;
2926
+ return roundedScaled / precisionFactor;
2927
+ };
2928
+ const isValidNormalizedNumber = (normalized) => (
2929
+ // Accept plain decimals as well as scientific notation.
2930
+ // Note: whitespace is removed earlier; we don't accept grouping separators here.
2931
+ /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(normalized)
2932
+ );
2933
+ const parseFromInput = (value) => {
2934
+ const trimmed = value.trim();
2935
+ if (trimmed.length === 0) {
2936
+ return NaN;
2937
+ }
2938
+ const localeDecimal = decimalSeparator;
2939
+ const hasLocaleDecimal = localeDecimal.length > 0 && trimmed.includes(localeDecimal);
2940
+ if (hasLocaleDecimal) {
2941
+ const withoutGrouping = removeGroupingSeparators(trimmed);
2942
+ const normalized2 = withoutGrouping.split(localeDecimal).join(".");
2943
+ if (!isValidNormalizedNumber(normalized2)) {
2944
+ return NaN;
2534
2945
  }
2535
- wildcard += next;
2536
- i += 1;
2537
- continue;
2946
+ const parsed2 = Number.parseFloat(normalized2);
2947
+ return Number.isFinite(parsed2) ? parsed2 : NaN;
2538
2948
  }
2539
- if (char === ".") {
2540
- const next = regexBody[i + 1];
2541
- if (next === "*") {
2542
- wildcard += "*";
2543
- i += 1;
2544
- continue;
2949
+ if (localeDecimal !== "." && trimmed.includes(".")) {
2950
+ const lastDotIndex = trimmed.lastIndexOf(".");
2951
+ const digitsAfterDot = trimmed.slice(lastDotIndex + 1);
2952
+ const looksLikeDecimal = digitsAfterDot.length > 0 && digitsAfterDot.length <= 2;
2953
+ const normalized2 = looksLikeDecimal ? `${removeGroupingSeparators(trimmed.slice(0, lastDotIndex))}.${removeGroupingSeparators(
2954
+ digitsAfterDot
2955
+ )}` : removeGroupingSeparators(trimmed);
2956
+ if (!isValidNormalizedNumber(normalized2)) {
2957
+ return NaN;
2545
2958
  }
2546
- wildcard += "?";
2547
- continue;
2959
+ const parsed2 = Number.parseFloat(normalized2);
2960
+ return Number.isFinite(parsed2) ? parsed2 : NaN;
2548
2961
  }
2549
- if (/[[\]{}()+^$|]/.test(char)) {
2550
- return void 0;
2962
+ const normalized = removeGroupingSeparators(trimmed);
2963
+ if (!isValidNormalizedNumber(normalized)) {
2964
+ return NaN;
2551
2965
  }
2552
- wildcard += char;
2553
- }
2554
- return wildcard;
2555
- };
2556
- const CASE_INSENSITIVE_PREFIX = "(?i:";
2557
- const stripOuterGroup = (pattern, prefix) => {
2558
- const trimmed = pattern.trim();
2559
- if (trimmed.startsWith(prefix) && trimmed.endsWith(")")) {
2560
- return trimmed.slice(prefix.length, -1);
2561
- }
2562
- return trimmed;
2563
- };
2564
- const buildRegexFromPatternInput = (input, options) => {
2565
- const body = options.useRegex ? input : wildcardToRegexBody(input);
2566
- const grouped = `(?:${body})`;
2567
- const withCase = options.caseSensitive ? grouped : `${CASE_INSENSITIVE_PREFIX}${grouped})`;
2568
- if (!options.excludeMatches) {
2569
- return withCase;
2570
- }
2571
- return `^(?!.*${withCase}).*$`;
2572
- };
2573
- const stripOuterNonCapturingGroup = (pattern) => stripOuterGroup(pattern, "(?:");
2574
- const stripCaseInsensitiveWrapper = (pattern) => stripOuterGroup(pattern, CASE_INSENSITIVE_PREFIX);
2575
- const tryParseExcluded = (regex) => {
2576
- const match = regex.trim().match(/^\^\(\?!\.\*([\s\S]*)\)\.\*\$$/);
2577
- if (!match) {
2578
- return {};
2579
- }
2580
- return { excludedInner: match[1] };
2581
- };
2582
- const parseRegexToPatternInputValue = (regex, options) => {
2583
- if (regex === "") {
2584
- return "";
2585
- }
2586
- const { excludedInner } = tryParseExcluded(regex);
2587
- const inner = excludedInner === void 0 ? regex : excludedInner;
2588
- const withoutCase = options.caseSensitive ? inner : stripCaseInsensitiveWrapper(inner);
2589
- const body = stripOuterNonCapturingGroup(withoutCase);
2590
- if (options.useRegex) {
2591
- return body;
2592
- }
2593
- const wildcard = regexBodyToWildcard(body);
2594
- return wildcard ?? body;
2966
+ const parsed = Number.parseFloat(normalized);
2967
+ return Number.isFinite(parsed) ? parsed : NaN;
2968
+ };
2969
+ return {
2970
+ locale: params.locale,
2971
+ decimalSeparator,
2972
+ groupSeparator,
2973
+ stepFractionDigits,
2974
+ formatForDisplay,
2975
+ parseFromInput,
2976
+ roundToStep
2977
+ };
2595
2978
  };
2596
2979
 
2597
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
2598
- __name: "KdsPatternInput",
2980
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2981
+ __name: "KdsNumberInput",
2599
2982
  props: /* @__PURE__ */ mergeModels({
2600
2983
  description: {},
2601
2984
  label: {},
@@ -2607,240 +2990,1118 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2607
2990
  preserveSubTextSpace: { type: Boolean, default: false },
2608
2991
  placeholder: {},
2609
2992
  disabled: { type: Boolean, default: false },
2610
- readonly: { type: Boolean, default: false },
2611
- required: { type: Boolean, default: false },
2612
- name: {},
2613
- autocomplete: {}
2993
+ autocomplete: {},
2994
+ unit: { default: "" },
2995
+ min: {},
2996
+ max: {},
2997
+ step: { default: 1 }
2614
2998
  }, {
2615
- "modelValue": { default: "" },
2999
+ "modelValue": { default: Number.NaN },
2616
3000
  "modelModifiers": {}
2617
3001
  }),
2618
3002
  emits: ["update:modelValue"],
2619
3003
  setup(__props, { expose: __expose }) {
2620
3004
  const props = __props;
2621
- const regex = useModel(__props, "modelValue");
2622
- const uiValue = ref("");
2623
- const caseSensitive = ref(false);
2624
- const excludeMatches = ref(false);
2625
- const useRegex = ref(false);
2626
- const rebuildRegexFromUi = () => {
2627
- regex.value = buildRegexFromPatternInput(uiValue.value, {
2628
- caseSensitive: caseSensitive.value,
2629
- excludeMatches: excludeMatches.value,
2630
- useRegex: useRegex.value
2631
- });
3005
+ const modelValue = useModel(__props, "modelValue");
3006
+ const isFocused = ref(false);
3007
+ const localValue = ref("");
3008
+ const numberParser = computed(
3009
+ () => createKdsNumberParser({ locale: "en-US", step: props.step })
3010
+ );
3011
+ const ariaValuenow = computed(
3012
+ () => Number.isFinite(modelValue.value) ? modelValue.value : void 0
3013
+ );
3014
+ const ariaValuetext = computed(() => {
3015
+ if (!Number.isFinite(modelValue.value)) {
3016
+ return void 0;
3017
+ }
3018
+ return numberParser.value.formatForDisplay(modelValue.value);
3019
+ });
3020
+ const clamp = (value) => {
3021
+ if (!Number.isFinite(value)) {
3022
+ return Number.NaN;
3023
+ }
3024
+ let result = value;
3025
+ if (props.min !== void 0 && !Number.isNaN(props.min)) {
3026
+ result = Math.max(props.min, result);
3027
+ }
3028
+ if (props.max !== void 0 && !Number.isNaN(props.max)) {
3029
+ result = Math.min(props.max, result);
3030
+ }
3031
+ return result;
2632
3032
  };
2633
3033
  watch(
2634
- () => regex.value,
2635
- (newValue) => {
2636
- uiValue.value = parseRegexToPatternInputValue(newValue, {
2637
- useRegex: useRegex.value,
2638
- excludeMatches: excludeMatches.value,
2639
- caseSensitive: caseSensitive.value
2640
- });
3034
+ () => modelValue.value,
3035
+ (next) => {
3036
+ if (isFocused.value) {
3037
+ return;
3038
+ }
3039
+ localValue.value = numberParser.value.formatForDisplay(next);
2641
3040
  },
2642
3041
  { immediate: true }
2643
3042
  );
2644
- const caseSensitiveAriaLabel = computed(
2645
- () => caseSensitive.value ? "Match case-sensitive" : "Match case-insensitive"
2646
- );
2647
- const excludeMatchesAriaLabel = computed(
2648
- () => excludeMatches.value ? "Exclude matches" : "Include matches"
2649
- );
2650
- const patternModeAriaLabel = computed(
2651
- () => useRegex.value ? "Use regex pattern" : "Use wildcard pattern"
2652
- );
2653
- const baseInput = useTemplateRef("baseInput");
2654
- __expose({
2655
- focus: () => baseInput.value?.focus()
2656
- });
2657
- return (_ctx, _cache) => {
2658
- return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
2659
- default: withCtx((slotProps) => [
2660
- createVNode(BaseInput, mergeProps({
2661
- ref_key: "baseInput",
2662
- ref: baseInput
2663
- }, slotProps, {
2664
- modelValue: uiValue.value,
2665
- "onUpdate:modelValue": [
2666
- _cache[3] || (_cache[3] = ($event) => uiValue.value = $event),
2667
- rebuildRegexFromUi
2668
- ],
3043
+ const canDecrease = computed(() => {
3044
+ if (props.disabled) {
3045
+ return false;
3046
+ }
3047
+ if (props.min === void 0 || Number.isNaN(props.min)) {
3048
+ return true;
3049
+ }
3050
+ if (Number.isNaN(modelValue.value)) {
3051
+ return true;
3052
+ }
3053
+ return modelValue.value > props.min;
3054
+ });
3055
+ const canIncrease = computed(() => {
3056
+ if (props.disabled) {
3057
+ return false;
3058
+ }
3059
+ if (props.max === void 0 || Number.isNaN(props.max)) {
3060
+ return true;
3061
+ }
3062
+ if (Number.isNaN(modelValue.value)) {
3063
+ return true;
3064
+ }
3065
+ return modelValue.value < props.max;
3066
+ });
3067
+ const adjustByStep = (direction) => {
3068
+ if (props.step <= 0) {
3069
+ return;
3070
+ }
3071
+ const base = Number.isFinite(modelValue.value) ? modelValue.value : numberParser.value.parseFromInput(localValue.value);
3072
+ const nextRaw = Number.isFinite(base) ? base + direction * props.step : 0;
3073
+ const rounded = numberParser.value.roundToStep(nextRaw);
3074
+ const next = clamp(rounded);
3075
+ modelValue.value = next;
3076
+ localValue.value = numberParser.value.formatForDisplay(next);
3077
+ };
3078
+ const handleKeydown = (event) => {
3079
+ if (props.disabled) {
3080
+ return;
3081
+ }
3082
+ if (event.key === "ArrowUp" && canIncrease.value) {
3083
+ event.preventDefault();
3084
+ adjustByStep(1);
3085
+ return;
3086
+ }
3087
+ if (event.key === "ArrowDown" && canDecrease.value) {
3088
+ event.preventDefault();
3089
+ adjustByStep(-1);
3090
+ }
3091
+ };
3092
+ const handleUpdateModelValue = (value) => {
3093
+ localValue.value = value;
3094
+ modelValue.value = numberParser.value.parseFromInput(value);
3095
+ };
3096
+ const handleBlur = () => {
3097
+ isFocused.value = false;
3098
+ const parsed = numberParser.value.parseFromInput(localValue.value);
3099
+ const normalized = clamp(parsed);
3100
+ modelValue.value = normalized;
3101
+ localValue.value = numberParser.value.formatForDisplay(normalized);
3102
+ };
3103
+ const baseInput = useTemplateRef("baseInput");
3104
+ __expose({
3105
+ focus: () => baseInput.value?.focus()
3106
+ });
3107
+ return (_ctx, _cache) => {
3108
+ return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
3109
+ default: withCtx((slotProps) => [
3110
+ createVNode(BaseInput, mergeProps({
3111
+ ref_key: "baseInput",
3112
+ ref: baseInput
3113
+ }, slotProps, {
3114
+ "model-value": localValue.value,
2669
3115
  type: "text",
3116
+ inputmode: props.step >= 1 ? "numeric" : "decimal",
2670
3117
  placeholder: props.placeholder,
2671
3118
  disabled: props.disabled,
2672
- readonly: props.readonly,
2673
- required: props.required,
2674
3119
  error: props.error,
2675
- name: props.name,
2676
3120
  autocomplete: props.autocomplete,
2677
- "leading-icon": "filter",
2678
- clearable: ""
3121
+ unit: props.unit,
3122
+ role: "spinbutton",
3123
+ "aria-valuenow": ariaValuenow.value,
3124
+ "aria-valuemin": props.min,
3125
+ "aria-valuemax": props.max,
3126
+ "aria-valuetext": ariaValuetext.value,
3127
+ "onUpdate:modelValue": handleUpdateModelValue,
3128
+ onKeydown: handleKeydown,
3129
+ onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
3130
+ onBlur: handleBlur
2679
3131
  }), {
2680
3132
  trailing: withCtx(() => [
2681
- createVNode(_sfc_main$r, {
2682
- modelValue: caseSensitive.value,
2683
- "onUpdate:modelValue": [
2684
- _cache[0] || (_cache[0] = ($event) => caseSensitive.value = $event),
2685
- rebuildRegexFromUi
2686
- ],
2687
- size: "xsmall",
2688
- variant: "outlined",
2689
- "leading-icon": "case-sensitive",
2690
- title: caseSensitiveAriaLabel.value,
2691
- "aria-label": caseSensitiveAriaLabel.value,
2692
- disabled: props.disabled || props.readonly
2693
- }, null, 8, ["modelValue", "title", "aria-label", "disabled"]),
2694
- createVNode(_sfc_main$r, {
2695
- modelValue: excludeMatches.value,
2696
- "onUpdate:modelValue": [
2697
- _cache[1] || (_cache[1] = ($event) => excludeMatches.value = $event),
2698
- rebuildRegexFromUi
2699
- ],
3133
+ createVNode(_sfc_main$B, {
3134
+ type: "button",
2700
3135
  size: "xsmall",
2701
3136
  variant: "outlined",
2702
- "leading-icon": "arrows-order",
2703
- title: excludeMatchesAriaLabel.value,
2704
- "aria-label": excludeMatchesAriaLabel.value,
2705
- disabled: props.disabled || props.readonly
2706
- }, null, 8, ["modelValue", "title", "aria-label", "disabled"]),
2707
- createVNode(_sfc_main$r, {
2708
- modelValue: useRegex.value,
2709
- "onUpdate:modelValue": [
2710
- _cache[2] || (_cache[2] = ($event) => useRegex.value = $event),
2711
- rebuildRegexFromUi
2712
- ],
3137
+ "leading-icon": "minus",
3138
+ "aria-label": `Decrease ${props.label ?? props.ariaLabel}`,
3139
+ disabled: !canDecrease.value,
3140
+ onClick: _cache[0] || (_cache[0] = ($event) => adjustByStep(-1))
3141
+ }, null, 8, ["aria-label", "disabled"]),
3142
+ createVNode(_sfc_main$B, {
3143
+ type: "button",
2713
3144
  size: "xsmall",
2714
3145
  variant: "outlined",
2715
- "leading-icon": "regex",
2716
- title: patternModeAriaLabel.value,
2717
- "aria-label": patternModeAriaLabel.value,
2718
- disabled: props.disabled || props.readonly
2719
- }, null, 8, ["modelValue", "title", "aria-label", "disabled"])
3146
+ "leading-icon": "plus",
3147
+ "aria-label": `Increase ${props.label ?? props.ariaLabel}`,
3148
+ disabled: !canIncrease.value,
3149
+ onClick: _cache[1] || (_cache[1] = ($event) => adjustByStep(1))
3150
+ }, null, 8, ["aria-label", "disabled"])
2720
3151
  ]),
2721
3152
  _: 1
2722
- }, 16, ["modelValue", "placeholder", "disabled", "readonly", "required", "error", "name", "autocomplete"])
3153
+ }, 16, ["model-value", "inputmode", "placeholder", "disabled", "error", "autocomplete", "unit", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext"])
2723
3154
  ]),
2724
3155
  _: 1
2725
3156
  }, 16);
2726
3157
  };
2727
- }
2728
- });
2729
-
2730
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
2731
- __name: "KdsSearchInput",
2732
- props: /* @__PURE__ */ mergeModels({
2733
- description: {},
2734
- label: {},
2735
- ariaLabel: {},
2736
- id: {},
2737
- subText: {},
2738
- error: { type: Boolean, default: false },
2739
- validating: { type: Boolean, default: false },
2740
- preserveSubTextSpace: { type: Boolean, default: false },
2741
- placeholder: { default: "Search" },
2742
- disabled: { type: Boolean, default: false },
2743
- readonly: { type: Boolean, default: false },
2744
- required: { type: Boolean, default: false },
2745
- name: {},
2746
- autocomplete: {}
2747
- }, {
2748
- "modelValue": { default: "" },
2749
- "modelModifiers": {}
2750
- }),
2751
- emits: ["update:modelValue"],
2752
- setup(__props, { expose: __expose }) {
2753
- const props = __props;
2754
- const modelValue = useModel(__props, "modelValue");
2755
- const baseInput = useTemplateRef("baseInput");
3158
+ }
3159
+ });
3160
+
3161
+ const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3162
+ const wildcardToRegexBody = (pattern) => {
3163
+ let body = "";
3164
+ for (const char of pattern) {
3165
+ if (char === "*") {
3166
+ body += ".*";
3167
+ continue;
3168
+ }
3169
+ if (char === "?") {
3170
+ body += ".";
3171
+ continue;
3172
+ }
3173
+ body += escapeRegex(char);
3174
+ }
3175
+ return body;
3176
+ };
3177
+ const regexBodyToWildcard = (regexBody) => {
3178
+ let wildcard = "";
3179
+ for (let i = 0; i < regexBody.length; i += 1) {
3180
+ const char = regexBody[i];
3181
+ if (char === "\\") {
3182
+ const next = regexBody[i + 1];
3183
+ if (next === void 0) {
3184
+ return void 0;
3185
+ }
3186
+ wildcard += next;
3187
+ i += 1;
3188
+ continue;
3189
+ }
3190
+ if (char === ".") {
3191
+ const next = regexBody[i + 1];
3192
+ if (next === "*") {
3193
+ wildcard += "*";
3194
+ i += 1;
3195
+ continue;
3196
+ }
3197
+ wildcard += "?";
3198
+ continue;
3199
+ }
3200
+ if (/[[\]{}()+^$|]/.test(char)) {
3201
+ return void 0;
3202
+ }
3203
+ wildcard += char;
3204
+ }
3205
+ return wildcard;
3206
+ };
3207
+ const CASE_INSENSITIVE_PREFIX = "(?i:";
3208
+ const stripOuterGroup = (pattern, prefix) => {
3209
+ const trimmed = pattern.trim();
3210
+ if (trimmed.startsWith(prefix) && trimmed.endsWith(")")) {
3211
+ return trimmed.slice(prefix.length, -1);
3212
+ }
3213
+ return trimmed;
3214
+ };
3215
+ const buildRegexFromPatternInput = (input, options) => {
3216
+ const body = options.useRegex ? input : wildcardToRegexBody(input);
3217
+ const grouped = `(?:${body})`;
3218
+ const withCase = options.caseSensitive ? grouped : `${CASE_INSENSITIVE_PREFIX}${grouped})`;
3219
+ if (!options.excludeMatches) {
3220
+ return withCase;
3221
+ }
3222
+ return `^(?!.*${withCase}).*$`;
3223
+ };
3224
+ const stripOuterNonCapturingGroup = (pattern) => stripOuterGroup(pattern, "(?:");
3225
+ const stripCaseInsensitiveWrapper = (pattern) => stripOuterGroup(pattern, CASE_INSENSITIVE_PREFIX);
3226
+ const tryParseExcluded = (regex) => {
3227
+ const match = regex.trim().match(/^\^\(\?!\.\*([\s\S]*)\)\.\*\$$/);
3228
+ if (!match) {
3229
+ return {};
3230
+ }
3231
+ return { excludedInner: match[1] };
3232
+ };
3233
+ const parseRegexToPatternInputValue = (regex, options) => {
3234
+ if (regex === "") {
3235
+ return "";
3236
+ }
3237
+ const { excludedInner } = tryParseExcluded(regex);
3238
+ const inner = excludedInner === void 0 ? regex : excludedInner;
3239
+ const withoutCase = options.caseSensitive ? inner : stripCaseInsensitiveWrapper(inner);
3240
+ const body = stripOuterNonCapturingGroup(withoutCase);
3241
+ if (options.useRegex) {
3242
+ return body;
3243
+ }
3244
+ const wildcard = regexBodyToWildcard(body);
3245
+ return wildcard ?? body;
3246
+ };
3247
+
3248
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3249
+ __name: "KdsPatternInput",
3250
+ props: /* @__PURE__ */ mergeModels({
3251
+ description: {},
3252
+ label: {},
3253
+ ariaLabel: {},
3254
+ id: {},
3255
+ subText: {},
3256
+ error: { type: Boolean, default: false },
3257
+ validating: { type: Boolean, default: false },
3258
+ preserveSubTextSpace: { type: Boolean, default: false },
3259
+ placeholder: {},
3260
+ disabled: { type: Boolean, default: false },
3261
+ autocomplete: {}
3262
+ }, {
3263
+ "modelValue": { default: "" },
3264
+ "modelModifiers": {}
3265
+ }),
3266
+ emits: ["update:modelValue"],
3267
+ setup(__props, { expose: __expose }) {
3268
+ const props = __props;
3269
+ const regex = useModel(__props, "modelValue");
3270
+ const uiValue = ref("");
3271
+ const caseSensitive = ref(false);
3272
+ const excludeMatches = ref(false);
3273
+ const useRegex = ref(false);
3274
+ const rebuildRegexFromUi = () => {
3275
+ regex.value = buildRegexFromPatternInput(uiValue.value, {
3276
+ caseSensitive: caseSensitive.value,
3277
+ excludeMatches: excludeMatches.value,
3278
+ useRegex: useRegex.value
3279
+ });
3280
+ };
3281
+ watch(
3282
+ () => regex.value,
3283
+ (newValue) => {
3284
+ uiValue.value = parseRegexToPatternInputValue(newValue, {
3285
+ useRegex: useRegex.value,
3286
+ excludeMatches: excludeMatches.value,
3287
+ caseSensitive: caseSensitive.value
3288
+ });
3289
+ },
3290
+ { immediate: true }
3291
+ );
3292
+ const caseSensitiveAriaLabel = computed(
3293
+ () => caseSensitive.value ? "Match case-sensitive" : "Match case-insensitive"
3294
+ );
3295
+ const excludeMatchesAriaLabel = computed(
3296
+ () => excludeMatches.value ? "Exclude matches" : "Include matches"
3297
+ );
3298
+ const patternModeAriaLabel = computed(
3299
+ () => useRegex.value ? "Use regex pattern" : "Use wildcard pattern"
3300
+ );
3301
+ const baseInput = useTemplateRef("baseInput");
3302
+ __expose({
3303
+ focus: () => baseInput.value?.focus()
3304
+ });
3305
+ return (_ctx, _cache) => {
3306
+ return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
3307
+ default: withCtx((slotProps) => [
3308
+ createVNode(BaseInput, mergeProps({
3309
+ ref_key: "baseInput",
3310
+ ref: baseInput
3311
+ }, slotProps, {
3312
+ modelValue: uiValue.value,
3313
+ "onUpdate:modelValue": [
3314
+ _cache[3] || (_cache[3] = ($event) => uiValue.value = $event),
3315
+ rebuildRegexFromUi
3316
+ ],
3317
+ type: "text",
3318
+ placeholder: props.placeholder,
3319
+ disabled: props.disabled,
3320
+ error: props.error,
3321
+ autocomplete: props.autocomplete,
3322
+ "leading-icon": "filter",
3323
+ clearable: ""
3324
+ }), {
3325
+ trailing: withCtx(() => [
3326
+ createVNode(_sfc_main$z, {
3327
+ modelValue: caseSensitive.value,
3328
+ "onUpdate:modelValue": [
3329
+ _cache[0] || (_cache[0] = ($event) => caseSensitive.value = $event),
3330
+ rebuildRegexFromUi
3331
+ ],
3332
+ size: "xsmall",
3333
+ variant: "outlined",
3334
+ "leading-icon": "case-sensitive",
3335
+ title: caseSensitiveAriaLabel.value,
3336
+ "aria-label": caseSensitiveAriaLabel.value,
3337
+ disabled: props.disabled
3338
+ }, null, 8, ["modelValue", "title", "aria-label", "disabled"]),
3339
+ createVNode(_sfc_main$z, {
3340
+ modelValue: excludeMatches.value,
3341
+ "onUpdate:modelValue": [
3342
+ _cache[1] || (_cache[1] = ($event) => excludeMatches.value = $event),
3343
+ rebuildRegexFromUi
3344
+ ],
3345
+ size: "xsmall",
3346
+ variant: "outlined",
3347
+ "leading-icon": "arrows-order",
3348
+ title: excludeMatchesAriaLabel.value,
3349
+ "aria-label": excludeMatchesAriaLabel.value,
3350
+ disabled: props.disabled
3351
+ }, null, 8, ["modelValue", "title", "aria-label", "disabled"]),
3352
+ createVNode(_sfc_main$z, {
3353
+ modelValue: useRegex.value,
3354
+ "onUpdate:modelValue": [
3355
+ _cache[2] || (_cache[2] = ($event) => useRegex.value = $event),
3356
+ rebuildRegexFromUi
3357
+ ],
3358
+ size: "xsmall",
3359
+ variant: "outlined",
3360
+ "leading-icon": "regex",
3361
+ title: patternModeAriaLabel.value,
3362
+ "aria-label": patternModeAriaLabel.value,
3363
+ disabled: props.disabled
3364
+ }, null, 8, ["modelValue", "title", "aria-label", "disabled"])
3365
+ ]),
3366
+ _: 1
3367
+ }, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete"])
3368
+ ]),
3369
+ _: 1
3370
+ }, 16);
3371
+ };
3372
+ }
3373
+ });
3374
+
3375
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3376
+ __name: "KdsSearchInput",
3377
+ props: /* @__PURE__ */ mergeModels({
3378
+ description: {},
3379
+ label: {},
3380
+ ariaLabel: {},
3381
+ id: {},
3382
+ subText: {},
3383
+ error: { type: Boolean, default: false },
3384
+ validating: { type: Boolean, default: false },
3385
+ preserveSubTextSpace: { type: Boolean, default: false },
3386
+ placeholder: { default: "Search" },
3387
+ disabled: { type: Boolean, default: false },
3388
+ autocomplete: {}
3389
+ }, {
3390
+ "modelValue": { default: "" },
3391
+ "modelModifiers": {}
3392
+ }),
3393
+ emits: /* @__PURE__ */ mergeModels(["focus", "blur", "keydown"], ["update:modelValue"]),
3394
+ setup(__props, { expose: __expose, emit: __emit }) {
3395
+ const props = __props;
3396
+ const modelValue = useModel(__props, "modelValue");
3397
+ const emit = __emit;
3398
+ const baseInput = useTemplateRef("baseInput");
3399
+ __expose({
3400
+ focus: () => baseInput.value?.focus()
3401
+ });
3402
+ return (_ctx, _cache) => {
3403
+ return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
3404
+ default: withCtx((slotProps) => [
3405
+ createVNode(BaseInput, mergeProps({
3406
+ ref_key: "baseInput",
3407
+ ref: baseInput
3408
+ }, slotProps, {
3409
+ modelValue: modelValue.value,
3410
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
3411
+ type: "search",
3412
+ placeholder: props.placeholder,
3413
+ disabled: props.disabled,
3414
+ error: props.error,
3415
+ autocomplete: props.autocomplete,
3416
+ "leading-icon": "search",
3417
+ clearable: true,
3418
+ onFocus: _cache[1] || (_cache[1] = ($event) => emit("focus", $event)),
3419
+ onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event)),
3420
+ onKeydown: _cache[3] || (_cache[3] = ($event) => emit("keydown", $event))
3421
+ }), null, 16, ["modelValue", "placeholder", "disabled", "error", "autocomplete"])
3422
+ ]),
3423
+ _: 1
3424
+ }, 16);
3425
+ };
3426
+ }
3427
+ });
3428
+
3429
+ const _hoisted_1$d = ["rows", "placeholder", "disabled", "autocomplete"];
3430
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3431
+ __name: "KdsTextarea",
3432
+ props: /* @__PURE__ */ mergeModels({
3433
+ description: {},
3434
+ label: {},
3435
+ ariaLabel: {},
3436
+ id: {},
3437
+ subText: {},
3438
+ error: { type: Boolean, default: false },
3439
+ validating: { type: Boolean, default: false },
3440
+ preserveSubTextSpace: { type: Boolean, default: false },
3441
+ placeholder: { default: "" },
3442
+ disabled: { type: Boolean, default: false },
3443
+ autocomplete: {},
3444
+ rows: { default: 3 }
3445
+ }, {
3446
+ "modelValue": { default: "" },
3447
+ "modelModifiers": {}
3448
+ }),
3449
+ emits: ["update:modelValue"],
3450
+ setup(__props, { expose: __expose }) {
3451
+ const props = __props;
3452
+ const normalizedRows = computed(() => Math.max(1, props.rows));
3453
+ const modelValue = useModel(__props, "modelValue");
3454
+ const textareaElement = useTemplateRef("textareaElement");
3455
+ function resize() {
3456
+ const element = textareaElement.value;
3457
+ if (!element) {
3458
+ return;
3459
+ }
3460
+ element.style.height = "auto";
3461
+ const scrollHeight = element.scrollHeight;
3462
+ const offsetHeight = element.offsetHeight;
3463
+ if (scrollHeight <= offsetHeight) {
3464
+ return;
3465
+ }
3466
+ element.style.height = `${scrollHeight}px`;
3467
+ }
3468
+ useResizeObserver(textareaElement, resize);
3469
+ watch(modelValue, resize, { immediate: true });
3470
+ __expose({
3471
+ focus: () => {
3472
+ textareaElement.value?.focus();
3473
+ }
3474
+ });
3475
+ return (_ctx, _cache) => {
3476
+ return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
3477
+ default: withCtx((slotProps) => [
3478
+ withDirectives(createElementVNode("textarea", mergeProps(slotProps, {
3479
+ ref_key: "textareaElement",
3480
+ ref: textareaElement,
3481
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
3482
+ class: { invalid: props.error },
3483
+ rows: normalizedRows.value,
3484
+ placeholder: props.placeholder,
3485
+ disabled: props.disabled,
3486
+ autocomplete: props.autocomplete
3487
+ }), null, 16, _hoisted_1$d), [
3488
+ [vModelText, modelValue.value]
3489
+ ])
3490
+ ]),
3491
+ _: 1
3492
+ }, 16);
3493
+ };
3494
+ }
3495
+ });
3496
+
3497
+ const KdsTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a2df5fed"]]);
3498
+
3499
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3500
+ __name: "ListItemAccessory",
3501
+ props: {
3502
+ accessory: {},
3503
+ size: {},
3504
+ disabled: { type: Boolean, default: false }
3505
+ },
3506
+ setup(__props) {
3507
+ const props = __props;
3508
+ return (_ctx, _cache) => {
3509
+ return props.accessory.type === "avatar" ? (openBlock(), createBlock(KdsAvatar, {
3510
+ key: 0,
3511
+ title: props.accessory.title,
3512
+ src: props.accessory.src,
3513
+ initials: props.accessory.initials,
3514
+ size: props.size
3515
+ }, null, 8, ["title", "src", "initials", "size"])) : props.accessory.type === "colorSwatch" ? (openBlock(), createBlock(KdsColorSwatch, {
3516
+ key: 1,
3517
+ color: props.accessory.color,
3518
+ title: props.accessory.title,
3519
+ size: props.size
3520
+ }, null, 8, ["color", "title", "size"])) : props.accessory.type === "icon" ? (openBlock(), createBlock(KdsIcon, {
3521
+ key: 2,
3522
+ name: props.accessory.name,
3523
+ size: props.size,
3524
+ disabled: props.disabled
3525
+ }, null, 8, ["name", "size", "disabled"])) : props.accessory.type === "dataType" ? (openBlock(), createBlock(KdsDataType, {
3526
+ key: 3,
3527
+ "icon-name": props.accessory.name,
3528
+ size: props.size,
3529
+ disabled: props.disabled
3530
+ }, null, 8, ["icon-name", "size", "disabled"])) : props.accessory.type === "liveStatus" ? (openBlock(), createBlock(unref(KdsLiveStatus), {
3531
+ key: 4,
3532
+ status: props.accessory.status,
3533
+ title: props.accessory.title,
3534
+ size: props.size
3535
+ }, null, 8, ["status", "title", "size"])) : createCommentVNode("", true);
3536
+ };
3537
+ }
3538
+ });
3539
+
3540
+ const _hoisted_1$c = ["id", "aria-expanded", "aria-labelledby", "aria-describedby", "aria-label", "aria-invalid", "aria-controls", "disabled"];
3541
+ const _hoisted_2$5 = {
3542
+ key: 0,
3543
+ class: "leading",
3544
+ "aria-hidden": "true"
3545
+ };
3546
+ const _hoisted_3$4 = ["id"];
3547
+ const _hoisted_4$3 = {
3548
+ class: "trailing",
3549
+ "aria-hidden": "true"
3550
+ };
3551
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3552
+ __name: "BaseDropdown",
3553
+ props: /* @__PURE__ */ mergeModels({
3554
+ text: { default: void 0 },
3555
+ placeholder: {},
3556
+ disabled: { type: Boolean, default: false },
3557
+ error: { type: Boolean, default: false },
3558
+ missing: { type: Boolean, default: false },
3559
+ accessory: { default: void 0 },
3560
+ id: { default: void 0 },
3561
+ ariaLabelledby: { default: void 0 },
3562
+ ariaDescribedby: { default: void 0 },
3563
+ ariaLabel: { default: void 0 },
3564
+ ariaInvalid: { type: Boolean, default: void 0 },
3565
+ popoverId: { default: void 0 }
3566
+ }, {
3567
+ "open": { type: Boolean, ...{ default: false } },
3568
+ "openModifiers": {}
3569
+ }),
3570
+ emits: /* @__PURE__ */ mergeModels(["click", "keydown"], ["update:open"]),
3571
+ setup(__props, { emit: __emit }) {
3572
+ const props = __props;
3573
+ const open = useModel(__props, "open");
3574
+ const valueTextId = useId();
3575
+ const ariaLabelledby = computed(() => {
3576
+ if (props.ariaLabel) {
3577
+ return void 0;
3578
+ }
3579
+ if (!props.ariaLabelledby) {
3580
+ return valueTextId;
3581
+ }
3582
+ return `${props.ariaLabelledby} ${valueTextId}`;
3583
+ });
3584
+ const effectiveAriaLabel = computed(() => {
3585
+ if (!props.ariaLabel) {
3586
+ return void 0;
3587
+ }
3588
+ const displayText = props.text ?? props.placeholder;
3589
+ return `${props.ariaLabel}, ${displayText}`;
3590
+ });
3591
+ const emit = __emit;
3592
+ const onKeydown = (event) => {
3593
+ if (props.disabled) {
3594
+ return;
3595
+ }
3596
+ emit("keydown", event);
3597
+ switch (event.key) {
3598
+ case "ArrowDown":
3599
+ case "ArrowUp":
3600
+ event.preventDefault();
3601
+ if (!open.value) {
3602
+ open.value = true;
3603
+ }
3604
+ break;
3605
+ }
3606
+ };
3607
+ return (_ctx, _cache) => {
3608
+ return openBlock(), createElementBlock("button", {
3609
+ id: props.id,
3610
+ class: normalizeClass(["kds-dropdown-trigger-button", { error: props.error }]),
3611
+ type: "button",
3612
+ "aria-expanded": open.value,
3613
+ "aria-labelledby": ariaLabelledby.value,
3614
+ "aria-describedby": props.ariaDescribedby,
3615
+ "aria-label": effectiveAriaLabel.value,
3616
+ "aria-invalid": props.ariaInvalid,
3617
+ "aria-controls": props.popoverId,
3618
+ "aria-haspopup": "dialog",
3619
+ disabled: props.disabled,
3620
+ onClick: _cache[0] || (_cache[0] = ($event) => !props.disabled && emit("click")),
3621
+ onKeydown
3622
+ }, [
3623
+ props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$5, [
3624
+ createVNode(_sfc_main$e, {
3625
+ accessory: props.accessory,
3626
+ size: "medium"
3627
+ }, null, 8, ["accessory"])
3628
+ ])) : createCommentVNode("", true),
3629
+ createElementVNode("span", {
3630
+ id: unref(valueTextId),
3631
+ class: normalizeClass(["text", {
3632
+ placeholder: !props.text,
3633
+ missing: props.missing
3634
+ }])
3635
+ }, toDisplayString(props.text ?? props.placeholder), 11, _hoisted_3$4),
3636
+ createElementVNode("span", _hoisted_4$3, [
3637
+ createVNode(KdsIcon, {
3638
+ name: open.value ? "chevron-up" : "chevron-down",
3639
+ size: "small"
3640
+ }, null, 8, ["name"])
3641
+ ])
3642
+ ], 42, _hoisted_1$c);
3643
+ };
3644
+ }
3645
+ });
3646
+
3647
+ const BaseDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-f1917c48"]]);
3648
+
3649
+ const _hoisted_1$b = { class: "kds-empty-state" };
3650
+ const _hoisted_2$4 = { class: "kds-empty-state-headline" };
3651
+ const _hoisted_3$3 = {
3652
+ key: 0,
3653
+ class: "kds-empty-state-description"
3654
+ };
3655
+ const _hoisted_4$2 = {
3656
+ key: 1,
3657
+ class: "kds-empty-state-action"
3658
+ };
3659
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3660
+ __name: "KdsEmptyState",
3661
+ props: {
3662
+ headline: {},
3663
+ description: {},
3664
+ button: {}
3665
+ },
3666
+ emits: ["buttonClick"],
3667
+ setup(__props, { emit: __emit }) {
3668
+ const props = __props;
3669
+ const emit = __emit;
3670
+ const isLinkButton = computed(
3671
+ () => props.button && "to" in props.button && props.button.to !== void 0
3672
+ );
3673
+ const buttonComponent = computed(
3674
+ () => isLinkButton.value ? _sfc_main$A : _sfc_main$B
3675
+ );
3676
+ return (_ctx, _cache) => {
3677
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
3678
+ createElementVNode("p", _hoisted_2$4, toDisplayString(props.headline), 1),
3679
+ props.description ? (openBlock(), createElementBlock("p", _hoisted_3$3, toDisplayString(props.description), 1)) : createCommentVNode("", true),
3680
+ props.button ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
3681
+ (openBlock(), createBlock(resolveDynamicComponent(buttonComponent.value), mergeProps(props.button, {
3682
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("buttonClick", $event))
3683
+ }), null, 16))
3684
+ ])) : createCommentVNode("", true)
3685
+ ]);
3686
+ };
3687
+ }
3688
+ });
3689
+
3690
+ const KdsEmptyState = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-b4af30cf"]]);
3691
+
3692
+ const kdsListItemAccessorySize = {
3693
+ SMALL: "small",
3694
+ LARGE: "large"
3695
+ };
3696
+
3697
+ const kdsListItemVariant = {
3698
+ SMALL: "small",
3699
+ LARGE: "large"
3700
+ };
3701
+
3702
+ const _hoisted_1$a = ["id", "aria-selected", "aria-disabled"];
3703
+ const _hoisted_2$3 = {
3704
+ key: 0,
3705
+ class: "accessory"
3706
+ };
3707
+ const _hoisted_3$2 = { class: "content" };
3708
+ const _hoisted_4$1 = ["title"];
3709
+ const _hoisted_5 = {
3710
+ key: 0,
3711
+ class: "prefix"
3712
+ };
3713
+ const _hoisted_6 = ["title"];
3714
+ const _hoisted_7 = {
3715
+ key: 1,
3716
+ class: "trailing-item"
3717
+ };
3718
+ const _hoisted_8 = {
3719
+ key: 0,
3720
+ class: "shortcut"
3721
+ };
3722
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3723
+ __name: "KdsListItem",
3724
+ props: {
3725
+ id: {},
3726
+ label: {},
3727
+ accessory: { default: void 0 },
3728
+ subText: { default: void 0 },
3729
+ variant: { default: kdsListItemVariant.SMALL },
3730
+ shortcut: { default: void 0 },
3731
+ trailingIcon: { default: void 0 },
3732
+ special: { type: Boolean, default: false },
3733
+ selected: { type: Boolean, default: false },
3734
+ active: { type: Boolean, default: false },
3735
+ missing: { type: Boolean, default: false },
3736
+ disabled: { type: Boolean, default: false }
3737
+ },
3738
+ emits: ["click"],
3739
+ setup(__props, { emit: __emit }) {
3740
+ const props = __props;
3741
+ const emit = __emit;
3742
+ const accessorySize = computed(
3743
+ () => props.variant === kdsListItemVariant.LARGE ? kdsListItemAccessorySize.LARGE : kdsListItemAccessorySize.SMALL
3744
+ );
3745
+ const onClick = (event) => {
3746
+ if (props.disabled) {
3747
+ event.stopPropagation();
3748
+ event.preventDefault();
3749
+ return;
3750
+ }
3751
+ emit("click", event);
3752
+ };
3753
+ const labelEl = useTemplateRef("labelEl");
3754
+ const { isTruncated: isLabelTruncated } = useKdsIsTruncated(labelEl);
3755
+ const subtextEl = useTemplateRef("subtextEl");
3756
+ const { isTruncated: isSubtextTruncated } = useKdsIsTruncated(subtextEl);
3757
+ return (_ctx, _cache) => {
3758
+ return openBlock(), createElementBlock("div", {
3759
+ id: props.id,
3760
+ role: "option",
3761
+ "aria-selected": props.selected,
3762
+ "aria-disabled": props.disabled,
3763
+ class: normalizeClass([
3764
+ "kds-list-item",
3765
+ props.variant,
3766
+ {
3767
+ selected: props.selected,
3768
+ active: props.active,
3769
+ missing: props.missing,
3770
+ disabled: props.disabled
3771
+ }
3772
+ ]),
3773
+ onClick
3774
+ }, [
3775
+ props.accessory ? (openBlock(), createElementBlock("span", _hoisted_2$3, [
3776
+ createVNode(_sfc_main$e, {
3777
+ accessory: props.accessory,
3778
+ size: accessorySize.value,
3779
+ disabled: props.disabled
3780
+ }, null, 8, ["accessory", "size", "disabled"])
3781
+ ])) : createCommentVNode("", true),
3782
+ createElementVNode("span", _hoisted_3$2, [
3783
+ createElementVNode("span", {
3784
+ ref_key: "labelEl",
3785
+ ref: labelEl,
3786
+ class: "label",
3787
+ title: unref(isLabelTruncated) ? props.label : void 0
3788
+ }, [
3789
+ props.missing ? (openBlock(), createElementBlock("span", _hoisted_5, "(Missing) ")) : createCommentVNode("", true),
3790
+ createElementVNode("span", {
3791
+ class: normalizeClass({ special: props.special })
3792
+ }, toDisplayString(props.label), 3)
3793
+ ], 8, _hoisted_4$1),
3794
+ props.subText ? (openBlock(), createElementBlock("span", {
3795
+ key: 0,
3796
+ ref_key: "subtextEl",
3797
+ ref: subtextEl,
3798
+ class: "subtext",
3799
+ title: unref(isSubtextTruncated) ? props.subText : void 0
3800
+ }, toDisplayString(props.subText), 9, _hoisted_6)) : createCommentVNode("", true)
3801
+ ]),
3802
+ props.shortcut || props.trailingIcon ? (openBlock(), createElementBlock("span", _hoisted_7, [
3803
+ props.shortcut ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(props.shortcut), 1)) : createCommentVNode("", true),
3804
+ props.trailingIcon ? (openBlock(), createBlock(KdsIcon, {
3805
+ key: 1,
3806
+ name: props.trailingIcon,
3807
+ size: "small"
3808
+ }, null, 8, ["name"])) : createCommentVNode("", true)
3809
+ ])) : createCommentVNode("", true)
3810
+ ], 10, _hoisted_1$a);
3811
+ };
3812
+ }
3813
+ });
3814
+
3815
+ const KdsListItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-fca25fc2"]]);
3816
+
3817
+ const _hoisted_1$9 = ["aria-label", "aria-activedescendant", "tabindex"];
3818
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3819
+ __name: "KdsListContainer",
3820
+ props: {
3821
+ possibleValues: {},
3822
+ emptyText: { default: "" },
3823
+ ariaLabel: {},
3824
+ controlledExternally: { type: Boolean }
3825
+ },
3826
+ emits: ["itemClick"],
3827
+ setup(__props, { expose: __expose, emit: __emit }) {
3828
+ const props = __props;
3829
+ const emit = __emit;
3830
+ const idPrefix = useId();
3831
+ const toOptionId = (elementId) => elementId.slice(idPrefix.length + 1);
3832
+ const emptyOptionId = `${idPrefix}-empty`;
3833
+ const prefixedValues = computed(
3834
+ () => props.possibleValues.map((o) => ({ ...o, id: `${idPrefix}-${o.id}` }))
3835
+ );
3836
+ const activeId = ref(void 0);
3837
+ const lastActiveId = ref(void 0);
3838
+ const isFocused = ref(false);
3839
+ const containerEl = useTemplateRef("containerEl");
3840
+ function scrollToView() {
3841
+ if (!activeId.value || !containerEl.value) {
3842
+ return;
3843
+ }
3844
+ containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
3845
+ }
3846
+ const onMouseLeave = () => {
3847
+ if (!isFocused.value) {
3848
+ activeId.value = void 0;
3849
+ }
3850
+ };
3851
+ const onMousemove = (event) => {
3852
+ const target = event.target?.closest?.('[role="option"]');
3853
+ if (target instanceof HTMLElement && target.id && target.getAttribute("aria-disabled") !== "true") {
3854
+ activeId.value = target.id;
3855
+ }
3856
+ };
3857
+ const enabledValues = computed(
3858
+ () => prefixedValues.value.filter((o) => !o.disabled)
3859
+ );
3860
+ watch(enabledValues, (values) => {
3861
+ const isValid = (id) => id !== void 0 && values.some((o) => o.id === id);
3862
+ if (activeId.value !== void 0 && !isValid(activeId.value)) {
3863
+ if (values.length > 0) {
3864
+ activeId.value = values[0].id;
3865
+ } else {
3866
+ activeId.value = prefixedValues.value.length === 0 ? emptyOptionId : void 0;
3867
+ }
3868
+ }
3869
+ if (!isValid(lastActiveId.value)) {
3870
+ lastActiveId.value = void 0;
3871
+ }
3872
+ nextTick(scrollToView);
3873
+ });
3874
+ const findEnabledIndex = (id) => id === void 0 ? -1 : enabledValues.value.findIndex((o) => o.id === id);
3875
+ const handleFocus = () => {
3876
+ isFocused.value = true;
3877
+ if (activeId.value === void 0) {
3878
+ activeId.value = lastActiveId.value ?? enabledValues.value[0]?.id;
3879
+ }
3880
+ };
3881
+ const handleBlur = () => {
3882
+ isFocused.value = false;
3883
+ lastActiveId.value = activeId.value;
3884
+ activeId.value = void 0;
3885
+ };
3886
+ const handleKeydown = (event) => {
3887
+ if (enabledValues.value.length === 0) {
3888
+ return;
3889
+ }
3890
+ const currentIndex = findEnabledIndex(activeId.value);
3891
+ switch (event.key) {
3892
+ case "ArrowDown": {
3893
+ const nextIndex = currentIndex < 0 || currentIndex >= enabledValues.value.length - 1 ? 0 : currentIndex + 1;
3894
+ activeId.value = enabledValues.value[nextIndex].id;
3895
+ scrollToView();
3896
+ event.preventDefault();
3897
+ break;
3898
+ }
3899
+ case "ArrowUp": {
3900
+ const nextIndex = currentIndex <= 0 ? enabledValues.value.length - 1 : currentIndex - 1;
3901
+ activeId.value = enabledValues.value[nextIndex].id;
3902
+ scrollToView();
3903
+ event.preventDefault();
3904
+ break;
3905
+ }
3906
+ case "Enter":
3907
+ if (activeId.value) {
3908
+ emit("itemClick", toOptionId(activeId.value));
3909
+ event.preventDefault();
3910
+ }
3911
+ break;
3912
+ case " ":
3913
+ if (event.target instanceof HTMLElement && ["INPUT", "TEXTAREA", "SELECT"].includes(event.target.tagName)) {
3914
+ break;
3915
+ }
3916
+ if (activeId.value) {
3917
+ emit("itemClick", toOptionId(activeId.value));
3918
+ event.preventDefault();
3919
+ }
3920
+ break;
3921
+ case "Home":
3922
+ activeId.value = enabledValues.value[0].id;
3923
+ scrollToView();
3924
+ event.preventDefault();
3925
+ break;
3926
+ case "End":
3927
+ activeId.value = enabledValues.value[enabledValues.value.length - 1].id;
3928
+ scrollToView();
3929
+ event.preventDefault();
3930
+ break;
3931
+ }
3932
+ };
2756
3933
  __expose({
2757
- focus: () => baseInput.value?.focus()
3934
+ /** Forward a keydown event to the list for keyboard navigation */
3935
+ handleKeydown,
3936
+ /** Notify the list that its controlling element received focus */
3937
+ handleFocus,
3938
+ /** Notify the list that its controlling element lost focus */
3939
+ handleBlur,
3940
+ activeDescendant: activeId
2758
3941
  });
2759
3942
  return (_ctx, _cache) => {
2760
- return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
2761
- default: withCtx((slotProps) => [
2762
- createVNode(BaseInput, mergeProps({
2763
- ref_key: "baseInput",
2764
- ref: baseInput
2765
- }, slotProps, {
2766
- modelValue: modelValue.value,
2767
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2768
- type: "search",
2769
- placeholder: props.placeholder,
2770
- disabled: props.disabled,
2771
- readonly: props.readonly,
2772
- required: props.required,
2773
- error: props.error,
2774
- name: props.name,
2775
- autocomplete: props.autocomplete,
2776
- "leading-icon": "search",
2777
- clearable: true
2778
- }), null, 16, ["modelValue", "placeholder", "disabled", "readonly", "required", "error", "name", "autocomplete"])
2779
- ]),
2780
- _: 1
2781
- }, 16);
3943
+ return openBlock(), createElementBlock("div", mergeProps({
3944
+ ref_key: "containerEl",
3945
+ ref: containerEl,
3946
+ role: "listbox",
3947
+ "aria-label": props.ariaLabel,
3948
+ "aria-activedescendant": !props.controlledExternally && activeId.value ? activeId.value : void 0,
3949
+ class: "kds-list-container",
3950
+ tabindex: props.controlledExternally ? void 0 : 0
3951
+ }, toHandlers(
3952
+ props.controlledExternally ? { mousemove: onMousemove, mouseleave: onMouseLeave } : {
3953
+ keydown: handleKeydown,
3954
+ focus: handleFocus,
3955
+ blur: handleBlur,
3956
+ mousemove: onMousemove,
3957
+ mouseleave: onMouseLeave
3958
+ },
3959
+ true
3960
+ )), [
3961
+ (openBlock(true), createElementBlock(Fragment, null, renderList(prefixedValues.value, (item) => {
3962
+ return openBlock(), createBlock(unref(KdsListItem), {
3963
+ id: item.id,
3964
+ key: item.id,
3965
+ accessory: item.accessory,
3966
+ label: item.text,
3967
+ "sub-text": item.subText,
3968
+ selected: item.selected,
3969
+ disabled: item.disabled,
3970
+ active: activeId.value === item.id,
3971
+ special: item.special,
3972
+ missing: item.missing,
3973
+ "trailing-icon": item.selected ? "checkmark" : void 0,
3974
+ onMousedown: _cache[0] || (_cache[0] = ($event) => props.controlledExternally && $event.preventDefault()),
3975
+ onClick: withModifiers(($event) => emit("itemClick", toOptionId(item.id)), ["stop"])
3976
+ }, null, 8, ["id", "accessory", "label", "sub-text", "selected", "disabled", "active", "special", "missing", "trailing-icon", "onClick"]);
3977
+ }), 128)),
3978
+ prefixedValues.value.length === 0 ? (openBlock(), createElementBlock("div", {
3979
+ key: 0,
3980
+ id: emptyOptionId,
3981
+ role: "option",
3982
+ "aria-disabled": "true",
3983
+ "aria-selected": void 0,
3984
+ class: "kds-list-container-empty"
3985
+ }, [
3986
+ createVNode(KdsEmptyState, {
3987
+ headline: props.emptyText
3988
+ }, null, 8, ["headline"])
3989
+ ])) : createCommentVNode("", true)
3990
+ ], 16, _hoisted_1$9);
2782
3991
  };
2783
3992
  }
2784
3993
  });
2785
3994
 
2786
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
2787
- __name: "KdsTextInput",
3995
+ const KdsListContainer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-bfdaa003"]]);
3996
+
3997
+ const _hoisted_1$8 = { class: "kds-dropdown-container" };
3998
+ const _hoisted_2$2 = { class: "kds-dropdown-container-sticky-top" };
3999
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4000
+ __name: "DropdownContainer",
2788
4001
  props: /* @__PURE__ */ mergeModels({
2789
- description: {},
2790
- label: {},
2791
- ariaLabel: {},
2792
- id: {},
2793
- subText: {},
2794
- error: { type: Boolean, default: false },
2795
- validating: { type: Boolean, default: false },
2796
- preserveSubTextSpace: { type: Boolean, default: false },
2797
- placeholder: {},
2798
- disabled: { type: Boolean, default: false },
2799
- readonly: { type: Boolean, default: false },
2800
- required: { type: Boolean, default: false },
2801
- name: {},
2802
- autocomplete: {}
4002
+ emptyText: {},
4003
+ possibleValues: {}
2803
4004
  }, {
2804
- "modelValue": { default: "" },
4005
+ "modelValue": { default: null },
2805
4006
  "modelModifiers": {}
2806
4007
  }),
2807
4008
  emits: ["update:modelValue"],
2808
4009
  setup(__props, { expose: __expose }) {
2809
4010
  const props = __props;
2810
4011
  const modelValue = useModel(__props, "modelValue");
2811
- const baseInput = useTemplateRef("baseInput");
4012
+ const searchValue = ref("");
4013
+ const searchEl = useTemplateRef("searchEl");
4014
+ const listContainerRef = useTemplateRef("listContainer");
4015
+ const optionsWithSyntheticMissing = computed(
4016
+ () => {
4017
+ if (modelValue.value === null) {
4018
+ return props.possibleValues;
4019
+ }
4020
+ const hasSelected = props.possibleValues.some(
4021
+ (o) => o.id === modelValue.value
4022
+ );
4023
+ if (hasSelected) {
4024
+ return props.possibleValues;
4025
+ }
4026
+ return [
4027
+ {
4028
+ id: modelValue.value,
4029
+ text: modelValue.value,
4030
+ missing: true
4031
+ },
4032
+ ...props.possibleValues
4033
+ ];
4034
+ }
4035
+ );
4036
+ const filteredOptions = computed(() => {
4037
+ const normalizedQuery = searchValue.value.trim().toLowerCase();
4038
+ const base = optionsWithSyntheticMissing.value;
4039
+ if (normalizedQuery.length === 0) {
4040
+ return base;
4041
+ }
4042
+ return base.filter(
4043
+ (option) => option.text.toLowerCase().includes(normalizedQuery)
4044
+ );
4045
+ });
4046
+ const listOptions = computed(
4047
+ () => filteredOptions.value.map((option) => ({
4048
+ id: option.id,
4049
+ text: option.text,
4050
+ subText: option.subText,
4051
+ accessory: option.accessory,
4052
+ disabled: option.disabled || option.missing,
4053
+ selected: option.id === modelValue.value,
4054
+ special: option.special,
4055
+ missing: option.missing
4056
+ }))
4057
+ );
4058
+ const hasMultiline = computed(
4059
+ () => props.possibleValues.some((o) => o.subText !== void 0)
4060
+ );
2812
4061
  __expose({
2813
- focus: () => baseInput.value?.focus()
4062
+ focus: () => searchEl.value?.focus()
2814
4063
  });
2815
4064
  return (_ctx, _cache) => {
2816
- return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
2817
- default: withCtx((slotProps) => [
2818
- createVNode(BaseInput, mergeProps({
2819
- ref_key: "baseInput",
2820
- ref: baseInput
2821
- }, slotProps, {
2822
- modelValue: modelValue.value,
2823
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2824
- type: "text",
2825
- placeholder: props.placeholder,
2826
- disabled: props.disabled,
2827
- readonly: props.readonly,
2828
- required: props.required,
2829
- error: props.error,
2830
- name: props.name,
2831
- autocomplete: props.autocomplete
2832
- }), null, 16, ["modelValue", "placeholder", "disabled", "readonly", "required", "error", "name", "autocomplete"])
4065
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
4066
+ createElementVNode("div", _hoisted_2$2, [
4067
+ createVNode(BaseInput, {
4068
+ ref_key: "searchEl",
4069
+ ref: searchEl,
4070
+ modelValue: searchValue.value,
4071
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
4072
+ type: "search",
4073
+ placeholder: "Search",
4074
+ "aria-label": "Filter options",
4075
+ "aria-activedescendant": listContainerRef.value?.activeDescendant,
4076
+ "leading-icon": "search",
4077
+ clearable: true,
4078
+ onKeydown: _cache[1] || (_cache[1] = ($event) => listContainerRef.value?.handleKeydown($event)),
4079
+ onFocus: _cache[2] || (_cache[2] = ($event) => listContainerRef.value?.handleFocus()),
4080
+ onBlur: _cache[3] || (_cache[3] = ($event) => listContainerRef.value?.handleBlur())
4081
+ }, null, 8, ["modelValue", "aria-activedescendant"])
2833
4082
  ]),
2834
- _: 1
2835
- }, 16);
4083
+ createVNode(unref(KdsListContainer), {
4084
+ ref: "listContainer",
4085
+ class: normalizeClass(["kds-dropdown-container-list", { multiline: hasMultiline.value }]),
4086
+ "possible-values": listOptions.value,
4087
+ "empty-text": props.emptyText,
4088
+ "controlled-externally": "",
4089
+ "aria-label": "Dropdown options",
4090
+ onItemClick: _cache[4] || (_cache[4] = ($event) => modelValue.value = $event)
4091
+ }, null, 8, ["class", "possible-values", "empty-text"])
4092
+ ]);
2836
4093
  };
2837
4094
  }
2838
4095
  });
2839
4096
 
2840
- const _hoisted_1$a = ["rows", "placeholder", "disabled", "readonly", "required", "name", "autocomplete"];
2841
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2842
- __name: "KdsTextarea",
4097
+ const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-dd55ee4d"]]);
4098
+
4099
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4100
+ __name: "KdsDropdown",
2843
4101
  props: /* @__PURE__ */ mergeModels({
4102
+ placeholder: { default: "Select" },
4103
+ disabled: { type: Boolean, default: false },
4104
+ possibleValues: {},
2844
4105
  description: {},
2845
4106
  label: {},
2846
4107
  ariaLabel: {},
@@ -2848,128 +4109,87 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2848
4109
  subText: {},
2849
4110
  error: { type: Boolean, default: false },
2850
4111
  validating: { type: Boolean, default: false },
2851
- preserveSubTextSpace: { type: Boolean, default: false },
2852
- placeholder: { default: "" },
2853
- disabled: { type: Boolean, default: false },
2854
- readonly: { type: Boolean, default: false },
2855
- required: { type: Boolean, default: false },
2856
- name: {},
2857
- autocomplete: {},
2858
- rows: { default: 3 }
4112
+ preserveSubTextSpace: { type: Boolean, default: false }
2859
4113
  }, {
2860
- "modelValue": { default: "" },
4114
+ "modelValue": { default: null },
2861
4115
  "modelModifiers": {}
2862
4116
  }),
2863
4117
  emits: ["update:modelValue"],
2864
- setup(__props, { expose: __expose }) {
4118
+ setup(__props) {
2865
4119
  const props = __props;
2866
- const normalizedRows = computed(() => Math.max(1, props.rows));
2867
4120
  const modelValue = useModel(__props, "modelValue");
2868
- const textareaElement = useTemplateRef("textareaElement");
2869
- function resize() {
2870
- const element = textareaElement.value;
2871
- if (!element) {
2872
- return;
2873
- }
2874
- element.style.height = "auto";
2875
- const scrollHeight = element.scrollHeight;
2876
- const offsetHeight = element.offsetHeight;
2877
- if (scrollHeight <= offsetHeight) {
2878
- return;
4121
+ const open = ref(false);
4122
+ const popoverEl = useTemplateRef("popoverEl");
4123
+ const dropdownContainerEl = useTemplateRef("dropdownContainerEl");
4124
+ const selectedOption = computed(
4125
+ () => props.possibleValues.find((o) => o.id === modelValue.value)
4126
+ );
4127
+ watchEffect(() => {
4128
+ if (open.value) {
4129
+ nextTick(() => dropdownContainerEl.value?.focus());
2879
4130
  }
2880
- element.style.height = `${scrollHeight}px`;
2881
- }
2882
- useResizeObserver(textareaElement, resize);
2883
- watch(modelValue, resize, { immediate: true });
2884
- __expose({
2885
- focus: () => {
2886
- textareaElement.value?.focus();
4131
+ });
4132
+ watch(modelValue, () => {
4133
+ if (open.value) {
4134
+ open.value = false;
2887
4135
  }
2888
4136
  });
2889
4137
  return (_ctx, _cache) => {
2890
- return openBlock(), createBlock(BaseFormFieldWrapper, normalizeProps(guardReactiveProps(props)), {
4138
+ return openBlock(), createBlock(BaseFormFieldWrapper, {
4139
+ id: props.id,
4140
+ label: props.label,
4141
+ "aria-label": props.ariaLabel,
4142
+ description: props.description,
4143
+ "sub-text": props.subText,
4144
+ error: props.error,
4145
+ validating: props.validating,
4146
+ "preserve-sub-text-space": props.preserveSubTextSpace
4147
+ }, {
2891
4148
  default: withCtx((slotProps) => [
2892
- withDirectives(createElementVNode("textarea", mergeProps(slotProps, {
2893
- ref_key: "textareaElement",
2894
- ref: textareaElement,
2895
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2896
- class: { invalid: props.error },
2897
- rows: normalizedRows.value,
4149
+ createVNode(BaseDropdown, mergeProps(slotProps, {
4150
+ open: open.value,
4151
+ "onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
4152
+ text: modelValue.value !== null && !selectedOption.value ? `(Missing) ${modelValue.value}` : selectedOption.value?.text,
2898
4153
  placeholder: props.placeholder,
2899
4154
  disabled: props.disabled,
2900
- readonly: props.readonly,
2901
- required: props.required,
2902
- name: props.name,
2903
- autocomplete: props.autocomplete
2904
- }), null, 16, _hoisted_1$a), [
2905
- [vModelText, modelValue.value]
2906
- ])
4155
+ error: props.error,
4156
+ missing: modelValue.value !== null && !selectedOption.value,
4157
+ accessory: selectedOption.value?.accessory,
4158
+ style: popoverEl.value?.anchorStyle,
4159
+ "popover-id": popoverEl.value?.popoverId,
4160
+ onClick: _cache[1] || (_cache[1] = ($event) => open.value = !open.value)
4161
+ }), null, 16, ["open", "text", "placeholder", "disabled", "error", "missing", "accessory", "style", "popover-id"]),
4162
+ createVNode(KdsPopover, {
4163
+ ref_key: "popoverEl",
4164
+ ref: popoverEl,
4165
+ modelValue: open.value,
4166
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => open.value = $event),
4167
+ placement: "bottom-left",
4168
+ role: "dialog",
4169
+ "full-width": "",
4170
+ "popover-aria-label": "Searchable dropdown options"
4171
+ }, {
4172
+ default: withCtx(() => [
4173
+ createVNode(DropdownContainer, {
4174
+ ref_key: "dropdownContainerEl",
4175
+ ref: dropdownContainerEl,
4176
+ modelValue: modelValue.value,
4177
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => modelValue.value = $event),
4178
+ "possible-values": props.possibleValues,
4179
+ "empty-text": "No entries found"
4180
+ }, null, 8, ["modelValue", "possible-values"])
4181
+ ]),
4182
+ _: 1
4183
+ }, 8, ["modelValue"])
2907
4184
  ]),
2908
4185
  _: 1
2909
- }, 16);
2910
- };
2911
- }
2912
- });
2913
-
2914
- const KdsTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2e4d2d42"]]);
2915
-
2916
- const _hoisted_1$9 = ["id", "role", "aria-label"];
2917
- const _hoisted_2$3 = {
2918
- key: 0,
2919
- class: "kds-popover-default-content"
2920
- };
2921
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2922
- __name: "KdsPopover",
2923
- props: /* @__PURE__ */ mergeModels({
2924
- placement: { default: "bottom-left" },
2925
- role: { default: "dialog" },
2926
- fullWidth: { type: Boolean, default: false },
2927
- popoverAriaLabel: {},
2928
- content: {}
2929
- }, {
2930
- "modelValue": { type: Boolean, ...{ default: false } },
2931
- "modelModifiers": {}
2932
- }),
2933
- emits: ["update:modelValue"],
2934
- setup(__props, { expose: __expose }) {
2935
- const props = __props;
2936
- const open = useModel(__props, "modelValue");
2937
- const popoverEl = useTemplateRef("popoverEl");
2938
- const popoverId = useId();
2939
- const anchorName = `--anchor-${popoverId}`;
2940
- watchEffect(() => {
2941
- if (open.value) {
2942
- popoverEl.value?.showPopover?.();
2943
- } else {
2944
- popoverEl.value?.hidePopover?.();
2945
- }
2946
- });
2947
- const anchorStyle = { "anchor-name": anchorName };
2948
- __expose({ anchorStyle, popoverId });
2949
- return (_ctx, _cache) => {
2950
- return openBlock(), createElementBlock("div", {
2951
- id: unref(popoverId),
2952
- ref_key: "popoverEl",
2953
- ref: popoverEl,
2954
- class: normalizeClass(["kds-popover", ["floating", props.placement, { "full-width": props.fullWidth }]]),
2955
- popover: "auto",
2956
- style: normalizeStyle({ "position-anchor": anchorName }),
2957
- role: props.role,
2958
- "aria-label": props.popoverAriaLabel,
2959
- onToggle: _cache[0] || (_cache[0] = ($event) => open.value = $event.newState === "open")
2960
- }, [
2961
- open.value ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
2962
- props.content?.trim().length ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(props.content), 1)) : createCommentVNode("", true)
2963
- ], true) : createCommentVNode("", true)
2964
- ], 46, _hoisted_1$9);
4186
+ }, 8, ["id", "label", "aria-label", "description", "sub-text", "error", "validating", "preserve-sub-text-space"]);
2965
4187
  };
2966
4188
  }
2967
4189
  });
2968
4190
 
2969
- const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9125d023"]]);
2970
-
2971
- const _hoisted_1$8 = { class: "kds-info-popover-content" };
2972
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4191
+ const _hoisted_1$7 = { class: "kds-info-popover-content" };
4192
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2973
4193
  __name: "InfoPopover",
2974
4194
  props: {
2975
4195
  content: {}
@@ -2977,7 +4197,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2977
4197
  setup(__props) {
2978
4198
  const props = __props;
2979
4199
  return (_ctx, _cache) => {
2980
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
4200
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
2981
4201
  renderSlot(_ctx.$slots, "default", {}, () => [
2982
4202
  createTextVNode(toDisplayString(props.content), 1)
2983
4203
  ], true)
@@ -2986,11 +4206,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2986
4206
  }
2987
4207
  });
2988
4208
 
2989
- const InfoPopover = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-951f2a2b"]]);
4209
+ const InfoPopover = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-951f2a2b"]]);
2990
4210
 
2991
- const _hoisted_1$7 = ["aria-pressed", "aria-expanded", "aria-controls"];
4211
+ const _hoisted_1$6 = ["aria-pressed", "aria-expanded", "aria-controls"];
2992
4212
  const TITLE = "Click for more information";
2993
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4213
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2994
4214
  __name: "KdsInfoToggleButton",
2995
4215
  props: /* @__PURE__ */ mergeModels({
2996
4216
  content: {},
@@ -3032,7 +4252,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3032
4252
  name: "circle-question",
3033
4253
  size: "small"
3034
4254
  })
3035
- ], 16, _hoisted_1$7),
4255
+ ], 16, _hoisted_1$6),
3036
4256
  createVNode(KdsPopover, {
3037
4257
  ref_key: "popoverEl",
3038
4258
  ref: popoverEl,
@@ -3058,15 +4278,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3058
4278
  }
3059
4279
  });
3060
4280
 
3061
- const KdsInfoToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-f98c9924"]]);
4281
+ const KdsInfoToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-f98c9924"]]);
3062
4282
 
3063
4283
  const KdsInfoToggleButton$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3064
4284
  __proto__: null,
3065
4285
  default: KdsInfoToggleButton
3066
4286
  }, Symbol.toStringTag, { value: 'Module' }));
3067
4287
 
3068
- const _hoisted_1$6 = { class: "kds-variable-popover" };
3069
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4288
+ const _hoisted_1$5 = { class: "kds-variable-popover" };
4289
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3070
4290
  __name: "VariablePopover",
3071
4291
  props: {
3072
4292
  content: {}
@@ -3074,7 +4294,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3074
4294
  setup(__props) {
3075
4295
  const props = __props;
3076
4296
  return (_ctx, _cache) => {
3077
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
4297
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
3078
4298
  renderSlot(_ctx.$slots, "default", {}, () => [
3079
4299
  createTextVNode(toDisplayString(props.content), 1)
3080
4300
  ], true)
@@ -3083,10 +4303,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3083
4303
  }
3084
4304
  });
3085
4305
 
3086
- const VariablePopover = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-54c206b9"]]);
4306
+ const VariablePopover = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-54c206b9"]]);
3087
4307
 
3088
- const _hoisted_1$5 = ["title", "aria-label", "aria-pressed", "aria-expanded", "aria-controls"];
3089
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4308
+ const _hoisted_1$4 = ["title", "aria-label", "aria-pressed", "aria-expanded", "aria-controls"];
4309
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3090
4310
  __name: "KdsVariableToggleButton",
3091
4311
  props: /* @__PURE__ */ mergeModels({
3092
4312
  content: {},
@@ -3175,7 +4395,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3175
4395
  name: iconName.value,
3176
4396
  size: "small"
3177
4397
  }, null, 8, ["name"])
3178
- ], 16, _hoisted_1$5),
4398
+ ], 16, _hoisted_1$4),
3179
4399
  createVNode(KdsPopover, {
3180
4400
  ref_key: "popoverEl",
3181
4401
  ref: popoverEl,
@@ -3201,50 +4421,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3201
4421
  }
3202
4422
  });
3203
4423
 
3204
- const KdsVariableToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1541cbb3"]]);
3205
-
3206
- const _hoisted_1$4 = { class: "kds-empty-state" };
3207
- const _hoisted_2$2 = { class: "kds-empty-state-headline" };
3208
- const _hoisted_3$2 = {
3209
- key: 0,
3210
- class: "kds-empty-state-description"
3211
- };
3212
- const _hoisted_4$1 = {
3213
- key: 1,
3214
- class: "kds-empty-state-action"
3215
- };
3216
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3217
- __name: "KdsEmptyState",
3218
- props: {
3219
- headline: {},
3220
- description: {},
3221
- button: {}
3222
- },
3223
- emits: ["buttonClick"],
3224
- setup(__props, { emit: __emit }) {
3225
- const props = __props;
3226
- const emit = __emit;
3227
- const isLinkButton = computed(
3228
- () => props.button && "to" in props.button && props.button.to !== void 0
3229
- );
3230
- const buttonComponent = computed(
3231
- () => isLinkButton.value ? _sfc_main$s : _sfc_main$t
3232
- );
3233
- return (_ctx, _cache) => {
3234
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
3235
- createElementVNode("p", _hoisted_2$2, toDisplayString(props.headline), 1),
3236
- props.description ? (openBlock(), createElementBlock("p", _hoisted_3$2, toDisplayString(props.description), 1)) : createCommentVNode("", true),
3237
- props.button ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
3238
- (openBlock(), createBlock(resolveDynamicComponent(buttonComponent.value), mergeProps(props.button, {
3239
- onClick: _cache[0] || (_cache[0] = ($event) => emit("buttonClick", $event))
3240
- }), null, 16))
3241
- ])) : createCommentVNode("", true)
3242
- ]);
3243
- };
3244
- }
3245
- });
3246
-
3247
- const KdsEmptyState = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b4af30cf"]]);
4424
+ const KdsVariableToggleButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1541cbb3"]]);
3248
4425
 
3249
4426
  const _hoisted_1$3 = ["aria-label", "aria-labelledby", "aria-pressed", "disabled"];
3250
4427
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
@@ -3381,7 +4558,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3381
4558
  size: "medium"
3382
4559
  }, null, 8, ["name"])) : createCommentVNode("", true),
3383
4560
  createElementVNode("div", _hoisted_2$1, toDisplayString(props.title), 1),
3384
- createVNode(_sfc_main$t, {
4561
+ createVNode(_sfc_main$B, {
3385
4562
  "leading-icon": "x-close",
3386
4563
  variant: "transparent",
3387
4564
  size: "medium",
@@ -3654,7 +4831,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3654
4831
  unref(internal).isTemplateBasedConfirm(unref(config).value) ? (openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1, [
3655
4832
  createElementVNode("div", _hoisted_2, toDisplayString(unref(config).value.message), 1),
3656
4833
  unref(config).value.doNotAskAgain ? (openBlock(), createElementBlock("div", _hoisted_3, [
3657
- createVNode(_sfc_main$m, {
4834
+ createVNode(_sfc_main$u, {
3658
4835
  modelValue: askAgain.value,
3659
4836
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => askAgain.value = $event),
3660
4837
  label: unref(config).value.doNotAskAgain.label,
@@ -3669,7 +4846,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3669
4846
  name: "footer",
3670
4847
  fn: withCtx(() => [
3671
4848
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(config).value.buttons, (button, index) => {
3672
- return openBlock(), createBlock(_sfc_main$t, {
4849
+ return openBlock(), createBlock(_sfc_main$B, {
3673
4850
  key: index,
3674
4851
  destructive: button.destructive,
3675
4852
  autofocus: button.autofocus,
@@ -3701,5 +4878,5 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3701
4878
 
3702
4879
  const KdsDynamicModalProvider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-67e036b5"]]);
3703
4880
 
3704
- export { KdsAvatar, KdsBadge, _sfc_main$t as KdsButton, KdsCardClickable, _sfc_main$m as KdsCheckbox, KdsCheckboxGroup, KdsColorSwatch, KdsDataType, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsLabel, _sfc_main$s as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsModal, KdsModalLayout, _sfc_main$e as KdsNumberInput, _sfc_main$d as KdsPatternInput, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, _sfc_main$c as KdsSearchInput, KdsSubText, _sfc_main$b as KdsTextInput, KdsTextarea, _sfc_main$r 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, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
4881
+ export { KdsAvatar, KdsBadge, _sfc_main$B as KdsButton, KdsCardClickable, _sfc_main$u as KdsCheckbox, KdsCheckboxGroup, _sfc_main$j as KdsColorInput, KdsColorSwatch, KdsDataType, _sfc_main$8 as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsIcon, KdsInfoToggleButton, KdsLabel, _sfc_main$A as KdsLinkButton, KdsLiveStatus, KdsLoadingSpinner, KdsModal, KdsModalLayout, _sfc_main$i as KdsNumberInput, _sfc_main$h as KdsPatternInput, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, _sfc_main$g as KdsSearchInput, KdsSubText, _sfc_main$l as KdsTextInput, KdsTextarea, _sfc_main$z 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, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode };
3705
4882
  //# sourceMappingURL=index.js.map