@fluentui/react-tabs 1.0.0-beta.98 → 9.0.0-beta.7
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/CHANGELOG.json +71 -1840
- package/CHANGELOG.md +24 -743
- package/README.md +0 -17
- package/Spec.md +433 -0
- package/dist/react-tabs.d.ts +171 -137
- package/lib/Tab.d.ts +1 -0
- package/lib/Tab.js +2 -0
- package/lib/Tab.js.map +1 -0
- package/lib/TabList.d.ts +1 -0
- package/lib/TabList.js +2 -0
- package/lib/TabList.js.map +1 -0
- package/lib/components/Tab/Tab.d.ts +6 -0
- package/lib/components/Tab/Tab.js +15 -0
- package/lib/components/Tab/Tab.js.map +1 -0
- package/lib/components/Tab/Tab.types.d.ts +52 -0
- package/lib/components/Tab/Tab.types.js +2 -0
- package/lib/components/Tab/Tab.types.js.map +1 -0
- package/lib/components/Tab/index.d.ts +5 -0
- package/lib/components/Tab/index.js +6 -0
- package/lib/components/Tab/index.js.map +1 -0
- package/lib/components/Tab/renderTab.d.ts +5 -0
- package/lib/components/Tab/renderTab.js +18 -0
- package/lib/components/Tab/renderTab.js.map +1 -0
- package/lib/components/Tab/useTab.d.ts +12 -0
- package/lib/components/Tab/useTab.js +82 -0
- package/lib/components/Tab/useTab.js.map +1 -0
- package/lib/components/Tab/useTabStyles.d.ts +6 -0
- package/lib/components/Tab/useTabStyles.js +205 -0
- package/lib/components/Tab/useTabStyles.js.map +1 -0
- package/lib/components/TabList/TabList.d.ts +6 -0
- package/lib/components/TabList/TabList.js +17 -0
- package/lib/components/TabList/TabList.js.map +1 -0
- package/lib/components/TabList/TabList.types.d.ts +99 -0
- package/lib/components/TabList/TabList.types.js +2 -0
- package/lib/components/TabList/TabList.types.js.map +1 -0
- package/lib/components/TabList/TabListContext.d.ts +3 -0
- package/lib/components/TabList/TabListContext.js +17 -0
- package/lib/components/TabList/TabListContext.js.map +1 -0
- package/lib/components/TabList/index.d.ts +5 -0
- package/lib/components/TabList/index.js +6 -0
- package/lib/components/TabList/index.js.map +1 -0
- package/lib/components/TabList/renderTabList.d.ts +5 -0
- package/lib/components/TabList/renderTabList.js +19 -0
- package/lib/components/TabList/renderTabList.js.map +1 -0
- package/lib/components/TabList/useTabList.d.ts +12 -0
- package/lib/components/TabList/useTabList.js +106 -0
- package/lib/components/TabList/useTabList.js.map +1 -0
- package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
- package/lib/components/TabList/useTabListContextValues.js +24 -0
- package/lib/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib/components/TabList/useTabListStyles.d.ts +9 -0
- package/lib/components/TabList/useTabListStyles.js +118 -0
- package/lib/components/TabList/useTabListStyles.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/tab.constants.d.ts +15 -0
- package/lib/tab.constants.js +17 -0
- package/lib/tab.constants.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Tab.d.ts +1 -0
- package/lib-commonjs/Tab.js +10 -0
- package/lib-commonjs/Tab.js.map +1 -0
- package/lib-commonjs/TabList.d.ts +1 -0
- package/lib-commonjs/TabList.js +10 -0
- package/lib-commonjs/TabList.js.map +1 -0
- package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
- package/lib-commonjs/components/Tab/Tab.js +26 -0
- package/lib-commonjs/components/Tab/Tab.js.map +1 -0
- package/lib-commonjs/components/Tab/Tab.types.d.ts +52 -0
- package/lib-commonjs/components/Tab/Tab.types.js +6 -0
- package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
- package/lib-commonjs/components/Tab/index.d.ts +5 -0
- package/lib-commonjs/components/Tab/index.js +18 -0
- package/lib-commonjs/components/Tab/index.js.map +1 -0
- package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
- package/lib-commonjs/components/Tab/renderTab.js +29 -0
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
- package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
- package/lib-commonjs/components/Tab/useTab.js +95 -0
- package/lib-commonjs/components/Tab/useTab.js.map +1 -0
- package/lib-commonjs/components/Tab/useTabStyles.d.ts +6 -0
- package/lib-commonjs/components/Tab/useTabStyles.js +218 -0
- package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
- package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
- package/lib-commonjs/components/TabList/TabList.js +29 -0
- package/lib-commonjs/components/TabList/TabList.js.map +1 -0
- package/lib-commonjs/components/TabList/TabList.types.d.ts +99 -0
- package/lib-commonjs/components/TabList/TabList.types.js +6 -0
- package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
- package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
- package/lib-commonjs/components/TabList/TabListContext.js +25 -0
- package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
- package/lib-commonjs/components/TabList/index.d.ts +5 -0
- package/lib-commonjs/components/TabList/index.js +18 -0
- package/lib-commonjs/components/TabList/index.js.map +1 -0
- package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
- package/lib-commonjs/components/TabList/renderTabList.js +31 -0
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
- package/lib-commonjs/components/TabList/useTabList.js +118 -0
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js +33 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabListStyles.d.ts +9 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js +131 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +10 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/tab.constants.d.ts +15 -0
- package/lib-commonjs/tab.constants.js +23 -0
- package/lib-commonjs/tab.constants.js.map +1 -0
- package/package.json +19 -13
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -14
- package/etc/react-tabs.api.md +0 -104
- package/just.config.ts +0 -3
- package/lib/Tabs.d.ts +0 -1
- package/lib/Tabs.js +0 -2
- package/lib/Tabs.js.map +0 -1
- package/lib/common/isConformant.d.ts +0 -2
- package/lib/common/isConformant.js +0 -9
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Tabs/TabItem.d.ts +0 -6
- package/lib/components/Tabs/TabItem.js +0 -18
- package/lib/components/Tabs/TabItem.js.map +0 -1
- package/lib/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib/components/Tabs/TabItem.types.js +0 -2
- package/lib/components/Tabs/TabItem.types.js.map +0 -1
- package/lib/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib/components/Tabs/Tabs.base.js +0 -179
- package/lib/components/Tabs/Tabs.base.js.map +0 -1
- package/lib/components/Tabs/Tabs.d.ts +0 -8
- package/lib/components/Tabs/Tabs.js +0 -12
- package/lib/components/Tabs/Tabs.js.map +0 -1
- package/lib/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib/components/Tabs/Tabs.styles.js +0 -264
- package/lib/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib/components/Tabs/Tabs.types.js +0 -2
- package/lib/components/Tabs/Tabs.types.js.map +0 -1
- package/lib/components/Tabs/index.d.ts +0 -5
- package/lib/components/Tabs/index.js +0 -6
- package/lib/components/Tabs/index.js.map +0 -1
- package/lib/utilities/observeResize.d.ts +0 -21
- package/lib/utilities/observeResize.js +0 -46
- package/lib/utilities/observeResize.js.map +0 -1
- package/lib/utilities/useOverflow.d.ts +0 -45
- package/lib/utilities/useOverflow.js +0 -126
- package/lib/utilities/useOverflow.js.map +0 -1
- package/lib-amd/Tabs.d.ts +0 -1
- package/lib-amd/Tabs.js +0 -6
- package/lib-amd/Tabs.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Tabs/TabItem.d.ts +0 -6
- package/lib-amd/components/Tabs/TabItem.js +0 -20
- package/lib-amd/components/Tabs/TabItem.js.map +0 -1
- package/lib-amd/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib-amd/components/Tabs/TabItem.types.js +0 -5
- package/lib-amd/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib-amd/components/Tabs/Tabs.base.js +0 -176
- package/lib-amd/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.d.ts +0 -8
- package/lib-amd/components/Tabs/Tabs.js +0 -14
- package/lib-amd/components/Tabs/Tabs.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib-amd/components/Tabs/Tabs.styles.js +0 -267
- package/lib-amd/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-amd/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib-amd/components/Tabs/Tabs.types.js +0 -5
- package/lib-amd/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-amd/components/Tabs/index.d.ts +0 -5
- package/lib-amd/components/Tabs/index.js +0 -11
- package/lib-amd/components/Tabs/index.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/utilities/observeResize.d.ts +0 -21
- package/lib-amd/utilities/observeResize.js +0 -51
- package/lib-amd/utilities/observeResize.js.map +0 -1
- package/lib-amd/utilities/useOverflow.d.ts +0 -45
- package/lib-amd/utilities/useOverflow.js +0 -128
- package/lib-amd/utilities/useOverflow.js.map +0 -1
- package/lib-commonjs/Tabs.d.ts +0 -1
- package/lib-commonjs/Tabs.js +0 -5
- package/lib-commonjs/Tabs.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -2
- package/lib-commonjs/common/isConformant.js +0 -13
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Tabs/TabItem.d.ts +0 -6
- package/lib-commonjs/components/Tabs/TabItem.js +0 -21
- package/lib-commonjs/components/Tabs/TabItem.js.map +0 -1
- package/lib-commonjs/components/Tabs/TabItem.types.d.ts +0 -61
- package/lib-commonjs/components/Tabs/TabItem.types.js +0 -3
- package/lib-commonjs/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.base.d.ts +0 -3
- package/lib-commonjs/components/Tabs/Tabs.base.js +0 -182
- package/lib-commonjs/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.d.ts +0 -8
- package/lib-commonjs/components/Tabs/Tabs.js +0 -15
- package/lib-commonjs/components/Tabs/Tabs.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.styles.d.ts +0 -2
- package/lib-commonjs/components/Tabs/Tabs.styles.js +0 -268
- package/lib-commonjs/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-commonjs/components/Tabs/Tabs.types.d.ts +0 -113
- package/lib-commonjs/components/Tabs/Tabs.types.js +0 -3
- package/lib-commonjs/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-commonjs/components/Tabs/index.d.ts +0 -5
- package/lib-commonjs/components/Tabs/index.js +0 -11
- package/lib-commonjs/components/Tabs/index.js.map +0 -1
- package/lib-commonjs/utilities/observeResize.d.ts +0 -21
- package/lib-commonjs/utilities/observeResize.js +0 -50
- package/lib-commonjs/utilities/observeResize.js.map +0 -1
- package/lib-commonjs/utilities/useOverflow.d.ts +0 -45
- package/lib-commonjs/utilities/useOverflow.js +0 -130
- package/lib-commonjs/utilities/useOverflow.js.map +0 -1
- package/src/components/Tabs/TabItem.types.ts +0 -69
- package/src/components/Tabs/Tabs.types.ts +0 -131
package/dist/react-tabs.d.ts
CHANGED
|
@@ -1,197 +1,231 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IRenderFunction } from '@fluentui/utilities';
|
|
5
|
-
import { IStyle } from '@fluentui/style-utilities';
|
|
6
|
-
import { IStyleFunctionOrObject } from '@fluentui/utilities';
|
|
7
|
-
import { ITheme } from '@fluentui/style-utilities';
|
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
8
4
|
import * as React_2 from 'react';
|
|
5
|
+
import type { Slot } from '@fluentui/react-utilities';
|
|
6
|
+
|
|
7
|
+
export declare const indicatorLengthVar = "--selection-indicator-length";
|
|
8
|
+
|
|
9
|
+
export declare const indicatorOffsetVar = "--selection-indicator-offset";
|
|
10
|
+
|
|
11
|
+
export declare type RegisterTabData = {
|
|
12
|
+
/**
|
|
13
|
+
* The value of the selected tab.
|
|
14
|
+
*/
|
|
15
|
+
value: TabValue;
|
|
16
|
+
ref: React_2.RefObject<HTMLElement>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export declare type RegisterTabEventHandler = (data: RegisterTabData) => void;
|
|
9
20
|
|
|
10
21
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Display mode for the tabs
|
|
22
|
+
* Render the final JSX of Tab
|
|
13
23
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
|
|
16
|
-
export declare class TabItem extends React_2.Component<TabItemProps, {}> {
|
|
17
|
-
constructor(props: TabItemProps);
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
24
|
+
export declare const renderTab_unstable: (state: TabState) => JSX.Element;
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
27
|
+
* Render the final JSX of TabList
|
|
23
28
|
*/
|
|
24
|
-
export declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
componentRef?: IRefObject<{}>;
|
|
29
|
+
export declare const renderTabList_unstable: (state: TabListState, contextValues: TabListContextValues) => JSX.Element;
|
|
30
|
+
|
|
31
|
+
export declare type SelectTabData = {
|
|
29
32
|
/**
|
|
30
|
-
* The
|
|
33
|
+
* The value of the selected tab.
|
|
31
34
|
*/
|
|
32
|
-
|
|
35
|
+
value: TabValue;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export declare type SelectTabEvent<E = HTMLElement> = React_2.MouseEvent<E> | React_2.KeyboardEvent<E>;
|
|
39
|
+
|
|
40
|
+
export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A tab provides a selectable item in a tab list.
|
|
44
|
+
*/
|
|
45
|
+
export declare const Tab: ForwardRefComponent<TabProps>;
|
|
46
|
+
|
|
47
|
+
export declare const tabClassName = "fui-Tab";
|
|
48
|
+
|
|
49
|
+
declare type TabCommons = {
|
|
33
50
|
/**
|
|
34
|
-
*
|
|
35
|
-
* for each tab element.
|
|
51
|
+
* The value that identifies this tab when selected.
|
|
36
52
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
value: TabValue;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A bounding rectangle of a tab
|
|
58
|
+
*/
|
|
59
|
+
export declare type TabContentRect = {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A tab list provides single selection from a set of tabs.
|
|
68
|
+
*/
|
|
69
|
+
export declare const TabList: ForwardRefComponent<TabListProps>;
|
|
70
|
+
|
|
71
|
+
export declare const tabListClassName = "fui-TabList";
|
|
72
|
+
|
|
73
|
+
declare type TabListCommons = {
|
|
40
74
|
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
75
|
+
* A tab list can supports 'transparent' and 'subtle' appearance.
|
|
76
|
+
*- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
|
77
|
+
*- 'transparent': No background and border styling
|
|
78
|
+
* The appearance affects each of the contained tabs.
|
|
79
|
+
* @default 'transparent'
|
|
44
80
|
*/
|
|
45
|
-
|
|
81
|
+
appearance?: 'transparent' | 'subtle';
|
|
46
82
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* Note that unless you have compelling requirements you should not override aria-label.
|
|
83
|
+
* Raised when a tab is selected.
|
|
50
84
|
*/
|
|
51
|
-
|
|
85
|
+
onTabSelect?: SelectTabEventHandler;
|
|
52
86
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Examples: completed (4), Unread (99+)
|
|
87
|
+
* The value of the currently selected tab.
|
|
56
88
|
*/
|
|
57
|
-
|
|
89
|
+
selectedValue?: TabValue;
|
|
58
90
|
/**
|
|
59
|
-
*
|
|
91
|
+
* A tab list can be either 'small' or 'medium' size.
|
|
92
|
+
* The size affects each of the contained tabs.
|
|
93
|
+
* @default 'medium'
|
|
60
94
|
*/
|
|
61
|
-
|
|
95
|
+
size?: 'small' | 'medium';
|
|
62
96
|
/**
|
|
63
|
-
*
|
|
97
|
+
* A tab list can arrange its tabs vertically.
|
|
98
|
+
* @default false
|
|
64
99
|
*/
|
|
65
|
-
|
|
100
|
+
vertical?: boolean;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'size' | 'vertical'>> & {
|
|
104
|
+
/** A callback to allow a tab to register itself with the tab list. */
|
|
105
|
+
onRegister: RegisterTabEventHandler;
|
|
106
|
+
/** A callback to allow a tab to unregister itself with the tab list. */
|
|
107
|
+
onUnregister: RegisterTabEventHandler;
|
|
66
108
|
/**
|
|
67
|
-
*
|
|
109
|
+
* A callback to allow a tab to select itself when pressed.
|
|
68
110
|
*/
|
|
69
|
-
|
|
111
|
+
onSelect: SelectTabEventHandler;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Context values used in rendering TabList.
|
|
116
|
+
*/
|
|
117
|
+
export declare type TabListContextValues = {
|
|
70
118
|
/**
|
|
71
|
-
*
|
|
72
|
-
* Useful if you're rendering content that is expensive to mount.
|
|
73
|
-
*
|
|
74
|
-
* @defaultvalue false
|
|
119
|
+
* The context of the tab list available to each tab.
|
|
75
120
|
*/
|
|
76
|
-
|
|
77
|
-
}
|
|
121
|
+
tabList: TabListContextValue;
|
|
122
|
+
};
|
|
78
123
|
|
|
79
124
|
/**
|
|
80
|
-
*
|
|
81
|
-
* distinct content categories. Tabs allow for navigation between two or more content
|
|
82
|
-
* views and relies on text headers to articulate the different sections of content.
|
|
125
|
+
* TabList Props
|
|
83
126
|
*/
|
|
84
|
-
export declare
|
|
127
|
+
export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
|
|
128
|
+
/**
|
|
129
|
+
* The value of the tab to be selected by default.
|
|
130
|
+
* Typically useful when the selectedValue is uncontrolled.
|
|
131
|
+
*/
|
|
132
|
+
defaultSelectedValue?: TabValue;
|
|
133
|
+
};
|
|
85
134
|
|
|
86
|
-
export declare const
|
|
135
|
+
export declare const tabListSelectionIndicatorName = "fui-TabList_SelectionIndicator";
|
|
87
136
|
|
|
88
|
-
|
|
89
|
-
* {@docCategory Tabs}
|
|
90
|
-
*/
|
|
91
|
-
export declare interface TabsImperativeHandle {
|
|
137
|
+
export declare type TabListSlots = {
|
|
92
138
|
/**
|
|
93
|
-
*
|
|
139
|
+
* The slot associated with the root element of this tab list.
|
|
94
140
|
*/
|
|
95
|
-
|
|
96
|
-
}
|
|
141
|
+
root: Slot<'div'>;
|
|
142
|
+
};
|
|
97
143
|
|
|
98
144
|
/**
|
|
99
|
-
*
|
|
100
|
-
* Size of the tabs
|
|
145
|
+
* State used in rendering TabList.
|
|
101
146
|
*/
|
|
102
|
-
export declare type
|
|
147
|
+
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue & {
|
|
148
|
+
selectedTabRect?: TabContentRect;
|
|
149
|
+
};
|
|
103
150
|
|
|
104
151
|
/**
|
|
105
|
-
*
|
|
152
|
+
* Tab Props
|
|
106
153
|
*/
|
|
107
|
-
export declare
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* the public methods and properties of the component.
|
|
111
|
-
*/
|
|
112
|
-
componentRef?: React_2.RefObject<TabsImperativeHandle>;
|
|
113
|
-
/**
|
|
114
|
-
* Call to provide customized styling that will layer on top of the variant rules.
|
|
115
|
-
*/
|
|
116
|
-
styles?: IStyleFunctionOrObject<TabsStyleProps, TabsStyles>;
|
|
117
|
-
/**
|
|
118
|
-
* Theme provided by High-Order Component.
|
|
119
|
-
*/
|
|
120
|
-
theme?: ITheme;
|
|
121
|
-
/**
|
|
122
|
-
* Additional css class to apply to the Tabs
|
|
123
|
-
* @defaultvalue undefined
|
|
124
|
-
*/
|
|
125
|
-
className?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Default selected TabItem key. Only provide this if the Tabs is an uncontrolled component;
|
|
128
|
-
* otherwise, use the `selectedKey` property.
|
|
129
|
-
*/
|
|
130
|
-
defaultSelectedKey?: string;
|
|
154
|
+
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
155
|
+
|
|
156
|
+
export declare type TabSlots = {
|
|
131
157
|
/**
|
|
132
|
-
*
|
|
133
|
-
* Only provide this if the Tabs is a controlled component where you are maintaining the
|
|
134
|
-
* current state; otherwise, use `defaultSelectedKey`.
|
|
158
|
+
* Root of the component.
|
|
135
159
|
*/
|
|
136
|
-
|
|
160
|
+
root: Slot<'div'>;
|
|
137
161
|
/**
|
|
138
|
-
*
|
|
162
|
+
* Icon that renders before the content.
|
|
139
163
|
*/
|
|
140
|
-
|
|
164
|
+
icon?: Slot<'span'>;
|
|
141
165
|
/**
|
|
142
|
-
*
|
|
166
|
+
* Component children are placed in this slot
|
|
167
|
+
* Avoid using the `children` property in this slot in favour of Component children whenever possible.
|
|
143
168
|
*/
|
|
144
|
-
|
|
169
|
+
content: NonNullable<Slot<'span'>>;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* State used in rendering Tab
|
|
174
|
+
*/
|
|
175
|
+
export declare type TabState = ComponentState<TabSlots> & TabCommons & {
|
|
145
176
|
/**
|
|
146
|
-
*
|
|
177
|
+
* A tab supports 'transparent' and 'subtle' appearance.
|
|
147
178
|
*/
|
|
148
|
-
|
|
179
|
+
appearance?: string;
|
|
149
180
|
/**
|
|
150
|
-
*
|
|
151
|
-
* * none: Tabs will overflow the container and may not be visible
|
|
152
|
-
* * menu: Display an overflow menu that contains the tabs that don't fit
|
|
153
|
-
*
|
|
154
|
-
* @default none
|
|
181
|
+
* If this tab is selected.
|
|
155
182
|
*/
|
|
156
|
-
|
|
183
|
+
selected?: boolean;
|
|
157
184
|
/**
|
|
158
|
-
*
|
|
159
|
-
* Use this prop if you plan to separately render the tab content
|
|
160
|
-
* and don't want to leave an empty tabpanel in the page that may confuse Screen Readers.
|
|
185
|
+
* A tab can be either 'small' or 'medium' size.
|
|
161
186
|
*/
|
|
162
|
-
|
|
187
|
+
size: 'small' | 'medium';
|
|
163
188
|
/**
|
|
164
|
-
*
|
|
165
|
-
* Useful if you're rendering content outside and need to connect aria-labelledby.
|
|
189
|
+
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
|
|
166
190
|
*/
|
|
167
|
-
|
|
168
|
-
}
|
|
191
|
+
vertical: boolean;
|
|
192
|
+
};
|
|
169
193
|
|
|
170
194
|
/**
|
|
171
|
-
*
|
|
195
|
+
* Any value that identifies a specific tab.
|
|
172
196
|
*/
|
|
173
|
-
export declare type
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
197
|
+
export declare type TabValue = unknown;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Create the state required to render Tab.
|
|
201
|
+
*
|
|
202
|
+
* The returned state can be modified with hooks such as useTabStyles_unstable,
|
|
203
|
+
* before being passed to renderTab_unstable.
|
|
204
|
+
*
|
|
205
|
+
* @param props - props from this instance of Tab
|
|
206
|
+
* @param ref - reference to root HTMLElement of Tab
|
|
207
|
+
*/
|
|
208
|
+
export declare const useTab_unstable: (props: TabProps, ref: React_2.Ref<HTMLElement>) => TabState;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Create the state required to render TabList.
|
|
212
|
+
*
|
|
213
|
+
* The returned state can be modified with hooks such as useTabListStyles_unstable,
|
|
214
|
+
* before being passed to renderTabList_unstable.
|
|
215
|
+
*
|
|
216
|
+
* @param props - props from this instance of TabList
|
|
217
|
+
* @param ref - reference to root HTMLElement of TabList
|
|
218
|
+
*/
|
|
219
|
+
export declare const useTabList_unstable: (props: TabListProps, ref: React_2.Ref<HTMLElement>) => TabListState;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Apply styling to the TabList slots based on the state
|
|
223
|
+
*/
|
|
224
|
+
export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;
|
|
177
225
|
|
|
178
226
|
/**
|
|
179
|
-
*
|
|
227
|
+
* Apply styling to the Tab slots based on the state
|
|
180
228
|
*/
|
|
181
|
-
export declare
|
|
182
|
-
/**
|
|
183
|
-
* Style for the root element.
|
|
184
|
-
*/
|
|
185
|
-
root: IStyle;
|
|
186
|
-
tab: IStyle;
|
|
187
|
-
tabIsSelected: IStyle;
|
|
188
|
-
tabContent: IStyle;
|
|
189
|
-
text: IStyle;
|
|
190
|
-
count: IStyle;
|
|
191
|
-
icon: IStyle;
|
|
192
|
-
tabInMenu: IStyle;
|
|
193
|
-
overflowMenuButton: IStyle;
|
|
194
|
-
itemContainer?: IStyle;
|
|
195
|
-
}
|
|
229
|
+
export declare const useTabStyles_unstable: (state: TabState) => TabState;
|
|
196
230
|
|
|
197
231
|
export { }
|
package/lib/Tab.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Tab/index';
|
package/lib/Tab.js
ADDED
package/lib/Tab.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tab.js","sourceRoot":"../src/","sources":["Tab.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './components/Tab/index';\n"]}
|
package/lib/TabList.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/TabList/index';
|
package/lib/TabList.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabList.js","sourceRoot":"../src/","sources":["TabList.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/TabList/index';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTab_unstable } from './useTab';
|
|
3
|
+
import { renderTab_unstable } from './renderTab';
|
|
4
|
+
import { useTabStyles_unstable } from './useTabStyles';
|
|
5
|
+
/**
|
|
6
|
+
* A tab provides a selectable item in a tab list.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const Tab = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
10
|
+
const state = useTab_unstable(props, ref);
|
|
11
|
+
useTabStyles_unstable(state);
|
|
12
|
+
return renderTab_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
Tab.displayName = 'Tab';
|
|
15
|
+
//# sourceMappingURL=Tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Tab/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,UAAhC;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AAIA;;AAEG;;AACH,OAAO,MAAM,GAAG,gBAAkC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChF,QAAM,KAAK,GAAG,eAAe,CAAC,KAAD,EAAQ,GAAR,CAA7B;AAEA,EAAA,qBAAqB,CAAC,KAAD,CAArB;AACA,SAAO,kBAAkB,CAAC,KAAD,CAAzB;AACD,CALiD,CAA3C;AAOP,GAAG,CAAC,WAAJ,GAAkB,KAAlB","sourcesContent":["import * as React from 'react';\nimport { useTab_unstable } from './useTab';\nimport { renderTab_unstable } from './renderTab';\nimport { useTabStyles_unstable } from './useTabStyles';\nimport type { TabProps } from './Tab.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A tab provides a selectable item in a tab list.\n */\nexport const Tab: ForwardRefComponent<TabProps> = React.forwardRef((props, ref) => {\n const state = useTab_unstable(props, ref);\n\n useTabStyles_unstable(state);\n return renderTab_unstable(state);\n});\n\nTab.displayName = 'Tab';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Any value that identifies a specific tab.
|
|
4
|
+
*/
|
|
5
|
+
export declare type TabValue = unknown;
|
|
6
|
+
export declare type TabSlots = {
|
|
7
|
+
/**
|
|
8
|
+
* Root of the component.
|
|
9
|
+
*/
|
|
10
|
+
root: Slot<'div'>;
|
|
11
|
+
/**
|
|
12
|
+
* Icon that renders before the content.
|
|
13
|
+
*/
|
|
14
|
+
icon?: Slot<'span'>;
|
|
15
|
+
/**
|
|
16
|
+
* Component children are placed in this slot
|
|
17
|
+
* Avoid using the `children` property in this slot in favour of Component children whenever possible.
|
|
18
|
+
*/
|
|
19
|
+
content: NonNullable<Slot<'span'>>;
|
|
20
|
+
};
|
|
21
|
+
declare type TabCommons = {
|
|
22
|
+
/**
|
|
23
|
+
* The value that identifies this tab when selected.
|
|
24
|
+
*/
|
|
25
|
+
value: TabValue;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Tab Props
|
|
29
|
+
*/
|
|
30
|
+
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
31
|
+
/**
|
|
32
|
+
* State used in rendering Tab
|
|
33
|
+
*/
|
|
34
|
+
export declare type TabState = ComponentState<TabSlots> & TabCommons & {
|
|
35
|
+
/**
|
|
36
|
+
* A tab supports 'transparent' and 'subtle' appearance.
|
|
37
|
+
*/
|
|
38
|
+
appearance?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If this tab is selected.
|
|
41
|
+
*/
|
|
42
|
+
selected?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* A tab can be either 'small' or 'medium' size.
|
|
45
|
+
*/
|
|
46
|
+
size: 'small' | 'medium';
|
|
47
|
+
/**
|
|
48
|
+
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
|
|
49
|
+
*/
|
|
50
|
+
vertical: boolean;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tab.types.js","sourceRoot":"../src/","sources":["components/Tab/Tab.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Any value that identifies a specific tab.\n */\nexport type TabValue = unknown;\n\nexport type TabSlots = {\n /**\n * Root of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Icon that renders before the content.\n */\n icon?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible.\n */\n content: NonNullable<Slot<'span'>>;\n};\n\ntype TabCommons = {\n /**\n * The value that identifies this tab when selected.\n */\n value: TabValue;\n};\n\n/**\n * Tab Props\n */\nexport type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;\n\n/**\n * State used in rendering Tab\n */\nexport type TabState = ComponentState<TabSlots> &\n TabCommons & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: string;\n /**\n * If this tab is selected.\n */\n selected?: boolean;\n /**\n * A tab can be either 'small' or 'medium' size.\n */\n size: 'small' | 'medium';\n /**\n * A tab can arrange its content based on if the tabs in the list are arranged vertically.\n */\n vertical: boolean;\n };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Tab/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of Tab
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
|
|
8
|
+
export const renderTab_unstable = state => {
|
|
9
|
+
const {
|
|
10
|
+
slots,
|
|
11
|
+
slotProps
|
|
12
|
+
} = getSlots(state);
|
|
13
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
14
|
+
}, slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
|
|
15
|
+
}), /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=renderTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Tab/renderTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;AACH;;AACA,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoB;AACpD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAW,KAAX,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADjB,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAFF,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TabState, TabSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const renderTab_unstable = (state: TabState) => {\n const { slots, slotProps } = getSlots<TabSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n <slots.content {...slotProps.content} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TabProps, TabState } from './Tab.types';
|
|
3
|
+
/**
|
|
4
|
+
* Create the state required to render Tab.
|
|
5
|
+
*
|
|
6
|
+
* The returned state can be modified with hooks such as useTabStyles_unstable,
|
|
7
|
+
* before being passed to renderTab_unstable.
|
|
8
|
+
*
|
|
9
|
+
* @param props - props from this instance of Tab
|
|
10
|
+
* @param ref - reference to root HTMLElement of Tab
|
|
11
|
+
*/
|
|
12
|
+
export declare const useTab_unstable: (props: TabProps, ref: React.Ref<HTMLElement>) => TabState;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
|
3
|
+
import { TabListContext } from '../TabList/TabListContext';
|
|
4
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
5
|
+
/**
|
|
6
|
+
* Create the state required to render Tab.
|
|
7
|
+
*
|
|
8
|
+
* The returned state can be modified with hooks such as useTabStyles_unstable,
|
|
9
|
+
* before being passed to renderTab_unstable.
|
|
10
|
+
*
|
|
11
|
+
* @param props - props from this instance of Tab
|
|
12
|
+
* @param ref - reference to root HTMLElement of Tab
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
|
|
16
|
+
export const useTab_unstable = (props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
content,
|
|
19
|
+
icon,
|
|
20
|
+
value
|
|
21
|
+
} = props;
|
|
22
|
+
const {
|
|
23
|
+
appearance,
|
|
24
|
+
selected,
|
|
25
|
+
onRegister,
|
|
26
|
+
onUnregister,
|
|
27
|
+
onSelect,
|
|
28
|
+
size,
|
|
29
|
+
vertical
|
|
30
|
+
} = useContextSelector(TabListContext, ctx => ({
|
|
31
|
+
appearance: ctx.appearance,
|
|
32
|
+
selected: ctx.selectedValue === value,
|
|
33
|
+
onRegister: ctx.onRegister,
|
|
34
|
+
onUnregister: ctx.onUnregister,
|
|
35
|
+
onSelect: ctx.onSelect,
|
|
36
|
+
size: ctx.size,
|
|
37
|
+
vertical: !!ctx.vertical
|
|
38
|
+
}));
|
|
39
|
+
const onClick = useEventCallback(event => onSelect(event, {
|
|
40
|
+
value
|
|
41
|
+
}));
|
|
42
|
+
const innerRef = React.useRef(null);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
onRegister({
|
|
45
|
+
value,
|
|
46
|
+
ref: innerRef
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
onUnregister({
|
|
50
|
+
value,
|
|
51
|
+
ref: innerRef
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}, [onRegister, onUnregister, innerRef, value]);
|
|
55
|
+
return {
|
|
56
|
+
components: {
|
|
57
|
+
root: 'div',
|
|
58
|
+
icon: 'span',
|
|
59
|
+
content: 'span'
|
|
60
|
+
},
|
|
61
|
+
root: getNativeElementProps('div', {
|
|
62
|
+
ref: useMergedRefs(ref, innerRef),
|
|
63
|
+
role: 'tab',
|
|
64
|
+
tabIndex: 0,
|
|
65
|
+
...props,
|
|
66
|
+
onClick
|
|
67
|
+
}),
|
|
68
|
+
icon: resolveShorthand(icon),
|
|
69
|
+
content: resolveShorthand(content, {
|
|
70
|
+
required: true,
|
|
71
|
+
defaultProps: {
|
|
72
|
+
children: props.children
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
appearance,
|
|
76
|
+
selected,
|
|
77
|
+
size,
|
|
78
|
+
value,
|
|
79
|
+
vertical
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=useTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,gBAAlD,EAAoE,aAApE,QAAyF,2BAAzF;AAEA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,kBAAT,QAAmC,kCAAnC;AAGA;;;;;;;;AAQG;AACH;;AACA,OAAO,MAAM,eAAe,GAAG,CAAC,KAAD,EAAkB,GAAlB,KAA2D;AACxF,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,IAAX;AAAiB,IAAA;AAAjB,MAA2B,KAAjC;AAEA,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,QAAd;AAAwB,IAAA,UAAxB;AAAoC,IAAA,YAApC;AAAkD,IAAA,QAAlD;AAA4D,IAAA,IAA5D;AAAkE,IAAA;AAAlE,MAA+E,kBAAkB,CACrG,cADqG,EAErG,GAAG,KAAK;AACN,IAAA,UAAU,EAAE,GAAG,CAAC,UADV;AAEN,IAAA,QAAQ,EAAE,GAAG,CAAC,aAAJ,KAAsB,KAF1B;AAGN,IAAA,UAAU,EAAE,GAAG,CAAC,UAHV;AAIN,IAAA,YAAY,EAAE,GAAG,CAAC,YAJZ;AAKN,IAAA,QAAQ,EAAE,GAAG,CAAC,QALR;AAMN,IAAA,IAAI,EAAE,GAAG,CAAC,IANJ;AAON,IAAA,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC;AAPV,GAAL,CAFkG,CAAvG;AAaA,QAAM,OAAO,GAAG,gBAAgB,CAAE,KAAD,IAA2B,QAAQ,CAAC,KAAD,EAAQ;AAAE,IAAA;AAAF,GAAR,CAApC,CAAhC;AAEA,QAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAA0B,IAA1B,CAAjB;AAEA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,IAAA,UAAU,CAAC;AACT,MAAA,KADS;AAET,MAAA,GAAG,EAAE;AAFI,KAAD,CAAV;AAKA,WAAO,MAAK;AACV,MAAA,YAAY,CAAC;AAAE,QAAA,KAAF;AAAS,QAAA,GAAG,EAAE;AAAd,OAAD,CAAZ;AACD,KAFD;AAGD,GATD,EASG,CAAC,UAAD,EAAa,YAAb,EAA2B,QAA3B,EAAqC,KAArC,CATH;AAWA,SAAO;AACL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,IAAI,EAAE,MAFI;AAGV,MAAA,OAAO,EAAE;AAHC,KADP;AAML,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;AACjC,MAAA,GAAG,EAAE,aAAa,CAAC,GAAD,EAAM,QAAN,CADe;AAEjC,MAAA,IAAI,EAAE,KAF2B;AAGjC,MAAA,QAAQ,EAAE,CAHuB;AAIjC,SAAG,KAJ8B;AAKjC,MAAA;AALiC,KAAR,CANtB;AAaL,IAAA,IAAI,EAAE,gBAAgB,CAAC,IAAD,CAbjB;AAcL,IAAA,OAAO,EAAE,gBAAgB,CAAC,OAAD,EAAU;AAAE,MAAA,QAAQ,EAAE,IAAZ;AAAkB,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE,KAAK,CAAC;AAAlB;AAAhC,KAAV,CAdpB;AAeL,IAAA,UAfK;AAgBL,IAAA,QAhBK;AAiBL,IAAA,IAjBK;AAkBL,IAAA,KAlBK;AAmBL,IAAA;AAnBK,GAAP;AAqBD,CApDM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { TabListContext } from '../TabList/TabListContext';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, icon, value } = props;\n\n const { appearance, selected, onRegister, onUnregister, onSelect, size, vertical } = useContextSelector(\n TabListContext,\n ctx => ({\n appearance: ctx.appearance,\n selected: ctx.selectedValue === value,\n onRegister: ctx.onRegister,\n onUnregister: ctx.onUnregister,\n onSelect: ctx.onSelect,\n size: ctx.size,\n vertical: !!ctx.vertical,\n }),\n );\n\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n return {\n components: {\n root: 'div',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n tabIndex: 0,\n ...props,\n onClick,\n }),\n icon: resolveShorthand(icon),\n content: resolveShorthand(content, { required: true, defaultProps: { children: props.children } }),\n appearance,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"sourceRoot":"../src/"}
|