feat(ui): the shared page frame and toolbar kit: Page, PageHeader, Toolbar, Dropdown (multi-select), SearchInput, FilterChip, Segmented, Tabs
Owner's UI review (2026-11-20): pages that don't scroll and sit on the left, native selects in toolbars, controls of different heights, labels too loud. Everything is global in @xenia/ui so no page rebuilds it: - Page: scrolls on its own, fills the area up to a 16:9 screen's width (--x-page-max = max(1280px, 100vh*16/9)), centred beyond (ultrawides); width="form" for settings; top= keeps a tab strip above the scroll - Dropdown: portal list, flips above, keyboard, search for long lists, multiple (array value, [] = all, allLabel), dots and hints; Input heights - SearchInput, FilterChip (tone + count), Segmented, Tabs (sideways scroll only, no 1px up/down scroll), Toolbar/ToolbarSpacer - InfoTip opens on hover too; Dialog size xl (920px) - tokens: --x-text-overline (11px), --x-pad-card(-y), muted ink-2 (contrast test still passes in every look); preset: text-overline, p-card, max-w-page, the special tone - component labels (search, clear, all, nothing found) in en/el Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,8 @@ const MARGIN = 8
|
||||
|
||||
/**
|
||||
* The "(i)" help tip next to a setting or label (D-12: every manager page gets them).
|
||||
* Opens on click/tap (works on touch screens), closes on Escape, a click outside, or
|
||||
* a second click. Placed above the button, or below when there's no room.
|
||||
* Opens while the pointer rests on it (2026-11-20) and on click/tap (touch screens: a tap keeps
|
||||
* it open), closes on Escape, a click outside, a second click or the pointer leaving. Placed above the button, or below when there's no room.
|
||||
*
|
||||
* <label>Alert after failures <InfoTip>How many failed print attempts before managers are notified. 0 turns it off.</InfoTip></label>
|
||||
*
|
||||
@@ -17,7 +17,14 @@ const MARGIN = 8
|
||||
*/
|
||||
export function InfoTip({ children, label, side = 'top', className }) {
|
||||
const labels = useLabels()
|
||||
const [open, setOpen] = useState(false)
|
||||
const [pinned, setPinned] = useState(false)
|
||||
const [hover, setHover] = useState(false)
|
||||
const leaveTimer = useRef(null)
|
||||
const open = pinned || hover
|
||||
const setOpen = v => { setPinned(v); if (!v) setHover(false) }
|
||||
const enter = () => { clearTimeout(leaveTimer.current); setHover(true) }
|
||||
const leave = () => { clearTimeout(leaveTimer.current); leaveTimer.current = setTimeout(() => setHover(false), 120) }
|
||||
useEffect(() => () => clearTimeout(leaveTimer.current), [])
|
||||
const [pos, setPos] = useState(null)
|
||||
const button = useRef(null)
|
||||
const tip = useRef(null)
|
||||
@@ -66,7 +73,9 @@ export function InfoTip({ children, label, side = 'top', className }) {
|
||||
aria-label={label ?? labels.moreInfo}
|
||||
aria-expanded={open}
|
||||
aria-describedby={open ? id : undefined}
|
||||
onClick={() => setOpen(o => !o)}
|
||||
onClick={() => setOpen(!pinned)}
|
||||
onPointerEnter={e => { if (e.pointerType === 'mouse') enter() }}
|
||||
onPointerLeave={e => { if (e.pointerType === 'mouse') leave() }}
|
||||
>
|
||||
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">
|
||||
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" strokeWidth="1.5" />
|
||||
@@ -80,6 +89,8 @@ export function InfoTip({ children, label, side = 'top', className }) {
|
||||
ref={tip}
|
||||
id={id}
|
||||
role="tooltip"
|
||||
onPointerEnter={enter}
|
||||
onPointerLeave={leave}
|
||||
className={cx('x-infotip__popover', pos && (pos.above ? 'x-infotip__popover--above' : 'x-infotip__popover--below'))}
|
||||
style={pos ? { top: pos.top, left: pos.left, '--x-arrow-x': `${pos.arrow}px` } : { top: 0, left: 0, visibility: 'hidden' }}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user