@thecb/components 10.6.2-beta.7 → 10.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.6.2-beta.7",
3
+ "version": "10.6.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { fallbackValues } from "./Icons.theme";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
 
5
- const WalletIconSmall = ({ themeValues, iconIndex = 0 }) => {
5
+ const WalletIconSmall = ({ themeValues, iconIndex = 0, colorOverride }) => {
6
6
  return (
7
7
  <svg
8
8
  width="20"
@@ -15,7 +15,7 @@ const WalletIconSmall = ({ themeValues, iconIndex = 0 }) => {
15
15
  fillRule="evenodd"
16
16
  clipRule="evenodd"
17
17
  d="M16.3125 6.94643C16.0446 6.70536 15.7232 6.57143 15.3482 6.57143L5.14283 6.57143C5.0089 6.57143 4.90176 6.54464 4.8214 6.46429C4.74104 6.38393 4.71426 6.27678 4.71426 6.14286C4.71426 6.03571 4.74104 5.92857 4.8214 5.84821C4.90176 5.76786 5.0089 5.71428 5.14283 5.71428L15.4285 5.71428C15.5357 5.71428 15.6428 5.6875 15.7232 5.60714C15.8035 5.52678 15.8571 5.41964 15.8571 5.28571C15.8571 4.9375 15.7232 4.64286 15.4821 4.375C15.2143 4.13393 14.9196 4 14.5714 4L4.71426 4C4.23211 4 3.80354 4.1875 3.48211 4.50893C3.16068 4.83036 2.99997 5.23214 2.99997 5.71428V14.2857C2.99997 14.7679 3.16068 15.1964 3.48211 15.5179C3.80354 15.8393 4.23211 16 4.71426 16L15.3482 16C15.7232 16 16.0446 15.8929 16.3125 15.625C16.5803 15.3839 16.7143 15.0893 16.7143 14.7143V7.85714C16.7143 7.50893 16.5803 7.21428 16.3125 6.94643ZM12.7142 13.143C13.661 13.143 14.4285 12.3755 14.4285 11.4288C14.4285 10.482 13.661 9.71447 12.7142 9.71447C11.7674 9.71447 10.9999 10.482 10.9999 11.4288C10.9999 12.3755 11.7674 13.143 12.7142 13.143Z"
18
- fill={themeValues.singleIconColor}
18
+ fill={colorOverride || themeValues.singleIconColor}
19
19
  />
20
20
  <mask
21
21
  id={`mask0_503_574-${iconIndex}`}
@@ -34,7 +34,11 @@ const WalletIconSmall = ({ themeValues, iconIndex = 0 }) => {
34
34
  />
35
35
  </mask>
36
36
  <g mask={`url(#mask0_503_574-${iconIndex})`}>
37
- <rect width="20" height="20" fill={themeValues.singleIconColor} />
37
+ <rect
38
+ width="20"
39
+ height="20"
40
+ fill={colorOverride || themeValues.singleIconColor}
41
+ />
38
42
  </g>
39
43
  </svg>
40
44
  );
@@ -32,7 +32,6 @@ import {
32
32
  FailedIcon,
33
33
  PencilIcon,
34
34
  PendingIcon,
35
- PlusCircleIcon,
36
35
  RefundIcon,
37
36
  RejectedIcon,
38
37
  RejectedVelocityIcon,
@@ -59,7 +58,6 @@ export const accountsIcon = () => <AccountsIcon />;
59
58
  export const accountsAddIcon = () => <AccountsAddIcon />;
60
59
  export const forgotPasswordIcon = () => <ForgotPasswordIcon />;
61
60
  export const goToEmailIcon = () => <GoToEmailIcon />;
62
- export const plusCircleIcon = () => <PlusCircleIcon />;
63
61
  export const verifiedEmailIcon = () => <VerifiedEmailIcon />;
64
62
  export const paymentMethodIcon = () => <PaymentMethodIcon />;
65
63
  export const accountsIconSmall = () => <AccountsIconSmall />;
@@ -31,7 +31,6 @@ const Box = forwardRef(
31
31
  hoverStyles,
32
32
  activeStyles,
33
33
  disabledStyles,
34
- focusStyles,
35
34
  variant,
36
35
  as,
37
36
  onClick,
@@ -69,7 +68,6 @@ const Box = forwardRef(
69
68
  hoverStyles={hoverStyles}
70
69
  activeStyles={activeStyles}
71
70
  disabledStyles={disabledStyles}
72
- focusStyles={focusStyles}
73
71
  variant={variant}
74
72
  as={as}
75
73
  onClick={onClick}
@@ -13,7 +13,6 @@ import { ROYAL_BLUE } from "../../../constants/colors";
13
13
  export const BoxWrapper = styled(
14
14
  ({
15
15
  activeStyles,
16
- focusStyles,
17
16
  hoverStyles,
18
17
  disabledStyles,
19
18
  extraStyles,
@@ -65,9 +64,8 @@ export const BoxWrapper = styled(
65
64
  }
66
65
 
67
66
  &:focus {
68
- ${({ focusStyles, as }) =>
67
+ ${({ as }) =>
69
68
  css`
70
- ${focusStyles}
71
69
  outline: 3px solid ${ROYAL_BLUE};
72
70
  outline-offset: 2px;
73
71
  ${as === "button" &&
@@ -5,17 +5,25 @@ import Text from "../text";
5
5
  import { Box, Switcher, Center, Cluster, Cover } from "../layouts";
6
6
  import { fallbackValues } from "./Placeholder.theme";
7
7
  import { themeComponent } from "../../../util/themeUtils";
8
- import { TRANSPARENT, MANATEE_GREY } from "../../../constants/colors";
8
+ import {
9
+ STORM_GREY,
10
+ GRECIAN_GREY,
11
+ CHARADE_GREY,
12
+ WHITE,
13
+ TRANSPARENT,
14
+ MANATEE_GREY
15
+ } from "../../../constants/colors";
9
16
  import {
10
17
  AccountsAddIcon,
11
18
  PropertiesAddIcon,
12
- PlusCircleIcon,
19
+ IconAdd,
13
20
  PaymentMethodAddIcon,
14
21
  DisabledAccountsAddIcon,
15
22
  DisabledPropertiesAddIcon,
16
23
  DisabledPaymentMethodsAddIcon
17
24
  } from "../icons";
18
25
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
26
+ import { noop } from "../../../util/general";
19
27
 
20
28
  const getLargeIcon = (iconName, isDisabled) => {
21
29
  switch (iconName) {
@@ -59,8 +67,6 @@ const renderContent = ({ isLink, destination, dataQa, children, action }) =>
59
67
  minHeight="100%"
60
68
  extraStyles="cursor: pointer;"
61
69
  dataQa={dataQa}
62
- tabIndex="0"
63
- onKeyPress={e => e.key === "Enter" && action()}
64
70
  >
65
71
  {children}
66
72
  </Box>
@@ -95,97 +101,126 @@ const Placeholder = ({
95
101
  themeValues,
96
102
  isDisabled = false,
97
103
  dataQa
98
- }) => {
99
- const borderColor = isDisabled ? MANATEE_GREY : themeValues.color;
100
- return (
101
- <PlaceholderContentWrapper
102
- isLink={isLink}
103
- action={action}
104
- destination={destination}
105
- dataQa={dataQa}
106
- isDisabled={isDisabled}
104
+ }) => (
105
+ <PlaceholderContentWrapper
106
+ isLink={isLink}
107
+ action={action}
108
+ destination={destination}
109
+ dataQa={dataQa}
110
+ isDisabled={isDisabled}
111
+ >
112
+ <Box
113
+ padding="0"
114
+ borderRadius="4px"
115
+ border="none"
116
+ minHeight={themeValues.height}
117
+ hiddenStyles={!visible}
118
+ extraStyles={
119
+ isDisabled
120
+ ? `border: 1px dashed ${MANATEE_GREY};
121
+ display: flex;
122
+ justify-content: center;
123
+ align-items:center;`
124
+ : `
125
+ background: linear-gradient(
126
+ to right,
127
+ ${variant === "large" ? STORM_GREY : themeValues.color} 40%,
128
+ rgba(255, 255, 255, 0) 0%
129
+ ),
130
+ linear-gradient(${
131
+ variant === "large" ? STORM_GREY : themeValues.color
132
+ } 40%, rgba(255, 255, 255, 0) 0%),
133
+ linear-gradient(to right, ${
134
+ variant === "large" ? STORM_GREY : themeValues.color
135
+ } 40%, rgba(255, 255, 255, 0) 0%),
136
+ linear-gradient(${
137
+ variant === "large" ? STORM_GREY : themeValues.color
138
+ } 40%, rgba(255, 255, 255, 0) 0%);
139
+ background-position: top, right, bottom, left;
140
+ background-repeat: repeat-x, repeat-y;
141
+ background-size: 5px 1px, 1px 5px;
142
+ display: flex;
143
+ justify-content: center;
144
+ align-items:center;`
145
+ }
146
+ hoverStyles={`background-color: ${
147
+ isDisabled
148
+ ? TRANSPARENT
149
+ : variant === "large"
150
+ ? GRECIAN_GREY
151
+ : tint(0.9, themeValues.color)
152
+ };`}
107
153
  >
108
- <Box
109
- padding="0"
110
- borderRadius="4px"
111
- border="none"
112
- minHeight={themeValues.height}
113
- hiddenStyles={!visible}
114
- extraStyles={`
115
- display: flex;
116
- justify-content: center;
117
- align-items:center;
118
- 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);
119
- background-size: 2px 100%, 100% 2px, 2px 100% , 100% 2px;
120
- background-position: 0 0, 0 0, 100% 0, 0 100%;
121
- background-repeat: no-repeat;
122
- `}
123
- hoverStyles={`background-color: ${
124
- isDisabled ? TRANSPARENT : tint(0.9, themeValues.color)
125
- };`}
126
- focusStyles={`background-color: ${
127
- isDisabled ? TRANSPARENT : tint(0.9, themeValues.color)
128
- };`}
129
- activeStyles={`background-color: ${
130
- isDisabled ? TRANSPARENT : tint(0.8, themeValues.color)
131
- }; ${!isDisabled && `background-image:none; border: 2px solid ${borderColor};}`}`}
132
- >
133
- <Center maxWidth="300px">
134
- <Box padding="0">
135
- <Cluster justify="center" align="center" minHeight="100%">
136
- <Switcher maxChildren={2} childGap="0">
137
- {variant === "large" && <div></div>}
138
- <Box
139
- padding="0"
140
- aria-disabled={isDisabled}
141
- extraStyles={`.fill {
142
- fill: ${isDisabled ? MANATEE_GREY : themeValues.color};
154
+ <Center maxWidth="300px">
155
+ <Box
156
+ padding="0"
157
+ tabIndex="0"
158
+ onKeyPress={e => (isDisabled ? noop : e.key === "Enter" && action())}
159
+ >
160
+ <Cluster justify="center" align="center" minHeight="100%">
161
+ <Switcher maxChildren={2} childGap="0">
162
+ {variant === "large" && <div></div>}
163
+ <Box
164
+ padding="0"
165
+ aria-disabled={isDisabled}
166
+ extraStyles={`.fill {
167
+ fill: ${
168
+ isDisabled
169
+ ? MANATEE_GREY
170
+ : variant === "large"
171
+ ? CHARADE_GREY
172
+ : themeValues.color
173
+ };
143
174
  } .stroke {
144
- stroke: ${isDisabled ? MANATEE_GREY : themeValues.color};
175
+ stroke: ${
176
+ isDisabled
177
+ ? MANATEE_GREY
178
+ : variant === "large"
179
+ ? CHARADE_GREY
180
+ : themeValues.color
181
+ };
145
182
  } `}
146
- >
147
- {variant === "large" ? (
148
- <Center intrinsic>
149
- {getLargeIcon(largeIcon, isDisabled)}
150
- <Text
151
- variant="pS"
152
- color={isDisabled ? MANATEE_GREY : themeValues.color}
153
- weight={FONT_WEIGHT_SEMIBOLD}
154
- extraStyles={`text-align: center;`}
155
- >
156
- {text}
157
- </Text>
158
- </Center>
159
- ) : (
160
- <Cover singleChild minHeight="100%">
161
- <Cluster justify="center" align="center">
162
- <PlusCircleIcon
183
+ >
184
+ {variant === "large" ? (
185
+ <Center intrinsic>
186
+ {getLargeIcon(largeIcon, isDisabled)}
187
+ <Text
188
+ variant="pS"
189
+ color={isDisabled ? MANATEE_GREY : themeValues.color}
190
+ weight={FONT_WEIGHT_SEMIBOLD}
191
+ extraStyles={`text-align: center;`}
192
+ >
193
+ {text}
194
+ </Text>
195
+ </Center>
196
+ ) : (
197
+ <Cover singleChild minHeight="100%">
198
+ <Cluster justify="center" align="center">
199
+ <IconAdd
200
+ fill={isDisabled ? MANATEE_GREY : WHITE}
201
+ strokeWidth="2"
202
+ />
203
+ <Center intrinsic>
204
+ <Text
205
+ variant="pS"
163
206
  color={isDisabled ? MANATEE_GREY : themeValues.color}
164
- />
165
- <Center intrinsic>
166
- <Text
167
- variant="pS"
168
- color={
169
- isDisabled ? MANATEE_GREY : themeValues.color
170
- }
171
- weight={FONT_WEIGHT_SEMIBOLD}
172
- extraStyles={`padding: 0 0 0 8px; text-align: center;`}
173
- >
174
- {text}
175
- </Text>
176
- </Center>
177
- </Cluster>
178
- </Cover>
179
- )}
180
- </Box>
181
- </Switcher>
182
- </Cluster>
183
- </Box>
184
- </Center>
185
- </Box>
186
- </PlaceholderContentWrapper>
187
- );
188
- };
207
+ weight={FONT_WEIGHT_SEMIBOLD}
208
+ extraStyles={`padding: 0 0 0 8px; text-align: center;`}
209
+ >
210
+ {text}
211
+ </Text>
212
+ </Center>
213
+ </Cluster>
214
+ </Cover>
215
+ )}
216
+ </Box>
217
+ </Switcher>
218
+ </Cluster>
219
+ </Box>
220
+ </Center>
221
+ </Box>
222
+ </PlaceholderContentWrapper>
223
+ );
189
224
 
190
225
  export default themeComponent(
191
226
  Placeholder,
@@ -30,7 +30,6 @@ export const placeholder = () => (
30
30
  largeIcon={select(iconLabel, icons, defaultIcon, groupId)}
31
31
  key="placeholder"
32
32
  isDisabled={boolean("isDisabled", false, "props")}
33
- action={() => console.log("placeholder action")}
34
33
  />
35
34
  );
36
35
 
@@ -1,10 +1,7 @@
1
1
  import React from "react";
2
- import { number, boolean } from "@storybook/addon-knobs";
3
2
  import EditableList from "./EditableList";
4
3
  import page from "../../../../.storybook/page";
5
4
 
6
- const groupId = "props";
7
-
8
5
  const story = page({
9
6
  title: "Components|Molecules/EditableList",
10
7
  Component: EditableList
@@ -15,9 +12,7 @@ export const editableList = () => {
15
12
  return (
16
13
  <EditableList
17
14
  as="h2"
18
- canRemove={boolean("Can Remove", false, groupId)}
19
- canAdd={boolean("Can Add", true, groupId)}
20
- canEdit={boolean("Can Edit", true, groupId)}
15
+ canRemove={false}
21
16
  title="Contact first name"
22
17
  titleWeight="600"
23
18
  editItem={() => console.log("edit click")}
@@ -25,7 +20,7 @@ export const editableList = () => {
25
20
  itemName="Contact first name"
26
21
  listPadding="0"
27
22
  renderItem={contactFirstName => contactFirstName}
28
- maxItems={number("Max Items", 2, groupId)}
23
+ maxItems={1}
29
24
  items={["Ronald"]}
30
25
  qaPrefix="Contact first name"
31
26
  ariaLabel="Contact first name"
@@ -28,7 +28,8 @@ const Module = ({
28
28
  spacingBottom = "2.5rem",
29
29
  fontSize,
30
30
  themeValues,
31
- children
31
+ children,
32
+ allowContentOverflow = false
32
33
  }) => {
33
34
  const themedFontSize =
34
35
  variant === "small"
@@ -64,7 +65,12 @@ const Module = ({
64
65
  >
65
66
  {heading && !rightTitleContent && headingText}
66
67
  {heading && rightTitleContent && (
67
- <Cluster justify="space-between" align="center" nowrap>
68
+ <Cluster
69
+ justify="space-between"
70
+ align="center"
71
+ overflow={allowContentOverflow}
72
+ nowrap
73
+ >
68
74
  {headingText}
69
75
  {rightTitleContent}
70
76
  </Cluster>
@@ -362,9 +362,11 @@ const PaymentDetails = ({
362
362
  <Box width="100%" padding="none">
363
363
  <Cluster justify="space-between" align="center">
364
364
  <Title
365
- weight={FONT_WEIGHT_BOLD}
365
+ weight={FONT_WEIGHT_SEMIBOLD}
366
366
  as="h2"
367
- extraStyles={`font-size: 1.375rem;`}
367
+ extraStyles={`font-size: 1.5rem; line-height: ${
368
+ isMobile ? "2.2857rem" : "2.25rem"
369
+ };`}
368
370
  id="payment-details-title"
369
371
  >
370
372
  {titleText}
@@ -382,9 +384,11 @@ const PaymentDetails = ({
382
384
  <>
383
385
  <Title
384
386
  as="h2"
385
- weight={FONT_WEIGHT_BOLD}
387
+ weight={FONT_WEIGHT_SEMIBOLD}
386
388
  margin="1rem 0 0 0"
387
- extraStyles={`font-size: 1.75rem;`}
389
+ extraStyles={`font-size: 1.5rem; line-height: ${
390
+ isMobile ? "2.2857rem" : "2.25rem"
391
+ };`}
388
392
  id="payment-details-title"
389
393
  >
390
394
  {titleText}