@thecb/components 12.0.0-beta.8 → 12.0.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 +37 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +37 -42
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/icons/AutopayOnIcon.js +1 -0
- package/src/components/molecules/link-card/LinkCard.js +18 -22
- package/src/components/molecules/link-card/LinkCard.stories.js +19 -16
- package/src/components/molecules/link-card/LinkCard.styled.js +8 -9
- package/src/components/molecules/link-card/LinkCard.theme.js +5 -2
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +10 -17
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Box, Stack } from "../../atoms/layouts";
|
|
3
3
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
4
|
import { fallbackValues } from "./LinkCard.theme";
|
|
5
|
-
import { ThemeContext } from "styled-components";
|
|
6
5
|
import * as Styled from "./LinkCard.styled";
|
|
7
|
-
import { noop } from "../../../util/general";
|
|
8
6
|
import ExternalLinkIcon from "../../atoms/icons/ExternalLinkIcon";
|
|
9
|
-
import { Link } from "react-router-dom";
|
|
10
7
|
|
|
11
8
|
const LinkCard = ({
|
|
12
9
|
title = "Test Workflow",
|
|
@@ -23,29 +20,28 @@ const LinkCard = ({
|
|
|
23
20
|
themeValues,
|
|
24
21
|
titleVariant = "h3",
|
|
25
22
|
disabled = false,
|
|
26
|
-
isExternalLink = false
|
|
27
|
-
key
|
|
23
|
+
isExternalLink = false
|
|
28
24
|
}) => {
|
|
29
|
-
const { isMobile } = useContext(ThemeContext);
|
|
30
25
|
const regex = /\W/g;
|
|
31
26
|
const locatorSlug = title?.toLowerCase?.()?.replaceAll?.(regex, "-");
|
|
32
27
|
|
|
33
28
|
return (
|
|
34
|
-
<Styled.
|
|
35
|
-
key={
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$theme={themeValues}
|
|
41
|
-
extraStyles={extraStyles}
|
|
42
|
-
hoverStyles={extraHoverStyles}
|
|
43
|
-
activeStyles={extraActiveStyles}
|
|
29
|
+
<Styled.StyledAnchor
|
|
30
|
+
key={`link-card-${locatorSlug}`}
|
|
31
|
+
href={disabled ? undefined : href}
|
|
32
|
+
rel={isExternalLink ? "noopener noreferrer" : undefined}
|
|
33
|
+
target={isExternalLink ? "_blank" : undefined}
|
|
34
|
+
tabIndex={disabled ? -1 : 0}
|
|
44
35
|
aria-disabled={disabled}
|
|
45
|
-
disabled={disabled}
|
|
36
|
+
$disabled={disabled}
|
|
46
37
|
aria-label={`${title}, ${subtitle}`}
|
|
47
38
|
data-qa={`link-card-${locatorSlug}`}
|
|
48
|
-
|
|
39
|
+
$theme={themeValues}
|
|
40
|
+
$extraStyles={
|
|
41
|
+
disabled ? `pointer-events: none; ${extraStyles}` : extraStyles
|
|
42
|
+
}
|
|
43
|
+
$hoverStyles={extraHoverStyles}
|
|
44
|
+
$activeStyles={extraActiveStyles}
|
|
49
45
|
>
|
|
50
46
|
<Stack
|
|
51
47
|
childGap={0}
|
|
@@ -63,7 +59,7 @@ const LinkCard = ({
|
|
|
63
59
|
variant={titleVariant}
|
|
64
60
|
$theme={themeValues}
|
|
65
61
|
margin={0}
|
|
66
|
-
disabled={disabled}
|
|
62
|
+
$disabled={disabled}
|
|
67
63
|
>
|
|
68
64
|
{title}
|
|
69
65
|
</Styled.Title>
|
|
@@ -79,7 +75,7 @@ const LinkCard = ({
|
|
|
79
75
|
<Styled.Subtitle
|
|
80
76
|
variant="pS"
|
|
81
77
|
$theme={themeValues}
|
|
82
|
-
disabled={disabled}
|
|
78
|
+
$disabled={disabled}
|
|
83
79
|
>
|
|
84
80
|
{subtitle}
|
|
85
81
|
</Styled.Subtitle>
|
|
@@ -101,7 +97,7 @@ const LinkCard = ({
|
|
|
101
97
|
</Styled.Footer>
|
|
102
98
|
</Box>
|
|
103
99
|
</Stack>
|
|
104
|
-
</Styled.
|
|
100
|
+
</Styled.StyledAnchor>
|
|
105
101
|
);
|
|
106
102
|
};
|
|
107
103
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { Box } from "../../atoms/layouts";
|
|
9
9
|
import LinkCard from "./LinkCard";
|
|
10
10
|
import Badge from "../../atoms/badge/Badge";
|
|
11
|
+
import { fn } from "@storybook/test";
|
|
11
12
|
import AutopayIcon from "../../atoms/icons/AutopayIcon";
|
|
12
13
|
import ArrowRightIcon from "../../atoms/icons/ArrowRightIcon";
|
|
13
14
|
import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
|
|
@@ -27,7 +28,7 @@ const meta = {
|
|
|
27
28
|
leftContent: undefined,
|
|
28
29
|
showRight: undefined,
|
|
29
30
|
rightContent: undefined,
|
|
30
|
-
|
|
31
|
+
onClick: fn(),
|
|
31
32
|
extraStyles: "",
|
|
32
33
|
extraActiveStyles: "",
|
|
33
34
|
extraHoverStyles: "",
|
|
@@ -78,10 +79,10 @@ const meta = {
|
|
|
78
79
|
defaultValue: { summary: undefined }
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
|
-
|
|
82
|
-
description: "
|
|
82
|
+
onClick: {
|
|
83
|
+
description: "Function to execute on click of LinkCard",
|
|
83
84
|
table: {
|
|
84
|
-
type: { summary: "
|
|
85
|
+
type: { summary: "function" },
|
|
85
86
|
defaultValue: { summary: undefined }
|
|
86
87
|
}
|
|
87
88
|
},
|
|
@@ -89,7 +90,7 @@ const meta = {
|
|
|
89
90
|
description: "Extra styles to apply to the LinkCard",
|
|
90
91
|
table: {
|
|
91
92
|
type: { summary: "string" },
|
|
92
|
-
defaultValue: { summary:
|
|
93
|
+
defaultValue: { summary: undefined }
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
96
|
extraActiveStyles: {
|
|
@@ -97,7 +98,7 @@ const meta = {
|
|
|
97
98
|
"Extra styles to apply to the LinkCard when it is in an active state",
|
|
98
99
|
table: {
|
|
99
100
|
type: { summary: "string" },
|
|
100
|
-
defaultValue: { summary:
|
|
101
|
+
defaultValue: { summary: undefined }
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
104
|
extraHoverStyles: {
|
|
@@ -105,7 +106,7 @@ const meta = {
|
|
|
105
106
|
"Extra styles to apply to the LinkCard when it is being hovered",
|
|
106
107
|
table: {
|
|
107
108
|
type: { summary: "string" },
|
|
108
|
-
defaultValue: { summary:
|
|
109
|
+
defaultValue: { summary: undefined }
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
112
|
titleVariant: {
|
|
@@ -138,13 +139,14 @@ export default meta;
|
|
|
138
139
|
export const BasicLinkCard = {
|
|
139
140
|
args: {
|
|
140
141
|
title: "Construction Permits",
|
|
141
|
-
subtitle: "Cityville Department of Building Inspection"
|
|
142
|
-
href: "/construction-permits"
|
|
142
|
+
subtitle: "Cityville Department of Building Inspection"
|
|
143
143
|
},
|
|
144
144
|
render: args => {
|
|
145
145
|
return (
|
|
146
146
|
<LinkCard
|
|
147
147
|
{...args}
|
|
148
|
+
key="link-card-basic"
|
|
149
|
+
extraStyles={`transition: all .2s ease-in-out;`}
|
|
148
150
|
extraHoverStyles={`.show-on-hover {opacity: 1}`}
|
|
149
151
|
showLeft={false}
|
|
150
152
|
leftContent={
|
|
@@ -194,13 +196,14 @@ export const BasicLinkCard = {
|
|
|
194
196
|
export const ExternalLinkCard = {
|
|
195
197
|
args: {
|
|
196
198
|
title: "Construction Permits",
|
|
197
|
-
subtitle: "Cityville Department of Building Inspection"
|
|
198
|
-
href: "/construction-permits"
|
|
199
|
+
subtitle: "Cityville Department of Building Inspection"
|
|
199
200
|
},
|
|
200
201
|
render: args => {
|
|
201
202
|
return (
|
|
202
203
|
<LinkCard
|
|
203
204
|
{...args}
|
|
205
|
+
key="link-card-basic"
|
|
206
|
+
extraStyles={`transition: all .2s ease-in-out;`}
|
|
204
207
|
extraHoverStyles={`.show-on-hover {opacity: 1}`}
|
|
205
208
|
showLeft={false}
|
|
206
209
|
leftContent={
|
|
@@ -251,13 +254,13 @@ export const ExternalLinkCard = {
|
|
|
251
254
|
export const CompleteLinkCard = {
|
|
252
255
|
args: {
|
|
253
256
|
title: "Water Bills - Autopay",
|
|
254
|
-
|
|
255
|
-
href: "/water-bills"
|
|
257
|
+
subittle: "Cityville Water Management"
|
|
256
258
|
},
|
|
257
259
|
render: args => {
|
|
258
260
|
return (
|
|
259
261
|
<LinkCard
|
|
260
262
|
{...args}
|
|
263
|
+
extraStyles={`transition: all .2s ease-in-out;`}
|
|
261
264
|
extraHoverStyles={`.show-on-hover {opacity: 1}`}
|
|
262
265
|
showLeft={true}
|
|
263
266
|
leftContent={
|
|
@@ -290,7 +293,7 @@ export const CompleteLinkCard = {
|
|
|
290
293
|
id={`workflow-two`}
|
|
291
294
|
extraStyles={`
|
|
292
295
|
transition: opacity .2s ease-in-out;
|
|
293
|
-
opacity: 0
|
|
296
|
+
opacity: 0
|
|
294
297
|
`}
|
|
295
298
|
>
|
|
296
299
|
{"Find"}
|
|
@@ -309,13 +312,13 @@ export const CompleteLinkCard = {
|
|
|
309
312
|
export const DisabledLinkCard = {
|
|
310
313
|
args: {
|
|
311
314
|
title: "Property Tax - Autopay",
|
|
312
|
-
subtitle: ""
|
|
313
|
-
href: "/property-tax"
|
|
315
|
+
subtitle: ""
|
|
314
316
|
},
|
|
315
317
|
render: args => {
|
|
316
318
|
return (
|
|
317
319
|
<LinkCard
|
|
318
320
|
{...args}
|
|
321
|
+
extraHoverStyles={`box-shadow: none; cursor: default; .show-on-hover {opacity: 0}`}
|
|
319
322
|
disabled={true}
|
|
320
323
|
showLeft={true}
|
|
321
324
|
leftContent={
|
|
@@ -6,16 +6,15 @@ import {
|
|
|
6
6
|
FONT_WEIGHT_SEMIBOLD,
|
|
7
7
|
FONT_WEIGHT_REGULAR
|
|
8
8
|
} from "../../../constants/style_constants";
|
|
9
|
-
import { Link } from "react-router-dom";
|
|
10
9
|
|
|
11
|
-
export const
|
|
10
|
+
export const StyledAnchor = styled("a")`
|
|
12
11
|
${({
|
|
13
|
-
disabled,
|
|
12
|
+
$disabled: disabled,
|
|
14
13
|
$theme: theme,
|
|
15
|
-
extraStyles,
|
|
16
|
-
disabledStyles,
|
|
17
|
-
hoverStyles,
|
|
18
|
-
activeStyles
|
|
14
|
+
$extraStyles: extraStyles,
|
|
15
|
+
$disabledStyles: disabledStyles,
|
|
16
|
+
$hoverStyles: hoverStyles,
|
|
17
|
+
$activeStyles: activeStyles
|
|
19
18
|
}) => `
|
|
20
19
|
display: flex;
|
|
21
20
|
flex-direction: column;
|
|
@@ -83,7 +82,7 @@ export const Title = styled(Heading)`
|
|
|
83
82
|
line-height: 150%;
|
|
84
83
|
background-color: transparent;
|
|
85
84
|
font-weight: ${FONT_WEIGHT_SEMIBOLD};
|
|
86
|
-
color: ${({ disabled, $theme: theme }) =>
|
|
85
|
+
color: ${({ $disabled: disabled, $theme: theme }) =>
|
|
87
86
|
disabled ? theme.disabledColor : theme.color};
|
|
88
87
|
`;
|
|
89
88
|
|
|
@@ -98,7 +97,7 @@ export const Subtitle = styled(Paragraph)`
|
|
|
98
97
|
line-height: 150%;
|
|
99
98
|
letter-spacing: 0.14px;
|
|
100
99
|
font-weight: ${FONT_WEIGHT_REGULAR};
|
|
101
|
-
color: ${({ disabled, $theme: theme }) =>
|
|
100
|
+
color: ${({ $disabled: disabled, $theme: theme }) =>
|
|
102
101
|
disabled ? theme.disabledColor : theme.textColor};
|
|
103
102
|
`;
|
|
104
103
|
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
ROYAL_BLUE_VIVID,
|
|
6
6
|
MANATEE_GREY,
|
|
7
7
|
GHOST_GREY,
|
|
8
|
-
TRANSPARENT
|
|
8
|
+
TRANSPARENT,
|
|
9
|
+
BRIGHT_GREY
|
|
9
10
|
} from "../../../constants/colors";
|
|
10
11
|
|
|
11
12
|
const disabledBackgroundColor = TRANSPARENT;
|
|
@@ -15,6 +16,7 @@ const activeBackgroundColor = CORNFLOWER_BLUE;
|
|
|
15
16
|
const backgroundColor = LINK_WATER;
|
|
16
17
|
const borderColor = MOON_RAKER;
|
|
17
18
|
const color = ROYAL_BLUE_VIVID;
|
|
19
|
+
const textColor = BRIGHT_GREY;
|
|
18
20
|
|
|
19
21
|
export const fallbackValues = {
|
|
20
22
|
disabledBackgroundColor,
|
|
@@ -23,5 +25,6 @@ export const fallbackValues = {
|
|
|
23
25
|
activeBackgroundColor,
|
|
24
26
|
backgroundColor,
|
|
25
27
|
borderColor,
|
|
26
|
-
color
|
|
28
|
+
color,
|
|
29
|
+
textColor
|
|
27
30
|
};
|
|
@@ -98,12 +98,6 @@ const AutopayModalModule = ({
|
|
|
98
98
|
: navigateToSettings,
|
|
99
99
|
isLoading: deactivatingSchedule
|
|
100
100
|
};
|
|
101
|
-
const modalLinkHoverFocus = `
|
|
102
|
-
outline: none;
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
text-decoration: underline;
|
|
105
|
-
text-decoration-color: #317D4F;
|
|
106
|
-
`;
|
|
107
101
|
|
|
108
102
|
const hoverStyles = "text-decoration: underline;";
|
|
109
103
|
const activeStyles = "text-decoration: underline;";
|
|
@@ -144,15 +138,24 @@ const AutopayModalModule = ({
|
|
|
144
138
|
return (
|
|
145
139
|
<Box
|
|
146
140
|
padding="0"
|
|
141
|
+
role="button"
|
|
142
|
+
tabIndex="0"
|
|
147
143
|
onClick={
|
|
148
144
|
onClick ||
|
|
149
145
|
(() => {
|
|
150
146
|
toggleModal(true);
|
|
151
147
|
})
|
|
152
148
|
}
|
|
149
|
+
onKeyDown={
|
|
150
|
+
onKeyPress ||
|
|
151
|
+
(e => {
|
|
152
|
+
e.key === "Enter" && toggleModal(true);
|
|
153
|
+
})
|
|
154
|
+
}
|
|
153
155
|
hoverStyles={hoverStyles}
|
|
154
156
|
activeStyles={activeStyles}
|
|
155
|
-
extraStyles={"cursor: pointer;"}
|
|
157
|
+
extraStyles={"cursor: pointer; margin-bottom: 5px;"}
|
|
158
|
+
dataQa={`${shortPlan} On`}
|
|
156
159
|
>
|
|
157
160
|
<Cluster
|
|
158
161
|
justify={isMobile ? "flex-start" : "flex-end"}
|
|
@@ -161,18 +164,8 @@ const AutopayModalModule = ({
|
|
|
161
164
|
<AutopayOnIcon />
|
|
162
165
|
<Text
|
|
163
166
|
variant="pS"
|
|
164
|
-
onClick={onClick || (() => toggleModal(true))}
|
|
165
|
-
onKeyPress={
|
|
166
|
-
onKeyPress ||
|
|
167
|
-
(e => {
|
|
168
|
-
e.key === "Enter" && toggleModal(true);
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
tabIndex="0"
|
|
172
|
-
dataQa={`${shortPlan} On`}
|
|
173
167
|
color={SEA_GREEN}
|
|
174
168
|
weight={FONT_WEIGHT_REGULAR}
|
|
175
|
-
hoverStyles={modalLinkHoverFocus}
|
|
176
169
|
extraStyles={`padding-left: 0.25rem;`}
|
|
177
170
|
disabled={disableActions}
|
|
178
171
|
>
|