feat(signage): look rows that wrap, one colour field with opacity, badges' text, several widgets per stack part, pages up to 2200 px (owner review 4)
- Menu text look: each field names its part ("Headings size"), rows wrap in aligned columns on
alternating bands; names align left / right; line and letter spacing as lists (Auto default);
each field changes only itself (followers frozen before the other changes); badge colour +
badge text colour (auto: readableOn); "Reset the look" with a question.
- ColourField everywhere in signage: a Popover panel (new @xenia/ui Popover, portal, kept in the
window) with 12 presets, picker, opacity (#rrggbbaa) and typed code; HEX accepts 8 digits.
- Stacks: Cell.widgets (a stored `widget` still reads), several widgets per part laid across the
stack's direction; extras by path stack.part.place; Add a widget adds, each removable / ordered.
- Page rule: --x-page-max is 2200px (no longer follows the window height).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -465,6 +465,15 @@
|
||||
box-shadow: var(--x-shadow-popover); outline: none;
|
||||
animation: x-fade-in var(--x-duration-fast) var(--x-ease);
|
||||
}
|
||||
/* ── Popover (2026-11-21): a small panel under a button, kept inside the window ── */
|
||||
.x-popover {
|
||||
position: fixed; z-index: var(--x-z-popover); box-sizing: border-box;
|
||||
max-width: calc(100vw - 16px); overflow: auto;
|
||||
background: var(--x-surface); color: var(--x-ink); color-scheme: var(--x-color-scheme);
|
||||
border: var(--x-border-width) solid var(--x-line); border-radius: var(--x-radius-card);
|
||||
box-shadow: var(--x-shadow-popover); outline: none;
|
||||
animation: x-fade-in var(--x-duration-fast) var(--x-ease);
|
||||
}
|
||||
.x-dropdown__search { padding: var(--x-space-2); border-bottom: var(--x-border-width) solid var(--x-line); }
|
||||
.x-dropdown__list { list-style: none; margin: 0; padding: var(--x-space-1); overflow-y: auto; min-height: 0; }
|
||||
.x-dropdown__option {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cx } from '../internal/cx.js'
|
||||
|
||||
/**
|
||||
* The page rule (2026-11-20): every app page's root. It scrolls on its own, fills the area up to
|
||||
* a 16:9 screen's width (--x-page-max) and is centred beyond it (ultrawides), with the same
|
||||
* 2200 px (--x-page-max: a 1080p screen is filled; the window's height never narrows it) and is centred beyond it (ultrawides), with the same
|
||||
* padding and gaps everywhere. Never put padding, max-width or overflow on a page's root yourself.
|
||||
*
|
||||
* <Page testId="contacts-page">
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
||||
import { cx } from '../internal/cx.js'
|
||||
import { Portal } from '../internal/Portal.jsx'
|
||||
|
||||
const GAP = 6
|
||||
const MARGIN = 8
|
||||
|
||||
/**
|
||||
* A small floating panel under a button (2026-11-21): a colour picker, an "Add…" menu. Drawn over
|
||||
* everything (portal, fixed), like the Dropdown's list: below its button, above when there's no
|
||||
* room, and always kept inside the window, so it never makes a page or a section scroll sideways.
|
||||
* Closes on a click outside (the button excluded) and on Escape.
|
||||
*
|
||||
* const btn = useRef(null)
|
||||
* <Button ref={btn} onClick={() => setOpen(o => !o)}>Add</Button>
|
||||
* <Popover open={open} anchor={btn} onClose={() => setOpen(false)} role="menu">…</Popover>
|
||||
*/
|
||||
export function Popover({ open, anchor, onClose, className, style, children, role = 'dialog', ...rest }) {
|
||||
const panel = useRef(null)
|
||||
const [pos, setPos] = useState(null)
|
||||
|
||||
const place = useCallback(() => {
|
||||
const b = anchor?.current?.getBoundingClientRect()
|
||||
const p = panel.current?.getBoundingClientRect()
|
||||
if (!b || !p) return
|
||||
const below = window.innerHeight - b.bottom - GAP - MARGIN
|
||||
const above = b.top - GAP - MARGIN
|
||||
const up = p.height > below && above > below
|
||||
const left = Math.min(Math.max(MARGIN, b.left), Math.max(MARGIN, window.innerWidth - MARGIN - p.width))
|
||||
const top = up ? Math.max(MARGIN, b.top - GAP - p.height) : b.bottom + GAP
|
||||
setPos({ left, top, maxHeight: Math.max(160, up ? above : below) })
|
||||
}, [anchor])
|
||||
|
||||
useLayoutEffect(() => { if (open) place(); else setPos(null) }, [open, place])
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined
|
||||
const away = e => {
|
||||
if (panel.current?.contains(e.target) || anchor?.current?.contains(e.target)) return
|
||||
onClose?.()
|
||||
}
|
||||
const esc = e => { if (e.key === 'Escape') { e.stopPropagation(); onClose?.() } }
|
||||
const onScroll = e => { if (!panel.current?.contains(e.target)) place() }
|
||||
document.addEventListener('pointerdown', away)
|
||||
window.addEventListener('keydown', esc)
|
||||
window.addEventListener('resize', place)
|
||||
window.addEventListener('scroll', onScroll, true)
|
||||
return () => {
|
||||
document.removeEventListener('pointerdown', away)
|
||||
window.removeEventListener('keydown', esc)
|
||||
window.removeEventListener('resize', place)
|
||||
window.removeEventListener('scroll', onScroll, true)
|
||||
}
|
||||
}, [open, anchor, onClose, place])
|
||||
|
||||
if (!open) return null
|
||||
return (
|
||||
<Portal>
|
||||
<div ref={panel} role={role} className={cx('x-popover', className)} {...rest}
|
||||
style={{ ...style, ...(pos ? { left: pos.left, top: pos.top, maxHeight: pos.maxHeight } : { left: 0, top: 0, visibility: 'hidden' }) }}>
|
||||
{children}
|
||||
</div>
|
||||
</Portal>
|
||||
)
|
||||
}
|
||||
@@ -22,6 +22,7 @@ export { EmptyState } from './components/EmptyState.jsx'
|
||||
export { Spinner } from './components/Spinner.jsx'
|
||||
export { Field, Input, Textarea, Select } from './components/Field.jsx'
|
||||
export { Dropdown } from './components/Dropdown.jsx'
|
||||
export { Popover } from './components/Popover.jsx'
|
||||
export { Page, PageHeader, Pane, Toolbar, ToolbarSpacer } from './components/Page.jsx'
|
||||
export { SearchInput, FilterChip, Segmented, Tabs } from './components/Controls.jsx'
|
||||
export { Switch } from './components/Switch.jsx'
|
||||
|
||||
@@ -588,9 +588,10 @@
|
||||
--x-pad-card: 20px;
|
||||
--x-pad-card-y: 14px; /* a card's header row and list rows */
|
||||
|
||||
/* Pages (the page rule, 2026-11-20): a page fills its area up to a 16:9 screen's width and
|
||||
is centred beyond it, so ultrawides keep a 16:9 page instead of stretched content. */
|
||||
--x-page-max: max(1280px, calc(100vh * 16 / 9));
|
||||
/* Pages (the page rule, 2026-11-20; owner 2026-11-21): a page fills its area up to 2200 px
|
||||
(a 1080p screen is filled) and is centred beyond it, so ultrawides don't stretch the content.
|
||||
A fixed width: a short window never makes the page narrower. */
|
||||
--x-page-max: 2200px;
|
||||
--x-page-pad: 24px;
|
||||
--x-page-gap: 20px;
|
||||
--x-page-form-max: 880px; /* forms and settings that read badly when stretched */
|
||||
|
||||
Reference in New Issue
Block a user