@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.cjs.js
CHANGED
|
@@ -26061,6 +26061,8 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
26061
26061
|
name = _ref2.name,
|
|
26062
26062
|
_ref2$disabled = _ref2.disabled,
|
|
26063
26063
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
26064
|
+
_ref2$ariaDescribedBy = _ref2.ariaDescribedBy,
|
|
26065
|
+
ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
|
|
26064
26066
|
themeValues = _ref2.themeValues;
|
|
26065
26067
|
var buttonBorder = {
|
|
26066
26068
|
onFocused: {
|
|
@@ -26112,6 +26114,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
26112
26114
|
"aria-label": name,
|
|
26113
26115
|
disabled: disabled,
|
|
26114
26116
|
onClick: toggleRadio,
|
|
26117
|
+
"aria-describedby": ariaDescribedBy,
|
|
26115
26118
|
tabIndex: "-1"
|
|
26116
26119
|
}), /*#__PURE__*/React__default.createElement(Motion, {
|
|
26117
26120
|
borderWidth: "1px",
|
|
@@ -47230,9 +47233,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47230
47233
|
background: themeValues.backgroundColor,
|
|
47231
47234
|
border: "1px solid ".concat(themeValues.border),
|
|
47232
47235
|
borderRadius: "3px",
|
|
47233
|
-
extraStyles: "overflow: scroll; max-height: 20rem;"
|
|
47236
|
+
extraStyles: "overflow: scroll; max-height: 20rem;",
|
|
47237
|
+
id: "terms-body-text"
|
|
47234
47238
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47235
|
-
id: "terms-body-text",
|
|
47236
47239
|
variant: "p",
|
|
47237
47240
|
extraStyles: "& a { text-decoration: underline; }"
|
|
47238
47241
|
}, terms)),
|
|
@@ -47961,7 +47964,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
47961
47964
|
_ref$initiallyOpen = _ref.initiallyOpen,
|
|
47962
47965
|
initiallyOpen = _ref$initiallyOpen === void 0 ? true : _ref$initiallyOpen,
|
|
47963
47966
|
_ref$openHeight = _ref.openHeight,
|
|
47964
|
-
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight
|
|
47967
|
+
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
47968
|
+
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
47965
47969
|
|
|
47966
47970
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
47967
47971
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13) {
|
|
@@ -48038,7 +48042,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48038
48042
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48039
48043
|
childGap: "0"
|
|
48040
48044
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
48041
|
-
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem
|
|
48045
|
+
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48042
48046
|
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48043
48047
|
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48044
48048
|
return toggleOpenSection(section.id);
|
|
@@ -48055,7 +48059,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48055
48059
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48056
48060
|
justify: "space-between",
|
|
48057
48061
|
align: "center",
|
|
48058
|
-
childGap: "0
|
|
48062
|
+
childGap: "0",
|
|
48059
48063
|
nowrap: true
|
|
48060
48064
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48061
48065
|
justify: "flex-start",
|
|
@@ -48064,7 +48068,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48064
48068
|
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48065
48069
|
padding: "0"
|
|
48066
48070
|
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48067
|
-
name: section.id,
|
|
48071
|
+
name: typeof section.title === "string" ? createIdFromString(section.title) : section.id,
|
|
48072
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
48068
48073
|
radioOn: openSection === section.id,
|
|
48069
48074
|
radioFocused: focused === section.id,
|
|
48070
48075
|
toggleRadio: section.disabled ? noop : function () {
|
|
@@ -48629,6 +48634,43 @@ var generateShadows = function generateShadows(baseColorRGB) {
|
|
|
48629
48634
|
};
|
|
48630
48635
|
};
|
|
48631
48636
|
|
|
48637
|
+
/*
|
|
48638
|
+
Hook that takes an ID selector for an element on the screen
|
|
48639
|
+
And optionally values for top position, left position, smooth behavior
|
|
48640
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
48641
|
+
|
|
48642
|
+
(string, number, number, string, number) => undefined;
|
|
48643
|
+
*/
|
|
48644
|
+
var useScrollTo = function useScrollTo(id) {
|
|
48645
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48646
|
+
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48647
|
+
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48648
|
+
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48649
|
+
var scrollItem;
|
|
48650
|
+
|
|
48651
|
+
if (delay) {
|
|
48652
|
+
setTimeout(function () {
|
|
48653
|
+
var _scrollItem;
|
|
48654
|
+
|
|
48655
|
+
scrollItem = document.getElementById(id);
|
|
48656
|
+
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48657
|
+
top: top,
|
|
48658
|
+
left: left,
|
|
48659
|
+
behavior: behavior
|
|
48660
|
+
});
|
|
48661
|
+
}, delay);
|
|
48662
|
+
} else {
|
|
48663
|
+
var _scrollItem2;
|
|
48664
|
+
|
|
48665
|
+
scrollItem = document.getElementById(id);
|
|
48666
|
+
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48667
|
+
top: top,
|
|
48668
|
+
left: left,
|
|
48669
|
+
behavior: behavior
|
|
48670
|
+
});
|
|
48671
|
+
}
|
|
48672
|
+
};
|
|
48673
|
+
|
|
48632
48674
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48633
48675
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48634
48676
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -48662,6 +48704,15 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48662
48704
|
toggleShowTerms = _useState2[1];
|
|
48663
48705
|
|
|
48664
48706
|
var standardBoxShadow = generateShadows().standard.base;
|
|
48707
|
+
|
|
48708
|
+
var toggleTerms = function toggleTerms(termsOpen) {
|
|
48709
|
+
toggleShowTerms(termsOpen);
|
|
48710
|
+
|
|
48711
|
+
if (termsOpen) {
|
|
48712
|
+
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48713
|
+
}
|
|
48714
|
+
};
|
|
48715
|
+
|
|
48665
48716
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48666
48717
|
padding: displayInline ? "0" : "1.5rem",
|
|
48667
48718
|
minWidth: displayInline ? "0" : "100%",
|
|
@@ -48697,7 +48748,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48697
48748
|
link: linkText,
|
|
48698
48749
|
terms: terms,
|
|
48699
48750
|
isOpen: showTerms,
|
|
48700
|
-
toggleOpen:
|
|
48751
|
+
toggleOpen: toggleTerms,
|
|
48701
48752
|
linkVariant: modalVariant,
|
|
48702
48753
|
title: modalTitle
|
|
48703
48754
|
})), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
|