asma-ui-core 3.108.2 → 3.108.4

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.
Files changed (23) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/dialog/StyledDialog.js +139 -96
  3. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +180 -171
  4. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +115 -106
  5. package/dist/components/inputs/select/StyledSelect.js +56 -50
  6. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
  7. package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
  8. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
  9. package/dist/components/utils/popover/PopoverSheet.js +95 -85
  10. package/dist/components/utils/popover/StyledPopover.js +81 -71
  11. package/dist/datetime/components/date-picker/StyledDatePicker.js +33 -28
  12. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
  13. package/dist/datetime/components/time-picker/StyledTimePicker.js +56 -51
  14. package/dist/datetime/hooks/useBackNavigationClose.hook.js +16 -7
  15. package/dist/hooks/useBackCloses.hook.js +100 -0
  16. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +6 -1
  17. package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
  18. package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
  19. package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
  20. package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +2 -1
  21. package/dist/src/hooks/useBackCloses.hook.d.ts +101 -0
  22. package/dist/src/hooks/useBackCloses.hook.test.d.ts +1 -0
  23. package/package.json +1 -1
@@ -6,18 +6,19 @@ import { CheckIcon as ft } from "../../icons/check-icon/CheckIcon.js";
6
6
  import { PlusIconCircle as mt } from "../../icons/plus-icon-circle/PlusIconCircle.js";
7
7
  import { StyledChip as ht } from "../../data-display/chip/StyledChip.js";
8
8
  import { StyledCheckbox as de } from "../checkbox/base-ui/StyledCheckbox.js";
9
- import { LoadingIcon as bt } from "../../../table/shared-components/LoadingIcon.js";
10
- import U from "./StyledSelectAutocomplete.module.js";
11
- import { useEffect as ue, useMemo as V, useRef as pe, useState as D } from "react";
12
- import { jsx as o, jsxs as I } from "react/jsx-runtime";
13
- import { FloatingPortal as gt, autoUpdate as xt, flip as wt, offset as yt, shift as kt, size as vt, useDismiss as Dt, useFloating as It, useInteractions as Nt, useMergeRefs as fe, useRole as At } from "@floating-ui/react";
14
- var Ct = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), St = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
- function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, getOptionLabel: he, getOptionKey: C, isOptionEqualToValue: B, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: be = "Loading…", noOptionsText: ge = "No options", disabled: S, readOnly: g, error: xe, helperText: we, size: ye = "small", rowSize: ke = "compact", disableClearable: ve, disableCloseOnSelect: De, popupIcon: Ie, autoHeight: Ne, multiple: Ae, allowSelectAll: M, selectAllLabel: Ce = "Select all", fullWidth: Se, classes: Me, inputValue: R, onInputChange: Re, open: G, onOpen: Pe, onClose: $e, className: _e, wrapperClassName: Le, getOptionDisabled: Ee, slotProps: J }) {
16
- const s = Ae === !0, c = he ?? Ct, P = (e, t) => B ? B(e, t) : e === t, [Oe, Fe] = D(!1), a = G ?? Oe, d = (e) => {
9
+ import { useBackCloses as bt } from "../../../hooks/useBackCloses.hook.js";
10
+ import { LoadingIcon as gt } from "../../../table/shared-components/LoadingIcon.js";
11
+ import B from "./StyledSelectAutocomplete.module.js";
12
+ import { useEffect as ue, useMemo as U, useRef as pe, useState as D } from "react";
13
+ import { jsx as r, jsxs as I } from "react/jsx-runtime";
14
+ import { FloatingPortal as xt, autoUpdate as wt, flip as yt, offset as kt, shift as vt, size as Dt, useDismiss as It, useFloating as Nt, useInteractions as Ct, useMergeRefs as fe, useRole as At } from "@floating-ui/react";
15
+ var St = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Mt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
16
+ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, getOptionLabel: he, getOptionKey: A, isOptionEqualToValue: V, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: be = "Loading…", noOptionsText: ge = "No options", disabled: S, readOnly: g, error: xe, helperText: we, size: ye = "small", rowSize: ke = "compact", disableClearable: ve, disableCloseOnSelect: De, popupIcon: Ie, autoHeight: Ne, multiple: Ce, allowSelectAll: M, selectAllLabel: Ae = "Select all", fullWidth: Se, classes: Me, inputValue: R, onInputChange: Re, open: G, onOpen: Pe, onClose: $e, className: _e, wrapperClassName: Le, getOptionDisabled: Ee, slotProps: J }) {
17
+ const s = Ce === !0, d = he ?? St, P = (e, t) => V ? V(e, t) : e === t, [Oe, Fe] = D(!1), n = G ?? Oe, c = (e) => {
17
18
  e && (g || S) || (G === void 0 && Fe(e), e ? Pe?.() : (x(null), $e?.()));
18
- }, [je, Q] = D(""), m = R ?? je, $ = (e, t, n) => {
19
- R === void 0 && Q(t), Re?.(e, t, n);
20
- }, [r, x] = D(null), X = `${l}-listbox`, Z = pe([]), K = pe(null), [ze, He] = D(null), [ee, We] = D(null), i = s ? Array.isArray(N) ? N : [] : [], w = s ? null : N ?? null, te = !s && w !== null ? c(w) : "";
19
+ }, [je, Q] = D(""), m = R ?? je, $ = (e, t, a) => {
20
+ R === void 0 && Q(t), Re?.(e, t, a);
21
+ }, [o, x] = D(null), X = `${l}-listbox`, Z = pe([]), K = pe(null), [ze, He] = D(null), [ee, We] = D(null), i = s ? Array.isArray(N) ? N : [] : [], w = s ? null : N ?? null, te = !s && w !== null ? d(w) : "";
21
22
  ue(() => {
22
23
  R !== void 0 || s || Q(te);
23
24
  }, [
@@ -25,108 +26,113 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
25
26
  s,
26
27
  te
27
28
  ]);
