Files
commitea/docs/design/components/forms/Checkbox.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

44 lines
1.8 KiB
Plaintext

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