next-helios-fe 1.8.42 → 1.8.44

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.8.42",
3
+ "version": "1.8.44",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,26 +35,13 @@ export const Tab: TabComponent = ({
35
35
  });
36
36
  const [activeTab, setActiveTab] = useState(0);
37
37
 
38
- useEffect(() => {
39
- if (tabs.length === 1) {
40
- setActiveTab(0);
41
- }
42
-
43
- if (onChangeTab) {
44
- onChangeTab({
45
- index: activeTab,
46
- title: tabs[activeTab].title,
47
- });
48
- }
49
- }, [tabs, activeTab]);
50
-
51
38
  return (
52
39
  <div
53
- className={`flex w-full h-full overlow-hidden ${
40
+ className={`overlow-hidden flex h-full w-full ${
54
41
  options?.variant !== "horizontal"
55
42
  ? "flex-col divide-y-1"
56
- : "flex-col lg:flex-row divide-y-1 lg:divide-y-0 divide-x-0 lg:divide-x-1"
57
- } ${options?.border && "border rounded-md"}`}
43
+ : "flex-col divide-x-0 divide-y-1 lg:flex-row lg:divide-x-1 lg:divide-y-0"
44
+ } ${options?.border && "rounded-md border"}`}
58
45
  >
59
46
  {options?.variant !== "horizontal" ? (
60
47
  <div className="flex overflow-auto [&::-webkit-scrollbar]:hidden">
@@ -63,17 +50,24 @@ export const Tab: TabComponent = ({
63
50
  <div key={index} className="relative flex items-center">
64
51
  <button
65
52
  type="button"
66
- className={`flex items-center gap-2 pt-2 pb-1.5 border-b-2 select-none whitespace-nowrap duration-300 ${
53
+ className={`flex select-none items-center gap-2 whitespace-nowrap border-b-2 pb-1.5 pt-2 duration-300 ${
67
54
  activeTab === index
68
- ? "text-primary border-primary"
69
- : "border-transparent hover:text-primary hover:border-primary-transparent"
55
+ ? "border-primary text-primary"
56
+ : "border-transparent hover:border-primary-transparent hover:text-primary"
70
57
  } ${
71
58
  onCloseTab && childrenList.length !== 1
72
- ? "ps-6 pe-10"
59
+ ? "pe-10 ps-6"
73
60
  : "px-6"
74
61
  }`}
75
62
  onClick={() => {
76
63
  setActiveTab(index);
64
+
65
+ if (onChangeTab) {
66
+ onChangeTab({
67
+ index: index,
68
+ title: tabs[index].title,
69
+ });
70
+ }
77
71
  }}
78
72
  >
79
73
  {tab?.icon && <Icon icon={tab?.icon} className="text-lg" />}
@@ -82,7 +76,7 @@ export const Tab: TabComponent = ({
82
76
  {onCloseTab && childrenList.length !== 1 && (
83
77
  <button
84
78
  type="button"
85
- className="absolute right-2 p-0.5 rounded-full hover:text-warning"
79
+ className="absolute right-2 rounded-full p-0.5 hover:text-warning"
86
80
  onClick={() => {
87
81
  setActiveTab(
88
82
  activeTab === index
@@ -91,6 +85,7 @@ export const Tab: TabComponent = ({
91
85
  : index - 1
92
86
  : activeTab
93
87
  );
88
+
94
89
  onCloseTab(index);
95
90
  }}
96
91
  >
@@ -102,19 +97,26 @@ export const Tab: TabComponent = ({
102
97
  })}
103
98
  </div>
104
99
  ) : (
105
- <div className="flex flex-row lg:flex-col lg:min-w-36 lg:max-w-48 overflow-auto [&::-webkit-scrollbar]:hidden">
100
+ <div className="flex flex-row overflow-auto lg:min-w-36 lg:max-w-48 lg:flex-col [&::-webkit-scrollbar]:hidden">
106
101
  {tabs.slice(0, childrenList.length).map((tab, index) => {
107
102
  return (
108
103
  <button
109
104
  key={index}
110
105
  type="button"
111
- className={`flex items-center gap-2 px-6 pt-2 pb-1.5 border-b-2 lg:border-b-0 border-r-0 lg:border-r-2 text-left select-none whitespace-nowrap duration-300 ${
106
+ className={`flex select-none items-center gap-2 whitespace-nowrap border-b-2 border-r-0 px-6 pb-1.5 pt-2 text-left duration-300 lg:border-b-0 lg:border-r-2 ${
112
107
  activeTab === index
113
- ? "text-primary border-primary"
114
- : "border-transparent hover:text-primary hover:border-primary-transparent"
108
+ ? "border-primary text-primary"
109
+ : "border-transparent hover:border-primary-transparent hover:text-primary"
115
110
  }`}
116
111
  onClick={() => {
117
112
  setActiveTab(index);
113
+
114
+ if (onChangeTab) {
115
+ onChangeTab({
116
+ index: index,
117
+ title: tabs[index].title,
118
+ });
119
+ }
118
120
  }}
119
121
  >
120
122
  {tab?.icon && <Icon icon={tab?.icon} className="text-lg" />}
@@ -129,7 +131,7 @@ export const Tab: TabComponent = ({
129
131
  !options?.disablePadding
130
132
  ? options?.variant !== "horizontal"
131
133
  ? "px-6 py-8"
132
- : "px-6 lg:px-8 py-8 lg:py-6"
134
+ : "px-6 py-8 lg:px-8 lg:py-6"
133
135
  : ""
134
136
  }`}
135
137
  >