28
- const F = (e) => s ? i.some((t) => P(e, t)) : w !== null && P(e, w), _ = (e) => Ee?.(e) ?? St(e), le = V(() => {
29
+ const F = (e) => s ? i.some((t) => P(e, t)) : w !== null && P(e, w), _ = (e) => Ee?.(e) ?? Mt(e), le = U(() => {
29
30
  const e = [...b];
30
31
  if (O) return O(e, { inputValue: m });
31
- const t = !s && w !== null ? c(w).toLowerCase() : null;
32
+ const t = !s && w !== null ? d(w).toLowerCase() : null;
32
33
  if (!m || m.toLowerCase() === t) return e;
33
- const n = m.toLowerCase();
34
- return e.filter((p) => c(p).toLowerCase().includes(n));
34
+ const a = m.toLowerCase();
35
+ return e.filter((p) => d(p).toLowerCase().includes(a));
35
36
  }, [
36
37
  b,
37
38
  m,
38
39
  O,
39
40
  N
40
- ]), u = V(() => le.slice(0, 100), [le]), se = u.flatMap((e, t) => _(e) ? [] : [t]), j = M && s ? [-1, ...se] : se, re = u.map((e, t) => t), h = M && s ? [-1, ...re] : re, k = u.findIndex(F);
41
+ ]), u = U(() => le.slice(0, 100), [le]), se = u.flatMap((e, t) => _(e) ? [] : [t]), j = M && s ? [-1, ...se] : se, oe = u.map((e, t) => t), h = M && s ? [-1, ...oe] : oe, k = u.findIndex(F);
41
42
  ue(() => {
42
- if (!a) return;
43
- const e = r ?? k;
43
+ if (!n) return;
44
+ const e = o ?? k;
44
45
  if (e < 0) return;
45
46
  const t = requestAnimationFrame(() => Z.current[e]?.scrollIntoView({ block: "nearest" }));
46
47
  return () => cancelAnimationFrame(t);
47
48
  }, [
48
- r,
49
- a,
49
+ o,
50
+ n,
50
51
  ee,
51
52
  k
52
53
  ]);
