@eightshift/ui-components 5.6.1 → 6.0.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/{Button-CQ5ZZJ2w.js → Button-BXjXzdW_.js} +13 -13
- package/dist/{Dialog-BMgMUQuN.js → Dialog-D8bjn-nh.js} +404 -77
- package/dist/{FieldError-B8BgFmIQ.js → FieldError-DwBG6m1U.js} +2 -2
- package/dist/{FocusScope-B5vxRkHm.js → FocusScope-BMk5oZCk.js} +8 -8
- package/dist/{Heading-B5aEynOM.js → Heading-BmRX4BRL.js} +3 -3
- package/dist/{Hidden-rE6uR-lr.js → Hidden-Rfj-STx7.js} +4 -4
- package/dist/{Input-8yja_IHC.js → Input-CNNksOWg.js} +11 -11
- package/dist/{Label-DWVaNd2E.js → Label-D8a3eYb-.js} +4 -4
- package/dist/{List-BiAnh5G5.js → List-BGHOoFf0.js} +8 -8
- package/dist/{ListBox-DggfiuO_.js → ListBox-Dd37zMvs.js} +40 -41
- package/dist/{OverlayArrow-DraDOoRn.js → OverlayArrow-DokC40S3.js} +6 -6
- package/dist/{PortalProvider---wyKpMr.js → PortalProvider-CHPnqDSH.js} +2 -2
- package/dist/RadioGroup-BVFvITWO.js +371 -0
- package/dist/{SearchField-DWGdCvnn.js → SearchField-CHYnN-jt.js} +16 -16
- package/dist/{SelectionManager-B6-b5NM2.js → SelectionManager-N8X7T_4D.js} +44 -46
- package/dist/{SharedElementTransition-fML-zIv6.js → SharedElementTransition-BDT84GtD.js} +3 -3
- package/dist/{Slider-DfU6bRtH.js → Slider-CL5CM9S8.js} +23 -23
- package/dist/{Text-AxKZjtFm.js → Text-ztX6G1zR.js} +3 -3
- package/dist/{VisuallyHidden-CgnIuZJ2.js → VisuallyHidden-DTUuKFiI.js} +4 -4
- package/dist/assets/style-admin.css +12156 -2
- package/dist/assets/style-editor.css +12156 -2
- package/dist/assets/style.css +12162 -2
- package/dist/assets/wp-overrides/allow-full-width-blocks.css +6 -0
- package/dist/assets/wp-overrides/fix-label-text-case.css +29 -0
- package/dist/assets/wp-overrides/increase-sidebar-width.css +4 -0
- package/dist/assets/wp-overrides/make-block-messages-nicer.css +155 -0
- package/dist/assets/wp-overrides/replace-fonts.css +8 -0
- package/dist/assets/wp-overrides/restyle-tooltips.css +194 -0
- package/dist/assets/wp-overrides/round-corners.css +200 -0
- package/dist/assets/wp-overrides/unify-button-sizes.css +5 -0
- package/dist/clsx-DgYk2OaC.js +16 -0
- package/dist/{Color-WxFE7lQB.js → color-swatch-CFIuSPcO.js} +124 -6
- package/dist/components/animated-visibility/animated-visibility.js +25 -17
- package/dist/components/base-control/base-control.js +8 -5
- package/dist/components/base-control/container.js +204 -0
- package/dist/components/button/button.js +249 -155
- package/dist/components/checkbox/checkbox.js +96 -37
- package/dist/components/color-pickers/color-picker.js +16 -7
- package/dist/components/color-pickers/color-swatch.js +5 -57
- package/dist/components/color-pickers/gradient-editor.js +161 -138
- package/dist/components/color-pickers/solid-color-picker.js +308 -206
- package/dist/components/component-toggle/component-toggle.js +12 -8
- package/dist/components/container-panel/container-panel.js +54 -31
- package/dist/components/draggable/draggable-handle.js +8 -7
- package/dist/components/draggable/draggable.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +21 -12
- package/dist/components/draggable-list/draggable-list.js +19 -21
- package/dist/components/expandable/expandable.js +56 -28
- package/dist/components/index.js +7 -21
- package/dist/components/input-field/input-field.js +112 -35
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +181 -121
- package/dist/components/matrix-align/matrix-align.js +54 -20
- package/dist/components/menu/menu.js +26 -34
- package/dist/components/modal/modal.js +31 -28
- package/dist/components/notice/notice.js +45 -28
- package/dist/components/number-picker/number-picker.js +151 -101
- package/dist/components/option-select/option-select.js +40 -4
- package/dist/components/options-panel/options-panel.js +52 -25
- package/dist/components/placeholders/file-picker-shell.js +10 -9
- package/dist/components/placeholders/file-placeholder.js +14 -6
- package/dist/components/placeholders/image-placeholder.js +14 -4
- package/dist/components/placeholders/media-placeholder.js +11 -4
- package/dist/components/popover/popover.js +14 -11
- package/dist/components/portal-provider/portal-provider.js +1 -1
- package/dist/components/radio/radio.js +118 -429
- package/dist/components/repeater/repeater-item.js +7 -10
- package/dist/components/repeater/repeater.js +9 -15
- package/dist/components/responsive/mini-responsive.js +53 -61
- package/dist/components/responsive/responsive-legacy.js +1 -1
- package/dist/components/responsive/responsive.js +27 -27
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +5 -5
- package/dist/components/select/async-multi-select.js +467 -100
- package/dist/components/select/{v2/async-select.js → async-select.js} +182 -105
- package/dist/components/select/multi-select.js +437 -83
- package/dist/components/select/shared.js +14 -42
- package/dist/components/select/single-select.js +349 -54
- package/dist/components/slider/column-config-slider.js +138 -45
- package/dist/components/slider/slider.js +265 -205
- package/dist/components/slider/utils.js +32 -1
- package/dist/components/smart-image/smart-image.js +25 -4
- package/dist/components/smart-image/worker-inline.js +1 -1
- package/dist/components/spacer/spacer.js +2 -2
- package/dist/components/tabs/tabs.js +370 -101
- package/dist/components/toggle/switch.js +174 -39
- package/dist/components/toggle/toggle.js +6 -3
- package/dist/components/toggle-button/toggle-button.js +140 -56
- package/dist/components/tooltip/tooltip.js +27 -26
- package/dist/{context-DMOmz986.js → context-BQvmiUqb.js} +3 -3
- package/dist/{default-i18n-DBm-GqWM.js → default-i18n-CnQeC5Pl.js} +10 -10
- package/dist/{general-Ck8IV7xJ.js → general-B6pOveVp.js} +11 -10
- package/dist/icons/icons.js +28 -9
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/icons/spinner.js +3 -1
- package/dist/{index-Dq3gT5pW.js → index-BHpUy2Ix.js} +1 -1
- package/dist/{index-D8-Zjpbd.js → index-oFgxU4zs.js} +3 -3
- package/dist/index.js +6 -20
- package/dist/proxy-0B6wWuDe.js +7409 -0
- package/dist/{react-jsx-parser.min-VUl-CuCv.js → react-jsx-parser.min-B_hvYYa1.js} +5 -5
- package/dist/{Select-BvggcFOX.js → shared-DwjRce5e.js} +170 -36
- package/dist/{textSelection-DbCKqaw8.js → textSelection-CwHUtNVX.js} +1 -1
- package/dist/{useButton-v9ngEj50.js → useButton-DdZrS1Kz.js} +3 -3
- package/dist/{useEvent-BifIGnVS.js → useEvent-BD7Olibq.js} +1 -1
- package/dist/{useFilter-BlkUH1Ma.js → useFilter-bhxeEDg8.js} +1 -1
- package/dist/{useFocusRing-Cgm0R4Cf.js → useFocusRing-D3b7Kh4P.js} +1 -1
- package/dist/{useFormReset-yV9VVy9R.js → useFormReset-WUv2PdFO.js} +1 -1
- package/dist/{useFormValidation-CeNsUGWK.js → useFormValidation-DQeXkyLm.js} +2 -2
- package/dist/{useHover-BRDW3y7-.js → useHover-Bycb7BsD.js} +7 -7
- package/dist/{useLabel-C8umX0gk.js → useLabel-Bnv4-T24.js} +2 -2
- package/dist/{useLabels-Cdxi6JSa.js → useLabels-B49ptFDX.js} +1 -1
- package/dist/{useListState-RdLrYsMP.js → useListState-ZKhRO8ML.js} +1 -1
- package/dist/{useLocalizedStringFormatter-eaZiN2tE.js → useLocalizedStringFormatter-NETP-8H8.js} +1 -1
- package/dist/{useNumberField-D16dDfYF.js → useNumberField-D2fUHql3.js} +10 -10
- package/dist/{useNumberFormatter-BCmkV-7c.js → useNumberFormatter-DGvuRCn7.js} +1 -1
- package/dist/{usePress-DJskZBH9.js → usePress-B8OteQMu.js} +6 -6
- package/dist/{useSingleSelectListState-n0AVMr3Y.js → useSingleSelectListState-BBTu4shO.js} +2 -2
- package/dist/{useToggle-DSBDAfdw.js → useToggle-BZhaYwZl.js} +4 -4
- package/dist/{useToggleState-CzN79ary.js → useToggleState-VkXJjsru.js} +1 -1
- package/dist/utilities/general.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/{utils-cvK1vxO7.js → utils-DGpXyJOJ.js} +29 -42
- package/dist/workers/image-analysis.worker.js +3 -3
- package/package.json +26 -22
- package/dist/ColorSwatch-xVS3rMYS.js +0 -66
- package/dist/Select-ef7c0426.esm-CmTkSxDx.js +0 -2474
- package/dist/Separator-B-xeqOkC.js +0 -344
- package/dist/assets/wp-font-enhancements.css +0 -2
- package/dist/assets/wp-ui-enhancements.css +0 -2
- package/dist/components/select/async-single-select.js +0 -138
- 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/react-select-component-wrappers.js +0 -90
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-multi-select.js +0 -432
- package/dist/components/select/v2/multi-select.js +0 -403
- package/dist/components/select/v2/shared.js +0 -69
- package/dist/components/select/v2/single-select.js +0 -358
- package/dist/index-641ee5b8.esm-DVp0njHa.js +0 -3139
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-CT_W0Cy9.js +0 -3744
- package/dist/react-select-async.esm-Zl1LPaPb.js +0 -107
- package/dist/react-select.esm-Bu36HujU.js +0 -15
- package/dist/useDragAndDrop-C08ZXv4F.js +0 -3925
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
2
|
-
const controlStyles = {
|
|
3
|
-
base: "es:border es:border-gray-300 es:rounded-10 es:bg-white es:text-sm es:transition es:group es:shadow-sm es:min-h-10! es:inset-ring es:inset-ring-secondary-100",
|
|
4
|
-
focus: "es:ring-2 es:ring-accent-500/50 es:border-accent-500!"
|
|
5
|
-
};
|
|
6
|
-
const placeholderStyles = "es:text-gray-400 es:ml-1";
|
|
7
|
-
const selectInputStyles = "es:any-focus:outline-hidden es:[&_input]:shadow-none! es:[&_input:focus]:shadow-none!";
|
|
8
|
-
const valueContainerStyles = "es:gap-1 es:ml-1.25 es:my-1 es:overflow-visible!";
|
|
9
|
-
const singleValueStyles = "es:ml-0.5 es:px-1";
|
|
10
|
-
const multiValueStyles = clsx(
|
|
11
|
-
"es:bg-gray-100 es:rounded-md es:py-1 es:px-1.5 es:border es:border-gray-100 hover:border-gray-300 es:items-center es:gap-1.5 es:transition es:overflow-visible es:max-w-40",
|
|
12
|
-
"es:in-focus-visible:outline-hidden es:in-focus-visible:ring",
|
|
13
|
-
"es:in-focus-visible:ring-accent-500/50"
|
|
14
|
-
);
|
|
15
|
-
const multiValueLabelStyles = "es:select-none";
|
|
16
|
-
const multiValueRemoveStyles = "es:hover:bg-red-500/15 es:hover:text-red-900 es:text-gray-500 es:rounded es:p-0.5 es:icon:size-3.5 es:icon:stroke-[1.5] es:transition";
|
|
17
|
-
const clearIndicatorStyles = "es:text-gray-500 es:p-1 es:rounded-md hover:bg-red-50 hover:text-red-800 es:transition";
|
|
18
|
-
const dropdownIndicatorStyles = "es:text-gray-500 es:px-1 es:group-hover:text-black es:icon:transition-transform es:icon:duration-500 es:icon:size-5";
|
|
19
|
-
const menuStyles = "es:rounded-2xl es:border es:border-gray-200 es:bg-white es:shadow-lg es:mt-1 es:text-sm es:overflow-x-hidden es:min-w-48";
|
|
20
|
-
const optionStyles = {
|
|
21
|
-
base: "es:p-2 es:flex! es:items-center es:gap-1.5 es:text-gray-800 es:rounded-xl es:icon:size-5 es:icon:text-gray-500 es:transition es:mx-1 es:first:mt-1 es:last:mb-1 es:w-auto! es:min-h-9",
|
|
22
|
-
focus: "es:bg-gray-100 es:active:bg-accent-700/15",
|
|
23
|
-
selected: "es:bg-accent-600/15 es:text-accent-950"
|
|
24
|
-
};
|
|
25
|
-
const noOptionsMessageStyles = "es:text-gray-400 es:p-4";
|
|
26
|
-
const groupHeadingStyles = "es:ml-3 es:mt-3 es:mb-1 es:text-gray-500/80 es:empty:hidden";
|
|
27
|
-
const groupStyles = "es:border-b es:border-b-gray-200 es:last:border-b-0";
|
|
28
|
-
const loadingMessageStyles = "es:p-4";
|
|
29
|
-
const eightshiftSelectClasses = {
|
|
30
|
-
clearIndicator: () => clearIndicatorStyles,
|
|
31
|
-
control: ({ isFocused }) => clsx(isFocused && controlStyles.focus, controlStyles.base),
|
|
32
|
-
dropdownIndicator: () => dropdownIndicatorStyles,
|
|
33
|
-
group: () => groupStyles,
|
|
34
|
-
groupHeading: () => groupHeadingStyles,
|
|
35
|
-
input: () => selectInputStyles,
|
|
36
|
-
menu: () => menuStyles,
|
|
37
|
-
multiValue: () => multiValueStyles,
|
|
38
|
-
multiValueLabel: () => multiValueLabelStyles,
|
|
39
|
-
multiValueRemove: () => multiValueRemoveStyles,
|
|
40
|
-
noOptionsMessage: () => noOptionsMessageStyles,
|
|
41
|
-
option: ({ isFocused, isSelected }) => clsx(isFocused && optionStyles.focus, isSelected && optionStyles.selected, optionStyles.base),
|
|
42
|
-
placeholder: () => placeholderStyles,
|
|
43
|
-
singleValue: () => singleValueStyles,
|
|
44
|
-
valueContainer: () => valueContainerStyles,
|
|
45
|
-
loadingMessage: () => loadingMessageStyles
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
eightshiftSelectClasses
|
|
49
|
-
};
|
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __ } from "../../../default-i18n-DBm-GqWM.js";
|
|
3
|
-
import { BaseControl } from "../../base-control/base-control.js";
|
|
4
|
-
import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../../SearchField-DWGdCvnn.js";
|
|
5
|
-
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../../Button-CQ5ZZJ2w.js";
|
|
6
|
-
import { g as $de32f1b87079253c$export$2e1e1122cf0cba88, e as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../../Dialog-BMgMUQuN.js";
|
|
7
|
-
import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../../Input-8yja_IHC.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-DggfiuO_.js";
|
|
10
|
-
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../../Text-AxKZjtFm.js";
|
|
11
|
-
import { $ as $d8f176866e6dc039$export$2cfc5be7a55829f6 } from "../../../useDragAndDrop-C08ZXv4F.js";
|
|
12
|
-
import { useRef, useEffect, cloneElement } from "react";
|
|
13
|
-
import { icons } from "../../../icons/icons.js";
|
|
14
|
-
import "../../../react-jsx-parser.min-VUl-CuCv.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-D52mQcrH.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 {Function} [props.fetchUrl] - Function to get the URL for fetching data. Provides typed search text if entered. `(searchText: string) => string`
|
|
44
|
-
* @param {Object} [props.fetchConfig] - Configuration object for the fetch request, passed to the `fetch` function.
|
|
45
|
-
* @param {Function} [props.fetchFunction] - Allows overriding the default fetch function. `fetchFunction: (url: string, fetchOptions: Object<string, any>, searchText?: string) => Promise<Object<string, any>>`
|
|
46
|
-
* @param {Function} [props.processLoadedOptions] - Allows processing the options fetched from the source. `(options: Object<string, any>[]) => Object<string, any>[]`
|
|
47
|
-
* @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`
|
|
48
|
-
* @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`
|
|
49
|
-
* @param {JSX.Element} [props.customDropdownArrow] - If provided, replaces the default dropdown arrow indicator.
|
|
50
|
-
* @param {string} props.className - Classes to pass to the select menu.
|
|
51
|
-
* @param {boolean} [props.noMinWidth=false] - If `true`, the select menu will not have a minimum width.
|
|
52
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
53
|
-
*
|
|
54
|
-
* @returns {JSX.Element} The __AsyncMultiSelectNext component.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* const [value, setValue] = useState(null);
|
|
58
|
-
*
|
|
59
|
-
* <__AsyncMultiSelectNext
|
|
60
|
-
* label='Select items'
|
|
61
|
-
* value={value}
|
|
62
|
-
* onChange={setValue}
|
|
63
|
-
* fetchUrl={(searchText) => `https://api.example.com/items?search=${searchText}`}
|
|
64
|
-
* getLabel={(item) => item?.label}
|
|
65
|
-
* getValue={(item) => item?.id}
|
|
66
|
-
* getIcon={() => icons.emptyCircle}
|
|
67
|
-
* />
|
|
68
|
-
*
|
|
69
|
-
* @preserve
|
|
70
|
-
*/
|
|
71
|
-
const __AsyncMultiSelectNext = (props) => {
|
|
72
|
-
const {
|
|
73
|
-
label,
|
|
74
|
-
help,
|
|
75
|
-
icon,
|
|
76
|
-
subtitle,
|
|
77
|
-
actions,
|
|
78
|
-
inline,
|
|
79
|
-
value,
|
|
80
|
-
onChange,
|
|
81
|
-
clearable,
|
|
82
|
-
disabled,
|
|
83
|
-
placeholder = __("Select...", "eightshift-ui-components"),
|
|
84
|
-
fetchUrl,
|
|
85
|
-
fetchConfig = {},
|
|
86
|
-
fetchFunction,
|
|
87
|
-
getLabel = (item) => item?.label,
|
|
88
|
-
getValue = (item) => item?.value,
|
|
89
|
-
getMeta,
|
|
90
|
-
getIcon,
|
|
91
|
-
getSubtitle,
|
|
92
|
-
getData = (data) => data,
|
|
93
|
-
customMenuOption,
|
|
94
|
-
customValueDisplay,
|
|
95
|
-
customDropdownArrow,
|
|
96
|
-
className,
|
|
97
|
-
noMinWidth,
|
|
98
|
-
hidden,
|
|
99
|
-
processLoadedOptions,
|
|
100
|
-
...rest
|
|
101
|
-
} = props;
|
|
102
|
-
const list = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
|
|
103
|
-
initialSelectedKeys: Array.isArray(value) ? value.map((item) => item?.value) : [],
|
|
104
|
-
getKey: (item) => item.value,
|
|
105
|
-
async load({ signal, filterText }) {
|
|
106
|
-
let json = [];
|
|
107
|
-
if (fetchFunction) {
|
|
108
|
-
const res = await fetchFunction(filterText, signal);
|
|
109
|
-
json = processLoadedOptions ? processLoadedOptions(getData(res)) : getData(res);
|
|
110
|
-
} else {
|
|
111
|
-
const res = await fetch(fetchUrl(filterText), { ...fetchConfig, signal });
|
|
112
|
-
json = processLoadedOptions ? processLoadedOptions(getData(await res.json())) : getData(res);
|
|
113
|
-
}
|
|
114
|
-
const output = json?.map((item, index) => {
|
|
115
|
-
const id = getValue?.(item) ?? index;
|
|
116
|
-
const entry = { label: unescapeHTML(getLabel?.(item) ?? ""), value: id };
|
|
117
|
-
if (getMeta) {
|
|
118
|
-
entry.meta = getMeta(item);
|
|
119
|
-
}
|
|
120
|
-
if (getSubtitle) {
|
|
121
|
-
entry.subtitle = unescapeHTML(getSubtitle(item));
|
|
122
|
-
}
|
|
123
|
-
return entry;
|
|
124
|
-
});
|
|
125
|
-
if (filterText.length > 0) {
|
|
126
|
-
return {
|
|
127
|
-
items: output
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const extra = value?.map((val) => {
|
|
131
|
-
if (output?.find((item) => item.value === val?.value)) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
return val;
|
|
135
|
-
})?.filter(Boolean) ?? [];
|
|
136
|
-
return {
|
|
137
|
-
items: [...output, ...extra]
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const handleSelectionChange = (rawSelected) => {
|
|
142
|
-
const selected = list.filterText.length > 0 ? /* @__PURE__ */ new Set([...value?.map((item) => item?.value) ?? [], ...rawSelected]) : rawSelected;
|
|
143
|
-
list.filterText = "";
|
|
144
|
-
if (selected === null || selected === void 0) {
|
|
145
|
-
onChange(null);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (selected.size === 0) {
|
|
149
|
-
onChange([]);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const selectedValues = [...selected].map((item) => {
|
|
153
|
-
const option = list.items.find((option2) => option2.value === item) || value.find((option2) => option2.value === item);
|
|
154
|
-
if (!option) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
...option
|
|
159
|
-
};
|
|
160
|
-
}).filter(Boolean);
|
|
161
|
-
onChange(selectedValues);
|
|
162
|
-
};
|
|
163
|
-
const ref = useRef();
|
|
164
|
-
let { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6({
|
|
165
|
-
getItems: (keys) => [...keys].map((key) => ({ "text/plain": key, text: value.find((item) => item.value === key)?.label ?? key })),
|
|
166
|
-
onReorder(e) {
|
|
167
|
-
handleSelectionChange(
|
|
168
|
-
new Set(
|
|
169
|
-
moveArrayItem(
|
|
170
|
-
value?.map((item) => item?.value),
|
|
171
|
-
[...e.keys][0],
|
|
172
|
-
e.target.key,
|
|
173
|
-
e.target.dropPosition
|
|
174
|
-
)
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
},
|
|
178
|
-
renderDragPreview(items) {
|
|
179
|
-
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: [
|
|
180
|
-
truncateEnd(items[0]["text"], 20),
|
|
181
|
-
items.length > 1 && /* @__PURE__ */ jsx("span", { className: "badge", children: items.length })
|
|
182
|
-
] });
|
|
183
|
-
},
|
|
184
|
-
renderDropIndicator(target) {
|
|
185
|
-
return /* @__PURE__ */ jsx(
|
|
186
|
-
$612b8eb6cb90e02d$export$62ed72bc21f6b8a6,
|
|
187
|
-
{
|
|
188
|
-
target,
|
|
189
|
-
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"
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
|
-
isDisabled: disabled || value.length < 2
|
|
194
|
-
});
|
|
195
|
-
useEffect(() => {
|
|
196
|
-
if (list.selectedKeys.size !== (value ?? []).length) {
|
|
197
|
-
list.setSelectedKeys(new Set(value?.map((item) => item?.value)));
|
|
198
|
-
list.setFilterText("");
|
|
199
|
-
}
|
|
200
|
-
}, [value]);
|
|
201
|
-
if (hidden) {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
return /* @__PURE__ */ jsx(
|
|
205
|
-
BaseControl,
|
|
206
|
-
{
|
|
207
|
-
label,
|
|
208
|
-
icon,
|
|
209
|
-
subtitle,
|
|
210
|
-
actions,
|
|
211
|
-
help,
|
|
212
|
-
inline,
|
|
213
|
-
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
214
|
-
...rest,
|
|
215
|
-
children: /* @__PURE__ */ jsxs(
|
|
216
|
-
$de32f1b87079253c$export$2e1e1122cf0cba88,
|
|
217
|
-
{
|
|
218
|
-
onOpenChange: (isOpen) => {
|
|
219
|
-
if (!isOpen) {
|
|
220
|
-
list.setFilterText("");
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
children: [
|
|
224
|
-
/* @__PURE__ */ jsxs(
|
|
225
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
226
|
-
{
|
|
227
|
-
"aria-label": __("Select items", "eightshift-ui-components"),
|
|
228
|
-
className: clsx(
|
|
229
|
-
"es:group",
|
|
230
|
-
"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",
|
|
231
|
-
"es:min-h-9 es:rounded-10 es:border es:border-secondary-300 es:bg-white es:text-sm es:shadow-sm es:transition",
|
|
232
|
-
"es:inset-ring es:inset-ring-secondary-100",
|
|
233
|
-
"es:any-focus:outline-hidden",
|
|
234
|
-
!noMinWidth && "es:min-w-48",
|
|
235
|
-
!inline && "es:w-full",
|
|
236
|
-
disabled && "es:select-none es:shadow-none!",
|
|
237
|
-
"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",
|
|
238
|
-
className
|
|
239
|
-
),
|
|
240
|
-
ref,
|
|
241
|
-
children: [
|
|
242
|
-
/* @__PURE__ */ jsx(
|
|
243
|
-
$eed445e0843c11d0$export$41f133550aa26f48,
|
|
244
|
-
{
|
|
245
|
-
"aria-label": __("Selected items", "eightshift-ui-components"),
|
|
246
|
-
layout: "grid",
|
|
247
|
-
items: value,
|
|
248
|
-
selectionMode: "none",
|
|
249
|
-
dependencies: [value],
|
|
250
|
-
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",
|
|
251
|
-
renderEmptyState: () => /* @__PURE__ */ jsx("div", { className: "es:text-secondary-500 es:pl-1.5 es:flex es:items-center", children: placeholder }),
|
|
252
|
-
dragAndDropHooks,
|
|
253
|
-
children: (item) => /* @__PURE__ */ jsxs(
|
|
254
|
-
$eed445e0843c11d0$export$a11e76429ed99b4,
|
|
255
|
-
{
|
|
256
|
-
id: item?.value,
|
|
257
|
-
textValue: item?.label,
|
|
258
|
-
className: clsx(
|
|
259
|
-
"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",
|
|
260
|
-
!disabled && value.size >= 2 && "es:cursor-move"
|
|
261
|
-
),
|
|
262
|
-
children: [
|
|
263
|
-
customValueDisplay && customValueDisplay(truncateEnd(item?.label, 20), item),
|
|
264
|
-
!customValueDisplay && /* @__PURE__ */ jsx($514c0188e459b4c0$export$5f1af8db9871e1d6, { slot: "label", children: truncateEnd(item?.label, 20) })
|
|
265
|
-
]
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsxs("div", { className: "es:shrink-0 es:ml-auto es:peer-has-dragging:hidden", children: [
|
|
271
|
-
!customDropdownArrow && cloneElement(icons.dropdownCaretAlt, {
|
|
272
|
-
className: "es:shrink-0 es:w-4 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200"
|
|
273
|
-
}),
|
|
274
|
-
customDropdownArrow && /* @__PURE__ */ jsx(
|
|
275
|
-
"div",
|
|
276
|
-
{
|
|
277
|
-
"aria-hidden": "true",
|
|
278
|
-
className: "es:shrink-0 es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200",
|
|
279
|
-
children: customDropdownArrow
|
|
280
|
-
}
|
|
281
|
-
)
|
|
282
|
-
] })
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
),
|
|
286
|
-
/* @__PURE__ */ jsx(
|
|
287
|
-
$07b14b47974efb58$export$5b6b19405a83ff9d,
|
|
288
|
-
{
|
|
289
|
-
"aria-label": __("Items", "eightshift-ui-components"),
|
|
290
|
-
className: ({ isEntering, isExiting }) => clsx(
|
|
291
|
-
"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",
|
|
292
|
-
"es:any-focus:outline-hidden",
|
|
293
|
-
"es:motion-safe:motion-duration-200 es:motion-safe:motion-ease-spring-bouncy",
|
|
294
|
-
"es:placement-bottom:origin-top-left es:placement-top:origin-bottom-left",
|
|
295
|
-
"es:placement-left:origin-right es:placement-right:origin-left",
|
|
296
|
-
isEntering && "es:motion-safe:motion-scale-in-95 es:motion-opacity-in-0",
|
|
297
|
-
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%]",
|
|
298
|
-
isExiting && "es:motion-safe:motion-scale-out-95 es:motion-opacity-out-0",
|
|
299
|
-
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%]"
|
|
300
|
-
),
|
|
301
|
-
placement: "bottom left",
|
|
302
|
-
maxHeight: 360,
|
|
303
|
-
triggerRef: ref,
|
|
304
|
-
children: /* @__PURE__ */ jsxs(
|
|
305
|
-
$d2f53cda644affe3$export$2f2b9559550c7bbc,
|
|
306
|
-
{
|
|
307
|
-
inputValue: list.filterText,
|
|
308
|
-
onInputChange: list.setFilterText,
|
|
309
|
-
children: [
|
|
310
|
-
/* @__PURE__ */ jsxs(
|
|
311
|
-
$440f4836bcb56932$export$b94867ecbd698f21,
|
|
312
|
-
{
|
|
313
|
-
"aria-label": __("Search", "eightshift-ui-components"),
|
|
314
|
-
className: "es:flex es:items-center es:bg-secondary-100 es:m-2 es:rounded-lg es:relative es:placeholder:text-secondary-500",
|
|
315
|
-
autoFocus: true,
|
|
316
|
-
children: [
|
|
317
|
-
/* @__PURE__ */ jsx(
|
|
318
|
-
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
319
|
-
{
|
|
320
|
-
placeholder: __("Search...", "eightshift-ui-components"),
|
|
321
|
-
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"
|
|
322
|
-
}
|
|
323
|
-
),
|
|
324
|
-
/* @__PURE__ */ jsx(
|
|
325
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
326
|
-
{
|
|
327
|
-
"aria-label": __("Clear", "eightshift-ui-components"),
|
|
328
|
-
className: clsx(
|
|
329
|
-
"es:absolute es:right-2 es:top-0 es:bottom-0 es:my-auto",
|
|
330
|
-
"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",
|
|
331
|
-
"es:peer-placeholder-shown:opacity-0"
|
|
332
|
-
),
|
|
333
|
-
children: icons.clearAlt
|
|
334
|
-
}
|
|
335
|
-
)
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
),
|
|
339
|
-
/* @__PURE__ */ jsx("div", { className: "es:w-full es:h-px es:bg-secondary-200 es:shrink-0" }),
|
|
340
|
-
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 es:motion-preset-spin es:motion-duration-1500" }) }),
|
|
341
|
-
/* @__PURE__ */ jsx(
|
|
342
|
-
$eed445e0843c11d0$export$41f133550aa26f48,
|
|
343
|
-
{
|
|
344
|
-
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"),
|
|
345
|
-
items: list.items,
|
|
346
|
-
selectedKeys: list.selectedKeys,
|
|
347
|
-
selectionMode: "multiple",
|
|
348
|
-
selectionBehavior: "toggle",
|
|
349
|
-
onSelectionChange: (selected) => {
|
|
350
|
-
list.setSelectedKeys(selected);
|
|
351
|
-
handleSelectionChange(selected);
|
|
352
|
-
},
|
|
353
|
-
dependencies: [value],
|
|
354
|
-
renderEmptyState: () => /* @__PURE__ */ jsx(
|
|
355
|
-
RichLabel,
|
|
356
|
-
{
|
|
357
|
-
icon: icons.searchEmpty,
|
|
358
|
-
label: __("No results", "eightshift-ui-components"),
|
|
359
|
-
subtitle: __("Try a different search term", "eightshift-ui-components"),
|
|
360
|
-
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",
|
|
361
|
-
iconClassName: "es:text-accent-700 es:icon:size-7!",
|
|
362
|
-
noColor: true
|
|
363
|
-
}
|
|
364
|
-
),
|
|
365
|
-
children: (item) => {
|
|
366
|
-
let icon2 = getIcon ? getIcon(item) : item?.icon ?? null;
|
|
367
|
-
if (typeof item?.icon === "string") {
|
|
368
|
-
icon2 = icons?.[item.icon] ?? null;
|
|
369
|
-
}
|
|
370
|
-
return /* @__PURE__ */ jsxs(
|
|
371
|
-
OptionItemBase,
|
|
372
|
-
{
|
|
373
|
-
id: item?.value,
|
|
374
|
-
className: item?.className,
|
|
375
|
-
selectIndicator: true,
|
|
376
|
-
children: [
|
|
377
|
-
customMenuOption && customMenuOption(item),
|
|
378
|
-
!customMenuOption && /* @__PURE__ */ jsx(
|
|
379
|
-
RichLabel,
|
|
380
|
-
{
|
|
381
|
-
icon: icon2,
|
|
382
|
-
label: item?.label,
|
|
383
|
-
subtitle: item?.subtitle,
|
|
384
|
-
noColor: true
|
|
385
|
-
}
|
|
386
|
-
)
|
|
387
|
-
]
|
|
388
|
-
}
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
),
|
|
393
|
-
clearable && value.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
394
|
-
/* @__PURE__ */ jsx("div", { className: "es:w-full es:h-px es:bg-secondary-200 es:shrink-0" }),
|
|
395
|
-
/* @__PURE__ */ jsx(
|
|
396
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
397
|
-
{
|
|
398
|
-
slot: "close",
|
|
399
|
-
onPress: () => handleSelectionChange([]),
|
|
400
|
-
className: clsx(
|
|
401
|
-
"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",
|
|
402
|
-
"es:any-focus:outline-hidden es:overflow-clip",
|
|
403
|
-
"es:not-selected:hover:bg-secondary-100 es:not-selected:hover:outline-hidden",
|
|
404
|
-
"es:selected:bg-accent-600/15 es:selected:text-accent-950",
|
|
405
|
-
"es:selected:focus-visible:inset-ring es:selected:focus-visible:inset-ring-accent-600/30",
|
|
406
|
-
"es:not-selected:focus-visible:bg-secondary-100 es:not-selected:focus-visible:outline-hidden",
|
|
407
|
-
"es:active:bg-accent-700/15"
|
|
408
|
-
),
|
|
409
|
-
children: /* @__PURE__ */ jsx(
|
|
410
|
-
RichLabel,
|
|
411
|
-
{
|
|
412
|
-
icon: icons.clearAlt,
|
|
413
|
-
label: __("Clear selection", "eightshift-ui-components")
|
|
414
|
-
}
|
|
415
|
-
)
|
|
416
|
-
}
|
|
417
|
-
)
|
|
418
|
-
] })
|
|
419
|
-
]
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
}
|
|
423
|
-
)
|
|
424
|
-
]
|
|
425
|
-
}
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
);
|
|
429
|
-
};
|
|
430
|
-
export {
|
|
431
|
-
__AsyncMultiSelectNext
|
|
432
|
-
};
|