@thecb/components 9.2.10-beta.9 → 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.esm.js CHANGED
@@ -22137,6 +22137,7 @@ var Checkbox = function Checkbox(_ref4) {
22137
22137
  checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
22138
22138
  extraStyles = _ref4.extraStyles,
22139
22139
  textExtraStyles = _ref4.textExtraStyles,
22140
+ labelledById = _ref4.labelledById,
22140
22141
  _ref4$dataQa = _ref4.dataQa,
22141
22142
  dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
22142
22143
 
@@ -22151,6 +22152,9 @@ var Checkbox = function Checkbox(_ref4) {
22151
22152
  }
22152
22153
  };
22153
22154
 
22155
+ var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22156
+ var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22157
+ var ariaLabel = ariaLabelledById ? undefined : name;
22154
22158
  return /*#__PURE__*/React.createElement(Box, {
22155
22159
  padding: "0",
22156
22160
  tabIndex: "0",
@@ -22167,14 +22171,15 @@ var Checkbox = function Checkbox(_ref4) {
22167
22171
  background: themeValues.backgroundColor,
22168
22172
  extraStyles: "outline: none; ".concat(extraStyles, "; margin: ").concat(checkboxMargin, ";")
22169
22173
  }, /*#__PURE__*/React.createElement(CheckboxLabelContainer, {
22170
- "data-qa": dataQa,
22171
- id: "".concat(id, "_label_container")
22174
+ "data-qa": dataQa
22172
22175
  }, /*#__PURE__*/React.createElement(CheckboxContainer, {
22173
22176
  "data-qa": "Checkbox"
22174
22177
  }, /*#__PURE__*/React.createElement(HiddenCheckbox, {
22175
22178
  id: "checkbox-".concat(name),
22176
22179
  disabled: disabled,
22177
22180
  name: name,
22181
+ "aria-label": ariaLabel,
22182
+ "aria-labelledby": ariaLabelledById,
22178
22183
  checked: checked,
22179
22184
  onChange: onChange,
22180
22185
  tabIndex: "-1",
@@ -22192,8 +22197,7 @@ var Checkbox = function Checkbox(_ref4) {
22192
22197
  errorStyles: themeValues.errorStyles,
22193
22198
  disabledStyles: themeValues.disabledStyles,
22194
22199
  disabledCheckedStyles: themeValues.disabledCheckedStyles,
22195
- focusedStyles: themeValues.focusedStyles,
22196
- "aria-labelledby": title ? "".concat(name, "_title_id") : "".concat(id, "_label_container")
22200
+ focusedStyles: themeValues.focusedStyles
22197
22201
  }, /*#__PURE__*/React.createElement(CheckboxIcon, {
22198
22202
  viewBox: "0 0 24 24",
22199
22203
  disabled: disabled,
@@ -22202,10 +22206,10 @@ var Checkbox = function Checkbox(_ref4) {
22202
22206
  }, /*#__PURE__*/React.createElement("polyline", {
22203
22207
  points: "20 6 9 17 4 12"
22204
22208
  })))), title && /*#__PURE__*/React.createElement(Text$1, {
22209
+ id: titleId,
22205
22210
  variant: "p",
22206
22211
  weight: themeValues.textFontWeight,
22207
22212
  color: themeValues.textColor,
22208
- id: "".concat(name, "_title_id"),
22209
22213
  extraStyles: textExtraStyles ? "".concat(textExtraStyles, " ").concat(disabled && "color: #6e727e; background-color: #f7f7f7;", " ") : "margin-left: 1rem ".concat(disabled && "color: #6e727e; background-color: #f7f7f7;")
22210
22214
  }, title)));
22211
22215
  };
@@ -22709,12 +22713,12 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
22709
22713
  return hasOwnProperty(toObject(it), key);
22710
22714
  };
22711
22715
 
22712
- var id$1 = 0;
22716
+ var id = 0;
22713
22717
  var postfix = Math.random();
22714
22718
  var toString$3 = functionUncurryThis(1.0.toString);
22715
22719
 
22716
22720
  var uid = function (key) {
22717
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id$1 + postfix, 36);
22721
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
22718
22722
  };
22719
22723
 
22720
22724
  var WellKnownSymbolsStore = shared('wks');
