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/index25.js CHANGED
@@ -1,136 +1,136 @@
1
- import n, { useState as j, useRef as ce, useEffect as O, useLayoutEffect as Le } from "react";
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 Oe } from "./index23.js";
4
+ import { Checkbox as Le } from "./index23.js";
5
5
  import { Button as ue } from "./index4.js";
6
- import { InputWithIcon as Be } from "./index52.js";
7
- import { useStableId as U } from "./index205.js";
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 { useLiveAnnouncer as Te } from "./index77.js";
10
- function p() {
11
- return p = Object.assign ? Object.assign.bind() : function(t) {
12
- for (var b = 1; b < arguments.length; b++) {
13
- var x = arguments[b];
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
- }, p.apply(null, arguments);
19
+ }, b.apply(null, arguments);
18
20
  }
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) => {
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
- }, T = (e) => {
25
- b || _(e);
24
+ }, q = (e) => {
25
+ h || J(e);
26
26
  }, {
27
- selectBy: f = "",
28
- optionsUniqueBy: c = "",
29
- displaySelected: pe = !1,
30
- dropDownOptions: J,
31
- defaultText: u = "Select",
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 = "",
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: Z = !1,
45
+ isWithPortal: M = !1,
46
46
  firstOptionAsHeading: ee = !1
47
47
  } = t;
48
- O(() => {
49
- if (!b) {
48
+ B(() => {
49
+ if (!h) {
50
50
  const e = t?.defaultSelectedValue ? Array.isArray(t?.defaultSelectedValue) ? t?.defaultSelectedValue : [t.defaultSelectedValue] : [];
51
- _(e);
51
+ J(e);
52
52
  }
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);
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 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(() => {
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
- m.current?.focusTrigger();
63
+ d.current?.focusTrigger();
64
64
  });
65
65
  });
66
- }, r = we(), {
67
- listboxProps: q,
68
- getOptionProps: Se,
69
- highlightedIndex: C,
66
+ }, a = xe(), {
67
+ listboxProps: H,
68
+ getOptionProps: we,
69
+ highlightedIndex: I,
70
70
  setHighlightedIndex: te,
71
- containerProps: M,
72
- inputProps: K,
73
- isKeyboardFocused: Ee
71
+ containerProps: j,
72
+ inputProps: L,
73
+ isKeyboardFocused: Se
74
74
  } = me({
75
- items: i ? [] : r,
75
+ items: c ? [] : a,
76
76
  // Only use for single-select
77
- isOpen: s && !i,
78
- onOpenChange: V,
77
+ isOpen: l && !c,
78
+ onOpenChange: $,
79
79
  onSelect: (e) => {
80
- A(e);
80
+ F(e);
81
81
  },
82
- listboxId: N,
83
- disabled: i || $,
84
- hasItems: r.length > 0
82
+ listboxId: V,
83
+ disabled: c || K,
84
+ hasItems: a.length > 0
85
85
  }), {
86
- inputProps: H,
87
- listboxProps: L,
88
- containerProps: I,
89
- highlightedIndex: D,
90
- setHighlightedIndex: Ce,
91
- isKeyboardFocused: Ie
86
+ inputProps: U,
87
+ listboxProps: D,
88
+ containerProps: k,
89
+ highlightedIndex: P,
90
+ setHighlightedIndex: Ee,
91
+ isKeyboardFocused: Ce
92
92
  } = me({
93
- items: i ? r : [],
94
- isOpen: s && i,
95
- onOpenChange: V,
93
+ items: c ? a : [],
94
+ isOpen: l && c,
95
+ onOpenChange: $,
96
96
  onSelect: () => {
97
97
  },
98
- listboxId: N,
99
- disabled: !i,
98
+ listboxId: V,
99
+ disabled: !c,
100
100
  loop: !1,
101
- hasItems: r.length > 0,
101
+ hasItems: a.length > 0,
102
102
  closeOnTab: !1
103
103
  });
104
- O(() => {
105
- s && r.length === 0 && S.trim() && ge(E, {
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
- }, [r.length, s, S]);
111
- const De = (e, o = !1) => i ? u : o && R ? R : e?.[f] || u, ke = () => {
112
- T([]), t?.onClear?.();
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 (i && l?.length > 0) {
117
- const g = l[0]?.[f] || "", k = l.length - 1;
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: `${k > 0 ? "w-full" : "flex-1"} truncate`
122
- }, `${u}: ${g}`), k > 0 && /* @__PURE__ */ n.createElement("div", {
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
- }, "+", k));
124
+ }, "+", N));
125
125
  }
