Skip to content

Commit 3de1d14

Browse files
authored
Merge pull request #1338 from habx/feature/APP-29181
APP-29181: feat: React 18
2 parents c8bc678 + a472b31 commit 3de1d14

File tree

20 files changed

+1335
-3379
lines changed

20 files changed

+1335
-3379
lines changed

package-lock.json

Lines changed: 1246 additions & 3290 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
]
4343
},
4444
"peerDependencies": {
45-
"@habx/ui-core": "^5.64.0",
45+
"@habx/ui-core": "^7.0.0",
4646
"lodash": ">=4.17.21",
47-
"react": ">= 17.0.2",
47+
"react": ">= 18.0.0",
4848
"styled-components": ">= 5.3.5"
4949
},
5050
"dependencies": {
@@ -57,22 +57,22 @@
5757
"react-window-infinite-loader": "^1.0.7"
5858
},
5959
"devDependencies": {
60-
"@habx/config-ci-front": "^0.19.0",
60+
"@habx/config-ci-front": "^2.0.0",
6161
"@habx/eslint-config-client": "^6.6.0",
62-
"@habx/ui-core": "5.64.0",
62+
"@habx/ui-core": "^6.0.0",
6363
"@storybook/addon-docs": "^6.4.22",
6464
"@storybook/addon-essentials": "^6.4.22",
6565
"@storybook/addon-links": "^6.4.22",
6666
"@storybook/react": "^6.4.22",
6767
"@storybook/storybook-deployer": "^2.8.11",
68-
"@testing-library/react": "^12.1.5",
68+
"@testing-library/react": "^13.1.1",
6969
"@testing-library/react-hooks": "^8.0.0",
7070
"@types/faker": "^5.5.9",
7171
"@types/jest": "^27.4.1",
7272
"@types/lodash": "^4.14.181",
7373
"@types/papaparse": "^5.3.2",
74-
"@types/react": "^17.0.44",
75-
"@types/react-dom": "^17.0.15",
74+
"@types/react": "^18.0.5",
75+
"@types/react-dom": "^18.0.1",
7676
"@types/react-table": "^7.7.10",
7777
"@types/react-window": "^1.8.5",
7878
"@types/react-window-infinite-loader": "^1.0.6",
@@ -85,9 +85,9 @@
8585
"jest-environment-jsdom-sixteen": "^1.0.3",
8686
"lint-staged": "^12.3.8",
8787
"lodash": "^4.17.21",
88-
"react": "^17.0.2",
89-
"react-dom": "^17.0.2",
90-
"react-test-renderer": "^17.0.2",
88+
"react": "^18.0.0",
89+
"react-dom": "^18.0.0",
90+
"react-test-renderer": "^18.0.0",
9191
"rimraf": "^3.0.2",
9292
"rollup-plugin-typescript2": "^0.31.2",
9393
"storybook-dark-mode": "^1.0.9",

src/Table/LoadingOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const LoadingContainer = styled.div`
1919
opacity: 0.8;
2020
`
2121

22-
export const LoadingOverlay: React.VoidFunctionComponent = () => (
22+
export const LoadingOverlay: React.FunctionComponent = () => (
2323
<LoadingContainer>
2424
<Loader size="large" outline />
2525
</LoadingContainer>

src/Table/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const Table = <D extends {}>({
132132
headerGroups.map((headerGroup, headerGroupIndex) => (
133133
<TableHeadRow {...headerGroup.getHeaderGroupProps()}>
134134
{headerGroup.headers.map((col, headerCellIndex) => {
135-
const column = (col as unknown) as ColumnInstance<D>
135+
const column = col as unknown as ColumnInstance<D>
136136

137137
const headerProps = column.getHeaderProps(
138138
...(column.getSortByToggleProps

src/Table/TableFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const TableFooter = <D extends {}>({
1212
{footerGroups.map((group) => {
1313
if (
1414
group.headers.every((column) => {
15-
const Footer = ((column as unknown) as { Footer: Function }).Footer
15+
const Footer = (column as unknown as { Footer: Function }).Footer
1616
return !Footer || Footer === emptyRenderer
1717
})
1818
) {

src/Table/TableOptions/TablePagination.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,5 @@ export const TablePagination: React.FunctionComponent<PaginationProps> = ({
8686

8787
interface PaginationProps {
8888
instance: TableInstance<any>
89+
children?: React.ReactNode
8990
}

src/Table/hooks/useVirtualize.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ export const useVirtualize = <D extends object>(
2626

2727
React.useEffect(() => {
2828
if (!skip && isEmpty(dimensions)) {
29-
setDimensions({
30-
height: scrollContainerRef.current?.clientHeight,
31-
width: scrollContainerRef.current?.clientWidth,
32-
itemSize: config.rowsHeight,
33-
})
29+
React.startTransition(() =>
30+
setDimensions({
31+
height: scrollContainerRef.current?.clientHeight,
32+
width: scrollContainerRef.current?.clientWidth,
33+
itemSize: config.rowsHeight,
34+
})
35+
)
3436
}
3537

36-
const handleResize = () => setDimensions({})
38+
const handleResize = () => React.startTransition(() => setDimensions({}))
3739

3840
window.addEventListener('resize', handleResize)
3941

src/_fakeData/storyFakeData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const RICH_COLUMNS = [
6666
},
6767
] as Column<typeof FAKE_DATA[0]>[]
6868

69-
export const IMEX_COLUMNS: IMEXColumn<Faker.Card & { id: number }>[] = [
69+
export const IMEX_COLUMNS: IMEXColumn[] = [
7070
{
7171
Header: 'Username',
7272
accessor: 'username',

src/cell/ImageCell/ImageCell.hooks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import * as React from 'react'
33
import { IMAGE_ZOOM_SIZE } from './ImageCell.style'
44

55
export const useZoomStyle = (imageRef: React.RefObject<HTMLImageElement>) => {
6-
const [zoomStyle, setZoomStyle] = React.useState<
7-
React.CSSProperties | undefined
8-
>(undefined)
6+
const [zoomStyle, setZoomStyle] =
7+
React.useState<React.CSSProperties | undefined>(undefined)
98

109
React.useLayoutEffect(() => {
1110
if (imageRef.current) {

src/components/LoadingOverlay/LoadingOverlay.tsx

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,32 @@ import { OverlayContainer } from './LoadingOverlay.style'
88

99
const pad = (n: number) => (n < 10 ? `0${n}` : n)
1010

11-
export const LoadingOverlay: React.FunctionComponent<LoadingOverlayInterface> = ({
12-
total,
13-
done,
14-
remainingTime,
15-
}) => {
16-
const remainingTimeDate = remainingTime ? new Date(remainingTime) : new Date()
17-
return (
18-
<OverlayContainer>
19-
<Card spacing="regular">
20-
<Title type="regular">
21-
{done}/{total}
22-
</Title>
23-
<br />
24-
<LoadingBar total={total} loaded={done} />
25-
<br />
26-
<Text>
27-
Temps restant:{' '}
28-
{remainingTime
29-
? `${pad(remainingTimeDate.getMinutes())}:${pad(
30-
remainingTimeDate.getSeconds()
31-
)}`
32-
: '--:--'}
33-
</Text>
34-
</Card>
35-
</OverlayContainer>
36-
)
37-
}
11+
export const LoadingOverlay: React.FunctionComponent<LoadingOverlayInterface> =
12+
({ total, done, remainingTime }) => {
13+
const remainingTimeDate = remainingTime
14+
? new Date(remainingTime)
15+
: new Date()
16+
return (
17+
<OverlayContainer>
18+
<Card spacing="regular">
19+
<Title type="regular">
20+
{done}/{total}
21+
</Title>
22+
<br />
23+
<LoadingBar total={total} loaded={done} />
24+
<br />
25+
<Text>
26+
Temps restant:{' '}
27+
{remainingTime
28+
? `${pad(remainingTimeDate.getMinutes())}:${pad(
29+
remainingTimeDate.getSeconds()
30+
)}`
31+
: '--:--'}
32+
</Text>
33+
</Card>
34+
</OverlayContainer>
35+
)
36+
}
3837

3938
interface LoadingOverlayInterface {
4039
total: number

0 commit comments

Comments
 (0)