@thecb/components 9.3.1-beta.6 → 9.3.1-beta.8
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 +113 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +113 -125
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/solid-divider/SolidDivider.js +1 -7
- package/src/components/molecules/radio-section/RadioSection.js +158 -182
- package/src/components/molecules/radio-section/RadioSection.stories.js +25 -41
package/dist/index.cjs.js
CHANGED
|
@@ -27577,17 +27577,14 @@ var fallbackValues$x = {
|
|
|
27577
27577
|
var SolidDivider = function SolidDivider(_ref) {
|
|
27578
27578
|
var borderColor = _ref.borderColor,
|
|
27579
27579
|
borderSize = _ref.borderSize,
|
|
27580
|
-
themeValues = _ref.themeValues
|
|
27581
|
-
_ref$extraStyles = _ref.extraStyles,
|
|
27582
|
-
extraStyles = _ref$extraStyles === void 0 ? "" : _ref$extraStyles;
|
|
27580
|
+
themeValues = _ref.themeValues;
|
|
27583
27581
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
27584
27582
|
padding: "0",
|
|
27585
27583
|
minWidth: "100%",
|
|
27586
27584
|
minHeight: "1px",
|
|
27587
27585
|
borderColor: borderColor || themeValues.borderColor,
|
|
27588
27586
|
borderSize: borderSize || themeValues.borderSize,
|
|
27589
|
-
borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px")
|
|
27590
|
-
extraStyles: extraStyles
|
|
27587
|
+
borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px")
|
|
27591
27588
|
});
|
|
27592
27589
|
};
|
|
27593
27590
|
|
|
@@ -48673,6 +48670,8 @@ var idString = function idString(section) {
|
|
|
48673
48670
|
};
|
|
48674
48671
|
|
|
48675
48672
|
var RadioSection = function RadioSection(_ref) {
|
|
48673
|
+
var _sections$;
|
|
48674
|
+
|
|
48676
48675
|
var themeValues = _ref.themeValues,
|
|
48677
48676
|
isMobile = _ref.isMobile,
|
|
48678
48677
|
supportsTouch = _ref.supportsTouch,
|
|
@@ -48691,9 +48690,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48691
48690
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48692
48691
|
ariaDescribedBy = _ref.ariaDescribedBy,
|
|
48693
48692
|
_ref$isSectionRequire = _ref.isSectionRequired,
|
|
48694
|
-
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire
|
|
48695
|
-
|
|
48696
|
-
sectionGroups = _ref$sectionGroups === void 0 ? null : _ref$sectionGroups;
|
|
48693
|
+
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire;
|
|
48694
|
+
var areSectionsGrouped = typeof (sections === null || sections === void 0 ? void 0 : (_sections$ = sections[0]) === null || _sections$ === void 0 ? void 0 : _sections$[0]) !== "undefined";
|
|
48697
48695
|
|
|
48698
48696
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48699
48697
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
@@ -48742,16 +48740,6 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48742
48740
|
focused = _useState2[0],
|
|
48743
48741
|
setFocused = _useState2[1];
|
|
48744
48742
|
|
|
48745
|
-
var PrependedItem = function PrependedItem(_ref5) {
|
|
48746
|
-
var themeValues = _ref5.themeValues;
|
|
48747
|
-
return /*#__PURE__*/React__default.createElement(SolidDivider$1, {
|
|
48748
|
-
borderSize: "2px",
|
|
48749
|
-
borderRadius: "0 0 0 0",
|
|
48750
|
-
color: themeValues.borderColor,
|
|
48751
|
-
extraStyles: "margin-left: -1px; margin-right: -1px; width: cacl(100% + 2px);"
|
|
48752
|
-
});
|
|
48753
|
-
};
|
|
48754
|
-
|
|
48755
48743
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48756
48744
|
padding: "1px",
|
|
48757
48745
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
@@ -48759,112 +48747,10 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48759
48747
|
extraStyles: containerStyles
|
|
48760
48748
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48761
48749
|
childGap: "0",
|
|
48762
|
-
tabIndex: "0",
|
|
48763
48750
|
role: "radiogroup",
|
|
48764
48751
|
"aria-required": isSectionRequired
|
|
48765
|
-
},
|
|
48766
|
-
return
|
|
48767
|
-
key: "sectiongroup-".concat(sectionGroups.indexOf(sectionGroup))
|
|
48768
|
-
}, sectionGroups.indexOf(sectionGroup) !== 0 ? /*#__PURE__*/React__default.createElement(PrependedItem, {
|
|
48769
|
-
themeValues: themeValues
|
|
48770
|
-
}) : "", sectionGroup.filter(function (unfilteredSection) {
|
|
48771
|
-
return !unfilteredSection.hidden;
|
|
48772
|
-
}).map(function (section) {
|
|
48773
|
-
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48774
|
-
tabIndex: section.hidden || section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48775
|
-
onKeyDown: function onKeyDown(e) {
|
|
48776
|
-
return !section.disabled && handleKeyDown(section.id, e);
|
|
48777
|
-
},
|
|
48778
|
-
onFocus: function onFocus() {
|
|
48779
|
-
return !section.disabled && setFocused(section.id);
|
|
48780
|
-
},
|
|
48781
|
-
onBlur: function onBlur() {
|
|
48782
|
-
return !section.disabled && setFocused(null);
|
|
48783
|
-
},
|
|
48784
|
-
hoverStyles: themeValues.focusStyles,
|
|
48785
|
-
animate: openSection === section.id ? "open" : "closed",
|
|
48786
|
-
initial: initiallyOpen ? "open" : "closed",
|
|
48787
|
-
key: "item-".concat(section.id),
|
|
48788
|
-
extraStyles: borderStyles,
|
|
48789
|
-
dataQa: section.dataQa,
|
|
48790
|
-
role: "radio",
|
|
48791
|
-
"aria-checked": openSection === section.id,
|
|
48792
|
-
"aria-disabled": section.disabled,
|
|
48793
|
-
"aria-required": section === null || section === void 0 ? void 0 : section.required
|
|
48794
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48795
|
-
childGap: "0"
|
|
48796
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
48797
|
-
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48798
|
-
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48799
|
-
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48800
|
-
return toggleOpenSection(section.id);
|
|
48801
|
-
},
|
|
48802
|
-
onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
|
|
48803
|
-
return toggleOpenSection(section.id);
|
|
48804
|
-
} : noop,
|
|
48805
|
-
key: "header-".concat(section.id),
|
|
48806
|
-
borderSize: "0px",
|
|
48807
|
-
borderColor: themeValues.borderColor,
|
|
48808
|
-
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48809
|
-
extraStyles: !section.disabled ? "cursor: pointer;" : ""
|
|
48810
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48811
|
-
justify: "space-between",
|
|
48812
|
-
align: "center",
|
|
48813
|
-
childGap: "1px",
|
|
48814
|
-
nowrap: true
|
|
48815
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48816
|
-
justify: "flex-start",
|
|
48817
|
-
align: "center",
|
|
48818
|
-
nowrap: true
|
|
48819
|
-
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48820
|
-
padding: "0"
|
|
48821
|
-
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48822
|
-
id: "radio-input-".concat(idString(section)),
|
|
48823
|
-
name: idString(section),
|
|
48824
|
-
ariaDescribedBy: ariaDescribedBy,
|
|
48825
|
-
radioOn: openSection === section.id,
|
|
48826
|
-
radioFocused: focused === section.id,
|
|
48827
|
-
toggleRadio: section.disabled ? noop : function () {
|
|
48828
|
-
return toggleOpenSection(section.id);
|
|
48829
|
-
},
|
|
48830
|
-
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48831
|
-
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48832
|
-
align: "center"
|
|
48833
|
-
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
48834
|
-
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48835
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48836
|
-
as: "label",
|
|
48837
|
-
htmlFor: "radio-input-".concat(idString(section)),
|
|
48838
|
-
color: CHARADE_GREY
|
|
48839
|
-
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48840
|
-
childGap: "0.5rem",
|
|
48841
|
-
"aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
|
|
48842
|
-
role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
|
|
48843
|
-
}, section.rightIcons.map(function (icon) {
|
|
48844
|
-
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48845
|
-
src: icon.img,
|
|
48846
|
-
key: icon.img,
|
|
48847
|
-
fade: !icon.enabled,
|
|
48848
|
-
isMobile: isMobile,
|
|
48849
|
-
alt: icon.altText,
|
|
48850
|
-
"aria-disabled": !icon.enabled
|
|
48851
|
-
});
|
|
48852
|
-
})), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48853
|
-
initial: false
|
|
48854
|
-
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
48855
|
-
key: "content-".concat(section.id),
|
|
48856
|
-
padding: "0",
|
|
48857
|
-
background: themeValues.bodyBackgroundColor,
|
|
48858
|
-
layoutTransition: true,
|
|
48859
|
-
initial: "closed",
|
|
48860
|
-
animate: "open",
|
|
48861
|
-
exit: "closed",
|
|
48862
|
-
variants: wrapper,
|
|
48863
|
-
extraStyles: "transform-origin: 100% 0;"
|
|
48864
|
-
}, section.content))));
|
|
48865
|
-
}));
|
|
48866
|
-
}), sections && sections.filter(function (unfilteredSection) {
|
|
48867
|
-
return !unfilteredSection.hidden;
|
|
48752
|
+
}, !areSectionsGrouped && sections.filter(function (section) {
|
|
48753
|
+
return !section.hidden;
|
|
48868
48754
|
}).map(function (section) {
|
|
48869
48755
|
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48870
48756
|
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
@@ -48880,9 +48766,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48880
48766
|
hoverStyles: themeValues.focusStyles,
|
|
48881
48767
|
animate: openSection === section.id ? "open" : "closed",
|
|
48882
48768
|
initial: initiallyOpen ? "open" : "closed",
|
|
48883
|
-
key: "item-".concat(section
|
|
48769
|
+
key: "item-".concat(sections.indexOf(section)),
|
|
48884
48770
|
extraStyles: borderStyles,
|
|
48885
|
-
dataQa: section.dataQa ? section.dataQa : section.id,
|
|
48886
48771
|
role: "radio",
|
|
48887
48772
|
"aria-checked": openSection === section.id,
|
|
48888
48773
|
"aria-disabled": section.disabled,
|
|
@@ -48902,7 +48787,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48902
48787
|
borderSize: "0px",
|
|
48903
48788
|
borderColor: themeValues.borderColor,
|
|
48904
48789
|
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48905
|
-
extraStyles: !section.disabled ? "cursor: pointer;" : ""
|
|
48790
|
+
extraStyles: !section.disabled ? "cursor: pointer;" : "",
|
|
48791
|
+
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48906
48792
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48907
48793
|
justify: "space-between",
|
|
48908
48794
|
align: "center",
|
|
@@ -48923,6 +48809,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48923
48809
|
toggleRadio: section.disabled ? noop : function () {
|
|
48924
48810
|
return toggleOpenSection(section.id);
|
|
48925
48811
|
},
|
|
48812
|
+
tabIndex: "-1",
|
|
48926
48813
|
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48927
48814
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48928
48815
|
align: "center"
|
|
@@ -48958,6 +48845,107 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48958
48845
|
variants: wrapper,
|
|
48959
48846
|
extraStyles: "transform-origin: 100% 0;"
|
|
48960
48847
|
}, section.content))));
|
|
48848
|
+
}), areSectionsGrouped && sections.map(function (sectionGroup) {
|
|
48849
|
+
return sectionGroup.filter(function (section) {
|
|
48850
|
+
return !section.hidden;
|
|
48851
|
+
}).map(function (section) {
|
|
48852
|
+
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48853
|
+
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48854
|
+
onKeyDown: function onKeyDown(e) {
|
|
48855
|
+
return !section.disabled && handleKeyDown(section.id, e);
|
|
48856
|
+
},
|
|
48857
|
+
onFocus: function onFocus() {
|
|
48858
|
+
return !section.disabled && setFocused(section.id);
|
|
48859
|
+
},
|
|
48860
|
+
onBlur: function onBlur() {
|
|
48861
|
+
return !section.disabled && setFocused(null);
|
|
48862
|
+
},
|
|
48863
|
+
hoverStyles: themeValues.focusStyles,
|
|
48864
|
+
animate: openSection === section.id ? "open" : "closed",
|
|
48865
|
+
initial: initiallyOpen ? "open" : "closed",
|
|
48866
|
+
key: "item-".concat(sections.indexOf(sectionGroup), "-").concat(sectionGroup.indexOf(section)),
|
|
48867
|
+
extraStyles: borderStyles,
|
|
48868
|
+
role: "radio",
|
|
48869
|
+
"aria-checked": openSection === section.id,
|
|
48870
|
+
"aria-disabled": section.disabled,
|
|
48871
|
+
"aria-required": section === null || section === void 0 ? void 0 : section.required
|
|
48872
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48873
|
+
childGap: "0"
|
|
48874
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
48875
|
+
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48876
|
+
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48877
|
+
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48878
|
+
return toggleOpenSection(section.id);
|
|
48879
|
+
},
|
|
48880
|
+
onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
|
|
48881
|
+
return toggleOpenSection(section.id);
|
|
48882
|
+
} : noop,
|
|
48883
|
+
key: "header-".concat(section.id),
|
|
48884
|
+
borderSize: "0px",
|
|
48885
|
+
borderColor: themeValues.borderColor,
|
|
48886
|
+
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48887
|
+
extraStyles: !section.disabled ? "cursor: pointer;" : "",
|
|
48888
|
+
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48889
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48890
|
+
justify: "space-between",
|
|
48891
|
+
align: "center",
|
|
48892
|
+
childGap: "1px",
|
|
48893
|
+
nowrap: true
|
|
48894
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48895
|
+
justify: "flex-start",
|
|
48896
|
+
align: "center",
|
|
48897
|
+
nowrap: true
|
|
48898
|
+
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48899
|
+
padding: "0"
|
|
48900
|
+
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48901
|
+
id: "radio-input-".concat(idString(section)),
|
|
48902
|
+
name: idString(section),
|
|
48903
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
48904
|
+
radioOn: openSection === section.id,
|
|
48905
|
+
radioFocused: focused === section.id,
|
|
48906
|
+
toggleRadio: section.disabled ? noop : function () {
|
|
48907
|
+
return toggleOpenSection(section.id);
|
|
48908
|
+
},
|
|
48909
|
+
tabIndex: "-1",
|
|
48910
|
+
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48911
|
+
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48912
|
+
align: "center"
|
|
48913
|
+
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
48914
|
+
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48915
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48916
|
+
as: "label",
|
|
48917
|
+
htmlFor: "radio-input-".concat(idString(section)),
|
|
48918
|
+
color: CHARADE_GREY
|
|
48919
|
+
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48920
|
+
childGap: "0.5rem",
|
|
48921
|
+
"aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
|
|
48922
|
+
role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
|
|
48923
|
+
}, section.rightIcons.map(function (icon) {
|
|
48924
|
+
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48925
|
+
src: icon.img,
|
|
48926
|
+
key: icon.img,
|
|
48927
|
+
fade: !icon.enabled,
|
|
48928
|
+
isMobile: isMobile,
|
|
48929
|
+
alt: icon.altText,
|
|
48930
|
+
"aria-disabled": !icon.enabled
|
|
48931
|
+
});
|
|
48932
|
+
})), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48933
|
+
initial: false
|
|
48934
|
+
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
48935
|
+
key: "content-".concat(section.id),
|
|
48936
|
+
padding: "0",
|
|
48937
|
+
background: themeValues.bodyBackgroundColor,
|
|
48938
|
+
layoutTransition: true,
|
|
48939
|
+
initial: "closed",
|
|
48940
|
+
animate: "open",
|
|
48941
|
+
exit: "closed",
|
|
48942
|
+
variants: wrapper,
|
|
48943
|
+
extraStyles: "transform-origin: 100% 0;"
|
|
48944
|
+
}, section.content))), sectionGroup.indexOf(section) === sectionGroup.length - 1 && /*#__PURE__*/React__default.createElement(SolidDivider$1, {
|
|
48945
|
+
borderSize: "2px",
|
|
48946
|
+
borderColor: themeValues.borderColor
|
|
48947
|
+
}));
|
|
48948
|
+
});
|
|
48961
48949
|
})));
|
|
48962
48950
|
};
|
|
48963
48951
|
|