Skip to content

Commit

Permalink
Initial React 18 and MUI5 upgrade changes (#391)
Browse files Browse the repository at this point in the history
* upgrade: React 18 & MUI 5

* fix: Date & Date Time picker changes

* fix: Theme issues

* dependency packages updated

* BUG-863783 - Locale support
  • Loading branch information
tumms2021389 authored Oct 8, 2024
1 parent 26081da commit 8662686
Show file tree
Hide file tree
Showing 87 changed files with 5,551 additions and 17,082 deletions.
21,679 changes: 5,067 additions & 16,612 deletions package-lock.json

Large diffs are not rendered by default.

47 changes: 22 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,41 @@
"author": "Pegasystems",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@date-io/dayjs": "^1.3.13",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
"@pega/auth": "^0.2.14",
"@pega/constellationjs": "^0.242.3",
"@tinymce/tinymce-react": "^4.3.2",
"@types/react": "^17.0.74",
"dayjs": "^1.11.10",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.14",
"@mui/lab": "^5.0.0-alpha.169",
"@mui/material": "^5.15.14",
"@mui/styles": "^5.15.14",
"@mui/x-date-pickers": "^7.1.0",
"@pega/auth": "~0.2.14",
"@tinymce/tinymce-react": "^5.1.1",
"clsx": "^2.1.0",
"dayjs": "^1.11.13",
"downloadjs": "^1.4.7",
"fast-deep-equal": "^3.1.3",
"lodash.difference": "^4.5.0",
"lodash.isequal": "^4.5.0",
"material-ui-phone-number": "^2.2.6",
"react": "^17.0.2",
"material-ui-phone-number-2": "^1.3.0",
"react": "^18.2.0",
"react-datepicker": "^4.25.0",
"react-dom": "^17.0.2",
"react-number-format": "^5.3.4",
"react-redux": "^8.1.3",
"react-router-dom": "^5.3.4",
"throttle-debounce": "^5.0.0"
"react-dom": "^18.2.0",
"react-number-format": "^5.4.2",
"react-redux": "^9.1.0",
"react-router-dom": "^6.22.3",
"throttle-debounce": "^5.0.2"
},
"devDependencies": {
"@kooneko/livereload-webpack-plugin": "^1.2.1",
"@pega/commitlint-config": "^0.7.1",
"@pega/commitlint-plugin": "^0.7.1",
"@pega/configs": "^0.7.1",
"@pega/cspell-config": "^0.7.1",
"@pega/eslint-config": "^0.7.1",
"@pega/constellationjs": "~0.242.5",
"@pega/eslint-config": "^0.7.2",
"@pega/pcore-pconnect-typedefs": "~3.0.0",
"@pega/prettier-config": "^0.7.1",
"@pega/stylelint-config": "^0.7.1",
"@pega/tsconfig": "^0.6.0",
"@playwright/test": "^1.40.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.11",
"@types/react": "^18.2.73",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0",
Expand Down Expand Up @@ -119,7 +116,7 @@
"shx": "^0.3.4",
"style-loader": "^3.3.4",
"stylelint": "^16.1.0",
"tinymce": "^6.8.2",
"tinymce": "^7.3.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"typescript": "^4.9.5",
Expand Down
6 changes: 5 additions & 1 deletion packages/react-sdk-components/src/bridge/react_pconnect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ class PConnect extends Component {

// If the new component is a reference node then mark with a unique key
if (['reference', 'View'].includes(getPConnect().getComponentName()) && !finalProps.key) {
finalProps.key = this.getKey();
return (
<this.Control {...finalProps} key={this.getKey()}>
{this.createChildren()}
</this.Control>
);
}

// console.log(`react_pconnect: used to return: <this.Control {...finalProps} />`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Alert } from '@material-ui/lab';
import { Alert } from '@mui/material';

// AlertBanner is one of the few components that does NOT have getPConnect.
// So, no need to extend PConnProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grid from '@material-ui/core/Grid';
import Grid from '@mui/material/Grid';
import './Banner.css';

// AlertBanner is one of the few components that does NOT have getPConnect.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import isDeepEqual from 'fast-deep-equal/react';
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import Grid from '@mui/material/Grid';
import TextField from '@mui/material/TextField';

import { getDateFormatInfo } from '../../helpers/date-format-utils';
import { getCurrencyOptions } from '../../field/Currency/currency-utils';
Expand Down Expand Up @@ -43,6 +43,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
default:
return (
<TextField
variant='standard'
value='---'
label={field.config.label}
InputProps={{
Expand All @@ -61,6 +62,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
case 'dropdown':
return (
<TextField
variant='standard'
value={field.config.value}
label={field.config.label}
InputProps={{
Expand All @@ -77,6 +79,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {

return (
<TextField
variant='standard'
value={fieldValue}
label={fieldLabel}
InputProps={{
Expand All @@ -90,6 +93,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
case 'status':
return (
<TextField
variant='standard'
className='psdk-csf-status-style'
value={field.config.value}
label={field.config.label}
Expand All @@ -105,6 +109,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
return (
<a href={`tel:${displayPhone}`}>
<TextField
variant='standard'
value={field.config.value}
label={field.config.label}
InputProps={{
Expand All @@ -124,6 +129,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
return (
<a href={`mailto:${displayEmail}`}>
<TextField
variant='standard'
value={field.config.value}
label={field.config.label}
InputProps={{
Expand All @@ -145,6 +151,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {

return (
<TextField
variant='standard'
value={format(field.config.value, field.type, {
format: theFormat
})}
Expand All @@ -161,6 +168,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
const theCurrencyOptions = getCurrencyOptions(field.config?.currencyISOCode);
return (
<TextField
variant='standard'
value={format(field.config.value, field.type, theCurrencyOptions)}
label={field.config.label}
InputProps={{
Expand All @@ -175,6 +183,7 @@ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
case 'userreference':
return (
<TextField
variant='standard'
value={format(field.config.value, field.type)}
label={field.config.label}
InputProps={{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable react/no-array-index-key */
import React, { createElement, isValidElement } from 'react';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import makeStyles from '@mui/styles/makeStyles';

import createPConnectComponent from '../../../bridge/react_pconnect';
import { format } from '../../helpers/formatters';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PropsWithChildren, useState } from 'react';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
import Grid from '@mui/material/Grid';
import makeStyles from '@mui/styles/makeStyles';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';

// FieldGroupProps is one of the few components that does NOT have getPConnect.
// So, no need to extend PConnProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Grid from '@material-ui/core/Grid';
import Divider from '@material-ui/core/Divider';
import Link from '@material-ui/core/Link';
import Grid from '@mui/material/Grid';
import Divider from '@mui/material/Divider';
import Link from '@mui/material/Link';

import { Utils } from '../../helpers/utils';

Expand Down Expand Up @@ -47,7 +47,7 @@ export default function FieldGroupList(props: FieldGroupListProps) {
</Grid>
))}
{props.onAdd && (
<Link onClick={props.onAdd} style={{ cursor: 'pointer' }}>
<Link onClick={props.onAdd} style={{ cursor: 'pointer' }} underline='hover'>
+Add
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import makeStyles from '@mui/styles/makeStyles';

// FieldValueList is one of the few components that does NOT have getPConnect.
// So, no need to extend PConnProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react';
import TextField from '@material-ui/core/TextField';
import Popover from '@material-ui/core/Popover';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import TextField from '@mui/material/TextField';
import Popover from '@mui/material/Popover';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import makeStyles from '@mui/styles/makeStyles';

import Utils from '../../helpers/utils';
import { PConnProps } from '../../../types/PConnProps';
Expand Down Expand Up @@ -189,6 +189,7 @@ export default function Operator(props: OperatorProps) {
return (
<>
<TextField
variant='standard'
defaultValue={caseOpName}
label={caseOpLabel}
onClick={showOperatorDetails}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PropsWithChildren } from 'react';
import { Card, CardContent, CardHeader, Typography } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { Card, CardContent, CardHeader, Typography } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';

// Pulse is one of the few components that does NOT have getPConnect.
// So, no need to extend PConnProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { forwardRef } from 'react';
import { Editor } from '@tinymce/tinymce-react';
import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
import { FormControl, FormHelperText, InputLabel } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';

import { useAfterInitialEffect, useConsolidatedRef, useUID } from '../../../hooks';

Expand Down Expand Up @@ -107,7 +108,7 @@ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorP
}

return (
<FormControl data-test-id={testId} error={error} required={required}>
<FormControl variant='standard' data-test-id={testId} error={error} required={required}>
{!labelHidden && (
<InputLabel id='demo-simple-select-error-label' className={classes.fieldLabel}>
{label}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button } from '@material-ui/core';
import { Button } from '@mui/material';
import './WssQuickCreate.css';

// WssQuickCreate is one of the few components that does NOT have getPConnect.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { TextField } from '@material-ui/core';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { TextField } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
import isDeepEqual from 'fast-deep-equal/react';

import Utils from '../../helpers/utils';
Expand Down Expand Up @@ -191,7 +191,7 @@ export default function AutoComplete(props: AutoCompleteProps) {
getOptionLabel={(option: IOption) => {
return option.value ? option.value : '';
}}
getOptionSelected={(option: any) => {
isOptionEqualToValue={(option: any) => {
return option.value ? option.value : '';
}}
fullWidth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { Button, Grid, IconButton, Snackbar } from '@material-ui/core';
import CloseIcon from '@material-ui/icons/Close';
import { Button, Grid, IconButton, Snackbar } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';

import { PConnFieldProps } from '../../../types/PConnProps';
import './CancelAlert.css';
Expand Down Expand Up @@ -89,7 +89,7 @@ export default function CancelAlert(props: CancelAlertProps) {
}
}

function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
if (reason === 'clickaway') {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable react/no-array-index-key */
import { useState, useEffect } from 'react';
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material-ui/core';
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';

import handleEvent from '../../helpers/event-utils';
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
import { insertInstruction, deleteInstruction, updateNewInstuctions } from '../../helpers/instructions-utils';
import { PConnFieldProps } from '../../../types/PConnProps';
import { makeStyles } from '@material-ui/core/styles';

interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
// If any, enter additional props that only exist on Checkbox here
Expand Down Expand Up @@ -161,7 +161,7 @@ export default function CheckboxComponent(props: CheckboxProps) {
}

return (
<FormControl required={required} error={status === 'error'}>
<FormControl variant='standard' required={required} error={status === 'error'}>
{!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}
<FormGroup>{theCheckbox}</FormGroup>
<FormHelperText>{helperTextToDisplay}</FormHelperText>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TextField } from '@material-ui/core';
import { useState } from 'react';
import { NumericFormat } from 'react-number-format';
import { TextField } from '@mui/material';
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
import { PConnFieldProps } from '../../../types/PConnProps';
import handleEvent from '../../helpers/event-utils';
Expand Down
Loading

0 comments on commit 8662686

Please sign in to comment.