carbon-react 143.2.5 → 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/menu/__internal__/submenu/submenu.style.js +8 -5
- package/esm/components/menu/menu-item/menu-item.component.d.ts +1 -1
- package/esm/components/menu/menu-item/menu-item.component.js +3 -1
- package/esm/components/menu/menu-item/menu-item.style.d.ts +1 -0
- package/esm/components/menu/menu-item/menu-item.style.js +58 -24
- package/esm/components/menu/menu.component.d.ts +1 -1
- package/esm/components/menu/menu.style.js +13 -0
- 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/menu/__internal__/submenu/submenu.style.js +8 -5
- package/lib/components/menu/menu-item/menu-item.component.d.ts +1 -1
- package/lib/components/menu/menu-item/menu-item.component.js +3 -1
- package/lib/components/menu/menu-item/menu-item.style.d.ts +1 -0
- package/lib/components/menu/menu-item/menu-item.style.js +58 -24
- package/lib/components/menu/menu.component.d.ts +1 -1
- package/lib/components/menu/menu.style.js +13 -0
- 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
|
@@ -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 = {
|
|
@@ -8,88 +8,46 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
8
8
|
var _form = require("../form/form.style");
|
|
9
9
|
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); }
|
|
10
10
|
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; }
|
|
11
|
+
function computePadding() {
|
|
12
|
+
return (0, _styledComponents.css)`
|
|
13
|
+
padding: 0 16px;
|
|
14
|
+
@media screen and (min-width: 600px) {
|
|
15
|
+
padding: 0 24px;
|
|
16
|
+
}
|
|
17
|
+
@media screen and (min-width: 960px) {
|
|
18
|
+
padding: 0 32px;
|
|
19
|
+
}
|
|
20
|
+
@media screen and (min-width: 1260px) {
|
|
21
|
+
padding: 0 40px;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
11
25
|
const StyledContent = _styledComponents.default.div`
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
display: block;
|
|
12
28
|
overflow-y: auto;
|
|
13
|
-
padding: 0 16px;
|
|
14
|
-
flex: 1;
|
|
15
29
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
overflow-y: inherit;
|
|
19
|
-
}
|
|
30
|
+
flex: 1;
|
|
31
|
+
width: 100%;
|
|
20
32
|
|
|
21
33
|
${({
|
|
22
34
|
disableContentPadding
|
|
23
|
-
}) =>
|
|
24
|
-
${!disableContentPadding && (0, _styledComponents.css)`
|
|
25
|
-
@media screen and (min-width: 600px) {
|
|
26
|
-
padding: 0 24px;
|
|
27
|
-
}
|
|
28
|
-
@media screen and (min-width: 960px) {
|
|
29
|
-
padding: 0 32px;
|
|
30
|
-
}
|
|
31
|
-
@media screen and (min-width: 1260px) {
|
|
32
|
-
padding: 0 40px;
|
|
33
|
-
}
|
|
35
|
+
}) => disableContentPadding ? "padding: 0" : computePadding()}
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@media screen and (min-width: 600px) {
|
|
42
|
-
padding-right: 24px;
|
|
43
|
-
padding-left: 24px;
|
|
44
|
-
margin-right: -24px;
|
|
45
|
-
margin-left: -24px;
|
|
46
|
-
}
|
|
47
|
-
@media screen and (min-width: 960px) {
|
|
48
|
-
padding-right: 32px;
|
|
49
|
-
padding-left: 32px;
|
|
50
|
-
margin-right: -32px;
|
|
51
|
-
margin-left: -32px;
|
|
52
|
-
}
|
|
53
|
-
@media screen and (min-width: 1260px) {
|
|
54
|
-
padding-right: 40px;
|
|
55
|
-
padding-left: 40px;
|
|
56
|
-
margin-right: -40px;
|
|
57
|
-
margin-left: -40px;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
37
|
+
&:has(${_form.StyledForm}.sticky) {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
overflow-y: hidden;
|
|
41
|
+
padding: 0;
|
|
60
42
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
width: calc(100% + 32px);
|
|
67
|
-
|
|
68
|
-
@media screen and (min-width: 600px) {
|
|
69
|
-
padding: 16px 24px;
|
|
70
|
-
margin-right: -24px;
|
|
71
|
-
margin-left: -24px;
|
|
72
|
-
width: calc(100% + 48px);
|
|
73
|
-
}
|
|
74
|
-
@media screen and (min-width: 960px) {
|
|
75
|
-
padding: 16px 32px;
|
|
76
|
-
margin-right: -32px;
|
|
77
|
-
margin-left: -32px;
|
|
78
|
-
width: calc(100% + 64px);
|
|
79
|
-
}
|
|
80
|
-
@media screen and (min-width: 1260px) {
|
|
81
|
-
padding: 16px 40px;
|
|
82
|
-
margin-right: -40px;
|
|
83
|
-
margin-left: -40px;
|
|
84
|
-
width: calc(100% + 80px);
|
|
85
|
-
}
|
|
43
|
+
${_form.StyledForm}.sticky {
|
|
44
|
+
${_form.StyledFormContent} {
|
|
45
|
+
${({
|
|
46
|
+
disableContentPadding
|
|
47
|
+
}) => disableContentPadding ? "padding: 0" : computePadding()}
|
|
86
48
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
${disableContentPadding && (0, _styledComponents.css)`
|
|
90
|
-
padding: 0;
|
|
91
|
-
`}
|
|
92
|
-
`}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
93
51
|
|
|
94
52
|
${({
|
|
95
53
|
hasHeader
|
|
@@ -10,7 +10,6 @@ var _content = _interopRequireDefault(require("./content.style"));
|
|
|
10
10
|
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
11
11
|
var _fullScreenHeading = _interopRequireDefault(require("../../__internal__/full-screen-heading/full-screen-heading.style"));
|
|
12
12
|
var _heading = require("../heading/heading.style");
|
|
13
|
-
var _form = require("../form/form.style");
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
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); }
|
|
16
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; }
|
|
@@ -31,10 +30,6 @@ const StyledDialogFullScreen = _styledComponents.default.div`
|
|
|
31
30
|
display: flex;
|
|
32
31
|
flex-direction: column;
|
|
33
32
|
|
|
34
|
-
${_form.StyledForm} {
|
|
35
|
-
min-height: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
${_heading.StyledHeaderContent} {
|
|
39
34
|
align-items: baseline;
|
|
40
35
|
}
|
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Form = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _sidebar = _interopRequireDefault(require("../sidebar/__internal__/sidebar.context"));
|
|
10
|
-
var _modal = _interopRequireDefault(require("../modal/__internal__/modal.context"));
|
|
11
9
|
var _formSummary = _interopRequireDefault(require("./__internal__/form-summary.component"));
|
|
12
10
|
var _form = require("./form.style");
|
|
13
11
|
var _form2 = require("./form.config");
|
|
14
12
|
var _formSpacingProvider = _interopRequireDefault(require("../../__internal__/form-spacing-provider"));
|
|
13
|
+
var _modal = _interopRequireDefault(require("../modal/__internal__/modal.context"));
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
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
16
|
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; }
|
|
@@ -33,45 +32,37 @@ const Form = ({
|
|
|
33
32
|
footerPadding = {},
|
|
34
33
|
...rest
|
|
35
34
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
} = (0, _react.useContext)(_sidebar.default);
|
|
35
|
+
const formRef = (0, _react.useRef)(null);
|
|
36
|
+
const formFooterRef = (0, _react.useRef)(null);
|
|
39
37
|
const {
|
|
40
38
|
isInModal
|
|
41
39
|
} = (0, _react.useContext)(_modal.default);
|
|
42
|
-
const formRef = (0, _react.useRef)(null);
|
|
43
|
-
const formFooterRef = (0, _react.useRef)(null);
|
|
44
|
-
const hasPadding = !!Object.keys(footerPadding).length;
|
|
45
40
|
const renderFooter = !!(saveButton || leftSideButtons || rightSideButtons || errorCount || warningCount);
|
|
46
|
-
const classNames = `${stickyFooter ? "sticky" : ""} ${hasPadding ? "padded" : ""}`.trimEnd();
|
|
47
41
|
return /*#__PURE__*/_react.default.createElement(_form.StyledForm, _extends({
|
|
48
42
|
ref: formRef,
|
|
43
|
+
className: stickyFooter ? "sticky" : "",
|
|
49
44
|
stickyFooter: stickyFooter,
|
|
50
45
|
onSubmit: onSubmit,
|
|
51
46
|
"data-component": "form",
|
|
52
47
|
fieldSpacing: fieldSpacing,
|
|
53
48
|
noValidate: noValidate,
|
|
54
|
-
isInSidebar: isInSidebar,
|
|
55
49
|
height: height,
|
|
56
50
|
isInModal: isInModal
|
|
57
51
|
}, rest), /*#__PURE__*/_react.default.createElement(_form.StyledFormContent, {
|
|
58
52
|
"data-element": "form-content",
|
|
59
53
|
"data-role": "form-content",
|
|
60
|
-
className: stickyFooter ? "sticky" : "",
|
|
61
54
|
stickyFooter: stickyFooter,
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
isInModal: isInModal
|
|
64
57
|
}, /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
|
|
65
58
|
marginBottom: _form2.formSpacing[fieldSpacing]
|
|
66
59
|
}, children)), renderFooter && /*#__PURE__*/_react.default.createElement(_form.StyledFormFooter, _extends({
|
|
67
60
|
"data-element": "form-footer",
|
|
68
61
|
"data-role": "form-footer",
|
|
69
|
-
className: classNames,
|
|
70
62
|
ref: formFooterRef,
|
|
71
63
|
stickyFooter: stickyFooter,
|
|
72
64
|
buttonAlignment: buttonAlignment,
|
|
73
|
-
fullWidthButtons: fullWidthButtons
|
|
74
|
-
isInModal: isInModal
|
|
65
|
+
fullWidthButtons: fullWidthButtons
|
|
75
66
|
}, footerPadding), leftSideButtons && /*#__PURE__*/_react.default.createElement(_form.StyledLeftButtons, {
|
|
76
67
|
"data-role": "form-left-buttons",
|
|
77
68
|
buttonAlignment: buttonAlignment
|
|
@@ -4,17 +4,21 @@ interface StyledFormContentProps {
|
|
|
4
4
|
isInModal?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const StyledFormContent: import("styled-components").StyledComponent<"div", any, StyledFormContentProps, never>;
|
|
7
|
-
interface
|
|
8
|
-
|
|
7
|
+
interface StyledFormFooterProps {
|
|
8
|
+
stickyFooter?: boolean;
|
|
9
9
|
fullWidthButtons?: boolean;
|
|
10
|
+
buttonAlignment?: FormButtonAlignment;
|
|
10
11
|
}
|
|
11
|
-
export declare const StyledFormFooter: import("styled-components").StyledComponent<"div", any,
|
|
12
|
+
export declare const StyledFormFooter: import("styled-components").StyledComponent<"div", any, StyledFormFooterProps, never>;
|
|
12
13
|
interface StyledFormProps extends StyledFormContentProps {
|
|
13
14
|
height?: string;
|
|
14
15
|
fieldSpacing: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
15
|
-
isInSidebar?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export declare const StyledForm: import("styled-components").StyledComponent<"form", any, StyledFormProps, never>;
|
|
18
|
-
export declare const StyledRightButtons: import("styled-components").StyledComponent<"div", any,
|
|
19
|
-
|
|
18
|
+
export declare const StyledRightButtons: import("styled-components").StyledComponent<"div", any, {
|
|
19
|
+
buttonAlignment?: "left" | "right" | undefined;
|
|
20
|
+
}, never>;
|
|
21
|
+
export declare const StyledLeftButtons: import("styled-components").StyledComponent<"div", any, {
|
|
22
|
+
buttonAlignment?: "left" | "right" | undefined;
|
|
23
|
+
}, never>;
|
|
20
24
|
export {};
|