@vuer-ai/vuer-uikit 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/dist/chunk-25GQKTNF.mjs +105 -0
- package/dist/chunk-277NQUJD.js +99 -0
- package/dist/chunk-3FR3WKI4.mjs +24 -0
- package/dist/chunk-3Q75Z2CT.mjs +76 -0
- package/dist/chunk-5BIQ3IN7.js +93 -0
- package/dist/chunk-5GPQ7U5B.mjs +50 -0
- package/dist/chunk-66JQXJEV.mjs +272 -0
- package/dist/chunk-6ILSFDR5.mjs +161 -0
- package/dist/chunk-6L4KPPOD.mjs +90 -0
- package/dist/chunk-75QDQ67T.js +56 -0
- package/dist/chunk-7A7VNE3J.mjs +31 -0
- package/dist/chunk-7SXCVFSA.mjs +200 -0
- package/dist/chunk-7V4ELMOH.js +52 -0
- package/dist/chunk-7WUQTWQX.js +303 -0
- package/dist/chunk-A2Z57NAA.js +202 -0
- package/dist/chunk-ATDHGFVI.mjs +82 -0
- package/dist/chunk-ATEHWT2R.mjs +78 -0
- package/dist/chunk-B5EMQBVL.js +93 -0
- package/dist/chunk-CLTLT5XW.js +27 -0
- package/dist/chunk-COFRS37Z.mjs +337 -0
- package/dist/chunk-CP7QYV4N.mjs +110 -0
- package/dist/chunk-CZSRIDXN.mjs +165 -0
- package/dist/chunk-D4C5V4EN.mjs +53 -0
- package/dist/chunk-DWIK2CUV.mjs +45 -0
- package/dist/chunk-ECWCQWV5.js +148 -0
- package/dist/chunk-ENZI5WM7.js +108 -0
- package/dist/chunk-FVT46HEE.js +21 -0
- package/dist/chunk-FXIL4NQZ.js +58 -0
- package/dist/chunk-FYS6YECN.js +33 -0
- package/dist/chunk-G7XNQVPB.js +187 -0
- package/dist/chunk-GSXXTAQ3.js +373 -0
- package/dist/chunk-HUQZOPYD.js +2 -0
- package/dist/chunk-HW6SLBO3.mjs +9 -0
- package/dist/chunk-IPKCIMU4.mjs +156 -0
- package/dist/chunk-J7PTSP4Q.mjs +19 -0
- package/dist/chunk-KJ42IGH6.js +2 -0
- package/dist/chunk-KO7BQ6RR.js +83 -0
- package/dist/chunk-KQHNQQUZ.js +103 -0
- package/dist/chunk-KVFK3YC7.js +187 -0
- package/dist/chunk-KYKEJFJT.js +110 -0
- package/dist/chunk-LD7Y34QT.js +79 -0
- package/dist/chunk-LVSI4HYF.mjs +409 -0
- package/dist/chunk-M3KBBKQR.mjs +15 -0
- package/dist/chunk-MASRZTZC.mjs +34 -0
- package/dist/chunk-NN7R5DNL.mjs +119 -0
- package/dist/chunk-OE56M4MX.js +93 -0
- package/dist/chunk-OTDY2E2A.js +163 -0
- package/dist/chunk-PKGNHHWG.mjs +60 -0
- package/dist/chunk-Q3APPCB2.mjs +91 -0
- package/dist/chunk-QOUX33X5.mjs +111 -0
- package/dist/chunk-QS7WS6DD.mjs +1 -0
- package/dist/chunk-QZASHJNJ.js +24 -0
- package/dist/chunk-R6XNT4PN.js +431 -0
- package/dist/chunk-RACVRWME.js +136 -0
- package/dist/chunk-S2F2GRDB.mjs +1 -0
- package/dist/chunk-SI56IQWH.js +102 -0
- package/dist/chunk-ST4P6AN6.js +2 -0
- package/dist/chunk-TOZYLDAL.mjs +72 -0
- package/dist/chunk-UFR656UY.mjs +87 -0
- package/dist/chunk-UWO6RBCE.js +11 -0
- package/dist/chunk-VGCVIHBR.mjs +1 -0
- package/dist/chunk-WOG6UIG5.mjs +71 -0
- package/dist/chunk-X2QENXCS.mjs +54 -0
- package/dist/chunk-XACRGXGF.js +75 -0
- package/dist/chunk-XPNUQSKQ.mjs +94 -0
- package/dist/chunk-YQORMF34.js +110 -0
- package/dist/chunk-Z37VNICQ.js +67 -0
- package/dist/chunk-ZJXBC33M.js +112 -0
- package/dist/highlight-cursor/cursor-context.d.mts +7 -0
- package/dist/highlight-cursor/cursor-context.d.ts +7 -0
- package/dist/highlight-cursor/cursor-context.js +14 -0
- package/dist/highlight-cursor/cursor-context.mjs +1 -0
- package/dist/highlight-cursor/cursor-provider.d.mts +7 -0
- package/dist/highlight-cursor/cursor-provider.d.ts +7 -0
- package/dist/highlight-cursor/cursor-provider.js +12 -0
- package/dist/highlight-cursor/cursor-provider.mjs +3 -0
- package/dist/highlight-cursor/enhanced-components.d.mts +20 -0
- package/dist/highlight-cursor/enhanced-components.d.ts +20 -0
- package/dist/highlight-cursor/enhanced-components.js +36 -0
- package/dist/highlight-cursor/enhanced-components.mjs +11 -0
- package/dist/highlight-cursor/index.d.mts +16 -0
- package/dist/highlight-cursor/index.d.ts +16 -0
- package/dist/highlight-cursor/index.js +50 -0
- package/dist/highlight-cursor/index.mjs +13 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.mts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.ts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.js +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.mjs +1 -0
- package/dist/highlight-cursor/types.d.mts +39 -0
- package/dist/highlight-cursor/types.d.ts +39 -0
- package/dist/highlight-cursor/types.js +2 -0
- package/dist/highlight-cursor/types.mjs +1 -0
- package/dist/highlight-cursor/with-cursor.d.mts +7 -0
- package/dist/highlight-cursor/with-cursor.d.ts +7 -0
- package/dist/highlight-cursor/with-cursor.js +11 -0
- package/dist/highlight-cursor/with-cursor.mjs +2 -0
- package/dist/index.css +314 -0
- package/dist/index.d.mts +51 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +425 -6744
- package/dist/index.mjs +34 -0
- package/dist/styles/theme.css +191 -0
- package/dist/styles/theme.d.mts +2 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/styles/toast.css +58 -0
- package/dist/styles/toast.d.mts +2 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/variables.css +188 -0
- package/dist/styles/variables.d.mts +2 -0
- package/dist/styles/variables.d.ts +2 -0
- package/dist/ui/avatar.d.mts +16 -0
- package/dist/ui/avatar.d.ts +16 -0
- package/dist/ui/avatar.js +23 -0
- package/dist/ui/avatar.mjs +2 -0
- package/dist/ui/badge.d.mts +14 -0
- package/dist/ui/badge.d.ts +14 -0
- package/dist/ui/badge.js +16 -0
- package/dist/ui/badge.mjs +3 -0
- package/dist/ui/button.d.mts +16 -0
- package/dist/ui/button.d.ts +16 -0
- package/dist/ui/button.js +12 -0
- package/dist/ui/button.mjs +3 -0
- package/dist/ui/card.d.mts +12 -0
- package/dist/ui/card.d.ts +12 -0
- package/dist/ui/card.js +36 -0
- package/dist/ui/card.mjs +3 -0
- package/dist/ui/checkbox.d.mts +11 -0
- package/dist/ui/checkbox.d.ts +11 -0
- package/dist/ui/checkbox.js +12 -0
- package/dist/ui/checkbox.mjs +3 -0
- package/dist/ui/collapsible.d.mts +9 -0
- package/dist/ui/collapsible.d.ts +9 -0
- package/dist/ui/collapsible.js +20 -0
- package/dist/ui/collapsible.mjs +3 -0
- package/dist/ui/dropdown.d.mts +28 -0
- package/dist/ui/dropdown.d.ts +28 -0
- package/dist/ui/dropdown.js +68 -0
- package/dist/ui/dropdown.mjs +3 -0
- package/dist/ui/index.d.mts +44 -0
- package/dist/ui/index.d.ts +44 -0
- package/dist/ui/index.js +398 -0
- package/dist/ui/index.mjs +29 -0
- package/dist/ui/input-numbers.d.mts +15 -0
- package/dist/ui/input-numbers.d.ts +15 -0
- package/dist/ui/input-numbers.js +13 -0
- package/dist/ui/input-numbers.mjs +4 -0
- package/dist/ui/input.d.mts +22 -0
- package/dist/ui/input.d.ts +22 -0
- package/dist/ui/input.js +16 -0
- package/dist/ui/input.mjs +3 -0
- package/dist/ui/layout.d.mts +12 -0
- package/dist/ui/layout.d.ts +12 -0
- package/dist/ui/layout.js +12 -0
- package/dist/ui/layout.mjs +3 -0
- package/dist/ui/modal.d.mts +28 -0
- package/dist/ui/modal.d.ts +28 -0
- package/dist/ui/modal.js +48 -0
- package/dist/ui/modal.mjs +3 -0
- package/dist/ui/popover.d.mts +10 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +23 -0
- package/dist/ui/popover.mjs +2 -0
- package/dist/ui/radio-group.d.mts +8 -0
- package/dist/ui/radio-group.d.ts +8 -0
- package/dist/ui/radio-group.js +16 -0
- package/dist/ui/radio-group.mjs +3 -0
- package/dist/ui/select.d.mts +28 -0
- package/dist/{types/ui → ui}/select.d.ts +18 -14
- package/dist/ui/select.js +48 -0
- package/dist/ui/select.mjs +3 -0
- package/dist/ui/sheet.d.mts +16 -0
- package/dist/ui/sheet.d.ts +16 -0
- package/dist/ui/sheet.js +39 -0
- package/dist/ui/sheet.mjs +2 -0
- package/dist/ui/slider.d.mts +10 -0
- package/dist/ui/slider.d.ts +10 -0
- package/dist/ui/slider.js +12 -0
- package/dist/ui/slider.mjs +3 -0
- package/dist/ui/switch.d.mts +7 -0
- package/dist/ui/switch.d.ts +7 -0
- package/dist/ui/switch.js +12 -0
- package/dist/ui/switch.mjs +3 -0
- package/dist/ui/tabs.d.mts +16 -0
- package/dist/ui/tabs.d.ts +16 -0
- package/dist/ui/tabs.js +25 -0
- package/dist/ui/tabs.mjs +4 -0
- package/dist/ui/textarea.d.mts +16 -0
- package/dist/ui/textarea.d.ts +16 -0
- package/dist/ui/textarea.js +12 -0
- package/dist/ui/textarea.mjs +3 -0
- package/dist/ui/theme-context.d.mts +17 -0
- package/dist/{types/ui → ui}/theme-context.d.ts +5 -3
- package/dist/ui/theme-context.js +14 -0
- package/dist/ui/theme-context.mjs +1 -0
- package/dist/ui/toast.d.mts +7 -0
- package/dist/ui/toast.d.ts +7 -0
- package/dist/ui/toast.js +14 -0
- package/dist/ui/toast.mjs +1 -0
- package/dist/ui/toggle-group.d.mts +12 -0
- package/dist/ui/toggle-group.d.ts +12 -0
- package/dist/ui/toggle-group.js +17 -0
- package/dist/ui/toggle-group.mjs +4 -0
- package/dist/ui/toggle.d.mts +13 -0
- package/dist/ui/toggle.d.ts +13 -0
- package/dist/ui/toggle.js +16 -0
- package/dist/ui/toggle.mjs +3 -0
- package/dist/ui/tooltip.d.mts +10 -0
- package/dist/ui/tooltip.d.ts +10 -0
- package/dist/ui/tooltip.js +23 -0
- package/dist/ui/tooltip.mjs +2 -0
- package/dist/ui/tree-view.d.mts +27 -0
- package/dist/ui/tree-view.d.ts +27 -0
- package/dist/ui/tree-view.js +11 -0
- package/dist/ui/tree-view.mjs +2 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +10 -0
- package/dist/utils/cn.mjs +1 -0
- package/dist/utils/index.d.mts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.mjs +2 -0
- package/package.json +49 -27
- package/dist/index.umd.js +0 -74
- package/dist/types/index.d.ts +0 -4
- package/dist/types/lib/utils.d.ts +0 -2
- package/dist/types/ui/button.d.ts +0 -13
- package/dist/types/ui/input.d.ts +0 -19
- package/dist/vuer-uikit.css +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
|
|
4
|
+
var chunkCLTLT5XW_js = require('./chunk-CLTLT5XW.js');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var reactDom = require('react-dom');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
var CursorProvider = ({
|
|
10
|
+
children,
|
|
11
|
+
maxOffsetX = 5,
|
|
12
|
+
maxOffsetY = 20,
|
|
13
|
+
cursorSize = 20,
|
|
14
|
+
transitionDuration = 100,
|
|
15
|
+
cursorClassName,
|
|
16
|
+
className,
|
|
17
|
+
as: Component = "div",
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const [isMouseInside, setIsMouseInside] = react.useState(false);
|
|
21
|
+
const [mousePosition, setMousePosition] = react.useState({ x: 0, y: 0 });
|
|
22
|
+
const [hoveredElementId, setHoveredElementId] = react.useState(null);
|
|
23
|
+
const [elementDimensions, setElementDimensions] = react.useState({
|
|
24
|
+
width: 0,
|
|
25
|
+
height: 0,
|
|
26
|
+
x: 0,
|
|
27
|
+
y: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
bottom: 0
|
|
30
|
+
});
|
|
31
|
+
const hoveredElementRef = react.useRef(null);
|
|
32
|
+
react.useEffect(() => {
|
|
33
|
+
const handleMouseMove = (e) => {
|
|
34
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
37
|
+
return () => document.removeEventListener("mousemove", handleMouseMove);
|
|
38
|
+
}, []);
|
|
39
|
+
const handleMouseEnter = react.useCallback(() => {
|
|
40
|
+
setIsMouseInside(true);
|
|
41
|
+
}, []);
|
|
42
|
+
const handleMouseLeave = react.useCallback(() => {
|
|
43
|
+
setIsMouseInside(false);
|
|
44
|
+
setHoveredElementId(null);
|
|
45
|
+
hoveredElementRef.current = null;
|
|
46
|
+
}, []);
|
|
47
|
+
const checkMouseInElement = react.useCallback(() => {
|
|
48
|
+
if (!hoveredElementRef.current || !hoveredElementId) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const rect = hoveredElementRef.current.getBoundingClientRect();
|
|
52
|
+
setElementDimensions({
|
|
53
|
+
width: rect.width,
|
|
54
|
+
height: rect.height,
|
|
55
|
+
x: rect.left,
|
|
56
|
+
y: rect.top,
|
|
57
|
+
right: rect.right,
|
|
58
|
+
bottom: rect.bottom
|
|
59
|
+
});
|
|
60
|
+
const isInside = mousePosition.x >= rect.left && mousePosition.x <= rect.right && mousePosition.y >= rect.top && mousePosition.y <= rect.bottom;
|
|
61
|
+
if (!isInside) {
|
|
62
|
+
setHoveredElementId(null);
|
|
63
|
+
hoveredElementRef.current = null;
|
|
64
|
+
}
|
|
65
|
+
}, [mousePosition, hoveredElementId]);
|
|
66
|
+
react.useEffect(() => {
|
|
67
|
+
const handleScroll = () => {
|
|
68
|
+
checkMouseInElement();
|
|
69
|
+
};
|
|
70
|
+
document.addEventListener("scroll", handleScroll, { passive: true, capture: true });
|
|
71
|
+
return () => {
|
|
72
|
+
document.removeEventListener("scroll", handleScroll, { capture: true });
|
|
73
|
+
};
|
|
74
|
+
}, [checkMouseInElement]);
|
|
75
|
+
const registerHoveredElement = react.useCallback(
|
|
76
|
+
(id, dimensions, element) => {
|
|
77
|
+
setHoveredElementId(id);
|
|
78
|
+
setElementDimensions({
|
|
79
|
+
width: dimensions.width,
|
|
80
|
+
height: dimensions.height,
|
|
81
|
+
x: dimensions.left,
|
|
82
|
+
y: dimensions.top,
|
|
83
|
+
right: dimensions.right,
|
|
84
|
+
bottom: dimensions.bottom
|
|
85
|
+
});
|
|
86
|
+
if (element) {
|
|
87
|
+
hoveredElementRef.current = element;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
92
|
+
const unregisterHoveredElement = react.useCallback(() => {
|
|
93
|
+
setHoveredElementId(null);
|
|
94
|
+
hoveredElementRef.current = null;
|
|
95
|
+
}, []);
|
|
96
|
+
const updateElementDimensions = react.useCallback(
|
|
97
|
+
(dimensions) => {
|
|
98
|
+
if (hoveredElementId) {
|
|
99
|
+
setElementDimensions({
|
|
100
|
+
width: dimensions.width,
|
|
101
|
+
height: dimensions.height,
|
|
102
|
+
x: dimensions.left,
|
|
103
|
+
y: dimensions.top,
|
|
104
|
+
right: dimensions.right,
|
|
105
|
+
bottom: dimensions.bottom
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[hoveredElementId]
|
|
110
|
+
);
|
|
111
|
+
const getCursorPosition = () => {
|
|
112
|
+
if (!hoveredElementId) {
|
|
113
|
+
return {
|
|
114
|
+
x: mousePosition.x - cursorSize / 2,
|
|
115
|
+
y: mousePosition.y - cursorSize / 2
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const elementCenterX = elementDimensions.x + elementDimensions.width / 2;
|
|
119
|
+
const elementCenterY = elementDimensions.y + elementDimensions.height / 2;
|
|
120
|
+
const offsetX = (mousePosition.x - elementCenterX) * 0.1;
|
|
121
|
+
const offsetY = (mousePosition.y - elementCenterY) * 0.1;
|
|
122
|
+
const boundedOffsetX = Math.max(-maxOffsetX, Math.min(maxOffsetX, offsetX));
|
|
123
|
+
const boundedOffsetY = Math.max(-maxOffsetY, Math.min(maxOffsetY, offsetY));
|
|
124
|
+
return {
|
|
125
|
+
x: elementDimensions.x + boundedOffsetX,
|
|
126
|
+
y: elementDimensions.y + boundedOffsetY
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const contextValue = react.useMemo(
|
|
130
|
+
() => ({
|
|
131
|
+
// State values that change during component lifecycle
|
|
132
|
+
mousePosition,
|
|
133
|
+
hoveredElementId,
|
|
134
|
+
elementDimensions,
|
|
135
|
+
// Callbacks that should be stable references
|
|
136
|
+
registerHoveredElement,
|
|
137
|
+
unregisterHoveredElement,
|
|
138
|
+
updateElementDimensions
|
|
139
|
+
}),
|
|
140
|
+
[
|
|
141
|
+
mousePosition,
|
|
142
|
+
hoveredElementId,
|
|
143
|
+
elementDimensions,
|
|
144
|
+
registerHoveredElement,
|
|
145
|
+
unregisterHoveredElement,
|
|
146
|
+
updateElementDimensions
|
|
147
|
+
]
|
|
148
|
+
);
|
|
149
|
+
const cursorPosition = getCursorPosition();
|
|
150
|
+
const cursorStyleObject = react.useMemo(
|
|
151
|
+
() => ({
|
|
152
|
+
left: cursorPosition.x,
|
|
153
|
+
top: cursorPosition.y,
|
|
154
|
+
width: hoveredElementId ? elementDimensions.width > 0 ? elementDimensions.width : cursorSize : cursorSize,
|
|
155
|
+
height: hoveredElementId ? elementDimensions.height > 0 ? elementDimensions.height : cursorSize : cursorSize,
|
|
156
|
+
willChange: "transform, width, height"
|
|
157
|
+
}),
|
|
158
|
+
[
|
|
159
|
+
cursorPosition.x,
|
|
160
|
+
cursorPosition.y,
|
|
161
|
+
hoveredElementId,
|
|
162
|
+
elementDimensions.width,
|
|
163
|
+
elementDimensions.height,
|
|
164
|
+
cursorSize
|
|
165
|
+
]
|
|
166
|
+
);
|
|
167
|
+
let styleClass;
|
|
168
|
+
if (hoveredElementId) {
|
|
169
|
+
styleClass = `opacity-[0.05] rounded-md transition-[width,height,left,top] duration-${transitionDuration} ease-out`;
|
|
170
|
+
} else {
|
|
171
|
+
styleClass = `opacity-90 rounded-xl z-10 transition-[width,height,left,top] duration-${transitionDuration} ease-out transition-opacity duration-${transitionDuration}`;
|
|
172
|
+
}
|
|
173
|
+
const cursorElement = isMouseInside && /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: `pointer-events-none fixed ${styleClass} ${hoveredElementId ? "" : cursorClassName || ""}`,
|
|
177
|
+
style: {
|
|
178
|
+
...cursorStyleObject,
|
|
179
|
+
backgroundColor: "var(--shadow-tertiary)"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
184
|
+
typeof document !== "undefined" && document.body && cursorElement && reactDom.createPortal(cursorElement, document.body),
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkCLTLT5XW_js.CursorContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
186
|
+
Component,
|
|
187
|
+
{
|
|
188
|
+
...props,
|
|
189
|
+
className: chunkUWO6RBCE_js.cn(className),
|
|
190
|
+
style: {
|
|
191
|
+
cursor: isMouseInside && !hoveredElementId ? "none" : "auto",
|
|
192
|
+
...props.style
|
|
193
|
+
},
|
|
194
|
+
onMouseEnter: handleMouseEnter,
|
|
195
|
+
onMouseLeave: handleMouseLeave,
|
|
196
|
+
children
|
|
197
|
+
}
|
|
198
|
+
) })
|
|
199
|
+
] });
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
exports.CursorProvider = CursorProvider;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn } from './chunk-HW6SLBO3.mjs';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Avatar({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
AvatarPrimitive.Root,
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "avatar",
|
|
11
|
+
className: cn("relative flex size-[24px] shrink-0 overflow-hidden rounded-full", className),
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function AvatarImage({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
AvatarPrimitive.Image,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "avatar-image",
|
|
21
|
+
className: cn("aspect-square size-full", className),
|
|
22
|
+
...props
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function AvatarFallback({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
AvatarPrimitive.Fallback,
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "avatar-fallback",
|
|
31
|
+
className: cn(
|
|
32
|
+
"bg-bg-tertiary flex size-full items-center justify-center rounded-full",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function AvatarGroup({ children, className, spacing = "normal", max }) {
|
|
40
|
+
const spacingClasses = {
|
|
41
|
+
tight: "-space-x-1.5",
|
|
42
|
+
normal: "-space-x-1",
|
|
43
|
+
loose: "-space-x-0.45"
|
|
44
|
+
};
|
|
45
|
+
const childrenArray = React.Children.toArray(children);
|
|
46
|
+
const displayChildren = max ? childrenArray.slice(0, max) : childrenArray;
|
|
47
|
+
const remainingCount = max && childrenArray.length > max ? childrenArray.length - max : 0;
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex", spacingClasses[spacing], className), children: [
|
|
49
|
+
displayChildren.map((child, index) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const zIndex = 30 - index;
|
|
52
|
+
if (React.isValidElement(child)) {
|
|
53
|
+
return React.cloneElement(
|
|
54
|
+
child,
|
|
55
|
+
{
|
|
56
|
+
key: index,
|
|
57
|
+
className: cn(
|
|
58
|
+
`ring-background relative ring-2 z-[${zIndex}] hover:scale-120 transition-all duration-200 ease-in-out hover:z-[100]`,
|
|
59
|
+
(_a = child.props) == null ? void 0 : _a.className
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return child;
|
|
65
|
+
}),
|
|
66
|
+
remainingCount > 0 && /* @__PURE__ */ jsx(
|
|
67
|
+
Avatar,
|
|
68
|
+
{
|
|
69
|
+
className: cn(
|
|
70
|
+
"ring-background hover:scale-120 relative cursor-default ring-2 transition-all duration-200 ease-in-out hover:z-[100]",
|
|
71
|
+
`z-[${30 - displayChildren.length}]`
|
|
72
|
+
),
|
|
73
|
+
children: /* @__PURE__ */ jsxs(AvatarFallback, { children: [
|
|
74
|
+
"+",
|
|
75
|
+
remainingCount
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { Avatar, AvatarFallback, AvatarGroup, AvatarImage };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cn } from './chunk-HW6SLBO3.mjs';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function TooltipProvider({
|
|
6
|
+
delayDuration = 0,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
TooltipPrimitive.Provider,
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "tooltip-provider",
|
|
13
|
+
delayDuration,
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function Tooltip({ ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
20
|
+
}
|
|
21
|
+
function TooltipTrigger({ ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
23
|
+
}
|
|
24
|
+
function TooltipContent({
|
|
25
|
+
className,
|
|
26
|
+
sideOffset = 0,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
31
|
+
TooltipPrimitive.Content,
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "tooltip-content",
|
|
34
|
+
sideOffset,
|
|
35
|
+
className: cn(
|
|
36
|
+
"bg-bg-secondary",
|
|
37
|
+
"text-text-primary",
|
|
38
|
+
"animate-in",
|
|
39
|
+
"text-sm",
|
|
40
|
+
"rounded-uk-md",
|
|
41
|
+
"px-lg",
|
|
42
|
+
"py-md",
|
|
43
|
+
"shadow-[0_8px_24px_0_var(--color-shadow-secondary)]",
|
|
44
|
+
"fade-in-0",
|
|
45
|
+
"zoom-in-95",
|
|
46
|
+
"data-[state=closed]:animate-out",
|
|
47
|
+
"data-[state=closed]:fade-out-0",
|
|
48
|
+
"data-[state=closed]:zoom-out-95",
|
|
49
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
50
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
51
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
52
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
53
|
+
"z-50",
|
|
54
|
+
"w-fit",
|
|
55
|
+
"origin-(--radix-tooltip-content-transform-origin)",
|
|
56
|
+
"text-balance",
|
|
57
|
+
"liquid:liquid-bg",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props,
|
|
61
|
+
children: [
|
|
62
|
+
children,
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
TooltipPrimitive.Arrow,
|
|
65
|
+
{
|
|
66
|
+
className: "fill-bg-secondary z-50 h-[9px] w-[20px] border-none liquid:liquid-bg",
|
|
67
|
+
style: {
|
|
68
|
+
clipPath: "polygon(50% 100%, 0% 0%, 100% 0%)",
|
|
69
|
+
borderRadius: "1px 1px 0 0"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var framerMotion = require('framer-motion');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactDom = require('react-dom');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/highlight-cursor/tabs-cursor-context.tsx
|
|
9
|
+
var TabsCursorContext = react.createContext(null);
|
|
10
|
+
var TabsCursorProvider = ({
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const [cursorTarget, setCursorTarget] = react.useState(null);
|
|
16
|
+
const [targetRect, setTargetRect] = react.useState(null);
|
|
17
|
+
const [mousePosition, setMousePosition] = react.useState({ x: 0, y: 0 });
|
|
18
|
+
const [isMouseInside, setIsMouseInside] = react.useState(false);
|
|
19
|
+
react.useEffect(() => {
|
|
20
|
+
const handleMouseMove = (e) => {
|
|
21
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
22
|
+
};
|
|
23
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
24
|
+
return () => document.removeEventListener("mousemove", handleMouseMove);
|
|
25
|
+
}, []);
|
|
26
|
+
react.useEffect(() => {
|
|
27
|
+
if (cursorTarget) {
|
|
28
|
+
setTargetRect(cursorTarget.getBoundingClientRect());
|
|
29
|
+
} else {
|
|
30
|
+
setTargetRect(null);
|
|
31
|
+
}
|
|
32
|
+
}, [cursorTarget]);
|
|
33
|
+
const handleMouseEnter = react.useCallback(() => {
|
|
34
|
+
setIsMouseInside(true);
|
|
35
|
+
}, []);
|
|
36
|
+
const handleMouseLeave = react.useCallback(() => {
|
|
37
|
+
setIsMouseInside(false);
|
|
38
|
+
setCursorTarget(null);
|
|
39
|
+
}, []);
|
|
40
|
+
const contextValue = { setCursorTarget };
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
...props,
|
|
45
|
+
className,
|
|
46
|
+
style: {
|
|
47
|
+
cursor: isMouseInside && !cursorTarget ? "none" : "auto",
|
|
48
|
+
...props.style
|
|
49
|
+
},
|
|
50
|
+
onMouseEnter: handleMouseEnter,
|
|
51
|
+
onMouseLeave: handleMouseLeave,
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(TabsCursorContext.Provider, { value: contextValue, children: [
|
|
53
|
+
children,
|
|
54
|
+
isMouseInside && reactDom.createPortal(
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
framerMotion.motion.div,
|
|
57
|
+
{
|
|
58
|
+
className: "pointer-events-none",
|
|
59
|
+
initial: false,
|
|
60
|
+
animate: {
|
|
61
|
+
x: targetRect ? targetRect.left : mousePosition.x - 8,
|
|
62
|
+
y: targetRect ? targetRect.top : mousePosition.y - 8,
|
|
63
|
+
width: targetRect ? targetRect.width : 16,
|
|
64
|
+
height: targetRect ? targetRect.height : 16,
|
|
65
|
+
borderRadius: targetRect && cursorTarget ? getComputedStyle(cursorTarget).borderRadius : "50%"
|
|
66
|
+
},
|
|
67
|
+
transition: { type: "spring", stiffness: 1e3, damping: 60, mass: 1 },
|
|
68
|
+
style: {
|
|
69
|
+
position: "fixed",
|
|
70
|
+
top: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
backgroundColor: "var(--shadow-tertiary)",
|
|
73
|
+
zIndex: 9999
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
document.body
|
|
78
|
+
)
|
|
79
|
+
] })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
var useTabsCursor = () => {
|
|
84
|
+
const context = react.useContext(TabsCursorContext);
|
|
85
|
+
if (!context) {
|
|
86
|
+
return { setCursorTarget: () => {
|
|
87
|
+
} };
|
|
88
|
+
}
|
|
89
|
+
return context;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.TabsCursorProvider = TabsCursorProvider;
|
|
93
|
+
exports.useTabsCursor = useTabsCursor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// src/highlight-cursor/cursor-context.tsx
|
|
6
|
+
var defaultDimensions = {
|
|
7
|
+
width: 0,
|
|
8
|
+
height: 0,
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0
|
|
11
|
+
};
|
|
12
|
+
var defaultContext = {
|
|
13
|
+
mousePosition: { x: 0, y: 0 },
|
|
14
|
+
hoveredElementId: null,
|
|
15
|
+
elementDimensions: defaultDimensions,
|
|
16
|
+
registerHoveredElement: () => {
|
|
17
|
+
},
|
|
18
|
+
unregisterHoveredElement: () => {
|
|
19
|
+
},
|
|
20
|
+
updateElementDimensions: () => {
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var CursorContext = react.createContext(defaultContext);
|
|
24
|
+
var useCursor = () => react.useContext(CursorContext);
|
|
25
|
+
|
|
26
|
+
exports.CursorContext = CursorContext;
|
|
27
|
+
exports.useCursor = useCursor;
|