Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split RUIProvider into two #583

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/components/Alert/Alert.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import {
RUIContext,
withGlobalProps,
} from '../../provider';
import { TranslationsContext } from '../../providers/translations';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
Expand All @@ -17,7 +15,7 @@ export const Alert = ({
onClose,
...restProps
}) => {
const { translations } = useContext(RUIContext);
const translations = useContext(TranslationsContext);

return (
<div
Expand Down
2 changes: 1 addition & 1 deletion src/components/Badge/Badge.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonGroup/ButtonGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React, {
useMemo,
} from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/CardBody.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import styles from './Card.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/CardFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { transferProps } from '../../utils/transferProps';
import { withGlobalProps } from '../../providers/globalProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import styles from './Card.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/components/CheckboxField/CheckboxField.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/FileInputField/FileInputField.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormLayout/FormLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useMemo } from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormLayout/FormLayoutCustomField.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Grid/Grid.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Grid/GridSpan.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
Expand Down
4 changes: 2 additions & 2 deletions src/components/InputGroup/InputGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import React, {
useContext,
useMemo,
} from 'react';
import { Text } from '../Text';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
import { FormLayoutContext } from '../FormLayout';
import { Text } from '../Text';
import { InputGroupContext } from './InputGroupContext';
import styles from './InputGroup.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React, { useRef } from 'react';
import { createPortal } from 'react-dom';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getPositionClassName } from './_helpers/getPositionClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalBody.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
Expand Down
8 changes: 3 additions & 5 deletions src/components/Modal/ModalCloseButton.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import {
RUIContext,
withGlobalProps,
} from '../../provider';
import { TranslationsContext } from '../../providers/translations';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import styles from './ModalCloseButton.module.scss';

Expand All @@ -13,7 +11,7 @@ export const ModalCloseButton = React.forwardRef((props, ref) => {
...restProps
} = props;

const { translations } = useContext(RUIContext);
const translations = useContext(TranslationsContext);

return (
<button
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalContent.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
import styles from './ModalContent.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getJustifyClassName } from './_helpers/getJustifyClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import { getJustifyClassName } from './_helpers/getJustifyClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import styles from './ModalTitle.module.scss';

Expand Down
36 changes: 18 additions & 18 deletions src/components/Modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -72,7 +72,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand Down Expand Up @@ -126,7 +126,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -247,7 +247,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand Down Expand Up @@ -281,7 +281,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -374,7 +374,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand Down Expand Up @@ -415,7 +415,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -517,7 +517,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand All @@ -538,7 +538,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -605,7 +605,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand All @@ -622,7 +622,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -665,7 +665,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand All @@ -690,7 +690,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -734,7 +734,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand All @@ -754,7 +754,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -807,7 +807,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand Down Expand Up @@ -936,7 +936,7 @@ React.createElement(() => {
React UI docs. You may not need it in your application.
*/}
return (
<RUIProvider globalProps={{
<GlobalPropsProvider globalProps={{
Modal: { preventScrollUnderneath: window.document.documentElement }
}}>
<Button
Expand Down Expand Up @@ -999,7 +999,7 @@ React.createElement(() => {
</Modal>
)}
</div>
</RUIProvider>
</GlobalPropsProvider>
);
});
```
Expand Down
2 changes: 1 addition & 1 deletion src/components/Paper/Paper.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import styles from './Paper.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popover/Popover.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import { createPortal } from 'react-dom';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { classNames } from '../../utils/classNames';
import { transferProps } from '../../utils/transferProps';
import getRootSideClassName from './_helpers/getRootSideClassName';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popover/PopoverWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { withGlobalProps } from '../../provider';
import { withGlobalProps } from '../../providers/globalProps';
import { transferProps } from '../../utils/transferProps';
import styles from './PopoverWrapper.module.scss';

Expand Down
Loading
Loading