@bouko/react 1.5.8 → 1.5.9
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/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/layout/separator.d.ts +3 -0
- package/dist/components/layout/separator.js +24 -0
- package/dist/hooks/element/container.d.ts +4 -0
- package/dist/hooks/element/container.js +7 -0
- package/dist/hooks/element/resize.d.ts +1 -0
- package/dist/hooks/element/resize.js +12 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Separator } from "./layout/separator";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Separator } from "./layout/separator";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useContainer, useResize } from "../../hooks";
|
|
5
|
+
import { cn, tv } from "@bouko/style";
|
|
6
|
+
export default function Separator({ style }) {
|
|
7
|
+
const { container, ref } = useContainer();
|
|
8
|
+
const [flow, setFlow] = useState();
|
|
9
|
+
useResize(container, () => {
|
|
10
|
+
const css = getComputedStyle(container);
|
|
11
|
+
setFlow(css.flexDirection);
|
|
12
|
+
});
|
|
13
|
+
return (_jsx("div", { className: cn(styles({ flow }), style), ref: ref }));
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
|
+
const styles = tv({
|
|
17
|
+
base: "bg-border-dark",
|
|
18
|
+
variants: {
|
|
19
|
+
flow: {
|
|
20
|
+
row: "w-px min-w-px h-full",
|
|
21
|
+
column: "w-full h-px min-h-px"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useResizeObserver(element: HTMLElement | null | undefined, action: () => void): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
export default function useResizeObserver(element, action) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!element)
|
|
6
|
+
return;
|
|
7
|
+
const observer = new ResizeObserver(action);
|
|
8
|
+
observer.observe(element);
|
|
9
|
+
action();
|
|
10
|
+
return () => observer.disconnect();
|
|
11
|
+
}, [element, action]);
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as CheckBox } from "./components/checkbox";
|
|
|
7
7
|
export { default as Heading } from "./components/heading";
|
|
8
8
|
export { default as Badge } from "./components/badge";
|
|
9
9
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
|
+
export * from "./components";
|
|
10
11
|
export * from "./components/flex";
|
|
11
12
|
export * from "./components/button";
|
|
12
13
|
export * from "./core/types";
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as CheckBox } from "./components/checkbox";
|
|
|
7
7
|
export { default as Heading } from "./components/heading";
|
|
8
8
|
export { default as Badge } from "./components/badge";
|
|
9
9
|
export { default as FadeCarousel } from "./components/fade-carousel";
|
|
10
|
+
export * from "./components";
|
|
10
11
|
export * from "./components/flex";
|
|
11
12
|
export * from "./components/button";
|
|
12
13
|
export * from "./core/types";
|