Skip to content

Conversation

@EurFelux
Copy link
Collaborator

@EurFelux EurFelux commented Oct 30, 2025

Summary

This pull request replaces the HeroUI Switch component with a custom implementation based on Radix UI primitives, improving maintainability and providing better control over the component's behavior and styling.

image

Key Changes

Component Migration

  • Replaced HeroUI Switch with custom Radix UI-based implementation
  • Added @radix-ui/react-switch as a new dependency
  • Deprecated direct imports of HeroUI Switch component via ESLint rules

API Improvements

  • Standardized props: isSelectedchecked, onValueChangeonCheckedChange
  • Simplified loading state: isLoadingloading
  • Removed unnecessary props: Eliminated redundant size prop
  • Enhanced TypeScript support: Better type safety with proper interface extensions

Enhanced Features

  • Loading state: Built-in loading spinner with Lucide React icons
  • Improved accessibility: Better semantic HTML structure from Radix UI
  • Custom styling: Tailwind CSS classes for consistent theming
  • Better visual feedback: Enhanced hover and focus states

Code Updates

Updated 30+ files across the codebase to use the new Switch API:

  • Settings pages (SettingsTab.tsx, AboutSettings.tsx, etc.)
  • Painting pages (AihubmixPage.tsx, DmxapiPage.tsx, etc.)
  • Mini-app settings and dialog components
  • Dynamic form rendering components

Benefits

  • Better maintainability: Custom implementation gives full control
  • Consistent API: Standardized prop names follow React conventions
  • Improved performance: Radix UI primitives are optimized
  • Enhanced accessibility: Better screen reader support
  • Flexible styling: Easier to customize with Tailwind CSS

Breaking Changes

  • Prop name changes: All Switch components now use checked/onCheckedChange instead of isSelected/onValueChange
  • Loading prop: isLoading renamed to loading
  • Size prop: Removed, styling handled through CSS classes
  • HeroUI Switch: Direct imports now blocked by ESLint rule

These changes are backward-compatible through the wrapper components and have been systematically applied throughout the codebase.

Testing

  • ✅ All existing Switch functionality preserved
  • ✅ Loading states work correctly with spinner animation
  • ✅ Accessibility features maintained via Radix UI
  • ✅ Storybook stories updated and comprehensive
  • ✅ ESLint rules prevent deprecated imports
replace heroui switch implementation with radix-ui for better maintainability
update package.json and yarn.lock to include new dependency
…ange to checked/onCheckedChange

Standardize Switch component props across the codebase to use checked/onCheckedChange instead of isSelected/onValueChange for better consistency with common React patterns. Also updates loading state prop from isLoading to loading and removes size prop where unnecessary.

The changes include:
- Replacing isSelected with checked
- Replacing onValueChange with onCheckedChange
- Updating isLoading to loading
- Removing redundant size props
- Adjusting styling to accommodate new loading state
- Add default values for loading and disabled props
- Update styling classes and add group cursor pointer
- Restructure loading indicator and thumb positioning
- Wrap DescriptionSwitch children in flex container
@EurFelux EurFelux changed the title feat(switch): new Switch Oct 30, 2025
- Restructure DescriptionSwitch to use explicit props instead of children
- Add label, description, and position props for better customization
- Update all switch usages in SettingsTab to use new props format
Remove redundant children prop from CustomSwitchProps since it's already omitted from the parent type
Ensure proper label association with switch input by generating unique ID using React's useId hook
Add sm, md, and lg size options to the Switch component with corresponding styles. This allows for better visual consistency across different UI contexts.
update switch component layout and spacing to improve consistency
modify secondary-foreground color variable to use correct semantic token
- Add new switch.css file with gradient and transition styles
- Update switch.tsx component with new styling classes and animations
- Remove loader icon in favor of animated gradient effect
github-actions bot pushed a commit that referenced this pull request Oct 31, 2025
@0xfullex 0xfullex added the v2 label Nov 1, 2025
@0xfullex 0xfullex added this to the v2.0.0 milestone Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants