asma-ui-core 3.53.1 → 3.54.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.
@@ -1,39 +1,41 @@
1
- import { cn as E } from "../../../helpers/cn.js";
2
- import { resolveSx as p } from "../../../helpers/sx.js";
3
- import { TOP_LAYER_PROPS as F, TOP_LAYER_RESET_STYLE as O, getOpenModalDialogAncestor as L, useTopLayerRef as M } from "../../../hooks/useTopLayer.hook.js";
4
- import { useEffect as z, useMemo as f, useState as D } from "react";
5
- import { jsx as c } from "react/jsx-runtime";
6
- import { FloatingPortal as N, autoUpdate as k, flip as C, offset as U, shift as Y, useDismiss as H, useFloating as K, useInteractions as $, useMergeRefs as j } from "@floating-ui/react";
7
- var I = {
1
+ import { cn as O } from "../../../helpers/cn.js";
2
+ import { resolveSx as c } from "../../../helpers/sx.js";
3
+ import { TOP_LAYER_PROPS as L, TOP_LAYER_RESET_STYLE as M, getOpenModalDialogAncestor as z, useTopLayerRef as D } from "../../../hooks/useTopLayer.hook.js";
4
+ import { useEffect as N, useMemo as k, useState as d } from "react";
5
+ import { jsx as u } from "react/jsx-runtime";
6
+ import { FloatingPortal as C, autoUpdate as U, flip as Y, offset as H, shift as K, useDismiss as $, useFloating as j, useInteractions as I, useMergeRefs as q } from "@floating-ui/react";
7
+ var B = {
8
8
  vertical: "bottom",
9
9
  horizontal: "left"
10
- }, q = {
10
+ }, G = {
11
11
  vertical: "top",
12
12
  horizontal: "left"
13
- }, B = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, Z = ({ open: e, anchorEl: o, onClose: d, anchorOrigin: i = I, transformOrigin: l = q, id: u, className: m, sx: v, slotProps: a, onClick: g, children: h, keepMounted: y = !1 }) => {
14
- const R = f(() => B(i, l), [i, l]), [n, _] = D(e);
15
- e && !n && _(!0);
16
- const r = e || y && n, { refs: s, floatingStyles: x, context: P } = K({
13
+ }, J = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, te = ({ open: e, anchorEl: o, onClose: m, anchorOrigin: l = B, transformOrigin: n = G, id: v, className: g, sx: h, slotProps: r, onClick: y, children: R, keepMounted: P = !1 }) => {
14
+ const _ = k(() => J(l, n), [l, n]), [p, x] = d(e);
15
+ e && !p && x(!0);
16
+ const a = e || P && p, s = z(o), [f, w] = d(s);
17
+ o && f !== s && w(s);
18
+ const { refs: i, floatingStyles: S, context: T } = j({
17
19
  open: e,
18
- placement: R,
20
+ placement: _,
19
21
  strategy: "fixed",
20
- whileElementsMounted: k,
22
+ whileElementsMounted: U,
21
23
  elements: { reference: o ?? void 0 },
22
24
  middleware: [
23
- U(4),
24
- C({ padding: 8 }),
25
- Y({ padding: 8 })
25
+ H(4),
26
+ Y({ padding: 8 }),
27
+ K({ padding: 8 })
26
28
  ],
27
- onOpenChange: (t, b, A) => {
28
- t || d?.(b ?? {}, A === "escape-key" ? "escapeKeyDown" : "backdropClick");
29
+ onOpenChange: (t, E, F) => {
30
+ t || m?.(E ?? {}, F === "escape-key" ? "escapeKeyDown" : "backdropClick");
29
31
  }
30
- }), { getFloatingProps: w } = $([H(P, {
32
+ }), { getFloatingProps: b } = I([$(T, {
31
33
  outsidePress: !0,
32
34
  escapeKey: !0
33
- })]), S = j([M(s.setFloating)]), T = f(() => r ? L(o) : void 0, [r, o]);
34
- return z(() => {
35
- if (!r) return;
36
- const t = s.floating.current;
35
+ })]), A = q([D(i.setFloating)]);
36
+ return N(() => {
37
+ if (!a) return;
38
+ const t = i.floating.current;
37
39
  if (!(!t || typeof t.showPopover != "function"))
38
40
  try {
39
41
  e && !t.matches(":popover-open") && t.showPopover(), !e && t.matches(":popover-open") && t.hidePopover();
@@ -41,28 +43,28 @@ var I = {
41
43
  }
42
44
  }, [
43
45
  e,
44
- r,
45
- s.floating
46
- ]), r ? /* @__PURE__ */ c(N, {
47
- root: T,
48
- children: /* @__PURE__ */ c("div", {
49
- ref: S,
50
- id: u,
51
- ...F,
46
+ a,
47
+ i.floating
48
+ ]), a ? /* @__PURE__ */ u(C, {
49
+ root: f,
50
+ children: /* @__PURE__ */ u("div", {
51
+ ref: A,
52
+ id: v,
53
+ ...L,
52
54
  style: {
53
- ...O,
54
- ...e ? x : {},
55
- ...p(v),
56
- ...p(a?.paper?.sx),
57
- ...a?.paper?.style,
55
+ ...M,
56
+ ...e ? S : {},
57
+ ...c(h),
58
+ ...c(r?.paper?.sx),
59
+ ...r?.paper?.style,
58
60
  ...e ? null : { display: "none" }
59
61
  },
60
- ...e ? w({ onClick: g }) : {},
61
- className: E("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", m ?? "my-1", a?.paper?.className),
62
- children: h
62
+ ...e ? b({ onClick: y }) : {},
63
+ className: O("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", g ?? "my-1", r?.paper?.className),
64
+ children: R
63
65
  })
64
66
  }) : null;
65
67
  };
66
68
  export {
67
- Z as StyledPopover
69
+ te as StyledPopover
68
70
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.53.1",
6
+ "version": "3.54.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",