@fluentui/react-tabs 9.0.0-beta.6 → 9.0.0-beta.9
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 +180 -1
- package/CHANGELOG.md +49 -2
- package/dist/react-tabs.d.ts +48 -36
- package/lib/components/Tab/Tab.types.d.ts +14 -5
- package/lib/components/Tab/Tab.types.js.map +1 -1
- package/lib/components/Tab/index.d.ts +1 -0
- package/lib/components/Tab/index.js +1 -0
- package/lib/components/Tab/index.js.map +1 -1
- package/lib/components/Tab/renderTab.js +1 -2
- package/lib/components/Tab/renderTab.js.map +1 -1
- package/lib/components/Tab/useTab.js +25 -29
- package/lib/components/Tab/useTab.js.map +1 -1
- 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 +4 -2
- package/lib/components/Tab/useTabStyles.js +280 -84
- package/lib/components/Tab/useTabStyles.js.map +1 -1
- package/lib/components/TabList/TabList.types.d.ts +21 -16
- package/lib/components/TabList/TabList.types.js.map +1 -1
- package/lib/components/TabList/TabListContext.js +6 -0
- package/lib/components/TabList/TabListContext.js.map +1 -1
- package/lib/components/TabList/renderTabList.js +0 -1
- package/lib/components/TabList/renderTabList.js.map +1 -1
- package/lib/components/TabList/useTabList.js +26 -51
- package/lib/components/TabList/useTabList.js.map +1 -1
- package/lib/components/TabList/useTabListContextValues.js +4 -0
- package/lib/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib/components/TabList/useTabListStyles.d.ts +4 -5
- package/lib/components/TabList/useTabListStyles.js +8 -90
- package/lib/components/TabList/useTabListStyles.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/tab.constants.d.ts +59 -12
- package/lib/tab.constants.js +64 -13
- package/lib/tab.constants.js.map +1 -1
- package/lib-commonjs/components/Tab/Tab.types.d.ts +14 -5
- package/lib-commonjs/components/Tab/index.d.ts +1 -0
- package/lib-commonjs/components/Tab/index.js +2 -0
- package/lib-commonjs/components/Tab/index.js.map +1 -1
- package/lib-commonjs/components/Tab/renderTab.js +1 -2
- package/lib-commonjs/components/Tab/renderTab.js.map +1 -1
- package/lib-commonjs/components/Tab/useTab.js +25 -29
- package/lib-commonjs/components/Tab/useTab.js.map +1 -1
- 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 +4 -2
- package/lib-commonjs/components/Tab/useTabStyles.js +281 -84
- package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -1
- package/lib-commonjs/components/TabList/TabList.types.d.ts +21 -16
- package/lib-commonjs/components/TabList/TabListContext.js +6 -0
- package/lib-commonjs/components/TabList/TabListContext.js.map +1 -1
- package/lib-commonjs/components/TabList/renderTabList.js +0 -1
- package/lib-commonjs/components/TabList/renderTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabList.js +25 -50
- package/lib-commonjs/components/TabList/useTabList.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListContextValues.js +4 -0
- package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -1
- package/lib-commonjs/components/TabList/useTabListStyles.d.ts +4 -5
- package/lib-commonjs/components/TabList/useTabListStyles.js +7 -92
- package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +4 -2
- package/lib-commonjs/index.js +76 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/tab.constants.d.ts +59 -12
- package/lib-commonjs/tab.constants.js +66 -14
- package/lib-commonjs/tab.constants.js.map +1 -1
- package/package.json +16 -17
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,186 @@
|
|
|
2
2
|
"name": "@fluentui/react-tabs",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 19 Apr 2022 19:14:06 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tabs_v9.0.0-beta.9",
|
|
7
|
+
"version": "9.0.0-beta.9",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "gcox@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-tabs",
|
|
13
|
+
"commit": "b514b6072c080c6d3539cfc67c4a3e554d9bb775",
|
|
14
|
+
"comment": "Set disabled tab background to transparent"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "seanmonahan@microsoft.com",
|
|
18
|
+
"package": "@fluentui/react-tabs",
|
|
19
|
+
"commit": "086a675fd0c648944ff4048450190a0a13467de3",
|
|
20
|
+
"comment": "Add static classnames to Tabs"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "olfedias@microsoft.com",
|
|
24
|
+
"package": "@fluentui/react-tabs",
|
|
25
|
+
"commit": "e569d6e04d83cbcc6225e61db52ff81d2addd363",
|
|
26
|
+
"comment": "chore: Update Griffel to latest version"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
30
|
+
"package": "@fluentui/react-tabs",
|
|
31
|
+
"commit": "ad93ede78815d6767af5bf496ea6ad3ab6f47120",
|
|
32
|
+
"comment": "Removing star exports."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "martinhochel@microsoft.com",
|
|
36
|
+
"package": "@fluentui/react-tabs",
|
|
37
|
+
"commit": "8722596e561b57decfe9aa79121db844737102ff",
|
|
38
|
+
"comment": "fix missing dependencies and lint warnings"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "gcox@microsoft.com",
|
|
42
|
+
"package": "@fluentui/react-tabs",
|
|
43
|
+
"commit": "72fa867ab6b084656b53c8f644df74b31077ae15",
|
|
44
|
+
"comment": "Fix subtle style on tabs"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "gcox@microsoft.com",
|
|
48
|
+
"package": "@fluentui/react-tabs",
|
|
49
|
+
"commit": "374dca7b9d662f71a1f81297d7e4f4ea95615645",
|
|
50
|
+
"comment": "react-tabs fit and finish"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "gcox@microsoft.com",
|
|
54
|
+
"package": "@fluentui/react-tabs",
|
|
55
|
+
"commit": "69bcdf2f52fe6a8bf7d5f7ca71be74d753202356",
|
|
56
|
+
"comment": "Set subtle tab background to subtle background tokens"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "gcox@microsoft.com",
|
|
60
|
+
"package": "@fluentui/react-tabs",
|
|
61
|
+
"commit": "f098bb23b512e4084534238f2eca794a39a5c2e0",
|
|
62
|
+
"comment": "Updated to decrease gap of small vertical tab per figma change"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"author": "beachball",
|
|
66
|
+
"package": "@fluentui/react-tabs",
|
|
67
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.6",
|
|
68
|
+
"commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"author": "beachball",
|
|
72
|
+
"package": "@fluentui/react-tabs",
|
|
73
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.6",
|
|
74
|
+
"commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"author": "beachball",
|
|
78
|
+
"package": "@fluentui/react-tabs",
|
|
79
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.5",
|
|
80
|
+
"commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"author": "beachball",
|
|
84
|
+
"package": "@fluentui/react-tabs",
|
|
85
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
|
|
86
|
+
"commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"author": "beachball",
|
|
90
|
+
"package": "@fluentui/react-tabs",
|
|
91
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4",
|
|
92
|
+
"commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"none": [
|
|
96
|
+
{
|
|
97
|
+
"author": "elcraig@microsoft.com",
|
|
98
|
+
"package": "@fluentui/react-tabs",
|
|
99
|
+
"commit": "b7f17e976f9e058f39c9fce4f0f9bb6eb4dfa577",
|
|
100
|
+
"comment": "Update React dev deps and hoist them to the repo root"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"author": "mgodbolt@microsoft.com",
|
|
104
|
+
"package": "@fluentui/react-tabs",
|
|
105
|
+
"commit": "905e46db07ada986fd7885531f72a71b7bbaabdc",
|
|
106
|
+
"comment": "create v9 api extractor config and set all v9 packags to use it, suppress forgotten export"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"date": "Fri, 04 Mar 2022 05:17:30 GMT",
|
|
113
|
+
"tag": "@fluentui/react-tabs_v9.0.0-beta.8",
|
|
114
|
+
"version": "9.0.0-beta.8",
|
|
115
|
+
"comments": {
|
|
116
|
+
"prerelease": [
|
|
117
|
+
{
|
|
118
|
+
"author": "dzearing@microsoft.com",
|
|
119
|
+
"package": "@fluentui/react-tabs",
|
|
120
|
+
"commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
|
|
121
|
+
"comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"author": "beachball",
|
|
125
|
+
"package": "@fluentui/react-tabs",
|
|
126
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.5",
|
|
127
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"author": "beachball",
|
|
131
|
+
"package": "@fluentui/react-tabs",
|
|
132
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
|
|
133
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"author": "beachball",
|
|
137
|
+
"package": "@fluentui/react-tabs",
|
|
138
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
|
|
139
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"author": "beachball",
|
|
143
|
+
"package": "@fluentui/react-tabs",
|
|
144
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.5",
|
|
145
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"date": "Tue, 01 Mar 2022 02:17:39 GMT",
|
|
152
|
+
"tag": "@fluentui/react-tabs_v9.0.0-beta.7",
|
|
153
|
+
"version": "9.0.0-beta.7",
|
|
154
|
+
"comments": {
|
|
155
|
+
"prerelease": [
|
|
156
|
+
{
|
|
157
|
+
"author": "olfedias@microsoft.com",
|
|
158
|
+
"package": "@fluentui/react-tabs",
|
|
159
|
+
"commit": "084d7408855f3e52b67cbca172da1acef9dcb98f",
|
|
160
|
+
"comment": "fix: Add react-theme as dependency"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"author": "beachball",
|
|
164
|
+
"package": "@fluentui/react-tabs",
|
|
165
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.4",
|
|
166
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"author": "beachball",
|
|
170
|
+
"package": "@fluentui/react-tabs",
|
|
171
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
|
|
172
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"author": "beachball",
|
|
176
|
+
"package": "@fluentui/react-tabs",
|
|
177
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.4",
|
|
178
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"date": "Fri, 18 Feb 2022 13:35:35 GMT",
|
|
6
185
|
"tag": "@fluentui/react-tabs_v9.0.0-beta.6",
|
|
7
186
|
"version": "9.0.0-beta.6",
|
|
8
187
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,59 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tabs
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 19 Apr 2022 19:14:06 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.0.0-beta.9)
|
|
8
|
+
|
|
9
|
+
Tue, 19 Apr 2022 19:14:06 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.0.0-beta.8..@fluentui/react-tabs_v9.0.0-beta.9)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Set disabled tab background to transparent ([PR #22342](https://github.com/microsoft/fluentui/pull/22342) by gcox@microsoft.com)
|
|
15
|
+
- Add static classnames to Tabs ([PR #21960](https://github.com/microsoft/fluentui/pull/21960) by seanmonahan@microsoft.com)
|
|
16
|
+
- chore: Update Griffel to latest version ([PR #21976](https://github.com/microsoft/fluentui/pull/21976) by olfedias@microsoft.com)
|
|
17
|
+
- Removing star exports. ([PR #22151](https://github.com/microsoft/fluentui/pull/22151) by Humberto.Morimoto@microsoft.com)
|
|
18
|
+
- fix missing dependencies and lint warnings ([PR #21924](https://github.com/microsoft/fluentui/pull/21924) by martinhochel@microsoft.com)
|
|
19
|
+
- Fix subtle style on tabs ([PR #22439](https://github.com/microsoft/fluentui/pull/22439) by gcox@microsoft.com)
|
|
20
|
+
- react-tabs fit and finish ([PR #22225](https://github.com/microsoft/fluentui/pull/22225) by gcox@microsoft.com)
|
|
21
|
+
- Set subtle tab background to subtle background tokens ([PR #22346](https://github.com/microsoft/fluentui/pull/22346) by gcox@microsoft.com)
|
|
22
|
+
- Updated to decrease gap of small vertical tab per figma change ([PR #22335](https://github.com/microsoft/fluentui/pull/22335) by gcox@microsoft.com)
|
|
23
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
|
|
25
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.5 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
|
|
27
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
|
|
28
|
+
|
|
29
|
+
## [9.0.0-beta.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.0.0-beta.8)
|
|
30
|
+
|
|
31
|
+
Fri, 04 Mar 2022 05:17:30 GMT
|
|
32
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.0.0-beta.7..@fluentui/react-tabs_v9.0.0-beta.8)
|
|
33
|
+
|
|
34
|
+
### Changes
|
|
35
|
+
|
|
36
|
+
- Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
|
|
37
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
38
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
39
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
40
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
41
|
+
|
|
42
|
+
## [9.0.0-beta.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.0.0-beta.7)
|
|
43
|
+
|
|
44
|
+
Tue, 01 Mar 2022 02:17:39 GMT
|
|
45
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.0.0-beta.6..@fluentui/react-tabs_v9.0.0-beta.7)
|
|
46
|
+
|
|
47
|
+
### Changes
|
|
48
|
+
|
|
49
|
+
- fix: Add react-theme as dependency ([PR #21825](https://github.com/microsoft/fluentui/pull/21825) by olfedias@microsoft.com)
|
|
50
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
51
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
52
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
53
|
+
|
|
7
54
|
## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.0.0-beta.6)
|
|
8
55
|
|
|
9
|
-
Fri, 18 Feb 2022 13:
|
|
56
|
+
Fri, 18 Feb 2022 13:35:35 GMT
|
|
10
57
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.0.0-beta.4..@fluentui/react-tabs_v9.0.0-beta.6)
|
|
11
58
|
|
|
12
59
|
### Changes
|
package/dist/react-tabs.d.ts
CHANGED
|
@@ -3,20 +3,9 @@ import type { ComponentState } from '@fluentui/react-utilities';
|
|
|
3
3
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
4
4
|
import * as React_2 from 'react';
|
|
5
5
|
import type { Slot } from '@fluentui/react-utilities';
|
|
6
|
+
import { SlotClassNames } from '@fluentui/react-utilities';
|
|
6
7
|
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
export declare const indicatorOffsetVar = "--selection-indicator-offset";
|
|
10
|
-
|
|
11
|
-
export declare type RegisterTabData = {
|
|
12
|
-
/**
|
|
13
|
-
* The value of the selected tab.
|
|
14
|
-
*/
|
|
15
|
-
value: TabValue;
|
|
16
|
-
ref: React_2.RefObject<HTMLElement>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export declare type RegisterTabEventHandler = (data: RegisterTabData) => void;
|
|
8
|
+
export declare type RegisterTabEventHandler = (data: TabRegisterData) => void;
|
|
20
9
|
|
|
21
10
|
/**
|
|
22
11
|
* Render the final JSX of Tab
|
|
@@ -44,31 +33,30 @@ export declare type SelectTabEventHandler = (event: SelectTabEvent, data: Select
|
|
|
44
33
|
*/
|
|
45
34
|
export declare const Tab: ForwardRefComponent<TabProps>;
|
|
46
35
|
|
|
47
|
-
export declare const tabClassName
|
|
36
|
+
export declare const tabClassName: string;
|
|
37
|
+
|
|
38
|
+
export declare const tabClassNames: SlotClassNames<TabSlots>;
|
|
48
39
|
|
|
49
40
|
declare type TabCommons = {
|
|
41
|
+
/**
|
|
42
|
+
* A tab can be set to disable interaction.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
50
46
|
/**
|
|
51
47
|
* The value that identifies this tab when selected.
|
|
52
48
|
*/
|
|
53
49
|
value: TabValue;
|
|
54
50
|
};
|
|
55
51
|
|
|
56
|
-
/**
|
|
57
|
-
* A bounding rectangle of a tab
|
|
58
|
-
*/
|
|
59
|
-
export declare type TabContentRect = {
|
|
60
|
-
x: number;
|
|
61
|
-
y: number;
|
|
62
|
-
width: number;
|
|
63
|
-
height: number;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
52
|
/**
|
|
67
53
|
* A tab list provides single selection from a set of tabs.
|
|
68
54
|
*/
|
|
69
55
|
export declare const TabList: ForwardRefComponent<TabListProps>;
|
|
70
56
|
|
|
71
|
-
export declare const tabListClassName
|
|
57
|
+
export declare const tabListClassName: string;
|
|
58
|
+
|
|
59
|
+
export declare const tabListClassNames: SlotClassNames<TabListSlots>;
|
|
72
60
|
|
|
73
61
|
declare type TabListCommons = {
|
|
74
62
|
/**
|
|
@@ -79,6 +67,11 @@ declare type TabListCommons = {
|
|
|
79
67
|
* @default 'transparent'
|
|
80
68
|
*/
|
|
81
69
|
appearance?: 'transparent' | 'subtle';
|
|
70
|
+
/**
|
|
71
|
+
* A tab list can be set to disable interaction.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
disabled?: boolean;
|
|
82
75
|
/**
|
|
83
76
|
* Raised when a tab is selected.
|
|
84
77
|
*/
|
|
@@ -100,7 +93,7 @@ declare type TabListCommons = {
|
|
|
100
93
|
vertical?: boolean;
|
|
101
94
|
};
|
|
102
95
|
|
|
103
|
-
export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'size' | 'vertical'>> & {
|
|
96
|
+
export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | 'selectedValue'> & Required<Pick<TabListCommons, 'appearance' | 'disabled' | 'size' | 'vertical'>> & {
|
|
104
97
|
/** A callback to allow a tab to register itself with the tab list. */
|
|
105
98
|
onRegister: RegisterTabEventHandler;
|
|
106
99
|
/** A callback to allow a tab to unregister itself with the tab list. */
|
|
@@ -109,6 +102,14 @@ export declare type TabListContextValue = Pick<TabListCommons, 'onTabSelect' | '
|
|
|
109
102
|
* A callback to allow a tab to select itself when pressed.
|
|
110
103
|
*/
|
|
111
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
|
+
};
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
/**
|
|
@@ -132,8 +133,6 @@ export declare type TabListProps = ComponentProps<TabListSlots> & TabListCommons
|
|
|
132
133
|
defaultSelectedValue?: TabValue;
|
|
133
134
|
};
|
|
134
135
|
|
|
135
|
-
export declare const tabListSelectionIndicatorName = "fui-TabList_SelectionIndicator";
|
|
136
|
-
|
|
137
136
|
export declare type TabListSlots = {
|
|
138
137
|
/**
|
|
139
138
|
* The slot associated with the root element of this tab list.
|
|
@@ -144,20 +143,29 @@ export declare type TabListSlots = {
|
|
|
144
143
|
/**
|
|
145
144
|
* State used in rendering TabList.
|
|
146
145
|
*/
|
|
147
|
-
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue
|
|
148
|
-
selectedTabRect?: TabContentRect;
|
|
149
|
-
};
|
|
146
|
+
export declare type TabListState = ComponentState<Required<TabListSlots>> & TabListContextValue;
|
|
150
147
|
|
|
151
148
|
/**
|
|
152
149
|
* Tab Props
|
|
153
150
|
*/
|
|
154
151
|
export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
155
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
|
+
|
|
156
164
|
export declare type TabSlots = {
|
|
157
165
|
/**
|
|
158
166
|
* Root of the component.
|
|
159
167
|
*/
|
|
160
|
-
root: Slot<'
|
|
168
|
+
root: Slot<'button'>;
|
|
161
169
|
/**
|
|
162
170
|
* Icon that renders before the content.
|
|
163
171
|
*/
|
|
@@ -172,15 +180,19 @@ export declare type TabSlots = {
|
|
|
172
180
|
/**
|
|
173
181
|
* State used in rendering Tab
|
|
174
182
|
*/
|
|
175
|
-
export declare type TabState = ComponentState<TabSlots> & TabCommons & {
|
|
183
|
+
export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
|
|
176
184
|
/**
|
|
177
185
|
* A tab supports 'transparent' and 'subtle' appearance.
|
|
178
186
|
*/
|
|
179
|
-
appearance?:
|
|
187
|
+
appearance?: 'transparent' | 'subtle';
|
|
188
|
+
/**
|
|
189
|
+
* A tab can have only an icon slot filled and no content.
|
|
190
|
+
*/
|
|
191
|
+
iconOnly: boolean;
|
|
180
192
|
/**
|
|
181
|
-
* If this tab is selected
|
|
193
|
+
* If this tab is selected
|
|
182
194
|
*/
|
|
183
|
-
selected
|
|
195
|
+
selected: boolean;
|
|
184
196
|
/**
|
|
185
197
|
* A tab can be either 'small' or 'medium' size.
|
|
186
198
|
*/
|
|
@@ -7,7 +7,7 @@ export declare type TabSlots = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Root of the component.
|
|
9
9
|
*/
|
|
10
|
-
root: Slot<'
|
|
10
|
+
root: Slot<'button'>;
|
|
11
11
|
/**
|
|
12
12
|
* Icon that renders before the content.
|
|
13
13
|
*/
|
|
@@ -19,6 +19,11 @@ export declare type TabSlots = {
|
|
|
19
19
|
content: NonNullable<Slot<'span'>>;
|
|
20
20
|
};
|
|
21
21
|
declare type TabCommons = {
|
|
22
|
+
/**
|
|
23
|
+
* A tab can be set to disable interaction.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
22
27
|
/**
|
|
23
28
|
* The value that identifies this tab when selected.
|
|
24
29
|
*/
|
|
@@ -31,15 +36,19 @@ export declare type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;
|
|
|
31
36
|
/**
|
|
32
37
|
* State used in rendering Tab
|
|
33
38
|
*/
|
|
34
|
-
export declare type TabState = ComponentState<TabSlots> & TabCommons & {
|
|
39
|
+
export declare type TabState = ComponentState<TabSlots> & Omit<TabCommons, 'disabled'> & Required<Pick<TabCommons, 'disabled'>> & {
|
|
35
40
|
/**
|
|
36
41
|
* A tab supports 'transparent' and 'subtle' appearance.
|
|
37
42
|
*/
|
|
38
|
-
appearance?:
|
|
43
|
+
appearance?: 'transparent' | 'subtle';
|
|
44
|
+
/**
|
|
45
|
+
* A tab can have only an icon slot filled and no content.
|
|
46
|
+
*/
|
|
47
|
+
iconOnly: boolean;
|
|
39
48
|
/**
|
|
40
|
-
* If this tab is selected
|
|
49
|
+
* If this tab is selected
|
|
41
50
|
*/
|
|
42
|
-
selected
|
|
51
|
+
selected: boolean;
|
|
43
52
|
/**
|
|
44
53
|
* A tab can be either 'small' or 'medium' size.
|
|
45
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.types.js","sourceRoot":"../src/","sources":["components/Tab/Tab.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Any value that identifies a specific tab.\n */\nexport type TabValue = unknown;\n\nexport type TabSlots = {\n /**\n * Root of the component.\n */\n root: Slot<'
|
|
1
|
+
{"version":3,"file":"Tab.types.js","sourceRoot":"../src/","sources":["components/Tab/Tab.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Any value that identifies a specific tab.\n */\nexport type TabValue = unknown;\n\nexport type TabSlots = {\n /**\n * Root of the component.\n */\n root: Slot<'button'>;\n\n /**\n * Icon that renders before the content.\n */\n icon?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible.\n */\n content: NonNullable<Slot<'span'>>;\n};\n\ntype TabCommons = {\n /**\n * A tab can be set to disable interaction.\n * @default false\n */\n disabled?: boolean;\n /**\n * The value that identifies this tab when selected.\n */\n value: TabValue;\n};\n\n/**\n * Tab Props\n */\nexport type TabProps = ComponentProps<Partial<TabSlots>> & TabCommons;\n\n/**\n * State used in rendering Tab\n */\nexport type TabState = ComponentState<TabSlots> &\n Omit<TabCommons, 'disabled'> &\n Required<Pick<TabCommons, 'disabled'>> & {\n /**\n * A tab supports 'transparent' and 'subtle' appearance.\n */\n appearance?: 'transparent' | 'subtle';\n /**\n * A tab can have only an icon slot filled and no content.\n */\n iconOnly: boolean;\n /**\n * If this tab is selected\n */\n selected: boolean;\n /**\n * A tab can be either 'small' or 'medium' size.\n */\n size: 'small' | 'medium';\n /**\n * A tab can arrange its content based on if the tabs in the list are arranged vertically.\n */\n vertical: boolean;\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Tab/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Tab/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './Tab';\nexport * from './Tab.types';\nexport * from './renderTab';\nexport * from './useTab';\nexport * from './useTabStyles';\nexport * from './useTabAnimatedIndicator';\n"]}
|
|
@@ -3,7 +3,6 @@ import { getSlots } from '@fluentui/react-utilities';
|
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of Tab
|
|
5
5
|
*/
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
6
|
|
|
8
7
|
export const renderTab_unstable = state => {
|
|
9
8
|
const {
|
|
@@ -12,7 +11,7 @@ export const renderTab_unstable = state => {
|
|
|
12
11
|
} = getSlots(state);
|
|
13
12
|
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
14
13
|
}, slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
|
|
15
|
-
}), /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
|
|
14
|
+
}), !state.iconOnly && /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
|
|
16
15
|
}));
|
|
17
16
|
};
|
|
18
17
|
//# sourceMappingURL=renderTab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Tab/renderTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG
|
|
1
|
+
{"version":3,"sources":["components/Tab/renderTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoB;AACpD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAW,KAAX,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADjB,EAEG,CAAC,KAAK,CAAC,QAAP,iBAAmB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAFtB,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TabState, TabSlots } from './Tab.types';\n\n/**\n * Render the final JSX of Tab\n */\nexport const renderTab_unstable = (state: TabState) => {\n const { slots, slotProps } = getSlots<TabSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {!state.iconOnly && <slots.content {...slotProps.content} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -11,35 +11,27 @@ import { useContextSelector } from '@fluentui/react-context-selector';
|
|
|
11
11
|
* @param props - props from this instance of Tab
|
|
12
12
|
* @param ref - reference to root HTMLElement of Tab
|
|
13
13
|
*/
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
14
|
|
|
16
15
|
export const useTab_unstable = (props, ref) => {
|
|
17
16
|
const {
|
|
18
17
|
content,
|
|
18
|
+
disabled: tabDisabled = false,
|
|
19
19
|
icon,
|
|
20
20
|
value
|
|
21
21
|
} = props;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
selected: ctx.selectedValue === value,
|
|
33
|
-
onRegister: ctx.onRegister,
|
|
34
|
-
onUnregister: ctx.onUnregister,
|
|
35
|
-
onSelect: ctx.onSelect,
|
|
36
|
-
size: ctx.size,
|
|
37
|
-
vertical: !!ctx.vertical
|
|
38
|
-
}));
|
|
22
|
+
const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);
|
|
23
|
+
const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);
|
|
24
|
+
const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);
|
|
25
|
+
const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);
|
|
26
|
+
const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);
|
|
27
|
+
const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);
|
|
28
|
+
const size = useContextSelector(TabListContext, ctx => ctx.size);
|
|
29
|
+
const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);
|
|
30
|
+
const disabled = listDisabled || tabDisabled;
|
|
31
|
+
const innerRef = React.useRef(null);
|
|
39
32
|
const onClick = useEventCallback(event => onSelect(event, {
|
|
40
33
|
value
|
|
41
34
|
}));
|
|
42
|
-
const innerRef = React.useRef(null);
|
|
43
35
|
React.useEffect(() => {
|
|
44
36
|
onRegister({
|
|
45
37
|
value,
|
|
@@ -52,27 +44,31 @@ export const useTab_unstable = (props, ref) => {
|
|
|
52
44
|
});
|
|
53
45
|
};
|
|
54
46
|
}, [onRegister, onUnregister, innerRef, value]);
|
|
47
|
+
const iconShorthand = resolveShorthand(icon);
|
|
48
|
+
const contentShorthand = resolveShorthand(content, {
|
|
49
|
+
required: true,
|
|
50
|
+
defaultProps: {
|
|
51
|
+
children: props.children
|
|
52
|
+
}
|
|
53
|
+
});
|
|
55
54
|
return {
|
|
56
55
|
components: {
|
|
57
|
-
root: '
|
|
56
|
+
root: 'button',
|
|
58
57
|
icon: 'span',
|
|
59
58
|
content: 'span'
|
|
60
59
|
},
|
|
61
|
-
root: getNativeElementProps('
|
|
60
|
+
root: getNativeElementProps('button', {
|
|
62
61
|
ref: useMergedRefs(ref, innerRef),
|
|
63
62
|
role: 'tab',
|
|
64
|
-
tabIndex: 0,
|
|
65
63
|
...props,
|
|
64
|
+
disabled,
|
|
66
65
|
onClick
|
|
67
66
|
}),
|
|
68
|
-
icon:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
defaultProps: {
|
|
72
|
-
children: props.children
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
67
|
+
icon: iconShorthand,
|
|
68
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !contentShorthand.children),
|
|
69
|
+
content: contentShorthand,
|
|
75
70
|
appearance,
|
|
71
|
+
disabled,
|
|
76
72
|
selected,
|
|
77
73
|
size,
|
|
78
74
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,gBAAlD,EAAoE,aAApE,QAAyF,2BAAzF;AAEA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,kBAAT,QAAmC,kCAAnC;AAGA;;;;;;;;AAQG
|
|
1
|
+
{"version":3,"sources":["components/Tab/useTab.ts"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TabProps, TabState } from './Tab.types';\nimport { TabListContext } from '../TabList/TabListContext';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport { SelectTabEvent } from '../TabList/TabList.types';\n\n/**\n * Create the state required to render Tab.\n *\n * The returned state can be modified with hooks such as useTabStyles_unstable,\n * before being passed to renderTab_unstable.\n *\n * @param props - props from this instance of Tab\n * @param ref - reference to root HTMLElement of Tab\n */\nexport const useTab_unstable = (props: TabProps, ref: React.Ref<HTMLElement>): TabState => {\n const { content, disabled: tabDisabled = false, icon, value } = props;\n\n const appearance = useContextSelector(TabListContext, ctx => ctx.appearance);\n const listDisabled = useContextSelector(TabListContext, ctx => ctx.disabled);\n const selected = useContextSelector(TabListContext, ctx => ctx.selectedValue === value);\n const onRegister = useContextSelector(TabListContext, ctx => ctx.onRegister);\n const onUnregister = useContextSelector(TabListContext, ctx => ctx.onUnregister);\n const onSelect = useContextSelector(TabListContext, ctx => ctx.onSelect);\n const size = useContextSelector(TabListContext, ctx => ctx.size);\n const vertical = useContextSelector(TabListContext, ctx => !!ctx.vertical);\n const disabled = listDisabled || tabDisabled;\n\n const innerRef = React.useRef<HTMLElement>(null);\n const onClick = useEventCallback((event: SelectTabEvent) => onSelect(event, { value }));\n\n React.useEffect(() => {\n onRegister({\n value,\n ref: innerRef,\n });\n\n return () => {\n onUnregister({ value, ref: innerRef });\n };\n }, [onRegister, onUnregister, innerRef, value]);\n\n const iconShorthand = resolveShorthand(icon);\n const contentShorthand = resolveShorthand(content, { required: true, defaultProps: { children: props.children } });\n return {\n components: {\n root: 'button',\n icon: 'span',\n content: 'span',\n },\n root: getNativeElementProps('button', {\n ref: useMergedRefs(ref, innerRef),\n role: 'tab',\n ...props,\n disabled,\n onClick,\n }),\n icon: iconShorthand,\n iconOnly: Boolean(iconShorthand?.children && !contentShorthand.children),\n content: contentShorthand,\n appearance,\n disabled,\n selected,\n size,\n value,\n vertical,\n };\n};\n"],"sourceRoot":"../src/"}
|