@eightshift/ui-components 6.1.1 → 6.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.
@@ -1,21 +1,22 @@
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-CafsA525.js";
4
+ import { $ as $d2f53cda644affe3$export$2f2b9559550c7bbc, a as $440f4836bcb56932$export$b94867ecbd698f21 } from "../../SearchField-BME59dt-.js";
5
5
  import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CFnNdpNZ.js";
6
+ import { f as $07b14b47974efb58$export$5b6b19405a83ff9d, i as $72a5793c14baf454$export$8b251419efc915eb } from "../../Dialog-DDfABlp4.js";
6
7
  import { $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-B4X6-x6r.js";
7
8
  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
- import { useRef, cloneElement } from "react";
9
+ import { $ as $eed445e0843c11d0$export$41f133550aa26f48, a as $eed445e0843c11d0$export$dca12b0bb56e4fc } from "../../ListBox-ByPsaVVK.js";
10
+ import { g as getGroupedOptions, $ as $82d7e5349645de74$export$ef9b1a59e592288f, a as $82d7e5349645de74$export$e288731fd71264f0, S as SelectClearButton, O as OptionItemBase } from "../../shared-HdRrpnhs.js";
11
+ import { $ as $e1995378a142960e$export$fb8073518f34e6ec } from "../../SelectionManager-iru59gc4.js";
12
+ import { useRef, useState, useMemo, cloneElement } from "react";
12
13
  import { icons } from "../../icons/icons.js";
13
14
  import "../../react-jsx-parser.min-DAh4myol.js";
14
15
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
15
16
  import { RichLabel } from "../rich-label/rich-label.js";
16
17
  import { c as cva } from "../../index-BHpUy2Ix.js";
17
18
  import { randomId } from "../../utilities/hash.js";
18
- import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-8S94U4xM.js";
19
+ import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-NhAlifsK.js";
19
20
  /**
20
21
  * Select menu.
21
22
  *
@@ -31,6 +32,8 @@ import { $ as $bb77f239b46e8c72$export$3274cf84b703fff } from "../../useFilter-8
31
32
  * @param {string|{label: string, value: string, metadata: Object<string, any>?}} props.value - Current value of the select.
32
33
  * @param {Function} props.onChange - Function to call when the value changes.
33
34
  * @param {boolean} [props.simpleValue=false] - If `true`, instead of using a `{label: '', value: ''}` value type, a string is used (just the value).
35
+ * @param {string} [props.groupKey] - If provided, the options will be grouped by this key.
36
+ * @param {Object} [props.groupValueMapping] - If provided, the group headers will be mapped to these labels/icons.
34
37
  * @param {boolean} [props.clearable] - Whether the select is clearable.
35
38
  * @param {boolean} [props.disabled] - Whether the select is disabled.
36
39
  * @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
@@ -78,6 +81,8 @@ const Select = (props) => {
78
81
  onChange,
79
82
  options,
80
83
  simpleValue = false,
84
+ groupKey,
85
+ groupValueMapping,
81
86
  disabled = false,
82
87
  clearable = false,
83
88
  placeholder = __("Select...", "eightshift-ui-components"),
@@ -93,8 +98,44 @@ const Select = (props) => {
93
98
  ...rest
94
99
  } = props;
95
100
  const ref = useRef();
96
- const currentValue = simpleValue ? value ?? null : value?.value ?? null;
101
+ const [searchTerm, setSearchTerm] = useState("");
97
102
  const { contains } = $bb77f239b46e8c72$export$3274cf84b703fff({ sensitivity: "base" });
103
+ const filteredOptions = useMemo(() => {
104
+ if (!searchable || searchTerm.length === 0) {
105
+ return options;
106
+ }
107
+ return options?.filter((item) => {
108
+ return contains(item.label ?? "", searchTerm) || contains(item?.subtitle ?? "", searchTerm);
109
+ });
110
+ }, [options, searchable, searchTerm, contains]);
111
+ const groupedOptions = useMemo(() => getGroupedOptions(filteredOptions, groupKey, groupValueMapping), [filteredOptions, groupKey, groupValueMapping]);
112
+ const currentValue = simpleValue ? value ?? null : value?.value ?? null;
113
+ const renderItem = (item) => {
114
+ let icon2 = item?.icon ?? null;
115
+ if (typeof item?.icon === "string") {
116
+ icon2 = icons?.[item.icon] ?? null;
117
+ }
118
+ return /* @__PURE__ */ jsxs(
119
+ OptionItemBase,
120
+ {
121
+ id: item?.value ?? randomId(8),
122
+ className: item?.className,
123
+ selectIndicator: true,
124
+ children: [
125
+ customMenuOption && customMenuOption(item),
126
+ !customMenuOption && /* @__PURE__ */ jsx(
127
+ RichLabel,
128
+ {
129
+ icon: icon2,
130
+ label: item?.label,
131
+ subtitle: item?.subtitle,
132
+ noColor: true
133
+ }
134
+ )
135
+ ]
136
+ }
137
+ );
138
+ };
98
139
  if (hidden) {
99
140
  return null;
100
141
  }
