@thecb/components 9.2.10-beta.9 → 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",
@@ -22175,14 +22179,15 @@ var Checkbox = function Checkbox(_ref4) {
22175
22179
  background: themeValues.backgroundColor,
22176
22180
  extraStyles: "outline: none; ".concat(extraStyles, "; margin: ").concat(checkboxMargin, ";")
22177
22181
  }, /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, {
22178
- "data-qa": dataQa,
22179
- id: "".concat(id, "_label_container")
22182
+ "data-qa": dataQa
22180
22183
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22181
22184
  "data-qa": "Checkbox"
22182
22185
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22183
22186
  id: "checkbox-".concat(name),
22184
22187
  disabled: disabled,
22185
22188
  name: name,
22189
+ "aria-label": ariaLabel,
22190
+ "aria-labelledby": ariaLabelledById,
22186
22191
  checked: checked,
22187
22192
  onChange: onChange,
22188
22193
  tabIndex: "-1",
@@ -22200,8 +22205,7 @@ var Checkbox = function Checkbox(_ref4) {
22200
22205
  errorStyles: themeValues.errorStyles,
22201
22206
  disabledStyles: themeValues.disabledStyles,
22202
22207
  disabledCheckedStyles: themeValues.disabledCheckedStyles,
22203
- focusedStyles: themeValues.focusedStyles,
22204
- "aria-labelledby": title ? "".concat(name, "_title_id") : "".concat(id, "_label_container")
22208
+ focusedStyles: themeValues.focusedStyles
22205
22209
  }, /*#__PURE__*/React__default.createElement(CheckboxIcon, {
22206
22210
  viewBox: "0 0 24 24",
22207
22211
  disabled: disabled,
@@ -22210,10 +22214,10 @@ var Checkbox = function Checkbox(_ref4) {
22210
22214
  }, /*#__PURE__*/React__default.createElement("polyline", {
22211
22215
  points: "20 6 9 17 4 12"
22212
22216
  })))), title && /*#__PURE__*/React__default.createElement(Text$1, {
22217
+ id: titleId,
22213
22218
  variant: "p",
22214
22219
  weight: themeValues.textFontWeight,
22215
22220
  color: themeValues.textColor,
22216
- id: "".concat(name, "_title_id"),
22217
22221
  extraStyles: textExtraStyles ? "".concat(textExtraStyles, " ").concat(disabled && "color: #6e727e; background-color: #f7f7f7;", " ") : "margin-left: 1rem ".concat(disabled && "color: #6e727e; background-color: #f7f7f7;")
22218
22222
  }, title)));
22219
22223
  };
@@ -22717,12 +22721,12 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
22717
22721
  return hasOwnProperty(toObject(it), key);
22718
22722
  };
22719
22723
 
22720
- var id$1 = 0;
22724
+ var id = 0;
22721
22725
  var postfix = Math.random();
22722
22726
  var toString$3 = functionUncurryThis(1.0.toString);
22723
22727
 
22724
22728
  var uid = function (key) {
22725
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id$1 + postfix, 36);
22729
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
22726
22730
  };
22727
22731
 
22728
22732
  var WellKnownSymbolsStore = shared('wks');
