@eightshift/ui-components 8.1.0 → 8.3.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 (170) hide show
  1. package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-Dqkum3dO.js} +29 -25
  2. package/dist/{Button-_E2Z5G2l.js → Button-DHgs_rCq.js} +15 -9
  3. package/dist/{Dialog-3XLIaepk.js → Dialog-CldDJ_4u.js} +390 -189
  4. package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BHNgL5Is.js} +33 -29
  5. package/dist/{FocusScope-BKGWN6UK.js → FocusScope-CUuL5wjz.js} +13 -8
  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-CZXso3mJ.js} +14 -38
  10. package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
  11. package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-BTByPMrl.js} +35 -35
  12. package/dist/{SearchField-q2Fj0L9K.js → SearchField-DkX1vqMN.js} +29 -26
  13. package/dist/{Slider-B8icnyOo.js → Slider-Dw-JjfLx.js} +55 -44
  14. package/dist/{Text-D4y19vs8.js → Text-CA2_mHEB.js} +4 -3
  15. package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-ZZwHZDro.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/assets/wp-overrides/make-block-messages-nicer.css +1 -1
  22. package/dist/{build-module-DG6ZK7Ty.js → build-module-BISCoQjQ.js} +4 -4
  23. package/dist/{button-XSk_8UW7.js → button-ldR_tlvk.js} +64 -13
  24. package/dist/{checkbox-BYaS9tQ5.js → checkbox-DDyLJRY8.js} +8 -8
  25. package/dist/{color-swatch-6ZEIXej3.js → color-swatch-DmhdOhe4.js} +15 -16
  26. package/dist/components/animated-visibility/animated-visibility.js +5 -3
  27. package/dist/components/base-control/base-control.d.ts +1 -1
  28. package/dist/components/base-control/base-control.js +1 -1
  29. package/dist/components/base-control/container.d.ts +4 -30
  30. package/dist/components/base-control/container.js +5 -32
  31. package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
  32. package/dist/components/button/button.d.ts +1 -1
  33. package/dist/components/button/button.js +1 -1
  34. package/dist/components/checkbox/checkbox.js +1 -1
  35. package/dist/components/color-pickers/color-picker.js +8 -8
  36. package/dist/components/color-pickers/color-swatch.js +1 -1
  37. package/dist/components/color-pickers/gradient-editor.js +1 -1
  38. package/dist/components/color-pickers/solid-color-picker.js +1 -1
  39. package/dist/components/component-toggle/component-toggle.d.ts +1 -1
  40. package/dist/components/component-toggle/component-toggle.js +4 -4
  41. package/dist/components/container-panel/container-panel.js +11 -11
  42. package/dist/components/contextual-help/contextual-help.js +3 -3
  43. package/dist/components/draggable/draggable.d.ts +3 -3
  44. package/dist/components/draggable/draggable.js +1 -1
  45. package/dist/components/draggable-list/draggable-list.d.ts +3 -3
  46. package/dist/components/draggable-list/draggable-list.js +9 -9
  47. package/dist/components/expandable/expandable.js +4 -4
  48. package/dist/components/index.d.ts +1 -0
  49. package/dist/components/index.js +18 -17
  50. package/dist/components/input-field/input-field.d.ts +1 -1
  51. package/dist/components/input-field/input-field.js +1 -1
  52. package/dist/components/item-collection/item-collection.d.ts +3 -28
  53. package/dist/components/item-collection/item-collection.js +7 -7
  54. package/dist/components/link-input/link-input.d.ts +0 -2
  55. package/dist/components/link-input/link-input.js +1 -1
  56. package/dist/components/matrix-align/matrix-align.js +5 -4
  57. package/dist/components/menu/menu.d.ts +8 -29
  58. package/dist/components/menu/menu.js +11 -8
  59. package/dist/components/modal/modal.js +1 -1
  60. package/dist/components/notice/notice.js +8 -8
  61. package/dist/components/number-picker/number-picker.d.ts +1 -1
  62. package/dist/components/number-picker/number-picker.js +1 -1
  63. package/dist/components/option-select/option-select.d.ts +1 -1
  64. package/dist/components/option-select/option-select.js +22 -16
  65. package/dist/components/options-panel/options-panel.js +4 -4
  66. package/dist/components/placeholders/file-picker-shell.js +4 -3
  67. package/dist/components/placeholders/file-placeholder.js +3 -2
  68. package/dist/components/popover/popover.js +5 -5
  69. package/dist/components/portal-provider/portal-provider.js +2 -1
  70. package/dist/components/prompt-popover/prompt-popover.d.ts +56 -0
  71. package/dist/components/prompt-popover/prompt-popover.js +81 -0
  72. package/dist/components/radio/radio.d.ts +2 -1
  73. package/dist/components/radio/radio.js +2 -2
  74. package/dist/components/repeater/repeater-context.d.ts +0 -1
  75. package/dist/components/repeater/repeater-item.js +2 -2
  76. package/dist/components/repeater/repeater.d.ts +5 -38
  77. package/dist/components/repeater/repeater.js +8 -11
  78. package/dist/components/responsive/mini-responsive.d.ts +0 -1
  79. package/dist/components/responsive/mini-responsive.js +31 -31
  80. package/dist/components/responsive/responsive-legacy.d.ts +0 -1
  81. package/dist/components/responsive/responsive-legacy.js +13 -11
  82. package/dist/components/responsive/responsive.d.ts +0 -1
  83. package/dist/components/responsive/responsive.js +29 -29
  84. package/dist/components/responsive-preview/responsive-preview.js +4 -4
  85. package/dist/components/rich-label/rich-label.d.ts +1 -1
  86. package/dist/components/rich-label/rich-label.js +2 -2
  87. package/dist/components/select/async-multi-select.d.ts +12 -13
  88. package/dist/components/select/async-multi-select.js +40 -21
  89. package/dist/components/select/async-select.d.ts +12 -13
  90. package/dist/components/select/async-select.js +39 -21
  91. package/dist/components/select/multi-select.d.ts +2 -8
  92. package/dist/components/select/multi-select.js +20 -20
  93. package/dist/components/select/shared.d.ts +7 -11
  94. package/dist/components/select/shared.js +2 -2
  95. package/dist/components/select/single-select.d.ts +2 -8
  96. package/dist/components/select/single-select.js +17 -17
  97. package/dist/components/select/styles.d.ts +2 -2
  98. package/dist/components/slider/column-config-slider.js +8 -6
  99. package/dist/components/slider/slider.js +16 -12
  100. package/dist/components/slider/utils.js +1 -1
  101. package/dist/components/smart-image/smart-image.d.ts +1 -2
  102. package/dist/components/smart-image/smart-image.js +53 -51
  103. package/dist/components/tabs/tabs.d.ts +16 -64
  104. package/dist/components/tabs/tabs.js +1 -1
  105. package/dist/components/toggle/switch.d.ts +1 -1
  106. package/dist/components/toggle/switch.js +1 -1
  107. package/dist/components/toggle/toggle.js +2 -2
  108. package/dist/components/toggle-button/toggle-button.d.ts +2 -2
  109. package/dist/components/toggle-button/toggle-button.js +1 -1
  110. package/dist/components/tooltip/tooltip.js +1 -1
  111. package/dist/{draggable-9MfdTVWP.js → draggable-oS68xcYX.js} +130 -125
  112. package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
  113. package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-DP8ioFX1.js} +39 -30
  114. package/dist/icons/block-icon.js +1 -1
  115. package/dist/icons/icon.d.ts +3 -3
  116. package/dist/icons/icon.js +21 -9
  117. package/dist/icons/icons.d.ts +210 -1
  118. package/dist/icons/index.js +1 -1
  119. package/dist/icons/jsx-svg.d.ts +5 -4
  120. package/dist/icons/jsx-svg.js +1 -1
  121. package/dist/index.js +18 -17
  122. package/dist/{input-field-nN6BO0oz.js → input-field-C-XvZeCZ.js} +8 -8
  123. package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
  124. package/dist/{keyboard-g5Amam-c.js → keyboard-Cdqi5ZQQ.js} +1 -1
  125. package/dist/{link-input-BhlPElU8.js → link-input-DdwuqoMg.js} +147 -89
  126. package/dist/{modal-B5axB0Fc.js → modal-DZco5MDu.js} +15 -14
  127. package/dist/{number-picker-nnOf0XnN.js → number-picker-XqKW0BNi.js} +9 -9
  128. package/dist/{react-y40Dt3ab.js → react-O71mlJXS.js} +250 -266
  129. package/dist/{shared-Ba_bt4s9.js → shared-YXMIX2ka.js} +60 -44
  130. package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-D5LEdmDM.js} +78 -58
  131. package/dist/{switch-BJ4_OyUm.js → switch-Bo6nmed_.js} +8 -8
  132. package/dist/{tabs-wAe0AAyu.js → tabs-DE-qb7Kt.js} +35 -30
  133. package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
  134. package/dist/{textSelection-B_Nv6Jz3.js → textSelection-C17LWYmO.js} +3 -3
  135. package/dist/{toggle-button-BLJdEp8V.js → toggle-button-Cb4yCEua.js} +39 -8
  136. package/dist/{tooltip-BW9nj5-V.js → tooltip-CT-vzIdz.js} +68 -62
  137. package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
  138. package/dist/{useButton-CPMVLXoX.js → useButton-V65TBDGM.js} +3 -3
  139. package/dist/{useCollection-PzY6FI39.js → useCollection-DqUS7tjk.js} +281 -184
  140. package/dist/useEvent-C9zwSNzZ.js +18 -0
  141. package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
  142. package/dist/{useFilter-CiCjo6Na.js → useFilter-C75IzdIZ.js} +1 -1
  143. package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-JidySWlU.js} +1 -1
  144. package/dist/{useFormReset-U6c35PHq.js → useFormReset-Sp8-miDa.js} +1 -1
  145. package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-CpmQEh8J.js} +2 -2
  146. package/dist/{useHover-CNsbAR0V.js → useHover-CaY3sRjL.js} +250 -46
  147. package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
  148. package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
  149. package/dist/{useListState-FLxa7R_U.js → useListState-CzB3v6M9.js} +6 -11
  150. package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
  151. package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-DC3XY3DQ.js} +79 -62
  152. package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
  153. package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-BKmSTK_5.js} +16 -11
  154. package/dist/{usePress-DRoujMNm.js → usePress-CUCWcP-m.js} +50 -28
  155. package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
  156. package/dist/{useTextField-e8jIFT3s.js → useTextField-C3QIkMON.js} +6 -6
  157. package/dist/{useToggle-CR_ZKvr_.js → useToggle-bbGRUbo4.js} +6 -6
  158. package/dist/{useToggleState-ButQxGrJ.js → useToggleState-D_rLMrVW.js} +1 -1
  159. package/dist/utilities/array-helpers.d.ts +2 -2
  160. package/dist/utilities/array-helpers.js +4 -3
  161. package/dist/utilities/debounce-throttle.d.ts +9 -2
  162. package/dist/utilities/es-dash.d.ts +11 -8
  163. package/dist/utilities/es-dash.js +1 -1
  164. package/dist/utilities/index.js +2 -2
  165. package/dist/utilities/text-helpers.js +1 -1
  166. package/dist/utilities/web-workers.d.ts +7 -7
  167. package/dist/utilities/web-workers.js +5 -5
  168. package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
  169. package/package.json +23 -27
  170. package/dist/useEvent-CzuFZ2HT.js +0 -22
