@thecb/components 7.10.1-beta.0 → 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 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +58 -6
- 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 +1 -0
- 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,7 +47233,8 @@ 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
47239
|
variant: "p",
|
|
47236
47240
|
extraStyles: "& a { text-decoration: underline; }"
|
|
@@ -47960,7 +47964,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
47960
47964
|
_ref$initiallyOpen = _ref.initiallyOpen,
|
|
47961
47965
|
initiallyOpen = _ref$initiallyOpen === void 0 ? true : _ref$initiallyOpen,
|
|
47962
47966
|
_ref$openHeight = _ref.openHeight,
|
|
47963
|
-
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight
|
|
47967
|
+
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
47968
|
+
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
47964
47969
|
|
|
47965
47970
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
47966
47971
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13) {
|
|
@@ -48037,7 +48042,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48037
48042
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48038
48043
|
childGap: "0"
|
|
48039
48044
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
48040
|
-
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem
|
|
48045
|
+
padding: section.hideRadioButton ? "1.5rem" : "1.25rem 1.5rem",
|
|
48041
48046
|
background: section.disabled ? themeValues.headingDisabledColor : themeValues.headingBackgroundColor,
|
|
48042
48047
|
onClick: isMobile && supportsTouch || section.disabled ? noop : function () {
|
|
48043
48048
|
return toggleOpenSection(section.id);
|
|
@@ -48054,7 +48059,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48054
48059
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48055
48060
|
justify: "space-between",
|
|
48056
48061
|
align: "center",
|
|
48057
|
-
childGap: "0
|
|
48062
|
+
childGap: "0",
|
|
48058
48063
|
nowrap: true
|
|
48059
48064
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48060
48065
|
justify: "flex-start",
|
|
@@ -48063,7 +48068,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48063
48068
|
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48064
48069
|
padding: "0"
|
|
48065
48070
|
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48066
|
-
name: section.id,
|
|
48071
|
+
name: typeof section.title === "string" ? createIdFromString(section.title) : section.id,
|
|
48072
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
48067
48073
|
radioOn: openSection === section.id,
|
|
48068
48074
|
radioFocused: focused === section.id,
|
|
48069
48075
|
toggleRadio: section.disabled ? noop : function () {
|
|
@@ -48628,6 +48634,43 @@ var generateShadows = function generateShadows(baseColorRGB) {
|
|
|
48628
48634
|
};
|
|
48629
48635
|
};
|
|
48630
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
|
+
|
|
48631
48674
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48632
48675
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48633
48676
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -48661,6 +48704,15 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48661
48704
|
toggleShowTerms = _useState2[1];
|
|
48662
48705
|
|
|
48663
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
|
+
|
|
48664
48716
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48665
48717
|
padding: displayInline ? "0" : "1.5rem",
|
|
48666
48718
|
minWidth: displayInline ? "0" : "100%",
|
|
@@ -48696,7 +48748,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48696
48748
|
link: linkText,
|
|
48697
48749
|
terms: terms,
|
|
48698
48750
|
isOpen: showTerms,
|
|
48699
|
-
toggleOpen:
|
|
48751
|
+
toggleOpen: toggleTerms,
|
|
48700
48752
|
linkVariant: modalVariant,
|
|
48701
48753
|
title: modalTitle
|
|
48702
48754
|
})), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
|