Skip to content

Commit 0944549

Browse files
authored
Merge pull request #335 from eccenca/change/upgradedToReact18-CMEM-6639
Upgrade to react18 CMEM-6639
2 parents 319d2b9 + 288520f commit 0944549

98 files changed

Lines changed: 520 additions & 363 deletions

File tree

Some content is hidden

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

.github/workflows/publish-featurefix-prerelease.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "fix/*"
99
- "bugfix/*"
1010
- "hotfix/*"
11+
- "change/*"
1112
inputs:
1213
confirmation:
1314
description: "Create feature tag and publish package"
@@ -28,7 +29,7 @@ jobs:
2829
uses: tj-actions/branch-names@v8
2930
- name: Allow only for feature/fix branches
3031
run: |
31-
if [[ ! ${{ steps.branch-name.outputs.current_branch }} =~ ^(feature|fix|bugfix|hotfix)\/ ]] ;
32+
if [[ ! ${{ steps.branch-name.outputs.current_branch }} =~ ^(feature|fix|bugfix|hotfix|change)\/ ]] ;
3233
then
3334
echo "Only allowed to get triggered on feature and fix branches!"
3435
echo "You started it on '${{ steps.branch-name.outputs.current_branch }}'."

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,37 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- `<NotAvailable />`
12+
- simple placeholder element that can be used to display info about missing data
13+
- `<ContentBlobToggler />`
14+
- `forceInline` property: force inline rendering
15+
- `<ContextMenu />`
16+
- `togglerSize`: replaces the deprecated `togglerLarge` property
17+
- `<MultiSelect />`
18+
- `searchListPredicate` property: Allows to filter the complete list of search options at once.
19+
- Following optional BlueprintJs properties are forwarded now to override default behaviour: `noResults`, `createNewItemRenderer` and `itemRenderer`
20+
- `isValidNewOption` property: Checks if an input string is or can be turned into a valid new option.
21+
22+
### Fixed
23+
24+
- `<MultiSelect />`
25+
- border of the BlueprintJS `Tag` elements were fixed
26+
27+
### Changed
28+
29+
- **React and its types were updated to v18, so you may hit incompatibilities if you run it with React 16 or 17.**
30+
- `<MultiSelect />`
31+
- by default, if no searchPredicate or searchListPredicate is defined, the filtering is done via case-insensitive multi-word filtering.
32+
33+
### Deprecated
34+
35+
- `<ContextMenu />`
36+
- `togglerLarge`: replaced by the more versatile `togglerSize` property
37+
- `<MultiSelect />`
38+
- `searchPredicate`: replaced by the -- in some cases -- more efficient `searchListPredicate`
39+
940
## [25.2.0] - 2026-04-30
1041

1142
### Added

eslint.config.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ const compat = new FlatCompat({
1717
allConfig: js.configs.all
1818
});
1919

