@thecb/components 9.2.9 → 9.2.10-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 CHANGED
@@ -45765,7 +45765,11 @@ var Modal$1 = function Modal(_ref) {
45765
45765
  buttonExtraStyles = _ref.buttonExtraStyles,
45766
45766
  children = _ref.children,
45767
45767
  _ref$dataQa = _ref.dataQa,
45768
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45768
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45769
+ _ref$initialFocusSele = _ref.initialFocusSelector,
45770
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
45771
+ _ref$modalName = _ref.modalName,
45772
+ modalName = _ref$modalName === void 0 ? "" : _ref$modalName;
45769
45773
 
45770
45774
  var _useContext = React.useContext(styled.ThemeContext),
45771
45775
  isMobile = _useContext.isMobile;
@@ -45792,7 +45796,10 @@ var Modal$1 = function Modal(_ref) {
45792
45796
  width: customWidth || "615px",
45793
45797
  overflow: "auto"
45794
45798
  },
45795
- underlayClickExits: underlayClickExits
45799
+ underlayClickExits: underlayClickExits,
45800
+ "aria-modal": true,
45801
+ "aria-name": !!modalName.length ? modalName : modalHeaderText,
45802
+ initialFocus: initialFocusSelector
45796
45803
  }, /*#__PURE__*/React__default.createElement(Box, {
45797
45804
  padding: "0",
45798
45805
  borderRadius: "2px",
@@ -45839,7 +45846,9 @@ var Modal$1 = function Modal(_ref) {
45839
45846
  text: cancelButtonText,
45840
45847
  dataQa: cancelButtonText,
45841
45848
  extraStyles: buttonExtraStyles,
45842
- className: "modal-cancel-button"
45849
+ className: "modal-cancel-button",
45850
+ role: "button",
45851
+ name: cancelButtonText
45843
45852
  })), /*#__PURE__*/React__default.createElement(Box, {
45844
45853
  width: "100%",
45845
45854
  padding: "0"
@@ -45851,7 +45860,9 @@ var Modal$1 = function Modal(_ref) {
45851
45860
  isLoading: isLoading,
45852
45861
  disabled: isContinueActionDisabled,
45853
45862
  extraStyles: buttonExtraStyles,
45854
- className: "modal-continue-button"
45863
+ className: "modal-continue-button",
45864
+ role: "button",
45865
+ name: continueButtonText
45855
45866
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45856
45867
  childGap: "1rem",
45857
45868
  direction: "row",
@@ -45862,7 +45873,9 @@ var Modal$1 = function Modal(_ref) {
45862
45873
  text: cancelButtonText,
45863
45874
  dataQa: cancelButtonText,
45864
45875
  extraStyles: buttonExtraStyles,
45865
- className: "modal-cancel-button"
45876
+ className: "modal-cancel-button",
45877
+ role: "button",
45878
+ name: cancelButtonText
45866
45879
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45867
45880
  variant: useDangerButton ? "danger" : "primary",
45868
45881
  action: continueAction,
@@ -45871,7 +45884,9 @@ var Modal$1 = function Modal(_ref) {
45871
45884
  isLoading: isLoading,
45872
45885
  disabled: isContinueActionDisabled,
45873
45886
  extraStyles: buttonExtraStyles,
45874
- className: "modal-continue-button"
45887
+ className: "modal-continue-button",
45888
+ role: "button",
45889
+ name: continueButtonText
45875
45890
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45876
45891
  padding: "0.5rem"
45877
45892
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45880,7 +45895,9 @@ var Modal$1 = function Modal(_ref) {
45880
45895
  text: closeButtonText,
45881
45896
  dataQa: closeButtonText,
45882
45897
  extraStyles: buttonExtraStyles,
45883
- className: "modal-close-button"
45898
+ className: "modal-close-button",
45899
+ role: "button",
45900
+ name: closeButtonText
45884
45901
  }))))))))), children);
45885
45902
  };
