@eightshift/ui-components 8.1.0 → 8.2.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 (150) hide show
  1. package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
  2. package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
  3. package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
  4. package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
  5. package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
  6. package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
  7. package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
  8. package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
  9. package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
  10. package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
  11. package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
  12. package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
  13. package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
  14. package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
  15. package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
  16. package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
  17. package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
  18. package/dist/assets/style-admin.css +1 -1
  19. package/dist/assets/style-editor.css +1 -1
  20. package/dist/assets/style.css +1 -1
  21. package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
  22. package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
  23. package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
  24. package/dist/components/animated-visibility/animated-visibility.js +5 -3
  25. package/dist/components/base-control/base-control.js +1 -1
  26. package/dist/components/base-control/container.d.ts +4 -30
  27. package/dist/components/base-control/container.js +5 -32
  28. package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
  29. package/dist/components/button/button.js +1 -1
  30. package/dist/components/checkbox/checkbox.js +1 -1
  31. package/dist/components/color-pickers/color-picker.js +7 -7
  32. package/dist/components/color-pickers/color-swatch.js +1 -1
  33. package/dist/components/color-pickers/gradient-editor.js +1 -1
  34. package/dist/components/color-pickers/solid-color-picker.js +1 -1
  35. package/dist/components/component-toggle/component-toggle.js +3 -3
  36. package/dist/components/container-panel/container-panel.js +11 -11
  37. package/dist/components/contextual-help/contextual-help.js +2 -2
  38. package/dist/components/draggable/draggable.d.ts +3 -3
  39. package/dist/components/draggable/draggable.js +1 -1
  40. package/dist/components/draggable-list/draggable-list.d.ts +3 -3
  41. package/dist/components/draggable-list/draggable-list.js +8 -8
  42. package/dist/components/expandable/expandable.js +3 -3
  43. package/dist/components/index.js +16 -16
  44. package/dist/components/input-field/input-field.js +1 -1
  45. package/dist/components/item-collection/item-collection.d.ts +3 -28
  46. package/dist/components/item-collection/item-collection.js +6 -6
  47. package/dist/components/link-input/link-input.d.ts +0 -2
  48. package/dist/components/link-input/link-input.js +1 -1
  49. package/dist/components/matrix-align/matrix-align.js +4 -3
  50. package/dist/components/menu/menu.js +10 -7
  51. package/dist/components/modal/modal.js +1 -1
  52. package/dist/components/notice/notice.js +8 -8
  53. package/dist/components/number-picker/number-picker.js +1 -1
  54. package/dist/components/option-select/option-select.d.ts +1 -1
  55. package/dist/components/option-select/option-select.js +21 -15
  56. package/dist/components/options-panel/options-panel.js +4 -4
  57. package/dist/components/placeholders/file-picker-shell.js +4 -3
  58. package/dist/components/placeholders/file-placeholder.js +2 -1
  59. package/dist/components/popover/popover.js +3 -3
  60. package/dist/components/portal-provider/portal-provider.js +2 -1
  61. package/dist/components/radio/radio.js +2 -2
  62. package/dist/components/repeater/repeater-context.d.ts +0 -1
  63. package/dist/components/repeater/repeater-item.js +1 -1
  64. package/dist/components/repeater/repeater.d.ts +5 -38
  65. package/dist/components/repeater/repeater.js +7 -10
  66. package/dist/components/responsive/mini-responsive.d.ts +0 -1
  67. package/dist/components/responsive/mini-responsive.js +30 -30
  68. package/dist/components/responsive/responsive-legacy.d.ts +0 -1
  69. package/dist/components/responsive/responsive-legacy.js +12 -10
  70. package/dist/components/responsive/responsive.d.ts +0 -1
  71. package/dist/components/responsive/responsive.js +28 -28
  72. package/dist/components/responsive-preview/responsive-preview.js +3 -3
  73. package/dist/components/select/async-multi-select.d.ts +12 -13
  74. package/dist/components/select/async-multi-select.js +39 -20
  75. package/dist/components/select/async-select.d.ts +12 -13
  76. package/dist/components/select/async-select.js +38 -20
  77. package/dist/components/select/multi-select.d.ts +2 -8
  78. package/dist/components/select/multi-select.js +19 -19
  79. package/dist/components/select/shared.d.ts +5 -9
  80. package/dist/components/select/shared.js +2 -2
  81. package/dist/components/select/single-select.d.ts +2 -8
  82. package/dist/components/select/single-select.js +16 -16
  83. package/dist/components/slider/column-config-slider.js +7 -5
  84. package/dist/components/slider/slider.js +15 -11
  85. package/dist/components/smart-image/smart-image.d.ts +0 -1
  86. package/dist/components/smart-image/smart-image.js +52 -50
  87. package/dist/components/tabs/tabs.js +1 -1
  88. package/dist/components/toggle/switch.js +1 -1
  89. package/dist/components/toggle/toggle.js +2 -2
  90. package/dist/components/toggle-button/toggle-button.js +1 -1
  91. package/dist/components/tooltip/tooltip.js +1 -1
  92. package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
  93. package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
  94. package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
  95. package/dist/icons/block-icon.js +1 -1
  96. package/dist/icons/icon.d.ts +3 -3
  97. package/dist/icons/icon.js +21 -9
  98. package/dist/icons/icons.d.ts +210 -1
  99. package/dist/icons/index.js +1 -1
  100. package/dist/icons/jsx-svg.d.ts +5 -4
  101. package/dist/icons/jsx-svg.js +1 -1
  102. package/dist/index.js +16 -16
  103. package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
  104. package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
  105. package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
  106. package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
  107. package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
  108. package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
  109. package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
  110. package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
  111. package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
  112. package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
  113. package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
  114. package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
  115. package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
  116. package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
  117. package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
  118. package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
  119. package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
  120. package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
  121. package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
  122. package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
  123. package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
  124. package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
  125. package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
  126. package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
  127. package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
  128. package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
  129. package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
  130. package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
  131. package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
  132. package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
  133. package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
  134. package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
  135. package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
  136. package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
  137. package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
  138. package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
  139. package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
  140. package/dist/utilities/array-helpers.d.ts +1 -1
  141. package/dist/utilities/array-helpers.js +4 -3
  142. package/dist/utilities/debounce-throttle.d.ts +9 -2
  143. package/dist/utilities/es-dash.d.ts +11 -8
  144. package/dist/utilities/es-dash.js +1 -1
  145. package/dist/utilities/index.js +2 -2
  146. package/dist/utilities/text-helpers.js +1 -1
  147. package/dist/utilities/web-workers.d.ts +7 -7
  148. package/dist/utilities/web-workers.js +5 -5
  149. package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
  150. package/package.json +21 -25
