@thecb/components 10.5.0 → 10.5.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +16408 -139
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16408 -139
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/icons/index.js +1 -1
- package/src/components/molecules/modal/Modal.stories.js +1 -0
- package/src/components/molecules/modal/ModalControlV2.js +26 -4
- package/src/components/molecules/modal/__private__/CloseIconButton.js +32 -0
- package/src/components/molecules/modal/__private__/index.d.ts +11 -0
- package/src/components/molecules/modal/__private__/index.js +1 -0
- package/src/constants/style_constants.js +2 -1
- /package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ import ChargebackIcon from "./ChargebackIcon";
|
|
|
35
35
|
import ChargebackReversalIcon from "./ChargebackReversalIcon";
|
|
36
36
|
import DuplicateIcon from "./DuplicateIcon";
|
|
37
37
|
import ErroredIcon from "./ErroredIcon";
|
|
38
|
-
import ExternalLinkIcon from "./
|
|
38
|
+
import ExternalLinkIcon from "./ExternalLinkicon";
|
|
39
39
|
import FailedIcon from "./FailedIcon";
|
|
40
40
|
import PencilIcon from "./PencilIcon";
|
|
41
41
|
import PendingIcon from "./PendingIcon";
|
|
@@ -77,6 +77,7 @@ export const modalV2 = () => (
|
|
|
77
77
|
onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
|
|
78
78
|
onlyContinueButton={boolean("onlyContinueButton", false, groupId)}
|
|
79
79
|
useDangerButton={boolean("useDangerButton", false, groupId)}
|
|
80
|
+
showCloseIconButton={boolean("showCloseIconButton", true, groupId)}
|
|
80
81
|
/>
|
|
81
82
|
);
|
|
82
83
|
|
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
ButtonLayoutWrapper,
|
|
19
19
|
CancelButton,
|
|
20
20
|
CloseButton,
|
|
21
|
-
ContinueButton
|
|
21
|
+
ContinueButton,
|
|
22
|
+
CloseIconButton
|
|
22
23
|
} from "./__private__";
|
|
23
24
|
|
|
24
25
|
/*
|
|
@@ -61,7 +62,8 @@ const Modal = ({
|
|
|
61
62
|
onlyCloseButton = false,
|
|
62
63
|
onlyContinueButton = false,
|
|
63
64
|
underlayClickExits = true,
|
|
64
|
-
useDangerButton = false
|
|
65
|
+
useDangerButton = false,
|
|
66
|
+
showCloseIconButton = false
|
|
65
67
|
}) => {
|
|
66
68
|
const { isMobile } = useContext(ThemeContext);
|
|
67
69
|
|
|
@@ -108,7 +110,7 @@ const Modal = ({
|
|
|
108
110
|
borderRadius: BORDER_RADIUS.MD,
|
|
109
111
|
margin: SPACING.XS,
|
|
110
112
|
overflow: "auto",
|
|
111
|
-
width: isMobile ? "" : customWidth || "
|
|
113
|
+
width: isMobile ? "" : customWidth || "576px"
|
|
112
114
|
}}
|
|
113
115
|
underlayClickExits={underlayClickExits}
|
|
114
116
|
aria-modal={true}
|
|
@@ -122,7 +124,11 @@ const Modal = ({
|
|
|
122
124
|
borderWidthOverride={`0 0 ${BORDER_THIN} 0`}
|
|
123
125
|
padding={`${SPACING.XS} ${SPACING.MD}`}
|
|
124
126
|
>
|
|
125
|
-
<Cluster
|
|
127
|
+
<Cluster
|
|
128
|
+
justify={showCloseIconButton ? "space-between" : "flex-start"}
|
|
129
|
+
align="center"
|
|
130
|
+
nowrap
|
|
131
|
+
>
|
|
126
132
|
<Title
|
|
127
133
|
as="h2"
|
|
128
134
|
weight={FONT_WEIGHT_SEMIBOLD}
|
|
@@ -130,6 +136,22 @@ const Modal = ({
|
|
|
130
136
|
>
|
|
131
137
|
{modalHeaderText}
|
|
132
138
|
</Title>
|
|
139
|
+
{showCloseIconButton && (
|
|
140
|
+
<CloseIconButton
|
|
141
|
+
hideModal={hideModal}
|
|
142
|
+
iconWidth={isMobile ? "20" : "24"}
|
|
143
|
+
iconHeight={isMobile ? "20" : "24"}
|
|
144
|
+
buttonExtraStyles={`
|
|
145
|
+
min-height: auto;
|
|
146
|
+
min-width: auto;
|
|
147
|
+
height: 1.5rem;
|
|
148
|
+
margin: 0;
|
|
149
|
+
&:focus {
|
|
150
|
+
outline-offset: -3px;
|
|
151
|
+
}
|
|
152
|
+
`}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
133
155
|
</Cluster>
|
|
134
156
|
</Box>
|
|
135
157
|
<Box background={modalBodyBg || ATHENS_GREY} padding="0">
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { noop } from "../../../../util/general";
|
|
3
|
+
import ButtonWithAction from "../../../atoms/button-with-action/ButtonWithAction";
|
|
4
|
+
import { CloseIcon } from "../../../atoms/icons/CloseIcon";
|
|
5
|
+
import { button } from "@storybook/addon-knobs";
|
|
6
|
+
|
|
7
|
+
export const CloseIconButton = ({
|
|
8
|
+
buttonExtraStyles = "",
|
|
9
|
+
hideModal = noop,
|
|
10
|
+
iconWidth = "24",
|
|
11
|
+
iconHeight = "24",
|
|
12
|
+
ariaLabel = ""
|
|
13
|
+
}) => {
|
|
14
|
+
return (
|
|
15
|
+
<ButtonWithAction
|
|
16
|
+
variant="smallGhost"
|
|
17
|
+
action={hideModal}
|
|
18
|
+
contentOverride
|
|
19
|
+
extraStyles={buttonExtraStyles}
|
|
20
|
+
aria-label={ariaLabel ?? "Close Modal"}
|
|
21
|
+
>
|
|
22
|
+
<CloseIcon
|
|
23
|
+
role="img"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
iconWidth={iconWidth}
|
|
26
|
+
iconHeight={iconHeight}
|
|
27
|
+
/>
|
|
28
|
+
</ButtonWithAction>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default CloseIconButton;
|
|
@@ -44,3 +44,14 @@ export interface ContinueButtonProps {
|
|
|
44
44
|
|
|
45
45
|
export declare const ContinueButton: React.FC<Expand<ContinueButtonProps> &
|
|
46
46
|
React.HTMLAttributes<HTMLElement>>;
|
|
47
|
+
|
|
48
|
+
export interface CloseIconButtonProps {
|
|
49
|
+
buttonExtraStyles?: string;
|
|
50
|
+
hideModal?: action;
|
|
51
|
+
iconWidth?: string;
|
|
52
|
+
iconHeight?: string;
|
|
53
|
+
ariaLabel?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare const CloseIconButton: React.FC<Expand<CloseIconButtonProps> &
|
|
57
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
@@ -2,3 +2,4 @@ export { default as ButtonLayoutWrapper } from "./ButtonLayoutWrapper";
|
|
|
2
2
|
export { default as CancelButton } from "./CancelButton";
|
|
3
3
|
export { default as CloseButton } from "./CloseButton";
|
|
4
4
|
export { default as ContinueButton } from "./ContinueButton";
|
|
5
|
+
export { default as CloseIconButton } from "./CloseIconButton";
|
|
@@ -8,7 +8,8 @@ export const FONT_SIZE = {
|
|
|
8
8
|
XS: "0.750rem", // 12px
|
|
9
9
|
SM: "0.875rem", // 14px
|
|
10
10
|
MD: "1.000rem", // 16px
|
|
11
|
-
LG: "1.125rem" // 18px
|
|
11
|
+
LG: "1.125rem", // 18px
|
|
12
|
+
XLG: "1.25rem" //20px
|
|
12
13
|
};
|
|
13
14
|
export const FONT_WEIGHT_REGULAR = "400";
|
|
14
15
|
export const FONT_WEIGHT_SEMIBOLD = "600";
|
|
File without changes
|