/* ============================================================================
MOWDEW — Phone frame, chrome & navigation primitives
PhoneFrame (bezel + status bar + home indicator), Screen scaffold, TopBar,
TabBar (role-aware), FAB, ActionBar, Sheet, Toggle, Row. On window.
========================================================================= */
function StatusBar({ tint = 'var(--ink-900)' }) {
return (
);
}
function PhoneFrame({ children, dark = false }) {
return (
{/* dynamic island */}
{children}
{/* home indicator */}
);
}
/* TopBar — sticky screen header. variant: plain | green | dark */
function TopBar({ title, subtitle, onBack, right, variant = 'plain', big = false, children }) {
const dark = variant === 'green' || variant === 'dark';
const bg = variant === 'green' ? 'var(--green-700)' : variant === 'dark' ? 'var(--ink-900)' : 'var(--paper)';
const fg = dark ? '#fff' : 'var(--ink-900)';
const sub = dark ? 'rgba(255,255,255,.72)' : 'var(--ink-500)';
return (
{onBack && (
)}
{!big &&
{title}
}
{!big && subtitle &&
{subtitle}
}
{right}
{big && (
{title}
{subtitle &&
{subtitle}
}
)}
{children}
);
}
/* Screen — scroll body + optional sticky footer/tabbar */
function Screen({ children, footer, dark = false, padBottom = 22, scrollRef }) {
return (
);
}
/* TabBar — role-aware bottom nav with center FAB */
const TABS = {
provider: [['route', 'Today', 'pro_today'], ['check-circle', 'Done', 'pro_done'], [null], ['notes', 'Notes', 'pro_notes'], ['settings', 'Settings', 'settings']],
homeowner: [['feed', 'Visits', 'h_feed'], ['droplet', 'Pool', 'h_chem'], [null], ['file', 'Invoices', 'h_inbox'], ['ledger', 'Ledger', 'h_ledger']],
owner: [['home', 'Home', 'o_home'], ['dollar', 'Money', 'o_money'], [null], ['inbox', 'Inbox', 'o_inbox'], ['users', 'Customers', 'o_customers']],
};
const TAB_ICON = { homes: 'users' };
function TabBar({ role, active, go, onFab }) {
const items = TABS[role];
return (
{items.map((it, i) => {
if (it[0] === null) return
;
const [ic, lb, scr] = it;
const on = active === scr;
return (
);
})}
);
}
/* Sticky action bar (single/double button) */
function ActionBar({ children, dark = false }) {
return (
{children}
);
}
/* Toggle switch */
function Toggle({ on, onChange, tone = 'green' }) {
const bg = on ? (tone === 'green' ? 'var(--green-600)' : 'var(--blue-500)') : 'var(--ink-200)';
return (
);
}
/* Bottom sheet overlay */
function Sheet({ open, onClose, children, title }) {
if (!open) return null;
return (
e.stopPropagation()} style={{ width: '100%', background: 'var(--surface)', borderRadius: '28px 28px 0 0', padding: '12px 20px 26px', animation: 'tnSlideUp .26s cubic-bezier(.22,1,.36,1)', maxHeight: '86%', overflowY: 'auto' }}>
{title &&
{title}
}
{children}
);
}
/* Toast */
function Toast({ msg, tone = 'green' }) {
if (!msg) return null;
const bg = tone === 'green' ? 'var(--green-700)' : tone === 'blue' ? 'var(--blue-700)' : 'var(--ink-900)';
return (
{msg}
);
}
Object.assign(window, { StatusBar, PhoneFrame, TopBar, Screen, TabBar, ActionBar, Toggle, Sheet, Toast });