lumonui 0.1.0 → 0.2.0
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/README.md +9 -8
- package/package.json +10 -7
- package/src/badge.tsx +3 -3
- package/src/button.tsx +20 -0
- package/src/card.tsx +3 -0
- package/src/controls.tsx +12 -0
- package/src/dialog.tsx +0 -4
- package/src/field.tsx +6 -3
- package/src/file-button.tsx +0 -0
- package/src/index.ts +7 -0
- package/src/menu.tsx +4 -0
- package/src/misc.tsx +6 -0
- package/src/page-header.tsx +2 -2
- package/src/sidebar.tsx +21 -0
- package/src/styles.css +32 -0
- package/src/submit-button.tsx +6 -8
- package/src/tabs.tsx +2 -3
- package/src/toast.tsx +6 -0
- package/src/types.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# lumonui
|
|
2
2
|
|
|
3
|
-
Lumon Studio's UI: design tokens, Tailwind 4 styles and React components for
|
|
3
|
+
Lumon Studio's UI: design tokens, Tailwind 4 styles and React components for modern React apps. Source is shipped as-is (no build step).
|
|
4
4
|
|
|
5
5
|
## Use it
|
|
6
6
|
|
|
@@ -8,11 +8,6 @@ Lumon Studio's UI: design tokens, Tailwind 4 styles and React components for Nex
|
|
|
8
8
|
npm i lumonui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`next.config.ts`:
|
|
12
|
-
```ts
|
|
13
|
-
const config = { transpilePackages: ["lumonui"] };
|
|
14
|
-
```
|
|
15
|
-
|
|
16
11
|
`globals.css` (after Tailwind):
|
|
17
12
|
```css
|
|
18
13
|
@import "tailwindcss";
|
|
@@ -23,12 +18,18 @@ const config = { transpilePackages: ["lumonui"] };
|
|
|
23
18
|
import { PageHeader, Field, SubmitButton, Badge, Dialog } from "lumonui";
|
|
24
19
|
```
|
|
25
20
|
|
|
26
|
-
Needs `
|
|
21
|
+
Needs `react`, `react-dom`, `lucide-react` (the only icon library) and `tailwindcss` 4. The layout should set `--font-inter` when using a custom Inter font.
|
|
27
22
|
|
|
28
23
|
## What's inside
|
|
29
24
|
|
|
30
25
|
- `styles.css`: `@theme` tokens (colours, shadow, font) and classes: `.btn*`, `.icon-btn`, `.control`, `.card`, `.table`, `.badge*`, `.tabs`, `.dialog`, `.skeleton`, motion rules (all respect reduced motion).
|
|
31
|
-
- Components: `ActionForm`, `SubmitButton`, `Field`, `FormAlert`, `Dialog`, `PageTabs`, `PageHeader`, `EmptyState`, `TableEmpty`, `FileButton`, `Badge`.
|
|
26
|
+
- Components: `ActionForm`, `Button`, `SubmitButton`, `Field`, `FormAlert`, `Dialog`, `PageTabs`, `PageHeader`, `EmptyState`, `TableEmpty`, `FileButton`, `Badge`, `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`, `Card`, `CardHeader`, `Toaster`, `useToast`, `Menu`, `MenuItem`, `MenuSeparator`, `Skeleton`, `Avatar`, `Progress`, `Breadcrumbs`, `Pagination`.
|
|
27
|
+
|
|
28
|
+
### Core components
|
|
29
|
+
|
|
30
|
+
`Button` supports `primary`, `secondary`, `danger`, and `danger-solid` variants, `sm` sizing, loading state, and `href` links. Use `Field` around `Input`, `Textarea`, or `Select` so IDs and error/help ARIA relationships are applied automatically.
|
|
31
|
+
|
|
32
|
+
`Card` and `CardHeader` provide the 8px surface pattern. `Toaster` exposes `useToast()` for success, error, and info notices. `Menu` provides a keyboard-closeable menu surface, while `Skeleton`, `Avatar`, `Progress`, `Breadcrumbs`, and `Pagination` cover common application chrome.
|
|
32
33
|
|
|
33
34
|
## Releasing
|
|
34
35
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lumonui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Lumon Studio UI: design tokens
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Lumon Studio UI: light operational design tokens and framework-neutral React components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
8
10
|
"exports": {
|
|
9
11
|
".": "./src/index.ts",
|
|
10
12
|
"./styles.css": "./src/styles.css"
|
|
11
13
|
},
|
|
12
|
-
"scripts": {
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
13
17
|
"peerDependencies": {
|
|
14
18
|
"lucide-react": ">=1",
|
|
15
|
-
"next": ">=15",
|
|
16
19
|
"react": ">=19",
|
|
17
20
|
"react-dom": ">=19",
|
|
18
21
|
"tailwindcss": ">=4"
|
|
@@ -21,9 +24,9 @@
|
|
|
21
24
|
"@types/react": "^19.3.0",
|
|
22
25
|
"@types/react-dom": "^19.2.0",
|
|
23
26
|
"lucide-react": "^1.72.0",
|
|
24
|
-
"next": "^15.5.29",
|
|
25
27
|
"react": "^19.3.1",
|
|
26
28
|
"react-dom": "^19.3.1",
|
|
27
29
|
"typescript": "^5.9.0"
|
|
28
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {}
|
|
29
32
|
}
|
package/src/badge.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
export function Badge({ tone = "neutral", children }: { tone?: "neutral" | "green" | "orange" | "blue" | "purple" | "red" | "accent"; children: ReactNode }) {
|
|
4
|
-
return <span className={`badge badge-${tone}`}>{children}</span>;
|
|
3
|
+
export function Badge({ tone = "neutral", children, className = "", ...props }: HTMLAttributes<HTMLSpanElement> & { tone?: "neutral" | "green" | "orange" | "blue" | "purple" | "red" | "accent"; children: ReactNode }) {
|
|
4
|
+
return <span {...props} className={`badge badge-${tone} ${className}`}>{children}</span>;
|
|
5
5
|
}
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Loader2 } from "lucide-react";
|
|
2
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
type Variant = "primary" | "secondary" | "danger" | "danger-solid";
|
|
5
|
+
type Common = { variant?: Variant; size?: "default" | "sm"; loading?: boolean; children: ReactNode; className?: string };
|
|
6
|
+
type ButtonProps = Common & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & { href?: never };
|
|
7
|
+
type LinkProps = Common & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "children"> & { href: string };
|
|
8
|
+
|
|
9
|
+
export function Button(props: ButtonProps | LinkProps) {
|
|
10
|
+
const { variant = "primary", size = "default", loading = false, className = "", children, ...rest } = props;
|
|
11
|
+
const cls = `btn btn-${variant}${size === "sm" ? " btn-sm" : ""} ${className}`;
|
|
12
|
+
if ("href" in props && props.href) {
|
|
13
|
+
return <a {...(rest as AnchorHTMLAttributes<HTMLAnchorElement>)} href={props.href} className={cls} aria-disabled={loading || undefined} tabIndex={loading ? -1 : undefined}>
|
|
14
|
+
{loading && <Loader2 className="animate-spin" aria-hidden />} {children}
|
|
15
|
+
</a>;
|
|
16
|
+
}
|
|
17
|
+
return <button {...(rest as ButtonHTMLAttributes<HTMLButtonElement>)} className={cls} disabled={loading || (rest as ButtonHTMLAttributes<HTMLButtonElement>).disabled} aria-busy={loading || undefined}>
|
|
18
|
+
{loading && <Loader2 className="animate-spin" aria-hidden />} {children}
|
|
19
|
+
</button>;
|
|
20
|
+
}
|
package/src/card.tsx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export function Card({ pad = false, className = "", ...props }: HTMLAttributes<HTMLDivElement> & { pad?: boolean }) { return <div {...props} className={`card${pad ? " card-pad" : ""} ${className}`} />; }
|
|
3
|
+
export function CardHeader({ title, meta, actions, className = "" }: { title: ReactNode; meta?: ReactNode; actions?: ReactNode; className?: string }) { return <div className={`card-header ${className}`}><div><h2 className="h2">{title}</h2>{meta && <div className="meta">{meta}</div>}</div>{actions && <div className="card-actions">{actions}</div>}</div>; }
|
package/src/controls.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type Props = { prefix?: ReactNode; suffix?: ReactNode; className?: string };
|
|
4
|
+
export function Input({ prefix, suffix, className = "", ...props }: Props & InputHTMLAttributes<HTMLInputElement>) {
|
|
5
|
+
return <ControlShell prefix={prefix} suffix={suffix}><input {...props} className={`control ${className}`} /></ControlShell>;
|
|
6
|
+
}
|
|
7
|
+
export function Textarea({ className = "", ...props }: TextareaHTMLAttributes<HTMLTextAreaElement>) { return <textarea {...props} className={`control ${className}`} />; }
|
|
8
|
+
export function Select({ className = "", children, ...props }: SelectHTMLAttributes<HTMLSelectElement>) { return <select {...props} className={`control ${className}`}>{children}</select>; }
|
|
9
|
+
export function Checkbox({ label, className = "", ...props }: InputHTMLAttributes<HTMLInputElement> & { label: ReactNode }) { return <label className={`check-row ${className}`}><input {...props} type="checkbox" className="check" />{label}</label>; }
|
|
10
|
+
export function Radio({ label, className = "", ...props }: InputHTMLAttributes<HTMLInputElement> & { label: ReactNode }) { return <label className={`check-row ${className}`}><input {...props} type="radio" className="check" />{label}</label>; }
|
|
11
|
+
export function Switch({ label, className = "", ...props }: InputHTMLAttributes<HTMLInputElement> & { label?: ReactNode }) { return <label className={`switch-row ${className}`}><input {...props} type="checkbox" role="switch" />{label && <span>{label}</span>}</label>; }
|
|
12
|
+
function ControlShell({ prefix, suffix, children }: { prefix?: ReactNode; suffix?: ReactNode; children: ReactNode }) { return prefix || suffix ? <span className="control-shell">{prefix && <span className="control-slot">{prefix}</span>}{children}{suffix && <span className="control-slot">{suffix}</span>}</span> : children; }
|
package/src/dialog.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { X } from "lucide-react";
|
|
3
|
-
import { usePathname } from "next/navigation";
|
|
4
3
|
import { createContext, useContext, useEffect, useId, useRef, useState, type ReactNode } from "react";
|
|
5
4
|
|
|
6
5
|
const CloseCtx = createContext<(() => void) | null>(null);
|
|
@@ -26,9 +25,6 @@ export function Dialog({ trigger, title, description, children, triggerClassName
|
|
|
26
25
|
if (open && !d.open) d.showModal();
|
|
27
26
|
if (!open && d.open) d.close();
|
|
28
27
|
}, [open]);
|
|
29
|
-
// Layouts persist across navigation, so close when the route changes.
|
|
30
|
-
const path = usePathname();
|
|
31
|
-
useEffect(() => setOpen(false), [path]);
|
|
32
28
|
const close = () => setOpen(false);
|
|
33
29
|
return (
|
|
34
30
|
<>
|
package/src/field.tsx
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { Children, cloneElement, isValidElement, type ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
export function Field({ label, htmlFor, hint, error, children, className }: { label: string; htmlFor: string; hint?: ReactNode; error?: string; children: ReactNode; className?: string }) {
|
|
4
|
+
const describedBy = [hint && `${htmlFor}-hint`, error && `${htmlFor}-error`].filter(Boolean).join(" ") || undefined;
|
|
5
|
+
const control = Children.only(children);
|
|
6
|
+
const child = isValidElement(control) ? cloneElement(control as never, { id: htmlFor, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy } as never) : control;
|
|
4
7
|
return (
|
|
5
8
|
<div className={className}>
|
|
6
9
|
<label className="label" htmlFor={htmlFor}>{label}</label>
|
|
7
|
-
{
|
|
8
|
-
{error ? <p className="field-error" id={`${htmlFor}-error`}>{error}</p> : hint ? <p className="hint">{hint}</p> : null}
|
|
10
|
+
{child}
|
|
11
|
+
{error ? <p className="field-error" id={`${htmlFor}-error`}>{error}</p> : hint ? <p className="hint" id={`${htmlFor}-hint`}>{hint}</p> : null}
|
|
9
12
|
</div>
|
|
10
13
|
);
|
|
11
14
|
}
|
package/src/file-button.tsx
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./action-form";
|
|
2
|
+
export * from "./button";
|
|
2
3
|
export * from "./badge";
|
|
3
4
|
export * from "./dialog";
|
|
4
5
|
export * from "./empty-state";
|
|
@@ -7,4 +8,10 @@ export * from "./file-button";
|
|
|
7
8
|
export * from "./page-header";
|
|
8
9
|
export * from "./submit-button";
|
|
9
10
|
export * from "./tabs";
|
|
11
|
+
export * from "./controls";
|
|
12
|
+
export * from "./card";
|
|
13
|
+
export * from "./toast";
|
|
14
|
+
export * from "./menu";
|
|
15
|
+
export * from "./misc";
|
|
16
|
+
export * from "./sidebar";
|
|
10
17
|
export type { ActionResult } from "./types";
|
package/src/menu.tsx
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
2
|
+
export function Menu({ trigger, children }: { trigger: ReactNode; children: ReactNode }) { const [open,setOpen]=useState(false); const ref=useRef<HTMLDivElement>(null); useEffect(()=>{const close=(e:MouseEvent)=>{if(!ref.current?.contains(e.target as Node))setOpen(false)};document.addEventListener("mousedown",close);return()=>document.removeEventListener("mousedown",close)},[]); return <div className="menu" ref={ref}><button className="menu-trigger" aria-haspopup="menu" aria-expanded={open} onClick={()=>setOpen(v=>!v)}>{trigger}</button>{open&&<div className="menu-panel" role="menu" onKeyDown={e=>e.key==="Escape"&&setOpen(false)}>{children}</div>}</div> }
|
|
3
|
+
export function MenuItem({ children, destructive = false, onSelect }: { children: ReactNode; destructive?: boolean; onSelect?: ()=>void }) { return <button role="menuitem" className={`menu-item${destructive?" destructive":""}`} onClick={onSelect}>{children}</button> }
|
|
4
|
+
export function MenuSeparator(){return <div className="menu-separator" role="separator"/>}
|
package/src/misc.tsx
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export function Skeleton({ className = "" }: { className?: string }) { return <span className={`skeleton ${className}`} aria-hidden />; }
|
|
3
|
+
export function Avatar({ src, alt = "", initials, size = "md" }: { src?: string; alt?: string; initials?: string; size?: "sm" | "md" | "lg" }) { return <span className={`avatar avatar-${size}`}>{src ? <img src={src} alt={alt} /> : initials}</span>; }
|
|
4
|
+
export function Progress({ value, label, className = "" }: { value: number; label?: ReactNode; className?: string }) { return <div className={`progress ${className}`}><div className="progress-track"><span style={{ width: `${Math.max(0, Math.min(100, value))}%` }} /></div>{label && <span className="progress-label">{label}</span>}</div>; }
|
|
5
|
+
export function Breadcrumbs({ items }: { items: Array<{ label: string; href?: string }> }) { return <nav aria-label="Breadcrumb" className="breadcrumbs">{items.map((item,i)=><span key={`${item.label}-${i}`}>{i>0&&<span aria-hidden> / </span>}{item.href?<a href={item.href}>{item.label}</a>:<strong aria-current="page">{item.label}</strong>}</span>)}</nav> }
|
|
6
|
+
export function Pagination({ page, pages, onPageChange }: { page: number; pages: number; onPageChange: (page:number)=>void }) { return <nav className="pagination" aria-label="Pagination">{Array.from({length:pages},(_,i)=>i+1).map(n=><button key={n} className="page-btn" aria-current={n===page?"page":undefined} onClick={()=>onPageChange(n)}>{n}</button>)}</nav> }
|
package/src/page-header.tsx
CHANGED
|
@@ -4,10 +4,10 @@ import type { ReactNode } from "react";
|
|
|
4
4
|
* Page heading. Section pages are already named in the top bar breadcrumb, so their H1 is kept for
|
|
5
5
|
* screen readers only. Record pages (with an eyebrow, e.g. "Booking") show the record's title visibly.
|
|
6
6
|
*/
|
|
7
|
-
export function PageHeader({ eyebrow, title, subtitle, actions }: { eyebrow?: string; title: string; subtitle?: ReactNode; actions?: ReactNode }) {
|
|
7
|
+
export function PageHeader({ eyebrow, title, subtitle, actions, className = "" }: { eyebrow?: string; title: string; subtitle?: ReactNode; actions?: ReactNode; className?: string }) {
|
|
8
8
|
const visibleTitle = !!eyebrow;
|
|
9
9
|
return (
|
|
10
|
-
<div className=
|
|
10
|
+
<div className={`flex flex-col gap-4 md:flex-row md:items-end md:justify-between ${className}`}>
|
|
11
11
|
<div className="min-w-0">
|
|
12
12
|
{eyebrow && <div className="meta mb-2 text-[11px] font-medium uppercase tracking-wide">{eyebrow}</div>}
|
|
13
13
|
<h1 className={visibleTitle ? "h1" : "sr-only"}>{title}</h1>
|
package/src/sidebar.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function Sidebar({ children, collapsed = false, className = "" }: { children: ReactNode; collapsed?: boolean; className?: string }) {
|
|
4
|
+
return <aside className={`sidebar${collapsed ? " sidebar-collapsed" : ""} ${className}`} aria-label="Sidebar">{children}</aside>;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function SidebarHeader({ brand, action, className = "" }: { brand: ReactNode; action?: ReactNode; className?: string }) {
|
|
8
|
+
return <div className={`sidebar-header ${className}`}><div className="sidebar-brand">{brand}</div>{action}</div>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function SidebarSection({ label, children, className = "" }: { label?: ReactNode; children: ReactNode; className?: string }) {
|
|
12
|
+
return <section className={`sidebar-section ${className}`}>{label && <div className="sidebar-label">{label}</div>}<nav className="sidebar-nav">{children}</nav></section>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function SidebarItem({ href = "#", active = false, icon, children, badge, className = "", onClick }: { href?: string; active?: boolean; icon?: ReactNode; children: ReactNode; badge?: ReactNode; className?: string; onClick?: () => void }) {
|
|
16
|
+
return <a href={href} onClick={onClick} className={`sidebar-item${active ? " sidebar-item-active" : ""} ${className}`} aria-current={active ? "page" : undefined}><span className="sidebar-item-content">{icon && <span className="sidebar-icon" aria-hidden>{icon}</span>}<span className="sidebar-item-label">{children}</span></span>{badge && <span className="sidebar-badge">{badge}</span>}</a>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function SidebarFooter({ children, className = "" }: { children: ReactNode; className?: string }) {
|
|
20
|
+
return <div className={`sidebar-footer ${className}`}>{children}</div>;
|
|
21
|
+
}
|
package/src/styles.css
CHANGED
|
@@ -30,6 +30,27 @@ html, body { background: var(--color-bg); color: var(--color-text); }
|
|
|
30
30
|
body { font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
|
|
31
31
|
|
|
32
32
|
@layer components {
|
|
33
|
+
.sidebar { display:flex; flex-direction:column; width:244px; min-height:100%; flex:none; background:var(--color-surface); border-right:1px solid var(--color-border); color:var(--color-text); }
|
|
34
|
+
.sidebar-header { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:0 16px; border-bottom:1px solid var(--color-border); }
|
|
35
|
+
.sidebar-brand { min-width:0; font-size:13px; font-weight:600; letter-spacing:-.01em; }
|
|
36
|
+
.sidebar-section { padding:14px 10px 0; }
|
|
37
|
+
.sidebar-section + .sidebar-section { padding-top:18px; }
|
|
38
|
+
.sidebar-label { padding:0 10px 7px; color:var(--color-quiet); font-size:10px; font-weight:500; letter-spacing:.04em; text-transform:uppercase; }
|
|
39
|
+
.sidebar-nav { display:grid; gap:2px; }
|
|
40
|
+
.sidebar-item { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:32px; padding:0 10px; border-radius:6px; color:#4b5059; font-size:13px; text-decoration:none; }
|
|
41
|
+
.sidebar-item:hover { background:#eef0f3; color:var(--color-text); }
|
|
42
|
+
.sidebar-item-active { background:var(--color-accent-soft); color:var(--color-accent); font-weight:600; }
|
|
43
|
+
.sidebar-item-content { display:flex; align-items:center; gap:9px; min-width:0; }
|
|
44
|
+
.sidebar-icon { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; color:var(--color-muted); flex:none; }
|
|
45
|
+
.sidebar-icon svg { width:16px; height:16px; }
|
|
46
|
+
.sidebar-item-active .sidebar-icon { color:var(--color-accent); }
|
|
47
|
+
.sidebar-item-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
48
|
+
.sidebar-badge { color:var(--color-quiet); font-size:10px; font-variant-numeric:tabular-nums; }
|
|
49
|
+
.sidebar-footer { margin-top:auto; padding:12px 16px; border-top:1px solid var(--color-border); }
|
|
50
|
+
.sidebar-collapsed { width:64px; }
|
|
51
|
+
.sidebar-collapsed .sidebar-item-label,.sidebar-collapsed .sidebar-label,.sidebar-collapsed .sidebar-badge { display:none; }
|
|
52
|
+
.sidebar-collapsed .sidebar-item { justify-content:center; padding:0; }
|
|
53
|
+
.sidebar-collapsed .sidebar-item-content { justify-content:center; }
|
|
33
54
|
.h1 { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -0.035em; }
|
|
34
55
|
.h2 { font-size: 15px; font-weight: 600; }
|
|
35
56
|
.meta { font-size: 12px; color: var(--color-muted); }
|
|
@@ -174,3 +195,14 @@ html { scroll-behavior: smooth; scroll-padding-top: 96px; overscroll-behavior-y:
|
|
|
174
195
|
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
175
196
|
.page-enter { animation: none; }
|
|
176
197
|
@media (prefers-reduced-motion: reduce) { .page-enter { animation: none; } }
|
|
198
|
+
|
|
199
|
+
@layer components {
|
|
200
|
+
.control-shell { display:flex;align-items:center;width:100%;height:32px;border:1px solid #ebebeb;border-radius:4px;background:#fcfcfc;padding:0 8px;transition:border-color .12s,background-color .12s; }
|
|
201
|
+
.control-shell:focus-within { border-color:#1f1f1f;background:#fff; }.control-shell .control{border:0;background:transparent;padding:0 6px}.control-slot{display:inline-flex;color:var(--color-muted)}.control-slot svg{width:14px;height:14px}
|
|
202
|
+
.check-row,.switch-row{display:inline-flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;font-size:13px}.switch-row input{appearance:none;width:32px;height:18px;margin:0;border:1px solid var(--color-border-strong);border-radius:999px;background:var(--color-surface);cursor:pointer;position:relative;transition:background-color .12s,border-color .12s}.switch-row input::after{content:"";position:absolute;width:14px;height:14px;top:1px;left:1px;border-radius:50%;background:#fff;box-shadow:var(--shadow-card);transition:transform .12s}.switch-row input:checked{background:var(--color-accent);border-color:var(--color-accent)}.switch-row input:checked::after{transform:translateX(14px)}
|
|
203
|
+
.card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:14px 16px;border-bottom:1px solid var(--color-border)}.card-header .meta{margin-top:3px}.card-actions{display:flex;gap:8px;align-items:center}
|
|
204
|
+
.toaster{position:fixed;z-index:100;right:16px;bottom:16px;display:grid;gap:8px;width:min(360px,calc(100vw - 24px))}.toast{display:flex;align-items:center;gap:9px;min-height:46px;padding:10px 10px 10px 12px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:8px;box-shadow:0 12px 32px rgba(29,34,44,.14);font-size:12.5px;animation:toast-in .16s ease-out both}.toast>svg{width:16px;height:16px;flex:none}.toast-success>svg{color:var(--color-green)}.toast-error>svg{color:var(--color-red)}.toast-info>svg{color:var(--color-blue)}.toast>span{flex:1}
|
|
205
|
+
.menu{position:relative;display:inline-block}.menu-trigger{border:0;background:transparent;padding:0;cursor:pointer}.menu-panel{position:absolute;z-index:20;right:0;top:calc(100% + 5px);min-width:180px;padding:4px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:8px;box-shadow:0 12px 32px rgba(29,34,44,.14)}.menu-item{display:flex;align-items:center;width:100%;min-height:32px;padding:0 9px;border:0;border-radius:6px;background:transparent;color:var(--color-text);font-size:12.5px;text-align:left;cursor:pointer}.menu-item:hover,.menu-item:focus-visible{background:#eef0f3;outline:0}.menu-item.destructive{color:var(--color-red)}.menu-separator{height:1px;margin:4px 0;background:var(--color-border)}
|
|
206
|
+
.avatar{display:inline-grid;place-items:center;overflow:hidden;flex:none;border-radius:50%;background:var(--color-accent-soft);color:var(--color-accent);font-size:12px;font-weight:600}.avatar img{width:100%;height:100%;object-fit:cover}.avatar-sm{width:24px;height:24px}.avatar-md{width:32px;height:32px}.avatar-lg{width:40px;height:40px}.progress{display:flex;align-items:center;gap:9px}.progress-track{height:6px;flex:1;overflow:hidden;border-radius:999px;background:var(--color-accent-soft)}.progress-track span{display:block;height:100%;border-radius:inherit;background:var(--color-accent);transition:width .16s ease-out}.progress-label{color:var(--color-muted);font-size:12px;font-variant-numeric:tabular-nums}.breadcrumbs{display:flex;align-items:center;gap:4px;color:var(--color-muted);font-size:12px}.breadcrumbs a{color:inherit;text-decoration:none}.breadcrumbs a:hover{color:var(--color-text)}.breadcrumbs strong{color:var(--color-text);font-weight:600}.pagination{display:flex;gap:4px}.page-btn{min-width:30px;height:30px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-muted);cursor:pointer}.page-btn:hover{background:var(--color-surface-subtle);color:var(--color-text)}.page-btn[aria-current="page"]{border-color:var(--color-accent);background:var(--color-accent);color:#fff}
|
|
207
|
+
@keyframes toast-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
|
208
|
+
}
|
package/src/submit-button.tsx
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useFormStatus } from "react-dom";
|
|
3
|
-
import { Loader2 } from "lucide-react";
|
|
4
2
|
import type { ReactNode } from "react";
|
|
5
3
|
import { useActionPending } from "./action-form";
|
|
4
|
+
import { Button } from "./button";
|
|
6
5
|
|
|
7
6
|
export function SubmitButton({ children, variant = "primary", pendingLabel, className = "", confirm, name, value }: { children: ReactNode; variant?: "primary" | "secondary" | "danger" | "danger-solid"; pendingLabel?: string; className?: string; confirm?: string; name?: string; value?: string }) {
|
|
8
|
-
const status = useFormStatus();
|
|
9
7
|
const ctx = useActionPending();
|
|
10
|
-
const pending =
|
|
8
|
+
const pending = ctx;
|
|
11
9
|
return (
|
|
12
|
-
<
|
|
10
|
+
<Button
|
|
13
11
|
type="submit" name={name} value={value}
|
|
14
|
-
|
|
12
|
+
variant={variant} className={className} loading={pending}
|
|
15
13
|
onClick={(e) => { if (confirm && !window.confirm(confirm)) e.preventDefault(); }}
|
|
16
14
|
>
|
|
17
|
-
{pending ?
|
|
18
|
-
</
|
|
15
|
+
{pending ? pendingLabel ?? "Working…" : children}
|
|
16
|
+
</Button>
|
|
19
17
|
);
|
|
20
18
|
}
|
package/src/tabs.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Link from "next/link";
|
|
2
1
|
import type { ReactNode } from "react";
|
|
3
2
|
|
|
4
3
|
export type TabItem = { href: string; label: string; icon?: ReactNode; active: boolean; count?: number };
|
|
@@ -8,11 +7,11 @@ export function PageTabs({ items, className = "mt-6 mb-9" }: { items: TabItem[];
|
|
|
8
7
|
return (
|
|
9
8
|
<nav aria-label="Sections" className={`tabs ${className}`}>
|
|
10
9
|
{items.map((t) => (
|
|
11
|
-
<
|
|
10
|
+
<a key={t.href} href={t.href} className="tab" aria-current={t.active ? "page" : undefined}>
|
|
12
11
|
{t.icon}
|
|
13
12
|
{t.label}
|
|
14
13
|
{typeof t.count === "number" && <span className="rounded-[5px] bg-[#f0f1f4] px-1.5 text-[11px] text-muted">{t.count}</span>}
|
|
15
|
-
</
|
|
14
|
+
</a>
|
|
16
15
|
))}
|
|
17
16
|
</nav>
|
|
18
17
|
);
|
package/src/toast.tsx
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AlertCircle, CheckCircle2, Info, X } from "lucide-react";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, type ReactNode } from "react";
|
|
3
|
+
type Kind = "success" | "error" | "info"; type Item = { id: number; kind: Kind; message: string; action?: ReactNode };
|
|
4
|
+
const ToastContext = createContext<{toast:{success:(message:string,action?:ReactNode)=>void;error:(message:string,action?:ReactNode)=>void;info:(message:string,action?:ReactNode)=>void}} | null>(null);
|
|
5
|
+
export function Toaster({ children }: { children?: ReactNode }) { const [items,setItems]=useState<Item[]>([]); const add=useCallback((kind:Kind,message:string,action?:ReactNode)=>{const id=Date.now()+Math.random();setItems(v=>[...v.slice(-2),{id,kind,message,action}]);if(kind!=="error"||!action)window.setTimeout(()=>setItems(v=>v.filter(x=>x.id!==id)),kind==="error"?6000:4000)},[]); const toast=useMemo(()=>({success:(m:string,a?:ReactNode)=>add("success",m,a),error:(m:string,a?:ReactNode)=>add("error",m,a),info:(m:string,a?:ReactNode)=>add("info",m,a)}),[add]);return <ToastContext.Provider value={{toast}}>{children}<div className="toaster" aria-live="polite">{items.map(item=><div className={`toast toast-${item.kind}`} key={item.id} role={item.kind==="error"?"alert":"status"}>{item.kind==="success"?<CheckCircle2 aria-hidden/>:item.kind==="error"?<AlertCircle aria-hidden/>:<Info aria-hidden/>}<span>{item.message}</span>{item.action}<button className="icon-btn" aria-label="Dismiss notification" onClick={()=>setItems(v=>v.filter(x=>x.id!==item.id))}><X aria-hidden/></button></div>)}</div></ToastContext.Provider> }
|
|
6
|
+
export function useToast(){const context=useContext(ToastContext);if(!context)throw new Error("useToast must be used inside Toaster");return context.toast}
|
package/src/types.ts
CHANGED
|
File without changes
|