b44ui 0.2.1 → 0.2.2

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 {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { App, Card, D, Input, Scroll } from './index';
4
+ const Example = () => {
5
+ let [text, setText] = useState('');
6
+ return _jsxs(App, { htScreen: true, children: [_jsxs(Card, { row: true, children: [_jsx("h1", { children: "b44ui" }), _jsx(Input, { state: [text, setText], placeholder: 'input supports useState natively' })] }), _jsx(Card, { grow: true, children: _jsx(Scroll, { children: Array.from({ length: 24 }, (_, i) => _jsxs(D, { children: ["item ", i + 1] }, i)) }) })] });
7
+ };
8
+ import { createRoot } from 'react-dom/client';
9
+ createRoot(document.getElementById('root')).render(_jsx(Example, {}));
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { type ReactNode } from "react";
2
- import type { ClassValue } from "clsx";
1
+ import { type ReactNode } from 'react';
2
+ import type { ClassValue } from 'clsx';
3
3
  export type Color = 'red' | 'blue' | 'orange' | 'purple' | 'yellow' | 'green';
4
4
  export declare const CN: (...inputs: ClassValue[]) => string;
5
5
  export type DProps = {
@@ -12,88 +12,93 @@ export type DProps = {
12
12
  p?: number;
13
13
  wd?: number;
14
14
  ht?: number;
15
+ row?: boolean;
16
+ col?: boolean;
17
+ ratio?: number;
18
+ align?: 'start' | 'mid' | 'center' | 'end';
15
19
  };
16
- export declare const D: (props: DProps) => import("react/jsx-runtime").JSX.Element;
17
- export declare const App: (props: DProps & {
20
+ type DivProps = DProps & React.HTMLAttributes<HTMLDivElement>;
21
+ type SpanProps = DProps & React.HTMLAttributes<HTMLSpanElement>;
22
+ type AppProps = DivProps & {
18
23
  center?: boolean;
19
24
  width?: number;
20
- }) => import("react/jsx-runtime").JSX.Element;
21
- export declare const Centered: (props: DProps & {
25
+ htScreen?: boolean;
26
+ };
27
+ type InputState = [string, React.Dispatch<React.SetStateAction<string>>];
28
+ export declare const D: ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, row, col, ratio, align, ...rest }: DivProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const App: ({ children, center, width, htScreen, cn, cnIgnoreWrongUsage, gap, p, wd, ht, ...rest }: AppProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const Centered: ({ width, ...rest }: DivProps & {
22
31
  width?: number;
23
32
  }) => import("react/jsx-runtime").JSX.Element;
24
- export declare const TabList: (props: DProps) => import("react/jsx-runtime").JSX.Element;
25
- export declare const Tab: ({ title, active, click, grow, gap, p, ...rest }: DProps & {
33
+ export declare const TabList: ({ gap, ...rest }: DivProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const Tab: ({ title, active, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }: DProps & {
26
35
  title: ReactNode;
27
36
  active?: boolean;
28
37
  click?: () => void;
29
38
  } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
30
- export declare const Block: (props: DProps & {
39
+ export declare const Block: ({ label, children, row, dashed, gap, p, ...rest }: DivProps & {
31
40
  label?: ReactNode;
32
41
  row?: boolean;
33
42
  dashed?: boolean;
34
43
  }) => import("react/jsx-runtime").JSX.Element;
35
- export declare const BlockSm: (props: DProps & {
44
+ export declare const BlockSm: ({ dashed, gap, p, ...rest }: DivProps & {
36
45
  dashed?: boolean;
37
46
  }) => import("react/jsx-runtime").JSX.Element;
38
- export declare const Chip: (props: DProps & {
47
+ export declare const Chip: ({ children, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }: SpanProps & {
39
48
  click?: () => void;
40
49
  }) => import("react/jsx-runtime").JSX.Element;
41
- export declare const Card: (props: DProps) => import("react/jsx-runtime").JSX.Element;
42
- export declare const Col: (props: DProps & {
43
- align?: "start" | "center" | "end";
44
- }) => import("react/jsx-runtime").JSX.Element;
45
- export declare const Popover: (props: DProps & {
50
+ export declare const Card: ({ row, col, gap, p, ...rest }: DivProps) => import("react/jsx-runtime").JSX.Element;
51
+ export declare const Popover: ({ children, text, color, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onMouseEnter, onMouseLeave, ...rest }: SpanProps & {
46
52
  text: ReactNode;
47
53
  color?: Color;
48
54
  }) => import("react/jsx-runtime").JSX.Element;
49
- export declare const Muted: (props: DProps) => import("react/jsx-runtime").JSX.Element;
50
- export declare const A: ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, style, click, href, onClick, onKeyDown, role, tabIndex, ...rest }: DProps & {
55
+ export declare const Muted: ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }: SpanProps) => import("react/jsx-runtime").JSX.Element;
56
+ export declare const A: ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, click, href, onClick, onKeyDown, role, tabIndex, ...rest }: DProps & {
51
57
  click?: () => void;
52
58
  } & React.AnchorHTMLAttributes<HTMLAnchorElement>) => import("react/jsx-runtime").JSX.Element;
53
- export declare const Btn: ({ children, grow, gap, p, click, color, ghost, sm, ...rest }: DProps & {
59
+ export declare const Btn: ({ children, click, color, ghost, sm, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }: DProps & {
54
60
  click?: () => void;
55
61
  color?: Color;
56
62
  ghost?: boolean;
57
63
  sm?: boolean;
58
64
  } & React.ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
59
- export declare const Tint: (props: DProps & {
65
+ export declare const Tint: ({ color, gap, p, ...rest }: DivProps & {
60
66
  color: Color;
61
67
  }) => import("react/jsx-runtime").JSX.Element;
62
- export declare const Row: (props: DProps & {
63
- ratio?: number;
64
- align?: "mid" | "start" | "end";
65
- }) => import("react/jsx-runtime").JSX.Element;
66
- export declare const Toolbar: (props: DProps) => import("react/jsx-runtime").JSX.Element;
67
- export declare const Modal: (props: DProps & {
68
+ export declare const Toolbar: ({ p, ...rest }: DivProps) => import("react/jsx-runtime").JSX.Element;
69
+ export declare const Modal: ({ children, open, cn, cnIgnoreWrongUsage, gap, p, wd, ht, ...rest }: DivProps & {
68
70
  open: boolean;
69
71
  }) => import("react/jsx-runtime").JSX.Element | null;
70
- export declare const Input: ({ cn, cnIgnoreWrongUsage, grow, ...rest }: DProps & React.InputHTMLAttributes<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element;
71
- export declare const Textarea: ({ cn, cnIgnoreWrongUsage, ref, grow, ...rest }: DProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
72
+ export declare const Input: ({ state, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, ...rest }: DProps & React.InputHTMLAttributes<HTMLInputElement> & {
73
+ state?: InputState;
74
+ }) => import("react/jsx-runtime").JSX.Element;
75
+ export declare const Textarea: ({ cn, cnIgnoreWrongUsage, ref, grow, gap, p, wd, ht, ...rest }: DProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
72
76
  ref?: React.RefObject<HTMLTextAreaElement | null>;
73
77
  }) => import("react/jsx-runtime").JSX.Element;
74
- export declare const Select: ({ cn, cnIgnoreWrongUsage, grow, ...rest }: DProps & React.SelectHTMLAttributes<HTMLSelectElement>) => import("react/jsx-runtime").JSX.Element;
75
- export declare const Grid: (props: DProps & {
78
+ export declare const Select: ({ cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }: DProps & React.SelectHTMLAttributes<HTMLSelectElement>) => import("react/jsx-runtime").JSX.Element;
79
+ export declare const Grid: ({ children, cols, gap, ...rest }: DivProps & {
76
80
  cols?: number;
77
81
  }) => import("react/jsx-runtime").JSX.Element;
78
- export declare const Hr: ({ vertical, color, grow, gap, p, ...rest }: DProps & {
82
+ export declare const Scroll: ({ grow, ...rest }: DivProps) => import("react/jsx-runtime").JSX.Element;
83
+ export declare const Hr: ({ vertical, color, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }: DProps & {
79
84
  vertical?: boolean;
80
85
  color?: Color | "gray";
81
- }) => import("react/jsx-runtime").JSX.Element;
82
- export declare const Progress: ({ value, color, dot, grow, gap, p, ...rest }: DProps & {
86
+ } & React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
87
+ export declare const Progress: ({ value, color, dot, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }: DProps & {
83
88
  value: number;
84
89
  color?: Color;
85
90
  dot?: boolean;
86
- }) => import("react/jsx-runtime").JSX.Element;
87
- export declare const Dropzone: ({ children, onFiles, multiple, accept, click, onClick, onDragOver, onDrop, ...rest }: DProps & {
91
+ } & React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
92
+ export declare const Dropzone: ({ children, onFiles, multiple, accept, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, onDragOver, onDrop, ...rest }: DProps & {
88
93
  onFiles: (files: File[]) => void;
89
94
  multiple?: boolean;
90
95
  accept?: string;
91
96
  click?: () => void;
92
97
  } & React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
93
- export declare const Code: (props: DProps & {
98
+ export declare const Code: ({ children, highlight, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }: DProps & {
94
99
  highlight?: string;
95
- }) => import("react/jsx-runtime").JSX.Element;
96
- export declare const Md: ({ children, className }: {
100
+ } & React.HTMLAttributes<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
101
+ export declare const Md: ({ children, ...rest }: {
97
102
  children: string;
98
- className?: string;
99
- }) => import("react/jsx-runtime").JSX.Element;
103
+ } & React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
104
+ export {};
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, useMemo, useRef, useState } from "react";
3
- import { Marked } from "marked";
4
- import { markedHighlight } from "marked-highlight";
5
- import hljs from "highlight.js";
6
- import clsx from "clsx";
7
- import { twMerge } from "tailwind-merge";
2
+ import { Children, useMemo, useRef, useState } from 'react';
3
+ import { Marked } from 'marked';
4
+ import { markedHighlight } from 'marked-highlight';
5
+ import hljs from 'highlight.js';
6
+ import clsx from 'clsx';
7
+ import { twMerge } from 'tailwind-merge';
8
8
  const tintMap = {
9
9
  red: 'bg-red-500/20 border-red-500',
10
10
  blue: 'bg-blue-500/20 border-blue-500',
@@ -23,73 +23,63 @@ const colorMap = {
23
23
  };
24
24
  const tintCn = (c) => tintMap[c];
25
25
  const colorCn = (c) => colorMap[c];
26
+ const growCn = (grow) => grow && 'flex-1 min-h-0';
26
27
  export const CN = (...inputs) => twMerge(clsx(inputs));
27
28
  const warnCn = (cn) => typeof cn === 'string' && cn.length > 24 && console.warn(`long cn detected (${cn.length} chars). please avoid using cn. you SHOULD use b44ui builtins instead. you SHOULD NOT use cn to add unnecessary visual enhancements. you MUST NOT have long cns. if you choose to ignore these requirements (ie. because you cannot achieve this otherwise) you MUST instead use <... cnIgnoreWrongUsage="styles..">\n cn="${cn}"`);
28
- const rcn = ({ cn, cnIgnoreWrongUsage }) => { warnCn(cn); return cn ?? cnIgnoreWrongUsage; };
29
- const sc = (n) => n !== undefined ? n * 4 : undefined; // tailwind scale -> px
29
+ const rcn = ({ cn, cnIgnoreWrongUsage, className }) => { warnCn(cn); return CN(className, cn ?? cnIgnoreWrongUsage); };
30
+ const sc = (n) => n !== undefined ? n * 4 : undefined;
30
31
  const dStyle = ({ gap, p, wd, ht, style }) => {
31
32
  const g = sc(gap), pd = sc(p);
32
33
  if (!g && !pd && wd === undefined && ht === undefined && !style)
33
34
  return undefined;
34
35
  return { ...(g !== undefined && { gap: g }), ...(pd !== undefined && { padding: pd }), ...(wd !== undefined && { width: `${wd * 100}%` }), ...(ht !== undefined && { height: `${ht * 100}%` }), ...style };
35
36
  };
36
- export const D = (props) => _jsx("div", { className: CN(props.cn ?? props.cnIgnoreWrongUsage, props.grow && "flex-1"), style: dStyle(props), children: props.children });
37
- export const App = (props) => {
38
- const { children, center = true, width, gap, p } = props;
39
- const c = rcn(props);
37
+ export const D = ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, row, col, ratio, align, ...rest }) => _jsx("div", { ...rest, className: CN(row && 'flex items-center justify-center', col && 'flex flex-col', row && align === 'mid' && 'justify-between', row && align === 'start' && 'justify-start', row && align === 'end' && 'justify-end', col && align === 'start' && 'items-start', col && (align === 'center' || align === 'mid') && 'items-center', col && align === 'end' && 'items-end', rcn({ cn, cnIgnoreWrongUsage, className: rest.className }), growCn(grow)), style: dStyle({ gap, p, wd, ht, style: { ...(ratio ? { width: `${ratio * 100}%` } : {}), ...rest.style } }), children: children });
38
+ export const App = ({ children, center = true, width, htScreen, cn, cnIgnoreWrongUsage, gap, p, wd, ht, ...rest }) => {
40
39
  const inner = Children.map(children, c => typeof c == 'string' ? _jsx(Md, { children: c.trim() }) : c);
41
- return _jsx(D, { cn: CN("min-h-screen w-full bg-[#111] text-[#eee] font-[Inter]", center && "flex justify-center items-center", c), gap: gap, p: p, children: center ? _jsx("div", { className: "max-w-full px-5 py-10 space-y-5 *:mx-auto", style: { width }, children: inner }) : inner });
42
- };
43
- export const Centered = (props) => {
44
- const { children, grow, gap, p, wd, ht, width = 700 } = props;
45
- return _jsx(D, { cn: CN("mx-auto max-w-full px-6", rcn(props)), grow: grow, gap: gap, p: p, wd: wd, ht: ht, style: { width }, children: children });
46
- };
47
- export const TabList = (props) => {
48
- const { children, grow, gap, p, wd, ht } = props;
49
- return _jsx(D, { cn: CN("flex items-end gap-4", rcn(props)), grow: grow, gap: gap, p: p, wd: wd, ht: ht, children: children });
50
- };
51
- export const Tab = ({ title, active, click, grow, gap, p, ...rest }) => {
52
- const c = rcn(rest);
53
- return _jsx("button", { className: CN("cursor-pointer border-b-2 pb-1.5 text-sm font-medium", active ? "border-zinc-100 text-zinc-100" : "border-transparent text-zinc-400 hover:text-zinc-200", grow && "flex-1", c), style: dStyle({ gap, p, wd: rest.wd, style: rest.style }), onClick: click, role: "tab", "aria-selected": active, ...rest, children: title });
54
- };
55
- export const Block = (props) => {
56
- const { label, children, row, dashed, grow, gap, p, wd, ht } = props;
57
- return _jsxs(D, { cn: CN("rounded flex flex-col items-center", dashed && "border border-dashed border-zinc-700", rcn(props)), grow: grow, gap: gap ?? 4, p: p ?? 4, wd: wd, ht: ht, children: [label && _jsx("span", { className: "opacity-75", children: label }), _jsx("div", { className: CN(row ? "flex-row" : "flex-col", "flex items-center"), style: { gap: sc(gap ?? 4) }, children: children })] });
58
- };
59
- export const BlockSm = (props) => {
60
- const { children, dashed, grow, gap, p, wd, ht } = props;
61
- return _jsx(D, { cn: CN("rounded text-sm", dashed && "border border-dashed border-zinc-700", rcn(props)), grow: grow, gap: gap, p: p ?? 2, wd: wd, ht: ht, style: { paddingLeft: sc(3), paddingRight: sc(3) }, children: children });
62
- };
63
- export const Chip = (props) => {
64
- const { children, click, gap, p, wd, ht, style } = props;
65
- return _jsx("span", { className: CN("bg-zinc-800 rounded px-2 py-0.5 text-xs", click && "cursor-pointer hover:bg-zinc-700", rcn(props)), style: dStyle({ gap, p, wd, ht, style }), onClick: click, children: children });
66
- };
67
- export const Card = (props) => {
68
- const { children, grow, gap, p, wd, ht } = props;
69
- return _jsx(D, { cn: CN("rounded border border-zinc-700 bg-zinc-900", rcn(props)), grow: grow, gap: gap ?? 4, p: p ?? 4, wd: wd, ht: ht, style: { display: 'flex', flexDirection: 'column' }, children: children });
70
- };
71
- export const Col = (props) => {
72
- const { children, grow, gap, p, wd, ht, align } = props;
73
- return _jsx(D, { cn: CN("flex flex-col", align === 'start' && 'items-start', align === 'center' && 'items-center', align === 'end' && 'items-end', rcn(props)), grow: grow, gap: gap ?? 4, p: p, wd: wd, ht: ht, children: children });
74
- };
75
- export const Popover = (props) => {
76
- const { children, text, color } = props;
77
- const c = rcn(props);
78
- const [open, setOpen] = useState(false);
79
- return _jsxs("span", { className: "relative inline-block", onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: [_jsx("span", { className: CN("cursor-pointer", color && tintCn(color), color && "border-b-2", c), children: children }), open && _jsx("div", { className: "absolute left-0 top-full z-10 mt-1", children: _jsx(Card, { cn: "w-64 shadow-lg text-sm", p: props.p ?? 3, gap: props.gap, children: text }) })] });
40
+ const wrap = center || width !== undefined || htScreen;
41
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
42
+ return _jsx("div", { ...rest, className: CN('w-full bg-[#111] text-[#eee] font-[Inter]', htScreen ? 'h-screen' : 'min-h-screen', center && !htScreen && 'flex justify-center items-center', c), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: wrap ? _jsx("div", { className: CN('max-w-full px-5', htScreen ? 'w-full h-full min-h-0 py-5 flex flex-col gap-5' : 'py-10 space-y-5', center && 'mx-auto', center && !htScreen && '[&>*]:mx-auto'), style: { width }, children: inner }) : inner });
43
+ };
44
+ export const Centered = ({ width = 700, ...rest }) => _jsx(D, { ...rest, cn: CN('mx-auto max-w-full px-6', rcn(rest)), style: { width, ...rest.style } });
45
+ export const TabList = ({ gap, ...rest }) => _jsx(D, { ...rest, cn: CN('flex items-end gap-4', rcn(rest)), gap: gap });
46
+ export const Tab = ({ title, active, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }) => {
47
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
48
+ return _jsx("button", { ...rest, className: CN('cursor-pointer border-b-2 pb-1.5 text-sm font-medium', active ? 'border-zinc-100 text-zinc-100' : 'border-transparent text-zinc-400 hover:text-zinc-200', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), onClick: e => {
49
+ click?.();
50
+ onClick?.(e);
51
+ }, role: rest.role ?? 'tab', "aria-selected": active, children: title });
80
52
  };
81
- export const Muted = (props) => {
82
- const { children, grow } = props;
83
- return _jsx("span", { className: CN("text-sm text-zinc-400", grow && "flex-1", rcn(props)), children: children });
53
+ export const Block = ({ label, children, row, dashed, gap, p, ...rest }) => _jsxs(D, { ...rest, cn: CN('rounded flex flex-col items-center', dashed && 'border border-dashed border-zinc-700', rcn(rest)), gap: gap ?? 4, p: p ?? 4, children: [label && _jsx("span", { className: 'opacity-75', children: label }), _jsx("div", { className: CN(row ? 'flex-row' : 'flex-col', 'flex items-center'), style: { gap: sc(gap ?? 4) }, children: children })] });
54
+ export const BlockSm = ({ dashed, gap, p, ...rest }) => _jsx(D, { ...rest, cn: CN('rounded text-sm', dashed && 'border border-dashed border-zinc-700', rcn(rest)), gap: gap, p: p ?? 2, style: { paddingLeft: sc(3), paddingRight: sc(3), ...rest.style } });
55
+ export const Chip = ({ children, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }) => {
56
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
57
+ return _jsx("span", { ...rest, className: CN('bg-zinc-800 rounded px-2 py-0.5 text-xs', (click || onClick) && 'cursor-pointer hover:bg-zinc-700', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), onClick: e => {
58
+ click?.();
59
+ onClick?.(e);
60
+ }, children: children });
84
61
  };
85
- export const A = ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, style, click, href, onClick, onKeyDown, role, tabIndex, ...rest }) => {
62
+ export const Card = ({ row, col, gap, p, ...rest }) => _jsx(D, { ...rest, cn: CN('rounded border border-zinc-700 bg-zinc-900 flex min-h-0', row ? 'flex-row' : 'flex-col', col && 'flex-col', rcn(rest)), gap: gap ?? 4, p: p ?? 4 });
63
+ export const Popover = ({ children, text, color, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onMouseEnter, onMouseLeave, ...rest }) => {
86
64
  const c = rcn({ cn, cnIgnoreWrongUsage });
65
+ const [open, setOpen] = useState(false);
66
+ return _jsxs("span", { ...rest, className: CN('relative inline-block', growCn(grow), rest.className), style: dStyle({ gap, p, wd, ht, style: rest.style }), onMouseEnter: e => {
67
+ setOpen(true);
68
+ onMouseEnter?.(e);
69
+ }, onMouseLeave: e => {
70
+ setOpen(false);
71
+ onMouseLeave?.(e);
72
+ }, children: [_jsx("span", { className: CN('cursor-pointer', color && tintCn(color), color && 'border-b-2', c), children: children }), open && _jsx("div", { className: 'absolute left-0 top-full z-10 mt-1', children: _jsx(Card, { cn: 'w-64 shadow-lg text-sm', p: p ?? 3, gap: gap, children: text }) })] });
73
+ };
74
+ export const Muted = ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }) => _jsx("span", { ...rest, className: CN('text-sm text-zinc-400', growCn(grow), rcn({ cn, cnIgnoreWrongUsage, className: rest.className })), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: children });
75
+ export const A = ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, click, href, onClick, onKeyDown, role, tabIndex, ...rest }) => {
76
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
87
77
  const fire = (e) => {
88
78
  click?.();
89
79
  onClick?.(e);
90
80
  };
91
81
  const buttonLike = !href;
92
- return _jsx("a", { ...rest, href: href, role: buttonLike ? role ?? 'button' : role, tabIndex: buttonLike ? tabIndex ?? 0 : tabIndex, className: CN("inline-flex items-center gap-1 text-zinc-300 underline underline-offset-4 cursor-pointer hover:text-zinc-100", grow && "flex-1", c), style: dStyle({ gap, p, wd, style }), onClick: fire, onKeyDown: e => {
82
+ return _jsx("a", { ...rest, href: href, role: buttonLike ? role ?? 'button' : role, tabIndex: buttonLike ? tabIndex ?? 0 : tabIndex, className: CN('inline-flex items-center gap-1 text-zinc-300 underline underline-offset-4 cursor-pointer hover:text-zinc-100', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), onClick: fire, onKeyDown: e => {
93
83
  if (buttonLike && (e.key === 'Enter' || e.key === ' ')) {
94
84
  e.preventDefault();
95
85
  fire(e);
@@ -97,56 +87,50 @@ export const A = ({ children, cn, cnIgnoreWrongUsage, grow, gap, p, wd, style, c
97
87
  onKeyDown?.(e);
98
88
  }, children: children });
99
89
  };
100
- export const Btn = ({ children, grow, gap, p, click, color, ghost, sm, ...rest }) => {
101
- const c = rcn(rest);
102
- return _jsx("button", { className: CN("rounded cursor-pointer", sm ? "px-3 py-1 text-xs" : "px-4 py-2 text-sm", ghost ? "bg-transparent text-zinc-400 hover:bg-zinc-800" : color ? colorCn(color) : "bg-zinc-800 hover:bg-zinc-700", grow && "flex-1", c), style: dStyle({ gap, p, wd: rest.wd, style: rest.style }), onClick: click, ...rest, children: children });
103
- };
104
- export const Tint = (props) => {
105
- const { children, color, grow, gap, p, wd, ht } = props;
106
- return _jsx(D, { cn: CN("rounded text-sm", tintCn(color), rcn(props)), grow: grow, gap: gap, p: p ?? 3, wd: wd, ht: ht, children: children });
107
- };
108
- export const Row = (props) => {
109
- const { children, ratio, align, grow, gap, p, wd, ht, style } = props;
110
- return _jsx("div", { className: CN("flex items-center justify-center", align === 'mid' && "justify-between", align == 'end' && "justify-end", align == 'start' && "justify-start", grow && "flex-1", rcn(props)), style: { ...dStyle({ gap: gap ?? 4, p, wd, ht, style }), ...(ratio ? { width: `${ratio * 100}%` } : {}) }, children: children });
111
- };
112
- export const Toolbar = (props) => {
113
- const { children, gap, p, wd, ht } = props;
114
- return _jsx(Row, { cn: CN("border-b border-zinc-700", rcn(props)), gap: gap, p: p ?? 2, wd: wd, ht: ht, align: "mid", children: children });
115
- };
116
- export const Modal = (props) => {
117
- const { children, open, gap, p, wd, ht } = props;
118
- return open ? _jsx("div", { className: "fixed inset-0 flex items-center justify-center bg-black/50 z-50", children: _jsx(Card, { cn: CN("max-h-[80vh] overflow-y-auto w-lg", rcn(props)), gap: gap, p: p, wd: wd, ht: ht, children: children }) }) : null;
119
- };
120
- export const Input = ({ cn, cnIgnoreWrongUsage, grow, ...rest }) => {
121
- const c = rcn({ cn, cnIgnoreWrongUsage });
122
- return _jsx("input", { className: CN("rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none", grow && "flex-1", c), style: dStyle({ gap: rest.gap, p: rest.p, wd: rest.wd, style: rest.style }), ...rest });
123
- };
124
- export const Textarea = ({ cn, cnIgnoreWrongUsage, ref, grow, ...rest }) => {
125
- const c = rcn({ cn, cnIgnoreWrongUsage });
126
- return _jsx("textarea", { ref: ref, className: CN("rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none w-full", grow && "flex-1", c), style: dStyle({ gap: rest.gap, p: rest.p, wd: rest.wd, style: rest.style }), ...rest });
90
+ export const Btn = ({ children, click, color, ghost, sm, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, ...rest }) => {
91
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
92
+ return _jsx("button", { ...rest, className: CN('rounded cursor-pointer', sm ? 'px-3 py-1 text-xs' : 'px-4 py-2 text-sm', ghost ? 'bg-transparent text-zinc-400 hover:bg-zinc-800' : color ? colorCn(color) : 'bg-zinc-800 hover:bg-zinc-700', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), onClick: e => {
93
+ click?.();
94
+ onClick?.(e);
95
+ }, children: children });
127
96
  };
128
- export const Select = ({ cn, cnIgnoreWrongUsage, grow, ...rest }) => {
129
- const c = rcn({ cn, cnIgnoreWrongUsage });
130
- return _jsx("select", { className: CN("rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none cursor-pointer", grow && "flex-1", c), style: dStyle({ gap: rest.gap, p: rest.p, wd: rest.wd, style: rest.style }), ...rest });
131
- };
132
- export const Grid = (props) => {
133
- const { children, cols, grow, gap, p, wd, ht } = props;
134
- return _jsx(D, { cn: CN("grid ui-grid", rcn(props)), grow: grow, p: p, wd: wd, ht: ht, style: { gap: sc(gap ?? 4), '--cols': cols ?? Children.count(children) }, children: children });
135
- };
136
- export const Hr = ({ vertical, color = 'gray', grow, gap, p, ...rest }) => {
137
- const c = rcn(rest);
138
- const border = color === 'gray' ? "border-zinc-700" : {
139
- red: "border-red-500",
140
- blue: "border-blue-500",
141
- orange: "border-orange-500",
142
- purple: "border-purple-500",
143
- yellow: "border-yellow-500",
144
- green: "border-green-500",
97
+ export const Tint = ({ color, gap, p, ...rest }) => _jsx(D, { ...rest, cn: CN('rounded text-sm', tintCn(color), rcn(rest)), gap: gap, p: p ?? 3 });
98
+ export const Toolbar = ({ p, ...rest }) => _jsx(D, { ...rest, row: true, cn: CN('border-b border-zinc-700', rcn(rest)), p: p ?? 2, gap: rest.gap ?? 4, align: 'mid' });
99
+ export const Modal = ({ children, open, cn, cnIgnoreWrongUsage, gap, p, wd, ht, ...rest }) => {
100
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
101
+ return open ? _jsx("div", { ...rest, className: CN('fixed inset-0 flex items-center justify-center bg-black/50 z-50', c), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: _jsx(Card, { cn: 'max-h-[80vh] overflow-y-auto w-lg', children: children }) }) : null;
102
+ };
103
+ export const Input = ({ state, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, ...rest }) => {
104
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
105
+ return _jsx("input", { ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), value: state ? state[0] : rest.value, onChange: e => {
106
+ state?.[1](e.target.value);
107
+ onChange?.(e);
108
+ } });
109
+ };
110
+ export const Textarea = ({ cn, cnIgnoreWrongUsage, ref, grow, gap, p, wd, ht, ...rest }) => {
111
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
112
+ return _jsx("textarea", { ref: ref, ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none w-full', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }) });
113
+ };
114
+ export const Select = ({ cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }) => {
115
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
116
+ return _jsx("select", { ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none cursor-pointer', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }) });
117
+ };
118
+ export const Grid = ({ children, cols, gap, ...rest }) => _jsx(D, { ...rest, cn: CN('grid ui-grid', rcn(rest)), gap: gap ?? 4, style: { ['--cols']: cols ?? Children.count(children), ...rest.style }, children: children });
119
+ export const Scroll = ({ grow = true, ...rest }) => _jsx(D, { ...rest, cn: CN('min-h-0 overflow-y-auto', rcn(rest)), grow: grow });
120
+ export const Hr = ({ vertical, color = 'gray', cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }) => {
121
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
122
+ const border = color === 'gray' ? 'border-zinc-700' : {
123
+ red: 'border-red-500',
124
+ blue: 'border-blue-500',
125
+ orange: 'border-orange-500',
126
+ purple: 'border-purple-500',
127
+ yellow: 'border-yellow-500',
128
+ green: 'border-green-500',
145
129
  }[color];
146
- return _jsx("div", { className: CN(vertical ? "self-stretch border-l" : "w-full border-t", border, grow && "flex-1", c), style: dStyle({ gap, p, wd: rest.wd, style: rest.style }), "aria-hidden": "true" });
130
+ return _jsx("div", { ...rest, className: CN(vertical ? 'self-stretch border-l' : 'w-full border-t', border, growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), "aria-hidden": 'true' });
147
131
  };
148
- export const Progress = ({ value, color = 'blue', dot, grow, gap, p, ...rest }) => {
149
- const c = rcn(rest);
132
+ export const Progress = ({ value, color = 'blue', dot, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }) => {
133
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
150
134
  const v = Math.max(0, Math.min(1, value));
151
135
  const fill = color === 'red' ? 'bg-red-500'
152
136
  : color === 'orange' ? 'bg-orange-500'
@@ -155,18 +139,18 @@ export const Progress = ({ value, color = 'blue', dot, grow, gap, p, ...rest })
155
139
  : color === 'green' ? 'bg-green-500'
156
140
  : 'bg-blue-500';
157
141
  if (dot)
158
- return _jsx("div", { className: CN("rounded-full border border-zinc-700 bg-zinc-800 overflow-hidden", grow && "flex-1", c), style: dStyle({ gap, p, wd: rest.wd, style: { aspectRatio: '1 / 1', ...rest.style } }), children: _jsx("div", { className: CN("h-full rounded-full", fill), style: { opacity: v ? 1 : 0.2 } }) });
159
- return _jsx("div", { className: CN("h-2 overflow-hidden rounded-full bg-zinc-800 border border-zinc-700", grow && "flex-1", c), style: dStyle({ gap, p, wd: rest.wd, style: rest.style }), children: _jsx("div", { className: CN("h-full rounded-full", fill), style: { width: `${v * 100}%` } }) });
142
+ return _jsx("div", { ...rest, className: CN('rounded-full border border-zinc-700 bg-zinc-800 overflow-hidden', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: { aspectRatio: '1 / 1', ...rest.style } }), children: _jsx("div", { className: CN('h-full rounded-full', fill), style: { opacity: v ? 1 : 0.2 } }) });
143
+ return _jsx("div", { ...rest, className: CN('h-2 overflow-hidden rounded-full bg-zinc-800 border border-zinc-700', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: _jsx("div", { className: CN('h-full rounded-full', fill), style: { width: `${v * 100}%` } }) });
160
144
  };
161
- export const Dropzone = ({ children, onFiles, multiple, accept, click, onClick, onDragOver, onDrop, ...rest }) => {
145
+ export const Dropzone = ({ children, onFiles, multiple, accept, click, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onClick, onDragOver, onDrop, ...rest }) => {
162
146
  const input = useRef(null);
163
- const c = rcn(rest);
147
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
164
148
  const push = (list) => {
165
149
  const files = list ? Array.from(list) : [];
166
150
  if (files.length)
167
151
  onFiles(files);
168
152
  };
169
- return _jsxs("div", { className: CN("contents", c), onClick: e => {
153
+ return _jsxs("div", { ...rest, className: CN(growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), onClick: e => {
170
154
  click?.();
171
155
  input.current?.click();
172
156
  onClick?.(e);
@@ -177,18 +161,17 @@ export const Dropzone = ({ children, onFiles, multiple, accept, click, onClick,
177
161
  e.preventDefault();
178
162
  push(e.dataTransfer.files);
179
163
  onDrop?.(e);
180
- }, children: [_jsx("input", { ref: input, hidden: true, type: "file", multiple: multiple, accept: accept, onChange: e => push(e.target.files) }), children] });
164
+ }, children: [_jsx("input", { ref: input, hidden: true, type: 'file', multiple: multiple, accept: accept, onChange: e => push(e.target.files) }), children] });
181
165
  };
182
- export const Code = (props) => {
183
- const { children, highlight } = props;
184
- const c = rcn(props);
166
+ export const Code = ({ children, highlight, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, ...rest }) => {
167
+ const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
185
168
  const html = useMemo(() => highlight ? hljs.highlight(children, { language: highlight }).value : '', [children, highlight]);
186
169
  if (highlight)
187
- return _jsx("pre", { className: CN("rounded bg-zinc-900 border border-zinc-700 p-3 text-sm overflow-x-auto", c), children: _jsx("code", { className: `hljs language-${highlight}`, dangerouslySetInnerHTML: { __html: html } }) });
188
- return _jsx("code", { className: CN("bg-zinc-800 rounded px-1.5 py-0.5 text-sm font-mono", c), children: children });
170
+ return _jsx("pre", { ...rest, className: CN('rounded bg-zinc-900 border border-zinc-700 p-3 text-sm overflow-x-auto', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: _jsx("code", { className: `hljs language-${highlight}`, dangerouslySetInnerHTML: { __html: html } }) });
171
+ return _jsx("code", { ...rest, className: CN('bg-zinc-800 rounded px-1.5 py-0.5 text-sm font-mono', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), children: children });
189
172
  };
190
- const marked = new Marked(markedHighlight({ langPrefix: "hljs language-", highlight: c => hljs.highlightAuto(c).value }));
191
- export const Md = ({ children, className }) => {
173
+ const marked = new Marked(markedHighlight({ langPrefix: 'hljs language-', highlight: c => hljs.highlightAuto(c).value }));
174
+ export const Md = ({ children, ...rest }) => {
192
175
  const html = useMemo(() => marked.parse(children), [children]);
193
- return _jsx("div", { className: CN("ui-markdown", className), dangerouslySetInnerHTML: { __html: html } });
176
+ return _jsx("div", { ...rest, className: CN('ui-markdown', rest.className), dangerouslySetInnerHTML: { __html: html } });
194
177
  };
package/dist/styles.css CHANGED
@@ -223,9 +223,6 @@
223
223
  .mt-1 {
224
224
  margin-top: calc(var(--spacing) * 1);
225
225
  }
226
- .contents {
227
- display: contents;
228
- }
229
226
  .flex {
230
227
  display: flex;
231
228
  }
@@ -244,9 +241,15 @@
244
241
  .h-full {
245
242
  height: 100%;
246
243
  }
244
+ .h-screen {
245
+ height: 100vh;
246
+ }
247
247
  .max-h-\[80vh\] {
248
248
  max-height: 80vh;
249
249
  }
250
+ .min-h-0 {
251
+ min-height: calc(var(--spacing) * 0);
252
+ }
250
253
  .min-h-screen {
251
254
  min-height: 100vh;
252
255
  }
@@ -301,6 +304,9 @@
301
304
  .gap-4 {
302
305
  gap: calc(var(--spacing) * 4);
303
306
  }
307
+ .gap-5 {
308
+ gap: calc(var(--spacing) * 5);
309
+ }
304
310
  .space-y-5 {
305
311
  :where(& > :not(:last-child)) {
306
312
  --tw-space-y-reverse: 0;
@@ -497,6 +503,9 @@
497
503
  .py-2 {
498
504
  padding-block: calc(var(--spacing) * 2);
499
505
  }
506
+ .py-5 {
507
+ padding-block: calc(var(--spacing) * 5);
508
+ }
500
509
  .py-10 {
501
510
  padding-block: calc(var(--spacing) * 10);
502
511
  }
@@ -690,20 +699,40 @@ code.hljs {
690
699
  color: #ffdcd7;
691
700
  background-color: #67060c;
692
701
  }
702
+ h1, h2, h3, h4 {
703
+ font-weight: 700;
704
+ line-height: 1.1;
705
+ margin: 0;
706
+ }
707
+ h1 {
708
+ font-size: 2em;
709
+ }
710
+ h2 {
711
+ font-size: 1.6em;
712
+ }
713
+ h3 {
714
+ font-size: 1.3em;
715
+ }
716
+ h4 {
717
+ font-size: 1.1em;
718
+ }
693
719
  .ui-markdown {
694
720
  line-height: 1.5;
695
721
  }
696
- .ui-markdown h1, .ui-markdown h2, .ui-markdown h3 {
722
+ .ui-markdown h1, .ui-markdown h2, .ui-markdown h3, .ui-markdown h4 {
697
723
  font-weight: 700;
698
724
  margin: 0;
699
725
  }
700
726
  .ui-markdown h1 {
701
- font-size: 1.5em;
727
+ font-size: 2em;
702
728
  }
703
729
  .ui-markdown h2 {
704
- font-size: 1.25em;
730
+ font-size: 1.6em;
705
731
  }
706
732
  .ui-markdown h3 {
733
+ font-size: 1.3em;
734
+ }
735
+ .ui-markdown h4 {
707
736
  font-size: 1.1em;
708
737
  }
709
738
  .ui-markdown p {
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ export default defineConfig({
4
+ plugins: [react()],
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b44ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "./index.js",
@@ -15,7 +15,7 @@
15
15
  "build": "npm run build:js && npm run build:css",
16
16
  "build:css": "node scripts/build-css.mjs",
17
17
  "build:js": "tsc -p tsconfig.json",
18
- "dev": "npm run dev --prefix example",
18
+ "dev": "vite",
19
19
  "prepare": "npm run build",
20
20
  "prepublishOnly": "npm run build"
21
21
  },
@@ -28,17 +28,21 @@
28
28
  "./styles.css": "./dist/styles.css"
29
29
  },
30
30
  "dependencies": {
31
+ "@vitejs/plugin-react": "^6.0.1",
31
32
  "clsx": "^2.1.1",
32
33
  "highlight.js": "^11.11.0",
33
34
  "marked": "^17.0.0",
34
35
  "marked-highlight": "^2.2.3",
35
- "tailwind-merge": "^3.0.0"
36
+ "tailwind-merge": "^3.0.0",
37
+ "vite": "^8.0.2"
36
38
  },
37
39
  "peerDependencies": {
38
40
  "react": "^19.0.0"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@types/react": "^19.2.14",
44
+ "@types/react-dom": "^19.2.3",
45
+ "react-dom": "^19.2.4",
42
46
  "tailwindcss": "^4.0.0"
43
47
  }
44
48
  }
package/readme.md CHANGED
@@ -26,14 +26,13 @@ export default defineConfig({
26
26
 
27
27
  | Component | Props | Description |
28
28
  |-----------|-------|-------------|
29
- | `App` | `center`, `width`, `cn` | Root layout, dark background, wraps strings in `Md` |
29
+ | `App` | `center`, `width`, `htScreen`, `cn`, native `div` props | Root layout, dark background, wraps strings in `Md` |
30
30
  | `Centered` | `width`, `cn`, `grow` | Centered max-width container |
31
- | `D` | `cn`, `style`, `grow`, `wd` | Plain div with `cn` |
32
- | `Row` | `align`, `ratio`, `cn`, `grow`, `wd` | Flex row, `align`: `start \| mid \| end` |
33
- | `Col` | `cn`, `grow`, `wd` | Flex column |
31
+ | `D` | `row`, `col`, `align`, `ratio`, `cn`, `style`, `grow`, `wd` | Plain div, also handles row/col layout |
32
+ | `Scroll` | `grow` (defaults `true`), native `div` props | Vertical scroll container for growable layouts |
34
33
  | `Code` | `highlight` | Code block |
35
34
  | `Grid` | `cols`, `cn`, `grow` | CSS grid, defaults to one column per child |
36
- | `Card` | `cn`, `grow` | Bordered zinc-900 card |
35
+ | `Card` | `row`, `col`, `cn`, `grow` | Bordered zinc-900 card, column by default |
37
36
  | `Block` | `label`, `row`, `dashed`, `cn`, `grow` | Padded container with optional label |
38
37
  | `BlockSm` | `dashed`, `cn`, `grow` | Smaller padded container |
39
38
  | `TabList` | `gap`, `p`, `wd` | Simple tab row wrapper |
@@ -46,13 +45,15 @@ export default defineConfig({
46
45
  | `Chip` | `click`, `cn` | Small inline badge, clickable if `click` provided |
47
46
  | `Tint` | `color`, `cn`, `grow` | Tinted background block |
48
47
  | `Muted` | `cn`, `grow` | Small muted text |
49
- | `Input` | `cn`, `grow`, ...input attrs | Styled text input |
48
+ | `Input` | `state`, `cn`, `grow`, ...input attrs | Styled text input, `state={[value, setValue]}` supported |
50
49
  | `Textarea` | `cn`, `grow`, ...textarea attrs | Styled textarea |
51
50
  | `Select` | `cn`, `grow`, ...select attrs | Styled select |
52
51
  | `Modal` | `open`, `cn` | Fixed overlay modal |
53
52
  | `Popover` | `text`, `color`, `cn` | Hover popover |
54
53
  | `Md` | `className` | Markdown renderer with syntax highlighting |
55
54
 
56
- `Color`: `red \| blue \| orange \| purple \| yellow \| green`
55
+ `Color` = `red | blue | orange | purple | yellow | green`
56
+
57
+ All rendered components forward native rest props to their underlying element, so `style`, `onClick`, `data-*`, and native element attributes work directly.
57
58
 
58
59
  All components accept `cn` for additional Tailwind classes (merged via `tailwind-merge`).