@thecb/components 3.6.0-beta.2 → 4.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/.storybook/main.js +1 -1
- package/.storybook/page.js +2 -0
- package/dist/index.cjs.js +293 -145
- package/package.json +2 -2
- package/src/components/atoms/alert/Alert.js +53 -35
- package/src/components/atoms/breadcrumb/Breadcrumb.js +4 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +2 -2
- package/src/components/atoms/checkbox/Checkbox.js +1 -0
- package/src/components/atoms/checkbox-list/CheckboxList.js +3 -1
- package/src/components/atoms/display-card/DisplayCard.js +4 -2
- package/src/components/atoms/dropdown/Dropdown.js +4 -4
- package/src/components/atoms/dropdown/Dropdown.stories.js +10 -33
- package/src/components/atoms/form-layouts/FormInput.js +7 -4
- package/src/components/atoms/form-layouts/FormLayouts.stories.js +5 -5
- package/src/components/atoms/hamburger-button/HamburgerButton.js +4 -3
- package/src/components/atoms/icons/AccountsIconSmall.js +6 -13
- package/src/components/atoms/icons/ChevronIcon.js +4 -4
- package/src/components/atoms/icons/icons.stories.js +1 -1
- package/src/components/atoms/layouts/Box.styled.js +1 -0
- package/src/components/atoms/layouts/Cluster.styled.js +5 -1
- package/src/components/atoms/layouts/Sidebar.styled.js +7 -1
- package/src/components/atoms/radio-button/RadioButton.js +1 -0
- package/src/components/atoms/radio-button/RadioButton.stories.js +26 -61
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +1 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +10 -51
- package/src/components/molecules/editable-list/EditableList.js +11 -8
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +2 -1
- package/src/components/molecules/nav-menu/NavMenuMobile.js +7 -1
- package/src/components/molecules/obligation/Obligation.js +9 -7
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +23 -23
- package/src/components/molecules/pagination/Pagination.js +149 -0
- package/src/components/molecules/pagination/index.js +3 -0
- package/src/components/molecules/radio-section/RadioSection.js +7 -3
- package/src/deprecated/components/radio-button/radio-button.js +5 -1
- package/src/deprecated/icons/IconInvalid.js +7 -31
- package/src/deprecated/icons/IconNeutral.js +5 -4
- package/src/deprecated/icons/IconValid.js +8 -33
- package/src/util/general.js +10 -1
- package/src/components/molecules/content/Content.js +0 -20
- package/src/components/molecules/content/Content.theme.js +0 -60
- package/src/components/molecules/content/blocks/accordion-block/AccordionBlock.js +0 -108
- package/src/components/molecules/content/blocks/accordion-block/index.js +0 -3
- package/src/components/molecules/content/blocks/article-block/ArticleBlock.js +0 -58
- package/src/components/molecules/content/blocks/article-block/index.js +0 -3
- package/src/components/molecules/content/blocks/attached-file-block/AttachedFileBlock.js +0 -60
- package/src/components/molecules/content/blocks/attached-file-block/index.js +0 -3
- package/src/components/molecules/content/blocks/featured-content-block/FeaturedContentBlock.js +0 -0
- package/src/components/molecules/content/blocks/featured-content-block/index.js +0 -0
- package/src/components/molecules/content/blocks/hero-block/HeroBlock.js +0 -54
- package/src/components/molecules/content/blocks/hero-block/index.js +0 -3
- package/src/components/molecules/content/blocks/highlight-block/HighlightBlock.js +0 -42
- package/src/components/molecules/content/blocks/highlight-block/index.js +0 -3
- package/src/components/molecules/content/blocks/index.js +0 -33
- package/src/components/molecules/content/blocks/info-block/InfoBlock.js +0 -15
- package/src/components/molecules/content/blocks/info-block/index.js +0 -3
- package/src/components/molecules/content/blocks/location-block/LocationBlock.js +0 -228
- package/src/components/molecules/content/blocks/location-block/index.js +0 -3
- package/src/components/molecules/content/blocks/related-links-block/RelatedLinksBlock.js +0 -35
- package/src/components/molecules/content/blocks/related-links-block/index.js +0 -3
- package/src/components/molecules/content/blocks/screendoor-block/ScreendoorBlock.js +0 -57
- package/src/components/molecules/content/blocks/screendoor-block/ScreendoorForm.styled.js +0 -314
- package/src/components/molecules/content/blocks/screendoor-block/index.js +0 -3
- package/src/components/molecules/content/blocks/tagline-block/TaglineBlock.js +0 -45
- package/src/components/molecules/content/blocks/tagline-block/index.js +0 -3
- package/src/components/molecules/content/blocks/task-block/TaskBlock.js +0 -40
- package/src/components/molecules/content/blocks/task-block/index.js +0 -3
- package/src/components/molecules/content/blocks/text-block/TextBlock.js +0 -40
- package/src/components/molecules/content/blocks/text-block/index.js +0 -3
- package/src/components/molecules/content/header/Header.js +0 -283
- package/src/components/molecules/content/header/Header.theme.js +0 -11
- package/src/components/molecules/content/header/index.js +0 -3
- package/src/components/molecules/content/index.js +0 -3
|
@@ -1,69 +1,34 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
3
3
|
import RadioButton from "./RadioButton";
|
|
4
|
-
import { Box
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
const fakeTheme = {
|
|
8
|
-
RadioButton: {
|
|
9
|
-
activeColor: "#15749D",
|
|
10
|
-
inactiveColor: "#959CA8"
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: "Radio Button",
|
|
16
|
-
component: RadioButton,
|
|
17
|
-
decorators: [
|
|
18
|
-
withKnobs,
|
|
19
|
-
storyFn => (
|
|
20
|
-
<ThemeProvider
|
|
21
|
-
theme={{
|
|
22
|
-
name: text("Theme Name", "default"),
|
|
23
|
-
values: fakeTheme
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<Cover>
|
|
27
|
-
<div />
|
|
28
|
-
<Center>{storyFn()}</Center>
|
|
29
|
-
<div />
|
|
30
|
-
</Cover>
|
|
31
|
-
</ThemeProvider>
|
|
32
|
-
)
|
|
33
|
-
]
|
|
34
|
-
};
|
|
4
|
+
import { Box } from "../layouts";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
35
6
|
|
|
36
7
|
export const radioButtonsDefault = () => {
|
|
37
|
-
const buttons = 3;
|
|
38
|
-
|
|
39
8
|
const [selected, setSelected] = useState(null);
|
|
40
9
|
const [focused, setFocused] = useState(null);
|
|
41
10
|
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
radios(
|
|
59
|
-
"Disable Radio Buttons",
|
|
60
|
-
{ Enabled: "enabled", Disabled: "disabled" },
|
|
61
|
-
"enabled",
|
|
62
|
-
"RADIO-GROUP-1"
|
|
63
|
-
) === "disabled"
|
|
64
|
-
}
|
|
65
|
-
/>
|
|
66
|
-
</Box>
|
|
67
|
-
);
|
|
68
|
-
});
|
|
11
|
+
return (
|
|
12
|
+
<Box
|
|
13
|
+
onFocus={() => setFocused(name)}
|
|
14
|
+
onBlur={() => setFocused(null)}
|
|
15
|
+
extraStyles="outline: none;"
|
|
16
|
+
tabIndex="0"
|
|
17
|
+
>
|
|
18
|
+
<RadioButton
|
|
19
|
+
name="demo"
|
|
20
|
+
radioOn={selected === name}
|
|
21
|
+
radioFocused={focused === name}
|
|
22
|
+
toggleRadio={() => setSelected(name)}
|
|
23
|
+
disabled={boolean("disabled", false, "props")}
|
|
24
|
+
/>
|
|
25
|
+
</Box>
|
|
26
|
+
);
|
|
69
27
|
};
|
|
28
|
+
|
|
29
|
+
const story = page({
|
|
30
|
+
title: "Components|Atoms/RadioButton",
|
|
31
|
+
Component: RadioButton
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default story;
|
|
@@ -1,60 +1,12 @@
|
|
|
1
1
|
import React, { useState, Fragment } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
3
3
|
import ToggleSwitch from "./ToggleSwitch";
|
|
4
|
-
import
|
|
5
|
-
import { ThemeProvider } from "styled-components";
|
|
6
|
-
|
|
7
|
-
const fakeTheme = {
|
|
8
|
-
ToggleSwitch: {
|
|
9
|
-
onBackground: "#15749D",
|
|
10
|
-
disabledBackground: "#D5D8DC",
|
|
11
|
-
white: "white",
|
|
12
|
-
offBackground: "#959EA7",
|
|
13
|
-
rightLabelStyles: `display: flex;
|
|
14
|
-
justify-content: flex-start;
|
|
15
|
-
align-items: center;
|
|
16
|
-
flex-direction: row;`,
|
|
17
|
-
leftLabelStyles: `display: flex;
|
|
18
|
-
justify-content: flex-start;
|
|
19
|
-
align-items: center;
|
|
20
|
-
flex-direction: row-reverse;`
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
title: "Toggle Switch",
|
|
26
|
-
component: ToggleSwitch,
|
|
27
|
-
decorators: [
|
|
28
|
-
withKnobs,
|
|
29
|
-
storyFn => (
|
|
30
|
-
<ThemeProvider
|
|
31
|
-
theme={{
|
|
32
|
-
name: text("Theme Name", "default"),
|
|
33
|
-
values: fakeTheme
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
<Cover>
|
|
37
|
-
<div />
|
|
38
|
-
<Center>
|
|
39
|
-
<Stack>{storyFn()}</Stack>
|
|
40
|
-
</Center>
|
|
41
|
-
<div />
|
|
42
|
-
</Cover>
|
|
43
|
-
</ThemeProvider>
|
|
44
|
-
)
|
|
45
|
-
]
|
|
46
|
-
};
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
47
5
|
|
|
48
6
|
export const toggleSwitchDefault = () => {
|
|
49
7
|
const [isOn, onToggle] = useState(false);
|
|
50
8
|
|
|
51
|
-
const disabled =
|
|
52
|
-
radios(
|
|
53
|
-
"Disable Toggle Switch",
|
|
54
|
-
{ Enabled: "enabled", Disabled: "disabled" },
|
|
55
|
-
"enabled",
|
|
56
|
-
"RADIO-GROUP-1"
|
|
57
|
-
) === "disabled";
|
|
9
|
+
const disabled = boolean("disabled", false, "props");
|
|
58
10
|
|
|
59
11
|
return (
|
|
60
12
|
<Fragment>
|
|
@@ -68,3 +20,10 @@ export const toggleSwitchDefault = () => {
|
|
|
68
20
|
</Fragment>
|
|
69
21
|
);
|
|
70
22
|
};
|
|
23
|
+
|
|
24
|
+
const story = page({
|
|
25
|
+
title: "Components|Atoms/ToggleSwitch",
|
|
26
|
+
Component: ToggleSwitch
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default story;
|
|
@@ -55,24 +55,25 @@ const EditableList = ({
|
|
|
55
55
|
extraStyles={`box-shadow: 0px 2px 14px 0px rgb(246, 246, 249),
|
|
56
56
|
0px 3px 8px 0px rgb(202, 206, 216);`}
|
|
57
57
|
>
|
|
58
|
-
{items.map(
|
|
58
|
+
{items.map(item => {
|
|
59
59
|
const [modalOpen, toggleModal] = useState(false);
|
|
60
60
|
return (
|
|
61
61
|
<EditableListItem
|
|
62
62
|
listItemSize={
|
|
63
|
-
!!
|
|
63
|
+
!!item.id && item.id === autoPayMethod ? "big" : listItemSize
|
|
64
64
|
}
|
|
65
|
-
key={
|
|
65
|
+
key={item.id || item}
|
|
66
66
|
>
|
|
67
67
|
<Text variant="p" color={CHARADE_GREY}>
|
|
68
|
-
{renderItem(
|
|
68
|
+
{renderItem(item)}
|
|
69
69
|
</Text>
|
|
70
70
|
<EditableListItemControls>
|
|
71
|
-
{
|
|
71
|
+
{item.isPrimary && (
|
|
72
72
|
<Text
|
|
73
73
|
variant="p"
|
|
74
74
|
color={STORM_GREY}
|
|
75
75
|
extraStyles={`font-style: italic;`}
|
|
76
|
+
key={`Default ${itemName}`}
|
|
76
77
|
>
|
|
77
78
|
Default {itemName}
|
|
78
79
|
</Text>
|
|
@@ -83,10 +84,11 @@ const EditableList = ({
|
|
|
83
84
|
border="2px solid transparent"
|
|
84
85
|
extraStyles={`:not(:first-child) { border-left: 2px solid ${BOSTON_BLUE};}`}
|
|
85
86
|
dataQa={qaPrefix + " Remove"}
|
|
87
|
+
key={`Remove ${item.id}`}
|
|
86
88
|
>
|
|
87
89
|
{useModal ? (
|
|
88
90
|
<Modal
|
|
89
|
-
item={{ ...
|
|
91
|
+
item={{ ...item }}
|
|
90
92
|
{...modalProps}
|
|
91
93
|
modalOpen={modalOpen}
|
|
92
94
|
toggleModal={toggleModal}
|
|
@@ -95,7 +97,7 @@ const EditableList = ({
|
|
|
95
97
|
<ButtonWithAction
|
|
96
98
|
variant="smallGhost"
|
|
97
99
|
text="Remove"
|
|
98
|
-
action={() => removeItem(
|
|
100
|
+
action={() => removeItem(item.id)}
|
|
99
101
|
extraStyles={`min-width: 0;`}
|
|
100
102
|
/>
|
|
101
103
|
)}
|
|
@@ -107,11 +109,12 @@ const EditableList = ({
|
|
|
107
109
|
border="2px solid transparent"
|
|
108
110
|
extraStyles={`:not(:first-child) { border-left: 2px solid ${BOSTON_BLUE};}`}
|
|
109
111
|
dataQa={qaPrefix + " Edit"}
|
|
112
|
+
key={`Edit ${item.id}`}
|
|
110
113
|
>
|
|
111
114
|
<ButtonWithAction
|
|
112
115
|
variant="smallGhost"
|
|
113
116
|
text="Edit"
|
|
114
|
-
action={() => editItem(
|
|
117
|
+
action={() => editItem(item.id)}
|
|
115
118
|
extraStyles={`min-width: 0;`}
|
|
116
119
|
/>
|
|
117
120
|
</Box>
|
|
@@ -13,6 +13,7 @@ export { default as Module } from "./module";
|
|
|
13
13
|
export * from "./nav-menu";
|
|
14
14
|
export { default as Obligation } from "./obligation";
|
|
15
15
|
export * from "./partial-amount-form";
|
|
16
|
+
export { default as Pagination } from "./pagination";
|
|
16
17
|
export { default as PaymentButtonBar } from "./payment-button-bar";
|
|
17
18
|
export { default as PaymentDetails } from "./payment-details";
|
|
18
19
|
export { default as PaymentFormACH } from "./payment-form-ach";
|
|
@@ -4,6 +4,7 @@ import { fallbackValues } from "./NavMenu.theme.js";
|
|
|
4
4
|
import { themeComponent } from "../../../util/themeUtils";
|
|
5
5
|
|
|
6
6
|
const NavMenuDesktop = ({
|
|
7
|
+
id,
|
|
7
8
|
top = "125%",
|
|
8
9
|
left = "-100%",
|
|
9
10
|
menuContent = [],
|
|
@@ -17,7 +18,7 @@ const NavMenuDesktop = ({
|
|
|
17
18
|
const menuCarat = `&:after { bottom: 100%; right: 10px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; border-color: ${themeValues.backgroundColor}00; border-bottom-color: ${themeValues.backgroundColor}; border-width: 10px; margin-left: -10px; }`;
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
|
-
<Imposter breakout top={top} left={left} visible={visible}>
|
|
21
|
+
<Imposter id={id} breakout top={top} left={left} visible={visible}>
|
|
21
22
|
<Box
|
|
22
23
|
minWidth="240px"
|
|
23
24
|
padding="1rem 0.5rem"
|
|
@@ -42,9 +42,15 @@ const ImposterMenu = styled(menu)`
|
|
|
42
42
|
top: 72px;
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
|
-
const NavMenuMobile = ({
|
|
45
|
+
const NavMenuMobile = ({
|
|
46
|
+
id,
|
|
47
|
+
menuContent = [],
|
|
48
|
+
visible = false,
|
|
49
|
+
themeValues
|
|
50
|
+
}) => {
|
|
46
51
|
return (
|
|
47
52
|
<ImposterMenu
|
|
53
|
+
id={id}
|
|
48
54
|
initialPose="invisible"
|
|
49
55
|
pose={visible ? "visible" : "invisible"}
|
|
50
56
|
>
|
|
@@ -39,13 +39,15 @@ const Obligation = ({
|
|
|
39
39
|
>
|
|
40
40
|
<Box padding="0">
|
|
41
41
|
<Cluster justify="flex-start" align="center">
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
{!isMobile && (
|
|
43
|
+
<IconModule
|
|
44
|
+
icon={config.icon}
|
|
45
|
+
iconDefault={config.iconDefault}
|
|
46
|
+
configIconMap={config.iconMap}
|
|
47
|
+
iconValue={config.iconValue}
|
|
48
|
+
customAttributes={customAttributes}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
49
51
|
<TitleModule
|
|
50
52
|
title={obligation.description}
|
|
51
53
|
subtitle={obligation.subDescription}
|
|
@@ -54,29 +54,17 @@ const PaymentDetailsActions = ({
|
|
|
54
54
|
borderWidthOverride="0 0 1px 0"
|
|
55
55
|
>
|
|
56
56
|
<Cluster justify="space-between" align="center" nowrap>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/>
|
|
69
|
-
</Box>
|
|
70
|
-
<Box padding="0" width="100%">
|
|
71
|
-
<ButtonWithAction
|
|
72
|
-
isLoading={isLoading}
|
|
73
|
-
action={() => handleClick(obligations)}
|
|
74
|
-
text="Pay Now"
|
|
75
|
-
variant={isMobile ? "smallSecondary" : "secondary"}
|
|
76
|
-
dataQa="Pay Now"
|
|
77
|
-
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
78
|
-
/>
|
|
79
|
-
</Box>
|
|
57
|
+
<AmountModule
|
|
58
|
+
totalAmountDue={obligations.reduce(
|
|
59
|
+
(acc, curr) => acc + curr.amountDue,
|
|
60
|
+
0
|
|
61
|
+
)}
|
|
62
|
+
autoPayEnabled={autoPayEnabled}
|
|
63
|
+
isMobile={isMobile}
|
|
64
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
65
|
+
navigateToSettings={navigateToSettings}
|
|
66
|
+
autoPaySchedule={autoPaySchedule}
|
|
67
|
+
/>
|
|
80
68
|
</Cluster>
|
|
81
69
|
</Box>
|
|
82
70
|
)}
|
|
@@ -146,6 +134,18 @@ const PaymentDetailsActions = ({
|
|
|
146
134
|
</Box>
|
|
147
135
|
)}
|
|
148
136
|
</Cluster>
|
|
137
|
+
{isMobile && (
|
|
138
|
+
<Box padding="8px 0 0" width="100%">
|
|
139
|
+
<ButtonWithAction
|
|
140
|
+
isLoading={isLoading}
|
|
141
|
+
action={() => handleClick(obligations)}
|
|
142
|
+
text="Pay Now"
|
|
143
|
+
variant={isMobile ? "smallSecondary" : "secondary"}
|
|
144
|
+
dataQa="Pay Now"
|
|
145
|
+
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
146
|
+
/>
|
|
147
|
+
</Box>
|
|
148
|
+
)}
|
|
149
149
|
</Box>
|
|
150
150
|
</Box>
|
|
151
151
|
);
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Cluster, Box } from "../../atoms/layouts";
|
|
3
|
+
import Text from "../../atoms/text";
|
|
4
|
+
import ButtonWithAction from "../../atoms/button-with-action";
|
|
5
|
+
import { ChevronIcon } from "../../atoms/icons";
|
|
6
|
+
import { MATISSE_BLUE, ALABASTER_WHITE } from "../../../constants/colors";
|
|
7
|
+
import { noop } from "../../../util/general";
|
|
8
|
+
|
|
9
|
+
const PAGING_SPACE = 2; // how many pages we want to have before/after delimiter
|
|
10
|
+
const PAGING_INIT_SPACE = 3; // first delimiter should appear after 3 pages
|
|
11
|
+
|
|
12
|
+
const PrevNextButton = ({ action, type, arrowColor, numberColor }) => (
|
|
13
|
+
<Box padding="0 10px 0" minHeight="40px" extraStyles="max-height: 40px;">
|
|
14
|
+
<ButtonWithAction
|
|
15
|
+
action={action}
|
|
16
|
+
contentOverride
|
|
17
|
+
dataQa={type}
|
|
18
|
+
extraStyles={`
|
|
19
|
+
min-width: 40px;
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
max-height: 40px;
|
|
22
|
+
padding: 6px;
|
|
23
|
+
border-radius: 3px;
|
|
24
|
+
background-color: ${numberColor ?? MATISSE_BLUE};
|
|
25
|
+
border-color: ${numberColor ?? MATISSE_BLUE}
|
|
26
|
+
`}
|
|
27
|
+
>
|
|
28
|
+
<Box padding="0" extraStyles={type === "prev" && "transform: scaleX(-1)"}>
|
|
29
|
+
<ChevronIcon variant="darkMode" iconFill={arrowColor} />
|
|
30
|
+
</Box>
|
|
31
|
+
</ButtonWithAction>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const getPagesPanel = (page, pagesCount) => {
|
|
36
|
+
if (!pagesCount || pagesCount <= 1) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
const lastPageNumber = pagesCount;
|
|
40
|
+
const space = page === 1 ? PAGING_INIT_SPACE : PAGING_SPACE;
|
|
41
|
+
const pages = [{ index: 1, isButton: true }];
|
|
42
|
+
if (page > space + 1) {
|
|
43
|
+
pages.push({ isDelimiter: true });
|
|
44
|
+
}
|
|
45
|
+
for (
|
|
46
|
+
let j = Math.max(1, page - space) + 1;
|
|
47
|
+
j < Math.min(lastPageNumber, page + space);
|
|
48
|
+
j++
|
|
49
|
+
) {
|
|
50
|
+
pages.push({ index: j, isButton: true });
|
|
51
|
+
}
|
|
52
|
+
if (page < lastPageNumber - space) {
|
|
53
|
+
pages.push({ isDelimiter: true });
|
|
54
|
+
}
|
|
55
|
+
pages.push({ index: lastPageNumber, isButton: true });
|
|
56
|
+
const activePage = pages.find(p => p.index === page);
|
|
57
|
+
if (activePage) {
|
|
58
|
+
activePage.active = true;
|
|
59
|
+
}
|
|
60
|
+
return pages;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const Pagination = ({
|
|
64
|
+
pagePrevious,
|
|
65
|
+
pageNext,
|
|
66
|
+
setCurrentPage,
|
|
67
|
+
currentPage,
|
|
68
|
+
pageCount,
|
|
69
|
+
numberColor,
|
|
70
|
+
arrowColor
|
|
71
|
+
}) => (
|
|
72
|
+
<Cluster justify="center" childGap="10px">
|
|
73
|
+
{currentPage > 1 && (
|
|
74
|
+
<PrevNextButton
|
|
75
|
+
type="prev"
|
|
76
|
+
action={pagePrevious}
|
|
77
|
+
arrowColor={arrowColor}
|
|
78
|
+
numberColor={numberColor}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
81
|
+
{getPagesPanel(currentPage, pageCount).map((item, index) =>
|
|
82
|
+
item.isButton ? (
|
|
83
|
+
<Box
|
|
84
|
+
padding="0"
|
|
85
|
+
border={item.active && `1px solid ${numberColor ?? MATISSE_BLUE}`}
|
|
86
|
+
borderRadius={item.active && "3px"}
|
|
87
|
+
extraStyles="max-height: 40px;"
|
|
88
|
+
>
|
|
89
|
+
<ButtonWithAction
|
|
90
|
+
variant="ghost"
|
|
91
|
+
key={item.index}
|
|
92
|
+
text={item.index}
|
|
93
|
+
disabled={item.active}
|
|
94
|
+
action={
|
|
95
|
+
!item.active
|
|
96
|
+
? () => setCurrentPage({ pageNumber: item.index })
|
|
97
|
+
: noop
|
|
98
|
+
}
|
|
99
|
+
textExtraStyles={`font-size: 17px; font-weight: 900;`}
|
|
100
|
+
extraStyles={`
|
|
101
|
+
min-width: 40px; min-height: 100%; padding: 0;
|
|
102
|
+
&:hover, &:focus {
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
> * > span {
|
|
105
|
+
text-decoration: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
> * > span {
|
|
109
|
+
color: ${numberColor ?? MATISSE_BLUE}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
&:hover { ${
|
|
113
|
+
item.active
|
|
114
|
+
? "cursor: default;"
|
|
115
|
+
: `background-color: ${ALABASTER_WHITE}`
|
|
116
|
+
} }
|
|
117
|
+
`}
|
|
118
|
+
dataQa={index}
|
|
119
|
+
>
|
|
120
|
+
{item.index}
|
|
121
|
+
</ButtonWithAction>
|
|
122
|
+
</Box>
|
|
123
|
+
) : (
|
|
124
|
+
<Box padding="0 10px">
|
|
125
|
+
<Cluster justify="flex-end">
|
|
126
|
+
<Text
|
|
127
|
+
key={index}
|
|
128
|
+
variant="pXL"
|
|
129
|
+
weight="900"
|
|
130
|
+
color={numberColor ?? MATISSE_BLUE}
|
|
131
|
+
>
|
|
132
|
+
{"..."}
|
|
133
|
+
</Text>
|
|
134
|
+
</Cluster>
|
|
135
|
+
</Box>
|
|
136
|
+
)
|
|
137
|
+
)}
|
|
138
|
+
{currentPage < pageCount && (
|
|
139
|
+
<PrevNextButton
|
|
140
|
+
type="next"
|
|
141
|
+
action={pageNext}
|
|
142
|
+
arrowColor={arrowColor}
|
|
143
|
+
numberColor={numberColor}
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
</Cluster>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
export default Pagination;
|
|
@@ -122,12 +122,12 @@ const RadioSection = ({
|
|
|
122
122
|
: themeValues.headingBackgroundColor
|
|
123
123
|
}
|
|
124
124
|
onClick={
|
|
125
|
-
isMobile && supportsTouch
|
|
125
|
+
(isMobile && supportsTouch) || section.disabled
|
|
126
126
|
? noop
|
|
127
127
|
: () => toggleOpenSection(section.id)
|
|
128
128
|
}
|
|
129
129
|
onTouchEnd={
|
|
130
|
-
isMobile && supportsTouch
|
|
130
|
+
(isMobile && supportsTouch) || !section.disabled
|
|
131
131
|
? () => toggleOpenSection(section.id)
|
|
132
132
|
: noop
|
|
133
133
|
}
|
|
@@ -155,7 +155,11 @@ const RadioSection = ({
|
|
|
155
155
|
name={section.id}
|
|
156
156
|
radioOn={openSection === section.id}
|
|
157
157
|
radioFocused={focused === section.id}
|
|
158
|
-
toggleRadio={
|
|
158
|
+
toggleRadio={
|
|
159
|
+
section.disabled
|
|
160
|
+
? noop
|
|
161
|
+
: () => toggleOpenSection(section.id)
|
|
162
|
+
}
|
|
159
163
|
tabIndex="-1"
|
|
160
164
|
/>
|
|
161
165
|
</Box>
|
|
@@ -36,7 +36,11 @@ const RadioButtonCenter = styled.div`
|
|
|
36
36
|
RadioButtonCenter.defaultProps = defaultTheme;
|
|
37
37
|
|
|
38
38
|
const RadioButton = ({ isSelected, name }) => (
|
|
39
|
-
<RadioButtonBorder
|
|
39
|
+
<RadioButtonBorder
|
|
40
|
+
isSelected={isSelected}
|
|
41
|
+
name={name}
|
|
42
|
+
aria-checked={isSelected}
|
|
43
|
+
>
|
|
40
44
|
{isSelected && <RadioButtonCenter />}
|
|
41
45
|
</RadioButtonBorder>
|
|
42
46
|
);
|
|
@@ -16,47 +16,23 @@ export const IconInvalid = ({
|
|
|
16
16
|
xmlns="http://www.w3.org/2000/svg"
|
|
17
17
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
18
18
|
style={{ margin }}
|
|
19
|
+
aria-label="Invalid"
|
|
19
20
|
>
|
|
20
|
-
<g
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
fillRule="evenodd"
|
|
26
|
-
>
|
|
27
|
-
<g
|
|
28
|
-
id="icon-invalid-00.1.0.1---HSS---Register---Already-Exists-Error"
|
|
29
|
-
transform="translate(-538.000000, -1064.000000)"
|
|
30
|
-
fillRule="nonzero"
|
|
31
|
-
>
|
|
32
|
-
<g
|
|
33
|
-
id="icon-invalid-Password-Requirements"
|
|
34
|
-
transform="translate(457.000000, 938.000000)"
|
|
35
|
-
>
|
|
36
|
-
<g
|
|
37
|
-
id="icon-invalid-Group-2"
|
|
38
|
-
transform="translate(81.000000, 20.000000)"
|
|
39
|
-
>
|
|
40
|
-
<g
|
|
41
|
-
id="icon-invalid-PasswordVerification-Error"
|
|
42
|
-
transform="translate(0.000000, 106.000000)"
|
|
43
|
-
>
|
|
21
|
+
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
22
|
+
<g transform="translate(-538.000000, -1064.000000)" fillRule="nonzero">
|
|
23
|
+
<g transform="translate(457.000000, 938.000000)">
|
|
24
|
+
<g transform="translate(81.000000, 20.000000)">
|
|
25
|
+
<g transform="translate(0.000000, 106.000000)">
|
|
44
26
|
<circle
|
|
45
|
-
id="icon-invalid-Oval"
|
|
46
27
|
stroke={bgFill}
|
|
47
28
|
fill={bgFill}
|
|
48
29
|
cx="9"
|
|
49
30
|
cy="9"
|
|
50
31
|
r="8.5"
|
|
51
32
|
></circle>
|
|
52
|
-
<g
|
|
53
|
-
id="icon-invalid-Icon/Close"
|
|
54
|
-
transform="translate(2.000000, 2.000000)"
|
|
55
|
-
fill={iconFill}
|
|
56
|
-
>
|
|
33
|
+
<g transform="translate(2.000000, 2.000000)" fill={iconFill}>
|
|
57
34
|
<path
|
|
58
35
|
d="M7.58333333,7.58333333 L7.58333333,11.6666667 L6.41666667,11.6666667 L6.41666667,7.58333333 L2.33333333,7.58333333 L2.33333333,6.41666667 L6.41666667,6.41666667 L6.41666667,2.33333333 L7.58333333,2.33333333 L7.58333333,6.41666667 L11.6666667,6.41666667 L11.6666667,7.58333333 L7.58333333,7.58333333 Z"
|
|
59
|
-
id="icon-invalid-x"
|
|
60
36
|
transform="translate(7.000000, 7.000000) rotate(45.000000) translate(-7.000000, -7.000000) "
|
|
61
37
|
></path>
|
|
62
38
|
</g>
|
|
@@ -15,11 +15,12 @@ export const IconNeutral = ({
|
|
|
15
15
|
xmlns="http://www.w3.org/2000/svg"
|
|
16
16
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
17
17
|
style={{ margin }}
|
|
18
|
+
aria-label="Neutral"
|
|
18
19
|
>
|
|
19
|
-
<g
|
|
20
|
-
<g
|
|
21
|
-
<g
|
|
22
|
-
<circle
|
|
20
|
+
<g fill={fill} fillRule="nonzero" stroke={fill}>
|
|
21
|
+
<g>
|
|
22
|
+
<g>
|
|
23
|
+
<circle cx="9" cy="9" r="8.5"></circle>
|
|
23
24
|
</g>
|
|
24
25
|
</g>
|
|
25
26
|
</g>
|