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/index25.js CHANGED
@@ -1,130 +1,132 @@
1
- import n, { useState as j, useRef as ce, useEffect as O, useLayoutEffect as Ke } from "react";
2
- import { Popover as Le } from "./index19.js";
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 Fe } from "./index23.js";
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 U } from "./index205.js";
7
+ import { useStableId as _ } from "./index205.js";
8
8
  import { useCombobox as me } from "./index68.js";
9
- import { announce as Be } from "./index75.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 Je = (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), 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) => {
21
23
  x || fe(e), t.onOpenChange?.(e);
22
- }, T = (e) => {
23
- b || _(e);
24
+ }, q = (e) => {
25
+ h || J(e);
24
26
  }, {
25
- selectBy: f = "",
26
- optionsUniqueBy: c = "",
27
+ selectBy: g = "",
28
+ optionsUniqueBy: u = "",
27
29
  displaySelected: ge = !1,
28
- dropDownOptions: J,
29
- defaultText: u = "Select",
30
- iconColor: Q = "var(--color-gray-700)",
31
- disabled: $ = !1,
30
+ dropDownOptions: A,
31
+ defaultText: y = "Select",
32
+ iconColor: X = "var(--color-gray-700)",
33
+ disabled: K = !1,
32
34
  dropdownClassName: pe = "",
33
- hasError: X = !1,
35
+ hasError: G = !1,
34
36
  errorMessage: be = "",
35
- customDropdownContent: G = null,
37
+ customDropdownContent: Y = null,
36
38
  isBorderless: he = !1,
37
- shouldShowSearch: d = !1,
39
+ shouldShowSearch: i = !1,
38
40
  showSearchIcon: ve = !0,
39
- searchPlaceholder: Y = "Search...",
40
- searchResultEmptyMessage: E = "No results found",
41
- ariaLabel: h = "",
41
+ searchPlaceholder: Z = "Search...",
42
+ searchResultEmptyMessage: C = "No results found",
43
+ ariaLabel: v = "",
42
44
  customSelectedValue: R = "",
43
- isWithPortal: Z = !1,
45
+ isWithPortal: M = !1,
44
46
  firstOptionAsHeading: ee = !1
45
47
  } = t;
