@purpur/library 10.1.0 → 10.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 (87) hide show
  1. package/CHANGELOG.json +12 -0
  2. package/CHANGELOG.md +8 -1
  3. package/dist/components/accordion/src/accordion-item.d.ts +3 -3
  4. package/dist/components/accordion/src/accordion.d.ts +1 -1
  5. package/dist/components/alert-badge/src/alert-badge.d.ts +1 -1
  6. package/dist/components/breadcrumbs/src/breadcrumbs.d.ts +1 -1
  7. package/dist/components/card/src/card-badge.d.ts +1 -1
  8. package/dist/components/card/src/card-content-container.d.ts +2 -2
  9. package/dist/components/card/src/card-content.d.ts +2 -2
  10. package/dist/components/card/src/card-cta.d.ts +2 -2
  11. package/dist/components/card/src/card-media-layout.d.ts +1 -1
  12. package/dist/components/card/src/card-root.d.ts +2 -2
  13. package/dist/components/container/src/container.d.ts +2 -2
  14. package/dist/components/counter-badge/src/counter-badge.d.ts +1 -1
  15. package/dist/components/cta-link/src/cta-link.d.ts +10 -10
  16. package/dist/components/date-range-field/src/date-range-field.d.ts +1 -1
  17. package/dist/components/dismissable-chip-group/src/dismissable-chip-group-item.d.ts +2 -2
  18. package/dist/components/drawer/src/drawer-content.d.ts +2 -2
  19. package/dist/components/drawer/src/drawer-trigger.d.ts +2 -2
  20. package/dist/components/drawer/src/drawer.d.ts +1 -1
  21. package/dist/components/dropdown/src/dropdown-combobox.d.ts.map +1 -1
  22. package/dist/components/dropdown/src/useDropdown.d.ts +2 -2
  23. package/dist/components/field-error-text/src/field-error-text.d.ts +1 -1
  24. package/dist/components/footer/src/footer-social-link.d.ts +1 -1
  25. package/dist/components/footer/src/footer.d.ts +4 -4
  26. package/dist/components/grid/src/grid.d.ts +1 -1
  27. package/dist/components/grid/src/grid.item.d.ts +1 -1
  28. package/dist/components/heading/src/heading.d.ts +1 -1
  29. package/dist/components/hero-banner/src/hero-banner-actions.d.ts +2 -2
  30. package/dist/components/hero-banner/src/hero-banner-media.d.ts +2 -2
  31. package/dist/components/hero-banner/src/hero-banner-types.d.ts +3 -3
  32. package/dist/components/label/src/label.d.ts +1 -1
  33. package/dist/components/listbox/src/listbox-item.d.ts +2 -2
  34. package/dist/components/logo/src/logo.types.d.ts +1 -1
  35. package/dist/components/notification/src/notification.d.ts +2 -2
  36. package/dist/components/pagination/src/pagination-page-selector.d.ts +1 -1
  37. package/dist/components/pagination/src/pagination-page-size-selector.d.ts +2 -2
  38. package/dist/components/pagination/src/pagination-page-trigger.d.ts +2 -2
  39. package/dist/components/pagination/src/pagination-pages.d.ts +1 -1
  40. package/dist/components/pagination/src/pagination-step-trigger.d.ts +2 -2
  41. package/dist/components/pagination/src/types.d.ts +2 -2
  42. package/dist/components/pagination/src/use-page-options.hook.d.ts +2 -2
  43. package/dist/components/password-field/src/password-strength.d.ts +2 -2
  44. package/dist/components/product-card/src/product-card.d.ts +3 -3
  45. package/dist/components/promotion-card/src/promotion-card.d.ts +3 -3
  46. package/dist/components/quantity-selector/src/quantity-selector.d.ts +1 -1
  47. package/dist/components/radio-button-group/src/radio-button-group-root.d.ts +3 -3
  48. package/dist/components/radio-card-group/src/radio-card-group.d.ts +2 -2
  49. package/dist/components/rich-text/src/types.d.ts +1 -1
  50. package/dist/components/search-field/src/search-field.d.ts +6 -6
  51. package/dist/components/select/src/select.d.ts +2 -2
  52. package/dist/components/spacer/src/spacer.d.ts +1 -1
  53. package/dist/components/stepper/src/stepper-container.d.ts +1 -1
  54. package/dist/components/stepper/src/stepper-content.d.ts +2 -2
  55. package/dist/components/stepper/src/stepper.d.ts +1 -1
  56. package/dist/components/table/src/cell-types/button-group-cell.d.ts +3 -3
  57. package/dist/components/table/src/story-utils/table-data.d.ts +4 -4
  58. package/dist/components/table/src/table-content.d.ts +2 -2
  59. package/dist/components/table/src/table.d.ts +2 -2
  60. package/dist/components/table/src/test-utils/table-data.d.ts +3 -3
  61. package/dist/components/table/src/types.d.ts +1 -1
  62. package/dist/components/tabs/src/tab-content.d.ts +1 -1
  63. package/dist/components/text-area/src/text-area.d.ts +1 -1
  64. package/dist/components/text-field/src/text-field.d.ts +1 -1
  65. package/dist/country-flag-icon/LICENSE.txt +0 -11
  66. package/dist/dropdown-B7W5fErJ.js +2 -0
  67. package/dist/dropdown-B7W5fErJ.js.map +1 -0
  68. package/dist/{dropdown-DJr5COdU.mjs → dropdown-CxEElxNf.mjs} +359 -352
  69. package/dist/dropdown-CxEElxNf.mjs.map +1 -0
  70. package/dist/dropdown.cjs.js +1 -1
  71. package/dist/dropdown.es.js +1 -1
  72. package/dist/libraries/library/src/container.d.ts +1 -1
  73. package/dist/libraries/library/src/content-block.d.ts +1 -1
  74. package/dist/libraries/library/src/toggle.d.ts +2 -2
  75. package/dist/libraries/theme/src/ThemeProvider.d.ts +1 -1
  76. package/dist/library.cjs.js +1 -1
  77. package/dist/library.es.js +2 -2
  78. package/dist/{table-CY8rjMoR.mjs → table-7-6k_wGH.mjs} +2 -2
  79. package/dist/{table-CY8rjMoR.mjs.map → table-7-6k_wGH.mjs.map} +1 -1
  80. package/dist/{table-BkXNxvjW.js → table-CllIkAkM.js} +2 -2
  81. package/dist/{table-BkXNxvjW.js.map → table-CllIkAkM.js.map} +1 -1
  82. package/dist/table.cjs.js +1 -1
  83. package/dist/table.es.js +1 -1
  84. package/package.json +21 -21
  85. package/dist/dropdown-DJr5COdU.mjs.map +0 -1
  86. package/dist/dropdown-s8FhNU5N.js +0 -2
  87. package/dist/dropdown-s8FhNU5N.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { jsxs as ee, jsx as d, Fragment as ke } from "react/jsx-runtime";
2
- import { useState as xe, forwardRef as $e, useId as ye, useRef as fe, useCallback as Oe, useEffect as Ke } from "react";
2
+ import { useState as xe, forwardRef as $e, useId as ye, useRef as fe, useCallback as Oe, useEffect as Ve } from "react";
3
3
  import { L as ue } from "./listbox-CtV-Vcmy.mjs";
4
- import { t as Ve } from "./use-autocomplete.es-CKb0RHKG.mjs";
4
+ import { t as He } from "./use-autocomplete.es-CKb0RHKG.mjs";
5
5
  import { C as Se } from "./checkbox-DaRtZXrE.mjs";
