@thecb/components 11.1.9 → 11.1.11-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 +13 -63
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -63
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +10 -49
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +1 -3
- package/src/components/molecules/multiple-select-filter/__private__/util.js +0 -13
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +22 -6
package/package.json
CHANGED
|
Binary file
|
|
@@ -11,7 +11,6 @@ import FilterDropdown from "./__private__/FilterDropdown";
|
|
|
11
11
|
import SearchBox from "./__private__/SearchBox";
|
|
12
12
|
import FilterableList from "./__private__/FilterableList";
|
|
13
13
|
import useOutsideClickHook from "../../../hooks/use-outside-click";
|
|
14
|
-
import { mergeOptions } from "./__private__/util";
|
|
15
14
|
|
|
16
15
|
const MultipleSelectFilter = ({
|
|
17
16
|
actions,
|
|
@@ -33,71 +32,34 @@ const MultipleSelectFilter = ({
|
|
|
33
32
|
placeholder = "Search",
|
|
34
33
|
searchable = true,
|
|
35
34
|
themeValues,
|
|
36
|
-
truncateBtnTextWidth = "15rem"
|
|
37
|
-
activeAppliedOptions
|
|
35
|
+
truncateBtnTextWidth = "15rem"
|
|
38
36
|
}) => {
|
|
39
|
-
// State to manage whether the dropdown is open or closed
|
|
40
37
|
const [opened, setOpened] = useState(false);
|
|
41
|
-
|
|
42
|
-
// State to manage the currently selected options
|
|
43
38
|
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
44
|
-
|
|
45
|
-
// State to manage the applied options, initialized with activeAppliedOptions or an empty array
|
|
46
|
-
const [appliedOptions, setAppliedOptions] = useState(
|
|
47
|
-
activeAppliedOptions || []
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// State to track whether the user has interacted with the component
|
|
51
|
-
const [hasInteracted, setHasInteracted] = useState(false);
|
|
52
|
-
|
|
53
|
-
// Reference to keep track of the opened state across renders without causing re-renders
|
|
39
|
+
const [appliedOptions, setAppliedOptions] = useState([]);
|
|
54
40
|
const openedRef = useRef(opened);
|
|
55
41
|
|
|
56
|
-
// Hook to detect clicks outside the component and close the dropdown
|
|
57
|
-
const containerRef = useOutsideClickHook(() => handleOnClose());
|
|
58
|
-
|
|
59
|
-
// References to various elements within the component
|
|
60
|
-
const dropdownRef = useRef(null);
|
|
61
|
-
const filterButtonRef = useRef(null);
|
|
62
|
-
const applyFilterButtonRef = useRef(null);
|
|
63
|
-
|
|
64
|
-
// IDs for accessibility and identification purposes
|
|
65
|
-
const filterDropdownID = `${name}-filter-dropdown`;
|
|
66
|
-
const listGroupID = `${name}-list-group`;
|
|
67
|
-
|
|
68
42
|
const handleOnClose = () => {
|
|
69
43
|
if (openedRef.current) {
|
|
70
44
|
setOpened(false);
|
|
71
45
|
actions.fields.searchTerm.set("");
|
|
72
46
|
}
|
|
73
47
|
};
|
|
48
|
+
const containerRef = useOutsideClickHook(() => handleOnClose());
|
|
49
|
+
const dropdownRef = useRef(null);
|
|
50
|
+
const filterButtonRef = useRef(null);
|
|
51
|
+
const applyFilterButtonRef = useRef(null);
|
|
52
|
+
const filterDropdownID = `${name}-filter-dropdown`;
|
|
53
|
+
const listGroupID = `${name}-list-group`;
|
|
74
54
|
|
|
75
55
|
useEffect(() => {
|
|
76
56
|
openedRef.current = opened;
|
|
77
57
|
if (!opened) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
setAppliedOptions(selectedOptions);
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
setHasInteracted(true);
|
|
58
|
+
onApply(selectedOptions);
|
|
59
|
+
setAppliedOptions(selectedOptions);
|
|
84
60
|
}
|
|
85
61
|
}, [opened]);
|
|
86
62
|
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
// Update the applied options state with the current active applied options,
|
|
89
|
-
// or an empty array if activeAppliedOptions is undefined or null.
|
|
90
|
-
// This ensures that the current applied options are in sync with the parent component.
|
|
91
|
-
setAppliedOptions(activeAppliedOptions || []);
|
|
92
|
-
|
|
93
|
-
// Merge the selected options with the active applied options.
|
|
94
|
-
const mergedSelections = mergeOptions(
|
|
95
|
-
selectedOptions,
|
|
96
|
-
activeAppliedOptions
|
|
97
|
-
);
|
|
98
|
-
setSelectedOptions(mergedSelections);
|
|
99
|
-
}, [activeAppliedOptions]);
|
|
100
|
-
|
|
101
63
|
useEffect(() => {
|
|
102
64
|
const handleKeyDown = event => {
|
|
103
65
|
if (event.key === "Escape") {
|
|
@@ -160,7 +122,6 @@ const MultipleSelectFilter = ({
|
|
|
160
122
|
filterLabel={filterLabel}
|
|
161
123
|
selectedOptions={selectedOptions}
|
|
162
124
|
extraStyles={btnExtraStyles}
|
|
163
|
-
dataAppliedOptions={appliedOptions?.length}
|
|
164
125
|
></FilterButton>
|
|
165
126
|
<FilterDropdown
|
|
166
127
|
id={filterDropdownID}
|
|
@@ -21,8 +21,7 @@ const FilterButton = forwardRef(
|
|
|
21
21
|
truncateBtnTextWidth,
|
|
22
22
|
filterLabel,
|
|
23
23
|
selectedOptions,
|
|
24
|
-
extraStyles
|
|
25
|
-
dataAppliedOptions
|
|
24
|
+
extraStyles
|
|
26
25
|
},
|
|
27
26
|
ref
|
|
28
27
|
) => {
|
|
@@ -49,7 +48,6 @@ const FilterButton = forwardRef(
|
|
|
49
48
|
dataQa={`${name}-filter-button`}
|
|
50
49
|
extraStyles={extraStyles}
|
|
51
50
|
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
52
|
-
data-applied-options={dataAppliedOptions}
|
|
53
51
|
contentOverride
|
|
54
52
|
>
|
|
55
53
|
{btnContentOverride ? (
|
|
@@ -29,16 +29,3 @@ export const selectOption = (option, selectedOptions, setSelectedOptions) => {
|
|
|
29
29
|
setSelectedOptions(moreOptions);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
export const mergeOptions = (selectedOptions, activeOptions) => {
|
|
34
|
-
if (!activeOptions.length) return selectedOptions;
|
|
35
|
-
if (!selectedOptions.length) return activeOptions;
|
|
36
|
-
|
|
37
|
-
const mergedOptions = [...selectedOptions];
|
|
38
|
-
activeOptions.forEach(activeOption => {
|
|
39
|
-
if (!mergedOptions.some(option => option.name === activeOption.name)) {
|
|
40
|
-
mergedOptions.push(activeOption);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return mergedOptions;
|
|
44
|
-
};
|
|
@@ -8,6 +8,7 @@ import { SEA_GREEN } from "../../../../constants/colors";
|
|
|
8
8
|
import { ACH_METHOD, CC_METHOD } from "../../../../constants/general";
|
|
9
9
|
import { titleCaseString, noop } from "../../../../util/general";
|
|
10
10
|
import { FONT_WEIGHT_REGULAR } from "../../../../constants/style_constants";
|
|
11
|
+
import Paragraph from "../../../atoms/paragraph/index";
|
|
11
12
|
|
|
12
13
|
const AutopayModalModule = ({
|
|
13
14
|
autoPayActive,
|
|
@@ -54,13 +55,28 @@ const AutopayModalModule = ({
|
|
|
54
55
|
const nextDate = dueDate || nextAutopayDate;
|
|
55
56
|
const modalExtraProps = {
|
|
56
57
|
modalHeaderText: autoPayActive ? deactivateText : activateText,
|
|
57
|
-
modalBodyText: autoPayActive
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
modalBodyText: autoPayActive ? (
|
|
59
|
+
<>
|
|
60
|
+
<Paragraph>
|
|
61
|
+
Are you sure you want to stop {plan}?
|
|
62
|
+
{!inactive && nextDate && nextDate !== "On"
|
|
60
63
|
? "Your next payment will be due on " + nextDate + "."
|
|
61
|
-
: ""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
: ""}
|
|
65
|
+
</Paragraph>
|
|
66
|
+
{!isPaymentPlan && (
|
|
67
|
+
<>
|
|
68
|
+
<br />
|
|
69
|
+
<Paragraph>
|
|
70
|
+
If your next autopayment is scheduled to run today, you may be
|
|
71
|
+
billed today and autopay will then stop for the next billing
|
|
72
|
+
cycle.
|
|
73
|
+
</Paragraph>
|
|
74
|
+
</>
|
|
75
|
+
)}
|
|
76
|
+
</>
|
|
77
|
+
) : (
|
|
78
|
+
generateMethodNeededText(plan, allowedPaymentInstruments)
|
|
79
|
+
),
|
|
64
80
|
continueButtonText: autoPayActive ? `Stop ${shortPlan}` : "Add",
|
|
65
81
|
useDangerButton: autoPayActive,
|
|
66
82
|
continueAction: autoPayActive
|