@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.
Files changed (144) hide show
  1. package/dist/Button-BpwTmkAe.js +185 -0
  2. package/dist/Collection-n5d0zIgb.js +2398 -0
  3. package/dist/Color-lVhk8V_G.js +2452 -0
  4. package/dist/ColorSwatch-DntWEAC3.js +64 -0
  5. package/dist/ComboBox-BJpTEATT.js +1915 -0
  6. package/dist/Dialog-O9uw63D7.js +2317 -0
  7. package/dist/FieldError-DHrSdE_Q.js +42 -0
  8. package/dist/FocusScope-BEPI2m7u.js +831 -0
  9. package/dist/Form-Cq3fu75_.js +5 -0
  10. package/dist/Group-DDPhPPTQ.js +48 -0
  11. package/dist/Heading-ba38ScjJ.js +16 -0
  12. package/dist/Hidden-rE6uR-lr.js +41 -0
  13. package/dist/Input-BmDS8Juy.js +133 -0
  14. package/dist/Label-JS_ob-kh.js +17 -0
  15. package/dist/List-CZMUbkFU.js +593 -0
  16. package/dist/ListBox-BTxlCGcc.js +664 -0
  17. package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
  18. package/dist/OverlayArrow-5aDgmImj.js +637 -0
  19. package/dist/RSPContexts-2lR5GG9p.js +14 -0
  20. package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
  21. package/dist/Separator-CaTBkETC.js +332 -0
  22. package/dist/Slider-C-S1oEH9.js +853 -0
  23. package/dist/Text-BuJgePCv.js +16 -0
  24. package/dist/VisuallyHidden-BYi0pekx.js +48 -0
  25. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  26. package/dist/assets/index.css +57 -0
  27. package/dist/assets/style-admin.css +5908 -0
  28. package/dist/assets/style-editor.css +5908 -0
  29. package/dist/assets/style.css +5914 -0
  30. package/dist/assets/wp-font-enhancements.css +8 -0
  31. package/dist/assets/wp-ui-enhancements.css +396 -0
  32. package/dist/components/animated-visibility/animated-visibility.js +105 -0
  33. package/dist/components/base-control/base-control.js +86 -0
  34. package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
  35. package/dist/components/button/button.js +387 -0
  36. package/dist/components/checkbox/checkbox.js +323 -0
  37. package/dist/components/color-pickers/color-picker.js +272 -0
  38. package/dist/components/color-pickers/color-swatch.js +59 -0
  39. package/dist/components/color-pickers/gradient-editor.js +534 -0
  40. package/dist/components/color-pickers/solid-color-picker.js +1567 -0
  41. package/dist/components/component-toggle/component-toggle.js +161 -0
  42. package/dist/components/container-panel/container-panel.js +131 -0
  43. package/dist/components/draggable/draggable-context.js +5 -0
  44. package/dist/components/draggable/draggable-handle.js +46 -0
  45. package/dist/components/draggable/draggable.js +7320 -0
  46. package/dist/components/draggable-list/draggable-list-context.js +5 -0
  47. package/dist/components/draggable-list/draggable-list-item.js +77 -0
  48. package/dist/components/draggable-list/draggable-list.js +151 -0
  49. package/dist/components/expandable/expandable.js +342 -0
  50. package/dist/components/index.js +137 -0
  51. package/dist/components/input-field/input-field.js +231 -0
  52. package/dist/components/item-collection/item-collection.js +59 -0
  53. package/dist/components/layout/hstack.js +30 -0
  54. package/dist/components/layout/vstack.js +30 -0
  55. package/dist/components/link-input/link-input.js +284 -0
  56. package/dist/components/matrix-align/matrix-align.js +134 -0
  57. package/dist/components/menu/menu.js +285 -0
  58. package/dist/components/modal/modal.js +305 -0
  59. package/dist/components/notice/notice.js +123 -0
  60. package/dist/components/number-picker/number-picker.js +292 -0
  61. package/dist/components/option-select/option-select.js +264 -0
  62. package/dist/components/options-panel/options-panel.js +158 -0
  63. package/dist/components/placeholders/file-placeholder.js +42 -0
  64. package/dist/components/placeholders/image-placeholder.js +88 -0
  65. package/dist/components/placeholders/media-placeholder.js +63 -0
  66. package/dist/components/popover/popover.js +207 -0
  67. package/dist/components/radio/radio.js +582 -0
  68. package/dist/components/repeater/repeater-context.js +5 -0
  69. package/dist/components/repeater/repeater-item.js +119 -0
  70. package/dist/components/repeater/repeater.js +280 -0
  71. package/dist/components/responsive/mini-responsive.js +498 -0
  72. package/dist/components/responsive/responsive-legacy.js +343 -0
  73. package/dist/components/responsive/responsive.js +583 -0
  74. package/dist/components/responsive-preview/responsive-preview.js +123 -0
  75. package/dist/components/rich-label/rich-label.js +66 -0
  76. package/dist/components/select/async-multi-select.js +157 -0
  77. package/dist/components/select/async-single-select.js +137 -0
  78. package/dist/components/select/custom-select-default-components.js +38 -0
  79. package/dist/components/select/multi-select-components.js +8 -0
  80. package/dist/components/select/multi-select.js +151 -0
  81. package/dist/components/select/react-select-component-wrappers.js +90 -0
  82. package/dist/components/select/shared.js +26 -0
  83. package/dist/components/select/single-select.js +131 -0
  84. package/dist/components/select/styles.js +49 -0
  85. package/dist/components/select/v2/async-select.js +297 -0
  86. package/dist/components/select/v2/shared.js +24 -0
  87. package/dist/components/select/v2/single-select.js +1004 -0
  88. package/dist/components/slider/column-config-slider.js +210 -0
  89. package/dist/components/slider/slider.js +345 -0
  90. package/dist/components/slider/utils.js +94 -0
  91. package/dist/components/spacer/spacer.js +97 -0
  92. package/dist/components/tabs/tabs.js +703 -0
  93. package/dist/components/toggle/switch.js +156 -0
  94. package/dist/components/toggle/toggle.js +64 -0
  95. package/dist/components/toggle-button/toggle-button.js +343 -0
  96. package/dist/components/tooltip/tooltip.js +527 -0
  97. package/dist/context-BbYZoHvX.js +92 -0
  98. package/dist/default-i18n-CT_oS1Fy.js +922 -0
  99. package/dist/filterDOMProps-EDDcM64A.js +28 -0
  100. package/dist/icons/block-icon.js +42 -0
  101. package/dist/icons/generic-color-swatch.js +113 -0
  102. package/dist/icons/icons.js +30495 -0
  103. package/dist/icons/index.js +11 -0
  104. package/dist/icons/jsx-svg.js +50 -0
  105. package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
  106. package/dist/index-BljRBEr_.js +44 -0
  107. package/dist/index-CFozsmNS.js +28321 -0
  108. package/dist/index.js +139 -0
  109. package/dist/lite-DVmmD_-j.js +7 -0
  110. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  111. package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
  112. package/dist/number-GajL10e1.js +36 -0
  113. package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
  114. package/dist/react-select-async.esm-D937XTWW.js +107 -0
  115. package/dist/react-select.esm-Ciai3aKf.js +15 -0
  116. package/dist/style-admin.js +1 -0
  117. package/dist/style-editor.js +1 -0
  118. package/dist/style.js +1 -0
  119. package/dist/textSelection-8DpK8fJl.js +46 -0
  120. package/dist/useButton-Bt3BffJm.js +50 -0
  121. package/dist/useEvent-ICdlokG-.js +23 -0
  122. package/dist/useFocusRing-Bv0UJQl8.js +107 -0
  123. package/dist/useFormReset-D2YaWRIA.js +22 -0
  124. package/dist/useFormValidation-Dy0PXJg5.js +224 -0
  125. package/dist/useHover-C2SkI1Fn.js +895 -0
  126. package/dist/useLabel-BPCd5c7-.js +27 -0
  127. package/dist/useLabels-B7-lUnAF.js +23 -0
  128. package/dist/useListState-DkyH7elT.js +168 -0
  129. package/dist/useLocalizedStringFormatter-C9GO0IDB.js +121 -0
  130. package/dist/useNumberField-CU1_u8ze.js +1215 -0
  131. package/dist/useNumberFormatter-CZ9QUnRt.js +13 -0
  132. package/dist/usePress-BrJylgPR.js +688 -0
  133. package/dist/useSingleSelectListState-C4sorv2p.js +38 -0
  134. package/dist/useToggle-CDa3YAZI.js +59 -0
  135. package/dist/useToggleState-ibcBUHnB.js +19 -0
  136. package/dist/utilities/array-helpers.js +56 -0
  137. package/dist/utilities/debounce-throttle.js +123 -0
  138. package/dist/utilities/es-dash.js +382 -0
  139. package/dist/utilities/index.js +27 -0
  140. package/dist/utilities/text-helpers.js +136 -0
  141. package/dist/utils-CZt7LCbO.js +403 -0
  142. package/dist/wp/wp-font-enhancements.js +1 -0
  143. package/dist/wp/wp-ui-enhancements.js +1 -0
  144. package/package.json +24 -24
