asma-ui-core 3.136.0 → 3.136.1
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/dialog/StyledDialog.js +129 -126
- package/dist/components/feedback/dialog/dialogHeaderStyles.js +5 -3
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +178 -171
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +120 -113
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +3 -2
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +3 -3
- package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +15 -3
- package/package.json +1 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as f } from "../../../../helpers/cn.js";
|
|
2
2
|
import { firstTabbable as q } from "../../../../helpers/focusable.js";
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { DialogBusyContext as
|
|
5
|
-
import { OverlayBackOwnerContext as
|
|
6
|
-
import { useFocusTrap as
|
|
3
|
+
import { StyledTooltip as ce } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { DialogBusyContext as G, useDialogBusyBoundary as me } from "../../dialog/DialogBusyContext.js";
|
|
5
|
+
import { OverlayBackOwnerContext as ue, isOverlayBackNavigationPending as fe, useBackCloses as pe } from "../../../../hooks/useBackCloses.hook.js";
|
|
6
|
+
import { useFocusTrap as he } from "../../../../hooks/useFocusTrap.hook.js";
|
|
7
7
|
import { useMobileMediaQuery as ve } from "../../../../hooks/useMediaQuery.hook.js";
|
|
8
|
-
import { useDialogHeaderPinning as
|
|
9
|
-
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as
|
|
10
|
-
import { fullScreenFieldWidthVars as
|
|
11
|
-
import { CloseBtn as
|
|
8
|
+
import { useDialogHeaderPinning as xe } from "../../dialog/useDialogHeaderPinning.js";
|
|
9
|
+
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as ge, DIALOG_HEADER_CLASSES as be, DIALOG_HEADER_TITLE_ROW_CLASSES as ye, DIALOG_TITLE_CLASSES as Se, dialogContentFlowClasses as we, dialogScrollerStyle as Ce } from "../../dialog/dialogHeaderStyles.js";
|
|
10
|
+
import { fullScreenFieldWidthVars as Re } from "../../../inputs/field-styles.js";
|
|
11
|
+
import { CloseBtn as V } from "../components/CloseBtn.js";
|
|
12
12
|
import { MinimizeBtn as $ } from "../components/MinimizeBtn.js";
|
|
13
|
-
import { FullScreenBtn as
|
|
14
|
-
import
|
|
13
|
+
import { FullScreenBtn as _e } from "../components/FullscreenBtn.js";
|
|
14
|
+
import p from "./MinimizableDialogV2.module.js";
|
|
15
15
|
import { useTranslations as ze } from "./useTranslations.js";
|
|
16
|
-
import { useControlledProps as
|
|
17
|
-
import
|
|
18
|
-
import { useId as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
var
|
|
21
|
-
const { showCloseIcon:
|
|
16
|
+
import { useControlledProps as Ee } from "./useControlledProps.js";
|
|
17
|
+
import Ie from "clsx";
|
|
18
|
+
import { useId as Q, useLayoutEffect as U, useRef as l } from "react";
|
|
19
|
+
import { Fragment as Ne, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
20
|
+
var Ye = (_) => {
|
|
21
|
+
const { showCloseIcon: z = !0, showMinimizeIcon: X = !0, showExpandIcon: J = !0, enableFullscreen: K = !0, fullscreenLockedReason: E, title: h, label: a, children: Y, open: i, onClose: Z, classNameOverrides: v = {
|
|
22
22
|
maximized: "",
|
|
23
23
|
minimized: "",
|
|
24
24
|
fullscreen: ""
|
|
25
|
-
}, dataTest:
|
|
26
|
-
if (
|
|
27
|
-
|
|
25
|
+
}, dataTest: ee, actionNode: te, locale: ie = "en", busyReason: oe, style: I, initialFocusRef: N } = _, x = ve(), o = ze(ie), n = l(null), m = l(null), A = l(null), T = l(null), g = l(!1), b = l(null), y = Q(), B = Q(), L = l(null), { headerRef: ne, pinned: S, hidden: w, scrollPaddingTop: le, scrollPaddingBottom: re } = xe(L), { minimized: t, setMinimized: O, fullScreen: s, setFullScreen: k } = Ee(_), d = s && !t, D = !!E, { busy: C, busyReason: F, contextValue: M } = me(oe ?? o.waitUntilSaved), u = () => {
|
|
26
|
+
if (C) return !1;
|
|
27
|
+
O(!1), Z();
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
n.current?.toggleAttribute("inert", t),
|
|
31
|
-
}, [t]),
|
|
32
|
-
const
|
|
33
|
-
if (g.current = i,
|
|
34
|
-
const
|
|
35
|
-
b.current = null, (!document.activeElement || document.activeElement === document.body) &&
|
|
29
|
+
U(() => {
|
|
30
|
+
n.current?.toggleAttribute("inert", t), m.current?.toggleAttribute("inert", !t);
|
|
31
|
+
}, [t]), U(() => {
|
|
32
|
+
const R = i && !g.current, c = !i && g.current;
|
|
33
|
+
if (g.current = i, c) {
|
|
34
|
+
const W = b.current;
|
|
35
|
+
b.current = null, (!document.activeElement || document.activeElement === document.body) && W?.isConnected && W.focus({ preventScroll: !0 });
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (!
|
|
38
|
+
if (!R) return;
|
|
39
39
|
b.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
40
|
-
const j = t ?
|
|
41
|
-
(
|
|
40
|
+
const j = t ? m.current : n.current, de = t ? T.current : A.current;
|
|
41
|
+
(N?.current ?? de ?? (j ? q(j) : void 0))?.focus({ preventScroll: !0 });
|
|
42
42
|
}, [
|
|
43
|
-
|
|
43
|
+
N,
|
|
44
44
|
t,
|
|
45
45
|
i
|
|
46
46
|
]);
|
|
47
47
|
const P = () => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
48
|
+
const R = t ? n : m;
|
|
49
|
+
O(!t), requestAnimationFrame(() => {
|
|
50
|
+
const c = R.current;
|
|
51
|
+
c && (c.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(c))?.focus({ preventScroll: !0 });
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
he(i && d, n, u), pe({
|
|
55
55
|
active: i && !t,
|
|
56
|
-
requestClose: () => !
|
|
56
|
+
requestClose: () => !d && fe() ? !1 : u(),
|
|
57
57
|
ownerRef: n
|
|
58
58
|
});
|
|
59
|
-
const
|
|
59
|
+
const ae = d ? x ? {
|
|
60
60
|
inset: 0,
|
|
61
61
|
maxHeight: "100dvh",
|
|
62
62
|
maxWidth: "100dvw",
|
|
@@ -72,31 +72,35 @@ var Je = (R) => {
|
|
|
72
72
|
width: "min(1000px, calc(100vw - 32px))",
|
|
73
73
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
74
74
|
height: "95dvh",
|
|
75
|
-
...
|
|
75
|
+
...Re
|
|
76
76
|
} : void 0;
|
|
77
77
|
if (!i) return null;
|
|
78
|
-
const
|
|
79
|
-
|
|
78
|
+
const se = a ? `${B} ${y}` : y, H = /* @__PURE__ */ e("div", {
|
|
79
|
+
id: y,
|
|
80
|
+
className: Se,
|
|
81
|
+
children: h
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ r(Ne, { children: [
|
|
80
84
|
/* @__PURE__ */ e("div", {
|
|
81
|
-
ref:
|
|
85
|
+
ref: m,
|
|
82
86
|
style: {
|
|
83
87
|
zIndex: 51,
|
|
84
88
|
...I
|
|
85
89
|
},
|
|
86
|
-
className:
|
|
90
|
+
className: f(p["minimized-dialog"], !t && p.hidden, v.minimized),
|
|
87
91
|
children: /* @__PURE__ */ r("div", {
|
|
88
|
-
className:
|
|
89
|
-
"data-testid":
|
|
92
|
+
className: Ie("flex items-center justify-between", !t && "hidden"),
|
|
93
|
+
"data-testid": ee,
|
|
90
94
|
children: [/* @__PURE__ */ e("div", {
|
|
91
95
|
className: "min-w-0 max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
92
|
-
children: /* @__PURE__ */ e(
|
|
93
|
-
title:
|
|
96
|
+
children: /* @__PURE__ */ e(ce, {
|
|
97
|
+
title: h,
|
|
94
98
|
placement: "top",
|
|
95
99
|
children: /* @__PURE__ */ e("div", {
|
|
96
100
|
tabIndex: 0,
|
|
97
101
|
"data-testid": "minimized-title",
|
|
98
102
|
className: "truncate focus-visible:[outline-offset:-2px]",
|
|
99
|
-
children:
|
|
103
|
+
children: h
|
|
100
104
|
})
|
|
101
105
|
})
|
|
102
106
|
}), /* @__PURE__ */ r("div", {
|
|
@@ -106,95 +110,98 @@ var Je = (R) => {
|
|
|
106
110
|
visibility: J,
|
|
107
111
|
onClick: P,
|
|
108
112
|
tooltipTitle: o.expand
|
|
109
|
-
}), /* @__PURE__ */ e(
|
|
110
|
-
buttonRef:
|
|
111
|
-
showCloseIcon:
|
|
112
|
-
onClick:
|
|
113
|
-
disabledReason:
|
|
113
|
+
}), /* @__PURE__ */ e(V, {
|
|
114
|
+
buttonRef: T,
|
|
115
|
+
showCloseIcon: z,
|
|
116
|
+
onClick: u,
|
|
117
|
+
disabledReason: C ? F : void 0,
|
|
114
118
|
tooltipTitle: o.close
|
|
115
119
|
})]
|
|
116
120
|
})]
|
|
117
121
|
})
|
|
118
122
|
}),
|
|
119
|
-
|
|
123
|
+
d && /* @__PURE__ */ e("div", {
|
|
120
124
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
121
125
|
onClick: () => {
|
|
122
|
-
|
|
126
|
+
D || k(!1);
|
|
123
127
|
}
|
|
124
128
|
}),
|
|
125
129
|
/* @__PURE__ */ e("div", {
|
|
126
130
|
style: {
|
|
127
131
|
zIndex: 51,
|
|
128
132
|
...I,
|
|
129
|
-
...
|
|
133
|
+
...ae
|
|
130
134
|
},
|
|
131
135
|
ref: n,
|
|
132
136
|
role: "dialog",
|
|
133
|
-
"aria-modal":
|
|
134
|
-
"aria-labelledby":
|
|
135
|
-
className:
|
|
136
|
-
children: /* @__PURE__ */ e(
|
|
137
|
+
"aria-modal": d ? !0 : void 0,
|
|
138
|
+
"aria-labelledby": se,
|
|
139
|
+
className: f(p.dialog, t && p.hidden, !s && v.maximized, s && v.fullscreen, d && "fixed z-[53] duration-0"),
|
|
140
|
+
children: /* @__PURE__ */ e(ue.Provider, {
|
|
137
141
|
value: n,
|
|
138
142
|
children: /* @__PURE__ */ r("div", {
|
|
139
|
-
ref:
|
|
143
|
+
ref: L,
|
|
140
144
|
"data-dialog-body": "",
|
|
141
|
-
className:
|
|
142
|
-
style:
|
|
145
|
+
className: f(t && "hidden", "flex min-h-0 flex-grow flex-col overflow-y-auto overscroll-contain", "[&>[data-dialog-content-flow]>[data-dialog-content]]:!flex-[1_0_auto]", "[&_[data-dialog-footer]]:sticky [&_[data-dialog-footer]]:bottom-0 [&_[data-dialog-footer]]:z-[2] [&_[data-dialog-footer]]:bg-white"),
|
|
146
|
+
style: Ce(le, re),
|
|
143
147
|
children: [/* @__PURE__ */ r("div", {
|
|
144
|
-
ref:
|
|
148
|
+
ref: ne,
|
|
145
149
|
"data-dialog-header": "",
|
|
146
|
-
"data-header-pinned":
|
|
147
|
-
"aria-hidden":
|
|
148
|
-
hidden:
|
|
149
|
-
className:
|
|
150
|
+
"data-header-pinned": S ? "true" : "false",
|
|
151
|
+
"aria-hidden": w || void 0,
|
|
152
|
+
hidden: w,
|
|
153
|
+
className: f(be, "border-b-[1px] border-delta-200 sm:rounded-t-lg", S && "sticky top-0 z-[2]", w && "hidden"),
|
|
150
154
|
children: [/* @__PURE__ */ r("div", {
|
|
151
|
-
className:
|
|
152
|
-
children: [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
155
|
+
className: a ? ge : ye,
|
|
156
|
+
children: [
|
|
157
|
+
a && /* @__PURE__ */ e("div", {
|
|
158
|
+
id: B,
|
|
159
|
+
className: "min-w-0 flex-auto hyphens-auto text-sm text-delta-700 [overflow-wrap:anywhere]",
|
|
160
|
+
children: a
|
|
161
|
+
}),
|
|
162
|
+
!a && /* @__PURE__ */ e("div", {
|
|
163
|
+
className: "min-w-0 flex-auto py-[9px] min-[744px]:py-1.5",
|
|
164
|
+
children: H
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ r("div", {
|
|
167
|
+
className: "ml-auto flex min-h-11 items-center gap-x-1 max-xs:flex-wrap max-xs:justify-end max-xs:gap-y-2",
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ e(G.Provider, {
|
|
170
|
+
value: M,
|
|
171
|
+
children: te
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ e($, {
|
|
174
|
+
visibility: X && !x,
|
|
175
|
+
type: "minimize",
|
|
176
|
+
onClick: P,
|
|
177
|
+
tooltipTitle: o.minimize
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ e(_e, {
|
|
180
|
+
showFullScreenIcon: (K || D) && !x,
|
|
181
|
+
disabledReason: E,
|
|
182
|
+
fullScreen: s,
|
|
183
|
+
onClick: () => {
|
|
184
|
+
k(!s);
|
|
185
|
+
},
|
|
186
|
+
tooltipTitle: s ? o.exitFullscreen : o.fullscreen
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ e(V, {
|
|
189
|
+
buttonRef: A,
|
|
190
|
+
showCloseIcon: z,
|
|
191
|
+
onClick: u,
|
|
192
|
+
disabledReason: C ? F : void 0,
|
|
193
|
+
tooltipTitle: o.close
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}), a && H]
|
|
192
199
|
}), /* @__PURE__ */ e("div", {
|
|
193
200
|
"data-dialog-content-flow": "",
|
|
194
|
-
className:
|
|
195
|
-
children: /* @__PURE__ */ e(
|
|
201
|
+
className: we(S),
|
|
202
|
+
children: /* @__PURE__ */ e(G.Provider, {
|
|
196
203
|
value: M,
|
|
197
|
-
children:
|
|
204
|
+
children: Y
|
|
198
205
|
})
|
|
199
206
|
})]
|
|
200
207
|
})
|
|
@@ -203,5 +210,5 @@ var Je = (R) => {
|
|
|
203
210
|
] });
|
|
204
211
|
};
|
|
205
212
|
export {
|
|
206
|
-
|
|
213
|
+
Ye as MinimizableDialogV2
|
|
207
214
|
};
|
|
@@ -12,8 +12,9 @@ interface DialogPaperProps {
|
|
|
12
12
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#15820-18954
|
|
13
13
|
* Figma "Dialog": white paper radius 8 with the Dialogue-popup shadow (#22213366, 0 4 40) over a
|
|
14
14
|
* bg/modal #626e7eb2 overlay. Header = actions row (optional label, Helper delta-600, + close button)
|
|
15
|
-
* over the full-width title
|
|
16
|
-
*
|
|
15
|
+
* over the full-width title; without a label the title sits in that row, left of the close button
|
|
16
|
+
* (ASMA-8737: 24/32 Bold, 20/26 Bold below 744 px, delta-800, never truncated). `fullScreen`/mobile
|
|
17
|
+
* drops the radius and fills the viewport.
|
|
17
18
|
*/
|
|
18
19
|
export interface IStyledDialogProps {
|
|
19
20
|
open: boolean;
|
|
@@ -9,9 +9,9 @@ interface DialogTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
|
9
9
|
* Adopts the id its enclosing `StyledDialog` offers, so the dialog is named by this visible title
|
|
10
10
|
* rather than by its test hook (WCAG 4.1.2). An explicit `id` from the caller always wins.
|
|
11
11
|
*
|
|
12
|
-
* Inside a `StyledDialog` it renders into the header's title
|
|
13
|
-
* actions
|
|
14
|
-
* place with the same type.
|
|
12
|
+
* Inside a `StyledDialog` it renders into the header's title slot (ASMA-8737): beside the header
|
|
13
|
+
* actions when the dialog has no label, under them when it has one; never truncated, pinned or
|
|
14
|
+
* scrolling with the header. Elsewhere it renders in place with the same type.
|
|
15
15
|
*/
|
|
16
16
|
export declare const StyledDialogTitle: ({ children, className, sx, style, id, classes: _classes, ...rest }: DialogTitleProps) => JSX.Element | null;
|
|
17
17
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* The one dialog header layout (ASMA-8737), shared by `StyledDialog`, `MinimizableDialog` and
|
|
4
|
-
* `MinimizableDialogV2
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `MinimizableDialogV2`. With a label: the actions row (label + actions) on top, then the title on a
|
|
5
|
+
* row of its own across the full width. Without a label the title takes the label's place, so title
|
|
6
|
+
* and actions share one row. Geometry: 44 px actions row, 28 px vertical padding (16 + 12), title
|
|
7
|
+
* lines of 26 px below 744 px wide and 32 px from there up.
|
|
7
8
|
*/
|
|
8
9
|
export declare const DIALOG_HEADER_CLASSES = "box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4";
|
|
9
10
|
/**
|
|
@@ -32,6 +33,17 @@ export declare const dialogContentFlowClasses: (pinned: boolean) => string;
|
|
|
32
33
|
export declare const dialogScrollerStyle: (scrollPaddingTop: number, scrollPaddingBottom: number) => CSSProperties;
|
|
33
34
|
/** Label (if any) on the left, the header actions on the right. Wraps rather than overflowing at 320 px. */
|
|
34
35
|
export declare const DIALOG_HEADER_ACTIONS_ROW_CLASSES = "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1";
|
|
36
|
+
/**
|
|
37
|
+
* The actions row when it also holds the title (no label): top-aligned so the actions stay level with
|
|
38
|
+
* the first title line however many lines it wraps to, and never wrapped below the title. Pair the
|
|
39
|
+
* actions group with `min-h-11` so it centres on that first line.
|
|
40
|
+
*/
|
|
41
|
+
export declare const DIALOG_HEADER_TITLE_ROW_CLASSES = "flex min-h-11 w-full min-w-0 items-start justify-between gap-x-2";
|
|
42
|
+
/**
|
|
43
|
+
* The title's box inside that row: takes the free width and centres its first line on the 44 px row
|
|
44
|
+
* (9 px around a 26 px line, 6 px around a 32 px line).
|
|
45
|
+
*/
|
|
46
|
+
export declare const DIALOG_HEADER_ROW_TITLE_BOX_CLASSES = "min-w-0 flex-auto py-[9px] min-[744px]:py-1.5";
|
|
35
47
|
/**
|
|
36
48
|
* Title type: 20/26 Bold below 744 px, 24/32 Bold from 744 px (the desktop size from before
|
|
37
49
|
* ASMA-8737). Never truncated or clamped: it wraps to as many lines as it needs, breaking an
|