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