@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.esm.js CHANGED
@@ -46854,7 +46854,7 @@ var AutopayModalModule = function AutopayModalModule(_ref) {
46854
46854
  var nextDate = dueDate || nextAutopayDate;
46855
46855
  var modalExtraProps = {
46856
46856
  modalHeaderText: autoPayActive ? deactivateText : activateText,
46857
- modalBodyText: autoPayActive ? "Are you sure you want to stop ".concat(plan, "? ").concat(!inactive && nextDate && nextDate !== "On" ? "Your next payment will be due on " + nextDate + "." : "") : generateMethodNeededText(plan, allowedPaymentInstruments),
46857
+ modalBodyText: autoPayActive ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Paragraph$1, null, "Are you sure you want to stop ", plan, "?", !inactive && nextDate && nextDate !== "On" ? "Your next payment will be due on " + nextDate + "." : ""), !isPaymentPlan && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Paragraph$1, null, "If your next autopayment is scheduled to run today, you may be billed today and autopay will then stop for the next billing cycle."))) : generateMethodNeededText(plan, allowedPaymentInstruments),
46858
46858
  continueButtonText: autoPayActive ? "Stop ".concat(shortPlan) : "Add",
46859
46859
  useDangerButton: autoPayActive,
46860
46860
  continueAction: autoPayActive ? function () {
@@ -50732,8 +50732,7 @@ var FilterButton$1 = /*#__PURE__*/forwardRef(function (_ref, ref) {
50732
50732
  truncateBtnTextWidth = _ref.truncateBtnTextWidth,
50733
50733
  filterLabel = _ref.filterLabel,
50734
50734
  selectedOptions = _ref.selectedOptions,
50735
- extraStyles = _ref.extraStyles,
50736
- dataAppliedOptions = _ref.dataAppliedOptions;
50735
+ extraStyles = _ref.extraStyles;
50737
50736
  var btnTextFilterDescription = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? "".concat(filterLabel ? "".concat(filterLabel, ": ") : "").concat(selectedOptions[0].name) : "".concat(filterLabel ? filterLabel : "");
50738
50737
  var btnTextItemsDescription = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 1 ? ", +".concat((selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) - 1, " More") : "";
50739
50738
  return /*#__PURE__*/React.createElement(StyledFilterButton, {
@@ -50751,7 +50750,6 @@ var FilterButton$1 = /*#__PURE__*/forwardRef(function (_ref, ref) {
50751
50750
  dataQa: "".concat(name, "-filter-button"),
50752
50751
  extraStyles: extraStyles,
50753
50752
  "aria-label": "".concat(filterLabel, " Filter: ").concat(btnTextFilterDescription, " ").concat(btnTextItemsDescription),
50754
- "data-applied-options": dataAppliedOptions,
50755
50753
  contentOverride: true
50756
50754
  }, btnContentOverride ? btnContentOverride : /*#__PURE__*/React.createElement(Center, {
50757
50755
  as: "span",
@@ -50936,19 +50934,6 @@ var selectOption = function selectOption(option, selectedOptions, setSelectedOpt
50936
50934
  setSelectedOptions(moreOptions);
50937
50935
  }
50938
50936
  };
50939
- var mergeOptions = function mergeOptions(selectedOptions, activeOptions) {
50940
- if (!activeOptions.length) return selectedOptions;
50941
- if (!selectedOptions.length) return activeOptions;
50942
- var mergedOptions = _toConsumableArray(selectedOptions);
50943
- activeOptions.forEach(function (activeOption) {
50944
- if (!mergedOptions.some(function (option) {
50945
- return option.name === activeOption.name;
50946
- })) {
50947
- mergedOptions.push(activeOption);
50948
- }
50949
- });
50950
- return mergedOptions;
50951
- };
50952
50937
 
50953
50938
  var useKeyboardNavigation = function useKeyboardNavigation(_ref) {
50954
50939
  var options = _ref.options,
@@ -51149,75 +51134,41 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
51149
51134
  searchable = _ref$searchable === void 0 ? true : _ref$searchable,
51150
51135
  themeValues = _ref.themeValues,
51151
51136
  _ref$truncateBtnTextW = _ref.truncateBtnTextWidth,
51152
- truncateBtnTextWidth = _ref$truncateBtnTextW === void 0 ? "15rem" : _ref$truncateBtnTextW,
51153
- activeAppliedOptions = _ref.activeAppliedOptions;
51154
- // State to manage whether the dropdown is open or closed
51137
+ truncateBtnTextWidth = _ref$truncateBtnTextW === void 0 ? "15rem" : _ref$truncateBtnTextW;
51155
51138
  var _useState = useState(false),
51156
51139
  _useState2 = _slicedToArray(_useState, 2),
51157
51140
  opened = _useState2[0],
51158
51141
  setOpened = _useState2[1];
51159
-
51160
- // State to manage the currently selected options
51161
51142
  var _useState3 = useState([]),
51162
51143
  _useState4 = _slicedToArray(_useState3, 2),
51163
51144
  selectedOptions = _useState4[0],
51164
51145
  setSelectedOptions = _useState4[1];
51165
-
51166
- // State to manage the applied options, initialized with activeAppliedOptions or an empty array
51167
- var _useState5 = useState(activeAppliedOptions || []),
51146
+ var _useState5 = useState([]),
51168
51147
  _useState6 = _slicedToArray(_useState5, 2),
51169
51148
  appliedOptions = _useState6[0],
51170
51149
  setAppliedOptions = _useState6[1];
51171
-
51172
- // State to track whether the user has interacted with the component
51173
- var _useState7 = useState(false),
51174
- _useState8 = _slicedToArray(_useState7, 2),
51175
- hasInteracted = _useState8[0],
51176
- setHasInteracted = _useState8[1];
51177
-
51178
- // Reference to keep track of the opened state across renders without causing re-renders
51179
51150
  var openedRef = useRef(opened);
51180
-
51181
- // Hook to detect clicks outside the component and close the dropdown
51151
+ var handleOnClose = function handleOnClose() {
51152
+ if (openedRef.current) {
51153
+ setOpened(false);
51154
+ actions.fields.searchTerm.set("");
51155
+ }
51156
+ };
51182
51157
  var containerRef = useOutsideClickHook(function () {
51183
51158
  return handleOnClose();
51184
51159
  });
51185
-
51186
- // References to various elements within the component
51187
51160
  var dropdownRef = useRef(null);
51188
51161
  var filterButtonRef = useRef(null);
51189
51162
  var applyFilterButtonRef = useRef(null);
51190
-
51191
- // IDs for accessibility and identification purposes
51192
51163
  var filterDropdownID = "".concat(name, "-filter-dropdown");
51193
51164
  var listGroupID = "".concat(name, "-list-group");
51194
- var handleOnClose = function handleOnClose() {
51195
- if (openedRef.current) {
51196
- setOpened(false);
51197
- actions.fields.searchTerm.set("");
51198
- }
51199
- };
51200
51165
  useEffect$1(function () {
51201
51166
  openedRef.current = opened;
51202
51167
  if (!opened) {
51203
- if (hasInteracted) {
51204
- onApply(selectedOptions);
51205
- setAppliedOptions(selectedOptions);
51206
- }
51207
- } else {
51208
- setHasInteracted(true);
51168
+ onApply(selectedOptions);
51169
+ setAppliedOptions(selectedOptions);
51209
51170
  }
51210
51171
  }, [opened]);
51211
- useEffect$1(function () {
51212
- // Update the applied options state with the current active applied options,
51213
- // or an empty array if activeAppliedOptions is undefined or null.
51214
- // This ensures that the current applied options are in sync with the parent component.
51215
- setAppliedOptions(activeAppliedOptions || []);
51216
-
51217
- // Merge the selected options with the active applied options.
51218
- var mergedSelections = mergeOptions(selectedOptions, activeAppliedOptions);
51219
- setSelectedOptions(mergedSelections);
51220
- }, [activeAppliedOptions]);
51221
51172
  useEffect$1(function () {
51222
51173
  var handleKeyDown = function handleKeyDown(event) {
51223
51174
  if (event.key === "Escape") {
@@ -51259,8 +51210,7 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
51259
51210
  truncateBtnTextWidth: truncateBtnTextWidth,
51260
51211
  filterLabel: filterLabel,
51261
51212
  selectedOptions: selectedOptions,
51262
- extraStyles: btnExtraStyles,
51263
- dataAppliedOptions: appliedOptions === null || appliedOptions === void 0 ? void 0 : appliedOptions.length
51213
+ extraStyles: btnExtraStyles
51264
51214
  }), /*#__PURE__*/React.createElement(FilterDropdown, {
51265
51215
  id: filterDropdownID,
51266
51216
  ref: dropdownRef,