carbon-react 124.0.0 → 124.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/dialog/dialog.component.d.ts +2 -0
- package/esm/components/dialog/dialog.component.js +5 -1
- package/esm/components/dialog/dialog.style.d.ts +1 -0
- package/esm/components/dialog/dialog.style.js +6 -1
- package/lib/components/dialog/dialog.component.d.ts +2 -0
- package/lib/components/dialog/dialog.component.js +5 -1
- package/lib/components/dialog/dialog.style.d.ts +1 -0
- package/lib/components/dialog/dialog.style.js +6 -1
- package/package.json +1 -1
|
@@ -56,6 +56,8 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
56
56
|
role?: string;
|
|
57
57
|
/** Padding to be set on the Dialog content */
|
|
58
58
|
contentPadding?: ContentPaddingInterface;
|
|
59
|
+
/** Change the background color of the content to grey */
|
|
60
|
+
greyBackground?: boolean;
|
|
59
61
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
60
62
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
61
63
|
}
|
|
@@ -33,6 +33,7 @@ const Dialog = /*#__PURE__*/forwardRef(({
|
|
|
33
33
|
help,
|
|
34
34
|
role = "dialog",
|
|
35
35
|
contentPadding = {},
|
|
36
|
+
greyBackground = false,
|
|
36
37
|
focusableContainers,
|
|
37
38
|
topModalOverride,
|
|
38
39
|
...rest
|
|
@@ -175,7 +176,9 @@ const Dialog = /*#__PURE__*/forwardRef(({
|
|
|
175
176
|
"data-role": rest["data-role"],
|
|
176
177
|
role: role,
|
|
177
178
|
tabIndex: -1
|
|
178
|
-
}, contentPadding
|
|
179
|
+
}, contentPadding, {
|
|
180
|
+
backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
|
|
181
|
+
}), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledDialogContent, _extends({}, contentPadding, {
|
|
179
182
|
hasStickyFooter: hasStickyFooter
|
|
180
183
|
}), /*#__PURE__*/React.createElement(StyledDialogInnerContent, _extends({
|
|
181
184
|
ref: innerContentRef
|
|
@@ -227,6 +230,7 @@ Dialog.propTypes = {
|
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
})]),
|
|
233
|
+
"greyBackground": PropTypes.bool,
|
|
230
234
|
"height": PropTypes.string,
|
|
231
235
|
"help": PropTypes.string,
|
|
232
236
|
"onCancel": PropTypes.func,
|
|
@@ -4,6 +4,7 @@ declare type StyledDialogProps = {
|
|
|
4
4
|
topMargin: number;
|
|
5
5
|
size?: DialogSizes;
|
|
6
6
|
dialogHeight?: string;
|
|
7
|
+
backgroundColor: string;
|
|
7
8
|
};
|
|
8
9
|
declare const StyledDialog: import("styled-components").StyledComponent<"div", any, StyledDialogProps & ContentPaddingInterface, never>;
|
|
9
10
|
declare type StyledDialogTitleProps = {
|
|
@@ -21,7 +21,6 @@ const calculatePaddingTopInnerContent = ({
|
|
|
21
21
|
p
|
|
22
22
|
}) => [py, p].some(padding => padding !== undefined) ? 0 : `${CONTENT_TOP_PADDING}px`;
|
|
23
23
|
const StyledDialog = styled.div`
|
|
24
|
-
background-color: var(--colorsUtilityMajor025);
|
|
25
24
|
box-shadow: var(--boxShadow300);
|
|
26
25
|
display: flex;
|
|
27
26
|
flex-direction: column;
|
|
@@ -39,6 +38,12 @@ const StyledDialog = styled.div`
|
|
|
39
38
|
outline: none;
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
${({
|
|
42
|
+
backgroundColor
|
|
43
|
+
}) => css`
|
|
44
|
+
background-color: ${backgroundColor};
|
|
45
|
+
`}
|
|
46
|
+
|
|
42
47
|
${({
|
|
43
48
|
size
|
|
44
49
|
}) => size && css`
|
|
@@ -56,6 +56,8 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
56
56
|
role?: string;
|
|
57
57
|
/** Padding to be set on the Dialog content */
|
|
58
58
|
contentPadding?: ContentPaddingInterface;
|
|
59
|
+
/** Change the background color of the content to grey */
|
|
60
|
+
greyBackground?: boolean;
|
|
59
61
|
/** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
|
|
60
62
|
focusableContainers?: CustomRefObject<HTMLElement>[];
|
|
61
63
|
}
|
|
@@ -42,6 +42,7 @@ const Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
42
42
|
help,
|
|
43
43
|
role = "dialog",
|
|
44
44
|
contentPadding = {},
|
|
45
|
+
greyBackground = false,
|
|
45
46
|
focusableContainers,
|
|
46
47
|
topModalOverride,
|
|
47
48
|
...rest
|
|
@@ -184,7 +185,9 @@ const Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
184
185
|
"data-role": rest["data-role"],
|
|
185
186
|
role: role,
|
|
186
187
|
tabIndex: -1
|
|
187
|
-
}, contentPadding
|
|
188
|
+
}, contentPadding, {
|
|
189
|
+
backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
|
|
190
|
+
}), dialogTitle(), closeIcon(), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogContent, _extends({}, contentPadding, {
|
|
188
191
|
hasStickyFooter: hasStickyFooter
|
|
189
192
|
}), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogInnerContent, _extends({
|
|
190
193
|
ref: innerContentRef
|
|
@@ -237,6 +240,7 @@ Dialog.propTypes = {
|
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
})]),
|
|
243
|
+
"greyBackground": _propTypes.default.bool,
|
|
240
244
|
"height": _propTypes.default.string,
|
|
241
245
|
"help": _propTypes.default.string,
|
|
242
246
|
"onCancel": _propTypes.default.func,
|
|
@@ -4,6 +4,7 @@ declare type StyledDialogProps = {
|
|
|
4
4
|
topMargin: number;
|
|
5
5
|
size?: DialogSizes;
|
|
6
6
|
dialogHeight?: string;
|
|
7
|
+
backgroundColor: string;
|
|
7
8
|
};
|
|
8
9
|
declare const StyledDialog: import("styled-components").StyledComponent<"div", any, StyledDialogProps & ContentPaddingInterface, never>;
|
|
9
10
|
declare type StyledDialogTitleProps = {
|
|
@@ -30,7 +30,6 @@ const calculatePaddingTopInnerContent = ({
|
|
|
30
30
|
p
|
|
31
31
|
}) => [py, p].some(padding => padding !== undefined) ? 0 : `${_dialog.CONTENT_TOP_PADDING}px`;
|
|
32
32
|
const StyledDialog = _styledComponents.default.div`
|
|
33
|
-
background-color: var(--colorsUtilityMajor025);
|
|
34
33
|
box-shadow: var(--boxShadow300);
|
|
35
34
|
display: flex;
|
|
36
35
|
flex-direction: column;
|
|
@@ -48,6 +47,12 @@ const StyledDialog = _styledComponents.default.div`
|
|
|
48
47
|
outline: none;
|
|
49
48
|
}
|
|
50
49
|
|
|
50
|
+
${({
|
|
51
|
+
backgroundColor
|
|
52
|
+
}) => (0, _styledComponents.css)`
|
|
53
|
+
background-color: ${backgroundColor};
|
|
54
|
+
`}
|
|
55
|
+
|
|
51
56
|
${({
|
|
52
57
|
size
|
|
53
58
|
}) => size && (0, _styledComponents.css)`
|