@fluentui/react-positioning 9.4.3 → 9.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +51 -1
- package/CHANGELOG.md +22 -2
- package/dist/index.d.ts +7 -2
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js +19 -3
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js +4 -2
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js +6 -3
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-amd/middleware/flip.js +10 -2
- package/lib-amd/middleware/flip.js.map +1 -1
- package/lib-amd/middleware/maxSize.js +2 -0
- package/lib-amd/middleware/maxSize.js.map +1 -1
- package/lib-amd/types.js.map +1 -1
- package/lib-amd/usePositioning.js +3 -2
- package/lib-amd/usePositioning.js.map +1 -1
- package/lib-amd/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js +18 -2
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js +4 -2
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js +6 -3
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":"AAuEA,IAAKA,OAuBJ;AAvBD,WAAKA,OAAO;EACVA,+DAAqB;EACrBA,yDAAkB;EAClBA,yEAA0B;EAC1BA,6CAAY;EACZA,iDAAc;EACdA,uDAAiB;EACjBA,6CAAY;EACZA,6CAAY;EACZA,qCAAQ;EACRA,2DAAmB;EACnBA,4DAAoB;EACpBA,kDAAe;EACfA,8CAAa;EACbA,gEAAsB;EACtBA,wDAAkB;EAClBA,oEAAwB;EACxBA,wDAAkB;EAClBA,8EAA6B;EAC7BA,kEAAuB;EACvBA,wEAA0B;EAC1BA,sEAAyB;EACzBA,0DAAmB;AACrB,CAAC,EAvBIA,OAAO,KAAPA,OAAO;AAsLZ,OAAM,SAAUC,qBAAqB,CAACC,GAAqB;EACzD,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,IAAI;;EAGb,KAAK,MAAMC,CAAC,IAAID,GAAG,EAAE;IACnB;IACA;IACA;IACA,IAAIC,CAAC,CAACC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAID,CAAC,CAACC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAC,CAAC;;;EAIjB,MAAM,IAAIE,KAAK,CAAC,yDAAyD,CAAC;AAC5E","names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"]}
|
1
|
+
{"version":3,"names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sources":["../src/packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"mappings":"AAuEA,IAAKA,OAuBJ;AAvBD,WAAKA,OAAO;EACVA,OAAA,CAAAA,OAAA,gDAAqB;EACrBA,OAAA,CAAAA,OAAA,0CAAkB;EAClBA,OAAA,CAAAA,OAAA,0DAA0B;EAC1BA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,kCAAc;EACdA,OAAA,CAAAA,OAAA,wCAAiB;EACjBA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,sBAAQ;EACRA,OAAA,CAAAA,OAAA,4CAAmB;EACnBA,OAAA,CAAAA,OAAA,6CAAoB;EACpBA,OAAA,CAAAA,OAAA,mCAAe;EACfA,OAAA,CAAAA,OAAA,+BAAa;EACbA,OAAA,CAAAA,OAAA,iDAAsB;EACtBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,qDAAwB;EACxBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,+DAA6B;EAC7BA,OAAA,CAAAA,OAAA,mDAAuB;EACvBA,OAAA,CAAAA,OAAA,yDAA0B;EAC1BA,OAAA,CAAAA,OAAA,uDAAyB;EACzBA,OAAA,CAAAA,OAAA,2CAAmB;AACrB,CAAC,EAvBIA,OAAO,KAAPA,OAAO;AAsLZ,OAAM,SAAUC,qBAAqBA,CAACC,GAAqB;EACzD,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,IAAI;;EAGb,KAAK,MAAMC,CAAC,IAAID,GAAG,EAAE;IACnB;IACA;IACA;IACA,IAAIC,CAAC,CAACC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAID,CAAC,CAACC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAC,CAAC;;;EAIjB,MAAM,IAAIE,KAAK,CAAC,yDAAyD,CAAC;AAC5E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","window","_a","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","scrollParentElement"],"sources":["../src/packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"mappings":"AAAA;;;;;AAKA,OAAO,MAAMA,aAAa,GAAIC,IAAiB,IAAiB;EAC9D,IAAIA,IAAI,CAACC,QAAQ,KAAK,MAAM,EAAE;IAC5B,OAAOD,IAAI;;EAEb;EACA,OAAOA,IAAI,CAACE,UAAU,IAAKF,IAAY,CAACG,IAAI;AAC9C,CAAC;AAED;;;;;AAKA,MAAMC,wBAAwB,GAAIJ,IAAiB,IAAkC;;EACnF,IAAIA,IAAI,CAACK,QAAQ,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;;EAGX,MAAMC,MAAM,GAAG,CAAAC,EAAA,GAAAP,IAAI,CAACQ,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,WAAW;EAC9C,OAAOH,MAAO,CAACI,gBAAgB,CAACV,IAAI,EAAE,IAAI,CAAC;AAC7C,CAAC;AAED;;;;;AAKA,OAAO,MAAMW,eAAe,GAAIX,IAAmC,IAAiB;EAClF;EACA,MAAME,UAAU,GAAGF,IAAI,IAAID,aAAa,CAACC,IAAmB,CAAC;EAC7D;EACA,IAAI,CAACE,UAAU,EAAE,OAAOU,QAAQ,CAACC,IAAI;EAErC,QAAQX,UAAU,CAACD,QAAQ;IACzB,KAAK,MAAM;IACX,KAAK,MAAM;MACT,OAAOC,UAAU,CAACM,aAAc,CAACK,IAAI;IACvC,KAAK,WAAW;MACd,OAAQX,UAAkC,CAACW,IAAI;EAAC;EAGpD;EACA,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAS,CAAE,GAAGZ,wBAAwB,CAACF,UAAU,CAAC;EAC/E,IAAI,uBAAuB,CAACe,IAAI,CAACH,QAAS,GAAGE,SAAU,GAAGD,SAAS,CAAC,EAAE;IACpE,OAAOb,UAAU;;EAGnB,OAAOS,eAAe,CAACT,UAAU,CAAC;AACpC,CAAC;AAED,OAAO,MAAMgB,eAAe,GAAIlB,IAAmC,IAAa;;EAC9E,MAAMmB,mBAAmB,GAAgBR,eAAe,CAACX,IAAI,CAAC;EAC9D,OAAOmB,mBAAmB,GAAGA,mBAAmB,MAAK,CAAAZ,EAAA,GAAAY,mBAAmB,CAACX,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEM,IAAI,IAAG,KAAK;AACtG,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_a","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"sources":["../src/packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,qBAAqB,QAAQ,yBAAyB;AAE/D;;;;;;AAMA,SAASC,gBAAgBA,CAACC,IAAU;;EAClC;EACA,MAAMC,sBAAsB,GAC1BD,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,OAAO,IACzBF,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,UAAU;EAE9B,IAAID,sBAAsB,EAAE;IAC1B,OAAO,CAAC,EAAC,CAAAE,EAAA,GAAAL,qBAAqB,CAACE,IAAI,CAAC,cAAAG,EAAA,uBAAAA,EAAA,CAAEC,YAAY,CAACC,SAAS;;EAG9D,OAAO,KAAK;AACd;AAEA,OAAM,SAAUC,kBAAkBA,CAACN,IAAU;EAC3C,OAAOD,gBAAgB,CAACC,IAAI,CAAC,GAAGO,UAAU,CAACC,aAAa,GAAGD,UAAU,CAACE,WAAW;AACnF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","_a"],"sources":["../src/packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"mappings":"AAEA;;;;;;;;;AASA,OAAM,SAAUA,gBAAgBA,CAACC,UAAqC,EAAEC,WAAmB;EACzF,IAAI,OAAOD,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIA,UAAU,KAAK,IAAI,EAAE;IACzD,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,UAAU,EAAE;IACpC,OAAOG,YAAY,IAAG;MACpB,MAAMC,MAAM,GAAGJ,UAAU,CAACG,YAAY,CAAC;MACvC,OAAOD,cAAc,CAACE,MAAM,EAAEH,WAAW,CAAC;IAC5C,CAAC;;EAGH,OAAO;IAAEI,QAAQ,EAAEJ;EAAW,CAAE;AAClC;AAEA,MAAMC,cAAc,GAAGA,CAACE,MAA6B,EAAEH,WAAmB,KAAkB;;EAC1F,IAAI,OAAOG,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAO;MAAEC,QAAQ,EAAED,MAAM,GAAGH;IAAW,CAAE;;EAG3C,OAAO;IAAE,GAAGG,MAAM;IAAEC,QAAQ,EAAE,CAAC,CAAAC,EAAA,GAAAF,MAAM,CAACC,QAAQ,cAAAC,EAAA,cAAAA,EAAA,GAAI,CAAC,IAAIL;EAAW,CAAE;AACtE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"sources":["../src/packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"mappings":"AAEA;;;;;;AAMA,OAAM,SAAUA,wBAAwBA,CAACC,SAAoB;EAC3D,MAAMC,MAAM,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC;EACnC,OAAO;IACLC,IAAI,EAAEF,MAAM,CAAC,CAAC,CAAS;IACvBG,SAAS,EAAEH,MAAM,CAAC,CAAC;GACpB;AACH"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined"],"sources":["../src/packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"mappings":"AAEA;AACA,MAAMA,eAAe,GAAoF;EACvGC,KAAK,EAAE;IAAEC,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDC,KAAK,EAAE;IAAEF,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDE,MAAM,EAAE;IAAEH,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC/C,YAAY,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAK,CAAE;EAClD,eAAe,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EACxDG,KAAK,EAAE;IAAEJ,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChD,cAAc,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ;CACrD;AAED,OAAM,SAAUI,2BAA2BA,CACzCC,SAAkD;EAElD,IAAIA,SAAS,KAAKC,SAAS,IAAID,SAAS,KAAK,IAAI,EAAE;IACjD,OAAO,EAAE;;EAGX,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IACjC,OAAOR,eAAe,CAACQ,SAAS,CAAC;;EAGnC,OAAOA,SAAuC;AAChD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"sources":["../src/packages/react-components/react-positioning/src/utils/toFloatingUIPadding.ts"],"sourcesContent":["import type { SideObject } from '@floating-ui/dom';\nimport { PositioningOptions } from '../types';\n\nexport function toFloatingUIPadding(\n padding: NonNullable<PositioningOptions['overflowBoundaryPadding']>,\n isRtl: boolean,\n): number | Partial<SideObject> {\n if (typeof padding === 'number') {\n return padding;\n }\n\n const { start, end, ...verticalPadding } = padding;\n\n const paddingObject: Partial<SideObject> = verticalPadding;\n\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n\n return paddingObject;\n}\n"],"mappings":"AAGA,OAAM,SAAUA,mBAAmBA,CACjCC,OAAmE,EACnEC,KAAc;EAEd,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;;EAGhB,MAAM;IAAEE,KAAK;IAAEC,GAAG;IAAE,GAAGC;EAAe,CAAE,GAAGJ,OAAO;EAElD,MAAMK,aAAa,GAAwBD,eAAe;EAE1D,MAAME,IAAI,GAAGL,KAAK,GAAG,KAAK,GAAG,OAAO;EACpC,MAAMM,KAAK,GAAGN,KAAK,GAAG,OAAO,GAAG,KAAK;EAErC;EACA;EACA,IAAID,OAAO,CAACM,IAAI,CAAC,EAAE;IACjBD,aAAa,CAACC,IAAI,GAAGN,OAAO,CAACM,IAAI,CAAC;;EAGpC,IAAIN,OAAO,CAACO,KAAK,CAAC,EAAE;IAClBF,aAAa,CAACE,KAAK,GAAGP,OAAO,CAACO,KAAK,CAAC;;EAGtC,OAAOF,aAAa;AACtB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment"],"sources":["../src/packages/react-components/react-positioning/src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"mappings":"AAMA,MAAMA,cAAc,GAAIC,GAAa,KAA2C;EAC9EC,KAAK,EAAE,KAAK;EACZC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAEH,GAAG,GAAG,OAAO,GAAG,MAAM;EAC9BI,KAAK,EAAEJ,GAAG,GAAG,MAAM,GAAG;CACvB,CAAC;AAEF;AACA;AACA,MAAMK,eAAe,GAAGA,CAAA,MAAsD;EAC5EC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAEC;CACT,CAAC;AAEF,MAAMC,mBAAmB,GAAGA,CAACC,CAAY,EAAEC,CAAa,KAAa;EACnE,MAAMC,oBAAoB,GAAGF,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,OAAO;EAC3D,MAAMG,iBAAiB,GAAGF,CAAC,KAAK,KAAK,IAAIA,CAAC,KAAK,QAAQ;EAEvD,OAAQC,oBAAoB,IAAIC,iBAAiB,IAAM,CAACD,oBAAoB,IAAI,CAACC,iBAAkB;AACrG,CAAC;AAED;;;;AAIA,OAAO,MAAMC,qBAAqB,GAAGA,CAACC,KAAiB,EAAEC,QAAmB,EAAEnB,GAAa,KAA2B;EACpH,MAAMoB,SAAS,GAAGR,mBAAmB,CAACO,QAAQ,EAAED,KAAK,CAAC,GAAG,QAAQ,GAAGA,KAAK;EAEzE,MAAMG,gBAAgB,GAAGF,QAAQ,IAAIpB,cAAc,CAACC,GAAG,CAAC,CAACmB,QAAQ,CAAC;EAClE,MAAMG,iBAAiB,GAAGF,SAAS,IAAIf,eAAe,EAAE,CAACe,SAAS,CAAC;EAEnE,IAAIC,gBAAgB,IAAIC,iBAAiB,EAAE;IACzC,OAAO,GAAGD,gBAAgB,IAAIC,iBAAiB,EAAe;;EAGhE,OAAOD,gBAAgB;AACzB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getScrollParent","toggleScrollListener","next","prev","handler","HTMLElement","prevScrollParent","removeEventListener","scrollParent","addEventListener"],"sources":["../src/packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"sourcesContent":["import type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (prev instanceof HTMLElement) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (next instanceof HTMLElement) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,mBAAmB;AAEnD;;;;;;AAMA,OAAM,SAAUC,oBAAoBA,CAClCC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;EAEtB,IAAIF,IAAI,KAAKC,IAAI,EAAE;IACjB;;EAGF,IAAIA,IAAI,YAAYE,WAAW,EAAE;IAC/B,MAAMC,gBAAgB,GAAGN,eAAe,CAACG,IAAI,CAAC;IAC9CG,gBAAgB,CAACC,mBAAmB,CAAC,QAAQ,EAAEH,OAAO,CAAC;;EAEzD,IAAIF,IAAI,YAAYG,WAAW,EAAE;IAC/B,MAAMG,YAAY,GAAGR,eAAe,CAACE,IAAI,CAAC;IAC1CM,YAAY,CAACC,gBAAgB,CAAC,QAAQ,EAAEL,OAAO,CAAC;;AAEpD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React","useIsomorphicLayoutEffect","useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","useRef","ref","useState","value","facade","current","last"],"sources":["../src/packages/react-components/react-positioning/src/utils/useCallbackRef.ts"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,yBAAyB,QAAQ,2BAA2B;AAErE;;;;;;;;;;;;;;;;;AAiBA,OAAM,SAAUC,cAAcA,CAC5BC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;EAE5B,MAAMC,OAAO,GAAGN,KAAK,CAACO,MAAM,CAAC,IAAI,CAAC;EAClC,MAAM,CAACC,GAAG,CAAC,GAAGR,KAAK,CAACS,QAAQ,CAAC,OAAO;IAClC;IACAC,KAAK,EAAEP,YAAY;IACnB;IACAC,QAAQ;IACR;IACAO,MAAM,EAAE;MACN,IAAIC,OAAOA,CAAA;QACT,OAAOJ,GAAG,CAACE,KAAK;MAClB,CAAC;MACD,IAAIE,OAAOA,CAACF,KAAK;QACf,MAAMG,IAAI,GAAGL,GAAG,CAACE,KAAK;QAEtB,IAAIG,IAAI,KAAKH,KAAK,EAAE;UAClBF,GAAG,CAACE,KAAK,GAAGA,KAAK;UAEjB,IAAIL,kBAAkB,IAAIC,OAAO,CAACM,OAAO,EAAE;YACzC;;UAGFJ,GAAG,CAACJ,QAAQ,CAACM,KAAK,EAAEG,IAAI,CAAC;;MAE7B;;GAEH,CAAC,CAAC;EAEHZ,yBAAyB,CAAC,MAAK;IAC7BK,OAAO,CAACM,OAAO,GAAG,KAAK;EACzB,CAAC,EAAE,EAAE,CAAC;EAEN;EACAJ,GAAG,CAACJ,QAAQ,GAAGA,QAAQ;EAEvB,OAAOI,GAAG,CAACG,MAAM;AACnB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"sources":["../src/packages/react-components/react-positioning/src/utils/writeArrowUpdates.ts"],"sourcesContent":["import { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }) {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`,\n });\n}\n"],"mappings":"AAEA;;;AAGA,OAAM,SAAUA,iBAAiBA,CAACC,OAAsE;EACtG,MAAM;IAAEC,KAAK;IAAEC;EAAc,CAAE,GAAGF,OAAO;EACzC,IAAI,CAACE,cAAc,CAACD,KAAK,IAAI,CAACA,KAAK,EAAE;IACnC;;EAGF,MAAM;IAAEE,CAAC,EAAEC,MAAM;IAAEC,CAAC,EAAEC;EAAM,CAAE,GAAGJ,cAAc,CAACD,KAAK;EAErDM,MAAM,CAACC,MAAM,CAACP,KAAK,CAACQ,KAAK,EAAE;IACzBC,IAAI,EAAE,GAAGN,MAAM,IAAI;IACnBO,GAAG,EAAE,GAAGL,MAAM;GACf,CAAC;AACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_PLACEMENT","writeContainerUpdates","options","container","placement","middlewareData","strategy","lowPPI","coordinates","setAttribute","removeAttribute","intersectionObserver","intersecting","_a","hide","escaped","_b","referenceHidden","devicePixelRatio","_c","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","transform","position"],"sources":["../src/packages/react-components/react-positioning/src/utils/writeContainerupdates.ts"],"sourcesContent":["import type { Placement, MiddlewareData, Strategy, Coords } from '@floating-ui/dom';\nimport {\n DATA_POSITIONING_ESCAPED,\n DATA_POSITIONING_HIDDEN,\n DATA_POSITIONING_INTERSECTING,\n DATA_POSITIONING_PLACEMENT,\n} from '../constants';\n\n/**\n * Writes all container element position updates after the position is computed\n */\nexport function writeContainerUpdates(options: {\n container: HTMLElement | null;\n placement: Placement;\n middlewareData: MiddlewareData;\n /**\n * Layer acceleration can disable subpixel rendering which causes slightly\n * blurry text on low PPI displays, so we want to use 2D transforms\n * instead\n */\n lowPPI: boolean;\n strategy: Strategy;\n coordinates: Coords;\n}) {\n const { container, placement, middlewareData, strategy, lowPPI, coordinates } = options;\n if (!container) {\n return;\n }\n container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);\n container.removeAttribute(DATA_POSITIONING_INTERSECTING);\n if (middlewareData.intersectionObserver.intersecting) {\n container.setAttribute(DATA_POSITIONING_INTERSECTING, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if (middlewareData.hide?.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if (middlewareData.hide?.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\n }\n\n // Round so that the coordinates land on device pixels.\n // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like\n // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.\n // See https://github.com/microsoft/fluentui/issues/26764 for more info.\n const devicePixelRatio = container.ownerDocument.defaultView?.devicePixelRatio || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n\n Object.assign(container.style, {\n transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,\n position: strategy,\n });\n}\n"],"mappings":"AACA,SACEA,wBAAwB,EACxBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,0BAA0B,QACrB,cAAc;AAErB;;;AAGA,OAAM,SAAUC,qBAAqBA,CAACC,OAYrC;;EACC,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC,cAAc;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAW,CAAE,GAAGN,OAAO;EACvF,IAAI,CAACC,SAAS,EAAE;IACd;;EAEFA,SAAS,CAACM,YAAY,CAACT,0BAA0B,EAAEI,SAAS,CAAC;EAC7DD,SAAS,CAACO,eAAe,CAACX,6BAA6B,CAAC;EACxD,IAAIM,cAAc,CAACM,oBAAoB,CAACC,YAAY,EAAE;IACpDT,SAAS,CAACM,YAAY,CAACV,6BAA6B,EAAE,EAAE,CAAC;;EAG3DI,SAAS,CAACO,eAAe,CAACb,wBAAwB,CAAC;EACnD,IAAI,CAAAgB,EAAA,GAAAR,cAAc,CAACS,IAAI,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,OAAO,EAAE;IAChCZ,SAAS,CAACM,YAAY,CAACZ,wBAAwB,EAAE,EAAE,CAAC;;EAGtDM,SAAS,CAACO,eAAe,CAACZ,uBAAuB,CAAC;EAClD,IAAI,CAAAkB,EAAA,GAAAX,cAAc,CAACS,IAAI,cAAAE,EAAA,uBAAAA,EAAA,CAAEC,eAAe,EAAE;IACxCd,SAAS,CAACM,YAAY,CAACX,uBAAuB,EAAE,EAAE,CAAC;;EAGrD;EACA;EACA;EACA;EACA,MAAMoB,gBAAgB,GAAG,EAAAC,EAAA,GAAAhB,SAAS,CAACiB,aAAa,CAACC,WAAW,cAAAF,EAAA,uBAAAA,EAAA,CAAED,gBAAgB,KAAI,CAAC;EACnF,MAAMI,CAAC,GAAGC,IAAI,CAACC,KAAK,CAAChB,WAAW,CAACc,CAAC,GAAGJ,gBAAgB,CAAC,GAAGA,gBAAgB;EACzE,MAAMO,CAAC,GAAGF,IAAI,CAACC,KAAK,CAAChB,WAAW,CAACiB,CAAC,GAAGP,gBAAgB,CAAC,GAAGA,gBAAgB;EAEzEQ,MAAM,CAACC,MAAM,CAACxB,SAAS,CAACyB,KAAK,EAAE;IAC7BC,SAAS,EAAEtB,MAAM,GAAG,aAAae,CAAC,OAAOG,CAAC,KAAK,GAAG,eAAeH,CAAC,OAAOG,CAAC,QAAQ;IAClFK,QAAQ,EAAExB;GACX,CAAC;AACJ"}
|
@@ -3,8 +3,16 @@ define(["require", "exports", "tslib", "@floating-ui/dom", "../utils/index"], fu
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.flip = void 0;
|
5
5
|
function flip(options) {
|
6
|
-
var hasScrollableElement = options.hasScrollableElement, flipBoundary = options.flipBoundary, container = options.container;
|
7
|
-
|
6
|
+
var hasScrollableElement = options.hasScrollableElement, flipBoundary = options.flipBoundary, container = options.container, _a = options.fallbackPositions, fallbackPositions = _a === void 0 ? [] : _a, isRtl = options.isRtl;
|
7
|
+
var fallbackPlacements = fallbackPositions.reduce(function (acc, shorthand) {
|
8
|
+
var _a = index_1.resolvePositioningShorthand(shorthand), position = _a.position, align = _a.align;
|
9
|
+
var placement = index_1.toFloatingUIPlacement(align, position, isRtl);
|
10
|
+
if (placement) {
|
11
|
+
acc.push(placement);
|
12
|
+
}
|
13
|
+
return acc;
|
14
|
+
}, []);
|
15
|
+
return dom_1.flip(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (hasScrollableElement && { boundary: 'clippingAncestors' })), (flipBoundary && { altBoundary: true, boundary: index_1.getBoundary(container, flipBoundary) })), { fallbackStrategy: 'bestFit' }), (fallbackPlacements.length && { fallbackPlacements: fallbackPlacements })));
|
8
16
|
}
|
9
17
|
exports.flip = flip;
|
10
18
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flip.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/flip.ts"],"names":[],"mappings":";;;;
|
1
|
+
{"version":3,"file":"flip.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/flip.ts"],"names":[],"mappings":";;;;IAUA,SAAgB,IAAI,CAAC,OAA8B;QACzC,IAAA,oBAAoB,GAA6D,OAAO,qBAApE,EAAE,YAAY,GAA+C,OAAO,aAAtD,EAAE,SAAS,GAAoC,OAAO,UAA3C,EAAE,KAAkC,OAAO,kBAAnB,EAAtB,iBAAiB,mBAAG,EAAE,KAAA,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAa;QAEjG,IAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,CAAc,UAAC,GAAG,EAAE,SAAS;YACxE,IAAA,KAAsB,mCAA2B,CAAC,SAAS,CAAC,EAA1D,QAAQ,cAAA,EAAE,KAAK,WAA2C,CAAC;YACnE,IAAM,SAAS,GAAG,6BAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAChE,IAAI,SAAS,EAAE;gBACb,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACrB;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,UAAQ,yEACV,CAAC,oBAAoB,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC,GAC3D,CAAC,YAAY,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAW,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,CAAC,KAC1F,gBAAgB,EAAE,SAAS,KACxB,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,kBAAkB,oBAAA,EAAE,CAAC,EACxD,CAAC;IACL,CAAC;IAlBD,oBAkBC","sourcesContent":["import { flip as baseFlip, Placement } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary, resolvePositioningShorthand, toFloatingUIPlacement } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary' | 'fallbackPositions'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n isRtl?: boolean;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container, fallbackPositions = [], isRtl } = options;\n\n const fallbackPlacements = fallbackPositions.reduce<Placement[]>((acc, shorthand) => {\n const { position, align } = resolvePositioningShorthand(shorthand);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n if (placement) {\n acc.push(placement);\n }\n return acc;\n }, []);\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n ...(fallbackPlacements.length && { fallbackPlacements }),\n });\n}\n"]}
|
@@ -16,12 +16,14 @@ define(["require", "exports", "tslib", "@floating-ui/dom", "../utils/getBoundary
|
|
16
16
|
Object.assign(elements.floating.style, {
|
17
17
|
maxHeight: availableHeight + "px",
|
18
18
|
boxSizing: 'border-box',
|
19
|
+
overflowY: 'auto',
|
19
20
|
});
|
20
21
|
}
|
21
22
|
if (applyMaxWidth) {
|
22
23
|
Object.assign(elements.floating.style, {
|
23
24
|
maxWidth: availableWidth + "px",
|
24
25
|
boxSizing: 'border-box',
|
26
|
+
overflowX: 'auto',
|
25
27
|
});
|
26
28
|
}
|
27
29
|
} }));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"maxSize.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/maxSize.ts"],"names":[],"mappings":";;;;IAQA,SAAgB,OAAO,CAAC,QAAwC,EAAE,OAAiC;QACzF,IAAA,SAAS,GAAuB,OAAO,UAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;QAChD,OAAO,UAAI,uCACN,CAAC,gBAAgB,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC,EAAE,CAAC,KAClG,KAAK,
|
1
|
+
{"version":3,"file":"maxSize.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/maxSize.ts"],"names":[],"mappings":";;;;IAQA,SAAgB,OAAO,CAAC,QAAwC,EAAE,OAAiC;QACzF,IAAA,SAAS,GAAuB,OAAO,UAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;QAChD,OAAO,UAAI,uCACN,CAAC,gBAAgB,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC,EAAE,CAAC,KAClG,KAAK,EAAL,UAAM,EAAoD;oBAAlD,eAAe,qBAAA,EAAE,cAAc,oBAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA;gBACtD,IAAM,aAAa,GACjB,QAAQ,KAAK,QAAQ;oBACrB,QAAQ,KAAK,cAAc;oBAC3B,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,cAAc,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC;gBAEzF,IAAM,cAAc,GAClB,QAAQ,KAAK,QAAQ;oBACrB,QAAQ,KAAK,eAAe;oBAC5B,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,eAAe,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC;gBAE5F,IAAI,cAAc,EAAE;oBAClB,MAAM,CAAC,MAAM,CAAoD,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE;wBACxF,SAAS,EAAK,eAAe,OAAI;wBACjC,SAAS,EAAE,YAAY;wBACvB,SAAS,EAAE,MAAM;qBAClB,CAAC,CAAC;iBACJ;gBAED,IAAI,aAAa,EAAE;oBACjB,MAAM,CAAC,MAAM,CAAoD,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE;wBACxF,QAAQ,EAAK,cAAc,OAAI;wBAC/B,SAAS,EAAE,YAAY;wBACvB,SAAS,EAAE,MAAM;qBAClB,CAAC,CAAC;iBACJ;YACH,CAAC,IACD,CAAC;IACL,CAAC;IAhCD,0BAgCC","sourcesContent":["import { size } from '@floating-ui/dom';\nimport type { Middleware } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/getBoundary';\nexport interface MaxSizeMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n container: HTMLElement | null;\n}\n\nexport function maxSize(autoSize: PositioningOptions['autoSize'], options: MaxSizeMiddlewareOptions): Middleware {\n const { container, overflowBoundary } = options;\n return size({\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n apply({ availableHeight, availableWidth, elements, rects }) {\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (rects.floating.width > availableWidth && (autoSize === true || autoSize === 'width'));\n\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (rects.floating.height > availableHeight && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxHeight) {\n Object.assign<CSSStyleDeclaration, Partial<CSSStyleDeclaration>>(elements.floating.style, {\n maxHeight: `${availableHeight}px`,\n boxSizing: 'border-box',\n overflowY: 'auto',\n });\n }\n\n if (applyMaxWidth) {\n Object.assign<CSSStyleDeclaration, Partial<CSSStyleDeclaration>>(elements.floating.style, {\n maxWidth: `${availableWidth}px`,\n boxSizing: 'border-box',\n overflowX: 'auto',\n });\n }\n },\n });\n}\n"]}
|
package/lib-amd/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/types.ts"],"names":[],"mappings":"","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 UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\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;\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\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 */\n positionFixed?: boolean;\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 max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-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
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/types.ts"],"names":[],"mappings":"","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 UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\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;\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\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 */\n positionFixed?: boolean;\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 max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-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\nexport interface PositioningProps\n extends Pick<\n PositioningOptions,\n | 'align'\n | 'flipBoundary'\n | 'overflowBoundary'\n | 'overflowBoundaryPadding'\n | 'position'\n | 'offset'\n | 'arrowPadding'\n | 'autoSize'\n | 'coverTarget'\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"]}
|
@@ -110,7 +110,7 @@ define(["require", "exports", "tslib", "@floating-ui/dom", "@fluentui/react-shar
|
|
110
110
|
}
|
111
111
|
exports.usePositioning = usePositioning;
|
112
112
|
function usePositioningOptions(options) {
|
113
|
-
var align = options.align, arrowPadding = options.arrowPadding, autoSize = options.autoSize, coverTarget = options.coverTarget, flipBoundary = options.flipBoundary, offset = options.offset, overflowBoundary = options.overflowBoundary, pinned = options.pinned, position = options.position, disableTether = options.unstable_disableTether, positionFixed = options.positionFixed, overflowBoundaryPadding = options.overflowBoundaryPadding;
|
113
|
+
var align = options.align, arrowPadding = options.arrowPadding, autoSize = options.autoSize, coverTarget = options.coverTarget, flipBoundary = options.flipBoundary, offset = options.offset, overflowBoundary = options.overflowBoundary, pinned = options.pinned, position = options.position, disableTether = options.unstable_disableTether, positionFixed = options.positionFixed, overflowBoundaryPadding = options.overflowBoundaryPadding, fallbackPositions = options.fallbackPositions;
|
114
114
|
var dir = react_shared_contexts_1.useFluent_unstable().dir;
|
115
115
|
var isRtl = dir === 'rtl';
|
116
116
|
var strategy = positionFixed ? 'fixed' : 'absolute';
|
@@ -119,7 +119,7 @@ define(["require", "exports", "tslib", "@floating-ui/dom", "@fluentui/react-shar
|
|
119
119
|
var middleware = [
|
120
120
|
offset && middleware_1.offset(offset),
|
121
121
|
coverTarget && middleware_1.coverTarget(),
|
122
|
-
!pinned && middleware_1.flip({ container: container, flipBoundary: flipBoundary, hasScrollableElement: hasScrollableElement }),
|
122
|
+
!pinned && middleware_1.flip({ container: container, flipBoundary: flipBoundary, hasScrollableElement: hasScrollableElement, isRtl: isRtl, fallbackPositions: fallbackPositions }),
|
123
123
|
middleware_1.shift({
|
124
124
|
container: container,
|
125
125
|
hasScrollableElement: hasScrollableElement,
|
@@ -154,6 +154,7 @@ define(["require", "exports", "tslib", "@floating-ui/dom", "@fluentui/react-shar
|
|
154
154
|
position,
|
155
155
|
strategy,
|
156
156
|
overflowBoundaryPadding,
|
157
|
+
fallbackPositions,
|
157
158
|
]);
|
158
159
|
}
|
159
160
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePositioning.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-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SAAS,WAAA;oBACT,oBAAoB,sBAAA;oBACpB,gBAAgB,kBAAA;oBAChB,aAAa,eAAA;oBACb,uBAAuB,yBAAA;oBACvB,KAAK,OAAA;iBACN,CAAC;gBACF,QAAQ,IAAI,oBAAiB,CAAC,QAAQ,EAAE,EAAE,SAAS,WAAA,EAAE,gBAAgB,kBAAA,EAAE,CAAC;gBACxE,yBAAsB,EAAE;gBACxB,KAAK,IAAI,WAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;gBACnE,UAAc,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAC/C,UAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;aACxC,CAAC,MAAM,CAAC,OAAO,CAAiB,CAAC;YAElC,IAAM,SAAS,GAAG,6BAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAEhE,OAAO;gBACL,SAAS,WAAA;gBACT,UAAU,YAAA;gBACV,QAAQ,UAAA;aACT,CAAC;QACJ,CAAC,EACD;YACE,KAAK;YACL,YAAY;YACZ,QAAQ;YACR,WAAW;YACX,aAAa;YACb,YAAY;YACZ,KAAK;YACL,MAAM;YACN,gBAAgB;YAChB,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,uBAAuB;SACxB,CACF,CAAC;IACJ,CAAC","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 } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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\ninterface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement }),\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,\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 strategy,\n overflowBoundaryPadding,\n ],\n );\n}\n"]}
|
1
|
+
{"version":3,"file":"usePositioning.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/usePositioning.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACH,SAAgB,cAAc,CAAC,OAA8B;QAC3D,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAyB,IAAI,CAAC,CAAC;QAC9D,IAAM,SAAS,GAAG,KAAK,CAAC,MA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BACN,CAAC;gBACF,QAAQ,IAAI,oBAAiB,CAAC,QAAQ,EAAE,EAAE,SAAS,WAAA,EAAE,gBAAgB,kBAAA,EAAE,CAAC;gBACxE,yBAAsB,EAAE;gBACxB,KAAK,IAAI,WAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;gBACnE,UAAc,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAC/C,UAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;aACxC,CAAC,MAAM,CAAC,OAAO,CAAiB,CAAC;YAElC,IAAM,SAAS,GAAG,6BAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAEhE,OAAO;gBACL,SAAS,WAAA;gBACT,UAAU,YAAA;gBACV,QAAQ,UAAA;aACT,CAAC;QACJ,CAAC,EACD;YACE,KAAK;YACL,YAAY;YACZ,QAAQ;YACR,WAAW;YACX,aAAa;YACb,YAAY;YACZ,KAAK;YACL,MAAM;YACN,gBAAgB;YAChB,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,uBAAuB;YACvB,iBAAiB;SAClB,CACF,CAAC;IACJ,CAAC","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 } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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\ninterface UsePositioningOptions extends PositioningProps, Pick<PositioningOptions, 'fallbackPositions' | 'pinned'> {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n fallbackPositions,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\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,\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 strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n ],\n );\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getScrollParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"names":[],"mappings":";;;;IAAA;;;;OAIG;IACI,IAAM,aAAa,GAAG,UAAC,IAAiB;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;YAC5B,OAAO,IAAI,CAAC;SACb;QACD,8DAA8D;QAC9D,OAAO,IAAI,CAAC,UAAU,IAAK,IAAY,CAAC,IAAI,CAAC;IAC/C,CAAC,CAAC;IANW,QAAA,aAAa,iBAMxB;IAEF;;;;OAIG;IACH,IAAM,wBAAwB,GAAG,UAAC,IAAiB;;QACjD,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAAG,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,CAAC;QAC/C,OAAO,MAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF;;;;OAIG;IACI,IAAM,eAAe,GAAG,UAAC,IAAmC;QACjE,iFAAiF;QACjF,IAAM,UAAU,GAAG,IAAI,IAAI,qBAAa,CAAC,IAAmB,CAAC,CAAC;QAC9D,2BAA2B;QAC3B,IAAI,CAAC,UAAU;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;QAEtC,QAAQ,UAAU,CAAC,QAAQ,EAAE;YAC3B,KAAK,MAAM,CAAC;YACZ,KAAK,MAAM;gBACT,OAAO,UAAU,CAAC,aAAc,CAAC,IAAI,CAAC;YACxC,KAAK,WAAW;gBACd,
|
1
|
+
{"version":3,"file":"getScrollParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"names":[],"mappings":";;;;IAAA;;;;OAIG;IACI,IAAM,aAAa,GAAG,UAAC,IAAiB;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;YAC5B,OAAO,IAAI,CAAC;SACb;QACD,8DAA8D;QAC9D,OAAO,IAAI,CAAC,UAAU,IAAK,IAAY,CAAC,IAAI,CAAC;IAC/C,CAAC,CAAC;IANW,QAAA,aAAa,iBAMxB;IAEF;;;;OAIG;IACH,IAAM,wBAAwB,GAAG,UAAC,IAAiB;;QACjD,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,OAAO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ent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["exports","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_PLACEMENT"],"sources":["../src/packages/react-components/react-positioning/src/constants.ts"],"sourcesContent":["export const DATA_POSITIONING_INTERSECTING = 'data-popper-is-intersecting';\nexport const DATA_POSITIONING_ESCAPED = 'data-popper-escaped';\nexport const DATA_POSITIONING_HIDDEN = 'data-popper-reference-hidden';\nexport const DATA_POSITIONING_PLACEMENT = 'data-popper-placement';\n"],"mappings":";;;;;;AAAaA,OAAA,CAAAC,6BAA6B,GAAG,6BAA6B;AAC7DD,OAAA,CAAAE,wBAAwB,GAAG,qBAAqB;AAChDF,OAAA,CAAAG,uBAAuB,GAAG,8BAA8B;AACxDH,OAAA,CAAAI,0BAA0B,GAAG,uBAAuB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["react_1","require","react_theme_1","createArrowStyles","options","arrowHeight","borderWidth","borderStyle","borderColor","tokens","colorTransparentStroke","position","backgroundColor","visibility","zIndex","createArrowHeightStyles","content","boxSizing","width","height","shorthands","borderRight","borderBottom","borderBottomRightRadius","borderRadiusSmall","transform","bottom","left","top","right","exports","edgeLength"],"sources":["../src/packages/react-components/react-positioning/src/createArrowStyles.ts"],"sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * @internal\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * @internal\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n '::before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * @internal\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"mappings":";;;;;;AAAA,MAAAA,OAAA,gBAAAC,OAAA;AACA,MAAAC,aAAA,gBAAAD,OAAA;AAsCA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgBE,iBAAiBA,CAACC,OAAiC;EACjE,MAAM;IACJC,WAAW;IACXC,WAAW,GAAG,KAAK;IACnBC,WAAW,GAAG,OAAO;IACrBC,WAAW,GAAGN,aAAA,CAAAO,MAAM,CAACC;EAAsB,CAC5C,GAAGN,OAAO;EAEX,OAAO;IACLO,QAAQ,EAAE,UAAU;IACpBC,eAAe,EAAE,SAAS;IAC1BC,UAAU,EAAE,QAAQ;IACpBC,MAAM,EAAE,CAAC,CAAC;IAEV,IAAIT,WAAW,IAAIU,uBAAuB,CAACV,WAAW,CAAC,CAAC;IAExD,UAAU,EAAE;MACVW,OAAO,EAAE,IAAI;MACbH,UAAU,EAAE,SAAS;MACrBF,QAAQ,EAAE,UAAU;MACpBM,SAAS,EAAE,YAAY;MACvBC,KAAK,EAAE,SAAS;MAChBC,MAAM,EAAE,SAAS;MACjBP,eAAe,EAAE,SAAS;MAC1B,GAAGZ,OAAA,CAAAoB,UAAU,CAACC,WAAW,CACvB,GAAGf,WAAW,gBAAgB,EAC9B,GAAGC,WAAW,gBAAgB,EAC9B,GAAGC,WAAW,gBAAgB,CAC/B;MACD,GAAGR,OAAA,CAAAoB,UAAU,CAACE,YAAY,CAAChB,WAAW,EAAEC,WAAW,EAAEC,WAAW,CAAC;MACjEe,uBAAuB,EAAErB,aAAA,CAAAO,MAAM,CAACe,iBAAiB;MACjDC,SAAS,EAAE;KACZ;IAED;IACA,yCAAyC,EAAE;MACzCC,MAAM,EAAE,IAAIpB,WAAW,EAAE;MACzB,SAAS,EAAE;KACZ;IACD,2CAA2C,EAAE;MAC3CqB,IAAI,EAAE,IAAIrB,WAAW,gBAAgB;MACrC,SAAS,EAAE;KACZ;IACD,4CAA4C,EAAE;MAC5CsB,GAAG,EAAE,IAAItB,WAAW,EAAE;MACtB,SAAS,EAAE;KACZ;IACD,0CAA0C,EAAE;MAC1CuB,KAAK,EAAE,IAAIvB,WAAW,gBAAgB;MACtC,SAAS,EAAE;;GAEd;AACH;AApDAwB,OAAA,CAAA3B,iBAAA,GAAAA,iBAAA;AAsDA;;;;;;;AAOA,SAAgBY,uBAAuBA,CAACV,WAAmB;EACzD;EACA;EACA,MAAM0B,UAAU,GAAG,GAAG,KAAK,GAAG1B,WAAW,IAAI;EAC7C,OAAO;IAAEa,KAAK,EAAEa,UAAU;IAAEZ,MAAM,EAAEY;EAAU,CAAE;AAClD;AALAD,OAAA,CAAAf,uBAAA,GAAAA,uBAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["dom_1","require","utils_1","createPositionManager","options","container","target","arrow","strategy","middleware","placement","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","add","getScrollParent","HTMLElement","forEach","scrollParent","addEventListener","computePosition","then","x","y","middlewareData","computedPlacement","writeArrowUpdates","writeContainerUpdates","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","debounce","removeEventListener","exports"],"sources":["../src/packages/react-components/react-positioning/src/createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (target instanceof HTMLElement) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition);\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n isDestroyed = true;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition);\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAGA,MAAAC,OAAA,gBAAAD,OAAA;AA8BA;;;;AAIA,SAAgBE,qBAAqBA,CAACC,OAA+B;EACnE,MAAM;IAAEC,SAAS;IAAEC,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;EAAS,CAAE,GAAGN,OAAO;EAC7E,IAAIO,WAAW,GAAG,KAAK;EACvB,IAAI,CAACL,MAAM,IAAI,CAACD,SAAS,EAAE;IACzB,OAAO;MACLO,cAAc,EAAEA,CAAA,KAAMC,SAAS;MAC/BC,OAAO,EAAEA,CAAA,KAAMD;KAChB;;EAGH,IAAIE,aAAa,GAAG,IAAI;EACxB,MAAMC,aAAa,GAAqB,IAAIC,GAAG,EAAe;EAC9D,MAAMC,YAAY,GAAGb,SAAS,CAACc,aAAa,CAACC,WAAW;EAExD;EACA;EACAC,MAAM,CAACC,MAAM,CAACjB,SAAS,CAACkB,KAAK,EAAE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AE2B,gBAAgB,KAAI,CAAC,KAAK,CAAC;QAClDrC;OACD,CAAC;IACJ,CAAC,CAAC,CACDsC,KAAK,CAACC,GAAG,IAAG;MACX;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;QAC1C;QACAC,OAAO,CAACC,KAAK,CAAC,gDAAgD,EAAEL,GAAG,CAAC;;IAExE,CAAC,CAAC;EACN,CAAC;EAED,MAAMnC,cAAc,GAAGV,OAAA,CAAAmD,QAAQ,CAAC,MAAMzB,WAAW,EAAE,CAAC;EAEpD,MAAMd,OAAO,GAAGA,CAAA,KAAK;IACnBH,WAAW,GAAG,IAAI;IAElB,IAAIO,YAAY,EAAE;MAChBA,YAAY,CAACoC,mBAAmB,CAAC,QAAQ,EAAE1C,cAAc,CAAC;MAC1DM,YAAY,CAACoC,mBAAmB,CAAC,QAAQ,EAAE1C,cAAc,CAAC;;IAG5DI,aAAa,CAACgB,OAAO,CAACC,YAAY,IAAG;MACnCA,YAAY,CAACqB,mBAAmB,CAAC,QAAQ,EAAE1C,cAAc,CAAC;IAC5D,CAAC,CAAC;EACJ,CAAC;EAED,IAAIM,YAAY,EAAE;IAChBA,YAAY,CAACgB,gBAAgB,CAAC,QAAQ,EAAEtB,cAAc,CAAC;IACvDM,YAAY,CAACgB,gBAAgB,CAAC,QAAQ,EAAEtB,cAAc,CAAC;;EAGzD;EACAA,cAAc,EAAE;EAEhB,OAAO;IACLA,cAAc;IACdE;GACD;AACH;AAnGAyC,OAAA,CAAApD,qBAAA,GAAAA,qBAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["createVirtualElementFromClick","nativeEvent","left","clientX","top","clientY","right","bottom","getBoundingClientRect","x","y","height","width","exports"],"sources":["../src/packages/react-components/react-positioning/src/createVirtualElementFromClick.ts"],"sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"mappings":";;;;;;AAEA;;;;AAIA,SAAgBA,6BAA6BA,CAACC,WAAuB;EACnE,MAAMC,IAAI,GAAGD,WAAW,CAACE,OAAO;EAChC,MAAMC,GAAG,GAAGH,WAAW,CAACI,OAAO;EAC/B,MAAMC,KAAK,GAAGJ,IAAI,GAAG,CAAC;EACtB,MAAMK,MAAM,GAAGH,GAAG,GAAG,CAAC;EAEtB,SAASI,qBAAqBA,CAAA;IAC5B,OAAO;MACLN,IAAI;MACJE,GAAG;MACHE,KAAK;MACLC,MAAM;MACNE,CAAC,EAAEP,IAAI;MACPQ,CAAC,EAAEN,GAAG;MACNO,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE;KACR;EACH;EAEA,OAAO;IACLJ;GACD;AACH;AAtBAK,OAAA,CAAAb,6BAAA,GAAAA,6BAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["createVirtualElementFromClick_1","require","Object","defineProperty","exports","enumerable","get","createVirtualElementFromClick","createArrowStyles_1","createArrowHeightStyles","createArrowStyles","usePositioning_1","usePositioning","usePositioningMouseTarget_1","usePositioningMouseTarget","index_1","resolvePositioningShorthand","mergeArrowOffset"],"sources":["../src/packages/react-components/react-positioning/src/index.ts"],"sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport type { CreateArrowStylesOptions } from './createArrowStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport type {\n Alignment,\n AutoSize,\n Boundary,\n Offset,\n OffsetFunction,\n OffsetFunctionParam,\n OffsetObject,\n OffsetShorthand,\n Position,\n PositioningImperativeRef,\n PositioningProps,\n PositioningShorthand,\n PositioningShorthandValue,\n PositioningVirtualElement,\n SetVirtualMouseTarget,\n} from './types';\n"],"mappings":";;;;;;AAAA,IAAAA,+BAAA,gBAAAC,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,+BAAA,CAAAO,6BAA6B;EAAA;AAAA;AACtC,IAAAC,mBAAA,gBAAAP,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAE,mBAAA,CAAAC,uBAAuB;EAAA;AAAA;AAAEP,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAE,mBAAA,CAAAE,iBAAiB;EAAA;AAAA;AAEnD,IAAAC,gBAAA,gBAAAV,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAK,gBAAA,CAAAC,cAAc;EAAA;AAAA;AACvB,IAAAC,2BAAA,gBAAAZ,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAO,2BAAA,CAAAC,yBAAyB;EAAA;AAAA;AAClC,IAAAC,OAAA,gBAAAd,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAS,OAAA,CAAAC,2BAA2B;EAAA;AAAA;AAAEd,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAS,OAAA,CAAAE,gBAAgB;EAAA;AAAA"}
|