@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.
Files changed (150) hide show
  1. package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
  2. package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
  3. package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
  4. package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
  5. package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
  6. package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
  7. package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
  8. package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
  9. package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
  10. package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
  11. package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
  12. package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
  13. package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
  14. package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
  15. package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
  16. package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
  17. package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
  18. package/dist/assets/style-admin.css +1 -1
  19. package/dist/assets/style-editor.css +1 -1
  20. package/dist/assets/style.css +1 -1
  21. package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
  22. package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
  23. package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
  24. package/dist/components/animated-visibility/animated-visibility.js +5 -3
  25. package/dist/components/base-control/base-control.js +1 -1
  26. package/dist/components/base-control/container.d.ts +4 -30
  27. package/dist/components/base-control/container.js +5 -32
  28. package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
  29. package/dist/components/button/button.js +1 -1
  30. package/dist/components/checkbox/checkbox.js +1 -1
  31. package/dist/components/color-pickers/color-picker.js +7 -7
  32. package/dist/components/color-pickers/color-swatch.js +1 -1
  33. package/dist/components/color-pickers/gradient-editor.js +1 -1
  34. package/dist/components/color-pickers/solid-color-picker.js +1 -1
  35. package/dist/components/component-toggle/component-toggle.js +3 -3
  36. package/dist/components/container-panel/container-panel.js +11 -11
  37. package/dist/components/contextual-help/contextual-help.js +2 -2
  38. package/dist/components/draggable/draggable.d.ts +3 -3
  39. package/dist/components/draggable/draggable.js +1 -1
  40. package/dist/components/draggable-list/draggable-list.d.ts +3 -3
  41. package/dist/components/draggable-list/draggable-list.js +8 -8
  42. package/dist/components/expandable/expandable.js +3 -3
  43. package/dist/components/index.js +16 -16
  44. package/dist/components/input-field/input-field.js +1 -1
  45. package/dist/components/item-collection/item-collection.d.ts +3 -28
  46. package/dist/components/item-collection/item-collection.js +6 -6
  47. package/dist/components/link-input/link-input.d.ts +0 -2
  48. package/dist/components/link-input/link-input.js +1 -1
  49. package/dist/components/matrix-align/matrix-align.js +4 -3
  50. package/dist/components/menu/menu.js +10 -7
  51. package/dist/components/modal/modal.js +1 -1
  52. package/dist/components/notice/notice.js +8 -8
  53. package/dist/components/number-picker/number-picker.js +1 -1
  54. package/dist/components/option-select/option-select.d.ts +1 -1
  55. package/dist/components/option-select/option-select.js +21 -15
  56. package/dist/components/options-panel/options-panel.js +4 -4
  57. package/dist/components/placeholders/file-picker-shell.js +4 -3
  58. package/dist/components/placeholders/file-placeholder.js +2 -1
  59. package/dist/components/popover/popover.js +3 -3
  60. package/dist/components/portal-provider/portal-provider.js +2 -1
  61. package/dist/components/radio/radio.js +2 -2
  62. package/dist/components/repeater/repeater-context.d.ts +0 -1
  63. package/dist/components/repeater/repeater-item.js +1 -1
  64. package/dist/components/repeater/repeater.d.ts +5 -38
  65. package/dist/components/repeater/repeater.js +7 -10
  66. package/dist/components/responsive/mini-responsive.d.ts +0 -1
  67. package/dist/components/responsive/mini-responsive.js +30 -30
  68. package/dist/components/responsive/responsive-legacy.d.ts +0 -1
  69. package/dist/components/responsive/responsive-legacy.js +12 -10
  70. package/dist/components/responsive/responsive.d.ts +0 -1
  71. package/dist/components/responsive/responsive.js +28 -28
  72. package/dist/components/responsive-preview/responsive-preview.js +3 -3
  73. package/dist/components/select/async-multi-select.d.ts +12 -13
  74. package/dist/components/select/async-multi-select.js +39 -20
  75. package/dist/components/select/async-select.d.ts +12 -13
  76. package/dist/components/select/async-select.js +38 -20
  77. package/dist/components/select/multi-select.d.ts +2 -8
  78. package/dist/components/select/multi-select.js +19 -19
  79. package/dist/components/select/shared.d.ts +5 -9
  80. package/dist/components/select/shared.js +2 -2
  81. package/dist/components/select/single-select.d.ts +2 -8
  82. package/dist/components/select/single-select.js +16 -16
  83. package/dist/components/slider/column-config-slider.js +7 -5
  84. package/dist/components/slider/slider.js +15 -11
  85. package/dist/components/smart-image/smart-image.d.ts +0 -1
  86. package/dist/components/smart-image/smart-image.js +52 -50
  87. package/dist/components/tabs/tabs.js +1 -1
  88. package/dist/components/toggle/switch.js +1 -1
  89. package/dist/components/toggle/toggle.js +2 -2
  90. package/dist/components/toggle-button/toggle-button.js +1 -1
  91. package/dist/components/tooltip/tooltip.js +1 -1
  92. package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
  93. package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
  94. package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
  95. package/dist/icons/block-icon.js +1 -1
  96. package/dist/icons/icon.d.ts +3 -3
  97. package/dist/icons/icon.js +21 -9
  98. package/dist/icons/icons.d.ts +210 -1
  99. package/dist/icons/index.js +1 -1
  100. package/dist/icons/jsx-svg.d.ts +5 -4
  101. package/dist/icons/jsx-svg.js +1 -1
  102. package/dist/index.js +16 -16
  103. package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
  104. package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
  105. package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
  106. package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
  107. package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
  108. package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
  109. package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
  110. package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
  111. package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
  112. package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
  113. package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
  114. package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
  115. package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
  116. package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
  117. package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
  118. package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
  119. package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
  120. package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
  121. package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
  122. package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
  123. package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
  124. package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
  125. package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
  126. package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
  127. package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
  128. package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
  129. package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
  130. package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
  131. package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
  132. package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
  133. package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
  134. package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
  135. package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
  136. package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
  137. package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
  138. package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
  139. package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
  140. package/dist/utilities/array-helpers.d.ts +1 -1
  141. package/dist/utilities/array-helpers.js +4 -3
  142. package/dist/utilities/debounce-throttle.d.ts +9 -2
  143. package/dist/utilities/es-dash.d.ts +11 -8
  144. package/dist/utilities/es-dash.js +1 -1
  145. package/dist/utilities/index.js +2 -2
  146. package/dist/utilities/text-helpers.js +1 -1
  147. package/dist/utilities/web-workers.d.ts +7 -7
  148. package/dist/utilities/web-workers.js +5 -5
  149. package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
  150. 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-UpU4cKPh.js";
