@thecb/components 10.6.1-beta.0 → 10.6.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.
Files changed (51) hide show
  1. package/dist/index.cjs.js +1052 -302
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +42 -18
  4. package/dist/index.esm.js +1048 -302
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/.DS_Store +0 -0
  8. package/src/components/.DS_Store +0 -0
  9. package/src/components/atoms/.DS_Store +0 -0
  10. package/src/components/atoms/icons/DisabledAccountsAddIcon.js +200 -0
  11. package/src/components/atoms/icons/DisabledPaymentMethodsAddIcon.js +62 -0
  12. package/src/components/atoms/icons/DisabledPropertiesAddIcon.js +54 -0
  13. package/src/components/atoms/icons/PropertiesAddIcon.js +1 -0
  14. package/src/components/atoms/icons/WalletIconSmall.js +3 -7
  15. package/src/components/atoms/icons/icons.stories.js +9 -1
  16. package/src/components/atoms/icons/index.js +7 -1
  17. package/src/components/atoms/index.js +1 -0
  18. package/src/components/atoms/placeholder/Placeholder.js +85 -26
  19. package/src/components/atoms/placeholder/Placeholder.stories.js +2 -0
  20. package/src/components/atoms/placeholder/Placeholder.theme.js +8 -2
  21. package/src/components/atoms/spinner/Spinner.js +13 -5
  22. package/src/components/atoms/spinner/index.d.ts +4 -0
  23. package/src/components/atoms/toggle-switch/ToggleSwitch.js +33 -61
  24. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +2 -3
  25. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +5 -5
  26. package/src/components/atoms/wallet-name/WalletName.js +102 -0
  27. package/src/components/atoms/wallet-name/WalletName.stories.js +24 -0
  28. package/src/components/atoms/wallet-name/index.d.ts +15 -0
  29. package/src/components/atoms/wallet-name/index.js +3 -0
  30. package/src/components/molecules/editable-list/EditableList.js +3 -1
  31. package/src/components/molecules/editable-list/EditableList.stories.js +1 -3
  32. package/src/components/molecules/link-card/LinkCard.theme.js +7 -21
  33. package/src/components/molecules/modal/Modal.js +6 -217
  34. package/src/components/molecules/modal/Modal.stories.js +57 -13
  35. package/src/components/molecules/modal/ModalControlV1.js +234 -0
  36. package/src/components/molecules/modal/ModalControlV2.js +218 -0
  37. package/src/components/molecules/modal/__private__/ButtonLayoutWrapper.js +24 -0
  38. package/src/components/molecules/modal/__private__/CancelButton.js +36 -0
  39. package/src/components/molecules/modal/__private__/CloseButton.js +34 -0
  40. package/src/components/molecules/modal/__private__/CloseIconButton.js +39 -0
  41. package/src/components/molecules/modal/__private__/ContinueButton.js +45 -0
  42. package/src/components/molecules/modal/__private__/index.d.ts +59 -0
  43. package/src/components/molecules/modal/__private__/index.js +5 -0
  44. package/src/components/molecules/partial-amount-form/PartialAmountField.js +49 -0
  45. package/src/components/molecules/partial-amount-form/PartialAmountForm.js +8 -22
  46. package/src/components/molecules/radio-section/InnerRadioSection.js +7 -2
  47. package/src/components/molecules/registration-form/RegistrationForm.js +6 -3
  48. package/src/components/molecules/registration-form/RegistrationForm.state.js +4 -3
  49. package/src/constants/style_constants.d.ts +18 -6
  50. package/src/constants/style_constants.js +23 -20
  51. package/src/components/atoms/icons/.DS_Store +0 -0
