@radix-ui/react-popper 1.2.0-rc.2 → 1.2.0-rc.4

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 CHANGED
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import * as ArrowPrimitive from '@radix-ui/react-arrow';
3
- import * as Radix from '@radix-ui/react-primitive';
4
3
  import { Primitive } from '@radix-ui/react-primitive';
5
4
  import { Measurable } from '@radix-ui/rect';
6
5
 
7
- declare type Scope<C = any> = {
6
+ type Scope<C = any> = {
8
7
  [scopeName: string]: React.Context<C>[];
9
8
  } | undefined;
10
- declare type ScopeHook = (scope: Scope) => {
9
+ type ScopeHook = (scope: Scope) => {
11
10
  [__scopeProp: string]: Scope;
12
11
  };
13
12
  interface CreateScope {
@@ -17,19 +16,19 @@ interface CreateScope {
17
16
 
18
17
  declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"];
19
18
  declare const ALIGN_OPTIONS: readonly ["start", "center", "end"];
20
- declare type Side = typeof SIDE_OPTIONS[number];
21
- declare type Align = typeof ALIGN_OPTIONS[number];
19
+ type Side = (typeof SIDE_OPTIONS)[number];
20
+ type Align = (typeof ALIGN_OPTIONS)[number];
22
21
  declare const createPopperScope: CreateScope;
23
22
  interface PopperProps {
24
23
  children?: React.ReactNode;
25
24
  }
26
25
  declare const Popper: React.FC<PopperProps>;
27
- declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
26
+ type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
28
27
  interface PopperAnchorProps extends PrimitiveDivProps {
29
28
  virtualRef?: React.RefObject<Measurable>;
30
29
  }
31
30
  declare const PopperAnchor: React.ForwardRefExoticComponent<PopperAnchorProps & React.RefAttributes<HTMLDivElement>>;
32
- declare type Boundary = Element | null;
31
+ type Boundary = Element | null;
33
32
  interface PopperContentProps extends PrimitiveDivProps {
34
33
  side?: Side;
35
34
  sideOffset?: number;
@@ -45,7 +44,7 @@ interface PopperContentProps extends PrimitiveDivProps {
45
44
  onPlaced?: () => void;
46
45
  }
47
46
  declare const PopperContent: React.ForwardRefExoticComponent<PopperContentProps & React.RefAttributes<HTMLDivElement>>;
48
- declare type ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;
47
+ type ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;
49
48
  interface PopperArrowProps extends ArrowProps {
50
49
  }
51
50
  declare const PopperArrow: React.ForwardRefExoticComponent<PopperArrowProps & React.RefAttributes<SVGSVGElement>>;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import * as ArrowPrimitive from '@radix-ui/react-arrow';
3
- import * as Radix from '@radix-ui/react-primitive';
4
3
  import { Primitive } from '@radix-ui/react-primitive';
5
4
  import { Measurable } from '@radix-ui/rect';
6
5
 
7
- declare type Scope<C = any> = {
6
+ type Scope<C = any> = {
8
7
  [scopeName: string]: React.Context<C>[];
9
8
  } | undefined;
10
- declare type ScopeHook = (scope: Scope) => {
9
+ type ScopeHook = (scope: Scope) => {
11
10
  [__scopeProp: string]: Scope;
12
11
  };
13
12
  interface CreateScope {
@@ -17,19 +16,19 @@ interface CreateScope {
17
16
 
18
17
  declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"];
19
18
  declare const ALIGN_OPTIONS: readonly ["start", "center", "end"];
20
- declare type Side = typeof SIDE_OPTIONS[number];
21
- declare type Align = typeof ALIGN_OPTIONS[number];
19
+ type Side = (typeof SIDE_OPTIONS)[number];
20
+ type Align = (typeof ALIGN_OPTIONS)[number];
22
21
  declare const createPopperScope: CreateScope;
23
22
  interface PopperProps {
24
23
  children?: React.ReactNode;
25
24
  }
26
25
  declare const Popper: React.FC<PopperProps>;
27
- declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
26
+ type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
28
27
  interface PopperAnchorProps extends PrimitiveDivProps {
29
28
  virtualRef?: React.RefObject<Measurable>;
30
29
  }
31
30
  declare const PopperAnchor: React.ForwardRefExoticComponent<PopperAnchorProps & React.RefAttributes<HTMLDivElement>>;
32
- declare type Boundary = Element | null;
31
+ type Boundary = Element | null;
33
32
  interface PopperContentProps extends PrimitiveDivProps {
34
33
  side?: Side;
35
34
  sideOffset?: number;
@@ -45,7 +44,7 @@ interface PopperContentProps extends PrimitiveDivProps {
45
44
  onPlaced?: () => void;
46
45
  }
47
46
  declare const PopperContent: React.ForwardRefExoticComponent<PopperContentProps & React.RefAttributes<HTMLDivElement>>;
48
- declare type ArrowProps = Radix.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;
47
+ type ArrowProps = React.ComponentPropsWithoutRef<typeof ArrowPrimitive.Root>;
49
48
  interface PopperArrowProps extends ArrowProps {
50
49
  }
51
50
  declare const PopperArrow: React.ForwardRefExoticComponent<PopperArrowProps & React.RefAttributes<SVGSVGElement>>;
package/dist/index.js CHANGED
@@ -1,311 +1,325 @@
1
1
  "use strict";
2
2
  "use client";
3
- (() => {
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
30
 
33
- // packages/react/popper/src/Popper.tsx
34
- var React = __toESM(__require("react"));
35
- var import_react_dom = __require("@floating-ui/react-dom");
36
- var ArrowPrimitive = __toESM(__require("@radix-ui/react-arrow"));
37
- var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
38
- var import_react_context = __require("@radix-ui/react-context");
39
- var import_react_primitive = __require("@radix-ui/react-primitive");
40
- var import_react_use_callback_ref = __require("@radix-ui/react-use-callback-ref");
41
- var import_react_use_layout_effect = __require("@radix-ui/react-use-layout-effect");
42
- var import_react_use_size = __require("@radix-ui/react-use-size");
43
- var import_jsx_runtime = __require("react/jsx-runtime");
44
- var SIDE_OPTIONS = ["top", "right", "bottom", "left"];
45
- var ALIGN_OPTIONS = ["start", "center", "end"];
46
- var POPPER_NAME = "Popper";
47
- var [createPopperContext, createPopperScope] = (0, import_react_context.createContextScope)(POPPER_NAME);
48
- var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
49
- var Popper = (props) => {
50
- const { __scopePopper, children } = props;
51
- const [anchor, setAnchor] = React.useState(null);
52
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
53
- };
54
- Popper.displayName = POPPER_NAME;
55
- var ANCHOR_NAME = "PopperAnchor";
56
- var PopperAnchor = React.forwardRef(
57
- (props, forwardedRef) => {
58
- const { __scopePopper, virtualRef, ...anchorProps } = props;
59
- const context = usePopperContext(ANCHOR_NAME, __scopePopper);
60
- const ref = React.useRef(null);
61
- const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
62
- React.useEffect(() => {
63
- context.onAnchorChange(virtualRef?.current || ref.current);
64
- });
65
- return virtualRef ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...anchorProps, ref: composedRefs });
66
- }
67
- );
68
- PopperAnchor.displayName = ANCHOR_NAME;
69
- var CONTENT_NAME = "PopperContent";
70
- var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
71
- var PopperContent = React.forwardRef(
72
- (props, forwardedRef) => {
73
- const {
74
- __scopePopper,
75
- side = "bottom",
76
- sideOffset = 0,
77
- align = "center",
78
- alignOffset = 0,
79
- arrowPadding = 0,
80
- avoidCollisions = true,
81
- collisionBoundary = [],
82
- collisionPadding: collisionPaddingProp = 0,
83
- sticky = "partial",
84
- hideWhenDetached = false,
85
- updatePositionStrategy = "optimized",
86
- onPlaced,
87
- ...contentProps
88
- } = props;
89
- const context = usePopperContext(CONTENT_NAME, __scopePopper);
90
- const [content, setContent] = React.useState(null);
91
- const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setContent(node));
92
- const [arrow, setArrow] = React.useState(null);
93
- const arrowSize = (0, import_react_use_size.useSize)(arrow);
94
- const arrowWidth = arrowSize?.width ?? 0;
95
- const arrowHeight = arrowSize?.height ?? 0;
96
- const desiredPlacement = side + (align !== "center" ? "-" + align : "");
97
- const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
98
- const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
99
- const hasExplicitBoundaries = boundary.length > 0;
100
- const detectOverflowOptions = {
101
- padding: collisionPadding,
102
- boundary: boundary.filter(isNotNull),
103
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
104
- altBoundary: hasExplicitBoundaries
105
- };
106
- const { refs, floatingStyles, placement, isPositioned, middlewareData } = (0, import_react_dom.useFloating)({
107
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
108
- strategy: "fixed",
109
- placement: desiredPlacement,
110
- whileElementsMounted: (...args) => {
111
- const cleanup = (0, import_react_dom.autoUpdate)(...args, {
112
- animationFrame: updatePositionStrategy === "always"
113
- });
114
- return cleanup;
115
- },
116
- elements: {
117
- reference: context.anchor
31
+ // packages/react/popper/src/index.ts
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ ALIGN_OPTIONS: () => ALIGN_OPTIONS,
35
+ Anchor: () => Anchor,
36
+ Arrow: () => Arrow,
37
+ Content: () => Content,
38
+ Popper: () => Popper,
39
+ PopperAnchor: () => PopperAnchor,
40
+ PopperArrow: () => PopperArrow,
41
+ PopperContent: () => PopperContent,
42
+ Root: () => Root2,
43
+ SIDE_OPTIONS: () => SIDE_OPTIONS,
44
+ createPopperScope: () => createPopperScope
45
+ });
46
+ module.exports = __toCommonJS(src_exports);
47
+
48
+ // packages/react/popper/src/Popper.tsx
49
+ var React = __toESM(require("react"));
50
+ var import_react_dom = require("@floating-ui/react-dom");
51
+ var ArrowPrimitive = __toESM(require("@radix-ui/react-arrow"));
52
+ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
53
+ var import_react_context = require("@radix-ui/react-context");
54
+ var import_react_primitive = require("@radix-ui/react-primitive");
55
+ var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
56
+ var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
57
+ var import_react_use_size = require("@radix-ui/react-use-size");
58
+ var import_jsx_runtime = require("react/jsx-runtime");
59
+ var SIDE_OPTIONS = ["top", "right", "bottom", "left"];
60
+ var ALIGN_OPTIONS = ["start", "center", "end"];
61
+ var POPPER_NAME = "Popper";
62
+ var [createPopperContext, createPopperScope] = (0, import_react_context.createContextScope)(POPPER_NAME);
63
+ var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
64
+ var Popper = (props) => {
65
+ const { __scopePopper, children } = props;
66
+ const [anchor, setAnchor] = React.useState(null);
67
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
68
+ };
69
+ Popper.displayName = POPPER_NAME;
70
+ var ANCHOR_NAME = "PopperAnchor";
71
+ var PopperAnchor = React.forwardRef(
72
+ (props, forwardedRef) => {
73
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
74
+ const context = usePopperContext(ANCHOR_NAME, __scopePopper);
75
+ const ref = React.useRef(null);
76
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
77
+ React.useEffect(() => {
78
+ context.onAnchorChange(virtualRef?.current || ref.current);
79
+ });
80
+ return virtualRef ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...anchorProps, ref: composedRefs });
81
+ }
82
+ );
83
+ PopperAnchor.displayName = ANCHOR_NAME;
84
+ var CONTENT_NAME = "PopperContent";
85
+ var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
86
+ var PopperContent = React.forwardRef(
87
+ (props, forwardedRef) => {
88
+ const {
89
+ __scopePopper,
90
+ side = "bottom",
91
+ sideOffset = 0,
92
+ align = "center",
93
+ alignOffset = 0,
94
+ arrowPadding = 0,
95
+ avoidCollisions = true,
96
+ collisionBoundary = [],
97
+ collisionPadding: collisionPaddingProp = 0,
98
+ sticky = "partial",
99
+ hideWhenDetached = false,
100
+ updatePositionStrategy = "optimized",
101
+ onPlaced,
102
+ ...contentProps
103
+ } = props;
104
+ const context = usePopperContext(CONTENT_NAME, __scopePopper);
105
+ const [content, setContent] = React.useState(null);
106
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setContent(node));
107
+ const [arrow, setArrow] = React.useState(null);
108
+ const arrowSize = (0, import_react_use_size.useSize)(arrow);
109
+ const arrowWidth = arrowSize?.width ?? 0;
110
+ const arrowHeight = arrowSize?.height ?? 0;
111
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
112
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
113
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
114
+ const hasExplicitBoundaries = boundary.length > 0;
115
+ const detectOverflowOptions = {
116
+ padding: collisionPadding,
117
+ boundary: boundary.filter(isNotNull),
118
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
119
+ altBoundary: hasExplicitBoundaries
120
+ };
121
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = (0, import_react_dom.useFloating)({
122
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
123
+ strategy: "fixed",
124
+ placement: desiredPlacement,
125
+ whileElementsMounted: (...args) => {
126
+ const cleanup = (0, import_react_dom.autoUpdate)(...args, {
127
+ animationFrame: updatePositionStrategy === "always"
128
+ });
129
+ return cleanup;
130
+ },
131
+ elements: {
132
+ reference: context.anchor
133
+ },
134
+ middleware: [
135
+ (0, import_react_dom.offset)({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
136
+ avoidCollisions && (0, import_react_dom.shift)({
137
+ mainAxis: true,
138
+ crossAxis: false,
139
+ limiter: sticky === "partial" ? (0, import_react_dom.limitShift)() : void 0,
140
+ ...detectOverflowOptions
141
+ }),
142
+ avoidCollisions && (0, import_react_dom.flip)({ ...detectOverflowOptions }),
143
+ (0, import_react_dom.size)({
144
+ ...detectOverflowOptions,
145
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
146
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
147
+ const contentStyle = elements.floating.style;
148
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
149
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
150
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
151
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
152
+ }
153
+ }),
154
+ arrow && (0, import_react_dom.arrow)({ element: arrow, padding: arrowPadding }),
155
+ transformOrigin({ arrowWidth, arrowHeight }),
156
+ hideWhenDetached && (0, import_react_dom.hide)({ strategy: "referenceHidden", ...detectOverflowOptions })
157
+ ]
158
+ });
159
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
160
+ const handlePlaced = (0, import_react_use_callback_ref.useCallbackRef)(onPlaced);
161
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
162
+ if (isPositioned) {
163
+ handlePlaced?.();
164
+ }
165
+ }, [isPositioned, handlePlaced]);
166
+ const arrowX = middlewareData.arrow?.x;
167
+ const arrowY = middlewareData.arrow?.y;
168
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
169
+ const [contentZIndex, setContentZIndex] = React.useState();
170
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
171
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
172
+ }, [content]);
173
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
174
+ "div",
175
+ {
176
+ ref: refs.setFloating,
177
+ "data-radix-popper-content-wrapper": "",
178
+ style: {
179
+ ...floatingStyles,
180
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
181
+ // keep off the page when measuring
182
+ minWidth: "max-content",
183
+ zIndex: contentZIndex,
184
+ ["--radix-popper-transform-origin"]: [
185
+ middlewareData.transformOrigin?.x,
186
+ middlewareData.transformOrigin?.y
187
+ ].join(" "),
188
+ // hide the content if using the hide middleware and should be hidden
189
+ // set visibility to hidden and disable pointer events so the UI behaves
190
+ // as if the PopperContent isn't there at all
191
+ ...middlewareData.hide?.referenceHidden && {
192
+ visibility: "hidden",
193
+ pointerEvents: "none"
194
+ }
118
195
  },
119
- middleware: [
120
- (0, import_react_dom.offset)({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
121
- avoidCollisions && (0, import_react_dom.shift)({
122
- mainAxis: true,
123
- crossAxis: false,
124
- limiter: sticky === "partial" ? (0, import_react_dom.limitShift)() : void 0,
125
- ...detectOverflowOptions
126
- }),
127
- avoidCollisions && (0, import_react_dom.flip)({ ...detectOverflowOptions }),
128
- (0, import_react_dom.size)({
129
- ...detectOverflowOptions,
130
- apply: ({ elements, rects, availableWidth, availableHeight }) => {
131
- const { width: anchorWidth, height: anchorHeight } = rects.reference;
132
- const contentStyle = elements.floating.style;
133
- contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
134
- contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
135
- contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
136
- contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
137
- }
138
- }),
139
- arrow && (0, import_react_dom.arrow)({ element: arrow, padding: arrowPadding }),
140
- transformOrigin({ arrowWidth, arrowHeight }),
141
- hideWhenDetached && (0, import_react_dom.hide)({ strategy: "referenceHidden", ...detectOverflowOptions })
142
- ]
143
- });
144
- const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
145
- const handlePlaced = (0, import_react_use_callback_ref.useCallbackRef)(onPlaced);
146
- (0, import_react_use_layout_effect.useLayoutEffect)(() => {
147
- if (isPositioned) {
148
- handlePlaced?.();
149
- }
150
- }, [isPositioned, handlePlaced]);
151
- const arrowX = middlewareData.arrow?.x;
152
- const arrowY = middlewareData.arrow?.y;
153
- const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
154
- const [contentZIndex, setContentZIndex] = React.useState();
155
- (0, import_react_use_layout_effect.useLayoutEffect)(() => {
156
- if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
157
- }, [content]);
158
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
- "div",
160
- {
161
- ref: refs.setFloating,
162
- "data-radix-popper-content-wrapper": "",
163
- style: {
164
- ...floatingStyles,
165
- transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
166
- // keep off the page when measuring
167
- minWidth: "max-content",
168
- zIndex: contentZIndex,
169
- ["--radix-popper-transform-origin"]: [
170
- middlewareData.transformOrigin?.x,
171
- middlewareData.transformOrigin?.y
172
- ].join(" "),
173
- // hide the content if using the hide middleware and should be hidden
174
- // set visibility to hidden and disable pointer events so the UI behaves
175
- // as if the PopperContent isn't there at all
176
- ...middlewareData.hide?.referenceHidden && {
177
- visibility: "hidden",
178
- pointerEvents: "none"
179
- }
180
- },
181
- dir: props.dir,
182
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
- PopperContentProvider,
184
- {
185
- scope: __scopePopper,
186
- placedSide,
187
- onArrowChange: setArrow,
188
- arrowX,
189
- arrowY,
190
- shouldHideArrow: cannotCenterArrow,
191
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
192
- import_react_primitive.Primitive.div,
193
- {
194
- "data-side": placedSide,
195
- "data-align": placedAlign,
196
- ...contentProps,
197
- ref: composedRefs,
198
- style: {
199
- ...contentProps.style,
200
- // if the PopperContent hasn't been placed yet (not all measurements done)
201
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
202
- animation: !isPositioned ? "none" : void 0
203
- }
196
+ dir: props.dir,
197
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
+ PopperContentProvider,
199
+ {
200
+ scope: __scopePopper,
201
+ placedSide,
202
+ onArrowChange: setArrow,
203
+ arrowX,
204
+ arrowY,
205
+ shouldHideArrow: cannotCenterArrow,
206
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
207
+ import_react_primitive.Primitive.div,
208
+ {
209
+ "data-side": placedSide,
210
+ "data-align": placedAlign,
211
+ ...contentProps,
212
+ ref: composedRefs,
213
+ style: {
214
+ ...contentProps.style,
215
+ // if the PopperContent hasn't been placed yet (not all measurements done)
216
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
217
+ animation: !isPositioned ? "none" : void 0
204
218
  }
205
- )
206
- }
207
- )
208
- }
209
- );
210
- }
211
- );
212
- PopperContent.displayName = CONTENT_NAME;
213
- var ARROW_NAME = "PopperArrow";
214
- var OPPOSITE_SIDE = {
215
- top: "bottom",
216
- right: "left",
217
- bottom: "top",
218
- left: "right"
219
- };
220
- var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
221
- const { __scopePopper, ...arrowProps } = props;
222
- const contentContext = useContentContext(ARROW_NAME, __scopePopper);
223
- const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
224
- return (
225
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
226
- // doesn't report size as we'd expect on SVG elements.
227
- // it reports their bounding box which is effectively the largest path inside the SVG.
228
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
229
- "span",
230
- {
231
- ref: contentContext.onArrowChange,
232
- style: {
233
- position: "absolute",
234
- left: contentContext.arrowX,
235
- top: contentContext.arrowY,
236
- [baseSide]: 0,
237
- transformOrigin: {
238
- top: "",
239
- right: "0 0",
240
- bottom: "center 0",
241
- left: "100% 0"
242
- }[contentContext.placedSide],
243
- transform: {
244
- top: "translateY(100%)",
245
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
246
- bottom: `rotate(180deg)`,
247
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
248
- }[contentContext.placedSide],
249
- visibility: contentContext.shouldHideArrow ? "hidden" : void 0
250
- },
251
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
252
- ArrowPrimitive.Root,
253
- {
254
- ...arrowProps,
255
- ref: forwardedRef,
256
- style: {
257
- ...arrowProps.style,
258
- // ensures the element can be measured correctly (mostly for if SVG)
259
- display: "block"
260
219
  }
261
- }
262
- )
263
- }
264
- )
220
+ )
221
+ }
222
+ )
223
+ }
265
224
  );
266
- });
267
- PopperArrow.displayName = ARROW_NAME;
268
- function isNotNull(value) {
269
- return value !== null;
270
225
  }
