triafly-ui-kit 1.0.64 → 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,8 +1,7 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import "../../../src/components/Ui/NumberInput/NumberInput.scss.js";
4
- import { TextInput as f } from "../TextInput/TextInput.js";
5
- const t = [
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 = [
6
5
  "0",
7
6
  "1",
8
7
  "2",
@@ -18,12 +17,33 @@ const t = [
18
17
  "Tab",
19
18
  "ArrowLeft",
20
19
  "ArrowRight"
21
- ], i = p(
22
- ({ allowNegative: a = !1, allowDecimal: u = !1, onKeyDown: r, ...l }, n) => /* @__PURE__ */ s(f, { ...l, name: "NumberInput", ref: n, type: "number", onKeyDown: (e) => {
23
- u && e.key === "." && (e.currentTarget.value.includes(".") ? e.preventDefault() : t.push(".")), a && e.key === "-" && (e.currentTarget.selectionStart === 0 || e.currentTarget.value === "" ? t.push("-") : e.preventDefault()), !t.includes(e.key) && !(e.ctrlKey && ["a", "c", "v", "x"].includes(e.key.toLowerCase())) && e.preventDefault(), r == null || r(e);
24
- } })
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
+ )
25
45
  );
26
- i.displayName = "NumberInput";
46
+ s.displayName = "NumberInput";
27
47
  export {
28
- i as NumberInput
48
+ s as NumberInput
29
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triafly-ui-kit",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "UI Kit from Triafly",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",