@thecb/components 11.1.16 → 11.2.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
@@ -28363,21 +28363,25 @@ var RadioButton$1 = function RadioButton(_ref2) {
28363
28363
  var buttonBorder = {
28364
28364
  onFocused: {
28365
28365
  borderColor: themeValues.activeColor,
28366
- outline: "3px solid ".concat(themeValues.activeColor),
28366
+ outlineWidth: "3px",
28367
+ outlineColor: themeValues.activeColor,
28367
28368
  outlineOffset: "2px"
28368
28369
  },
28369
28370
  offFocused: {
28370
28371
  borderColor: themeValues.activeColor,
28371
- outline: "3px solid ".concat(themeValues.activeColor),
28372
+ outlineWidth: "3px",
28373
+ outlineColor: themeValues.activeColor,
28372
28374
  outlineOffset: "2px"
28373
28375
  },
28374
28376
  on: {
28375
28377
  borderColor: themeValues.activeColor,
28376
- outline: "0"
28378
+ outlineWidth: "0px",
28379
+ outlineColor: "rgba(0, 0, 0, 0)"
28377
28380
  },
28378
28381
  off: {
28379
28382
  borderColor: themeValues.inactiveColor,
28380
- outline: "0"
28383
+ outlineWidth: "0px",
28384
+ outlineColor: "rgba(0, 0, 0, 0)"
28381
28385
  }
28382
28386
  };
28383
28387
  var buttonCenter = {
@@ -28430,7 +28434,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
28430
28434
  width: "24px",
28431
28435
  variants: buttonBorder,
28432
28436
  display: "flex",
28433
- extraStyles: "justify-content: center; align-items: center;"
28437
+ extraStyles: "outline: 0px solid rgba(0, 0, 0, 0); justify-content: center; align-items: center;"
28434
28438
  }, /*#__PURE__*/React__default.createElement(Motion, {
28435
28439
  variants: buttonCenter,
28436
28440
  borderRadius: "8px"
@@ -47233,7 +47237,7 @@ var InactiveTitleModule = function InactiveTitleModule(_ref) {
47233
47237
  variant: "extraSmall",
47234
47238
  as: "p",
47235
47239
  color: BLACK
47236
- }, "This may mean that the account has been paid off or there was an error loading it. If you have questions about this account, please contact us.".concat(autoPayEnabled ? " You may disable autopay for this account by pressing the 'Turn off Autopay' button." : ""))));
47240
+ }, "This may mean the balance has been paid and was removed from the system, or that there was an error loading it. .".concat(autoPayEnabled ? " You may disable autopay for this account by pressing the 'Turn off Autopay' button." : ""))));
47237
47241
  };
47238
47242
 
47239
47243
  var iconColor = ROYAL_BLUE_VIVID;
