triafly-ui-kit 1.0.37 → 1.0.39
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,35 +1,28 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useState as
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
2
|
+
import { useState as d, useEffect as u } from "react";
|
3
3
|
import '../../../assets/src/components/Ui/ButtonsArray/ButtonsArray.css';/* empty css */
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
o || (s.length > 0 ? s[0].key : "")
|
12
|
-
);
|
13
|
-
a(() => {
|
14
|
-
o !== void 0 ? t(o) : s.length > 0 && !s.some((e) => e.key === n) && t(s[0].key);
|
15
|
-
}, [s, o]);
|
16
|
-
const d = (e) => {
|
17
|
-
t(e), c && c(e);
|
4
|
+
const p = ({ tabs: t, label: o, onChange: i, activeKey: e }) => {
|
5
|
+
const [r, l] = d(e ?? t[0].key);
|
6
|
+
u(() => {
|
7
|
+
e != null ? l(e) : l(t[0].key);
|
8
|
+
}, [e]);
|
9
|
+
const c = (s) => {
|
10
|
+
l(s), i && i(s);
|
18
11
|
};
|
19
|
-
return /* @__PURE__ */
|
20
|
-
|
21
|
-
/* @__PURE__ */
|
12
|
+
return /* @__PURE__ */ a("div", { className: "buttons", children: [
|
13
|
+
o && /* @__PURE__ */ n("span", { className: "buttons-label", children: o }),
|
14
|
+
/* @__PURE__ */ n("div", { className: "buttons-bar", children: t.map((s) => /* @__PURE__ */ n(
|
22
15
|
"button",
|
23
16
|
{
|
24
|
-
disabled:
|
25
|
-
onClick: () =>
|
26
|
-
className: `button ${
|
27
|
-
children:
|
17
|
+
disabled: s.disabled,
|
18
|
+
onClick: () => c(s.key),
|
19
|
+
className: `button ${s.key === r ? "active" : ""} status-${s.status}`,
|
20
|
+
children: s.label
|
28
21
|
},
|
29
|
-
|
22
|
+
s.key
|
30
23
|
)) })
|
31
24
|
] });
|
32
25
|
};
|
33
26
|
export {
|
34
|
-
|
27
|
+
p as ButtonsArray
|
35
28
|
};
|
@@ -4,7 +4,7 @@ const a = {
|
|
4
4
|
component: e,
|
5
5
|
tags: ["autodocs"],
|
6
6
|
argTypes: {
|
7
|
-
|
7
|
+
activeKey: {
|
8
8
|
control: { type: "number", min: 0 }
|
9
9
|
},
|
10
10
|
onChange: { action: "tabChanged" }
|
@@ -35,9 +35,9 @@ const a = {
|
|
35
35
|
{ label: "Second", key: "second" },
|
36
36
|
{ label: "Third", key: "third" }
|
37
37
|
],
|
38
|
-
|
38
|
+
activeKey: 1
|
39
39
|
}
|
40
|
-
},
|
40
|
+
}, r = {
|
41
41
|
args: {
|
42
42
|
label: "Account type:",
|
43
43
|
tabs: [
|
@@ -46,14 +46,14 @@ const a = {
|
|
46
46
|
{ label: "Enterprise", key: "enterprise" }
|
47
47
|
]
|
48
48
|
}
|
49
|
-
},
|
49
|
+
}, b = {
|
50
50
|
args: {
|
51
51
|
tabs: [
|
52
52
|
{ label: "Yes", key: "yes" },
|
53
53
|
{ label: "No", key: "no" }
|
54
54
|
]
|
55
55
|
}
|
56
|
-
},
|
56
|
+
}, n = {
|
57
57
|
args: {
|
58
58
|
label: "Categories:",
|
59
59
|
tabs: [
|
@@ -69,9 +69,9 @@ const a = {
|
|
69
69
|
};
|
70
70
|
export {
|
71
71
|
l as Default,
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
r as DisabledTabs,
|
73
|
+
n as ManyTabs,
|
74
|
+
b as SmallSelection,
|
75
75
|
o as WithInitialActiveTab,
|
76
76
|
s as WithStatusIndicators,
|
77
77
|
a as default
|
package/dist/main.d.ts
CHANGED
@@ -79,8 +79,8 @@ export declare const ButtonsArray: React.FC<ButtonsArrayProps>;
|
|
79
79
|
export declare interface ButtonsArrayProps {
|
80
80
|
tabs: ButtonTab[];
|
81
81
|
label?: string;
|
82
|
-
initialActiveTab?: string | number;
|
83
82
|
onChange?: (key: string | number) => void;
|
83
|
+
activeKey?: string | number | null | undefined;
|
84
84
|
}
|
85
85
|
|
86
86
|
declare interface ButtonTab {
|