@@ -45767,9 +45771,7 @@ var Modal$1 = function Modal(_ref) {
45767
45771
  buttonExtraStyles = _ref.buttonExtraStyles,
45768
45772
  children = _ref.children,
45769
45773
  _ref$dataQa = _ref.dataQa,
45770
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45771
- _ref$initialFocusSele = _ref.initialFocusSelector,
45772
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45774
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45773
45775
 
45774
45776
  var _useContext = React.useContext(styled.ThemeContext),
45775
45777
  isMobile = _useContext.isMobile;
@@ -45796,11 +45798,7 @@ var Modal$1 = function Modal(_ref) {
45796
45798
  width: customWidth || "615px",
45797
45799
  overflow: "auto"
45798
45800
  },
45799
- underlayClickExits: underlayClickExits,
45800
- "aria-modal": true,
45801
- initialFocus: initialFocusSelector,
45802
- focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45803
-
45801
+ underlayClickExits: underlayClickExits
45804
45802
  }, /*#__PURE__*/React__default.createElement(Box, {
45805
45803
  padding: "0",
45806
45804
  borderRadius: "2px",
@@ -45847,9 +45845,7 @@ var Modal$1 = function Modal(_ref) {
45847
45845
  text: cancelButtonText,
45848
45846
  dataQa: cancelButtonText,
45849
45847
  extraStyles: buttonExtraStyles,
45850
- className: "modal-cancel-button",
45851
- role: "button",
45852
- name: cancelButtonText
45848
+ className: "modal-cancel-button"
45853
45849
  })), /*#__PURE__*/React__default.createElement(Box, {
45854
45850
  width: "100%",
45855
45851
  padding: "0"
@@ -45861,9 +45857,7 @@ var Modal$1 = function Modal(_ref) {
45861
45857
  isLoading: isLoading,
45862
45858
  disabled: isContinueActionDisabled,
45863
45859
  extraStyles: buttonExtraStyles,
45864
- className: "modal-continue-button",
45865
- role: "button",
45866
- name: continueButtonText
45860
+ className: "modal-continue-button"
45867
45861
  }))) : /*#__PURE__*/React__default.createElement(Stack, {
45868
45862
  childGap: "1rem",
45869
45863
  direction: "row",
@@ -45874,9 +45868,7 @@ var Modal$1 = function Modal(_ref) {
45874
45868
  text: cancelButtonText,
45875
45869
  dataQa: cancelButtonText,
45876
45870
  extraStyles: buttonExtraStyles,
45877
- className: "modal-cancel-button",
45878
- role: "button",
45879
- name: cancelButtonText
45871
+ className: "modal-cancel-button"
45880
45872
  }), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
45881
45873
  variant: useDangerButton ? "danger" : "primary",
45882
45874
  action: continueAction,
@@ -45885,9 +45877,7 @@ var Modal$1 = function Modal(_ref) {
45885
45877
  isLoading: isLoading,
45886
45878
  disabled: isContinueActionDisabled,
45887
45879
  extraStyles: buttonExtraStyles,
45888
- className: "modal-continue-button",
45889
- role: "button",
45890
- name: continueButtonText
45880
+ className: "modal-continue-button"
45891
45881
  }))) : /*#__PURE__*/React__default.createElement(Box, {
45892
45882
  padding: "0.5rem"
45893
45883
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -45896,9 +45886,7 @@ var Modal$1 = function Modal(_ref) {
45896
45886
  text: closeButtonText,
45897
45887
  dataQa: closeButtonText,
45898
45888
  extraStyles: buttonExtraStyles,
45899
- className: "modal-close-button",
45900
- role: "button",
45901
- name: closeButtonText
45889
+ className: "modal-close-button"
45902
45890
  }))))))))), children);
45903
45891
  };
45904
45892
 
@@ -47730,8 +47718,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47730
47718
  continueAction: function continueAction() {
47731
47719
  toggleAccepted(true);
47732
47720
  toggleOpen(false);
47733
- },
47734
- initialFocusSelector: "[name='Close']"
47721
+ }
47735
47722
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47736
47723
  variant: "pS",
47737
47724
  onClick: function onClick() {
@@ -47744,9 +47731,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47744
47731
  color: themeValues.linkColor,
47745
47732
  weight: themeValues.fontWeight,
47746
47733
  hoverStyles: themeValues.modalLinkHoverFocus,
47747
- extraStyles: "cursor: pointer;",
47748
- role: "button",
47749
- className: "modal-trigger"
47734
+ extraStyles: "cursor: pointer;"
47750
47735
  }, link));
47751
47736
  };
47752
47737
 
