@eightshift/ui-components 6.0.13 → 6.1.1

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 (97) hide show
  1. package/dist/{Button-JRIu2BnS.js → Button-CFnNdpNZ.js} +9 -9
  2. package/dist/{Dialog-Dd1yqNus.js → Dialog-D0jMcN-a.js} +79 -60
  3. package/dist/{FieldError-DmVwL6Dj.js → FieldError-BPG0hKfB.js} +2 -2
  4. package/dist/{FocusScope-Dri1oBcH.js → FocusScope-BJhC1-1e.js} +6 -7
  5. package/dist/{Heading-eA6LXIKB.js → Heading-CY-_gt-U.js} +2 -2
  6. package/dist/{Input-Cuw9UbNb.js → Input-B4X6-x6r.js} +8 -8
  7. package/dist/{Label-DPWyf-gp.js → Label-BDlf9vIY.js} +3 -2
  8. package/dist/{List-CWheI3JH.js → List-CQFXnN4w.js} +1 -1
  9. package/dist/{ListBox-DT1sFY3e.js → ListBox-BaN0n5h3.js} +30 -28
  10. package/dist/{OverlayArrow-DVJTTfZM.js → OverlayArrow-Dy0qw7WL.js} +7 -7
  11. package/dist/{PortalProvider-CHPnqDSH.js → PortalProvider-BQ1X8vGX.js} +1 -1
  12. package/dist/{RadioGroup-Cp5cdBI_.js → RadioGroup-CjCAbUr4.js} +15 -15
  13. package/dist/{SearchField-CLhr5PGZ.js → SearchField-CafsA525.js} +12 -12
  14. package/dist/{SelectionManager-DbBiF5M8.js → SelectionManager-oojq6MOy.js} +38 -34
  15. package/dist/{SharedElementTransition-B_vnQ1uR.js → SharedElementTransition-CtoWSaF0.js} +1 -1
  16. package/dist/{Slider-CZV3HhHY.js → Slider-BIbaMdUE.js} +17 -16
  17. package/dist/{Text-Dae33gHp.js → Text-CjFEHSfr.js} +3 -2
  18. package/dist/{VisuallyHidden-eaCBtXhE.js → VisuallyHidden-CqnizvzQ.js} +2 -2
  19. package/dist/{animation-DY7CNkr6.js → animation-Dfl8uEb3.js} +2 -2
  20. package/dist/assets/style-admin.css +38 -54
  21. package/dist/assets/style-editor.css +38 -54
  22. package/dist/assets/style.css +38 -54
  23. package/dist/{color-swatch-CZj0jHZd.js → color-swatch-bUFkK7ox.js} +6 -6
  24. package/dist/components/base-control/base-control.js +1 -1
  25. package/dist/components/button/button.js +9 -9
  26. package/dist/components/checkbox/checkbox.js +10 -10
  27. package/dist/components/color-pickers/color-picker.js +1 -1
  28. package/dist/components/color-pickers/color-swatch.js +1 -1
  29. package/dist/components/color-pickers/gradient-editor.js +2 -2
  30. package/dist/components/color-pickers/solid-color-picker.js +27 -23
  31. package/dist/components/draggable/draggable-handle.js +1 -1
  32. package/dist/components/draggable/draggable.js +841 -633
  33. package/dist/components/draggable-list/draggable-list-item.js +1 -1
  34. package/dist/components/draggable-list/draggable-list.js +1 -1
  35. package/dist/components/expandable/expandable.js +10 -10
  36. package/dist/components/index.js +4 -2
  37. package/dist/components/input-field/input-field.js +10 -10
  38. package/dist/components/link-input/link-input.js +24 -23
  39. package/dist/components/matrix-align/matrix-align.js +1 -1
  40. package/dist/components/menu/menu.js +1 -1
  41. package/dist/components/modal/modal.js +21 -22
  42. package/dist/components/number-picker/number-picker.js +11 -11
  43. package/dist/components/options-panel/options-panel.js +1 -1
  44. package/dist/components/placeholders/file-picker-shell.js +49 -44
  45. package/dist/components/popover/popover.js +1 -1
  46. package/dist/components/portal-provider/portal-provider.js +1 -1
  47. package/dist/components/radio/radio.js +2 -2
  48. package/dist/components/repeater/repeater.js +1 -1
  49. package/dist/components/responsive/mini-responsive.js +1 -1
  50. package/dist/components/select/async-multi-select.js +53 -32
  51. package/dist/components/select/async-select.js +8 -8
  52. package/dist/components/select/multi-select.js +9 -9
  53. package/dist/components/select/shared.js +4 -4
  54. package/dist/components/select/single-select.js +9 -9
  55. package/dist/components/slider/column-config-slider.js +3 -3
  56. package/dist/components/slider/slider.js +3 -3
  57. package/dist/components/smart-image/image-analysis-worker-next.js +144 -0
  58. package/dist/components/smart-image/smart-image-next.js +294 -0
  59. package/dist/components/smart-image/smart-image.js +2 -2
  60. package/dist/components/smart-image/worker-inline.js +1 -1
  61. package/dist/components/tabs/tabs.js +17 -16
  62. package/dist/components/toggle/switch.js +7 -7
  63. package/dist/components/toggle/toggle.js +1 -1
  64. package/dist/components/toggle-button/toggle-button.js +10 -7
  65. package/dist/components/tooltip/tooltip.js +8 -8
  66. package/dist/{context-DYYO3Ns3.js → context-iUFQCK8m.js} +1 -1
  67. package/dist/{general-C8Q0dvEx.js → general-BfKmjm56.js} +3 -4
  68. package/dist/icons/icons.js +2 -2
  69. package/dist/icons/jsx-svg.js +1 -1
  70. package/dist/{index-sSixe2j_.js → index-BL5gdWX4.js} +52 -52
  71. package/dist/index.js +3 -1
  72. package/dist/{proxy-B_RaYTfe.js → proxy-DFlYXk07.js} +320 -82
  73. package/dist/{react-jsx-parser.min-B_hvYYa1.js → react-jsx-parser.min-DAh4myol.js} +35 -35
  74. package/dist/{shared-Bg9lx3pE.js → shared-CMLCUova.js} +29 -26
  75. package/dist/{textSelection-Cq_Br7RW.js → textSelection-CeoEP4rL.js} +1 -1
  76. package/dist/{useButton-CeuyDay5.js → useButton-5YL_nmpZ.js} +3 -3
  77. package/dist/{useEvent-DoWvho2u.js → useEvent-Zze2g7CX.js} +1 -1
  78. package/dist/{useFilter-DYtfYPua.js → useFilter-8S94U4xM.js} +1 -1
  79. package/dist/{useFocusRing-WEswknAY.js → useFocusRing-rUOwLdTK.js} +10 -5
  80. package/dist/{useFormReset-BDF1K4E4.js → useFormReset-BxtOoO5Q.js} +1 -1
  81. package/dist/{useFormValidation-Dqzjv4jX.js → useFormValidation-DTmPrTD8.js} +3 -3
  82. package/dist/{useHover-CG39Ci3A.js → useHover-CmyvqeWX.js} +18 -17
  83. package/dist/{useLabel--3fT2XKM.js → useLabel-DzXzKZZZ.js} +2 -2
  84. package/dist/{useLabels-vzdDMGCX.js → useLabels-D8O3gOdV.js} +1 -1
  85. package/dist/{useListState-Bya9g7W8.js → useListState-B22CApJO.js} +1 -1
  86. package/dist/{useLocalizedStringFormatter-M3L6Ge2c.js → useLocalizedStringFormatter-CEDs0LsA.js} +1 -1
  87. package/dist/{useNumberField-D6lsi3Vu.js → useNumberField-CTkI-U9a.js} +50 -40
  88. package/dist/{useNumberFormatter-BWOyCamK.js → useNumberFormatter-CG_IQXp9.js} +1 -1
  89. package/dist/{usePress-B9w0X4Ur.js → usePress-CNefMs8d.js} +14 -8
  90. package/dist/{useSingleSelectListState-D9SqGLJ0.js → useSingleSelectListState-CDZGQDLC.js} +2 -2
  91. package/dist/{useToggle-Deq2xxQV.js → useToggle-CFFOmZWi.js} +4 -4
  92. package/dist/{useToggleState-j3o1PvdS.js → useToggleState-BWrKKisg.js} +1 -1
  93. package/dist/utilities/general.js +1 -1
  94. package/dist/utilities/index.js +1 -1
  95. package/dist/{utils-HC9_3Crc.js → utils-Cr3pLd9c.js} +77 -38
  96. package/dist/workers/image-analysis.worker.js +1 -1
  97. package/package.json +17 -17
