@thecb/components 9.3.1-beta.1 → 9.3.1-beta.2

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
@@ -48689,7 +48689,10 @@ var RadioSection = function RadioSection(_ref) {
48689
48689
  ariaDescribedBy = _ref.ariaDescribedBy,
48690
48690
  _ref$isSectionRequire = _ref.isSectionRequired,
48691
48691
  isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
48692
- _ref$legendText = _ref.legendText;
48692
+ _ref$legendText = _ref.legendText,
48693
+ legendText = _ref$legendText === void 0 ? "" : _ref$legendText,
48694
+ _ref$sectionGroups = _ref.sectionGroups,
48695
+ sectionGroups = _ref$sectionGroups === void 0 ? null : _ref$sectionGroups;
48693
48696
 
48694
48697
  var handleKeyDown = function handleKeyDown(id, e) {
48695
48698
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
@@ -48748,14 +48751,121 @@ var RadioSection = function RadioSection(_ref) {
48748
48751
  }, /*#__PURE__*/React__default.createElement("fieldset", {
48749
48752
  role: "radiogroup",
48750
48753
  tabIndex: "0",
48751
- required: isSectionRequired
48752
- }, /*#__PURE__*/React__default.createElement("legend", null, /*#__PURE__*/React__default.createElement(Box, {
48753
- width: "0",
48754
+ "aria-required": isSectionRequired,
48755
+ style: {
48756
+ padding: 0,
48757
+ margin: 0,
48758
+ border: 0
48759
+ }
48760
+ }, /*#__PURE__*/React__default.createElement(Box, {
48761
+ as: "legend",
48754
48762
  srOnly: true,
48755
- border: "0",
48756
48763
  padding: "0",
48757
48764
  margin: "0"
48758
- })), sections.filter(function (section) {
48765
+ }, legendText), sectionGroups && sectionGroups.map(function (sectionGroup) {
48766
+ var prependedItem = "";
48767
+
48768
+ if (sectionGroups.indexOf(sectionGroup) !== 0) {
48769
+ prependedItem = /*#__PURE__*/React__default.createElement(SolidDivider$1, null);
48770
+ }
48771
+
48772
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, prependedItem, sectionGroup.filter(function (unfilteredSection) {
48773
+ return !unfilteredSection.hidden;
48774
+ }).map(function (section) {
48775
+ return /*#__PURE__*/React__default.createElement(Motion, {
48776
+ tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
48777
+ onKeyDown: function onKeyDown(e) {
48778
+ return !section.disabled && handleKeyDown(section.id, e);
48779
+ },
48780
+ onFocus: function onFocus() {
48781
+ return !section.disabled && setFocused(section.id);
48782
+ },
48783
+ onBlur: function onBlur() {
48784
+ return !section.disabled && setFocused(null);
48785
+ },
48786
+ hoverStyles: themeValues.focusStyles,
48787
+ animate: openSection === section.id ? "open" : "closed",
48788
+ initial: initiallyOpen ? "open" : "closed",
48789
+ key: "item-".concat(section.id),
48790
+ extraStyles: borderStyles,
48791
+ role: "radio",
48792
+ "aria-checked": openSection === section.id,
48793
+ "aria-disabled": section.disabled,
48794
+ "aria-required": section === null || section === void 0 ? void 0 : section.required
48795
+ }, /*#__PURE__*/React__default.createElement(Stack, {
48796
+ childGap: "0"
48797
+ }, /*#__PURE__*/React__default.createElement(Box, {
48798
+ padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
48799
+ background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
48800
+ onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
48801
+ return toggleOpenSection(section.id);
48802
+ },
48803
+ onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
48804
+ return toggleOpenSection(section.id);
48805
+ } : noop,
48806
+ key: "header-".concat(section.id),
48807
+ borderSize: "0px",
48808
+ borderColor: themeValues.borderColor,
48809
+ borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
48810
+ extraStyles: !section.disabled ? "cursor: pointer;" : "",
48811
+ dataQa: section.dataQa ? section.dataQa : section.id
48812
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
48813
+ justify: "space-between",
48814
+ align: "center",
48815
+ childGap: "1px",
48816
+ nowrap: true
48817
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
48818
+ justify: "flex-start",
48819
+ align: "center",
48820
+ nowrap: true
48821
+ }, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
48822
+ padding: "0"
48823
+ }, /*#__PURE__*/React__default.createElement(RadioButton$2, {
48824
+ id: "radio-input-".concat(idString(section)),
48825
+ name: idString(section),
48826
+ ariaDescribedBy: ariaDescribedBy,
48827
+ radioOn: openSection === section.id,
48828
+ radioFocused: focused === section.id,
48829
+ toggleRadio: section.disabled ? noop : function () {
48830
+ return toggleOpenSection(section.id);
48831
+ },
48832
+ isRequired: section === null || section === void 0 ? void 0 : section.required
48833
+ })), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
48834
+ align: "center"
48835
+ }, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
48836
+ padding: section.titleIcon ? "0 0 0 8px" : "0"
48837
+ }, /*#__PURE__*/React__default.createElement(Text$1, {
48838
+ as: "label",
48839
+ htmlFor: "radio-input-".concat(idString(section)),
48840
+ color: CHARADE_GREY
48841
+ }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
48842
+ childGap: "0.5rem",
48843
+ "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
48844
+ role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
48845
+ }, section.rightIcons.map(function (icon) {
48846
+ return /*#__PURE__*/React__default.createElement(RightIcon, {
48847
+ src: icon.img,
48848
+ key: icon.img,
48849
+ fade: !icon.enabled,
48850
+ isMobile: isMobile,
48851
+ alt: icon.altText,
48852
+ "aria-disabled": !icon.enabled
48853
+ });
48854
+ })), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
48855
+ initial: false
48856
+ }, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
48857
+ key: "content-".concat(section.id),
48858
+ padding: "0",
48859
+ background: themeValues.bodyBackgroundColor,
48860
+ layoutTransition: true,
48861
+ initial: "closed",
48862
+ animate: "open",
48863
+ exit: "closed",
48864
+ variants: wrapper,
48865
+ extraStyles: "transform-origin: 100% 0;"
48866
+ }, section.content))));
48867
+ }));
48868
+ }), sections && sections.filter(function (section) {
48759
48869
  return !section.hidden;
48760
48870
  }).map(function (section) {
48761
48871
  return /*#__PURE__*/React__default.createElement(Motion, {
@@ -48773,11 +48883,7 @@ var RadioSection = function RadioSection(_ref) {
48773
48883
  animate: openSection === section.id ? "open" : "closed",
48774
48884
  initial: initiallyOpen ? "open" : "closed",
48775
48885
  key: "item-".concat(section.id),
48776
- extraStyles: borderStyles,
48777
- role: "radio",
48778
- "aria-checked": openSection === section.id,
48779
- "aria-disabled": section.disabled,
48780
- "aria-required": section === null || section === void 0 ? void 0 : section.required
48886
+ extraStyles: borderStyles
48781
48887
  }, /*#__PURE__*/React__default.createElement(Stack, {
48782
48888
  childGap: "0"
48783
48889
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -48794,7 +48900,12 @@ var RadioSection = function RadioSection(_ref) {
48794
48900
  borderColor: themeValues.borderColor,
48795
48901
  borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
48796
48902
  extraStyles: !section.disabled ? "cursor: pointer;" : "",
48797
- dataQa: section.dataQa ? section.dataQa : section.id
48903
+ dataQa: section.dataQa ? section.dataQa : section.id,
48904
+ role: "radio",
48905
+ "aria-checked": openSection === section.id,
48906
+ "aria-disabled": section.disabled,
48907
+ "aria-required": section === null || section === void 0 ? void 0 : section.required,
48908
+ tabIndex: "0"
48798
48909
  }, /*#__PURE__*/React__default.createElement(Cluster, {
48799
48910
  justify: "space-between",
48800
48911
  align: "center",