@yoopta/themes-shadcn 6.0.0-beta.14 → 6.0.0-beta.15
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/table/components/row-controls.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/accordion.js.map +0 -1
- package/dist/blockquote.js.map +0 -1
- package/dist/callout.js.map +0 -1
- package/dist/carousel.js.map +0 -1
- package/dist/chunks/Combination-2202c874.js +0 -1080
- package/dist/chunks/Combination-2202c874.js.map +0 -1
- package/dist/chunks/_tslib-514d60fe.js +0 -67
- package/dist/chunks/_tslib-514d60fe.js.map +0 -1
- package/dist/chunks/arrow-right-cc37c75c.js +0 -30
- package/dist/chunks/arrow-right-cc37c75c.js.map +0 -1
- package/dist/chunks/button-f9af7cb3.js +0 -76
- package/dist/chunks/button-f9af7cb3.js.map +0 -1
- package/dist/chunks/card-29720641.js +0 -38
- package/dist/chunks/card-29720641.js.map +0 -1
- package/dist/chunks/check-530fff0e.js +0 -14
- package/dist/chunks/check-530fff0e.js.map +0 -1
- package/dist/chunks/chevron-down-544d1acd.js +0 -16
- package/dist/chunks/chevron-down-544d1acd.js.map +0 -1
- package/dist/chunks/chevron-up-053cba03.js +0 -14
- package/dist/chunks/chevron-up-053cba03.js.map +0 -1
- package/dist/chunks/code-2ff9cc0c.js +0 -17
- package/dist/chunks/code-2ff9cc0c.js.map +0 -1
- package/dist/chunks/createLucideIcon-02eb7854.js +0 -95
- package/dist/chunks/createLucideIcon-02eb7854.js.map +0 -1
- package/dist/chunks/dropdown-menu-ac777fdc.js +0 -1165
- package/dist/chunks/dropdown-menu-ac777fdc.js.map +0 -1
- package/dist/chunks/external-link-43895ded.js +0 -18
- package/dist/chunks/external-link-43895ded.js.map +0 -1
- package/dist/chunks/file-text-99674d8d.js +0 -20
- package/dist/chunks/file-text-99674d8d.js.map +0 -1
- package/dist/chunks/hover-card-134f053d.js +0 -257
- package/dist/chunks/hover-card-134f053d.js.map +0 -1
- package/dist/chunks/index-056b596e.js +0 -16
- package/dist/chunks/index-056b596e.js.map +0 -1
- package/dist/chunks/index-35823769.js +0 -222
- package/dist/chunks/index-35823769.js.map +0 -1
- package/dist/chunks/index-41c4abc4.js +0 -3805
- package/dist/chunks/index-41c4abc4.js.map +0 -1
- package/dist/chunks/index-454935af.js +0 -71
- package/dist/chunks/index-454935af.js.map +0 -1
- package/dist/chunks/index-ae9b48d5.js +0 -12
- package/dist/chunks/index-ae9b48d5.js.map +0 -1
- package/dist/chunks/index-b8a83ba5.js +0 -335
- package/dist/chunks/index-b8a83ba5.js.map +0 -1
- package/dist/chunks/index-b8f2908d.js +0 -40
- package/dist/chunks/index-b8f2908d.js.map +0 -1
- package/dist/chunks/index-c655a86f.js +0 -7
- package/dist/chunks/index-c655a86f.js.map +0 -1
- package/dist/chunks/index-c90e54a4.js +0 -190
- package/dist/chunks/index-c90e54a4.js.map +0 -1
- package/dist/chunks/index-cf5f0d71.js +0 -2907
- package/dist/chunks/index-cf5f0d71.js.map +0 -1
- package/dist/chunks/index-d9171717.js +0 -13
- package/dist/chunks/index-d9171717.js.map +0 -1
- package/dist/chunks/index-dd0fd848.js +0 -70
- package/dist/chunks/index-dd0fd848.js.map +0 -1
- package/dist/chunks/input-5608c2c9.js +0 -13
- package/dist/chunks/input-5608c2c9.js.map +0 -1
- package/dist/chunks/label-c9152e49.js +0 -168
- package/dist/chunks/label-c9152e49.js.map +0 -1
- package/dist/chunks/language-select-bdc50f20.js +0 -44
- package/dist/chunks/language-select-bdc50f20.js.map +0 -1
- package/dist/chunks/play-1a34ad05.js +0 -16
- package/dist/chunks/play-1a34ad05.js.map +0 -1
- package/dist/chunks/plus-fcea2532.js +0 -17
- package/dist/chunks/plus-fcea2532.js.map +0 -1
- package/dist/chunks/popover-ef29b0ac.js +0 -300
- package/dist/chunks/popover-ef29b0ac.js.map +0 -1
- package/dist/chunks/scroll-area-17d8c584.js +0 -726
- package/dist/chunks/scroll-area-17d8c584.js.map +0 -1
- package/dist/chunks/select-98610101.js +0 -1213
- package/dist/chunks/select-98610101.js.map +0 -1
- package/dist/chunks/separator-9e6aa45b.js +0 -172
- package/dist/chunks/separator-9e6aa45b.js.map +0 -1
- package/dist/chunks/sparkles-8922a4af.js +0 -26
- package/dist/chunks/sparkles-8922a4af.js.map +0 -1
- package/dist/chunks/style-inject.es-746bb8ed.js +0 -29
- package/dist/chunks/style-inject.es-746bb8ed.js.map +0 -1
- package/dist/chunks/tabs-9cfbd3cc.js +0 -204
- package/dist/chunks/tabs-9cfbd3cc.js.map +0 -1
- package/dist/chunks/tooltip-f1e02ae0.js +0 -800
- package/dist/chunks/tooltip-f1e02ae0.js.map +0 -1
- package/dist/chunks/trash-2-be728dd2.js +0 -20
- package/dist/chunks/trash-2-be728dd2.js.map +0 -1
- package/dist/chunks/upload-0f56ec3e.js +0 -44
- package/dist/chunks/upload-0f56ec3e.js.map +0 -1
- package/dist/chunks/utils-131071a4.js +0 -2500
- package/dist/chunks/utils-131071a4.js.map +0 -1
- package/dist/chunks/x-2f6cf742.js +0 -17
- package/dist/chunks/x-2f6cf742.js.map +0 -1
- package/dist/code-group.js.map +0 -1
- package/dist/code.js.map +0 -1
- package/dist/divider.js.map +0 -1
- package/dist/embed.js.map +0 -1
- package/dist/file.js.map +0 -1
- package/dist/headings.js.map +0 -1
- package/dist/image.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/lists.js.map +0 -1
- package/dist/mention.js.map +0 -1
- package/dist/paragraph.js.map +0 -1
- package/dist/steps.js.map +0 -1
- package/dist/table-of-contents.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/tabs.js.map +0 -1
- package/dist/video.js.map +0 -1
|
@@ -1,800 +0,0 @@
|
|
|
1
|
-
import { c as createLucideIcon } from './createLucideIcon-02eb7854.js';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useLayoutEffect, useEffect } from 'react';
|
|
4
|
-
import { d as useFloating$1, e as isElement, c as createPopperScope, A as Anchor, D as DismissableLayer, C as Content, b as Arrow, R as Root2, P as Portal$1 } from './index-cf5f0d71.js';
|
|
5
|
-
import 'react-dom';
|
|
6
|
-
import { _ as __rest } from './_tslib-514d60fe.js';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
import { P as Primitive, c as createContextScope, a as composeEventHandlers, b as Presence, f as createSlottable } from './index-b8a83ba5.js';
|
|
9
|
-
import { u as useComposedRefs } from './index-b8f2908d.js';
|
|
10
|
-
import { u as useId$1 } from './index-056b596e.js';
|
|
11
|
-
import { u as useControllableState } from './index-454935af.js';
|
|
12
|
-
import { c as cn } from './utils-131071a4.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @license lucide-react v0.378.0 - ISC
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the ISC license.
|
|
18
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const RotateCw = createLucideIcon("RotateCw", [
|
|
23
|
-
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
24
|
-
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
28
|
-
const SafeReact = {
|
|
29
|
-
...React
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const useInsertionEffect = SafeReact.useInsertionEffect;
|
|
33
|
-
const useSafeInsertionEffect = useInsertionEffect || (fn => fn());
|
|
34
|
-
function useEffectEvent(callback) {
|
|
35
|
-
const ref = React.useRef(() => {
|
|
36
|
-
{
|
|
37
|
-
throw new Error('Cannot call an event handler while rendering.');
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
useSafeInsertionEffect(() => {
|
|
41
|
-
ref.current = callback;
|
|
42
|
-
});
|
|
43
|
-
return React.useCallback(function () {
|
|
44
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
-
args[_key] = arguments[_key];
|
|
46
|
-
}
|
|
47
|
-
return ref.current == null ? void 0 : ref.current(...args);
|
|
48
|
-
}, []);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
|
|
52
|
-
|
|
53
|
-
let serverHandoffComplete = false;
|
|
54
|
-
let count = 0;
|
|
55
|
-
const genId = () => // Ensure the id is unique with multiple independent versions of Floating UI
|
|
56
|
-
// on <React 18
|
|
57
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++;
|
|
58
|
-
function useFloatingId() {
|
|
59
|
-
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : undefined);
|
|
60
|
-
index(() => {
|
|
61
|
-
if (id == null) {
|
|
62
|
-
setId(genId());
|
|
63
|
-
}
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
-
}, []);
|
|
66
|
-
React.useEffect(() => {
|
|
67
|
-
serverHandoffComplete = true;
|
|
68
|
-
}, []);
|
|
69
|
-
return id;
|
|
70
|
-
}
|
|
71
|
-
const useReactId = SafeReact.useId;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Uses React 18's built-in `useId()` when available, or falls back to a
|
|
75
|
-
* slightly less performant (requiring a double render) implementation for
|
|
76
|
-
* earlier React versions.
|
|
77
|
-
* @see https://floating-ui.com/docs/react-utils#useid
|
|
78
|
-
*/
|
|
79
|
-
const useId = useReactId || useFloatingId;
|
|
80
|
-
|
|
81
|
-
let devMessageSet;
|
|
82
|
-
{
|
|
83
|
-
devMessageSet = /*#__PURE__*/new Set();
|
|
84
|
-
}
|
|
85
|
-
function error() {
|
|
86
|
-
var _devMessageSet3;
|
|
87
|
-
for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
88
|
-
messages[_key2] = arguments[_key2];
|
|
89
|
-
}
|
|
90
|
-
const message = "Floating UI: " + messages.join(' ');
|
|
91
|
-
if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
|
|
92
|
-
var _devMessageSet4;
|
|
93
|
-
(_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
|
|
94
|
-
console.error(message);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function createPubSub() {
|
|
99
|
-
const map = new Map();
|
|
100
|
-
return {
|
|
101
|
-
emit(event, data) {
|
|
102
|
-
var _map$get;
|
|
103
|
-
(_map$get = map.get(event)) == null || _map$get.forEach(handler => handler(data));
|
|
104
|
-
},
|
|
105
|
-
on(event, listener) {
|
|
106
|
-
map.set(event, [...(map.get(event) || []), listener]);
|
|
107
|
-
},
|
|
108
|
-
off(event, listener) {
|
|
109
|
-
var _map$get2;
|
|
110
|
-
map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter(l => l !== listener)) || []);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const FloatingNodeContext = /*#__PURE__*/React.createContext(null);
|
|
116
|
-
const FloatingTreeContext = /*#__PURE__*/React.createContext(null);
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Returns the parent node id for nested floating elements, if available.
|
|
120
|
-
* Returns `null` for top-level floating elements.
|
|
121
|
-
*/
|
|
122
|
-
const useFloatingParentNodeId = () => {
|
|
123
|
-
var _React$useContext;
|
|
124
|
-
return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Returns the nearest floating tree context, if available.
|
|
129
|
-
*/
|
|
130
|
-
const useFloatingTree = () => React.useContext(FloatingTreeContext);
|
|
131
|
-
|
|
132
|
-
function useFloatingRootContext(options) {
|
|
133
|
-
const {
|
|
134
|
-
open = false,
|
|
135
|
-
onOpenChange: onOpenChangeProp,
|
|
136
|
-
elements: elementsProp
|
|
137
|
-
} = options;
|
|
138
|
-
const floatingId = useId();
|
|
139
|
-
const dataRef = React.useRef({});
|
|
140
|
-
const [events] = React.useState(() => createPubSub());
|
|
141
|
-
const nested = useFloatingParentNodeId() != null;
|
|
142
|
-
{
|
|
143
|
-
const optionDomReference = elementsProp.reference;
|
|
144
|
-
if (optionDomReference && !isElement(optionDomReference)) {
|
|
145
|
-
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const [positionReference, setPositionReference] = React.useState(elementsProp.reference);
|
|
149
|
-
const onOpenChange = useEffectEvent((open, event, reason) => {
|
|
150
|
-
dataRef.current.openEvent = open ? event : undefined;
|
|
151
|
-
events.emit('openchange', {
|
|
152
|
-
open,
|
|
153
|
-
event,
|
|
154
|
-
reason,
|
|
155
|
-
nested
|
|
156
|
-
});
|
|
157
|
-
onOpenChangeProp == null || onOpenChangeProp(open, event, reason);
|
|
158
|
-
});
|
|
159
|
-
const refs = React.useMemo(() => ({
|
|
160
|
-
setPositionReference
|
|
161
|
-
}), []);
|
|
162
|
-
const elements = React.useMemo(() => ({
|
|
163
|
-
reference: positionReference || elementsProp.reference || null,
|
|
164
|
-
floating: elementsProp.floating || null,
|
|
165
|
-
domReference: elementsProp.reference
|
|
166
|
-
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
|
167
|
-
return React.useMemo(() => ({
|
|
168
|
-
dataRef,
|
|
169
|
-
open,
|
|
170
|
-
onOpenChange,
|
|
171
|
-
elements,
|
|
172
|
-
events,
|
|
173
|
-
floatingId,
|
|
174
|
-
refs
|
|
175
|
-
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Provides data to position a floating element and context to add interactions.
|
|
180
|
-
* @see https://floating-ui.com/docs/useFloating
|
|
181
|
-
*/
|
|
182
|
-
function useFloating(options) {
|
|
183
|
-
if (options === void 0) {
|
|
184
|
-
options = {};
|
|
185
|
-
}
|
|
186
|
-
const {
|
|
187
|
-
nodeId
|
|
188
|
-
} = options;
|
|
189
|
-
const internalRootContext = useFloatingRootContext({
|
|
190
|
-
...options,
|
|
191
|
-
elements: {
|
|
192
|
-
reference: null,
|
|
193
|
-
floating: null,
|
|
194
|
-
...options.elements
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
const rootContext = options.rootContext || internalRootContext;
|
|
198
|
-
const computedElements = rootContext.elements;
|
|
199
|
-
const [_domReference, setDomReference] = React.useState(null);
|
|
200
|
-
const [positionReference, _setPositionReference] = React.useState(null);
|
|
201
|
-
const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
|
|
202
|
-
const domReference = optionDomReference || _domReference;
|
|
203
|
-
const domReferenceRef = React.useRef(null);
|
|
204
|
-
const tree = useFloatingTree();
|
|
205
|
-
index(() => {
|
|
206
|
-
if (domReference) {
|
|
207
|
-
domReferenceRef.current = domReference;
|
|
208
|
-
}
|
|
209
|
-
}, [domReference]);
|
|
210
|
-
const position = useFloating$1({
|
|
211
|
-
...options,
|
|
212
|
-
elements: {
|
|
213
|
-
...computedElements,
|
|
214
|
-
...(positionReference && {
|
|
215
|
-
reference: positionReference
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
const setPositionReference = React.useCallback(node => {
|
|
220
|
-
const computedPositionReference = isElement(node) ? {
|
|
221
|
-
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
222
|
-
contextElement: node
|
|
223
|
-
} : node;
|
|
224
|
-
// Store the positionReference in state if the DOM reference is specified externally via the
|
|
225
|
-
// `elements.reference` option. This ensures that it won't be overridden on future renders.
|
|
226
|
-
_setPositionReference(computedPositionReference);
|
|
227
|
-
position.refs.setReference(computedPositionReference);
|
|
228
|
-
}, [position.refs]);
|
|
229
|
-
const setReference = React.useCallback(node => {
|
|
230
|
-
if (isElement(node) || node === null) {
|
|
231
|
-
domReferenceRef.current = node;
|
|
232
|
-
setDomReference(node);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Backwards-compatibility for passing a virtual element to `reference`
|
|
236
|
-
// after it has set the DOM reference.
|
|
237
|
-
if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
238
|
-
// Don't allow setting virtual elements using the old technique back to
|
|
239
|
-
// `null` to support `positionReference` + an unstable `reference`
|
|
240
|
-
// callback ref.
|
|
241
|
-
node !== null && !isElement(node)) {
|
|
242
|
-
position.refs.setReference(node);
|
|
243
|
-
}
|
|
244
|
-
}, [position.refs]);
|
|
245
|
-
const refs = React.useMemo(() => ({
|
|
246
|
-
...position.refs,
|
|
247
|
-
setReference,
|
|
248
|
-
setPositionReference,
|
|
249
|
-
domReference: domReferenceRef
|
|
250
|
-
}), [position.refs, setReference, setPositionReference]);
|
|
251
|
-
const elements = React.useMemo(() => ({
|
|
252
|
-
...position.elements,
|
|
253
|
-
domReference: domReference
|
|
254
|
-
}), [position.elements, domReference]);
|
|
255
|
-
const context = React.useMemo(() => ({
|
|
256
|
-
...position,
|
|
257
|
-
...rootContext,
|
|
258
|
-
refs,
|
|
259
|
-
elements,
|
|
260
|
-
nodeId
|
|
261
|
-
}), [position, refs, elements, nodeId, rootContext]);
|
|
262
|
-
index(() => {
|
|
263
|
-
rootContext.dataRef.current.floatingContext = context;
|
|
264
|
-
const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);
|
|
265
|
-
if (node) {
|
|
266
|
-
node.context = context;
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
return React.useMemo(() => ({
|
|
270
|
-
...position,
|
|
271
|
-
context,
|
|
272
|
-
refs,
|
|
273
|
-
elements
|
|
274
|
-
}), [position, refs, elements, context]);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// src/visually-hidden.tsx
|
|
278
|
-
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
279
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
280
|
-
position: "absolute",
|
|
281
|
-
border: 0,
|
|
282
|
-
width: 1,
|
|
283
|
-
height: 1,
|
|
284
|
-
padding: 0,
|
|
285
|
-
margin: -1,
|
|
286
|
-
overflow: "hidden",
|
|
287
|
-
clip: "rect(0, 0, 0, 0)",
|
|
288
|
-
whiteSpace: "nowrap",
|
|
289
|
-
wordWrap: "normal"
|
|
290
|
-
});
|
|
291
|
-
var NAME = "VisuallyHidden";
|
|
292
|
-
var VisuallyHidden = React.forwardRef(
|
|
293
|
-
(props, forwardedRef) => {
|
|
294
|
-
return /* @__PURE__ */ jsx(
|
|
295
|
-
Primitive.span,
|
|
296
|
-
{
|
|
297
|
-
...props,
|
|
298
|
-
ref: forwardedRef,
|
|
299
|
-
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
VisuallyHidden.displayName = NAME;
|
|
305
|
-
var Root = VisuallyHidden;
|
|
306
|
-
|
|
307
|
-
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
308
|
-
createPopperScope
|
|
309
|
-
]);
|
|
310
|
-
var usePopperScope = createPopperScope();
|
|
311
|
-
var PROVIDER_NAME = "TooltipProvider";
|
|
312
|
-
var DEFAULT_DELAY_DURATION = 700;
|
|
313
|
-
var TOOLTIP_OPEN = "tooltip.open";
|
|
314
|
-
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
315
|
-
var TooltipProvider$1 = (props) => {
|
|
316
|
-
const {
|
|
317
|
-
__scopeTooltip,
|
|
318
|
-
delayDuration = DEFAULT_DELAY_DURATION,
|
|
319
|
-
skipDelayDuration = 300,
|
|
320
|
-
disableHoverableContent = false,
|
|
321
|
-
children
|
|
322
|
-
} = props;
|
|
323
|
-
const isOpenDelayedRef = React.useRef(true);
|
|
324
|
-
const isPointerInTransitRef = React.useRef(false);
|
|
325
|
-
const skipDelayTimerRef = React.useRef(0);
|
|
326
|
-
React.useEffect(() => {
|
|
327
|
-
const skipDelayTimer = skipDelayTimerRef.current;
|
|
328
|
-
return () => window.clearTimeout(skipDelayTimer);
|
|
329
|
-
}, []);
|
|
330
|
-
return /* @__PURE__ */ jsx(
|
|
331
|
-
TooltipProviderContextProvider,
|
|
332
|
-
{
|
|
333
|
-
scope: __scopeTooltip,
|
|
334
|
-
isOpenDelayedRef,
|
|
335
|
-
delayDuration,
|
|
336
|
-
onOpen: React.useCallback(() => {
|
|
337
|
-
window.clearTimeout(skipDelayTimerRef.current);
|
|
338
|
-
isOpenDelayedRef.current = false;
|
|
339
|
-
}, []),
|
|
340
|
-
onClose: React.useCallback(() => {
|
|
341
|
-
window.clearTimeout(skipDelayTimerRef.current);
|
|
342
|
-
skipDelayTimerRef.current = window.setTimeout(
|
|
343
|
-
() => isOpenDelayedRef.current = true,
|
|
344
|
-
skipDelayDuration
|
|
345
|
-
);
|
|
346
|
-
}, [skipDelayDuration]),
|
|
347
|
-
isPointerInTransitRef,
|
|
348
|
-
onPointerInTransitChange: React.useCallback((inTransit) => {
|
|
349
|
-
isPointerInTransitRef.current = inTransit;
|
|
350
|
-
}, []),
|
|
351
|
-
disableHoverableContent,
|
|
352
|
-
children
|
|
353
|
-
}
|
|
354
|
-
);
|
|
355
|
-
};
|
|
356
|
-
TooltipProvider$1.displayName = PROVIDER_NAME;
|
|
357
|
-
var TOOLTIP_NAME = "Tooltip";
|
|
358
|
-
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
359
|
-
var Tooltip$1 = (props) => {
|
|
360
|
-
const {
|
|
361
|
-
__scopeTooltip,
|
|
362
|
-
children,
|
|
363
|
-
open: openProp,
|
|
364
|
-
defaultOpen,
|
|
365
|
-
onOpenChange,
|
|
366
|
-
disableHoverableContent: disableHoverableContentProp,
|
|
367
|
-
delayDuration: delayDurationProp
|
|
368
|
-
} = props;
|
|
369
|
-
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
370
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
371
|
-
const [trigger, setTrigger] = React.useState(null);
|
|
372
|
-
const contentId = useId$1();
|
|
373
|
-
const openTimerRef = React.useRef(0);
|
|
374
|
-
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
375
|
-
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
376
|
-
const wasOpenDelayedRef = React.useRef(false);
|
|
377
|
-
const [open, setOpen] = useControllableState({
|
|
378
|
-
prop: openProp,
|
|
379
|
-
defaultProp: defaultOpen ?? false,
|
|
380
|
-
onChange: (open2) => {
|
|
381
|
-
if (open2) {
|
|
382
|
-
providerContext.onOpen();
|
|
383
|
-
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
384
|
-
} else {
|
|
385
|
-
providerContext.onClose();
|
|
386
|
-
}
|
|
387
|
-
onOpenChange?.(open2);
|
|
388
|
-
},
|
|
389
|
-
caller: TOOLTIP_NAME
|
|
390
|
-
});
|
|
391
|
-
const stateAttribute = React.useMemo(() => {
|
|
392
|
-
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
393
|
-
}, [open]);
|
|
394
|
-
const handleOpen = React.useCallback(() => {
|
|
395
|
-
window.clearTimeout(openTimerRef.current);
|
|
396
|
-
openTimerRef.current = 0;
|
|
397
|
-
wasOpenDelayedRef.current = false;
|
|
398
|
-
setOpen(true);
|
|
399
|
-
}, [setOpen]);
|
|
400
|
-
const handleClose = React.useCallback(() => {
|
|
401
|
-
window.clearTimeout(openTimerRef.current);
|
|
402
|
-
openTimerRef.current = 0;
|
|
403
|
-
setOpen(false);
|
|
404
|
-
}, [setOpen]);
|
|
405
|
-
const handleDelayedOpen = React.useCallback(() => {
|
|
406
|
-
window.clearTimeout(openTimerRef.current);
|
|
407
|
-
openTimerRef.current = window.setTimeout(() => {
|
|
408
|
-
wasOpenDelayedRef.current = true;
|
|
409
|
-
setOpen(true);
|
|
410
|
-
openTimerRef.current = 0;
|
|
411
|
-
}, delayDuration);
|
|
412
|
-
}, [delayDuration, setOpen]);
|
|
413
|
-
React.useEffect(() => {
|
|
414
|
-
return () => {
|
|
415
|
-
if (openTimerRef.current) {
|
|
416
|
-
window.clearTimeout(openTimerRef.current);
|
|
417
|
-
openTimerRef.current = 0;
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
}, []);
|
|
421
|
-
return /* @__PURE__ */ jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsx(
|
|
422
|
-
TooltipContextProvider,
|
|
423
|
-
{
|
|
424
|
-
scope: __scopeTooltip,
|
|
425
|
-
contentId,
|
|
426
|
-
open,
|
|
427
|
-
stateAttribute,
|
|
428
|
-
trigger,
|
|
429
|
-
onTriggerChange: setTrigger,
|
|
430
|
-
onTriggerEnter: React.useCallback(() => {
|
|
431
|
-
if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
|
|
432
|
-
else handleOpen();
|
|
433
|
-
}, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
|
|
434
|
-
onTriggerLeave: React.useCallback(() => {
|
|
435
|
-
if (disableHoverableContent) {
|
|
436
|
-
handleClose();
|
|
437
|
-
} else {
|
|
438
|
-
window.clearTimeout(openTimerRef.current);
|
|
439
|
-
openTimerRef.current = 0;
|
|
440
|
-
}
|
|
441
|
-
}, [handleClose, disableHoverableContent]),
|
|
442
|
-
onOpen: handleOpen,
|
|
443
|
-
onClose: handleClose,
|
|
444
|
-
disableHoverableContent,
|
|
445
|
-
children
|
|
446
|
-
}
|
|
447
|
-
) });
|
|
448
|
-
};
|
|
449
|
-
Tooltip$1.displayName = TOOLTIP_NAME;
|
|
450
|
-
var TRIGGER_NAME = "TooltipTrigger";
|
|
451
|
-
var TooltipTrigger$1 = React.forwardRef(
|
|
452
|
-
(props, forwardedRef) => {
|
|
453
|
-
const { __scopeTooltip, ...triggerProps } = props;
|
|
454
|
-
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
455
|
-
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
456
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
457
|
-
const ref = React.useRef(null);
|
|
458
|
-
const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
|
|
459
|
-
const isPointerDownRef = React.useRef(false);
|
|
460
|
-
const hasPointerMoveOpenedRef = React.useRef(false);
|
|
461
|
-
const handlePointerUp = React.useCallback(() => isPointerDownRef.current = false, []);
|
|
462
|
-
React.useEffect(() => {
|
|
463
|
-
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
464
|
-
}, [handlePointerUp]);
|
|
465
|
-
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
466
|
-
Primitive.button,
|
|
467
|
-
{
|
|
468
|
-
"aria-describedby": context.open ? context.contentId : void 0,
|
|
469
|
-
"data-state": context.stateAttribute,
|
|
470
|
-
...triggerProps,
|
|
471
|
-
ref: composedRefs,
|
|
472
|
-
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
473
|
-
if (event.pointerType === "touch") return;
|
|
474
|
-
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
475
|
-
context.onTriggerEnter();
|
|
476
|
-
hasPointerMoveOpenedRef.current = true;
|
|
477
|
-
}
|
|
478
|
-
}),
|
|
479
|
-
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
480
|
-
context.onTriggerLeave();
|
|
481
|
-
hasPointerMoveOpenedRef.current = false;
|
|
482
|
-
}),
|
|
483
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
484
|
-
if (context.open) {
|
|
485
|
-
context.onClose();
|
|
486
|
-
}
|
|
487
|
-
isPointerDownRef.current = true;
|
|
488
|
-
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
489
|
-
}),
|
|
490
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
491
|
-
if (!isPointerDownRef.current) context.onOpen();
|
|
492
|
-
}),
|
|
493
|
-
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
494
|
-
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
495
|
-
}
|
|
496
|
-
) });
|
|
497
|
-
}
|
|
498
|
-
);
|
|
499
|
-
TooltipTrigger$1.displayName = TRIGGER_NAME;
|
|
500
|
-
var PORTAL_NAME = "TooltipPortal";
|
|
501
|
-
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
502
|
-
forceMount: void 0
|
|
503
|
-
});
|
|
504
|
-
var TooltipPortal = (props) => {
|
|
505
|
-
const { __scopeTooltip, forceMount, children, container } = props;
|
|
506
|
-
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
507
|
-
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children }) }) });
|
|
508
|
-
};
|
|
509
|
-
TooltipPortal.displayName = PORTAL_NAME;
|
|
510
|
-
var CONTENT_NAME = "TooltipContent";
|
|
511
|
-
var TooltipContent$1 = React.forwardRef(
|
|
512
|
-
(props, forwardedRef) => {
|
|
513
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
514
|
-
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
515
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
516
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
517
|
-
}
|
|
518
|
-
);
|
|
519
|
-
var TooltipContentHoverable = React.forwardRef((props, forwardedRef) => {
|
|
520
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
521
|
-
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
522
|
-
const ref = React.useRef(null);
|
|
523
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
524
|
-
const [pointerGraceArea, setPointerGraceArea] = React.useState(null);
|
|
525
|
-
const { trigger, onClose } = context;
|
|
526
|
-
const content = ref.current;
|
|
527
|
-
const { onPointerInTransitChange } = providerContext;
|
|
528
|
-
const handleRemoveGraceArea = React.useCallback(() => {
|
|
529
|
-
setPointerGraceArea(null);
|
|
530
|
-
onPointerInTransitChange(false);
|
|
531
|
-
}, [onPointerInTransitChange]);
|
|
532
|
-
const handleCreateGraceArea = React.useCallback(
|
|
533
|
-
(event, hoverTarget) => {
|
|
534
|
-
const currentTarget = event.currentTarget;
|
|
535
|
-
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
536
|
-
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
537
|
-
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
538
|
-
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
539
|
-
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
|
|
540
|
-
setPointerGraceArea(graceArea);
|
|
541
|
-
onPointerInTransitChange(true);
|
|
542
|
-
},
|
|
543
|
-
[onPointerInTransitChange]
|
|
544
|
-
);
|
|
545
|
-
React.useEffect(() => {
|
|
546
|
-
return () => handleRemoveGraceArea();
|
|
547
|
-
}, [handleRemoveGraceArea]);
|
|
548
|
-
React.useEffect(() => {
|
|
549
|
-
if (trigger && content) {
|
|
550
|
-
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
551
|
-
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
552
|
-
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
553
|
-
content.addEventListener("pointerleave", handleContentLeave);
|
|
554
|
-
return () => {
|
|
555
|
-
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
556
|
-
content.removeEventListener("pointerleave", handleContentLeave);
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
560
|
-
React.useEffect(() => {
|
|
561
|
-
if (pointerGraceArea) {
|
|
562
|
-
const handleTrackPointerGrace = (event) => {
|
|
563
|
-
const target = event.target;
|
|
564
|
-
const pointerPosition = { x: event.clientX, y: event.clientY };
|
|
565
|
-
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
|
|
566
|
-
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
567
|
-
if (hasEnteredTarget) {
|
|
568
|
-
handleRemoveGraceArea();
|
|
569
|
-
} else if (isPointerOutsideGraceArea) {
|
|
570
|
-
handleRemoveGraceArea();
|
|
571
|
-
onClose();
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
575
|
-
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
576
|
-
}
|
|
577
|
-
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
578
|
-
return /* @__PURE__ */ jsx(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
579
|
-
});
|
|
580
|
-
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
581
|
-
var Slottable = createSlottable("TooltipContent");
|
|
582
|
-
var TooltipContentImpl = React.forwardRef(
|
|
583
|
-
(props, forwardedRef) => {
|
|
584
|
-
const {
|
|
585
|
-
__scopeTooltip,
|
|
586
|
-
children,
|
|
587
|
-
"aria-label": ariaLabel,
|
|
588
|
-
onEscapeKeyDown,
|
|
589
|
-
onPointerDownOutside,
|
|
590
|
-
...contentProps
|
|
591
|
-
} = props;
|
|
592
|
-
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
593
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
594
|
-
const { onClose } = context;
|
|
595
|
-
React.useEffect(() => {
|
|
596
|
-
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
597
|
-
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
598
|
-
}, [onClose]);
|
|
599
|
-
React.useEffect(() => {
|
|
600
|
-
if (context.trigger) {
|
|
601
|
-
const handleScroll = (event) => {
|
|
602
|
-
const target = event.target;
|
|
603
|
-
if (target?.contains(context.trigger)) onClose();
|
|
604
|
-
};
|
|
605
|
-
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
606
|
-
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
607
|
-
}
|
|
608
|
-
}, [context.trigger, onClose]);
|
|
609
|
-
return /* @__PURE__ */ jsx(
|
|
610
|
-
DismissableLayer,
|
|
611
|
-
{
|
|
612
|
-
asChild: true,
|
|
613
|
-
disableOutsidePointerEvents: false,
|
|
614
|
-
onEscapeKeyDown,
|
|
615
|
-
onPointerDownOutside,
|
|
616
|
-
onFocusOutside: (event) => event.preventDefault(),
|
|
617
|
-
onDismiss: onClose,
|
|
618
|
-
children: /* @__PURE__ */ jsxs(
|
|
619
|
-
Content,
|
|
620
|
-
{
|
|
621
|
-
"data-state": context.stateAttribute,
|
|
622
|
-
...popperScope,
|
|
623
|
-
...contentProps,
|
|
624
|
-
ref: forwardedRef,
|
|
625
|
-
style: {
|
|
626
|
-
...contentProps.style,
|
|
627
|
-
// re-namespace exposed content custom properties
|
|
628
|
-
...{
|
|
629
|
-
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
630
|
-
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
631
|
-
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
632
|
-
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
633
|
-
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
634
|
-
}
|
|
635
|
-
},
|
|
636
|
-
children: [
|
|
637
|
-
/* @__PURE__ */ jsx(Slottable, { children }),
|
|
638
|
-
/* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
639
|
-
]
|
|
640
|
-
}
|
|
641
|
-
)
|
|
642
|
-
}
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
);
|
|
646
|
-
TooltipContent$1.displayName = CONTENT_NAME;
|
|
647
|
-
var ARROW_NAME = "TooltipArrow";
|
|
648
|
-
var TooltipArrow = React.forwardRef(
|
|
649
|
-
(props, forwardedRef) => {
|
|
650
|
-
const { __scopeTooltip, ...arrowProps } = props;
|
|
651
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
652
|
-
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
653
|
-
ARROW_NAME,
|
|
654
|
-
__scopeTooltip
|
|
655
|
-
);
|
|
656
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
657
|
-
}
|
|
658
|
-
);
|
|
659
|
-
TooltipArrow.displayName = ARROW_NAME;
|
|
660
|
-
function getExitSideFromRect(point, rect) {
|
|
661
|
-
const top = Math.abs(rect.top - point.y);
|
|
662
|
-
const bottom = Math.abs(rect.bottom - point.y);
|
|
663
|
-
const right = Math.abs(rect.right - point.x);
|
|
664
|
-
const left = Math.abs(rect.left - point.x);
|
|
665
|
-
switch (Math.min(top, bottom, right, left)) {
|
|
666
|
-
case left:
|
|
667
|
-
return "left";
|
|
668
|
-
case right:
|
|
669
|
-
return "right";
|
|
670
|
-
case top:
|
|
671
|
-
return "top";
|
|
672
|
-
case bottom:
|
|
673
|
-
return "bottom";
|
|
674
|
-
default:
|
|
675
|
-
throw new Error("unreachable");
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
|
|
679
|
-
const paddedExitPoints = [];
|
|
680
|
-
switch (exitSide) {
|
|
681
|
-
case "top":
|
|
682
|
-
paddedExitPoints.push(
|
|
683
|
-
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
|
|
684
|
-
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
685
|
-
);
|
|
686
|
-
break;
|
|
687
|
-
case "bottom":
|
|
688
|
-
paddedExitPoints.push(
|
|
689
|
-
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
690
|
-
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
|
|
691
|
-
);
|
|
692
|
-
break;
|
|
693
|
-
case "left":
|
|
694
|
-
paddedExitPoints.push(
|
|
695
|
-
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
|
|
696
|
-
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
697
|
-
);
|
|
698
|
-
break;
|
|
699
|
-
case "right":
|
|
700
|
-
paddedExitPoints.push(
|
|
701
|
-
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
702
|
-
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
|
|
703
|
-
);
|
|
704
|
-
break;
|
|
705
|
-
}
|
|
706
|
-
return paddedExitPoints;
|
|
707
|
-
}
|
|
708
|
-
function getPointsFromRect(rect) {
|
|
709
|
-
const { top, right, bottom, left } = rect;
|
|
710
|
-
return [
|
|
711
|
-
{ x: left, y: top },
|
|
712
|
-
{ x: right, y: top },
|
|
713
|
-
{ x: right, y: bottom },
|
|
714
|
-
{ x: left, y: bottom }
|
|
715
|
-
];
|
|
716
|
-
}
|
|
717
|
-
function isPointInPolygon(point, polygon) {
|
|
718
|
-
const { x, y } = point;
|
|
719
|
-
let inside = false;
|
|
720
|
-
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
721
|
-
const ii = polygon[i];
|
|
722
|
-
const jj = polygon[j];
|
|
723
|
-
const xi = ii.x;
|
|
724
|
-
const yi = ii.y;
|
|
725
|
-
const xj = jj.x;
|
|
726
|
-
const yj = jj.y;
|
|
727
|
-
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
728
|
-
if (intersect) inside = !inside;
|
|
729
|
-
}
|
|
730
|
-
return inside;
|
|
731
|
-
}
|
|
732
|
-
function getHull(points) {
|
|
733
|
-
const newPoints = points.slice();
|
|
734
|
-
newPoints.sort((a, b) => {
|
|
735
|
-
if (a.x < b.x) return -1;
|
|
736
|
-
else if (a.x > b.x) return 1;
|
|
737
|
-
else if (a.y < b.y) return -1;
|
|
738
|
-
else if (a.y > b.y) return 1;
|
|
739
|
-
else return 0;
|
|
740
|
-
});
|
|
741
|
-
return getHullPresorted(newPoints);
|
|
742
|
-
}
|
|
743
|
-
function getHullPresorted(points) {
|
|
744
|
-
if (points.length <= 1) return points.slice();
|
|
745
|
-
const upperHull = [];
|
|
746
|
-
for (let i = 0; i < points.length; i++) {
|
|
747
|
-
const p = points[i];
|
|
748
|
-
while (upperHull.length >= 2) {
|
|
749
|
-
const q = upperHull[upperHull.length - 1];
|
|
750
|
-
const r = upperHull[upperHull.length - 2];
|
|
751
|
-
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
752
|
-
else break;
|
|
753
|
-
}
|
|
754
|
-
upperHull.push(p);
|
|
755
|
-
}
|
|
756
|
-
upperHull.pop();
|
|
757
|
-
const lowerHull = [];
|
|
758
|
-
for (let i = points.length - 1; i >= 0; i--) {
|
|
759
|
-
const p = points[i];
|
|
760
|
-
while (lowerHull.length >= 2) {
|
|
761
|
-
const q = lowerHull[lowerHull.length - 1];
|
|
762
|
-
const r = lowerHull[lowerHull.length - 2];
|
|
763
|
-
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
764
|
-
else break;
|
|
765
|
-
}
|
|
766
|
-
lowerHull.push(p);
|
|
767
|
-
}
|
|
768
|
-
lowerHull.pop();
|
|
769
|
-
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
770
|
-
return upperHull;
|
|
771
|
-
} else {
|
|
772
|
-
return upperHull.concat(lowerHull);
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
var Provider = TooltipProvider$1;
|
|
776
|
-
var Root3 = Tooltip$1;
|
|
777
|
-
var Trigger = TooltipTrigger$1;
|
|
778
|
-
var Portal = TooltipPortal;
|
|
779
|
-
var Content2 = TooltipContent$1;
|
|
780
|
-
var Arrow2 = TooltipArrow;
|
|
781
|
-
|
|
782
|
-
const TooltipProvider = (_a) => {
|
|
783
|
-
var { delayDuration = 0 } = _a, props = __rest(_a, ["delayDuration"]);
|
|
784
|
-
return (jsx(Provider, Object.assign({ "data-slot": "tooltip-provider", delayDuration: delayDuration }, props)));
|
|
785
|
-
};
|
|
786
|
-
const Tooltip = (_a) => {
|
|
787
|
-
var props = __rest(_a, []);
|
|
788
|
-
return (jsx(TooltipProvider, { children: jsx(Root3, Object.assign({ "data-slot": "tooltip" }, props)) }));
|
|
789
|
-
};
|
|
790
|
-
const TooltipTrigger = (_a) => {
|
|
791
|
-
var props = __rest(_a, []);
|
|
792
|
-
return (jsx(Trigger, Object.assign({ "data-slot": "tooltip-trigger" }, props)));
|
|
793
|
-
};
|
|
794
|
-
const TooltipContent = (_a) => {
|
|
795
|
-
var { className, sideOffset = 0, children } = _a, props = __rest(_a, ["className", "sideOffset", "children"]);
|
|
796
|
-
return (jsx(Portal, { children: jsxs(Content2, Object.assign({ "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn('bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance', className) }, props, { children: [children, jsx(Arrow2, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] })) }));
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
export { RotateCw as R, TooltipProvider as T, VISUALLY_HIDDEN_STYLES as V, Tooltip as a, TooltipTrigger as b, TooltipContent as c, useFloating as u };
|
|
800
|
-
//# sourceMappingURL=tooltip-f1e02ae0.js.map
|