@thecb/components 10.12.4 → 10.12.5-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 +304 -690
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +305 -689
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/card/CardText.js +3 -4
- package/src/components/atoms/checkbox/Checkbox.js +9 -22
- package/src/components/atoms/checkbox/Checkbox.stories.js +13 -17
- package/src/components/atoms/checkbox/Checkbox.theme.js +2 -6
- package/src/components/atoms/icons/icons.stories.js +1 -5
- package/src/components/atoms/icons/index.js +1 -5
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +25 -33
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.stories.js +4 -2
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +7 -15
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +3 -7
- package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +13 -16
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +14 -24
- package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +18 -22
- package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +41 -43
- package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +41 -52
- package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +7 -10
- package/src/components/molecules/multiple-select-filter/index.d.ts +2 -2
- package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +0 -45
- package/src/components/atoms/icons/PaymentStatusIcon.d.ts +0 -1
- package/src/components/atoms/icons/PaymentStatusIcon.js +0 -28
- package/src/components/atoms/icons/PersonIcon.d.ts +0 -1
- package/src/components/atoms/icons/PersonIcon.js +0 -28
package/package.json
CHANGED
|
Binary file
|
|
@@ -11,7 +11,6 @@ import Paragraph from "../paragraph";
|
|
|
11
11
|
import Stack from "../layouts/Stack";
|
|
12
12
|
import Title from "../title";
|
|
13
13
|
import IconQuitLarge from "../../atoms/icons/IconQuitLarge";
|
|
14
|
-
import { Cluster } from "../layouts";
|
|
15
14
|
|
|
16
15
|
export const CardText = ({
|
|
17
16
|
showQuitLink,
|
|
@@ -28,7 +27,7 @@ export const CardText = ({
|
|
|
28
27
|
<Box padding={padding}>
|
|
29
28
|
<Cover>
|
|
30
29
|
<Stack>
|
|
31
|
-
<
|
|
30
|
+
<Box padding="0">
|
|
32
31
|
{titleText && (
|
|
33
32
|
<Title
|
|
34
33
|
as={titleAs}
|
|
@@ -47,12 +46,12 @@ export const CardText = ({
|
|
|
47
46
|
role="button"
|
|
48
47
|
tabIndex={0}
|
|
49
48
|
aria-label={`Close Card: ${titleText}`}
|
|
50
|
-
extraStyles="cursor: pointer;"
|
|
49
|
+
extraStyles="position: absolute; top: 0.5rem; right: 0.5rem; cursor: pointer;"
|
|
51
50
|
>
|
|
52
51
|
<IconQuitLarge />
|
|
53
52
|
</Box>
|
|
54
53
|
)}
|
|
55
|
-
</
|
|
54
|
+
</Box>
|
|
56
55
|
<Paragraph as={textAs} color={themeValues.textColor}>
|
|
57
56
|
{text}
|
|
58
57
|
</Paragraph>
|
|
@@ -16,7 +16,6 @@ const CheckboxLabelContainer = styled.label`
|
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
column-gap: 1rem;
|
|
19
|
-
cursor: pointer;
|
|
20
19
|
`;
|
|
21
20
|
|
|
22
21
|
const CheckboxIcon = styled.svg`
|
|
@@ -107,8 +106,6 @@ const Checkbox = forwardRef(
|
|
|
107
106
|
labelledById,
|
|
108
107
|
dataQa = null,
|
|
109
108
|
checkboxExtraStyles,
|
|
110
|
-
hasIconOverride = false,
|
|
111
|
-
icon: Icon,
|
|
112
109
|
...rest
|
|
113
110
|
},
|
|
114
111
|
ref
|
|
@@ -135,13 +132,7 @@ const Checkbox = forwardRef(
|
|
|
135
132
|
onKeyDown={e => handleClick(e, onChange)}
|
|
136
133
|
hiddenStyles={hidden}
|
|
137
134
|
background={themeValues.backgroundColor}
|
|
138
|
-
extraStyles={`
|
|
139
|
-
:focus {
|
|
140
|
-
outline: 0;
|
|
141
|
-
}
|
|
142
|
-
${extraStyles};
|
|
143
|
-
margin: ${checkboxMargin};
|
|
144
|
-
`}
|
|
135
|
+
extraStyles={`outline: none; ${extraStyles}; margin: ${checkboxMargin};`}
|
|
145
136
|
{...rest}
|
|
146
137
|
>
|
|
147
138
|
<CheckboxLabelContainer data-qa={dataQa}>
|
|
@@ -173,18 +164,14 @@ const Checkbox = forwardRef(
|
|
|
173
164
|
focusedStyles={themeValues.focusedStyles}
|
|
174
165
|
checkboxExtraStyles={checkboxExtraStyles}
|
|
175
166
|
>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
>
|
|
185
|
-
<polyline points="20 6 9 17 4 12" />
|
|
186
|
-
</CheckboxIcon>
|
|
187
|
-
)}
|
|
167
|
+
<CheckboxIcon
|
|
168
|
+
viewBox="0 0 24 24"
|
|
169
|
+
disabled={disabled}
|
|
170
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
171
|
+
checkColor={themeValues.checkColor}
|
|
172
|
+
>
|
|
173
|
+
<polyline points="20 6 9 17 4 12" />
|
|
174
|
+
</CheckboxIcon>
|
|
188
175
|
</StyledCheckbox>
|
|
189
176
|
</CheckboxContainer>
|
|
190
177
|
{title && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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,22 +10,18 @@ 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
|
-
|
|
25
|
-
onChange={() => setChecked(!checked)}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
13
|
+
export const checkbox = () => (
|
|
14
|
+
<Checkbox
|
|
15
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
16
|
+
title={text("title", "Checkbox", "props")}
|
|
17
|
+
name={text("name", "Checkbox", "props")}
|
|
18
|
+
checked={boolean("checked", false, "props")}
|
|
19
|
+
error={boolean("error", false, "props")}
|
|
20
|
+
disabled={boolean("disabled", false, "props")}
|
|
21
|
+
focused={boolean("focused", false, "props")}
|
|
22
|
+
labelledById={text("labelledById", undefined, "props")}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
29
25
|
|
|
30
26
|
const story = page({
|
|
31
27
|
title: "Components|Atoms/Checkbox",
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
MATISSE_BLUE,
|
|
7
7
|
RED,
|
|
8
8
|
CHARADE_GREY,
|
|
9
|
-
STORM_GREY
|
|
10
|
-
ROYAL_BLUE
|
|
9
|
+
STORM_GREY
|
|
11
10
|
} from "../../../constants/colors";
|
|
12
11
|
|
|
13
12
|
const backgroundColor = { default: `${TRANSPARENT}` };
|
|
@@ -19,10 +18,7 @@ const disabledCheckColor = { default: `${WHITE};` };
|
|
|
19
18
|
const checkColor = { default: `${WHITE};` };
|
|
20
19
|
const errorStyles = { default: `border: 1px solid ${RED};` };
|
|
21
20
|
const focusedStyles = {
|
|
22
|
-
default: `
|
|
23
|
-
outline: 3px solid ${ROYAL_BLUE};
|
|
24
|
-
outline-offset: 3px;
|
|
25
|
-
`
|
|
21
|
+
default: `box-shadow: 0 0 5px 0 ${MATISSE_BLUE};`
|
|
26
22
|
};
|
|
27
23
|
const disabledCheckedStyles = {
|
|
28
24
|
default: `
|
|
@@ -52,9 +52,7 @@ import {
|
|
|
52
52
|
DisabledPaymentMethodsAddIcon,
|
|
53
53
|
ReversalNeededIcon,
|
|
54
54
|
OverageIcon,
|
|
55
|
-
ShortageIcon
|
|
56
|
-
PersonIcon,
|
|
57
|
-
PaymentStatusIcon
|
|
55
|
+
ShortageIcon
|
|
58
56
|
} from "./index";
|
|
59
57
|
|
|
60
58
|
const story = page({
|
|
@@ -116,5 +114,3 @@ export const successfulIcon = () => <SuccessfulIcon />;
|
|
|
116
114
|
export const trashIconV2 = () => <TrashIconV2 />;
|
|
117
115
|
export const verifiedEmailIcon = () => <VerifiedEmailIcon />;
|
|
118
116
|
export const voidedIcon = () => <VoidedIcon />;
|
|
119
|
-
export const personIcon = () => <PersonIcon />;
|
|
120
|
-
export const paymentStatusIcon = () => <PaymentStatusIcon />;
|
|
@@ -99,8 +99,6 @@ 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";
|
|
104
102
|
|
|
105
103
|
export {
|
|
106
104
|
AccountsIcon,
|
|
@@ -203,7 +201,5 @@ export {
|
|
|
203
201
|
OverageIcon,
|
|
204
202
|
ShortageIcon,
|
|
205
203
|
NoResultsIcon,
|
|
206
|
-
AgencyIcon
|
|
207
|
-
PersonIcon,
|
|
208
|
-
PaymentStatusIcon
|
|
204
|
+
AgencyIcon
|
|
209
205
|
};
|
|
@@ -16,9 +16,7 @@ const MultipleSelectFilter = ({
|
|
|
16
16
|
actions,
|
|
17
17
|
autocompleteValue,
|
|
18
18
|
btnContentOverride,
|
|
19
|
-
btnExtraStyles,
|
|
20
19
|
disabled,
|
|
21
|
-
dropdownExtraStyles,
|
|
22
20
|
extraStyles,
|
|
23
21
|
fields,
|
|
24
22
|
filterLabel,
|
|
@@ -31,29 +29,27 @@ const MultipleSelectFilter = ({
|
|
|
31
29
|
options,
|
|
32
30
|
placeholder = "Search",
|
|
33
31
|
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([]);
|
|
39
38
|
const [appliedOptions, setAppliedOptions] = useState([]);
|
|
40
|
-
const openedRef = useRef(opened);
|
|
41
39
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
40
|
+
const handleClickOutsideContainer = () => {
|
|
41
|
+
setOpened(false);
|
|
42
|
+
actions.fields.searchTerm.set("");
|
|
43
|
+
onApply(selectedOptions);
|
|
47
44
|
};
|
|
48
|
-
const containerRef = useOutsideClickHook(() =>
|
|
45
|
+
const containerRef = useOutsideClickHook(() => handleClickOutsideContainer());
|
|
49
46
|
const dropdownRef = useRef(null);
|
|
50
47
|
const filterButtonRef = useRef(null);
|
|
51
48
|
const applyFilterButtonRef = useRef(null);
|
|
52
49
|
const filterDropdownID = `${name}-filter-dropdown`;
|
|
53
|
-
const
|
|
50
|
+
const checkboxListID = `${name}-checkbox-list`;
|
|
54
51
|
|
|
55
52
|
useEffect(() => {
|
|
56
|
-
openedRef.current = opened;
|
|
57
53
|
if (!opened) {
|
|
58
54
|
onApply(selectedOptions);
|
|
59
55
|
setAppliedOptions(selectedOptions);
|
|
@@ -81,7 +77,9 @@ const MultipleSelectFilter = ({
|
|
|
81
77
|
filterButtonRef.current &&
|
|
82
78
|
filterButtonRef.current.contains(event.target))
|
|
83
79
|
) {
|
|
84
|
-
|
|
80
|
+
setOpened(false);
|
|
81
|
+
actions.fields.searchTerm.set("");
|
|
82
|
+
onApply(selectedOptions);
|
|
85
83
|
}
|
|
86
84
|
};
|
|
87
85
|
document.addEventListener("keydown", handleKeyDown);
|
|
@@ -100,20 +98,14 @@ const MultipleSelectFilter = ({
|
|
|
100
98
|
setOpened(!opened);
|
|
101
99
|
}}
|
|
102
100
|
opened={opened}
|
|
103
|
-
backgroundHoverColor={
|
|
104
|
-
appliedOptions?.length
|
|
105
|
-
? themeValues.secondaryHoverColor
|
|
106
|
-
: themeValues.primaryHoverColor
|
|
107
|
-
}
|
|
108
101
|
backgroundColor={
|
|
109
|
-
|
|
102
|
+
opened
|
|
103
|
+
? themeValues.primaryColor
|
|
104
|
+
: selectedOptions?.length
|
|
110
105
|
? themeValues.secondaryColor
|
|
111
|
-
:
|
|
112
|
-
}
|
|
113
|
-
textColor={appliedOptions?.length ? WHITE : CHARADE_GREY}
|
|
114
|
-
textHoverColor={
|
|
115
|
-
opened && !appliedOptions?.length ? CHARADE_GREY : WHITE
|
|
106
|
+
: WHITE
|
|
116
107
|
}
|
|
108
|
+
contentColor={!opened && selectedOptions?.length ? WHITE : CHARADE_GREY}
|
|
117
109
|
name={name}
|
|
118
110
|
filterDropdownID={filterDropdownID}
|
|
119
111
|
hasIcon={hasIcon}
|
|
@@ -121,15 +113,12 @@ const MultipleSelectFilter = ({
|
|
|
121
113
|
truncateBtnTextWidth={truncateBtnTextWidth}
|
|
122
114
|
filterLabel={filterLabel}
|
|
123
115
|
selectedOptions={selectedOptions}
|
|
124
|
-
extraStyles={btnExtraStyles}
|
|
125
116
|
></FilterButton>
|
|
126
117
|
<FilterDropdown
|
|
127
118
|
id={filterDropdownID}
|
|
128
119
|
ref={dropdownRef}
|
|
129
|
-
ariaOwns={
|
|
130
|
-
ariaControls={listGroupID}
|
|
120
|
+
ariaOwns={checkboxListID}
|
|
131
121
|
opened={opened}
|
|
132
|
-
extraStyles={dropdownExtraStyles}
|
|
133
122
|
>
|
|
134
123
|
<SearchBox
|
|
135
124
|
showSearchBox={searchable && options?.length > 8}
|
|
@@ -140,7 +129,7 @@ const MultipleSelectFilter = ({
|
|
|
140
129
|
disabled={disabled}
|
|
141
130
|
></SearchBox>
|
|
142
131
|
<FilterableList
|
|
143
|
-
id={
|
|
132
|
+
id={checkboxListID}
|
|
144
133
|
options={options}
|
|
145
134
|
appliedOptions={appliedOptions}
|
|
146
135
|
themeValues={themeValues}
|
|
@@ -162,20 +151,23 @@ const MultipleSelectFilter = ({
|
|
|
162
151
|
>
|
|
163
152
|
<ActionLinkButton
|
|
164
153
|
action={() => {
|
|
154
|
+
setOpened(false);
|
|
165
155
|
setSelectedOptions([]);
|
|
166
|
-
|
|
156
|
+
actions.fields.searchTerm.set("");
|
|
167
157
|
onClear();
|
|
168
158
|
}}
|
|
169
159
|
text="Clear"
|
|
170
160
|
dataQa={`${name}-clear-filters`}
|
|
171
|
-
ariaLabel={"Clear all filters"}
|
|
172
161
|
></ActionLinkButton>
|
|
173
162
|
<ActionLinkButton
|
|
174
163
|
ref={applyFilterButtonRef}
|
|
175
|
-
action={() =>
|
|
164
|
+
action={() => {
|
|
165
|
+
setOpened(false);
|
|
166
|
+
actions.fields.searchTerm.set("");
|
|
167
|
+
onApply(selectedOptions);
|
|
168
|
+
}}
|
|
176
169
|
text="Apply"
|
|
177
170
|
dataQa={`${name}-apply-filters`}
|
|
178
|
-
ariaLabel={"Apply all filters"}
|
|
179
171
|
></ActionLinkButton>
|
|
180
172
|
</Box>
|
|
181
173
|
</FilterDropdown>
|
|
@@ -41,6 +41,8 @@ const items = [
|
|
|
41
41
|
];
|
|
42
42
|
|
|
43
43
|
const FormWrapper = props => {
|
|
44
|
+
const [selectedItems, setSelectedItems] = useState([]);
|
|
45
|
+
|
|
44
46
|
return (
|
|
45
47
|
<MultipleSelectFilter
|
|
46
48
|
autocompleteValue={props.autocompleteValue}
|
|
@@ -53,8 +55,8 @@ const FormWrapper = props => {
|
|
|
53
55
|
placeholder={"Find an agency"}
|
|
54
56
|
fields={props.fields}
|
|
55
57
|
actions={props.actions}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
selectedOptions={selectedItems}
|
|
59
|
+
setSelectedOptions={setSelectedItems}
|
|
58
60
|
/>
|
|
59
61
|
);
|
|
60
62
|
};
|
|
@@ -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;
|
|
9
8
|
box-sizing: border-box;
|
|
10
9
|
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: 100%;
|
|
22
22
|
background-color: white;
|
|
23
23
|
z-index: 1000;
|
|
24
24
|
border-radius: 0.25rem;
|
|
@@ -39,23 +39,15 @@ 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
|
-
${({
|
|
43
|
-
color: ${
|
|
44
|
-
:hover,
|
|
45
|
-
:active,
|
|
46
|
-
:focus {
|
|
47
|
-
color: ${textHoverColor};
|
|
48
|
-
> * {
|
|
49
|
-
color: ${textHoverColor};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
42
|
+
${({ textColor }) => `
|
|
43
|
+
color: ${textColor};
|
|
52
44
|
`}
|
|
53
|
-
${({
|
|
54
|
-
background-color: ${
|
|
45
|
+
${({ backgroundColor }) => `
|
|
46
|
+
background-color: ${backgroundColor};
|
|
55
47
|
:hover,
|
|
56
48
|
:active,
|
|
57
49
|
:focus {
|
|
58
|
-
background-color: ${
|
|
50
|
+
background-color: ${backgroundColor};
|
|
59
51
|
}
|
|
60
52
|
`}
|
|
61
53
|
`;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { INFO_BLUE, MATISSE_BLUE
|
|
1
|
+
import { INFO_BLUE, MATISSE_BLUE } from "../../../constants/colors";
|
|
2
2
|
|
|
3
|
-
const primaryColor =
|
|
4
|
-
const primaryHoverColor = INFO_BLUE;
|
|
3
|
+
const primaryColor = INFO_BLUE;
|
|
5
4
|
const secondaryColor = MATISSE_BLUE;
|
|
6
|
-
const secondaryHoverColor = "#115D7E";
|
|
7
5
|
|
|
8
6
|
export const fallbackValues = {
|
|
9
7
|
primaryColor,
|
|
10
|
-
|
|
11
|
-
secondaryColor,
|
|
12
|
-
secondaryHoverColor
|
|
8
|
+
secondaryColor
|
|
13
9
|
};
|
|
@@ -2,26 +2,23 @@ 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
|
-
|
|
12
|
-
extraStyles={`
|
|
5
|
+
const ActionLinkButton = forwardRef(({ action, text, dataQa }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<ButtonWithAction
|
|
8
|
+
ref={ref}
|
|
9
|
+
action={action}
|
|
10
|
+
variant="tertiary"
|
|
11
|
+
extraStyles={`
|
|
13
12
|
padding: 0.2rem;
|
|
14
13
|
margin: 0.5rem;
|
|
15
14
|
min-height: auto;
|
|
16
15
|
min-width: auto;
|
|
17
16
|
`}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
);
|
|
17
|
+
textExtraStyles={`font-weight: ${FONT_WEIGHT_REGULAR};`}
|
|
18
|
+
text={text}
|
|
19
|
+
dataQa={dataQa}
|
|
20
|
+
></ButtonWithAction>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
26
23
|
|
|
27
24
|
export default ActionLinkButton;
|
|
@@ -11,27 +11,17 @@ const FilterButton = forwardRef(
|
|
|
11
11
|
action = noop,
|
|
12
12
|
opened,
|
|
13
13
|
backgroundColor,
|
|
14
|
-
|
|
15
|
-
textColor,
|
|
16
|
-
textHoverColor,
|
|
14
|
+
contentColor,
|
|
17
15
|
name,
|
|
18
16
|
filterDropdownID,
|
|
19
17
|
hasIcon = false,
|
|
20
18
|
icon: Icon,
|
|
21
19
|
truncateBtnTextWidth,
|
|
22
20
|
filterLabel,
|
|
23
|
-
selectedOptions
|
|
24
|
-
extraStyles
|
|
21
|
+
selectedOptions
|
|
25
22
|
},
|
|
26
23
|
ref
|
|
27
24
|
) => {
|
|
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
|
-
: "";
|
|
35
25
|
return (
|
|
36
26
|
<StyledFilterButton
|
|
37
27
|
ref={ref}
|
|
@@ -41,13 +31,7 @@ const FilterButton = forwardRef(
|
|
|
41
31
|
aria-expanded={opened}
|
|
42
32
|
aria-controls={filterDropdownID}
|
|
43
33
|
backgroundColor={backgroundColor}
|
|
44
|
-
backgroundHoverColor={backgroundHoverColor}
|
|
45
|
-
textColor={textColor}
|
|
46
|
-
textHoverColor={textHoverColor}
|
|
47
|
-
opened={opened}
|
|
48
34
|
dataQa={`${name}-filter-button`}
|
|
49
|
-
extraStyles={extraStyles}
|
|
50
|
-
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
51
35
|
contentOverride
|
|
52
36
|
>
|
|
53
37
|
{btnContentOverride ? (
|
|
@@ -58,7 +42,7 @@ const FilterButton = forwardRef(
|
|
|
58
42
|
style={{ display: "flex", flexDirection: "row" }}
|
|
59
43
|
intrinsic
|
|
60
44
|
>
|
|
61
|
-
{hasIcon && <Icon color={
|
|
45
|
+
{hasIcon && <Icon color={contentColor} />}
|
|
62
46
|
<Center
|
|
63
47
|
as="span"
|
|
64
48
|
style={{
|
|
@@ -70,7 +54,7 @@ const FilterButton = forwardRef(
|
|
|
70
54
|
>
|
|
71
55
|
<Text
|
|
72
56
|
variant="pS"
|
|
73
|
-
color={
|
|
57
|
+
color={contentColor}
|
|
74
58
|
extraStyles={`
|
|
75
59
|
white-space: nowrap;
|
|
76
60
|
overflow: hidden;
|
|
@@ -78,13 +62,19 @@ const FilterButton = forwardRef(
|
|
|
78
62
|
${truncateBtnTextWidth && `max-width:` + truncateBtnTextWidth}
|
|
79
63
|
`}
|
|
80
64
|
>
|
|
81
|
-
{
|
|
65
|
+
{selectedOptions?.length
|
|
66
|
+
? `${filterLabel ? filterLabel + ": " : ""}${
|
|
67
|
+
selectedOptions[0].name
|
|
68
|
+
}`
|
|
69
|
+
: `${filterLabel ? filterLabel : ""}`}
|
|
82
70
|
</Text>
|
|
83
|
-
<Text color={
|
|
84
|
-
{
|
|
71
|
+
<Text color={contentColor} variant="pS">
|
|
72
|
+
{selectedOptions?.length && selectedOptions?.length > 1
|
|
73
|
+
? `, +${selectedOptions?.length - 1} More`
|
|
74
|
+
: ""}
|
|
85
75
|
</Text>
|
|
86
76
|
</Center>
|
|
87
|
-
<DropdownIconV2 color={
|
|
77
|
+
<DropdownIconV2 color={contentColor} />
|
|
88
78
|
</Center>
|
|
89
79
|
)}
|
|
90
80
|
</StyledFilterButton>
|
|
@@ -1,27 +1,23 @@
|
|
|
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
|
-
|
|
22
|
-
</>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
);
|
|
4
|
+
const FilterDropdown = forwardRef(({ id, ariaOwns, opened, children }, ref) => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
{opened && (
|
|
8
|
+
<FilterDropdownContainer
|
|
9
|
+
ref={ref}
|
|
10
|
+
id={id}
|
|
11
|
+
role="combobox"
|
|
12
|
+
aria-expanded={opened}
|
|
13
|
+
aria-haspopup="listbox"
|
|
14
|
+
aria-owns={ariaOwns}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</FilterDropdownContainer>
|
|
18
|
+
)}
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
26
22
|
|
|
27
23
|
export default FilterDropdown;
|