271
- var transformOrigin = (options) => ({
272
- name: "transformOrigin",
273
- options,
274
- fn(data) {
275
- const { placement, rects, middlewareData } = data;
276
- const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
277
- const isArrowHidden = cannotCenterArrow;
278
- const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
279
- const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
280
- const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
281
- const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
282
- const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
283
- const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
284
- let x = "";
285
- let y = "";
286
- if (placedSide === "bottom") {
287
- x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
288
- y = `${-arrowHeight}px`;
289
- } else if (placedSide === "top") {
290
- x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
291
- y = `${rects.floating.height + arrowHeight}px`;
292
- } else if (placedSide === "right") {
293
- x = `${-arrowHeight}px`;
294
- y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
295
- } else if (placedSide === "left") {
296
- x = `${rects.floating.width + arrowHeight}px`;
297
- y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
226
+ );
227
+ PopperContent.displayName = CONTENT_NAME;
228
+ var ARROW_NAME = "PopperArrow";
229
+ var OPPOSITE_SIDE = {
230
+ top: "bottom",
231
+ right: "left",
232
+ bottom: "top",
233
+ left: "right"
234
+ };
235
+ var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
236
+ const { __scopePopper, ...arrowProps } = props;
237
+ const contentContext = useContentContext(ARROW_NAME, __scopePopper);
238
+ const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
239
+ return (
240
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
241
+ // doesn't report size as we'd expect on SVG elements.
242
+ // it reports their bounding box which is effectively the largest path inside the SVG.
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
+ "span",
245
+ {
246
+ ref: contentContext.onArrowChange,
247
+ style: {
248
+ position: "absolute",
249
+ left: contentContext.arrowX,
250
+ top: contentContext.arrowY,
251
+ [baseSide]: 0,
252
+ transformOrigin: {
253
+ top: "",
254
+ right: "0 0",
255
+ bottom: "center 0",
256
+ left: "100% 0"
257
+ }[contentContext.placedSide],
258
+ transform: {
259
+ top: "translateY(100%)",
260
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
261
+ bottom: `rotate(180deg)`,
262
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
263
+ }[contentContext.placedSide],
264
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
265
+ },
266
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
267
+ ArrowPrimitive.Root,
268
+ {
269
+ ...arrowProps,
270
+ ref: forwardedRef,
271
+ style: {
272
+ ...arrowProps.style,
273
+ // ensures the element can be measured correctly (mostly for if SVG)
274
+ display: "block"
275
+ }
276
+ }
277
+ )
298
278
  }
299
- return { data: { x, y } };
279
+ )
280
+ );
281
+ });
282
+ PopperArrow.displayName = ARROW_NAME;
283
+ function isNotNull(value) {
284
+ return value !== null;
285
+ }
286
+ var transformOrigin = (options) => ({
287
+ name: "transformOrigin",
288
+ options,
289
+ fn(data) {
290
+ const { placement, rects, middlewareData } = data;
291
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
292
+ const isArrowHidden = cannotCenterArrow;
293
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
294
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
295
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
296
+ const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
297
+ const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
298
+ const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
299
+ let x = "";
300
+ let y = "";
301
+ if (placedSide === "bottom") {
302
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
303
+ y = `${-arrowHeight}px`;
304
+ } else if (placedSide === "top") {
305
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
306
+ y = `${rects.floating.height + arrowHeight}px`;
307
+ } else if (placedSide === "right") {
308
+ x = `${-arrowHeight}px`;
309
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
310
+ } else if (placedSide === "left") {
311
+ x = `${rects.floating.width + arrowHeight}px`;
312
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
300
313
  }
301
- });
302
- function getSideAndAlignFromPlacement(placement) {
303
- const [side, align = "center"] = placement.split("-");
304
- return [side, align];
314
+ return { data: { x, y } };
305
315
  }
306
- var Root2 = Popper;
307
- var Anchor = PopperAnchor;
308
- var Content = PopperContent;
309
- var Arrow = PopperArrow;
310
- })();
316
+ });
317
+ function getSideAndAlignFromPlacement(placement) {
318
+ const [side, align = "center"] = placement.split("-");
319
+ return [side, align];
320
+ }
321
+ var Root2 = Popper;
322
+ var Anchor = PopperAnchor;
323
+ var Content = PopperContent;
324
+ var Arrow = PopperArrow;
311
325
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 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 * as Radix from '@radix-ui/react-primitive';\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};\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 placedSide: Side;\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.ElementRef<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, (node) => setContent(node));\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 && hide({ strategy: 'referenceHidden', ...detectOverflowOptions }),\n ],\n });\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' as any]: [\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 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.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,yBAUO;AACP,uBAAgC;AAChC,kCAAgC;AAChC,6BAAmC;AACnC,+BAA0B;AAC1B,sCAA+B;AAC/B,uCAAgC;AAChC,8BAAwB;AAmCpB;AA5BJ,MAAM,eAAe,CAAC,OAAO,SAAS,UAAU,MAAM;AACtD,MAAM,gBAAgB,CAAC,SAAS,UAAU,KAAK;AAS/C,MAAM,cAAc;AAGpB,MAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAM/E,MAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAK9F,MAAM,SAAgC,CAAC,UAAoC;AACzE,UAAM,EAAE,eAAe,SAAS,IAAI;AACpC,UAAM,CAAC,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I,gBAAgB,eAAe,GAAG,YAAY;AAAA,MACpD;AACA,aAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;AAAA,IAC1B;AAAA,EACF;AAEA,WAAS,6BAA6B,WAAsB;AAC1D,UAAM,CAAC,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,GAAG;AACpD,WAAO,CAAC,MAAc,KAAc;AAAA,EACtC;AAEA,MAAMC,QAAO;AACb,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,QAAQ;",
6
- "names": ["floatingUIarrow", "PopperArrow", "Root"]
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};\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 = 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 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 placedSide: Side;\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.ElementRef<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, (node) => setContent(node));\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 && hide({ strategy: 'referenceHidden', ...detectOverflowOptions }),\n ],\n });\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' as any]: [\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 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.ElementRef<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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAkCpB;AA5BJ,IAAM,eAAe,CAAC,OAAO,SAAS,UAAU,MAAM;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AAI,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;AAEA,SAAS,6BAA6B,WAAsB;AAC1D,QAAM,CAAC,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,GAAG;AACpD,SAAO,CAAC,MAAc,KAAc;AACtC;AAEA,IAAMC,QAAO;AACb,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,QAAQ;",
6
+ "names": ["Root", "floatingUIarrow", "PopperArrow", "Root"]
7
7
  }