126
- const a = De(e, o), y = !!t?.label || !!t?.ariaLabelledBy, v = o && u && e?.[f] && !R && !y;
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
- }, v ? `${u}: ${a}` : a);
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(Be, {
133
- leftIcon: xe ? {
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) => W(o),
142
- placeholder: Y,
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: Y,
154
- inputRef: P,
153
+ ariaLabel: Z,
154
+ inputRef: E,
155
155
  inputProps: e
156
- })), re = () => ne(i ? {
157
- ...H,
156
+ })), re = () => ne(c ? {
157
+ ...U,
158
158
  onKeyDown: (e) => se(e, !0)
159
159
  } : {
160
- ...K,
160
+ ...L,
161
161
  onKeyDown: (e) => {
162
- K.onKeyDown(e), e.key === "Escape" && requestAnimationFrame(() => m.current?.focusTrigger());
162
+ L.onKeyDown(e), e.key === "Escape" && requestAnimationFrame(() => d.current?.focusTrigger());
163
163
  }
164
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({
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 ${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());
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
- }, Ke, {
176
- "aria-selected": g ? "true" : "false"
175
+ }, Ae, {
176
+ "aria-selected": f ? "true" : "false"
177
177
  }), oe({
178
178
  ...e,
179
- isOptionSelected: g
180
- }, !1), g && /* @__PURE__ */ n.createElement(de, {
179
+ isOptionSelected: f
180
+ }, !1), f && /* @__PURE__ */ n.createElement(de, {
181
181
  name: "checkmark",
182
- stroke: Q
182
+ stroke: X
183
183
  }));
184
- }, Pe = () => /* @__PURE__ */ n.createElement(n.Fragment, null, t?.label && ee && /* @__PURE__ */ n.createElement("div", {
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), 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`,
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": K["aria-activedescendant"],
196
+ "aria-activedescendant": L["aria-activedescendant"],
197
197
  onKeyDown: (e) => {
198
- if (M.onKeyDownCapture?.(e), e.key === " ") {
199
- e.preventDefault(), C >= 0 && r[C] && A(r[C]);
198
+ if (j.onKeyDownCapture?.(e), e.key === " ") {
199
+ e.preventDefault(), I >= 0 && a[I] && F(a[I]);
200
200
  return;
201
201
  }
202
- K.onKeyDown(e);
202
+ L.onKeyDown(e);
203
203
  },
204
204
  onFocus: () => {
205
- C === -1 && r.length > 0 && te(0);
205
+ I === -1 && a.length > 0 && te(0);
206
206
  }
207
- }), d ? /* @__PURE__ */ n.createElement("div", p({
207
+ }), i ? /* @__PURE__ */ n.createElement("div", b({
208
208
  className: "flex flex-col max-h-80 overflow-y-auto",
209
- "aria-label": `${u} options`
210
- }, q), r.length > 0 ? r.map((e, o) => ae(e, o)) : /* @__PURE__ */ n.createElement("div", {
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
- }, E)) : r.length > 0 ? r.map((e, o) => ae(e, o)) : /* @__PURE__ */ n.createElement("div", {
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
- }, 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);
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(), D >= 0 && D < r.length) {
223
- const a = r[D], y = l.some((v) => v[c] === a[c]);
224
- le(!y, a);
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
- H.onKeyDown(e), e.key === "Escape" && (e.stopPropagation(), requestAnimationFrame(() => m.current?.focusTrigger()));
228
+ U.onKeyDown(e), e.key === "Escape" && (e.stopPropagation(), requestAnimationFrame(() => d.current?.focusTrigger()));
229
229
  }
230
- }, ie = (e, o) => {
231
- const a = l.some((g) => g[c] === e[c]), y = `${N}-option-${o}`, v = D === o;
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: y,
234
+ id: m,
235
235
  role: "option",
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),
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(Oe, {
240
+ }, /* @__PURE__ */ n.createElement(Le, {
241
241
  tabIndex: -1,
242
242
  ariaHidden: !0,
243
- checked: a,
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
- }, Ve = () => /* @__PURE__ */ n.createElement("div", {
250
+ }, Ne = () => /* @__PURE__ */ n.createElement("div", {
251
251
  onKeyDown: (e) => {
252
252
  e.key === "Tab" && e.stopPropagation();
253
253
  }
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,
258
- "aria-label": `${u} options`,
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": H["aria-activedescendant"],
264
+ "aria-activedescendant": U["aria-activedescendant"],
265
265
  onKeyDown: (e) => se(e, !1),
266
266
  onFocus: () => {
267
- D === -1 && r.length > 0 && Ce(0);
267
+ P === -1 && a.length > 0 && Ee(0);
268
268
  }
269
- }), d ? /* @__PURE__ */ n.createElement("div", p({
269
+ }), i ? /* @__PURE__ */ n.createElement("div", b({
270
270
  className: "flex flex-col max-h-80 overflow-y-auto"
271
- }, L, {
272
- "aria-label": `${u} options`,
271
+ }, D, {
272
+ "aria-label": `${y} options`,
273
273
  "aria-multiselectable": "true"
274
- }), r.length > 0 ? r.map((e, o) => ie(e, o)) : /* @__PURE__ */ n.createElement("div", {
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
- }, E)) : r.length > 0 ? r.map((e, o) => ie(e, o)) : /* @__PURE__ */ n.createElement("div", {
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
- }, E)), /* @__PURE__ */ n.createElement("div", {
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 && (e.preventDefault(), e.stopPropagation(), d ? P.current?.focus() : L.ref.current?.focus());
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: ke,
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: Ne,
307
+ onClick: Pe,
298
308
  automationId: "se-design-dropdown-apply-button"
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}`;
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: a
312
+ className: r
303
313
  }, /* @__PURE__ */ n.createElement("div", {
304
- id: z,
314
+ id: Q,
305
315
  className: "flex-1 min-w-0",
306
316
  "data-automation-id": t?.dropDownSelectAutomationId || "selected-dropdown-value"
307
- }, oe(l[0], !0)), /* @__PURE__ */ n.createElement("div", {
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: s ? "180" : "0",
322
+ rotation: l ? "180" : "0",
313
323
  className: "transition-transform",
314
- stroke: Q
324
+ stroke: X
315
325
  })));
