@fluentui/react-tabs 1.0.0-beta.97 → 9.0.0-beta.10
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 +181 -1762
- package/CHANGELOG.md +54 -718
- package/README.md +0 -17
- package/Spec.md +433 -0
- package/dist/react-tabs.d.ts +173 -127
- 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 +61 -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 +6 -0
- package/lib/components/Tab/index.js +7 -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 +17 -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 +78 -0
- package/lib/components/Tab/useTab.js.map +1 -0
- package/lib/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
- package/lib/components/Tab/useTabAnimatedIndicator.js +134 -0
- package/lib/components/Tab/useTabAnimatedIndicator.js.map +1 -0
- package/lib/components/Tab/useTabStyles.d.ts +8 -0
- package/lib/components/Tab/useTabStyles.js +402 -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 +104 -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 +23 -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 +18 -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 +81 -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 +28 -0
- package/lib/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib/components/TabList/useTabListStyles.d.ts +8 -0
- package/lib/components/TabList/useTabListStyles.js +45 -0
- package/lib/components/TabList/useTabListStyles.js.map +1 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/tab.constants.d.ts +62 -0
- package/lib/tab.constants.js +68 -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 +61 -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 +6 -0
- package/lib-commonjs/components/Tab/index.js +20 -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 +28 -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 +91 -0
- package/lib-commonjs/components/Tab/useTab.js.map +1 -0
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.d.ts +5 -0
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js +148 -0
- package/lib-commonjs/components/Tab/useTabAnimatedIndicator.js.map +1 -0
- package/lib-commonjs/components/Tab/useTabStyles.d.ts +8 -0
- package/lib-commonjs/components/Tab/useTabStyles.js +416 -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 +104 -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 +31 -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 +30 -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 +93 -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 +37 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
- package/lib-commonjs/components/TabList/useTabListStyles.d.ts +8 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js +55 -0
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -1
- package/lib-commonjs/index.js +83 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/tab.constants.d.ts +62 -0
- package/lib-commonjs/tab.constants.js +75 -0
- package/lib-commonjs/tab.constants.js.map +1 -0
- package/package.json +25 -21
- 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,243 @@
|
|
|
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
|
+
import { SlotClassNames } from '@fluentui/react-utilities';
|
|
7
|
+
|
|
8
|
+
export declare type RegisterTabEventHandler = (data: TabRegisterData) => void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Render the final JSX of Tab
|
|
12
|
+
*/
|
|
13
|
+
export declare const renderTab_unstable: (state: TabState) => JSX.Element;
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Display mode for the tabs
|
|
16
|
+
* Render the final JSX of TabList
|
|
13
17
|
*/
|
|
14
|
-
export declare
|
|
18
|
+
export declare const renderTabList_unstable: (state: TabListState, contextValues: TabListContextValues) => JSX.Element;
|
|
19
|
+
|
|
20
|
+
export declare type SelectTabData = {
|
|
21
|
+
/**
|
|
22
|
+
* The value of the selected tab.
|
|
23
|
+
*/
|
|
24
|
+
value: TabValue;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export declare type SelectTabEvent<E = HTMLElement> = React_2.MouseEvent<E> | React_2.KeyboardEvent<E>;
|
|
15
28
|
|
|
16
|
-
export declare
|
|
17
|
-
constructor(props: TabItemProps);
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
29
|
+
export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
|
|
20
30
|
|
|
21
31
|
/**
|
|
22
|
-
*
|
|
32
|
+
* A tab provides a selectable item in a tab list.
|
|
23
33
|
*/
|
|
24
|
-
export declare
|
|
34
|
+
export declare const Tab: ForwardRefComponent<TabProps>;
|
|
35
|
+
|
|
36
|
+
export declare const tabClassName: string;
|
|
37
|
+
|
|
38
|
+
export declare const tabClassNames: SlotClassNames<TabSlots>;
|
|
39
|
+
|
|
40
|
+
declare type TabCommons = {
|
|
25
41
|
/**
|
|
26
|
-
*
|
|
42
|
+
* A tab can be set to disable interaction.
|
|
43
|
+
* @default false
|
|
27
44
|
*/
|
|
28
|
-
|
|
45
|
+
disabled?: boolean;
|
|
29
46
|
/**
|
|
30
|
-
* The
|
|
47
|
+
* The value that identifies this tab when selected.
|
|
31
48
|
*/
|
|
32
|
-
|
|
49
|
+
value: TabValue;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A tab list provides single selection from a set of tabs.
|
|
54
|
+
*/
|
|
55
|
+
export declare const TabList: ForwardRefComponent<TabListProps>;
|
|
56
|
+
|
|
57
|
+
export declare const tabListClassName: string;
|
|
58
|
+
|
|
59
|
+
export declare const tabListClassNames: SlotClassNames<TabListSlots>;
|
|
60
|
+
|
|
61
|
+
declare type TabListCommons = {
|
|
33
62
|
/**
|
|
34
|
-
*
|
|
35
|
-
|
|
63
|
+
* A tab list can supports 'transparent' and 'subtle' appearance.
|
|
64
|
+
*- 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
|
65
|
+
*- 'transparent': No background and border styling
|
|
66
|
+
* The appearance affects each of the contained tabs.
|
|
67
|
+
* @default 'transparent'
|
|
36
68
|
*/
|
|
37
|
-
|
|
38
|
-
[key: string]: string | number | boolean;
|
|
39
|
-
};
|
|
69
|
+
appearance?: 'transparent' | 'subtle';
|
|
40
70
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* Note: The 'key' from react props cannot be used inside component.
|
|
71
|
+
* A tab list can be set to disable interaction.
|
|
72
|
+
* @default false
|
|
44
73
|
*/
|
|
45
|
-
|
|
74
|
+
disabled?: boolean;
|
|
46
75
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* Note that unless you have compelling requirements you should not override aria-label.
|
|
76
|
+
* Raised when a tab is selected.
|
|
50
77
|
*/
|
|
51
|
-
|
|
78
|
+
onTabSelect?: SelectTabEventHandler;
|
|
52
79
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Examples: completed (4), Unread (99+)
|
|
80
|
+
* The value of the currently selected tab.
|
|
56
81
|
*/
|
|
57
|
-
|
|
82
|
+
selectedValue?: TabValue;
|
|
58
83
|
/**
|
|
59
|
-
*
|
|
84
|
+
* A tab list can be either 'small' or 'medium' size.
|
|
85
|
+
* The size affects each of the contained tabs.
|
|
86
|
+
* @default 'medium'
|
|
60
87
|
*/
|
|
61
|
-
|
|
88
|
+
size?: 'small' | 'medium';
|
|
62
89
|
/**
|
|
63
|
-
*
|
|
90
|
+
* A tab list can arrange its tabs vertically.
|
|
91
|
+
* @default false
|
|
64
92
|
*/
|
|
65
|
-
|
|
93
|
+
vertical?: boolean;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'disabled' | 'size' | 'vertical'>> & {
|
|
97
|
+
/** A callback to allow a tab to register itself with the tab list. */
|
|
98
|
+
onRegister: RegisterTabEventHandler;
|
|
99
|
+
/** A callback to allow a tab to unregister itself with the tab list. */
|
|
100
|
+
onUnregister: RegisterTabEventHandler;
|
|
66
101
|
/**
|
|
67
|
-
*
|
|
102
|
+
* A callback to allow a tab to select itself when pressed.
|
|
68
103
|
*/
|
|
69
|
-
|
|
104
|
+
onSelect: SelectTabEventHandler;
|
|
70
105
|
/**
|
|
71
|
-
*
|
|
72
|
-
* Useful if you're rendering content that is expensive to mount.
|
|
73
|
-
*
|
|
74
|
-
* @defaultvalue false
|
|
106
|
+
* Gets the registered tab data along with current and previous selected values.
|
|
75
107
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
getRegisteredTabs: () => {
|
|
109
|
+
selectedValue?: TabValue;
|
|
110
|
+
previousSelectedValue?: TabValue;
|
|
111
|
+
registeredTabs: Record<string, TabRegisterData>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
78
114
|
|
|
79
115
|
/**
|
|
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.
|
|
116
|
+
* Context values used in rendering TabList.
|
|
83
117
|
*/
|
|
84
|
-
export declare
|
|
85
|
-
|
|
86
|
-
|
|
118
|
+
export declare type TabListContextValues = {
|
|
119
|
+
/**
|
|
120
|
+
* The context of the tab list available to each tab.
|
|
121
|
+
*/
|
|
122
|
+
tabList: TabListContextValue;
|
|
123
|
+
};
|
|
87
124
|
|
|
88
125
|
/**
|
|
89
|
-
*
|
|
126
|
+
* TabList Props
|
|
90
127
|
*/
|
|
91
|
-
export declare
|
|
128
|
+
export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
|
|
92
129
|
/**
|
|
93
|
-
*
|
|
130
|
+
* The value of the tab to be selected by default.
|
|
131
|
+
* Typically useful when the selectedValue is uncontrolled.
|
|
94
132
|
*/
|
|
95
|
-
|
|
96
|
-
}
|
|
133
|
+
defaultSelectedValue?: TabValue;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export declare type TabListSlots = {
|
|
137
|
+
/**
|
|
138
|
+
* The slot associated with the root element of this tab list.
|
|
139
|
+
*/
|
|
140
|
+
root: Slot<'div'>;
|
|
141
|
+
};
|
|
97
142
|
|
|
98
143
|
/**
|
|
99
|
-
*
|
|
100
|
-
* Size of the tabs
|
|
144
|
+
* State used in rendering TabList.
|
|
101
145
|
*/
|
|
102
|
-
export declare type
|
|
146
|
+
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;
|
|
103
147
|
|
|
104
148
|
/**
|
|
105
|
-
*
|
|
149
|
+
* Tab Props
|
|
106
150
|
*/
|
|
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>;
|
|
151
|
+
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
152
|
+
|
|
153
|
+
export declare type TabRegisterData = {
|
|
117
154
|
/**
|
|
118
|
-
*
|
|
155
|
+
* The value of the tab.
|
|
119
156
|
*/
|
|
120
|
-
|
|
157
|
+
value: TabValue;
|
|
121
158
|
/**
|
|
122
|
-
*
|
|
123
|
-
* @defaultvalue undefined
|
|
159
|
+
* The reference to the tab HTML element.
|
|
124
160
|
*/
|
|
125
|
-
|
|
161
|
+
ref: React_2.RefObject<HTMLElement>;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export declare type TabSlots = {
|
|
126
165
|
/**
|
|
127
|
-
*
|
|
128
|
-
* otherwise, use the `selectedKey` property.
|
|
166
|
+
* Root of the component.
|
|
129
167
|
*/
|
|
130
|
-
|
|
168
|
+
root: Slot<'button'>;
|
|
131
169
|
/**
|
|
132
|
-
*
|
|
133
|
-
* Only provide this if the Tabs is a controlled component where you are maintaining the
|
|
134
|
-
* current state; otherwise, use `defaultSelectedKey`.
|
|
170
|
+
* Icon that renders before the content.
|
|
135
171
|
*/
|
|
136
|
-
|
|
172
|
+
icon?: Slot<'span'>;
|
|
137
173
|
/**
|
|
138
|
-
*
|
|
174
|
+
* Component children are placed in this slot
|
|
175
|
+
* Avoid using the `children` property in this slot in favour of Component children whenever possible.
|
|
139
176
|
*/
|
|
140
|
-
|
|
177
|
+
content: NonNullable<Slot<'span'>>;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* State used in rendering Tab
|
|
182
|
+
*/
|
|
183
|
+
export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
|
|
141
184
|
/**
|
|
142
|
-
*
|
|
185
|
+
* A tab supports 'transparent' and 'subtle' appearance.
|
|
143
186
|
*/
|
|
144
|
-
|
|
187
|
+
appearance?: 'transparent' | 'subtle';
|
|
145
188
|
/**
|
|
146
|
-
*
|
|
189
|
+
* A tab can have only an icon slot filled and no content.
|
|
147
190
|
*/
|
|
148
|
-
|
|
191
|
+
iconOnly: boolean;
|
|
149
192
|
/**
|
|
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
|
|
193
|
+
* If this tab is selected
|
|
155
194
|
*/
|
|
156
|
-
|
|
195
|
+
selected: boolean;
|
|
157
196
|
/**
|
|
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.
|
|
197
|
+
* A tab can be either 'small' or 'medium' size.
|
|
161
198
|
*/
|
|
162
|
-
|
|
199
|
+
size: 'small' | 'medium';
|
|
163
200
|
/**
|
|
164
|
-
*
|
|
165
|
-
* Useful if you're rendering content outside and need to connect aria-labelledby.
|
|
201
|
+
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
|
|
166
202
|
*/
|
|
167
|
-
|
|
168
|
-
}
|
|
203
|
+
vertical: boolean;
|
|
204
|
+
};
|
|
169
205
|
|
|
170
206
|
/**
|
|
171
|
-
*
|
|
207
|
+
* Any value that identifies a specific tab.
|
|
172
208
|
*/
|
|
173
|
-
export declare type
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
209
|
+
export declare type TabValue = unknown;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Create the state required to render Tab.
|
|
213
|
+
*
|
|
214
|
+
* The returned state can be modified with hooks such as useTabStyles_unstable,
|
|
215
|
+
* before being passed to renderTab_unstable.
|
|
216
|
+
*
|
|
217
|
+
* @param props - props from this instance of Tab
|
|
218
|
+
* @param ref - reference to root HTMLElement of Tab
|
|
219
|
+
*/
|
|
220
|
+
export declare const useTab_unstable: (props: TabProps, ref: React_2.Ref<HTMLElement>) => TabState;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Create the state required to render TabList.
|
|
224
|
+
*
|
|
225
|
+
* The returned state can be modified with hooks such as useTabListStyles_unstable,
|
|
226
|
+
* before being passed to renderTabList_unstable.
|
|
227
|
+
*
|
|
228
|
+
* @param props - props from this instance of TabList
|
|
229
|
+
* @param ref - reference to root HTMLElement of TabList
|
|
230
|
+
*/
|
|
231
|
+
export declare const useTabList_unstable: (props: TabListProps, ref: React_2.Ref<HTMLElement>) => TabListState;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Apply styling to the TabList slots based on the state
|
|
235
|
+
*/
|
|
236
|
+
export declare const useTabListStyles_unstable: (state: TabListState) => TabListState;
|
|
177
237
|
|
|
178
238
|
/**
|
|
179
|
-
*
|
|
239
|
+
* Apply styling to the Tab slots based on the state
|
|
180
240
|
*/
|
|
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
|
-
}
|
|
241
|
+
export declare const useTabStyles_unstable: (state: TabState) => TabState;
|
|
196
242
|
|
|
197
243
|
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,61 @@
|
|
|
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<'button'>;
|
|
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
|
+
* A tab can be set to disable interaction.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The value that identifies this tab when selected.
|
|
29
|
+
*/
|
|
30
|
+
value: TabValue;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Tab Props
|
|
34
|
+
*/
|
|
35
|
+
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
36
|
+
/**
|
|
37
|
+
* State used in rendering Tab
|
|
38
|
+
*/
|
|
39
|
+
export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
|
|
40
|
+
/**
|
|
41
|
+
* A tab supports 'transparent' and 'subtle' appearance.
|
|
42
|
+
*/
|
|
43
|
+
appearance?: 'transparent' | 'subtle';
|
|
44
|
+
/**
|
|
45
|
+
* A tab can have only an icon slot filled and no content.
|
|
46
|
+
*/
|
|
47
|
+
iconOnly: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If this tab is selected
|
|
50
|
+
*/
|
|
51
|
+
selected: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A tab can be either 'small' or 'medium' size.
|
|
54
|
+
*/
|
|
55
|
+
size: 'small' | 'medium';
|
|
56
|
+
/**
|
|
57
|
+
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
|
|
58
|
+
*/
|
|
59
|
+
vertical: boolean;
|
|
60
|
+
};
|
|
61
|
+
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<'button'>;\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 * A tab can be set to disable interaction.\n * @default false\n */\n disabled?: boolean;\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 Omit<TabCommons, 'disabled'> &\n Required<Pick<TabCommons, 'disabled'>> & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: 'transparent' | 'subtle';\n /**\n * A tab can have only an icon slot filled and no content.\n */\n iconOnly: boolean;\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;AAC/B,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\nexport * from './useTabAnimatedIndicator';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of Tab
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const renderTab_unstable = state => {
|
|
8
|
+
const {
|
|
9
|
+
slots,
|
|
10
|
+
slotProps
|
|
11
|
+
} = getSlots(state);
|
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
13
|
+
}, slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
|
|
14
|
+
}), !state.iconOnly && /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
//# 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,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,EAEG,CAAC,KAAK,CAAC,QAAP,iBAAmB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAFtB,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 */\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 {!state.iconOnly && <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,78 @@
|
|
|
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
|
+
|
|
15
|
+
export const useTab_unstable = (props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
content,
|
|
18
|
+
disabled: tabDisabled = false,
|
|
19
|
+
icon,
|
|
20
|
+
value
|
|
21
|
+
} = props;
|
|
22
|
+
const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);
|
|
23
|
+
const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);
|
|
24
|
+
const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);
|
|
25
|
+
const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);
|
|
26
|
+
const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);
|
|
27
|
+
const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);
|
|
28
|
+
const size = useContextSelector(TabListContext, ctx => ctx.size);
|
|
29
|
+
const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);
|
|
30
|
+
const disabled = listDisabled || tabDisabled;
|
|
31
|
+
const innerRef = React.useRef(null);
|
|
32
|
+
const onClick = useEventCallback(event => onSelect(event, {
|
|
33
|
+
value
|
|
34
|
+
}));
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
onRegister({
|
|
37
|
+
value,
|
|
38
|
+
ref: innerRef
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
onUnregister({
|
|
42
|
+
value,
|
|
43
|
+
ref: innerRef
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}, [onRegister, onUnregister, innerRef, value]);
|
|
47
|
+
const iconShorthand = resolveShorthand(icon);
|
|
48
|
+
const contentShorthand = resolveShorthand(content, {
|
|
49
|
+
required: true,
|
|
50
|
+
defaultProps: {
|
|
51
|
+
children: props.children
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
components: {
|
|
56
|
+
root: 'button',
|
|
57
|
+
icon: 'span',
|
|
58
|
+
content: 'span'
|
|
59
|
+
},
|
|
60
|
+
root: getNativeElementProps('button', {
|
|
61
|
+
ref: useMergedRefs(ref, innerRef),
|
|
62
|
+
role: 'tab',
|
|
63
|
+
...props,
|
|
64
|
+
disabled,
|
|
65
|
+
onClick
|
|
66
|
+
}),
|
|
67
|
+
icon: iconShorthand,
|
|
68
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !contentShorthand.children),
|
|
69
|
+
content: contentShorthand,
|
|
70
|
+
appearance,
|
|
71
|
+
disabled,
|
|
72
|
+
selected,
|
|
73
|
+
size,
|
|
74
|
+
value,
|
|
75
|
+
vertical
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=useTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":"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","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 */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, value } = props;\n\n const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);\n const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);\n const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);\n const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);\n const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);\n const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);\n const size = useContextSelector(TabListContext, ctx => ctx.size);\n const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\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 const iconShorthand = resolveShorthand(icon);\n const contentShorthand = resolveShorthand(content, { required: true, defaultProps: { children: props.children } });\n return {\n components: {\n root: 'button',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('button', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n ...props,\n disabled,\n onClick,\n }),\n icon: iconShorthand,\n iconOnly: Boolean(iconShorthand?.children && !contentShorthand.children),\n content: contentShorthand,\n appearance,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"sourceRoot":"../src/"}
|