@eightshift/ui-components 5.1.4 → 5.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 (114) hide show
  1. package/dist/{Button-DH22t_SM.js → Button-RTwMSBs-.js} +20 -26
  2. package/dist/{Collection-BRJOMbOa.js → Collection-D_KhdLDC.js} +40 -23
  3. package/dist/{Color-CNqKeT8D.js → Color-WxFE7lQB.js} +2 -2
  4. package/dist/{ColorSwatch-Dt3lRApA.js → ColorSwatch-xVS3rMYS.js} +9 -7
  5. package/dist/{Dialog-D6EdDPeu.js → Dialog-Xf6AsnV-.js} +86 -62
  6. package/dist/{FieldError-DHrSdE_Q.js → FieldError-B8BgFmIQ.js} +2 -2
  7. package/dist/{FocusScope-BEPI2m7u.js → FocusScope-BnwM-e8R.js} +24 -22
  8. package/dist/{Form-Bnyyv3Im.js → Form-BeMxJA29.js} +13 -3
  9. package/dist/{Input-DfSBLhDx.js → Group-C4cXobNT.js} +56 -11
  10. package/dist/{Heading-ba38ScjJ.js → Heading-bh1HU5HH.js} +1 -1
  11. package/dist/{Label-JS_ob-kh.js → Label-DWVaNd2E.js} +1 -1
  12. package/dist/{List-BLeHBkfx.js → List-CwJTORxj.js} +1 -1
  13. package/dist/{ListBox-BY3gwI8c.js → ListBox-BeC97FZ4.js} +62 -38
  14. package/dist/{OverlayArrow-BUfV-5P3.js → OverlayArrow-EZ0v_ljk.js} +6 -6
  15. package/dist/{Select-BebwUgKB.js → Select-DEQf8ZWI.js} +96 -58
  16. package/dist/{Select-aab027f3.esm-BKIJGje-.js → Select-ef7c0426.esm-D6WOCaYm.js} +11 -6
  17. package/dist/{Separator-CTQWg_HO.js → Separator-Fl7qSeN-.js} +37 -20
  18. package/dist/{Slider-uOPcIpqS.js → Slider-BQFSEhvk.js} +28 -21
  19. package/dist/{Text-BuJgePCv.js → Text-AxKZjtFm.js} +1 -1
  20. package/dist/{TextField-o2U-uBWv.js → TextField-x_eEa_qR.js} +20 -10
  21. package/dist/{VisuallyHidden-BYi0pekx.js → VisuallyHidden-D9s7FTtC.js} +2 -2
  22. package/dist/assets/style-admin.css +227 -3
  23. package/dist/assets/style-editor.css +227 -3
  24. package/dist/assets/style.css +227 -3
  25. package/dist/components/base-control/base-control.js +1 -1
  26. package/dist/components/button/button.js +11 -10
  27. package/dist/components/checkbox/checkbox.js +17 -12
  28. package/dist/components/color-pickers/color-picker.js +1 -1
  29. package/dist/components/color-pickers/color-swatch.js +3 -3
  30. package/dist/components/color-pickers/gradient-editor.js +3 -2
  31. package/dist/components/color-pickers/solid-color-picker.js +85 -49
  32. package/dist/components/component-toggle/component-toggle.js +2 -1
  33. package/dist/components/draggable/draggable-handle.js +1 -1
  34. package/dist/components/draggable/draggable.js +191 -170
  35. package/dist/components/draggable-list/draggable-list-item.js +1 -1
  36. package/dist/components/draggable-list/draggable-list.js +2 -2
  37. package/dist/components/expandable/expandable.js +18 -18
  38. package/dist/components/index.js +5 -1
  39. package/dist/components/input-field/input-field.js +3 -3
  40. package/dist/components/item-collection/item-collection.js +1 -1
  41. package/dist/components/link-input/link-input.js +45 -34
  42. package/dist/components/matrix-align/matrix-align.js +1 -1
  43. package/dist/components/menu/menu.js +3 -3
  44. package/dist/components/modal/modal.js +39 -13
  45. package/dist/components/number-picker/number-picker.js +15 -13
  46. package/dist/components/option-select/option-select.js +1 -1
  47. package/dist/components/options-panel/options-panel.js +1 -1
  48. package/dist/components/placeholders/file-placeholder.js +1 -1
  49. package/dist/components/popover/popover.js +2 -2
  50. package/dist/components/radio/radio.js +45 -22
  51. package/dist/components/repeater/repeater-item.js +1 -1
  52. package/dist/components/repeater/repeater.js +2 -2
  53. package/dist/components/responsive/mini-responsive.js +3 -2
  54. package/dist/components/responsive/responsive-legacy.js +2 -1
  55. package/dist/components/responsive/responsive.js +2 -1
  56. package/dist/components/responsive-preview/responsive-preview.js +1 -1
  57. package/dist/components/select/async-multi-select.js +3 -3
  58. package/dist/components/select/async-single-select.js +2 -2
  59. package/dist/components/select/custom-select-default-components.js +1 -1
  60. package/dist/components/select/multi-select-components.js +1 -1
  61. package/dist/components/select/multi-select.js +3 -3
  62. package/dist/components/select/react-select-component-wrappers.js +1 -1
  63. package/dist/components/select/shared.js +19 -1
  64. package/dist/components/select/single-select.js +2 -2
  65. package/dist/components/select/v2/async-multi-select.js +421 -0
  66. package/dist/components/select/v2/async-select.js +10 -10
  67. package/dist/components/select/v2/multi-select.js +403 -0
  68. package/dist/components/select/v2/shared.js +44 -8
  69. package/dist/components/select/v2/single-select.js +10 -10
  70. package/dist/components/slider/column-config-slider.js +3 -3
  71. package/dist/components/slider/slider.js +3 -3
  72. package/dist/components/slider/utils.js +2 -1
  73. package/dist/components/tabs/tabs.js +33 -23
  74. package/dist/components/toggle/switch.js +11 -8
  75. package/dist/components/toggle/toggle.js +1 -1
  76. package/dist/components/toggle-button/toggle-button.js +14 -8
  77. package/dist/components/tooltip/tooltip.js +9 -7
  78. package/dist/{context-BbYZoHvX.js → context-DMOmz986.js} +1 -1
  79. package/dist/{default-i18n-OFa3zAyB.js → default-i18n-DY6EfUSA.js} +21 -284
  80. package/dist/filterDOMProps-D2C6R0DK.js +71 -0
  81. package/dist/icons/icons.js +1 -1
  82. package/dist/{index-641ee5b8.esm-BPU8rMZr.js → index-641ee5b8.esm-Bu-mgopl.js} +1 -1
  83. package/dist/{index-CFozsmNS.js → index-CBHA_HDD.js} +3 -1
  84. package/dist/{index-BljRBEr_.js → index-Dq3gT5pW.js} +1 -1
  85. package/dist/index.js +4 -0
  86. package/dist/{multi-select-components-BcKzA24f.js → multi-select-components-rCCyCaKO.js} +1 -1
  87. package/dist/{number-CHmNj-oR.js → number-7sOvrqo0.js} +7 -2
  88. package/dist/{react-select-async.esm-D937XTWW.js → react-select-async.esm-XYrsKYb2.js} +3 -3
  89. package/dist/{react-select.esm-Ciai3aKf.js → react-select.esm-CCSPY6XR.js} +3 -3
  90. package/dist/sprintf-DmNrJSYG.js +51 -0
  91. package/dist/{textSelection-8DpK8fJl.js → textSelection-D5tWX1rJ.js} +1 -1
  92. package/dist/{useAsyncList-fLtZMvJO.js → useAsyncList-ZqaIH2gh.js} +1 -1
  93. package/dist/{useButton-lRcWnvOB.js → useButton-BtJSiQi3.js} +13 -5
  94. package/dist/useDragAndDrop-CddFteYC.js +3917 -0
  95. package/dist/{useEvent-ICdlokG-.js → useEvent-BifIGnVS.js} +1 -1
  96. package/dist/{useFilter-BR5z1A4Q.js → useFilter-Cl2ggwwq.js} +1 -1
  97. package/dist/{useFocusRing-Bv0UJQl8.js → useFocusRing-D5BfOWag.js} +3 -3
  98. package/dist/{useFormReset-D2YaWRIA.js → useFormReset-yV9VVy9R.js} +3 -4
  99. package/dist/{useHover-C2SkI1Fn.js → useHover-44IApaa2.js} +67 -34
  100. package/dist/{useLabel-BPCd5c7-.js → useLabel-C8umX0gk.js} +2 -2
  101. package/dist/{useLabels-B7-lUnAF.js → useLabels-Cdxi6JSa.js} +1 -1
  102. package/dist/{useListState-BrZ2XvDS.js → useListState-BSkHuB7-.js} +1 -1
  103. package/dist/{useLocalizedStringFormatter-C9GO0IDB.js → useLocalizedStringFormatter-eaZiN2tE.js} +1 -1
  104. package/dist/{useNumberField-y0dLc_6m.js → useNumberField-JhWPy1JY.js} +23 -16
  105. package/dist/{useNumberFormatter-CZ9QUnRt.js → useNumberFormatter-BCmkV-7c.js} +1 -1
  106. package/dist/{usePress-DWBuejBp.js → usePress-BnrkvZ7e.js} +20 -5
  107. package/dist/{useSingleSelectListState-Bh46cRXs.js → useSingleSelectListState-CzJFsSHr.js} +2 -2
  108. package/dist/{useToggle-yGuUBU7q.js → useToggle-OaIBlwRu.js} +21 -8
  109. package/dist/{useToggleState-ibcBUHnB.js → useToggleState-BF8hvidm.js} +5 -1
  110. package/dist/{utils-CZt7LCbO.js → utils-cvK1vxO7.js} +9 -7
  111. package/package.json +18 -18
  112. package/dist/Group-LBogWgyp.js +0 -48
  113. package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
  114. package/dist/filterDOMProps-EDDcM64A.js +0 -28
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
- import { A as AsyncSelect$1 } from "../../react-select-async.esm-D937XTWW.js";
4
- import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-BcKzA24f.js";
3
+ import { A as AsyncSelect$1 } from "../../react-select-async.esm-XYrsKYb2.js";
4
+ import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-rCCyCaKO.js";
5
5
  import { r as restrictToParentElement } from "../../modifiers.esm-BuJQPI1X.js";
