@thecb/components 8.4.10-beta.5 → 8.4.11-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
@@ -4997,6 +4997,8 @@ var BLACK_SQUEEZE = "#EAF2F7";
4997
4997
  var GREY_CHATEAU = "#959CA8"; // CBS-500
4998
4998
 
4999
4999
  var COOL_GREY_05 = "#fbfcfd"; // CBS-050
5000
+
5001
+ var MANATEE_GREY = "#878E9B"; // CB-60 (cool)
5000
5002
  // BLUE
5001
5003
 
5002
5004
  var CLOUDBURST_BLUE = "#26395c";
@@ -5131,6 +5133,7 @@ var colors = /*#__PURE__*/Object.freeze({
5131
5133
  CHARADE_GREY: CHARADE_GREY,
5132
5134
  GRECIAN_GREY: GRECIAN_GREY,
5133
5135
  COOL_GREY_05: COOL_GREY_05,
5136
+ MANATEE_GREY: MANATEE_GREY,
5134
5137
  BLACK_SQUEEZE: BLACK_SQUEEZE,
5135
5138
  GREY_CHATEAU: GREY_CHATEAU,
5136
5139
  CLOUDBURST_BLUE: CLOUDBURST_BLUE,
@@ -27110,7 +27113,24 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
27110
27113
  themeValues = _ref5.themeValues,
27111
27114
  index = _ref5.index,
27112
27115
  _ref5$handleChange = _ref5.handleChange,
27113
- handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange;
27116
+ handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange,
27117
+ field = _ref5.field,
27118
+ config = _ref5.config;
27119
+
27120
+ var getDefaultChecked = function getDefaultChecked(value, idx) {
27121
+ var selectionExistsInConfig = config.map(function (c) {
27122
+ return c.value;
27123
+ }).includes(field.rawValue);
27124
+
27125
+ if (selectionExistsInConfig) {
27126
+ // if exists, selection comes from the redux-freeform state
27127
+ return field.rawValue === value;
27128
+ } // fallback to first option as default selection
27129
+
27130
+
27131
+ return idx === 0;
27132
+ };
27133
+
27114
27134
  return /*#__PURE__*/React__default.createElement(InputAndLabelContainer, {
27115
27135
  align: "center",
27116
27136
  childGap: "0.5rem",
@@ -27128,7 +27148,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
27128
27148
  setValue(e.target.value);
27129
27149
  handleChange(e);
27130
27150
  },
27131
- defaultChecked: index === 0
27151
+ defaultChecked: getDefaultChecked(value, index)
27132
27152
  }), /*#__PURE__*/React__default.createElement(Text$1, {
27133
27153
  as: "label",
27134
27154
  htmlFor: id,
@@ -27332,14 +27352,16 @@ var fallbackValues$x = {
27332
27352
  };
27333
27353
 
27334
27354
  var SolidDivider = function SolidDivider(_ref) {
27335
- var themeValues = _ref.themeValues;
27355
+ var borderColor = _ref.borderColor,
27356
+ borderSize = _ref.borderSize,
27357
+ themeValues = _ref.themeValues;
27336
27358
  return /*#__PURE__*/React__default.createElement(Box, {
27337
27359
  padding: "0",
27338
27360
  minWidth: "100%",
27339
27361
  minHeight: "1px",
27340
- borderColor: themeValues.borderColor,
27341
- borderSize: themeValues.borderSize,
27342
- borderWidthOverride: "0px 0px ".concat(themeValues.borderSize, " 0px")
27362
+ borderColor: borderColor || themeValues.borderColor,
27363
+ borderSize: borderSize || themeValues.borderSize,
27364
+ borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px")
27343
27365
  });
27344
27366
  };
27345
27367
 
@@ -46793,26 +46815,30 @@ var fallbackValues$J = {
46793
46815
  */
46794
46816
 
46795
46817
  var Module = function Module(_ref) {
46796
- var heading = _ref.heading,
46818
+ var _ref$variant = _ref.variant,
46819
+ variant = _ref$variant === void 0 ? "default" : _ref$variant,
46820
+ as = _ref.as,
46821
+ disabled = _ref.disabled,
46822
+ heading = _ref.heading,
46823
+ rightTitleContent = _ref.rightTitleContent,
46824
+ _ref$titleID = _ref.titleID,
46825
+ titleID = _ref$titleID === void 0 ? "" : _ref$titleID,
46797
46826
  _ref$spacing = _ref.spacing,
46798
46827
  spacing = _ref$spacing === void 0 ? "1rem" : _ref$spacing,
46799
46828
  _ref$padding = _ref.padding,
46800
46829
  padding = _ref$padding === void 0 ? "0" : _ref$padding,
46830
+ _ref$margin = _ref.margin,
46831
+ margin = _ref$margin === void 0 ? "0" : _ref$margin,
46801
46832
  _ref$spacingBottom = _ref.spacingBottom,
46802
46833
  spacingBottom = _ref$spacingBottom === void 0 ? "2.5rem" : _ref$spacingBottom,
46803
- themeValues = _ref.themeValues,
46804
- _ref$variant = _ref.variant,
46805
- variant = _ref$variant === void 0 ? "default" : _ref$variant,
46806
46834
  fontSize = _ref.fontSize,
46807
- as = _ref.as,
46808
- _ref$titleID = _ref.titleID,
46809
- titleID = _ref$titleID === void 0 ? "" : _ref$titleID,
46810
- rightTitleContent = _ref.rightTitleContent,
46835
+ themeValues = _ref.themeValues,
46811
46836
  children = _ref.children;
46812
46837
  var themedFontSize = variant === "small" ? "1.25rem" : variant === "default" ? "1.375rem" : "2rem";
46813
46838
  var computedFontSize = fontSize || themedFontSize;
46814
46839
  var themedElemType = variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
46815
46840
  var computedElemType = as || themedElemType;
46841
+ var disabledStyles = "opacity: 0.40;";
46816
46842
  var headingText = /*#__PURE__*/React__default.createElement(Title$1, {
46817
46843
  weight: themeValues.fontWeight,
46818
46844
  color: themeValues.fontColor,
@@ -46822,12 +46848,18 @@ var Module = function Module(_ref) {
46822
46848
  extraStyles: "font-size: ".concat(computedFontSize, ";"),
46823
46849
  id: titleID
46824
46850
  }, heading);
46825
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React__default.createElement(Cluster, {
46851
+ return /*#__PURE__*/React__default.createElement(Box, {
46852
+ "aria-disabled": disabled,
46853
+ extraStyles: disabled && disabledStyles,
46854
+ padding: "0",
46855
+ role: "group"
46856
+ }, heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React__default.createElement(Cluster, {
46826
46857
  justify: "space-between",
46827
46858
  align: "center",
46828
46859
  nowrap: true
46829
46860
  }, headingText, rightTitleContent), /*#__PURE__*/React__default.createElement(Box, {
46830
- padding: "0 0 ".concat(spacingBottom)
46861
+ padding: "0 0 ".concat(spacingBottom),
46862
+ extraStyles: "margin: ".concat(margin)
46831
46863
  }, /*#__PURE__*/React__default.createElement(Box, {
46832
46864
  padding: padding,
46833
46865
  background: themeValues.backgroundColor,
@@ -47769,24 +47801,7 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
47769
47801
  var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
47770
47802
  var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
47771
47803
  var formConfig = lineItems.reduce(function (acc, item) {
47772
- var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
47773
- return lineItem != item;
47774
- }).reduce(function (acc, curr) {
47775
- return [].concat(_toConsumableArray(acc), [curr.id]);
47776
- }, []))];
47777
-
47778
- if (!!maximum) {
47779
- validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
47780
- return lineItem != item;
47781
- }).reduce(function (acc, curr) {
47782
- return [].concat(_toConsumableArray(acc), [curr.id]);
47783
- }, [])));
47784
- }
47785
-
47786
- if (blockPartialPaymentOverpay) {
47787
- validators.push(numberLessThanOrEqualTo(item.amount));
47788
- }
47789
-
47804
+ var validators = createPartialAmountFormValidators(lineItems, maximum, minimum, blockPartialPaymentOverpay);
47790
47805
  return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, item.id, {
47791
47806
  validators: validators,
47792
47807
  constraints: [onlyNaturals()],
@@ -47805,6 +47820,29 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
47805
47820
  partialAmountFormMapDispatchToProps: mapDispatchToProps
47806
47821
  };
47807
47822
  };
47823
+ var createPartialAmountFormValidators = function createPartialAmountFormValidators(lineItems, maximum) {
47824
+ var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
47825
+ var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
47826
+ var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
47827
+ return lineItem != item;
47828
+ }).reduce(function (acc, curr) {
47829
+ return [].concat(_toConsumableArray(acc), [curr.id]);
47830
+ }, []))];
47831
+
47832
+ if (!!maximum) {
47833
+ validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
47834
+ return lineItem != item;
47835
+ }).reduce(function (acc, curr) {
47836
+ return [].concat(_toConsumableArray(acc), [curr.id]);
47837
+ }, [])));
47838
+ }
47839
+
47840
+ if (blockPartialPaymentOverpay) {
47841
+ validators.push(numberLessThanOrEqualTo(item.amount));
47842
+ }
47843
+
47844
+ return validators;
47845
+ };
47808
47846
 
