@thecb/components 9.2.9 → 9.2.10-beta.1

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
@@ -45757,7 +45757,11 @@ var Modal$1 = function Modal(_ref) {
45757
45757
  buttonExtraStyles = _ref.buttonExtraStyles,
45758
45758
  children = _ref.children,
45759
45759
  _ref$dataQa = _ref.dataQa,
45760
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45760
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45761
+ _ref$initialFocusSele = _ref.initialFocusSelector,
45762
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
45763
+ _ref$modalName = _ref.modalName,
45764
+ modalName = _ref$modalName === void 0 ? "" : _ref$modalName;
45761
45765
 
45762
45766
  var _useContext = useContext(ThemeContext),
45763
45767
  isMobile = _useContext.isMobile;
@@ -45784,7 +45788,10 @@ var Modal$1 = function Modal(_ref) {
45784
45788
  width: customWidth || "615px",
45785
45789
  overflow: "auto"
45786
45790
  },
45787
- underlayClickExits: underlayClickExits
45791
+ underlayClickExits: underlayClickExits,
45792
+ "aria-modal": true,
45793
+ "aria-name": !!modalName.length ? modalName : modalHeaderText,
45794
+ initialFocus: initialFocusSelector
45788
45795
  }, /*#__PURE__*/React.createElement(Box, {
45789
45796
  padding: "0",
45790
45797
  borderRadius: "2px",
@@ -45831,7 +45838,9 @@ var Modal$1 = function Modal(_ref) {
45831
45838
  text: cancelButtonText,
45832
45839
  dataQa: cancelButtonText,
45833
45840
  extraStyles: buttonExtraStyles,
45834
- className: "modal-cancel-button"
45841
+ className: "modal-cancel-button",
45842
+ role: "button",
45843
+ name: cancelButtonText
45835
45844
  })), /*#__PURE__*/React.createElement(Box, {
45836
45845
  width: "100%",
45837
45846
  padding: "0"
@@ -45843,7 +45852,9 @@ var Modal$1 = function Modal(_ref) {
45843
45852
  isLoading: isLoading,
45844
45853
  disabled: isContinueActionDisabled,
45845
45854
  extraStyles: buttonExtraStyles,
45846
- className: "modal-continue-button"
45855
+ className: "modal-continue-button",
45856
+ role: "button",
45857
+ name: continueButtonText
45847
45858
  }))) : /*#__PURE__*/React.createElement(Stack, {
45848
45859
  childGap: "1rem",
45849
45860
  direction: "row",
@@ -45854,7 +45865,9 @@ var Modal$1 = function Modal(_ref) {
45854
45865
  text: cancelButtonText,
45855
45866
  dataQa: cancelButtonText,
45856
45867
  extraStyles: buttonExtraStyles,
45857
- className: "modal-cancel-button"
45868
+ className: "modal-cancel-button",
45869
+ role: "button",
45870
+ name: cancelButtonText
45858
45871
  }), /*#__PURE__*/React.createElement(ButtonWithAction, {
45859
45872
  variant: useDangerButton ? "danger" : "primary",
45860
45873
  action: continueAction,
@@ -45863,7 +45876,9 @@ var Modal$1 = function Modal(_ref) {
45863
45876
  isLoading: isLoading,
45864
45877
  disabled: isContinueActionDisabled,
45865
45878
  extraStyles: buttonExtraStyles,
45866
- className: "modal-continue-button"
45879
+ className: "modal-continue-button",
45880
+ role: "button",
45881
+ name: continueButtonText
45867
45882
  }))) : /*#__PURE__*/React.createElement(Box, {
45868
45883
  padding: "0.5rem"
45869
45884
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
@@ -45872,7 +45887,9 @@ var Modal$1 = function Modal(_ref) {
45872
45887
  text: closeButtonText,
45873
45888
  dataQa: closeButtonText,
45874
45889
  extraStyles: buttonExtraStyles,
45875
- className: "modal-close-button"
45890
+ className: "modal-close-button",
45891
+ role: "button",
45892
+ name: closeButtonText
45876
45893
  }))))))))), children);
45877
45894
  };
45878
45895
 
