Skip to content

Commit

Permalink
fix(root-provider): make id a prop
Browse files Browse the repository at this point in the history
fix #305
  • Loading branch information
morewings committed May 24, 2024
1 parent 09bd401 commit e4cb37d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib/RootTheme/RootThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {useRootTheme} from './useRootTheme';
/**
* @public
*/
export type RootThemeProviderProps = DataAttributes &
Omit<LibraryProps, 'id'> & {children: ReactNode; theme: ThemeType};
export type RootThemeProviderProps = DataAttributes & LibraryProps & {children: ReactNode; theme: ThemeType};

/**
* @public
Expand All @@ -20,7 +19,13 @@ export type RootThemeProviderProps = DataAttributes &
* @see ThemeType
* @see https://github.com/morewings/css-vars-hook#type-safety
*/
export const RootThemeProvider: FC<RootThemeProviderProps> = ({children, theme, className, ...nativeProps}) => {
export const RootThemeProvider: FC<RootThemeProviderProps> = ({
children,
theme,
className,
id = ROOT_ID,
...nativeProps
}) => {
const {setTheme, style, getTheme, getVariable, setVariable, removeVariable} = useRootTheme(theme);

const {Provider} = RootContext;
Expand All @@ -36,7 +41,7 @@ export const RootThemeProvider: FC<RootThemeProviderProps> = ({children, theme,

return (
<Provider value={actions}>
<div {...nativeProps} id={ROOT_ID} className={className} style={style}>
<div {...nativeProps} id={id} className={className} style={style}>
{children}
</div>
</Provider>
Expand Down

0 comments on commit e4cb37d

Please sign in to comment.