@thecb/components 10.4.6-beta.6 → 10.4.7-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.4.6-beta.6",
3
+ "version": "10.4.7-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -48,5 +48,4 @@ export { default as TypeaheadInput } from "./typeahead-input";
48
48
  export { default as Card } from "./card";
49
49
  export { default as NavTabs } from "./nav-tabs";
50
50
  export { default as LoadingLine } from "./loading-line";
51
- export { default as WalletName } from "./wallet-name";
52
51
  export * from "./table";
@@ -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,54 +61,32 @@ 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: "4px",
82
+ left: "23px",
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
 
89
+ // to do: for disabled, background color should not be white (should be lighter disabled background)
124
90
  const VisibleSwitch = posed(VisibleSwitchComponent)({
125
91
  focusable: true,
126
92
  hoverable: true,
@@ -133,19 +99,28 @@ const ToggleSwitch = ({
133
99
  boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
134
100
  },
135
101
  off: {
136
- backgroundColor: themeValues.offBackground,
102
+ border: "1px solid",
103
+ backgroundColor: disabled
104
+ ? themeValues.disabledBackgroundLight
105
+ : themeValues.white,
106
+ borderColor: disabled
107
+ ? themeValues.disabledBackground
108
+ : themeValues.onBackground,
137
109
  transition: {
138
110
  ease: "easeOut"
139
111
  }
140
112
  },
141
113
  on: {
142
- backgroundColor: themeValues.onBackground,
114
+ border: "1px solid",
115
+ backgroundColor: disabled
116
+ ? themeValues.disabledBackground
117
+ : themeValues.onBackground,
118
+ borderColor: disabled
119
+ ? themeValues.disabledBackground
120
+ : themeValues.onBackground,
143
121
  transition: {
144
122
  ease: "easeIn"
145
123
  }
146
- },
147
- disabled: {
148
- backgroundColor: themeValues.disabledBackground
149
124
  }
150
125
  });
151
126
 
@@ -184,14 +159,12 @@ const ToggleSwitch = ({
184
159
  htmlFor={`#toggle-${name}`}
185
160
  onClick={disabled ? noop : onToggle}
186
161
  onKeyDown={disabled ? noop : handleKeyDown}
187
- pose={disabled ? "disabled" : isOn ? "on" : "off"}
162
+ pose={isOn ? "on" : "off"}
188
163
  tabIndex={disabled ? -1 : 0}
189
164
  disabled={disabled}
190
165
  isMobile={isMobile}
191
166
  >
192
- <ToggleSwitchMiddleRing>
193
- <ToggleSwitchInnerRing />
194
- </ToggleSwitchMiddleRing>
167
+ <ToggleSwitchRing />
195
168
  </VisibleSwitch>
196
169
  </Box>
197
170
  </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,12 @@ export const toggleSwitchDefault = () => {
7
7
  const [isOn, onToggle] = useState(false);
8
8
 
9
9
  const disabled = boolean("disabled", false, "props");
10
-
10
+ const label = text(label, "Toggle Switch Label", "props");
11
11
  return (
12
12
  <Fragment>
13
13
  <ToggleSwitch
14
14
  name="toggle-switch"
15
- label="Toggle Switch Label"
15
+ label={label}
16
16
  isOn={isOn}
17
17
  onToggle={() => onToggle(!isOn)}
18
18
  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
  };
@@ -3,6 +3,7 @@ import Modal from "../modal";
3
3
  import Text from "../../atoms/text";
4
4
  import Paragraph from "../../atoms/paragraph";
5
5
  import { Box, Stack, Center } from "../../atoms/layouts";
6
+ import ButtonWithAction from "../../atoms/button-with-action/ButtonWithAction";
6
7
  import { fallbackValues } from "./AccountAndRoutingModal.theme";
7
8
  import { themeComponent } from "../../../util/themeUtils";
8
9
  import { AccountNumberImage, RoutingNumberImage } from "../../atoms/icons";
@@ -18,57 +19,56 @@ const AccountAndRoutingModal = ({
18
19
  imageType,
19
20
  themeValues,
20
21
  dataQa = null
21
- }) => (
22
- <Modal
23
- modalOpen={isOpen}
24
- hideModal={() => toggleOpen(false)}
25
- showModal={() => toggleOpen(true)}
26
- modalHeaderText={title}
27
- dataQa={dataQa}
28
- modalBodyText={
29
- <Box extraStyles="overflow: scroll; max-height: 20rem;">
30
- <Stack>
31
- <Paragraph variant="p">{content}</Paragraph>
32
- {imageType === "Account" ? (
33
- <Center intrinsic>
34
- <AccountNumberImage />
35
- </Center>
36
- ) : imageType === "Routing" ? (
37
- <Center intrinsic>
38
- <RoutingNumberImage />
39
- </Center>
40
- ) : (
41
- <Fragment />
42
- )}
43
- </Stack>
44
- </Box>
45
- }
46
- defaultWrapper={false}
47
- onlyCloseButton={!acceptText}
48
- continueButtonText={acceptText}
49
- continueAction={() => {
50
- toggleAccepted(true);
51
- toggleOpen(false);
52
- }}
53
- initialFocusSelector={"[name='Close']"}
54
- >
55
- <Text
56
- variant="pS"
57
- onClick={() => toggleOpen(true)}
58
- onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
59
- tabIndex="0"
60
- color={themeValues.linkColor}
61
- weight={themeValues.fontWeight}
62
- hoverStyles={themeValues.modalLinkHoverFocus}
63
- textDecoration={themeValues.linkTextDecoration}
64
- extraStyles={`cursor: pointer;`}
65
- role="button"
66
- className="modal-trigger"
22
+ }) => {
23
+ return (
24
+ <Modal
25
+ modalOpen={isOpen}
26
+ hideModal={() => toggleOpen(false)}
27
+ showModal={() => toggleOpen(true)}
28
+ modalHeaderText={title}
29
+ dataQa={dataQa}
30
+ modalBodyText={
31
+ <Box extraStyles="overflow: scroll; max-height: 20rem;">
32
+ <Stack>
33
+ <Paragraph variant="p">{content}</Paragraph>
34
+ {imageType === "Account" ? (
35
+ <Center intrinsic>
36
+ <AccountNumberImage />
37
+ </Center>
38
+ ) : imageType === "Routing" ? (
39
+ <Center intrinsic>
40
+ <RoutingNumberImage />
41
+ </Center>
42
+ ) : (
43
+ <Fragment />
44
+ )}
45
+ </Stack>
46
+ </Box>
47
+ }
48
+ defaultWrapper={false}
49
+ onlyCloseButton={!acceptText}
50
+ continueButtonText={acceptText}
51
+ continueAction={() => {
52
+ toggleAccepted(true);
53
+ toggleOpen(false);
54
+ }}
55
+ initialFocusSelector={"[name='Close']"}
67
56
  >
68
- {link}
69
- </Text>
70
- </Modal>
71
- );
57
+ <ButtonWithAction
58
+ variant="ghost"
59
+ tabIndex="0"
60
+ onClick={() => toggleOpen(true)}
61
+ onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
62
+ extraStyles="min-width: 0; min-height: 0;margin: 0; padding: 0; text-transform: none;"
63
+ text={
64
+ <Text variant="pS" color="inherit">
65
+ {link}
66
+ </Text>
67
+ }
68
+ />
69
+ </Modal>
70
+ );
71
+ };
72
72
 
73
73
  export default themeComponent(
74
74
  AccountAndRoutingModal,