@fluentui/react-tabs 1.0.0-beta.99 → 9.0.0-beta.12
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 +259 -1810
- package/CHANGELOG.md +74 -733
- package/README.md +0 -17
- package/Spec.md +433 -0
- package/dist/index.d.ts +243 -0
- 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 +81 -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 +403 -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/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 +94 -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/package.json +25 -21
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -14
- package/dist/react-tabs.d.ts +0 -197
- 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 -4
- 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 -4
- 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 -4
- 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/README.md
CHANGED
|
@@ -2,21 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
**React Tabs components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
|
|
4
4
|
|
|
5
|
-
The `Tabs` control (formerly `Pivot`) is used for navigating frequently accessed, distinct content categories. Tabs allow for navigation between two or more content views and relies on text headers to articulate the different sections of content.
|
|
6
|
-
|
|
7
5
|
These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
|
|
8
|
-
|
|
9
|
-
To import React Tabs components:
|
|
10
|
-
|
|
11
|
-
```jsx
|
|
12
|
-
import { Tabs, TabItem } from '@fluentui/react-tabs';
|
|
13
|
-
|
|
14
|
-
const App = () => {
|
|
15
|
-
return (
|
|
16
|
-
<Tabs>
|
|
17
|
-
<TabItem headerText="Hello">Hello</TabItem>
|
|
18
|
-
<TabItem headerText="World">World</TabItem>
|
|
19
|
-
</Tabs>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
```
|
package/Spec.md
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# @fluentui/react-tabs Spec
|
|
2
|
+
|
|
3
|
+
# Tabs
|
|
4
|
+
|
|
5
|
+
**GitHub Epic issue** - [Tabs/Pivot Convergence #20338](https://github.com/microsoft/fluentui/issues/20338)
|
|
6
|
+
**Figma** - [Tabs](https://www.figma.com/file/dK5AnDvvnSTWV9lduQWeDk/Tabs)
|
|
7
|
+
|
|
8
|
+
## Background
|
|
9
|
+
|
|
10
|
+
Tabs allow for navigation between two or more content views and relies on text headers to
|
|
11
|
+
articulate the different sections of content.
|
|
12
|
+
|
|
13
|
+
There are a few different components typically provided for tabs:
|
|
14
|
+
|
|
15
|
+
- Tab or tab header. This is the individual tab the user clicks to display content. It most often has text, an icon, or both.
|
|
16
|
+
- Tab list or tab strip. This is a container for tabs and provides single selection behavior.
|
|
17
|
+
- Tab panel. This is a container for the content to display when an associated tab is selected.
|
|
18
|
+
|
|
19
|
+
In some cases the tab list and tab panels are provided together in a "tabs" aggregate component. This is historically done to provide the manilla folder tab style where the tab list and tab panels are arranged next to each other.
|
|
20
|
+
|
|
21
|
+
## Prior Art - Open UI
|
|
22
|
+
|
|
23
|
+
Naming: The Open UI component naming matrix indicates Tabs is the most common and popular name for this component.
|
|
24
|
+
Only Fabric/Fluent UI v8 and earlier named it Pivot.
|
|
25
|
+
|
|
26
|
+
The [Tabs Research](https://open-ui.org/components/tabs.research) notes part naming and terminology are not
|
|
27
|
+
very consistent across libraries.
|
|
28
|
+
|
|
29
|
+
The API and implementations depend on how tabs are conceptualized and integrated with existing components.
|
|
30
|
+
For example, a set of tabs can be thought of as:
|
|
31
|
+
|
|
32
|
+
- a set styled buttons with radio selection behavior
|
|
33
|
+
- a menu list of menu items that toggle
|
|
34
|
+
- a command bar with radio buttons plus other commands and components
|
|
35
|
+
- a stack of components expected to render their state based on single/multi-select data.
|
|
36
|
+
|
|
37
|
+
Features common to most libraries:
|
|
38
|
+
|
|
39
|
+
- Grouping and consistent appearance across tabs within the same tab list
|
|
40
|
+
- Focus trap and keyboard commands for switching tabs
|
|
41
|
+
- Left/Right and Up/Down arrow keys when focus trapped
|
|
42
|
+
- Ctrl+Tab/Ctrl+Shift+Tab for cycling next/previous
|
|
43
|
+
- Text, an icon, or text with icon for tab content
|
|
44
|
+
- Horizontal or vertical layout
|
|
45
|
+
- LTR and RTL layout (i.e. ordering of tabs)
|
|
46
|
+
- Overflow or scrolling when tabs do not fit within available space
|
|
47
|
+
|
|
48
|
+
Features common to some libraries:
|
|
49
|
+
|
|
50
|
+
- Keyboard commands for individual tab focus navigation
|
|
51
|
+
- Tab/Shift+Tab to cycle focus through tabs
|
|
52
|
+
- Space bar to select currently focused tab
|
|
53
|
+
- Tab list containing both tabs and tab panels.
|
|
54
|
+
- Conditionally render or show/hide of tab panels based on current tab selection.
|
|
55
|
+
|
|
56
|
+
Advanced features supported by only a few libraries:
|
|
57
|
+
|
|
58
|
+
- Close/Hide individual tabs
|
|
59
|
+
- Tabs with drop-down content menus
|
|
60
|
+
- Reordering tabs, sometimes with drag-and-drop
|
|
61
|
+
- State indicators via badges
|
|
62
|
+
- Show or scroll to a specific tab (i.e. ensure visible and selected)
|
|
63
|
+
|
|
64
|
+
Given the ARIA standard roles of tablist and tab we can follow with TabList and Tab components.
|
|
65
|
+
|
|
66
|
+
## Prior Art - Comparison with v0 and v8
|
|
67
|
+
|
|
68
|
+
The existing components are:
|
|
69
|
+
|
|
70
|
+
- v0 - [Menu](https://fluentsite.z22.web.core.windows.net/0.59.0/components/menu/definition)
|
|
71
|
+
- v8 - [Pivot](https://developer.microsoft.com/en-us/fluentui#/controls/web/pivot)
|
|
72
|
+
|
|
73
|
+
### Approach
|
|
74
|
+
|
|
75
|
+
v0 Menu provides tabs, toolbars, menus, and breadcrumbs.
|
|
76
|
+
v0 Menu supports tabs interaction when accessibility={tabListBehavior}
|
|
77
|
+
|
|
78
|
+
v8 provides a separate Pivot component with tabs behavior and appearance customization.
|
|
79
|
+
|
|
80
|
+
### Appearances
|
|
81
|
+
|
|
82
|
+
#### **Pivot**
|
|
83
|
+
|
|
84
|
+
A 'Pivot' appears as a horizontal set of borderless buttons with an underline indicating current selection.
|
|
85
|
+
|
|
86
|
+
v0 and v8 provide a 'Pivot' appearance.
|
|
87
|
+
v0: underlined=true
|
|
88
|
+
v8: by default
|
|
89
|
+
|
|
90
|
+
#### **Block Tab**
|
|
91
|
+
|
|
92
|
+
A 'Block Tab' appears as a horizontal set of borderless buttons.
|
|
93
|
+
The selection has an active color, rectangular background.
|
|
94
|
+
|
|
95
|
+
Both v0 and v8 provide the 'Block Tab' appearance.
|
|
96
|
+
v0: by default
|
|
97
|
+
v8: linkFormat="tabs"
|
|
98
|
+
|
|
99
|
+
#### **Variations**
|
|
100
|
+
|
|
101
|
+
v0 supports decorating tabs with arrows pointing toward the associated content.
|
|
102
|
+
v0: pointing=true
|
|
103
|
+
|
|
104
|
+
v8 supports a large tab style with increased padding per tab.
|
|
105
|
+
v8: linkSize="large"
|
|
106
|
+
|
|
107
|
+
### Tab Item Content
|
|
108
|
+
|
|
109
|
+
Both v0 and v8 support text, icon, and text and icon as tab content.
|
|
110
|
+
v0 additionally supports menus as tab content.
|
|
111
|
+
|
|
112
|
+
Both v0 and v8 support custom rendering of tab content through a render props per item.
|
|
113
|
+
|
|
114
|
+
### Tab Panel
|
|
115
|
+
|
|
116
|
+
v0 does not provide a tab panel since it is implemented through the menu component.
|
|
117
|
+
v8 supports the tab panel as the children of PivotItem. The tab content is provided through the header property.
|
|
118
|
+
|
|
119
|
+
## Sample Code
|
|
120
|
+
|
|
121
|
+
### Default
|
|
122
|
+
|
|
123
|
+
By default tabs are arranged horizontally.
|
|
124
|
+
Content within the tab is arranged horizontally.
|
|
125
|
+
It is centered (horizontally and vertically).
|
|
126
|
+
The default appearance is transparent.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<TabList>
|
|
130
|
+
<Tab value="tab1">One</Tab>
|
|
131
|
+
<Tab value="tab2">Two</Tab>
|
|
132
|
+
<Tab value="tab3">Three</Tab>
|
|
133
|
+
</TabList>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Vertical
|
|
137
|
+
|
|
138
|
+
The vertical prop causes the tabs to be arranged vertically.
|
|
139
|
+
Content within the tab is still arranged horizontally and centered.
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<TabList vertical>
|
|
143
|
+
<Tab value="tab1">One</Tab>
|
|
144
|
+
<Tab value="tab2">Two</Tab>
|
|
145
|
+
<Tab value="tab3">Three</Tab>
|
|
146
|
+
</TabList>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Vertical Tab content
|
|
150
|
+
|
|
151
|
+
The verticalTabContent prop causes the content within the tab to be arranged vertically.
|
|
152
|
+
The content is still centered.
|
|
153
|
+
If the icon prop is set, the rendered icon is part of the vertical tab content.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<TabList verticalTabContent>
|
|
157
|
+
<Tab value="tab1">One</Tab>
|
|
158
|
+
<Tab value="tab2">Two</Tab>
|
|
159
|
+
<Tab value="tab3">Three</Tab>
|
|
160
|
+
</TabList>
|
|
161
|
+
|
|
162
|
+
<TabList vertical verticalTabContent>
|
|
163
|
+
<Tab value="tab1">One</Tab>
|
|
164
|
+
<Tab value="tab2">Two</Tab>
|
|
165
|
+
<Tab value="tab3">Three</Tab>
|
|
166
|
+
</TabList>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Appearance
|
|
170
|
+
|
|
171
|
+
The default appearance is transparent.
|
|
172
|
+
Transparent has no border and background styles.
|
|
173
|
+
The selection indicator is a brand color line below the tab.
|
|
174
|
+
Hovering over a tab shows a gray line below the tab.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<TabList>
|
|
178
|
+
{/* ... */}
|
|
179
|
+
</TabList>
|
|
180
|
+
|
|
181
|
+
<TabList appearance="transparent">
|
|
182
|
+
{/* ... */}
|
|
183
|
+
</TabList>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The subtle appearance is similar to transparent, but a light background is displayed when hovering over a tab.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
<TabList appearance="subtle">{/* ... */}</TabList>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Size
|
|
193
|
+
|
|
194
|
+
Small and medium sizes are supported.
|
|
195
|
+
The size affects the padding and spacing between elements.
|
|
196
|
+
Size can also affect the default icon (and badge) size.
|
|
197
|
+
The default size is medium.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
<TabList size="small">
|
|
201
|
+
{/* ... */}
|
|
202
|
+
</TabList>
|
|
203
|
+
|
|
204
|
+
<TabList size="medium">
|
|
205
|
+
{/* ... */}
|
|
206
|
+
</TabList>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### With Icon
|
|
210
|
+
|
|
211
|
+
When the icon slot is filled, an icon is positioned before the tab content.
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
<TabList>
|
|
215
|
+
<Tab icon={<CheckboxComposite />} value="allowed">
|
|
216
|
+
Allowed
|
|
217
|
+
</Tab>
|
|
218
|
+
<Tab icon={<BlockedSite />} value="blocked">
|
|
219
|
+
Blocked
|
|
220
|
+
</Tab>
|
|
221
|
+
</TabList>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
An icon only tab is displayed when the icon slot is filled and tab content is omitted.
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
<TabList>
|
|
228
|
+
<Tab icon={<CheckboxComposite />} value="allowed" />
|
|
229
|
+
<Tab icon={<BlockedSite />} value="blocked" />
|
|
230
|
+
</TabList>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## API
|
|
234
|
+
|
|
235
|
+
### Tab
|
|
236
|
+
|
|
237
|
+
TabCommons.value supports an arbitrary identifier value.
|
|
238
|
+
This is similar to Accordion's selection approach.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
export type TabValue = unknown;
|
|
242
|
+
|
|
243
|
+
export type TabCommons = {
|
|
244
|
+
disabled?: boolean;
|
|
245
|
+
disabledFocusable?: boolean;
|
|
246
|
+
value: TabValue;
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Each tab has an icon slot.
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
export type TabSlots = {
|
|
254
|
+
root: IntrinsicSlotProps<'div'>;
|
|
255
|
+
icon?: IntrinsicSlotProps<'span'>;
|
|
256
|
+
};
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
export type TabProps = ComponentProps<TabSlots> & TabCommons;
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### TabList
|
|
264
|
+
|
|
265
|
+
The tab list only has the root slot.
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
export type TabListSlots = {
|
|
269
|
+
root: IntrinsicSlotProps<'div'>;
|
|
270
|
+
};
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The tab list supports tab selection events that include the value of the tab selected.
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
export type TabSelectedEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;
|
|
277
|
+
|
|
278
|
+
export type TabSelectedData = {
|
|
279
|
+
value: TabValue;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export type TabSelectedEventHandler = (event: TabSelectedEvent, data: TabSelectedData) => void;
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Tab list supports default and selected values for controlled and uncontrolled scenarios.
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
export type TabListProps = ComponentProps<TabListSlots> & {
|
|
289
|
+
appearance?: 'transparent' | 'subtle';
|
|
290
|
+
defaultSelectedValue?: string | number;
|
|
291
|
+
selectedValue?: string | number;
|
|
292
|
+
size?: 'small' | 'medium';
|
|
293
|
+
vertical?: boolean;
|
|
294
|
+
verticalTabContent?: boolean;
|
|
295
|
+
onTabSelected?: TabSelectedEventHandler;
|
|
296
|
+
};
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The tab list communicates with tabs via context.
|
|
300
|
+
This applies appearance, size, and layout.
|
|
301
|
+
The tab can leverage the selectedValue and is expected to call selectTab when clicked.
|
|
302
|
+
|
|
303
|
+
By adding these properties to TabProps we could allow individual tabs to override these values.
|
|
304
|
+
However the expectation is that the tabs within a tab list have consistent layout and appearance.
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
export type TabListContextValue = TabListCommons & {
|
|
308
|
+
appearance: 'transparent' | 'subtle';
|
|
309
|
+
selectedValue: string;
|
|
310
|
+
size: 'small' | 'medium';
|
|
311
|
+
selectTab: SelectTabEventHandler;
|
|
312
|
+
vertical: boolean;
|
|
313
|
+
};
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Structure
|
|
317
|
+
|
|
318
|
+
- _**Public**_
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
<TabList>
|
|
322
|
+
<Tab>One</Tab>
|
|
323
|
+
<Tab>Two</Tab>
|
|
324
|
+
<Tab>Three</Tab>
|
|
325
|
+
</TabList>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
- _**DOM**_
|
|
329
|
+
|
|
330
|
+
```html
|
|
331
|
+
<div role="tablist">
|
|
332
|
+
<div role="tab">One</div>
|
|
333
|
+
<div role="tab">Two</div>
|
|
334
|
+
<div role="tab">Three</div>
|
|
335
|
+
</div>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Migration
|
|
339
|
+
|
|
340
|
+
### From v8
|
|
341
|
+
|
|
342
|
+
1. Replace occurrences of `<Pivot>` with `<TabList>`
|
|
343
|
+
2. Replace occurrences of `<PivotItem>` with `<Tab>`
|
|
344
|
+
3. Replace `<PivotItem>` content with handling onTabSelected to show/hide associated content.
|
|
345
|
+
4. Move PivotItem.headerText to be the content of Tab
|
|
346
|
+
5. Subscribe to onTabSelected to show/hide content when a tab is selected.
|
|
347
|
+
|
|
348
|
+
### From v0
|
|
349
|
+
|
|
350
|
+
1. Replace use of `<Menu>` with `<TabList>`
|
|
351
|
+
2. Replace items data with Tab instances, writing a `map` function as needed.
|
|
352
|
+
|
|
353
|
+
## Behaviors
|
|
354
|
+
|
|
355
|
+
### Selection
|
|
356
|
+
|
|
357
|
+
TabList provides single selection of a tab.
|
|
358
|
+
|
|
359
|
+
#### **Programmatic**
|
|
360
|
+
|
|
361
|
+
The TabList.selectedKey can control the currently selected tab.
|
|
362
|
+
The onTabSelected event informs callers of a selection change.
|
|
363
|
+
The event data includes the tab value.
|
|
364
|
+
|
|
365
|
+
#### **Mouse/Touch**
|
|
366
|
+
|
|
367
|
+
Clicking the tab selects it.
|
|
368
|
+
|
|
369
|
+
#### **Keyboard**
|
|
370
|
+
|
|
371
|
+
The tab list will support the prescribed [ARIA keyboard interaction](https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard-interaction-19).
|
|
372
|
+
|
|
373
|
+
A Tablist allows focus of individual tabs.
|
|
374
|
+
|
|
375
|
+
When the TabList has focus, the user can use arrow keys to move focus to the next or previous tab.
|
|
376
|
+
The keys are based on layout. Horizontal uses left/right arrows and vertical uses up/down arrows.
|
|
377
|
+
|
|
378
|
+
When the TabList has focus, the user can use the home/end keys to move focus to the first/last tab.
|
|
379
|
+
|
|
380
|
+
A tab is selected when the spacebar/enter key is pressed for a focused tab.
|
|
381
|
+
|
|
382
|
+
The `TAB` key moves focus out of the tabs.
|
|
383
|
+
|
|
384
|
+
## Accessibility
|
|
385
|
+
|
|
386
|
+
ARIA provides tab-specific roles:
|
|
387
|
+
|
|
388
|
+
- [tab](https://www.w3.org/TR/wai-aria-1.1/#tab): A grouping label providing a mechanism for selecting the tab content that is to be rendered to the user.
|
|
389
|
+
- [tablist](https://www.w3.org/TR/wai-aria-1.1/#tablist): A list of tab elements, which are references to tabpanel elements.
|
|
390
|
+
- [tabpanel](https://www.w3.org/TR/wai-aria-1.1/#tabpanel): A container for the resources associated with a tab, where each tab is contained in a tablist.
|
|
391
|
+
|
|
392
|
+
TabList and Tab will apply the `tablist` and `tab` ARIA roles.
|
|
393
|
+
The `tabpanel` will be reserved for possible future component.
|
|
394
|
+
|
|
395
|
+
### Screen readers
|
|
396
|
+
|
|
397
|
+
Screen readers will read each tab's content.
|
|
398
|
+
|
|
399
|
+
# Future
|
|
400
|
+
|
|
401
|
+
## Overflow Button/Dropdown
|
|
402
|
+
|
|
403
|
+
The design spec details a menu button (...) that displays the list of tabs that were not able to be displayed due to limited space. We have some concerns providing overflow as a default feature of tabs. The v1 of TabList and Tab will not include overflow.
|
|
404
|
+
|
|
405
|
+
- Overflow made the v0 toolbar difficult to maintain. Customers hacked around it when it did not meet app requirements.
|
|
406
|
+
- In v8, taking a dependency on menu over-complicated the button component and increased the default footprint. It also created a tighter binding with the overflow props matching the menu props and children.
|
|
407
|
+
- Overflow dropdown is one of many possible approaches such as scrolling, paging, multi-row, scroll-into-view. This may be best left as an application-level concern.
|
|
408
|
+
- The dropdown approach is called out by bootstrap as [problematic for usability and accessibility](https://react-bootstrap.github.io/components/tabs/#tabs-with-dropdown).
|
|
409
|
+
- Many (if not most) component libraries do not support dropdown overflow.
|
|
410
|
+
- There is not a general purpose overflow solution in vNext infrastructure. The team needs to explore options and formulate an approach.
|
|
411
|
+
|
|
412
|
+
### Tab with Badge
|
|
413
|
+
|
|
414
|
+
The design spec shows a badge which is arranged near the icon or text. The initial vNext package will not provide a badge variant or badge slot.
|
|
415
|
+
|
|
416
|
+
- It is unclear if the badge is a common enough scenario to warrant the package dependency on react-badge.
|
|
417
|
+
- The positioning of the badge relative to other parts is not confirmed in the design spec
|
|
418
|
+
- Other controls may want to overlay a badge. We may want a general purpose badge overlay solution.
|
|
419
|
+
- The badge appears most often in an app bar scenario. It is unclear if the items with badges are really tabs, or some other kind of command button. We may have a future app bar/nav bar/toolbar component that handles the badge scenario.
|
|
420
|
+
|
|
421
|
+
> The intial work to explore supporting a badge used a BadgeTab variant.
|
|
422
|
+
|
|
423
|
+
### TabPanel
|
|
424
|
+
|
|
425
|
+
While the design spec does not cover tab panels, v8 Pivot supports them through the content of the PivotItem. They are also a common scenario when the tabs are adjacent to the content associated with each tab.
|
|
426
|
+
|
|
427
|
+
- There are many approaches to handling tab panel content: show/hide, conditional render, navigation through a router
|
|
428
|
+
- We're not providing a manilla folder tab appearance, so there is no need for the tab panel to support styling for when the components are co-located. We may want to have a manilla folder appearance.
|
|
429
|
+
|
|
430
|
+
If/When we do support tab panels,
|
|
431
|
+
|
|
432
|
+
- we should provide flexible composition. The tabs should be able to be placed independent of the tab panels in the DOM. The caller should be able to wire the two together easily through event callbacks or state binding.
|
|
433
|
+
- we should make connecting tabs and tab panels easy by a Tabs container component that wires them together.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
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;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Render the final JSX of TabList
|
|
17
|
+
*/
|
|
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>;
|
|
28
|
+
|
|
29
|
+
export declare type SelectTabEventHandler = (event: SelectTabEvent, data: SelectTabData) => void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A tab provides a selectable item in a tab list.
|
|
33
|
+
*/
|
|
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 = {
|
|
41
|
+
/**
|
|
42
|
+
* A tab can be set to disable interaction.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The value that identifies this tab when selected.
|
|
48
|
+
*/
|
|
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 = {
|
|
62
|
+
/**
|
|
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'
|
|
68
|
+
*/
|
|
69
|
+
appearance?: 'transparent' | 'subtle';
|
|
70
|
+
/**
|
|
71
|
+
* A tab list can be set to disable interaction.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Raised when a tab is selected.
|
|
77
|
+
*/
|
|
78
|
+
onTabSelect?: SelectTabEventHandler;
|
|
79
|
+
/**
|
|
80
|
+
* The value of the currently selected tab.
|
|
81
|
+
*/
|
|
82
|
+
selectedValue?: TabValue;
|
|
83
|
+
/**
|
|
84
|
+
* A tab list can be either 'small' or 'medium' size.
|
|
85
|
+
* The size affects each of the contained tabs.
|
|
86
|
+
* @default 'medium'
|
|
87
|
+
*/
|
|
88
|
+
size?: 'small' | 'medium';
|
|
89
|
+
/**
|
|
90
|
+
* A tab list can arrange its tabs vertically.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
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;
|
|
101
|
+
/**
|
|
102
|
+
* A callback to allow a tab to select itself when pressed.
|
|
103
|
+
*/
|
|
104
|
+
onSelect: SelectTabEventHandler;
|
|
105
|
+
/**
|
|
106
|
+
* Gets the registered tab data along with current and previous selected values.
|
|
107
|
+
*/
|
|
108
|
+
getRegisteredTabs: () => {
|
|
109
|
+
selectedValue?: TabValue;
|
|
110
|
+
previousSelectedValue?: TabValue;
|
|
111
|
+
registeredTabs: Record<string, TabRegisterData>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Context values used in rendering TabList.
|
|
117
|
+
*/
|
|
118
|
+
export declare type TabListContextValues = {
|
|
119
|
+
/**
|
|
120
|
+
* The context of the tab list available to each tab.
|
|
121
|
+
*/
|
|
122
|
+
tabList: TabListContextValue;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* TabList Props
|
|
127
|
+
*/
|
|
128
|
+
export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons & {
|
|
129
|
+
/**
|
|
130
|
+
* The value of the tab to be selected by default.
|
|
131
|
+
* Typically useful when the selectedValue is uncontrolled.
|
|
132
|
+
*/
|
|
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
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* State used in rendering TabList.
|
|
145
|
+
*/
|
|
146
|
+
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Tab Props
|
|
150
|
+
*/
|
|
151
|
+
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
152
|
+
|
|
153
|
+
export declare type TabRegisterData = {
|
|
154
|
+
/**
|
|
155
|
+
* The value of the tab.
|
|
156
|
+
*/
|
|
157
|
+
value: TabValue;
|
|
158
|
+
/**
|
|
159
|
+
* The reference to the tab HTML element.
|
|
160
|
+
*/
|
|
161
|
+
ref: React_2.RefObject<HTMLElement>;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export declare type TabSlots = {
|
|
165
|
+
/**
|
|
166
|
+
* Root of the component.
|
|
167
|
+
*/
|
|
168
|
+
root: Slot<'button'>;
|
|
169
|
+
/**
|
|
170
|
+
* Icon that renders before the content.
|
|
171
|
+
*/
|
|
172
|
+
icon?: Slot<'span'>;
|
|
173
|
+
/**
|
|
174
|
+
* Component children are placed in this slot
|
|
175
|
+
* Avoid using the `children` property in this slot in favour of Component children whenever possible.
|
|
176
|
+
*/
|
|
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'>> & {
|
|
184
|
+
/**
|
|
185
|
+
* A tab supports 'transparent' and 'subtle' appearance.
|
|
186
|
+
*/
|
|
187
|
+
appearance?: 'transparent' | 'subtle';
|
|
188
|
+
/**
|
|
189
|
+
* A tab can have only an icon slot filled and no content.
|
|
190
|
+
*/
|
|
191
|
+
iconOnly: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* If this tab is selected
|
|
194
|
+
*/
|
|
195
|
+
selected: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* A tab can be either 'small' or 'medium' size.
|
|
198
|
+
*/
|
|
199
|
+
size: 'small' | 'medium';
|
|
200
|
+
/**
|
|
201
|
+
* A tab can arrange its content based on if the tabs in the list are arranged vertically.
|
|
202
|
+
*/
|
|
203
|
+
vertical: boolean;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Any value that identifies a specific tab.
|
|
208
|
+
*/
|
|
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;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Apply styling to the Tab slots based on the state
|
|
240
|
+
*/
|
|
241
|
+
export declare const useTabStyles_unstable: (state: TabState) => TabState;
|
|
242
|
+
|
|
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"]}
|