@dmsi/wedgekit-react 0.0.1009 → 0.0.1011
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-FHXCCVOG.js → chunk-72WLEGGU.js} +1 -1
- package/dist/{chunk-5NRKL5CJ.js → chunk-FFCSDPXR.js} +1 -1
- package/dist/{chunk-FZ2TEKOE.js → chunk-IEKZBWVL.js} +1 -1
- package/dist/{chunk-7T5RGDCN.js → chunk-NEMOTB6U.js} +75 -13
- package/dist/{chunk-RLJU65SD.js → chunk-PJQHRERH.js} +4 -4
- package/dist/components/CalendarRange.cjs +75 -13
- package/dist/components/CalendarRange.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +75 -13
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +75 -13
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
- package/dist/components/DataGrid/PinnedColumns.cjs +75 -13
- package/dist/components/DataGrid/PinnedColumns.js +5 -5
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +75 -13
- package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +75 -13
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
- package/dist/components/DataGrid/TableBody/index.cjs +75 -13
- package/dist/components/DataGrid/TableBody/index.js +5 -5
- package/dist/components/DataGrid/index.cjs +75 -13
- package/dist/components/DataGrid/index.js +5 -5
- package/dist/components/DataGrid/utils.cjs +75 -13
- package/dist/components/DataGrid/utils.js +5 -5
- package/dist/components/DataGridCell.cjs +75 -13
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +75 -13
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.cjs +75 -13
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/FilterGroup.cjs +75 -13
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +75 -13
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +75 -13
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +75 -13
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +75 -13
- package/dist/components/MobileDataGrid/index.js +5 -5
- package/dist/components/Password.cjs +75 -13
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +75 -13
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +75 -13
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +75 -13
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +75 -13
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +75 -13
- package/dist/components/index.js +5 -5
- package/package.json +1 -1
|
@@ -1624,6 +1624,7 @@ var Input = (_a) => {
|
|
|
1624
1624
|
variant = "default",
|
|
1625
1625
|
decimals,
|
|
1626
1626
|
uom,
|
|
1627
|
+
currencyFormat = false,
|
|
1627
1628
|
removeSearchIcon,
|
|
1628
1629
|
value: propValue,
|
|
1629
1630
|
onChange,
|
|
@@ -1636,6 +1637,7 @@ var Input = (_a) => {
|
|
|
1636
1637
|
"variant",
|
|
1637
1638
|
"decimals",
|
|
1638
1639
|
"uom",
|
|
1640
|
+
"currencyFormat",
|
|
1639
1641
|
"removeSearchIcon",
|
|
1640
1642
|
"value",
|
|
1641
1643
|
"onChange",
|
|
@@ -1650,22 +1652,21 @@ var Input = (_a) => {
|
|
|
1650
1652
|
(0, import_react10.useEffect)(() => {
|
|
1651
1653
|
var _a2;
|
|
1652
1654
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
var _a2;
|
|
1658
|
-
if (variant !== "currency") {
|
|
1655
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
1656
|
+
if (!stringValue) {
|
|
1657
|
+
setInternalValue("");
|
|
1658
|
+
setDisplayValue("");
|
|
1659
1659
|
return;
|
|
1660
1660
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1661
|
+
if (!shouldUseThousandsFormatting) {
|
|
1662
|
+
setInternalValue(stringValue);
|
|
1663
|
+
setDisplayValue(stringValue);
|
|
1663
1664
|
return;
|
|
1664
1665
|
}
|
|
1665
1666
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
1666
1667
|
setInternalValue(formatted);
|
|
1667
1668
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1668
|
-
}, []);
|
|
1669
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
1669
1670
|
const getInputProps = () => {
|
|
1670
1671
|
var _a2;
|
|
1671
1672
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -1691,8 +1692,9 @@ var Input = (_a) => {
|
|
|
1691
1692
|
case "percentage":
|
|
1692
1693
|
case "uom":
|
|
1693
1694
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
1694
|
-
type: "number",
|
|
1695
|
-
align: "right"
|
|
1695
|
+
type: currencyFormat ? "text" : "number",
|
|
1696
|
+
align: "right",
|
|
1697
|
+
value: currencyFormat ? displayValue : propValue
|
|
1696
1698
|
});
|
|
1697
1699
|
default:
|
|
1698
1700
|
return baseProps;
|
|
@@ -1705,6 +1707,8 @@ var Input = (_a) => {
|
|
|
1705
1707
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "search" }) }) : null;
|
|
1706
1708
|
case "currency":
|
|
1707
1709
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) });
|
|
1710
|
+
case "uom":
|
|
1711
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
1708
1712
|
default:
|
|
1709
1713
|
return null;
|
|
1710
1714
|
}
|
|
@@ -1796,6 +1800,51 @@ var Input = (_a) => {
|
|
|
1796
1800
|
}
|
|
1797
1801
|
return;
|
|
1798
1802
|
}
|
|
1803
|
+
if (variant === "uom" && currencyFormat) {
|
|
1804
|
+
const raw = rawValue.replace(/,/g, "");
|
|
1805
|
+
if (raw === "") {
|
|
1806
|
+
setInternalValue("");
|
|
1807
|
+
setDisplayValue("");
|
|
1808
|
+
if (onChange) {
|
|
1809
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1810
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
1811
|
+
});
|
|
1812
|
+
onChange(syntheticEvent);
|
|
1813
|
+
}
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
const regex = /^\d*\.?\d*$/;
|
|
1817
|
+
if (!regex.test(raw)) return;
|
|
1818
|
+
const parts = raw.split(".");
|
|
1819
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
1820
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
1821
|
+
const asNumber = Number(raw);
|
|
1822
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
1823
|
+
const clamped = maxNumber;
|
|
1824
|
+
const formattedClamped = formatDecimalValue(
|
|
1825
|
+
clamped.toString(),
|
|
1826
|
+
currentDecimals
|
|
1827
|
+
);
|
|
1828
|
+
setInternalValue(formattedClamped);
|
|
1829
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
1830
|
+
if (onChange) {
|
|
1831
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1832
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
1833
|
+
});
|
|
1834
|
+
onChange(syntheticEvent);
|
|
1835
|
+
}
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
setInternalValue(raw);
|
|
1839
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
1840
|
+
if (!isNaN(asNumber) && onChange) {
|
|
1841
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1842
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
1843
|
+
});
|
|
1844
|
+
onChange(syntheticEvent);
|
|
1845
|
+
}
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1799
1848
|
if (variant === "uom" && e.target.type === "number") {
|
|
1800
1849
|
const numeric = Number(rawValue);
|
|
1801
1850
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -1844,8 +1893,21 @@ var Input = (_a) => {
|
|
|
1844
1893
|
onChange(syntheticEvent);
|
|
1845
1894
|
}
|
|
1846
1895
|
} else if (variant === "uom") {
|
|
1847
|
-
|
|
1848
|
-
|
|
1896
|
+
if (currencyFormat) {
|
|
1897
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
1898
|
+
setInternalValue(formatted);
|
|
1899
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1900
|
+
const asNumber = Number(formatted);
|
|
1901
|
+
if (!isNaN(asNumber) && onChange) {
|
|
1902
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1903
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
1904
|
+
});
|
|
1905
|
+
onChange(syntheticEvent);
|
|
1906
|
+
}
|
|
1907
|
+
} else {
|
|
1908
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
1909
|
+
e.target.value = formattedValue;
|
|
1910
|
+
}
|
|
1849
1911
|
}
|
|
1850
1912
|
onBlur == null ? void 0 : onBlur(e);
|
|
1851
1913
|
};
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
DataGridCell,
|
|
5
5
|
DragAlongCell,
|
|
6
6
|
DraggableCellHeader
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-FFCSDPXR.js";
|
|
8
8
|
import "../chunk-OM7QLLI2.js";
|
|
9
9
|
import "../chunk-PE3EZP56.js";
|
|
10
10
|
import "../chunk-X3NDEFVA.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-72WLEGGU.js";
|
|
12
|
+
import "../chunk-NEMOTB6U.js";
|
|
13
13
|
import "../chunk-HXGJVYGQ.js";
|
|
14
14
|
import "../chunk-WVUIIBRR.js";
|
|
15
15
|
import "../chunk-ZRFXUER3.js";
|
|
@@ -571,6 +571,7 @@ var Input = (_a) => {
|
|
|
571
571
|
variant = "default",
|
|
572
572
|
decimals,
|
|
573
573
|
uom,
|
|
574
|
+
currencyFormat = false,
|
|
574
575
|
removeSearchIcon,
|
|
575
576
|
value: propValue,
|
|
576
577
|
onChange,
|
|
@@ -583,6 +584,7 @@ var Input = (_a) => {
|
|
|
583
584
|
"variant",
|
|
584
585
|
"decimals",
|
|
585
586
|
"uom",
|
|
587
|
+
"currencyFormat",
|
|
586
588
|
"removeSearchIcon",
|
|
587
589
|
"value",
|
|
588
590
|
"onChange",
|
|
@@ -597,22 +599,21 @@ var Input = (_a) => {
|
|
|
597
599
|
(0, import_react.useEffect)(() => {
|
|
598
600
|
var _a2;
|
|
599
601
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
var _a2;
|
|
605
|
-
if (variant !== "currency") {
|
|
602
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
603
|
+
if (!stringValue) {
|
|
604
|
+
setInternalValue("");
|
|
605
|
+
setDisplayValue("");
|
|
606
606
|
return;
|
|
607
607
|
}
|
|
608
|
-
|
|
609
|
-
|
|
608
|
+
if (!shouldUseThousandsFormatting) {
|
|
609
|
+
setInternalValue(stringValue);
|
|
610
|
+
setDisplayValue(stringValue);
|
|
610
611
|
return;
|
|
611
612
|
}
|
|
612
613
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
613
614
|
setInternalValue(formatted);
|
|
614
615
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
615
|
-
}, []);
|
|
616
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
616
617
|
const getInputProps = () => {
|
|
617
618
|
var _a2;
|
|
618
619
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -638,8 +639,9 @@ var Input = (_a) => {
|
|
|
638
639
|
case "percentage":
|
|
639
640
|
case "uom":
|
|
640
641
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
641
|
-
type: "number",
|
|
642
|
-
align: "right"
|
|
642
|
+
type: currencyFormat ? "text" : "number",
|
|
643
|
+
align: "right",
|
|
644
|
+
value: currencyFormat ? displayValue : propValue
|
|
643
645
|
});
|
|
644
646
|
default:
|
|
645
647
|
return baseProps;
|
|
@@ -652,6 +654,8 @@ var Input = (_a) => {
|
|
|
652
654
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "search" }) }) : null;
|
|
653
655
|
case "currency":
|
|
654
656
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) });
|
|
657
|
+
case "uom":
|
|
658
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
655
659
|
default:
|
|
656
660
|
return null;
|
|
657
661
|
}
|
|
@@ -743,6 +747,51 @@ var Input = (_a) => {
|
|
|
743
747
|
}
|
|
744
748
|
return;
|
|
745
749
|
}
|
|
750
|
+
if (variant === "uom" && currencyFormat) {
|
|
751
|
+
const raw = rawValue.replace(/,/g, "");
|
|
752
|
+
if (raw === "") {
|
|
753
|
+
setInternalValue("");
|
|
754
|
+
setDisplayValue("");
|
|
755
|
+
if (onChange) {
|
|
756
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
757
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
758
|
+
});
|
|
759
|
+
onChange(syntheticEvent);
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
const regex = /^\d*\.?\d*$/;
|
|
764
|
+
if (!regex.test(raw)) return;
|
|
765
|
+
const parts = raw.split(".");
|
|
766
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
767
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
768
|
+
const asNumber = Number(raw);
|
|
769
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
770
|
+
const clamped = maxNumber;
|
|
771
|
+
const formattedClamped = formatDecimalValue(
|
|
772
|
+
clamped.toString(),
|
|
773
|
+
currentDecimals
|
|
774
|
+
);
|
|
775
|
+
setInternalValue(formattedClamped);
|
|
776
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
777
|
+
if (onChange) {
|
|
778
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
779
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
780
|
+
});
|
|
781
|
+
onChange(syntheticEvent);
|
|
782
|
+
}
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
setInternalValue(raw);
|
|
786
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
787
|
+
if (!isNaN(asNumber) && onChange) {
|
|
788
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
789
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
790
|
+
});
|
|
791
|
+
onChange(syntheticEvent);
|
|
792
|
+
}
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
746
795
|
if (variant === "uom" && e.target.type === "number") {
|
|
747
796
|
const numeric = Number(rawValue);
|
|
748
797
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -791,8 +840,21 @@ var Input = (_a) => {
|
|
|
791
840
|
onChange(syntheticEvent);
|
|
792
841
|
}
|
|
793
842
|
} else if (variant === "uom") {
|
|
794
|
-
|
|
795
|
-
|
|
843
|
+
if (currencyFormat) {
|
|
844
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
845
|
+
setInternalValue(formatted);
|
|
846
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
847
|
+
const asNumber = Number(formatted);
|
|
848
|
+
if (!isNaN(asNumber) && onChange) {
|
|
849
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
850
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
851
|
+
});
|
|
852
|
+
onChange(syntheticEvent);
|
|
853
|
+
}
|
|
854
|
+
} else {
|
|
855
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
856
|
+
e.target.value = formattedValue;
|
|
857
|
+
}
|
|
796
858
|
}
|
|
797
859
|
onBlur == null ? void 0 : onBlur(e);
|
|
798
860
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DateInput
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PJQHRERH.js";
|
|
4
4
|
import "../chunk-2UNLVJU5.js";
|
|
5
5
|
import "../chunk-POZD6R3P.js";
|
|
6
6
|
import "../chunk-M7INAUAJ.js";
|
|
@@ -21,7 +21,7 @@ import "../chunk-7IPESTQS.js";
|
|
|
21
21
|
import "../chunk-Z2HPSFEQ.js";
|
|
22
22
|
import "../chunk-AT4AWD6B.js";
|
|
23
23
|
import "../chunk-EWGHVZL5.js";
|
|
24
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-IEKZBWVL.js";
|
|
25
25
|
import "../chunk-I57U5THY.js";
|
|
26
26
|
import "../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../chunk-3IAXYRUR.js";
|
|
|
38
38
|
import "../chunk-SJZNVG4N.js";
|
|
39
39
|
import "../chunk-75USUR3I.js";
|
|
40
40
|
import "../chunk-BWPNXY7T.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-FFCSDPXR.js";
|
|
42
42
|
import "../chunk-OM7QLLI2.js";
|
|
43
43
|
import "../chunk-PE3EZP56.js";
|
|
44
44
|
import "../chunk-X3NDEFVA.js";
|
|
45
|
-
import "../chunk-
|
|
46
|
-
import "../chunk-
|
|
45
|
+
import "../chunk-72WLEGGU.js";
|
|
46
|
+
import "../chunk-NEMOTB6U.js";
|
|
47
47
|
import "../chunk-HXGJVYGQ.js";
|
|
48
48
|
import "../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../chunk-M7WHWZ2J.js";
|
|
@@ -570,6 +570,7 @@ var Input = (_a) => {
|
|
|
570
570
|
variant = "default",
|
|
571
571
|
decimals,
|
|
572
572
|
uom,
|
|
573
|
+
currencyFormat = false,
|
|
573
574
|
removeSearchIcon,
|
|
574
575
|
value: propValue,
|
|
575
576
|
onChange,
|
|
@@ -582,6 +583,7 @@ var Input = (_a) => {
|
|
|
582
583
|
"variant",
|
|
583
584
|
"decimals",
|
|
584
585
|
"uom",
|
|
586
|
+
"currencyFormat",
|
|
585
587
|
"removeSearchIcon",
|
|
586
588
|
"value",
|
|
587
589
|
"onChange",
|
|
@@ -596,22 +598,21 @@ var Input = (_a) => {
|
|
|
596
598
|
(0, import_react.useEffect)(() => {
|
|
597
599
|
var _a2;
|
|
598
600
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
var _a2;
|
|
604
|
-
if (variant !== "currency") {
|
|
601
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
602
|
+
if (!stringValue) {
|
|
603
|
+
setInternalValue("");
|
|
604
|
+
setDisplayValue("");
|
|
605
605
|
return;
|
|
606
606
|
}
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
if (!shouldUseThousandsFormatting) {
|
|
608
|
+
setInternalValue(stringValue);
|
|
609
|
+
setDisplayValue(stringValue);
|
|
609
610
|
return;
|
|
610
611
|
}
|
|
611
612
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
612
613
|
setInternalValue(formatted);
|
|
613
614
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
614
|
-
}, []);
|
|
615
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
615
616
|
const getInputProps = () => {
|
|
616
617
|
var _a2;
|
|
617
618
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -637,8 +638,9 @@ var Input = (_a) => {
|
|
|
637
638
|
case "percentage":
|
|
638
639
|
case "uom":
|
|
639
640
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
640
|
-
type: "number",
|
|
641
|
-
align: "right"
|
|
641
|
+
type: currencyFormat ? "text" : "number",
|
|
642
|
+
align: "right",
|
|
643
|
+
value: currencyFormat ? displayValue : propValue
|
|
642
644
|
});
|
|
643
645
|
default:
|
|
644
646
|
return baseProps;
|
|
@@ -651,6 +653,8 @@ var Input = (_a) => {
|
|
|
651
653
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "search" }) }) : null;
|
|
652
654
|
case "currency":
|
|
653
655
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) });
|
|
656
|
+
case "uom":
|
|
657
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
654
658
|
default:
|
|
655
659
|
return null;
|
|
656
660
|
}
|
|
@@ -742,6 +746,51 @@ var Input = (_a) => {
|
|
|
742
746
|
}
|
|
743
747
|
return;
|
|
744
748
|
}
|
|
749
|
+
if (variant === "uom" && currencyFormat) {
|
|
750
|
+
const raw = rawValue.replace(/,/g, "");
|
|
751
|
+
if (raw === "") {
|
|
752
|
+
setInternalValue("");
|
|
753
|
+
setDisplayValue("");
|
|
754
|
+
if (onChange) {
|
|
755
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
756
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
757
|
+
});
|
|
758
|
+
onChange(syntheticEvent);
|
|
759
|
+
}
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
const regex = /^\d*\.?\d*$/;
|
|
763
|
+
if (!regex.test(raw)) return;
|
|
764
|
+
const parts = raw.split(".");
|
|
765
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
766
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
767
|
+
const asNumber = Number(raw);
|
|
768
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
769
|
+
const clamped = maxNumber;
|
|
770
|
+
const formattedClamped = formatDecimalValue(
|
|
771
|
+
clamped.toString(),
|
|
772
|
+
currentDecimals
|
|
773
|
+
);
|
|
774
|
+
setInternalValue(formattedClamped);
|
|
775
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
776
|
+
if (onChange) {
|
|
777
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
778
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
779
|
+
});
|
|
780
|
+
onChange(syntheticEvent);
|
|
781
|
+
}
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
setInternalValue(raw);
|
|
785
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
786
|
+
if (!isNaN(asNumber) && onChange) {
|
|
787
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
788
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
789
|
+
});
|
|
790
|
+
onChange(syntheticEvent);
|
|
791
|
+
}
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
745
794
|
if (variant === "uom" && e.target.type === "number") {
|
|
746
795
|
const numeric = Number(rawValue);
|
|
747
796
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -790,8 +839,21 @@ var Input = (_a) => {
|
|
|
790
839
|
onChange(syntheticEvent);
|
|
791
840
|
}
|
|
792
841
|
} else if (variant === "uom") {
|
|
793
|
-
|
|
794
|
-
|
|
842
|
+
if (currencyFormat) {
|
|
843
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
844
|
+
setInternalValue(formatted);
|
|
845
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
846
|
+
const asNumber = Number(formatted);
|
|
847
|
+
if (!isNaN(asNumber) && onChange) {
|
|
848
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
849
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
850
|
+
});
|
|
851
|
+
onChange(syntheticEvent);
|
|
852
|
+
}
|
|
853
|
+
} else {
|
|
854
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
855
|
+
e.target.value = formattedValue;
|
|
856
|
+
}
|
|
795
857
|
}
|
|
796
858
|
onBlur == null ? void 0 : onBlur(e);
|
|
797
859
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CalendarRange
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PJQHRERH.js";
|
|
4
4
|
import "../chunk-2UNLVJU5.js";
|
|
5
5
|
import "../chunk-POZD6R3P.js";
|
|
6
6
|
import "../chunk-M7INAUAJ.js";
|
|
@@ -21,7 +21,7 @@ import "../chunk-7IPESTQS.js";
|
|
|
21
21
|
import "../chunk-Z2HPSFEQ.js";
|
|
22
22
|
import "../chunk-AT4AWD6B.js";
|
|
23
23
|
import "../chunk-EWGHVZL5.js";
|
|
24
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-IEKZBWVL.js";
|
|
25
25
|
import "../chunk-I57U5THY.js";
|
|
26
26
|
import "../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../chunk-NSZTJ5R4.js";
|
|
@@ -38,14 +38,14 @@ import "../chunk-3IAXYRUR.js";
|
|
|
38
38
|
import "../chunk-SJZNVG4N.js";
|
|
39
39
|
import "../chunk-75USUR3I.js";
|
|
40
40
|
import "../chunk-BWPNXY7T.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-FFCSDPXR.js";
|
|
42
42
|
import "../chunk-OM7QLLI2.js";
|
|
43
43
|
import "../chunk-PE3EZP56.js";
|
|
44
44
|
import "../chunk-X3NDEFVA.js";
|
|
45
|
-
import "../chunk-
|
|
45
|
+
import "../chunk-72WLEGGU.js";
|
|
46
46
|
import {
|
|
47
47
|
InputBase
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-NEMOTB6U.js";
|
|
49
49
|
import "../chunk-HXGJVYGQ.js";
|
|
50
50
|
import "../chunk-WVUIIBRR.js";
|
|
51
51
|
import "../chunk-M7WHWZ2J.js";
|
|
@@ -1111,6 +1111,7 @@ var Input = (_a) => {
|
|
|
1111
1111
|
variant = "default",
|
|
1112
1112
|
decimals,
|
|
1113
1113
|
uom,
|
|
1114
|
+
currencyFormat = false,
|
|
1114
1115
|
removeSearchIcon,
|
|
1115
1116
|
value: propValue,
|
|
1116
1117
|
onChange,
|
|
@@ -1123,6 +1124,7 @@ var Input = (_a) => {
|
|
|
1123
1124
|
"variant",
|
|
1124
1125
|
"decimals",
|
|
1125
1126
|
"uom",
|
|
1127
|
+
"currencyFormat",
|
|
1126
1128
|
"removeSearchIcon",
|
|
1127
1129
|
"value",
|
|
1128
1130
|
"onChange",
|
|
@@ -1137,22 +1139,21 @@ var Input = (_a) => {
|
|
|
1137
1139
|
(0, import_react.useEffect)(() => {
|
|
1138
1140
|
var _a2;
|
|
1139
1141
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
var _a2;
|
|
1145
|
-
if (variant !== "currency") {
|
|
1142
|
+
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
1143
|
+
if (!stringValue) {
|
|
1144
|
+
setInternalValue("");
|
|
1145
|
+
setDisplayValue("");
|
|
1146
1146
|
return;
|
|
1147
1147
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1148
|
+
if (!shouldUseThousandsFormatting) {
|
|
1149
|
+
setInternalValue(stringValue);
|
|
1150
|
+
setDisplayValue(stringValue);
|
|
1150
1151
|
return;
|
|
1151
1152
|
}
|
|
1152
1153
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
1153
1154
|
setInternalValue(formatted);
|
|
1154
1155
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1155
|
-
}, []);
|
|
1156
|
+
}, [propValue, variant, currencyFormat, decimals]);
|
|
1156
1157
|
const getInputProps = () => {
|
|
1157
1158
|
var _a2;
|
|
1158
1159
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -1178,8 +1179,9 @@ var Input = (_a) => {
|
|
|
1178
1179
|
case "percentage":
|
|
1179
1180
|
case "uom":
|
|
1180
1181
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
1181
|
-
type: "number",
|
|
1182
|
-
align: "right"
|
|
1182
|
+
type: currencyFormat ? "text" : "number",
|
|
1183
|
+
align: "right",
|
|
1184
|
+
value: currencyFormat ? displayValue : propValue
|
|
1183
1185
|
});
|
|
1184
1186
|
default:
|
|
1185
1187
|
return baseProps;
|
|
@@ -1192,6 +1194,8 @@ var Input = (_a) => {
|
|
|
1192
1194
|
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "search" }) }) : null;
|
|
1193
1195
|
case "currency":
|
|
1194
1196
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "attach_money" }) });
|
|
1197
|
+
case "uom":
|
|
1198
|
+
return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "attach_money" }) }) : null;
|
|
1195
1199
|
default:
|
|
1196
1200
|
return null;
|
|
1197
1201
|
}
|
|
@@ -1283,6 +1287,51 @@ var Input = (_a) => {
|
|
|
1283
1287
|
}
|
|
1284
1288
|
return;
|
|
1285
1289
|
}
|
|
1290
|
+
if (variant === "uom" && currencyFormat) {
|
|
1291
|
+
const raw = rawValue.replace(/,/g, "");
|
|
1292
|
+
if (raw === "") {
|
|
1293
|
+
setInternalValue("");
|
|
1294
|
+
setDisplayValue("");
|
|
1295
|
+
if (onChange) {
|
|
1296
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1297
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
1298
|
+
});
|
|
1299
|
+
onChange(syntheticEvent);
|
|
1300
|
+
}
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const regex = /^\d*\.?\d*$/;
|
|
1304
|
+
if (!regex.test(raw)) return;
|
|
1305
|
+
const parts = raw.split(".");
|
|
1306
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
1307
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
1308
|
+
const asNumber = Number(raw);
|
|
1309
|
+
if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
|
|
1310
|
+
const clamped = maxNumber;
|
|
1311
|
+
const formattedClamped = formatDecimalValue(
|
|
1312
|
+
clamped.toString(),
|
|
1313
|
+
currentDecimals
|
|
1314
|
+
);
|
|
1315
|
+
setInternalValue(formattedClamped);
|
|
1316
|
+
setDisplayValue(formatCurrencyDisplay(formattedClamped));
|
|
1317
|
+
if (onChange) {
|
|
1318
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1319
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
1320
|
+
});
|
|
1321
|
+
onChange(syntheticEvent);
|
|
1322
|
+
}
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
setInternalValue(raw);
|
|
1326
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
1327
|
+
if (!isNaN(asNumber) && onChange) {
|
|
1328
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1329
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
1330
|
+
});
|
|
1331
|
+
onChange(syntheticEvent);
|
|
1332
|
+
}
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1286
1335
|
if (variant === "uom" && e.target.type === "number") {
|
|
1287
1336
|
const numeric = Number(rawValue);
|
|
1288
1337
|
if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
|
|
@@ -1331,8 +1380,21 @@ var Input = (_a) => {
|
|
|
1331
1380
|
onChange(syntheticEvent);
|
|
1332
1381
|
}
|
|
1333
1382
|
} else if (variant === "uom") {
|
|
1334
|
-
|
|
1335
|
-
|
|
1383
|
+
if (currencyFormat) {
|
|
1384
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
1385
|
+
setInternalValue(formatted);
|
|
1386
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1387
|
+
const asNumber = Number(formatted);
|
|
1388
|
+
if (!isNaN(asNumber) && onChange) {
|
|
1389
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1390
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
1391
|
+
});
|
|
1392
|
+
onChange(syntheticEvent);
|
|
1393
|
+
}
|
|
1394
|
+
} else {
|
|
1395
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
1396
|
+
e.target.value = formattedValue;
|
|
1397
|
+
}
|
|
1336
1398
|
}
|
|
1337
1399
|
onBlur == null ? void 0 : onBlur(e);
|
|
1338
1400
|
};
|