@thecb/components 9.2.10-beta.8 → 9.2.11-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
@@ -22145,6 +22145,7 @@ var Checkbox = function Checkbox(_ref4) {
22145
22145
  checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
22146
22146
  extraStyles = _ref4.extraStyles,
22147
22147
  textExtraStyles = _ref4.textExtraStyles,
22148
+ labelledById = _ref4.labelledById,
22148
22149
  _ref4$dataQa = _ref4.dataQa,
22149
22150
  dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
22150
22151
 
@@ -22159,6 +22160,9 @@ var Checkbox = function Checkbox(_ref4) {
22159
22160
  }
22160
22161
  };
22161
22162
 
22163
+ var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22164
+ var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22165
+ var ariaLabel = ariaLabelledById ? undefined : name;
22162
22166
  return /*#__PURE__*/React__default.createElement(Box, {
22163
22167
  padding: "0",
22164
22168
  tabIndex: "0",
@@ -22182,6 +22186,8 @@ var Checkbox = function Checkbox(_ref4) {
22182
22186
  id: "checkbox-".concat(name),
22183
22187
  disabled: disabled,
22184
22188
  name: name,
22189
+ "aria-label": ariaLabel,
22190
+ "aria-labelledby": ariaLabelledById,
22185
22191
  checked: checked,
22186
22192
  onChange: onChange,
22187
22193
  tabIndex: "-1",
@@ -22199,8 +22205,7 @@ var Checkbox = function Checkbox(_ref4) {
22199
22205
  errorStyles: themeValues.errorStyles,
22200
22206
  disabledStyles: themeValues.disabledStyles,
22201
22207
  disabledCheckedStyles: themeValues.disabledCheckedStyles,
22202
- focusedStyles: themeValues.focusedStyles,
22203
- "aria-labelledby": "".concat(name, "_title_id")
22208
+ focusedStyles: themeValues.focusedStyles
22204
22209
  }, /*#__PURE__*/React__default.createElement(CheckboxIcon, {
22205
22210
  viewBox: "0 0 24 24",
22206
22211
  disabled: disabled,
@@ -22209,10 +22214,10 @@ var Checkbox = function Checkbox(_ref4) {
22209
22214
  }, /*#__PURE__*/React__default.createElement("polyline", {
22210
22215
  points: "20 6 9 17 4 12"
22211
22216
  })))), title && /*#__PURE__*/React__default.createElement(Text$1, {
22217
+ id: titleId,
22212
22218
  variant: "p",
22213
22219
  weight: themeValues.textFontWeight,
22214
22220
  color: themeValues.textColor,
22215
- id: "".concat(name, "_title_id"),
22216
22221
  extraStyles: textExtraStyles ? "".concat(textExtraStyles, " ").concat(disabled && "color: #6e727e; background-color: #f7f7f7;", " ") : "margin-left: 1rem ".concat(disabled && "color: #6e727e; background-color: #f7f7f7;")
22217
22222
  }, title)));
22218
22223
  };
