next-helios-fe 1.6.22 → 1.6.23

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.6.22",
3
+ "version": "1.6.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useState } from "react";
2
+ import React, { useState, useEffect } from "react";
3
3
  import { Icon } from "@iconify/react";
4
4
  import { Window, type WindowProps } from "./window";
5
5
 
@@ -13,19 +13,29 @@ interface TabProps {
13
13
  variant?: "vertical" | "horizontal";
14
14
  border?: boolean;
15
15
  };
16
+ onChangeTab?: (tab: any) => void;
16
17
  }
17
18
 
18
19
  interface TabComponent extends React.FC<TabProps> {
19
20
  Window: React.FC<WindowProps>;
20
21
  }
21
22
 
22
- export const Tab: TabComponent = ({ children, tabs, options }) => {
23
+ export const Tab: TabComponent = ({ children, tabs, options, onChangeTab }) => {
23
24
  const childrenList = React.Children.toArray(children);
24
25
  const windowList = childrenList.filter((child) => {
25
26
  return (child as React.ReactElement).type === Tab.Window;
26
27
  });
27
28
  const [activeTab, setActiveTab] = useState(0);
28
29
 
30
+ useEffect(() => {
31
+ if (onChangeTab) {
32
+ onChangeTab({
33
+ index: activeTab,
34
+ title: tabs[activeTab].title,
35
+ });
36
+ }
37
+ }, [activeTab]);
38
+
29
39
  return (
30
40
  <div
31
41
  className={`flex w-full h-full overlow-hidden ${