@thecb/components 9.5.0-beta.8 → 9.5.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.esm.js CHANGED
@@ -27068,17 +27068,26 @@ var Jumbo = function Jumbo(_ref) {
27068
27068
  var Jumbo$1 = withWindowSize(Jumbo);
27069
27069
 
27070
27070
  var fontWeight$4 = {
27071
+ // v1 variants
27071
27072
  "default": "600",
27072
27073
  pS: "600",
27073
27074
  p: "600",
27074
27075
  pL: "600",
27075
- h6: "700"
27076
+ h6: "700",
27077
+ // v2 variants
27078
+ regular: "600",
27079
+ // fontsize Detail large
27080
+ extraSmall: "600",
27081
+ //fontsize Detail small
27082
+ small: "600",
27083
+ // fontsize Detail regular
27084
+ large: "700" // fontsize Title small
27076
27085
  };
27077
27086
  var fallbackValues$p = {
27078
27087
  fontWeight: fontWeight$4
27079
27088
  };
27080
27089
 
27081
- var LabeledAmount = function LabeledAmount(_ref) {
27090
+ var LabeledAmountV1 = function LabeledAmountV1(_ref) {
27082
27091
  var _ref$variant = _ref.variant,
27083
27092
  variant = _ref$variant === void 0 ? "pL" : _ref$variant,
27084
27093
  label = _ref.label,
@@ -27101,19 +27110,51 @@ var LabeledAmount = function LabeledAmount(_ref) {
27101
27110
  extraStyles: "".concat(extraStyles, "; text-align: end; flex: 1;")
27102
27111
  }, amount));
27103
27112
  };
27113
+
27114
+ var LabeledAmountV2 = function LabeledAmountV2(_ref) {
27115
+ var _ref$variant = _ref.variant,
27116
+ variant = _ref$variant === void 0 ? "regular" : _ref$variant,
27117
+ label = _ref.label,
27118
+ amount = _ref.amount,
27119
+ themeValues = _ref.themeValues,
27120
+ as = _ref.as,
27121
+ extraStyles = _ref.extraStyles;
27122
+ var mappedDetailVariants = {
27123
+ regular: "large",
27124
+ small: "regular",
27125
+ extraSmall: "small"
27126
+ };
27127
+ var LabeledAmountContainer = variant === "large" ? Title$1 : Detail$1;
27128
+ var containerVariant = variant === "large" ? "small" : mappedDetailVariants[variant];
27129
+ return /*#__PURE__*/React.createElement(LabeledAmountContainer, {
27130
+ variant: containerVariant,
27131
+ as: as,
27132
+ weight: themeValues.fontWeight,
27133
+ extraStyles: "display: flex; justify-content: space-between; ".concat(extraStyles)
27134
+ }, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null, amount));
27135
+ };
27136
+
27137
+ var _excluded$u = ["version"];
27138
+ var LabeledAmount = function LabeledAmount(_ref) {
27139
+ var _ref$version = _ref.version,
27140
+ version = _ref$version === void 0 ? "v1" : _ref$version,
27141
+ rest = _objectWithoutProperties(_ref, _excluded$u);
27142
+ var LabeledAmountComponent = version === "v1" ? LabeledAmountV1 : LabeledAmountV2;
27143
+ return /*#__PURE__*/React.createElement(LabeledAmountComponent, rest);
27144
+ };
27104
27145
  var LabeledAmount$1 = themeComponent(LabeledAmount, "LabeledAmount", fallbackValues$p, "default");
27105
27146
 
27106
27147
  var weightTitle = {
27107
27148
  "default": "600",
27108
27149
  small: "400"
27109
27150
  };
