Skip to content

Commit d280e43

Browse files
[WC-3065]: Update to React 19 (#1910)
2 parents 5a5008d + b7de02a commit d280e43

File tree

590 files changed

+9240
-7866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

590 files changed

+9240
-7866
lines changed

package.json

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,86 @@
11
{
22
"name": "web-widgets",
33
"copyright": "© Mendix Technology BV 2025. All rights reserved.",
4+
"license": "Apache-2.0",
45
"repository": {
56
"type": "git",
67
"url": "https://github.com/mendix/web-widgets.git"
78
},
8-
"license": "Apache-2.0",
99
"scripts": {
10-
"prepare": "husky install",
11-
"lint": "turbo run lint --continue --concurrency 1",
12-
"test": "turbo run test --continue --concurrency 1",
13-
"verify": "turbo run verify --continue --concurrency 1",
1410
"build": "turbo run build",
15-
"release": "turbo run release",
11+
"changelog": "pnpm --filter @mendix/automation-utils run changelog",
1612
"create-gh-release": "turbo run create-gh-release --concurrency 1",
1713
"create-translation": "turbo run create-translation",
18-
"publish-marketplace": "turbo run publish-marketplace",
19-
"version": "pnpm --filter @mendix/automation-utils run version",
20-
"changelog": "pnpm --filter @mendix/automation-utils run changelog",
14+
"postinstall": "turbo run agent-rules",
15+
"lint": "turbo run lint --continue --concurrency 1",
16+
"prepare": "husky install",
2117
"prepare-release": "pnpm --filter @mendix/automation-utils run prepare-release",
22-
"postinstall": "turbo run agent-rules"
18+
"publish-marketplace": "turbo run publish-marketplace",
19+
"release": "turbo run release",
20+
"test": "turbo run test --continue --concurrency 1",
21+
"verify": "turbo run verify --continue --concurrency 1",
22+
"version": "pnpm --filter @mendix/automation-utils run version"
2323
},
2424
"devDependencies": {
2525
"husky": "^8.0.3",
2626
"turbo": "^2.5.4"
2727
},
28+
"prettier": "@mendix/prettier-config-web-widgets",
29+
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
2830
"engines": {
2931
"node": ">=22",
3032
"pnpm": "10.17.0"
3133
},
32-
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
3334
"pnpm": {
3435
"peerDependencyRules": {
3536
"allowedVersions": {
36-
"react": "^18.0.0",
37-
"react-dom": "^18.0.0"
37+
"react": ">=18.0.0 <19.0.0",
38+
"react-dom": ">=18.0.0 <19.0.0"
3839
},
3940
"ignoreMissing": [
4041
"react-native"
4142
]
4243
},
44+
"onlyBuiltDependencies": [
45+
"@swc/core",
46+
"canvas"
47+
],
4348
"overrides": {
49+
"@codemirror/state": "^6.5.2",
50+
"@codemirror/view": "^6.38.1",
4451
"@mendix/pluggable-widgets-tools": "10.21.2",
45-
"react": "^18.0.0",
46-
"react-dom": "^18.0.0",
47-
"prettier": "3.5.3",
52+
"@types/big.js": "^6.2.2",
4853
"@types/node": "~22.14.0",
4954
"@types/react": ">=18.2.36",
50-
"@types/big.js": "^6.2.2",
5155
"d3-color@<3.1.0": ">=3.1.0",
52-
"loader-utils@1": "^1.4.2",
53-
"loader-utils@3": "^3.2.1",
5456
"decode-uri-component@<0.2.1": ">=0.2.1",
57+
"enzyme>cheerio": "1.0.0-rc.10",
5558
"jest": "^29.7.0",
5659
"jest-environment-jsdom": "^29.7.0",
57-
"json5@1.x": ">=1.0.2",
5860
"json5@0.x": ">=1.0.2",
59-
"@codemirror/view": "^6.38.1",
60-
"@codemirror/state": "^6.5.2",
61-
"enzyme>cheerio": "1.0.0-rc.10",
62-
"ts-node": "10.9.2",
61+
"json5@1.x": ">=1.0.2",
62+
"loader-utils@1": "^1.4.2",
63+
"loader-utils@3": "^3.2.1",
64+
"prettier": "3.5.3",
65+
"react": ">=18.0.0 <19.0.0",
6366
"react-big-calendar@1>clsx": "2.1.1",
67+
"react-dom": ">=18.0.0 <19.0.0",
68+
"rollup": "catalog:",
69+
"ts-node": "10.9.2",
6470
"typescript": ">5.8.0"
6571
},
6672
"patchedDependencies": {
67-
"react-big-calendar@0.19.2": "patches/react-big-calendar@0.19.2.patch",
68-
"mobx@6.12.3": "patches/mobx@6.12.3.patch",
69-
"mobx-react-lite@4.0.7": "patches/mobx-react-lite@4.0.7.patch",
7073
"mime-types": "patches/mime-types.patch",
74+
"mobx-react-lite@4.0.7": "patches/mobx-react-lite@4.0.7.patch",
75+
"mobx@6.12.3": "patches/mobx@6.12.3.patch",
7176
"rc-trigger": "patches/rc-trigger.patch",
77+
"react-big-calendar@0.19.2": "patches/react-big-calendar@0.19.2.patch",
7278
"react-dropzone": "patches/react-dropzone.patch"
7379
},
74-
"onlyBuiltDependencies": [
75-
"@swc/core",
76-
"canvas"
77-
],
7880
"ignoredBuiltDependencies": [
7981
"@parcel/watcher",
8082
"core-js",
8183
"es5-ext"
8284
]
83-
},
84-
"prettier": "@mendix/prettier-config-web-widgets"
85+
}
8586
}

