@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
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { DecorativeTooltip } from "../tooltip/tooltip.js";
|
|
4
4
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
5
|
-
import { _ as __, s as sprintf } from "../../default-i18n-
|
|
5
|
+
import { _ as __, s as sprintf } from "../../default-i18n-OFa3zAyB.js";
|
|
6
6
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
7
7
|
import { upperFirst } from "../../utilities/es-dash.js";
|
|
8
8
|
import { icons } from "../../icons/icons.js";
|
|
@@ -104,16 +104,15 @@ const Responsive = (props) => {
|
|
|
104
104
|
desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
105
105
|
}
|
|
106
106
|
const [detailsVisible, setDetailsVisible] = useState(false);
|
|
107
|
-
const isDesktopFirst =
|
|
108
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof
|
|
109
|
-
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof
|
|
107
|
+
const isDesktopFirst = value?.["_desktopFirst"] === true;
|
|
108
|
+
const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof value?.[breakpoint] !== "undefined");
|
|
109
|
+
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof value?.[breakpoint] !== "undefined");
|
|
110
110
|
const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
|
|
111
111
|
if (hidden) {
|
|
112
112
|
return null;
|
|
113
113
|
}
|
|
114
114
|
const DefaultTooltip = () => {
|
|
115
|
-
|
|
116
|
-
const overrideIcon = (_a = breakpointUiData == null ? void 0 : breakpointUiData[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]) == null ? void 0 : _a.icon;
|
|
115
|
+
const overrideIcon = breakpointUiData?.[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]?.icon;
|
|
117
116
|
return /* @__PURE__ */ jsx(
|
|
118
117
|
DecorativeTooltip,
|
|
119
118
|
{
|
|
@@ -137,14 +136,14 @@ const Responsive = (props) => {
|
|
|
137
136
|
{
|
|
138
137
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
139
138
|
widthEnd: breakpointData[firstMobileFirstOverride] - 1,
|
|
140
|
-
value:
|
|
139
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
141
140
|
dotsStart: true,
|
|
142
141
|
alignEnd: true,
|
|
143
142
|
active: true
|
|
144
143
|
},
|
|
145
144
|
{
|
|
146
|
-
breakpoint:
|
|
147
|
-
value:
|
|
145
|
+
breakpoint: breakpointUiData?.[firstMobileFirstOverride]?.label ?? firstMobileFirstOverride,
|
|
146
|
+
value: options?.find((opt) => opt.value === value?.[firstMobileFirstOverride])?.label ?? upperFirst(value?.[firstMobileFirstOverride]),
|
|
148
147
|
dotsEnd: true
|
|
149
148
|
}
|
|
150
149
|
]
|
|
@@ -155,14 +154,14 @@ const Responsive = (props) => {
|
|
|
155
154
|
{
|
|
156
155
|
blocks: [
|
|
157
156
|
{
|
|
158
|
-
breakpoint:
|
|
159
|
-
value:
|
|
157
|
+
breakpoint: breakpointUiData?.[lastDesktopFirstOverride.replace("max-", "")]?.label ?? lastDesktopFirstOverride.replace("max-", ""),
|
|
158
|
+
value: options?.find((opt) => opt.value === value?.[lastDesktopFirstOverride])?.label ?? upperFirst(value?.[lastDesktopFirstOverride]),
|
|
160
159
|
dotsStart: true,
|
|
161
160
|
alignEnd: true
|
|
162
161
|
},
|
|
163
162
|
{
|
|
164
163
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
165
|
-
value:
|
|
164
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
166
165
|
width: breakpointData[lastDesktopFirstOverride.replace("max-", "")],
|
|
167
166
|
dotsEnd: true,
|
|
168
167
|
active: true
|
|
@@ -172,7 +171,7 @@ const Responsive = (props) => {
|
|
|
172
171
|
)
|
|
173
172
|
] })
|
|
174
173
|
] }),
|
|
175
|
-
children: /* @__PURE__ */ jsx("div", { className: "es:flex es:size-7 es:items-center es:justify-center es:rounded es:border es:border-accent-500/10 es:bg-accent-50 es:p-0.5 es:text-accent-800 es:shadow-sm es:shadow-accent-600/25 es:icon:size-5", children:
|
|
174
|
+
children: /* @__PURE__ */ jsx("div", { className: "es:flex es:size-7 es:items-center es:justify-center es:rounded es:border es:border-accent-500/10 es:bg-accent-50 es:p-0.5 es:text-accent-800 es:shadow-sm es:shadow-accent-600/25 es:icon:size-5", children: icons?.[overrideIcon] ?? overrideIcon ?? icons[`screen${upperFirst(isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0))}`] })
|
|
176
175
|
}
|
|
177
176
|
);
|
|
178
177
|
};
|
|
@@ -194,7 +193,7 @@ const Responsive = (props) => {
|
|
|
194
193
|
noInitial: true,
|
|
195
194
|
children: children({
|
|
196
195
|
breakpoint: "_default",
|
|
197
|
-
currentValue: value
|
|
196
|
+
currentValue: value?.["_default"],
|
|
198
197
|
handleChange: (newValue) => onChange({
|
|
199
198
|
...value,
|
|
200
199
|
_default: newValue
|
|
@@ -269,7 +268,7 @@ const Responsive = (props) => {
|
|
|
269
268
|
),
|
|
270
269
|
/* @__PURE__ */ jsx(MenuSeparator, {})
|
|
271
270
|
] }),
|
|
272
|
-
Object.keys(value).some((key) => !
|
|
271
|
+
Object.keys(value).some((key) => !key?.startsWith("_") && typeof value?.[key] !== "undefined") && /* @__PURE__ */ jsx(SubMenuItem, { trigger: /* @__PURE__ */ jsx(MenuItem, { icon: icons.previewResponsive, children: __("Responsive preview", "eightshift-ui-components") }), children: /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: /* @__PURE__ */ jsx(
|
|
273
272
|
ResponsivePreview,
|
|
274
273
|
{
|
|
275
274
|
value,
|
|
@@ -281,7 +280,7 @@ const Responsive = (props) => {
|
|
|
281
280
|
breakpointUiData
|
|
282
281
|
}
|
|
283
282
|
) }) }),
|
|
284
|
-
Object.keys(value).some((key) => !
|
|
283
|
+
Object.keys(value).some((key) => !key?.startsWith("_") && typeof value?.[key] !== "undefined") && /* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
285
284
|
/* @__PURE__ */ jsx(
|
|
286
285
|
MenuItem,
|
|
287
286
|
{
|
|
@@ -317,7 +316,7 @@ const Responsive = (props) => {
|
|
|
317
316
|
detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
318
317
|
/* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
|
|
319
318
|
breakpoint: "_default",
|
|
320
|
-
currentValue: value
|
|
319
|
+
currentValue: value?.["_default"],
|
|
321
320
|
handleChange: (newValue) => onChange({
|
|
322
321
|
...value,
|
|
323
322
|
_default: newValue
|
|
@@ -344,7 +343,7 @@ const Responsive = (props) => {
|
|
|
344
343
|
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
345
344
|
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
346
345
|
breakpoint: "_default",
|
|
347
|
-
currentValue: value
|
|
346
|
+
currentValue: value?.["_default"],
|
|
348
347
|
handleChange: (newValue) => onChange({
|
|
349
348
|
...value,
|
|
350
349
|
_default: newValue
|
|
@@ -363,11 +362,10 @@ const Responsive = (props) => {
|
|
|
363
362
|
visible: detailsVisible,
|
|
364
363
|
className: "es:space-y-2",
|
|
365
364
|
children: breakpointsToMap.map((breakpoint, i) => {
|
|
366
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
367
365
|
const realBreakpointName = breakpoint.replace("max-", "");
|
|
368
366
|
const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, "_default"] : ["_default", ...breakpointsToMap];
|
|
369
|
-
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(i + 1).find((breakpoint2) => typeof
|
|
370
|
-
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => typeof
|
|
367
|
+
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(i + 1).find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined") : filterBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined");
|
|
368
|
+
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined") : filterBreakpoints.slice(i + 2).find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined");
|
|
371
369
|
return /* @__PURE__ */ jsxs(
|
|
372
370
|
"div",
|
|
373
371
|
{
|
|
@@ -387,7 +385,7 @@ const Responsive = (props) => {
|
|
|
387
385
|
offset: 7.5,
|
|
388
386
|
arrow: true,
|
|
389
387
|
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-96 es:p-1", children: [
|
|
390
|
-
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children:
|
|
388
|
+
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children: breakpointUiData?.[realBreakpointName]?.label ?? upperFirst(realBreakpointName) }),
|
|
391
389
|
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
392
390
|
!isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
393
391
|
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[realBreakpointName]),
|
|
@@ -402,10 +400,10 @@ const Responsive = (props) => {
|
|
|
402
400
|
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[realBreakpointName] - 1),
|
|
403
401
|
belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
|
|
404
402
|
__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
|
|
405
|
-
breakpointData[belowOverride
|
|
403
|
+
breakpointData[belowOverride?.replace("max-", "")],
|
|
406
404
|
breakpointData[realBreakpointName] - 1
|
|
407
405
|
),
|
|
408
|
-
typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint
|
|
406
|
+
typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint?.replace("max-", "")])
|
|
409
407
|
] })
|
|
410
408
|
] }),
|
|
411
409
|
typeof value[breakpoint] === "undefined" && /* @__PURE__ */ jsx("span", { className: "es:mt-2 es:block es:font-medium es:italic", children: __("Not set", "eightshift-ui-components") }),
|
|
@@ -415,28 +413,28 @@ const Responsive = (props) => {
|
|
|
415
413
|
{
|
|
416
414
|
dotsStart: belowOverride,
|
|
417
415
|
blocks: [
|
|
418
|
-
aboveOverride !== "_default" && typeof
|
|
419
|
-
breakpoint:
|
|
420
|
-
value:
|
|
416
|
+
aboveOverride !== "_default" && typeof value?.[aboveOverride] !== "undefined" && {
|
|
417
|
+
breakpoint: breakpointUiData?.[aboveOverride]?.label ?? aboveOverride,
|
|
418
|
+
value: options?.find((opt) => opt.value === value?.[aboveOverride])?.label ?? upperFirst(value?.[aboveOverride]),
|
|
421
419
|
dotsStart: !belowOverride,
|
|
422
420
|
alignEnd: !belowOverride
|
|
423
421
|
},
|
|
424
|
-
aboveOverride === "_default" && typeof
|
|
422
|
+
aboveOverride === "_default" && typeof value?.["_default"] !== "undefined" && {
|
|
425
423
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
426
|
-
value:
|
|
424
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
427
425
|
dotsStart: !belowOverride,
|
|
428
426
|
alignEnd: !belowOverride
|
|
429
427
|
},
|
|
430
428
|
{
|
|
431
|
-
breakpoint:
|
|
432
|
-
value:
|
|
429
|
+
breakpoint: breakpointUiData?.[realBreakpointName]?.label ?? realBreakpointName,
|
|
430
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[breakpoint]),
|
|
433
431
|
width: breakpointData[realBreakpointName],
|
|
434
432
|
active: true,
|
|
435
433
|
dotsEnd: !belowOverride
|
|
436
434
|
},
|
|
437
|
-
belowOverride && typeof
|
|
438
|
-
breakpoint:
|
|
439
|
-
value:
|
|
435
|
+
belowOverride && typeof value?.[belowOverride] !== "undefined" && {
|
|
436
|
+
breakpoint: breakpointUiData?.[belowOverride]?.label ?? belowOverride,
|
|
437
|
+
value: options?.find((opt) => opt.value === value?.[belowOverride])?.label ?? upperFirst(value?.[belowOverride]),
|
|
440
438
|
width: breakpointData[belowOverride],
|
|
441
439
|
dotsEnd: true
|
|
442
440
|
}
|
|
@@ -450,24 +448,24 @@ const Responsive = (props) => {
|
|
|
450
448
|
dotsEnd: aboveOverride !== "_default",
|
|
451
449
|
blocks: [
|
|
452
450
|
belowOverride && {
|
|
453
|
-
breakpoint:
|
|
454
|
-
value:
|
|
451
|
+
breakpoint: breakpointUiData?.[belowOverride?.replace("max-", "")]?.label ?? belowOverride?.replace("max-", ""),
|
|
452
|
+
value: options?.find((opt) => opt.value === value?.[belowOverride])?.label ?? upperFirst(value?.[belowOverride])
|
|
455
453
|
},
|
|
456
454
|
{
|
|
457
|
-
breakpoint:
|
|
458
|
-
value:
|
|
459
|
-
width: breakpointData[
|
|
455
|
+
breakpoint: breakpointUiData?.[realBreakpointName]?.label ?? realBreakpointName,
|
|
456
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[realBreakpointName]),
|
|
457
|
+
width: breakpointData[filterBreakpoints[i - 1]?.replace("max-", "")],
|
|
460
458
|
active: true
|
|
461
459
|
},
|
|
462
460
|
aboveOverride !== "_default" && {
|
|
463
|
-
breakpoint:
|
|
464
|
-
value:
|
|
465
|
-
width: breakpointData[breakpoint
|
|
461
|
+
breakpoint: breakpointUiData?.[aboveOverride?.replace("max-", "")]?.label ?? aboveOverride?.replace("max-", ""),
|
|
462
|
+
value: options?.find((opt) => opt.value === value?.[aboveOverride])?.label ?? upperFirst(value?.[aboveOverride]),
|
|
463
|
+
width: breakpointData[breakpoint?.replace("max-", "")]
|
|
466
464
|
},
|
|
467
465
|
aboveOverride === "_default" && {
|
|
468
466
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
469
|
-
value:
|
|
470
|
-
width: breakpointData[breakpoint
|
|
467
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
468
|
+
width: breakpointData[breakpoint?.replace("max-", "")],
|
|
471
469
|
dotsEnd: true
|
|
472
470
|
}
|
|
473
471
|
]
|
|
@@ -482,14 +480,14 @@ const Responsive = (props) => {
|
|
|
482
480
|
"es:flex es:size-7 es:items-center es:justify-center es:rounded es:border es:p-0.5 es:shadow-sm es:transition-colors es:icon:size-5",
|
|
483
481
|
typeof value[breakpoint] !== "undefined" ? "es:border-secondary-200 es:bg-secondary-50 es:text-secondary-700" : "es:border-secondary-100 es:bg-white es:text-secondary-500"
|
|
484
482
|
),
|
|
485
|
-
children:
|
|
483
|
+
children: icons?.[breakpointUiData?.[realBreakpointName]?.icon] ?? breakpointUiData?.[realBreakpointName]?.icon ?? icons?.[`screen${upperFirst(realBreakpointName)}`]
|
|
486
484
|
}
|
|
487
485
|
)
|
|
488
486
|
}
|
|
489
487
|
),
|
|
490
488
|
children({
|
|
491
489
|
breakpoint,
|
|
492
|
-
currentValue: value
|
|
490
|
+
currentValue: value?.[breakpoint],
|
|
493
491
|
handleChange: (newValue) => {
|
|
494
492
|
onChange({
|
|
495
493
|
...value,
|
|
@@ -508,7 +506,7 @@ const Responsive = (props) => {
|
|
|
508
506
|
onChange(newValue);
|
|
509
507
|
},
|
|
510
508
|
icon: icons.clearAlt,
|
|
511
|
-
disabled: typeof
|
|
509
|
+
disabled: typeof value?.[breakpoint] === "undefined",
|
|
512
510
|
type: "ghost"
|
|
513
511
|
}
|
|
514
512
|
)
|
|
@@ -534,7 +532,7 @@ const Responsive = (props) => {
|
|
|
534
532
|
detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
535
533
|
/* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
|
|
536
534
|
breakpoint: "_default",
|
|
537
|
-
currentValue: value
|
|
535
|
+
currentValue: value?.["_default"],
|
|
538
536
|
handleChange: (newValue) => onChange({
|
|
539
537
|
...value,
|
|
540
538
|
_default: newValue
|
|
@@ -561,7 +559,7 @@ const Responsive = (props) => {
|
|
|
561
559
|
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
562
560
|
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
563
561
|
breakpoint: "_default",
|
|
564
|
-
currentValue: value
|
|
562
|
+
currentValue: value?.["_default"],
|
|
565
563
|
handleChange: (newValue) => onChange({
|
|
566
564
|
...value,
|
|
567
565
|
_default: newValue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __ } from "../../default-i18n-
|
|
2
|
+
import { _ as __ } from "../../default-i18n-OFa3zAyB.js";
|
|
3
3
|
import { upperFirst } from "../../utilities/es-dash.js";
|
|
4
4
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
5
5
|
import { icons } from "../../icons/icons.js";
|
|
@@ -33,7 +33,6 @@ import { RichLabel } from "../rich-label/rich-label.js";
|
|
|
33
33
|
* @preserve
|
|
34
34
|
*/
|
|
35
35
|
const ResponsivePreview = (props) => {
|
|
36
|
-
var _a, _b;
|
|
37
36
|
const {
|
|
38
37
|
value,
|
|
39
38
|
isDesktopFirst: rawIsDesktopFirst,
|
|
@@ -43,39 +42,37 @@ const ResponsivePreview = (props) => {
|
|
|
43
42
|
breakpointData,
|
|
44
43
|
breakpointUiData
|
|
45
44
|
} = props;
|
|
46
|
-
const isDesktopFirst = rawIsDesktopFirst ??
|
|
45
|
+
const isDesktopFirst = rawIsDesktopFirst ?? value?.["_desktopFirst"] ?? false;
|
|
47
46
|
const breakpoints = rawBreakpoints;
|
|
48
47
|
const desktopFirstBreakpoints = rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1);
|
|
49
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) => value
|
|
50
|
-
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => value
|
|
48
|
+
const firstMobileFirstOverride = breakpoints.find((breakpoint) => value?.[breakpoint]);
|
|
49
|
+
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => value?.[breakpoint]);
|
|
51
50
|
let previewItems = [];
|
|
52
51
|
if (firstMobileFirstOverride && !isDesktopFirst) {
|
|
53
52
|
previewItems = [
|
|
54
53
|
...previewItems,
|
|
55
54
|
{
|
|
56
55
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
57
|
-
value:
|
|
56
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"])
|
|
58
57
|
}
|
|
59
58
|
];
|
|
60
59
|
breakpoints.forEach((breakpoint) => {
|
|
61
|
-
|
|
62
|
-
if (typeof (value == null ? void 0 : value[breakpoint]) === "undefined") {
|
|
60
|
+
if (typeof value?.[breakpoint] === "undefined") {
|
|
63
61
|
return;
|
|
64
62
|
}
|
|
65
63
|
previewItems = [
|
|
66
64
|
...previewItems,
|
|
67
65
|
{
|
|
68
66
|
width: breakpointData[breakpoint],
|
|
69
|
-
breakpoint:
|
|
70
|
-
value:
|
|
67
|
+
breakpoint: breakpointUiData?.[breakpoint]?.label ?? breakpoint,
|
|
68
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[breakpoint])
|
|
71
69
|
}
|
|
72
70
|
];
|
|
73
71
|
});
|
|
74
72
|
}
|
|
75
73
|
if (lastDesktopFirstOverride && isDesktopFirst) {
|
|
76
74
|
desktopFirstBreakpoints.forEach((breakpoint) => {
|
|
77
|
-
|
|
78
|
-
if (typeof (value == null ? void 0 : value[breakpoint]) === "undefined") {
|
|
75
|
+
if (typeof value?.[breakpoint] === "undefined") {
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
previewItems = [
|
|
@@ -83,8 +80,8 @@ const ResponsivePreview = (props) => {
|
|
|
83
80
|
{
|
|
84
81
|
alignEnd: true,
|
|
85
82
|
widthEnd: breakpointData[breakpoint.replace("max-", "")],
|
|
86
|
-
breakpoint:
|
|
87
|
-
value:
|
|
83
|
+
breakpoint: breakpointUiData?.[breakpoint.replace("max-", "")]?.label ?? breakpoint.replace("max-", ""),
|
|
84
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[breakpoint])
|
|
88
85
|
}
|
|
89
86
|
];
|
|
90
87
|
});
|
|
@@ -92,7 +89,7 @@ const ResponsivePreview = (props) => {
|
|
|
92
89
|
...previewItems,
|
|
93
90
|
{
|
|
94
91
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
95
|
-
value:
|
|
92
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"])
|
|
96
93
|
}
|
|
97
94
|
];
|
|
98
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { A as AsyncSelect$1 } from "../../react-select-async.esm-D937XTWW.js";
|
|
4
|
-
import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-
|
|
4
|
+
import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-BcKzA24f.js";
|
|
5
5
|
import { r as restrictToParentElement } from "../../modifiers.esm-BuJQPI1X.js";
|
|
6
6
|
import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator, CustomSelectDefaultMultiValueRemove } from "./custom-select-default-components.js";
|
|
7
7
|
import { BaseControl } from "../base-control/base-control.js";
|
|
@@ -92,17 +92,17 @@ const AsyncMultiSelect = (props) => {
|
|
|
92
92
|
const idBase = useId();
|
|
93
93
|
const value = rawValue.map((item, index) => ({
|
|
94
94
|
...item,
|
|
95
|
-
id:
|
|
95
|
+
id: item?.value ?? `${idBase}-${index}`
|
|
96
96
|
}));
|
|
97
97
|
const modifiedOnChange = (v) => {
|
|
98
|
-
onChange(v
|
|
98
|
+
onChange(v?.map((item) => ({ ...item, id: void 0 })));
|
|
99
99
|
};
|
|
100
100
|
if (hidden) {
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
103
|
const customLoadOptions = async (searchText) => {
|
|
104
104
|
const results = await loadOptions(searchText);
|
|
105
|
-
return processLoadedOptions(
|
|
105
|
+
return processLoadedOptions(results?.map((item) => ({ id: item.value, ...item })) ?? []);
|
|
106
106
|
};
|
|
107
107
|
return /* @__PURE__ */ jsx(
|
|
108
108
|
BaseControl,
|
|
@@ -87,7 +87,7 @@ const AsyncSelect = (props) => {
|
|
|
87
87
|
}
|
|
88
88
|
const customLoadOptions = async (searchText) => {
|
|
89
89
|
const results = await loadOptions(searchText);
|
|
90
|
-
return processLoadedOptions(
|
|
90
|
+
return processLoadedOptions(results?.map((item) => ({ id: item.value, ...item })) ?? []);
|
|
91
91
|
};
|
|
92
92
|
return /* @__PURE__ */ jsx(
|
|
93
93
|
BaseControl,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { S as StateManagedSelect$1 } from "../../react-select.esm-Ciai3aKf.js";
|
|
4
|
-
import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-
|
|
4
|
+
import { D as DndContext, g as getDragEndHandler, S as SortableContext, a as getMultiValueRemove, b as getMultiValue } from "../../multi-select-components-BcKzA24f.js";
|
|
5
5
|
import { r as restrictToParentElement } from "../../modifiers.esm-BuJQPI1X.js";
|
|
6
6
|
import { CustomSelectDefaultClearIndicator, CustomSelectDefaultDropdownIndicator, CustomSelectDefaultMultiValueRemove } from "./custom-select-default-components.js";
|
|
7
7
|
import { getValue } from "./shared.js";
|
|
@@ -87,14 +87,14 @@ const MultiSelect = (props) => {
|
|
|
87
87
|
const idBase = useId();
|
|
88
88
|
const value = getValue(simpleValue, rawValue, options).map((item, index) => ({
|
|
89
89
|
...item,
|
|
90
|
-
id: (simpleValue ? item : item
|
|
90
|
+
id: (simpleValue ? item : item?.value) ?? `${idBase}-${index}`
|
|
91
91
|
}));
|
|
92
92
|
const modifiedOnChange = (v) => {
|
|
93
93
|
if (simpleValue) {
|
|
94
|
-
onChange(v
|
|
94
|
+
onChange(v?.map(({ value: value2 }) => value2));
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
onChange(v
|
|
97
|
+
onChange(v?.map((item) => ({ ...item, id: void 0 })));
|
|
98
98
|
};
|
|
99
99
|
if (hidden) {
|
|
100
100
|
return null;
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
const getValue = (simpleValue, value, options) => {
|
|
13
13
|
if (Array.isArray(value)) {
|
|
14
14
|
if (simpleValue) {
|
|
15
|
-
return value.map((value2) => options
|
|
15
|
+
return value.map((value2) => options?.find(({ value: itemValue }) => itemValue === value2));
|
|
16
16
|
}
|
|
17
17
|
return value;
|
|
18
18
|
}
|
|
19
19
|
if (simpleValue) {
|
|
20
|
-
return options
|
|
20
|
+
return options?.find(({ value: itemValue }) => itemValue === value);
|
|
21
21
|
}
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
@@ -5,7 +5,7 @@ const controlStyles = {
|
|
|
5
5
|
};
|
|
6
6
|
const placeholderStyles = "es:text-gray-400 es:ml-1";
|
|
7
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 es:my-1 es:overflow-visible!";
|
|
8
|
+
const valueContainerStyles = "es:gap-1 es:ml-1.25 es:my-1 es:overflow-visible!";
|
|
9
9
|
const singleValueStyles = "es:ml-0.5 es:px-1";
|
|
10
10
|
const multiValueStyles = clsx(
|
|
11
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",
|
|
@@ -16,9 +16,9 @@ const multiValueLabelStyles = "es:select-none";
|
|
|
16
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
17
|
const clearIndicatorStyles = "es:text-gray-500 es:p-1 es:rounded-md hover:bg-red-50 hover:text-red-800 es:transition";
|
|
18
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.5";
|
|
19
|
-
const menuStyles = "es:rounded-
|
|
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
20
|
const optionStyles = {
|
|
21
|
-
base: "es:p-2 es:flex! es:items-center es:gap-1.5 es:text-gray-800 es:rounded-
|
|
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
22
|
focus: "es:bg-gray-100 es:active:bg-accent-700/15",
|
|
23
23
|
selected: "es:bg-accent-600/15 es:text-accent-950"
|
|
24
24
|
};
|