@radix-ui/react-popper 1.3.3 → 1.3.4-rc.1784074599772
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.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -64
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +68 -64
- package/dist/index.mjs.map +3 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,7 @@ interface PopperProps {
|
|
|
15
15
|
declare const Popper: React.FC<PopperProps>;
|
|
16
16
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
17
17
|
interface PopperAnchorProps extends PrimitiveDivProps {
|
|
18
|
-
virtualRef?: React.RefObject<Measurable>;
|
|
18
|
+
virtualRef?: React.RefObject<Measurable | null>;
|
|
19
19
|
}
|
|
20
20
|
declare const PopperAnchor: React.ForwardRefExoticComponent<PopperAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
type Boundary = Element | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ interface PopperProps {
|
|
|
15
15
|
declare const Popper: React.FC<PopperProps>;
|
|
16
16
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
17
17
|
interface PopperAnchorProps extends PrimitiveDivProps {
|
|
18
|
-
virtualRef?: React.RefObject<Measurable>;
|
|
18
|
+
virtualRef?: React.RefObject<Measurable | null>;
|
|
19
19
|
}
|
|
20
20
|
declare const PopperAnchor: React.ForwardRefExoticComponent<PopperAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
type Boundary = Element | null;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
10
|
var __export = (target, all) => {
|
|
10
11
|
for (var name in all)
|
|
11
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -61,7 +62,7 @@ var ALIGN_OPTIONS = ["start", "center", "end"];
|
|
|
61
62
|
var POPPER_NAME = "Popper";
|
|
62
63
|
var [createPopperContext, createPopperScope] = (0, import_react_context.createContextScope)(POPPER_NAME);
|
|
63
64
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
64
|
-
var Popper = (props) => {
|
|
65
|
+
var Popper = /* @__PURE__ */ __name((props) => {
|
|
65
66
|
const { __scopePopper, children } = props;
|
|
66
67
|
const [anchor, setAnchor] = React.useState(null);
|
|
67
68
|
const [placementState, setPlacementState] = React.useState(void 0);
|
|
@@ -76,11 +77,10 @@ var Popper = (props) => {
|
|
|
76
77
|
children
|
|
77
78
|
}
|
|
78
79
|
);
|
|
79
|
-
};
|
|
80
|
-
Popper.displayName = POPPER_NAME;
|
|
80
|
+
}, "Popper");
|
|
81
81
|
var ANCHOR_NAME = "PopperAnchor";
|
|
82
|
-
var PopperAnchor = React.forwardRef(
|
|
83
|
-
(props, forwardedRef)
|
|
82
|
+
var PopperAnchor = /* @__PURE__ */ React.forwardRef(
|
|
83
|
+
/* @__PURE__ */ __name(function PopperAnchor2(props, forwardedRef) {
|
|
84
84
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
85
85
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
86
86
|
const ref = React.useRef(null);
|
|
@@ -118,13 +118,12 @@ var PopperAnchor = React.forwardRef(
|
|
|
118
118
|
ref: composedRefs
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
}
|
|
121
|
+
}, "PopperAnchor")
|
|
122
122
|
);
|
|
123
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
124
123
|
var CONTENT_NAME = "PopperContent";
|
|
125
124
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
126
|
-
var PopperContent = React.forwardRef(
|
|
127
|
-
(props, forwardedRef)
|
|
125
|
+
var PopperContent = /* @__PURE__ */ React.forwardRef(
|
|
126
|
+
/* @__PURE__ */ __name(function PopperContent2(props, forwardedRef) {
|
|
128
127
|
const {
|
|
129
128
|
__scopePopper,
|
|
130
129
|
side = "bottom",
|
|
@@ -162,12 +161,12 @@ var PopperContent = React.forwardRef(
|
|
|
162
161
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
163
162
|
strategy: "fixed",
|
|
164
163
|
placement: desiredPlacement,
|
|
165
|
-
whileElementsMounted: (...args) => {
|
|
164
|
+
whileElementsMounted: /* @__PURE__ */ __name((...args) => {
|
|
166
165
|
const cleanup = (0, import_react_dom.autoUpdate)(...args, {
|
|
167
166
|
animationFrame: updatePositionStrategy === "always"
|
|
168
167
|
});
|
|
169
168
|
return cleanup;
|
|
170
|
-
},
|
|
169
|
+
}, "whileElementsMounted"),
|
|
171
170
|
elements: {
|
|
172
171
|
reference: context.anchor
|
|
173
172
|
},
|
|
@@ -182,14 +181,14 @@ var PopperContent = React.forwardRef(
|
|
|
182
181
|
avoidCollisions && (0, import_react_dom.flip)({ ...detectOverflowOptions }),
|
|
183
182
|
(0, import_react_dom.size)({
|
|
184
183
|
...detectOverflowOptions,
|
|
185
|
-
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
184
|
+
apply: /* @__PURE__ */ __name(({ elements, rects, availableWidth, availableHeight }) => {
|
|
186
185
|
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
187
186
|
const contentStyle = elements.floating.style;
|
|
188
187
|
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
189
188
|
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
190
189
|
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
191
190
|
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
192
|
-
}
|
|
191
|
+
}, "apply")
|
|
193
192
|
}),
|
|
194
193
|
arrow && (0, import_react_dom.arrow)({ element: arrow, padding: arrowPadding }),
|
|
195
194
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
@@ -281,9 +280,8 @@ var PopperContent = React.forwardRef(
|
|
|
281
280
|
)
|
|
282
281
|
}
|
|
283
282
|
);
|
|
284
|
-
}
|
|
283
|
+
}, "PopperContent")
|
|
285
284
|
);
|
|
286
|
-
PopperContent.displayName = CONTENT_NAME;
|
|
287
285
|
var ARROW_NAME = "PopperArrow";
|
|
288
286
|
var OPPOSITE_SIDE = {
|
|
289
287
|
top: "bottom",
|
|
@@ -291,58 +289,62 @@ var OPPOSITE_SIDE = {
|
|
|
291
289
|
bottom: "top",
|
|
292
290
|
left: "right"
|
|
293
291
|
};
|
|
294
|
-
var PopperArrow = React.forwardRef(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
top:
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
...arrowProps
|
|
332
|
-
|
|
333
|
-
|
|
292
|
+
var PopperArrow = /* @__PURE__ */ React.forwardRef(
|
|
293
|
+
// ignore prettier to reduce diff noise
|
|
294
|
+
// prettier-ignore
|
|
295
|
+
/* @__PURE__ */ __name(function PopperArrow2(props, forwardedRef) {
|
|
296
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
297
|
+
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
298
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
299
|
+
return (
|
|
300
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
301
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
302
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
304
|
+
"span",
|
|
305
|
+
{
|
|
306
|
+
ref: contentContext.onArrowChange,
|
|
307
|
+
style: {
|
|
308
|
+
position: "absolute",
|
|
309
|
+
left: contentContext.arrowX,
|
|
310
|
+
top: contentContext.arrowY,
|
|
311
|
+
[baseSide]: 0,
|
|
312
|
+
transformOrigin: {
|
|
313
|
+
top: "",
|
|
314
|
+
right: "0 0",
|
|
315
|
+
bottom: "center 0",
|
|
316
|
+
left: "100% 0"
|
|
317
|
+
}[contentContext.placedSide],
|
|
318
|
+
transform: {
|
|
319
|
+
top: "translateY(100%)",
|
|
320
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
321
|
+
bottom: `rotate(180deg)`,
|
|
322
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
323
|
+
}[contentContext.placedSide],
|
|
324
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
325
|
+
},
|
|
326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
327
|
+
ArrowPrimitive.Root,
|
|
328
|
+
{
|
|
329
|
+
...arrowProps,
|
|
330
|
+
ref: forwardedRef,
|
|
331
|
+
style: {
|
|
332
|
+
...arrowProps.style,
|
|
333
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
334
|
+
display: "block"
|
|
335
|
+
}
|
|
334
336
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
)
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
PopperArrow.displayName = ARROW_NAME;
|
|
337
|
+
)
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
}, "PopperArrow")
|
|
342
|
+
);
|
|
342
343
|
function isNotNull(value) {
|
|
343
344
|
return value !== null;
|
|
344
345
|
}
|
|
345
|
-
|
|
346
|
+
__name(isNotNull, "isNotNull");
|
|
347
|
+
var transformOrigin = /* @__PURE__ */ __name((options) => ({
|
|
346
348
|
name: "transformOrigin",
|
|
347
349
|
options,
|
|
348
350
|
fn(data) {
|
|
@@ -372,11 +374,12 @@ var transformOrigin = (options) => ({
|
|
|
372
374
|
}
|
|
373
375
|
return { data: { x, y } };
|
|
374
376
|
}
|
|
375
|
-
});
|
|
377
|
+
}), "transformOrigin");
|
|
376
378
|
function getSideAndAlignFromPlacement(placement) {
|
|
377
379
|
const [side, align = "center"] = placement.split("-");
|
|
378
380
|
return [side, align];
|
|
379
381
|
}
|
|
382
|
+
__name(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
|
|
380
383
|
var Root2 = Popper;
|
|
381
384
|
var Anchor = PopperAnchor;
|
|
382
385
|
var Content = PopperContent;
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/popper.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n} from './popper';\nexport type {\n PopperProps,\n PopperAnchorProps,\n PopperContentProps,\n PopperArrowProps,\n} from './popper';\n", "import * as React from 'react';\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size,\n} from '@floating-ui/react-dom';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type { Placement, Middleware } from '@floating-ui/react-dom';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Measurable } from '@radix-ui/rect';\n\nconst SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;\nconst ALIGN_OPTIONS = ['start', 'center', 'end'] as const;\n\ntype Side = (typeof SIDE_OPTIONS)[number];\ntype Align = (typeof ALIGN_OPTIONS)[number];\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 placementState: Placement | undefined;\n setPlacementState: React.Dispatch<React.SetStateAction<Placement | undefined>>;\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 const [placementState, setPlacementState] = React.useState<Placement | undefined>(undefined);\n return (\n <PopperProvider\n scope={__scopePopper}\n anchor={anchor}\n onAnchorChange={setAnchor}\n placementState={placementState}\n setPlacementState={setPlacementState}\n >\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.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.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 onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef<Measurable | null>(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n <Primitive.div\n data-radix-popper-side={placedSide}\n data-radix-popper-align={placedAlign}\n {...anchorProps}\n ref={composedRefs}\n />\n );\n },\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number;\n arrowY?: number;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n arrowPadding?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Boundary | Boundary[];\n collisionPadding?: number | Partial<Record<Side, number>>;\n sticky?: 'partial' | 'always';\n hideWhenDetached?: boolean;\n updatePositionStrategy?: 'optimized' | 'always';\n onPlaced?: () => void;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = 'partial',\n hideWhenDetached = false,\n updatePositionStrategy = 'optimized',\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === 'always',\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n limiter: sticky === 'partial' ? limitShift() : undefined,\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n hide({\n strategy: 'referenceHidden',\n ...detectOverflowOptions,\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we fall back to Floating\n // UI's default clipping ancestors (e.g. a scrollable menu). This\n // lets an occluded submenu hide once its anchor scrolls out of view\n // (#3237). The collision/size middlewares deliberately keep the\n // viewport-based default to avoid clamping content rendered inside\n // transformed or overflow-clipping portal containers.\n boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : undefined,\n }),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\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\n ref={refs.setFloating}\n data-radix-popper-content-wrapper=\"\"\n style={{\n ...floatingStyles,\n transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)', // keep off the page when measuring\n minWidth: 'max-content',\n zIndex: contentZIndex,\n '--radix-popper-transform-origin': [\n middlewareData.transformOrigin?.x,\n middlewareData.transformOrigin?.y,\n ].join(' '),\n\n // hide the content if using the hide middleware and should be hidden\n // set visibility to hidden and disable pointer events so the UI behaves\n // as if the PopperContent isn't there at all\n ...(middlewareData.hide?.referenceHidden && {\n visibility: 'hidden',\n pointerEvents: 'none',\n }),\n }}\n // Floating UI interally calculates logical alignment based the `dir` attribute on\n // the reference/floating node, we must add this attribute here to ensure\n // this is calculated when portalled as well as inline.\n dir={props.dir}\n >\n <PopperContentProvider\n scope={__scopePopper}\n placedSide={placedSide}\n placedAlign={placedAlign}\n onArrowChange={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n shouldHideArrow={cannotCenterArrow}\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: !isPositioned ? '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\nconst OPPOSITE_SIDE: Record<Side, Side> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ntype PopperArrowElement = React.ComponentRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef,\n) {\n const { __scopePopper, ...arrowProps } = props;\n const contentContext = useContentContext(ARROW_NAME, __scopePopper);\n const baseSide = OPPOSITE_SIDE[contentContext.placedSide];\n\n return (\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 <span\n ref={contentContext.onArrowChange}\n style={{\n position: 'absolute',\n left: contentContext.arrowX,\n top: contentContext.arrowY,\n [baseSide]: 0,\n transformOrigin: {\n top: '',\n right: '0 0',\n bottom: 'center 0',\n left: '100% 0',\n }[contentContext.placedSide],\n transform: {\n top: 'translateY(100%)',\n right: 'translateY(50%) rotate(90deg) translateX(-50%)',\n bottom: `rotate(180deg)`,\n left: 'translateY(50%) rotate(-90deg) translateX(50%)',\n }[contentContext.placedSide],\n visibility: contentContext.shouldHideArrow ? 'hidden' : undefined,\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 );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction isNotNull<T>(value: T | null): value is T {\n return value !== null;\n}\n\nconst transformOrigin = (options: { arrowWidth: number; arrowHeight: number }): Middleware => ({\n name: 'transformOrigin',\n options,\n fn(data) {\n const { placement, rects, middlewareData } = data;\n\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const isArrowHidden = cannotCenterArrow;\n const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;\n const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const noArrowAlign = { start: '0%', center: '50%', end: '100%' }[placedAlign];\n\n const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;\n const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;\n\n let x = '';\n let y = '';\n\n if (placedSide === 'bottom') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${-arrowHeight}px`;\n } else if (placedSide === 'top') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${rects.floating.height + arrowHeight}px`;\n } else if (placedSide === 'right') {\n x = `${-arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n } else if (placedSide === 'left') {\n x = `${rects.floating.width + arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n }\n return { data: { x, y } };\n },\n});\n\nfunction getSideAndAlignFromPlacement(placement: Placement) {\n const [side, align = 'center'] = placement.split('-');\n return [side as Side, align as Align] as const;\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 //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Root", "floatingUIarrow", "PopperArrow", "Root"]
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createPopperScope,\n //\n Popper,\n PopperAnchor,\n PopperContent,\n PopperArrow,\n //\n Root,\n Anchor,\n Content,\n Arrow,\n //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n} from './popper';\nexport type {\n PopperProps,\n PopperAnchorProps,\n PopperContentProps,\n PopperArrowProps,\n} from './popper';\n", "import * as React from 'react';\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size,\n} from '@floating-ui/react-dom';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type { Placement, Middleware } from '@floating-ui/react-dom';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Measurable } from '@radix-ui/rect';\n\nconst SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;\nconst ALIGN_OPTIONS = ['start', 'center', 'end'] as const;\n\ntype Side = (typeof SIDE_OPTIONS)[number];\ntype Align = (typeof ALIGN_OPTIONS)[number];\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 placementState: Placement | undefined;\n setPlacementState: React.Dispatch<React.SetStateAction<Placement | undefined>>;\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 const [placementState, setPlacementState] = React.useState<Placement | undefined>(undefined);\n return (\n <PopperProvider\n scope={__scopePopper}\n anchor={anchor}\n onAnchorChange={setAnchor}\n placementState={placementState}\n setPlacementState={setPlacementState}\n >\n {children}\n </PopperProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable | null>;\n}\n\nconst PopperAnchor = /* @__PURE__ */ React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n function PopperAnchor(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 onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef<Measurable | null>(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n <Primitive.div\n data-radix-popper-side={placedSide}\n data-radix-popper-align={placedAlign}\n {...anchorProps}\n ref={composedRefs}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number;\n arrowY?: number;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n arrowPadding?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Boundary | Boundary[];\n collisionPadding?: number | Partial<Record<Side, number>>;\n sticky?: 'partial' | 'always';\n hideWhenDetached?: boolean;\n updatePositionStrategy?: 'optimized' | 'always';\n onPlaced?: () => void;\n}\n\nconst PopperContent = /* @__PURE__ */ React.forwardRef<PopperContentElement, PopperContentProps>(\n function PopperContent(props: ScopedProps<PopperContentProps>, forwardedRef) {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = 'partial',\n hideWhenDetached = false,\n updatePositionStrategy = 'optimized',\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === 'always',\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n limiter: sticky === 'partial' ? limitShift() : undefined,\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n hide({\n strategy: 'referenceHidden',\n ...detectOverflowOptions,\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we fall back to Floating\n // UI's default clipping ancestors (e.g. a scrollable menu). This\n // lets an occluded submenu hide once its anchor scrolls out of view\n // (#3237). The collision/size middlewares deliberately keep the\n // viewport-based default to avoid clamping content rendered inside\n // transformed or overflow-clipping portal containers.\n boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : undefined,\n }),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\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\n ref={refs.setFloating}\n data-radix-popper-content-wrapper=\"\"\n style={{\n ...floatingStyles,\n transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)', // keep off the page when measuring\n minWidth: 'max-content',\n zIndex: contentZIndex,\n '--radix-popper-transform-origin': [\n middlewareData.transformOrigin?.x,\n middlewareData.transformOrigin?.y,\n ].join(' '),\n\n // hide the content if using the hide middleware and should be hidden\n // set visibility to hidden and disable pointer events so the UI behaves\n // as if the PopperContent isn't there at all\n ...(middlewareData.hide?.referenceHidden && {\n visibility: 'hidden',\n pointerEvents: 'none',\n }),\n }}\n // Floating UI interally calculates logical alignment based the `dir` attribute on\n // the reference/floating node, we must add this attribute here to ensure\n // this is calculated when portalled as well as inline.\n dir={props.dir}\n >\n <PopperContentProvider\n scope={__scopePopper}\n placedSide={placedSide}\n placedAlign={placedAlign}\n onArrowChange={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n shouldHideArrow={cannotCenterArrow}\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: !isPositioned ? 'none' : undefined,\n }}\n />\n </PopperContentProvider>\n </div>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\nconst OPPOSITE_SIDE: Record<Side, Side> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ntype PopperArrowElement = React.ComponentRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {}\n\nconst PopperArrow = /* @__PURE__ */ React.forwardRef<PopperArrowElement, PopperArrowProps>(\n // ignore prettier to reduce diff noise\n // prettier-ignore\n function PopperArrow(props: ScopedProps<PopperArrowProps>, forwardedRef) {\n const { __scopePopper, ...arrowProps } = props;\n const contentContext = useContentContext(ARROW_NAME, __scopePopper);\n const baseSide = OPPOSITE_SIDE[contentContext.placedSide];\n\n return (\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 <span\n ref={contentContext.onArrowChange}\n style={{\n position: 'absolute',\n left: contentContext.arrowX,\n top: contentContext.arrowY,\n [baseSide]: 0,\n transformOrigin: {\n top: '',\n right: '0 0',\n bottom: 'center 0',\n left: '100% 0',\n }[contentContext.placedSide],\n transform: {\n top: 'translateY(100%)',\n right: 'translateY(50%) rotate(90deg) translateX(-50%)',\n bottom: `rotate(180deg)`,\n left: 'translateY(50%) rotate(-90deg) translateX(50%)',\n }[contentContext.placedSide],\n visibility: contentContext.shouldHideArrow ? 'hidden' : undefined,\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 );\n},\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction isNotNull<T>(value: T | null): value is T {\n return value !== null;\n}\n\nconst transformOrigin = (options: { arrowWidth: number; arrowHeight: number }): Middleware => ({\n name: 'transformOrigin',\n options,\n fn(data) {\n const { placement, rects, middlewareData } = data;\n\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const isArrowHidden = cannotCenterArrow;\n const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;\n const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const noArrowAlign = { start: '0%', center: '50%', end: '100%' }[placedAlign];\n\n const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;\n const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;\n\n let x = '';\n let y = '';\n\n if (placedSide === 'bottom') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${-arrowHeight}px`;\n } else if (placedSide === 'top') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${rects.floating.height + arrowHeight}px`;\n } else if (placedSide === 'right') {\n x = `${-arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n } else if (placedSide === 'left') {\n x = `${rects.floating.width + arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n }\n return { data: { x, y } };\n },\n});\n\nfunction getSideAndAlignFromPlacement(placement: Placement) {\n const [side, align = 'center'] = placement.split('-');\n return [side as Side, align as Align] as const;\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 //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAUO;AACP,qBAAgC;AAChC,gCAAgC;AAChC,2BAAmC;AACnC,6BAA0B;AAC1B,oCAA+B;AAC/B,qCAAgC;AAChC,4BAAwB;AAqCpB;AA/BJ,IAAM,eAAe,CAAC,OAAO,SAAS,UAAU,MAAM;AACtD,IAAM,gBAAgB,CAAC,SAAS,UAAU,KAAK;AAS/C,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAQ/E,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAK9F,IAAM,SAAgC,wBAAC,UAAoC;AACzE,QAAM,EAAE,eAAe,SAAS,IAAI;AACpC,QAAM,CAAC,QAAQ,SAAS,IAAU,eAA4B,IAAI;AAClE,QAAM,CAAC,gBAAgB,iBAAiB,IAAU,eAAgC,MAAS;AAC3F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ,GAfsC;AAqBtC,IAAM,cAAc;AAQpB,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,eAAe,YAAY,GAAG,YAAY,IAAI;AACt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gB,eAAe,OAAO,KAAK,KAAK,aAAa;AACnE,UAAM,gBAAgB,eAAe,OAAO,KAAK,KAAK,cAAc;AAEpE,QAAI,IAAI;AACR,QAAI,IAAI;AAER,QAAI,eAAe,UAAU;AAC3B,UAAI,gBAAgB,eAAe,GAAG,YAAY;AAClD,UAAI,GAAG,CAAC,WAAW;AAAA,IACrB,WAAW,eAAe,OAAO;AAC/B,UAAI,gBAAgB,eAAe,GAAG,YAAY;AAClD,UAAI,GAAG,MAAM,SAAS,SAAS,WAAW;AAAA,IAC5C,WAAW,eAAe,SAAS;AACjC,UAAI,GAAG,CAAC,WAAW;AACnB,UAAI,gBAAgB,eAAe,GAAG,YAAY;AAAA,IACpD,WAAW,eAAe,QAAQ;AAChC,UAAI,GAAG,MAAM,SAAS,QAAQ,WAAW;AACzC,UAAI,gBAAgB,eAAe,GAAG,YAAY;AAAA,IACpD;AACA,WAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;AAAA,EAC1B;AACF,IAnCwB;AAqCxB,SAAS,6BAA6B,WAAsB;AAC1D,QAAM,CAAC,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,GAAG;AACpD,SAAO,CAAC,MAAc,KAAc;AACtC;AAHS;AAKT,IAAMC,QAAO;AACb,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,QAAQ;",
|
|
6
|
+
"names": ["Root", "PopperAnchor", "PopperContent", "floatingUIarrow", "PopperArrow", "Root"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
4
|
|
|
3
5
|
// src/popper.tsx
|
|
4
6
|
import * as React from "react";
|
|
@@ -26,7 +28,7 @@ var ALIGN_OPTIONS = ["start", "center", "end"];
|
|
|
26
28
|
var POPPER_NAME = "Popper";
|
|
27
29
|
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
28
30
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
29
|
-
var Popper = (props) => {
|
|
31
|
+
var Popper = /* @__PURE__ */ __name((props) => {
|
|
30
32
|
const { __scopePopper, children } = props;
|
|
31
33
|
const [anchor, setAnchor] = React.useState(null);
|
|
32
34
|
const [placementState, setPlacementState] = React.useState(void 0);
|
|
@@ -41,11 +43,10 @@ var Popper = (props) => {
|
|
|
41
43
|
children
|
|
42
44
|
}
|
|
43
45
|
);
|
|
44
|
-
};
|
|
45
|
-
Popper.displayName = POPPER_NAME;
|
|
46
|
+
}, "Popper");
|
|
46
47
|
var ANCHOR_NAME = "PopperAnchor";
|
|
47
|
-
var PopperAnchor = React.forwardRef(
|
|
48
|
-
(props, forwardedRef)
|
|
48
|
+
var PopperAnchor = /* @__PURE__ */ React.forwardRef(
|
|
49
|
+
/* @__PURE__ */ __name(function PopperAnchor2(props, forwardedRef) {
|
|
49
50
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
50
51
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
51
52
|
const ref = React.useRef(null);
|
|
@@ -83,13 +84,12 @@ var PopperAnchor = React.forwardRef(
|
|
|
83
84
|
ref: composedRefs
|
|
84
85
|
}
|
|
85
86
|
);
|
|
86
|
-
}
|
|
87
|
+
}, "PopperAnchor")
|
|
87
88
|
);
|
|
88
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
89
89
|
var CONTENT_NAME = "PopperContent";
|
|
90
90
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
91
|
-
var PopperContent = React.forwardRef(
|
|
92
|
-
(props, forwardedRef)
|
|
91
|
+
var PopperContent = /* @__PURE__ */ React.forwardRef(
|
|
92
|
+
/* @__PURE__ */ __name(function PopperContent2(props, forwardedRef) {
|
|
93
93
|
const {
|
|
94
94
|
__scopePopper,
|
|
95
95
|
side = "bottom",
|
|
@@ -127,12 +127,12 @@ var PopperContent = React.forwardRef(
|
|
|
127
127
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
128
128
|
strategy: "fixed",
|
|
129
129
|
placement: desiredPlacement,
|
|
130
|
-
whileElementsMounted: (...args) => {
|
|
130
|
+
whileElementsMounted: /* @__PURE__ */ __name((...args) => {
|
|
131
131
|
const cleanup = autoUpdate(...args, {
|
|
132
132
|
animationFrame: updatePositionStrategy === "always"
|
|
133
133
|
});
|
|
134
134
|
return cleanup;
|
|
135
|
-
},
|
|
135
|
+
}, "whileElementsMounted"),
|
|
136
136
|
elements: {
|
|
137
137
|
reference: context.anchor
|
|
138
138
|
},
|
|
@@ -147,14 +147,14 @@ var PopperContent = React.forwardRef(
|
|
|
147
147
|
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
148
148
|
size({
|
|
149
149
|
...detectOverflowOptions,
|
|
150
|
-
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
150
|
+
apply: /* @__PURE__ */ __name(({ elements, rects, availableWidth, availableHeight }) => {
|
|
151
151
|
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
152
152
|
const contentStyle = elements.floating.style;
|
|
153
153
|
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
154
154
|
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
155
155
|
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
156
156
|
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
157
|
-
}
|
|
157
|
+
}, "apply")
|
|
158
158
|
}),
|
|
159
159
|
arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),
|
|
160
160
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
@@ -246,9 +246,8 @@ var PopperContent = React.forwardRef(
|
|
|
246
246
|
)
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
|
-
}
|
|
249
|
+
}, "PopperContent")
|
|
250
250
|
);
|
|
251
|
-
PopperContent.displayName = CONTENT_NAME;
|
|
252
251
|
var ARROW_NAME = "PopperArrow";
|
|
253
252
|
var OPPOSITE_SIDE = {
|
|
254
253
|
top: "bottom",
|
|
@@ -256,58 +255,62 @@ var OPPOSITE_SIDE = {
|
|
|
256
255
|
bottom: "top",
|
|
257
256
|
left: "right"
|
|
258
257
|
};
|
|
259
|
-
var PopperArrow = React.forwardRef(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
top:
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
...arrowProps
|
|
297
|
-
|
|
298
|
-
|
|
258
|
+
var PopperArrow = /* @__PURE__ */ React.forwardRef(
|
|
259
|
+
// ignore prettier to reduce diff noise
|
|
260
|
+
// prettier-ignore
|
|
261
|
+
/* @__PURE__ */ __name(function PopperArrow2(props, forwardedRef) {
|
|
262
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
263
|
+
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
264
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
265
|
+
return (
|
|
266
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
267
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
268
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
269
|
+
/* @__PURE__ */ jsx(
|
|
270
|
+
"span",
|
|
271
|
+
{
|
|
272
|
+
ref: contentContext.onArrowChange,
|
|
273
|
+
style: {
|
|
274
|
+
position: "absolute",
|
|
275
|
+
left: contentContext.arrowX,
|
|
276
|
+
top: contentContext.arrowY,
|
|
277
|
+
[baseSide]: 0,
|
|
278
|
+
transformOrigin: {
|
|
279
|
+
top: "",
|
|
280
|
+
right: "0 0",
|
|
281
|
+
bottom: "center 0",
|
|
282
|
+
left: "100% 0"
|
|
283
|
+
}[contentContext.placedSide],
|
|
284
|
+
transform: {
|
|
285
|
+
top: "translateY(100%)",
|
|
286
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
287
|
+
bottom: `rotate(180deg)`,
|
|
288
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
289
|
+
}[contentContext.placedSide],
|
|
290
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
291
|
+
},
|
|
292
|
+
children: /* @__PURE__ */ jsx(
|
|
293
|
+
ArrowPrimitive.Root,
|
|
294
|
+
{
|
|
295
|
+
...arrowProps,
|
|
296
|
+
ref: forwardedRef,
|
|
297
|
+
style: {
|
|
298
|
+
...arrowProps.style,
|
|
299
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
300
|
+
display: "block"
|
|
301
|
+
}
|
|
299
302
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
)
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
PopperArrow.displayName = ARROW_NAME;
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
}, "PopperArrow")
|
|
308
|
+
);
|
|
307
309
|
function isNotNull(value) {
|
|
308
310
|
return value !== null;
|
|
309
311
|
}
|
|
310
|
-
|
|
312
|
+
__name(isNotNull, "isNotNull");
|
|
313
|
+
var transformOrigin = /* @__PURE__ */ __name((options) => ({
|
|
311
314
|
name: "transformOrigin",
|
|
312
315
|
options,
|
|
313
316
|
fn(data) {
|
|
@@ -337,11 +340,12 @@ var transformOrigin = (options) => ({
|
|
|
337
340
|
}
|
|
338
341
|
return { data: { x, y } };
|
|
339
342
|
}
|
|
340
|
-
});
|
|
343
|
+
}), "transformOrigin");
|
|
341
344
|
function getSideAndAlignFromPlacement(placement) {
|
|
342
345
|
const [side, align = "center"] = placement.split("-");
|
|
343
346
|
return [side, align];
|
|
344
347
|
}
|
|
348
|
+
__name(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
|
|
345
349
|
var Root2 = Popper;
|
|
346
350
|
var Anchor = PopperAnchor;
|
|
347
351
|
var Content = PopperContent;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/popper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size,\n} from '@floating-ui/react-dom';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type { Placement, Middleware } from '@floating-ui/react-dom';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Measurable } from '@radix-ui/rect';\n\nconst SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;\nconst ALIGN_OPTIONS = ['start', 'center', 'end'] as const;\n\ntype Side = (typeof SIDE_OPTIONS)[number];\ntype Align = (typeof ALIGN_OPTIONS)[number];\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 placementState: Placement | undefined;\n setPlacementState: React.Dispatch<React.SetStateAction<Placement | undefined>>;\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 const [placementState, setPlacementState] = React.useState<Placement | undefined>(undefined);\n return (\n <PopperProvider\n scope={__scopePopper}\n anchor={anchor}\n onAnchorChange={setAnchor}\n placementState={placementState}\n setPlacementState={setPlacementState}\n >\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.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.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 onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef<Measurable | null>(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n <Primitive.div\n data-radix-popper-side={placedSide}\n data-radix-popper-align={placedAlign}\n {...anchorProps}\n ref={composedRefs}\n />\n );\n },\n);\n\nPopperAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number;\n arrowY?: number;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n arrowPadding?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Boundary | Boundary[];\n collisionPadding?: number | Partial<Record<Side, number>>;\n sticky?: 'partial' | 'always';\n hideWhenDetached?: boolean;\n updatePositionStrategy?: 'optimized' | 'always';\n onPlaced?: () => void;\n}\n\nconst PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>(\n (props: ScopedProps<PopperContentProps>, forwardedRef) => {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = 'partial',\n hideWhenDetached = false,\n updatePositionStrategy = 'optimized',\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === 'always',\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n limiter: sticky === 'partial' ? limitShift() : undefined,\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n hide({\n strategy: 'referenceHidden',\n ...detectOverflowOptions,\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we fall back to Floating\n // UI's default clipping ancestors (e.g. a scrollable menu). This\n // lets an occluded submenu hide once its anchor scrolls out of view\n // (#3237). The collision/size middlewares deliberately keep the\n // viewport-based default to avoid clamping content rendered inside\n // transformed or overflow-clipping portal containers.\n boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : undefined,\n }),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\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\n ref={refs.setFloating}\n data-radix-popper-content-wrapper=\"\"\n style={{\n ...floatingStyles,\n transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)', // keep off the page when measuring\n minWidth: 'max-content',\n zIndex: contentZIndex,\n '--radix-popper-transform-origin': [\n middlewareData.transformOrigin?.x,\n middlewareData.transformOrigin?.y,\n ].join(' '),\n\n // hide the content if using the hide middleware and should be hidden\n // set visibility to hidden and disable pointer events so the UI behaves\n // as if the PopperContent isn't there at all\n ...(middlewareData.hide?.referenceHidden && {\n visibility: 'hidden',\n pointerEvents: 'none',\n }),\n }}\n // Floating UI interally calculates logical alignment based the `dir` attribute on\n // the reference/floating node, we must add this attribute here to ensure\n // this is calculated when portalled as well as inline.\n dir={props.dir}\n >\n <PopperContentProvider\n scope={__scopePopper}\n placedSide={placedSide}\n placedAlign={placedAlign}\n onArrowChange={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n shouldHideArrow={cannotCenterArrow}\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: !isPositioned ? '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\nconst OPPOSITE_SIDE: Record<Side, Side> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ntype PopperArrowElement = React.ComponentRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {}\n\nconst PopperArrow = React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(\n props: ScopedProps<PopperArrowProps>,\n forwardedRef,\n) {\n const { __scopePopper, ...arrowProps } = props;\n const contentContext = useContentContext(ARROW_NAME, __scopePopper);\n const baseSide = OPPOSITE_SIDE[contentContext.placedSide];\n\n return (\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 <span\n ref={contentContext.onArrowChange}\n style={{\n position: 'absolute',\n left: contentContext.arrowX,\n top: contentContext.arrowY,\n [baseSide]: 0,\n transformOrigin: {\n top: '',\n right: '0 0',\n bottom: 'center 0',\n left: '100% 0',\n }[contentContext.placedSide],\n transform: {\n top: 'translateY(100%)',\n right: 'translateY(50%) rotate(90deg) translateX(-50%)',\n bottom: `rotate(180deg)`,\n left: 'translateY(50%) rotate(-90deg) translateX(50%)',\n }[contentContext.placedSide],\n visibility: contentContext.shouldHideArrow ? 'hidden' : undefined,\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 );\n});\n\nPopperArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction isNotNull<T>(value: T | null): value is T {\n return value !== null;\n}\n\nconst transformOrigin = (options: { arrowWidth: number; arrowHeight: number }): Middleware => ({\n name: 'transformOrigin',\n options,\n fn(data) {\n const { placement, rects, middlewareData } = data;\n\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const isArrowHidden = cannotCenterArrow;\n const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;\n const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const noArrowAlign = { start: '0%', center: '50%', end: '100%' }[placedAlign];\n\n const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;\n const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;\n\n let x = '';\n let y = '';\n\n if (placedSide === 'bottom') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${-arrowHeight}px`;\n } else if (placedSide === 'top') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${rects.floating.height + arrowHeight}px`;\n } else if (placedSide === 'right') {\n x = `${-arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n } else if (placedSide === 'left') {\n x = `${rects.floating.width + arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n }\n return { data: { x, y } };\n },\n});\n\nfunction getSideAndAlignFromPlacement(placement: Placement) {\n const [side, align = 'center'] = placement.split('-');\n return [side as Side, align as Align] as const;\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 //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["PopperArrow", "Root"]
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size,\n} from '@floating-ui/react-dom';\nimport * as ArrowPrimitive from '@radix-ui/react-arrow';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useSize } from '@radix-ui/react-use-size';\n\nimport type { Placement, Middleware } from '@floating-ui/react-dom';\nimport type { Scope } from '@radix-ui/react-context';\nimport type { Measurable } from '@radix-ui/rect';\n\nconst SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;\nconst ALIGN_OPTIONS = ['start', 'center', 'end'] as const;\n\ntype Side = (typeof SIDE_OPTIONS)[number];\ntype Align = (typeof ALIGN_OPTIONS)[number];\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 placementState: Placement | undefined;\n setPlacementState: React.Dispatch<React.SetStateAction<Placement | undefined>>;\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 const [placementState, setPlacementState] = React.useState<Placement | undefined>(undefined);\n return (\n <PopperProvider\n scope={__scopePopper}\n anchor={anchor}\n onAnchorChange={setAnchor}\n placementState={placementState}\n setPlacementState={setPlacementState}\n >\n {children}\n </PopperProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopperAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopperAnchor';\n\ntype PopperAnchorElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PopperAnchorProps extends PrimitiveDivProps {\n virtualRef?: React.RefObject<Measurable | null>;\n}\n\nconst PopperAnchor = /* @__PURE__ */ React.forwardRef<PopperAnchorElement, PopperAnchorProps>(\n function PopperAnchor(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 onAnchorChange = context.onAnchorChange;\n\n // For DOM anchors, set the anchor from a callback ref rather than an\n // effect. React invokes callback refs during the commit phase which does\n // not count toward the nested update depth limit, so mounting many\n // Popper-based components at once doesn't trigger \"Maximum update depth\n // exceeded\"\n // see https://github.com/radix-ui/primitives/issues/3858\n const callbackRef = React.useCallback(\n (node: PopperAnchorElement | null) => {\n ref.current = node;\n if (node) {\n onAnchorChange(node);\n }\n },\n [onAnchorChange],\n );\n const composedRefs = useComposedRefs(forwardedRef, callbackRef);\n\n const anchorRef = React.useRef<Measurable | null>(null);\n React.useEffect(() => {\n if (!virtualRef) {\n return;\n }\n\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef.current;\n if (previousAnchor !== anchorRef.current) {\n onAnchorChange(anchorRef.current);\n }\n });\n\n const sideAndAlign =\n context.placementState && getSideAndAlignFromPlacement(context.placementState);\n const placedSide = sideAndAlign?.[0];\n const placedAlign = sideAndAlign?.[1];\n\n return virtualRef ? null : (\n <Primitive.div\n data-radix-popper-side={placedSide}\n data-radix-popper-align={placedAlign}\n {...anchorProps}\n ref={composedRefs}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopperContent';\n\ntype PopperContentContextValue = {\n placedSide: Side;\n placedAlign: Align;\n onArrowChange(arrow: HTMLSpanElement | null): void;\n arrowX?: number;\n arrowY?: number;\n shouldHideArrow: boolean;\n};\n\nconst [PopperContentProvider, useContentContext] =\n createPopperContext<PopperContentContextValue>(CONTENT_NAME);\n\ntype Boundary = Element | null;\n\ntype PopperContentElement = React.ComponentRef<typeof Primitive.div>;\ninterface PopperContentProps extends PrimitiveDivProps {\n side?: Side;\n sideOffset?: number;\n align?: Align;\n alignOffset?: number;\n arrowPadding?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Boundary | Boundary[];\n collisionPadding?: number | Partial<Record<Side, number>>;\n sticky?: 'partial' | 'always';\n hideWhenDetached?: boolean;\n updatePositionStrategy?: 'optimized' | 'always';\n onPlaced?: () => void;\n}\n\nconst PopperContent = /* @__PURE__ */ React.forwardRef<PopperContentElement, PopperContentProps>(\n function PopperContent(props: ScopedProps<PopperContentProps>, forwardedRef) {\n const {\n __scopePopper,\n side = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = 'partial',\n hideWhenDetached = false,\n updatePositionStrategy = 'optimized',\n onPlaced,\n ...contentProps\n } = props;\n\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n\n const [content, setContent] = React.useState<HTMLDivElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContent);\n\n const [arrow, setArrow] = React.useState<HTMLSpanElement | null>(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n\n const desiredPlacement = (side + (align !== 'center' ? '-' + align : '')) as Placement;\n\n const collisionPadding =\n typeof collisionPaddingProp === 'number'\n ? collisionPaddingProp\n : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries,\n };\n\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: 'fixed',\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === 'always',\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor,\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions &&\n shift({\n mainAxis: true,\n crossAxis: false,\n limiter: sticky === 'partial' ? limitShift() : undefined,\n ...detectOverflowOptions,\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);\n contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);\n contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);\n contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);\n },\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached &&\n hide({\n strategy: 'referenceHidden',\n ...detectOverflowOptions,\n // `hide` detects whether the anchor (reference) is clipped, so when\n // no explicit `collisionBoundary` is set we fall back to Floating\n // UI's default clipping ancestors (e.g. a scrollable menu). This\n // lets an occluded submenu hide once its anchor scrolls out of view\n // (#3237). The collision/size middlewares deliberately keep the\n // viewport-based default to avoid clamping content rendered inside\n // transformed or overflow-clipping portal containers.\n boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : undefined,\n }),\n ],\n });\n\n const setPlacementState = context.setPlacementState;\n useLayoutEffect(() => {\n setPlacementState(placement);\n return () => {\n setPlacementState(undefined);\n };\n }, [placement, setPlacementState]);\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\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\n ref={refs.setFloating}\n data-radix-popper-content-wrapper=\"\"\n style={{\n ...floatingStyles,\n transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)', // keep off the page when measuring\n minWidth: 'max-content',\n zIndex: contentZIndex,\n '--radix-popper-transform-origin': [\n middlewareData.transformOrigin?.x,\n middlewareData.transformOrigin?.y,\n ].join(' '),\n\n // hide the content if using the hide middleware and should be hidden\n // set visibility to hidden and disable pointer events so the UI behaves\n // as if the PopperContent isn't there at all\n ...(middlewareData.hide?.referenceHidden && {\n visibility: 'hidden',\n pointerEvents: 'none',\n }),\n }}\n // Floating UI interally calculates logical alignment based the `dir` attribute on\n // the reference/floating node, we must add this attribute here to ensure\n // this is calculated when portalled as well as inline.\n dir={props.dir}\n >\n <PopperContentProvider\n scope={__scopePopper}\n placedSide={placedSide}\n placedAlign={placedAlign}\n onArrowChange={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n shouldHideArrow={cannotCenterArrow}\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: !isPositioned ? 'none' : undefined,\n }}\n />\n </PopperContentProvider>\n </div>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopperArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopperArrow';\n\nconst OPPOSITE_SIDE: Record<Side, Side> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ntype PopperArrowElement = React.ComponentRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;\ninterface PopperArrowProps extends ArrowProps {}\n\nconst PopperArrow = /* @__PURE__ */ React.forwardRef<PopperArrowElement, PopperArrowProps>(\n // ignore prettier to reduce diff noise\n // prettier-ignore\n function PopperArrow(props: ScopedProps<PopperArrowProps>, forwardedRef) {\n const { __scopePopper, ...arrowProps } = props;\n const contentContext = useContentContext(ARROW_NAME, __scopePopper);\n const baseSide = OPPOSITE_SIDE[contentContext.placedSide];\n\n return (\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 <span\n ref={contentContext.onArrowChange}\n style={{\n position: 'absolute',\n left: contentContext.arrowX,\n top: contentContext.arrowY,\n [baseSide]: 0,\n transformOrigin: {\n top: '',\n right: '0 0',\n bottom: 'center 0',\n left: '100% 0',\n }[contentContext.placedSide],\n transform: {\n top: 'translateY(100%)',\n right: 'translateY(50%) rotate(90deg) translateX(-50%)',\n bottom: `rotate(180deg)`,\n left: 'translateY(50%) rotate(-90deg) translateX(50%)',\n }[contentContext.placedSide],\n visibility: contentContext.shouldHideArrow ? 'hidden' : undefined,\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 );\n},\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction isNotNull<T>(value: T | null): value is T {\n return value !== null;\n}\n\nconst transformOrigin = (options: { arrowWidth: number; arrowHeight: number }): Middleware => ({\n name: 'transformOrigin',\n options,\n fn(data) {\n const { placement, rects, middlewareData } = data;\n\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const isArrowHidden = cannotCenterArrow;\n const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;\n const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;\n\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const noArrowAlign = { start: '0%', center: '50%', end: '100%' }[placedAlign];\n\n const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;\n const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;\n\n let x = '';\n let y = '';\n\n if (placedSide === 'bottom') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${-arrowHeight}px`;\n } else if (placedSide === 'top') {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${rects.floating.height + arrowHeight}px`;\n } else if (placedSide === 'right') {\n x = `${-arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n } else if (placedSide === 'left') {\n x = `${rects.floating.width + arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n }\n return { data: { x, y } };\n },\n});\n\nfunction getSideAndAlignFromPlacement(placement: Placement) {\n const [side, align = 'center'] = placement.split('-');\n return [side as Side, align as Align] as const;\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 //\n SIDE_OPTIONS,\n ALIGN_OPTIONS,\n};\nexport type { PopperProps, PopperAnchorProps, PopperContentProps, PopperArrowProps };\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACK;AACP,YAAY,oBAAoB;AAChC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAqCpB;AA/BJ,IAAM,eAAe,CAAC,OAAO,SAAS,UAAU,MAAM;AACtD,IAAM,gBAAgB,CAAC,SAAS,UAAU,KAAK;AAS/C,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,IAAI,mBAAmB,WAAW;AAQ/E,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAK9F,IAAM,SAAgC,wBAAC,UAAoC;AACzE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
+
"names": ["PopperAnchor", "PopperContent", "PopperArrow", "Root"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-popper",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4-rc.1784074599772",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@floating-ui/react-dom": "^2.0.0",
|
|
15
|
-
"@radix-ui/react-arrow": "1.1.
|
|
16
|
-
"@radix-ui/react-compose-refs": "1.1.3",
|
|
15
|
+
"@radix-ui/react-arrow": "1.1.12-rc.1784074599772",
|
|
17
16
|
"@radix-ui/react-context": "1.2.0",
|
|
17
|
+
"@radix-ui/react-compose-refs": "1.1.3",
|
|
18
18
|
"@radix-ui/react-primitive": "2.1.7",
|
|
19
19
|
"@radix-ui/react-use-callback-ref": "1.1.2",
|
|
20
20
|
"@radix-ui/react-use-layout-effect": "1.1.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react": "^19.2.0",
|
|
29
29
|
"react-dom": "^19.2.0",
|
|
30
30
|
"typescript": "^5.9.3",
|
|
31
|
-
"@repo/builder": "0.0.
|
|
31
|
+
"@repo/builder": "0.0.1-rc.1784074599772",
|
|
32
32
|
"@repo/test-utils": "0.0.0",
|
|
33
33
|
"@repo/typescript-config": "0.0.0"
|
|
34
34
|
},
|