@eightshift/ui-components 3.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +101 -101
- package/dist/Button-BPLceDeW.js +0 -185
- package/dist/Collection-CZxddMZS.js +0 -2332
- package/dist/Color-MV5kBVXr.js +0 -2452
- package/dist/ColorSwatch-BqQfVu4L.js +0 -64
- package/dist/ComboBox-_RfyhwZw.js +0 -1906
- package/dist/Dialog-8tYeQ9n4.js +0 -2300
- package/dist/FieldError-52GVSGgC.js +0 -42
- package/dist/FocusScope-Cri5BFRz.js +0 -831
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/Group-_emcIVxI.js +0 -48
- package/dist/Heading-B2153VXe.js +0 -16
- package/dist/Hidden-rE6uR-lr.js +0 -41
- package/dist/Input-BxpFEIXV.js +0 -133
- package/dist/Label-icmbmNdI.js +0 -17
- package/dist/List-CZMUbkFU.js +0 -593
- package/dist/ListBox-Ca6hiCqz.js +0 -581
- package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
- package/dist/OverlayArrow-CYXQSlEU.js +0 -629
- package/dist/RSPContexts-2lR5GG9p.js +0 -14
- package/dist/Select-aab027f3.esm-PDJCDE95.js +0 -2469
- package/dist/Separator-4IIDRlV_.js +0 -322
- package/dist/Slider-rz2XRMGm.js +0 -853
- package/dist/Text-DVSAPY-K.js +0 -16
- package/dist/VisuallyHidden-f9zX67a_.js +0 -48
- package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
- package/dist/assets/index.css +0 -37
- package/dist/assets/style-admin.css +0 -5255
- package/dist/assets/style-editor.css +0 -5255
- package/dist/assets/style.css +0 -5261
- package/dist/assets/wp-font-enhancements.css +0 -8
- package/dist/assets/wp-ui-enhancements.css +0 -299
- package/dist/components/animated-visibility/animated-visibility.js +0 -105
- package/dist/components/base-control/base-control.js +0 -86
- package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
- package/dist/components/button/button.js +0 -387
- package/dist/components/checkbox/checkbox.js +0 -320
- package/dist/components/color-pickers/color-picker.js +0 -272
- package/dist/components/color-pickers/color-swatch.js +0 -58
- package/dist/components/color-pickers/gradient-editor.js +0 -534
- package/dist/components/color-pickers/solid-color-picker.js +0 -1567
- package/dist/components/component-toggle/component-toggle.js +0 -158
- package/dist/components/container-panel/container-panel.js +0 -131
- package/dist/components/draggable/draggable-context.js +0 -5
- package/dist/components/draggable/draggable-handle.js +0 -46
- package/dist/components/draggable/draggable.js +0 -6207
- package/dist/components/draggable-list/draggable-list-context.js +0 -5
- package/dist/components/draggable-list/draggable-list-item.js +0 -77
- package/dist/components/draggable-list/draggable-list.js +0 -151
- package/dist/components/expandable/expandable.js +0 -342
- package/dist/components/index.js +0 -137
- package/dist/components/input-field/input-field.js +0 -231
- package/dist/components/item-collection/item-collection.js +0 -59
- package/dist/components/layout/hstack.js +0 -30
- package/dist/components/layout/vstack.js +0 -30
- package/dist/components/link-input/link-input.js +0 -293
- package/dist/components/matrix-align/matrix-align.js +0 -134
- package/dist/components/menu/menu.js +0 -285
- package/dist/components/modal/modal.js +0 -305
- package/dist/components/notice/notice.js +0 -123
- package/dist/components/number-picker/number-picker.js +0 -292
- package/dist/components/option-select/option-select.js +0 -264
- package/dist/components/options-panel/options-panel.js +0 -158
- package/dist/components/placeholders/file-placeholder.js +0 -42
- package/dist/components/placeholders/image-placeholder.js +0 -88
- package/dist/components/placeholders/media-placeholder.js +0 -63
- package/dist/components/popover/popover.js +0 -207
- package/dist/components/radio/radio.js +0 -579
- package/dist/components/repeater/repeater-context.js +0 -5
- package/dist/components/repeater/repeater-item.js +0 -119
- package/dist/components/repeater/repeater.js +0 -280
- package/dist/components/responsive/mini-responsive.js +0 -498
- package/dist/components/responsive/responsive-legacy.js +0 -343
- package/dist/components/responsive/responsive.js +0 -580
- package/dist/components/responsive-preview/responsive-preview.js +0 -123
- package/dist/components/rich-label/rich-label.js +0 -66
- package/dist/components/select/async-multi-select.js +0 -157
- package/dist/components/select/async-single-select.js +0 -137
- package/dist/components/select/custom-select-default-components.js +0 -38
- package/dist/components/select/multi-select-components.js +0 -8
- package/dist/components/select/multi-select.js +0 -151
- package/dist/components/select/react-select-component-wrappers.js +0 -90
- package/dist/components/select/shared.js +0 -26
- package/dist/components/select/single-select.js +0 -131
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-select.js +0 -297
- package/dist/components/select/v2/shared.js +0 -24
- package/dist/components/select/v2/single-select.js +0 -990
- package/dist/components/slider/column-config-slider.js +0 -210
- package/dist/components/slider/slider.js +0 -343
- package/dist/components/slider/utils.js +0 -84
- package/dist/components/spacer/spacer.js +0 -97
- package/dist/components/tabs/tabs.js +0 -702
- package/dist/components/toggle/switch.js +0 -155
- package/dist/components/toggle/toggle.js +0 -64
- package/dist/components/toggle-button/toggle-button.js +0 -324
- package/dist/components/tooltip/tooltip.js +0 -525
- package/dist/context-D2KUdwNL.js +0 -92
- package/dist/default-i18n-CT_oS1Fy.js +0 -922
- package/dist/filterDOMProps-EDDcM64A.js +0 -28
- package/dist/icons/block-icon.js +0 -42
- package/dist/icons/generic-color-swatch.js +0 -113
- package/dist/icons/icons.js +0 -30371
- package/dist/icons/index.js +0 -11
- package/dist/icons/jsx-svg.js +0 -50
- package/dist/index-641ee5b8.esm-DIuJijyT.js +0 -3137
- package/dist/index-BKGQ6jGS.js +0 -44
- package/dist/index-CFozsmNS.js +0 -28321
- package/dist/index.js +0 -139
- package/dist/lite-DVmmD_-j.js +0 -7
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-Sp-JEFEX.js +0 -3744
- package/dist/number-GajL10e1.js +0 -36
- package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
- package/dist/react-select-async.esm-Bql4G5iV.js +0 -107
- package/dist/react-select.esm-B_TudhTU.js +0 -15
- package/dist/style-admin.js +0 -1
- package/dist/style-editor.js +0 -1
- package/dist/style.js +0 -1
- package/dist/textSelection-0UUS8Yfg.js +0 -46
- package/dist/useButton-Cg474OYB.js +0 -71
- package/dist/useEvent-B0b-6KBr.js +0 -23
- package/dist/useFocusRing-CV5l3lf6.js +0 -107
- package/dist/useFormReset-C5OggHsw.js +0 -22
- package/dist/useFormValidation-DhDNSjws.js +0 -224
- package/dist/useHover-DwDr6ozG.js +0 -900
- package/dist/useLabel-D7HkNEHT.js +0 -27
- package/dist/useLabels-D8cxd1Z8.js +0 -23
- package/dist/useListState-DVr6aYd_.js +0 -161
- package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
- package/dist/useNumberField-TwM0Z9D1.js +0 -1204
- package/dist/useNumberFormatter-321rAb4J.js +0 -13
- package/dist/usePress-Cucx-xSA.js +0 -664
- package/dist/useSingleSelectListState-CMGsRHHh.js +0 -38
- package/dist/useToggle-C0I3vs0g.js +0 -59
- package/dist/useToggleState-CmQX3SoX.js +0 -19
- package/dist/utilities/array-helpers.js +0 -56
- package/dist/utilities/debounce-throttle.js +0 -123
- package/dist/utilities/es-dash.js +0 -376
- package/dist/utilities/index.js +0 -27
- package/dist/utilities/text-helpers.js +0 -136
- package/dist/utils-DkCSC521.js +0 -370
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement } from "react";
|
|
3
|
-
import { DecorativeTooltip } from "../tooltip/tooltip.js";
|
|
4
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
5
|
-
import { _ as __, s as sprintf } from "../../default-i18n-CT_oS1Fy.js";
|
|
6
|
-
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
7
|
-
import { upperFirst } from "../../utilities/es-dash.js";
|
|
8
|
-
import { icons } from "../../icons/icons.js";
|
|
9
|
-
import { ResponsivePreview } from "../responsive-preview/responsive-preview.js";
|
|
10
|
-
import { ButtonGroup, Button } from "../button/button.js";
|
|
11
|
-
import { Spacer } from "../spacer/spacer.js";
|
|
12
|
-
import { BaseControl } from "../base-control/base-control.js";
|
|
13
|
-
import { TriggeredPopover } from "../popover/popover.js";
|
|
14
|
-
import { OptionSelect } from "../option-select/option-select.js";
|
|
15
|
-
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../Text-DVSAPY-K.js";
|
|
16
|
-
/**
|
|
17
|
-
* A compact, inline version of `Responsive`. Allows the user to set different values for different breakpoints.
|
|
18
|
-
*
|
|
19
|
-
* Inner items should be passed as a render function.
|
|
20
|
-
* The following props are passed to the render function:
|
|
21
|
-
* - `breakpoint: string` - Name of the current breakpoint.
|
|
22
|
-
* - `currentValue: any` - Current value.
|
|
23
|
-
* - `handleChange: Function<(attributeName: string, value: any) => void>` - A function to change the value for the breakpoint..
|
|
24
|
-
* - `options: Object<string, any>` - (Optional) Options list passed to the `ResponsiveLegacy` component. (optional)
|
|
25
|
-
* - `isInlineCollapsedView: boolean` - (Optional) `true` if in the main view, with the detail popover closed.
|
|
26
|
-
* - `isInlineExpandedView: boolean` - (Optional) `true` if the detail popover is open.
|
|
27
|
-
*
|
|
28
|
-
* @component
|
|
29
|
-
* @param {Object} props - Component props.
|
|
30
|
-
* @param {Object} props.value - The current value of the component.
|
|
31
|
-
* @param {Function} props.onChange - Function to run when the value changes. `(newValue: Object) => void`.
|
|
32
|
-
* @param {JSX.Element} props.icon - The icon of the component.
|
|
33
|
-
* @param {string} props.help - The help text of the component.
|
|
34
|
-
* @param {string} props.label - The label of the component.
|
|
35
|
-
* @param {string} props.subtitle - The subtitle of the component.
|
|
36
|
-
* @param {{label: string, value: string}[]} props.options - Options of the attribute the component is linked to. `{ value: string, label: string }[]`.
|
|
37
|
-
* @param {string[]} props.breakpoints - Breakpoints to use.
|
|
38
|
-
* @param {string[]} [props.desktopFirstBreakpoints] - Breakpoints to use in desktop-first mode. If not provided, the breakpoints will be used in reverse order.
|
|
39
|
-
* @param {Object<string, number>} [props.breakpointData] - Currently used breakpoint data. `{ [breakpoint: string]: number }`.
|
|
40
|
-
* @param {Object<string, number>} [props.breakpointUiData] - Allows overriding breakpoint names and icons. `{ [breakpoint: string]: { label: string, icon: JSX.Element|string } }`.
|
|
41
|
-
* @param {boolean} [props.noModeSelect] - If `true`, the mode selection (desktop-first/mobile-first) is hidden.
|
|
42
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
43
|
-
* @param {boolean} [props.useLegacyDesktopFirst] - If `true`, the legacy desktop-first mode is used. This is only for backwards compatibility.
|
|
44
|
-
* @param {'start' | 'center' | 'end' | 'stretch'} [props.innerContentAlign='start'] - Determines inner content alignment
|
|
45
|
-
*
|
|
46
|
-
* @returns {JSX.Element} The MiniResponsive component.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* <MiniResponsive
|
|
50
|
-
* value={value}
|
|
51
|
-
* onChange={onChange}
|
|
52
|
-
* icon={icons.myIcon}
|
|
53
|
-
* label={__('Label', 'eightshift-ui-components')}
|
|
54
|
-
* options={[
|
|
55
|
-
* { value: 'value1', label: 'Value 1' },
|
|
56
|
-
* { value: 'value2', label: 'Value 2' },
|
|
57
|
-
* { value: 'value3', label: 'Value 3' },
|
|
58
|
-
* ]}
|
|
59
|
-
* breakpoints={['mobile', 'tablet', 'desktop', 'large']}
|
|
60
|
-
* breakpointData={breakpointData}
|
|
61
|
-
* >
|
|
62
|
-
* {({ breakpoint, currentValue, options, handleChange }) => (
|
|
63
|
-
* <Select
|
|
64
|
-
* label={breakpoint}
|
|
65
|
-
* value={currentValue}
|
|
66
|
-
* options={options}
|
|
67
|
-
* onChange={handleChange}
|
|
68
|
-
* />
|
|
69
|
-
* )}
|
|
70
|
-
* </MiniResponsive>
|
|
71
|
-
*
|
|
72
|
-
* @preserve
|
|
73
|
-
*/
|
|
74
|
-
const MiniResponsive = (props) => {
|
|
75
|
-
const {
|
|
76
|
-
value,
|
|
77
|
-
onChange,
|
|
78
|
-
icon,
|
|
79
|
-
help,
|
|
80
|
-
label,
|
|
81
|
-
subtitle,
|
|
82
|
-
options,
|
|
83
|
-
breakpoints: rawBreakpoints,
|
|
84
|
-
desktopFirstBreakpoints: rawDesktopFirstBreakpoints,
|
|
85
|
-
breakpointData,
|
|
86
|
-
breakpointUiData,
|
|
87
|
-
noModeSelect,
|
|
88
|
-
children,
|
|
89
|
-
hidden,
|
|
90
|
-
useLegacyDesktopFirst,
|
|
91
|
-
innerContentAlign = "start"
|
|
92
|
-
} = props;
|
|
93
|
-
if (typeof rawBreakpoints === "undefined" || !Array.isArray(rawBreakpoints)) {
|
|
94
|
-
console.warn(__("MiniResponsive: Missing or invalid 'breakpoints' prop.", "eightshift-ui-components"));
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
const breakpoints = rawBreakpoints.slice(1);
|
|
98
|
-
let desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
99
|
-
if (useLegacyDesktopFirst) {
|
|
100
|
-
desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
101
|
-
}
|
|
102
|
-
const isDesktopFirst = (value == null ? void 0 : value["_desktopFirst"]) === true;
|
|
103
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
|
|
104
|
-
const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
|
|
105
|
-
const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
|
|
106
|
-
if (hidden) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
const DefaultTooltip = () => {
|
|
110
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
111
|
-
const overrideIcon = (_a = breakpointUiData == null ? void 0 : breakpointUiData[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]) == null ? void 0 : _a.icon;
|
|
112
|
-
return /* @__PURE__ */ jsx(
|
|
113
|
-
DecorativeTooltip,
|
|
114
|
-
{
|
|
115
|
-
placement: "left",
|
|
116
|
-
className: "es:p-3",
|
|
117
|
-
theme: "light",
|
|
118
|
-
offset: 7.5,
|
|
119
|
-
arrow: true,
|
|
120
|
-
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-64 es:p-1", children: [
|
|
121
|
-
/* @__PURE__ */ jsx("span", { className: "es:block es:text-balance es:font-semibold es:tabular-nums", children: __("Default", "eightshift-ui-components") }),
|
|
122
|
-
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
123
|
-
!firstMobileFirstOverride && !lastDesktopFirstOverride && __("Always applied, regardless of browser width.", "eightshift-ui-components"),
|
|
124
|
-
firstMobileFirstOverride && !isDesktopFirst && sprintf(__("Applies when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[firstMobileFirstOverride] - 1),
|
|
125
|
-
lastDesktopFirstOverride && isDesktopFirst && sprintf(__("Applies when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[lastDesktopFirstOverride.replace("max-", "")])
|
|
126
|
-
] }),
|
|
127
|
-
/* @__PURE__ */ jsxs("div", { className: "es:mx-auto", children: [
|
|
128
|
-
firstMobileFirstOverride && !isDesktopFirst && /* @__PURE__ */ jsx(
|
|
129
|
-
BreakpointPreview,
|
|
130
|
-
{
|
|
131
|
-
blocks: [
|
|
132
|
-
{
|
|
133
|
-
breakpoint: __("Default", "eightshift-ui-components"),
|
|
134
|
-
widthEnd: breakpointData[firstMobileFirstOverride] - 1,
|
|
135
|
-
value: ((_b = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value["_default"]))) == null ? void 0 : _b.label) ?? upperFirst(value == null ? void 0 : value["_default"]),
|
|
136
|
-
dotsStart: true,
|
|
137
|
-
alignEnd: true,
|
|
138
|
-
active: true
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
breakpoint: ((_c = breakpointUiData == null ? void 0 : breakpointUiData[firstMobileFirstOverride]) == null ? void 0 : _c.label) ?? firstMobileFirstOverride,
|
|
142
|
-
value: ((_d = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[firstMobileFirstOverride]))) == null ? void 0 : _d.label) ?? upperFirst(value == null ? void 0 : value[firstMobileFirstOverride]),
|
|
143
|
-
dotsEnd: true
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
lastDesktopFirstOverride && isDesktopFirst && /* @__PURE__ */ jsx(
|
|
149
|
-
BreakpointPreview,
|
|
150
|
-
{
|
|
151
|
-
blocks: [
|
|
152
|
-
{
|
|
153
|
-
breakpoint: ((_e = breakpointUiData == null ? void 0 : breakpointUiData[lastDesktopFirstOverride.replace("max-", "")]) == null ? void 0 : _e.label) ?? lastDesktopFirstOverride.replace("max-", ""),
|
|
154
|
-
value: ((_f = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[lastDesktopFirstOverride]))) == null ? void 0 : _f.label) ?? upperFirst(value == null ? void 0 : value[lastDesktopFirstOverride]),
|
|
155
|
-
dotsStart: true,
|
|
156
|
-
alignEnd: true
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
breakpoint: __("Default", "eightshift-ui-components"),
|
|
160
|
-
value: ((_g = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value["_default"]))) == null ? void 0 : _g.label) ?? upperFirst(value == null ? void 0 : value["_default"]),
|
|
161
|
-
width: breakpointData[lastDesktopFirstOverride.replace("max-", "")],
|
|
162
|
-
dotsEnd: true,
|
|
163
|
-
active: true
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
] })
|
|
169
|
-
] }),
|
|
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: ((_h = icons) == null ? void 0 : _h[overrideIcon]) ?? overrideIcon ?? icons[`screen${upperFirst(isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0))}`] })
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
return /* @__PURE__ */ jsx(
|
|
175
|
-
BaseControl,
|
|
176
|
-
{
|
|
177
|
-
icon,
|
|
178
|
-
label,
|
|
179
|
-
subtitle,
|
|
180
|
-
help,
|
|
181
|
-
inline: true,
|
|
182
|
-
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
183
|
-
children({
|
|
184
|
-
breakpoint: "_default",
|
|
185
|
-
currentValue: value == null ? void 0 : value["_default"],
|
|
186
|
-
handleChange: (newValue) => onChange({
|
|
187
|
-
...value,
|
|
188
|
-
_default: newValue
|
|
189
|
-
}),
|
|
190
|
-
options,
|
|
191
|
-
key: Object.keys(value),
|
|
192
|
-
isInlineCollapsedView: true
|
|
193
|
-
}),
|
|
194
|
-
/* @__PURE__ */ jsxs(
|
|
195
|
-
TriggeredPopover,
|
|
196
|
-
{
|
|
197
|
-
triggerButtonIcon: cloneElement(isDesktopFirst ? icons.responsiveOverridesAlt : icons.responsiveOverridesAlt2, { className: "es:size-5!" }),
|
|
198
|
-
triggerButtonProps: {
|
|
199
|
-
tooltip: __("Responsive overrides", "eightshift-ui-components"),
|
|
200
|
-
className: "es:w-7"
|
|
201
|
-
},
|
|
202
|
-
className: "es:min-w-80 es:divide-y es:divide-secondary-200 es:p-0!",
|
|
203
|
-
children: [
|
|
204
|
-
/* @__PURE__ */ jsxs("div", { className: "es:flex es:items-center es:justify-between es:p-2", children: [
|
|
205
|
-
/* @__PURE__ */ jsx($514c0188e459b4c0$export$5f1af8db9871e1d6, { className: "es:block es:text-xs es:text-secondary-500", children: __("Responsive overrides", "eightshift-ui-components") }),
|
|
206
|
-
/* @__PURE__ */ jsx(
|
|
207
|
-
OptionSelect,
|
|
208
|
-
{
|
|
209
|
-
hidden: noModeSelect,
|
|
210
|
-
"aria-label": __("Breakpoint mode", "eightshift-ui-components"),
|
|
211
|
-
value: isDesktopFirst,
|
|
212
|
-
onChange: (newMode) => {
|
|
213
|
-
onChange({
|
|
214
|
-
_default: value["_default"],
|
|
215
|
-
_desktopFirst: newMode
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
options: [
|
|
219
|
-
{ label: __("Mobile-first", "eightshift-ui-components"), subtitle: __("Default", "eightshift-ui-components"), value: false },
|
|
220
|
-
{ label: __("Desktop-first", "eightshift-ui-components"), value: true }
|
|
221
|
-
],
|
|
222
|
-
wrapperProps: { triggerProps: { size: "small" } },
|
|
223
|
-
type: "menu",
|
|
224
|
-
tooltip: true
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
] }),
|
|
228
|
-
/* @__PURE__ */ jsxs("div", { className: "es:space-y-2 es:px-2 es:py-2.5", children: [
|
|
229
|
-
!isDesktopFirst && /* @__PURE__ */ jsxs(
|
|
230
|
-
"div",
|
|
231
|
-
{
|
|
232
|
-
className: clsx(
|
|
233
|
-
"es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
|
|
234
|
-
innerContentAlign === "start" && "es:justify-items-start",
|
|
235
|
-
innerContentAlign === "center" && "es:justify-items-center",
|
|
236
|
-
innerContentAlign === "end" && "es:justify-items-end",
|
|
237
|
-
innerContentAlign === "stretch" && "es:justify-items-stretch"
|
|
238
|
-
),
|
|
239
|
-
children: [
|
|
240
|
-
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
241
|
-
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
242
|
-
breakpoint: "_default",
|
|
243
|
-
currentValue: value == null ? void 0 : value["_default"],
|
|
244
|
-
handleChange: (newValue) => onChange({
|
|
245
|
-
...value,
|
|
246
|
-
_default: newValue
|
|
247
|
-
}),
|
|
248
|
-
options,
|
|
249
|
-
key: Object.keys(value),
|
|
250
|
-
isInlineExpandedView: true
|
|
251
|
-
}) })
|
|
252
|
-
]
|
|
253
|
-
},
|
|
254
|
-
"_default-mobile-first"
|
|
255
|
-
),
|
|
256
|
-
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
|
-
const realBreakpointName = breakpoint.replace("max-", "");
|
|
259
|
-
const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, "_default"] : ["_default", ...breakpointsToMap];
|
|
260
|
-
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(i + 1).find((breakpoint2) => typeof (value == null ? void 0 : value[breakpoint2]) !== "undefined") : filterBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) => typeof (value == null ? void 0 : value[breakpoint2]) !== "undefined");
|
|
261
|
-
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => typeof (value == null ? void 0 : value[breakpoint2]) !== "undefined") : filterBreakpoints.slice(i + 2).find((breakpoint2) => typeof (value == null ? void 0 : value[breakpoint2]) !== "undefined");
|
|
262
|
-
return /* @__PURE__ */ jsxs(
|
|
263
|
-
"div",
|
|
264
|
-
{
|
|
265
|
-
className: clsx(
|
|
266
|
-
"es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
|
|
267
|
-
innerContentAlign === "start" && "es:justify-items-start",
|
|
268
|
-
innerContentAlign === "center" && "es:justify-items-center",
|
|
269
|
-
innerContentAlign === "end" && "es:justify-items-end",
|
|
270
|
-
innerContentAlign === "stretch" && "es:justify-items-stretch"
|
|
271
|
-
),
|
|
272
|
-
children: [
|
|
273
|
-
/* @__PURE__ */ jsx(
|
|
274
|
-
DecorativeTooltip,
|
|
275
|
-
{
|
|
276
|
-
placement: "left",
|
|
277
|
-
theme: "light",
|
|
278
|
-
offset: 7.5,
|
|
279
|
-
arrow: true,
|
|
280
|
-
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-96 es:p-1", children: [
|
|
281
|
-
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children: ((_a = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _a.label) ?? upperFirst(realBreakpointName) }),
|
|
282
|
-
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
283
|
-
!isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
284
|
-
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[realBreakpointName]),
|
|
285
|
-
belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
|
|
286
|
-
__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
|
|
287
|
-
breakpointData[realBreakpointName],
|
|
288
|
-
breakpointData[belowOverride] - 1
|
|
289
|
-
),
|
|
290
|
-
typeof value[breakpoint] === "undefined" && sprintf(__("From %dpx", "eightshift-ui-components"), breakpointData[realBreakpointName])
|
|
291
|
-
] }),
|
|
292
|
-
isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
293
|
-
!belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[realBreakpointName] - 1),
|
|
294
|
-
belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
|
|
295
|
-
__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
|
|
296
|
-
breakpointData[belowOverride == null ? void 0 : belowOverride.replace("max-", "")],
|
|
297
|
-
breakpointData[realBreakpointName] - 1
|
|
298
|
-
),
|
|
299
|
-
typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")])
|
|
300
|
-
] })
|
|
301
|
-
] }),
|
|
302
|
-
typeof value[breakpoint] === "undefined" && /* @__PURE__ */ jsx("span", { className: "es:mt-2 es:block es:font-medium es:italic", children: __("Not set", "eightshift-ui-components") }),
|
|
303
|
-
typeof value[breakpoint] !== "undefined" && /* @__PURE__ */ jsxs("div", { className: "es:mx-auto es:mt-2", children: [
|
|
304
|
-
!isDesktopFirst && /* @__PURE__ */ jsx(
|
|
305
|
-
BreakpointPreview,
|
|
306
|
-
{
|
|
307
|
-
dotsStart: belowOverride,
|
|
308
|
-
blocks: [
|
|
309
|
-
aboveOverride !== "_default" && typeof (value == null ? void 0 : value[aboveOverride]) !== "undefined" && {
|
|
310
|
-
breakpoint: ((_b = breakpointUiData == null ? void 0 : breakpointUiData[aboveOverride]) == null ? void 0 : _b.label) ?? aboveOverride,
|
|
311
|
-
value: ((_c = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[aboveOverride]))) == null ? void 0 : _c.label) ?? upperFirst(value == null ? void 0 : value[aboveOverride]),
|
|
312
|
-
dotsStart: !belowOverride,
|
|
313
|
-
alignEnd: !belowOverride
|
|
314
|
-
},
|
|
315
|
-
aboveOverride === "_default" && typeof (value == null ? void 0 : value["_default"]) !== "undefined" && {
|
|
316
|
-
breakpoint: __("Default", "eightshift-ui-components"),
|
|
317
|
-
value: ((_d = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value["_default"]))) == null ? void 0 : _d.label) ?? upperFirst(value == null ? void 0 : value["_default"]),
|
|
318
|
-
dotsStart: !belowOverride,
|
|
319
|
-
alignEnd: !belowOverride
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
breakpoint: ((_e = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _e.label) ?? realBreakpointName,
|
|
323
|
-
value: ((_f = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[breakpoint]))) == null ? void 0 : _f.label) ?? upperFirst(value == null ? void 0 : value[breakpoint]),
|
|
324
|
-
width: breakpointData[realBreakpointName],
|
|
325
|
-
active: true,
|
|
326
|
-
dotsEnd: !belowOverride
|
|
327
|
-
},
|
|
328
|
-
belowOverride && typeof (value == null ? void 0 : value[belowOverride]) !== "undefined" && {
|
|
329
|
-
breakpoint: ((_g = breakpointUiData == null ? void 0 : breakpointUiData[belowOverride]) == null ? void 0 : _g.label) ?? belowOverride,
|
|
330
|
-
value: ((_h = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[belowOverride]))) == null ? void 0 : _h.label) ?? upperFirst(value == null ? void 0 : value[belowOverride]),
|
|
331
|
-
width: breakpointData[belowOverride],
|
|
332
|
-
dotsEnd: true
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
),
|
|
337
|
-
isDesktopFirst && /* @__PURE__ */ jsx(
|
|
338
|
-
BreakpointPreview,
|
|
339
|
-
{
|
|
340
|
-
dotsStart: true,
|
|
341
|
-
dotsEnd: aboveOverride !== "_default",
|
|
342
|
-
blocks: [
|
|
343
|
-
belowOverride && {
|
|
344
|
-
breakpoint: ((_i = breakpointUiData == null ? void 0 : breakpointUiData[belowOverride == null ? void 0 : belowOverride.replace("max-", "")]) == null ? void 0 : _i.label) ?? (belowOverride == null ? void 0 : belowOverride.replace("max-", "")),
|
|
345
|
-
value: ((_j = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[belowOverride]))) == null ? void 0 : _j.label) ?? upperFirst(value == null ? void 0 : value[belowOverride])
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
breakpoint: ((_k = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _k.label) ?? realBreakpointName,
|
|
349
|
-
value: ((_l = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[breakpoint]))) == null ? void 0 : _l.label) ?? upperFirst(value == null ? void 0 : value[realBreakpointName]),
|
|
350
|
-
width: breakpointData[(_m = filterBreakpoints[i - 1]) == null ? void 0 : _m.replace("max-", "")],
|
|
351
|
-
active: true
|
|
352
|
-
},
|
|
353
|
-
aboveOverride !== "_default" && {
|
|
354
|
-
breakpoint: ((_n = breakpointUiData == null ? void 0 : breakpointUiData[aboveOverride == null ? void 0 : aboveOverride.replace("max-", "")]) == null ? void 0 : _n.label) ?? (aboveOverride == null ? void 0 : aboveOverride.replace("max-", "")),
|
|
355
|
-
value: ((_o = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[aboveOverride]))) == null ? void 0 : _o.label) ?? upperFirst(value == null ? void 0 : value[aboveOverride]),
|
|
356
|
-
width: breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")]
|
|
357
|
-
},
|
|
358
|
-
aboveOverride === "_default" && {
|
|
359
|
-
breakpoint: __("Default", "eightshift-ui-components"),
|
|
360
|
-
value: ((_p = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value["_default"]))) == null ? void 0 : _p.label) ?? upperFirst(value == null ? void 0 : value["_default"]),
|
|
361
|
-
width: breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")],
|
|
362
|
-
dotsEnd: true
|
|
363
|
-
}
|
|
364
|
-
]
|
|
365
|
-
}
|
|
366
|
-
)
|
|
367
|
-
] })
|
|
368
|
-
] }),
|
|
369
|
-
children: /* @__PURE__ */ jsx(
|
|
370
|
-
"div",
|
|
371
|
-
{
|
|
372
|
-
className: clsx(
|
|
373
|
-
"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
|
-
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
|
-
),
|
|
376
|
-
children: ((_r = icons) == null ? void 0 : _r[(_q = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _q.icon]) ?? ((_s = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _s.icon) ?? ((_t = icons) == null ? void 0 : _t[`screen${upperFirst(realBreakpointName)}`])
|
|
377
|
-
}
|
|
378
|
-
)
|
|
379
|
-
}
|
|
380
|
-
),
|
|
381
|
-
children({
|
|
382
|
-
breakpoint,
|
|
383
|
-
currentValue: value == null ? void 0 : value[breakpoint],
|
|
384
|
-
handleChange: (newValue) => {
|
|
385
|
-
onChange({
|
|
386
|
-
...value,
|
|
387
|
-
[breakpoint]: newValue
|
|
388
|
-
});
|
|
389
|
-
},
|
|
390
|
-
options,
|
|
391
|
-
key: Object.keys(value)
|
|
392
|
-
}),
|
|
393
|
-
/* @__PURE__ */ jsx(
|
|
394
|
-
Button,
|
|
395
|
-
{
|
|
396
|
-
onPress: () => {
|
|
397
|
-
const newValue = { ...value };
|
|
398
|
-
delete newValue[breakpoint];
|
|
399
|
-
onChange(newValue);
|
|
400
|
-
},
|
|
401
|
-
icon: icons.clearAlt,
|
|
402
|
-
disabled: typeof (value == null ? void 0 : value[breakpoint]) === "undefined",
|
|
403
|
-
type: "ghost"
|
|
404
|
-
}
|
|
405
|
-
)
|
|
406
|
-
]
|
|
407
|
-
},
|
|
408
|
-
realBreakpointName
|
|
409
|
-
);
|
|
410
|
-
}),
|
|
411
|
-
isDesktopFirst && /* @__PURE__ */ jsxs(
|
|
412
|
-
"div",
|
|
413
|
-
{
|
|
414
|
-
className: clsx(
|
|
415
|
-
"es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
|
|
416
|
-
innerContentAlign === "start" && "es:justify-items-start",
|
|
417
|
-
innerContentAlign === "center" && "es:justify-items-center",
|
|
418
|
-
innerContentAlign === "end" && "es:justify-items-end",
|
|
419
|
-
innerContentAlign === "stretch" && "es:justify-items-stretch"
|
|
420
|
-
),
|
|
421
|
-
children: [
|
|
422
|
-
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
423
|
-
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
424
|
-
breakpoint: "_default",
|
|
425
|
-
currentValue: value == null ? void 0 : value["_default"],
|
|
426
|
-
handleChange: (newValue) => onChange({
|
|
427
|
-
...value,
|
|
428
|
-
_default: newValue
|
|
429
|
-
}),
|
|
430
|
-
options,
|
|
431
|
-
key: Object.keys(value),
|
|
432
|
-
isInlineExpandedView: true
|
|
433
|
-
}) })
|
|
434
|
-
]
|
|
435
|
-
},
|
|
436
|
-
"_default-desktop-first"
|
|
437
|
-
)
|
|
438
|
-
] }),
|
|
439
|
-
/* @__PURE__ */ jsxs("div", { className: "es:grid es:grid-cols-[1fr_auto_1fr] es:gap-x-1 es:px-1", children: [
|
|
440
|
-
/* @__PURE__ */ jsx(
|
|
441
|
-
TriggeredPopover,
|
|
442
|
-
{
|
|
443
|
-
triggerButtonLabel: __("Responsive preview", "eightshift-ui-components"),
|
|
444
|
-
triggerButtonProps: {
|
|
445
|
-
disabled: !Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined"),
|
|
446
|
-
type: "ghost",
|
|
447
|
-
className: "es:my-1"
|
|
448
|
-
},
|
|
449
|
-
children: /* @__PURE__ */ jsx(
|
|
450
|
-
ResponsivePreview,
|
|
451
|
-
{
|
|
452
|
-
value,
|
|
453
|
-
isDesktopFirst,
|
|
454
|
-
breakpoints,
|
|
455
|
-
desktopFirstBreakpoints,
|
|
456
|
-
options,
|
|
457
|
-
breakpointData,
|
|
458
|
-
breakpointUiData
|
|
459
|
-
}
|
|
460
|
-
)
|
|
461
|
-
}
|
|
462
|
-
),
|
|
463
|
-
/* @__PURE__ */ jsx(
|
|
464
|
-
Spacer,
|
|
465
|
-
{
|
|
466
|
-
className: "es:*:bg-secondary-200!",
|
|
467
|
-
vertical: true,
|
|
468
|
-
border: true
|
|
469
|
-
}
|
|
470
|
-
),
|
|
471
|
-
/* @__PURE__ */ jsx(
|
|
472
|
-
Button,
|
|
473
|
-
{
|
|
474
|
-
icon: icons.clearAlt,
|
|
475
|
-
disabled: !Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined"),
|
|
476
|
-
onPress: () => {
|
|
477
|
-
const newValue = { ...value };
|
|
478
|
-
[...breakpoints, ...desktopFirstBreakpoints].forEach((breakpoint) => {
|
|
479
|
-
delete newValue[breakpoint];
|
|
480
|
-
});
|
|
481
|
-
onChange(newValue);
|
|
482
|
-
},
|
|
483
|
-
type: "ghost",
|
|
484
|
-
className: "es:my-1 es:justify-center",
|
|
485
|
-
children: __("Clear all overrides", "eightshift-ui-components")
|
|
486
|
-
}
|
|
487
|
-
)
|
|
488
|
-
] })
|
|
489
|
-
]
|
|
490
|
-
}
|
|
491
|
-
)
|
|
492
|
-
] })
|
|
493
|
-
}
|
|
494
|
-
);
|
|
495
|
-
};
|
|
496
|
-
export {
|
|
497
|
-
MiniResponsive
|
|
498
|
-
};
|