packages/customWidgets/calendar-custom-web/src/components/Calendar.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, createElement, CSSProperties, ReactChild, ReactNode } from "react";
1+
import { Component, createElement, CSSProperties, ReactNode } from "react";
22

33
import { Alert } from "./Alert";
44
import { Container, Style } from "../utils/namespaces";
@@ -20,18 +20,18 @@ const localizer = BigCalendar.momentLocalizer(moment);
2020
const DragAndDropCalendar = withDragAndDrop(BigCalendar);
2121

2222
export interface CalendarProps {
23-
alertMessage?: ReactChild;
23+
alertMessage?: ReactNode;
2424
className?: string;
2525
events: CalendarEvent[];
2626
color?: string;
27-
formats?: {};
27+
formats?: object;
2828
enableCreate: boolean;
2929
height: number;
3030
heightUnit: Style.HeightUnitType;
3131
defaultView: Style.View;
3232
loading?: boolean;
3333
startPosition?: Date;
34-
messages: {};
34+
messages: object;
3535
editable: string;
3636
titleFormat?: (date: Date) => void;
3737
weekdayFormat?: (date: Date) => void;
@@ -141,7 +141,7 @@ class Calendar extends Component<CalendarProps, State> {
141141

142142
private renderCalendar(): ReactNode {
143143
const wrapToolbar =
144-
(injectedProps: HOCToolbarProps): Function =>
144+
(injectedProps: HOCToolbarProps): ((toolbarProps: Container.ToolbarProps) => void) =>
145145
(toolbarProps: Container.ToolbarProps) =>
146146
createElement(CustomToolbar as any, { ...injectedProps, ...toolbarProps });
147147

packages/customWidgets/calendar-custom-web/src/utils/validation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Container } from "./namespaces";
2-
import { createElement, ReactChild } from "react";
2+
import { createElement, ReactNode } from "react";
33

4-
export function validateProps(props: Container.CalendarContainerProps): ReactChild {
4+
export function validateProps(props: Container.CalendarContainerProps): ReactNode {
55
const errorMessages: string[] = [];
66

77
if (props.onClickEvent === "callMicroflow" && !props.onClickMicroflow) {
@@ -53,7 +53,7 @@ export function validateProps(props: Container.CalendarContainerProps): ReactChi
5353
return "";
5454
}
5555

56-
export function validateCustomFormats(props: Container.CalendarContainerProps): ReactChild {
56+
export function validateCustomFormats(props: Container.CalendarContainerProps): ReactNode {
5757
const errorMessages: string[] = [];
5858

5959
try {
@@ -68,7 +68,7 @@ export function validateCustomFormats(props: Container.CalendarContainerProps):
6868
window.mx.parser.formatValue(date, "datetime", { datePattern: customView.gutterTimeFormat });
6969
});
7070
}
71-
} catch (error) {
71+
} catch (_error) {
7272
errorMessages.push(`${props.friendlyId}: Invalid format value`);
7373
}
7474
if (errorMessages.length) {
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { createElement, FC, PropsWithChildren } from "react";
1+
import { FC, PropsWithChildren } from "react";
22
import classNames from "classnames";
33

44
export interface AlertProps extends PropsWithChildren {
55
bootstrapStyle?: "default" | "primary" | "success" | "info" | "warning" | "danger";
66
className?: string;
77
}
88

9-
export const Alert: FC<AlertProps> = ({ bootstrapStyle, className, children }) =>
9+
export const Alert: FC<AlertProps> = ({ bootstrapStyle = "danger", className, children }) =>
1010
children ? <div className={classNames(`alert alert-${bootstrapStyle}`, className)}>{children}</div> : null;
1111

1212
Alert.displayName = "Alert";
13-
Alert.defaultProps = { bootstrapStyle: "danger" };

packages/customWidgets/signature-web/src/components/Grid.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createElement, FC } from "react";
1+
import { FC } from "react";
22

33
export interface GridBackgroundProps {
44
gridCellWidth: number;
@@ -12,7 +12,7 @@ export const Grid: FC<GridBackgroundProps> = ({
1212
gridCellHeight,
1313
gridBorderColor,
1414
gridBorderWidth,
15-
showGrid
15+
showGrid = true
1616
}) => {
1717
const id = `grid${Math.floor(Math.random() * 1000000)}`;
1818
return showGrid ? (
@@ -43,4 +43,3 @@ export const Grid: FC<GridBackgroundProps> = ({
4343
};
4444

4545
Grid.displayName = "Grid";
46-
Grid.defaultProps = { showGrid: true };

packages/customWidgets/signature-web/src/components/Signature.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createElement, PureComponent, ReactNode } from "react";
1+
import { PureComponent, ReactNode } from "react";
22

3-
// @ts-ignore
3+
// @ts-expect-error signature_pad has no types
44
import SignaturePad, { IOptions } from "signature_pad";
55
import classNames from "classnames";
66
import ReactResizeDetector from "react-resize-detector";
@@ -31,7 +31,7 @@ export type penOptions = "fountain" | "ballpoint" | "marker";
3131

3232
export class Signature extends PureComponent<SignatureProps> {
3333
private canvasNode: HTMLCanvasElement | null = null;
34-
// @ts-expect-error
34+
// @ts-expect-error signature_pad has no types
3535
private signaturePad: SignaturePad;
3636

3737
render(): ReactNode {
@@ -48,7 +48,9 @@ export class Signature extends PureComponent<SignatureProps> {
4848
<Grid {...this.props} />
4949
<canvas
5050
className="widget-signature-canvas"
51-
ref={(node: HTMLCanvasElement) => (this.canvasNode = node)}
51+
ref={(node: HTMLCanvasElement | null): void => {
52+
this.canvasNode = node;
53+
}}
5254
/>
5355
<ReactResizeDetector handleWidth handleHeight onResize={this.onResize} />
5456
</SizeContainer>

packages/customWidgets/signature-web/src/components/SizeContainer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const SizeContainer: FC<SizeProps> = ({
2828
height,
2929
children,
3030
style,
31-
readOnly
31+
readOnly = false
3232
}) => {
3333
const styleWidth = widthUnit === "percentage" ? `${width}%` : `${width}px`;
3434
return createElement(
@@ -62,7 +62,6 @@ export const SizeContainer: FC<SizeProps> = ({
6262
};
6363

6464
SizeContainer.displayName = "SizeContainer";
65-
SizeContainer.defaultProps = { readOnly: false };
6665

6766
const getHeight = (
6867
heightUnit: HeightUnitType,

packages/customWidgets/signature-web/src/components/__tests__/Alert.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { shallow, ShallowWrapper } from "enzyme";
2-
import { createElement, ReactChild } from "react";
2+
import { createElement, ReactNode } from "react";
33

44
import { Alert, AlertProps } from "../Alert";
55

66
describe("Alert", () => {
7-
const renderAlert = (props: AlertProps, message: ReactChild): ShallowWrapper<AlertProps, any> =>
7+
const renderAlert = (props: AlertProps, message: ReactNode): ShallowWrapper<AlertProps, any> =>
88
shallow(createElement(Alert, props, message));
99
const alertMessage = "This is an error";
1010

packages/customWidgets/signature-web/src/components/__tests__/Signature.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("Signature", () => {
4141
});
4242
const canvasInstance: any = canvas.instance();
4343
canvasInstance.canvasNode = document.createElement("canvas");
44-
const signaturePadOptions = spyOn(canvasInstance, "signaturePadOptions").and.callThrough();
44+
const signaturePadOptions = jest.spyOn(canvasInstance, "signaturePadOptions");
4545
canvasInstance.componentDidMount();
4646
expect(signaturePadOptions).toHaveBeenCalled();
4747
});

packages/customWidgets/signature-web/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"noUnusedParameters": true,
2121
"allowSyntheticDefaultImports": true,
2222
"esModuleInterop": true,
23-
"jsx": "react",
24-
"jsxFactory": "createElement"
23+
"jsx": "react-jsx"
2524
},
2625
"files": ["./node_modules/mendix-client/index.d.ts"],
2726
"include": ["./src", "./typings"],

0 commit comments

Comments
 (0)