@eightshift/ui-components 5.0.10 → 5.1.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/{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 +268 -150
- package/dist/assets/style-editor.css +268 -150
- package/dist/assets/style.css +268 -150
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +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 +13 -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 +3 -3
- 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 +215 -158
- package/dist/components/select/v2/shared.js +29 -20
- package/dist/components/select/v2/single-select.js +202 -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/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,14 +2,13 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-JS_ob-kh.js";
|
|
3
3
|
import { d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, h as $64fa3d84918910a7$export$ef03459518577ad4, b as $64fa3d84918910a7$export$4d86445c2cf5e3, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, g as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "../../utils-CZt7LCbO.js";
|
|
4
4
|
import { a as $2baaea4c71418dea$export$294aa081a6c6f55d, $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-DHrSdE_Q.js";
|
|
5
|
-
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-
|
|
5
|
+
import { b as $e93e671b31057976$export$b8473d3665f3a75a, a as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Bnyyv3Im.js";
|
|
6
6
|
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-BuJgePCv.js";
|
|
7
7
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
8
8
|
import React__default, { useMemo, useState, forwardRef, createContext, cloneElement } from "react";
|
|
9
9
|
import { $ as $99facab73266f662$export$5add1d006293d136 } from "../../useFormReset-D2YaWRIA.js";
|
|
10
10
|
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "../../usePress-DWBuejBp.js";
|
|
11
11
|
import { a as $f645667febf57a63$export$4c014de7c8940b4c, b as $458b0a5536c1a7cf$export$40bfa8c7b0832715, $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../useHover-C2SkI1Fn.js";
|
|
12
|
-
import { a as $e93e671b31057976$export$b8473d3665f3a75a, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "../../useFormValidation-Dy0PXJg5.js";
|
|
13
12
|
import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "../../FocusScope-BEPI2m7u.js";
|
|
14
13
|
import { a as $9ab94262bd0047c7$export$420e68273165f4ec, $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-Bv0UJQl8.js";
|
|
15
14
|
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-BbYZoHvX.js";
|
|
@@ -428,9 +427,9 @@ const RadioButton = (props) => {
|
|
|
428
427
|
isSelected && "es:text-white es:from-accent-500 es:to-accent-600",
|
|
429
428
|
isSelected && "es:shadow-accent-600/30 es:border-accent-700 es:inset-ring es:inset-ring-accent-600 es:inset-shadow-accent-400/75",
|
|
430
429
|
isSelected && "es:group-focus-visible:inset-ring-accent-600 es:group-focus-visible:inset-shadow-xs es:group-focus-visible:inset-shadow-accent-400",
|
|
431
|
-
!
|
|
432
|
-
!
|
|
433
|
-
!
|
|
430
|
+
!design?.startsWith("segmented") && "es:group-focus-visible:ring-2 es:group-focus-visible:ring-accent-500/50",
|
|
431
|
+
!design?.startsWith("segmented") && !isSelected && "es:group-focus-visible:border-accent-500",
|
|
432
|
+
!design?.startsWith("segmented") && !alignEnd && subtitle && "es:mb-auto"
|
|
434
433
|
),
|
|
435
434
|
children: /* @__PURE__ */ jsx(
|
|
436
435
|
AnimatedVisibility,
|
|
@@ -5,7 +5,7 @@ import { icons } from "../../icons/icons.js";
|
|
|
5
5
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
6
6
|
import { useContext } from "react";
|
|
7
7
|
import { Expandable } from "../expandable/expandable.js";
|
|
8
|
-
import { _ as __ } from "../../default-i18n-
|
|
8
|
+
import { _ as __ } from "../../default-i18n-OFa3zAyB.js";
|
|
9
9
|
import { RepeaterContext } from "./repeater-context.js";
|
|
10
10
|
/**
|
|
11
11
|
* A Repeater item.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState } from "react";
|
|
3
|
-
import { _ as __ } from "../../default-i18n-
|
|
3
|
+
import { _ as __ } from "../../default-i18n-OFa3zAyB.js";
|
|
4
4
|
import { Button } from "../button/button.js";
|
|
5
5
|
import { icons } from "../../icons/icons.js";
|
|
6
6
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
7
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
8
8
|
import { RepeaterContext } from "./repeater-context.js";
|
|
9
9
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
10
|
-
import { L as List, a as arrayRemove, b as arrayMove } from "../../List-
|
|
10
|
+
import { L as List, a as arrayRemove, b as arrayMove } from "../../List-BLeHBkfx.js";
|
|
11
11
|
import { Menu, MenuItem, MenuSeparator } from "../menu/menu.js";
|
|
12
12
|
const fixIds = (items, itemIdBase) => {
|
|
13
|
-
return items
|
|
13
|
+
return items?.map((item, i) => ({
|
|
14
14
|
...item,
|
|
15
|
-
id:
|
|
15
|
+
id: item?.id ?? `${itemIdBase}-${i}`
|
|
16
16
|
}));
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
@@ -123,7 +123,7 @@ const Repeater = (props) => {
|
|
|
123
123
|
tooltip: __("More options", "eightshift-ui-components"),
|
|
124
124
|
triggerIcon: icons.moreH,
|
|
125
125
|
triggerProps: { type: "ghost", size: "small" },
|
|
126
|
-
hidden:
|
|
126
|
+
hidden: items?.length < 1 || noExpandAllButton && !moreOptions,
|
|
127
127
|
children: [
|
|
128
128
|
!noExpandAllButton && /* @__PURE__ */ jsx(
|
|
129
129
|
MenuItem,
|
|
@@ -238,7 +238,7 @@ const Repeater = (props) => {
|
|
|
238
238
|
}
|
|
239
239
|
)
|
|
240
240
|
},
|
|
241
|
-
|
|
241
|
+
item?.id ?? key
|
|
242
242
|
);
|
|
243
243
|
},
|
|
244
244
|
removableByMove: !noDragToRemove
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { cloneElement } 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";
|
|
@@ -99,16 +99,15 @@ const MiniResponsive = (props) => {
|
|
|
99
99
|
if (useLegacyDesktopFirst) {
|
|
100
100
|
desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
101
101
|
}
|
|
102
|
-
const isDesktopFirst =
|
|
103
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof
|
|
104
|
-
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof
|
|
102
|
+
const isDesktopFirst = value?.["_desktopFirst"] === true;
|
|
103
|
+
const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof value?.[breakpoint] !== "undefined");
|
|
104
|
+
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof value?.[breakpoint] !== "undefined");
|
|
105
105
|
const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
|
|
106
106
|
if (hidden) {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
109
|
const DefaultTooltip = () => {
|
|
110
|
-
|
|
111
|
-
const overrideIcon = (_a = breakpointUiData == null ? void 0 : breakpointUiData[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]) == null ? void 0 : _a.icon;
|
|
110
|
+
const overrideIcon = breakpointUiData?.[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]?.icon;
|
|
112
111
|
return /* @__PURE__ */ jsx(
|
|
113
112
|
DecorativeTooltip,
|
|
114
113
|
{
|
|
@@ -132,14 +131,14 @@ const MiniResponsive = (props) => {
|
|
|
132
131
|
{
|
|
133
132
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
134
133
|
widthEnd: breakpointData[firstMobileFirstOverride] - 1,
|
|
135
|
-
value:
|
|
134
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
136
135
|
dotsStart: true,
|
|
137
136
|
alignEnd: true,
|
|
138
137
|
active: true
|
|
139
138
|
},
|
|
140
139
|
{
|
|
141
|
-
breakpoint:
|
|
142
|
-
value:
|
|
140
|
+
breakpoint: breakpointUiData?.[firstMobileFirstOverride]?.label ?? firstMobileFirstOverride,
|
|
141
|
+
value: options?.find((opt) => opt.value === value?.[firstMobileFirstOverride])?.label ?? upperFirst(value?.[firstMobileFirstOverride]),
|
|
143
142
|
dotsEnd: true
|
|
144
143
|
}
|
|
145
144
|
]
|
|
@@ -150,14 +149,14 @@ const MiniResponsive = (props) => {
|
|
|
150
149
|
{
|
|
151
150
|
blocks: [
|
|
152
151
|
{
|
|
153
|
-
breakpoint:
|
|
154
|
-
value:
|
|
152
|
+
breakpoint: breakpointUiData?.[lastDesktopFirstOverride.replace("max-", "")]?.label ?? lastDesktopFirstOverride.replace("max-", ""),
|
|
153
|
+
value: options?.find((opt) => opt.value === value?.[lastDesktopFirstOverride])?.label ?? upperFirst(value?.[lastDesktopFirstOverride]),
|
|
155
154
|
dotsStart: true,
|
|
156
155
|
alignEnd: true
|
|
157
156
|
},
|
|
158
157
|
{
|
|
159
158
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
160
|
-
value:
|
|
159
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
161
160
|
width: breakpointData[lastDesktopFirstOverride.replace("max-", "")],
|
|
162
161
|
dotsEnd: true,
|
|
163
162
|
active: true
|
|
@@ -167,7 +166,7 @@ const MiniResponsive = (props) => {
|
|
|
167
166
|
)
|
|
168
167
|
] })
|
|
169
168
|
] }),
|
|
170
|
-
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:
|
|
169
|
+
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))}`] })
|
|
171
170
|
}
|
|
172
171
|
);
|
|
173
172
|
};
|
|
@@ -182,7 +181,7 @@ const MiniResponsive = (props) => {
|
|
|
182
181
|
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
183
182
|
children({
|
|
184
183
|
breakpoint: "_default",
|
|
185
|
-
currentValue: value
|
|
184
|
+
currentValue: value?.["_default"],
|
|
186
185
|
handleChange: (newValue) => onChange({
|
|
187
186
|
...value,
|
|
188
187
|
_default: newValue
|
|
@@ -240,7 +239,7 @@ const MiniResponsive = (props) => {
|
|
|
240
239
|
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
241
240
|
/* @__PURE__ */ jsx("div", { className: "es:w-full es:col-start-2 es:col-end-2", children: children({
|
|
242
241
|
breakpoint: "_default",
|
|
243
|
-
currentValue: value
|
|
242
|
+
currentValue: value?.["_default"],
|
|
244
243
|
handleChange: (newValue) => onChange({
|
|
245
244
|
...value,
|
|
246
245
|
_default: newValue
|
|
@@ -254,11 +253,10 @@ const MiniResponsive = (props) => {
|
|
|
254
253
|
"_default-mobile-first"
|
|
255
254
|
),
|
|
256
255
|
breakpointsToMap.map((breakpoint, i) => {
|
|
257
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
258
256
|
const realBreakpointName = breakpoint.replace("max-", "");
|
|
259
257
|
const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, "_default"] : ["_default", ...breakpointsToMap];
|
|
260
|
-
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(i + 1).find((breakpoint2) => typeof
|
|
261
|
-
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => typeof
|
|
258
|
+
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");
|
|
259
|
+
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined") : filterBreakpoints.slice(i + 2).find((breakpoint2) => typeof value?.[breakpoint2] !== "undefined");
|
|
262
260
|
return /* @__PURE__ */ jsxs(
|
|
263
261
|
"div",
|
|
264
262
|
{
|
|
@@ -278,7 +276,7 @@ const MiniResponsive = (props) => {
|
|
|
278
276
|
offset: 7.5,
|
|
279
277
|
arrow: true,
|
|
280
278
|
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-96 es:p-1", children: [
|
|
281
|
-
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children:
|
|
279
|
+
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children: breakpointUiData?.[realBreakpointName]?.label ?? upperFirst(realBreakpointName) }),
|
|
282
280
|
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
283
281
|
!isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
284
282
|
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[realBreakpointName]),
|
|
@@ -293,10 +291,10 @@ const MiniResponsive = (props) => {
|
|
|
293
291
|
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[realBreakpointName] - 1),
|
|
294
292
|
belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
|
|
295
293
|
__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
|
|
296
|
-
breakpointData[belowOverride
|
|
294
|
+
breakpointData[belowOverride?.replace("max-", "")],
|
|
297
295
|
breakpointData[realBreakpointName] - 1
|
|
298
296
|
),
|
|
299
|
-
typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint
|
|
297
|
+
typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint?.replace("max-", "")])
|
|
300
298
|
] })
|
|
301
299
|
] }),
|
|
302
300
|
typeof value[breakpoint] === "undefined" && /* @__PURE__ */ jsx("span", { className: "es:mt-2 es:block es:font-medium es:italic", children: __("Not set", "eightshift-ui-components") }),
|
|
@@ -306,28 +304,28 @@ const MiniResponsive = (props) => {
|
|
|
306
304
|
{
|
|
307
305
|
dotsStart: belowOverride,
|
|
308
306
|
blocks: [
|
|
309
|
-
aboveOverride !== "_default" && typeof
|
|
310
|
-
breakpoint:
|
|
311
|
-
value:
|
|
307
|
+
aboveOverride !== "_default" && typeof value?.[aboveOverride] !== "undefined" && {
|
|
308
|
+
breakpoint: breakpointUiData?.[aboveOverride]?.label ?? aboveOverride,
|
|
309
|
+
value: options?.find((opt) => opt.value === value?.[aboveOverride])?.label ?? upperFirst(value?.[aboveOverride]),
|
|
312
310
|
dotsStart: !belowOverride,
|
|
313
311
|
alignEnd: !belowOverride
|
|
314
312
|
},
|
|
315
|
-
aboveOverride === "_default" && typeof
|
|
313
|
+
aboveOverride === "_default" && typeof value?.["_default"] !== "undefined" && {
|
|
316
314
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
317
|
-
value:
|
|
315
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
318
316
|
dotsStart: !belowOverride,
|
|
319
317
|
alignEnd: !belowOverride
|
|
320
318
|
},
|
|
321
319
|
{
|
|
322
|
-
breakpoint:
|
|
323
|
-
value:
|
|
320
|
+
breakpoint: breakpointUiData?.[realBreakpointName]?.label ?? realBreakpointName,
|
|
321
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[breakpoint]),
|
|
324
322
|
width: breakpointData[realBreakpointName],
|
|
325
323
|
active: true,
|
|
326
324
|
dotsEnd: !belowOverride
|
|
327
325
|
},
|
|
328
|
-
belowOverride && typeof
|
|
329
|
-
breakpoint:
|
|
330
|
-
value:
|
|
326
|
+
belowOverride && typeof value?.[belowOverride] !== "undefined" && {
|
|
327
|
+
breakpoint: breakpointUiData?.[belowOverride]?.label ?? belowOverride,
|
|
328
|
+
value: options?.find((opt) => opt.value === value?.[belowOverride])?.label ?? upperFirst(value?.[belowOverride]),
|
|
331
329
|
width: breakpointData[belowOverride],
|
|
332
330
|
dotsEnd: true
|
|
333
331
|
}
|
|
@@ -341,24 +339,24 @@ const MiniResponsive = (props) => {
|
|
|
341
339
|
dotsEnd: aboveOverride !== "_default",
|
|
342
340
|
blocks: [
|
|
343
341
|
belowOverride && {
|
|
344
|
-
breakpoint:
|
|
345
|
-
value:
|
|
342
|
+
breakpoint: breakpointUiData?.[belowOverride?.replace("max-", "")]?.label ?? belowOverride?.replace("max-", ""),
|
|
343
|
+
value: options?.find((opt) => opt.value === value?.[belowOverride])?.label ?? upperFirst(value?.[belowOverride])
|
|
346
344
|
},
|
|
347
345
|
{
|
|
348
|
-
breakpoint:
|
|
349
|
-
value:
|
|
350
|
-
width: breakpointData[
|
|
346
|
+
breakpoint: breakpointUiData?.[realBreakpointName]?.label ?? realBreakpointName,
|
|
347
|
+
value: options?.find((opt) => opt.value === value?.[breakpoint])?.label ?? upperFirst(value?.[realBreakpointName]),
|
|
348
|
+
width: breakpointData[filterBreakpoints[i - 1]?.replace("max-", "")],
|
|
351
349
|
active: true
|
|
352
350
|
},
|
|
353
351
|
aboveOverride !== "_default" && {
|
|
354
|
-
breakpoint:
|
|
355
|
-
value:
|
|
356
|
-
width: breakpointData[breakpoint
|
|
352
|
+
breakpoint: breakpointUiData?.[aboveOverride?.replace("max-", "")]?.label ?? aboveOverride?.replace("max-", ""),
|
|
353
|
+
value: options?.find((opt) => opt.value === value?.[aboveOverride])?.label ?? upperFirst(value?.[aboveOverride]),
|
|
354
|
+
width: breakpointData[breakpoint?.replace("max-", "")]
|
|
357
355
|
},
|
|
358
356
|
aboveOverride === "_default" && {
|
|
359
357
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
360
|
-
value:
|
|
361
|
-
width: breakpointData[breakpoint
|
|
358
|
+
value: options?.find((opt) => opt.value === value?.["_default"])?.label ?? upperFirst(value?.["_default"]),
|
|
359
|
+
width: breakpointData[breakpoint?.replace("max-", "")],
|
|
362
360
|
dotsEnd: true
|
|
363
361
|
}
|
|
364
362
|
]
|
|
@@ -373,14 +371,14 @@ const MiniResponsive = (props) => {
|
|
|
373
371
|
"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",
|
|
374
372
|
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"
|
|
375
373
|
),
|
|
376
|
-
children:
|
|
374
|
+
children: icons?.[breakpointUiData?.[realBreakpointName]?.icon] ?? breakpointUiData?.[realBreakpointName]?.icon ?? icons?.[`screen${upperFirst(realBreakpointName)}`]
|
|
377
375
|
}
|
|
378
376
|
)
|
|
379
377
|
}
|
|
380
378
|
),
|
|
381
379
|
children({
|
|
382
380
|
breakpoint,
|
|
383
|
-
currentValue: value
|
|
381
|
+
currentValue: value?.[breakpoint],
|
|
384
382
|
handleChange: (newValue) => {
|
|
385
383
|
onChange({
|
|
386
384
|
...value,
|
|
@@ -399,7 +397,7 @@ const MiniResponsive = (props) => {
|
|
|
399
397
|
onChange(newValue);
|
|
400
398
|
},
|
|
401
399
|
icon: icons.clearAlt,
|
|
402
|
-
disabled: typeof
|
|
400
|
+
disabled: typeof value?.[breakpoint] === "undefined",
|
|
403
401
|
type: "ghost"
|
|
404
402
|
}
|
|
405
403
|
)
|
|
@@ -422,7 +420,7 @@ const MiniResponsive = (props) => {
|
|
|
422
420
|
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
423
421
|
/* @__PURE__ */ jsx("div", { className: "es:w-full es:col-start-2 es:col-end-2", children: children({
|
|
424
422
|
breakpoint: "_default",
|
|
425
|
-
currentValue: value
|
|
423
|
+
currentValue: value?.["_default"],
|
|
426
424
|
handleChange: (newValue) => onChange({
|
|
427
425
|
...value,
|
|
428
426
|
_default: newValue
|
|
@@ -442,7 +440,7 @@ const MiniResponsive = (props) => {
|
|
|
442
440
|
{
|
|
443
441
|
triggerButtonLabel: __("Responsive preview", "eightshift-ui-components"),
|
|
444
442
|
triggerButtonProps: {
|
|
445
|
-
disabled: !Object.keys(value).some((key) => !
|
|
443
|
+
disabled: !Object.keys(value).some((key) => !key?.startsWith("_") && typeof value?.[key] !== "undefined"),
|
|
446
444
|
type: "ghost",
|
|
447
445
|
className: "es:my-1"
|
|
448
446
|
},
|
|
@@ -472,7 +470,7 @@ const MiniResponsive = (props) => {
|
|
|
472
470
|
Button,
|
|
473
471
|
{
|
|
474
472
|
icon: icons.clearAlt,
|
|
475
|
-
disabled: !Object.keys(value).some((key) => !
|
|
473
|
+
disabled: !Object.keys(value).some((key) => !key?.startsWith("_") && typeof value?.[key] !== "undefined"),
|
|
476
474
|
onPress: () => {
|
|
477
475
|
const newValue = { ...value };
|
|
478
476
|
[...breakpoints, ...desktopFirstBreakpoints].forEach((breakpoint) => {
|
|
@@ -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 { s as sprintf, _ as __ } from "../../default-i18n-
|
|
5
|
+
import { s as sprintf, _ as __ } 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";
|
|
@@ -98,52 +98,49 @@ const ResponsiveLegacy = (props) => {
|
|
|
98
98
|
const inheritValue = allowUndefined ? void 0 : rawInheritValue;
|
|
99
99
|
const [detailsVisible, setDetailsVisible] = useState(false);
|
|
100
100
|
const breakpoints = rawBreakpoints.slice(1);
|
|
101
|
-
const globalOverride = breakpoints.find((breakpoint) =>
|
|
101
|
+
const globalOverride = breakpoints.find((breakpoint) => value?.[attribute[breakpoint]] !== inheritValue);
|
|
102
102
|
const defaultBreakpoint = rawBreakpoints[0];
|
|
103
103
|
if (hidden) {
|
|
104
104
|
return null;
|
|
105
105
|
}
|
|
106
|
-
const DefaultTooltip = () =>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
!globalOverride && __("Always applied, regardless of browser width.", "eightshift-ui-components"),
|
|
120
|
-
globalOverride && sprintf(__("Applied when the browser width is %dpx or wider.", "eightshift-ui-components"), breakpointData[globalOverride] + 1)
|
|
121
|
-
] }),
|
|
122
|
-
globalOverride && /* @__PURE__ */ jsx("div", { className: "es:mx-auto es:mt-2", children: /* @__PURE__ */ jsx(
|
|
123
|
-
BreakpointPreview,
|
|
124
|
-
{
|
|
125
|
-
blocks: [
|
|
126
|
-
{
|
|
127
|
-
breakpoint: globalOverride,
|
|
128
|
-
value: ((_a = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[globalOverride]]))) == null ? void 0 : _a.label) ?? upperFirst(value == null ? void 0 : value[globalOverride]),
|
|
129
|
-
dotsStart: true,
|
|
130
|
-
alignEnd: true
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
breakpoint: __("Default", "eightshift-ui-components"),
|
|
134
|
-
value: ((_b = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[defaultBreakpoint]]))) == null ? void 0 : _b.label) ?? upperFirst(value == null ? void 0 : value[defaultBreakpoint]),
|
|
135
|
-
width: breakpointData[globalOverride] + 1,
|
|
136
|
-
dotsEnd: true,
|
|
137
|
-
active: true
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
) })
|
|
106
|
+
const DefaultTooltip = () => /* @__PURE__ */ jsx(
|
|
107
|
+
DecorativeTooltip,
|
|
108
|
+
{
|
|
109
|
+
placement: "left",
|
|
110
|
+
className: "es:p-3",
|
|
111
|
+
theme: "light",
|
|
112
|
+
offset: 7.5,
|
|
113
|
+
arrow: true,
|
|
114
|
+
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-64 es:p-1", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "es:block es:text-balance es:font-semibold es:tabular-nums", children: __("Default", "eightshift-ui-components") }),
|
|
116
|
+
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
117
|
+
!globalOverride && __("Always applied, regardless of browser width.", "eightshift-ui-components"),
|
|
118
|
+
globalOverride && sprintf(__("Applied when the browser width is %dpx or wider.", "eightshift-ui-components"), breakpointData[globalOverride] + 1)
|
|
142
119
|
] }),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
120
|
+
globalOverride && /* @__PURE__ */ jsx("div", { className: "es:mx-auto es:mt-2", children: /* @__PURE__ */ jsx(
|
|
121
|
+
BreakpointPreview,
|
|
122
|
+
{
|
|
123
|
+
blocks: [
|
|
124
|
+
{
|
|
125
|
+
breakpoint: globalOverride,
|
|
126
|
+
value: options?.find((opt) => opt.value === value?.[attribute[globalOverride]])?.label ?? upperFirst(value?.[globalOverride]),
|
|
127
|
+
dotsStart: true,
|
|
128
|
+
alignEnd: true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
breakpoint: __("Default", "eightshift-ui-components"),
|
|
132
|
+
value: options?.find((opt) => opt.value === value?.[attribute[defaultBreakpoint]])?.label ?? upperFirst(value?.[defaultBreakpoint]),
|
|
133
|
+
width: breakpointData[globalOverride] + 1,
|
|
134
|
+
dotsEnd: true,
|
|
135
|
+
active: true
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
) })
|
|
140
|
+
] }),
|
|
141
|
+
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[`screen${upperFirst(defaultBreakpoint)}`] ?? icons.play })
|
|
142
|
+
}
|
|
143
|
+
);
|
|
147
144
|
return /* @__PURE__ */ jsxs(
|
|
148
145
|
BaseControl,
|
|
149
146
|
{
|
|
@@ -161,7 +158,7 @@ const ResponsiveLegacy = (props) => {
|
|
|
161
158
|
noInitial: true,
|
|
162
159
|
children: children({
|
|
163
160
|
breakpoint: defaultBreakpoint,
|
|
164
|
-
currentValue: value
|
|
161
|
+
currentValue: value?.[attribute[defaultBreakpoint]],
|
|
165
162
|
options,
|
|
166
163
|
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue),
|
|
167
164
|
isInlineCollapsedView: true
|
|
@@ -195,7 +192,7 @@ const ResponsiveLegacy = (props) => {
|
|
|
195
192
|
detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
196
193
|
/* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
|
|
197
194
|
breakpoint: defaultBreakpoint,
|
|
198
|
-
currentValue: value
|
|
195
|
+
currentValue: value?.[attribute[defaultBreakpoint]],
|
|
199
196
|
options,
|
|
200
197
|
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue)
|
|
201
198
|
}) })
|
|
@@ -218,7 +215,7 @@ const ResponsiveLegacy = (props) => {
|
|
|
218
215
|
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
219
216
|
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
220
217
|
breakpoint: defaultBreakpoint,
|
|
221
|
-
currentValue: value
|
|
218
|
+
currentValue: value?.[attribute[defaultBreakpoint]],
|
|
222
219
|
options,
|
|
223
220
|
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue),
|
|
224
221
|
isInlineExpandedView: true
|
|
@@ -233,10 +230,9 @@ const ResponsiveLegacy = (props) => {
|
|
|
233
230
|
visible: detailsVisible,
|
|
234
231
|
className: "es:space-y-2",
|
|
235
232
|
children: breakpoints.map((breakpoint, i) => {
|
|
236
|
-
var _a, _b, _c, _d, _e;
|
|
237
233
|
const isOverrideSet = value[attribute[breakpoint]] !== inheritValue;
|
|
238
|
-
const aboveOverride = rawBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) =>
|
|
239
|
-
const belowOverride = rawBreakpoints.slice(i + 2).find((breakpoint2) =>
|
|
234
|
+
const aboveOverride = rawBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) => value?.[attribute[breakpoint2]] !== inheritValue);
|
|
235
|
+
const belowOverride = rawBreakpoints.slice(i + 2).find((breakpoint2) => value?.[attribute[breakpoint2]] !== inheritValue);
|
|
240
236
|
return /* @__PURE__ */ jsxs(
|
|
241
237
|
"div",
|
|
242
238
|
{
|
|
@@ -273,14 +269,14 @@ const ResponsiveLegacy = (props) => {
|
|
|
273
269
|
blocks: [
|
|
274
270
|
belowOverride && {
|
|
275
271
|
breakpoint: belowOverride,
|
|
276
|
-
value:
|
|
272
|
+
value: options?.find((opt) => opt.value === value?.[attribute[belowOverride]])?.label ?? upperFirst(value?.[belowOverride]),
|
|
277
273
|
widthEnd: breakpointData[belowOverride],
|
|
278
274
|
dotsStart: true,
|
|
279
275
|
alignEnd: true
|
|
280
276
|
},
|
|
281
277
|
{
|
|
282
278
|
breakpoint,
|
|
283
|
-
value:
|
|
279
|
+
value: options?.find((opt) => opt.value === value?.[attribute[breakpoint]])?.label ?? upperFirst(value?.[breakpoint]),
|
|
284
280
|
widthEnd: breakpointData[breakpoint],
|
|
285
281
|
active: true,
|
|
286
282
|
alignEnd: true,
|
|
@@ -288,12 +284,12 @@ const ResponsiveLegacy = (props) => {
|
|
|
288
284
|
},
|
|
289
285
|
aboveOverride !== defaultBreakpoint && {
|
|
290
286
|
breakpoint: aboveOverride,
|
|
291
|
-
value:
|
|
287
|
+
value: options?.find((opt) => opt.value === value?.[attribute[aboveOverride]])?.label ?? upperFirst(value?.[aboveOverride]),
|
|
292
288
|
dotsEnd: true
|
|
293
289
|
},
|
|
294
290
|
aboveOverride === defaultBreakpoint && {
|
|
295
291
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
296
|
-
value:
|
|
292
|
+
value: options?.find((opt) => opt.value === value?.[attribute[defaultBreakpoint]])?.label ?? upperFirst(value?.[defaultBreakpoint]),
|
|
297
293
|
dotsEnd: true
|
|
298
294
|
}
|
|
299
295
|
]
|
|
@@ -307,14 +303,14 @@ const ResponsiveLegacy = (props) => {
|
|
|
307
303
|
"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",
|
|
308
304
|
value[attribute[breakpoint]] === inheritValue ? "es:border-secondary-200 es:bg-secondary-50 es:text-secondary-700" : "es:border-secondary-100 es:bg-white es:text-secondary-500"
|
|
309
305
|
),
|
|
310
|
-
children:
|
|
306
|
+
children: icons?.[`screen${upperFirst(breakpoint)}`]
|
|
311
307
|
}
|
|
312
308
|
)
|
|
313
309
|
}
|
|
314
310
|
),
|
|
315
311
|
/* @__PURE__ */ jsx("div", { className: "es:w-full", children: children({
|
|
316
312
|
breakpoint,
|
|
317
|
-
currentValue: value
|
|
313
|
+
currentValue: value?.[attribute[breakpoint]],
|
|
318
314
|
options,
|
|
319
315
|
handleChange: (newValue) => onChange(attribute[breakpoint], newValue)
|
|
320
316
|
}) }),
|
|
@@ -323,7 +319,7 @@ const ResponsiveLegacy = (props) => {
|
|
|
323
319
|
{
|
|
324
320
|
onPress: () => onChange(attribute[breakpoint], inheritValue),
|
|
325
321
|
icon: icons.clearAlt,
|
|
326
|
-
disabled:
|
|
322
|
+
disabled: value?.[attribute[breakpoint]] === inheritValue,
|
|
327
323
|
type: "ghost"
|
|
328
324
|
}
|
|
329
325
|
)
|