@@ -47791,6 +47776,8 @@ var fallbackValues$P = {
47791
47776
  modalLinkHoverFocus: modalLinkHoverFocus$2
47792
47777
  };
47793
47778
 
47779
+ var TermsAndConditionsModalLinkId = "terms-and-conditions-link";
47780
+
47794
47781
  var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47795
47782
  var link = _ref.link,
47796
47783
  _ref$title = _ref.title,
@@ -47803,9 +47790,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47803
47790
  variant = _ref.variant,
47804
47791
  _ref$linkVariant = _ref.linkVariant,
47805
47792
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47806
- themeValues = _ref.themeValues,
47807
- _ref$initialFocusSele = _ref.initialFocusSelector,
47808
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47793
+ themeValues = _ref.themeValues;
47809
47794
  return /*#__PURE__*/React__default.createElement(Modal$1, {
47810
47795
  modalOpen: isOpen,
47811
47796
  hideModal: function hideModal() {
@@ -47831,9 +47816,9 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47831
47816
  continueAction: function continueAction() {
47832
47817
  toggleAccepted(true);
47833
47818
  toggleOpen(false);
47834
- },
47835
- initialFocusSelector: initialFocusSelector
47819
+ }
47836
47820
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47821
+ id: TermsAndConditionsModalLinkId,
47837
47822
  variant: linkVariant,
47838
47823
  onClick: function onClick() {
47839
47824
  return toggleOpen(true);
@@ -47845,10 +47830,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47845
47830
  color: themeValues.linkColor,
47846
47831
  weight: themeValues.fontWeight,
47847
47832
  hoverStyles: themeValues.modalLinkHoverFocus,
47848
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47849
- role: "button" // This should always be a "button" since it opens a modal
47850
- ,
47851
- className: "modal-trigger"
47833
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47852
47834
  }, link));
47853
47835
  };
47854
47836
 
@@ -47861,15 +47843,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47861
47843
  terms = _ref.terms,
47862
47844
  _ref$error = _ref.error,
47863
47845
  error = _ref$error === void 0 ? false : _ref$error,
47864
- linkVariant = _ref.linkVariant,
47865
- _ref$initialFocusSele = _ref.initialFocusSelector,
47866
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
47867
- _ref$id = _ref.id,
47868
- id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
47869
- _ref$screenReaderChec = _ref.screenReaderCheckboxLabel,
47870
- screenReaderCheckboxLabel = _ref$screenReaderChec === void 0 ? "" : _ref$screenReaderChec,
47871
- _ref$ariaLabelledBy = _ref.ariaLabelledBy,
47872
- ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? "" : _ref$ariaLabelledBy;
47846
+ linkVariant = _ref.linkVariant;
47873
47847
 
47874
47848
  var _useState = React.useState(false),
47875
47849
  _useState2 = _slicedToArray(_useState, 2),
@@ -47881,23 +47855,17 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47881
47855
  title: "Terms and Conditions",
47882
47856
  error: error,
47883
47857
  checked: isChecked,
47884
- onChange: onCheck,
47885
- "aria-labelledby": ariaLabelledBy || (screenReaderCheckboxLabel ? "".concat(id, "_sr_only_label") : "".concat(id, "_html_label"))
47858
+ onChange: onCheck
47886
47859
  }), /*#__PURE__*/React__default.createElement(Box, {
47887
47860
  padding: "0 0 0 58px"
47888
- }, screenReaderCheckboxLabel && /*#__PURE__*/React__default.createElement("span", {
47889
- className: "sr-only-text",
47890
- id: "".concat(id, "_sr_only_label")
47891
- }, screenReaderCheckboxLabel), /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47892
- padding: "0",
47893
- id: "".concat(id, "_html_label")
47861
+ }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47862
+ padding: "0"
47894
47863
  }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47895
47864
  link: "Learn More",
47896
47865
  terms: terms,
47897
47866
  isOpen: showTerms,
47898
47867
  toggleOpen: toggleShowTerms,
