asma-ui-core 3.86.1 → 3.86.2

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 (42) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/chip/StyledChip.js +28 -27
  3. package/dist/components/data-display/tooltip/StyledTooltip.js +76 -47
  4. package/dist/components/feedback/dialog/StyledDialog.js +62 -58
  5. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +113 -105
  6. package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +10 -12
  7. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +75 -67
  8. package/dist/components/feedback/snack-bar/StyledSnackbar.js +12 -10
  9. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +69 -71
  10. package/dist/components/inputs/input-field/StyledInputField.js +10 -9
  11. package/dist/components/inputs/phone-field/CountryCodeOptions.js +16 -15
  12. package/dist/components/inputs/phone-field/CountryCodeSelect.js +98 -85
  13. package/dist/components/inputs/phone-field/useCountryPicker.js +44 -24
  14. package/dist/components/inputs/select/StyledSelect.js +15 -14
  15. package/dist/components/inputs/select/StyledSelectItem.js +4 -4
  16. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +199 -172
  17. package/dist/components/navigation/listbox/Listbox.js +104 -54
  18. package/dist/components/navigation/menu/StyledMenu.js +22 -18
  19. package/dist/components/navigation/menu/StyledMenuItem.js +6 -6
  20. package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +26 -22
  21. package/dist/components/utils/copy-wrapper/CopyWrapper.module.js +2 -2
  22. package/dist/components/utils/popover/StyledPopover.js +102 -52
  23. package/dist/datetime/components/date-picker/StyledDatePicker.js +40 -34
  24. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +5 -4
  25. package/dist/datetime/components/time-picker/StyledTimePicker.js +69 -56
  26. package/dist/helpers/focusable.js +5 -0
  27. package/dist/hooks/useFocusTrap.hook.js +24 -19
  28. package/dist/src/components/data-display/chip/StyledChip.d.ts +2 -0
  29. package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +3 -4
  30. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts +1 -0
  31. package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +1 -1
  32. package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +5 -2
  33. package/dist/src/components/navigation/listbox/Listbox.d.ts +3 -2
  34. package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -2
  35. package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +2 -1
  36. package/dist/src/components/utils/popover/StyledPopover.d.ts +9 -2
  37. package/dist/src/helpers/focusable.d.ts +8 -0
  38. package/dist/src/hooks/useFocusTrap.hook.d.ts +2 -1
  39. package/dist/table/components/columns/action-column/components/RowActionMenu.js +30 -34
  40. package/dist/table/components/table-footer/TablePagination.js +18 -17
  41. package/dist/table/components/table-footer/TableRowCountSelect.js +5 -4
  42. package/package.json +1 -1
