@thecb/components 10.6.4-beta.0 → 10.6.4-beta.2
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 +1016 -1651
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +1013 -1652
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/icons/DisabledAccountsAddIcon.js +200 -0
- package/src/components/atoms/icons/DisabledPaymentMethodsAddIcon.js +62 -0
- package/src/components/atoms/icons/DisabledPropertiesAddIcon.js +54 -0
- package/src/components/atoms/icons/EmptyCartIconV2.js +0 -1
- package/src/components/atoms/icons/PropertiesAddIcon.js +1 -0
- package/src/components/atoms/icons/WalletIconSmall.js +7 -3
- package/src/components/atoms/icons/icons.stories.js +9 -1
- package/src/components/atoms/icons/index.js +7 -1
- package/src/components/atoms/index.js +1 -0
- package/src/components/atoms/placeholder/Placeholder.js +85 -26
- package/src/components/atoms/placeholder/Placeholder.stories.js +2 -0
- package/src/components/atoms/placeholder/Placeholder.theme.js +8 -2
- package/src/components/atoms/spinner/Spinner.js +13 -5
- package/src/components/atoms/spinner/index.d.ts +4 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +33 -61
- package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +2 -3
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +5 -5
- package/src/components/atoms/wallet-name/WalletName.js +102 -0
- package/src/components/atoms/wallet-name/WalletName.stories.js +24 -0
- package/src/components/atoms/wallet-name/index.d.ts +15 -0
- package/src/components/atoms/wallet-name/index.js +3 -0
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/editable-list/EditableList.js +3 -1
- package/src/components/molecules/editable-list/EditableList.stories.js +1 -3
- package/src/components/molecules/link-card/LinkCard.theme.js +7 -21
- 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/components/molecules/module/Module.js +8 -2
- package/src/components/molecules/obligation/.DS_Store +0 -0
- package/src/components/molecules/obligation/icons/AccountBillIcon.js +14 -79
- package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +14 -89
- package/src/components/molecules/obligation/icons/AccountDentalIcon.js +13 -85
- package/src/components/molecules/obligation/icons/AccountElectricIcon.js +13 -90
- package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +14 -84
- package/src/components/molecules/obligation/icons/AccountGasIcon.js +13 -85
- package/src/components/molecules/obligation/icons/AccountGenericIcon.js +14 -79
- package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +14 -84
- package/src/components/molecules/obligation/icons/AccountWaterIcon.js +14 -84
- package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +13 -90
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +13 -83
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +12 -89
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +12 -90
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +12 -86
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +12 -89
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +12 -89
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +14 -84
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +12 -90
- package/src/components/molecules/obligation/icons/index.js +32 -18
- package/src/components/molecules/obligation/modules/IconModule.js +9 -3
- package/src/components/molecules/partial-amount-form/PartialAmountField.js +49 -0
- package/src/components/molecules/partial-amount-form/PartialAmountForm.js +8 -22
- package/src/components/molecules/payment-details/PaymentDetails.js +8 -4
- package/src/components/molecules/radio-section/InnerRadioSection.js +7 -2
- package/src/components/molecules/registration-form/RegistrationForm.js +6 -3
- package/src/components/molecules/registration-form/RegistrationForm.state.js +4 -3
- package/src/constants/style_constants.js +2 -1
- /package/src/components/atoms/icons/{ExternalLinkicon.js → ExternalLinkIcon.js} +0 -0
|
@@ -8,39 +8,55 @@ import { themeComponent } from "../../../util/themeUtils";
|
|
|
8
8
|
import {
|
|
9
9
|
STORM_GREY,
|
|
10
10
|
GRECIAN_GREY,
|
|
11
|
-
CHARADE_GREY
|
|
11
|
+
CHARADE_GREY,
|
|
12
|
+
WHITE,
|
|
13
|
+
TRANSPARENT,
|
|
14
|
+
MANATEE_GREY
|
|
12
15
|
} from "../../../constants/colors";
|
|
13
16
|
import {
|
|
14
17
|
AccountsAddIcon,
|
|
15
18
|
PropertiesAddIcon,
|
|
16
19
|
IconAdd,
|
|
17
|
-
PaymentMethodAddIcon
|
|
20
|
+
PaymentMethodAddIcon,
|
|
21
|
+
DisabledAccountsAddIcon,
|
|
22
|
+
DisabledPropertiesAddIcon,
|
|
23
|
+
DisabledPaymentMethodsAddIcon
|
|
18
24
|
} from "../icons";
|
|
19
25
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
26
|
+
import { noop } from "../../../util/general";
|
|
20
27
|
|
|
21
|
-
const getLargeIcon = iconName => {
|
|
28
|
+
const getLargeIcon = (iconName, isDisabled) => {
|
|
22
29
|
switch (iconName) {
|
|
23
30
|
case "accounts":
|
|
24
|
-
return <AccountsAddIcon />;
|
|
31
|
+
return isDisabled ? <DisabledAccountsAddIcon /> : <AccountsAddIcon />;
|
|
25
32
|
case "properties":
|
|
26
|
-
return <PropertiesAddIcon />;
|
|
33
|
+
return isDisabled ? <DisabledPropertiesAddIcon /> : <PropertiesAddIcon />;
|
|
27
34
|
case "payments":
|
|
28
|
-
return
|
|
35
|
+
return isDisabled ? (
|
|
36
|
+
<DisabledPaymentMethodsAddIcon />
|
|
37
|
+
) : (
|
|
38
|
+
<PaymentMethodAddIcon />
|
|
39
|
+
);
|
|
29
40
|
default:
|
|
30
|
-
return <AccountsAddIcon />;
|
|
41
|
+
return isDisabled ? <DisabledAccountsAddIcon /> : <AccountsAddIcon />;
|
|
31
42
|
}
|
|
32
43
|
};
|
|
33
44
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
const renderDisabledContent = ({ children }) => (
|
|
46
|
+
<Box
|
|
47
|
+
padding="0"
|
|
48
|
+
minHeight="100%"
|
|
49
|
+
extraStyles="cursor: default;"
|
|
50
|
+
aria-disabled={true}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const renderContent = ({ isLink, destination, dataQa, children, action }) =>
|
|
41
57
|
isLink ? (
|
|
42
58
|
<Link to={destination} data-qa={dataQa} style={{ textDecoration: "none" }}>
|
|
43
|
-
<Box padding="0" minHeight="100%" extraStyles=
|
|
59
|
+
<Box padding="0" minHeight="100%" extraStyles="cursor: pointer;">
|
|
44
60
|
{children}
|
|
45
61
|
</Box>
|
|
46
62
|
</Link>
|
|
@@ -49,13 +65,31 @@ const PlaceholderContentWrapper = ({
|
|
|
49
65
|
onClick={action}
|
|
50
66
|
padding="0"
|
|
51
67
|
minHeight="100%"
|
|
52
|
-
extraStyles=
|
|
68
|
+
extraStyles="cursor: pointer;"
|
|
53
69
|
dataQa={dataQa}
|
|
54
70
|
>
|
|
55
71
|
{children}
|
|
56
72
|
</Box>
|
|
57
73
|
);
|
|
58
74
|
|
|
75
|
+
const PlaceholderContentWrapper = ({
|
|
76
|
+
isLink,
|
|
77
|
+
action,
|
|
78
|
+
destination,
|
|
79
|
+
children,
|
|
80
|
+
isDisabled = false,
|
|
81
|
+
dataQa
|
|
82
|
+
}) =>
|
|
83
|
+
isDisabled
|
|
84
|
+
? renderDisabledContent({ children })
|
|
85
|
+
: renderContent({
|
|
86
|
+
children,
|
|
87
|
+
action,
|
|
88
|
+
isLink,
|
|
89
|
+
destination,
|
|
90
|
+
dataQa
|
|
91
|
+
});
|
|
92
|
+
|
|
59
93
|
const Placeholder = ({
|
|
60
94
|
text,
|
|
61
95
|
action,
|
|
@@ -65,6 +99,7 @@ const Placeholder = ({
|
|
|
65
99
|
variant,
|
|
66
100
|
largeIcon,
|
|
67
101
|
themeValues,
|
|
102
|
+
isDisabled = false,
|
|
68
103
|
dataQa
|
|
69
104
|
}) => (
|
|
70
105
|
<PlaceholderContentWrapper
|
|
@@ -72,6 +107,7 @@ const Placeholder = ({
|
|
|
72
107
|
action={action}
|
|
73
108
|
destination={destination}
|
|
74
109
|
dataQa={dataQa}
|
|
110
|
+
isDisabled={isDisabled}
|
|
75
111
|
>
|
|
76
112
|
<Box
|
|
77
113
|
padding="0"
|
|
@@ -79,7 +115,13 @@ const Placeholder = ({
|
|
|
79
115
|
border="none"
|
|
80
116
|
minHeight={themeValues.height}
|
|
81
117
|
hiddenStyles={!visible}
|
|
82
|
-
extraStyles={
|
|
118
|
+
extraStyles={
|
|
119
|
+
isDisabled
|
|
120
|
+
? `border: 1px dashed ${MANATEE_GREY};
|
|
121
|
+
display: flex;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
align-items:center;`
|
|
124
|
+
: `
|
|
83
125
|
background: linear-gradient(
|
|
84
126
|
to right,
|
|
85
127
|
${variant === "large" ? STORM_GREY : themeValues.color} 40%,
|
|
@@ -99,38 +141,52 @@ const Placeholder = ({
|
|
|
99
141
|
background-size: 5px 1px, 1px 5px;
|
|
100
142
|
display: flex;
|
|
101
143
|
justify-content: center;
|
|
102
|
-
align-items:center;`
|
|
144
|
+
align-items:center;`
|
|
145
|
+
}
|
|
103
146
|
hoverStyles={`background-color: ${
|
|
104
|
-
|
|
147
|
+
isDisabled
|
|
148
|
+
? TRANSPARENT
|
|
149
|
+
: variant === "large"
|
|
150
|
+
? GRECIAN_GREY
|
|
151
|
+
: tint(0.9, themeValues.color)
|
|
105
152
|
};`}
|
|
106
153
|
>
|
|
107
154
|
<Center maxWidth="300px">
|
|
108
155
|
<Box
|
|
109
156
|
padding="0"
|
|
110
157
|
tabIndex="0"
|
|
111
|
-
onKeyPress={e => e.key === "Enter" && action()}
|
|
158
|
+
onKeyPress={e => (isDisabled ? noop : e.key === "Enter" && action())}
|
|
112
159
|
>
|
|
113
160
|
<Cluster justify="center" align="center" minHeight="100%">
|
|
114
161
|
<Switcher maxChildren={2} childGap="0">
|
|
115
162
|
{variant === "large" && <div></div>}
|
|
116
163
|
<Box
|
|
117
164
|
padding="0"
|
|
165
|
+
aria-disabled={isDisabled}
|
|
118
166
|
extraStyles={`.fill {
|
|
119
167
|
fill: ${
|
|
120
|
-
|
|
168
|
+
isDisabled
|
|
169
|
+
? MANATEE_GREY
|
|
170
|
+
: variant === "large"
|
|
171
|
+
? CHARADE_GREY
|
|
172
|
+
: themeValues.color
|
|
121
173
|
};
|
|
122
174
|
} .stroke {
|
|
123
175
|
stroke: ${
|
|
124
|
-
|
|
176
|
+
isDisabled
|
|
177
|
+
? MANATEE_GREY
|
|
178
|
+
: variant === "large"
|
|
179
|
+
? CHARADE_GREY
|
|
180
|
+
: themeValues.color
|
|
125
181
|
};
|
|
126
182
|
} `}
|
|
127
183
|
>
|
|
128
184
|
{variant === "large" ? (
|
|
129
185
|
<Center intrinsic>
|
|
130
|
-
{getLargeIcon(largeIcon)}
|
|
186
|
+
{getLargeIcon(largeIcon, isDisabled)}
|
|
131
187
|
<Text
|
|
132
188
|
variant="pS"
|
|
133
|
-
color={themeValues.color}
|
|
189
|
+
color={isDisabled ? MANATEE_GREY : themeValues.color}
|
|
134
190
|
weight={FONT_WEIGHT_SEMIBOLD}
|
|
135
191
|
extraStyles={`text-align: center;`}
|
|
136
192
|
>
|
|
@@ -140,11 +196,14 @@ const Placeholder = ({
|
|
|
140
196
|
) : (
|
|
141
197
|
<Cover singleChild minHeight="100%">
|
|
142
198
|
<Cluster justify="center" align="center">
|
|
143
|
-
<IconAdd
|
|
199
|
+
<IconAdd
|
|
200
|
+
fill={isDisabled ? MANATEE_GREY : WHITE}
|
|
201
|
+
strokeWidth="2"
|
|
202
|
+
/>
|
|
144
203
|
<Center intrinsic>
|
|
145
204
|
<Text
|
|
146
205
|
variant="pS"
|
|
147
|
-
color={themeValues.color}
|
|
206
|
+
color={isDisabled ? MANATEE_GREY : themeValues.color}
|
|
148
207
|
weight={FONT_WEIGHT_SEMIBOLD}
|
|
149
208
|
extraStyles={`padding: 0 0 0 8px; text-align: center;`}
|
|
150
209
|
>
|
|
@@ -29,6 +29,7 @@ export const placeholder = () => (
|
|
|
29
29
|
text={text("text", "Add an Account", "props")}
|
|
30
30
|
largeIcon={select(iconLabel, icons, defaultIcon, groupId)}
|
|
31
31
|
key="placeholder"
|
|
32
|
+
isDisabled={boolean("isDisabled", false, "props")}
|
|
32
33
|
/>
|
|
33
34
|
);
|
|
34
35
|
|
|
@@ -36,4 +37,5 @@ const story = page({
|
|
|
36
37
|
title: "Components|Atoms/Placeholder",
|
|
37
38
|
Component: Placeholder
|
|
38
39
|
});
|
|
40
|
+
|
|
39
41
|
export default story;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { BRIGHT_GREY, CHARADE_GREY } from "../../../constants/colors";
|
|
2
2
|
|
|
3
|
-
const color = {
|
|
4
|
-
|
|
3
|
+
const color = {
|
|
4
|
+
default: `${CHARADE_GREY}`,
|
|
5
|
+
large: `${BRIGHT_GREY}`
|
|
6
|
+
};
|
|
7
|
+
const height = {
|
|
8
|
+
default: "3rem",
|
|
9
|
+
large: "192px"
|
|
10
|
+
};
|
|
5
11
|
|
|
6
12
|
export const fallbackValues = {
|
|
7
13
|
color,
|
|
@@ -61,7 +61,15 @@ export const SpinnerContainer = styled.div`
|
|
|
61
61
|
containers. Default is false to preserve legacy behavior for past uses.
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
const Spinner = ({
|
|
64
|
+
const Spinner = ({
|
|
65
|
+
size = "24",
|
|
66
|
+
centerSpinner = false,
|
|
67
|
+
themeValues,
|
|
68
|
+
cx = "50",
|
|
69
|
+
cy = "50",
|
|
70
|
+
radius = "25",
|
|
71
|
+
strokeWidth = "6"
|
|
72
|
+
}) => (
|
|
65
73
|
<SpinnerContainer centerSpinner={centerSpinner} size={size}>
|
|
66
74
|
<SpinnerSvgAnimation
|
|
67
75
|
size={size}
|
|
@@ -70,11 +78,11 @@ const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
|
|
|
70
78
|
>
|
|
71
79
|
<circle
|
|
72
80
|
className="path"
|
|
73
|
-
cx=
|
|
74
|
-
cy=
|
|
75
|
-
r=
|
|
81
|
+
cx={cx}
|
|
82
|
+
cy={cy}
|
|
83
|
+
r={radius}
|
|
76
84
|
fill="none"
|
|
77
|
-
strokeWidth=
|
|
85
|
+
strokeWidth={strokeWidth}
|
|
78
86
|
/>
|
|
79
87
|
</SpinnerSvgAnimation>
|
|
80
88
|
</SpinnerContainer>
|
|
@@ -20,9 +20,9 @@ const HiddenToggleSwitchBox = styled.input`
|
|
|
20
20
|
`;
|
|
21
21
|
|
|
22
22
|
const VisibleSwitchComponent = styled.label`
|
|
23
|
-
width:
|
|
23
|
+
width: 44px;
|
|
24
24
|
height: 24px;
|
|
25
|
-
border-radius:
|
|
25
|
+
border-radius: 12px;
|
|
26
26
|
border: none;
|
|
27
27
|
position: relative;
|
|
28
28
|
box-sizing: border-box;
|
|
@@ -41,27 +41,15 @@ const VisibleSwitchComponent = styled.label`
|
|
|
41
41
|
${({ isMobile }) => (isMobile ? `transform: scale(0.75)` : ``)}
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const ToggleSwitchRingComponent = styled.div`
|
|
45
45
|
position: absolute;
|
|
46
|
-
width:
|
|
47
|
-
height:
|
|
46
|
+
width: 16px;
|
|
47
|
+
height: 16px;
|
|
48
48
|
border: none;
|
|
49
49
|
border-radius: 50%;
|
|
50
50
|
box-sizing: border-box;
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
-
const ToggleSwitchInnerRingComponent = styled.div`
|
|
54
|
-
position: absolute;
|
|
55
|
-
width: 14px;
|
|
56
|
-
height: 14px;
|
|
57
|
-
top: 3px;
|
|
58
|
-
left: 3px;
|
|
59
|
-
right: 3px;
|
|
60
|
-
bottom: 3px;
|
|
61
|
-
border-radius: 50%;
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
53
|
const ToggleSwitch = ({
|
|
66
54
|
isOn = false,
|
|
67
55
|
onToggle = noop,
|
|
@@ -73,51 +61,28 @@ const ToggleSwitch = ({
|
|
|
73
61
|
isMobile,
|
|
74
62
|
dataQa
|
|
75
63
|
}) => {
|
|
76
|
-
const
|
|
77
|
-
off: {
|
|
78
|
-
backgroundColor: themeValues.offBackground,
|
|
79
|
-
transition: {
|
|
80
|
-
ease: "easeOut"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
on: {
|
|
84
|
-
backgroundColor: themeValues.onBackground,
|
|
85
|
-
transition: {
|
|
86
|
-
ease: "easeIn"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
disabled: {
|
|
90
|
-
backgroundColor: themeValues.disabledBackground
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const ToggleSwitchMiddleRing = posed(ToggleSwitchMiddleRingComponent)({
|
|
64
|
+
const ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
|
|
95
65
|
off: {
|
|
96
|
-
backgroundColor:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
66
|
+
backgroundColor: disabled
|
|
67
|
+
? themeValues.disabledBackground
|
|
68
|
+
: themeValues.onBackground,
|
|
69
|
+
left: "4px",
|
|
70
|
+
top: "3px",
|
|
71
|
+
bottom: "3px",
|
|
72
|
+
right: "20px",
|
|
101
73
|
transition: {
|
|
102
74
|
ease: "backIn"
|
|
103
75
|
}
|
|
104
76
|
},
|
|
105
77
|
on: {
|
|
106
78
|
backgroundColor: themeValues.white,
|
|
107
|
-
right: "
|
|
108
|
-
top: "
|
|
109
|
-
bottom: "
|
|
110
|
-
left: "
|
|
79
|
+
right: "8px",
|
|
80
|
+
top: "3px",
|
|
81
|
+
bottom: "3px",
|
|
82
|
+
left: "22px",
|
|
111
83
|
transition: {
|
|
112
84
|
ease: "backIn"
|
|
113
85
|
}
|
|
114
|
-
},
|
|
115
|
-
disabled: {
|
|
116
|
-
backgroundColor: themeValues.white,
|
|
117
|
-
left: "2px",
|
|
118
|
-
top: "2px",
|
|
119
|
-
bottom: "2px",
|
|
120
|
-
right: "24px"
|
|
121
86
|
}
|
|
122
87
|
});
|
|
123
88
|
|
|
@@ -133,19 +98,28 @@ const ToggleSwitch = ({
|
|
|
133
98
|
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
134
99
|
},
|
|
135
100
|
off: {
|
|
136
|
-
|
|
101
|
+
border: "1px solid",
|
|
102
|
+
backgroundColor: disabled
|
|
103
|
+
? themeValues.disabledBackgroundLight
|
|
104
|
+
: themeValues.white,
|
|
105
|
+
borderColor: disabled
|
|
106
|
+
? themeValues.disabledBackground
|
|
107
|
+
: themeValues.onBackground,
|
|
137
108
|
transition: {
|
|
138
109
|
ease: "easeOut"
|
|
139
110
|
}
|
|
140
111
|
},
|
|
141
112
|
on: {
|
|
142
|
-
|
|
113
|
+
border: "1px solid",
|
|
114
|
+
backgroundColor: disabled
|
|
115
|
+
? themeValues.disabledBackground
|
|
116
|
+
: themeValues.onBackground,
|
|
117
|
+
borderColor: disabled
|
|
118
|
+
? themeValues.disabledBackground
|
|
119
|
+
: themeValues.onBackground,
|
|
143
120
|
transition: {
|
|
144
121
|
ease: "easeIn"
|
|
145
122
|
}
|
|
146
|
-
},
|
|
147
|
-
disabled: {
|
|
148
|
-
backgroundColor: themeValues.disabledBackground
|
|
149
123
|
}
|
|
150
124
|
});
|
|
151
125
|
|
|
@@ -184,14 +158,12 @@ const ToggleSwitch = ({
|
|
|
184
158
|
htmlFor={`#toggle-${name}`}
|
|
185
159
|
onClick={disabled ? noop : onToggle}
|
|
186
160
|
onKeyDown={disabled ? noop : handleKeyDown}
|
|
187
|
-
pose={
|
|
161
|
+
pose={isOn ? "on" : "off"}
|
|
188
162
|
tabIndex={disabled ? -1 : 0}
|
|
189
163
|
disabled={disabled}
|
|
190
164
|
isMobile={isMobile}
|
|
191
165
|
>
|
|
192
|
-
<
|
|
193
|
-
<ToggleSwitchInnerRing />
|
|
194
|
-
</ToggleSwitchMiddleRing>
|
|
166
|
+
<ToggleSwitchRing />
|
|
195
167
|
</VisibleSwitch>
|
|
196
168
|
</Box>
|
|
197
169
|
</Cover>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, Fragment } from "react";
|
|
2
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
2
|
+
import { boolean, text } from "@storybook/addon-knobs";
|
|
3
3
|
import ToggleSwitch from "./ToggleSwitch";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
5
5
|
|
|
@@ -7,12 +7,11 @@ export const toggleSwitchDefault = () => {
|
|
|
7
7
|
const [isOn, onToggle] = useState(false);
|
|
8
8
|
|
|
9
9
|
const disabled = boolean("disabled", false, "props");
|
|
10
|
-
|
|
11
10
|
return (
|
|
12
11
|
<Fragment>
|
|
13
12
|
<ToggleSwitch
|
|
14
13
|
name="toggle-switch"
|
|
15
|
-
label="Toggle Switch Label"
|
|
14
|
+
label={text("label", "Toggle Switch Label", "props")}
|
|
16
15
|
isOn={isOn}
|
|
17
16
|
onToggle={() => onToggle(!isOn)}
|
|
18
17
|
disabled={disabled}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WHITE,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
ATHENS_GREY,
|
|
4
|
+
MANATEE_GREY,
|
|
5
5
|
MATISSE_BLUE
|
|
6
6
|
} from "../../../constants/colors";
|
|
7
7
|
|
|
8
8
|
const onBackground = `${MATISSE_BLUE}`;
|
|
9
|
-
const disabledBackground = `${
|
|
9
|
+
const disabledBackground = `${MANATEE_GREY}`;
|
|
10
|
+
const disabledBackgroundLight = `${ATHENS_GREY}`;
|
|
10
11
|
const white = `${WHITE}`;
|
|
11
|
-
const offBackground = `${REGENT_GREY}`;
|
|
12
12
|
|
|
13
13
|
const labelStyles = `
|
|
14
14
|
display: flex;
|
|
@@ -29,8 +29,8 @@ const leftLabelStyles = `
|
|
|
29
29
|
export const fallbackValues = {
|
|
30
30
|
onBackground,
|
|
31
31
|
disabledBackground,
|
|
32
|
+
disabledBackgroundLight,
|
|
32
33
|
white,
|
|
33
|
-
offBackground,
|
|
34
34
|
rightLabelStyles,
|
|
35
35
|
leftLabelStyles
|
|
36
36
|
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { Fragment, useContext } from "react";
|
|
2
|
+
import { Box, Cluster } from "../layouts";
|
|
3
|
+
import ButtonWithAction from "../button-with-action";
|
|
4
|
+
import { Center } from "../layouts";
|
|
5
|
+
import Text from "../text/Text";
|
|
6
|
+
import { ThemeContext } from "styled-components";
|
|
7
|
+
import Module from "../../molecules/module/Module";
|
|
8
|
+
import Spinner from "../spinner/Spinner";
|
|
9
|
+
import { CHARADE_GREY } from "../../../constants/colors";
|
|
10
|
+
import { noop } from "../../../util/general";
|
|
11
|
+
|
|
12
|
+
const WalletName = ({
|
|
13
|
+
mainText, // left side text
|
|
14
|
+
action, // right side link/button action
|
|
15
|
+
text = null, // right side non-hyperlinked text
|
|
16
|
+
actionText = null, // right side hyperlinked text
|
|
17
|
+
disableAction = false,
|
|
18
|
+
linkButtonExtraStyles = "", // hyperlinked text extraStyles
|
|
19
|
+
isLoading = false // shows a spinner on the left when true
|
|
20
|
+
}) => {
|
|
21
|
+
const { isMobile } = useContext(ThemeContext);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Fragment>
|
|
25
|
+
<Module spacingBottom={isMobile ? "0" : "1.5rem"}>
|
|
26
|
+
<Cluster
|
|
27
|
+
align="center"
|
|
28
|
+
justify={!!text || !!actionText ? "space-between" : "flex-start"}
|
|
29
|
+
extraStyles={`
|
|
30
|
+
box-shadow: 0px 1px 2px 0px rgba(${CHARADE_GREY}, 0.1);
|
|
31
|
+
box-shadow: 0px 2px 6px 0px rgba(${CHARADE_GREY}, 0.2);
|
|
32
|
+
box-shadow: 0px -1px 0px 0px rgba(${CHARADE_GREY}, 0.1) inset;
|
|
33
|
+
padding: 1.5rem;
|
|
34
|
+
${isMobile ? `span {text-align: right;}` : ``}
|
|
35
|
+
`}
|
|
36
|
+
>
|
|
37
|
+
<Box padding="0">
|
|
38
|
+
{isLoading ? (
|
|
39
|
+
<Center as="span" style={{ padding: "24px 24px 0" }} intrinsic>
|
|
40
|
+
<Spinner
|
|
41
|
+
strokeWidth="2"
|
|
42
|
+
size="24"
|
|
43
|
+
radius="10"
|
|
44
|
+
cx="12"
|
|
45
|
+
cy="12"
|
|
46
|
+
/>
|
|
47
|
+
</Center>
|
|
48
|
+
) : (
|
|
49
|
+
mainText && <Text>{mainText}</Text>
|
|
50
|
+
)}
|
|
51
|
+
</Box>
|
|
52
|
+
{!isMobile && (
|
|
53
|
+
<Box padding="0">
|
|
54
|
+
{text && <Text variant="pXS">{text}</Text>}
|
|
55
|
+
{(text || actionText) && <> </>}
|
|
56
|
+
{action && actionText && (
|
|
57
|
+
<ButtonWithAction
|
|
58
|
+
disabled={disableAction}
|
|
59
|
+
text={actionText}
|
|
60
|
+
action={action}
|
|
61
|
+
variant="smallGhost"
|
|
62
|
+
extraStyles={`
|
|
63
|
+
margin: 0;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
span {font-size: 0.75rem;}
|
|
66
|
+
${linkButtonExtraStyles}
|
|
67
|
+
`}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
</Box>
|
|
71
|
+
)}
|
|
72
|
+
</Cluster>
|
|
73
|
+
</Module>
|
|
74
|
+
{isMobile && (
|
|
75
|
+
<Cluster
|
|
76
|
+
align="center"
|
|
77
|
+
justify={text || actionText ? "flex-end" : "flex-start"}
|
|
78
|
+
extraStyles="margin-top: 0.5rem;"
|
|
79
|
+
>
|
|
80
|
+
{text && <Text extraStyles="font-size: 0.857rem;">{text}</Text>}
|
|
81
|
+
{(text || actionText) && <> </>}
|
|
82
|
+
{action && actionText && (
|
|
83
|
+
<ButtonWithAction
|
|
84
|
+
text={actionText}
|
|
85
|
+
action={action}
|
|
86
|
+
variant="smallGhost"
|
|
87
|
+
disabled={disableAction}
|
|
88
|
+
extraStyles={`
|
|
89
|
+
margin: 0;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
span {font-size: 0.857rem;}
|
|
92
|
+
${linkButtonExtraStyles}
|
|
93
|
+
`}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</Cluster>
|
|
97
|
+
)}
|
|
98
|
+
</Fragment>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default WalletName;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import WalletName from "./WalletName";
|
|
3
|
+
import { text, object, boolean } from "@storybook/addon-knobs";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
export const walletName = () => {
|
|
7
|
+
return (
|
|
8
|
+
<WalletName
|
|
9
|
+
mainText={text("mainText", "Firstname Lastname", "props")}
|
|
10
|
+
action={object("action", () => window.alert("action fired!"), "props")}
|
|
11
|
+
actionText={text("actionText", "Check out as a guest", "props")}
|
|
12
|
+
text={text("text", "Not you?", "props")}
|
|
13
|
+
disableAction={boolean("disableAction", false, "props")}
|
|
14
|
+
isLoading={boolean("isLoading", false, "props")}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const story = page({
|
|
20
|
+
title: "Components|Atoms/WalletName",
|
|
21
|
+
component: WalletName
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
|
|
4
|
+
export interface WalletNameProps {
|
|
5
|
+
action: () => void;
|
|
6
|
+
actionText: string;
|
|
7
|
+
disableAction: boolean;
|
|
8
|
+
mainText: string;
|
|
9
|
+
text?: string | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
buttonExtraStyles?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const WalletName: React.FC<Expand<WalletNameProps> &
|
|
15
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
Binary file
|
|
@@ -40,7 +40,8 @@ const EditableList = ({
|
|
|
40
40
|
listPadding = "0rem 0rem 1.5rem 0rem",
|
|
41
41
|
qaPrefix,
|
|
42
42
|
ariaLabel,
|
|
43
|
-
editItemAriaRole = ""
|
|
43
|
+
editItemAriaRole = "",
|
|
44
|
+
disablePlaceholder = false
|
|
44
45
|
}) => {
|
|
45
46
|
const addText = `Add a${
|
|
46
47
|
itemName[0].match(/[aieouAIEOU]/) ? "n" : ""
|
|
@@ -168,6 +169,7 @@ const EditableList = ({
|
|
|
168
169
|
action={addItem}
|
|
169
170
|
dataQa={"Add " + qaPrefix}
|
|
170
171
|
aria-label={addText}
|
|
172
|
+
isDisabled={disablePlaceholder}
|
|
171
173
|
/>
|
|
172
174
|
</Box>
|
|
173
175
|
)}
|