asma-ui-core 3.87.5 → 3.88.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.
- package/dist/components/feedback/minimizable-dialog/components/CloseBtn.js +6 -5
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +93 -82
- package/dist/src/components/feedback/minimizable-dialog/components/CloseBtn.d.ts +1 -0
- package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { CloseIcon as
|
|
2
|
-
import { StyledTooltip as
|
|
1
|
+
import { CloseIcon as i } from "../../../icons/close-icon/CloseIcon.js";
|
|
2
|
+
import { StyledTooltip as n } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
3
|
import { StyledButton as a } from "../../../inputs/button/StyledButton.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
|
-
var
|
|
6
|
+
var h = ({ showCloseIcon: e, tooltipTitle: r, onClick: o, buttonRef: l }) => e ? /* @__PURE__ */ t(n, {
|
|
7
7
|
title: r,
|
|
8
8
|
placement: "top",
|
|
9
9
|
children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(a, {
|
|
10
10
|
dataTest: "close-button",
|
|
11
|
+
refLink: l,
|
|
11
12
|
"aria-label": r,
|
|
12
13
|
variant: "textGray",
|
|
13
14
|
size: "small",
|
|
14
15
|
onClick: o,
|
|
15
|
-
endIcon: /* @__PURE__ */ t(
|
|
16
|
+
endIcon: /* @__PURE__ */ t(i, {
|
|
16
17
|
height: 20,
|
|
17
18
|
width: 20,
|
|
18
19
|
color: "text-delta-700"
|
|
@@ -20,5 +21,5 @@ var f = ({ showCloseIcon: e, tooltipTitle: r, onClick: o }) => e ? /* @__PURE__
|
|
|
20
21
|
}) })
|
|
21
22
|
}) : null;
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
h as CloseBtn
|
|
24
25
|
};
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { useMobileMediaQuery as
|
|
5
|
-
import { useFocusTrap as
|
|
6
|
-
import { CloseBtn as
|
|
7
|
-
import { MinimizeBtn as
|
|
8
|
-
import { FullScreenBtn as
|
|
9
|
-
import
|
|
10
|
-
import { useTranslations as
|
|
11
|
-
import { useControlledProps as
|
|
12
|
-
import
|
|
13
|
-
import { useLayoutEffect as
|
|
14
|
-
import { Fragment as
|
|
15
|
-
var
|
|
16
|
-
const { showCloseIcon:
|
|
1
|
+
import { cn as a } from "../../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as M } from "../../../../helpers/focusable.js";
|
|
3
|
+
import { StyledTooltip as $ } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { useMobileMediaQuery as H } from "../../../../hooks/useMediaQuery.hook.js";
|
|
5
|
+
import { useFocusTrap as L } from "../../../../hooks/useFocusTrap.hook.js";
|
|
6
|
+
import { CloseBtn as k } from "../components/CloseBtn.js";
|
|
7
|
+
import { MinimizeBtn as B } from "../components/MinimizeBtn.js";
|
|
8
|
+
import { FullScreenBtn as Q } from "../components/FullscreenBtn.js";
|
|
9
|
+
import p from "./MinimizableDialogV2.module.js";
|
|
10
|
+
import { useTranslations as G } from "./useTranslations.js";
|
|
11
|
+
import { useControlledProps as J } from "./useControlledProps.js";
|
|
12
|
+
import K from "clsx";
|
|
13
|
+
import { useLayoutEffect as I, useRef as u } from "react";
|
|
14
|
+
import { Fragment as U, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
15
|
+
var ue = (g) => {
|
|
16
|
+
const { showCloseIcon: z = !0, showMinimizeIcon: j = !0, showExpandIcon: A = !0, enableFullscreen: D = !0, title: o, label: x, children: O, open: m, onClose: q, classNameOverrides: h = {
|
|
17
17
|
maximized: "",
|
|
18
18
|
minimized: "",
|
|
19
19
|
fullscreen: ""
|
|
20
|
-
}, dataTest:
|
|
21
|
-
|
|
20
|
+
}, dataTest: E, actionNode: P, locale: V = "en", style: y, initialFocusRef: w } = g, r = H(), s = G(V), d = u(null), f = u(null), N = u(null), C = u(null), F = u(!1), { minimized: t, setMinimized: S, fullScreen: i, setFullScreen: R } = J(g), l = i && !t, v = () => {
|
|
21
|
+
S(!1), q();
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
I(() => {
|
|
24
|
+
d.current?.toggleAttribute("inert", t), f.current?.toggleAttribute("inert", !t);
|
|
25
|
+
}, [t]), I(() => {
|
|
26
|
+
const b = m && !F.current;
|
|
27
|
+
if (F.current = m, !b) return;
|
|
28
|
+
const c = t ? f.current : d.current, _ = t ? C.current : N.current;
|
|
29
|
+
(w?.current ?? _ ?? (c ? M(c) : void 0))?.focus({ preventScroll: !0 });
|
|
30
|
+
}, [
|
|
31
|
+
w,
|
|
32
|
+
t,
|
|
33
|
+
m
|
|
34
|
+
]);
|
|
35
|
+
const T = () => {
|
|
36
|
+
const b = t ? d : f;
|
|
37
|
+
S(!t), requestAnimationFrame(() => {
|
|
38
|
+
const c = b.current;
|
|
39
|
+
c && (c.querySelector('[data-testid="toggle-minimize-btn"]') ?? M(c))?.focus({ preventScroll: !0 });
|
|
31
40
|
});
|
|
32
41
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
42
|
+
L(m && l, d, v);
|
|
43
|
+
const W = l ? r ? {
|
|
35
44
|
inset: 0,
|
|
36
45
|
maxHeight: "100dvh",
|
|
37
46
|
maxWidth: "100dvw",
|
|
@@ -48,38 +57,39 @@ var ae = (h) => {
|
|
|
48
57
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
49
58
|
height: "95dvh"
|
|
50
59
|
} : void 0;
|
|
51
|
-
return
|
|
60
|
+
return m ? /* @__PURE__ */ n(U, { children: [
|
|
52
61
|
/* @__PURE__ */ e("div", {
|
|
53
|
-
ref:
|
|
62
|
+
ref: f,
|
|
54
63
|
style: {
|
|
55
64
|
zIndex: 51,
|
|
56
|
-
...
|
|
65
|
+
...y
|
|
57
66
|
},
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
className:
|
|
61
|
-
"data-testid":
|
|
67
|
+
className: a(p["minimized-dialog"], !t && p.hidden, h.minimized),
|
|
68
|
+
children: /* @__PURE__ */ n("div", {
|
|
69
|
+
className: K("flex items-center justify-between", !t && "hidden"),
|
|
70
|
+
"data-testid": E,
|
|
62
71
|
children: [/* @__PURE__ */ e("div", {
|
|
63
72
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
64
|
-
children: /* @__PURE__ */ e(
|
|
65
|
-
title:
|
|
73
|
+
children: /* @__PURE__ */ e($, {
|
|
74
|
+
title: o,
|
|
66
75
|
placement: "top",
|
|
67
76
|
children: /* @__PURE__ */ e("div", {
|
|
68
77
|
className: "truncate",
|
|
69
|
-
children:
|
|
78
|
+
children: o
|
|
70
79
|
})
|
|
71
80
|
})
|
|
72
|
-
}), /* @__PURE__ */
|
|
81
|
+
}), /* @__PURE__ */ n("div", {
|
|
73
82
|
className: "flex items-center gap-x-1",
|
|
74
|
-
children: [/* @__PURE__ */ e(
|
|
83
|
+
children: [/* @__PURE__ */ e(B, {
|
|
75
84
|
type: "expand",
|
|
76
|
-
visibility:
|
|
77
|
-
onClick:
|
|
78
|
-
tooltipTitle:
|
|
79
|
-
}), /* @__PURE__ */ e(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
visibility: A,
|
|
86
|
+
onClick: T,
|
|
87
|
+
tooltipTitle: s.expand
|
|
88
|
+
}), /* @__PURE__ */ e(k, {
|
|
89
|
+
buttonRef: C,
|
|
90
|
+
showCloseIcon: z,
|
|
91
|
+
onClick: v,
|
|
92
|
+
tooltipTitle: s.close
|
|
83
93
|
})]
|
|
84
94
|
})]
|
|
85
95
|
})
|
|
@@ -87,66 +97,67 @@ var ae = (h) => {
|
|
|
87
97
|
l && /* @__PURE__ */ e("div", {
|
|
88
98
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
89
99
|
onClick: () => {
|
|
90
|
-
|
|
100
|
+
R(!1);
|
|
91
101
|
}
|
|
92
102
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ n("div", {
|
|
94
104
|
style: {
|
|
95
105
|
zIndex: 51,
|
|
96
|
-
...
|
|
97
|
-
...
|
|
106
|
+
...y,
|
|
107
|
+
...W
|
|
98
108
|
},
|
|
99
|
-
ref:
|
|
109
|
+
ref: d,
|
|
100
110
|
role: l ? "dialog" : void 0,
|
|
101
111
|
"aria-modal": l ? !0 : void 0,
|
|
102
|
-
"aria-label": l && typeof
|
|
103
|
-
className:
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
-
className:
|
|
106
|
-
children: [/* @__PURE__ */
|
|
112
|
+
"aria-label": l && typeof o == "string" ? o : void 0,
|
|
113
|
+
className: a(p.dialog, t && p.hidden, !i && h.maximized, i && h.fullscreen, l && "fixed z-[53] duration-0"),
|
|
114
|
+
children: [/* @__PURE__ */ n("div", {
|
|
115
|
+
className: a("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
|
|
116
|
+
children: [/* @__PURE__ */ n("div", {
|
|
107
117
|
className: "flex items-center justify-between",
|
|
108
|
-
children: [
|
|
118
|
+
children: [x ? /* @__PURE__ */ e("div", {
|
|
109
119
|
className: "text-sm text-delta-700",
|
|
110
|
-
children:
|
|
120
|
+
children: x
|
|
111
121
|
}) : /* @__PURE__ */ e("div", {
|
|
112
|
-
className:
|
|
113
|
-
children:
|
|
114
|
-
}), /* @__PURE__ */
|
|
122
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
123
|
+
children: o
|
|
124
|
+
}), /* @__PURE__ */ n("div", {
|
|
115
125
|
className: "flex items-center gap-x-1",
|
|
116
126
|
children: [
|
|
117
|
-
|
|
118
|
-
/* @__PURE__ */ e(
|
|
119
|
-
visibility:
|
|
127
|
+
P,
|
|
128
|
+
/* @__PURE__ */ e(B, {
|
|
129
|
+
visibility: j && !r && !i,
|
|
120
130
|
type: "minimize",
|
|
121
|
-
onClick:
|
|
122
|
-
tooltipTitle:
|
|
131
|
+
onClick: T,
|
|
132
|
+
tooltipTitle: s.minimize
|
|
123
133
|
}),
|
|
124
|
-
/* @__PURE__ */ e(
|
|
125
|
-
showFullScreenIcon:
|
|
126
|
-
fullScreen:
|
|
134
|
+
/* @__PURE__ */ e(Q, {
|
|
135
|
+
showFullScreenIcon: D && !r,
|
|
136
|
+
fullScreen: i,
|
|
127
137
|
onClick: () => {
|
|
128
|
-
|
|
138
|
+
R(!i);
|
|
129
139
|
},
|
|
130
|
-
tooltipTitle:
|
|
140
|
+
tooltipTitle: i ? s.exitFullscreen : s.fullscreen
|
|
131
141
|
}),
|
|
132
|
-
/* @__PURE__ */ e(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
/* @__PURE__ */ e(k, {
|
|
143
|
+
buttonRef: N,
|
|
144
|
+
showCloseIcon: z,
|
|
145
|
+
onClick: v,
|
|
146
|
+
tooltipTitle: s.close
|
|
136
147
|
})
|
|
137
148
|
]
|
|
138
149
|
})]
|
|
139
|
-
}),
|
|
140
|
-
className:
|
|
141
|
-
children:
|
|
150
|
+
}), x && /* @__PURE__ */ e("div", {
|
|
151
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
152
|
+
children: o
|
|
142
153
|
})]
|
|
143
154
|
}), /* @__PURE__ */ e("div", {
|
|
144
|
-
className:
|
|
145
|
-
children:
|
|
155
|
+
className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto"),
|
|
156
|
+
children: O
|
|
146
157
|
})]
|
|
147
158
|
})
|
|
148
159
|
] }) : null;
|
|
149
160
|
};
|
|
150
161
|
export {
|
|
151
|
-
|
|
162
|
+
ue as MinimizableDialogV2
|
|
152
163
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
export type ILocale = 'en' | 'no';
|
|
3
3
|
/**
|
|
4
4
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#20049-111828 (Design-System · "Dialog minimized")
|
|
@@ -32,6 +32,11 @@ export interface IMinimizableDialogV2Props {
|
|
|
32
32
|
locale?: ILocale;
|
|
33
33
|
dataTest: string;
|
|
34
34
|
style?: React.CSSProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Overrides the Close button as the focus target when the dialog opens.
|
|
37
|
+
* Docked dialogs remain non-modal and do not trap subsequent keyboard navigation.
|
|
38
|
+
*/
|
|
39
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
35
40
|
minimizedState?: boolean;
|
|
36
41
|
handleMinimizedState?: (minimized: boolean) => void;
|
|
37
42
|
enableFullscreen?: boolean;
|