@@ -1,18 +1,18 @@
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-Dqkum3dO.js";
3
+ import { y as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-DqUS7tjk.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DHgs_rCq.js";
6
+ import { T as $53e61d82d8b8611d$export$8b251419efc915eb, u as $542a13ca2fa5b484$export$5b6b19405a83ff9d } from "../../Dialog-CldDJ_4u.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-C3QIkMON.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-YXMIX2ka.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CZXso3mJ.js";
10
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-DkX1vqMN.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";
15
- import { t as __ } from "../../build-module-DG6ZK7Ty.js";
14
+ import { i as unescapeHTML } from "../../text-helpers-QrwKKaOh.js";
15
+ import { t as __ } from "../../build-module-BISCoQjQ.js";
16
16
  import { Icon } from "../../icons/icon.js";
17
17
  import { Spinner } from "../../icons/spinner.js";
18
18
  import { clearAlt } from "../../icons/ui-icons/clear-alt.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,18 +1,18 @@
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-Dqkum3dO.js";
3
+ import { y as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-DqUS7tjk.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DHgs_rCq.js";
6
+ import { T as $53e61d82d8b8611d$export$8b251419efc915eb, u as $542a13ca2fa5b484$export$5b6b19405a83ff9d } from "../../Dialog-CldDJ_4u.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-C3QIkMON.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-YXMIX2ka.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CZXso3mJ.js";
10
+ import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-C75IzdIZ.js";
11
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-DkX1vqMN.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";
15
- import { n as _n, t as __ } from "../../build-module-DG6ZK7Ty.js";
15
+ import { n as _n, t as __ } from "../../build-module-BISCoQjQ.js";
16
16
  import { Icon } from "../../icons/icon.js";
17
17
  import { clearAlt } from "../../icons/ui-icons/clear-alt.js";
18
18
  import { dropdownCaret } from "../../icons/ui-icons/dropdown-caret.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;
@@ -46,7 +42,7 @@ export declare const OptionItemBase: (props: Prettify<OptionItemBaseProps>) => i
46
42
  *
47
43
  * @returns {SelectOption[] | SelectOption | Primitive[] | Primitive | undefined} Appropriate output for the given input combination.
48
44
  */
49
- export declare const getValue: (simpleValue: boolean, value: SelectOption<Primitive>[] | SelectOption<Primitive> | Primitive[] | Primitive, options?: SelectOption<Primitive>[]) => Primitive | SelectOption<Primitive> | Primitive[] | (SelectOption<Primitive> | undefined)[] | undefined;
45
+ export declare const getValue: (simpleValue: boolean, value: SelectOption<Primitive>[] | SelectOption<Primitive> | Primitive[] | Primitive, options?: SelectOption<Primitive>[]) => Primitive[] | (SelectOption<Primitive> | undefined)[] | SelectOption<Primitive> | Primitive | undefined;
50
46
  /**
51
47
  * Moves an array item before or after another item in the array.
52
48
  *
@@ -57,7 +53,7 @@ export declare const getValue: (simpleValue: boolean, value: SelectOption<Primit
57
53
  * @param {'before' | 'after'} [position='before'] - Where to place the moved item.
58
54
  * @returns {Item[]} New array with the item moved.
59
55
  */
60
- export declare const moveArrayItem: <Item>(array: Item[], itemToMove: Item, targetItem: Item, position?: "before" | "after") => Item[];
56
+ export declare const moveArrayItem: <Item>(array: Item[], itemToMove: Item, targetItem: Item, position?: 'before' | 'after') => Item[];
61
57
  export declare const SelectClearButton: ({ multi }: Prettify<SelectClearButtonProps>) => import("react").JSX.Element;
62
58
  /**
63
59
  * Groups options by a key.
@@ -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-YXMIX2ka.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,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 $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-Dqkum3dO.js";
3
+ import { y as $42ceafc619f9c3ba$export$fb8073518f34e6ec } from "../../useCollection-DqUS7tjk.js";
4
+ import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
5
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "../../Button-DHgs_rCq.js";
6
+ import { T as $53e61d82d8b8611d$export$8b251419efc915eb, u as $542a13ca2fa5b484$export$5b6b19405a83ff9d } from "../../Dialog-CldDJ_4u.js";
7
+ import { r as $41fb335299a4a39e$export$f5b8910cec6cf069 } from "../../useTextField-C3QIkMON.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-YXMIX2ka.js";
9
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../../ListBox-CZXso3mJ.js";
10
+ import { t as $ef182bb9912241d8$export$3274cf84b703fff } from "../../useFilter-C75IzdIZ.js";
11
+ import { t as $29a5029ff43c9612$export$b94867ecbd698f21 } from "../../SearchField-DkX1vqMN.js";
12
12
  import { RichLabel } from "../rich-label/rich-label.js";
13
13
  import { BaseControl } from "../base-control/base-control.js";
14
- import { t as __ } from "../../build-module-DG6ZK7Ty.js";
14
+ import { t as __ } from "../../build-module-BISCoQjQ.js";
15
15
  import { Icon } from "../../icons/icon.js";
16
16
  import { clearAlt } from "../../icons/ui-icons/clear-alt.js";
17
17
  import { dropdownCaret } from "../../icons/ui-icons/dropdown-caret.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,5 +1,5 @@
1
1
  export declare const selectButtonClass: (props?: ({
2
- size?: "small" | "default" | "large" | "medium" | null | undefined;
2
+ size?: "default" | "large" | "medium" | "small" | null | undefined;
3
3
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
4
4
  export declare const selectControlClass: (props?: ({
5
5
  disabled?: boolean | null | undefined;
@@ -8,5 +8,5 @@ export declare const selectControlClass: (props?: ({
8
8
  inline?: boolean | null | undefined;
9
9
  flat?: boolean | null | undefined;
10
10
  readOnly?: boolean | null | undefined;
11
- size?: "small" | "default" | "large" | "medium" | null | undefined;
11
+ size?: "default" | "large" | "medium" | "small" | null | undefined;
12
12
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -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-Dw-JjfLx.js";
5
4
  import { BaseControl } from "../base-control/base-control.js";
6
5
  import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
7
- import { t as __ } from "../../build-module-DG6ZK7Ty.js";
6
+ import { t as __ } from "../../build-module-BISCoQjQ.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-O71mlJXS.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
@@ -1,15 +1,18 @@
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";
5
- import { t as NumberPicker } from "../../number-picker-nnOf0XnN.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-Dw-JjfLx.js";
4
+ import { t as NumberPicker } from "../../number-picker-XqKW0BNi.js";
6
5
  import { BaseControl } from "../base-control/base-control.js";
7
- import { t as __ } from "../../build-module-DG6ZK7Ty.js";
6
+ import { t as __ } from "../../build-module-BISCoQjQ.js";
8
7
  import { HStack } from "../layout/hstack.js";
8
+ import { n as AnimatePresence, t as motion } from "../../react-O71mlJXS.js";
9
9
  import { generateGridTemplate, generateMarkers } from "./utils.js";
10
10
  import { useState } from "react";
11
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
  //#region lib/components/slider/slider.tsx
13
+ var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
14
+ var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
15
+ var isMarkerMap = (markers) => markers !== true && markers !== "dots" && markers !== "lines";
13
16
  /**
14
17
  * A single/multi-thumb slider component.
15
18
  *
@@ -32,13 +35,13 @@ var Slider = (props) => {
32
35
  let startPoint = rawStartPoint ?? null;
33
36
  if (Array.isArray(value) && rawStartPoint) startPoint = null;
34
37
  let generatedMarkers = {};
35
- if (markers && typeof markers === "object" && Object.keys(markers).length > 0) generatedMarkers = markers;
38
+ if (markers && isMarkerMap(markers) && Object.keys(markers).length > 0) generatedMarkers = markers;
36
39
  if (markers === true || markers === "dots") generatedMarkers = generateMarkers(min, max, markerStep);
37
40
  const markerEntries = Object.entries(generatedMarkers);
38
41
  markerEntries.sort((firstEntry, secondEntry) => parseFloat(firstEntry[0]) - parseFloat(secondEntry[0]));
39
42
  const markerData = vertical ? [...markerEntries].reverse() : markerEntries;
40
43
  const isRange = Array.isArray(value);
41
- const singleValue = typeof value === "number" ? value : value[0] ?? min;
44
+ const singleValue = isNumberValue(value) ? value : value[0] ?? min;
42
45
  return jsx($806e559d0c2c64a0$export$472062a354075cee, {
43
46
  value,
44
47
  onChange,
@@ -62,7 +65,7 @@ var Slider = (props) => {
62
65
  children: ({ state }) => state.values.map((_, index) => state.getThumbValueLabel(index)).join(" – ")
63
66
  }) : null,
64
67
  inputField && !isRange ? jsx(NumberPicker, {
65
- "aria-label": typeof label === "string" ? label : __("Slider value", "eightshift-ui-components"),
68
+ "aria-label": isStringValue(label) ? label : __("Slider value", "eightshift-ui-components"),
66
69
  value: singleValue,
67
70
  onChange: (nextValue) => onChange(nextValue),
68
71
  min,
@@ -80,7 +83,7 @@ var Slider = (props) => {
80
83
  jsx($806e559d0c2c64a0$export$105594979f116971, {
81
84
  className: clsx("es:isolate", vertical && "es:mx-auto es:h-48", !vertical && "es:grow"),
82
85
  children: ({ state }) => {
83
- const stateValues = state.values.filter((entry) => typeof entry === "number");
86
+ const stateValues = state.values.filter(isNumberValue);
84
87
  const firstStateValue = stateValues[0] ?? min;
85
88
  const lastStateValue = stateValues.at(-1) ?? firstStateValue;
86
89
  let gridTemplate = generateGridTemplate(stateValues.map((_, index) => Math.round(state.getThumbPercent(index) * 100)), startPoint, { spaceBetween: 3 });
@@ -114,9 +117,10 @@ var Slider = (props) => {
114
117
  const dotValue = parseFloat(rawDotValue);
115
118
  let isWithinActiveBar = false;
116
119
  if (isRange) isWithinActiveBar = dotValue > firstStateValue && dotValue < lastStateValue;
117
- else if (startPoint !== null) if (firstStateValue < startPoint) isWithinActiveBar = dotValue > firstStateValue && dotValue <= startPoint;
118
- else isWithinActiveBar = dotValue >= startPoint && dotValue < firstStateValue;
119
- else isWithinActiveBar = dotValue < firstStateValue;
120
+ else if (startPoint !== null) {
121
+ if (firstStateValue < startPoint) isWithinActiveBar = dotValue > firstStateValue && dotValue <= startPoint;
122
+ else isWithinActiveBar = dotValue >= startPoint && dotValue < firstStateValue;
123
+ } else isWithinActiveBar = dotValue < firstStateValue;
120
124
  return jsx("div", {
121
125
  className: clsx("es:relative", "es:size-0.75 es:place-self-center es:rounded-2xl", !disabled && isWithinActiveBar && "es:bg-accent-50", !disabled && !isWithinActiveBar && "es:bg-surface-500", disabled && isWithinActiveBar && "es:bg-secondary-300", disabled && !isWithinActiveBar && "es:bg-secondary-400", stateValues.includes(dotValue) && "es:opacity-0"),
122
126
  children: jsx("span", {
@@ -1,5 +1,5 @@
1
1
  import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
2
- import { n as _n, t as __ } from "../../build-module-DG6ZK7Ty.js";
2
+ import { n as _n, t as __ } from "../../build-module-BISCoQjQ.js";
3
3
  //#region lib/components/slider/utils.ts
4
4
  /**
5
5
  * Generates an array of markers based on the provided minimum and maximum values and step.
@@ -3,7 +3,6 @@ import type { Prettify } from '../../utilities/types';
3
3
  type AnalysisSource = 'worker' | 'cache' | 'analysisData';
4
4
  type ImageAnalysisSettings = {
5
5
  numColors?: number;
6
- [key: string]: unknown;
7
6
  };
8
7
  type SmartImageColor = {
9
8
  color: string;
@@ -97,5 +96,5 @@ type SmartImageProps = SmartImageImageProps & {
97
96
  * )}
98
97
  * </SmartImage>
99
98
  */
100
- declare const SmartImage: (props: Prettify<SmartImageProps>) => string | number | boolean | Iterable<ReactNode> | import("react").JSX.Element | null | undefined;
99
+ declare const SmartImage: (props: Prettify<SmartImageProps>) => string | number | boolean | import("react").JSX.Element | Iterable<ReactNode> | null | undefined;
101
100
  export { SmartImage, SmartImage as __SmartImage };