4
- import { i as $806e559d0c2c64a0$export$472062a354075cee, o as $806e559d0c2c64a0$export$a590f758a961cb5b, r as $806e559d0c2c64a0$export$2c1b491743890dec, t as $806e559d0c2c64a0$export$105594979f116971 } from "../../Slider-B8icnyOo.js";
5
- import { t as NumberPicker } from "../../number-picker-nnOf0XnN.js";
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 && typeof markers === "object" && Object.keys(markers).length > 0) generatedMarkers = 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 = typeof value === "number" ? value : value[0] ?? min;
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": typeof label === "string" ? label : __("Slider value", "eightshift-ui-components"),
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((entry) => typeof entry === "number");
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) if (firstStateValue < startPoint) isWithinActiveBar = dotValue > firstStateValue && dotValue <= startPoint;
118
- else isWithinActiveBar = dotValue >= startPoint && dotValue < firstStateValue;
119
- else isWithinActiveBar = dotValue < firstStateValue;
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", {
@@ -3,7 +3,6 @@ import type { Prettify } from '../../utilities/types';
3
3
  type AnalysisSource = 'worker' | 'cache' | 'analysisData';
4
4
  type ImageAnalysisSettings = {
5
5
  numColors?: number;
6
- [key: string]: unknown;
7
6
  };
8
7
  type SmartImageColor = {
9
8
  color: string;
@@ -1,5 +1,5 @@
1
1
  import { t as clsx } from "../../clsx-DQoRUQAf.js";
2
- import { t as DecorativeTooltip } from "../../tooltip-BW9nj5-V.js";
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 getErrorMessage = (error) => {
38
- if (error instanceof Error) return error.message;
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-BuHru-CI.js", import.meta.url).href + "", "" + import.meta.url), { type: "module" });
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
- setObjectUrl(null);
106
- return () => {
107
- isActive = false;
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 (typeof OffscreenCanvas !== "undefined") {
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 ("close" in imageSource && typeof imageSource.close === "function") imageSource.close();
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
- setError(exists ? getErrorMessage(caughtError) : "failedToFetch");
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 hasAnalysed = Boolean(analysis) && Boolean(objectUrl);
227
- const { dominantColors, isDark, isTransparent, transparencyInfo, averageColor } = analysis ?? {};
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: analysis && objectUrl && !error ? objectUrl : imageProps.src,
248
+ src: activeAnalysis && activeObjectUrl && !error ? activeObjectUrl : imageProps.src,
250
249
  style: imageStyle,
251
- className: clsx("es:transition-opacity", !hasAnalysed && !error && processingClassName, typeof className === "function" ? className(classFetchProps) : className),
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") return jsxs("div", {
257
- className: clsx(typeof children !== "function" && "es:flex es:flex-col es:gap-2 es:items-center-safe es:justify-center es:p-2", "es:motion-preset-fade", errorClassName),
258
- children: [typeof children !== "function" && jsx(DecorativeTooltip, {
259
- text: __("Error loading image", "eightshift-ui-components"),
260
- children: cloneElement(imageError, { className: "es:text-surface-600 es:size-8" })
261
- }), typeof children === "function" ? children({
262
- image: imageElement,
263
- hasAnalysed,
264
- isLoaded: true,
265
- dominantColors: void 0,
266
- isDark: void 0,
267
- isTransparent: false,
268
- transparencyInfo: void 0,
269
- averageColor: null,
270
- hasError: true,
271
- errorBadge: jsx("div", {
272
- className: "es:size-full es:flex es:items-center es:justify-center",
273
- children: jsx(DecorativeTooltip, {
274
- text: __("Error loading image", "eightshift-ui-components"),
275
- children: cloneElement(imageError, { className: "es:text-surface-600 es:size-8" })
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
- }) : imageElement]
279
- });
280
- return children && typeof children === "function" ? 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-wAe0AAyu.js";
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-BJ4_OyUm.js";
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-UpU4cKPh.js";
3
- import { t as Switch } from "../../switch-BJ4_OyUm.js";
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-BLJdEp8V.js";
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-BW9nj5-V.js";
1
+ import { n as Tooltip, t as DecorativeTooltip } from "../../tooltip-AzOLps8g.js";
2
2
  export { DecorativeTooltip, Tooltip };