@@ -49585,7 +49589,8 @@ var RadioSection = function RadioSection(_ref) {
49585
49589
  ariaDescribedBy = _ref.ariaDescribedBy,
49586
49590
  _ref$isSectionRequire = _ref.isSectionRequired,
49587
49591
  isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
49588
- groupedSections = _ref.groupedSections,
49592
+ _ref$groupedSections = _ref.groupedSections,
49593
+ groupedSections = _ref$groupedSections === void 0 ? [] : _ref$groupedSections,
49589
49594
  borderOverride = _ref.borderOverride,
49590
49595
  rest = _objectWithoutProperties(_ref, _excluded$K);
49591
49596
  var _useState = React.useState(null),
@@ -49595,26 +49600,53 @@ var RadioSection = function RadioSection(_ref) {
49595
49600
  var sectionRefs = React.useRef(_toConsumableArray(Array(sections.length)).map(function () {
49596
49601
  return /*#__PURE__*/React.createRef();
49597
49602
  }));
49598
- var handleKeyDown = function handleKeyDown(id, e, i) {
49599
- if (e.currentTarget !== e.target) {
49603
+
49604
+ // Flatten the groupedSections while keeping track of indices
49605
+ var flattenedGroupedSections = groupedSections.flatMap(function (group, groupIndex) {
49606
+ return group.map(function (section, sectionIndex) {
49607
+ return _objectSpread2(_objectSpread2({}, section), {}, {
49608
+ groupIndex: groupIndex,
49609
+ sectionIndex: sectionIndex
49610
+ });
49611
+ });
49612
+ });
49613
+ var groupedSectionsRefs = React.useRef(_toConsumableArray(Array(flattenedGroupedSections.length)).map(function () {
49614
+ return /*#__PURE__*/React.createRef();
49615
+ }));
49616
+ var getFlatGroupIndex = function getFlatGroupIndex(groupIndex, sectionIndex) {
49617
+ return flattenedGroupedSections.findIndex(function (item) {
49618
+ return item.groupIndex === groupIndex && item.sectionIndex === sectionIndex;
49619
+ });
49620
+ };
49621
+ var handleKeyDown = function handleKeyDown(e, sectionID, sectionIndex, isGroup) {
49622
+ var currentTarget = e.currentTarget,
49623
+ target = e.target,
49624
+ keyCode = e.keyCode;
49625
+ if (currentTarget !== target) {
49600
49626
  return;
49601
49627
  }
49628
+ var refs = isGroup ? groupedSectionsRefs : sectionRefs;
49629
+ var currSection = isGroup ? flattenedGroupedSections : sections;
49602
49630
 
49603
49631
  // Allow Enter and Space to select a section
49604
- if (e.keyCode === ENTER || e.keyCode === SPACEBAR) {
49632
+ if (keyCode === ENTER || keyCode === SPACEBAR) {
49605
49633
  e.preventDefault();
49606
- toggleOpenSection(id);
49634
+ toggleOpenSection(sectionID);
49607
49635
  }
49608
49636
 
49609
49637
  // Allow Up and Down arrow navigation between sections
49610
- if (e.keyCode == ARROW_UP || e.keyCode == ARROW_DOWN || e.keyCode == ARROW_LEFT || e.keyCode == ARROW_RIGHT) {
49611
- var _sectionRefs$current$, _sections$nextIndex, _sections$nextIndex2;
49638
+ if (keyCode == ARROW_UP || keyCode == ARROW_DOWN || keyCode == ARROW_LEFT || keyCode == ARROW_RIGHT) {
49639
+ var _refs$current$nextInd;
49612
49640
  e.preventDefault();
49613
- var indexIncrement = e.keyCode == ARROW_RIGHT || e.keyCode == ARROW_DOWN ? 1 : -1;
49614
- var nextIndex = wrapIndex(i + indexIncrement, sections.length);
49615
- sectionRefs === null || sectionRefs === void 0 || (_sectionRefs$current$ = sectionRefs.current[nextIndex]) === null || _sectionRefs$current$ === void 0 || (_sectionRefs$current$ = _sectionRefs$current$.current) === null || _sectionRefs$current$ === void 0 || _sectionRefs$current$.focus();
49616
- setFocused((_sections$nextIndex = sections[nextIndex]) === null || _sections$nextIndex === void 0 ? void 0 : _sections$nextIndex.id);
49617
- toggleOpenSection((_sections$nextIndex2 = sections[nextIndex]) === null || _sections$nextIndex2 === void 0 ? void 0 : _sections$nextIndex2.id);
49641
+ var indexIncrement = keyCode == ARROW_RIGHT || keyCode == ARROW_DOWN ? 1 : -1;
49642
+ var nextIndex = wrapIndex(sectionIndex + indexIncrement, currSection.length);
49643
+ var nextRef = refs === null || refs === void 0 || (_refs$current$nextInd = refs.current[nextIndex]) === null || _refs$current$nextInd === void 0 ? void 0 : _refs$current$nextInd.current;
49644
+ if (nextRef) {
49645
+ var _currSection$nextInde;
49646
+ nextRef.focus();
49647
+ var nextRadioID = (_currSection$nextInde = currSection[nextIndex]) === null || _currSection$nextInde === void 0 ? void 0 : _currSection$nextInde.id;
49648
+ setFocused(nextRadioID);
49649
+ }
49618
49650
  }
49619
49651
  };
49620
49652
  return /*#__PURE__*/React__default.createElement(Box, _extends({
@@ -49642,7 +49674,7 @@ var RadioSection = function RadioSection(_ref) {
49642
49674
  openSection: openSection,
49643
49675
  toggleOpenSection: toggleOpenSection,
49644
49676
  onKeyDown: function onKeyDown(e) {
49645
- return !section.disabled && handleKeyDown(section.id, e, i);
49677
+ return !section.disabled && handleKeyDown(e, section.id, i);
49646
49678
  },
49647
49679
  ariaLabelledBy: section.id,
49648
49680
  ariaDescribedBy: "right-icons-".concat(idString$1(section)),
@@ -49652,13 +49684,14 @@ var RadioSection = function RadioSection(_ref) {
49652
49684
  return sectionGroup.filter(function (unfilteredSection) {
49653
49685
  return !unfilteredSection.hidden;
49654
49686
  }).map(function (section, sectionIndex) {
49687
+ var flatGroupSectionIndex = getFlatGroupIndex(sectionGroupIndex, sectionIndex);
49655
49688
  return /*#__PURE__*/React__default.createElement(React.Fragment, {
49656
49689
  key: "key-".concat(sectionGroupIndex, "-").concat(sectionIndex)
49657
49690
  }, /*#__PURE__*/React__default.createElement(InnerRadioSection, {
49658
49691
  themeValues: themeValues,
49659
- sectionIndex: "".concat(sectionGroupIndex, "-").concat(sectionIndex),
49692
+ sectionIndex: flatGroupSectionIndex,
49660
49693
  section: section,
49661
- sectionRefs: sectionRefs,
49694
+ sectionRefs: groupedSectionsRefs,
49662
49695
  focused: focused,
49663
49696
  setFocused: setFocused,
49664
49697
  openHeight: openHeight,
@@ -49666,6 +49699,9 @@ var RadioSection = function RadioSection(_ref) {
49666
49699
  ariaDescribedBy: "right-icons-".concat(idString$1(section)),
49667
49700
  openSection: openSection,
49668
49701
  toggleOpenSection: toggleOpenSection,
49702
+ onKeyDown: function onKeyDown(e) {
49703
+ return !section.disabled && handleKeyDown(e, section.id, flatGroupSectionIndex, true);
49704
+ },
49669
49705
  isLastGroupedItemInSection: sectionIndex === sectionGroup.length - 1
49670
49706
  }), sectionIndex === sectionGroup.length - 1 && sectionGroupIndex !== groupedSections.length - 1 && /*#__PURE__*/React__default.createElement(SolidDivider$1, {
49671
49707
  borderSize: "1px",