asma-ui-core 3.108.3 → 3.109.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.
Files changed (24) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +18 -18
  3. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +52 -51
  4. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +66 -65
  5. package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -12
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectTitle.js +9 -0
  7. package/dist/components/inputs/select/StyledSelect.js +56 -50
  8. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
  9. package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
  10. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
  11. package/dist/components/utils/popover/PopoverSheet.js +95 -85
  12. package/dist/components/utils/popover/StyledPopover.js +81 -71
  13. package/dist/datetime/components/date-picker/StyledDatePicker.js +36 -27
  14. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
  15. package/dist/datetime/components/time-picker/StyledTimePicker.js +75 -64
  16. package/dist/datetime/hooks/useBackNavigationClose.hook.js +19 -0
  17. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
  18. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectTitle.d.ts +14 -0
  19. package/dist/src/components/inputs/dynamic-select/types.d.ts +8 -2
  20. package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
  21. package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
  22. package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
  23. package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +5 -0
  24. package/package.json +1 -1
@@ -3,54 +3,59 @@ import { firstTabbable as se } from "../../../helpers/focusable.js";
3
3
  import { TOP_LAYER_PROPS as ae, TOP_LAYER_RESET_STYLE as le, getOpenModalDialogAncestor as ce, shouldUsePopoverTopLayer as de, useTopLayerRef as ue } from "../../../hooks/useTopLayer.hook.js";
4
4
  import { StyledButton as fe } from "../../inputs/button/StyledButton.js";
5
5
  import { useMobileMediaQuery as pe } from "../../../hooks/useMediaQuery.hook.js";