27110
- var paragraphVariant = {
27111
- "default": "pL",
27112
- small: "pS"
27151
+ var detailVariant = {
27152
+ "default": "large",
27153
+ small: "small"
27113
27154
  };
27114
27155
  var fallbackValues$q = {
27115
27156
  weightTitle: weightTitle,
27116
- paragraphVariant: paragraphVariant
27157
+ detailVariant: detailVariant
27117
27158
  };
27118
27159
 
27119
27160
  var LineItem = function LineItem(_ref) {
@@ -27137,35 +27178,27 @@ var LineItem = function LineItem(_ref) {
27137
27178
  var visibleCustomAttrs = customAttributes === null || customAttributes === void 0 || (_customAttributes$fil = customAttributes.filter(function (attr) {
27138
27179
  return (visibleFields === null || visibleFields === void 0 ? void 0 : visibleFields.includes(attr.key)) && attr.key !== "description";
27139
27180
  })) === null || _customAttributes$fil === void 0 ? void 0 : _customAttributes$fil.map(function (attr) {
27140
- return /*#__PURE__*/React.createElement(Paragraph$1, {
27141
- variant: "pS",
27181
+ return /*#__PURE__*/React.createElement(Detail$1, {
27182
+ variant: "small",
27142
27183
  weight: "400",
27143
27184
  key: attr.key,
27144
27185
  color: STORM_GREY
27145
27186
  }, "".concat(formatAttrKeys(attr.key), ": ").concat(attr.value));
27146
27187
  });
27147
- return /*#__PURE__*/React.createElement(Cluster, {
27148
- nowrap: true,
27149
- justify: "space-between",
27150
- align: "start"
27151
- }, /*#__PURE__*/React.createElement(Stack, {
27188
+ return /*#__PURE__*/React.createElement(Stack, {
27152
27189
  childGap: "0px"
27153
- }, /*#__PURE__*/React.createElement(Paragraph$1, {
27154
- variant: themeValues.paragraphVariant,
27155
- weight: themeValues.weightTitle
27156
- }, description), /*#__PURE__*/React.createElement(Paragraph$1, {
27157
- variant: themeValues.paragraphVariant,
27190
+ }, /*#__PURE__*/React.createElement(Detail$1, {
27191
+ as: "h3",
27192
+ variant: themeValues.detailVariant,
27193
+ weight: themeValues.weightTitle,
27194
+ extraStyles: "display: flex; justify-content: space-between;"
27195
+ }, /*#__PURE__*/React.createElement("span", null, description), /*#__PURE__*/React.createElement("span", null, !!displayQuantity && "x".concat(displayQuantity)), /*#__PURE__*/React.createElement("span", null, amount)), /*#__PURE__*/React.createElement(Detail$1, {
27196
+ as: "p",
27197
+ variant: themeValues.detailVariant,
27158
27198
  weight: "400"
27159
27199
  }, subDescription), visibleCustomAttrs && /*#__PURE__*/React.createElement(Stack, {
27160
27200
  childGap: "0.25rem"
27161
- }, visibleCustomAttrs)), !!displayQuantity && /*#__PURE__*/React.createElement(Paragraph$1, {
27162
- variant: themeValues.paragraphVariant,
27163
- weight: themeValues.weightTitle
27164
- }, "x".concat(displayQuantity)), /*#__PURE__*/React.createElement(Paragraph$1, {
27165
- variant: themeValues.paragraphVariant,
27166
- weight: "600",
27167
- extraStyles: "margin: 0; text-align: end; min-width: fit-content; padding-left: 32px;"
27168
- }, amount));
27201
+ }, visibleCustomAttrs));
27169
27202
  };
27170
27203
  var LineItem$1 = themeComponent(LineItem, "LineItem", fallbackValues$q, "default");
27171
27204
 
@@ -27242,7 +27275,7 @@ var Loading = function Loading() {
27242
27275
  })))));
27243
27276
  };
27244
27277
 
27245
- var _excluded$u = ["leftContent", "rightContent", "footerMinHeight", "backgroundColor", "largeSide", "largeSideSize", "footerPadding", "isMobile", "footerWidth"];
27278
+ var _excluded$v = ["leftContent", "rightContent", "footerMinHeight", "backgroundColor", "largeSide", "largeSideSize", "footerPadding", "isMobile", "footerWidth"];
27246
27279
  var NavFooter = function NavFooter(_ref) {
27247
27280
  var leftContent = _ref.leftContent,
27248
27281
  rightContent = _ref.rightContent,
@@ -27257,7 +27290,7 @@ var NavFooter = function NavFooter(_ref) {
27257
27290
  footerPadding = _ref$footerPadding === void 0 ? "1.5rem 1rem" : _ref$footerPadding,
27258
27291
  isMobile = _ref.isMobile,
27259
27292
  footerWidth = _ref.footerWidth,
27260
- rest = _objectWithoutProperties(_ref, _excluded$u);
27293
+ rest = _objectWithoutProperties(_ref, _excluded$v);
27261
27294
  return /*#__PURE__*/React.createElement(Box, _extends({
27262
27295
  padding: footerPadding,
27263
27296
  background: backgroundColor,
@@ -27288,7 +27321,7 @@ var NavFooter = function NavFooter(_ref) {
27288
27321
  }, rightContent)))))));
