asma-ui-core 3.86.1 → 3.86.2
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/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/chip/StyledChip.js +28 -27
- package/dist/components/data-display/tooltip/StyledTooltip.js +76 -47
- package/dist/components/feedback/dialog/StyledDialog.js +62 -58
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +113 -105
- package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +10 -12
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +75 -67
- package/dist/components/feedback/snack-bar/StyledSnackbar.js +12 -10
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +69 -71
- package/dist/components/inputs/input-field/StyledInputField.js +10 -9
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +16 -15
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +98 -85
- package/dist/components/inputs/phone-field/useCountryPicker.js +44 -24
- package/dist/components/inputs/select/StyledSelect.js +15 -14
- package/dist/components/inputs/select/StyledSelectItem.js +4 -4
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +199 -172
- package/dist/components/navigation/listbox/Listbox.js +104 -54
- package/dist/components/navigation/menu/StyledMenu.js +22 -18
- package/dist/components/navigation/menu/StyledMenuItem.js +6 -6
- package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +26 -22
- package/dist/components/utils/copy-wrapper/CopyWrapper.module.js +2 -2
- package/dist/components/utils/popover/StyledPopover.js +102 -52
- package/dist/datetime/components/date-picker/StyledDatePicker.js +40 -34
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +5 -4
- package/dist/datetime/components/time-picker/StyledTimePicker.js +69 -56
- package/dist/helpers/focusable.js +5 -0
- package/dist/hooks/useFocusTrap.hook.js +24 -19
- package/dist/src/components/data-display/chip/StyledChip.d.ts +2 -0
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +3 -4
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts +1 -0
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +1 -1
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +5 -2
- package/dist/src/components/navigation/listbox/Listbox.d.ts +3 -2
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -2
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +2 -1
- package/dist/src/components/utils/popover/StyledPopover.d.ts +9 -2
- package/dist/src/helpers/focusable.d.ts +8 -0
- package/dist/src/hooks/useFocusTrap.hook.d.ts +2 -1
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +30 -34
- package/dist/table/components/table-footer/TablePagination.js +18 -17
- package/dist/table/components/table-footer/TableRowCountSelect.js +5 -4
- package/package.json +1 -1
|
@@ -1,143 +1,156 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { useMobileMediaQuery as
|
|
4
|
-
import { StyledDialog as
|
|
5
|
-
import { StyledPopover as
|
|
6
|
-
import { notchedOutlineClass as
|
|
1
|
+
import { cn as f } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as $ } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { useMobileMediaQuery as j } from "../../../hooks/useMediaQuery.hook.js";
|
|
4
|
+
import { StyledDialog as z } from "../../feedback/dialog/StyledDialog.js";
|
|
5
|
+
import { StyledPopover as Q } from "../../utils/popover/StyledPopover.js";
|
|
6
|
+
import { notchedOutlineClass as U } from "../field-styles.js";
|
|
7
7
|
import { StyledSearchField as W } from "../search-field/StyledSearchField.js";
|
|
8
|
-
import { CountryCodeOptions as
|
|
8
|
+
import { CountryCodeOptions as q } from "./CountryCodeOptions.js";
|
|
9
9
|
import { useCountryPicker as G } from "./useCountryPicker.js";
|
|
10
|
-
import { useEffect as K, useId as H, useRef as
|
|
11
|
-
import { Fragment as J, jsx as
|
|
12
|
-
var re = ({ dataTest: r, countries:
|
|
13
|
-
const [t,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
import { useEffect as K, useId as H, useRef as b, useState as m } from "react";
|
|
11
|
+
import { Fragment as J, jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
12
|
+
var re = ({ dataTest: r, countries: g, value: s, onChange: A, disabled: c, selectCountryLabel: w, searchPlaceholder: E, renderFlag: h, labelledBy: F, className: O }) => {
|
|
13
|
+
const [t, d] = m(!1), [P, u] = m(!1), [x, a] = m(""), [B, M] = m(null), y = b(null), v = b(null), C = b(!1), p = j(), l = `${H()}-country-listbox`, I = g.find((o) => o.iso2 === s), k = I === void 0 ? "" : `+${I.dialCode}`, e = G({
|
|
14
|
+
countries: g,
|
|
15
|
+
selectedIso2: s,
|
|
16
|
+
query: x,
|
|
17
|
+
listId: l,
|
|
18
|
+
onSelect: (o, R = !0) => {
|
|
19
|
+
A(o), R && (d(!1), a(""));
|
|
20
|
+
},
|
|
21
|
+
onDismiss: () => {
|
|
22
|
+
d(!1), a("");
|
|
23
|
+
}
|
|
24
24
|
});
|
|
25
25
|
K(() => {
|
|
26
|
-
t && !
|
|
27
|
-
}, [t,
|
|
28
|
-
|
|
26
|
+
t && !p && y.current?.focus();
|
|
27
|
+
}, [t, p]), K(() => {
|
|
28
|
+
C.current && !t && v.current?.focus(), C.current = t;
|
|
29
29
|
}, [t]);
|
|
30
|
-
const
|
|
30
|
+
const N = /* @__PURE__ */ n(q, {
|
|
31
31
|
dataTest: r,
|
|
32
|
-
visible:
|
|
33
|
-
selectedIso2:
|
|
34
|
-
activeIndex:
|
|
35
|
-
optionId:
|
|
36
|
-
onSelect:
|
|
37
|
-
listId:
|
|
38
|
-
label:
|
|
39
|
-
renderFlag:
|
|
40
|
-
}),
|
|
32
|
+
visible: e.visible,
|
|
33
|
+
selectedIso2: s,
|
|
34
|
+
activeIndex: e.activeIndex,
|
|
35
|
+
optionId: e.optionId,
|
|
36
|
+
onSelect: e.select,
|
|
37
|
+
listId: l,
|
|
38
|
+
label: w,
|
|
39
|
+
renderFlag: h
|
|
40
|
+
}), D = {
|
|
41
41
|
role: "combobox",
|
|
42
|
-
"aria-activedescendant":
|
|
42
|
+
"aria-activedescendant": e.activeIndex === null ? void 0 : e.optionId(e.activeIndex),
|
|
43
43
|
"aria-autocomplete": "list",
|
|
44
|
-
"aria-controls":
|
|
44
|
+
"aria-controls": l,
|
|
45
45
|
"aria-expanded": !0
|
|
46
|
-
},
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
ref:
|
|
46
|
+
}, S = t && !p;
|
|
47
|
+
return /* @__PURE__ */ i(J, { children: [/* @__PURE__ */ i("div", {
|
|
48
|
+
ref: M,
|
|
49
49
|
"data-testid": `${r}-shell`,
|
|
50
50
|
style: { height: 40 },
|
|
51
|
-
className:
|
|
52
|
-
children: [/* @__PURE__ */
|
|
51
|
+
className: f("group relative flex w-32 shrink-0 items-center gap-1.5 rounded px-3 text-base", c ? "cursor-not-allowed text-delta-300" : "text-delta-800"),
|
|
52
|
+
children: [/* @__PURE__ */ n("span", {
|
|
53
53
|
"aria-hidden": "true",
|
|
54
|
-
className:
|
|
55
|
-
|
|
54
|
+
className: f(U({
|
|
55
|
+
focused: P || S,
|
|
56
|
+
disabled: c,
|
|
56
57
|
notched: !1
|
|
57
|
-
}),
|
|
58
|
-
}),
|
|
58
|
+
}), O)
|
|
59
|
+
}), S ? /* @__PURE__ */ i("span", {
|
|
59
60
|
className: "relative z-[1] flex w-full items-center gap-1.5",
|
|
60
61
|
children: [
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
h?.(s, "eager"),
|
|
63
|
+
/* @__PURE__ */ n("input", {
|
|
63
64
|
ref: y,
|
|
64
65
|
role: "combobox",
|
|
65
66
|
"data-testid": `${r}-search`,
|
|
66
67
|
className: "w-12 min-w-0 border-0 bg-transparent p-0 text-base outline-none",
|
|
67
|
-
value:
|
|
68
|
+
value: x,
|
|
68
69
|
placeholder: k,
|
|
69
|
-
onChange: (
|
|
70
|
-
onKeyDown:
|
|
71
|
-
"aria-controls":
|
|
70
|
+
onChange: (o) => a(o.target.value),
|
|
71
|
+
onKeyDown: e.handleKeyDown,
|
|
72
|
+
"aria-controls": l,
|
|
72
73
|
"aria-expanded": !0,
|
|
73
|
-
"aria-activedescendant":
|
|
74
|
-
"aria-autocomplete": "list"
|
|
74
|
+
"aria-activedescendant": D["aria-activedescendant"],
|
|
75
|
+
"aria-autocomplete": "list",
|
|
76
|
+
"aria-haspopup": "listbox",
|
|
77
|
+
onFocus: () => u(!0),
|
|
78
|
+
onBlur: () => u(!1)
|
|
75
79
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ n("button", {
|
|
77
81
|
type: "button",
|
|
78
82
|
"data-testid": `${r}-collapse`,
|
|
79
|
-
|
|
83
|
+
tabIndex: -1,
|
|
84
|
+
"aria-hidden": "true",
|
|
80
85
|
"aria-expanded": !0,
|
|
81
|
-
onClick:
|
|
82
|
-
className: "ml-auto flex shrink-0 cursor-pointer border-0 bg-transparent p-0",
|
|
83
|
-
children: /* @__PURE__ */
|
|
86
|
+
onClick: e.dismiss,
|
|
87
|
+
className: "ml-auto flex shrink-0 cursor-pointer border-0 bg-transparent p-0 outline-none focus:shadow-none focus:outline-none focus:ring-0",
|
|
88
|
+
children: /* @__PURE__ */ n($, {
|
|
84
89
|
width: 20,
|
|
85
90
|
height: 20,
|
|
86
91
|
className: "flip-180"
|
|
87
92
|
})
|
|
88
93
|
})
|
|
89
94
|
]
|
|
90
|
-
}) : /* @__PURE__ */
|
|
91
|
-
ref:
|
|
95
|
+
}) : /* @__PURE__ */ i("button", {
|
|
96
|
+
ref: v,
|
|
92
97
|
type: "button",
|
|
93
98
|
"data-testid": r,
|
|
94
|
-
disabled:
|
|
99
|
+
disabled: c,
|
|
95
100
|
"aria-haspopup": "listbox",
|
|
96
101
|
"aria-expanded": t,
|
|
97
|
-
"aria-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
"aria-controls": t ? l : void 0,
|
|
103
|
+
"aria-labelledby": F,
|
|
104
|
+
role: "combobox",
|
|
105
|
+
onClick: () => d(!0),
|
|
106
|
+
onKeyDown: (o) => {
|
|
107
|
+
o.key !== "ArrowDown" && o.key !== "ArrowUp" || (o.preventDefault(), e.openWithKeyboard(o.key === "ArrowUp" ? -1 : 1), d(!0));
|
|
108
|
+
},
|
|
109
|
+
onFocus: () => u(!0),
|
|
110
|
+
onBlur: () => u(!1),
|
|
111
|
+
className: f("relative z-[1] flex w-full items-center gap-1.5 border-0 bg-transparent p-0 text-base outline-none focus:shadow-none focus:outline-none focus:ring-0", c ? "cursor-not-allowed text-delta-300" : "cursor-pointer text-delta-800"),
|
|
100
112
|
children: [
|
|
101
|
-
|
|
102
|
-
/* @__PURE__ */
|
|
113
|
+
h?.(s, "eager"),
|
|
114
|
+
/* @__PURE__ */ n("span", {
|
|
103
115
|
className: "w-12 text-left",
|
|
104
116
|
children: k
|
|
105
117
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ n($, {
|
|
107
119
|
width: 20,
|
|
108
120
|
height: 20,
|
|
109
|
-
className:
|
|
121
|
+
className: f("ml-auto shrink-0 transition-transform", t && "flip-180")
|
|
110
122
|
})
|
|
111
123
|
]
|
|
112
124
|
})]
|
|
113
|
-
}),
|
|
125
|
+
}), p ? /* @__PURE__ */ n(z, {
|
|
114
126
|
open: t,
|
|
115
|
-
onClose:
|
|
127
|
+
onClose: e.dismiss,
|
|
116
128
|
dataTest: `${r}-dialog`,
|
|
117
|
-
dialogTitle:
|
|
129
|
+
dialogTitle: w,
|
|
118
130
|
showCloseIcon: !0,
|
|
119
131
|
fullWidth: !0,
|
|
120
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ i("div", {
|
|
121
133
|
className: "flex min-h-0 flex-1 flex-col",
|
|
122
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ n("div", {
|
|
123
135
|
className: "shrink-0 p-4",
|
|
124
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ n(W, {
|
|
125
137
|
dataTest: `${r}-search`,
|
|
126
|
-
label:
|
|
127
|
-
value:
|
|
128
|
-
onChange: (
|
|
129
|
-
onClear: () =>
|
|
130
|
-
onKeyDown:
|
|
131
|
-
slotProps: { htmlInput:
|
|
138
|
+
label: E,
|
|
139
|
+
value: x,
|
|
140
|
+
onChange: (o) => a(o.target.value),
|
|
141
|
+
onClear: () => a(""),
|
|
142
|
+
onKeyDown: e.handleKeyDown,
|
|
143
|
+
slotProps: { htmlInput: D }
|
|
132
144
|
})
|
|
133
|
-
}),
|
|
145
|
+
}), N]
|
|
134
146
|
})
|
|
135
|
-
}) : /* @__PURE__ */
|
|
147
|
+
}) : /* @__PURE__ */ n(Q, {
|
|
136
148
|
open: t,
|
|
137
|
-
anchorEl:
|
|
138
|
-
onClose:
|
|
149
|
+
anchorEl: B,
|
|
150
|
+
onClose: e.dismiss,
|
|
151
|
+
tabIntoContent: !1,
|
|
139
152
|
slotProps: { paper: { className: "flex max-h-80 w-80 flex-col overflow-hidden" } },
|
|
140
|
-
children:
|
|
153
|
+
children: N
|
|
141
154
|
})] });
|
|
142
155
|
};
|
|
143
156
|
export {
|
|
@@ -1,48 +1,68 @@
|
|
|
1
|
-
import { useMemo as m, useState as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
const
|
|
6
|
-
return
|
|
1
|
+
import { useMemo as m, useState as D } from "react";
|
|
2
|
+
function w(a, c) {
|
|
3
|
+
const o = c.trim();
|
|
4
|
+
if (o.length === 0) return !0;
|
|
5
|
+
const r = o.replace(/^\+/, "").replace(/\D/g, "");
|
|
6
|
+
return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || a.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && a.dialCode.startsWith(r);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const [p,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, onDismiss: b }) {
|
|
9
|
+
const [p, s] = D(null), n = m(() => a.filter((e) => w(e, o)), [a, o]), i = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), k = (e) => `${r}-option-${e}`, g = (e) => {
|
|
10
|
+
const t = e === 1 ? n[0] : n[n.length - 1], l = n.find((d) => d.iso2 === c) ?? t;
|
|
11
|
+
l !== void 0 && s(l.iso2);
|
|
12
|
+
}, h = (e) => {
|
|
13
|
+
if (n.length === 0) return;
|
|
14
|
+
const t = n.findIndex((d) => d.iso2 === c), l = n[((i ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
|
|
15
|
+
l !== void 0 && s(l.iso2);
|
|
16
|
+
}, u = (e, t = !0) => {
|
|
17
|
+
t && s(null), v(e, t);
|
|
18
|
+
}, f = () => {
|
|
19
|
+
s(null), b();
|
|
13
20
|
};
|
|
14
21
|
return {
|
|
15
|
-
visible:
|
|
16
|
-
activeIndex:
|
|
17
|
-
optionId:
|
|
22
|
+
visible: n,
|
|
23
|
+
activeIndex: i,
|
|
24
|
+
optionId: k,
|
|
25
|
+
openWithKeyboard: g,
|
|
26
|
+
select: u,
|
|
27
|
+
dismiss: f,
|
|
18
28
|
handleKeyDown: (e) => {
|
|
19
29
|
switch (e.key) {
|
|
20
30
|
case "ArrowDown":
|
|
21
|
-
e.preventDefault(),
|
|
31
|
+
e.preventDefault(), h(1);
|
|
22
32
|
break;
|
|
23
33
|
case "ArrowUp":
|
|
24
|
-
e.preventDefault(),
|
|
34
|
+
e.preventDefault(), h(-1);
|
|
25
35
|
break;
|
|
26
36
|
case "Home": {
|
|
27
37
|
e.preventDefault();
|
|
28
|
-
const t =
|
|
29
|
-
t !== void 0 &&
|
|
38
|
+
const t = n[0];
|
|
39
|
+
t !== void 0 && s(t.iso2);
|
|
30
40
|
break;
|
|
31
41
|
}
|
|
32
42
|
case "End": {
|
|
33
43
|
e.preventDefault();
|
|
34
|
-
const t =
|
|
35
|
-
t !== void 0 &&
|
|
44
|
+
const t = n[n.length - 1];
|
|
45
|
+
t !== void 0 && s(t.iso2);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case " ": {
|
|
49
|
+
if (o !== "") break;
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
const t = i === null ? void 0 : n[i];
|
|
52
|
+
t !== void 0 && u(t.iso2, !1);
|
|
36
53
|
break;
|
|
37
54
|
}
|
|
38
55
|
case "Enter": {
|
|
39
56
|
e.preventDefault();
|
|
40
|
-
const t =
|
|
41
|
-
t !== void 0 &&
|
|
57
|
+
const t = i === null ? void 0 : n[i];
|
|
58
|
+
t !== void 0 && u(t.iso2);
|
|
42
59
|
break;
|
|
43
60
|
}
|
|
44
61
|
case "Escape":
|
|
45
|
-
e.preventDefault(),
|
|
62
|
+
e.preventDefault(), f();
|
|
63
|
+
break;
|
|
64
|
+
case "Tab":
|
|
65
|
+
f();
|
|
46
66
|
break;
|
|
47
67
|
default:
|
|
48
68
|
break;
|
|
@@ -51,5 +71,5 @@ function b({ countries: r, selectedIso2: i, query: n, listId: s, onSelect: f, on
|
|
|
51
71
|
};
|
|
52
72
|
}
|
|
53
73
|
export {
|
|
54
|
-
|
|
74
|
+
C as useCountryPicker
|
|
55
75
|
};
|
|
@@ -8,11 +8,11 @@ import { useHelperRowBudget as Ge } from "../../../helpers/useHelperRowBudget.js
|
|
|
8
8
|
import { useHelperSlot as Je } from "../../../helpers/useHelperSlot.js";
|
|
9
9
|
import { outlineClass as Qe } from "../field-styles.js";
|
|
10
10
|
import { useFormControlContext as Xe } from "../../miscellaneous/FormControlContext.js";
|
|
11
|
-
import { Children as se, cloneElement as Ze, isValidElement as
|
|
11
|
+
import { Children as se, cloneElement as Ze, isValidElement as f, useEffect as B, useId as et, useRef as tt, useState as x } from "react";
|
|
12
12
|
import { jsx as l, jsxs as L } from "react/jsx-runtime";
|
|
13
13
|
import { FloatingPortal as ot, autoUpdate as rt, flip as st, offset as nt, shift as lt, size as it, useClick as at, useDismiss as ct, useFloating as dt, useInteractions as ut, useMergeRefs as ft, useRole as pt } from "@floating-ui/react";
|
|
14
|
-
var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, errorText: ie, helperText: j, reserveHelperText: ae, expandHelperText: ce = !0, allowClear: U, disabled: de, readOnly: c, name: w, placeholder: S, displayEmpty: C, multiple:
|
|
15
|
-
const
|
|
14
|
+
var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, errorText: ie, helperText: j, reserveHelperText: ae, expandHelperText: ce = !0, allowClear: U, disabled: de, readOnly: c, name: w, placeholder: S, displayEmpty: C, multiple: d, renderValue: V, fullWidth: ue, className: fe, style: pe, sx: me, variant: be, children: q, MenuProps: ge, onFocus: he, onBlur: ye, labelId: v }) => {
|
|
15
|
+
const u = Xe(), A = `${T}-listbox`, R = be === "standard", p = le ?? u?.error ?? !1, n = de ?? u?.disabled ?? !1, Y = p ? ie ?? j : j, { show: F, role: xe } = Je("StyledSelect", p, Y, ae, c), z = et(), { fieldRef: we, rowRef: ve, rowStyle: Ae } = Ge(ce && F), [r, K] = x(!1), [k, I] = x(!1), [m, b] = x(null), [Re, W] = x(ne), O = M !== void 0, o = O ? M : Re, i = Array.isArray(o) ? o.length > 0 : o !== void 0 && o !== "" && o !== null, g = se.toArray(q), G = (e) => d ? Array.isArray(o) && o.includes(e) : e === o, s = g.flatMap((e, t) => f(e) && !e.props.disabled ? [t] : []), E = g.findIndex((e) => f(e) && G(e.props.value)), ke = (e = 1) => s.includes(E) ? E : s[e === 1 ? 0 : s.length - 1] ?? null, D = m === null ? void 0 : `${A}-option-${m}`, P = tt(null), h = (e) => {
|
|
16
16
|
K(e), e || b(null);
|
|
17
17
|
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context: N } = dt({
|
|
18
18
|
open: r,
|
|
@@ -33,15 +33,15 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
33
33
|
ct(N),
|
|
34
34
|
pt(N, { role: "listbox" })
|
|
35
35
|
]), [Q, X] = x(), _ = ze(Q), Ee = ft([Ke(Se, _), P]);
|
|
36
|
-
B(() =>
|
|
36
|
+
B(() => u?.setFocused(r || k), [
|
|
37
37
|
r,
|
|
38
38
|
k,
|
|
39
|
-
|
|
40
|
-
]), B(() =>
|
|
39
|
+
u
|
|
40
|
+
]), B(() => u?.setFilled(i || !!S || !!C), [
|
|
41
41
|
i,
|
|
42
42
|
S,
|
|
43
43
|
C,
|
|
44
|
-
|
|
44
|
+
u
|
|
45
45
|
]), B(() => {
|
|
46
46
|
if (!r) return;
|
|
47
47
|
const e = requestAnimationFrame(() => {
|
|
@@ -50,20 +50,20 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
50
50
|
});
|
|
51
51
|
return () => cancelAnimationFrame(e);
|
|
52
52
|
}, [D, r]);
|
|
53
|
-
const Z = (e, t, a = !
|
|
54
|
-
const oe =
|
|
53
|
+
const Z = (e, t, a = !d) => {
|
|
54
|
+
const oe = d ? Array.isArray(o) && o.includes(e) ? o.filter(($e) => $e !== e) : [...Array.isArray(o) ? o : [], e] : e;
|
|
55
55
|
O || W(oe), $?.({ target: {
|
|
56
56
|
value: oe,
|
|
57
57
|
name: w
|
|
58
58
|
} }, t), a && (h(!1), requestAnimationFrame(() => De.current?.focus()));
|
|
59
59
|
}, ee = () => {
|
|
60
|
-
const e =
|
|
60
|
+
const e = d ? [] : "";
|
|
61
61
|
O || W(e), $?.({ target: {
|
|
62
62
|
value: e,
|
|
63
63
|
name: w
|
|
64
64
|
} }, null), h(!1), I(!1);
|
|
65
65
|
}, Pe = se.map(q, (e, t) => {
|
|
66
|
-
if (!
|
|
66
|
+
if (!f(e)) return e;
|
|
67
67
|
const a = e.props.value;
|
|
68
68
|
return Ze(e, {
|
|
69
69
|
id: `${A}-option-${t}`,
|
|
@@ -73,7 +73,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
73
73
|
b(null), Z(a, e.props.children);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
}), Ne = g.find((e) =>
|
|
76
|
+
}), Ne = g.find((e) => f(e) && e.props.value === o), _e = V ? V(o) : d && Array.isArray(o) ? g.filter((e) => f(e) && o.includes(e.props.value)).map((e) => {
|
|
77
77
|
const t = e.props.children;
|
|
78
78
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
79
79
|
}).join(", ") : Ne?.props.children, He = (e) => {
|
|
@@ -83,7 +83,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
83
83
|
});
|
|
84
84
|
}, te = (e) => {
|
|
85
85
|
const t = m === null ? void 0 : g[m];
|
|
86
|
-
!
|
|
86
|
+
!f(t) || t.props.disabled || Z(t.props.value, t.props.children, e);
|
|
87
87
|
}, Be = (e = 1) => {
|
|
88
88
|
X(re(J.current)), b(ke(e)), K(!0);
|
|
89
89
|
}, Le = (e) => {
|
|
@@ -119,7 +119,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
119
119
|
role: "combobox",
|
|
120
120
|
"aria-haspopup": "listbox",
|
|
121
121
|
"aria-expanded": r,
|
|
122
|
-
"aria-controls": A,
|
|
122
|
+
"aria-controls": r ? A : void 0,
|
|
123
123
|
"aria-activedescendant": r ? D : void 0,
|
|
124
124
|
"aria-labelledby": v,
|
|
125
125
|
"aria-label": v ? void 0 : w,
|
|
@@ -175,6 +175,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
175
175
|
...Oe(),
|
|
176
176
|
id: A,
|
|
177
177
|
role: "listbox",
|
|
178
|
+
"aria-multiselectable": d ? !0 : void 0,
|
|
178
179
|
"aria-labelledby": v,
|
|
179
180
|
"aria-label": v ? void 0 : w,
|
|
180
181
|
..._ ? qe : {},
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { cn as c } from "../../../helpers/cn.js";
|
|
2
2
|
import { CheckIcon as d } from "../../icons/check-icon/CheckIcon.js";
|
|
3
3
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
4
|
-
var f = ({ id: r, children: o, selected: t, active:
|
|
4
|
+
var f = ({ id: r, children: o, selected: t, active: l, disabled: a, className: n, onClick: i }) => /* @__PURE__ */ m("li", {
|
|
5
5
|
id: r,
|
|
6
6
|
role: "option",
|
|
7
|
-
"aria-selected": t
|
|
7
|
+
"aria-selected": !!t,
|
|
8
8
|
"aria-disabled": a ? !0 : void 0,
|
|
9
9
|
tabIndex: -1,
|
|
10
10
|
onMouseDown: (s) => s.preventDefault(),
|
|
11
|
-
onClick: a ? void 0 :
|
|
11
|
+
onClick: a ? void 0 : i,
|
|
12
12
|
className: c("relative flex items-center gap-1 px-2 py-2.5 text-base outline-none", a ? "cursor-not-allowed text-delta-300" : "cursor-pointer text-delta-800 hover:bg-delta-50", t && "bg-gama-50", n),
|
|
13
13
|
children: [
|
|
14
|
-
|
|
14
|
+
l && /* @__PURE__ */ e("span", {
|
|
15
15
|
"aria-hidden": "true",
|
|
16
16
|
"data-select-active-indicator": !0,
|
|
17
17
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|