@@ -173,6 +214,11 @@ const Select = (props) => {
173
214
  {
174
215
  isDisabled: disabled,
175
216
  value: currentValue,
217
+ onOpenChange: (isOpen) => {
218
+ if (!isOpen) {
219
+ setSearchTerm("");
220
+ }
221
+ },
176
222
  onChange: (selected) => {
177
223
  if (selected === null || selected === void 0) {
178
224
  onChange(null);
@@ -190,12 +236,7 @@ const Select = (props) => {
190
236
  if (item && "id" in item) {
191
237
  delete item.id;
192
238
  }
193
- onChange({
194
- label: item?.label,
195
- value: item?.value,
196
- subtitle: item?.subtitle,
197
- meta: item?.meta
198
- });
239
+ onChange(item);
199
240
  },
200
241
  placeholder,
201
242
  ...rest,
@@ -296,92 +337,96 @@ const Select = (props) => {
296
337
  maxHeight: 240,
297
338
  triggerRef: ref,
298
339
  children: [
299
- searchable && /* @__PURE__ */ jsxs($d2f53cda644affe3$export$2f2b9559550c7bbc, { filter: contains, children: [
300
- /* @__PURE__ */ jsxs(
301
- $440f4836bcb56932$export$b94867ecbd698f21,
302
- {
303
- "aria-label": __("Search", "eightshift-ui-components"),
304
- className: "es:flex es:items-center es:relative",
305
- autoFocus: true,
306
- children: [
307
- /* @__PURE__ */ jsx(
308
- $3985021b0ad6602f$export$f5b8910cec6cf069,
309
- {
310
- placeholder: __("Search...", "eightshift-ui-components"),
311
- className: clsx(
312
- "es:peer es:size-full es:h-9.5 es:outline-hidden! es:pl-3.5 es:pr-9 es:shadow-none! es:text-13! es:placeholder:text-surface-500 es:[&::-webkit-search-cancel-button]:hidden",
313
- "es:bg-accent-900/8 es:m-1.5 es:rounded-3xl es:border-none!",
314
- "es:inset-ring! es:inset-ring-accent-950/7 es:focus:inset-ring-accent-950/20",
315
- "es:text-accent-950 es:placeholder:text-accent-700/50",
316
- "es:transition"
317
- )
318
- }
319
- ),
320
- /* @__PURE__ */ jsx(
321
- $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
322
- {
323
- "aria-label": __("Clear", "eightshift-ui-components"),
324
- className: clsx(
325
- "es:absolute es:right-3 es:top-0 es:bottom-0 es:my-auto es:border-none es:bg-transparent",
326
- "es:flex es:size-7 es:items-center es:justify-center es:rounded-3xl es:text-sm es:text-surface-700 es:transition es:hover:bg-accent-50 es:hover:text-accent-800 es:any-focus:outline-hidden es:focus:ring-2 es:focus:ring-accent-500/50 es:disabled:text-secondary-300",
327
- "es:peer-placeholder-shown:opacity-0"
328
- ),
329
- children: icons.clearAlt
330
- }
331
- )
332
- ]
333
- }
334
- ),
335
- /* @__PURE__ */ jsx(
336
- $eed445e0843c11d0$export$41f133550aa26f48,
337
- {
338
- className: "es:space-y-0.75 es:p-1.5 es:pt-0 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl",
339
- items: options,
340
- renderEmptyState: () => /* @__PURE__ */ jsx(
341
- RichLabel,
340
+ searchable && /* @__PURE__ */ jsxs(
341
+ $d2f53cda644affe3$export$2f2b9559550c7bbc,
342
+ {
343
+ filter: () => true,
344
+ inputValue: searchTerm,
345
+ onInputChange: setSearchTerm,
346
+ children: [
347
+ /* @__PURE__ */ jsxs(
348
+ $440f4836bcb56932$export$b94867ecbd698f21,
342
349
  {
343
- icon: icons.searchEmpty,
344
- label: __("No results", "eightshift-ui-components"),
345
- subtitle: __("Try a different search term", "eightshift-ui-components"),
346
- className: "es:min-h-14 es:p-2 es:w-fit es:mx-auto es:motion-preset-slide-up es:motion-ease-spring-bouncy es:motion-duration-200 es:shrink-0",
347
- iconClassName: "es:text-accent-700 es:icon:size-7!",
348
- noColor: true
350
+ "aria-label": __("Search", "eightshift-ui-components"),
351
+ className: "es:flex es:items-center es:relative",
352
+ autoFocus: true,
353
+ children: [
354
+ /* @__PURE__ */ jsx(
355
+ $3985021b0ad6602f$export$f5b8910cec6cf069,
356
+ {
357
+ placeholder: __("Search...", "eightshift-ui-components"),
358
+ className: clsx(
359
+ "es:peer es:size-full es:h-9.5 es:outline-hidden! es:pl-3.5 es:pr-9 es:shadow-none! es:text-13! es:placeholder:text-surface-500 es:[&::-webkit-search-cancel-button]:hidden",
360
+ "es:bg-accent-900/8 es:m-1.5 es:rounded-3xl! es:border-none!",
361
+ "es:inset-ring! es:inset-ring-accent-950/7 es:focus:inset-ring-accent-950/20",
362
+ "es:text-accent-950 es:placeholder:text-accent-700/50",
363
+ "es:transition"
364
+ )
365
+ }
366
+ ),
367
+ /* @__PURE__ */ jsx(
368
+ $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
369
+ {
370
+ slot: "clear",
371
+ "aria-label": __("Clear", "eightshift-ui-components"),
372
+ className: clsx(
373
+ "es:absolute es:right-3 es:top-0 es:bottom-0 es:my-auto es:border-none es:bg-transparent",
374
+ "es:flex es:size-7 es:items-center es:justify-center es:rounded-3xl es:text-sm es:text-surface-700 es:transition es:hover:bg-accent-50 es:hover:text-accent-800 es:any-focus:outline-hidden es:focus:ring-2 es:focus:ring-accent-500/50 es:disabled:text-secondary-300",
375
+ "es:peer-placeholder-shown:opacity-0"
376
+ ),
377
+ children: icons.clearAlt
378
+ }
379
+ )
380
+ ]
349
381
  }
350
382
  ),
351
- children: (item) => {
352
- let icon2 = item?.icon ?? null;
353
- if (typeof item?.icon === "string") {
354
- icon2 = icons?.[item.icon] ?? null;
383
+ /* @__PURE__ */ jsxs(
384
+ $eed445e0843c11d0$export$41f133550aa26f48,
385
+ {
386
+ className: "es:space-y-0.75 es:p-1.5 es:pt-0 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl",
387
+ renderEmptyState: () => /* @__PURE__ */ jsx(
388
+ RichLabel,
389
+ {
390
+ icon: icons.searchEmpty,
391
+ label: __("No results", "eightshift-ui-components"),
392
+ subtitle: __("Try a different search term", "eightshift-ui-components"),
393
+ className: "es:min-h-14 es:p-2 es:w-fit es:mx-auto es:motion-preset-slide-up es:motion-ease-spring-bouncy es:motion-duration-200 es:shrink-0",
394
+ iconClassName: "es:text-accent-700 es:icon:size-7!",
395
+ noColor: true
396
+ }
397
+ ),
398
+ children: [
399
+ groupedOptions && /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: groupedOptions, children: (item) => /* @__PURE__ */ jsxs(
400
+ $eed445e0843c11d0$export$dca12b0bb56e4fc,
401
+ {
402
+ id: item.key,
403
+ className: "es:flex es:flex-col es:gap-0.75",
404
+ children: [
405
+ /* @__PURE__ */ jsx($72a5793c14baf454$export$8b251419efc915eb, { className: "es:px-2.5 es:pb-1 es:pt-3 es:select-none", children: /* @__PURE__ */ jsx(
406
+ RichLabel,
407
+ {
408
+ icon: item?.icon,
409
+ label: item?.label,
410
+ subtitle: item?.subtitle,
411
+ endIcon: item?.endIcon,
412
+ fullWidth: true
413
+ }
414
+ ) }),
415
+ /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: item.options, children: (subItem) => renderItem(subItem) })
416
+ ]
417
+ }
418
+ ) }),
419
+ !groupedOptions && /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: searchable ? filteredOptions : options, children: (item) => renderItem(item) })
420
+ ]
355
421
  }
356
- return /* @__PURE__ */ jsxs(
357
- OptionItemBase,
358
- {
359
- id: item?.value ?? randomId(8),
360
- className: item?.className,
361
- selectIndicator: true,
362
- children: [
363
- customMenuOption && customMenuOption(item),
364
- !customMenuOption && /* @__PURE__ */ jsx(
365
- RichLabel,
366
- {
367
- icon: icon2,
368
- label: item?.label,
369
- subtitle: item?.subtitle,
370
- noColor: true
371
- }
372
- )
373
- ]
374
- }
375
- );
376
- }
377
- }
378
- )
379
- ] }),
380
- !searchable && /* @__PURE__ */ jsx(
422
+ )
423
+ ]
424
+ }
425
+ ),
426
+ !searchable && /* @__PURE__ */ jsxs(
381
427
  $eed445e0843c11d0$export$41f133550aa26f48,
382
428
  {
383
429
  className: "es:space-y-0.75 es:p-1.5 es:any-focus:outline-hidden es:h-full es:overflow-y-auto es:rounded-t-xl",
384
- items: options,
385
430
  renderEmptyState: () => /* @__PURE__ */ jsx(
386
431
  RichLabel,
387
432
  {
@@ -393,32 +438,29 @@ const Select = (props) => {
393
438
  noColor: true
394
439
  }
395
440
  ),
396
- children: (item) => {
397
- let icon2 = item?.icon ?? null;
398
- if (typeof item?.icon === "string") {
399
- icon2 = icons?.[item.icon] ?? null;
400
- }
401
- return /* @__PURE__ */ jsxs(
402
- OptionItemBase,
441
+ children: [
442
+ groupedOptions && /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: groupedOptions, children: (item) => /* @__PURE__ */ jsxs(
443
+ $eed445e0843c11d0$export$dca12b0bb56e4fc,
403
444
  {
404
- id: item.value,
405
- className: item?.className,
406
- selectIndicator: true,
445
+ id: item.key,
446
+ className: "es:flex es:flex-col es:gap-0.75",
407
447
  children: [
408
- customMenuOption && customMenuOption(item),
409
- !customMenuOption && /* @__PURE__ */ jsx(
448
+ /* @__PURE__ */ jsx($72a5793c14baf454$export$8b251419efc915eb, { className: "es:px-2.5 es:pb-1 es:pt-3 es:select-none", children: /* @__PURE__ */ jsx(
410
449
  RichLabel,
411
450
  {
412
- icon: icon2,
451
+ icon: item?.icon,
413
452
  label: item?.label,
414
453
  subtitle: item?.subtitle,
415
- noColor: true
454
+ endIcon: item?.endIcon,
455
+ fullWidth: true
416
456
  }
417
- )
457
+ ) }),
458
+ /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: item.options, children: (subItem) => renderItem(subItem) })
418
459
  ]
419
460
  }
420
- );
421
- }
461
+ ) }),
462
+ !groupedOptions && /* @__PURE__ */ jsx($e1995378a142960e$export$fb8073518f34e6ec, { items: options, children: (item) => renderItem(item) })
463
+ ]
422
464
  }
423
465
  )