27289
27322
  };
27290
27323
 
27291
- var _excluded$v = ["leftContent", "rightContent", "headerHeight", "isMobile", "backgroundColor", "headerWidth"];
27324
+ var _excluded$w = ["leftContent", "rightContent", "headerHeight", "isMobile", "backgroundColor", "headerWidth"];
27292
27325
  var NavHeader = function NavHeader(_ref) {
27293
27326
  var leftContent = _ref.leftContent,
27294
27327
  rightContent = _ref.rightContent,
@@ -27297,7 +27330,7 @@ var NavHeader = function NavHeader(_ref) {
27297
27330
  isMobile = _ref.isMobile,
27298
27331
  backgroundColor = _ref.backgroundColor,
27299
27332
  headerWidth = _ref.headerWidth,
27300
- rest = _objectWithoutProperties(_ref, _excluded$v);
27333
+ rest = _objectWithoutProperties(_ref, _excluded$w);
27301
27334
  return /*#__PURE__*/React.createElement(Box, _extends({
27302
27335
  padding: "0 16px 4px",
27303
27336
  background: backgroundColor,
@@ -27844,6 +27877,9 @@ var SearchableSelect = function SearchableSelect(_ref) {
27844
27877
  _useState2 = _slicedToArray(_useState, 2),
27845
27878
  itemList = _useState2[0],
27846
27879
  setItemList = _useState2[1];
27880
+ var completeOptionsList = itemList.sort(function (a, b) {
27881
+ return a.name == SELECT_ALL ? -1 : b.name === SELECT_ALL ? 1 : a.name.toLowerCase().localeCompare(b.name.toLowerCase());
27882
+ });
27847
27883
  useEffect$1(function () {
27848
27884
  return setItemList(items);
27849
27885
  }, [items, selectedItems]);
@@ -27875,17 +27911,16 @@ var SearchableSelect = function SearchableSelect(_ref) {
27875
27911
  }), /*#__PURE__*/React.createElement(Box, {
27876
27912
  padding: "0 0 0.5rem",
27877
27913
  extraStyles: "overflow-y: scroll; max-height: 250px;"
27878
- }, /*#__PURE__*/React.createElement(Stack, null, itemList.map(function (value) {
27879
- var _selectedItems$find;
27914
+ }, /*#__PURE__*/React.createElement(Stack, null, completeOptionsList.map(function (option) {
27880
27915
  return /*#__PURE__*/React.createElement(Checkbox$1, {
27881
- key: value.name,
27882
- title: value.name,
27883
- name: value.name,
27884
- checked: (_selectedItems$find = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.find(function (item) {
27885
- return (item === null || item === void 0 ? void 0 : item.name) === (value === null || value === void 0 ? void 0 : value.name);
27886
- })) !== null && _selectedItems$find !== void 0 ? _selectedItems$find : false,
27916
+ key: option.name,
27917
+ title: option.name,
27918
+ name: option.name,
27919
+ checked: !!(selectedItems !== null && selectedItems !== void 0 && selectedItems.find(function (item) {
27920
+ return (item === null || item === void 0 ? void 0 : item.name) === (option === null || option === void 0 ? void 0 : option.name);
27921
+ })),
27887
27922
  onChange: function onChange() {
27888
- return handleSelect(value);
27923
+ return handleSelect(option);
27889
27924
  },
27890
27925
  textExtraStyles: "margin: 0;",
27891
27926
  disabled: disabled,
@@ -39049,7 +39084,7 @@ var TableRowWrapper = styled.tr.withConfig({
39049
39084
  return extraStyles;
39050
39085
  });
39051
39086
 
39052
- var _excluded$w = ["children", "extraStyles", "hoverCursor", "hoverEffect", "onClick", "themeValues"];
39087
+ var _excluded$x = ["children", "extraStyles", "hoverCursor", "hoverEffect", "onClick", "themeValues"];
39053
39088
  var TableRow = function TableRow(_ref) {
39054
39089
  var children = _ref.children,
39055
39090
  extraStyles = _ref.extraStyles,
@@ -39058,7 +39093,7 @@ var TableRow = function TableRow(_ref) {
39058
39093
  hoverEffect = _ref$hoverEffect === void 0 ? true : _ref$hoverEffect,
39059
39094
  onClick = _ref.onClick,
39060
39095
  themeValues = _ref.themeValues,
39061
- props = _objectWithoutProperties(_ref, _excluded$w);
39096
+ props = _objectWithoutProperties(_ref, _excluded$x);
39062
39097
  return /*#__PURE__*/React.createElement(TableRowWrapper, _extends({
39063
39098
  onClick: onClick,
39064
39099
  hoverEffect: hoverEffect,
@@ -46033,9 +46068,10 @@ var Modal$1 = function Modal(_ref) {
46033
46068
  }, /*#__PURE__*/React.createElement(Cluster, {
46034
46069
  justify: "flex-start",
46035
46070
  align: "center"
46036
- }, /*#__PURE__*/React.createElement(Heading$1, {
46037
- variant: "h6",
46038
- weight: FONT_WEIGHT_SEMIBOLD
46071
+ }, /*#__PURE__*/React.createElement(Title$1, {
46072
+ as: "h2",
46073
+ weight: FONT_WEIGHT_SEMIBOLD,
46074
+ fontSize: "1.25rem"
46039
46075
  }, modalHeaderText))), /*#__PURE__*/React.createElement(Box, {
46040
46076
  background: modalBodyBg,
46041
46077
  padding: "1.5rem"
@@ -47469,12 +47505,12 @@ var lineItem = {
47469
47505
  small: "small"
47470
47506
  };
47471
47507
  var labeledAmountSubtotal = {
47472
- "default": "pL",
47473
- small: "pS"
47508
+ "default": "regular",
47509
+ small: "small"
47474
47510
  };
47475
47511
  var labeledAmountTotal = {
47476
- "default": "h6",
47477
- small: "p"
47512
+ "default": "large",
47513
+ small: "small"
47478
47514
  };
47479
47515
  var fallbackValues$N = {
47480
47516
  backgroundColor: backgroundColor$c,
@@ -47483,7 +47519,7 @@ var fallbackValues$N = {
47483
47519
  labeledAmountTotal: labeledAmountTotal
47484
47520
  };
47485
47521
 
47486
- var _excluded$x = ["amount"],
47522
+ var _excluded$y = ["amount"],
47487
47523
  _excluded2$1 = ["amount"];
47488
47524
  var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
47489
47525
  var lineItemElems = _ref.lineItemElems,
@@ -47533,6 +47569,9 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
47533
47569
  }), /*#__PURE__*/React.createElement(Box, {
47534
47570
  padding: "16px 0px"
47535
47571
  }, /*#__PURE__*/React.createElement(SolidDivider$1, null)), /*#__PURE__*/React.createElement(LabeledAmount$1, {
47572
+ version: "v2",
47573
+ as: "h3",
47574
+ variant: "small",
47536
47575
  extraStyles: "font-weight: ".concat(FONT_WEIGHT_REGULAR, "; font-size: 14px;"),
47537
47576
  label: "Amount paid",
47538
47577
  amount: displayCurrency(voidableAmountPaid)
@@ -47540,15 +47579,18 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
47540
47579
  , subtotal ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
47541
47580
  padding: "0.5rem 0"
47542
47581
  }, /*#__PURE__*/React.createElement(LabeledAmount$1, {
47582
+ version: "v2",
47543
47583
  variant: themeValues.labeledAmountSubtotal,
47544
47584
  label: "Subtotal",
47545
- amount: displayCurrency(subtotal)
47585
+ amount: displayCurrency(subtotal),
47586
+ as: "h3"
47546
47587
  }), feeElems), /*#__PURE__*/React.createElement(SolidDivider$1, null)) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(LabeledAmount$1, {
47547
- as: "p",
47588
+ version: "v2",
47589
+ as: "h3",
47548
47590
  variant: themeValues.labeledAmountTotal,
47549
47591
  label: hasVoidablePaymentsSection ? "Remaining amount due" : "Total",
47550
47592
  amount: displayCurrency(typeof remainingBalance === "number" ? remainingBalance : total),
47551
- extraStyles: variant === "small" && "font-weight: ".concat(FONT_WEIGHT_BOLD, ";")
47593
+ extraStyles: "margin-top: 1rem;"
47552
47594
  }));
47553
47595
  };
47554
47596
  var LoadingDetails = function LoadingDetails() {
@@ -47717,7 +47759,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47717
47759
  return fee.amount > 0;
47718
47760
  }).map(function (_ref5) {
47719
47761
  var amount = _ref5.amount,
47720
- rest = _objectWithoutProperties(_ref5, _excluded$x);
47762
+ rest = _objectWithoutProperties(_ref5, _excluded$y);
47721
47763
  return _objectSpread2(_objectSpread2({}, rest), {}, {
47722
47764
  amount: displayCurrency(amount)
47723
47765
  });
@@ -47742,6 +47784,8 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47742
47784
  }, /*#__PURE__*/React.createElement(Box, {
47743
47785
  padding: "4px 0"
47744
47786
  }), /*#__PURE__*/React.createElement(LabeledAmount$1, _extends({
47787
+ version: "v2",
47788
+ as: "h3",
47745
47789
  key: fee.label,
47746
47790
  variant: themeValues.labeledAmountSubtotal
47747
47791
  }, fee)));
@@ -47785,7 +47829,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47785
47829
  align: "center"
47786
47830
  }, /*#__PURE__*/React.createElement(Title$1, {
47787
47831
  weight: FONT_WEIGHT_BOLD,
47788
- as: "h1",
47832
+ as: "h2",
47789
47833
  extraStyles: "font-size: 1.375rem;",
47790
47834
  id: "payment-details-title"
47791
47835
  }, titleText), /*#__PURE__*/React.createElement(Title$1, {
@@ -47793,7 +47837,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47793
47837
  as: "p",
47794
47838
  extraStyles: "font-size: 1.375rem;"
47795
47839
  }, displayCurrency(total)))) : /*#__PURE__*/React.createElement(Title$1, {
47796
- as: "h1",
47840
+ as: "h2",
47797
47841
  weight: FONT_WEIGHT_BOLD,
47798
47842
  margin: "1rem 0 0 0",
47799
47843
  extraStyles: "font-size: 1.75rem;",
@@ -48124,11 +48168,11 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48124
48168
  }, errorMessage))))));
48125
48169
  };
48126
48170
 
48127
- var _excluded$y = ["version"];
48171
+ var _excluded$z = ["version"];
48128
48172
  var TermsAndConditions = function TermsAndConditions(_ref) {
48129
48173
  var _ref$version = _ref.version,
48130
48174
  version = _ref$version === void 0 ? "v1" : _ref$version,
48131
- rest = _objectWithoutProperties(_ref, _excluded$y);
48175
+ rest = _objectWithoutProperties(_ref, _excluded$z);
48132
48176
  var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
48133
48177
  return /*#__PURE__*/React.createElement(TermsAndConditionsControl, rest);
48134
48178
  };
@@ -48923,11 +48967,11 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48923
48967
  animate: "open",
48924
48968
  exit: "closed",
48925
48969
  variants: wrapper,
48926
- extraStyles: "transform-origin: 100% 0; border-top: 1px solid ".concat(themeValues.borderColor)
48970
+ extraStyles: "transform-origin: 100% 0; border-top: 0;"
48927
48971
  }, section.content))));
48928
48972
  };
