@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.cjs.js +110 -129
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +110 -129
- 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 +150 -186
- package/src/components/molecules/radio-section/RadioSection.stories.js +21 -25
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,10 +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
|
-
|
|
48697
|
-
|
|
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);
|
|
48698
48697
|
|
|
48699
48698
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48700
48699
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
@@ -48743,16 +48742,6 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48743
48742
|
focused = _useState2[0],
|
|
48744
48743
|
setFocused = _useState2[1];
|
|
48745
48744
|
|
|
48746
|
-
var PrependedItem = function PrependedItem(_ref5) {
|
|
48747
|
-
var themeValues = _ref5.themeValues;
|
|
48748
|
-
return /*#__PURE__*/React__default.createElement(SolidDivider$1, {
|
|
48749
|
-
borderSize: "2px",
|
|
48750
|
-
borderRadius: "0 0 0 0",
|
|
48751
|
-
color: themeValues.borderColor,
|
|
48752
|
-
extraStyles: "margin-left: -1px; margin-right: -1px; width: cacl(100% + 2px);"
|
|
48753
|
-
});
|
|
48754
|
-
};
|
|
48755
|
-
|
|
48756
48745
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48757
48746
|
padding: "1px",
|
|
48758
48747
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
@@ -48760,111 +48749,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48760
48749
|
extraStyles: containerStyles
|
|
48761
48750
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48762
48751
|
childGap: "0",
|
|
48763
|
-
tabIndex: "0",
|
|
48764
48752
|
role: "radiogroup",
|
|
48765
48753
|
"aria-required": isSectionRequired
|
|
48766
|
-
},
|
|
48767
|
-
return /*#__PURE__*/React__default.createElement(React.Fragment, {
|
|
48768
|
-
key: "sectiongroup-".concat(sectionGroups.indexOf(sectionGroup))
|
|
48769
|
-
}, sectionGroups.indexOf(sectionGroup) !== 0 ? /*#__PURE__*/React__default.createElement(PrependedItem, {
|
|
48770
|
-
themeValues: themeValues
|
|
48771
|
-
}) : "", sectionGroup.filter(function (unfilteredSection) {
|
|
48772
|
-
return !unfilteredSection.hidden;
|
|
48773
|
-
}).map(function (section) {
|
|
48774
|
-
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48775
|
-
tabIndex: section.hidden || section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48776
|
-
onKeyDown: function onKeyDown(e) {
|
|
48777
|
-
return !section.disabled && handleKeyDown(section.id, e);
|
|
48778
|
-
},
|
|
48779
|
-
onFocus: function onFocus() {
|
|
48780
|
-
return !section.disabled && setFocused(section.id);
|
|
48781
|
-
},
|
|
48782
|
-
onBlur: function onBlur() {
|
|
48783
|
-
return !section.disabled && setFocused(null);
|
|
48784
|
-
},
|
|
48785
|
-
hoverStyles: themeValues.focusStyles,
|
|
48786
|
-
animate: openSection === section.id ? "open" : "closed",
|
|
48787
|
-
initial: initiallyOpen ? "open" : "closed",
|
|
48788
|
-
key: "item-".concat(section.id),
|
|
48789
|
-
extraStyles: borderStyles,
|
|
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
|
-
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48811
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48812
|
-
justify: "space-between",
|
|
48813
|
-
align: "center",
|
|
48814
|
-
childGap: "1px",
|
|
48815
|
-
nowrap: true
|
|
48816
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48817
|
-
justify: "flex-start",
|
|
48818
|
-
align: "center",
|
|
48819
|
-
nowrap: true
|
|
48820
|
-
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48821
|
-
padding: "0"
|
|
48822
|
-
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48823
|
-
id: "radio-input-".concat(idString(section)),
|
|
48824
|
-
name: idString(section),
|
|
48825
|
-
ariaDescribedBy: ariaDescribedBy,
|
|
48826
|
-
radioOn: openSection === section.id,
|
|
48827
|
-
radioFocused: focused === section.id,
|
|
48828
|
-
toggleRadio: section.disabled ? noop : function () {
|
|
48829
|
-
return toggleOpenSection(section.id);
|
|
48830
|
-
},
|
|
48831
|
-
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48832
|
-
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48833
|
-
align: "center"
|
|
48834
|
-
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
48835
|
-
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48836
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48837
|
-
as: "label",
|
|
48838
|
-
htmlFor: "radio-input-".concat(idString(section)),
|
|
48839
|
-
color: CHARADE_GREY
|
|
48840
|
-
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48841
|
-
childGap: "0.5rem",
|
|
48842
|
-
"aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
|
|
48843
|
-
role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
|
|
48844
|
-
}, section.rightIcons.map(function (icon) {
|
|
48845
|
-
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48846
|
-
src: icon.img,
|
|
48847
|
-
key: icon.img,
|
|
48848
|
-
fade: !icon.enabled,
|
|
48849
|
-
isMobile: isMobile,
|
|
48850
|
-
alt: icon.altText,
|
|
48851
|
-
"aria-disabled": !icon.enabled
|
|
48852
|
-
});
|
|
48853
|
-
})), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48854
|
-
initial: false
|
|
48855
|
-
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
48856
|
-
key: "content-".concat(section.id),
|
|
48857
|
-
padding: "0",
|
|
48858
|
-
background: themeValues.bodyBackgroundColor,
|
|
48859
|
-
layoutTransition: true,
|
|
48860
|
-
initial: "closed",
|
|
48861
|
-
animate: "open",
|
|
48862
|
-
exit: "closed",
|
|
48863
|
-
variants: wrapper,
|
|
48864
|
-
extraStyles: "transform-origin: 100% 0;"
|
|
48865
|
-
}, section.content))));
|
|
48866
|
-
}));
|
|
48867
|
-
}), sections && sections.filter(function (section) {
|
|
48754
|
+
}, !areSectionsGrouped && sections.filter(function (section) {
|
|
48868
48755
|
return !section.hidden;
|
|
48869
48756
|
}).map(function (section) {
|
|
48870
48757
|
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
@@ -48881,7 +48768,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48881
48768
|
hoverStyles: themeValues.focusStyles,
|
|
48882
48769
|
animate: openSection === section.id ? "open" : "closed",
|
|
48883
48770
|
initial: initiallyOpen ? "open" : "closed",
|
|
48884
|
-
key: "item-".concat(section
|
|
48771
|
+
key: "item-".concat(sections.indexOf(section)),
|
|
48885
48772
|
extraStyles: borderStyles,
|
|
48886
48773
|
role: "radio",
|
|
48887
48774
|
"aria-checked": openSection === section.id,
|
|
@@ -48903,12 +48790,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48903
48790
|
borderColor: themeValues.borderColor,
|
|
48904
48791
|
borderWidthOverride: openSection === section.id && !!section.content ? "0px 0px 1px 0px" : "",
|
|
48905
48792
|
extraStyles: !section.disabled ? "cursor: pointer;" : "",
|
|
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"
|
|
48793
|
+
dataQa: section.dataQa ? section.dataQa : section.id
|
|
48912
48794
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48913
48795
|
justify: "space-between",
|
|
48914
48796
|
align: "center",
|
|
@@ -48929,6 +48811,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48929
48811
|
toggleRadio: section.disabled ? noop : function () {
|
|
48930
48812
|
return toggleOpenSection(section.id);
|
|
48931
48813
|
},
|
|
48814
|
+
tabIndex: "-1",
|
|
48932
48815
|
isRequired: section === null || section === void 0 ? void 0 : section.required
|
|
48933
48816
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48934
48817
|
align: "center"
|
|
@@ -48964,6 +48847,104 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48964
48847
|
variants: wrapper,
|
|
48965
48848
|
extraStyles: "transform-origin: 100% 0;"
|
|
48966
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
|
+
});
|
|
48967
48948
|
})));
|
|
48968
48949
|
};
|
|
48969
48950
|
|