@pawkit/ui 0.0.0-stage → 0.2.1

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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -2
  3. package/dist/index.d.ts +26 -0
  4. package/dist/index.js +26 -0
  5. package/dist/lib/sounds.d.ts +5 -0
  6. package/dist/lib/sounds.js +94 -0
  7. package/dist/lib/utils.d.ts +2 -0
  8. package/dist/lib/utils.js +5 -0
  9. package/dist/ui/avatar.d.ts +17 -0
  10. package/dist/ui/avatar.js +30 -0
  11. package/dist/ui/button.d.ts +15 -0
  12. package/dist/ui/button.js +38 -0
  13. package/dist/ui/card.d.ts +6 -0
  14. package/dist/ui/card.js +14 -0
  15. package/dist/ui/command.d.ts +17 -0
  16. package/dist/ui/command.js +42 -0
  17. package/dist/ui/dialog.d.ts +14 -0
  18. package/dist/ui/dialog.js +25 -0
  19. package/dist/ui/dropzone.d.ts +14 -0
  20. package/dist/ui/dropzone.js +70 -0
  21. package/dist/ui/empty-state.d.ts +10 -0
  22. package/dist/ui/empty-state.js +12 -0
  23. package/dist/ui/fluid-hover.d.ts +15 -0
  24. package/dist/ui/fluid-hover.js +69 -0
  25. package/dist/ui/input.d.ts +8 -0
  26. package/dist/ui/input.js +15 -0
  27. package/dist/ui/juicy-button.d.ts +21 -0
  28. package/dist/ui/juicy-button.js +32 -0
  29. package/dist/ui/kbd.d.ts +3 -0
  30. package/dist/ui/kbd.js +7 -0
  31. package/dist/ui/list.d.ts +24 -0
  32. package/dist/ui/list.js +20 -0
  33. package/dist/ui/menu.d.ts +20 -0
  34. package/dist/ui/menu.js +42 -0
  35. package/dist/ui/pixel-pup.d.ts +88 -0
  36. package/dist/ui/pixel-pup.js +424 -0
  37. package/dist/ui/popover.d.ts +8 -0
  38. package/dist/ui/popover.js +12 -0
  39. package/dist/ui/segmented-control.d.ts +15 -0
  40. package/dist/ui/segmented-control.js +45 -0
  41. package/dist/ui/sheet.d.ts +12 -0
  42. package/dist/ui/sheet.js +16 -0
  43. package/dist/ui/slider.d.ts +5 -0
  44. package/dist/ui/slider.js +12 -0
  45. package/dist/ui/stepper.d.ts +14 -0
  46. package/dist/ui/stepper.js +55 -0
  47. package/dist/ui/switch.d.ts +5 -0
  48. package/dist/ui/switch.js +9 -0
  49. package/dist/ui/tabs.d.ts +10 -0
  50. package/dist/ui/tabs.js +43 -0
  51. package/dist/ui/toast.d.ts +22 -0
  52. package/dist/ui/toast.js +49 -0
  53. package/dist/ui/tooltip.d.ts +17 -0
  54. package/dist/ui/tooltip.js +16 -0
  55. package/dist/ui/tuner.d.ts +39 -0
  56. package/dist/ui/tuner.js +52 -0
  57. package/package.json +63 -5
  58. package/styles.css +279 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dogxi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,29 @@
