@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.esm.js CHANGED
@@ -45763,7 +45763,9 @@ var Modal$1 = function Modal(_ref) {
45763
45763
  buttonExtraStyles = _ref.buttonExtraStyles,
45764
45764
  children = _ref.children,
45765
45765
  _ref$dataQa = _ref.dataQa,
45766
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45766
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45767
+ _ref$initialFocusSele = _ref.initialFocusSelector,
45768
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45767
45769
 
45768
45770
  var _useContext = useContext(ThemeContext),
45769
45771
  isMobile = _useContext.isMobile;
@@ -45790,7 +45792,11 @@ var Modal$1 = function Modal(_ref) {
45790
45792
  width: customWidth || "615px",
45791
45793
  overflow: "auto"
45792
45794
  },
45793
- underlayClickExits: underlayClickExits
45795
+ underlayClickExits: underlayClickExits,
45796
+ "aria-modal": true,
45797
+ initialFocus: initialFocusSelector,
45798
+ focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45799
+
45794
45800
  }, /*#__PURE__*/React.createElement(Box, {
45795
45801
  padding: "0",
45796
45802
  borderRadius: "2px",
@@ -45837,7 +45843,9 @@ var Modal$1 = function Modal(_ref) {
45837
45843
  text: cancelButtonText,
45838
45844
  dataQa: cancelButtonText,
45839
45845
  extraStyles: buttonExtraStyles,
45840
- className: "modal-cancel-button"
45846
+ className: "modal-cancel-button",
45847
+ role: "button",
45848
+ name: cancelButtonText
45841
45849
  })), /*#__PURE__*/React.createElement(Box, {
45842
45850
  width: "100%",
45843
45851
  padding: "0"
@@ -45849,7 +45857,9 @@ var Modal$1 = function Modal(_ref) {
45849
45857
  isLoading: isLoading,
45850
45858
  disabled: isContinueActionDisabled,
45851
45859
  extraStyles: buttonExtraStyles,
45852
- className: "modal-continue-button"
45860
+ className: "modal-continue-button",
45861
+ role: "button",
45862
+ name: continueButtonText
45853
45863
  }))) : /*#__PURE__*/React.createElement(Stack, {
45854
45864
  childGap: "1rem",
45855
45865
  direction: "row",
@@ -45860,7 +45870,9 @@ var Modal$1 = function Modal(_ref) {
45860
45870
  text: cancelButtonText,
45861
45871
  dataQa: cancelButtonText,
45862
45872
  extraStyles: buttonExtraStyles,
45863
- className: "modal-cancel-button"
45873
+ className: "modal-cancel-button",
45874
+ role: "button",
45875
+ name: cancelButtonText
45864
45876
  }), /*#__PURE__*/React.createElement(ButtonWithAction, {
45865
45877
  variant: useDangerButton ? "danger" : "primary",
45866
45878
  action: continueAction,
@@ -45869,7 +45881,9 @@ var Modal$1 = function Modal(_ref) {
45869
45881
  isLoading: isLoading,
45870
45882
  disabled: isContinueActionDisabled,
45871
45883
  extraStyles: buttonExtraStyles,
45872
- className: "modal-continue-button"
45884
+ className: "modal-continue-button",
45885
+ role: "button",
45886
+ name: continueButtonText
45873
45887
  }))) : /*#__PURE__*/React.createElement(Box, {
45874
45888
  padding: "0.5rem"
45875
45889
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
@@ -45878,7 +45892,9 @@ var Modal$1 = function Modal(_ref) {
45878
45892
  text: closeButtonText,
45879
45893
  dataQa: closeButtonText,
45880
45894
  extraStyles: buttonExtraStyles,
45881
- className: "modal-close-button"
45895
+ className: "modal-close-button",
45896
+ role: "button",
45897
+ name: closeButtonText
45882
45898
  }))))))))), children);
45883
45899
  };
45884
45900
 
