@dmsi/wedgekit-react 0.0.1033 → 0.0.1035
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/components/Stepper.cjs +24 -19
- package/dist/components/Stepper.js +24 -19
- package/package.json +1 -1
|
@@ -1287,6 +1287,7 @@ var Stepper = (_a) => {
|
|
|
1287
1287
|
]);
|
|
1288
1288
|
const userInputRef = (0, import_react8.useRef)(false);
|
|
1289
1289
|
const [displayValue, setDisplayValue] = (0, import_react8.useState)(String(value));
|
|
1290
|
+
const buttonMin = Math.max(step, min != null ? min : step);
|
|
1290
1291
|
(0, import_react8.useEffect)(() => {
|
|
1291
1292
|
if (userInputRef.current) {
|
|
1292
1293
|
userInputRef.current = false;
|
|
@@ -1298,29 +1299,33 @@ var Stepper = (_a) => {
|
|
|
1298
1299
|
if (max != null && value >= max) {
|
|
1299
1300
|
return;
|
|
1300
1301
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1302
|
+
setValue(() => {
|
|
1303
|
+
const prec = String(step).includes(".") ? String(step).split(".")[1].length : 0;
|
|
1304
|
+
const next = Number(
|
|
1305
|
+
Math.min(
|
|
1306
|
+
Number((value + step).toFixed(prec + 6)),
|
|
1307
|
+
max != null ? max : Infinity
|
|
1308
|
+
).toFixed(prec)
|
|
1309
|
+
);
|
|
1310
|
+
onIncrease == null ? void 0 : onIncrease(next);
|
|
1311
|
+
return next;
|
|
1312
|
+
});
|
|
1310
1313
|
}
|
|
1311
1314
|
function handleDecrease() {
|
|
1312
1315
|
if (min != null && value <= min) {
|
|
1313
1316
|
return;
|
|
1314
1317
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1318
|
+
setValue(() => {
|
|
1319
|
+
const prec = String(step).includes(".") ? String(step).split(".")[1].length : 0;
|
|
1320
|
+
const next = Number(
|
|
1321
|
+
Math.max(
|
|
1322
|
+
Number((value - step).toFixed(prec + 6)),
|
|
1323
|
+
min != null ? min : -Infinity
|
|
1324
|
+
).toFixed(prec)
|
|
1325
|
+
);
|
|
1326
|
+
onDecrease == null ? void 0 : onDecrease(next);
|
|
1327
|
+
return next;
|
|
1328
|
+
});
|
|
1324
1329
|
}
|
|
1325
1330
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1326
1331
|
"div",
|
|
@@ -1353,7 +1358,7 @@ var Stepper = (_a) => {
|
|
|
1353
1358
|
}
|
|
1354
1359
|
),
|
|
1355
1360
|
onClick: handleDecrease,
|
|
1356
|
-
disabled: disabled || value <=
|
|
1361
|
+
disabled: disabled || value <= buttonMin
|
|
1357
1362
|
}
|
|
1358
1363
|
)
|
|
1359
1364
|
}
|
|
@@ -66,6 +66,7 @@ var Stepper = (_a) => {
|
|
|
66
66
|
]);
|
|
67
67
|
const userInputRef = useRef(false);
|
|
68
68
|
const [displayValue, setDisplayValue] = useState(String(value));
|
|
69
|
+
const buttonMin = Math.max(step, min != null ? min : step);
|
|
69
70
|
useEffect(() => {
|
|
70
71
|
if (userInputRef.current) {
|
|
71
72
|
userInputRef.current = false;
|
|
@@ -77,29 +78,33 @@ var Stepper = (_a) => {
|
|
|
77
78
|
if (max != null && value >= max) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
setValue(() => {
|
|
82
|
+
const prec = String(step).includes(".") ? String(step).split(".")[1].length : 0;
|
|
83
|
+
const next = Number(
|
|
84
|
+
Math.min(
|
|
85
|
+
Number((value + step).toFixed(prec + 6)),
|
|
86
|
+
max != null ? max : Infinity
|
|
87
|
+
).toFixed(prec)
|
|
88
|
+
);
|
|
89
|
+
onIncrease == null ? void 0 : onIncrease(next);
|
|
90
|
+
return next;
|
|
91
|
+
});
|
|
89
92
|
}
|
|
90
93
|
function handleDecrease() {
|
|
91
94
|
if (min != null && value <= min) {
|
|
92
95
|
return;
|
|
93
96
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
setValue(() => {
|
|
98
|
+
const prec = String(step).includes(".") ? String(step).split(".")[1].length : 0;
|
|
99
|
+
const next = Number(
|
|
100
|
+
Math.max(
|
|
101
|
+
Number((value - step).toFixed(prec + 6)),
|
|
102
|
+
min != null ? min : -Infinity
|
|
103
|
+
).toFixed(prec)
|
|
104
|
+
);
|
|
105
|
+
onDecrease == null ? void 0 : onDecrease(next);
|
|
106
|
+
return next;
|
|
107
|
+
});
|
|
103
108
|
}
|
|
104
109
|
return /* @__PURE__ */ jsxs(
|
|
105
110
|
"div",
|
|
@@ -132,7 +137,7 @@ var Stepper = (_a) => {
|
|
|
132
137
|
}
|
|
133
138
|
),
|
|
134
139
|
onClick: handleDecrease,
|
|
135
|
-
disabled: disabled || value <=
|
|
140
|
+
disabled: disabled || value <= buttonMin
|
|
136
141
|
}
|
|
137
142
|
)
|
|
138
143
|
}
|