@@ -45759,9 +45763,7 @@ var Modal$1 = function Modal(_ref) {
45759
45763
  buttonExtraStyles = _ref.buttonExtraStyles,
45760
45764
  children = _ref.children,
45761
45765
  _ref$dataQa = _ref.dataQa,
45762
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45763
- _ref$initialFocusSele = _ref.initialFocusSelector,
45764
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45766
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
45765
45767
 
45766
45768
  var _useContext = useContext(ThemeContext),
45767
45769
  isMobile = _useContext.isMobile;
@@ -45788,11 +45790,7 @@ var Modal$1 = function Modal(_ref) {
45788
45790
  width: customWidth || "615px",
45789
45791
  overflow: "auto"
45790
45792
  },
45791
- underlayClickExits: underlayClickExits,
45792
- "aria-modal": true,
45793
- initialFocus: initialFocusSelector,
45794
- focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45795
-
45793
+ underlayClickExits: underlayClickExits
45796
45794
  }, /*#__PURE__*/React.createElement(Box, {
45797
45795
  padding: "0",
45798
45796
  borderRadius: "2px",
@@ -45839,9 +45837,7 @@ var Modal$1 = function Modal(_ref) {
45839
45837
  text: cancelButtonText,
45840
45838
  dataQa: cancelButtonText,
45841
45839
  extraStyles: buttonExtraStyles,
45842
- className: "modal-cancel-button",
45843
- role: "button",
45844
- name: cancelButtonText
45840
+ className: "modal-cancel-button"
45845
45841
  })), /*#__PURE__*/React.createElement(Box, {
45846
45842
  width: "100%",
45847
45843
  padding: "0"
@@ -45853,9 +45849,7 @@ var Modal$1 = function Modal(_ref) {
45853
45849
  isLoading: isLoading,
45854
45850
  disabled: isContinueActionDisabled,
45855
45851
  extraStyles: buttonExtraStyles,
45856
- className: "modal-continue-button",
45857
- role: "button",
45858
- name: continueButtonText
45852
+ className: "modal-continue-button"
45859
45853
  }))) : /*#__PURE__*/React.createElement(Stack, {
45860
45854
  childGap: "1rem",
45861
45855
  direction: "row",
@@ -45866,9 +45860,7 @@ var Modal$1 = function Modal(_ref) {
45866
45860
  text: cancelButtonText,
45867
45861
  dataQa: cancelButtonText,
45868
45862
  extraStyles: buttonExtraStyles,
45869
- className: "modal-cancel-button",
45870
- role: "button",
45871
- name: cancelButtonText
45863
+ className: "modal-cancel-button"
45872
45864
  }), /*#__PURE__*/React.createElement(ButtonWithAction, {
45873
45865
  variant: useDangerButton ? "danger" : "primary",
45874
45866
  action: continueAction,
@@ -45877,9 +45869,7 @@ var Modal$1 = function Modal(_ref) {
45877
45869
  isLoading: isLoading,
45878
45870
  disabled: isContinueActionDisabled,
45879
45871
  extraStyles: buttonExtraStyles,
45880
- className: "modal-continue-button",
45881
- role: "button",
45882
- name: continueButtonText
45872
+ className: "modal-continue-button"
45883
45873
  }))) : /*#__PURE__*/React.createElement(Box, {
45884
45874
  padding: "0.5rem"
45885
45875
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
@@ -45888,9 +45878,7 @@ var Modal$1 = function Modal(_ref) {
45888
45878
  text: closeButtonText,
45889
45879
  dataQa: closeButtonText,
45890
45880
  extraStyles: buttonExtraStyles,
45891
- className: "modal-close-button",
45892
- role: "button",
45893
- name: closeButtonText
45881
+ className: "modal-close-button"
45894
45882
  }))))))))), children);
45895
45883
  };
45896
45884
 
