@radix-ui/react-popper 0.1.5-rc.26 → 0.1.5-rc.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
+ import * as ArrowPrimitive from "@radix-ui/react-arrow";
2
3
  import * as Radix from "@radix-ui/react-primitive";
3
4
  import { Primitive } from "@radix-ui/react-primitive";
4
- import * as ArrowPrimitive from "@radix-ui/react-arrow";
5
5
  import { Side, Align } from "@radix-ui/popper";
6
6
  import { Measurable } from "@radix-ui/rect";
7
7
  export const createPopperScope: import("@radix-ui/react-context").CreateScope;
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAqBA,OAAA,wFAAgF,CAAC;AAQjF;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;CAC5B;AACD,OAAA,MAAM,QAAQ,MAAM,EAAE,CAAC,WAAW,CAQjC,CAAC;AAWF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,kCAA4B,SAAQ,iBAAiB;IACnD,UAAU,CAAC,EAAE,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED,OAAA,MAAM,sGAgBL,CAAC;AAoBF,mCAA6B,SAAQ,iBAAiB;IACpD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,OAAA,MAAM,wGAqEL,CAAC;AAWF,kBAAkB,MAAM,wBAAwB,CAAC,OAAO,eAAe,IAAI,CAAC,CAAC;AAC7E,iCAA2B,SAAQ,UAAU;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,OAAA,MAAM,mGAoCJ,CAAC;AAiCH,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,gGAAqB,CAAC;AAC5B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,6FAAmB,CAAC","sources":["packages/react/popper/src/packages/react/popper/src/Popper.tsx","packages/react/popper/src/packages/react/popper/src/index.ts","packages/react/popper/src/index.ts"],"sourcesContent":[null,null,"export * from './Popper';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;;;;;AAsBA,OAAA,wFAAgF,CAAC;AAQjF;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;CAC5B;AACD,OAAA,MAAM,QAAQ,MAAM,EAAE,CAAC,WAAW,CAQjC,CAAC;AAWF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,kCAA4B,SAAQ,iBAAiB;IACnD,UAAU,CAAC,EAAE,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED,OAAA,MAAM,sGAgBL,CAAC;AAoBF,mCAA6B,SAAQ,iBAAiB;IACpD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,OAAA,MAAM,wGA0EL,CAAC;AAWF,kBAAkB,MAAM,wBAAwB,CAAC,OAAO,eAAe,IAAI,CAAC,CAAC;AAC7E,iCAA2B,SAAQ,UAAU;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,OAAA,MAAM,mGAoCJ,CAAC;AAiCH,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,gGAAqB,CAAC;AAC5B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,6FAAmB,CAAC","sources":["packages/react/popper/src/packages/react/popper/src/Popper.tsx","packages/react/popper/src/packages/react/popper/src/index.ts","packages/react/popper/src/index.ts"],"sourcesContent":[null,null,"export * from './Popper';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  var $50Iv9$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
2
2
  var $50Iv9$react = require("react");
3
- var $50Iv9$radixuipopper = require("@radix-ui/popper");
3
+ var $50Iv9$radixuireactarrow = require("@radix-ui/react-arrow");
4
4
  var $50Iv9$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
5
5
  var $50Iv9$radixuireactcontext = require("@radix-ui/react-context");
6
+ var $50Iv9$radixuipopper = require("@radix-ui/popper");
7
+ var $50Iv9$radixuireactprimitive = require("@radix-ui/react-primitive");
8
+ var $50Iv9$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
6
9
  var $50Iv9$radixuireactuserect = require("@radix-ui/react-use-rect");
7
10
  var $50Iv9$radixuireactusesize = require("@radix-ui/react-use-size");
8
- var $50Iv9$radixuireactprimitive = require("@radix-ui/react-primitive");
9
- var $50Iv9$radixuireactarrow = require("@radix-ui/react-arrow");
10
11
 
11
12
  function $parcel$exportWildcard(dest, source) {
12
13
  Object.keys(source).forEach(function(key) {
@@ -50,6 +51,7 @@ $parcel$export($34310caa050a8d63$exports, "Arrow", () => $34310caa050a8d63$expor
50
51
 
51
52
 
52
53
 
54
+
53
55
  /* -------------------------------------------------------------------------------------------------
54
56
  * Popper
55
57
  * -----------------------------------------------------------------------------------------------*/ const $34310caa050a8d63$var$POPPER_NAME = 'Popper';
@@ -124,8 +126,17 @@ const $34310caa050a8d63$export$bc4ae5855d3c4fc = /*#__PURE__*/ $50Iv9$react.forw
124
126
  collisionTolerance: collisionTolerance
125
127
  });
126
128
  const isPlaced = placedSide !== undefined;
129
+ const [contentZIndex, setContentZIndex] = $50Iv9$react.useState();
130
+ $50Iv9$radixuireactuselayouteffect.useLayoutEffect(()=>{
131
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
132
+ }, [
133
+ content
134
+ ]);
127
135
  return /*#__PURE__*/ $50Iv9$react.createElement("div", {
128
- style: popperStyles,
136
+ style: {
137
+ ...popperStyles,
138
+ zIndex: contentZIndex
139
+ },
129
140
  "data-radix-popper-content-wrapper": ""
130
141
  }, /*#__PURE__*/ $50Iv9$react.createElement($34310caa050a8d63$var$PopperContentProvider, {
131
142
  scope: __scopePopper,
@@ -136,13 +147,13 @@ const $34310caa050a8d63$export$bc4ae5855d3c4fc = /*#__PURE__*/ $50Iv9$react.forw
136
147
  "data-side": placedSide,
137
148
  "data-align": placedAlign
138
149
  }, contentProps, {
150
+ ref: composedRefs,
139
151
  style: {
140
152
  ...contentProps.style,
141
153
  // if the PopperContent hasn't been placed yet (not all measurements done)
142
154
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
143
155
  animation: !isPlaced ? 'none' : undefined
144
- },
145
- ref: composedRefs
156
+ }
146
157
  }))));
