@thecb/components 12.1.0-beta.15 → 12.1.0-beta.16

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This library contains CityBase React components for use across all current and future CB applications (NFE, RMD, POS).
4
4
 
5
+ > See [CONTRIBUTING.md](./CONTRIBUTING.md) for PR guidelines, dev tasks checklist, integration testing, and deployment/versioning.
6
+
5
7
  <!-- TOC -->
6
8
 
7
9
  - [Development setup](#development-setup)
package/dist/index.cjs.js CHANGED
@@ -19826,13 +19826,7 @@ var Alert = function Alert(_ref) {
19826
19826
  _ref$ariaAtomic = _ref.ariaAtomic,
19827
19827
  ariaAtomic = _ref$ariaAtomic === void 0 ? true : _ref$ariaAtomic,
19828
19828
  _ref$ariaLive = _ref.ariaLive,
19829
- ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive,
19830
- _ref$ariaLabelledBy = _ref.ariaLabelledBy,
19831
- ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? null : _ref$ariaLabelledBy,
19832
- _ref$headingAs = _ref.headingAs,
19833
- headingAs = _ref$headingAs === void 0 ? null : _ref$headingAs,
19834
- _ref$headingId = _ref.headingId,
19835
- headingId = _ref$headingId === void 0 ? null : _ref$headingId;
19829
+ ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive;
19836
19830
  var Icon = AlertIcons[variant];
19837
19831
  var contentPadding = maxContentWidth ? "".concat(padding, " 1rem") : innerContentPadding;
19838
19832
  var content = /*#__PURE__*/React__default.createElement(Sidebar, {
@@ -19863,15 +19857,11 @@ var Alert = function Alert(_ref) {
19863
19857
  }, textOverride ? textOverride : /*#__PURE__*/React__default.createElement(Stack, {
19864
19858
  fullHeight: true,
19865
19859
  childGap: "0"
19866
- }, /*#__PURE__*/React__default.createElement(Text$1, _extends({
19860
+ }, /*#__PURE__*/React__default.createElement(Text$1, {
19867
19861
  variant: enableSmallText ? "pS" : "p",
19868
19862
  color: themeValues.text,
19869
19863
  weight: "600"
19870
- }, headingAs ? {
19871
- as: headingAs
19872
- } : {}, headingId ? {
19873
- id: headingId
19874
- } : {}), heading), /*#__PURE__*/React__default.createElement(Text$1, {
19864
+ }, heading), /*#__PURE__*/React__default.createElement(Text$1, {
19875
19865
  variant: "pS",
19876
19866
  color: themeValues.text
19877
19867
  }, text), children))), /*#__PURE__*/React__default.createElement(Cluster, {
@@ -19905,8 +19895,6 @@ var Alert = function Alert(_ref) {
19905
19895
  "aria-atomic": ariaAtomic
19906
19896
  } : {}, ariaRole !== null ? {
19907
19897
  role: ariaRole
19908
- } : {}, ariaLabelledBy !== null ? {
19909
- "aria-labelledby": ariaLabelledBy
19910
19898
  } : {}), maxContentWidth ? /*#__PURE__*/React__default.createElement(Center, {
19911
19899
  maxWidth: maxContentWidth
19912
19900
  }, content) : content);
@@ -22167,8 +22155,9 @@ var ARROW_DOWN = 40;
22167
22155
  var ENTER = 13;
22168
22156
  var ESCAPE = 27;
22169
22157
  var SPACEBAR = 32;
22158
+ var SPACE_KEY = " ";
22170
22159
 
22171
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22160
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon", "customAriaLabel"];
22172
22161
  var CheckboxContainer = styled__default.span.withConfig({
22173
22162
  displayName: "Checkbox__CheckboxContainer",
22174
22163
  componentId: "sc-36kqbv-0"
@@ -22240,19 +22229,24 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22240
22229
  _ref5$hasIconOverride = _ref5.hasIconOverride,
22241
22230
  hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
22242
22231
  Icon = _ref5.icon,
22232
+ customAriaLabel = _ref5.customAriaLabel,
22243
22233
  rest = _objectWithoutProperties(_ref5, _excluded$x);
22244
22234
  var _useState = React.useState(false),
22245
22235
  _useState2 = _slicedToArray(_useState, 2),
22246
22236
  focused = _useState2[0],
22247
22237
  setFocused = _useState2[1];
22248
22238
  var handleClick = function handleClick(e, func) {
22249
- if (e.keyCode === ENTER) {
22239
+ if (e.key === SPACE_KEY) {
22240
+ e.preventDefault();
22250
22241
  func();
22251
22242
  }
22252
22243
  };
22253
- var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22254
- var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22255
- var ariaLabel = ariaLabelledById ? undefined : name;
22244
+ var normalizeName = name ? name.replace(/\s+/g, "-") : "";
22245
+ var checkboxId = "checkbox-".concat(normalizeName);
22246
+ var titleId = title ? "checkboxlabel-".concat(normalizeName) : undefined;
22247
+ var ariaLabelledById = customAriaLabel ? undefined : labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22248
+ var ariaLabel = ariaLabelledById ? undefined : customAriaLabel !== null && customAriaLabel !== void 0 ? customAriaLabel : name;
22249
+ var errorMessageNormalized = error ? "".concat(normalizeName, "-error-message") : undefined;
22256
22250
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22257
22251
  ref: ref,
22258
22252
  padding: "0",
@@ -22263,7 +22257,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22263
22257
  "aria-invalid": error,
22264
22258
  "aria-label": ariaLabel,
22265
22259
  "aria-labelledby": ariaLabelledById,
22266
- "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22260
+ "aria-describedby": errorMessageNormalized,
22267
22261
  onFocus: function onFocus() {
22268
22262
  return setFocused(true);
22269
22263
  },
@@ -22281,7 +22275,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22281
22275
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22282
22276
  "data-qa": "Checkbox"
22283
22277
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22284
- id: "checkbox-".concat(name),
22278
+ id: checkboxId,
22285
22279
  disabled: disabled,
22286
22280
  name: name,
22287
22281
  checked: checked,
@@ -48207,6 +48201,10 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48207
48201
  };
48208
48202
 
48209
48203
  var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
48204
+ var InlineTermsWrapper = styled__default.span.withConfig({
48205
+ displayName: "TermsAndConditionsControlV2__InlineTermsWrapper",
48206
+ componentId: "sc-16np073-0"
48207
+ })(["display:inline;> div{display:inline;}.modal-trigger{display:inline !important;}"]);
48210
48208
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48211
48209
  var _ref$showCheckbox = _ref.showCheckbox,
48212
48210
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48248,6 +48246,21 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48248
48246
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48249
48247
  }
48250
48248
  };
48249
+ if (!showCheckbox && displayInline) {
48250
+ return /*#__PURE__*/React__default.createElement(InlineTermsWrapper, {
48251
+ id: TermsAndConditionsTitleDivId
48252
+ }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48253
+ color: CHARADE_GREY
48254
+ }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48255
+ link: linkText,
48256
+ terms: terms,
48257
+ isOpen: showTerms,
48258
+ toggleOpen: toggleTerms,
48259
+ linkVariant: modalVariant,
48260
+ title: modalTitle,
48261
+ initialFocusSelector: initialFocusSelector
48262
+ }));
48263
+ }
48251
48264
  return /*#__PURE__*/React__default.createElement(Box, {
48252
48265
  padding: displayInline ? "0" : "1.5rem",
48253
48266
  minWidth: displayInline ? "0" : "100%",
@@ -48460,24 +48473,33 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48460
48473
  onChange: toggleCheckbox,
48461
48474
  checked: defaultMethod.value,
48462
48475
  hidden: hideDefaultPayment
48463
- }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48464
- childGap: "4px",
48465
- align: "center"
48466
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48476
+ }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48467
48477
  name: "bank checkbox",