@@ -1,80 +1,130 @@
1
- import { ClickAwayListener as p } from "../../mui-compat/ClickAwayListener.js";
2
- import { createContext as x, useContext as d, useEffect as b, useMemo as v, useState as m } from "react";
3
- import { jsx as s } from "react/jsx-runtime";
4
- var a = x(null), l = () => {
5
- const t = d(a);
1
+ import { tabbableWithin as L } from "../../../helpers/focusable.js";
2
+ import { ClickAwayListener as $ } from "../../mui-compat/ClickAwayListener.js";
3
+ import { Children as C, cloneElement as D, createContext as O, isValidElement as g, useCallback as B, useContext as S, useEffect as w, useId as M, useMemo as T, useRef as q, useState as k } from "react";
4
+ import { jsx as x } from "react/jsx-runtime";
5
+ var I = O(null), b = () => {
6
+ const t = S(I);
6
7
  if (!t) throw new Error("Listbox.Button/Options/Option must be rendered inside <Listbox>");
7
8
  return t;
8
- }, f = (t, e) => typeof t == "function" ? t(e) : t;
9
- function L({ value: t, onChange: e, children: r }) {
10
- const [o, n] = m(!1), u = v(() => ({
11
- open: o,
9
+ }, h = (t, l) => typeof t == "function" ? t(l) : t;
10
+ function K({ value: t, onChange: l, children: d }) {
11
+ const [s, u] = k(!1), [n, o] = k(null), r = `listbox-${M()}`, p = q(null), a = B(() => {
12
+ u(!1), o(null);
13
+ }, []);
14
+ w(() => {
15
+ if (!s) return;
16
+ const i = (y) => {
17
+ if (y.key !== "Escape") return;
18
+ const e = p.current;
19
+ e?.contains(document.activeElement) && e.querySelector('[role="combobox"]')?.focus(), a();
20
+ };
21
+ return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
22
+ }, [s, a]);
23
+ const f = T(() => ({
24
+ open: s,
12
25
  select: (i) => {
13
- e(i), n(!1);
26
+ l(i), a();
14
27
  },
15
- setOpen: n,
28
+ setOpen: u,
29
+ setActiveIndex: o,
30
+ activeIndex: n,
31
+ listboxId: r,
16
32
  value: t
17
33
  }), [
18
- o,
34
+ s,
19
35
  t,
20
- e
36
+ l,
37
+ n,
38
+ r,
39
+ a
21
40
  ]);
22
- return b(() => {
23
- if (!o) return;
24
- const i = (c) => {
25
- c.key === "Escape" && n(!1);
26
- };
27
- return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
28
- }, [o]), /* @__PURE__ */ s(a.Provider, {
29
- value: u,
30
- children: /* @__PURE__ */ s(p, {
31
- onClickAway: () => n(!1),
32
- children: /* @__PURE__ */ s("div", {
41
+ return /* @__PURE__ */ x(I.Provider, {
42
+ value: f,
43
+ children: /* @__PURE__ */ x($, {
44
+ onClickAway: a,
45
+ children: /* @__PURE__ */ x("div", {
46
+ ref: (i) => {
47
+ p.current = i;
48
+ },
49
+ onBlur: (i) => {
50
+ i.relatedTarget && !i.currentTarget.contains(i.relatedTarget) && a();
51
+ },
33
52
  className: "relative w-full",
34
- children: r
53
+ children: d
35
54
  })
36
55
  })
37
56
  });
38
57
  }
39
- var y = ({ children: t, className: e, ...r }) => {
40
- const { open: o, setOpen: n } = l();
41
- return /* @__PURE__ */ s("button", {
58
+ var N = ({ children: t, className: l, onClick: d, onKeyDown: s, ...u }) => {
59
+ const { activeIndex: n, listboxId: o, open: r, setActiveIndex: p, setOpen: a } = b(), f = () => Array.from(document.querySelectorAll(`#${CSS.escape(o)} [role="option"]:not([aria-disabled="true"])`)), i = (e) => {
60
+ const c = f();
61
+ if (c.length === 0) return;
62
+ const m = c.findIndex((E) => E.id === `${o}-option-${n}`), v = m === -1 ? e === 1 ? 0 : c.length - 1 : Math.min(Math.max(m + e, 0), c.length - 1);
63
+ p(Number(c[v].dataset.index));
64
+ };
65
+ return /* @__PURE__ */ x("button", {
66
+ ...u,
42
67
  type: "button",
43
- className: e,
44
- onClick: () => n(!o),
45
- ...r,
46
- children: f(t, { open: o })
68
+ className: l,
69
+ onClick: (e) => {
70
+ d?.(e), e.defaultPrevented || a(!r);
71
+ },
72
+ onKeyDown: (e) => {
73
+ if (s?.(e), !e.defaultPrevented)
74
+ if (e.key === "ArrowDown" || e.key === "ArrowUp")
75
+ e.preventDefault(), r ? i(e.key === "ArrowDown" ? 1 : -1) : (a(!0), requestAnimationFrame(() => i(e.key === "ArrowDown" ? 1 : -1)));
76
+ else if (r && (e.key === "Home" || e.key === "End")) {
77
+ e.preventDefault();
78
+ const c = f(), m = c[e.key === "Home" ? 0 : c.length - 1];
79
+ m && p(Number(m.dataset.index));
80
+ } else r && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f().find((c) => c.id === `${o}-option-${n}`)?.click());
81
+ },
82
+ role: "combobox",
83
+ "aria-haspopup": "listbox",
84
+ "aria-expanded": r,
85
+ "aria-controls": r ? o : void 0,
86
+ "aria-activedescendant": r && n !== null ? `${o}-option-${n}` : void 0,
87
+ children: h(t, { open: r })
47
88
  });
48
- }, k = ({ children: t, className: e }) => {
49
- const { open: r } = l();
50
- return r ? /* @__PURE__ */ s("div", {
89
+ }, P = ({ children: t, className: l }) => {
90
+ const { activeIndex: d, listboxId: s, open: u } = b();
91
+ return w(() => {
92
+ d !== null && document.getElementById(`${s}-option-${d}`)?.scrollIntoView({ block: "nearest" });
93
+ }, [d, s]), u ? /* @__PURE__ */ x("div", {
94
+ id: s,
51
95
  role: "listbox",
52
- className: e,
53
- children: t
96
+ className: l,
97
+ children: (() => {
98
+ let n = 0;
99
+ return C.toArray(t).map((o) => g(o) && o.type === A ? D(o, { optionIndex: n++ }) : o);
100
+ })()
54
101
  }) : null;
55
102
  };
56
- function w({ value: t, disabled: e, children: r, className: o }) {
57
- const n = l(), u = n.value === t, i = () => {
58
- e || n.select(t);
103
+ function A({ value: t, disabled: l, children: d, className: s, optionIndex: u = 0 }) {
104
+ const n = b(), o = n.value === t, r = () => {
105
+ l || n.select(t);
59
106
  };
60
- return /* @__PURE__ */ s("div", {
107
+ return /* @__PURE__ */ x("div", {
108
+ id: `${n.listboxId}-option-${u}`,
61
109
  role: "option",
62
- "aria-selected": u,
63
- "aria-disabled": e,
64
- tabIndex: e ? void 0 : 0,
65
- className: o,
66
- onClick: i,
67
- onKeyDown: (c) => {
68
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), i());
110
+ "aria-selected": o,
111
+ "aria-disabled": l,
112
+ "data-index": u,
113
+ tabIndex: -1,
114
+ className: s,
115
+ onMouseDown: (p) => {
116
+ const a = p.target;
117
+ L(p.currentTarget).some((f) => f.contains(a)) || p.preventDefault();
69
118
  },
70
- children: f(r, { selected: u })
119
+ onClick: r,
120
+ children: h(d, { selected: o })
71
121
  });
72
122
  }
73
- var h = Object.assign(L, {
74
- Button: y,
75
- Option: w,
76
- Options: k
123
+ var H = Object.assign(K, {
124
+ Button: N,
125
+ Option: A,
126
+ Options: P
77
127
  });
78
128
  export {
79
- h as Listbox
129
+ H as Listbox
80
130
  };
@@ -1,30 +1,34 @@
1
- import { cn as S } from "../../../helpers/cn.js";
2
- import { StyledPopover as f } from "../../utils/popover/StyledPopover.js";
3
- import { StyledMenuList as u } from "./StyledMenuList.js";
4
- import { jsx as p } from "react/jsx-runtime";
5
- var v = {
1
+ import { cn as u } from "../../../helpers/cn.js";
2
+ import { StyledPopover as c } from "../../utils/popover/StyledPopover.js";
3
+ import { StyledMenuList as S } from "./StyledMenuList.js";
4
+ import { jsx as o } from "react/jsx-runtime";
5
+ var N = {
6
6
  border: "1px solid var(--colors-delta-300)",
7
7
  boxShadow: "0px 2px 4px 0px rgba(34, 33, 51, 0.15)"
8
- }, h = ({ open: a, anchorEl: o, onClose: t, anchorOrigin: l, transformOrigin: m, id: d, className: s, sx: x, classes: e, slotProps: r, autoFocus: i = !0, onClick: c, children: n, keepMounted: y }) => /* @__PURE__ */ p(f, {
9
- open: a,
10
- anchorEl: o,
8
+ }, h = ({ open: p, anchorEl: m, onClose: t, anchorOrigin: l, transformOrigin: i, id: d, className: s, sx: x, classes: a, slotProps: e, autoFocus: n = !0, onClick: y, children: b, keepMounted: f }) => /* @__PURE__ */ o(c, {
9
+ open: p,
10
+ anchorEl: m,
11
11
  onClose: t,
12
+ tabIntoContent: !1,
12
13
  anchorOrigin: l,
13
- transformOrigin: m,
14
+ transformOrigin: i,
14
15
  id: d,
15
16
  className: s,
16
17
  sx: x,
17
- keepMounted: y,
18
+ keepMounted: f,
18
19
  slotProps: { paper: {
19
- className: S("rounded", e?.paper, r?.paper?.className),
20
- sx: [v, r?.paper?.sx],
21
- style: r?.paper?.style
20
+ className: u("rounded", a?.paper, e?.paper?.className),
21
+ sx: [N, e?.paper?.sx],
22
+ style: e?.paper?.style
22
23
  } },
23
- children: /* @__PURE__ */ p(u, {
24
- autoFocus: i,
25
- className: e?.list,
26
- onClick: c,
27
- children: n
24
+ children: /* @__PURE__ */ o(S, {
25
+ autoFocus: n,
26
+ className: a?.list,
27
+ onClick: y,
28
+ onKeyDown: (r) => {
29
+ r.key === "Tab" && r.target.getAttribute("role") === "menuitem" && t?.(r, "tabKeyDown");
30
+ },
31
+ children: b
28
32
  })
29
33
  });
30
34
  export {
@@ -1,7 +1,7 @@
1
1
  import { cn as r } from "../../../helpers/cn.js";
2
- import { resolveSx as y } from "../../../helpers/sx.js";
2
+ import { resolveSx as c } from "../../../helpers/sx.js";
3
3
  import { jsx as f } from "react/jsx-runtime";
4
- var D = ({ children: n, onClick: o, onMouseDown: i, onMouseUp: l, disabled: e, selected: s, dense: m, className: d, classes: a, sx: u, "data-test": p, "data-testid": x, value: c }) => /* @__PURE__ */ f("li", {
4
+ var g = ({ children: n, onClick: o, onMouseDown: i, onMouseUp: s, disabled: e, selected: l, dense: m, className: d, classes: a, sx: u, "data-test": p, "data-testid": x, value: v }) => /* @__PURE__ */ f("li", {
5
5
  role: "menuitem",
6
6
  "aria-disabled": e ? !0 : void 0,
7
7
  tabIndex: -1,
@@ -9,17 +9,17 @@ var D = ({ children: n, onClick: o, onMouseDown: i, onMouseUp: l, disabled: e, s
9
9
  "data-testid": x,
10
10
  onClick: e ? void 0 : o,
11
11
  onMouseDown: e ? void 0 : i,
12
- onMouseUp: e ? void 0 : l,
12
+ onMouseUp: e ? void 0 : s,
13
13
  onKeyDown: (t) => {
14
14
  e || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), o?.(t));
15
15
  },
16
- className: r("box-border flex items-center px-4 text-base outline-none", m ? "min-h-8 py-1" : "min-h-10 py-2", "asma-pressable asma-touch-target", e ? "cursor-not-allowed text-delta-300 aria-disabled:text-delta-300" : "cursor-pointer text-delta-700 hover:bg-delta-50", s && r("bg-gama-50", a?.selected), a?.root, d),
16
+ className: r("box-border flex items-center px-4 text-base outline-none focus-visible:shadow-[inset_3px_0_var(--colors-focus-ring)]", m ? "min-h-8 py-1" : "min-h-10 py-2", "asma-pressable asma-touch-target", e ? "cursor-not-allowed text-delta-300 aria-disabled:text-delta-300" : "cursor-pointer text-delta-700 hover:bg-delta-50", l && r("bg-gama-50", a?.selected), a?.root, d),
17
17
  style: {
18
18
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
19
- ...y(u)
19
+ ...c(u)
20
20
  },
21
21
  children: n
22
22
  });
23
23
  export {
24
- D as StyledMenuItem
24
+ g as StyledMenuItem
25
25
  };
@@ -1,27 +1,31 @@
1
- import n from "./StyledAccordion.module.js";
2
- import { useAccordionContext as g } from "./AccordionContext.js";
3
- import { clsx as s } from "clsx";
4
- import { useEffect as h, useRef as v, useState as x } from "react";
5
- import { jsx as c } from "react/jsx-runtime";
6
- var C = ({ children: r, className: i, contentClassName: l, ...a }) => {
7
- const { open: d, panelId: m, triggerId: u } = g(), e = v(null), [f, p] = x(0);
8
- return h(() => {
9
- if (!e.current) return;
10
- const t = () => p(e.current?.scrollHeight ?? 0);
1
+ import u from "./StyledAccordion.module.js";
2
+ import { useAccordionContext as h } from "./AccordionContext.js";
3
+ import { clsx as a } from "clsx";
4
+ import { useEffect as x, useLayoutEffect as y, useRef as c, useState as A } from "react";
5
+ import { jsx as d } from "react/jsx-runtime";
6
+ var C = ({ children: s, className: f, contentClassName: m, ...p }) => {
7
+ const { open: e, panelId: g, triggerId: o } = h(), l = c(null), r = c(null), i = c(e), [v, b] = A(0);
8
+ return x(() => {
9
+ if (!r.current) return;
10
+ const t = () => b(r.current?.scrollHeight ?? 0);
11
11
  t();
12
- const o = new ResizeObserver(t);
13
- return o.observe(e.current), () => o.disconnect();
14
- }, [r]), /* @__PURE__ */ c("div", {
15
- ...a,
16
- id: m,
12
+ const n = new ResizeObserver(t);
13
+ return n.observe(r.current), () => n.disconnect();
14
+ }, [s]), y(() => {
15
+ const t = l.current, n = i.current && !e && t?.contains(document.activeElement);
16
+ t?.toggleAttribute("inert", !e), n && document.getElementById(o)?.focus({ preventScroll: !0 }), i.current = e;
17
+ }, [e, o]), /* @__PURE__ */ d("div", {
18
+ ref: l,
19
+ ...p,
20
+ id: g,
17
21
  role: "region",
18
- "aria-labelledby": u,
19
- className: s(n.Panel, i),
20
- style: { "--accordion-panel-height": d ? `${f}px` : "0px" },
21
- children: /* @__PURE__ */ c("div", {
22
- ref: e,
23
- className: s(n.Content, l),
24
- children: r
22
+ "aria-labelledby": o,
23
+ className: a(u.Panel, f),
24
+ style: { "--accordion-panel-height": e ? `${v}px` : "0px" },
25
+ children: /* @__PURE__ */ d("div", {
26
+ ref: r,
27
+ className: a(u.Content, m),
28
+ children: s
25
29
  })
26
30
  });
27
31
  };
@@ -1,6 +1,6 @@
1
1
  var p = {
2
- "copy-wrapper": "_copy-wrapper_1gjzc_1",
3
- "hidden-copy": "_hidden-copy_1gjzc_1"
2
+ "copy-wrapper": "_copy-wrapper_15hst_1",
3
+ "hidden-copy": "_hidden-copy_15hst_1"
4
4
  };
5
5
  export {
6
6
  p as default
@@ -1,74 +1,124 @@
1
- import { cn as E } from "../../../helpers/cn.js";
2
- import { resolveSx as d } from "../../../helpers/sx.js";
3
- import { TOP_LAYER_PROPS as M, TOP_LAYER_RESET_STYLE as z, getOpenModalDialogAncestor as D, shouldUsePopoverTopLayer as N, useTopLayerRef as U } from "../../../hooks/useTopLayer.hook.js";
4
- import { useEffect as k, useMemo as C, useState as m } from "react";
5
- import { jsx as v } from "react/jsx-runtime";
6
- import { FloatingPortal as Y, autoUpdate as H, flip as K, offset as $, shift as j, useDismiss as I, useFloating as q, useInteractions as B, useMergeRefs as G } from "@floating-ui/react";
7
- var J = {
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 = {
8
9
  vertical: "bottom",
9
10
  horizontal: "left"
10
- }, Q = {
11
+ }, se = {
11
12
  vertical: "top",
12
13
  horizontal: "left"
13
- }, V = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, re = ({ open: e, anchorEl: o, onClose: g, anchorOrigin: f = J, transformOrigin: c = Q, id: y, className: h, sx: P, slotProps: a, onClick: R, children: _, keepMounted: x = !1 }) => {
14
- const T = C(() => V(f, c), [f, c]), [u, w] = m(e);
15
- e && !u && w(!0);
16
- const i = e || x && u, n = D(o), [l, L] = m(n);
17
- o && l !== n && L(n);
18
- const { refs: p, floatingStyles: S, context: b } = q({
19
- open: e,
20
- placement: T,
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,
21
22
  strategy: "fixed",
22
- whileElementsMounted: H,
23
- elements: { reference: o ?? void 0 },
23
+ whileElementsMounted: V,
24
+ elements: { reference: t ?? void 0 },
24
25
  middleware: [
25
- $(4),
26
- K({ padding: 8 }),
27
- j({ padding: 8 })
26
+ Z(4),
27
+ X({ padding: 8 }),
28
+ C({ padding: 8 })
28
29
  ],
29
- onOpenChange: (t, s, O) => {
30
- t || g?.(s ?? {}, O === "escape-key" ? "escapeKeyDown" : "backdropClick");
30
+ onOpenChange: (e, r, n) => {
31
+ e || u?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
31
32
  }
32
- }), { getFloatingProps: A } = B([I(b, {
33
- outsidePress: (t) => {
34
- const s = t.target;
35
- return !(o instanceof Element && s instanceof Node && o.contains(s));
33
+ }), { getFloatingProps: N } = oe([ee(A, {
34
+ outsidePress: (e) => {
35
+ const r = e.target;
36
+ return !(t instanceof Element && r instanceof Node && t.contains(r));
36
37
  },
37
38
  escapeKey: !0
38
- })]), r = N(l), F = G([U(p.setFloating, r)]);
39
- return k(() => {
40
- if (!i || !r) return;
41
- const t = p.floating.current;
42
- if (!(!t || typeof t.showPopover != "function"))
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;
43
+ let n = r();
44
+ const s = () => {
45
+ n = r();
46
+ };
47
+ return document.addEventListener("focusin", s), () => {
48
+ document.removeEventListener("focusin", s);
49
+ const i = document.activeElement, g = !i || i === document.body || r();
50
+ n && g && e?.isConnected && e.focus({ preventScroll: !0 });
51
+ };
52
+ }, [
53
+ o,
54
+ t,
55
+ a.floating
56
+ ]), P(() => {
57
+ if (!o) return;
58
+ 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);
64
+ }, 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;
67
+ };
68
+ return document.addEventListener("keydown", e, !0), document.addEventListener("focusin", r), () => {
69
+ document.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", r);
70
+ };
71
+ }, [
72
+ o,
73
+ t,
74
+ u,
75
+ a.floating,
76
+ d
77
+ ]);
78
+ const H = o ? N({
79
+ onClick: S,
80
+ 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);
83
+ if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
84
+ 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");
87
+ }
88
+ }) : {};
89
+ return P(() => {
90
+ if (!m || !f) return;
91
+ const e = a.floating.current;
92
+ if (!(!e || typeof e.showPopover != "function"))
43
93
  try {
44
- e && !t.matches(":popover-open") && t.showPopover(), !e && t.matches(":popover-open") && t.hidePopover();
94
+ o && !e.matches(":popover-open") && e.showPopover(), !o && e.matches(":popover-open") && e.hidePopover();
45
95
  } catch {
46
96
  }
47
97
  }, [
48
- e,
49
- i,
50
- r,
51
- p.floating
52
- ]), i ? /* @__PURE__ */ v(Y, {
53
- root: l,
54
- children: /* @__PURE__ */ v("div", {
55
- ref: F,
56
- id: y,
57
- ...r ? M : {},
98
+ o,
99
+ m,
100
+ f,
101
+ a.floating
102
+ ]), m ? /* @__PURE__ */ T(Q, {
103
+ root: v,
104
+ children: /* @__PURE__ */ T("div", {
105
+ ref: z,
106
+ id: x,
107
+ ...f ? W : {},
58
108
  style: {
59
- ...r ? z : {},
60
- ...e ? S : {},
61
- ...d(P),
62
- ...d(a?.paper?.sx),
63
- ...a?.paper?.style,
64
- ...e ? null : { display: "none" }
109
+ ...f ? $ : {},
110
+ ...o ? M : {},
111
+ ...R(K),
112
+ ...R(l?.paper?.sx),
113
+ ...l?.paper?.style,
114
+ ...o ? null : { display: "none" }
65
115
  },
66
- ...e ? A({ onClick: R }) : {},
67
- className: E("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", h ?? "my-1", a?.paper?.className),
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),
68
118
  children: _
69
119
  })
70
120
  }) : null;
71
121
  };
72
122
  export {
73
- re as StyledPopover
123
+ ve as StyledPopover
74
124
  };
@@ -1,54 +1,60 @@
1
- import { setPickerPosition as f } from "./helpers.js";
1
+ import { setPickerPosition as P } from "./helpers.js";
2
2
  import { StyledDayPicker as k } from "./components/StyledDayPicker.js";
3
- import { StyledCalendarPicker as u } from "./components/StyledCalendarPicker.js";
4
- import { DatePickerInputIndex as x } from "./components/DatePickerInputIndex.js";
5
- import { useIsMobileView as v } from "../../hooks/useWindowWidthSize.hook.js";
6
- import { StyledDrawer as C } from "../../../components/navigation/drawer/StyledDrawer.js";
7
- import { useBackNavigationClose as b } from "../../hooks/useBackNavigationClose.hook.js";
8
- import { useState as a } from "react";
9
- import { Fragment as h, jsx as o, jsxs as y } from "react/jsx-runtime";
10
- var E = (p) => {
11
- const s = v(), [e, n] = a(null), [c, m] = a(!1), [d, i] = a(!1), P = (l) => {
12
- n(l.currentTarget), f(l, m);
13
- }, r = () => {
14
- i(!0), n(null);
3
+ import { StyledCalendarPicker as v } from "./components/StyledCalendarPicker.js";
4
+ import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js";
5
+ import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
6
+ import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
7
+ import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
8
+ import { useEffect as C, useState as a } from "react";
9
+ import { Fragment as E, jsx as t, jsxs as w } from "react/jsx-runtime";
10
+ var L = (m) => {
11
+ const s = x(), [e, i] = a(null), [p, d] = a(!1), [f, c] = a(!1), u = (r) => {
12
+ i(r.currentTarget), P(r, d);
13
+ }, o = () => {
14
+ c(!0), i(null);
15
15
  };
16
- b({
16
+ C(() => {
17
+ if (!e) return;
18
+ const r = (l) => {
19
+ document.activeElement === e && (l.key === "Escape" || l.key === "Tab") && o();
20
+ };
21
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
22
+ }, [e]), h({
17
23
  open: !!e,
18
- onClose: r
24
+ onClose: o
19
25
  });
20
- const t = {
21
- ...p,
22
- validateOnCalendarClose: d,
23
- onValidatedOnce: () => i(!1)
26
+ const n = {
27
+ ...m,
28
+ validateOnCalendarClose: f,
29
+ onValidatedOnce: () => c(!1)
24
30
  };
25
- return /* @__PURE__ */ y(h, { children: [
26
- /* @__PURE__ */ o(x, {
27
- datePickerProps: t,
28
- onClick: P
31
+ return /* @__PURE__ */ w(E, { children: [
32
+ /* @__PURE__ */ t(y, {
33
+ datePickerProps: n,
34
+ onClick: u
29
35
  }),
30
- !s && /* @__PURE__ */ o(u, {
31
- datePickerProps: { ...t },
36
+ !s && /* @__PURE__ */ t(v, {
37
+ datePickerProps: { ...n },
32
38
  popoverProps: {
33
39
  open: !!e,
34
40
  anchorEl: e,
35
- onClose: r
41
+ onClose: o
36
42
  },
37
- positionAbove: c
43
+ positionAbove: p
38
44
  }),
39
- s && /* @__PURE__ */ o(C, {
45
+ s && /* @__PURE__ */ t(b, {
40
46
  anchor: "bottom",
41
47
  open: !!e,
42
- onClose: r,
48
+ onClose: o,
43
49
  anchorEl: e,
44
- children: /* @__PURE__ */ o("div", {
50
+ children: /* @__PURE__ */ t("div", {
45
51
  className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
46
- children: /* @__PURE__ */ o(k, {
47
- datePickerProps: { ...t },
52
+ children: /* @__PURE__ */ t(k, {
53
+ datePickerProps: { ...n },
48
54
  popoverProps: {
49
55
  open: !!e,
50
56
  anchorEl: e,
51
- onClose: r
57
+ onClose: o
52
58
  }
53
59
  })
54
60
  })
@@ -56,5 +62,5 @@ var E = (p) => {
56
62
  ] });
57
63
  };
58
64
  export {
59
- E as StyledDatePicker
65
+ L as StyledDatePicker
60
66
  };
@@ -1,12 +1,13 @@
1
- import { StyledPopover as n } from "../../../../components/utils/popover/StyledPopover.js";
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
4
  var h = ({ datePickerProps: e, popoverProps: t, positionAbove: o }) => {
5
- const { open: l, anchorEl: i, onClose: a } = t;
6
- return /* @__PURE__ */ r(n, {
5
+ const { open: l, anchorEl: n, onClose: a } = t;
6
+ return /* @__PURE__ */ r(i, {
7
7
  open: l,
8
- anchorEl: i,
8
+ anchorEl: n,
9
9
  onClose: a,
10
+ tabIntoContent: !1,
10
11
  anchorOrigin: {
11
12
  vertical: o ? "top" : 50,
12
13
  horizontal: "left"