Files
commitea/docs/design/components/forms/Radio.js.txt
Christian LeDoux 7a5cacc54c Scaffold CommiTea: yarn workspaces, Electron shell, core label schema, design system
- apps/desktop: electron-vite + React + Tailwind mapped onto design tokens
  (preflight off; tokens/base.css owns the reset); boots to a Reginald
  placeholder proving fonts/tokens/core wiring
- packages/core: pure TS; gitea label schema (est/*, p/*, deadline/hard)
  with pessimistic conflict resolution + 15 unit tests
- docs/design: full design handoff (tokens, 16 component contracts,
  interactive 14-screen prototype, Reginald voice rules)
- docs/PLAN.md: product plan (purity rule, pm-state repo, deterministic
  scheduler + Monte Carlo, directive log)
- Deliberate deviation from novelpad stack: no ElectricSQL/PGlite — local
  store is a rebuildable cache over gitea REST/webhooks (better-sqlite3
  in main process, arriving in P1)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 20:42:46 -04:00

51 lines
1.9 KiB
Plaintext

import React from 'react';
const CSS = `
.ct-radio { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font: var(--text-body); color: var(--ink-1); }
.ct-radio--disabled { opacity: 0.5; cursor: not-allowed; }
.ct-radio__input { position: absolute; opacity: 0; width: 0; height: 0; }
.ct-radio__dot {
width: 16px; height: 16px; flex-shrink: 0;
border: 1px solid var(--line-2);
border-radius: 50%;
background: var(--surface-card);
display: inline-flex; align-items: center; justify-content: center;
transition: border-color var(--duration-fast) var(--ease-out);
}
.ct-radio__dot::after {
content: '';
width: 8px; height: 8px; border-radius: 50%;
background: transparent;
transition: background var(--duration-fast) var(--ease-out);
}
.ct-radio:hover:not(.ct-radio--disabled) .ct-radio__dot { border-color: var(--border-strong); }
.ct-radio__input:checked + .ct-radio__dot { border-color: var(--accent); }
.ct-radio__input:checked + .ct-radio__dot::after { background: var(--accent); }
.ct-radio__input:focus-visible + .ct-radio__dot { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
`;
(function inject() {
if (typeof document !== 'undefined' && !document.getElementById('ct-radio-css')) {
const s = document.createElement('style'); s.id = 'ct-radio-css'; s.textContent = CSS;
document.head.appendChild(s);
}
})();
export function Radio({ label, checked, onChange, name, value, disabled = false, style, ...rest }) {
return (
<label className={`ct-radio${disabled ? ' ct-radio--disabled' : ''}`} style={style}>
<input
type="radio"
className="ct-radio__input"
checked={checked}
onChange={onChange}
name={name}
value={value}
disabled={disabled}
{...rest}
/>
<span className="ct-radio__dot"></span>
{label ? <span>{label}</span> : null}
</label>
);
}