@thecb/components 9.3.2 → 9.3.3-beta.10

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
@@ -45818,7 +45818,9 @@ var Modal$1 = function Modal(_ref) {
45818
45818
  buttonExtraStyles = _ref.buttonExtraStyles,
45819
45819
  children = _ref.children,
45820
45820
  _ref$dataQa = _ref.dataQa,
45821
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45821
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45822
+ _ref$initialFocusSele = _ref.initialFocusSelector,
45823
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45822
45824
 
45823
45825
  var _useContext = React.useContext(styled.ThemeContext),
45824
45826
  isMobile = _useContext.isMobile;
@@ -45845,7 +45847,11 @@ var Modal$1 = function Modal(_ref) {
45845
45847
  width: customWidth || "615px",
45846
45848
  overflow: "auto"
45847
45849
  },
45848
- underlayClickExits: underlayClickExits
45850
+ underlayClickExits: underlayClickExits,
45851
+ "aria-modal": true,
45852
+ initialFocus: initialFocusSelector,
45853
+ focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45854
+
45849
45855
  }, /*#__PURE__*/React__default.createElement(Box, {
45850
45856
  padding: "0",
45851
45857
  borderRadius: "2px",
@@ -45892,7 +45898,9 @@ var Modal$1 = function Modal(_ref) {
45892
45898
  text: cancelButtonText,
45893
45899
  dataQa: cancelButtonText,
45894
45900
  extraStyles: buttonExtraStyles,
45895
- className: "modal-cancel-button"
45901
+ className: "modal-cancel-button",
45902
+ role: "button",
45903
+ name: cancelButtonText
45896
45904
  })), /*#__PURE__*/React__default.createElement(Box, {
45897
45905
  width: "100%",
45898
45906
  padding: "0"
@@ -45904,7 +45912,9 @@ var Modal$1 = function Modal(_ref) {
45904
45912
  isLoading: isLoading,
45905
45913
  disabled: isContinueActionDisabled,
45906
45914
  extraStyles: buttonExtraStyles,
45907
- className: "modal-continue-button"
45915
+ className: "modal-continue-button",
45916
+ role: "button",
45917
+ name: continueButtonText
45908
45918
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45909
45919
  childGap: "1rem",
45910
45920
  direction: "row",
@@ -45915,7 +45925,9 @@ var Modal$1 = function Modal(_ref) {
45915
45925
  text: cancelButtonText,
45916
45926
  dataQa: cancelButtonText,
45917
45927
  extraStyles: buttonExtraStyles,
45918
- className: "modal-cancel-button"
45928
+ className: "modal-cancel-button",
45929
+ role: "button",
45930
+ name: cancelButtonText
45919
45931
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45920
45932
  variant: useDangerButton ? "danger" : "primary",
45921
45933
  action: continueAction,
@@ -45924,7 +45936,9 @@ var Modal$1 = function Modal(_ref) {
45924
45936
  isLoading: isLoading,
45925
45937
  disabled: isContinueActionDisabled,
45926
45938
  extraStyles: buttonExtraStyles,
45927
- className: "modal-continue-button"
45939
+ className: "modal-continue-button",
45940
+ role: "button",
45941
+ name: continueButtonText
45928
45942
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45929
45943
  padding: "0.5rem"
45930
45944
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45933,7 +45947,9 @@ var Modal$1 = function Modal(_ref) {
45933
45947
  text: closeButtonText,
45934
45948
  dataQa: closeButtonText,
45935
45949
  extraStyles: buttonExtraStyles,
45936
- className: "modal-close-button"
45950
+ className: "modal-close-button",
45951
+ role: "button",
45952
+ name: closeButtonText
45937
45953
  }))))))))), children);
45938
45954
  };
45939
45955
 
@@ -47764,7 +47780,8 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47764
47780
  continueAction: function continueAction() {
47765
47781
  toggleAccepted(true);
47766
47782
  toggleOpen(false);
47767
- }
47783
+ },
47784
+ initialFocusSelector: "[name='Close']"
47768
47785
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47769
47786
  variant: "pS",
