triafly-ui-kit 1.0.63 → 1.0.65
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.
@@ -1,10 +1,49 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import "
|
3
|
-
import { TextInput as
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as o } from "react";
|
3
|
+
import { TextInput as h } from "../TextInput/TextInput.js";
|
4
|
+
const l = [
|
5
|
+
"0",
|
6
|
+
"1",
|
7
|
+
"2",
|
8
|
+
"3",
|
9
|
+
"4",
|
10
|
+
"5",
|
11
|
+
"6",
|
12
|
+
"7",
|
13
|
+
"8",
|
14
|
+
"9",
|
15
|
+
"Backspace",
|
16
|
+
"Delete",
|
17
|
+
"Tab",
|
18
|
+
"ArrowLeft",
|
19
|
+
"ArrowRight"
|
20
|
+
], s = o(
|
21
|
+
({ allowNegative: r = !1, allowDecimal: c = !1, ...n }, f) => /* @__PURE__ */ g(
|
22
|
+
h,
|
23
|
+
{
|
24
|
+
...n,
|
25
|
+
ref: f,
|
26
|
+
type: "text",
|
27
|
+
onKeyDown: (t) => {
|
28
|
+
var a;
|
29
|
+
c && t.key === "." && !t.currentTarget.value.includes(".") && l.push("."), r && t.key === "-" && (t.currentTarget.selectionStart === 0 || t.currentTarget.value === "") && l.push("-"), !l.includes(t.key) && !(t.ctrlKey && ["a", "c", "v", "x"].includes(t.key.toLowerCase())) && t.preventDefault(), (a = n.onKeyDown) == null || a.call(n, t);
|
30
|
+
},
|
31
|
+
onChange: (t) => {
|
32
|
+
var u;
|
33
|
+
const a = t.target.value;
|
34
|
+
let e = a.replace(/[^-0-9.]/g, "");
|
35
|
+
if (r ? (e.match(/-/g) || []).length > 1 && (e = e.replace(/-/g, ""), e.length > 0 && (e = "-" + e)) : e = e.replace(/-/g, ""), !c)
|
36
|
+
e = e.replace(/\./g, "");
|
37
|
+
else if ((e.match(/\./g) || []).length > 1) {
|
38
|
+
const i = e.split(".");
|
39
|
+
e = i[0] + "." + i.slice(1).join("");
|
40
|
+
}
|
41
|
+
a !== e && (t.target.value = e), (u = n.onChange) == null || u.call(n, t);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
)
|
45
|
+
);
|
46
|
+
s.displayName = "NumberInput";
|
8
47
|
export {
|
9
|
-
|
48
|
+
s as NumberInput
|
10
49
|
};
|
package/dist/main.d.ts
CHANGED
@@ -1062,7 +1062,12 @@ declare type ModalWindowProps = {
|
|
1062
1062
|
foolHeight?: boolean;
|
1063
1063
|
};
|
1064
1064
|
|
1065
|
-
export declare const NumberInput: default_2.
|
1065
|
+
export declare const NumberInput: default_2.ForwardRefExoticComponent<NumberInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
1066
|
+
|
1067
|
+
declare interface NumberInputProps extends TextInputProps {
|
1068
|
+
allowNegative?: boolean;
|
1069
|
+
allowDecimal?: boolean;
|
1070
|
+
}
|
1066
1071
|
|
1067
1072
|
declare type Option_2 = {
|
1068
1073
|
value: string;
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
|