CORE-2000: Migrate Checkbox and Radio components to plain CSS - #120
Conversation
Review Comments AddressedI've addressed all the review comments: 1. Fixed
|
9ce33b7 to
42a08ec
Compare
42a08ec to
d9716f1
Compare
d9716f1 to
15ca528
Compare
bc4aade to
dfd8807
Compare
This comment was marked as resolved.
This comment was marked as resolved.
8ec5ed7 to
8b2238d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
- Created Checkbox.css with CSS variable-based styling - Updated Checkbox.tsx to use classnames and CSS variables - Updated sharedCheckboxStyles.ts to remove styled-components dependencies - Created Radio.css with CSS variable-based styling - Updated Radio.tsx to use classnames and CSS variables - Added CSS module declaration to react.d.ts - Updated package.json sideEffects to preserve CSS imports Related to CORE-2000
- Updated TreeCheckbox.tsx to use classnames and CSS variables - Added TreeCheckbox-specific styles to Checkbox.css for data-slot and indeterminate state - Removed styled-components dependency from TreeCheckbox
- Fixed CSS properties type assertion in TreeCheckbox - Updated all test snapshots for Checkbox, Radio, and TreeCheckbox - All 214 tests passing
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Fix Radio.tsx labelAs prop to properly render different element types using React.createElement - Remove tooltipText from DOM props spreading to avoid React warnings - Fix TypeScript CSS custom property type errors by casting to unknown first - Update test snapshots for all affected components Fixes: - Radio labelAs prop now works correctly instead of setting invalid DOM attribute - TreeCheckbox, Checkbox, and Radio now use proper TypeScript type casting for CSS variables - All 214 tests passing revert lock files Update TreeCheckbox.tsx Update index.spec.tsx.snap
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Replace generic 'disabled' class with BEM-style modifier classes to avoid CSS collisions with consumer code: - checkbox-label--disabled / checkbox-input--disabled - radio-label--disabled / radio-input--disabled - Add explicit HTMLElement type to ref in Radio.tsx for better type safety - Update all component implementations to use new BEM class names - Update test snapshots All 214 tests passing. Addresses review comments from Copilot about: - Generic class names causing potential conflicts in published component library - Untyped ref leading to potential type errors revert lock files Update index.spec.tsx.snap
The selection slot div in TreeCheckbox was using both className="checkbox-input" and data-slot="selection", causing duplicate styling. The CSS already has comprehensive [data-slot="selection"] rules that cover all the necessary styling, making the checkbox-input class redundant and confusing. Changes: - Removed className="checkbox-input" from TreeCheckbox selection slot - CSS [data-slot="selection"] rules already include all necessary styling - Updated 5 test snapshots to reflect the cleaner markup This addresses the Copilot review comment about duplicate/conflicting styling between .checkbox-input class and [data-slot="selection"] attribute. revert lock files
f5302ea to
a0e3788
Compare
Summary
This PR migrates the Checkbox and Radio form components from styled-components to plain CSS, following the same patterns established in #115 and #119.
Changes Made
Checkbox Component
Checkbox.csswith CSS variable-based stylingCheckbox.tsxto:sharedCheckboxStyles.tsto:Radio Component
Radio.csswith CSS variable-based stylingRadio.tsxto:Infrastructure
react.d.tspackage.jsonsideEffects to["**/*.css"]to prevent tree-shaking of CSS importsCSS Variable Bindings
Checkbox (variant-dependent):
--checkbox-bg: variant background color--checkbox-color: variant text color--checkbox-border-unchecked: variant unchecked border--checkbox-border-checked: variant checked border--checkbox-checkmark: variant checkmark SVG--checkbox-size: size prop value--checkbox-disabled-color: colors.palette.neutralLightRadio (static):
--radio-border: colors.palette.neutralThin--radio-checked: colors.palette.mediumBlue--radio-bg: colors.palette.white--radio-disabled-color: colors.palette.paleTesting
Related