@eightshift/ui-components 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-BpwTmkAe.js +185 -0
- package/dist/Collection-n5d0zIgb.js +2398 -0
- package/dist/Color-lVhk8V_G.js +2452 -0
- package/dist/ColorSwatch-DntWEAC3.js +64 -0
- package/dist/ComboBox-BJpTEATT.js +1915 -0
- package/dist/Dialog-O9uw63D7.js +2317 -0
- package/dist/FieldError-DHrSdE_Q.js +42 -0
- package/dist/FocusScope-BEPI2m7u.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-DDPhPPTQ.js +48 -0
- package/dist/Heading-ba38ScjJ.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input-BmDS8Juy.js +133 -0
- package/dist/Label-JS_ob-kh.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-BTxlCGcc.js +664 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-5aDgmImj.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-CaTBkETC.js +332 -0
- package/dist/Slider-C-S1oEH9.js +853 -0
- package/dist/Text-BuJgePCv.js +16 -0
- package/dist/VisuallyHidden-BYi0pekx.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5908 -0
- package/dist/assets/style-editor.css +5908 -0
- package/dist/assets/style.css +5914 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +396 -0
- package/dist/components/animated-visibility/animated-visibility.js +105 -0
- package/dist/components/base-control/base-control.js +86 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
- package/dist/components/button/button.js +387 -0
- package/dist/components/checkbox/checkbox.js +323 -0
- package/dist/components/color-pickers/color-picker.js +272 -0
- package/dist/components/color-pickers/color-swatch.js +59 -0
- package/dist/components/color-pickers/gradient-editor.js +534 -0
- package/dist/components/color-pickers/solid-color-picker.js +1567 -0
- package/dist/components/component-toggle/component-toggle.js +161 -0
- package/dist/components/container-panel/container-panel.js +131 -0
- package/dist/components/draggable/draggable-context.js +5 -0
- package/dist/components/draggable/draggable-handle.js +46 -0
- package/dist/components/draggable/draggable.js +7320 -0
- package/dist/components/draggable-list/draggable-list-context.js +5 -0
- package/dist/components/draggable-list/draggable-list-item.js +77 -0
- package/dist/components/draggable-list/draggable-list.js +151 -0
- package/dist/components/expandable/expandable.js +342 -0
- package/dist/components/index.js +137 -0
- package/dist/components/input-field/input-field.js +231 -0
- package/dist/components/item-collection/item-collection.js +59 -0
- package/dist/components/layout/hstack.js +30 -0
- package/dist/components/layout/vstack.js +30 -0
- package/dist/components/link-input/link-input.js +284 -0
- package/dist/components/matrix-align/matrix-align.js +134 -0
- package/dist/components/menu/menu.js +285 -0
- package/dist/components/modal/modal.js +305 -0
- package/dist/components/notice/notice.js +123 -0
- package/dist/components/number-picker/number-picker.js +292 -0
- package/dist/components/option-select/option-select.js +264 -0
- package/dist/components/options-panel/options-panel.js +158 -0
- package/dist/components/placeholders/file-placeholder.js +42 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +63 -0
- package/dist/components/popover/popover.js +207 -0
- package/dist/components/radio/radio.js +582 -0
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +119 -0
- package/dist/components/repeater/repeater.js +280 -0
- package/dist/components/responsive/mini-responsive.js +498 -0
- package/dist/components/responsive/responsive-legacy.js +343 -0
- package/dist/components/responsive/responsive.js +583 -0
- package/dist/components/responsive-preview/responsive-preview.js +123 -0
- package/dist/components/rich-label/rich-label.js +66 -0
- package/dist/components/select/async-multi-select.js +157 -0
- package/dist/components/select/async-single-select.js +137 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +151 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +26 -0
- package/dist/components/select/single-select.js +131 -0
- package/dist/components/select/styles.js +49 -0
- package/dist/components/select/v2/async-select.js +297 -0
- package/dist/components/select/v2/shared.js +24 -0
- package/dist/components/select/v2/single-select.js +1004 -0
- package/dist/components/slider/column-config-slider.js +210 -0
- package/dist/components/slider/slider.js +345 -0
- package/dist/components/slider/utils.js +94 -0
- package/dist/components/spacer/spacer.js +97 -0
- package/dist/components/tabs/tabs.js +703 -0
- package/dist/components/toggle/switch.js +156 -0
- package/dist/components/toggle/toggle.js +64 -0
- package/dist/components/toggle-button/toggle-button.js +343 -0
- package/dist/components/tooltip/tooltip.js +527 -0
- package/dist/context-BbYZoHvX.js +92 -0
- package/dist/default-i18n-CT_oS1Fy.js +922 -0
- package/dist/filterDOMProps-EDDcM64A.js +28 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +113 -0
- package/dist/icons/icons.js +30495 -0
- package/dist/icons/index.js +11 -0
- package/dist/icons/jsx-svg.js +50 -0
- package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
- package/dist/index-BljRBEr_.js +44 -0
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/index.js +139 -0
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
- package/dist/number-GajL10e1.js +36 -0
- package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
- package/dist/react-select-async.esm-D937XTWW.js +107 -0
- package/dist/react-select.esm-Ciai3aKf.js +15 -0
- package/dist/style-admin.js +1 -0
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-8DpK8fJl.js +46 -0
- package/dist/useButton-Bt3BffJm.js +50 -0
- package/dist/useEvent-ICdlokG-.js +23 -0
- package/dist/useFocusRing-Bv0UJQl8.js +107 -0
- package/dist/useFormReset-D2YaWRIA.js +22 -0
- package/dist/useFormValidation-Dy0PXJg5.js +224 -0
- package/dist/useHover-C2SkI1Fn.js +895 -0
- package/dist/useLabel-BPCd5c7-.js +27 -0
- package/dist/useLabels-B7-lUnAF.js +23 -0
- package/dist/useListState-DkyH7elT.js +168 -0
- package/dist/useLocalizedStringFormatter-C9GO0IDB.js +121 -0
- package/dist/useNumberField-CU1_u8ze.js +1215 -0
- package/dist/useNumberFormatter-CZ9QUnRt.js +13 -0
- package/dist/usePress-BrJylgPR.js +688 -0
- package/dist/useSingleSelectListState-C4sorv2p.js +38 -0
- package/dist/useToggle-CDa3YAZI.js +59 -0
- package/dist/useToggleState-ibcBUHnB.js +19 -0
- package/dist/utilities/array-helpers.js +56 -0
- package/dist/utilities/debounce-throttle.js +123 -0
- package/dist/utilities/es-dash.js +382 -0
- package/dist/utilities/index.js +27 -0
- package/dist/utilities/text-helpers.js +136 -0
- package/dist/utils-CZt7LCbO.js +403 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +24 -24
|
@@ -0,0 +1,498 @@
|
|
|
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-BuJgePCv.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:w-full 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:w-full 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
|
+
};
|