@fluentui/react-overflow 9.8.0 → 9.9.0
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.md +20 -2
- package/dist/index.d.ts +99 -17
- package/lib/components/Overflow/Overflow.js +14 -0
- package/lib/components/Overflow/Overflow.js.map +1 -0
- package/lib/components/Overflow/Overflow.types.js +3 -0
- package/lib/components/Overflow/Overflow.types.js.map +1 -0
- package/lib/components/Overflow/index.js +4 -0
- package/lib/components/Overflow/index.js.map +1 -0
- package/lib/components/Overflow/renderOverflow.js +19 -0
- package/lib/components/Overflow/renderOverflow.js.map +1 -0
- package/lib/components/Overflow/useOverflow.js +42 -0
- package/lib/components/Overflow/useOverflow.js.map +1 -0
- package/lib/components/Overflow/useOverflowStyles.styles.js +22 -0
- package/lib/components/Overflow/useOverflowStyles.styles.js.map +1 -0
- package/lib/components/Overflow/useOverflowStyles.styles.raw.js +23 -0
- package/lib/components/Overflow/useOverflowStyles.styles.raw.js.map +1 -0
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/overflowContext.js +23 -10
- package/lib/overflowContext.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/useIsOverflowGroupVisible.js +2 -2
- package/lib/useIsOverflowGroupVisible.js.map +1 -1
- package/lib/useIsOverflowItemVisible.js +2 -2
- package/lib/useIsOverflowItemVisible.js.map +1 -1
- package/lib/useOverflowContainer.js +64 -55
- package/lib/useOverflowContainer.js.map +1 -1
- package/lib/useOverflowContextValues.js +35 -0
- package/lib/useOverflowContextValues.js.map +1 -0
- package/lib/useOverflowCount.js +3 -9
- package/lib/useOverflowCount.js.map +1 -1
- package/lib/useOverflowMenu.js +10 -12
- package/lib/useOverflowMenu.js.map +1 -1
- package/lib/useOverflowSnapshot.js +23 -0
- package/lib/useOverflowSnapshot.js.map +1 -0
- package/lib/useOverflowVisibility.js +6 -11
- package/lib/useOverflowVisibility.js.map +1 -1
- package/lib-commonjs/components/Overflow/Overflow.js +23 -0
- package/lib-commonjs/components/Overflow/Overflow.js.map +1 -0
- package/lib-commonjs/components/Overflow/Overflow.types.js +6 -0
- package/lib-commonjs/components/Overflow/Overflow.types.js.map +1 -0
- package/lib-commonjs/components/Overflow/index.js +28 -0
- package/lib-commonjs/components/Overflow/index.js.map +1 -0
- package/lib-commonjs/components/Overflow/renderOverflow.js +25 -0
- package/lib-commonjs/components/Overflow/renderOverflow.js.map +1 -0
- package/lib-commonjs/components/Overflow/useOverflow.js +47 -0
- package/lib-commonjs/components/Overflow/useOverflow.js.map +1 -0
- package/lib-commonjs/components/Overflow/useOverflowStyles.styles.js +41 -0
- package/lib-commonjs/components/Overflow/useOverflowStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Overflow/useOverflowStyles.styles.raw.js +41 -0
- package/lib-commonjs/components/Overflow/useOverflowStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/index.js +16 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/overflowContext.js +23 -8
- package/lib-commonjs/overflowContext.js.map +1 -1
- package/lib-commonjs/types.js +1 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/useIsOverflowGroupVisible.js +2 -2
- package/lib-commonjs/useIsOverflowGroupVisible.js.map +1 -1
- package/lib-commonjs/useIsOverflowItemVisible.js +2 -2
- package/lib-commonjs/useIsOverflowItemVisible.js.map +1 -1
- package/lib-commonjs/useOverflowContainer.js +62 -53
- package/lib-commonjs/useOverflowContainer.js.map +1 -1
- package/lib-commonjs/useOverflowContextValues.js +41 -0
- package/lib-commonjs/useOverflowContextValues.js.map +1 -0
- package/lib-commonjs/useOverflowCount.js +3 -9
- package/lib-commonjs/useOverflowCount.js.map +1 -1
- package/lib-commonjs/useOverflowMenu.js +10 -12
- package/lib-commonjs/useOverflowMenu.js.map +1 -1
- package/lib-commonjs/useOverflowSnapshot.js +30 -0
- package/lib-commonjs/useOverflowSnapshot.js.map +1 -0
- package/lib-commonjs/useOverflowVisibility.js +6 -12
- package/lib-commonjs/useOverflowVisibility.js.map +1 -1
- package/package.json +3 -4
- package/lib/components/Overflow.js +0 -61
- package/lib/components/Overflow.js.map +0 -1
- package/lib/components/useOverflowStyles.styles.js +0 -14
- package/lib/components/useOverflowStyles.styles.js.map +0 -1
- package/lib/components/useOverflowStyles.styles.raw.js +0 -15
- package/lib/components/useOverflowStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Overflow.js +0 -70
- package/lib-commonjs/components/Overflow.js.map +0 -1
- package/lib-commonjs/components/useOverflowStyles.styles.js +0 -25
- package/lib-commonjs/components/useOverflowStyles.styles.js.map +0 -1
- package/lib-commonjs/components/useOverflowStyles.styles.raw.js +0 -25
- package/lib-commonjs/components/useOverflowStyles.styles.raw.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-overflow
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 24 Jun 2026 11:03:38 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.9.0)
|
|
8
|
+
|
|
9
|
+
Wed, 24 Jun 2026 11:03:38 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.8.0..@fluentui/react-overflow_v9.9.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- Expose Overflow use/render/styles hooks, provider and context types for headless consumers ([PR #36304](https://github.com/microsoft/fluentui/pull/36304) by vgenaev@gmail.com)
|
|
15
|
+
- feat: produce a correct overflow snapshot before the first paint ([PR #36264](https://github.com/microsoft/fluentui/pull/36264) by bsunderhus@microsoft.com)
|
|
16
|
+
- Bump @fluentui/priority-overflow to v9.4.0 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- fix: remove redundant use no memo directives, and add justification to valid ones ([PR #36224](https://github.com/microsoft/fluentui/pull/36224) by martinhochel@microsoft.com)
|
|
22
|
+
- fix: make Overflow container strict-mode safe ([PR #36262](https://github.com/microsoft/fluentui/pull/36262) by bsunderhus@microsoft.com)
|
|
23
|
+
- fix: subscribe overflow hooks directly to the manager snapshot ([PR #36263](https://github.com/microsoft/fluentui/pull/36263) by bsunderhus@microsoft.com)
|
|
24
|
+
|
|
7
25
|
## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.8.0)
|
|
8
26
|
|
|
9
|
-
Tue, 26 May 2026 09:
|
|
27
|
+
Tue, 26 May 2026 09:39:28 GMT
|
|
10
28
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.7.2..@fluentui/react-overflow_v9.8.0)
|
|
11
29
|
|
|
12
30
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { OnUpdateOverflow } from '@fluentui/priority-overflow';
|
|
1
|
+
import { OnUpdateItemVisibility } from '@fluentui/priority-overflow';
|
|
2
|
+
import { OnUpdateOverflow } from '@fluentui/priority-overflow';
|
|
4
3
|
import type { OverflowDividerEntry } from '@fluentui/priority-overflow';
|
|
5
|
-
import {
|
|
4
|
+
import { OverflowEventPayload } from '@fluentui/priority-overflow';
|
|
5
|
+
import type { OverflowGroupState } from '@fluentui/priority-overflow';
|
|
6
6
|
import type { OverflowItemEntry } from '@fluentui/priority-overflow';
|
|
7
|
+
import { OverflowOptions } from '@fluentui/priority-overflow';
|
|
8
|
+
import type { OverflowSnapshot } from '@fluentui/priority-overflow';
|
|
7
9
|
import * as React_2 from 'react';
|
|
8
10
|
|
|
9
11
|
export declare const DATA_OVERFLOW_DIVIDER = "data-overflow-divider";
|
|
@@ -17,28 +19,71 @@ export declare const DATA_OVERFLOWING = "data-overflowing";
|
|
|
17
19
|
export declare interface OnOverflowChangeData extends OverflowState {
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
export { OnUpdateItemVisibility }
|
|
23
|
+
|
|
24
|
+
export { OnUpdateOverflow }
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
27
|
* Provides an OverflowContext for OverflowItem descendants.
|
|
22
28
|
*/
|
|
23
|
-
export declare const Overflow: React_2.ForwardRefExoticComponent<Partial<Pick<
|
|
29
|
+
export declare const Overflow: React_2.ForwardRefExoticComponent<Partial<Pick<OverflowOptions, "overflowAxis" | "overflowDirection" | "padding" | "minimumVisible" | "hasHiddenItems">> & {
|
|
24
30
|
children: React_2.ReactElement;
|
|
25
31
|
onOverflowChange?: (ev: null, data: OverflowState) => void;
|
|
26
32
|
} & React_2.RefAttributes<unknown>>;
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
35
|
+
* State used in rendering Overflow. Carries the overflow container's registration api so
|
|
36
|
+
* `useOverflowContextValues_unstable` can assemble the context values.
|
|
30
37
|
*/
|
|
31
|
-
declare
|
|
38
|
+
export declare type OverflowComponentState = UseOverflowContainerReturn<HTMLElement> & {
|
|
39
|
+
/**
|
|
40
|
+
* Merged ref applied to the cloned child's root element.
|
|
41
|
+
*/
|
|
42
|
+
ref: React_2.Ref<HTMLElement>;
|
|
43
|
+
/**
|
|
44
|
+
* Class name applied to the cloned child. Set by `useOverflowStyles_unstable`; left `undefined`
|
|
45
|
+
* by headless consumers that apply no styling.
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The single child that overflow behavior is attached to.
|
|
50
|
+
*/
|
|
51
|
+
children: React_2.ReactElement;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export declare interface OverflowContextValue {
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead
|
|
60
|
+
*/
|
|
32
61
|
itemVisibility: Record<string, boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead
|
|
64
|
+
*/
|
|
33
65
|
groupVisibility: Record<string, OverflowGroupState>;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead
|
|
68
|
+
*/
|
|
34
69
|
hasOverflow: boolean;
|
|
35
70
|
registerItem: (item: OverflowItemEntry) => () => void;
|
|
36
71
|
registerOverflowMenu: (el: HTMLElement) => () => void;
|
|
37
72
|
registerDivider: (divider: OverflowDividerEntry) => () => void;
|
|
38
73
|
updateOverflow: (padding?: number) => void;
|
|
74
|
+
forceUpdateOverflow: () => void;
|
|
39
75
|
containerRef?: React_2.RefObject<HTMLElement | null>;
|
|
76
|
+
getSnapshot: () => OverflowSnapshot;
|
|
77
|
+
subscribe: (listener: () => void) => () => void;
|
|
40
78
|
}
|
|
41
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Context values provided to overflow descendants.
|
|
82
|
+
*/
|
|
83
|
+
export declare type OverflowContextValues = {
|
|
84
|
+
overflow: OverflowContextValue;
|
|
85
|
+
};
|
|
86
|
+
|
|
42
87
|
/**
|
|
43
88
|
* Attaches overflow item behavior to its child registered with the OverflowContext.
|
|
44
89
|
* It does not render an element of its own.
|
|
@@ -48,7 +93,7 @@ export declare const OverflowDivider: React_2.ForwardRefExoticComponent<Overflow
|
|
|
48
93
|
/**
|
|
49
94
|
* OverflowDividerProps
|
|
50
95
|
*/
|
|
51
|
-
declare type OverflowDividerProps = {
|
|
96
|
+
export declare type OverflowDividerProps = {
|
|
52
97
|
/**
|
|
53
98
|
* Assigns the item to a group, group visibility can be watched.
|
|
54
99
|
*/
|
|
@@ -59,6 +104,8 @@ declare type OverflowDividerProps = {
|
|
|
59
104
|
children: React_2.ReactElement;
|
|
60
105
|
};
|
|
61
106
|
|
|
107
|
+
export { OverflowEventPayload }
|
|
108
|
+
|
|
62
109
|
/**
|
|
63
110
|
* Attaches overflow item behavior to its child registered with the OverflowContext.
|
|
64
111
|
* It does not render an element of its own.
|
|
@@ -99,14 +146,18 @@ export declare type OverflowItemProps = {
|
|
|
99
146
|
priority?: number;
|
|
100
147
|
});
|
|
101
148
|
|
|
102
|
-
|
|
103
|
-
* Overflow Props
|
|
104
|
-
*/
|
|
105
|
-
export declare type OverflowProps = Partial<Pick<ObserveOptions, 'overflowAxis' | 'overflowDirection' | 'padding' | 'minimumVisible' | 'hasHiddenItems'>> & {
|
|
149
|
+
export declare type OverflowProps = Partial<Pick<OverflowOptions, 'overflowAxis' | 'overflowDirection' | 'padding' | 'minimumVisible' | 'hasHiddenItems'>> & {
|
|
106
150
|
children: React_2.ReactElement;
|
|
107
151
|
onOverflowChange?: (ev: null, data: OverflowState) => void;
|
|
108
152
|
};
|
|
109
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Provides an {@link OverflowContextValue} to descendant overflow hooks and components.
|
|
156
|
+
* Used by headless consumers that build their own overflow root.
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
export declare const OverflowProvider: React_2.Provider<OverflowContextValue>;
|
|
160
|
+
|
|
110
161
|
/**
|
|
111
162
|
* Renderless opt-in component that observes the `<Overflow>` container for
|
|
112
163
|
* direct-child DOM mutations and triggers an overflow recompute. Drop it
|
|
@@ -127,12 +178,20 @@ export declare type OverflowProps = Partial<Pick<ObserveOptions, 'overflowAxis'
|
|
|
127
178
|
*/
|
|
128
179
|
export declare const OverflowReorderObserver: React_2.FC;
|
|
129
180
|
|
|
130
|
-
declare interface OverflowState {
|
|
181
|
+
export declare interface OverflowState {
|
|
131
182
|
hasOverflow: boolean;
|
|
132
183
|
itemVisibility: Record<string, boolean>;
|
|
133
184
|
groupVisibility: Record<string, OverflowGroupState>;
|
|
134
185
|
}
|
|
135
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Render the final JSX of Overflow.
|
|
189
|
+
*
|
|
190
|
+
* Griffel-free so it can be reused by headless consumers; all class merging happens in
|
|
191
|
+
* `useOverflowStyles_unstable`.
|
|
192
|
+
*/
|
|
193
|
+
export declare const renderOverflow_unstable: (state: OverflowComponentState, contextValues: OverflowContextValues) => React_2.ReactElement;
|
|
194
|
+
|
|
136
195
|
/**
|
|
137
196
|
* @param id - unique identifier for a group of overflow items
|
|
138
197
|
* @returns visibility state of the group
|
|
@@ -145,18 +204,26 @@ export declare function useIsOverflowGroupVisible(id: string): OverflowGroupStat
|
|
|
145
204
|
*/
|
|
146
205
|
export declare function useIsOverflowItemVisible(id: string): boolean;
|
|
147
206
|
|
|
207
|
+
/**
|
|
208
|
+
* The state required to render Overflow.
|
|
209
|
+
*
|
|
210
|
+
* @param props - props from this instance of Overflow
|
|
211
|
+
* @param ref - reference forwarded to the single child's root element
|
|
212
|
+
*/
|
|
213
|
+
export declare const useOverflow_unstable: (props: OverflowProps, ref: React_2.Ref<HTMLElement>) => OverflowComponentState;
|
|
214
|
+
|
|
148
215
|
/**
|
|
149
216
|
* @internal
|
|
150
217
|
* @param update - Callback when overflow state changes
|
|
151
218
|
* @param options - Options to configure the overflow container
|
|
152
219
|
* @returns - ref to attach to an intrinsic HTML element and imperative functions
|
|
153
220
|
*/
|
|
154
|
-
export declare const useOverflowContainer: <TElement extends HTMLElement>(update: OnUpdateOverflow, options: Omit<
|
|
221
|
+
export declare const useOverflowContainer: <TElement extends HTMLElement>(update: OnUpdateOverflow, options: Omit<OverflowOptions, "onUpdateOverflow">) => UseOverflowContainerReturn<TElement>;
|
|
155
222
|
|
|
156
223
|
/**
|
|
157
|
-
* @
|
|
224
|
+
* @public
|
|
158
225
|
*/
|
|
159
|
-
export declare interface UseOverflowContainerReturn<TElement extends HTMLElement> extends Pick<OverflowContextValue, 'registerItem' | 'updateOverflow' | 'registerOverflowMenu' | 'registerDivider'> {
|
|
226
|
+
export declare interface UseOverflowContainerReturn<TElement extends HTMLElement> extends Pick<OverflowContextValue, 'registerItem' | 'updateOverflow' | 'forceUpdateOverflow' | 'registerOverflowMenu' | 'registerDivider' | 'getSnapshot' | 'subscribe'> {
|
|
160
227
|
/**
|
|
161
228
|
* Ref to apply to the container that will overflow
|
|
162
229
|
*/
|
|
@@ -166,7 +233,20 @@ export declare interface UseOverflowContainerReturn<TElement extends HTMLElement
|
|
|
166
233
|
/**
|
|
167
234
|
* @internal
|
|
168
235
|
*/
|
|
169
|
-
export declare
|
|
236
|
+
export declare function useOverflowContext(): OverflowContextValue;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @internal
|
|
240
|
+
*/
|
|
241
|
+
export declare function useOverflowContext<SelectedValue>(selector: (context: OverflowContextValue) => SelectedValue): SelectedValue;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Assembles the overflow context values provided to descendants, from the state returned by
|
|
245
|
+
* {@link useOverflow_unstable}.
|
|
246
|
+
*
|
|
247
|
+
* @internal
|
|
248
|
+
*/
|
|
249
|
+
export declare const useOverflowContextValues_unstable: (state: OverflowComponentState) => OverflowContextValues;
|
|
170
250
|
|
|
171
251
|
/**
|
|
172
252
|
* @returns Number of items that are overflowing
|
|
@@ -200,6 +280,8 @@ export declare function useOverflowMenu<TElement extends HTMLElement>(id?: strin
|
|
|
200
280
|
isOverflowing: boolean;
|
|
201
281
|
};
|
|
202
282
|
|
|
283
|
+
export declare const useOverflowStyles_unstable: (state: OverflowComponentState) => OverflowComponentState;
|
|
284
|
+
|
|
203
285
|
/**
|
|
204
286
|
* A hook that returns the visibility status of all items and groups.
|
|
205
287
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useOverflow_unstable } from './useOverflow';
|
|
4
|
+
import { useOverflowContextValues_unstable } from '../../useOverflowContextValues';
|
|
5
|
+
import { useOverflowStyles_unstable } from './useOverflowStyles.styles';
|
|
6
|
+
import { renderOverflow_unstable } from './renderOverflow';
|
|
7
|
+
/**
|
|
8
|
+
* Provides an OverflowContext for OverflowItem descendants.
|
|
9
|
+
*/ export const Overflow = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
10
|
+
const state = useOverflow_unstable(props, ref);
|
|
11
|
+
const contextValues = useOverflowContextValues_unstable(state);
|
|
12
|
+
useOverflowStyles_unstable(state);
|
|
13
|
+
return renderOverflow_unstable(state, contextValues);
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/Overflow.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { OverflowProps } from './Overflow.types';\nimport { useOverflow_unstable } from './useOverflow';\nimport { useOverflowContextValues_unstable } from '../../useOverflowContextValues';\nimport { useOverflowStyles_unstable } from './useOverflowStyles.styles';\nimport { renderOverflow_unstable } from './renderOverflow';\n\n/**\n * Provides an OverflowContext for OverflowItem descendants.\n */\nexport const Overflow = React.forwardRef((props: OverflowProps, ref) => {\n const state = useOverflow_unstable(props, ref as React.Ref<HTMLElement>);\n const contextValues = useOverflowContextValues_unstable(state);\n\n useOverflowStyles_unstable(state);\n\n return renderOverflow_unstable(state, contextValues);\n});\n"],"names":["React","useOverflow_unstable","useOverflowContextValues_unstable","useOverflowStyles_unstable","renderOverflow_unstable","Overflow","forwardRef","props","ref","state","contextValues"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iCAAiC,QAAQ,iCAAiC;AACnF,SAASC,0BAA0B,QAAQ,6BAA6B;AACxE,SAASC,uBAAuB,QAAQ,mBAAmB;AAE3D;;CAEC,GACD,OAAO,MAAMC,yBAAWL,MAAMM,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,QAAQR,qBAAqBM,OAAOC;IAC1C,MAAME,gBAAgBR,kCAAkCO;IAExDN,2BAA2BM;IAE3B,OAAOL,wBAAwBK,OAAOC;AACxC,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/Overflow.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { OverflowOptions, OverflowGroupState } from '@fluentui/priority-overflow';\nimport type { OverflowContextValue } from '../../overflowContext';\nimport type { UseOverflowContainerReturn } from '../../types';\n\nexport interface OverflowState {\n hasOverflow: boolean;\n itemVisibility: Record<string, boolean>;\n groupVisibility: Record<string, OverflowGroupState>;\n}\n\nexport interface OnOverflowChangeData extends OverflowState {}\n\nexport type OverflowProps = Partial<\n Pick<OverflowOptions, 'overflowAxis' | 'overflowDirection' | 'padding' | 'minimumVisible' | 'hasHiddenItems'>\n> & {\n children: React.ReactElement;\n\n // overflow is not caused by DOM event\n // eslint-disable-next-line @nx/workspace-consistent-callback-type\n onOverflowChange?: (ev: null, data: OverflowState) => void;\n};\n\n/**\n * State used in rendering Overflow. Carries the overflow container's registration api so\n * `useOverflowContextValues_unstable` can assemble the context values.\n */\nexport type OverflowComponentState = UseOverflowContainerReturn<HTMLElement> & {\n /**\n * Merged ref applied to the cloned child's root element.\n */\n ref: React.Ref<HTMLElement>;\n /**\n * Class name applied to the cloned child. Set by `useOverflowStyles_unstable`; left `undefined`\n * by headless consumers that apply no styling.\n */\n className?: string;\n /**\n * The single child that overflow behavior is attached to.\n */\n children: React.ReactElement;\n};\n\n/**\n * Context values provided to overflow descendants.\n */\nexport type OverflowContextValues = {\n overflow: OverflowContextValue;\n};\n"],"names":[],"mappings":"AA2CA;;CAEC,GACD,WAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/index.ts"],"sourcesContent":["export { Overflow } from './Overflow';\nexport { useOverflow_unstable } from './useOverflow';\nexport { renderOverflow_unstable } from './renderOverflow';\nexport { useOverflowStyles_unstable } from './useOverflowStyles.styles';\nexport type {\n OverflowProps,\n OnOverflowChangeData,\n OverflowState,\n OverflowComponentState,\n OverflowContextValues,\n} from './Overflow.types';\n"],"names":["Overflow","useOverflow_unstable","renderOverflow_unstable","useOverflowStyles_unstable"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,6BAA6B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-utilities';
|
|
3
|
+
import { OverflowContext } from '../../overflowContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of Overflow.
|
|
6
|
+
*
|
|
7
|
+
* Griffel-free so it can be reused by headless consumers; all class merging happens in
|
|
8
|
+
* `useOverflowStyles_unstable`.
|
|
9
|
+
*/ export const renderOverflow_unstable = (state, contextValues)=>{
|
|
10
|
+
const child = getTriggerChild(state.children);
|
|
11
|
+
var _state_className;
|
|
12
|
+
const clonedChild = applyTriggerPropsToChildren(state.children, {
|
|
13
|
+
ref: state.ref,
|
|
14
|
+
className: (_state_className = state.className) !== null && _state_className !== void 0 ? _state_className : child === null || child === void 0 ? void 0 : child.props.className
|
|
15
|
+
});
|
|
16
|
+
return /*#__PURE__*/ React.createElement(OverflowContext.Provider, {
|
|
17
|
+
value: contextValues.overflow
|
|
18
|
+
}, clonedChild);
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/renderOverflow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-utilities';\nimport { OverflowContext } from '../../overflowContext';\nimport type { OverflowComponentState, OverflowContextValues } from './Overflow.types';\n\n/**\n * Render the final JSX of Overflow.\n *\n * Griffel-free so it can be reused by headless consumers; all class merging happens in\n * `useOverflowStyles_unstable`.\n */\nexport const renderOverflow_unstable = (\n state: OverflowComponentState,\n contextValues: OverflowContextValues,\n): React.ReactElement => {\n const child = getTriggerChild<HTMLElement>(state.children);\n\n const clonedChild = applyTriggerPropsToChildren(state.children, {\n ref: state.ref,\n className: state.className ?? child?.props.className,\n });\n\n return <OverflowContext.Provider value={contextValues.overflow}>{clonedChild}</OverflowContext.Provider>;\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","OverflowContext","renderOverflow_unstable","state","contextValues","child","children","clonedChild","ref","className","props","Provider","value","overflow"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,QAAQ,4BAA4B;AACzF,SAASC,eAAe,QAAQ,wBAAwB;AAGxD;;;;;CAKC,GACD,OAAO,MAAMC,0BAA0B,CACrCC,OACAC;IAEA,MAAMC,QAAQL,gBAA6BG,MAAMG,QAAQ;QAI5CH;IAFb,MAAMI,cAAcR,4BAA4BI,MAAMG,QAAQ,EAAE;QAC9DE,KAAKL,MAAMK,GAAG;QACdC,WAAWN,CAAAA,mBAAAA,MAAMM,SAAS,cAAfN,8BAAAA,mBAAmBE,kBAAAA,4BAAAA,MAAOK,KAAK,CAACD,SAAS;IACtD;IAEA,qBAAO,oBAACR,gBAAgBU,QAAQ;QAACC,OAAOR,cAAcS,QAAQ;OAAGN;AACnE,EAAE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { getTriggerChild, getReactElementRef, useMergedRefs, useEventCallback } from '@fluentui/react-utilities';
|
|
3
|
+
import { updateVisibilityAttribute, useOverflowContainer } from '../../useOverflowContainer';
|
|
4
|
+
/**
|
|
5
|
+
* The state required to render Overflow.
|
|
6
|
+
*
|
|
7
|
+
* @param props - props from this instance of Overflow
|
|
8
|
+
* @param ref - reference forwarded to the single child's root element
|
|
9
|
+
*/ export const useOverflow_unstable = (props, ref)=>{
|
|
10
|
+
const { children, minimumVisible, overflowAxis = 'horizontal', overflowDirection, padding, onOverflowChange, hasHiddenItems } = props;
|
|
11
|
+
const update = useEventCallback(()=>{
|
|
12
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
13
|
+
const snapshot = getSnapshot();
|
|
14
|
+
const state = {
|
|
15
|
+
hasOverflow: snapshot.invisibleItemCount > 0,
|
|
16
|
+
itemVisibility: snapshot.itemVisibility,
|
|
17
|
+
groupVisibility: snapshot.groupVisibility
|
|
18
|
+
};
|
|
19
|
+
onOverflowChange === null || onOverflowChange === void 0 ? void 0 : onOverflowChange(null, state);
|
|
20
|
+
});
|
|
21
|
+
const { containerRef, getSnapshot, subscribe, registerItem, updateOverflow, forceUpdateOverflow, registerOverflowMenu, registerDivider } = useOverflowContainer(update, {
|
|
22
|
+
overflowDirection,
|
|
23
|
+
overflowAxis,
|
|
24
|
+
padding,
|
|
25
|
+
minimumVisible,
|
|
26
|
+
hasHiddenItems,
|
|
27
|
+
onUpdateItemVisibility: updateVisibilityAttribute
|
|
28
|
+
});
|
|
29
|
+
const child = getTriggerChild(children);
|
|
30
|
+
return {
|
|
31
|
+
containerRef,
|
|
32
|
+
getSnapshot,
|
|
33
|
+
subscribe,
|
|
34
|
+
registerItem,
|
|
35
|
+
updateOverflow,
|
|
36
|
+
forceUpdateOverflow,
|
|
37
|
+
registerOverflowMenu,
|
|
38
|
+
registerDivider,
|
|
39
|
+
ref: useMergedRefs(containerRef, ref, getReactElementRef(child)),
|
|
40
|
+
children
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/useOverflow.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type { OnUpdateOverflow } from '@fluentui/priority-overflow';\nimport { getTriggerChild, getReactElementRef, useMergedRefs, useEventCallback } from '@fluentui/react-utilities';\n\nimport { updateVisibilityAttribute, useOverflowContainer } from '../../useOverflowContainer';\nimport type { OverflowComponentState, OverflowProps, OverflowState } from './Overflow.types';\n\n/**\n * The state required to render Overflow.\n *\n * @param props - props from this instance of Overflow\n * @param ref - reference forwarded to the single child's root element\n */\nexport const useOverflow_unstable = (props: OverflowProps, ref: React.Ref<HTMLElement>): OverflowComponentState => {\n const {\n children,\n minimumVisible,\n overflowAxis = 'horizontal',\n overflowDirection,\n padding,\n onOverflowChange,\n hasHiddenItems,\n } = props;\n\n const update: OnUpdateOverflow = useEventCallback(() => {\n // eslint-disable-next-line react-hooks/immutability\n const snapshot = getSnapshot();\n const state: OverflowState = {\n hasOverflow: snapshot.invisibleItemCount > 0,\n itemVisibility: snapshot.itemVisibility,\n groupVisibility: snapshot.groupVisibility,\n };\n onOverflowChange?.(null, state);\n });\n\n const {\n containerRef,\n getSnapshot,\n subscribe,\n registerItem,\n updateOverflow,\n forceUpdateOverflow,\n registerOverflowMenu,\n registerDivider,\n } = useOverflowContainer(update, {\n overflowDirection,\n overflowAxis,\n padding,\n minimumVisible,\n hasHiddenItems,\n onUpdateItemVisibility: updateVisibilityAttribute,\n });\n\n const child = getTriggerChild<HTMLElement>(children);\n\n return {\n containerRef,\n getSnapshot,\n subscribe,\n registerItem,\n updateOverflow,\n forceUpdateOverflow,\n registerOverflowMenu,\n registerDivider,\n ref: useMergedRefs(containerRef, ref, getReactElementRef(child)),\n children,\n };\n};\n"],"names":["getTriggerChild","getReactElementRef","useMergedRefs","useEventCallback","updateVisibilityAttribute","useOverflowContainer","useOverflow_unstable","props","ref","children","minimumVisible","overflowAxis","overflowDirection","padding","onOverflowChange","hasHiddenItems","update","snapshot","getSnapshot","state","hasOverflow","invisibleItemCount","itemVisibility","groupVisibility","containerRef","subscribe","registerItem","updateOverflow","forceUpdateOverflow","registerOverflowMenu","registerDivider","onUpdateItemVisibility","child"],"mappings":"AAAA;AAIA,SAASA,eAAe,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,gBAAgB,QAAQ,4BAA4B;AAEjH,SAASC,yBAAyB,EAAEC,oBAAoB,QAAQ,6BAA6B;AAG7F;;;;;CAKC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAM,EACJC,QAAQ,EACRC,cAAc,EACdC,eAAe,YAAY,EAC3BC,iBAAiB,EACjBC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACf,GAAGR;IAEJ,MAAMS,SAA2Bb,iBAAiB;QAChD,oDAAoD;QACpD,MAAMc,WAAWC;QACjB,MAAMC,QAAuB;YAC3BC,aAAaH,SAASI,kBAAkB,GAAG;YAC3CC,gBAAgBL,SAASK,cAAc;YACvCC,iBAAiBN,SAASM,eAAe;QAC3C;QACAT,6BAAAA,uCAAAA,iBAAmB,MAAMK;IAC3B;IAEA,MAAM,EACJK,YAAY,EACZN,WAAW,EACXO,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,eAAe,EAChB,GAAGzB,qBAAqBW,QAAQ;QAC/BJ;QACAD;QACAE;QACAH;QACAK;QACAgB,wBAAwB3B;IAC1B;IAEA,MAAM4B,QAAQhC,gBAA6BS;IAE3C,OAAO;QACLe;QACAN;QACAO;QACAC;QACAC;QACAC;QACAC;QACAC;QACAtB,KAAKN,cAAcsB,cAAchB,KAAKP,mBAAmB+B;QACzDvB;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
4
|
+
import { getTriggerChild } from '@fluentui/react-utilities';
|
|
5
|
+
import { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../../constants';
|
|
6
|
+
export const useOverflowStyles = /*#__PURE__*/__styles({
|
|
7
|
+
overflowMenu: {
|
|
8
|
+
Brvla84: "fyfkpbf"
|
|
9
|
+
},
|
|
10
|
+
overflowingItems: {
|
|
11
|
+
zb22lx: "f10570jf"
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
d: [".fyfkpbf [data-overflow-menu]{flex-shrink:0;}", ".f10570jf [data-overflowing]{display:none;}"]
|
|
15
|
+
});
|
|
16
|
+
export const useOverflowStyles_unstable = state => {
|
|
17
|
+
const styles = useOverflowStyles();
|
|
18
|
+
const child = getTriggerChild(state.children);
|
|
19
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
20
|
+
state.className = mergeClasses('fui-Overflow', styles.overflowMenu, styles.overflowingItems, child === null || child === void 0 ? void 0 : child.props.className);
|
|
21
|
+
return state;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","getTriggerChild","DATA_OVERFLOWING","DATA_OVERFLOW_MENU","useOverflowStyles","overflowMenu","Brvla84","overflowingItems","zb22lx","d","useOverflowStyles_unstable","state","styles","child","children","className","props"],"sources":["useOverflowStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { getTriggerChild } from '@fluentui/react-utilities';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../../constants';\nexport const useOverflowStyles = makeStyles({\n overflowMenu: {\n [`& [${DATA_OVERFLOW_MENU}]`]: {\n flexShrink: 0\n }\n },\n overflowingItems: {\n [`& [${DATA_OVERFLOWING}]`]: {\n display: 'none'\n }\n }\n});\nexport const useOverflowStyles_unstable = (state)=>{\n const styles = useOverflowStyles();\n const child = getTriggerChild(state.children);\n // eslint-disable-next-line react-hooks/immutability\n state.className = mergeClasses('fui-Overflow', styles.overflowMenu, styles.overflowingItems, child === null || child === void 0 ? void 0 : child.props.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,iBAAiB;AACtE,OAAO,MAAMC,iBAAiB,gBAAGL,QAAA;EAAAM,YAAA;IAAAC,OAAA;EAAA;EAAAC,gBAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAWhC,CAAC;AACF,OAAO,MAAMC,0BAA0B,GAAIC,KAAK,IAAG;EAC/C,MAAMC,MAAM,GAAGR,iBAAiB,CAAC,CAAC;EAClC,MAAMS,KAAK,GAAGZ,eAAe,CAACU,KAAK,CAACG,QAAQ,CAAC;EAC7C;EACAH,KAAK,CAACI,SAAS,GAAGf,YAAY,CAAC,cAAc,EAAEY,MAAM,CAACP,YAAY,EAAEO,MAAM,CAACL,gBAAgB,EAAEM,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACG,KAAK,CAACD,SAAS,CAAC;EACjK,OAAOJ,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { makeStyles, mergeClasses } from '@griffel/react';
|
|
3
|
+
import { getTriggerChild } from '@fluentui/react-utilities';
|
|
4
|
+
import { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../../constants';
|
|
5
|
+
export const useOverflowStyles = makeStyles({
|
|
6
|
+
overflowMenu: {
|
|
7
|
+
[`& [${DATA_OVERFLOW_MENU}]`]: {
|
|
8
|
+
flexShrink: 0
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
overflowingItems: {
|
|
12
|
+
[`& [${DATA_OVERFLOWING}]`]: {
|
|
13
|
+
display: 'none'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export const useOverflowStyles_unstable = (state)=>{
|
|
18
|
+
const styles = useOverflowStyles();
|
|
19
|
+
const child = getTriggerChild(state.children);
|
|
20
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
21
|
+
state.className = mergeClasses('fui-Overflow', styles.overflowMenu, styles.overflowingItems, child === null || child === void 0 ? void 0 : child.props.className);
|
|
22
|
+
return state;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Overflow/useOverflowStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { getTriggerChild } from '@fluentui/react-utilities';\nimport { DATA_OVERFLOWING, DATA_OVERFLOW_MENU } from '../../constants';\nimport type { OverflowComponentState } from './Overflow.types';\n\nexport const useOverflowStyles = 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\nexport const useOverflowStyles_unstable = (state: OverflowComponentState): OverflowComponentState => {\n const styles = useOverflowStyles();\n const child = getTriggerChild<HTMLElement>(state.children);\n\n // eslint-disable-next-line react-hooks/immutability\n state.className = mergeClasses('fui-Overflow', styles.overflowMenu, styles.overflowingItems, child?.props.className);\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","getTriggerChild","DATA_OVERFLOWING","DATA_OVERFLOW_MENU","useOverflowStyles","overflowMenu","flexShrink","overflowingItems","display","useOverflowStyles_unstable","state","styles","child","children","className","props"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,kBAAkB;AAGvE,OAAO,MAAMC,oBAAoBL,WAAW;IAC1CM,cAAc;QACZ,CAAC,CAAC,GAAG,EAAEF,mBAAmB,CAAC,CAAC,CAAC,EAAE;YAC7BG,YAAY;QACd;IACF;IAEAC,kBAAkB;QAChB,CAAC,CAAC,GAAG,EAAEL,iBAAiB,CAAC,CAAC,CAAC,EAAE;YAC3BM,SAAS;QACX;IACF;AACF,GAAG;AAEH,OAAO,MAAMC,6BAA6B,CAACC;IACzC,MAAMC,SAASP;IACf,MAAMQ,QAAQX,gBAA6BS,MAAMG,QAAQ;IAEzD,oDAAoD;IACpDH,MAAMI,SAAS,GAAGd,aAAa,gBAAgBW,OAAON,YAAY,EAAEM,OAAOJ,gBAAgB,EAAEK,kBAAAA,4BAAAA,MAAOG,KAAK,CAACD,SAAS;IAEnH,OAAOJ;AACT,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { Overflow } from './components/Overflow';
|
|
1
|
+
export { Overflow, useOverflow_unstable, renderOverflow_unstable, useOverflowStyles_unstable } from './components/Overflow';
|
|
2
2
|
export { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU, DATA_OVERFLOW_DIVIDER } from './constants';
|
|
3
3
|
export { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';
|
|
4
4
|
export { useIsOverflowItemVisible } from './useIsOverflowItemVisible';
|
|
5
5
|
export { useOverflowContainer } from './useOverflowContainer';
|
|
6
|
+
export { useOverflowContextValues_unstable } from './useOverflowContextValues';
|
|
6
7
|
export { useOverflowCount } from './useOverflowCount';
|
|
7
8
|
export { useOverflowItem } from './useOverflowItem';
|
|
8
9
|
export { useOverflowMenu } from './useOverflowMenu';
|
|
9
10
|
export { useOverflowDivider } from './useOverflowDivider';
|
|
10
11
|
export { useOverflowVisibility } from './useOverflowVisibility';
|
|
11
|
-
export { useOverflowContext } from './overflowContext';
|
|
12
|
+
export { useOverflowContext, OverflowProvider } from './overflowContext';
|
|
12
13
|
export { OverflowItem } from './components/OverflowItem/OverflowItem';
|
|
13
14
|
export { OverflowDivider } from './components/OverflowDivider/OverflowDivider';
|
|
14
15
|
export { OverflowReorderObserver } from './components/OverflowReorderObserver';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Overflow,\n useOverflow_unstable,\n renderOverflow_unstable,\n useOverflowStyles_unstable,\n} from './components/Overflow';\nexport type {\n OverflowProps,\n OnOverflowChangeData,\n OverflowState,\n OverflowComponentState,\n OverflowContextValues,\n} from './components/Overflow';\nexport { DATA_OVERFLOWING, DATA_OVERFLOW_ITEM, DATA_OVERFLOW_MENU, DATA_OVERFLOW_DIVIDER } from './constants';\nexport type { UseOverflowContainerReturn } from './types';\nexport { useIsOverflowGroupVisible } from './useIsOverflowGroupVisible';\nexport { useIsOverflowItemVisible } from './useIsOverflowItemVisible';\nexport { useOverflowContainer } from './useOverflowContainer';\nexport { useOverflowContextValues_unstable } from './useOverflowContextValues';\nexport { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\nexport { useOverflowDivider } from './useOverflowDivider';\nexport { useOverflowVisibility } from './useOverflowVisibility';\n\nexport { useOverflowContext, OverflowProvider } from './overflowContext';\nexport type { OverflowContextValue } from './overflowContext';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport type { OverflowDividerProps } from './components/OverflowDivider/OverflowDivider.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\nexport { OverflowDivider } from './components/OverflowDivider/OverflowDivider';\nexport { OverflowReorderObserver } from './components/OverflowReorderObserver';\n\nexport type { OnUpdateItemVisibility, OnUpdateOverflow, OverflowEventPayload } from '@fluentui/priority-overflow';\n"],"names":["Overflow","useOverflow_unstable","renderOverflow_unstable","useOverflowStyles_unstable","DATA_OVERFLOWING","DATA_OVERFLOW_ITEM","DATA_OVERFLOW_MENU","DATA_OVERFLOW_DIVIDER","useIsOverflowGroupVisible","useIsOverflowItemVisible","useOverflowContainer","useOverflowContextValues_unstable","useOverflowCount","useOverflowItem","useOverflowMenu","useOverflowDivider","useOverflowVisibility","useOverflowContext","OverflowProvider","OverflowItem","OverflowDivider","OverflowReorderObserver"],"mappings":"AAAA,SACEA,QAAQ,EACRC,oBAAoB,EACpBC,uBAAuB,EACvBC,0BAA0B,QACrB,wBAAwB;AAQ/B,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,qBAAqB,QAAQ,cAAc;AAE9G,SAASC,yBAAyB,QAAQ,8BAA8B;AACxE,SAASC,wBAAwB,QAAQ,6BAA6B;AACtE,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,iCAAiC,QAAQ,6BAA6B;AAC/E,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAKzE,SAASC,YAAY,QAAQ,yCAAyC;AACtE,SAASC,eAAe,QAAQ,+CAA+C;AAC/E,SAASC,uBAAuB,QAAQ,uCAAuC"}
|
package/lib/overflowContext.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { EMPTY_SNAPSHOT } from '@fluentui/priority-overflow';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export const OverflowContext = React.createContext(undefined);
|
|
5
|
+
/**
|
|
6
|
+
* Provides an {@link OverflowContextValue} to descendant overflow hooks and components.
|
|
7
|
+
* Used by headless consumers that build their own overflow root.
|
|
8
|
+
* @public
|
|
9
|
+
*/ export const OverflowProvider = OverflowContext.Provider;
|
|
10
|
+
const noop = ()=>{
|
|
11
|
+
/* noop */ };
|
|
4
12
|
const overflowContextDefaultValue = {
|
|
13
|
+
hasOverflow: false,
|
|
5
14
|
itemVisibility: {},
|
|
6
15
|
groupVisibility: {},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
registerOverflowMenu: ()=>
|
|
11
|
-
registerDivider: ()=>
|
|
16
|
+
registerItem: ()=>noop,
|
|
17
|
+
updateOverflow: noop,
|
|
18
|
+
forceUpdateOverflow: noop,
|
|
19
|
+
registerOverflowMenu: ()=>noop,
|
|
20
|
+
registerDivider: ()=>noop,
|
|
21
|
+
getSnapshot: ()=>EMPTY_SNAPSHOT,
|
|
22
|
+
subscribe: ()=>noop
|
|
12
23
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
export function useOverflowContext(selector) {
|
|
25
|
+
var _React_useContext;
|
|
26
|
+
const context = (_React_useContext = React.useContext(OverflowContext)) !== null && _React_useContext !== void 0 ? _React_useContext : overflowContextDefaultValue;
|
|
27
|
+
return selector ? selector(context) : context;
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/overflowContext.ts"],"sourcesContent":["'use client';\n\nimport type
|
|
1
|
+
{"version":3,"sources":["../src/overflowContext.ts"],"sourcesContent":["'use client';\n\nimport type {\n OverflowItemEntry,\n OverflowDividerEntry,\n OverflowGroupState,\n OverflowSnapshot,\n} from '@fluentui/priority-overflow';\nimport { EMPTY_SNAPSHOT } from '@fluentui/priority-overflow';\nimport * as React from 'react';\n\n/**\n * @public\n */\nexport interface OverflowContextValue {\n /**\n * @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead\n */\n itemVisibility: Record<string, boolean>;\n /**\n * @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead\n */\n groupVisibility: Record<string, OverflowGroupState>;\n /**\n * @deprecated This value is not guaranteed to be up to date and should not be used directly. Use getSnapshot or the provided hooks instead\n */\n hasOverflow: boolean;\n registerItem: (item: OverflowItemEntry) => () => void;\n registerOverflowMenu: (el: HTMLElement) => () => void;\n registerDivider: (divider: OverflowDividerEntry) => () => void;\n updateOverflow: (padding?: number) => void;\n forceUpdateOverflow: () => void;\n containerRef?: React.RefObject<HTMLElement | null>;\n getSnapshot: () => OverflowSnapshot;\n subscribe: (listener: () => void) => () => void;\n}\n\nexport const OverflowContext = React.createContext<OverflowContextValue | undefined>(\n undefined,\n) as React.Context<OverflowContextValue>;\n\n/**\n * Provides an {@link OverflowContextValue} to descendant overflow hooks and components.\n * Used by headless consumers that build their own overflow root.\n * @public\n */\nexport const OverflowProvider = OverflowContext.Provider;\n\nconst noop = () => {\n /* noop */\n};\n\nconst overflowContextDefaultValue: OverflowContextValue = {\n hasOverflow: false,\n itemVisibility: {},\n groupVisibility: {},\n registerItem: () => noop,\n updateOverflow: noop,\n forceUpdateOverflow: noop,\n registerOverflowMenu: () => noop,\n registerDivider: () => noop,\n getSnapshot: () => EMPTY_SNAPSHOT,\n subscribe: () => noop,\n};\n\n/**\n * @internal\n */\nexport function useOverflowContext(): OverflowContextValue;\n/**\n * @internal\n */\nexport function useOverflowContext<SelectedValue>(\n selector: (context: OverflowContextValue) => SelectedValue,\n): SelectedValue;\nexport function useOverflowContext<SelectedValue>(\n selector?: (context: OverflowContextValue) => SelectedValue,\n): SelectedValue | OverflowContextValue {\n const context = React.useContext(OverflowContext) ?? overflowContextDefaultValue;\n return selector ? selector(context) : context;\n}\n"],"names":["EMPTY_SNAPSHOT","React","OverflowContext","createContext","undefined","OverflowProvider","Provider","noop","overflowContextDefaultValue","hasOverflow","itemVisibility","groupVisibility","registerItem","updateOverflow","forceUpdateOverflow","registerOverflowMenu","registerDivider","getSnapshot","subscribe","useOverflowContext","selector","context","useContext"],"mappings":"AAAA;AAQA,SAASA,cAAc,QAAQ,8BAA8B;AAC7D,YAAYC,WAAW,QAAQ;AA4B/B,OAAO,MAAMC,kBAAkBD,MAAME,aAAa,CAChDC,WACuC;AAEzC;;;;CAIC,GACD,OAAO,MAAMC,mBAAmBH,gBAAgBI,QAAQ,CAAC;AAEzD,MAAMC,OAAO;AACX,QAAQ,GACV;AAEA,MAAMC,8BAAoD;IACxDC,aAAa;IACbC,gBAAgB,CAAC;IACjBC,iBAAiB,CAAC;IAClBC,cAAc,IAAML;IACpBM,gBAAgBN;IAChBO,qBAAqBP;IACrBQ,sBAAsB,IAAMR;IAC5BS,iBAAiB,IAAMT;IACvBU,aAAa,IAAMjB;IACnBkB,WAAW,IAAMX;AACnB;AAYA,OAAO,SAASY,mBACdC,QAA2D;QAE3CnB;IAAhB,MAAMoB,UAAUpB,CAAAA,oBAAAA,MAAMqB,UAAU,CAACpB,8BAAjBD,+BAAAA,oBAAqCO;IACrD,OAAOY,WAAWA,SAASC,WAAWA;AACxC"}
|
package/lib/types.js
CHANGED
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { OverflowContextValue } from './overflowContext';\n\n/**\n * @
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { OverflowContextValue } from './overflowContext';\n\n/**\n * @public\n */\nexport interface UseOverflowContainerReturn<TElement extends HTMLElement>\n extends Pick<\n OverflowContextValue,\n | 'registerItem'\n | 'updateOverflow'\n | 'forceUpdateOverflow'\n | 'registerOverflowMenu'\n | 'registerDivider'\n | 'getSnapshot'\n | 'subscribe'\n > {\n /**\n * Ref to apply to the container that will overflow\n */\n containerRef: React.RefObject<TElement | null>;\n}\n"],"names":[],"mappings":"AAGA;;CAEC,GACD,WAeC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { useOverflowSnapshot } from './useOverflowSnapshot';
|
|
3
3
|
/**
|
|
4
4
|
* @param id - unique identifier for a group of overflow items
|
|
5
5
|
* @returns visibility state of the group
|
|
6
6
|
*/ export function useIsOverflowGroupVisible(id) {
|
|
7
|
-
return
|
|
7
|
+
return useOverflowSnapshot((snapshot)=>snapshot.groupVisibility[id]);
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useIsOverflowGroupVisible.ts"],"sourcesContent":["'use client';\n\nimport type { OverflowGroupState } from '@fluentui/priority-overflow';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/useIsOverflowGroupVisible.ts"],"sourcesContent":["'use client';\n\nimport type { OverflowGroupState } from '@fluentui/priority-overflow';\nimport { useOverflowSnapshot } from './useOverflowSnapshot';\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 useOverflowSnapshot(snapshot => snapshot.groupVisibility[id]);\n}\n"],"names":["useOverflowSnapshot","useIsOverflowGroupVisible","id","snapshot","groupVisibility"],"mappings":"AAAA;AAGA,SAASA,mBAAmB,QAAQ,wBAAwB;AAE5D;;;CAGC,GACD,OAAO,SAASC,0BAA0BC,EAAU;IAClD,OAAOF,oBAAoBG,CAAAA,WAAYA,SAASC,eAAe,CAACF,GAAG;AACrE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { useOverflowSnapshot } from './useOverflowSnapshot';
|
|
3
3
|
/**
|
|
4
4
|
* @param id - unique identifier for the item used by the overflow manager
|
|
5
5
|
* @returns visibility state of an overflow item
|
|
6
6
|
*/ export function useIsOverflowItemVisible(id) {
|
|
7
|
-
return
|
|
7
|
+
return useOverflowSnapshot((snapshot)=>!!snapshot.itemVisibility[id]);
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useIsOverflowItemVisible.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/useIsOverflowItemVisible.ts"],"sourcesContent":["'use client';\n\nimport { useOverflowSnapshot } from './useOverflowSnapshot';\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 useOverflowSnapshot(snapshot => !!snapshot.itemVisibility[id]);\n}\n"],"names":["useOverflowSnapshot","useIsOverflowItemVisible","id","snapshot","itemVisibility"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,QAAQ,wBAAwB;AAE5D;;;CAGC,GACD,OAAO,SAASC,yBAAyBC,EAAU;IACjD,OAAOF,oBAAoBG,CAAAA,WAAY,CAAC,CAACA,SAASC,cAAc,CAACF,GAAG;AACtE"}
|