@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,15 +1,18 @@
|
|
|
1
|
-
import { n as AnimatePresence, t as motion } from "../../react-y40Dt3ab.js";
|
|
2
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
3
|
-
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-
|
|
4
|
-
import { i as $806e559d0c2c64a0$export$472062a354075cee, o as $806e559d0c2c64a0$export$a590f758a961cb5b, r as $806e559d0c2c64a0$export$2c1b491743890dec, t as $806e559d0c2c64a0$export$105594979f116971 } from "../../Slider-
|
|
5
|
-
import { t as NumberPicker } from "../../number-picker-
|
|
2
|
+
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
|
|
3
|
+
import { i as $806e559d0c2c64a0$export$472062a354075cee, o as $806e559d0c2c64a0$export$a590f758a961cb5b, r as $806e559d0c2c64a0$export$2c1b491743890dec, t as $806e559d0c2c64a0$export$105594979f116971 } from "../../Slider-BXc72kE0.js";
|
|
4
|
+
import { t as NumberPicker } from "../../number-picker-CK_OHBXw.js";
|
|
6
5
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
6
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
8
7
|
import { HStack } from "../layout/hstack.js";
|
|
8
|
+
import { n as AnimatePresence, t as motion } from "../../react-C6Y6cCOx.js";
|
|
9
9
|
import { generateGridTemplate, generateMarkers } from "./utils.js";
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
//#region lib/components/slider/slider.tsx
|
|
13
|
+
var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
|
|
14
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
15
|
+
var isMarkerMap = (markers) => markers !== true && markers !== "dots" && markers !== "lines";
|
|
13
16
|
/**
|
|
14
17
|
* A single/multi-thumb slider component.
|
|
15
18
|
*
|
|
@@ -32,13 +35,13 @@ var Slider = (props) => {
|
|
|
32
35
|
let startPoint = rawStartPoint ?? null;
|
|
33
36
|
if (Array.isArray(value) && rawStartPoint) startPoint = null;
|
|
34
37
|
let generatedMarkers = {};
|
|
35
|
-
if (markers &&
|
|
38
|
+
if (markers && isMarkerMap(markers) && Object.keys(markers).length > 0) generatedMarkers = markers;
|
|
36
39
|
if (markers === true || markers === "dots") generatedMarkers = generateMarkers(min, max, markerStep);
|
|
37
40
|
const markerEntries = Object.entries(generatedMarkers);
|
|
38
41
|
markerEntries.sort((firstEntry, secondEntry) => parseFloat(firstEntry[0]) - parseFloat(secondEntry[0]));
|
|
39
42
|
const markerData = vertical ? [...markerEntries].reverse() : markerEntries;
|
|
40
43
|
const isRange = Array.isArray(value);
|
|
41
|
-
const singleValue =
|
|
44
|
+
const singleValue = isNumberValue(value) ? value : value[0] ?? min;
|
|
42
45
|
return jsx($806e559d0c2c64a0$export$472062a354075cee, {
|
|
43
46
|
value,
|
|
44
47
|
onChange,
|
|
@@ -62,7 +65,7 @@ var Slider = (props) => {
|
|
|
62
65
|
children: ({ state }) => state.values.map((_, index) => state.getThumbValueLabel(index)).join(" – ")
|
|
63
66
|
}) : null,
|
|
64
67
|
inputField && !isRange ? jsx(NumberPicker, {
|
|
65
|
-
"aria-label":
|
|
68
|
+
"aria-label": isStringValue(label) ? label : __("Slider value", "eightshift-ui-components"),
|
|
66
69
|
value: singleValue,
|
|
67
70
|
onChange: (nextValue) => onChange(nextValue),
|
|
68
71
|
min,
|
|
@@ -80,7 +83,7 @@ var Slider = (props) => {
|
|
|
80
83
|
jsx($806e559d0c2c64a0$export$105594979f116971, {
|
|
81
84
|
className: clsx("es:isolate", vertical && "es:mx-auto es:h-48", !vertical && "es:grow"),
|
|
82
85
|
children: ({ state }) => {
|
|
83
|
-
const stateValues = state.values.filter(
|
|
86
|
+
const stateValues = state.values.filter(isNumberValue);
|
|
84
87
|
const firstStateValue = stateValues[0] ?? min;
|
|
85
88
|
const lastStateValue = stateValues.at(-1) ?? firstStateValue;
|
|
86
89
|
let gridTemplate = generateGridTemplate(stateValues.map((_, index) => Math.round(state.getThumbPercent(index) * 100)), startPoint, { spaceBetween: 3 });
|
|
@@ -114,9 +117,10 @@ var Slider = (props) => {
|
|
|
114
117
|
const dotValue = parseFloat(rawDotValue);
|
|
115
118
|
let isWithinActiveBar = false;
|
|
116
119
|
if (isRange) isWithinActiveBar = dotValue > firstStateValue && dotValue < lastStateValue;
|
|
117
|
-
else if (startPoint !== null)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
else if (startPoint !== null) {
|
|
121
|
+
if (firstStateValue < startPoint) isWithinActiveBar = dotValue > firstStateValue && dotValue <= startPoint;
|
|
122
|
+
else isWithinActiveBar = dotValue >= startPoint && dotValue < firstStateValue;
|
|
123
|
+
} else isWithinActiveBar = dotValue < firstStateValue;
|
|
120
124
|
return jsx("div", {
|
|
121
125
|
className: clsx("es:relative", "es:size-0.75 es:place-self-center es:rounded-2xl", !disabled && isWithinActiveBar && "es:bg-accent-50", !disabled && !isWithinActiveBar && "es:bg-surface-500", disabled && isWithinActiveBar && "es:bg-secondary-300", disabled && !isWithinActiveBar && "es:bg-secondary-400", stateValues.includes(dotValue) && "es:opacity-0"),
|
|
122
126
|
children: jsx("span", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { t as DecorativeTooltip } from "../../tooltip-
|
|
2
|
+
import { t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
|
|
3
3
|
import { cyrb64Hash } from "../../utilities/hash.js";
|
|
4
4
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
5
5
|
import { imageError } from "../../icons/ui-icons/image-error.js";
|
|
@@ -34,10 +34,8 @@ var parseCachedAnalysis = (value) => {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
return String(error);
|
|
40
|
-
};
|
|
37
|
+
var isClassNameResolver = (value) => value instanceof Function;
|
|
38
|
+
var isChildrenRenderer = (value) => value instanceof Function;
|
|
41
39
|
var loadHtmlImage = async (src) => {
|
|
42
40
|
const image = new Image();
|
|
43
41
|
image.src = src;
|
|
@@ -79,7 +77,7 @@ var SmartImage = (props) => {
|
|
|
79
77
|
const workerRef = useRef(null);
|
|
80
78
|
const lastAnalysisNotificationKeyRef = useRef(null);
|
|
81
79
|
useEffect(() => {
|
|
82
|
-
workerRef.current = new Worker(new URL("" + new URL("../../assets/image-analysis-worker-
|
|
80
|
+
workerRef.current = new Worker(new URL("" + new URL("../../assets/image-analysis-worker-CBOB71mx.js", import.meta.url).href + "", "" + import.meta.url), { type: "module" });
|
|
83
81
|
return () => {
|
|
84
82
|
workerRef.current?.terminate();
|
|
85
83
|
};
|
|
@@ -101,16 +99,11 @@ var SmartImage = (props) => {
|
|
|
101
99
|
lastAnalysisNotificationKeyRef.current = notificationKey;
|
|
102
100
|
onAnalysisComplete(result, { source });
|
|
103
101
|
};
|
|
104
|
-
if (!src) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
abortController.abort();
|
|
109
|
-
};
|
|
110
|
-
}
|
|
102
|
+
if (!src) return () => {
|
|
103
|
+
isActive = false;
|
|
104
|
+
abortController.abort();
|
|
105
|
+
};
|
|
111
106
|
if (analysisData) {
|
|
112
|
-
setAnalysis(analysisData);
|
|
113
|
-
setObjectUrl(src);
|
|
114
107
|
notifyAnalysisComplete(analysisData, "analysisData");
|
|
115
108
|
return () => {
|
|
116
109
|
isActive = false;
|
|
@@ -119,11 +112,12 @@ var SmartImage = (props) => {
|
|
|
119
112
|
}
|
|
120
113
|
const cacheKey = `es-uic-img-data-${cyrb64Hash(src)}`;
|
|
121
114
|
const cachedAnalysis = parseCachedAnalysis(localStorage?.getItem(cacheKey) ?? null);
|
|
122
|
-
if (cachedAnalysis) {
|
|
115
|
+
if (cachedAnalysis) queueMicrotask(() => {
|
|
116
|
+
if (!isActive) return;
|
|
123
117
|
setAnalysis(cachedAnalysis);
|
|
124
118
|
setObjectUrl(src);
|
|
125
119
|
notifyAnalysisComplete(cachedAnalysis, "cache");
|
|
126
|
-
}
|
|
120
|
+
});
|
|
127
121
|
if (!cachedAnalysis) {
|
|
128
122
|
const processImage = async () => {
|
|
129
123
|
let nextObjectUrl = null;
|
|
@@ -159,8 +153,8 @@ var SmartImage = (props) => {
|
|
|
159
153
|
}
|
|
160
154
|
let buffer;
|
|
161
155
|
let transferBuffer = null;
|
|
162
|
-
if (
|
|
163
|
-
const context = new OffscreenCanvas(width, height).getContext("2d", { willReadFrequently: true });
|
|
156
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
157
|
+
const context = new globalThis.OffscreenCanvas(width, height).getContext("2d", { willReadFrequently: true });
|
|
164
158
|
if (!context) throw new Error("Could not create image analysis canvas context.");
|
|
165
159
|
context.clearRect(0, 0, width, height);
|
|
166
160
|
context.drawImage(imageSource, 0, 0, width, height);
|
|
@@ -177,7 +171,7 @@ var SmartImage = (props) => {
|
|
|
177
171
|
buffer = context.getImageData(0, 0, width, height).data;
|
|
178
172
|
transferBuffer = buffer.buffer instanceof ArrayBuffer ? buffer.buffer : null;
|
|
179
173
|
}
|
|
180
|
-
if (
|
|
174
|
+
if (imageSource instanceof ImageBitmap) imageSource.close();
|
|
181
175
|
if (workerRef.current) {
|
|
182
176
|
workerRef.current.onmessage = (event) => {
|
|
183
177
|
if (!isActive) return;
|
|
@@ -203,7 +197,9 @@ var SmartImage = (props) => {
|
|
|
203
197
|
if (isActive) {
|
|
204
198
|
if (verbose) console.error("[SmartImage] Error:", caughtError);
|
|
205
199
|
const exists = await urlExists(src);
|
|
206
|
-
|
|
200
|
+
let errorMessage = "failedToFetch";
|
|
201
|
+
if (exists) errorMessage = caughtError instanceof Error ? caughtError.message : String(caughtError);
|
|
202
|
+
setError(errorMessage);
|
|
207
203
|
setObjectUrl(null);
|
|
208
204
|
}
|
|
209
205
|
}
|
|
@@ -223,8 +219,11 @@ var SmartImage = (props) => {
|
|
|
223
219
|
src,
|
|
224
220
|
verbose
|
|
225
221
|
]);
|
|
226
|
-
const
|
|
227
|
-
|
|
222
|
+
const activeAnalysis = analysisData ?? analysis;
|
|
223
|
+
let activeObjectUrl = src ? objectUrl : null;
|
|
224
|
+
if (analysisData) activeObjectUrl = src ?? null;
|
|
225
|
+
const hasAnalysed = Boolean(activeAnalysis) && Boolean(activeObjectUrl);
|
|
226
|
+
const { dominantColors, isDark, isTransparent, transparencyInfo, averageColor } = activeAnalysis ?? {};
|
|
228
227
|
const classFetchProps = {
|
|
229
228
|
isLoaded: true,
|
|
230
229
|
dominantColors,
|
|
@@ -238,7 +237,7 @@ var SmartImage = (props) => {
|
|
|
238
237
|
if (hidden) return null;
|
|
239
238
|
const colorfulDominantColor = dominantColors?.find((color) => (color.saturation ?? 0) > .25 && (color.area ?? 0) >= .1) || dominantColors?.[0];
|
|
240
239
|
const imageStyle = {
|
|
241
|
-
...imageProps.style
|
|
240
|
+
...imageProps.style,
|
|
242
241
|
"--es-img-dominant-color": dominantColors?.[0]?.color ?? "",
|
|
243
242
|
"--es-img-colorful-dominant-color": colorfulDominantColor?.color ?? "",
|
|
244
243
|
"--es-img-average-color": averageColor?.color ?? ""
|
|
@@ -246,38 +245,41 @@ var SmartImage = (props) => {
|
|
|
246
245
|
const imageElement = jsx("img", {
|
|
247
246
|
decoding: "async",
|
|
248
247
|
...imageProps,
|
|
249
|
-
src:
|
|
248
|
+
src: activeAnalysis && activeObjectUrl && !error ? activeObjectUrl : imageProps.src,
|
|
250
249
|
style: imageStyle,
|
|
251
|
-
className: clsx("es:transition-opacity", !hasAnalysed && !error && processingClassName,
|
|
250
|
+
className: clsx("es:transition-opacity", !hasAnalysed && !error && processingClassName, isClassNameResolver(className) ? className(classFetchProps) : className),
|
|
252
251
|
"data-is-transparent": isTransparent,
|
|
253
252
|
"data-is-dark": isDark
|
|
254
253
|
});
|
|
255
254
|
if (error && renderError) return renderError(error);
|
|
256
|
-
if (error === "failedToFetch")
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
children:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
children:
|
|
255
|
+
if (error === "failedToFetch") {
|
|
256
|
+
const hasCustomErrorRenderer = isChildrenRenderer(children);
|
|
257
|
+
return jsxs("div", {
|
|
258
|
+
className: clsx(!hasCustomErrorRenderer && "es:flex es:flex-col es:gap-2 es:items-center-safe es:justify-center es:p-2", "es:motion-preset-fade", errorClassName),
|
|
259
|
+
children: [!hasCustomErrorRenderer && jsx(DecorativeTooltip, {
|
|
260
|
+
text: __("Error loading image", "eightshift-ui-components"),
|
|
261
|
+
children: cloneElement(imageError, { className: "es:text-surface-600 es:size-8" })
|
|
262
|
+
}), hasCustomErrorRenderer ? children({
|
|
263
|
+
image: imageElement,
|
|
264
|
+
hasAnalysed,
|
|
265
|
+
isLoaded: true,
|
|
266
|
+
dominantColors: void 0,
|
|
267
|
+
isDark: void 0,
|
|
268
|
+
isTransparent: false,
|
|
269
|
+
transparencyInfo: void 0,
|
|
270
|
+
averageColor: null,
|
|
271
|
+
hasError: true,
|
|
272
|
+
errorBadge: jsx("div", {
|
|
273
|
+
className: "es:size-full es:flex es:items-center es:justify-center",
|
|
274
|
+
children: jsx(DecorativeTooltip, {
|
|
275
|
+
text: __("Error loading image", "eightshift-ui-components"),
|
|
276
|
+
children: cloneElement(imageError, { className: "es:text-surface-600 es:size-8" })
|
|
277
|
+
})
|
|
276
278
|
})
|
|
277
|
-
})
|
|
278
|
-
})
|
|
279
|
-
}
|
|
280
|
-
return children
|
|
279
|
+
}) : imageElement]
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return isChildrenRenderer(children) ? children({
|
|
281
283
|
image: imageElement,
|
|
282
284
|
...classFetchProps
|
|
283
285
|
}) : imageElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as Tabs, n as TabList, r as TabPanel, t as Tab } from "../../tabs-
|
|
1
|
+
import { i as Tabs, n as TabList, r as TabPanel, t as Tab } from "../../tabs-DgkJUkIX.js";
|
|
2
2
|
export { Tab, TabList, TabPanel, Tabs };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Switch } from "../../switch-
|
|
1
|
+
import { t as Switch } from "../../switch-B87lQ1V0.js";
|
|
2
2
|
export { Switch };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-
|
|
3
|
-
import { t as Switch } from "../../switch-
|
|
2
|
+
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
|
|
3
|
+
import { t as Switch } from "../../switch-B87lQ1V0.js";
|
|
4
4
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ToggleButton } from "../../toggle-button-
|
|
1
|
+
import { t as ToggleButton } from "../../toggle-button-B2-f2rU6.js";
|
|
2
2
|
export { ToggleButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Tooltip, t as DecorativeTooltip } from "../../tooltip-
|
|
1
|
+
import { n as Tooltip, t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
|
|
2
2
|
export { DecorativeTooltip, Tooltip };
|