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

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