feat(signage): stacks, menu and text widgets, widget order (owner review 2)
- Stacks: horizontal / vertical, 2-6 parts with % shares; each part shows a widget, a stack one level deep, or a whole Slides-library slide - Menu widget (a board's list in its box), text widget, weather for tomorrow / the day after and in picture / degrees / both styles - Widgets' order (arrows, drag with a drop line), drawn in list order; arrow keys move the picked widget from its card too - Server: extras by widget path (QR links, menus, embedded slides), POST /preview/slide, resolve(keep_hidden) so hidden products stay greyed in the editor's list; screens told when an embedded slide changes - Editor rows tidied: framed sliders, colours as fields, text look on one row, Switch boxed toggles from its whole frame Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -347,6 +347,8 @@
|
||||
box-sizing: border-box; min-height: var(--x-control-md); padding: var(--x-space-2) var(--x-space-3);
|
||||
background: var(--x-surface); border: var(--x-border-width) solid var(--x-line); border-radius: var(--x-radius-control);
|
||||
}
|
||||
.x-switch-row--boxed { cursor: pointer; }
|
||||
.x-switch-row--boxed.x-switch-row--disabled { cursor: not-allowed; }
|
||||
.x-switch-row--boxed .x-switch-row__label { font-size: var(--x-text-label); }
|
||||
.x-confirm__body { font-size: var(--x-text-body); line-height: var(--x-leading-body); color: var(--x-ink-2); }
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import { cx } from '../internal/cx.js'
|
||||
* onChange receives the new boolean. Without `label`, pass aria-label.
|
||||
* The whole row (label + description) is clickable.
|
||||
* info: an element right after the label (an <InfoTip>), not after the switch.
|
||||
* boxed: framed and as tall as an input, the text left and the switch right (a switch in a row of fields).
|
||||
* boxed: framed and as tall as an input, the text left and the switch right (a switch in a row of fields);
|
||||
* a click anywhere in the frame toggles it (2026-11-21).
|
||||
*/
|
||||
export function Switch({ checked, onChange, label, description, info, disabled = false, boxed = false, id, className, ...rest }) {
|
||||
const auto = useId()
|
||||
@@ -21,9 +22,10 @@ export function Switch({ checked, onChange, label, description, info, disabled =
|
||||
role="switch"
|
||||
aria-checked={!!checked}
|
||||
aria-describedby={description ? descId : undefined}
|
||||
aria-label={boxed && typeof label === 'string' ? label : undefined}
|
||||
disabled={disabled}
|
||||
className={cx('x-switch', checked && 'x-switch--on')}
|
||||
onClick={() => onChange?.(!checked)}
|
||||
onClick={boxed ? undefined : () => onChange?.(!checked)}
|
||||
{...rest}
|
||||
>
|
||||
<span className="x-switch__thumb" />
|
||||
@@ -32,11 +34,14 @@ export function Switch({ checked, onChange, label, description, info, disabled =
|
||||
|
||||
if (!label && !description) return <span className={cx('x-switch-bare', className)}>{control}</span>
|
||||
return (
|
||||
<div className={cx('x-switch-row', boxed && 'x-switch-row--boxed', disabled && 'x-switch-row--disabled', className)}>
|
||||
<div className={cx('x-switch-row', boxed && 'x-switch-row--boxed', disabled && 'x-switch-row--disabled', className)}
|
||||
onClick={boxed && !disabled ? () => onChange?.(!checked) : undefined}>
|
||||
<div className="x-switch-row__text">
|
||||
{label && (
|
||||
<span className="x-switch-row__head">
|
||||
<label className="x-switch-row__label" htmlFor={switchId}>{label}</label>
|
||||
{boxed
|
||||
? <span className="x-switch-row__label">{label}</span>
|
||||
: <label className="x-switch-row__label" htmlFor={switchId}>{label}</label>}
|
||||
{info}
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user