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