@eightshift/ui-components 0.0.1 → 0.0.3

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 (116) hide show
  1. package/README.md +0 -1
  2. package/dist/Button-eebLs4cp.js +54 -0
  3. package/dist/{Checkbox-BLcVbhiO.js → Checkbox-BN0TEda-.js} +7 -7
  4. package/dist/{ColorSwatch-Cmlex_kT.js → ColorSwatch-BrowHhTG.js} +4 -4
  5. package/dist/{FieldError-wtMA4667.js → FieldError-ILxgMZy5.js} +2 -2
  6. package/dist/{FocusScope-1u9yyfIN.js → FocusScope-B9b0VMib.js} +2 -2
  7. package/dist/GeistMonoVF.woff2 +0 -0
  8. package/dist/GeistVF.woff2 +0 -0
  9. package/dist/{GridList-BZPXp3_O.js → GridList-CzpWxJsS.js} +18 -18
  10. package/dist/{Group-DyqpTRPe.js → Group-Dkdm2-E7.js} +3 -3
  11. package/dist/{Input-jsbb4ugq.js → Input-BJA4rmIo.js} +7 -7
  12. package/dist/{Label-BPzS-sR7.js → Label-9x5iLJ-Y.js} +1 -1
  13. package/dist/{ListBox-w9gDaJkV.js → ListBox-D3Vr4vvC.js} +18 -18
  14. package/dist/{Select-49a62830.esm-C-RFtLiD.js → Select-49a62830.esm-CKPmlkza.js} +1 -1
  15. package/dist/{SelectionManager-mefd0ThJ.js → SelectionManager-sedvcM-1.js} +8 -8
  16. package/dist/{Separator-DHn0CwdK.js → Separator-B6rnDabE.js} +3 -3
  17. package/dist/{Slider-Pyh2V4bY.js → Slider-C5U5N7uM.js} +11 -11
  18. package/dist/{Text-BM136LvS.js → Text-Cyxp9ewv.js} +1 -1
  19. package/dist/{VisuallyHidden-BYRI1Lfo.js → VisuallyHidden-BPJVSUyp.js} +2 -2
  20. package/dist/_commonjsHelpers-DWwsNxpa.js +8 -0
  21. package/dist/assets/fonts.css +1 -0
  22. package/dist/assets/style.css +1 -1
  23. package/dist/assets/wp.css +1 -0
  24. package/dist/{button-BkkdyHfJ.js → button-idVI4jmd.js} +45 -64
  25. package/dist/components/base-control/base-control.js +29 -39
  26. package/dist/components/breakpoint-preview/breakpoint-preview.js +7 -7
  27. package/dist/components/button/button.js +6 -5
  28. package/dist/components/checkbox/checkbox.js +9 -7
  29. package/dist/components/color-pickers/color-picker.js +27 -36
  30. package/dist/components/color-pickers/color-swatch.js +6 -6
  31. package/dist/components/color-pickers/gradient-editor.js +10 -6
  32. package/dist/components/color-pickers/solid-color-picker.js +35 -38
  33. package/dist/components/component-toggle/component-toggle.js +52 -6
  34. package/dist/components/container-panel/container-panel.js +55 -6
  35. package/dist/components/draggable-list/draggable-list-item.js +74 -0
  36. package/dist/components/draggable-list/draggable-list.js +157 -0
  37. package/dist/components/expandable/expandable.js +19 -12
  38. package/dist/components/input-field/input-field.js +15 -10
  39. package/dist/components/layout/hstack.js +40 -0
  40. package/dist/components/layout/vstack.js +40 -0
  41. package/dist/components/link-input/link-input.js +35 -31
  42. package/dist/components/list-box/list-box.js +11 -6
  43. package/dist/components/matrix-align/matrix-align.js +12 -7
  44. package/dist/components/menu/menu.js +26 -21
  45. package/dist/components/notice/notice.js +11 -7
  46. package/dist/components/number-picker/number-picker.js +19 -13
  47. package/dist/components/option-select/option-select.js +231 -0
  48. package/dist/components/placeholders/file-placeholder.js +53 -0
  49. package/dist/components/placeholders/image-placeholder.js +88 -0
  50. package/dist/components/placeholders/media-placeholder.js +62 -0
  51. package/dist/components/popover/popover.js +4 -4
  52. package/dist/components/radio/radio.js +56 -38
  53. package/dist/components/repeater/repeater-item.js +46 -39
  54. package/dist/components/repeater/repeater.js +82 -56
  55. package/dist/components/responsive/responsive-legacy.js +17 -12
  56. package/dist/components/responsive/responsive.js +227 -160
  57. package/dist/components/responsive-preview/responsive-preview.js +5 -3
  58. package/dist/components/rich-label/rich-label.js +12 -8
  59. package/dist/components/select/async-multi-select.js +9 -6
  60. package/dist/components/select/async-single-select.js +7 -2
  61. package/dist/components/select/custom-select-default-components.js +3 -3
  62. package/dist/components/select/multi-select-components.js +2 -2
  63. package/dist/components/select/multi-select.js +9 -6
  64. package/dist/components/select/react-select-component-wrappers.js +1 -1
  65. package/dist/components/select/single-select.js +7 -2
  66. package/dist/components/select/styles.js +4 -4
  67. package/dist/components/slider/column-config-slider.js +18 -34
  68. package/dist/components/slider/slider.js +19 -26
  69. package/dist/components/slider/utils.js +44 -1
  70. package/dist/components/spacer/spacer.js +21 -11
  71. package/dist/components/tabs/tabs.js +21 -20
  72. package/dist/components/toggle/switch.js +18 -12
  73. package/dist/components/toggle/toggle.js +8 -2
  74. package/dist/components/toggle-button/toggle-button.js +25 -13
  75. package/dist/components/tooltip/tooltip.js +4 -4
  76. package/dist/{context-jMy6xdVq.js → context-BAcFg5GO.js} +1 -1
  77. package/dist/{default-i18n-BhE-OUmt.js → default-i18n-Bk1GxDHz.js} +1 -1
  78. package/dist/{focusSafely-C3K8zAKj.js → focusSafely-B0hyd-S4.js} +1 -1
  79. package/dist/fonts.js +1 -0
  80. package/dist/icons/icons.js +184 -164
  81. package/dist/icons/jsx-svg.js +4957 -0
  82. package/dist/{index-Bfb9bWcb.js → index-BDk0TPWz.js} +1 -1
  83. package/dist/{index-a301f526.esm-Bioi4cGX.js → index-a301f526.esm-BzTuHLdr.js} +1 -1
  84. package/dist/index.js +30 -4
  85. package/dist/{intlStrings-CUhoK9EN.js → intlStrings-Ctkp0HDc.js} +1 -1
  86. package/dist/lite-pbIeT7tm.js +8 -0
  87. package/dist/{multi-select-components-CjVpCNko.js → multi-select-components-nORKdJ-2.js} +3 -3
  88. package/dist/{popover-Dx3vKXUX.js → popover-o2Q28Ljn.js} +19 -14
  89. package/dist/{react-select-async.esm-TFb_ZX6C.js → react-select-async.esm-CLj9uZTq.js} +3 -3
  90. package/dist/{react-select.esm-BjRWqf0E.js → react-select.esm-3tyTZmrx.js} +3 -3
  91. package/dist/{textSelection-BosCCRVE.js → textSelection-BRZdHY-4.js} +1 -1
  92. package/dist/{tooltip-CkCndvTI.js → tooltip-T6H9uF-Z.js} +10 -10
  93. package/dist/{useButton-CuG5UzUw.js → useButton-D-xACzEY.js} +3 -3
  94. package/dist/{useEvent-DHv-yhOH.js → useEvent-XlYPKgwX.js} +1 -1
  95. package/dist/{useFocusRing-Cc-4eouh.js → useFocusRing-CRx_hYC4.js} +1 -1
  96. package/dist/{useFocusable-5q1Gek1J.js → useFocusable-CHfpEdlE.js} +2 -2
  97. package/dist/{useFormReset-Buc9YJcv.js → useFormReset-aHn6-wRk.js} +1 -1
  98. package/dist/{useFormValidationState-BAPPNXic.js → useFormValidationState-CdYmOaXI.js} +2 -2
  99. package/dist/{useHasTabbableChild-D3uUNhJ0.js → useHasTabbableChild-domoFB7A.js} +2 -2
  100. package/dist/{useLabel-CGlkoFG0.js → useLabel-DVhXVhtH.js} +2 -2
  101. package/dist/{useLabels-Dg62M_3P.js → useLabels-C7E5SkOi.js} +1 -1
  102. package/dist/{useListState-Domq0blV.js → useListState-BRsq7O1C.js} +1 -1
  103. package/dist/{useLocalizedStringFormatter-Prmz0h0A.js → useLocalizedStringFormatter-WsEL47qR.js} +1 -1
  104. package/dist/{useNumberFieldState-BLU3uhSR.js → useNumberFieldState-ZH2Qyyxh.js} +9 -9
  105. package/dist/{useNumberFormatter-BLc2xjZn.js → useNumberFormatter-mhdYLxWQ.js} +1 -1
  106. package/dist/{usePress-BQgVor4T.js → usePress-B42RawCH.js} +3 -3
  107. package/dist/{useToggle-C9ETOBaZ.js → useToggle-CExfZM8x.js} +4 -4
  108. package/dist/{useToggleState-DJ_z5E2S.js → useToggleState-DghG5ImG.js} +1 -1
  109. package/dist/utilities/array-helpers.js +30 -0
  110. package/dist/utilities/index.js +8 -0
  111. package/dist/utilities/text-helpers.js +30 -4
  112. package/dist/{utils-BsiH7-5Y.js → utils-DIBzm1e4.js} +1 -1
  113. package/dist/wp.js +1 -0
  114. package/package.json +11 -4
  115. package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
  116. package/dist/utilities/classnames.js +0 -16
