// Visual check page for @xenia/ui (plan step 2.3). Dev builds only: the manager mounts // it at /ui-gallery under `import.meta.env.DEV` (moves to the terminal dev build in 3.1). // Sets data-theme / data-venue-theme on while open and restores them on leave. import { useEffect, useState } from 'react' import { Button, Dialog, EmptyState, Field, IconButton, InfoTip, Input, PinPad, Select, Sheet, ReasonPicker, Spinner, Stepper, Switch, Textarea, ToastProvider, useToast, } from '../src/index.js' import '../src/styles.css' const THEMES = ['light', 'dark', 'system'] const VENUES = ['teal', 'amber', 'blue', 'violet', 'rose'] const Plus = () => ( ) const Trash = () => ( ) const Inbox = () => ( ) const page = { minHeight: '100vh', background: 'var(--x-canvas)', color: 'var(--x-ink)', fontFamily: 'var(--x-font-sans)', fontSize: 'var(--x-text-body)', padding: 'var(--x-space-6)', } const card = { background: 'var(--x-surface)', border: '1px solid var(--x-line)', borderRadius: 'var(--x-radius-card)', boxShadow: 'var(--x-shadow-raised)', padding: 'var(--x-space-6)', marginBottom: 'var(--x-space-6)', } const row = { display: 'flex', flexWrap: 'wrap', gap: 'var(--x-space-3)', alignItems: 'center' } const h2 = { margin: '0 0 var(--x-space-4)', fontSize: 'var(--x-text-title)', fontWeight: 600 } function Section({ title, children }) { return

{title}

{children}
} function Demo() { const toast = useToast() const [theme, setTheme] = useState('light') const [venue, setVenue] = useState('teal') const [dialog, setDialog] = useState(false) const [reason, setReason] = useState(null) const [reasonOther, setReasonOther] = useState('') const [locked, setLocked] = useState(false) const [sheet, setSheet] = useState(null) const [on, setOn] = useState(true) const [step, setStep] = useState(30) const [off, setOff] = useState(false) const [name, setName] = useState('') const [lang, setLang] = useState('el') const [pinError, setPinError] = useState('') const [unlocked, setUnlocked] = useState('') useEffect(() => { const html = document.documentElement const before = [html.getAttribute('data-theme'), html.getAttribute('data-venue-theme')] html.setAttribute('data-theme', theme) html.setAttribute('data-venue-theme', venue) return () => { before[0] == null ? html.removeAttribute('data-theme') : html.setAttribute('data-theme', before[0]) before[1] == null ? html.removeAttribute('data-venue-theme') : html.setAttribute('data-venue-theme', before[1]) } }, [theme, venue]) const checkPin = pin => new Promise((resolve, reject) => setTimeout(() => { if (pin === '1234') { setPinError(''); setUnlocked(n => `Unlocked (${n ? Number(n.slice(10, -1)) + 1 : 1})`); resolve() } else { setPinError('Wrong PIN'); reject(new Error('wrong')) } }, 500)) return (

@xenia/ui gallery

setVenue(e.target.value)} options={VENUES.map(v => ({ value: v, label: `Venue: ${v}` }))} />
setDialog(false)} title="Delete product?" description="Freddo espresso will be removed from every category." footer={<>} > setLocked(false)}>Done} > Escape and the backdrop don't close this one. setSheet(null)} title="Move order" footer={} > setName(e.target.value)} placeholder="e.g. Freddo espresso" /> The language staff screens start in. Each person can change their own.}>