asma-ui-core 3.101.1 → 3.101.3

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,40 +1,47 @@
1
- import { useTopmostOpenModalDialog as a } from "../../../hooks/useTopLayer.hook.js";
2
- import { StyledAlertSnackbar as n } from "./StyledAlertSnackbar.js";
3
- import { StyledDefaultSnackbar as i } from "./components/StyledDefaultSnackbar.js";
4
- import { StyledInfoSnackbar as m } from "./components/StyledInfoSnackbar.js";
5
- import { useLayoutEffect as r, useState as c } from "react";
6
- import { jsx as s } from "react/jsx-runtime";
7
- import { SnackbarProvider as l } from "notistack";
8
- var d = () => {
9
- const [t] = c(() => {
10
- const o = document.createElement("div");
11
- return o.style.display = "contents", o.setAttribute("data-asma-snackbar-host", ""), o;
12
- }), e = a();
13
- return r(() => {
14
- const o = e ?? document.body;
15
- t.parentElement !== o && o.appendChild(t);
16
- }, [t, e]), r(() => () => t.remove(), [t]), t;
17
- }, h = (t) => {
18
- const e = d();
19
- return /* @__PURE__ */ s(l, {
1
+ import { useTopmostOpenModalDialog as e } from "../../../hooks/useTopLayer.hook.js";
2
+ import { registerSnackbarHost as n } from "./snackbarHost.js";
3
+ import { StyledAlertSnackbar as i } from "./StyledAlertSnackbar.js";
4
+ import { StyledDefaultSnackbar as s } from "./components/StyledDefaultSnackbar.js";
5
+ import { StyledInfoSnackbar as c } from "./components/StyledInfoSnackbar.js";
6
+ import { useLayoutEffect as o, useState as m } from "react";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ import { SnackbarProvider as d, useSnackbar as f } from "notistack";
9
+ var S = () => {
10
+ const [t] = m(() => {
11
+ const a = document.createElement("div");
12
+ return a.style.display = "contents", a.setAttribute("data-asma-snackbar-host", ""), a;
13
+ }), r = e();
14
+ return o(() => {
15
+ const a = r ?? document.body;
16
+ t.parentElement !== a && a.appendChild(t);
17
+ }, [t, r]), o(() => () => t.remove(), [t]), t;
18
+ }, b = () => {
19
+ const { enqueueSnackbar: t, closeSnackbar: r } = f();
20
+ return o(() => n({
21
+ enqueueSnackbar: t,
22
+ closeSnackbar: r
23
+ }), [t, r]), null;
24
+ }, H = (t) => {
25
+ const r = S();
26
+ return /* @__PURE__ */ u(d, {
20
27
  ...t,
21
28
  Components: {
22
- alert: n,
23
- info: m,
24
- default: i
29
+ alert: i,
30
+ info: c,
31
+ default: s
25
32
  },
26
33
  autoHideDuration: t.autoHideDuration === void 0 ? 6e3 : t.autoHideDuration,
27
34
  anchorOrigin: {
28
35
  vertical: "top",
29
36
  horizontal: "right"
30
37
  },
31
- domRoot: e,
38
+ domRoot: r,
32
39
  maxSnack: 3,
33
40
  classes: { root: "min-w-fit flex justify-center" },
34
41
  className: "w-fit min-w-fit max-w-fit",
35
- children: t.children
42
+ children: [/* @__PURE__ */ l(b, {}), t.children]
36
43
  });
37
44
  };
38
45
  export {
39
- h as SnackbarProvider
46
+ H as SnackbarProvider
40
47
  };
@@ -1,4 +1,4 @@
1
- import { closeSnackbar as t, enqueueSnackbar as a } from "notistack";
1
+ import { closeSnackbar as t, enqueueSnackbar as a } from "../snackbarHost.js";
2
2
  function o(r, e) {
3
3
  return a({
4
4
  variant: "info",
@@ -1,4 +1,4 @@
1
- import { closeSnackbar as r, enqueueSnackbar as t } from "notistack";
1
+ import { closeSnackbar as r, enqueueSnackbar as t } from "../snackbarHost.js";
2
2
  function o(a, e) {
3
3
  return t({
4
4
  variant: "info",
@@ -1,13 +1,12 @@
1
1
  import "./StyledAlert.js";
2
+ import "./snackbarHost.js";
2
3
  import "./SnackbarProvider.js";
3
4
  import "./StyledSnackbar.js";
4
5
  import "./processAlertSnackBar.js";
5
6
  import "./processDefaultSnackbar.js";
6
7
  import "./processInfoSnackbar.js";
7
8
  import "./message.js";
8
- import { closeSnackbar as u, enqueueSnackbar as l, useSnackbar as d } from "notistack";
9
+ import { useSnackbar as $ } from "notistack";
9
10
  export {
10
- u as closeSnackbar,
11
- l as enqueueSnackbar,
12
- d as useSnackbar
11
+ $ as useSnackbar
13
12
  };
@@ -1,4 +1,4 @@
1
- import { enqueueSnackbar as a } from "notistack";
1
+ import { enqueueSnackbar as a } from "./snackbarHost.js";
2
2
  function t(r) {
3
3
  a({
4
4
  message: r,
@@ -1,4 +1,4 @@
1
- import { closeSnackbar as t, enqueueSnackbar as c } from "notistack";
1
+ import { closeSnackbar as t, enqueueSnackbar as c } from "./snackbarHost.js";
2
2
  function s(n, a = {}) {
3
3
  const { severity: e = "info", ...o } = a, r = c(n, {
4
4
  variant: "default",
@@ -1,4 +1,4 @@
1
- import { enqueueSnackbar as e } from "notistack";
1
+ import { enqueueSnackbar as e } from "./snackbarHost.js";
2
2
  function a(t) {
3
3
  e({
4
4
  variant: "alert",
@@ -0,0 +1,22 @@
1
+ import { closeSnackbar as c, enqueueSnackbar as s } from "notistack";
2
+ var t;
3
+ function a() {
4
+ if (typeof window > "u") return t ??= [];
5
+ const n = window.rawWindow ?? document.defaultView ?? window;
6
+ return n.__asmaSnackbarHosts__ ??= [];
7
+ }
8
+ function i(n) {
9
+ return a().push(n), () => {
10
+ const e = a(), r = e.indexOf(n);
11
+ r !== -1 && e.splice(r, 1);
12
+ };
13
+ }
14
+ var o = () => a()[0] ?? {
15
+ enqueueSnackbar: s,
16
+ closeSnackbar: c
17
+ }, b = ((...n) => o().enqueueSnackbar(...n)), d = (n) => o().closeSnackbar(n);
18
+ export {
19
+ d as closeSnackbar,
20
+ b as enqueueSnackbar,
21
+ i as registerSnackbarHost
22
+ };
@@ -1,46 +1,53 @@
1
- import { cn as p } from "../../../helpers/cn.js";
2
- import { CloseIcon as m } from "../../icons/close-icon/CloseIcon.js";
3
- import { StyledButton as c } from "../../inputs/button/StyledButton.js";
4
- import { Fragment as f, jsx as e, jsxs as t } from "react/jsx-runtime";
5
- var g = "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]", y = ({ dataTest: i, title: a, titleId: d, children: n, viewResultsAction: l, resetAction: r, footerActions: o, closeLabel: s, onClose: x }) => /* @__PURE__ */ t(f, { children: [
6
- /* @__PURE__ */ t("div", {
7
- className: "relative flex min-h-0 flex-1 flex-col",
8
- children: [
9
- a && /* @__PURE__ */ e("div", {
10
- id: d,
11
- className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
12
- children: a
13
- }),
14
- /* @__PURE__ */ e("div", {
15
- className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 pr-10",
16
- children: n
17
- }),
18
- /* @__PURE__ */ e("div", {
19
- className: "absolute right-0 top-0",
20
- children: /* @__PURE__ */ e(c, {
21
- dataTest: `${i}-close`,
22
- variant: "textGray",
23
- type: "button",
24
- "aria-label": s,
25
- onClick: x,
26
- startIcon: /* @__PURE__ */ e(m, {
27
- width: 24,
28
- height: 24
1
+ import { cn as n } from "../../../helpers/cn.js";
2
+ import { CloseIcon as c } from "../../icons/close-icon/CloseIcon.js";
3
+ import { StyledButton as h } from "../../inputs/button/StyledButton.js";
4
+ import { useScrollGutter as u } from "./useScrollGutter.js";
5
+ import { useRef as v } from "react";
6
+ import { Fragment as g, jsx as e, jsxs as r } from "react/jsx-runtime";
7
+ var _ = 40, j = "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]", k = ({ dataTest: d, title: t, titleId: m, children: f, viewResultsAction: l, resetAction: a, footerActions: o, closeLabel: p, onClose: x }) => {
8
+ const i = v(null), s = u(i);
9
+ return /* @__PURE__ */ r(g, { children: [
10
+ /* @__PURE__ */ r("div", {
11
+ className: "relative flex min-h-0 flex-1 flex-col",
12
+ children: [
13
+ t && /* @__PURE__ */ e("div", {
14
+ id: m,
15
+ className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
16
+ children: t
17
+ }),
18
+ /* @__PURE__ */ e("div", {
19
+ ref: i,
20
+ className: n("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !t && s.overflows && "mt-10"),
21
+ style: { paddingRight: Math.max(0, _ - s.width) },
22
+ children: f
23
+ }),
24
+ /* @__PURE__ */ e("div", {
25
+ className: "absolute right-0 top-0",
26
+ children: /* @__PURE__ */ e(h, {
27
+ dataTest: `${d}-close`,
28
+ variant: "textGray",
29
+ type: "button",
30
+ "aria-label": p,
31
+ onClick: x,
32
+ startIcon: /* @__PURE__ */ e(c, {
33
+ width: 24,
34
+ height: 24
35
+ })
29
36
  })
30
37
  })
31
- })
32
- ]
33
- }),
34
- (l ?? r) && /* @__PURE__ */ t("div", {
35
- className: p("flex shrink-0 items-start p-1", l ? "justify-between" : "justify-end"),
36
- children: [l, r]
37
- }),
38
- o && /* @__PURE__ */ e("div", {
39
- className: "flex shrink-0 flex-col items-end p-3",
40
- children: o
41
- })
42
- ] });
38
+ ]
39
+ }),
40
+ (l ?? a) && /* @__PURE__ */ r("div", {
41
+ className: n("flex shrink-0 items-start p-1", l ? "justify-between" : "justify-end"),
42
+ children: [l, a]
43
+ }),
44
+ o && /* @__PURE__ */ e("div", {
45
+ className: "flex shrink-0 flex-col items-end p-3",
46
+ children: o
47
+ })
48
+ ] });
49
+ };
43
50
  export {
44
- g as POPOVER_SURFACE_CLASSNAME,
45
- y as PopoverAnatomy
51
+ j as POPOVER_SURFACE_CLASSNAME,
52
+ k as PopoverAnatomy
46
53
  };
@@ -0,0 +1,33 @@
1
+ import { useLayoutEffect as v, useState as l } from "react";
2
+ var w = {
3
+ width: 0,
4
+ overflows: !1
5
+ }, h = (s) => {
6
+ const [f, u] = l(w);
7
+ return v(() => {
8
+ const e = s.current;
9
+ if (!e) return;
10
+ const t = () => {
11
+ const r = e.offsetWidth - e.clientWidth, d = e.scrollHeight > e.clientHeight;
12
+ u((n) => n.width === r && n.overflows === d ? n : {
13
+ width: r,
14
+ overflows: d
15
+ });
16
+ };
17
+ if (t(), typeof ResizeObserver > "u" || typeof MutationObserver > "u") return;
18
+ const o = new ResizeObserver(t), i = () => {
19
+ o.observe(e);
20
+ for (const r of Array.from(e.children)) o.observe(r);
21
+ };
22
+ i();
23
+ const c = new MutationObserver(() => {
24
+ i(), t();
25
+ });
26
+ return c.observe(e, { childList: !0 }), window.addEventListener("resize", t), () => {
27
+ o.disconnect(), c.disconnect(), window.removeEventListener("resize", t);
28
+ };
29
+ }, [s]), f;
30
+ };
31
+ export {
32
+ h as useScrollGutter
33
+ };