53
- const { refs: L, floatingStyles: Ue, context: oe } = It({
54
- open: a,
55
- onOpenChange: d,
54
+ const { refs: L, floatingStyles: Be, context: re } = Nt({
55
+ open: n,
56
+ onOpenChange: c,
56
57
  placement: "bottom-start",
57
58
  strategy: "fixed",
58
- whileElementsMounted: xt,
59
+ whileElementsMounted: wt,
59
60
  middleware: [
60
- yt(0),
61
- wt({ padding: 8 }),
62
- kt({ padding: 8 }),
63
- vt({ apply({ rects: e, availableHeight: t }) {
61
+ kt(0),
62
+ yt({ padding: 8 }),
63
+ vt({ padding: 8 }),
64
+ Dt({ apply({ rects: e, availableHeight: t }) {
64
65
  He(e.reference.width), We(Ne ? t - 8 : Math.min(t - 8, 320));
65
66
  } })
66
67
  ]
67
- }), { getReferenceProps: Ve, getFloatingProps: Be, getItemProps: Te } = Nt([Dt(oe), At(oe, { role: "listbox" })]), Ye = fe([L.setReference]), ne = V(() => a ? it(L.reference.current) : void 0, [a, L]), z = ct(ne), qe = fe([dt(L.setFloating, z)]), Ge = (e) => j.includes(k) ? k : j[e === 1 ? 0 : j.length - 1] ?? null, Je = (e) => {
68
+ }), { getReferenceProps: Ue, getFloatingProps: Ve, getItemProps: Te } = Ct([It(re), At(re, { role: "listbox" })]);
69
+ bt({
70
+ active: n,
71
+ requestClose: () => c(!1)
72
+ });
73
+ const Ye = fe([L.setReference]), ne = U(() => n ? it(L.reference.current) : void 0, [n, L]), z = ct(ne), qe = fe([dt(L.setFloating, z)]), Ge = (e) => j.includes(k) ? k : j[e === 1 ? 0 : j.length - 1] ?? null, Je = (e) => {
68
74
  h.length !== 0 && x((t) => {
69
- const n = h.indexOf(t ?? k);
70
- return n === -1 ? h[e === 1 ? 0 : h.length - 1] ?? null : h[Math.min(Math.max(n + e, 0), h.length - 1)] ?? null;
75
+ const a = h.indexOf(t ?? k);
76
+ return a === -1 ? h[e === 1 ? 0 : h.length - 1] ?? null : h[Math.min(Math.max(a + e, 0), h.length - 1)] ?? null;
71
77
  });
72
- }, v = (e, t, n = !s || !De) => {
78
+ }, v = (e, t, a = !s || !De) => {
73
79
  if (s) {
74
80
  const p = i.some((f) => P(t, f)), y = p ? i.filter((f) => !P(t, f)) : [...i, t];
75
- A?.(e, y, p ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), n && d(!1);
81
+ C?.(e, y, p ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), a && c(!1);
76
82
  } else
77
- A?.(e, t, "selectOption", { option: t }), $(e, c(t), "reset"), n && d(!1);
83
+ C?.(e, t, "selectOption", { option: t }), $(e, d(t), "reset"), a && c(!1);
78
84
  }, ae = (e) => {
79
- A?.(e, s ? [] : null, "clear", void 0), $(e, "", "clear");
85
+ C?.(e, s ? [] : null, "clear", void 0), $(e, "", "clear");
80
86
  }, H = (e) => {
81
87
  const t = b.length > 0 && i.length === b.length;
82
- A?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
88
+ C?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
83
89
  }, Qe = (e) => {
84
90
  if (e.key === "Backspace" && m === "" && ie) {
85
91
  const t = i[i.length - 1];
86
92
  s ? t !== void 0 && v(e, t, !1) : ae(e);
87
- } else if (e.key === "Enter" && !a)
88
- e.preventDefault(), d(!0);
89
- else if (e.key === "Enter" && r === -1)
93
+ } else if (e.key === "Enter" && !n)
94
+ e.preventDefault(), c(!0);
95
+ else if (e.key === "Enter" && o === -1)
90
96
  e.preventDefault(), H(e);
91
- else if (e.key === "Enter" && r != null && u[r] != null) {
97
+ else if (e.key === "Enter" && o != null && u[o] != null) {
92
98
  e.preventDefault();
93
- const t = u[r];
99
+ const t = u[o];
94
100
  _(t) || v(e, t, !0);
95
101
  } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
96
- if (e.preventDefault(), !a) {
97
- x(Ge(e.key === "ArrowDown" ? 1 : -1)), d(!0);
102
+ if (e.preventDefault(), !n) {
103
+ x(Ge(e.key === "ArrowDown" ? 1 : -1)), c(!0);
98
104
  return;
99
105
  }
100
106
  Je(e.key === "ArrowDown" ? 1 : -1);
101
107
  } else if (e.key === "Home" || e.key === "End")
102
108
  e.preventDefault(), x(h[e.key === "Home" ? 0 : h.length - 1] ?? null);
103
- else if (e.key === " " && r === -1)
109
+ else if (e.key === " " && o === -1)
104
110
  e.preventDefault(), H(e);
105
- else if (e.key === " " && r != null && u[r] != null) {
111
+ else if (e.key === " " && o != null && u[o] != null) {
106
112
  e.preventDefault();
107
- const t = u[r];
113
+ const t = u[o];
108
114
  _(t) || v(e, t, !1);
109
- } else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), d(!1)) : e.key === "Tab" && d(!1);
115
+ } else e.key === "Escape" && n ? (e.preventDefault(), e.stopPropagation(), c(!1)) : e.key === "Tab" && c(!1);
110
116
  }, ie = !ve && !g && !S && (s ? i.length > 0 : w !== null);
111
117
  let ce;
112
- a && r != null && (r === -1 || u[r] !== void 0) && (ce = r === -1 ? `${l}-select-all` : `${l}-option-${r}`);
118
+ n && o != null && (o === -1 || u[o] !== void 0) && (ce = o === -1 ? `${l}-select-all` : `${l}-option-${o}`);
113
119
  const Xe = (e) => {
114
- e.preventDefault(), !(S || g) && (K.current?.focus(), d(!a));
115
- }, Ze = s ? Y ? Y(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ o(ht, {
116
- dataTest: `selected-chip-${c(e)}`,
117
- label: c(e),
120
+ e.preventDefault(), !(S || g) && (K.current?.focus(), c(!n));
121
+ }, Ze = s ? Y ? Y(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ r(ht, {
122
+ dataTest: `selected-chip-${d(e)}`,
123
+ label: d(e),
118
124
  readOnly: g,
119
125
  deleteButtonTabIndex: -1,
120
- onDelete: g ? void 0 : (n) => v(n, e)
121
- }, C ? C(e) : `${c(e)}-${t}`)) : void 0, Ke = /* @__PURE__ */ I("span", {
126
+ onDelete: g ? void 0 : (a) => v(a, e)
127
+ }, A ? A(e) : `${d(e)}-${t}`)) : void 0, Ke = /* @__PURE__ */ I("span", {
122
128
  className: "flex items-center gap-1",
123
129
  children: [
124
- q && /* @__PURE__ */ o(bt, {
130
+ q && /* @__PURE__ */ r(gt, {
125
131
  width: 20,
126
132
  height: 20,
127
133
  className: "animate-spin"
128
134
  }),
129
- ie && /* @__PURE__ */ o("button", {
135
+ ie && /* @__PURE__ */ r("button", {
130
136
  type: "button",
131
137
  tabIndex: -1,
132
138
  "aria-label": "Clear",
@@ -134,29 +140,29 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
134
140
  className: "invisible flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-delta-50 group-focus-within:visible",
135
141
  onMouseDown: (e) => e.preventDefault(),
136
142
  onClick: ae,
137
- children: /* @__PURE__ */ o(pt, {
143
+ children: /* @__PURE__ */ r(pt, {
138
144
  width: 20,
139
145
  height: 20,
140
146
  className: "text-delta-700"
141
147
  })
142
148
  }),
143
- g ? null : /* @__PURE__ */ o("button", {
149
+ g ? null : /* @__PURE__ */ r("button", {
144
150
  type: "button",
145
151
  tabIndex: -1,
146
152
  "aria-label": "Toggle options",
147
- "aria-expanded": a,
153
+ "aria-expanded": n,
148
154
  "data-testid": `${l}-popup-indicator`,
149
155
  className: "flex cursor-pointer items-center border-0 bg-transparent",
150
156
  onMouseDown: (e) => e.preventDefault(),
151
157
  onClick: Xe,
152
- children: Ie ?? (s ? /* @__PURE__ */ o(mt, {
158
+ children: Ie ?? (s ? /* @__PURE__ */ r(mt, {
153
159
  width: 24,
154
160
  height: 24,
155
161
  className: "text-delta-700"
156
- }) : /* @__PURE__ */ o(ut, {
162
+ }) : /* @__PURE__ */ r(ut, {
157
163
  width: 24,
158
164
  height: 24,
159
- className: E(U["select-custom-icon"], a && U["select-custom-icon-open"], "text-delta-700")
165
+ className: E(B["select-custom-icon"], n && B["select-custom-icon-open"], "text-delta-700")
160
166
  }))
161
167
  })
162
168
  ]
@@ -168,18 +174,18 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
168
174
  helperText: we,
169
175
  value: m,
170
176
  onChange: (e) => {
171
- x(null), $(e, e.target.value, "input"), a || d(!0);
177
+ x(null), $(e, e.target.value, "input"), n || c(!0);
172
178
  },
173
179
  onKeyDown: Qe,
174
180
  slotProps: {
175
181
  htmlInput: {
176
- ...Ve(),
182
+ ...Ue(),
177
183
  ref: K,
178
- onClick: () => d(!0),
184
+ onClick: () => c(!0),
179
185
  role: "combobox",
180
186
  "aria-autocomplete": "list",
181
- "aria-expanded": a,
182
- "aria-controls": a ? X : void 0,
187
+ "aria-expanded": n,
188
+ "aria-controls": n ? X : void 0,
183
189
  "aria-activedescendant": ce,
184
190
  autoComplete: "off",
185
191
  readOnly: g
@@ -190,54 +196,54 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
190
196
  endAdornment: Ke
191
197
  }
192
198
  }
193
- }, tt = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", ke === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), lt = (e, t, n) => {
199
+ }, tt = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", ke === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), lt = (e, t, a) => {
194
200
  const { key: p, ...y } = e;
195
201
  return /* @__PURE__ */ I("li", {
196
202
  ...y,
197
203
  children: [
198
- e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
204
+ e["data-active"] !== void 0 && /* @__PURE__ */ r("span", {
199
205
  "aria-hidden": "true",
200
206
  className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
201
207
  }),
202
- s ? /* @__PURE__ */ o(de, {
203
- dataTest: `${l}-${c(t)}-checkbox`,
204
- checked: n.selected,
208
+ s ? /* @__PURE__ */ r(de, {
209
+ dataTest: `${l}-${d(t)}-checkbox`,
210
+ checked: a.selected,
205
211
  size: "medium",
206
212
  checkboxClassName: "!h-4 !w-4",
207
213
  hideWrapper: !0,
208
214
  decorative: !0
209
- }) : /* @__PURE__ */ o("span", {
215
+ }) : /* @__PURE__ */ r("span", {
210
216
  className: "w-5",
211
- children: n.selected && /* @__PURE__ */ o(ft, {
217
+ children: a.selected && /* @__PURE__ */ r(ft, {
212
218
  width: 20,
213
219
  height: 20,
214
220
  className: "text-gama-500"
215
221
  })
216
222
  }),
217
- /* @__PURE__ */ o("span", {
223
+ /* @__PURE__ */ r("span", {
218
224
  className: "line-clamp-2 min-w-0 flex-1 break-words",
219
- children: c(t)
225
+ children: d(t)
220
226
  })
221
227
  ]
222
228
  }, p);
223
229
  }, st = (e, t) => {
224
- const n = _(e), p = {
230
+ const a = _(e), p = {
225
231
  ...Te({
226
232
  onMouseDown: (f) => f.preventDefault(),
227
233
  onClick: (f) => {
228
- n || v(f, e);
234
+ a || v(f, e);
229
235
  },
230
236
  onMouseMove: () => x(null)
231
237
  }),
232
- key: C ? String(C(e)) : `${c(e)}-${t}`,
238
+ key: A ? String(A(e)) : `${d(e)}-${t}`,
233
239
  ref: (f) => {
234
240
  Z.current[t] = f;
235
241
  },
236
242
  role: "option",
237
243
  id: `${l}-option-${t}`,
238
244
  "aria-selected": F(e),
239
- "aria-disabled": n || void 0,
240
- "data-active": r === t ? "" : void 0,
245
+ "aria-disabled": a || void 0,
246
+ "data-active": o === t ? "" : void 0,
241
247
  className: tt
242
248
  }, y = {
243
249
  selected: F(e),
@@ -245,61 +251,61 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
245
251
  inputValue: m
246
252
  };
247
253
  return T ? T(p, e, y) : lt(p, e, y);
248
- }, rt = !!(M && s), W = b.length > 0 && i.length === b.length, ot = i.length > 0 && !W;
254
+ }, ot = !!(M && s), W = b.length > 0 && i.length === b.length, rt = i.length > 0 && !W;
249
255
  return /* @__PURE__ */ I("div", {
250
- className: E(U.styledSelectAutocompleteWrapper, !Se && "w-auto", Le, _e),
251
- children: [me(et), a && /* @__PURE__ */ o(gt, {
256
+ className: E(B.styledSelectAutocompleteWrapper, !Se && "w-auto", Le, _e),
257
+ children: [me(et), n && /* @__PURE__ */ r(xt, {
252
258
  root: ne,
253
259
  children: /* @__PURE__ */ I("ul", {
254
260
  ref: qe,
255
261
  ...z ? nt : {},
256
262
  style: {
257
263
  ...z ? at : {},
258
- ...Ue,
264
+ ...Be,
259
265
  width: ze ?? void 0,
260
266
  maxHeight: ee ?? void 0,
261
267
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
262
268
  ...J?.popper?.style
263
269
  },
264
- ...Be(),
270
+ ...Ve(),
265
271
  id: X,
266
272
  role: "listbox",
267
273
  "aria-multiselectable": s ? !0 : void 0,
268
- className: E("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", rt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Me?.listbox, J?.popper?.className),
274
+ className: E("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", ot && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Me?.listbox, J?.popper?.className),
269
275
  children: [M && s && /* @__PURE__ */ I("li", {
270
276
  id: `${l}-select-all`,
271
277
  role: "option",
272
278
  "aria-selected": W,
273
- "data-active": r === -1 ? "" : void 0,
279
+ "data-active": o === -1 ? "" : void 0,
274
280
  tabIndex: -1,
275
281
  onMouseDown: (e) => e.preventDefault(),
276
282
  onClick: H,
277
283
  onMouseMove: () => x(null),
278
284
  className: "relative box-border flex h-8 cursor-pointer items-center gap-x-3 bg-[var(--colors-gray-10)] px-3 text-xs font-semibold uppercase tracking-[0.2px] text-delta-600 hover:bg-delta-50",
279
285
  children: [
280
- r === -1 && /* @__PURE__ */ o("span", {
286
+ o === -1 && /* @__PURE__ */ r("span", {
281
287
  "aria-hidden": "true",
282
288
  className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
283
289
  }),
284
- /* @__PURE__ */ o(de, {
290
+ /* @__PURE__ */ r(de, {
285
291
  dataTest: `${l}-select-all`,
286
292
  checked: W,
287
- indeterminate: ot,
293
+ indeterminate: rt,
288
294
  size: "medium",
289
295
  checkboxClassName: "!h-4 !w-4",
290
296
  hideWrapper: !0,
291
297
  decorative: !0
292
298
  }),
293
- /* @__PURE__ */ o("span", {
299
+ /* @__PURE__ */ r("span", {
294
300
  className: "flex-1 truncate",
295
- children: Ce
301
+ children: Ae
296
302
  })
297
303
  ]
298
- }), q ? /* @__PURE__ */ o("li", {
304
+ }), q ? /* @__PURE__ */ r("li", {
299
305
  role: "presentation",
300
306
  className: "px-3 py-2 text-sm text-delta-600",
301
307
  children: be
302
- }) : u.length === 0 ? /* @__PURE__ */ o("li", {
308
+ }) : u.length === 0 ? /* @__PURE__ */ r("li", {
303
309
  role: "presentation",
304
310
  className: "px-3 py-2 text-sm text-delta-600",
305
311
  children: ge
@@ -309,5 +315,5 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
309
315
  });
310
316
  }
311
317
  export {
312
- Ut as StyledSelectAutocomplete
318
+ Vt as StyledSelectAutocomplete
313
319
  };
@@ -1,16 +1,17 @@
1
- import { cn as c } from "../../../helpers/cn.js";
1
+ import { cn as d } from "../../../helpers/cn.js";
2
2
  import { resolveSx as m } from "../../../helpers/sx.js";
3
- import { TOP_LAYER_PROPS as d, getOpenModalDialogAncestor as O, shouldUsePopoverTopLayer as b } from "../../../hooks/useTopLayer.hook.js";
4
- import { useFocusTrap as T } from "../../../hooks/useFocusTrap.hook.js";
5
- import { useEffect as S, useLayoutEffect as L, useRef as h } from "react";
6
- import { jsx as v, jsxs as k } from "react/jsx-runtime";
7
- import { FloatingPortal as A } from "@floating-ui/react";
8
- var D = {
3
+ import { TOP_LAYER_PROPS as v, getOpenModalDialogAncestor as k, shouldUsePopoverTopLayer as T } from "../../../hooks/useTopLayer.hook.js";
4
+ import { OverlayBackOwnerContext as b, requestCloseTopOverlayBack as S, useBackCloses as L } from "../../../hooks/useBackCloses.hook.js";
5
+ import { useFocusTrap as A } from "../../../hooks/useFocusTrap.hook.js";
6
+ import { useEffect as D, useLayoutEffect as C, useRef as h } from "react";
7
+ import { jsx as n, jsxs as B } from "react/jsx-runtime";
8
+ import { FloatingPortal as N } from "@floating-ui/react";
9
+ var U = {
9
10
  left: "inset-y-0 left-0 h-full",
10
11
  right: "inset-y-0 right-0 h-full",
11
12
  top: "inset-x-0 top-0 w-full",
12
13
  bottom: "inset-x-0 bottom-0 w-full"
13
- }, N = {
14
+ }, F = {
14
15
  left: "-translate-x-full",
15
16
  right: "translate-x-full",
16
17
  top: "-translate-y-full",
@@ -19,11 +20,11 @@ var D = {
19
20
  margin: 0,
20
21
  border: "none",
21
22
  padding: 0
22
- }, U = {
23
+ }, K = {
23
24
  ...y,
24
25
  width: "auto",
25
26
  height: "auto"
26
- }, C = {
27
+ }, M = {
27
28
  left: {
28
29
  right: "auto",
29
30
  width: "auto"
@@ -40,62 +41,65 @@ var D = {
40
41
  top: "auto",
41
42
  height: "auto"
42
43
  }
43
- }, G = ({ open: o = !1, onClose: a, anchor: i = "left", variant: E = "temporary", hideBackdrop: _, className: g, sx: w, PaperProps: l, ModalProps: P, anchorEl: x, children: R }) => {
44
- const e = E === "temporary", f = O(x), s = h(null), n = h(null), r = e && b(f), u = (t) => {
44
+ }, H = ({ open: o = !1, onClose: l, anchor: s = "left", variant: w = "temporary", hideBackdrop: E, className: P, sx: g, PaperProps: f, ModalProps: _, anchorEl: x, registerBackClose: O = !0, children: R }) => {
45
+ const e = w === "temporary", u = k(x), a = h(null), p = h(null), r = e && T(u), c = (t) => {
45
46
  if (!(!t || !o || !r))
46
47
  try {
47
48
  typeof t.showPopover == "function" && !t.matches(":popover-open") && t.showPopover();
48
49
  } catch {
49
50
  }
50
51
  };
51
- return L(() => {
52
+ return C(() => {
52
53
  if (!(!o || !r))
53
- for (const t of [n.current, s.current]) try {
54
+ for (const t of [p.current, a.current]) try {
54
55
  if (!t || typeof t.showPopover != "function") continue;
55
56
  t.matches(":popover-open") && t.hidePopover(), t.showPopover();
56
57
  } catch {
57
58
  }
58
- }, [o, r]), S(() => {
59
+ }, [o, r]), D(() => {
59
60
  if (!o || !e) return;
60
- const t = (p) => {
61
- p.key === "Escape" && a?.(p, "escapeKeyDown");
61
+ const t = (i) => {
62
+ i.key !== "Escape" || i.defaultPrevented || (i.preventDefault(), i.stopImmediatePropagation(), S(i));
62
63
  };
63
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
64
- }, [
65
- o,
66
- e,
67
- a
68
- ]), T(o && e, s), e && !o && !P?.keepMounted ? null : /* @__PURE__ */ k(A, {
69
- root: f,
70
- children: [e && !_ && o && /* @__PURE__ */ v("div", {
71
- ref: (t) => {
72
- n.current = t, u(t);
73
- },
74
- ...r ? d : void 0,
75
- className: "fixed inset-0 z-[1200] bg-[#626e7eb2]",
76
- style: r ? U : void 0,
77
- onClick: (t) => a?.(t, "backdropClick")
78
- }), /* @__PURE__ */ v("div", {
79
- ref: (t) => {
80
- s.current = t, u(t);
81
- },
82
- ...r ? d : void 0,
83
- role: e ? "dialog" : void 0,
84
- "aria-modal": e && o ? !0 : void 0,
85
- "aria-hidden": !o,
86
- className: c("fixed z-[1200] overflow-auto bg-white transition-transform duration-300", o && "shadow-[0px_4px_40px_0px_#22213366]", D[i], !o && c(N[i], "pointer-events-none"), g, l?.className),
87
- style: {
88
- ...r && {
89
- ...y,
90
- ...C[i]
64
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
65
+ }, [o, e]), A(o && e, a), L({
66
+ active: o && e && O,
67
+ requestClose: (t) => l ? l(t ?? new Event("overlayBack"), "escapeKeyDown") : !1,
68
+ ownerRef: a
69
+ }), e && !o && !_?.keepMounted ? null : /* @__PURE__ */ n(N, {
70
+ root: u,
71
+ children: /* @__PURE__ */ B(b.Provider, {
72
+ value: a,
73
+ children: [e && !E && o && /* @__PURE__ */ n("div", {
74
+ ref: (t) => {
75
+ p.current = t, c(t);
91
76
  },
92
- ...m(w),
93
- ...m(l?.sx)
94
- },
95
- children: R
96
- })]
77
+ ...r ? v : void 0,
78
+ className: "fixed inset-0 z-[1200] bg-[#626e7eb2]",
79
+ style: r ? K : void 0,
80
+ onClick: (t) => l?.(t, "backdropClick")
81
+ }), /* @__PURE__ */ n("div", {
82
+ ref: (t) => {
83
+ a.current = t, c(t);
84
+ },
85
+ ...r ? v : void 0,
86
+ role: e ? "dialog" : void 0,
87
+ "aria-modal": e && o ? !0 : void 0,
88
+ "aria-hidden": !o,
89
+ className: d("fixed z-[1200] overflow-auto bg-white transition-transform duration-300", o && "shadow-[0px_4px_40px_0px_#22213366]", U[s], !o && d(F[s], "pointer-events-none"), P, f?.className),
90
+ style: {
91
+ ...r && {
92
+ ...y,
93
+ ...M[s]
94
+ },
95
+ ...m(g),
96
+ ...m(f?.sx)
97
+ },
98
+ children: R
99
+ })]
100
+ })
97
101
  });
98
102
  };
99
103
  export {
100
- G as StyledDrawer
104
+ H as StyledDrawer
101
105
  };