@@ -2,16 +2,16 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { s as sprintf } from "../../sprintf-DmNrJSYG.js";
3
3
  import { _ as __, a as _n } from "../../default-i18n-CnQeC5Pl.js";
4
4
  import { BaseControl } from "../base-control/base-control.js";
5
- import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CLhr5PGZ.js";
6
- import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-JRIu2BnS.js";
7
- import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-Cuw9UbNb.js";
8
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
9
- import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-DT1sFY3e.js";
10
- import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-Dd1yqNus.js";
11
- import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-Bg9lx3pE.js";
5
+ import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CafsA525.js";
6
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CFnNdpNZ.js";
7
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-B4X6-x6r.js";
8
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
9
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-BaN0n5h3.js";
10
+ import { f as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-D0jMcN-a.js";
11
+ import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-CMLCUova.js";
12
12
  import { useRef, cloneElement } from "react";
13
13
  import { icons } from "../../icons/icons.js";
14
- import "../../react-jsx-parser.min-B_hvYYa1.js";
14
+ import "../../react-jsx-parser.min-DAh4myol.js";
15
15
  import { Spinner } from "../../icons/spinner.js";
16
16
  import { RichLabel } from "../rich-label/rich-label.js";
17
17
  import { unescapeHTML } from "../../utilities/text-helpers.js";
@@ -151,7 +151,23 @@ const AsyncMultiSelect = (props) => {
151
151
  }
152
152
  });
