Skip to content

Commit 032cccb

Browse files
committed
chore(types-react): update react types v18
1 parent a4bbc98 commit 032cccb

File tree

14 files changed

+41
-53
lines changed

14 files changed

+41
-53
lines changed

packages/lumx-react/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"@types/dom-view-transitions": "^1.0.5",
4444
"@types/jest": "^29.2.1",
4545
"@types/lodash": "^4.14.149",
46-
"@types/react": "^17.0.2",
47-
"@types/react-dom": "^17.0.2",
48-
"@types/react-is": "^17.0.2",
46+
"@types/react": "^18.3.16",
47+
"@types/react-dom": "^18.3.5",
48+
"@types/react-is": "^18.3.1",
4949
"autoprefixer": "^9.7.4",
5050
"babel-jest": "29.1.2",
5151
"babel-loader": "^8.0.6",

packages/lumx-react/src/components/post-block/PostBlock.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { ReactNode } from 'react';
22

33
import classNames from 'classnames';
4-
import isObject from 'lodash/isObject';
54

65
import { Orientation, Theme, Thumbnail, ThumbnailProps, ThumbnailVariant } from '@lumx/react';
76
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
@@ -98,11 +97,11 @@ export const PostBlock = forwardRef<PostBlockProps, HTMLDivElement>((props, ref)
9897

9998
{meta && <span className={`${CLASSNAME}__meta`}>{meta}</span>}
10099

101-
{isObject(text) && text.__html ? (
100+
{typeof text === 'string' ? (
101+
<p className={`${CLASSNAME}__text`}>{text}</p>
102+
) : (
102103
// eslint-disable-next-line react/no-danger
103104
<p dangerouslySetInnerHTML={text} className={`${CLASSNAME}__text`} />
104-
) : (
105-
<p className={`${CLASSNAME}__text`}>{text}</p>
106105
)}
107106

108107
{attachments && <div className={`${CLASSNAME}__attachments`}>{attachments}</div>}

packages/lumx-react/src/components/side-navigation/SideNavigation.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Emphasis, SideNavigation, SideNavigationItem } from '@lumx/react';
66

77
export default { title: 'LumX components/side-navigation/Side Navigation' };
88

9-
const CustomLink: React.FC = ({ children, ...props }) =>
9+
const CustomLink: React.FC<{ children?: React.ReactNode }> = ({ children, ...props }) =>
1010
React.createElement('a', { ...props, style: { color: 'red' } }, children);
1111

1212
export const Simple = () => (

packages/lumx-react/src/components/text-field/TextField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { forwardRef } from '@lumx/react/utils/forwardRef';
2727
*/
2828
export interface TextFieldProps extends GenericProps, HasTheme {
2929
/** Chip Group to be rendered before the main text input. */
30-
chips?: HTMLElement | ReactNode;
30+
chips?: ReactNode;
3131
/** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */
3232
clearButtonProps?: Pick<IconButtonProps, 'label'> &
3333
Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;

packages/lumx-react/src/components/tooltip/context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const DEFAULT_VALUE = {};
1010
*/
1111
const TooltipContext = React.createContext<TooltipContextValue | undefined>(undefined);
1212

13-
export const TooltipContextProvider: React.FC = ({ children }) => (
13+
export const TooltipContextProvider: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
1414
<TooltipContext.Provider value={DEFAULT_VALUE}>{children}</TooltipContext.Provider>
1515
);
1616

packages/lumx-react/src/utils/ClickAwayProvider/ClickAwayProvider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ interface ClickAwayProviderProps extends ClickAwayParameters {
1313
* (Optional) Element that should be considered as part of the parent
1414
*/
1515
parentRef?: RefObject<HTMLElement>;
16+
/**
17+
* Children
18+
*/
19+
children?: React.ReactNode;
1620
}
1721

1822
/**

packages/lumx-react/src/utils/skipRender.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { DOCUMENT } from '@lumx/react/constants';
2-
import { Comp } from '@lumx/react/utils/type';
31
import React from 'react';
2+
import { Comp } from '@lumx/react/utils/type';
43

54
/**
65
* HOC component wrapping a component to skip render if predicate return falsy
76
*/
87
export const skipRender = <P, T>(predicate: (props: P) => any, Component: Comp<P, T>) => {
9-
const Wrapper = React.forwardRef<T, P>((props, ref) => {
10-
if (!DOCUMENT) {
8+
const Wrapper = React.forwardRef<T, P>((props: any, ref) => {
9+
if (!predicate(props)) {
1110
// Can't render in SSR.
1211
return null;
1312
}

packages/lumx-react/src/utils/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const NAME_PROPERTIES: string[] = [
2121

2222
/** LumX Component Type. */
2323
export type Comp<P, T = HTMLElement> = {
24-
(props: P & { ref?: Ref<T> }): ReactElement | null;
24+
(props: P & { ref?: Ref<T> }): ReactNode | null;
2525
/** React component type. */
2626
readonly $$typeof: symbol;
2727
/** Component default props. */

packages/site-demo/content/product/components/table/react/default.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const App = ({ theme = Theme.light }: any) => {
8383
const [tableHeader, setTableHeader] = useState(initialHeaders);
8484
const [tableBody, setTableBody] = useState(initialTable);
8585
const toggleSort = useCallback(
86-
(header) => {
86+
(header: Partial<TableHeaderProps>) => {
8787
const sortOrder = header.sortOrder === ThOrder.asc ? ThOrder.desc : ThOrder.asc;
8888
setTableHeader(
8989
tableHeader.map((h) => ({

packages/site-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"devDependencies": {
5757
"@types/reach__router": "^1.3.6",
58-
"@types/react-helmet": "^6.1.0",
58+
"@types/react-helmet": "^6.1.11",
5959
"glob": "^7.1.6",
6060
"htmlparser2": "^3.10.1",
6161
"tsconfig-paths-webpack-plugin": "^3.3.0",

0 commit comments

Comments
 (0)