48929
48973
 
48930
- var _excluded$z = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired", "groupedSections"];
48974
+ var _excluded$A = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired", "groupedSections"];
48931
48975
 
48932
48976
  /**
48933
48977
  - The RadioSection component takes either a flat array (via the 'sections'
@@ -48975,7 +49019,7 @@ var RadioSection = function RadioSection(_ref) {
48975
49019
  _ref$isSectionRequire = _ref.isSectionRequired,
48976
49020
  isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
48977
49021
  groupedSections = _ref.groupedSections,
48978
- rest = _objectWithoutProperties(_ref, _excluded$z);
49022
+ rest = _objectWithoutProperties(_ref, _excluded$A);
48979
49023
  var _useState = useState(null),
48980
49024
  _useState2 = _slicedToArray(_useState, 2),
48981
49025
  focused = _useState2[0],
@@ -49055,7 +49099,7 @@ var RadioSection = function RadioSection(_ref) {
49055
49099
  openSection: openSection,
49056
49100
  toggleOpenSection: toggleOpenSection,
49057
49101
  isLastGroupedItemInSection: sectionIndex === sectionGroup.length - 1
49058
- }), sectionIndex === sectionGroup.length - 1 && groupedSections.indexOf(sectionGroup) !== groupedSections.length - 1 && /*#__PURE__*/React.createElement(SolidDivider$1, {
49102
+ }), sectionIndex === sectionGroup.length - 1 && sectionGroupIndex !== groupedSections.length - 1 && /*#__PURE__*/React.createElement(SolidDivider$1, {
49059
49103
  borderSize: "1px",
49060
49104
  borderColor: MANATEE_GREY
49061
49105
  }));