UPDATE: Update to React 19.0.0

Diverse fixes
This commit is contained in:
Nicolás Hatcher
2025-02-02 22:48:12 +01:00
committed by Nicolás Hatcher Andrés
parent 8a54f45d75
commit d866e283e9
15 changed files with 698 additions and 697 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,12 @@
{
"name": "@ironcalc/workbook",
"version": "0.3.1",
"version": "0.3.2",
"type": "module",
"main": "./dist/ironcalc.js",
"module": "./dist/ironcalc.js",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "vite build && tsc",
"check": "biome check ./src",
"check-write": "biome check --write ./src",
@@ -27,19 +26,19 @@
"react-i18next": "^15.4.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@biomejs/biome": "1.9.4",
"@chromatic-com/storybook": "^3.2.4",
"@storybook/addon-essentials": "^8.6.0-alpha.0",
"@storybook/addon-interactions": "^8.6.0-alpha.0",
"@storybook/addon-onboarding": "^8.6.0-alpha.0",
"@storybook/blocks": "^8.6.0-alpha.0",
"@storybook/react": "^8.6.0-alpha.0",
"@storybook/react-vite": "^8.6.0-alpha.0",
"@storybook/test": "^8.6.0-alpha.0",
"@storybook/addon-essentials": "^8.5.3",
"@storybook/addon-interactions": "^8.5.3",
"@storybook/addon-onboarding": "^8.5.3",
"@storybook/blocks": "^8.5.3",
"@storybook/react": "^8.5.3",
"@storybook/react-vite": "^8.5.3",
"@storybook/test": "^8.5.3",
"@vitejs/plugin-react": "^4.2.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"storybook": "^8.6.0-alpha.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"storybook": "^8.5.3",
"ts-node": "^10.9.2",
"typescript": "~5.6.2",
"vite": "^6.0.5",
@@ -47,9 +46,9 @@
"vitest": "^2.0.5"
},
"peerDependencies": {
"@types/react": "^18.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"@types/react": "^18.0.0 || ^19.0.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"files": [
"dist"

View File

@@ -26,7 +26,7 @@ function SheetTab(props: SheetTabProps) {
const { name, color, selected, workbookState, onSelected } = props;
const [anchorEl, setAnchorEl] = useState<null | HTMLButtonElement>(null);
const [colorPickerOpen, setColorPickerOpen] = useState(false);
const colorButton = useRef(null);
const colorButton = useRef<HTMLDivElement>(null);
const open = Boolean(anchorEl);
const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
@@ -57,12 +57,12 @@ function SheetTab(props: SheetTabProps) {
<TabWrapper
$color={color}
$selected={selected}
onClick={(event) => {
onClick={(event: React.MouseEvent) => {
onSelected();
event.stopPropagation();
event.preventDefault();
}}
onPointerDown={(event) => {
onPointerDown={(event: React.PointerEvent) => {
// If it is in browse mode stop he event
const cell = workbookState.getEditingCell();
if (cell && isInReferenceMode(cell.text, cell.cursorStart)) {

View File

@@ -28,7 +28,7 @@ type BorderPickerProps = {
className?: string;
onChange: (border: BorderOptions) => void;
onClose: () => void;
anchorEl: React.RefObject<HTMLElement>;
anchorEl: React.RefObject<HTMLElement | null>;
anchorOrigin?: PopoverOrigin;
transformOrigin?: PopoverOrigin;
open: boolean;

View File

@@ -10,7 +10,7 @@ type ColorPickerProps = {
color: string;
onChange: (color: string) => void;
onClose: () => void;
anchorEl: React.RefObject<HTMLElement>;
anchorEl: React.RefObject<HTMLElement | null>;
anchorOrigin?: PopoverOrigin;
transformOrigin?: PopoverOrigin;
open: boolean;

View File

@@ -9,7 +9,7 @@ interface Options {
onEditEnd: () => void;
onTextUpdated: () => void;
workbookState: WorkbookState;
textareaRef: RefObject<HTMLTextAreaElement>;
textareaRef: RefObject<HTMLTextAreaElement | null>;
}
export const useKeyDown = (

View File

@@ -5,6 +5,7 @@ import {
type TokenType,
getTokens,
} from "@ironcalc/wasm";
import type { JSX } from "react";
import type { ActiveRange } from "../workbookState";
function sliceString(

View File

@@ -32,7 +32,7 @@ interface Options {
onNextSheet: () => void;
onPreviousSheet: () => void;
onEscape: () => void;
root: RefObject<HTMLDivElement>;
root: RefObject<HTMLDivElement | null>;
}
// # IronCalc Keyboard accessibility:

View File

@@ -11,9 +11,9 @@ import { rangeToStr } from "./util";
import type { WorkbookState } from "./workbookState";
interface PointerSettings {
canvasElement: RefObject<HTMLCanvasElement>;
canvasElement: RefObject<HTMLCanvasElement | null>;
worksheetCanvas: RefObject<WorksheetCanvas | null>;
worksheetElement: RefObject<HTMLDivElement>;
worksheetElement: RefObject<HTMLDivElement | null>;
onCellSelected: (cell: Cell, event: React.MouseEvent) => void;
onAreaSelecting: (cell: Cell) => void;
onAreaSelected: () => void;

View File

@@ -29,7 +29,7 @@ import Worksheet from "./worksheet";
const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
const { model, workbookState } = props;
const rootRef = useRef<HTMLDivElement>(null);
const rootRef = useRef<HTMLDivElement | null>(null);
// Calling `setRedrawId((id) => id + 1);` forces a redraw
// This is needed because `model` or `workbookState` can change without React being aware of it
@@ -350,7 +350,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
ref={rootRef}
onKeyDown={onKeyDown}
tabIndex={0}
onClick={(event) => {
onClick={(event: React.MouseEvent) => {
if (!workbookState.getEditingCell()) {
focusWorkbook();
} else {