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