@thecb/components 9.3.1-beta.5 → 9.3.1-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -27569,17 +27569,14 @@ var fallbackValues$x = {
27569
27569
  var SolidDivider = function SolidDivider(_ref) {
27570
27570
  var borderColor = _ref.borderColor,
27571
27571
  borderSize = _ref.borderSize,
27572
- themeValues = _ref.themeValues,
27573
- _ref$extraStyles = _ref.extraStyles,
27574
- extraStyles = _ref$extraStyles === void 0 ? "" : _ref$extraStyles;
27572
+ themeValues = _ref.themeValues;
27575
27573
  return /*#__PURE__*/React.createElement(Box, {
27576
27574
  padding: "0",
27577
27575
  minWidth: "100%",
27578
27576
  minHeight: "1px",
27579
27577
  borderColor: borderColor || themeValues.borderColor,
27580
27578
  borderSize: borderSize || themeValues.borderSize,
27581
- borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px"),
27582
- extraStyles: extraStyles
27579
+ borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px")
27583
27580
  });
27584
27581
  };
27585
27582
 
@@ -48665,6 +48662,8 @@ var idString = function idString(section) {
48665
48662
  };
48666
48663
 
48667
48664
  var RadioSection = function RadioSection(_ref) {
48665
+ var _sections$;
48666
+
48668
48667
  var themeValues = _ref.themeValues,
48669
48668
  isMobile = _ref.isMobile,
48670
48669
  supportsTouch = _ref.supportsTouch,
@@ -48683,10 +48682,10 @@ var RadioSection = function RadioSection(_ref) {
48683
48682
  containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
48684
48683
  ariaDescribedBy = _ref.ariaDescribedBy,
48685
48684
  _ref$isSectionRequire = _ref.isSectionRequired,
48686
- isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
48687
- _ref$legendText = _ref.legendText,
48688
- _ref$sectionGroups = _ref.sectionGroups,
48689
- sectionGroups = _ref$sectionGroups === void 0 ? null : _ref$sectionGroups;
48685
+ isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire;
48686
+ console.log("sections", sections);
48687
+ var areSectionsGrouped = typeof (sections === null || sections === void 0 ? void 0 : (_sections$ = sections[0]) === null || _sections$ === void 0 ? void 0 : _sections$[0]) !== "undefined";
48688
+ console.log("areSectionsGrouped", areSectionsGrouped);
48690
48689
 
48691
48690
  var handleKeyDown = function handleKeyDown(id, e) {
48692
48691
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
@@ -48735,16 +48734,6 @@ var RadioSection = function RadioSection(_ref) {
48735
48734
  focused = _useState2[0],
48736
48735
  setFocused = _useState2[1];
48737
48736
 
48738
- var PrependedItem = function PrependedItem(_ref5) {
48739
- var themeValues = _ref5.themeValues;
48740
- return /*#__PURE__*/React.createElement(SolidDivider$1, {
48741
- borderSize: "2px",
48742
- borderRadius: "0 0 0 0",
48743
- color: themeValues.borderColor,
48744
- extraStyles: "margin-left: -1px; margin-right: -1px; width: cacl(100% + 2px);"
48745
- });
48746
- };
48747
-
48748
48737
  return /*#__PURE__*/React.createElement(Box, {
48749
48738
  padding: "1px",
48750
48739
  border: "1px solid ".concat(themeValues.borderColor),
@@ -48752,111 +48741,9 @@ var RadioSection = function RadioSection(_ref) {
48752
48741
  extraStyles: containerStyles
48753
48742
  }, /*#__PURE__*/React.createElement(Stack, {
48754
48743
  childGap: "0",
48755
- tabIndex: "0",
48756
48744
  role: "radiogroup",
48757
48745
  "aria-required": isSectionRequired
48758
- }, sectionGroups && sectionGroups.map(function (sectionGroup) {
48759
- return /*#__PURE__*/React.createElement(Fragment$1, {
48760
- key: "sectiongroup-".concat(sectionGroups.indexOf(sectionGroup))
48761
- }, sectionGroups.indexOf(sectionGroup) !== 0 ? /*#__PURE__*/React.createElement(PrependedItem, {
48762
- themeValues: themeValues
48763
- }) : "", sectionGroup.filter(function (unfilteredSection) {
48764
- return !unfilteredSection.hidden;
48765
- }).map(function (section) {
48766
- return /*#__PURE__*/React.createElement(Motion, {
48767
- tabIndex: section.hidden || section.hideRadioButton || section.disabled ? "-1" : "0",
48768
- onKeyDown: function onKeyDown(e) {
48769
- return !section.disabled && handleKeyDown(section.id, e);
48770
- },
48771
- onFocus: function onFocus() {
48772
- return !section.disabled && setFocused(section.id);
48773
- },
48774
- onBlur: function onBlur() {
48775
- return !section.disabled && setFocused(null);
48776
- },
48777
- hoverStyles: themeValues.focusStyles,
48778
- animate: openSection === section.id ? "open" : "closed",
48779
- initial: initiallyOpen ? "open" : "closed",
48780
- key: "item-".concat(section.id),
48781
- extraStyles: borderStyles,
48782
- role: "radio",
48783
- "aria-checked": openSection === section.id,
48784
- "aria-disabled": section.disabled,
48785
- "aria-required": section === null || section === void 0 ? void 0 : section.required
48786
- }, /*#__PURE__*/React.createElement(Stack, {
48787
- childGap: "0"
48788
- }, /*#__PURE__*/React.createElement(Box, {
48789
- padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
48790
- background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
48791
- onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
48792
- return toggleOpenSection(section.id);
48793
- },
48794
- onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
48795
- return toggleOpenSection(section.id);
48796
- } : noop,
48797
- key: "header-".concat(section.id),
48798
- borderSize: "0px",
48799
- borderColor: themeValues.borderColor,
48800
- borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
48801
- extraStyles: !section.disabled ? "cursor: pointer;" : "",
48802
- dataQa: section.dataQa ? section.dataQa : section.id
48803
- }, /*#__PURE__*/React.createElement(Cluster, {
48804
- justify: "space-between",
48805
- align: "center",
48806
- childGap: "1px",
48807
- nowrap: true
48808
- }, /*#__PURE__*/React.createElement(Cluster, {
48809
- justify: "flex-start",
48810
- align: "center",
48811
- nowrap: true
48812
- }, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
48813
- padding: "0"
48814
- }, /*#__PURE__*/React.createElement(RadioButton$2, {
48815
- id: "radio-input-".concat(idString(section)),
48816
- name: idString(section),
48817
- ariaDescribedBy: ariaDescribedBy,
48818
- radioOn: openSection === section.id,
48819
- radioFocused: focused === section.id,
48820
- toggleRadio: section.disabled ? noop : function () {
48821
- return toggleOpenSection(section.id);
48822
- },
48823
- isRequired: section === null || section === void 0 ? void 0 : section.required
48824
- })), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
48825
- align: "center"
48826
- }, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
48827
- padding: section.titleIcon ? "0 0 0 8px" : "0"
48828
- }, /*#__PURE__*/React.createElement(Text$1, {
48829
- as: "label",
48830
- htmlFor: "radio-input-".concat(idString(section)),
48831
- color: CHARADE_GREY
48832
- }, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
48833
- childGap: "0.5rem",
48834
- "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
48835
- role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
48836
- }, section.rightIcons.map(function (icon) {
48837
- return /*#__PURE__*/React.createElement(RightIcon, {
48838
- src: icon.img,
48839
- key: icon.img,
48840
- fade: !icon.enabled,
48841
- isMobile: isMobile,
48842
- alt: icon.altText,
48843
- "aria-disabled": !icon.enabled
48844
- });
48845
- })), section.rightTitleContent && /*#__PURE__*/React.createElement(Fragment$1, null, section.rightTitleContent))), /*#__PURE__*/React.createElement(AnimatePresence, {
48846
- initial: false
48847
- }, openSection === section.id && /*#__PURE__*/React.createElement(Motion, {
48848
- key: "content-".concat(section.id),
48849
- padding: "0",
48850
- background: themeValues.bodyBackgroundColor,
48851
- layoutTransition: true,
48852
- initial: "closed",
48853
- animate: "open",
48854
- exit: "closed",
48855
- variants: wrapper,
48856
- extraStyles: "transform-origin: 100% 0;"
48857
- }, section.content))));
48858
- }));
48859
- }), sections && sections.filter(function (section) {
48746
+ }, !areSectionsGrouped && sections.filter(function (section) {
48860
48747
  return !section.hidden;
48861
48748
  }).map(function (section) {
48862
48749
  return /*#__PURE__*/React.createElement(Motion, {
@@ -48873,7 +48760,7 @@ var RadioSection = function RadioSection(_ref) {
48873
48760
  hoverStyles: themeValues.focusStyles,
48874
48761
  animate: openSection === section.id ? "open" : "closed",
48875
48762
  initial: initiallyOpen ? "open" : "closed",
48876
- key: "item-".concat(section.id),
48763
+ key: "item-".concat(sections.indexOf(section)),
48877
48764
  extraStyles: borderStyles,
48878
48765
  role: "radio",
48879
48766
  "aria-checked": openSection === section.id,
@@ -48895,12 +48782,7 @@ var RadioSection = function RadioSection(_ref) {
48895
48782
  borderColor: themeValues.borderColor,
48896
48783
  borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
48897
48784
  extraStyles: !section.disabled ? "cursor: pointer;" : "",
48898
- dataQa: section.dataQa ? section.dataQa : section.id,
48899
- role: "radio",
48900
- "aria-checked": openSection === section.id,
48901
- "aria-disabled": section.disabled,
48902
- "aria-required": section === null || section === void 0 ? void 0 : section.required,
48903
- tabIndex: "0"
48785
+ dataQa: section.dataQa ? section.dataQa : section.id
48904
48786
  }, /*#__PURE__*/React.createElement(Cluster, {
48905
48787
  justify: "space-between",
48906
48788
  align: "center",
@@ -48921,6 +48803,7 @@ var RadioSection = function RadioSection(_ref) {
48921
48803
  toggleRadio: section.disabled ? noop : function () {
48922
48804
  return toggleOpenSection(section.id);
48923
48805
  },
48806
+ tabIndex: "-1",
48924
48807
  isRequired: section === null || section === void 0 ? void 0 : section.required
48925
48808
  })), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
48926
48809
  align: "center"
@@ -48956,6 +48839,104 @@ var RadioSection = function RadioSection(_ref) {
48956
48839
  variants: wrapper,
48957
48840
  extraStyles: "transform-origin: 100% 0;"
48958
48841
  }, section.content))));
48842
+ }), areSectionsGrouped && sections.map(function (sectionGroup) {
48843
+ return sectionGroup.filter(function (section) {
48844
+ return !section.hidden;
48845
+ }).map(function (section) {
48846
+ return /*#__PURE__*/React.createElement(Motion, {
48847
+ tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
48848
+ onKeyDown: function onKeyDown(e) {
48849
+ return !section.disabled && handleKeyDown(section.id, e);
48850
+ },
48851
+ onFocus: function onFocus() {
48852
+ return !section.disabled && setFocused(section.id);
48853
+ },
48854
+ onBlur: function onBlur() {
48855
+ return !section.disabled && setFocused(null);
48856
+ },
48857
+ hoverStyles: themeValues.focusStyles,
48858
+ animate: openSection === section.id ? "open" : "closed",
48859
+ initial: initiallyOpen ? "open" : "closed",
48860
+ key: "item-".concat(sections.indexOf(sectionGroup), "-").concat(sectionGroup.indexOf(section)),
48861
+ extraStyles: borderStyles,
48862
+ role: "radio",
48863
+ "aria-checked": openSection === section.id,
48864
+ "aria-disabled": section.disabled,
48865
+ "aria-required": section === null || section === void 0 ? void 0 : section.required
48866
+ }, /*#__PURE__*/React.createElement(Stack, {
48867
+ childGap: "0"
48868
+ }, /*#__PURE__*/React.createElement(Box, {
48869
+ padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
48870
+ background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
48871
+ onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
48872
+ return toggleOpenSection(section.id);
48873
+ },
48874
+ onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
48875
+ return toggleOpenSection(section.id);
48876
+ } : noop,
48877
+ key: "header-".concat(section.id),
48878
+ borderSize: "0px",
48879
+ borderColor: themeValues.borderColor,
48880
+ borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
48881
+ extraStyles: !section.disabled ? "cursor: pointer;" : "",
48882
+ dataQa: section.dataQa ? section.dataQa : section.id
48883
+ }, /*#__PURE__*/React.createElement(Cluster, {
48884
+ justify: "space-between",
48885
+ align: "center",
48886
+ childGap: "1px",
48887
+ nowrap: true
48888
+ }, /*#__PURE__*/React.createElement(Cluster, {
48889
+ justify: "flex-start",
48890
+ align: "center",
48891
+ nowrap: true
48892
+ }, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
48893
+ padding: "0"
48894
+ }, /*#__PURE__*/React.createElement(RadioButton$2, {
48895
+ id: "radio-input-".concat(idString(section)),
48896
+ name: idString(section),
48897
+ ariaDescribedBy: ariaDescribedBy,
48898
+ radioOn: openSection === section.id,
48899
+ radioFocused: focused === section.id,
48900
+ toggleRadio: section.disabled ? noop : function () {
48901
+ return toggleOpenSection(section.id);
48902
+ },
48903
+ tabIndex: "-1",
48904
+ isRequired: section === null || section === void 0 ? void 0 : section.required
48905
+ })), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
48906
+ align: "center"
48907
+ }, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
48908
+ padding: section.titleIcon ? "0 0 0 8px" : "0"
48909
+ }, /*#__PURE__*/React.createElement(Text$1, {
48910
+ as: "label",
48911
+ htmlFor: "radio-input-".concat(idString(section)),
48912
+ color: CHARADE_GREY
48913
+ }, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
48914
+ childGap: "0.5rem",
48915
+ "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
48916
+ role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
48917
+ }, section.rightIcons.map(function (icon) {
48918
+ return /*#__PURE__*/React.createElement(RightIcon, {
48919
+ src: icon.img,
48920
+ key: icon.img,
48921
+ fade: !icon.enabled,
48922
+ isMobile: isMobile,
48923
+ alt: icon.altText,
48924
+ "aria-disabled": !icon.enabled
48925
+ });
48926
+ })), section.rightTitleContent && /*#__PURE__*/React.createElement(Fragment$1, null, section.rightTitleContent))), /*#__PURE__*/React.createElement(AnimatePresence, {
48927
+ initial: false
48928
+ }, openSection === section.id && /*#__PURE__*/React.createElement(Motion, {
48929
+ key: "content-".concat(section.id),
48930
+ padding: "0",
48931
+ background: themeValues.bodyBackgroundColor,
48932
+ layoutTransition: true,
48933
+ initial: "closed",
48934
+ animate: "open",
48935
+ exit: "closed",
48936
+ variants: wrapper,
48937
+ extraStyles: "transform-origin: 100% 0;"
48938
+ }, section.content))));
48939
+ });
48959
48940
  })));
48960
48941
  };
48961
48942