@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.esm.js CHANGED
@@ -22230,45 +22230,43 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22230
22230
  func();
22231
22231
  }
22232
22232
  };
22233
- var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22234
- var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22235
- var ariaLabel = ariaLabelledById ? undefined : name;
22233
+ var normalizedName = name ? name.replace(/\s+/g, "-") : name;
22234
+ var checkboxId = "checkbox-".concat(normalizedName);
22235
+ var titleId = title ? "checkboxlabel-".concat(normalizedName) : undefined;
22236
+ // aria-label fallback when no visible title or external labelledById is provided
22237
+ var ariaLabel = !labelledById && !title ? name : undefined;
22236
22238
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22237
22239
  ref: ref,
22238
22240
  padding: "0",
22239
- tabIndex: "0",
22240
- role: "checkbox",
22241
- "aria-checked": checked,
22242
- "aria-required": isRequired || undefined,
22243
- "aria-invalid": error,
22244
- "aria-label": ariaLabel,
22245
- "aria-labelledby": ariaLabelledById,
22246
- "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22247
- onFocus: function onFocus() {
22248
- return setFocused(true);
22249
- },
22250
- onBlur: function onBlur() {
22251
- return setFocused(false);
22252
- },
22253
- onKeyDown: function onKeyDown(e) {
22254
- return handleClick(e, onChange);
22255
- },
22256
22241
  hiddenStyles: hidden,
22257
22242
  background: themeValues.backgroundColor,
22258
- extraStyles: "\n :focus {\n outline: 0;\n }\n ".concat(extraStyles, "; \n margin: ").concat(checkboxMargin, ";\n ")
22243
+ extraStyles: "\n ".concat(extraStyles, "; \n margin: ").concat(checkboxMargin, ";\n ")
22259
22244
  }, rest), /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, {
22245
+ htmlFor: checkboxId,
22260
22246
  "data-qa": dataQa
22261
22247
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22262
22248
  "data-qa": "Checkbox"
22263
22249
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22264
- id: "checkbox-".concat(name),
22250
+ id: checkboxId,
22265
22251
  disabled: disabled,
22266
22252
  name: name,
22267
22253
  checked: checked,
22268
22254
  onChange: onChange,
22269
- tabIndex: "-1",
22255
+ tabIndex: "0",
22270
22256
  required: isRequired,
22271
- "aria-hidden": "true"
22257
+ "aria-invalid": error,
22258
+ "aria-label": ariaLabel,
22259
+ "aria-labelledby": labelledById,
22260
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22261
+ onKeyDown: function onKeyDown(e) {
22262
+ return handleClick(e, onChange);
22263
+ },
22264
+ onFocus: function onFocus() {
22265
+ return setFocused(true);
22266
+ },
22267
+ onBlur: function onBlur() {
22268
+ return setFocused(false);
22269
+ }
22272
22270
  }), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
22273
22271
  "aria-hidden": "true",
22274
22272
  error: error,
@@ -47162,7 +47160,7 @@ var PartialAmountField = function PartialAmountField(_ref) {
47162
47160
  extraStyles: "display: block;",
47163
47161
  variant: themeValues.detailVariant,
47164
47162
  weight: "400"
47165
- }, lineItem.subDescription, " payment amount"))),
47163
+ }, lineItem.subDescription))),
47166
47164
  key: lineItem.id,
47167
47165
  field: field,
47168
47166
  fieldActions: fieldActions,
@@ -47174,7 +47172,6 @@ var PartialAmountField = function PartialAmountField(_ref) {
47174
47172
  placeholder: "$0.00",
47175
47173
  formatter: moneyFormat,
47176
47174
  isNum: true,
47177
- isRequired: true,
47178
47175
  decorator: /*#__PURE__*/React__default.createElement(Text$1, {
47179
47176
  variant: "p"
47180
47177
  }, "Amount owed:", " ", /*#__PURE__*/React__default.createElement(Text$1, {
@@ -48217,7 +48214,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48217
48214
  _ref$initialFocusSele = _ref.initialFocusSelector,
48218
48215
  initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
48219
48216
  _ref$isRequired = _ref.isRequired,
48220
- isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
48217
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
48218
+ _ref$textExtraStyles = _ref.textExtraStyles,
48219
+ textExtraStyles = _ref$textExtraStyles === void 0 ? "" : _ref$textExtraStyles;
48221
48220
  var _useState = useState(false),
48222
48221
  _useState2 = _slicedToArray(_useState, 2),
48223
48222
  showTerms = _useState2[0],
@@ -48259,7 +48258,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48259
48258
  justify: "flex-start",
48260
48259
  align: "center",
48261
48260
  nowrap: true,
48262
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
48261
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; }; ".concat(textExtraStyles),
48263
48262
  id: TermsAndConditionsTitleDivId
48264
48263
  }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48265
48264
  color: CHARADE_GREY
@@ -48443,11 +48442,12 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48443
48442
  hidden: hideDefaultPayment
48444
48443
  }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48445
48444
  childGap: "4px",
48446
- align: "center"
48445
+ align: "center",
48446
+ overflow: true
48447
48447
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48448
48448
  name: "bank checkbox",
48449
48449
  dataQa: "Save checking account to wallet",
48450
- title: "Save checking account to wallet.",
48450
+ title: "Save checking account to wallet (optional).",
48451
48451
  checked: walletCheckboxMarked,
48452
48452
  onChange: saveToWallet
48453
48453
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
@@ -48457,7 +48457,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48457
48457
  showCheckbox: false,
48458
48458
  description: "View",
48459
48459
  terms: termsContent,
48460
- initialFocusSelector: ".modal-close-button"
48460
+ initialFocusSelector: ".modal-close-button",
48461
+ textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48461
48462
  })))));
48462
48463
  };
48463
48464
 
@@ -48632,11 +48633,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48632
48633
  isRequired: true
48633
48634
  })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48634
48635
  childGap: "4px",
48635
- align: "center"
48636
+ align: "center",
48637
+ overflow: true
48636
48638
  }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48637
48639
  name: "credit card checkbox",
48638
48640
  dataQa: "Save credit card to wallet",
48639
- title: "Save credit card to wallet.",
48641
+ title: "Save credit card to wallet (optional).",
48640
48642
  checked: walletCheckboxMarked,
48641
48643
  onChange: saveToWallet
48642
48644
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
@@ -48646,7 +48648,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48646
48648
  showCheckbox: false,
48647
48649
  description: "View",
48648
48650
  terms: termsContent,
48649
- initialFocusSelector: ".modal-close-button"
48651
+ initialFocusSelector: ".modal-close-button",
48652
+ textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48650
48653
  })))));
48651
48654
  };
48652
48655
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);