@@ -45766,9 +45771,7 @@ var Modal$1 = function Modal(_ref) {
45766
45771
  buttonExtraStyles = _ref.buttonExtraStyles,
45767
45772
  children = _ref.children,
45768
45773
  _ref$dataQa = _ref.dataQa,
45769
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45770
- _ref$initialFocusSele = _ref.initialFocusSelector,
45771
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45774
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45772
45775
 
45773
45776
  var _useContext = React.useContext(styled.ThemeContext),
45774
45777
  isMobile = _useContext.isMobile;
@@ -45795,11 +45798,7 @@ var Modal$1 = function Modal(_ref) {
45795
45798
  width: customWidth || "615px",
45796
45799
  overflow: "auto"
45797
45800
  },
45798
- underlayClickExits: underlayClickExits,
45799
- "aria-modal": true,
45800
- initialFocus: initialFocusSelector,
45801
- focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45802
-
45801
+ underlayClickExits: underlayClickExits
45803
45802
  }, /*#__PURE__*/React__default.createElement(Box, {
45804
45803
  padding: "0",
45805
45804
  borderRadius: "2px",
@@ -45846,9 +45845,7 @@ var Modal$1 = function Modal(_ref) {
45846
45845
  text: cancelButtonText,
45847
45846
  dataQa: cancelButtonText,
45848
45847
  extraStyles: buttonExtraStyles,
45849
- className: "modal-cancel-button",
45850
- role: "button",
45851
- name: cancelButtonText
45848
+ className: "modal-cancel-button"
45852
45849
  })), /*#__PURE__*/React__default.createElement(Box, {
45853
45850
  width: "100%",
45854
45851
  padding: "0"
@@ -45860,9 +45857,7 @@ var Modal$1 = function Modal(_ref) {
45860
45857
  isLoading: isLoading,
45861
45858
  disabled: isContinueActionDisabled,
45862
45859
  extraStyles: buttonExtraStyles,
45863
- className: "modal-continue-button",
45864
- role: "button",
45865
- name: continueButtonText
45860
+ className: "modal-continue-button"
45866
45861
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45867
45862
  childGap: "1rem",
45868
45863
  direction: "row",
@@ -45873,9 +45868,7 @@ var Modal$1 = function Modal(_ref) {
45873
45868
  text: cancelButtonText,
45874
45869
  dataQa: cancelButtonText,
45875
45870
  extraStyles: buttonExtraStyles,
45876
- className: "modal-cancel-button",
45877
- role: "button",
45878
- name: cancelButtonText
45871
+ className: "modal-cancel-button"
45879
45872
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45880
45873
  variant: useDangerButton ? "danger" : "primary",
45881
45874
  action: continueAction,
@@ -45884,9 +45877,7 @@ var Modal$1 = function Modal(_ref) {
45884
45877
  isLoading: isLoading,
45885
45878
  disabled: isContinueActionDisabled,
45886
45879
  extraStyles: buttonExtraStyles,
45887
- className: "modal-continue-button",
45888
- role: "button",
45889
- name: continueButtonText
45880
+ className: "modal-continue-button"
45890
45881
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45891
45882
  padding: "0.5rem"
45892
45883
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45895,9 +45886,7 @@ var Modal$1 = function Modal(_ref) {
45895
45886
  text: closeButtonText,
45896
45887
  dataQa: closeButtonText,
45897
45888
  extraStyles: buttonExtraStyles,
45898
- className: "modal-close-button",
45899
- role: "button",
45900
- name: closeButtonText
45889
+ className: "modal-close-button"
45901
45890
  }))))))))), children);
45902
45891
  };
45903
45892
 
@@ -47729,8 +47718,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47729
47718
  continueAction: function continueAction() {
47730
47719
  toggleAccepted(true);
47731
47720
  toggleOpen(false);
47732
- },
47733
- initialFocusSelector: "[name='Close']"
47721
+ }
47734
47722
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47735
47723
  variant: "pS",
47736
47724
  onClick: function onClick() {
@@ -47743,9 +47731,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47743
47731
  color: themeValues.linkColor,
47744
47732
  weight: themeValues.fontWeight,
47745
47733
  hoverStyles: themeValues.modalLinkHoverFocus,
47746
- extraStyles: "cursor: pointer;",
47747
- role: "button",
47748
- className: "modal-trigger"
47734
+ extraStyles: "cursor: pointer;"
47749
47735
  }, link));
47750
47736
  };
47751
47737
 
@@ -47790,6 +47776,8 @@ var fallbackValues$P = {
47790
47776
  modalLinkHoverFocus: modalLinkHoverFocus$2
47791
47777
  };
47792
47778
 
47779
+ var TermsAndConditionsModalLinkId = "terms-and-conditions-link";
47780
+
47793
47781
  var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47794
47782
  var link = _ref.link,
47795
47783
  _ref$title = _ref.title,
@@ -47802,9 +47790,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47802
47790
  variant = _ref.variant,
47803
47791
  _ref$linkVariant = _ref.linkVariant,
47804
47792
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47805
- themeValues = _ref.themeValues,
47806
- _ref$initialFocusSele = _ref.initialFocusSelector,
47807
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47793
+ themeValues = _ref.themeValues;
47808
47794
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47809
47795
  modalOpen: isOpen,
47810
47796
  hideModal: function hideModal() {
@@ -47830,9 +47816,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47830
47816
  continueAction: function continueAction() {
47831
47817
  toggleAccepted(true);
47832
47818
  toggleOpen(false);
47833
- },
47834
- initialFocusSelector: initialFocusSelector
47819
+ }
47835
47820
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47821
+ id: TermsAndConditionsModalLinkId,
47836
47822
  variant: linkVariant,
