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
|
@@ -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 {};
|
|
@@ -13,18 +13,14 @@ var _textarea = _interopRequireDefault(require("../textarea/textarea.style"));
|
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
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); }
|
|
15
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; }
|
|
16
|
-
const StyledFormContent = exports.StyledFormContent = _styledComponents.default.div
|
|
17
|
-
${({
|
|
16
|
+
const StyledFormContent = exports.StyledFormContent = _styledComponents.default.div(({
|
|
18
17
|
stickyFooter,
|
|
19
18
|
isInModal
|
|
20
|
-
}) => (0, _styledComponents.css)`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
overflow-y:
|
|
24
|
-
|
|
25
|
-
`}
|
|
26
|
-
`}
|
|
27
|
-
`;
|
|
19
|
+
}) => stickyFooter && isInModal && (0, _styledComponents.css)`
|
|
20
|
+
flex-grow: 1;
|
|
21
|
+
min-height: 0;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
`);
|
|
28
24
|
const StyledFormFooter = exports.StyledFormFooter = _styledComponents.default.div`
|
|
29
25
|
align-items: center;
|
|
30
26
|
display: flex;
|
|
@@ -39,8 +35,7 @@ const StyledFormFooter = exports.StyledFormFooter = _styledComponents.default.di
|
|
|
39
35
|
|
|
40
36
|
${({
|
|
41
37
|
stickyFooter,
|
|
42
|
-
fullWidthButtons
|
|
43
|
-
isInModal
|
|
38
|
+
fullWidthButtons
|
|
44
39
|
}) => (0, _styledComponents.css)`
|
|
45
40
|
${!stickyFooter && (0, _styledComponents.css)`
|
|
46
41
|
margin-top: 48px;
|
|
@@ -53,9 +48,7 @@ const StyledFormFooter = exports.StyledFormFooter = _styledComponents.default.di
|
|
|
53
48
|
padding: 16px 32px;
|
|
54
49
|
width: 100%;
|
|
55
50
|
z-index: 1000;
|
|
56
|
-
|
|
57
|
-
position: sticky;
|
|
58
|
-
`}
|
|
51
|
+
position: sticky;
|
|
59
52
|
bottom: 0;
|
|
60
53
|
`}
|
|
61
54
|
|
|
@@ -70,9 +63,6 @@ const StyledFormFooter = exports.StyledFormFooter = _styledComponents.default.di
|
|
|
70
63
|
StyledFormFooter.defaultProps = {
|
|
71
64
|
theme: _base.default
|
|
72
65
|
};
|
|
73
|
-
|
|
74
|
-
// Accounts for height of the header of Modal parent, the height form footer and some additional spacing
|
|
75
|
-
const HEIGHT_SPACING = 216;
|
|
76
66
|
const StyledForm = exports.StyledForm = _styledComponents.default.form`
|
|
77
67
|
${_styledSystem.space}
|
|
78
68
|
|
|
@@ -89,19 +79,16 @@ const StyledForm = exports.StyledForm = _styledComponents.default.form`
|
|
|
89
79
|
|
|
90
80
|
${({
|
|
91
81
|
stickyFooter,
|
|
92
|
-
isInModal
|
|
93
|
-
isInSidebar
|
|
82
|
+
isInModal
|
|
94
83
|
}) => stickyFooter && (0, _styledComponents.css)`
|
|
95
84
|
display: flex;
|
|
96
85
|
flex-direction: column;
|
|
97
86
|
position: relative;
|
|
98
87
|
|
|
99
88
|
${isInModal && (0, _styledComponents.css)`
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
${isInSidebar && (0, _styledComponents.css)`
|
|
104
|
-
min-height: 100%;
|
|
89
|
+
flex-grow: 1;
|
|
90
|
+
min-height: 0;
|
|
91
|
+
height: 100%;
|
|
105
92
|
`}
|
|
106
93
|
`}
|
|
107
94
|
`;
|
|
@@ -7,12 +7,11 @@ exports.default = exports.Sidebar = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _modal = _interopRequireDefault(require("../modal"));
|
|
10
|
-
var _sidebar =
|
|
10
|
+
var _sidebar = require("./sidebar.style");
|
|
11
11
|
var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
12
12
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
13
13
|
var _focusTrap = _interopRequireDefault(require("../../__internal__/focus-trap"));
|
|
14
14
|
var _sidebarHeader = _interopRequireDefault(require("./__internal__/sidebar-header"));
|
|
15
|
-
var _box = _interopRequireDefault(require("../box"));
|
|
16
15
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
17
16
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
18
17
|
var _utils = require("../../style/utils");
|
|
@@ -53,7 +52,6 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
53
52
|
const {
|
|
54
53
|
current: headerId
|
|
55
54
|
} = (0, _react.useRef)((0, _guid.default)());
|
|
56
|
-
const hasStickyFooter = (0, _react.useMemo)(() => _react.default.Children.toArray(children).some(child => /*#__PURE__*/_react.default.isValidElement(child) && child.props.stickyFooter), [children]);
|
|
57
55
|
const sidebarRef = (0, _react.useRef)(null);
|
|
58
56
|
const setRefs = (0, _react.useCallback)(reference => {
|
|
59
57
|
sidebarRef.current = reference;
|
|
@@ -72,7 +70,7 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
72
70
|
type: "close"
|
|
73
71
|
}));
|
|
74
72
|
};
|
|
75
|
-
const sidebar = /*#__PURE__*/_react.default.createElement(_sidebar.
|
|
73
|
+
const sidebar = /*#__PURE__*/_react.default.createElement(_sidebar.StyledSidebar, {
|
|
76
74
|
"aria-modal": !enableBackgroundUI && isTopModal,
|
|
77
75
|
"aria-describedby": ariaDescribedBy,
|
|
78
76
|
"aria-label": ariaLabel,
|
|
@@ -84,24 +82,16 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
84
82
|
position: position,
|
|
85
83
|
size: size,
|
|
86
84
|
onCancel: onCancel,
|
|
87
|
-
role: role
|
|
88
|
-
}, (0, _utils.filterStyledSystemPaddingProps)(rest), {
|
|
85
|
+
role: role,
|
|
89
86
|
width: width
|
|
90
|
-
}
|
|
87
|
+
}, header && /*#__PURE__*/_react.default.createElement(_sidebarHeader.default, _extends({
|
|
91
88
|
closeIcon: closeIcon()
|
|
92
89
|
}, headerPadding, {
|
|
93
90
|
id: headerId
|
|
94
|
-
}), header), !header && closeIcon(), /*#__PURE__*/_react.default.createElement(
|
|
91
|
+
}), header), !header && closeIcon(), /*#__PURE__*/_react.default.createElement(_sidebar.StyledSidebarContent, _extends({
|
|
95
92
|
"data-element": "sidebar-content",
|
|
96
|
-
"data-role": "sidebar-content"
|
|
97
|
-
|
|
98
|
-
pb: "var(--spacing400)",
|
|
99
|
-
px: "var(--spacing400)"
|
|
100
|
-
}, (0, _utils.filterStyledSystemPaddingProps)(rest), {
|
|
101
|
-
scrollVariant: "light",
|
|
102
|
-
overflow: hasStickyFooter ? undefined : "auto",
|
|
103
|
-
flex: "1"
|
|
104
|
-
}), /*#__PURE__*/_react.default.createElement(_sidebar2.default.Provider, {
|
|
93
|
+
"data-role": "sidebar-content"
|
|
94
|
+
}, (0, _utils.filterStyledSystemPaddingProps)(rest)), /*#__PURE__*/_react.default.createElement(_sidebar2.default.Provider, {
|
|
105
95
|
value: {
|
|
106
96
|
isInSidebar: true
|
|
107
97
|
}
|
|
@@ -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)";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.SIDEBAR_SIZES_CSS = exports.SIDEBAR_SIZES = exports.SIDEBAR_ALIGNMENTS = void 0;
|
|
7
7
|
const SIDEBAR_SIZES_CSS = exports.SIDEBAR_SIZES_CSS = {
|
|
8
8
|
"extra-small": "214px",
|
|
9
9
|
small: "314px",
|
|
@@ -14,8 +14,4 @@ const SIDEBAR_SIZES_CSS = exports.SIDEBAR_SIZES_CSS = {
|
|
|
14
14
|
"extra-large": "814px"
|
|
15
15
|
};
|
|
16
16
|
const SIDEBAR_SIZES = exports.SIDEBAR_SIZES = ["extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large"];
|
|
17
|
-
const SIDEBAR_ALIGNMENTS = exports.SIDEBAR_ALIGNMENTS = ["left", "right"];
|
|
18
|
-
const SIDEBAR_TOP_SPACING = exports.SIDEBAR_TOP_SPACING = "27px";
|
|
19
|
-
const SIDEBAR_BOTTOM_SPACING = exports.SIDEBAR_BOTTOM_SPACING = "var(--spacing400)";
|
|
20
|
-
const SIDEBAR_LEFT_PADDING = exports.SIDEBAR_LEFT_PADDING = "var(--spacing400)";
|
|
21
|
-
const SIDEBAR_RIGHT_PADDING = exports.SIDEBAR_RIGHT_PADDING = "var(--spacing400)";
|
|
17
|
+
const SIDEBAR_ALIGNMENTS = exports.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 };
|