@thecb/components 10.6.0-beta.0 → 10.6.0-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 +74 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +74 -29
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/icons/.DS_Store +0 -0
- package/src/components/atoms/wallet-name/WalletName.js +30 -24
- package/src/components/atoms/wallet-name/WalletName.stories.js +2 -1
- package/src/components/atoms/wallet-name/WalletName.theme.js +6 -1
- package/src/components/atoms/wallet-name/index.d.ts +4 -3
- package/src/components/molecules/modal/Modal.stories.js +1 -0
- package/src/components/molecules/modal/ModalControlV2.js +17 -2
- package/src/components/molecules/modal/__private__/CancelButton.js +2 -1
- package/src/components/molecules/modal/__private__/CloseIconButton.js +39 -0
- package/src/components/molecules/modal/__private__/ContinueButton.js +2 -1
- package/src/components/molecules/modal/__private__/index.d.ts +13 -0
- package/src/components/molecules/modal/__private__/index.js +1 -0
- package/src/constants/style_constants.js +2 -1
package/package.json
CHANGED
|
Binary file
|
|
@@ -2,21 +2,20 @@ import React, { Fragment, useContext } from "react";
|
|
|
2
2
|
import { Box } from "../layouts";
|
|
3
3
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
4
|
import ButtonWithAction from "../button-with-action";
|
|
5
|
-
import { noop } from "../../../util/general";
|
|
6
5
|
import Text from "../text/Text";
|
|
7
6
|
import { ThemeContext } from "styled-components";
|
|
8
7
|
import { fallbackValues } from "./WalletName.theme";
|
|
9
8
|
import Module from "../../molecules/module/Module";
|
|
10
9
|
|
|
11
10
|
const WalletName = ({
|
|
12
|
-
mainText
|
|
13
|
-
action
|
|
14
|
-
text
|
|
15
|
-
actionText
|
|
16
|
-
themeValues
|
|
11
|
+
mainText,
|
|
12
|
+
action,
|
|
13
|
+
text,
|
|
14
|
+
actionText,
|
|
15
|
+
themeValues,
|
|
16
|
+
disableAction = false
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
const { isMobile } = themeContext;
|
|
18
|
+
const { isMobile } = useContext(ThemeContext);
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<Fragment>
|
|
@@ -28,7 +27,7 @@ const WalletName = ({
|
|
|
28
27
|
margin="0 0 0 0"
|
|
29
28
|
extraStyles={
|
|
30
29
|
isMobile
|
|
31
|
-
? `display: flex; flex-direction: column; flex-wrap: wrap; span {text
|
|
30
|
+
? `display: flex; flex-direction: column; flex-wrap: wrap; span {text-align: right;}`
|
|
32
31
|
: `display: flex; justify-content: space-between; align-items: center;`
|
|
33
32
|
}
|
|
34
33
|
>
|
|
@@ -37,17 +36,21 @@ const WalletName = ({
|
|
|
37
36
|
</Box>
|
|
38
37
|
{!isMobile && (
|
|
39
38
|
<Box padding="0">
|
|
40
|
-
<Text variant="pXS">{text}</Text>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
{text && <Text variant="pXS">{text}</Text>}
|
|
40
|
+
{text && actionText && <> </>}
|
|
41
|
+
{action && actionText && (
|
|
42
|
+
<ButtonWithAction
|
|
43
|
+
disabled={disableAction}
|
|
44
|
+
text={actionText}
|
|
45
|
+
action={action}
|
|
46
|
+
variant="smallGhost"
|
|
47
|
+
extraStyles="
|
|
47
48
|
margin-left: 0;
|
|
49
|
+
min-width: 0;
|
|
48
50
|
span {font-size: 0.75rem;}
|
|
49
51
|
"
|
|
50
|
-
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
51
54
|
</Box>
|
|
52
55
|
)}
|
|
53
56
|
</Box>
|
|
@@ -57,13 +60,16 @@ const WalletName = ({
|
|
|
57
60
|
padding="0 0 24px"
|
|
58
61
|
extraStyles="display: flex; align-items: center; justify-content: flex-end;"
|
|
59
62
|
>
|
|
60
|
-
<Text extraStyles="font-size: 12px">{text}</Text>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
{text && <Text extraStyles="font-size: 12px">{text}</Text>}
|
|
64
|
+
{action && actionText && (
|
|
65
|
+
<ButtonWithAction
|
|
66
|
+
text={actionText}
|
|
67
|
+
action={action}
|
|
68
|
+
variant="smallGhost"
|
|
69
|
+
extraStyles="span {font-size: 12px;}"
|
|
70
|
+
disabled={disableAction}
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
67
73
|
</Box>
|
|
68
74
|
)}
|
|
69
75
|
</Fragment>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import WalletName from "./WalletName";
|
|
3
|
-
import { text, object } from "@storybook/addon-knobs";
|
|
3
|
+
import { text, object, boolean } from "@storybook/addon-knobs";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
5
5
|
|
|
6
6
|
export const walletName = () => {
|
|
@@ -10,6 +10,7 @@ export const walletName = () => {
|
|
|
10
10
|
action={object("action", () => window.alert("action fired!"), "props")}
|
|
11
11
|
actionText={text("actionText", "Check out as a guest", "props")}
|
|
12
12
|
text={text("text", "Not you?", "props")}
|
|
13
|
+
actionDisabled={boolean("actionDisabled", false, "props")}
|
|
13
14
|
/>
|
|
14
15
|
);
|
|
15
16
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { CHARADE_GREY, WHITE } from "../../../constants/colors";
|
|
1
|
+
import { CHARADE_GREY, ROYAL_BLUE, WHITE } from "../../../constants/colors";
|
|
2
2
|
|
|
3
3
|
const backgroundColor = {
|
|
4
4
|
primary: WHITE
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
const color = {
|
|
8
|
+
primary: ROYAL_BLUE
|
|
9
|
+
};
|
|
10
|
+
|
|
7
11
|
const boxShadow = {
|
|
8
12
|
primary: `box-shadow: 0px 1px 2px 0px rgba(${CHARADE_GREY}, 0.1);
|
|
9
13
|
box-shadow: 0px 2px 6px 0px rgba(${CHARADE_GREY}, 0.2);
|
|
@@ -12,5 +16,6 @@ const boxShadow = {
|
|
|
12
16
|
|
|
13
17
|
export const fallbackValues = {
|
|
14
18
|
backgroundColor,
|
|
19
|
+
color,
|
|
15
20
|
boxShadow
|
|
16
21
|
};
|
|
@@ -3,9 +3,10 @@ import Expand from "../../../util/expand";
|
|
|
3
3
|
|
|
4
4
|
export interface WalletNameProps {
|
|
5
5
|
action?: () => void;
|
|
6
|
-
text
|
|
7
|
-
actionText
|
|
8
|
-
mainText
|
|
6
|
+
text: string;
|
|
7
|
+
actionText: string;
|
|
8
|
+
mainText: string;
|
|
9
|
+
actionDisabled?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const WalletName: React.FC<Expand<WalletNameProps> &
|
|
@@ -76,6 +76,7 @@ export const modalV2 = () => (
|
|
|
76
76
|
noButtons={boolean("noButtons", false, groupId)}
|
|
77
77
|
onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
|
|
78
78
|
onlyContinueButton={boolean("onlyContinueButton", false, groupId)}
|
|
79
|
+
showCloseIconButton={boolean("showCloseIconButton", true, groupId)}
|
|
79
80
|
useDangerButton={boolean("useDangerButton", false, groupId)}
|
|
80
81
|
/>
|
|
81
82
|
);
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ButtonLayoutWrapper,
|
|
19
19
|
CancelButton,
|
|
20
20
|
CloseButton,
|
|
21
|
+
CloseIconButton,
|
|
21
22
|
ContinueButton
|
|
22
23
|
} from "./__private__";
|
|
23
24
|
|
|
@@ -38,10 +39,12 @@ const Modal = ({
|
|
|
38
39
|
buttonExtraStyles = "",
|
|
39
40
|
cancelAction = noop,
|
|
40
41
|
cancelButtonText = "Cancel",
|
|
42
|
+
cancelButtonVariant = "secondary",
|
|
41
43
|
children = [],
|
|
42
44
|
closeButtonText = "Close",
|
|
43
45
|
continueAction = noop,
|
|
44
46
|
continueButtonText = "Continue",
|
|
47
|
+
continueButtonVariant = "primary",
|
|
45
48
|
continueURL = "",
|
|
46
49
|
customWidth = "",
|
|
47
50
|
dataQa = null,
|
|
@@ -60,6 +63,7 @@ const Modal = ({
|
|
|
60
63
|
onExit = hideModal,
|
|
61
64
|
onlyCloseButton = false,
|
|
62
65
|
onlyContinueButton = false,
|
|
66
|
+
showCloseIconButton = false,
|
|
63
67
|
underlayClickExits = true,
|
|
64
68
|
useDangerButton = false
|
|
65
69
|
}) => {
|
|
@@ -108,7 +112,7 @@ const Modal = ({
|
|
|
108
112
|
borderRadius: BORDER_RADIUS.MD,
|
|
109
113
|
margin: SPACING.XS,
|
|
110
114
|
overflow: "auto",
|
|
111
|
-
width: isMobile ? "" : customWidth || "
|
|
115
|
+
width: isMobile ? "" : customWidth || "576px"
|
|
112
116
|
}}
|
|
113
117
|
underlayClickExits={underlayClickExits}
|
|
114
118
|
aria-modal={true}
|
|
@@ -122,7 +126,13 @@ const Modal = ({
|
|
|
122
126
|
borderWidthOverride={`0 0 ${BORDER_THIN} 0`}
|
|
123
127
|
padding={`${SPACING.XS} ${SPACING.MD}`}
|
|
124
128
|
>
|
|
125
|
-
<Cluster
|
|
129
|
+
<Cluster
|
|
130
|
+
justify={showCloseIconButton ? "space-between" : "flex-start"}
|
|
131
|
+
align={
|
|
132
|
+
showCloseIconButton && isMobile ? "flex-start" : "center"
|
|
133
|
+
}
|
|
134
|
+
nowrap
|
|
135
|
+
>
|
|
126
136
|
<Title
|
|
127
137
|
as="h2"
|
|
128
138
|
weight={FONT_WEIGHT_SEMIBOLD}
|
|
@@ -130,6 +140,9 @@ const Modal = ({
|
|
|
130
140
|
>
|
|
131
141
|
{modalHeaderText}
|
|
132
142
|
</Title>
|
|
143
|
+
{showCloseIconButton && (
|
|
144
|
+
<CloseIconButton hideModal={hideModal} />
|
|
145
|
+
)}
|
|
133
146
|
</Cluster>
|
|
134
147
|
</Box>
|
|
135
148
|
<Box background={modalBodyBg || ATHENS_GREY} padding="0">
|
|
@@ -161,6 +174,7 @@ const Modal = ({
|
|
|
161
174
|
buttonExtraStyles={buttonExtraStyles}
|
|
162
175
|
cancelAction={cancelAction}
|
|
163
176
|
cancelButtonText={cancelButtonText}
|
|
177
|
+
cancelButtonVariant={cancelButtonVariant}
|
|
164
178
|
hideModal={hideModal}
|
|
165
179
|
isMobile={isMobile}
|
|
166
180
|
key="cancel"
|
|
@@ -172,6 +186,7 @@ const Modal = ({
|
|
|
172
186
|
continueAction={continueAction}
|
|
173
187
|
continueButtonText={continueButtonText}
|
|
174
188
|
continueURL={continueURL}
|
|
189
|
+
continueButtonVariant={continueButtonVariant}
|
|
175
190
|
isContinueActionDisabled={isContinueActionDisabled}
|
|
176
191
|
isLoading={isLoading}
|
|
177
192
|
isMobile={isMobile}
|
|
@@ -10,6 +10,7 @@ export const CancelButton = ({
|
|
|
10
10
|
buttonExtraStyles = "",
|
|
11
11
|
cancelAction = noop,
|
|
12
12
|
cancelButtonText = "",
|
|
13
|
+
cancelButtonVariant = "secondary",
|
|
13
14
|
hideModal = noop,
|
|
14
15
|
isMobile = false
|
|
15
16
|
}) => {
|
|
@@ -27,7 +28,7 @@ export const CancelButton = ({
|
|
|
27
28
|
role="button"
|
|
28
29
|
text={cancelButtonText}
|
|
29
30
|
textExtraStyles={`${fontSize}`}
|
|
30
|
-
variant=
|
|
31
|
+
variant={cancelButtonVariant}
|
|
31
32
|
/>
|
|
32
33
|
);
|
|
33
34
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
|
|
6
|
+
export const CloseIconButton = ({
|
|
7
|
+
buttonExtraStyles = "",
|
|
8
|
+
hideModal = noop,
|
|
9
|
+
iconWidth = "24",
|
|
10
|
+
iconHeight = "24",
|
|
11
|
+
ariaLabel = "Close Modal"
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<ButtonWithAction
|
|
15
|
+
action={hideModal}
|
|
16
|
+
aria-label={ariaLabel}
|
|
17
|
+
contentOverride
|
|
18
|
+
extraStyles={`
|
|
19
|
+
min-height: auto;
|
|
20
|
+
min-width: auto;
|
|
21
|
+
height: 1.5rem;
|
|
22
|
+
margin: 0 0 0 0.5rem;
|
|
23
|
+
&:focus {
|
|
24
|
+
outline-offset: -3px;
|
|
25
|
+
}
|
|
26
|
+
`}
|
|
27
|
+
variant="smallGhost"
|
|
28
|
+
>
|
|
29
|
+
<CloseIcon
|
|
30
|
+
role="img"
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
iconWidth={iconWidth}
|
|
33
|
+
iconHeight={iconHeight}
|
|
34
|
+
/>
|
|
35
|
+
</ButtonWithAction>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default CloseIconButton;
|
|
@@ -12,6 +12,7 @@ export const ContinueButton = ({
|
|
|
12
12
|
continueAction = noop,
|
|
13
13
|
continueButtonText = "",
|
|
14
14
|
continueURL = "",
|
|
15
|
+
continueButtonVariant = "primary",
|
|
15
16
|
isContinueActionDisabled = false,
|
|
16
17
|
isLoading = false,
|
|
17
18
|
isMobile = false,
|
|
@@ -36,7 +37,7 @@ export const ContinueButton = ({
|
|
|
36
37
|
text={continueButtonText}
|
|
37
38
|
textExtraStyles={`${fontSize}`}
|
|
38
39
|
url={continueURL}
|
|
39
|
-
variant={useDangerButton ? "danger" :
|
|
40
|
+
variant={useDangerButton ? "danger" : continueButtonVariant}
|
|
40
41
|
/>
|
|
41
42
|
);
|
|
42
43
|
};
|
|
@@ -14,6 +14,7 @@ export interface CancelButtonProps {
|
|
|
14
14
|
buttonExtraStyles?: string;
|
|
15
15
|
cancelAction?: Function;
|
|
16
16
|
cancelButtonText?: string;
|
|
17
|
+
cancelButtonVariant?: string;
|
|
17
18
|
hideModal?: Function;
|
|
18
19
|
isMobile?: boolean;
|
|
19
20
|
}
|
|
@@ -31,11 +32,23 @@ export interface CloseButtonProps {
|
|
|
31
32
|
export declare const CloseButton: React.FC<Expand<CloseButtonProps> &
|
|
32
33
|
React.HTMLAttributes<HTMLElement>>;
|
|
33
34
|
|
|
35
|
+
export interface CloseIconButtonProps {
|
|
36
|
+
buttonExtraStyles?: string;
|
|
37
|
+
hideModal?: action;
|
|
38
|
+
iconWidth?: string;
|
|
39
|
+
iconHeight?: string;
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare const CloseIconButton: React.FC<Expand<CloseIconButtonProps> &
|
|
44
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
45
|
+
|
|
34
46
|
export interface ContinueButtonProps {
|
|
35
47
|
buttonExtraStyles?: string;
|
|
36
48
|
continueAction?: Function;
|
|
37
49
|
continueButtonText?: string;
|
|
38
50
|
continueURL?: string;
|
|
51
|
+
continueButtonVariant?: string;
|
|
39
52
|
isContinueActionDisabled?: boolean;
|
|
40
53
|
isLoading?: boolean;
|
|
41
54
|
isMobile?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as ButtonLayoutWrapper } from "./ButtonLayoutWrapper";
|
|
2
2
|
export { default as CancelButton } from "./CancelButton";
|
|
3
3
|
export { default as CloseButton } from "./CloseButton";
|
|
4
|
+
export { default as CloseIconButton } from "./CloseIconButton";
|
|
4
5
|
export { default as ContinueButton } from "./ContinueButton";
|
|
@@ -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
|
+
XL: "1.250rem" //20px
|
|
12
13
|
};
|
|
13
14
|
export const FONT_WEIGHT_REGULAR = "400";
|
|
14
15
|
export const FONT_WEIGHT_SEMIBOLD = "600";
|