diff --git a/src/components/formPrimitives.tsx b/src/components/formPrimitives.tsx index f15b81d..e9c3a2e 100644 --- a/src/components/formPrimitives.tsx +++ b/src/components/formPrimitives.tsx @@ -1,24 +1,24 @@ 'use client'; -import { useId, type ButtonHTMLAttributes, type ReactNode } from 'react'; -import { - btnBase, - btnDanger, - btnGhost, - btnOutline, - btnPrimary, - btnSecondary, - buttonClass, - type ButtonSize, - type ButtonVariant, -} from '@/components/ui/buttonPrimitives'; - /** - * Shared compact form primitives used by settings-like surfaces across - * the app (settings modal, document settings, and admin panels). + * Compatibility shim for older settings/admin imports. + * New UI work should import from `@/components/ui/*` or `@/components/ui`. */ - export { + Badge, + Button, + Card, + CheckItem, + Divider, + Field, + IconButton, + Menu, + Panel, + Section, + Sidebar, + Surface, + Switch, + ToggleRow, btnBase, btnDanger, btnGhost, @@ -26,364 +26,13 @@ export { btnPrimary, btnSecondary, buttonClass, + inputClass, + listboxButtonClass, + listboxOptionClass, + listboxOptionsClass, + segmentedButtonClass, + segmentedGroupClass, type ButtonSize, type ButtonVariant, -}; - -// Inputs use `bg-surface` so they remain visible regardless of whether the -// surrounding container is `bg-background` (Card) or `bg-surface` (Section). -// Using the same `bg-background` as the Card would make the input blend in. -// (Note: never use Tailwind alpha modifiers on these theme variables — they -// resolve to CSS custom properties that don't accept opacity suffixes.) -export const inputClass = - 'w-full rounded-md bg-surface-sunken border border-line px-2.5 py-1.5 text-sm text-foreground transition-colors duration-fast ease-standard focus:outline-none focus:ring-2 focus:ring-accent-line focus:border-accent-line'; - -export const listboxButtonClass = - 'relative w-full cursor-pointer rounded-md bg-surface-sunken border border-line py-1.5 pl-2.5 pr-9 text-left text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-accent-line hover:bg-accent-wash transition-colors duration-fast ease-standard'; -export const listboxOptionsClass = - 'z-50 w-[var(--button-width)] max-h-60 overflow-y-auto overscroll-contain rounded-md bg-surface p-1 shadow-elev-2 ring-1 ring-line focus:outline-none [--anchor-gap:0.25rem]'; -export const listboxOptionClass = (active: boolean) => - `relative cursor-pointer select-none rounded-sm py-1.5 pl-9 pr-3 text-sm ${active ? 'bg-accent-wash text-foreground' : 'text-foreground'}`; - -export const segmentedGroupClass = - 'grid gap-1 rounded-full border border-line bg-surface-sunken p-1'; -export const segmentedButtonClass = (active: boolean) => - `rounded-full px-2.5 py-1.5 text-xs font-medium transition-colors duration-fast ease-standard focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${ - active - ? 'bg-accent text-background' - : 'text-soft hover:bg-accent-wash hover:text-foreground' - }`; - -type SurfaceElevation = 'none' | '1' | '2' | '3'; - -const SURFACE_ELEVATION_CLASS: Record = { - none: '', - '1': 'shadow-elev-1', - '2': 'shadow-elev-2', - '3': 'shadow-elev-3', -}; - -export function Surface({ - children, - className = '', - elevation = 'none', -}: { - children: ReactNode; - className?: string; - elevation?: SurfaceElevation; -}) { - return ( -
- {children} -
- ); -} - -export function Panel({ - children, - className = '', -}: { - children: ReactNode; - className?: string; -}) { - return ( - - {children} - - ); -} - -export function Sidebar({ - children, - className = '', -}: { - children: ReactNode; - className?: string; -}) { - return ( - - ); -} - -export function Divider({ className = '' }: { className?: string }) { - return