@fluentui/react-overflow 9.7.2 → 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.
Files changed (95) hide show
  1. package/CHANGELOG.md +33 -4
  2. package/dist/index.d.ts +120 -17
  3. package/lib/components/Overflow/Overflow.js +14 -0
  4. package/lib/components/Overflow/Overflow.js.map +1 -0
  5. package/lib/components/Overflow/Overflow.types.js +3 -0
  6. package/lib/components/Overflow/Overflow.types.js.map +1 -0
  7. package/lib/components/Overflow/index.js +4 -0
  8. package/lib/components/Overflow/index.js.map +1 -0
  9. package/lib/components/Overflow/renderOverflow.js +19 -0
  10. package/lib/components/Overflow/renderOverflow.js.map +1 -0
  11. package/lib/components/Overflow/useOverflow.js +42 -0
  12. package/lib/components/Overflow/useOverflow.js.map +1 -0
  13. package/lib/components/Overflow/useOverflowStyles.styles.js +22 -0
  14. package/lib/components/Overflow/useOverflowStyles.styles.js.map +1 -0
  15. package/lib/components/Overflow/useOverflowStyles.styles.raw.js +23 -0
  16. package/lib/components/Overflow/useOverflowStyles.styles.raw.js.map +1 -0
  17. package/lib/components/OverflowReorderObserver/OverflowReorderObserver.js +43 -0
  18. package/lib/components/OverflowReorderObserver/OverflowReorderObserver.js.map +1 -0
  19. package/lib/components/OverflowReorderObserver/index.js +1 -0
  20. package/lib/components/OverflowReorderObserver/index.js.map +1 -0
  21. package/lib/index.js +4 -2
  22. package/lib/index.js.map +1 -1
  23. package/lib/overflowContext.js +23 -10
  24. package/lib/overflowContext.js.map +1 -1
  25. package/lib/types.js +1 -1
  26. package/lib/types.js.map +1 -1
  27. package/lib/useIsOverflowGroupVisible.js +2 -2
  28. package/lib/useIsOverflowGroupVisible.js.map +1 -1
  29. package/lib/useIsOverflowItemVisible.js +2 -2
  30. package/lib/useIsOverflowItemVisible.js.map +1 -1
  31. package/lib/useOverflowContainer.js +64 -55
  32. package/lib/useOverflowContainer.js.map +1 -1
  33. package/lib/useOverflowContextValues.js +35 -0
  34. package/lib/useOverflowContextValues.js.map +1 -0
  35. package/lib/useOverflowCount.js +3 -9
  36. package/lib/useOverflowCount.js.map +1 -1
  37. package/lib/useOverflowMenu.js +10 -12
  38. package/lib/useOverflowMenu.js.map +1 -1
  39. package/lib/useOverflowSnapshot.js +23 -0
  40. package/lib/useOverflowSnapshot.js.map +1 -0
  41. package/lib/useOverflowVisibility.js +6 -11
  42. package/lib/useOverflowVisibility.js.map +1 -1
  43. package/lib-commonjs/components/Overflow/Overflow.js +23 -0
  44. package/lib-commonjs/components/Overflow/Overflow.js.map +1 -0
  45. package/lib-commonjs/components/Overflow/Overflow.types.js +6 -0
  46. package/lib-commonjs/components/Overflow/Overflow.types.js.map +1 -0
  47. package/lib-commonjs/components/Overflow/index.js +28 -0
  48. package/lib-commonjs/components/Overflow/index.js.map +1 -0
  49. package/lib-commonjs/components/Overflow/renderOverflow.js +25 -0
  50. package/lib-commonjs/components/Overflow/renderOverflow.js.map +1 -0
  51. package/lib-commonjs/components/Overflow/useOverflow.js +47 -0
  52. package/lib-commonjs/components/Overflow/useOverflow.js.map +1 -0
  53. package/lib-commonjs/components/Overflow/useOverflowStyles.styles.js +41 -0
  54. package/lib-commonjs/components/Overflow/useOverflowStyles.styles.js.map +1 -0
  55. package/lib-commonjs/components/Overflow/useOverflowStyles.styles.raw.js +41 -0
  56. package/lib-commonjs/components/Overflow/useOverflowStyles.styles.raw.js.map +1 -0
  57. package/lib-commonjs/components/OverflowReorderObserver/OverflowReorderObserver.js +37 -0
  58. package/lib-commonjs/components/OverflowReorderObserver/OverflowReorderObserver.js.map +1 -0
  59. package/lib-commonjs/components/OverflowReorderObserver/index.js +11 -0
  60. package/lib-commonjs/components/OverflowReorderObserver/index.js.map +1 -0
  61. package/lib-commonjs/index.js +20 -0
  62. package/lib-commonjs/index.js.map +1 -1
  63. package/lib-commonjs/overflowContext.js +23 -8
  64. package/lib-commonjs/overflowContext.js.map +1 -1
  65. package/lib-commonjs/types.js +1 -1
  66. package/lib-commonjs/types.js.map +1 -1
  67. package/lib-commonjs/useIsOverflowGroupVisible.js +2 -2
  68. package/lib-commonjs/useIsOverflowGroupVisible.js.map +1 -1
  69. package/lib-commonjs/useIsOverflowItemVisible.js +2 -2
  70. package/lib-commonjs/useIsOverflowItemVisible.js.map +1 -1
  71. package/lib-commonjs/useOverflowContainer.js +62 -53
  72. package/lib-commonjs/useOverflowContainer.js.map +1 -1
  73. package/lib-commonjs/useOverflowContextValues.js +41 -0
  74. package/lib-commonjs/useOverflowContextValues.js.map +1 -0
  75. package/lib-commonjs/useOverflowCount.js +3 -9
  76. package/lib-commonjs/useOverflowCount.js.map +1 -1
  77. package/lib-commonjs/useOverflowMenu.js +10 -12
  78. package/lib-commonjs/useOverflowMenu.js.map +1 -1
  79. package/lib-commonjs/useOverflowSnapshot.js +30 -0
  80. package/lib-commonjs/useOverflowSnapshot.js.map +1 -0
  81. package/lib-commonjs/useOverflowVisibility.js +6 -12
  82. package/lib-commonjs/useOverflowVisibility.js.map +1 -1
  83. package/package.json +4 -4
  84. package/lib/components/Overflow.js +0 -60
  85. package/lib/components/Overflow.js.map +0 -1
  86. package/lib/components/useOverflowStyles.styles.js +0 -14
  87. package/lib/components/useOverflowStyles.styles.js.map +0 -1
  88. package/lib/components/useOverflowStyles.styles.raw.js +0 -15
  89. package/lib/components/useOverflowStyles.styles.raw.js.map +0 -1
  90. package/lib-commonjs/components/Overflow.js +0 -69
  91. package/lib-commonjs/components/Overflow.js.map +0 -1
  92. package/lib-commonjs/components/useOverflowStyles.styles.js +0 -25
  93. package/lib-commonjs/components/useOverflowStyles.styles.js.map +0 -1
  94. package/lib-commonjs/components/useOverflowStyles.styles.raw.js +0 -25
  95. package/lib-commonjs/components/useOverflowStyles.styles.raw.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,18 +1,47 @@
