carbon-react 144.0.0 → 144.0.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/esm/components/advanced-color-picker/advanced-color-picker.style.js +1 -5
- package/esm/components/dialog/dialog.component.js +29 -103
- package/esm/components/dialog/dialog.config.d.ts +0 -4
- package/esm/components/dialog/dialog.config.js +1 -5
- package/esm/components/dialog/dialog.style.d.ts +6 -14
- package/esm/components/dialog/dialog.style.js +54 -83
- package/esm/components/dialog-full-screen/content.style.js +32 -74
- package/esm/components/dialog-full-screen/dialog-full-screen.style.js +0 -5
- package/esm/components/form/form.component.js +8 -17
- package/esm/components/form/form.style.d.ts +10 -6
- package/esm/components/form/form.style.js +12 -25
- package/esm/components/sidebar/sidebar.component.js +8 -18
- package/esm/components/sidebar/sidebar.config.d.ts +0 -4
- package/esm/components/sidebar/sidebar.config.js +1 -5
- package/esm/components/sidebar/sidebar.style.d.ts +4 -2
- package/esm/components/sidebar/sidebar.style.js +26 -12
- package/lib/components/advanced-color-picker/advanced-color-picker.style.js +0 -4
- package/lib/components/dialog/dialog.component.js +27 -101
- package/lib/components/dialog/dialog.config.d.ts +0 -4
- package/lib/components/dialog/dialog.config.js +2 -6
- package/lib/components/dialog/dialog.style.d.ts +6 -14
- package/lib/components/dialog/dialog.style.js +54 -83
- package/lib/components/dialog-full-screen/content.style.js +31 -73
- package/lib/components/dialog-full-screen/dialog-full-screen.style.js +0 -5
- package/lib/components/form/form.component.js +7 -16
- package/lib/components/form/form.style.d.ts +10 -6
- package/lib/components/form/form.style.js +12 -25
- package/lib/components/sidebar/sidebar.component.js +7 -17
- package/lib/components/sidebar/sidebar.config.d.ts +0 -4
- package/lib/components/sidebar/sidebar.config.js +2 -6
- package/lib/components/sidebar/sidebar.style.d.ts +4 -2
- package/lib/components/sidebar/sidebar.style.js +28 -15
- package/package.json +1 -1
- package/esm/style/utils/form-style-utils.d.ts +0 -21
- package/esm/style/utils/form-style-utils.js +0 -92
- package/lib/style/utils/form-style-utils.d.ts +0 -21
- package/lib/style/utils/form-style-utils.js +0 -100
|
@@ -4,18 +4,14 @@ import StyledFormField from "../../__internal__/form-field/form-field.style";
|
|
|
4
4
|
import baseTheme from "../../style/themes/base";
|
|
5
5
|
import StyledSearch from "../search/search.style";
|
|
6
6
|
import StyledTextarea from "../textarea/textarea.style";
|
|
7
|
-
export const StyledFormContent = styled.div
|
|
8
|
-
${({
|
|
7
|
+
export const StyledFormContent = styled.div(({
|
|
9
8
|
stickyFooter,
|
|
10
9
|
isInModal
|
|
11
|
-
}) => css`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
overflow-y:
|
|
15
|
-
|
|
16
|
-
`}
|
|
17
|
-
`}
|
|
18
|
-
`;
|
|
10
|
+
}) => stickyFooter && isInModal && css`
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
min-height: 0;
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
`);
|
|
19
15
|
export const StyledFormFooter = styled.div`
|
|
20
16
|
align-items: center;
|
|
21
17
|
display: flex;
|
|
@@ -30,8 +26,7 @@ export const StyledFormFooter = styled.div`
|
|
|
30
26
|
|
|
31
27
|
${({
|
|
32
28
|
stickyFooter,
|
|
33
|
-
fullWidthButtons
|
|
34
|
-
isInModal
|
|
29
|
+
fullWidthButtons
|
|
35
30
|
}) => css`
|
|
36
31
|
${!stickyFooter && css`
|
|
37
32
|
margin-top: 48px;
|
|
@@ -44,9 +39,7 @@ export const StyledFormFooter = styled.div`
|
|
|
44
39
|
padding: 16px 32px;
|
|
45
40
|
width: 100%;
|
|
46
41
|
z-index: 1000;
|
|
47
|
-
|
|
48
|
-
position: sticky;
|
|
49
|
-
`}
|
|
42
|
+
position: sticky;
|
|
50
43
|
bottom: 0;
|
|
51
44
|
`}
|
|
52
45
|
|
|
@@ -61,9 +54,6 @@ export const StyledFormFooter = styled.div`
|
|
|
61
54
|
StyledFormFooter.defaultProps = {
|
|
62
55
|
theme: baseTheme
|
|
63
56
|
};
|
|
64
|
-
|
|
65
|
-
// Accounts for height of the header of Modal parent, the height form footer and some additional spacing
|
|
66
|
-
const HEIGHT_SPACING = 216;
|
|
67
57
|
export const StyledForm = styled.form`
|
|
68
58
|
${space}
|
|
69
59
|
|
|
@@ -80,19 +70,16 @@ export const StyledForm = styled.form`
|
|
|
80
70
|
|
|
81
71
|
${({
|
|
82
72
|
stickyFooter,
|
|
83
|
-
isInModal
|
|
84
|
-
isInSidebar
|
|
73
|
+
isInModal
|
|
85
74
|
}) => stickyFooter && css`
|
|
86
75
|
display: flex;
|
|
87
76
|
flex-direction: column;
|
|
88
77
|
position: relative;
|
|
89
78
|
|
|
90
79
|
${isInModal && css`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
${isInSidebar && css`
|
|
95
|
-
min-height: 100%;
|
|
80
|
+
flex-grow: 1;
|
|
81
|
+
min-height: 0;
|
|
82
|
+
height: 100%;
|
|
96
83
|
`}
|
|
97
84
|
`}
|
|
98
85
|
`;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useRef
|
|
2
|
+
import React, { useCallback, useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import Modal from "../modal";
|
|
5
|
-
import StyledSidebar from "./sidebar.style";
|
|
5
|
+
import { StyledSidebar, StyledSidebarContent } from "./sidebar.style";
|
|
6
6
|
import IconButton from "../icon-button";
|
|
7
7
|
import Icon from "../icon";
|
|
8
8
|
import FocusTrap from "../../__internal__/focus-trap";
|
|
9
9
|
import SidebarHeader from "./__internal__/sidebar-header";
|
|
10
|
-
import Box from "../box";
|
|
11
10
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
12
11
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
13
12
|
import { filterStyledSystemPaddingProps } from "../../style/utils";
|
|
@@ -45,7 +44,6 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
45
44
|
const {
|
|
46
45
|
current: headerId
|
|
47
46
|
} = useRef(createGuid());
|
|
48
|
-
const hasStickyFooter = useMemo(() => React.Children.toArray(children).some(child => /*#__PURE__*/React.isValidElement(child) && child.props.stickyFooter), [children]);
|
|
49
47
|
const sidebarRef = useRef(null);
|
|
50
48
|
const setRefs = useCallback(reference => {
|
|
51
49
|
sidebarRef.current = reference;
|
|
@@ -64,7 +62,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
64
62
|
type: "close"
|
|
65
63
|
}));
|
|
66
64
|
};
|
|
67
|
-
const sidebar = /*#__PURE__*/React.createElement(StyledSidebar,
|
|
65
|
+
const sidebar = /*#__PURE__*/React.createElement(StyledSidebar, {
|
|
68
66
|
"aria-modal": !enableBackgroundUI && isTopModal,
|
|
69
67
|
"aria-describedby": ariaDescribedBy,
|
|
70
68
|
"aria-label": ariaLabel,
|
|
@@ -76,24 +74,16 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
76
74
|
position: position,
|
|
77
75
|
size: size,
|
|
78
76
|
onCancel: onCancel,
|
|
79
|
-
role: role
|
|
80
|
-
}, filterStyledSystemPaddingProps(rest), {
|
|
77
|
+
role: role,
|
|
81
78
|
width: width
|
|
82
|
-
}
|
|
79
|
+
}, header && /*#__PURE__*/React.createElement(SidebarHeader, _extends({
|
|
83
80
|
closeIcon: closeIcon()
|
|
84
81
|
}, headerPadding, {
|
|
85
82
|
id: headerId
|
|
86
|
-
}), header), !header && closeIcon(), /*#__PURE__*/React.createElement(
|
|
83
|
+
}), header), !header && closeIcon(), /*#__PURE__*/React.createElement(StyledSidebarContent, _extends({
|
|
87
84
|
"data-element": "sidebar-content",
|
|
88
|
-
"data-role": "sidebar-content"
|
|
89
|
-
|
|
90
|
-
pb: "var(--spacing400)",
|
|
91
|
-
px: "var(--spacing400)"
|
|
92
|
-
}, filterStyledSystemPaddingProps(rest), {
|
|
93
|
-
scrollVariant: "light",
|
|
94
|
-
overflow: hasStickyFooter ? undefined : "auto",
|
|
95
|
-
flex: "1"
|
|
96
|
-
}), /*#__PURE__*/React.createElement(SidebarContext.Provider, {
|
|
85
|
+
"data-role": "sidebar-content"
|
|
86
|
+
}, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(SidebarContext.Provider, {
|
|
97
87
|
value: {
|
|
98
88
|
isInSidebar: true
|
|
99
89
|
}
|
|
@@ -9,7 +9,3 @@ export declare const SIDEBAR_SIZES_CSS: {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const SIDEBAR_SIZES: string[];
|
|
11
11
|
export declare const SIDEBAR_ALIGNMENTS: string[];
|
|
12
|
-
export declare const SIDEBAR_TOP_SPACING = "27px";
|
|
13
|
-
export declare const SIDEBAR_BOTTOM_SPACING = "var(--spacing400)";
|
|
14
|
-
export declare const SIDEBAR_LEFT_PADDING = "var(--spacing400)";
|
|
15
|
-
export declare const SIDEBAR_RIGHT_PADDING = "var(--spacing400)";
|
|
@@ -8,8 +8,4 @@ export const SIDEBAR_SIZES_CSS = {
|
|
|
8
8
|
"extra-large": "814px"
|
|
9
9
|
};
|
|
10
10
|
export const SIDEBAR_SIZES = ["extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large"];
|
|
11
|
-
export const SIDEBAR_ALIGNMENTS = ["left", "right"];
|
|
12
|
-
export const SIDEBAR_TOP_SPACING = "27px";
|
|
13
|
-
export const SIDEBAR_BOTTOM_SPACING = "var(--spacing400)";
|
|
14
|
-
export const SIDEBAR_LEFT_PADDING = "var(--spacing400)";
|
|
15
|
-
export const SIDEBAR_RIGHT_PADDING = "var(--spacing400)";
|
|
11
|
+
export const SIDEBAR_ALIGNMENTS = ["left", "right"];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PaddingProps } from "styled-system";
|
|
2
2
|
import { SidebarProps } from "./sidebar.component";
|
|
3
|
-
declare
|
|
4
|
-
|
|
3
|
+
declare type StyledSidebarProps = Pick<SidebarProps, "onCancel" | "position" | "size" | "width">;
|
|
4
|
+
declare const StyledSidebar: import("styled-components").StyledComponent<"div", any, StyledSidebarProps, never>;
|
|
5
|
+
declare const StyledSidebarContent: import("styled-components").StyledComponent<"div", any, PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
|
|
6
|
+
export { StyledSidebar, StyledSidebarContent };
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
+
import { padding as paddingFn } from "styled-system";
|
|
2
3
|
import computeSizing from "../../style/utils/element-sizing";
|
|
3
4
|
import baseTheme from "../../style/themes/base";
|
|
4
5
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
5
|
-
import { calculateFormSpacingValues, calculateWidthValue } from "../../style/utils/form-style-utils";
|
|
6
|
-
import { StyledFormContent, StyledFormFooter } from "../form/form.style";
|
|
7
6
|
import { SIDEBAR_SIZES_CSS } from "./sidebar.config";
|
|
7
|
+
import { StyledForm, StyledFormContent } from "../form/form.style";
|
|
8
8
|
const StyledSidebar = styled.div`
|
|
9
9
|
// prevents outline being added in safari
|
|
10
10
|
:focus {
|
|
11
11
|
outline: none;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
${StyledFormContent} {
|
|
15
|
-
${props => calculateFormSpacingValues(props, true, "sidebar")}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
${StyledFormFooter}.sticky {
|
|
19
|
-
${calculateWidthValue}
|
|
20
|
-
${props => calculateFormSpacingValues(props, false, "sidebar")}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
14
|
${({
|
|
24
15
|
onCancel,
|
|
25
16
|
position,
|
|
@@ -58,7 +49,30 @@ const StyledSidebar = styled.div`
|
|
|
58
49
|
`}
|
|
59
50
|
`}
|
|
60
51
|
`;
|
|
52
|
+
const StyledSidebarContent = styled.div`
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
display: block;
|
|
55
|
+
overflow-y: auto;
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
|
|
58
|
+
padding: var(--spacing300) var(--spacing400) var(--spacing400);
|
|
59
|
+
${paddingFn}
|
|
60
|
+
|
|
61
|
+
&:has(${StyledForm}.sticky) {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
overflow-y: hidden;
|
|
65
|
+
padding: 0;
|
|
66
|
+
|
|
67
|
+
${StyledForm}.sticky {
|
|
68
|
+
${StyledFormContent} {
|
|
69
|
+
padding: var(--spacing300) var(--spacing400) var(--spacing400);
|
|
70
|
+
${paddingFn}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
61
75
|
StyledSidebar.defaultProps = {
|
|
62
76
|
theme: baseTheme
|
|
63
77
|
};
|
|
64
|
-
export
|
|
78
|
+
export { StyledSidebar, StyledSidebarContent };
|
|
@@ -68,10 +68,6 @@ const DialogStyle = exports.DialogStyle = (0, _styledComponents.default)(_dialog
|
|
|
68
68
|
padding: var(--spacing200);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
${_dialog.StyledDialogInnerContent} {
|
|
72
|
-
padding: 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
71
|
${_simpleColorPicker.StyledColorOptions} {
|
|
76
72
|
max-width: 285px;
|
|
77
73
|
${_simpleColor.StyledSimpleColor} {
|
|
@@ -10,9 +10,7 @@ var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/gui
|
|
|
10
10
|
var _modal = _interopRequireDefault(require("../modal"));
|
|
11
11
|
var _heading = _interopRequireDefault(require("../heading"));
|
|
12
12
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
13
|
-
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
14
13
|
var _dialog = require("./dialog.style");
|
|
15
|
-
var _dialog2 = require("./dialog.config");
|
|
16
14
|
var _focusTrap = _interopRequireDefault(require("../../__internal__/focus-trap"));
|
|
17
15
|
var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
18
16
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
@@ -53,11 +51,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
53
51
|
}, ref) => {
|
|
54
52
|
const locale = (0, _useLocale.default)();
|
|
55
53
|
const containerRef = (0, _react.useRef)(null);
|
|
56
|
-
const innerContentRef = (0, _react.useRef)(null);
|
|
57
54
|
const titleRef = (0, _react.useRef)(null);
|
|
58
|
-
const [breakpointOffset, setBreakpointOffset] = (0, _react.useState)(undefined);
|
|
59
|
-
const isDialogMaximised = size === "maximise";
|
|
60
|
-
const listenersAdded = (0, _react.useRef)(false);
|
|
61
55
|
const {
|
|
62
56
|
current: titleId
|
|
63
57
|
} = (0, _react.useRef)((0, _guid.default)());
|
|
@@ -70,93 +64,29 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
70
64
|
containerRef.current?.focus();
|
|
71
65
|
}
|
|
72
66
|
}), []);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setBreakpointOffset(breakPoint);
|
|
97
|
-
}
|
|
98
|
-
containerRef.current.style.top = `${midPointY}px`;
|
|
99
|
-
containerRef.current.style.left = `${midPointX}px`;
|
|
100
|
-
}, [size]);
|
|
101
|
-
(0, _useResizeObserver.default)(innerContentRef, centerDialog, !open);
|
|
102
|
-
const addListeners = (0, _react.useCallback)(() => {
|
|
103
|
-
/* istanbul ignore else */
|
|
104
|
-
if (!listenersAdded.current) {
|
|
105
|
-
window.addEventListener("resize", centerDialog);
|
|
106
|
-
listenersAdded.current = true;
|
|
107
|
-
}
|
|
108
|
-
}, [centerDialog]);
|
|
109
|
-
const removeListeners = (0, _react.useCallback)(() => {
|
|
110
|
-
if (listenersAdded.current) {
|
|
111
|
-
window.removeEventListener("resize", centerDialog);
|
|
112
|
-
listenersAdded.current = false;
|
|
113
|
-
}
|
|
114
|
-
}, [centerDialog]);
|
|
115
|
-
(0, _react.useEffect)(() => {
|
|
116
|
-
if (open) {
|
|
117
|
-
addListeners();
|
|
118
|
-
}
|
|
119
|
-
if (!open) {
|
|
120
|
-
removeListeners();
|
|
121
|
-
}
|
|
122
|
-
return () => {
|
|
123
|
-
removeListeners();
|
|
124
|
-
};
|
|
125
|
-
}, [open, addListeners, removeListeners]);
|
|
126
|
-
(0, _react.useLayoutEffect)(() => {
|
|
127
|
-
if (open) {
|
|
128
|
-
centerDialog();
|
|
129
|
-
}
|
|
130
|
-
}, [centerDialog, open, height]);
|
|
131
|
-
const closeIcon = () => {
|
|
132
|
-
if (!showCloseIcon || !onCancel) return null;
|
|
133
|
-
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
134
|
-
"aria-label": locale.dialog.ariaLabels.close(),
|
|
135
|
-
onClick: onCancel,
|
|
136
|
-
disabled: disableClose
|
|
137
|
-
}, (0, _tags.default)("close", {
|
|
138
|
-
"data-element": "close",
|
|
139
|
-
...closeButtonDataProps
|
|
140
|
-
})), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
141
|
-
type: "close"
|
|
142
|
-
}));
|
|
143
|
-
};
|
|
144
|
-
const dialogTitle = () => {
|
|
145
|
-
if (!title) return null;
|
|
146
|
-
return /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogTitle, {
|
|
147
|
-
showCloseIcon: showCloseIcon,
|
|
148
|
-
hasSubtitle: !!subtitle,
|
|
149
|
-
ref: titleRef
|
|
150
|
-
}, typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
151
|
-
"data-element": "dialog-title",
|
|
152
|
-
title: title,
|
|
153
|
-
titleId: titleId,
|
|
154
|
-
subheader: subtitle,
|
|
155
|
-
subtitleId: subtitleId,
|
|
156
|
-
divider: false,
|
|
157
|
-
help: help
|
|
158
|
-
}) : title);
|
|
159
|
-
};
|
|
67
|
+
const closeIcon = showCloseIcon && onCancel && /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
68
|
+
"aria-label": locale.dialog.ariaLabels.close(),
|
|
69
|
+
onClick: onCancel,
|
|
70
|
+
disabled: disableClose
|
|
71
|
+
}, (0, _tags.default)("close", {
|
|
72
|
+
"data-element": "close",
|
|
73
|
+
...closeButtonDataProps
|
|
74
|
+
})), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
75
|
+
type: "close"
|
|
76
|
+
}));
|
|
77
|
+
const dialogTitle = title && /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogTitle, {
|
|
78
|
+
showCloseIcon: showCloseIcon,
|
|
79
|
+
hasSubtitle: !!subtitle,
|
|
80
|
+
ref: titleRef
|
|
81
|
+
}, typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
82
|
+
"data-element": "dialog-title",
|
|
83
|
+
title: title,
|
|
84
|
+
titleId: titleId,
|
|
85
|
+
subheader: subtitle,
|
|
86
|
+
subtitleId: subtitleId,
|
|
87
|
+
divider: false,
|
|
88
|
+
help: help
|
|
89
|
+
}) : title);
|
|
160
90
|
let dialogHeight = height;
|
|
161
91
|
if (height && height.match(/px$/)) {
|
|
162
92
|
dialogHeight = height.replace("px", "");
|
|
@@ -183,25 +113,21 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
183
113
|
wrapperRef: containerRef,
|
|
184
114
|
isOpen: open,
|
|
185
115
|
additionalWrapperRefs: focusableContainers
|
|
186
|
-
}, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialog, _extends({
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement(_dialog.DialogPositioner, null, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialog, _extends({
|
|
187
117
|
"data-component": dataComponent,
|
|
188
118
|
"data-element": dataElement,
|
|
189
119
|
"data-role": dataRole,
|
|
190
120
|
"aria-modal": isTopModal ? true : undefined,
|
|
191
|
-
ref: containerRef
|
|
192
|
-
topMargin: isDialogMaximised && breakpointOffset ? breakpointOffset * 2 : _dialog2.TOP_MARGIN
|
|
121
|
+
ref: containerRef
|
|
193
122
|
}, dialogProps, {
|
|
194
123
|
role: role,
|
|
195
124
|
tabIndex: -1
|
|
196
125
|
}, contentPadding, {
|
|
197
126
|
backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
|
|
198
|
-
}), dialogTitle
|
|
127
|
+
}), dialogTitle, closeIcon, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogContent, _extends({}, contentPadding, {
|
|
199
128
|
"data-role": "dialog-content",
|
|
200
129
|
tabIndex: -1
|
|
201
|
-
}),
|
|
202
|
-
"data-role": "dialog-inner-content",
|
|
203
|
-
ref: innerContentRef
|
|
204
|
-
}, contentPadding), children)))));
|
|
130
|
+
}), children)))));
|
|
205
131
|
});
|
|
206
132
|
if (process.env.NODE_ENV !== "production") {
|
|
207
133
|
Dialog.propTypes = {
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
export declare const DIALOG_SIZES: readonly ["auto", "extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large", "maximise"];
|
|
2
|
-
export declare const TOP_MARGIN = 20;
|
|
3
|
-
export declare const CONTENT_TOP_PADDING = 24;
|
|
4
|
-
export declare const HORIZONTAL_PADDING = 32;
|
|
5
|
-
export declare const CONTENT_BOTTOM_PADDING = 30;
|
|
6
2
|
export declare type DialogSizes = typeof DIALOG_SIZES[number];
|
|
@@ -3,9 +3,5 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
const DIALOG_SIZES = exports.DIALOG_SIZES = ["auto", "extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large", "maximise"];
|
|
8
|
-
const TOP_MARGIN = exports.TOP_MARGIN = 20;
|
|
9
|
-
const CONTENT_TOP_PADDING = exports.CONTENT_TOP_PADDING = 24;
|
|
10
|
-
const HORIZONTAL_PADDING = exports.HORIZONTAL_PADDING = 32;
|
|
11
|
-
const CONTENT_BOTTOM_PADDING = exports.CONTENT_BOTTOM_PADDING = 30;
|
|
6
|
+
exports.DIALOG_SIZES = void 0;
|
|
7
|
+
const DIALOG_SIZES = exports.DIALOG_SIZES = ["auto", "extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large", "maximise"];
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
size?: DialogSizes;
|
|
6
|
-
dialogHeight?: string;
|
|
1
|
+
import { ContentPaddingInterface, DialogProps } from "./dialog.component";
|
|
2
|
+
declare const DialogPositioner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
declare const StyledDialog: import("styled-components").StyledComponent<"div", any, Required<Pick<DialogProps, "size">> & {
|
|
4
|
+
dialogHeight?: string | undefined;
|
|
7
5
|
backgroundColor: string;
|
|
8
|
-
}
|
|
9
|
-
declare const StyledDialog: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
-
isDialogMaximised: boolean;
|
|
11
|
-
isDialogMaximisedSmallViewport: boolean;
|
|
12
|
-
isDialogMaximisedLargeViewport: boolean;
|
|
13
|
-
} & StyledDialogProps & ContentPaddingInterface, "isDialogMaximised" | "isDialogMaximisedSmallViewport" | "isDialogMaximisedLargeViewport">;
|
|
6
|
+
} & ContentPaddingInterface, never>;
|
|
14
7
|
declare type StyledDialogTitleProps = {
|
|
15
8
|
showCloseIcon?: boolean;
|
|
16
9
|
hasSubtitle?: boolean;
|
|
17
10
|
};
|
|
18
11
|
declare const StyledDialogTitle: import("styled-components").StyledComponent<"div", any, StyledDialogTitleProps, never>;
|
|
19
12
|
declare const StyledDialogContent: import("styled-components").StyledComponent<"div", any, ContentPaddingInterface, never>;
|
|
20
|
-
|
|
21
|
-
export { StyledDialog, StyledDialogTitle, StyledDialogContent, StyledDialogInnerContent, };
|
|
13
|
+
export { DialogPositioner, StyledDialog, StyledDialogTitle, StyledDialogContent, };
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledDialogTitle = exports.
|
|
6
|
+
exports.StyledDialogTitle = exports.StyledDialogContent = exports.StyledDialog = exports.DialogPositioner = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
|
-
var _formStyleUtils = require("../../style/utils/form-style-utils");
|
|
11
|
-
var _form = require("../form/form.style");
|
|
12
10
|
var _heading = require("../heading/heading.style");
|
|
13
11
|
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
14
|
-
var
|
|
12
|
+
var _form = require("../form/form.style");
|
|
15
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -25,38 +23,38 @@ const dialogSizes = {
|
|
|
25
23
|
large: "960px",
|
|
26
24
|
"extra-large": "1080px"
|
|
27
25
|
};
|
|
28
|
-
const
|
|
29
|
-
py,
|
|
30
|
-
p
|
|
31
|
-
}) => [py, p].some(padding => padding !== undefined) ? 0 : `${_dialog.CONTENT_TOP_PADDING}px`;
|
|
32
|
-
const StyledDialog = exports.StyledDialog = _styledComponents.default.div.attrs(({
|
|
33
|
-
topMargin,
|
|
34
|
-
size
|
|
35
|
-
}) => {
|
|
36
|
-
const isDialogMaximised = size === "maximise";
|
|
37
|
-
const isDialogMaximisedSmallViewport = topMargin === 32;
|
|
38
|
-
const isDialogMaximisedLargeViewport = topMargin === 64;
|
|
39
|
-
return {
|
|
40
|
-
isDialogMaximised,
|
|
41
|
-
isDialogMaximisedSmallViewport,
|
|
42
|
-
isDialogMaximisedLargeViewport
|
|
43
|
-
};
|
|
44
|
-
})`
|
|
45
|
-
box-shadow: var(--boxShadow300);
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
border-radius: var(--borderRadius200);
|
|
26
|
+
const DialogPositioner = exports.DialogPositioner = _styledComponents.default.div`
|
|
49
27
|
position: fixed;
|
|
50
|
-
|
|
28
|
+
inset: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
51
32
|
z-index: ${({
|
|
52
33
|
theme
|
|
53
34
|
}) => theme.zIndex.modal};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
`;
|
|
36
|
+
const StyledDialog = exports.StyledDialog = _styledComponents.default.div`
|
|
37
|
+
box-shadow: var(--boxShadow300);
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
position: relative;
|
|
41
|
+
border-radius: var(--borderRadius200);
|
|
42
|
+
|
|
57
43
|
${({
|
|
58
|
-
|
|
59
|
-
}) =>
|
|
44
|
+
size
|
|
45
|
+
}) => size === "maximise" ? (0, _styledComponents.css)`
|
|
46
|
+
height: calc(100% - var(--spacing400));
|
|
47
|
+
width: calc(100% - var(--spacing400));
|
|
48
|
+
|
|
49
|
+
@media screen and (min-width: 960px) {
|
|
50
|
+
height: calc(100% - var(--spacing800));
|
|
51
|
+
width: calc(100% - var(--spacing800));
|
|
52
|
+
}
|
|
53
|
+
` : (0, _styledComponents.css)`
|
|
54
|
+
max-height: 90vh;
|
|
55
|
+
max-width: ${dialogSizes[size]};
|
|
56
|
+
width: 100%;
|
|
57
|
+
`};
|
|
60
58
|
|
|
61
59
|
&:focus {
|
|
62
60
|
outline: none;
|
|
@@ -68,46 +66,12 @@ const StyledDialog = exports.StyledDialog = _styledComponents.default.div.attrs(
|
|
|
68
66
|
background-color: ${backgroundColor};
|
|
69
67
|
`}
|
|
70
68
|
|
|
71
|
-
${({
|
|
72
|
-
size,
|
|
73
|
-
topMargin
|
|
74
|
-
}) => size && (0, _styledComponents.css)`
|
|
75
|
-
max-width: ${size === "maximise" ? `calc(100vw - ${topMargin}px)` : dialogSizes[size]};
|
|
76
|
-
width: 100%;
|
|
77
|
-
`}
|
|
78
|
-
|
|
79
69
|
${({
|
|
80
70
|
dialogHeight
|
|
81
71
|
}) => dialogHeight && (0, _styledComponents.css)`
|
|
82
72
|
height: ${dialogHeight}px;
|
|
83
73
|
`}
|
|
84
|
-
|
|
85
|
-
/* We're overriding the max-height on the form content to account for a larger height when in a smaller viewport.
|
|
86
|
-
TODO: Remove this upon the completion of FE-6643. */
|
|
87
|
-
${_form.StyledForm} {
|
|
88
|
-
${({
|
|
89
|
-
isDialogMaximised,
|
|
90
|
-
isDialogMaximisedSmallViewport
|
|
91
|
-
}) => isDialogMaximised && (0, _styledComponents.css)`
|
|
92
|
-
${isDialogMaximisedSmallViewport && "max-height: calc(100vh - 184px);"}
|
|
93
|
-
height: 100%;
|
|
94
|
-
`}
|
|
95
|
-
|
|
96
|
-
padding-bottom: 0px;
|
|
97
|
-
box-sizing: border-box;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
${_form.StyledFormContent}.sticky {
|
|
101
|
-
${props => (0, _formStyleUtils.calculateFormSpacingValues)(props, true)}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
${_form.StyledFormFooter}.sticky {
|
|
105
|
-
${_formStyleUtils.calculateWidthValue}
|
|
106
|
-
${props => (0, _formStyleUtils.calculateFormSpacingValues)(props, false)}
|
|
107
|
-
border-bottom-right-radius: var(--borderRadius200);
|
|
108
|
-
border-bottom-left-radius: var(--borderRadius200);
|
|
109
|
-
}
|
|
110
|
-
|
|
74
|
+
|
|
111
75
|
> ${_iconButton.default} {
|
|
112
76
|
margin: 0;
|
|
113
77
|
position: absolute;
|
|
@@ -122,7 +86,7 @@ const StyledDialog = exports.StyledDialog = _styledComponents.default.div.attrs(
|
|
|
122
86
|
`;
|
|
123
87
|
const StyledDialogTitle = exports.StyledDialogTitle = _styledComponents.default.div`
|
|
124
88
|
background-color: var(--colorsUtilityYang100);
|
|
125
|
-
padding: 23px
|
|
89
|
+
padding: 23px 32px 0;
|
|
126
90
|
border-bottom: 1px solid #ccd6db;
|
|
127
91
|
border-top-right-radius: var(--borderRadius200);
|
|
128
92
|
border-top-left-radius: var(--borderRadius200);
|
|
@@ -150,26 +114,33 @@ const StyledDialogTitle = exports.StyledDialogTitle = _styledComponents.default.
|
|
|
150
114
|
`;
|
|
151
115
|
const StyledDialogContent = exports.StyledDialogContent = _styledComponents.default.div`
|
|
152
116
|
box-sizing: border-box;
|
|
153
|
-
display:
|
|
154
|
-
flex-direction: column;
|
|
117
|
+
display: block;
|
|
155
118
|
overflow-y: auto;
|
|
156
|
-
|
|
157
|
-
/* Delegate handling overflow to child form if it has a sticky footer */
|
|
158
|
-
&:has(${_form.StyledFormContent}.sticky) {
|
|
159
|
-
overflow-y: inherit;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
119
|
width: 100%;
|
|
163
|
-
flex: 1;
|
|
164
|
-
|
|
120
|
+
flex-grow: 1;
|
|
121
|
+
|
|
122
|
+
padding: 24px 32px 30px;
|
|
165
123
|
${_styledSystem.padding}
|
|
124
|
+
|
|
125
|
+
&:has(${_form.StyledForm}.sticky) {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
padding: 0;
|
|
129
|
+
|
|
130
|
+
${_form.StyledForm}.sticky {
|
|
131
|
+
${_form.StyledFormContent} {
|
|
132
|
+
padding: 24px 32px 30px;
|
|
133
|
+
${_styledSystem.padding}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
${_form.StyledFormFooter} {
|
|
137
|
+
border-bottom-right-radius: var(--borderRadius200);
|
|
138
|
+
border-bottom-left-radius: var(--borderRadius200);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
166
142
|
`;
|
|
167
|
-
|
|
168
|
-
position: relative;
|
|
169
|
-
flex: 1;
|
|
170
|
-
padding-top: ${calculatePaddingTopInnerContent};
|
|
171
|
-
`;
|
|
172
|
-
StyledDialog.defaultProps = {
|
|
143
|
+
DialogPositioner.defaultProps = {
|
|
173
144
|
theme: _base.default
|
|
174
145
|
};
|
|
175
146
|
StyledDialogContent.defaultProps = {
|