@mw-kit/mw-ui 1.7.79 → 1.7.80
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/dist/components/Tabs/components/Close/index.d.ts +2 -2
- package/dist/components/Tabs/index.d.ts +2 -3
- package/dist/components/Tabs/interfaces.d.ts +16 -8
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +5 -2
- package/dist/index.modern.js.map +1 -1
- package/dist/interfaces.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabProps, TabsProps } from '../../interfaces';
|
|
3
|
-
declare const Close: (props: Pick<TabsProps
|
|
3
|
+
declare const Close: <T>(props: Pick<TabsProps<T>, "onClose"> & {
|
|
4
4
|
index: number;
|
|
5
5
|
active: [number, React.Dispatch<React.SetStateAction<number>>];
|
|
6
|
-
options: [TabProps[], React.Dispatch<React.SetStateAction<TabProps[]>>];
|
|
6
|
+
options: [TabProps<T>[], React.Dispatch<React.SetStateAction<TabProps<T>[]>>];
|
|
7
7
|
}) => JSX.Element;
|
|
8
8
|
export default Close;
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SpacingOrZero, Spacings } from '../../interfaces';
|
|
3
|
-
export declare type TabComponent = React.FunctionComponent
|
|
4
|
-
|
|
3
|
+
export declare type TabComponent<T = {}> = React.FunctionComponent<{
|
|
4
|
+
data: T;
|
|
5
|
+
}>;
|
|
6
|
+
export declare type TabProvider<T = {}> = React.FunctionComponent<React.PropsWithChildren<{
|
|
5
7
|
active: boolean;
|
|
8
|
+
data: T;
|
|
6
9
|
}>>;
|
|
7
|
-
export declare type TabProps = {
|
|
10
|
+
export declare type TabProps<T = {}> = {
|
|
8
11
|
/**
|
|
9
12
|
* Define the tab label.
|
|
10
13
|
*/
|
|
11
14
|
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Define the tab data.
|
|
17
|
+
*/
|
|
18
|
+
data: T;
|
|
12
19
|
} & ({
|
|
13
20
|
/**
|
|
14
21
|
* Specifies which component, will mount/unmount everytime the tab is ACTIVATED/INACTIVATED
|
|
15
22
|
*/
|
|
16
|
-
component: TabComponent
|
|
23
|
+
component: TabComponent<T>;
|
|
17
24
|
/**
|
|
18
25
|
* Specifies the component provider, will mount/unmount when the tab is CREATED/REMOVED
|
|
19
26
|
*/
|
|
20
|
-
provider?: TabProvider
|
|
27
|
+
provider?: TabProvider<T>;
|
|
21
28
|
} | {});
|
|
22
|
-
export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
export interface TabsProps<T = {}> extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
30
|
/**
|
|
24
31
|
* Array with available tabs.
|
|
25
32
|
*/
|
|
26
|
-
options: TabProps[] | [TabProps[], React.Dispatch<React.SetStateAction<TabProps[]>>];
|
|
33
|
+
options: TabProps<T>[] | [TabProps<T>[], React.Dispatch<React.SetStateAction<TabProps<T>[]>>];
|
|
27
34
|
/**
|
|
28
35
|
* React state to control which tab is active.
|
|
29
36
|
*/
|
|
@@ -55,7 +62,7 @@ export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
55
62
|
/**
|
|
56
63
|
* callback when closing a tab
|
|
57
64
|
*/
|
|
58
|
-
onClose?: (index: number, tab: TabProps
|
|
65
|
+
onClose?: (index: number, tab: TabProps<T>, event: React.MouseEvent) => void | Promise<void>;
|
|
59
66
|
}
|
|
60
67
|
export interface StyledTabsProps {
|
|
61
68
|
/**
|
|
@@ -67,3 +74,4 @@ export interface StyledTabsProps {
|
|
|
67
74
|
*/
|
|
68
75
|
$active?: boolean;
|
|
69
76
|
}
|
|
77
|
+
export declare type TabsComponent = <T = {}>(props: React.PropsWithChildren<TabsProps<T>>) => JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -19245,10 +19245,13 @@ var Tabs$1 = function Tabs$1(props) {
|
|
|
19245
19245
|
Provider = _tab$provider === void 0 ? VoidProvider : _tab$provider,
|
|
19246
19246
|
Component = tab.component;
|
|
19247
19247
|
return React__default.createElement(Provider, Object.assign({
|
|
19248
|
-
key: index
|
|
19248
|
+
key: index,
|
|
19249
|
+
data: tab.data
|
|
19249
19250
|
}, index === active ? {
|
|
19250
19251
|
active: true,
|
|
19251
|
-
children: React__default.createElement("div", null, React__default.createElement(Component,
|
|
19252
|
+
children: React__default.createElement("div", null, React__default.createElement(Component, {
|
|
19253
|
+
data: tab.data
|
|
19254
|
+
}))
|
|
19252
19255
|
} : {
|
|
19253
19256
|
active: false
|
|
19254
19257
|
}));
|