@@ -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 * as Radix from '@radix-ui/react-primitive';\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};\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 placedSide: Side;\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.ElementRef<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, (node) => setContent(node));\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 && hide({ strategy: 'referenceHidden', ...detectOverflowOptions }),\n ],\n });\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' as any]: [\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 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.ElementRef<typeof ArrowPrimitive.Root>;\ntype ArrowProps = Radix.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": ";;;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;AA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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;AAEA,SAAS,6BAA6B,WAAsB;AAC1D,QAAM,CAAC,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,GAAG;AACpD,SAAO,CAAC,MAAc,KAAc;AACtC;AAEA,IAAMC,QAAO;AACb,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,QAAQ;",
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};\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 = 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 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 placedSide: Side;\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.ElementRef<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, (node) => setContent(node));\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 && hide({ strategy: 'referenceHidden', ...detectOverflowOptions }),\n ],\n });\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' as any]: [\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 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.ElementRef<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": ";;;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;AAkCpB;AA5BJ,IAAM,eAAe,CAAC,OAAO,SAAS,UAAU,MAAM;AACtD,IAAM,gBAAgB,CAAC,SA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Ae,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;AAEA,SAAS,6BAA6B,WAAsB;AAC1D,QAAM,CAAC,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,GAAG;AACpD,SAAO,CAAC,MAAc,KAAc;AACtC;AAEA,IAAMC,QAAO;AACb,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,QAAQ;",
6
6
  "names": ["PopperArrow", "Root"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-popper",
3
- "version": "1.2.0-rc.2",
3
+ "version": "1.2.0-rc.4",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -29,21 +29,21 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@floating-ui/react-dom": "^2.0.0",
32
- "@radix-ui/react-arrow": "1.1.0-rc.2",
33
- "@radix-ui/react-compose-refs": "1.1.0-rc.2",
34
- "@radix-ui/react-context": "1.1.0-rc.2",
35
- "@radix-ui/react-primitive": "1.1.0-rc.2",
36
- "@radix-ui/react-use-callback-ref": "1.1.0-rc.2",
37
- "@radix-ui/react-use-layout-effect": "1.1.0-rc.2",
38
- "@radix-ui/react-use-rect": "1.1.0-rc.2",
39
- "@radix-ui/react-use-size": "1.1.0-rc.2",
40
- "@radix-ui/rect": "1.1.0-rc.2"
32
+ "@radix-ui/react-arrow": "1.1.0-rc.4",
33
+ "@radix-ui/react-compose-refs": "1.1.0-rc.4",
34
+ "@radix-ui/react-context": "1.1.0-rc.4",
35
+ "@radix-ui/react-primitive": "2.0.0-rc.1",
36
+ "@radix-ui/react-use-callback-ref": "1.1.0-rc.4",
37
+ "@radix-ui/react-use-layout-effect": "1.1.0-rc.4",
38
+ "@radix-ui/react-use-rect": "1.1.0-rc.4",
39
+ "@radix-ui/react-use-size": "1.1.0-rc.4",
40
+ "@radix-ui/rect": "1.1.0-rc.4"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@types/react": "*",
44
44
  "@types/react-dom": "*",
45
- "react": "^16.8 || ^17.0 || ^18.0",
46
- "react-dom": "^16.8 || ^17.0 || ^18.0"
45
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
46
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@types/react": {