asma-ui-core 3.134.3 → 3.134.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.
@@ -1,50 +1,54 @@
1
- import { cn as Y } from "../../../helpers/cn.js";
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 = {
1
+ import { cn as $ } 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 j, TOP_LAYER_RESET_STYLE as q, getOpenModalDialogAncestor as C, shouldUsePopoverTopLayer as G, useTopLayerRef as J } from "../../../hooks/useTopLayer.hook.js";
5
+ import { OverlayBackOwnerContext as Q, useBackCloses as V } from "../../../hooks/useBackCloses.hook.js";
6
+ import { useEffect as P, useMemo as X, useRef as Z, useState as w } from "react";
7
+ import { jsx as x } from "react/jsx-runtime";
8
+ import { FloatingPortal as ee, autoUpdate as te, flip as oe, offset as ne, shift as re, size as se, useDismiss as ie, useFloating as ae, useInteractions as ce, useMergeRefs as fe } from "@floating-ui/react";
9
+ var ue = {
10
10
  vertical: "bottom",
11
11
  horizontal: "left"
12
- }, ce = {
12
+ }, le = {
13
13
  vertical: "top",
14
14
  horizontal: "left"
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({
15
+ }, de = (t, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : t.vertical === "top" ? "top" : "bottom"}${t.horizontal === "left" ? "-start" : t.horizontal === "right" ? "-end" : ""}`, be = ({ open: t, anchorEl: o, onClose: c, anchorOrigin: h = ue, transformOrigin: b = le, id: D, className: T, sx: K, slotProps: l, onClick: k, children: E, keepMounted: O = !1, tabIntoContent: d = !0, registerBackClose: S = !0 }) => {
16
+ const _ = X(() => de(h, b), [h, b]), [L, F] = w(t), f = Z(!1), [M, H] = w();
17
+ t && !L && F(!0);
18
+ const m = t || O && L, p = C(o), [v, A] = w(p);
19
+ o && v !== p && A(p);
20
+ const { refs: i, floatingStyles: z, context: N } = ae({
21
21
  open: t,
22
22
  placement: _,
23
23
  strategy: "fixed",
24
- whileElementsMounted: Z,
24
+ whileElementsMounted: te,
25
25
  elements: { reference: o ?? void 0 },
26
26
  middleware: [
27
- te(4),
28
- ee({ padding: 8 }),
29
- oe({ padding: 8 })
27
+ ne(4),
28
+ oe({ padding: 8 }),
29
+ re({ padding: 8 }),
30
+ se({
31
+ padding: 8,
32
+ apply: ({ availableHeight: e }) => H(e)
33
+ })
30
34
  ],
31
35
  onOpenChange: (e, r, n) => {
32
36
  e || c?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
33
37
  }
34
- }), { getFloatingProps: z } = se([ne(N, {
38
+ }), { getFloatingProps: U } = ce([ie(N, {
35
39
  outsidePress: (e) => {
36
40
  const r = e.target;
37
41
  return !(o instanceof Element && r instanceof Node && o.contains(r));
38
42
  },
39
43
  escapeKey: !0
40
44
  })]);
41
- J({
45
+ V({
42
46
  active: t && S,
43
47
  requestClose: (e) => c ? c(e ?? new Event("overlayBack"), "escapeKeyDown") : !1,
44
48
  ownerRef: i.floating
45
49
  });
46
- const u = q(v), H = ie([C(i.setFloating, u)]);
47
- w(() => {
50
+ const u = G(v), B = fe([J(i.setFloating, u)]);
51
+ P(() => {
48
52
  if (!t) return;
49
53
  const e = o instanceof HTMLElement ? o : null, r = () => i.floating.current?.contains(document.activeElement) ?? !1;
50
54
  let n = r();
@@ -53,20 +57,20 @@ var ae = {
53
57
  };
54
58
  return document.addEventListener("focusin", s), () => {
55
59
  document.removeEventListener("focusin", s);
56
- const a = document.activeElement, y = !a || a === document.body || r();
57
- n && y && e?.isConnected && e.focus({ preventScroll: !0 });
60
+ const a = document.activeElement, g = !a || a === document.body || r();
61
+ n && g && e?.isConnected && e.focus({ preventScroll: !0 });
58
62
  };
59
63
  }, [
60
64
  t,
61
65
  o,
62
66
  i.floating
63
- ]), w(() => {
67
+ ]), P(() => {
64
68
  if (!t) return;
65
69
  const e = (n) => {
66
70
  if (f.current = n.key === "Tab", !d || !f.current || n.shiftKey || n.defaultPrevented) return;
67
71
  const s = i.floating.current;
68
72
  if (!s || !(o instanceof Element) || !o.contains(document.activeElement)) return;
69
- const [a] = g(s);
73
+ const [a] = y(s);
70
74
  a && (n.preventDefault(), a.focus({ preventScroll: !0 }), f.current = !1);
71
75
  }, r = (n) => {
72
76
  const s = n.target, a = s instanceof Node && ((i.floating.current?.contains(s) ?? !1) || o instanceof Element && o.contains(s));
@@ -82,18 +86,18 @@ var ae = {
82
86
  i.floating,
83
87
  d
84
88
  ]);
85
- const U = t ? z({
89
+ const I = t ? U({
86
90
  onClick: k,
87
91
  onKeyDown: (e) => {
88
92
  if (e.key !== "Tab" || e.defaultPrevented || !(o instanceof HTMLElement)) return;
89
- const r = e.currentTarget, n = g(r), s = n.indexOf(document.activeElement);
93
+ const r = e.currentTarget, n = y(r), s = n.indexOf(document.activeElement);
90
94
  if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
91
95
  e.preventDefault();
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");
96
+ const a = y(document).filter((W) => !r.contains(W)), g = a[a.indexOf(o) + (e.shiftKey ? -1 : 1)], Y = (d && e.shiftKey ? void 0 : g) ?? o;
97
+ f.current = !1, Y.focus({ preventScroll: !0 }), c?.(e, "tabKeyDown");
94
98
  }
95
99
  }) : {};
96
- return w(() => {
100
+ return P(() => {
97
101
  if (!m || !u) return;
98
102
  const e = i.floating.current;
99
103
  if (!(!e || typeof e.showPopover != "function"))
@@ -106,23 +110,26 @@ var ae = {
106
110
  m,
107
111
  u,
108
112
  i.floating
109
- ]), m ? /* @__PURE__ */ P(X, {
113
+ ]), m ? /* @__PURE__ */ x(ee, {
110
114
  root: v,
111
- children: /* @__PURE__ */ P("div", {
112
- ref: H,
115
+ children: /* @__PURE__ */ x("div", {
116
+ ref: B,
113
117
  id: D,
114
- ...u ? W : {},
118
+ ...u ? j : {},
115
119
  style: {
116
- ...u ? $ : {},
117
- ...t ? A : {},
118
- ...h(K),
119
- ...h(l?.paper?.sx),
120
+ ...u ? q : {},
121
+ ...t ? {
122
+ ...z,
123
+ maxHeight: M
124
+ } : {},
125
+ ...R(K),
126
+ ...R(l?.paper?.sx),
120
127
  ...l?.paper?.style,
121
128
  ...t ? null : { display: "none" }
122
129
  },
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, {
130
+ ...I,
131
+ className: $("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", T ?? "my-1", l?.paper?.className),
132
+ children: /* @__PURE__ */ x(Q.Provider, {
126
133
  value: i.floating,
127
134
  children: E
128
135
  })
@@ -130,5 +137,5 @@ var ae = {
130
137
  }) : null;
131
138
  };
132
139
  export {
133
- Pe as StyledPopover
140
+ be as StyledPopover
134
141
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.134.3",
6
+ "version": "3.134.4",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",