@thecb/components 9.2.12-beta.0 → 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 +74 -91
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +74 -91
- 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/account-and-routing-modal/AccountAndRoutingModal.js +0 -3
- package/src/components/molecules/modal/Modal.js +1 -16
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +0 -1
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +0 -1
- 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 +3 -22
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +1 -3
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +1 -7
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -5
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +3 -8
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
- /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,
|
|
@@ -45771,9 +45764,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45771
45764
|
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
45772
45765
|
children = _ref.children,
|
|
45773
45766
|
_ref$dataQa = _ref.dataQa,
|
|
45774
|
-
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa
|
|
45775
|
-
_ref$initialFocusSele = _ref.initialFocusSelector,
|
|
45776
|
-
initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
|
|
45767
|
+
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
|
|
45777
45768
|
|
|
45778
45769
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
45779
45770
|
isMobile = _useContext.isMobile;
|
|
@@ -45800,11 +45791,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45800
45791
|
width: customWidth || "615px",
|
|
45801
45792
|
overflow: "auto"
|
|
45802
45793
|
},
|
|
45803
|
-
underlayClickExits: underlayClickExits
|
|
45804
|
-
"aria-modal": true,
|
|
45805
|
-
initialFocus: initialFocusSelector,
|
|
45806
|
-
focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
|
|
45807
|
-
|
|
45794
|
+
underlayClickExits: underlayClickExits
|
|
45808
45795
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
45809
45796
|
padding: "0",
|
|
45810
45797
|
borderRadius: "2px",
|
|
@@ -45851,9 +45838,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45851
45838
|
text: cancelButtonText,
|
|
45852
45839
|
dataQa: cancelButtonText,
|
|
45853
45840
|
extraStyles: buttonExtraStyles,
|
|
45854
|
-
className: "modal-cancel-button"
|
|
45855
|
-
role: "button",
|
|
45856
|
-
name: cancelButtonText
|
|
45841
|
+
className: "modal-cancel-button"
|
|
45857
45842
|
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
45858
45843
|
width: "100%",
|
|
45859
45844
|
padding: "0"
|
|
@@ -45865,9 +45850,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45865
45850
|
isLoading: isLoading,
|
|
45866
45851
|
disabled: isContinueActionDisabled,
|
|
45867
45852
|
extraStyles: buttonExtraStyles,
|
|
45868
|
-
className: "modal-continue-button"
|
|
45869
|
-
role: "button",
|
|
45870
|
-
name: continueButtonText
|
|
45853
|
+
className: "modal-continue-button"
|
|
45871
45854
|
}))) : /*#__PURE__*/React__default.createElement(Stack, {
|
|
45872
45855
|
childGap: "1rem",
|
|
45873
45856
|
direction: "row",
|
|
@@ -45878,9 +45861,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45878
45861
|
text: cancelButtonText,
|
|
45879
45862
|
dataQa: cancelButtonText,
|
|
45880
45863
|
extraStyles: buttonExtraStyles,
|
|
45881
|
-
className: "modal-cancel-button"
|
|
45882
|
-
role: "button",
|
|
45883
|
-
name: cancelButtonText
|
|
45864
|
+
className: "modal-cancel-button"
|
|
45884
45865
|
}), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
45885
45866
|
variant: useDangerButton ? "danger" : "primary",
|
|
45886
45867
|
action: continueAction,
|
|
@@ -45889,9 +45870,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45889
45870
|
isLoading: isLoading,
|
|
45890
45871
|
disabled: isContinueActionDisabled,
|
|
45891
45872
|
extraStyles: buttonExtraStyles,
|
|
45892
|
-
className: "modal-continue-button"
|
|
45893
|
-
role: "button",
|
|
45894
|
-
name: continueButtonText
|
|
45873
|
+
className: "modal-continue-button"
|
|
45895
45874
|
}))) : /*#__PURE__*/React__default.createElement(Box, {
|
|
45896
45875
|
padding: "0.5rem"
|
|
45897
45876
|
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
@@ -45900,9 +45879,7 @@ var Modal$1 = function Modal(_ref) {
|
|
|
45900
45879
|
text: closeButtonText,
|
|
45901
45880
|
dataQa: closeButtonText,
|
|
45902
45881
|
extraStyles: buttonExtraStyles,
|
|
45903
|
-
className: "modal-close-button"
|
|
45904
|
-
role: "button",
|
|
45905
|
-
name: closeButtonText
|
|
45882
|
+
className: "modal-close-button"
|
|
45906
45883
|
}))))))))), children);
|
|
45907
45884
|
};
|
|
45908
45885
|
|
|
@@ -47734,8 +47711,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
|
|
|
47734
47711
|
continueAction: function continueAction() {
|
|
47735
47712
|
toggleAccepted(true);
|
|
47736
47713
|
toggleOpen(false);
|
|
47737
|
-
}
|
|
47738
|
-
initialFocusSelector: "[name='Close']"
|
|
47714
|
+
}
|
|
47739
47715
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47740
47716
|
variant: "pS",
|
|
47741
47717
|
onClick: function onClick() {
|
|
@@ -47748,9 +47724,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
|
|
|
47748
47724
|
color: themeValues.linkColor,
|
|
47749
47725
|
weight: themeValues.fontWeight,
|
|
47750
47726
|
hoverStyles: themeValues.modalLinkHoverFocus,
|
|
47751
|
-
extraStyles: "cursor: pointer;"
|
|
47752
|
-
role: "button",
|
|
47753
|
-
className: "modal-trigger"
|
|
47727
|
+
extraStyles: "cursor: pointer;"
|
|
47754
47728
|
}, link));
|
|
47755
47729
|
};
|
|
47756
47730
|
|
|
@@ -47807,9 +47781,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47807
47781
|
variant = _ref.variant,
|
|
47808
47782
|
_ref$linkVariant = _ref.linkVariant,
|
|
47809
47783
|
linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
|
|
47810
|
-
themeValues = _ref.themeValues
|
|
47811
|
-
_ref$initialFocusSele = _ref.initialFocusSelector,
|
|
47812
|
-
initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
|
|
47784
|
+
themeValues = _ref.themeValues;
|
|
47813
47785
|
return /*#__PURE__*/React__default.createElement(Modal$1, {
|
|
47814
47786
|
modalOpen: isOpen,
|
|
47815
47787
|
hideModal: function hideModal() {
|
|
@@ -47835,8 +47807,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47835
47807
|
continueAction: function continueAction() {
|
|
47836
47808
|
toggleAccepted(true);
|
|
47837
47809
|
toggleOpen(false);
|
|
47838
|
-
}
|
|
47839
|
-
initialFocusSelector: initialFocusSelector
|
|
47810
|
+
}
|
|
47840
47811
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47841
47812
|
variant: linkVariant,
|
|
47842
47813
|
onClick: function onClick() {
|
|
@@ -47849,10 +47820,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47849
47820
|
color: themeValues.linkColor,
|
|
47850
47821
|
weight: themeValues.fontWeight,
|
|
47851
47822
|
hoverStyles: themeValues.modalLinkHoverFocus,
|
|
47852
|
-
extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
|
|
47853
|
-
role: "button" // This should always be a "button" since it opens a modal
|
|
47854
|
-
,
|
|
47855
|
-
className: "modal-trigger"
|
|
47823
|
+
extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
|
|
47856
47824
|
}, link));
|
|
47857
47825
|
};
|
|
47858
47826
|
|
|
@@ -47865,9 +47833,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
47865
47833
|
terms = _ref.terms,
|
|
47866
47834
|
_ref$error = _ref.error,
|
|
47867
47835
|
error = _ref$error === void 0 ? false : _ref$error,
|
|
47868
|
-
linkVariant = _ref.linkVariant
|
|
47869
|
-
_ref$initialFocusSele = _ref.initialFocusSelector,
|
|
47870
|
-
initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
|
|
47836
|
+
linkVariant = _ref.linkVariant;
|
|
47871
47837
|
|
|
47872
47838
|
var _useState = React.useState(false),
|
|
47873
47839
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -47889,13 +47855,10 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
47889
47855
|
terms: terms,
|
|
47890
47856
|
isOpen: showTerms,
|
|
47891
47857
|
toggleOpen: toggleShowTerms,
|
|
47892
|
-
linkVariant: linkVariant
|
|
47893
|
-
initialFocusSelector: initialFocusSelector
|
|
47858
|
+
linkVariant: linkVariant
|
|
47894
47859
|
})))));
|
|
47895
47860
|
};
|
|
47896
47861
|
|
|
47897
|
-
var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
|
|
47898
|
-
|
|
47899
47862
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
47900
47863
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
47901
47864
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -47921,9 +47884,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47921
47884
|
_ref$checkboxMargin = _ref.checkboxMargin,
|
|
47922
47885
|
checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
|
|
47923
47886
|
_ref$modalTitle = _ref.modalTitle,
|
|
47924
|
-
modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle
|
|
47925
|
-
_ref$initialFocusSele = _ref.initialFocusSelector,
|
|
47926
|
-
initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
|
|
47887
|
+
modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
|
|
47927
47888
|
|
|
47928
47889
|
var _useState = React.useState(false),
|
|
47929
47890
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -47960,8 +47921,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47960
47921
|
checked: isChecked,
|
|
47961
47922
|
onChange: onCheck,
|
|
47962
47923
|
checkboxMargin: checkboxMargin,
|
|
47963
|
-
extraStyles: "align-self: flex-start;"
|
|
47964
|
-
labelledById: TermsAndConditionsTitleDivId
|
|
47924
|
+
extraStyles: "align-self: flex-start;"
|
|
47965
47925
|
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
47966
47926
|
childGap: "0.25rem",
|
|
47967
47927
|
fullHeight: true
|
|
@@ -47969,8 +47929,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47969
47929
|
justify: "flex-start",
|
|
47970
47930
|
align: "center",
|
|
47971
47931
|
nowrap: true,
|
|
47972
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47973
|
-
id: TermsAndConditionsTitleDivId
|
|
47932
|
+
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47974
47933
|
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47975
47934
|
color: CHARADE_GREY
|
|
47976
47935
|
}, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
@@ -47979,8 +47938,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47979
47938
|
isOpen: showTerms,
|
|
47980
47939
|
toggleOpen: toggleTerms,
|
|
47981
47940
|
linkVariant: modalVariant,
|
|
47982
|
-
title: modalTitle
|
|
47983
|
-
initialFocusSelector: initialFocusSelector
|
|
47941
|
+
title: modalTitle
|
|
47984
47942
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
47985
47943
|
"aria-live": "polite",
|
|
47986
47944
|
"aria-atomic": true
|
|
@@ -48181,8 +48139,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
48181
48139
|
version: "v2",
|
|
48182
48140
|
showCheckbox: false,
|
|
48183
48141
|
description: "View",
|
|
48184
|
-
terms: termsContent
|
|
48185
|
-
initialFocusSelector: ".modal-close-button"
|
|
48142
|
+
terms: termsContent
|
|
48186
48143
|
})))));
|
|
48187
48144
|
};
|
|
48188
48145
|
|
|
@@ -48378,8 +48335,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48378
48335
|
version: "v2",
|
|
48379
48336
|
showCheckbox: false,
|
|
48380
48337
|
description: "View",
|
|
48381
|
-
terms: termsContent
|
|
48382
|
-
initialFocusSelector: ".modal-close-button"
|
|
48338
|
+
terms: termsContent
|
|
48383
48339
|
})))));
|
|
48384
48340
|
};
|
|
48385
48341
|
|
|
@@ -48675,6 +48631,7 @@ var fallbackValues$Q = {
|
|
|
48675
48631
|
focusStyles: focusStyles
|
|
48676
48632
|
};
|
|
48677
48633
|
|
|
48634
|
+
var _excluded$z = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired"];
|
|
48678
48635
|
/*
|
|
48679
48636
|
Takes an array of section objects, each object should look like:
|
|
48680
48637
|
{
|
|
@@ -48721,11 +48678,39 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48721
48678
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48722
48679
|
ariaDescribedBy = _ref.ariaDescribedBy,
|
|
48723
48680
|
_ref$isSectionRequire = _ref.isSectionRequired,
|
|
48724
|
-
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
|
+
|
|
48725
48698
|
|
|
48726
|
-
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48727
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();
|
|
48728
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);
|
|
48729
48714
|
}
|
|
48730
48715
|
};
|
|
48731
48716
|
|
|
@@ -48764,34 +48749,29 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48764
48749
|
var fade = _ref4.fade;
|
|
48765
48750
|
return fade && "opacity: 0.4;";
|
|
48766
48751
|
});
|
|
48767
|
-
|
|
48768
|
-
var _useState = React.useState(null),
|
|
48769
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48770
|
-
focused = _useState2[0],
|
|
48771
|
-
setFocused = _useState2[1];
|
|
48772
|
-
|
|
48773
48752
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48774
48753
|
padding: "1px",
|
|
48775
48754
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
48776
48755
|
borderRadius: "4px",
|
|
48777
48756
|
extraStyles: containerStyles
|
|
48778
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48757
|
+
}, /*#__PURE__*/React__default.createElement(Stack, _extends({
|
|
48779
48758
|
childGap: "0",
|
|
48780
|
-
|
|
48759
|
+
role: "radiogroup",
|
|
48781
48760
|
"aria-required": isSectionRequired
|
|
48782
|
-
}, sections.filter(function (section) {
|
|
48761
|
+
}, rest), sections.filter(function (section) {
|
|
48783
48762
|
return !section.hidden;
|
|
48784
|
-
}).map(function (section) {
|
|
48763
|
+
}).map(function (section, i) {
|
|
48785
48764
|
return /*#__PURE__*/React__default.createElement(Motion, {
|
|
48786
48765
|
tabIndex: section.hideRadioButton || section.disabled ? "-1" : "0",
|
|
48787
|
-
|
|
48788
|
-
|
|
48766
|
+
ref: sectionRefs.current[i],
|
|
48767
|
+
onBlur: function onBlur() {
|
|
48768
|
+
return !section.disabled && setFocused(null);
|
|
48789
48769
|
},
|
|
48790
48770
|
onFocus: function onFocus() {
|
|
48791
48771
|
return !section.disabled && setFocused(section.id);
|
|
48792
48772
|
},
|
|
48793
|
-
|
|
48794
|
-
return !section.disabled &&
|
|
48773
|
+
onKeyDown: function onKeyDown(e) {
|
|
48774
|
+
return !section.disabled && handleKeyDown(section.id, e, i);
|
|
48795
48775
|
},
|
|
48796
48776
|
hoverStyles: themeValues.focusStyles,
|
|
48797
48777
|
animate: openSection === section.id ? "open" : "closed",
|
|
@@ -48801,7 +48781,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48801
48781
|
role: "radio",
|
|
48802
48782
|
"aria-checked": openSection === section.id,
|
|
48803
48783
|
"aria-disabled": section.disabled,
|
|
48804
|
-
"aria-required": section
|
|
48784
|
+
"aria-required": section.required,
|
|
48785
|
+
"aria-labelledby": section.id,
|
|
48786
|
+
"aria-describedby": "right-icons-".concat(idString(section))
|
|
48805
48787
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48806
48788
|
childGap: "0"
|
|
48807
48789
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -48840,7 +48822,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48840
48822
|
return toggleOpenSection(section.id);
|
|
48841
48823
|
},
|
|
48842
48824
|
tabIndex: "-1",
|
|
48843
|
-
isRequired: section
|
|
48825
|
+
isRequired: section.required
|
|
48844
48826
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48845
48827
|
align: "center"
|
|
48846
48828
|
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -48850,9 +48832,10 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48850
48832
|
htmlFor: "radio-input-".concat(idString(section)),
|
|
48851
48833
|
color: CHARADE_GREY
|
|
48852
48834
|
}, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48835
|
+
id: "right-icons-".concat(idString(section)),
|
|
48853
48836
|
childGap: "0.5rem",
|
|
48854
|
-
"aria-label":
|
|
48855
|
-
role:
|
|
48837
|
+
"aria-label": section.rightIconsLabel || null,
|
|
48838
|
+
role: section.rightIconsRole || null
|
|
48856
48839
|
}, section.rightIcons.map(function (icon) {
|
|
48857
48840
|
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48858
48841
|
src: icon.img,
|