chore: update react 18 (#520)

* chore: update to react 18 and related dependencies
This commit is contained in:
Dan Ribbens
2022-04-12 11:26:55 -04:00
committed by GitHub
parent 6b06fe4481
commit a4f2c5abd4
19 changed files with 65 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
import { MouseEvent } from 'react';
import React, { MouseEvent } from 'react';
export type Props = {
className?: string,

View File

@@ -1,4 +1,5 @@
export type Props = {
children?: React.ReactNode,
className?: string,
to?: string,
icon?: React.ReactNode,

View File

@@ -9,7 +9,7 @@ import './index.scss';
const Context = createContext({} as ContextType);
const StepNavProvider: React.FC = ({ children }) => {
const StepNavProvider: React.FC<{children?: React.ReactNode}> = ({ children }) => {
const [stepNav, setStepNav] = useState([]);
return (

View File

@@ -4,7 +4,7 @@ import { useWindowInfo } from '@faceless-ui/window-info';
const context = createContext(false);
const { Provider } = context;
export const NegativeFieldGutterProvider: React.FC<{allow?: boolean}> = ({ children, allow }) => {
export const NegativeFieldGutterProvider: React.FC<{allow?: boolean, children?: React.ReactNode}> = ({ children, allow }) => {
const { breakpoints: { m: midBreak } } = useWindowInfo();
return (

View File

@@ -1,3 +1,4 @@
import React from 'react';
import { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd';
export type Props = {
@@ -5,4 +6,5 @@ export type Props = {
verticalAlignment?: 'top' | 'center' | 'sticky'
dragHandleProps?: DraggableProvidedDragHandleProps
className?: string
children?: React.ReactNode
}

View File

@@ -1,3 +1,4 @@
import React from 'react';
import { Field as FieldConfig, Condition, Validate } from '../../../../fields/config/types';
export type Field = {
@@ -39,6 +40,7 @@ export type Props = {
waitForAutocomplete?: boolean
log?: boolean
validationOperation?: 'create' | 'update'
children?: React.ReactNode
}
export type SubmitOptions = {

View File

@@ -3,7 +3,6 @@ import isHotkey from 'is-hotkey';
import { createEditor, Transforms, Node, Element as SlateElement, Text, BaseEditor } from 'slate';
import { ReactEditor, Editable, withReact, Slate } from 'slate-react';
import { HistoryEditor, withHistory } from 'slate-history';
import { options } from 'joi';
import { richText } from '../../../../../fields/validations';
import useField from '../../useField';
import withCondition from '../../withCondition';

View File

@@ -2,4 +2,5 @@ export type ButtonProps = {
format: string
onClick?: (e: React.MouseEvent) => void
className?: string
children?: React.ReactNode
}

View File

@@ -1,3 +1,6 @@
import React from 'react';
export type Props = {
className?: string,
className?: string
children?: React.ReactNode
};

View File

@@ -4,4 +4,5 @@ export type Props = {
className?: string,
width?: 'normal' | 'wide'
style?: React.CSSProperties
children?: React.ReactNode
};

View File

@@ -21,7 +21,7 @@ const NestProviders = ({ providers, children }) => {
);
};
export const CustomProvider: React.FC<{ children }> = ({ children }) => {
export const CustomProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const config = useConfig();
const {

View File

@@ -1,3 +1,4 @@
import React from 'react';
import { SanitizedCollectionConfig, TypeWithID, TypeWithTimestamps } from '../../../../collections/config/types';
import { SanitizedGlobalConfig } from '../../../../globals/config/types';
import { PaginatedDocs } from '../../../../mongoose/types';
@@ -21,4 +22,5 @@ export type Props = {
collection?: SanitizedCollectionConfig
global?: SanitizedGlobalConfig
id?: string | number
children?: React.ReactNode
}

View File

@@ -7,7 +7,7 @@ import { useSearchParams } from '../SearchParams';
const Context = createContext('');
export const LocaleProvider: React.FC = ({ children }) => {
export const LocaleProvider: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
const { localization } = useConfig();
const { user } = useAuth();
const defaultLocale = (localization && localization.defaultLocale) ? localization.defaultLocale : 'en';

View File

@@ -17,7 +17,7 @@ const requestOptions = (value) => ({
},
});
export const PreferencesProvider: React.FC = ({ children }) => {
export const PreferencesProvider: React.FC<{children?: React.ReactNode}> = ({ children }) => {
const contextRef = useRef({} as PreferencesContext);
const preferencesRef = useRef({});
const config = useConfig();

View File

@@ -4,7 +4,7 @@ import qs from 'qs';
const Context = createContext({});
export const SearchParamsProvider: React.FC = ({ children }) => {
export const SearchParamsProvider: React.FC<{children?: React.ReactNode}> = ({ children }) => {
const location = useLocation();
const params = qs.parse(

View File

@@ -4,7 +4,7 @@ import './index.scss';
const baseClass = 'field-diff-label';
const Label: React.FC = ({ children }) => (
const Label: React.FC<{children?: React.ReactNode}> = ({ children }) => (
<div className={baseClass}>
{children}
</div>

View File

@@ -31,7 +31,7 @@ const CreatedAtCell: React.FC<CreatedAtCellProps> = ({ collection, global, id, d
);
};
const TextCell: React.FC = ({ children }) => (
const TextCell: React.FC<{children?: React.ReactNode}> = ({ children }) => (
<span>
{children}
</span>