@eightshift/ui-components 5.6.1 → 6.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/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,10 +1,20 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator } from "./custom-select-default-components.js";
|
|
4
|
-
import { getValue } from "./shared.js";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
|
|
5
3
|
import { BaseControl } from "../base-control/base-control.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CHYnN-jt.js";
|
|
5
|
+
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-BXjXzdW_.js";
|
|
6
|
+
import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-CNNksOWg.js";
|
|
7
|
+
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-D8a3eYb-.js";
|
|
8
|
+
import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-Dd37zMvs.js";
|
|
9
|
+
import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-D8bjn-nh.js";
|
|
10
|
+
import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-DwjRce5e.js";
|
|
11
|
+
import { useRef, cloneElement } from "react";
|
|
12
|
+
import { icons } from "../../icons/icons.js";
|
|
13
|
+
import "../../react-jsx-parser.min-B_hvYYa1.js";
|
|
14
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
15
|
+
import { RichLabel } from "../rich-label/rich-label.js";
|
|
16
|
+
import { c as cva } from "../../index-BHpUy2Ix.js";
|
|
17
|
+
import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-bhxeEDg8.js";
|
|
8
18
|
/**
|
|
9
19
|
* Select menu.
|
|
10
20
|
*
|
|
@@ -21,19 +31,22 @@ import { c as components } from "../../index-641ee5b8.esm-DVp0njHa.js";
|
|
|
21
31
|
* @param {Function} props.onChange - Function to call when the value changes.
|
|
22
32
|
* @param {boolean} [props.simpleValue=false] - If `true`, instead of using a `{label: '', value: ''}` value type, a string is used (just the value).
|
|
23
33
|
* @param {boolean} [props.clearable] - Whether the select is clearable.
|
|
24
|
-
* @param {boolean} [props.noSearch] - Whether the search is disabled.
|
|
25
34
|
* @param {boolean} [props.disabled] - Whether the select is disabled.
|
|
26
|
-
* @param {boolean} [props.keepMenuOpenAfterSelect] - Whether the menu stays open after an select.
|
|
27
35
|
* @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
|
|
28
36
|
* @param {JSX.Element} [props.customMenuOption] - If provided, replaces the default item in the dropdown menu (react-select's `components.Option`).
|
|
29
37
|
* @param {JSX.Element} [props.customValueDisplay] - If provided, replaces the default current value display of each selected item (react-select's `components.MultiValue`).
|
|
30
38
|
* @param {JSX.Element} [props.customDropdownArrow] - If provided, replaces the default dropdown arrow indicator.
|
|
31
|
-
* @param {JSX.Element} [props.customClearIndicator] - If provided, replaces the default 'Clear all' button.
|
|
32
39
|
* @param {string} [props.className] - Classes to pass to the select menu.
|
|
40
|
+
* @param {boolean} [props.noMinWidth=false] - If `true`, the select menu will not have a minimum width.
|
|
41
|
+
* @param {boolean} [props.searchable] - If `true`, the menu will allow searching through the options.
|
|
42
|
+
* @param {boolean} [props.flat] - If `true`, component will look more flat. Useful for nested layer of controls.
|
|
43
|
+
* @param {SelectSize} [props.size='default'] - Sets the size of the input field.
|
|
33
44
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
34
45
|
*
|
|
35
46
|
* @returns {JSX.Element} The Select component.
|
|
36
47
|
*
|
|
48
|
+
* @typedef {'small' | 'medium' | 'default' | 'large'} SelectSize
|
|
49
|
+
*
|
|
37
50
|
* @example
|
|
38
51
|
* const [value, setValue] = useState(null);
|
|
39
52
|
*
|
|
@@ -43,7 +56,7 @@ import { c as components } from "../../index-641ee5b8.esm-DVp0njHa.js";
|
|
|
43
56
|
* { label: 'Option 3', value: 'option-3' },
|
|
44
57
|
* ];
|
|
45
58
|
*
|
|
46
|
-
* <
|
|
59
|
+
* <Select
|
|
47
60
|
* label='Select items'
|
|
48
61
|
* options={loadOptions}
|
|
49
62
|
* value={value}
|
|
@@ -65,63 +78,345 @@ const Select = (props) => {
|
|
|
65
78
|
options,
|
|
66
79
|
simpleValue = false,
|
|
67
80
|
disabled = false,
|
|
68
|
-
noSearch = false,
|
|
69
81
|
clearable = false,
|
|
70
|
-
|
|
71
|
-
placeholder,
|
|
82
|
+
placeholder = __("Select...", "eightshift-ui-components"),
|
|
72
83
|
customMenuOption,
|
|
73
84
|
customValueDisplay,
|
|
74
85
|
customDropdownArrow,
|
|
75
|
-
customClearIndicator,
|
|
76
86
|
className,
|
|
87
|
+
flat,
|
|
88
|
+
size = "default",
|
|
89
|
+
noMinWidth = false,
|
|
90
|
+
searchable,
|
|
77
91
|
hidden,
|
|
78
|
-
...
|
|
92
|
+
...rest
|
|
79
93
|
} = props;
|
|
94
|
+
const ref = useRef();
|
|
95
|
+
const currentValue = simpleValue ? value ?? null : value?.value ?? null;
|
|
96
|
+
const { contains } = $bb77f239b46e8c72$export$3274cf84b703fff({ sensitivity: "base" });
|
|
80
97
|
if (hidden) {
|
|
81
98
|
return null;
|
|
82
99
|
}
|
|
100
|
+
const selectClass = cva(
|
|
101
|
+
[
|
|
102
|
+
"es:relative",
|
|
103
|
+
"es:flex es:items-center es:gap-px",
|
|
104
|
+
"es:leading-none",
|
|
105
|
+
"es:rounded-lg es:hover:rounded-xl es:has-focus-visible:rounded-2xl es:group-open:rounded-2xl",
|
|
106
|
+
"es:transition-plus",
|
|
107
|
+
"es:any-focus:outline-hidden",
|
|
108
|
+
"es:inset-ring",
|
|
109
|
+
"es:has-focus-visible:ring-2 es:has-focus-visible:ring-accent-500/30",
|
|
110
|
+
"es:has-focus-visible:text-accent-950 es:has-focus-visible:inset-ring-accent-500",
|
|
111
|
+
clearable && "es:pr-8",
|
|
112
|
+
"es:focus:placeholder:text-surface-400",
|
|
113
|
+
!noMinWidth && "es:min-w-48",
|
|
114
|
+
!inline && "es:w-fill",
|
|
115
|
+
className
|
|
116
|
+
],
|
|
117
|
+
{
|
|
118
|
+
variants: {
|
|
119
|
+
size: {
|
|
120
|
+
small: ["es:min-h-8", "es:px-2.5"],
|
|
121
|
+
medium: ["es:min-h-9", "es:px-3"],
|
|
122
|
+
default: ["es:min-h-10", "es:px-3"],
|
|
123
|
+
large: ["es:min-h-12", "es:px-4"]
|
|
124
|
+
},
|
|
125
|
+
disabled: {
|
|
126
|
+
false: "es:selection:bg-surface-100 es:selection:text-accent-800",
|
|
127
|
+
true: "es:selection:bg-secondary-200 es:selection:text-secondary-600"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
compoundVariants: [
|
|
131
|
+
{
|
|
132
|
+
flat: false,
|
|
133
|
+
disabled: false,
|
|
134
|
+
class: [
|
|
135
|
+
"es:bg-white",
|
|
136
|
+
"es:bg-linear-to-b es:from-secondary-100/0 es:to-secondary-100/50 es:from-25%",
|
|
137
|
+
"es:hover:from-surface-100/0 es:hover:to-surface-100/50",
|
|
138
|
+
"es:inset-ring-secondary-400/50 es:hover:inset-ring-surface-300 es:focus:inset-ring-surface-400",
|
|
139
|
+
"es:inset-shadow-sm es:inset-shadow-secondary-100/50",
|
|
140
|
+
"es:hover:placeholder:text-surface-400",
|
|
141
|
+
"es:placeholder:text-secondary-400",
|
|
142
|
+
"es:shadow-xs es:shadow-black/5"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
flat: true,
|
|
147
|
+
disabled: false,
|
|
148
|
+
class: [
|
|
149
|
+
"es:inset-ring-secondary-100",
|
|
150
|
+
"es:focus:text-accent-950",
|
|
151
|
+
"es:placeholder:text-secondary-500/80",
|
|
152
|
+
"es:bg-secondary-100 es:focus:bg-surface-50",
|
|
153
|
+
"es:inset-ring-secondary-200/15 es:hover:inset-ring-secondary-200/65 es:focus:inset-ring-surface-200"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{ disabled: true, class: ["es:bg-secondary-50 es:inset-ring-secondary-200 es:text-secondary-400"] },
|
|
157
|
+
{ readOnly: true, flat: false, class: ["es:bg-secondary-50 es:inset-ring-secondary-300 es:text-secondary-400"] },
|
|
158
|
+
{ readOnly: true, flat: true, class: ["es:bg-secondary-50 es:inset-ring-secondary-300/60 es:text-secondary-400"] }
|
|
159
|
+
],
|
|
160
|
+
defaultVariants: { disabled: false, flat: false, size: "default" }
|
|
161
|
+
}
|
|
162
|
+
);
|
|
83
163
|
return /* @__PURE__ */ jsx(
|
|
84
|
-
|
|
164
|
+
$82d7e5349645de74$export$ef9b1a59e592288f,
|
|
85
165
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
166
|
+
isDisabled: disabled,
|
|
167
|
+
value: currentValue,
|
|
168
|
+
onChange: (selected) => {
|
|
169
|
+
if (selected === null || selected === void 0) {
|
|
170
|
+
onChange(null);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (simpleValue) {
|
|
174
|
+
onChange(selected);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const item = options.find((item2) => item2.value === selected);
|
|
178
|
+
if (!item) {
|
|
179
|
+
onChange(null);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (item && "id" in item) {
|
|
183
|
+
delete item.id;
|
|
184
|
+
}
|
|
185
|
+
onChange({
|
|
186
|
+
label: item?.label,
|
|
187
|
+
value: item?.value,
|
|
188
|
+
subtitle: item?.subtitle,
|
|
189
|
+
meta: item?.meta
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
placeholder,
|
|
193
|
+
...rest,
|
|
194
|
+
className: clsx("es:group es:w-fill", rest?.className),
|
|
195
|
+
children: /* @__PURE__ */ jsxs(
|
|
196
|
+
BaseControl,
|
|
94
197
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
198
|
+
label,
|
|
199
|
+
icon,
|
|
200
|
+
subtitle,
|
|
201
|
+
actions,
|
|
202
|
+
help,
|
|
203
|
+
inline,
|
|
204
|
+
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ jsxs(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: selectClass({ disabled, flat, size }),
|
|
210
|
+
ref,
|
|
211
|
+
children: [
|
|
212
|
+
/* @__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: [
|
|
213
|
+
/* @__PURE__ */ jsx($82d7e5349645de74$export$e288731fd71264f0, { children: ({ isPlaceholder, selectedItems }) => {
|
|
214
|
+
const [selectedItem] = selectedItems;
|
|
215
|
+
if (!isPlaceholder && currentValue && customValueDisplay) {
|
|
216
|
+
return customValueDisplay(selectedItem);
|
|
217
|
+
}
|
|
218
|
+
if (!currentValue) {
|
|
219
|
+
return /* @__PURE__ */ jsx("span", { className: "es:select-none es:pointer-events-none es:pr-6 es:text-sm es:text-surface-500", children: placeholder });
|
|
220
|
+
}
|
|
221
|
+
let icon2 = selectedItem?.icon ?? null;
|
|
222
|
+
if (typeof selectedItem?.icon === "string") {
|
|
223
|
+
icon2 = icons?.[selectedItem.icon] ?? null;
|
|
224
|
+
}
|
|
225
|
+
return /* @__PURE__ */ jsx(
|
|
226
|
+
RichLabel,
|
|
227
|
+
{
|
|
228
|
+
icon: icon2,
|
|
229
|
+
label: selectedItem?.label,
|
|
230
|
+
subtitle: selectedItem?.subtitle,
|
|
231
|
+
className: clsx("es:pr-6 es:grow es:w-full", disabled && "es:grayscale es:pointer-events-none"),
|
|
232
|
+
iconClassName: "es:pointer-events-none es:select-none"
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
} }),
|
|
236
|
+
/* @__PURE__ */ jsxs(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: clsx("es:absolute es:bottom-0 es:right-3 es:top-0 es:my-auto es:flex es:items-center", disabled ? "es:text-secondary-300" : "es:text-secondary-500"),
|
|
240
|
+
"aria-hidden": "true",
|
|
241
|
+
children: [
|
|
242
|
+
!customDropdownArrow && cloneElement(icons.dropdownCaret, {
|
|
243
|
+
className: "es:w-4 es:stroke-[1.2] es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200"
|
|
244
|
+
}),
|
|
245
|
+
customDropdownArrow && /* @__PURE__ */ jsx(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
"aria-hidden": "true",
|
|
249
|
+
className: "es:group-aria-expanded:-scale-y-100 es:transition-transform es:duration-200",
|
|
250
|
+
children: customDropdownArrow
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] }),
|
|
257
|
+
clearable && /* @__PURE__ */ jsx(SelectClearButton, {})
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
/* @__PURE__ */ jsxs(
|
|
262
|
+
$07b14b47974efb58$export$5b6b19405a83ff9d,
|
|
263
|
+
{
|
|
264
|
+
className: ({ isEntering, isExiting }) => clsx(
|
|
265
|
+
"es:w-(--trigger-width) es:min-w-72",
|
|
266
|
+
"es:outline-hidden",
|
|
267
|
+
searchable ? "es:rounded-b-xl es:rounded-t-3xl" : "es:rounded-2xl",
|
|
268
|
+
"es:overflow-clip es:grid es:grid-cols-1",
|
|
269
|
+
searchable ? "es:grid-rows-[auto_minmax(0,1fr)]" : "es:grid-rows-1",
|
|
270
|
+
!searchable && "es:has-first-selected:rounded-t-20!",
|
|
271
|
+
"es:has-last-selected:rounded-b-20!",
|
|
272
|
+
"es:inset-ring es:inset-ring-surface-500/10",
|
|
273
|
+
"es:inset-shadow-sm es:inset-shadow-white/30",
|
|
274
|
+
searchable && !options?.length ? "es:bg-surface-50/50" : "es:bg-surface-300/50",
|
|
275
|
+
searchable && !options?.length ? "es:backdrop-blur-sm" : "es:backdrop-blur-md",
|
|
276
|
+
searchable && !options?.length ? "es:backdrop-brightness-105" : "es:backdrop-brightness-110",
|
|
277
|
+
"es:backdrop-saturate-125",
|
|
278
|
+
"es:shadow-lg es:shadow-black/10",
|
|
279
|
+
"es:transition-plus",
|
|
280
|
+
"es:motion-duration-300 es:motion-ease-spring-bouncy",
|
|
281
|
+
"es:placement-bottom:origin-top-left es:placement-top:origin-bottom-left",
|
|
282
|
+
isEntering && "es:motion-scale-x-in-95 es:motion-scale-y-in-85 es:motion-opacity-in-0 es:motion-blur-in-[2px]",
|
|
283
|
+
isEntering && "es:placement-top:motion-translate-y-in-[0.5rem] es:placement-bottom:motion-translate-y-in-[-0.5rem]",
|
|
284
|
+
isExiting && "es:motion-scale-x-out-95 es:motion-scale-y-out-85 es:motion-opacity-out-0 es:motion-blur-out-xs",
|
|
285
|
+
isExiting && "es:placement-top:motion-translate-y-out-[0.5rem] es:placement-bottom:motion-translate-y-out-[-0.5rem]"
|
|
286
|
+
),
|
|
287
|
+
placement: "bottom left",
|
|
288
|
+
maxHeight: 240,
|
|
289
|
+
triggerRef: ref,
|
|
290
|
+
children: [
|
|
291
|
+
searchable && /* @__PURE__ */ jsxs($d2f53cda644affe3$export$2f2b9559550c7bbc, { filter: contains, children: [
|
|
292
|
+
/* @__PURE__ */ jsxs(
|
|
293
|
+
$440f4836bcb56932$export$b94867ecbd698f21,
|
|
294
|
+
{
|
|
295
|
+
"aria-label": __("Search", "eightshift-ui-components"),
|
|
296
|
+
className: "es:flex es:items-center es:relative",
|
|
297
|
+
autoFocus: true,
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
301
|
+
{
|
|
302
|
+
placeholder: __("Search...", "eightshift-ui-components"),
|
|
303
|
+
className: clsx(
|
|
304
|
+
"es:peer es:size-full es:h-9.5 es:outline-hidden es:pl-3.5 es:pr-9 es:shadow-none es:text-13 es:placeholder:text-surface-500 es:[&::-webkit-search-cancel-button]:hidden",
|
|
305
|
+
"es:bg-accent-900/8 es:m-1.5 es:rounded-3xl es:border-none",
|
|
306
|
+
"es:inset-ring es:inset-ring-accent-950/7 es:focus:inset-ring-accent-950/20",
|
|
307
|
+
"es:text-accent-950 es:placeholder:text-accent-700/50",
|
|
308
|
+
"es:transition"
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ jsx(
|
|
313
|
+
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
314
|
+
{
|
|
315
|
+
"aria-label": __("Clear", "eightshift-ui-components"),
|
|
316
|
+
className: clsx(
|
|
317
|
+
"es:absolute es:right-3 es:top-0 es:bottom-0 es:my-auto es:border-none es:bg-transparent",
|
|
318
|
+
"es:flex es:size-7 es:items-center es:justify-center es:rounded-3xl es:text-sm es:text-surface-700 es:transition es:hover:bg-accent-50 es:hover:text-accent-800 es:any-focus:outline-hidden es:focus:ring-2 es:focus:ring-accent-500/50 es:disabled:text-secondary-300 es:cursor-pointer",
|
|
319
|
+
"es:peer-placeholder-shown:opacity-0"
|
|
320
|
+
),
|
|
321
|
+
children: icons.clearAlt
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsx(
|
|
328
|
+
$eed445e0843c11d0$export$41f133550aa26f48,
|
|
329
|
+
{
|
|
330
|
+
className: "es:space-y-0.75 es:p-1.5 es:pt-0 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl",
|
|
331
|
+
items: options,
|
|
332
|
+
renderEmptyState: () => /* @__PURE__ */ jsx(
|
|
333
|
+
RichLabel,
|
|
334
|
+
{
|
|
335
|
+
icon: icons.searchEmpty,
|
|
336
|
+
label: __("No results", "eightshift-ui-components"),
|
|
337
|
+
subtitle: __("Try a different search term", "eightshift-ui-components"),
|
|
338
|
+
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",
|
|
339
|
+
iconClassName: "es:text-accent-700 es:icon:size-7!",
|
|
340
|
+
noColor: true
|
|
341
|
+
}
|
|
342
|
+
),
|
|
343
|
+
children: (item) => {
|
|
344
|
+
let icon2 = item?.icon ?? null;
|
|
345
|
+
if (typeof item?.icon === "string") {
|
|
346
|
+
icon2 = icons?.[item.icon] ?? null;
|
|
347
|
+
}
|
|
348
|
+
return /* @__PURE__ */ jsxs(
|
|
349
|
+
OptionItemBase,
|
|
350
|
+
{
|
|
351
|
+
id: item.value,
|
|
352
|
+
className: item?.className,
|
|
353
|
+
selectIndicator: true,
|
|
354
|
+
children: [
|
|
355
|
+
customMenuOption && customMenuOption(item),
|
|
356
|
+
!customMenuOption && /* @__PURE__ */ jsx(
|
|
357
|
+
RichLabel,
|
|
358
|
+
{
|
|
359
|
+
icon: icon2,
|
|
360
|
+
label: item?.label,
|
|
361
|
+
subtitle: item?.subtitle,
|
|
362
|
+
noColor: true
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] }),
|
|
372
|
+
!searchable && /* @__PURE__ */ jsx(
|
|
373
|
+
$eed445e0843c11d0$export$41f133550aa26f48,
|
|
374
|
+
{
|
|
375
|
+
className: "es:space-y-0.75 es:p-1.5 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl",
|
|
376
|
+
items: options,
|
|
377
|
+
renderEmptyState: () => /* @__PURE__ */ jsx(
|
|
378
|
+
RichLabel,
|
|
379
|
+
{
|
|
380
|
+
icon: icons.searchEmpty,
|
|
381
|
+
label: __("No results", "eightshift-ui-components"),
|
|
382
|
+
subtitle: __("Try a different search term", "eightshift-ui-components"),
|
|
383
|
+
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",
|
|
384
|
+
iconClassName: "es:text-accent-700 es:icon:size-7!",
|
|
385
|
+
noColor: true
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
children: (item) => {
|
|
389
|
+
let icon2 = item?.icon ?? null;
|
|
390
|
+
if (typeof item?.icon === "string") {
|
|
391
|
+
icon2 = icons?.[item.icon] ?? null;
|
|
392
|
+
}
|
|
393
|
+
return /* @__PURE__ */ jsxs(
|
|
394
|
+
OptionItemBase,
|
|
395
|
+
{
|
|
396
|
+
id: item.value,
|
|
397
|
+
className: item?.className,
|
|
398
|
+
selectIndicator: true,
|
|
399
|
+
children: [
|
|
400
|
+
customMenuOption && customMenuOption(item),
|
|
401
|
+
!customMenuOption && /* @__PURE__ */ jsx(
|
|
402
|
+
RichLabel,
|
|
403
|
+
{
|
|
404
|
+
icon: icon2,
|
|
405
|
+
label: item?.label,
|
|
406
|
+
subtitle: item?.subtitle,
|
|
407
|
+
noColor: true
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
]
|
|
125
420
|
}
|
|
126
421
|
)
|
|
127
422
|
}
|