@eightshift/ui-components 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-wERNNG0T.js +185 -0
- package/dist/Collection-CKsHTyhc.js +2363 -0
- package/dist/Color-BhgbJF5x.js +2452 -0
- package/dist/ColorSwatch-Bcn6oRSg.js +64 -0
- package/dist/ComboBox-D1LPUwWP.js +1906 -0
- package/dist/Dialog-D190gMbE.js +2298 -0
- package/dist/FieldError-DeUh5Wkw.js +42 -0
- package/dist/FocusScope-C-plSxbS.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-C5iZpSAM.js +48 -0
- package/dist/Heading-D-Pboe4p.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input--mF4XVE1.js +133 -0
- package/dist/Label-Fp6AwSRn.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-4oW9kh3R.js +582 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-BpB9uB_I.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-B88tj5YD.js +323 -0
- package/dist/Slider-CyJzC1bp.js +853 -0
- package/dist/Text-DRpwWot2.js +16 -0
- package/dist/VisuallyHidden-DsKYcRQ_.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5864 -0
- package/dist/assets/style-editor.css +5864 -0
- package/dist/assets/style.css +5870 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +377 -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 +320 -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 +6979 -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 +291 -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 +579 -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 +991 -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 +704 -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-BYWrbm1z.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 +30371 -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-CFozsmNS.js +28321 -0
- package/dist/index-wl5606BX.js +44 -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-CCcyjiRP.js +46 -0
- package/dist/useButton-BOHxkGQF.js +50 -0
- package/dist/useEvent-D5o_CqDH.js +23 -0
- package/dist/useFocusRing-nMG2uzxS.js +107 -0
- package/dist/useFormReset-DlmRL87g.js +22 -0
- package/dist/useFormValidation-D0_aaK-e.js +224 -0
- package/dist/useHover-VO5tcIli.js +890 -0
- package/dist/useLabel-BKH4fVA4.js +27 -0
- package/dist/useLabels-ntF3rFY0.js +23 -0
- package/dist/useListState-Cq2Nvr-v.js +161 -0
- package/dist/useLocalizedStringFormatter-CGzwx1a0.js +121 -0
- package/dist/useNumberField-C9dmERhP.js +1207 -0
- package/dist/useNumberFormatter-MrRLgvhj.js +13 -0
- package/dist/usePress-DjNo5790.js +677 -0
- package/dist/useSingleSelectListState--r3AAhRj.js +38 -0
- package/dist/useToggle-CQaXLe-O.js +59 -0
- package/dist/useToggleState-C3DLdez5.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-B94NDG0v.js +370 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { DecorativeTooltip } from "../tooltip/tooltip.js";
|
|
4
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
5
|
+
import { s as sprintf, _ as __ } 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 { Button } from "../button/button.js";
|
|
10
|
+
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
11
|
+
import { ToggleButton } from "../toggle-button/toggle-button.js";
|
|
12
|
+
import { BaseControl } from "../base-control/base-control.js";
|
|
13
|
+
/**
|
|
14
|
+
* A component that allows the user to set different values for different breakpoints.
|
|
15
|
+
*
|
|
16
|
+
* Replacement for the `Responsive` component from Eightshift Frontend libs v12 (and older).
|
|
17
|
+
*
|
|
18
|
+
* Meant to be used with a more complex attribute setup, with one attribute per breakpoint,
|
|
19
|
+
* and a single value object that contains all the values.
|
|
20
|
+
*
|
|
21
|
+
* Inner items should be passed as a render function.
|
|
22
|
+
* The following props are passed to the render function:
|
|
23
|
+
* - `breakpoint: string` - Name of the current breakpoint.
|
|
24
|
+
* - `currentValue: any` - Current value.
|
|
25
|
+
* - `handleChange: Function<(attributeName: string, value: any) => void>` - A function to change the value for the breakpoint..
|
|
26
|
+
* - `options: Object<string, any>` - (Optional) Options list passed to the `ResponsiveLegacy` component. (optional)
|
|
27
|
+
* - `isInlineCollapsedView: boolean` - (Optional) `true` if in `inline` mode, and the details are collapsed.
|
|
28
|
+
* - `isInlineExpandedView: boolean` - (Optional) `true` if in `inline` mode, and the details are shown.
|
|
29
|
+
*
|
|
30
|
+
* @component
|
|
31
|
+
* @param {Object} props - Component props.
|
|
32
|
+
* @param {Object} props.value - The current value of the component.
|
|
33
|
+
* @param {Function} props.onChange - Function to run when the value changes. `(newValue: Object) => void`.
|
|
34
|
+
* @param {Object} props.attribute - The attribute the component is linked to. `{ [breakpoint: string]: string }`.
|
|
35
|
+
* @param {JSX.Element} [props.icon] - The icon of the component.
|
|
36
|
+
* @param {string} [props.help] - The help text of the component.
|
|
37
|
+
* @param {string} [props.label] - The label of the component.
|
|
38
|
+
* @param {string} [props.subtitle] - The subtitle of the component.
|
|
39
|
+
* @param {{label: string, value: string}[]} props.options - Options of the attribute the component is linked to. `{ value: string, label: string }[]`.
|
|
40
|
+
* @param {any} [props.inheritValue=''] - Value that will be used as a default for breakpoints that don't have a value set. If `undefined`, needs to be used, use `allowUndefined` instead.
|
|
41
|
+
* @param {boolean?} [props.allowUndefined] - If `true`, `undefined` is used as a default value for breakpoints that don't have a value set. Overrides `inheritValue`.
|
|
42
|
+
* @param {Object} props.globalManifest - The global manifest.
|
|
43
|
+
* @param {boolean} [props.inline] - If `true`, the default breakpoint is shown inline with the label. In the expanded state, all breakpoints are shown below the label.
|
|
44
|
+
* @param {Object<string, number>} [props.breakpointData] - Breakpoints to use. `{ [breakpoint: string]: number }`.
|
|
45
|
+
* @param {string[]} [props.breakpoints] - Breakpoints to use. `{ [breakpoint: string]: number }`.
|
|
46
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
47
|
+
* @param {'start' | 'center' | 'end' | 'stretch'} [props.innerContentAlign='start'] - Determines inner content alignment
|
|
48
|
+
*
|
|
49
|
+
* @returns {JSX.Element} The ResponsiveLegacy component.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Basic example
|
|
53
|
+
* <ResponsiveLegacy
|
|
54
|
+
* attribute={myResponsiveAttribute} // from 'responsiveAttributes' in manifest
|
|
55
|
+
* value={value} // attributes
|
|
56
|
+
* onChange={(attributeName, value) => setAttributes({
|
|
57
|
+
* [attributeName]: value,
|
|
58
|
+
* })}
|
|
59
|
+
* icon={icons.myIcon}
|
|
60
|
+
* label={__('Label', 'eightshift-ui-components')}
|
|
61
|
+
* options={[
|
|
62
|
+
* { value: 'value1', label: 'Value 1' },
|
|
63
|
+
* { value: 'value2', label: 'Value 2' },
|
|
64
|
+
* { value: 'value3', label: 'Value 3' },
|
|
65
|
+
* ]}
|
|
66
|
+
* breakpointData={breakpoints} // From global manifest
|
|
67
|
+
* >
|
|
68
|
+
* {({ currentValue, options, handleChange }) => (
|
|
69
|
+
* <Select
|
|
70
|
+
* value={currentValue}
|
|
71
|
+
* options={options}
|
|
72
|
+
* onChange={handleChange}
|
|
73
|
+
* />
|
|
74
|
+
* )}
|
|
75
|
+
* </ResponsiveLegacy>
|
|
76
|
+
*
|
|
77
|
+
* @preserve
|
|
78
|
+
*/
|
|
79
|
+
const ResponsiveLegacy = (props) => {
|
|
80
|
+
const {
|
|
81
|
+
value,
|
|
82
|
+
onChange,
|
|
83
|
+
attribute,
|
|
84
|
+
icon,
|
|
85
|
+
help,
|
|
86
|
+
label,
|
|
87
|
+
subtitle,
|
|
88
|
+
options,
|
|
89
|
+
inheritValue: rawInheritValue = "",
|
|
90
|
+
allowUndefined,
|
|
91
|
+
children,
|
|
92
|
+
inline,
|
|
93
|
+
breakpointData,
|
|
94
|
+
breakpoints: rawBreakpoints = Object.entries(breakpointData).toSorted((a, b) => a[1] - b[1]).map(([breakpoint]) => breakpoint).toReversed(),
|
|
95
|
+
hidden,
|
|
96
|
+
innerContentAlign = "start"
|
|
97
|
+
} = props;
|
|
98
|
+
const inheritValue = allowUndefined ? void 0 : rawInheritValue;
|
|
99
|
+
const [detailsVisible, setDetailsVisible] = useState(false);
|
|
100
|
+
const breakpoints = rawBreakpoints.slice(1);
|
|
101
|
+
const globalOverride = breakpoints.find((breakpoint) => (value == null ? void 0 : value[attribute[breakpoint]]) !== inheritValue);
|
|
102
|
+
const defaultBreakpoint = rawBreakpoints[0];
|
|
103
|
+
if (hidden) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const DefaultTooltip = () => {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
DecorativeTooltip,
|
|
110
|
+
{
|
|
111
|
+
placement: "left",
|
|
112
|
+
className: "es:p-3",
|
|
113
|
+
theme: "light",
|
|
114
|
+
offset: 7.5,
|
|
115
|
+
arrow: true,
|
|
116
|
+
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-64 es:p-1", children: [
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "es:block es:text-balance es:font-semibold es:tabular-nums", children: __("Default", "eightshift-ui-components") }),
|
|
118
|
+
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
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
|
+
) })
|
|
142
|
+
] }),
|
|
143
|
+
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 })
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
return /* @__PURE__ */ jsxs(
|
|
148
|
+
BaseControl,
|
|
149
|
+
{
|
|
150
|
+
icon,
|
|
151
|
+
label,
|
|
152
|
+
subtitle,
|
|
153
|
+
help,
|
|
154
|
+
className: "es:w-full",
|
|
155
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
156
|
+
inline && /* @__PURE__ */ jsx(
|
|
157
|
+
AnimatedVisibility,
|
|
158
|
+
{
|
|
159
|
+
visible: !detailsVisible,
|
|
160
|
+
transition: "scaleFade",
|
|
161
|
+
noInitial: true,
|
|
162
|
+
children: children({
|
|
163
|
+
breakpoint: defaultBreakpoint,
|
|
164
|
+
currentValue: value == null ? void 0 : value[attribute[defaultBreakpoint]],
|
|
165
|
+
options,
|
|
166
|
+
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue),
|
|
167
|
+
isInlineCollapsedView: true
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
defaultBreakpoint
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsx(
|
|
173
|
+
ToggleButton,
|
|
174
|
+
{
|
|
175
|
+
icon: icons.responsiveOverridesAlt,
|
|
176
|
+
onChange: () => setDetailsVisible(!detailsVisible),
|
|
177
|
+
selected: detailsVisible,
|
|
178
|
+
tooltip: detailsVisible ? __("Hide responsive overrides", "eightshift-ui-components") : __("Show responsive overrides", "eightshift-ui-components")
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }),
|
|
182
|
+
children: [
|
|
183
|
+
!inline && /* @__PURE__ */ jsxs(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: clsx(
|
|
187
|
+
"es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-end] es:duration-150",
|
|
188
|
+
innerContentAlign === "start" && "es:justify-items-start",
|
|
189
|
+
innerContentAlign === "center" && "es:justify-items-center",
|
|
190
|
+
innerContentAlign === "end" && "es:justify-items-end",
|
|
191
|
+
innerContentAlign === "stretch" && "es:justify-items-stretch",
|
|
192
|
+
detailsVisible ? "es:mb-2 es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)]" : "es:grid-cols-[minmax(0,0rem)_minmax(0,1fr)_minmax(0,2.25rem)]"
|
|
193
|
+
),
|
|
194
|
+
children: [
|
|
195
|
+
detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
196
|
+
/* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
|
|
197
|
+
breakpoint: defaultBreakpoint,
|
|
198
|
+
currentValue: value == null ? void 0 : value[attribute[defaultBreakpoint]],
|
|
199
|
+
options,
|
|
200
|
+
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue)
|
|
201
|
+
}) })
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
defaultBreakpoint
|
|
205
|
+
),
|
|
206
|
+
inline && /* @__PURE__ */ jsxs(
|
|
207
|
+
AnimatedVisibility,
|
|
208
|
+
{
|
|
209
|
+
className: clsx(
|
|
210
|
+
"es:mb-2 es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
|
|
211
|
+
innerContentAlign === "start" && "es:justify-items-start",
|
|
212
|
+
innerContentAlign === "center" && "es:justify-items-center",
|
|
213
|
+
innerContentAlign === "end" && "es:justify-items-end",
|
|
214
|
+
innerContentAlign === "stretch" && "es:justify-items-stretch"
|
|
215
|
+
),
|
|
216
|
+
visible: detailsVisible,
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx(DefaultTooltip, {}),
|
|
219
|
+
/* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
|
|
220
|
+
breakpoint: defaultBreakpoint,
|
|
221
|
+
currentValue: value == null ? void 0 : value[attribute[defaultBreakpoint]],
|
|
222
|
+
options,
|
|
223
|
+
handleChange: (newValue) => onChange(attribute[defaultBreakpoint], newValue),
|
|
224
|
+
isInlineExpandedView: true
|
|
225
|
+
}) })
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
defaultBreakpoint
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx(
|
|
231
|
+
AnimatedVisibility,
|
|
232
|
+
{
|
|
233
|
+
visible: detailsVisible,
|
|
234
|
+
className: "es:space-y-2",
|
|
235
|
+
children: breakpoints.map((breakpoint, i) => {
|
|
236
|
+
var _a, _b, _c, _d, _e;
|
|
237
|
+
const isOverrideSet = value[attribute[breakpoint]] !== inheritValue;
|
|
238
|
+
const aboveOverride = rawBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) => (value == null ? void 0 : value[attribute[breakpoint2]]) !== inheritValue);
|
|
239
|
+
const belowOverride = rawBreakpoints.slice(i + 2).find((breakpoint2) => (value == null ? void 0 : value[attribute[breakpoint2]]) !== inheritValue);
|
|
240
|
+
return /* @__PURE__ */ jsxs(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
className: clsx(
|
|
244
|
+
"es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
|
|
245
|
+
innerContentAlign === "start" && "es:justify-items-start",
|
|
246
|
+
innerContentAlign === "center" && "es:justify-items-center",
|
|
247
|
+
innerContentAlign === "end" && "es:justify-items-end",
|
|
248
|
+
innerContentAlign === "stretch" && "es:justify-items-stretch"
|
|
249
|
+
),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx(
|
|
252
|
+
DecorativeTooltip,
|
|
253
|
+
{
|
|
254
|
+
placement: "left",
|
|
255
|
+
theme: "light",
|
|
256
|
+
offset: 7.5,
|
|
257
|
+
arrow: true,
|
|
258
|
+
text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-96 es:p-1", children: [
|
|
259
|
+
/* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children: upperFirst(breakpoint) }),
|
|
260
|
+
/* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
|
|
261
|
+
aboveOverride && (aboveOverride !== rawBreakpoints[0] || !belowOverride) && isOverrideSet && sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[breakpoint]),
|
|
262
|
+
aboveOverride && aboveOverride === rawBreakpoints[0] && belowOverride && isOverrideSet && sprintf(
|
|
263
|
+
__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
|
|
264
|
+
breakpointData[belowOverride] + 1,
|
|
265
|
+
breakpointData[breakpoint]
|
|
266
|
+
),
|
|
267
|
+
(!aboveOverride || !isOverrideSet) && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint])
|
|
268
|
+
] }),
|
|
269
|
+
(aboveOverride && !isOverrideSet || !aboveOverride) && /* @__PURE__ */ jsx("span", { className: "es:mt-2 es:block es:font-medium es:italic", children: __("Not set", "eightshift-ui-components") }),
|
|
270
|
+
aboveOverride && isOverrideSet && /* @__PURE__ */ jsx("div", { className: "es:mx-auto es:mt-2", children: /* @__PURE__ */ jsx(
|
|
271
|
+
BreakpointPreview,
|
|
272
|
+
{
|
|
273
|
+
blocks: [
|
|
274
|
+
belowOverride && {
|
|
275
|
+
breakpoint: belowOverride,
|
|
276
|
+
value: ((_a = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[belowOverride]]))) == null ? void 0 : _a.label) ?? upperFirst(value == null ? void 0 : value[belowOverride]),
|
|
277
|
+
widthEnd: breakpointData[belowOverride],
|
|
278
|
+
dotsStart: true,
|
|
279
|
+
alignEnd: true
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
breakpoint,
|
|
283
|
+
value: ((_b = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[breakpoint]]))) == null ? void 0 : _b.label) ?? upperFirst(value == null ? void 0 : value[breakpoint]),
|
|
284
|
+
widthEnd: breakpointData[breakpoint],
|
|
285
|
+
active: true,
|
|
286
|
+
alignEnd: true,
|
|
287
|
+
dotsStart: aboveOverride === breakpoint
|
|
288
|
+
},
|
|
289
|
+
aboveOverride !== defaultBreakpoint && {
|
|
290
|
+
breakpoint: aboveOverride,
|
|
291
|
+
value: ((_c = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[aboveOverride]]))) == null ? void 0 : _c.label) ?? upperFirst(value == null ? void 0 : value[aboveOverride]),
|
|
292
|
+
dotsEnd: true
|
|
293
|
+
},
|
|
294
|
+
aboveOverride === defaultBreakpoint && {
|
|
295
|
+
breakpoint: __("Default", "eightshift-ui-components"),
|
|
296
|
+
value: ((_d = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[attribute[defaultBreakpoint]]))) == null ? void 0 : _d.label) ?? upperFirst(value == null ? void 0 : value[defaultBreakpoint]),
|
|
297
|
+
dotsEnd: true
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
) })
|
|
302
|
+
] }),
|
|
303
|
+
children: /* @__PURE__ */ jsx(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: clsx(
|
|
307
|
+
"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
|
+
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
|
+
),
|
|
310
|
+
children: (_e = icons) == null ? void 0 : _e[`screen${upperFirst(breakpoint)}`]
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
/* @__PURE__ */ jsx("div", { className: "es:w-full", children: children({
|
|
316
|
+
breakpoint,
|
|
317
|
+
currentValue: value == null ? void 0 : value[attribute[breakpoint]],
|
|
318
|
+
options,
|
|
319
|
+
handleChange: (newValue) => onChange(attribute[breakpoint], newValue)
|
|
320
|
+
}) }),
|
|
321
|
+
/* @__PURE__ */ jsx(
|
|
322
|
+
Button,
|
|
323
|
+
{
|
|
324
|
+
onPress: () => onChange(attribute[breakpoint], inheritValue),
|
|
325
|
+
icon: icons.clearAlt,
|
|
326
|
+
disabled: (value == null ? void 0 : value[attribute[breakpoint]]) === inheritValue,
|
|
327
|
+
type: "ghost"
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
breakpoint
|
|
333
|
+
);
|
|
334
|
+
})
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
export {
|
|
342
|
+
ResponsiveLegacy
|
|
343
|
+
};
|