@hanzogui/popper 3.0.2 → 7.3.0
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/LICENSE +40 -19
- package/dist/cjs/Popper.cjs +492 -460
- package/dist/cjs/Popper.native.js +514 -517
- package/dist/cjs/Popper.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +8 -6
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Popper.mjs +456 -426
- package/dist/esm/Popper.mjs.map +1 -1
- package/dist/esm/Popper.native.js +489 -495
- package/dist/esm/Popper.native.js.map +1 -1
- package/dist/jsx/Popper.mjs +456 -426
- package/dist/jsx/Popper.mjs.map +1 -1
- package/dist/jsx/Popper.native.js +514 -517
- package/dist/jsx/Popper.native.js.map +1 -1
- package/dist/jsx/index.native.js +7 -5
- package/package.json +18 -15
- package/src/Popper.tsx +8 -8
- package/types/Popper.d.ts +28 -28
- package/types/Popper.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
|
@@ -4,33 +4,35 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var Popper_exports = {};
|
|
35
37
|
__export(Popper_exports, {
|
|
36
38
|
Popper: () => Popper,
|
|
@@ -50,146 +52,144 @@ __export(Popper_exports, {
|
|
|
50
52
|
usePopperContextSlow: () => usePopperContextSlow
|
|
51
53
|
});
|
|
52
54
|
module.exports = __toCommonJS(Popper_exports);
|
|
53
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
|
+
var import_react_dom = require("react-dom");
|
|
57
|
+
var import_compose_refs = require("@hanzogui/compose-refs");
|
|
58
|
+
var import_constants = require("@hanzogui/constants");
|
|
59
|
+
var import_core = require("@hanzogui/core");
|
|
60
|
+
var import_floating = require("@hanzogui/floating");
|
|
61
|
+
var import_floating2 = require("@hanzogui/floating");
|
|
62
|
+
var import_get_token = require("@hanzogui/get-token");
|
|
63
|
+
var import_stacks = require("@hanzogui/stacks");
|
|
64
|
+
var import_start_transition = require("@hanzogui/start-transition");
|
|
65
|
+
var React = __toESM(require("react"), 1);
|
|
66
|
+
var import_react_native = require("react-native");
|
|
65
67
|
function _instanceof(left, right) {
|
|
66
|
-
|
|
68
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);else return left instanceof right;
|
|
67
69
|
}
|
|
68
70
|
function _type_of(obj) {
|
|
69
71
|
"@swc/helpers - typeof";
|
|
70
72
|
|
|
71
|
-
return obj && typeof Symbol
|
|
73
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
72
74
|
}
|
|
73
|
-
var PopperContextFast = (0,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
75
|
+
var PopperContextFast = (0, import_core.createStyledContext)(
|
|
76
|
+
// since we always provide this we can avoid setting here
|
|
77
|
+
{}, "Popper__");
|
|
78
|
+
var PopperPositionContext = import_core.createStyledContext;
|
|
79
|
+
var {
|
|
80
|
+
useStyledContext: usePopperContext,
|
|
81
|
+
Provider: PopperProviderFast
|
|
82
|
+
} = PopperContextFast;
|
|
83
|
+
var PopperContextSlow = (0, import_core.createStyledContext)(
|
|
84
|
+
// since we always provide this we can avoid setting here
|
|
85
|
+
{}, "PopperSlow__");
|
|
86
|
+
var {
|
|
87
|
+
useStyledContext: usePopperContextSlow,
|
|
88
|
+
Provider: PopperProviderSlow
|
|
89
|
+
} = PopperContextSlow;
|
|
90
|
+
var PopperProvider = function (param) {
|
|
91
|
+
var {
|
|
92
|
+
scope,
|
|
93
|
+
children,
|
|
94
|
+
...context
|
|
95
|
+
} = param;
|
|
96
|
+
var fns = React.useRef(context);
|
|
97
|
+
fns.current = context;
|
|
98
|
+
var [slowContext] = React.useState(function () {
|
|
99
|
+
return {
|
|
100
|
+
refs: context.refs,
|
|
101
|
+
triggerElements: context.triggerElements,
|
|
102
|
+
update() {
|
|
103
|
+
for (var _len = arguments.length, a = new Array(_len), _key = 0; _key < _len; _key++) a[_key] = arguments[_key];
|
|
104
|
+
fns.current.update(...a);
|
|
105
|
+
},
|
|
106
|
+
getReferenceProps(p) {
|
|
107
|
+
var _fns_current_getReferenceProps, _fns_current;
|
|
108
|
+
return (_fns_current_getReferenceProps = (_fns_current = fns.current).getReferenceProps) === null || _fns_current_getReferenceProps === void 0 ? void 0 : _fns_current_getReferenceProps.call(_fns_current, p);
|
|
109
|
+
},
|
|
110
|
+
onHoverReference(e) {
|
|
111
|
+
var _fns_current_onHoverReference, _fns_current;
|
|
112
|
+
(_fns_current_onHoverReference = (_fns_current = fns.current).onHoverReference) === null || _fns_current_onHoverReference === void 0 || _fns_current_onHoverReference.call(_fns_current, e);
|
|
113
|
+
},
|
|
114
|
+
onLeaveReference() {
|
|
115
|
+
var _fns_current_onLeaveReference, _fns_current;
|
|
116
|
+
(_fns_current_onLeaveReference = (_fns_current = fns.current).onLeaveReference) === null || _fns_current_onLeaveReference === void 0 || _fns_current_onLeaveReference.call(_fns_current);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperProviderFast, {
|
|
121
|
+
scope,
|
|
122
|
+
...context,
|
|
123
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperProviderSlow, {
|
|
119
124
|
scope,
|
|
120
|
-
...
|
|
121
|
-
children
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
setupOptions = {};
|
|
125
|
+
...slowContext,
|
|
126
|
+
children
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var checkFloating = {
|
|
131
|
+
name: "checkFloating",
|
|
132
|
+
fn(data) {
|
|
133
|
+
return {
|
|
134
|
+
data: {
|
|
135
|
+
hasFloating: !!data.rects.floating.width
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var setupOptions = {};
|
|
139
141
|
function setupPopper(options) {
|
|
140
142
|
Object.assign(setupOptions, options);
|
|
141
143
|
}
|
|
142
|
-
function
|
|
144
|
+
function guiAutoUpdate(reference, floating, update) {
|
|
143
145
|
update();
|
|
144
146
|
var rafId = requestAnimationFrame(function () {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
_didIteratorError =
|
|
147
|
+
update();
|
|
148
|
+
rafId = 0;
|
|
149
|
+
});
|
|
150
|
+
var cleanups = [function () {
|
|
151
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
152
|
+
}];
|
|
153
|
+
if (_instanceof(reference, HTMLElement)) cleanups.push((0, import_core.registerLayoutNode)(reference, update));
|
|
154
|
+
var ancestors = [...(_instanceof(reference, Element) ? (0, import_floating2.getOverflowAncestors)(reference) : []), ...(0, import_floating2.getOverflowAncestors)(floating)];
|
|
155
|
+
var uniqueAncestors = [...new Set(ancestors)];
|
|
156
|
+
var _iteratorNormalCompletion = true,
|
|
157
|
+
_didIteratorError = false,
|
|
156
158
|
_iteratorError = void 0;
|
|
157
159
|
try {
|
|
158
|
-
for (var _iterator = uniqueAncestors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion =
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
passive: !0
|
|
162
|
-
});
|
|
163
|
-
}
|
|
160
|
+
for (var _iterator = uniqueAncestors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) _step.value.addEventListener("scroll", update, {
|
|
161
|
+
passive: true
|
|
162
|
+
});
|
|
164
163
|
} catch (err) {
|
|
165
|
-
_didIteratorError =
|
|
164
|
+
_didIteratorError = true;
|
|
165
|
+
_iteratorError = err;
|
|
166
166
|
} finally {
|
|
167
167
|
try {
|
|
168
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
168
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
169
169
|
} finally {
|
|
170
170
|
if (_didIteratorError) throw _iteratorError;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
window.addEventListener("resize", update);
|
|
174
|
+
cleanups.push(function () {
|
|
175
|
+
var _iteratorNormalCompletion2 = true,
|
|
176
|
+
_didIteratorError2 = false,
|
|
176
177
|
_iteratorError2 = void 0;
|
|
177
178
|
try {
|
|
178
|
-
for (var _iterator2 = uniqueAncestors[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 =
|
|
179
|
-
var ancestor2 = _step2.value;
|
|
180
|
-
ancestor2.removeEventListener("scroll", update);
|
|
181
|
-
}
|
|
179
|
+
for (var _iterator2 = uniqueAncestors[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) _step2.value.removeEventListener("scroll", update);
|
|
182
180
|
} catch (err) {
|
|
183
|
-
_didIteratorError2 =
|
|
181
|
+
_didIteratorError2 = true;
|
|
182
|
+
_iteratorError2 = err;
|
|
184
183
|
} finally {
|
|
185
184
|
try {
|
|
186
|
-
!_iteratorNormalCompletion2 && _iterator2.return != null
|
|
185
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();
|
|
187
186
|
} finally {
|
|
188
187
|
if (_didIteratorError2) throw _iteratorError2;
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
window.removeEventListener("resize", update);
|
|
192
|
-
})
|
|
191
|
+
});
|
|
192
|
+
return function () {
|
|
193
193
|
return cleanups.forEach(function (fn) {
|
|
194
194
|
return fn();
|
|
195
195
|
});
|
|
@@ -197,76 +197,71 @@ function tamaguiAutoUpdate(reference, floating, update) {
|
|
|
197
197
|
}
|
|
198
198
|
function Popper(props) {
|
|
199
199
|
var {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
isOpen
|
|
220
|
-
// order matters: offset first, then flip, then shift, then arrow
|
|
221
|
-
typeof offsetOptions < "u" ? (0, import_gui_floating2.offset)(offsetOptions) : null, allowFlip ? (0, import_gui_floating2.flip)(typeof allowFlip == "boolean" ? {} : allowFlip) : null,
|
|
222
|
-
// NOTE: shift's axis terminology is reversed vs flip/offset:
|
|
223
|
-
// for top/bottom placements: mainAxis = horizontal, crossAxis = vertical
|
|
224
|
-
// for left/right placements: mainAxis = vertical, crossAxis = horizontal
|
|
225
|
-
// default to horizontal shift only (mainAxis: true, crossAxis: false)
|
|
226
|
-
stayInFrame ? (0, import_gui_floating2.shift)({
|
|
200
|
+
children,
|
|
201
|
+
size,
|
|
202
|
+
strategy = "absolute",
|
|
203
|
+
placement = "bottom",
|
|
204
|
+
stayInFrame,
|
|
205
|
+
allowFlip,
|
|
206
|
+
offset,
|
|
207
|
+
disableRTL,
|
|
208
|
+
resize,
|
|
209
|
+
passThrough,
|
|
210
|
+
open,
|
|
211
|
+
scope
|
|
212
|
+
} = props;
|
|
213
|
+
var [arrowEl, setArrow] = React.useState(null);
|
|
214
|
+
var [arrowSize, setArrowSize] = React.useState(0);
|
|
215
|
+
var offsetOptions = offset !== null && offset !== void 0 ? offset : arrowSize;
|
|
216
|
+
React.useRef({});
|
|
217
|
+
var isOpen = passThrough ? false : open !== null && open !== void 0 ? open : true;
|
|
218
|
+
var middlewareRef = React.useRef([]);
|
|
219
|
+
if (isOpen) middlewareRef.current = [typeof offsetOptions !== "undefined" ? (0, import_floating2.offset)(offsetOptions) : null, allowFlip ? (0, import_floating2.flip)(typeof allowFlip === "boolean" ? {} : allowFlip) : null, stayInFrame ? (0, import_floating2.shift)({
|
|
227
220
|
padding: 10,
|
|
228
|
-
mainAxis:
|
|
229
|
-
crossAxis:
|
|
230
|
-
...((typeof stayInFrame
|
|
231
|
-
}) : null, arrowEl ? (0,
|
|
221
|
+
mainAxis: true,
|
|
222
|
+
crossAxis: false,
|
|
223
|
+
...((typeof stayInFrame === "undefined" ? "undefined" : _type_of(stayInFrame)) === "object" ? stayInFrame : null)
|
|
224
|
+
}) : null, arrowEl ? (0, import_floating2.arrow)({
|
|
232
225
|
element: arrowEl
|
|
233
|
-
}) : null, checkFloating, null, null, null].filter(Boolean)
|
|
234
|
-
var floating = (0,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
platform
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
[keyboardOpen, setKeyboardOpen] = React.useState(!1);
|
|
226
|
+
}) : null, checkFloating, null, null, null].filter(Boolean);
|
|
227
|
+
var floating = (0, import_floating2.useFloating)({
|
|
228
|
+
open: isOpen,
|
|
229
|
+
strategy,
|
|
230
|
+
placement,
|
|
231
|
+
sameScrollView: false,
|
|
232
|
+
whileElementsMounted: !isOpen ? void 0 : guiAutoUpdate,
|
|
233
|
+
platform: (disableRTL !== null && disableRTL !== void 0 ? disableRTL : setupOptions.disableRTL) ? {
|
|
234
|
+
...import_floating2.platform,
|
|
235
|
+
isRTL(element) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
} : import_floating2.platform,
|
|
239
|
+
middleware: middlewareRef.current
|
|
240
|
+
});
|
|
241
|
+
var {
|
|
242
|
+
middlewareData
|
|
243
|
+
} = floating;
|
|
244
|
+
var dimensions = (0, import_react_native.useWindowDimensions)();
|
|
245
|
+
var [keyboardOpen, setKeyboardOpen] = React.useState(false);
|
|
254
246
|
React.useEffect(function () {
|
|
255
247
|
var showSubscription = import_react_native.Keyboard.addListener("keyboardDidShow", function () {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
});
|
|
248
|
+
(0, import_start_transition.startTransition)(function () {
|
|
249
|
+
setKeyboardOpen(true);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
var hideSubscription = import_react_native.Keyboard.addListener("keyboardDidHide", function () {
|
|
253
|
+
(0, import_start_transition.startTransition)(function () {
|
|
254
|
+
setKeyboardOpen(false);
|
|
264
255
|
});
|
|
256
|
+
});
|
|
265
257
|
return function () {
|
|
266
|
-
showSubscription.remove()
|
|
258
|
+
showSubscription.remove();
|
|
259
|
+
hideSubscription.remove();
|
|
267
260
|
};
|
|
268
|
-
}, [])
|
|
269
|
-
|
|
261
|
+
}, []);
|
|
262
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
263
|
+
if (passThrough) return;
|
|
264
|
+
floating.update();
|
|
270
265
|
}, [passThrough, dimensions, keyboardOpen]);
|
|
271
266
|
var popperContext = React.useMemo(function () {
|
|
272
267
|
var _middlewareData_checkFloating;
|
|
@@ -284,349 +279,351 @@ function Popper(props) {
|
|
|
284
279
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperProvider, {
|
|
285
280
|
scope,
|
|
286
281
|
...popperContext,
|
|
287
|
-
children: (
|
|
288
|
-
/* reset FloatingOverrideContext so it doesn't leak into nested Poppers —
|
|
289
|
-
each Popper consumes the override for its own useFloating, children
|
|
290
|
-
should not inherit it (e.g. a Menu inside a Tooltip's tree) */
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
(0, import_jsx_runtime.jsx)(import_gui_floating.FloatingOverrideContext.Provider, {
|
|
282
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_floating.FloatingOverrideContext.Provider, {
|
|
293
283
|
value: null,
|
|
294
284
|
children
|
|
295
|
-
})
|
|
285
|
+
})
|
|
296
286
|
});
|
|
297
287
|
}
|
|
298
|
-
var PopperAnchor =
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
composedRefs = (0, import_gui_compose_refs.useComposedRefs)(forwardedRef, ref,
|
|
336
|
-
// web handles this onMouseEnter below so it can support multiple targets + hovering
|
|
337
|
-
shouldHandleInHover ? void 0 : safeSetReference);
|
|
338
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_core.View, {
|
|
339
|
-
...rest,
|
|
340
|
-
...refProps,
|
|
341
|
-
ref: composedRefs,
|
|
342
|
-
...(shouldHandleInHover && {
|
|
343
|
-
// scoped poppers with multiple triggers: set the reference on
|
|
344
|
-
// mouseEnter so floating-ui positions relative to the hovered
|
|
345
|
-
// trigger, not the last one rendered.
|
|
346
|
-
//
|
|
347
|
-
// flushSync is critical here: without it, setReference batches
|
|
348
|
-
// with React's async state updates and the arrow/content position
|
|
349
|
-
// computes against the OLD reference element. this causes the
|
|
350
|
-
// arrow to flash at x=0 (top-left) during trigger switches.
|
|
351
|
-
// flushSync forces synchronous commit so update() below reads
|
|
352
|
-
// the correct reference element immediately.
|
|
353
|
-
onMouseEnter: function (e) {
|
|
354
|
-
var _e_currentTarget,
|
|
355
|
-
el = (_e_currentTarget = e.currentTarget) !== null && _e_currentTarget !== void 0 ? _e_currentTarget : ref.current;
|
|
356
|
-
if (_instanceof(el, HTMLElement)) {
|
|
357
|
-
var _refProps_onPointerEnter, _context_onHoverReference;
|
|
358
|
-
if ((0, import_react_dom.flushSync)(function () {
|
|
359
|
-
return refs.setReference(el);
|
|
360
|
-
}), update(), !refProps) return;
|
|
361
|
-
(_refProps_onPointerEnter = refProps.onPointerEnter) === null || _refProps_onPointerEnter === void 0 || _refProps_onPointerEnter.call(refProps, e), (_context_onHoverReference = context.onHoverReference) === null || _context_onHoverReference === void 0 || _context_onHoverReference.call(context, e.nativeEvent);
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
onMouseLeave: function (e) {
|
|
365
|
-
var _context_onLeaveReference, _refProps_onMouseLeave;
|
|
366
|
-
(_context_onLeaveReference = context.onLeaveReference) === null || _context_onLeaveReference === void 0 || _context_onLeaveReference.call(context), refProps == null || (_refProps_onMouseLeave = refProps.onMouseLeave) === null || _refProps_onMouseLeave === void 0 || _refProps_onMouseLeave.call(refProps, e);
|
|
367
|
-
}
|
|
368
|
-
})
|
|
288
|
+
var PopperAnchor = import_stacks.YStack.styleable(function PopperAnchor2(props, forwardedRef) {
|
|
289
|
+
var {
|
|
290
|
+
virtualRef,
|
|
291
|
+
scope,
|
|
292
|
+
...rest
|
|
293
|
+
} = props;
|
|
294
|
+
var context = usePopperContextSlow(scope);
|
|
295
|
+
var {
|
|
296
|
+
getReferenceProps,
|
|
297
|
+
refs,
|
|
298
|
+
update
|
|
299
|
+
} = context;
|
|
300
|
+
var ref = React.useRef(null);
|
|
301
|
+
var triggerId = React.useId();
|
|
302
|
+
React.useEffect(function () {
|
|
303
|
+
if (!scope || !context.triggerElements || !ref.current) return;
|
|
304
|
+
if (!_instanceof(ref.current, Element)) return;
|
|
305
|
+
var el = ref.current;
|
|
306
|
+
context.triggerElements.add(triggerId, el);
|
|
307
|
+
return function () {
|
|
308
|
+
var _context_triggerElements;
|
|
309
|
+
(_context_triggerElements = context.triggerElements) === null || _context_triggerElements === void 0 || _context_triggerElements.delete(triggerId);
|
|
310
|
+
};
|
|
311
|
+
}, [scope, triggerId, context.triggerElements]);
|
|
312
|
+
React.useEffect(function () {
|
|
313
|
+
if (virtualRef) {
|
|
314
|
+
refs.setReference(virtualRef.current);
|
|
315
|
+
update();
|
|
316
|
+
}
|
|
317
|
+
}, [virtualRef]);
|
|
318
|
+
var refProps = (getReferenceProps === null || getReferenceProps === void 0 ? void 0 : getReferenceProps({
|
|
319
|
+
...rest,
|
|
320
|
+
ref
|
|
321
|
+
})) || null;
|
|
322
|
+
var safeSetReference = React.useCallback(function (node) {
|
|
323
|
+
(0, import_start_transition.startTransition)(function () {
|
|
324
|
+
refs.setReference(node);
|
|
369
325
|
});
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
326
|
+
},
|
|
327
|
+
// it was refs.setRefernce but its stable and refs is undefined on server
|
|
328
|
+
[refs]);
|
|
329
|
+
var shouldHandleInHover = import_constants.isWeb && scope;
|
|
330
|
+
var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref,
|
|
331
|
+
// web handles this onMouseEnter below so it can support multiple targets + hovering
|
|
332
|
+
shouldHandleInHover ? void 0 : safeSetReference);
|
|
333
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.View, {
|
|
334
|
+
...rest,
|
|
335
|
+
...refProps,
|
|
336
|
+
ref: composedRefs,
|
|
337
|
+
...(shouldHandleInHover && {
|
|
338
|
+
onMouseEnter: function (e) {
|
|
339
|
+
var _e_currentTarget;
|
|
340
|
+
var el = (_e_currentTarget = e.currentTarget) !== null && _e_currentTarget !== void 0 ? _e_currentTarget : ref.current;
|
|
341
|
+
if (_instanceof(el, HTMLElement)) {
|
|
342
|
+
var _refProps_onPointerEnter, _context_onHoverReference;
|
|
343
|
+
(0, import_react_dom.flushSync)(function () {
|
|
344
|
+
return refs.setReference(el);
|
|
345
|
+
});
|
|
346
|
+
update();
|
|
347
|
+
if (!refProps) return;
|
|
348
|
+
(_refProps_onPointerEnter = refProps.onPointerEnter) === null || _refProps_onPointerEnter === void 0 || _refProps_onPointerEnter.call(refProps, e);
|
|
349
|
+
(_context_onHoverReference = context.onHoverReference) === null || _context_onHoverReference === void 0 || _context_onHoverReference.call(context, e.nativeEvent);
|
|
386
350
|
}
|
|
351
|
+
},
|
|
352
|
+
onMouseLeave: function (e) {
|
|
353
|
+
var _context_onLeaveReference, _refProps_onMouseLeave;
|
|
354
|
+
(_context_onLeaveReference = context.onLeaveReference) === null || _context_onLeaveReference === void 0 || _context_onLeaveReference.call(context);
|
|
355
|
+
refProps === null || refProps === void 0 || (_refProps_onMouseLeave = refProps.onMouseLeave) == null || _refProps_onMouseLeave.call(refProps, e);
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
var PopperContentFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
361
|
+
name: "PopperContent",
|
|
362
|
+
variants: {
|
|
363
|
+
unstyled: {
|
|
364
|
+
true: {}
|
|
365
|
+
},
|
|
366
|
+
size: {
|
|
367
|
+
"...size": function (val, param) {
|
|
368
|
+
var {
|
|
369
|
+
tokens
|
|
370
|
+
} = param;
|
|
371
|
+
return {
|
|
372
|
+
padding: tokens.space[val],
|
|
373
|
+
borderRadius: tokens.radius[val]
|
|
374
|
+
};
|
|
387
375
|
}
|
|
388
376
|
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
var PopperContent = /* @__PURE__ */React.forwardRef(function PopperContent2(props, forwardedRef) {
|
|
380
|
+
var {
|
|
381
|
+
scope,
|
|
382
|
+
animatePosition,
|
|
383
|
+
enableAnimationForPositionChange,
|
|
384
|
+
children,
|
|
385
|
+
passThrough,
|
|
386
|
+
unstyled,
|
|
387
|
+
...rest
|
|
388
|
+
} = props;
|
|
389
|
+
var animatePos = animatePosition !== null && animatePosition !== void 0 ? animatePosition : enableAnimationForPositionChange;
|
|
390
|
+
var context = usePopperContext(scope);
|
|
391
|
+
var {
|
|
392
|
+
strategy,
|
|
393
|
+
placement,
|
|
394
|
+
refs,
|
|
395
|
+
x,
|
|
396
|
+
y,
|
|
397
|
+
getFloatingProps,
|
|
398
|
+
size,
|
|
399
|
+
isPositioned,
|
|
400
|
+
transformOrigin,
|
|
401
|
+
update
|
|
402
|
+
} = context;
|
|
403
|
+
var updateRef = React.useRef(update);
|
|
404
|
+
updateRef.current = update;
|
|
405
|
+
var lastNodeRef = React.useRef(null);
|
|
406
|
+
var safeSetFloating = React.useCallback(function (node) {
|
|
407
|
+
var isNewNode = node !== lastNodeRef.current;
|
|
408
|
+
if (node) {
|
|
409
|
+
lastNodeRef.current = node;
|
|
410
|
+
refs.setFloating(node);
|
|
411
|
+
if (!isNewNode) {
|
|
412
|
+
var _updateRef_current;
|
|
413
|
+
(_updateRef_current = updateRef.current) === null || _updateRef_current === void 0 || _updateRef_current.call(updateRef);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
// null calls are blocked: cycling nulls are transient, genuine unmount
|
|
418
|
+
// is handled by the useEffect cleanup below
|
|
419
|
+
[refs.setFloating]);
|
|
420
|
+
React.useEffect(function () {
|
|
421
|
+
return function () {
|
|
422
|
+
var ourNode = lastNodeRef.current;
|
|
423
|
+
if (ourNode && refs.floating.current === ourNode) refs.setFloating(null);
|
|
424
|
+
lastNodeRef.current = null;
|
|
425
|
+
};
|
|
426
|
+
}, []);
|
|
427
|
+
var contentRefs = (0, import_compose_refs.useComposedRefs)(safeSetFloating, forwardedRef);
|
|
428
|
+
var [needsMeasure, setNeedsMeasure] = React.useState(animatePos);
|
|
429
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
430
|
+
if (needsMeasure && x && y) setNeedsMeasure(false);
|
|
431
|
+
}, [needsMeasure, animatePos, x, y]);
|
|
432
|
+
var hasBeenPositioned = React.useRef(false);
|
|
433
|
+
var lastGoodPosition = React.useRef({
|
|
434
|
+
x: 0,
|
|
435
|
+
y: 0
|
|
436
|
+
});
|
|
437
|
+
if (x !== 0 || y !== 0) {
|
|
438
|
+
lastGoodPosition.current = {
|
|
444
439
|
x,
|
|
445
440
|
y
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
441
|
+
};
|
|
442
|
+
if (isPositioned) hasBeenPositioned.current = true;
|
|
443
|
+
}
|
|
444
|
+
var brieflyZero = hasBeenPositioned.current && x === 0 && y === 0;
|
|
445
|
+
var effectiveX = brieflyZero ? lastGoodPosition.current.x : x;
|
|
446
|
+
var effectiveY = brieflyZero ? lastGoodPosition.current.y : y;
|
|
447
|
+
var hide = !hasBeenPositioned.current && effectiveX === 0 && effectiveY === 0;
|
|
448
|
+
var disableAnimationProp = animatePos === "even-when-repositioning" ? needsMeasure : !hasBeenPositioned.current && !isPositioned || needsMeasure;
|
|
449
|
+
var [disableAnimation, setDisableAnimation] = React.useState(disableAnimationProp);
|
|
450
|
+
React.useEffect(function () {
|
|
451
|
+
setDisableAnimation(disableAnimationProp);
|
|
452
|
+
}, [disableAnimationProp]);
|
|
453
|
+
var frameProps = {
|
|
454
|
+
ref: contentRefs,
|
|
455
|
+
...(hide ? {} :
|
|
456
|
+
// omit x/y when hiding - prevents motion driver from animating from origin
|
|
457
|
+
{
|
|
458
|
+
x: effectiveX || 0,
|
|
459
|
+
y: effectiveY || 0
|
|
460
|
+
}),
|
|
461
|
+
top: 0,
|
|
462
|
+
left: 0,
|
|
463
|
+
position: strategy,
|
|
464
|
+
opacity: hide ? 0 : 1,
|
|
465
|
+
...(animatePos && {
|
|
466
|
+
transition: rest.transition,
|
|
467
|
+
animateOnly: disableAnimation ? [] : rest.animateOnly,
|
|
468
|
+
animatePresence: false
|
|
469
|
+
})
|
|
470
|
+
};
|
|
471
|
+
var {
|
|
472
|
+
style,
|
|
473
|
+
...floatingProps
|
|
474
|
+
} = getFloatingProps ? getFloatingProps(frameProps) : frameProps;
|
|
475
|
+
var transformOriginStyle = import_constants.isWeb && transformOrigin ? {
|
|
476
|
+
transformOrigin: `${transformOrigin.x} ${transformOrigin.y}`
|
|
477
|
+
} : void 0;
|
|
478
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.LayoutMeasurementController, {
|
|
479
|
+
disable: !context.open,
|
|
480
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.View, {
|
|
481
|
+
passThrough,
|
|
482
|
+
ref: contentRefs,
|
|
483
|
+
direction: rest.direction,
|
|
484
|
+
...(passThrough ? null : floatingProps),
|
|
485
|
+
...(!passThrough && animatePos && {
|
|
486
|
+
"data-popper-animate-position": "true"
|
|
487
|
+
}),
|
|
488
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperContentFrame, {
|
|
489
489
|
passThrough,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
490
|
+
unstyled,
|
|
491
|
+
...(!passThrough && {
|
|
492
|
+
"data-placement": placement,
|
|
493
|
+
"data-strategy": strategy,
|
|
494
|
+
size,
|
|
495
|
+
...style,
|
|
496
|
+
...transformOriginStyle,
|
|
497
|
+
...rest
|
|
495
498
|
}),
|
|
496
|
-
children
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
})
|
|
510
|
-
});
|
|
511
|
-
}),
|
|
512
|
-
PopperArrowFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
|
|
513
|
-
name: "PopperArrow",
|
|
514
|
-
variants: {
|
|
515
|
-
unstyled: {
|
|
516
|
-
false: {
|
|
517
|
-
borderColor: "$borderColor",
|
|
518
|
-
backgroundColor: "$background",
|
|
519
|
-
position: "relative"
|
|
520
|
-
}
|
|
499
|
+
children
|
|
500
|
+
}, "popper-content-frame")
|
|
501
|
+
})
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
var PopperArrowFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
505
|
+
name: "PopperArrow",
|
|
506
|
+
variants: {
|
|
507
|
+
unstyled: {
|
|
508
|
+
false: {
|
|
509
|
+
borderColor: "$borderColor",
|
|
510
|
+
backgroundColor: "$background",
|
|
511
|
+
position: "relative"
|
|
521
512
|
}
|
|
522
|
-
},
|
|
523
|
-
defaultVariants: {
|
|
524
|
-
unstyled: process.env.HANZO_GUI_HEADLESS === "1"
|
|
525
513
|
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
514
|
+
},
|
|
515
|
+
defaultVariants: {
|
|
516
|
+
unstyled: process.env.GUI_HEADLESS === "1"
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
var PopperArrowOuterFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
520
|
+
name: "PopperArrowOuter",
|
|
521
|
+
variants: {
|
|
522
|
+
unstyled: {
|
|
523
|
+
false: {
|
|
524
|
+
position: "absolute",
|
|
525
|
+
zIndex: 1e6,
|
|
526
|
+
pointerEvents: "none",
|
|
527
|
+
overflow: "hidden",
|
|
528
|
+
alignItems: "center",
|
|
529
|
+
justifyContent: "center"
|
|
539
530
|
}
|
|
540
|
-
},
|
|
541
|
-
defaultVariants: {
|
|
542
|
-
unstyled: process.env.HANZO_GUI_HEADLESS === "1"
|
|
543
531
|
}
|
|
544
|
-
}),
|
|
545
|
-
opposites = {
|
|
546
|
-
top: "bottom",
|
|
547
|
-
right: "left",
|
|
548
|
-
bottom: "top",
|
|
549
|
-
left: "right"
|
|
550
532
|
},
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
533
|
+
defaultVariants: {
|
|
534
|
+
unstyled: process.env.GUI_HEADLESS === "1"
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
var opposites = {
|
|
538
|
+
top: "bottom",
|
|
539
|
+
right: "left",
|
|
540
|
+
bottom: "top",
|
|
541
|
+
left: "right"
|
|
542
|
+
};
|
|
543
|
+
var PopperArrow = /* @__PURE__ */React.forwardRef(function PopperArrow2(propsIn, forwardedRef) {
|
|
544
|
+
var _context_arrowStyle, _context_arrowStyle1;
|
|
545
|
+
var {
|
|
546
|
+
scope,
|
|
547
|
+
animatePosition,
|
|
548
|
+
transition,
|
|
549
|
+
...rest
|
|
550
|
+
} = propsIn;
|
|
551
|
+
var {
|
|
552
|
+
offset,
|
|
553
|
+
size: sizeProp,
|
|
554
|
+
borderWidth = 0,
|
|
555
|
+
...arrowProps
|
|
556
|
+
} = rest;
|
|
557
|
+
var context = usePopperContext(scope);
|
|
558
|
+
var sizeVal = typeof sizeProp === "number" ? sizeProp : (0, import_core.getVariableValue)((0, import_get_token.getSpace)(sizeProp !== null && sizeProp !== void 0 ? sizeProp : context.size, {
|
|
559
|
+
shift: -2,
|
|
560
|
+
bounds: [2]
|
|
561
|
+
}));
|
|
562
|
+
var size = Math.max(0, +sizeVal);
|
|
563
|
+
var {
|
|
564
|
+
placement
|
|
565
|
+
} = context;
|
|
566
|
+
var refs = (0, import_compose_refs.useComposedRefs)(context.arrowRef, forwardedRef);
|
|
567
|
+
var x = ((_context_arrowStyle = context.arrowStyle) === null || _context_arrowStyle === void 0 ? void 0 : _context_arrowStyle.x) || 0;
|
|
568
|
+
var y = ((_context_arrowStyle1 = context.arrowStyle) === null || _context_arrowStyle1 === void 0 ? void 0 : _context_arrowStyle1.y) || 0;
|
|
569
|
+
var arrowPositioned = context.arrowStyle != null;
|
|
570
|
+
var primaryPlacement = placement ? placement.split("-")[0] : "top";
|
|
571
|
+
var arrowStyle = {
|
|
572
|
+
x,
|
|
573
|
+
y,
|
|
574
|
+
width: size,
|
|
575
|
+
height: size
|
|
576
|
+
};
|
|
577
|
+
var innerArrowStyle = {};
|
|
578
|
+
var isVertical = primaryPlacement === "bottom" || primaryPlacement === "top";
|
|
579
|
+
if (primaryPlacement) {
|
|
580
|
+
arrowStyle[isVertical ? "width" : "height"] = size * 2;
|
|
581
|
+
var oppSide = opposites[primaryPlacement];
|
|
582
|
+
if (oppSide) {
|
|
583
|
+
arrowStyle[oppSide] = -size;
|
|
584
|
+
innerArrowStyle[oppSide] = size / 2;
|
|
595
585
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
586
|
+
if (oppSide === "top" || oppSide === "bottom") arrowStyle.left = 0;
|
|
587
|
+
if (oppSide === "left" || oppSide === "right") arrowStyle.top = 0;
|
|
588
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
589
|
+
var _context_onArrowSize;
|
|
590
|
+
(_context_onArrowSize = context.onArrowSize) === null || _context_onArrowSize === void 0 || _context_onArrowSize.call(context, size);
|
|
591
|
+
}, [size, context.onArrowSize]);
|
|
592
|
+
}
|
|
593
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperArrowOuterFrame, {
|
|
594
|
+
ref: refs,
|
|
595
|
+
...arrowStyle,
|
|
596
|
+
...(!arrowPositioned && {
|
|
597
|
+
opacity: 0
|
|
598
|
+
}),
|
|
599
|
+
...(animatePosition && {
|
|
600
|
+
transition,
|
|
601
|
+
animateOnly: ["transform"],
|
|
602
|
+
animatePresence: false
|
|
603
|
+
}),
|
|
604
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(PopperArrowFrame, {
|
|
605
|
+
width: size,
|
|
606
|
+
height: size,
|
|
607
|
+
...arrowProps,
|
|
608
|
+
...innerArrowStyle,
|
|
609
|
+
rotate: "45deg",
|
|
610
|
+
...(primaryPlacement === "bottom" && {
|
|
611
|
+
borderLeftWidth: borderWidth,
|
|
612
|
+
borderTopWidth: borderWidth
|
|
601
613
|
}),
|
|
602
|
-
...(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
animatePresence: !1
|
|
614
|
+
...(primaryPlacement === "top" && {
|
|
615
|
+
borderBottomWidth: borderWidth,
|
|
616
|
+
borderRightWidth: borderWidth
|
|
606
617
|
}),
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
borderLeftWidth: borderWidth,
|
|
615
|
-
borderTopWidth: borderWidth
|
|
616
|
-
}),
|
|
617
|
-
...(primaryPlacement === "top" && {
|
|
618
|
-
borderBottomWidth: borderWidth,
|
|
619
|
-
borderRightWidth: borderWidth
|
|
620
|
-
}),
|
|
621
|
-
...(primaryPlacement === "right" && {
|
|
622
|
-
borderLeftWidth: borderWidth,
|
|
623
|
-
borderBottomWidth: borderWidth
|
|
624
|
-
}),
|
|
625
|
-
...(primaryPlacement === "left" && {
|
|
626
|
-
borderTopWidth: borderWidth,
|
|
627
|
-
borderRightWidth: borderWidth
|
|
628
|
-
})
|
|
618
|
+
...(primaryPlacement === "right" && {
|
|
619
|
+
borderLeftWidth: borderWidth,
|
|
620
|
+
borderBottomWidth: borderWidth
|
|
621
|
+
}),
|
|
622
|
+
...(primaryPlacement === "left" && {
|
|
623
|
+
borderTopWidth: borderWidth,
|
|
624
|
+
borderRightWidth: borderWidth
|
|
629
625
|
})
|
|
630
|
-
})
|
|
626
|
+
})
|
|
631
627
|
});
|
|
628
|
+
});
|
|
632
629
|
//# sourceMappingURL=Popper.native.js.map
|