@thecb/components 9.3.1-beta.6 → 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.cjs.js +112 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +112 -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 +152 -182
- package/src/components/molecules/radio-section/RadioSection.stories.js +21 -39
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,10 @@ 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
|
-
|
|
48693
|
+
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire;
|
|
48694
|
+
console.log("sections", sections);
|
|
48695
|
+
var areSectionsGrouped = typeof (sections === null || sections === void 0 ? void 0 : (_sections$ = sections[0]) === null || _sections$ === void 0 ? void 0 : _sections$[0]) !== "undefined";
|
|
48696
|
+
console.log("areSectionsGrouped", areSectionsGrouped);
|
|
48697
48697
|
|
|
48698
48698
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48699
48699
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
@@ -48742,16 +48742,6 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48742
48742
|
focused = _useState2[0],
|
|
48743
48743
|
setFocused = _useState2[1];
|
|
48744
48744
|
|
|
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
48745
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48756
48746
|
padding: "1px",
|
|
48757
48747
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
@@ -48759,112 +48749,10 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48759
48749
|
extraStyles: containerStyles
|
|
48760
48750
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48761
48751
|
childGap: "0",
|
|
48762
|
-
tabIndex: "0",
|
|
48763
48752
|
role: "radiogroup",
|
|
48764
48753
|
"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;
|
|
48754
|
+
}, !areSectionsGrouped && sections.filter(function (section) {
|
|
48755
|
+
return !section.hidden;
|
|
48868
48756
|
}).map(function (section) {
|
|
48869
48757
|
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48870
48758
|
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
@@ -48880,9 +48768,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48880
48768
|
hoverStyles: themeValues.focusStyles,
|
|
48881
48769
|
animate: openSection === section.id ? "open" : "closed",
|
|
48882
48770
|
initial: initiallyOpen ? "open" : "closed",
|
|
48883
|
-
key: "item-".concat(section
|
|
48771
|
+
key: "item-".concat(sections.indexOf(section)),
|
|
48884
48772
|
extraStyles: borderStyles,
|
|
48885
|
-
dataQa: section.dataQa ? section.dataQa : section.id,
|
|
48886
48773
|
role: "radio",
|
|
48887
48774
|
"aria-checked": openSection === section.id,
|
|
48888
48775
|
"aria-disabled": section.disabled,
|
|
@@ -48902,7 +48789,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48902
48789
|
borderSize: "0px",
|
|
48903
48790
|
borderColor: themeValues.borderColor,
|
|
48904
48791
|
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48905
|
-
extraStyles: !section.disabled ? "cursor: pointer;" : ""
|
|
48792
|
+
extraStyles: !section.disabled ? "cursor: pointer;" : "",
|
|
48793
|
+
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48906
48794
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48907
48795
|
justify: "space-between",
|
|
48908
48796
|
align: "center",
|
|
@@ -48923,6 +48811,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48923
48811
|
toggleRadio: section.disabled ? noop : function () {
|
|
48924
48812
|
return toggleOpenSection(section.id);
|
|
48925
48813
|
},
|
|
48814
|
+
tabIndex: "-1",
|
|
48926
48815
|
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48927
48816
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48928
48817
|
align: "center"
|
|
@@ -48958,6 +48847,104 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48958
48847
|
variants: wrapper,
|
|
48959
48848
|
extraStyles: "transform-origin: 100% 0;"
|
|
48960
48849
|
}, section.content))));
|
|
48850
|
+
}), areSectionsGrouped && sections.map(function (sectionGroup) {
|
|
48851
|
+
return sectionGroup.filter(function (section) {
|
|
48852
|
+
return !section.hidden;
|
|
48853
|
+
}).map(function (section) {
|
|
48854
|
+
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48855
|
+
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48856
|
+
onKeyDown: function onKeyDown(e) {
|
|
48857
|
+
return !section.disabled && handleKeyDown(section.id, e);
|
|
48858
|
+
},
|
|
48859
|
+
onFocus: function onFocus() {
|
|
48860
|
+
return !section.disabled && setFocused(section.id);
|
|
48861
|
+
},
|
|
48862
|
+
onBlur: function onBlur() {
|
|
48863
|
+
return !section.disabled && setFocused(null);
|
|
48864
|
+
},
|
|
48865
|
+
hoverStyles: themeValues.focusStyles,
|
|
48866
|
+
animate: openSection === section.id ? "open" : "closed",
|
|
48867
|
+
initial: initiallyOpen ? "open" : "closed",
|
|
48868
|
+
key: "item-".concat(sections.indexOf(sectionGroup), "-").concat(sectionGroup.indexOf(section)),
|
|
48869
|
+
extraStyles: borderStyles,
|
|
48870
|
+
role: "radio",
|
|
48871
|
+
"aria-checked": openSection === section.id,
|
|
48872
|
+
"aria-disabled": section.disabled,
|
|
48873
|
+
"aria-required": section === null || section === void 0 ? void 0 : section.required
|
|
48874
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48875
|
+
childGap: "0"
|
|
48876
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
48877
|
+
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48878
|
+
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48879
|
+
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48880
|
+
return toggleOpenSection(section.id);
|
|
48881
|
+
},
|
|
48882
|
+
onTouchEnd: isMobile && supportsTouch && !section.disabled ? function () {
|
|
48883
|
+
return toggleOpenSection(section.id);
|
|
48884
|
+
} : noop,
|
|
48885
|
+
key: "header-".concat(section.id),
|
|
48886
|
+
borderSize: "0px",
|
|
48887
|
+
borderColor: themeValues.borderColor,
|
|
48888
|
+
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48889
|
+
extraStyles: !section.disabled ? "cursor: pointer;" : "",
|
|
48890
|
+
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48891
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48892
|
+
justify: "space-between",
|
|
48893
|
+
align: "center",
|
|
48894
|
+
childGap: "1px",
|
|
48895
|
+
nowrap: true
|
|
48896
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48897
|
+
justify: "flex-start",
|
|
48898
|
+
align: "center",
|
|
48899
|
+
nowrap: true
|
|
48900
|
+
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48901
|
+
padding: "0"
|
|
48902
|
+
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48903
|
+
id: "radio-input-".concat(idString(section)),
|
|
48904
|
+
name: idString(section),
|
|
48905
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
48906
|
+
radioOn: openSection === section.id,
|
|
48907
|
+
radioFocused: focused === section.id,
|
|
48908
|
+
toggleRadio: section.disabled ? noop : function () {
|
|
48909
|
+
return toggleOpenSection(section.id);
|
|
48910
|
+
},
|
|
48911
|
+
tabIndex: "-1",
|
|
48912
|
+
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48913
|
+
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48914
|
+
align: "center"
|
|
48915
|
+
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
48916
|
+
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48917
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48918
|
+
as: "label",
|
|
48919
|
+
htmlFor: "radio-input-".concat(idString(section)),
|
|
48920
|
+
color: CHARADE_GREY
|
|
48921
|
+
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48922
|
+
childGap: "0.5rem",
|
|
48923
|
+
"aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
|
|
48924
|
+
role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
|
|
48925
|
+
}, section.rightIcons.map(function (icon) {
|
|
48926
|
+
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48927
|
+
src: icon.img,
|
|
48928
|
+
key: icon.img,
|
|
48929
|
+
fade: !icon.enabled,
|
|
48930
|
+
isMobile: isMobile,
|
|
48931
|
+
alt: icon.altText,
|
|
48932
|
+
"aria-disabled": !icon.enabled
|
|
48933
|
+
});
|
|
48934
|
+
})), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48935
|
+
initial: false
|
|
48936
|
+
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
48937
|
+
key: "content-".concat(section.id),
|
|
48938
|
+
padding: "0",
|
|
48939
|
+
background: themeValues.bodyBackgroundColor,
|
|
48940
|
+
layoutTransition: true,
|
|
48941
|
+
initial: "closed",
|
|
48942
|
+
animate: "open",
|
|
48943
|
+
exit: "closed",
|
|
48944
|
+
variants: wrapper,
|
|
48945
|
+
extraStyles: "transform-origin: 100% 0;"
|
|
48946
|
+
}, section.content))));
|
|
48947
|
+
});
|
|
48961
48948
|
})));
|
|
48962
48949
|
};
|
|
48963
48950
|
|