@thecb/components 9.2.11 → 9.2.13-beta.0
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 +56 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +56 -40
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +1 -8
- package/src/components/atoms/checkbox/Checkbox.stories.js +0 -1
- package/src/components/atoms/dropdown/Dropdown.js +1 -2
- package/src/components/atoms/layouts/Motion.js +7 -10
- package/src/components/molecules/radio-section/RadioSection.js +42 -13
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +1 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +1 -3
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +0 -4
- /package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -12511,7 +12511,7 @@ var _excluded$f = ["position", "padding", "children"];
|
|
|
12511
12511
|
This should be sufficient for most scenarios, but if you need to, you have the ability to make Motion act like all of the other primitives using the props provided.
|
|
12512
12512
|
*/
|
|
12513
12513
|
|
|
12514
|
-
var Motion = function
|
|
12514
|
+
var Motion = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12515
12515
|
var _ref$position = _ref.position,
|
|
12516
12516
|
position = _ref$position === void 0 ? "relative" : _ref$position,
|
|
12517
12517
|
_ref$padding = _ref.padding,
|
|
@@ -12521,9 +12521,10 @@ var Motion = function Motion(_ref) {
|
|
|
12521
12521
|
|
|
12522
12522
|
return /*#__PURE__*/React__default.createElement(MotionWrapper, _extends({
|
|
12523
12523
|
position: position,
|
|
12524
|
-
padding: padding
|
|
12524
|
+
padding: padding,
|
|
12525
|
+
ref: ref
|
|
12525
12526
|
}, rest), safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null)));
|
|
12526
|
-
};
|
|
12527
|
+
});
|
|
12527
12528
|
|
|
12528
12529
|
var ReelStyled = styled__default.div.withConfig({
|
|
12529
12530
|
displayName: "Reelstyled__ReelStyled",
|
|
@@ -22145,7 +22146,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22145
22146
|
checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
|
|
22146
22147
|
extraStyles = _ref4.extraStyles,
|
|
22147
22148
|
textExtraStyles = _ref4.textExtraStyles,
|
|
22148
|
-
labelledById = _ref4.labelledById,
|
|
22149
22149
|
_ref4$dataQa = _ref4.dataQa,
|
|
22150
22150
|
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
|
|
22151
22151
|
|
|
@@ -22160,9 +22160,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22160
22160
|
}
|
|
22161
22161
|
};
|
|
22162
22162
|
|
|
22163
|
-
var titleId = title ? "checkboxlabel-".concat(name) : undefined;
|
|
22164
|
-
var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
|
|
22165
|
-
var ariaLabel = ariaLabelledById ? undefined : name;
|
|
22166
22163
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
22167
22164
|
padding: "0",
|
|
22168
22165
|
tabIndex: "0",
|
|
@@ -22186,8 +22183,7 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22186
22183
|
id: "checkbox-".concat(name),
|
|
22187
22184
|
disabled: disabled,
|
|
22188
22185
|
name: name,
|
|
22189
|
-
"aria-label":
|
|
22190
|
-
"aria-labelledby": ariaLabelledById,
|
|
22186
|
+
"aria-label": name,
|
|
22191
22187
|
checked: checked,
|
|
22192
22188
|
onChange: onChange,
|
|
22193
22189
|
tabIndex: "-1",
|
|
@@ -22214,7 +22210,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22214
22210
|
}, /*#__PURE__*/React__default.createElement("polyline", {
|
|
22215
22211
|
points: "20 6 9 17 4 12"
|
|
22216
22212
|
})))), title && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
22217
|
-
id: titleId,
|
|
22218
22213
|
variant: "p",
|
|
22219
22214
|
weight: themeValues.textFontWeight,
|
|
22220
22215
|
color: themeValues.textColor,
|
|
@@ -24061,10 +24056,9 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24061
24056
|
dataQa: "".concat(ariaLabelledby, "-dropdown")
|
|
24062
24057
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
24063
24058
|
as: "input",
|
|
24064
|
-
"aria-multiline": "false",
|
|
24065
24059
|
autoComplete: autocompleteValue,
|
|
24066
24060
|
"aria-controls": "".concat(ariaLabelledby, "_listbox"),
|
|
24067
|
-
"aria-activedescendant": "focused_option",
|
|
24061
|
+
"aria-activedescendant": isOpen ? "focused_option" : undefined,
|
|
24068
24062
|
"aria-owns": "".concat(ariaLabelledby, "_listbox"),
|
|
24069
24063
|
"aria-haspopup": "listbox",
|
|
24070
24064
|
"aria-labelledby": ariaLabelledby,
|
|
@@ -27389,8 +27383,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27389
27383
|
name = _ref2.name,
|
|
27390
27384
|
_ref2$disabled = _ref2.disabled,
|
|
27391
27385
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
27392
|
-
|
|
27393
|
-
ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
|
|
27386
|
+
ariaDescribedBy = _ref2.ariaDescribedBy,
|
|
27394
27387
|
themeValues = _ref2.themeValues,
|
|
27395
27388
|
_ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
|
|
27396
27389
|
ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
|
|
@@ -47866,8 +47859,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
47866
47859
|
})))));
|
|
47867
47860
|
};
|
|
47868
47861
|
|
|
47869
|
-
var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
|
|
47870
|
-
|
|
47871
47862
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
47872
47863
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
47873
47864
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -47930,8 +47921,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47930
47921
|
checked: isChecked,
|
|
47931
47922
|
onChange: onCheck,
|
|
47932
47923
|
checkboxMargin: checkboxMargin,
|
|
47933
|
-
extraStyles: "align-self: flex-start;"
|
|
47934
|
-
labelledById: TermsAndConditionsTitleDivId
|
|
47924
|
+
extraStyles: "align-self: flex-start;"
|
|
47935
47925
|
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
47936
47926
|
childGap: "0.25rem",
|
|
47937
47927
|
fullHeight: true
|
|
@@ -47939,8 +47929,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47939
47929
|
justify: "flex-start",
|
|
47940
47930
|
align: "center",
|
|
47941
47931
|
nowrap: true,
|
|
47942
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47943
|
-
id: TermsAndConditionsTitleDivId
|
|
47932
|
+
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47944
47933
|
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47945
47934
|
color: CHARADE_GREY
|
|
47946
47935
|
}, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
@@ -48642,6 +48631,7 @@ var fallbackValues$Q = {
|
|
|
48642
48631
|
focusStyles: focusStyles
|
|
48643
48632
|
};
|
|
48644
48633
|
|
|
48634
|
+
var _excluded$z = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired"];
|
|
48645
48635
|
/*
|
|
48646
48636
|
Takes an array of section objects, each object should look like:
|
|
48647
48637
|
{
|
|
@@ -48688,11 +48678,39 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48688
48678
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48689
48679
|
ariaDescribedBy = _ref.ariaDescribedBy,
|
|
48690
48680
|
_ref$isSectionRequire = _ref.isSectionRequired,
|
|
48691
|
-
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire
|
|
48681
|
+
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
|
|
48682
|
+
rest = _objectWithoutProperties(_ref, _excluded$z);
|
|
48683
|
+
|
|
48684
|
+
var _useState = React.useState(null),
|
|
48685
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48686
|
+
focused = _useState2[0],
|
|
48687
|
+
setFocused = _useState2[1];
|
|
48688
|
+
|
|
48689
|
+
var sectionRefs = React.useRef(_toConsumableArray(Array(sections.length)).map(function () {
|
|
48690
|
+
return /*#__PURE__*/React.createRef();
|
|
48691
|
+
}));
|
|
48692
|
+
|
|
48693
|
+
var handleKeyDown = function handleKeyDown(id, e, i) {
|
|
48694
|
+
if (e.currentTarget !== e.target) {
|
|
48695
|
+
return;
|
|
48696
|
+
} // Allow Enter and Space to select a section
|
|
48697
|
+
|
|
48692
48698
|
|
|
48693
|
-
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48694
48699
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
48700
|
+
e.preventDefault();
|
|
48695
48701
|
toggleOpenSection(id);
|
|
48702
|
+
} // Allow Up and Down arrow navigation between sections
|
|
48703
|
+
|
|
48704
|
+
|
|
48705
|
+
if ((e === null || e === void 0 ? void 0 : e.keyCode) >= 37 && (e === null || e === void 0 ? void 0 : e.keyCode) <= 40) {
|
|
48706
|
+
var _sections$target, _sections$target2;
|
|
48707
|
+
|
|
48708
|
+
e.preventDefault();
|
|
48709
|
+
var next = i + ((e === null || e === void 0 ? void 0 : e.keyCode) > 38 ? 1 : -1);
|
|
48710
|
+
var target = next == -1 ? sections.length - 1 : next == sections.length ? 0 : next;
|
|
48711
|
+
sectionRefs.current[target].current.focus();
|
|
48712
|
+
setFocused((_sections$target = sections[target]) === null || _sections$target === void 0 ? void 0 : _sections$target.id);
|
|
48713
|
+
toggleOpenSection((_sections$target2 = sections[target]) === null || _sections$target2 === void 0 ? void 0 : _sections$target2.id);
|
|
48696
48714
|
}
|
|
48697
48715
|
};
|
|
48698
48716
|
|
|
@@ -48731,34 +48749,29 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48731
48749
|
var fade = _ref4.fade;
|
|
48732
48750
|
return fade && "opacity: 0.4;";
|
|
48733
48751
|
});
|
|
48734
|
-
|
|
48735
|
-
var _useState = React.useState(null),
|
|
48736
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48737
|
-
focused = _useState2[0],
|
|
48738
|
-
setFocused = _useState2[1];
|
|
48739
|
-
|
|
48740
48752
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48741
48753
|
padding: "1px",
|
|
48742
48754
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
48743
48755
|
borderRadius: "4px",
|
|
48744
48756
|
extraStyles: containerStyles
|
|
48745
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48757
|
+
}, /*#__PURE__*/React__default.createElement(Stack, _extends({
|
|
48746
48758
|
childGap: "0",
|
|
48747
|
-
|
|
48759
|
+
role: "radiogroup",
|
|
48748
48760
|
"aria-required": isSectionRequired
|
|
48749
|
-
}, sections.filter(function (section) {
|
|
48761
|
+
}, rest), sections.filter(function (section) {
|
|
48750
48762
|
return !section.hidden;
|
|
48751
|
-
}).map(function (section) {
|
|
48763
|
+
}).map(function (section, i) {
|
|
48752
48764
|
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48753
48765
|
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48754
|
-
|
|
48755
|
-
|
|
48766
|
+
ref: sectionRefs.current[i],
|
|
48767
|
+
onBlur: function onBlur() {
|
|
48768
|
+
return !section.disabled && setFocused(null);
|
|
48756
48769
|
},
|
|
48757
48770
|
onFocus: function onFocus() {
|
|
48758
48771
|
return !section.disabled && setFocused(section.id);
|
|
48759
48772
|
},
|
|
48760
|
-
|
|
48761
|
-
return !section.disabled &&
|
|
48773
|
+
onKeyDown: function onKeyDown(e) {
|
|
48774
|
+
return !section.disabled && handleKeyDown(section.id, e, i);
|
|
48762
48775
|
},
|
|
48763
48776
|
hoverStyles: themeValues.focusStyles,
|
|
48764
48777
|
animate: openSection === section.id ? "open" : "closed",
|
|
@@ -48768,7 +48781,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48768
48781
|
role: "radio",
|
|
48769
48782
|
"aria-checked": openSection === section.id,
|
|
48770
48783
|
"aria-disabled": section.disabled,
|
|
48771
|
-
"aria-required": section
|
|
48784
|
+
"aria-required": section.required,
|
|
48785
|
+
"aria-labelledby": section.id,
|
|
48786
|
+
"aria-describedby": "right-icons-".concat(idString(section))
|
|
48772
48787
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48773
48788
|
childGap: "0"
|
|
48774
48789
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -48807,7 +48822,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48807
48822
|
return toggleOpenSection(section.id);
|
|
48808
48823
|
},
|
|
48809
48824
|
tabIndex: "-1",
|
|
48810
|
-
isRequired: section
|
|
48825
|
+
isRequired: section.required
|
|
48811
48826
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48812
48827
|
align: "center"
|
|
48813
48828
|
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -48817,9 +48832,10 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48817
48832
|
htmlFor: "radio-input-".concat(idString(section)),
|
|
48818
48833
|
color: CHARADE_GREY
|
|
48819
48834
|
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48835
|
+
id: "right-icons-".concat(idString(section)),
|
|
48820
48836
|
childGap: "0.5rem",
|
|
48821
|
-
"aria-label":
|
|
48822
|
-
role:
|
|
48837
|
+
"aria-label": section.rightIconsLabel || null,
|
|
48838
|
+
role: section.rightIconsRole || null
|
|
48823
48839
|
}, section.rightIcons.map(function (icon) {
|
|
48824
48840
|
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48825
48841
|
src: icon.img,
|