424
466
  ]
@@ -1,11 +1,11 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { c as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, b as $3ef42575df84b30b$export$9d1611c77c2fe928, d as $bdb11010cef70236$export$f680877a34711e37, k as $df56164dff5785e2$export$4338b53315abf666, h as $64fa3d84918910a7$export$4d86445c2cf5e3, a as $64fa3d84918910a7$export$df3a06d6289f983e, $ as $64fa3d84918910a7$export$29f1550f4b0d4415, e as $64fa3d84918910a7$export$fabf2dc03a41866e, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "../../utils-Cr3pLd9c.js";
3
- import { e as $880e95eb8b93ba9a$export$ecf600387e221c37, m as $ae20dd8cbca75726$export$d6daf82dcd84e87c, h as $e1995378a142960e$export$18af5c7a9e9b3664, g as $e1995378a142960e$export$fb8073518f34e6ec, f as $e1995378a142960e$export$bf788dd355e3a401, n as $23b9f4fcf0fe224b$export$d68d59712b04d9d1, j as $7135fc7d473fd974$export$4feb769f8ddf26c5, o as $7135fc7d473fd974$export$90e00781bc59d8f9, p as $7135fc7d473fd974$export$a164736487e3f0ae } from "../../SelectionManager-oojq6MOy.js";
3
+ import { f as $880e95eb8b93ba9a$export$ecf600387e221c37, o as $ae20dd8cbca75726$export$d6daf82dcd84e87c, j as $e1995378a142960e$export$18af5c7a9e9b3664, $ as $e1995378a142960e$export$fb8073518f34e6ec, g as $e1995378a142960e$export$bf788dd355e3a401, p as $23b9f4fcf0fe224b$export$d68d59712b04d9d1, l as $7135fc7d473fd974$export$4feb769f8ddf26c5, q as $7135fc7d473fd974$export$90e00781bc59d8f9, r as $7135fc7d473fd974$export$a164736487e3f0ae } from "../../SelectionManager-iru59gc4.js";
4
4
  import { $ as $1d5b8b8664671ef2$export$c9549807523555e0 } from "../../SelectionIndicator-D7WMzeAW.js";
5
5
  import { $ as $c8a5a149f625efcf$export$758399f318e6385a } from "../../SharedElementTransition-CtoWSaF0.js";
6
6
  import { $ as $f39a9eba43920ace$export$86427a43e3e48ebb } from "../../Hidden-Rfj-STx7.js";
7
7
  import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-eGTqWSTd.js";
8
- import { b as $cdc5a6778b766db2$export$a9d04c5684123369 } from "../../useListState-B22CApJO.js";
8
+ import { b as $cdc5a6778b766db2$export$a9d04c5684123369 } from "../../useListState-HOvCQJFf.js";
9
9
  import { $ as $d3f049242431219c$export$45fda7c47f93fd48, a as $d3f049242431219c$export$6d3443f2c48bfc20 } from "../../animation-Dfl8uEb3.js";
10
10
  import $dbSRa$react__default, { useState, useMemo, useRef, useEffect, useContext, forwardRef, createContext, isValidElement, useId, cloneElement } from "react";
11
11
  import { E as $ea8dcbcb9ea1b556$export$7e924b3091a3bd18, $ as $f645667febf57a63$export$4c014de7c8940b4c, x as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../useHover-CmyvqeWX.js";
@@ -13,7 +13,7 @@ import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-
13
13
  import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "../../FocusScope-BJhC1-1e.js";
14
14
  import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-iUFQCK8m.js";
15
15
  import { a as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-rUOwLdTK.js";
16
- import { $ as $a0d645289fe9b86b$export$e7f05e985daf4b5f } from "../../useSingleSelectListState-CDZGQDLC.js";
16
+ import { $ as $a0d645289fe9b86b$export$e7f05e985daf4b5f } from "../../useSingleSelectListState-BtrMHGeE.js";
17
17
  import { s as sprintf } from "../../sprintf-DmNrJSYG.js";
18
18
  import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
19
19
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
@@ -1,14 +1,14 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { _ as __ } from "./default-i18n-CnQeC5Pl.js";
3
3
  import { a as $d2b4bc8c273e7be6$export$24d547caef80ccd1, $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "./Button-CFnNdpNZ.js";
4
- import { c as $eed445e0843c11d0$export$7ff8f37d2d81a48d, d as $eed445e0843c11d0$export$7c5906fe4f1f2af2, e as $eed445e0843c11d0$export$a11e76429ed99b4 } from "./ListBox-BaN0n5h3.js";
4
+ import { d as $eed445e0843c11d0$export$7ff8f37d2d81a48d, e as $eed445e0843c11d0$export$7c5906fe4f1f2af2, f as $eed445e0843c11d0$export$a11e76429ed99b4 } from "./ListBox-ByPsaVVK.js";
5
5
  import { b as $3ef42575df84b30b$export$9d1611c77c2fe928, d as $bdb11010cef70236$export$f680877a34711e37, o as $ff5963eb1fccf552$export$e08e3b67e392101e, $ as $64fa3d84918910a7$export$29f1550f4b0d4415, e as $64fa3d84918910a7$export$fabf2dc03a41866e, h as $64fa3d84918910a7$export$4d86445c2cf5e3, a as $64fa3d84918910a7$export$df3a06d6289f983e, f as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, g as $64fa3d84918910a7$export$ef03459518577ad4, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "./utils-Cr3pLd9c.js";
6
6
  import { a as $2baaea4c71418dea$export$294aa081a6c6f55d, $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "./FieldError-BPG0hKfB.js";
7
7
  import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "./Form-Cq3fu75_.js";
8
8
  import { a as $01b77f81d0f07f68$export$75b6ee27786ba447 } from "./Label-BDlf9vIY.js";
9
- import { i as $325a3faab7a68acd$export$a16aca283550c30d, t as $2a25aae57d74318e$export$a05409b8bb224a5a, w as $168583247155ddda$export$dc9c12ed27dd1b49, n as $de32f1b87079253c$export$d2f961adcb0afbe, x as $07b14b47974efb58$export$9b9a0cd73afb7ca4 } from "./Dialog-D0jMcN-a.js";
9
+ import { j as $325a3faab7a68acd$export$a16aca283550c30d, u as $2a25aae57d74318e$export$a05409b8bb224a5a, x as $168583247155ddda$export$dc9c12ed27dd1b49, o as $de32f1b87079253c$export$d2f961adcb0afbe, y as $07b14b47974efb58$export$9b9a0cd73afb7ca4 } from "./Dialog-DDfABlp4.js";
10
10
  import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "./Text-CjFEHSfr.js";
11
- import { s as $fb3050f43d946246$export$e32c88dfddc6e1d8, f as $e1995378a142960e$export$bf788dd355e3a401 } from "./SelectionManager-oojq6MOy.js";
11
+ import { u as $fb3050f43d946246$export$e32c88dfddc6e1d8, g as $e1995378a142960e$export$bf788dd355e3a401 } from "./SelectionManager-iru59gc4.js";
12
12
  import { $ as $f39a9eba43920ace$export$86427a43e3e48ebb } from "./Hidden-Rfj-STx7.js";
13
13
  import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-eGTqWSTd.js";
14
14
  import { $ as $fc909762b330b746$export$61c6a8c84e605fb6, d as $9daab02d461809db$export$683480f191c0e3ea } from "./OverlayArrow-Dy0qw7WL.js";
@@ -16,7 +16,7 @@ import $dbSRa$react__default, { useMemo, useRef, useCallback, useState, forwardR
16
16
  import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-iUFQCK8m.js";
17
17
  import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-CEDs0LsA.js";
18
18
  import { a as $e93e671b31057976$export$b8473d3665f3a75a, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "./useFormValidation-DTmPrTD8.js";
19
- import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-B22CApJO.js";
19
+ import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-HOvCQJFf.js";
20
20
  import { g as $d4ee10de306f2510$export$4282f70798064fe0, w as $507fabe10e71c6fb$export$8397ddfc504fdb9a, a as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-CmyvqeWX.js";
21
21
  import { a as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-rUOwLdTK.js";
22
22
  import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-BxtOoO5Q.js";
@@ -967,6 +967,7 @@ const OptionItemBase = (props) => /* @__PURE__ */ jsx(
967
967
  "es:bg-surface-50/90",
968
968
  "es:rounded-md",
969
969
  "es:first:rounded-t-xl es:last:rounded-b-xl",
970
+ "es:nth-2:rounded-t-xl",
970
971
  "es:after-current:rounded-t-xl es:before-current:rounded-b-xl",
971
972
  "es:hover:rounded-2xl es:pressed:rounded-3xl",
972
973
  "es:focus-visible:bg-white/90 es:focus-visible:rounded-2xl es:focus-visible:text-accent-950",
@@ -1066,11 +1067,44 @@ const SelectClearButton = ({ multi = false }) => {
1066
1067
  }
1067
1068
  );
1068
1069
  };
1070
+ const getGroupedOptions = (filteredOptions, groupKey, groupValueMapping) => {
1071
+ if (!groupKey || !filteredOptions || filteredOptions?.length === 0) {
1072
+ return null;
1073
+ }
1074
+ const groups = filteredOptions.reduce((acc, item) => {
1075
+ const key = item[groupKey] ?? "_other";
1076
+ if (!acc[key]) {
1077
+ acc[key] = [];
1078
+ }
1079
+ acc[key].push(item);
1080
+ return acc;
1081
+ }, {});
1082
+ return Object.entries(groups).map(([key, options]) => {
1083
+ const mapping = groupValueMapping?.[key];
1084
+ let icon = mapping?.icon;
1085
+ if (typeof icon === "string") {
1086
+ icon = icons?.[icon] ?? icon;
1087
+ }
1088
+ let endIcon = mapping?.endIcon;
1089
+ if (typeof endIcon === "string") {
1090
+ endIcon = icons?.[endIcon] ?? endIcon;
1091
+ }
1092
+ return {
1093
+ key,
1094
+ label: mapping?.label ?? (key === "_other" ? __("Other", "eightshift-ui-components") : key),
1095
+ icon: icon || null,
1096
+ subtitle: mapping?.subtitle || null,
1097
+ endIcon: endIcon || null,
1098
+ options
1099
+ };
1100
+ });
1101
+ };
1069
1102
  export {
1070
1103
  $82d7e5349645de74$export$ef9b1a59e592288f as $,
1071
1104
  OptionItemBase as O,
1072
1105
  SelectClearButton as S,
1073
1106
  $82d7e5349645de74$export$e288731fd71264f0 as a,
1074
- getValue as g,
1107
+ getValue as b,
1108
+ getGroupedOptions as g,
1075
1109
  moveArrayItem as m
1076
1110
  };
@@ -1,4 +1,4 @@
1
- import { i as $325a3faab7a68acd$export$a16aca283550c30d } from "./Dialog-D0jMcN-a.js";
1
+ import { j as $325a3faab7a68acd$export$a16aca283550c30d } from "./Dialog-DDfABlp4.js";
2
2
  import { useCallback, useMemo } from "react";
3
3
  function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
4
4
  let collator = $325a3faab7a68acd$export$a16aca283550c30d({
@@ -1,5 +1,5 @@
1
1
  import { version, useMemo, useCallback, useRef, useEffect } from "react";
2
- import { $ as $7af3f5b51489e0b5$export$253fe78d46329472, a as $7613b1592d41b092$export$6cd28814d92fa9c9, b as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-oojq6MOy.js";
2
+ import { a as $7af3f5b51489e0b5$export$253fe78d46329472, b as $7613b1592d41b092$export$6cd28814d92fa9c9, c as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-iru59gc4.js";
3
3
  function $cdc5a6778b766db2$export$a9d04c5684123369(value) {
4
4
  const pieces = version.split(".");
5
5
  const major = parseInt(pieces[0], 10);
@@ -1,4 +1,4 @@
1
- import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-B22CApJO.js";
1
+ import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-HOvCQJFf.js";
2
2
  import { a as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-CmyvqeWX.js";
3
3
  import { useMemo } from "react";
4
4
  function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/ui-components",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -58,10 +58,10 @@
58
58
  "@react-stately/collections": "^3.12.9",
59
59
  "@stylistic/eslint-plugin-js": "^4.4.1",
60
60
  "@tailwindcss/vite": "^4.1.18",
61
- "@thi.ng/color": "^5.8.9",
62
- "@thi.ng/pixel": "^7.5.22",
63
- "@thi.ng/pixel-analysis": "^2.0.24",
64
- "@thi.ng/pixel-dominant-colors": "^2.0.28",
61
+ "@thi.ng/color": "^5.8.10",
62
+ "@thi.ng/pixel": "^7.5.23",
63
+ "@thi.ng/pixel-analysis": "^2.0.25",
64
+ "@thi.ng/pixel-dominant-colors": "^2.0.29",
65
65
  "@types/react": "^18.3.28",
66
66
  "@types/react-dom": "^18.3.7",
67
67
  "@vitejs/plugin-react-swc": "^4.2.3",
@@ -74,7 +74,7 @@
74
74
  "eslint-config-prettier": "^10.1.8",
75
75
  "eslint-plugin-jsdoc": "^61.7.1",
76
76
  "eslint-plugin-prettier": "^5.5.5",
77
- "glob": "^13.0.1",
77
+ "glob": "^13.0.2",
78
78
  "globals": "^16.5.0",
79
79
  "just-camel-case": "^6.2.0",
80
80
  "just-debounce-it": "^3.2.0",
@@ -88,7 +88,7 @@
88
88
  "prettier-plugin-tailwindcss": "^0.7.2",
89
89
  "react": "^18.3.1",
90
90
  "react-aria": "^3.46.0",
91
- "react-aria-components": "^1.15.0",
91
+ "react-aria-components": "^1.15.1",
92
92
  "react-dom": "^18.3.1",
93
93
  "react-jsx-parser": "^2.4.1",
94
94
  "react-movable": "^3.4.1",
@@ -103,6 +103,6 @@
103
103
  "dependencies": {
104
104
  "@fontsource-variable/geist-mono": "^5.2.7",
105
105
  "@fontsource-variable/roboto-flex": "^5.2.8",
106
- "motion": "^12.31.2"
106
+ "motion": "^12.34.0"
107
107
  }
108
108
  }