feat(checkbox): add atom component#243
Conversation
Mira el storybook la tab accesibilidad da warnings de contraste El resto... fetén. |
There was a problem hiding this comment.
Pull request overview
Adds a new Checkbox atom with native checkbox semantics, accessibility-focused naming/description handling, sanitised labelHtml, Storybook coverage, and unit tests.
Changes:
- Added Checkbox component, hook, CVA types, stories, tests, and atom exports.
- Added strict inline HTML sanitization utilities for checkbox label HTML.
- Exported
Checkboxfrom the package entrypoint.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/components/atoms/checkbox/Checkbox.tsx |
Renders the Checkbox atom UI and error/description rows. |
src/components/atoms/checkbox/useCheckbox.ts |
Implements checkbox state, ARIA wiring, sanitised labels, and event handling. |
src/components/atoms/checkbox/types.ts |
Defines props, variants, and CVA styling. |
src/components/atoms/checkbox/Checkbox.test.tsx |
Adds component and hook behavior tests. |
src/components/atoms/checkbox/Checkbox.stories.tsx |
Adds Storybook examples for supported states. |
src/components/atoms/checkbox/index.ts |
Exports Checkbox and its types. |
src/utils/sanitizeHtml.ts |
Adds inline sanitization profile and text extraction helper. |
src/utils/sanitizeHtml.test.ts |
Covers default and inline sanitization behavior. |
src/index.ts |
Exports Checkbox from the package entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review feedback addressedGracias por la revisión. Apliqué los puntos que correspondían:
Validación local/pre-push:
Sobre los warnings de contraste en Storybook: además de quitar la sustitución de color en disabled label, los checks de Accessibility del PR estaban en verde. Queda listo para re-check de CI con el nuevo commit. |
Summary
Checkboxatom following the approved issue [ATOMS] Checkbox #18 component spec and 6-file pattern.labelHtmlsanitization plus Storybook/test coverage for visual states and non-clickable descriptive text.Closes #18
Review scope
src/components/atoms/checkbox/*src/utils/sanitizeHtml.tssrc/utils/sanitizeHtml.test.tssrc/index.tsType of change
Workflow gates
Closes #NNNor maintainer approved an exception.status:approvedbefore implementation starts.In progress, branch/worktree recorded.<type>(<optional scope>): <description>..playwright-mcp,page-*.png,page-*.jpeg,*.md.playwright-output.Component evidence (required for component changes)
types.ts,use*.ts,Component.tsx,Component.test.tsx,Component.stories.tsx,index.ts.types.ts; JSX component has no state, CVA calls, or business logic.theme.css; no hardcoded colors or arbitrary color utilities.Accessibility evidence
Validation evidence
pnpm exec tsc --noEmit✅pnpm exec vitest run src/components/atoms/checkbox/Checkbox.test.tsx src/utils/sanitizeHtml.test.ts✅pnpm test✅26 passed / 403 testspnpm run build✅labelHtmlsanitizer tests remove/neutralize interactive and unsafe HTML ✅Screenshots or recordings
Not attached. Live Storybook visual review was performed locally; Playwright runtime artifacts were cleaned before PR.
Notes for reviewer
label,description, anderrorMessageintentionally do not toggle the checkbox; only the visual control hit area toggles.labelHtmluses a strict inline-only sanitizer profile; the general Text sanitizer remains broader by design.