48468
48478
  dataQa: "Save checking account to wallet",
48469
- title: "Save checking account to wallet.",
48479
+ customAriaLabel: "Save checking account to wallet (optional).",
48480
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save checking account to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
48481
+ onClick: function onClick(e) {
48482
+ return e.stopPropagation();
48483
+ },
48484
+ style: {
48485
+ display: "inline"
48486
+ }
48487
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48488
+ version: "v2",
48489
+ showCheckbox: false,
48490
+ description: "View ",
48491
+ terms: termsContent,
48492
+ initialFocusSelector: ".modal-close-button"
48493
+ }))),
48470
48494
  checked: walletCheckboxMarked,
48471
48495
  onChange: saveToWallet
48472
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48473
- singleChild: true
48474
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48496
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48475
48497
  version: "v2",
48476
48498
  showCheckbox: false,
48477
- description: "View",
48499
+ description: "View ",
48478
48500
  terms: termsContent,
48479
48501
  initialFocusSelector: ".modal-close-button"
48480
- })))));
48502
+ })));
48481
48503
  };
48482
48504
 
48483
48505
  var formConfig$6 = {
@@ -48649,24 +48671,33 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48649
48671
  },
48650
48672
  autocompleteValue: "billing postal-code",
48651
48673
  isRequired: true
48652
- })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48653
- childGap: "4px",
48654
- align: "center"
48655
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48674
+ })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48656
48675
  name: "credit card checkbox",
48657
48676
  dataQa: "Save credit card to wallet",
48658
- title: "Save credit card to wallet.",
48677
+ customAriaLabel: "Save credit card to wallet (optional).",
48678
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save credit card to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
48679
+ onClick: function onClick(e) {
48680
+ return e.stopPropagation();
48681
+ },
48682
+ style: {
48683
+ display: "inline"
48684
+ }
48685
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48686
+ version: "v2",
48687
+ showCheckbox: false,
48688
+ description: "View ",
48689
+ terms: termsContent,
48690
+ initialFocusSelector: ".modal-close-button"
48691
+ }))),
48659
48692
  checked: walletCheckboxMarked,
48660
48693
  onChange: saveToWallet
48661
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48662
- singleChild: true
48663
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48694
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48664
48695
  version: "v2",
48665
48696
  showCheckbox: false,
48666
- description: "View",
48697
+ description: "View ",
48667
48698
  terms: termsContent,
48668
48699
  initialFocusSelector: ".modal-close-button"
48669
- })))));
48700
+ })));
48670
48701
  };
48671
48702
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48672
48703