@@ -1,17 +1,17 @@
1
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
2
- import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-BUU44AuW.js";
3
- import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-PzY6FI39.js";
4
- import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-UpU4cKPh.js";
5
- import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-_E2Z5G2l.js";
6
- import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-3XLIaepk.js";
7
- import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-e8jIFT3s.js";
8
- import { c as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, r as getGroupedOptions, s as $c8bb816105474884$export$e288731fd71264f0, t as OptionItemBase } from "../../shared-Ba_bt4s9.js";
9
- import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-DepY-52g.js";
10
- import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-q2Fj0L9K.js";
11
- import { t as $c73d3f3d5ec90946$export$bc3384a35de93d66 } from "../../useAsyncList-B3-uyJgA.js";
2
+ import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-CO9aIsTe.js";
3
+ import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-LQlZnc1u.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DO3oQfCq.js";
6
+ import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-Bdqjmtt2.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-CnTuCBMs.js";
8
+ import { c as isStringValue, d as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, o as isPrimitive, r as getGroupedOptions, t as OptionItemBase, u as $c8bb816105474884$export$e288731fd71264f0 } from "../../shared-DBCipn_m.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CBvtIFuB.js";
10
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-zY9JqR1c.js";
11
+ import { t as $c73d3f3d5ec90946$export$bc3384a35de93d66 } from "../../useAsyncList-CjKVLGN0.js";
12
12
  import { RichLabel } from "../rich-label/rich-label.js";
13
13
  import { BaseControl } from "../base-control/base-control.js";
14
- import { i as unescapeHTML } from "../../text-helpers-2j9DuxP1.js";
14
+ import { i as unescapeHTML } from "../../text-helpers-QrwKKaOh.js";
15
15
  import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
16
16
  import { n as _n, t as __ } from "../../build-module-DG6ZK7Ty.js";
17
17
  import { Icon } from "../../icons/icon.js";
@@ -28,16 +28,29 @@ import { selectButtonClass, selectControlClass } from "./styles.js";
28
28
  import { cloneElement, useMemo, useRef } from "react";
29
29
  import { jsx, jsxs } from "react/jsx-runtime";
30
30
  //#region lib/components/select/async-multi-select.tsx
31
+ var getRawItemValue = (item, key) => {
32
+ return Object.entries(item).find(([entryKey]) => entryKey === key)?.[1];
33
+ };
34
+ var setRawItemValue = (item, key, value) => {
35
+ Object.defineProperty(item, key, {
36
+ configurable: true,
37
+ enumerable: true,
38
+ value,
39
+ writable: true
40
+ });
41
+ };
42
+ var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
43
+ var isAsyncMultiSelectOption = (value) => value instanceof Object && "value" in value && isPrimitive(value.value);
31
44
  var TypedDraggableList = DraggableList;
32
45
  var getPopoverStyle = (triggerElement) => ({ "--select-width": triggerElement ? `${triggerElement.offsetWidth}px` : "var(--trigger-width)" });
33
46
  var getCurrentValue = (value) => {
34
47
  if (!Array.isArray(value)) return [];
35
- return value.filter((item) => typeof item === "object" && item !== null);
48
+ return value.filter((item) => isAsyncMultiSelectOption(item));
36
49
  };