6
- import { useDebouncedValue as me } from "../../../hooks/useDebouncedValue.hook.js";
7
- import { useFocusTrap as ge } from "../../../hooks/useFocusTrap.hook.js";
8
- import { formatResultsLabel as he } from "../bottom-sheet/formatResultsLabel.js";
9
- import { StyledBottomSheet as ve } from "../bottom-sheet/StyledBottomSheet.js";
10
- import { PopoverAnatomy as xe } from "./PopoverAnatomy.js";
11
- import { useCallback as v, useEffect as R, useId as _e, useRef as T, useState as l } from "react";
12
- import { Fragment as N, jsx as c, jsxs as B } from "react/jsx-runtime";
13
- import { FloatingPortal as be, autoUpdate as Pe, flip as ye, offset as Re, shift as Te, size as Ee, useDismiss as Me, useFloating as Se, useInteractions as we, useMergeRefs as Ae } from "@floating-ui/react";
14
- var Oe = 240, Fe = {
6
+ import { OverlayBackOwnerContext as me, useBackCloses as ge } from "../../../hooks/useBackCloses.hook.js";
7
+ import { useDebouncedValue as ve } from "../../../hooks/useDebouncedValue.hook.js";
8
+ import { useFocusTrap as he } from "../../../hooks/useFocusTrap.hook.js";
9
+ import { formatResultsLabel as xe } from "../bottom-sheet/formatResultsLabel.js";
10
+ import { StyledBottomSheet as _e } from "../bottom-sheet/StyledBottomSheet.js";
11
+ import { PopoverAnatomy as Pe } from "./PopoverAnatomy.js";
12
+ import { useCallback as x, useEffect as w, useId as be, useRef as O, useState as d } from "react";
13
+ import { Fragment as D, jsx as a, jsxs as N } from "react/jsx-runtime";
14
+ import { FloatingPortal as ye, autoUpdate as Re, flip as we, offset as Oe, shift as Te, size as Ee, useDismiss as Me, useFloating as Se, useInteractions as Ae, useMergeRefs as Fe } from "@floating-ui/react";
15
+ var Ie = 240, Ce = {
15
16
  info: 472,
16
17
  action: 472
17
- }, Ie = 0.6, X = "calc(100vw - 32px)", Le = (n, d, u) => Pe(n, d, u, { elementResize: !1 }), Ve = ({ dataTest: n, renderTrigger: d, variant: u = "info", title: f, children: E, viewResultsAction: M, resetAction: S, footerActions: w, resultCount: x, closeLabel: A = "Lukk", ariaLabel: O, onOpenChange: F, className: I }) => {
18
- const a = _e(), L = `${a}-title`, [o, z] = l(!1), [H, K] = l(), [U, Y] = l(), p = pe(), t = u === "action", $ = p && !t, k = p && t, m = v((e) => {
19
- z(e), F?.(e);
20
- }, [F]), { refs: _, floatingStyles: j, context: q } = Se({
18
+ }, ke = 0.6, X = "calc(100vw - 32px)", Le = (i, u, f) => Re(i, u, f, { elementResize: !1 }), Je = ({ dataTest: i, renderTrigger: u, variant: f = "info", title: p, children: T, viewResultsAction: E, resetAction: M, footerActions: S, resultCount: _, closeLabel: A = "Lukk", ariaLabel: F, onOpenChange: I, className: C }) => {
19
+ const l = be(), k = `${l}-title`, [o, q] = d(!1), [L, z] = d(), [K, U] = d(), m = pe(), t = f === "action", Y = m && !t, H = m && t, g = x((e) => {
20
+ q(e), I?.(e);
21
+ }, [I]), { refs: P, floatingStyles: $, context: j } = Se({
21
22
  open: o,
22
- onOpenChange: m,
23
+ onOpenChange: g,
23
24
  placement: "bottom-start",
24
25
  strategy: "fixed",
25
26
  whileElementsMounted: Le,
26
27
  middleware: [
27
- Re(8),
28
- ...$ ? [] : [ye({ padding: 8 })],
28
+ Oe(8),
29
+ ...Y ? [] : [we({ padding: 8 })],
29
30
  Te({ padding: 8 }),
30
31
  Ee({
31
32
  padding: 8,
32
33
  apply({ availableHeight: e }) {
33
- Y(Math.min(e, Math.round(window.innerHeight * Ie)));
34
+ U(Math.min(e, Math.round(window.innerHeight * ke)));
34
35
  }
35
36
  })
36
37
  ]
37
- }), { getFloatingProps: V } = we([Me(q, {
38
- enabled: !k,
38
+ }), { getFloatingProps: V } = Ae([Me(j, {
39
+ enabled: !H,
39
40
  escapeKey: !0,
40
41
  outsidePress: (e) => {
41
- const s = g.current;
42
+ const s = v.current;
42
43
  return !(s && e.target instanceof Node && s.contains(e.target));
43
44
  }
44
- })]), b = de(H), C = T(null), [r, G] = l(null), Q = v((e) => {
45
- C.current = e, G(e);
46
- }, []), J = Ae([ue(_.setFloating, b), Q]), g = T(null), Z = v((e) => {
47
- g.current = e, _.setReference(e);
48
- }, [_]), i = v(() => {
49
- m(!1);
50
- }, [m]);
51
- ge(o && t && r !== null, C);
52
- const [W, ee] = l(!1);
53
- R(() => {
45
+ })]), b = de(L), c = O(null), [r, G] = d(null), Q = x((e) => {
46
+ c.current = e, G(e);
47
+ }, []), J = Fe([ue(P.setFloating, b), Q]), v = O(null), Z = x((e) => {
48
+ v.current = e, P.setReference(e);
49
+ }, [P]), n = x(() => {
50
+ g(!1);
51
+ }, [g]);
52
+ ge({
53
+ active: o,
54
+ requestClose: n,
55
+ ownerRef: c
56
+ }), he(o && t && r !== null, c);
57
+ const [W, ee] = d(!1);
58
+ w(() => {
54
59
  if (!r || t && !W) return;
55
60
  const e = requestAnimationFrame(() => {
56
61
  (t ? se(r) : r)?.focus({ preventScroll: !0 });
@@ -62,11 +67,11 @@ var Oe = 240, Fe = {
62
67
  r,
63
68
  t,
64
69
  W
65
- ]), R(() => {
70
+ ]), w(() => {
66
71
  if (!r || t) return;
67
72
  const e = (s) => {
68
- const y = s.relatedTarget;
69
- y instanceof Node && (r.contains(y) || g.current?.contains(y)) || i();
73
+ const R = s.relatedTarget;
74
+ R instanceof Node && (r.contains(R) || v.current?.contains(R)) || n();
70
75
  };
71
76
  return r.addEventListener("focusout", e), () => {
72
77
  r.removeEventListener("focusout", e);
@@ -74,17 +79,17 @@ var Oe = 240, Fe = {
74
79
  }, [
75
80
  r,
76
81
  t,
77
- i
82
+ n
78
83
  ]);
79
- const P = T(!1);
80
- R(() => {
84
+ const y = O(!1);
85
+ w(() => {
81
86
  if (o) {
82
- P.current = !0;
87
+ y.current = !0;
83
88
  return;
84
89
  }
85
- if (!P.current) return;
86
- P.current = !1;
87
- const e = g.current;
90
+ if (!y.current) return;
91
+ y.current = !1;
92
+ const e = v.current;
88
93
  if (!e) return;
89
94
  const s = requestAnimationFrame(() => {
90
95
  document.activeElement === document.body && e.focus();
@@ -93,79 +98,84 @@ var Oe = 240, Fe = {
93
98
  cancelAnimationFrame(s);
94
99
  };
95
100
  }, [o]);
96
- const D = {
101
+ const B = {
97
102
  ref: Z,
98
103
  isOpen: o,
99
104
  triggerProps: {
100
105
  onClick: (e) => {
101
106
  if (o) {
102
- i();
107
+ n();
103
108
  return;
104
109
  }
105
- K(ce(e.currentTarget)), ee(e.detail === 0), m(!0);
110
+ z(ce(e.currentTarget)), ee(e.detail === 0), g(!0);
106
111
  },
107
112
  "aria-expanded": o,
108
- "aria-controls": o ? a : void 0,
113
+ "aria-controls": o ? l : void 0,
109
114
  "aria-haspopup": t ? "dialog" : void 0,
110
- "aria-describedby": !t && o ? a : void 0
115
+ "aria-describedby": !t && o ? l : void 0
111
116
  }
112
- }, h = (e) => typeof e == "function" ? e({ close: i }) : e, te = me(x, 500), oe = M ?? (x === void 0 ? void 0 : /* @__PURE__ */ c(fe, {
113
- dataTest: `${n}-view-results`,
117
+ }, h = (e) => typeof e == "function" ? e({ close: n }) : e, te = ve(_, 500), oe = E ?? (_ === void 0 ? void 0 : /* @__PURE__ */ a(fe, {
118
+ dataTest: `${i}-view-results`,
114
119
  type: "button",
115
120
  variant: "text",
116
- onClick: i,
117
- children: he(te)
118
- })), re = p ? X : Fe[u], ne = p ? X : void 0;
119
- return k ? /* @__PURE__ */ B(N, { children: [d(D), /* @__PURE__ */ c(ve, {
120
- id: a,
121
- dataTest: n,
121
+ onClick: n,
122
+ children: xe(te)
123
+ })), re = m ? X : Ce[f], ne = m ? X : void 0;
124
+ return H ? /* @__PURE__ */ N(D, { children: [u(B), /* @__PURE__ */ a(_e, {
125
+ id: l,
126
+ dataTest: i,
122
127
  open: o,
123
- onClose: i,
124
- title: f,
125
- ariaLabel: O,
126
- viewResultsAction: M,
127
- resetAction: S,
128
- footerActions: w,
129
- resultCount: x,
128
+ onClose: n,
129
+ registerBackClose: !1,
130
+ ownerRef: c,
131
+ title: p,
132
+ ariaLabel: F,
133
+ viewResultsAction: E,
134
+ resetAction: M,
135
+ footerActions: S,
136
+ resultCount: _,
130
137
  closeLabel: A,
131
- className: I,
132
- children: E
133
- })] }) : /* @__PURE__ */ B(N, { children: [d(D), o && /* @__PURE__ */ c(be, {
134
- root: H,
135
- children: /* @__PURE__ */ c("div", {
138
+ className: C,
139
+ children: T
140
+ })] }) : /* @__PURE__ */ N(D, { children: [u(B), o && /* @__PURE__ */ a(ye, {
141
+ root: L,
142
+ children: /* @__PURE__ */ a("div", {
136
143
  ...V(),
137
144
  ref: J,
138
- id: a,
139
- "data-test": n,
140
- "data-testid": n,
145
+ id: l,
146
+ "data-test": i,
147
+ "data-testid": i,
141
148
  role: t ? "dialog" : void 0,
142
- "aria-labelledby": t && f ? L : void 0,
143
- "aria-label": t && !f ? O : void 0,
149
+ "aria-labelledby": t && p ? k : void 0,
150
+ "aria-label": t && !p ? F : void 0,
144
151
  tabIndex: t ? void 0 : -1,
145
152
  ...b ? ae : {},
146
153
  style: {
147
154
  ...b ? le : {},
148
- ...j,
149
- minWidth: Oe,
155
+ ...$,
156
+ minWidth: Ie,
150
157
  width: ne,
151
158
  maxWidth: re,
152
- maxHeight: U
159
+ maxHeight: K
153
160
  },
154
- className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", I),
155
- children: /* @__PURE__ */ c(xe, {
156
- dataTest: n,
157
- title: f,
158
- titleId: L,
159
- viewResultsAction: h(oe),
160
- resetAction: h(S),
161
- footerActions: h(w),
162
- closeLabel: A,
163
- onClose: i,
164
- children: h(E)
161
+ className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", C),
162
+ children: /* @__PURE__ */ a(me.Provider, {
163
+ value: c,
164
+ children: /* @__PURE__ */ a(Pe, {
165
+ dataTest: i,
166
+ title: p,
167
+ titleId: k,
168
+ viewResultsAction: h(oe),
169
+ resetAction: h(M),
170
+ footerActions: h(S),
171
+ closeLabel: A,
172
+ onClose: n,
173
+ children: h(T)
174
+ })
165
175
  })
166
176
  })
167
177
  })] });
168
178
  };
169
179
  export {
170
- Ve as PopoverSheet
180
+ Je as PopoverSheet
171
181
  };
@@ -1,124 +1,134 @@
1
1
  import { cn as Y } from "../../../helpers/cn.js";
2
- import { resolveSx as R } from "../../../helpers/sx.js";
3
- import { tabbableWithin as y } from "../../../helpers/focusable.js";
4
- import { TOP_LAYER_PROPS as W, TOP_LAYER_RESET_STYLE as $, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as q, useTopLayerRef as B } from "../../../hooks/useTopLayer.hook.js";
5
- import { useEffect as P, useMemo as G, useRef as J, useState as h } from "react";
6
- import { jsx as T } from "react/jsx-runtime";
7
- import { FloatingPortal as Q, autoUpdate as V, flip as X, offset as Z, shift as C, useDismiss as ee, useFloating as te, useInteractions as oe, useMergeRefs as ne } from "@floating-ui/react";
8
- var re = {
2
+ import { resolveSx as h } from "../../../helpers/sx.js";
3
+ import { tabbableWithin as g } from "../../../helpers/focusable.js";
4
+ import { TOP_LAYER_PROPS as W, TOP_LAYER_RESET_STYLE as $, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as q, useTopLayerRef as C } from "../../../hooks/useTopLayer.hook.js";
5
+ import { OverlayBackOwnerContext as G, useBackCloses as J } from "../../../hooks/useBackCloses.hook.js";
6
+ import { useEffect as w, useMemo as Q, useRef as V, useState as x } from "react";
7
+ import { jsx as P } from "react/jsx-runtime";
8
+ import { FloatingPortal as X, autoUpdate as Z, flip as ee, offset as te, shift as oe, useDismiss as ne, useFloating as re, useInteractions as se, useMergeRefs as ie } from "@floating-ui/react";
9
+ var ae = {
9
10
  vertical: "bottom",
10
11
  horizontal: "left"
11
- }, se = {
12
+ }, ce = {
12
13
  vertical: "top",
13
14
  horizontal: "left"
14
- }, ie = (o, t) => `${t.vertical === "bottom" ? "top" : t.vertical === "top" ? "bottom" : o.vertical === "top" ? "top" : "bottom"}${o.horizontal === "left" ? "-start" : o.horizontal === "right" ? "-end" : ""}`, ve = ({ open: o, anchorEl: t, onClose: u, anchorOrigin: b = re, transformOrigin: L = se, id: x, className: D, sx: K, slotProps: l, onClick: S, children: _, keepMounted: E = !1, tabIntoContent: d = !0 }) => {
15
- const F = G(() => ie(b, L), [b, L]), [w, O] = h(o), c = J(!1);
16
- o && !w && O(!0);
17
- const m = o || E && w, p = j(t), [v, k] = h(p);
18
- t && v !== p && k(p);
19
- const { refs: a, floatingStyles: M, context: A } = te({
20
- open: o,
21
- placement: F,
15
+ }, fe = (t, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : t.vertical === "top" ? "top" : "bottom"}${t.horizontal === "left" ? "-start" : t.horizontal === "right" ? "-end" : ""}`, Pe = ({ open: t, anchorEl: o, onClose: c, anchorOrigin: b = ae, transformOrigin: L = ce, id: D, className: T, sx: K, slotProps: l, onClick: k, children: E, keepMounted: O = !1, tabIntoContent: d = !0, registerBackClose: S = !0 }) => {
16
+ const _ = Q(() => fe(b, L), [b, L]), [R, F] = x(t), f = V(!1);
17
+ t && !R && F(!0);
18
+ const m = t || O && R, p = j(o), [v, M] = x(p);
19
+ o && v !== p && M(p);
20
+ const { refs: i, floatingStyles: A, context: N } = re({
21
+ open: t,
22
+ placement: _,
22
23
  strategy: "fixed",
23
- whileElementsMounted: V,
24
- elements: { reference: t ?? void 0 },
24
+ whileElementsMounted: Z,
25
+ elements: { reference: o ?? void 0 },
25
26
  middleware: [
26
- Z(4),
27
- X({ padding: 8 }),
28
- C({ padding: 8 })
27
+ te(4),
28
+ ee({ padding: 8 }),
29
+ oe({ padding: 8 })
29
30
  ],
30
31
  onOpenChange: (e, r, n) => {
31
- e || u?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
32
+ e || c?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
32
33
  }
33
- }), { getFloatingProps: N } = oe([ee(A, {
34
+ }), { getFloatingProps: z } = se([ne(N, {
34
35
  outsidePress: (e) => {
35
36
  const r = e.target;
36
- return !(t instanceof Element && r instanceof Node && t.contains(r));
37
+ return !(o instanceof Element && r instanceof Node && o.contains(r));
37
38
  },
38
39
  escapeKey: !0
39
- })]), f = q(v), z = ne([B(a.setFloating, f)]);
40
- P(() => {
41
- if (!o) return;
42
- const e = t instanceof HTMLElement ? t : null, r = () => a.floating.current?.contains(document.activeElement) ?? !1;
40
+ })]);
41
+ J({
42
+ active: t && S,
43
+ requestClose: (e) => c ? c(e ?? new Event("overlayBack"), "escapeKeyDown") : !1,
44
+ ownerRef: i.floating
45
+ });
46
+ const u = q(v), H = ie([C(i.setFloating, u)]);
47
+ w(() => {
48
+ if (!t) return;
49
+ const e = o instanceof HTMLElement ? o : null, r = () => i.floating.current?.contains(document.activeElement) ?? !1;
43
50
  let n = r();
44
51
  const s = () => {
45
52
  n = r();
46
53
  };
47
54
  return document.addEventListener("focusin", s), () => {
48
55
  document.removeEventListener("focusin", s);
49
- const i = document.activeElement, g = !i || i === document.body || r();
50
- n && g && e?.isConnected && e.focus({ preventScroll: !0 });
56
+ const a = document.activeElement, y = !a || a === document.body || r();
57
+ n && y && e?.isConnected && e.focus({ preventScroll: !0 });
51
58
  };
52
59
  }, [
53
- o,
54
60
  t,
55
- a.floating
56
- ]), P(() => {
57
- if (!o) return;
61
+ o,
62
+ i.floating
63
+ ]), w(() => {
64
+ if (!t) return;
58
65
  const e = (n) => {
59
- if (c.current = n.key === "Tab", !d || !c.current || n.shiftKey || n.defaultPrevented) return;
60
- const s = a.floating.current;
61
- if (!s || !(t instanceof Element) || !t.contains(document.activeElement)) return;
62
- const [i] = y(s);
63
- i && (n.preventDefault(), i.focus({ preventScroll: !0 }), c.current = !1);
66
+ if (f.current = n.key === "Tab", !d || !f.current || n.shiftKey || n.defaultPrevented) return;
67
+ const s = i.floating.current;
68
+ if (!s || !(o instanceof Element) || !o.contains(document.activeElement)) return;
69
+ const [a] = g(s);
70
+ a && (n.preventDefault(), a.focus({ preventScroll: !0 }), f.current = !1);
64
71
  }, r = (n) => {
65
- const s = n.target, i = s instanceof Node && ((a.floating.current?.contains(s) ?? !1) || t instanceof Element && t.contains(s));
66
- c.current && !i && u?.(n, "tabKeyDown"), c.current = !1;
72
+ const s = n.target, a = s instanceof Node && ((i.floating.current?.contains(s) ?? !1) || o instanceof Element && o.contains(s));
73
+ f.current && !a && c?.(n, "tabKeyDown"), f.current = !1;
67
74
  };
68
75
  return document.addEventListener("keydown", e, !0), document.addEventListener("focusin", r), () => {
69
76
  document.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", r);
70
77
  };
71
78
  }, [
72
- o,
73
79
  t,
74
- u,
75
- a.floating,
80
+ o,
81
+ c,
82
+ i.floating,
76
83
  d
77
84
  ]);
78
- const H = o ? N({
79
- onClick: S,
85
+ const U = t ? z({
86
+ onClick: k,
80
87
  onKeyDown: (e) => {
81
- if (e.key !== "Tab" || e.defaultPrevented || !(t instanceof HTMLElement)) return;
82
- const r = e.currentTarget, n = y(r), s = n.indexOf(document.activeElement);
88
+ if (e.key !== "Tab" || e.defaultPrevented || !(o instanceof HTMLElement)) return;
89
+ const r = e.currentTarget, n = g(r), s = n.indexOf(document.activeElement);
83
90
  if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
84
91
  e.preventDefault();
85
- const i = y(document).filter((I) => !r.contains(I)), g = i[i.indexOf(t) + (e.shiftKey ? -1 : 1)], U = (d && e.shiftKey ? void 0 : g) ?? t;
86
- c.current = !1, U.focus({ preventScroll: !0 }), u?.(e, "tabKeyDown");
92
+ const a = g(document).filter((I) => !r.contains(I)), y = a[a.indexOf(o) + (e.shiftKey ? -1 : 1)], B = (d && e.shiftKey ? void 0 : y) ?? o;
93
+ f.current = !1, B.focus({ preventScroll: !0 }), c?.(e, "tabKeyDown");
87
94
  }
88
95
  }) : {};
89
- return P(() => {
90
- if (!m || !f) return;
91
- const e = a.floating.current;
96
+ return w(() => {
97
+ if (!m || !u) return;
98
+ const e = i.floating.current;
92
99
  if (!(!e || typeof e.showPopover != "function"))
93
100
  try {
94
- o && !e.matches(":popover-open") && e.showPopover(), !o && e.matches(":popover-open") && e.hidePopover();
101
+ t && !e.matches(":popover-open") && e.showPopover(), !t && e.matches(":popover-open") && e.hidePopover();
95
102
  } catch {
96
103
  }
97
104
  }, [
98
- o,
105
+ t,
99
106
  m,
100
- f,
101
- a.floating
102
- ]), m ? /* @__PURE__ */ T(Q, {
107
+ u,
108
+ i.floating
109
+ ]), m ? /* @__PURE__ */ P(X, {
103
110
  root: v,
104
- children: /* @__PURE__ */ T("div", {
105
- ref: z,
106
- id: x,
107
- ...f ? W : {},
111
+ children: /* @__PURE__ */ P("div", {
112
+ ref: H,
113
+ id: D,
114
+ ...u ? W : {},
108
115
  style: {
109
- ...f ? $ : {},
110
- ...o ? M : {},
111
- ...R(K),
112
- ...R(l?.paper?.sx),
116
+ ...u ? $ : {},
117
+ ...t ? A : {},
118
+ ...h(K),
119
+ ...h(l?.paper?.sx),
113
120
  ...l?.paper?.style,
114
- ...o ? null : { display: "none" }
121
+ ...t ? null : { display: "none" }
115
122
  },
116
- ...H,
117
- className: Y("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", D ?? "my-1", l?.paper?.className),
118
- children: _
123
+ ...U,
124
+ className: Y("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", T ?? "my-1", l?.paper?.className),
125
+ children: /* @__PURE__ */ P(G.Provider, {
126
+ value: i.floating,
127
+ children: E
128
+ })
119
129
  })
120
130
  }) : null;
121
131
  };
122
132
  export {
123
- ve as StyledPopover
133
+ Pe as StyledPopover
124
134
  };
@@ -1,36 +1,44 @@
1
- import { setPickerPosition as u } from "./helpers.js";
2
- import { StyledDayPicker as k } from "./components/StyledDayPicker.js";
3
- import { StyledCalendarPicker as y } from "./components/StyledCalendarPicker.js";
4
- import { DatePickerInputIndex as v } from "./components/DatePickerInputIndex.js";
1
+ import { isOverlayBackEnabled as k, useBackCloses as P } from "../../../hooks/useBackCloses.hook.js";
2
+ import { setPickerPosition as v } from "./helpers.js";
3
+ import { StyledDayPicker as y } from "./components/StyledDayPicker.js";
4
+ import { StyledCalendarPicker as C } from "./components/StyledCalendarPicker.js";
5
+ import { DatePickerInputIndex as b } from "./components/DatePickerInputIndex.js";
5
6
  import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
6
- import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
7
- import { useEffect as h, useState as s } from "react";
8
- import { Fragment as C, jsx as t, jsxs as D } from "react/jsx-runtime";
9
- var j = (p) => {
10
- const i = x(), [e, c] = s(null), [m, d] = s(!1), [f, l] = s(!1), P = (r) => {
11
- c(r.currentTarget), u(r, d);
7
+ import { StyledDrawer as h } from "../../../components/navigation/drawer/StyledDrawer.js";
8
+ import { useBackNavigationClose as E } from "../../hooks/useBackNavigationClose.hook.js";
9
+ import { useEffect as D, useState as n } from "react";
10
+ import { Fragment as g, jsx as t, jsxs as w } from "react/jsx-runtime";
11
+ var N = (p) => {
12
+ const i = x(), [e, l] = n(null), [m, d] = n(!1), [f, c] = n(!1), u = (r) => {
13
+ l(r.currentTarget), v(r, d);
12
14
  }, o = () => {
13
- l(!0), c(null);
15
+ c(!0), l(null);
14
16
  };
15
- h(() => {
17
+ D(() => {
16
18
  if (!e) return;
17
- const r = (n) => {
18
- document.activeElement === e && (n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), o()) : n.key === "Tab" && o());
19
+ const r = (a) => {
20
+ document.activeElement === e && (a.key === "Escape" ? (a.preventDefault(), a.stopPropagation(), o()) : a.key === "Tab" && o());
19
21
  };
20
22
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
21
- }, [e]);
22
- const a = {
23
+ }, [e]), P({
24
+ active: !!e,
25
+ requestClose: o
26
+ }), E({
27
+ open: !!e && !k(),
28
+ onClose: o
29
+ });
30
+ const s = {
23
31
  ...p,
24
32
  validateOnCalendarClose: f,
25
- onValidatedOnce: () => l(!1)
33
+ onValidatedOnce: () => c(!1)
26
34
  };
27
- return /* @__PURE__ */ D(C, { children: [
28
- /* @__PURE__ */ t(v, {
29
- datePickerProps: a,
30
- onClick: P
35
+ return /* @__PURE__ */ w(g, { children: [
36
+ /* @__PURE__ */ t(b, {
37
+ datePickerProps: s,
38
+ onClick: u
31
39
  }),
32
- !i && /* @__PURE__ */ t(y, {
33
- datePickerProps: { ...a },
40
+ !i && /* @__PURE__ */ t(C, {
41
+ datePickerProps: { ...s },
34
42
  popoverProps: {
35
43
  open: !!e,
36
44
  anchorEl: e,
@@ -38,15 +46,16 @@ var j = (p) => {
38
46
  },
39
47
  positionAbove: m
40
48
  }),
41
- i && /* @__PURE__ */ t(b, {
49
+ i && /* @__PURE__ */ t(h, {
42
50
  anchor: "bottom",
43
51
  open: !!e,
44
52
  onClose: o,
45
53
  anchorEl: e,
54
+ registerBackClose: !1,
46
55
  children: /* @__PURE__ */ t("div", {
47
56
  className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
48
- children: /* @__PURE__ */ t(k, {
49
- datePickerProps: { ...a },
57
+ children: /* @__PURE__ */ t(y, {
58
+ datePickerProps: { ...s },
50
59
  popoverProps: {
51
60
  open: !!e,
52
61
  anchorEl: e,
@@ -58,5 +67,5 @@ var j = (p) => {
58
67
  ] });
59
68
  };
60
69
  export {
61
- j as StyledDatePicker
70
+ N as StyledDatePicker
62
71
  };
@@ -1,30 +1,31 @@
1
1
  import { StyledPopover as i } from "../../../../components/utils/popover/StyledPopover.js";
2
2
  import { StyledDayPicker as c } from "./StyledDayPicker.js";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
- var h = ({ datePickerProps: e, popoverProps: t, positionAbove: o }) => {
5
- const { open: l, anchorEl: n, onClose: a } = t;
4
+ var d = ({ datePickerProps: o, popoverProps: t, positionAbove: e }) => {
5
+ const { open: l, anchorEl: a, onClose: n } = t;
6
6
  return /* @__PURE__ */ r(i, {
7
7
  open: l,
8
- anchorEl: n,
9
- onClose: a,
8
+ anchorEl: a,
9
+ onClose: n,
10
10
  tabIntoContent: !1,
11
+ registerBackClose: !1,
11
12
  anchorOrigin: {
12
- vertical: o ? "top" : 50,
13
+ vertical: e ? "top" : 50,
13
14
  horizontal: "left"
14
15
  },
15
16
  transformOrigin: {
16
- vertical: o ? "bottom" : "top",
17
+ vertical: e ? "bottom" : "top",
17
18
  horizontal: "left"
18
19
  },
19
20
  children: /* @__PURE__ */ r("div", {
20
21
  className: "p-4",
21
22
  children: /* @__PURE__ */ r(c, {
22
- datePickerProps: e,
23
+ datePickerProps: o,
23
24
  popoverProps: t
24
25
  })
25
26
  })
26
27
  });
27
28
  };
28
29
  export {
29
- h as StyledCalendarPicker
30
+ d as StyledCalendarPicker
30
31
  };