6
6
  import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator, CustomSelectDefaultMultiValueRemove } from "./custom-select-default-components.js";
7
7
  import { BaseControl } from "../base-control/base-control.js";
8
8
  import { eightshiftSelectClasses } from "./styles.js";
9
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
9
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
10
10
  /**
11
11
  * Multi-select menu with async loading and re-ordering.
12
12
  *
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { A as AsyncSelect$1 } from "../../react-select-async.esm-D937XTWW.js";
2
+ import { A as AsyncSelect$1 } from "../../react-select-async.esm-XYrsKYb2.js";
3
3
  import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator } from "./custom-select-default-components.js";
4
4
  import { BaseControl } from "../base-control/base-control.js";
5
5
  import { eightshiftSelectClasses } from "./styles.js";
6
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
6
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
7
7
  /**
8
8
  * Select menu with async loading.
9
9
  *
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import React__default from "react";
3
3
  import { icons } from "../../icons/icons.js";
4
4
  import { c as clsx } from "../../lite-DVmmD_-j.js";
5
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
5
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
6
6
  /**
7
7
  * Default dropdown indicator for CustomSelect.
8
8
  *
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { g, b, a } from "../../multi-select-components-BcKzA24f.js";
2
+ import { g, b, a } from "../../multi-select-components-rCCyCaKO.js";
3
3
  import "../../lite-DVmmD_-j.js";
4
4
  export {
5
5
  g as getDragEndHandler,
@@ -1,13 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
- import { S as StateManagedSelect$1 } from "../../react-select.esm-Ciai3aKf.js";
4
- import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-BcKzA24f.js";
3
+ import { S as StateManagedSelect$1 } from "../../react-select.esm-CCSPY6XR.js";
4
+ import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-rCCyCaKO.js";
5
5
  import { r as restrictToParentElement } from "../../modifiers.esm-BuJQPI1X.js";
6
6
  import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator, CustomSelectDefaultMultiValueRemove } from "./custom-select-default-components.js";
7
7
  import { getValue } from "./shared.js";
8
8
  import { BaseControl } from "../base-control/base-control.js";
9
9
  import { eightshiftSelectClasses } from "./styles.js";
10
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
10
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
11
11
  /**
12
12
  * Multi-select menu with re-orderable items.
13
13
  *
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
2
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
3
3
  /**
4
4
  * Custom dropdown indicator for CustomSelect.
5
5
  *
@@ -21,6 +21,24 @@ const getValue = (simpleValue, value, options) => {
21
21
  }
22
22
  return value;
23
23
  };
24
+ const moveArrayItem = (array, itemToMove, targetItem, position = "before") => {
25
+ const result = [...array];
26
+ const sourceIndex = result.indexOf(itemToMove);
27
+ const targetIndex = result.indexOf(targetItem);
28
+ if (sourceIndex === -1 || targetIndex === -1) {
29
+ return result;
30
+ }
31
+ result.splice(sourceIndex, 1);
32
+ let adjustedTargetIndex;
33
+ if (position === "after") {
34
+ adjustedTargetIndex = sourceIndex < targetIndex ? targetIndex : targetIndex + 1;
35
+ } else if (position === "before") {
36
+ adjustedTargetIndex = sourceIndex < targetIndex ? targetIndex - 1 : targetIndex;
37
+ }
38
+ result.splice(adjustedTargetIndex, 0, itemToMove);
39
+ return result;
40
+ };
24
41
  export {
25
- getValue
42
+ getValue,
43
+ moveArrayItem
26
44
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { S as StateManagedSelect$1 } from "../../react-select.esm-Ciai3aKf.js";
2
+ import { S as StateManagedSelect$1 } from "../../react-select.esm-CCSPY6XR.js";
3
3
  import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator } from "./custom-select-default-components.js";
4
4
  import { getValue } from "./shared.js";
5
5
  import { BaseControl } from "../base-control/base-control.js";
6
6
  import { eightshiftSelectClasses } from "./styles.js";
7
- import { c as components } from "../../index-641ee5b8.esm-BPU8rMZr.js";
7
+ import { c as components } from "../../index-641ee5b8.esm-Bu-mgopl.js";
8
8
  /**
9
9
  * Select menu.
10
10
  *
@@ -0,0 +1,421 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { _ as __ } from "../../../default-i18n-DY6EfUSA.js";
3
+ import { BaseControl } from "../../base-control/base-control.js";
4
+ import { b as $d2f53cda644affe3$export$2f2b9559550c7bbc, c as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../../Separator-Fl7qSeN-.js";
5
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-RTwMSBs-.js";
6
+ import { g as $de32f1b87079253c$export$2e1e1122cf0cba88, e as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../../Dialog-Xf6AsnV-.js";
7
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Group-C4cXobNT.js";
8
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../../Label-DWVaNd2E.js";
9
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48, a as $eed445e0843c11d0$export$a11e76429ed99b4, b as $612b8eb6cb90e02d$export$62ed72bc21f6b8a6 } from "../../../ListBox-BeC97FZ4.js";
10
+ import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../../Text-AxKZjtFm.js";
11
+ import { $ as $d8f176866e6dc039$export$2cfc5be7a55829f6 } from "../../../useDragAndDrop-CddFteYC.js";
12
+ import { useRef, useEffect, cloneElement } from "react";
13
+ import { icons } from "../../../icons/icons.js";
14
+ import "../../../react-jsx-parser.min-LF707GK8.js";
15
+ import { OptionItemBase } from "./shared.js";
16
+ import { RichLabel } from "../../rich-label/rich-label.js";
17
+ import { c as clsx } from "../../../utils-cvK1vxO7.js";
18
+ import { truncateEnd, unescapeHTML } from "../../../utilities/text-helpers.js";
19
+ import { moveArrayItem } from "../shared.js";
20
+ import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66 } from "../../../useAsyncList-ZqaIH2gh.js";
21
+ /**
22
+ * Async multi-select menu.
23
+ *
24
+ * @component
25
+ * @param {Object} props - Component props.
26
+ * @param {string} [props.label] - Label of the component.
27
+ * @param {string} [props.help] - Help text of the component.
28
+ * @param {string} [props.icon] - Icon of the component.
29
+ * @param {string} [props.subtitle] - Subtitle of the component.
30
+ * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to show to the right of the label.
31
+ * @param {boolean} [props.inline] - Whether the Select menu is displayed inline with the label, to the right.
32
+ * @param {{label: string, value: string, metadata: Object<string, any>?}[]} props.value - Current value of the select.
33
+ * @param {Function} props.onChange - Function to call when the value changes.
34
+ * @param {boolean} [props.clearable=false] - Whether the select is clearable.
35
+ * @param {boolean} [props.disabled=false] - Whether the select is disabled.
36
+ * @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
37
+ * @param {Function} [props.getLabel] - Function to get the label for the item from the fetched data. `(item: Object<string, any>) => string`
38
+ * @param {Function} [props.getValue] - Function to get the value for the item from the fetched data. `(item: Object<string, any>) => string`
39
+ * @param {Function} [props.getMeta] - Function to get the metadata for the item from the fetched data. `(item: Object<string, any>) => Object<string, any>` (optional)
40
+ * @param {Function} [props.getIcon] - Function to get the icon for the item from the fetched data. `(item: Object<string, any>) => JSX.Element | string`
41
+ * @param {Function} [props.getSubtitle] - Function to get the subtitle for the item from the fetched data. `(item: Object<string, any>) => string`
42
+ * @param {Function} [props.getData] - Function to pre-process the fetched data before it is used in the select. `(data: Object<string, any>[]) => Object<string, any>[]`
43
+ * @param {JSX.Element} [props.customMenuOption] - If provided, replaces the default item in the dropdown menu. `({ value: string, label: string, subtitle: string, metadata: any }) => JSX.Element`
44
+ * @param {JSX.Element} [props.customValueDisplay] - If provided, replaces the default current value display of each selected item. `({ value: string, label: string, subtitle: string, metadata: any }) => JSX.Element`
45
+ * @param {JSX.Element} [props.customDropdownArrow] - If provided, replaces the default dropdown arrow indicator.
46
+ * @param {string} props.className - Classes to pass to the select menu.
47
+ * @param {boolean} [props.noMinWidth=false] - If `true`, the select menu will not have a minimum width.
48
+ * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
49
+ *
50
+ * @returns {JSX.Element} The __AsyncMultiSelectNext component.
51
+ *
52
+ * @example
53
+ * const [value, setValue] = useState(null);
54
+ *
55
+ * <__AsyncMultiSelectNext
56
+ * label='Select items'
57
+ * value={value}
58
+ * onChange={setValue}
59
+ * fetchUrl={(searchText) => `https://api.example.com/items?search=${searchText}`}
60
+ * getLabel={(item) => item?.label}
61
+ * getValue={(item) => item?.id}
62
+ * getIcon={() => icons.emptyCircle}
63
+ * />
64
+ *
65
+ * @preserve
66
+ */
67
+ const __AsyncMultiSelectNext = (props) => {
68
+ const {
69
+ label,
70
+ help,
71
+ icon,
72
+ subtitle,
73
+ actions,
74
+ inline,
75
+ value,
76
+ onChange,
77
+ clearable,
78
+ disabled,
79
+ placeholder = __("Select...", "eightshift-ui-components"),
80
+ fetchUrl,
81
+ fetchConfig = {},
82
+ getLabel,
83
+ getValue,
84
+ getMeta,
85
+ getIcon,
86
+ getSubtitle,
87
+ getData = (data) => data,
88
+ customMenuOption,
89
+ customValueDisplay,
90
+ customDropdownArrow,
91
+ className,
92
+ noMinWidth,
93
+ hidden,
94
+ processLoadedOptions,
95
+ ...rest
96
+ } = props;
97
+ const list = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
98
+ initialSelectedKeys: Array.isArray(value) ? value.map((item) => item?.value) : [],
99
+ getKey: (item) => item.value,
100
+ async load({ signal, filterText }) {
101
+ const res = await fetch(fetchUrl(filterText), { ...fetchConfig, signal });
102
+ const json = processLoadedOptions(getData(await res.json()));
103
+ const output = json?.map((item, index) => {
104
+ const id = getValue?.(item) ?? index;
105
+ const entry = { label: unescapeHTML(getLabel?.(item) ?? ""), value: id };
106
+ if (getMeta) {
107
+ entry.meta = getMeta(item);
108
+ }
109
+ if (getSubtitle) {
110
+ entry.subtitle = unescapeHTML(getSubtitle(item));
111
+ }
112
+ return entry;
113
+ });
114
+ if (filterText.length > 0) {
115
+ return {
116
+ items: output
117
+ };
118
+ }
119
+ const extra = value?.map((val) => {
120
+ if (output?.find((item) => item.value === val?.value)) {
121
+ return null;
122
+ }
123
+ return val;
124
+ })?.filter(Boolean) ?? [];
125
+ return {
126
+ items: [...output, ...extra]
127
+ };
128
+ }
129
+ });
130
+ const handleSelectionChange = (rawSelected) => {
131
+ const selected = list.filterText.length > 0 ? /* @__PURE__ */ new Set([...value?.map((item) => item?.value) ?? [], ...rawSelected]) : rawSelected;
132
+ list.filterText = "";
133
+ if (selected === null || selected === void 0) {
134
+ onChange(null);
135
+ return;
136
+ }
137
+ if (selected.size === 0) {
138
+ onChange([]);
139
+ return;
140
+ }
141
+ const selectedValues = [...selected].map((item) => {
142
+ const option = list.items.find((option2) => option2.value === item) || value.find((option2) => option2.value === item);
143
+ if (!option) {
144
+ return null;
145
+ }
146
+ return {
147
+ ...option
148
+ };
149
+ }).filter(Boolean);
150
+ onChange(selectedValues);
151
+ };
152
+ const ref = useRef();
153
+ let { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6({
154
+ getItems: (keys) => [...keys].map((key) => ({ "text/plain": key, text: value.find((item) => item.value === key)?.label ?? key })),
155
+ onReorder(e) {
156
+ handleSelectionChange(
157
+ new Set(
158
+ moveArrayItem(
159
+ value?.map((item) => item?.value),
160
+ [...e.keys][0],
161
+ e.target.key,
162
+ e.target.dropPosition
163
+ )
164
+ )
165
+ );
166
+ },
167
+ renderDragPreview(items) {
168
+ return /* @__PURE__ */ jsxs("div", { className: "es:bg-accent-700 es:rounded-md es:px-1.5 es:py-0.5 es:text-white es:translate-x-7 es:translate-y-6", children: [
169
+ truncateEnd(items[0]["text"], 20),
170
+ items.length > 1 && /* @__PURE__ */ jsx("span", { className: "badge", children: items.length })
171
+ ] });
172
+ },
173
+ renderDropIndicator(target) {
174
+ return /* @__PURE__ */ jsx(
175
+ $612b8eb6cb90e02d$export$62ed72bc21f6b8a6,
176
+ {
177
+ target,
178
+ className: "es:w-0.75 es:h-5.5 es:rounded-md es:transition es:inset-ring-0 es:drop-target:bg-accent-600 es:bg-accent-700/30 es:any-focus:outline-hidden es:any-focus:inset-ring-0"
179
+ }
180
+ );
181
+ },
182
+ isDisabled: disabled || value.length < 2
183
+ });
184
+ useEffect(() => {
185
+ if (list.selectedKeys.size !== (value ?? []).length) {
186
+ list.setSelectedKeys(new Set(value?.map((item) => item?.value)));
187
+ list.setFilterText("");
188
+ }
189
+ }, [value]);
190
+ if (hidden) {
191
+ return null;
192
+ }
193
+ return /* @__PURE__ */ jsx(
194
+ BaseControl,
195
+ {
196
+ label,
197
+ icon,
198
+ subtitle,
199
+ actions,
200
+ help,
201
+ inline,
202
+ labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
203
+ ...rest,
204
+ children: /* @__PURE__ */ jsxs(
205
+ $de32f1b87079253c$export$2e1e1122cf0cba88,
206
+ {
207
+ onOpenChange: (isOpen) => {
208
+ if (!isOpen) {
209
+ list.setFilterText("");
210
+ }
211
+ },
212
+ children: [
213
+ /* @__PURE__ */ jsxs(
214
+ $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
215
+ {
216
+ "aria-label": __("Select items", "eightshift-ui-components"),
217
+ className: clsx(
218
+ "es:group",
219
+ "es:relative es:flex es:items-center es:gap-1 es:py-0.75 es:pl-0.75 es:pr-1.5 es:focus-visible:outline-hidden es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
220
+ "es:min-h-9 es:rounded-10 es:border es:border-secondary-300 es:bg-white es:text-sm es:shadow-sm es:transition",
221
+ "es:inset-ring es:inset-ring-secondary-100",
222
+ "es:any-focus:outline-hidden",
223
+ !noMinWidth && "es:min-w-48",
224
+ !inline && "es:w-full",
225
+ disabled && "es:select-none es:shadow-none!",
226
+ "es:has-[[aria-haspopup=listbox][data-focus-visible=true],[aria-autocomplete=list][data-focus-visible=true]]:border-accent-500 es:has-[[aria-haspopup=listbox][data-focus-visible=true],[aria-autocomplete=list][data-focus-visible=true]]:ring-2 es:has-[[aria-haspopup=listbox][data-focus-visible=true],[aria-autocomplete=list][data-focus-visible=true]]:ring-accent-500/50",
227
+ className
228
+ ),
229
+ ref,
230
+ children: [
231
+ /* @__PURE__ */ jsx(
232
+ $eed445e0843c11d0$export$41f133550aa26f48,
233
+ {
234
+ "aria-label": __("Selected items", "eightshift-ui-components"),
235
+ layout: "grid",
236
+ items: value,
237
+ selectionMode: "none",
238
+ dependencies: [value],
239
+ className: "es:peer es:w-full es:flex es:items-center es:flex-wrap es:gap-0.75 es:has-dragging:inset-ring-1 es:has-dragging:inset-ring-accent-500/10 es:rounded-md es:transition es:leading-tight",
240
+ renderEmptyState: () => /* @__PURE__ */ jsx("div", { className: "es:text-secondary-500 es:pl-1.5 es:flex es:items-center", children: placeholder }),
241
+ dragAndDropHooks,
242
+ children: (item) => /* @__PURE__ */ jsxs(
243
+ $eed445e0843c11d0$export$a11e76429ed99b4,
244
+ {
245
+ id: item?.value,
246
+ textValue: item?.label,
247
+ className: clsx(
248
+ "es:inset-ring es:inset-ring-secondary-200/30 es:h-7 es:bg-secondary-100 es:focus-visible:inset-ring-accent-500 es:dragging:cursor-grabbing es:focus:outline-hidden es:py-1 es:px-1.5 es:rounded-7 es:dragging:inset-ring-accent-600/20 es:dragging:bg-transparent es:dragging:text-accent-600/40 es:transition es:flex es:items-center es:gap-1",
249
+ !disabled && value.size >= 2 && "es:cursor-move"
250
+ ),
251
+ children: [
252
+ customValueDisplay && customValueDisplay(truncateEnd(item?.label, 20), item),
253
+ !customValueDisplay && /* @__PURE__ */ jsx($514c0188e459b4c0$export$5f1af8db9871e1d6, { slot: "label", children: truncateEnd(item?.label, 20) })
254
+ ]
255
+ }
256
+ )
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsxs("div", { className: "es:shrink-0 es:ml-auto es:peer-has-dragging:hidden", children: [
260
+ !customDropdownArrow && cloneElement(icons.dropdownCaretAlt, {
261
+ className: "es:shrink-0 es:w-4 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200"
262
+ }),
263
+ customDropdownArrow && /* @__PURE__ */ jsx(
264
+ "div",
265
+ {
266
+ "aria-hidden": "true",
267
+ className: "es:shrink-0 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200",
268
+ children: customDropdownArrow
269
+ }
270
+ )
271
+ ] })
272
+ ]
273
+ }
274
+ ),
275
+ /* @__PURE__ */ jsx(
276
+ $07b14b47974efb58$export$5b6b19405a83ff9d,
277
+ {
278
+ "aria-label": __("Items", "eightshift-ui-components"),
279
+ className: ({ isEntering, isExiting }) => clsx(
280
+ "es:flex es:w-76 es:min-w-9 es:max-w-76 es:flex-col es:overflow-hidden es:rounded-2xl es:border es:border-secondary-200 es:bg-white es:text-sm es:shadow-xl es:inset-ring es:inset-ring-secondary-100",
281
+ "es:any-focus:outline-hidden",
282
+ "es:motion-safe:motion-duration-200 es:motion-safe:motion-ease-spring-bouncy",
283
+ "es:placement-bottom:origin-top-left es:placement-top:origin-bottom-left",
284
+ "es:placement-left:origin-right es:placement-right:origin-left",
285
+ isEntering && "es:motion-safe:motion-scale-in-95 es:motion-opacity-in-0",
286
+ isEntering && "es:motion-safe:placement-top:motion-translate-y-in-[5%] es:motion-safe:placement-bottom:motion-translate-y-in-[-5%] es:motion-safe:placement-left:motion-translate-x-in-[5%] es:motion-safe:placement-right:motion-translate-x-in-[-5%]",
287
+ isExiting && "es:motion-safe:motion-scale-out-95 es:motion-opacity-out-0",
288
+ isExiting && "es:motion-safe:placement-top:motion-translate-y-out-[5%] es:motion-safe:placement-bottom:motion-translate-y-out-[-5%] es:motion-safe:placement-left:motion-translate-x-out-[5%] es:motion-safe:placement-right:motion-translate-x-out-[-5%]"
289
+ ),
290
+ placement: "bottom left",
291
+ maxHeight: 360,
292
+ triggerRef: ref,
293
+ children: /* @__PURE__ */ jsxs(
294
+ $d2f53cda644affe3$export$2f2b9559550c7bbc,
295
+ {
296
+ inputValue: list.filterText,
297
+ onInputChange: list.setFilterText,
298
+ children: [
299
+ /* @__PURE__ */ jsxs(
300
+ $440f4836bcb56932$export$b94867ecbd698f21,
301
+ {
302
+ "aria-label": __("Search", "eightshift-ui-components"),
303
+ className: "es:flex es:items-center es:bg-secondary-100 es:m-2 es:rounded-lg es:relative es:placeholder:text-secondary-500",
304
+ autoFocus: true,
305
+ children: [
306
+ /* @__PURE__ */ jsx(
307
+ $3985021b0ad6602f$export$f5b8910cec6cf069,
308
+ {
309
+ placeholder: __("Search...", "eightshift-ui-components"),
310
+ className: "es:peer es:size-full es:h-9 es:outline-hidden es:shadow-none es:px-2.5 es:text-sm es:py-0 es:[&::-webkit-search-cancel-button]:hidden"
311
+ }
312
+ ),
313
+ /* @__PURE__ */ jsx(
314
+ $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
315
+ {
316
+ "aria-label": __("Clear", "eightshift-ui-components"),
317
+ className: clsx(
318
+ "es:absolute es:right-2 es:top-0 es:bottom-0 es:my-auto",
319
+ "es:flex es:size-6 es:items-center es:justify-center es:rounded es:text-sm es:text-secondary-600 es:transition es:hover:bg-red-50 es:hover:text-red-900 es:any-focus:outline-hidden es:focus:ring-2 es:focus:ring-accent-500/50 es:disabled:text-secondary-300 es:cursor-pointer",
320
+ "es:peer-placeholder-shown:opacity-0"
321
+ ),
322
+ children: icons.clearAlt
323
+ }
324
+ )
325
+ ]
326
+ }
327
+ ),
328
+ /* @__PURE__ */ jsx("div", { className: "es:w-full es:h-px es:bg-secondary-200 es:shrink-0" }),
329
+ list.isLoading && /* @__PURE__ */ jsx("div", { className: "es:p-3 es:min-h-16 es:flex es:items-center es:justify-center", children: cloneElement(icons.loader, { className: "es:text-accent-600! es:size-5.5 es:motion-preset-spin es:motion-duration-1500" }) }),
330
+ /* @__PURE__ */ jsx(
331
+ $eed445e0843c11d0$export$41f133550aa26f48,
332
+ {
333
+ className: clsx("es:space-y-0.5 es:p-1 es:any-focus:outline-hidden es:min-h-16", list.isLoading && "es:hidden", list?.items?.length > 0 && "es:overflow-y-auto"),
334
+ items: list.items,
335
+ selectedKeys: list.selectedKeys,
336
+ selectionMode: "multiple",
337
+ selectionBehavior: "toggle",
338
+ onSelectionChange: (selected) => {
339
+ list.setSelectedKeys(selected);
340
+ handleSelectionChange(selected);
341
+ },
342
+ dependencies: [value],
343
+ renderEmptyState: () => /* @__PURE__ */ jsx(
344
+ RichLabel,
345
+ {
346
+ icon: icons.searchEmpty,
347
+ label: __("No results", "eightshift-ui-components"),
348
+ subtitle: __("Try a different search term", "eightshift-ui-components"),
349
+ className: "es:min-h-14 es:p-2 es:w-fit es:mx-auto es:motion-preset-slide-up es:motion-ease-spring-bouncy es:motion-duration-200 es:shrink-0",
350
+ iconClassName: "es:text-accent-700 es:icon:size-7!",
351
+ noColor: true
352
+ }
353
+ ),
354
+ children: (item) => {
355
+ let icon2 = getIcon ? getIcon(item) : item?.icon ?? null;
356
+ if (typeof item?.icon === "string") {
357
+ icon2 = icons?.[item.icon] ?? null;
358
+ }
359
+ return /* @__PURE__ */ jsxs(
360
+ OptionItemBase,
361
+ {
362
+ id: item?.value,
363
+ className: item?.className,
364
+ selectIndicator: true,
365
+ children: [
366
+ customMenuOption && customMenuOption(item),
367
+ !customMenuOption && /* @__PURE__ */ jsx(
368
+ RichLabel,
369
+ {
370
+ icon: icon2,
371
+ label: item?.label,
372
+ subtitle: item?.subtitle,
373
+ noColor: true
374
+ }
375
+ )
376
+ ]
377
+ }
378
+ );
379
+ }
380
+ }
381
+ ),
382
+ clearable && value.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
383
+ /* @__PURE__ */ jsx("div", { className: "es:w-full es:h-px es:bg-secondary-200 es:shrink-0" }),
384
+ /* @__PURE__ */ jsx(
385
+ $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
386
+ {
387
+ slot: "close",
388
+ onPress: () => handleSelectionChange([]),
389
+ className: clsx(
390
+ "es:flex es:h-10 es:m-1 es:select-none es:items-center es:gap-1 es:rounded-xl es:px-2 es:py-1.5 es:transition es:scroll-m-1",
391
+ "es:any-focus:outline-hidden es:overflow-clip",
392
+ "es:not-selected:hover:bg-secondary-100 es:not-selected:hover:outline-hidden",
393
+ "es:selected:bg-accent-600/15 es:selected:text-accent-950",
394
+ "es:selected:focus-visible:inset-ring es:selected:focus-visible:inset-ring-accent-600/30",
395
+ "es:not-selected:focus-visible:bg-secondary-100 es:not-selected:focus-visible:outline-hidden",
396
+ "es:active:bg-accent-700/15"
397
+ ),
398
+ children: /* @__PURE__ */ jsx(
399
+ RichLabel,
400
+ {
401
+ icon: icons.clearAlt,
402
+ label: __("Clear selection", "eightshift-ui-components")
403
+ }
404
+ )
405
+ }
406
+ )
407
+ ] })
408
+ ]
409
+ }
410
+ )
411
+ }
412
+ )
413
+ ]
414
+ }
415
+ )
416
+ }
417
+ );
418
+ };
419
+ export {
420
+ __AsyncMultiSelectNext
421
+ };
@@ -1,21 +1,21 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { _ as __ } from "../../../default-i18n-OFa3zAyB.js";
2
+ import { _ as __ } from "../../../default-i18n-DY6EfUSA.js";
3
3
  import { BaseControl } from "../../base-control/base-control.js";
