mirror of
https://github.com/luxfi/design.git
synced 2026-10-30 16:58:57 +00:00
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]>
32 lines
1.6 KiB
React
32 lines
1.6 KiB
React
import React from 'react'
|
|
|
|
export function Sheet({ open, onOpenChange, side = 'right', width = 380, children }) {
|
|
React.useEffect(() => {
|
|
if (!open) return
|
|
const onKey = (e) => { if (e.key === 'Escape') onOpenChange && onOpenChange(false) }
|
|
document.addEventListener('keydown', onKey)
|
|
return () => document.removeEventListener('keydown', onKey)
|
|
}, [open, onOpenChange])
|
|
if (!open) return null
|
|
const pos = side === 'left'
|
|
? { left: 0, top: 0, bottom: 0, width, borderRight: '1px solid var(--border)' }
|
|
: { right: 0, top: 0, bottom: 0, width, borderLeft: '1px solid var(--border)' }
|
|
return (
|
|
<div onClick={() => onOpenChange && onOpenChange(false)} style={{position:'fixed',inset:0,zIndex:80,background:'rgb(0 0 0 / .7)'}}>
|
|
<div
|
|
onClick={(e) => e.stopPropagation()}
|
|
style={{position:'absolute',display:'flex',flexDirection:'column',background:'var(--popover)',boxShadow:'var(--shadow-floating)',animation:'lux-fade-up var(--duration-base) var(--ease-out)',...pos}}
|
|
>{children}</div>
|
|
</div>
|
|
)
|
|
}
|
|
export function SheetHeader({ style, children, ...rest }) {
|
|
return <div style={{padding:'20px 24px',borderBottom:'1px solid var(--border)',display:'flex',flexDirection:'column',gap:4,...style}} {...rest}>{children}</div>
|
|
}
|
|
export function SheetTitle({ style, children, ...rest }) {
|
|
return <h2 style={{fontSize:'var(--text-base)',fontWeight:'var(--weight-semibold)',color:'var(--text-primary)',...style}} {...rest}>{children}</h2>
|
|
}
|
|
export function SheetContent({ style, children, ...rest }) {
|
|
return <div style={{flex:1,overflowY:'auto',padding:24,...style}} {...rest}>{children}</div>
|
|
}
|