@eightshift/ui-components 3.0.1 → 5.0.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.
- package/package.json +101 -101
- package/dist/Button-BPLceDeW.js +0 -185
- package/dist/Collection-CZxddMZS.js +0 -2332
- package/dist/Color-MV5kBVXr.js +0 -2452
- package/dist/ColorSwatch-BqQfVu4L.js +0 -64
- package/dist/ComboBox-_RfyhwZw.js +0 -1906
- package/dist/Dialog-8tYeQ9n4.js +0 -2300
- package/dist/FieldError-52GVSGgC.js +0 -42
- package/dist/FocusScope-Cri5BFRz.js +0 -831
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/Group-_emcIVxI.js +0 -48
- package/dist/Heading-B2153VXe.js +0 -16
- package/dist/Hidden-rE6uR-lr.js +0 -41
- package/dist/Input-BxpFEIXV.js +0 -133
- package/dist/Label-icmbmNdI.js +0 -17
- package/dist/List-CZMUbkFU.js +0 -593
- package/dist/ListBox-Ca6hiCqz.js +0 -581
- package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
- package/dist/OverlayArrow-CYXQSlEU.js +0 -629
- package/dist/RSPContexts-2lR5GG9p.js +0 -14
- package/dist/Select-aab027f3.esm-PDJCDE95.js +0 -2469
- package/dist/Separator-4IIDRlV_.js +0 -322
- package/dist/Slider-rz2XRMGm.js +0 -853
- package/dist/Text-DVSAPY-K.js +0 -16
- package/dist/VisuallyHidden-f9zX67a_.js +0 -48
- package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
- package/dist/assets/index.css +0 -37
- package/dist/assets/style-admin.css +0 -5255
- package/dist/assets/style-editor.css +0 -5255
- package/dist/assets/style.css +0 -5261
- package/dist/assets/wp-font-enhancements.css +0 -8
- package/dist/assets/wp-ui-enhancements.css +0 -299
- package/dist/components/animated-visibility/animated-visibility.js +0 -105
- package/dist/components/base-control/base-control.js +0 -86
- package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
- package/dist/components/button/button.js +0 -387
- package/dist/components/checkbox/checkbox.js +0 -320
- package/dist/components/color-pickers/color-picker.js +0 -272
- package/dist/components/color-pickers/color-swatch.js +0 -58
- package/dist/components/color-pickers/gradient-editor.js +0 -534
- package/dist/components/color-pickers/solid-color-picker.js +0 -1567
- package/dist/components/component-toggle/component-toggle.js +0 -158
- package/dist/components/container-panel/container-panel.js +0 -131
- package/dist/components/draggable/draggable-context.js +0 -5
- package/dist/components/draggable/draggable-handle.js +0 -46
- package/dist/components/draggable/draggable.js +0 -6207
- package/dist/components/draggable-list/draggable-list-context.js +0 -5
- package/dist/components/draggable-list/draggable-list-item.js +0 -77
- package/dist/components/draggable-list/draggable-list.js +0 -151
- package/dist/components/expandable/expandable.js +0 -342
- package/dist/components/index.js +0 -137
- package/dist/components/input-field/input-field.js +0 -231
- package/dist/components/item-collection/item-collection.js +0 -59
- package/dist/components/layout/hstack.js +0 -30
- package/dist/components/layout/vstack.js +0 -30
- package/dist/components/link-input/link-input.js +0 -293
- package/dist/components/matrix-align/matrix-align.js +0 -134
- package/dist/components/menu/menu.js +0 -285
- package/dist/components/modal/modal.js +0 -305
- package/dist/components/notice/notice.js +0 -123
- package/dist/components/number-picker/number-picker.js +0 -292
- package/dist/components/option-select/option-select.js +0 -264
- package/dist/components/options-panel/options-panel.js +0 -158
- package/dist/components/placeholders/file-placeholder.js +0 -42
- package/dist/components/placeholders/image-placeholder.js +0 -88
- package/dist/components/placeholders/media-placeholder.js +0 -63
- package/dist/components/popover/popover.js +0 -207
- package/dist/components/radio/radio.js +0 -579
- package/dist/components/repeater/repeater-context.js +0 -5
- package/dist/components/repeater/repeater-item.js +0 -119
- package/dist/components/repeater/repeater.js +0 -280
- package/dist/components/responsive/mini-responsive.js +0 -498
- package/dist/components/responsive/responsive-legacy.js +0 -343
- package/dist/components/responsive/responsive.js +0 -580
- package/dist/components/responsive-preview/responsive-preview.js +0 -123
- package/dist/components/rich-label/rich-label.js +0 -66
- package/dist/components/select/async-multi-select.js +0 -157
- package/dist/components/select/async-single-select.js +0 -137
- package/dist/components/select/custom-select-default-components.js +0 -38
- package/dist/components/select/multi-select-components.js +0 -8
- package/dist/components/select/multi-select.js +0 -151
- package/dist/components/select/react-select-component-wrappers.js +0 -90
- package/dist/components/select/shared.js +0 -26
- package/dist/components/select/single-select.js +0 -131
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-select.js +0 -297
- package/dist/components/select/v2/shared.js +0 -24
- package/dist/components/select/v2/single-select.js +0 -990
- package/dist/components/slider/column-config-slider.js +0 -210
- package/dist/components/slider/slider.js +0 -343
- package/dist/components/slider/utils.js +0 -84
- package/dist/components/spacer/spacer.js +0 -97
- package/dist/components/tabs/tabs.js +0 -702
- package/dist/components/toggle/switch.js +0 -155
- package/dist/components/toggle/toggle.js +0 -64
- package/dist/components/toggle-button/toggle-button.js +0 -324
- package/dist/components/tooltip/tooltip.js +0 -525
- package/dist/context-D2KUdwNL.js +0 -92
- package/dist/default-i18n-CT_oS1Fy.js +0 -922
- package/dist/filterDOMProps-EDDcM64A.js +0 -28
- package/dist/icons/block-icon.js +0 -42
- package/dist/icons/generic-color-swatch.js +0 -113
- package/dist/icons/icons.js +0 -30371
- package/dist/icons/index.js +0 -11
- package/dist/icons/jsx-svg.js +0 -50
- package/dist/index-641ee5b8.esm-DIuJijyT.js +0 -3137
- package/dist/index-BKGQ6jGS.js +0 -44
- package/dist/index-CFozsmNS.js +0 -28321
- package/dist/index.js +0 -139
- package/dist/lite-DVmmD_-j.js +0 -7
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-Sp-JEFEX.js +0 -3744
- package/dist/number-GajL10e1.js +0 -36
- package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
- package/dist/react-select-async.esm-Bql4G5iV.js +0 -107
- package/dist/react-select.esm-B_TudhTU.js +0 -15
- package/dist/style-admin.js +0 -1
- package/dist/style-editor.js +0 -1
- package/dist/style.js +0 -1
- package/dist/textSelection-0UUS8Yfg.js +0 -46
- package/dist/useButton-Cg474OYB.js +0 -71
- package/dist/useEvent-B0b-6KBr.js +0 -23
- package/dist/useFocusRing-CV5l3lf6.js +0 -107
- package/dist/useFormReset-C5OggHsw.js +0 -22
- package/dist/useFormValidation-DhDNSjws.js +0 -224
- package/dist/useHover-DwDr6ozG.js +0 -900
- package/dist/useLabel-D7HkNEHT.js +0 -27
- package/dist/useLabels-D8cxd1Z8.js +0 -23
- package/dist/useListState-DVr6aYd_.js +0 -161
- package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
- package/dist/useNumberField-TwM0Z9D1.js +0 -1204
- package/dist/useNumberFormatter-321rAb4J.js +0 -13
- package/dist/usePress-Cucx-xSA.js +0 -664
- package/dist/useSingleSelectListState-CMGsRHHh.js +0 -38
- package/dist/useToggle-C0I3vs0g.js +0 -59
- package/dist/useToggleState-CmQX3SoX.js +0 -19
- package/dist/utilities/array-helpers.js +0 -56
- package/dist/utilities/debounce-throttle.js +0 -123
- package/dist/utilities/es-dash.js +0 -376
- package/dist/utilities/index.js +0 -27
- package/dist/utilities/text-helpers.js +0 -136
- package/dist/utils-DkCSC521.js +0 -370
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __ } from "../../../default-i18n-CT_oS1Fy.js";
|
|
3
|
-
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-BPLceDeW.js";
|
|
4
|
-
import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66, a as $d01f2c01039c0eec$export$72b9695b8216309a, b as $d01f2c01039c0eec$export$c02625b26074192c } from "../../../ComboBox-_RfyhwZw.js";
|
|
5
|
-
import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Input-BxpFEIXV.js";
|
|
6
|
-
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../../Label-icmbmNdI.js";
|
|
7
|
-
import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../../ListBox-Ca6hiCqz.js";
|
|
8
|
-
import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../../Dialog-8tYeQ9n4.js";
|
|
9
|
-
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../../Text-DVSAPY-K.js";
|
|
10
|
-
import { OptionItemBase } from "./shared.js";
|
|
11
|
-
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
|
-
import { unescapeHTML } from "../../../utilities/text-helpers.js";
|
|
17
|
-
import { c as clsx } from "../../../utils-DkCSC521.js";
|
|
18
|
-
/**
|
|
19
|
-
* Select menu with async loading.
|
|
20
|
-
*
|
|
21
|
-
* @component
|
|
22
|
-
* @param {Object} props - Component props.
|
|
23
|
-
* @param {string} [props.label] - Label of the component.
|
|
24
|
-
* @param {string} [props.help] - Help text of the component.
|
|
25
|
-
* @param {string} [props.icon] - Icon of the component.
|
|
26
|
-
* @param {string} [props.subtitle] - Subtitle of the component.
|
|
27
|
-
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to show to the right of the label.
|
|
28
|
-
* @param {boolean} [props.inline] - Whether the Select menu is displayed inline with the label, to the right.
|
|
29
|
-
* @param {{label: string, value: string, metadata: Object<string, any>?}} props.value - Current value of the select.
|
|
30
|
-
* @param {Function} props.onChange - Function to call when the value changes.
|
|
31
|
-
* @param {boolean} [props.clearable=false] - Whether the select is clearable.
|
|
32
|
-
* @param {boolean} [props.noSearch=false] - Whether the search is disabled.
|
|
33
|
-
* @param {boolean} [props.disabled=false] - Whether the select is disabled.
|
|
34
|
-
* @param {boolean} [props.keepMenuOpenAfterSelect=false] - Whether the menu stays open after an select.
|
|
35
|
-
* @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
|
|
36
|
-
* @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
|
-
* @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`
|
|
38
|
-
* @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
|
-
* @param {string} props.className - Classes to pass to the select menu.
|
|
40
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
41
|
-
*
|
|
42
|
-
* @returns {JSX.Element} The __ExperimentalAsyncSelect component.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* const [value, setValue] = useState(null);
|
|
46
|
-
*
|
|
47
|
-
* <__ExperimentalAsyncSelect
|
|
48
|
-
* label='Select items'
|
|
49
|
-
* fetchUrl={(searchText) => `https://api.example.com/items?q=${searchText}`}
|
|
50
|
-
* value={value}
|
|
51
|
-
* onChange={setValue}
|
|
52
|
-
* getLabel={(item) => item?.name}
|
|
53
|
-
* getValue={(item) => item?.id}
|
|
54
|
-
* />
|
|
55
|
-
*
|
|
56
|
-
* @preserve
|
|
57
|
-
*/
|
|
58
|
-
const __ExperimentalAsyncSelect = (props) => {
|
|
59
|
-
const {
|
|
60
|
-
label,
|
|
61
|
-
help,
|
|
62
|
-
icon,
|
|
63
|
-
subtitle,
|
|
64
|
-
actions,
|
|
65
|
-
inline,
|
|
66
|
-
value,
|
|
67
|
-
onChange,
|
|
68
|
-
noSearch = false,
|
|
69
|
-
disabled = false,
|
|
70
|
-
clearable = false,
|
|
71
|
-
className,
|
|
72
|
-
placeholder,
|
|
73
|
-
customMenuOption,
|
|
74
|
-
customValueDisplay,
|
|
75
|
-
processLoadedOptions = (options) => options,
|
|
76
|
-
fetchUrl,
|
|
77
|
-
fetchConfig = {},
|
|
78
|
-
getLabel,
|
|
79
|
-
getValue,
|
|
80
|
-
getMeta,
|
|
81
|
-
getIcon,
|
|
82
|
-
getSubtitle,
|
|
83
|
-
getData = (data) => data,
|
|
84
|
-
hidden,
|
|
85
|
-
...rest
|
|
86
|
-
} = props;
|
|
87
|
-
let list = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
|
|
88
|
-
// initialFilterText: value?.label,
|
|
89
|
-
async load({ signal, filterText: rawFilterText }) {
|
|
90
|
-
let filterText = rawFilterText.trim();
|
|
91
|
-
const res = await fetch(fetchUrl(filterText), { ...fetchConfig, signal });
|
|
92
|
-
const json = getData(await res.json());
|
|
93
|
-
const output = json == null ? void 0 : json.map((item) => {
|
|
94
|
-
const id = getValue(item);
|
|
95
|
-
const entry = { label: unescapeHTML(getLabel(item)), value: id };
|
|
96
|
-
if (getMeta) {
|
|
97
|
-
entry.meta = getMeta(item);
|
|
98
|
-
}
|
|
99
|
-
if (getSubtitle) {
|
|
100
|
-
entry.subtitle = unescapeHTML(getSubtitle(item));
|
|
101
|
-
}
|
|
102
|
-
return entry;
|
|
103
|
-
});
|
|
104
|
-
return {
|
|
105
|
-
items: output
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
let listItems = [...list.items];
|
|
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
|
-
}
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (list.filterText !== (value == null ? void 0 : value.label)) {
|
|
118
|
-
list.setFilterText(value == null ? void 0 : value.label);
|
|
119
|
-
}
|
|
120
|
-
if (!value && list.filterText) {
|
|
121
|
-
list.setFilterText("");
|
|
122
|
-
}
|
|
123
|
-
}, [value]);
|
|
124
|
-
const ref = useRef();
|
|
125
|
-
if (hidden) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return /* @__PURE__ */ jsxs(
|
|
129
|
-
$d01f2c01039c0eec$export$72b9695b8216309a,
|
|
130
|
-
{
|
|
131
|
-
onSelectionChange: (selected) => {
|
|
132
|
-
if (selected === null || selected === void 0) {
|
|
133
|
-
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
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const item = (list == null ? void 0 : list.getItem(selected)) ?? listItems.find((item2) => item2.value === selected);
|
|
141
|
-
if (!item) {
|
|
142
|
-
onChange(null);
|
|
143
|
-
list.setFilterText("");
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
list.setFilterText(item.label);
|
|
147
|
-
onChange(item);
|
|
148
|
-
},
|
|
149
|
-
allowsCustomValue: false,
|
|
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",
|
|
157
|
-
...rest,
|
|
158
|
-
children: [
|
|
159
|
-
/* @__PURE__ */ jsx(
|
|
160
|
-
BaseControl,
|
|
161
|
-
{
|
|
162
|
-
icon,
|
|
163
|
-
label,
|
|
164
|
-
subtitle,
|
|
165
|
-
help,
|
|
166
|
-
actions,
|
|
167
|
-
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
168
|
-
inline,
|
|
169
|
-
children: /* @__PURE__ */ jsxs(
|
|
170
|
-
"div",
|
|
171
|
-
{
|
|
172
|
-
className: clsx(
|
|
173
|
-
"es:relative es:flex es:max-w-80 es:items-center es:gap-1 es:p-1 es:focus-visible:outline-hidden es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
|
|
174
|
-
"es:h-9 es:rounded-lg es:border es:border-secondary-300 es:bg-white es:text-sm es:shadow-xs es:transition",
|
|
175
|
-
"es:any-focus:outline-hidden",
|
|
176
|
-
!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"
|
|
179
|
-
),
|
|
180
|
-
ref,
|
|
181
|
-
children: [
|
|
182
|
-
/* @__PURE__ */ jsx(
|
|
183
|
-
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
184
|
-
{
|
|
185
|
-
className: clsx(
|
|
186
|
-
"es:peer es:h-6 es:w-full es:grow es:rounded-sm es:p-1 es:pr-6 es:text-sm es:text-transparent es:transition",
|
|
187
|
-
"es:focus:text-current es:any-focus:outline-hidden",
|
|
188
|
-
"es:selection:bg-accent-500/20 es:selection:text-accent-950",
|
|
189
|
-
disabled && "es:bg-transparent es:text-secondary-400 es:selection:bg-transparent es:selection:text-transparent"
|
|
190
|
-
),
|
|
191
|
-
placeholder: placeholder ?? __("Select...", "eightshift-ui-components")
|
|
192
|
-
}
|
|
193
|
-
),
|
|
194
|
-
value && /* @__PURE__ */ jsxs(
|
|
195
|
-
"div",
|
|
196
|
-
{
|
|
197
|
-
className: clsx(
|
|
198
|
-
"es:pointer-events-none es:absolute es:bottom-0 es:left-2 es:top-0 es:my-auto es:flex es:select-none es:items-center es:overflow-hidden",
|
|
199
|
-
"es:has-[svg]:left-1 es:peer-data-[focused=true]:invisible es:peer-disabled:opacity-40",
|
|
200
|
-
clearable ? "es:right-16" : "es:right-6"
|
|
201
|
-
),
|
|
202
|
-
children: [
|
|
203
|
-
customValueDisplay && customValueDisplay(value),
|
|
204
|
-
!customValueDisplay && /* @__PURE__ */ jsx(
|
|
205
|
-
RichLabel,
|
|
206
|
-
{
|
|
207
|
-
icon: getIcon(value),
|
|
208
|
-
label: value == null ? void 0 : value.label,
|
|
209
|
-
subtitle: value == null ? void 0 : value.subtitle,
|
|
210
|
-
className: "es:[&_span]:overflow-hidden es:[&_span]:text-ellipsis es:[&_span]:text-nowrap"
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
),
|
|
216
|
-
clearable && /* @__PURE__ */ jsx(ClearButton, { disabled }),
|
|
217
|
-
/* @__PURE__ */ jsx($d2b4bc8c273e7be6$export$353f5b6fc5456de1, { className: clsx("es:group es:absolute es:bottom-0 es:right-0 es:top-0 es:my-auto es:size-6", disabled ? "es:text-secondary-300" : "es:text-secondary-500"), children: cloneElement(icons.dropdownCaretAlt, {
|
|
218
|
-
className: "es:w-4 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200",
|
|
219
|
-
"aria-hidden": true
|
|
220
|
-
}) })
|
|
221
|
-
]
|
|
222
|
-
}
|
|
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
|
-
),
|
|
235
|
-
placement: "bottom left",
|
|
236
|
-
triggerRef: ref,
|
|
237
|
-
children: [
|
|
238
|
-
!list.isLoading && list.items.length > 0 && /* @__PURE__ */ jsx($eed445e0843c11d0$export$41f133550aa26f48, { className: "es:space-y-0.5 es:p-1 es:any-focus:outline-hidden", children: (item) => {
|
|
239
|
-
return /* @__PURE__ */ jsxs(
|
|
240
|
-
OptionItemBase,
|
|
241
|
-
{
|
|
242
|
-
id: item.value,
|
|
243
|
-
className: item == null ? void 0 : item.className,
|
|
244
|
-
children: [
|
|
245
|
-
customMenuOption && customMenuOption(item),
|
|
246
|
-
!customMenuOption && /* @__PURE__ */ jsx(
|
|
247
|
-
RichLabel,
|
|
248
|
-
{
|
|
249
|
-
icon: (item == null ? void 0 : item.icon) ?? getIcon(item),
|
|
250
|
-
label: item == null ? void 0 : item.label,
|
|
251
|
-
subtitle: item.subtitle
|
|
252
|
-
}
|
|
253
|
-
)
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
} }),
|
|
258
|
-
list.isLoading && cloneElement(icons.loader, { className: "es:mx-auto es:my-4 es:animate-spin es:size-5.5 es:text-accent-700" }),
|
|
259
|
-
!list.isLoading && list.items.length === 0 && /* @__PURE__ */ jsx("div", { className: "es:flex es:p-2", children: /* @__PURE__ */ jsxs(
|
|
260
|
-
$514c0188e459b4c0$export$5f1af8db9871e1d6,
|
|
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
|
-
]
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
};
|
|
277
|
-
const ClearButton = ({ disabled }) => {
|
|
278
|
-
const state = useContext($d01f2c01039c0eec$export$c02625b26074192c);
|
|
279
|
-
const isEmpty = (state == null ? void 0 : state.selectedKey) === null || (state == null ? void 0 : state.inputValue) === "";
|
|
280
|
-
return /* @__PURE__ */ jsx(
|
|
281
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
282
|
-
{
|
|
283
|
-
"aria-label": __("Clear value", "eightshift-ui-components"),
|
|
284
|
-
className: clsx(
|
|
285
|
-
"es:mr-7 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
|
-
isEmpty ? "es:hidden" : "es:flex"
|
|
287
|
-
),
|
|
288
|
-
onPress: () => state == null ? void 0 : state.setSelectedKey(null),
|
|
289
|
-
slot: null,
|
|
290
|
-
isDisabled: disabled || isEmpty,
|
|
291
|
-
children: icons.clearAlt
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
export {
|
|
296
|
-
__ExperimentalAsyncSelect
|
|
297
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { a as $eed445e0843c11d0$export$a11e76429ed99b4 } from "../../../ListBox-Ca6hiCqz.js";
|
|
3
|
-
import { c as clsx } from "../../../utils-DkCSC521.js";
|
|
4
|
-
const OptionItemBase = (props) => {
|
|
5
|
-
var _a;
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
-
$eed445e0843c11d0$export$a11e76429ed99b4,
|
|
8
|
-
{
|
|
9
|
-
...props,
|
|
10
|
-
textValue: (_a = props == null ? void 0 : props.value) == null ? void 0 : _a.label,
|
|
11
|
-
className: clsx(
|
|
12
|
-
"es:flex es:min-h-9 es:select-none es:items-center es:gap-1 es:rounded es:p-2 es:transition",
|
|
13
|
-
"es:any-focus:outline-hidden",
|
|
14
|
-
"es:hover:bg-secondary-100 es:hover:outline-hidden",
|
|
15
|
-
"selected:es:bg-accent-600/15 selected:es:text-accent-950",
|
|
16
|
-
"es:focus-visible:bg-secondary-100 es:focus-visible:outline-hidden",
|
|
17
|
-
"es:active:bg-accent-700/15"
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
OptionItemBase
|
|
24
|
-
};
|