@fluentui/react-overflow 9.0.0-beta.9 → 9.0.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +293 -1
- package/CHANGELOG.md +77 -2
- package/README.md +1 -1
- package/dist/index.d.ts +2 -9
- package/lib/components/Overflow.js +4 -2
- package/lib/components/Overflow.js.map +1 -1
- package/lib/components/OverflowItem/OverflowItem.js.map +1 -1
- package/lib/components/OverflowItem/OverflowItem.types.js.map +1 -1
- package/lib/components/OverflowItem/index.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/overflowContext.js +7 -6
- package/lib/overflowContext.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/useIsOverflowGroupVisible.js.map +1 -1
- package/lib/useIsOverflowItemVisible.js.map +1 -1
- package/lib/useOverflowContainer.js +11 -2
- package/lib/useOverflowContainer.js.map +1 -1
- package/lib/useOverflowCount.js.map +1 -1
- package/lib/useOverflowItem.js.map +1 -1
- package/lib/useOverflowMenu.js +4 -16
- package/lib/useOverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Overflow.js +4 -2
- package/lib-commonjs/components/Overflow.js.map +1 -1
- package/lib-commonjs/components/OverflowItem/OverflowItem.js.map +1 -1
- package/lib-commonjs/components/OverflowItem/index.js.map +1 -1
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/overflowContext.js +7 -6
- package/lib-commonjs/overflowContext.js.map +1 -1
- package/lib-commonjs/useIsOverflowGroupVisible.js.map +1 -1
- package/lib-commonjs/useIsOverflowItemVisible.js.map +1 -1
- package/lib-commonjs/useOverflowContainer.js +10 -1
- package/lib-commonjs/useOverflowContainer.js.map +1 -1
- package/lib-commonjs/useOverflowCount.js.map +1 -1
- package/lib-commonjs/useOverflowItem.js.map +1 -1
- package/lib-commonjs/useOverflowMenu.js +4 -17
- package/lib-commonjs/useOverflowMenu.js.map +1 -1
- package/package.json +24 -15
- package/dist/tsdoc-metadata.json +0 -11
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,299 @@
|
|
2
2
|
"name": "@fluentui/react-overflow",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Thu, 17 Nov 2022 23:02:39 GMT",
|
6
|
+
"tag": "@fluentui/react-overflow_v9.0.0-rc.1",
|
7
|
+
"version": "9.0.0-rc.1",
|
8
|
+
"comments": {
|
9
|
+
"none": [
|
10
|
+
{
|
11
|
+
"author": "martinhochel@microsoft.com",
|
12
|
+
"package": "@fluentui/react-overflow",
|
13
|
+
"commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
|
14
|
+
"comment": "chore: update package scaffold"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"prerelease": [
|
18
|
+
{
|
19
|
+
"author": "lingfangao@hotmail.com",
|
20
|
+
"package": "@fluentui/react-overflow",
|
21
|
+
"commit": "80075557d5f685b21d145de3b538af5e80534feb",
|
22
|
+
"comment": "feat: Bump to RC"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"author": "beachball",
|
26
|
+
"package": "@fluentui/react-overflow",
|
27
|
+
"comment": "Bump @fluentui/priority-overflow to v9.0.0-rc.1",
|
28
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"author": "beachball",
|
32
|
+
"package": "@fluentui/react-overflow",
|
33
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.2",
|
34
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"author": "beachball",
|
38
|
+
"package": "@fluentui/react-overflow",
|
39
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.2",
|
40
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"date": "Fri, 11 Nov 2022 14:58:08 GMT",
|
47
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.14",
|
48
|
+
"version": "9.0.0-beta.14",
|
49
|
+
"comments": {
|
50
|
+
"none": [
|
51
|
+
{
|
52
|
+
"author": "tristan.watanabe@gmail.com",
|
53
|
+
"package": "@fluentui/react-overflow",
|
54
|
+
"commit": "43d8356d0ede055caedd64bc73a7658efe884616",
|
55
|
+
"comment": "chore: Migrate to new package structure."
|
56
|
+
}
|
57
|
+
],
|
58
|
+
"prerelease": [
|
59
|
+
{
|
60
|
+
"author": "martinhochel@microsoft.com",
|
61
|
+
"package": "@fluentui/react-overflow",
|
62
|
+
"commit": "b3907043bd8d7b650c55e8e7c3119b14f2606c38",
|
63
|
+
"comment": "fix: create valid export maps"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"author": "beachball",
|
67
|
+
"package": "@fluentui/react-overflow",
|
68
|
+
"comment": "Bump @fluentui/priority-overflow to v9.0.0-beta.4",
|
69
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"author": "beachball",
|
73
|
+
"package": "@fluentui/react-overflow",
|
74
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.1",
|
75
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"author": "beachball",
|
79
|
+
"package": "@fluentui/react-overflow",
|
80
|
+
"comment": "Bump @fluentui/react-theme to v9.1.2",
|
81
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"author": "beachball",
|
85
|
+
"package": "@fluentui/react-overflow",
|
86
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.1",
|
87
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
88
|
+
}
|
89
|
+
]
|
90
|
+
}
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"date": "Wed, 02 Nov 2022 11:57:55 GMT",
|
94
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.13",
|
95
|
+
"version": "9.0.0-beta.13",
|
96
|
+
"comments": {
|
97
|
+
"prerelease": [
|
98
|
+
{
|
99
|
+
"author": "olfedias@microsoft.com",
|
100
|
+
"package": "@fluentui/react-overflow",
|
101
|
+
"commit": "c619ba066f11a8654e95375314824ba6b81b003e",
|
102
|
+
"comment": "chore: Update Griffel to latest version"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"author": "beachball",
|
106
|
+
"package": "@fluentui/react-overflow",
|
107
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.0",
|
108
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"author": "beachball",
|
112
|
+
"package": "@fluentui/react-overflow",
|
113
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.0",
|
114
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"date": "Tue, 25 Oct 2022 00:35:33 GMT",
|
121
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.12",
|
122
|
+
"version": "9.0.0-beta.12",
|
123
|
+
"comments": {
|
124
|
+
"none": [
|
125
|
+
{
|
126
|
+
"author": "miroslav.stastny@microsoft.com",
|
127
|
+
"package": "@fluentui/react-overflow",
|
128
|
+
"commit": "6ced976a8d0e6a0e2e207da8fe0eb810e2bd19bc",
|
129
|
+
"comment": "Update package readme"
|
130
|
+
}
|
131
|
+
]
|
132
|
+
}
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"date": "Thu, 20 Oct 2022 08:39:38 GMT",
|
136
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.12",
|
137
|
+
"version": "9.0.0-beta.12",
|
138
|
+
"comments": {
|
139
|
+
"prerelease": [
|
140
|
+
{
|
141
|
+
"author": "olfedias@microsoft.com",
|
142
|
+
"package": "@fluentui/react-overflow",
|
143
|
+
"commit": "06865dada128321804646582f564ee86d835d174",
|
144
|
+
"comment": "chore: Update Griffel to latest version"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"author": "mgodbolt@microsoft.com",
|
148
|
+
"package": "@fluentui/react-overflow",
|
149
|
+
"commit": "17096b3137d9d3e7c7443ddc3ce0738b2910a334",
|
150
|
+
"comment": "chore: Bump peer deps to support React 18"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"author": "beachball",
|
154
|
+
"package": "@fluentui/react-overflow",
|
155
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.5",
|
156
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"author": "beachball",
|
160
|
+
"package": "@fluentui/react-overflow",
|
161
|
+
"comment": "Bump @fluentui/react-theme to v9.1.1",
|
162
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"author": "beachball",
|
166
|
+
"package": "@fluentui/react-overflow",
|
167
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.2",
|
168
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
169
|
+
}
|
170
|
+
],
|
171
|
+
"none": [
|
172
|
+
{
|
173
|
+
"author": "lingfangao@hotmail.com",
|
174
|
+
"package": "@fluentui/react-overflow",
|
175
|
+
"commit": "099d9f0f3d9e033ebb3bb450f31cf3e5765ec8f0",
|
176
|
+
"comment": "Remove it.only from unit tests"
|
177
|
+
}
|
178
|
+
]
|
179
|
+
}
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"date": "Thu, 13 Oct 2022 11:02:54 GMT",
|
183
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.11",
|
184
|
+
"version": "9.0.0-beta.11",
|
185
|
+
"comments": {
|
186
|
+
"prerelease": [
|
187
|
+
{
|
188
|
+
"author": "lingfangao@hotmail.com",
|
189
|
+
"package": "@fluentui/react-overflow",
|
190
|
+
"commit": "6440417cb5db157acfb33d9f2c93de9bf7493791",
|
191
|
+
"comment": "fix: useOverflowMenu should register overflow menu"
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"author": "olfedias@microsoft.com",
|
195
|
+
"package": "@fluentui/react-overflow",
|
196
|
+
"commit": "1a527d440e0497ef8046b3ce240492241e7a04ac",
|
197
|
+
"comment": "chore: Update Griffel to latest version"
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"author": "beachball",
|
201
|
+
"package": "@fluentui/react-overflow",
|
202
|
+
"comment": "Bump @fluentui/priority-overflow to v9.0.0-beta.3",
|
203
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
204
|
+
},
|
205
|
+
{
|
206
|
+
"author": "beachball",
|
207
|
+
"package": "@fluentui/react-overflow",
|
208
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.4",
|
209
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"author": "beachball",
|
213
|
+
"package": "@fluentui/react-overflow",
|
214
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.1",
|
215
|
+
"commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
|
216
|
+
}
|
217
|
+
],
|
218
|
+
"none": [
|
219
|
+
{
|
220
|
+
"author": "lingfangao@hotmail.com",
|
221
|
+
"package": "@fluentui/react-overflow",
|
222
|
+
"commit": "d59683655d4d2a3775df4a2b41a09504cddd72ad",
|
223
|
+
"comment": "chore: Add browser e2e tests"
|
224
|
+
}
|
225
|
+
]
|
226
|
+
}
|
227
|
+
},
|
228
|
+
{
|
229
|
+
"date": "Mon, 03 Oct 2022 22:24:38 GMT",
|
230
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.10",
|
231
|
+
"version": "9.0.0-beta.10",
|
232
|
+
"comments": {
|
233
|
+
"none": [
|
234
|
+
{
|
235
|
+
"author": "bernardo.sunderhus@gmail.com",
|
236
|
+
"package": "@fluentui/react-overflow",
|
237
|
+
"commit": "fa59098280d8187ce9a62a568525694a56782e45",
|
238
|
+
"comment": "chore: update package scaffold"
|
239
|
+
}
|
240
|
+
]
|
241
|
+
}
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"date": "Thu, 15 Sep 2022 09:49:10 GMT",
|
245
|
+
"tag": "@fluentui/react-overflow_v9.0.0-beta.10",
|
246
|
+
"version": "9.0.0-beta.10",
|
247
|
+
"comments": {
|
248
|
+
"prerelease": [
|
249
|
+
{
|
250
|
+
"author": "lingfangao@hotmail.com",
|
251
|
+
"package": "@fluentui/react-overflow",
|
252
|
+
"commit": "a0cfab0e5f74e3a3bfa9c269fff574295042d7f2",
|
253
|
+
"comment": "chore: fix no-context-default-value lint violations"
|
254
|
+
},
|
255
|
+
{
|
256
|
+
"author": "olfedias@microsoft.com",
|
257
|
+
"package": "@fluentui/react-overflow",
|
258
|
+
"commit": "e610024474cfe5d45f61501a8b6a21daf4c794a2",
|
259
|
+
"comment": "chore: Update Griffel to latest version"
|
260
|
+
},
|
261
|
+
{
|
262
|
+
"author": "beachball",
|
263
|
+
"package": "@fluentui/react-overflow",
|
264
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.3",
|
265
|
+
"commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
|
266
|
+
},
|
267
|
+
{
|
268
|
+
"author": "beachball",
|
269
|
+
"package": "@fluentui/react-overflow",
|
270
|
+
"comment": "Bump @fluentui/react-theme to v9.1.0",
|
271
|
+
"commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"author": "beachball",
|
275
|
+
"package": "@fluentui/react-overflow",
|
276
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.0",
|
277
|
+
"commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
|
278
|
+
}
|
279
|
+
],
|
280
|
+
"none": [
|
281
|
+
{
|
282
|
+
"author": "martinhochel@microsoft.com",
|
283
|
+
"package": "@fluentui/react-overflow",
|
284
|
+
"commit": "e6cf183695d6d67a24e038c49a876224e5ed35e5",
|
285
|
+
"comment": "chore: update package scaffold"
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"author": "martinhochel@microsoft.com",
|
289
|
+
"package": "@fluentui/react-overflow",
|
290
|
+
"commit": "16aa65dcae8f75c6a221225fd0eb43800650ac66",
|
291
|
+
"comment": "docs: re-generate api.md files"
|
292
|
+
}
|
293
|
+
]
|
294
|
+
}
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"date": "Wed, 03 Aug 2022 16:03:52 GMT",
|
6
298
|
"tag": "@fluentui/react-overflow_v9.0.0-beta.9",
|
7
299
|
"version": "9.0.0-beta.9",
|
8
300
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,87 @@
|
|
1
1
|
# Change Log - @fluentui/react-overflow
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 17 Nov 2022 23:02:39 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-rc.1)
|
8
|
+
|
9
|
+
Thu, 17 Nov 2022 23:02:39 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.14..@fluentui/react-overflow_v9.0.0-rc.1)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- feat: Bump to RC ([PR #25659](https://github.com/microsoft/fluentui/pull/25659) by lingfangao@hotmail.com)
|
15
|
+
- Bump @fluentui/priority-overflow to v9.0.0-rc.1 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
16
|
+
- Bump @fluentui/react-context-selector to v9.1.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
18
|
+
|
19
|
+
## [9.0.0-beta.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.14)
|
20
|
+
|
21
|
+
Fri, 11 Nov 2022 14:58:08 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.13..@fluentui/react-overflow_v9.0.0-beta.14)
|
23
|
+
|
24
|
+
### Changes
|
25
|
+
|
26
|
+
- fix: create valid export maps ([PR #25558](https://github.com/microsoft/fluentui/pull/25558) by martinhochel@microsoft.com)
|
27
|
+
- Bump @fluentui/priority-overflow to v9.0.0-beta.4 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
28
|
+
- Bump @fluentui/react-context-selector to v9.1.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
29
|
+
- Bump @fluentui/react-theme to v9.1.2 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
30
|
+
- Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
31
|
+
|
32
|
+
## [9.0.0-beta.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.13)
|
33
|
+
|
34
|
+
Wed, 02 Nov 2022 11:57:55 GMT
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.12..@fluentui/react-overflow_v9.0.0-beta.13)
|
36
|
+
|
37
|
+
### Changes
|
38
|
+
|
39
|
+
- chore: Update Griffel to latest version ([PR #25412](https://github.com/microsoft/fluentui/pull/25412) by olfedias@microsoft.com)
|
40
|
+
- Bump @fluentui/react-context-selector to v9.1.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
41
|
+
- Bump @fluentui/react-utilities to v9.2.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
42
|
+
|
43
|
+
## [9.0.0-beta.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.12)
|
44
|
+
|
45
|
+
Thu, 20 Oct 2022 08:39:38 GMT
|
46
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.11..@fluentui/react-overflow_v9.0.0-beta.12)
|
47
|
+
|
48
|
+
### Changes
|
49
|
+
|
50
|
+
- chore: Update Griffel to latest version ([PR #25212](https://github.com/microsoft/fluentui/pull/25212) by olfedias@microsoft.com)
|
51
|
+
- chore: Bump peer deps to support React 18 ([PR #24972](https://github.com/microsoft/fluentui/pull/24972) by mgodbolt@microsoft.com)
|
52
|
+
- Bump @fluentui/react-context-selector to v9.0.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
53
|
+
- Bump @fluentui/react-theme to v9.1.1 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
54
|
+
- Bump @fluentui/react-utilities to v9.1.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
55
|
+
|
56
|
+
## [9.0.0-beta.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.11)
|
57
|
+
|
58
|
+
Thu, 13 Oct 2022 11:02:54 GMT
|
59
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.10..@fluentui/react-overflow_v9.0.0-beta.11)
|
60
|
+
|
61
|
+
### Changes
|
62
|
+
|
63
|
+
- fix: useOverflowMenu should register overflow menu ([PR #25091](https://github.com/microsoft/fluentui/pull/25091) by lingfangao@hotmail.com)
|
64
|
+
- chore: Update Griffel to latest version ([PR #25075](https://github.com/microsoft/fluentui/pull/25075) by olfedias@microsoft.com)
|
65
|
+
- Bump @fluentui/priority-overflow to v9.0.0-beta.3 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
66
|
+
- Bump @fluentui/react-context-selector to v9.0.4 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
67
|
+
- Bump @fluentui/react-utilities to v9.1.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
68
|
+
|
69
|
+
## [9.0.0-beta.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.10)
|
70
|
+
|
71
|
+
Thu, 15 Sep 2022 09:49:10 GMT
|
72
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.9..@fluentui/react-overflow_v9.0.0-beta.10)
|
73
|
+
|
74
|
+
### Changes
|
75
|
+
|
76
|
+
- chore: fix no-context-default-value lint violations ([PR #24276](https://github.com/microsoft/fluentui/pull/24276) by lingfangao@hotmail.com)
|
77
|
+
- chore: Update Griffel to latest version ([PR #24221](https://github.com/microsoft/fluentui/pull/24221) by olfedias@microsoft.com)
|
78
|
+
- Bump @fluentui/react-context-selector to v9.0.3 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
|
79
|
+
- Bump @fluentui/react-theme to v9.1.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
|
80
|
+
- Bump @fluentui/react-utilities to v9.1.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
|
81
|
+
|
7
82
|
## [9.0.0-beta.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.0.0-beta.9)
|
8
83
|
|
9
|
-
Wed, 03 Aug 2022 16:
|
84
|
+
Wed, 03 Aug 2022 16:03:52 GMT
|
10
85
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.0.0-beta.8..@fluentui/react-overflow_v9.0.0-beta.9)
|
11
86
|
|
12
87
|
### Changes
|
package/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# @fluentui/react-overflow
|
2
2
|
|
3
|
-
**React Priority Overflow components for [Fluent UI React](https://
|
3
|
+
**React Priority Overflow components for [Fluent UI React](https://react.fluentui.dev)**
|
4
4
|
|
5
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.
|
package/dist/index.d.ts
CHANGED
@@ -22,6 +22,7 @@ declare interface OverflowContextValue {
|
|
22
22
|
groupVisibility: Record<string, OverflowGroupState>;
|
23
23
|
hasOverflow: boolean;
|
24
24
|
registerItem: (item: OverflowItemEntry) => () => void;
|
25
|
+
registerOverflowMenu: (el: HTMLElement) => () => void;
|
25
26
|
updateOverflow: (padding?: number) => void;
|
26
27
|
}
|
27
28
|
|
@@ -83,19 +84,11 @@ export declare const useOverflowContainer: <TElement extends HTMLElement>(update
|
|
83
84
|
/**
|
84
85
|
* @internal
|
85
86
|
*/
|
86
|
-
export declare interface UseOverflowContainerReturn<TElement extends HTMLElement> {
|
87
|
+
export declare interface UseOverflowContainerReturn<TElement extends HTMLElement> extends Pick<OverflowContextValue, 'registerItem' | 'updateOverflow' | 'registerOverflowMenu'> {
|
87
88
|
/**
|
88
89
|
* Ref to apply to the container that will overflow
|
89
90
|
*/
|
90
91
|
containerRef: React_2.RefObject<TElement>;
|
91
|
-
/**
|
92
|
-
* Registers and overflow item
|
93
|
-
*/
|
94
|
-
registerItem: OverflowContextValue['registerItem'];
|
95
|
-
/**
|
96
|
-
* Imperative function to trigger overflow update
|
97
|
-
*/
|
98
|
-
updateOverflow: OverflowContextValue['updateOverflow'];
|
99
92
|
}
|
100
93
|
|
101
94
|
/**
|
@@ -48,7 +48,8 @@ export const Overflow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
48
48
|
const {
|
49
49
|
containerRef,
|
50
50
|
registerItem,
|
51
|
-
updateOverflow
|
51
|
+
updateOverflow,
|
52
|
+
registerOverflowMenu
|
52
53
|
} = useOverflowContainer(update, {
|
53
54
|
overflowDirection,
|
54
55
|
overflowAxis,
|
@@ -66,7 +67,8 @@ export const Overflow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
66
67
|
groupVisibility,
|
67
68
|
hasOverflow,
|
68
69
|
registerItem,
|
69
|
-
updateOverflow
|
70
|
+
updateOverflow,
|
71
|
+
registerOverflowMenu
|
70
72
|
}
|
71
73
|
}, clonedChild);
|
72
74
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Overflow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,mBAAqB,YAArB,QAAyC,gBAAzC;AAEA,SAAS,2BAAT,EAAsC,aAAtC,QAA2D,2BAA3D;AAEA,SAAS,eAAT,QAAgC,oBAAhC;AACA,SAAS,yBAAT,EAAoC,oBAApC,QAAgE,yBAAhE;AACA,SAAS,gBAAT,EAA2B,kBAA3B,QAAqD,cAArD;;AAEA,MAAM,SAAS,gBAAG;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAuBA;;AAEG;;;AACH,OAAO,MAAM,QAAQ,gBAAG,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAuB,GAAvB,KAA8B;EACrE,MAAM,MAAM,GAAG,SAAS,EAAxB;EAEA,MAAM;IAAE,QAAF;IAAY,cAAZ;IAA4B,YAAY,GAAG,YAA3C;IAAyD,iBAAzD;IAA4E;EAA5E,IAAwF,KAA9F;EAEA,MAAM,CAAC,WAAD,EAAc,cAAd,IAAgC,KAAK,CAAC,QAAN,CAAe,KAAf,CAAtC;EACA,MAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAwC,EAAxC,CAA5C;EACA,MAAM,CAAC,eAAD,EAAkB,kBAAlB,IAAwC,KAAK,CAAC,QAAN,CAAmD,EAAnD,CAA9C,CAPqE,CASrE;EACA;;EACA,MAAM,MAAM,GAAqB,IAAI,IAAG;IACtC,cAAc,CAAC,MAAM,IAAI,CAAC,cAAL,CAAoB,MAApB,GAA6B,CAApC,CAAd;IACA,iBAAiB,CAAC,MAAK;MACrB,M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asses } from '@griffel/react';\nimport type { OnUpdateOverflow, OverflowGroupState, ObserveOptions } from '@fluentui/priority-overflow';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\n\nimport { OverflowContext } from '../overflowContext';\nimport { updateVisibilityAttribute, useOverflowContainer } from '../useOverflowContainer';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../constants';\n\nconst useStyles = makeStyles({\n overflowMenu: {\n [`& [${DATA_OVERFLOW_MENU}]`]: {\n flexShrink: 0,\n },\n },\n\n overflowingItems: {\n [`& > [${DATA_OVERFLOWING}]`]: {\n display: 'none',\n },\n },\n});\n\n/**\n * Overflow Props\n */\nexport type OverflowProps = Partial<\n Pick<ObserveOptions, 'overflowAxis' | 'overflowDirection' | 'padding' | 'minimumVisible'>\n> & {\n children: React.ReactElement;\n};\n\n/**\n * Provides an OverflowContext for OverflowItem descendants.\n */\nexport const Overflow = React.forwardRef((props: OverflowProps, ref) => {\n const styles = useStyles();\n\n const { children, minimumVisible, overflowAxis = 'horizontal', overflowDirection, padding } = props;\n\n const [hasOverflow, setHasOverflow] = React.useState(false);\n const [itemVisibility, setItemVisibility] = React.useState<Record<string, boolean>>({});\n const [groupVisibility, setGroupVisibility] = React.useState<Record<string, OverflowGroupState>>({});\n\n // useOverflowContainer wraps this method in a useEventCallback.\n // TODO: Do we need a useEventCallback here too?\n const update: OnUpdateOverflow = data => {\n setHasOverflow(() => data.invisibleItems.length > 0);\n setItemVisibility(() => {\n const newState: Record<string, boolean> = {};\n data.visibleItems.forEach(x => (newState[x.id] = true));\n data.invisibleItems.forEach(x => (newState[x.id] = false));\n return newState;\n });\n setGroupVisibility(data.groupVisibility);\n };\n\n const { containerRef, registerItem, updateOverflow, registerOverflowMenu } = useOverflowContainer(update, {\n overflowDirection,\n overflowAxis,\n padding,\n minimumVisible,\n onUpdateItemVisibility: updateVisibilityAttribute,\n });\n\n const clonedChild = applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n className: mergeClasses(styles.overflowMenu, styles.overflowingItems, children.props.className),\n });\n\n return (\n <OverflowContext.Provider\n value={{\n itemVisibility,\n groupVisibility,\n hasOverflow,\n registerItem,\n updateOverflow,\n registerOverflowMenu,\n }}\n >\n {clonedChild}\n </OverflowContext.Provider>\n );\n});\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/OverflowItem/OverflowItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,2BAAT,EAAsC,aAAtC,QAA2D,2BAA3D;AACA,SAAS,eAAT,QAAgC,uBAAhC;AAGA;;;AAGG;;AACH,OAAO,MAAM,YAAY,gBAAG,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAA2B,GAA3B,KAAkC;EAC7E,MAAM;IAAE,EAAF;IAAM,OAAN;IAAe,QAAf;IAAyB;EAAzB,IAAsC,KAA5C;EAEA,MAAM,YAAY,GAAG,eAAe,CAAC,EAAD,EAAK,QAAL,EAAe,OAAf,CAApC;EACA,OAAO,2BAA2B,CAAC,QAAD,EAAW;IAC3C,GAAG,EAAE,aAAa,CAAC,YAAD,EAAe,GAAf;EADyB,CAAX,CAAlC;AAGD,CAP2B,CAArB","sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOverflowItem } from '../../useOverflowItem';\nimport { OverflowItemProps } from './OverflowItem.types';\n\n/**\n * Attaches overflow item behavior to its child registered with the OverflowContext.\n * It does not render an element of its own.\n */\nexport const OverflowItem = React.forwardRef((props: OverflowItemProps, ref) => {\n const { id, groupId, priority, children } = props;\n\n const containerRef = useOverflowItem(id, priority, groupId);\n return applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n });\n});\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,2BAAT,EAAsC,aAAtC,QAA2D,2BAA3D;AACA,SAAS,eAAT,QAAgC,uBAAhC;AAGA;;;AAGG;;AACH,OAAO,MAAM,YAAY,gBAAG,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAA2B,GAA3B,KAAkC;EAC7E,MAAM;IAAE,EAAF;IAAM,OAAN;IAAe,QAAf;IAAyB;EAAzB,IAAsC,KAA5C;EAEA,MAAM,YAAY,GAAG,eAAe,CAAC,EAAD,EAAK,QAAL,EAAe,OAAf,CAApC;EACA,OAAO,2BAA2B,CAAC,QAAD,EAAW;IAC3C,GAAG,EAAE,aAAa,CAAC,YAAD,EAAe,GAAf;EADyB,CAAX,CAAlC;AAGD,CAP2B,CAArB","sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOverflowItem } from '../../useOverflowItem';\nimport { OverflowItemProps } from './OverflowItem.types';\n\n/**\n * Attaches overflow item behavior to its child registered with the OverflowContext.\n * It does not render an element of its own.\n */\nexport const OverflowItem = React.forwardRef((props: OverflowItemProps, ref) => {\n const { id, groupId, priority, children } = props;\n\n const containerRef = useOverflowItem(id, priority, groupId);\n return applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n });\n});\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OverflowItem.types.js","sourceRoot":"../src/","sources":["components/OverflowItem/OverflowItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\n * OverflowItemProps\n */\nexport type OverflowItemProps = {\n /**\n * The unique identifier for the item used by the overflow manager.\n */\n id: string;\n /**\n * Assigns the item to a group, group visibility can be watched.\n */\n groupId?: string;\n /**\n * A higher priority means the item overflows later.\n */\n priority?: number;\n /**\n * The single child that has overflow item behavior attached.\n */\n children: React.ReactElement;\n};\n"]}
|
1
|
+
{"version":3,"file":"OverflowItem.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\n * OverflowItemProps\n */\nexport type OverflowItemProps = {\n /**\n * The unique identifier for the item used by the overflow manager.\n */\n id: string;\n /**\n * Assigns the item to a group, group visibility can be watched.\n */\n groupId?: string;\n /**\n * A higher priority means the item overflows later.\n */\n priority?: number;\n /**\n * The single child that has overflow item behavior attached.\n */\n children: React.ReactElement;\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/OverflowItem/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type { OverflowItemProps } from './OverflowItem.types';\nexport { OverflowItem } from './OverflowItem';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-overflow/src/components/OverflowItem/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type { OverflowItemProps } from './OverflowItem.types';\nexport { OverflowItem } from './OverflowItem';\n"]}
|
package/lib/constants.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC","sourcesContent":["export const DATA_OVERFLOWING = 'data-overflowing';\nexport const DATA_OVERFLOW_ITEM = 'data-overflow-item';\nexport const DATA_OVERFLOW_MENU = 'data-overflow-menu';\n"]}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["packages/react-components/react-overflow/src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC","sourcesContent":["export const DATA_OVERFLOWING = 'data-overflowing';\nexport const DATA_OVERFLOW_ITEM = 'data-overflow-item';\nexport const DATA_OVERFLOW_MENU = 'data-overflow-menu';\n"]}
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export { Overflow } from './components/Overflow';\nexport type { OverflowProps } from './components/Overflow';\nexport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\nexport type { UseOverflowContainerReturn } from './types';\nexport { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';\nexport { useIsOverflowItemVisible } from './useIsOverflowItemVisible';\nexport { useOverflowContainer } from './useOverflowContainer';\nexport { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-overflow/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export { Overflow } from './components/Overflow';\nexport type { OverflowProps } from './components/Overflow';\nexport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\nexport type { UseOverflowContainerReturn } from './types';\nexport { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';\nexport { useIsOverflowItemVisible } from './useIsOverflowItemVisible';\nexport { useOverflowContainer } from './useOverflowContainer';\nexport { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\n"]}
|
package/lib/overflowContext.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
|
-
|
3
|
-
|
1
|
+
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
|
+
export const OverflowContext = /*#__PURE__*/createContext(undefined);
|
3
|
+
const overflowContextDefaultValue = {
|
4
4
|
itemVisibility: {},
|
5
5
|
groupVisibility: {},
|
6
6
|
hasOverflow: false,
|
7
7
|
registerItem: () => () => null,
|
8
|
-
updateOverflow: () => null
|
9
|
-
|
10
|
-
|
8
|
+
updateOverflow: () => null,
|
9
|
+
registerOverflowMenu: () => () => null
|
10
|
+
};
|
11
|
+
export const useOverflowContext = selector => useContextSelector(OverflowContext, (ctx = overflowContextDefaultValue) => selector(ctx));
|
11
12
|
//# sourceMappingURL=overflowContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["overflowContext.ts"],"names":[],"mappings":"AACA,SAA0B,aAA1B,EAAyC,kBAAzC,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/overflowContext.ts"],"names":[],"mappings":"AACA,SAA0B,aAA1B,EAAyC,kBAAzC,QAA4E,kCAA5E;AAWA,OAAO,MAAM,eAAe,gBAAG,aAAa,CAC1C,SAD0C,CAArC;AAIP,MAAM,2BAA2B,GAAyB;EACxD,cAAc,EAAE,EADwC;EAExD,eAAe,EAAE,EAFuC;EAGxD,WAAW,EAAE,KAH2C;EAIxD,YAAY,EAAE,MAAM,MAAM,IAJ8B;EAKxD,cAAc,EAAE,MAAM,IALkC;EAMxD,oBAAoB,EAAE,MAAM,MAAM;AANsB,CAA1D;AASA,OAAO,MAAM,kBAAkB,GAAmB,QAAhB,IAChC,kBAAkB,CAAC,eAAD,EAAkB,CAAC,GAAG,GAAG,2BAAP,KAAuC,QAAQ,CAAC,GAAD,CAAjE,CADb","sourcesContent":["import type { OverflowGroupState, OverflowItemEntry } from '@fluentui/priority-overflow';\nimport { ContextSelector, createContext, useContextSelector, Context } from '@fluentui/react-context-selector';\n\nexport interface OverflowContextValue {\n itemVisibility: Record<string, boolean>;\n groupVisibility: Record<string, OverflowGroupState>;\n hasOverflow: boolean;\n registerItem: (item: OverflowItemEntry) => () => void;\n registerOverflowMenu: (el: HTMLElement) => () => void;\n updateOverflow: (padding?: number) => void;\n}\n\nexport const OverflowContext = createContext<OverflowContextValue | undefined>(\n undefined,\n) as Context<OverflowContextValue>;\n\nconst overflowContextDefaultValue: OverflowContextValue = {\n itemVisibility: {},\n groupVisibility: {},\n hasOverflow: false,\n registerItem: () => () => null,\n updateOverflow: () => null,\n registerOverflowMenu: () => () => null,\n};\n\nexport const useOverflowContext = <SelectedValue>(selector: ContextSelector<OverflowContextValue, SelectedValue>) =>\n useContextSelector(OverflowContext, (ctx = overflowContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { OverflowContextValue } from './overflowContext';\n\n/**\n * @internal\n */\nexport interface UseOverflowContainerReturn<TElement extends HTMLElement> {\n /**\n * Ref to apply to the container that will overflow\n */\n containerRef: React.RefObject<TElement>;\n
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["packages/react-components/react-overflow/src/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { OverflowContextValue } from './overflowContext';\n\n/**\n * @internal\n */\nexport interface UseOverflowContainerReturn<TElement extends HTMLElement>\n extends Pick<OverflowContextValue, 'registerItem' | 'updateOverflow' | 'registerOverflowMenu'> {\n /**\n * Ref to apply to the container that will overflow\n */\n containerRef: React.RefObject<TElement>;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsOverflowGroupVisible.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;AAGG;;AACH,OAAM,SAAU,yBAAV,CAAoC,EAApC,EAA8C;EAClD,OAAO,kBAAkB,CAAC,GAAG,IAAI,GAAG,CAAC,eAAJ,CAAoB,EAApB,CAAR,CAAzB;AACD","sourcesContent":["import { OverflowGroupState } from '@fluentui/priority-overflow';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for a group of overflow items\n * @returns visibility state of the group\n */\nexport function useIsOverflowGroupVisible(id: string): OverflowGroupState {\n return useOverflowContext(ctx => ctx.groupVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useIsOverflowGroupVisible.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;AAGG;;AACH,OAAM,SAAU,yBAAV,CAAoC,EAApC,EAA8C;EAClD,OAAO,kBAAkB,CAAC,GAAG,IAAI,GAAG,CAAC,eAAJ,CAAoB,EAApB,CAAR,CAAzB;AACD","sourcesContent":["import { OverflowGroupState } from '@fluentui/priority-overflow';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for a group of overflow items\n * @returns visibility state of the group\n */\nexport function useIsOverflowGroupVisible(id: string): OverflowGroupState {\n return useOverflowContext(ctx => ctx.groupVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsOverflowItemVisible.ts"],"names":[],"mappings":"AAAA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;AAGG;;AACH,OAAM,SAAU,wBAAV,CAAmC,EAAnC,EAA6C;EACjD,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAI,GAAG,CAAC,cAAJ,CAAmB,EAAnB,CAAR,CAA3B;AACD","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for the item used by the overflow manager\n * @returns visibility state of an overflow item\n */\nexport function useIsOverflowItemVisible(id: string): boolean {\n return !!useOverflowContext(ctx => ctx.itemVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useIsOverflowItemVisible.ts"],"names":[],"mappings":"AAAA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;AAGG;;AACH,OAAM,SAAU,wBAAV,CAAmC,EAAnC,EAA6C;EACjD,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAI,GAAG,CAAC,cAAJ,CAAmB,EAAnB,CAAR,CAA3B;AACD","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for the item used by the overflow manager\n * @returns visibility state of an overflow item\n */\nexport function useIsOverflowItemVisible(id: string): boolean {\n return !!useOverflowContext(ctx => ctx.itemVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { createOverflowManager } from '@fluentui/priority-overflow';
|
3
3
|
import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
4
|
-
import { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM } from './constants';
|
4
|
+
import { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';
|
5
5
|
/**
|
6
6
|
* @internal
|
7
7
|
* @param update - Callback when overflow state changes
|
@@ -52,10 +52,19 @@ export const useOverflowContainer = (update, options) => {
|
|
52
52
|
const updateOverflow = React.useCallback(() => {
|
53
53
|
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.update();
|
54
54
|
}, [overflowManager]);
|
55
|
+
const registerOverflowMenu = React.useCallback(el => {
|
56
|
+
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.addOverflowMenu(el);
|
57
|
+
el.setAttribute(DATA_OVERFLOW_MENU, '');
|
58
|
+
return () => {
|
59
|
+
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.removeOverflowMenu();
|
60
|
+
el.removeAttribute(DATA_OVERFLOW_MENU);
|
61
|
+
};
|
62
|
+
}, [overflowManager]);
|
55
63
|
return {
|
56
64
|
containerRef,
|
57
65
|
registerItem,
|
58
|
-
updateOverflow
|
66
|
+
updateOverflow,
|
67
|
+
registerOverflowMenu
|
59
68
|
};
|
60
69
|
};
|
61
70
|
export const updateVisibilityAttribute = ({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowContainer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,QAAsC,6BAAtC;AAYA,SAAS,SAAT,EAAoB,gBAApB,EAAsC,yBAAtC,QAAuE,2BAAvE;AAEA,SAAS,gBAAT,EAA2B,kBAA3B,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowContainer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,QAAsC,6BAAtC;AAYA,SAAS,SAAT,EAAoB,gBAApB,EAAsC,yBAAtC,QAAuE,2BAAvE;AAEA,SAAS,gBAAT,EAA2B,kBAA3B,EAA+C,kBAA/C,QAAyE,aAAzE;AAEA;;;;;AAKG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAClC,MADkC,EAElC,OAFkC,KAGM;EACxC,MAAM;IAAE,YAAF;IAAgB,iBAAhB;IAAmC,OAAnC;IAA4C,cAA5C;IAA4D;EAA5D,IAAuF,OAA7F,CADwC,CAGxC;;EACA,MAAM,YAAY,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAArB;EACA,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,MAAD,CAA5C;EAEA,MAAM,CAAC,eAAD,IAAoB,KAAK,CAAC,QAAN,CAAuC,MAC/D,SAAS,KAAK,qBAAqB,EAA1B,GAA+B,IADhB,CAA1B;EAIA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,CAAC,YAAY,CAAC,OAAlB,EAA2B;MACzB;IACD;;IAED,IAAI,eAAJ,EAAqB;MACnB,eAAe,CAAC,OAAhB,CAAwB,YAAY,CAA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Af,GAAA,eAAe,CAAE,UAAjB,CAA4B,IAAI,CAAC,EAAjC,CAAA;IACD,CAJD;EAKD,CAVkB,EAWnB,CAAC,eAAD,CAXmB,CAArB;EAcA,MAAM,cAAc,GAAG,KAAK,CAAC,WAAN,CAAkB,MAAK;IAC5C,eAAe,KAAA,IAAf,IAAA,eAAe,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAA,eAAe,CAAE,MAAjB,EAAA;EACD,CAFsB,EAEpB,CAAC,eAAD,CAFoB,CAAvB;EAIA,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAN,CAC1B,EAAD,IAAoB;IAClB,eAAe,KAAA,IAAf,IAAA,eAAe,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAA,eAAe,CAAE,eAAjB,CAAiC,EAAjC,CAAA;IACA,EAAE,CAAC,YAAH,CAAgB,kBAAhB,EAAoC,EAApC;IAEA,OAAO,MAAK;MACV,eAAe,KAAA,IAAf,IAAA,eAAe,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAA,eAAe,CAAE,kBAAjB,EAAA;MACA,EAAE,CAAC,eAAH,CAAmB,kBAAnB;IACD,CAHD;EAID,CAT0B,EAU3B,CAAC,eAAD,CAV2B,CAA7B;EAaA,OAAO;IACL,YADK;IAEL,YAFK;IAGL,cAHK;IAIL;EAJK,CAAP;AAMD,CAhFM;AAkFP,OAAO,MAAM,yBAAyB,GAA2B,CAAC;EAAE,IAAF;EAAQ;AAAR,CAAD,KAAsB;EACrF,IAAI,OAAJ,EAAa;IACX,IAAI,CAAC,OAAL,CAAa,eAAb,CAA6B,gBAA7B;EACD,CAFD,MAEO;IACL,IAAI,CAAC,OAAL,CAAa,YAAb,CAA0B,gBAA1B,EAA4C,EAA5C;EACD;AACF,CANM","sourcesContent":["import * as React from 'react';\nimport { createOverflowManager } from '@fluentui/priority-overflow';\n\n/**\n * @internal\n */\nimport type {\n OnUpdateItemVisibility,\n OnUpdateOverflow,\n OverflowItemEntry,\n OverflowManager,\n ObserveOptions,\n} from '@fluentui/priority-overflow';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { UseOverflowContainerReturn } from './types';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\n\n/**\n * @internal\n * @param update - Callback when overflow state changes\n * @param options - Options to configure the overflow container\n * @returns - ref to attach to an intrinsic HTML element and imperative functions\n */\nexport const useOverflowContainer = <TElement extends HTMLElement>(\n update: OnUpdateOverflow,\n options: Omit<ObserveOptions, 'onUpdateOverflow'>,\n): UseOverflowContainerReturn<TElement> => {\n const { overflowAxis, overflowDirection, padding, minimumVisible, onUpdateItemVisibility } = options;\n\n // DOM ref to the overflow container element\n const containerRef = React.useRef<TElement>(null);\n const updateOverflowItems = useEventCallback(update);\n\n const [overflowManager] = React.useState<OverflowManager | null>(() =>\n canUseDOM() ? createOverflowManager() : null,\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!containerRef.current) {\n return;\n }\n\n if (overflowManager) {\n overflowManager.observe(containerRef.current, {\n overflowDirection: overflowDirection ?? 'end',\n overflowAxis: overflowAxis ?? 'horizontal',\n padding: padding ?? 10,\n minimumVisible: minimumVisible ?? 0,\n onUpdateItemVisibility: onUpdateItemVisibility ?? (() => undefined),\n onUpdateOverflow: updateOverflowItems ?? (() => undefined),\n });\n\n return () => {\n overflowManager.disconnect();\n };\n }\n }, [\n updateOverflowItems,\n overflowManager,\n overflowDirection,\n overflowAxis,\n padding,\n minimumVisible,\n onUpdateItemVisibility,\n ]);\n\n const registerItem = React.useCallback(\n (item: OverflowItemEntry) => {\n overflowManager?.addItem(item);\n item.element.setAttribute(DATA_OVERFLOW_ITEM, '');\n\n return () => {\n item.element.removeAttribute(DATA_OVERFLOWING);\n item.element.removeAttribute(DATA_OVERFLOW_ITEM);\n overflowManager?.removeItem(item.id);\n };\n },\n [overflowManager],\n );\n\n const updateOverflow = React.useCallback(() => {\n overflowManager?.update();\n }, [overflowManager]);\n\n const registerOverflowMenu = React.useCallback(\n (el: HTMLElement) => {\n overflowManager?.addOverflowMenu(el);\n el.setAttribute(DATA_OVERFLOW_MENU, '');\n\n return () => {\n overflowManager?.removeOverflowMenu();\n el.removeAttribute(DATA_OVERFLOW_MENU);\n };\n },\n [overflowManager],\n );\n\n return {\n containerRef,\n registerItem,\n updateOverflow,\n registerOverflowMenu,\n };\n};\n\nexport const updateVisibilityAttribute: OnUpdateItemVisibility = ({ item, visible }) => {\n if (visible) {\n item.element.removeAttribute(DATA_OVERFLOWING);\n } else {\n item.element.setAttribute(DATA_OVERFLOWING, '');\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowCount.ts"],"names":[],"mappings":"AAAA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;AAEG;;AACH,OAAO,MAAM,gBAAgB,GAAG,MAC9B,kBAAkB,CAAC,CAAC,IAAG;EACrB,OAAO,MAAM,CAAC,OAAP,CAAe,CAAC,CAAC,cAAjB,EAAiC,MAAjC,CAAwC,CAAC,GAAD,EAAM,CAAC,EAAD,EAAK,OAAL,CAAN,KAAuB;IACpE,IAAI,CAAC,OAAL,EAAc;MACZ,GAAG;IACJ;;IAED,OAAO,GAAP;EACD,CANM,EAMJ,CANI,CAAP;AAOD,CARiB,CADb","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @returns Number of items that are overflowing\n */\nexport const useOverflowCount = () =>\n useOverflowContext(v => {\n return Object.entries(v.itemVisibility).reduce((acc, [id, visible]) => {\n if (!visible) {\n acc++;\n }\n\n return acc;\n }, 0);\n });\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowCount.ts"],"names":[],"mappings":"AAAA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;AAEG;;AACH,OAAO,MAAM,gBAAgB,GAAG,MAC9B,kBAAkB,CAAC,CAAC,IAAG;EACrB,OAAO,MAAM,CAAC,OAAP,CAAe,CAAC,CAAC,cAAjB,EAAiC,MAAjC,CAAwC,CAAC,GAAD,EAAM,CAAC,EAAD,EAAK,OAAL,CAAN,KAAuB;IACpE,IAAI,CAAC,OAAL,EAAc;MACZ,GAAG;IACJ;;IAED,OAAO,GAAP;EACD,CANM,EAMJ,CANI,CAAP;AAOD,CARiB,CADb","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @returns Number of items that are overflowing\n */\nexport const useOverflowCount = () =>\n useOverflowContext(v => {\n return Object.entries(v.itemVisibility).reduce((acc, [id, visible]) => {\n if (!visible) {\n acc++;\n }\n\n return acc;\n }, 0);\n });\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;;;;;AAOG;;AACH,OAAM,SAAU,eAAV,CAAwD,EAAxD,EAAoE,QAApE,EAAuF,OAAvF,EAAuG;EAC3G,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EACA,MAAM,YAAY,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,YAAR,CAAvC;EAEA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,GAAG,CAAC,OAAR,EAAiB;MACf,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC,OADK;QAElB,EAFkB;QAGlB,QAAQ,EAAE,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAHJ;QAIlB;MAJkB,CAAD,CAAnB;IAMD;EACF,CATwB,EAStB,CAAC,EAAD,EAAK,QAAL,EAAe,YAAf,EAA6B,OAA7B,CATsB,CAAzB;EAWA,OAAO,GAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @internal\n * Registers an overflow item\n * @param id - unique identifier for the item used by the overflow manager\n * @param priority - higher priority means the item overflows later\n * @param groupId - assigns the item to a group, group visibility can be watched\n * @returns ref to assign to an intrinsic HTML element\n */\nexport function useOverflowItem<TElement extends HTMLElement>(id: string, priority?: number, groupId?: string) {\n const ref = React.useRef<TElement>(null);\n const registerItem = useOverflowContext(v => v.registerItem);\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerItem({\n element: ref.current,\n id,\n priority: priority ?? 0,\n groupId,\n });\n }\n }, [id, priority, registerItem, groupId]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SAAS,kBAAT,QAAmC,mBAAnC;AAEA;;;;;;;AAOG;;AACH,OAAM,SAAU,eAAV,CAAwD,EAAxD,EAAoE,QAApE,EAAuF,OAAvF,EAAuG;EAC3G,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EACA,MAAM,YAAY,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,YAAR,CAAvC;EAEA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,GAAG,CAAC,OAAR,EAAiB;MACf,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC,OADK;QAElB,EAFkB;QAGlB,QAAQ,EAAE,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAHJ;QAIlB;MAJkB,CAAD,CAAnB;IAMD;EACF,CATwB,EAStB,CAAC,EAAD,EAAK,QAAL,EAAe,YAAf,EAA6B,OAA7B,CATsB,CAAzB;EAWA,OAAO,GAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @internal\n * Registers an overflow item\n * @param id - unique identifier for the item used by the overflow manager\n * @param priority - higher priority means the item overflows later\n * @param groupId - assigns the item to a group, group visibility can be watched\n * @returns ref to assign to an intrinsic HTML element\n */\nexport function useOverflowItem<TElement extends HTMLElement>(id: string, priority?: number, groupId?: string) {\n const ref = React.useRef<TElement>(null);\n const registerItem = useOverflowContext(v => v.registerItem);\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerItem({\n element: ref.current,\n id,\n priority: priority ?? 0,\n groupId,\n });\n }\n }, [id, priority, registerItem, groupId]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}
|
package/lib/useOverflowMenu.js
CHANGED
@@ -2,30 +2,18 @@ import * as React from 'react';
|
|
2
2
|
import { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
3
3
|
import { useOverflowContext } from './overflowContext';
|
4
4
|
import { useOverflowCount } from './useOverflowCount';
|
5
|
-
import { DATA_OVERFLOW_MENU } from './constants';
|
6
5
|
export function useOverflowMenu(id) {
|
7
6
|
const elementId = useId('overflow-menu', id);
|
8
7
|
const overflowCount = useOverflowCount();
|
9
|
-
const
|
8
|
+
const registerOverflowMenu = useOverflowContext(v => v.registerOverflowMenu);
|
10
9
|
const updateOverflow = useOverflowContext(v => v.updateOverflow);
|
11
10
|
const ref = React.useRef(null);
|
12
11
|
const isOverflowing = overflowCount > 0;
|
13
12
|
useIsomorphicLayoutEffect(() => {
|
14
|
-
|
15
|
-
|
16
|
-
if (element) {
|
17
|
-
const deregisterItem = registerItem({
|
18
|
-
element,
|
19
|
-
id: elementId,
|
20
|
-
priority: Infinity
|
21
|
-
});
|
22
|
-
element.setAttribute(DATA_OVERFLOW_MENU, '');
|
23
|
-
return () => {
|
24
|
-
deregisterItem();
|
25
|
-
element === null || element === void 0 ? void 0 : element.removeAttribute(DATA_OVERFLOW_MENU);
|
26
|
-
};
|
13
|
+
if (ref.current) {
|
14
|
+
return registerOverflowMenu(ref.current);
|
27
15
|
}
|
28
|
-
}, [
|
16
|
+
}, [registerOverflowMenu, isOverflowing, elementId]);
|
29
17
|
useIsomorphicLayoutEffect(() => {
|
30
18
|
if (isOverflowing) {
|
31
19
|
updateOverflow();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,KAAT,EAAgB,yBAAhB,QAAiD,2BAAjD;AACA,SAAS,kBAAT,QAAmC,mBAAnC;AACA,SAAS,gBAAT,QAAiC,oBAAjC;
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,KAAT,EAAgB,yBAAhB,QAAiD,2BAAjD;AACA,SAAS,kBAAT,QAAmC,mBAAnC;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA,OAAM,SAAU,eAAV,CAAwD,EAAxD,EAAmE;EACvE,MAAM,SAAS,GAAG,KAAK,CAAC,eAAD,EAAkB,EAAlB,CAAvB;EACA,MAAM,aAAa,GAAG,gBAAgB,EAAtC;EACA,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,oBAAR,CAA/C;EACA,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,cAAR,CAAzC;EACA,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EACA,MAAM,aAAa,GAAG,aAAa,GAAG,CAAtC;EAEA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,GAAG,CAAC,OAAR,EAAiB;MACf,OAAO,oBAAoB,CAAC,GAAG,CAAC,OAAL,CAA3B;IACD;EACF,CAJwB,EAItB,CAAC,oBAAD,EAAuB,aAAvB,EAAsC,SAAtC,CAJsB,CAAzB;EAMA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,aAAJ,EAAmB;MACjB,cAAc;IACf;EACF,CAJwB,EAItB,CAAC,aAAD,EAAgB,cAAhB,EAAgC,GAAhC,CAJsB,CAAzB;EAMA,OAAO;IAAE,GAAF;IAAO,aAAP;IAAsB;EAAtB,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\nimport { useOverflowCount } from './useOverflowCount';\n\nexport function useOverflowMenu<TElement extends HTMLElement>(id?: string) {\n const elementId = useId('overflow-menu', id);\n const overflowCount = useOverflowCount();\n const registerOverflowMenu = useOverflowContext(v => v.registerOverflowMenu);\n const updateOverflow = useOverflowContext(v => v.updateOverflow);\n const ref = React.useRef<TElement>(null);\n const isOverflowing = overflowCount > 0;\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerOverflowMenu(ref.current);\n }\n }, [registerOverflowMenu, isOverflowing, elementId]);\n\n useIsomorphicLayoutEffect(() => {\n if (isOverflowing) {\n updateOverflow();\n }\n }, [isOverflowing, updateOverflow, ref]);\n\n return { ref, overflowCount, isOverflowing };\n}\n"],"sourceRoot":"../src/"}
|
@@ -60,7 +60,8 @@ exports.Overflow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
60
60
|
const {
|
61
61
|
containerRef,
|
62
62
|
registerItem,
|
63
|
-
updateOverflow
|
63
|
+
updateOverflow,
|
64
|
+
registerOverflowMenu
|
64
65
|
} = useOverflowContainer_1.useOverflowContainer(update, {
|
65
66
|
overflowDirection,
|
66
67
|
overflowAxis,
|
@@ -78,7 +79,8 @@ exports.Overflow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
78
79
|
groupVisibility,
|
79
80
|
hasOverflow,
|
80
81
|
registerItem,
|
81
|
-
updateOverflow
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AE;MACL,cADK;MAEL,eAFK;MAGL,WAHK;MAIL,YAJK;MAKL,cALK;MAML;IANK;EADgB,CAAzB,EAUG,WAVH,CADF;AAcD,CAjDuB,CAAX","sourcesContent":["import * as React from 'react';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { OnUpdateOverflow, OverflowGroupState, ObserveOptions } from '@fluentui/priority-overflow';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\n\nimport { OverflowContext } from '../overflowContext';\nimport { updateVisibilityAttribute, useOverflowContainer } from '../useOverflowContainer';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../constants';\n\nconst useStyles = makeStyles({\n overflowMenu: {\n [`& [${DATA_OVERFLOW_MENU}]`]: {\n flexShrink: 0,\n },\n },\n\n overflowingItems: {\n [`& > [${DATA_OVERFLOWING}]`]: {\n display: 'none',\n },\n },\n});\n\n/**\n * Overflow Props\n */\nexport type OverflowProps = Partial<\n Pick<ObserveOptions, 'overflowAxis' | 'overflowDirection' | 'padding' | 'minimumVisible'>\n> & {\n children: React.ReactElement;\n};\n\n/**\n * Provides an OverflowContext for OverflowItem descendants.\n */\nexport const Overflow = React.forwardRef((props: OverflowProps, ref) => {\n const styles = useStyles();\n\n const { children, minimumVisible, overflowAxis = 'horizontal', overflowDirection, padding } = props;\n\n const [hasOverflow, setHasOverflow] = React.useState(false);\n const [itemVisibility, setItemVisibility] = React.useState<Record<string, boolean>>({});\n const [groupVisibility, setGroupVisibility] = React.useState<Record<string, OverflowGroupState>>({});\n\n // useOverflowContainer wraps this method in a useEventCallback.\n // TODO: Do we need a useEventCallback here too?\n const update: OnUpdateOverflow = data => {\n setHasOverflow(() => data.invisibleItems.length > 0);\n setItemVisibility(() => {\n const newState: Record<string, boolean> = {};\n data.visibleItems.forEach(x => (newState[x.id] = true));\n data.invisibleItems.forEach(x => (newState[x.id] = false));\n return newState;\n });\n setGroupVisibility(data.groupVisibility);\n };\n\n const { containerRef, registerItem, updateOverflow, registerOverflowMenu } = useOverflowContainer(update, {\n overflowDirection,\n overflowAxis,\n padding,\n minimumVisible,\n onUpdateItemVisibility: updateVisibilityAttribute,\n });\n\n const clonedChild = applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n className: mergeClasses(styles.overflowMenu, styles.overflowingItems, children.props.className),\n });\n\n return (\n <OverflowContext.Provider\n value={{\n itemVisibility,\n groupVisibility,\n hasOverflow,\n registerItem,\n updateOverflow,\n registerOverflowMenu,\n }}\n >\n {clonedChild}\n </OverflowContext.Provider>\n );\n});\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/OverflowItem/OverflowItem.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAGA;;;AAGG;;;AACU,OAAA,CAAA,YAAA,gBAAe,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAA2B,GAA3B,KAAkC;EAC7E,MAAM;IAAE,EAAF;IAAM,OAAN;IAAe,QAAf;IAAyB;EAAzB,IAAsC,KAA5C;EAEA,MAAM,YAAY,GAAG,iBAAA,CAAA,eAAA,CAAgB,EAAhB,EAAoB,QAApB,EAA8B,OAA9B,CAArB;EACA,OAAO,iBAAA,CAAA,2BAAA,CAA4B,QAA5B,EAAsC;IAC3C,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,YAAd,EAA4B,GAA5B;EADsC,CAAtC,CAAP;AAGD,CAP2B,CAAf","sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOverflowItem } from '../../useOverflowItem';\nimport { OverflowItemProps } from './OverflowItem.types';\n\n/**\n * Attaches overflow item behavior to its child registered with the OverflowContext.\n * It does not render an element of its own.\n */\nexport const OverflowItem = React.forwardRef((props: OverflowItemProps, ref) => {\n const { id, groupId, priority, children } = props;\n\n const containerRef = useOverflowItem(id, priority, groupId);\n return applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n });\n});\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAGA;;;AAGG;;;AACU,OAAA,CAAA,YAAA,gBAAe,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAA2B,GAA3B,KAAkC;EAC7E,MAAM;IAAE,EAAF;IAAM,OAAN;IAAe,QAAf;IAAyB;EAAzB,IAAsC,KAA5C;EAEA,MAAM,YAAY,GAAG,iBAAA,CAAA,eAAA,CAAgB,EAAhB,EAAoB,QAApB,EAA8B,OAA9B,CAArB;EACA,OAAO,iBAAA,CAAA,2BAAA,CAA4B,QAA5B,EAAsC;IAC3C,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,YAAd,EAA4B,GAA5B;EADsC,CAAtC,CAAP;AAGD,CAP2B,CAAf","sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOverflowItem } from '../../useOverflowItem';\nimport { OverflowItemProps } from './OverflowItem.types';\n\n/**\n * Attaches overflow item behavior to its child registered with the OverflowContext.\n * It does not render an element of its own.\n */\nexport const OverflowItem = React.forwardRef((props: OverflowItemProps, ref) => {\n const { id, groupId, priority, children } = props;\n\n const containerRef = useOverflowItem(id, priority, groupId);\n return applyTriggerPropsToChildren(children, {\n ref: useMergedRefs(containerRef, ref),\n });\n});\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/OverflowItem/index.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,cAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,YAAA;EAAY;AAAZ,CAAA","sourcesContent":["export type { OverflowItemProps } from './OverflowItem.types';\nexport { OverflowItem } from './OverflowItem';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/components/OverflowItem/index.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,cAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,YAAA;EAAY;AAAZ,CAAA","sourcesContent":["export type { OverflowItemProps } from './OverflowItem.types';\nexport { OverflowItem } from './OverflowItem';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["constants.ts"],"names":[],"mappings":";;;;;;AAAa,OAAA,CAAA,gBAAA,GAAmB,kBAAnB;AACA,OAAA,CAAA,kBAAA,GAAqB,oBAArB;AACA,OAAA,CAAA,kBAAA,GAAqB,oBAArB","sourcesContent":["export const DATA_OVERFLOWING = 'data-overflowing';\nexport const DATA_OVERFLOW_ITEM = 'data-overflow-item';\nexport const DATA_OVERFLOW_MENU = 'data-overflow-menu';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/constants.ts"],"names":[],"mappings":";;;;;;AAAa,OAAA,CAAA,gBAAA,GAAmB,kBAAnB;AACA,OAAA,CAAA,kBAAA,GAAqB,oBAArB;AACA,OAAA,CAAA,kBAAA,GAAqB,oBAArB","sourcesContent":["export const DATA_OVERFLOWING = 'data-overflowing';\nexport const DATA_OVERFLOW_ITEM = 'data-overflow-item';\nexport const DATA_OVERFLOW_MENU = 'data-overflow-menu';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,UAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,UAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,UAAA,CAAA,QAAA;EAAQ;AAAR,CAAA;;AAET,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AAAkB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;AAAoB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;;AAE/C,IAAA,2BAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,2BAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;;AACT,IAAA,0BAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA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DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\nexport type { UseOverflowContainerReturn } from './types';\nexport { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';\nexport { useIsOverflowItemVisible } from './useIsOverflowItemVisible';\nexport { useOverflowContainer } from './useOverflowContainer';\nexport { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,UAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,UAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,UAAA,CAAA,QAAA;EAAQ;AAAR,CAAA;;AAET,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AAAkB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;AAAoB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,WAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;;AAE/C,IAAA,2BAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAAS,MAAA,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A;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,cAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,YAAA;EAAY;AAAZ,CAAA","sourcesContent":["export { Overflow } from './components/Overflow';\nexport type { OverflowProps } from './components/Overflow';\nexport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\nexport type { UseOverflowContainerReturn } from './types';\nexport { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';\nexport { useIsOverflowItemVisible } from './useIsOverflowItemVisible';\nexport { useOverflowContainer } from './useOverflowContainer';\nexport { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\n"],"sourceRoot":"../src/"}
|
@@ -5,18 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useOverflowContext = exports.OverflowContext = void 0;
|
7
7
|
|
8
|
-
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
exports.OverflowContext = /*#__PURE__*/react_context_selector_1.createContext(undefined);
|
11
|
+
const overflowContextDefaultValue = {
|
12
12
|
itemVisibility: {},
|
13
13
|
groupVisibility: {},
|
14
14
|
hasOverflow: false,
|
15
15
|
registerItem: () => () => null,
|
16
|
-
updateOverflow: () => null
|
17
|
-
|
16
|
+
updateOverflow: () => null,
|
17
|
+
registerOverflowMenu: () => () => null
|
18
|
+
};
|
18
19
|
|
19
|
-
const useOverflowContext = selector => react_context_selector_1.useContextSelector(exports.OverflowContext, selector);
|
20
|
+
const useOverflowContext = selector => react_context_selector_1.useContextSelector(exports.OverflowContext, (ctx = overflowContextDefaultValue) => selector(ctx));
|
20
21
|
|
21
22
|
exports.useOverflowContext = useOverflowContext;
|
22
23
|
//# sourceMappingURL=overflowContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["overflowContext.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/overflowContext.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAWa,OAAA,CAAA,eAAA,gBAAkB,wBAAA,CAAA,aAAA,CAC7B,SAD6B,CAAlB;AAIb,MAAM,2BAA2B,GAAyB;EACxD,cAAc,EAAE,EADwC;EAExD,eAAe,EAAE,EAFuC;EAGxD,WAAW,EAAE,KAH2C;EAIxD,YAAY,EAAE,MAAM,MAAM,IAJ8B;EAKxD,cAAc,EAAE,MAAM,IALkC;EAMxD,oBAAoB,EAAE,MAAM,MAAM;AANsB,CAA1D;;AASO,MAAM,kBAAkB,GAAmB,QAAhB,IAChC,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,eAAnB,EAAoC,CAAC,GAAG,GAAG,2BAAP,KAAuC,QAAQ,CAAC,GAAD,CAAnF,CADK;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import type { OverflowGroupState, OverflowItemEntry } from '@fluentui/priority-overflow';\nimport { ContextSelector, createContext, useContextSelector, Context } from '@fluentui/react-context-selector';\n\nexport interface OverflowContextValue {\n itemVisibility: Record<string, boolean>;\n groupVisibility: Record<string, OverflowGroupState>;\n hasOverflow: boolean;\n registerItem: (item: OverflowItemEntry) => () => void;\n registerOverflowMenu: (el: HTMLElement) => () => void;\n updateOverflow: (padding?: number) => void;\n}\n\nexport const OverflowContext = createContext<OverflowContextValue | undefined>(\n undefined,\n) as Context<OverflowContextValue>;\n\nconst overflowContextDefaultValue: OverflowContextValue = {\n itemVisibility: {},\n groupVisibility: {},\n hasOverflow: false,\n registerItem: () => () => null,\n updateOverflow: () => null,\n registerOverflowMenu: () => () => null,\n};\n\nexport const useOverflowContext = <SelectedValue>(selector: ContextSelector<OverflowContextValue, SelectedValue>) =>\n useContextSelector(OverflowContext, (ctx = overflowContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsOverflowGroupVisible.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,yBAAhB,CAA0C,EAA1C,EAAoD;EAClD,OAAO,iBAAA,CAAA,kBAAA,CAAmB,GAAG,IAAI,GAAG,CAAC,eAAJ,CAAoB,EAApB,CAA1B,CAAP;AACD;;AAFD,OAAA,CAAA,yBAAA,GAAA,yBAAA","sourcesContent":["import { OverflowGroupState } from '@fluentui/priority-overflow';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for a group of overflow items\n * @returns visibility state of the group\n */\nexport function useIsOverflowGroupVisible(id: string): OverflowGroupState {\n return useOverflowContext(ctx => ctx.groupVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useIsOverflowGroupVisible.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,yBAAhB,CAA0C,EAA1C,EAAoD;EAClD,OAAO,iBAAA,CAAA,kBAAA,CAAmB,GAAG,IAAI,GAAG,CAAC,eAAJ,CAAoB,EAApB,CAA1B,CAAP;AACD;;AAFD,OAAA,CAAA,yBAAA,GAAA,yBAAA","sourcesContent":["import { OverflowGroupState } from '@fluentui/priority-overflow';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for a group of overflow items\n * @returns visibility state of the group\n */\nexport function useIsOverflowGroupVisible(id: string): OverflowGroupState {\n return useOverflowContext(ctx => ctx.groupVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsOverflowItemVisible.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,wBAAhB,CAAyC,EAAzC,EAAmD;EACjD,OAAO,CAAC,CAAC,iBAAA,CAAA,kBAAA,CAAmB,GAAG,IAAI,GAAG,CAAC,cAAJ,CAAmB,EAAnB,CAA1B,CAAT;AACD;;AAFD,OAAA,CAAA,wBAAA,GAAA,wBAAA","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for the item used by the overflow manager\n * @returns visibility state of an overflow item\n */\nexport function useIsOverflowItemVisible(id: string): boolean {\n return !!useOverflowContext(ctx => ctx.itemVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useIsOverflowItemVisible.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,wBAAhB,CAAyC,EAAzC,EAAmD;EACjD,OAAO,CAAC,CAAC,iBAAA,CAAA,kBAAA,CAAmB,GAAG,IAAI,GAAG,CAAC,cAAJ,CAAmB,EAAnB,CAA1B,CAAT;AACD;;AAFD,OAAA,CAAA,wBAAA,GAAA,wBAAA","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @param id - unique identifier for the item used by the overflow manager\n * @returns visibility state of an overflow item\n */\nexport function useIsOverflowItemVisible(id: string): boolean {\n return !!useOverflowContext(ctx => ctx.itemVisibility[id]);\n}\n"],"sourceRoot":"../src/"}
|
@@ -63,10 +63,19 @@ const useOverflowContainer = (update, options) => {
|
|
63
63
|
const updateOverflow = React.useCallback(() => {
|
64
64
|
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.update();
|
65
65
|
}, [overflowManager]);
|
66
|
+
const registerOverflowMenu = React.useCallback(el => {
|
67
|
+
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.addOverflowMenu(el);
|
68
|
+
el.setAttribute(constants_1.DATA_OVERFLOW_MENU, '');
|
69
|
+
return () => {
|
70
|
+
overflowManager === null || overflowManager === void 0 ? void 0 : overflowManager.removeOverflowMenu();
|
71
|
+
el.removeAttribute(constants_1.DATA_OVERFLOW_MENU);
|
72
|
+
};
|
73
|
+
}, [overflowManager]);
|
66
74
|
return {
|
67
75
|
containerRef,
|
68
76
|
registerItem,
|
69
|
-
updateOverflow
|
77
|
+
updateOverflow,
|
78
|
+
registerOverflowMenu
|
70
79
|
};
|
71
80
|
};
|
72
81
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowContainer.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAYA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAEA;;;;;AAKG;;;AACI,MAAM,oBAAoB,GAAG,CAClC,MADkC,EAElC,OAFkC,KAGM;EACxC,MAAM;IAAE,YAAF;IAAgB,iBAAhB;IAAmC,OAAnC;IAA4C,cAA5C;IAA4D;EAA5D,IAAuF,OAA7F,CADwC,CAGxC;;EACA,MAAM,YAAY,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAArB;EACA,MAAM,mBAAmB,GAAG,iBAAA,CAAA,gBAAA,CAAiB,MAAjB,CAA5B;EAEA,MAAM,CAAC,eAAD,IAAoB,KAAK,CAAC,QAAN,CAAuC,MAC/D,iBAAA,CAAA,SAA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,yBAAyB,GAA2B,CAAC;EAAE,IAAF;EAAQ;AAAR,CAAD,KAAsB;EACrF,IAAI,OAAJ,EAAa;IACX,IAAI,CAAC,OAAL,CAAa,eAAb,CAA6B,WAAA,CAAA,gBAA7B;EACD,CAFD,MAEO;IACL,IAAI,CAAC,OAAL,CAAa,YAAb,CAA0B,WAAA,CAAA,gBAA1B,EAA4C,EAA5C;EACD;AACF,CANM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { createOverflowManager } from '@fluentui/priority-overflow';\n\n/**\n * @internal\n */\nimport type {\n OnUpdateItemVisibility,\n OnUpdateOverflow,\n OverflowItemEntry,\n OverflowManager,\n ObserveOptions,\n} from '@fluentui/priority-overflow';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { UseOverflowContainerReturn } from './types';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU } from './constants';\n\n/**\n * @internal\n * @param update - Callback when overflow state changes\n * @param options - Options to configure the overflow container\n * @returns - ref to attach to an intrinsic HTML element and imperative functions\n */\nexport const useOverflowContainer = <TElement extends HTMLElement>(\n update: OnUpdateOverflow,\n options: Omit<ObserveOptions, 'onUpdateOverflow'>,\n): UseOverflowContainerReturn<TElement> => {\n const { overflowAxis, overflowDirection, padding, minimumVisible, onUpdateItemVisibility } = options;\n\n // DOM ref to the overflow container element\n const containerRef = React.useRef<TElement>(null);\n const updateOverflowItems = useEventCallback(update);\n\n const [overflowManager] = React.useState<OverflowManager | null>(() =>\n canUseDOM() ? createOverflowManager() : null,\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!containerRef.current) {\n return;\n }\n\n if (overflowManager) {\n overflowManager.observe(containerRef.current, {\n overflowDirection: overflowDirection ?? 'end',\n overflowAxis: overflowAxis ?? 'horizontal',\n padding: padding ?? 10,\n minimumVisible: minimumVisible ?? 0,\n onUpdateItemVisibility: onUpdateItemVisibility ?? (() => undefined),\n onUpdateOverflow: updateOverflowItems ?? (() => undefined),\n });\n\n return () => {\n overflowManager.disconnect();\n };\n }\n }, [\n updateOverflowItems,\n overflowManager,\n overflowDirection,\n overflowAxis,\n padding,\n minimumVisible,\n onUpdateItemVisibility,\n ]);\n\n const registerItem = React.useCallback(\n (item: OverflowItemEntry) => {\n overflowManager?.addItem(item);\n item.element.setAttribute(DATA_OVERFLOW_ITEM, '');\n\n return () => {\n item.element.removeAttribute(DATA_OVERFLOWING);\n item.element.removeAttribute(DATA_OVERFLOW_ITEM);\n overflowManager?.removeItem(item.id);\n };\n },\n [overflowManager],\n );\n\n const updateOverflow = React.useCallback(() => {\n overflowManager?.update();\n }, [overflowManager]);\n\n const registerOverflowMenu = React.useCallback(\n (el: HTMLElement) => {\n overflowManager?.addOverflowMenu(el);\n el.setAttribute(DATA_OVERFLOW_MENU, '');\n\n return () => {\n overflowManager?.removeOverflowMenu();\n el.removeAttribute(DATA_OVERFLOW_MENU);\n };\n },\n [overflowManager],\n );\n\n return {\n containerRef,\n registerItem,\n updateOverflow,\n registerOverflowMenu,\n };\n};\n\nexport const updateVisibilityAttribute: OnUpdateItemVisibility = ({ item, visible }) => {\n if (visible) {\n item.element.removeAttribute(DATA_OVERFLOWING);\n } else {\n item.element.setAttribute(DATA_OVERFLOWING, '');\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowCount.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,gBAAgB,GAAG,MAC9B,iBAAA,CAAA,kBAAA,CAAmB,CAAC,IAAG;EACrB,OAAO,MAAM,CAAC,OAAP,CAAe,CAAC,CAAC,cAAjB,EAAiC,MAAjC,CAAwC,CAAC,GAAD,EAAM,CAAC,EAAD,EAAK,OAAL,CAAN,KAAuB;IACpE,IAAI,CAAC,OAAL,EAAc;MACZ,GAAG;IACJ;;IAED,OAAO,GAAP;EACD,CANM,EAMJ,CANI,CAAP;AAOD,CARD,CADK;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @returns Number of items that are overflowing\n */\nexport const useOverflowCount = () =>\n useOverflowContext(v => {\n return Object.entries(v.itemVisibility).reduce((acc, [id, visible]) => {\n if (!visible) {\n acc++;\n }\n\n return acc;\n }, 0);\n });\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowCount.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,gBAAgB,GAAG,MAC9B,iBAAA,CAAA,kBAAA,CAAmB,CAAC,IAAG;EACrB,OAAO,MAAM,CAAC,OAAP,CAAe,CAAC,CAAC,cAAjB,EAAiC,MAAjC,CAAwC,CAAC,GAAD,EAAM,CAAC,EAAD,EAAK,OAAL,CAAN,KAAuB;IACpE,IAAI,CAAC,OAAL,EAAc;MACZ,GAAG;IACJ;;IAED,OAAO,GAAP;EACD,CANM,EAMJ,CANI,CAAP;AAOD,CARD,CADK;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import { useOverflowContext } from './overflowContext';\n\n/**\n * @returns Number of items that are overflowing\n */\nexport const useOverflowCount = () =>\n useOverflowContext(v => {\n return Object.entries(v.itemVisibility).reduce((acc, [id, visible]) => {\n if (!visible) {\n acc++;\n }\n\n return acc;\n }, 0);\n });\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowItem.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,eAAhB,CAA8D,EAA9D,EAA0E,QAA1E,EAA6F,OAA7F,EAA6G;EAC3G,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EACA,MAAM,YAAY,GAAG,iBAAA,CAAA,kBAAA,CAAmB,CAAC,IAAI,CAAC,CAAC,YAA1B,CAArB;EAEA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;IAC7B,IAAI,GAAG,CAAC,OAAR,EAAiB;MACf,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC,OADK;QAElB,EAFkB;QAGlB,QAAQ,EAAE,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAHJ;QAIlB;MAJkB,CAAD,CAAnB;IAMD;EACF,CATD,EASG,CAAC,EAAD,EAAK,QAAL,EAAe,YAAf,EAA6B,OAA7B,CATH;EAWA,OAAO,GAAP;AACD;;AAhBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @internal\n * Registers an overflow item\n * @param id - unique identifier for the item used by the overflow manager\n * @param priority - higher priority means the item overflows later\n * @param groupId - assigns the item to a group, group visibility can be watched\n * @returns ref to assign to an intrinsic HTML element\n */\nexport function useOverflowItem<TElement extends HTMLElement>(id: string, priority?: number, groupId?: string) {\n const ref = React.useRef<TElement>(null);\n const registerItem = useOverflowContext(v => v.registerItem);\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerItem({\n element: ref.current,\n id,\n priority: priority ?? 0,\n groupId,\n });\n }\n }, [id, priority, registerItem, groupId]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["packages/react-components/react-overflow/src/useOverflowItem.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,eAAhB,CAA8D,EAA9D,EAA0E,QAA1E,EAA6F,OAA7F,EAA6G;EAC3G,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EACA,MAAM,YAAY,GAAG,iBAAA,CAAA,kBAAA,CAAmB,CAAC,IAAI,CAAC,CAAC,YAA1B,CAArB;EAEA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;IAC7B,IAAI,GAAG,CAAC,OAAR,EAAiB;MACf,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC,OADK;QAElB,EAFkB;QAGlB,QAAQ,EAAE,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,CAHJ;QAIlB;MAJkB,CAAD,CAAnB;IAMD;EACF,CATD,EASG,CAAC,EAAD,EAAK,QAAL,EAAe,YAAf,EAA6B,OAA7B,CATH;EAWA,OAAO,GAAP;AACD;;AAhBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\n\n/**\n * @internal\n * Registers an overflow item\n * @param id - unique identifier for the item used by the overflow manager\n * @param priority - higher priority means the item overflows later\n * @param groupId - assigns the item to a group, group visibility can be watched\n * @returns ref to assign to an intrinsic HTML element\n */\nexport function useOverflowItem<TElement extends HTMLElement>(id: string, priority?: number, groupId?: string) {\n const ref = React.useRef<TElement>(null);\n const registerItem = useOverflowContext(v => v.registerItem);\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerItem({\n element: ref.current,\n id,\n priority: priority ?? 0,\n groupId,\n });\n }\n }, [id, priority, registerItem, groupId]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}
|
@@ -13,31 +13,18 @@ const overflowContext_1 = /*#__PURE__*/require("./overflowContext");
|
|
13
13
|
|
14
14
|
const useOverflowCount_1 = /*#__PURE__*/require("./useOverflowCount");
|
15
15
|
|
16
|
-
const constants_1 = /*#__PURE__*/require("./constants");
|
17
|
-
|
18
16
|
function useOverflowMenu(id) {
|
19
17
|
const elementId = react_utilities_1.useId('overflow-menu', id);
|
20
18
|
const overflowCount = useOverflowCount_1.useOverflowCount();
|
21
|
-
const
|
19
|
+
const registerOverflowMenu = overflowContext_1.useOverflowContext(v => v.registerOverflowMenu);
|
22
20
|
const updateOverflow = overflowContext_1.useOverflowContext(v => v.updateOverflow);
|
23
21
|
const ref = React.useRef(null);
|
24
22
|
const isOverflowing = overflowCount > 0;
|
25
23
|
react_utilities_1.useIsomorphicLayoutEffect(() => {
|
26
|
-
|
27
|
-
|
28
|
-
if (element) {
|
29
|
-
const deregisterItem = registerItem({
|
30
|
-
element,
|
31
|
-
id: elementId,
|
32
|
-
priority: Infinity
|
33
|
-
});
|
34
|
-
element.setAttribute(constants_1.DATA_OVERFLOW_MENU, '');
|
35
|
-
return () => {
|
36
|
-
deregisterItem();
|
37
|
-
element === null || element === void 0 ? void 0 : element.removeAttribute(constants_1.DATA_OVERFLOW_MENU);
|
38
|
-
};
|
24
|
+
if (ref.current) {
|
25
|
+
return registerOverflowMenu(ref.current);
|
39
26
|
}
|
40
|
-
}, [
|
27
|
+
}, [registerOverflowMenu, isOverflowing, elementId]);
|
41
28
|
react_utilities_1.useIsomorphicLayoutEffect(() => {
|
42
29
|
if (isOverflowing) {
|
43
30
|
updateOverflow();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOverflowMenu.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAA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AAF;IAAO,aAAP;IAAsB;EAAtB,CAAP;AACD;;AArBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import * as React from 'react';\nimport { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useOverflowContext } from './overflowContext';\nimport { useOverflowCount } from './useOverflowCount';\n\nexport function useOverflowMenu<TElement extends HTMLElement>(id?: string) {\n const elementId = useId('overflow-menu', id);\n const overflowCount = useOverflowCount();\n const registerOverflowMenu = useOverflowContext(v => v.registerOverflowMenu);\n const updateOverflow = useOverflowContext(v => v.updateOverflow);\n const ref = React.useRef<TElement>(null);\n const isOverflowing = overflowCount > 0;\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) {\n return registerOverflowMenu(ref.current);\n }\n }, [registerOverflowMenu, isOverflowing, elementId]);\n\n useIsomorphicLayoutEffect(() => {\n if (isOverflowing) {\n updateOverflow();\n }\n }, [isOverflowing, updateOverflow, ref]);\n\n return { ref, overflowCount, isOverflowing };\n}\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-overflow",
|
3
|
-
"version": "9.0.0-
|
3
|
+
"version": "9.0.0-rc.1",
|
4
4
|
"description": "React bindings for @fluentui/priority-overflow",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
|
-
"typings": "dist/index.d.ts",
|
7
|
+
"typings": "./dist/index.d.ts",
|
8
8
|
"sideEffects": false,
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -16,32 +16,33 @@
|
|
16
16
|
"bundle-size": "bundle-size measure",
|
17
17
|
"clean": "just-scripts clean",
|
18
18
|
"code-style": "just-scripts code-style",
|
19
|
+
"e2e": "cypress run --component",
|
20
|
+
"e2e:local": "cypress open --component",
|
19
21
|
"just": "just-scripts",
|
20
22
|
"lint": "just-scripts lint",
|
21
23
|
"start": "yarn storybook",
|
22
24
|
"test": "jest --passWithNoTests",
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"type-check": "tsc -b tsconfig.json"
|
25
|
+
"storybook": "start-storybook",
|
26
|
+
"type-check": "tsc -b tsconfig.json",
|
27
|
+
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
|
27
28
|
},
|
28
29
|
"devDependencies": {
|
29
30
|
"@fluentui/eslint-plugin": "*",
|
30
31
|
"@fluentui/scripts": "^1.0.0"
|
31
32
|
},
|
32
33
|
"dependencies": {
|
33
|
-
"@fluentui/priority-overflow": "^9.0.0-
|
34
|
-
"@fluentui/react-context-selector": "^9.
|
35
|
-
"@fluentui/react-theme": "^9.
|
36
|
-
"@fluentui/react-utilities": "^9.
|
37
|
-
"@griffel/react": "^1.2
|
34
|
+
"@fluentui/priority-overflow": "^9.0.0-rc.1",
|
35
|
+
"@fluentui/react-context-selector": "^9.1.2",
|
36
|
+
"@fluentui/react-theme": "^9.1.2",
|
37
|
+
"@fluentui/react-utilities": "^9.2.2",
|
38
|
+
"@griffel/react": "^1.4.2",
|
38
39
|
"tslib": "^2.1.0"
|
39
40
|
},
|
40
41
|
"peerDependencies": {
|
41
|
-
"@types/react": ">=16.8.0 <
|
42
|
-
"@types/react-dom": ">=16.8.0 <
|
43
|
-
"react": ">=16.8.0 <
|
44
|
-
"react-dom": ">=16.8.0 <
|
42
|
+
"@types/react": ">=16.8.0 <19.0.0",
|
43
|
+
"@types/react-dom": ">=16.8.0 <19.0.0",
|
44
|
+
"react": ">=16.8.0 <19.0.0",
|
45
|
+
"react-dom": ">=16.8.0 <19.0.0",
|
45
46
|
"scheduler": "^0.19.0 || ^0.20.0"
|
46
47
|
},
|
47
48
|
"beachball": {
|
@@ -50,5 +51,13 @@
|
|
50
51
|
"minor",
|
51
52
|
"patch"
|
52
53
|
]
|
54
|
+
},
|
55
|
+
"exports": {
|
56
|
+
".": {
|
57
|
+
"types": "./dist/index.d.ts",
|
58
|
+
"import": "./lib/index.js",
|
59
|
+
"require": "./lib-commonjs/index.js"
|
60
|
+
},
|
61
|
+
"./package.json": "./package.json"
|
53
62
|
}
|
54
63
|
}
|
package/dist/tsdoc-metadata.json
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
3
|
-
{
|
4
|
-
"tsdocVersion": "0.12",
|
5
|
-
"toolPackages": [
|
6
|
-
{
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
8
|
-
"packageVersion": "7.18.1"
|
9
|
-
}
|
10
|
-
]
|
11
|
-
}
|