Skip to content

Commit

Permalink
Re-export RtlProvider from system
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed Jun 3, 2024
1 parent ba52f86 commit c407625
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions packages/pigment-css-react/src/RtlProvider.tsx
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';

0 comments on commit c407625

Please sign in to comment.