@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.
@@ -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,3 @@
1
+ export default function Separator({ style }: {
2
+ style?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -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,4 @@
1
+ export default function useContainer(): {
2
+ ref: import("react").RefObject<HTMLDivElement | null>;
3
+ container: HTMLElement | null | undefined;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { useRef } from "react";
3
+ export default function useContainer() {
4
+ const ref = useRef(null);
5
+ const container = ref.current?.parentElement;
6
+ return { ref, container };
7
+ }
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export { default as useContainer } from "./element/container";
2
+ export { default as useResize } from "./element/resize";
@@ -0,0 +1,2 @@
1
+ export { default as useContainer } from "./element/container";
2
+ export { default as useResize } from "./element/resize";
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";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "1.5.8",
4
+ "version": "1.5.9",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",