45886
45903
 
@@ -47725,7 +47742,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47725
47742
  color: themeValues.linkColor,
47726
47743
  weight: themeValues.fontWeight,
47727
47744
  hoverStyles: themeValues.modalLinkHoverFocus,
47728
- extraStyles: "cursor: pointer;"
47745
+ extraStyles: "cursor: pointer;",
47746
+ role: "button",
47747
+ className: "modal-trigger"
47729
47748
  }, link));
47730
47749
  };
47731
47750
 
@@ -47782,7 +47801,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47782
47801
  variant = _ref.variant,
47783
47802
  _ref$linkVariant = _ref.linkVariant,
47784
47803
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47785
- themeValues = _ref.themeValues;
47804
+ themeValues = _ref.themeValues,
47805
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47806
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47786
47807
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47787
47808
  modalOpen: isOpen,
47788
47809
  hideModal: function hideModal() {
@@ -47808,7 +47829,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47808
47829
  continueAction: function continueAction() {
47809
47830
  toggleAccepted(true);
47810
47831
  toggleOpen(false);
47811
- }
47832
+ },
47833
+ initialFocusSelector: initialFocusSelector
47812
47834
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47813
47835
  variant: linkVariant,
47814
47836
  onClick: function onClick() {
@@ -47821,7 +47843,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47821
47843
  color: themeValues.linkColor,
47822
47844
  weight: themeValues.fontWeight,
47823
47845
  hoverStyles: themeValues.modalLinkHoverFocus,
47824
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47846
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47847
+ role: "button" // This should always be a "button" since it opens a modal
47848
+ ,
47849
+ className: "modal-trigger"
47825
47850
  }, link));
47826
47851
  };
47827
47852
 
@@ -47834,7 +47859,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47834
47859
  terms = _ref.terms,
47835
47860
  _ref$error = _ref.error,
47836
47861
  error = _ref$error === void 0 ? false : _ref$error,
47837
- linkVariant = _ref.linkVariant;
47862
+ linkVariant = _ref.linkVariant,
47863
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47864
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47838
47865
 
47839
47866
  var _useState = React.useState(false),
47840
47867
  _useState2 = _slicedToArray(_useState, 2),
@@ -47856,7 +47883,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47856
47883
  terms: terms,
47857
47884
  isOpen: showTerms,
47858
47885
  toggleOpen: toggleShowTerms,
47859
- linkVariant: linkVariant
47886
+ linkVariant: linkVariant,
47887
+ initialFocusSelector: initialFocusSelector
47860
47888
  })))));
47861
47889
  };
47862
47890
 
@@ -47885,7 +47913,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47885
47913
  _ref$checkboxMargin = _ref.checkboxMargin,
47886
47914
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47887
47915
  _ref$modalTitle = _ref.modalTitle,
47888
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47916
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47917
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47918
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47889
47919
 
47890
47920
  var _useState = React.useState(false),
47891
47921
  _useState2 = _slicedToArray(_useState, 2),
@@ -47939,7 +47969,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47939
47969
  isOpen: showTerms,
47940
47970
  toggleOpen: toggleTerms,
47941
47971
  linkVariant: modalVariant,
47942
- title: modalTitle
47972
+ title: modalTitle,
47973
+ initialFocusSelector: initialFocusSelector
47943
47974
  })), /*#__PURE__*/React__default.createElement("div", {
47944
47975
  "aria-live": "polite",
47945
47976
  "aria-atomic": true
@@ -47958,7 +47989,9 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
47958
47989
  rest = _objectWithoutProperties(_ref, _excluded$y);
47959
47990
 
47960
47991
  var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
47961
- return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
47992
+ return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, _extends({
47993
+ initialFocusSelector: "[role='button']:not(.modal-trigger)"
47994
+ }, rest));
47962
47995
  };
47963
47996
 
47964
47997
  var PaymentFormACH = function PaymentFormACH(_ref) {