@thecb/components 10.12.1-beta.0 → 10.12.2-beta.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 +274 -121
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +13 -8
- package/dist/index.esm.js +273 -122
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/card/Card.js +9 -0
- package/src/components/atoms/card/CardText.js +34 -11
- package/src/components/atoms/card/index.d.ts +7 -1
- package/src/components/atoms/checkbox/Checkbox.js +14 -8
- 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 +26 -32
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.stories.js +2 -4
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +2 -2
- package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +16 -13
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +13 -9
- 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 +53 -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/src/hooks/use-outside-click/index.js +4 -5
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import Stack from "../layouts/Stack";
|
|
|
14
14
|
import CardImage from "./CardImage.styled";
|
|
15
15
|
import CardText from "./CardText";
|
|
16
16
|
import CardHeader from "./CardHeader";
|
|
17
|
+
import { noop } from "../../../util/general";
|
|
17
18
|
|
|
18
19
|
const Card = ({
|
|
19
20
|
borderRadius = "4px",
|
|
@@ -26,8 +27,12 @@ const Card = ({
|
|
|
26
27
|
imgHeight = "150px",
|
|
27
28
|
imgObjectFit = "none",
|
|
28
29
|
imgAltText,
|
|
30
|
+
onQuitClick = noop,
|
|
29
31
|
padding = "24px",
|
|
32
|
+
showQuitLink = false,
|
|
30
33
|
text,
|
|
34
|
+
textAs = "p",
|
|
35
|
+
titleAs = "h2",
|
|
31
36
|
titleText,
|
|
32
37
|
titleVariant = "small",
|
|
33
38
|
themeValues,
|
|
@@ -90,9 +95,13 @@ const Card = ({
|
|
|
90
95
|
<Box padding="0" width="100%" extraStyles="flex-basis: 100%;">
|
|
91
96
|
{text && (
|
|
92
97
|
<CardText
|
|
98
|
+
onQuitClick={onQuitClick}
|
|
93
99
|
padding={padding}
|
|
100
|
+
showQuitLink={showQuitLink}
|
|
101
|
+
titleAs={titleAs}
|
|
94
102
|
titleText={titleText}
|
|
95
103
|
text={text}
|
|
104
|
+
textAs={textAs}
|
|
96
105
|
titleVariant={titleVariant}
|
|
97
106
|
/>
|
|
98
107
|
)}
|
|
@@ -10,10 +10,16 @@ import Cover from "../layouts/Cover";
|
|
|
10
10
|
import Paragraph from "../paragraph";
|
|
11
11
|
import Stack from "../layouts/Stack";
|
|
12
12
|
import Title from "../title";
|
|
13
|
+
import IconQuitLarge from "../../atoms/icons/IconQuitLarge";
|
|
14
|
+
import { Cluster } from "../layouts";
|
|
13
15
|
|
|
14
16
|
export const CardText = ({
|
|
17
|
+
showQuitLink,
|
|
18
|
+
onQuitClick,
|
|
19
|
+
titleAs,
|
|
15
20
|
padding,
|
|
16
21
|
text,
|
|
22
|
+
textAs = "p",
|
|
17
23
|
titleText,
|
|
18
24
|
titleVariant = "small",
|
|
19
25
|
themeValues
|
|
@@ -22,17 +28,34 @@ export const CardText = ({
|
|
|
22
28
|
<Box padding={padding}>
|
|
23
29
|
<Cover>
|
|
24
30
|
<Stack>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<Cluster justify="space-between" align="center" overflow={true}>
|
|
32
|
+
{titleText && (
|
|
33
|
+
<Title
|
|
34
|
+
as={titleAs}
|
|
35
|
+
variant={titleVariant}
|
|
36
|
+
color={themeValues.titleColor}
|
|
37
|
+
weight={themeValues.titleWeight}
|
|
38
|
+
>
|
|
39
|
+
{titleText}
|
|
40
|
+
</Title>
|
|
41
|
+
)}
|
|
42
|
+
{showQuitLink && (
|
|
43
|
+
<Box
|
|
44
|
+
padding="0"
|
|
45
|
+
onClick={onQuitClick}
|
|
46
|
+
onKeyDown={e => e.key === "Enter" && onQuitClick()}
|
|
47
|
+
role="button"
|
|
48
|
+
tabIndex={0}
|
|
49
|
+
aria-label={`Close Card: ${titleText}`}
|
|
50
|
+
extraStyles="cursor: pointer;"
|
|
51
|
+
>
|
|
52
|
+
<IconQuitLarge />
|
|
53
|
+
</Box>
|
|
54
|
+
)}
|
|
55
|
+
</Cluster>
|
|
56
|
+
<Paragraph as={textAs} color={themeValues.textColor}>
|
|
57
|
+
{text}
|
|
58
|
+
</Paragraph>
|
|
36
59
|
</Stack>
|
|
37
60
|
</Cover>
|
|
38
61
|
</Box>
|
|
@@ -2,8 +2,10 @@ import React from "react";
|
|
|
2
2
|
import Expand from "../../../util/expand";
|
|
3
3
|
|
|
4
4
|
export interface CardProps {
|
|
5
|
-
text?: string;
|
|
5
|
+
text?: string | React.ReactNode;
|
|
6
|
+
textAs?: string;
|
|
6
7
|
titleText?: string;
|
|
8
|
+
titleAs?: string;
|
|
7
9
|
titleVariant?: string;
|
|
8
10
|
extraStyles?: string;
|
|
9
11
|
imgSrc?: string;
|
|
@@ -27,6 +29,10 @@ export interface CardProps {
|
|
|
27
29
|
borderRadius?: string;
|
|
28
30
|
width?: string;
|
|
29
31
|
padding?: string;
|
|
32
|
+
showQuitLink?: boolean;
|
|
33
|
+
onQuitClick?: (
|
|
34
|
+
event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>
|
|
35
|
+
) => void;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export const Card: React.FC<Expand<CardProps> &
|
|
@@ -106,6 +106,8 @@ const Checkbox = forwardRef(
|
|
|
106
106
|
labelledById,
|
|
107
107
|
dataQa = null,
|
|
108
108
|
checkboxExtraStyles,
|
|
109
|
+
hasIconOverride = false,
|
|
110
|
+
icon: Icon,
|
|
109
111
|
...rest
|
|
110
112
|
},
|
|
111
113
|
ref
|
|
@@ -164,14 +166,18 @@ const Checkbox = forwardRef(
|
|
|
164
166
|
focusedStyles={themeValues.focusedStyles}
|
|
165
167
|
checkboxExtraStyles={checkboxExtraStyles}
|
|
166
168
|
>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
{hasIconOverride ? (
|
|
170
|
+
<Icon />
|
|
171
|
+
) : (
|
|
172
|
+
<CheckboxIcon
|
|
173
|
+
viewBox="0 0 24 24"
|
|
174
|
+
disabled={disabled}
|
|
175
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
176
|
+
checkColor={themeValues.checkColor}
|
|
177
|
+
>
|
|
178
|
+
<polyline points="20 6 9 17 4 12" />
|
|
179
|
+
</CheckboxIcon>
|
|
180
|
+
)}
|
|
175
181
|
</StyledCheckbox>
|
|
176
182
|
</CheckboxContainer>
|
|
177
183
|
{title && (
|
|
@@ -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 = "14",
|
|
6
|
+
height = "15",
|
|
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="M12.25 1.8125H1.75C1.50838 1.8125 1.3125 2.00838 1.3125 2.25V12.75C1.3125 12.9916 1.50838 13.1875 1.75 13.1875H2.625V11.7778C2.625 9.89848 4.02411 8.375 5.75 8.375H8.25C9.97589 8.375 11.375 9.89848 11.375 11.7778V13.1875H12.25C12.4916 13.1875 12.6875 12.9916 12.6875 12.75V2.25C12.6875 2.00838 12.4916 1.8125 12.25 1.8125ZM1.75 14.5H2.625H11.375H12.25C13.2165 14.5 14 13.7165 14 12.75V2.25C14 1.2835 13.2165 0.5 12.25 0.5H1.75C0.783502 0.5 0 1.2835 0 2.25V12.75C0 13.7165 0.783502 14.5 1.75 14.5ZM7 7.5C8.20812 7.5 9.1875 6.52062 9.1875 5.3125C9.1875 4.10438 8.20812 3.125 7 3.125C5.79188 3.125 4.8125 4.10438 4.8125 5.3125C4.8125 6.52062 5.79188 7.5 7 7.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
|
};
|
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
|
|
|
2
2
|
import { fallbackValues } from "./MultipleSelectFilter.theme";
|
|
3
3
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
4
|
import { Box } from "../../atoms/layouts";
|
|
5
|
-
import { GHOST_GREY, WHITE } from "../../../constants/colors";
|
|
5
|
+
import { GHOST_GREY, WHITE, CHARADE_GREY } from "../../../constants/colors";
|
|
6
6
|
import { noop } from "../../../util/general";
|
|
7
7
|
import { FilterContainer } from "./MultipleSelectFilter.styled";
|
|
8
8
|
import ActionLinkButton from "./__private__/ActionLinkButton";
|
|
@@ -10,12 +10,15 @@ import FilterButton from "./__private__/FilterButton";
|
|
|
10
10
|
import FilterDropdown from "./__private__/FilterDropdown";
|
|
11
11
|
import SearchBox from "./__private__/SearchBox";
|
|
12
12
|
import FilterableList from "./__private__/FilterableList";
|
|
13
|
+
import useOutsideClickHook from "../../../hooks/use-outside-click";
|
|
13
14
|
|
|
14
15
|
const MultipleSelectFilter = ({
|
|
15
16
|
actions,
|
|
16
17
|
autocompleteValue,
|
|
17
18
|
btnContentOverride,
|
|
19
|
+
btnExtraStyles,
|
|
18
20
|
disabled,
|
|
21
|
+
dropdownExtraStyles,
|
|
19
22
|
extraStyles,
|
|
20
23
|
fields,
|
|
21
24
|
filterLabel,
|
|
@@ -28,22 +31,29 @@ const MultipleSelectFilter = ({
|
|
|
28
31
|
options,
|
|
29
32
|
placeholder = "Search",
|
|
30
33
|
searchable = true,
|
|
31
|
-
selectedOptions,
|
|
32
|
-
setSelectedOptions,
|
|
33
34
|
themeValues,
|
|
34
35
|
truncateBtnTextWidth = "15rem"
|
|
35
36
|
}) => {
|
|
36
37
|
const [opened, setOpened] = useState(false);
|
|
38
|
+
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
37
39
|
const [appliedOptions, setAppliedOptions] = useState([]);
|
|
40
|
+
const openedRef = useRef(opened);
|
|
38
41
|
|
|
39
|
-
const
|
|
42
|
+
const handleOnClose = () => {
|
|
43
|
+
if (openedRef.current) {
|
|
44
|
+
setOpened(false);
|
|
45
|
+
actions.fields.searchTerm.set("");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const containerRef = useOutsideClickHook(() => handleOnClose());
|
|
40
49
|
const dropdownRef = useRef(null);
|
|
41
50
|
const filterButtonRef = useRef(null);
|
|
42
51
|
const applyFilterButtonRef = useRef(null);
|
|
43
52
|
const filterDropdownID = `${name}-filter-dropdown`;
|
|
44
|
-
const
|
|
53
|
+
const listGroupID = `${name}-list-group`;
|
|
45
54
|
|
|
46
55
|
useEffect(() => {
|
|
56
|
+
openedRef.current = opened;
|
|
47
57
|
if (!opened) {
|
|
48
58
|
onApply(selectedOptions);
|
|
49
59
|
setAppliedOptions(selectedOptions);
|
|
@@ -71,27 +81,11 @@ const MultipleSelectFilter = ({
|
|
|
71
81
|
filterButtonRef.current &&
|
|
72
82
|
filterButtonRef.current.contains(event.target))
|
|
73
83
|
) {
|
|
74
|
-
|
|
75
|
-
actions.fields.searchTerm.set("");
|
|
76
|
-
onApply(selectedOptions);
|
|
84
|
+
handleOnClose();
|
|
77
85
|
}
|
|
78
86
|
};
|
|
79
|
-
const handleClickOutside = event => {
|
|
80
|
-
if (
|
|
81
|
-
containerRef.current &&
|
|
82
|
-
!containerRef.current.contains(event.target) &&
|
|
83
|
-
dropdownRef.current &&
|
|
84
|
-
!dropdownRef.current.contains(event.target)
|
|
85
|
-
) {
|
|
86
|
-
setOpened(false);
|
|
87
|
-
actions.fields.searchTerm.set("");
|
|
88
|
-
onApply(selectedOptions);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
92
87
|
document.addEventListener("keydown", handleKeyDown);
|
|
93
88
|
return () => {
|
|
94
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
95
89
|
document.removeEventListener("keydown", handleKeyDown);
|
|
96
90
|
};
|
|
97
91
|
}, []);
|
|
@@ -113,7 +107,7 @@ const MultipleSelectFilter = ({
|
|
|
113
107
|
? themeValues.secondaryColor
|
|
114
108
|
: WHITE
|
|
115
109
|
}
|
|
116
|
-
contentColor={!opened && selectedOptions?.length ? WHITE :
|
|
110
|
+
contentColor={!opened && selectedOptions?.length ? WHITE : CHARADE_GREY}
|
|
117
111
|
name={name}
|
|
118
112
|
filterDropdownID={filterDropdownID}
|
|
119
113
|
hasIcon={hasIcon}
|
|
@@ -121,12 +115,15 @@ const MultipleSelectFilter = ({
|
|
|
121
115
|
truncateBtnTextWidth={truncateBtnTextWidth}
|
|
122
116
|
filterLabel={filterLabel}
|
|
123
117
|
selectedOptions={selectedOptions}
|
|
118
|
+
extraStyles={btnExtraStyles}
|
|
124
119
|
></FilterButton>
|
|
125
120
|
<FilterDropdown
|
|
126
121
|
id={filterDropdownID}
|
|
127
122
|
ref={dropdownRef}
|
|
128
|
-
ariaOwns={
|
|
123
|
+
ariaOwns={listGroupID}
|
|
124
|
+
ariaControls={listGroupID}
|
|
129
125
|
opened={opened}
|
|
126
|
+
extraStyles={dropdownExtraStyles}
|
|
130
127
|
>
|
|
131
128
|
<SearchBox
|
|
132
129
|
showSearchBox={searchable && options?.length > 8}
|
|
@@ -137,7 +134,7 @@ const MultipleSelectFilter = ({
|
|
|
137
134
|
disabled={disabled}
|
|
138
135
|
></SearchBox>
|
|
139
136
|
<FilterableList
|
|
140
|
-
id={
|
|
137
|
+
id={listGroupID}
|
|
141
138
|
options={options}
|
|
142
139
|
appliedOptions={appliedOptions}
|
|
143
140
|
themeValues={themeValues}
|
|
@@ -159,23 +156,20 @@ const MultipleSelectFilter = ({
|
|
|
159
156
|
>
|
|
160
157
|
<ActionLinkButton
|
|
161
158
|
action={() => {
|
|
162
|
-
setOpened(false);
|
|
163
159
|
setSelectedOptions([]);
|
|
164
|
-
|
|
160
|
+
handleOnClose();
|
|
165
161
|
onClear();
|
|
166
162
|
}}
|
|
167
163
|
text="Clear"
|
|
168
164
|
dataQa={`${name}-clear-filters`}
|
|
165
|
+
ariaLabel={"Clear all filters"}
|
|
169
166
|
></ActionLinkButton>
|
|
170
167
|
<ActionLinkButton
|
|
171
168
|
ref={applyFilterButtonRef}
|
|
172
|
-
action={() =>
|
|
173
|
-
setOpened(false);
|
|
174
|
-
actions.fields.searchTerm.set("");
|
|
175
|
-
onApply(selectedOptions);
|
|
176
|
-
}}
|
|
169
|
+
action={() => handleOnClose()}
|
|
177
170
|
text="Apply"
|
|
178
171
|
dataQa={`${name}-apply-filters`}
|
|
172
|
+
ariaLabel={"Apply all filters"}
|
|
179
173
|
></ActionLinkButton>
|
|
180
174
|
</Box>
|
|
181
175
|
</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;
|
|
@@ -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;
|
|
@@ -18,10 +18,18 @@ const FilterButton = forwardRef(
|
|
|
18
18
|
icon: Icon,
|
|
19
19
|
truncateBtnTextWidth,
|
|
20
20
|
filterLabel,
|
|
21
|
-
selectedOptions
|
|
21
|
+
selectedOptions,
|
|
22
|
+
extraStyles
|
|
22
23
|
},
|
|
23
24
|
ref
|
|
24
25
|
) => {
|
|
26
|
+
const btnTextFilterDescription = selectedOptions?.length
|
|
27
|
+
? `${filterLabel ? `${filterLabel}: ` : ""}${selectedOptions[0].name}`
|
|
28
|
+
: `${filterLabel ? filterLabel : ""}`;
|
|
29
|
+
const btnTextItemsDescription =
|
|
30
|
+
selectedOptions?.length && selectedOptions?.length > 1
|
|
31
|
+
? `, +${selectedOptions?.length - 1} More`
|
|
32
|
+
: "";
|
|
25
33
|
return (
|
|
26
34
|
<StyledFilterButton
|
|
27
35
|
ref={ref}
|
|
@@ -32,6 +40,8 @@ const FilterButton = forwardRef(
|
|
|
32
40
|
aria-controls={filterDropdownID}
|
|
33
41
|
backgroundColor={backgroundColor}
|
|
34
42
|
dataQa={`${name}-filter-button`}
|
|
43
|
+
extraStyles={extraStyles}
|
|
44
|
+
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
35
45
|
contentOverride
|
|
36
46
|
>
|
|
37
47
|
{btnContentOverride ? (
|
|
@@ -62,16 +72,10 @@ const FilterButton = forwardRef(
|
|
|
62
72
|
${truncateBtnTextWidth && `max-width:` + truncateBtnTextWidth}
|
|
63
73
|
`}
|
|
64
74
|
>
|
|
65
|
-
{
|
|
66
|
-
? `${filterLabel ? filterLabel + ": " : ""}${
|
|
67
|
-
selectedOptions[0].name
|
|
68
|
-
}`
|
|
69
|
-
: `${filterLabel ? filterLabel : ""}`}
|
|
75
|
+
{btnTextFilterDescription}
|
|
70
76
|
</Text>
|
|
71
77
|
<Text color={contentColor} variant="pS">
|
|
72
|
-
{
|
|
73
|
-
? `, +${selectedOptions?.length - 1} More`
|
|
74
|
-
: ""}
|
|
78
|
+
{btnTextItemsDescription}
|
|
75
79
|
</Text>
|
|
76
80
|
</Center>
|
|
77
81
|
<DropdownIconV2 color={contentColor} />
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { FilterDropdownContainer } from "../MultipleSelectFilter.styled";
|
|
3
3
|
|
|
4
|
-
const FilterDropdown = forwardRef(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
4
|
+
const FilterDropdown = forwardRef(
|
|
5
|
+
({ id, ariaOwns, ariaControls, opened, extraStyles, children }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
{opened && (
|
|
9
|
+
<FilterDropdownContainer
|
|
10
|
+
ref={ref}
|
|
11
|
+
id={id}
|
|
12
|
+
role="combobox"
|
|
13
|
+
aria-expanded={opened}
|
|
14
|
+
aria-haspopup="listbox"
|
|
15
|
+
aria-owns={ariaOwns}
|
|
16
|
+
aria-controls={ariaControls}
|
|
17
|
+
extraStyles={extraStyles}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</FilterDropdownContainer>
|
|
21
|
+
)}
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
22
26
|
|
|
23
27
|
export default FilterDropdown;
|