asma-ui-core 3.94.1 → 3.95.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,15 +1,15 @@
|
|
|
1
1
|
import { cn as p } from "../../../helpers/cn.js";
|
|
2
2
|
import { CloseIcon as m } from "../../icons/close-icon/CloseIcon.js";
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
var
|
|
6
|
-
/* @__PURE__ */
|
|
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
7
|
className: "relative flex min-h-0 flex-1 flex-col",
|
|
8
8
|
children: [
|
|
9
|
-
|
|
10
|
-
id:
|
|
9
|
+
a && /* @__PURE__ */ e("div", {
|
|
10
|
+
id: d,
|
|
11
11
|
className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
|
|
12
|
-
children:
|
|
12
|
+
children: a
|
|
13
13
|
}),
|
|
14
14
|
/* @__PURE__ */ e("div", {
|
|
15
15
|
className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 pr-10",
|
|
@@ -17,8 +17,8 @@ var y = "box-border flex flex-col overflow-hidden rounded-lg border border-solid
|
|
|
17
17
|
}),
|
|
18
18
|
/* @__PURE__ */ e("div", {
|
|
19
19
|
className: "absolute right-0 top-0",
|
|
20
|
-
children: /* @__PURE__ */ e(
|
|
21
|
-
dataTest: `${
|
|
20
|
+
children: /* @__PURE__ */ e(c, {
|
|
21
|
+
dataTest: `${i}-close`,
|
|
22
22
|
variant: "textGray",
|
|
23
23
|
type: "button",
|
|
24
24
|
"aria-label": s,
|
|
@@ -31,9 +31,9 @@ var y = "box-border flex flex-col overflow-hidden rounded-lg border border-solid
|
|
|
31
31
|
})
|
|
32
32
|
]
|
|
33
33
|
}),
|
|
34
|
-
(l ??
|
|
34
|
+
(l ?? r) && /* @__PURE__ */ t("div", {
|
|
35
35
|
className: p("flex shrink-0 items-start p-1", l ? "justify-between" : "justify-end"),
|
|
36
|
-
children: [l,
|
|
36
|
+
children: [l, r]
|
|
37
37
|
}),
|
|
38
38
|
o && /* @__PURE__ */ e("div", {
|
|
39
39
|
className: "flex shrink-0 flex-col items-end p-3",
|
|
@@ -41,6 +41,6 @@ var y = "box-border flex flex-col overflow-hidden rounded-lg border border-solid
|
|
|
41
41
|
})
|
|
42
42
|
] });
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
g as POPOVER_SURFACE_CLASSNAME,
|
|
45
|
+
y as PopoverAnatomy
|
|
46
46
|
};
|
|
@@ -2,53 +2,53 @@ import { cn as oe } from "../../../helpers/cn.js";
|
|
|
2
2
|
import { firstTabbable as re } from "../../../helpers/focusable.js";
|
|
3
3
|
import { TOP_LAYER_PROPS as ne, TOP_LAYER_RESET_STYLE as ie, getOpenModalDialogAncestor as se, shouldUsePopoverTopLayer as ae, useTopLayerRef as ce } from "../../../hooks/useTopLayer.hook.js";
|
|
4
4
|
import { StyledButton as le } from "../../inputs/button/StyledButton.js";
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { useDebouncedValue as
|
|
5
|
+
import { useMobileMediaQuery as ue } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { useDebouncedValue as de } from "../../../hooks/useDebouncedValue.hook.js";
|
|
7
7
|
import { useFocusTrap as fe } from "../../../hooks/useFocusTrap.hook.js";
|
|
8
8
|
import { formatResultsLabel as pe } from "../bottom-sheet/formatResultsLabel.js";
|
|
9
9
|
import { StyledBottomSheet as me } from "../bottom-sheet/StyledBottomSheet.js";
|
|
10
10
|
import { PopoverAnatomy as ge } from "./PopoverAnatomy.js";
|
|
11
|
-
import { useCallback as m, useEffect as
|
|
11
|
+
import { useCallback as m, useEffect as b, useId as ve, useRef as y, useState as g } from "react";
|
|
12
12
|
import { Fragment as N, jsx as c, jsxs as W } from "react/jsx-runtime";
|
|
13
|
-
import { FloatingPortal as he, autoUpdate as xe, flip as
|
|
13
|
+
import { FloatingPortal as he, autoUpdate as xe, flip as _e, offset as Pe, shift as be, size as ye, useDismiss as Re, useFloating as Ee, useInteractions as Se, useMergeRefs as Te } from "@floating-ui/react";
|
|
14
14
|
var Ae = 240, Me = {
|
|
15
15
|
info: 472,
|
|
16
16
|
action: 472
|
|
17
|
-
}, we = 0.6, B = "calc(100vw - 32px)", je = ({ dataTest: s, renderTrigger:
|
|
18
|
-
const a = ve(), L = `${a}-title`, [o, X] = g(!1), [H, U] = g(), [Y, $] = g(),
|
|
17
|
+
}, we = 0.6, B = "calc(100vw - 32px)", je = ({ dataTest: s, renderTrigger: R, variant: E = "info", title: l, children: S, viewResultsAction: T, resetAction: A, footerActions: M, resultCount: v, closeLabel: w = "Lukk", ariaLabel: F, onOpenChange: I, className: O }) => {
|
|
18
|
+
const a = ve(), L = `${a}-title`, [o, X] = g(!1), [H, U] = g(), [Y, $] = g(), u = ue(), t = E === "action", j = u && !t, k = u && t, d = m((e) => {
|
|
19
19
|
X(e), I?.(e);
|
|
20
20
|
}, [I]), { refs: h, floatingStyles: q, context: z } = Ee({
|
|
21
21
|
open: o,
|
|
22
|
-
onOpenChange:
|
|
22
|
+
onOpenChange: d,
|
|
23
23
|
placement: "bottom-start",
|
|
24
24
|
strategy: "fixed",
|
|
25
25
|
whileElementsMounted: xe,
|
|
26
26
|
middleware: [
|
|
27
27
|
Pe(8),
|
|
28
|
-
...j ? [] : [
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
...j ? [] : [_e({ padding: 8 })],
|
|
29
|
+
be({ padding: 8 }),
|
|
30
|
+
ye({
|
|
31
31
|
padding: 8,
|
|
32
32
|
apply({ availableHeight: e }) {
|
|
33
33
|
$(Math.min(e, Math.round(window.innerHeight * we)));
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
]
|
|
37
|
-
}), { getFloatingProps: V } = Se([
|
|
37
|
+
}), { getFloatingProps: V } = Se([Re(z, {
|
|
38
38
|
enabled: !k,
|
|
39
39
|
escapeKey: !0,
|
|
40
40
|
outsidePress: (e) => {
|
|
41
41
|
const i = f.current;
|
|
42
42
|
return !(i && e.target instanceof Node && i.contains(e.target));
|
|
43
43
|
}
|
|
44
|
-
})]), x = ae(H), C =
|
|
44
|
+
})]), x = ae(H), C = y(null), [r, G] = g(null), K = m((e) => {
|
|
45
45
|
C.current = e, G(e);
|
|
46
|
-
}, []), Q = Te([ce(h.setFloating, x), K]), f =
|
|
46
|
+
}, []), Q = Te([ce(h.setFloating, x), K]), f = y(null), J = m((e) => {
|
|
47
47
|
f.current = e, h.setReference(e);
|
|
48
48
|
}, [h]), n = m(() => {
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
fe(o && t && r !== null, C),
|
|
49
|
+
d(!1);
|
|
50
|
+
}, [d]);
|
|
51
|
+
fe(o && t && r !== null, C), b(() => {
|
|
52
52
|
if (!r) return;
|
|
53
53
|
const e = requestAnimationFrame(() => {
|
|
54
54
|
(t ? re(r) : r)?.focus({ preventScroll: !0 });
|
|
@@ -56,7 +56,7 @@ var Ae = 240, Me = {
|
|
|
56
56
|
return () => {
|
|
57
57
|
cancelAnimationFrame(e);
|
|
58
58
|
};
|
|
59
|
-
}, [r, t]),
|
|
59
|
+
}, [r, t]), b(() => {
|
|
60
60
|
if (!r || t) return;
|
|
61
61
|
const e = (i) => {
|
|
62
62
|
const P = i.relatedTarget;
|
|
@@ -70,14 +70,14 @@ var Ae = 240, Me = {
|
|
|
70
70
|
t,
|
|
71
71
|
n
|
|
72
72
|
]);
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const _ = y(!1);
|
|
74
|
+
b(() => {
|
|
75
75
|
if (o) {
|
|
76
|
-
|
|
76
|
+
_.current = !0;
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
if (!
|
|
80
|
-
|
|
79
|
+
if (!_.current) return;
|
|
80
|
+
_.current = !1;
|
|
81
81
|
const e = f.current;
|
|
82
82
|
if (!e) return;
|
|
83
83
|
const i = requestAnimationFrame(() => {
|
|
@@ -96,21 +96,21 @@ var Ae = 240, Me = {
|
|
|
96
96
|
n();
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
U(se(e.currentTarget)),
|
|
99
|
+
U(se(e.currentTarget)), d(!0);
|
|
100
100
|
},
|
|
101
101
|
"aria-expanded": o,
|
|
102
102
|
"aria-controls": o ? a : void 0,
|
|
103
103
|
"aria-haspopup": t ? "dialog" : void 0,
|
|
104
104
|
"aria-describedby": !t && o ? a : void 0
|
|
105
105
|
}
|
|
106
|
-
}, p = (e) => typeof e == "function" ? e({ close: n }) : e, Z =
|
|
106
|
+
}, p = (e) => typeof e == "function" ? e({ close: n }) : e, Z = de(v, 500), ee = T ?? (v === void 0 ? void 0 : /* @__PURE__ */ c(le, {
|
|
107
107
|
dataTest: `${s}-view-results`,
|
|
108
108
|
type: "button",
|
|
109
109
|
variant: "text",
|
|
110
110
|
onClick: n,
|
|
111
111
|
children: pe(Z)
|
|
112
|
-
})), te =
|
|
113
|
-
return k ? /* @__PURE__ */ W(N, { children: [
|
|
112
|
+
})), te = u ? B : Me[E];
|
|
113
|
+
return k ? /* @__PURE__ */ W(N, { children: [R(D), /* @__PURE__ */ c(me, {
|
|
114
114
|
id: a,
|
|
115
115
|
dataTest: s,
|
|
116
116
|
open: o,
|
|
@@ -124,7 +124,7 @@ var Ae = 240, Me = {
|
|
|
124
124
|
closeLabel: w,
|
|
125
125
|
className: O,
|
|
126
126
|
children: S
|
|
127
|
-
})] }) : /* @__PURE__ */ W(N, { children: [
|
|
127
|
+
})] }) : /* @__PURE__ */ W(N, { children: [R(D), o && /* @__PURE__ */ c(he, {
|
|
128
128
|
root: H,
|
|
129
129
|
children: /* @__PURE__ */ c("div", {
|
|
130
130
|
...V(),
|
|
@@ -141,11 +141,11 @@ var Ae = 240, Me = {
|
|
|
141
141
|
...x ? ie : {},
|
|
142
142
|
...q,
|
|
143
143
|
minWidth: Ae,
|
|
144
|
-
width:
|
|
144
|
+
width: u ? B : void 0,
|
|
145
145
|
maxWidth: te,
|
|
146
146
|
maxHeight: Y
|
|
147
147
|
},
|
|
148
|
-
className: oe("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg
|
|
148
|
+
className: oe("z-[1300]", "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]", O),
|
|
149
149
|
children: /* @__PURE__ */ c(ge, {
|
|
150
150
|
dataTest: s,
|
|
151
151
|
title: l,
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* The Figma "_Popover" surface chrome (node `44531:233781`): white, 1px `border/outline
|
|
4
|
-
* (`dialog` token) and the Dialogue-popup elevation — the same surface `StyledDialog` paints.
|
|
3
|
+
* The Figma "_Popover" surface chrome (node `44531:233781`): white, 1px `border/outline` (delta-300),
|
|
4
|
+
* radius 8 (`dialog` token) and the Dialogue-popup elevation — the same surface `StyledDialog` paints.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
6
|
+
* The 1px edge is an **inset box-shadow ring**, the package's own idiom for non-layout lines
|
|
7
|
+
* (`StyledTab`/`StyledMenuItem` draw their DS focus rings the same way): a border consumes layout
|
|
8
|
+
* width, and at the 472px Action max-width a date-picker pair (200 + 16 + 200 = 416px, with 16px +
|
|
9
|
+
* 40px body padding) needs the full 472px of the frame — with a border only 470px remain and the
|
|
10
|
+
* pair wraps. Figma's stroke takes no width from autolayout, and the inset shadow matches that.
|
|
11
|
+
*
|
|
12
|
+
* `box-border` is load-bearing, not noise: this package builds Tailwind with `preflight: false`, so
|
|
13
|
+
* without it `box-sizing` falls back to `content-box` and a 472px max-width renders 474.
|
|
9
14
|
*
|
|
10
15
|
* Positioning (`z-index`, the floating transform, the top-layer props) deliberately stays with the
|
|
11
16
|
* caller, so the Gallery story can render the same surface statically in a grid.
|
|
12
17
|
*/
|
|
13
|
-
export declare const POPOVER_SURFACE_CLASSNAME = "box-border flex flex-col overflow-hidden rounded-lg
|
|
18
|
+
export declare const POPOVER_SURFACE_CLASSNAME = "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]";
|
|
14
19
|
export interface PopoverAnatomyProps {
|
|
15
20
|
dataTest: string;
|
|
16
21
|
title?: ReactNode;
|