se-design 1.0.84 → 1.0.85-dev.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/dist/components/Button/index.d.ts +5 -0
- package/dist/index16.js +27 -27
- package/dist/index16.js.map +1 -1
- package/dist/index19.js +121 -128
- package/dist/index19.js.map +1 -1
- package/dist/index25.js +191 -175
- package/dist/index25.js.map +1 -1
- package/dist/index4.js +66 -57
- package/dist/index4.js.map +1 -1
- package/dist/index67.js +39 -30
- package/dist/index67.js.map +1 -1
- package/package.json +1 -1
package/dist/index25.js
CHANGED
|
@@ -1,130 +1,132 @@
|
|
|
1
|
-
import n, { useState as
|
|
2
|
-
import { Popover as
|
|
1
|
+
import n, { useState as W, useRef as ie, useEffect as B, useLayoutEffect as Ke } from "react";
|
|
2
|
+
import { Popover as Fe } from "./index19.js";
|
|
3
3
|
import { Icon as de } from "./index6.js";
|
|
4
|
-
import { Checkbox as
|
|
4
|
+
import { Checkbox as Le } from "./index23.js";
|
|
5
5
|
import { Button as ue } from "./index4.js";
|
|
6
6
|
import { InputWithIcon as Oe } from "./index52.js";
|
|
7
|
-
import { useStableId as
|
|
7
|
+
import { useStableId as _ } from "./index205.js";
|
|
8
8
|
import { useCombobox as me } from "./index68.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { getFocusableElements as Be } from "./index71.js";
|
|
10
|
+
import "./index72.js";
|
|
11
|
+
import { announce as Te } from "./index75.js";
|
|
12
|
+
function b() {
|
|
13
|
+
return b = Object.assign ? Object.assign.bind() : function(t) {
|
|
14
|
+
for (var h = 1; h < arguments.length; h++) {
|
|
15
|
+
var x = arguments[h];
|
|
14
16
|
for (var w in x) ({}).hasOwnProperty.call(x, w) && (t[w] = x[w]);
|
|
15
17
|
}
|
|
16
18
|
return t;
|
|
17
|
-
},
|
|
19
|
+
}, b.apply(null, arguments);
|
|
18
20
|
}
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
+
const Ge = (t) => {
|
|
22
|
+
const h = t.selectedValue !== void 0, x = t.isOpen !== void 0, [w, fe] = W(!1), [S, z] = W(""), [ye, J] = W(() => t?.defaultSelectedValue ? Array.isArray(t?.defaultSelectedValue) ? t?.defaultSelectedValue : [t.defaultSelectedValue] : []), d = ie(null), E = ie(null), T = _(void 0, "dropdown-label"), Q = _(void 0, "dropdown-value"), V = _(void 0, "dropdown-listbox"), l = x ? t.isOpen : w, s = h ? Array.isArray(t.selectedValue) ? t.selectedValue : t.selectedValue ? [t.selectedValue] : [] : ye, $ = (e) => {
|
|
21
23
|
x || fe(e), t.onOpenChange?.(e);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
+
}, q = (e) => {
|
|
25
|
+
h || J(e);
|
|
24
26
|
}, {
|
|
25
|
-
selectBy:
|
|
26
|
-
optionsUniqueBy:
|
|
27
|
+
selectBy: g = "",
|
|
28
|
+
optionsUniqueBy: u = "",
|
|
27
29
|
displaySelected: ge = !1,
|
|
28
|
-
dropDownOptions:
|
|
29
|
-
defaultText:
|
|
30
|
-
iconColor:
|
|
31
|
-
disabled:
|
|
30
|
+
dropDownOptions: A,
|
|
31
|
+
defaultText: y = "Select",
|
|
32
|
+
iconColor: X = "var(--color-gray-700)",
|
|
33
|
+
disabled: K = !1,
|
|
32
34
|
dropdownClassName: pe = "",
|
|
33
|
-
hasError:
|
|
35
|
+
hasError: G = !1,
|
|
34
36
|
errorMessage: be = "",
|
|
35
|
-
customDropdownContent:
|
|
37
|
+
customDropdownContent: Y = null,
|
|
36
38
|
isBorderless: he = !1,
|
|
37
|
-
shouldShowSearch:
|
|
39
|
+
shouldShowSearch: i = !1,
|
|
38
40
|
showSearchIcon: ve = !0,
|
|
39
|
-
searchPlaceholder:
|
|
40
|
-
searchResultEmptyMessage:
|
|
41
|
-
ariaLabel:
|
|
41
|
+
searchPlaceholder: Z = "Search...",
|
|
42
|
+
searchResultEmptyMessage: C = "No results found",
|
|
43
|
+
ariaLabel: v = "",
|
|
42
44
|
customSelectedValue: R = "",
|
|
43
|
-
isWithPortal:
|
|
45
|
+
isWithPortal: M = !1,
|
|
44
46
|
firstOptionAsHeading: ee = !1
|
|
45
47
|
} = t;
|
|
46
|
-
|
|
47
|
-
if (!
|
|
48
|
+
B(() => {
|
|
49
|
+
if (!h) {
|
|
48
50
|
const e = t?.defaultSelectedValue ? Array.isArray(t?.defaultSelectedValue) ? t?.defaultSelectedValue : [t.defaultSelectedValue] : [];
|
|
49
|
-
|
|
51
|
+
J(e);
|
|
50
52
|
}
|
|
51
|
-
}, [t?.defaultSelectedValue,
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
t.popoverElementRef && (t.popoverElementRef.current =
|
|
53
|
+
}, [t?.defaultSelectedValue, h]), B(() => {
|
|
54
|
+
l || z("");
|
|
55
|
+
}, [l]), B(() => {
|
|
56
|
+
l && i && E.current && requestAnimationFrame(() => E.current?.focus());
|
|
57
|
+
}, [l, i]), Ke(() => {
|
|
58
|
+
t.popoverElementRef && (t.popoverElementRef.current = d.current?.element ?? null);
|
|
57
59
|
});
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
+
const c = t?.type === "multi-select", xe = () => S.trim() ? (A || []).filter((e) => (e?.[g]?.toString().toLowerCase() || "").includes(S.toLowerCase())) : A || [], F = (e) => {
|
|
61
|
+
q([e]), $(!1), t?.onOptionClick?.(e), requestAnimationFrame(() => {
|
|
60
62
|
requestAnimationFrame(() => {
|
|
61
|
-
|
|
63
|
+
d.current?.focusTrigger();
|
|
62
64
|
});
|
|
63
65
|
});
|
|
64
|
-
},
|
|
65
|
-
listboxProps:
|
|
66
|
+
}, a = xe(), {
|
|
67
|
+
listboxProps: H,
|
|
66
68
|
getOptionProps: we,
|
|
67
|
-
highlightedIndex:
|
|
69
|
+
highlightedIndex: I,
|
|
68
70
|
setHighlightedIndex: te,
|
|
69
|
-
containerProps:
|
|
70
|
-
inputProps:
|
|
71
|
+
containerProps: j,
|
|
72
|
+
inputProps: L,
|
|
71
73
|
isKeyboardFocused: Se
|
|
72
74
|
} = me({
|
|
73
|
-
items:
|
|
75
|
+
items: c ? [] : a,
|
|
74
76
|
// Only use for single-select
|
|
75
|
-
isOpen:
|
|
76
|
-
onOpenChange:
|
|
77
|
+
isOpen: l && !c,
|
|
78
|
+
onOpenChange: $,
|
|
77
79
|
onSelect: (e) => {
|
|
78
|
-
|
|
80
|
+
F(e);
|
|
79
81
|
},
|
|
80
|
-
listboxId:
|
|
81
|
-
disabled:
|
|
82
|
-
hasItems:
|
|
82
|
+
listboxId: V,
|
|
83
|
+
disabled: c || K,
|
|
84
|
+
hasItems: a.length > 0
|
|
83
85
|
}), {
|
|
84
|
-
inputProps:
|
|
85
|
-
listboxProps:
|
|
86
|
-
containerProps:
|
|
87
|
-
highlightedIndex:
|
|
86
|
+
inputProps: U,
|
|
87
|
+
listboxProps: D,
|
|
88
|
+
containerProps: k,
|
|
89
|
+
highlightedIndex: P,
|
|
88
90
|
setHighlightedIndex: Ee,
|
|
89
91
|
isKeyboardFocused: Ce
|
|
90
92
|
} = me({
|
|
91
|
-
items:
|
|
92
|
-
isOpen:
|
|
93
|
-
onOpenChange:
|
|
93
|
+
items: c ? a : [],
|
|
94
|
+
isOpen: l && c,
|
|
95
|
+
onOpenChange: $,
|
|
94
96
|
onSelect: () => {
|
|
95
97
|
},
|
|
96
|
-
listboxId:
|
|
97
|
-
disabled: !
|
|
98
|
+
listboxId: V,
|
|
99
|
+
disabled: !c,
|
|
98
100
|
loop: !1,
|
|
99
|
-
hasItems:
|
|
101
|
+
hasItems: a.length > 0,
|
|
100
102
|
closeOnTab: !1
|
|
101
103
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
B(() => {
|
|
105
|
+
l && a.length === 0 && (S.trim() || A?.length === 0) && Te(C, {
|
|
104
106
|
assertiveness: "polite",
|
|
105
107
|
batchId: "dropdown-empty-state",
|
|
106
108
|
delay: 300
|
|
107
109
|
});
|
|
108
|
-
}, [
|
|
109
|
-
const Ie = (e, o = !1) =>
|
|
110
|
-
|
|
110
|
+
}, [a.length, l, S, A?.length]);
|
|
111
|
+
const Ie = (e, o = !1) => c ? y : o && R ? R : e?.[g] || y, De = () => {
|
|
112
|
+
q([]), t?.onClear?.();
|
|
111
113
|
}, oe = (e, o = !1) => {
|
|
112
114
|
if (t?.renderOptionChip)
|
|
113
115
|
return t?.renderOptionChip(e, o);
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
+
if (c && s?.length > 0) {
|
|
117
|
+
const f = s[0]?.[g] || "", N = s.length - 1;
|
|
116
118
|
return /* @__PURE__ */ n.createElement("div", {
|
|
117
119
|
className: "option-chip flex items-center w-full"
|
|
118
120
|
}, /* @__PURE__ */ n.createElement("div", {
|
|
119
|
-
className: `${
|
|
120
|
-
}, `${
|
|
121
|
+
className: `${N > 0 ? "w-full" : "flex-1"} truncate`
|
|
122
|
+
}, `${y}: ${f}`), N > 0 && /* @__PURE__ */ n.createElement("div", {
|
|
121
123
|
className: "flex-shrink-0"
|
|
122
|
-
}, "+",
|
|
124
|
+
}, "+", N));
|
|
123
125
|
}
|
|
124
|
-
const
|
|
126
|
+
const r = Ie(e, o), m = !!t?.label || !!t?.ariaLabelledBy, p = o && y && e?.[g] && !R && !m;
|
|
125
127
|
return /* @__PURE__ */ n.createElement("p", {
|
|
126
128
|
className: "option-chip flex flex-1 items-center justify-between"
|
|
127
|
-
},
|
|
129
|
+
}, p ? `${y}: ${r}` : r);
|
|
128
130
|
}, ne = (e) => /* @__PURE__ */ n.createElement("div", {
|
|
129
131
|
className: " w-full relative flex items-center border-b border-[var(--color-gray-300)]"
|
|
130
132
|
}, /* @__PURE__ */ n.createElement(Oe, {
|
|
@@ -136,8 +138,8 @@ const Je = (t) => {
|
|
|
136
138
|
}
|
|
137
139
|
} : void 0,
|
|
138
140
|
value: S,
|
|
139
|
-
onChange: (o) =>
|
|
140
|
-
placeholder:
|
|
141
|
+
onChange: (o) => z(o),
|
|
142
|
+
placeholder: Z,
|
|
141
143
|
style: {
|
|
142
144
|
margin: 0,
|
|
143
145
|
gap: 0
|
|
@@ -148,97 +150,97 @@ const Je = (t) => {
|
|
|
148
150
|
outline: "none"
|
|
149
151
|
},
|
|
150
152
|
automationId: "se-design-dropdown-search",
|
|
151
|
-
ariaLabel:
|
|
152
|
-
inputRef:
|
|
153
|
+
ariaLabel: Z,
|
|
154
|
+
inputRef: E,
|
|
153
155
|
inputProps: e
|
|
154
|
-
})), re = () => ne(
|
|
155
|
-
...
|
|
156
|
+
})), re = () => ne(c ? {
|
|
157
|
+
...U,
|
|
156
158
|
onKeyDown: (e) => se(e, !0)
|
|
157
159
|
} : {
|
|
158
|
-
...
|
|
160
|
+
...L,
|
|
159
161
|
onKeyDown: (e) => {
|
|
160
|
-
|
|
162
|
+
L.onKeyDown(e), e.key === "Escape" && requestAnimationFrame(() => d.current?.focusTrigger());
|
|
161
163
|
}
|
|
162
164
|
}), ae = (e, o) => {
|
|
163
|
-
const
|
|
164
|
-
return /* @__PURE__ */ n.createElement("div",
|
|
165
|
+
const r = e[g], m = s[0]?.[g] || y, p = u?.length ? e[u] == s[0]?.[u] : !0, f = ge && r === m && p, N = I === o, Ae = c ? {} : we(o, f);
|
|
166
|
+
return /* @__PURE__ */ n.createElement("div", b({
|
|
165
167
|
key: e.id || e.value,
|
|
166
|
-
className: `option break-words px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center justify-between ${
|
|
167
|
-
onClick: () =>
|
|
168
|
-
onKeyDown: (
|
|
169
|
-
|
|
168
|
+
className: `option break-words px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center justify-between ${f ? "selected" : ""} ${N ? `bg-[var(--color-gray-100)]${Se ? " outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]" : ""}` : ""}`,
|
|
169
|
+
onClick: () => F(e),
|
|
170
|
+
onKeyDown: (O) => {
|
|
171
|
+
O.key === "Enter" || O.key === " " ? (O.preventDefault(), F(e)) : O.key === "Escape" && requestAnimationFrame(() => d.current?.focusTrigger());
|
|
170
172
|
},
|
|
171
173
|
tabIndex: -1,
|
|
172
174
|
"data-automation-id": `dropdown-option-${e?.automationId || o}`
|
|
173
175
|
}, Ae, {
|
|
174
|
-
"aria-selected":
|
|
176
|
+
"aria-selected": f ? "true" : "false"
|
|
175
177
|
}), oe({
|
|
176
178
|
...e,
|
|
177
|
-
isOptionSelected:
|
|
178
|
-
}, !1),
|
|
179
|
+
isOptionSelected: f
|
|
180
|
+
}, !1), f && /* @__PURE__ */ n.createElement(de, {
|
|
179
181
|
name: "checkmark",
|
|
180
|
-
stroke:
|
|
182
|
+
stroke: X
|
|
181
183
|
}));
|
|
182
184
|
}, ke = () => /* @__PURE__ */ n.createElement(n.Fragment, null, t?.label && ee && /* @__PURE__ */ n.createElement("div", {
|
|
183
185
|
"aria-hidden": "true",
|
|
184
186
|
className: "px-3 pt-2 pb-1 text-[var(--color-gray-650)] text-xs cursor-default select-none"
|
|
185
|
-
}, t.label),
|
|
186
|
-
className: `dropdown-content dropdown-options${
|
|
187
|
-
},
|
|
188
|
-
...
|
|
189
|
-
"aria-label": `${
|
|
187
|
+
}, t.label), i && re(), /* @__PURE__ */ n.createElement("div", b({
|
|
188
|
+
className: `dropdown-content dropdown-options${i ? "" : " flex flex-col max-h-80 overflow-y-auto"}`
|
|
189
|
+
}, i ? {} : {
|
|
190
|
+
...H,
|
|
191
|
+
"aria-label": `${y} options`,
|
|
190
192
|
style: {
|
|
191
193
|
outline: "none"
|
|
192
194
|
},
|
|
193
195
|
tabIndex: -1,
|
|
194
|
-
"aria-activedescendant":
|
|
196
|
+
"aria-activedescendant": L["aria-activedescendant"],
|
|
195
197
|
onKeyDown: (e) => {
|
|
196
|
-
if (
|
|
197
|
-
e.preventDefault(),
|
|
198
|
+
if (j.onKeyDownCapture?.(e), e.key === " ") {
|
|
199
|
+
e.preventDefault(), I >= 0 && a[I] && F(a[I]);
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
200
|
-
|
|
202
|
+
L.onKeyDown(e);
|
|
201
203
|
},
|
|
202
204
|
onFocus: () => {
|
|
203
|
-
|
|
205
|
+
I === -1 && a.length > 0 && te(0);
|
|
204
206
|
}
|
|
205
|
-
}),
|
|
207
|
+
}), i ? /* @__PURE__ */ n.createElement("div", b({
|
|
206
208
|
className: "flex flex-col max-h-80 overflow-y-auto",
|
|
207
|
-
"aria-label": `${
|
|
208
|
-
},
|
|
209
|
+
"aria-label": `${y} options`
|
|
210
|
+
}, H), a.length > 0 ? a.map((e, o) => ae(e, o)) : /* @__PURE__ */ n.createElement("div", {
|
|
209
211
|
className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
|
|
210
|
-
},
|
|
212
|
+
}, C)) : a.length > 0 ? a.map((e, o) => ae(e, o)) : /* @__PURE__ */ n.createElement("div", {
|
|
211
213
|
className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
|
|
212
|
-
},
|
|
213
|
-
let
|
|
214
|
-
e ?
|
|
214
|
+
}, C))), le = (e, o) => {
|
|
215
|
+
let r = [];
|
|
216
|
+
e ? r = [...s, o] : r = s?.filter((m) => m[u] !== o[u]), q(r);
|
|
215
217
|
}, Pe = () => {
|
|
216
|
-
|
|
218
|
+
d.current?.togglePopover(), d.current?.focusTrigger(), t?.onApply?.(s);
|
|
217
219
|
}, se = (e, o = !1) => {
|
|
218
220
|
if (!(o && e.key === " ")) {
|
|
219
221
|
if (e.key === "Enter" || e.key === " ") {
|
|
220
|
-
if (e.preventDefault(),
|
|
221
|
-
const
|
|
222
|
-
le(!
|
|
222
|
+
if (e.preventDefault(), P >= 0 && P < a.length) {
|
|
223
|
+
const r = a[P], m = s.some((p) => p[u] === r[u]);
|
|
224
|
+
le(!m, r);
|
|
223
225
|
}
|
|
224
226
|
return;
|
|
225
227
|
}
|
|
226
|
-
|
|
228
|
+
U.onKeyDown(e), e.key === "Escape" && (e.stopPropagation(), requestAnimationFrame(() => d.current?.focusTrigger()));
|
|
227
229
|
}
|
|
228
|
-
},
|
|
229
|
-
const
|
|
230
|
+
}, ce = (e, o) => {
|
|
231
|
+
const r = s.some((f) => f[u] === e[u]), m = `${V}-option-${o}`, p = P === o;
|
|
230
232
|
return /* @__PURE__ */ n.createElement("div", {
|
|
231
233
|
key: e.id || e.value,
|
|
232
|
-
id:
|
|
234
|
+
id: m,
|
|
233
235
|
role: "option",
|
|
234
|
-
"aria-selected":
|
|
235
|
-
className: `option px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center gap-2 ${
|
|
236
|
-
onClick: () => le(!
|
|
236
|
+
"aria-selected": r,
|
|
237
|
+
className: `option px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center gap-2 ${p ? `bg-[var(--color-gray-100)]${Ce ? " outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]" : ""}` : ""}`,
|
|
238
|
+
onClick: () => le(!r, e),
|
|
237
239
|
"data-automation-id": `dropdown-option-${e?.automationId || o}`
|
|
238
|
-
}, /* @__PURE__ */ n.createElement(
|
|
240
|
+
}, /* @__PURE__ */ n.createElement(Le, {
|
|
239
241
|
tabIndex: -1,
|
|
240
242
|
ariaHidden: !0,
|
|
241
|
-
checked:
|
|
243
|
+
checked: r,
|
|
242
244
|
onChange: () => {
|
|
243
245
|
},
|
|
244
246
|
className: "pointer-events-none"
|
|
@@ -249,38 +251,48 @@ const Je = (t) => {
|
|
|
249
251
|
onKeyDown: (e) => {
|
|
250
252
|
e.key === "Tab" && e.stopPropagation();
|
|
251
253
|
}
|
|
252
|
-
},
|
|
253
|
-
className: `dropdown-content dropdown-options${
|
|
254
|
-
},
|
|
255
|
-
...
|
|
256
|
-
"aria-label": `${
|
|
254
|
+
}, i && re(), /* @__PURE__ */ n.createElement("div", b({
|
|
255
|
+
className: `dropdown-content dropdown-options${i ? "" : " flex flex-col max-h-80 overflow-y-auto"}`
|
|
256
|
+
}, i ? {} : {
|
|
257
|
+
...D,
|
|
258
|
+
"aria-label": `${y} options`,
|
|
257
259
|
"aria-multiselectable": "true",
|
|
258
260
|
style: {
|
|
259
261
|
outline: "none"
|
|
260
262
|
},
|
|
261
263
|
tabIndex: -1,
|
|
262
|
-
"aria-activedescendant":
|
|
264
|
+
"aria-activedescendant": U["aria-activedescendant"],
|
|
263
265
|
onKeyDown: (e) => se(e, !1),
|
|
264
266
|
onFocus: () => {
|
|
265
|
-
|
|
267
|
+
P === -1 && a.length > 0 && Ee(0);
|
|
266
268
|
}
|
|
267
|
-
}),
|
|
269
|
+
}), i ? /* @__PURE__ */ n.createElement("div", b({
|
|
268
270
|
className: "flex flex-col max-h-80 overflow-y-auto"
|
|
269
|
-
},
|
|
270
|
-
"aria-label": `${
|
|
271
|
+
}, D, {
|
|
272
|
+
"aria-label": `${y} options`,
|
|
271
273
|
"aria-multiselectable": "true"
|
|
272
|
-
}),
|
|
274
|
+
}), a.length > 0 ? a.map((e, o) => ce(e, o)) : /* @__PURE__ */ n.createElement("div", {
|
|
273
275
|
className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
|
|
274
|
-
},
|
|
276
|
+
}, C)) : a.length > 0 ? a.map((e, o) => ce(e, o)) : /* @__PURE__ */ n.createElement("div", {
|
|
275
277
|
className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
|
|
276
|
-
},
|
|
278
|
+
}, C)), /* @__PURE__ */ n.createElement("div", {
|
|
277
279
|
className: "flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]",
|
|
278
280
|
onKeyDown: (e) => {
|
|
279
281
|
if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") {
|
|
280
282
|
e.stopPropagation();
|
|
281
283
|
return;
|
|
282
284
|
}
|
|
283
|
-
e.key === "Tab" && e.shiftKey
|
|
285
|
+
if (e.key === "Tab" && !e.shiftKey) {
|
|
286
|
+
const o = e.currentTarget.querySelector('[data-automation-id="se-design-dropdown-apply-button"]');
|
|
287
|
+
if (document.activeElement === o && (e.stopPropagation(), d.current?.togglePopover(), M)) {
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
const r = d.current?.element, m = Be({
|
|
290
|
+
container: document.body,
|
|
291
|
+
filterHidden: !0
|
|
292
|
+
}), p = r ? m.indexOf(r) : -1, f = m[p + 1];
|
|
293
|
+
f ? f.focus() : r?.focus();
|
|
294
|
+
}
|
|
295
|
+
} else e.key === "Tab" && e.shiftKey && (e.preventDefault(), e.stopPropagation(), i ? E.current?.focus() : D.ref.current?.focus());
|
|
284
296
|
}
|
|
285
297
|
}, /* @__PURE__ */ n.createElement(ue, {
|
|
286
298
|
label: "Clear",
|
|
@@ -295,94 +307,98 @@ const Je = (t) => {
|
|
|
295
307
|
onClick: Pe,
|
|
296
308
|
automationId: "se-design-dropdown-apply-button"
|
|
297
309
|
}))), Ve = () => {
|
|
298
|
-
const e =
|
|
310
|
+
const e = l ? "border-[var(--color-blue-500)]" : K ? "border-[var(--color-gray-300)]" : "border-[var(--color-gray-600)]", o = G ? "border-[var(--color-red-500)]" : "", r = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${he ? "border-0" : `border rounded-md ${o || e}`} flex items-center ${pe}`;
|
|
299
311
|
return /* @__PURE__ */ n.createElement("div", {
|
|
300
|
-
className:
|
|
312
|
+
className: r
|
|
301
313
|
}, /* @__PURE__ */ n.createElement("div", {
|
|
302
|
-
id:
|
|
314
|
+
id: Q,
|
|
303
315
|
className: "flex-1 min-w-0",
|
|
304
316
|
"data-automation-id": t?.dropDownSelectAutomationId || "selected-dropdown-value"
|
|
305
|
-
}, oe(
|
|
317
|
+
}, oe(s[0], !0)), /* @__PURE__ */ n.createElement("div", {
|
|
306
318
|
className: "flex-shrink-0 ml-2",
|
|
307
319
|
"aria-hidden": "true"
|
|
308
320
|
}, /* @__PURE__ */ n.createElement(de, {
|
|
309
321
|
name: "chevron",
|
|
310
|
-
rotation:
|
|
322
|
+
rotation: l ? "180" : "0",
|
|
311
323
|
className: "transition-transform",
|
|
312
|
-
stroke:
|
|
324
|
+
stroke: X
|
|
313
325
|
})));
|
|
314
326
|
}, $e = () => {
|
|
315
|
-
const e =
|
|
316
|
-
return
|
|
327
|
+
const e = s[0]?.[g];
|
|
328
|
+
return v && e ? `${v}, ${e}` : v || y || "Select option";
|
|
317
329
|
};
|
|
318
330
|
return /* @__PURE__ */ n.createElement("div", {
|
|
319
331
|
className: `se-design-dropdown-container${t?.className ? ` ${t?.className}` : ""}`,
|
|
320
332
|
style: t?.style
|
|
321
333
|
}, t?.label ? /* @__PURE__ */ n.createElement("div", {
|
|
322
|
-
id:
|
|
334
|
+
id: T,
|
|
323
335
|
className: `se-design-dropdown-label ${ee ? "sr-only" : "mb-[3px] text-[var(--color-gray-700)] text-sm"}`
|
|
324
|
-
}, t?.label) : !t?.ariaLabelledBy &&
|
|
325
|
-
id:
|
|
336
|
+
}, t?.label) : !t?.ariaLabelledBy && v ? /* @__PURE__ */ n.createElement("span", {
|
|
337
|
+
id: T,
|
|
326
338
|
className: "sr-only"
|
|
327
|
-
},
|
|
339
|
+
}, v) : null, /* @__PURE__ */ n.createElement("div", b({
|
|
328
340
|
style: t?.style,
|
|
329
|
-
className: `${
|
|
330
|
-
},
|
|
341
|
+
className: `${K ? "bg-[var(--color-gray-50)] rounded-md cursor-not-allowed" : ""}`
|
|
342
|
+
}, c ? {
|
|
331
343
|
// Multi-select: only spread focus-tracking handlers for isKeyboardFocused.
|
|
332
344
|
// Dismiss is handled by Popover — don't spread onBlurCapture.
|
|
333
|
-
onPointerMove:
|
|
334
|
-
onPointerDown:
|
|
335
|
-
onPointerUp:
|
|
336
|
-
onFocusCapture:
|
|
345
|
+
onPointerMove: k.onPointerMove,
|
|
346
|
+
onPointerDown: k.onPointerDown,
|
|
347
|
+
onPointerUp: k.onPointerUp,
|
|
348
|
+
onFocusCapture: k.onFocusCapture,
|
|
337
349
|
onKeyDownCapture: (e) => {
|
|
338
|
-
e.key === "Escape" &&
|
|
350
|
+
if (e.key === "Escape" && l && (e.stopPropagation(), d.current?.focusTrigger()), (e.key === "ArrowDown" || e.key === "ArrowUp") && l) {
|
|
351
|
+
const o = i ? E.current : D.ref.current;
|
|
352
|
+
o && document.activeElement !== o && !o.contains(document.activeElement) && o.focus();
|
|
353
|
+
}
|
|
354
|
+
k.onKeyDownCapture?.(e);
|
|
339
355
|
}
|
|
340
356
|
} : {
|
|
341
|
-
...
|
|
357
|
+
...j,
|
|
342
358
|
onKeyDownCapture: (e) => {
|
|
343
|
-
(e.key === "Escape" || e.key === "Tab") &&
|
|
359
|
+
(e.key === "Escape" || e.key === "Tab") && l && (e.stopPropagation(), d.current?.focusTrigger()), j.onKeyDownCapture?.(e);
|
|
344
360
|
},
|
|
345
361
|
// Portal content lives in document.body — focus moving into it looks like "focus out" to
|
|
346
362
|
// the container's blur handler, causing immediate close. Suppress it; the Popover's own
|
|
347
363
|
// onBlur handler checks both source and portal content and handles dismissal correctly.
|
|
348
|
-
...
|
|
364
|
+
...M ? {
|
|
349
365
|
onBlurCapture: void 0
|
|
350
366
|
} : {}
|
|
351
|
-
}), /* @__PURE__ */ n.createElement(
|
|
352
|
-
ref:
|
|
353
|
-
isPopoverOpen:
|
|
354
|
-
isWithPortal:
|
|
355
|
-
renderPopoverContents:
|
|
367
|
+
}), /* @__PURE__ */ n.createElement(Fe, b({
|
|
368
|
+
ref: d,
|
|
369
|
+
isPopoverOpen: l,
|
|
370
|
+
isWithPortal: M,
|
|
371
|
+
renderPopoverContents: Y || (c ? Ne : ke),
|
|
356
372
|
contentWidth: "full",
|
|
357
373
|
popoverContentStyleProperty: t.popoverContentStyleProperty,
|
|
358
374
|
renderPopoverSrcElement: t.renderSrcElement ? () => t.renderSrcElement({
|
|
359
|
-
isOpen:
|
|
360
|
-
selectedValue:
|
|
375
|
+
isOpen: l,
|
|
376
|
+
selectedValue: s
|
|
361
377
|
}) : Ve,
|
|
362
378
|
onPopoverToggle: (e) => {
|
|
363
|
-
if (
|
|
364
|
-
const o =
|
|
379
|
+
if ($(e), e && !c && s.length > 0) {
|
|
380
|
+
const o = a.findIndex((r) => u ? r[u] === s[0]?.[u] : r[g] === s[0]?.[g]);
|
|
365
381
|
o >= 0 && te(o);
|
|
366
382
|
}
|
|
367
|
-
if (e && !
|
|
368
|
-
const o =
|
|
383
|
+
if (e && !i) {
|
|
384
|
+
const o = c ? D.ref : H.ref;
|
|
369
385
|
requestAnimationFrame(() => requestAnimationFrame(() => o.current?.focus()));
|
|
370
386
|
}
|
|
371
387
|
},
|
|
372
|
-
disabled:
|
|
388
|
+
disabled: K,
|
|
373
389
|
automationId: t?.dropDownSrcAutomationId,
|
|
374
390
|
popoverContentAutomationId: t?.dropDownContentAutomationId,
|
|
375
|
-
ariaLabelledBy: t?.label || t?.ariaLabelledBy ||
|
|
376
|
-
ariaLabel: !t?.label && !
|
|
391
|
+
ariaLabelledBy: t?.label || t?.ariaLabelledBy || v ? [t?.label || !t?.ariaLabelledBy && v ? T : t?.ariaLabelledBy, Q].filter(Boolean).join(" ") : void 0,
|
|
392
|
+
ariaLabel: !t?.label && !v && !t?.ariaLabelledBy ? $e() : void 0,
|
|
377
393
|
sourceRole: "button",
|
|
378
394
|
"aria-haspopup": "listbox"
|
|
379
|
-
},
|
|
380
|
-
"aria-controls":
|
|
381
|
-
} : {}))),
|
|
395
|
+
}, l ? {
|
|
396
|
+
"aria-controls": V
|
|
397
|
+
} : {}))), G && /* @__PURE__ */ n.createElement("div", {
|
|
382
398
|
className: "text-[var(--color-red-500)] text-sm"
|
|
383
399
|
}, be));
|
|
384
400
|
};
|
|
385
401
|
export {
|
|
386
|
-
|
|
402
|
+
Ge as Dropdown
|
|
387
403
|
};
|
|
388
404
|
//# sourceMappingURL=index25.js.map
|