@@ -47710,7 +47726,8 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47710
47726
  continueAction: function continueAction() {
47711
47727
  toggleAccepted(true);
47712
47728
  toggleOpen(false);
47713
- }
47729
+ },
47730
+ initialFocusSelector: "[name='Close']"
47714
47731
  }, /*#__PURE__*/React.createElement(Text$1, {
47715
47732
  variant: "pS",
47716
47733
  onClick: function onClick() {
@@ -47723,7 +47740,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47723
47740
  color: themeValues.linkColor,
47724
47741
  weight: themeValues.fontWeight,
47725
47742
  hoverStyles: themeValues.modalLinkHoverFocus,
47726
- extraStyles: "cursor: pointer;"
47743
+ extraStyles: "cursor: pointer;",
47744
+ role: "button",
47745
+ className: "modal-trigger"
47727
47746
  }, link));
47728
47747
  };
47729
47748
 
@@ -47780,7 +47799,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47780
47799
  variant = _ref.variant,
47781
47800
  _ref$linkVariant = _ref.linkVariant,
47782
47801
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47783
- themeValues = _ref.themeValues;
47802
+ themeValues = _ref.themeValues,
47803
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47804
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47784
47805
  return /*#__PURE__*/React.createElement(Modal$1, {
47785
47806
  modalOpen: isOpen,
47786
47807
  hideModal: function hideModal() {
@@ -47806,7 +47827,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47806
47827
  continueAction: function continueAction() {
47807
47828
  toggleAccepted(true);
47808
47829
  toggleOpen(false);
47809
- }
47830
+ },
47831
+ initialFocusSelector: initialFocusSelector
47810
47832
  }, /*#__PURE__*/React.createElement(Text$1, {
47811
47833
  variant: linkVariant,
47812
47834
  onClick: function onClick() {
@@ -47819,7 +47841,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47819
47841
  color: themeValues.linkColor,
47820
47842
  weight: themeValues.fontWeight,
47821
47843
  hoverStyles: themeValues.modalLinkHoverFocus,
47822
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47844
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47845
+ role: "button" // This should always be a "button" since it opens a modal
47846
+ ,
47847
+ className: "modal-trigger"
47823
47848
  }, link));
47824
47849
  };
47825
47850
 
@@ -47832,7 +47857,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47832
47857
  terms = _ref.terms,
47833
47858
  _ref$error = _ref.error,
47834
47859
  error = _ref$error === void 0 ? false : _ref$error,
47835
- linkVariant = _ref.linkVariant;
47860
+ linkVariant = _ref.linkVariant,
47861
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47862
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47836
47863
 
47837
47864
  var _useState = useState(false),
47838
47865
  _useState2 = _slicedToArray(_useState, 2),
@@ -47854,7 +47881,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47854
47881
  terms: terms,
47855
47882
  isOpen: showTerms,
47856
47883
  toggleOpen: toggleShowTerms,
47857
- linkVariant: linkVariant
47884
+ linkVariant: linkVariant,
47885
+ initialFocusSelector: initialFocusSelector
47858
47886
  })))));
47859
47887
  };
47860
47888
 
@@ -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 = useState(false),
47891
47921
  _useState2 = _slicedToArray(_useState, 2),
@@ -47941,7 +47971,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47941
47971
  isOpen: showTerms,
47942
47972
  toggleOpen: toggleTerms,
47943
47973
  linkVariant: modalVariant,
47944
- title: modalTitle
47974
+ title: modalTitle,
47975
+ initialFocusSelector: initialFocusSelector
47945
47976
  })), /*#__PURE__*/React.createElement("div", {
47946
47977
  "aria-live": "polite",
47947
47978
  "aria-atomic": true
@@ -48142,7 +48173,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48142
48173
  version: "v2",
48143
48174
  showCheckbox: false,
48144
48175
  description: "View",
48145
- terms: termsContent
48176
+ terms: termsContent,
48177
+ initialFocusSelector: ".modal-close-button"
48146
48178
  })))));
48147
48179
  };
48148
48180
 
@@ -48338,7 +48370,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48338
48370
  version: "v2",
48339
48371
  showCheckbox: false,
48340
48372
  description: "View",
48341
- terms: termsContent
48373
+ terms: termsContent,
48374
+ initialFocusSelector: ".modal-close-button"
48342
48375
  })))));
48343
48376
  };
48344
48377