'use client' import { useId, useState, type AnchorHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, type InputHTMLAttributes, type ReactNode } from 'react' import FishiesImg from './FishiesImg' import { ICON_SIZES, iconByName, iconUrl, type IconSize, type SystemIconName } from './icons' import './kit.css' const cx = (...names: (string | false | null | undefined)[]) => names.filter(Boolean).join(' ') const px = (size: IconSize | number) => typeof size === 'number' ? size : ICON_SIZES[size] export function SystemIcon({ name, size = 'md', fallback, className }: { name: SystemIconName; size?: IconSize | number; fallback?: ReactNode; className?: string }) { const [failed, setFailed] = useState(false) const icon = iconByName(name) const side = px(size) if (!icon || failed) return fallback ? <>{fallback} : null return } export type ButtonTone = 'glass' | 'gold' | 'ghost' | 'danger' type ButtonOwn = { tone?: ButtonTone; size?: 'sm' | 'md' | 'lg'; icon?: SystemIconName; children?: ReactNode } /** A plump toy button: glass for everyday actions, gold for the one thing to press, ghost for a quiet third choice, danger for what cannot be undone. */ export function Button({ tone = 'glass', size = 'md', icon, children, className, type = 'button', ...rest }: ButtonOwn & ButtonHTMLAttributes) { return } /** The same button as a link, for an action that goes somewhere. */ export function ButtonLink({ tone = 'glass', size = 'md', icon, children, className, ...rest }: ButtonOwn & AnchorHTMLAttributes) { return {icon && }{children} } /** A round toy button for window controls, the video player and close; `label` is what it says to a screen reader. */ export function RoundButton({ label, tone = 'navy', size = 'md', icon, children, className, type = 'button', ...rest }: { label: string; tone?: 'navy' | 'coral' | 'gold'; size?: 'sm' | 'md' | 'lg'; icon?: SystemIconName; children?: ReactNode } & ButtonHTMLAttributes) { return } /** A small reading or choice: a dot of colour for a kind, an icon, or gold when chosen. */ export function Chip({ tone, icon, selected, onClick, children, className }: { tone?: string; icon?: SystemIconName; selected?: boolean; onClick?: () => void; children: ReactNode; className?: string }) { const style = tone ? { '--tone': tone } as CSSProperties : undefined const inner = <>{tone &&