@thecb/components 7.13.0-beta.0 → 7.13.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
@@ -13807,16 +13807,16 @@ var CheckmarkIcon = function CheckmarkIcon() {
13807
13807
  transform: "translate(672.000000, 64.000000)"
13808
13808
  }, /*#__PURE__*/React.createElement("circle", {
13809
13809
  id: "Oval-2",
13810
- stroke: MATISSE_BLUE,
13810
+ stroke: SEA_GREEN,
13811
13811
  strokeWidth: "2",
13812
- fill: INFO_BLUE,
13812
+ fill: HINT_GREEN,
13813
13813
  cx: "48",
13814
13814
  cy: "48",
13815
13815
  r: "48"
13816
13816
  }), /*#__PURE__*/React.createElement("g", {
13817
13817
  id: "Group-2",
13818
13818
  transform: "translate(20.800000, 28.400000)",
13819
- fill: MATISSE_BLUE
13819
+ fill: SEA_GREEN
13820
13820
  }, /*#__PURE__*/React.createElement("polygon", {
13821
13821
  id: "Rectangle-2",
13822
13822
  transform: "translate(12.800000, 30.000000) rotate(-45.000000) translate(-12.800000, -30.000000) ",
@@ -14774,7 +14774,9 @@ var PencilIcon = function PencilIcon(_ref) {
14774
14774
 
14775
14775
  var PencilIcon$1 = themeComponent(PencilIcon, "Icons", fallbackValues$2, "info");
14776
14776
 
14777
- var PendingIcon = function PendingIcon() {
14777
+ var PendingIcon = function PendingIcon(_ref) {
14778
+ var _ref$fill = _ref.fill,
14779
+ fill = _ref$fill === void 0 ? STORM_GREY : _ref$fill;
14778
14780
  return /*#__PURE__*/React.createElement("svg", {
14779
14781
  width: "32px",
14780
14782
  height: "32px",
@@ -14791,7 +14793,7 @@ var PendingIcon = function PendingIcon() {
14791
14793
  }, /*#__PURE__*/React.createElement("g", {
14792
14794
  id: "Icons",
14793
14795
  transform: "translate(-64.000000, -448.000000)",
14794
- fill: "#6D717E"
14796
+ fill: fill
14795
14797
  }, /*#__PURE__*/React.createElement("path", {
14796
14798
  d: "M80,480 C88.836556,480 96,472.836556 96,464 C96,455.163444 88.836556,448 80,448 C71.163444,448 64,455.163444 64,464 C64,472.836556 71.163444,480 80,480 Z M87,466 C88.1045695,466 89,465.104569 89,464 C89,462.895431 88.1045695,462 87,462 C85.8954305,462 85,462.895431 85,464 C85,465.104569 85.8954305,466 87,466 Z M80,462 C81.1045695,462 82,462.895431 82,464 C82,465.104569 81.1045695,466 80,466 C78.8954305,466 78,465.104569 78,464 C78,462.895431 78.8954305,462 80,462 Z M73,462 C74.1045695,462 75,462.895431 75,464 C75,465.104569 74.1045695,466 73,466 C71.8954305,466 71,465.104569 71,464 C71,462.895431 71.8954305,462 73,462 Z",
14797
14799
  id: "status-icon---pending"
@@ -46500,6 +46502,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
46500
46502
  maximum = _ref.maximum,
46501
46503
  _ref$minimum = _ref.minimum,
46502
46504
  minimum = _ref$minimum === void 0 ? 1 : _ref$minimum,
46505
+ blockPartialPaymentOverpay = _ref.blockPartialPaymentOverpay,
46503
46506
  clearOnDismount = _ref.clearOnDismount,
46504
46507
  fields = _ref.fields,
46505
46508
  actions = _ref.actions,
@@ -46515,6 +46518,18 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
46515
46518
  }
46516
46519
 
46517
46520
  var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThanOrEqualTo.error, "There is a minimum payment of ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors, numberLessThanOrEqualTo.error, "There is a maximum payment of ".concat(displayCurrency(maximum))), _amountErrors);
46521
+
46522
+ var getPartialAmountFormErrors = function getPartialAmountFormErrors(itemAmount) {
46523
+ var errorMessages = amountErrors;
46524
+
46525
+ if (blockPartialPaymentOverpay) {
46526
+ var maxAmountError = "There is a maximum payment of ".concat(displayCurrency(itemAmount));
46527
+ return _objectSpread2(_objectSpread2({}, errorMessages), {}, _defineProperty({}, numberLessThanOrEqualTo.error, maxAmountError));
46528
+ }
46529
+
46530
+ return errorMessages;
46531
+ };
46532
+
46518
46533
  var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
46519
46534
  return /*#__PURE__*/React.createElement(FormContainer$1, {
46520
46535
  variant: variant,
@@ -46533,7 +46548,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
46533
46548
  field: fields[li.id],
46534
46549
  fieldActions: actions.fields[li.id],
46535
46550
  showErrors: showErrors,
46536
- errorMessages: amountErrors,
46551
+ errorMessages: getPartialAmountFormErrors(li.amount),
46537
46552
  style: {
46538
46553
  textAlign: "right"
46539
46554
  },
@@ -46552,6 +46567,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
46552
46567
 
46553
46568
  var createPartialAmountFormState = function createPartialAmountFormState(lineItems, maximum) {
46554
46569
  var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
46570
+ var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
46555
46571
  var formConfig = lineItems.reduce(function (acc, item) {
46556
46572
  var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
46557
46573
  return lineItem != item;
@@ -46567,6 +46583,10 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
46567
46583
  }, [])));
46568
46584
  }
46569
46585
 
46586
+ if (blockPartialPaymentOverpay) {
46587
+ validators.push(numberLessThanOrEqualTo(item.amount));
46588
+ }
46589
+
46570
46590
  return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, item.id, {
46571
46591
  validators: validators,
46572
46592
  constraints: [onlyNaturals()],
@@ -46819,7 +46839,9 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
46819
46839
  redirectText = _ref$redirectText === void 0 ? "Return" : _ref$redirectText,
46820
46840
  buttonFlexOverride = _ref.buttonFlexOverride,
46821
46841
  _ref$hideForwardButto = _ref.hideForwardButton,
46822
- hideForwardButton = _ref$hideForwardButto === void 0 ? false : _ref$hideForwardButto;
46842
+ hideForwardButton = _ref$hideForwardButto === void 0 ? false : _ref$hideForwardButto,
46843
+ _ref$hideBackButton = _ref.hideBackButton,
46844
+ hideBackButton = _ref$hideBackButton === void 0 ? false : _ref$hideBackButton;
46823
46845
 
46824
46846
  var _useContext = useContext(ThemeContext),
46825
46847
  isMobile = _useContext.isMobile;
@@ -46858,7 +46880,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
46858
46880
  }, /*#__PURE__*/React.createElement(Cluster, {
46859
46881
  justify: buttonFlexOverride ? buttonFlexOverride : !!backButton ? "space-between" : "flex-end",
46860
46882
  align: "center"
46861
- }, backButton, !hideForwardButton && /*#__PURE__*/React.createElement(Fragment$1, null, forwardButton))));
46883
+ }, !hideBackButton && /*#__PURE__*/React.createElement(Fragment$1, null, backButton), !hideForwardButton && /*#__PURE__*/React.createElement(Fragment$1, null, forwardButton))));
46862
46884
  };
46863
46885
 
46864
46886
  var backgroundColor$b = {
@@ -48881,9 +48903,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
48881
48903
  workflowActionName = _ref$workflowActionNa === void 0 ? "Search" : _ref$workflowActionNa,
48882
48904
  slug = _ref.slug,
48883
48905
  _ref$buttonVariant = _ref.buttonVariant,
48884
- buttonVariant = _ref$buttonVariant === void 0 ? "primary" : _ref$buttonVariant,
48885
- selectWorkflowAction = _ref.selectWorkflowAction,
48886
- navigate = _ref.navigate;
48906
+ buttonVariant = _ref$buttonVariant === void 0 ? "primary" : _ref$buttonVariant;
48887
48907
  return /*#__PURE__*/React.createElement(Box, {
48888
48908
  background: WHITE,
48889
48909
  boxShadow: "0px 0px 5px 0px ".concat(GHOST_GREY),
@@ -48911,21 +48931,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
48911
48931
  background: ATHENS_GREY,
48912
48932
  borderColor: GRECIAN_GREY,
48913
48933
  borderWidthOverride: "2px 0 0 0"
48914
- }, selectWorkflowAction ? /*#__PURE__*/React.createElement(ButtonWithAction, {
48915
- variant: buttonVariant,
48916
- primary: buttonVariant == "primary",
48917
- primaryBG: MATISSE_BLUE,
48918
- fontWeight: FONT_WEIGHT_SEMIBOLD,
48919
- fontSize: "1.125rem",
48920
- text: workflowActionName,
48921
- minWidth: "100%",
48922
- extraStyles: "width: 100%; margin: 0; text-align: center;",
48923
- dataQa: slug,
48924
- action: function action() {
48925
- selectWorkflowAction(slug);
48926
- navigate("/service/".concat(slug));
48927
- }
48928
- }) : /*#__PURE__*/React.createElement(ButtonWithLink, {
48934
+ }, /*#__PURE__*/React.createElement(ButtonWithLink, {
48929
48935
  variant: buttonVariant,
48930
48936
  primary: buttonVariant == "primary",
48931
48937
  primaryBG: MATISSE_BLUE,