// Form primitives shared across screens. Tight, dense, faithful enterprise look.
const fieldStyles = {
row: { display: "flex", alignItems: "center", gap: 0, minWidth: 0 },
label: {
width: 88, flex: "none", textAlign: "right", paddingRight: 8,
color: "var(--text)", fontSize: 12, lineHeight: "26px",
whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis",
},
labelReq: { color: "var(--required)" },
control: {
flex: 1, minWidth: 0, height: "var(--input-h)",
border: "1px solid var(--border-input)",
background: "var(--bg-input)",
padding: "0 6px", fontSize: 12, color: "var(--text)",
borderRadius: 0,
},
controlDisabled: { background: "var(--bg-disabled)", color: "var(--text-muted)" },
controlReq: { background: "#fff8e1" }, // matches reference: required cells get a yellow tint
};
const Field = ({ label, required, children, labelWidth, span = 1, valign = "center" }) => (
{required ? * : null}
{label}:
{children}
);
const Input = ({ value, onChange, disabled, required, placeholder, mono, style }) => (
onChange(e.target.value) : undefined}
disabled={disabled}
placeholder={placeholder}
style={{
...fieldStyles.control,
...(disabled ? fieldStyles.controlDisabled : {}),
...(required && !disabled ? fieldStyles.controlReq : {}),
...(mono ? { fontFamily: '"JetBrains Mono", Menlo, Consolas, monospace', fontSize: 11 } : {}),
...style,
}}
/>
);
const Select = ({ value, onChange, options, disabled, required, style }) => (
);
const Checkbox = ({ checked, onChange, disabled, label, size = 13 }) => (
);
// Top-bar style (light blue) toolbar button — used in module config screen
const ToolbarBtnLight = ({ children, icon, onClick, disabled, primary, danger, success }) => {
const [hover, setHover] = React.useState(false);
let bg = "#fff", border = "var(--border-input)", color = "var(--text)";
if (primary) { bg = hover ? "#3a9ae8" : "#5cabe8"; border = "#3a8ad6"; color = "#fff"; }
else if (danger) { bg = hover ? "#e85a5a" : "#f07070"; border = "#d04141"; color = "#fff"; }
else if (success) { bg = hover ? "#38b777" : "#4cc488"; border = "#27a567"; color = "#fff"; }
else if (hover && !disabled) { bg = "var(--accent-soft)"; border = "var(--accent)"; }
return (
);
};
// Dark-band toolbar button (used in user detail, matches the dark sub-toolbar in references)
const ToolbarBtnDark = ({ children, icon, onClick, disabled, danger }) => {
const [hover, setHover] = React.useState(false);
return (
);
};
const Divider = ({ vertical }) =>
vertical
?
: ;
Object.assign(window, {
Field, Input, Select, Checkbox, ToolbarBtnLight, ToolbarBtnDark, Divider, fieldStyles,
});