feat(web,web-react): add InputDetails component #DS-2454#2556
Conversation
packages/web-react/src/components/FieldDetails/FieldDetails.tsx
Outdated
Show resolved
Hide resolved
✅ Deploy Preview for spirit-design-system-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for spirit-design-system-docsite ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for spirit-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Adds a new FieldDetails sub-component to Spirit (web + web-react) for rendering supplementary consent-related content (e.g. modal triggers) beneath Checkbox/Toggle labels, and wires it into Checkbox/Toggle via a new details prop.
Changes:
- Introduces
FieldDetailsstyling and documentation inpackages/web, including disabled-state color handling. - Adds
detailsprop support toCheckboxandToggleinpackages/web-react, includingaria-detailswiring and new demos/tests. - Exports the new component from
web-reactpublic entrypoints and adds a visual regression snapshot.
Reviewed changes
Copilot reviewed 48 out of 53 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/demo-components-compare.spec.ts-snapshots/fielddetails-chromium-linux.png | Adds visual snapshot for FieldDetails. |
| packages/web/src/scss/tools/_form-fields.scss | Adds mixin to set disabled FieldDetails text color via CSS variable. |
| packages/web/src/scss/settings/_form-fields.scss | Adds disabled color token setting for FieldDetails. |
| packages/web/src/scss/components/index.scss | Exposes FieldDetails SCSS module. |
| packages/web/src/scss/components/Toggle/index.html | Adds Toggle consent examples using FieldDetails + modals. |
| packages/web/src/scss/components/Toggle/_Toggle.scss | Applies FieldDetails disabled text color variable in disabled Toggle. |
| packages/web/src/scss/components/Toggle/README.md | Documents consent + FieldDetails usage for Toggle (vanilla). |
| packages/web/src/scss/components/FieldDetails/index.scss | Exposes FieldDetails SCSS entrypoint. |
| packages/web/src/scss/components/FieldDetails/index.html | Adds FieldDetails demo page (vanilla). |
| packages/web/src/scss/components/FieldDetails/_theme.scss | Defines FieldDetails theme tokens (typography/spacing/colors). |
| packages/web/src/scss/components/FieldDetails/_FieldDetails.scss | Implements FieldDetails layout + color via CSS variable fallback. |
| packages/web/src/scss/components/FieldDetails/README.md | Documents FieldDetails usage (vanilla). |
| packages/web/src/scss/components/Checkbox/index.html | Adds Checkbox consent examples using FieldDetails + modals. |
| packages/web/src/scss/components/Checkbox/_Checkbox.scss | Applies FieldDetails disabled text color variable in disabled Checkbox. |
| packages/web/src/scss/components/Checkbox/README.md | Documents consent + FieldDetails usage for Checkbox (vanilla). |
| packages/web-react/src/types/shared/inputs.ts | Introduces shared DetailsProps (details?: ReactNode). |
| packages/web-react/src/types/checkbox.ts | Adds details prop to Checkbox types via DetailsProps. |
| packages/web-react/src/types/toggle.ts | Adds details prop to Toggle types via DetailsProps. |
| packages/web-react/src/hooks/useAriaDetails.tsx | Adds hook for managing aria-details id registration. |
| packages/web-react/src/hooks/index.ts | Exports useAriaDetails. |
| packages/web-react/src/components/index.ts | Exports FieldDetails from components barrel. |
| packages/web-react/src/components/Toggle/Toggle.tsx | Renders FieldDetails when details provided and wires aria-details. |
| packages/web-react/src/components/Toggle/tests/Toggle.test.tsx | Adds tests for details rendering + aria-details. |
| packages/web-react/src/components/Toggle/README.md | Documents new details prop and consent patterns. |
| packages/web-react/src/components/Toggle/demo/index.tsx | Adds consent demo sections for Toggle. |
| packages/web-react/src/components/Toggle/demo/ToggleConsentEmphasizedLabel.tsx | Adds emphasized-label consent demo (Toggle). |
| packages/web-react/src/components/Toggle/demo/ToggleConsentFullExample.tsx | Adds full consent demo with helper/validation + modals (Toggle). |
| packages/web-react/src/components/Checkbox/Checkbox.tsx | Renders FieldDetails when details provided and wires aria-details. |
| packages/web-react/src/components/Checkbox/tests/Checkbox.test.tsx | Adds tests for details rendering + aria-details. |
| packages/web-react/src/components/Checkbox/README.md | Documents new details prop and consent patterns. |
| packages/web-react/src/components/Checkbox/demo/index.tsx | Adds consent demo sections for Checkbox. |
| packages/web-react/src/components/Checkbox/demo/CheckboxConsentEmphasizedLabel.tsx | Adds emphasized-label consent demo (Checkbox). |
| packages/web-react/src/components/Checkbox/demo/CheckboxConsentFullExample.tsx | Adds full consent demo with helper/validation + modals (Checkbox). |
| packages/web-react/src/components/Field/useAriaIds.tsx | Changes useAriaIds to named export (no default export). |
| packages/web-react/src/components/Field/index.ts | Updates Field barrel exports for useAriaIds. |
| packages/web-react/src/components/Field/tests/useAriaIds.test.tsx | Updates test import to named useAriaIds. |
| packages/web-react/src/components/FieldDetails/FieldDetails.tsx | Adds new FieldDetails component with aria-details registration support. |
| packages/web-react/src/components/FieldDetails/types.ts | Adds FieldDetails prop types. |
| packages/web-react/src/components/FieldDetails/useFieldDetailsStyleProps.ts | Adds style-props hook for FieldDetails. |
| packages/web-react/src/components/FieldDetails/tests/FieldDetails.test.tsx | Adds FieldDetails rendering + registration tests. |
| packages/web-react/src/components/FieldDetails/tests/useFieldDetailsStyleProps.test.ts | Adds hook test for className prefix. |
| packages/web-react/src/components/FieldDetails/README.md | Documents FieldDetails (React) usage/API. |
| packages/web-react/src/components/FieldDetails/stories/FieldDetails.stories.tsx | Adds Storybook stories for FieldDetails. |
| packages/web-react/src/components/FieldDetails/index.ts | Adds FieldDetails entrypoint exports. |
| packages/web-react/src/components/FieldDetails/index.html | Adds web-react demo page entry for FieldDetails. |
| packages/web-react/src/components/FieldDetails/demo/index.tsx | Adds FieldDetails demo app entry (web-react). |
| packages/web-react/src/components/FieldDetails/demo/FieldDetailsDefault.tsx | Adds Checkbox-based FieldDetails demo (web-react). |
| packages/web-react/src/components/FieldDetails/demo/FieldDetailsWithToggle.tsx | Adds Toggle-based FieldDetails demo (web-react). |
| packages/web-react/package.json | Adds package export map entry for ./components/FieldDetails. |
packages/web-react/src/components/FieldDetails/FieldDetails.tsx
Outdated
Show resolved
Hide resolved
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23431329539/artifacts/6056070783 |
|
suggestion (non-blocking): Consider renaming
|
packages/web-react/src/components/FieldDetails/FieldDetails.tsx
Outdated
Show resolved
Hide resolved
packages/web-react/src/components/InputDetails/__tests__/InputDetails.test.tsx
Show resolved
Hide resolved
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23481020650/artifacts/6076266881 |
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23481020650/artifacts/6076438123 |
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23481970781/artifacts/6076660818 |
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23481970781/artifacts/6076821463 |
4f69156 to
81b09a7
Compare
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23639806062/artifacts/6141061168 |
d8643c5 to
800c8ed
Compare
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23640002974/artifacts/6141131330 |
800c8ed to
eb0a2d0
Compare
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23640449260/artifacts/6141324274 |
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23640057594/artifacts/6141380957 |
26e58fa to
c41efae
Compare
packages/web-react/src/components/InputDetails/demo/InputDetailsWithToggle.tsx
Outdated
Show resolved
Hide resolved
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23640788119/artifacts/6141689493 |
7799ddd to
01a37d9
Compare
01a37d9 to
c63868c
Compare
* add ignore pattern for hook names (useXxx) to heading-capitalization
rule so they are not flagged as capitalization errors
c63868c to
b586883
Compare
|
Here is the URL of the uploaded artifact: https://github.com/alma-oss/spirit-design-system/actions/runs/23644007762/artifacts/6142844949 |

Description
Add new
InputDetailscomponent for rendering supplementary content (e.g. modal trigger links for terms and conditions, privacy policies) below form field labels of the Checkbox or Toggle component.FieldDetails→InputDetailsAdditional context
InputDetailsis a shared sub-component consumed internally by Checkbox and Toggle via their new details prop. It is also exported for standalone use.Issue reference
https://jira.almacareer.tech/browse/DS-2454