@eightshift/ui-components 5.0.10 → 5.1.1
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.
- package/dist/{Collection-uTAXq9Br.js → Collection-BRJOMbOa.js} +12 -7
- package/dist/{Dialog-CmAxaSUv.js → Dialog-D6EdDPeu.js} +8 -8
- package/dist/{useFormValidation-Dy0PXJg5.js → Form-Bnyyv3Im.js} +6 -4
- package/dist/{Group-DDPhPPTQ.js → Group-LBogWgyp.js} +2 -2
- package/dist/{Input-BmDS8Juy.js → Input-DfSBLhDx.js} +1 -1
- package/dist/List-BLeHBkfx.js +590 -0
- package/dist/{ListBox-_nDFq8-H.js → ListBox-BY3gwI8c.js} +3 -3
- package/dist/Select-BebwUgKB.js +764 -0
- package/dist/Separator-CTQWg_HO.js +1111 -0
- package/dist/TextField-o2U-uBWv.js +133 -0
- package/dist/assets/style-admin.css +264 -150
- package/dist/assets/style-editor.css +264 -150
- package/dist/assets/style.css +264 -150
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/breakpoint-preview/breakpoint-preview.js +3 -4
- package/dist/components/button/button.js +3 -3
- package/dist/components/checkbox/checkbox.js +1 -2
- package/dist/components/color-pickers/color-picker.js +7 -9
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +19 -25
- package/dist/components/color-pickers/solid-color-picker.js +27 -27
- package/dist/components/component-toggle/component-toggle.js +1 -1
- package/dist/components/draggable/draggable-handle.js +2 -2
- package/dist/components/draggable/draggable.js +5 -5
- package/dist/components/draggable-list/draggable-list-item.js +2 -2
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +1 -1
- package/dist/components/index.js +5 -5
- package/dist/components/input-field/input-field.js +14 -129
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +1463 -17
- package/dist/components/matrix-align/matrix-align.js +11 -14
- package/dist/components/menu/menu.js +4 -8
- package/dist/components/modal/modal.js +30 -31
- package/dist/components/number-picker/number-picker.js +9 -10
- package/dist/components/option-select/option-select.js +140 -156
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/placeholders/image-placeholder.js +3 -3
- package/dist/components/placeholders/media-placeholder.js +2 -2
- package/dist/components/popover/popover.js +10 -5
- package/dist/components/radio/radio.js +4 -5
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.js +6 -6
- package/dist/components/responsive/mini-responsive.js +45 -47
- package/dist/components/responsive/responsive-legacy.js +51 -55
- package/dist/components/responsive/responsive.js +47 -49
- package/dist/components/responsive-preview/responsive-preview.js +12 -15
- package/dist/components/select/async-multi-select.js +4 -4
- package/dist/components/select/async-single-select.js +1 -1
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +4 -4
- package/dist/components/select/shared.js +2 -2
- package/dist/components/select/single-select.js +1 -1
- package/dist/components/select/styles.js +3 -3
- package/dist/components/select/v2/async-select.js +216 -158
- package/dist/components/select/v2/shared.js +29 -20
- package/dist/components/select/v2/single-select.js +203 -851
- package/dist/components/slider/column-config-slider.js +2 -2
- package/dist/components/slider/slider.js +2 -2
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/tabs/tabs.js +7 -8
- package/dist/components/toggle/switch.js +4 -3
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/{default-i18n-CT_oS1Fy.js → default-i18n-OFa3zAyB.js} +5 -9
- package/dist/icons/icons.js +141 -141
- package/dist/icons/jsx-svg.js +3 -4
- package/dist/index.js +4 -4
- package/dist/{multi-select-components-Sp-JEFEX.js → multi-select-components-BcKzA24f.js} +3 -3
- package/dist/{react-jsx-parser.min-DZCiis5V.js → react-jsx-parser.min-LF707GK8.js} +312 -332
- package/dist/useAsyncList-fLtZMvJO.js +420 -0
- package/dist/useFilter-BR5z1A4Q.js +50 -0
- package/dist/{useListState-9Hq_FiRF.js → useListState-BrZ2XvDS.js} +1 -1
- package/dist/{useNumberField-D0u2bh8g.js → useNumberField-y0dLc_6m.js} +2 -2
- package/dist/{useSingleSelectListState-DqhemUIh.js → useSingleSelectListState-Bh46cRXs.js} +1 -1
- package/dist/utilities/array-helpers.js +4 -7
- package/dist/utilities/es-dash.js +21 -3
- package/dist/utilities/index.js +2 -1
- package/dist/utilities/text-helpers.js +3 -3
- package/package.json +9 -9
- package/dist/ComboBox-BANSEKnb.js +0 -1915
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/List-CZMUbkFU.js +0 -593
- package/dist/Separator-BN3mjL6q.js +0 -332
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as __ } from "../../../default-i18n-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { _ as __ } from "../../../default-i18n-OFa3zAyB.js";
|
|
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";
|
|
3
5
|
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-DH22t_SM.js";
|
|
4
|
-
import { $ as $
|
|
5
|
-
import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Input-BmDS8Juy.js";
|
|
6
|
+
import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Input-DfSBLhDx.js";
|
|
6
7
|
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../../Label-JS_ob-kh.js";
|
|
7
|
-
import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../../ListBox-
|
|
8
|
-
import {
|
|
9
|
-
import { $ as $
|
|
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";
|
|
11
|
+
import { useRef, useEffect, cloneElement, useContext } from "react";
|
|
12
|
+
import { icons } from "../../../icons/icons.js";
|
|
13
|
+
import "../../../react-jsx-parser.min-LF707GK8.js";
|
|
10
14
|
import { OptionItemBase } from "./shared.js";
|
|
11
15
|
import { RichLabel } from "../../rich-label/rich-label.js";
|
|
12
|
-
import { BaseControl } from "../../base-control/base-control.js";
|
|
13
|
-
import { useEffect, useRef, cloneElement, useContext } from "react";
|
|
14
|
-
import { icons } from "../../../icons/icons.js";
|
|
15
|
-
import "../../../react-jsx-parser.min-DZCiis5V.js";
|
|
16
16
|
import { unescapeHTML } from "../../../utilities/text-helpers.js";
|
|
17
17
|
import { c as clsx } from "../../../utils-CZt7LCbO.js";
|
|
18
|
+
import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66 } from "../../../useAsyncList-fLtZMvJO.js";
|
|
18
19
|
/**
|
|
19
20
|
* Select menu with async loading.
|
|
20
21
|
*
|
|
@@ -35,16 +36,18 @@ import { c as clsx } from "../../../utils-CZt7LCbO.js";
|
|
|
35
36
|
* @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
|
|
36
37
|
* @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`
|
|
37
38
|
* @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`
|
|
39
|
+
* @param {JSX.Element} [props.customDropdownArrow] - If provided, replaces the default dropdown arrow indicator.
|
|
38
40
|
* @param {Function} [props.processLoadedOptions] - Allows modifying (filtering, grouping, ...) options output after the items have been dynamically fetched. Must include `label`, `value`, and `id` keys in the output, additional fields can be added as required.
|
|
39
41
|
* @param {string} props.className - Classes to pass to the select menu.
|
|
42
|
+
* @param {boolean} [props.noMinWidth=false] - If `true`, the select menu will not have a minimum width.
|
|
40
43
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
41
44
|
*
|
|
42
|
-
* @returns {JSX.Element} The
|
|
45
|
+
* @returns {JSX.Element} The AsyncSelectNext component.
|
|
43
46
|
*
|
|
44
47
|
* @example
|
|
45
48
|
* const [value, setValue] = useState(null);
|
|
46
49
|
*
|
|
47
|
-
* <
|
|
50
|
+
* <AsyncSelectNext
|
|
48
51
|
* label='Select items'
|
|
49
52
|
* fetchUrl={(searchText) => `https://api.example.com/items?q=${searchText}`}
|
|
50
53
|
* value={value}
|
|
@@ -55,7 +58,7 @@ import { c as clsx } from "../../../utils-CZt7LCbO.js";
|
|
|
55
58
|
*
|
|
56
59
|
* @preserve
|
|
57
60
|
*/
|
|
58
|
-
const
|
|
61
|
+
const AsyncSelectNext = (props) => {
|
|
59
62
|
const {
|
|
60
63
|
label,
|
|
61
64
|
help,
|
|
@@ -69,9 +72,10 @@ const __ExperimentalAsyncSelect = (props) => {
|
|
|
69
72
|
disabled = false,
|
|
70
73
|
clearable = false,
|
|
71
74
|
className,
|
|
72
|
-
placeholder,
|
|
75
|
+
placeholder = __("Select...", "eightshift-ui-components"),
|
|
73
76
|
customMenuOption,
|
|
74
77
|
customValueDisplay,
|
|
78
|
+
customDropdownArrow,
|
|
75
79
|
processLoadedOptions = (options) => options,
|
|
76
80
|
fetchUrl,
|
|
77
81
|
fetchConfig = {},
|
|
@@ -82,17 +86,17 @@ const __ExperimentalAsyncSelect = (props) => {
|
|
|
82
86
|
getSubtitle,
|
|
83
87
|
getData = (data) => data,
|
|
84
88
|
hidden,
|
|
89
|
+
noMinWidth = false,
|
|
85
90
|
...rest
|
|
86
91
|
} = props;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
async load({ signal, filterText
|
|
90
|
-
let filterText = rawFilterText.trim();
|
|
92
|
+
const list = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
|
|
93
|
+
getKey: (item) => item.value,
|
|
94
|
+
async load({ signal, filterText }) {
|
|
91
95
|
const res = await fetch(fetchUrl(filterText), { ...fetchConfig, signal });
|
|
92
|
-
const json = getData(await res.json());
|
|
93
|
-
const output = json
|
|
94
|
-
const id = getValue(item);
|
|
95
|
-
const entry = { label: unescapeHTML(getLabel(item)), value: id };
|
|
96
|
+
const json = processLoadedOptions(getData(await res.json()));
|
|
97
|
+
const output = json?.map((item, index) => {
|
|
98
|
+
const id = getValue?.(item) ?? index;
|
|
99
|
+
const entry = { label: unescapeHTML(getLabel?.(item) ?? ""), value: id };
|
|
96
100
|
if (getMeta) {
|
|
97
101
|
entry.meta = getMeta(item);
|
|
98
102
|
}
|
|
@@ -101,197 +105,251 @@ const __ExperimentalAsyncSelect = (props) => {
|
|
|
101
105
|
}
|
|
102
106
|
return entry;
|
|
103
107
|
});
|
|
108
|
+
if (value && value?.value && (filterText ?? "").length < 1 && output.length > 0 && !output?.find((item) => item.value === value?.value)) {
|
|
109
|
+
return {
|
|
110
|
+
items: [value, ...output.slice(0, -1)],
|
|
111
|
+
selectedKeys: [value?.value]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
104
114
|
return {
|
|
105
115
|
items: output
|
|
106
116
|
};
|
|
107
117
|
}
|
|
108
118
|
});
|
|
109
|
-
|
|
110
|
-
if (value == null ? void 0 : value.value) {
|
|
111
|
-
const selectedIndex = listItems.findIndex((item) => item.value === (value == null ? void 0 : value.value));
|
|
112
|
-
if (selectedIndex === -1) {
|
|
113
|
-
listItems = [{ ...value }, ...listItems];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
119
|
+
const ref = useRef();
|
|
116
120
|
useEffect(() => {
|
|
117
|
-
if (list.
|
|
118
|
-
list.
|
|
121
|
+
if (value?.value && !list.getItem(value?.value)) {
|
|
122
|
+
list.items[0] = value;
|
|
119
123
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, [value]);
|
|
124
|
-
const ref = useRef();
|
|
124
|
+
list.setSelectedKeys(value?.value ? [value.value] : []);
|
|
125
|
+
list.setFilterText("");
|
|
126
|
+
}, [value?.value]);
|
|
125
127
|
if (hidden) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
-
$
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
$82d7e5349645de74$export$ef9b1a59e592288f,
|
|
130
132
|
{
|
|
133
|
+
isDisabled: disabled,
|
|
134
|
+
selectedKey: value?.value ?? null,
|
|
131
135
|
onSelectionChange: (selected) => {
|
|
136
|
+
list.filterText = "";
|
|
132
137
|
if (selected === null || selected === void 0) {
|
|
133
138
|
onChange(null);
|
|
134
|
-
list.setFilterText("");
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (selected === (value == null ? void 0 : value.value) || list.filterText === (value == null ? void 0 : value.label)) {
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
const item =
|
|
141
|
+
const item = list.items.find((item2) => item2.value === selected);
|
|
141
142
|
if (!item) {
|
|
142
143
|
onChange(null);
|
|
143
|
-
list.setFilterText("");
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
if (item && "id" in item) {
|
|
147
|
+
delete item.id;
|
|
148
|
+
}
|
|
147
149
|
onChange(item);
|
|
148
150
|
},
|
|
149
|
-
|
|
150
|
-
allowsEmptyCollection: true,
|
|
151
|
-
selectedKey: (value == null ? void 0 : value.value) ?? null,
|
|
152
|
-
inputValue: list.filterText,
|
|
153
|
-
onInputChange: list.setFilterText,
|
|
154
|
-
items: listItems,
|
|
155
|
-
isDisabled: disabled,
|
|
156
|
-
menuTrigger: "focus",
|
|
151
|
+
placeholder,
|
|
157
152
|
...rest,
|
|
158
|
-
children:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
children: /* @__PURE__ */ jsxs(
|
|
154
|
+
BaseControl,
|
|
155
|
+
{
|
|
156
|
+
label,
|
|
157
|
+
icon,
|
|
158
|
+
subtitle,
|
|
159
|
+
actions,
|
|
160
|
+
help,
|
|
161
|
+
inline,
|
|
162
|
+
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsxs(
|
|
170
165
|
"div",
|
|
171
166
|
{
|
|
172
167
|
className: clsx(
|
|
173
|
-
"es:relative es:flex es:
|
|
168
|
+
"es:relative es:flex es:items-center es:gap-1 es:px-1.5 es:focus-visible:outline-hidden es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
|
|
174
169
|
"es:h-9 es:rounded-10 es:border es:border-secondary-300 es:bg-white es:text-sm es:shadow-sm es:transition",
|
|
170
|
+
"es:inset-ring es:inset-ring-secondary-100",
|
|
175
171
|
"es:any-focus:outline-hidden",
|
|
172
|
+
!noMinWidth && "es:min-w-48",
|
|
176
173
|
!inline && "es:w-full",
|
|
177
|
-
disabled && "es:select-none",
|
|
178
|
-
"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"
|
|
174
|
+
disabled && "es:select-none es:shadow-none!",
|
|
175
|
+
"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",
|
|
176
|
+
className
|
|
179
177
|
),
|
|
180
178
|
ref,
|
|
181
179
|
children: [
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
$
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
180
|
+
/* @__PURE__ */ jsxs($d2b4bc8c273e7be6$export$353f5b6fc5456de1, { className: "es:any-focus:outline-hidden es:text-start es:size-full es:inline-block es:group es:overflow-x-clip", children: [
|
|
181
|
+
/* @__PURE__ */ jsx($82d7e5349645de74$export$e288731fd71264f0, { children: ({ selectedItem }) => {
|
|
182
|
+
if (!value?.value) {
|
|
183
|
+
return /* @__PURE__ */ jsx("span", { className: "es:pointer-events-none es:pr-6 es:text-sm es:text-secondary-500", children: placeholder });
|
|
184
|
+
}
|
|
185
|
+
if (customValueDisplay) {
|
|
186
|
+
return customValueDisplay(selectedItem);
|
|
187
|
+
}
|
|
188
|
+
let icon2 = getIcon ? getIcon(selectedItem) : selectedItem?.icon ?? null;
|
|
189
|
+
if (typeof selectedItem?.icon === "string") {
|
|
190
|
+
icon2 = icons?.[selectedItem.icon] ?? null;
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ jsx(
|
|
193
|
+
RichLabel,
|
|
194
|
+
{
|
|
195
|
+
icon: icon2,
|
|
196
|
+
label: /* @__PURE__ */ jsx("span", { className: "es:line-clamp-1", children: selectedItem?.label }),
|
|
197
|
+
subtitle: /* @__PURE__ */ jsx("span", { className: "es:line-clamp-1", children: selectedItem?.subtitle }),
|
|
198
|
+
className: clsx("es:pr-6 es:grow es:w-full", disabled && "es:grayscale es:pointer-events-none"),
|
|
199
|
+
iconClassName: "es:pointer-events-none es:select-none"
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
} }),
|
|
203
|
+
/* @__PURE__ */ jsxs(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
className: clsx("es:absolute es:bottom-0 es:right-1 es:top-0 es:my-auto es:flex es:items-center", disabled ? "es:text-secondary-300" : "es:text-secondary-500"),
|
|
207
|
+
"aria-hidden": "true",
|
|
208
|
+
children: [
|
|
209
|
+
!customDropdownArrow && cloneElement(icons.dropdownCaretAlt, {
|
|
210
|
+
className: "es:w-4 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200"
|
|
211
|
+
}),
|
|
212
|
+
customDropdownArrow && /* @__PURE__ */ jsx(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
"aria-hidden": "true",
|
|
216
|
+
className: "es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200",
|
|
217
|
+
children: customDropdownArrow
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] }),
|
|
224
|
+
clearable && /* @__PURE__ */ jsx(SelectClearButton, {})
|
|
221
225
|
]
|
|
222
226
|
}
|
|
223
|
-
)
|
|
224
|
-
}
|
|
225
|
-
),
|
|
226
|
-
/* @__PURE__ */ jsxs(
|
|
227
|
-
$07b14b47974efb58$export$5b6b19405a83ff9d,
|
|
228
|
-
{
|
|
229
|
-
className: ({ isEntering, isExiting }) => clsx(
|
|
230
|
-
"es:flex es:w-80 es:min-w-9 es:max-w-80 es:flex-col es:overflow-x-hidden es:rounded-lg es:border es:border-secondary-200 es:bg-white es:text-sm es:shadow-lg",
|
|
231
|
-
"es:any-focus:outline-hidden",
|
|
232
|
-
isEntering && "es:motion-safe:motion-preset-slide-down-sm es:motion-safe:motion-duration-300 es:motion-reduce:motion-preset-fade-md",
|
|
233
|
-
isExiting && "es:not-motion-reduce:motion-translate-y-out-[-2.5%] es:motion-opacity-out-0 es:motion-duration-200"
|
|
234
227
|
),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
228
|
+
/* @__PURE__ */ jsx(
|
|
229
|
+
$07b14b47974efb58$export$5b6b19405a83ff9d,
|
|
230
|
+
{
|
|
231
|
+
className: ({ isEntering, isExiting }) => clsx(
|
|
232
|
+
"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",
|
|
233
|
+
"es:any-focus:outline-hidden",
|
|
234
|
+
"es:motion-safe:motion-duration-200 es:motion-safe:motion-ease-spring-bouncy",
|
|
235
|
+
"es:placement-bottom:origin-top-left es:placement-top:origin-bottom-left",
|
|
236
|
+
"es:placement-left:origin-right es:placement-right:origin-left",
|
|
237
|
+
isEntering && "es:motion-safe:motion-scale-in-95 es:motion-opacity-in-0",
|
|
238
|
+
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%]",
|
|
239
|
+
isExiting && "es:motion-safe:motion-scale-out-95 es:motion-opacity-out-0",
|
|
240
|
+
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%]"
|
|
241
|
+
),
|
|
242
|
+
placement: "bottom left",
|
|
243
|
+
maxHeight: 300,
|
|
244
|
+
triggerRef: ref,
|
|
245
|
+
children: /* @__PURE__ */ jsxs(
|
|
246
|
+
$d2f53cda644affe3$export$2f2b9559550c7bbc,
|
|
241
247
|
{
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
inputValue: list.filterText,
|
|
249
|
+
onInputChange: list.setFilterText,
|
|
244
250
|
children: [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
/* @__PURE__ */ jsxs(
|
|
252
|
+
$440f4836bcb56932$export$b94867ecbd698f21,
|
|
253
|
+
{
|
|
254
|
+
"aria-label": __("Search", "eightshift-ui-components"),
|
|
255
|
+
className: "es:flex es:items-center es:bg-secondary-100 es:m-2 es:rounded-lg es:relative es:placeholder:text-secondary-500",
|
|
256
|
+
autoFocus: true,
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx(
|
|
259
|
+
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
260
|
+
{
|
|
261
|
+
placeholder: __("Search...", "eightshift-ui-components"),
|
|
262
|
+
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"
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ jsx(
|
|
266
|
+
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
267
|
+
{
|
|
268
|
+
"aria-label": __("Clear", "eightshift-ui-components"),
|
|
269
|
+
className: clsx(
|
|
270
|
+
"es:absolute es:right-2 es:top-0 es:bottom-0 es:my-auto",
|
|
271
|
+
"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",
|
|
272
|
+
"es:peer-placeholder-shown:opacity-0"
|
|
273
|
+
),
|
|
274
|
+
children: icons.clearAlt
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ jsx("div", { className: "es:w-full es:h-px es:bg-secondary-200 es:shrink-0" }),
|
|
281
|
+
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" }) }),
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
$eed445e0843c11d0$export$41f133550aa26f48,
|
|
248
284
|
{
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
285
|
+
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"),
|
|
286
|
+
items: list.items,
|
|
287
|
+
renderEmptyState: () => /* @__PURE__ */ jsx(
|
|
288
|
+
RichLabel,
|
|
289
|
+
{
|
|
290
|
+
icon: icons.searchEmpty,
|
|
291
|
+
label: __("No results", "eightshift-ui-components"),
|
|
292
|
+
subtitle: __("Try a different search term", "eightshift-ui-components"),
|
|
293
|
+
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",
|
|
294
|
+
iconClassName: "es:text-accent-700 es:icon:size-7!",
|
|
295
|
+
noColor: true
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
children: (item) => {
|
|
299
|
+
let icon2 = getIcon ? getIcon(item) : item?.icon ?? null;
|
|
300
|
+
if (typeof item?.icon === "string") {
|
|
301
|
+
icon2 = icons?.[item.icon] ?? null;
|
|
302
|
+
}
|
|
303
|
+
return /* @__PURE__ */ jsxs(
|
|
304
|
+
OptionItemBase,
|
|
305
|
+
{
|
|
306
|
+
id: item.value,
|
|
307
|
+
className: item?.className,
|
|
308
|
+
children: [
|
|
309
|
+
customMenuOption && customMenuOption(item),
|
|
310
|
+
!customMenuOption && /* @__PURE__ */ jsx(
|
|
311
|
+
RichLabel,
|
|
312
|
+
{
|
|
313
|
+
icon: icon2,
|
|
314
|
+
label: item?.label,
|
|
315
|
+
subtitle: item.subtitle,
|
|
316
|
+
noColor: true
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}
|
|
252
323
|
}
|
|
253
324
|
)
|
|
254
325
|
]
|
|
255
326
|
}
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
slot: "errorMessage",
|
|
263
|
-
className: clsx("es:flex es:w-full es:items-center es:gap-1 es:rounded es:text-amber-950"),
|
|
264
|
-
children: [
|
|
265
|
-
icons.searchEmpty,
|
|
266
|
-
__("Nothing found", "eightshift-ui-components")
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
) })
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
]
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
)
|
|
274
333
|
}
|
|
275
334
|
);
|
|
276
335
|
};
|
|
277
|
-
const
|
|
278
|
-
const state = useContext($
|
|
279
|
-
const isEmpty =
|
|
336
|
+
const SelectClearButton = () => {
|
|
337
|
+
const state = useContext($82d7e5349645de74$export$ef445b55be0601bd);
|
|
338
|
+
const isEmpty = state?.selectedKey === null;
|
|
280
339
|
return /* @__PURE__ */ jsx(
|
|
281
340
|
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
282
341
|
{
|
|
283
342
|
"aria-label": __("Clear value", "eightshift-ui-components"),
|
|
284
343
|
className: clsx(
|
|
285
|
-
"es:mr-
|
|
344
|
+
"es:mr-6 es:flex es:h-6 es:w-8 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",
|
|
286
345
|
isEmpty ? "es:hidden" : "es:flex"
|
|
287
346
|
),
|
|
288
|
-
onPress: () => state
|
|
347
|
+
onPress: () => state?.setSelectedKey(null),
|
|
289
348
|
slot: null,
|
|
290
|
-
isDisabled: disabled || isEmpty,
|
|
291
349
|
children: icons.clearAlt
|
|
292
350
|
}
|
|
293
351
|
);
|
|
294
352
|
};
|
|
295
353
|
export {
|
|
296
|
-
|
|
354
|
+
AsyncSelectNext
|
|
297
355
|
};
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { a as $eed445e0843c11d0$export$a11e76429ed99b4 } from "../../../ListBox-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { a as $eed445e0843c11d0$export$a11e76429ed99b4 } from "../../../ListBox-BY3gwI8c.js";
|
|
3
3
|
import { c as clsx } from "../../../utils-CZt7LCbO.js";
|
|
4
|
-
const OptionItemBase = (props) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
const OptionItemBase = (props) => /* @__PURE__ */ jsxs(
|
|
5
|
+
$eed445e0843c11d0$export$a11e76429ed99b4,
|
|
6
|
+
{
|
|
7
|
+
...props,
|
|
8
|
+
textValue: props?.value?.label,
|
|
9
|
+
className: "es:group es:any-focus:outline-hidden es:motion-preset-slide-down es:motion-ease-spring-bouncy es:motion-duration-200",
|
|
10
|
+
children: [
|
|
11
|
+
props.extraPre,
|
|
12
|
+
/* @__PURE__ */ jsx(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: clsx(
|
|
16
|
+
"es:flex es:min-h-9 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",
|
|
17
|
+
"es:group-any-focus:outline-hidden es:overflow-clip",
|
|
18
|
+
"es:group-not-selected:hover:bg-secondary-100 es:group-not-selected:hover:outline-hidden",
|
|
19
|
+
"es:group-selected:bg-accent-600/15 es:group-selected:text-accent-950",
|
|
20
|
+
"es:group-selected:group-focus-visible:inset-ring es:group-selected:group-focus-visible:inset-ring-accent-600/30",
|
|
21
|
+
"es:group-not-selected:group-focus-visible:bg-secondary-100 es:group-not-selected:group-focus-visible:outline-hidden",
|
|
22
|
+
"es:group-active:bg-accent-700/15"
|
|
23
|
+
),
|
|
24
|
+
children: props.children
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
props.extraAfter
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
22
31
|
export {
|
|
23
32
|
OptionItemBase
|
|
24
33
|
};
|