@thecb/components 9.2.5 → 9.2.6-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
@@ -45745,7 +45745,9 @@ var Modal$1 = function Modal(_ref) {
45745
45745
  buttonExtraStyles = _ref.buttonExtraStyles,
45746
45746
  children = _ref.children,
45747
45747
  _ref$dataQa = _ref.dataQa,
45748
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45748
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45749
+ _ref$initialFocus = _ref.initialFocus,
45750
+ initialFocus = _ref$initialFocus === void 0 ? null : _ref$initialFocus;
45749
45751
 
45750
45752
  var _useContext = useContext(ThemeContext),
45751
45753
  isMobile = _useContext.isMobile;
@@ -45755,7 +45757,7 @@ var Modal$1 = function Modal(_ref) {
45755
45757
  ref: modalContainerRef,
45756
45758
  "data-qa": dataQa
45757
45759
  }, modalOpen && /*#__PURE__*/React.createElement(reactAriaModal // fallback to resolve Jest unit test errors when tabbable doesn't exist in jsdom https://github.com/focus-trap/focus-trap-react/issues/91
45758
- , {
45760
+ , _extends({
45759
45761
  focusTrapOptions: {
45760
45762
  fallbackFocus: modalContainerRef === null || modalContainerRef === void 0 ? void 0 : modalContainerRef.current
45761
45763
  },
@@ -45769,11 +45771,14 @@ var Modal$1 = function Modal(_ref) {
45769
45771
  alignItems: "center"
45770
45772
  },
45771
45773
  dialogStyle: {
45772
- width: customWidth || "615px",
45773
- overflow: "auto"
45774
+ width: customWidth || "615px"
45774
45775
  },
45775
- underlayClickExits: underlayClickExits
45776
- }, /*#__PURE__*/React.createElement(Box, {
45776
+ underlayClickExits: underlayClickExits,
45777
+ "aria-modal": true,
45778
+ "aria-name": modalHeaderText
45779
+ }, initialFocus ? {
45780
+ initialFocus: initialFocus
45781
+ } : {}), /*#__PURE__*/React.createElement(Box, {
45777
45782
  padding: "0",
45778
45783
  borderRadius: "2px",
45779
45784
  boxShadow: "inset 0px -2px 0px 0px rgb(0, 80, 149)"
@@ -45819,7 +45824,9 @@ var Modal$1 = function Modal(_ref) {
45819
45824
  text: cancelButtonText,
45820
45825
  dataQa: cancelButtonText,
45821
45826
  extraStyles: buttonExtraStyles,
45822
- className: "modal-cancel-button"
45827
+ className: "modal-cancel-button",
45828
+ role: "button",
45829
+ name: cancelButtonText
45823
45830
  })), /*#__PURE__*/React.createElement(Box, {
45824
45831
  width: "100%",
45825
45832
  padding: "0"
@@ -45831,7 +45838,9 @@ var Modal$1 = function Modal(_ref) {
45831
45838
  isLoading: isLoading,
45832
45839
  disabled: isContinueActionDisabled,
45833
45840
  extraStyles: buttonExtraStyles,
45834
- className: "modal-continue-button"
45841
+ className: "modal-continue-button",
45842
+ role: "button",
45843
+ name: continueButtonText
45835
45844
  }))) : /*#__PURE__*/React.createElement(Stack, {
45836
45845
  childGap: "1rem",
45837
45846
  direction: "row",
@@ -45842,7 +45851,9 @@ var Modal$1 = function Modal(_ref) {
45842
45851
  text: cancelButtonText,
45843
45852
  dataQa: cancelButtonText,
45844
45853
  extraStyles: buttonExtraStyles,
45845
- className: "modal-cancel-button"
45854
+ className: "modal-cancel-button",
45855
+ role: "button",
45856
+ name: cancelButtonText
45846
45857
  }), /*#__PURE__*/React.createElement(ButtonWithAction, {
45847
45858
  variant: useDangerButton ? "danger" : "primary",
45848
45859
  action: continueAction,
@@ -45851,7 +45862,9 @@ var Modal$1 = function Modal(_ref) {
45851
45862
  isLoading: isLoading,
45852
45863
  disabled: isContinueActionDisabled,
45853
45864
  extraStyles: buttonExtraStyles,
45854
- className: "modal-continue-button"
45865
+ className: "modal-continue-button",
45866
+ role: "button",
45867
+ name: continueButtonText
45855
45868
  }))) : /*#__PURE__*/React.createElement(Box, {
45856
45869
  padding: "0.5rem"
45857
45870
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
@@ -45860,7 +45873,9 @@ var Modal$1 = function Modal(_ref) {
45860
45873
  text: closeButtonText,
45861
45874
  dataQa: closeButtonText,
45862
45875
  extraStyles: buttonExtraStyles,
45863
- className: "modal-close-button"
45876
+ className: "modal-close-button",
45877
+ role: "button",
45878
+ name: closeButtonText
45864
45879
  }))))))))), children);