@@ -0,0 +1,583 @@
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 { _ 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 { Menu, MenuItem, MenuSeparator, SubMenuItem } from "../menu/menu.js";
10
+ import { ResponsivePreview } from "../responsive-preview/responsive-preview.js";
11
+ import { Button, ButtonGroup } from "../button/button.js";
12
+ import { RichLabel } from "../rich-label/rich-label.js";
13
+ import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
14
+ import { ToggleButton } from "../toggle-button/toggle-button.js";
15
+ import { BaseControl } from "../base-control/base-control.js";
16
+ /**
17
+ * A component that 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 `inline` mode, and the details are collapsed.
26
+ * - `isInlineExpandedView: boolean` - (Optional) `true` if in `inline` mode, and the details are shown.
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.inline] - If `true`, the default breakpoint is shown inline with the label. In the expanded state, all breakpoints are shown below the label.
43
+ * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
44
+ * @param {boolean} [props.useLegacyDesktopFirst] - If `true`, the legacy desktop-first mode is used. This is only for backwards compatibility.
45
+ * @param {string} [props.className] - Classes to pass to the control base.
46
+ * @param {'start' | 'center' | 'end' | 'stretch'} [props.innerContentAlign='start'] - Determines inner content alignment
47
+ *
48
+ * @returns {JSX.Element} The Responsive component.
49
+ *
50
+ * @example
51
+ * <Responsive
52
+ * value={value}
53
+ * onChange={onChange}
54
+ * icon={icons.myIcon}
55
+ * label={__('Label', 'eightshift-ui-components')}
56
+ * options={[
57
+ * { value: 'value1', label: 'Value 1' },
58
+ * { value: 'value2', label: 'Value 2' },
59
+ * { value: 'value3', label: 'Value 3' },
60
+ * ]}
61
+ * breakpoints={['mobile', 'tablet', 'desktop', 'large']}
62
+ * breakpointData={breakpointData}
63
+ * >
64
+ * {({ breakpoint, currentValue, options, handleChange }) => (
65
+ * <Select
66
+ * label={breakpoint}
67
+ * value={currentValue}
68
+ * options={options}
69
+ * onChange={handleChange}
70
+ * />
71
+ * )}
72
+ * </Responsive>
73
+ *
74
+ * @preserve
75
+ */
76
+ const Responsive = (props) => {
77
+ const {
78
+ value,
79
+ onChange,
80
+ icon,
81
+ help,
82
+ label,
83
+ subtitle,
84
+ options,
85
+ breakpoints: rawBreakpoints,
86
+ desktopFirstBreakpoints: rawDesktopFirstBreakpoints,
87
+ breakpointData,
88
+ breakpointUiData,
89
+ noModeSelect,
90
+ inline,
91
+ children,
92
+ hidden,
93
+ innerContentAlign = "start",
94
+ useLegacyDesktopFirst,
95
+ className
96
+ } = props;
97
+ if (typeof rawBreakpoints === "undefined" || !Array.isArray(rawBreakpoints)) {
98
+ console.warn(__("Responsive: Missing or invalid 'breakpoints' prop.", "eightshift-ui-components"));
99
+ return null;
100
+ }
101
+ const breakpoints = rawBreakpoints.slice(1);
102
+ let desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
103
+ if (useLegacyDesktopFirst) {
104
+ desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
105
+ }
106
+ const [detailsVisible, setDetailsVisible] = useState(false);
107
+ const isDesktopFirst = (value == null ? void 0 : value["_desktopFirst"]) === true;
108
+ const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
109
+ const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
110
+ const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
111
+ if (hidden) {
112
+ return null;
113
+ }
114
+ const DefaultTooltip = () => {
115
+ var _a, _b, _c, _d, _e, _f, _g, _h;
116
+ const overrideIcon = (_a = breakpointUiData == null ? void 0 : breakpointUiData[isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0)]) == null ? void 0 : _a.icon;
117
+ return /* @__PURE__ */ jsx(
118
+ DecorativeTooltip,
119
+ {
120
+ placement: "left",
121
+ className: "es:p-3",
122
+ theme: "light",
123
+ offset: 7.5,
124
+ arrow: true,
125
+ text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-64 es:p-1", children: [
126
+ /* @__PURE__ */ jsx("span", { className: "es:block es:text-balance es:font-semibold es:tabular-nums", children: __("Default", "eightshift-ui-components") }),
127
+ /* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
128
+ !firstMobileFirstOverride && !lastDesktopFirstOverride && __("Always applied, regardless of browser width.", "eightshift-ui-components"),
129
+ firstMobileFirstOverride && !isDesktopFirst && sprintf(__("Applies when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[firstMobileFirstOverride] - 1),
130
+ lastDesktopFirstOverride && isDesktopFirst && sprintf(__("Applies when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[lastDesktopFirstOverride.replace("max-", "")])
131
+ ] }),
132
+ /* @__PURE__ */ jsxs("div", { className: "es:mx-auto", children: [
133
+ firstMobileFirstOverride && !isDesktopFirst && /* @__PURE__ */ jsx(
134
+ BreakpointPreview,
135
+ {
136
+ blocks: [
137
+ {
138
+ breakpoint: __("Default", "eightshift-ui-components"),
139
+ widthEnd: breakpointData[firstMobileFirstOverride] - 1,
140
+ 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"]),
141
+ dotsStart: true,
142
+ alignEnd: true,
143
+ active: true
144
+ },
145
+ {
146
+ breakpoint: ((_c = breakpointUiData == null ? void 0 : breakpointUiData[firstMobileFirstOverride]) == null ? void 0 : _c.label) ?? firstMobileFirstOverride,
147
+ 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]),
148
+ dotsEnd: true
149
+ }
150
+ ]
151
+ }
152
+ ),
153
+ lastDesktopFirstOverride && isDesktopFirst && /* @__PURE__ */ jsx(
154
+ BreakpointPreview,
155
+ {
156
+ blocks: [
157
+ {
158
+ breakpoint: ((_e = breakpointUiData == null ? void 0 : breakpointUiData[lastDesktopFirstOverride.replace("max-", "")]) == null ? void 0 : _e.label) ?? lastDesktopFirstOverride.replace("max-", ""),
159
+ 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]),
160
+ dotsStart: true,
161
+ alignEnd: true
162
+ },
163
+ {
164
+ breakpoint: __("Default", "eightshift-ui-components"),
165
+ 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"]),
166
+ width: breakpointData[lastDesktopFirstOverride.replace("max-", "")],
167
+ dotsEnd: true,
168
+ active: true
169
+ }
170
+ ]
171
+ }
172
+ )
173
+ ] })
174
+ ] }),
175
+ children: /* @__PURE__ */ jsx("div", { className: "es:flex es:size-7 es:items-center es:justify-center es:rounded es:border es:border-accent-500/10 es:bg-accent-50 es:p-0.5 es:text-accent-800 es:shadow-sm es:shadow-accent-600/25 es:icon:size-5", children: ((_h = icons) == null ? void 0 : _h[overrideIcon]) ?? overrideIcon ?? icons[`screen${upperFirst(isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0))}`] })
176
+ }
177
+ );
178
+ };
179
+ return /* @__PURE__ */ jsxs(
180
+ BaseControl,
181
+ {
182
+ icon,
183
+ label,
184
+ subtitle,
185
+ help,
186
+ className,
187
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
188
+ inline && /* @__PURE__ */ jsx(
189
+ AnimatedVisibility,
190
+ {
191
+ className: "es:mr-0.5",
192
+ visible: !detailsVisible,
193
+ transition: "scaleFade",
194
+ noInitial: true,
195
+ children: children({
196
+ breakpoint: "_default",
197
+ currentValue: value == null ? void 0 : value["_default"],
198
+ handleChange: (newValue) => onChange({
199
+ ...value,
200
+ _default: newValue
201
+ }),
202
+ options,
203
+ key: Object.keys(value),
204
+ isInlineCollapsedView: true
205
+ })
206
+ },
207
+ "_default-inline"
208
+ ),
209
+ /* @__PURE__ */ jsxs(ButtonGroup, { children: [
210
+ /* @__PURE__ */ jsx(
211
+ ToggleButton,
212
+ {
213
+ icon: isDesktopFirst ? icons.responsiveOverridesAlt : icons.responsiveOverridesAlt2,
214
+ onChange: () => setDetailsVisible(!detailsVisible),
215
+ selected: detailsVisible,
216
+ tooltip: detailsVisible ? __("Hide responsive overrides", "eightshift-ui-components") : __("Show responsive overrides", "eightshift-ui-components")
217
+ }
218
+ ),
219
+ /* @__PURE__ */ jsxs(
220
+ Menu,
221
+ {
222
+ "aria-label": __("Responsive options", "eightshift-ui-components"),
223
+ tooltip: __("Responsive options", "eightshift-ui-components"),
224
+ popoverProps: { placement: "bottom right" },
225
+ triggerProps: { className: "es:w-5.5 es:stroke-[1.25]" },
226
+ triggerIcon: icons.dropdownCaretAlt,
227
+ children: [
228
+ !noModeSelect && /* @__PURE__ */ jsxs(Fragment, { children: [
229
+ /* @__PURE__ */ jsx(
230
+ MenuItem,
231
+ {
232
+ className: "es:pb-0! es:pt-1!",
233
+ disabled: true,
234
+ children: __("Breakpoint mode", "eightshift-ui-components")
235
+ }
236
+ ),
237
+ /* @__PURE__ */ jsx(
238
+ MenuItem,
239
+ {
240
+ selected: !isDesktopFirst,
241
+ onClick: () => {
242
+ onChange({
243
+ _default: value["_default"],
244
+ _desktopFirst: false
245
+ });
246
+ },
247
+ children: /* @__PURE__ */ jsx(
248
+ RichLabel,
249
+ {
250
+ label: __("Mobile-first", "eightshift-ui-components"),
251
+ subtitle: __("Default", "eightshift-ui-components"),
252
+ noColor: true
253
+ }
254
+ )
255
+ }
256
+ ),
257
+ /* @__PURE__ */ jsx(
258
+ MenuItem,
259
+ {
260
+ selected: isDesktopFirst,
261
+ onClick: () => {
262
+ onChange({
263
+ _default: value["_default"],
264
+ _desktopFirst: true
265
+ });
266
+ },
267
+ children: __("Desktop-first", "eightshift-ui-components")
268
+ }
269
+ ),
270
+ /* @__PURE__ */ jsx(MenuSeparator, {})
271
+ ] }),
272
+ Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined") && /* @__PURE__ */ jsx(SubMenuItem, { trigger: /* @__PURE__ */ jsx(MenuItem, { icon: icons.previewResponsive, children: __("Responsive preview", "eightshift-ui-components") }), children: /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: /* @__PURE__ */ jsx(
273
+ ResponsivePreview,
274
+ {
275
+ value,
276
+ isDesktopFirst,
277
+ breakpoints,
278
+ desktopFirstBreakpoints,
279
+ options,
280
+ breakpointData,
281
+ breakpointUiData
282
+ }
283
+ ) }) }),
284
+ Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined") && /* @__PURE__ */ jsx(MenuSeparator, {}),
285
+ /* @__PURE__ */ jsx(
286
+ MenuItem,
287
+ {
288
+ icon: icons.clearAlt,
289
+ onClick: () => {
290
+ const newValue = { ...value };
291
+ [...breakpoints, ...desktopFirstBreakpoints].forEach((breakpoint) => {
292
+ delete newValue[breakpoint];
293
+ });
294
+ onChange(newValue);
295
+ },
296
+ children: __("Clear all overrides", "eightshift-ui-components")
297
+ }
298
+ )
299
+ ]
300
+ }
301
+ )
302
+ ] })
303
+ ] }),
304
+ children: [
305
+ !isDesktopFirst && !inline && /* @__PURE__ */ jsxs(
306
+ "div",
307
+ {
308
+ className: clsx(
309
+ "es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-end] es:duration-150",
310
+ innerContentAlign === "start" && "es:justify-items-start",
311
+ innerContentAlign === "center" && "es:justify-items-center",
312
+ innerContentAlign === "end" && "es:justify-items-end",
313
+ innerContentAlign === "stretch" && "es:justify-items-stretch",
314
+ 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)]"
315
+ ),
316
+ children: [
317
+ detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
318
+ /* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
319
+ breakpoint: "_default",
320
+ currentValue: value == null ? void 0 : value["_default"],
321
+ handleChange: (newValue) => onChange({
322
+ ...value,
323
+ _default: newValue
324
+ }),
325
+ options,
326
+ key: Object.keys(value)
327
+ }) })
328
+ ]
329
+ },
330
+ "_default-mobile-first"
331
+ ),
332
+ !isDesktopFirst && inline && /* @__PURE__ */ jsxs(
333
+ AnimatedVisibility,
334
+ {
335
+ className: clsx(
336
+ "es:mb-2 es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
337
+ innerContentAlign === "start" && "es:justify-items-start",
338
+ innerContentAlign === "center" && "es:justify-items-center",
339
+ innerContentAlign === "end" && "es:justify-items-end",
340
+ innerContentAlign === "stretch" && "es:justify-items-stretch"
341
+ ),
342
+ visible: detailsVisible,
343
+ children: [
344
+ /* @__PURE__ */ jsx(DefaultTooltip, {}),
345
+ /* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
346
+ breakpoint: "_default",
347
+ currentValue: value == null ? void 0 : value["_default"],
348
+ handleChange: (newValue) => onChange({
349
+ ...value,
350
+ _default: newValue
351
+ }),
352
+ options,
353
+ key: Object.keys(value),
354
+ isInlineExpandedView: true
355
+ }) })
356
+ ]
357
+ },
358
+ "_default-mobile-first-inline"
359
+ ),
360
+ /* @__PURE__ */ jsx(
361
+ AnimatedVisibility,
362
+ {
363
+ visible: detailsVisible,
364
+ className: "es:space-y-2",
365
+ children: breakpointsToMap.map((breakpoint, i) => {
366
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
367
+ const realBreakpointName = breakpoint.replace("max-", "");
368
+ const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, "_default"] : ["_default", ...breakpointsToMap];
369
+ 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");
370
+ 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");
371
+ return /* @__PURE__ */ jsxs(
372
+ "div",
373
+ {
374
+ className: clsx(
375
+ "es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2",
376
+ innerContentAlign === "start" && "es:justify-items-start",
377
+ innerContentAlign === "center" && "es:justify-items-center",
378
+ innerContentAlign === "end" && "es:justify-items-end",
379
+ innerContentAlign === "stretch" && "es:justify-items-stretch"
380
+ ),
381
+ children: [
382
+ /* @__PURE__ */ jsx(
383
+ DecorativeTooltip,
384
+ {
385
+ placement: "left",
386
+ theme: "light",
387
+ offset: 7.5,
388
+ arrow: true,
389
+ text: /* @__PURE__ */ jsxs("div", { className: "es:max-w-96 es:p-1", children: [
390
+ /* @__PURE__ */ jsx("span", { className: "es:block es:font-semibold", children: ((_a = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _a.label) ?? upperFirst(realBreakpointName) }),
391
+ /* @__PURE__ */ jsxs("span", { className: "es:block es:text-balance es:tabular-nums", children: [
392
+ !isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ !belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), breakpointData[realBreakpointName]),
394
+ belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
395
+ __("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
396
+ breakpointData[realBreakpointName],
397
+ breakpointData[belowOverride] - 1
398
+ ),
399
+ typeof value[breakpoint] === "undefined" && sprintf(__("From %dpx", "eightshift-ui-components"), breakpointData[realBreakpointName])
400
+ ] }),
401
+ isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
402
+ !belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), breakpointData[realBreakpointName] - 1),
403
+ belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
404
+ __("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"),
405
+ breakpointData[belowOverride == null ? void 0 : belowOverride.replace("max-", "")],
406
+ breakpointData[realBreakpointName] - 1
407
+ ),
408
+ typeof value[breakpoint] === "undefined" && sprintf(__("Up to %dpx", "eightshift-ui-components"), breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")])
409
+ ] })
410
+ ] }),
411
+ typeof value[breakpoint] === "undefined" && /* @__PURE__ */ jsx("span", { className: "es:mt-2 es:block es:font-medium es:italic", children: __("Not set", "eightshift-ui-components") }),
412
+ typeof value[breakpoint] !== "undefined" && /* @__PURE__ */ jsxs("div", { className: "es:mx-auto es:mt-2", children: [
413
+ !isDesktopFirst && /* @__PURE__ */ jsx(
414
+ BreakpointPreview,
415
+ {
416
+ dotsStart: belowOverride,
417
+ blocks: [
418
+ aboveOverride !== "_default" && typeof (value == null ? void 0 : value[aboveOverride]) !== "undefined" && {
419
+ breakpoint: ((_b = breakpointUiData == null ? void 0 : breakpointUiData[aboveOverride]) == null ? void 0 : _b.label) ?? aboveOverride,
420
+ 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]),
421
+ dotsStart: !belowOverride,
422
+ alignEnd: !belowOverride
423
+ },
424
+ aboveOverride === "_default" && typeof (value == null ? void 0 : value["_default"]) !== "undefined" && {
425
+ breakpoint: __("Default", "eightshift-ui-components"),
426
+ 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"]),
427
+ dotsStart: !belowOverride,
428
+ alignEnd: !belowOverride
429
+ },
430
+ {
431
+ breakpoint: ((_e = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _e.label) ?? realBreakpointName,
432
+ 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]),
433
+ width: breakpointData[realBreakpointName],
434
+ active: true,
435
+ dotsEnd: !belowOverride
436
+ },
437
+ belowOverride && typeof (value == null ? void 0 : value[belowOverride]) !== "undefined" && {
438
+ breakpoint: ((_g = breakpointUiData == null ? void 0 : breakpointUiData[belowOverride]) == null ? void 0 : _g.label) ?? belowOverride,
439
+ 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]),
440
+ width: breakpointData[belowOverride],
441
+ dotsEnd: true
442
+ }
443
+ ]
444
+ }
445
+ ),
446
+ isDesktopFirst && /* @__PURE__ */ jsx(
447
+ BreakpointPreview,
448
+ {
449
+ dotsStart: true,
450
+ dotsEnd: aboveOverride !== "_default",
451
+ blocks: [
452
+ belowOverride && {
453
+ 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-", "")),
454
+ 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])
455
+ },
456
+ {
457
+ breakpoint: ((_k = breakpointUiData == null ? void 0 : breakpointUiData[realBreakpointName]) == null ? void 0 : _k.label) ?? realBreakpointName,
458
+ 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]),
459
+ width: breakpointData[(_m = filterBreakpoints[i - 1]) == null ? void 0 : _m.replace("max-", "")],
460
+ active: true
461
+ },
462
+ aboveOverride !== "_default" && {
463
+ 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-", "")),
464
+ 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]),
465
+ width: breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")]
466
+ },
467
+ aboveOverride === "_default" && {
468
+ breakpoint: __("Default", "eightshift-ui-components"),
469
+ 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"]),
470
+ width: breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")],
471
+ dotsEnd: true
472
+ }
473
+ ]
474
+ }
475
+ )
476
+ ] })
477
+ ] }),
478
+ children: /* @__PURE__ */ jsx(
479
+ "div",
480
+ {
481
+ className: clsx(
482
+ "es:flex es:size-7 es:items-center es:justify-center es:rounded es:border es:p-0.5 es:shadow-sm es:transition-colors es:icon:size-5",
483
+ typeof value[breakpoint] !== "undefined" ? "es:border-secondary-200 es:bg-secondary-50 es:text-secondary-700" : "es:border-secondary-100 es:bg-white es:text-secondary-500"
484
+ ),
485
+ 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)}`])
486
+ }
487
+ )
488
+ }
489
+ ),
490
+ children({
491
+ breakpoint,
492
+ currentValue: value == null ? void 0 : value[breakpoint],
493
+ handleChange: (newValue) => {
494
+ onChange({
495
+ ...value,
496
+ [breakpoint]: newValue
497
+ });
498
+ },
499
+ options,
500
+ key: Object.keys(value)
501
+ }),
502
+ /* @__PURE__ */ jsx(
503
+ Button,
504
+ {
505
+ onPress: () => {
506
+ const newValue = { ...value };
507
+ delete newValue[breakpoint];
508
+ onChange(newValue);
509
+ },
510
+ icon: icons.clearAlt,
511
+ disabled: typeof (value == null ? void 0 : value[breakpoint]) === "undefined",
512
+ type: "ghost"
513
+ }
514
+ )
515
+ ]
516
+ },
517
+ realBreakpointName
518
+ );
519
+ })
520
+ }
521
+ ),
522
+ isDesktopFirst && !inline && /* @__PURE__ */ jsxs(
523
+ "div",
524
+ {
525
+ className: clsx(
526
+ "es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-start] es:duration-150",
527
+ innerContentAlign === "start" && "es:justify-items-start",
528
+ innerContentAlign === "center" && "es:justify-items-center",
529
+ innerContentAlign === "end" && "es:justify-items-end",
530
+ innerContentAlign === "stretch" && "es:justify-items-stretch",
531
+ detailsVisible ? "es:mt-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)]"
532
+ ),
533
+ children: [
534
+ detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
535
+ /* @__PURE__ */ jsx("div", { className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"), children: children({
536
+ breakpoint: "_default",
537
+ currentValue: value == null ? void 0 : value["_default"],
538
+ handleChange: (newValue) => onChange({
539
+ ...value,
540
+ _default: newValue
541
+ }),
542
+ options,
543
+ key: Object.keys(value)
544
+ }) })
545
+ ]
546
+ },
547
+ "_default-desktop-first"
548
+ ),
549
+ isDesktopFirst && inline && /* @__PURE__ */ jsxs(
550
+ AnimatedVisibility,
551
+ {
552
+ className: clsx(
553
+ "es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2 es:pt-1",
554
+ innerContentAlign === "start" && "es:justify-items-start",
555
+ innerContentAlign === "center" && "es:justify-items-center",
556
+ innerContentAlign === "end" && "es:justify-items-end",
557
+ innerContentAlign === "stretch" && "es:justify-items-stretch"
558
+ ),
559
+ visible: detailsVisible,
560
+ children: [
561
+ /* @__PURE__ */ jsx(DefaultTooltip, {}),
562
+ /* @__PURE__ */ jsx("div", { className: "es:col-start-2 es:col-end-2", children: children({
563
+ breakpoint: "_default",
564
+ currentValue: value == null ? void 0 : value["_default"],
565
+ handleChange: (newValue) => onChange({
566
+ ...value,
567
+ _default: newValue
568
+ }),
569
+ options,
570
+ key: Object.keys(value),
571
+ isInlineExpandedView: true
572
+ }) })
573
+ ]
574
+ },
575
+ "_default-desktop-first-inline"
576
+ )
577
+ ]
578
+ }
579
+ );
580
+ };
581
+ export {
582
+ Responsive
583
+ };