1
1
  # Change Log - @fluentui/react-overflow
2
2
 
3
- This log was last generated on Thu, 23 Apr 2026 11:59:28 GMT and should not be manually modified.
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
+
25
+ ## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.8.0)
26
+
27
+ Tue, 26 May 2026 09:39:28 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.7.2..@fluentui/react-overflow_v9.8.0)
29
+
30
+ ### Minor changes
31
+
32
+ - feat: add OverflowReorderObserver to recompute overflow when items are reordered via React state without a container resize ([PR #36231](https://github.com/microsoft/fluentui/pull/36231) by olfedias@microsoft.com)
33
+ - Bump @fluentui/react-context-selector to v9.2.17 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.26.4 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
35
+
7
36
  ## [9.7.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.7.2)
8
37
 
9
- Thu, 23 Apr 2026 11:59:28 GMT
38
+ Thu, 23 Apr 2026 14:21:14 GMT
10
39
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-overflow_v9.7.1..@fluentui/react-overflow_v9.7.2)
11
40
 
12
41
  ### Patches
13
42
 
14
- - Bump @fluentui/react-context-selector to v9.2.16 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
15
- - Bump @fluentui/react-utilities to v9.26.3 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
43
+ - Bump @fluentui/react-context-selector to v9.2.16 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
44
+ - Bump @fluentui/react-utilities to v9.26.3 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
16
45
 
17
46
  ## [9.7.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-overflow_v9.7.1)
18
47
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import type { ContextSelector } from '@fluentui/react-context-selector';
2
- import type { ObserveOptions } from '@fluentui/priority-overflow';
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 { OverflowGroupState } from '@fluentui/priority-overflow';
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,27 +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<ObserveOptions, "padding" | "overflowDirection" | "overflowAxis" | "minimumVisible" | "hasHiddenItems">> & {
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
- * @internal
35
+ * State used in rendering Overflow. Carries the overflow container's registration api so
36
+ * `useOverflowContextValues_unstable` can assemble the context values.
37
+ */
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
30
56
  */
31
- declare interface OverflowContextValue {
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;
75
+ containerRef?: React_2.RefObject<HTMLElement | null>;
76
+ getSnapshot: () => OverflowSnapshot;
77
+ subscribe: (listener: () => void) => () => void;
39
78
  }
40
79
 
80
+ /**
81
+ * Context values provided to overflow descendants.
82
+ */
83
+ export declare type OverflowContextValues = {
84
+ overflow: OverflowContextValue;
85
+ };
86
+
41
87
  /**
42
88
  * Attaches overflow item behavior to its child registered with the OverflowContext.
43
89
  * It does not render an element of its own.
@@ -47,7 +93,7 @@ export declare const OverflowDivider: React_2.ForwardRefExoticComponent<Overflow
47
93
  /**
48
94
  * OverflowDividerProps
49
95
  */
50
- declare type OverflowDividerProps = {
96
+ export declare type OverflowDividerProps = {
51
97
  /**
52
98
  * Assigns the item to a group, group visibility can be watched.
53
99
  */
@@ -58,6 +104,8 @@ declare type OverflowDividerProps = {
58
104
  children: React_2.ReactElement;
59
105
  };
60
106
 
107
+ export { OverflowEventPayload }
108
+
61
109
  /**
62
110
  * Attaches overflow item behavior to its child registered with the OverflowContext.
63
111
  * It does not render an element of its own.
@@ -98,20 +146,52 @@ export declare type OverflowItemProps = {
98
146
  priority?: number;
99
147
  });
100
148
 
101
- /**
102
- * Overflow Props
103
- */
104
- 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'>> & {
105
150
  children: React_2.ReactElement;
106
151
  onOverflowChange?: (ev: null, data: OverflowState) => void;
107
152
  };
108
153
 
109
- declare interface OverflowState {
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
+
161
+ /**
162
+ * Renderless opt-in component that observes the `<Overflow>` container for
163
+ * direct-child DOM mutations and triggers an overflow recompute. Drop it
164
+ * inside `<Overflow>` when items can be reordered, added, or removed via
165
+ * React state without a container resize — Fluent's overflow manager only
166
+ * listens to `ResizeObserver` otherwise, so reorders leave visibility flags
167
+ * stale.
168
+ *
169
+ * @example
170
+ * ```tsx
171
+ * <Overflow>
172
+ * <div>
173
+ * <OverflowReorderObserver />
174
+ * {items.map(id => <OverflowItem key={id} id={id} priority={1}>{id}</OverflowItem>)}
175
+ * </div>
176
+ * </Overflow>
177
+ * ```
178
+ */
179
+ export declare const OverflowReorderObserver: React_2.FC;
180
+
181
+ export declare interface OverflowState {
110
182
  hasOverflow: boolean;
111
183
  itemVisibility: Record<string, boolean>;
112
184
  groupVisibility: Record<string, OverflowGroupState>;
113
185
  }
114
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
+
115
195
  /**
116
196
  * @param id - unique identifier for a group of overflow items
117
197
  * @returns visibility state of the group
@@ -124,18 +204,26 @@ export declare function useIsOverflowGroupVisible(id: string): OverflowGroupStat
124
204
  */
125
205
  export declare function useIsOverflowItemVisible(id: string): boolean;
126
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
+
127
215
  /**
128
216
  * @internal
129
217
  * @param update - Callback when overflow state changes
130
218
  * @param options - Options to configure the overflow container
131
219
  * @returns - ref to attach to an intrinsic HTML element and imperative functions
132
220
  */
133
- export declare const useOverflowContainer: <TElement extends HTMLElement>(update: OnUpdateOverflow, options: Omit<ObserveOptions, "onUpdateOverflow">) => UseOverflowContainerReturn<TElement>;
221
+ export declare const useOverflowContainer: <TElement extends HTMLElement>(update: OnUpdateOverflow, options: Omit<OverflowOptions, "onUpdateOverflow">) => UseOverflowContainerReturn<TElement>;
134
222
 
135
223
  /**
136
- * @internal
224
+ * @public
137
225
  */
138
- 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'> {
139
227
  /**
140
228
  * Ref to apply to the container that will overflow
141
229
  */
@@ -145,7 +233,20 @@ export declare interface UseOverflowContainerReturn<TElement extends HTMLElement
145
233
  /**
146
234
  * @internal
147
235
  */
148
- export declare const useOverflowContext: <SelectedValue>(selector: ContextSelector<OverflowContextValue, SelectedValue>) => SelectedValue;
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;
149
250
 
150
251
  /**
151
252
  * @returns Number of items that are overflowing
@@ -179,6 +280,8 @@ export declare function useOverflowMenu<TElement extends HTMLElement>(id?: strin
179
280
  isOverflowing: boolean;
180
281
  };
181
282
 
283
+ export declare const useOverflowStyles_unstable: (state: OverflowComponentState) => OverflowComponentState;
284
+
182
285
  /**
183
286
  * A hook that returns the visibility status of all items and groups.
184
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,3 @@
1
+ /**
2
+ * Context values provided to overflow descendants.
3
+ */ export { };
@@ -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,4 @@
1
+ export { Overflow } from './Overflow';
2
+ export { useOverflow_unstable } from './useOverflow';
3
+ export { renderOverflow_unstable } from './renderOverflow';
4
+ export { useOverflowStyles_unstable } from './useOverflowStyles.styles';
@@ -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"}
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
+ import { useOverflowContext } from '../../overflowContext';
5
+ /**
6
+ * Renderless opt-in component that observes the `<Overflow>` container for
7
+ * direct-child DOM mutations and triggers an overflow recompute. Drop it
8
+ * inside `<Overflow>` when items can be reordered, added, or removed via
9
+ * React state without a container resize — Fluent's overflow manager only
10
+ * listens to `ResizeObserver` otherwise, so reorders leave visibility flags
11
+ * stale.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <Overflow>
16
+ * <div>
17
+ * <OverflowReorderObserver />
18
+ * {items.map(id => <OverflowItem key={id} id={id} priority={1}>{id}</OverflowItem>)}
19
+ * </div>
20
+ * </Overflow>
21
+ * ```
22
+ */ export const OverflowReorderObserver = ()=>{
23
+ const containerRef = useOverflowContext((v)=>v.containerRef);
24
+ const updateOverflow = useOverflowContext((v)=>v.updateOverflow);
25
+ const { targetDocument } = useFluent();
26
+ const targetWindow = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
27
+ React.useEffect(()=>{
28
+ const el = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
29
+ if (!el || !(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.MutationObserver)) {
30
+ return;
31
+ }
32
+ const mutationObserver = new targetWindow.MutationObserver(()=>updateOverflow());
33
+ mutationObserver.observe(el, {
34
+ childList: true
35
+ });
36
+ return ()=>mutationObserver.disconnect();
37
+ }, [
38
+ containerRef,
39
+ updateOverflow,
40
+ targetWindow
41
+ ]);
42
+ return null;
43
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/OverflowReorderObserver/OverflowReorderObserver.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useOverflowContext } from '../../overflowContext';\n\n/**\n * Renderless opt-in component that observes the `<Overflow>` container for\n * direct-child DOM mutations and triggers an overflow recompute. Drop it\n * inside `<Overflow>` when items can be reordered, added, or removed via\n * React state without a container resize — Fluent's overflow manager only\n * listens to `ResizeObserver` otherwise, so reorders leave visibility flags\n * stale.\n *\n * @example\n * ```tsx\n * <Overflow>\n * <div>\n * <OverflowReorderObserver />\n * {items.map(id => <OverflowItem key={id} id={id} priority={1}>{id}</OverflowItem>)}\n * </div>\n * </Overflow>\n * ```\n */\nexport const OverflowReorderObserver: React.FC = () => {\n const containerRef = useOverflowContext(v => v.containerRef);\n const updateOverflow = useOverflowContext(v => v.updateOverflow);\n const { targetDocument } = useFluent();\n const targetWindow = targetDocument?.defaultView;\n\n React.useEffect(() => {\n const el = containerRef?.current;\n if (!el || !targetWindow?.MutationObserver) {\n return;\n }\n\n const mutationObserver = new targetWindow.MutationObserver(() => updateOverflow());\n mutationObserver.observe(el, { childList: true });\n\n return () => mutationObserver.disconnect();\n }, [containerRef, updateOverflow, targetWindow]);\n\n return null;\n};\n"],"names":["React","useFluent_unstable","useFluent","useOverflowContext","OverflowReorderObserver","containerRef","v","updateOverflow","targetDocument","targetWindow","defaultView","useEffect","el","current","MutationObserver","mutationObserver","observe","childList","disconnect"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,kBAAkB,QAAQ,wBAAwB;AAE3D;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMC,0BAAoC;IAC/C,MAAMC,eAAeF,mBAAmBG,CAAAA,IAAKA,EAAED,YAAY;IAC3D,MAAME,iBAAiBJ,mBAAmBG,CAAAA,IAAKA,EAAEC,cAAc;IAC/D,MAAM,EAAEC,cAAc,EAAE,GAAGN;IAC3B,MAAMO,eAAeD,2BAAAA,qCAAAA,eAAgBE,WAAW;IAEhDV,MAAMW,SAAS,CAAC;QACd,MAAMC,KAAKP,yBAAAA,mCAAAA,aAAcQ,OAAO;QAChC,IAAI,CAACD,MAAM,EAACH,yBAAAA,mCAAAA,aAAcK,gBAAgB,GAAE;YAC1C;QACF;QAEA,MAAMC,mBAAmB,IAAIN,aAAaK,gBAAgB,CAAC,IAAMP;QACjEQ,iBAAiBC,OAAO,CAACJ,IAAI;YAAEK,WAAW;QAAK;QAE/C,OAAO,IAAMF,iBAAiBG,UAAU;IAC1C,GAAG;QAACb;QAAcE;QAAgBE;KAAa;IAE/C,OAAO;AACT,EAAE"}
@@ -0,0 +1 @@
1
+ export { OverflowReorderObserver } from './OverflowReorderObserver';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/OverflowReorderObserver/index.ts"],"sourcesContent":["export { OverflowReorderObserver } from './OverflowReorderObserver';\n"],"names":["OverflowReorderObserver"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,4BAA4B"}
package/lib/index.js CHANGED
@@ -1,13 +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';
15
+ export { OverflowReorderObserver } from './components/OverflowReorderObserver';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { Overflow } from './components/Overflow';\nexport type { OverflowProps, OnOverflowChangeData } 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 { useOverflowCount } from './useOverflowCount';\nexport { useOverflowItem } from './useOverflowItem';\nexport { useOverflowMenu } from './useOverflowMenu';\nexport { useOverflowDivider } from './useOverflowDivider';\nexport { useOverflowVisibility } from './useOverflowVisibility';\n\nexport { useOverflowContext } from './overflowContext';\n\nexport type { OverflowItemProps } from './components/OverflowItem/OverflowItem.types';\nexport { OverflowItem } from './components/OverflowItem/OverflowItem';\nexport { OverflowDivider } from './components/OverflowDivider/OverflowDivider';\n"],"names":["Overflow","DATA_OVERFLOWING","DATA_OVERFLOW_ITEM","DATA_OVERFLOW_MENU","DATA_OVERFLOW_DIVIDER","useIsOverflowGroupVisible","useIsOverflowItemVisible","useOverflowContainer","useOverflowCount","useOverflowItem","useOverflowMenu","useOverflowDivider","useOverflowVisibility","useOverflowContext","OverflowItem","OverflowDivider"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,wBAAwB;AAEjD,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,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,QAAQ,oBAAoB;AAGvD,SAASC,YAAY,QAAQ,yCAAyC;AACtE,SAASC,eAAe,QAAQ,+CAA+C"}
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"}
@@ -1,15 +1,28 @@
1
1
  'use client';
2
- import { createContext, useContextSelector } from '@fluentui/react-context-selector';
3
- export const OverflowContext = createContext(undefined);
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
- hasOverflow: false,
8
- registerItem: ()=>()=>null,
9
- updateOverflow: ()=>null,
10
- registerOverflowMenu: ()=>()=>null,
11
- registerDivider: ()=>()=>null
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
- * @internal
15
- */ export const useOverflowContext = (selector)=>useContextSelector(OverflowContext, (ctx = overflowContextDefaultValue)=>selector(ctx));
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 { OverflowGroupState, OverflowItemEntry, OverflowDividerEntry } from '@fluentui/priority-overflow';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\n\n/**\n * @internal\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 registerDivider: (divider: OverflowDividerEntry) => () => 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 registerDivider: () => () => null,\n};\n\n/**\n * @internal\n */\nexport const useOverflowContext = <SelectedValue>(\n selector: ContextSelector<OverflowContextValue, SelectedValue>,\n): SelectedValue => useContextSelector(OverflowContext, (ctx = overflowContextDefaultValue) => selector(ctx));\n"],"names":["createContext","useContextSelector","OverflowContext","undefined","overflowContextDefaultValue","itemVisibility","groupVisibility","hasOverflow","registerItem","updateOverflow","registerOverflowMenu","registerDivider","useOverflowContext","selector","ctx"],"mappings":"AAAA;AAIA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,mCAAmC;AAerF,OAAO,MAAMC,kBAAkBF,cAC7BG,WACiC;AAEnC,MAAMC,8BAAoD;IACxDC,gBAAgB,CAAC;IACjBC,iBAAiB,CAAC;IAClBC,aAAa;IACbC,cAAc,IAAM,IAAM;IAC1BC,gBAAgB,IAAM;IACtBC,sBAAsB,IAAM,IAAM;IAClCC,iBAAiB,IAAM,IAAM;AAC/B;AAEA;;CAEC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,WACkBZ,mBAAmBC,iBAAiB,CAACY,MAAMV,2BAA2B,GAAKS,SAASC,MAAM"}
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
@@ -1,3 +1,3 @@
1
1
  /**
2
- * @internal
2
+ * @public
3
3
  */ export { };