@radix-ui/react-popper 1.2.0-rc.1 → 1.2.0-rc.3

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