- Badges: the venue's list (setting signage.badges: names el/en, colours, an icon from a food and drink set) edited under Signage -> "Message & settings"; sent with the venue to screens and previews; several badges per product (MenuList.badges lists, a single one still read) in the shared multiple Dropdown; a board's badge colour / text colour override them (None = each own). - Widgets: colour, background plate, font, bold / italic / underline, text size, QR colours; widgets in a stack's part get every setting, vertical alignment, and a custom box inside their place, picked (stack, then widget) and dragged on the preview (selection by path "2.1.0"). - Menu slides: vertical alignment of the list (board_valign); "Where the list sits" is now "Horizontal alignment". - Message of the day: one component in the settings tab, on the Overview and from its widget. - Leaving a slide with changes: "Save and leave" (ConfirmDialog altLabel). - @xenia/ui: ColourField (with colour.js helpers), FieldRow (framed only while wrapped), Slider, IconPicker, Segmented multiple; native selects on the Overview and signage replaced by Dropdown, the device settings' colour input by ColourField. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.5 KiB
React
35 lines
1.5 KiB
React
import { Children, useLayoutEffect, useRef, useState } from 'react'
|
|
import { cx } from '../internal/cx.js'
|
|
|
|
/**
|
|
* A row of fields that wraps (2026-11-21): each field keeps its least width (`min`) and the ones
|
|
* that don't fit go to a second line, in columns that line up from row to row. While a row is
|
|
* wrapped it is framed and (with `shade`, every other row) tinted, so its two lines read as one
|
|
* set; a row that fits on one line looks like any other row.
|
|
* <FieldRow><Field …/><Field …/></FieldRow>
|
|
* <FieldRow shade>…</FieldRow> (alternate rows)
|
|
*/
|
|
export function FieldRow({ min = '10.5rem', shade = false, className, style, children, ...rest }) {
|
|
const ref = useRef(null)
|
|
const [wrapped, setWrapped] = useState(false)
|
|
const count = Children.count(children)
|
|
useLayoutEffect(() => {
|
|
const el = ref.current
|
|
if (!el) return undefined
|
|
const check = () => {
|
|
const kids = [...el.children].filter(k => k.offsetParent !== null || k.getClientRects().length)
|
|
setWrapped(kids.length > 1 && kids.some(k => k.offsetTop > kids[0].offsetTop + 2))
|
|
}
|
|
check()
|
|
const ro = new ResizeObserver(check)
|
|
ro.observe(el)
|
|
return () => ro.disconnect()
|
|
}, [count])
|
|
return (
|
|
<div ref={ref} className={cx('x-field-row', wrapped && 'x-field-row--wrapped', wrapped && shade && 'x-field-row--shade', className)}
|
|
style={{ ...style, '--x-field-min': min }} data-wrapped={wrapped ? 'true' : undefined} {...rest}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|