@dmsi/wedgekit-react 0.0.1248 → 0.0.1249
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-MOBFZ672.js → chunk-3DJWSTPS.js} +1 -1
- package/dist/{chunk-EA6Y4HXQ.js → chunk-4FUZDLWX.js} +1 -1
- package/dist/{chunk-PABII472.js → chunk-H5SHC4XZ.js} +40 -33
- package/dist/{chunk-PBJ2MEHM.js → chunk-QW4AJ5FK.js} +1 -1
- package/dist/{chunk-5UPADXVU.js → chunk-WSZ3ET5G.js} +4 -4
- package/dist/components/CalendarRange.cjs +40 -33
- package/dist/components/CalendarRange.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +40 -33
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +40 -33
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
- package/dist/components/DataGrid/PinnedColumns.cjs +40 -33
- package/dist/components/DataGrid/PinnedColumns.js +5 -5
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +40 -33
- package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +40 -33
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
- package/dist/components/DataGrid/TableBody/index.cjs +40 -33
- package/dist/components/DataGrid/TableBody/index.js +5 -5
- package/dist/components/DataGrid/index.cjs +40 -33
- package/dist/components/DataGrid/index.js +5 -5
- package/dist/components/DataGrid/utils.cjs +40 -33
- package/dist/components/DataGrid/utils.js +5 -5
- package/dist/components/DataGridCell.cjs +40 -33
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +40 -33
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.cjs +40 -33
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/FilterGroup.cjs +40 -33
- package/dist/components/FilterGroup.js +2 -2
- package/dist/components/Input.cjs +40 -33
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +40 -33
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +40 -33
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +40 -33
- package/dist/components/MobileDataGrid/index.js +5 -5
- package/dist/components/Password.cjs +40 -33
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +40 -33
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +40 -33
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +40 -33
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Time.cjs +40 -33
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +40 -33
- package/dist/components/index.js +5 -5
- package/package.json +1 -1
|
@@ -1910,6 +1910,14 @@ var import_react11 = require("react");
|
|
|
1910
1910
|
var import_react10 = require("react");
|
|
1911
1911
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
1912
1912
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1913
|
+
function hasEquivalentNumericValue(currentValue, nextValue) {
|
|
1914
|
+
if (!currentValue || !nextValue) {
|
|
1915
|
+
return false;
|
|
1916
|
+
}
|
|
1917
|
+
const currentNumericValue = Number(currentValue.replace(/,/g, ""));
|
|
1918
|
+
const nextNumericValue = Number(nextValue.replace(/,/g, ""));
|
|
1919
|
+
return !Number.isNaN(currentNumericValue) && !Number.isNaN(nextNumericValue) && currentNumericValue === nextNumericValue;
|
|
1920
|
+
}
|
|
1913
1921
|
var InputBase = (_a) => {
|
|
1914
1922
|
var _b = _a, {
|
|
1915
1923
|
id,
|
|
@@ -2132,28 +2140,33 @@ var Input = (_a) => {
|
|
|
2132
2140
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2133
2141
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2134
2142
|
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2143
|
+
const internalValueRef = (0, import_react10.useRef)("");
|
|
2144
|
+
const setInputValues = (nextInternalValue, nextDisplayValue) => {
|
|
2145
|
+
internalValueRef.current = nextInternalValue;
|
|
2146
|
+
setInternalValue(nextInternalValue);
|
|
2147
|
+
setDisplayValue(nextDisplayValue);
|
|
2148
|
+
};
|
|
2135
2149
|
(0, import_react10.useEffect)(() => {
|
|
2136
2150
|
var _a2;
|
|
2137
2151
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2138
2152
|
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2139
2153
|
if (!stringValue) {
|
|
2140
|
-
|
|
2141
|
-
setDisplayValue("");
|
|
2154
|
+
setInputValues("", "");
|
|
2142
2155
|
return;
|
|
2143
2156
|
}
|
|
2144
2157
|
if (!shouldUseThousandsFormatting) {
|
|
2145
|
-
|
|
2146
|
-
|
|
2158
|
+
setInputValues(stringValue, stringValue);
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
if (isFocused && hasEquivalentNumericValue(internalValueRef.current, stringValue)) {
|
|
2147
2162
|
return;
|
|
2148
2163
|
}
|
|
2149
|
-
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2150
2164
|
if (formatOnBlur && isFocused) {
|
|
2151
|
-
|
|
2152
|
-
setDisplayValue(stringValue);
|
|
2165
|
+
setInputValues(stringValue, stringValue);
|
|
2153
2166
|
return;
|
|
2154
2167
|
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2168
|
+
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2169
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2157
2170
|
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2158
2171
|
const getInputProps = () => {
|
|
2159
2172
|
var _a2;
|
|
@@ -2175,6 +2188,7 @@ var Input = (_a) => {
|
|
|
2175
2188
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2176
2189
|
align: "right",
|
|
2177
2190
|
type: "text",
|
|
2191
|
+
inputMode: "decimal",
|
|
2178
2192
|
value: displayValue
|
|
2179
2193
|
});
|
|
2180
2194
|
case "percentage":
|
|
@@ -2182,6 +2196,7 @@ var Input = (_a) => {
|
|
|
2182
2196
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2183
2197
|
type: currencyFormat ? "text" : "number",
|
|
2184
2198
|
align: "right",
|
|
2199
|
+
inputMode: currencyFormat ? "decimal" : void 0,
|
|
2185
2200
|
value: currencyFormat ? displayValue : propValue
|
|
2186
2201
|
});
|
|
2187
2202
|
default:
|
|
@@ -2228,8 +2243,7 @@ var Input = (_a) => {
|
|
|
2228
2243
|
}
|
|
2229
2244
|
};
|
|
2230
2245
|
const handleSearchReset = () => {
|
|
2231
|
-
|
|
2232
|
-
setDisplayValue("");
|
|
2246
|
+
setInputValues("", "");
|
|
2233
2247
|
if (onChange) {
|
|
2234
2248
|
const syntheticEvent = {
|
|
2235
2249
|
target: { value: "" }
|
|
@@ -2246,8 +2260,7 @@ var Input = (_a) => {
|
|
|
2246
2260
|
if (variant === "currency") {
|
|
2247
2261
|
const raw = rawValue.replace(/,/g, "");
|
|
2248
2262
|
if (raw === "") {
|
|
2249
|
-
|
|
2250
|
-
setDisplayValue("");
|
|
2263
|
+
setInputValues("", "");
|
|
2251
2264
|
if (onChange) {
|
|
2252
2265
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2253
2266
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2268,8 +2281,8 @@ var Input = (_a) => {
|
|
|
2268
2281
|
clamped.toString(),
|
|
2269
2282
|
currentDecimals
|
|
2270
2283
|
);
|
|
2271
|
-
|
|
2272
|
-
|
|
2284
|
+
setInputValues(
|
|
2285
|
+
formattedClamped,
|
|
2273
2286
|
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2274
2287
|
);
|
|
2275
2288
|
if (onChange) {
|
|
@@ -2280,8 +2293,7 @@ var Input = (_a) => {
|
|
|
2280
2293
|
}
|
|
2281
2294
|
return;
|
|
2282
2295
|
}
|
|
2283
|
-
|
|
2284
|
-
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2296
|
+
setInputValues(raw, formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2285
2297
|
if (!isNaN(asNumber) && onChange) {
|
|
2286
2298
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2287
2299
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2293,8 +2305,7 @@ var Input = (_a) => {
|
|
|
2293
2305
|
if (variant === "uom" && currencyFormat) {
|
|
2294
2306
|
const raw = rawValue.replace(/,/g, "");
|
|
2295
2307
|
if (raw === "") {
|
|
2296
|
-
|
|
2297
|
-
setDisplayValue("");
|
|
2308
|
+
setInputValues("", "");
|
|
2298
2309
|
if (onChange) {
|
|
2299
2310
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2300
2311
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2315,8 +2326,10 @@ var Input = (_a) => {
|
|
|
2315
2326
|
clamped.toString(),
|
|
2316
2327
|
currentDecimals
|
|
2317
2328
|
);
|
|
2318
|
-
|
|
2319
|
-
|
|
2329
|
+
setInputValues(
|
|
2330
|
+
formattedClamped,
|
|
2331
|
+
formatCurrencyDisplay(formattedClamped)
|
|
2332
|
+
);
|
|
2320
2333
|
if (onChange) {
|
|
2321
2334
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2322
2335
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2325,8 +2338,7 @@ var Input = (_a) => {
|
|
|
2325
2338
|
}
|
|
2326
2339
|
return;
|
|
2327
2340
|
}
|
|
2328
|
-
|
|
2329
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2341
|
+
setInputValues(raw, formatCurrencyDisplay(raw));
|
|
2330
2342
|
if (!isNaN(asNumber) && onChange) {
|
|
2331
2343
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2332
2344
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2343,8 +2355,7 @@ var Input = (_a) => {
|
|
|
2343
2355
|
clamped.toString(),
|
|
2344
2356
|
decimals != null ? decimals : 0
|
|
2345
2357
|
);
|
|
2346
|
-
|
|
2347
|
-
setDisplayValue(formattedClamped);
|
|
2358
|
+
setInputValues(formattedClamped, formattedClamped);
|
|
2348
2359
|
if (typeof onChange === "function") {
|
|
2349
2360
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2350
2361
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2353,15 +2364,13 @@ var Input = (_a) => {
|
|
|
2353
2364
|
}
|
|
2354
2365
|
return;
|
|
2355
2366
|
}
|
|
2356
|
-
|
|
2357
|
-
setDisplayValue(rawValue);
|
|
2367
|
+
setInputValues(rawValue, rawValue);
|
|
2358
2368
|
if (typeof onChange === "function") {
|
|
2359
2369
|
onChange(e);
|
|
2360
2370
|
}
|
|
2361
2371
|
return;
|
|
2362
2372
|
}
|
|
2363
|
-
|
|
2364
|
-
setDisplayValue(rawValue);
|
|
2373
|
+
setInputValues(rawValue, rawValue);
|
|
2365
2374
|
if (typeof onChange === "function") {
|
|
2366
2375
|
onChange(e);
|
|
2367
2376
|
}
|
|
@@ -2374,8 +2383,7 @@ var Input = (_a) => {
|
|
|
2374
2383
|
}
|
|
2375
2384
|
if (variant === "currency") {
|
|
2376
2385
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2377
|
-
|
|
2378
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2386
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2379
2387
|
const asNumber = Number(formatted);
|
|
2380
2388
|
if (!isNaN(asNumber) && onChange) {
|
|
2381
2389
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
@@ -2386,8 +2394,7 @@ var Input = (_a) => {
|
|
|
2386
2394
|
} else if (variant === "uom") {
|
|
2387
2395
|
if (currencyFormat) {
|
|
2388
2396
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2389
|
-
|
|
2390
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2397
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2391
2398
|
const asNumber = Number(formatted);
|
|
2392
2399
|
if (!isNaN(asNumber) && onChange) {
|
|
2393
2400
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LoadingCell
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-WSZ3ET5G.js";
|
|
4
4
|
import "../../../chunk-3UPUZBP5.js";
|
|
5
5
|
import "../../../chunk-7ZJIGTFN.js";
|
|
6
6
|
import "../../../chunk-E3FOCECQ.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-4FUZDLWX.js";
|
|
25
25
|
import "../../../chunk-CIYLALYO.js";
|
|
26
26
|
import "../../../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../../../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../../../chunk-UARCWLMD.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-QW4AJ5FK.js";
|
|
42
42
|
import "../../../chunk-3JUIYULW.js";
|
|
43
43
|
import "../../../chunk-OM7QLLI2.js";
|
|
44
44
|
import "../../../chunk-PE3EZP56.js";
|
|
45
|
-
import "../../../chunk-
|
|
46
|
-
import "../../../chunk-
|
|
45
|
+
import "../../../chunk-3DJWSTPS.js";
|
|
46
|
+
import "../../../chunk-H5SHC4XZ.js";
|
|
47
47
|
import "../../../chunk-4UGMSWWA.js";
|
|
48
48
|
import "../../../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../../../chunk-I3W5K76C.js";
|
|
@@ -1913,6 +1913,14 @@ var import_react11 = require("react");
|
|
|
1913
1913
|
var import_react10 = require("react");
|
|
1914
1914
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
1915
1915
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1916
|
+
function hasEquivalentNumericValue(currentValue, nextValue) {
|
|
1917
|
+
if (!currentValue || !nextValue) {
|
|
1918
|
+
return false;
|
|
1919
|
+
}
|
|
1920
|
+
const currentNumericValue = Number(currentValue.replace(/,/g, ""));
|
|
1921
|
+
const nextNumericValue = Number(nextValue.replace(/,/g, ""));
|
|
1922
|
+
return !Number.isNaN(currentNumericValue) && !Number.isNaN(nextNumericValue) && currentNumericValue === nextNumericValue;
|
|
1923
|
+
}
|
|
1916
1924
|
var InputBase = (_a) => {
|
|
1917
1925
|
var _b = _a, {
|
|
1918
1926
|
id,
|
|
@@ -2135,28 +2143,33 @@ var Input = (_a) => {
|
|
|
2135
2143
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2136
2144
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2137
2145
|
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2146
|
+
const internalValueRef = (0, import_react10.useRef)("");
|
|
2147
|
+
const setInputValues = (nextInternalValue, nextDisplayValue) => {
|
|
2148
|
+
internalValueRef.current = nextInternalValue;
|
|
2149
|
+
setInternalValue(nextInternalValue);
|
|
2150
|
+
setDisplayValue(nextDisplayValue);
|
|
2151
|
+
};
|
|
2138
2152
|
(0, import_react10.useEffect)(() => {
|
|
2139
2153
|
var _a2;
|
|
2140
2154
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2141
2155
|
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2142
2156
|
if (!stringValue) {
|
|
2143
|
-
|
|
2144
|
-
setDisplayValue("");
|
|
2157
|
+
setInputValues("", "");
|
|
2145
2158
|
return;
|
|
2146
2159
|
}
|
|
2147
2160
|
if (!shouldUseThousandsFormatting) {
|
|
2148
|
-
|
|
2149
|
-
|
|
2161
|
+
setInputValues(stringValue, stringValue);
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
if (isFocused && hasEquivalentNumericValue(internalValueRef.current, stringValue)) {
|
|
2150
2165
|
return;
|
|
2151
2166
|
}
|
|
2152
|
-
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2153
2167
|
if (formatOnBlur && isFocused) {
|
|
2154
|
-
|
|
2155
|
-
setDisplayValue(stringValue);
|
|
2168
|
+
setInputValues(stringValue, stringValue);
|
|
2156
2169
|
return;
|
|
2157
2170
|
}
|
|
2158
|
-
|
|
2159
|
-
|
|
2171
|
+
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2172
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2160
2173
|
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2161
2174
|
const getInputProps = () => {
|
|
2162
2175
|
var _a2;
|
|
@@ -2178,6 +2191,7 @@ var Input = (_a) => {
|
|
|
2178
2191
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2179
2192
|
align: "right",
|
|
2180
2193
|
type: "text",
|
|
2194
|
+
inputMode: "decimal",
|
|
2181
2195
|
value: displayValue
|
|
2182
2196
|
});
|
|
2183
2197
|
case "percentage":
|
|
@@ -2185,6 +2199,7 @@ var Input = (_a) => {
|
|
|
2185
2199
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2186
2200
|
type: currencyFormat ? "text" : "number",
|
|
2187
2201
|
align: "right",
|
|
2202
|
+
inputMode: currencyFormat ? "decimal" : void 0,
|
|
2188
2203
|
value: currencyFormat ? displayValue : propValue
|
|
2189
2204
|
});
|
|
2190
2205
|
default:
|
|
@@ -2231,8 +2246,7 @@ var Input = (_a) => {
|
|
|
2231
2246
|
}
|
|
2232
2247
|
};
|
|
2233
2248
|
const handleSearchReset = () => {
|
|
2234
|
-
|
|
2235
|
-
setDisplayValue("");
|
|
2249
|
+
setInputValues("", "");
|
|
2236
2250
|
if (onChange) {
|
|
2237
2251
|
const syntheticEvent = {
|
|
2238
2252
|
target: { value: "" }
|
|
@@ -2249,8 +2263,7 @@ var Input = (_a) => {
|
|
|
2249
2263
|
if (variant === "currency") {
|
|
2250
2264
|
const raw = rawValue.replace(/,/g, "");
|
|
2251
2265
|
if (raw === "") {
|
|
2252
|
-
|
|
2253
|
-
setDisplayValue("");
|
|
2266
|
+
setInputValues("", "");
|
|
2254
2267
|
if (onChange) {
|
|
2255
2268
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2256
2269
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2271,8 +2284,8 @@ var Input = (_a) => {
|
|
|
2271
2284
|
clamped.toString(),
|
|
2272
2285
|
currentDecimals
|
|
2273
2286
|
);
|
|
2274
|
-
|
|
2275
|
-
|
|
2287
|
+
setInputValues(
|
|
2288
|
+
formattedClamped,
|
|
2276
2289
|
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2277
2290
|
);
|
|
2278
2291
|
if (onChange) {
|
|
@@ -2283,8 +2296,7 @@ var Input = (_a) => {
|
|
|
2283
2296
|
}
|
|
2284
2297
|
return;
|
|
2285
2298
|
}
|
|
2286
|
-
|
|
2287
|
-
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2299
|
+
setInputValues(raw, formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2288
2300
|
if (!isNaN(asNumber) && onChange) {
|
|
2289
2301
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2290
2302
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2296,8 +2308,7 @@ var Input = (_a) => {
|
|
|
2296
2308
|
if (variant === "uom" && currencyFormat) {
|
|
2297
2309
|
const raw = rawValue.replace(/,/g, "");
|
|
2298
2310
|
if (raw === "") {
|
|
2299
|
-
|
|
2300
|
-
setDisplayValue("");
|
|
2311
|
+
setInputValues("", "");
|
|
2301
2312
|
if (onChange) {
|
|
2302
2313
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2303
2314
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2318,8 +2329,10 @@ var Input = (_a) => {
|
|
|
2318
2329
|
clamped.toString(),
|
|
2319
2330
|
currentDecimals
|
|
2320
2331
|
);
|
|
2321
|
-
|
|
2322
|
-
|
|
2332
|
+
setInputValues(
|
|
2333
|
+
formattedClamped,
|
|
2334
|
+
formatCurrencyDisplay(formattedClamped)
|
|
2335
|
+
);
|
|
2323
2336
|
if (onChange) {
|
|
2324
2337
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2325
2338
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2328,8 +2341,7 @@ var Input = (_a) => {
|
|
|
2328
2341
|
}
|
|
2329
2342
|
return;
|
|
2330
2343
|
}
|
|
2331
|
-
|
|
2332
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2344
|
+
setInputValues(raw, formatCurrencyDisplay(raw));
|
|
2333
2345
|
if (!isNaN(asNumber) && onChange) {
|
|
2334
2346
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2335
2347
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2346,8 +2358,7 @@ var Input = (_a) => {
|
|
|
2346
2358
|
clamped.toString(),
|
|
2347
2359
|
decimals != null ? decimals : 0
|
|
2348
2360
|
);
|
|
2349
|
-
|
|
2350
|
-
setDisplayValue(formattedClamped);
|
|
2361
|
+
setInputValues(formattedClamped, formattedClamped);
|
|
2351
2362
|
if (typeof onChange === "function") {
|
|
2352
2363
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2353
2364
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2356,15 +2367,13 @@ var Input = (_a) => {
|
|
|
2356
2367
|
}
|
|
2357
2368
|
return;
|
|
2358
2369
|
}
|
|
2359
|
-
|
|
2360
|
-
setDisplayValue(rawValue);
|
|
2370
|
+
setInputValues(rawValue, rawValue);
|
|
2361
2371
|
if (typeof onChange === "function") {
|
|
2362
2372
|
onChange(e);
|
|
2363
2373
|
}
|
|
2364
2374
|
return;
|
|
2365
2375
|
}
|
|
2366
|
-
|
|
2367
|
-
setDisplayValue(rawValue);
|
|
2376
|
+
setInputValues(rawValue, rawValue);
|
|
2368
2377
|
if (typeof onChange === "function") {
|
|
2369
2378
|
onChange(e);
|
|
2370
2379
|
}
|
|
@@ -2377,8 +2386,7 @@ var Input = (_a) => {
|
|
|
2377
2386
|
}
|
|
2378
2387
|
if (variant === "currency") {
|
|
2379
2388
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2380
|
-
|
|
2381
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2389
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2382
2390
|
const asNumber = Number(formatted);
|
|
2383
2391
|
if (!isNaN(asNumber) && onChange) {
|
|
2384
2392
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
@@ -2389,8 +2397,7 @@ var Input = (_a) => {
|
|
|
2389
2397
|
} else if (variant === "uom") {
|
|
2390
2398
|
if (currencyFormat) {
|
|
2391
2399
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2392
|
-
|
|
2393
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2400
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2394
2401
|
const asNumber = Number(formatted);
|
|
2395
2402
|
if (!isNaN(asNumber) && onChange) {
|
|
2396
2403
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TableBodyRow
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-WSZ3ET5G.js";
|
|
4
4
|
import "../../../chunk-3UPUZBP5.js";
|
|
5
5
|
import "../../../chunk-7ZJIGTFN.js";
|
|
6
6
|
import "../../../chunk-E3FOCECQ.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-4FUZDLWX.js";
|
|
25
25
|
import "../../../chunk-CIYLALYO.js";
|
|
26
26
|
import "../../../chunk-KBIEWFQS.js";
|
|
27
27
|
import "../../../chunk-NSZTJ5R4.js";
|
|
@@ -38,12 +38,12 @@ import "../../../chunk-UARCWLMD.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-QW4AJ5FK.js";
|
|
42
42
|
import "../../../chunk-3JUIYULW.js";
|
|
43
43
|
import "../../../chunk-OM7QLLI2.js";
|
|
44
44
|
import "../../../chunk-PE3EZP56.js";
|
|
45
|
-
import "../../../chunk-
|
|
46
|
-
import "../../../chunk-
|
|
45
|
+
import "../../../chunk-3DJWSTPS.js";
|
|
46
|
+
import "../../../chunk-H5SHC4XZ.js";
|
|
47
47
|
import "../../../chunk-4UGMSWWA.js";
|
|
48
48
|
import "../../../chunk-WVUIIBRR.js";
|
|
49
49
|
import "../../../chunk-I3W5K76C.js";
|
|
@@ -1911,6 +1911,14 @@ var import_react11 = require("react");
|
|
|
1911
1911
|
var import_react10 = require("react");
|
|
1912
1912
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
1913
1913
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1914
|
+
function hasEquivalentNumericValue(currentValue, nextValue) {
|
|
1915
|
+
if (!currentValue || !nextValue) {
|
|
1916
|
+
return false;
|
|
1917
|
+
}
|
|
1918
|
+
const currentNumericValue = Number(currentValue.replace(/,/g, ""));
|
|
1919
|
+
const nextNumericValue = Number(nextValue.replace(/,/g, ""));
|
|
1920
|
+
return !Number.isNaN(currentNumericValue) && !Number.isNaN(nextNumericValue) && currentNumericValue === nextNumericValue;
|
|
1921
|
+
}
|
|
1914
1922
|
var InputBase = (_a) => {
|
|
1915
1923
|
var _b = _a, {
|
|
1916
1924
|
id,
|
|
@@ -2133,28 +2141,33 @@ var Input = (_a) => {
|
|
|
2133
2141
|
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
2134
2142
|
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
2135
2143
|
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
2144
|
+
const internalValueRef = (0, import_react10.useRef)("");
|
|
2145
|
+
const setInputValues = (nextInternalValue, nextDisplayValue) => {
|
|
2146
|
+
internalValueRef.current = nextInternalValue;
|
|
2147
|
+
setInternalValue(nextInternalValue);
|
|
2148
|
+
setDisplayValue(nextDisplayValue);
|
|
2149
|
+
};
|
|
2136
2150
|
(0, import_react10.useEffect)(() => {
|
|
2137
2151
|
var _a2;
|
|
2138
2152
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
2139
2153
|
const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
|
|
2140
2154
|
if (!stringValue) {
|
|
2141
|
-
|
|
2142
|
-
setDisplayValue("");
|
|
2155
|
+
setInputValues("", "");
|
|
2143
2156
|
return;
|
|
2144
2157
|
}
|
|
2145
2158
|
if (!shouldUseThousandsFormatting) {
|
|
2146
|
-
|
|
2147
|
-
|
|
2159
|
+
setInputValues(stringValue, stringValue);
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
if (isFocused && hasEquivalentNumericValue(internalValueRef.current, stringValue)) {
|
|
2148
2163
|
return;
|
|
2149
2164
|
}
|
|
2150
|
-
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2151
2165
|
if (formatOnBlur && isFocused) {
|
|
2152
|
-
|
|
2153
|
-
setDisplayValue(stringValue);
|
|
2166
|
+
setInputValues(stringValue, stringValue);
|
|
2154
2167
|
return;
|
|
2155
2168
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2169
|
+
const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
|
|
2170
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2158
2171
|
}, [propValue, variant, currencyFormat, decimals, formatOnBlur, isFocused]);
|
|
2159
2172
|
const getInputProps = () => {
|
|
2160
2173
|
var _a2;
|
|
@@ -2176,6 +2189,7 @@ var Input = (_a) => {
|
|
|
2176
2189
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2177
2190
|
align: "right",
|
|
2178
2191
|
type: "text",
|
|
2192
|
+
inputMode: "decimal",
|
|
2179
2193
|
value: displayValue
|
|
2180
2194
|
});
|
|
2181
2195
|
case "percentage":
|
|
@@ -2183,6 +2197,7 @@ var Input = (_a) => {
|
|
|
2183
2197
|
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2184
2198
|
type: currencyFormat ? "text" : "number",
|
|
2185
2199
|
align: "right",
|
|
2200
|
+
inputMode: currencyFormat ? "decimal" : void 0,
|
|
2186
2201
|
value: currencyFormat ? displayValue : propValue
|
|
2187
2202
|
});
|
|
2188
2203
|
default:
|
|
@@ -2229,8 +2244,7 @@ var Input = (_a) => {
|
|
|
2229
2244
|
}
|
|
2230
2245
|
};
|
|
2231
2246
|
const handleSearchReset = () => {
|
|
2232
|
-
|
|
2233
|
-
setDisplayValue("");
|
|
2247
|
+
setInputValues("", "");
|
|
2234
2248
|
if (onChange) {
|
|
2235
2249
|
const syntheticEvent = {
|
|
2236
2250
|
target: { value: "" }
|
|
@@ -2247,8 +2261,7 @@ var Input = (_a) => {
|
|
|
2247
2261
|
if (variant === "currency") {
|
|
2248
2262
|
const raw = rawValue.replace(/,/g, "");
|
|
2249
2263
|
if (raw === "") {
|
|
2250
|
-
|
|
2251
|
-
setDisplayValue("");
|
|
2264
|
+
setInputValues("", "");
|
|
2252
2265
|
if (onChange) {
|
|
2253
2266
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2254
2267
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2269,8 +2282,8 @@ var Input = (_a) => {
|
|
|
2269
2282
|
clamped.toString(),
|
|
2270
2283
|
currentDecimals
|
|
2271
2284
|
);
|
|
2272
|
-
|
|
2273
|
-
|
|
2285
|
+
setInputValues(
|
|
2286
|
+
formattedClamped,
|
|
2274
2287
|
formatOnBlur ? formattedClamped : formatCurrencyDisplay(formattedClamped)
|
|
2275
2288
|
);
|
|
2276
2289
|
if (onChange) {
|
|
@@ -2281,8 +2294,7 @@ var Input = (_a) => {
|
|
|
2281
2294
|
}
|
|
2282
2295
|
return;
|
|
2283
2296
|
}
|
|
2284
|
-
|
|
2285
|
-
setDisplayValue(formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2297
|
+
setInputValues(raw, formatOnBlur ? raw : formatCurrencyDisplay(raw));
|
|
2286
2298
|
if (!isNaN(asNumber) && onChange) {
|
|
2287
2299
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2288
2300
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2294,8 +2306,7 @@ var Input = (_a) => {
|
|
|
2294
2306
|
if (variant === "uom" && currencyFormat) {
|
|
2295
2307
|
const raw = rawValue.replace(/,/g, "");
|
|
2296
2308
|
if (raw === "") {
|
|
2297
|
-
|
|
2298
|
-
setDisplayValue("");
|
|
2309
|
+
setInputValues("", "");
|
|
2299
2310
|
if (onChange) {
|
|
2300
2311
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2301
2312
|
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
@@ -2316,8 +2327,10 @@ var Input = (_a) => {
|
|
|
2316
2327
|
clamped.toString(),
|
|
2317
2328
|
currentDecimals
|
|
2318
2329
|
);
|
|
2319
|
-
|
|
2320
|
-
|
|
2330
|
+
setInputValues(
|
|
2331
|
+
formattedClamped,
|
|
2332
|
+
formatCurrencyDisplay(formattedClamped)
|
|
2333
|
+
);
|
|
2321
2334
|
if (onChange) {
|
|
2322
2335
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2323
2336
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2326,8 +2339,7 @@ var Input = (_a) => {
|
|
|
2326
2339
|
}
|
|
2327
2340
|
return;
|
|
2328
2341
|
}
|
|
2329
|
-
|
|
2330
|
-
setDisplayValue(formatCurrencyDisplay(raw));
|
|
2342
|
+
setInputValues(raw, formatCurrencyDisplay(raw));
|
|
2331
2343
|
if (!isNaN(asNumber) && onChange) {
|
|
2332
2344
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2333
2345
|
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
@@ -2344,8 +2356,7 @@ var Input = (_a) => {
|
|
|
2344
2356
|
clamped.toString(),
|
|
2345
2357
|
decimals != null ? decimals : 0
|
|
2346
2358
|
);
|
|
2347
|
-
|
|
2348
|
-
setDisplayValue(formattedClamped);
|
|
2359
|
+
setInputValues(formattedClamped, formattedClamped);
|
|
2349
2360
|
if (typeof onChange === "function") {
|
|
2350
2361
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
2351
2362
|
target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
|
|
@@ -2354,15 +2365,13 @@ var Input = (_a) => {
|
|
|
2354
2365
|
}
|
|
2355
2366
|
return;
|
|
2356
2367
|
}
|
|
2357
|
-
|
|
2358
|
-
setDisplayValue(rawValue);
|
|
2368
|
+
setInputValues(rawValue, rawValue);
|
|
2359
2369
|
if (typeof onChange === "function") {
|
|
2360
2370
|
onChange(e);
|
|
2361
2371
|
}
|
|
2362
2372
|
return;
|
|
2363
2373
|
}
|
|
2364
|
-
|
|
2365
|
-
setDisplayValue(rawValue);
|
|
2374
|
+
setInputValues(rawValue, rawValue);
|
|
2366
2375
|
if (typeof onChange === "function") {
|
|
2367
2376
|
onChange(e);
|
|
2368
2377
|
}
|
|
@@ -2375,8 +2384,7 @@ var Input = (_a) => {
|
|
|
2375
2384
|
}
|
|
2376
2385
|
if (variant === "currency") {
|
|
2377
2386
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2378
|
-
|
|
2379
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2387
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2380
2388
|
const asNumber = Number(formatted);
|
|
2381
2389
|
if (!isNaN(asNumber) && onChange) {
|
|
2382
2390
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
@@ -2387,8 +2395,7 @@ var Input = (_a) => {
|
|
|
2387
2395
|
} else if (variant === "uom") {
|
|
2388
2396
|
if (currencyFormat) {
|
|
2389
2397
|
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
2390
|
-
|
|
2391
|
-
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
2398
|
+
setInputValues(formatted, formatCurrencyDisplay(formatted));
|
|
2392
2399
|
const asNumber = Number(formatted);
|
|
2393
2400
|
if (!isNaN(asNumber) && onChange) {
|
|
2394
2401
|
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|