1
- # Temporary Holding Version
1
+ # @pawkit/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Quiet, soft, tactile React components. Docs: **[ui.dogxi.me](https://ui.dogxi.me)**
4
+
5
+ ```bash
6
+ npm i @pawkit/ui
7
+ ```
8
+
9
+ Needs React 19 and Tailwind CSS v4. Import the styles once, right after Tailwind:
10
+
11
+ ```css
12
+ @import "tailwindcss";
13
+ @import "@pawkit/ui/styles.css";
14
+ ```
15
+
16
+ ```tsx
17
+ import { Button, Switch, toast, Toaster } from "@pawkit/ui";
18
+ // or per component: import { Button } from "@pawkit/ui/button";
19
+
20
+ <Button variant="primary" onClick={() => toast.success("Saved")}>Save</Button>
21
+ <Toaster />
22
+ ```
23
+
24
+ Dark mode: put `class="dark"` on `<html>`. Retheme by overriding `--pk-accent` and `--pk-radius`.
25
+
26
+ Want to edit a component's source? Copy it into your project with shadcn instead:
27
+ `npx shadcn@latest add https://ui.dogxi.me/r/button.json`
28
+
29
+ MIT © Dogxi
@@ -0,0 +1,26 @@
1
+ export * from "./lib/sounds.js";
2
+ export * from "./lib/utils.js";
3
+ export * from "./ui/avatar.js";
4
+ export * from "./ui/button.js";
5
+ export * from "./ui/card.js";
6
+ export * from "./ui/command.js";
7
+ export * from "./ui/dialog.js";
8
+ export * from "./ui/dropzone.js";
9
+ export * from "./ui/empty-state.js";
10
+ export * from "./ui/fluid-hover.js";
11
+ export * from "./ui/input.js";
12
+ export * from "./ui/juicy-button.js";
13
+ export * from "./ui/kbd.js";
14
+ export * from "./ui/list.js";
15
+ export * from "./ui/menu.js";
16
+ export * from "./ui/pixel-pup.js";
17
+ export * from "./ui/popover.js";
18
+ export * from "./ui/segmented-control.js";
19
+ export * from "./ui/sheet.js";
20
+ export * from "./ui/slider.js";
21
+ export * from "./ui/stepper.js";
22
+ export * from "./ui/switch.js";
23
+ export * from "./ui/tabs.js";
24
+ export * from "./ui/toast.js";
25
+ export * from "./ui/tooltip.js";
26
+ export * from "./ui/tuner.js";
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ export * from "./lib/sounds.js";
2
+ export * from "./lib/utils.js";
3
+ export * from "./ui/avatar.js";
4
+ export * from "./ui/button.js";
5
+ export * from "./ui/card.js";
6
+ export * from "./ui/command.js";
7
+ export * from "./ui/dialog.js";
8
+ export * from "./ui/dropzone.js";
9
+ export * from "./ui/empty-state.js";
10
+ export * from "./ui/fluid-hover.js";
11
+ export * from "./ui/input.js";
12
+ export * from "./ui/juicy-button.js";
13
+ export * from "./ui/kbd.js";
14
+ export * from "./ui/list.js";
15
+ export * from "./ui/menu.js";
16
+ export * from "./ui/pixel-pup.js";
17
+ export * from "./ui/popover.js";
18
+ export * from "./ui/segmented-control.js";
19
+ export * from "./ui/sheet.js";
20
+ export * from "./ui/slider.js";
21
+ export * from "./ui/stepper.js";
22
+ export * from "./ui/switch.js";
23
+ export * from "./ui/tabs.js";
24
+ export * from "./ui/toast.js";
25
+ export * from "./ui/tooltip.js";
26
+ export * from "./ui/tuner.js";
@@ -0,0 +1,5 @@
1
+ export type SoundName = "tick" | "pop" | "toggleOn" | "toggleOff" | "success" | "error" | "whoosh";
2
+ export declare function setSoundEnabled(v: boolean): void;
3
+ export declare function useSoundEnabled(): boolean;
4
+ /** Plays only when sounds are enabled and the tab has been interacted with. */
5
+ export declare function playSound(name: SoundName): void;
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ /**
3
+ * Tiny UI sounds, synthesized with WebAudio — no audio files.
4
+ * Off by default: call setSoundEnabled(true) (e.g. from a settings switch).
5
+ */
6
+ import * as React from "react";
7
+ const KEY = "pk-sound";
8
+ let enabled = typeof localStorage !== "undefined" && localStorage.getItem(KEY) === "1";
9
+ let ctx = null;
10
+ const listeners = new Set();
11
+ export function setSoundEnabled(v) {
12
+ enabled = v;
13
+ try {
14
+ localStorage.setItem(KEY, v ? "1" : "0");
15
+ }
16
+ catch { }
17
+ for (const l of listeners)
18
+ l();
19
+ if (v)
20
+ playSound("toggleOn");
21
+ }
22
+ export function useSoundEnabled() {
23
+ return React.useSyncExternalStore((cb) => {
24
+ listeners.add(cb);
25
+ return () => listeners.delete(cb);
26
+ }, () => enabled, () => false);
27
+ }
28
+ function tone(ac, { freq, to, start = 0, dur = 0.06, type = "sine", gain = 0.12, }) {
29
+ const t = ac.currentTime + start;
30
+ const o = ac.createOscillator();
31
+ const g = ac.createGain();
32
+ o.type = type;
33
+ o.frequency.setValueAtTime(freq, t);
34
+ if (to)
35
+ o.frequency.exponentialRampToValueAtTime(to, t + dur);
36
+ g.gain.setValueAtTime(0, t);
37
+ g.gain.linearRampToValueAtTime(gain, t + 0.004);
38
+ g.gain.exponentialRampToValueAtTime(0.0001, t + dur);
39
+ o.connect(g).connect(ac.destination);
40
+ o.start(t);
41
+ o.stop(t + dur + 0.02);
42
+ }
43
+ function noise(ac, dur, gain) {
44
+ const t = ac.currentTime;
45
+ const buf = ac.createBuffer(1, Math.ceil(ac.sampleRate * dur), ac.sampleRate);
46
+ const data = buf.getChannelData(0);
47
+ for (let i = 0; i < data.length; i++)
48
+ data[i] = (Math.random() * 2 - 1) * (1 - i / data.length);
49
+ const src = ac.createBufferSource();
50
+ const f = ac.createBiquadFilter();
51
+ f.type = "bandpass";
52
+ f.frequency.setValueAtTime(800, t);
53
+ f.frequency.exponentialRampToValueAtTime(3000, t + dur);
54
+ const g = ac.createGain();
55
+ g.gain.value = gain;
56
+ src.buffer = buf;
57
+ src.connect(f).connect(g).connect(ac.destination);
58
+ src.start(t);
59
+ }
60
+ const recipes = {
61
+ tick: (ac) => tone(ac, { freq: 1800, dur: 0.018, type: "square", gain: 0.03 }),
62
+ pop: (ac) => tone(ac, { freq: 420, to: 880, dur: 0.07, gain: 0.14 }),
63
+ toggleOn: (ac) => {
64
+ tone(ac, { freq: 660, dur: 0.05, gain: 0.08 });
65
+ tone(ac, { freq: 990, start: 0.045, dur: 0.06, gain: 0.08 });
66
+ },
67
+ toggleOff: (ac) => {
68
+ tone(ac, { freq: 990, dur: 0.05, gain: 0.07 });
69
+ tone(ac, { freq: 660, start: 0.045, dur: 0.06, gain: 0.07 });
70
+ },
71
+ success: (ac) => {
72
+ for (const [i, f] of [523.25, 659.25, 783.99].entries())
73
+ tone(ac, { freq: f, start: i * 0.06, dur: 0.12, type: "triangle", gain: 0.09 });
74
+ },
75
+ error: (ac) => {
76
+ tone(ac, { freq: 311, dur: 0.09, type: "triangle", gain: 0.1 });
77
+ tone(ac, { freq: 233, start: 0.08, dur: 0.14, type: "triangle", gain: 0.1 });
78
+ },
79
+ whoosh: (ac) => noise(ac, 0.16, 0.05),
80
+ };
81
+ /** Plays only when sounds are enabled and the tab has been interacted with. */
82
+ export function playSound(name) {
83
+ if (!enabled || typeof window === "undefined")
84
+ return;
85
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches)
86
+ return;
87
+ try {
88
+ ctx ??= new AudioContext();
89
+ if (ctx.state === "suspended")
90
+ ctx.resume();
91
+ recipes[name](ctx);
92
+ }
93
+ catch { }
94
+ }
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,5 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
@@ -0,0 +1,17 @@
1
+ import { Avatar as AvatarPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+ interface AvatarProps extends React.ComponentProps<typeof AvatarPrimitive.Root> {
4
+ src?: string;
5
+ name: string;
6
+ size?: number;
7
+ }
8
+ /** Falls back to tinted initials (the last character for Chinese names). */
9
+ declare function Avatar({ src, name, size, className, style, ...props }: AvatarProps): React.JSX.Element;
10
+ /** Overlapping stack. Hover fans it out a little. */
11
+ declare function AvatarGroup({ className, children, max, size, }: {
12
+ className?: string;
13
+ children: React.ReactElement<AvatarProps>[];
14
+ max?: number;
15
+ size?: number;
16
+ }): React.JSX.Element;
17
+ export { Avatar, AvatarGroup };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Avatar as AvatarPrimitive } from "radix-ui";
4
+ import { cn } from "../lib/utils.js";
5
+ const TINTS = ["#0a7cff", "#30c25a", "#ff9f0a", "#ff375f", "#5e5ce6", "#64d2ff", "#bf5af2"];
6
+ const tint = (s) => TINTS[[...s].reduce((a, c) => a + c.charCodeAt(0), 0) % TINTS.length];
7
+ const initials = (name) => /[一-鿿]/.test(name)
8
+ ? name.slice(-1)
9
+ : name
10
+ .split(/\s+/)
11
+ .map((w) => w[0])
12
+ .join("")
13
+ .slice(0, 2)
14
+ .toUpperCase();
15
+ /** Falls back to tinted initials (the last character for Chinese names). */
16
+ function Avatar({ src, name, size = 32, className, style, ...props }) {
17
+ return (_jsxs(AvatarPrimitive.Root, { "data-slot": "avatar", className: cn("relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full", className), style: { width: size, height: size, ...style }, ...props, children: [src && _jsx(AvatarPrimitive.Image, { src: src, alt: name, className: "size-full object-cover" }), _jsx(AvatarPrimitive.Fallback, { delayMs: src ? 400 : 0, className: "grid size-full place-items-center font-semibold text-white", style: { background: tint(name), fontSize: size * 0.4 }, children: initials(name) })] }));
18
+ }
19
+ /** Overlapping stack. Hover fans it out a little. */
20
+ function AvatarGroup({ className, children, max, size = 32, }) {
21
+ const shown = max ? children.slice(0, max) : children;
22
+ const rest = children.length - shown.length;
23
+ return (_jsxs("div", { "data-slot": "avatar-group", className: cn("group/av flex items-center", className), children: [shown.map((child, i) => (_jsx("span", { className: "ml-(--ov) flex rounded-full shadow-[0_0_0_2px_var(--pk-surface)] transition-[margin] duration-300 ease-spring first:ml-0 group-hover/av:ml-[calc(var(--ov)+8px)] group-hover/av:first:ml-0", style: { "--ov": `${-size * 0.3}px`, zIndex: shown.length - i }, children: child }, child.key ?? i))), rest > 0 && (_jsxs("span", { className: "ml-(--ov) grid place-items-center rounded-full bg-fill font-medium text-fg-2 shadow-[0_0_0_2px_var(--pk-surface)] transition-[margin] duration-300 ease-spring group-hover/av:ml-[calc(var(--ov)+8px)]", style: {
24
+ width: size,
25
+ height: size,
26
+ "--ov": `${-size * 0.3}px`,
27
+ fontSize: size * 0.34,
28
+ }, children: ["+", rest] }))] }));
29
+ }
30
+ export { Avatar, AvatarGroup };
@@ -0,0 +1,15 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import type * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "danger" | "ghost" | "primary" | "secondary" | "solid" | "surface" | null | undefined;
5
+ size?: "icon" | "icon-sm" | "lg" | "md" | "sm" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ loading?: boolean;
10
+ }
11
+ declare function Button({ className, variant, size, asChild, loading, disabled, children, ...props }: ButtonProps): React.JSX.Element;
12
+ declare function Spinner({ className }: {
13
+ className?: string;
14
+ }): React.JSX.Element;
15
+ export { Button, buttonVariants, Spinner };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { Slot } from "radix-ui";
5
+ import { cn } from "../lib/utils.js";
6
+ const buttonVariants = cva([
7
+ "relative inline-flex shrink-0 select-none items-center justify-center gap-1.5 whitespace-nowrap font-medium",
8
+ "transition-[transform,background-color,box-shadow,opacity] duration-150 ease-pk",
9
+ "active:scale-[0.97] active:duration-75 disabled:pointer-events-none disabled:opacity-40",
10
+ "[&_svg]:size-4 [&_svg]:shrink-0",
11
+ ], {
12
+ variants: {
13
+ variant: {
14
+ primary: "bg-accent text-on-accent hover:brightness-[1.06]",
15
+ secondary: "bg-fill text-fg hover:bg-fill-hover",
16
+ solid: "bg-fg text-bg hover:opacity-90",
17
+ surface: "bg-surface text-fg shadow-card hover:bg-fill",
18
+ ghost: "text-fg-2 hover:bg-fill hover:text-fg",
19
+ danger: "bg-danger/10 text-danger hover:bg-danger/15",
20
+ },
21
+ size: {
22
+ sm: "h-7 rounded-md px-2.5 text-[13px]",
23
+ md: "h-9 rounded-lg px-3.5 text-sm",
24
+ lg: "h-11 rounded-xl px-5 text-[15px]",
25
+ icon: "size-9 rounded-lg",
26
+ "icon-sm": "size-7 rounded-md [&_svg]:size-3.5",
27
+ },
28
+ },
29
+ defaultVariants: { variant: "secondary", size: "md" },
30
+ });
31
+ function Button({ className, variant, size, asChild, loading, disabled, children, ...props }) {
32
+ const Comp = asChild ? Slot.Root : "button";
33
+ return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size }), className), disabled: disabled || loading, "aria-busy": loading || undefined, ...props, children: loading ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "invisible contents", children: children }), _jsx("span", { className: "absolute inset-0 grid place-items-center", children: _jsx(Spinner, {}) })] })) : (children) }));
34
+ }
35
+ function Spinner({ className }) {
36
+ return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", className: cn("size-4 animate-pk-spin", className), children: [_jsx("circle", { cx: "8", cy: "8", r: "6.25", stroke: "currentColor", strokeOpacity: ".2", strokeWidth: "1.5" }), _jsx("path", { d: "M14.25 8A6.25 6.25 0 0 0 8 1.75", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }));
37
+ }
38
+ export { Button, buttonVariants, Spinner };
@@ -0,0 +1,6 @@
1
+ import type * as React from "react";
2
+ /** A quiet surface. Layered by shadow and a step of gray — never a border. */
3
+ declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
4
+ declare function CardTitle({ className, ...props }: React.ComponentProps<"h3">): React.JSX.Element;
5
+ declare function CardDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
6
+ export { Card, CardDescription, CardTitle };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from "../lib/utils.js";
4
+ /** A quiet surface. Layered by shadow and a step of gray — never a border. */
5
+ function Card({ className, ...props }) {
6
+ return (_jsx("div", { "data-slot": "card", className: cn("rounded-2xl bg-surface p-4 shadow-card", className), ...props }));
7
+ }
8
+ function CardTitle({ className, ...props }) {
9
+ return _jsx("h3", { className: cn("font-semibold text-[15px] text-fg", className), ...props });
10
+ }
11
+ function CardDescription({ className, ...props }) {
12
+ return _jsx("p", { className: cn("text-[13px] text-fg-2", className), ...props });
13
+ }
14
+ export { Card, CardDescription, CardTitle };
@@ -0,0 +1,17 @@
1
+ import { Command as CommandPrimitive } from "cmdk";
2
+ import * as React from "react";
3
+ declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
4
+ declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
5
+ declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
6
+ declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
7
+ declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
8
+ declare function CommandItem({ className, shortcut, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Item> & {
9
+ shortcut?: React.ReactNode;
10
+ }): React.JSX.Element;
11
+ /** Toggle with ⌘K / Ctrl+K. */
12
+ declare function useCommandHotkey(setOpen: React.Dispatch<React.SetStateAction<boolean>>, key?: string): void;
13
+ declare function CommandDialog({ open, onOpenChange, label, children, ...props }: React.ComponentProps<typeof CommandPrimitive> & {
14
+ open: boolean;
15
+ onOpenChange: (open: boolean) => void;
16
+ }): React.JSX.Element;
17
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, useCommandHotkey, };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Command as CommandPrimitive } from "cmdk";
4
+ import { Search } from "lucide-react";
5
+ import { Dialog as DialogPrimitive } from "radix-ui";
6
+ import * as React from "react";
7
+ import { cn } from "../lib/utils.js";
8
+ function Command({ className, ...props }) {
9
+ return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn("flex w-full flex-col overflow-hidden text-fg", className), ...props }));
10
+ }
11
+ function CommandInput({ className, ...props }) {
12
+ return (_jsxs("div", { className: "flex items-center gap-2.5 px-4 shadow-[inset_0_-1px_0_var(--pk-hairline)]", children: [_jsx(Search, { className: "size-4 shrink-0 text-fg-3" }), _jsx(CommandPrimitive.Input, { className: cn("h-12 w-full bg-transparent text-[15px] text-fg outline-none placeholder:text-fg-3", className), ...props })] }));
13
+ }
14
+ function CommandList({ className, ...props }) {
15
+ return (_jsx(CommandPrimitive.List, { className: cn("max-h-[min(376px,60dvh)] scroll-py-2 overflow-y-auto overscroll-contain [&>[cmdk-list-sizer]]:p-2", "h-[calc(var(--cmdk-list-height)+16px)] transition-[height] duration-200 ease-pk", className), ...props }));
16
+ }
17
+ function CommandEmpty({ className, ...props }) {
18
+ return (_jsx(CommandPrimitive.Empty, { className: cn("py-10 text-center text-[14px] text-fg-3", className), ...props }));
19
+ }
20
+ function CommandGroup({ className, ...props }) {
21
+ return (_jsx(CommandPrimitive.Group, { className: cn("[&:not(:first-child)]:mt-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pt-1 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:text-[12px] [&_[cmdk-group-heading]]:text-fg-3", className), ...props }));
22
+ }
23
+ function CommandItem({ className, shortcut, children, ...props }) {
24
+ return (_jsxs(CommandPrimitive.Item, { className: cn("flex h-10 cursor-default select-none items-center gap-2.5 rounded-lg px-2.5 text-[14px] outline-none", "transition-colors duration-75 data-[disabled=true]:opacity-40 data-[selected=true]:bg-fill", "[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-fg-2", className), ...props, children: [children, shortcut && _jsx("span", { className: "ml-auto text-[12px] text-fg-3", children: shortcut })] }));
25
+ }
26
+ /** Toggle with ⌘K / Ctrl+K. */
27
+ function useCommandHotkey(setOpen, key = "k") {
28
+ React.useEffect(() => {
29
+ const onKey = (e) => {
30
+ if (e.key.toLowerCase() === key && (e.metaKey || e.ctrlKey)) {
31
+ e.preventDefault();
32
+ setOpen((o) => !o);
33
+ }
34
+ };
35
+ window.addEventListener("keydown", onKey);
36
+ return () => window.removeEventListener("keydown", onKey);
37
+ }, [setOpen, key]);
38
+ }
39
+ function CommandDialog({ open, onOpenChange, label = "Command menu", children, ...props }) {
40
+ return (_jsx(DialogPrimitive.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/15 data-[state=closed]:animate-[pk-fade-out_120ms_ease-in_forwards] data-[state=open]:animate-[pk-fade-in_160ms_var(--pk-ease)] dark:bg-black/45" }), _jsxs(DialogPrimitive.Content, { "aria-describedby": undefined, className: "-translate-x-1/2 fixed top-[16dvh] left-1/2 z-50 w-[min(560px,calc(100vw-24px))] overflow-hidden rounded-2xl bg-surface shadow-float outline-none data-[state=closed]:animate-[pk-pop-out_120ms_ease-in_forwards] data-[state=open]:animate-[pk-pop-in_240ms_var(--pk-spring)]", children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: label }), _jsx(Command, { label: label, ...props, children: children })] })] }) }));
41
+ }
42
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, useCommandHotkey, };
@@ -0,0 +1,14 @@
1
+ import { Dialog as DialogPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
4
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
7
+ /** A centered card that springs in. Title is required for screen readers; hide it with `sr-only` if needed. */
8
+ declare function DialogContent({ className, children, showClose, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ showClose?: boolean;
10
+ }): React.JSX.Element;
11
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
12
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
13
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
14
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogOverlay, DialogTitle, DialogTrigger, };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { X } from "lucide-react";
4
+ import { Dialog as DialogPrimitive } from "radix-ui";
5
+ import { cn } from "../lib/utils.js";
6
+ const Dialog = DialogPrimitive.Root;
7
+ const DialogTrigger = DialogPrimitive.Trigger;
8
+ const DialogClose = DialogPrimitive.Close;
9
+ function DialogOverlay({ className, ...props }) {
10
+ return (_jsx(DialogPrimitive.Overlay, { className: cn("fixed inset-0 z-50 bg-black/20 backdrop-blur-[2px] dark:bg-black/50", "data-[state=open]:animate-[pk-fade-in_200ms_var(--pk-ease)] data-[state=closed]:animate-[pk-fade-out_150ms_ease-in_forwards]", className), ...props }));
11
+ }
12
+ /** A centered card that springs in. Title is required for screen readers; hide it with `sr-only` if needed. */
13
+ function DialogContent({ className, children, showClose = true, ...props }) {
14
+ return (_jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog", className: cn("-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2 z-50 w-[min(420px,calc(100vw-32px))]", "rounded-2xl bg-surface p-5 shadow-float outline-none", "data-[state=open]:animate-[pk-pop-in_320ms_var(--pk-spring)] data-[state=closed]:animate-[pk-pop-out_140ms_ease-in_forwards]", className), ...props, children: [children, showClose && (_jsx(DialogPrimitive.Close, { "aria-label": "Close", className: "absolute top-3.5 right-3.5 grid size-7 place-items-center rounded-full text-fg-3 transition hover:bg-fill hover:text-fg active:scale-90", children: _jsx(X, { className: "size-4" }) }))] })] }));
15
+ }
16
+ function DialogTitle({ className, ...props }) {
17
+ return (_jsx(DialogPrimitive.Title, { className: cn("pr-8 font-semibold text-[17px] text-fg", className), ...props }));
18
+ }
19
+ function DialogDescription({ className, ...props }) {
20
+ return (_jsx(DialogPrimitive.Description, { className: cn("mt-1.5 text-[14px] text-fg-2 leading-relaxed", className), ...props }));
21
+ }
22
+ function DialogFooter({ className, ...props }) {
23
+ return _jsx("div", { className: cn("mt-5 flex justify-end gap-2", className), ...props });
24
+ }
25
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogOverlay, DialogTitle, DialogTrigger, };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ type Upload = (file: File, onProgress: (p: number) => void, signal: AbortSignal) => Promise<void>;
3
+ interface DropzoneProps {
4
+ /** Upload the file and report progress 0–1. Without it, a fake upload runs (handy for demos). */
5
+ upload?: Upload;
6
+ onComplete?: (file: File) => void;
7
+ accept?: string;
8
+ title?: React.ReactNode;
9
+ hint?: React.ReactNode;
10
+ className?: string;
11
+ }
12
+ /** Upload progress, but you watch the photo arrive — it sharpens from top to bottom. */
13
+ declare function Dropzone({ upload, onComplete, accept, title, hint, className, }: DropzoneProps): React.JSX.Element;
14
+ export { Dropzone };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArrowUpFromLine, Check, X } from "lucide-react";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/utils.js";
6
+ const fakeUpload = (_file, onProgress, signal) => new Promise((resolve, reject) => {
7
+ let p = 0;
8
+ const id = window.setInterval(() => {
9
+ p = Math.min(1, p + Math.random() * 0.06 + 0.01);
10
+ onProgress(p);
11
+ if (p >= 1) {
12
+ window.clearInterval(id);
13
+ resolve();
14
+ }
15
+ }, 90);
16
+ signal.addEventListener("abort", () => {
17
+ window.clearInterval(id);
18
+ reject(new DOMException("aborted", "AbortError"));
19
+ });
20
+ });
21
+ /** Upload progress, but you watch the photo arrive — it sharpens from top to bottom. */
22
+ function Dropzone({ upload = fakeUpload, onComplete, accept = "image/*", title = "Drop an image to upload", hint = "or browse — JPG, PNG, HEIC up to 25 MB", className, }) {
23
+ const input = React.useRef(null);
24
+ const ctrl = React.useRef(null);
25
+ const [over, setOver] = React.useState(false);
26
+ const [state, setState] = React.useState({ kind: "idle" });
27
+ const reset = React.useCallback(() => {
28
+ ctrl.current?.abort();
29
+ setState((s) => {
30
+ if (s.kind !== "idle")
31
+ URL.revokeObjectURL(s.url);
32
+ return { kind: "idle" };
33
+ });
34
+ }, []);
35
+ React.useEffect(() => () => ctrl.current?.abort(), []);
36
+ const start = async (file) => {
37
+ if (!file)
38
+ return;
39
+ reset();
40
+ const url = URL.createObjectURL(file);
41
+ const c = new AbortController();
42
+ ctrl.current = c;
43
+ setState({ kind: "uploading", url, progress: 0, name: file.name });
44
+ try {
45
+ await upload(file, (p) => setState((s) => (s.kind === "uploading" ? { ...s, progress: p } : s)), c.signal);
46
+ setState((s) => (s.kind === "uploading" ? { ...s, kind: "done", progress: 1 } : s));
47
+ onComplete?.(file);
48
+ }
49
+ catch {
50
+ /* aborted or failed: stay where reset() put us */
51
+ }
52
+ };
53
+ const pct = state.kind === "idle" ? 0 : Math.round(state.progress * 100);
54
+ return (_jsxs("div", { "data-slot": "dropzone", className: cn("relative overflow-hidden rounded-2xl bg-surface p-2 shadow-card transition-transform duration-300 ease-spring", over && "scale-[1.015]", className), onDragOver: (e) => {
55
+ e.preventDefault();
56
+ setOver(true);
57
+ }, onDragLeave: () => setOver(false), onDrop: (e) => {
58
+ e.preventDefault();
59
+ setOver(false);
60
+ start(e.dataTransfer.files[0]);
61
+ }, children: [_jsx("input", { ref: input, type: "file", accept: accept, hidden: true, onChange: (e) => {
62
+ start(e.target.files?.[0]);
63
+ e.target.value = "";
64
+ } }), state.kind === "idle" ? (_jsxs("button", { type: "button", onClick: () => input.current?.click(), className: cn("flex aspect-[4/3] w-full flex-col items-center justify-center gap-3 rounded-xl text-center", "bg-[radial-gradient(var(--pk-hairline)_1px,transparent_1px)] bg-size-[10px_10px] transition-colors duration-200", over ? "bg-accent-soft" : "hover:bg-fill/50"), children: [_jsx("span", { className: cn("grid size-10 place-items-center rounded-xl bg-surface text-fg shadow-card transition-transform duration-300 ease-spring", over && "-translate-y-1"), children: _jsx(ArrowUpFromLine, { className: "size-4" }) }), _jsxs("span", { className: "space-y-0.5", children: [_jsx("span", { className: "block font-medium text-[14px] text-fg", children: title }), _jsx("span", { className: "block text-[12px] text-fg-3", children: hint })] })] })) : (_jsxs("div", { className: "relative aspect-[4/3] w-full overflow-hidden rounded-xl bg-fill", children: [_jsx("img", { src: state.url, alt: "", className: "absolute inset-0 size-full scale-105 object-cover opacity-70 blur-xl saturate-50" }), _jsx("img", { src: state.url, alt: state.name, className: "absolute inset-0 size-full object-cover transition-[mask-position] duration-150", style: {
65
+ maskImage: "linear-gradient(to bottom, #000 45%, transparent 55%)",
66
+ maskSize: "100% 220%",
67
+ maskPosition: `0 ${100 - pct}%`,
68
+ } }), _jsxs("div", { className: "absolute right-2 bottom-2 left-2 flex items-center gap-2", children: [_jsx("span", { className: "min-w-0 flex-1 truncate rounded-full bg-black/35 px-2.5 py-1 font-medium text-[12px] text-white backdrop-blur-md", children: state.name }), _jsx("span", { className: cn("grid h-6 min-w-11 place-items-center rounded-full px-2 font-medium text-[12px] tabular-nums backdrop-blur-md transition-colors duration-300", state.kind === "done" ? "bg-success text-white" : "bg-black/35 text-white"), children: state.kind === "done" ? _jsx(Check, { className: "size-3.5 animate-pk-in" }) : `${pct}%` })] }), _jsx("button", { type: "button", onClick: reset, "aria-label": "Remove", className: "absolute top-2 right-2 grid size-7 place-items-center rounded-full bg-black/35 text-white backdrop-blur-md transition-transform hover:scale-105 active:scale-95", children: _jsx(X, { className: "size-3.5" }) })] }))] }));
69
+ }
70
+ export { Dropzone };
@@ -0,0 +1,10 @@
1
+ import type * as React from "react";
2
+ interface EmptyStateProps extends Omit<React.ComponentProps<"div">, "title"> {
3
+ /** A built-in wireframe, or your own node. */
4
+ illustration?: "list" | "search" | "inbox" | React.ReactNode;
5
+ title: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ action?: React.ReactNode;
8
+ }
9
+ declare function EmptyState({ illustration, title, description, action, className, ...props }: EmptyStateProps): React.JSX.Element;
10
+ export { EmptyState };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../lib/utils.js";
4
+ /** A shrunken, honest piece of product UI — not clip art. */
5
+ function Wireframe({ kind }) {
6
+ const line = "var(--pk-fill-hover)";
7
+ return (_jsxs("svg", { viewBox: "0 0 120 84", className: "h-[84px] w-[120px]", "aria-hidden": true, children: [_jsx("rect", { x: "10", y: "6", width: "100", height: "72", rx: "12", fill: "var(--pk-surface)" }), _jsx("rect", { x: "10", y: "6", width: "100", height: "72", rx: "12", fill: "none", stroke: "var(--pk-hairline)" }), kind === "list" && (_jsxs(_Fragment, { children: [_jsx("rect", { x: "22", y: "20", width: "76", height: "12", rx: "4", fill: "none", stroke: line, strokeDasharray: "3 3" }), _jsx("rect", { x: "22", y: "38", width: "76", height: "12", rx: "4", fill: "none", stroke: line, strokeDasharray: "3 3" }), _jsx("rect", { x: "22", y: "56", width: "44", height: "12", rx: "4", fill: "none", stroke: line, strokeDasharray: "3 3" }), _jsx("circle", { cx: "92", cy: "62", r: "9", fill: "var(--pk-accent)" }), _jsx("path", { d: "M92 58v8M88 62h8", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round" })] })), kind === "search" && (_jsxs(_Fragment, { children: [_jsx("rect", { x: "22", y: "18", width: "76", height: "14", rx: "7", fill: line }), _jsx("circle", { cx: "31", cy: "25", r: "3", fill: "none", stroke: "var(--pk-fg-3)", strokeWidth: "1.4" }), _jsx("rect", { x: "38", y: "23.5", width: "22", height: "3", rx: "1.5", fill: "var(--pk-fg-3)", opacity: ".5" }), _jsx("circle", { cx: "60", cy: "56", r: "11", fill: "none", stroke: "var(--pk-fg-3)", strokeWidth: "1.6", opacity: ".7" }), _jsx("path", { d: "M68 64l7 7", stroke: "var(--pk-fg-3)", strokeWidth: "1.8", strokeLinecap: "round", opacity: ".7" }), _jsx("path", { d: "M56 53l8 6M64 53l-8 6", stroke: "var(--pk-fg-3)", strokeWidth: "1.4", strokeLinecap: "round", opacity: ".5" })] })), kind === "inbox" && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M30 40h60l-7-16H37z", fill: "none", stroke: line, strokeWidth: "1.6", strokeLinejoin: "round" }), _jsx("path", { d: "M30 40v20a4 4 0 0 0 4 4h52a4 4 0 0 0 4-4V40H74l-4 6H50l-4-6z", fill: line }), _jsx("path", { d: "M54 18l3 3 6-7", stroke: "var(--pk-success)", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })] }))] }));
8
+ }
9
+ function EmptyState({ illustration = "list", title, description, action, className, ...props }) {
10
+ return (_jsxs("div", { "data-slot": "empty-state", className: cn("flex flex-col items-center px-6 py-8 text-center", className), ...props, children: [_jsx("div", { className: "mb-4", children: typeof illustration === "string" ? (_jsx(Wireframe, { kind: illustration })) : (illustration) }), _jsx("p", { className: "font-medium text-[15px] text-fg", children: title }), description && (_jsx("p", { className: "mt-1 max-w-64 text-[13px] text-fg-2 leading-relaxed", children: description })), action && _jsx("div", { className: "mt-4", children: action })] }));
11
+ }
12
+ export { EmptyState };
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Fluid hover — one highlight glides between items instead of blinking at every gap.
4
+ * Wrap any list of interactive children; mark each with `data-fluid-item`.
5
+ */
6
+ declare function FluidHover({ className, children, orientation, activeValue, ...props }: React.ComponentProps<"div"> & {
7
+ orientation?: "vertical" | "horizontal";
8
+ /** If set, the highlight rests on the item with `data-value={activeValue}` when not hovering. */
9
+ activeValue?: string;
10
+ }): React.JSX.Element;
11
+ declare function FluidItem({ className, active, asChild, ...props }: React.ComponentProps<"button"> & {
12
+ active?: boolean;
13
+ asChild?: boolean;
14
+ }): React.JSX.Element;
15
+ export { FluidHover, FluidItem };