Skip to content

Commit

Permalink
react 19 type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Dec 13, 2024
1 parent a8dbbe7 commit c7adbf8
Show file tree
Hide file tree
Showing 27 changed files with 1,043 additions and 1,235 deletions.
62 changes: 31 additions & 31 deletions apps/material-react-table-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,48 @@
"sitemap": "pnpm docs:sitemap"
},
"dependencies": {
"@docsearch/js": "3.6.1",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@faker-js/faker": "^9.0.0",
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@docsearch/js": "3.8.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@faker-js/faker": "^9.3.0",
"@fortawesome/fontawesome-svg-core": "^6.7.1",
"@fortawesome/free-solid-svg-icons": "^6.7.1",
"@fortawesome/react-fontawesome": "^0.2.2",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@mui/icons-material": "^6.1.0",
"@mui/material": "^6.1.0",
"@mui/x-charts": "^7.16.0",
"@mui/x-date-pickers": "^7.16.0",
"@next/mdx": "^14.2.11",
"@tanstack/react-query": "^5.56.2",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@mui/icons-material": "^6.2.0",
"@mui/material": "^6.2.0",
"@mui/x-charts": "^7.23.2",
"@mui/x-date-pickers": "^7.23.2",
"@next/mdx": "^15.1.0",
"@tanstack/react-query": "^5.62.7",
"@tanstack/react-table-devtools": "^8.20.5",
"@types/mdx": "^2.0.13",
"dayjs": "^1.11.13",
"export-to-csv": "^1.4.0",
"highlight-words": "2.0.0",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.8.3",
"match-sorter": "^6.3.4",
"jspdf": "^2.5.2",
"jspdf-autotable": "^3.8.4",
"match-sorter": "^8.0.0",
"material-react-table": "workspace:*",
"next": "14.2.11",
"next-sitemap": "^4.2.3",
"prism-react-renderer": "^2.4.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"zod": "^3.23.8"
"prism-react-renderer": "^2.4.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.56.1",
"@types/node": "^22.5.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"eslint": "9.10.0",
"eslint-config-next": "14.2.11",
"next-plausible": "^3.12.2",
"@tanstack/eslint-plugin-query": "^5.62.1",
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"eslint": "9.16.0",
"eslint-config-next": "15.1.0",
"next-plausible": "^3.12.4",
"raw-loader": "^4.0.2",
"typescript": "5.6.2"
"typescript": "5.7.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const table = useMaterialReactTable({
table.setEditingCell(cell); //set editing cell
//optionally, focus the text field
queueMicrotask(() => {
const textField = table.refs.editInputRefs.current[column.id];
const textField = table.refs.editInputRefs.current?.[column.id];
if (textField) {
textField.focus();
textField.select?.();
Expand Down
202 changes: 101 additions & 101 deletions apps/material-react-table-docs/public/sitemap-0.xml

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions apps/test-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@mui/icons-material": "^6.1.9",
"@mui/material": "^6.1.9",
"@mui/x-date-pickers": "^7.23.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.2.0",
"@mui/material": "^6.2.0",
"@mui/x-date-pickers": "^7.23.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"material-react-table": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-scripts": "5.0.1"
},
"scripts": {
Expand Down
30 changes: 15 additions & 15 deletions apps/test-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
"typecheck": "tsc"
},
"dependencies": {
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@mui/icons-material": "^6.1.9",
"@mui/material": "^6.1.9",
"@mui/x-date-pickers": "^7.23.0",
"@remix-run/css-bundle": "^2.15.0",
"@remix-run/node": "^2.15.0",
"@remix-run/react": "^2.15.0",
"@remix-run/serve": "^2.15.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.2.0",
"@mui/material": "^6.2.0",
"@mui/x-date-pickers": "^7.23.2",
"@remix-run/css-bundle": "^2.15.1",
"@remix-run/node": "^2.15.1",
"@remix-run/react": "^2.15.1",
"@remix-run/serve": "^2.15.1",
"isbot": "^5.1.17",
"material-react-table": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@remix-run/dev": "^2.15.0",
"@remix-run/eslint-config": "^2.15.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@remix-run/dev": "^2.15.1",
"@remix-run/eslint-config": "^2.15.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"eslint": "^9.16.0",
"typescript": "^5.7.2"
},
Expand Down
28 changes: 14 additions & 14 deletions apps/test-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@mui/icons-material": "^6.1.9",
"@mui/material": "^6.1.9",
"@mui/x-date-pickers": "^7.23.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.2.0",
"@mui/material": "^6.2.0",
"@mui/x-date-pickers": "^7.23.2",
"material-react-table": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.16.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"typescript": "^5.7.2",
"vite": "^6.0.1"
"vite": "^6.0.3"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"storybook:dev": "turbo run storybook"
},
"devDependencies": {
"prettier": "^3.4.1",
"turbo": "2.1.2"
"prettier": "^3.4.2",
"turbo": "2.3.3"
},
"engines": {
"node": ">=16.0.0"
Expand Down
67 changes: 33 additions & 34 deletions packages/material-react-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,46 @@
"build-storybook": "storybook build"
},
"devDependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@faker-js/faker": "^9.0.0",
"@mui/icons-material": "^6.1.0",
"@mui/material": "^6.1.0",
"@mui/x-date-pickers": "^7.16.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@faker-js/faker": "^9.3.0",
"@mui/icons-material": "^6.2.0",
"@mui/material": "^6.2.0",
"@mui/x-date-pickers": "^7.23.2",
"@rollup/plugin-typescript": "^11.1.6",
"@size-limit/preset-small-lib": "^11.1.5",
"@storybook/addon-a11y": "^8.3.0",
"@storybook/addon-essentials": "^8.3.0",
"@storybook/addon-links": "^8.3.0",
"@storybook/addon-storysource": "^8.3.0",
"@storybook/blocks": "^8.3.0",
"@storybook/preview-api": "^8.3.0",
"@storybook/react": "^8.3.0",
"@storybook/react-vite": "^8.3.0",
"@types/node": "^22.5.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.10.0",
"@size-limit/preset-small-lib": "^11.1.6",
"@storybook/addon-a11y": "^8.4.7",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/addon-storysource": "^8.4.7",
"@storybook/blocks": "^8.4.7",
"@storybook/preview-api": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-vite": "^8.4.7",
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "8.5.0",
"@typescript-eslint/parser": "8.5.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.16.0",
"eslint-plugin-mui-path-imports": "^0.0.15",
"eslint-plugin-perfectionist": "^3.5.0",
"eslint-plugin-storybook": "^0.8.0",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-is": "^18.3.1",
"eslint-plugin-perfectionist": "^4.3.0",
"eslint-plugin-storybook": "^0.11.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-is": "^19.0.0",
"rollup": "^2.79.1",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-delete": "^2.1.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"size-limit": "^11.1.5",
"storybook": "^8.3.0",
"size-limit": "^11.1.6",
"storybook": "^8.4.7",
"storybook-dark-mode": "^4.0.2",
"tslib": "^2.7.0",
"typescript": "^5.6.2",
"vite": "^5.4.4"
"tslib": "^2.8.1",
"typescript": "5.6.2",
"vite": "^6.0.3"
},
"peerDependencies": {
"@emotion/react": ">=11.13",
Expand All @@ -116,7 +115,7 @@
"dependencies": {
"@tanstack/match-sorter-utils": "8.19.4",
"@tanstack/react-table": "8.20.5",
"@tanstack/react-virtual": "3.10.9",
"@tanstack/react-virtual": "3.11.1",
"highlight-words": "2.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface MRT_TableBodyCellProps<TData extends MRT_RowData>
extends TableCellProps {
cell: MRT_Cell<TData>;
numRows?: number;
rowRef: RefObject<HTMLTableRowElement>;
rowRef: RefObject<HTMLTableRowElement | null>;
staticColumnIndex?: number;
staticRowIndex: number;
table: MRT_TableInstance<TData>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const allowedTypes = ['string', 'number'];

export interface MRT_TableBodyCellValueProps<TData extends MRT_RowData> {
cell: MRT_Cell<TData>;
rowRef?: RefObject<HTMLTableRowElement>;
rowRef?: RefObject<HTMLTableRowElement | null>;
staticColumnIndex?: number;
staticRowIndex?: number;
table: MRT_TableInstance<TData>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
export interface MRT_TableBodyRowGrabHandleProps<TData extends MRT_RowData>
extends IconButtonProps {
row: MRT_Row<TData>;
rowRef: RefObject<HTMLTableRowElement>;
rowRef: RefObject<HTMLTableRowElement | null>;
table: MRT_TableInstance<TData>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseFromValuesOrFunc } from '../../utils/utils';

export interface MRT_TableDetailPanelProps<TData extends MRT_RowData>
extends TableCellProps {
parentRowRef: RefObject<HTMLTableRowElement>;
parentRowRef: RefObject<HTMLTableRowElement | null>;
row: MRT_Row<TData>;
rowVirtualizer?: MRT_RowVirtualizer;
staticRowIndex: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const MRT_EditActionButtons = <TData extends MRT_RowData>({

const handleSubmitRow = () => {
//look for auto-filled input values
Object.values(editInputRefs?.current)
Object.values(editInputRefs.current ?? {})
.filter((inputRef) => row.id === inputRef?.name?.split('_')?.[0])
?.forEach((input) => {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
onDragOver={handleDragOver}
ref={(node: HTMLTableCellElement) => {
if (node) {
tableHeadCellRefs.current[column.id] = node;
tableHeadCellRefs.current![column.id] = node;
if (columnDefType !== 'group') {
columnVirtualizer?.measureElement?.(node);
}
Expand Down Expand Up @@ -319,7 +319,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
column={column}
table={table}
tableHeadCellRef={{
current: tableHeadCellRefs.current[column.id],
current: tableHeadCellRefs.current?.[column.id]!,
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export const MRT_TableHeadCellFilterLabel = <TData extends MRT_RowData = {}>({
setShowColumnFilters(true);
}
queueMicrotask(() => {
filterInputRefs.current[`${column.id}-0`]?.focus?.();
filterInputRefs.current[`${column.id}-0`]?.select?.();
filterInputRefs.current?.[`${column.id}-0`]?.focus?.();
filterInputRefs.current?.[`${column.id}-0`]?.select?.();
});
event.stopPropagation();
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface MRT_TableHeadCellGrabHandleProps<TData extends MRT_RowData>
extends IconButtonProps {
column: MRT_Column<TData>;
table: MRT_TableInstance<TData>;
tableHeadCellRef: RefObject<HTMLTableCellElement>;
tableHeadCellRef: RefObject<HTMLTableCellElement | null>;
}

export const MRT_TableHeadCellGrabHandle = <TData extends MRT_RowData>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
const handleEnterKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
textFieldProps.onKeyDown?.(event);
if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
editInputRefs.current[column.id]?.blur();
editInputRefs.current?.[column.id]?.blur();
}
};

Expand All @@ -110,7 +110,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
fullWidth
inputRef={(inputRef) => {
if (inputRef) {
editInputRefs.current[column.id] = inputRef;
editInputRefs.current![column.id] = inputRef;
if (textFieldProps.inputRef) {
textFieldProps.inputRef = inputRef;
}
Expand Down
Loading

0 comments on commit c7adbf8

Please sign in to comment.