@galaxy-io/dls 2.11.2 → 2.12.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/modal/ConfirmDialog.d.ts +4 -4
- package/dist/modal/Modal.d.ts +18 -9
- package/dist/modal/Modal.js +157 -43
- package/dist/navigation/SidebarNav.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -45,13 +45,13 @@ export interface ConfirmDialogProps extends AriaAttributes {
|
|
|
45
45
|
defaultIsOpen?: boolean;
|
|
46
46
|
/** Called with `false` on Cancel, Escape, a backdrop click, the close button, and after `onConfirm` succeeds. */
|
|
47
47
|
onOpenChange?: (isOpen: boolean) => void;
|
|
48
|
-
/** DOM id on the dialog
|
|
48
|
+
/** DOM id on the dialog (`role="dialog"`). */
|
|
49
49
|
id?: string;
|
|
50
|
-
/** Any `data-*` attribute, forwarded to the dialog
|
|
50
|
+
/** Any `data-*` attribute, forwarded to the dialog. */
|
|
51
51
|
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
52
|
-
/** Extra class on the dialog
|
|
52
|
+
/** Extra class on the dialog. */
|
|
53
53
|
className?: string;
|
|
54
|
-
/** Inline style on the dialog
|
|
54
|
+
/** Inline style on the dialog; only for setting CSS custom properties. */
|
|
55
55
|
style?: CSSProperties;
|
|
56
56
|
}
|
|
57
57
|
/** A yes/no question before an action: title, description, optional type-to-confirm, Cancel + action. */
|
package/dist/modal/Modal.d.ts
CHANGED
|
@@ -8,17 +8,21 @@ export declare enum ModalSize {
|
|
|
8
8
|
MEDIUM = "MEDIUM",
|
|
9
9
|
/** 720px: a longer form or a preview. */
|
|
10
10
|
LARGE = "LARGE",
|
|
11
|
-
/**
|
|
11
|
+
/** 960px wide and a fixed 720px tall: settings, a chooser, a multi-step wizard. */
|
|
12
12
|
X_LARGE = "X_LARGE"
|
|
13
13
|
}
|
|
14
14
|
/** Every Modal prop except the name pair (`header` / `ariaLabel`). */
|
|
15
15
|
interface ModalBaseProps extends AriaAttributes {
|
|
16
|
-
/** The body. It scrolls when the panel reaches
|
|
16
|
+
/** The body. It scrolls when the panel reaches its height. A string or number renders as `Text`. */
|
|
17
17
|
children?: ReactNode;
|
|
18
18
|
/** The actions row, end-aligned with an 8px gap. Put the least destructive action first. */
|
|
19
19
|
footer?: ReactNode;
|
|
20
20
|
/** A strip between the title row and the body that stays in place while the body scrolls: an `Alert isBanner`. */
|
|
21
21
|
banner?: ReactNode;
|
|
22
|
+
/** A navigation column at the panel's start, its full height: a `SidebarNav` with `hasDividers={false}`, a vertical `Stepper`. The title row, body and footer sit in the column beside it, and the panel holds a fixed height (480 / 560 / 640 / 720px by `size`, less on a shorter viewport). */
|
|
23
|
+
sidebar?: ReactNode;
|
|
24
|
+
/** A second panel beside the dialog's end edge, for context on the body (a preview, the matches for what was typed). Slides out when set and back in when `null`. It takes its child's width (set it with `Box width`), at most half the viewport, and shares the panel's height; no padding: the app pads it. */
|
|
25
|
+
aside?: ReactNode;
|
|
22
26
|
/**
|
|
23
27
|
* Hairlines between the title row and the body, and between the body and the footer. For a body that scrolls.
|
|
24
28
|
* @default false
|
|
@@ -30,10 +34,15 @@ interface ModalBaseProps extends AriaAttributes {
|
|
|
30
34
|
*/
|
|
31
35
|
isFlush?: boolean;
|
|
32
36
|
/**
|
|
33
|
-
* Panel width: 400 / 560 /
|
|
37
|
+
* Panel width: 400 / 560 / 720 / 960px. `X_LARGE` also holds a fixed 720px height.
|
|
34
38
|
* @default ModalSize.MEDIUM
|
|
35
39
|
*/
|
|
36
40
|
size?: ModalSize;
|
|
41
|
+
/**
|
|
42
|
+
* Fill the viewport less 32px on each side (16px on a phone). Replaces `size`.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
isFullscreen?: boolean;
|
|
37
46
|
/**
|
|
38
47
|
* Escape, a backdrop click and the close button close the dialog. When `false` there is no close button, and only the app (usually a `footer` action) can close it.
|
|
39
48
|
* @default true
|
|
@@ -48,18 +57,18 @@ interface ModalBaseProps extends AriaAttributes {
|
|
|
48
57
|
defaultIsOpen?: boolean;
|
|
49
58
|
/** Called with `false` on Escape, a backdrop click and the close button. */
|
|
50
59
|
onOpenChange?: (isOpen: boolean) => void;
|
|
51
|
-
/** DOM id on the
|
|
60
|
+
/** DOM id on the dialog (`role="dialog"`, the panel and its aside). @default a `useId()` value */
|
|
52
61
|
id?: string;
|
|
53
|
-
/** Any `data-*` attribute, forwarded to the
|
|
62
|
+
/** Any `data-*` attribute, forwarded to the dialog. */
|
|
54
63
|
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
55
|
-
/** Extra class on the
|
|
64
|
+
/** Extra class on the dialog. */
|
|
56
65
|
className?: string;
|
|
57
|
-
/** Inline style on the
|
|
66
|
+
/** Inline style on the dialog; only for setting CSS custom properties. */
|
|
58
67
|
style?: CSSProperties;
|
|
59
68
|
}
|
|
60
69
|
/** A title row names the dialog. */
|
|
61
70
|
interface ModalTitledProps {
|
|
62
|
-
/** The title row. A string renders as an `h2` `Text` and names the dialog; a node renders as it is, in a first line one control tall.
|
|
71
|
+
/** The title row. A string renders as an `h2` `Text` and names the dialog; a node renders as it is, in a first line one control tall. Without it there is no title row and the close button floats in the top-end corner; `ariaLabel` is then required. */
|
|
63
72
|
header: ReactNode;
|
|
64
73
|
/** A secondary line under the title. Describes the dialog. */
|
|
65
74
|
subheader?: string | undefined;
|
|
@@ -70,7 +79,7 @@ interface ModalTitledProps {
|
|
|
70
79
|
}
|
|
71
80
|
/** No title row: the accessible name is required. */
|
|
72
81
|
interface ModalUntitledProps {
|
|
73
|
-
/** The title row. A string renders as an `h2` `Text` and names the dialog; a node renders as it is.
|
|
82
|
+
/** The title row. A string renders as an `h2` `Text` and names the dialog; a node renders as it is. Without it there is no title row and the close button floats in the top-end corner; `ariaLabel` is then required. */
|
|
74
83
|
header?: undefined;
|
|
75
84
|
/** A secondary line under the title. Needs `header`. */
|
|
76
85
|
subheader?: undefined;
|
package/dist/modal/Modal.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import FocusScope, { FocusScopeAutoFocus } from "../a11y/FocusScope.js";
|
|
2
2
|
import Text from "../text/Text.js";
|
|
3
|
+
import { DURATION } from "../theme/tokens/scales.js";
|
|
3
4
|
import { useControlledOpenState } from "../hooks/useControlledOpenState.js";
|
|
4
5
|
import Portal from "../layout/Portal.js";
|
|
5
6
|
import { OverlayLayer, useOverlay } from "../overlay/useOverlay.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../hooks/usePrefersReducedMotion.js";
|
|
6
8
|
import Divider from "../layout/Divider.js";
|
|
7
9
|
import { OverlayScaleFade } from "../overlay/internal/OverlayScaleFade.js";
|
|
8
10
|
import { OverlayNode } from "../overlay/OverlayProvider.js";
|
|
@@ -15,6 +17,7 @@ import { forwardRef, useId, useRef, useState } from "react";
|
|
|
15
17
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
18
|
import { cx } from "@linaria/core";
|
|
17
19
|
import { XIcon } from "@phosphor-icons/react";
|
|
20
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
18
21
|
//#region src/modal/Modal.tsx
|
|
19
22
|
/**
|
|
20
23
|
* The blocking dialog: a centered panel over a dimmed page holding one task the user must finish
|
|
@@ -28,7 +31,20 @@ import { XIcon } from "@phosphor-icons/react";
|
|
|
28
31
|
* body and between the body and the footer, for a body that scrolls. `isFlush` drops the body's
|
|
29
32
|
* padding so the app owns it (sections of `Box padding={16}` and `Divider`s, a table edge to
|
|
30
33
|
* edge). `banner` is a slot between the title row and the body that stays put while the body
|
|
31
|
-
* scrolls, for an `Alert isBanner`.
|
|
34
|
+
* scrolls, for an `Alert isBanner`. With no `header` there is no title row: the close button
|
|
35
|
+
* floats in the panel's top-end corner, on the body's first line, and the body starts at the top.
|
|
36
|
+
*
|
|
37
|
+
* Two slots change the panel's shape without leaving the frame. `sidebar` is a navigation column
|
|
38
|
+
* at the panel's start, its full height (settings sections, the steps of a wizard); the title row,
|
|
39
|
+
* body and footer move into the column beside it, and the panel holds a fixed height so switching
|
|
40
|
+
* sections never resizes it. `aside` is a second panel outside the dialog's end edge, for context
|
|
41
|
+
* on what the body is doing (a preview, the matches for what was typed): it slides out from behind
|
|
42
|
+
* the panel when set and back in when `null`, and the panel and the aside center as a pair. It
|
|
43
|
+
* takes its child's width (`Box width`), at most half the viewport, and the panel gives way. Below
|
|
44
|
+
* 768px the aside stacks under the panel instead, so the field that feeds it stays in view.
|
|
45
|
+
*
|
|
46
|
+
* Sizes are widths: 400 / 560 / 720 / 960px. `X_LARGE` also holds a fixed height (720px, less
|
|
47
|
+
* when the viewport is shorter). `isFullscreen` fills the viewport less 32px on each side.
|
|
32
48
|
*
|
|
33
49
|
* A short yes/no question is `ConfirmDialog`; a panel beside the page is `Drawer`; an anchored
|
|
34
50
|
* panel is `Popover`.
|
|
@@ -44,12 +60,14 @@ var ModalSize = /* @__PURE__ */ function(ModalSize) {
|
|
|
44
60
|
ModalSize["MEDIUM"] = "MEDIUM";
|
|
45
61
|
/** 720px: a longer form or a preview. */
|
|
46
62
|
ModalSize["LARGE"] = "LARGE";
|
|
47
|
-
/**
|
|
63
|
+
/** 960px wide and a fixed 720px tall: settings, a chooser, a multi-step wizard. */
|
|
48
64
|
ModalSize["X_LARGE"] = "X_LARGE";
|
|
49
65
|
return ModalSize;
|
|
50
66
|
}({});
|
|
51
67
|
/** The close button's accessible name (fixed English, as Input's "Clear"). */
|
|
52
68
|
var CLOSE_LABEL = "Close";
|
|
69
|
+
/** The `sidebar` column's width: AppFrame's sidebar column. */
|
|
70
|
+
/** Below this viewport width the aside stacks under the panel and the sidebar above the content. */
|
|
53
71
|
/**
|
|
54
72
|
* Scroll lock: while any modal backdrop is mounted (open or exiting) the page does not scroll.
|
|
55
73
|
* `overflow: hidden` on `html` keeps the scroll position; the package reset hides scrollbars, so
|
|
@@ -62,54 +80,131 @@ var Backdrop = /*#__PURE__*/ styled("div")({
|
|
|
62
80
|
});
|
|
63
81
|
/** The backdrop's Fade root: positioned just under the panel. Sets no opacity or visibility. */
|
|
64
82
|
var BACKDROP_FRAME_CSS = "gx-Modal-BACKDROP_FRAME_CSS-b1jgo9vf";
|
|
65
|
-
/** Centers the
|
|
83
|
+
/** Centers the dialog; passes clicks around it through to the backdrop. */
|
|
66
84
|
var Positioner = /*#__PURE__*/ styled("div")({
|
|
67
85
|
name: "Positioner",
|
|
68
86
|
class: "gx-Modal-Positioner-ptpk8hn",
|
|
69
87
|
propsAsIs: false
|
|
70
88
|
});
|
|
71
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The dialog's scale-fade root: the flex chain that lets a tall body scroll. It shrink-wraps the
|
|
91
|
+
* panel and the aside, so the pair centers together.
|
|
92
|
+
*/
|
|
72
93
|
var FRAME_CSS = "gx-Modal-FRAME_CSS-fedvh3d";
|
|
94
|
+
/** `isFullscreen`: the frame fills the positioner. */
|
|
95
|
+
var FULLSCREEN_FRAME_CSS = "gx-Modal-FULLSCREEN_FRAME_CSS-f1jpkb4q";
|
|
96
|
+
/** A fixed height (`X_LARGE`, or any size with a `sidebar`): the viewport's, when it is shorter. */
|
|
97
|
+
var MODAL_SIZE_TO_FIXED_HEIGHT_CSS_MAP = {
|
|
98
|
+
["SMALL"]: "gx-Modal-SMALL-sh1vj51",
|
|
99
|
+
["MEDIUM"]: "gx-Modal-MEDIUM-m1th1b6t",
|
|
100
|
+
["LARGE"]: "gx-Modal-LARGE-l1s4ejyc",
|
|
101
|
+
["X_LARGE"]: "gx-Modal-X_LARGE-x69bx3r"
|
|
102
|
+
};
|
|
103
|
+
/** The panel's width; it gives way (never the aside) when the pair is wider than the viewport. */
|
|
73
104
|
var MODAL_SIZE_TO_CSS_MAP = {
|
|
74
|
-
["SMALL"]: "gx-Modal-SMALL-
|
|
75
|
-
["MEDIUM"]: "gx-Modal-MEDIUM-
|
|
76
|
-
["LARGE"]: "gx-Modal-LARGE-
|
|
77
|
-
["X_LARGE"]: "gx-Modal-X_LARGE-
|
|
105
|
+
["SMALL"]: "gx-Modal-SMALL-s14wx16q",
|
|
106
|
+
["MEDIUM"]: "gx-Modal-MEDIUM-m1w4b032",
|
|
107
|
+
["LARGE"]: "gx-Modal-LARGE-lbri8ij",
|
|
108
|
+
["X_LARGE"]: "gx-Modal-X_LARGE-xxdonbm"
|
|
78
109
|
};
|
|
79
|
-
|
|
110
|
+
/**
|
|
111
|
+
* `isFullscreen`: the panel takes the whole width, and the panel's own `flex-shrink: 1` gives the
|
|
112
|
+
* aside its share. A width, not a flex override: `Panel`'s `flex` comes later in the stylesheet.
|
|
113
|
+
*/
|
|
114
|
+
var FULLSCREEN_PANEL_CSS = "gx-Modal-FULLSCREEN_PANEL_CSS-f1c1q51w";
|
|
115
|
+
var FOCUS_SCOPE_CSS = "gx-Modal-FOCUS_SCOPE_CSS-f1aye683";
|
|
116
|
+
/** The dialog (`role="dialog"`): the panel, then the aside, in a row (a column on a phone). Draws nothing itself. */
|
|
117
|
+
var Root = /*#__PURE__*/ styled("div")({
|
|
118
|
+
name: "Root",
|
|
119
|
+
class: "gx-Modal-r1uq3md9",
|
|
120
|
+
propsAsIs: false
|
|
121
|
+
});
|
|
80
122
|
var Panel = /*#__PURE__*/ styled("div")({
|
|
81
123
|
name: "Panel",
|
|
82
|
-
class: "gx-Modal-Panel-
|
|
124
|
+
class: "gx-Modal-Panel-p1ltfmcj",
|
|
125
|
+
propsAsIs: false
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* `sidebar`: the navigation column, its full height, a hairline at its end. Below 768px it stacks
|
|
129
|
+
* above the content at full width, at most 40% of the viewport height, with the hairline under it.
|
|
130
|
+
*/
|
|
131
|
+
var Sidebar = /*#__PURE__*/ styled("div")({
|
|
132
|
+
name: "Sidebar",
|
|
133
|
+
class: "gx-Modal-Sidebar-s1vc3s89",
|
|
134
|
+
propsAsIs: false
|
|
135
|
+
});
|
|
136
|
+
/** The title row, banner, body and footer, in a column. */
|
|
137
|
+
var Content = /*#__PURE__*/ styled("div")({
|
|
138
|
+
name: "Content",
|
|
139
|
+
class: "gx-Modal-Content-c1kofw5u",
|
|
83
140
|
propsAsIs: false
|
|
84
141
|
});
|
|
85
142
|
var Body = /*#__PURE__*/ styled("div")({
|
|
86
143
|
name: "Body",
|
|
87
|
-
class: "gx-Modal-Body-
|
|
144
|
+
class: "gx-Modal-Body-burevkp",
|
|
88
145
|
propsAsIs: false
|
|
89
146
|
});
|
|
90
147
|
/** `isFlush`: the body has no inset; the content pads itself. */
|
|
91
|
-
var FLUSH_BODY_CSS = "gx-Modal-FLUSH_BODY_CSS-
|
|
148
|
+
var FLUSH_BODY_CSS = "gx-Modal-FLUSH_BODY_CSS-f11dq6j2";
|
|
92
149
|
/** `banner`: a strip pinned between the title row and the body; it never shrinks or scrolls. */
|
|
93
150
|
var Banner = /*#__PURE__*/ styled("div")({
|
|
94
151
|
name: "Banner",
|
|
95
|
-
class: "gx-Modal-Banner-
|
|
152
|
+
class: "gx-Modal-Banner-b6mxmup",
|
|
96
153
|
propsAsIs: false
|
|
97
154
|
});
|
|
98
155
|
var Footer = /*#__PURE__*/ styled("div")({
|
|
99
156
|
name: "Footer",
|
|
100
|
-
class: "gx-Modal-Footer-
|
|
157
|
+
class: "gx-Modal-Footer-f9gpbdm",
|
|
101
158
|
propsAsIs: false
|
|
102
159
|
});
|
|
160
|
+
/** Pinned 12px from the panel's top-end corner. */
|
|
103
161
|
var CloseSlot = /*#__PURE__*/ styled("span")({
|
|
104
162
|
name: "CloseSlot",
|
|
105
|
-
class: "gx-Modal-CloseSlot-
|
|
163
|
+
class: "gx-Modal-CloseSlot-cfsn1gx",
|
|
106
164
|
propsAsIs: false
|
|
107
165
|
});
|
|
166
|
+
/**
|
|
167
|
+
* The aside's slot: its width runs from 0 to `auto` (the 8px gap plus the aside, measured by
|
|
168
|
+
* framer), which glides the panel aside as the pair re-centers, while the slot clips the aside so
|
|
169
|
+
* it slides out from behind the panel's edge. Never shrinks: the panel gives way. Below 768px it
|
|
170
|
+
* stacks under the panel at full width (the `!important` beats the slide's inline width) and takes
|
|
171
|
+
* at most 40% of the viewport height.
|
|
172
|
+
*/
|
|
173
|
+
var ASIDE_SLOT_CSS = "gx-Modal-ASIDE_SLOT_CSS-a1jg9rc6";
|
|
174
|
+
/**
|
|
175
|
+
* The aside takes its child's width (`flex: none`, so the slide clips it rather than squeezing
|
|
176
|
+
* it), at most half the viewport less the positioner's 32px inset and the gap: the panel always
|
|
177
|
+
* keeps the other half. A wider child scrolls inside it.
|
|
178
|
+
*/
|
|
179
|
+
var Aside = /*#__PURE__*/ styled("div")({
|
|
180
|
+
name: "Aside",
|
|
181
|
+
class: "gx-Modal-Aside-a7k0w0q",
|
|
182
|
+
propsAsIs: false
|
|
183
|
+
});
|
|
184
|
+
/**
|
|
185
|
+
* The aside's slide: its slot's width runs from 0 to the child's (framer measures `auto`) as it
|
|
186
|
+
* fades in, so on a phone, where the stacked slot keeps its full width, it fades rather than pops.
|
|
187
|
+
*/
|
|
188
|
+
var ASIDE_HIDDEN = {
|
|
189
|
+
width: 0,
|
|
190
|
+
opacity: 0
|
|
191
|
+
};
|
|
192
|
+
var ASIDE_SHOWN = {
|
|
193
|
+
width: "auto",
|
|
194
|
+
opacity: 1
|
|
195
|
+
};
|
|
196
|
+
/** The aside's slide: `duration.base` (a transform-like move), snapped under reduced motion. */
|
|
197
|
+
var ASIDE_TRANSITION = {
|
|
198
|
+
duration: Number.parseFloat(DURATION.base) / 1e3,
|
|
199
|
+
ease: "easeOut"
|
|
200
|
+
};
|
|
201
|
+
var REDUCED_TRANSITION = { duration: 0 };
|
|
108
202
|
/** A blocking dialog over a dimmed page: title row, scrolling body, actions row. */
|
|
109
|
-
var Modal = forwardRef(function Modal({ children, header, subheader, icon, footer, banner, hasDividers = false, isFlush = false, size = "MEDIUM", isDismissable = true, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, ariaLabel, id, className, style, ...rest }, ref) {
|
|
203
|
+
var Modal = forwardRef(function Modal({ children, header, subheader, icon, footer, banner, sidebar, aside, hasDividers = false, isFlush = false, size = "MEDIUM", isFullscreen = false, isDismissable = true, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, ariaLabel, id, className, style, ...rest }, ref) {
|
|
110
204
|
const generatedId = useId();
|
|
111
205
|
const titleId = useId();
|
|
112
206
|
const subheaderId = useId();
|
|
207
|
+
const isReducedMotion = usePrefersReducedMotion();
|
|
113
208
|
const { isOpen, setOpen } = useControlledOpenState({
|
|
114
209
|
isOpen: isOpenProp,
|
|
115
210
|
defaultIsOpen,
|
|
@@ -136,7 +231,10 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
|
|
|
136
231
|
if (isBackdropPress && isDismissable) close();
|
|
137
232
|
};
|
|
138
233
|
if (!hasOpened) return null;
|
|
139
|
-
const hasHeaderRow = header !== void 0
|
|
234
|
+
const hasHeaderRow = header !== void 0;
|
|
235
|
+
const hasSidebar = sidebar !== void 0 && sidebar !== null && sidebar !== false;
|
|
236
|
+
const hasAside = aside !== void 0 && aside !== null && aside !== false;
|
|
237
|
+
const hasFixedHeight = !isFullscreen && (size === "X_LARGE" || hasSidebar);
|
|
140
238
|
const labelling = ariaLabel !== void 0 ? { "aria-label": ariaLabel } : rest["aria-labelledby"] !== void 0 || header === void 0 ? {} : { "aria-labelledby": titleId };
|
|
141
239
|
const describing = subheader !== void 0 && header !== void 0 && rest["aria-describedby"] === void 0 ? { "aria-describedby": subheaderId } : {};
|
|
142
240
|
const zStyle = { "--gx-modal-z": zIndex };
|
|
@@ -157,11 +255,11 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
|
|
|
157
255
|
children: /* @__PURE__ */ jsx(OverlayScaleFade, {
|
|
158
256
|
isOpen,
|
|
159
257
|
shouldAnimateOnMount,
|
|
160
|
-
className: cx(FRAME_CSS,
|
|
258
|
+
className: cx(FRAME_CSS, isFullscreen && FULLSCREEN_FRAME_CSS, hasFixedHeight && MODAL_SIZE_TO_FIXED_HEIGHT_CSS_MAP[size]),
|
|
161
259
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
162
260
|
autoFocus: FocusScopeAutoFocus.FIRST,
|
|
163
261
|
className: FOCUS_SCOPE_CSS,
|
|
164
|
-
children: /* @__PURE__ */ jsxs(
|
|
262
|
+
children: /* @__PURE__ */ jsxs(Root, {
|
|
165
263
|
...rest,
|
|
166
264
|
...labelling,
|
|
167
265
|
...describing,
|
|
@@ -171,30 +269,46 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
|
|
|
171
269
|
"aria-modal": "true",
|
|
172
270
|
className,
|
|
173
271
|
style,
|
|
174
|
-
children: [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
272
|
+
children: [/* @__PURE__ */ jsxs(Panel, {
|
|
273
|
+
className: isFullscreen ? FULLSCREEN_PANEL_CSS : MODAL_SIZE_TO_CSS_MAP[size],
|
|
274
|
+
children: [
|
|
275
|
+
hasSidebar && /* @__PURE__ */ jsx(Sidebar, { children: sidebar }),
|
|
276
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
277
|
+
hasHeaderRow && /* @__PURE__ */ jsx(OverlayTitleRow, {
|
|
278
|
+
header,
|
|
279
|
+
subheader,
|
|
280
|
+
icon,
|
|
281
|
+
titleId,
|
|
282
|
+
subheaderId,
|
|
283
|
+
hasClose: isDismissable
|
|
284
|
+
}),
|
|
285
|
+
hasDividers && hasHeaderRow && /* @__PURE__ */ jsx(Divider, {}),
|
|
286
|
+
banner !== void 0 && /* @__PURE__ */ jsx(Banner, { children: banner }),
|
|
287
|
+
/* @__PURE__ */ jsx(Body, {
|
|
288
|
+
className: cx(isFlush && FLUSH_BODY_CSS),
|
|
289
|
+
children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx(Text, { children }) : children
|
|
290
|
+
}),
|
|
291
|
+
footer !== void 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [hasDividers && /* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsx(Footer, { children: footer })] })
|
|
292
|
+
] }),
|
|
293
|
+
isDismissable && /* @__PURE__ */ jsx(CloseSlot, { children: /* @__PURE__ */ jsx(Button, {
|
|
294
|
+
variant: ButtonVariant.TERTIARY,
|
|
295
|
+
size: ButtonSize.SMALL,
|
|
296
|
+
icon: XIcon,
|
|
297
|
+
ariaLabel: CLOSE_LABEL,
|
|
298
|
+
onClick: close
|
|
299
|
+
}) })
|
|
300
|
+
]
|
|
301
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, {
|
|
302
|
+
initial: false,
|
|
303
|
+
children: hasAside && /* @__PURE__ */ jsx(motion.div, {
|
|
304
|
+
className: ASIDE_SLOT_CSS,
|
|
305
|
+
initial: ASIDE_HIDDEN,
|
|
306
|
+
animate: ASIDE_SHOWN,
|
|
307
|
+
exit: ASIDE_HIDDEN,
|
|
308
|
+
transition: isReducedMotion ? REDUCED_TRANSITION : ASIDE_TRANSITION,
|
|
309
|
+
children: /* @__PURE__ */ jsx(Aside, { children: aside })
|
|
310
|
+
}, "aside")
|
|
311
|
+
})]
|
|
198
312
|
})
|
|
199
313
|
})
|
|
200
314
|
})
|
|
@@ -63,7 +63,7 @@ var Header = /*#__PURE__*/ styled("div")({
|
|
|
63
63
|
class: "gx-SidebarNav-Header-h7sesvp",
|
|
64
64
|
propsAsIs: false
|
|
65
65
|
});
|
|
66
|
-
/** Items stand
|
|
66
|
+
/** Items stand 4px apart, expanded and on the rail, in the list, in sections and in the footer. */
|
|
67
67
|
var List = /*#__PURE__*/ styled("ul")({
|
|
68
68
|
name: "List",
|
|
69
69
|
class: "gx-SidebarNav-List-lxg8t2f",
|
|
@@ -135,7 +135,7 @@ var GroupDivider = /*#__PURE__*/ styled("div")({
|
|
|
135
135
|
/**
|
|
136
136
|
* Rail mode: the header content and the footer content center in the 48px column. A section drops
|
|
137
137
|
* its 12px top padding and spaces its divider row like an item: the 24px row centres the line, so
|
|
138
|
-
* the space above it (the list's
|
|
138
|
+
* the space above it (the list's 4px gap + 11.5px) matches the space below (11.5px + 4px).
|
|
139
139
|
*/
|
|
140
140
|
var ROOT_COLLAPSED_CSS = "gx-SidebarNav-ROOT_COLLAPSED_CSS-rieaizt";
|
|
141
141
|
/** The scrolling list takes the height between header and footer. */
|