@@ -47722,8 +47710,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47722
47710
  continueAction: function continueAction() {
47723
47711
  toggleAccepted(true);
47724
47712
  toggleOpen(false);
47725
- },
47726
- initialFocusSelector: "[name='Close']"
47713
+ }
47727
47714
  }, /*#__PURE__*/React.createElement(Text$1, {
47728
47715
  variant: "pS",
47729
47716
  onClick: function onClick() {
@@ -47736,9 +47723,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47736
47723
  color: themeValues.linkColor,
47737
47724
  weight: themeValues.fontWeight,
47738
47725
  hoverStyles: themeValues.modalLinkHoverFocus,
47739
- extraStyles: "cursor: pointer;",
47740
- role: "button",
47741
- className: "modal-trigger"
47726
+ extraStyles: "cursor: pointer;"
47742
47727
  }, link));
47743
47728
  };
47744
47729
 
@@ -47795,9 +47780,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47795
47780
  variant = _ref.variant,
47796
47781
  _ref$linkVariant = _ref.linkVariant,
47797
47782
  linkVariant = _ref$linkVariant === void 0 ? "p" : _ref$linkVariant,
47798
- themeValues = _ref.themeValues,
47799
- _ref$initialFocusSele = _ref.initialFocusSelector,
47800
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
47783
+ themeValues = _ref.themeValues;
47801
47784
  return /*#__PURE__*/React.createElement(Modal$1, {
47802
47785
  modalOpen: isOpen,
47803
47786
  hideModal: function hideModal() {
@@ -47823,8 +47806,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47823
47806
  continueAction: function continueAction() {
47824
47807
  toggleAccepted(true);
47825
47808
  toggleOpen(false);
47826
- },
47827
- initialFocusSelector: initialFocusSelector
47809
+ }
47828
47810
  }, /*#__PURE__*/React.createElement(Text$1, {
47829
47811
  variant: linkVariant,
47830
47812
  onClick: function onClick() {
@@ -47837,10 +47819,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47837
47819
  color: themeValues.linkColor,
47838
47820
  weight: themeValues.fontWeight,
47839
47821
  hoverStyles: themeValues.modalLinkHoverFocus,
47840
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
47841
- role: "button" // This should always be a "button" since it opens a modal
47842
- ,
47843
- className: "modal-trigger"
47822
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer"
47844
47823
  }, link));
47845
47824
  };
47846
47825
 
@@ -47853,15 +47832,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47853
47832
  terms = _ref.terms,
47854
47833
  _ref$error = _ref.error,
47855
47834
  error = _ref$error === void 0 ? false : _ref$error,
47856
- linkVariant = _ref.linkVariant,
47857
- _ref$initialFocusSele = _ref.initialFocusSelector,
47858
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
47859
- _ref$id = _ref.id,
47860
- id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
47861
- _ref$screenReaderChec = _ref.screenReaderCheckboxLabel,
47862
- screenReaderCheckboxLabel = _ref$screenReaderChec === void 0 ? "" : _ref$screenReaderChec,
47863
- _ref$ariaLabelledBy = _ref.ariaLabelledBy,
47864
- ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? "" : _ref$ariaLabelledBy;
47835
+ linkVariant = _ref.linkVariant;
47865
47836
 
47866
47837
  var _useState = useState(false),
47867
47838
  _useState2 = _slicedToArray(_useState, 2),
@@ -47873,26 +47844,22 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47873
47844
  title: "Terms and Conditions",
47874
47845
  error: error,
47875
47846
  checked: isChecked,
47876
- onChange: onCheck,
47877
- "aria-labelledby": ariaLabelledBy || (screenReaderCheckboxLabel ? "".concat(id, "_sr_only_label") : "".concat(id, "_html_label"))
47847
+ onChange: onCheck
47878
47848
  }), /*#__PURE__*/React.createElement(Box, {
47879
47849
  padding: "0 0 0 58px"
47880
- }, screenReaderCheckboxLabel && /*#__PURE__*/React.createElement("span", {
47881
- className: "sr-only-text",
47882
- id: "".concat(id, "_sr_only_label")
47883
- }, screenReaderCheckboxLabel), /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Box, {
47884
- padding: "0",
47885
- id: "".concat(id, "_html_label")
47850
+ }, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Box, {
47851
+ padding: "0"
47886
47852
  }, html), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
47887
47853
  link: "Learn More",
47888
47854
  terms: terms,
47889
47855
  isOpen: showTerms,
47890
47856
  toggleOpen: toggleShowTerms,