6
6
  import { a as Ie } from "./dismissable-chip-group-DMNU7g5e.mjs";
7
- import { F as He } from "./field-error-text-CBSX8dGx.mjs";
8
- import { F as Me } from "./field-helper-text-C5ee4SFV.mjs";
9
- import { r as Ue } from "./check-circle-filled.es-umBwOv5_.mjs";
10
- import { l as Ye } from "./chevron-down.es-PCIIj6oG.mjs";
11
- import { L as qe } from "./label-7sJe5-pX.mjs";
12
- import { a as ze } from "./spinner-DRQN6YdK.mjs";
13
- import { c as je } from "./bind-CU-R61T-.mjs";
14
- const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
7
+ import { F as Me } from "./field-error-text-CBSX8dGx.mjs";
8
+ import { F as Ue } from "./field-helper-text-C5ee4SFV.mjs";
9
+ import { r as Ye } from "./check-circle-filled.es-umBwOv5_.mjs";
10
+ import { l as qe } from "./chevron-down.es-PCIIj6oG.mjs";
11
+ import { L as ze } from "./label-7sJe5-pX.mjs";
12
+ import { a as je } from "./spinner-DRQN6YdK.mjs";
13
+ import { c as Ge } from "./bind-CU-R61T-.mjs";
14
+ const re = (e) => typeof e.label == "string" ? e.label : e.value ?? "", We = {
15
15
  "purpur-dropdown": "_purpur-dropdown_p8b57_1",
16
16
  "purpur-dropdown--negative": "_purpur-dropdown--negative_p8b57_14",
17
17
  "purpur-dropdown__label": "_purpur-dropdown__label_p8b57_17",
@@ -55,20 +55,20 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
55
55
  "purpur-dropdown__checkbox-container": "_purpur-dropdown__checkbox-container_p8b57_304",
56
56
  "purpur-dropdown__checkbox-container--disabled": "_purpur-dropdown__checkbox-container--disabled_p8b57_311",
57
57
  "purpur-dropdown__select-all-child": "_purpur-dropdown__select-all-child_p8b57_314"
58
- }, m = je.bind(Ge), r = "purpur-dropdown", De = ({
58
+ }, m = Ge.bind(We), r = "purpur-dropdown", De = ({
59
59
  fieldId: e,
60
60
  htmlForSuffix: o,
61
61
  label: i,
62
- getTestId: s,
62
+ getTestId: l,
63
63
  disabled: n,
64
64
  negative: u,
65
65
  required: b
66
66
  }) => i ? /* @__PURE__ */ ee(
67
- qe,
67
+ ze,
68
68
  {
69
69
  htmlFor: o ? `${e}-${o}` : e,
70
70
  className: m(`${r}__label`),
71
- "data-testid": s("label"),
71
+ "data-testid": l("label"),
72
72
  disabled: n,
73
73
  negative: u,
74
74
  children: [
@@ -80,36 +80,36 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
80
80
  getTestId: e,
81
81
  loading: o,
82
82
  disabled: i,
83
- negative: s,
83
+ negative: l,
84
84
  isValid: n,
85
85
  isOpen: u,
86
86
  readOnly: b,
87
87
  showChevronOpen: w
88
88
  }) => /* @__PURE__ */ d("span", { className: m(`${r}__end-adornments`), children: o ? /* @__PURE__ */ d(
89
- ze,
89
+ je,
90
90
  {
91
91
  disabled: i,
92
92
  size: "xxs",
93
- negative: s,
93
+ negative: l,
94
94
  "data-testid": e("spinner")
95
95
  }
96
96
  ) : /* @__PURE__ */ ee(ke, { children: [
97
97
  n && /* @__PURE__ */ d(
98
- Ue,
98
+ Ye,
99
99
  {
100
100
  "data-testid": e("valid-icon"),
101
101
  className: m(`${r}__valid-icon`)
102
102
  }
103
103
  ),
104
104
  /* @__PURE__ */ d(
105
- Ye,
105
+ qe,
106
106
  {
107
107
  className: m(`${r}__chevron-icon`, {
108
108
  [`${r}__chevron-icon--open`]: w && u,
109
109
  [`${r}__chevron-icon--disabled`]: i,
110
110
  [`${r}__chevron-icon--readonly`]: b && !i,
111
111
  [`${r}__chevron-icon--is-valid`]: n,
112
- [`${r}__chevron-icon--negative`]: s
112
+ [`${r}__chevron-icon--negative`]: l
113
113
  }),
114
114
  "data-testid": e("dropdown-icon"),
115
115
  size: "sm"
@@ -119,7 +119,7 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
119
119
  selectedItems: e,
120
120
  getTestId: o,
121
121
  disabled: i,
122
- negative: s,
122
+ negative: l,
123
123
  onRemove: n,
124
124
  isSelect: u,
125
125
  moreOptionsText: b,
@@ -133,23 +133,23 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
133
133
  className: m(`${r}__chip-group`, {
134
134
  [`${r}__chip-group--select`]: u
135
135
  }),
136
- negative: s,
136
+ negative: l,
137
137
  "data-testid": o("tags"),
138
138
  size: "sm",
139
139
  children: [
140
- p.map((l) => /* @__PURE__ */ d(
140
+ p.map((a) => /* @__PURE__ */ d(
141
141
  Ie.Item,
142
142
  {
143
- id: l.id,
144
- "data-testid": o(`tag-${l.id}`),
145
- "aria-label": w ? `${w} ${ie(l)}` : ie(l),
143
+ id: a.id,
144
+ "data-testid": o(`tag-${a.id}`),
145
+ "aria-label": w ? `${w} ${re(a)}` : re(a),
146
146
  onDismiss: () => {
147
- n(l);
147
+ n(a);
148
148
  },
149
- disabled: i || l.disabled,
150
- children: l.label
149
+ disabled: i || a.disabled,
150
+ children: a.label
151
151
  },
152
- l.id
152
+ a.id
153
153
  )),
154
154
  h > 0 && /* @__PURE__ */ d(
155
155
  "li",
@@ -162,26 +162,26 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
162
162
  ]
163
163
  }
164
164
  );
165
- }, Ae = ({
165
+ }, Ee = ({
166
166
  errorText: e,
167
167
  helperText: o,
168
168
  helperTextId: i,
169
- negative: s
169
+ negative: l
170
170
  }) => /* @__PURE__ */ ee(ke, { children: [
171
- e && /* @__PURE__ */ d(He, { negative: s, children: e }),
172
- o && !e && /* @__PURE__ */ d(Me, { id: i, negative: s, children: o })
173
- ] }), ne = "__purpur-dropdown-select-all__", Ee = ({
171
+ e && /* @__PURE__ */ d(Me, { negative: l, children: e }),
172
+ o && !e && /* @__PURE__ */ d(Ue, { id: i, negative: l, children: o })
173
+ ] }), de = "__purpur-dropdown-select-all__", Ae = ({
174
174
  selectAllLabel: e,
175
175
  multiple: o,
176
176
  options: i,
177
- selectedItems: s
177
+ selectedItems: l
178
178
  }) => !e || !o || i.filter((w) => !w.disabled).length === 0 ? !1 : !i.filter((w) => w.disabled).some(
179
- (w) => !s.some((C) => C.id === w.id)
179
+ (w) => !l.some((k) => k.id === w.id)
180
180
  ), Re = ({
181
181
  optionsToShow: e,
182
182
  getListboxItemProps: o,
183
183
  multiple: i,
184
- negative: s,
184
+ negative: l,
185
185
  fieldId: n,
186
186
  noOptionsText: u,
187
187
  selectAllLabel: b,
@@ -189,17 +189,17 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
189
189
  }) => {
190
190
  if (u !== void 0 && !e.length)
191
191
  return /* @__PURE__ */ d(ue.Item, { noninteractive: !0, children: u });
192
- const C = e[0]?.id === ne;
192
+ const k = e[0]?.id === de;
193
193
  let p = !1;
194
- if (C) {
195
- const l = e.filter((a) => a.id !== ne).filter((a) => !a.disabled), _ = l.filter(
196
- (a) => w.some((y) => y.id === a.id)
197
- ).length, $ = l.length > 0 && _ === l.length, f = w.length > 0;
198
- p = $ ? !0 : f ? "indeterminate" : !1;
194
+ if (k) {
195
+ const a = e.filter((s) => s.id !== de).filter((s) => !s.disabled), _ = a.filter(
196
+ (s) => w.some((x) => x.id === s.id)
197
+ ).length, y = a.length > 0 && _ === a.length, f = w.length > 0;
198
+ p = y ? !0 : f ? "indeterminate" : !1;
199
199
  }
200
- return e.map((h, l) => {
201
- const { key: _, selected: $, ...f } = o(h, l);
202
- return h.id === ne ? /* @__PURE__ */ d(
200
+ return e.map((h, a) => {
201
+ const { key: _, selected: y, ...f } = o(h, a);
202
+ return h.id === de ? /* @__PURE__ */ d(
203
203
  ue.Item,
204
204
  {
205
205
  ...f,
@@ -215,7 +215,7 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
215
215
  id: `${n}-checkbox-select-all`,
216
216
  checked: p,
217
217
  label: b,
218
- negative: s,
218
+ negative: l,
219
219
  "aria-hidden": !0
220
220
  }
221
221
  ) })
@@ -226,9 +226,9 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
226
226
  {
227
227
  ...f,
228
228
  className: m(`${r}__checkbox-item-multiple`, {
229
- [`${r}__select-all-child`]: C
229
+ [`${r}__select-all-child`]: k
230
230
  }),
231
- selected: !!$,
231
+ selected: !!y,
232
232
  hideSelectedIcon: !0,
233
233
  children: /* @__PURE__ */ d(
234
234
  "span",
@@ -240,9 +240,9 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
240
240
  Se,
241
241
  {
242
242
  id: `${n}-checkbox-${h.id}`,
243
- checked: !!$,
243
+ checked: !!y,
244
244
  label: h.label,
245
- negative: s,
245
+ negative: l,
246
246
  "aria-hidden": !0,
247
247
  disabled: h.disabled
248
248
  }
@@ -251,15 +251,15 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
251
251
  )
252
252
  },
253
253
  _
254
- ) : /* @__PURE__ */ d(ue.Item, { ...f, selected: !!$, children: /* @__PURE__ */ d("div", { children: h.label }) }, _);
254
+ ) : /* @__PURE__ */ d(ue.Item, { ...f, selected: !!y, children: /* @__PURE__ */ d("div", { children: h.label }) }, _);
255
255
  });
256
- }, We = (e, o, i) => {
256
+ }, Xe = (e, o, i) => {
257
257
  if (i)
258
258
  return e.filter((n) => i(o, n));
259
259
  if (!o) return e;
260
- const s = o.toUpperCase().split(" ");
260
+ const l = o.toUpperCase().split(" ");
261
261
  return e.filter(
262
- (n) => s.every(
262
+ (n) => l.every(
263
263
  (u) => (n.value || (typeof n.label == "string" ? n.label : "")).toUpperCase().includes(u)
264
264
  )
265
265
  );
@@ -267,161 +267,167 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
267
267
  options: e,
268
268
  searchTerm: o,
269
269
  filterOption: i,
270
- selectedOption: s,
270
+ selectedOption: l,
271
271
  multiple: n
272
- }) => !n && s && ie(s) === o ? e : We(e, o, i), Be = ({
272
+ }) => !n && l && re(l) === o ? e : Xe(e, o, i), Be = ({
273
273
  controlledInputValue: e,
274
274
  defaultInputValue: o,
275
275
  selectedOption: i,
276
- onInputChange: s
276
+ onInputChange: l
277
277
  }) => {
278
278
  const [n, u] = xe(
279
- (typeof e == "string" ? e : o ?? (i ? ie(i) : void 0)) ?? ""
279
+ (typeof e == "string" ? e : o ?? (i ? re(i) : void 0)) ?? ""
280
280
  );
281
281
  return {
282
282
  displayInputValue: typeof e == "string" ? e : n,
283
- populateInputField: (C) => {
284
- s?.(C), u(C);
283
+ populateInputField: (k) => {
284
+ l?.(k), u(k);
285
285
  }
286
286
  };
287
287
  }, Fe = $e((e, o) => {
288
288
  const {
289
289
  id: i,
290
- label: s,
290
+ label: l,
291
291
  options: n,
292
292
  className: u,
293
293
  errorText: b,
294
294
  helperText: w,
295
- placeholder: C,
295
+ placeholder: k,
296
296
  negative: p = !1,
297
297
  readOnly: h = !1,
298
- disabled: l = !1,
298
+ disabled: a = !1,
299
299
  required: _ = !1,
300
- valid: $,
300
+ valid: y,
301
301
  loading: f,
302
- multiple: a = !1,
303
- selectedOption: y,
304
- selectedOptions: N = [],
302
+ multiple: s = !1,
303
+ selectedOption: x,
304
+ selectedOptions: L = [],
305
305
  onSelect: S,
306
- openOnFocus: de = !1,
307
- listboxMaxHeight: A,
306
+ openOnFocus: se = !1,
307
+ listboxMaxHeight: E,
308
308
  listboxLabel: _e,
309
309
  filterOption: F,
310
- inputValue: re,
311
- defaultInputValue: U,
310
+ inputValue: te,
311
+ defaultInputValue: q,
312
312
  onInputChange: g,
313
- noOptionsText: te,
313
+ noOptionsText: oe,
314
314
  highlightFirstOption: P = !1,
315
- selectAllLabel: k,
316
- moreOptionsText: X,
317
- removeOptionAriaLabel: E,
318
- ["data-testid"]: I
319
- } = e, Y = ye(), K = i ?? Y, O = (c) => I ? `${I}-${c}` : void 0, q = !!$ && !b, z = `${K}-helper-text`, x = a ? N : y ? [y] : [], { displayInputValue: j, populateInputField: J } = Be({
320
- controlledInputValue: re,
321
- defaultInputValue: U,
322
- selectedOption: y,
315
+ selectAllLabel: O,
316
+ moreOptionsText: Q,
317
+ removeOptionAriaLabel: A,
318
+ ["data-testid"]: C
319
+ } = e, z = ye(), K = i ?? z, D = (c) => C ? `${C}-${c}` : void 0, j = !!y && !b, G = `${K}-helper-text`, $ = s ? L : x ? [x] : [], { displayInputValue: M, populateInputField: W } = Be({
320
+ controlledInputValue: te,
321
+ defaultInputValue: q,
322
+ selectedOption: x,
323
323
  onInputChange: g
324
- }), se = Te({
324
+ }), le = Te({
325
325
  options: n,
326
- searchTerm: j,
326
+ searchTerm: M,
327
327
  filterOption: F,
328
- selectedOption: y,
329
- multiple: a
330
- }), le = Ee({
331
- selectAllLabel: k,
332
- multiple: a,
328
+ selectedOption: x,
329
+ multiple: s
330
+ }), ae = Ae({
331
+ selectAllLabel: O,
332
+ multiple: s,
333
333
  options: n,
334
- selectedItems: x
335
- }), oe = le && (le && !j) ? [{ id: ne, label: k }, ...se] : se, V = () => {
336
- const c = n.filter((D) => !D.disabled);
334
+ selectedItems: $
335
+ }), ne = ae && (ae && !M) ? [{ id: de, label: O }, ...le] : le, V = () => {
336
+ const c = n.filter((N) => !N.disabled);
337
337
  if (c.every(
338
- (D) => x.some((B) => B.id === D.id)
338
+ (N) => $.some((B) => B.id === N.id)
339
339
  )) {
340
- const D = x.filter((B) => B.disabled);
341
- S?.(void 0, D);
340
+ const N = $.filter((B) => B.disabled);
341
+ S?.(void 0, N);
342
342
  } else {
343
- const B = [...x.filter((ve) => ve.disabled), ...c];
343
+ const B = [...$.filter((ve) => ve.disabled), ...c];
344
344
  S?.(void 0, B);
345
345
  }
346
- J("");
346
+ W("");
347
347
  }, ge = (c) => {
348
- if (c.id === ne) {
348
+ if (c.id === de) {
349
349
  V();
350
350
  return;
351
351
  }
352
- if (a) {
353
- const D = x.some((B) => B.id === c.id) ? x.filter((B) => B.id !== c.id) : [...x, c];
354
- S?.(c, D), J("");
352
+ if (s) {
353
+ const N = $.some((B) => B.id === c.id) ? $.filter((B) => B.id !== c.id) : [...$, c];
354
+ S?.(c, N), W("");
355
355
  } else
356
- S?.(c, [c]), J(ie(c));
356
+ S?.(c, [c]), W(re(c));
357
357
  }, {
358
- rootRef: Q,
358
+ rootRef: X,
359
359
  inputRef: Z,
360
- inputProps: G,
361
- listboxProps: ae,
360
+ inputProps: U,
361
+ listboxProps: ce,
362
362
  getListboxItemProps: be,
363
363
  isOpen: v,
364
- openListbox: M,
364
+ openListbox: Y,
365
365
  anchorStyle: R
366
- } = Ve({
366
+ } = He({
367
367
  id: K,
368
368
  // useAutocomplete only reads id/disabled, never label's value, so this is safe even though
369
369
  // DropdownOption.label can be a ReactNode instead of the string it's typed to require.
370
- options: oe,
371
- listboxLabel: _e || s || "Options",
372
- selectedOption: a ? void 0 : y,
373
- disabled: l,
370
+ options: ne,
371
+ listboxLabel: _e || l || "Options",
372
+ selectedOption: s ? void 0 : x,
373
+ disabled: a,
374
374
  readOnly: h,
375
- openOnFocus: de,
376
- listboxMaxHeight: A,
375
+ openOnFocus: se,
376
+ listboxMaxHeight: E,
377
377
  highlightFirstOption: P,
378
- closeOnSelect: !a,
379
- noOptionsText: te,
378
+ closeOnSelect: !s,
379
+ noOptionsText: oe,
380
380
  negative: p,
381
381
  onSelect: ge,
382
- "data-testid": I
383
- }), W = (c) => {
384
- Q.current = c, typeof o == "function" ? o(c) : o && (o.current = c);
385
- }, he = (c, L) => {
386
- const D = be(c, L);
387
- if (a) {
388
- const B = x.some((ve) => ve.id === c.id);
389
- return { ...D, selected: B, "aria-selected": B };
382
+ "data-testid": C
383
+ }), J = (c) => {
384
+ X.current = c, typeof o == "function" ? o(c) : o && (o.current = c);
385
+ }, he = (c, I) => {
386
+ const N = be(c, I);
387
+ if (s) {
388
+ const B = $.some((ve) => ve.id === c.id);
389
+ return { ...N, selected: B, "aria-selected": B };
390
390
  }
391
- return D;
391
+ return N;
392
392
  }, t = (c) => {
393
- const L = x.filter((D) => D.id !== c.id);
394
- S?.(c, L);
393
+ const I = $.filter((N) => N.id !== c.id);
394
+ S?.(c, I);
395
395
  }, T = (c) => {
396
- if (a && c.key === "Backspace" && c.currentTarget.value === "" && x.length > 0) {
397
- for (let L = x.length - 1; L >= 0; L--)
398
- if (!x[L].disabled) {
399
- t(x[L]);
396
+ if (s && c.key === "Backspace" && c.currentTarget.value === "" && $.length > 0) {
397
+ for (let I = $.length - 1; I >= 0; I--)
398
+ if (!$[I].disabled) {
399
+ t($[I]);
400
400
  break;
401
401
  }
402
402
  }
403
- G?.onKeyDown?.(c);
404
- }, ce = (c) => {
405
- J(c.target.value), v || M();
403
+ U?.onKeyDown?.(c);
404
+ }, pe = (c) => {
405
+ W(c.target.value), v || Y();
406
406
  }, H = (c) => {
407
- if (l || h) return;
408
- const L = c.target;
409
- if (L === Z.current || L.closest("button"))
407
+ U?.onBlur?.(c), !s && setTimeout(() => {
408
+ if (X.current?.contains(document.activeElement)) return;
409
+ const I = x ? re(x) : "";
410
+ M !== I && W(I);
411
+ });
412
+ }, we = (c) => {
413
+ if (a || h) return;
414
+ const I = c.target;
415
+ if (I === Z.current || I.closest("button"))
410
416
  return;
411
- const D = Z.current;
412
- D?.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0 })), D?.focus();
413
- }, we = a && !!k && n.length > 0 && n.every((c) => x.some((L) => L.id === c.id)), pe = m(r, u, {
417
+ const N = Z.current;
418
+ N?.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0 })), N?.focus();
419
+ }, ie = s && !!O && n.length > 0 && n.every((c) => $.some((I) => I.id === c.id)), Ke = m(r, u, {
414
420
  [`${r}--negative`]: p
415
421
  });
416
- return /* @__PURE__ */ ee("div", { ref: W, className: pe, children: [
422
+ return /* @__PURE__ */ ee("div", { ref: J, className: Ke, children: [
417
423
  /* @__PURE__ */ d(
418
424
  De,
419
425
  {
420
426
  fieldId: K,
421
427
  htmlForSuffix: "input",
422
- label: s,
423
- getTestId: O,
424
- disabled: l,
428
+ label: l,
429
+ getTestId: D,
430
+ disabled: a,
425
431
  negative: p,
426
432
  required: _
427
433
  }
@@ -431,54 +437,55 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
431
437
  {
432
438
  className: m(`${r}__combobox-container`, {
433
439
  [`${r}__combobox-container--error`]: !!b,
434
- [`${r}__combobox-container--is-valid`]: q,
440
+ [`${r}__combobox-container--is-valid`]: j,
435
441
  [`${r}__combobox-container--negative`]: p,
436
- [`${r}__combobox-container--disabled`]: l,
437
- [`${r}__combobox-container--readonly`]: h && !l
442
+ [`${r}__combobox-container--disabled`]: a,
443
+ [`${r}__combobox-container--readonly`]: h && !a
438
444
  }),
439
445
  style: R,
440
- onClick: H,
446
+ onClick: we,
441
447
  children: [
442
- a && !we && /* @__PURE__ */ d(
448
+ s && !ie && /* @__PURE__ */ d(
443
449
  Le,
444
450
  {
445
- selectedItems: x,
446
- getTestId: O,
447
- disabled: l,
451
+ selectedItems: $,
452
+ getTestId: D,
453
+ disabled: a,
448
454
  negative: p,
449
455
  onRemove: t,
450
- moreOptionsText: X,
451
- removeOptionAriaLabel: E
456
+ moreOptionsText: Q,
457
+ removeOptionAriaLabel: A
452
458
  }
453
459
  ),
454
460
  /* @__PURE__ */ d(
455
461
  "input",
456
462
  {
457
- ...G,
463
+ ...U,
458
464
  ref: Z,
459
465
  id: `${K}-input`,
460
- "data-testid": O("input"),
466
+ "data-testid": D("input"),
461
467
  onKeyDown: T,
462
- onChange: ce,
463
- value: we && !j ? k : j,
464
- placeholder: C,
468
+ onChange: pe,
469
+ onBlur: H,
470
+ value: ie && !M ? O : M,
471
+ placeholder: k,
465
472
  className: m(`${r}__input`, {
466
473
  [`${r}__input--negative`]: p
467
474
  }),
468
- "aria-describedby": z,
475
+ "aria-describedby": G,
469
476
  "aria-invalid": !!b,
470
- disabled: l,
477
+ disabled: a,
471
478
  readOnly: h
472
479
  }
473
480
  ),
474
481
  /* @__PURE__ */ d(
475
482
  Ne,
476
483
  {
477
- getTestId: O,
484
+ getTestId: D,
478
485
  loading: f,
479
- disabled: l,
486
+ disabled: a,
480
487
  negative: p,
481
- isValid: q,
488
+ isValid: j,
482
489
  isOpen: v,
483
490
  showChevronOpen: !0
484
491
  }
@@ -494,173 +501,173 @@ const ie = (e) => typeof e.label == "string" ? e.label : e.value ?? "", Ge = {
494
501
  ]
495
502
  }
496
503
  ) }),
497
- v && /* @__PURE__ */ d(ue, { ...ae, className: m(`${r}__listbox`), children: Re({
498
- optionsToShow: oe,
504
+ v && /* @__PURE__ */ d(ue, { ...ce, className: m(`${r}__listbox`), children: Re({
505
+ optionsToShow: ne,
499
506
  getListboxItemProps: he,
500
- multiple: a,
507
+ multiple: s,
501
508
  negative: p,
502
509
  fieldId: K,
503
- noOptionsText: te,
504
- selectAllLabel: k,
505
- selectedItems: x
510
+ noOptionsText: oe,
511
+ selectAllLabel: O,
512
+ selectedItems: $
506
513
  }) }),
507
514
  /* @__PURE__ */ d(
508
- Ae,
515
+ Ee,
509
516
  {
510
517
  errorText: b,
511
518
  helperText: w,
512
- helperTextId: z,
519
+ helperTextId: G,
513
520
  negative: p
514
521
  }
515
522
  )
516
523
  ] });
517
524
  });
518
525
  Fe.displayName = "DropdownCombobox";
519
- const Xe = ({
526
+ const Je = ({
520
527
  options: e,
521
528
  highlightFirstOption: o
522
529
  }) => {
523
- const i = fe(null), s = fe({}), [n, u] = xe(
530
+ const i = fe(null), l = fe({}), [n, u] = xe(
524
531
  o ? e[0] : void 0
525
532
  ), b = (_) => {
526
533
  if (_) {
527
- const $ = _.getBoundingClientRect(), f = i.current?.getBoundingClientRect() || { top: 0, bottom: 0 };
528
- ($.top < f.top || $.bottom > f.bottom) && _.scrollIntoView({ block: "nearest" });
534
+ const y = _.getBoundingClientRect(), f = i.current?.getBoundingClientRect() || { top: 0, bottom: 0 };
535
+ (y.top < f.top || y.bottom > f.bottom) && _.scrollIntoView({ block: "nearest" });
529
536
  }
530
537
  };
531
538
  return {
532
539
  highlightedOption: n,
533
540
  listboxRef: i,
534
- optionRefs: s,
535
- findNextOption: (_, $) => {
536
- const f = $.filter((y) => !y.disabled);
541
+ optionRefs: l,
542
+ findNextOption: (_, y) => {
543
+ const f = y.filter((x) => !x.disabled);
537
544
  if (!f.length) return;
538
- const a = n ? f.findIndex((y) => y.id === n.id) : -1;
539
- return _ === "ArrowDown" ? f[(a + 1) % f.length] : f[(a - 1 + f.length) % f.length];
545
+ const s = n ? f.findIndex((x) => x.id === n.id) : -1;
546
+ return _ === "ArrowDown" ? f[(s + 1) % f.length] : f[(s - 1 + f.length) % f.length];
540
547
  },
541
548
  highlightOption: (_) => {
542
- u(_ ? { ..._ } : void 0), _ && b(s.current[_.id]);
549
+ u(_ ? { ..._ } : void 0), _ && b(l.current[_.id]);
543
550
  },
544
551
  highlightByClick: (_) => {
545
552
  _.id !== n?.id && u({ ..._, isSetByClickEvent: !0 });
546
553
  },
547
- highlightSelected: (_, $) => {
554
+ highlightSelected: (_, y) => {
548
555
  requestAnimationFrame(() => {
549
- u({ ..._, isSetByClickEvent: $ === "CLICK" }), b(s.current[_.id]);
556
+ u({ ..._, isSetByClickEvent: y === "CLICK" }), b(l.current[_.id]);
550
557
  });
551
558
  },
552
559
  resetHighlight: () => {
553
560
  u(void 0);
554
561
  }
555
562
  };
556
- }, Je = (e, o) => {
563
+ }, Qe = (e, o) => {
557
564
  const i = Oe(
558
- (s) => {
559
- e && !e.contains(s.target) && o();
565
+ (l) => {
566
+ e && !e.contains(l.target) && o();
560
567
  },
561
568
  [o, e]
562
569
  );
563
- Ke(() => (document.addEventListener("mousedown", i), () => {
570
+ Ve(() => (document.addEventListener("mousedown", i), () => {
564
571
  document.removeEventListener("mousedown", i);
565
572
  }), [i]);
566
- }, Qe = ({
573
+ }, Ze = ({
567
574
  id: e,
568
575
  variant: o,
569
576
  options: i,
570
- listboxLabel: s,
577
+ listboxLabel: l,
571
578
  multiple: n = !1,
572
579
  selectedOption: u,
573
580
  selectedOptions: b = [],
574
581
  onSelect: w,
575
- filterOption: C,
582
+ filterOption: k,
576
583
  inputValue: p,
577
584
  defaultInputValue: h,
578
- onInputChange: l,
585
+ onInputChange: a,
579
586
  noOptionsText: _,
580
- highlightFirstOption: $ = !1,
587
+ highlightFirstOption: y = !1,
581
588
  openOnFocus: f = !1,
582
- listboxMaxHeight: a,
583
- negative: y,
584
- disabled: N = !1,
589
+ listboxMaxHeight: s,
590
+ negative: x,
591
+ disabled: L = !1,
585
592
  readOnly: S = !1,
586
- ["data-testid"]: de
593
+ ["data-testid"]: se
587
594
  }) => {
588
- const A = o === "combobox", _e = ye(), F = fe(null), re = fe(null), U = fe(null), g = Xe({ options: i, highlightFirstOption: $ }), { displayInputValue: te, populateInputField: P } = Be({
595
+ const E = o === "combobox", _e = ye(), F = fe(null), te = fe(null), q = fe(null), g = Je({ options: i, highlightFirstOption: y }), { displayInputValue: oe, populateInputField: P } = Be({
589
596
  controlledInputValue: p,
590
597
  defaultInputValue: h,
591
598
  selectedOption: u,
592
- onInputChange: l
593
- }), [k, X] = xe(!1), E = () => {
594
- X(!1), g.resetHighlight();
599
+ onInputChange: a
600
+ }), [O, Q] = xe(!1), A = () => {
601
+ Q(!1), g.resetHighlight();
595
602
  };
596
- Je(F.current, E);
597
- const I = ({ eventType: t }) => {
598
- X(!0);
603
+ Qe(F.current, A);
604
+ const C = ({ eventType: t }) => {
605
+ Q(!0);
599
606
  const T = n ? void 0 : u;
600
607
  T && g.highlightSelected(T, t);
601
- }, Y = n ? b : u ? [u] : [], K = A ? Te({
608
+ }, z = n ? b : u ? [u] : [], K = E ? Te({
602
609
  options: i,
603
- searchTerm: te,
604
- filterOption: C,
610
+ searchTerm: oe,
611
+ filterOption: k,
605
612
  selectedOption: u,
606
613
  multiple: n
607
- }) : i, O = k && (!!K.length || !!_), q = (t) => de ? `${de}-${t}` : void 0, z = (t) => {
614
+ }) : i, D = O && (!!K.length || !!_), j = (t) => se ? `${se}-${t}` : void 0, G = (t) => {
608
615
  if (!(!t || t.disabled))
609
616
  if (n) {
610
- const ce = Y.some((H) => H.id === t.id) ? Y.filter((H) => H.id !== t.id) : [...Y, t];
611
- w?.(t, ce), A && (P(""), U.current?.focus());
617
+ const pe = z.some((H) => H.id === t.id) ? z.filter((H) => H.id !== t.id) : [...z, t];
618
+ w?.(t, pe), E && (P(""), q.current?.focus());
612
619
  } else
613
- w?.(t, [t]), A && P(ie(t)), E(), (A ? U : re).current?.focus();
614
- }, x = (t) => {
615
- O || I({ eventType: "KEYBOARD" });
620
+ w?.(t, [t]), E && P(re(t)), A(), (E ? q : te).current?.focus();
621
+ }, $ = (t) => {
622
+ D || C({ eventType: "KEYBOARD" });
616
623
  const T = g.findNextOption(t, K);
617
624
  g.highlightOption(T);
618
- }, j = (t) => {
619
- if (!(N || S))
625
+ }, M = (t) => {
626
+ if (!(L || S))
620
627
  switch (t.key) {
621
628
  case "ArrowUp":
622
629
  case "ArrowDown":
623
- t.preventDefault(), x(t.key);
630
+ t.preventDefault(), $(t.key);
624
631
  break;
625
632
  case "Enter": {
626
- t.preventDefault(), O && g.highlightedOption ? z(g.highlightedOption) : O || I({ eventType: "KEYBOARD" });
633
+ t.preventDefault(), D && g.highlightedOption ? G(g.highlightedOption) : D || C({ eventType: "KEYBOARD" });
627
634
  break;
628
635
  }
629
636
  case " ": {
630
- A || (t.preventDefault(), O && g.highlightedOption ? z(g.highlightedOption) : O || I({ eventType: "KEYBOARD" }));
637
+ E || (t.preventDefault(), D && g.highlightedOption ? G(g.highlightedOption) : D || C({ eventType: "KEYBOARD" }));
631
638
  break;
632
639
  }
633
640
  case "Escape":
634
- t.preventDefault(), E();
641
+ t.preventDefault(), A();
635
642
  break;
636
643
  case "Tab":
637
- E();
644
+ A();
638
645
  break;
639
646
  case "Home":
640
647
  case "End":
641
- A && E();
648
+ E && A();
642
649
  break;
643
650
  }
644
- }, J = (t) => {
645
- P(t.target.value), g.resetHighlight(), k || I({ eventType: "KEYBOARD" });
646
- }, se = () => {
647
- N || S || (k ? E() : I({ eventType: "CLICK" }));
651
+ }, W = (t) => {
652
+ P(t.target.value), g.resetHighlight(), O || C({ eventType: "KEYBOARD" });
648
653
  }, le = () => {
649
- !k && f && !N && !S && I({ eventType: "KEYBOARD" }), U.current?.select();
654
+ L || S || (O ? A() : C({ eventType: "CLICK" }));
655
+ }, ae = () => {
656
+ !O && f && !L && !S && C({ eventType: "KEYBOARD" }), q.current?.select();
650
657
  }, me = () => {
651
658
  setTimeout(() => {
652
659
  const t = document.activeElement;
653
- t !== document.body && !U.current?.contains(t) && !g.listboxRef.current?.contains(t) && !F.current?.contains(t) && (E(), A && !n && P(u ? ie(u) : ""));
660
+ t !== document.body && !q.current?.contains(t) && !g.listboxRef.current?.contains(t) && !F.current?.contains(t) && (A(), E && !n && P(u ? re(u) : ""));
654
661
  });
655
- }, oe = () => {
656
- N || S || (k ? E() : I({ eventType: "CLICK" }));
662
+ }, ne = () => {
663
+ L || S || (O ? A() : C({ eventType: "CLICK" }));
657
664
  }, V = (t) => {
658
- if (N || S) return;
665
+ if (L || S) return;
659
666
  const T = t.target.closest("button");
660
- T && T !== re.current || oe();
667
+ T && T !== te.current || ne();
661
668
  }, ge = () => {
662
- !k && f && !N && !S && I({ eventType: "KEYBOARD" });
663
- }, Q = `${e}-listbox`, Z = (t) => `${e}-listbox-item-${t.id}`, G = `--purpur-dropdown-${_e.replace(/:/g, "")}`, ae = { anchorName: G }, be = A ? null : {
669
+ !O && f && !L && !S && C({ eventType: "KEYBOARD" });
670
+ }, X = `${e}-listbox`, Z = (t) => `${e}-listbox-item-${t.id}`, U = `--purpur-dropdown-${_e.replace(/:/g, "")}`, ce = { anchorName: U }, be = E ? null : {
664
671
  onClick: V
665
672
  }, v = Oe(
666
673
  (t) => {
@@ -671,180 +678,180 @@ const Xe = ({
671
678
  }
672
679
  },
673
680
  [g.listboxRef]
674
- ), M = {
675
- "aria-label": s,
676
- "aria-expanded": O,
677
- "data-testid": q("listbox"),
678
- id: Q,
681
+ ), Y = {
682
+ "aria-label": l,
683
+ "aria-expanded": D,
684
+ "data-testid": j("listbox"),
685
+ id: X,
679
686
  ref: v,
680
687
  onMouseLeave: () => g.resetHighlight(),
681
688
  popover: "manual",
682
- negative: y,
689
+ negative: x,
683
690
  style: {
684
- ...a ? {
685
- maxHeight: typeof a == "number" ? `${a}px` : a
691
+ ...s ? {
692
+ maxHeight: typeof s == "number" ? `${s}px` : s
686
693
  } : {},
687
- positionAnchor: G
694
+ positionAnchor: U
688
695
  }
689
696
  }, R = (t, T) => {
690
- const ce = Y.some((pe) => pe.id === t.id), { highlightedOption: H } = g, we = (t.id === H?.id || $ && !H && T === 0) && !H?.isSetByClickEvent;
697
+ const pe = z.some((ie) => ie.id === t.id), { highlightedOption: H } = g, we = (t.id === H?.id || y && !H && T === 0) && !H?.isSetByClickEvent;
691
698
  return {
692
- "data-testid": q(`listbox-item-${t.id}`),
699
+ "data-testid": j(`listbox-item-${t.id}`),
693
700
  id: Z(t),
694
701
  key: t.id,
695
702
  onMouseMove: () => g.highlightByClick(t),
696
- onMouseUp: () => z(t),
697
- ref: (pe) => {
698
- pe && (g.optionRefs.current[t.id] = pe);
703
+ onMouseUp: () => G(t),
704
+ ref: (ie) => {
705
+ ie && (g.optionRefs.current[t.id] = ie);
699
706
  },
700
707
  tabIndex: -1,
701
- selected: ce,
708
+ selected: pe,
702
709
  disabled: t.disabled,
703
710
  highlighted: we,
704
711
  hovered: t.id === H?.id && !!H?.isSetByClickEvent,
705
- "aria-selected": ce
712
+ "aria-selected": pe
706
713
  };
707
- }, W = A ? {} : {
708
- ref: re,
714
+ }, J = E ? {} : {
715
+ ref: te,
709
716
  type: "button",
710
717
  role: "combobox",
711
718
  "aria-haspopup": "listbox",
712
- "aria-expanded": O,
713
- "aria-controls": Q,
714
- "aria-disabled": N,
715
- "data-testid": q("trigger"),
719
+ "aria-expanded": D,
720
+ "aria-controls": X,
721
+ "aria-disabled": L,
722
+ "data-testid": j("trigger"),
716
723
  id: `${e}-trigger`,
717
- onKeyDown: j,
724
+ onKeyDown: M,
718
725
  onFocus: ge,
719
- disabled: N,
720
- tabIndex: N ? -1 : 0,
721
- style: ae
722
- }, he = A ? {
723
- ref: U,
726
+ disabled: L,
727
+ tabIndex: L ? -1 : 0,
728
+ style: ce
729
+ }, he = E ? {
730
+ ref: q,
724
731
  role: "combobox",
725
732
  "aria-autocomplete": "list",
726
- "aria-expanded": O,
727
- "aria-controls": Q,
733
+ "aria-expanded": D,
734
+ "aria-controls": X,
728
735
  "aria-activedescendant": g.highlightedOption ? Z(g.highlightedOption) : void 0,
729
- "data-testid": q("input"),
736
+ "data-testid": j("input"),
730
737
  autoComplete: "off",
731
738
  id: `${e}-input`,
732
739
  type: "text",
733
- value: te,
734
- onChange: J,
735
- onMouseDown: se,
736
- onFocus: le,
740
+ value: oe,
741
+ onChange: W,
742
+ onMouseDown: le,
743
+ onFocus: ae,
737
744
  onBlur: me,
738
- onKeyDown: j,
739
- disabled: N,
745
+ onKeyDown: M,
746
+ disabled: L,
740
747
  readOnly: S
741
748
  } : null;
742
749
  return {
743
750
  rootRef: F,
744
751
  triggerContainerProps: be,
745
- triggerProps: W,
752
+ triggerProps: J,
746
753
  inputProps: he,
747
- listboxProps: M,
754
+ listboxProps: Y,
748
755
  getListboxItemProps: R,
749
756
  optionsToShow: K,
750
- isOpen: O,
757
+ isOpen: D,
751
758
  highlightedOption: g.highlightedOption,
752
- selectedItems: Y,
753
- anchorStyle: ae
759
+ selectedItems: z,
760
+ anchorStyle: ce
754
761
  };
755
762
  }, Pe = $e((e, o) => {
756
763
  const {
757
764
  id: i,
758
- label: s,
765
+ label: l,
759
766
  options: n,
760
767
  className: u,
761
768
  errorText: b,
762
769
  helperText: w,
763
- placeholder: C,
770
+ placeholder: k,
764
771
  negative: p = !1,
765
772
  readOnly: h = !1,
766
- disabled: l = !1,
773
+ disabled: a = !1,
767
774
  required: _ = !1,
768
- valid: $ = !1,
775
+ valid: y = !1,
769
776
  loading: f = !1,
770
- multiple: a = !1,
771
- selectedOption: y,
772
- selectedOptions: N = [],
777
+ multiple: s = !1,
778
+ selectedOption: x,
779
+ selectedOptions: L = [],
773
780
  onSelect: S,
774
- openOnFocus: de = !1,
775
- listboxMaxHeight: A,
781
+ openOnFocus: se = !1,
782
+ listboxMaxHeight: E,
776
783
  listboxLabel: _e,
777
784
  selectAllLabel: F,
778
- moreOptionsText: re,
779
- removeOptionAriaLabel: U,
785
+ moreOptionsText: te,
786
+ removeOptionAriaLabel: q,
780
787
  ["data-testid"]: g
781
- } = e, te = ye(), P = i ?? te, k = (v) => g ? `${g}-${v}` : void 0, X = !!$ && !b, E = `${P}-helper-text`, I = a ? N : y ? [y] : [], Y = Ee({
788
+ } = e, oe = ye(), P = i ?? oe, O = (v) => g ? `${g}-${v}` : void 0, Q = !!y && !b, A = `${P}-helper-text`, C = s ? L : x ? [x] : [], z = Ae({
782
789
  selectAllLabel: F,
783
- multiple: a,
790
+ multiple: s,
784
791
  options: n,
785
- selectedItems: I
792
+ selectedItems: C
786
793
  }), K = () => {
787
794
  const v = n.filter((R) => !R.disabled);
788
795
  if (v.every(
789
- (R) => I.some((W) => W.id === R.id)
796
+ (R) => C.some((J) => J.id === R.id)
790
797
  )) {
791
- const R = I.filter((W) => W.disabled);
798
+ const R = C.filter((J) => J.disabled);
792
799
  S?.(void 0, R);
793
800
  } else {
794
- const W = [...I.filter((he) => he.disabled), ...v];
795
- S?.(void 0, W);
801
+ const J = [...C.filter((he) => he.disabled), ...v];
802
+ S?.(void 0, J);
796
803
  }
797
- }, O = (v, M) => {
798
- if (v?.id === ne) {
804
+ }, D = (v, Y) => {
805
+ if (v?.id === de) {
799
806
  K();
800
807
  return;
801
808
  }
802
- S?.(v, M);
803
- }, q = Y ? [{ id: ne, label: F }, ...n] : n, z = Qe({
809
+ S?.(v, Y);
810
+ }, j = z ? [{ id: de, label: F }, ...n] : n, G = Ze({
804
811
  id: P,
805
812
  variant: "select",
806
- options: q,
807
- listboxLabel: _e || s || "Options",
808
- multiple: a,
813
+ options: j,
814
+ listboxLabel: _e || l || "Options",
815
+ multiple: s,
809
816
  negative: p,
810
- selectedOption: y,
811
- selectedOptions: N,
812
- onSelect: O,
813
- openOnFocus: de,
814
- listboxMaxHeight: A,
815
- disabled: l,
817
+ selectedOption: x,
818
+ selectedOptions: L,
819
+ onSelect: D,
820
+ openOnFocus: se,
821
+ listboxMaxHeight: E,
822
+ disabled: a,
816
823
  readOnly: h,
817
824
  "data-testid": g
818
- }), x = (v) => {
819
- z.rootRef.current = v, typeof o == "function" ? o(v) : o && (o.current = v);
825
+ }), $ = (v) => {
826
+ G.rootRef.current = v, typeof o == "function" ? o(v) : o && (o.current = v);
820
827
  }, {
821
- triggerContainerProps: j,
822
- triggerProps: J,
823
- listboxProps: se,
824
- getListboxItemProps: le,
828
+ triggerContainerProps: M,
829
+ triggerProps: W,
830
+ listboxProps: le,
831
+ getListboxItemProps: ae,
825
832
  optionsToShow: me,
826
- isOpen: oe,
833
+ isOpen: ne,
827
834
  selectedItems: V,
828
835
  anchorStyle: ge
829
- } = z, Q = {
830
- ...J
836
+ } = G, X = {
837
+ ...W
831
838
  };
832
- delete Q.style;
839
+ delete X.style;
833
840
  const Z = (v) => {
834
- const M = V.filter((R) => R.id !== v.id);
835
- S?.(v, M);
836
- }, G = a && !!F && n.length > 0 && n.every((v) => V.some((M) => M.id === v.id)), ae = a ? G ? F : V.length === 0 && C || "" : y?.label || C || "", be = m(r, u, {
841
+ const Y = V.filter((R) => R.id !== v.id);
842
+ S?.(v, Y);
843
+ }, U = s && !!F && n.length > 0 && n.every((v) => V.some((Y) => Y.id === v.id)), ce = s ? U ? F : V.length === 0 && k || "" : x?.label || k || "", be = m(r, u, {
837
844
  [`${r}--negative`]: p
838
845
  });
839
- return /* @__PURE__ */ ee("div", { ref: x, className: be, children: [
846
+ return /* @__PURE__ */ ee("div", { ref: $, className: be, children: [
840
847
  /* @__PURE__ */ d(
841
848
  De,
842
849
  {
843
850
  fieldId: P,
844
851
  htmlForSuffix: "trigger",
845
- label: s,
846
- getTestId: k,
847
- disabled: l,
852
+ label: l,
853
+ getTestId: O,
854
+ disabled: a,
848
855
  negative: p,
849
856
  required: _
850
857
  }
@@ -852,54 +859,54 @@ const Xe = ({
852
859
  /* @__PURE__ */ d("div", { className: m(`${r}__field-row`), children: /* @__PURE__ */ ee(
853
860
  "div",
854
861
  {
855
- ...j,
862
+ ...M,
856
863
  className: m(`${r}__trigger-container`, {
857
864
  [`${r}__trigger-container--error`]: !!b,
858
- [`${r}__trigger-container--is-valid`]: X,
865
+ [`${r}__trigger-container--is-valid`]: Q,
859
866
  [`${r}__trigger-container--negative`]: p,
860
- [`${r}__trigger-container--disabled`]: l,
861
- [`${r}__trigger-container--readonly`]: h && !l,
862
- [`${r}__trigger-container--has-tags`]: a && V.length > 0 && !G
867
+ [`${r}__trigger-container--disabled`]: a,
868
+ [`${r}__trigger-container--readonly`]: h && !a,
869
+ [`${r}__trigger-container--has-tags`]: s && V.length > 0 && !U
863
870
  }),
864
871
  style: ge,
865
872
  children: [
866
- a && !G && /* @__PURE__ */ d(
873
+ s && !U && /* @__PURE__ */ d(
867
874
  Le,
868
875
  {
869
876
  selectedItems: V,
870
- getTestId: k,
871
- disabled: l,
877
+ getTestId: O,
878
+ disabled: a,
872
879
  negative: p,
873
880
  onRemove: Z,
874
- moreOptionsText: re,
875
- removeOptionAriaLabel: U,
881
+ moreOptionsText: te,
882
+ removeOptionAriaLabel: q,
876
883
  isSelect: !0
877
884
  }
878
885
  ),
879
886
  /* @__PURE__ */ d(
880
887
  "button",
881
888
  {
882
- ...Q,
889
+ ...X,
883
890
  className: m(`${r}__trigger`, {
884
- [`${r}__trigger--is-valid`]: X,
891
+ [`${r}__trigger--is-valid`]: Q,
885
892
  [`${r}__trigger--negative`]: p,
886
- [`${r}__trigger--disabled`]: l,
887
- [`${r}__trigger--readonly`]: h && !l,
893
+ [`${r}__trigger--disabled`]: a,
894
+ [`${r}__trigger--readonly`]: h && !a,
888
895
  [`${r}__trigger--placeholder`]: !V.length
889
896
  }),
890
- "aria-describedby": E,
891
- children: /* @__PURE__ */ d("span", { className: m(`${r}__trigger-text`), children: ae })
897
+ "aria-describedby": A,
898
+ children: /* @__PURE__ */ d("span", { className: m(`${r}__trigger-text`), children: ce })
892
899
  }
893
900
  ),
894
901
  /* @__PURE__ */ d(
895
902
  Ne,
896
903
  {
897
- getTestId: k,
904
+ getTestId: O,
898
905
  loading: f,
899
- disabled: l,
906
+ disabled: a,
900
907
  negative: p,
901
- isValid: X,
902
- isOpen: oe,
908
+ isValid: Q,
909
+ isOpen: ne,
903
910
  readOnly: h,
904
911
  showChevronOpen: !0
905
912
  }
@@ -915,31 +922,31 @@ const Xe = ({
915
922
  ]
916
923
  }
917
924
  ) }),
918
- oe && /* @__PURE__ */ d(ue, { ...se, className: m(`${r}__listbox`), children: Re({
925
+ ne && /* @__PURE__ */ d(ue, { ...le, className: m(`${r}__listbox`), children: Re({
919
926
  optionsToShow: me,
920
- getListboxItemProps: le,
921
- multiple: a,
927
+ getListboxItemProps: ae,
928
+ multiple: s,
922
929
  negative: p,
923
930
  fieldId: P,
924
931
  selectAllLabel: F,
925
932
  selectedItems: V
926
933
  }) }),
927
934
  /* @__PURE__ */ d(
928
- Ae,
935
+ Ee,
929
936
  {
930
937
  errorText: b,
931
938
  helperText: w,
932
- helperTextId: E,
939
+ helperTextId: A,
933
940
  negative: p
934
941
  }
935
942
  )
936
943
  ] });
937
944
  });
938
945
  Pe.displayName = "DropdownSelect";
939
- const Ze = $e((e, o) => e.combobox ? /* @__PURE__ */ d(Fe, { ref: o, ...e }) : /* @__PURE__ */ d(Pe, { ref: o, ...e }));
940
- Ze.displayName = "Dropdown";
946
+ const er = $e((e, o) => e.combobox ? /* @__PURE__ */ d(Fe, { ref: o, ...e }) : /* @__PURE__ */ d(Pe, { ref: o, ...e }));
947
+ er.displayName = "Dropdown";
941
948
  export {
942
- Ze as D,
943
- Qe as u
949
+ er as D,
950
+ Ze as u
944
951
  };
945
- //# sourceMappingURL=dropdown-DJr5COdU.mjs.map
952
+ //# sourceMappingURL=dropdown-CxEElxNf.mjs.map