triafly-ui-kit 1.0.64 → 1.0.66
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,28 +1,31 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useState as
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as c, useState as m, useEffect as f } from "react";
|
3
3
|
import '../../../assets/src/components/Ui/ButtonsArray/ButtonsArray.css';/* empty css */
|
4
|
-
const p = (
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
};
|
4
|
+
const p = c(
|
5
|
+
({ tabs: t, label: n, onChange: o, activeKey: e }, i) => {
|
6
|
+
const [a, l] = m(e ?? t[0].key);
|
7
|
+
f(() => {
|
8
|
+
e != null ? l(e) : l(t[0].key);
|
9
|
+
}, [e]);
|
10
|
+
const u = (s) => {
|
11
|
+
l(s), o && o(s);
|
12
|
+
};
|
13
|
+
return t.length === 0 ? null : /* @__PURE__ */ d("div", { className: "buttons", ref: i, children: [
|
14
|
+
n && /* @__PURE__ */ r("span", { className: "buttons-label", children: n }),
|
15
|
+
/* @__PURE__ */ r("div", { className: "buttons-bar", children: t.map((s) => /* @__PURE__ */ r(
|
16
|
+
"button",
|
17
|
+
{
|
18
|
+
disabled: s.disabled,
|
19
|
+
onClick: () => u(s.key),
|
20
|
+
className: `button ${s.key === a ? "active" : ""} status-${s.status}`,
|
21
|
+
children: s.label
|
22
|
+
},
|
23
|
+
s.key
|
24
|
+
)) })
|
25
|
+
] });
|
26
|
+
}
|
27
|
+
);
|
28
|
+
p.displayName = "ButtonsArray";
|
26
29
|
export {
|
27
30
|
p as ButtonsArray
|
28
31
|
};
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { forwardRef as
|
3
|
-
import "
|
4
|
-
|
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
|
-
],
|
22
|
-
({ allowNegative:
|
23
|
-
|
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
|
-
|
46
|
+
s.displayName = "NumberInput";
|
27
47
|
export {
|
28
|
-
|
48
|
+
s as NumberInput
|
29
49
|
};
|
package/dist/main.d.ts
CHANGED
@@ -74,7 +74,7 @@ declare type ButtonProps = {
|
|
74
74
|
iconTail?: ReactElement;
|
75
75
|
};
|
76
76
|
|
77
|
-
export declare const ButtonsArray:
|
77
|
+
export declare const ButtonsArray: ForwardRefExoticComponent<ButtonsArrayProps & RefAttributes<HTMLDivElement>>;
|
78
78
|
|
79
79
|
export declare interface ButtonsArrayProps {
|
80
80
|
tabs: ButtonTab[];
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
|