Files
zeekayandHanzo Dev 01dc7b5306 fix: shipped components spoke the fork's border vocabulary, which no longer exists
Swapping the forked token layer for the inherited one silently orphaned
two names. The fork declared --border-hairline (a solid #262626) and
--border-card; the substrate draws every one of those boundaries with a
single alpha --border, and explains at length why alpha beats a solid hex
there — a solid edge reads on the page and vanishes the moment it lands
on a lifted surface.

Nineteen shipped files still asked for the old names: Card, Avatar,
Badge, Table, Accordion, Dialog, DropdownMenu, Sheet, Toaster, seven
specimen cards, and the generation prompts. An undefined custom property
in `border:1px solid var(--gone)` does not fail. The declaration is
invalid at computed-value time, border-color falls back to currentColor,
and every one of those surfaces draws its edge in the INK colour — a
stark near-white hairline on black that reads as a bold design choice
rather than as nineteen broken files.

They are not re-declared as aliases. Both mapped to the substrate's
--border, so keeping them would be two names for one thing — exactly the
duplication this package exists to remove. The components now speak the
substrate's vocabulary.

check-tokens gains the check that would have caught it. Check 4 proves
the STYLESHEET is internally consistent and says nothing about the
components, kits, specimen cards and prompts shipped beside it — which
are the files a consumer actually renders. Now every var() in all 78 of
them must resolve against the sheet. Mutation-proven: pointing one card
back at --border-hairline fails the build.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-05 15:50:28 -07:00

38 lines
2.0 KiB
React

import React from 'react'
const Ctx = React.createContext({ open: null, toggle: () => {} })
export function Accordion({ type = 'single', defaultValue = null, style, children, ...rest }) {
const [open, setOpen] = React.useState(type === 'multiple' ? [].concat(defaultValue || []) : defaultValue)
const toggle = (v) => {
if (type === 'multiple') setOpen((cur) => (cur.includes(v) ? cur.filter((x) => x !== v) : [...cur, v]))
else setOpen((cur) => (cur === v ? null : v))
}
const isOpen = (v) => (type === 'multiple' ? open.includes(v) : open === v)
return (
<Ctx.Provider value={{ isOpen, toggle }}>
<div style={{borderTop:'1px solid var(--border)',...style}} {...rest}>{children}</div>
</Ctx.Provider>
)
}
export function AccordionItem({ value, title, style, children, ...rest }) {
const { isOpen, toggle } = React.useContext(Ctx)
const on = isOpen(value)
return (
<div style={{borderBottom:'1px solid var(--border)',...style}} {...rest}>
<button
onClick={() => toggle(value)} aria-expanded={on}
style={{display:'flex',width:'100%',alignItems:'center',justifyContent:'space-between',gap:16,padding:'18px 0',background:'transparent',border:'none',cursor:'pointer',textAlign:'left',fontFamily:'var(--font-sans)',fontSize:'var(--text-base)',fontWeight:'var(--weight-medium)',color:'var(--text-primary)'}}
>
{title}
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--text-helper)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" style={{flexShrink:0,transform: on ? 'rotate(180deg)' : 'none',transition:'transform var(--duration-fast) var(--ease-out)'}}><polyline points="6 9 12 15 18 9" /></svg>
</button>
{on && <div style={{paddingBottom:20,fontSize:'var(--text-sm)',lineHeight:'var(--leading-relaxed)',color:'var(--text-helper)',maxWidth:'62ch'}}>{children}</div>}
</div>
)
}
export const AccordionTrigger = ({ children }) => children
export const AccordionContent = ({ children }) => children