@thecb/components 10.12.0 → 10.12.1-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 CHANGED
@@ -6249,7 +6249,7 @@ return numeral;
6249
6249
  }));
6250
6250
  });
6251
6251
 
6252
- var noop = function noop() {};
6252
+ var noop$1 = function noop() {};
6253
6253
  var formatMoneyString = function formatMoneyString(s) {
6254
6254
  return numeral(s).format("$0,0.00");
6255
6255
  };
@@ -6383,7 +6383,7 @@ var wrapIndex = function wrapIndex(index, length) {
6383
6383
 
6384
6384
  var general = /*#__PURE__*/Object.freeze({
6385
6385
  __proto__: null,
6386
- noop: noop,
6386
+ noop: noop$1,
6387
6387
  displayCurrency: displayCurrency,
6388
6388
  convertCentsToMoneyInt: convertCentsToMoneyInt,
6389
6389
  formatPercent: formatPercent,
@@ -10575,7 +10575,7 @@ var isRefObject = function (ref) {
10575
10575
  return typeof ref === "object" && ref.hasOwnProperty("current");
10576
10576
  };
10577
10577
 
10578
- var noop$1 = function (v) { return v; };
10578
+ var noop$2 = function (v) { return v; };
10579
10579
  var ComponentDragControls = /** @class */ (function () {
10580
10580
  function ComponentDragControls(_a) {
10581
10581
  var ref = _a.ref, values = _a.values, controls = _a.controls;
@@ -10603,7 +10603,7 @@ var ComponentDragControls = /** @class */ (function () {
10603
10603
  * @internal
10604
10604
  */
10605
10605
  this.props = {
10606
- transformPagePoint: noop$1,
10606
+ transformPagePoint: noop$2,
10607
10607
  };
10608
10608
  /**
10609
10609
  * References to the MotionValues used for tracking the current dragged point.
@@ -13033,7 +13033,7 @@ var Spinner = function Spinner(_ref) {
13033
13033
 
13034
13034
  var ButtonWithAction = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13035
13035
  var _ref2$action = _ref2.action,
13036
- action = _ref2$action === void 0 ? noop : _ref2$action,
13036
+ action = _ref2$action === void 0 ? noop$1 : _ref2$action,
13037
13037
  _ref2$variant = _ref2.variant,
13038
13038
  variant = _ref2$variant === void 0 ? "primary" : _ref2$variant,
13039
13039
  text = _ref2.text,
@@ -13075,7 +13075,7 @@ var ButtonWithAction = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13075
13075
  disabledStyles: disabledStyles,
13076
13076
  "aria-disabled": disabled,
13077
13077
  as: "button",
13078
- onClick: isLoading || disabled ? noop : action,
13078
+ onClick: isLoading || disabled ? noop$1 : action,
13079
13079
  borderRadius: "2px",
13080
13080
  theme: themeContext,
13081
13081
  extraStyles: "margin: 0.5rem; ".concat(extraStyles),
@@ -23248,7 +23248,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
23248
23248
  name = _ref5.name,
23249
23249
  checked = _ref5.checked,
23250
23250
  _ref5$onChange = _ref5.onChange,
23251
- onChange = _ref5$onChange === void 0 ? noop : _ref5$onChange,
23251
+ onChange = _ref5$onChange === void 0 ? noop$1 : _ref5$onChange,
23252
23252
  _ref5$disabled = _ref5.disabled,
23253
23253
  disabled = _ref5$disabled === void 0 ? false : _ref5$disabled,
23254
23254
  themeValues = _ref5.themeValues,
@@ -23447,7 +23447,7 @@ var CheckboxListItem = function CheckboxListItem(_ref) {
23447
23447
  padding: "0.875rem",
23448
23448
  borderRadius: "4px",
23449
23449
  minWidth: "30%",
23450
- onClick: disabled ? noop : onSelect,
23450
+ onClick: disabled ? noop$1 : onSelect,
23451
23451
  borderColor: borderColor,
23452
23452
  borderSize: "1px",
23453
23453
  color: color,
@@ -23462,8 +23462,8 @@ var CheckboxListItem = function CheckboxListItem(_ref) {
23462
23462
  name: name,
23463
23463
  "aria-label": name,
23464
23464
  htmlFor: "checkbox-".concat(name, "-").concat(index),
23465
- onClick: disabled ? noop : onSelect,
23466
- onKeyDown: disabled ? noop : onSelect,
23465
+ onClick: disabled ? noop$1 : onSelect,
23466
+ onKeyDown: disabled ? noop$1 : onSelect,
23467
23467
  tabIndex: 0
23468
23468
  }, /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
23469
23469
  theme: {
@@ -23691,7 +23691,7 @@ var SortableTableHeading = function SortableTableHeading(_ref) {
23691
23691
  disabled: disabled,
23692
23692
  extraStyles: "cursor: pointer; ".concat(extraStyles),
23693
23693
  onClick: function onClick(event) {
23694
- return disabled ? noop : onSortChange(event);
23694
+ return disabled ? noop$1 : onSortChange(event);
23695
23695
  },
23696
23696
  "aria-controls": ariaControlsId
23697
23697
  }, /*#__PURE__*/React__default.createElement(Cluster, {
@@ -25121,7 +25121,7 @@ var Dropdown = function Dropdown(_ref13) {
25121
25121
  _ref13$disabledValues = _ref13.disabledValues,
25122
25122
  disabledValues = _ref13$disabledValues === void 0 ? [] : _ref13$disabledValues,
25123
25123
  _ref13$onClick = _ref13.onClick,
25124
- _onClick = _ref13$onClick === void 0 ? noop : _ref13$onClick,
25124
+ _onClick = _ref13$onClick === void 0 ? noop$1 : _ref13$onClick,
25125
25125
  themeValues = _ref13.themeValues,
25126
25126
  maxHeight = _ref13.maxHeight,
25127
25127
  _ref13$widthFitOption = _ref13.widthFitOptions,
@@ -26766,7 +26766,7 @@ var Popover = function Popover(_ref) {
26766
26766
  extraStyles: "position: relative; ".concat(extraStyles)
26767
26767
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
26768
26768
  action: function action() {
26769
- return noop;
26769
+ return noop$1;
26770
26770
  },
26771
26771
  onFocus: function onFocus() {
26772
26772
  handleTogglePopover(true);
@@ -27096,83 +27096,79 @@ var createFormat = function createFormat(formats, formatChar) {
27096
27096
  var FormattedInput = function FormattedInput(_ref) {
27097
27097
  var value = _ref.value,
27098
27098
  formatter = _ref.formatter,
27099
- onChange = _ref.onChange,
27099
+ _onChange = _ref.onChange,
27100
27100
  props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
27101
27101
 
27102
- var _useState = React.useState(format$1(formatter)(value)),
27103
- _useState2 = _slicedToArray$1(_useState, 2),
27104
- formattedValue = _useState2[0],
27105
- setFormattedValue = _useState2[1];
27106
-
27107
27102
  var inputEl = React.useRef(null);
27108
- var stateRefs = React.useRef({
27103
+
27104
+ var _useState = React.useState({
27109
27105
  selectionStart: 0,
27110
27106
  selectionEnd: 0,
27111
- isDelete: false,
27112
- rawValue: ''
27113
- });
27107
+ rawValue: value,
27108
+ "delete": false,
27109
+ formattedValue: format$1(formatter)(value)
27110
+ }),
27111
+ _useState2 = _slicedToArray$1(_useState, 2),
27112
+ state = _useState2[0],
27113
+ setState = _useState2[1];
27114
+
27114
27115
  React.useLayoutEffect(function () {
27115
27116
  // A lot of the work here is cursor manipulation
27116
27117
  if (inputEl.current && inputEl.current === document.activeElement) {
27117
- inputEl.current.setSelectionRange(stateRefs.current.selectionStart, stateRefs.current.selectionEnd);
27118
+ inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
27118
27119
  }
27119
- }, [stateRefs]);
27120
-
27121
- var handleChange = function handleChange(event) {
27122
- var deleteKeyPressed = stateRefs.current.isDelete;
27123
- var maxFormatExceeded = stateRefs.current.rawValue.length >= formatter.formats.length - 1;
27124
-
27125
- if (maxFormatExceeded && !deleteKeyPressed) {
27126
- return;
27127
- }
27128
- /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
27129
- * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
27130
- * the unformatted value for the user's onChange, the formatted string and unformatted injection need
27131
- * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
27132
- * old unformatted value.
27133
- */
27134
-
27135
-
27136
- var injectionLength = event.target.value.length - formattedValue.length;
27137
- var end = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? stateRefs.current.selectionStart + injectionLength : stateRefs.current.selectionEnd - 1;
27138
- var injection = event.target.value.substring(stateRefs.current.selectionStart, end); // Injection is the new unformatted piece of the input
27139
- // Need to find where to put it
27140
-
27141
- var rawInjectionPointStart = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter);
27142
- var rawInjectionPointEnd = formattedToUnformattedIndex(stateRefs.current.selectionEnd, stateRefs.current.rawValue, formatter); // Unformat the previous formatted value for injection
27143
- // Using the relevant format string, strips away chars not marked with the formatChar
27144
-
27145
- var unformattedOldValue = unformat(formatter)(formattedValue, stateRefs.current.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
27146
-
27147
- var injectIntoOldValue = inject(unformattedOldValue);
27148
- var unformattedNewValue = deleteKeyPressed ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
27149
- var lengthDifference = unformattedNewValue.length - stateRefs.current.rawValue.length;
27150
- var rawIndex = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
27151
- // Applied by useLayoutEffect
27152
-
27153
- var newFormattedCursorPosition = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, deleteKeyPressed) : deleteKeyPressed ? stateRefs.current.selectionStart : stateRefs.current.selectionEnd;
27154
- var formattedNewValue = format$1(formatter)(unformattedNewValue);
27155
- setFormattedValue(formattedNewValue); // Apply the external onChange function to the raw underlying string
27156
- // This is where the user generally updates the input value
27157
-
27158
- if (onChange) {
27159
- onChange(unformattedNewValue);
27160
- }
27161
- };
27162
-
27120
+ });
27163
27121
  return React__default.createElement("input", _extends$2({}, props, {
27164
27122
  ref: inputEl,
27165
27123
  value: format$1(formatter)(value),
27166
27124
  onKeyDown: function onKeyDown(event) {
27167
- // Keep track of the state of the input before onChange
27168
- stateRefs.current = {
27169
- isDelete: event.key === "Backspace" || event.key === "Delete",
27125
+ // Keep track of the state of the input before onChange, including if user is hitting delete
27126
+ setState({
27127
+ rawValue: value,
27170
27128
  selectionStart: event.target.selectionStart,
27171
27129
  selectionEnd: event.target.selectionEnd,
27172
- rawValue: value
27173
- };
27130
+ "delete": event.key === "Backspace" || event.key === "Delete",
27131
+ formattedValue: event.target.value
27132
+ });
27174
27133
  },
27175
- onChange: handleChange
27134
+ onChange: function onChange(event) {
27135
+ /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
27136
+ * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
27137
+ * the unformatted value for the user's onChange, the formatted string and unformatted injection need
27138
+ * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
27139
+ * old unformatted value.
27140
+ */
27141
+ var injectionLength = event.target.value.length - state.formattedValue.length;
27142
+ var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
27143
+ var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
27144
+ // Need to find where to put it
27145
+
27146
+ var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
27147
+ var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
27148
+ // Using the relevant format string, strips away chars not marked with the formatChar
27149
+
27150
+ var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
27151
+
27152
+ var injectIntoOldValue = inject(unformattedOldValue);
27153
+ var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
27154
+ var lengthDifference = unformattedNewValue.length - state.rawValue.length;
27155
+ var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
27156
+ // Applied by useLayoutEffect
27157
+
27158
+ var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
27159
+ setState({
27160
+ selectionStart: newFormattedCursorPosition,
27161
+ selectionEnd: newFormattedCursorPosition,
27162
+ rawValue: state.rawValue,
27163
+ "delete": false,
27164
+ formattedValue: state.formattedValue
27165
+ }); // Apply the external onChange function to the raw underlying string
27166
+ // This is where the user generally updates the input value
27167
+
27168
+ if (_onChange) {
27169
+ _onChange(unformattedNewValue);
27170
+ }
27171
+ }
27176
27172
  }));
27177
27173
  };
27178
27174
 
@@ -27769,7 +27765,7 @@ var HamburgerButton = function HamburgerButton(_ref4) {
27769
27765
  inactiveColor = _ref4.inactiveColor,
27770
27766
  isActive = _ref4.isActive,
27771
27767
  _ref4$onClick = _ref4.onClick,
27772
- onClick = _ref4$onClick === void 0 ? noop : _ref4$onClick,
27768
+ onClick = _ref4$onClick === void 0 ? noop$1 : _ref4$onClick,
27773
27769
  controls = _ref4.controls;
27774
27770
  return /*#__PURE__*/React__default.createElement(Hamburger, {
27775
27771
  className: isActive === true ? "active" : "",
@@ -28660,7 +28656,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
28660
28656
  themeValues = _ref5.themeValues,
28661
28657
  index = _ref5.index,
28662
28658
  _ref5$handleChange = _ref5.handleChange,
28663
- handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange,
28659
+ handleChange = _ref5$handleChange === void 0 ? noop$1 : _ref5$handleChange,
28664
28660
  field = _ref5.field,
28665
28661
  config = _ref5.config;
28666
28662
  var getDefaultChecked = function getDefaultChecked(value, idx) {
@@ -28877,7 +28873,7 @@ var Search = function Search(_ref) {
28877
28873
  "aria-controls": ariaControlsId,
28878
28874
  extraStyles: "border-radius: 4px 0 0 4px; border: none; box-shadow: 0px 1px 2px 0px ".concat(CHARADE_GREY, "1A; font-size: 0.875rem;"),
28879
28875
  onKeyDown: function onKeyDown(e) {
28880
- return searchOnKeypress || e.key === "Enter" ? handleSubmit() : noop;
28876
+ return searchOnKeypress || e.key === "Enter" ? handleSubmit() : noop$1;
28881
28877
  },
28882
28878
  field: field,
28883
28879
  fieldActions: fieldActions,
@@ -39665,7 +39661,7 @@ var ToggleSwitch = function ToggleSwitch(_ref10) {
39665
39661
  _ref10$isOn = _ref10.isOn,
39666
39662
  isOn = _ref10$isOn === void 0 ? false : _ref10$isOn,
39667
39663
  _ref10$onToggle = _ref10.onToggle,
39668
- onToggle = _ref10$onToggle === void 0 ? noop : _ref10$onToggle,
39664
+ onToggle = _ref10$onToggle === void 0 ? noop$1 : _ref10$onToggle,
39669
39665
  _ref10$disabled = _ref10.disabled,
39670
39666
  disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
39671
39667
  _ref10$name = _ref10.name,
@@ -39765,13 +39761,13 @@ var ToggleSwitch = function ToggleSwitch(_ref10) {
39765
39761
  "aria-labelledby": label ? "".concat(nameId, "-label") : null,
39766
39762
  "aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
39767
39763
  checked: isOn,
39768
- onChange: disabled ? noop : onToggle,
39764
+ onChange: disabled ? noop$1 : onToggle,
39769
39765
  disabled: disabled,
39770
39766
  id: "#".concat(nameId),
39771
39767
  isMobile: isMobile
39772
39768
  }), /*#__PURE__*/React__default.createElement(VisibleSwitch, {
39773
- onClick: disabled ? noop : onToggle,
39774
- onKeyDown: disabled ? noop : handleKeyDown,
39769
+ onClick: disabled ? noop$1 : onToggle,
39770
+ onKeyDown: disabled ? noop$1 : handleKeyDown,
39775
39771
  pose: isOn ? "on" : "off",
39776
39772
  tabIndex: disabled ? -1 : 0,
39777
39773
  disabled: disabled,
@@ -39865,40 +39861,20 @@ var fallbackValues$E = {
39865
39861
  };
39866
39862
 
39867
39863
  var CardText = function CardText(_ref) {
39868
- var showQuitLink = _ref.showQuitLink,
39869
- onQuitClick = _ref.onQuitClick,
39870
- titleAs = _ref.titleAs,
39871
- padding = _ref.padding,
39864
+ var padding = _ref.padding,
39872
39865
  text = _ref.text,
39873
- _ref$textAs = _ref.textAs,
39874
- textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
39875
39866
  titleText = _ref.titleText,
39876
39867
  _ref$titleVariant = _ref.titleVariant,
39877
39868
  titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
39878
39869
  themeValues = _ref.themeValues;
39879
39870
  return /*#__PURE__*/React__default.createElement(Box, {
39880
39871
  padding: padding
39881
- }, /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Cluster, {
39882
- justify: "space-between",
39883
- align: "center",
39884
- overflow: true
39885
- }, titleText && /*#__PURE__*/React__default.createElement(Title$1, {
39886
- as: titleAs,
39872
+ }, /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Stack, null, titleText && /*#__PURE__*/React__default.createElement(Title$1, {
39873
+ as: "p",
39887
39874
  variant: titleVariant,
39888
39875
  color: themeValues.titleColor,
39889
39876
  weight: themeValues.titleWeight
39890
- }, titleText), showQuitLink && /*#__PURE__*/React__default.createElement(Box, {
39891
- padding: "0",
39892
- onClick: onQuitClick,
39893
- onKeyDown: function onKeyDown(e) {
39894
- return e.key === "Enter" && onQuitClick();
39895
- },
39896
- role: "button",
39897
- tabIndex: 0,
39898
- "aria-label": "Close Card: ".concat(titleText),
39899
- extraStyles: "cursor: pointer;"
39900
- }, /*#__PURE__*/React__default.createElement(IconQuitLarge, null))), /*#__PURE__*/React__default.createElement(Paragraph$1, {
39901
- as: textAs,
39877
+ }, titleText), /*#__PURE__*/React__default.createElement(Paragraph$1, {
39902
39878
  color: themeValues.textColor
39903
39879
  }, text))));
39904
39880
  };
@@ -39939,17 +39915,9 @@ var Card = function Card(_ref) {
39939
39915
  _ref$imgObjectFit = _ref.imgObjectFit,
39940
39916
  imgObjectFit = _ref$imgObjectFit === void 0 ? "none" : _ref$imgObjectFit,
39941
39917
  imgAltText = _ref.imgAltText,
39942
- _ref$onQuitClick = _ref.onQuitClick,
39943
- onQuitClick = _ref$onQuitClick === void 0 ? noop : _ref$onQuitClick,
39944
39918
  _ref$padding = _ref.padding,
39945
39919
  padding = _ref$padding === void 0 ? "24px" : _ref$padding,
39946
- _ref$showQuitLink = _ref.showQuitLink,
39947
- showQuitLink = _ref$showQuitLink === void 0 ? false : _ref$showQuitLink,
39948
39920
  text = _ref.text,
39949
- _ref$textAs = _ref.textAs,
39950
- textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
39951
- _ref$titleAs = _ref.titleAs,
39952
- titleAs = _ref$titleAs === void 0 ? "h2" : _ref$titleAs,
39953
39921
  titleText = _ref.titleText,
39954
39922
  _ref$titleVariant = _ref.titleVariant,
39955
39923
  titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
@@ -40006,13 +39974,9 @@ var Card = function Card(_ref) {
40006
39974
  width: "100%",
40007
39975
  extraStyles: "flex-basis: 100%;"
40008
39976
  }, text && /*#__PURE__*/React__default.createElement(CardText$1, {
40009
- onQuitClick: onQuitClick,
40010
39977
  padding: padding,
40011
- showQuitLink: showQuitLink,
40012
- titleAs: titleAs,
40013
39978
  titleText: titleText,
40014
39979
  text: text,
40015
- textAs: textAs,
40016
39980
  titleVariant: titleVariant
40017
39981
  }), children)))));
40018
39982
  };
@@ -40973,7 +40937,7 @@ var AddressForm = function AddressForm(_ref) {
40973
40937
  clearOnDismount = _ref.clearOnDismount,
40974
40938
  showErrors = _ref.showErrors,
40975
40939
  _ref$handleSubmit = _ref.handleSubmit,
40976
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
40940
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
40977
40941
  showWalletCheckbox = _ref.showWalletCheckbox,
40978
40942
  saveToWallet = _ref.saveToWallet,
40979
40943
  walletCheckboxMarked = _ref.walletCheckboxMarked,
@@ -41173,7 +41137,7 @@ var ChangePasswordForm = function ChangePasswordForm(_ref) {
41173
41137
  fields = _ref.fields,
41174
41138
  actions = _ref.actions,
41175
41139
  _ref$handleSubmit = _ref.handleSubmit,
41176
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
41140
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
41177
41141
  showErrors = _ref.showErrors,
41178
41142
  isMobile = _ref.isMobile,
41179
41143
  revenueManagement = _ref.revenueManagement,
@@ -41384,8 +41348,8 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
41384
41348
  }, /*#__PURE__*/React__default.createElement(Box, {
41385
41349
  padding: customPadding ? customPadding : "0",
41386
41350
  background: themeValues.headingBackgroundColor,
41387
- onClick: isMobile && supportsTouch ? noop : toggleSection,
41388
- onTouchEnd: isMobile && supportsTouch ? toggleSection : noop,
41351
+ onClick: isMobile && supportsTouch ? noop$1 : toggleSection,
41352
+ onTouchEnd: isMobile && supportsTouch ? toggleSection : noop$1,
41389
41353
  key: "header",
41390
41354
  hoverStyles: "cursor: pointer;",
41391
41355
  tabIndex: "0",
@@ -41603,7 +41567,7 @@ var EditNameForm = function EditNameForm(_ref) {
41603
41567
  clearOnDismount = _ref.clearOnDismount,
41604
41568
  showErrors = _ref.showErrors,
41605
41569
  _ref$handleSubmit = _ref.handleSubmit,
41606
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit;
41570
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit;
41607
41571
  if (clearOnDismount) {
41608
41572
  React.useEffect(function () {
41609
41573
  return function () {
@@ -41946,7 +41910,7 @@ var EmailForm = function EmailForm(_ref) {
41946
41910
  showErrors = _ref.showErrors,
41947
41911
  guestCheckout = _ref.guestCheckout,
41948
41912
  _ref$handleSubmit = _ref.handleSubmit,
41949
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
41913
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
41950
41914
  showWalletCheckbox = _ref.showWalletCheckbox,
41951
41915
  saveToWallet = _ref.saveToWallet,
41952
41916
  walletCheckboxMarked = _ref.walletCheckboxMarked,
@@ -42044,7 +42008,7 @@ var ForgotPasswordForm = function ForgotPasswordForm(_ref) {
42044
42008
  clearOnDismount = _ref.clearOnDismount,
42045
42009
  showErrors = _ref.showErrors,
42046
42010
  _ref$handleSubmit = _ref.handleSubmit,
42047
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit;
42011
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit;
42048
42012
  if (clearOnDismount) {
42049
42013
  React.useEffect(function () {
42050
42014
  return function () {
@@ -42638,7 +42602,7 @@ var LinkCard = function LinkCard(_ref) {
42638
42602
  extraStyles: extraStyles,
42639
42603
  hoverStyles: extraHoverStyles,
42640
42604
  activeStyles: extraActiveStyles,
42641
- onClick: disabled ? noop : onClick,
42605
+ onClick: disabled ? noop$1 : onClick,
42642
42606
  "aria-disabled": disabled,
42643
42607
  isDisabled: disabled,
42644
42608
  role: "group",
@@ -42687,7 +42651,7 @@ var LoginForm = function LoginForm(_ref) {
42687
42651
  actions = _ref.actions,
42688
42652
  showErrors = _ref.showErrors,
42689
42653
  _ref$handleSubmit = _ref.handleSubmit,
42690
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit;
42654
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit;
42691
42655
  if (clearOnDismount) {
42692
42656
  React.useEffect(function () {
42693
42657
  return function () {
@@ -46357,13 +46321,13 @@ var CancelButton = function CancelButton(_ref) {
46357
46321
  var _ref$buttonExtraStyle = _ref.buttonExtraStyles,
46358
46322
  buttonExtraStyles = _ref$buttonExtraStyle === void 0 ? "" : _ref$buttonExtraStyle,
46359
46323
  _ref$cancelAction = _ref.cancelAction,
46360
- cancelAction = _ref$cancelAction === void 0 ? noop : _ref$cancelAction,
46324
+ cancelAction = _ref$cancelAction === void 0 ? noop$1 : _ref$cancelAction,
46361
46325
  _ref$cancelButtonText = _ref.cancelButtonText,
46362
46326
  cancelButtonText = _ref$cancelButtonText === void 0 ? "" : _ref$cancelButtonText,
46363
46327
  _ref$cancelButtonVari = _ref.cancelButtonVariant,
46364
46328
  cancelButtonVariant = _ref$cancelButtonVari === void 0 ? "secondary" : _ref$cancelButtonVari,
46365
46329
  _ref$hideModal = _ref.hideModal,
46366
- hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
46330
+ hideModal = _ref$hideModal === void 0 ? noop$1 : _ref$hideModal,
46367
46331
  _ref$isMobile = _ref.isMobile,
46368
46332
  isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
46369
46333
  var fontSize = "font-size: ".concat(isMobile ? FONT_SIZE.XS : FONT_SIZE.SM, ";");
@@ -46390,7 +46354,7 @@ var CloseButton = function CloseButton(_ref) {
46390
46354
  _ref$closeButtonVaria = _ref.closeButtonVariant,
46391
46355
  closeButtonVariant = _ref$closeButtonVaria === void 0 ? "primary" : _ref$closeButtonVaria,
46392
46356
  _ref$hideModal = _ref.hideModal,
46393
- hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
46357
+ hideModal = _ref$hideModal === void 0 ? noop$1 : _ref$hideModal,
46394
46358
  _ref$isMobile = _ref.isMobile,
46395
46359
  isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
46396
46360
  var fontSize = "font-size: ".concat(isMobile ? FONT_SIZE.XS : FONT_SIZE.SM, ";");
@@ -46412,7 +46376,7 @@ var CloseButton = function CloseButton(_ref) {
46412
46376
  var CloseIconButton = function CloseIconButton(_ref) {
46413
46377
  var _ref$buttonExtraStyle = _ref.buttonExtraStyles,
46414
46378
  _ref$hideModal = _ref.hideModal,
46415
- hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
46379
+ hideModal = _ref$hideModal === void 0 ? noop$1 : _ref$hideModal,
46416
46380
  _ref$iconWidth = _ref.iconWidth,
46417
46381
  iconWidth = _ref$iconWidth === void 0 ? "24px" : _ref$iconWidth,
46418
46382
  _ref$iconHeight = _ref.iconHeight,
@@ -46437,7 +46401,7 @@ var ContinueButton = function ContinueButton(_ref) {
46437
46401
  var _ref$buttonExtraStyle = _ref.buttonExtraStyles,
46438
46402
  buttonExtraStyles = _ref$buttonExtraStyle === void 0 ? "" : _ref$buttonExtraStyle,
46439
46403
  _ref$continueAction = _ref.continueAction,
46440
- continueAction = _ref$continueAction === void 0 ? noop : _ref$continueAction,
46404
+ continueAction = _ref$continueAction === void 0 ? noop$1 : _ref$continueAction,
46441
46405
  _ref$continueButtonTe = _ref.continueButtonText,
46442
46406
  continueButtonText = _ref$continueButtonTe === void 0 ? "" : _ref$continueButtonTe,
46443
46407
  _ref$continueURL = _ref.continueURL,
@@ -46492,7 +46456,7 @@ var Modal$2 = function Modal(_ref) {
46492
46456
  _ref$buttonExtraStyle = _ref.buttonExtraStyles,
46493
46457
  buttonExtraStyles = _ref$buttonExtraStyle === void 0 ? "" : _ref$buttonExtraStyle,
46494
46458
  _ref$cancelAction = _ref.cancelAction,
46495
- cancelAction = _ref$cancelAction === void 0 ? noop : _ref$cancelAction,
46459
+ cancelAction = _ref$cancelAction === void 0 ? noop$1 : _ref$cancelAction,
46496
46460
  _ref$cancelButtonText = _ref.cancelButtonText,
46497
46461
  cancelButtonText = _ref$cancelButtonText === void 0 ? "Cancel" : _ref$cancelButtonText,
46498
46462
  _ref$cancelButtonVari = _ref.cancelButtonVariant,
@@ -46504,7 +46468,7 @@ var Modal$2 = function Modal(_ref) {
46504
46468
  _ref$closeButtonVaria = _ref.closeButtonVariant,
46505
46469
  closeButtonVariant = _ref$closeButtonVaria === void 0 ? "primary" : _ref$closeButtonVaria,
46506
46470
  _ref$continueAction = _ref.continueAction,
46507
- continueAction = _ref$continueAction === void 0 ? noop : _ref$continueAction,
46471
+ continueAction = _ref$continueAction === void 0 ? noop$1 : _ref$continueAction,
46508
46472
  _ref$continueButtonTe = _ref.continueButtonText,
46509
46473
  continueButtonText = _ref$continueButtonTe === void 0 ? "Continue" : _ref$continueButtonTe,
46510
46474
  _ref$continueButtonVa = _ref.continueButtonVariant,
@@ -46518,7 +46482,7 @@ var Modal$2 = function Modal(_ref) {
46518
46482
  _ref$defaultWrapper = _ref.defaultWrapper,
46519
46483
  defaultWrapper = _ref$defaultWrapper === void 0 ? true : _ref$defaultWrapper,
46520
46484
  _ref$hideModal = _ref.hideModal,
46521
- hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
46485
+ hideModal = _ref$hideModal === void 0 ? noop$1 : _ref$hideModal,
46522
46486
  _ref$initialFocusSele = _ref.initialFocusSelector,
46523
46487
  initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
46524
46488
  _ref$isContinueAction = _ref.isContinueActionDisabled,
@@ -46999,13 +46963,13 @@ var AmountModule = function AmountModule(_ref) {
46999
46963
  subDescription: subDescription,
47000
46964
  allowedPaymentInstruments: allowedPaymentInstruments,
47001
46965
  disableActions: disableActions,
47002
- action: disableActions ? noop : function () {
46966
+ action: disableActions ? noop$1 : function () {
47003
46967
  return toggleModal(true);
47004
46968
  },
47005
- onClick: disableActions ? noop : function () {
46969
+ onClick: disableActions ? noop$1 : function () {
47006
46970
  toggleModal(true);
47007
46971
  },
47008
- onKeyPress: disableActions ? noop : function (e) {
46972
+ onKeyPress: disableActions ? noop$1 : function (e) {
47009
46973
  e.key === "Enter" && toggleModal(true);
47010
46974
  }
47011
46975
  })));
@@ -47135,7 +47099,7 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
47135
47099
  padding: "0"
47136
47100
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
47137
47101
  isLoading: isLoading,
47138
- action: disableActions ? noop : function () {
47102
+ action: disableActions ? noop$1 : function () {
47139
47103
  return handleClick(obligations);
47140
47104
  },
47141
47105
  text: "Pay Now",
@@ -47147,7 +47111,7 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
47147
47111
  width: "100%"
47148
47112
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
47149
47113
  isLoading: isLoading,
47150
- action: disableActions ? noop : function () {
47114
+ action: disableActions ? noop$1 : function () {
47151
47115
  return handleClick(obligations);
47152
47116
  },
47153
47117
  text: "Pay Now",
@@ -47202,7 +47166,7 @@ var RemoveAccountModalModule = function RemoveAccountModalModule(_ref) {
47202
47166
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
47203
47167
  text: "Remove",
47204
47168
  variant: "secondary",
47205
- action: disableActions ? noop : function () {
47169
+ action: disableActions ? noop$1 : function () {
47206
47170
  return setModalIsOpen(true);
47207
47171
  },
47208
47172
  dataQa: "Remove Account",
@@ -47274,7 +47238,7 @@ var InactiveControlsModule = function InactiveControlsModule(_ref) {
47274
47238
  extraStyles: "flex-grow: 1;"
47275
47239
  }, /*#__PURE__*/React__default.createElement(RemoveAccountModalModule, {
47276
47240
  agencyName: agencyName,
47277
- removeAccount: disableActions ? noop : handleRemoveAccount,
47241
+ removeAccount: disableActions ? noop$1 : handleRemoveAccount,
47278
47242
  accountType: configType === "ACCOUNT" ? "Account" : "Property",
47279
47243
  isMobile: isMobile,
47280
47244
  disableActions: disableActions
@@ -47835,7 +47799,7 @@ var Pagination = function Pagination(_ref3) {
47835
47799
  return setCurrentPage({
47836
47800
  pageNumber: item.index
47837
47801
  });
47838
- } : noop,
47802
+ } : noop$1,
47839
47803
  textExtraStyles: "font-size: ".concat(fontSize, "; font-weight: ").concat(fontWeight, ";"),
47840
47804
  extraStyles: "".concat(extraStyles).concat(item.active ? currentPageStyles : ""),
47841
47805
  dataQa: index
@@ -48198,7 +48162,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
48198
48162
  _ref4$voidableTransac = _ref4.voidableTransactionDetails,
48199
48163
  voidableTransactionDetails = _ref4$voidableTransac === void 0 ? [] : _ref4$voidableTransac,
48200
48164
  _ref4$partialVoidActi = _ref4.partialVoidAction,
48201
- partialVoidAction = _ref4$partialVoidActi === void 0 ? noop : _ref4$partialVoidActi,
48165
+ partialVoidAction = _ref4$partialVoidActi === void 0 ? noop$1 : _ref4$partialVoidActi,
48202
48166
  _ref4$voidableAmountP = _ref4.voidableAmountPaid,
48203
48167
  voidableAmountPaid = _ref4$voidableAmountP === void 0 ? 0 : _ref4$voidableAmountP,
48204
48168
  _ref4$remainingBalanc = _ref4.remainingBalance,
@@ -48675,7 +48639,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48675
48639
  actions = _ref.actions,
48676
48640
  showErrors = _ref.showErrors,
48677
48641
  _ref$handleSubmit = _ref.handleSubmit,
48678
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
48642
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
48679
48643
  showWalletCheckbox = _ref.showWalletCheckbox,
48680
48644
  saveToWallet = _ref.saveToWallet,
48681
48645
  walletCheckboxMarked = _ref.walletCheckboxMarked,
@@ -48877,7 +48841,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48877
48841
  actions = _ref.actions,
48878
48842
  showErrors = _ref.showErrors,
48879
48843
  _ref$handleSubmit = _ref.handleSubmit,
48880
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
48844
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
48881
48845
  showWalletCheckbox = _ref.showWalletCheckbox,
48882
48846
  saveToWallet = _ref.saveToWallet,
48883
48847
  walletCheckboxMarked = _ref.walletCheckboxMarked,
@@ -49182,7 +49146,7 @@ var PhoneForm = function PhoneForm(_ref) {
49182
49146
  clearOnDismount = _ref.clearOnDismount,
49183
49147
  showErrors = _ref.showErrors,
49184
49148
  _ref$handleSubmit = _ref.handleSubmit,
49185
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
49149
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
49186
49150
  showWalletCheckbox = _ref.showWalletCheckbox,
49187
49151
  saveToWallet = _ref.saveToWallet,
49188
49152
  walletCheckboxMarked = _ref.walletCheckboxMarked,
@@ -49266,7 +49230,7 @@ var RadioGroup = function RadioGroup(_ref2) {
49266
49230
  config = _ref2.config,
49267
49231
  extraStyles = _ref2.extraStyles,
49268
49232
  _ref2$handleChange = _ref2.handleChange,
49269
- handleChange = _ref2$handleChange === void 0 ? noop : _ref2$handleChange,
49233
+ handleChange = _ref2$handleChange === void 0 ? noop$1 : _ref2$handleChange,
49270
49234
  field = _ref2.field,
49271
49235
  fieldActions = _ref2.fieldActions;
49272
49236
  var setValue = function setValue(value) {
@@ -49331,7 +49295,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
49331
49295
  ariaLabelledBy = _ref.ariaLabelledBy,
49332
49296
  isLastGroupedItemInSection = _ref.isLastGroupedItemInSection,
49333
49297
  _ref$onKeyDown = _ref.onKeyDown,
49334
- onKeyDown = _ref$onKeyDown === void 0 ? noop : _ref$onKeyDown;
49298
+ onKeyDown = _ref$onKeyDown === void 0 ? noop$1 : _ref$onKeyDown;
49335
49299
  var wrapper = {
49336
49300
  open: {
49337
49301
  height: openHeight,
@@ -49388,12 +49352,12 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
49388
49352
  "aria-required": section.required,
49389
49353
  "aria-labelledby": ariaLabelledBy,
49390
49354
  "aria-describedby": ariaDescribedBy,
49391
- onClick: isMobile && supportsTouch || section.disabled || section.id === openSection ? noop : function () {
49355
+ onClick: isMobile && supportsTouch || section.disabled || section.id === openSection ? noop$1 : function () {
49392
49356
  return toggleOpenSection(section.id);
49393
49357
  },
49394
49358
  onTouchEnd: isMobile && supportsTouch && !section.disabled && section.id !== openSection ? function () {
49395
49359
  return toggleOpenSection(section.id);
49396
- } : noop,
49360
+ } : noop$1,
49397
49361
  id: "inner-radio-section-".concat(sectionIndex),
49398
49362
  "data-qa": section.dataQa ? section.dataQa : section.id || "inner-radio-section-".concat(sectionIndex)
49399
49363
  }, /*#__PURE__*/React__default.createElement(Stack, {
@@ -49423,7 +49387,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
49423
49387
  ariaDescribedBy: ariaDescribedBy,
49424
49388
  radioOn: openSection === section.id,
49425
49389
  radioFocused: focused === section.id,
49426
- toggleRadio: section.disabled ? noop : function () {
49390
+ toggleRadio: section.disabled ? noop$1 : function () {
49427
49391
  return toggleOpenSection(section.id);
49428
49392
  },
49429
49393
  tabIndex: "-1",
@@ -49608,7 +49572,7 @@ var RegistrationForm = function RegistrationForm(_ref) {
49608
49572
  fields = _ref.fields,
49609
49573
  actions = _ref.actions,
49610
49574
  _ref$handleSubmit = _ref.handleSubmit,
49611
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
49575
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
49612
49576
  showErrors = _ref.showErrors,
49613
49577
  isMobile = _ref.isMobile;
49614
49578
  if (clearOnDismount) {
@@ -49775,7 +49739,7 @@ var ResetConfirmationForm$1 = withWindowSize(ResetConfirmationForm);
49775
49739
 
49776
49740
  var ResetPasswordForm = function ResetPasswordForm(_ref) {
49777
49741
  var _ref$handleSubmit = _ref.handleSubmit,
49778
- handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
49742
+ handleSubmit = _ref$handleSubmit === void 0 ? noop$1 : _ref$handleSubmit,
49779
49743
  clearOnDismount = _ref.clearOnDismount,
49780
49744
  fields = _ref.fields,
49781
49745
  actions = _ref.actions,
@@ -50469,6 +50433,58 @@ var fallbackValues$_ = {
50469
50433
  secondaryColor: secondaryColor
50470
50434
  };
50471
50435
 
50436
+ var StyledFilterContainer = styled__default(Box).withConfig({
50437
+ displayName: "MultipleSelectFilterstyled__StyledFilterContainer",
50438
+ componentId: "sc-126xgc2-0"
50439
+ })(["position:relative;box-sizing:border-box;padding:0;", ""], function (_ref) {
50440
+ var extraStyles = _ref.extraStyles;
50441
+ return extraStyles;
50442
+ });
50443
+ var FilterContainer = /*#__PURE__*/React.forwardRef(function (props, ref) {
50444
+ return /*#__PURE__*/React__default.createElement(StyledFilterContainer, _extends({
50445
+ ref: ref
50446
+ }, props));
50447
+ });
50448
+ var StyledFilterDropdown = styled__default(Box).withConfig({
50449
+ displayName: "MultipleSelectFilterstyled__StyledFilterDropdown",
50450
+ componentId: "sc-126xgc2-1"
50451
+ })(["position:absolute;top:calc(100% + 0.5rem);left:0;width:100%;background-color:white;z-index:1000;border-radius:0.25rem;box-shadow:0px 1px 0px 0px rgba(41,42,51,0.1),0px 2px 4px 0px rgba(41,42,51,0.2),0px 1px 2px 0px rgba(41,42,51,0.1);padding:0;max-width:18.625rem;"]);
50452
+ var FilterDropdownContainer = /*#__PURE__*/React.forwardRef(function (props, ref) {
50453
+ return /*#__PURE__*/React__default.createElement(StyledFilterDropdown, _extends({
50454
+ ref: ref
50455
+ }, props));
50456
+ });
50457
+ var FilterButton = styled__default(ButtonWithAction).withConfig({
50458
+ displayName: "MultipleSelectFilterstyled__FilterButton",
50459
+ componentId: "sc-126xgc2-2"
50460
+ })(["min-width:auto;min-height:2.3125rem;margin:0;padding:0.5rem;border-radius:0.25rem;box-shadow:0px 1px 2px 0px rgba(41,42,51,0.1);", " ", ""], function (_ref2) {
50461
+ var textColor = _ref2.textColor;
50462
+ return "\n color: ".concat(textColor, ";\n ");
50463
+ }, function (_ref3) {
50464
+ var backgroundColor = _ref3.backgroundColor;
50465
+ return "\n background-color: ".concat(backgroundColor, ";\n :hover,\n :active,\n :focus {\n background-color: ").concat(backgroundColor, ";\n }\n ");
50466
+ });
50467
+ var StyledFilterButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
50468
+ return /*#__PURE__*/React__default.createElement(FilterButton, _extends({
50469
+ ref: ref
50470
+ }, props));
50471
+ });
50472
+
50473
+ var ActionLinkButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50474
+ var action = _ref.action,
50475
+ text = _ref.text,
50476
+ dataQa = _ref.dataQa;
50477
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
50478
+ ref: ref,
50479
+ action: action,
50480
+ variant: "tertiary",
50481
+ extraStyles: "\n padding: 0.2rem; \n margin: 0.5rem; \n min-height: auto; \n min-width: auto;\n ",
50482
+ textExtraStyles: "font-weight: ".concat(FONT_WEIGHT_REGULAR, ";"),
50483
+ text: text,
50484
+ dataQa: dataQa
50485
+ });
50486
+ });
50487
+
50472
50488
  var _excluded$J = ["width", "height", "color"];
50473
50489
  var DropdownIconV2 = function DropdownIconV2(_ref) {
50474
50490
  var _ref$width = _ref.width,
@@ -50517,205 +50533,385 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
50517
50533
  }))));
50518
50534
  };
50519
50535
 
50520
- var StyledFilterContainer = styled__default(Box).withConfig({
50521
- displayName: "MultipleSelectFilterstyled__StyledFilterContainer",
50522
- componentId: "sc-126xgc2-0"
50523
- })(["position:relative;box-sizing:border-box;padding:0;", ""], function (_ref) {
50524
- var extraStyles = _ref.extraStyles;
50525
- return extraStyles;
50526
- });
50527
- var FilterContainer = /*#__PURE__*/React.forwardRef(function (props, ref) {
50528
- return /*#__PURE__*/React__default.createElement(StyledFilterContainer, _extends({
50529
- ref: ref
50530
- }, props));
50531
- });
50532
- var StyledFilterDropdown = styled__default(Box).withConfig({
50533
- displayName: "MultipleSelectFilterstyled__StyledFilterDropdown",
50534
- componentId: "sc-126xgc2-1"
50535
- })(["position:absolute;top:calc(100% + 0.5rem);left:0;width:100%;background-color:white;z-index:1000;border-radius:0.25rem;box-shadow:0px 1px 0px 0px rgba(41,42,51,0.1),0px 2px 4px 0px rgba(41,42,51,0.2),0px 1px 2px 0px rgba(41,42,51,0.1);padding:0;max-width:18.625rem;"]);
50536
- var FilterDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
50537
- return /*#__PURE__*/React__default.createElement(StyledFilterDropdown, _extends({
50538
- ref: ref
50539
- }, props));
50536
+ var FilterButton$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50537
+ var btnContentOverride = _ref.btnContentOverride,
50538
+ _ref$action = _ref.action,
50539
+ action = _ref$action === void 0 ? noop$1 : _ref$action,
50540
+ opened = _ref.opened,
50541
+ backgroundColor = _ref.backgroundColor,
50542
+ contentColor = _ref.contentColor,
50543
+ name = _ref.name,
50544
+ filterDropdownID = _ref.filterDropdownID,
50545
+ _ref$hasIcon = _ref.hasIcon,
50546
+ hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
50547
+ Icon = _ref.icon,
50548
+ truncateBtnTextWidth = _ref.truncateBtnTextWidth,
50549
+ filterLabel = _ref.filterLabel,
50550
+ selectedOptions = _ref.selectedOptions;
50551
+ return /*#__PURE__*/React__default.createElement(StyledFilterButton, {
50552
+ ref: ref,
50553
+ variant: "tertiary",
50554
+ action: action,
50555
+ "aria-haspopup": "listbox",
50556
+ "aria-expanded": opened,
50557
+ "aria-controls": filterDropdownID,
50558
+ backgroundColor: backgroundColor,
50559
+ dataQa: "".concat(name, "-filter-button"),
50560
+ contentOverride: true
50561
+ }, btnContentOverride ? btnContentOverride : /*#__PURE__*/React__default.createElement(Center, {
50562
+ as: "span",
50563
+ style: {
50564
+ display: "flex",
50565
+ flexDirection: "row"
50566
+ },
50567
+ intrinsic: true
50568
+ }, hasIcon && /*#__PURE__*/React__default.createElement(Icon, {
50569
+ color: contentColor
50570
+ }), /*#__PURE__*/React__default.createElement(Center, {
50571
+ as: "span",
50572
+ style: {
50573
+ display: "flex",
50574
+ flexDirection: "row",
50575
+ padding: "0 0.5rem 0 0.25rem"
50576
+ },
50577
+ intrinsic: true
50578
+ }, /*#__PURE__*/React__default.createElement(Text$1, {
50579
+ variant: "pS",
50580
+ color: contentColor,
50581
+ extraStyles: "\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n ".concat(truncateBtnTextWidth && "max-width:" + truncateBtnTextWidth, "\n ")
50582
+ }, selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? "".concat(filterLabel ? filterLabel + ": " : "").concat(selectedOptions[0].name) : "".concat(filterLabel ? filterLabel : "")), /*#__PURE__*/React__default.createElement(Text$1, {
50583
+ color: contentColor,
50584
+ variant: "pS"
50585
+ }, 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") : "")), /*#__PURE__*/React__default.createElement(DropdownIconV2, {
50586
+ color: contentColor
50587
+ })));
50540
50588
  });
50541
- var StyledFilterButton = styled__default(ButtonWithAction).withConfig({
50542
- displayName: "MultipleSelectFilterstyled__StyledFilterButton",
50543
- componentId: "sc-126xgc2-2"
50544
- })(["min-width:auto;min-height:2.3125rem;margin:0;padding:0.5rem;border-radius:0.25rem;box-shadow:0px 1px 2px 0px rgba(41,42,51,0.1);", " ", ""], function (_ref2) {
50545
- var textColor = _ref2.textColor;
50546
- return "\n color: ".concat(textColor, ";\n ");
50547
- }, function (_ref3) {
50548
- var backgroundColor = _ref3.backgroundColor;
50549
- return "\n background-color: ".concat(backgroundColor, ";\n :hover,\n :active,\n :focus {\n background-color: ").concat(backgroundColor, ";\n }\n ");
50589
+
50590
+ var FilterDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50591
+ var id = _ref.id,
50592
+ ariaOwns = _ref.ariaOwns,
50593
+ opened = _ref.opened,
50594
+ children = _ref.children;
50595
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, opened && /*#__PURE__*/React__default.createElement(FilterDropdownContainer, {
50596
+ ref: ref,
50597
+ id: id,
50598
+ role: "combobox",
50599
+ "aria-expanded": opened,
50600
+ "aria-haspopup": "listbox",
50601
+ "aria-owns": ariaOwns
50602
+ }, children));
50550
50603
  });
50551
- var FilterButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
50552
- return /*#__PURE__*/React__default.createElement(StyledFilterButton, _extends({
50553
- ref: ref
50554
- }, props));
50604
+
50605
+ var SearchBox = function SearchBox(_ref) {
50606
+ var autocompleteValue = _ref.autocompleteValue,
50607
+ fields = _ref.fields,
50608
+ actions = _ref.actions,
50609
+ placeholder = _ref.placeholder,
50610
+ disabled = _ref.disabled,
50611
+ showSearchBox = _ref.showSearchBox;
50612
+ return /*#__PURE__*/React__default.createElement(Box, {
50613
+ padding: "0 0 0.5rem"
50614
+ }, showSearchBox && /*#__PURE__*/React__default.createElement(FormInput$1, {
50615
+ autocompleteValue: autocompleteValue,
50616
+ showFieldErrorRow: false,
50617
+ errorMessages: {},
50618
+ field: fields.searchTerm,
50619
+ fieldActions: actions.fields.searchTerm,
50620
+ placeholder: placeholder,
50621
+ disabled: disabled,
50622
+ extraStyles: "\n height: 2.875rem;\n border: 0; \n border-radius: 0;\n padding: 0.45rem;\n font-size: 0.875rem;\n border-bottom: 1px solid ".concat(GHOST_GREY, ";\n ")
50623
+ }));
50624
+ };
50625
+
50626
+ var FilterableListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50627
+ var index = _ref.index,
50628
+ option = _ref.option,
50629
+ checked = _ref.checked,
50630
+ selectOption = _ref.selectOption,
50631
+ disabled = _ref.disabled,
50632
+ tabIndex = _ref.tabIndex,
50633
+ name = _ref.name,
50634
+ themeValues = _ref.themeValues;
50635
+ return /*#__PURE__*/React__default.createElement(Box, {
50636
+ padding: "0",
50637
+ key: index,
50638
+ extraStyles: "\n :hover,\n :active,\n :focus {\n background-color: ".concat(themeValues.primaryColor, ";\n }\n ")
50639
+ }, /*#__PURE__*/React__default.createElement(Checkbox$1, {
50640
+ ref: ref,
50641
+ title: option.name,
50642
+ name: option.name,
50643
+ checked: checked,
50644
+ onChange: function onChange() {
50645
+ return selectOption(option);
50646
+ },
50647
+ textExtraStyles: "font-size: 0.875rem; margin: 0;",
50648
+ disabled: disabled,
50649
+ extraStyles: "\n padding: 0.075rem 0.325rem; \n margin: 0;\n :hover,\n :active,\n :focus {\n background-color: ".concat(themeValues.primaryColor, ";\n }\n "),
50650
+ checkboxMargin: "0.3rem",
50651
+ role: "option",
50652
+ checkboxExtraStyles: "\n width: 1.375rem; \n height: 1.375rem;\n ".concat(checked && !disabled ? "background: " + themeValues.secondaryColor + ";" : "", "\n "),
50653
+ tabIndex: tabIndex,
50654
+ dataQa: "".concat(name, "-option-").concat(index)
50655
+ }));
50555
50656
  });
50556
50657
 
50557
- var ScrollableOptionsList = function ScrollableOptionsList(_ref) {
50558
- var id = _ref.id,
50559
- optionsList = _ref.optionsList,
50658
+ var filterItemsList = function filterItemsList(list, searchTerm) {
50659
+ return list.filter(function (item) {
50660
+ var _item$name;
50661
+ return item === null || item === void 0 || (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.toLowerCase().includes(searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.toLowerCase());
50662
+ });
50663
+ };
50664
+ var sortItemsList = function sortItemsList(list) {
50665
+ return list.slice().sort(function (a, b) {
50666
+ return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
50667
+ });
50668
+ };
50669
+ var isMaxSelectionReached = function isMaxSelectionReached(maxSelection, selectedOptions) {
50670
+ return maxSelection && maxSelection === (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length);
50671
+ };
50672
+ var isChecked = function isChecked(option, selectedOptions) {
50673
+ return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.some(function (selectedOption) {
50674
+ return (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name) === (option === null || option === void 0 ? void 0 : option.name);
50675
+ });
50676
+ };
50677
+ var selectValues = function selectValues(items) {
50678
+ return items.map(function (item) {
50679
+ return item.value;
50680
+ });
50681
+ };
50682
+ var selectOption = function selectOption(option, selectedOptions, setSelectedOptions) {
50683
+ if (selectValues(selectedOptions).includes(option.value)) {
50684
+ var fewerOptions = selectedOptions.filter(function (selectedOption) {
50685
+ return selectedOption.value !== option.value;
50686
+ });
50687
+ setSelectedOptions(fewerOptions);
50688
+ } else {
50689
+ var moreOptions = selectedOptions.concat(option);
50690
+ setSelectedOptions(moreOptions);
50691
+ }
50692
+ };
50693
+
50694
+ var useKeyboardNavigation = function useKeyboardNavigation(_ref) {
50695
+ var options = _ref.options,
50696
+ appliedOptions = _ref.appliedOptions,
50560
50697
  selectedOptions = _ref.selectedOptions,
50561
- themeValues = _ref.themeValues,
50562
- selectOption = _ref.selectOption,
50563
- maxSelections = _ref.maxSelections,
50564
- name = _ref.name;
50698
+ maxSelections = _ref.maxSelections;
50565
50699
  var _useState = React.useState(-1),
50566
50700
  _useState2 = _slicedToArray(_useState, 2),
50567
50701
  focusedIndex = _useState2[0],
50568
50702
  setFocusedIndex = _useState2[1];
50569
- var checkboxRefs = React.useRef([]);
50570
- var isMaxSelectionReached = maxSelections && maxSelections === (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length);
50571
- var isChecked = function isChecked(option) {
50572
- return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.some(function (selectedOption) {
50573
- return (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name) === (option === null || option === void 0 ? void 0 : option.name);
50703
+ var itemRefs = React.useRef([]);
50704
+ var totalItemsLength = options.length + appliedOptions.length;
50705
+ var handleArrowUp = function handleArrowUp(event) {
50706
+ event.preventDefault();
50707
+ setFocusedIndex(function (prevIndex) {
50708
+ return prevIndex > 0 ? prevIndex - 1 : totalItemsLength - 1;
50574
50709
  });
50575
50710
  };
50576
- React.useEffect(function () {
50577
- if (focusedIndex !== -1 && checkboxRefs.current && checkboxRefs.current[focusedIndex]) {
50578
- checkboxRefs.current[focusedIndex].focus(); // move focus to the active option
50711
+ var handleArrowDown = function handleArrowDown(event) {
50712
+ event.preventDefault();
50713
+ setFocusedIndex(function (prevIndex) {
50714
+ return prevIndex < totalItemsLength - 1 ? prevIndex + 1 : 0;
50715
+ });
50716
+ };
50717
+ var handleSpacebar = function handleSpacebar(event) {
50718
+ event.preventDefault();
50719
+ var validFocusedIndex = focusedIndex < 0 ? 0 : focusedIndex;
50720
+ // Select option on spacebar press if the maximum selection hasn't been reached.
50721
+ if (!isMaxSelectionReached(maxSelections, selectedOptions) && itemRefs.current && itemRefs.current[validFocusedIndex]) {
50722
+ var nestedInput = itemRefs.current[validFocusedIndex].querySelector("input");
50723
+ if (nestedInput) {
50724
+ nestedInput.click();
50725
+ }
50579
50726
  }
50580
- }, [focusedIndex]);
50727
+ };
50728
+ var handleTab = function handleTab(event) {
50729
+ // Reset focus when tabbing out of the list.
50730
+ setFocusedIndex(-1);
50731
+ };
50732
+ var keyActions = {
50733
+ " ": function _(event) {
50734
+ return handleSpacebar(event);
50735
+ },
50736
+ Space: function Space(event) {
50737
+ return handleSpacebar(event);
50738
+ },
50739
+ Tab: function Tab(event) {
50740
+ return handleTab();
50741
+ },
50742
+ ArrowUp: function ArrowUp(event) {
50743
+ return handleArrowUp(event);
50744
+ },
50745
+ ArrowDown: function ArrowDown(event) {
50746
+ return handleArrowDown(event);
50747
+ }
50748
+ };
50581
50749
  var handleKeyDown = function handleKeyDown(event) {
50582
- if (event.key === "ArrowDown") {
50583
- event.preventDefault();
50584
- setFocusedIndex(function (prevIndex) {
50585
- return prevIndex < optionsList.length - 1 ? prevIndex + 1 : 0;
50586
- });
50587
- } else if (event.key === "ArrowUp") {
50588
- event.preventDefault();
50589
- setFocusedIndex(function (prevIndex) {
50590
- return prevIndex > 0 ? prevIndex - 1 : optionsList.length - 1;
50591
- });
50592
- } else if (event.key === " ") {
50593
- event.preventDefault();
50594
- // Select option on spacebar press if the maximum selection hasn't been reached.
50595
- var validFocusedIndex = focusedIndex < 0 ? 0 : focusedIndex;
50596
- if (!isMaxSelectionReached || focusedIndex !== -1 && isChecked(optionsList[validFocusedIndex])) {
50597
- selectOption(optionsList[validFocusedIndex]);
50598
- }
50599
- } else if (event.key === "Tab") {
50600
- // Reset focus when tabbing out of the list.
50601
- setTimeout(function () {
50602
- setFocusedIndex(-1);
50603
- }, 500);
50750
+ var eventKey = event.code || event.key;
50751
+ var action = keyActions[eventKey];
50752
+ if (action) {
50753
+ action(event);
50754
+ }
50755
+ };
50756
+ React.useEffect(function () {
50757
+ if (focusedIndex !== -1 && itemRefs.current && itemRefs.current[focusedIndex]) {
50758
+ itemRefs.current[focusedIndex].focus(); // move focus to the active option
50604
50759
  }
50760
+ }, [focusedIndex]);
50761
+ return {
50762
+ itemRefs: itemRefs,
50763
+ focusedIndex: focusedIndex,
50764
+ handleKeyDown: handleKeyDown
50765
+ };
50766
+ };
50767
+
50768
+ var FilterableList = function FilterableList(_ref) {
50769
+ var id = _ref.id,
50770
+ options = _ref.options,
50771
+ appliedOptions = _ref.appliedOptions,
50772
+ selectedOptions = _ref.selectedOptions,
50773
+ maxSelections = _ref.maxSelections,
50774
+ name = _ref.name,
50775
+ setSelectedOptions = _ref.setSelectedOptions,
50776
+ searchTerm = _ref.searchTerm,
50777
+ themeValues = _ref.themeValues;
50778
+ var _useState = React.useState([]),
50779
+ _useState2 = _slicedToArray(_useState, 2),
50780
+ filteredOptions = _useState2[0],
50781
+ setFilteredOptions = _useState2[1];
50782
+ var _useState3 = React.useState([]),
50783
+ _useState4 = _slicedToArray(_useState3, 2),
50784
+ filteredAppliedOptions = _useState4[0],
50785
+ setFilteredAppliedOptions = _useState4[1];
50786
+ React.useEffect(function () {
50787
+ setFilteredOptions(options);
50788
+ setFilteredAppliedOptions(appliedOptions);
50789
+ }, [options, appliedOptions]);
50790
+ React.useEffect(function () {
50791
+ var filteredOptionItems = filterItemsList(options, searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.rawValue);
50792
+ var filteredAppliedItems = filterItemsList(appliedOptions, searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.rawValue);
50793
+ setFilteredOptions(filteredOptionItems.length ? filteredOptionItems : filteredOptions);
50794
+ setFilteredAppliedOptions(filteredAppliedItems);
50795
+ }, [searchTerm.rawValue]);
50796
+ var handleSelectOption = function handleSelectOption(option) {
50797
+ return selectOption(option, selectedOptions, setSelectedOptions);
50605
50798
  };
50799
+ var isAppliedOption = function isAppliedOption(option) {
50800
+ return filteredAppliedOptions === null || filteredAppliedOptions === void 0 ? void 0 : filteredAppliedOptions.some(function (appliedItem) {
50801
+ return (appliedItem === null || appliedItem === void 0 ? void 0 : appliedItem.name) === (option === null || option === void 0 ? void 0 : option.name);
50802
+ });
50803
+ };
50804
+ var currentFilteredOptions = filteredOptions.filter(function (option) {
50805
+ return !isAppliedOption(option);
50806
+ });
50807
+ var sortedOptions = sortItemsList(currentFilteredOptions);
50808
+ var sortedAppliedOptions = sortItemsList(filteredAppliedOptions);
50809
+ var _useKeyboardNavigatio = useKeyboardNavigation({
50810
+ options: sortedOptions,
50811
+ appliedOptions: sortedAppliedOptions,
50812
+ selectedOptions: selectedOptions,
50813
+ maxSelections: maxSelections
50814
+ }),
50815
+ itemRefs = _useKeyboardNavigatio.itemRefs,
50816
+ focusedIndex = _useKeyboardNavigatio.focusedIndex,
50817
+ handleKeyDown = _useKeyboardNavigatio.handleKeyDown;
50606
50818
  return /*#__PURE__*/React__default.createElement(Box, {
50607
50819
  id: id,
50608
50820
  role: "listbox",
50609
50821
  padding: "0",
50610
- extraStyles: "\n overflow-y: auto; \n max-height: 250px; \n display: flex; \n flex-flow: column;\n ",
50822
+ extraStyles: "\n overflow-y: auto;\n max-height: 250px;\n display: flex;\n flex-flow: column;\n ",
50611
50823
  onKeyDown: handleKeyDown
50612
- }, optionsList.map(function (option, index) {
50613
- var checked = isChecked(option);
50614
- var isDisabled = isMaxSelectionReached && !checked;
50824
+ }, (sortedAppliedOptions === null || sortedAppliedOptions === void 0 ? void 0 : sortedAppliedOptions.length) > 0 && /*#__PURE__*/React__default.createElement(Box, {
50825
+ padding: "0",
50826
+ extraStyles: sortedOptions.length > 0 && "border-bottom: 1px solid ".concat(GHOST_GREY)
50827
+ }, sortedAppliedOptions.map(function (option, index) {
50828
+ var checked = isChecked(option, selectedOptions);
50615
50829
  var tabIndex = index === focusedIndex || index === 0 && focusedIndex === -1 ? "0" : "-1";
50616
- return /*#__PURE__*/React__default.createElement(Box, {
50617
- padding: "0",
50830
+ return /*#__PURE__*/React__default.createElement(FilterableListItem, {
50618
50831
  key: index,
50619
- extraStyles: "\n :hover,\n :active,\n :focus {\n background-color: ".concat(themeValues.primaryColor, ";\n }\n ")
50620
- }, /*#__PURE__*/React__default.createElement(Checkbox$1, {
50621
50832
  ref: function ref(el) {
50622
- return checkboxRefs.current[index] = el;
50833
+ return itemRefs.current[index] = el;
50623
50834
  },
50624
- title: option.name,
50625
- name: option.name,
50835
+ index: index,
50836
+ option: option,
50626
50837
  checked: checked,
50627
- onChange: function onChange() {
50628
- return isDisabled ? noop : selectOption(option);
50838
+ selectOption: handleSelectOption,
50839
+ tabIndex: tabIndex,
50840
+ name: name,
50841
+ themeValues: themeValues
50842
+ });
50843
+ })), sortedOptions.map(function (option, index) {
50844
+ var checked = isChecked(option, selectedOptions);
50845
+ var isDisabled = isMaxSelectionReached(maxSelections, selectedOptions) && !checked;
50846
+ var indexOffset = sortedAppliedOptions !== null && sortedAppliedOptions !== void 0 && sortedAppliedOptions.length ? sortedAppliedOptions === null || sortedAppliedOptions === void 0 ? void 0 : sortedAppliedOptions.length : 0;
50847
+ var currentIndex = index === 0 ? indexOffset : index + indexOffset;
50848
+ var tabIndex = currentIndex === focusedIndex || indexOffset === 0 && currentIndex === indexOffset && focusedIndex === -1 ? "0" : "-1";
50849
+ return /*#__PURE__*/React__default.createElement(FilterableListItem, {
50850
+ key: currentIndex,
50851
+ ref: function ref(el) {
50852
+ return itemRefs.current[currentIndex] = el;
50629
50853
  },
50630
- textExtraStyles: "font-size: 0.875rem; margin: 0;",
50854
+ index: currentIndex,
50855
+ option: option,
50856
+ checked: checked,
50857
+ selectOption: isDisabled ? noop : handleSelectOption,
50631
50858
  disabled: isDisabled,
50632
- extraStyles: "\n padding: 0.075rem 0.325rem; \n margin: 0;\n :hover,\n :active,\n :focus {\n background-color: ".concat(themeValues.primaryColor, ";\n }\n "),
50633
- checkboxMargin: "0.3rem",
50634
- role: "option",
50635
- checkboxExtraStyles: "\n width: 1.375rem; \n height: 1.375rem; \n ".concat(checked && !isDisabled ? "background: " + themeValues.secondaryColor + ";" : ""),
50636
50859
  tabIndex: tabIndex,
50637
- dataQa: "".concat(name, "-option-").concat(index)
50638
- }));
50860
+ name: name,
50861
+ themeValues: themeValues
50862
+ });
50639
50863
  }));
50640
50864
  };
50641
- var MultipleSelectFilter = function MultipleSelectFilter(_ref2) {
50642
- var actions = _ref2.actions,
50643
- autocompleteValue = _ref2.autocompleteValue,
50644
- btnContentOverride = _ref2.btnContentOverride,
50645
- disabled = _ref2.disabled,
50646
- extraStyles = _ref2.extraStyles,
50647
- fields = _ref2.fields,
50648
- filterLabel = _ref2.filterLabel,
50649
- _ref2$hasIcon = _ref2.hasIcon,
50650
- hasIcon = _ref2$hasIcon === void 0 ? false : _ref2$hasIcon,
50651
- Icon = _ref2.icon,
50652
- maxSelections = _ref2.maxSelections,
50653
- _ref2$name = _ref2.name,
50654
- name = _ref2$name === void 0 ? "MultipleSelectFilter" : _ref2$name,
50655
- _ref2$onApply = _ref2.onApply,
50656
- onApply = _ref2$onApply === void 0 ? noop : _ref2$onApply,
50657
- _ref2$onClear = _ref2.onClear,
50658
- onClear = _ref2$onClear === void 0 ? noop : _ref2$onClear,
50659
- options = _ref2.options,
50660
- _ref2$placeholder = _ref2.placeholder,
50661
- placeholder = _ref2$placeholder === void 0 ? "Search" : _ref2$placeholder,
50662
- _ref2$searchable = _ref2.searchable,
50663
- searchable = _ref2$searchable === void 0 ? true : _ref2$searchable,
50664
- selectedOptions = _ref2.selectedOptions,
50665
- setSelectedOptions = _ref2.setSelectedOptions,
50666
- themeValues = _ref2.themeValues,
50667
- _ref2$truncateBtnText = _ref2.truncateBtnTextWidth,
50668
- truncateBtnTextWidth = _ref2$truncateBtnText === void 0 ? "15rem" : _ref2$truncateBtnText;
50865
+ var FilterableList$1 = /*#__PURE__*/React__default.memo(FilterableList);
50866
+
50867
+ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
50868
+ var actions = _ref.actions,
50869
+ autocompleteValue = _ref.autocompleteValue,
50870
+ btnContentOverride = _ref.btnContentOverride,
50871
+ disabled = _ref.disabled,
50872
+ extraStyles = _ref.extraStyles,
50873
+ fields = _ref.fields,
50874
+ filterLabel = _ref.filterLabel,
50875
+ _ref$hasIcon = _ref.hasIcon,
50876
+ hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
50877
+ Icon = _ref.icon,
50878
+ maxSelections = _ref.maxSelections,
50879
+ _ref$name = _ref.name,
50880
+ name = _ref$name === void 0 ? "MultipleSelectFilter" : _ref$name,
50881
+ _ref$onApply = _ref.onApply,
50882
+ onApply = _ref$onApply === void 0 ? noop$1 : _ref$onApply,
50883
+ _ref$onClear = _ref.onClear,
50884
+ onClear = _ref$onClear === void 0 ? noop$1 : _ref$onClear,
50885
+ options = _ref.options,
50886
+ _ref$placeholder = _ref.placeholder,
50887
+ placeholder = _ref$placeholder === void 0 ? "Search" : _ref$placeholder,
50888
+ _ref$searchable = _ref.searchable,
50889
+ searchable = _ref$searchable === void 0 ? true : _ref$searchable,
50890
+ selectedOptions = _ref.selectedOptions,
50891
+ setSelectedOptions = _ref.setSelectedOptions,
50892
+ themeValues = _ref.themeValues,
50893
+ _ref$truncateBtnTextW = _ref.truncateBtnTextWidth,
50894
+ truncateBtnTextWidth = _ref$truncateBtnTextW === void 0 ? "15rem" : _ref$truncateBtnTextW;
50895
+ var _useState = React.useState(false),
50896
+ _useState2 = _slicedToArray(_useState, 2),
50897
+ opened = _useState2[0],
50898
+ setOpened = _useState2[1];
50669
50899
  var _useState3 = React.useState([]),
50670
50900
  _useState4 = _slicedToArray(_useState3, 2),
50671
- itemList = _useState4[0],
50672
- setItemList = _useState4[1];
50673
- var _useState5 = React.useState(false),
50674
- _useState6 = _slicedToArray(_useState5, 2),
50675
- opened = _useState6[0],
50676
- setOpened = _useState6[1];
50901
+ appliedOptions = _useState4[0],
50902
+ setAppliedOptions = _useState4[1];
50677
50903
  var containerRef = React.useRef(null);
50678
50904
  var dropdownRef = React.useRef(null);
50679
50905
  var filterButtonRef = React.useRef(null);
50680
50906
  var applyFilterButtonRef = React.useRef(null);
50681
50907
  var filterDropdownID = "".concat(name, "-filter-dropdown");
50682
50908
  var checkboxListID = "".concat(name, "-checkbox-list");
50683
- var backgroundColor = opened ? themeValues.primaryColor : selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? themeValues.secondaryColor : WHITE;
50684
- var contentColor = !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : "#292A33";
50685
- var completeOptionsList = itemList.slice().sort(function (a, b) {
50686
- return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
50687
- });
50688
- var selectValues = function selectValues(items) {
50689
- return items.map(function (item) {
50690
- return item.value;
50691
- });
50692
- };
50693
- var selectOption = function selectOption(selectedOption) {
50694
- if (selectValues(selectedOptions).includes(selectedOption.value)) {
50695
- var fewerOptions = selectedOptions.filter(function (option) {
50696
- return option.value !== selectedOption.value;
50697
- });
50698
- setSelectedOptions(fewerOptions);
50699
- } else {
50700
- var moreOptions = selectedOptions.concat(selectedOption);
50701
- setSelectedOptions(moreOptions);
50702
- }
50703
- };
50704
- React.useEffect(function () {
50705
- return setItemList(options);
50706
- }, [options]);
50707
50909
  React.useEffect(function () {
50708
- var filteredItems = options.filter(function (item) {
50709
- var _item$name, _fields$searchTerm;
50710
- return item === null || item === void 0 || (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.toLowerCase().includes(fields === null || fields === void 0 || (_fields$searchTerm = fields.searchTerm) === null || _fields$searchTerm === void 0 || (_fields$searchTerm = _fields$searchTerm.rawValue) === null || _fields$searchTerm === void 0 ? void 0 : _fields$searchTerm.toLowerCase());
50711
- });
50712
- // If no items are filtered, display the entire list of options.
50713
- if (filteredItems !== null && filteredItems !== void 0 && filteredItems.length) {
50714
- setItemList(filteredItems);
50715
- } else {
50716
- setItemList(options);
50910
+ if (!opened) {
50911
+ onApply(selectedOptions);
50912
+ setAppliedOptions(selectedOptions);
50717
50913
  }
50718
- }, [fields.searchTerm.rawValue]);
50914
+ }, [opened]);
50719
50915
  React.useEffect(function () {
50720
50916
  var handleKeyDown = function handleKeyDown(event) {
50721
50917
  if (event.key === "Escape") {
@@ -50749,97 +50945,64 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref2) {
50749
50945
  return /*#__PURE__*/React__default.createElement(FilterContainer, {
50750
50946
  ref: containerRef,
50751
50947
  extraStyles: "".concat(extraStyles)
50752
- }, /*#__PURE__*/React__default.createElement(FilterButton, {
50948
+ }, /*#__PURE__*/React__default.createElement(FilterButton$1, {
50753
50949
  ref: filterButtonRef,
50754
- variant: "tertiary",
50950
+ btnContentOverride: btnContentOverride,
50755
50951
  action: function action() {
50756
50952
  actions.fields.searchTerm.set("");
50757
50953
  setOpened(!opened);
50758
50954
  },
50759
- "aria-haspopup": "listbox",
50760
- "aria-expanded": opened,
50761
- "aria-controls": filterDropdownID,
50762
- backgroundColor: backgroundColor,
50763
- dataQa: "".concat(name, "-filter-button"),
50764
- contentOverride: true
50765
- }, btnContentOverride ? btnContentOverride : /*#__PURE__*/React__default.createElement(Center, {
50766
- as: "span",
50767
- style: {
50768
- display: "flex",
50769
- flexDirection: "row"
50770
- },
50771
- intrinsic: true
50772
- }, hasIcon && /*#__PURE__*/React__default.createElement(Icon, {
50773
- color: contentColor
50774
- }), /*#__PURE__*/React__default.createElement(Center, {
50775
- as: "span",
50776
- style: {
50777
- display: "flex",
50778
- flexDirection: "row",
50779
- padding: "0 0.5rem 0 0.25rem"
50780
- },
50781
- intrinsic: true
50782
- }, /*#__PURE__*/React__default.createElement(Text$1, {
50783
- variant: "pS",
50784
- color: contentColor,
50785
- extraStyles: "\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n ".concat(truncateBtnTextWidth && "max-width:" + truncateBtnTextWidth, "\n ")
50786
- }, selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? "".concat(filterLabel ? filterLabel + ": " : "").concat(selectedOptions[0].name) : "".concat(filterLabel ? filterLabel : "")), /*#__PURE__*/React__default.createElement(Text$1, {
50787
- color: contentColor,
50788
- variant: "pS"
50789
- }, 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") : "")), /*#__PURE__*/React__default.createElement(DropdownIconV2, {
50790
- color: contentColor
50791
- }))), /*#__PURE__*/React__default.createElement(FilterDropdown, {
50955
+ opened: opened,
50956
+ backgroundColor: opened ? themeValues.primaryColor : selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? themeValues.secondaryColor : WHITE,
50957
+ contentColor: !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : "#292A33",
50958
+ name: name,
50959
+ filterDropdownID: filterDropdownID,
50960
+ hasIcon: hasIcon,
50961
+ icon: Icon,
50962
+ truncateBtnTextWidth: truncateBtnTextWidth,
50963
+ filterLabel: filterLabel,
50964
+ selectedOptions: selectedOptions
50965
+ }), /*#__PURE__*/React__default.createElement(FilterDropdown, {
50792
50966
  id: filterDropdownID,
50793
50967
  ref: dropdownRef,
50794
- hidden: !opened,
50795
- role: "combobox",
50796
- "aria-expanded": opened,
50797
- "aria-haspopup": "listbox",
50798
- "aria-owns": checkboxListID
50799
- }, /*#__PURE__*/React__default.createElement(Box, {
50800
- padding: "0 0 0.5rem"
50801
- }, searchable && (options === null || options === void 0 ? void 0 : options.length) > 8 && /*#__PURE__*/React__default.createElement(FormInput$1, {
50968
+ ariaOwns: checkboxListID,
50969
+ opened: opened
50970
+ }, /*#__PURE__*/React__default.createElement(SearchBox, {
50971
+ showSearchBox: searchable && (options === null || options === void 0 ? void 0 : options.length) > 8,
50802
50972
  autocompleteValue: autocompleteValue,
50803
- showFieldErrorRow: false,
50804
- errorMessages: {},
50805
- field: fields.searchTerm,
50806
- fieldActions: actions.fields.searchTerm,
50973
+ fields: fields,
50974
+ actions: actions,
50807
50975
  placeholder: placeholder,
50808
- disabled: disabled,
50809
- extraStyles: "\n height: 2.875rem;\n border: 0; \n border-radius: 0;\n padding: 0.45rem;\n font-size: 0.875rem;\n border-bottom: 1px solid ".concat(GHOST_GREY, ";\n ")
50810
- })), /*#__PURE__*/React__default.createElement(ScrollableOptionsList, {
50976
+ disabled: disabled
50977
+ }), /*#__PURE__*/React__default.createElement(FilterableList$1, {
50811
50978
  id: checkboxListID,
50812
- optionsList: completeOptionsList,
50813
- selectedOptions: selectedOptions,
50979
+ options: options,
50980
+ appliedOptions: appliedOptions,
50814
50981
  themeValues: themeValues,
50815
- selectOption: selectOption,
50982
+ selectedOptions: selectedOptions,
50816
50983
  maxSelections: maxSelections,
50817
- name: name
50984
+ name: name,
50985
+ setSelectedOptions: setSelectedOptions,
50986
+ searchTerm: fields === null || fields === void 0 ? void 0 : fields.searchTerm
50818
50987
  }), /*#__PURE__*/React__default.createElement(Box, {
50819
50988
  padding: "0 0.5rem 0.0625rem 0.5rem",
50820
50989
  extraStyles: "\n max-height: 100px; \n display: flex; \n flex-flow: row; \n justify-content: space-between;\n border-top: 1px solid ".concat(GHOST_GREY, ";\n ")
50821
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
50990
+ }, /*#__PURE__*/React__default.createElement(ActionLinkButton, {
50822
50991
  action: function action() {
50823
50992
  setOpened(false);
50824
50993
  setSelectedOptions([]);
50825
50994
  actions.fields.searchTerm.set("");
50826
50995
  onClear();
50827
50996
  },
50828
- variant: "tertiary",
50829
- extraStyles: "\n padding: 0.2rem; \n margin: 0.5rem; \n min-height: auto; \n min-width: auto;\n ",
50830
- textExtraStyles: "font-weight: ".concat(FONT_WEIGHT_REGULAR, ";"),
50831
50997
  text: "Clear",
50832
50998
  dataQa: "".concat(name, "-clear-filters")
50833
- }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
50999
+ }), /*#__PURE__*/React__default.createElement(ActionLinkButton, {
50834
51000
  ref: applyFilterButtonRef,
50835
51001
  action: function action() {
50836
51002
  setOpened(false);
50837
51003
  actions.fields.searchTerm.set("");
50838
51004
  onApply(selectedOptions);
50839
51005
  },
50840
- variant: "tertiary",
50841
- extraStyles: "\n padding: 0.2rem; \n margin: 0.5rem; \n min-height: auto; \n min-width: auto;\n ",
50842
- textExtraStyles: "font-weight: ".concat(FONT_WEIGHT_REGULAR, ";"),
50843
51006
  text: "Apply",
50844
51007
  dataQa: "".concat(name, "-apply-filters")
50845
51008
  }))));