@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.cjs.js CHANGED
@@ -45753,7 +45753,9 @@ var Modal$1 = function Modal(_ref) {
45753
45753
  buttonExtraStyles = _ref.buttonExtraStyles,
45754
45754
  children = _ref.children,
45755
45755
  _ref$dataQa = _ref.dataQa,
45756
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45756
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45757
+ _ref$initialFocus = _ref.initialFocus,
45758
+ initialFocus = _ref$initialFocus === void 0 ? null : _ref$initialFocus;
45757
45759
 
45758
45760
  var _useContext = React.useContext(styled.ThemeContext),
45759
45761
  isMobile = _useContext.isMobile;
@@ -45763,7 +45765,7 @@ var Modal$1 = function Modal(_ref) {
45763
45765
  ref: modalContainerRef,
45764
45766
  "data-qa": dataQa
45765
45767
  }, modalOpen && /*#__PURE__*/React__default.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
45766
- , {
45768
+ , _extends({
45767
45769
  focusTrapOptions: {
45768
45770
  fallbackFocus: modalContainerRef === null || modalContainerRef === void 0 ? void 0 : modalContainerRef.current
45769
45771
  },
@@ -45777,11 +45779,14 @@ var Modal$1 = function Modal(_ref) {
45777
45779
  alignItems: "center"
45778
45780
  },
45779
45781
  dialogStyle: {
45780
- width: customWidth || "615px",
45781
- overflow: "auto"
45782
+ width: customWidth || "615px"
45782
45783
  },
45783
- underlayClickExits: underlayClickExits
45784
- }, /*#__PURE__*/React__default.createElement(Box, {
45784
+ underlayClickExits: underlayClickExits,
45785
+ "aria-modal": true,
45786
+ "aria-name": modalHeaderText
45787
+ }, initialFocus ? {
45788
+ initialFocus: initialFocus
45789
+ } : {}), /*#__PURE__*/React__default.createElement(Box, {
45785
45790
  padding: "0",
45786
45791
  borderRadius: "2px",
45787
45792
  boxShadow: "inset 0px -2px 0px 0px rgb(0, 80, 149)"
@@ -45827,7 +45832,9 @@ var Modal$1 = function Modal(_ref) {
45827
45832
  text: cancelButtonText,
45828
45833
  dataQa: cancelButtonText,
45829
45834
  extraStyles: buttonExtraStyles,
45830
- className: "modal-cancel-button"
45835
+ className: "modal-cancel-button",
45836
+ role: "button",
45837
+ name: cancelButtonText
45831
45838
  })), /*#__PURE__*/React__default.createElement(Box, {
45832
45839
  width: "100%",
45833
45840
  padding: "0"
@@ -45839,7 +45846,9 @@ var Modal$1 = function Modal(_ref) {
45839
45846
  isLoading: isLoading,
45840
45847
  disabled: isContinueActionDisabled,
45841
45848
  extraStyles: buttonExtraStyles,
45842
- className: "modal-continue-button"
45849
+ className: "modal-continue-button",
45850
+ role: "button",
45851
+ name: continueButtonText
45843
45852
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45844
45853
  childGap: "1rem",
45845
45854
  direction: "row",
@@ -45850,7 +45859,9 @@ var Modal$1 = function Modal(_ref) {
45850
45859
  text: cancelButtonText,
45851
45860
  dataQa: cancelButtonText,
45852
45861
  extraStyles: buttonExtraStyles,
45853
- className: "modal-cancel-button"
45862
+ className: "modal-cancel-button",
45863
+ role: "button",
45864
+ name: cancelButtonText
45854
45865
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45855
45866
  variant: useDangerButton ? "danger" : "primary",
45856
45867
  action: continueAction,
@@ -45859,7 +45870,9 @@ var Modal$1 = function Modal(_ref) {
45859
45870
  isLoading: isLoading,
45860
45871
  disabled: isContinueActionDisabled,
45861
45872
  extraStyles: buttonExtraStyles,
45862
- className: "modal-continue-button"
45873
+ className: "modal-continue-button",
45874
+ role: "button",
45875
+ name: continueButtonText
45863
45876
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45864
45877
  padding: "0.5rem"
45865
45878
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45868,7 +45881,9 @@ var Modal$1 = function Modal(_ref) {
45868
45881
  text: closeButtonText,
45869
45882
  dataQa: closeButtonText,
45870
45883
  extraStyles: buttonExtraStyles,
45871
- className: "modal-close-button"
45884
+ className: "modal-close-button",
45885
+ role: "button",
45886
+ name: closeButtonText
45872
45887
  }))))))))), children);
45873
45888
  };
45874
45889
 
@@ -47713,7 +47728,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47713
47728
  color: themeValues.linkColor,
47714
47729
  weight: themeValues.fontWeight,
47715
47730
  hoverStyles: themeValues.modalLinkHoverFocus,
47716
- extraStyles: "cursor: pointer;"
47731
+ extraStyles: "cursor: pointer;",
47732
+ role: "button",
47733
+ className: "modal-trigger"
47717
47734
  }, link));
47718
47735
  };
47719
47736
 
@@ -47770,8 +47787,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47770
47787
  variant = _ref.variant,
47771
47788
  _ref$linkVariant = _ref.linkVariant,
47772
47789
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47773
- themeValues = _ref.themeValues;
47774
- return /*#__PURE__*/React__default.createElement(Modal$1, {
47790
+ themeValues = _ref.themeValues,
47791
+ _ref$initialFocus = _ref.initialFocus,
47792
+ initialFocus = _ref$initialFocus === void 0 ? null : _ref$initialFocus;
47793
+ return /*#__PURE__*/React__default.createElement(Modal$1, _extends({
47775
47794
  modalOpen: isOpen,
47776
47795
  hideModal: function hideModal() {
47777
47796
  return toggleOpen(false);
@@ -47797,7 +47816,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47797
47816
  toggleAccepted(true);
47798
47817
  toggleOpen(false);
47799
47818
  }
47800
- }, /*#__PURE__*/React__default.createElement(Text$1, {
47819
+ }, initialFocus ? {
47820
+ initialFocus: initialFocus
47821
+ } : {}), /*#__PURE__*/React__default.createElement(Text$1, {
47801
47822
  variant: linkVariant,
47802
47823
  onClick: function onClick() {
47803
47824
  return toggleOpen(true);
@@ -47809,7 +47830,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47809
47830
  color: themeValues.linkColor,
47810
47831
  weight: themeValues.fontWeight,
47811
47832
  hoverStyles: themeValues.modalLinkHoverFocus,
47812
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47833
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47834
+ role: "button",
47835
+ className: "modal-trigger"
47813
47836
  }, link));
47814
47837
  };
47815
47838
 
@@ -47844,7 +47867,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47844
47867
  terms: terms,
47845
47868
  isOpen: showTerms,
47846
47869
  toggleOpen: toggleShowTerms,
47847
- linkVariant: linkVariant
47870
+ linkVariant: linkVariant,
47871
+ initialFocus: "[role=\"button\"]:not(.modal-trigger)"
47848
47872
  })))));
47849
47873
  };
47850
47874
 
@@ -47927,7 +47951,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47927
47951
  isOpen: showTerms,
47928
47952
  toggleOpen: toggleTerms,
47929
47953
  linkVariant: modalVariant,
47930
- title: modalTitle
47954
+ title: modalTitle,
47955
+ initialFocus: ".modal-close-button"
47931
47956
  })), /*#__PURE__*/React__default.createElement("div", {
47932
47957
  "aria-live": "polite",
47933
47958
  "aria-atomic": true