@eightshift/ui-components 4.0.0 → 5.0.0

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