153
153
  const handleSelectionChange = (rawSelected) => {
154
- const selected = list.filterText.length > 0 ? /* @__PURE__ */ new Set([...value?.map((item) => item?.value) ?? [], ...rawSelected]) : rawSelected;
154
+ let selected;
155
+ if (list.filterText.length > 0) {
156
+ const visibleItemKeys = new Set(list.items?.map((item) => item.value) ?? []);
157
+ selected = /* @__PURE__ */ new Set();
158
+ for (const item of value ?? []) {
159
+ const key = item?.value ?? item;
160
+ if (!visibleItemKeys.has(key)) {
161
+ selected.add(key);
162
+ }
163
+ }
164
+ for (const key of rawSelected) {
165
+ selected.add(key);
166
+ }
167
+ } else {
168
+ selected = rawSelected;
169
+ }
170
+ list.setSelectedKeys(selected);
155
171
  list.filterText = "";
156
172
  if (selected === null || selected === void 0) {
157
173
  onChange(null);
@@ -282,35 +298,35 @@ const AsyncMultiSelect = (props) => {
282
298
  ref,
283
299
  children: [
284
300
  /* @__PURE__ */ jsxs($d2b4bc8c273e7be6$export$353f5b6fc5456de1, { className: buttonClass({ size }), children: [
285
- /* @__PURE__ */ jsx($82d7e5349645de74$export$e288731fd71264f0, { className: "es:select-none es:pointer-events-none", children: ({ isPlaceholder, selectedItems }) => {
286
- const [selectedItem] = selectedItems;
287
- if (!currentValueKeys?.length || isPlaceholder) {
301
+ /* @__PURE__ */ jsx($82d7e5349645de74$export$e288731fd71264f0, { className: "es:select-none es:pointer-events-none", children: () => {
302
+ if (!currentValueKeys?.length) {
288
303
  return /* @__PURE__ */ jsx("span", { className: "es:select-none es:pointer-events-none es:pr-6 es:text-sm es:text-surface-500", children: placeholder });
289
304
  }
290
- let icon2 = getIcon ? getIcon(selectedItem) : selectedItem?.icon ?? null;
291
- if (typeof selectedItem?.icon === "string") {
292
- icon2 = icons?.[selectedItem.icon] ?? null;
305
+ const currentItem = value?.[0];
306
+ let icon2 = getIcon ? getIcon(currentItem) : currentItem?.icon ?? null;
307
+ if (typeof currentItem?.icon === "string") {
308
+ icon2 = icons?.[currentItem.icon] ?? null;
293
309
  }
294
- if (selectedItems.length > 1) {
310
+ if (value?.length > 1) {
295
311
  return /* @__PURE__ */ jsx(
296
312
  RichLabel,
297
313
  {
298
314
  icon: icons.multiple,
299
- label: sprintf(_n("%s item", "%s items", selectedItems.length, "eightshift-ui-components"), selectedItems.length),
300
- subtitle: selectedItems.map((item) => item?.label ?? item).join(", "),
315
+ label: sprintf(_n("%s item", "%s items", value.length, "eightshift-ui-components"), value.length),
316
+ subtitle: value.map((item) => item?.label ?? item).join(", "),
301
317
  subtitleClassName: "es:line-clamp-1 es:max-w-56"
302
318
  }
303
319
  );
304
320
  }
305
- if (!isPlaceholder && value && customValueDisplay) {
306
- return customValueDisplay(selectedItem);
321
+ if (value && customValueDisplay) {
322
+ return customValueDisplay(currentItem);
307
323
  }
308
324
  return /* @__PURE__ */ jsx(
309
325
  RichLabel,
310
326
  {
311
327
  icon: icon2,
312
- label: selectedItem?.label,
313
- subtitle: selectedItem?.subtitle,
328
+ label: currentItem?.label,
329
+ subtitle: currentItem?.subtitle,
314
330
  className: clsx("es:pr-6 es:grow es:w-full", disabled && "es:grayscale es:pointer-events-none"),
315
331
  iconClassName: "es:pointer-events-none es:select-none",
316
332
  labelClassName: "es:line-clamp-1",
@@ -362,28 +378,34 @@ const AsyncMultiSelect = (props) => {
362
378
  DraggableList,
363
379
  {
364
380
  items: value ?? [],
365
- onChange: (value2) => {
366
- handleSelectionChange(new Set(value2?.map((item) => item?.value ?? item)));
381
+ onChange: (reordered) => {
382
+ onChange(
383
+ reordered.map((item) => ({
384
+ label: item?.label,
385
+ value: item?.value,
386
+ subtitle: item?.subtitle,
387
+ meta: item?.meta
388
+ }))
389
+ );
367
390
  },
368
391
  className: "es:contents",
369
392
  itemContainerClassName: "es:h-full es:max-h-60 es:overflow-y-auto es:pb-1.5 es:mt-0",
370
393
  itemClassName: "es:z-999999",
371
394
  children: (item) => {
372
- const realItem = list.getItem(item?.value);
373
- let icon2 = getIcon ? getIcon(realItem) : realItem?.icon ?? null;
374
- if (typeof realItem?.icon === "string") {
375
- icon2 = icons?.[realItem.icon] ?? null;
395
+ let icon2 = getIcon ? getIcon(item) : item?.icon ?? null;
396
+ if (typeof item?.icon === "string") {
397
+ icon2 = icons?.[item.icon] ?? null;
376
398
  }
377
399
  return /* @__PURE__ */ jsx(
378
400
  DraggableListItem,
379
401
  {
380
402
  icon: icon2,
381
- label: realItem?.label,
382
- subtitle: realItem?.subtitle,
403
+ label: item?.label,
404
+ subtitle: item?.subtitle,
383
405
  iconClassName: "es:pointer-events-none es:select-none",
384
406
  labelClassName: "es:line-clamp-1",
385
407
  subtitleClassName: "es:line-clamp-1",
386
- className: clsx("es:flex es:items-center es:justify-between", realItem?.icon ? "es:pl-1" : "es:pl-2")
408
+ className: clsx("es:flex es:items-center es:justify-between", item?.icon ? "es:pl-1" : "es:pl-2")
387
409
  }
388
410
  );
389
411
  }
@@ -473,7 +495,6 @@ const AsyncMultiSelect = (props) => {
473
495
  selectionMode: "multiple",
474
496
  selectionBehavior: "toggle",
475
497
  onSelectionChange: (selected) => {
476
- list.setSelectedKeys(selected);
477
498
  handleSelectionChange(selected);
478
499
  },
479
500
  renderEmptyState: () => /* @__PURE__ */ jsx(
@@ -1,16 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
3
3
  import { BaseControl } from "../base-control/base-control.js";
4
- import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CLhr5PGZ.js";
5
- import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-JRIu2BnS.js";
6
- import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-Cuw9UbNb.js";
7
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
8
- import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-DT1sFY3e.js";
9
- import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-Dd1yqNus.js";
10
- import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-Bg9lx3pE.js";
4
+ import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CafsA525.js";
5
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CFnNdpNZ.js";
6
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-B4X6-x6r.js";
7
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
8
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-BaN0n5h3.js";
9
+ import { f as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-D0jMcN-a.js";
10
+ import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-CMLCUova.js";
11
11
  import { useRef, cloneElement } from "react";
12
12
  import { icons } from "../../icons/icons.js";
13
- import "../../react-jsx-parser.min-B_hvYYa1.js";
13
+ import "../../react-jsx-parser.min-DAh4myol.js";
14
14
  import { Spinner } from "../../icons/spinner.js";
15
15
  import { RichLabel } from "../rich-label/rich-label.js";
16
16
  import { unescapeHTML } from "../../utilities/text-helpers.js";
@@ -2,16 +2,16 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { s as sprintf } from "../../sprintf-DmNrJSYG.js";
3
3
  import { _ as __, a as _n } from "../../default-i18n-CnQeC5Pl.js";
4
4
  import { BaseControl } from "../base-control/base-control.js";
5
- import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CLhr5PGZ.js";
6
- import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-JRIu2BnS.js";
7
- import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-Cuw9UbNb.js";
8
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
9
- import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-DT1sFY3e.js";
10
- import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-Dd1yqNus.js";
11
- import { g as getValue, $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-Bg9lx3pE.js";
5
+ import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CafsA525.js";
6
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CFnNdpNZ.js";
7
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-B4X6-x6r.js";
8
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
9
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-BaN0n5h3.js";
10
+ import { f as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-D0jMcN-a.js";
11
+ import { g as getValue, $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-CMLCUova.js";
12
12
  import { useRef, cloneElement, isValidElement } from "react";
13
13
  import { icons } from "../../icons/icons.js";
14
- import "../../react-jsx-parser.min-B_hvYYa1.js";
14
+ import "../../react-jsx-parser.min-DAh4myol.js";
15
15
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
16
16
  import { RichLabel } from "../rich-label/rich-label.js";
17
17
  import { c as cva } from "../../index-BHpUy2Ix.js";
@@ -19,7 +19,7 @@ import { TriggeredPopover } from "../popover/popover.js";
19
19
  import { DraggableList } from "../draggable-list/draggable-list.js";
20
20
  import { DraggableListItem } from "../draggable-list/draggable-list-item.js";
21
21
  import { randomId } from "../../utilities/hash.js";
22
- import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-DYtfYPua.js";
22
+ import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-8S94U4xM.js";
23
23
  /**
24
24
  * Multi-select menu.
25
25
  *
@@ -1,11 +1,11 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../default-i18n-CnQeC5Pl.js";
3
- import "../../Button-JRIu2BnS.js";
4
- import "../../ListBox-DT1sFY3e.js";
5
- import { O, S, g, m } from "../../shared-Bg9lx3pE.js";
3
+ import "../../Button-CFnNdpNZ.js";
4
+ import "../../ListBox-BaN0n5h3.js";
5
+ import { O, S, g, m } from "../../shared-CMLCUova.js";
6
6
  import "../../icons/icons.js";
7
7
  import "react";
8
- import "../../react-jsx-parser.min-B_hvYYa1.js";
8
+ import "../../react-jsx-parser.min-DAh4myol.js";
9
9
  import "../../clsx-DgYk2OaC.js";
10
10
  import "../animated-visibility/animated-visibility.js";
11
11
  export {
@@ -1,21 +1,21 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
3
3
  import { BaseControl } from "../base-control/base-control.js";
4
- import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CLhr5PGZ.js";
5
- import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-JRIu2BnS.js";
6
- import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-Cuw9UbNb.js";
7
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
8
- import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-DT1sFY3e.js";
9
- import { $ as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-Dd1yqNus.js";
10
- import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-Bg9lx3pE.js";
4
+ import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-CafsA525.js";
5
+ import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CFnNdpNZ.js";
6
+ import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-B4X6-x6r.js";
7
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
8
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48 } from "../../ListBox-BaN0n5h3.js";
9
+ import { f as $07b14b47974efb58$export$5b6b19405a83ff9d } from "../../Dialog-D0jMcN-a.js";
10
+ import { $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-CMLCUova.js";
11
11
  import { useRef, cloneElement } from "react";
12
12
  import { icons } from "../../icons/icons.js";
13
- import "../../react-jsx-parser.min-B_hvYYa1.js";
13
+ import "../../react-jsx-parser.min-DAh4myol.js";
14
14
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
15
15
  import { RichLabel } from "../rich-label/rich-label.js";
16
16
  import { c as cva } from "../../index-BHpUy2Ix.js";
17
17
  import { randomId } from "../../utilities/hash.js";
18
- import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-DYtfYPua.js";
18
+ import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-8S94U4xM.js";
19
19
  /**
20
20
  * Select menu.
21
21
  *
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { s as sprintf } from "../../sprintf-DmNrJSYG.js";
3
3
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
4
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
5
- import { $ as $6f909507e6374d18$export$472062a354075cee, a as $6f909507e6374d18$export$105594979f116971, b as $6f909507e6374d18$export$2c1b491743890dec, c as $6f909507e6374d18$export$a590f758a961cb5b } from "../../Slider-CZV3HhHY.js";
4
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
5
+ import { $ as $6f909507e6374d18$export$472062a354075cee, a as $6f909507e6374d18$export$105594979f116971, b as $6f909507e6374d18$export$2c1b491743890dec, c as $6f909507e6374d18$export$a590f758a961cb5b } from "../../Slider-BIbaMdUE.js";
6
6
  import { BaseControl } from "../base-control/base-control.js";
7
7
  import { icons } from "../../icons/icons.js";
8
8
  import { getColumnConfigOutputText } from "./utils.js";
9
9
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
10
- import { A as AnimatePresence, m as motion } from "../../proxy-B_RaYTfe.js";
10
+ import { A as AnimatePresence, m as motion } from "../../proxy-DFlYXk07.js";
11
11
  /**
12
12
  * A two-thumb slider for selecting a range of columns.
13
13
  *
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DPWyf-gp.js";
4
- import { $ as $6f909507e6374d18$export$472062a354075cee, a as $6f909507e6374d18$export$105594979f116971, b as $6f909507e6374d18$export$2c1b491743890dec, c as $6f909507e6374d18$export$a590f758a961cb5b } from "../../Slider-CZV3HhHY.js";
3
+ import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BDlf9vIY.js";
4
+ import { $ as $6f909507e6374d18$export$472062a354075cee, a as $6f909507e6374d18$export$105594979f116971, b as $6f909507e6374d18$export$2c1b491743890dec, c as $6f909507e6374d18$export$a590f758a961cb5b } from "../../Slider-BIbaMdUE.js";
5
5
  import { BaseControl } from "../base-control/base-control.js";
6
6
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
7
7
  import { NumberPicker } from "../number-picker/number-picker.js";
8
8
  import { generateMarkers, generateGridTemplate } from "./utils.js";
9
9
  import { HStack } from "../layout/hstack.js";
10
- import { A as AnimatePresence, m as motion } from "../../proxy-B_RaYTfe.js";
10
+ import { A as AnimatePresence, m as motion } from "../../proxy-DFlYXk07.js";
11
11
  /**
12
12
  * A single/multi-thumb slider component.
13
13
  *
@@ -0,0 +1,144 @@
1
+ const getSaturation = (r, g, b) => {
2
+ const red = r / 255;
3
+ const green = g / 255;
4
+ const blue = b / 255;
5
+ const max = Math.max(red, green, blue);
6
+ const min = Math.min(red, green, blue);
7
+ const delta = max - min;
8
+ if (max < 0.05) {
9
+ return 0;
10
+ }
11
+ let saturation = 0;
12
+ if (max !== 0) {
13
+ saturation = delta / max;
14
+ }
15
+ return parseFloat(saturation.toFixed(3));
16
+ };
17
+ const rgbToHex = (r, g, b) => "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
18
+ self.onmessage = (e) => {
19
+ const { buffer, width, height, config } = e.data;
20
+ const { maxColors = 5, threshold = 96, transparencyThreshold = 255 } = config;
21
+ const stride = 4;
22
+ const isTransparent = (idx) => buffer[idx + 3] < transparencyThreshold;
23
+ const getIdx = (x, y) => (y * width + x) * stride;
24
+ const corners = {
25
+ topLeft: isTransparent(getIdx(0, 0)),
26
+ topRight: isTransparent(getIdx(width - 1, 0)),
27
+ bottomLeft: isTransparent(getIdx(0, height - 1)),
28
+ bottomRight: isTransparent(getIdx(width - 1, height - 1))
29
+ };
30
+ const sides = { top: false, bottom: false, left: false, right: false };
31
+ for (let x = 0; x < width; x += 5) {
32
+ if (!sides.top && isTransparent(getIdx(x, 0))) {
33
+ sides.top = true;
34
+ }
35
+ if (!sides.bottom && isTransparent(getIdx(x, height - 1))) {
36
+ sides.bottom = true;
37
+ }
38
+ }
39
+ for (let y = 0; y < height; y += 5) {
40
+ if (!sides.left && isTransparent(getIdx(0, y))) {
41
+ sides.left = true;
42
+ }
43
+ if (!sides.right && isTransparent(getIdx(width - 1, y))) {
44
+ sides.right = true;
45
+ }
46
+ }
47
+ let internalTransparent = false;
48
+ const borderIsSolid = !Object.values(sides).some((v) => v);
49
+ if (borderIsSolid) {
50
+ const len = buffer.length;
51
+ const step = Math.floor(len / 100);
52
+ for (let i = 0; i < len; i += step) {
53
+ const idx = i - i % 4;
54
+ if (buffer[idx + 3] < 255) {
55
+ internalTransparent = true;
56
+ break;
57
+ }
58
+ }
59
+ } else {
60
+ internalTransparent = true;
61
+ }
62
+ const colorCounts = {};
63
+ const samplingRate = 20;
64
+ let totalSampledPixels = 0;
65
+ let sumR = 0;
66
+ let sumG = 0;
67
+ let sumB = 0;
68
+ for (let i = 0; i < buffer.length; i += stride * samplingRate) {
69
+ const rRaw = buffer[i];
70
+ const gRaw = buffer[i + 1];
71
+ const bRaw = buffer[i + 2];
72
+ const a = buffer[i + 3];
73
+ if (a < 250) continue;
74
+ totalSampledPixels++;
75
+ sumR += rRaw;
76
+ sumG += gRaw;
77
+ sumB += bRaw;
78
+ const q = 5;
79
+ const r = Math.round(rRaw / q) * q;
80
+ const g = Math.round(gRaw / q) * q;
81
+ const b = Math.round(bRaw / q) * q;
82
+ const key = `${r},${g},${b}`;
83
+ colorCounts[key] = (colorCounts[key] || 0) + 1;
84
+ }
85
+ let averageColor = null;
86
+ if (totalSampledPixels > 0) {
87
+ const avgR = Math.round(sumR / totalSampledPixels);
88
+ const avgG = Math.round(sumG / totalSampledPixels);
89
+ const avgB = Math.round(sumB / totalSampledPixels);
90
+ const avgLum = 0.2126 * avgR + 0.7152 * avgG + 0.0722 * avgB;
91
+ averageColor = {
92
+ color: rgbToHex(avgR, avgG, avgB),
93
+ isDark: avgLum <= 128,
94
+ saturation: getSaturation(avgR, avgG, avgB)
95
+ };
96
+ }
97
+ const sortedRawColors = Object.entries(colorCounts).map(([key, count]) => {
98
+ const [r, g, b] = key.split(",").map(Number);
99
+ return { r, g, b, count };
100
+ }).sort((a, b) => b.count - a.count);
101
+ const distinctPalette = [];
102
+ for (const candidate of sortedRawColors) {
103
+ if (distinctPalette.length >= maxColors) break;
104
+ let isSimilar = false;
105
+ for (const existing of distinctPalette) {
106
+ const dist = Math.sqrt(Math.pow(candidate.r - existing.r, 2) + Math.pow(candidate.g - existing.g, 2) + Math.pow(candidate.b - existing.b, 2));
107
+ if (dist < threshold) {
108
+ existing.count += candidate.count;
109
+ isSimilar = true;
110
+ break;
111
+ }
112
+ }
113
+ if (!isSimilar) {
114
+ distinctPalette.push({ ...candidate });
115
+ }
116
+ }
117
+ const palette = distinctPalette.map((item) => {
118
+ const percentage = parseFloat((item.count / totalSampledPixels).toFixed(3));
119
+ const lum = 0.2126 * item.r + 0.7152 * item.g + 0.0722 * item.b;
120
+ return {
121
+ color: rgbToHex(item.r, item.g, item.b),
122
+ area: percentage,
123
+ isDark: lum <= 128,
124
+ saturation: getSaturation(item.r, item.g, item.b)
125
+ };
126
+ });
127
+ self.postMessage({
128
+ dominantColors: palette,
129
+ averageColor,
130
+ isDark: palette[0]?.isDark || false,
131
+ isTransparent: internalTransparent || Object.values(corners).some((v) => v) || Object.values(sides).some((v) => v),
132
+ transparencyInfo: {
133
+ any: internalTransparent,
134
+ left: sides.left,
135
+ right: sides.right,
136
+ top: sides.top,
137
+ bottom: sides.bottom,
138
+ topLeftCorner: corners.topLeft,
139
+ topRightCorner: corners.topRight,
140
+ bottomLeftCorner: corners.bottomLeft,
141
+ bottomRightCorner: corners.bottomRight
142
+ }
143
+ });
144
+ };