@eightshift/ui-components 8.1.0 → 8.2.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.
- package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
- package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
- package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
- package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
- package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
- package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
- package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
- package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
- package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
- package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
- package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
- package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
- package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
- package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
- package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
- package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
- package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
- package/dist/assets/style-admin.css +1 -1
- package/dist/assets/style-editor.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
- package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
- package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
- package/dist/components/animated-visibility/animated-visibility.js +5 -3
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/base-control/container.d.ts +4 -30
- package/dist/components/base-control/container.js +5 -32
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +7 -7
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.js +3 -3
- package/dist/components/container-panel/container-panel.js +11 -11
- package/dist/components/contextual-help/contextual-help.js +2 -2
- package/dist/components/draggable/draggable.d.ts +3 -3
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list.d.ts +3 -3
- package/dist/components/draggable-list/draggable-list.js +8 -8
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +16 -16
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.d.ts +3 -28
- package/dist/components/item-collection/item-collection.js +6 -6
- package/dist/components/link-input/link-input.d.ts +0 -2
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +4 -3
- package/dist/components/menu/menu.js +10 -7
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/notice/notice.js +8 -8
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.d.ts +1 -1
- package/dist/components/option-select/option-select.js +21 -15
- package/dist/components/options-panel/options-panel.js +4 -4
- package/dist/components/placeholders/file-picker-shell.js +4 -3
- package/dist/components/placeholders/file-placeholder.js +2 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/portal-provider/portal-provider.js +2 -1
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-context.d.ts +0 -1
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.d.ts +5 -38
- package/dist/components/repeater/repeater.js +7 -10
- package/dist/components/responsive/mini-responsive.d.ts +0 -1
- package/dist/components/responsive/mini-responsive.js +30 -30
- package/dist/components/responsive/responsive-legacy.d.ts +0 -1
- package/dist/components/responsive/responsive-legacy.js +12 -10
- package/dist/components/responsive/responsive.d.ts +0 -1
- package/dist/components/responsive/responsive.js +28 -28
- package/dist/components/responsive-preview/responsive-preview.js +3 -3
- package/dist/components/select/async-multi-select.d.ts +12 -13
- package/dist/components/select/async-multi-select.js +39 -20
- package/dist/components/select/async-select.d.ts +12 -13
- package/dist/components/select/async-select.js +38 -20
- package/dist/components/select/multi-select.d.ts +2 -8
- package/dist/components/select/multi-select.js +19 -19
- package/dist/components/select/shared.d.ts +5 -9
- package/dist/components/select/shared.js +2 -2
- package/dist/components/select/single-select.d.ts +2 -8
- package/dist/components/select/single-select.js +16 -16
- package/dist/components/slider/column-config-slider.js +7 -5
- package/dist/components/slider/slider.js +15 -11
- package/dist/components/smart-image/smart-image.d.ts +0 -1
- package/dist/components/smart-image/smart-image.js +52 -50
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +2 -2
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
- package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
- package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
- package/dist/icons/block-icon.js +1 -1
- package/dist/icons/icon.d.ts +3 -3
- package/dist/icons/icon.js +21 -9
- package/dist/icons/icons.d.ts +210 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.d.ts +5 -4
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +16 -16
- package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
- package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
- package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
- package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
- package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
- package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
- package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
- package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
- package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
- package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
- package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
- package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
- package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
- package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
- package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
- package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
- package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
- package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
- package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
- package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
- package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
- package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
- package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
- package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
- package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
- package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
- package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
- package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
- package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
- package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
- package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
- package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
- package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
- package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
- package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
- package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
- package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
- package/dist/utilities/array-helpers.d.ts +1 -1
- package/dist/utilities/array-helpers.js +4 -3
- package/dist/utilities/debounce-throttle.d.ts +9 -2
- package/dist/utilities/es-dash.d.ts +11 -8
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/text-helpers.js +1 -1
- package/dist/utilities/web-workers.d.ts +7 -7
- package/dist/utilities/web-workers.js +5 -5
- package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
- package/package.json +21 -25
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { t as $efe09c6d1c304b50$export$5f1af8db9871e1d6 } from "../../Text-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
2
|
+
import { t as $efe09c6d1c304b50$export$5f1af8db9871e1d6 } from "../../Text-i-ZK4MiL.js";
|
|
3
|
+
import { t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
|
|
4
|
+
import { n as ButtonGroup, t as Button } from "../../button-C7mc6eS1.js";
|
|
5
5
|
import { BaseControl } from "../base-control/base-control.js";
|
|
6
|
-
import { f as upperFirst } from "../../es-dash-
|
|
6
|
+
import { f as upperFirst } from "../../es-dash-DPtJSRjw.js";
|
|
7
7
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
8
8
|
import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
|
|
9
9
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
@@ -14,7 +14,7 @@ import { responsiveOverridesAltFill } from "../../icons/ui-icons/responsive-over
|
|
|
14
14
|
import { responsiveOverridesAlt2Fill } from "../../icons/ui-icons/responsive-overrides-alt2-fill.js";
|
|
15
15
|
import { TriggeredPopover } from "../popover/popover.js";
|
|
16
16
|
import { HStack } from "../layout/hstack.js";
|
|
17
|
-
import { Container, ContainerGroup } from "../base-control/container.js";
|
|
17
|
+
import { Container as TypedContainer, ContainerGroup as TypedContainerGroup } from "../base-control/container.js";
|
|
18
18
|
import { OptionSelect } from "../option-select/option-select.js";
|
|
19
19
|
import { ResponsivePreview } from "../responsive-preview/responsive-preview.js";
|
|
20
20
|
import { cloneElement } from "react";
|
|
@@ -30,7 +30,7 @@ var getResponsiveLabel = (value, key, options) => {
|
|
|
30
30
|
if (!currentValue) return;
|
|
31
31
|
return options?.find((option) => option.value === currentValue)?.label ?? upperFirst(currentValue);
|
|
32
32
|
};
|
|
33
|
-
var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.startsWith("_") &&
|
|
33
|
+
var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.startsWith("_") && value[key] !== void 0);
|
|
34
34
|
/**
|
|
35
35
|
* A compact, inline version of `Responsive`. Allows the user to set different values for different breakpoints.
|
|
36
36
|
*
|
|
@@ -74,7 +74,7 @@ var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.st
|
|
|
74
74
|
*/
|
|
75
75
|
var MiniResponsive = (props) => {
|
|
76
76
|
const { value = {}, onChange, icon, help, label, subtitle, options, breakpoints: rawBreakpoints, desktopFirstBreakpoints: rawDesktopFirstBreakpoints, breakpointData = {}, breakpointUiData, noModeSelect, children, hidden, useLegacyDesktopFirst, innerContentAlign = "start" } = props;
|
|
77
|
-
if (
|
|
77
|
+
if (rawBreakpoints === void 0 || !Array.isArray(rawBreakpoints)) {
|
|
78
78
|
console.warn(__("MiniResponsive: Missing or invalid 'breakpoints' prop.", "eightshift-ui-components"));
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
@@ -82,13 +82,13 @@ var MiniResponsive = (props) => {
|
|
|
82
82
|
let desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
83
83
|
if (useLegacyDesktopFirst) desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
84
84
|
const isDesktopFirst = value[desktopFirstKey] === true;
|
|
85
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) =>
|
|
86
|
-
const lastDesktopFirstOverride = [...desktopFirstBreakpoints].reverse().find((breakpoint) =>
|
|
85
|
+
const firstMobileFirstOverride = breakpoints.find((breakpoint) => value[breakpoint] !== void 0);
|
|
86
|
+
const lastDesktopFirstOverride = [...desktopFirstBreakpoints].reverse().find((breakpoint) => value[breakpoint] !== void 0);
|
|
87
87
|
const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
|
|
88
88
|
const responsiveOverridesApplied = hasResponsiveOverrides(value);
|
|
89
89
|
const getBreakpointWidth = (breakpoint) => breakpointData[breakpoint] ?? 0;
|
|
90
90
|
if (hidden) return null;
|
|
91
|
-
const
|
|
91
|
+
const renderDefaultTooltip = () => {
|
|
92
92
|
const defaultBreakpoint = isDesktopFirst ? rawBreakpoints[rawBreakpoints.length - 1] : rawBreakpoints[0];
|
|
93
93
|
const overrideIcon = defaultBreakpoint ? breakpointUiData?.[defaultBreakpoint]?.icon : void 0;
|
|
94
94
|
const fallbackBreakpoint = defaultBreakpoint ?? "desktop";
|
|
@@ -181,7 +181,7 @@ var MiniResponsive = (props) => {
|
|
|
181
181
|
children: [
|
|
182
182
|
!isDesktopFirst ? jsxs("div", {
|
|
183
183
|
className: clsx("es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
184
|
-
children: [
|
|
184
|
+
children: [renderDefaultTooltip(), jsx("div", {
|
|
185
185
|
className: "es:w-full es:col-start-2 es:col-end-2",
|
|
186
186
|
children: children({
|
|
187
187
|
breakpoint: defaultKey,
|
|
@@ -199,8 +199,8 @@ var MiniResponsive = (props) => {
|
|
|
199
199
|
breakpointsToMap.map((breakpoint, index) => {
|
|
200
200
|
const realBreakpointName = breakpoint.replace("max-", "");
|
|
201
201
|
const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, defaultKey] : [defaultKey, ...breakpointsToMap];
|
|
202
|
-
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(index + 1).find((currentBreakpoint) =>
|
|
203
|
-
const belowOverride = isDesktopFirst ?
|
|
202
|
+
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(index + 1).find((currentBreakpoint) => value[currentBreakpoint] !== void 0) : filterBreakpoints.slice(0, index + 1).reverse().find((currentBreakpoint) => value[currentBreakpoint] !== void 0);
|
|
203
|
+
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, index).reverse().find((currentBreakpoint) => value[currentBreakpoint] !== void 0) : filterBreakpoints.slice(index + 2).find((currentBreakpoint) => value[currentBreakpoint] !== void 0);
|
|
204
204
|
return jsxs("div", {
|
|
205
205
|
className: clsx("es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-1.5", "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-surface-200/60", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
206
206
|
children: [
|
|
@@ -218,31 +218,31 @@ var MiniResponsive = (props) => {
|
|
|
218
218
|
jsx("span", {
|
|
219
219
|
className: "es:block es:text-balance es:tabular-nums es:font-variation-[\"wdth\"_64,\"wght\"_275,\"ROND\"_50,\"slnt\"_-2] es:text-surface-500 es:mt-1",
|
|
220
220
|
children: !isDesktopFirst ? jsxs(Fragment$1, { children: [
|
|
221
|
-
!belowOverride &&
|
|
222
|
-
belowOverride &&
|
|
223
|
-
|
|
221
|
+
!belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName)) : null,
|
|
222
|
+
belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName), getBreakpointWidth(belowOverride) - 1) : null,
|
|
223
|
+
value[breakpoint] === void 0 ? sprintf(__("From %dpx", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName)) : null
|
|
224
224
|
] }) : jsxs(Fragment$1, { children: [
|
|
225
|
-
!belowOverride &&
|
|
226
|
-
belowOverride &&
|
|
227
|
-
|
|
225
|
+
!belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName) - 1) : null,
|
|
226
|
+
belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"), getBreakpointWidth(belowOverride.replace("max-", "")), getBreakpointWidth(realBreakpointName) - 1) : null,
|
|
227
|
+
value[breakpoint] === void 0 ? sprintf(__("Up to %dpx", "eightshift-ui-components"), getBreakpointWidth(breakpoint.replace("max-", ""))) : null
|
|
228
228
|
] })
|
|
229
229
|
}),
|
|
230
|
-
|
|
230
|
+
value[breakpoint] === void 0 ? jsx("span", {
|
|
231
231
|
className: "es:mt-2 es:text-sm es:leading-none es:block es:font-variation-[\"wdth\"_75,\"wght\"_300,\"slnt\"_-5]",
|
|
232
232
|
children: __("Not set", "eightshift-ui-components")
|
|
233
233
|
}) : null,
|
|
234
|
-
|
|
234
|
+
value[breakpoint] !== void 0 ? jsx("div", {
|
|
235
235
|
className: "es:mx-auto es:mt-5",
|
|
236
236
|
children: !isDesktopFirst ? jsx(BreakpointPreview, {
|
|
237
237
|
dotsStart: Boolean(belowOverride),
|
|
238
238
|
blocks: [
|
|
239
|
-
aboveOverride && aboveOverride !== defaultKey &&
|
|
239
|
+
aboveOverride && aboveOverride !== defaultKey && value[aboveOverride] !== void 0 ? {
|
|
240
240
|
breakpoint: breakpointUiData?.[aboveOverride]?.label ?? aboveOverride,
|
|
241
241
|
value: getResponsiveLabel(value, aboveOverride, options),
|
|
242
242
|
dotsStart: !belowOverride,
|
|
243
243
|
alignEnd: !belowOverride
|
|
244
244
|
} : null,
|
|
245
|
-
aboveOverride === defaultKey &&
|
|
245
|
+
aboveOverride === defaultKey && value[defaultKey] !== void 0 ? {
|
|
246
246
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
247
247
|
value: getResponsiveLabel(value, defaultKey, options),
|
|
248
248
|
dotsStart: !belowOverride,
|
|
@@ -255,7 +255,7 @@ var MiniResponsive = (props) => {
|
|
|
255
255
|
active: true,
|
|
256
256
|
dotsEnd: !belowOverride
|
|
257
257
|
},
|
|
258
|
-
belowOverride &&
|
|
258
|
+
belowOverride && value[belowOverride] !== void 0 ? {
|
|
259
259
|
breakpoint: breakpointUiData?.[belowOverride]?.label ?? belowOverride,
|
|
260
260
|
value: getResponsiveLabel(value, belowOverride, options),
|
|
261
261
|
width: String(getBreakpointWidth(belowOverride)),
|
|
@@ -292,7 +292,7 @@ var MiniResponsive = (props) => {
|
|
|
292
292
|
}) : null
|
|
293
293
|
] }),
|
|
294
294
|
children: jsx("div", {
|
|
295
|
-
className: clsx("es:transition-colors es:icon:size-6 es:mx-0.5",
|
|
295
|
+
className: clsx("es:transition-colors es:icon:size-6 es:mx-0.5", value[breakpoint] !== void 0 ? "es:text-surface-600" : "es:text-surface-300"),
|
|
296
296
|
children: jsx(Icon, {
|
|
297
297
|
icon: breakpointUiData?.[realBreakpointName]?.icon,
|
|
298
298
|
fallback: jsx(Icon, { icon: `screen${upperFirst(realBreakpointName)}` })
|
|
@@ -318,7 +318,7 @@ var MiniResponsive = (props) => {
|
|
|
318
318
|
onChange(newValue);
|
|
319
319
|
},
|
|
320
320
|
icon: clearAlt,
|
|
321
|
-
disabled:
|
|
321
|
+
disabled: value[breakpoint] === void 0,
|
|
322
322
|
type: "ghost"
|
|
323
323
|
})
|
|
324
324
|
]
|
|
@@ -326,7 +326,7 @@ var MiniResponsive = (props) => {
|
|
|
326
326
|
}),
|
|
327
327
|
isDesktopFirst ? jsxs("div", {
|
|
328
328
|
className: clsx("es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
329
|
-
children: [
|
|
329
|
+
children: [renderDefaultTooltip(), jsx("div", {
|
|
330
330
|
className: "es:w-full es:col-start-2 es:col-end-2",
|
|
331
331
|
children: children({
|
|
332
332
|
breakpoint: defaultKey,
|
|
@@ -343,10 +343,10 @@ var MiniResponsive = (props) => {
|
|
|
343
343
|
}, "_default-desktop-first") : null
|
|
344
344
|
]
|
|
345
345
|
}),
|
|
346
|
-
jsxs(
|
|
346
|
+
jsxs(TypedContainerGroup, {
|
|
347
347
|
wrapClassName: "es:m-2 es:mt-4",
|
|
348
348
|
label: __("Breakpoints", "eightshift-ui-components"),
|
|
349
|
-
children: [jsx(
|
|
349
|
+
children: [jsx(TypedContainer, {
|
|
350
350
|
lessSpaceEnd: true,
|
|
351
351
|
children: jsx(BaseControl, {
|
|
352
352
|
label: __("Actions", "eightshift-ui-components"),
|
|
@@ -376,7 +376,7 @@ var MiniResponsive = (props) => {
|
|
|
376
376
|
children: __("Clear overrides", "eightshift-ui-components")
|
|
377
377
|
})] })
|
|
378
378
|
})
|
|
379
|
-
}), jsx(
|
|
379
|
+
}), jsx(TypedContainer, {
|
|
380
380
|
lessSpaceEnd: true,
|
|
381
381
|
children: jsx(OptionSelect, {
|
|
382
382
|
hidden: noModeSelect,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
2
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
3
|
+
import { t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
|
|
4
|
+
import { t as ToggleButton } from "../../toggle-button-B2-f2rU6.js";
|
|
5
|
+
import { t as Button } from "../../button-C7mc6eS1.js";
|
|
6
6
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
|
-
import { f as upperFirst } from "../../es-dash-
|
|
7
|
+
import { f as upperFirst } from "../../es-dash-DPtJSRjw.js";
|
|
8
8
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
9
9
|
import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
|
|
10
10
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
@@ -15,11 +15,13 @@ import { responsiveOverridesAlt } from "../../icons/ui-icons/responsive-override
|
|
|
15
15
|
import { useState } from "react";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
//#region lib/components/responsive/responsive-legacy.tsx
|
|
18
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
19
|
+
var isBooleanValue = (value) => Object.prototype.toString.call(value) === "[object Boolean]";
|
|
18
20
|
var getResolvedValueLabel = (value, options) => {
|
|
19
21
|
const optionLabel = options?.find((option) => option.value === value)?.label;
|
|
20
22
|
if (optionLabel) return optionLabel;
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
23
|
+
if (isStringValue(value)) return upperFirst(value);
|
|
24
|
+
if (isBooleanValue(value)) return String(value);
|
|
23
25
|
};
|
|
24
26
|
/**
|
|
25
27
|
* A component that allows the user to set different values for different breakpoints.
|
|
@@ -81,7 +83,7 @@ var ResponsiveLegacy = (props) => {
|
|
|
81
83
|
const getBreakpointValue = (breakpoint) => value[getAttributeName(breakpoint)];
|
|
82
84
|
const getBreakpointLabel = (breakpoint) => getResolvedValueLabel(getBreakpointValue(breakpoint), options);
|
|
83
85
|
const globalOverride = breakpoints.find((breakpoint) => getBreakpointValue(breakpoint) !== inheritValue);
|
|
84
|
-
const
|
|
86
|
+
const renderDefaultTooltip = () => jsx(DecorativeTooltip, {
|
|
85
87
|
placement: "left",
|
|
86
88
|
className: "es:p-3",
|
|
87
89
|
theme: "light",
|
|
@@ -149,7 +151,7 @@ var ResponsiveLegacy = (props) => {
|
|
|
149
151
|
children: [
|
|
150
152
|
!inline ? jsxs("div", {
|
|
151
153
|
className: clsx("es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-end] es:duration-150", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch", 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)]"),
|
|
152
|
-
children: [detailsVisible ?
|
|
154
|
+
children: [detailsVisible ? renderDefaultTooltip() : null, jsx("div", {
|
|
153
155
|
className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"),
|
|
154
156
|
children: children({
|
|
155
157
|
breakpoint: defaultBreakpoint,
|
|
@@ -162,7 +164,7 @@ var ResponsiveLegacy = (props) => {
|
|
|
162
164
|
inline ? jsxs(AnimatedVisibility, {
|
|
163
165
|
className: clsx("es:mb-2 es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
164
166
|
visible: detailsVisible,
|
|
165
|
-
children: [
|
|
167
|
+
children: [renderDefaultTooltip(), jsx("div", {
|
|
166
168
|
className: "es:col-start-2 es:col-end-2 es:w-full",
|
|
167
169
|
children: children({
|
|
168
170
|
breakpoint: defaultBreakpoint,
|
|
@@ -178,7 +180,7 @@ var ResponsiveLegacy = (props) => {
|
|
|
178
180
|
className: "es:space-y-2",
|
|
179
181
|
children: breakpoints.map((breakpoint, index) => {
|
|
180
182
|
const isOverrideSet = getBreakpointValue(breakpoint) !== inheritValue;
|
|
181
|
-
const aboveOverride =
|
|
183
|
+
const aboveOverride = rawBreakpoints.slice(0, index + 1).reverse().find((candidateBreakpoint) => getBreakpointValue(candidateBreakpoint) !== inheritValue);
|
|
182
184
|
const belowOverride = rawBreakpoints.slice(index + 2).find((candidateBreakpoint) => getBreakpointValue(candidateBreakpoint) !== inheritValue);
|
|
183
185
|
return jsxs("div", {
|
|
184
186
|
className: clsx("es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
2
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
3
|
+
import { t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
|
|
4
|
+
import { t as ToggleButton } from "../../toggle-button-B2-f2rU6.js";
|
|
5
|
+
import { n as ButtonGroup, t as Button } from "../../button-C7mc6eS1.js";
|
|
6
6
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
|
-
import { f as upperFirst } from "../../es-dash-
|
|
7
|
+
import { f as upperFirst } from "../../es-dash-DPtJSRjw.js";
|
|
8
8
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
9
9
|
import { t as sprintf } from "../../sprintf-xJRAt4p0.js";
|
|
10
10
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
@@ -31,7 +31,7 @@ var getResponsiveLabel = (value, key, options) => {
|
|
|
31
31
|
if (!currentValue) return;
|
|
32
32
|
return options?.find((option) => option.value === currentValue)?.label ?? upperFirst(currentValue);
|
|
33
33
|
};
|
|
34
|
-
var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.startsWith("_") &&
|
|
34
|
+
var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.startsWith("_") && value[key] !== void 0);
|
|
35
35
|
/**
|
|
36
36
|
* A component that allows the user to set different values for different breakpoints.
|
|
37
37
|
*
|
|
@@ -76,7 +76,7 @@ var hasResponsiveOverrides = (value) => Object.keys(value).some((key) => !key.st
|
|
|
76
76
|
var Responsive = (props) => {
|
|
77
77
|
const { value = {}, onChange, icon, help, label, subtitle, options, breakpoints: rawBreakpoints, desktopFirstBreakpoints: rawDesktopFirstBreakpoints, breakpointData = {}, breakpointUiData, noModeSelect, inline, children, hidden, innerContentAlign = "start", useLegacyDesktopFirst, className } = props;
|
|
78
78
|
const [detailsVisible, setDetailsVisible] = useState(false);
|
|
79
|
-
if (
|
|
79
|
+
if (rawBreakpoints === void 0 || !Array.isArray(rawBreakpoints)) {
|
|
80
80
|
console.warn(__("Responsive: Missing or invalid 'breakpoints' prop.", "eightshift-ui-components"));
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
@@ -84,13 +84,13 @@ var Responsive = (props) => {
|
|
|
84
84
|
let desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
85
85
|
if (useLegacyDesktopFirst) desktopFirstBreakpoints = (rawDesktopFirstBreakpoints ?? rawBreakpoints.slice(0, -1)).map((breakpoint) => breakpoint.startsWith("max-") ? breakpoint : `max-${breakpoint}`);
|
|
86
86
|
const isDesktopFirst = value[desktopFirstKey] === true;
|
|
87
|
-
const firstMobileFirstOverride = breakpoints.find((breakpoint) =>
|
|
88
|
-
const lastDesktopFirstOverride = [...desktopFirstBreakpoints].reverse().find((breakpoint) =>
|
|
87
|
+
const firstMobileFirstOverride = breakpoints.find((breakpoint) => value[breakpoint] !== void 0);
|
|
88
|
+
const lastDesktopFirstOverride = [...desktopFirstBreakpoints].reverse().find((breakpoint) => value[breakpoint] !== void 0);
|
|
89
89
|
const breakpointsToMap = isDesktopFirst ? desktopFirstBreakpoints : breakpoints;
|
|
90
90
|
const responsiveOverridesApplied = hasResponsiveOverrides(value);
|
|
91
91
|
const getBreakpointWidth = (breakpoint) => breakpointData[breakpoint] ?? 0;
|
|
92
92
|
if (hidden) return null;
|
|
93
|
-
const
|
|
93
|
+
const renderDefaultTooltip = () => {
|
|
94
94
|
const defaultBreakpoint = isDesktopFirst ? rawBreakpoints[rawBreakpoints.length - 1] : rawBreakpoints[0];
|
|
95
95
|
const overrideIcon = defaultBreakpoint ? breakpointUiData?.[defaultBreakpoint]?.icon : void 0;
|
|
96
96
|
const fallbackBreakpoint = defaultBreakpoint ?? "desktop";
|
|
@@ -244,7 +244,7 @@ var Responsive = (props) => {
|
|
|
244
244
|
children: [
|
|
245
245
|
!isDesktopFirst && !inline ? jsxs("div", {
|
|
246
246
|
className: clsx("es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-end] es:duration-200", detailsVisible && "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch", detailsVisible ? "es:mb-0.5 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)]"),
|
|
247
|
-
children: [detailsVisible ?
|
|
247
|
+
children: [detailsVisible ? renderDefaultTooltip() : null, jsx("div", {
|
|
248
248
|
className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"),
|
|
249
249
|
children: children({
|
|
250
250
|
breakpoint: defaultKey,
|
|
@@ -261,7 +261,7 @@ var Responsive = (props) => {
|
|
|
261
261
|
!isDesktopFirst && inline ? jsxs(AnimatedVisibility, {
|
|
262
262
|
className: clsx("es:mb-0.5 es:grid es:grid-cols-[minmax(0,1.75rem)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
263
263
|
visible: detailsVisible,
|
|
264
|
-
children: [
|
|
264
|
+
children: [renderDefaultTooltip(), jsx("div", {
|
|
265
265
|
className: "es:col-start-2 es:col-end-2 es:w-full",
|
|
266
266
|
children: children({
|
|
267
267
|
breakpoint: defaultKey,
|
|
@@ -282,8 +282,8 @@ var Responsive = (props) => {
|
|
|
282
282
|
children: breakpointsToMap.map((breakpoint, index) => {
|
|
283
283
|
const realBreakpointName = breakpoint.replace("max-", "");
|
|
284
284
|
const filterBreakpoints = isDesktopFirst ? [...breakpointsToMap, defaultKey] : [defaultKey, ...breakpointsToMap];
|
|
285
|
-
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(index + 1).find((currentBreakpoint) =>
|
|
286
|
-
const belowOverride = isDesktopFirst ?
|
|
285
|
+
const aboveOverride = isDesktopFirst ? filterBreakpoints.slice(index + 1).find((currentBreakpoint) => value[currentBreakpoint] !== void 0) : filterBreakpoints.slice(0, index + 1).reverse().find((currentBreakpoint) => value[currentBreakpoint] !== void 0);
|
|
286
|
+
const belowOverride = isDesktopFirst ? filterBreakpoints.slice(0, index).reverse().find((currentBreakpoint) => value[currentBreakpoint] !== void 0) : filterBreakpoints.slice(index + 2).find((currentBreakpoint) => value[currentBreakpoint] !== void 0);
|
|
287
287
|
return jsxs("div", {
|
|
288
288
|
className: clsx("es:grid es:grid-cols-[minmax(0,auto)_minmax(0,1fr)_minmax(0,2.25rem)] es:items-center es:gap-x-2", "es:bg-white/50 es:p-1.5 es:rounded-sm es:inset-ring es:inset-ring-surface-200/60", !isDesktopFirst && "es:last:rounded-b-2xl", isDesktopFirst && "es:first:rounded-t-2xl", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
289
289
|
children: [
|
|
@@ -301,31 +301,31 @@ var Responsive = (props) => {
|
|
|
301
301
|
jsx("span", {
|
|
302
302
|
className: "es:block es:text-balance es:tabular-nums es:font-variation-[\"wdth\"_64,\"wght\"_275,\"ROND\"_50,\"slnt\"_-2] es:text-surface-500 es:mt-1",
|
|
303
303
|
children: !isDesktopFirst ? jsxs(Fragment$1, { children: [
|
|
304
|
-
!belowOverride &&
|
|
305
|
-
belowOverride &&
|
|
306
|
-
|
|
304
|
+
!belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is %dpx or more.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName)) : null,
|
|
305
|
+
belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName), getBreakpointWidth(belowOverride) - 1) : null,
|
|
306
|
+
value[breakpoint] === void 0 ? sprintf(__("From %dpx", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName)) : null
|
|
307
307
|
] }) : jsxs(Fragment$1, { children: [
|
|
308
|
-
!belowOverride &&
|
|
309
|
-
belowOverride &&
|
|
310
|
-
|
|
308
|
+
!belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is %dpx or less.", "eightshift-ui-components"), getBreakpointWidth(realBreakpointName) - 1) : null,
|
|
309
|
+
belowOverride && value[breakpoint] !== void 0 ? sprintf(__("Applied when the browser width is between %dpx and %dpx.", "eightshift-ui-components"), getBreakpointWidth(belowOverride.replace("max-", "")), getBreakpointWidth(realBreakpointName) - 1) : null,
|
|
310
|
+
value[breakpoint] === void 0 ? sprintf(__("Up to %dpx", "eightshift-ui-components"), getBreakpointWidth(breakpoint.replace("max-", ""))) : null
|
|
311
311
|
] })
|
|
312
312
|
}),
|
|
313
|
-
|
|
313
|
+
value[breakpoint] === void 0 ? jsx("span", {
|
|
314
314
|
className: "es:mt-2 es:text-sm es:leading-none es:block es:font-variation-[\"wdth\"_75,\"wght\"_300,\"slnt\"_-5]",
|
|
315
315
|
children: __("Not set", "eightshift-ui-components")
|
|
316
316
|
}) : null,
|
|
317
|
-
|
|
317
|
+
value[breakpoint] !== void 0 ? jsx("div", {
|
|
318
318
|
className: "es:mx-auto es:mt-5",
|
|
319
319
|
children: !isDesktopFirst ? jsx(BreakpointPreview, {
|
|
320
320
|
dotsStart: Boolean(belowOverride),
|
|
321
321
|
blocks: [
|
|
322
|
-
aboveOverride && aboveOverride !== defaultKey &&
|
|
322
|
+
aboveOverride && aboveOverride !== defaultKey && value[aboveOverride] !== void 0 ? {
|
|
323
323
|
breakpoint: breakpointUiData?.[aboveOverride]?.label ?? aboveOverride,
|
|
324
324
|
value: getResponsiveLabel(value, aboveOverride, options),
|
|
325
325
|
dotsStart: !belowOverride,
|
|
326
326
|
alignEnd: !belowOverride
|
|
327
327
|
} : null,
|
|
328
|
-
aboveOverride === defaultKey &&
|
|
328
|
+
aboveOverride === defaultKey && value[defaultKey] !== void 0 ? {
|
|
329
329
|
breakpoint: __("Default", "eightshift-ui-components"),
|
|
330
330
|
value: getResponsiveLabel(value, defaultKey, options),
|
|
331
331
|
dotsStart: !belowOverride,
|
|
@@ -338,7 +338,7 @@ var Responsive = (props) => {
|
|
|
338
338
|
active: true,
|
|
339
339
|
dotsEnd: !belowOverride
|
|
340
340
|
},
|
|
341
|
-
belowOverride &&
|
|
341
|
+
belowOverride && value[belowOverride] !== void 0 ? {
|
|
342
342
|
breakpoint: breakpointUiData?.[belowOverride]?.label ?? belowOverride,
|
|
343
343
|
value: getResponsiveLabel(value, belowOverride, options),
|
|
344
344
|
width: String(getBreakpointWidth(belowOverride)),
|
|
@@ -375,7 +375,7 @@ var Responsive = (props) => {
|
|
|
375
375
|
}) : null
|
|
376
376
|
] }),
|
|
377
377
|
children: jsx("div", {
|
|
378
|
-
className: clsx("es:transition-colors es:icon:size-6 es:mx-0.5",
|
|
378
|
+
className: clsx("es:transition-colors es:icon:size-6 es:mx-0.5", value[breakpoint] !== void 0 ? "es:text-surface-600" : "es:text-surface-300"),
|
|
379
379
|
children: jsx(Icon, {
|
|
380
380
|
icon: breakpointUiData?.[realBreakpointName]?.icon,
|
|
381
381
|
fallback: jsx(Icon, { icon: `screen${upperFirst(realBreakpointName)}` })
|
|
@@ -401,7 +401,7 @@ var Responsive = (props) => {
|
|
|
401
401
|
onChange(newValue);
|
|
402
402
|
},
|
|
403
403
|
icon: clearAlt,
|
|
404
|
-
disabled:
|
|
404
|
+
disabled: value[breakpoint] === void 0,
|
|
405
405
|
type: "ghost"
|
|
406
406
|
})
|
|
407
407
|
]
|
|
@@ -410,7 +410,7 @@ var Responsive = (props) => {
|
|
|
410
410
|
}),
|
|
411
411
|
isDesktopFirst && !inline ? jsxs("div", {
|
|
412
412
|
className: clsx("es:grid es:items-center es:gap-x-2 es:transition-[grid-template-columns,margin-block-start] es:duration-150", detailsVisible && "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25 es:transition-plus", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch", detailsVisible ? "es:mt-0.5 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)]"),
|
|
413
|
-
children: [detailsVisible ?
|
|
413
|
+
children: [detailsVisible ? renderDefaultTooltip() : null, jsx("div", {
|
|
414
414
|
className: clsx("es:w-full", detailsVisible ? "es:col-start-2 es:col-end-2" : "es:col-span-full"),
|
|
415
415
|
children: children({
|
|
416
416
|
breakpoint: defaultKey,
|
|
@@ -427,7 +427,7 @@ var Responsive = (props) => {
|
|
|
427
427
|
isDesktopFirst && inline ? jsxs(AnimatedVisibility, {
|
|
428
428
|
className: clsx("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", "es:bg-white/50 es:p-1.5 es:rounded-sm es:first:rounded-t-2xl es:last:rounded-b-2xl es:inset-ring es:inset-ring-accent-600/25", innerContentAlign === "start" && "es:justify-items-start", innerContentAlign === "center" && "es:justify-items-center", innerContentAlign === "end" && "es:justify-items-end", innerContentAlign === "stretch" && "es:justify-items-stretch"),
|
|
429
429
|
visible: detailsVisible,
|
|
430
|
-
children: [
|
|
430
|
+
children: [renderDefaultTooltip(), jsx("div", {
|
|
431
431
|
className: "es:col-start-2 es:col-end-2",
|
|
432
432
|
children: children({
|
|
433
433
|
breakpoint: defaultKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
2
|
-
import { f as upperFirst } from "../../es-dash-
|
|
2
|
+
import { f as upperFirst } from "../../es-dash-DPtJSRjw.js";
|
|
3
3
|
import { BreakpointPreview } from "../breakpoint-preview/breakpoint-preview.js";
|
|
4
4
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
5
5
|
import { previewResponsive } from "../../icons/ui-icons/preview-responsive.js";
|
|
@@ -40,7 +40,7 @@ var ResponsivePreview = (props) => {
|
|
|
40
40
|
value: options?.find((opt) => opt.value === value?.[defaultKey])?.label ?? upperFirst(value?.[defaultKey])
|
|
41
41
|
}];
|
|
42
42
|
breakpoints.forEach((breakpoint) => {
|
|
43
|
-
if (
|
|
43
|
+
if (value?.[breakpoint] === void 0) return;
|
|
44
44
|
previewItems = [...previewItems, {
|
|
45
45
|
width: String(breakpointData[breakpoint]),
|
|
46
46
|
breakpoint: breakpointUiData?.[breakpoint]?.label ?? breakpoint,
|
|
@@ -50,7 +50,7 @@ var ResponsivePreview = (props) => {
|
|
|
50
50
|
}
|
|
51
51
|
if (lastDesktopFirstOverride && isDesktopFirst) {
|
|
52
52
|
desktopFirstBreakpoints.forEach((breakpoint) => {
|
|
53
|
-
if (
|
|
53
|
+
if (value?.[breakpoint] === void 0) return;
|
|
54
54
|
const normalizedBreakpoint = breakpoint.replace("max-", "");
|
|
55
55
|
previewItems = [...previewItems, {
|
|
56
56
|
alignEnd: true,
|
|
@@ -4,24 +4,23 @@ import { type Primitive } from './shared';
|
|
|
4
4
|
import type { Prettify } from '../../utilities/types';
|
|
5
5
|
type IconValue = string | JSX.Element | null;
|
|
6
6
|
type SelectSize = 'small' | 'medium' | 'default' | 'large';
|
|
7
|
-
|
|
7
|
+
interface RawAsyncItem {
|
|
8
|
+
toString(): string;
|
|
9
|
+
}
|
|
10
|
+
type AsyncFetchedData = RawAsyncItem[] | {
|
|
11
|
+
jokes?: RawAsyncItem[];
|
|
12
|
+
};
|
|
8
13
|
type AsyncMultiSelectOption = {
|
|
9
14
|
label: string;
|
|
10
15
|
value: Primitive;
|
|
11
|
-
metadata?:
|
|
12
|
-
meta?:
|
|
16
|
+
metadata?: RawAsyncItem | null;
|
|
17
|
+
meta?: RawAsyncItem | null;
|
|
13
18
|
subtitle?: string;
|
|
14
19
|
icon?: IconValue;
|
|
15
20
|
className?: string;
|
|
16
|
-
[key: string]: unknown;
|
|
17
21
|
};
|
|
18
22
|
type AsyncMultiSelectValue = AsyncMultiSelectOption[] | Primitive[] | '' | null;
|
|
19
|
-
type GroupValueMapping =
|
|
20
|
-
label?: ReactNode;
|
|
21
|
-
icon?: IconValue;
|
|
22
|
-
subtitle?: ReactNode;
|
|
23
|
-
endIcon?: IconValue;
|
|
24
|
-
}>;
|
|
23
|
+
type GroupValueMapping = object;
|
|
25
24
|
type AsyncMultiSelectProps = Omit<ReactAriaSelectProps<AsyncMultiSelectOption, 'multiple'>, 'children' | 'className' | 'isDisabled' | 'items' | 'placeholder' | 'selectionMode' | 'value' | 'onChange'> & {
|
|
26
25
|
/** Label of the component. */
|
|
27
26
|
label?: ReactNode;
|
|
@@ -50,7 +49,7 @@ type AsyncMultiSelectProps = Omit<ReactAriaSelectProps<AsyncMultiSelectOption, '
|
|
|
50
49
|
/** Function to get the value for the item from the fetched data. `(item) => string | number | boolean`. Defaults to reading `item.value`. */
|
|
51
50
|
getValue?: (item: RawAsyncItem) => Primitive | undefined;
|
|
52
51
|
/** Function to get the metadata for the item from the fetched data. `(item) => object` (optional). */
|
|
53
|
-
getMeta?: (item: RawAsyncItem) =>
|
|
52
|
+
getMeta?: (item: RawAsyncItem) => RawAsyncItem | null | undefined;
|
|
54
53
|
/** Function to get the icon for the item from the fetched data. `(item) => JSX.Element | string`. */
|
|
55
54
|
getIcon?: (item: RawAsyncItem | AsyncMultiSelectOption) => IconValue;
|
|
56
55
|
/** Function to get the subtitle for the item from the fetched data. `(item) => string`. */
|
|
@@ -58,13 +57,13 @@ type AsyncMultiSelectProps = Omit<ReactAriaSelectProps<AsyncMultiSelectOption, '
|
|
|
58
57
|
/** Function to get the group name for the item from the fetched data. `(item) => string`. */
|
|
59
58
|
getGroup?: (item: RawAsyncItem) => string | undefined;
|
|
60
59
|
/** Function to pre-process the fetched data before it is used in the select. `(data) => data[]`. Defaults to a passthrough. */
|
|
61
|
-
getData?: (data:
|
|
60
|
+
getData?: (data: AsyncFetchedData) => RawAsyncItem[];
|
|
62
61
|
/** Function to get the URL for fetching data. Provides typed search text if entered. `(searchText) => string`. */
|
|
63
62
|
fetchUrl?: (searchText?: string) => string;
|
|
64
63
|
/** Configuration object for the fetch request, passed to the `fetch` function. Defaults to `{}`. */
|
|
65
64
|
fetchConfig?: RequestInit;
|
|
66
65
|
/** Allows overriding the default fetch function. `(searchText, signal) => Promise`. */
|
|
67
|
-
fetchFunction?: (searchText: string | undefined, signal: AbortSignal) => Promise<
|
|
66
|
+
fetchFunction?: (searchText: string | undefined, signal: AbortSignal) => Promise<AsyncFetchedData>;
|
|
68
67
|
/** Allows processing the options fetched from the source. `(options) => options[]`. Defaults to a passthrough. */
|
|
69
68
|
processLoadedOptions?: (options: RawAsyncItem[]) => RawAsyncItem[];
|
|
70
69
|
/** If provided, replaces the default item in the dropdown menu. `({ value, label, subtitle, metadata }) => JSX.Element`. */
|