@pawkit/ui 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +28 -2
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/lib/sounds.d.ts +5 -0
- package/dist/lib/sounds.js +94 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/ui/avatar.d.ts +17 -0
- package/dist/ui/avatar.js +30 -0
- package/dist/ui/button.d.ts +15 -0
- package/dist/ui/button.js +38 -0
- package/dist/ui/card.d.ts +6 -0
- package/dist/ui/card.js +14 -0
- package/dist/ui/command.d.ts +17 -0
- package/dist/ui/command.js +42 -0
- package/dist/ui/dialog.d.ts +14 -0
- package/dist/ui/dialog.js +25 -0
- package/dist/ui/dropzone.d.ts +14 -0
- package/dist/ui/dropzone.js +70 -0
- package/dist/ui/empty-state.d.ts +10 -0
- package/dist/ui/empty-state.js +12 -0
- package/dist/ui/fluid-hover.d.ts +15 -0
- package/dist/ui/fluid-hover.js +69 -0
- package/dist/ui/input.d.ts +8 -0
- package/dist/ui/input.js +15 -0
- package/dist/ui/juicy-button.d.ts +21 -0
- package/dist/ui/juicy-button.js +32 -0
- package/dist/ui/kbd.d.ts +3 -0
- package/dist/ui/kbd.js +7 -0
- package/dist/ui/list.d.ts +24 -0
- package/dist/ui/list.js +20 -0
- package/dist/ui/menu.d.ts +20 -0
- package/dist/ui/menu.js +42 -0
- package/dist/ui/pixel-pup.d.ts +88 -0
- package/dist/ui/pixel-pup.js +424 -0
- package/dist/ui/popover.d.ts +8 -0
- package/dist/ui/popover.js +12 -0
- package/dist/ui/segmented-control.d.ts +15 -0
- package/dist/ui/segmented-control.js +45 -0
- package/dist/ui/sheet.d.ts +12 -0
- package/dist/ui/sheet.js +16 -0
- package/dist/ui/slider.d.ts +5 -0
- package/dist/ui/slider.js +12 -0
- package/dist/ui/stepper.d.ts +14 -0
- package/dist/ui/stepper.js +55 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.js +9 -0
- package/dist/ui/tabs.d.ts +10 -0
- package/dist/ui/tabs.js +43 -0
- package/dist/ui/toast.d.ts +22 -0
- package/dist/ui/toast.js +49 -0
- package/dist/ui/tooltip.d.ts +17 -0
- package/dist/ui/tooltip.js +16 -0
- package/dist/ui/tuner.d.ts +39 -0
- package/dist/ui/tuner.js +52 -0
- package/package.json +63 -5
- package/styles.css +279 -0
package/dist/ui/tabs.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
const TabsContent = (props) => (_jsx(TabsPrimitive.Content, { ...props, className: cn("outline-none data-[state=active]:animate-pk-in", props.className) }));
|
|
8
|
+
/** The indicator glides to the active tab. `pill` like a segmented control, `line` like an underline. */
|
|
9
|
+
function TabsList({ variant = "line", className, children, ...props }) {
|
|
10
|
+
const ref = React.useRef(null);
|
|
11
|
+
const [box, setBox] = React.useState(null);
|
|
12
|
+
const [ready, setReady] = React.useState(false);
|
|
13
|
+
React.useLayoutEffect(() => {
|
|
14
|
+
const list = ref.current;
|
|
15
|
+
if (!list)
|
|
16
|
+
return;
|
|
17
|
+
const measure = () => {
|
|
18
|
+
const el = list.querySelector('[role="tab"][data-state="active"]');
|
|
19
|
+
if (el)
|
|
20
|
+
setBox({ x: el.offsetLeft, w: el.offsetWidth });
|
|
21
|
+
};
|
|
22
|
+
measure();
|
|
23
|
+
const mo = new MutationObserver(measure);
|
|
24
|
+
mo.observe(list, { attributes: true, subtree: true, attributeFilter: ["data-state"] });
|
|
25
|
+
const ro = new ResizeObserver(measure);
|
|
26
|
+
ro.observe(list);
|
|
27
|
+
const id = requestAnimationFrame(() => setReady(true));
|
|
28
|
+
return () => {
|
|
29
|
+
mo.disconnect();
|
|
30
|
+
ro.disconnect();
|
|
31
|
+
cancelAnimationFrame(id);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
return (_jsxs(TabsPrimitive.List, { ref: ref, "data-variant": variant, className: cn("group/tabs relative inline-flex items-center", variant === "pill"
|
|
35
|
+
? "rounded-[10px] bg-fill p-[3px]"
|
|
36
|
+
: "gap-5 shadow-[inset_0_-1px_0_var(--pk-hairline)]", className), ...props, children: [box && (_jsx("span", { "aria-hidden": true, className: cn("absolute left-0", variant === "pill"
|
|
37
|
+
? "top-[3px] bottom-[3px] rounded-[7px] bg-raised shadow-card"
|
|
38
|
+
: "bottom-0 h-[2px] rounded-full bg-fg", ready && "transition-[translate,width] duration-400 ease-spring"), style: { translate: `${box.x}px 0`, width: box.w } })), children] }));
|
|
39
|
+
}
|
|
40
|
+
function TabsTrigger({ className, ...props }) {
|
|
41
|
+
return (_jsx(TabsPrimitive.Trigger, { className: cn("relative z-10 inline-flex items-center gap-1.5 font-medium text-fg-2 text-sm outline-none transition-colors duration-200", "hover:text-fg data-[state=active]:text-fg [&_svg]:size-4", "group-data-[variant=line]/tabs:h-9 group-data-[variant=pill]/tabs:h-7 group-data-[variant=pill]/tabs:rounded-[7px] group-data-[variant=pill]/tabs:px-3.5 group-data-[variant=pill]/tabs:text-[13px]", "focus-visible:outline-2 focus-visible:outline-accent", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function dismiss(id: number): void;
|
|
3
|
+
/** toast("Saved") · toast.success(…) · toast.error(…) */
|
|
4
|
+
declare const toast: ((title: React.ReactNode, opts?: {
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}) => number) & {
|
|
8
|
+
success: (t: React.ReactNode, o?: {
|
|
9
|
+
description?: React.ReactNode;
|
|
10
|
+
duration?: number;
|
|
11
|
+
}) => number;
|
|
12
|
+
error: (t: React.ReactNode, o?: {
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
duration?: number;
|
|
15
|
+
}) => number;
|
|
16
|
+
dismiss: typeof dismiss;
|
|
17
|
+
};
|
|
18
|
+
/** Mount once. Toasts stack at the bottom; hovering fans them out. */
|
|
19
|
+
declare function Toaster({ className }: {
|
|
20
|
+
className?: string;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
export { Toaster, toast };
|
package/dist/ui/toast.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CircleAlert, CircleCheck } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
let items = [];
|
|
7
|
+
let seq = 0;
|
|
8
|
+
const listeners = new Set();
|
|
9
|
+
const emit = () => {
|
|
10
|
+
for (const l of listeners)
|
|
11
|
+
l();
|
|
12
|
+
};
|
|
13
|
+
function dismiss(id) {
|
|
14
|
+
items = items.map((t) => (t.id === id ? { ...t, leaving: true } : t));
|
|
15
|
+
emit();
|
|
16
|
+
window.setTimeout(() => {
|
|
17
|
+
items = items.filter((t) => t.id !== id);
|
|
18
|
+
emit();
|
|
19
|
+
}, 200);
|
|
20
|
+
}
|
|
21
|
+
function push(kind, title, opts) {
|
|
22
|
+
const id = ++seq;
|
|
23
|
+
items = [...items.slice(-4), { id, title, kind, description: opts?.description }];
|
|
24
|
+
emit();
|
|
25
|
+
window.setTimeout(() => dismiss(id), opts?.duration ?? 3200);
|
|
26
|
+
return id;
|
|
27
|
+
}
|
|
28
|
+
/** toast("Saved") · toast.success(…) · toast.error(…) */
|
|
29
|
+
const toast = Object.assign((title, opts) => push("default", title, opts), {
|
|
30
|
+
success: (t, o) => push("success", t, o),
|
|
31
|
+
error: (t, o) => push("error", t, o),
|
|
32
|
+
dismiss,
|
|
33
|
+
});
|
|
34
|
+
/** Mount once. Toasts stack at the bottom; hovering fans them out. */
|
|
35
|
+
function Toaster({ className }) {
|
|
36
|
+
const list = React.useSyncExternalStore((cb) => {
|
|
37
|
+
listeners.add(cb);
|
|
38
|
+
return () => listeners.delete(cb);
|
|
39
|
+
}, () => items, () => items);
|
|
40
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
41
|
+
const visible = list.slice(-3);
|
|
42
|
+
return (_jsx("section", { "aria-live": "polite", "aria-label": "Notifications", onPointerEnter: () => setExpanded(true), onPointerLeave: () => setExpanded(false), className: cn("-translate-x-1/2 fixed bottom-6 left-1/2 z-[100] w-[min(360px,calc(100vw-32px))]", className), children: visible.map((t, i) => {
|
|
43
|
+
const depth = visible.length - 1 - i;
|
|
44
|
+
const y = expanded ? -depth * 60 : -depth * 8;
|
|
45
|
+
const scale = expanded ? 1 : 1 - depth * 0.05;
|
|
46
|
+
return (_jsxs("div", { role: "status", className: cn("absolute right-0 bottom-0 left-0 flex items-start gap-2.5 rounded-xl bg-raised px-3.5 py-3 shadow-float", "transition-[translate,scale,opacity] duration-400 ease-spring", t.leaving ? "animate-pk-out" : "animate-[pk-toast-in_420ms_var(--pk-spring)]"), style: { translate: `0 ${y}px`, scale, opacity: depth > 2 ? 0 : 1, zIndex: i }, onClick: () => dismiss(t.id), onKeyDown: (e) => e.key === "Escape" && dismiss(t.id), children: [t.kind === "success" && _jsx(CircleCheck, { className: "mt-px size-4 shrink-0 text-success" }), t.kind === "error" && _jsx(CircleAlert, { className: "mt-px size-4 shrink-0 text-danger" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium text-[14px] text-fg", children: t.title }), t.description && _jsx("p", { className: "mt-0.5 text-[13px] text-fg-2", children: t.description })] })] }, t.id));
|
|
47
|
+
}) }));
|
|
48
|
+
}
|
|
49
|
+
export { Toaster, toast };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Tooltips that wait once, then show at once.
|
|
5
|
+
* The first hover waits `delayDuration`; moving to a neighbour within
|
|
6
|
+
* `skipDelayDuration` shows it instantly — like a native toolbar.
|
|
7
|
+
*/
|
|
8
|
+
declare function TooltipProvider({ delayDuration, skipDelayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
9
|
+
interface TooltipProps {
|
|
10
|
+
content: React.ReactNode;
|
|
11
|
+
children: React.ReactElement;
|
|
12
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
13
|
+
/** Optional shortcut hint, e.g. "⌘B". */
|
|
14
|
+
shortcut?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function Tooltip({ content, children, side, shortcut }: TooltipProps): React.JSX.Element;
|
|
17
|
+
export { Tooltip, TooltipProvider };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Tooltips that wait once, then show at once.
|
|
7
|
+
* The first hover waits `delayDuration`; moving to a neighbour within
|
|
8
|
+
* `skipDelayDuration` shows it instantly — like a native toolbar.
|
|
9
|
+
*/
|
|
10
|
+
function TooltipProvider({ delayDuration = 500, skipDelayDuration = 400, ...props }) {
|
|
11
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: delayDuration, skipDelayDuration: skipDelayDuration, ...props }));
|
|
12
|
+
}
|
|
13
|
+
function Tooltip({ content, children, side = "top", shortcut }) {
|
|
14
|
+
return (_jsxs(TooltipPrimitive.Root, { children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip", side: side, sideOffset: 6, className: cn("z-50 flex items-center gap-1.5 rounded-md bg-fg px-2 py-1 font-medium text-[12px] text-bg", "origin-(--radix-tooltip-content-transform-origin) shadow-float", "data-[state=delayed-open]:animate-pk-in data-[state=closed]:animate-pk-out"), children: [content, shortcut && _jsx("span", { className: "opacity-55", children: shortcut })] }) })] }));
|
|
15
|
+
}
|
|
16
|
+
export { Tooltip, TooltipProvider };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Tuner — a floating panel for tweaking a design live, like a design tool's inspector.
|
|
4
|
+
* Number fields scrub: drag anywhere on the tile horizontally. Hold Shift for ×10.
|
|
5
|
+
*/
|
|
6
|
+
declare function Tuner({ title, onReset, defaultOpen, className, children, }: {
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
onReset?: () => void;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare function TunerSection({ title, children }: {
|
|
14
|
+
title?: React.ReactNode;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare function TunerNumber({ label, value, onChange, min, max, step, unit, wide, }: {
|
|
18
|
+
label: React.ReactNode;
|
|
19
|
+
value: number;
|
|
20
|
+
onChange: (v: number) => void;
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
step?: number;
|
|
24
|
+
unit?: string;
|
|
25
|
+
wide?: boolean;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare function TunerColor({ label, value, onChange, wide, }: {
|
|
28
|
+
label: React.ReactNode;
|
|
29
|
+
value: string;
|
|
30
|
+
onChange: (v: string) => void;
|
|
31
|
+
wide?: boolean;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
declare function TunerToggle({ label, value, onChange, wide, }: {
|
|
34
|
+
label: React.ReactNode;
|
|
35
|
+
value: boolean;
|
|
36
|
+
onChange: (v: boolean) => void;
|
|
37
|
+
wide?: boolean;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
export { Tuner, TunerColor, TunerNumber, TunerSection, TunerToggle };
|
package/dist/ui/tuner.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDown, RotateCcw } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* Tuner — a floating panel for tweaking a design live, like a design tool's inspector.
|
|
8
|
+
* Number fields scrub: drag anywhere on the tile horizontally. Hold Shift for ×10.
|
|
9
|
+
*/
|
|
10
|
+
function Tuner({ title = "Tuner", onReset, defaultOpen = true, className, children, }) {
|
|
11
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
12
|
+
return (_jsxs("div", { "data-slot": "tuner", className: cn("w-[264px] rounded-2xl bg-surface p-1.5 text-[12px] shadow-float", className), children: [_jsxs("div", { className: "flex h-8 items-center gap-1 pr-0.5 pl-2.5", children: [_jsx("span", { className: "flex-1 font-medium text-fg-2", children: title }), onReset && (_jsx("button", { type: "button", onClick: onReset, "aria-label": "Reset", className: "grid size-6 place-items-center rounded-md text-fg-3 transition hover:bg-fill hover:text-fg active:rotate-[-90deg]", children: _jsx(RotateCcw, { className: "size-3.5" }) })), _jsx("button", { type: "button", onClick: () => setOpen((o) => !o), "aria-expanded": open, "aria-label": "Toggle", className: "grid size-6 place-items-center rounded-md text-fg-3 transition hover:bg-fill hover:text-fg", children: _jsx(ChevronDown, { className: cn("size-3.5 transition-transform duration-300 ease-spring", !open && "-rotate-90") }) })] }), _jsx("div", { className: cn("grid transition-[grid-template-rows,opacity] duration-300 ease-pk", open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"), children: _jsx("div", { className: "overflow-hidden", children: _jsx("div", { className: "space-y-3 p-1 pt-0.5", children: children }) }) })] }));
|
|
13
|
+
}
|
|
14
|
+
function TunerSection({ title, children }) {
|
|
15
|
+
return (_jsxs("div", { className: "space-y-1.5", children: [title && _jsx("p", { className: "px-1.5 text-[11px] text-fg-3", children: title }), _jsx("div", { className: "grid grid-cols-2 gap-1.5", children: children })] }));
|
|
16
|
+
}
|
|
17
|
+
const tile = "flex h-[52px] flex-col justify-between rounded-[10px] bg-fill px-2.5 py-2";
|
|
18
|
+
function TunerNumber({ label, value, onChange, min = -Infinity, max = Infinity, step = 1, unit, wide, }) {
|
|
19
|
+
const drag = React.useRef(null);
|
|
20
|
+
const clamp = (v) => Math.min(max, Math.max(min, +v.toFixed(4)));
|
|
21
|
+
const pct = Number.isFinite(min) && Number.isFinite(max) ? (value - min) / (max - min) : null;
|
|
22
|
+
return (_jsxs("div", { className: cn(tile, "cursor-ew-resize touch-none select-none", wide && "col-span-2"), onPointerDown: (e) => {
|
|
23
|
+
if (e.target.tagName === "INPUT")
|
|
24
|
+
return;
|
|
25
|
+
drag.current = { x: e.clientX, v: value };
|
|
26
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
27
|
+
}, onPointerMove: (e) => {
|
|
28
|
+
if (!drag.current)
|
|
29
|
+
return;
|
|
30
|
+
const dx = e.clientX - drag.current.x;
|
|
31
|
+
onChange(clamp(drag.current.v + Math.round(dx / 4) * step * (e.shiftKey ? 10 : 1)));
|
|
32
|
+
}, onPointerUp: () => {
|
|
33
|
+
drag.current = null;
|
|
34
|
+
}, children: [_jsx("span", { className: "text-fg-3", children: label }), _jsxs("span", { className: "flex items-center gap-1", children: [_jsx("input", { inputMode: "decimal", value: value, onChange: (e) => {
|
|
35
|
+
const n = Number(e.target.value);
|
|
36
|
+
if (!Number.isNaN(n))
|
|
37
|
+
onChange(clamp(n));
|
|
38
|
+
}, onKeyDown: (e) => {
|
|
39
|
+
const d = e.key === "ArrowUp" ? 1 : e.key === "ArrowDown" ? -1 : 0;
|
|
40
|
+
if (!d)
|
|
41
|
+
return;
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
onChange(clamp(value + d * step * (e.shiftKey ? 10 : 1)));
|
|
44
|
+
}, className: "w-0 flex-1 cursor-text bg-transparent font-medium text-[13px] text-fg tabular-nums outline-none" }), unit && _jsx("span", { className: "text-fg-3", children: unit }), pct !== null && (_jsxs("svg", { viewBox: "0 0 16 16", className: "size-3.5 shrink-0 text-fg-3", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeOpacity: ".35" }), _jsx("line", { x1: "8", y1: "8", x2: "8", y2: "2.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", transform: `rotate(${-135 + pct * 270} 8 8)` })] }))] })] }));
|
|
45
|
+
}
|
|
46
|
+
function TunerColor({ label, value, onChange, wide, }) {
|
|
47
|
+
return (_jsxs("label", { className: cn(tile, "cursor-pointer", wide && "col-span-2"), children: [_jsx("span", { className: "text-fg-3", children: label }), _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "flex-1 font-medium font-mono text-[12px] text-fg uppercase", children: value }), _jsx("span", { className: "relative size-3.5 overflow-hidden rounded-[4px] shadow-[inset_0_0_0_0.5px_rgb(0_0_0/.2)]", style: { background: value }, children: _jsx("input", { type: "color", value: value, onChange: (e) => onChange(e.target.value), className: "absolute inset-0 cursor-pointer opacity-0" }) })] })] }));
|
|
48
|
+
}
|
|
49
|
+
function TunerToggle({ label, value, onChange, wide, }) {
|
|
50
|
+
return (_jsxs("button", { type: "button", role: "switch", "aria-checked": value, onClick: () => onChange(!value), className: cn(tile, "text-left", wide && "col-span-2"), children: [_jsx("span", { className: "text-fg-3", children: label }), _jsxs("span", { className: "flex w-full items-center", children: [_jsx("span", { className: "flex-1 font-medium text-[13px] text-fg", children: value ? "On" : "Off" }), _jsx("span", { className: cn("grid size-3.5 place-items-center rounded-full transition-colors duration-200", value ? "bg-success" : "bg-fg-3/40"), children: _jsx("span", { className: cn("size-1.5 rounded-full bg-white transition-transform duration-300 ease-spring", value ? "scale-100" : "scale-0") }) })] })] }));
|
|
51
|
+
}
|
|
52
|
+
export { Tuner, TunerColor, TunerNumber, TunerSection, TunerToggle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@pawkit/ui",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Quiet, soft, tactile React components. Tailwind v4 + Radix.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Dogxi",
|
|
7
|
+
"homepage": "https://ui.dogxi.me",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/dogxii/pawkit.git",
|
|
11
|
+
"directory": "packages/ui"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react",
|
|
15
|
+
"components",
|
|
16
|
+
"ui",
|
|
17
|
+
"tailwindcss",
|
|
18
|
+
"radix-ui",
|
|
19
|
+
"design-system",
|
|
20
|
+
"pawkit"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"*.css"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./styles.css": "./styles.css",
|
|
32
|
+
"./lib/*": {
|
|
33
|
+
"types": "./dist/lib/*.d.ts",
|
|
34
|
+
"default": "./dist/lib/*.js"
|
|
35
|
+
},
|
|
36
|
+
"./*": {
|
|
37
|
+
"types": "./dist/ui/*.d.ts",
|
|
38
|
+
"default": "./dist/ui/*.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"main": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"styles.css",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": ">=19",
|
|
51
|
+
"react-dom": ">=19"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"class-variance-authority": "^0.7.1",
|
|
55
|
+
"clsx": "^2.1.1",
|
|
56
|
+
"cmdk": "^1.1.1",
|
|
57
|
+
"lucide-react": "^1.84.0",
|
|
58
|
+
"radix-ui": "^1.8.1",
|
|
59
|
+
"tailwind-merge": "^3.7.1"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PawKit design tokens.
|
|
3
|
+
* Import after `@import "tailwindcss";` — every component reads only these variables.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
color-scheme: light;
|
|
10
|
+
/* Surfaces — light, airy, layered by small steps of gray, not by borders */
|
|
11
|
+
--pk-bg: #f5f5f7;
|
|
12
|
+
--pk-surface: #ffffff;
|
|
13
|
+
--pk-fill: #ececef;
|
|
14
|
+
--pk-fill-hover: #e3e3e7;
|
|
15
|
+
--pk-raised: #ffffff;
|
|
16
|
+
--pk-stage: rgb(255 255 255 / 0.6);
|
|
17
|
+
|
|
18
|
+
/* Text */
|
|
19
|
+
--pk-fg: #111113;
|
|
20
|
+
--pk-fg-2: #6e6e73;
|
|
21
|
+
--pk-fg-3: #a1a1a6;
|
|
22
|
+
--pk-on-accent: #ffffff;
|
|
23
|
+
|
|
24
|
+
/* One accent. Everything else is gray. */
|
|
25
|
+
--pk-accent: #0a7cff;
|
|
26
|
+
--pk-accent-soft: color-mix(in oklab, var(--pk-accent) 14%, transparent);
|
|
27
|
+
--pk-success: #30c25a;
|
|
28
|
+
--pk-danger: #ff3b30;
|
|
29
|
+
--pk-warning: #ff9f0a;
|
|
30
|
+
|
|
31
|
+
/* Hairline: used for inset list separators only */
|
|
32
|
+
--pk-hairline: rgb(0 0 0 / 0.07);
|
|
33
|
+
|
|
34
|
+
/* Elevation */
|
|
35
|
+
--pk-shadow-card:
|
|
36
|
+
0 0 0 0.5px rgb(0 0 0 / 0.04), 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px -4px rgb(0 0 0 / 0.05);
|
|
37
|
+
--pk-shadow-float:
|
|
38
|
+
0 0 0 0.5px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.04), 0 14px 40px -8px rgb(0 0 0 / 0.14);
|
|
39
|
+
--pk-shadow-thumb:
|
|
40
|
+
0 0 0 0.5px rgb(0 0 0 / 0.04), 0 3px 8px rgb(0 0 0 / 0.15), 0 1px 1px rgb(0 0 0 / 0.08);
|
|
41
|
+
|
|
42
|
+
/* Shape */
|
|
43
|
+
--pk-radius: 12px;
|
|
44
|
+
|
|
45
|
+
/* Motion */
|
|
46
|
+
--pk-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
47
|
+
--pk-spring: linear(
|
|
48
|
+
0,
|
|
49
|
+
0.009,
|
|
50
|
+
0.035 2.1%,
|
|
51
|
+
0.141 4.4%,
|
|
52
|
+
0.723 12.9%,
|
|
53
|
+
0.938 16.7%,
|
|
54
|
+
1.017 19.4%,
|
|
55
|
+
1.067,
|
|
56
|
+
1.099 24.3%,
|
|
57
|
+
1.108 26%,
|
|
58
|
+
1.104 27.8%,
|
|
59
|
+
1.064 32.9%,
|
|
60
|
+
1.008 38.8%,
|
|
61
|
+
0.99 42.6%,
|
|
62
|
+
0.983 46.4%,
|
|
63
|
+
1.001 58.7%,
|
|
64
|
+
1
|
|
65
|
+
);
|
|
66
|
+
--pk-dur: 240ms;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.dark {
|
|
70
|
+
color-scheme: dark;
|
|
71
|
+
--pk-bg: #111111;
|
|
72
|
+
--pk-surface: #1a1a1a;
|
|
73
|
+
--pk-fill: #232323;
|
|
74
|
+
--pk-fill-hover: #2b2b2b;
|
|
75
|
+
--pk-raised: #333335;
|
|
76
|
+
--pk-stage: rgb(255 255 255 / 0.025);
|
|
77
|
+
|
|
78
|
+
--pk-fg: #eeeeee;
|
|
79
|
+
--pk-fg-2: #a3a3a3;
|
|
80
|
+
--pk-fg-3: #6b6b6b;
|
|
81
|
+
|
|
82
|
+
--pk-accent: #2b8fff;
|
|
83
|
+
--pk-hairline: rgb(255 255 255 / 0.07);
|
|
84
|
+
|
|
85
|
+
--pk-shadow-card: 0 0 0 0.5px rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.3);
|
|
86
|
+
--pk-shadow-float: 0 0 0 0.5px rgb(255 255 255 / 0.08), 0 16px 40px -8px rgb(0 0 0 / 0.6);
|
|
87
|
+
--pk-shadow-thumb: 0 0 0 0.5px rgb(0 0 0 / 0.2), 0 3px 8px rgb(0 0 0 / 0.4);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@theme inline {
|
|
91
|
+
--color-bg: var(--pk-bg);
|
|
92
|
+
--color-surface: var(--pk-surface);
|
|
93
|
+
--color-fill: var(--pk-fill);
|
|
94
|
+
--color-fill-hover: var(--pk-fill-hover);
|
|
95
|
+
--color-raised: var(--pk-raised);
|
|
96
|
+
--color-stage: var(--pk-stage);
|
|
97
|
+
--color-fg: var(--pk-fg);
|
|
98
|
+
--color-fg-2: var(--pk-fg-2);
|
|
99
|
+
--color-fg-3: var(--pk-fg-3);
|
|
100
|
+
--color-on-accent: var(--pk-on-accent);
|
|
101
|
+
--color-accent: var(--pk-accent);
|
|
102
|
+
--color-accent-soft: var(--pk-accent-soft);
|
|
103
|
+
--color-success: var(--pk-success);
|
|
104
|
+
--color-danger: var(--pk-danger);
|
|
105
|
+
--color-warning: var(--pk-warning);
|
|
106
|
+
--color-hairline: var(--pk-hairline);
|
|
107
|
+
|
|
108
|
+
--shadow-card: var(--pk-shadow-card);
|
|
109
|
+
--shadow-float: var(--pk-shadow-float);
|
|
110
|
+
--shadow-thumb: var(--pk-shadow-thumb);
|
|
111
|
+
|
|
112
|
+
--radius-sm: calc(var(--pk-radius) * 0.5);
|
|
113
|
+
--radius-md: calc(var(--pk-radius) * 0.75);
|
|
114
|
+
--radius-lg: var(--pk-radius);
|
|
115
|
+
--radius-xl: calc(var(--pk-radius) * 1.5);
|
|
116
|
+
--radius-2xl: calc(var(--pk-radius) * 2);
|
|
117
|
+
|
|
118
|
+
--ease-pk: var(--pk-ease);
|
|
119
|
+
--ease-spring: var(--pk-spring);
|
|
120
|
+
|
|
121
|
+
--font-sans:
|
|
122
|
+
"InterVariable", "Inter", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
|
|
123
|
+
sans-serif;
|
|
124
|
+
--font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
|
|
125
|
+
|
|
126
|
+
--animate-pk-in: pk-in 180ms var(--pk-ease);
|
|
127
|
+
--animate-pk-out: pk-out 120ms ease-in forwards;
|
|
128
|
+
--animate-pk-spin: spin 700ms linear infinite;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@keyframes pk-in {
|
|
132
|
+
from {
|
|
133
|
+
opacity: 0;
|
|
134
|
+
transform: scale(0.96) translateY(2px);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
@keyframes pk-out {
|
|
138
|
+
to {
|
|
139
|
+
opacity: 0;
|
|
140
|
+
transform: scale(0.97);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@layer base {
|
|
145
|
+
body {
|
|
146
|
+
background: var(--pk-bg);
|
|
147
|
+
color: var(--pk-fg);
|
|
148
|
+
font-family: var(--font-sans);
|
|
149
|
+
font-feature-settings: "cv11", "ss01";
|
|
150
|
+
-webkit-font-smoothing: antialiased;
|
|
151
|
+
-moz-osx-font-smoothing: grayscale;
|
|
152
|
+
}
|
|
153
|
+
* {
|
|
154
|
+
scrollbar-width: thin;
|
|
155
|
+
scrollbar-color: color-mix(in srgb, var(--pk-fg) 18%, transparent) transparent;
|
|
156
|
+
}
|
|
157
|
+
::selection {
|
|
158
|
+
background: var(--pk-accent-soft);
|
|
159
|
+
}
|
|
160
|
+
:focus-visible {
|
|
161
|
+
outline: 2px solid var(--pk-accent);
|
|
162
|
+
outline-offset: 2px;
|
|
163
|
+
}
|
|
164
|
+
@media (prefers-reduced-motion: reduce) {
|
|
165
|
+
*,
|
|
166
|
+
*::before,
|
|
167
|
+
*::after {
|
|
168
|
+
transition-duration: 1ms !important;
|
|
169
|
+
animation-duration: 1ms !important;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@keyframes pk-roll {
|
|
175
|
+
from {
|
|
176
|
+
opacity: 0;
|
|
177
|
+
transform: translateY(var(--pk-roll-from, 60%));
|
|
178
|
+
filter: blur(2px);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@keyframes pk-toast-in {
|
|
183
|
+
from {
|
|
184
|
+
opacity: 0;
|
|
185
|
+
transform: translateY(24px) scale(0.96);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes pk-zz {
|
|
190
|
+
0% {
|
|
191
|
+
opacity: 0;
|
|
192
|
+
transform: translate(0, 4px);
|
|
193
|
+
}
|
|
194
|
+
40% {
|
|
195
|
+
opacity: 1;
|
|
196
|
+
}
|
|
197
|
+
100% {
|
|
198
|
+
opacity: 0;
|
|
199
|
+
transform: translate(6px, -8px);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
@keyframes pk-bark {
|
|
203
|
+
0% {
|
|
204
|
+
opacity: 0;
|
|
205
|
+
transform: scale(0.6);
|
|
206
|
+
}
|
|
207
|
+
20% {
|
|
208
|
+
opacity: 1;
|
|
209
|
+
transform: scale(1.05);
|
|
210
|
+
}
|
|
211
|
+
70% {
|
|
212
|
+
opacity: 1;
|
|
213
|
+
transform: scale(1);
|
|
214
|
+
}
|
|
215
|
+
100% {
|
|
216
|
+
opacity: 0;
|
|
217
|
+
transform: translateY(-6px);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@keyframes pk-hop {
|
|
222
|
+
40% {
|
|
223
|
+
transform: translateY(-7px) scale(1.04, 0.98);
|
|
224
|
+
}
|
|
225
|
+
75% {
|
|
226
|
+
transform: translateY(0) scale(1.06, 0.92);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
@keyframes pk-land {
|
|
230
|
+
35% {
|
|
231
|
+
transform: scale(1.1, 0.86);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes pk-fade-in {
|
|
236
|
+
from {
|
|
237
|
+
opacity: 0;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
@keyframes pk-fade-out {
|
|
241
|
+
to {
|
|
242
|
+
opacity: 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
@keyframes pk-pop-in {
|
|
246
|
+
from {
|
|
247
|
+
opacity: 0;
|
|
248
|
+
scale: 0.94;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
@keyframes pk-pop-out {
|
|
252
|
+
to {
|
|
253
|
+
opacity: 0;
|
|
254
|
+
scale: 0.97;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
@keyframes pk-sheet-right-in {
|
|
258
|
+
from {
|
|
259
|
+
transform: translateX(calc(100% + 16px));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
@keyframes pk-sheet-right-out {
|
|
263
|
+
to {
|
|
264
|
+
transform: translateX(calc(100% + 16px));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
@keyframes pk-sheet-up-in {
|
|
268
|
+
from {
|
|
269
|
+
transform: translateY(100%);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
@keyframes pk-sheet-up-out {
|
|
273
|
+
to {
|
|
274
|
+
transform: translateY(100%);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Let Tailwind see the classes used inside the package. */
|
|
279
|
+
@source "./dist";
|