@@ -1,15 +1,14 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import { D as DecorativeTooltip } from "../../tooltip-CkCndvTI.js";
4
- import { classnames } from "../../utilities/classnames.js";
5
- import { _ as __, s as sprintf } from "../../default-i18n-BhE-OUmt.js";
3
+ import { D as DecorativeTooltip } from "../../tooltip-T6H9uF-Z.js";
4
+ import { c as clsx } from "../../lite-pbIeT7tm.js";
5
+ import { _ as __, s as sprintf } from "../../default-i18n-Bk1GxDHz.js";
6
6
  import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
7
7
  import { upperFirst } from "../../utilities/text-helpers.js";
8
8
  import { icons } from "../../icons/icons.js";
9
- import { Menu, MenuItem, MenuSeparator } from "../menu/menu.js";
10
- import { T as TriggeredPopover } from "../../popover-Dx3vKXUX.js";
9
+ import { Menu, MenuItem, MenuSeparator, SubMenuItem } from "../menu/menu.js";
11
10
  import { ResponsivePreview } from "../responsive-preview/responsive-preview.js";
12
- import { a as ButtonGroup, B as Button } from "../../button-BkkdyHfJ.js";
11
+ import { a as ButtonGroup, B as Button } from "../../button-idVI4jmd.js";
13
12
  import { RichLabel } from "../rich-label/rich-label.js";
