@dmsi/wedgekit-react 0.0.1080 → 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
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
DataGridCell,
|
|
5
5
|
DragAlongCell,
|
|
6
6
|
DraggableCellHeader
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y2N7A2PP.js";
|
|
8
8
|
import "../chunk-X3NDEFVA.js";
|
|
9
9
|
import "../chunk-OM7QLLI2.js";
|
|
10
10
|
import "../chunk-PE3EZP56.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-TINCHPB4.js";
|
|
12
|
+
import "../chunk-KZPIH2K5.js";
|
|
13
13
|
import "../chunk-HXGJVYGQ.js";
|
|
14
14
|
import "../chunk-WVUIIBRR.js";
|
|
15
15
|
import "../chunk-ZRFXUER3.js";
|
|
@@ -572,6 +572,7 @@ var Input = (_a) => {
|
|
|
572
572
|
decimals,
|
|
573
573
|
uom,
|
|
574
574
|
currencyFormat = false,
|
|
575
|
+
formatOnBlur = false,
|
|
575
576
|
removeSearchIcon,
|
|
576
577
|
value: propValue,
|
|
577
578
|
onChange,
|
|
@@ -585,6 +586,7 @@ var Input = (_a) => {
|
|
|
585
586
|
"decimals",
|
|
586
587
|
"uom",
|
|
587
588
|
"currencyFormat",
|
|
589
|
+
"formatOnBlur",
|
|
588
590
|
"removeSearchIcon",
|
|
589
591
|
"value",
|
|
590
592
|
"onChange",
|
|
@@ -596,6 +598,7 @@ var Input = (_a) => {
|
|
|
596
598
|
]);
|
|
597
599
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
598
600
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
601
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
599
602
|
(0, import_react.useEffect)(() => {
|
|
600
603
|
var _a2;
|
|
601
604
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -611,9 +614,14 @@ var Input = (_a) => {
|
|
|
611
614
|
return;
|
|
612
615
|
}
|
|
613
616
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
617
|
+
if (formatOnBlur && isFocused) {
|
|
618
|
+
setInternalValue(stringValue);
|
|
619
|
+
setDisplayValue(stringValue);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
614
622
|
setInternalValue(formatted);
|
|
615
623
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
616
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
624
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
617
625
|
const getInputProps = () => {
|
|
618
626
|
var _a2;
|
|
619
627
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -728,7 +736,9 @@ var Input = (_a) => {
|
|
|
728
736
|
currentDecimals
|
|
729
737
|
);
|
|
730
738
|
setInternalValue(formattedClamped);
|
|
731
|
-
setDisplayValue(
|
|
739
|
+
setDisplayValue(
|
|
740
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
741
|
+
);
|
|
732
742
|
if (onChange) {
|
|
733
743
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
734
744
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -738,7 +748,7 @@ var Input = (_a) => {
|
|
|
738
748
|
return;
|
|
739
749
|
}
|
|
740
750
|
setInternalValue(raw);
|
|
741
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
751
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
742
752
|
if (!isNaN(asNumber) && onChange) {
|
|
743
753
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
744
754
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -824,6 +834,7 @@ var Input = (_a) => {
|
|
|
824
834
|
}
|
|
825
835
|
};
|
|
826
836
|
const handleBlur = (e) => {
|
|
837
|
+
setIsFocused(false);
|
|
827
838
|
if (!internalValue) {
|
|
828
839
|
onBlur == null ? void 0 : onBlur(e);
|
|
829
840
|
return;
|
|
@@ -858,12 +869,18 @@ var Input = (_a) => {
|
|
|
858
869
|
}
|
|
859
870
|
onBlur == null ? void 0 : onBlur(e);
|
|
860
871
|
};
|
|
872
|
+
const handleFocus = (e) => {
|
|
873
|
+
var _a2;
|
|
874
|
+
setIsFocused(true);
|
|
875
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
876
|
+
};
|
|
861
877
|
const inputProps = getInputProps();
|
|
862
878
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
863
879
|
InputBase,
|
|
864
880
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
865
881
|
before: getBeforeElement(),
|
|
866
882
|
after: getAfterElement(),
|
|
883
|
+
onFocus: handleFocus,
|
|
867
884
|
onChange: handleChange,
|
|
868
885
|
onBlur: handleBlur,
|
|
869
886
|
testid,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DateInput
|
|
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,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CalendarRange
|
|
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,14 +38,14 @@ 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-
|
|
45
|
+
import "../chunk-TINCHPB4.js";
|
|
46
46
|
import {
|
|
47
47
|
InputBase
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-KZPIH2K5.js";
|
|
49
49
|
import "../chunk-HXGJVYGQ.js";
|
|
50
50
|
import "../chunk-WVUIIBRR.js";
|
|
51
51
|
import "../chunk-M7WHWZ2J.js";
|
|
@@ -1112,6 +1112,7 @@ var Input = (_a) => {
|
|
|
1112
1112
|
decimals,
|
|
1113
1113
|
uom,
|
|
1114
1114
|
currencyFormat = false,
|
|
1115
|
+
formatOnBlur = false,
|
|
1115
1116
|
removeSearchIcon,
|
|
1116
1117
|
value: propValue,
|
|
1117
1118
|
onChange,
|
|
@@ -1125,6 +1126,7 @@ var Input = (_a) => {
|
|
|
1125
1126
|
"decimals",
|
|
1126
1127
|
"uom",
|
|
1127
1128
|
"currencyFormat",
|
|
1129
|
+
"formatOnBlur",
|
|
1128
1130
|
"removeSearchIcon",
|
|
1129
1131
|
"value",
|
|
1130
1132
|
"onChange",
|
|
@@ -1136,6 +1138,7 @@ var Input = (_a) => {
|
|
|
1136
1138
|
]);
|
|
1137
1139
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
1138
1140
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
1141
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
1139
1142
|
(0, import_react.useEffect)(() => {
|
|
1140
1143
|
var _a2;
|
|
1141
1144
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -1151,9 +1154,14 @@ var Input = (_a) => {
|
|
|
1151
1154
|
return;
|
|
1152
1155
|
}
|
|
1153
1156
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
1157
|
+
if (formatOnBlur && isFocused) {
|
|
1158
|
+
setInternalValue(stringValue);
|
|
1159
|
+
setDisplayValue(stringValue);
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1154
1162
|
setInternalValue(formatted);
|
|
1155
1163
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
1156
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
1164
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
1157
1165
|
const getInputProps = () => {
|
|
1158
1166
|
var _a2;
|
|
1159
1167
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -1268,7 +1276,9 @@ var Input = (_a) => {
|
|
|
1268
1276
|
currentDecimals
|
|
1269
1277
|
);
|
|
1270
1278
|
setInternalValue(formattedClamped);
|
|
1271
|
-
setDisplayValue(
|
|
1279
|
+
setDisplayValue(
|
|
1280
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
1281
|
+
);
|
|
1272
1282
|
if (onChange) {
|
|
1273
1283
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1274
1284
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -1278,7 +1288,7 @@ var Input = (_a) => {
|
|
|
1278
1288
|
return;
|
|
1279
1289
|
}
|
|
1280
1290
|
setInternalValue(raw);
|
|
1281
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
1291
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
1282
1292
|
if (!isNaN(asNumber) && onChange) {
|
|
1283
1293
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
1284
1294
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -1364,6 +1374,7 @@ var Input = (_a) => {
|
|
|
1364
1374
|
}
|
|
1365
1375
|
};
|
|
1366
1376
|
const handleBlur = (e) => {
|
|
1377
|
+
setIsFocused(false);
|
|
1367
1378
|
if (!internalValue) {
|
|
1368
1379
|
onBlur == null ? void 0 : onBlur(e);
|
|
1369
1380
|
return;
|
|
@@ -1398,12 +1409,18 @@ var Input = (_a) => {
|
|
|
1398
1409
|
}
|
|
1399
1410
|
onBlur == null ? void 0 : onBlur(e);
|
|
1400
1411
|
};
|
|
1412
|
+
const handleFocus = (e) => {
|
|
1413
|
+
var _a2;
|
|
1414
|
+
setIsFocused(true);
|
|
1415
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
1416
|
+
};
|
|
1401
1417
|
const inputProps = getInputProps();
|
|
1402
1418
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1403
1419
|
InputBase,
|
|
1404
1420
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
1405
1421
|
before: getBeforeElement(),
|
|
1406
1422
|
after: getAfterElement(),
|
|
1423
|
+
onFocus: handleFocus,
|
|
1407
1424
|
onChange: handleChange,
|
|
1408
1425
|
onBlur: handleBlur,
|
|
1409
1426
|
testid,
|
|
@@ -573,6 +573,7 @@ var Input = (_a) => {
|
|
|
573
573
|
decimals,
|
|
574
574
|
uom,
|
|
575
575
|
currencyFormat = false,
|
|
576
|
+
formatOnBlur = false,
|
|
576
577
|
removeSearchIcon,
|
|
577
578
|
value: propValue,
|
|
578
579
|
onChange,
|
|
@@ -586,6 +587,7 @@ var Input = (_a) => {
|
|
|
586
587
|
"decimals",
|
|
587
588
|
"uom",
|
|
588
589
|
"currencyFormat",
|
|
590
|
+
"formatOnBlur",
|
|
589
591
|
"removeSearchIcon",
|
|
590
592
|
"value",
|
|
591
593
|
"onChange",
|
|
@@ -597,6 +599,7 @@ var Input = (_a) => {
|
|
|
597
599
|
]);
|
|
598
600
|
const [internalValue, setInternalValue] = (0, import_react.useState)("");
|
|
599
601
|
const [displayValue, setDisplayValue] = (0, import_react.useState)("");
|
|
602
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
600
603
|
(0, import_react.useEffect)(() => {
|
|
601
604
|
var _a2;
|
|
602
605
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -612,9 +615,14 @@ var Input = (_a) => {
|
|
|
612
615
|
return;
|
|
613
616
|
}
|
|
614
617
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
618
|
+
if (formatOnBlur && isFocused) {
|
|
619
|
+
setInternalValue(stringValue);
|
|
620
|
+
setDisplayValue(stringValue);
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
615
623
|
setInternalValue(formatted);
|
|
616
624
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
617
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
625
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
618
626
|
const getInputProps = () => {
|
|
619
627
|
var _a2;
|
|
620
628
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -729,7 +737,9 @@ var Input = (_a) => {
|
|
|
729
737
|
currentDecimals
|
|
730
738
|
);
|
|
731
739
|
setInternalValue(formattedClamped);
|
|
732
|
-
setDisplayValue(
|
|
740
|
+
setDisplayValue(
|
|
741
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
742
|
+
);
|
|
733
743
|
if (onChange) {
|
|
734
744
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
735
745
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -739,7 +749,7 @@ var Input = (_a) => {
|
|
|
739
749
|
return;
|
|
740
750
|
}
|
|
741
751
|
setInternalValue(raw);
|
|
742
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
752
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
743
753
|
if (!isNaN(asNumber) && onChange) {
|
|
744
754
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
745
755
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -825,6 +835,7 @@ var Input = (_a) => {
|
|
|
825
835
|
}
|
|
826
836
|
};
|
|
827
837
|
const handleBlur = (e) => {
|
|
838
|
+
setIsFocused(false);
|
|
828
839
|
if (!internalValue) {
|
|
829
840
|
onBlur == null ? void 0 : onBlur(e);
|
|
830
841
|
return;
|
|
@@ -859,12 +870,18 @@ var Input = (_a) => {
|
|
|
859
870
|
}
|
|
860
871
|
onBlur == null ? void 0 : onBlur(e);
|
|
861
872
|
};
|
|
873
|
+
const handleFocus = (e) => {
|
|
874
|
+
var _a2;
|
|
875
|
+
setIsFocused(true);
|
|
876
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
877
|
+
};
|
|
862
878
|
const inputProps = getInputProps();
|
|
863
879
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
864
880
|
InputBase,
|
|
865
881
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
866
882
|
before: getBeforeElement(),
|
|
867
883
|
after: getAfterElement(),
|
|
884
|
+
onFocus: handleFocus,
|
|
868
885
|
onChange: handleChange,
|
|
869
886
|
onBlur: handleBlur,
|
|
870
887
|
testid,
|
package/dist/components/Input.js
CHANGED
|
@@ -2106,6 +2106,7 @@ var Input = (_a) => {
|
|
|
2106
2106
|
decimals,
|
|
2107
2107
|
uom,
|
|
2108
2108
|
currencyFormat = false,
|
|
2109
|
+
formatOnBlur = false,
|
|
2109
2110
|
removeSearchIcon,
|
|
2110
2111
|
value: propValue,
|
|
2111
2112
|
onChange,
|
|
@@ -2119,6 +2120,7 @@ var Input = (_a) => {
|
|
|
2119
2120
|
"decimals",
|
|
2120
2121
|
"uom",
|
|
2121
2122
|
"currencyFormat",
|
|
2123
|
+
"formatOnBlur",
|
|
2122
2124
|
"removeSearchIcon",
|
|
2123
2125
|
"value",
|
|
2124
2126
|
"onChange",
|
|
@@ -2130,6 +2132,7 @@ var Input = (_a) => {
|
|
|
2130
2132
|
]);
|
|
2131
2133
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2132
2134
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2135
|
+
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2133
2136
|
(0, import_react10.useEffect)(() => {
|
|
2134
2137
|
var _a2;
|
|
2135
2138
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
@@ -2145,9 +2148,14 @@ var Input = (_a) => {
|
|
|
2145
2148
|
return;
|
|
2146
2149
|
}
|
|
2147
2150
|
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2151
|
+
if (formatOnBlur && isFocused) {
|
|
2152
|
+
setInternalValue(stringValue);
|
|
2153
|
+
setDisplayValue(stringValue);
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2148
2156
|
setInternalValue(formatted);
|
|
2149
2157
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2150
|
-
}, [propValue, variant, currencyFormat, decimals]);
|
|
2158
|
+
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2151
2159
|
const getInputProps = () => {
|
|
2152
2160
|
var _a2;
|
|
2153
2161
|
const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
|
|
@@ -2262,7 +2270,9 @@ var Input = (_a) => {
|
|
|
2262
2270
|
currentDecimals
|
|
2263
2271
|
);
|
|
2264
2272
|
setInternalValue(formattedClamped);
|
|
2265
|
-
setDisplayValue(
|
|
2273
|
+
setDisplayValue(
|
|
2274
|
+
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2275
|
+
);
|
|
2266
2276
|
if (onChange) {
|
|
2267
2277
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2268
2278
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2272,7 +2282,7 @@ var Input = (_a) => {
|
|
|
2272
2282
|
return;
|
|
2273
2283
|
}
|
|
2274
2284
|
setInternalValue(raw);
|
|
2275
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2285
|
+
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2276
2286
|
if (!isNaN(asNumber) && onChange) {
|
|
2277
2287
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2278
2288
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2358,6 +2368,7 @@ var Input = (_a) => {
|
|
|
2358
2368
|
}
|
|
2359
2369
|
};
|
|
2360
2370
|
const handleBlur = (e) => {
|
|
2371
|
+
setIsFocused(false);
|
|
2361
2372
|
if (!internalValue) {
|
|
2362
2373
|
onBlur == null ? void 0 : onBlur(e);
|
|
2363
2374
|
return;
|
|
@@ -2392,12 +2403,18 @@ var Input = (_a) => {
|
|
|
2392
2403
|
}
|
|
2393
2404
|
onBlur == null ? void 0 : onBlur(e);
|
|
2394
2405
|
};
|
|
2406
|
+
const handleFocus = (e) => {
|
|
2407
|
+
var _a2;
|
|
2408
|
+
setIsFocused(true);
|
|
2409
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
|
|
2410
|
+
};
|
|
2395
2411
|
const inputProps = getInputProps();
|
|
2396
2412
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2397
2413
|
InputBase,
|
|
2398
2414
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
2399
2415
|
before: getBeforeElement(),
|
|
2400
2416
|
after: getAfterElement(),
|
|
2417
|
+
onFocus: handleFocus,
|
|
2401
2418
|
onChange: handleChange,
|
|
2402
2419
|
onBlur: handleBlur,
|
|
2403
2420
|
testid,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnSelector
|
|
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";
|
|
@@ -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
|
MobileDataGridHeader
|
|
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";
|