@thecb/components 9.2.10-beta.8 → 9.2.10

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
 
@@ -47802,9 +47788,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47802
47788
  variant = _ref.variant,
47803
47789
  _ref$linkVariant = _ref.linkVariant,
47804
47790
  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;
47791
+ themeValues = _ref.themeValues;
47808
47792
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47809
47793
  modalOpen: isOpen,
47810
47794
  hideModal: function hideModal() {
@@ -47830,8 +47814,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47830
47814
  continueAction: function continueAction() {
47831
47815
  toggleAccepted(true);
47832
47816
  toggleOpen(false);
47833
- },
47834
- initialFocusSelector: initialFocusSelector
47817
+ }
47835
47818
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47836
47819
  variant: linkVariant,
47837
47820
  onClick: function onClick() {
@@ -47844,10 +47827,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47844
47827
  color: themeValues.linkColor,
47845
47828
  weight: themeValues.fontWeight,
47846
47829
  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"
47830
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47851
47831
  }, link));
47852
47832
  };
47853
47833
 
@@ -47860,11 +47840,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47860
47840
  terms = _ref.terms,
47861
47841
  _ref$error = _ref.error,
47862
47842
  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;
47843
+ linkVariant = _ref.linkVariant;
47868
47844
 
47869
47845
  var _useState = React.useState(false),
47870
47846
  _useState2 = _slicedToArray(_useState, 2),
@@ -47876,23 +47852,22 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47876
47852
  title: "Terms and Conditions",
47877
47853
  error: error,
47878
47854
  checked: isChecked,
47879
- onChange: onCheck,
47880
- "aria-labelledby": "".concat(id, "_label")
47855
+ onChange: onCheck
47881
47856
  }), /*#__PURE__*/React__default.createElement(Box, {
47882
47857
  padding: "0 0 0 58px"
47883
47858
  }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47884
- padding: "0",
47885
- id: "".concat(id, "_label")
47859
+ padding: "0"
47886
47860
  }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47887
47861
  link: "Learn More",
47888
47862
  terms: terms,
47889
47863
  isOpen: showTerms,
47890
47864
  toggleOpen: toggleShowTerms,
47891
- linkVariant: linkVariant,
47892
- initialFocusSelector: initialFocusSelector
47865
+ linkVariant: linkVariant
47893
47866
  })))));
47894
47867
  };
47895
47868
 
47869
+ var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
47870
+
47896
47871
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47897
47872
  var _ref$showCheckbox = _ref.showCheckbox,
47898
47873
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -47918,9 +47893,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47918
47893
  _ref$checkboxMargin = _ref.checkboxMargin,
47919
47894
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47920
47895
  _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;
47896
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47924
47897
 
47925
47898
  var _useState = React.useState(false),
47926
47899
  _useState2 = _slicedToArray(_useState, 2),
@@ -47946,8 +47919,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47946
47919
  }, /*#__PURE__*/React__default.createElement(Stack, {
47947
47920
  childGap: "0"
47948
47921
  }, html && /*#__PURE__*/React__default.createElement(Box, {
47949
- padding: "0",
47950
- id: "".concat(id, "_label")
47922
+ padding: "0"
47951
47923
  }, html), /*#__PURE__*/React__default.createElement(Cluster, {
47952
47924
  justify: "flex-start",
47953
47925
  align: "center",
@@ -47959,7 +47931,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47959
47931
  onChange: onCheck,
47960
47932
  checkboxMargin: checkboxMargin,
47961
47933
  extraStyles: "align-self: flex-start;",
47962
- "aria-labelledby": "".concat(id, "_label")
47934
+ labelledById: TermsAndConditionsTitleDivId
47963
47935
  }), /*#__PURE__*/React__default.createElement(Stack, {
47964
47936
  childGap: "0.25rem",
47965
47937
  fullHeight: true
@@ -47967,7 +47939,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47967
47939
  justify: "flex-start",
47968
47940
  align: "center",
47969
47941
  nowrap: true,
47970
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
47942
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
47943
+ id: TermsAndConditionsTitleDivId
47971
47944
  }, description && /*#__PURE__*/React__default.createElement(Text$1, {
47972
47945
  color: CHARADE_GREY
47973
47946
  }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
@@ -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