14
13
  import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
15
14
  import { ToggleButton } from "../toggle-button/toggle-button.js";
@@ -23,6 +22,8 @@ import { BaseControl } from "../base-control/base-control.js";
23
22
  * - `currentValue: any` - Current value.
24
23
  * - `handleChange: Function<(attributeName: string, value: any) => void>` - A function to change the value for the breakpoint..
25
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.
26
27
  *
27
28
  * @component
28
29
  * @param {Object} props - Component props.
@@ -36,6 +37,9 @@ import { BaseControl } from "../base-control/base-control.js";
36
37
  * @param {string[]} props.breakpoints - Breakpoints to use.
37
38
  * @param {string[]} [props.desktopFirstBreakpoints] - Breakpoints to use in desktop-first mode. If not provided, the breakpoints will be used in reverse order.
38
39
  * @param {Object<string, number>} [props.breakpointData] - Currently used breakpoint data. `{ [breakpoint: string]: number }`.
40
+ * @param {boolean} [props.noModeSelect] - If `true`, the mode selection (desktop-first/mobile-first) is hidden.
41
+ * @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.
42
+ * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
39
43
  *
40
44
  * @returns {JSX.Element} The Responsive component.
41
45
  *
@@ -74,16 +78,26 @@ const Responsive = (props) => {
74
78
  label,
75
79
  subtitle,
76
80
  options,
77
- breakpoints,
78
- desktopFirstBreakpoints = breakpoints.map((bp) => `max-${bp}`),
81
+ breakpoints: rawBreakpoints,
82
+ desktopFirstBreakpoints: rawDesktopFirstBreakpoints,
79
83
  breakpointData,
80
- children
84
+ noModeSelect,
85
+ inline,
86
+ children,
87
+ hidden
81
88
  } = props;
