forked from mui/pigment-css
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba52f86
commit c407625
Showing
1 changed file
with
1 addition
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,2 @@ | ||
'use client'; | ||
/** | ||
* This package has it's own version of RtlProvider to avoid including | ||
* @mui/system in the bundle if someone is not using it. | ||
*/ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
type RtlContextType = boolean | undefined; | ||
|
||
type RtlProviderProps = { | ||
value?: RtlContextType; | ||
}; | ||
|
||
const RtlContext = React.createContext<RtlContextType>(false); | ||
|
||
function RtlProvider({ value, ...props }: RtlProviderProps) { | ||
return <RtlContext.Provider value={value ?? true} {...props} />; | ||
} | ||
|
||
RtlProvider.propTypes /* remove-proptypes */ = { | ||
// ┌────────────────────────────── Warning ──────────────────────────────┐ | ||
// │ These PropTypes are generated from the TypeScript type definitions. │ | ||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │ | ||
// └─────────────────────────────────────────────────────────────────────┘ | ||
/** | ||
* @ignore | ||
*/ | ||
value: PropTypes.bool, | ||
} as any; | ||
|
||
export const useRtl = () => { | ||
const value = React.useContext(RtlContext); | ||
return value ?? false; | ||
}; | ||
|
||
export default RtlProvider; | ||
export * from '@mui/system/RtlProvider'; |