46
- O(() => {
47
- if (!b) {
48
+ B(() => {
49
+ if (!h) {
48
50
  const e = t?.defaultSelectedValue ? Array.isArray(t?.defaultSelectedValue) ? t?.defaultSelectedValue : [t.defaultSelectedValue] : [];
49
- _(e);
51
+ J(e);
50
52
  }
51
- }, [t?.defaultSelectedValue, b]), O(() => {
52
- s || W("");
53
- }, [s]), O(() => {
54
- s && d && P.current && requestAnimationFrame(() => P.current?.focus());
55
- }, [s, d]), Ke(() => {
56
- 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);
57
59
  });
58
- const i = t?.type === "multi-select", xe = () => S.trim() ? (J || []).filter((e) => (e?.[f]?.toString().toLowerCase() || "").includes(S.toLowerCase())) : J || [], A = (e) => {
59
- 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(() => {
60
62
  requestAnimationFrame(() => {
61
- m.current?.focusTrigger();
63
+ d.current?.focusTrigger();
62
64
  });
63
65
  });
64
- }, r = xe(), {
65
- listboxProps: q,
66
+ }, a = xe(), {
67
+ listboxProps: H,
66
68
  getOptionProps: we,
67
- highlightedIndex: C,
69
+ highlightedIndex: I,
68
70
  setHighlightedIndex: te,
69
- containerProps: M,
70
- inputProps: K,
71
+ containerProps: j,
72
+ inputProps: L,
71
73
  isKeyboardFocused: Se
72
74
  } = me({
73
- items: i ? [] : r,
75
+ items: c ? [] : a,
74
76
  // Only use for single-select
75
- isOpen: s && !i,
76
- onOpenChange: V,
77
+ isOpen: l && !c,
78
+ onOpenChange: $,
77
79
  onSelect: (e) => {
78
- A(e);
80
+ F(e);
79
81
  },
80
- listboxId: N,
81
- disabled: i || $,
82
- hasItems: r.length > 0
82
+ listboxId: V,
83
+ disabled: c || K,
84
+ hasItems: a.length > 0
83
85
  }), {
84
- inputProps: H,
85
- listboxProps: L,
86
- containerProps: I,
87
- highlightedIndex: D,
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: i ? r : [],
92
- isOpen: s && i,
93
- onOpenChange: V,
93
+ items: c ? a : [],
94
+ isOpen: l && c,
95
+ onOpenChange: $,
94
96
  onSelect: () => {
95
97
  },
96
- listboxId: N,
97
- disabled: !i,
98
+ listboxId: V,
99
+ disabled: !c,
98
100
  loop: !1,
99
- hasItems: r.length > 0,
101
+ hasItems: a.length > 0,
100
102
  closeOnTab: !1
101
103
  });
102
- O(() => {
103
- s && r.length === 0 && S.trim() && Be(E, {
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
- }, [r.length, s, S]);
109
- const Ie = (e, o = !1) => i ? u : o && R ? R : e?.[f] || u, De = () => {
110
- 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?.();
111
113
  }, oe = (e, o = !1) => {
112
114
  if (t?.renderOptionChip)
113
115
  return t?.renderOptionChip(e, o);
114
- if (i && l?.length > 0) {
115
- 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;
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: `${k > 0 ? "w-full" : "flex-1"} truncate`
120
- }, `${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", {
121
123
  className: "flex-shrink-0"
122
- }, "+", k));
124
+ }, "+", N));
123
125
  }
124
- const a = Ie(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;
125
127
  return /* @__PURE__ */ n.createElement("p", {
126
128
  className: "option-chip flex flex-1 items-center justify-between"
127
- }, v ? `${u}: ${a}` : a);
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) => W(o),
140
- placeholder: Y,
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: Y,
152
- inputRef: P,
153
+ ariaLabel: Z,
154
+ inputRef: E,
153
155
  inputProps: e
154
- })), re = () => ne(i ? {
155
- ...H,
156
+ })), re = () => ne(c ? {
157
+ ...U,
156
158
  onKeyDown: (e) => se(e, !0)
157
159
  } : {
158
- ...K,
160
+ ...L,
159
161
  onKeyDown: (e) => {
160
- K.onKeyDown(e), e.key === "Escape" && requestAnimationFrame(() => m.current?.focusTrigger());
162
+ L.onKeyDown(e), e.key === "Escape" && requestAnimationFrame(() => d.current?.focusTrigger());
161
163
  }
162
164
  }), ae = (e, o) => {
163
- const a = e[f], y = l[0]?.[f] || u, v = c?.length ? e[c] == l[0]?.[c] : !0, g = ge && a === y && v, k = C === o, Ae = i ? {} : we(o, g);
164
- 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({
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 ${g ? "selected" : ""} ${k ? `bg-[var(--color-gray-100)]${Se ? " outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]" : ""}` : ""}`,
167
- onClick: () => A(e),
168
- onKeyDown: (F) => {
169
- 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());
170
172
  },
171
173
  tabIndex: -1,
172
174
  "data-automation-id": `dropdown-option-${e?.automationId || o}`
173
175
  }, Ae, {
174
- "aria-selected": g ? "true" : "false"
176
+ "aria-selected": f ? "true" : "false"
175
177
  }), oe({
176
178
  ...e,
177
- isOptionSelected: g
178
- }, !1), g && /* @__PURE__ */ n.createElement(de, {
179
+ isOptionSelected: f
180
+ }, !1), f && /* @__PURE__ */ n.createElement(de, {
179
181
  name: "checkmark",
180
- stroke: Q
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), d && re(), /* @__PURE__ */ n.createElement("div", p({
186
- className: `dropdown-content dropdown-options${d ? "" : " flex flex-col max-h-80 overflow-y-auto"}`
187
- }, d ? {} : {
188
- ...q,
189
- "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`,
190
192
  style: {
191
193
  outline: "none"
192
194
  },
193
195
  tabIndex: -1,
194
- "aria-activedescendant": K["aria-activedescendant"],
196
+ "aria-activedescendant": L["aria-activedescendant"],
195
197
  onKeyDown: (e) => {
196
- if (M.onKeyDownCapture?.(e), e.key === " ") {
197
- 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]);
198
200
  return;
199
201
  }
200
- K.onKeyDown(e);
202
+ L.onKeyDown(e);
201
203
  },
202
204
  onFocus: () => {
203
- C === -1 && r.length > 0 && te(0);
205
+ I === -1 && a.length > 0 && te(0);
204
206
  }
205
- }), d ? /* @__PURE__ */ n.createElement("div", p({
207
+ }), i ? /* @__PURE__ */ n.createElement("div", b({
206
208
  className: "flex flex-col max-h-80 overflow-y-auto",
207
- "aria-label": `${u} options`
208
- }, 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", {
209
211
  className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
210
- }, 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", {
211
213
  className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
212
- }, E))), le = (e, o) => {
213
- let a = [];
214
- e ? a = [...l, o] : a = l?.filter((y) => y[c] !== o[c]), T(a);
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
- m.current?.togglePopover(), t?.onApply?.(l);
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(), D >= 0 && D < r.length) {
221
- const a = r[D], y = l.some((v) => v[c] === a[c]);
222
- 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);
223
225
  }
224
226
  return;
225
227
  }
226
- 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()));
227
229
  }
228
- }, ie = (e, o) => {
229
- 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;
230
232
  return /* @__PURE__ */ n.createElement("div", {
231
233
  key: e.id || e.value,
232
- id: y,
234
+ id: m,
233
235
  role: "option",
234
- "aria-selected": a,
235
- 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)]${Ce ? " outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]" : ""}` : ""}`,
236
- 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),
237
239
  "data-automation-id": `dropdown-option-${e?.automationId || o}`
