@thecb/components 9.2.11 → 9.2.12-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 CHANGED
@@ -45771,7 +45771,9 @@ var Modal$1 = function Modal(_ref) {
45771
45771
  buttonExtraStyles = _ref.buttonExtraStyles,
45772
45772
  children = _ref.children,
45773
45773
  _ref$dataQa = _ref.dataQa,
45774
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45774
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45775
+ _ref$initialFocusSele = _ref.initialFocusSelector,
45776
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45775
45777
 
45776
45778
  var _useContext = React.useContext(styled.ThemeContext),
45777
45779
  isMobile = _useContext.isMobile;
@@ -45798,7 +45800,11 @@ var Modal$1 = function Modal(_ref) {
45798
45800
  width: customWidth || "615px",
45799
45801
  overflow: "auto"
45800
45802
  },
45801
- underlayClickExits: underlayClickExits
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
+
45802
45808
  }, /*#__PURE__*/React__default.createElement(Box, {
45803
45809
  padding: "0",
45804
45810
  borderRadius: "2px",
@@ -45845,7 +45851,9 @@ var Modal$1 = function Modal(_ref) {
45845
45851
  text: cancelButtonText,
45846
45852
  dataQa: cancelButtonText,
45847
45853
  extraStyles: buttonExtraStyles,
45848
- className: "modal-cancel-button"
45854
+ className: "modal-cancel-button",
45855
+ role: "button",
45856
+ name: cancelButtonText
45849
45857
  })), /*#__PURE__*/React__default.createElement(Box, {
45850
45858
  width: "100%",
45851
45859
  padding: "0"
@@ -45857,7 +45865,9 @@ var Modal$1 = function Modal(_ref) {
45857
45865
  isLoading: isLoading,
45858
45866
  disabled: isContinueActionDisabled,
45859
45867
  extraStyles: buttonExtraStyles,
45860
- className: "modal-continue-button"
45868
+ className: "modal-continue-button",
45869
+ role: "button",
45870
+ name: continueButtonText
45861
45871
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45862
45872
  childGap: "1rem",
45863
45873
  direction: "row",
@@ -45868,7 +45878,9 @@ var Modal$1 = function Modal(_ref) {
45868
45878
  text: cancelButtonText,
45869
45879
  dataQa: cancelButtonText,
45870
45880
  extraStyles: buttonExtraStyles,
45871
- className: "modal-cancel-button"
45881
+ className: "modal-cancel-button",
45882
+ role: "button",
45883
+ name: cancelButtonText
45872
45884
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45873
45885
  variant: useDangerButton ? "danger" : "primary",
45874
45886
  action: continueAction,
@@ -45877,7 +45889,9 @@ var Modal$1 = function Modal(_ref) {
45877
45889
  isLoading: isLoading,
45878
45890
  disabled: isContinueActionDisabled,
45879
45891
  extraStyles: buttonExtraStyles,
45880
- className: "modal-continue-button"
45892
+ className: "modal-continue-button",
45893
+ role: "button",
45894
+ name: continueButtonText
45881
45895
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45882
45896
  padding: "0.5rem"
45883
45897
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45886,7 +45900,9 @@ var Modal$1 = function Modal(_ref) {
45886
45900
  text: closeButtonText,
45887
45901
  dataQa: closeButtonText,
45888
45902
  extraStyles: buttonExtraStyles,
45889
- className: "modal-close-button"
45903
+ className: "modal-close-button",
45904
+ role: "button",
45905
+ name: closeButtonText
45890
45906
  }))))))))), children);
45891
45907
  };
45892
45908
 
@@ -47718,7 +47734,8 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47718
47734
  continueAction: function continueAction() {
47719
47735
  toggleAccepted(true);
47720
47736
  toggleOpen(false);
47721
- }
47737
+ },
47738
+ initialFocusSelector: "[name='Close']"
47722
47739
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47723
47740
  variant: "pS",
