@evinvest/uikit 0.1.0 → 0.1.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/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,12 +64,10 @@ function useControllableState(opts) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// src/primitives/portal.tsx
|
|
67
|
-
import
|
|
67
|
+
import "react";
|
|
68
68
|
import { createPortal } from "react-dom";
|
|
69
69
|
function Portal({ children, container }) {
|
|
70
|
-
|
|
71
|
-
React3.useEffect(() => setMounted(true), []);
|
|
72
|
-
if (!mounted) return null;
|
|
70
|
+
if (typeof document === "undefined") return null;
|
|
73
71
|
const target = container ?? document.body;
|
|
74
72
|
return createPortal(children, target);
|
|
75
73
|
}
|
|
@@ -160,12 +158,21 @@ function useFloating(opts) {
|
|
|
160
158
|
setStyle({ position: "fixed", top: Math.round(top), left: Math.round(left) });
|
|
161
159
|
setResolved({ side: placed, align });
|
|
162
160
|
}
|
|
161
|
+
let frame = 0;
|
|
162
|
+
function schedule() {
|
|
163
|
+
if (frame) return;
|
|
164
|
+
frame = requestAnimationFrame(() => {
|
|
165
|
+
frame = 0;
|
|
166
|
+
update();
|
|
167
|
+
});
|
|
168
|
+
}
|
|
163
169
|
update();
|
|
164
|
-
window.addEventListener("scroll",
|
|
165
|
-
window.addEventListener("resize",
|
|
170
|
+
window.addEventListener("scroll", schedule, true);
|
|
171
|
+
window.addEventListener("resize", schedule);
|
|
166
172
|
return () => {
|
|
167
|
-
|
|
168
|
-
window.removeEventListener("
|
|
173
|
+
if (frame) cancelAnimationFrame(frame);
|
|
174
|
+
window.removeEventListener("scroll", schedule, true);
|
|
175
|
+
window.removeEventListener("resize", schedule);
|
|
169
176
|
};
|
|
170
177
|
}, [open, side, align, offset, anchorRef]);
|
|
171
178
|
return { floatingRef, style, side: resolved.side, align: resolved.align };
|
|
@@ -2485,7 +2492,7 @@ function Slider({
|
|
|
2485
2492
|
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
2486
2493
|
};
|
|
2487
2494
|
const rangeStyle = orientation === "vertical" ? { height: `${percent}%` } : { width: `${percent}%` };
|
|
2488
|
-
const thumbStyle = orientation === "vertical" ? { bottom: `${percent}
|
|
2495
|
+
const thumbStyle = orientation === "vertical" ? { position: "absolute", bottom: `${percent}%`, left: "50%", transform: "translate(-50%, 50%)" } : { position: "absolute", left: `${percent}%`, top: "50%", transform: "translate(-50%, -50%)" };
|
|
2489
2496
|
return /* @__PURE__ */ jsxs5(
|
|
2490
2497
|
"span",
|
|
2491
2498
|
{
|