triafly-ui-kit 1.0.36 → 1.0.38

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 u, jsx as l } from "react/jsx-runtime";
2
- import { useState as i, useEffect as a } from "react";
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 k = ({
5
- tabs: s,
6
- label: r,
7
- initialActiveTab: o,
8
- onChange: c
9
- }) => {
10
- const [n, t] = i(
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__ */ u("div", { className: "buttons", children: [
20
- r && /* @__PURE__ */ l("span", { className: "buttons-label", children: r }),
21
- /* @__PURE__ */ l("div", { className: "buttons-bar", children: s.map((e, m) => /* @__PURE__ */ l(
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: e.disabled,
25
- onClick: () => d(e.key),
26
- className: `button ${m === n ? "active" : ""} status-${e.status}`,
27
- children: e.label
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
- e.key
22
+ s.key
30
23
  )) })
31
24
  ] });
32
25
  };
33
26
  export {
34
- k as ButtonsArray
27
+ p as ButtonsArray
35
28
  };
@@ -4,7 +4,7 @@ const a = {
4
4
  component: e,
5
5
  tags: ["autodocs"],
6
6
  argTypes: {
7
- initialActiveTab: {
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
- initialActiveTab: 1
38
+ activeKey: 1
39
39
  }
40
- }, b = {
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
- }, r = {
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
- }, i = {
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
- b as DisabledTabs,
73
- i as ManyTabs,
74
- r as SmallSelection,
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triafly-ui-kit",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "UI Kit from Triafly",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",