2222 * SOFTWARE.
2323 */
2424
25- import { cn } from '@/lib/utils' ;
2625import { useTheme } from 'next-themes' ;
26+ import { ForwardedRef , forwardRef , ForwardRefExoticComponent , ReactElement , RefAttributes } from 'react' ;
27+ import { cn } from '@/lib/utils' ;
2728import Button , { ButtonProps } from '@/components/Button' ;
2829import { TestableComponent } from '@/types/dom' ;
29- import { ForwardedRef , forwardRef , ForwardRefExoticComponent , PropsWithChildren , ReactElement } from 'react' ;
3030import { Theme } from '@/types/theme' ;
3131import MoonIcon from '@/icons/MoonIcon' ;
3232import SunIcon from '@/icons/SunIcon' ;
3333
3434/**
3535 * The `ThemeSwitchProps` interface represents the props accepted by the `ThemeSwitch` component.
3636 */
37- export type ThemeSwitchProps = ButtonProps &
38- TestableComponent &
39- PropsWithChildren < {
37+ export type ThemeSwitchProps = TestableComponent &
38+ ButtonProps & {
4039 /**
4140 * The variant of the theme switch component.
4241 * It can be either `'icon'` or `'labelled'`.
4342 *
4443 * @defaultValue `'icon'`
4544 */
4645 variant ?: 'icon' | 'labelled' ;
47- } > ;
46+ } ;
4847
4948/**
5049 * `ThemeSwitch` is a React component that allows users to toggle between light and dark themes.
@@ -57,7 +56,10 @@ export type ThemeSwitchProps = ButtonProps &
5756 * @param props - Props for the component.
5857 * @returns ThemeSwitch as a React component.
5958 */
60- const ThemeSwitch : ForwardRefExoticComponent < ThemeSwitchProps > = forwardRef (
59+ const ThemeSwitch : ForwardRefExoticComponent < ThemeSwitchProps & RefAttributes < HTMLButtonElement > > = forwardRef <
60+ HTMLButtonElement ,
61+ ThemeSwitchProps
62+ > (
6163 (
6264 { children, className, variant = 'icon' , bordered, ...rest } : ThemeSwitchProps ,
6365 ref : ForwardedRef < HTMLButtonElement > ,
0 commit comments