@bouko/react 1.9.5 → 1.9.7

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.
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { Button } from "../button";
5
- import { RowBox } from "../flex";
5
+ import { RowBox } from "../layout/flex";
6
6
  import CheckCircle from "./assets/check-circle.svg";
7
7
  import Spinner from "./assets/spinner.svg";
8
8
  export default function FormFooter({ data, validator, submit, clear }) {
@@ -7,7 +7,7 @@ import Spinner from "../../assets/icons/spinner.svg";
7
7
  import XCircle from "../../assets/icons/x-circle.svg";
8
8
  export * from "./functions";
9
9
  export * from "./types";
10
- import { RowBox } from "../flex";
10
+ import { RowBox } from "../layout/flex";
11
11
  import Input from "../input";
12
12
  import Select from "../select";
13
13
  import TextArea from "../textarea";
@@ -1,5 +1,6 @@
1
- export { default as Heading, HeadingProps } from "./layout/heading";
1
+ export { default as Heading } from "./layout/heading";
2
2
  export { default as Separator } from "./layout/separator";
3
+ export * from "./layout/flex";
3
4
  export { default as Badge } from "./text/badge";
4
5
  export { default as Dropdown } from "./dropdown/normal";
5
6
  export { default as FileUploader } from "./upload/file";
@@ -1,5 +1,6 @@
1
1
  export { default as Heading } from "./layout/heading";
2
2
  export { default as Separator } from "./layout/separator";
3
+ export * from "./layout/flex";
3
4
  export { default as Badge } from "./text/badge";
4
5
  export { default as Dropdown } from "./dropdown/normal";
5
6
  export { default as FileUploader } from "./upload/file";
@@ -0,0 +1,23 @@
1
+ import { Component } from "../../core/types";
2
+ type Props = Component & {
3
+ center?: boolean;
4
+ centerX?: boolean;
5
+ centerY?: boolean;
6
+ };
7
+ /**
8
+ * Flex containers with configurable alignment and styling.
9
+ *
10
+ * @param {string} style - Additional styles for container.
11
+ * @param {ReactNode} children - Child elements to render inside the row.
12
+ * @param {Props} opts - Variant options for styling.
13
+ **/
14
+ export declare const RowBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const ColumnBox: ({ style, children, ...opts }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ /**
18
+ * Problems
19
+ *
20
+ * - Perfect `Component`
21
+ * - Perfect `cn`
22
+ * - Perfect `tv`
23
+ **/
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, tv } from "@bouko/style";
3
+ /**
4
+ * Flex containers with configurable alignment and styling.
5
+ *
6
+ * @param {string} style - Additional styles for container.
7
+ * @param {ReactNode} children - Child elements to render inside the row.
8
+ * @param {Props} opts - Variant options for styling.
9
+ **/
10
+ export const RowBox = ({ style, children, ...opts }) => (_jsx("div", { className: cn(row(opts), style), children: children }));
11
+ export const ColumnBox = ({ style, children, ...opts }) => (_jsx("div", { className: cn(column(opts), style), children: children }));
12
+ /**
13
+ * Styling variants for flex options.
14
+ *
15
+ * @param {boolean} centerX - center children horizontally
16
+ * @param {boolean} centerY - center children vertically
17
+ * @param {boolean} center - center children on both axis
18
+ **/
19
+ const row = tv({
20
+ base: "flex",
21
+ variants: {
22
+ centerX: { true: "justify-center" },
23
+ centerY: { true: "items-center" },
24
+ center: { true: "items-center justify-center" }
25
+ }
26
+ });
27
+ const column = tv({
28
+ base: "flex flex-col",
29
+ variants: {
30
+ centerX: { true: "items-center" },
31
+ centerY: { true: "justify-center" },
32
+ center: { true: "items-center justify-center" }
33
+ }
34
+ });
@@ -1,18 +1,17 @@
1
- import { type ReactNode } from "react";
1
+ import { ReactNode } from "react";
2
+ type Options = {
3
+ size?: "md" | "lg";
4
+ align?: "left" | "center";
5
+ };
2
6
  type Styles = {
3
7
  container?: string;
4
8
  text?: string;
5
9
  title?: string;
6
10
  subtitle?: string;
7
11
  };
8
- type Options = {
9
- size?: "md" | "lg";
10
- align?: "left" | "center";
11
- };
12
- export type HeadingProps = {
12
+ type Props = {
13
13
  options?: Options;
14
14
  styles?: Styles;
15
- container?: string;
16
15
  badge?: string;
17
16
  icon?: ReactNode;
18
17
  title: ReactNode;
@@ -21,5 +20,5 @@ export type HeadingProps = {
21
20
  subtitle?: ReactNode;
22
21
  reverse?: boolean;
23
22
  };
24
- export default function Heading({ styles, options, container, badge, icon, title, subtitle, reverse }: HeadingProps): import("react/jsx-runtime").JSX.Element;
23
+ export default function Heading({ styles, options, badge, icon, title, subtitle, reverse }: Props): import("react/jsx-runtime").JSX.Element;
25
24
  export {};
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RowBox, ColumnBox } from "../flex";
3
- import Badge from "../text/badge";
4
2
  import { cn, tv } from "@bouko/style";
5
- export default function Heading({ styles = {}, options = {}, container, badge, icon, title, subtitle, reverse }) {
3
+ import { RowBox, ColumnBox } from "..";
4
+ import Badge from "../text/badge";
5
+ export default function Heading({ styles = {}, options = {}, badge, icon, title, subtitle, reverse }) {
6
6
  const custom = test(options);
7
- return (_jsxs(RowBox, { style: cn(base.container, styles.container, container), children: [icon, _jsxs(ColumnBox, { style: cn(custom.subcontainer(), reverse && "flex-col-reverse"), children: [badge && _jsx(Badge, { style: base.badge, children: badge }), _jsx(RowBox, { style: cn(custom.title(), styles.title, styles.text), children: title }), subtitle && _jsx(RowBox, { style: cn(custom.subtitle(), styles.subtitle, styles.text), children: subtitle })] })] }));
7
+ return (_jsxs(RowBox, { style: cn(base.container, styles.container), children: [icon, _jsxs(ColumnBox, { style: cn(custom.subcontainer(), reverse && "flex-col-reverse"), children: [badge && _jsx(Badge, { style: base.badge, children: badge }), _jsx(RowBox, { style: cn(custom.title(), styles.title, styles.text), children: title }), subtitle && _jsx(RowBox, { style: cn(custom.subtitle(), styles.subtitle, styles.text), children: subtitle })] })] }));
8
8
  }
9
9
  const base = {
10
10
  container: "gap-2 items-center",
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cloneElement, useState } from "react";
4
- import { RowBox } from "./flex";
4
+ import { RowBox } from "./layout/flex";
5
5
  import { Button } from "./button";
6
6
  export function SearchBar({ button, placeholder, action }) {
7
7
  const [query, search] = useState("");
@@ -1,3 +1,8 @@
1
+ import { ReactNode } from "react";
2
+ export type Component = {
3
+ style?: string;
4
+ children: ReactNode;
5
+ };
1
6
  export type Attachment = {
2
7
  filename: string;
3
8
  mimetype: string;
@@ -1,3 +1,2 @@
1
1
  export { default as useContainer } from "./element/container";
2
2
  export { default as useResize } from "./element/resize";
3
- export { default as useColor } from "./color";
@@ -1,3 +1,2 @@
1
1
  export { default as useContainer } from "./element/container";
2
2
  export { default as useResize } from "./element/resize";
3
- export { default as useColor } from "./color";
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export { default as Attachment } from "./components/attachment";
6
6
  export { default as CheckBox } from "./components/checkbox";
7
7
  export { default as FadeCarousel } from "./components/fade-carousel";
8
8
  export * from "./components";
9
- export * from "./components/flex";
10
9
  export * from "./components/button";
11
10
  export * from "./components/search-bar";
12
11
  export * from "./core/types";
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ export { default as Attachment } from "./components/attachment";
6
6
  export { default as CheckBox } from "./components/checkbox";
7
7
  export { default as FadeCarousel } from "./components/fade-carousel";
8
8
  export * from "./components";
9
- export * from "./components/flex";
10
9
  export * from "./components/button";
11
10
  export * from "./components/search-bar";
12
11
  export * from "./core/types";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "1.9.5",
4
+ "version": "1.9.7",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",
@@ -1,5 +0,0 @@
1
- import type { ReactNode } from "react";
2
- export default function Badge({ style, children }: {
3
- style?: string;
4
- children: ReactNode;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- export default function Badge({ style, children }) {
3
- return (_jsx("span", { className: "w-min px-3 py-1 bg-accent/20 border border-accent-dark rounded-full text-xs text-accent-dark font-semibold", children: children }));
4
- }
@@ -1,16 +0,0 @@
1
- import type { ReactNode } from "react";
2
- type Props = Position & {
3
- style?: string;
4
- children: ReactNode;
5
- };
6
- type Position = {
7
- center?: boolean;
8
- centerX?: boolean;
9
- centerY?: boolean;
10
- };
11
- export declare function ColumnBox({ style, center, centerX, centerY, children }: Props): import("react/jsx-runtime").JSX.Element;
12
- export declare function RowBox({ style, children }: {
13
- style?: string;
14
- children: ReactNode;
15
- }): import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "@bouko/style";
3
- export function ColumnBox({ style, center, centerX, centerY, children }) {
4
- return (_jsx("div", { className: cn("flex flex-col", center && "items-center justify-center", centerX && "items-center", centerY && "justify-center", style), children: children }));
5
- }
6
- export function RowBox({ style, children }) {
7
- return (_jsx("div", { className: cn("flex", style), children: children }));
8
- }
@@ -1,6 +0,0 @@
1
- type Props = {
2
- placeholder?: string;
3
- action: (query: string) => void;
4
- };
5
- export default function SearchBar({ placeholder, action }: Props): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,12 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { RowBox } from "../flex";
5
- import { Button } from "../button";
6
- export default function SearchBar({ placeholder, action }) {
7
- const [query, search] = useState("");
8
- return (_jsxs(RowBox, { style: styles.container, children: [_jsxs("div", { className: "relative grow", children: [_jsx("input", { className: "w-full outline-none lowercase text-lg placeholder-slate-500 tracking-wide", placeholder: placeholder, value: query, onChange: (e) => search(e.target.value), onKeyUp: (e) => e.key === "Enter" ? action(query) : null }), _jsx("div", { className: "absolute top-0 right-0 w-12 h-full bg-gradient-to-l from-slate-950" })] }), _jsx(Button, { size: "sm", style: "gap-[0.4rem] font-extrabold py-1 px-3 font-mono", onClick: () => action(query), children: "GO" })] }));
9
- }
10
- const styles = {
11
- container: "items-center gap-6 w-xl pl-5 pr-4 py-3 bg-slate-950 border border-border rounded-md"
12
- };
@@ -1,7 +0,0 @@
1
- type Props = {
2
- variable: string;
3
- color: string;
4
- original: string;
5
- };
6
- export default function useColor({ variable, color, original }: Props): void;
7
- export {};
@@ -1,8 +0,0 @@
1
- "use client";
2
- import { useEffect } from "react";
3
- export default function useColor({ variable, color, original }) {
4
- useEffect(() => {
5
- document.documentElement.style.setProperty(`--${variable}`, color);
6
- return () => document.documentElement.style.setProperty(`--${variable}`, original);
7
- }, []);
8
- }