20-
export default [...compat.extends(
20+
const base = compat.extends(
2121
"eslint:recommended",
2222
"plugin:@typescript-eslint/eslint-recommended",
2323
"plugin:@typescript-eslint/recommended",
24-
), {
24+
);
25+
26+
export default [...base, {
2527
plugins: {
2628
"@typescript-eslint": typescriptEslint,
2729
react,
@@ -31,6 +33,9 @@ export default [...compat.extends(
3133

3234
languageOptions: {
3335
parser: tsParser,
36+
globals: {
37+
window: "readonly",
38+
}
3439
},
3540

3641
rules: {
@@ -54,4 +59,4 @@ export default [...compat.extends(
5459

5560
"no-console": "error",
5661
},
57-
}];
62+
}];

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
"lodash": "^4.18.1",
9393
"n3": "^1.26.0",
9494
"re-resizable": "^6.10.3",
95-
"react": "^16.13.1",
96-
"react-dom": "^16.14.0",
95+
"react": "^18.2.0",
96+
"react-dom": "^18.2.0",
9797
"react-flow-renderer": "9.7.4",
9898
"react-inlinesvg": "^3.0.3",
9999
"react-is": "^16.13.1",
@@ -132,7 +132,7 @@
132132
"@storybook/react-webpack5": "^8.6.18",
133133
"@storybook/test": "^8.6.18",
134134
"@testing-library/jest-dom": "^6.9.1",
135-
"@testing-library/react": "^12.1.5",
135+
"@testing-library/react": "^14.3.1",
136136
"@types/color": "^3.0.6",
137137
"@types/he": "^1.2.3",
138138
"@types/jest": "^30.0.0",
@@ -153,6 +153,7 @@
153153
"identity-obj-proxy": "^3.0.0",
154154
"jest": "^30.2.0",
155155
"jest-environment-jsdom": "^30.2.0",
156+
"jest-fixed-jsdom": "^0.0.11",
156157
"jest-pnp-resolver": "^1.2.3",
157158
"lint-staged": "^15.5.2",
158159
"node-sass-package-importer": "^5.3.3",
@@ -177,10 +178,9 @@
177178
},
178179
"peerDependencies": {
179180
"@blueprintjs/core": ">=5",
180-
"react": ">=16"
181+
"react": ">=18"
181182
},
182183
"resolutions": {
183-
"**/@types/react": "^17.0.90",
184184
"node-sass-package-importer/**/postcss": "^8.5.6",
185185
"string-width": "^4.2.3",
186186
"wrap-ansi": "^7.0.0",
@@ -231,7 +231,7 @@
231231
"testMatch": [
232232
"<rootDir>/src/**/*(*.)@(spec|test).{js,jsx,ts,tsx}"
233233
],
234-
"testEnvironment": "jest-environment-jsdom",
234+
"testEnvironment": "jest-fixed-jsdom",
235235
"transform": {
236236
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest"
237237
},

src/cmem/ActivityControl/ActivityControlWidget.stories.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@ import { OverlaysProvider } from "@blueprintjs/core";
44
import { Meta, StoryFn } from "@storybook/react";
55

66
import { helpersArgTypes } from "../../../.storybook/helpers";
7-
import {
8-
ActivityControlWidget,
9-
ActivityControlWidgetAction,
10-
IconButton,
11-
SimpleDialog,
12-
Tag,
13-
TagList,
14-
} from "../../../index";
7+
import { IconButton, SimpleDialog, Tag, TagList } from "../../components";
8+
9+
import { ActivityControlWidget, ActivityControlWidgetAction } from "./ActivityControlWidget";
1510

1611
export default {
1712
title: "Cmem/ActivityControlWidget",

src/cmem/ActivityControl/ActivityControlWidget.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import React from "react";
22

3-
import {ValidIconName} from "../../components/Icon/canonicalIconNames";
4-
import {IconProps} from "../../components/Icon/Icon";
5-
import {TestIconProps} from "../../components/Icon/TestIcon";
6-
import {TestableComponent} from "../../components/interfaces";
7-
import {ProgressBarProps} from "../../components/ProgressBar/ProgressBar";
8-
import {SpinnerProps} from "../../components/Spinner/Spinner";
9-
import {CLASSPREFIX as eccgui} from "../../configuration/constants";
103
import {
114
Card,
125
ContextMenu,
@@ -24,22 +17,29 @@ import {
2417
ProgressBar,
2518
Spinner,
2619
Tooltip,
27-
} from "../../index";
20+
} from "../../components";
21+
import { ValidIconName } from "../../components/Icon/canonicalIconNames";
22+
import { IconProps } from "../../components/Icon/Icon";
23+
import { TestIconProps } from "../../components/Icon/TestIcon";
24+
import { TestableComponent } from "../../components/interfaces";
25+
import { ProgressBarProps } from "../../components/ProgressBar/ProgressBar";
26+
import { SpinnerProps } from "../../components/Spinner/Spinner";
27+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
2828

2929
export interface ActivityControlWidgetProps extends TestableComponent {
3030
/**
3131
* The label to be shown
3232
*/
33-
label?: string | JSX.Element;
33+
label?: string | React.JSX.Element;
3434
/**
3535
* Element that wraps around the label.
3636
* Default: `<OverflowText inline={true} />`
3737
*/
38-
labelWrapper?: JSX.Element;
38+
labelWrapper?: React.JSX.Element;
3939
/**
4040
* To add tags in addition to the widget status description
4141
*/
42-
tags?: JSX.Element;
42+
tags?: React.JSX.Element;
4343
/**
4444
* The progress bar parameters if it should be show by a progres bar
4545
*/
@@ -83,7 +83,7 @@ export interface ActivityControlWidgetProps extends TestableComponent {
8383
/**
8484
* execution timer messages for waiting and running times.
8585
*/
86-
timerExecutionMsg?: JSX.Element | null;
86+
timerExecutionMsg?: React.JSX.Element | null;
8787
/**
8888
* additional actions that can serve as a complex component, positioned between the default actions and the context menu
8989
*/
@@ -159,7 +159,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
159159
keepColors
160160
>
161161
{progressSpinnerFinishedIcon ? (
162-
React.cloneElement(progressSpinnerFinishedIcon as JSX.Element, { small, large: !small })
162+
React.cloneElement(progressSpinnerFinishedIcon as React.JSX.Element, { small, large: !small })
163163
) : (
164164
<Spinner
165165
position="inline"

src/cmem/ActivityControl/ActivityExecutionErrorReportModal.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import React, { useState } from "react";
2-
3-
import { Button, HtmlContentBlock, IconButton, SimpleDialog } from "../../index";
1+
import React, {useState} from "react";
2+
import SimpleDialog from "../../components/Dialog/SimpleDialog";
3+
import IconButton from "../../components/Icon/IconButton";
4+
import Button from "../../components/Button/Button";
5+
import HtmlContentBlock from "../../components/Typography/HtmlContentBlock";
46

57
interface ActivityExecutionErrorReportModalProps {
68
// Title of the modal
79
title?: string;
810
// Called when the close button is clicked
911
onDiscard: () => any;
1012
// The error report
11-
report: JSX.Element;
13+
report: React.JSX.Element;
1214
// Value of the download button
1315
downloadButtonValue: string;
1416
// Value of the close button

src/cmem/ActivityControl/SilkActivityControl.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const progressBreakpointAnimation = 99;
1515

1616
export interface SilkActivityControlProps extends TestableComponent {
1717
// The label of this activity
18-
label: string | JSX.Element;
18+
label: string | React.JSX.Element;
1919
/**
2020
* To add tags in addition to the widget status description
2121
*/
22-
tags?: JSX.Element;
22+
tags?: React.JSX.Element;
2323
// Initial state
2424
initialStatus?: SilkActivityStatusProps;
2525
// Register a function in order to receive callbacks
@@ -80,7 +80,7 @@ export interface SilkActivityControlLayoutProps {
8080
// what type of progrss display should be uses, horizontal progress bar, circular spinner, or none of that
8181
visualization?: "none" | "progressbar" | "spinner";
8282
// wrapper around label
83-
labelWrapper?: JSX.Element;
83+
labelWrapper?: React.JSX.Element;
8484
}
8585

8686
const defaultLayout: SilkActivityControlLayoutProps = {
@@ -94,7 +94,7 @@ interface IErrorReportAction {
9494
// The title of the error report modal
9595
title?: string;
9696
// The element that will be rendered in the modal, either as Markdown or object
97-
renderReport: (report: string | SilkActivityExecutionReportProps) => JSX.Element;
97+
renderReport: (report: string | SilkActivityExecutionReportProps) => React.JSX.Element;
9898
// What version of the report should be handed to the renderReport function, if false SilkActivityExecutionReportProps, if true the Markdown string
9999
renderMarkdown: boolean;
100100
// The function to fetch the error report. It returns undefined if something went wrong.

src/cmem/ContentBlobToggler/ContentBlobToggler.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useState } from "react";
22

3-
import { Link, Spacing } from "../../index";
3+
import Link from "../../components/Link/Link";
4+
import Spacing from "../../components/Separation/Spacing";
5+
import InlineText from "../../components/Typography/InlineText";
46

57
export interface ContentBlobTogglerProps extends React.HTMLAttributes<HTMLDivElement> {
68
/**
@@ -31,6 +33,10 @@ export interface ContentBlobTogglerProps extends React.HTMLAttributes<HTMLDivEle
3133
Callback if toggler is necessary. Default: true
3234
*/
3335
enableToggler?: boolean;
36+
/**
37+
* Force always inline rendering.
38+
*/
39+
forceInline?: boolean;
3440
}
3541

3642
/** Shows a preview with the option to expand to a full view (and back). */
@@ -42,27 +48,29 @@ export function ContentBlobToggler({
4248
fullviewContent,
4349
startExtended = false,
4450
enableToggler = true,
51+
forceInline = false,
4552
...otherProps
4653
}: ContentBlobTogglerProps) {
4754
const [isExtended, setViewState] = useState(startExtended);
48-
const handlerToggleView = (event: any) => {
55+
const handlerToggleView = (event: React.MouseEvent<HTMLAnchorElement>) => {
4956
event.preventDefault();
5057
event.stopPropagation();
5158
setViewState(!isExtended);
5259
};
5360

54-
return (
61+
const tooglerDisplay = (
5562
<div className={className} {...otherProps}>
5663
{!isExtended ? (
5764
<>
5865
{previewContent}
5966
{enableToggler && (
6067
<>
61-
{" "}&hellip;{" "}
68+
{" "}
69+
&hellip;{" "}
6270
<Link
6371
href="#more"
6472
data-test-id={"content-blob-toggler-more-link"}
65-
onClick={(e: any) => {
73+
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
6674
handlerToggleView(e);
6775
}}
6876
>
@@ -76,11 +84,11 @@ export function ContentBlobToggler({
7684
{fullviewContent}
7785
{enableToggler && (
7886
<div>
79-
<Spacing size="small" />
87+
{forceInline ? <> </> : <Spacing size="small" />}
8088
<Link
8189
data-test-id={"content-blob-toggler-less-link"}
8290
href="#less"
83-
onClick={(e: any) => {
91+
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
8492
handlerToggleView(e);
8593
}}
8694
>
@@ -92,4 +100,6 @@ export function ContentBlobToggler({
92100
)}
93101
</div>
94102
);
103+
104+
return forceInline ? <InlineText>{tooglerDisplay}</InlineText> : tooglerDisplay;
95105
}

src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from "react";
2+
import {ContentBlobToggler, ContentBlobTogglerProps} from "./ContentBlobToggler";
3+
import {Markdown} from "../markdown/Markdown";
4+
import {utils} from "../../common";
5+
import InlineText from "../../components/Typography/InlineText";
26

3-
import { ContentBlobToggler, ContentBlobTogglerProps, InlineText, Markdown, utils } from "./../../index";
47

58
export interface StringPreviewContentBlobTogglerProps
69
extends Omit<ContentBlobTogglerProps, "previewContent" | "enableToggler"> {
@@ -31,7 +34,7 @@ export interface StringPreviewContentBlobTogglerProps
3134
* Allows to add non-string elements at the end of the content if the full description is shown, i.e. no toggler is necessary.
3235
* This allows to add non-string elements to both the full-view content and the pure string content.
3336
*/
34-
noTogglerContentSuffix?: JSX.Element;
37+
noTogglerContentSuffix?: React.JSX.Element;
3538
/**
3639
* If only the first non-empty line should be shown in the preview.
3740
* This will in addition also be shortened according to `previewMaxLength`.
@@ -54,6 +57,7 @@ export function StringPreviewContentBlobToggler({
5457
allowedHtmlElementsInPreview,
5558
noTogglerContentSuffix,
5659
firstNonEmptyLineOnly,
60+
...otherContentBlobTogglerProps
5761
}: StringPreviewContentBlobTogglerProps) {
5862
// need to test `firstNonEmptyLineOnly` until property is removed
5963
const useOnlyTest: StringPreviewContentBlobTogglerProps["useOnly"] = firstNonEmptyLineOnly
@@ -105,6 +109,7 @@ export function StringPreviewContentBlobToggler({
105109
fullviewContent={fullviewContent}
106110
startExtended={startExtended}
107111
enableToggler={enableToggler}
112+
{...otherContentBlobTogglerProps}
108113
/>
109114
);
110115
}

0 commit comments

Comments
 (0)