37
50
  var getCurrentValueKeys = (value) => {
38
51
  if (!Array.isArray(value)) return [];
39
52
  return value.flatMap((item) => {
40
- if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") return getOptionKey(item);
53
+ if (isPrimitive(item)) return getOptionKey(item);
41
54
  if (item) return getOptionKey(item.value);
42
55
  return [];
43
56
  });
@@ -45,14 +58,14 @@ var getCurrentValueKeys = (value) => {
45
58
  var normalizeSelectedKeys = (selected) => {
46
59
  if (selected === null || selected === void 0 || selected === "all") return [];
47
60
  return (Array.isArray(selected) ? selected : [...selected]).flatMap((key) => {
48
- if (typeof key === "string") return key;
49
- if (typeof key === "number") return String(key);
61
+ if (isStringValue(key)) return key;
62
+ if (isNumberValue(key)) return String(key);
50
63
  return [];
51
64
  });
52
65
  };
53
66
  var getOptionIcon = (icon) => {
54
67
  if (!icon) return;
55
- return typeof icon === "string" ? jsx(Icon, { icon }) : icon;
68
+ return isStringValue(icon) ? jsx(Icon, { icon }) : icon;
56
69
  };
57
70
  var renderOptionIcon = (icon) => getOptionIcon(icon) ?? null;
58
71
  /**
@@ -77,7 +90,13 @@ var renderOptionIcon = (icon) => getOptionIcon(icon) ?? null;
77
90
  * />
78
91
  */
79
92
  var AsyncMultiSelect = (props) => {
80
- const { label, help, icon, subtitle, actions, inline, value, onChange, clearable = false, disabled = false, placeholder = __("Select...", "eightshift-ui-components"), fetchUrl, fetchConfig = {}, fetchFunction, getLabel = (item) => typeof item.label === "string" ? item.label : void 0, getValue = (item) => typeof item.value === "string" || typeof item.value === "number" || typeof item.value === "boolean" ? item.value : void 0, getMeta, getIcon, getSubtitle, getGroup, getData = (data) => Array.isArray(data) ? data : [], customMenuOption, customValueDisplay, customDropdownArrow, className, groupKey, groupValueMapping, flat, size = "default", noMinWidth = false, noReorder, hidden, processLoadedOptions = (options) => options, ...rest } = props;
93
+ const { label, help, icon, subtitle, actions, inline, value, onChange, clearable = false, disabled = false, placeholder = __("Select...", "eightshift-ui-components"), fetchUrl, fetchConfig = {}, fetchFunction, getLabel = (item) => {
94
+ const itemLabel = getRawItemValue(item, "label");
95
+ return isStringValue(itemLabel) ? itemLabel : void 0;
96
+ }, getValue = (item) => {
97
+ const itemValue = getRawItemValue(item, "value");
98
+ return isPrimitive(itemValue) ? itemValue : void 0;
99
+ }, getMeta, getIcon, getSubtitle, getGroup, getData = (data) => Array.isArray(data) ? data : data.jokes ?? [], customMenuOption, customValueDisplay, customDropdownArrow, className, groupKey, groupValueMapping, flat, size = "default", noMinWidth = false, noReorder, hidden, processLoadedOptions = (options) => options, ...rest } = props;
81
100
  const ref = useRef(null);
82
101
  const currentValue = getCurrentValue(value);
83
102
  const currentValueKeys = getCurrentValueKeys(value);
@@ -107,7 +126,7 @@ var AsyncMultiSelect = (props) => {
107
126
  }
108
127
  if (getSubtitle) entry.subtitle = (unescapeHTML(getSubtitle(item) ?? "") ?? "") || void 0;
109
128
  if (getIcon) entry.icon = getIcon(item);
110
- if (getGroup) entry[groupKey ?? "_group"] = getGroup(item);
129
+ if (getGroup) setRawItemValue(entry, groupKey ?? "_group", getGroup(item));
111
130
  return entry;
112
131
  });
113
132
  if ((filterText ?? "").length > 0) return { items: output };
@@ -248,7 +267,7 @@ var AsyncMultiSelect = (props) => {
248
267
  className: "es:grid es:grid-cols-1 es:grid-rows-[auto_minmax(0,1fr)] es:p-0!",
249
268
  wrapperClassName: "es:w-(--select-width) es:min-w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip es:rounded-20!",
250
269
  hidden: Boolean(noReorder) || disabled || currentValue.length < 2,
251
- style: getPopoverStyle(ref.current),
270
+ style: getPopoverStyle(null),
252
271
  children: [jsx("span", {
253
272
  className: "es:text-sm es:ml-3 es:mt-2 es:mb-1 es:font-variation-[\"wdth\"_100,\"wght\"_325,\"ROND\"_100] es:text-surface-600",
254
273
  children: __("Item order", "eightshift-ui-components")
@@ -282,7 +301,7 @@ var AsyncMultiSelect = (props) => {
282
301
  placement: "bottom left",
283
302
  maxHeight: 260,
284
303
  triggerRef: ref,
285
- style: getPopoverStyle(ref.current),
304
+ style: getPopoverStyle(null),
286
305
  children: jsxs($4b38b5b75ecc6208$export$2f2b9559550c7bbc, {
287
306
  inputValue: list.filterText,
288
307
  onInputChange: (text) => list.setFilterText(text),
@@ -4,23 +4,22 @@ import { type Primitive } from './shared';
4
4
  import type { Prettify } from '../../utilities/types';
5
5
  type IconValue = string | JSX.Element | null;
6
6
  type SelectSize = 'small' | 'medium' | 'default' | 'large';
7
- type RawAsyncItem = Record<string, unknown>;
7
+ interface RawAsyncItem {
8
+ toString(): string;
9
+ }
10
+ type AsyncFetchedData = RawAsyncItem[] | {
11
+ jokes?: RawAsyncItem[];
12
+ };
8
13
  type AsyncSelectOption = {
9
14
  label: string;
10
15
  value: Primitive;
11
- metadata?: Record<string, unknown> | null;
12
- meta?: Record<string, unknown> | null;
16
+ metadata?: RawAsyncItem | null;
17
+ meta?: RawAsyncItem | null;
13
18
  subtitle?: string;
14
19
  icon?: IconValue;
15
20
  className?: string;
16
- [key: string]: unknown;
17
21
  };
18
- type GroupValueMapping = Record<string, {
19
- label?: ReactNode;
20
- icon?: IconValue;
21
- subtitle?: ReactNode;
22
- endIcon?: IconValue;
23
- }>;
22
+ type GroupValueMapping = object;
24
23
  type AsyncSelectProps = Omit<ReactAriaSelectProps<AsyncSelectOption>, 'children' | 'className' | 'isDisabled' | 'selectedKey' | 'onSelectionChange' | 'items' | 'placeholder' | 'value' | 'onChange'> & {
25
24
  /** Label of the component. */
26
25
  label?: ReactNode;
@@ -49,7 +48,7 @@ type AsyncSelectProps = Omit<ReactAriaSelectProps<AsyncSelectOption>, 'children'
49
48
  /** Function to get the value for the item from the fetched data. `(item) => string | number | boolean`. Defaults to reading `item.value`. */
50
49
  getValue?: (item: RawAsyncItem) => Primitive | undefined;
51
50
  /** Function to get the metadata for the item from the fetched data. `(item) => object` (optional). */
52
- getMeta?: (item: RawAsyncItem) => Record<string, unknown> | null | undefined;
51
+ getMeta?: (item: RawAsyncItem) => RawAsyncItem | null | undefined;
53
52
  /** Function to get the icon for the item from the fetched data. `(item) => JSX.Element | string`. */
54
53
  getIcon?: (item: RawAsyncItem | AsyncSelectOption) => IconValue;
55
54
  /** Function to get the subtitle for the item from the fetched data. `(item) => string`. */
@@ -57,13 +56,13 @@ type AsyncSelectProps = Omit<ReactAriaSelectProps<AsyncSelectOption>, 'children'
57
56
  /** Function to get the group name for the item from the fetched data. `(item) => string`. */
58
57
  getGroup?: (item: RawAsyncItem) => string | undefined;
59
58
  /** Function to pre-process the fetched data before it is used in the select. `(data) => data[]`. Defaults to a passthrough. */
60
- getData?: (data: unknown) => RawAsyncItem[];
59
+ getData?: (data: AsyncFetchedData) => RawAsyncItem[];
61
60
  /** Function to get the URL for fetching data. Provides typed search text if entered. `(searchText) => string`. */
62
61
  fetchUrl?: (searchText?: string) => string;
63
62
  /** Configuration object for the fetch request, passed to the `fetch` function. Defaults to `{}`. */
64
63
  fetchConfig?: RequestInit;
65
64
  /** Allows overriding the default fetch function. `(searchText, signal) => Promise`. */
66
- fetchFunction?: (searchText: string | undefined, signal: AbortSignal) => Promise<unknown>;
65
+ fetchFunction?: (searchText: string | undefined, signal: AbortSignal) => Promise<AsyncFetchedData>;
67
66
  /** Allows processing the options fetched from the source. `(options) => options[]`. Defaults to a passthrough. */
68
67
  processLoadedOptions?: (options: RawAsyncItem[]) => RawAsyncItem[];
69
68
  /** If provided, replaces the default item in the dropdown menu. `({ value, label, subtitle, metadata }) => JSX.Element`. */
@@ -1,17 +1,17 @@
1
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
2
- import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-BUU44AuW.js";
3
- import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-PzY6FI39.js";
4
- import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-UpU4cKPh.js";
5
- import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-_E2Z5G2l.js";
6
- import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-3XLIaepk.js";
7
- import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-e8jIFT3s.js";
8
- import { c as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, r as getGroupedOptions, s as $c8bb816105474884$export$e288731fd71264f0, t as OptionItemBase } from "../../shared-Ba_bt4s9.js";
9
- import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-DepY-52g.js";
10
- import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-q2Fj0L9K.js";
11
- import { t as $c73d3f3d5ec90946$export$bc3384a35de93d66 } from "../../useAsyncList-B3-uyJgA.js";
2
+ import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-CO9aIsTe.js";
3
+ import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-LQlZnc1u.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DO3oQfCq.js";
6
+ import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-Bdqjmtt2.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-CnTuCBMs.js";
8
+ import { c as isStringValue, d as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, o as isPrimitive, r as getGroupedOptions, t as OptionItemBase, u as $c8bb816105474884$export$e288731fd71264f0 } from "../../shared-DBCipn_m.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CBvtIFuB.js";
10
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-zY9JqR1c.js";
11
+ import { t as $c73d3f3d5ec90946$export$bc3384a35de93d66 } from "../../useAsyncList-CjKVLGN0.js";
12
12
  import { RichLabel } from "../rich-label/rich-label.js";
13
13
  import { BaseControl } from "../base-control/base-control.js";
14
- import { i as unescapeHTML } from "../../text-helpers-2j9DuxP1.js";
14
+ import { i as unescapeHTML } from "../../text-helpers-QrwKKaOh.js";
15
15
  import { t as __ } from "../../build-module-DG6ZK7Ty.js";
16
16
  import { Icon } from "../../icons/icon.js";
17
17
  import { Spinner } from "../../icons/spinner.js";
@@ -22,20 +22,32 @@ import { selectButtonClass, selectControlClass } from "./styles.js";
22
22
  import { cloneElement, useMemo, useRef } from "react";
23
23
  import { jsx, jsxs } from "react/jsx-runtime";
24
24
  //#region lib/components/select/async-select.tsx
25
+ var getRawItemValue = (item, key) => {
26
+ return Object.entries(item).find(([entryKey]) => entryKey === key)?.[1];
27
+ };
28
+ var setRawItemValue = (item, key, value) => {
29
+ Object.defineProperty(item, key, {
30
+ configurable: true,
31
+ enumerable: true,
32
+ value,
33
+ writable: true
34
+ });
35
+ };
36
+ var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
25
37
  var getPopoverStyle = (triggerElement) => ({ "--select-width": triggerElement ? `${triggerElement.offsetWidth}px` : "var(--trigger-width)" });
26
38
  var renderOptionIcon = (icon) => icon ? jsx(Icon, { icon }) : null;
27
39
  var getKeyFromSelection = (selected) => {
28
40
  if (!selected || selected === "all") return null;
29
41
  for (const key of selected) {
30
- if (typeof key === "string") return key;
31
- if (typeof key === "number") return String(key);
42
+ if (isStringValue(key)) return key;
43
+ if (isNumberValue(key)) return String(key);
32
44
  }
33
45
  return null;
34
46
  };
35
47
  var getKeyFromValue = (selected) => {
36
48
  if (selected === null || selected === void 0) return null;
37
- if (typeof selected === "string") return selected;
38
- if (typeof selected === "number") return String(selected);
49
+ if (isStringValue(selected)) return selected;
50
+ if (isNumberValue(selected)) return String(selected);
39
51
  return null;
40
52
  };
41
53
  /**
@@ -59,8 +71,14 @@ var getKeyFromValue = (selected) => {
59
71
  * />
60
72
  */
61
73
  var AsyncSelect = (props) => {
62
- const { label, help, icon, subtitle, actions, inline, value: rawValue, onChange, disabled = false, clearable = false, className, placeholder = __("Select...", "eightshift-ui-components"), customMenuOption, customValueDisplay, customDropdownArrow, processLoadedOptions = (options) => options, fetchUrl, fetchConfig = {}, fetchFunction, getLabel = (item) => typeof item.label === "string" ? item.label : void 0, getValue = (item) => typeof item.value === "string" || typeof item.value === "number" || typeof item.value === "boolean" ? item.value : void 0, getMeta, getIcon, getSubtitle, getGroup, getData = (data) => Array.isArray(data) ? data : [], extraItemProps, hidden, groupKey, groupValueMapping, flat, size = "default", noMinWidth = false, ...rest } = props;
63
- const value = rawValue && !Array.isArray(rawValue) && typeof rawValue === "object" ? rawValue : null;
74
+ const { label, help, icon, subtitle, actions, inline, value: rawValue, onChange, disabled = false, clearable = false, className, placeholder = __("Select...", "eightshift-ui-components"), customMenuOption, customValueDisplay, customDropdownArrow, processLoadedOptions = (options) => options, fetchUrl, fetchConfig = {}, fetchFunction, getLabel = (item) => {
75
+ const itemLabel = getRawItemValue(item, "label");
76
+ return isStringValue(itemLabel) ? itemLabel : void 0;
77
+ }, getValue = (item) => {
78
+ const itemValue = getRawItemValue(item, "value");
79
+ return isPrimitive(itemValue) ? itemValue : void 0;
80
+ }, getMeta, getIcon, getSubtitle, getGroup, getData = (data) => Array.isArray(data) ? data : data.jokes ?? [], extraItemProps, hidden, groupKey, groupValueMapping, flat, size = "default", noMinWidth = false, ...rest } = props;
81
+ const value = rawValue;
64
82
  const ref = useRef(null);
65
83
  const list = $c73d3f3d5ec90946$export$bc3384a35de93d66({
66
84
  initialSelectedKeys: value ? [getOptionKey(value.value)] : [],
@@ -88,9 +106,9 @@ var AsyncSelect = (props) => {
88
106
  }
89
107
  if (getSubtitle) entry.subtitle = (unescapeHTML(getSubtitle(item) ?? "") ?? "") || void 0;
90
108
  if (getIcon) entry.icon = getIcon(item);
91
- if (getGroup) entry[groupKey ?? "_group"] = getGroup(item);
109
+ if (getGroup) setRawItemValue(entry, groupKey ?? "_group", getGroup(item));
92
110
  if (extraItemProps?.length) extraItemProps.forEach((propName) => {
93
- entry[propName] = item[propName];
111
+ setRawItemValue(entry, propName, getRawItemValue(item, propName));
94
112
  });
95
113
  return entry;
96
114
  });
@@ -199,7 +217,7 @@ var AsyncSelect = (props) => {
199
217
  placement: "bottom left",
200
218
  maxHeight: 260,
201
219
  triggerRef: ref,
202
- style: getPopoverStyle(ref.current),
220
+ style: getPopoverStyle(null),
203
221
  children: jsxs($4b38b5b75ecc6208$export$2f2b9559550c7bbc, {
204
222
  inputValue: list.filterText,
205
223
  onInputChange: (text) => list.setFilterText(text),
@@ -7,18 +7,12 @@ type SelectSize = 'small' | 'medium' | 'default' | 'large';
7
7
  type SelectOption = {
8
8
  label: string;
9
9
  value: Primitive;
10
- metadata?: Record<string, unknown> | null;
10
+ metadata?: object | null;
11
11
  subtitle?: ReactNode;
12
12
  icon?: IconValue;
13
13
  className?: string;
14
- [key: string]: unknown;
15
14
  };
16
- type GroupValueMapping = Record<string, {
17
- label?: ReactNode;
18
- icon?: IconValue;
19
- subtitle?: ReactNode;
20
- endIcon?: IconValue;
21
- }>;
15
+ type GroupValueMapping = object;
22
16
  type MultiSelectValueType = SelectOption[] | Primitive[] | '' | null;
23
17
  type MultiSelectProps = Omit<ReactAriaSelectProps<SelectOption, 'multiple'>, 'children' | 'className' | 'isDisabled' | 'items' | 'placeholder' | 'selectionMode'> & {
24
18
  /** Icon of the component. */
@@ -1,14 +1,14 @@
1
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
2
- import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-BUU44AuW.js";
3
- import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-PzY6FI39.js";
4
- import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-UpU4cKPh.js";
5
- import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-_E2Z5G2l.js";
6
- import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-3XLIaepk.js";
7
- import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-e8jIFT3s.js";
8
- import { c as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, r as getGroupedOptions, s as $c8bb816105474884$export$e288731fd71264f0, t as OptionItemBase } from "../../shared-Ba_bt4s9.js";
9
- import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-DepY-52g.js";
10
- import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-CiCjo6Na.js";
11
- import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-q2Fj0L9K.js";
2
+ import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-CO9aIsTe.js";
3
+ import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-LQlZnc1u.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DO3oQfCq.js";
6
+ import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-Bdqjmtt2.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-CnTuCBMs.js";
8
+ import { c as isStringValue, d as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, r as getGroupedOptions, s as isSelectOption, t as OptionItemBase, u as $c8bb816105474884$export$e288731fd71264f0 } from "../../shared-DBCipn_m.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CBvtIFuB.js";
10
+ import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-BFaOw4yi.js";
11
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-zY9JqR1c.js";
12
12
  import { RichLabel } from "../rich-label/rich-label.js";
13
13
  import { BaseControl } from "../base-control/base-control.js";
14
14
  import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
@@ -28,25 +28,25 @@ import { jsx, jsxs } from "react/jsx-runtime";
28
28
  //#region lib/components/select/multi-select.tsx
29
29
  var TypedDraggableList = DraggableList;
30
30
  var getSearchableText = (content) => {
31
- if (typeof content === "string") return content;
31
+ if (isStringValue(content)) return content;
32
32
  return "";
33
33
  };
34
34
  var getPopoverStyle = (triggerElement) => ({ "--select-width": triggerElement ? `${triggerElement.offsetWidth}px` : "var(--trigger-width)" });
35
35
  var getSelectedKeys = (value) => {
36
36
  if (!Array.isArray(value)) return [];
37
- return value.map((item) => typeof item === "object" && item !== null ? getOptionKey(item.value) : getOptionKey(item));
37
+ return value.map((item) => isSelectOption(item) ? getOptionKey(item.value) : getOptionKey(item));
38
38
  };
39
39
  var getCurrentValue = (value, simpleValue, options) => {
40
40
  if (!Array.isArray(value)) return [];
41
- if (!simpleValue) return value.filter((item) => typeof item === "object" && item !== null);
41
+ if (!simpleValue) return value.filter((item) => isSelectOption(item));
42
42
  return value.map((item) => {
43
- const itemValue = typeof item === "object" && item !== null ? item.value : item;
43
+ const itemValue = isSelectOption(item) ? item.value : item;
44
44
  return options.find((option) => getOptionKey(option.value) === getOptionKey(itemValue));
45
45
  }).filter((item) => Boolean(item));
46
46
  };
47
47
  var getOptionIcon = (icon) => {
48
48
  if (!icon) return;
49
- return typeof icon === "string" ? jsx(Icon, { icon }) : icon;
49
+ return isStringValue(icon) ? jsx(Icon, { icon }) : icon;
50
50
  };
51
51
  /**
52
52
  * Multi-select menu.
@@ -113,7 +113,7 @@ var MultiSelect = (props) => {
113
113
  onChange(null);
114
114
  return;
115
115
  }
116
- const selectedKeys = selected.filter((item) => typeof item === "string");
116
+ const selectedKeys = selected.filter((item) => isStringValue(item));
117
117
  if (selectedKeys.length === 0) {
118
118
  onChange(simpleValue ? "" : []);
119
119
  return;
@@ -215,7 +215,7 @@ var MultiSelect = (props) => {
215
215
  className: "es:grid es:grid-cols-1 es:grid-rows-[auto_minmax(0,1fr)] es:p-0!",
216
216
  wrapperClassName: "es:w-(--select-width) es:min-w-72 es:px-1.5 es:h-fit es:from-surface-300/35 es:to-surface-300/35 es:overflow-clip es:rounded-20!",
217
217
  hidden: noReorder || disabled || currentValue.length < 2,
218
- style: getPopoverStyle(ref.current),
218
+ style: getPopoverStyle(null),
219
219
  children: [jsx("span", {
220
220
  className: "es:text-sm es:ml-3 es:mt-2 es:mb-1 es:font-variation-[\"wdth\"_100,\"wght\"_325,\"ROND\"_100] es:text-surface-600",
221
221
  children: __("Item order", "eightshift-ui-components")
@@ -232,7 +232,7 @@ var MultiSelect = (props) => {
232
232
  return jsx(DraggableListItem, {
233
233
  icon: getOptionIcon(realItem?.icon),
234
234
  label: realItem?.label,
235
- subtitle: typeof realItem?.subtitle === "string" ? realItem.subtitle : void 0,
235
+ subtitle: isStringValue(realItem?.subtitle) ? realItem.subtitle : void 0,
236
236
  iconClassName: "es:pointer-events-none es:select-none",
237
237
  labelClassName: "es:line-clamp-1",
238
238
  subtitleClassName: "es:line-clamp-1",
@@ -247,7 +247,7 @@ var MultiSelect = (props) => {
247
247
  placement: "bottom left",
248
248
  maxHeight: 260,
249
249
  triggerRef: ref,
250
- style: getPopoverStyle(ref.current),
250
+ style: getPopoverStyle(null),
251
251
  children: searchable ? jsxs($4b38b5b75ecc6208$export$2f2b9559550c7bbc, {
252
252
  filter: () => true,
253
253
  inputValue: searchTerm,
@@ -2,19 +2,15 @@ import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
2
  import { ListBoxItem } from 'react-aria-components';
3
3
  import type { Prettify } from '../../utilities/types';
4
4
  export type Primitive = string | number | boolean;
5
+ export declare const isPrimitive: <T>(value: T) => value is T & Primitive;
6
+ export declare const isStringValue: <T>(value: T) => value is T & string;
5
7
  export declare const getOptionKey: (value: Primitive) => string;
6
- type IconValue = string | JSX.Element | null;
7
8
  type SelectOption<Value extends Primitive = string> = {
8
9
  label: string;
9
10
  value: Value;
10
- [key: string]: unknown;
11
11
  };
12
- type GroupValueMapping = Record<string, {
13
- label?: ReactNode;
14
- icon?: IconValue;
15
- subtitle?: ReactNode;
16
- endIcon?: IconValue;
17
- }>;
12
+ export declare const isSelectOption: <T>(value: T) => value is T & SelectOption<Primitive>;
13
+ type GroupValueMapping = object;
18
14
  type GroupedOption<Option extends SelectOption<Primitive> = SelectOption> = {
19
15
  key: string;
20
16
  label: ReactNode;
@@ -68,5 +64,5 @@ export declare const SelectClearButton: ({ multi }: Prettify<SelectClearButtonPr
68
64
  *
69
65
  * @returns {GroupedOption[] | null} Grouped options.
70
66
  */
71
- export declare const getGroupedOptions: <Option extends SelectOption<Primitive>>(filteredOptions?: Option[] | null, groupKey?: string, groupValueMapping?: GroupValueMapping) => GroupedOption<Option>[] | null;
67
+ export declare const getGroupedOptions: <Option extends SelectOption<Primitive>, Mapping extends object = GroupValueMapping>(filteredOptions?: Option[] | null, groupKey?: string, groupValueMapping?: Mapping) => GroupedOption<Option>[] | null;
72
68
  export {};
@@ -1,2 +1,2 @@
1
- import { a as getValue, i as getOptionKey, n as SelectClearButton, o as moveArrayItem, r as getGroupedOptions, t as OptionItemBase } from "../../shared-Ba_bt4s9.js";
2
- export { OptionItemBase, SelectClearButton, getGroupedOptions, getOptionKey, getValue, moveArrayItem };
1
+ import { a as getValue, c as isStringValue, i as getOptionKey, l as moveArrayItem, n as SelectClearButton, o as isPrimitive, r as getGroupedOptions, s as isSelectOption, t as OptionItemBase } from "../../shared-DBCipn_m.js";
2
+ export { OptionItemBase, SelectClearButton, getGroupedOptions, getOptionKey, getValue, isPrimitive, isSelectOption, isStringValue, moveArrayItem };
@@ -7,18 +7,12 @@ type SelectSize = 'small' | 'medium' | 'default' | 'large';
7
7
  type SelectOption = {
8
8
  label: string;
9
9
  value: Primitive;
10
- metadata?: Record<string, unknown> | null;
10
+ metadata?: object | null;
11
11
  subtitle?: ReactNode;
12
12
  icon?: IconValue;
13
13
  className?: string;
14
- [key: string]: unknown;
15
14
  };
16
- type GroupValueMapping = Record<string, {
17
- label?: ReactNode;
18
- icon?: IconValue;
19
- subtitle?: ReactNode;
20
- endIcon?: IconValue;
21
- }>;
15
+ type GroupValueMapping = object;
22
16
  type SelectValueType = SelectOption | Primitive | null;
23
17
  type SelectProps = Omit<ReactAriaSelectProps<SelectOption>, 'children' | 'className' | 'isDisabled' | 'selectedKey' | 'onSelectionChange' | 'items' | 'placeholder'> & {
24
18
  /** Icon of the component. */
@@ -1,14 +1,14 @@
1
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
2
- import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-BUU44AuW.js";
3
- import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-PzY6FI39.js";
4
- import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-UpU4cKPh.js";
5
- import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-_E2Z5G2l.js";
6
- import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-3XLIaepk.js";
7
- import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-e8jIFT3s.js";
8
- import { c as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, r as getGroupedOptions, s as $c8bb816105474884$export$e288731fd71264f0, t as OptionItemBase } from "../../shared-Ba_bt4s9.js";
9
- import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-DepY-52g.js";
10
- import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-CiCjo6Na.js";
11
- import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-q2Fj0L9K.js";
2
+ import { t as $4b38b5b75ecc6208$export$2f2b9559550c7bbc } from "../../Autocomplete-CO9aIsTe.js";
3
+ import { v as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-LQlZnc1u.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DO3oQfCq.js";
6
+ import { u as $542a13ca2fa5b484$export$5b6b19405a83ff9d, w as $53e61d82d8b8611d$export$8b251419efc915eb } from "../../Dialog-Bdqjmtt2.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-CnTuCBMs.js";
8
+ import { c as isStringValue, d as $c8bb816105474884$export$ef9b1a59e592288f, i as getOptionKey, n as SelectClearButton, o as isPrimitive, r as getGroupedOptions, t as OptionItemBase, u as $c8bb816105474884$export$e288731fd71264f0 } from "../../shared-DBCipn_m.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CBvtIFuB.js";
10
+ import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-BFaOw4yi.js";
11
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-zY9JqR1c.js";
12
12
  import { RichLabel } from "../rich-label/rich-label.js";
13
13
  import { BaseControl } from "../base-control/base-control.js";
14
14
  import { t as __ } from "../../build-module-DG6ZK7Ty.js";
@@ -21,13 +21,13 @@ import { cloneElement, useMemo, useRef, useState } from "react";
21
21
  import { jsx, jsxs } from "react/jsx-runtime";
22
22
  //#region lib/components/select/single-select.tsx
23
23
  var getSelectedKey = (value, simpleValue) => {
24
- if (simpleValue) return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? getOptionKey(value) : null;
25
- if (!value || typeof value !== "object") return null;
24
+ if (simpleValue) return isPrimitive(value) ? getOptionKey(value) : null;
25
+ if (!value || !(value instanceof Object)) return null;
26
26
  const selectedValue = value.value;
27
- return typeof selectedValue === "string" || typeof selectedValue === "number" || typeof selectedValue === "boolean" ? getOptionKey(selectedValue) : null;
27
+ return isPrimitive(selectedValue) ? getOptionKey(selectedValue) : null;
28
28
  };
29
29
  var getSearchableText = (content) => {
30
- if (typeof content === "string") return content;
30
+ if (isStringValue(content)) return content;
31
31
  return "";
32
32
  };
33
33
  var getPopoverStyle = (triggerElement) => ({ "--select-width": triggerElement ? `${triggerElement.offsetWidth}px` : "var(--trigger-width)" });
@@ -102,7 +102,7 @@ var Select = (props) => {
102
102
  onChange(null);
103
103
  return;
104
104
  }
105
- if (typeof selected !== "string") {
105
+ if (!isStringValue(selected)) {
106
106
  onChange(null);
107
107
  return;
108
108
  }
@@ -175,7 +175,7 @@ var Select = (props) => {
175
175
  placement: "bottom left",
176
176
  maxHeight: 260,
177
177
  triggerRef: ref,
178
- style: getPopoverStyle(ref.current),
178
+ style: getPopoverStyle(null),
179
179
  children: searchable ? jsxs($4b38b5b75ecc6208$export$2f2b9559550c7bbc, {
180
180
  filter: () => true,
181
181
  inputValue: searchTerm,
@@ -1,20 +1,21 @@
1
- import { n as AnimatePresence, t as motion } from "../../react-y40Dt3ab.js";
2
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
3
- import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-UpU4cKPh.js";
4
- import { i as $806e559d0c2c64a0$export$472062a354075cee, o as $806e559d0c2c64a0$export$a590f758a961cb5b, r as $806e559d0c2c64a0$export$2c1b491743890dec, t as $806e559d0c2c64a0$export$105594979f116971 } from "../../Slider-B8icnyOo.js";
2
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
3
+ import { i as $806e559d0c2c64a0$export$472062a354075cee, o as $806e559d0c2c64a0$export$a590f758a961cb5b, r as $806e559d0c2c64a0$export$2c1b491743890dec, t as $806e559d0c2c64a0$export$105594979f116971 } from "../../Slider-BXc72kE0.js";
5
4
  import { BaseControl } from "../base-control/base-control.js";
6
5
  import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
7
6
  import { t as __ } from "../../build-module-DG6ZK7Ty.js";
8
7
  import { chevronLeft } from "../../icons/ui-icons/chevron-left.js";
9
8
  import { chevronRight } from "../../icons/ui-icons/chevron-right.js";
9
+ import { n as AnimatePresence, t as motion } from "../../react-C6Y6cCOx.js";
10
10
  import { getColumnConfigOutputText } from "./utils.js";
11
11
  import "react";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region lib/components/slider/column-config-slider.tsx
14
+ var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
14
15
  var getColumnConfigValue = (value) => {
15
16
  if (!Array.isArray(value) || value.length !== 2) return null;
16
17
  const [startValue, endValue] = value;
17
- if (typeof startValue !== "number" || typeof endValue !== "number") return null;
18
+ if (!isNumberValue(startValue) || !isNumberValue(endValue)) return null;
18
19
  return [startValue, endValue];
19
20
  };
20
21
  /**
@@ -166,7 +167,8 @@ var ColumnConfigSliderOutput = ({ showOuterAsGutter }) => jsx($806e559d0c2c64a0$
166
167
  children: ({ state }) => {
167
168
  const columns = state.getThumbMaxValue(1);
168
169
  const offset = parseInt(state.getThumbValueLabel(0), 10);
169
- return getColumnConfigOutputText(columns, offset, parseInt(state.getThumbValueLabel(1), 10) - offset + 1, showOuterAsGutter);
170
+ const width = parseInt(state.getThumbValueLabel(1), 10) - offset + 1;
171
+ return getColumnConfigOutputText(columns, offset, width, showOuterAsGutter);
170
172
  }
171
173
  });
172
174
  //#endregion