@mw-kit/mw-ui 1.7.86 → 1.7.87
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/interfaces.d.ts +11 -9
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +15 -1
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SpacingOrZero, Spacings } from '../../interfaces';
|
|
3
|
-
|
|
4
|
-
data: T;
|
|
5
|
-
}>;
|
|
6
|
-
export declare type TabProvider<T = {}> = React.FunctionComponent<React.PropsWithChildren<{
|
|
7
|
-
active: boolean;
|
|
8
|
-
data: T;
|
|
9
|
-
}>>;
|
|
10
|
-
export declare type TabProps<T = {}> = {
|
|
3
|
+
declare type Tab<T = {}> = {
|
|
11
4
|
/**
|
|
12
5
|
* Define the tab label.
|
|
13
6
|
*/
|
|
@@ -16,7 +9,15 @@ export declare type TabProps<T = {}> = {
|
|
|
16
9
|
* Define the tab data.
|
|
17
10
|
*/
|
|
18
11
|
data: T;
|
|
19
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export declare type TabComponent<T = {}> = React.FunctionComponent<{
|
|
14
|
+
data: T;
|
|
15
|
+
}>;
|
|
16
|
+
export declare type TabProvider<T = {}> = React.FunctionComponent<React.PropsWithChildren<{
|
|
17
|
+
active: boolean;
|
|
18
|
+
setTab: React.Dispatch<React.SetStateAction<Tab<T>>>;
|
|
19
|
+
} & Tab<T>>>;
|
|
20
|
+
export declare type TabProps<T = {}> = Tab<T> & ({
|
|
20
21
|
/**
|
|
21
22
|
* Specifies which component, will mount/unmount everytime the tab is ACTIVATED/INACTIVATED
|
|
22
23
|
*/
|
|
@@ -75,3 +76,4 @@ export interface StyledTabsProps {
|
|
|
75
76
|
$active?: boolean;
|
|
76
77
|
}
|
|
77
78
|
export declare type TabsComponent = <T = {}>(props: React.PropsWithChildren<TabsProps<T>>) => JSX.Element;
|
|
79
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -19285,9 +19285,23 @@ var Tabs$1 = function Tabs$1(props) {
|
|
|
19285
19285
|
var _tab$provider = tab.provider,
|
|
19286
19286
|
Provider = _tab$provider === void 0 ? VoidProvider : _tab$provider,
|
|
19287
19287
|
Component = tab.component;
|
|
19288
|
+
|
|
19289
|
+
var setTab = function setTab(s) {
|
|
19290
|
+
setOptions(function (prev) {
|
|
19291
|
+
if (prev[index] !== tab) return prev;
|
|
19292
|
+
var newTab = typeof s === 'function' ? s(prev[index]) : s;
|
|
19293
|
+
if (prev[index] === newTab) return prev;
|
|
19294
|
+
var newTabs = [].concat(prev);
|
|
19295
|
+
newTabs[index] = _extends({}, prev[index], newTab);
|
|
19296
|
+
return newTabs;
|
|
19297
|
+
});
|
|
19298
|
+
};
|
|
19299
|
+
|
|
19288
19300
|
return React__default.createElement(Provider, Object.assign({
|
|
19289
19301
|
key: index,
|
|
19290
|
-
|
|
19302
|
+
label: tab.label,
|
|
19303
|
+
data: tab.data,
|
|
19304
|
+
setTab: setTab
|
|
19291
19305
|
}, index === active ? {
|
|
19292
19306
|
active: true,
|
|
19293
19307
|
children: React__default.createElement("div", null, React__default.createElement(Component, {
|