@thecb/components 12.0.6 → 12.1.0-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
@@ -22238,45 +22238,43 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22238
22238
  func();
22239
22239
  }
22240
22240
  };
22241
- var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22242
- var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22243
- var ariaLabel = ariaLabelledById ? undefined : name;
22241
+ var normalizedName = name ? name.replace(/\s+/g, "-") : name;
22242
+ var checkboxId = "checkbox-".concat(normalizedName);
22243
+ var titleId = title ? "checkboxlabel-".concat(normalizedName) : undefined;
22244
+ // aria-label fallback when no visible title or external labelledById is provided
22245
+ var ariaLabel = !labelledById && !title ? name : undefined;
22244
22246
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22245
22247
  ref: ref,
22246
22248
  padding: "0",
22247
- tabIndex: "0",
22248
- role: "checkbox",
22249
- "aria-checked": checked,
22250
- "aria-required": isRequired || undefined,
22251
- "aria-invalid": error,
22252
- "aria-label": ariaLabel,
22253
- "aria-labelledby": ariaLabelledById,
22254
- "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22255
- onFocus: function onFocus() {
22256
- return setFocused(true);
22257
- },
22258
- onBlur: function onBlur() {
22259
- return setFocused(false);
22260
- },
22261
- onKeyDown: function onKeyDown(e) {
22262
- return handleClick(e, onChange);
22263
- },
22264
22249
  hiddenStyles: hidden,
22265
22250
  background: themeValues.backgroundColor,
22266
- extraStyles: "\n :focus {\n outline: 0;\n }\n ".concat(extraStyles, "; \n margin: ").concat(checkboxMargin, ";\n ")
22251
+ extraStyles: "\n ".concat(extraStyles, "; \n margin: ").concat(checkboxMargin, ";\n ")
22267
22252
  }, rest), /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, {
22253
+ htmlFor: checkboxId,
22268
22254
  "data-qa": dataQa
22269
22255
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22270
22256
  "data-qa": "Checkbox"
22271
22257
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22272
- id: "checkbox-".concat(name),
22258
+ id: checkboxId,
22273
22259
  disabled: disabled,
22274
22260
  name: name,
22275
22261
  checked: checked,
22276
22262
  onChange: onChange,
22277
- tabIndex: "-1",
22263
+ tabIndex: "0",
22278
22264
  required: isRequired,
22279
- "aria-hidden": "true"
22265
+ "aria-invalid": error,
22266
+ "aria-label": ariaLabel,
22267
+ "aria-labelledby": labelledById,
22268
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22269
+ onKeyDown: function onKeyDown(e) {
22270
+ return handleClick(e, onChange);
22271
+ },
22272
+ onFocus: function onFocus() {
22273
+ return setFocused(true);
22274
+ },
22275
+ onBlur: function onBlur() {
22276
+ return setFocused(false);
22277
+ }
22280
22278
  }), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
22281
22279
  "aria-hidden": "true",
22282
22280
  error: error,
@@ -48454,7 +48452,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48454
48452
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48455
48453
  name: "bank checkbox",
48456
48454
  dataQa: "Save checking account to wallet",
48457
- title: "Save checking account to wallet.",
48455
+ title: "Save checking account to wallet (optional).",
48458
48456
  checked: walletCheckboxMarked,
48459
48457
  onChange: saveToWallet
48460
48458
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
@@ -48643,7 +48641,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48643
48641
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48644
48642
  name: "credit card checkbox",
48645
48643
  dataQa: "Save credit card to wallet",
48646
- title: "Save credit card to wallet.",
48644
+ title: "Save credit card to wallet (optional).",
48647
48645
  checked: walletCheckboxMarked,
48648
48646
  onChange: saveToWallet
48649
48647
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {