@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.esm.js
CHANGED
|
@@ -12503,7 +12503,7 @@ var _excluded$f = ["position", "padding", "children"];
|
|
|
12503
12503
|
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.
|
|
12504
12504
|
*/
|
|
12505
12505
|
|
|
12506
|
-
var Motion = function
|
|
12506
|
+
var Motion = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12507
12507
|
var _ref$position = _ref.position,
|
|
12508
12508
|
position = _ref$position === void 0 ? "relative" : _ref$position,
|
|
12509
12509
|
_ref$padding = _ref.padding,
|
|
@@ -12513,9 +12513,10 @@ var Motion = function Motion(_ref) {
|
|
|
12513
12513
|
|
|
12514
12514
|
return /*#__PURE__*/React.createElement(MotionWrapper, _extends({
|
|
12515
12515
|
position: position,
|
|
12516
|
-
padding: padding
|
|
12516
|
+
padding: padding,
|
|
12517
|
+
ref: ref
|
|
12517
12518
|
}, rest), safeChildren(children, /*#__PURE__*/React.createElement(Fragment$1, null)));
|
|
12518
|
-
};
|
|
12519
|
+
});
|
|
12519
12520
|
|
|
12520
12521
|
var ReelStyled = styled.div.withConfig({
|
|
12521
12522
|
displayName: "Reelstyled__ReelStyled",
|
|
@@ -22137,7 +22138,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22137
22138
|
checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
|
|
22138
22139
|
extraStyles = _ref4.extraStyles,
|
|
22139
22140
|
textExtraStyles = _ref4.textExtraStyles,
|
|
22140
|
-
labelledById = _ref4.labelledById,
|
|
22141
22141
|
_ref4$dataQa = _ref4.dataQa,
|
|
22142
22142
|
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
|
|
22143
22143
|
|
|
@@ -22152,9 +22152,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22152
22152
|
}
|
|
22153
22153
|
};
|
|
22154
22154
|
|
|
22155
|
-
var titleId = title ? "checkboxlabel-".concat(name) : undefined;
|
|
22156
|
-
var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
|
|
22157
|
-
var ariaLabel = ariaLabelledById ? undefined : name;
|
|
22158
22155
|
return /*#__PURE__*/React.createElement(Box, {
|
|
22159
22156
|
padding: "0",
|
|
22160
22157
|
tabIndex: "0",
|
|
@@ -22178,8 +22175,7 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22178
22175
|
id: "checkbox-".concat(name),
|
|
22179
22176
|
disabled: disabled,
|
|
22180
22177
|
name: name,
|
|
22181
|
-
"aria-label":
|
|
22182
|
-
"aria-labelledby": ariaLabelledById,
|
|
22178
|
+
"aria-label": name,
|
|
22183
22179
|
checked: checked,
|
|
22184
22180
|
onChange: onChange,
|
|
22185
22181
|
tabIndex: "-1",
|
|
@@ -22206,7 +22202,6 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22206
22202
|
}, /*#__PURE__*/React.createElement("polyline", {
|
|
22207
22203
|
points: "20 6 9 17 4 12"
|
|
22208
22204
|
})))), title && /*#__PURE__*/React.createElement(Text$1, {
|
|
22209
|
-
id: titleId,
|
|
22210
22205
|
variant: "p",
|
|
22211
22206
|
weight: themeValues.textFontWeight,
|
|
22212
22207
|
color: themeValues.textColor,
|
|
@@ -24053,10 +24048,9 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24053
24048
|
dataQa: "".concat(ariaLabelledby, "-dropdown")
|
|
24054
24049
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
24055
24050
|
as: "input",
|
|
24056
|
-
"aria-multiline": "false",
|
|
24057
24051
|
autoComplete: autocompleteValue,
|
|
24058
24052
|
"aria-controls": "".concat(ariaLabelledby, "_listbox"),
|
|
24059
|
-
"aria-activedescendant": "focused_option",
|
|
24053
|
+
"aria-activedescendant": isOpen ? "focused_option" : undefined,
|
|
24060
24054
|
"aria-owns": "".concat(ariaLabelledby, "_listbox"),
|
|
24061
24055
|
"aria-haspopup": "listbox",
|
|
24062
24056
|
"aria-labelledby": ariaLabelledby,
|
|
@@ -27381,8 +27375,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27381
27375
|
name = _ref2.name,
|
|
27382
27376
|
_ref2$disabled = _ref2.disabled,
|
|
27383
27377
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
27384
|
-
|
|
27385
|
-
ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
|
|
27378
|
+
ariaDescribedBy = _ref2.ariaDescribedBy,
|
|
27386
27379
|
themeValues = _ref2.themeValues,
|
|
27387
27380
|
_ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
|
|
27388
27381
|
ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
|
|
@@ -47858,8 +47851,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
47858
47851
|
})))));
|
|
47859
47852
|
};
|
|
47860
47853
|
|
|
47861
|
-
var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
|
|
47862
|
-
|
|
47863
47854
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
47864
47855
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
47865
47856
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -47922,8 +47913,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47922
47913
|
checked: isChecked,
|
|
47923
47914
|
onChange: onCheck,
|
|
47924
47915
|
checkboxMargin: checkboxMargin,
|
|
47925
|
-
extraStyles: "align-self: flex-start;"
|
|
47926
|
-
labelledById: TermsAndConditionsTitleDivId
|
|
47916
|
+
extraStyles: "align-self: flex-start;"
|
|
47927
47917
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
47928
47918
|
childGap: "0.25rem",
|
|
47929
47919
|
fullHeight: true
|
|
@@ -47931,8 +47921,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47931
47921
|
justify: "flex-start",
|
|
47932
47922
|
align: "center",
|
|
47933
47923
|
nowrap: true,
|
|
47934
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47935
|
-
id: TermsAndConditionsTitleDivId
|
|
47924
|
+
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47936
47925
|
}, description && /*#__PURE__*/React.createElement(Text$1, {
|
|
47937
47926
|
color: CHARADE_GREY
|
|
47938
47927
|
}, description), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
|
|
@@ -48634,6 +48623,7 @@ var fallbackValues$Q = {
|
|
|
48634
48623
|
focusStyles: focusStyles
|
|
48635
48624
|
};
|
|
48636
48625
|
|
|
48626
|
+
var _excluded$z = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired"];
|
|
48637
48627
|
/*
|
|
48638
48628
|
Takes an array of section objects, each object should look like:
|
|
48639
48629
|
{
|
|
@@ -48680,11 +48670,39 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48680
48670
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48681
48671
|
ariaDescribedBy = _ref.ariaDescribedBy,
|
|
48682
48672
|
_ref$isSectionRequire = _ref.isSectionRequired,
|
|
48683
|
-
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire
|
|
48673
|
+
isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
|
|
48674
|
+
rest = _objectWithoutProperties(_ref, _excluded$z);
|
|
48675
|
+
|
|
48676
|
+
var _useState = useState(null),
|
|
48677
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48678
|
+
focused = _useState2[0],
|
|
48679
|
+
setFocused = _useState2[1];
|
|
48680
|
+
|
|
48681
|
+
var sectionRefs = useRef(_toConsumableArray(Array(sections.length)).map(function () {
|
|
48682
|
+
return /*#__PURE__*/createRef();
|
|
48683
|
+
}));
|
|
48684
|
+
|
|
48685
|
+
var handleKeyDown = function handleKeyDown(id, e, i) {
|
|
48686
|
+
if (e.currentTarget !== e.target) {
|
|
48687
|
+
return;
|
|
48688
|
+
} // Allow Enter and Space to select a section
|
|
48689
|
+
|
|
48684
48690
|
|
|
48685
|
-
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48686
48691
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
48692
|
+
e.preventDefault();
|
|
48687
48693
|
toggleOpenSection(id);
|
|
48694
|
+
} // Allow Up and Down arrow navigation between sections
|
|
48695
|
+
|
|
48696
|
+
|
|
48697
|
+
if ((e === null || e === void 0 ? void 0 : e.keyCode) >= 37 && (e === null || e === void 0 ? void 0 : e.keyCode) <= 40) {
|
|
48698
|
+
var _sections$target, _sections$target2;
|
|
48699
|
+
|
|
48700
|
+
e.preventDefault();
|
|
48701
|
+
var next = i + ((e === null || e === void 0 ? void 0 : e.keyCode) > 38 ? 1 : -1);
|
|
48702
|
+
var target = next == -1 ? sections.length - 1 : next == sections.length ? 0 : next;
|
|
48703
|
+
sectionRefs.current[target].current.focus();
|
|
48704
|
+
setFocused((_sections$target = sections[target]) === null || _sections$target === void 0 ? void 0 : _sections$target.id);
|
|
48705
|
+
toggleOpenSection((_sections$target2 = sections[target]) === null || _sections$target2 === void 0 ? void 0 : _sections$target2.id);
|
|
48688
48706
|
}
|
|
48689
48707
|
};
|
|
48690
48708
|
|
|
@@ -48723,34 +48741,29 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48723
48741
|
var fade = _ref4.fade;
|
|
48724
48742
|
return fade && "opacity: 0.4;";
|
|
48725
48743
|
});
|
|
48726
|
-
|
|
48727
|
-
var _useState = useState(null),
|
|
48728
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48729
|
-
focused = _useState2[0],
|
|
48730
|
-
setFocused = _useState2[1];
|
|
48731
|
-
|
|
48732
48744
|
return /*#__PURE__*/React.createElement(Box, {
|
|
48733
48745
|
padding: "1px",
|
|
48734
48746
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
48735
48747
|
borderRadius: "4px",
|
|
48736
48748
|
extraStyles: containerStyles
|
|
48737
|
-
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48749
|
+
}, /*#__PURE__*/React.createElement(Stack, _extends({
|
|
48738
48750
|
childGap: "0",
|
|
48739
|
-
|
|
48751
|
+
role: "radiogroup",
|
|
48740
48752
|
"aria-required": isSectionRequired
|
|
48741
|
-
}, sections.filter(function (section) {
|
|
48753
|
+
}, rest), sections.filter(function (section) {
|
|
48742
48754
|
return !section.hidden;
|
|
48743
|
-
}).map(function (section) {
|
|
48755
|
+
}).map(function (section, i) {
|
|
48744
48756
|
return /*#__PURE__*/React.createElement(Motion, {
|
|
48745
48757
|
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48746
|
-
|
|
48747
|
-
|
|
48758
|
+
ref: sectionRefs.current[i],
|
|
48759
|
+
onBlur: function onBlur() {
|
|
48760
|
+
return !section.disabled && setFocused(null);
|
|
48748
48761
|
},
|
|
48749
48762
|
onFocus: function onFocus() {
|
|
48750
48763
|
return !section.disabled && setFocused(section.id);
|
|
48751
48764
|
},
|
|
48752
|
-
|
|
48753
|
-
return !section.disabled &&
|
|
48765
|
+
onKeyDown: function onKeyDown(e) {
|
|
48766
|
+
return !section.disabled && handleKeyDown(section.id, e, i);
|
|
48754
48767
|
},
|
|
48755
48768
|
hoverStyles: themeValues.focusStyles,
|
|
48756
48769
|
animate: openSection === section.id ? "open" : "closed",
|
|
@@ -48760,7 +48773,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48760
48773
|
role: "radio",
|
|
48761
48774
|
"aria-checked": openSection === section.id,
|
|
48762
48775
|
"aria-disabled": section.disabled,
|
|
48763
|
-
"aria-required": section
|
|
48776
|
+
"aria-required": section.required,
|
|
48777
|
+
"aria-labelledby": section.id,
|
|
48778
|
+
"aria-describedby": "right-icons-".concat(idString(section))
|
|
48764
48779
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48765
48780
|
childGap: "0"
|
|
48766
48781
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -48799,7 +48814,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48799
48814
|
return toggleOpenSection(section.id);
|
|
48800
48815
|
},
|
|
48801
48816
|
tabIndex: "-1",
|
|
48802
|
-
isRequired: section
|
|
48817
|
+
isRequired: section.required
|
|
48803
48818
|
})), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
|
|
48804
48819
|
align: "center"
|
|
48805
48820
|
}, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -48809,9 +48824,10 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48809
48824
|
htmlFor: "radio-input-".concat(idString(section)),
|
|
48810
48825
|
color: CHARADE_GREY
|
|
48811
48826
|
}, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
|
|
48827
|
+
id: "right-icons-".concat(idString(section)),
|
|
48812
48828
|
childGap: "0.5rem",
|
|
48813
|
-
"aria-label":
|
|
48814
|
-
role:
|
|
48829
|
+
"aria-label": section.rightIconsLabel || null,
|
|
48830
|
+
role: section.rightIconsRole || null
|
|
48815
48831
|
}, section.rightIcons.map(function (icon) {
|
|
48816
48832
|
return /*#__PURE__*/React.createElement(RightIcon, {
|
|
48817
48833
|
src: icon.img,
|