@ioca/react 1.5.25 → 1.5.26

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.
@@ -9,7 +9,7 @@ import Item from './item.js';
9
9
  import TabsNavs from './navs.js';
10
10
 
11
11
  const Tabs = ((props) => {
12
- const { ref, active, tabs: items, type = "default", prepend, append, children, className, vertical, toggable, loader, navsJustify = "start", navsClass, bar = true, hideMore, barClass, renderMore = defaultRenderMore, onTabChange, ...rest } = props;
12
+ const { ref, active, tabs: items, type = "default", prepend, append, children, className, vertical, toggable, loader, navsJustify = "start", navsClass, bar = true, hideMore, barClass, renderMore = defaultRenderMore, onTabChange, onClose, ...rest } = props;
13
13
  const navRefs = useRef([]);
14
14
  const navsRef = useRef(null);
15
15
  const contentsRef = useRef(new Map());
@@ -84,6 +84,7 @@ const Tabs = ((props) => {
84
84
  const i = currentTabs.findIndex((t) => t.key === key);
85
85
  if (i < 0)
86
86
  return;
87
+ onClose?.(key);
87
88
  if (sourceKeysRef.current.has(key)) {
88
89
  hiddenSourceKeysRef.current.add(key);
89
90
  }
package/lib/index.js CHANGED
@@ -6088,7 +6088,7 @@ const TabsNavs = (props) => {
6088
6088
  var TabsNavs$1 = memo(TabsNavs);
6089
6089
 
6090
6090
  const Tabs = ((props) => {
6091
- const { ref, active, tabs: items, type = "default", prepend, append, children, className, vertical, toggable, loader, navsJustify = "start", navsClass, bar = true, hideMore, barClass, renderMore = defaultRenderMore, onTabChange, ...rest } = props;
6091
+ const { ref, active, tabs: items, type = "default", prepend, append, children, className, vertical, toggable, loader, navsJustify = "start", navsClass, bar = true, hideMore, barClass, renderMore = defaultRenderMore, onTabChange, onClose, ...rest } = props;
6092
6092
  const navRefs = useRef([]);
6093
6093
  const navsRef = useRef(null);
6094
6094
  const contentsRef = useRef(new Map());
@@ -6163,6 +6163,7 @@ const Tabs = ((props) => {
6163
6163
  const i = currentTabs.findIndex((t) => t.key === key);
6164
6164
  if (i < 0)
6165
6165
  return;
6166
+ onClose?.(key);
6166
6167
  if (sourceKeysRef.current.has(key)) {
6167
6168
  hiddenSourceKeysRef.current.add(key);
6168
6169
  }
@@ -32,6 +32,7 @@ interface ITabs {
32
32
  renderMore?: (moreTabs: ITabItem[]) => ReactNode;
33
33
  loader?: ReactNode;
34
34
  onTabChange?: (to?: string, from?: string) => void;
35
+ onClose?: (key: string) => void;
35
36
  }
36
37
  interface RefTabs {
37
38
  open: (key: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ioca/react",
3
- "version": "1.5.25",
3
+ "version": "1.5.26",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",