carbon-react 111.16.0 → 111.18.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/card/card.component.d.ts +3 -1
- package/esm/components/card/card.component.js +4 -1
- package/esm/components/card/card.style.d.ts +1 -0
- package/esm/components/card/card.style.js +6 -1
- package/esm/components/confirm/confirm.component.d.ts +37 -0
- package/esm/components/confirm/confirm.component.js +46 -113
- package/esm/components/confirm/confirm.config.d.ts +1 -0
- package/esm/components/confirm/confirm.style.d.ts +5 -0
- package/esm/components/confirm/confirm.style.js +1 -5
- package/esm/components/confirm/index.d.ts +2 -1
- package/esm/components/dialog-full-screen/content.style.d.ts +7 -0
- package/esm/components/dialog-full-screen/dialog-full-screen.component.d.ts +55 -0
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +45 -80
- package/esm/components/dialog-full-screen/dialog-full-screen.style.d.ts +4 -0
- package/esm/components/dialog-full-screen/index.d.ts +2 -1
- package/esm/components/modal/modal.component.d.ts +2 -1
- package/esm/components/modal/modal.component.js +3 -0
- package/esm/components/tile/tile-footer/tile-footer.component.js +3 -5
- package/esm/components/tile/tile-footer/tile-footer.d.ts +1 -1
- package/esm/components/tile/tile-footer/tile-footer.style.js +15 -1
- package/esm/components/tile/tile.component.js +10 -3
- package/esm/components/tile/tile.d.ts +15 -0
- package/esm/components/tile/tile.style.js +30 -3
- package/esm/style/design-tokens/debug-theme.util.d.ts +15 -1
- package/esm/style/themes/sage/index.d.ts +15 -1
- package/lib/components/card/card.component.d.ts +3 -1
- package/lib/components/card/card.component.js +4 -1
- package/lib/components/card/card.style.d.ts +1 -0
- package/lib/components/card/card.style.js +6 -1
- package/lib/components/confirm/confirm.component.d.ts +37 -0
- package/lib/components/confirm/confirm.component.js +47 -114
- package/lib/components/confirm/confirm.config.d.ts +1 -0
- package/lib/components/confirm/confirm.style.d.ts +5 -0
- package/lib/components/confirm/confirm.style.js +1 -6
- package/lib/components/confirm/index.d.ts +2 -1
- package/lib/components/dialog-full-screen/content.style.d.ts +7 -0
- package/lib/components/dialog-full-screen/dialog-full-screen.component.d.ts +55 -0
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +46 -81
- package/lib/components/dialog-full-screen/dialog-full-screen.style.d.ts +4 -0
- package/lib/components/dialog-full-screen/index.d.ts +2 -1
- package/lib/components/modal/modal.component.d.ts +2 -1
- package/lib/components/modal/modal.component.js +3 -0
- package/lib/components/tile/tile-footer/tile-footer.component.js +4 -3
- package/lib/components/tile/tile-footer/tile-footer.d.ts +1 -1
- package/lib/components/tile/tile-footer/tile-footer.style.js +14 -1
- package/lib/components/tile/tile.component.js +12 -2
- package/lib/components/tile/tile.d.ts +15 -0
- package/lib/components/tile/tile.style.js +29 -3
- package/lib/style/design-tokens/debug-theme.util.d.ts +15 -1
- package/lib/style/themes/sage/index.d.ts +15 -1
- package/package.json +3 -3
- package/esm/components/confirm/confirm.d.ts +0 -50
- package/esm/components/dialog-full-screen/dialog-full-screen.d.ts +0 -52
- package/lib/components/confirm/confirm.d.ts +0 -50
- package/lib/components/dialog-full-screen/dialog-full-screen.d.ts +0 -52
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { padding } from "styled-system";
|
|
3
3
|
import { baseTheme } from "../../../style/themes";
|
|
4
|
+
|
|
5
|
+
const getBackgroundColor = variant => {
|
|
6
|
+
switch (variant) {
|
|
7
|
+
case "transparent":
|
|
8
|
+
return "transparent";
|
|
9
|
+
|
|
10
|
+
case "black":
|
|
11
|
+
return "var(--colorsUtilityYin100)";
|
|
12
|
+
|
|
13
|
+
default:
|
|
14
|
+
return "var(--colorsUtilityMajor100)";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
const StyledTileFooter = styled.div`
|
|
5
19
|
${padding}
|
|
6
20
|
|
|
7
21
|
${({
|
|
8
22
|
variant
|
|
9
23
|
}) => css`
|
|
10
|
-
background: ${variant
|
|
24
|
+
background: ${getBackgroundColor(variant)};
|
|
11
25
|
border-top: 1px solid var(--colorsUtilityMajor100);
|
|
12
26
|
`}
|
|
13
27
|
`;
|
|
@@ -4,8 +4,7 @@ import React from "react";
|
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import propTypes from "@styled-system/prop-types";
|
|
6
6
|
import { StyledTile, TileContent } from "./tile.style.js";
|
|
7
|
-
|
|
8
|
-
const Tile = ({
|
|
7
|
+
export const Tile = ({
|
|
9
8
|
variant = "tile",
|
|
10
9
|
p = 3,
|
|
11
10
|
children,
|
|
@@ -48,6 +47,8 @@ const Tile = ({
|
|
|
48
47
|
p: p
|
|
49
48
|
}, props), wrappedChildren);
|
|
50
49
|
};
|
|
50
|
+
/** TODO: When we convert this to typescript, dynamically pull the border tokens for borderWidth
|
|
51
|
+
* See how the Box component does this with boxShadows for an example */
|
|
51
52
|
|
|
52
53
|
Tile.propTypes = {
|
|
53
54
|
/** Styled system spacing props */
|
|
@@ -72,6 +73,12 @@ Tile.propTypes = {
|
|
|
72
73
|
* Set a percentage-based width for the whole Tile component, relative to its parent.
|
|
73
74
|
* If unset or zero, this will default to 100%.
|
|
74
75
|
*/
|
|
75
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
76
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
77
|
+
|
|
78
|
+
/** Sets the border width by using these design tokens */
|
|
79
|
+
borderWidth: PropTypes.oneOf(["borderWidth000", "borderWidth100", "borderWidth200", "borderWidth300", "borderWidth400"]),
|
|
80
|
+
|
|
81
|
+
/** Sets the border variant that should be used */
|
|
82
|
+
borderVariant: PropTypes.oneOf(["default", "selected", "positive", "negative", "caution", "info"])
|
|
76
83
|
};
|
|
77
84
|
export default Tile;
|
|
@@ -24,6 +24,21 @@ export interface TileProps extends SpaceProps {
|
|
|
24
24
|
* If unset or zero, this will default to 100%.
|
|
25
25
|
*/
|
|
26
26
|
width?: string | number;
|
|
27
|
+
/** Sets the border width by using these design tokens */
|
|
28
|
+
borderWidth?:
|
|
29
|
+
| "borderWidth000"
|
|
30
|
+
| "borderWidth100"
|
|
31
|
+
| "borderWidth200"
|
|
32
|
+
| "borderWidth300"
|
|
33
|
+
| "borderWidth400";
|
|
34
|
+
/** Sets the border variant that should be used */
|
|
35
|
+
borderVariant?:
|
|
36
|
+
| "default"
|
|
37
|
+
| "selected"
|
|
38
|
+
| "positive"
|
|
39
|
+
| "negative"
|
|
40
|
+
| "caution"
|
|
41
|
+
| "info";
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
declare function Tile(props: TileProps): JSX.Element;
|
|
@@ -3,6 +3,29 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { space } from "styled-system";
|
|
4
4
|
import baseTheme from "../../style/themes/base";
|
|
5
5
|
import computeWidth from "../../style/utils/width";
|
|
6
|
+
|
|
7
|
+
const getBorderColor = borderVariant => {
|
|
8
|
+
switch (borderVariant) {
|
|
9
|
+
case "selected":
|
|
10
|
+
return "var(--colorsUtilityYin100)";
|
|
11
|
+
|
|
12
|
+
case "positive":
|
|
13
|
+
return "var(--colorsSemanticPositive500)";
|
|
14
|
+
|
|
15
|
+
case "negative":
|
|
16
|
+
return "var(--colorsSemanticNegative500)";
|
|
17
|
+
|
|
18
|
+
case "caution":
|
|
19
|
+
return "var(--colorsSemanticCaution500)";
|
|
20
|
+
|
|
21
|
+
case "info":
|
|
22
|
+
return "var(--colorsSemanticInfo500)";
|
|
23
|
+
|
|
24
|
+
default:
|
|
25
|
+
return "var(--colorsUtilityMajor100)";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
6
29
|
const TileContent = styled.div`
|
|
7
30
|
${({
|
|
8
31
|
isHorizontal,
|
|
@@ -59,12 +82,14 @@ const StyledTile = styled.div`
|
|
|
59
82
|
${({
|
|
60
83
|
isHorizontal,
|
|
61
84
|
tileTheme,
|
|
62
|
-
width
|
|
85
|
+
width,
|
|
86
|
+
borderWidth = "borderWidth100",
|
|
87
|
+
borderVariant
|
|
63
88
|
}) => css`
|
|
64
89
|
${space}
|
|
65
90
|
|
|
66
91
|
box-sizing: border-box;
|
|
67
|
-
border:
|
|
92
|
+
border: var(--${borderWidth}) solid ${getBorderColor(borderVariant)};
|
|
68
93
|
|
|
69
94
|
${tileTheme === "tile" && css`
|
|
70
95
|
background-color: var(--colorsUtilityYang100);
|
|
@@ -99,7 +124,9 @@ StyledTile.propTypes = {
|
|
|
99
124
|
orientation: PropTypes.string,
|
|
100
125
|
padding: PropTypes.string,
|
|
101
126
|
tileTheme: PropTypes.string,
|
|
102
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
127
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
128
|
+
borderWidth: PropTypes.string,
|
|
129
|
+
borderVariant: PropTypes.string
|
|
103
130
|
};
|
|
104
131
|
StyledTile.defaultProps = {
|
|
105
132
|
theme: baseTheme
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
colorsUtilityMajor050: string;
|
|
17
17
|
colorsUtilityMajor075: string;
|
|
18
18
|
colorsUtilityMajorTransparent: string;
|
|
19
|
+
colorsUtilityYin100: string;
|
|
19
20
|
colorsUtilityYin030: string;
|
|
20
21
|
colorsUtilityYin055: string;
|
|
21
22
|
colorsUtilityYin065: string;
|
|
@@ -117,6 +118,7 @@ declare const _default: {
|
|
|
117
118
|
colorsSemanticInfoYang100: string;
|
|
118
119
|
colorsLogo: string;
|
|
119
120
|
colorsTransparent: string;
|
|
121
|
+
colorsYin100: string;
|
|
120
122
|
colorsYin030: string;
|
|
121
123
|
colorsYin055: string;
|
|
122
124
|
colorsYin065: string;
|
|
@@ -301,13 +303,25 @@ declare const _default: {
|
|
|
301
303
|
fontFamiliesIos: string;
|
|
302
304
|
fontFamiliesAndroid: string;
|
|
303
305
|
fontFamiliesOther: string;
|
|
306
|
+
borderRadius100: string;
|
|
307
|
+
borderRadius200: string;
|
|
308
|
+
borderRadius300: string;
|
|
309
|
+
borderRadius400: string;
|
|
304
310
|
borderRadiusCircle: string;
|
|
311
|
+
borderRadius025: string;
|
|
312
|
+
borderRadius050: string;
|
|
313
|
+
borderRadius000: string;
|
|
305
314
|
typographyAccordionTitleM: string;
|
|
315
|
+
typographyAccordionTitleS: string;
|
|
306
316
|
typographyAccordionSubtitleM: string;
|
|
317
|
+
typographyAccordionSubtitleS: string;
|
|
307
318
|
typographyAccordionParagraphM: string;
|
|
319
|
+
typographyAccordionParagraphS: string;
|
|
308
320
|
typographyActionPopoverMenuItemM: string;
|
|
309
321
|
typographyAnchorNavLabelM: string;
|
|
310
322
|
typographyBadgeLabelM: string;
|
|
323
|
+
typographyBreadcrumbSeparatorM: string;
|
|
324
|
+
typographyBreadcrumbCurrentPageM: string;
|
|
311
325
|
typographyButtonLabelS: string;
|
|
312
326
|
typographyButtonLabelM: string;
|
|
313
327
|
typographyButtonLabelL: string;
|
|
@@ -327,7 +341,7 @@ declare const _default: {
|
|
|
327
341
|
typographyDialogTitleL: string;
|
|
328
342
|
typographyDialogTitleXl: string;
|
|
329
343
|
typographyDialogTitleXxl: string;
|
|
330
|
-
|
|
344
|
+
typographyDialogSubtitleM: string;
|
|
331
345
|
typographyDialogParagraphXs: string;
|
|
332
346
|
typographyDialogParagraphS: string;
|
|
333
347
|
typographyDialogParagraphMs: string;
|
|
@@ -16,6 +16,7 @@ declare var _default: {
|
|
|
16
16
|
colorsUtilityMajor050: string;
|
|
17
17
|
colorsUtilityMajor075: string;
|
|
18
18
|
colorsUtilityMajorTransparent: string;
|
|
19
|
+
colorsUtilityYin100: string;
|
|
19
20
|
colorsUtilityYin030: string;
|
|
20
21
|
colorsUtilityYin055: string;
|
|
21
22
|
colorsUtilityYin065: string;
|
|
@@ -117,6 +118,7 @@ declare var _default: {
|
|
|
117
118
|
colorsSemanticInfoYang100: string;
|
|
118
119
|
colorsLogo: string;
|
|
119
120
|
colorsTransparent: string;
|
|
121
|
+
colorsYin100: string;
|
|
120
122
|
colorsYin030: string;
|
|
121
123
|
colorsYin055: string;
|
|
122
124
|
colorsYin065: string;
|
|
@@ -301,13 +303,25 @@ declare var _default: {
|
|
|
301
303
|
fontFamiliesIos: string;
|
|
302
304
|
fontFamiliesAndroid: string;
|
|
303
305
|
fontFamiliesOther: string;
|
|
306
|
+
borderRadius100: string;
|
|
307
|
+
borderRadius200: string;
|
|
308
|
+
borderRadius300: string;
|
|
309
|
+
borderRadius400: string;
|
|
304
310
|
borderRadiusCircle: string;
|
|
311
|
+
borderRadius025: string;
|
|
312
|
+
borderRadius050: string;
|
|
313
|
+
borderRadius000: string;
|
|
305
314
|
typographyAccordionTitleM: string;
|
|
315
|
+
typographyAccordionTitleS: string;
|
|
306
316
|
typographyAccordionSubtitleM: string;
|
|
317
|
+
typographyAccordionSubtitleS: string;
|
|
307
318
|
typographyAccordionParagraphM: string;
|
|
319
|
+
typographyAccordionParagraphS: string;
|
|
308
320
|
typographyActionPopoverMenuItemM: string;
|
|
309
321
|
typographyAnchorNavLabelM: string;
|
|
310
322
|
typographyBadgeLabelM: string;
|
|
323
|
+
typographyBreadcrumbSeparatorM: string;
|
|
324
|
+
typographyBreadcrumbCurrentPageM: string;
|
|
311
325
|
typographyButtonLabelS: string;
|
|
312
326
|
typographyButtonLabelM: string;
|
|
313
327
|
typographyButtonLabelL: string;
|
|
@@ -327,7 +341,7 @@ declare var _default: {
|
|
|
327
341
|
typographyDialogTitleL: string;
|
|
328
342
|
typographyDialogTitleXl: string;
|
|
329
343
|
typographyDialogTitleXxl: string;
|
|
330
|
-
|
|
344
|
+
typographyDialogSubtitleM: string;
|
|
331
345
|
typographyDialogParagraphXs: string;
|
|
332
346
|
typographyDialogParagraphS: string;
|
|
333
347
|
typographyDialogParagraphMs: string;
|
|
@@ -22,6 +22,8 @@ export interface CardProps extends MarginProps {
|
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
/** Flag to indicate if card is draggable */
|
|
24
24
|
draggable?: boolean;
|
|
25
|
+
/** Height of the component (any valid CSS value) */
|
|
26
|
+
height?: string;
|
|
25
27
|
/** Flag to indicate if card is interactive */
|
|
26
28
|
interactive?: boolean;
|
|
27
29
|
/** Size of card for applying padding */
|
|
@@ -32,7 +34,7 @@ export interface CardProps extends MarginProps {
|
|
|
32
34
|
hoverBoxShadow?: BoxShadowsType;
|
|
33
35
|
}
|
|
34
36
|
declare const Card: {
|
|
35
|
-
({ "data-element": dataElement, "data-role": dataRole, dataRole: oldDataRole, action, children, cardWidth, draggable, interactive, spacing, boxShadow, hoverBoxShadow, ...rest }: CardProps): JSX.Element;
|
|
37
|
+
({ "data-element": dataElement, "data-role": dataRole, dataRole: oldDataRole, action, children, cardWidth, draggable, height, interactive, spacing, boxShadow, hoverBoxShadow, ...rest }: CardProps): JSX.Element;
|
|
36
38
|
displayName: string;
|
|
37
39
|
};
|
|
38
40
|
export default Card;
|
|
@@ -41,6 +41,7 @@ const Card = ({
|
|
|
41
41
|
children,
|
|
42
42
|
cardWidth = "500px",
|
|
43
43
|
draggable,
|
|
44
|
+
height,
|
|
44
45
|
interactive,
|
|
45
46
|
spacing = "medium",
|
|
46
47
|
boxShadow,
|
|
@@ -80,7 +81,8 @@ const Card = ({
|
|
|
80
81
|
spacing: spacing,
|
|
81
82
|
boxShadow: boxShadow,
|
|
82
83
|
hoverBoxShadow: hoverBoxShadow,
|
|
83
|
-
onClick: interactive && !draggable ? action : undefined
|
|
84
|
+
onClick: interactive && !draggable ? action : undefined,
|
|
85
|
+
height: height
|
|
84
86
|
}, interactive && {
|
|
85
87
|
tabIndex: 0,
|
|
86
88
|
type: "button"
|
|
@@ -98,6 +100,7 @@ Card.propTypes = {
|
|
|
98
100
|
"data-role": _propTypes.default.string,
|
|
99
101
|
"dataRole": _propTypes.default.string,
|
|
100
102
|
"draggable": _propTypes.default.bool,
|
|
103
|
+
"height": _propTypes.default.string,
|
|
101
104
|
"hoverBoxShadow": _propTypes.default.any,
|
|
102
105
|
"interactive": _propTypes.default.bool,
|
|
103
106
|
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
@@ -27,6 +27,7 @@ const StyledCard = _styledComponents.default.div`
|
|
|
27
27
|
cardWidth,
|
|
28
28
|
interactive,
|
|
29
29
|
draggable,
|
|
30
|
+
height,
|
|
30
31
|
spacing,
|
|
31
32
|
boxShadow = "boxShadow050",
|
|
32
33
|
hoverBoxShadow = "boxShadow100"
|
|
@@ -35,12 +36,16 @@ const StyledCard = _styledComponents.default.div`
|
|
|
35
36
|
border: none;
|
|
36
37
|
box-shadow: var(--${boxShadow});
|
|
37
38
|
color: var(--colorsUtilityYin090);
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
height: ${height};
|
|
42
|
+
justify-content: space-between;
|
|
38
43
|
margin: 25px;
|
|
44
|
+
outline: none;
|
|
39
45
|
padding: ${paddingSizes[spacing]};
|
|
40
46
|
transition: all 0.3s ease-in-out;
|
|
41
47
|
vertical-align: top;
|
|
42
48
|
width: ${cardWidth};
|
|
43
|
-
outline: none;
|
|
44
49
|
${_styledSystem.margin}
|
|
45
50
|
|
|
46
51
|
${interactive && (0, _styledComponents.css)`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DialogProps } from "../dialog";
|
|
3
|
+
import { IconType } from "../icon";
|
|
4
|
+
export interface ConfirmProps extends Omit<DialogProps, "className" | "disableFocusTrap" | "bespokeFocusTrap" | "focusableSelectors" | "help" | "role" | "contentPadding" | "focusableContainers" | "ariaRole" | "timeout" | "enableBackgroundUI" | "disableClose"> {
|
|
5
|
+
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground" */
|
|
6
|
+
cancelButtonType?: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground";
|
|
7
|
+
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground" */
|
|
8
|
+
confirmButtonType?: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground";
|
|
9
|
+
/** Customise the cancel button label */
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
/** Customise the confirm button label */
|
|
12
|
+
confirmLabel?: string;
|
|
13
|
+
/** Apply destructive style to the cancel button */
|
|
14
|
+
cancelButtonDestructive?: boolean;
|
|
15
|
+
/** Apply destructive style to the confirm button */
|
|
16
|
+
confirmButtonDestructive?: boolean;
|
|
17
|
+
/** Defines a cancel button Icon position related to the children: "before" | "after" */
|
|
18
|
+
cancelButtonIconPosition?: "before" | "after";
|
|
19
|
+
/** Defines an Icon type within the cancel button (see Icon for options) */
|
|
20
|
+
cancelButtonIconType?: IconType;
|
|
21
|
+
/** Defines a cancel button Icon position related to the children: "before" | "after" */
|
|
22
|
+
confirmButtonIconPosition?: "before" | "after";
|
|
23
|
+
/** Defines an Icon type within the confirm button (see Icon for options) */
|
|
24
|
+
confirmButtonIconType?: IconType;
|
|
25
|
+
/** Makes cancel button disabled */
|
|
26
|
+
disableCancel?: boolean;
|
|
27
|
+
/** Makes confirm button disabled */
|
|
28
|
+
disableConfirm?: boolean;
|
|
29
|
+
/** Defines an Icon type within the button (see Icon for options) */
|
|
30
|
+
iconType?: "error" | "warning";
|
|
31
|
+
/** Adds isLoading state into confirm button */
|
|
32
|
+
isLoadingConfirm?: boolean;
|
|
33
|
+
/** A custom event handler when a confirmation takes place */
|
|
34
|
+
onConfirm: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const Confirm: ({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, open, children, cancelButtonDestructive, confirmButtonDestructive, cancelButtonType, confirmButtonType, cancelButtonIconType, cancelButtonIconPosition, confirmButtonIconType, confirmButtonIconPosition, cancelLabel, onCancel, disableCancel, onConfirm, isLoadingConfirm, disableConfirm, confirmLabel, iconType, subtitle, title, size, showCloseIcon, ...rest }: ConfirmProps) => JSX.Element;
|
|
37
|
+
export default Confirm;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.Confirm = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -39,10 +39,10 @@ const Confirm = ({
|
|
|
39
39
|
"aria-label": ariaLabel,
|
|
40
40
|
open,
|
|
41
41
|
children,
|
|
42
|
-
cancelButtonDestructive,
|
|
43
|
-
confirmButtonDestructive,
|
|
44
|
-
cancelButtonType,
|
|
45
|
-
confirmButtonType,
|
|
42
|
+
cancelButtonDestructive = false,
|
|
43
|
+
confirmButtonDestructive = false,
|
|
44
|
+
cancelButtonType = "secondary",
|
|
45
|
+
confirmButtonType = "primary",
|
|
46
46
|
cancelButtonIconType,
|
|
47
47
|
cancelButtonIconPosition,
|
|
48
48
|
confirmButtonIconType,
|
|
@@ -57,6 +57,8 @@ const Confirm = ({
|
|
|
57
57
|
iconType,
|
|
58
58
|
subtitle,
|
|
59
59
|
title,
|
|
60
|
+
size = "extra-small",
|
|
61
|
+
showCloseIcon = false,
|
|
60
62
|
...rest
|
|
61
63
|
}) => {
|
|
62
64
|
const l = (0, _useLocale.default)();
|
|
@@ -134,123 +136,54 @@ const Confirm = ({
|
|
|
134
136
|
subtitle: subtitle,
|
|
135
137
|
title: getTitle(),
|
|
136
138
|
"data-component": "confirm",
|
|
137
|
-
role: "alertdialog"
|
|
139
|
+
role: "alertdialog",
|
|
140
|
+
size: size,
|
|
141
|
+
showCloseIcon: showCloseIcon
|
|
138
142
|
}, ariaProps, rest), children, /*#__PURE__*/_react.default.createElement(_confirm.StyledConfirmButtons, null, renderCancelButton(), renderConfirmButton()));
|
|
139
143
|
};
|
|
140
144
|
|
|
141
|
-
Confirm
|
|
142
|
-
size: "extra-small",
|
|
143
|
-
showCloseIcon: false,
|
|
144
|
-
cancelButtonDestructive: false,
|
|
145
|
-
confirmButtonDestructive: false,
|
|
146
|
-
iconType: null,
|
|
147
|
-
cancelButtonType: "secondary",
|
|
148
|
-
confirmButtonType: "primary"
|
|
149
|
-
};
|
|
145
|
+
exports.Confirm = Confirm;
|
|
150
146
|
Confirm.propTypes = {
|
|
151
|
-
/** Prop to specify the aria-describedby property of the component */
|
|
152
147
|
"aria-describedby": _propTypes.default.string,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Prop to specify the aria-label of the component.
|
|
156
|
-
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
157
|
-
*/
|
|
158
148
|
"aria-label": _propTypes.default.string,
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Prop to specify the aria-labeledby property of the component
|
|
162
|
-
* To be used when the title prop is a custom React Node,
|
|
163
|
-
* or the component is labelled by an internal element other than the title.
|
|
164
|
-
*/
|
|
165
149
|
"aria-labelledby": _propTypes.default.string,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
showCloseIcon: _propTypes.default.bool,
|
|
193
|
-
|
|
194
|
-
/** Optional reference to an element meant to be focused on open */
|
|
195
|
-
focusFirstElement: _propTypes.default.shape({
|
|
196
|
-
current: _propTypes.default.any
|
|
150
|
+
"cancelButtonDestructive": _propTypes.default.bool,
|
|
151
|
+
"cancelButtonIconPosition": _propTypes.default.oneOf(["after", "before"]),
|
|
152
|
+
"cancelButtonIconType": _propTypes.default.oneOf(["add", "admin", "alert_on", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
153
|
+
"cancelButtonType": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
154
|
+
"cancelLabel": _propTypes.default.string,
|
|
155
|
+
"children": _propTypes.default.node,
|
|
156
|
+
"confirmButtonDestructive": _propTypes.default.bool,
|
|
157
|
+
"confirmButtonIconPosition": _propTypes.default.oneOf(["after", "before"]),
|
|
158
|
+
"confirmButtonIconType": _propTypes.default.oneOf(["add", "admin", "alert_on", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
159
|
+
"confirmButtonType": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
|
|
160
|
+
"confirmLabel": _propTypes.default.string,
|
|
161
|
+
"data-component": _propTypes.default.string,
|
|
162
|
+
"data-element": _propTypes.default.string,
|
|
163
|
+
"data-role": _propTypes.default.string,
|
|
164
|
+
"disableAutoFocus": _propTypes.default.bool,
|
|
165
|
+
"disableCancel": _propTypes.default.bool,
|
|
166
|
+
"disableConfirm": _propTypes.default.bool,
|
|
167
|
+
"disableEscKey": _propTypes.default.bool,
|
|
168
|
+
"focusFirstElement": _propTypes.default.shape({
|
|
169
|
+
"current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
|
|
170
|
+
if (props[propName] == null) {
|
|
171
|
+
return new Error("Prop '" + propName + "' is required but wasn't specified");
|
|
172
|
+
} else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
173
|
+
return new Error("Expected prop '" + propName + "' to be of type Element");
|
|
174
|
+
}
|
|
175
|
+
}]).isRequired
|
|
197
176
|
}),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/** Customise the cancel button label */
|
|
209
|
-
cancelLabel: _propTypes.default.string,
|
|
210
|
-
|
|
211
|
-
/** Apply destructive style to the cancel button */
|
|
212
|
-
cancelButtonDestructive: _propTypes.default.bool,
|
|
213
|
-
|
|
214
|
-
/** Apply destructive style to the confirm button */
|
|
215
|
-
confirmButtonDestructive: _propTypes.default.bool,
|
|
216
|
-
|
|
217
|
-
/** Defines a cancel button Icon position related to the children: "before" | "after" */
|
|
218
|
-
cancelButtonIconPosition: _propTypes.default.oneOf(["before", "after"]),
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
|
|
222
|
-
*
|
|
223
|
-
* Defines an Icon type within the cancel button (see Icon for options)
|
|
224
|
-
* */
|
|
225
|
-
cancelButtonIconType: _propTypes.default.string,
|
|
226
|
-
|
|
227
|
-
/** Defines a confirm button Icon position related to the children: "before" | "after" */
|
|
228
|
-
confirmButtonIconPosition: _propTypes.default.oneOf(["before", "after"]),
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
|
|
232
|
-
*
|
|
233
|
-
* Defines an Icon type within the confirm button (see Icon for options)
|
|
234
|
-
* */
|
|
235
|
-
confirmButtonIconType: _propTypes.default.string,
|
|
236
|
-
|
|
237
|
-
/** Defines an Icon type within the button (see Icon for options) */
|
|
238
|
-
iconType: _propTypes.default.oneOf(["error", "warning"]),
|
|
239
|
-
|
|
240
|
-
/** Makes cancel button disabled */
|
|
241
|
-
disableCancel: _propTypes.default.bool,
|
|
242
|
-
|
|
243
|
-
/** Makes confirm button disabled */
|
|
244
|
-
disableConfirm: _propTypes.default.bool,
|
|
245
|
-
|
|
246
|
-
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground" */
|
|
247
|
-
cancelButtonType: _propTypes.default.oneOf(["primary", "secondary", "tertiary", "dashed", "darkBackground"]),
|
|
248
|
-
|
|
249
|
-
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "dashed" | "darkBackground" */
|
|
250
|
-
confirmButtonType: _propTypes.default.oneOf(["primary", "secondary", "tertiary", "dashed", "darkBackground"]),
|
|
251
|
-
|
|
252
|
-
/** Adds isLoading state into confirm button */
|
|
253
|
-
isLoadingConfirm: _propTypes.default.bool
|
|
177
|
+
"height": _propTypes.default.string,
|
|
178
|
+
"iconType": _propTypes.default.oneOf(["error", "warning"]),
|
|
179
|
+
"isLoadingConfirm": _propTypes.default.bool,
|
|
180
|
+
"onCancel": _propTypes.default.func,
|
|
181
|
+
"onConfirm": _propTypes.default.func.isRequired,
|
|
182
|
+
"open": _propTypes.default.bool.isRequired,
|
|
183
|
+
"showCloseIcon": _propTypes.default.bool,
|
|
184
|
+
"size": _propTypes.default.oneOf(["auto", "extra-large", "extra-small", "large", "medium-large", "medium-small", "medium", "small"]),
|
|
185
|
+
"subtitle": _propTypes.default.string,
|
|
186
|
+
"title": _propTypes.default.node
|
|
254
187
|
};
|
|
255
188
|
var _default = Confirm;
|
|
256
189
|
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONFIRM_SIZES: string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ConfirmProps } from ".";
|
|
2
|
+
export declare const StyledConfirmButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const StyledConfirmHeading: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
type: ConfirmProps["iconType"];
|
|
5
|
+
}, never>;
|
|
@@ -7,8 +7,6 @@ exports.StyledConfirmHeading = exports.StyledConfirmButtons = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
13
11
|
|
|
14
12
|
var _heading = require("../heading/heading.style");
|
|
@@ -48,7 +46,4 @@ const StyledConfirmHeading = _styledComponents.default.div`
|
|
|
48
46
|
`}
|
|
49
47
|
}
|
|
50
48
|
`;
|
|
51
|
-
exports.StyledConfirmHeading = StyledConfirmHeading;
|
|
52
|
-
StyledConfirmHeading.propTypes = {
|
|
53
|
-
type: _propTypes.default.oneOf(["error", "warning"])
|
|
54
|
-
};
|
|
49
|
+
exports.StyledConfirmHeading = StyledConfirmHeading;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./confirm";
|
|
1
|
+
export { default } from "./confirm.component";
|
|
2
|
+
export type { ConfirmProps } from "./confirm.component";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare type StyledContentProps = {
|
|
2
|
+
hasHeader: boolean;
|
|
3
|
+
hasStickyFooter: boolean;
|
|
4
|
+
disableContentPadding?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const StyledContent: import("styled-components").StyledComponent<"div", any, StyledContentProps, never>;
|
|
7
|
+
export default StyledContent;
|