@thecb/components 4.1.27 → 4.1.28
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
|
@@ -38566,7 +38566,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
38566
38566
|
}, []);
|
|
38567
38567
|
}
|
|
38568
38568
|
|
|
38569
|
-
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors,
|
|
38569
|
+
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThanOrEqualTo.error, "Your total payment must be greater than or equal to ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors, numberLessThanOrEqualTo.error, "Your total payment must be less than ".concat(displayCurrency(maximum))), _amountErrors);
|
|
38570
38570
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
38571
38571
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
38572
38572
|
variant: variant,
|
|
@@ -38605,7 +38605,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
38605
38605
|
var createPartialAmountFormState = function createPartialAmountFormState(lineItems, maximum) {
|
|
38606
38606
|
var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
38607
38607
|
var formConfig = lineItems.reduce(function (acc, item) {
|
|
38608
|
-
var validators = [required(), validateSum(
|
|
38608
|
+
var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
|
|
38609
38609
|
return lineItem != item;
|
|
38610
38610
|
}).reduce(function (acc, curr) {
|
|
38611
38611
|
return [].concat(_toConsumableArray(acc), [curr.id]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
required,
|
|
4
|
-
|
|
4
|
+
numberGreaterThanOrEqualTo,
|
|
5
5
|
numberLessThanOrEqualTo
|
|
6
6
|
} from "redux-freeform";
|
|
7
7
|
import { displayCurrency } from "../../../util/general";
|
|
@@ -29,7 +29,7 @@ const PartialAmountForm = ({
|
|
|
29
29
|
|
|
30
30
|
const amountErrors = {
|
|
31
31
|
[required.error]: "Amount is required",
|
|
32
|
-
[
|
|
32
|
+
[numberGreaterThanOrEqualTo.error]: `Your total payment must be greater than or equal to ${displayCurrency(
|
|
33
33
|
minimum
|
|
34
34
|
)}`,
|
|
35
35
|
[numberLessThanOrEqualTo.error]: `Your total payment must be less than ${displayCurrency(
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
required,
|
|
4
4
|
onlyNaturals,
|
|
5
5
|
validateSum,
|
|
6
|
-
|
|
6
|
+
numberGreaterThanOrEqualTo,
|
|
7
7
|
numberLessThanOrEqualTo
|
|
8
8
|
} from "redux-freeform";
|
|
9
9
|
|
|
@@ -16,7 +16,7 @@ export const createPartialAmountFormState = (
|
|
|
16
16
|
const validators = [
|
|
17
17
|
required(),
|
|
18
18
|
validateSum(
|
|
19
|
-
|
|
19
|
+
numberGreaterThanOrEqualTo(minimum),
|
|
20
20
|
lineItems
|
|
21
21
|
.filter(lineItem => lineItem != item)
|
|
22
22
|
.reduce((acc, curr) => [...acc, curr.id], [])
|