47891
- linkVariant: linkVariant,
47892
- initialFocusSelector: initialFocusSelector
47857
+ linkVariant: linkVariant
47893
47858
  })))));
47894
47859
  };
47895
47860
 
47861
+ var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
47862
+
47896
47863
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47897
47864
  var _ref$showCheckbox = _ref.showCheckbox,
47898
47865
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -47918,13 +47885,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47918
47885
  _ref$checkboxMargin = _ref.checkboxMargin,
47919
47886
  checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47920
47887
  _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,
47924
- _ref$screenReaderChec = _ref.screenReaderCheckboxLabel,
47925
- screenReaderCheckboxLabel = _ref$screenReaderChec === void 0 ? "" : _ref$screenReaderChec,
47926
- _ref$ariaLabelledBy = _ref.ariaLabelledBy,
47927
- ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? "" : _ref$ariaLabelledBy;
47888
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47928
47889
 
47929
47890
  var _useState = useState(false),
47930
47891
  _useState2 = _slicedToArray(_useState, 2),
@@ -47950,31 +47911,28 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47950
47911
  }, /*#__PURE__*/React.createElement(Stack, {
47951
47912
  childGap: "0"
47952
47913
  }, html && /*#__PURE__*/React.createElement(Box, {
47953
- padding: "0",
47954
- id: "".concat(id, "_html_label")
47914
+ padding: "0"
47955
47915
  }, html), /*#__PURE__*/React.createElement(Cluster, {
47956
47916
  justify: "flex-start",
47957
47917
  align: "center",
47958
47918
  nowrap: true
47959
- }, showCheckbox && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(Checkbox$1, {
47919
+ }, showCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
47960
47920
  name: id,
47961
47921
  error: hasError,
47962
47922
  checked: isChecked,
47963
47923
  onChange: onCheck,
47964
47924
  checkboxMargin: checkboxMargin,
47965
47925
  extraStyles: "align-self: flex-start;",
47966
- "aria-labelledby": ariaLabelledBy || (screenReaderCheckboxLabel ? "".concat(id, "_sr_only_label") : "".concat(id, "_html_label"))
47967
- }), screenReaderCheckboxLabel && /*#__PURE__*/React.createElement("span", {
47968
- className: "sr-only-text",
47969
- id: "".concat(id, "_sr_only_label")
47970
- }, screenReaderCheckboxLabel)), /*#__PURE__*/React.createElement(Stack, {
47926
+ labelledById: TermsAndConditionsTitleDivId
47927
+ }), /*#__PURE__*/React.createElement(Stack, {
47971
47928
  childGap: "0.25rem",
47972
47929
  fullHeight: true
47973
47930
  }, /*#__PURE__*/React.createElement(Cluster, {
47974
47931
  justify: "flex-start",
47975
47932
  align: "center",
47976
47933
  nowrap: true,
47977
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
47934
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
47935
+ id: TermsAndConditionsTitleDivId
47978
47936
  }, description && /*#__PURE__*/React.createElement(Text$1, {
47979
47937
  color: CHARADE_GREY
47980
47938
  }, description), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
@@ -47983,8 +47941,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47983
47941
  isOpen: showTerms,
47984
47942
  toggleOpen: toggleTerms,
47985
47943
  linkVariant: modalVariant,
47986
- title: modalTitle,
47987
- initialFocusSelector: initialFocusSelector
47944
+ title: modalTitle
47988
47945
  })), /*#__PURE__*/React.createElement("div", {
47989
47946
  "aria-live": "polite",
47990
47947
  "aria-atomic": true
@@ -48185,8 +48142,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48185
48142
  version: "v2",
48186
48143
  showCheckbox: false,
48187
48144
  description: "View",
48188
- terms: termsContent,
48189
- initialFocusSelector: ".modal-close-button"
48145
+ terms: termsContent
48190
48146
  })))));
48191
48147
  };
48192
48148
 
@@ -48382,8 +48338,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48382
48338
  version: "v2",
48383
48339
  showCheckbox: false,
48384
48340
  description: "View",
48385
- terms: termsContent,
48386
- initialFocusSelector: ".modal-close-button"
48341
+ terms: termsContent
48387
48342
  })))));
48388
48343
  };
48389
48344