@@ -47717,7 +47734,9 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47717
47734
  color: themeValues.linkColor,
47718
47735
  weight: themeValues.fontWeight,
47719
47736
  hoverStyles: themeValues.modalLinkHoverFocus,
47720
- extraStyles: "cursor: pointer;"
47737
+ extraStyles: "cursor: pointer;",
47738
+ role: "button",
47739
+ className: "modal-trigger"
47721
47740
  }, link));
47722
47741
  };
47723
47742
 
@@ -47774,7 +47793,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47774
47793
  variant = _ref.variant,
47775
47794
  _ref$linkVariant = _ref.linkVariant,
47776
47795
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47777
- themeValues = _ref.themeValues;
47796
+ themeValues = _ref.themeValues,
47797
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47798
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47778
47799
  return /*#__PURE__*/React.createElement(Modal$1, {
47779
47800
  modalOpen: isOpen,
47780
47801
  hideModal: function hideModal() {
@@ -47800,7 +47821,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47800
47821
  continueAction: function continueAction() {
47801
47822
  toggleAccepted(true);
47802
47823
  toggleOpen(false);
47803
- }
47824
+ },
47825
+ initialFocusSelector: initialFocusSelector
47804
47826
  }, /*#__PURE__*/React.createElement(Text$1, {
47805
47827
  variant: linkVariant,
47806
47828
  onClick: function onClick() {
@@ -47813,7 +47835,10 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47813
47835
  color: themeValues.linkColor,
47814
47836
  weight: themeValues.fontWeight,
47815
47837
  hoverStyles: themeValues.modalLinkHoverFocus,
47816
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47838
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47839
+ role: "button" // This should always be a "button" since it opens a modal
47840
+ ,
47841
+ className: "modal-trigger"
47817
47842
  }, link));
47818
47843
  };
47819
47844
 
@@ -47826,7 +47851,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47826
47851
  terms = _ref.terms,
47827
47852
  _ref$error = _ref.error,
47828
47853
  error = _ref$error === void 0 ? false : _ref$error,
47829
- linkVariant = _ref.linkVariant;
47854
+ linkVariant = _ref.linkVariant,
47855
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47856
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47830
47857
 
47831
47858
  var _useState = useState(false),
47832
47859
  _useState2 = _slicedToArray(_useState, 2),
@@ -47848,7 +47875,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47848
47875
  terms: terms,
47849
47876
  isOpen: showTerms,
47850
47877
  toggleOpen: toggleShowTerms,
47851
- linkVariant: linkVariant
47878
+ linkVariant: linkVariant,
47879
+ initialFocusSelector: initialFocusSelector
47852
47880
  })))));
47853
47881
  };
47854
47882
 
@@ -47877,7 +47905,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47877
47905
  _ref$checkboxMargin = _ref.checkboxMargin,
47878
47906
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47879
47907
  _ref$modalTitle = _ref.modalTitle,
47880
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47908
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47909
+ _ref$initialFocusSele = _ref.initialFocusSelector,
47910
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47881
47911
 
47882
47912
  var _useState = useState(false),
47883
47913
  _useState2 = _slicedToArray(_useState, 2),
@@ -47931,7 +47961,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47931
47961
  isOpen: showTerms,
47932
47962
  toggleOpen: toggleTerms,
47933
47963
  linkVariant: modalVariant,
47934
- title: modalTitle
47964
+ title: modalTitle,
47965
+ initialFocusSelector: initialFocusSelector
47935
47966
  })), /*#__PURE__*/React.createElement("div", {
47936
47967
  "aria-live": "polite",
47937
47968
  "aria-atomic": true
@@ -47950,7 +47981,9 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
47950
47981
  rest = _objectWithoutProperties(_ref, _excluded$y);
47951
47982
 
47952
47983
  var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
47953
- return /*#__PURE__*/React.createElement(TermsAndConditionsControl, rest);
47984
+ return /*#__PURE__*/React.createElement(TermsAndConditionsControl, _extends({
47985
+ initialFocusSelector: "[role='button']:not(.modal-trigger)"
47986
+ }, rest));
47954
47987
  };
47955
47988
 
47956
47989
  var PaymentFormACH = function PaymentFormACH(_ref) {