@thecb/components 9.0.3-beta.9 → 9.0.4-beta.1
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 +53 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +53 -29
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +10 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +11 -1
- package/src/components/molecules/radio-section/RadioSection.js +40 -31
- package/src/components/molecules/radio-section/RadioSection.stories.js +459 -6
package/dist/index.cjs.js
CHANGED
|
@@ -47859,6 +47859,13 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47859
47859
|
|
|
47860
47860
|
var accountTypeErrors = _defineProperty({}, required.error, "Account type is required");
|
|
47861
47861
|
|
|
47862
|
+
React.useEffect(function () {
|
|
47863
|
+
var firstFocusableField = document.getElementById("first-focusable-ach-input");
|
|
47864
|
+
|
|
47865
|
+
if (firstFocusableField) {
|
|
47866
|
+
firstFocusableField.focus();
|
|
47867
|
+
}
|
|
47868
|
+
}, []);
|
|
47862
47869
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
47863
47870
|
variant: variant,
|
|
47864
47871
|
role: "form",
|
|
@@ -47873,7 +47880,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47873
47880
|
onKeyDown: function onKeyDown(e) {
|
|
47874
47881
|
return e.key === "Enter" && handleSubmit(e);
|
|
47875
47882
|
},
|
|
47876
|
-
autocompleteValue: "name"
|
|
47883
|
+
autocompleteValue: "name",
|
|
47884
|
+
id: "first-focusable-ach-input"
|
|
47877
47885
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
47878
47886
|
labelTextWhenNoError: "Routing number",
|
|
47879
47887
|
dataQa: "Routing number",
|
|
@@ -48058,13 +48066,20 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48058
48066
|
|
|
48059
48067
|
var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
|
|
48060
48068
|
|
|
48061
|
-
var creditCardNumberErrors = (_creditCardNumberErro = {}, _defineProperty(_creditCardNumberErro, required.error, "Credit card number is required"), _defineProperty(_creditCardNumberErro, hasLength.error, "Credit card number is invalid"), _defineProperty(_creditCardNumberErro, matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted")), _creditCardNumberErro);
|
|
48069
|
+
var creditCardNumberErrors = (_creditCardNumberErro = {}, _defineProperty(_creditCardNumberErro, required.error, "Credit card number is required"), _defineProperty(_creditCardNumberErro, hasLength.error, "Credit card number is invalid"), _defineProperty(_creditCardNumberErro, matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted.")), _creditCardNumberErro);
|
|
48062
48070
|
var expirationDateErrors = (_expirationDateErrors = {}, _defineProperty(_expirationDateErrors, required.error, "Expiration date is required"), _defineProperty(_expirationDateErrors, hasLength.error, "Expiration date is invalid"), _defineProperty(_expirationDateErrors, isValidMonth.error, "Expiration month is invalid"), _defineProperty(_expirationDateErrors, dateAfterToday.error, "Expiration date is invalid"), _expirationDateErrors);
|
|
48063
48071
|
var cvvErrors = (_cvvErrors = {}, _defineProperty(_cvvErrors, required.error, "CVV is required"), _defineProperty(_cvvErrors, hasLength.error, "CVV is invalid"), _cvvErrors);
|
|
48064
48072
|
var zipCodeErrors = (_zipCodeErrors = {}, _defineProperty(_zipCodeErrors, required.error, "Zip code is required"), _defineProperty(_zipCodeErrors, hasLength.error, "Zip code is invalid"), _zipCodeErrors);
|
|
48065
48073
|
|
|
48066
48074
|
var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
|
|
48067
48075
|
|
|
48076
|
+
React.useEffect(function () {
|
|
48077
|
+
var firstFocusableField = document.getElementById("first-focusable-card-input");
|
|
48078
|
+
|
|
48079
|
+
if (firstFocusableField) {
|
|
48080
|
+
firstFocusableField.focus();
|
|
48081
|
+
}
|
|
48082
|
+
}, []);
|
|
48068
48083
|
var isUS = fields.country.rawValue === "US";
|
|
48069
48084
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
48070
48085
|
variant: variant,
|
|
@@ -48094,7 +48109,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48094
48109
|
onKeyDown: function onKeyDown(e) {
|
|
48095
48110
|
return e.key === "Enter" && handleSubmit(e);
|
|
48096
48111
|
},
|
|
48097
|
-
autocompleteValue: "cc-name"
|
|
48112
|
+
autocompleteValue: "cc-name",
|
|
48113
|
+
id: "first-focusable-card-input"
|
|
48098
48114
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
48099
48115
|
labelTextWhenNoError: "Credit card number",
|
|
48100
48116
|
dataQa: "Credit card number",
|
|
@@ -48486,7 +48502,7 @@ var fallbackValues$Q = {
|
|
|
48486
48502
|
|
|
48487
48503
|
*/
|
|
48488
48504
|
|
|
48489
|
-
var
|
|
48505
|
+
var idString = function idString(section) {
|
|
48490
48506
|
return typeof section.title === "string" ? createIdFromString(section.title) : section.id;
|
|
48491
48507
|
};
|
|
48492
48508
|
|
|
@@ -48507,12 +48523,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48507
48523
|
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
48508
48524
|
_ref$containerStyles = _ref.containerStyles,
|
|
48509
48525
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48510
|
-
ariaDescribedBy = _ref.ariaDescribedBy
|
|
48511
|
-
_ref$rightContentRole = _ref.rightContentRole,
|
|
48512
|
-
rightContentRole = _ref$rightContentRole === void 0 ? null : _ref$rightContentRole,
|
|
48513
|
-
_ref$ariaLabel = _ref.ariaLabel,
|
|
48514
|
-
_ref$rightIconsLabel = _ref.rightIconsLabel,
|
|
48515
|
-
rightIconsLabel = _ref$rightIconsLabel === void 0 ? null : _ref$rightIconsLabel;
|
|
48526
|
+
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
48516
48527
|
|
|
48517
48528
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48518
48529
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
@@ -48559,7 +48570,19 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48559
48570
|
var _useState = React.useState(null),
|
|
48560
48571
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48561
48572
|
focused = _useState2[0],
|
|
48562
|
-
setFocused = _useState2[1];
|
|
48573
|
+
setFocused = _useState2[1]; // useEffect(() => {
|
|
48574
|
+
// if (toggledContentRef && toggledContentRef?.current) {
|
|
48575
|
+
// const inputEl = toggledContentRef.current?.querySelector(
|
|
48576
|
+
// `[tabindex="0"]`
|
|
48577
|
+
// );
|
|
48578
|
+
// if (inputEl) {
|
|
48579
|
+
// inputEl?.focus();
|
|
48580
|
+
// } else {
|
|
48581
|
+
// toggledContentRef.current.focus();
|
|
48582
|
+
// }
|
|
48583
|
+
// }
|
|
48584
|
+
// }, [toggledContentRef.current]);
|
|
48585
|
+
|
|
48563
48586
|
|
|
48564
48587
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48565
48588
|
padding: "1px",
|
|
@@ -48589,7 +48612,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48589
48612
|
key: "item-".concat(section.id),
|
|
48590
48613
|
extraStyles: borderStyles,
|
|
48591
48614
|
role: "radio",
|
|
48592
|
-
"aria-checked": openSection === section.id
|
|
48615
|
+
"aria-checked": openSection === section.id,
|
|
48616
|
+
"aria-disabled": section.disabled
|
|
48593
48617
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48594
48618
|
childGap: "0"
|
|
48595
48619
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -48619,10 +48643,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48619
48643
|
}, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
|
|
48620
48644
|
padding: "0"
|
|
48621
48645
|
}, /*#__PURE__*/React__default.createElement(RadioButton$2, {
|
|
48622
|
-
id:
|
|
48623
|
-
name:
|
|
48646
|
+
id: "radio-input-".concat(idString(section)),
|
|
48647
|
+
name: idString(section),
|
|
48624
48648
|
ariaDescribedBy: ariaDescribedBy,
|
|
48625
|
-
ariaLabelledBy: "radio-input-".concat(computeSectionId(section)),
|
|
48626
48649
|
radioOn: openSection === section.id,
|
|
48627
48650
|
radioFocused: focused === section.id,
|
|
48628
48651
|
toggleRadio: section.disabled ? noop : function () {
|
|
@@ -48633,25 +48656,26 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48633
48656
|
align: "center"
|
|
48634
48657
|
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
48635
48658
|
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48636
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48659
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, _extends({
|
|
48637
48660
|
as: "label",
|
|
48638
|
-
|
|
48639
|
-
|
|
48640
|
-
},
|
|
48641
|
-
|
|
48642
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
48643
|
-
"
|
|
48644
|
-
|
|
48645
|
-
|
|
48661
|
+
htmlFor: "radio-input-".concat(idString(section)),
|
|
48662
|
+
color: CHARADE_GREY
|
|
48663
|
+
}, _objectSpread2({}, section !== null && section !== void 0 && section.titleLabel ? {
|
|
48664
|
+
"aria-label": section.titleLabel
|
|
48665
|
+
} : {})), section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48666
|
+
childGap: "0.5rem",
|
|
48667
|
+
"aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
|
|
48668
|
+
role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
|
|
48669
|
+
}, section.rightIcons.map(function (icon) {
|
|
48670
|
+
return /*#__PURE__*/React__default.createElement(RightIcon, {
|
|
48646
48671
|
src: icon.img,
|
|
48647
48672
|
key: icon.img,
|
|
48648
48673
|
fade: !icon.enabled,
|
|
48649
48674
|
isMobile: isMobile,
|
|
48650
|
-
alt: icon.altText
|
|
48651
|
-
|
|
48652
|
-
|
|
48653
|
-
|
|
48654
|
-
}))), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48675
|
+
alt: icon.altText,
|
|
48676
|
+
"aria-disabled": !icon.enabled
|
|
48677
|
+
});
|
|
48678
|
+
})), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
48655
48679
|
initial: false
|
|
48656
48680
|
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
48657
48681
|
key: "content-".concat(section.id),
|