@thecb/components 10.6.1-beta.0 → 10.6.2-beta.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/dist/index.cjs.js +1055 -304
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +42 -18
- package/dist/index.esm.js +1051 -304
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- 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/PropertiesAddIcon.js +1 -0
- package/src/components/atoms/icons/WalletIconSmall.js +3 -7
- package/src/components/atoms/icons/icons.stories.js +11 -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 +150 -108
- 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/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.js +6 -217
- package/src/components/molecules/modal/Modal.stories.js +57 -13
- package/src/components/molecules/modal/ModalControlV1.js +234 -0
- package/src/components/molecules/modal/ModalControlV2.js +218 -0
- package/src/components/molecules/modal/__private__/ButtonLayoutWrapper.js +24 -0
- package/src/components/molecules/modal/__private__/CancelButton.js +36 -0
- package/src/components/molecules/modal/__private__/CloseButton.js +34 -0
- package/src/components/molecules/modal/__private__/CloseIconButton.js +39 -0
- package/src/components/molecules/modal/__private__/ContinueButton.js +45 -0
- package/src/components/molecules/modal/__private__/index.d.ts +59 -0
- package/src/components/molecules/modal/__private__/index.js +5 -0
- 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/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.d.ts +18 -6
- package/src/constants/style_constants.js +23 -20
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
|
@@ -6,41 +6,54 @@ import { Box, Switcher, Center, Cluster, Cover } from "../layouts";
|
|
|
6
6
|
import { fallbackValues } from "./Placeholder.theme";
|
|
7
7
|
import { themeComponent } from "../../../util/themeUtils";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
CHARADE_GREY,
|
|
10
|
+
TRANSPARENT,
|
|
11
|
+
MANATEE_GREY
|
|
12
12
|
} from "../../../constants/colors";
|
|
13
13
|
import {
|
|
14
14
|
AccountsAddIcon,
|
|
15
15
|
PropertiesAddIcon,
|
|
16
|
-
|
|
17
|
-
PaymentMethodAddIcon
|
|
16
|
+
PlusCircleIcon,
|
|
17
|
+
PaymentMethodAddIcon,
|
|
18
|
+
DisabledAccountsAddIcon,
|
|
19
|
+
DisabledPropertiesAddIcon,
|
|
20
|
+
DisabledPaymentMethodsAddIcon
|
|
18
21
|
} from "../icons";
|
|
19
22
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
23
|
+
import { noop } from "../../../util/general";
|
|
20
24
|
|
|
21
|
-
const getLargeIcon = iconName => {
|
|
25
|
+
const getLargeIcon = (iconName, isDisabled) => {
|
|
22
26
|
switch (iconName) {
|
|
23
27
|
case "accounts":
|
|
24
|
-
return <AccountsAddIcon />;
|
|
28
|
+
return isDisabled ? <DisabledAccountsAddIcon /> : <AccountsAddIcon />;
|
|
25
29
|
case "properties":
|
|
26
|
-
return <PropertiesAddIcon />;
|
|
30
|
+
return isDisabled ? <DisabledPropertiesAddIcon /> : <PropertiesAddIcon />;
|
|
27
31
|
case "payments":
|
|
28
|
-
return
|
|
32
|
+
return isDisabled ? (
|
|
33
|
+
<DisabledPaymentMethodsAddIcon />
|
|
34
|
+
) : (
|
|
35
|
+
<PaymentMethodAddIcon />
|
|
36
|
+
);
|
|
29
37
|
default:
|
|
30
|
-
return <AccountsAddIcon />;
|
|
38
|
+
return isDisabled ? <DisabledAccountsAddIcon /> : <AccountsAddIcon />;
|
|
31
39
|
}
|
|
32
40
|
};
|
|
33
41
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const renderDisabledContent = ({ children }) => (
|
|
43
|
+
<Box
|
|
44
|
+
padding="0"
|
|
45
|
+
minHeight="100%"
|
|
46
|
+
extraStyles="cursor: default;"
|
|
47
|
+
aria-disabled={true}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</Box>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const renderContent = ({ isLink, destination, dataQa, children, action }) =>
|
|
41
54
|
isLink ? (
|
|
42
55
|
<Link to={destination} data-qa={dataQa} style={{ textDecoration: "none" }}>
|
|
43
|
-
<Box padding="0" minHeight="100%" extraStyles=
|
|
56
|
+
<Box padding="0" minHeight="100%" extraStyles="cursor: pointer;">
|
|
44
57
|
{children}
|
|
45
58
|
</Box>
|
|
46
59
|
</Link>
|
|
@@ -49,13 +62,31 @@ const PlaceholderContentWrapper = ({
|
|
|
49
62
|
onClick={action}
|
|
50
63
|
padding="0"
|
|
51
64
|
minHeight="100%"
|
|
52
|
-
extraStyles=
|
|
65
|
+
extraStyles="cursor: pointer;"
|
|
53
66
|
dataQa={dataQa}
|
|
54
67
|
>
|
|
55
68
|
{children}
|
|
56
69
|
</Box>
|
|
57
70
|
);
|
|
58
71
|
|
|
72
|
+
const PlaceholderContentWrapper = ({
|
|
73
|
+
isLink,
|
|
74
|
+
action,
|
|
75
|
+
destination,
|
|
76
|
+
children,
|
|
77
|
+
isDisabled = false,
|
|
78
|
+
dataQa
|
|
79
|
+
}) =>
|
|
80
|
+
isDisabled
|
|
81
|
+
? renderDisabledContent({ children })
|
|
82
|
+
: renderContent({
|
|
83
|
+
children,
|
|
84
|
+
action,
|
|
85
|
+
isLink,
|
|
86
|
+
destination,
|
|
87
|
+
dataQa
|
|
88
|
+
});
|
|
89
|
+
|
|
59
90
|
const Placeholder = ({
|
|
60
91
|
text,
|
|
61
92
|
action,
|
|
@@ -65,103 +96,114 @@ const Placeholder = ({
|
|
|
65
96
|
variant,
|
|
66
97
|
largeIcon,
|
|
67
98
|
themeValues,
|
|
99
|
+
isDisabled = false,
|
|
68
100
|
dataQa
|
|
69
|
-
}) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
borderRadius="4px"
|
|
79
|
-
border="none"
|
|
80
|
-
minHeight={themeValues.height}
|
|
81
|
-
hiddenStyles={!visible}
|
|
82
|
-
extraStyles={`
|
|
83
|
-
background: linear-gradient(
|
|
84
|
-
to right,
|
|
85
|
-
${variant === "large" ? STORM_GREY : themeValues.color} 40%,
|
|
86
|
-
rgba(255, 255, 255, 0) 0%
|
|
87
|
-
),
|
|
88
|
-
linear-gradient(${
|
|
89
|
-
variant === "large" ? STORM_GREY : themeValues.color
|
|
90
|
-
} 40%, rgba(255, 255, 255, 0) 0%),
|
|
91
|
-
linear-gradient(to right, ${
|
|
92
|
-
variant === "large" ? STORM_GREY : themeValues.color
|
|
93
|
-
} 40%, rgba(255, 255, 255, 0) 0%),
|
|
94
|
-
linear-gradient(${
|
|
95
|
-
variant === "large" ? STORM_GREY : themeValues.color
|
|
96
|
-
} 40%, rgba(255, 255, 255, 0) 0%);
|
|
97
|
-
background-position: top, right, bottom, left;
|
|
98
|
-
background-repeat: repeat-x, repeat-y;
|
|
99
|
-
background-size: 5px 1px, 1px 5px;
|
|
100
|
-
display: flex;
|
|
101
|
-
justify-content: center;
|
|
102
|
-
align-items:center;`}
|
|
103
|
-
hoverStyles={`background-color: ${
|
|
104
|
-
variant === "large" ? GRECIAN_GREY : tint(0.9, themeValues.color)
|
|
105
|
-
};`}
|
|
101
|
+
}) => {
|
|
102
|
+
const borderColor = isDisabled ? MANATEE_GREY : themeValues.color;
|
|
103
|
+
return (
|
|
104
|
+
<PlaceholderContentWrapper
|
|
105
|
+
isLink={isLink}
|
|
106
|
+
action={action}
|
|
107
|
+
destination={destination}
|
|
108
|
+
dataQa={dataQa}
|
|
109
|
+
isDisabled={isDisabled}
|
|
106
110
|
>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
<Box
|
|
112
|
+
padding="0"
|
|
113
|
+
borderRadius="4px"
|
|
114
|
+
border="none"
|
|
115
|
+
minHeight={themeValues.height}
|
|
116
|
+
hiddenStyles={!visible}
|
|
117
|
+
extraStyles={`
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
align-items:center;
|
|
121
|
+
background-image: repeating-linear-gradient(0deg, ${borderColor}, ${borderColor} 2px, transparent 2px, transparent 4px, ${borderColor} 4px), repeating-linear-gradient(90deg, ${borderColor}, ${borderColor} 2px, transparent 2px, transparent 4px, ${borderColor} 4px), repeating-linear-gradient(180deg, ${borderColor}, ${borderColor} 2px, transparent 2px, transparent 4px, ${borderColor} 4px), repeating-linear-gradient(270deg, ${borderColor}, ${borderColor} 2px, transparent 2px, transparent 4px, ${borderColor} 4px);
|
|
122
|
+
background-size: 2px 100%, 100% 2px, 2px 100% , 100% 2px;
|
|
123
|
+
background-position: 0 0, 0 0, 100% 0, 0 100%;
|
|
124
|
+
background-repeat: no-repeat;
|
|
125
|
+
`}
|
|
126
|
+
hoverStyles={`background-color: ${
|
|
127
|
+
isDisabled ? TRANSPARENT : tint(0.9, themeValues.color)
|
|
128
|
+
};`}
|
|
129
|
+
activeStyles={`background-color: ${
|
|
130
|
+
isDisabled ? TRANSPARENT : tint(0.8, themeValues.color)
|
|
131
|
+
};`}
|
|
132
|
+
>
|
|
133
|
+
<Center maxWidth="300px">
|
|
134
|
+
<Box
|
|
135
|
+
padding="0"
|
|
136
|
+
tabIndex="0"
|
|
137
|
+
onKeyPress={e =>
|
|
138
|
+
isDisabled ? noop : e.key === "Enter" && action()
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
<Cluster justify="center" align="center" minHeight="100%">
|
|
142
|
+
<Switcher maxChildren={2} childGap="0">
|
|
143
|
+
{variant === "large" && <div></div>}
|
|
144
|
+
<Box
|
|
145
|
+
padding="0"
|
|
146
|
+
aria-disabled={isDisabled}
|
|
147
|
+
extraStyles={`.fill {
|
|
119
148
|
fill: ${
|
|
120
|
-
|
|
149
|
+
isDisabled
|
|
150
|
+
? MANATEE_GREY
|
|
151
|
+
: variant === "large"
|
|
152
|
+
? CHARADE_GREY
|
|
153
|
+
: themeValues.color
|
|
121
154
|
};
|
|
122
155
|
} .stroke {
|
|
123
156
|
stroke: ${
|
|
124
|
-
|
|
157
|
+
isDisabled
|
|
158
|
+
? MANATEE_GREY
|
|
159
|
+
: variant === "large"
|
|
160
|
+
? CHARADE_GREY
|
|
161
|
+
: themeValues.color
|
|
125
162
|
};
|
|
126
163
|
} `}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
>
|
|
165
|
+
{variant === "large" ? (
|
|
166
|
+
<Center intrinsic>
|
|
167
|
+
{getLargeIcon(largeIcon, isDisabled)}
|
|
168
|
+
<Text
|
|
169
|
+
variant="pS"
|
|
170
|
+
color={isDisabled ? MANATEE_GREY : themeValues.color}
|
|
171
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
172
|
+
extraStyles={`text-align: center;`}
|
|
173
|
+
>
|
|
174
|
+
{text}
|
|
175
|
+
</Text>
|
|
176
|
+
</Center>
|
|
177
|
+
) : (
|
|
178
|
+
<Cover singleChild minHeight="100%">
|
|
179
|
+
<Cluster justify="center" align="center">
|
|
180
|
+
<PlusCircleIcon
|
|
181
|
+
color={isDisabled ? MANATEE_GREY : themeValues.color}
|
|
182
|
+
/>
|
|
183
|
+
<Center intrinsic>
|
|
184
|
+
<Text
|
|
185
|
+
variant="pS"
|
|
186
|
+
color={
|
|
187
|
+
isDisabled ? MANATEE_GREY : themeValues.color
|
|
188
|
+
}
|
|
189
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
190
|
+
extraStyles={`padding: 0 0 0 8px; text-align: center;`}
|
|
191
|
+
>
|
|
192
|
+
{text}
|
|
193
|
+
</Text>
|
|
194
|
+
</Center>
|
|
195
|
+
</Cluster>
|
|
196
|
+
</Cover>
|
|
197
|
+
)}
|
|
198
|
+
</Box>
|
|
199
|
+
</Switcher>
|
|
200
|
+
</Cluster>
|
|
201
|
+
</Box>
|
|
202
|
+
</Center>
|
|
203
|
+
</Box>
|
|
204
|
+
</PlaceholderContentWrapper>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
165
207
|
|
|
166
208
|
export default themeComponent(
|
|
167
209
|
Placeholder,
|
|
@@ -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
|
};
|