47899
- linkVariant: linkVariant,
47900
- initialFocusSelector: initialFocusSelector
47868
+ linkVariant: linkVariant
47901
47869
  })))));
47902
47870
  };
47903
47871
 
@@ -47926,13 +47894,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47926
47894
  _ref$checkboxMargin = _ref.checkboxMargin,
47927
47895
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47928
47896
  _ref$modalTitle = _ref.modalTitle,
47929
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47930
- _ref$initialFocusSele = _ref.initialFocusSelector,
47931
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
47932
- _ref$screenReaderChec = _ref.screenReaderCheckboxLabel,
47933
- screenReaderCheckboxLabel = _ref$screenReaderChec === void 0 ? "" : _ref$screenReaderChec,
47934
- _ref$ariaLabelledBy = _ref.ariaLabelledBy,
47935
- ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? "" : _ref$ariaLabelledBy;
47897
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47936
47898
 
47937
47899
  var _useState = React.useState(false),
47938
47900
  _useState2 = _slicedToArray(_useState, 2),
@@ -47958,24 +47920,20 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47958
47920
  }, /*#__PURE__*/React__default.createElement(Stack, {
47959
47921
  childGap: "0"
47960
47922
  }, html && /*#__PURE__*/React__default.createElement(Box, {
47961
- padding: "0",
47962
- id: "".concat(id, "_html_label")
47923
+ padding: "0"
47963
47924
  }, html), /*#__PURE__*/React__default.createElement(Cluster, {
47964
47925
  justify: "flex-start",
47965
47926
  align: "center",
47966
47927
  nowrap: true
47967
- }, showCheckbox && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Checkbox$1, {
47928
+ }, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
47968
47929
  name: id,
47969
47930
  error: hasError,
47970
47931
  checked: isChecked,
47971
47932
  onChange: onCheck,
47972
47933
  checkboxMargin: checkboxMargin,
47973
47934
  extraStyles: "align-self: flex-start;",
47974
- "aria-labelledby": ariaLabelledBy || (screenReaderCheckboxLabel ? "".concat(id, "_sr_only_label") : "".concat(id, "_html_label"))
47975
- }), screenReaderCheckboxLabel && /*#__PURE__*/React__default.createElement("span", {
47976
- className: "sr-only-text",
47977
- id: "".concat(id, "_sr_only_label")
47978
- }, screenReaderCheckboxLabel)), /*#__PURE__*/React__default.createElement(Stack, {
47935
+ labelledById: TermsAndConditionsModalLinkId
47936
+ }), /*#__PURE__*/React__default.createElement(Stack, {
47979
47937
  childGap: "0.25rem",
47980
47938
  fullHeight: true
47981
47939
  }, /*#__PURE__*/React__default.createElement(Cluster, {
@@ -47991,8 +47949,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47991
47949
  isOpen: showTerms,
47992
47950
  toggleOpen: toggleTerms,
47993
47951
  linkVariant: modalVariant,
47994
- title: modalTitle,
47995
- initialFocusSelector: initialFocusSelector
47952
+ title: modalTitle
47996
47953
  })), /*#__PURE__*/React__default.createElement("div", {
47997
47954
  "aria-live": "polite",
47998
47955
  "aria-atomic": true
@@ -48193,8 +48150,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48193
48150
  version: "v2",
48194
48151
  showCheckbox: false,
48195
48152
  description: "View",
48196
- terms: termsContent,
48197
- initialFocusSelector: ".modal-close-button"
48153
+ terms: termsContent
48198
48154
  })))));
48199
48155
  };
48200
48156
 
@@ -48390,8 +48346,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48390
48346
  version: "v2",
48391
48347
  showCheckbox: false,
48392
48348
  description: "View",
48393
- terms: termsContent,
48394
- initialFocusSelector: ".modal-close-button"
48349
+ terms: termsContent
48395
48350
  })))));
48396
48351
  };
48397
48352