@thecb/components 12.1.0-beta.1 → 12.1.0-beta.2

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,
@@ -47170,7 +47168,7 @@ var PartialAmountField = function PartialAmountField(_ref) {
47170
47168
  extraStyles: "display: block;",
47171
47169
  variant: themeValues.detailVariant,
47172
47170
  weight: "400"
47173
- }, lineItem.subDescription, " payment amount"))),
47171
+ }, lineItem.subDescription))),
47174
47172
  key: lineItem.id,
47175
47173
  field: field,
47176
47174
  fieldActions: fieldActions,
@@ -47182,7 +47180,6 @@ var PartialAmountField = function PartialAmountField(_ref) {
47182
47180
  placeholder: "$0.00",
47183
47181
  formatter: moneyFormat,
47184
47182
  isNum: true,
47185
- isRequired: true,
47186
47183
  decorator: /*#__PURE__*/React__default.createElement(Text$1, {
47187
47184
  variant: "p"
47188
47185
  }, "Amount owed:", " ", /*#__PURE__*/React__default.createElement(Text$1, {
@@ -48225,7 +48222,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48225
48222
  _ref$initialFocusSele = _ref.initialFocusSelector,
48226
48223
  initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
48227
48224
  _ref$isRequired = _ref.isRequired,
48228
- isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
48225
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
48226
+ _ref$textExtraStyles = _ref.textExtraStyles,
48227
+ textExtraStyles = _ref$textExtraStyles === void 0 ? "" : _ref$textExtraStyles;
48229
48228
  var _useState = React.useState(false),
48230
48229
  _useState2 = _slicedToArray(_useState, 2),
48231
48230
  showTerms = _useState2[0],
@@ -48267,7 +48266,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48267
48266
  justify: "flex-start",
48268
48267
  align: "center",
48269
48268
  nowrap: true,
48270
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
48269
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; }; ".concat(textExtraStyles),
48271
48270
  id: TermsAndConditionsTitleDivId
48272
48271
  }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48273
48272
  color: CHARADE_GREY
@@ -48451,11 +48450,12 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48451
48450
  hidden: hideDefaultPayment
48452
48451
  }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48453
48452
  childGap: "4px",
48454
- align: "center"
48453
+ align: "center",
48454
+ overflow: true
48455
48455
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48456
48456
  name: "bank checkbox",
48457
48457
  dataQa: "Save checking account to wallet",
48458
- title: "Save checking account to wallet.",
48458
+ title: "Save checking account to wallet (optional).",
48459
48459
  checked: walletCheckboxMarked,
48460
48460
  onChange: saveToWallet
48461
48461
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
@@ -48465,7 +48465,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48465
48465
  showCheckbox: false,
48466
48466
  description: "View",
48467
48467
  terms: termsContent,
48468
- initialFocusSelector: ".modal-close-button"
48468
+ initialFocusSelector: ".modal-close-button",
48469
+ textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48469
48470
  })))));
48470
48471
  };
48471
48472
 
@@ -48640,11 +48641,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48640
48641
  isRequired: true
48641
48642
  })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48642
48643
  childGap: "4px",
48643
- align: "center"
48644
+ align: "center",
48645
+ overflow: true
48644
48646
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48645
48647
  name: "credit card checkbox",
48646
48648
  dataQa: "Save credit card to wallet",
48647
- title: "Save credit card to wallet.",
48649
+ title: "Save credit card to wallet (optional).",
48648
48650
  checked: walletCheckboxMarked,
48649
48651
  onChange: saveToWallet
48650
48652
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
@@ -48654,7 +48656,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48654
48656
  showCheckbox: false,
48655
48657
  description: "View",
48656
48658
  terms: termsContent,
48657
- initialFocusSelector: ".modal-close-button"
48659
+ initialFocusSelector: ".modal-close-button",
48660
+ textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48658
48661
  })))));
48659
48662
  };
48660
48663
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);