@fluentui/react-positioning 9.9.23 → 9.10.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +27 -2
- package/dist/index.d.ts +5 -1
- package/lib/middleware/index.js +1 -0
- package/lib/middleware/index.js.map +1 -1
- package/lib/middleware/matchTargetSize.js +22 -0
- package/lib/middleware/matchTargetSize.js.map +1 -0
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js +5 -3
- package/lib/usePositioning.js.map +1 -1
- package/lib-commonjs/middleware/index.js +1 -0
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/matchTargetSize.js +32 -0
- package/lib-commonjs/middleware/matchTargetSize.js.map +1 -0
- package/lib-commonjs/usePositioning.js +4 -2
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/package.json +11 -5
- package/CHANGELOG.json +0 -3475
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,37 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 20 Nov 2023 09:51:22 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.10.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.10.1)
|
8
|
+
|
9
|
+
Mon, 20 Nov 2023 09:51:22 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.10.0..@fluentui/react-positioning_v9.10.1)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- Bump @fluentui/react-shared-contexts to v9.13.0 ([PR #29878](https://github.com/microsoft/fluentui/pull/29878) by beachball)
|
15
|
+
|
16
|
+
## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.10.0)
|
17
|
+
|
18
|
+
Thu, 09 Nov 2023 17:29:40 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.23..@fluentui/react-positioning_v9.10.0)
|
20
|
+
|
21
|
+
### Minor changes
|
22
|
+
|
23
|
+
- feat: add `matchTargetSize` positioning option ([PR #29690](https://github.com/microsoft/fluentui/pull/29690) by lingfangao@hotmail.com)
|
24
|
+
- Bump @fluentui/react-shared-contexts to v9.12.0 ([PR #29800](https://github.com/microsoft/fluentui/pull/29800) by beachball)
|
25
|
+
- Bump @fluentui/react-theme to v9.1.16 ([PR #29800](https://github.com/microsoft/fluentui/pull/29800) by beachball)
|
26
|
+
- Bump @fluentui/react-utilities to v9.15.2 ([PR #29800](https://github.com/microsoft/fluentui/pull/29800) by beachball)
|
27
|
+
|
28
|
+
### Patches
|
29
|
+
|
30
|
+
- chore: use package.json#files setup instead of npmignore for all v9 libraries ([PR #29734](https://github.com/microsoft/fluentui/pull/29734) by martinhochel@microsoft.com)
|
31
|
+
|
7
32
|
## [9.9.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.23)
|
8
33
|
|
9
|
-
Wed, 01 Nov 2023 12:
|
34
|
+
Wed, 01 Nov 2023 12:55:59 GMT
|
10
35
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.22..@fluentui/react-positioning_v9.9.23)
|
11
36
|
|
12
37
|
### Patches
|
package/dist/index.d.ts
CHANGED
@@ -218,12 +218,16 @@ declare interface PositioningOptions {
|
|
218
218
|
* If false, does not position anything
|
219
219
|
*/
|
220
220
|
enabled?: boolean;
|
221
|
+
/**
|
222
|
+
* When set, the positioned element matches the chosen dimension(s) of the target element
|
223
|
+
*/
|
224
|
+
matchTargetSize?: 'width';
|
221
225
|
}
|
222
226
|
|
223
227
|
/**
|
224
228
|
* Public api that allows components using react-positioning to specify positioning options
|
225
229
|
*/
|
226
|
-
export declare interface PositioningProps extends Pick<PositioningOptions, 'align' | 'arrowPadding' | 'autoSize' | 'coverTarget' | 'flipBoundary' | 'offset' | 'overflowBoundary' | 'overflowBoundaryPadding' | 'pinned' | 'position' | 'strategy' | 'useTransform'> {
|
230
|
+
export declare interface PositioningProps extends Pick<PositioningOptions, 'align' | 'arrowPadding' | 'autoSize' | 'coverTarget' | 'flipBoundary' | 'offset' | 'overflowBoundary' | 'overflowBoundaryPadding' | 'pinned' | 'position' | 'strategy' | 'useTransform' | 'matchTargetSize'> {
|
227
231
|
/** An imperative handle to Popper methods. */
|
228
232
|
positioningRef?: React_2.Ref<PositioningImperativeRef>;
|
229
233
|
/**
|
package/lib/middleware/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,UAAU"}
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\nexport * from './matchTargetSize';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,oBAAoB"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export function matchTargetSize() {
|
2
|
+
return {
|
3
|
+
name: 'matchTargetSize',
|
4
|
+
fn: async (middlewareArguments)=>{
|
5
|
+
const { rects: { reference: referenceRect, floating: floatingRect }, elements: { floating: floatingElement }, middlewareData: { matchTargetSizeAttempt = false } } = middlewareArguments;
|
6
|
+
if (referenceRect.width === floatingRect.width || matchTargetSizeAttempt) {
|
7
|
+
return {};
|
8
|
+
}
|
9
|
+
const { width } = referenceRect;
|
10
|
+
floatingElement.style.width = `${width}px`;
|
11
|
+
floatingElement.style.boxSizing = 'border-box';
|
12
|
+
return {
|
13
|
+
data: {
|
14
|
+
matchTargetSizeAttempt: true
|
15
|
+
},
|
16
|
+
reset: {
|
17
|
+
rects: true
|
18
|
+
}
|
19
|
+
};
|
20
|
+
}
|
21
|
+
};
|
22
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["matchTargetSize.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\n\nexport function matchTargetSize(): Middleware {\n return {\n name: 'matchTargetSize',\n fn: async middlewareArguments => {\n const {\n rects: { reference: referenceRect, floating: floatingRect },\n elements: { floating: floatingElement },\n middlewareData: { matchTargetSizeAttempt = false },\n } = middlewareArguments;\n\n if (referenceRect.width === floatingRect.width || matchTargetSizeAttempt) {\n return {};\n }\n\n const { width } = referenceRect;\n floatingElement.style.width = `${width}px`;\n floatingElement.style.boxSizing = 'border-box';\n\n return {\n data: { matchTargetSizeAttempt: true },\n reset: {\n rects: true,\n },\n };\n },\n };\n}\n"],"names":["matchTargetSize","name","fn","middlewareArguments","rects","reference","referenceRect","floating","floatingRect","elements","floatingElement","middlewareData","matchTargetSizeAttempt","width","style","boxSizing","data","reset"],"mappings":"AAEA,OAAO,SAASA;IACd,OAAO;QACLC,MAAM;QACNC,IAAI,OAAMC;YACR,MAAM,EACJC,OAAO,EAAEC,WAAWC,aAAa,EAAEC,UAAUC,YAAY,EAAE,EAC3DC,UAAU,EAAEF,UAAUG,eAAe,EAAE,EACvCC,gBAAgB,EAAEC,yBAAyB,KAAK,EAAE,EACnD,GAAGT;YAEJ,IAAIG,cAAcO,KAAK,KAAKL,aAAaK,KAAK,IAAID,wBAAwB;gBACxE,OAAO,CAAC;YACV;YAEA,MAAM,EAAEC,KAAK,EAAE,GAAGP;YAClBI,gBAAgBI,KAAK,CAACD,KAAK,GAAG,CAAC,EAAEA,MAAM,EAAE,CAAC;YAC1CH,gBAAgBI,KAAK,CAACC,SAAS,GAAG;YAElC,OAAO;gBACLC,MAAM;oBAAEJ,wBAAwB;gBAAK;gBACrCK,OAAO;oBACLb,OAAO;gBACT;YACF;QACF;IACF;AACF"}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\nexport type NormalizedAutoSize = { applyMaxWidth: boolean; applyMaxHeight: boolean };\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\n/**\n * Internal options for positioning\n */\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Applies a padding to the overflow bounadry, so that overflow is detected earlier before the\n * positioned surface hits the overflow boundary.\n */\n overflowBoundaryPadding?: number | Partial<{ top: number; end: number; bottom: number; start: number }>;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n * @deprecated use `strategy` instead\n */\n positionFixed?: boolean;\n\n /**\n * Specifies the type of CSS position property to use.\n * @default absolute\n */\n strategy?: 'absolute' | 'fixed';\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies styles on the positioned element to fit it within the available space in viewport.\n * - true: set styles for max height/width.\n * - 'height': set styles for max height.\n * - 'width'': set styles for max width.\n * Note that options 'always'/'height-always'/'width-always' are now obsolete, and equivalent to true/'height'/'width'.\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n\n /**\n * If flip fails to stop the positioned element from overflowing\n * its boundaries, use a specified fallback positions.\n */\n fallbackPositions?: PositioningShorthandValue[];\n\n /**\n * Modifies whether popover is positioned using transform.\n * @default true\n */\n useTransform?: boolean;\n\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\n/**\n * Public api that allows components using react-positioning to specify positioning options\n */\nexport interface PositioningProps\n extends Pick<\n PositioningOptions,\n | 'align'\n | 'arrowPadding'\n | 'autoSize'\n | 'coverTarget'\n | 'flipBoundary'\n | 'offset'\n | 'overflowBoundary'\n | 'overflowBoundaryPadding'\n | 'pinned'\n | 'position'\n | 'strategy'\n | 'useTransform'\n > {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\nexport type NormalizedAutoSize = { applyMaxWidth: boolean; applyMaxHeight: boolean };\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\n/**\n * Internal options for positioning\n */\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Applies a padding to the overflow bounadry, so that overflow is detected earlier before the\n * positioned surface hits the overflow boundary.\n */\n overflowBoundaryPadding?: number | Partial<{ top: number; end: number; bottom: number; start: number }>;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n * @deprecated use `strategy` instead\n */\n positionFixed?: boolean;\n\n /**\n * Specifies the type of CSS position property to use.\n * @default absolute\n */\n strategy?: 'absolute' | 'fixed';\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies styles on the positioned element to fit it within the available space in viewport.\n * - true: set styles for max height/width.\n * - 'height': set styles for max height.\n * - 'width'': set styles for max width.\n * Note that options 'always'/'height-always'/'width-always' are now obsolete, and equivalent to true/'height'/'width'.\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n\n /**\n * If flip fails to stop the positioned element from overflowing\n * its boundaries, use a specified fallback positions.\n */\n fallbackPositions?: PositioningShorthandValue[];\n\n /**\n * Modifies whether popover is positioned using transform.\n * @default true\n */\n useTransform?: boolean;\n\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n\n /**\n * When set, the positioned element matches the chosen dimension(s) of the target element\n */\n matchTargetSize?: 'width';\n}\n\n/**\n * Public api that allows components using react-positioning to specify positioning options\n */\nexport interface PositioningProps\n extends Pick<\n PositioningOptions,\n | 'align'\n | 'arrowPadding'\n | 'autoSize'\n | 'coverTarget'\n | 'flipBoundary'\n | 'offset'\n | 'overflowBoundary'\n | 'overflowBoundaryPadding'\n | 'pinned'\n | 'position'\n | 'strategy'\n | 'useTransform'\n | 'matchTargetSize'\n > {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
package/lib/usePositioning.js
CHANGED
@@ -3,7 +3,7 @@ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
3
3
|
import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
4
4
|
import * as React from 'react';
|
5
5
|
import { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';
|
6
|
-
import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';
|
6
|
+
import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware, matchTargetSize as matchTargetSizeMiddleware } from './middleware';
|
7
7
|
import { createPositionManager } from './createPositionManager';
|
8
8
|
/**
|
9
9
|
* @internal
|
@@ -134,7 +134,7 @@ import { createPositionManager } from './createPositionManager';
|
|
134
134
|
}
|
135
135
|
function usePositioningOptions(options) {
|
136
136
|
const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, // eslint-disable-next-line deprecation/deprecation
|
137
|
-
positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform } = options;
|
137
|
+
positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform, matchTargetSize } = options;
|
138
138
|
const { dir } = useFluent();
|
139
139
|
const isRtl = dir === 'rtl';
|
140
140
|
const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';
|
@@ -143,6 +143,7 @@ function usePositioningOptions(options) {
|
|
143
143
|
const hasScrollableElement = hasScrollParent(container);
|
144
144
|
const middleware = [
|
145
145
|
autoSize && resetMaxSizeMiddleware(autoSize),
|
146
|
+
matchTargetSize && matchTargetSizeMiddleware(),
|
146
147
|
offset && offsetMiddleware(offset),
|
147
148
|
coverTarget && coverTargetMiddleware(),
|
148
149
|
!pinned && flipMiddleware({
|
@@ -198,6 +199,7 @@ function usePositioningOptions(options) {
|
|
198
199
|
positionStrategy,
|
199
200
|
overflowBoundaryPadding,
|
200
201
|
fallbackPositions,
|
201
|
-
useTransform
|
202
|
+
useTransform,
|
203
|
+
matchTargetSize
|
202
204
|
]);
|
203
205
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n resetMaxSize as resetMaxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: PositioningProps & PositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize: rawAutoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n // eslint-disable-next-line deprecation/deprecation\n positionFixed,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy: Strategy = strategy ?? positionFixed ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n ],\n );\n}\n"],"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","normalizeAutoSize","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","resetMaxSize","resetMaxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","dir","isRtl","positionStrategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"mappings":"AAAA,SAASA,QAAQC,cAAc,EAAEC,SAASC,eAAe,QAAQ,mBAAmB;AAEpF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,yBAAyB,QAAQ,4BAA4B;AACnG,YAAYC,WAAW,QAAQ;AAQ/B,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,kBAAkB,EAAEC,eAAe,EAAEC,iBAAiB,QAAQ,UAAU;AACxH,SACEC,SAAS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gBAAgB;gBACd8B;gBACA8C;gBACAb;gBACAI;gBACAG;gBACAI;YACF;YACAd,YAAYtD,kBAAkBsD,UAAU;gBAAE9B;gBAAWiC;YAAiB;YACtEnD;YACA1B,SAASC,gBAAgB;gBAAE2F,SAAS5F;gBAAO6F,SAASpB;YAAa;YACjE1E,eAAe;gBAAEoF,UAAU;YAAkB;YAC7CpF,eAAe;gBAAEoF,UAAU;YAAU;SACtC,CAACW,MAAM,CAACC;QAET,MAAMC,YAAYvF,sBAAsB+D,OAAOO,UAAUS;QAEzD,OAAO;YACLQ;YACAL;YACAR,UAAUM;YACVH;QACF;IACF,GACA;QACEd;QACAC;QACAC;QACAzD;QACAgE;QACAL;QACAY;QACAjE;QACAsD;QACAC;QACAC;QACAU;QACAL;QACAC;QACAC;KACD;AAEL"}
|
1
|
+
{"version":3,"sources":["usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n resetMaxSize as resetMaxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n matchTargetSize as matchTargetSizeMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: PositioningProps & PositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize: rawAutoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n // eslint-disable-next-line deprecation/deprecation\n positionFixed,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy: Strategy = strategy ?? positionFixed ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n matchTargetSize && matchTargetSizeMiddleware(),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n ],\n );\n}\n"],"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","normalizeAutoSize","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","resetMaxSize","resetMaxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","matchTargetSize","matchTargetSizeMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","dir","isRtl","positionStrategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"mappings":"AAAA,SAASA,QAAQC,cAAc,EAAEC,SAASC,eAAe,QAAQ,mBAAmB;AAEpF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,yBAAyB,QAAQ,4BAA4B;AACnG,YAAYC,WAAW,QAAQ;AAQ/B,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,kBAAkB,EAAEC,eAAe,EAAEC,iBAAiB,QAAQ,UAAU;AACxH,SACEC,SAASC,eAAe,EACxBC,QAAQC,cAAc,EACtBC,eAAeC,qBAAqB,EACpCC,WAAWC,iBAAiB,EAC5BC,gBAAgBC,sBAAsB,EACtCC,UAAUC,gBAAgB,EAC1BC,gBAAgBC,sBAAsB,EACtCC,mBAAmBC,yBAAyB,QACvC,eAAe;AACtB,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE;;CAEC,GACD,OAAO,SAASC,eAAeC,OAA8C;IAC3E,MAAMC,aAAazB,MAAM0B,MAAM,CAAyB;IACxD,MAAMC,YAAY3B,MAAM0B,MAAM,CAAuB;IACrD,MAAME,oBAAoB5B,MAAM0B,MAAM,CAAuB;IAC7D,MAAMG,eAAe7B,MAAM0B,MAAM,CAAqB;IACtD,MAAMI,WAAW9B,MAAM0B,MAAM,CAAqB;IAElD,MAAM,EAAEK,UAAU,IAAI,EAAE,GAAG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ACAC;QACAC;QACA7D;KACD;AAEL"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\nexport * from './matchTargetSize';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "matchTargetSize", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return matchTargetSize;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
function matchTargetSize() {
|
12
|
+
return {
|
13
|
+
name: 'matchTargetSize',
|
14
|
+
fn: async (middlewareArguments)=>{
|
15
|
+
const { rects: { reference: referenceRect, floating: floatingRect }, elements: { floating: floatingElement }, middlewareData: { matchTargetSizeAttempt = false } } = middlewareArguments;
|
16
|
+
if (referenceRect.width === floatingRect.width || matchTargetSizeAttempt) {
|
17
|
+
return {};
|
18
|
+
}
|
19
|
+
const { width } = referenceRect;
|
20
|
+
floatingElement.style.width = `${width}px`;
|
21
|
+
floatingElement.style.boxSizing = 'border-box';
|
22
|
+
return {
|
23
|
+
data: {
|
24
|
+
matchTargetSizeAttempt: true
|
25
|
+
},
|
26
|
+
reset: {
|
27
|
+
rects: true
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
};
|
32
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["matchTargetSize.js"],"sourcesContent":["export function matchTargetSize() {\n return {\n name: 'matchTargetSize',\n fn: async (middlewareArguments)=>{\n const { rects: { reference: referenceRect, floating: floatingRect }, elements: { floating: floatingElement }, middlewareData: { matchTargetSizeAttempt = false } } = middlewareArguments;\n if (referenceRect.width === floatingRect.width || matchTargetSizeAttempt) {\n return {};\n }\n const { width } = referenceRect;\n floatingElement.style.width = `${width}px`;\n floatingElement.style.boxSizing = 'border-box';\n return {\n data: {\n matchTargetSizeAttempt: true\n },\n reset: {\n rects: true\n }\n };\n }\n };\n}\n"],"names":["matchTargetSize","name","fn","middlewareArguments","rects","reference","referenceRect","floating","floatingRect","elements","floatingElement","middlewareData","matchTargetSizeAttempt","width","style","boxSizing","data","reset"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA;IACZ,OAAO;QACHC,MAAM;QACNC,IAAI,OAAOC;YACP,MAAM,EAAEC,OAAO,EAAEC,WAAWC,aAAa,EAAEC,UAAUC,YAAY,EAAE,EAAEC,UAAU,EAAEF,UAAUG,eAAe,EAAE,EAAEC,gBAAgB,EAAEC,yBAAyB,KAAK,EAAE,EAAE,GAAGT;YACrK,IAAIG,cAAcO,KAAK,KAAKL,aAAaK,KAAK,IAAID,wBAAwB;gBACtE,OAAO,CAAC;YACZ;YACA,MAAM,EAAEC,KAAK,EAAE,GAAGP;YAClBI,gBAAgBI,KAAK,CAACD,KAAK,GAAG,CAAC,EAAEA,MAAM,EAAE,CAAC;YAC1CH,gBAAgBI,KAAK,CAACC,SAAS,GAAG;YAClC,OAAO;gBACHC,MAAM;oBACFJ,wBAAwB;gBAC5B;gBACAK,OAAO;oBACHb,OAAO;gBACX;YACJ;QACJ;IACJ;AACJ"}
|
@@ -142,7 +142,7 @@ function usePositioning(options) {
|
|
142
142
|
};
|
143
143
|
}
|
144
144
|
function usePositioningOptions(options) {
|
145
|
-
const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform } = options;
|
145
|
+
const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform, matchTargetSize } = options;
|
146
146
|
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
|
147
147
|
const isRtl = dir === 'rtl';
|
148
148
|
const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';
|
@@ -151,6 +151,7 @@ function usePositioningOptions(options) {
|
|
151
151
|
const hasScrollableElement = (0, _utils.hasScrollParent)(container);
|
152
152
|
const middleware = [
|
153
153
|
autoSize && (0, _middleware.resetMaxSize)(autoSize),
|
154
|
+
matchTargetSize && (0, _middleware.matchTargetSize)(),
|
154
155
|
offset && (0, _middleware.offset)(offset),
|
155
156
|
coverTarget && (0, _middleware.coverTarget)(),
|
156
157
|
!pinned && (0, _middleware.flip)({
|
@@ -206,6 +207,7 @@ function usePositioningOptions(options) {
|
|
206
207
|
positionStrategy,
|
207
208
|
overflowBoundaryPadding,
|
208
209
|
fallbackPositions,
|
209
|
-
useTransform
|
210
|
+
useTransform,
|
211
|
+
matchTargetSize
|
210
212
|
]);
|
211
213
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePositioning.js"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';\nimport { createPositionManager } from './createPositionManager';\n/**\n * @internal\n */ export function usePositioning(options) {\n const managerRef = React.useRef(null);\n const targetRef = React.useRef(null);\n const overrideTargetRef = React.useRef(null);\n const containerRef = React.useRef(null);\n const arrowRef = React.useRef(null);\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(()=>{\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n var _overrideTargetRef_current;\n const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current)\n });\n }\n }, [\n enabled,\n resolvePositioningOptions\n ]);\n const setOverrideTarget = useEventCallback((target)=>{\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n React.useImperativeHandle(options.positioningRef, ()=>({\n updatePosition: ()=>{\n var _managerRef_current;\n return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();\n },\n setTarget: (target)=>{\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n setOverrideTarget(target);\n }\n }), [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n var _options_target;\n setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);\n }, [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n updatePositionManager();\n }, [\n updatePositionManager\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (containerRef.current) {\n var _contentNode_ownerDocument;\n const contentNode = containerRef.current;\n const treeWalker = (_contentNode_ownerDocument = contentNode.ownerDocument) === null || _contentNode_ownerDocument === void 0 ? void 0 : _contentNode_ownerDocument.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter\n });\n while(treeWalker.nextNode()){\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn([\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element'\n ].join(' '));\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n const setTarget = useCallbackRef(null, (target)=>{\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n const setContainer = useCallbackRef(null, (container)=>{\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n const setArrow = useCallbackRef(null, (arrow)=>{\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n // Let users use callback refs so they feel like 'normal' DOM refs\n return {\n targetRef: setTarget,\n containerRef: setContainer,\n arrowRef: setArrow\n };\n}\nfunction usePositioningOptions(options) {\n const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, // eslint-disable-next-line deprecation/deprecation\n positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform } = options;\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n return React.useCallback((container, arrow)=>{\n const hasScrollableElement = hasScrollParent(container);\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({\n container,\n flipBoundary,\n hasScrollableElement,\n isRtl,\n fallbackPositions\n }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl\n }),\n autoSize && maxSizeMiddleware(autoSize, {\n container,\n overflowBoundary\n }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({\n element: arrow,\n padding: arrowPadding\n }),\n hideMiddleware({\n strategy: 'referenceHidden'\n }),\n hideMiddleware({\n strategy: 'escaped'\n })\n ].filter(Boolean);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform\n };\n }, [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform\n ]);\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","_overrideTargetRef_current","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","_managerRef_current","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","_options_target","useEffect","_contentNode_ownerDocument","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","dir","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","filter","Boolean","placement","toFloatingUIPlacement"],"mappings":";;;;+BASoBA;;;eAAAA;;;;qBAT6C;qCACjB;gCACuB;iEAChD;uBACuF;4BACmI;uCAC3M;AAG3B,SAASA,eAAeC,OAAO;IACtC,MAAMC,aAAaC,OAAMC,MAAM,CAAC;IAChC,MAAMC,YAAYF,OAAMC,MAAM,CAAC;IAC/B,MAAME,oBAAoBH,OAAMC,MAAM,CAAC;IACvC,MAAMG,eAAeJ,OAAMC,MAAM,CAAC;IAClC,MAAMI,WAAWL,OAAMC,MAAM,CAAC;IAC9B,MAAM,EAAEK,UAAU,IAAI,EAAE,GAAGR;IAC3B,MAAMS,4BAA4BC,sBAAsBV;IACxD,MAAMW,wBAAwBT,OAAMU,WAAW,CAAC;QAC5C,IAAIX,WAAWY,OAAO,EAAE;YACpBZ,WAAWY,OAAO,CAACC,OAAO;QAC9B;QACAb,WAAWY,OAAO,GAAG;QACrB,IAAIE;QACJ,MAAMC,SAAS,AAACD,CAAAA,6BAA6BV,kBAAkBQ,OAAO,AAAD,MAAO,QAAQE,+BAA+B,KAAK,IAAIA,6BAA6BX,UAAUS,OAAO;QAC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;IACJ,GAAG;QACChB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAc;QACAb;QACAC;QACAC;QACAC;QACAW;QACAN;QACAC;QACAC;KACH;AACL"}
|
1
|
+
{"version":3,"sources":["usePositioning.js"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware, matchTargetSize as matchTargetSizeMiddleware } from './middleware';\nimport { createPositionManager } from './createPositionManager';\n/**\n * @internal\n */ export function usePositioning(options) {\n const managerRef = React.useRef(null);\n const targetRef = React.useRef(null);\n const overrideTargetRef = React.useRef(null);\n const containerRef = React.useRef(null);\n const arrowRef = React.useRef(null);\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(()=>{\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n var _overrideTargetRef_current;\n const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current)\n });\n }\n }, [\n enabled,\n resolvePositioningOptions\n ]);\n const setOverrideTarget = useEventCallback((target)=>{\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n React.useImperativeHandle(options.positioningRef, ()=>({\n updatePosition: ()=>{\n var _managerRef_current;\n return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();\n },\n setTarget: (target)=>{\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n setOverrideTarget(target);\n }\n }), [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n var _options_target;\n setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);\n }, [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n updatePositionManager();\n }, [\n updatePositionManager\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (containerRef.current) {\n var _contentNode_ownerDocument;\n const contentNode = containerRef.current;\n const treeWalker = (_contentNode_ownerDocument = contentNode.ownerDocument) === null || _contentNode_ownerDocument === void 0 ? void 0 : _contentNode_ownerDocument.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter\n });\n while(treeWalker.nextNode()){\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn([\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element'\n ].join(' '));\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n const setTarget = useCallbackRef(null, (target)=>{\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n const setContainer = useCallbackRef(null, (container)=>{\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n const setArrow = useCallbackRef(null, (arrow)=>{\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n // Let users use callback refs so they feel like 'normal' DOM refs\n return {\n targetRef: setTarget,\n containerRef: setContainer,\n arrowRef: setArrow\n };\n}\nfunction usePositioningOptions(options) {\n const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, // eslint-disable-next-line deprecation/deprecation\n positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform, matchTargetSize } = options;\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n return React.useCallback((container, arrow)=>{\n const hasScrollableElement = hasScrollParent(container);\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n matchTargetSize && matchTargetSizeMiddleware(),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({\n container,\n flipBoundary,\n hasScrollableElement,\n isRtl,\n fallbackPositions\n }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl\n }),\n autoSize && maxSizeMiddleware(autoSize, {\n container,\n overflowBoundary\n }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({\n element: arrow,\n padding: arrowPadding\n }),\n hideMiddleware({\n strategy: 'referenceHidden'\n }),\n hideMiddleware({\n strategy: 'escaped'\n })\n ].filter(Boolean);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform\n };\n }, [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize\n ]);\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","_overrideTargetRef_current","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","_managerRef_current","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","_options_target","useEffect","_contentNode_ownerDocument","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","matchTargetSize","dir","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","matchTargetSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","filter","Boolean","placement","toFloatingUIPlacement"],"mappings":";;;;+BASoBA;;;eAAAA;;;;qBAT6C;qCACjB;gC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AsB,EAACxB;YACnCe,mBAAmBU,IAAAA,2BAAyB;YAC5CrB,UAAUsB,IAAAA,kBAAgB,EAACtB;YAC3BF,eAAeyB,IAAAA,uBAAqB;YACpC,CAACrB,UAAUsB,IAAAA,gBAAc,EAAC;gBACtBlE;gBACAyC;gBACAkB;gBACAH;gBACAL;YACJ;YACAgB,IAAAA,iBAAe,EAAC;gBACZnE;gBACA2D;gBACAhB;gBACAI;gBACAG;gBACAM;YACJ;YACAlB,YAAY8B,IAAAA,mBAAiB,EAAC9B,UAAU;gBACpCtC;gBACA2C;YACJ;YACA0B,IAAAA,wBAAsB;YACtBpE,SAASqE,IAAAA,UAAe,EAAC;gBACrBC,SAAStE;gBACTuE,SAASnC;YACb;YACAoC,IAAAA,SAAc,EAAC;gBACXxB,UAAU;YACd;YACAwB,IAAAA,SAAc,EAAC;gBACXxB,UAAU;YACd;SACH,CAACyB,MAAM,CAACC;QACT,MAAMC,YAAYC,IAAAA,4BAAqB,EAACzC,OAAOS,UAAUW;QACzD,OAAO;YACHoB;YACAf;YACAZ,UAAUQ;YACVL;QACJ;IACJ,GAAG;QACChB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAe;QACAd;QACAC;QACAC;QACAC;QACAY;QACAP;QACAC;QACAC;QACAC;KACH;AACL"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.10.1",
|
4
4
|
"description": "A react wrapper around Popper.js for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -30,9 +30,9 @@
|
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"@floating-ui/dom": "^1.2.0",
|
33
|
-
"@fluentui/react-shared-contexts": "^9.
|
34
|
-
"@fluentui/react-theme": "^9.1.
|
35
|
-
"@fluentui/react-utilities": "^9.15.
|
33
|
+
"@fluentui/react-shared-contexts": "^9.13.0",
|
34
|
+
"@fluentui/react-theme": "^9.1.16",
|
35
|
+
"@fluentui/react-utilities": "^9.15.2",
|
36
36
|
"@griffel/react": "^1.5.14",
|
37
37
|
"@swc/helpers": "^0.5.1"
|
38
38
|
},
|
@@ -55,5 +55,11 @@
|
|
55
55
|
"require": "./lib-commonjs/index.js"
|
56
56
|
},
|
57
57
|
"./package.json": "./package.json"
|
58
|
-
}
|
58
|
+
},
|
59
|
+
"files": [
|
60
|
+
"*.md",
|
61
|
+
"dist/*.d.ts",
|
62
|
+
"lib",
|
63
|
+
"lib-commonjs"
|
64
|
+
]
|
59
65
|
}
|