147
158
  });
148
159
  /*#__PURE__*/ Object.assign($34310caa050a8d63$export$bc4ae5855d3c4fc, {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;ACcA;;oGAEA,CAEA,MAAMQ,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBC,uCAAtB,CAAA,GAA2CP,6CAAkB,CAACK,iCAAD,CAAnE,AAAA;AAMA,MAAM,CAACG,oCAAD,EAAiBC,sCAAjB,CAAA,GAAqCH,yCAAmB,CAAqBD,iCAArB,CAA9D,AAAA;AAKA,MAAMK,yCAA6B,GAAIC,CAAAA,KAAD,GAAqC;IACzE,MAAM,E,eAAEC,aAAF,CAAA,E,UAAiBC,QAAAA,CAAAA,EAAjB,GAA8BF,KAApC,AAAM;IACN,MAAM,CA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ts","packages/react/popper/src/Popper.tsx"],"sourcesContent":["export * from './Popper';\n","import * as React from 'react';\nimport { getPlacementData } from '@radix-ui/popper';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useRect } from '@radix-ui/react-use-rect';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Side, Align } from '@radix-ui/popper';\nimport type { Measurable } from '@radix-ui/rect';\n\n/* -------------------------------------------------------------------------------------------------\n * Popper\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_NAME = 'Popper';\n\ntype ScopedProps<P> = P & { __scopePopper?: Scope };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext<PopperContextValue>(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode;\n}\nconst Popper: React.FC<PopperProps> = (props: ScopedProps<PopperProps>) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState<Measurable | null>(null);\n return (\n <PopperProvider scope={__scopePopper} anchor={anchor} onAnchorChange={setAnchor}>\n {children}\n </PopperProvider>\n );\n};\n\nPopper.displayName = POPPER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable>;\n}\n\nconst PopperAnchor = React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef<PopperAnchorElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n // Consumer can anchor the popper to something that isn't\n // a DOM node e.g. pointer position, so we override the\n // `anchorRef` with their virtual ref in this case.\n context.onAnchorChange(virtualRef?.current || ref.current);\n });\n\n return virtualRef ? null : <Primitive.div {...anchorProps} ref={composedRefs} />;\n }\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n arrowStyles: React.CSSProperties;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n onArrowOffsetChange(offset?: number): void;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype PopperContentElement = React.ElementRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n collisionTolerance?: number;\n avoidCollisions?: boolean;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset,\n align = 'center',\n alignOffset,\n collisionTolerance,\n avoidCollisions = true,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n const [arrowOffset, setArrowOffset] = React.useState<number>();\n const anchorRect = useRect(context.anchor);\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const contentSize = useSize(content);\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n\n const windowSize = useWindowSize();\n const collisionBoundariesRect = windowSize\n ? DOMRect.fromRect({ ...windowSize, x: 0, y: 0 })\n : undefined;\n\n const { popperStyles, arrowStyles, placedSide, placedAlign } = getPlacementData({\n anchorRect,\n popperSize: contentSize,\n arrowSize,\n\n // config\n arrowOffset,\n side,\n sideOffset,\n align,\n alignOffset,\n shouldAvoidCollisions: avoidCollisions,\n collisionBoundariesRect,\n collisionTolerance,\n });\n const isPlaced = placedSide !== undefined;\n\n return (\n <div style={popperStyles} data-radix-popper-content-wrapper=\"\">\n <PopperContentProvider\n scope={__scopePopper}\n arrowStyles={arrowStyles}\n onArrowChange={setArrow}\n onArrowOffsetChange={setArrowOffset}\n >\n <Primitive.div\n data-side={placedSide}\n data-align={placedAlign}\n {...contentProps}\n style={{\n ...contentProps.style,\n // if the PopperContent hasn't been placed yet (not all measurements done)\n // we prevent animations so that users's animation don't kick in too early referring wrong sides\n animation: !isPlaced ? 'none' : undefined,\n }}\n ref={composedRefs}\n />\n </PopperContentProvider>\n </div>\n );\n }\n);\n\nPopperContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\ntype PopperArrowElement = React.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {\n offset?: number;\n}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef\n) {\n const { __scopePopper, offset, ...arrowProps } = props;\n const context = useContentContext(ARROW_NAME, __scopePopper);\n const { onArrowOffsetChange } = context;\n\n // send the Arrow's offset up to Popper\n React.useEffect(() => onArrowOffsetChange(offset), [onArrowOffsetChange, offset]);\n\n return (\n <span style={{ ...context.arrowStyles, pointerEvents: 'none' }}>\n <span\n // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)\n // doesn't report size as we'd expect on SVG elements.\n // it reports their bounding box which is effectively the largest path inside the SVG.\n ref={context.onArrowChange}\n style={{\n display: 'inline-block',\n verticalAlign: 'top',\n pointerEvents: 'auto',\n }}\n >\n <ArrowPrimitive.Root\n {...arrowProps}\n ref={forwardedRef}\n style={{\n ...arrowProps.style,\n // ensures the element can be measured correctly (mostly for if SVG)\n display: 'block',\n }}\n />\n </span>\n </span>\n );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS = 100;\n\nfunction useWindowSize() {\n const [windowSize, setWindowSize] = React.useState<{ width: number; height: number } | undefined>(\n undefined\n );\n\n React.useEffect(() => {\n let debounceTimerId: number;\n\n function updateWindowSize() {\n setWindowSize({ width: window.innerWidth, height: window.innerHeight });\n }\n\n function handleResize() {\n window.clearTimeout(debounceTimerId);\n debounceTimerId = window.setTimeout(updateWindowSize, WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS);\n }\n\n updateWindowSize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return windowSize;\n}\n\nconst Root = Popper;\nconst Anchor = PopperAnchor;\nconst Content = PopperContent;\nconst Arrow = PopperArrow;\n\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],"names":["React","getPlacementData","useComposedRefs","createContextScope","useRect","useSize","Primitive","ArrowPrimitive","POPPER_NAME","createPopperContext","createPopperScope","PopperProvider","usePopperContext","Popper","props","__scopePopper","children","anchor","setAnchor","useState","ANCHOR_NAME","PopperAnchor","forwardRef","forwardedRef","virtualRef","anchorProps","context","ref","useRef","composedRefs","useEffect","onAnchorChange","current","CONTENT_NAME","PopperContentProvider","useContentContext","PopperContent","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions","contentProps","arrowOffset","setArrowOffset","anchorRect","content","setContent","contentSize","arrow","setArrow","arrowSize","node","windowSize","useWindowSize","collisionBoundariesRect","DOMRect","fromRect","x","y","undefined","popperStyles","arrowStyles","placedSide","placedAlign","popperSize","shouldAvoidCollisions","isPlaced","style","animation","ARROW_NAME","PopperArrow","offset","arrowProps","onArrowOffsetChange","pointerEvents","onArrowChange","display","verticalAlign","WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS","setWindowSize","debounceTimerId","updateWindowSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","setTimeout","addEventListener","removeEventListener","Root","Anchor","Content","Arrow"],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;ACeA;;oGAEA,CAEA,MAAMS,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBC,uCAAtB,CAAA,GAA2CR,6CAAkB,CAACM,iCAAD,CAAnE,AAAA;AAMA,MAAM,CAACG,oCAAD,EAAiBC,sCAAjB,CAAA,GAAqCH,yCAAmB,CAAqBD,iCAArB,CAA9D,AAAA;AAKA,MAAMK,yCAA6B,GAAIC,CAAAA,KAAD,GAAqC;IACzE,MAAM,E,eAAEC,aAAF,CAAA,E,UAAiBC,QAAAA,CAAAA,EAAjB,GAA8BF,KAApC,AAAM;IACN,MAAM,CAACG,MAAD,EAASC,SAAT,CAAA,GAAsBnB,qBAAA,CAAkC,IAAlC,CAA5B,AAAA;IACA,OAAA,aACE,CAAA,0BAAA,CAAC,oCAAD,EADF;QACkB,KAAK,EAAEgB,aAAvB;QAAsC,MAAM,EAAEE,MAA9C;QAAsD,cAAc,EAAEC,SAAhB;KAAtD,EACGF,QADH,CADF,CACE;CAJJ,AAQC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA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ADxQA","sources":["packages/react/popper/src/index.ts","packages/react/popper/src/Popper.tsx"],"sourcesContent":["export * from './Popper';\n","import * as React from 'react';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { getPlacementData } from '@radix-ui/popper';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useRect } from '@radix-ui/react-use-rect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Side, Align } from '@radix-ui/popper';\nimport type { Measurable } from '@radix-ui/rect';\n\n/* -------------------------------------------------------------------------------------------------\n * Popper\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_NAME = 'Popper';\n\ntype ScopedProps<P> = P & { __scopePopper?: Scope };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext<PopperContextValue>(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode;\n}\nconst Popper: React.FC<PopperProps> = (props: ScopedProps<PopperProps>) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState<Measurable | null>(null);\n return (\n <PopperProvider scope={__scopePopper} anchor={anchor} onAnchorChange={setAnchor}>\n {children}\n </PopperProvider>\n );\n};\n\nPopper.displayName = POPPER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable>;\n}\n\nconst PopperAnchor = React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef<PopperAnchorElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n // Consumer can anchor the popper to something that isn't\n // a DOM node e.g. pointer position, so we override the\n // `anchorRef` with their virtual ref in this case.\n context.onAnchorChange(virtualRef?.current || ref.current);\n });\n\n return virtualRef ? null : <Primitive.div {...anchorProps} ref={composedRefs} />;\n }\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n arrowStyles: React.CSSProperties;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n onArrowOffsetChange(offset?: number): void;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype PopperContentElement = React.ElementRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n collisionTolerance?: number;\n avoidCollisions?: boolean;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset,\n align = 'center',\n alignOffset,\n collisionTolerance,\n avoidCollisions = true,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n const [arrowOffset, setArrowOffset] = React.useState<number>();\n const anchorRect = useRect(context.anchor);\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const contentSize = useSize(content);\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n\n const windowSize = useWindowSize();\n const collisionBoundariesRect = windowSize\n ? DOMRect.fromRect({ ...windowSize, x: 0, y: 0 })\n : undefined;\n\n const { popperStyles, arrowStyles, placedSide, placedAlign } = getPlacementData({\n anchorRect,\n popperSize: contentSize,\n arrowSize,\n\n // config\n arrowOffset,\n side,\n sideOffset,\n align,\n alignOffset,\n shouldAvoidCollisions: avoidCollisions,\n collisionBoundariesRect,\n collisionTolerance,\n });\n const isPlaced = placedSide !== undefined;\n\n const [contentZIndex, setContentZIndex] = React.useState<string>();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n return (\n <div style={{ ...popperStyles, zIndex: contentZIndex }} data-radix-popper-content-wrapper=\"\">\n <PopperContentProvider\n scope={__scopePopper}\n arrowStyles={arrowStyles}\n onArrowChange={setArrow}\n onArrowOffsetChange={setArrowOffset}\n >\n <Primitive.div\n data-side={placedSide}\n data-align={placedAlign}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // if the PopperContent hasn't been placed yet (not all measurements done)\n // we prevent animations so that users's animation don't kick in too early referring wrong sides\n animation: !isPlaced ? 'none' : undefined,\n }}\n />\n </PopperContentProvider>\n </div>\n );\n }\n);\n\nPopperContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\ntype PopperArrowElement = React.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {\n offset?: number;\n}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef\n) {\n const { __scopePopper, offset, ...arrowProps } = props;\n const context = useContentContext(ARROW_NAME, __scopePopper);\n const { onArrowOffsetChange } = context;\n\n // send the Arrow's offset up to Popper\n React.useEffect(() => onArrowOffsetChange(offset), [onArrowOffsetChange, offset]);\n\n return (\n <span style={{ ...context.arrowStyles, pointerEvents: 'none' }}>\n <span\n // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)\n // doesn't report size as we'd expect on SVG elements.\n // it reports their bounding box which is effectively the largest path inside the SVG.\n ref={context.onArrowChange}\n style={{\n display: 'inline-block',\n verticalAlign: 'top',\n pointerEvents: 'auto',\n }}\n >\n <ArrowPrimitive.Root\n {...arrowProps}\n ref={forwardedRef}\n style={{\n ...arrowProps.style,\n // ensures the element can be measured correctly (mostly for if SVG)\n display: 'block',\n }}\n />\n </span>\n </span>\n );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS = 100;\n\nfunction useWindowSize() {\n const [windowSize, setWindowSize] = React.useState<{ width: number; height: number } | undefined>(\n undefined\n );\n\n React.useEffect(() => {\n let debounceTimerId: number;\n\n function updateWindowSize() {\n setWindowSize({ width: window.innerWidth, height: window.innerHeight });\n }\n\n function handleResize() {\n window.clearTimeout(debounceTimerId);\n debounceTimerId = window.setTimeout(updateWindowSize, WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS);\n }\n\n updateWindowSize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return windowSize;\n}\n\nconst Root = Popper;\nconst Anchor = PopperAnchor;\nconst Content = PopperContent;\nconst Arrow = PopperArrow;\n\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],"names":["React","ArrowPrimitive","useComposedRefs","createContextScope","getPlacementData","Primitive","useLayoutEffect","useRect","useSize","POPPER_NAME","createPopperContext","createPopperScope","PopperProvider","usePopperContext","Popper","props","__scopePopper","children","anchor","setAnchor","useState","ANCHOR_NAME","PopperAnchor","forwardRef","forwardedRef","virtualRef","anchorProps","context","ref","useRef","composedRefs","useEffect","onAnchorChange","current","CONTENT_NAME","PopperContentProvider","useContentContext","PopperContent","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions","contentProps","arrowOffset","setArrowOffset","anchorRect","content","setContent","contentSize","arrow","setArrow","arrowSize","node","windowSize","useWindowSize","collisionBoundariesRect","DOMRect","fromRect","x","y","undefined","popperStyles","arrowStyles","placedSide","placedAlign","popperSize","shouldAvoidCollisions","isPlaced","contentZIndex","setContentZIndex","window","getComputedStyle","zIndex","style","animation","ARROW_NAME","PopperArrow","offset","arrowProps","onArrowOffsetChange","pointerEvents","onArrowChange","display","verticalAlign","WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS","setWindowSize","debounceTimerId","updateWindowSize","width","innerWidth","height","innerHeight","handleResize","clearTimeout","setTimeout","addEventListener","removeEventListener","Root","Anchor","Content","Arrow"],"version":3,"file":"index.js.map"}
@@ -1,12 +1,13 @@
1
1
  import $kY93V$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
2
2
  import {useState as $kY93V$useState, createElement as $kY93V$createElement, forwardRef as $kY93V$forwardRef, useRef as $kY93V$useRef, useEffect as $kY93V$useEffect} from "react";
3
- import {getPlacementData as $kY93V$getPlacementData} from "@radix-ui/popper";
3
+ import {Root as $kY93V$Root} from "@radix-ui/react-arrow";
4
4
  import {useComposedRefs as $kY93V$useComposedRefs} from "@radix-ui/react-compose-refs";
5
5
  import {createContextScope as $kY93V$createContextScope} from "@radix-ui/react-context";
6
+ import {getPlacementData as $kY93V$getPlacementData} from "@radix-ui/popper";
7
+ import {Primitive as $kY93V$Primitive} from "@radix-ui/react-primitive";
8
+ import {useLayoutEffect as $kY93V$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
6
9
  import {useRect as $kY93V$useRect} from "@radix-ui/react-use-rect";
7
10
  import {useSize as $kY93V$useSize} from "@radix-ui/react-use-size";
8
- import {Primitive as $kY93V$Primitive} from "@radix-ui/react-primitive";
9
- import {Root as $kY93V$Root} from "@radix-ui/react-arrow";
10
11
 
11
12
  function $parcel$export(e, n, v, s) {
12
13
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -31,6 +32,7 @@ $parcel$export($cf1ac5d9fe0e8206$exports, "Arrow", () => $cf1ac5d9fe0e8206$expor
31
32
 
32
33
 
33
34
 
35
+
34
36
  /* -------------------------------------------------------------------------------------------------
35
37
  * Popper
36
38
  * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$POPPER_NAME = 'Popper';
@@ -105,8 +107,17 @@ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ $kY93V$forwardRef
105
107
  collisionTolerance: collisionTolerance
106
108
  });
107
109
  const isPlaced = placedSide !== undefined;
110
+ const [contentZIndex, setContentZIndex] = $kY93V$useState();
111
+ $kY93V$useLayoutEffect(()=>{
112
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
113
+ }, [
114
+ content
115
+ ]);
108
116
  return /*#__PURE__*/ $kY93V$createElement("div", {
109
- style: popperStyles,
117
+ style: {
118
+ ...popperStyles,
119
+ zIndex: contentZIndex
120
+ },
110
121
  "data-radix-popper-content-wrapper": ""
111
122
  }, /*#__PURE__*/ $kY93V$createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
112
123
  scope: __scopePopper,
@@ -117,13 +128,13 @@ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ $kY93V$forwardRef
117
128
  "data-side": placedSide,
118
129
  "data-align": placedAlign
119
130
  }, contentProps, {
131
+ ref: composedRefs,
120
132
  style: {
121
133
  ...contentProps.style,
122
134
  // if the PopperContent hasn't been placed yet (not all measurements done)
123
135
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
124
136
  animation: !isPlaced ? 'none' : undefined
125
- },
126
- ref: composedRefs
137
+ }
127
138
  }))));