47809
47847
  var arrowColor = WHITE;
47810
47848
  var numberColor = MATISSE_BLUE;
@@ -49384,6 +49422,8 @@ var RadioGroup = function RadioGroup(_ref) {
49384
49422
  groupName: groupName,
49385
49423
  setValue: setValue,
49386
49424
  handleChange: handleChange,
49425
+ field: field,
49426
+ config: config,
49387
49427
  "aria-invalid": field.dirty && field.hasErrors
49388
49428
  }));
49389
49429
  })));
@@ -49440,6 +49480,8 @@ var RadioSection = function RadioSection(_ref) {
49440
49480
  initiallyOpen = _ref$initiallyOpen === void 0 ? true : _ref$initiallyOpen,
49441
49481
  _ref$openHeight = _ref.openHeight,
49442
49482
  openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
49483
+ _ref$containerStyles = _ref.containerStyles,
49484
+ containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
49443
49485
  ariaDescribedBy = _ref.ariaDescribedBy;
49444
49486
 
49445
49487
  var handleKeyDown = function handleKeyDown(id, e) {
@@ -49492,7 +49534,8 @@ var RadioSection = function RadioSection(_ref) {
49492
49534
  return /*#__PURE__*/React__default.createElement(Box, {
49493
49535
  padding: "1px",
49494
49536
  border: "1px solid ".concat(themeValues.borderColor),
49495
- borderRadius: "4px"
49537
+ borderRadius: "4px",
49538
+ extraStyles: containerStyles
49496
49539
  }, /*#__PURE__*/React__default.createElement(Stack, {
49497
49540
  childGap: "0"
49498
49541
  }, sections.filter(function (section) {
@@ -50639,6 +50682,7 @@ exports.XCircleIconSmall = XCircleIconSmall;
50639
50682
  exports.cardRegistry = cardRegistry;
50640
50683
  exports.constants = index$5;
50641
50684
  exports.createPartialAmountFormState = createPartialAmountFormState;
50685
+ exports.createPartialAmountFormValidators = createPartialAmountFormValidators;
50642
50686
  exports.util = index$4;
50643
50687
  exports.withWindowSize = withWindowSize;
50644
50688
  //# sourceMappingURL=index.cjs.js.map