238
- }, /* @__PURE__ */ n.createElement(Fe, {
240
+ }, /* @__PURE__ */ n.createElement(Le, {
239
241
  tabIndex: -1,
240
242
  ariaHidden: !0,
241
- checked: a,
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
- }, d && re(), /* @__PURE__ */ n.createElement("div", p({
253
- className: `dropdown-content dropdown-options${d ? "" : " flex flex-col max-h-80 overflow-y-auto"}`
254
- }, d ? {} : {
255
- ...L,
256
- "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`,
257
259
  "aria-multiselectable": "true",
258
260
  style: {
259
261
  outline: "none"
260
262
  },
261
263
  tabIndex: -1,
262
- "aria-activedescendant": H["aria-activedescendant"],
264
+ "aria-activedescendant": U["aria-activedescendant"],
263
265
  onKeyDown: (e) => se(e, !1),
264
266
  onFocus: () => {
265
- D === -1 && r.length > 0 && Ee(0);
267
+ P === -1 && a.length > 0 && Ee(0);
266
268
  }
267
- }), d ? /* @__PURE__ */ n.createElement("div", p({
269
+ }), i ? /* @__PURE__ */ n.createElement("div", b({
268
270
  className: "flex flex-col max-h-80 overflow-y-auto"
269
- }, L, {
270
- "aria-label": `${u} options`,
271
+ }, D, {
272
+ "aria-label": `${y} options`,
271
273
  "aria-multiselectable": "true"
272
- }), 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", {
273
275
  className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
274
- }, 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", {
275
277
  className: "px-3 py-4 text-center text-[var(--color-gray-700)] text-sm"
276
- }, E)), /* @__PURE__ */ n.createElement("div", {
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 && (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());
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 = 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 ${he ? "border-0" : `border rounded-md ${o || e}`} flex items-center ${pe}`;
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: a
312
+ className: r
301
313
  }, /* @__PURE__ */ n.createElement("div", {
302
- id: z,
314
+ id: Q,
303
315
  className: "flex-1 min-w-0",
304
316
  "data-automation-id": t?.dropDownSelectAutomationId || "selected-dropdown-value"
305
- }, oe(l[0], !0)), /* @__PURE__ */ n.createElement("div", {
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: s ? "180" : "0",
322
+ rotation: l ? "180" : "0",
311
323
  className: "transition-transform",
312
- stroke: Q
324
+ stroke: X
313
325
  })));
314
326
  }, $e = () => {
315
- const e = l[0]?.[f];
316
- return h && e ? `${h}, ${e}` : h || u || "Select option";
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: B,
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 && h ? /* @__PURE__ */ n.createElement("span", {
325
- id: B,
336
+ }, t?.label) : !t?.ariaLabelledBy && v ? /* @__PURE__ */ n.createElement("span", {
337
+ id: T,
326
338
  className: "sr-only"
327
- }, h) : null, /* @__PURE__ */ n.createElement("div", p({
339
+ }, v) : null, /* @__PURE__ */ n.createElement("div", b({
328
340
  style: t?.style,
329
- className: `${$ ? "bg-[var(--color-gray-50)] rounded-md cursor-not-allowed" : ""}`
330
- }, i ? {
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: I.onPointerMove,
334
- onPointerDown: I.onPointerDown,
335
- onPointerUp: I.onPointerUp,
336
- onFocusCapture: I.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" && 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);
339
355
  }
340
356
  } : {
341
- ...M,
357
+ ...j,
342
358
  onKeyDownCapture: (e) => {
343
- (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);
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
- ...Z ? {
364
+ ...M ? {
349
365
  onBlurCapture: void 0
350
366
  } : {}
351
- }), /* @__PURE__ */ n.createElement(Le, p({
352
- ref: m,
353
- isPopoverOpen: s,
354
- isWithPortal: Z,
355
- renderPopoverContents: G || (i ? Ne : ke),
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: s,
360
- selectedValue: l
375
+ isOpen: l,
376
+ selectedValue: s
361
377
  }) : Ve,
362
378
  onPopoverToggle: (e) => {
363
- if (V(e), e && !i && l.length > 0) {
364
- 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]);
365
381
  o >= 0 && te(o);
366
382
  }
367
- if (e && !d) {
368
- const o = i ? L.ref : q.ref;
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 || h ? [t?.label || !t?.ariaLabelledBy && h ? B : t?.ariaLabelledBy, z].filter(Boolean).join(" ") : void 0,
376
- ariaLabel: !t?.label && !h && !t?.ariaLabelledBy ? $e() : 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,
377
393
  sourceRole: "button",
378
394
  "aria-haspopup": "listbox"
379
- }, s ? {
380
- "aria-controls": N
381
- } : {}))), X && /* @__PURE__ */ n.createElement("div", {
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
- Je as Dropdown
402
+ Ge as Dropdown
387
403
  };
388
404
  //# sourceMappingURL=index25.js.map