45865
45880
  };
45866
45881
 
@@ -47705,7 +47720,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47705
47720
  color: themeValues.linkColor,
47706
47721
  weight: themeValues.fontWeight,
47707
47722
  hoverStyles: themeValues.modalLinkHoverFocus,
47708
- extraStyles: "cursor: pointer;"
47723
+ extraStyles: "cursor: pointer;",
47724
+ role: "button",
47725
+ className: "modal-trigger"
47709
47726
  }, link));
47710
47727
  };
47711
47728
 
@@ -47762,8 +47779,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47762
47779
  variant = _ref.variant,
47763
47780
  _ref$linkVariant = _ref.linkVariant,
47764
47781
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47765
- themeValues = _ref.themeValues;
47766
- return /*#__PURE__*/React.createElement(Modal$1, {
47782
+ themeValues = _ref.themeValues,
47783
+ _ref$initialFocus = _ref.initialFocus,
47784
+ initialFocus = _ref$initialFocus === void 0 ? null : _ref$initialFocus;
47785
+ return /*#__PURE__*/React.createElement(Modal$1, _extends({
47767
47786
  modalOpen: isOpen,
47768
47787
  hideModal: function hideModal() {
47769
47788
  return toggleOpen(false);
@@ -47789,7 +47808,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47789
47808
  toggleAccepted(true);
47790
47809
  toggleOpen(false);
47791
47810
  }
47792
- }, /*#__PURE__*/React.createElement(Text$1, {
47811
+ }, initialFocus ? {
47812
+ initialFocus: initialFocus
47813
+ } : {}), /*#__PURE__*/React.createElement(Text$1, {
47793
47814
  variant: linkVariant,
47794
47815
  onClick: function onClick() {
47795
47816
  return toggleOpen(true);
@@ -47801,7 +47822,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47801
47822
  color: themeValues.linkColor,
47802
47823
  weight: themeValues.fontWeight,
47803
47824
  hoverStyles: themeValues.modalLinkHoverFocus,
47804
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47825
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47826
+ role: "button",
47827
+ className: "modal-trigger"
47805
47828
  }, link));
47806
47829
  };
47807
47830
 
@@ -47836,7 +47859,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47836
47859
  terms: terms,
47837
47860
  isOpen: showTerms,
47838
47861
  toggleOpen: toggleShowTerms,
47839
- linkVariant: linkVariant
47862
+ linkVariant: linkVariant,
47863
+ initialFocus: "[role=\"button\"]:not(.modal-trigger)"
47840
47864
  })))));
47841
47865
  };
47842
47866
 
@@ -47919,7 +47943,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47919
47943
  isOpen: showTerms,
47920
47944
  toggleOpen: toggleTerms,
47921
47945
  linkVariant: modalVariant,
47922
- title: modalTitle
47946
+ title: modalTitle,
47947
+ initialFocus: ".modal-close-button"
47923
47948
  })), /*#__PURE__*/React.createElement("div", {
47924
47949
  "aria-live": "polite",
47925
47950
  "aria-atomic": true