@@ -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 = { default: `${CHARADE_GREY}`, large: `${BRIGHT_GREY}` };
4
- const height = { default: "3rem", large: "192px" };
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 = ({ size = "24", centerSpinner = false, themeValues }) => (
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="50"
74
- cy="50"
75
- r="25"
81
+ cx={cx}
82
+ cy={cy}
83
+ r={radius}
76
84
  fill="none"
77
- strokeWidth="6"
85
+ strokeWidth={strokeWidth}
78
86
  />
79
87
  </SpinnerSvgAnimation>
80
88
  </SpinnerContainer>
@@ -4,6 +4,10 @@ import Expand from "../../../util/expand";
4
4
  export interface SpinnerProps {
5
5
  size?: string;
6
6
  centerSpinner?: boolean;
7
+ cx?: string;
8
+ cy?: string;
9
+ radius?: string;
10
+ strokeWidth?: string;
7
11
  }
8
12
 
9
13
  export const Spinner: React.FC<Expand<SpinnerProps> &
@@ -20,9 +20,9 @@ const HiddenToggleSwitchBox = styled.input`
20
20
  `;
21
21
 
22
22
  const VisibleSwitchComponent = styled.label`
23
- width: 48px;
23
+ width: 44px;
24
24
  height: 24px;
25
- border-radius: 48px;
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 ToggleSwitchMiddleRingComponent = styled.div`
44
+ const ToggleSwitchRingComponent = styled.div`
45
45
  position: absolute;
46
- width: 20px;
47
- height: 20px;
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 ToggleSwitchInnerRing = posed(ToggleSwitchInnerRingComponent)({
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: themeValues.white,
97
- left: "2px",
98
- top: "2px",
99
- bottom: "2px",
100
- right: "24px",
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: "1px",
108
- top: "2px",
109
- bottom: "2px",
110
- left: "25px",
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
- backgroundColor: themeValues.offBackground,
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
- backgroundColor: themeValues.onBackground,
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={disabled ? "disabled" : isOn ? "on" : "off"}
161
+ pose={isOn ? "on" : "off"}
188
162
  tabIndex={disabled ? -1 : 0}
189
163
  disabled={disabled}
190
164
  isMobile={isMobile}
191
165
  >
192
- <ToggleSwitchMiddleRing>
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
- REGENT_GREY,
4
- IRON_GREY,
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 = `${IRON_GREY}`;
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) && <>&nbsp;</>}
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) && <>&nbsp;</>}
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>>;
@@ -0,0 +1,3 @@
1
+ import WalletName from "./WalletName";
2
+
3
+ export default WalletName;
@@ -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
  )}
@@ -1,6 +1,4 @@
1
- import React, { useState } from "react";
2
- import { boolean } from "@storybook/addon-knobs";
3
-
1
+ import React from "react";
4
2
  import EditableList from "./EditableList";
5
3
  import page from "../../../../.storybook/page";
6
4
 
@@ -8,27 +8,13 @@ import {
8
8
  TRANSPARENT
9
9
  } from "../../../constants/colors";
10
10
 
11
- const disabledBackgroundColor = {
12
- primary: TRANSPARENT
13
- };
14
- const disabledBorderColor = {
15
- primary: GHOST_GREY
16
- };
17
- const disabledColor = {
18
- primary: MANATEE_GREY
19
- };
20
- const activeBackgroundColor = {
21
- primary: CORNFLOWER_BLUE
22
- };
23
- const backgroundColor = {
24
- primary: LINK_WATER
25
- };
26
- const borderColor = {
27
- primary: MOON_RAKER
28
- };
29
- const color = {
30
- primary: ROYAL_BLUE_VIVID
31
- };
11
+ const disabledBackgroundColor = TRANSPARENT;
12
+ const disabledBorderColor = GHOST_GREY;
13
+ const disabledColor = MANATEE_GREY;
14
+ const activeBackgroundColor = CORNFLOWER_BLUE;
15
+ const backgroundColor = LINK_WATER;
16
+ const borderColor = MOON_RAKER;
17
+ const color = ROYAL_BLUE_VIVID;
32
18
 
33
19
  export const fallbackValues = {
34
20
  disabledBackgroundColor,