47770
47787
  onClick: function onClick() {
@@ -47777,7 +47794,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47777
47794
  color: themeValues.linkColor,
47778
47795
  weight: themeValues.fontWeight,
47779
47796
  hoverStyles: themeValues.modalLinkHoverFocus,
47780
- extraStyles: "cursor: pointer;"
47797
+ extraStyles: "cursor: pointer;",
47798
+ role: "button",
47799
+ className: "modal-trigger"
47781
47800
  }, link));
47782
47801
  };
47783
47802
 
@@ -47834,7 +47853,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47834
47853
  variant = _ref.variant,
47835
47854
  _ref$linkVariant = _ref.linkVariant,
47836
47855
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47837
- themeValues = _ref.themeValues;
47856
+ themeValues = _ref.themeValues,
47857
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47858
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47838
47859
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47839
47860
  modalOpen: isOpen,
47840
47861
  hideModal: function hideModal() {
@@ -47860,7 +47881,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47860
47881
  continueAction: function continueAction() {
47861
47882
  toggleAccepted(true);
47862
47883
  toggleOpen(false);
47863
- }
47884
+ },
47885
+ initialFocusSelector: initialFocusSelector
47864
47886
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47865
47887
  variant: linkVariant,
47866
47888
  onClick: function onClick() {
@@ -47873,7 +47895,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47873
47895
  color: themeValues.linkColor,
47874
47896
  weight: themeValues.fontWeight,
47875
47897
  hoverStyles: themeValues.modalLinkHoverFocus,
47876
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47898
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47899
+ role: "button" // This should always be a "button" since it opens a modal
47900
+ ,
47901
+ className: "modal-trigger"
47877
47902
  }, link));
47878
47903
  };
47879
47904
 
@@ -47886,7 +47911,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47886
47911
  terms = _ref.terms,
47887
47912
  _ref$error = _ref.error,
47888
47913
  error = _ref$error === void 0 ? false : _ref$error,
47889
- linkVariant = _ref.linkVariant;
47914
+ linkVariant = _ref.linkVariant,
47915
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47916
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47890
47917
 
47891
47918
  var _useState = React.useState(false),
47892
47919
  _useState2 = _slicedToArray(_useState, 2),
@@ -47908,7 +47935,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47908
47935
  terms: terms,
47909
47936
  isOpen: showTerms,
47910
47937
  toggleOpen: toggleShowTerms,
47911
- linkVariant: linkVariant
47938
+ linkVariant: linkVariant,
47939
+ initialFocusSelector: initialFocusSelector
47912
47940
  })))));
47913
47941
  };
47914
47942
 
@@ -47939,7 +47967,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47939
47967
  _ref$checkboxMargin = _ref.checkboxMargin,
47940
47968
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47941
47969
  _ref$modalTitle = _ref.modalTitle,
47942
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47970
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47971
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47972
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47943
47973
 
47944
47974
  var _useState = React.useState(false),
47945
47975
  _useState2 = _slicedToArray(_useState, 2),
@@ -47995,7 +48025,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47995
48025
  isOpen: showTerms,
47996
48026
  toggleOpen: toggleTerms,
47997
48027
  linkVariant: modalVariant,
47998
- title: modalTitle
48028
+ title: modalTitle,
48029
+ initialFocusSelector: initialFocusSelector
47999
48030
  })), /*#__PURE__*/React__default.createElement("div", {
48000
48031
  "aria-live": "polite",
48001
48032
  "aria-atomic": true
@@ -48196,7 +48227,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48196
48227
  version: "v2",
48197
48228
  showCheckbox: false,
48198
48229
  description: "View",
48199
- terms: termsContent
48230
+ terms: termsContent,
48231
+ initialFocusSelector: ".modal-close-button"
48200
48232
  })))));
48201
48233
  };
48202
48234
 
@@ -48392,7 +48424,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48392
48424
  version: "v2",
48393
48425
  showCheckbox: false,
48394
48426
  description: "View",
48395
- terms: termsContent
48427
+ terms: termsContent,
48428
+ initialFocusSelector: ".modal-close-button"
48396
48429
  })))));
48397
48430
  };
48398
48431