@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.
- package/CHANGELOG.json +12 -0
- package/CHANGELOG.md +8 -1
- package/dist/components/accordion/src/accordion-item.d.ts +3 -3
- package/dist/components/accordion/src/accordion.d.ts +1 -1
- package/dist/components/alert-badge/src/alert-badge.d.ts +1 -1
- package/dist/components/breadcrumbs/src/breadcrumbs.d.ts +1 -1
- package/dist/components/card/src/card-badge.d.ts +1 -1
- package/dist/components/card/src/card-content-container.d.ts +2 -2
- package/dist/components/card/src/card-content.d.ts +2 -2
- package/dist/components/card/src/card-cta.d.ts +2 -2
- package/dist/components/card/src/card-media-layout.d.ts +1 -1
- package/dist/components/card/src/card-root.d.ts +2 -2
- package/dist/components/container/src/container.d.ts +2 -2
- package/dist/components/counter-badge/src/counter-badge.d.ts +1 -1
- package/dist/components/cta-link/src/cta-link.d.ts +10 -10
- package/dist/components/date-range-field/src/date-range-field.d.ts +1 -1
- package/dist/components/dismissable-chip-group/src/dismissable-chip-group-item.d.ts +2 -2
- package/dist/components/drawer/src/drawer-content.d.ts +2 -2
- package/dist/components/drawer/src/drawer-trigger.d.ts +2 -2
- package/dist/components/drawer/src/drawer.d.ts +1 -1
- package/dist/components/dropdown/src/dropdown-combobox.d.ts.map +1 -1
- package/dist/components/dropdown/src/useDropdown.d.ts +2 -2
- package/dist/components/field-error-text/src/field-error-text.d.ts +1 -1
- package/dist/components/footer/src/footer-social-link.d.ts +1 -1
- package/dist/components/footer/src/footer.d.ts +4 -4
- package/dist/components/grid/src/grid.d.ts +1 -1
- package/dist/components/grid/src/grid.item.d.ts +1 -1
- package/dist/components/heading/src/heading.d.ts +1 -1
- package/dist/components/hero-banner/src/hero-banner-actions.d.ts +2 -2
- package/dist/components/hero-banner/src/hero-banner-media.d.ts +2 -2
- package/dist/components/hero-banner/src/hero-banner-types.d.ts +3 -3
- package/dist/components/label/src/label.d.ts +1 -1
- package/dist/components/listbox/src/listbox-item.d.ts +2 -2
- package/dist/components/logo/src/logo.types.d.ts +1 -1
- package/dist/components/notification/src/notification.d.ts +2 -2
- package/dist/components/pagination/src/pagination-page-selector.d.ts +1 -1
- package/dist/components/pagination/src/pagination-page-size-selector.d.ts +2 -2
- package/dist/components/pagination/src/pagination-page-trigger.d.ts +2 -2
- package/dist/components/pagination/src/pagination-pages.d.ts +1 -1
- package/dist/components/pagination/src/pagination-step-trigger.d.ts +2 -2
- package/dist/components/pagination/src/types.d.ts +2 -2
- package/dist/components/pagination/src/use-page-options.hook.d.ts +2 -2
- package/dist/components/password-field/src/password-strength.d.ts +2 -2
- package/dist/components/product-card/src/product-card.d.ts +3 -3
- package/dist/components/promotion-card/src/promotion-card.d.ts +3 -3
- package/dist/components/quantity-selector/src/quantity-selector.d.ts +1 -1
- package/dist/components/radio-button-group/src/radio-button-group-root.d.ts +3 -3
- package/dist/components/radio-card-group/src/radio-card-group.d.ts +2 -2
- package/dist/components/rich-text/src/types.d.ts +1 -1
- package/dist/components/search-field/src/search-field.d.ts +6 -6
- package/dist/components/select/src/select.d.ts +2 -2
- package/dist/components/spacer/src/spacer.d.ts +1 -1
- package/dist/components/stepper/src/stepper-container.d.ts +1 -1
- package/dist/components/stepper/src/stepper-content.d.ts +2 -2
- package/dist/components/stepper/src/stepper.d.ts +1 -1
- package/dist/components/table/src/cell-types/button-group-cell.d.ts +3 -3
- package/dist/components/table/src/story-utils/table-data.d.ts +4 -4
- package/dist/components/table/src/table-content.d.ts +2 -2
- package/dist/components/table/src/table.d.ts +2 -2
- package/dist/components/table/src/test-utils/table-data.d.ts +3 -3
- package/dist/components/table/src/types.d.ts +1 -1
- package/dist/components/tabs/src/tab-content.d.ts +1 -1
- package/dist/components/text-area/src/text-area.d.ts +1 -1
- package/dist/components/text-field/src/text-field.d.ts +1 -1
- package/dist/country-flag-icon/LICENSE.txt +0 -11
- package/dist/dropdown-B7W5fErJ.js +2 -0
- package/dist/dropdown-B7W5fErJ.js.map +1 -0
- package/dist/{dropdown-DJr5COdU.mjs → dropdown-CxEElxNf.mjs} +359 -352
- package/dist/dropdown-CxEElxNf.mjs.map +1 -0
- package/dist/dropdown.cjs.js +1 -1
- package/dist/dropdown.es.js +1 -1
- package/dist/libraries/library/src/container.d.ts +1 -1
- package/dist/libraries/library/src/content-block.d.ts +1 -1
- package/dist/libraries/library/src/toggle.d.ts +2 -2
- package/dist/libraries/theme/src/ThemeProvider.d.ts +1 -1
- package/dist/library.cjs.js +1 -1
- package/dist/library.es.js +2 -2
- package/dist/{table-CY8rjMoR.mjs → table-7-6k_wGH.mjs} +2 -2
- package/dist/{table-CY8rjMoR.mjs.map → table-7-6k_wGH.mjs.map} +1 -1
- package/dist/{table-BkXNxvjW.js → table-CllIkAkM.js} +2 -2
- package/dist/{table-BkXNxvjW.js.map → table-CllIkAkM.js.map} +1 -1
- package/dist/table.cjs.js +1 -1
- package/dist/table.es.js +1 -1
- package/package.json +21 -21
- package/dist/dropdown-DJr5COdU.mjs.map +0 -1
- package/dist/dropdown-s8FhNU5N.js +0 -2
- 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
|
|
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
|
|
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
|
|
8
|
-
import { F as
|
|
9
|
-
import { r as
|
|
10
|
-
import { l as
|
|
11
|
-
import { L as
|
|
12
|
-
import { a as
|
|
13
|
-
import { c as
|
|
14
|
-
const
|
|
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 =
|
|
58
|
+
}, m = Ge.bind(We), r = "purpur-dropdown", De = ({
|
|
59
59
|
fieldId: e,
|
|
60
60
|
htmlForSuffix: o,
|
|
61
61
|
label: i,
|
|
62
|
-
getTestId:
|
|
62
|
+
getTestId: l,
|
|
63
63
|
disabled: n,
|
|
64
64
|
negative: u,
|
|
65
65
|
required: b
|
|
66
66
|
}) => i ? /* @__PURE__ */ ee(
|
|
67
|
-
|
|
67
|
+
ze,
|
|
68
68
|
{
|
|
69
69
|
htmlFor: o ? `${e}-${o}` : e,
|
|
70
70
|
className: m(`${r}__label`),
|
|
71
|
-
"data-testid":
|
|
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:
|
|
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
|
-
|
|
89
|
+
je,
|
|
90
90
|
{
|
|
91
91
|
disabled: i,
|
|
92
92
|
size: "xxs",
|
|
93
|
-
negative:
|
|
93
|
+
negative: l,
|
|
94
94
|
"data-testid": e("spinner")
|
|
95
95
|
}
|
|
96
96
|
) : /* @__PURE__ */ ee(ke, { children: [
|
|
97
97
|
n && /* @__PURE__ */ d(
|
|
98
|
-
|
|
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
|
-
|
|
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`]:
|
|
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:
|
|
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:
|
|
136
|
+
negative: l,
|
|
137
137
|
"data-testid": o("tags"),
|
|
138
138
|
size: "sm",
|
|
139
139
|
children: [
|
|
140
|
-
p.map((
|
|
140
|
+
p.map((a) => /* @__PURE__ */ d(
|
|
141
141
|
Ie.Item,
|
|
142
142
|
{
|
|
143
|
-
id:
|
|
144
|
-
"data-testid": o(`tag-${
|
|
145
|
-
"aria-label": w ? `${w} ${
|
|
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(
|
|
147
|
+
n(a);
|
|
148
148
|
},
|
|
149
|
-
disabled: i ||
|
|
150
|
-
children:
|
|
149
|
+
disabled: i || a.disabled,
|
|
150
|
+
children: a.label
|
|
151
151
|
},
|
|
152
|
-
|
|
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
|
-
},
|
|
165
|
+
}, Ee = ({
|
|
166
166
|
errorText: e,
|
|
167
167
|
helperText: o,
|
|
168
168
|
helperTextId: i,
|
|
169
|
-
negative:
|
|
169
|
+
negative: l
|
|
170
170
|
}) => /* @__PURE__ */ ee(ke, { children: [
|
|
171
|
-
e && /* @__PURE__ */ d(
|
|
172
|
-
o && !e && /* @__PURE__ */ d(
|
|
173
|
-
] }),
|
|
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:
|
|
177
|
+
selectedItems: l
|
|
178
178
|
}) => !e || !o || i.filter((w) => !w.disabled).length === 0 ? !1 : !i.filter((w) => w.disabled).some(
|
|
179
|
-
(w) => !
|
|
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:
|
|
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
|
|
192
|
+
const k = e[0]?.id === de;
|
|
193
193
|
let p = !1;
|
|
194
|
-
if (
|
|
195
|
-
const
|
|
196
|
-
(
|
|
197
|
-
).length,
|
|
198
|
-
p =
|
|
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,
|
|
201
|
-
const { key: _, selected:
|
|
202
|
-
return h.id ===
|
|
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:
|
|
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`]:
|
|
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:
|
|
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:
|
|
254
|
+
) : /* @__PURE__ */ d(ue.Item, { ...f, selected: !!y, children: /* @__PURE__ */ d("div", { children: h.label }) }, _);
|
|
255
255
|
});
|
|
256
|
-
},
|
|
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
|
|
260
|
+
const l = o.toUpperCase().split(" ");
|
|
261
261
|
return e.filter(
|
|
262
|
-
(n) =>
|
|
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:
|
|
270
|
+
selectedOption: l,
|
|
271
271
|
multiple: n
|
|
272
|
-
}) => !n &&
|
|
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:
|
|
276
|
+
onInputChange: l
|
|
277
277
|
}) => {
|
|
278
278
|
const [n, u] = xe(
|
|
279
|
-
(typeof e == "string" ? e : o ?? (i ?
|
|
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: (
|
|
284
|
-
|
|
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:
|
|
290
|
+
label: l,
|
|
291
291
|
options: n,
|
|
292
292
|
className: u,
|
|
293
293
|
errorText: b,
|
|
294
294
|
helperText: w,
|
|
295
|
-
placeholder:
|
|
295
|
+
placeholder: k,
|
|
296
296
|
negative: p = !1,
|
|
297
297
|
readOnly: h = !1,
|
|
298
|
-
disabled:
|
|
298
|
+
disabled: a = !1,
|
|
299
299
|
required: _ = !1,
|
|
300
|
-
valid:
|
|
300
|
+
valid: y,
|
|
301
301
|
loading: f,
|
|
302
|
-
multiple:
|
|
303
|
-
selectedOption:
|
|
304
|
-
selectedOptions:
|
|
302
|
+
multiple: s = !1,
|
|
303
|
+
selectedOption: x,
|
|
304
|
+
selectedOptions: L = [],
|
|
305
305
|
onSelect: S,
|
|
306
|
-
openOnFocus:
|
|
307
|
-
listboxMaxHeight:
|
|
306
|
+
openOnFocus: se = !1,
|
|
307
|
+
listboxMaxHeight: E,
|
|
308
308
|
listboxLabel: _e,
|
|
309
309
|
filterOption: F,
|
|
310
|
-
inputValue:
|
|
311
|
-
defaultInputValue:
|
|
310
|
+
inputValue: te,
|
|
311
|
+
defaultInputValue: q,
|
|
312
312
|
onInputChange: g,
|
|
313
|
-
noOptionsText:
|
|
313
|
+
noOptionsText: oe,
|
|
314
314
|
highlightFirstOption: P = !1,
|
|
315
|
-
selectAllLabel:
|
|
316
|
-
moreOptionsText:
|
|
317
|
-
removeOptionAriaLabel:
|
|
318
|
-
["data-testid"]:
|
|
319
|
-
} = e,
|
|
320
|
-
controlledInputValue:
|
|
321
|
-
defaultInputValue:
|
|
322
|
-
selectedOption:
|
|
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
|
-
}),
|
|
324
|
+
}), le = Te({
|
|
325
325
|
options: n,
|
|
326
|
-
searchTerm:
|
|
326
|
+
searchTerm: M,
|
|
327
327
|
filterOption: F,
|
|
328
|
-
selectedOption:
|
|
329
|
-
multiple:
|
|
330
|
-
}),
|
|
331
|
-
selectAllLabel:
|
|
332
|
-
multiple:
|
|
328
|
+
selectedOption: x,
|
|
329
|
+
multiple: s
|
|
330
|
+
}), ae = Ae({
|
|
331
|
+
selectAllLabel: O,
|
|
332
|
+
multiple: s,
|
|
333
333
|
options: n,
|
|
334
|
-
selectedItems:
|
|
335
|
-
}),
|
|
336
|
-
const c = n.filter((
|
|
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
|
-
(
|
|
338
|
+
(N) => $.some((B) => B.id === N.id)
|
|
339
339
|
)) {
|
|
340
|
-
const
|
|
341
|
-
S?.(void 0,
|
|
340
|
+
const N = $.filter((B) => B.disabled);
|
|
341
|
+
S?.(void 0, N);
|
|
342
342
|
} else {
|
|
343
|
-
const B = [
|
|
343
|
+
const B = [...$.filter((ve) => ve.disabled), ...c];
|
|
344
344
|
S?.(void 0, B);
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
W("");
|
|
347
347
|
}, ge = (c) => {
|
|
348
|
-
if (c.id ===
|
|
348
|
+
if (c.id === de) {
|
|
349
349
|
V();
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
S?.(c,
|
|
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]),
|
|
356
|
+
S?.(c, [c]), W(re(c));
|
|
357
357
|
}, {
|
|
358
|
-
rootRef:
|
|
358
|
+
rootRef: X,
|
|
359
359
|
inputRef: Z,
|
|
360
|
-
inputProps:
|
|
361
|
-
listboxProps:
|
|
360
|
+
inputProps: U,
|
|
361
|
+
listboxProps: ce,
|
|
362
362
|
getListboxItemProps: be,
|
|
363
363
|
isOpen: v,
|
|
364
|
-
openListbox:
|
|
364
|
+
openListbox: Y,
|
|
365
365
|
anchorStyle: R
|
|
366
|
-
} =
|
|
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:
|
|
371
|
-
listboxLabel: _e ||
|
|
372
|
-
selectedOption:
|
|
373
|
-
disabled:
|
|
370
|
+
options: ne,
|
|
371
|
+
listboxLabel: _e || l || "Options",
|
|
372
|
+
selectedOption: s ? void 0 : x,
|
|
373
|
+
disabled: a,
|
|
374
374
|
readOnly: h,
|
|
375
|
-
openOnFocus:
|
|
376
|
-
listboxMaxHeight:
|
|
375
|
+
openOnFocus: se,
|
|
376
|
+
listboxMaxHeight: E,
|
|
377
377
|
highlightFirstOption: P,
|
|
378
|
-
closeOnSelect: !
|
|
379
|
-
noOptionsText:
|
|
378
|
+
closeOnSelect: !s,
|
|
379
|
+
noOptionsText: oe,
|
|
380
380
|
negative: p,
|
|
381
381
|
onSelect: ge,
|
|
382
|
-
"data-testid":
|
|
383
|
-
}),
|
|
384
|
-
|
|
385
|
-
}, he = (c,
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
const B =
|
|
389
|
-
return { ...
|
|
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
|
|
391
|
+
return N;
|
|
392
392
|
}, t = (c) => {
|
|
393
|
-
const
|
|
394
|
-
S?.(c,
|
|
393
|
+
const I = $.filter((N) => N.id !== c.id);
|
|
394
|
+
S?.(c, I);
|
|
395
395
|
}, T = (c) => {
|
|
396
|
-
if (
|
|
397
|
-
for (let
|
|
398
|
-
if (
|
|
399
|
-
t(
|
|
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
|
-
|
|
404
|
-
},
|
|
405
|
-
|
|
403
|
+
U?.onKeyDown?.(c);
|
|
404
|
+
}, pe = (c) => {
|
|
405
|
+
W(c.target.value), v || Y();
|
|
406
406
|
}, H = (c) => {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
|
412
|
-
|
|
413
|
-
},
|
|
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:
|
|
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:
|
|
423
|
-
getTestId:
|
|
424
|
-
disabled:
|
|
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`]:
|
|
440
|
+
[`${r}__combobox-container--is-valid`]: j,
|
|
435
441
|
[`${r}__combobox-container--negative`]: p,
|
|
436
|
-
[`${r}__combobox-container--disabled`]:
|
|
437
|
-
[`${r}__combobox-container--readonly`]: h && !
|
|
442
|
+
[`${r}__combobox-container--disabled`]: a,
|
|
443
|
+
[`${r}__combobox-container--readonly`]: h && !a
|
|
438
444
|
}),
|
|
439
445
|
style: R,
|
|
440
|
-
onClick:
|
|
446
|
+
onClick: we,
|
|
441
447
|
children: [
|
|
442
|
-
|
|
448
|
+
s && !ie && /* @__PURE__ */ d(
|
|
443
449
|
Le,
|
|
444
450
|
{
|
|
445
|
-
selectedItems:
|
|
446
|
-
getTestId:
|
|
447
|
-
disabled:
|
|
451
|
+
selectedItems: $,
|
|
452
|
+
getTestId: D,
|
|
453
|
+
disabled: a,
|
|
448
454
|
negative: p,
|
|
449
455
|
onRemove: t,
|
|
450
|
-
moreOptionsText:
|
|
451
|
-
removeOptionAriaLabel:
|
|
456
|
+
moreOptionsText: Q,
|
|
457
|
+
removeOptionAriaLabel: A
|
|
452
458
|
}
|
|
453
459
|
),
|
|
454
460
|
/* @__PURE__ */ d(
|
|
455
461
|
"input",
|
|
456
462
|
{
|
|
457
|
-
...
|
|
463
|
+
...U,
|
|
458
464
|
ref: Z,
|
|
459
465
|
id: `${K}-input`,
|
|
460
|
-
"data-testid":
|
|
466
|
+
"data-testid": D("input"),
|
|
461
467
|
onKeyDown: T,
|
|
462
|
-
onChange:
|
|
463
|
-
|
|
464
|
-
|
|
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":
|
|
475
|
+
"aria-describedby": G,
|
|
469
476
|
"aria-invalid": !!b,
|
|
470
|
-
disabled:
|
|
477
|
+
disabled: a,
|
|
471
478
|
readOnly: h
|
|
472
479
|
}
|
|
473
480
|
),
|
|
474
481
|
/* @__PURE__ */ d(
|
|
475
482
|
Ne,
|
|
476
483
|
{
|
|
477
|
-
getTestId:
|
|
484
|
+
getTestId: D,
|
|
478
485
|
loading: f,
|
|
479
|
-
disabled:
|
|
486
|
+
disabled: a,
|
|
480
487
|
negative: p,
|
|
481
|
-
isValid:
|
|
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, { ...
|
|
498
|
-
optionsToShow:
|
|
504
|
+
v && /* @__PURE__ */ d(ue, { ...ce, className: m(`${r}__listbox`), children: Re({
|
|
505
|
+
optionsToShow: ne,
|
|
499
506
|
getListboxItemProps: he,
|
|
500
|
-
multiple:
|
|
507
|
+
multiple: s,
|
|
501
508
|
negative: p,
|
|
502
509
|
fieldId: K,
|
|
503
|
-
noOptionsText:
|
|
504
|
-
selectAllLabel:
|
|
505
|
-
selectedItems:
|
|
510
|
+
noOptionsText: oe,
|
|
511
|
+
selectAllLabel: O,
|
|
512
|
+
selectedItems: $
|
|
506
513
|
}) }),
|
|
507
514
|
/* @__PURE__ */ d(
|
|
508
|
-
|
|
515
|
+
Ee,
|
|
509
516
|
{
|
|
510
517
|
errorText: b,
|
|
511
518
|
helperText: w,
|
|
512
|
-
helperTextId:
|
|
519
|
+
helperTextId: G,
|
|
513
520
|
negative: p
|
|
514
521
|
}
|
|
515
522
|
)
|
|
516
523
|
] });
|
|
517
524
|
});
|
|
518
525
|
Fe.displayName = "DropdownCombobox";
|
|
519
|
-
const
|
|
526
|
+
const Je = ({
|
|
520
527
|
options: e,
|
|
521
528
|
highlightFirstOption: o
|
|
522
529
|
}) => {
|
|
523
|
-
const i = fe(null),
|
|
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
|
|
528
|
-
(
|
|
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:
|
|
535
|
-
findNextOption: (_,
|
|
536
|
-
const f =
|
|
541
|
+
optionRefs: l,
|
|
542
|
+
findNextOption: (_, y) => {
|
|
543
|
+
const f = y.filter((x) => !x.disabled);
|
|
537
544
|
if (!f.length) return;
|
|
538
|
-
const
|
|
539
|
-
return _ === "ArrowDown" ? f[(
|
|
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(
|
|
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:
|
|
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
|
-
},
|
|
563
|
+
}, Qe = (e, o) => {
|
|
557
564
|
const i = Oe(
|
|
558
|
-
(
|
|
559
|
-
e && !e.contains(
|
|
565
|
+
(l) => {
|
|
566
|
+
e && !e.contains(l.target) && o();
|
|
560
567
|
},
|
|
561
568
|
[o, e]
|
|
562
569
|
);
|
|
563
|
-
|
|
570
|
+
Ve(() => (document.addEventListener("mousedown", i), () => {
|
|
564
571
|
document.removeEventListener("mousedown", i);
|
|
565
572
|
}), [i]);
|
|
566
|
-
},
|
|
573
|
+
}, Ze = ({
|
|
567
574
|
id: e,
|
|
568
575
|
variant: o,
|
|
569
576
|
options: i,
|
|
570
|
-
listboxLabel:
|
|
577
|
+
listboxLabel: l,
|
|
571
578
|
multiple: n = !1,
|
|
572
579
|
selectedOption: u,
|
|
573
580
|
selectedOptions: b = [],
|
|
574
581
|
onSelect: w,
|
|
575
|
-
filterOption:
|
|
582
|
+
filterOption: k,
|
|
576
583
|
inputValue: p,
|
|
577
584
|
defaultInputValue: h,
|
|
578
|
-
onInputChange:
|
|
585
|
+
onInputChange: a,
|
|
579
586
|
noOptionsText: _,
|
|
580
|
-
highlightFirstOption:
|
|
587
|
+
highlightFirstOption: y = !1,
|
|
581
588
|
openOnFocus: f = !1,
|
|
582
|
-
listboxMaxHeight:
|
|
583
|
-
negative:
|
|
584
|
-
disabled:
|
|
589
|
+
listboxMaxHeight: s,
|
|
590
|
+
negative: x,
|
|
591
|
+
disabled: L = !1,
|
|
585
592
|
readOnly: S = !1,
|
|
586
|
-
["data-testid"]:
|
|
593
|
+
["data-testid"]: se
|
|
587
594
|
}) => {
|
|
588
|
-
const
|
|
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:
|
|
593
|
-
}), [
|
|
594
|
-
|
|
599
|
+
onInputChange: a
|
|
600
|
+
}), [O, Q] = xe(!1), A = () => {
|
|
601
|
+
Q(!1), g.resetHighlight();
|
|
595
602
|
};
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
|
|
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
|
-
},
|
|
608
|
+
}, z = n ? b : u ? [u] : [], K = E ? Te({
|
|
602
609
|
options: i,
|
|
603
|
-
searchTerm:
|
|
604
|
-
filterOption:
|
|
610
|
+
searchTerm: oe,
|
|
611
|
+
filterOption: k,
|
|
605
612
|
selectedOption: u,
|
|
606
613
|
multiple: n
|
|
607
|
-
}) : i,
|
|
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
|
|
611
|
-
w?.(t,
|
|
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]),
|
|
614
|
-
},
|
|
615
|
-
|
|
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
|
-
},
|
|
619
|
-
if (!(
|
|
625
|
+
}, M = (t) => {
|
|
626
|
+
if (!(L || S))
|
|
620
627
|
switch (t.key) {
|
|
621
628
|
case "ArrowUp":
|
|
622
629
|
case "ArrowDown":
|
|
623
|
-
t.preventDefault(),
|
|
630
|
+
t.preventDefault(), $(t.key);
|
|
624
631
|
break;
|
|
625
632
|
case "Enter": {
|
|
626
|
-
t.preventDefault(),
|
|
633
|
+
t.preventDefault(), D && g.highlightedOption ? G(g.highlightedOption) : D || C({ eventType: "KEYBOARD" });
|
|
627
634
|
break;
|
|
628
635
|
}
|
|
629
636
|
case " ": {
|
|
630
|
-
|
|
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(),
|
|
641
|
+
t.preventDefault(), A();
|
|
635
642
|
break;
|
|
636
643
|
case "Tab":
|
|
637
|
-
|
|
644
|
+
A();
|
|
638
645
|
break;
|
|
639
646
|
case "Home":
|
|
640
647
|
case "End":
|
|
641
|
-
|
|
648
|
+
E && A();
|
|
642
649
|
break;
|
|
643
650
|
}
|
|
644
|
-
},
|
|
645
|
-
P(t.target.value), g.resetHighlight(),
|
|
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
|
-
|
|
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 && !
|
|
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
|
-
},
|
|
656
|
-
|
|
662
|
+
}, ne = () => {
|
|
663
|
+
L || S || (O ? A() : C({ eventType: "CLICK" }));
|
|
657
664
|
}, V = (t) => {
|
|
658
|
-
if (
|
|
665
|
+
if (L || S) return;
|
|
659
666
|
const T = t.target.closest("button");
|
|
660
|
-
T && T !==
|
|
667
|
+
T && T !== te.current || ne();
|
|
661
668
|
}, ge = () => {
|
|
662
|
-
!
|
|
663
|
-
},
|
|
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
|
-
),
|
|
675
|
-
"aria-label":
|
|
676
|
-
"aria-expanded":
|
|
677
|
-
"data-testid":
|
|
678
|
-
id:
|
|
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:
|
|
689
|
+
negative: x,
|
|
683
690
|
style: {
|
|
684
|
-
...
|
|
685
|
-
maxHeight: typeof
|
|
691
|
+
...s ? {
|
|
692
|
+
maxHeight: typeof s == "number" ? `${s}px` : s
|
|
686
693
|
} : {},
|
|
687
|
-
positionAnchor:
|
|
694
|
+
positionAnchor: U
|
|
688
695
|
}
|
|
689
696
|
}, R = (t, T) => {
|
|
690
|
-
const
|
|
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":
|
|
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: () =>
|
|
697
|
-
ref: (
|
|
698
|
-
|
|
703
|
+
onMouseUp: () => G(t),
|
|
704
|
+
ref: (ie) => {
|
|
705
|
+
ie && (g.optionRefs.current[t.id] = ie);
|
|
699
706
|
},
|
|
700
707
|
tabIndex: -1,
|
|
701
|
-
selected:
|
|
708
|
+
selected: pe,
|
|
702
709
|
disabled: t.disabled,
|
|
703
710
|
highlighted: we,
|
|
704
711
|
hovered: t.id === H?.id && !!H?.isSetByClickEvent,
|
|
705
|
-
"aria-selected":
|
|
712
|
+
"aria-selected": pe
|
|
706
713
|
};
|
|
707
|
-
},
|
|
708
|
-
ref:
|
|
714
|
+
}, J = E ? {} : {
|
|
715
|
+
ref: te,
|
|
709
716
|
type: "button",
|
|
710
717
|
role: "combobox",
|
|
711
718
|
"aria-haspopup": "listbox",
|
|
712
|
-
"aria-expanded":
|
|
713
|
-
"aria-controls":
|
|
714
|
-
"aria-disabled":
|
|
715
|
-
"data-testid":
|
|
719
|
+
"aria-expanded": D,
|
|
720
|
+
"aria-controls": X,
|
|
721
|
+
"aria-disabled": L,
|
|
722
|
+
"data-testid": j("trigger"),
|
|
716
723
|
id: `${e}-trigger`,
|
|
717
|
-
onKeyDown:
|
|
724
|
+
onKeyDown: M,
|
|
718
725
|
onFocus: ge,
|
|
719
|
-
disabled:
|
|
720
|
-
tabIndex:
|
|
721
|
-
style:
|
|
722
|
-
}, he =
|
|
723
|
-
ref:
|
|
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":
|
|
727
|
-
"aria-controls":
|
|
733
|
+
"aria-expanded": D,
|
|
734
|
+
"aria-controls": X,
|
|
728
735
|
"aria-activedescendant": g.highlightedOption ? Z(g.highlightedOption) : void 0,
|
|
729
|
-
"data-testid":
|
|
736
|
+
"data-testid": j("input"),
|
|
730
737
|
autoComplete: "off",
|
|
731
738
|
id: `${e}-input`,
|
|
732
739
|
type: "text",
|
|
733
|
-
value:
|
|
734
|
-
onChange:
|
|
735
|
-
onMouseDown:
|
|
736
|
-
onFocus:
|
|
740
|
+
value: oe,
|
|
741
|
+
onChange: W,
|
|
742
|
+
onMouseDown: le,
|
|
743
|
+
onFocus: ae,
|
|
737
744
|
onBlur: me,
|
|
738
|
-
onKeyDown:
|
|
739
|
-
disabled:
|
|
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:
|
|
752
|
+
triggerProps: J,
|
|
746
753
|
inputProps: he,
|
|
747
|
-
listboxProps:
|
|
754
|
+
listboxProps: Y,
|
|
748
755
|
getListboxItemProps: R,
|
|
749
756
|
optionsToShow: K,
|
|
750
|
-
isOpen:
|
|
757
|
+
isOpen: D,
|
|
751
758
|
highlightedOption: g.highlightedOption,
|
|
752
|
-
selectedItems:
|
|
753
|
-
anchorStyle:
|
|
759
|
+
selectedItems: z,
|
|
760
|
+
anchorStyle: ce
|
|
754
761
|
};
|
|
755
762
|
}, Pe = $e((e, o) => {
|
|
756
763
|
const {
|
|
757
764
|
id: i,
|
|
758
|
-
label:
|
|
765
|
+
label: l,
|
|
759
766
|
options: n,
|
|
760
767
|
className: u,
|
|
761
768
|
errorText: b,
|
|
762
769
|
helperText: w,
|
|
763
|
-
placeholder:
|
|
770
|
+
placeholder: k,
|
|
764
771
|
negative: p = !1,
|
|
765
772
|
readOnly: h = !1,
|
|
766
|
-
disabled:
|
|
773
|
+
disabled: a = !1,
|
|
767
774
|
required: _ = !1,
|
|
768
|
-
valid:
|
|
775
|
+
valid: y = !1,
|
|
769
776
|
loading: f = !1,
|
|
770
|
-
multiple:
|
|
771
|
-
selectedOption:
|
|
772
|
-
selectedOptions:
|
|
777
|
+
multiple: s = !1,
|
|
778
|
+
selectedOption: x,
|
|
779
|
+
selectedOptions: L = [],
|
|
773
780
|
onSelect: S,
|
|
774
|
-
openOnFocus:
|
|
775
|
-
listboxMaxHeight:
|
|
781
|
+
openOnFocus: se = !1,
|
|
782
|
+
listboxMaxHeight: E,
|
|
776
783
|
listboxLabel: _e,
|
|
777
784
|
selectAllLabel: F,
|
|
778
|
-
moreOptionsText:
|
|
779
|
-
removeOptionAriaLabel:
|
|
785
|
+
moreOptionsText: te,
|
|
786
|
+
removeOptionAriaLabel: q,
|
|
780
787
|
["data-testid"]: g
|
|
781
|
-
} = e,
|
|
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:
|
|
790
|
+
multiple: s,
|
|
784
791
|
options: n,
|
|
785
|
-
selectedItems:
|
|
792
|
+
selectedItems: C
|
|
786
793
|
}), K = () => {
|
|
787
794
|
const v = n.filter((R) => !R.disabled);
|
|
788
795
|
if (v.every(
|
|
789
|
-
(R) =>
|
|
796
|
+
(R) => C.some((J) => J.id === R.id)
|
|
790
797
|
)) {
|
|
791
|
-
const R =
|
|
798
|
+
const R = C.filter((J) => J.disabled);
|
|
792
799
|
S?.(void 0, R);
|
|
793
800
|
} else {
|
|
794
|
-
const
|
|
795
|
-
S?.(void 0,
|
|
801
|
+
const J = [...C.filter((he) => he.disabled), ...v];
|
|
802
|
+
S?.(void 0, J);
|
|
796
803
|
}
|
|
797
|
-
},
|
|
798
|
-
if (v?.id ===
|
|
804
|
+
}, D = (v, Y) => {
|
|
805
|
+
if (v?.id === de) {
|
|
799
806
|
K();
|
|
800
807
|
return;
|
|
801
808
|
}
|
|
802
|
-
S?.(v,
|
|
803
|
-
},
|
|
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:
|
|
807
|
-
listboxLabel: _e ||
|
|
808
|
-
multiple:
|
|
813
|
+
options: j,
|
|
814
|
+
listboxLabel: _e || l || "Options",
|
|
815
|
+
multiple: s,
|
|
809
816
|
negative: p,
|
|
810
|
-
selectedOption:
|
|
811
|
-
selectedOptions:
|
|
812
|
-
onSelect:
|
|
813
|
-
openOnFocus:
|
|
814
|
-
listboxMaxHeight:
|
|
815
|
-
disabled:
|
|
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
|
-
}),
|
|
819
|
-
|
|
825
|
+
}), $ = (v) => {
|
|
826
|
+
G.rootRef.current = v, typeof o == "function" ? o(v) : o && (o.current = v);
|
|
820
827
|
}, {
|
|
821
|
-
triggerContainerProps:
|
|
822
|
-
triggerProps:
|
|
823
|
-
listboxProps:
|
|
824
|
-
getListboxItemProps:
|
|
828
|
+
triggerContainerProps: M,
|
|
829
|
+
triggerProps: W,
|
|
830
|
+
listboxProps: le,
|
|
831
|
+
getListboxItemProps: ae,
|
|
825
832
|
optionsToShow: me,
|
|
826
|
-
isOpen:
|
|
833
|
+
isOpen: ne,
|
|
827
834
|
selectedItems: V,
|
|
828
835
|
anchorStyle: ge
|
|
829
|
-
} =
|
|
830
|
-
...
|
|
836
|
+
} = G, X = {
|
|
837
|
+
...W
|
|
831
838
|
};
|
|
832
|
-
delete
|
|
839
|
+
delete X.style;
|
|
833
840
|
const Z = (v) => {
|
|
834
|
-
const
|
|
835
|
-
S?.(v,
|
|
836
|
-
},
|
|
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:
|
|
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:
|
|
846
|
-
getTestId:
|
|
847
|
-
disabled:
|
|
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
|
-
...
|
|
862
|
+
...M,
|
|
856
863
|
className: m(`${r}__trigger-container`, {
|
|
857
864
|
[`${r}__trigger-container--error`]: !!b,
|
|
858
|
-
[`${r}__trigger-container--is-valid`]:
|
|
865
|
+
[`${r}__trigger-container--is-valid`]: Q,
|
|
859
866
|
[`${r}__trigger-container--negative`]: p,
|
|
860
|
-
[`${r}__trigger-container--disabled`]:
|
|
861
|
-
[`${r}__trigger-container--readonly`]: h && !
|
|
862
|
-
[`${r}__trigger-container--has-tags`]:
|
|
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
|
-
|
|
873
|
+
s && !U && /* @__PURE__ */ d(
|
|
867
874
|
Le,
|
|
868
875
|
{
|
|
869
876
|
selectedItems: V,
|
|
870
|
-
getTestId:
|
|
871
|
-
disabled:
|
|
877
|
+
getTestId: O,
|
|
878
|
+
disabled: a,
|
|
872
879
|
negative: p,
|
|
873
880
|
onRemove: Z,
|
|
874
|
-
moreOptionsText:
|
|
875
|
-
removeOptionAriaLabel:
|
|
881
|
+
moreOptionsText: te,
|
|
882
|
+
removeOptionAriaLabel: q,
|
|
876
883
|
isSelect: !0
|
|
877
884
|
}
|
|
878
885
|
),
|
|
879
886
|
/* @__PURE__ */ d(
|
|
880
887
|
"button",
|
|
881
888
|
{
|
|
882
|
-
...
|
|
889
|
+
...X,
|
|
883
890
|
className: m(`${r}__trigger`, {
|
|
884
|
-
[`${r}__trigger--is-valid`]:
|
|
891
|
+
[`${r}__trigger--is-valid`]: Q,
|
|
885
892
|
[`${r}__trigger--negative`]: p,
|
|
886
|
-
[`${r}__trigger--disabled`]:
|
|
887
|
-
[`${r}__trigger--readonly`]: h && !
|
|
893
|
+
[`${r}__trigger--disabled`]: a,
|
|
894
|
+
[`${r}__trigger--readonly`]: h && !a,
|
|
888
895
|
[`${r}__trigger--placeholder`]: !V.length
|
|
889
896
|
}),
|
|
890
|
-
"aria-describedby":
|
|
891
|
-
children: /* @__PURE__ */ d("span", { className: m(`${r}__trigger-text`), children:
|
|
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:
|
|
904
|
+
getTestId: O,
|
|
898
905
|
loading: f,
|
|
899
|
-
disabled:
|
|
906
|
+
disabled: a,
|
|
900
907
|
negative: p,
|
|
901
|
-
isValid:
|
|
902
|
-
isOpen:
|
|
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
|
-
|
|
925
|
+
ne && /* @__PURE__ */ d(ue, { ...le, className: m(`${r}__listbox`), children: Re({
|
|
919
926
|
optionsToShow: me,
|
|
920
|
-
getListboxItemProps:
|
|
921
|
-
multiple:
|
|
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
|
-
|
|
935
|
+
Ee,
|
|
929
936
|
{
|
|
930
937
|
errorText: b,
|
|
931
938
|
helperText: w,
|
|
932
|
-
helperTextId:
|
|
939
|
+
helperTextId: A,
|
|
933
940
|
negative: p
|
|
934
941
|
}
|
|
935
942
|
)
|
|
936
943
|
] });
|
|
937
944
|
});
|
|
938
945
|
Pe.displayName = "DropdownSelect";
|
|
939
|
-
const
|
|
940
|
-
|
|
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
|
-
|
|
943
|
-
|
|
949
|
+
er as D,
|
|
950
|
+
Ze as u
|
|
944
951
|
};
|
|
945
|
-
//# sourceMappingURL=dropdown-
|
|
952
|
+
//# sourceMappingURL=dropdown-CxEElxNf.mjs.map
|