@thecb/components 10.12.1 → 10.12.2-beta.1
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 +252 -124
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +251 -125
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +22 -9
- package/src/components/atoms/checkbox/Checkbox.stories.js +17 -13
- package/src/components/atoms/checkbox/Checkbox.theme.js +6 -2
- package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +45 -0
- package/src/components/atoms/icons/PaymentStatusIcon.d.ts +1 -0
- package/src/components/atoms/icons/PaymentStatusIcon.js +28 -0
- package/src/components/atoms/icons/PersonIcon.d.ts +1 -0
- package/src/components/atoms/icons/PersonIcon.js +28 -0
- package/src/components/atoms/icons/icons.stories.js +5 -1
- package/src/components/atoms/icons/index.js +5 -1
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +33 -25
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.stories.js +2 -4
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +15 -7
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +7 -3
- package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +16 -13
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +24 -14
- package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +22 -18
- package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +43 -41
- package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +52 -41
- package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +10 -7
- package/src/components/molecules/multiple-select-filter/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ const CheckboxLabelContainer = styled.label`
|
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
column-gap: 1rem;
|
|
19
|
+
cursor: pointer;
|
|
19
20
|
`;
|
|
20
21
|
|
|
21
22
|
const CheckboxIcon = styled.svg`
|
|
@@ -106,6 +107,8 @@ const Checkbox = forwardRef(
|
|
|
106
107
|
labelledById,
|
|
107
108
|
dataQa = null,
|
|
108
109
|
checkboxExtraStyles,
|
|
110
|
+
hasIconOverride = false,
|
|
111
|
+
icon: Icon,
|
|
109
112
|
...rest
|
|
110
113
|
},
|
|
111
114
|
ref
|
|
@@ -132,7 +135,13 @@ const Checkbox = forwardRef(
|
|
|
132
135
|
onKeyDown={e => handleClick(e, onChange)}
|
|
133
136
|
hiddenStyles={hidden}
|
|
134
137
|
background={themeValues.backgroundColor}
|
|
135
|
-
extraStyles={`
|
|
138
|
+
extraStyles={`
|
|
139
|
+
:focus {
|
|
140
|
+
outline: 0;
|
|
141
|
+
}
|
|
142
|
+
${extraStyles};
|
|
143
|
+
margin: ${checkboxMargin};
|
|
144
|
+
`}
|
|
136
145
|
{...rest}
|
|
137
146
|
>
|
|
138
147
|
<CheckboxLabelContainer data-qa={dataQa}>
|
|
@@ -164,14 +173,18 @@ const Checkbox = forwardRef(
|
|
|
164
173
|
focusedStyles={themeValues.focusedStyles}
|
|
165
174
|
checkboxExtraStyles={checkboxExtraStyles}
|
|
166
175
|
>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
176
|
+
{hasIconOverride ? (
|
|
177
|
+
<Icon />
|
|
178
|
+
) : (
|
|
179
|
+
<CheckboxIcon
|
|
180
|
+
viewBox="0 0 24 24"
|
|
181
|
+
disabled={disabled}
|
|
182
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
183
|
+
checkColor={themeValues.checkColor}
|
|
184
|
+
>
|
|
185
|
+
<polyline points="20 6 9 17 4 12" />
|
|
186
|
+
</CheckboxIcon>
|
|
187
|
+
)}
|
|
175
188
|
</StyledCheckbox>
|
|
176
189
|
</CheckboxContainer>
|
|
177
190
|
{title && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
3
|
import Checkbox from "./Checkbox";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
@@ -10,18 +10,22 @@ const variants = {
|
|
|
10
10
|
const defaultValue = "default";
|
|
11
11
|
const groupId = "props";
|
|
12
12
|
|
|
13
|
-
export const checkbox = () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
13
|
+
export const checkbox = () => {
|
|
14
|
+
const [checked, setChecked] = useState(false);
|
|
15
|
+
return (
|
|
16
|
+
<Checkbox
|
|
17
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
18
|
+
title={text("title", "Checkbox", "props")}
|
|
19
|
+
name={text("name", "Checkbox", "props")}
|
|
20
|
+
checked={checked}
|
|
21
|
+
error={boolean("error", false, "props")}
|
|
22
|
+
disabled={boolean("disabled", false, "props")}
|
|
23
|
+
focused={boolean("focused", false, "props")}
|
|
24
|
+
labelledById={text("labelledById", undefined, "props")}
|
|
25
|
+
onChange={() => setChecked(!checked)}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
const story = page({
|
|
27
31
|
title: "Components|Atoms/Checkbox",
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
MATISSE_BLUE,
|
|
7
7
|
RED,
|
|
8
8
|
CHARADE_GREY,
|
|
9
|
-
STORM_GREY
|
|
9
|
+
STORM_GREY,
|
|
10
|
+
ROYAL_BLUE
|
|
10
11
|
} from "../../../constants/colors";
|
|
11
12
|
|
|
12
13
|
const backgroundColor = { default: `${TRANSPARENT}` };
|
|
@@ -18,7 +19,10 @@ const disabledCheckColor = { default: `${WHITE};` };
|
|
|
18
19
|
const checkColor = { default: `${WHITE};` };
|
|
19
20
|
const errorStyles = { default: `border: 1px solid ${RED};` };
|
|
20
21
|
const focusedStyles = {
|
|
21
|
-
default: `
|
|
22
|
+
default: `
|
|
23
|
+
outline: 3px solid ${ROYAL_BLUE};
|
|
24
|
+
outline-offset: 3px;
|
|
25
|
+
`
|
|
22
26
|
};
|
|
23
27
|
const disabledCheckedStyles = {
|
|
24
28
|
default: `
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const CheckboxCheckmarkIcon = ({
|
|
4
|
+
width = "18",
|
|
5
|
+
height = "18",
|
|
6
|
+
color = "#FEFEFE",
|
|
7
|
+
...props
|
|
8
|
+
}) => (
|
|
9
|
+
<svg
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
width={width}
|
|
12
|
+
height={height}
|
|
13
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
14
|
+
fill="none"
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
<path
|
|
18
|
+
fillRule="evenodd"
|
|
19
|
+
clipRule="evenodd"
|
|
20
|
+
d="M13.7503 5.35354C13.555 5.15828 13.2385 5.15828 13.0432 5.35354L7.52373 10.873L5.52808 8.87735C5.33282 8.68209 5.01624 8.68209 4.82097 8.87735L4.35348 9.34484C4.15822 9.54011 4.15822 9.85669 4.35348 10.052L6.70268 12.4012L7.17018 12.8687C7.36544 13.0639 7.68203 13.0639 7.87729 12.8687L8.34478 12.4012L14.2178 6.52814C14.4131 6.33288 14.4131 6.0163 14.2178 5.82104L13.7503 5.35354Z"
|
|
21
|
+
fill="#FEFEFE"
|
|
22
|
+
/>
|
|
23
|
+
<mask
|
|
24
|
+
id="mask0_3361_1486"
|
|
25
|
+
style={{ maskType: "luminance" }}
|
|
26
|
+
maskUnits="userSpaceOnUse"
|
|
27
|
+
x="4"
|
|
28
|
+
y="5"
|
|
29
|
+
width="11"
|
|
30
|
+
height="9"
|
|
31
|
+
>
|
|
32
|
+
<path
|
|
33
|
+
fillRule="evenodd"
|
|
34
|
+
clipRule="evenodd"
|
|
35
|
+
d="M13.7503 5.35354C13.555 5.15828 13.2385 5.15828 13.0432 5.35354L7.52373 10.873L5.52808 8.87735C5.33282 8.68209 5.01624 8.68209 4.82097 8.87735L4.35348 9.34484C4.15822 9.54011 4.15822 9.85669 4.35348 10.052L6.70268 12.4012L7.17018 12.8687C7.36544 13.0639 7.68203 13.0639 7.87729 12.8687L8.34478 12.4012L14.2178 6.52814C14.4131 6.33288 14.4131 6.0163 14.2178 5.82104L13.7503 5.35354Z"
|
|
36
|
+
fill="white"
|
|
37
|
+
/>
|
|
38
|
+
</mask>
|
|
39
|
+
<g mask="url(#mask0_3361_1486)">
|
|
40
|
+
<rect width={width} height={height} fill={color} />
|
|
41
|
+
</g>
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export default CheckboxCheckmarkIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PaymentStatusIcon: JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CHARADE_GREY } from "../../../constants/colors";
|
|
3
|
+
|
|
4
|
+
const PaymentStatusIcon = ({
|
|
5
|
+
width = "20",
|
|
6
|
+
height = "21",
|
|
7
|
+
color = CHARADE_GREY,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
width={width}
|
|
14
|
+
height={height}
|
|
15
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
16
|
+
fill="none"
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
fillRule="evenodd"
|
|
21
|
+
clipRule="evenodd"
|
|
22
|
+
d="M10.875 4.375C10.875 3.89175 11.2668 3.5 11.75 3.5H16.125C16.6082 3.5 17 3.89175 17 4.375V8.75C17 9.23325 16.6082 9.625 16.125 9.625H15.25V15.75C15.25 16.7165 14.4665 17.5 13.5 17.5H4.75C3.7835 17.5 3 16.7165 3 15.75V7C3 6.0335 3.7835 5.25 4.75 5.25H10.875V4.375ZM10.875 8.75V6.5625H4.75C4.50838 6.5625 4.3125 6.75838 4.3125 7V15.75C4.3125 15.9916 4.50838 16.1875 4.75 16.1875H13.5C13.7416 16.1875 13.9375 15.9916 13.9375 15.75V9.625H11.75C11.2668 9.625 10.875 9.23325 10.875 8.75ZM13.9375 7.875C14.6624 7.875 15.25 7.28737 15.25 6.5625C15.25 5.83763 14.6624 5.25 13.9375 5.25C13.2126 5.25 12.625 5.83763 12.625 6.5625C12.625 7.28737 13.2126 7.875 13.9375 7.875Z"
|
|
23
|
+
fill={color}
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export default PaymentStatusIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PersonIcon: JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CHARADE_GREY } from "../../../constants/colors";
|
|
3
|
+
|
|
4
|
+
const PersonIcon = ({
|
|
5
|
+
width = "20",
|
|
6
|
+
height = "21",
|
|
7
|
+
color = CHARADE_GREY,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
width={width}
|
|
14
|
+
height={height}
|
|
15
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
16
|
+
fill="none"
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
fillRule="evenodd"
|
|
21
|
+
clipRule="evenodd"
|
|
22
|
+
d="M15.25 4.8125H4.75C4.50838 4.8125 4.3125 5.00838 4.3125 5.25V15.75C4.3125 15.9916 4.50838 16.1875 4.75 16.1875H5.625V14.7778C5.625 12.8985 7.02411 11.375 8.75 11.375H11.25C12.9759 11.375 14.375 12.8985 14.375 14.7778V16.1875H15.25C15.4916 16.1875 15.6875 15.9916 15.6875 15.75V5.25C15.6875 5.00838 15.4916 4.8125 15.25 4.8125ZM4.75 17.5H5.625H14.375H15.25C16.2165 17.5 17 16.7165 17 15.75V5.25C17 4.2835 16.2165 3.5 15.25 3.5H4.75C3.7835 3.5 3 4.2835 3 5.25V15.75C3 16.7165 3.7835 17.5 4.75 17.5ZM10 10.5C11.2081 10.5 12.1875 9.52062 12.1875 8.3125C12.1875 7.10438 11.2081 6.125 10 6.125C8.79188 6.125 7.8125 7.10438 7.8125 8.3125C7.8125 9.52062 8.79188 10.5 10 10.5Z"
|
|
23
|
+
fill={color}
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export default PersonIcon;
|
|
@@ -52,7 +52,9 @@ import {
|
|
|
52
52
|
DisabledPaymentMethodsAddIcon,
|
|
53
53
|
ReversalNeededIcon,
|
|
54
54
|
OverageIcon,
|
|
55
|
-
ShortageIcon
|
|
55
|
+
ShortageIcon,
|
|
56
|
+
PersonIcon,
|
|
57
|
+
PaymentStatusIcon
|
|
56
58
|
} from "./index";
|
|
57
59
|
|
|
58
60
|
const story = page({
|
|
@@ -114,3 +116,5 @@ export const successfulIcon = () => <SuccessfulIcon />;
|
|
|
114
116
|
export const trashIconV2 = () => <TrashIconV2 />;
|
|
115
117
|
export const verifiedEmailIcon = () => <VerifiedEmailIcon />;
|
|
116
118
|
export const voidedIcon = () => <VoidedIcon />;
|
|
119
|
+
export const personIcon = () => <PersonIcon />;
|
|
120
|
+
export const paymentStatusIcon = () => <PaymentStatusIcon />;
|
|
@@ -99,6 +99,8 @@ import OverageIcon from "./OverageIcon";
|
|
|
99
99
|
import ShortageIcon from "./ShortageIcon";
|
|
100
100
|
import NoResultsIcon from "./NoResultsIcon";
|
|
101
101
|
import AgencyIcon from "./AgencyIcon";
|
|
102
|
+
import PersonIcon from "./PersonIcon";
|
|
103
|
+
import PaymentStatusIcon from "./PaymentStatusIcon";
|
|
102
104
|
|
|
103
105
|
export {
|
|
104
106
|
AccountsIcon,
|
|
@@ -201,5 +203,7 @@ export {
|
|
|
201
203
|
OverageIcon,
|
|
202
204
|
ShortageIcon,
|
|
203
205
|
NoResultsIcon,
|
|
204
|
-
AgencyIcon
|
|
206
|
+
AgencyIcon,
|
|
207
|
+
PersonIcon,
|
|
208
|
+
PaymentStatusIcon
|
|
205
209
|
};
|
|
@@ -16,7 +16,9 @@ const MultipleSelectFilter = ({
|
|
|
16
16
|
actions,
|
|
17
17
|
autocompleteValue,
|
|
18
18
|
btnContentOverride,
|
|
19
|
+
btnExtraStyles,
|
|
19
20
|
disabled,
|
|
21
|
+
dropdownExtraStyles,
|
|
20
22
|
extraStyles,
|
|
21
23
|
fields,
|
|
22
24
|
filterLabel,
|
|
@@ -29,27 +31,29 @@ const MultipleSelectFilter = ({
|
|
|
29
31
|
options,
|
|
30
32
|
placeholder = "Search",
|
|
31
33
|
searchable = true,
|
|
32
|
-
selectedOptions,
|
|
33
|
-
setSelectedOptions,
|
|
34
34
|
themeValues,
|
|
35
35
|
truncateBtnTextWidth = "15rem"
|
|
36
36
|
}) => {
|
|
37
37
|
const [opened, setOpened] = useState(false);
|
|
38
|
+
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
38
39
|
const [appliedOptions, setAppliedOptions] = useState([]);
|
|
40
|
+
const openedRef = useRef(opened);
|
|
39
41
|
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const handleOnClose = () => {
|
|
43
|
+
if (openedRef.current) {
|
|
44
|
+
setOpened(false);
|
|
45
|
+
actions.fields.searchTerm.set("");
|
|
46
|
+
}
|
|
44
47
|
};
|
|
45
|
-
const containerRef = useOutsideClickHook(() =>
|
|
48
|
+
const containerRef = useOutsideClickHook(() => handleOnClose());
|
|
46
49
|
const dropdownRef = useRef(null);
|
|
47
50
|
const filterButtonRef = useRef(null);
|
|
48
51
|
const applyFilterButtonRef = useRef(null);
|
|
49
52
|
const filterDropdownID = `${name}-filter-dropdown`;
|
|
50
|
-
const
|
|
53
|
+
const listGroupID = `${name}-list-group`;
|
|
51
54
|
|
|
52
55
|
useEffect(() => {
|
|
56
|
+
openedRef.current = opened;
|
|
53
57
|
if (!opened) {
|
|
54
58
|
onApply(selectedOptions);
|
|
55
59
|
setAppliedOptions(selectedOptions);
|
|
@@ -77,9 +81,7 @@ const MultipleSelectFilter = ({
|
|
|
77
81
|
filterButtonRef.current &&
|
|
78
82
|
filterButtonRef.current.contains(event.target))
|
|
79
83
|
) {
|
|
80
|
-
|
|
81
|
-
actions.fields.searchTerm.set("");
|
|
82
|
-
onApply(selectedOptions);
|
|
84
|
+
handleOnClose();
|
|
83
85
|
}
|
|
84
86
|
};
|
|
85
87
|
document.addEventListener("keydown", handleKeyDown);
|
|
@@ -98,14 +100,20 @@ const MultipleSelectFilter = ({
|
|
|
98
100
|
setOpened(!opened);
|
|
99
101
|
}}
|
|
100
102
|
opened={opened}
|
|
103
|
+
backgroundHoverColor={
|
|
104
|
+
appliedOptions?.length
|
|
105
|
+
? themeValues.secondaryHoverColor
|
|
106
|
+
: themeValues.primaryHoverColor
|
|
107
|
+
}
|
|
101
108
|
backgroundColor={
|
|
102
|
-
|
|
103
|
-
? themeValues.primaryColor
|
|
104
|
-
: selectedOptions?.length
|
|
109
|
+
appliedOptions?.length
|
|
105
110
|
? themeValues.secondaryColor
|
|
106
|
-
:
|
|
111
|
+
: themeValues.primaryColor
|
|
112
|
+
}
|
|
113
|
+
textColor={appliedOptions?.length ? WHITE : CHARADE_GREY}
|
|
114
|
+
textHoverColor={
|
|
115
|
+
opened && !appliedOptions?.length ? CHARADE_GREY : WHITE
|
|
107
116
|
}
|
|
108
|
-
contentColor={!opened && selectedOptions?.length ? WHITE : CHARADE_GREY}
|
|
109
117
|
name={name}
|
|
110
118
|
filterDropdownID={filterDropdownID}
|
|
111
119
|
hasIcon={hasIcon}
|
|
@@ -113,12 +121,15 @@ const MultipleSelectFilter = ({
|
|
|
113
121
|
truncateBtnTextWidth={truncateBtnTextWidth}
|
|
114
122
|
filterLabel={filterLabel}
|
|
115
123
|
selectedOptions={selectedOptions}
|
|
124
|
+
extraStyles={btnExtraStyles}
|
|
116
125
|
></FilterButton>
|
|
117
126
|
<FilterDropdown
|
|
118
127
|
id={filterDropdownID}
|
|
119
128
|
ref={dropdownRef}
|
|
120
|
-
ariaOwns={
|
|
129
|
+
ariaOwns={listGroupID}
|
|
130
|
+
ariaControls={listGroupID}
|
|
121
131
|
opened={opened}
|
|
132
|
+
extraStyles={dropdownExtraStyles}
|
|
122
133
|
>
|
|
123
134
|
<SearchBox
|
|
124
135
|
showSearchBox={searchable && options?.length > 8}
|
|
@@ -129,7 +140,7 @@ const MultipleSelectFilter = ({
|
|
|
129
140
|
disabled={disabled}
|
|
130
141
|
></SearchBox>
|
|
131
142
|
<FilterableList
|
|
132
|
-
id={
|
|
143
|
+
id={listGroupID}
|
|
133
144
|
options={options}
|
|
134
145
|
appliedOptions={appliedOptions}
|
|
135
146
|
themeValues={themeValues}
|
|
@@ -151,23 +162,20 @@ const MultipleSelectFilter = ({
|
|
|
151
162
|
>
|
|
152
163
|
<ActionLinkButton
|
|
153
164
|
action={() => {
|
|
154
|
-
setOpened(false);
|
|
155
165
|
setSelectedOptions([]);
|
|
156
|
-
|
|
166
|
+
handleOnClose();
|
|
157
167
|
onClear();
|
|
158
168
|
}}
|
|
159
169
|
text="Clear"
|
|
160
170
|
dataQa={`${name}-clear-filters`}
|
|
171
|
+
ariaLabel={"Clear all filters"}
|
|
161
172
|
></ActionLinkButton>
|
|
162
173
|
<ActionLinkButton
|
|
163
174
|
ref={applyFilterButtonRef}
|
|
164
|
-
action={() =>
|
|
165
|
-
setOpened(false);
|
|
166
|
-
actions.fields.searchTerm.set("");
|
|
167
|
-
onApply(selectedOptions);
|
|
168
|
-
}}
|
|
175
|
+
action={() => handleOnClose()}
|
|
169
176
|
text="Apply"
|
|
170
177
|
dataQa={`${name}-apply-filters`}
|
|
178
|
+
ariaLabel={"Apply all filters"}
|
|
171
179
|
></ActionLinkButton>
|
|
172
180
|
</Box>
|
|
173
181
|
</FilterDropdown>
|
|
@@ -41,8 +41,6 @@ const items = [
|
|
|
41
41
|
];
|
|
42
42
|
|
|
43
43
|
const FormWrapper = props => {
|
|
44
|
-
const [selectedItems, setSelectedItems] = useState([]);
|
|
45
|
-
|
|
46
44
|
return (
|
|
47
45
|
<MultipleSelectFilter
|
|
48
46
|
autocompleteValue={props.autocompleteValue}
|
|
@@ -55,8 +53,8 @@ const FormWrapper = props => {
|
|
|
55
53
|
placeholder={"Find an agency"}
|
|
56
54
|
fields={props.fields}
|
|
57
55
|
actions={props.actions}
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
btnExtraStyles={props.btnExtraStyles}
|
|
57
|
+
dropdownExtraStyles={props.dropdownExtraStyles}
|
|
60
58
|
/>
|
|
61
59
|
);
|
|
62
60
|
};
|
|
@@ -5,9 +5,9 @@ import ButtonWithAction from "../../atoms/button-with-action";
|
|
|
5
5
|
|
|
6
6
|
const StyledFilterContainer = styled(Box)`
|
|
7
7
|
position: relative;
|
|
8
|
+
overflow: visible;
|
|
8
9
|
box-sizing: border-box;
|
|
9
10
|
padding: 0;
|
|
10
|
-
${({ extraStyles }) => extraStyles}
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
13
|
export const FilterContainer = forwardRef((props, ref) => (
|
|
@@ -18,7 +18,7 @@ const StyledFilterDropdown = styled(Box)`
|
|
|
18
18
|
position: absolute;
|
|
19
19
|
top: calc(100% + 0.5rem);
|
|
20
20
|
left: 0;
|
|
21
|
-
width:
|
|
21
|
+
width: 18.4rem;
|
|
22
22
|
background-color: white;
|
|
23
23
|
z-index: 1000;
|
|
24
24
|
border-radius: 0.25rem;
|
|
@@ -39,15 +39,23 @@ const FilterButton = styled(ButtonWithAction)`
|
|
|
39
39
|
padding: 0.5rem;
|
|
40
40
|
border-radius: 0.25rem;
|
|
41
41
|
box-shadow: 0px 1px 2px 0px rgba(41, 42, 51, 0.1);
|
|
42
|
-
${({ textColor }) => `
|
|
43
|
-
color: ${textColor};
|
|
42
|
+
${({ opened, textColor, textHoverColor }) => `
|
|
43
|
+
color: ${opened ? textHoverColor : textColor};
|
|
44
|
+
:hover,
|
|
45
|
+
:active,
|
|
46
|
+
:focus {
|
|
47
|
+
color: ${textHoverColor};
|
|
48
|
+
> * {
|
|
49
|
+
color: ${textHoverColor};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
44
52
|
`}
|
|
45
|
-
${({ backgroundColor }) => `
|
|
46
|
-
background-color: ${backgroundColor};
|
|
53
|
+
${({ opened, backgroundColor, backgroundHoverColor }) => `
|
|
54
|
+
background-color: ${opened ? backgroundHoverColor : backgroundColor};
|
|
47
55
|
:hover,
|
|
48
56
|
:active,
|
|
49
57
|
:focus {
|
|
50
|
-
background-color: ${
|
|
58
|
+
background-color: ${backgroundHoverColor};
|
|
51
59
|
}
|
|
52
60
|
`}
|
|
53
61
|
`;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { INFO_BLUE, MATISSE_BLUE } from "../../../constants/colors";
|
|
1
|
+
import { INFO_BLUE, MATISSE_BLUE, WHITE } from "../../../constants/colors";
|
|
2
2
|
|
|
3
|
-
const primaryColor =
|
|
3
|
+
const primaryColor = WHITE;
|
|
4
|
+
const primaryHoverColor = INFO_BLUE;
|
|
4
5
|
const secondaryColor = MATISSE_BLUE;
|
|
6
|
+
const secondaryHoverColor = "#115D7E";
|
|
5
7
|
|
|
6
8
|
export const fallbackValues = {
|
|
7
9
|
primaryColor,
|
|
8
|
-
|
|
10
|
+
primaryHoverColor,
|
|
11
|
+
secondaryColor,
|
|
12
|
+
secondaryHoverColor
|
|
9
13
|
};
|
|
@@ -2,23 +2,26 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import { ButtonWithAction } from "../../../atoms";
|
|
3
3
|
import { FONT_WEIGHT_REGULAR } from "../../../../constants/style_constants";
|
|
4
4
|
|
|
5
|
-
const ActionLinkButton = forwardRef(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const ActionLinkButton = forwardRef(
|
|
6
|
+
({ action, text, dataQa, ariaLabel }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<ButtonWithAction
|
|
9
|
+
ref={ref}
|
|
10
|
+
action={action}
|
|
11
|
+
variant="tertiary"
|
|
12
|
+
extraStyles={`
|
|
12
13
|
padding: 0.2rem;
|
|
13
14
|
margin: 0.5rem;
|
|
14
15
|
min-height: auto;
|
|
15
16
|
min-width: auto;
|
|
16
17
|
`}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
textExtraStyles={`font-weight: ${FONT_WEIGHT_REGULAR};`}
|
|
19
|
+
text={text}
|
|
20
|
+
dataQa={dataQa}
|
|
21
|
+
aria-label={ariaLabel}
|
|
22
|
+
></ButtonWithAction>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
export default ActionLinkButton;
|
|
@@ -11,17 +11,27 @@ const FilterButton = forwardRef(
|
|
|
11
11
|
action = noop,
|
|
12
12
|
opened,
|
|
13
13
|
backgroundColor,
|
|
14
|
-
|
|
14
|
+
backgroundHoverColor,
|
|
15
|
+
textColor,
|
|
16
|
+
textHoverColor,
|
|
15
17
|
name,
|
|
16
18
|
filterDropdownID,
|
|
17
19
|
hasIcon = false,
|
|
18
20
|
icon: Icon,
|
|
19
21
|
truncateBtnTextWidth,
|
|
20
22
|
filterLabel,
|
|
21
|
-
selectedOptions
|
|
23
|
+
selectedOptions,
|
|
24
|
+
extraStyles
|
|
22
25
|
},
|
|
23
26
|
ref
|
|
24
27
|
) => {
|
|
28
|
+
const btnTextFilterDescription = selectedOptions?.length
|
|
29
|
+
? `${filterLabel ? `${filterLabel}: ` : ""}${selectedOptions[0].name}`
|
|
30
|
+
: `${filterLabel ? filterLabel : ""}`;
|
|
31
|
+
const btnTextItemsDescription =
|
|
32
|
+
selectedOptions?.length && selectedOptions?.length > 1
|
|
33
|
+
? `, +${selectedOptions?.length - 1} More`
|
|
34
|
+
: "";
|
|
25
35
|
return (
|
|
26
36
|
<StyledFilterButton
|
|
27
37
|
ref={ref}
|
|
@@ -31,7 +41,13 @@ const FilterButton = forwardRef(
|
|
|
31
41
|
aria-expanded={opened}
|
|
32
42
|
aria-controls={filterDropdownID}
|
|
33
43
|
backgroundColor={backgroundColor}
|
|
44
|
+
backgroundHoverColor={backgroundHoverColor}
|
|
45
|
+
textColor={textColor}
|
|
46
|
+
textHoverColor={textHoverColor}
|
|
47
|
+
opened={opened}
|
|
34
48
|
dataQa={`${name}-filter-button`}
|
|
49
|
+
extraStyles={extraStyles}
|
|
50
|
+
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
35
51
|
contentOverride
|
|
36
52
|
>
|
|
37
53
|
{btnContentOverride ? (
|
|
@@ -42,7 +58,7 @@ const FilterButton = forwardRef(
|
|
|
42
58
|
style={{ display: "flex", flexDirection: "row" }}
|
|
43
59
|
intrinsic
|
|
44
60
|
>
|
|
45
|
-
{hasIcon && <Icon color={
|
|
61
|
+
{hasIcon && <Icon color={opened ? textHoverColor : textColor} />}
|
|
46
62
|
<Center
|
|
47
63
|
as="span"
|
|
48
64
|
style={{
|
|
@@ -54,7 +70,7 @@ const FilterButton = forwardRef(
|
|
|
54
70
|
>
|
|
55
71
|
<Text
|
|
56
72
|
variant="pS"
|
|
57
|
-
color={
|
|
73
|
+
color={opened ? textHoverColor : textColor}
|
|
58
74
|
extraStyles={`
|
|
59
75
|
white-space: nowrap;
|
|
60
76
|
overflow: hidden;
|
|
@@ -62,19 +78,13 @@ const FilterButton = forwardRef(
|
|
|
62
78
|
${truncateBtnTextWidth && `max-width:` + truncateBtnTextWidth}
|
|
63
79
|
`}
|
|
64
80
|
>
|
|
65
|
-
{
|
|
66
|
-
? `${filterLabel ? filterLabel + ": " : ""}${
|
|
67
|
-
selectedOptions[0].name
|
|
68
|
-
}`
|
|
69
|
-
: `${filterLabel ? filterLabel : ""}`}
|
|
81
|
+
{btnTextFilterDescription}
|
|
70
82
|
</Text>
|
|
71
|
-
<Text color={
|
|
72
|
-
{
|
|
73
|
-
? `, +${selectedOptions?.length - 1} More`
|
|
74
|
-
: ""}
|
|
83
|
+
<Text color={opened ? textHoverColor : textColor} variant="pS">
|
|
84
|
+
{btnTextItemsDescription}
|
|
75
85
|
</Text>
|
|
76
86
|
</Center>
|
|
77
|
-
<DropdownIconV2 color={
|
|
87
|
+
<DropdownIconV2 color={opened ? textHoverColor : textColor} />
|
|
78
88
|
</Center>
|
|
79
89
|
)}
|
|
80
90
|
</StyledFilterButton>
|