@mw-kit/mw-ui 1.7.97 → 1.7.98
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,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabProps, TabsProps } from '../../interfaces';
|
|
3
|
-
declare const Close:
|
|
3
|
+
declare const Close: (props: Pick<TabsProps, 'onClose'> & {
|
|
4
4
|
index: number;
|
|
5
|
-
active: [
|
|
6
|
-
options: [TabProps
|
|
5
|
+
active: Exclude<TabsProps['active'], number>;
|
|
6
|
+
options: [TabProps[], React.Dispatch<React.SetStateAction<TabProps[]>>];
|
|
7
7
|
}) => JSX.Element;
|
|
8
8
|
export default Close;
|
|
@@ -35,7 +35,7 @@ export interface TabsProps<T = {}> extends React.HTMLAttributes<HTMLDivElement>
|
|
|
35
35
|
/**
|
|
36
36
|
* React state to control which tab is active.
|
|
37
37
|
*/
|
|
38
|
-
active: number | [number,
|
|
38
|
+
active: number | [number, (active: number, data: T) => void];
|
|
39
39
|
/**
|
|
40
40
|
* Sets the style of the tabs to internal.
|
|
41
41
|
*/
|
package/dist/index.js
CHANGED
|
@@ -19435,8 +19435,11 @@ var Close$1 = function Close$1(props) {
|
|
|
19435
19435
|
newOptions.splice(index, 1);
|
|
19436
19436
|
onClose(index, options[index], event);
|
|
19437
19437
|
|
|
19438
|
-
if (index < active
|
|
19439
|
-
setActive(active - 1);
|
|
19438
|
+
if (index < active) {
|
|
19439
|
+
setActive(active - 1, newOptions[active - 1].data);
|
|
19440
|
+
} else if (active === index) {
|
|
19441
|
+
var newactive = active > 0 ? active - 1 : active;
|
|
19442
|
+
setActive(newactive, newOptions[newactive].data);
|
|
19440
19443
|
}
|
|
19441
19444
|
|
|
19442
19445
|
setOptions(newOptions);
|
|
@@ -19488,7 +19491,7 @@ var Tabs$1 = function Tabs$1(props) {
|
|
|
19488
19491
|
$active: true
|
|
19489
19492
|
} : {
|
|
19490
19493
|
onClick: function onClick() {
|
|
19491
|
-
return setActive(index);
|
|
19494
|
+
return setActive(index, tab.data);
|
|
19492
19495
|
}
|
|
19493
19496
|
}, {
|
|
19494
19497
|
"$internal": props.internal,
|