@obolnetwork/obol-ui 1.0.11 → 1.0.12
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/index.es.js +6 -4
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1359,7 +1359,8 @@ TextFieldWithCopy.displayName = "TextFieldWithCopy";
|
|
|
1359
1359
|
var NumberField = forwardRef(function (_a, ref) {
|
|
1360
1360
|
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ? 1 : _c, value = _a.value, onChangeValue = _a.onChangeValue;
|
|
1361
1361
|
var _d = useState(value || min), qty = _d[0], setQty = _d[1];
|
|
1362
|
-
var handleOnDec = function () {
|
|
1362
|
+
var handleOnDec = function (e) {
|
|
1363
|
+
e.preventDefault();
|
|
1363
1364
|
if (qty <= min) {
|
|
1364
1365
|
setQty(min);
|
|
1365
1366
|
}
|
|
@@ -1367,7 +1368,8 @@ var NumberField = forwardRef(function (_a, ref) {
|
|
|
1367
1368
|
setQty(qty - 1);
|
|
1368
1369
|
}
|
|
1369
1370
|
};
|
|
1370
|
-
var handleOnInc = function () {
|
|
1371
|
+
var handleOnInc = function (e) {
|
|
1372
|
+
e.preventDefault();
|
|
1371
1373
|
if (qty >= max) {
|
|
1372
1374
|
setQty(max);
|
|
1373
1375
|
}
|
|
@@ -1376,7 +1378,7 @@ var NumberField = forwardRef(function (_a, ref) {
|
|
|
1376
1378
|
}
|
|
1377
1379
|
};
|
|
1378
1380
|
var handleOnChange = function (e) {
|
|
1379
|
-
var value = e.target
|
|
1381
|
+
var value = e.target;
|
|
1380
1382
|
if (value > max) {
|
|
1381
1383
|
setQty(max);
|
|
1382
1384
|
}
|
|
@@ -1425,7 +1427,7 @@ var NumberField = forwardRef(function (_a, ref) {
|
|
|
1425
1427
|
borderRadius: 0,
|
|
1426
1428
|
width: "95px",
|
|
1427
1429
|
},
|
|
1428
|
-
} }, { children: [jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick:
|
|
1430
|
+
} }, { children: [jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick: handleOnDec }, { children: "-" })), jsx(TextField, { css: { borderRightStyle: "none", borderLeftStyle: "none" }, type: "number", ref: ref, value: qty, onChange: handleOnChange }), jsx(IconButton, __assign({ disabled: qty >= max, className: "inc-button", onClick: handleOnInc }, { children: "+" }))] })));
|
|
1429
1431
|
});
|
|
1430
1432
|
NumberField.displayName = "NumberField";
|
|
1431
1433
|
|
package/dist/index.js
CHANGED
|
@@ -1391,7 +1391,8 @@ TextFieldWithCopy.displayName = "TextFieldWithCopy";
|
|
|
1391
1391
|
var NumberField = React.forwardRef(function (_a, ref) {
|
|
1392
1392
|
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ? 1 : _c, value = _a.value, onChangeValue = _a.onChangeValue;
|
|
1393
1393
|
var _d = React.useState(value || min), qty = _d[0], setQty = _d[1];
|
|
1394
|
-
var handleOnDec = function () {
|
|
1394
|
+
var handleOnDec = function (e) {
|
|
1395
|
+
e.preventDefault();
|
|
1395
1396
|
if (qty <= min) {
|
|
1396
1397
|
setQty(min);
|
|
1397
1398
|
}
|
|
@@ -1399,7 +1400,8 @@ var NumberField = React.forwardRef(function (_a, ref) {
|
|
|
1399
1400
|
setQty(qty - 1);
|
|
1400
1401
|
}
|
|
1401
1402
|
};
|
|
1402
|
-
var handleOnInc = function () {
|
|
1403
|
+
var handleOnInc = function (e) {
|
|
1404
|
+
e.preventDefault();
|
|
1403
1405
|
if (qty >= max) {
|
|
1404
1406
|
setQty(max);
|
|
1405
1407
|
}
|
|
@@ -1408,7 +1410,7 @@ var NumberField = React.forwardRef(function (_a, ref) {
|
|
|
1408
1410
|
}
|
|
1409
1411
|
};
|
|
1410
1412
|
var handleOnChange = function (e) {
|
|
1411
|
-
var value = e.target
|
|
1413
|
+
var value = e.target;
|
|
1412
1414
|
if (value > max) {
|
|
1413
1415
|
setQty(max);
|
|
1414
1416
|
}
|
|
@@ -1457,7 +1459,7 @@ var NumberField = React.forwardRef(function (_a, ref) {
|
|
|
1457
1459
|
borderRadius: 0,
|
|
1458
1460
|
width: "95px",
|
|
1459
1461
|
},
|
|
1460
|
-
} }, { children: [jsxRuntime.jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick:
|
|
1462
|
+
} }, { children: [jsxRuntime.jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick: handleOnDec }, { children: "-" })), jsxRuntime.jsx(TextField, { css: { borderRightStyle: "none", borderLeftStyle: "none" }, type: "number", ref: ref, value: qty, onChange: handleOnChange }), jsxRuntime.jsx(IconButton, __assign({ disabled: qty >= max, className: "inc-button", onClick: handleOnInc }, { children: "+" }))] })));
|
|
1461
1463
|
});
|
|
1462
1464
|
NumberField.displayName = "NumberField";
|
|
1463
1465
|
|