@dmsi/wedgekit-react 0.0.1079 → 0.0.1081
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-FD2FKB5M.js → chunk-FDQBM3O4.js} +4 -4
- package/dist/{chunk-NEMOTB6U.js → chunk-KZPIH2K5.js} +20 -3
- package/dist/{chunk-IEKZBWVL.js → chunk-SISDU5GI.js} +1 -1
- package/dist/{chunk-72WLEGGU.js → chunk-TINCHPB4.js} +1 -1
- package/dist/{chunk-RMKITIDU.js → chunk-Y2N7A2PP.js} +1 -1
- package/dist/components/CalendarRange.cjs +20 -3
- package/dist/components/CalendarRange.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +20 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +20 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
- package/dist/components/DataGrid/PinnedColumns.cjs +20 -3
- package/dist/components/DataGrid/PinnedColumns.js +5 -5
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +20 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +20 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
- package/dist/components/DataGrid/TableBody/index.cjs +20 -3
- package/dist/components/DataGrid/TableBody/index.js +5 -5
- package/dist/components/DataGrid/index.cjs +20 -3
- package/dist/components/DataGrid/index.js +5 -5
- package/dist/components/DataGrid/utils.cjs +20 -3
- package/dist/components/DataGrid/utils.js +5 -5
- package/dist/components/DataGridCell.cjs +20 -3
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +20 -3
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.cjs +20 -3
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/FilterGroup.cjs +20 -3
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +20 -3
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +20 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +20 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +20 -3
- package/dist/components/MobileDataGrid/index.js +5 -5
- package/dist/components/Password.cjs +20 -3
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +20 -3
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +20 -3
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +20 -3
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +20 -3
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +20 -3
- package/dist/components/index.js +5 -5
- package/package.json +1 -1
|
@@ -2537,6 +2537,7 @@ var Input = (_a) => {
|
|
|
2537
2537
|
decimals,
|
|
2538
2538
|
uom,
|
|
2539
2539
|
currencyFormat = false,
|
|
2540
|
+
formatOnBlur = false,
|
|
2540
2541
|
removeSearchIcon,
|
|
2541
2542
|
value: propValue,
|
|
2542
2543
|
onChange,
|
|
@@ -2550,6 +2551,7 @@ var Input = (_a) => {
|
|
|
2550
2551
|
"decimals",
|
|
2551
2552
|
"uom",
|
|
2552
2553
|
"currencyFormat",
|
|
2554
|
+
"formatOnBlur",
|
|
2553
2555
|
"removeSearchIcon",
|
|
2554
2556
|
"value",
|
|
2555
2557
|
"onChange",
|
|
@@ -2561,6 +2563,7 @@ var Input = (_a) => {
|
|
|
2561
2563
|
]);
|
|
2562
2564
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2563
2565
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2566
|
+
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2564
2567
|
(0, import_react10.useEffect)(() => {
|
|
2565
2568
|
var _a2;
|
|
2566
2569
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -2576,9 +2579,14 @@ var Input = (_a) => {
|
|
|
2576
2579
|
return;
|
|
2577
2580
|
}
|
|
2578
2581
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2582
|
+
if (formatOnBlur && isFocused) {
|
|
2583
|
+
setInternalValue(stringValue);
|
|
2584
|
+
setDisplayValue(stringValue);
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2579
2587
|
setInternalValue(formatted);
|
|
2580
2588
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2581
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
2589
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2582
2590
|
const getInputProps = () => {
|
|
2583
2591
|
var _a2;
|
|
2584
2592
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2693,7 +2701,9 @@ var Input = (_a) => {
|
|
|
2693
2701
|
currentDecimals
|
|
2694
2702
|
);
|
|
2695
2703
|
setInternalValue(formattedClamped);
|
|
2696
|
-
setDisplayValue(
|
|
2704
|
+
setDisplayValue(
|
|
2705
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2706
|
+
);
|
|
2697
2707
|
if (onChange) {
|
|
2698
2708
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2699
2709
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2703,7 +2713,7 @@ var Input = (_a) => {
|
|
|
2703
2713
|
return;
|
|
2704
2714
|
}
|
|
2705
2715
|
setInternalValue(raw);
|
|
2706
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2716
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2707
2717
|
if (!isNaN(asNumber) && onChange) {
|
|
2708
2718
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2709
2719
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2789,6 +2799,7 @@ var Input = (_a) => {
|
|
|
2789
2799
|
}
|
|
2790
2800
|
};
|
|
2791
2801
|
const handleBlur = (e) => {
|
|
2802
|
+
setIsFocused(false);
|
|
2792
2803
|
if (!internalValue) {
|
|
2793
2804
|
onBlur == null ? void 0 : onBlur(e);
|
|
2794
2805
|
return;
|
|
@@ -2823,12 +2834,18 @@ var Input = (_a) => {
|
|
|
2823
2834
|
}
|
|
2824
2835
|
onBlur == null ? void 0 : onBlur(e);
|
|
2825
2836
|
};
|
|
2837
|
+
const handleFocus = (e) => {
|
|
2838
|
+
var _a2;
|
|
2839
|
+
setIsFocused(true);
|
|
2840
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
2841
|
+
};
|
|
2826
2842
|
const inputProps = getInputProps();
|
|
2827
2843
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2828
2844
|
InputBase,
|
|
2829
2845
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
2830
2846
|
before: getBeforeElement(),
|
|
2831
2847
|
after: getAfterElement(),
|
|
2848
|
+
onFocus: handleFocus,
|
|
2832
2849
|
onChange: handleChange,
|
|
2833
2850
|
onBlur: handleBlur,
|
|
2834
2851
|
testid,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MobileDataGrid
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-FDQBM3O4.js";
|
|
4
4
|
import "../../chunk-M7INAUAJ.js";
|
|
5
5
|
import "../../chunk-ICHD7DUS.js";
|
|
6
6
|
import "../../chunk-XPZY6KEI.js";
|
|
@@ -21,7 +21,7 @@ import "../../chunk-AJ5M6MVX.js";
|
|
|
21
21
|
import "../../chunk-7IPESTQS.js";
|
|
22
22
|
import "../../chunk-EWGHVZL5.js";
|
|
23
23
|
import "../../chunk-AT4AWD6B.js";
|
|
24
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-SISDU5GI.js";
|
|
25
25
|
import "../../chunk-KWMG6SN2.js";
|
|
26
26
|
import "../../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../../chunk-O2IR67XN.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-Y2N7A2PP.js";
|
|
42
42
|
import "../../chunk-X3NDEFVA.js";
|
|
43
43
|
import "../../chunk-OM7QLLI2.js";
|
|
44
44
|
import "../../chunk-PE3EZP56.js";
|
|
45
|
-
import "../../chunk-
|
|
46
|
-
import "../../chunk-
|
|
45
|
+
import "../../chunk-TINCHPB4.js";
|
|
46
|
+
import "../../chunk-KZPIH2K5.js";
|
|
47
47
|
import "../../chunk-HXGJVYGQ.js";
|
|
48
48
|
import "../../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../../chunk-M7WHWZ2J.js";
|
|
@@ -571,6 +571,7 @@ var Input = (_a) => {
|
|
|
571
571
|
decimals,
|
|
572
572
|
uom,
|
|
573
573
|
currencyFormat = false,
|
|
574
|
+
formatOnBlur = false,
|
|
574
575
|
removeSearchIcon,
|
|
575
576
|
value: propValue,
|
|
576
577
|
onChange,
|
|
@@ -584,6 +585,7 @@ var Input = (_a) => {
|
|
|
584
585
|
"decimals",
|
|
585
586
|
"uom",
|
|
586
587
|
"currencyFormat",
|
|
588
|
+
"formatOnBlur",
|
|
587
589
|
"removeSearchIcon",
|
|
588
590
|
"value",
|
|
589
591
|
"onChange",
|
|
@@ -595,6 +597,7 @@ var Input = (_a) => {
|
|
|
595
597
|
]);
|
|
596
598
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
597
599
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
600
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
598
601
|
(0, import_react.useEffect)(() => {
|
|
599
602
|
var _a2;
|
|
600
603
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -610,9 +613,14 @@ var Input = (_a) => {
|
|
|
610
613
|
return;
|
|
611
614
|
}
|
|
612
615
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
616
|
+
if (formatOnBlur && isFocused) {
|
|
617
|
+
setInternalValue(stringValue);
|
|
618
|
+
setDisplayValue(stringValue);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
613
621
|
setInternalValue(formatted);
|
|
614
622
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
615
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
623
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
616
624
|
const getInputProps = () => {
|
|
617
625
|
var _a2;
|
|
618
626
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -727,7 +735,9 @@ var Input = (_a) => {
|
|
|
727
735
|
currentDecimals
|
|
728
736
|
);
|
|
729
737
|
setInternalValue(formattedClamped);
|
|
730
|
-
setDisplayValue(
|
|
738
|
+
setDisplayValue(
|
|
739
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
740
|
+
);
|
|
731
741
|
if (onChange) {
|
|
732
742
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
733
743
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -737,7 +747,7 @@ var Input = (_a) => {
|
|
|
737
747
|
return;
|
|
738
748
|
}
|
|
739
749
|
setInternalValue(raw);
|
|
740
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
750
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
741
751
|
if (!isNaN(asNumber) && onChange) {
|
|
742
752
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
743
753
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -823,6 +833,7 @@ var Input = (_a) => {
|
|
|
823
833
|
}
|
|
824
834
|
};
|
|
825
835
|
const handleBlur = (e) => {
|
|
836
|
+
setIsFocused(false);
|
|
826
837
|
if (!internalValue) {
|
|
827
838
|
onBlur == null ? void 0 : onBlur(e);
|
|
828
839
|
return;
|
|
@@ -857,12 +868,18 @@ var Input = (_a) => {
|
|
|
857
868
|
}
|
|
858
869
|
onBlur == null ? void 0 : onBlur(e);
|
|
859
870
|
};
|
|
871
|
+
const handleFocus = (e) => {
|
|
872
|
+
var _a2;
|
|
873
|
+
setIsFocused(true);
|
|
874
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
875
|
+
};
|
|
860
876
|
const inputProps = getInputProps();
|
|
861
877
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
862
878
|
InputBase,
|
|
863
879
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
864
880
|
before: getBeforeElement(),
|
|
865
881
|
after: getAfterElement(),
|
|
882
|
+
onFocus: handleFocus,
|
|
866
883
|
onChange: handleChange,
|
|
867
884
|
onBlur: handleBlur,
|
|
868
885
|
testid,
|
|
@@ -571,6 +571,7 @@ var Input = (_a) => {
|
|
|
571
571
|
decimals,
|
|
572
572
|
uom,
|
|
573
573
|
currencyFormat = false,
|
|
574
|
+
formatOnBlur = false,
|
|
574
575
|
removeSearchIcon,
|
|
575
576
|
value: propValue,
|
|
576
577
|
onChange,
|
|
@@ -584,6 +585,7 @@ var Input = (_a) => {
|
|
|
584
585
|
"decimals",
|
|
585
586
|
"uom",
|
|
586
587
|
"currencyFormat",
|
|
588
|
+
"formatOnBlur",
|
|
587
589
|
"removeSearchIcon",
|
|
588
590
|
"value",
|
|
589
591
|
"onChange",
|
|
@@ -595,6 +597,7 @@ var Input = (_a) => {
|
|
|
595
597
|
]);
|
|
596
598
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
597
599
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
600
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
598
601
|
(0, import_react.useEffect)(() => {
|
|
599
602
|
var _a2;
|
|
600
603
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -610,9 +613,14 @@ var Input = (_a) => {
|
|
|
610
613
|
return;
|
|
611
614
|
}
|
|
612
615
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
616
|
+
if (formatOnBlur && isFocused) {
|
|
617
|
+
setInternalValue(stringValue);
|
|
618
|
+
setDisplayValue(stringValue);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
613
621
|
setInternalValue(formatted);
|
|
614
622
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
615
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
623
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
616
624
|
const getInputProps = () => {
|
|
617
625
|
var _a2;
|
|
618
626
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -727,7 +735,9 @@ var Input = (_a) => {
|
|
|
727
735
|
currentDecimals
|
|
728
736
|
);
|
|
729
737
|
setInternalValue(formattedClamped);
|
|
730
|
-
setDisplayValue(
|
|
738
|
+
setDisplayValue(
|
|
739
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
740
|
+
);
|
|
731
741
|
if (onChange) {
|
|
732
742
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
733
743
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -737,7 +747,7 @@ var Input = (_a) => {
|
|
|
737
747
|
return;
|
|
738
748
|
}
|
|
739
749
|
setInternalValue(raw);
|
|
740
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
750
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
741
751
|
if (!isNaN(asNumber) && onChange) {
|
|
742
752
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
743
753
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -823,6 +833,7 @@ var Input = (_a) => {
|
|
|
823
833
|
}
|
|
824
834
|
};
|
|
825
835
|
const handleBlur = (e) => {
|
|
836
|
+
setIsFocused(false);
|
|
826
837
|
if (!internalValue) {
|
|
827
838
|
onBlur == null ? void 0 : onBlur(e);
|
|
828
839
|
return;
|
|
@@ -857,12 +868,18 @@ var Input = (_a) => {
|
|
|
857
868
|
}
|
|
858
869
|
onBlur == null ? void 0 : onBlur(e);
|
|
859
870
|
};
|
|
871
|
+
const handleFocus = (e) => {
|
|
872
|
+
var _a2;
|
|
873
|
+
setIsFocused(true);
|
|
874
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
875
|
+
};
|
|
860
876
|
const inputProps = getInputProps();
|
|
861
877
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
862
878
|
InputBase,
|
|
863
879
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
864
880
|
before: getBeforeElement(),
|
|
865
881
|
after: getAfterElement(),
|
|
882
|
+
onFocus: handleFocus,
|
|
866
883
|
onChange: handleChange,
|
|
867
884
|
onBlur: handleBlur,
|
|
868
885
|
testid,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Search
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-TINCHPB4.js";
|
|
5
|
+
import "../chunk-KZPIH2K5.js";
|
|
6
6
|
import "../chunk-HXGJVYGQ.js";
|
|
7
7
|
import "../chunk-5UH6QUFB.js";
|
|
8
8
|
import "../chunk-WMPWWFUJ.js";
|
|
@@ -571,6 +571,7 @@ var Input = (_a) => {
|
|
|
571
571
|
decimals,
|
|
572
572
|
uom,
|
|
573
573
|
currencyFormat = false,
|
|
574
|
+
formatOnBlur = false,
|
|
574
575
|
removeSearchIcon,
|
|
575
576
|
value: propValue,
|
|
576
577
|
onChange,
|
|
@@ -584,6 +585,7 @@ var Input = (_a) => {
|
|
|
584
585
|
"decimals",
|
|
585
586
|
"uom",
|
|
586
587
|
"currencyFormat",
|
|
588
|
+
"formatOnBlur",
|
|
587
589
|
"removeSearchIcon",
|
|
588
590
|
"value",
|
|
589
591
|
"onChange",
|
|
@@ -595,6 +597,7 @@ var Input = (_a) => {
|
|
|
595
597
|
]);
|
|
596
598
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
597
599
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
600
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
598
601
|
(0, import_react.useEffect)(() => {
|
|
599
602
|
var _a2;
|
|
600
603
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -610,9 +613,14 @@ var Input = (_a) => {
|
|
|
610
613
|
return;
|
|
611
614
|
}
|
|
612
615
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
616
|
+
if (formatOnBlur && isFocused) {
|
|
617
|
+
setInternalValue(stringValue);
|
|
618
|
+
setDisplayValue(stringValue);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
613
621
|
setInternalValue(formatted);
|
|
614
622
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
615
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
623
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
616
624
|
const getInputProps = () => {
|
|
617
625
|
var _a2;
|
|
618
626
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -727,7 +735,9 @@ var Input = (_a) => {
|
|
|
727
735
|
currentDecimals
|
|
728
736
|
);
|
|
729
737
|
setInternalValue(formattedClamped);
|
|
730
|
-
setDisplayValue(
|
|
738
|
+
setDisplayValue(
|
|
739
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
740
|
+
);
|
|
731
741
|
if (onChange) {
|
|
732
742
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
733
743
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -737,7 +747,7 @@ var Input = (_a) => {
|
|
|
737
747
|
return;
|
|
738
748
|
}
|
|
739
749
|
setInternalValue(raw);
|
|
740
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
750
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
741
751
|
if (!isNaN(asNumber) && onChange) {
|
|
742
752
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
743
753
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -823,6 +833,7 @@ var Input = (_a) => {
|
|
|
823
833
|
}
|
|
824
834
|
};
|
|
825
835
|
const handleBlur = (e) => {
|
|
836
|
+
setIsFocused(false);
|
|
826
837
|
if (!internalValue) {
|
|
827
838
|
onBlur == null ? void 0 : onBlur(e);
|
|
828
839
|
return;
|
|
@@ -857,12 +868,18 @@ var Input = (_a) => {
|
|
|
857
868
|
}
|
|
858
869
|
onBlur == null ? void 0 : onBlur(e);
|
|
859
870
|
};
|
|
871
|
+
const handleFocus = (e) => {
|
|
872
|
+
var _a2;
|
|
873
|
+
setIsFocused(true);
|
|
874
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
875
|
+
};
|
|
860
876
|
const inputProps = getInputProps();
|
|
861
877
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
862
878
|
InputBase,
|
|
863
879
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
864
880
|
before: getBeforeElement(),
|
|
865
881
|
after: getAfterElement(),
|
|
882
|
+
onFocus: handleFocus,
|
|
866
883
|
onChange: handleChange,
|
|
867
884
|
onBlur: handleBlur,
|
|
868
885
|
testid,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Select
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-SISDU5GI.js";
|
|
5
|
+
import "../chunk-KZPIH2K5.js";
|
|
6
6
|
import "../chunk-HXGJVYGQ.js";
|
|
7
7
|
import "../chunk-5UH6QUFB.js";
|
|
8
8
|
import "../chunk-WMPWWFUJ.js";
|
|
@@ -766,6 +766,7 @@ var Input = (_a) => {
|
|
|
766
766
|
decimals,
|
|
767
767
|
uom,
|
|
768
768
|
currencyFormat = false,
|
|
769
|
+
formatOnBlur = false,
|
|
769
770
|
removeSearchIcon,
|
|
770
771
|
value: propValue,
|
|
771
772
|
onChange,
|
|
@@ -779,6 +780,7 @@ var Input = (_a) => {
|
|
|
779
780
|
"decimals",
|
|
780
781
|
"uom",
|
|
781
782
|
"currencyFormat",
|
|
783
|
+
"formatOnBlur",
|
|
782
784
|
"removeSearchIcon",
|
|
783
785
|
"value",
|
|
784
786
|
"onChange",
|
|
@@ -790,6 +792,7 @@ var Input = (_a) => {
|
|
|
790
792
|
]);
|
|
791
793
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
792
794
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
795
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
793
796
|
(0, import_react.useEffect)(() => {
|
|
794
797
|
var _a2;
|
|
795
798
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -805,9 +808,14 @@ var Input = (_a) => {
|
|
|
805
808
|
return;
|
|
806
809
|
}
|
|
807
810
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
811
|
+
if (formatOnBlur && isFocused) {
|
|
812
|
+
setInternalValue(stringValue);
|
|
813
|
+
setDisplayValue(stringValue);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
808
816
|
setInternalValue(formatted);
|
|
809
817
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
810
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
818
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
811
819
|
const getInputProps = () => {
|
|
812
820
|
var _a2;
|
|
813
821
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -922,7 +930,9 @@ var Input = (_a) => {
|
|
|
922
930
|
currentDecimals
|
|
923
931
|
);
|
|
924
932
|
setInternalValue(formattedClamped);
|
|
925
|
-
setDisplayValue(
|
|
933
|
+
setDisplayValue(
|
|
934
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
935
|
+
);
|
|
926
936
|
if (onChange) {
|
|
927
937
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
928
938
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -932,7 +942,7 @@ var Input = (_a) => {
|
|
|
932
942
|
return;
|
|
933
943
|
}
|
|
934
944
|
setInternalValue(raw);
|
|
935
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
945
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
936
946
|
if (!isNaN(asNumber) && onChange) {
|
|
937
947
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
938
948
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -1018,6 +1028,7 @@ var Input = (_a) => {
|
|
|
1018
1028
|
}
|
|
1019
1029
|
};
|
|
1020
1030
|
const handleBlur = (e) => {
|
|
1031
|
+
setIsFocused(false);
|
|
1021
1032
|
if (!internalValue) {
|
|
1022
1033
|
onBlur == null ? void 0 : onBlur(e);
|
|
1023
1034
|
return;
|
|
@@ -1052,12 +1063,18 @@ var Input = (_a) => {
|
|
|
1052
1063
|
}
|
|
1053
1064
|
onBlur == null ? void 0 : onBlur(e);
|
|
1054
1065
|
};
|
|
1066
|
+
const handleFocus = (e) => {
|
|
1067
|
+
var _a2;
|
|
1068
|
+
setIsFocused(true);
|
|
1069
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
1070
|
+
};
|
|
1055
1071
|
const inputProps = getInputProps();
|
|
1056
1072
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1057
1073
|
InputBase,
|
|
1058
1074
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
1059
1075
|
before: getBeforeElement(),
|
|
1060
1076
|
after: getAfterElement(),
|
|
1077
|
+
onFocus: handleFocus,
|
|
1061
1078
|
onChange: handleChange,
|
|
1062
1079
|
onBlur: handleBlur,
|
|
1063
1080
|
testid,
|
package/dist/components/Time.cjs
CHANGED
|
@@ -570,6 +570,7 @@ var Input = (_a) => {
|
|
|
570
570
|
decimals,
|
|
571
571
|
uom,
|
|
572
572
|
currencyFormat = false,
|
|
573
|
+
formatOnBlur = false,
|
|
573
574
|
removeSearchIcon,
|
|
574
575
|
value: propValue,
|
|
575
576
|
onChange,
|
|
@@ -583,6 +584,7 @@ var Input = (_a) => {
|
|
|
583
584
|
"decimals",
|
|
584
585
|
"uom",
|
|
585
586
|
"currencyFormat",
|
|
587
|
+
"formatOnBlur",
|
|
586
588
|
"removeSearchIcon",
|
|
587
589
|
"value",
|
|
588
590
|
"onChange",
|
|
@@ -594,6 +596,7 @@ var Input = (_a) => {
|
|
|
594
596
|
]);
|
|
595
597
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
596
598
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
599
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
597
600
|
(0, import_react.useEffect)(() => {
|
|
598
601
|
var _a2;
|
|
599
602
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -609,9 +612,14 @@ var Input = (_a) => {
|
|
|
609
612
|
return;
|
|
610
613
|
}
|
|
611
614
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
615
|
+
if (formatOnBlur && isFocused) {
|
|
616
|
+
setInternalValue(stringValue);
|
|
617
|
+
setDisplayValue(stringValue);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
612
620
|
setInternalValue(formatted);
|
|
613
621
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
614
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
622
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
615
623
|
const getInputProps = () => {
|
|
616
624
|
var _a2;
|
|
617
625
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -726,7 +734,9 @@ var Input = (_a) => {
|
|
|
726
734
|
currentDecimals
|
|
727
735
|
);
|
|
728
736
|
setInternalValue(formattedClamped);
|
|
729
|
-
setDisplayValue(
|
|
737
|
+
setDisplayValue(
|
|
738
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
739
|
+
);
|
|
730
740
|
if (onChange) {
|
|
731
741
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
732
742
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -736,7 +746,7 @@ var Input = (_a) => {
|
|
|
736
746
|
return;
|
|
737
747
|
}
|
|
738
748
|
setInternalValue(raw);
|
|
739
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
749
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
740
750
|
if (!isNaN(asNumber) && onChange) {
|
|
741
751
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
742
752
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -822,6 +832,7 @@ var Input = (_a) => {
|
|
|
822
832
|
}
|
|
823
833
|
};
|
|
824
834
|
const handleBlur = (e) => {
|
|
835
|
+
setIsFocused(false);
|
|
825
836
|
if (!internalValue) {
|
|
826
837
|
onBlur == null ? void 0 : onBlur(e);
|
|
827
838
|
return;
|
|
@@ -856,12 +867,18 @@ var Input = (_a) => {
|
|
|
856
867
|
}
|
|
857
868
|
onBlur == null ? void 0 : onBlur(e);
|
|
858
869
|
};
|
|
870
|
+
const handleFocus = (e) => {
|
|
871
|
+
var _a2;
|
|
872
|
+
setIsFocused(true);
|
|
873
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
874
|
+
};
|
|
859
875
|
const inputProps = getInputProps();
|
|
860
876
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
861
877
|
InputBase,
|
|
862
878
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
863
879
|
before: getBeforeElement(),
|
|
864
880
|
after: getAfterElement(),
|
|
881
|
+
onFocus: handleFocus,
|
|
865
882
|
onChange: handleChange,
|
|
866
883
|
onBlur: handleBlur,
|
|
867
884
|
testid,
|
package/dist/components/Time.js
CHANGED
|
@@ -2140,6 +2140,7 @@ var Input = (_a) => {
|
|
|
2140
2140
|
decimals,
|
|
2141
2141
|
uom,
|
|
2142
2142
|
currencyFormat = false,
|
|
2143
|
+
formatOnBlur = false,
|
|
2143
2144
|
removeSearchIcon,
|
|
2144
2145
|
value: propValue,
|
|
2145
2146
|
onChange,
|
|
@@ -2153,6 +2154,7 @@ var Input = (_a) => {
|
|
|
2153
2154
|
"decimals",
|
|
2154
2155
|
"uom",
|
|
2155
2156
|
"currencyFormat",
|
|
2157
|
+
"formatOnBlur",
|
|
2156
2158
|
"removeSearchIcon",
|
|
2157
2159
|
"value",
|
|
2158
2160
|
"onChange",
|
|
@@ -2164,6 +2166,7 @@ var Input = (_a) => {
|
|
|
2164
2166
|
]);
|
|
2165
2167
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2166
2168
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2169
|
+
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2167
2170
|
(0, import_react10.useEffect)(() => {
|
|
2168
2171
|
var _a2;
|
|
2169
2172
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -2179,9 +2182,14 @@ var Input = (_a) => {
|
|
|
2179
2182
|
return;
|
|
2180
2183
|
}
|
|
2181
2184
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2185
|
+
if (formatOnBlur && isFocused) {
|
|
2186
|
+
setInternalValue(stringValue);
|
|
2187
|
+
setDisplayValue(stringValue);
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2182
2190
|
setInternalValue(formatted);
|
|
2183
2191
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2184
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
2192
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2185
2193
|
const getInputProps = () => {
|
|
2186
2194
|
var _a2;
|
|
2187
2195
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2296,7 +2304,9 @@ var Input = (_a) => {
|
|
|
2296
2304
|
currentDecimals
|
|
2297
2305
|
);
|
|
2298
2306
|
setInternalValue(formattedClamped);
|
|
2299
|
-
setDisplayValue(
|
|
2307
|
+
setDisplayValue(
|
|
2308
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2309
|
+
);
|
|
2300
2310
|
if (onChange) {
|
|
2301
2311
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2302
2312
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2306,7 +2316,7 @@ var Input = (_a) => {
|
|
|
2306
2316
|
return;
|
|
2307
2317
|
}
|
|
2308
2318
|
setInternalValue(raw);
|
|
2309
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2319
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2310
2320
|
if (!isNaN(asNumber) && onChange) {
|
|
2311
2321
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2312
2322
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2392,6 +2402,7 @@ var Input = (_a) => {
|
|
|
2392
2402
|
}
|
|
2393
2403
|
};
|
|
2394
2404
|
const handleBlur = (e) => {
|
|
2405
|
+
setIsFocused(false);
|
|
2395
2406
|
if (!internalValue) {
|
|
2396
2407
|
onBlur == null ? void 0 : onBlur(e);
|
|
2397
2408
|
return;
|
|
@@ -2426,12 +2437,18 @@ var Input = (_a) => {
|
|
|
2426
2437
|
}
|
|
2427
2438
|
onBlur == null ? void 0 : onBlur(e);
|
|
2428
2439
|
};
|
|
2440
|
+
const handleFocus = (e) => {
|
|
2441
|
+
var _a2;
|
|
2442
|
+
setIsFocused(true);
|
|
2443
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
2444
|
+
};
|
|
2429
2445
|
const inputProps = getInputProps();
|
|
2430
2446
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2431
2447
|
InputBase,
|
|
2432
2448
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
2433
2449
|
before: getBeforeElement(),
|
|
2434
2450
|
after: getAfterElement(),
|
|
2451
|
+
onFocus: handleFocus,
|
|
2435
2452
|
onChange: handleChange,
|
|
2436
2453
|
onBlur: handleBlur,
|
|
2437
2454
|
testid,
|