4
- import { b as $d2f53cda644affe3$export$2f2b9559550c7bbc, c as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../../Separator-CTQWg_HO.js";
5
- import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-DH22t_SM.js";
6
- import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Input-DfSBLhDx.js";
7
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../../Label-JS_ob-kh.js";
8
- import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../../ListBox-BY3gwI8c.js";
9
- import { e as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../../Dialog-D6EdDPeu.js";
10
- import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, b as $82d7e5349645de74$export$ef445b55be0601bd } from "../../../Select-BebwUgKB.js";
4
+ import { b as $d2f53cda644affe3$export$2f2b9559550c7bbc, c as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../../Separator-Fl7qSeN-.js";
5
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-RTwMSBs-.js";
6
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Group-C4cXobNT.js";
7
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../../Label-DWVaNd2E.js";
8
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../../ListBox-BeC97FZ4.js";
9
+ import { e as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../../Dialog-Xf6AsnV-.js";
10
+ import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, b as $82d7e5349645de74$export$ef445b55be0601bd } from "../../../Select-DEQf8ZWI.js";
11
11
  import { useRef, useEffect, cloneElement, useContext } from "react";
12
12
  import { icons } from "../../../icons/icons.js";
13
13
  import "../../../react-jsx-parser.min-LF707GK8.js";
14
14
  import { OptionItemBase } from "./shared.js";
15
15
  import { RichLabel } from "../../rich-label/rich-label.js";
16
16
  import { unescapeHTML } from "../../../utilities/text-helpers.js";
17
- import { c as clsx } from "../../../utils-CZt7LCbO.js";
18
- import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66 } from "../../../useAsyncList-fLtZMvJO.js";
17
+ import { c as clsx } from "../../../utils-cvK1vxO7.js";
18
+ import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66 } from "../../../useAsyncList-ZqaIH2gh.js";
19
19
  /**
20
20
  * Select menu with async loading.
21
21
  *