128
139
  });
129
140
  /*#__PURE__*/ Object.assign($cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc, {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;ACcA;;oGAEA,CAEA,MAAMQ,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBC,uCAAtB,CAAA,GAA2CP,yBAAkB,CAACK,iCAAD,CAAnE,AAAA;AAMA,MAAM,CAACG,oCAAD,EAAiBC,sCAAjB,CAAA,GAAqCH,yCAAmB,CAAqBD,iCAArB,CAA9D,AAAA;AAKA,MAAMK,yCAA6B,GAAIC,CAAAA,KAAD,GAAqC;IACzE,MAAM,E,eAAEC,aAAF,CAAA,E,UAAiBC,QAAAA,CAAAA,EAAjB,GAA8BF,KAApC,AAAM;IACN,MAAM,CAACG,MAAD,EAASC,SAAT,CAAA,GAAsBlB,eAAA,CAAkC,IAAlC,CAA5B,AAAA;IACA,OAAA,aACE,CAAA,oBAAA,CAAC,oCAAD,EADF;QACkB,KAAK,EAAEe,aAAvB;QAAsC,MAAM,EAAEE,MAA9C;QAAsD,cAAc,EAAEC,SAAhB;KAAtD,EACGF,QADH,CADF,CACE;CAJJ,AAQC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,iCAAA;CAAA,CAAA,CAAA;AAEA;;oGAEA,CAEA,MAAMI,iCAAW,GAAG,cAApB,AAAA;AAQA,MAAMC,wCAAY,GAAA,aAAGrB,CAAAA,iBAAA,CACnB,CAACc,KAAD,EAAwCS,YAAxC,GAAyD;IACvD,MAAM,E,eAAER,aAAF,CAAA,E,YAAiBS,UAAjB,CAAA,EAA6B,GAAGC,WAAH,EAA7B,GAAgDX,KAAtD,AAAM;IACN,MAAMY,OAAO,GAAGd,sCAAgB,CAACQ,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;YACtBJ,MAAM,CAACK,YAAP,CAAoBR,eAApB,CAAAG,CAAAA;YACAH,eAAe,GAAGG,MAAM,CAACM,UAAP,CAAkBR,gBAAlB,EAAoCH,uDAApC,CAAlB,CAAAE;SACD;QAEDC,gBAAgB,EAAhBA,CAAAA;QACAE,MAAM,CAACO,gBAAP,CAAwB,QAAxB,EAAkCH,YAAlC,CAAAJ,CAAAA;QACA,OAAO,IAAMA,MAAM,CAACQ,mBAAP,CAA2B,QAA3B,EAAqCJ,YAArC,CAAb;QAAA,CAAA;KAdF,EAeG,EAfH,CAeC,CAAA;IAED,OAAOnC,UAAP,CAAA;CACD;AAED,MAAMwC,yCAAI,GAAGjF,yCAAb,AAAA;AACA,MAAMkF,yCAAM,GAAG1E,wCAAf,AAAA;AACA,MAAM2E,yCAAO,GAAG5D,wCAAhB,AAAA;AACA,MAAM6D,yCAAK,GAAGzB,yCAAd,AAAA;;ADlQA","sources":["packages/react/popper/src/index.ts","packages/react/popper/src/Popper.tsx"],"sourcesContent":["export * from './Popper';\n","import * as React from 'react';\nimport { getPlacementData } from '@radix-ui/popper';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useRect } from '@radix-ui/react-use-rect';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Side, Align } from '@radix-ui/popper';\nimport type { Measurable } from '@radix-ui/rect';\n\n/* -------------------------------------------------------------------------------------------------\n * Popper\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_NAME = 'Popper';\n\ntype ScopedProps<P> = P & { __scopePopper?: Scope };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext<PopperContextValue>(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode;\n}\nconst Popper: React.FC<PopperProps> = (props: ScopedProps<PopperProps>) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState<Measurable | null>(null);\n return (\n <PopperProvider scope={__scopePopper} anchor={anchor} onAnchorChange={setAnchor}>\n {children}\n </PopperProvider>\n );\n};\n\nPopper.displayName = POPPER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable>;\n}\n\nconst PopperAnchor = React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef<PopperAnchorElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n // Consumer can anchor the popper to something that isn't\n // a DOM node e.g. pointer position, so we override the\n // `anchorRef` with their virtual ref in this case.\n context.onAnchorChange(virtualRef?.current || ref.current);\n });\n\n return virtualRef ? null : <Primitive.div {...anchorProps} ref={composedRefs} />;\n }\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n arrowStyles: React.CSSProperties;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n onArrowOffsetChange(offset?: number): void;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype PopperContentElement = React.ElementRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n collisionTolerance?: number;\n avoidCollisions?: boolean;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset,\n align = 'center',\n alignOffset,\n collisionTolerance,\n avoidCollisions = true,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n const [arrowOffset, setArrowOffset] = React.useState<number>();\n const anchorRect = useRect(context.anchor);\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const contentSize = useSize(content);\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n\n const windowSize = useWindowSize();\n const collisionBoundariesRect = windowSize\n ? DOMRect.fromRect({ ...windowSize, x: 0, y: 0 })\n : undefined;\n\n const { popperStyles, arrowStyles, placedSide, placedAlign } = getPlacementData({\n anchorRect,\n popperSize: contentSize,\n arrowSize,\n\n // config\n arrowOffset,\n side,\n sideOffset,\n align,\n alignOffset,\n shouldAvoidCollisions: avoidCollisions,\n collisionBoundariesRect,\n collisionTolerance,\n });\n const isPlaced = placedSide !== undefined;\n\n return (\n <div style={popperStyles} data-radix-popper-content-wrapper=\"\">\n <PopperContentProvider\n scope={__scopePopper}\n arrowStyles={arrowStyles}\n onArrowChange={setArrow}\n onArrowOffsetChange={setArrowOffset}\n >\n <Primitive.div\n data-side={placedSide}\n data-align={placedAlign}\n {...contentProps}\n style={{\n ...contentProps.style,\n // if the PopperContent hasn't been placed yet (not all measurements done)\n // we prevent animations so that users's animation don't kick in too early referring wrong sides\n animation: !isPlaced ? 'none' : undefined,\n }}\n ref={composedRefs}\n />\n </PopperContentProvider>\n </div>\n );\n }\n);\n\nPopperContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\ntype PopperArrowElement = React.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {\n offset?: number;\n}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef\n) {\n const { __scopePopper, offset, ...arrowProps } = props;\n const context = useContentContext(ARROW_NAME, __scopePopper);\n const { onArrowOffsetChange } = context;\n\n // send the Arrow's offset up to Popper\n React.useEffect(() => onArrowOffsetChange(offset), [onArrowOffsetChange, offset]);\n\n return (\n <span style={{ ...context.arrowStyles, pointerEvents: 'none' }}>\n <span\n // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)\n // doesn't report size as we'd expect on SVG elements.\n // it reports their bounding box which is effectively the largest path inside the SVG.\n ref={context.onArrowChange}\n style={{\n display: 'inline-block',\n verticalAlign: 'top',\n pointerEvents: 'auto',\n }}\n >\n <ArrowPrimitive.Root\n {...arrowProps}\n ref={forwardedRef}\n style={{\n ...arrowProps.style,\n // ensures the element can be measured correctly (mostly for if SVG)\n display: 'block',\n }}\n />\n </span>\n </span>\n );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS = 100;\n\nfunction useWindowSize() {\n const [windowSize, setWindowSize] = React.useState<{ width: number; height: number } | undefined>(\n undefined\n );\n\n React.useEffect(() => {\n let debounceTimerId: number;\n\n function updateWindowSize() {\n setWindowSize({ width: window.innerWidth, height: window.innerHeight });\n }\n\n function handleResize() {\n window.clearTimeout(debounceTimerId);\n debounceTimerId = window.setTimeout(updateWindowSize, WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS);\n }\n\n updateWindowSize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return windowSize;\n}\n\nconst Root = Popper;\nconst Anchor = PopperAnchor;\nconst Content = PopperContent;\nconst Arrow = PopperArrow;\n\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],"names":["React","getPlacementData","useComposedRefs","createContextScope","useRect","useSize","Primitive","ArrowPrimitive","POPPER_NAME","createPopperContext","createPopperScope","PopperProvider","usePopperContext","Popper","props","__scopePopper","children","anchor","setAnchor","useState","ANCHOR_NAME","PopperAnchor","forwardRef","forwardedRef","virtualRef","anchorProps","context","ref","useRef","composedRefs","useEffect","onAnchorChange","current","CONTENT_NAME","PopperContentProvider","useContentContext","PopperContent","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions","contentProps","arrowOffset","setArrowOffset","anchorRect","content","setContent","contentSize","arrow","setArrow","arrowSize","node","windowSize","useWindowSize","collisionBoundariesRect","DOMRect","fromRect","x","y","undefined","popperStyles","arrowStyles","placedSide","placedAlign","popperSize","shouldAvoidCollisions","isPlaced","style","animation","ARROW_NAME","PopperArrow","offset","arrowProps","onArrowOffsetChange","pointerEvents","onArrowChange","display","verticalAlign","WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS","setWindowSize","debounceTimerId","updateWindowSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","setTimeout","addEventListener","removeEventListener","Root","Anchor","Content","Arrow"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;ACeA;;oGAEA,CAEA,MAAMS,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBC,uCAAtB,CAAA,GAA2CR,yB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ACuB,YAAP,CAAoBP,eAApB,CAAAhB,CAAAA;YACAgB,eAAe,GAAGhB,MAAM,CAACwB,UAAP,CAAkBP,gBAAlB,EAAoCH,uDAApC,CAAlB,CAAAE;SACD;QAEDC,gBAAgB,EAAhBA,CAAAA;QACAjB,MAAM,CAACyB,gBAAP,CAAwB,QAAxB,EAAkCH,YAAlC,CAAAtB,CAAAA;QACA,OAAO,IAAMA,MAAM,CAAC0B,mBAAP,CAA2B,QAA3B,EAAqCJ,YAArC,CAAb;QAAA,CAAA;KAdF,EAeG,EAfH,CAeC,CAAA;IAED,OAAOvC,UAAP,CAAA;CACD;AAED,MAAM4C,yCAAI,GAAGrF,yCAAb,AAAA;AACA,MAAMsF,yCAAM,GAAG9E,wCAAf,AAAA;AACA,MAAM+E,yCAAO,GAAGhE,wCAAhB,AAAA;AACA,MAAMiE,yCAAK,GAAGxB,yCAAd,AAAA;;ADxQA","sources":["packages/react/popper/src/index.ts","packages/react/popper/src/Popper.tsx"],"sourcesContent":["export * from './Popper';\n","import * as React from 'react';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { getPlacementData } from '@radix-ui/popper';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useRect } from '@radix-ui/react-use-rect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Side, Align } from '@radix-ui/popper';\nimport type { Measurable } from '@radix-ui/rect';\n\n/* -------------------------------------------------------------------------------------------------\n * Popper\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_NAME = 'Popper';\n\ntype ScopedProps<P> = P & { __scopePopper?: Scope };\nconst [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\n\ntype PopperContextValue = {\n anchor: Measurable | null;\n onAnchorChange(anchor: Measurable | null): void;\n};\nconst [PopperProvider, usePopperContext] = createPopperContext<PopperContextValue>(POPPER_NAME);\n\ninterface PopperProps {\n children?: React.ReactNode;\n}\nconst Popper: React.FC<PopperProps> = (props: ScopedProps<PopperProps>) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState<Measurable | null>(null);\n return (\n <PopperProvider scope={__scopePopper} anchor={anchor} onAnchorChange={setAnchor}>\n {children}\n </PopperProvider>\n );\n};\n\nPopper.displayName = POPPER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable>;\n}\n\nconst PopperAnchor = React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef<PopperAnchorElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n // Consumer can anchor the popper to something that isn't\n // a DOM node e.g. pointer position, so we override the\n // `anchorRef` with their virtual ref in this case.\n context.onAnchorChange(virtualRef?.current || ref.current);\n });\n\n return virtualRef ? null : <Primitive.div {...anchorProps} ref={composedRefs} />;\n }\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n arrowStyles: React.CSSProperties;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n onArrowOffsetChange(offset?: number): void;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype PopperContentElement = React.ElementRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n collisionTolerance?: number;\n avoidCollisions?: boolean;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset,\n align = 'center',\n alignOffset,\n collisionTolerance,\n avoidCollisions = true,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n const [arrowOffset, setArrowOffset] = React.useState<number>();\n const anchorRect = useRect(context.anchor);\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const contentSize = useSize(content);\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n\n const windowSize = useWindowSize();\n const collisionBoundariesRect = windowSize\n ? DOMRect.fromRect({ ...windowSize, x: 0, y: 0 })\n : undefined;\n\n const { popperStyles, arrowStyles, placedSide, placedAlign } = getPlacementData({\n anchorRect,\n popperSize: contentSize,\n arrowSize,\n\n // config\n arrowOffset,\n side,\n sideOffset,\n align,\n alignOffset,\n shouldAvoidCollisions: avoidCollisions,\n collisionBoundariesRect,\n collisionTolerance,\n });\n const isPlaced = placedSide !== undefined;\n\n const [contentZIndex, setContentZIndex] = React.useState<string>();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n return (\n <div style={{ ...popperStyles, zIndex: contentZIndex }} data-radix-popper-content-wrapper=\"\">\n <PopperContentProvider\n scope={__scopePopper}\n arrowStyles={arrowStyles}\n onArrowChange={setArrow}\n onArrowOffsetChange={setArrowOffset}\n >\n <Primitive.div\n data-side={placedSide}\n data-align={placedAlign}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // if the PopperContent hasn't been placed yet (not all measurements done)\n // we prevent animations so that users's animation don't kick in too early referring wrong sides\n animation: !isPlaced ? 'none' : undefined,\n }}\n />\n </PopperContentProvider>\n </div>\n );\n }\n);\n\nPopperContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\ntype PopperArrowElement = React.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {\n offset?: number;\n}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef\n) {\n const { __scopePopper, offset, ...arrowProps } = props;\n const context = useContentContext(ARROW_NAME, __scopePopper);\n const { onArrowOffsetChange } = context;\n\n // send the Arrow's offset up to Popper\n React.useEffect(() => onArrowOffsetChange(offset), [onArrowOffsetChange, offset]);\n\n return (\n <span style={{ ...context.arrowStyles, pointerEvents: 'none' }}>\n <span\n // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)\n // doesn't report size as we'd expect on SVG elements.\n // it reports their bounding box which is effectively the largest path inside the SVG.\n ref={context.onArrowChange}\n style={{\n display: 'inline-block',\n verticalAlign: 'top',\n pointerEvents: 'auto',\n }}\n >\n <ArrowPrimitive.Root\n {...arrowProps}\n ref={forwardedRef}\n style={{\n ...arrowProps.style,\n // ensures the element can be measured correctly (mostly for if SVG)\n display: 'block',\n }}\n />\n </span>\n </span>\n );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS = 100;\n\nfunction useWindowSize() {\n const [windowSize, setWindowSize] = React.useState<{ width: number; height: number } | undefined>(\n undefined\n );\n\n React.useEffect(() => {\n let debounceTimerId: number;\n\n function updateWindowSize() {\n setWindowSize({ width: window.innerWidth, height: window.innerHeight });\n }\n\n function handleResize() {\n window.clearTimeout(debounceTimerId);\n debounceTimerId = window.setTimeout(updateWindowSize, WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS);\n }\n\n updateWindowSize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return windowSize;\n}\n\nconst Root = Popper;\nconst Anchor = PopperAnchor;\nconst Content = PopperContent;\nconst Arrow = PopperArrow;\n\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],"names":["React","ArrowPrimitive","useComposedRefs","createContextScope","getPlacementData","Primitive","useLayoutEffect","useRect","useSize","POPPER_NAME","createPopperContext","createPopperScope","PopperProvider","usePopperContext","Popper","props","__scopePopper","children","anchor","setAnchor","useState","ANCHOR_NAME","PopperAnchor","forwardRef","forwardedRef","virtualRef","anchorProps","context","ref","useRef","composedRefs","useEffect","onAnchorChange","current","CONTENT_NAME","PopperContentProvider","useContentContext","PopperContent","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions","contentProps","arrowOffset","setArrowOffset","anchorRect","content","setContent","contentSize","arrow","setArrow","arrowSize","node","windowSize","useWindowSize","collisionBoundariesRect","DOMRect","fromRect","x","y","undefined","popperStyles","arrowStyles","placedSide","placedAlign","popperSize","shouldAvoidCollisions","isPlaced","contentZIndex","setContentZIndex","window","getComputedStyle","zIndex","style","animation","ARROW_NAME","PopperArrow","offset","arrowProps","onArrowOffsetChange","pointerEvents","onArrowChange","display","verticalAlign","WINDOW_RESIZE_DEBOUNCE_WAIT_IN_MS","setWindowSize","debounceTimerId","updateWindowSize","width","innerWidth","height","innerHeight","handleResize","clearTimeout","setTimeout","addEventListener","removeEventListener","Root","Anchor","Content","Arrow"],"version":3,"file":"index.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-popper",
3
- "version": "0.1.5-rc.26",
3
+ "version": "0.1.5-rc.29",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -18,12 +18,13 @@
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.13.10",
20
20
  "@radix-ui/popper": "0.1.0",
21
- "@radix-ui/react-arrow": "0.1.5-rc.26",
22
- "@radix-ui/react-compose-refs": "0.1.1-rc.26",
23
- "@radix-ui/react-context": "0.1.2-rc.26",
24
- "@radix-ui/react-primitive": "0.1.5-rc.26",
25
- "@radix-ui/react-use-rect": "0.1.2-rc.26",
26
- "@radix-ui/react-use-size": "0.1.2-rc.26",
21
+ "@radix-ui/react-arrow": "0.1.5-rc.29",
22
+ "@radix-ui/react-compose-refs": "0.1.1-rc.29",
23
+ "@radix-ui/react-context": "0.1.2-rc.29",
24
+ "@radix-ui/react-primitive": "0.1.5-rc.29",
25
+ "@radix-ui/react-use-layout-effect": "0.1.1-rc.29",
26
+ "@radix-ui/react-use-rect": "0.1.2-rc.29",
27
+ "@radix-ui/react-use-size": "0.1.2-rc.29",
27
28
  "@radix-ui/rect": "0.1.1"
28
29
  },
29
30
  "peerDependencies": {