89
+ const breakpoints = rawBreakpoints.slice(1);
90
+ const desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map(
91
+ (breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`
92
+ );
82
93
  const [detailsVisible, setDetailsVisible] = useState(false);
83
94
  const isDesktopFirst = (value == null ? void 0 : value["_mobileFirst"]) === true;
84
- const firstMobileFirstOverride = breakpoints.find((breakpoint) => value == null ? void 0 : value[breakpoint]);
85
- const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => value == null ? void 0 : value[breakpoint]);
95
+ const firstMobileFirstOverride = breakpoints.find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
96
+ const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => typeof (value == null ? void 0 : value[breakpoint]) !== "undefined");
86
97
  const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
98
+ if (hidden) {
99
+ return null;
100
+ }
87
101
  const DefaultTooltip = () => {
88
102
  var _a, _b, _c, _d;
89
103
  return /* @__PURE__ */ jsx(
@@ -98,17 +112,17 @@ const Responsive = (props) => {
98
112
  /* @__PURE__ */ jsx("span", { className: "es-uic-block es-uic-text-balance es-uic-font-semibold es-uic-tabular-nums", children: __("Default", "eightshift-ui-components") }),
99
113
  /* @__PURE__ */ jsxs("span", { className: "es-uic-block es-uic-text-balance es-uic-tabular-nums", children: [
100
114
  !firstMobileFirstOverride && !lastDesktopFirstOverride && __("Always applied, regardless of browser width.", "eightshift-ui-components"),
101
- firstMobileFirstOverride && sprintf(
115
+ firstMobileFirstOverride && !isDesktopFirst && sprintf(
102
116
  __("Applies when the browser width is %dpx or narrower.", "eightshift-ui-components"),
103
117
  breakpointData[firstMobileFirstOverride] - 1
104
118
  ),
105
- lastDesktopFirstOverride && sprintf(
119
+ lastDesktopFirstOverride && isDesktopFirst && sprintf(
106
120
  __("Applies when the browser width is %dpx or more.", "eightshift-ui-components"),
107
121
  breakpointData[breakpoints.at(-1)]
108
122
  )
109
123
  ] }),
110
124
  /* @__PURE__ */ jsxs("div", { className: "es-uic-mx-auto", children: [
111
- firstMobileFirstOverride && /* @__PURE__ */ jsx(
125
+ firstMobileFirstOverride && !isDesktopFirst && /* @__PURE__ */ jsx(
112
126
  BreakpointPreview,
113
127
  {
114
128
  blocks: [
@@ -128,7 +142,7 @@ const Responsive = (props) => {
128
142
  ]
129
143
  }
130
144
  ),
131
- lastDesktopFirstOverride && /* @__PURE__ */ jsx(
145
+ lastDesktopFirstOverride && isDesktopFirst && /* @__PURE__ */ jsx(
132
146
  BreakpointPreview,
133
147
  {
134
148
  blocks: [
@@ -150,7 +164,7 @@ const Responsive = (props) => {
150
164
  )
151
165
  ] })
152
166
  ] }),
153
- children: /* @__PURE__ */ jsx("div", { className: "es-uic-flex es-uic-size-8 es-uic-cursor-help es-uic-items-center es-uic-justify-center es-uic-rounded es-uic-bg-gray-200 es-uic-p-0.5 es-uic-text-gray-950 [&>svg]:es-uic-size-4", children: icons.play })
167
+ children: /* @__PURE__ */ jsx("div", { className: "es-uic-flex es-uic-size-7 es-uic-items-center es-uic-justify-center es-uic-rounded es-uic-border es-uic-border-teal-500/10 es-uic-bg-teal-50 es-uic-p-0.5 es-uic-text-teal-800 es-uic-shadow-sm es-uic-shadow-teal-600/25 [&>svg]:es-uic-size-5", children: icons[`screen${upperFirst(isDesktopFirst ? rawBreakpoints.at(-1) : rawBreakpoints.at(0))}`] })
154
168
  }
155
169
  );
156
170
  };
@@ -161,142 +175,172 @@ const Responsive = (props) => {
161
175
  label,
162
176
  subtitle,
163
177
  help,
164
- actions: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
165
- /* @__PURE__ */ jsxs(
166
- Menu,
178
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
179
+ inline && /* @__PURE__ */ jsx(
180
+ AnimatedVisibility,
167
181
  {
168
- tooltip: __("Responsive options", "eightshift-ui-components"),
169
- popoverProps: { placement: "bottom right" },
170
- children: [
171
- /* @__PURE__ */ jsx(
172
- MenuItem,
173
- {
174
- className: "!es-uic-pb-0 !es-uic-pt-1",
175
- disabled: true,
176
- children: __("Breakpoint mode", "eightshift-ui-components")
177
- }
178
- ),
179
- /* @__PURE__ */ jsx(
180
- MenuItem,
181
- {
182
- selected: !isDesktopFirst,
183
- onClick: () => {
184
- const thingsToDelete = [...breakpoints, ...desktopFirstBreakpoints].reduce(
185
- (prev, curr) => ({ ...prev, [curr]: void 0 }),
186
- {}
187
- );
188
- onChange({
189
- ...value,
190
- ...thingsToDelete,
191
- _mobileFirst: false
192
- });
193
- },
194
- children: /* @__PURE__ */ jsx(
195
- RichLabel,
182
+ className: "es-uic-mr-0.5",
183
+ visible: !detailsVisible,
184
+ transition: "scaleFade",
185
+ noInitial: true,
186
+ children: children({
187
+ breakpoint: "_default",
188
+ currentValue: value == null ? void 0 : value["_default"],
189
+ handleChange: (newValue) => onChange({
190
+ ...value,
191
+ _default: newValue
192
+ }),
193
+ options,
194
+ key: Object.keys(value),
195
+ isInlineCollapsedView: true
196
+ })
197
+ },
198
+ "_default-inline"
199
+ ),
200
+ /* @__PURE__ */ jsxs(ButtonGroup, { children: [
201
+ /* @__PURE__ */ jsx(
202
+ ToggleButton,
203
+ {
204
+ icon: isDesktopFirst ? icons.responsiveOverridesAlt : icons.responsiveOverridesAlt2,
205
+ onChange: () => setDetailsVisible(!detailsVisible),
206
+ selected: detailsVisible,
207
+ tooltip: detailsVisible ? __("Hide responsive overrides", "eightshift-ui-components") : __("Show responsive overrides", "eightshift-ui-components")
208
+ }
209
+ ),
210
+ /* @__PURE__ */ jsxs(
211
+ Menu,
212
+ {
213
+ tooltip: __("Responsive options", "eightshift-ui-components"),
214
+ popoverProps: { placement: "bottom right" },
215
+ triggerProps: { className: "es-uic-w-5.5 es-uic-stroke-[1.25]" },
216
+ triggerIcon: icons.dropdownCaretAlt,
217
+ children: [
218
+ !noModeSelect && /* @__PURE__ */ jsxs(Fragment, { children: [
219
+ /* @__PURE__ */ jsx(
220
+ MenuItem,
196
221
  {
197
- label: __("Mobile-first", "eightshift-ui-components"),
198
- subtitle: __("Recommended", "eightshift-ui-components")
222
+ className: "!es-uic-pb-0 !es-uic-pt-1",
223
+ disabled: true,
224
+ children: __("Breakpoint mode", "eightshift-ui-components")
199
225
  }
200
- )
201
- }
202
- ),
203
- /* @__PURE__ */ jsx(
204
- MenuItem,
205
- {
206
- selected: isDesktopFirst,
207
- onClick: () => {
208
- const thingsToDelete = [...breakpoints, ...desktopFirstBreakpoints].reduce(
209
- (prev, curr) => ({ ...prev, [curr]: void 0 }),
210
- {}
211
- );
212
- onChange({
213
- ...value,
214
- ...thingsToDelete,
215
- _mobileFirst: true
216
- });
217
- },
218
- children: __("Desktop-first", "eightshift-ui-components")
219
- }
220
- ),
221
- /* @__PURE__ */ jsx(MenuSeparator, {}),
222
- /* @__PURE__ */ jsx(
223
- MenuItem,
224
- {
225
- icon: icons.clearAlt,
226
- onClick: () => {
227
- const thingsToDelete = [...breakpoints, ...desktopFirstBreakpoints].reduce(
228
- (prev, curr) => ({ ...prev, [curr]: void 0 }),
229
- {}
230
- );
231
- onChange({
232
- ...value,
233
- ...thingsToDelete
234
- });
235
- },
236
- children: __("Clear all overrides", "eightshift-ui-components")
237
- }
238
- )
239
- ]
240
- }
241
- ),
242
- /* @__PURE__ */ jsx(
243
- TriggeredPopover,
244
- {
245
- "aria-label": props["aria-label"] ?? __("Breakpoint preview", "eightshift-ui-components"),
246
- trigger: /* @__PURE__ */ jsx(
247
- Button,
248
- {
249
- disabled: !Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && (value == null ? void 0 : value[key]) !== void 0),
250
- icon: icons.previewResponsive,
251
- tooltip: __("Breakpoint preview", "eightshift-ui-components")
252
- }
253
- ),
254
- children: /* @__PURE__ */ jsx(
255
- ResponsivePreview,
256
- {
257
- value,
258
- isDesktopFirst,
259
- breakpoints,
260
- desktopFirstBreakpoints,
261
- options,
262
- breakpointData
263
- }
264
- )
265
- }
266
- ),
267
- /* @__PURE__ */ jsx(
268
- ToggleButton,
269
- {
270
- icon: isDesktopFirst ? icons.responsiveOverridesAlt : icons.responsiveOverridesAlt2,
271
- onChange: () => setDetailsVisible(!detailsVisible),
272
- selected: detailsVisible,
273
- tooltip: detailsVisible ? __("Hide responsive overrides", "eightshift-ui-components") : __("Show responsive overrides", "eightshift-ui-components")
274
- }
275
- )
226
+ ),
227
+ /* @__PURE__ */ jsx(
228
+ MenuItem,
229
+ {
230
+ selected: !isDesktopFirst,
231
+ onClick: () => {
232
+ onChange({
233
+ _default: value["_default"],
234
+ _mobileFirst: false
235
+ });
236
+ },
237
+ children: /* @__PURE__ */ jsx(
238
+ RichLabel,
239
+ {
240
+ label: __("Mobile-first", "eightshift-ui-components"),
241
+ subtitle: __("Recommended", "eightshift-ui-components")
242
+ }
243
+ )
244
+ }
245
+ ),
246
+ /* @__PURE__ */ jsx(
247
+ MenuItem,
248
+ {
249
+ selected: isDesktopFirst,
250
+ onClick: () => {
251
+ onChange({
252
+ _default: value["_default"],
253
+ _mobileFirst: true
254
+ });
255
+ },
256
+ children: __("Desktop-first", "eightshift-ui-components")
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsx(MenuSeparator, {})
260
+ ] }),
261
+ Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined") && /* @__PURE__ */ jsx(
262
+ SubMenuItem,
263
+ {
264
+ trigger: /* @__PURE__ */ jsx(MenuItem, { icon: icons.previewResponsive, children: __("Responsive preview", "eightshift-ui-components") }),
265
+ children: /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: /* @__PURE__ */ jsx(
266
+ ResponsivePreview,
267
+ {
268
+ value,
269
+ isDesktopFirst,
270
+ breakpoints,
271
+ desktopFirstBreakpoints,
272
+ options,
273
+ breakpointData
274
+ }
275
+ ) })
276
+ }
277
+ ),
278
+ Object.keys(value).some((key) => !(key == null ? void 0 : key.startsWith("_")) && typeof (value == null ? void 0 : value[key]) !== "undefined") && /* @__PURE__ */ jsx(MenuSeparator, {}),
279
+ /* @__PURE__ */ jsx(
280
+ MenuItem,
281
+ {
282
+ icon: icons.clearAlt,
283
+ onClick: () => {
284
+ const newValue = { ...value };
285
+ [...breakpoints, ...desktopFirstBreakpoints].forEach((breakpoint) => {
286
+ delete newValue[breakpoint];
287
+ });
288
+ onChange(newValue);
289
+ },
290
+ children: __("Clear all overrides", "eightshift-ui-components")
291
+ }
292
+ )
293
+ ]
294
+ }
295
+ )
296
+ ] })
276
297
  ] }),
277
298
  children: [
278
- !isDesktopFirst && /* @__PURE__ */ jsxs(
299
+ !isDesktopFirst && !inline && /* @__PURE__ */ jsxs(
279
300
  "div",
280
301
  {
281
- className: classnames(
302
+ className: clsx(
282
303
  "es-uic-grid es-uic-items-center es-uic-gap-x-2 es-uic-transition-[grid-template-columns,_margin-block-end] es-uic-duration-150",
283
- detailsVisible ? "es-uic-mb-2 es-uic-grid-cols-[minmax(0,_2rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]" : "es-uic-grid-cols-[minmax(0,_0rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]"
304
+ detailsVisible ? "es-uic-mb-2 es-uic-grid-cols-[minmax(0,_1.75rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]" : "es-uic-grid-cols-[minmax(0,_0rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]"
284
305
  ),
285
306
  children: [
286
307
  detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
287
- /* @__PURE__ */ jsx("div", { className: classnames(detailsVisible ? "es-uic-col-start-2 es-uic-col-end-2" : "es-uic-col-span-full"), children: children({
308
+ /* @__PURE__ */ jsx("div", { className: clsx(detailsVisible ? "es-uic-col-start-2 es-uic-col-end-2" : "es-uic-col-span-full"), children: children({
288
309
  breakpoint: "_default",
289
310
  currentValue: value == null ? void 0 : value["_default"],
290
311
  handleChange: (newValue) => onChange({
291
312
  ...value,
292
313
  _default: newValue
293
314
  }),
294
- options
315
+ options,
316
+ key: Object.keys(value)
295
317
  }) })
296
318
  ]
297
319
  },
298
320
  "_default-mobile-first"
299
321
  ),
322
+ !isDesktopFirst && inline && /* @__PURE__ */ jsxs(
323
+ AnimatedVisibility,
324
+ {
325
+ className: "es-uic-mb-2 es-uic-grid es-uic-grid-cols-[minmax(0,_1.75rem),_minmax(0,_1fr),_minmax(0,_2.25rem)] es-uic-items-center es-uic-gap-x-2",
326
+ visible: detailsVisible,
327
+ children: [
328
+ /* @__PURE__ */ jsx(DefaultTooltip, {}),
329
+ /* @__PURE__ */ jsx("div", { className: "es-uic-col-start-2 es-uic-col-end-2", children: children({
330
+ breakpoint: "_default",
331
+ currentValue: value == null ? void 0 : value["_default"],
332
+ handleChange: (newValue) => onChange({
333
+ ...value,
334
+ _default: newValue
335
+ }),
336
+ options,
337
+ key: Object.keys(value),
338
+ isInlineExpandedView: true
339
+ }) })
340
+ ]
341
+ },
342
+ "_default-mobile-first-inline"
343
+ ),
300
344
  /* @__PURE__ */ jsx(
301
345
  AnimatedVisibility,
302
346
  {
@@ -306,8 +350,8 @@ const Responsive = (props) => {
306
350
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
307
351
  const realBreakpointName = breakpoint.replace("max-", "");
308
352
  const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, "_default"] : ["_default", ...breakpointsToMap];
309
- const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(i + 1).find((breakpoint2) => value == null ? void 0 : value[breakpoint2]) : filterBreakpoints.slice(0, i + 1).toReversed().find((breakpoint2) => value == null ? void 0 : value[breakpoint2]);
310
- const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, i).toReversed().find((breakpoint2) => value == null ? void 0 : value[breakpoint2]) : filterBreakpoints.slice(i + 2).find((breakpoint2) => value == null ? void 0 : value[breakpoint2]);
353
+ 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");
354
+ 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");
311
355
  return /* @__PURE__ */ jsxs(
312
356
  "div",
313
357
  {
@@ -324,11 +368,11 @@ const Responsive = (props) => {
324
368
  /* @__PURE__ */ jsx("span", { className: "es-uic-block es-uic-font-semibold", children: upperFirst(realBreakpointName) }),
325
369
  /* @__PURE__ */ jsxs("span", { className: "es-uic-block es-uic-text-balance es-uic-tabular-nums", children: [
326
370
  !isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
327
- !belowOverride && value[breakpoint] && sprintf(
371
+ !belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
328
372
  __("Applied when the browser width is %dpx or more.", "eightshift-ui-components"),
329
373
  breakpointData[realBreakpointName]
330
374
  ),
331
- belowOverride && value[breakpoint] && sprintf(
375
+ belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
332
376
  __(
333
377
  "Applied when the browser width is between %dpx and %dpx.",
334
378
  "eightshift-ui-components"
@@ -336,14 +380,14 @@ const Responsive = (props) => {
336
380
  breakpointData[realBreakpointName],
337
381
  breakpointData[belowOverride] - 1
338
382
  ),
339
- !value[breakpoint] && sprintf(__("From %dpx", "eightshift-ui-components"), breakpointData[realBreakpointName])
383
+ typeof value[breakpoint] === "undefined" && sprintf(__("From %dpx", "eightshift-ui-components"), breakpointData[realBreakpointName])
340
384
  ] }),
341
385
  isDesktopFirst && /* @__PURE__ */ jsxs(Fragment, { children: [
342
- !belowOverride && value[breakpoint] && sprintf(
386
+ !belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
343
387
  __("Applied when the browser width is %dpx or less.", "eightshift-ui-components"),
344
388
  breakpointData[realBreakpointName] - 1
345
389
  ),
346
- belowOverride && value[breakpoint] && sprintf(
390
+ belowOverride && typeof value[breakpoint] !== "undefined" && sprintf(
347
391
  __(
348
392
  "Applied when the browser width is between %dpx and %dpx.",
349
393
  "eightshift-ui-components"
@@ -351,26 +395,26 @@ const Responsive = (props) => {
351
395
  breakpointData[belowOverride == null ? void 0 : belowOverride.replace("max-", "")],
352
396
  breakpointData[realBreakpointName] - 1
353
397
  ),
354
- !value[breakpoint] && sprintf(
398
+ typeof value[breakpoint] === "undefined" && sprintf(
355
399
  __("Up to %dpx", "eightshift-ui-components"),
356
- breakpointData[belowOverride == null ? void 0 : belowOverride.replace("max-", "")]
400
+ breakpointData[breakpoint == null ? void 0 : breakpoint.replace("max-", "")]
357
401
  )
358
402
  ] })
359
403
  ] }),
360
- !value[breakpoint] && /* @__PURE__ */ jsx("span", { className: "es-uic-mt-2 es-uic-block es-uic-font-medium es-uic-italic", children: __("Not set", "eightshift-ui-components") }),
361
- value[breakpoint] && /* @__PURE__ */ jsxs("div", { className: "es-uic-mx-auto es-uic-mt-2", children: [
404
+ typeof value[breakpoint] === "undefined" && /* @__PURE__ */ jsx("span", { className: "es-uic-mt-2 es-uic-block es-uic-font-medium es-uic-italic", children: __("Not set", "eightshift-ui-components") }),
405
+ typeof value[breakpoint] !== "undefined" && /* @__PURE__ */ jsxs("div", { className: "es-uic-mx-auto es-uic-mt-2", children: [
362
406
  !isDesktopFirst && /* @__PURE__ */ jsx(
363
407
  BreakpointPreview,
364
408
  {
365
409
  dotsStart: belowOverride,
366
410
  blocks: [
367
- aboveOverride !== "_default" && {
411
+ aboveOverride !== "_default" && typeof (value == null ? void 0 : value[aboveOverride]) !== "undefined" && {
368
412
  breakpoint: aboveOverride,
369
413
  value: ((_a = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[aboveOverride]))) == null ? void 0 : _a.label) ?? upperFirst(value == null ? void 0 : value[aboveOverride]),
370
414
  dotsStart: !belowOverride,
371
415
  alignEnd: !belowOverride
372
416
  },
373
- aboveOverride === "_default" && {
417
+ aboveOverride === "_default" && typeof (value == null ? void 0 : value["_default"]) !== "undefined" && {
374
418
  breakpoint: __("Default", "eightshift-ui-components"),
375
419
  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"]),
376
420
  dotsStart: !belowOverride,
@@ -383,7 +427,7 @@ const Responsive = (props) => {
383
427
  active: true,
384
428
  dotsEnd: !belowOverride
385
429
  },
386
- belowOverride && {
430
+ belowOverride && typeof (value == null ? void 0 : value[belowOverride]) !== "undefined" && {
387
431
  breakpoint: belowOverride,
388
432
  value: ((_d = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[belowOverride]))) == null ? void 0 : _d.label) ?? upperFirst(value == null ? void 0 : value[belowOverride]),
389
433
  width: breakpointData[belowOverride],
@@ -400,7 +444,7 @@ const Responsive = (props) => {
400
444
  blocks: [
401
445
  belowOverride && {
402
446
  breakpoint: belowOverride == null ? void 0 : belowOverride.replace("max-", ""),
403
- value: ((_e = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[belowOverride == null ? void 0 : belowOverride.replace("max-", "")]))) == null ? void 0 : _e.label) ?? upperFirst(value == null ? void 0 : value[belowOverride])
447
+ value: ((_e = options == null ? void 0 : options.find((opt) => opt.value === (value == null ? void 0 : value[belowOverride]))) == null ? void 0 : _e.label) ?? upperFirst(value == null ? void 0 : value[belowOverride])
404
448
  },
405
449
  {
406
450
  breakpoint: realBreakpointName,
@@ -427,9 +471,9 @@ const Responsive = (props) => {
427
471
  children: /* @__PURE__ */ jsx(
428
472
  "div",
429
473
  {
430
- className: classnames(
431
- "es-uic-flex es-uic-size-8 es-uic-shrink-0 es-uic-items-center es-uic-justify-center es-uic-rounded es-uic-bg-gray-100 es-uic-p-0.5 es-uic-text-gray-800",
432
- !value[breakpoint] && "[&>svg]:es-uic-opacity-25"
474
+ className: clsx(
475
+ "es-uic-flex es-uic-size-7 es-uic-items-center es-uic-justify-center es-uic-rounded es-uic-border es-uic-p-0.5 es-uic-shadow-sm es-uic-transition-colors [&>svg]:es-uic-size-5",
476
+ typeof value[breakpoint] !== "undefined" ? "es-uic-border-gray-200 es-uic-bg-gray-50 es-uic-text-gray-700" : "es-uic-border-gray-100 es-uic-bg-white es-uic-text-gray-500"
433
477
  ),
434
478
  children: (_j = icons) == null ? void 0 : _j[`screen${upperFirst(realBreakpointName)}`]
435
479
  }
@@ -445,19 +489,19 @@ const Responsive = (props) => {
445
489
  [breakpoint]: newValue
446
490
  });
447
491
  },
448
- options
492
+ options,
493
+ key: Object.keys(value)
449
494
  }),
450
495
  /* @__PURE__ */ jsx(
451
496
  Button,
452
497
  {
453
498
  onPress: () => {
454
- onChange({
455
- ...value,
456
- [breakpoint]: void 0
457
- });
499
+ const newValue = { ...value };
500
+ delete newValue[breakpoint];
501
+ onChange(newValue);
458
502
  },
459
503
  icon: icons.clearAlt,
460
- disabled: !(value == null ? void 0 : value[breakpoint]),
504
+ disabled: typeof (value == null ? void 0 : value[breakpoint]) === "undefined",
461
505
  type: "ghost"
462
506
  }
463
507
  )
@@ -468,27 +512,50 @@ const Responsive = (props) => {
468
512
  })
469
513
  }
470
514
  ),
471
- isDesktopFirst && /* @__PURE__ */ jsxs(
515
+ isDesktopFirst && !inline && /* @__PURE__ */ jsxs(
472
516
  "div",
473
517
  {
474
- className: classnames(
518
+ className: clsx(
475
519
  "es-uic-grid es-uic-items-center es-uic-gap-x-2 es-uic-transition-[grid-template-columns,_margin-block-start] es-uic-duration-150",
476
- detailsVisible ? "!es-uic-mt-2 es-uic-grid-cols-[minmax(0,_2rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]" : "es-uic-grid-cols-[minmax(0,_0rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]"
520
+ detailsVisible ? "!es-uic-mt-2 es-uic-grid-cols-[minmax(0,_1.75rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]" : "es-uic-grid-cols-[minmax(0,_0rem),_minmax(0,_1fr),_minmax(0,_2.25rem)]"
477
521
  ),
478
522
  children: [
479
523
  detailsVisible && /* @__PURE__ */ jsx(DefaultTooltip, {}),
480
- /* @__PURE__ */ jsx("div", { className: classnames(detailsVisible ? "es-uic-col-start-2 es-uic-col-end-2" : "es-uic-col-span-full"), children: children({
524
+ /* @__PURE__ */ jsx("div", { className: clsx(detailsVisible ? "es-uic-col-start-2 es-uic-col-end-2" : "es-uic-col-span-full"), children: children({
481
525
  breakpoint: "_default",
482
526
  currentValue: value == null ? void 0 : value["_default"],
483
527
  handleChange: (newValue) => onChange({
484
528
  ...value,
485
529
  _default: newValue
486
530
  }),
487
- options
531
+ options,
532
+ key: Object.keys(value)
488
533
  }) })
489
534
  ]
490
535
  },
491
536
  "_default-desktop-first"
537
+ ),
538
+ isDesktopFirst && inline && /* @__PURE__ */ jsxs(
539
+ AnimatedVisibility,
540
+ {
541
+ className: "es-uic-grid es-uic-grid-cols-[minmax(0,_1.75rem),_minmax(0,_1fr),_minmax(0,_2.25rem)] es-uic-items-center es-uic-gap-x-2 es-uic-pt-1",
542
+ visible: detailsVisible,
543
+ children: [
544
+ /* @__PURE__ */ jsx(DefaultTooltip, {}),
545
+ /* @__PURE__ */ jsx("div", { className: "es-uic-col-start-2 es-uic-col-end-2", children: children({
546
+ breakpoint: "_default",
547
+ currentValue: value == null ? void 0 : value["_default"],
548
+ handleChange: (newValue) => onChange({
549
+ ...value,
550
+ _default: newValue
551
+ }),
552
+ options,
553
+ key: Object.keys(value),
554
+ isInlineExpandedView: true
555
+ }) })
556
+ ]
557
+ },
558
+ "_default-desktop-first-inline"
492
559
  )
493
560
  ]
494
561
  }
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
2
+ import { _ as __ } from "../../default-i18n-Bk1GxDHz.js";
3
3
  import { upperFirst } from "../../utilities/text-helpers.js";
4
4
  import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
5
5
  import { icons } from "../../icons/icons.js";
@@ -36,11 +36,13 @@ const ResponsivePreview = (props) => {
36
36
  const {
37
37
  value,
38
38
  isDesktopFirst,
39
- breakpoints,
40
- desktopFirstBreakpoints = breakpoints.map((bp) => `max-${bp}`),
39
+ breakpoints: rawBreakpoints,
40
+ desktopFirstBreakpoints: rawDesktopFirstBreakpoints,
41
41
  options,
42
42
  breakpointData
43
43
  } = props;
44
+ const breakpoints = rawBreakpoints.slice(1);
45
+ const desktopFirstBreakpoints = rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1);
44
46
  const firstMobileFirstOverride = breakpoints.find((breakpoint) => value == null ? void 0 : value[breakpoint]);
45
47
  const lastDesktopFirstOverride = desktopFirstBreakpoints.toReversed().find((breakpoint) => value == null ? void 0 : value[breakpoint]);
46
48
  let previewItems = [];