Form Components #22

Merged
an.di merged 10 commits from adilallo/component/FormComponents into main 2025-12-11 04:42:46 +00:00
Owner

Forms: Add and standardize new components, stories, a11y, and tests

Overview

This PR introduces a complete suite of form components with consistent styling using Tailwind design tokens, accessibility-compliant behavior, and comprehensive tests. All components are optimized (React.memo, forwardRef, stable callbacks) and disabled states were removed per product direction.

Changes

  • New and updated components (behavior, styling, a11y, tests, stories):
    • Checkbox: interactive stories; useId fix; label/text colors aligned to tokens.
    • ContextMenu (ContextMenu, ContextMenuItem, ContextMenuSection, ContextMenuDivider): correct roles (menu/menuitem); selection via aria-current; tests updated to current scope.
    • Input: sizes/label variants/states unified; hover uses outward-growing effect without layout shift; label color --color-content-default-secondary; input text color --color-content-default-primary; stories/tests updated.
    • RadioButton, RadioGroup: interactive stories reflecting mutual exclusivity; interaction tests corrected and awaited; useId fix.
    • Select: implemented SelectDropdown (role="listbox") and SelectOption (role="option"); focus returns to button after selection; hover/focus states match Input; stories use options prop; unit/integration/a11y tests added.
    • Switch: track/thumb visuals per spec; rounded focus ring around toggle; no disabled state; accessible naming via label/aria-label; tests added/updated.
    • TextArea: mirrors Input with specified radii and fixed heights for each size/variant; tokenized label/text colors via Tailwind; stories and tests added.
    • Toggle: default/hover/selected/focus states; hover only when off; selected outline visible without layout shift; simplified stories (States, Interactive) plus text/icon variations; tests added.
    • ToggleGroup: segmented toggles; selected outline on the inside; hover background matches selected; default hamburger icon when text hidden; specified typography; stories simplified to one icon row and interactive; tests added.
  • Storybook and tooling:
    • Storybook Inter font fix via a Storybook-only CSS import.
    • Storybook interaction tests enabled and passing for new and existing components.
    • Installed Storybook test runner and wired test:sb.
    • Vitest config excludes Playwright e2e; Playwright tests only target Next.js app, not Storybook.
  • Cleanup:
    • Removed Storybook e2e tests and the temporary /forms page.
    • Prettier and lint adjustments; only warnings remain.

Screenshots

Screenshot 2025-10-15 at 1.09.14 PM.png Screenshot 2025-10-15 at 1.09.58 PM.png Screenshot 2025-10-15 at 1.10.28 PM.png Screenshot 2025-10-15 at 1.11.07 PM.png

Notes

  • Disabled states removed across all form components per latest requirements.
  • ARIA roles corrected and separated: Select (listbox/option) vs ContextMenu (menu/menuitem).
  • All new components use React.memo/forwardRef/useCallback and stable class composition for performance.
  • CI pipeline green across unit/integration/a11y/e2e/Storybook/performance.
# Forms: Add and standardize new components, stories, a11y, and tests ## Overview This PR introduces a complete suite of form components with consistent styling using Tailwind design tokens, accessibility-compliant behavior, and comprehensive tests. All components are optimized (React.memo, forwardRef, stable callbacks) and disabled states were removed per product direction. ## Changes - New and updated components (behavior, styling, a11y, tests, stories): - Checkbox: interactive stories; `useId` fix; label/text colors aligned to tokens. - ContextMenu (ContextMenu, ContextMenuItem, ContextMenuSection, ContextMenuDivider): correct roles (`menu`/`menuitem`); selection via `aria-current`; tests updated to current scope. - Input: sizes/label variants/states unified; hover uses outward-growing effect without layout shift; label color `--color-content-default-secondary`; input text color `--color-content-default-primary`; stories/tests updated. - RadioButton, RadioGroup: interactive stories reflecting mutual exclusivity; interaction tests corrected and awaited; `useId` fix. - Select: implemented `SelectDropdown` (`role="listbox"`) and `SelectOption` (`role="option"`); focus returns to button after selection; hover/focus states match Input; stories use `options` prop; unit/integration/a11y tests added. - Switch: track/thumb visuals per spec; rounded focus ring around toggle; no disabled state; accessible naming via label/aria-label; tests added/updated. - TextArea: mirrors Input with specified radii and fixed heights for each size/variant; tokenized label/text colors via Tailwind; stories and tests added. - Toggle: default/hover/selected/focus states; hover only when off; selected outline visible without layout shift; simplified stories (States, Interactive) plus text/icon variations; tests added. - ToggleGroup: segmented toggles; selected outline on the inside; hover background matches selected; default hamburger icon when text hidden; specified typography; stories simplified to one icon row and interactive; tests added. - Storybook and tooling: - Storybook Inter font fix via a Storybook-only CSS import. - Storybook interaction tests enabled and passing for new and existing components. - Installed Storybook test runner and wired `test:sb`. - Vitest config excludes Playwright e2e; Playwright tests only target Next.js app, not Storybook. - Cleanup: - Removed Storybook e2e tests and the temporary `/forms` page. - Prettier and lint adjustments; only warnings remain. ## Screenshots <img width="543" alt="Screenshot 2025-10-15 at 1.09.14 PM.png" src="attachments/168a7f7e-5886-449a-a880-20dc3632c713"> <img width="193" alt="Screenshot 2025-10-15 at 1.09.58 PM.png" src="attachments/53bb867e-6067-4c30-bfe2-fc6ed10b5c11"> <img width="393" alt="Screenshot 2025-10-15 at 1.10.28 PM.png" src="attachments/0e2a5694-2d72-4c86-876c-1a077c16111b"> <img width="282" alt="Screenshot 2025-10-15 at 1.11.07 PM.png" src="attachments/44961415-eb50-4f61-b48d-5d542e73f81d"> ## Notes - Disabled states removed across all form components per latest requirements. - ARIA roles corrected and separated: Select (`listbox/option`) vs ContextMenu (`menu/menuitem`). - All new components use React.memo/forwardRef/useCallback and stable class composition for performance. - CI pipeline green across unit/integration/a11y/e2e/Storybook/performance.
an.di added 9 commits 2025-10-14 23:34:32 +00:00
Cleanup code and tests
CI Pipeline / test (20) (pull_request) Successful in 2m55s
CI Pipeline / test (18) (pull_request) Successful in 3m32s
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / storybook (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
c4a631a5d8
an.di added 1 commit 2025-10-15 02:48:12 +00:00
Fix failing tests
CI Pipeline / test (20) (pull_request) Successful in 2m30s
CI Pipeline / test (18) (pull_request) Successful in 3m51s
CI Pipeline / e2e (firefox) (pull_request) Successful in 3m22s
CI Pipeline / e2e (webkit) (pull_request) Successful in 3m45s
CI Pipeline / e2e (chromium) (pull_request) Successful in 11m49s
CI Pipeline / visual-regression (pull_request) Successful in 6m48s
CI Pipeline / storybook (pull_request) Successful in 1m35s
CI Pipeline / lint (pull_request) Successful in 1m12s
CI Pipeline / build (pull_request) Successful in 1m54s
CI Pipeline / performance (pull_request) Successful in 4m6s
fa5a190416
an.di self-assigned this 2025-10-15 19:11:41 +00:00
an.di changed title from adilallo/component/FormComponents to Form Components 2025-10-16 13:34:43 +00:00
an.di merged commit 1ad6bc85b4 into main 2025-12-11 04:42:46 +00:00
an.di deleted branch adilallo/component/FormComponents 2025-12-11 04:44:27 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CommunityRule/community-rule#22