@thecb/components 9.2.10-beta.1 → 9.2.10-beta.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
@@ -22107,7 +22107,7 @@ var HiddenCheckbox = styled__default.input.attrs({
22107
22107
  }).withConfig({
22108
22108
  displayName: "Checkbox__HiddenCheckbox",
22109
22109
  componentId: "sc-36kqbv-3"
22110
- })(["border:0;clip:rect(0 0 0 0);clippath:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]);
22110
+ })(["border:0;clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]);
22111
22111
  var StyledCheckbox = styled__default.div.withConfig({
22112
22112
  displayName: "Checkbox__StyledCheckbox",
22113
22113
  componentId: "sc-36kqbv-4"
@@ -22175,14 +22175,14 @@ var Checkbox = function Checkbox(_ref4) {
22175
22175
  background: themeValues.backgroundColor,
22176
22176
  extraStyles: "outline: none; ".concat(extraStyles, "; margin: ").concat(checkboxMargin, ";")
22177
22177
  }, /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, {
22178
- "data-qa": dataQa
22178
+ "data-qa": dataQa,
22179
+ id: "".concat(name, "_label_container")
22179
22180
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22180
22181
  "data-qa": "Checkbox"
22181
22182
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22182
22183
  id: "checkbox-".concat(name),
22183
22184
  disabled: disabled,
22184
22185
  name: name,
22185
- "aria-label": name,
22186
22186
  checked: checked,
22187
22187
  onChange: onChange,
22188
22188
  tabIndex: "-1",
@@ -22200,7 +22200,8 @@ var Checkbox = function Checkbox(_ref4) {
22200
22200
  errorStyles: themeValues.errorStyles,
22201
22201
  disabledStyles: themeValues.disabledStyles,
22202
22202
  disabledCheckedStyles: themeValues.disabledCheckedStyles,
22203
- focusedStyles: themeValues.focusedStyles
22203
+ focusedStyles: themeValues.focusedStyles,
22204
+ "aria-labelledby": title ? "".concat(name, "_title_id") : "".concat(name, "_label_container")
22204
22205
  }, /*#__PURE__*/React__default.createElement(CheckboxIcon, {
22205
22206
  viewBox: "0 0 24 24",
22206
22207
  disabled: disabled,
@@ -22212,6 +22213,7 @@ var Checkbox = function Checkbox(_ref4) {
22212
22213
  variant: "p",
22213
22214
  weight: themeValues.textFontWeight,
22214
22215
  color: themeValues.textColor,
22216
+ id: "".concat(name, "_title_id"),
22215
22217
  extraStyles: textExtraStyles ? "".concat(textExtraStyles, " ").concat(disabled && "color: #6e727e; background-color: #f7f7f7;", " ") : "margin-left: 1rem ".concat(disabled && "color: #6e727e; background-color: #f7f7f7;")
22216
22218
  }, title)));
22217
22219
  };
@@ -45767,9 +45769,7 @@ var Modal$1 = function Modal(_ref) {
45767
45769
  _ref$dataQa = _ref.dataQa,
45768
45770
  dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
45769
45771
  _ref$initialFocusSele = _ref.initialFocusSelector,
45770
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
45771
- _ref$modalName = _ref.modalName,
45772
- modalName = _ref$modalName === void 0 ? "" : _ref$modalName;
45772
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
45773
45773
 
45774
45774
  var _useContext = React.useContext(styled.ThemeContext),
45775
45775
  isMobile = _useContext.isMobile;
@@ -45798,8 +45798,9 @@ var Modal$1 = function Modal(_ref) {
45798
45798
  },
45799
45799
  underlayClickExits: underlayClickExits,
45800
45800
  "aria-modal": true,
45801
- "aria-name": !!modalName.length ? modalName : modalHeaderText,
45802
- initialFocus: initialFocusSelector
45801
+ initialFocus: initialFocusSelector,
45802
+ focusDialog: !initialFocusSelector // Focus the dialogue box itself if no selector for initial focus was provided
45803
+
45803
45804
  }, /*#__PURE__*/React__default.createElement(Box, {
45804
45805
  padding: "0",
45805
45806
  borderRadius: "2px",
@@ -47729,7 +47730,8 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
47729
47730
  continueAction: function continueAction() {
47730
47731
  toggleAccepted(true);
47731
47732
  toggleOpen(false);
47732
- }
47733
+ },
47734
+ initialFocusSelector: "[name='Close']"
47733
47735
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47734
47736
  variant: "pS",
47735
47737
  onClick: function onClick() {
@@ -47861,7 +47863,13 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47861
47863
  error = _ref$error === void 0 ? false : _ref$error,
47862
47864
  linkVariant = _ref.linkVariant,
47863
47865
  _ref$initialFocusSele = _ref.initialFocusSelector,
47864
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
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;
47865
47873
 
47866
47874
  var _useState = React.useState(false),
47867
47875
  _useState2 = _slicedToArray(_useState, 2),
@@ -47873,11 +47881,16 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47873
47881
  title: "Terms and Conditions",
47874
47882
  error: error,
47875
47883
  checked: isChecked,
47876
- onChange: onCheck
47884
+ onChange: onCheck,
47885
+ "aria-labelledby": ariaLabelledBy || (screenReaderCheckboxLabel ? "".concat(id, "_sr_only_label") : "".concat(id, "_html_label"))
47877
47886
  }), /*#__PURE__*/React__default.createElement(Box, {
47878
47887
  padding: "0 0 0 58px"
47879
- }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47880
- padding: "0"
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")
47881
47894
  }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47882
47895
  link: "Learn More",
47883
47896
  terms: terms,
@@ -47915,7 +47928,11 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47915
47928
  _ref$modalTitle = _ref.modalTitle,
47916
47929
  modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
47917
47930
  _ref$initialFocusSele = _ref.initialFocusSelector,
47918
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
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;
47919
47936
 
47920
47937
  var _useState = React.useState(false),
47921
47938
  _useState2 = _slicedToArray(_useState, 2),
@@ -47941,19 +47958,24 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47941
47958
  }, /*#__PURE__*/React__default.createElement(Stack, {
47942
47959
  childGap: "0"
47943
47960
  }, html && /*#__PURE__*/React__default.createElement(Box, {
47944
- padding: "0"
47961
+ padding: "0",
47962
+ id: "".concat(id, "_html_label")
47945
47963
  }, html), /*#__PURE__*/React__default.createElement(Cluster, {
47946
47964
  justify: "flex-start",
47947
47965
  align: "center",
47948
47966
  nowrap: true
47949
- }, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
47967
+ }, showCheckbox && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Checkbox$1, {
47950
47968
  name: id,
47951
47969
  error: hasError,
47952
47970
  checked: isChecked,
47953
47971
  onChange: onCheck,
47954
47972
  checkboxMargin: checkboxMargin,
47955
- extraStyles: "align-self: flex-start;"
47956
- }), /*#__PURE__*/React__default.createElement(Stack, {
47973
+ 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, {
47957
47979
  childGap: "0.25rem",
47958
47980
  fullHeight: true
47959
47981
  }, /*#__PURE__*/React__default.createElement(Cluster, {
@@ -47989,9 +48011,7 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
47989
48011
  rest = _objectWithoutProperties(_ref, _excluded$y);
47990
48012
 
47991
48013
  var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
47992
- return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, _extends({
47993
- initialFocusSelector: "[role='button']:not(.modal-trigger)"
47994
- }, rest));
48014
+ return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
47995
48015
  };
47996
48016
 
47997
48017
  var PaymentFormACH = function PaymentFormACH(_ref) {
@@ -48173,7 +48193,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48173
48193
  version: "v2",
48174
48194
  showCheckbox: false,
48175
48195
  description: "View",
48176
- terms: termsContent
48196
+ terms: termsContent,
48197
+ initialFocusSelector: ".modal-close-button"
48177
48198
  })))));
48178
48199
  };
48179
48200
 
@@ -48369,7 +48390,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48369
48390
  version: "v2",
48370
48391
  showCheckbox: false,
48371
48392
  description: "View",
48372
- terms: termsContent
48393
+ terms: termsContent,
48394
+ initialFocusSelector: ".modal-close-button"
48373
48395
  })))));
48374
48396
  };
48375
48397