47724
47741
  onClick: function onClick() {
@@ -47731,7 +47748,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47731
47748
  color: themeValues.linkColor,
47732
47749
  weight: themeValues.fontWeight,
47733
47750
  hoverStyles: themeValues.modalLinkHoverFocus,
47734
- extraStyles: "cursor: pointer;"
47751
+ extraStyles: "cursor: pointer;",
47752
+ role: "button",
47753
+ className: "modal-trigger"
47735
47754
  }, link));
47736
47755
  };
47737
47756
 
@@ -47788,7 +47807,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47788
47807
  variant = _ref.variant,
47789
47808
  _ref$linkVariant = _ref.linkVariant,
47790
47809
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47791
- themeValues = _ref.themeValues;
47810
+ themeValues = _ref.themeValues,
47811
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47812
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47792
47813
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47793
47814
  modalOpen: isOpen,
47794
47815
  hideModal: function hideModal() {
@@ -47814,7 +47835,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47814
47835
  continueAction: function continueAction() {
47815
47836
  toggleAccepted(true);
47816
47837
  toggleOpen(false);
47817
- }
47838
+ },
47839
+ initialFocusSelector: initialFocusSelector
47818
47840
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47819
47841
  variant: linkVariant,
47820
47842
  onClick: function onClick() {
@@ -47827,7 +47849,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47827
47849
  color: themeValues.linkColor,
47828
47850
  weight: themeValues.fontWeight,
47829
47851
  hoverStyles: themeValues.modalLinkHoverFocus,
47830
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
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"
47831
47856
  }, link));
47832
47857
  };
47833
47858
 
@@ -47840,7 +47865,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47840
47865
  terms = _ref.terms,
47841
47866
  _ref$error = _ref.error,
47842
47867
  error = _ref$error === void 0 ? false : _ref$error,
47843
- linkVariant = _ref.linkVariant;
47868
+ linkVariant = _ref.linkVariant,
47869
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47870
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47844
47871
 
47845
47872
  var _useState = React.useState(false),
47846
47873
  _useState2 = _slicedToArray(_useState, 2),
@@ -47862,7 +47889,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47862
47889
  terms: terms,
47863
47890
  isOpen: showTerms,
47864
47891
  toggleOpen: toggleShowTerms,
47865
- linkVariant: linkVariant
47892
+ linkVariant: linkVariant,
47893
+ initialFocusSelector: initialFocusSelector
47866
47894
  })))));
47867
47895
  };
47868
47896
 
@@ -47893,7 +47921,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47893
47921
  _ref$checkboxMargin = _ref.checkboxMargin,
47894
47922
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47895
47923
  _ref$modalTitle = _ref.modalTitle,
47896
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _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;
47897
47927
 
47898
47928
  var _useState = React.useState(false),
47899
47929
  _useState2 = _slicedToArray(_useState, 2),
@@ -47949,7 +47979,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47949
47979
  isOpen: showTerms,
47950
47980
  toggleOpen: toggleTerms,
47951
47981
  linkVariant: modalVariant,
47952
- title: modalTitle
47982
+ title: modalTitle,
47983
+ initialFocusSelector: initialFocusSelector
47953
47984
  })), /*#__PURE__*/React__default.createElement("div", {
47954
47985
  "aria-live": "polite",
47955
47986
  "aria-atomic": true
@@ -48150,7 +48181,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48150
48181
  version: "v2",
48151
48182
  showCheckbox: false,
48152
48183
  description: "View",
48153
- terms: termsContent
48184
+ terms: termsContent,
48185
+ initialFocusSelector: ".modal-close-button"
48154
48186
  })))));
48155
48187
  };
48156
48188
 
@@ -48346,7 +48378,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48346
48378
  version: "v2",
48347
48379
  showCheckbox: false,
48348
48380
  description: "View",
48349
- terms: termsContent
48381
+ terms: termsContent,
48382
+ initialFocusSelector: ".modal-close-button"
48350
48383
  })))));
48351
48384
  };
48352
48385