@fluentui/react-tabs 1.0.0-beta.17 → 1.0.0-beta.173
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 +3135 -0
- package/CHANGELOG.md +1338 -1
- package/config/tests.js +0 -4
- package/dist/react-tabs.d.ts +68 -122
- package/etc/react-tabs.api.md +47 -64
- package/lib/{next/Tabs.d.ts → Tabs.d.ts} +0 -0
- package/lib/{next/Tabs.js → Tabs.js} +0 -0
- package/lib/Tabs.js.map +1 -0
- package/lib/common/isConformant.d.ts +4 -2
- package/lib/common/isConformant.js.map +1 -1
- package/{lib-commonjs/next → lib}/components/Tabs/TabItem.d.ts +1 -1
- package/lib/{next/components → components}/Tabs/TabItem.js +0 -0
- package/lib/components/Tabs/TabItem.js.map +1 -0
- package/{lib-commonjs/next → lib}/components/Tabs/TabItem.types.d.ts +3 -6
- package/lib/components/Tabs/TabItem.types.js +2 -0
- package/lib/components/Tabs/TabItem.types.js.map +1 -0
- package/{lib-amd/next → lib}/components/Tabs/Tabs.base.d.ts +1 -1
- package/lib/{next/components → components}/Tabs/Tabs.base.js +5 -5
- package/lib/components/Tabs/Tabs.base.js.map +1 -0
- package/{lib-commonjs/next → lib}/components/Tabs/Tabs.d.ts +1 -1
- package/lib/{next/components → components}/Tabs/Tabs.js +0 -0
- package/lib/components/Tabs/Tabs.js.map +1 -0
- package/lib/{next/components → components}/Tabs/Tabs.styles.d.ts +1 -1
- package/lib/{next/components → components}/Tabs/Tabs.styles.js +3 -8
- package/lib/components/Tabs/Tabs.styles.js.map +1 -0
- package/{lib-amd/next → lib}/components/Tabs/Tabs.types.d.ts +2 -16
- package/lib/components/Tabs/Tabs.types.js +2 -0
- package/lib/components/Tabs/Tabs.types.js.map +1 -0
- package/lib/{next/components → components}/Tabs/index.d.ts +0 -0
- package/lib/components/Tabs/index.js +6 -0
- package/lib/components/Tabs/index.js.map +1 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/utilities/observeResize.d.ts +1 -1
- package/lib/utilities/useOverflow.d.ts +1 -1
- package/lib/utilities/useOverflow.js +1 -0
- package/lib/utilities/useOverflow.js.map +1 -1
- package/lib-amd/{next/Tabs.d.ts → Tabs.d.ts} +0 -0
- package/lib-amd/{next/Tabs.js → Tabs.js} +0 -0
- package/lib-amd/Tabs.js.map +1 -0
- package/lib-amd/common/isConformant.d.ts +4 -2
- package/lib-amd/common/isConformant.js +1 -0
- package/lib-amd/common/isConformant.js.map +1 -1
- package/{lib/next → lib-amd}/components/Tabs/TabItem.d.ts +1 -1
- package/lib-amd/{next/components → components}/Tabs/TabItem.js +1 -0
- package/lib-amd/components/Tabs/TabItem.js.map +1 -0
- package/{lib/next → lib-amd}/components/Tabs/TabItem.types.d.ts +3 -6
- package/lib-amd/{next/components → components}/Tabs/TabItem.types.js +0 -0
- package/lib-amd/components/Tabs/TabItem.types.js.map +1 -0
- package/{lib/next → lib-amd}/components/Tabs/Tabs.base.d.ts +1 -1
- package/lib-amd/{next/components → components}/Tabs/Tabs.base.js +7 -6
- package/lib-amd/components/Tabs/Tabs.base.js.map +1 -0
- package/{lib/next → lib-amd}/components/Tabs/Tabs.d.ts +1 -1
- package/lib-amd/{next/components → components}/Tabs/Tabs.js +1 -0
- package/lib-amd/components/Tabs/Tabs.js.map +1 -0
- package/lib-amd/{next/components → components}/Tabs/Tabs.styles.d.ts +1 -1
- package/lib-amd/{next/components → components}/Tabs/Tabs.styles.js +4 -7
- package/lib-amd/components/Tabs/Tabs.styles.js.map +1 -0
- package/{lib/next → lib-amd}/components/Tabs/Tabs.types.d.ts +2 -16
- package/lib-amd/{next/components → components}/Tabs/Tabs.types.js +0 -0
- package/lib-amd/components/Tabs/Tabs.types.js.map +1 -0
- package/lib-amd/{next/components → components}/Tabs/index.d.ts +0 -0
- package/lib-amd/components/Tabs/index.js +11 -0
- package/lib-amd/components/Tabs/index.js.map +1 -0
- package/lib-amd/index.d.ts +1 -3
- package/lib-amd/index.js +2 -3
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/utilities/observeResize.d.ts +1 -1
- package/lib-amd/utilities/observeResize.js +3 -1
- package/lib-amd/utilities/observeResize.js.map +1 -1
- package/lib-amd/utilities/useOverflow.d.ts +1 -1
- package/lib-amd/utilities/useOverflow.js +4 -1
- package/lib-amd/utilities/useOverflow.js.map +1 -1
- package/lib-commonjs/{next/Tabs.d.ts → Tabs.d.ts} +0 -0
- package/lib-commonjs/{next/Tabs.js → Tabs.js} +0 -0
- package/lib-commonjs/Tabs.js.map +1 -0
- package/lib-commonjs/common/isConformant.d.ts +4 -2
- package/lib-commonjs/common/isConformant.js +1 -0
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/{lib-amd/next → lib-commonjs}/components/Tabs/TabItem.d.ts +1 -1
- package/lib-commonjs/{next/components → components}/Tabs/TabItem.js +1 -0
- package/lib-commonjs/components/Tabs/TabItem.js.map +1 -0
- package/{lib-amd/next → lib-commonjs}/components/Tabs/TabItem.types.d.ts +3 -6
- package/lib-commonjs/{next/components → components}/Tabs/TabItem.types.js +0 -0
- package/lib-commonjs/components/Tabs/TabItem.types.js.map +1 -0
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.base.d.ts +1 -1
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.base.js +9 -8
- package/lib-commonjs/components/Tabs/Tabs.base.js.map +1 -0
- package/{lib-amd/next → lib-commonjs}/components/Tabs/Tabs.d.ts +1 -1
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.js +1 -0
- package/lib-commonjs/components/Tabs/Tabs.js.map +1 -0
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.styles.d.ts +1 -1
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.styles.js +4 -7
- package/lib-commonjs/components/Tabs/Tabs.styles.js.map +1 -0
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.types.d.ts +2 -16
- package/lib-commonjs/{next/components → components}/Tabs/Tabs.types.js +0 -0
- package/lib-commonjs/components/Tabs/Tabs.types.js.map +1 -0
- package/lib-commonjs/{next/components → components}/Tabs/index.d.ts +0 -0
- package/lib-commonjs/components/Tabs/index.js +11 -0
- package/lib-commonjs/components/Tabs/index.js.map +1 -0
- package/lib-commonjs/index.d.ts +1 -3
- package/lib-commonjs/index.js +1 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/observeResize.d.ts +1 -1
- package/lib-commonjs/utilities/observeResize.js +3 -1
- package/lib-commonjs/utilities/observeResize.js.map +1 -1
- package/lib-commonjs/utilities/useOverflow.d.ts +1 -1
- package/lib-commonjs/utilities/useOverflow.js +4 -1
- package/lib-commonjs/utilities/useOverflow.js.map +1 -1
- package/package.json +24 -26
- package/src/{next/components → components}/Tabs/TabItem.types.ts +3 -6
- package/src/{next/components → components}/Tabs/Tabs.types.ts +2 -16
- package/lib/Pivot.d.ts +0 -1
- package/lib/Pivot.js +0 -2
- package/lib/Pivot.js.map +0 -1
- package/lib/components/Pivot/Pivot.base.d.ts +0 -3
- package/lib/components/Pivot/Pivot.base.js +0 -183
- package/lib/components/Pivot/Pivot.base.js.map +0 -1
- package/lib/components/Pivot/Pivot.d.ts +0 -8
- package/lib/components/Pivot/Pivot.js +0 -12
- package/lib/components/Pivot/Pivot.js.map +0 -1
- package/lib/components/Pivot/Pivot.styles.d.ts +0 -2
- package/lib/components/Pivot/Pivot.styles.js +0 -269
- package/lib/components/Pivot/Pivot.styles.js.map +0 -1
- package/lib/components/Pivot/Pivot.types.d.ts +0 -141
- package/lib/components/Pivot/Pivot.types.js +0 -31
- package/lib/components/Pivot/Pivot.types.js.map +0 -1
- package/lib/components/Pivot/PivotItem.d.ts +0 -6
- package/lib/components/Pivot/PivotItem.js +0 -21
- package/lib/components/Pivot/PivotItem.js.map +0 -1
- package/lib/components/Pivot/PivotItem.types.d.ts +0 -66
- package/lib/components/Pivot/PivotItem.types.js +0 -1
- package/lib/components/Pivot/PivotItem.types.js.map +0 -1
- package/lib/components/Pivot/index.d.ts +0 -5
- package/lib/components/Pivot/index.js +0 -5
- package/lib/components/Pivot/index.js.map +0 -1
- package/lib/next/Tabs.js.map +0 -1
- package/lib/next/components/Tabs/TabItem.js.map +0 -1
- package/lib/next/components/Tabs/TabItem.types.js +0 -1
- package/lib/next/components/Tabs/TabItem.types.js.map +0 -1
- package/lib/next/components/Tabs/Tabs.base.js.map +0 -1
- package/lib/next/components/Tabs/Tabs.js.map +0 -1
- package/lib/next/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib/next/components/Tabs/Tabs.types.js +0 -1
- package/lib/next/components/Tabs/Tabs.types.js.map +0 -1
- package/lib/next/components/Tabs/index.js +0 -4
- package/lib/next/components/Tabs/index.js.map +0 -1
- package/lib/next/index.d.ts +0 -2
- package/lib/next/index.js +0 -3
- package/lib/next/index.js.map +0 -1
- package/lib/next.d.ts +0 -1
- package/lib/next.js +0 -2
- package/lib/next.js.map +0 -1
- package/lib/version.d.ts +0 -1
- package/lib/version.js +0 -5
- package/lib/version.js.map +0 -1
- package/lib-amd/Pivot.d.ts +0 -1
- package/lib-amd/Pivot.js +0 -6
- package/lib-amd/Pivot.js.map +0 -1
- package/lib-amd/components/Pivot/Pivot.base.d.ts +0 -3
- package/lib-amd/components/Pivot/Pivot.base.js +0 -179
- package/lib-amd/components/Pivot/Pivot.base.js.map +0 -1
- package/lib-amd/components/Pivot/Pivot.d.ts +0 -8
- package/lib-amd/components/Pivot/Pivot.js +0 -13
- package/lib-amd/components/Pivot/Pivot.js.map +0 -1
- package/lib-amd/components/Pivot/Pivot.styles.d.ts +0 -2
- package/lib-amd/components/Pivot/Pivot.styles.js +0 -270
- package/lib-amd/components/Pivot/Pivot.styles.js.map +0 -1
- package/lib-amd/components/Pivot/Pivot.types.d.ts +0 -141
- package/lib-amd/components/Pivot/Pivot.types.js +0 -35
- package/lib-amd/components/Pivot/Pivot.types.js.map +0 -1
- package/lib-amd/components/Pivot/PivotItem.d.ts +0 -6
- package/lib-amd/components/Pivot/PivotItem.js +0 -22
- package/lib-amd/components/Pivot/PivotItem.js.map +0 -1
- package/lib-amd/components/Pivot/PivotItem.types.d.ts +0 -66
- package/lib-amd/components/Pivot/PivotItem.types.js +0 -5
- package/lib-amd/components/Pivot/PivotItem.types.js.map +0 -1
- package/lib-amd/components/Pivot/index.d.ts +0 -5
- package/lib-amd/components/Pivot/index.js +0 -9
- package/lib-amd/components/Pivot/index.js.map +0 -1
- package/lib-amd/next/Tabs.js.map +0 -1
- package/lib-amd/next/components/Tabs/TabItem.js.map +0 -1
- package/lib-amd/next/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-amd/next/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-amd/next/components/Tabs/Tabs.js.map +0 -1
- package/lib-amd/next/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-amd/next/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-amd/next/components/Tabs/index.js +0 -8
- package/lib-amd/next/components/Tabs/index.js.map +0 -1
- package/lib-amd/next/index.d.ts +0 -2
- package/lib-amd/next/index.js +0 -7
- package/lib-amd/next/index.js.map +0 -1
- package/lib-amd/next.d.ts +0 -1
- package/lib-amd/next.js +0 -6
- package/lib-amd/next.js.map +0 -1
- package/lib-amd/version.d.ts +0 -1
- package/lib-amd/version.js +0 -6
- package/lib-amd/version.js.map +0 -1
- package/lib-commonjs/Pivot.d.ts +0 -1
- package/lib-commonjs/Pivot.js +0 -5
- package/lib-commonjs/Pivot.js.map +0 -1
- package/lib-commonjs/components/Pivot/Pivot.base.d.ts +0 -3
- package/lib-commonjs/components/Pivot/Pivot.base.js +0 -185
- package/lib-commonjs/components/Pivot/Pivot.base.js.map +0 -1
- package/lib-commonjs/components/Pivot/Pivot.d.ts +0 -8
- package/lib-commonjs/components/Pivot/Pivot.js +0 -14
- package/lib-commonjs/components/Pivot/Pivot.js.map +0 -1
- package/lib-commonjs/components/Pivot/Pivot.styles.d.ts +0 -2
- package/lib-commonjs/components/Pivot/Pivot.styles.js +0 -271
- package/lib-commonjs/components/Pivot/Pivot.styles.js.map +0 -1
- package/lib-commonjs/components/Pivot/Pivot.types.d.ts +0 -141
- package/lib-commonjs/components/Pivot/Pivot.types.js +0 -33
- package/lib-commonjs/components/Pivot/Pivot.types.js.map +0 -1
- package/lib-commonjs/components/Pivot/PivotItem.d.ts +0 -6
- package/lib-commonjs/components/Pivot/PivotItem.js +0 -23
- package/lib-commonjs/components/Pivot/PivotItem.js.map +0 -1
- package/lib-commonjs/components/Pivot/PivotItem.types.d.ts +0 -66
- package/lib-commonjs/components/Pivot/PivotItem.types.js +0 -3
- package/lib-commonjs/components/Pivot/PivotItem.types.js.map +0 -1
- package/lib-commonjs/components/Pivot/index.d.ts +0 -5
- package/lib-commonjs/components/Pivot/index.js +0 -9
- package/lib-commonjs/components/Pivot/index.js.map +0 -1
- package/lib-commonjs/next/Tabs.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/TabItem.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/TabItem.types.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/Tabs.base.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/Tabs.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/Tabs.styles.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/Tabs.types.js.map +0 -1
- package/lib-commonjs/next/components/Tabs/index.js +0 -8
- package/lib-commonjs/next/components/Tabs/index.js.map +0 -1
- package/lib-commonjs/next/index.d.ts +0 -2
- package/lib-commonjs/next/index.js +0 -6
- package/lib-commonjs/next/index.js.map +0 -1
- package/lib-commonjs/next.d.ts +0 -1
- package/lib-commonjs/next.js +0 -5
- package/lib-commonjs/next.js.map +0 -1
- package/lib-commonjs/version.d.ts +0 -1
- package/lib-commonjs/version.js +0 -7
- package/lib-commonjs/version.js.map +0 -1
- package/src/components/Pivot/Pivot.types.ts +0 -166
- package/src/components/Pivot/PivotItem.types.ts +0 -76
package/config/tests.js
CHANGED
package/dist/react-tabs.d.ts
CHANGED
|
@@ -1,78 +1,70 @@
|
|
|
1
|
-
import { IButtonProps } from '@fluentui/react
|
|
2
|
-
import { IKeytipProps } from '@fluentui/react
|
|
3
|
-
import { IRefObject } from '@fluentui/utilities';
|
|
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';
|
|
8
|
-
import * as
|
|
1
|
+
import type { IButtonProps } from '@fluentui/react/lib/Button';
|
|
2
|
+
import type { IKeytipProps } from '@fluentui/react';
|
|
3
|
+
import type { IRefObject } from '@fluentui/utilities';
|
|
4
|
+
import type { IRenderFunction } from '@fluentui/utilities';
|
|
5
|
+
import type { IStyle } from '@fluentui/style-utilities';
|
|
6
|
+
import type { IStyleFunctionOrObject } from '@fluentui/utilities';
|
|
7
|
+
import type { ITheme } from '@fluentui/style-utilities';
|
|
8
|
+
import * as React_2 from 'react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Display mode for the tabs
|
|
12
12
|
*/
|
|
13
|
-
export declare
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export declare type TabFormatType = 'links' | 'tabs';
|
|
14
|
+
|
|
15
|
+
export declare class TabItem extends React_2.Component<TabItemProps, {}> {
|
|
16
|
+
constructor(props: TabItemProps);
|
|
17
|
+
render(): JSX.Element;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
* {@docCategory Pivot}
|
|
22
|
-
*/
|
|
23
|
-
export declare interface IPivotItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
export declare interface TabItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
24
21
|
/**
|
|
25
22
|
* Gets the component ref.
|
|
26
23
|
*/
|
|
27
24
|
componentRef?: IRefObject<{}>;
|
|
28
25
|
/**
|
|
29
|
-
* The text displayed of each
|
|
30
|
-
* @deprecated Use `headerText` instead.
|
|
31
|
-
*/
|
|
32
|
-
linkText?: string;
|
|
33
|
-
/**
|
|
34
|
-
* The text displayed of each pivot link.
|
|
26
|
+
* The text displayed of each tab.
|
|
35
27
|
*/
|
|
36
28
|
headerText?: string;
|
|
37
29
|
/**
|
|
38
30
|
* Props for the header command button. This provides a way to pass in native props, such as data-* and aria-*,
|
|
39
|
-
* for each
|
|
31
|
+
* for each tab element.
|
|
40
32
|
*/
|
|
41
33
|
headerButtonProps?: IButtonProps | {
|
|
42
34
|
[key: string]: string | number | boolean;
|
|
43
35
|
};
|
|
44
36
|
/**
|
|
45
|
-
* An required key to uniquely identify a
|
|
37
|
+
* An required key to uniquely identify a tab item.
|
|
46
38
|
*
|
|
47
39
|
* Note: The 'key' from react props cannot be used inside component.
|
|
48
40
|
*/
|
|
49
41
|
itemKey?: string;
|
|
50
42
|
/**
|
|
51
|
-
* The aria label of each
|
|
43
|
+
* The aria label of each tab which will read by screen reader instead of headerText.
|
|
52
44
|
*
|
|
53
45
|
* Note that unless you have compelling requirements you should not override aria-label.
|
|
54
46
|
*/
|
|
55
47
|
ariaLabel?: string;
|
|
56
48
|
/**
|
|
57
|
-
* Defines an optional item count displayed in parentheses just after the `
|
|
49
|
+
* Defines an optional item count displayed in parentheses just after the `headerText`.
|
|
58
50
|
*
|
|
59
51
|
* Examples: completed (4), Unread (99+)
|
|
60
52
|
*/
|
|
61
53
|
itemCount?: number | string;
|
|
62
54
|
/**
|
|
63
|
-
* An optional icon to show next to the
|
|
55
|
+
* An optional icon to show next to the tab.
|
|
64
56
|
*/
|
|
65
57
|
itemIcon?: string;
|
|
66
58
|
/**
|
|
67
|
-
* Optional custom renderer for the
|
|
59
|
+
* Optional custom renderer for the tab
|
|
68
60
|
*/
|
|
69
|
-
|
|
61
|
+
onRenderTab?: IRenderFunction<TabItemProps>;
|
|
70
62
|
/**
|
|
71
|
-
* Optional keytip for this
|
|
63
|
+
* Optional keytip for this TabItem
|
|
72
64
|
*/
|
|
73
65
|
keytipProps?: IKeytipProps;
|
|
74
66
|
/**
|
|
75
|
-
* Defines whether to always render the
|
|
67
|
+
* Defines whether to always render the tab item (regardless of whether it is selected or not).
|
|
76
68
|
* Useful if you're rendering content that is expensive to mount.
|
|
77
69
|
*
|
|
78
70
|
* @defaultvalue false
|
|
@@ -81,53 +73,71 @@ export declare interface IPivotItemProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
/**
|
|
84
|
-
*
|
|
76
|
+
* The Tabs control and related tabs pattern are used for navigating frequently accessed,
|
|
77
|
+
* distinct content categories. Tabs allow for navigation between two or more content
|
|
78
|
+
* views and relies on text headers to articulate the different sections of content.
|
|
79
|
+
*/
|
|
80
|
+
export declare const Tabs: React_2.FunctionComponent<TabsProps>;
|
|
81
|
+
|
|
82
|
+
export declare const TabsBase: React_2.FunctionComponent<TabsProps>;
|
|
83
|
+
|
|
84
|
+
export declare interface TabsImperativeHandle {
|
|
85
|
+
/**
|
|
86
|
+
* Sets focus to the first tab.
|
|
87
|
+
*/
|
|
88
|
+
focus(): void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Size of the tabs
|
|
85
93
|
*/
|
|
86
|
-
export declare
|
|
94
|
+
export declare type TabSizeType = 'normal' | 'large';
|
|
95
|
+
|
|
96
|
+
export declare interface TabsProps extends React_2.HTMLAttributes<HTMLDivElement>, React_2.RefAttributes<HTMLDivElement> {
|
|
87
97
|
/**
|
|
88
|
-
* Optional callback to access the
|
|
98
|
+
* Optional callback to access the TabsImperativeHandle interface. Use this instead of ref for accessing
|
|
89
99
|
* the public methods and properties of the component.
|
|
90
100
|
*/
|
|
91
|
-
componentRef?:
|
|
101
|
+
componentRef?: React_2.RefObject<TabsImperativeHandle>;
|
|
92
102
|
/**
|
|
93
103
|
* Call to provide customized styling that will layer on top of the variant rules.
|
|
94
104
|
*/
|
|
95
|
-
styles?: IStyleFunctionOrObject<
|
|
105
|
+
styles?: IStyleFunctionOrObject<TabsStyleProps, TabsStyles>;
|
|
96
106
|
/**
|
|
97
107
|
* Theme provided by High-Order Component.
|
|
98
108
|
*/
|
|
99
109
|
theme?: ITheme;
|
|
100
110
|
/**
|
|
101
|
-
* Additional css class to apply to the
|
|
111
|
+
* Additional css class to apply to the Tabs
|
|
102
112
|
* @defaultvalue undefined
|
|
103
113
|
*/
|
|
104
114
|
className?: string;
|
|
105
115
|
/**
|
|
106
|
-
* Default selected key
|
|
116
|
+
* Default selected TabItem key. Only provide this if the Tabs is an uncontrolled component;
|
|
107
117
|
* otherwise, use the `selectedKey` property.
|
|
108
118
|
*/
|
|
109
119
|
defaultSelectedKey?: string;
|
|
110
120
|
/**
|
|
111
|
-
* Key of the selected
|
|
112
|
-
* Only provide this if the
|
|
121
|
+
* Key of the selected tab item. Updating this will override the selected tab state.
|
|
122
|
+
* Only provide this if the Tabs is a controlled component where you are maintaining the
|
|
113
123
|
* current state; otherwise, use `defaultSelectedKey`.
|
|
114
124
|
*/
|
|
115
125
|
selectedKey?: string | null;
|
|
116
126
|
/**
|
|
117
|
-
* Callback for when the selected
|
|
127
|
+
* Callback for when the selected tab item is changed.
|
|
118
128
|
*/
|
|
119
|
-
|
|
129
|
+
onTabClick?: (item?: TabItem, ev?: React_2.MouseEvent<HTMLElement>) => void;
|
|
120
130
|
/**
|
|
121
|
-
*
|
|
131
|
+
* Tab size (normal, large)
|
|
122
132
|
*/
|
|
123
|
-
|
|
133
|
+
tabSize?: TabSizeType;
|
|
124
134
|
/**
|
|
125
|
-
*
|
|
135
|
+
* Tab format (links, tabs)
|
|
126
136
|
*/
|
|
127
|
-
|
|
137
|
+
tabFormat?: TabFormatType;
|
|
128
138
|
/**
|
|
129
|
-
* Overflow behavior when there is not enough room to display all of the
|
|
130
|
-
* * none:
|
|
139
|
+
* Overflow behavior when there is not enough room to display all of the tabs
|
|
140
|
+
* * none: Tabs will overflow the container and may not be visible
|
|
131
141
|
* * menu: Display an overflow menu that contains the tabs that don't fit
|
|
132
142
|
*
|
|
133
143
|
* @default none
|
|
@@ -146,89 +156,25 @@ export declare interface IPivotProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
146
156
|
getTabId?: (itemKey: string, index: number) => string;
|
|
147
157
|
}
|
|
148
158
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export declare type IPivotStyleProps = Required<Pick<IPivotProps, 'theme'>> & Pick<IPivotProps, 'className'> & {
|
|
153
|
-
linkSize?: PivotLinkSizeType;
|
|
154
|
-
linkFormat?: PivotLinkFormatType;
|
|
159
|
+
export declare type TabsStyleProps = Required<Pick<TabsProps, 'theme'>> & Pick<TabsProps, 'className'> & {
|
|
160
|
+
tabSize?: TabSizeType;
|
|
161
|
+
tabFormat?: TabFormatType;
|
|
155
162
|
};
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
* {@docCategory Pivot}
|
|
159
|
-
*/
|
|
160
|
-
export declare interface IPivotStyles {
|
|
164
|
+
export declare interface TabsStyles {
|
|
161
165
|
/**
|
|
162
166
|
* Style for the root element.
|
|
163
167
|
*/
|
|
164
168
|
root: IStyle;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
tab: IStyle;
|
|
170
|
+
tabIsSelected: IStyle;
|
|
171
|
+
tabContent: IStyle;
|
|
168
172
|
text: IStyle;
|
|
169
173
|
count: IStyle;
|
|
170
174
|
icon: IStyle;
|
|
171
|
-
|
|
175
|
+
tabInMenu: IStyle;
|
|
172
176
|
overflowMenuButton: IStyle;
|
|
173
177
|
itemContainer?: IStyle;
|
|
174
178
|
}
|
|
175
179
|
|
|
176
|
-
/**
|
|
177
|
-
* The Pivot control and related tabs pattern are used for navigating frequently accessed,
|
|
178
|
-
* distinct content categories. Pivots allow for navigation between two or more content
|
|
179
|
-
* views and relies on text headers to articulate the different sections of content.
|
|
180
|
-
*/
|
|
181
|
-
export declare const Pivot: React.FunctionComponent<IPivotProps>;
|
|
182
|
-
|
|
183
|
-
export declare const PivotBase: React.FunctionComponent<IPivotProps>;
|
|
184
|
-
|
|
185
|
-
export declare class PivotItem extends React.Component<IPivotItemProps, {}> {
|
|
186
|
-
constructor(props: IPivotItemProps);
|
|
187
|
-
render(): JSX.Element;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* {@docCategory Pivot}
|
|
192
|
-
* @deprecated Use strings 'links' or 'tabs' instead of this enum
|
|
193
|
-
*/
|
|
194
|
-
export declare const enum PivotLinkFormat {
|
|
195
|
-
/**
|
|
196
|
-
* Display Pivot Links as links
|
|
197
|
-
*/
|
|
198
|
-
links = "links",
|
|
199
|
-
/**
|
|
200
|
-
* Display Pivot Links as Tabs
|
|
201
|
-
*/
|
|
202
|
-
tabs = "tabs"
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* {@docCategory Pivot}
|
|
207
|
-
* Display mode for the pivot links/tabs
|
|
208
|
-
*/
|
|
209
|
-
export declare type PivotLinkFormatType = 'links' | 'tabs';
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* {@docCategory Pivot}
|
|
213
|
-
* @deprecated Use strings 'normal' or 'large' instead of this enum
|
|
214
|
-
*/
|
|
215
|
-
export declare const enum PivotLinkSize {
|
|
216
|
-
/**
|
|
217
|
-
* Display Link using normal font size
|
|
218
|
-
*/
|
|
219
|
-
normal = "normal",
|
|
220
|
-
/**
|
|
221
|
-
* Display links using large font size
|
|
222
|
-
*/
|
|
223
|
-
large = "large"
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* {@docCategory Pivot}
|
|
228
|
-
* Size of the pivot links/tabs
|
|
229
|
-
*/
|
|
230
|
-
export declare type PivotLinkSizeType = 'normal' | 'large';
|
|
231
|
-
|
|
232
|
-
export * from "@fluentui/react-theme-provider";
|
|
233
|
-
|
|
234
180
|
export { }
|
package/etc/react-tabs.api.md
CHANGED
|
@@ -4,22 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IButtonProps } from '@fluentui/react
|
|
8
|
-
import { IKeytipProps } from '@fluentui/react
|
|
9
|
-
import { IRefObject } from '@fluentui/utilities';
|
|
10
|
-
import { IRenderFunction } from '@fluentui/utilities';
|
|
11
|
-
import { IStyle } from '@fluentui/style-utilities';
|
|
12
|
-
import { IStyleFunctionOrObject } from '@fluentui/utilities';
|
|
13
|
-
import { ITheme } from '@fluentui/style-utilities';
|
|
14
|
-
import * as
|
|
7
|
+
import type { IButtonProps } from '@fluentui/react/lib/Button';
|
|
8
|
+
import type { IKeytipProps } from '@fluentui/react';
|
|
9
|
+
import type { IRefObject } from '@fluentui/utilities';
|
|
10
|
+
import type { IRenderFunction } from '@fluentui/utilities';
|
|
11
|
+
import type { IStyle } from '@fluentui/style-utilities';
|
|
12
|
+
import type { IStyleFunctionOrObject } from '@fluentui/utilities';
|
|
13
|
+
import type { ITheme } from '@fluentui/style-utilities';
|
|
14
|
+
import * as React_2 from 'react';
|
|
15
|
+
|
|
16
|
+
// @public
|
|
17
|
+
export type TabFormatType = 'links' | 'tabs';
|
|
15
18
|
|
|
16
19
|
// @public (undocumented)
|
|
17
|
-
export
|
|
18
|
-
|
|
20
|
+
export class TabItem extends React_2.Component<TabItemProps, {}> {
|
|
21
|
+
constructor(props: TabItemProps);
|
|
22
|
+
// (undocumented)
|
|
23
|
+
render(): JSX.Element;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
// @public (undocumented)
|
|
22
|
-
export interface
|
|
27
|
+
export interface TabItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
23
28
|
alwaysRender?: boolean;
|
|
24
29
|
ariaLabel?: string;
|
|
25
30
|
componentRef?: IRefObject<{}>;
|
|
@@ -31,35 +36,47 @@ export interface IPivotItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
36
|
itemIcon?: string;
|
|
32
37
|
itemKey?: string;
|
|
33
38
|
keytipProps?: IKeytipProps;
|
|
34
|
-
|
|
35
|
-
linkText?: string;
|
|
36
|
-
onRenderItemLink?: IRenderFunction<IPivotItemProps>;
|
|
39
|
+
onRenderTab?: IRenderFunction<TabItemProps>;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
// @public
|
|
43
|
+
export const Tabs: React_2.FunctionComponent<TabsProps>;
|
|
44
|
+
|
|
39
45
|
// @public (undocumented)
|
|
40
|
-
export
|
|
46
|
+
export const TabsBase: React_2.FunctionComponent<TabsProps>;
|
|
47
|
+
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
export interface TabsImperativeHandle {
|
|
50
|
+
focus(): void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// @public
|
|
54
|
+
export type TabSizeType = 'normal' | 'large';
|
|
55
|
+
|
|
56
|
+
// @public (undocumented)
|
|
57
|
+
export interface TabsProps extends React_2.HTMLAttributes<HTMLDivElement>, React_2.RefAttributes<HTMLDivElement> {
|
|
41
58
|
className?: string;
|
|
42
|
-
componentRef?:
|
|
59
|
+
componentRef?: React_2.RefObject<TabsImperativeHandle>;
|
|
43
60
|
defaultSelectedKey?: string;
|
|
44
61
|
getTabId?: (itemKey: string, index: number) => string;
|
|
45
62
|
headersOnly?: boolean;
|
|
46
|
-
|
|
47
|
-
linkSize?: PivotLinkSizeType;
|
|
48
|
-
onLinkClick?: (item?: PivotItem, ev?: React.MouseEvent<HTMLElement>) => void;
|
|
63
|
+
onTabClick?: (item?: TabItem, ev?: React_2.MouseEvent<HTMLElement>) => void;
|
|
49
64
|
overflowBehavior?: 'none' | 'menu';
|
|
50
65
|
selectedKey?: string | null;
|
|
51
|
-
styles?: IStyleFunctionOrObject<
|
|
66
|
+
styles?: IStyleFunctionOrObject<TabsStyleProps, TabsStyles>;
|
|
67
|
+
tabFormat?: TabFormatType;
|
|
68
|
+
tabSize?: TabSizeType;
|
|
52
69
|
theme?: ITheme;
|
|
53
70
|
}
|
|
54
71
|
|
|
55
72
|
// @public (undocumented)
|
|
56
|
-
export type
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
export type TabsStyleProps = Required<Pick<TabsProps, 'theme'>> & Pick<TabsProps, 'className'> & {
|
|
74
|
+
tabSize?: TabSizeType;
|
|
75
|
+
tabFormat?: TabFormatType;
|
|
59
76
|
};
|
|
60
77
|
|
|
61
78
|
// @public (undocumented)
|
|
62
|
-
export interface
|
|
79
|
+
export interface TabsStyles {
|
|
63
80
|
// (undocumented)
|
|
64
81
|
count: IStyle;
|
|
65
82
|
// (undocumented)
|
|
@@ -67,54 +84,20 @@ export interface IPivotStyles {
|
|
|
67
84
|
// (undocumented)
|
|
68
85
|
itemContainer?: IStyle;
|
|
69
86
|
// (undocumented)
|
|
70
|
-
|
|
87
|
+
overflowMenuButton: IStyle;
|
|
88
|
+
root: IStyle;
|
|
71
89
|
// (undocumented)
|
|
72
|
-
|
|
90
|
+
tab: IStyle;
|
|
73
91
|
// (undocumented)
|
|
74
|
-
|
|
92
|
+
tabContent: IStyle;
|
|
75
93
|
// (undocumented)
|
|
76
|
-
|
|
94
|
+
tabInMenu: IStyle;
|
|
77
95
|
// (undocumented)
|
|
78
|
-
|
|
79
|
-
root: IStyle;
|
|
96
|
+
tabIsSelected: IStyle;
|
|
80
97
|
// (undocumented)
|
|
81
98
|
text: IStyle;
|
|
82
99
|
}
|
|
83
100
|
|
|
84
|
-
// @public
|
|
85
|
-
export const Pivot: React.FunctionComponent<IPivotProps>;
|
|
86
|
-
|
|
87
|
-
// @public (undocumented)
|
|
88
|
-
export const PivotBase: React.FunctionComponent<IPivotProps>;
|
|
89
|
-
|
|
90
|
-
// @public (undocumented)
|
|
91
|
-
export class PivotItem extends React.Component<IPivotItemProps, {}> {
|
|
92
|
-
constructor(props: IPivotItemProps);
|
|
93
|
-
// (undocumented)
|
|
94
|
-
render(): JSX.Element;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// @public @deprecated (undocumented)
|
|
98
|
-
export const enum PivotLinkFormat {
|
|
99
|
-
links = "links",
|
|
100
|
-
tabs = "tabs"
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// @public
|
|
104
|
-
export type PivotLinkFormatType = 'links' | 'tabs';
|
|
105
|
-
|
|
106
|
-
// @public @deprecated (undocumented)
|
|
107
|
-
export const enum PivotLinkSize {
|
|
108
|
-
large = "large",
|
|
109
|
-
normal = "normal"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// @public
|
|
113
|
-
export type PivotLinkSizeType = 'normal' | 'large';
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
export * from "@fluentui/react-theme-provider";
|
|
117
|
-
|
|
118
101
|
// (No @packageDocumentation comment for this package)
|
|
119
102
|
|
|
120
103
|
```
|
|
File without changes
|
|
File without changes
|
package/lib/Tabs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"../src/","sources":["Tabs.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './components/Tabs/index';\n"]}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { IsConformantOptions } from '@fluentui/react-conformance';
|
|
2
|
-
export declare function isConformant(testInfo: Omit<IsConformantOptions
|
|
1
|
+
import type { IsConformantOptions } from '@fluentui/react-conformance';
|
|
2
|
+
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
|
3
|
+
componentPath?: string;
|
|
4
|
+
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,
|
|
1
|
+
{"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/E,MAAM,UAAU,YAAY,CAC1B,QAAyF;IAEzF,IAAM,cAAc,GAAyC;QAC3D,aAAa,EAAE,CAAC,cAAc,EAAE,uBAAuB,CAAC;QACxD,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;KAC7D,CAAC;IAEF,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import { isConformant as baseIsConformant } from '@fluentui/react-conformance';\nimport type { IsConformantOptions } from '@fluentui/react-conformance';\n\nexport function isConformant<TProps = {}>(\n testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },\n) {\n const defaultOptions: Partial<IsConformantOptions<TProps>> = {\n disabledTests: ['has-docblock', 'kebab-aria-attributes'],\n componentPath: module!.parent!.filename.replace('.test', ''),\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TabItemProps } from './TabItem.types';
|
|
2
|
+
import type { TabItemProps } from './TabItem.types';
|
|
3
3
|
export declare class TabItem extends React.Component<TabItemProps, {}> {
|
|
4
4
|
constructor(props: TabItemProps);
|
|
5
5
|
render(): JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabItem.js","sourceRoot":"../src/","sources":["components/Tabs/TabItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG5F,oCAAoC;AAEpC;IAA6B,2BAAiC;IAC5D,iBAAY,KAAmB;QAA/B,YACE,kBAAM,KAAK,CAAC,SAGb;QADC,sBAAsB,CAAC,KAAI,CAAC,CAAC;;IAC/B,CAAC;IAEM,wBAAM,GAAb;QACE,OAAO,wCAAS,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAO,CAAC;IACzF,CAAC;IACH,cAAC;AAAD,CAAC,AAVD,CAA6B,KAAK,CAAC,SAAS,GAU3C","sourcesContent":["import * as React from 'react';\nimport { getNativeProps, divProperties, initializeComponentRef } from '@fluentui/utilities';\nimport type { TabItemProps } from './TabItem.types';\n\n// const COMPONENT_NAME = 'TabItem';\n\nexport class TabItem extends React.Component<TabItemProps, {}> {\n constructor(props: TabItemProps) {\n super(props);\n\n initializeComponentRef(this);\n }\n\n public render(): JSX.Element {\n return <div {...getNativeProps(this.props, divProperties)}>{this.props.children}</div>;\n }\n}\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IKeytipProps } from '@fluentui/react
|
|
3
|
-
import { IButtonProps } from '@fluentui/react
|
|
4
|
-
import { IRefObject, IRenderFunction } from '@fluentui/utilities';
|
|
5
|
-
/**
|
|
6
|
-
* {@docCategory Tabs}
|
|
7
|
-
*/
|
|
2
|
+
import type { IKeytipProps } from '@fluentui/react';
|
|
3
|
+
import type { IButtonProps } from '@fluentui/react/lib/Button';
|
|
4
|
+
import type { IRefObject, IRenderFunction } from '@fluentui/utilities';
|
|
8
5
|
export interface TabItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
6
|
/**
|
|
10
7
|
* Gets the component ref.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabItem.types.js","sourceRoot":"../src/","sources":["components/Tabs/TabItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { IKeytipProps } from '@fluentui/react';\nimport type { IButtonProps } from '@fluentui/react/lib/Button';\nimport type { IRefObject, IRenderFunction } from '@fluentui/utilities';\n\nexport interface TabItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Gets the component ref.\n */\n componentRef?: IRefObject<{}>;\n\n /**\n * The text displayed of each tab.\n */\n headerText?: string;\n\n /**\n * Props for the header command button. This provides a way to pass in native props, such as data-* and aria-*,\n * for each tab element.\n */\n headerButtonProps?: IButtonProps | { [key: string]: string | number | boolean };\n\n /**\n * An required key to uniquely identify a tab item.\n *\n * Note: The 'key' from react props cannot be used inside component.\n */\n itemKey?: string;\n\n /**\n * The aria label of each tab which will read by screen reader instead of headerText.\n *\n * Note that unless you have compelling requirements you should not override aria-label.\n */\n ariaLabel?: string;\n\n /**\n * Defines an optional item count displayed in parentheses just after the `headerText`.\n *\n * Examples: completed (4), Unread (99+)\n */\n itemCount?: number | string;\n\n /**\n * An optional icon to show next to the tab.\n */\n itemIcon?: string;\n\n /**\n * Optional custom renderer for the tab\n */\n onRenderTab?: IRenderFunction<TabItemProps>;\n\n /**\n * Optional keytip for this TabItem\n */\n keytipProps?: IKeytipProps;\n\n /**\n * Defines whether to always render the tab item (regardless of whether it is selected or not).\n * Useful if you're rendering content that is expensive to mount.\n *\n * @defaultvalue false\n */\n alwaysRender?: boolean;\n}\n"]}
|
|
@@ -2,10 +2,10 @@ import { __assign, __rest } from "tslib";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useControllableValue, useId } from '@fluentui/react-hooks';
|
|
4
4
|
import { classNamesFunction, css, divProperties, getNativeProps, getRTL, KeyCodes, warn } from '@fluentui/utilities';
|
|
5
|
-
import { DirectionalHint, FocusZone, FocusZoneDirection, Icon
|
|
6
|
-
import { CommandButton } from '@fluentui/react
|
|
5
|
+
import { DirectionalHint, FocusZone, FocusZoneDirection, Icon } from '@fluentui/react';
|
|
6
|
+
import { CommandButton } from '@fluentui/react/lib/Button';
|
|
7
7
|
import { TabItem } from './index';
|
|
8
|
-
import { useOverflow } from '
|
|
8
|
+
import { useOverflow } from '../../utilities/useOverflow';
|
|
9
9
|
var getClassNames = classNamesFunction();
|
|
10
10
|
var COMPONENT_NAME = 'Tabs';
|
|
11
11
|
var getTabId = function (props, baseId, itemKey, index) {
|
|
@@ -89,13 +89,14 @@ export var TabsBase = React.forwardRef(function (props, ref) {
|
|
|
89
89
|
// eslint-disable-next-line react/jsx-no-bind
|
|
90
90
|
onClick: function (ev) { return onTabClick(itemKey, ev); },
|
|
91
91
|
// eslint-disable-next-line react/jsx-no-bind
|
|
92
|
-
onKeyDown: function (ev) { return onKeyDown(itemKey, ev); }, "aria-label": tab.ariaLabel, role:
|
|
92
|
+
onKeyDown: function (ev) { return onKeyDown(itemKey, ev); }, "aria-label": tab.ariaLabel, role: tab.role || 'tab', "aria-selected": isSelected, name: tab.headerText, keytipProps: tab.keytipProps, "data-content": contentString }), tabContent));
|
|
93
93
|
};
|
|
94
94
|
var onTabClick = function (itemKey, ev) {
|
|
95
95
|
ev.preventDefault();
|
|
96
96
|
updateSelectedItem(itemKey, ev);
|
|
97
97
|
};
|
|
98
98
|
var onKeyDown = function (itemKey, ev) {
|
|
99
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
99
100
|
if (ev.which === KeyCodes.enter) {
|
|
100
101
|
ev.preventDefault();
|
|
101
102
|
updateSelectedItem(itemKey);
|
|
@@ -145,7 +146,6 @@ export var TabsBase = React.forwardRef(function (props, ref) {
|
|
|
145
146
|
// The overflow menu starts empty and items[] is updated as the overflow items change
|
|
146
147
|
var overflowMenuProps = React.useMemo(function () { return ({
|
|
147
148
|
items: [],
|
|
148
|
-
doNotLayer: true,
|
|
149
149
|
alignTargetEdge: true,
|
|
150
150
|
directionalHint: DirectionalHint.bottomRightEdge,
|
|
151
151
|
}); }, []);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.base.js","sourceRoot":"../src/","sources":["components/Tabs/Tabs.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC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Aa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,GAChE,CACH,CACS;QACX,mBAAmB;YAClB,aAAa,CAAC,IAAI,CAAC,GAAG,CACpB,UAAA,GAAG;gBACD,OAAA,CAAC,GAAG,CAAC,YAAY,KAAK,IAAI,IAAI,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;oBAClE,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;YAD/D,CAC+D,CAClE,CACC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import * as React from 'react';\nimport { useControllableValue, useId } from '@fluentui/react-hooks';\nimport { classNamesFunction, css, divProperties, getNativeProps, getRTL, KeyCodes, warn } from '@fluentui/utilities';\nimport { DirectionalHint, FocusZone, FocusZoneDirection, Icon } from '@fluentui/react';\nimport { CommandButton } from '@fluentui/react/lib/Button';\nimport { TabItem } from './index';\nimport { useOverflow } from '../../utilities/useOverflow';\nimport type { IContextualMenuProps, IFocusZone } from '@fluentui/react';\nimport type { IButton } from '@fluentui/react/lib/Button';\nimport type { TabsImperativeHandle, TabItemProps, TabsProps, TabsStyleProps, TabsStyles } from './index';\n\nconst getClassNames = classNamesFunction<TabsStyleProps, TabsStyles>();\n\nconst COMPONENT_NAME = 'Tabs';\n\ntype TabItemCollection = {\n tabs: TabItemProps[];\n keyToIndexMapping: { [key: string]: number };\n keyToTabIdMapping: { [key: string]: string };\n};\n\nconst getTabId = (props: TabsProps, baseId: string, itemKey: string, index: number): string => {\n if (props.getTabId) {\n return props.getTabId(itemKey, index);\n }\n return baseId + `-Tab${index}`;\n};\n\n// Gets the set of Tabs as array of TabItemProps\n// The set of Tabs is determined by child components of type TabItem\nconst getTabItems = (props: TabsProps, baseId: string): TabItemCollection => {\n const result: TabItemCollection = {\n tabs: [],\n keyToIndexMapping: {},\n keyToTabIdMapping: {},\n };\n\n React.Children.forEach(React.Children.toArray(props.children), (child: React.ReactNode, index: number) => {\n if (isTabItem(child)) {\n const { itemKey = index.toString(), ...tabItemProps } = child.props;\n result.tabs.push({\n ...tabItemProps,\n itemKey: itemKey,\n });\n result.keyToIndexMapping[itemKey] = index;\n result.keyToTabIdMapping[itemKey] = getTabId(props, baseId, itemKey, index);\n } else if (child) {\n warn('The children of a Tabs component must be of type TabItem to be rendered.');\n }\n });\n return result;\n};\n\nconst isTabItem = (item: React.ReactNode): item is TabItem => {\n return ((item as React.ReactElement)?.type as React.ComponentType)?.name === TabItem.name;\n};\n\nexport const TabsBase: React.FunctionComponent<TabsProps> = React.forwardRef<HTMLDivElement, TabsProps>(\n (props, ref) => {\n const focusZoneRef = React.useRef<IFocusZone>(null);\n const overflowMenuButtonComponentRef = React.useRef<IButton>(null);\n const baseId: string = useId('Tabs');\n\n const [selectedKey, setSelectedKey] = useControllableValue(props.selectedKey, props.defaultSelectedKey);\n\n const { componentRef, theme, tabSize, tabFormat, overflowBehavior } = props;\n\n let classNames: { [key in keyof TabsStyles]: string };\n const divProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, divProperties);\n\n let tabCollection = getTabItems(props, baseId);\n\n React.useImperativeHandle(componentRef as React.RefObject<TabsImperativeHandle>, () => ({\n focus: () => {\n focusZoneRef.current?.focus();\n },\n }));\n\n const renderTabContent = (tab?: TabItemProps): JSX.Element | null => {\n if (!tab) {\n return null;\n }\n\n const { itemCount, itemIcon, headerText } = tab;\n return (\n <span className={classNames.tabContent}>\n {itemIcon !== undefined && (\n <span className={classNames.icon}>\n <Icon iconName={itemIcon} />\n </span>\n )}\n {headerText !== undefined && <span className={classNames.text}> {tab.headerText}</span>}\n {itemCount !== undefined && <span className={classNames.count}> ({itemCount})</span>}\n </span>\n );\n };\n\n const renderTab = (\n renderTabCollection: TabItemCollection,\n tab: TabItemProps,\n renderTabSelectedKey: string | null | undefined,\n className: string,\n ): JSX.Element => {\n const { itemKey, headerButtonProps, onRenderTab } = tab;\n const tabId = renderTabCollection.keyToTabIdMapping[itemKey!];\n let tabContent: JSX.Element | null;\n const isSelected: boolean = renderTabSelectedKey === itemKey;\n\n if (onRenderTab) {\n tabContent = onRenderTab(tab, renderTabContent);\n } else {\n tabContent = renderTabContent(tab);\n }\n\n let contentString = tab.headerText || '';\n contentString += tab.itemCount ? ' (' + tab.itemCount + ')' : '';\n // Adding space supplementary for icon\n contentString += tab.itemIcon ? ' xx' : '';\n return (\n <CommandButton\n {...headerButtonProps}\n id={tabId}\n key={itemKey}\n className={css(className, isSelected && classNames.tabIsSelected)}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={(ev: React.MouseEvent<HTMLElement>) => onTabClick(itemKey!, ev)}\n // eslint-disable-next-line react/jsx-no-bind\n onKeyDown={(ev: React.KeyboardEvent<HTMLElement>) => onKeyDown(itemKey!, ev)}\n aria-label={tab.ariaLabel}\n role={tab.role || 'tab'}\n aria-selected={isSelected}\n name={tab.headerText}\n keytipProps={tab.keytipProps}\n data-content={contentString}\n >\n {tabContent}\n </CommandButton>\n );\n };\n\n const onTabClick = (itemKey: string, ev: React.MouseEvent<HTMLElement>): void => {\n ev.preventDefault();\n updateSelectedItem(itemKey, ev);\n };\n\n const onKeyDown = (itemKey: string, ev: React.KeyboardEvent<HTMLElement>): void => {\n // eslint-disable-next-line deprecation/deprecation\n if (ev.which === KeyCodes.enter) {\n ev.preventDefault();\n updateSelectedItem(itemKey);\n }\n };\n\n const updateSelectedItem = (itemKey: string, ev?: React.MouseEvent<HTMLElement>): void => {\n setSelectedKey(itemKey);\n tabCollection = getTabItems(props, baseId);\n if (props.onTabClick && tabCollection.keyToIndexMapping[itemKey] >= 0) {\n const selectedIndex = tabCollection.keyToIndexMapping[itemKey];\n const item = React.Children.toArray(props.children)[selectedIndex];\n if (isTabItem(item)) {\n props.onTabClick(item, ev);\n }\n }\n\n overflowMenuButtonComponentRef.current?.dismissMenu();\n };\n\n const renderTabItem = (itemKey: string | undefined, isActive: boolean): JSX.Element | null => {\n if (props.headersOnly || !itemKey) {\n return null;\n }\n\n const index = tabCollection.keyToIndexMapping[itemKey];\n const selectedTabId = tabCollection.keyToTabIdMapping[itemKey];\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n key={itemKey}\n aria-hidden={!isActive}\n aria-labelledby={selectedTabId}\n className={classNames.itemContainer}\n >\n {React.Children.toArray(props.children)[index]}\n </div>\n );\n };\n\n const isKeyValid = (itemKey: string | null | undefined): boolean => {\n return itemKey !== undefined && itemKey !== null && tabCollection.keyToIndexMapping[itemKey] !== undefined;\n };\n\n const getSelectedKey = () => {\n if (isKeyValid(selectedKey)) {\n return selectedKey;\n }\n if (tabCollection.tabs.length) {\n return tabCollection.tabs[0].itemKey;\n }\n return undefined;\n };\n\n classNames = getClassNames(props.styles!, {\n theme: theme!,\n tabSize,\n tabFormat,\n });\n\n const renderedSelectedKey = getSelectedKey();\n const renderedSelectedIndex = renderedSelectedKey ? tabCollection.keyToIndexMapping[renderedSelectedKey] : 0;\n\n const items = tabCollection.tabs.map(l => renderTab(tabCollection, l, renderedSelectedKey, classNames.tab));\n\n // The overflow menu starts empty and items[] is updated as the overflow items change\n const overflowMenuProps: IContextualMenuProps = React.useMemo(\n () => ({\n items: [],\n alignTargetEdge: true,\n directionalHint: DirectionalHint.bottomRightEdge,\n }),\n [],\n );\n\n const { menuButtonRef: overflowMenuButtonRef } = useOverflow({\n onOverflowItemsChanged: (overflowIndex, elements) => {\n // Set data-is-overflowing on each item\n elements.forEach(({ ele, isOverflowing }) => (ele.dataset.isOverflowing = `${isOverflowing}`));\n\n // Update the menu items\n overflowMenuProps.items = tabCollection.tabs.slice(overflowIndex).map((tab, index) => ({\n key: tab.itemKey || `${overflowIndex + index}`,\n onRender: () => renderTab(tabCollection, tab, renderedSelectedKey, classNames.tabInMenu),\n }));\n },\n rtl: getRTL(theme),\n pinnedIndex: renderedSelectedIndex,\n });\n\n return (\n <div role=\"toolbar\" {...divProps} ref={ref}>\n <FocusZone\n componentRef={focusZoneRef}\n direction={FocusZoneDirection.horizontal}\n className={classNames.root}\n role=\"tablist\"\n >\n {items}\n {overflowBehavior === 'menu' && (\n <CommandButton\n className={css(classNames.tab, classNames.overflowMenuButton)}\n elementRef={overflowMenuButtonRef}\n componentRef={overflowMenuButtonComponentRef}\n menuProps={overflowMenuProps}\n menuIconProps={{ iconName: 'More', style: { color: 'inherit' } }}\n />\n )}\n </FocusZone>\n {renderedSelectedKey &&\n tabCollection.tabs.map(\n tab =>\n (tab.alwaysRender === true || renderedSelectedKey === tab.itemKey) &&\n renderTabItem(tab.itemKey, renderedSelectedKey === tab.itemKey),\n )}\n </div>\n );\n },\n);\nTabsBase.displayName = COMPONENT_NAME;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TabsProps } from './Tabs.types';
|
|
2
|
+
import type { TabsProps } from './Tabs.types';
|
|
3
3
|
/**
|
|
4
4
|
* The Tabs control and related tabs pattern are used for navigating frequently accessed,
|
|
5
5
|
* distinct content categories. Tabs allow for navigation between two or more content
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"../src/","sources":["components/Tabs/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;GAIG;AACH,MAAM,CAAC,IAAM,IAAI,GAAuC,MAAM,CAC5D,QAAQ,EACR,SAAS,EACT,SAAS,EACT;IACE,KAAK,EAAE,MAAM;CACd,CACF,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '@fluentui/utilities';\nimport { TabsBase } from './Tabs.base';\nimport { getStyles } from './Tabs.styles';\nimport type { TabsProps, TabsStyleProps, TabsStyles } from './Tabs.types';\n\n/**\n * The Tabs control and related tabs pattern are used for navigating frequently accessed,\n * distinct content categories. Tabs allow for navigation between two or more content\n * views and relies on text headers to articulate the different sections of content.\n */\nexport const Tabs: React.FunctionComponent<TabsProps> = styled<TabsProps, TabsStyleProps, TabsStyles>(\n TabsBase,\n getStyles,\n undefined,\n {\n scope: 'Tabs',\n },\n);\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TabsStyleProps, TabsStyles } from './Tabs.types';
|
|
1
|
+
import type { TabsStyleProps, TabsStyles } from './Tabs.types';
|
|
2
2
|
export declare const getStyles: (props: TabsStyleProps) => TabsStyles;
|