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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/feedback/snack-bar/SnackbarProvider.js +32 -25
- package/dist/components/feedback/snack-bar/components/processMessageError.js +1 -1
- package/dist/components/feedback/snack-bar/components/processMessageInfo.js +1 -1
- package/dist/components/feedback/snack-bar/index.js +3 -4
- package/dist/components/feedback/snack-bar/processAlertSnackBar.js +1 -1
- package/dist/components/feedback/snack-bar/processDefaultSnackbar.js +1 -1
- package/dist/components/feedback/snack-bar/processInfoSnackbar.js +1 -1
- package/dist/components/feedback/snack-bar/snackbarHost.js +22 -0
- package/dist/components/utils/popover/PopoverAnatomy.js +49 -42
- package/dist/components/utils/popover/useScrollGutter.js +33 -0
- package/dist/index.js +156 -155
- package/dist/src/components/feedback/snack-bar/index.d.ts +2 -1
- package/dist/src/components/feedback/snack-bar/snackbarHost.d.ts +29 -0
- package/dist/src/components/utils/popover/useScrollGutter.d.ts +19 -0
- package/package.json +1 -1
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import { useTopmostOpenModalDialog as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
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:
|
|
23
|
-
info:
|
|
24
|
-
default:
|
|
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:
|
|
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
|
-
|
|
46
|
+
H as SnackbarProvider
|
|
40
47
|
};
|
|
@@ -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 {
|
|
9
|
+
import { useSnackbar as $ } from "notistack";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
l as enqueueSnackbar,
|
|
12
|
-
d as useSnackbar
|
|
11
|
+
$ as useSnackbar
|
|
13
12
|
};
|
|
@@ -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
|
|
2
|
-
import { CloseIcon as
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
+
};
|