47837
47823
  onClick: function onClick() {
47838
47824
  return toggleOpen(true);
@@ -47844,10 +47830,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47844
47830
  color: themeValues.linkColor,
47845
47831
  weight: themeValues.fontWeight,
47846
47832
  hoverStyles: themeValues.modalLinkHoverFocus,
47847
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47848
- role: "button" // This should always be a "button" since it opens a modal
47849
- ,
47850
- className: "modal-trigger"
47833
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47851
47834
  }, link));
47852
47835
  };
47853
47836
 
@@ -47860,11 +47843,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47860
47843
  terms = _ref.terms,
47861
47844
  _ref$error = _ref.error,
47862
47845
  error = _ref$error === void 0 ? false : _ref$error,
47863
- linkVariant = _ref.linkVariant,
47864
- _ref$initialFocusSele = _ref.initialFocusSelector,
47865
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
47866
- _ref$id = _ref.id,
47867
- id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id;
47846
+ linkVariant = _ref.linkVariant;
47868
47847
 
47869
47848
  var _useState = React.useState(false),
47870
47849
  _useState2 = _slicedToArray(_useState, 2),
@@ -47876,20 +47855,17 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47876
47855
  title: "Terms and Conditions",
47877
47856
  error: error,
47878
47857
  checked: isChecked,
47879
- onChange: onCheck,
47880
- "aria-labelledby": "".concat(id, "_label")
47858
+ onChange: onCheck
47881
47859
  }), /*#__PURE__*/React__default.createElement(Box, {
47882
47860
  padding: "0 0 0 58px"
47883
47861
  }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47884
- padding: "0",
47885
- id: "".concat(id, "_label")
47862
+ padding: "0"
47886
47863
  }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47887
47864
  link: "Learn More",
47888
47865
  terms: terms,
47889
47866
  isOpen: showTerms,
47890
47867
  toggleOpen: toggleShowTerms,
47891
- linkVariant: linkVariant,
47892
- initialFocusSelector: initialFocusSelector
47868
+ linkVariant: linkVariant
47893
47869
  })))));
47894
47870
  };
47895
47871
 
@@ -47918,9 +47894,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47918
47894
  _ref$checkboxMargin = _ref.checkboxMargin,
47919
47895
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47920
47896
  _ref$modalTitle = _ref.modalTitle,
47921
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47922
- _ref$initialFocusSele = _ref.initialFocusSelector,
47923
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47897
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47924
47898
 
47925
47899
  var _useState = React.useState(false),
47926
47900
  _useState2 = _slicedToArray(_useState, 2),
@@ -47946,8 +47920,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47946
47920
  }, /*#__PURE__*/React__default.createElement(Stack, {
47947
47921
  childGap: "0"
47948
47922
  }, html && /*#__PURE__*/React__default.createElement(Box, {
47949
- padding: "0",
47950
- id: "".concat(id, "_label")
47923
+ padding: "0"
47951
47924
  }, html), /*#__PURE__*/React__default.createElement(Cluster, {
47952
47925
  justify: "flex-start",
47953
47926
  align: "center",
@@ -47959,7 +47932,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47959
47932
  onChange: onCheck,
47960
47933
  checkboxMargin: checkboxMargin,
47961
47934
  extraStyles: "align-self: flex-start;",
47962
- "aria-labelledby": "".concat(id, "_label")
47935
+ labelledById: TermsAndConditionsModalLinkId
47963
47936
  }), /*#__PURE__*/React__default.createElement(Stack, {
47964
47937
  childGap: "0.25rem",
47965
47938
  fullHeight: true
@@ -47976,8 +47949,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47976
47949
  isOpen: showTerms,
47977
47950
  toggleOpen: toggleTerms,
47978
47951
  linkVariant: modalVariant,
47979
- title: modalTitle,
47980
- initialFocusSelector: initialFocusSelector
47952
+ title: modalTitle
47981
47953
  })), /*#__PURE__*/React__default.createElement("div", {
47982
47954
  "aria-live": "polite",
47983
47955
  "aria-atomic": true
@@ -48178,8 +48150,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48178
48150
  version: "v2",
48179
48151
  showCheckbox: false,
48180
48152
  description: "View",
48181
- terms: termsContent,
48182
- initialFocusSelector: ".modal-close-button"
48153
+ terms: termsContent
48183
48154
  })))));
48184
48155
  };
48185
48156
 
@@ -48375,8 +48346,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48375
48346
  version: "v2",
48376
48347
  showCheckbox: false,
48377
48348
  description: "View",
48378
- terms: termsContent,
48379
- initialFocusSelector: ".modal-close-button"
48349
+ terms: termsContent
48380
48350
  })))));
48381
48351
  };
48382
48352