@dmsi/wedgekit-react 0.0.536 → 0.0.538
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/{chunk-UV53RKAQ.js → chunk-BKBJOF4J.js} +1 -1
- package/dist/{chunk-U6W5E3XW.js → chunk-I5BV7UPG.js} +1 -1
- package/dist/{chunk-PMNNRB6S.js → chunk-NWTVBVBC.js} +44 -2
- package/dist/{chunk-UFGH5V7K.js → chunk-RB7F6QWD.js} +4 -4
- package/dist/{chunk-YHFOOBE2.js → chunk-Y3EFHKAG.js} +1 -1
- package/dist/components/CalendarRange.cjs +44 -2
- package/dist/components/CalendarRange.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +44 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +44 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
- package/dist/components/DataGrid/PinnedColumns.cjs +44 -2
- package/dist/components/DataGrid/PinnedColumns.js +5 -5
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +44 -2
- package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +44 -2
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
- package/dist/components/DataGrid/TableBody/index.cjs +44 -2
- package/dist/components/DataGrid/TableBody/index.js +5 -5
- package/dist/components/DataGrid/index.cjs +44 -2
- package/dist/components/DataGrid/index.js +5 -5
- package/dist/components/DataGrid/utils.cjs +44 -2
- package/dist/components/DataGrid/utils.js +5 -5
- package/dist/components/DataGridCell.cjs +44 -2
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +44 -2
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.cjs +44 -2
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/FilterGroup.cjs +44 -2
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +44 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +44 -2
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +44 -2
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +44 -2
- package/dist/components/MobileDataGrid/index.js +5 -5
- package/dist/components/Password.cjs +44 -2
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +44 -2
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +44 -2
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +44 -2
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +44 -2
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +44 -2
- package/dist/components/index.js +5 -5
- package/package.json +1 -1
- package/src/components/Input.tsx +62 -4
|
@@ -611,7 +611,7 @@ var Input = (_a) => {
|
|
|
611
611
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
612
612
|
setInternalValue(formatted);
|
|
613
613
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
614
|
-
}, [
|
|
614
|
+
}, []);
|
|
615
615
|
const getInputProps = () => {
|
|
616
616
|
var _a2;
|
|
617
617
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -696,6 +696,7 @@ var Input = (_a) => {
|
|
|
696
696
|
};
|
|
697
697
|
const handleChange = (e) => {
|
|
698
698
|
const rawValue = e.target.value;
|
|
699
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
699
700
|
if (variant === "currency") {
|
|
700
701
|
const raw = rawValue.replace(/,/g, "");
|
|
701
702
|
if (raw === "") {
|
|
@@ -714,9 +715,25 @@ var Input = (_a) => {
|
|
|
714
715
|
const parts = raw.split(".");
|
|
715
716
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
716
717
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
718
|
+
const asNumber = Number(raw);
|
|
719
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
720
|
+
const clamped = maxNumber;
|
|
721
|
+
const formattedClamped = formatDecimalValue(
|
|
722
|
+
clamped.toString(),
|
|
723
|
+
currentDecimals
|
|
724
|
+
);
|
|
725
|
+
setInternalValue(formattedClamped);
|
|
726
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
727
|
+
if (onChange) {
|
|
728
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
729
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
730
|
+
});
|
|
731
|
+
onChange(syntheticEvent);
|
|
732
|
+
}
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
717
735
|
setInternalValue(raw);
|
|
718
736
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
719
|
-
const asNumber = Number(raw);
|
|
720
737
|
if (!isNaN(asNumber) && onChange) {
|
|
721
738
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
722
739
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -725,6 +742,31 @@ var Input = (_a) => {
|
|
|
725
742
|
}
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
745
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
746
|
+
const numeric = Number(rawValue);
|
|
747
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
748
|
+
const clamped = maxNumber;
|
|
749
|
+
const formattedClamped = formatDecimalValue(
|
|
750
|
+
clamped.toString(),
|
|
751
|
+
decimals != null ? decimals : 0
|
|
752
|
+
);
|
|
753
|
+
setInternalValue(formattedClamped);
|
|
754
|
+
setDisplayValue(formattedClamped);
|
|
755
|
+
if (typeof onChange === "function") {
|
|
756
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
757
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
758
|
+
});
|
|
759
|
+
onChange(syntheticEvent);
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setInternalValue(rawValue);
|
|
764
|
+
setDisplayValue(rawValue);
|
|
765
|
+
if (typeof onChange === "function") {
|
|
766
|
+
onChange(e);
|
|
767
|
+
}
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
728
770
|
setInternalValue(rawValue);
|
|
729
771
|
setDisplayValue(rawValue);
|
|
730
772
|
if (typeof onChange === "function") {
|
|
@@ -611,7 +611,7 @@ var Input = (_a) => {
|
|
|
611
611
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
612
612
|
setInternalValue(formatted);
|
|
613
613
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
614
|
-
}, [
|
|
614
|
+
}, []);
|
|
615
615
|
const getInputProps = () => {
|
|
616
616
|
var _a2;
|
|
617
617
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -696,6 +696,7 @@ var Input = (_a) => {
|
|
|
696
696
|
};
|
|
697
697
|
const handleChange = (e) => {
|
|
698
698
|
const rawValue = e.target.value;
|
|
699
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
699
700
|
if (variant === "currency") {
|
|
700
701
|
const raw = rawValue.replace(/,/g, "");
|
|
701
702
|
if (raw === "") {
|
|
@@ -714,9 +715,25 @@ var Input = (_a) => {
|
|
|
714
715
|
const parts = raw.split(".");
|
|
715
716
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
716
717
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
718
|
+
const asNumber = Number(raw);
|
|
719
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
720
|
+
const clamped = maxNumber;
|
|
721
|
+
const formattedClamped = formatDecimalValue(
|
|
722
|
+
clamped.toString(),
|
|
723
|
+
currentDecimals
|
|
724
|
+
);
|
|
725
|
+
setInternalValue(formattedClamped);
|
|
726
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
727
|
+
if (onChange) {
|
|
728
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
729
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
730
|
+
});
|
|
731
|
+
onChange(syntheticEvent);
|
|
732
|
+
}
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
717
735
|
setInternalValue(raw);
|
|
718
736
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
719
|
-
const asNumber = Number(raw);
|
|
720
737
|
if (!isNaN(asNumber) && onChange) {
|
|
721
738
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
722
739
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -725,6 +742,31 @@ var Input = (_a) => {
|
|
|
725
742
|
}
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
745
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
746
|
+
const numeric = Number(rawValue);
|
|
747
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
748
|
+
const clamped = maxNumber;
|
|
749
|
+
const formattedClamped = formatDecimalValue(
|
|
750
|
+
clamped.toString(),
|
|
751
|
+
decimals != null ? decimals : 0
|
|
752
|
+
);
|
|
753
|
+
setInternalValue(formattedClamped);
|
|
754
|
+
setDisplayValue(formattedClamped);
|
|
755
|
+
if (typeof onChange === "function") {
|
|
756
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
757
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
758
|
+
});
|
|
759
|
+
onChange(syntheticEvent);
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setInternalValue(rawValue);
|
|
764
|
+
setDisplayValue(rawValue);
|
|
765
|
+
if (typeof onChange === "function") {
|
|
766
|
+
onChange(e);
|
|
767
|
+
}
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
728
770
|
setInternalValue(rawValue);
|
|
729
771
|
setDisplayValue(rawValue);
|
|
730
772
|
if (typeof onChange === "function") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Search
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-BKBJOF4J.js";
|
|
5
|
+
import "../chunk-NWTVBVBC.js";
|
|
6
6
|
import "../chunk-HXGJVYGQ.js";
|
|
7
7
|
import "../chunk-5UH6QUFB.js";
|
|
8
8
|
import "../chunk-WMPWWFUJ.js";
|
|
@@ -611,7 +611,7 @@ var Input = (_a) => {
|
|
|
611
611
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
612
612
|
setInternalValue(formatted);
|
|
613
613
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
614
|
-
}, [
|
|
614
|
+
}, []);
|
|
615
615
|
const getInputProps = () => {
|
|
616
616
|
var _a2;
|
|
617
617
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -696,6 +696,7 @@ var Input = (_a) => {
|
|
|
696
696
|
};
|
|
697
697
|
const handleChange = (e) => {
|
|
698
698
|
const rawValue = e.target.value;
|
|
699
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
699
700
|
if (variant === "currency") {
|
|
700
701
|
const raw = rawValue.replace(/,/g, "");
|
|
701
702
|
if (raw === "") {
|
|
@@ -714,9 +715,25 @@ var Input = (_a) => {
|
|
|
714
715
|
const parts = raw.split(".");
|
|
715
716
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
716
717
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
718
|
+
const asNumber = Number(raw);
|
|
719
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
720
|
+
const clamped = maxNumber;
|
|
721
|
+
const formattedClamped = formatDecimalValue(
|
|
722
|
+
clamped.toString(),
|
|
723
|
+
currentDecimals
|
|
724
|
+
);
|
|
725
|
+
setInternalValue(formattedClamped);
|
|
726
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
727
|
+
if (onChange) {
|
|
728
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
729
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
730
|
+
});
|
|
731
|
+
onChange(syntheticEvent);
|
|
732
|
+
}
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
717
735
|
setInternalValue(raw);
|
|
718
736
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
719
|
-
const asNumber = Number(raw);
|
|
720
737
|
if (!isNaN(asNumber) && onChange) {
|
|
721
738
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
722
739
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -725,6 +742,31 @@ var Input = (_a) => {
|
|
|
725
742
|
}
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
745
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
746
|
+
const numeric = Number(rawValue);
|
|
747
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
748
|
+
const clamped = maxNumber;
|
|
749
|
+
const formattedClamped = formatDecimalValue(
|
|
750
|
+
clamped.toString(),
|
|
751
|
+
decimals != null ? decimals : 0
|
|
752
|
+
);
|
|
753
|
+
setInternalValue(formattedClamped);
|
|
754
|
+
setDisplayValue(formattedClamped);
|
|
755
|
+
if (typeof onChange === "function") {
|
|
756
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
757
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
758
|
+
});
|
|
759
|
+
onChange(syntheticEvent);
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setInternalValue(rawValue);
|
|
764
|
+
setDisplayValue(rawValue);
|
|
765
|
+
if (typeof onChange === "function") {
|
|
766
|
+
onChange(e);
|
|
767
|
+
}
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
728
770
|
setInternalValue(rawValue);
|
|
729
771
|
setDisplayValue(rawValue);
|
|
730
772
|
if (typeof onChange === "function") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Select
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-I5BV7UPG.js";
|
|
5
|
+
import "../chunk-NWTVBVBC.js";
|
|
6
6
|
import "../chunk-HXGJVYGQ.js";
|
|
7
7
|
import "../chunk-5UH6QUFB.js";
|
|
8
8
|
import "../chunk-WMPWWFUJ.js";
|
|
@@ -751,7 +751,7 @@ var Input = (_a) => {
|
|
|
751
751
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
752
752
|
setInternalValue(formatted);
|
|
753
753
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
754
|
-
}, [
|
|
754
|
+
}, []);
|
|
755
755
|
const getInputProps = () => {
|
|
756
756
|
var _a2;
|
|
757
757
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -836,6 +836,7 @@ var Input = (_a) => {
|
|
|
836
836
|
};
|
|
837
837
|
const handleChange = (e) => {
|
|
838
838
|
const rawValue = e.target.value;
|
|
839
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
839
840
|
if (variant === "currency") {
|
|
840
841
|
const raw = rawValue.replace(/,/g, "");
|
|
841
842
|
if (raw === "") {
|
|
@@ -854,9 +855,25 @@ var Input = (_a) => {
|
|
|
854
855
|
const parts = raw.split(".");
|
|
855
856
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
856
857
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
858
|
+
const asNumber = Number(raw);
|
|
859
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
860
|
+
const clamped = maxNumber;
|
|
861
|
+
const formattedClamped = formatDecimalValue(
|
|
862
|
+
clamped.toString(),
|
|
863
|
+
currentDecimals
|
|
864
|
+
);
|
|
865
|
+
setInternalValue(formattedClamped);
|
|
866
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
867
|
+
if (onChange) {
|
|
868
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
869
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
870
|
+
});
|
|
871
|
+
onChange(syntheticEvent);
|
|
872
|
+
}
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
857
875
|
setInternalValue(raw);
|
|
858
876
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
859
|
-
const asNumber = Number(raw);
|
|
860
877
|
if (!isNaN(asNumber) && onChange) {
|
|
861
878
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
862
879
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -865,6 +882,31 @@ var Input = (_a) => {
|
|
|
865
882
|
}
|
|
866
883
|
return;
|
|
867
884
|
}
|
|
885
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
886
|
+
const numeric = Number(rawValue);
|
|
887
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
888
|
+
const clamped = maxNumber;
|
|
889
|
+
const formattedClamped = formatDecimalValue(
|
|
890
|
+
clamped.toString(),
|
|
891
|
+
decimals != null ? decimals : 0
|
|
892
|
+
);
|
|
893
|
+
setInternalValue(formattedClamped);
|
|
894
|
+
setDisplayValue(formattedClamped);
|
|
895
|
+
if (typeof onChange === "function") {
|
|
896
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
897
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
898
|
+
});
|
|
899
|
+
onChange(syntheticEvent);
|
|
900
|
+
}
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
setInternalValue(rawValue);
|
|
904
|
+
setDisplayValue(rawValue);
|
|
905
|
+
if (typeof onChange === "function") {
|
|
906
|
+
onChange(e);
|
|
907
|
+
}
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
868
910
|
setInternalValue(rawValue);
|
|
869
911
|
setDisplayValue(rawValue);
|
|
870
912
|
if (typeof onChange === "function") {
|
package/dist/components/Time.cjs
CHANGED
|
@@ -610,7 +610,7 @@ var Input = (_a) => {
|
|
|
610
610
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
611
611
|
setInternalValue(formatted);
|
|
612
612
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
613
|
-
}, [
|
|
613
|
+
}, []);
|
|
614
614
|
const getInputProps = () => {
|
|
615
615
|
var _a2;
|
|
616
616
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -695,6 +695,7 @@ var Input = (_a) => {
|
|
|
695
695
|
};
|
|
696
696
|
const handleChange = (e) => {
|
|
697
697
|
const rawValue = e.target.value;
|
|
698
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
698
699
|
if (variant === "currency") {
|
|
699
700
|
const raw = rawValue.replace(/,/g, "");
|
|
700
701
|
if (raw === "") {
|
|
@@ -713,9 +714,25 @@ var Input = (_a) => {
|
|
|
713
714
|
const parts = raw.split(".");
|
|
714
715
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
715
716
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
717
|
+
const asNumber = Number(raw);
|
|
718
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
719
|
+
const clamped = maxNumber;
|
|
720
|
+
const formattedClamped = formatDecimalValue(
|
|
721
|
+
clamped.toString(),
|
|
722
|
+
currentDecimals
|
|
723
|
+
);
|
|
724
|
+
setInternalValue(formattedClamped);
|
|
725
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
726
|
+
if (onChange) {
|
|
727
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
728
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
729
|
+
});
|
|
730
|
+
onChange(syntheticEvent);
|
|
731
|
+
}
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
716
734
|
setInternalValue(raw);
|
|
717
735
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
718
|
-
const asNumber = Number(raw);
|
|
719
736
|
if (!isNaN(asNumber) && onChange) {
|
|
720
737
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
721
738
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -724,6 +741,31 @@ var Input = (_a) => {
|
|
|
724
741
|
}
|
|
725
742
|
return;
|
|
726
743
|
}
|
|
744
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
745
|
+
const numeric = Number(rawValue);
|
|
746
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
747
|
+
const clamped = maxNumber;
|
|
748
|
+
const formattedClamped = formatDecimalValue(
|
|
749
|
+
clamped.toString(),
|
|
750
|
+
decimals != null ? decimals : 0
|
|
751
|
+
);
|
|
752
|
+
setInternalValue(formattedClamped);
|
|
753
|
+
setDisplayValue(formattedClamped);
|
|
754
|
+
if (typeof onChange === "function") {
|
|
755
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
756
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
757
|
+
});
|
|
758
|
+
onChange(syntheticEvent);
|
|
759
|
+
}
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
setInternalValue(rawValue);
|
|
763
|
+
setDisplayValue(rawValue);
|
|
764
|
+
if (typeof onChange === "function") {
|
|
765
|
+
onChange(e);
|
|
766
|
+
}
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
727
769
|
setInternalValue(rawValue);
|
|
728
770
|
setDisplayValue(rawValue);
|
|
729
771
|
if (typeof onChange === "function") {
|
package/dist/components/Time.js
CHANGED
|
@@ -1895,7 +1895,7 @@ var Input = (_a) => {
|
|
|
1895
1895
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
1896
1896
|
setInternalValue(formatted);
|
|
1897
1897
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1898
|
-
}, [
|
|
1898
|
+
}, []);
|
|
1899
1899
|
const getInputProps = () => {
|
|
1900
1900
|
var _a2;
|
|
1901
1901
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -1980,6 +1980,7 @@ var Input = (_a) => {
|
|
|
1980
1980
|
};
|
|
1981
1981
|
const handleChange = (e) => {
|
|
1982
1982
|
const rawValue = e.target.value;
|
|
1983
|
+
const maxNumber = props.max != null ? Number(String(props.max).replace(/,/g, "")) : void 0;
|
|
1983
1984
|
if (variant === "currency") {
|
|
1984
1985
|
const raw = rawValue.replace(/,/g, "");
|
|
1985
1986
|
if (raw === "") {
|
|
@@ -1998,9 +1999,25 @@ var Input = (_a) => {
|
|
|
1998
1999
|
const parts = raw.split(".");
|
|
1999
2000
|
const currentDecimals = decimals != null ? decimals : 2;
|
|
2000
2001
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
2002
|
+
const asNumber = Number(raw);
|
|
2003
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
2004
|
+
const clamped = maxNumber;
|
|
2005
|
+
const formattedClamped = formatDecimalValue(
|
|
2006
|
+
clamped.toString(),
|
|
2007
|
+
currentDecimals
|
|
2008
|
+
);
|
|
2009
|
+
setInternalValue(formattedClamped);
|
|
2010
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
2011
|
+
if (onChange) {
|
|
2012
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2013
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2014
|
+
});
|
|
2015
|
+
onChange(syntheticEvent);
|
|
2016
|
+
}
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2001
2019
|
setInternalValue(raw);
|
|
2002
2020
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2003
|
-
const asNumber = Number(raw);
|
|
2004
2021
|
if (!isNaN(asNumber) && onChange) {
|
|
2005
2022
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2006
2023
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2009,6 +2026,31 @@ var Input = (_a) => {
|
|
|
2009
2026
|
}
|
|
2010
2027
|
return;
|
|
2011
2028
|
}
|
|
2029
|
+
if ((variant === "percentage" || variant === "uom") && e.target.type === "number") {
|
|
2030
|
+
const numeric = Number(rawValue);
|
|
2031
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
2032
|
+
const clamped = maxNumber;
|
|
2033
|
+
const formattedClamped = formatDecimalValue(
|
|
2034
|
+
clamped.toString(),
|
|
2035
|
+
decimals != null ? decimals : 0
|
|
2036
|
+
);
|
|
2037
|
+
setInternalValue(formattedClamped);
|
|
2038
|
+
setDisplayValue(formattedClamped);
|
|
2039
|
+
if (typeof onChange === "function") {
|
|
2040
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2041
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
2042
|
+
});
|
|
2043
|
+
onChange(syntheticEvent);
|
|
2044
|
+
}
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
setInternalValue(rawValue);
|
|
2048
|
+
setDisplayValue(rawValue);
|
|
2049
|
+
if (typeof onChange === "function") {
|
|
2050
|
+
onChange(e);
|
|
2051
|
+
}
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2012
2054
|
setInternalValue(rawValue);
|
|
2013
2055
|
setDisplayValue(rawValue);
|
|
2014
2056
|
if (typeof onChange === "function") {
|
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DataGrid,
|
|
3
3
|
DateInput,
|
|
4
4
|
MobileDataGrid
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RB7F6QWD.js";
|
|
6
6
|
import "../chunk-M7INAUAJ.js";
|
|
7
7
|
import "../chunk-ZIPJMN2E.js";
|
|
8
8
|
import "../chunk-FJFZBIRG.js";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
} from "../chunk-MDB26F6T.js";
|
|
42
42
|
import {
|
|
43
43
|
Select
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-I5BV7UPG.js";
|
|
45
45
|
import "../chunk-JADOJNBI.js";
|
|
46
46
|
import "../chunk-4RJKB7LC.js";
|
|
47
47
|
import "../chunk-WVVEOCEH.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
DataGridCell,
|
|
59
59
|
DragAlongCell,
|
|
60
60
|
DraggableCellHeader
|
|
61
|
-
} from "../chunk-
|
|
61
|
+
} from "../chunk-Y3EFHKAG.js";
|
|
62
62
|
import {
|
|
63
63
|
Menu
|
|
64
64
|
} from "../chunk-HGLOO52X.js";
|
|
@@ -68,10 +68,10 @@ import {
|
|
|
68
68
|
} from "../chunk-EZ4KZYKG.js";
|
|
69
69
|
import {
|
|
70
70
|
Search
|
|
71
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-BKBJOF4J.js";
|
|
72
72
|
import {
|
|
73
73
|
Input
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-NWTVBVBC.js";
|
|
75
75
|
import {
|
|
76
76
|
Label
|
|
77
77
|
} from "../chunk-HXGJVYGQ.js";
|
package/package.json
CHANGED
package/src/components/Input.tsx
CHANGED
|
@@ -285,7 +285,9 @@ export const Input = ({
|
|
|
285
285
|
|
|
286
286
|
setInternalValue(formatted);
|
|
287
287
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
288
|
-
|
|
288
|
+
// Intentionally not adding dependencies to avoid formatting on every change
|
|
289
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
290
|
+
}, []);
|
|
289
291
|
|
|
290
292
|
const getInputProps = () => {
|
|
291
293
|
const baseProps = {
|
|
@@ -409,6 +411,10 @@ export const Input = ({
|
|
|
409
411
|
|
|
410
412
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
411
413
|
const rawValue = e.target.value;
|
|
414
|
+
const maxNumber =
|
|
415
|
+
props.max != null
|
|
416
|
+
? Number(String(props.max).replace(/,/g, ""))
|
|
417
|
+
: undefined;
|
|
412
418
|
|
|
413
419
|
if (variant === "currency") {
|
|
414
420
|
const raw = rawValue.replace(/,/g, ""); // Remove commas for processing
|
|
@@ -420,7 +426,7 @@ export const Input = ({
|
|
|
420
426
|
const syntheticEvent = {
|
|
421
427
|
...e,
|
|
422
428
|
target: { ...e.target, value: "" },
|
|
423
|
-
}
|
|
429
|
+
} as React.ChangeEvent<HTMLInputElement>;
|
|
424
430
|
onChange(syntheticEvent);
|
|
425
431
|
}
|
|
426
432
|
return;
|
|
@@ -433,20 +439,72 @@ export const Input = ({
|
|
|
433
439
|
const currentDecimals = decimals ?? 2;
|
|
434
440
|
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
435
441
|
|
|
442
|
+
const asNumber = Number(raw);
|
|
443
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
444
|
+
// Clamp to max
|
|
445
|
+
const clamped = maxNumber;
|
|
446
|
+
const formattedClamped = formatDecimalValue(
|
|
447
|
+
clamped.toString(),
|
|
448
|
+
currentDecimals,
|
|
449
|
+
);
|
|
450
|
+
setInternalValue(formattedClamped);
|
|
451
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
452
|
+
if (onChange) {
|
|
453
|
+
const syntheticEvent = {
|
|
454
|
+
...e,
|
|
455
|
+
target: { ...e.target, value: clamped.toString() },
|
|
456
|
+
} as React.ChangeEvent<HTMLInputElement>;
|
|
457
|
+
onChange(syntheticEvent);
|
|
458
|
+
}
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
436
462
|
setInternalValue(raw);
|
|
437
463
|
setDisplayValue(formatCurrencyDisplay(raw));
|
|
438
464
|
|
|
439
|
-
const asNumber = Number(raw);
|
|
440
465
|
if (!isNaN(asNumber) && onChange) {
|
|
441
466
|
const syntheticEvent = {
|
|
442
467
|
...e,
|
|
443
468
|
target: { ...e.target, value: asNumber.toString() },
|
|
444
|
-
}
|
|
469
|
+
} as React.ChangeEvent<HTMLInputElement>;
|
|
445
470
|
onChange(syntheticEvent);
|
|
446
471
|
}
|
|
447
472
|
return;
|
|
448
473
|
}
|
|
449
474
|
|
|
475
|
+
// Handle numeric variants (percentage / uom) wrt max prop
|
|
476
|
+
if (
|
|
477
|
+
(variant === "percentage" || variant === "uom") &&
|
|
478
|
+
e.target.type === "number"
|
|
479
|
+
) {
|
|
480
|
+
const numeric = Number(rawValue);
|
|
481
|
+
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
482
|
+
const clamped = maxNumber;
|
|
483
|
+
const formattedClamped = formatDecimalValue(
|
|
484
|
+
clamped.toString(),
|
|
485
|
+
decimals ?? 0,
|
|
486
|
+
);
|
|
487
|
+
setInternalValue(formattedClamped);
|
|
488
|
+
setDisplayValue(formattedClamped);
|
|
489
|
+
|
|
490
|
+
if (typeof onChange === "function") {
|
|
491
|
+
const syntheticEvent = {
|
|
492
|
+
...e,
|
|
493
|
+
target: { ...e.target, value: clamped.toString() },
|
|
494
|
+
} as React.ChangeEvent<HTMLInputElement>;
|
|
495
|
+
onChange(syntheticEvent);
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
setInternalValue(rawValue);
|
|
501
|
+
setDisplayValue(rawValue);
|
|
502
|
+
if (typeof onChange === "function") {
|
|
503
|
+
onChange(e);
|
|
504
|
+
}
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
|
|
450
508
|
// Default behavior for other variants
|
|
451
509
|
setInternalValue(rawValue);
|
|
452
510
|
setDisplayValue(rawValue);
|