316
- }, Ae = () => {
317
- const e = l[0]?.[f];
318
- return h && e ? `${h}, ${e}` : h || u || "Select option";
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: B,
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 && h ? /* @__PURE__ */ n.createElement("span", {
327
- id: B,
336
+ }, t?.label) : !t?.ariaLabelledBy && v ? /* @__PURE__ */ n.createElement("span", {
337
+ id: T,
328
338
  className: "sr-only"
329
- }, h) : null, /* @__PURE__ */ n.createElement("div", p({
339
+ }, v) : null, /* @__PURE__ */ n.createElement("div", b({
330
340
  style: t?.style,
331
- className: `${$ ? "bg-[var(--color-gray-50)] rounded-md cursor-not-allowed" : ""}`
332
- }, i ? {
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: I.onPointerMove,
336
- onPointerDown: I.onPointerDown,
337
- onPointerUp: I.onPointerUp,
338
- onFocusCapture: I.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" && s && (e.stopPropagation(), m.current?.focusTrigger()), I.onKeyDownCapture?.(e);
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
- ...M,
357
+ ...j,
344
358
  onKeyDownCapture: (e) => {
345
- (e.key === "Escape" || e.key === "Tab") && s && (e.stopPropagation(), m.current?.focusTrigger()), M.onKeyDownCapture?.(e);
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
- ...Z ? {
364
+ ...M ? {
351
365
  onBlurCapture: void 0
352
366
  } : {}
353
- }), /* @__PURE__ */ n.createElement(Fe, p({
354
- ref: m,
355
- isPopoverOpen: s,
356
- isWithPortal: Z,
357
- renderPopoverContents: G || (i ? Ve : Pe),
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: s,
362
- selectedValue: l
363
- }) : $e,
375
+ isOpen: l,
376
+ selectedValue: s
377
+ }) : Ve,
364
378
  onPopoverToggle: (e) => {
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]);
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 && !d) {
370
- const o = i ? L.ref : q.ref;
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 || 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,
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
- }, s ? {
382
- "aria-controls": N
383
- } : {}))), X && /* @__PURE__ */ n.createElement("div", {
395
+ }, l ? {
396
+ "aria-controls": V
397
+ } : {}))), G && /* @__PURE__ */ n.createElement("div", {
384
398
  className: "text-[var(--color-red-500)] text-sm"
385
- }, he));
399
+ }, be));
386
400
  };
387
401
  export {
388
- Qe as Dropdown
402
+ Ge as Dropdown
389
403
  };
390
404
  //# sourceMappingURL=index25.js.map