carbon-react 144.0.0 → 144.1.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/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/esm/components/typography/typography.style.js +12 -8
- 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/lib/components/typography/typography.style.js +12 -8
- 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 };
|
|
@@ -55,23 +55,27 @@ const getLineHeight = variant => {
|
|
|
55
55
|
case "h1-large":
|
|
56
56
|
return "40px";
|
|
57
57
|
case "h1":
|
|
58
|
-
|
|
59
|
-
return "31px";
|
|
58
|
+
return "30px";
|
|
60
59
|
case "h2":
|
|
61
|
-
return "
|
|
60
|
+
return "27.5px";
|
|
62
61
|
case "h3":
|
|
62
|
+
return "25px";
|
|
63
|
+
case "h4":
|
|
64
|
+
return "22.5px";
|
|
65
|
+
case "h5":
|
|
66
|
+
return "20px";
|
|
63
67
|
case "segment-header":
|
|
64
|
-
return "
|
|
68
|
+
return "25px";
|
|
69
|
+
case "segment-header-small":
|
|
70
|
+
return "22.5px";
|
|
71
|
+
case "segment-subheader":
|
|
72
|
+
return "24px";
|
|
65
73
|
case "big":
|
|
66
74
|
return "24px";
|
|
67
|
-
case "h4":
|
|
68
|
-
case "segment-header-small":
|
|
69
|
-
return "23px";
|
|
70
75
|
case "small":
|
|
71
76
|
case "sub":
|
|
72
77
|
case "sup":
|
|
73
78
|
return "20px";
|
|
74
|
-
case "h5":
|
|
75
79
|
case "segment-subheader-alt":
|
|
76
80
|
case "p":
|
|
77
81
|
case "span":
|
|
@@ -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, };
|