@thecb/components 12.0.0-beta.6 → 12.0.0-beta.8

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": "12.0.0-beta.6",
3
+ "version": "12.0.0-beta.8",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "source": "src/index.js",
9
9
  "scripts": {
10
10
  "storybook": "storybook dev -p 6006",
11
- "build": "rollup -cm",
11
+ "build": "rollup -cm",
12
12
  "build-storybook": "storybook build"
13
13
  },
14
14
  "repository": {
@@ -45,11 +45,7 @@ const CardType = ({ type, size = "small" }) => {
45
45
  const normalizedType = normalizeType(type);
46
46
  const { label, [size]: IconComponent } =
47
47
  cardBrands[normalizedType] || cardBrands.default;
48
- return (
49
- <span>
50
- <IconComponent />
51
- </span>
52
- );
48
+ return <IconComponent />;
53
49
  };
54
50
 
55
51
  export default CardType;
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
  import { fallbackValues } from "./FormattedBankAccount.theme";
5
- import BankIcon from "../icons/BankIcon";
6
- import { Stack, Box } from "../layouts";
5
+ import BankIconLarge from "../icons/BankIconLarge";
6
+ import { Stack } from "../layouts";
7
7
  import Text from "../text";
8
8
 
9
9
  export const BankItemWrapper = styled.div`
@@ -11,6 +11,12 @@ export const BankItemWrapper = styled.div`
11
11
  justify-content: flex-start;
12
12
  align-items: center;
13
13
  `;
14
+ export const BankIconWrapper = styled.div`
15
+ margin-right: 8px;
16
+ width: 36px;
17
+ height: auto;
18
+ display: flex;
19
+ `;
14
20
 
15
21
  export const BankAccountText = styled.h4`
16
22
  color: ${({ color }) => color};
@@ -32,9 +38,9 @@ const FormattedBankAccount = ({
32
38
  themeValues
33
39
  }) => (
34
40
  <BankItemWrapper>
35
- <Box padding="0.25rem 0 0 0" extraStyles={`margin-right: 1rem;`}>
36
- <BankIcon />
37
- </Box>
41
+ <BankIconWrapper>
42
+ <BankIconLarge />
43
+ </BankIconWrapper>
38
44
  <Stack childGap="0">
39
45
  {accountType === CHECKING && (
40
46
  <BankAccountText color={themeValues.textColor}>
@@ -14,7 +14,7 @@ export const CreditCardWrapper = styled.div`
14
14
  `;
15
15
 
16
16
  export const CCIconWrapper = styled.div`
17
- margin-right: 16px;
17
+ margin-right: 8px;
18
18
  width: 36px;
19
19
  height: auto;
20
20
  display: flex;
@@ -30,36 +30,36 @@ const FormattedCreditCard = ({
30
30
  }) => {
31
31
  const { isMobile } = useContext(ThemeContext);
32
32
  return (
33
- <CreditCardWrapper>
34
- <CCIconWrapper>
35
- <CardType type={type} size={isMobile ? "small" : "large"} />
36
- </CCIconWrapper>
37
- <Stack childGap="0">
38
- <Box padding="0">
39
- <Text
40
- variant="p"
41
- padding="0"
42
- color={themeValues.textColor}
43
- textAlign="left"
44
- extraStyles={`display: inline-block;`}
45
- >
46
- {`Card ending in ${lastFour}`}
47
- </Text>
48
- {expireDate && (
49
- <Fragment>
50
- {renderCardStatus(expirationStatus, expireDate, "left", "p")}
51
- </Fragment>
33
+ <CreditCardWrapper>
34
+ <CCIconWrapper>
35
+ <CardType type={type} size={isMobile ? "small" : "large"} />
36
+ </CCIconWrapper>
37
+ <Stack childGap="0">
38
+ <Box padding="0">
39
+ <Text
40
+ variant="p"
41
+ padding="0"
42
+ color={themeValues.textColor}
43
+ textAlign="left"
44
+ extraStyles={`display: inline-block;`}
45
+ >
46
+ {`Card ending in ${lastFour}`}
47
+ </Text>
48
+ {expireDate && (
49
+ <Fragment>
50
+ {renderCardStatus(expirationStatus, expireDate, "left", "p")}
51
+ </Fragment>
52
+ )}
53
+ </Box>
54
+ {autoPay && (
55
+ <Text
56
+ variant="p"
57
+ color={themeValues.autopayTextColor}
58
+ extraStyles={`font-style: italic; font-size: .75rem;`}
59
+ >{`Autopay On`}</Text>
52
60
  )}
53
- </Box>
54
- {autoPay && (
55
- <Text
56
- variant="p"
57
- color={themeValues.autopayTextColor}
58
- extraStyles={`font-style: italic; font-size: .75rem;`}
59
- >{`Autopay On`}</Text>
60
- )}
61
- </Stack>
62
- </CreditCardWrapper>
61
+ </Stack>
62
+ </CreditCardWrapper>
63
63
  );
64
64
  };
65
65
  export default themeComponent(
@@ -24,7 +24,8 @@ const InternalLink = forwardRef(
24
24
  hoverUnderline = true,
25
25
  extraHoverStyles = ``,
26
26
  extraActiveStyles = ``,
27
- extraFocusStyles = ``
27
+ extraFocusStyles = ``,
28
+ ...rest
28
29
  },
29
30
  ref
30
31
  ) => {
@@ -57,6 +58,7 @@ const InternalLink = forwardRef(
57
58
  extraFocusStyles={extraFocusStyles}
58
59
  data-qa={dataQa}
59
60
  ref={ref}
61
+ {...rest}
60
62
  >
61
63
  {safeChildren(children, <span />)}
62
64
  </StyledInternalLink>
@@ -6,6 +6,7 @@ import {
6
6
  import { Box, Stack } from "../../atoms/layouts";
7
7
  import Placeholder from "../../atoms/placeholder";
8
8
  import ButtonWithAction from "../../atoms/button-with-action";
9
+ import { InternalLink } from "../../atoms/link";
9
10
  import Text from "../../atoms/text";
10
11
  import Title from "../../atoms/title";
11
12
  import {
@@ -42,7 +43,8 @@ const EditableList = ({
42
43
  qaPrefix,
43
44
  ariaLabel,
44
45
  editItemAriaRole = "",
45
- disablePlaceholder = false
46
+ disablePlaceholder = false,
47
+ getEditHref = null
46
48
  }) => {
47
49
  const addText = `Add a${
48
50
  itemName[0].match(/[aieouAIEOU]/) ? "n" : ""
@@ -150,14 +152,25 @@ const EditableList = ({
150
152
  dataQa={qaPrefix + " Edit"}
151
153
  key={`Edit ${item.id}`}
152
154
  >
153
- <ButtonWithAction
154
- variant="smallGhost"
155
- text="Edit"
156
- action={() => editItem(item.id)}
157
- extraStyles={`min-width: 0;`}
158
- aria-label={`Edit ${ariaLabel || itemName}`}
159
- role={editItemAriaRole}
160
- />
155
+ {getEditHref ? (
156
+ <InternalLink
157
+ to={getEditHref(item)}
158
+ fontWeight="400"
159
+ extraStyles={`margin: 0.5rem; min-width: 0;`}
160
+ aria-label={`Edit ${ariaLabel || itemName}`}
161
+ >
162
+ Edit
163
+ </InternalLink>
164
+ ) : (
165
+ <ButtonWithAction
166
+ variant="smallGhost"
167
+ text="Edit"
168
+ action={() => editItem(item.id)}
169
+ extraStyles={`min-width: 0;`}
170
+ aria-label={`Edit ${ariaLabel || itemName}`}
171
+ role={editItemAriaRole}
172
+ />
173
+ )}
161
174
  </Box>
162
175
  )}
163
176
  </EditableListItemControls>
@@ -23,7 +23,8 @@ const LinkCard = ({
23
23
  themeValues,
24
24
  titleVariant = "h3",
25
25
  disabled = false,
26
- isExternalLink = false
26
+ isExternalLink = false,
27
+ key
27
28
  }) => {
28
29
  const { isMobile } = useContext(ThemeContext);
29
30
  const regex = /\W/g;
@@ -31,18 +32,20 @@ const LinkCard = ({
31
32
 
32
33
  return (
33
34
  <Styled.LinkWrapper
35
+ key={key || locatorSlug}
34
36
  as={Link}
35
37
  to={disabled ? undefined : href}
36
38
  role="link"
37
39
  isMobile={isMobile}
38
- dataQa={`link-card-${locatorSlug}`}
39
- theme={themeValues}
40
+ $theme={themeValues}
40
41
  extraStyles={extraStyles}
41
42
  hoverStyles={extraHoverStyles}
42
43
  activeStyles={extraActiveStyles}
43
44
  aria-disabled={disabled}
44
- isDisabled={disabled}
45
+ disabled={disabled}
45
46
  aria-label={`${title}, ${subtitle}`}
47
+ data-qa={`link-card-${locatorSlug}`}
48
+ tabIndex={disabled ? -1 : 0}
46
49
  >
47
50
  <Stack
48
51
  childGap={0}
@@ -58,9 +61,9 @@ const LinkCard = ({
58
61
  >
59
62
  <Styled.Title
60
63
  variant={titleVariant}
61
- theme={themeValues}
64
+ $theme={themeValues}
62
65
  margin={0}
63
- isDisabled={disabled}
66
+ disabled={disabled}
64
67
  >
65
68
  {title}
66
69
  </Styled.Title>
@@ -75,8 +78,8 @@ const LinkCard = ({
75
78
  <Box padding={subtitlePadding} width="100%">
76
79
  <Styled.Subtitle
77
80
  variant="pS"
78
- theme={themeValues}
79
- isDisabled={disabled}
81
+ $theme={themeValues}
82
+ disabled={disabled}
80
83
  >
81
84
  {subtitle}
82
85
  </Styled.Subtitle>
@@ -5,7 +5,7 @@ import {
5
5
  ROYAL_BLUE_VIVID,
6
6
  SEA_GREEN
7
7
  } from "../../../constants/colors";
8
- import { Box, Grid } from "../../atoms/layouts";
8
+ import { Box } from "../../atoms/layouts";
9
9
  import LinkCard from "./LinkCard";
10
10
  import Badge from "../../atoms/badge/Badge";
11
11
  import AutopayIcon from "../../atoms/icons/AutopayIcon";
@@ -89,7 +89,7 @@ const meta = {
89
89
  description: "Extra styles to apply to the LinkCard",
90
90
  table: {
91
91
  type: { summary: "string" },
92
- defaultValue: { summary: undefined }
92
+ defaultValue: { summary: "" }
93
93
  }
94
94
  },
95
95
  extraActiveStyles: {
@@ -97,7 +97,7 @@ const meta = {
97
97
  "Extra styles to apply to the LinkCard when it is in an active state",
98
98
  table: {
99
99
  type: { summary: "string" },
100
- defaultValue: { summary: undefined }
100
+ defaultValue: { summary: "" }
101
101
  }
102
102
  },
103
103
  extraHoverStyles: {
@@ -105,7 +105,7 @@ const meta = {
105
105
  "Extra styles to apply to the LinkCard when it is being hovered",
106
106
  table: {
107
107
  type: { summary: "string" },
108
- defaultValue: { summary: undefined }
108
+ defaultValue: { summary: "" }
109
109
  }
110
110
  },
111
111
  titleVariant: {
@@ -145,8 +145,6 @@ export const BasicLinkCard = {
145
145
  return (
146
146
  <LinkCard
147
147
  {...args}
148
- key="link-card-basic"
149
- extraStyles={`transition: all .2s ease-in-out;`}
150
148
  extraHoverStyles={`.show-on-hover {opacity: 1}`}
151
149
  showLeft={false}
152
150
  leftContent={
@@ -203,8 +201,6 @@ export const ExternalLinkCard = {
203
201
  return (
204
202
  <LinkCard
205
203
  {...args}
206
- key="link-card-basic"
207
- extraStyles={`transition: all .2s ease-in-out;`}
208
204
  extraHoverStyles={`.show-on-hover {opacity: 1}`}
209
205
  showLeft={false}
210
206
  leftContent={
@@ -255,14 +251,13 @@ export const ExternalLinkCard = {
255
251
  export const CompleteLinkCard = {
256
252
  args: {
257
253
  title: "Water Bills - Autopay",
258
- subittle: "Cityville Water Management",
254
+ subtitle: "Cityville Water Management",
259
255
  href: "/water-bills"
260
256
  },
261
257
  render: args => {
262
258
  return (
263
259
  <LinkCard
264
260
  {...args}
265
- extraStyles={`transition: all .2s ease-in-out;`}
266
261
  extraHoverStyles={`.show-on-hover {opacity: 1}`}
267
262
  showLeft={true}
268
263
  leftContent={
@@ -295,7 +290,7 @@ export const CompleteLinkCard = {
295
290
  id={`workflow-two`}
296
291
  extraStyles={`
297
292
  transition: opacity .2s ease-in-out;
298
- opacity: 0
293
+ opacity: 0;
299
294
  `}
300
295
  >
301
296
  {"Find"}
@@ -321,7 +316,6 @@ export const DisabledLinkCard = {
321
316
  return (
322
317
  <LinkCard
323
318
  {...args}
324
- extraHoverStyles={`box-shadow: none; cursor: default; .show-on-hover {opacity: 0}`}
325
319
  disabled={true}
326
320
  showLeft={true}
327
321
  leftContent={
@@ -370,138 +364,3 @@ export const DisabledLinkCard = {
370
364
  );
371
365
  }
372
366
  };
373
-
374
- export const LinkCardGrid = {
375
- render: () => {
376
- const sharedStyles = `transition: all .2s ease-in-out;`;
377
- const sharedHoverStyles = `.show-on-hover {opacity: 1}`;
378
-
379
- const rightSlot = (id, label, Icon, color) => (
380
- <Box
381
- data-qa={`find-or-pay-${id}`}
382
- extraStyles={`
383
- display: flex;
384
- gap: 6px;
385
- justify-content: space-between;
386
- align-items: center;
387
- `}
388
- padding="0"
389
- hoverStyles=".show-on-hover {opacity: 1;}"
390
- >
391
- <Text
392
- variant="pS"
393
- className="show-on-hover"
394
- color={color}
395
- id={`workflow-${id}`}
396
- extraStyles={`
397
- transition: opacity .2s ease-in-out;
398
- opacity: 0
399
- `}
400
- >
401
- {label}
402
- </Text>
403
- <Icon labelledBy={`workflow-${id}`} color={color} />
404
- </Box>
405
- );
406
-
407
- return (
408
- <Grid minColWidth={18} columnGap="1rem">
409
- <LinkCard
410
- title="Construction Permits"
411
- subtitle="Cityville Department of Building Inspection"
412
- href="/construction-permits"
413
- extraStyles={sharedStyles}
414
- extraHoverStyles={sharedHoverStyles}
415
- showRight={true}
416
- rightContent={rightSlot(
417
- "permits",
418
- "Pay",
419
- ArrowRightIcon,
420
- ROYAL_BLUE_VIVID
421
- )}
422
- />
423
- <LinkCard
424
- title="Water Bills"
425
- subtitle="Cityville Water Management"
426
- href="/water-bills"
427
- extraStyles={sharedStyles}
428
- extraHoverStyles={sharedHoverStyles}
429
- showLeft={true}
430
- leftContent={
431
- <Badge
432
- label="Autopay Available"
433
- variant="success"
434
- Icon={() => AutopayIcon({ fill: SEA_GREEN })}
435
- />
436
- }
437
- showRight={true}
438
- rightContent={rightSlot(
439
- "water",
440
- "Find",
441
- PlusCircleIcon,
442
- ROYAL_BLUE_VIVID
443
- )}
444
- />
445
- <LinkCard
446
- title="Property Tax"
447
- subtitle="Cityville Revenue Department"
448
- href="/property-tax"
449
- extraStyles={sharedStyles}
450
- extraHoverStyles={sharedHoverStyles}
451
- showRight={true}
452
- rightContent={rightSlot(
453
- "tax",
454
- "Pay",
455
- ArrowRightIcon,
456
- ROYAL_BLUE_VIVID
457
- )}
458
- isExternalLink={true}
459
- />
460
- <LinkCard
461
- title="Business Licenses"
462
- subtitle="Cityville Commerce Division"
463
- href="/business-licenses"
464
- extraStyles={sharedStyles}
465
- extraHoverStyles={sharedHoverStyles}
466
- showLeft={true}
467
- leftContent={
468
- <Badge
469
- label="Autopay Available"
470
- variant="success"
471
- Icon={() => AutopayIcon({ fill: SEA_GREEN })}
472
- />
473
- }
474
- showRight={true}
475
- rightContent={rightSlot(
476
- "licenses",
477
- "Pay",
478
- ArrowRightIcon,
479
- ROYAL_BLUE_VIVID
480
- )}
481
- />
482
- <LinkCard
483
- title="Parking Fines"
484
- subtitle="Cityville Transportation Authority"
485
- href="/parking-fines"
486
- disabled={true}
487
- extraHoverStyles={`box-shadow: none; cursor: default; .show-on-hover {opacity: 0}`}
488
- showLeft={true}
489
- leftContent={
490
- <Badge
491
- label="Autopay Available"
492
- variant="disabled"
493
- Icon={() => AutopayIcon({ fill: MANATEE_GREY })}
494
- />
495
- }
496
- showRight={true}
497
- rightContent={rightSlot(
498
- "parking",
499
- "Find",
500
- PlusCircleIcon,
501
- COOL_GREY_05
502
- )}
503
- />
504
- </Grid>
505
- );
506
- }
507
- };
@@ -9,6 +9,14 @@ import {
9
9
  import { Link } from "react-router-dom";
10
10
 
11
11
  export const LinkWrapper = styled(Link)`
12
+ ${({
13
+ disabled,
14
+ $theme: theme,
15
+ extraStyles,
16
+ disabledStyles,
17
+ hoverStyles,
18
+ activeStyles
19
+ }) => `
12
20
  display: flex;
13
21
  flex-direction: column;
14
22
  align-items: flex-start;
@@ -18,25 +26,23 @@ export const LinkWrapper = styled(Link)`
18
26
  align-self: stretch;
19
27
  border-radius: 8px;
20
28
  text-decoration: none;
21
- ${({ isDisabled, theme }) => `
22
- background-color: ${
23
- isDisabled ? theme.disabledBackgroundColor : theme.backgroundColor
24
- };
25
- border: 1px solid ${
26
- isDisabled ? theme.disabledBorderColor : theme.borderColor
27
- };
28
- `}
29
- ${({ extraStyles }) => extraStyles}
30
- transition: all .2s ease-in-out;
29
+ background-color: ${
30
+ disabled ? theme.disabledBackgroundColor : theme.backgroundColor
31
+ };
32
+ border: 1px solid
33
+ ${disabled ? theme.disabledBorderColor : theme.borderColor};
34
+ transition: all 0.2s ease-in-out;
35
+ ${extraStyles || ""}
31
36
 
32
- ${({ isDisabled, theme }) =>
33
- isDisabled
37
+ ${
38
+ disabled
34
39
  ? `
35
40
  &:hover,
36
41
  &:active {
37
42
  cursor: default;
38
43
  box-shadow: none;
39
44
  border: 1px solid ${theme.disabledBorderColor};
45
+ ${disabledStyles || ""}
40
46
  }
41
47
  `
42
48
  : `
@@ -50,6 +56,7 @@ export const LinkWrapper = styled(Link)`
50
56
  0px 56px 31px 0px rgba(41, 42, 51, 0.01),
51
57
  0px 80px 33px 0px rgba(41, 42, 51, 0);
52
58
  }
59
+ ${hoverStyles || ""}
53
60
 
54
61
  &:hover:not(:active) {
55
62
  border: 1px solid ${theme.borderColor};
@@ -58,8 +65,11 @@ export const LinkWrapper = styled(Link)`
58
65
  &:active {
59
66
  background-color: ${theme.activeBackgroundColor};
60
67
  border: 1px solid ${theme.borderColor};
68
+ ${activeStyles || ""}
61
69
  }
62
- `}
70
+ `
71
+ }
72
+ `}
63
73
  `;
64
74
 
65
75
  export const Title = styled(Heading)`
@@ -73,8 +83,8 @@ export const Title = styled(Heading)`
73
83
  line-height: 150%;
74
84
  background-color: transparent;
75
85
  font-weight: ${FONT_WEIGHT_SEMIBOLD};
76
- ${({ isDisabled, theme }) =>
77
- `color: ${isDisabled ? theme.disabledColor : theme.color};`};
86
+ color: ${({ disabled, $theme: theme }) =>
87
+ disabled ? theme.disabledColor : theme.color};
78
88
  `;
79
89
 
80
90
  export const Subtitle = styled(Paragraph)`
@@ -88,8 +98,8 @@ export const Subtitle = styled(Paragraph)`
88
98
  line-height: 150%;
89
99
  letter-spacing: 0.14px;
90
100
  font-weight: ${FONT_WEIGHT_REGULAR};
91
- ${({ isDisabled, theme }) =>
92
- `color: ${isDisabled ? theme.disabledColor : theme.textColor};`};
101
+ color: ${({ disabled, $theme: theme }) =>
102
+ disabled ? theme.disabledColor : theme.textColor};
93
103
  `;
94
104
 
95
105
  export const Footer = styled(Stack)`
@@ -19,7 +19,7 @@ const IconsModule = ({
19
19
  Icon = iconsMap[icon];
20
20
  }
21
21
  return (
22
- <Box padding="0 1rem 0 0">
22
+ <Box padding="0 1rem 0 0" aria-hidden="true">
23
23
  <Cluster justify="center" align="center">
24
24
  <Icon color={iconColor} />
25
25
  </Cluster>
@@ -105,7 +105,7 @@ const RadioButton = ({
105
105
  borderWidth="1px"
106
106
  borderStyle="solid"
107
107
  borderRadius="12px"
108
- margin="6px 14px 6px 6px"
108
+ margin="6px 8px 6px 6px"
109
109
  height="24px"
110
110
  width="24px"
111
111
  variants={buttonBorder}