@thecb/components 7.10.1-beta.1 → 7.10.1-beta.10
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 +58 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +58 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/radio-section/RadioSection.js +11 -6
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +2 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +9 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +2 -5
- package/src/util/useScrollTo.js +22 -0
package/dist/index.esm.js
CHANGED
|
@@ -26053,6 +26053,8 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
26053
26053
|
name = _ref2.name,
|
|
26054
26054
|
_ref2$disabled = _ref2.disabled,
|
|
26055
26055
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
26056
|
+
_ref2$ariaDescribedBy = _ref2.ariaDescribedBy,
|
|
26057
|
+
ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
|
|
26056
26058
|
themeValues = _ref2.themeValues;
|
|
26057
26059
|
var buttonBorder = {
|
|
26058
26060
|
onFocused: {
|
|
@@ -26104,6 +26106,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
26104
26106
|
"aria-label": name,
|
|
26105
26107
|
disabled: disabled,
|
|
26106
26108
|
onClick: toggleRadio,
|
|
26109
|
+
"aria-describedby": ariaDescribedBy,
|
|
26107
26110
|
tabIndex: "-1"
|
|
26108
26111
|
}), /*#__PURE__*/React.createElement(Motion, {
|
|
26109
26112
|
borderWidth: "1px",
|
|
@@ -47222,9 +47225,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47222
47225
|
background: themeValues.backgroundColor,
|
|
47223
47226
|
border: "1px solid ".concat(themeValues.border),
|
|
47224
47227
|
borderRadius: "3px",
|
|
47225
|
-
extraStyles: "overflow: scroll; max-height: 20rem;"
|
|
47228
|
+
extraStyles: "overflow: scroll; max-height: 20rem;",
|
|
47229
|
+
id: "terms-body-text"
|
|
47226
47230
|
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
47227
|
-
id: "terms-body-text",
|
|
47228
47231
|
variant: "p",
|
|
47229
47232
|
extraStyles: "& a { text-decoration: underline; }"
|
|
47230
47233
|
}, terms)),
|
|
@@ -47953,7 +47956,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
47953
47956
|
_ref$initiallyOpen = _ref.initiallyOpen,
|
|
47954
47957
|
initiallyOpen = _ref$initiallyOpen === void 0 ? true : _ref$initiallyOpen,
|
|
47955
47958
|
_ref$openHeight = _ref.openHeight,
|
|
47956
|
-
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight
|
|
47959
|
+
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
47960
|
+
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
47957
47961
|
|
|
47958
47962
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
47959
47963
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13) {
|
|
@@ -48030,7 +48034,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48030
48034
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48031
48035
|
childGap: "0"
|
|
48032
48036
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
48033
|
-
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem
|
|
48037
|
+
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48034
48038
|
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48035
48039
|
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48036
48040
|
return toggleOpenSection(section.id);
|
|
@@ -48047,7 +48051,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48047
48051
|
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
48048
48052
|
justify: "space-between",
|
|
48049
48053
|
align: "center",
|
|
48050
|
-
childGap: "0
|
|
48054
|
+
childGap: "0",
|
|
48051
48055
|
nowrap: true
|
|
48052
48056
|
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
48053
48057
|
justify: "flex-start",
|
|
@@ -48056,7 +48060,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48056
48060
|
}, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
|
|
48057
48061
|
padding: "0"
|
|
48058
48062
|
}, /*#__PURE__*/React.createElement(RadioButton$2, {
|
|
48059
|
-
name: section.id,
|
|
48063
|
+
name: typeof section.title === "string" ? createIdFromString(section.title) : section.id,
|
|
48064
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
48060
48065
|
radioOn: openSection === section.id,
|
|
48061
48066
|
radioFocused: focused === section.id,
|
|
48062
48067
|
toggleRadio: section.disabled ? noop : function () {
|
|
@@ -48621,6 +48626,43 @@ var generateShadows = function generateShadows(baseColorRGB) {
|
|
|
48621
48626
|
};
|
|
48622
48627
|
};
|
|
48623
48628
|
|
|
48629
|
+
/*
|
|
48630
|
+
Hook that takes an ID selector for an element on the screen
|
|
48631
|
+
And optionally values for top position, left position, smooth behavior
|
|
48632
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
48633
|
+
|
|
48634
|
+
(string, number, number, string, number) => undefined;
|
|
48635
|
+
*/
|
|
48636
|
+
var useScrollTo = function useScrollTo(id) {
|
|
48637
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48638
|
+
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48639
|
+
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48640
|
+
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48641
|
+
var scrollItem;
|
|
48642
|
+
|
|
48643
|
+
if (delay) {
|
|
48644
|
+
setTimeout(function () {
|
|
48645
|
+
var _scrollItem;
|
|
48646
|
+
|
|
48647
|
+
scrollItem = document.getElementById(id);
|
|
48648
|
+
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48649
|
+
top: top,
|
|
48650
|
+
left: left,
|
|
48651
|
+
behavior: behavior
|
|
48652
|
+
});
|
|
48653
|
+
}, delay);
|
|
48654
|
+
} else {
|
|
48655
|
+
var _scrollItem2;
|
|
48656
|
+
|
|
48657
|
+
scrollItem = document.getElementById(id);
|
|
48658
|
+
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48659
|
+
top: top,
|
|
48660
|
+
left: left,
|
|
48661
|
+
behavior: behavior
|
|
48662
|
+
});
|
|
48663
|
+
}
|
|
48664
|
+
};
|
|
48665
|
+
|
|
48624
48666
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48625
48667
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48626
48668
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -48654,6 +48696,15 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48654
48696
|
toggleShowTerms = _useState2[1];
|
|
48655
48697
|
|
|
48656
48698
|
var standardBoxShadow = generateShadows().standard.base;
|
|
48699
|
+
|
|
48700
|
+
var toggleTerms = function toggleTerms(termsOpen) {
|
|
48701
|
+
toggleShowTerms(termsOpen);
|
|
48702
|
+
|
|
48703
|
+
if (termsOpen) {
|
|
48704
|
+
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48705
|
+
}
|
|
48706
|
+
};
|
|
48707
|
+
|
|
48657
48708
|
return /*#__PURE__*/React.createElement(Box, {
|
|
48658
48709
|
padding: displayInline ? "0" : "1.5rem",
|
|
48659
48710
|
minWidth: displayInline ? "0" : "100%",
|
|
@@ -48689,7 +48740,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48689
48740
|
link: linkText,
|
|
48690
48741
|
terms: terms,
|
|
48691
48742
|
isOpen: showTerms,
|
|
48692
|
-
toggleOpen:
|
|
48743
|
+
toggleOpen: toggleTerms,
|
|
48693
48744
|
linkVariant: modalVariant,
|
|
48694
48745
|
title: modalTitle
|
|
48695
48746
|
})), showCheckbox && hasError && /*#__PURE__*/React.createElement(Text$1, {
|