Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
818 changes: 36 additions & 782 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lodash": "^4.17.0",
"luxon": "^1.23.0",
"query-string": "^7.0.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"semantic-ui-css": "^2.4.0",
"semantic-ui-react": "^2.1.0",
"tinymce": "^6.7.2",
Expand All @@ -41,7 +41,7 @@
},
"devDependencies": {
"@babel/cli": "^7.5.0",
"@inveniosoftware/eslint-config-invenio": "^2.0.0",
"@inveniosoftware/eslint-config-invenio": "^2.1.0",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-node-resolve": "^7.1.0",
Expand All @@ -53,17 +53,15 @@
"ajv": "^8.0.0",
"ajv-keywords": "^5.0.0",
"axios": "^1.7.7",
"coveralls": "^3.0.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.0",
"expect": "^26.0.0",
"formik": "^2.1.0",
"json": "^10.0.0",
"lodash": "^4.17.0",
"luxon": "^1.23.0",
"query-string": "^7.0.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react": "^18.3.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in RSK, is it possible to keep React v16 as min version?

"react-dom": "^18.3.0",
"react-scripts": "^5.0.1",
"rimraf": "^3.0.0",
"rollup": "^2.10.0",
Expand Down Expand Up @@ -111,6 +109,6 @@
]
},
"engines": {
"node": ">=16.0.0"
"node": ">=22.0.0"
}
}
10 changes: 3 additions & 7 deletions src/demos/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// React-Invenio-Forms is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

import React, { Component } from "react";

import PropTypes from "prop-types";
import * as Yup from "yup";
import { Header, Message, Container } from "semantic-ui-react";
Expand All @@ -31,11 +29,9 @@ CurrentRecord.defaultProps = {
record: undefined,
};

class RecordPreviewer extends Component {
render() {
const { record } = this.props;
return <CurrentRecord record={record} />;
}
function RecordPreviewer(props) {
const { record } = props;
return <CurrentRecord record={record} />;
}

RecordPreviewer.propTypes = {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* under the terms of the MIT License; see LICENSE file for more details.
*/

import React from "react";
import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
import App from "./demos/App";
import "semantic-ui-css/semantic.min.css";

ReactDOM.render(<App />, document.getElementById("root"));
const root = createRoot(document.getElementById("root"));
root.render(<App />);
27 changes: 12 additions & 15 deletions src/lib/elements/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { Message, Icon } from "semantic-ui-react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import _isEmpty from "lodash/isEmpty";

const FieldErrorList = ({ fieldErrors }) => {
Expand Down Expand Up @@ -48,21 +47,19 @@ FieldErrorList.propTypes = {
* - complex error messages: provide list or received errors.
* Icon and other ui props are supported.
*/
export class ErrorMessage extends Component {
render() {
const { header, errors, content, icon, ...uiProps } = this.props;
export function ErrorMessage(props) {
const { header, errors, content, icon, ...uiProps } = props;

return (
<Message icon={Boolean(icon)} {...uiProps}>
{icon && <Icon name={icon} />}
<Message.Content role="alert">
{header && <Message.Header>{header}</Message.Header>}
{content}
{!_isEmpty(errors) && <FieldErrorList fieldErrors={errors} />}
</Message.Content>
</Message>
);
}
return (
<Message icon={Boolean(icon)} {...uiProps}>
{icon && <Icon name={icon} />}
<Message.Content role="alert">
{header && <Message.Header>{header}</Message.Header>}
{content}
{!_isEmpty(errors) && <FieldErrorList fieldErrors={errors} />}
</Message.Content>
</Message>
);
}

ErrorMessage.propTypes = {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/elements/GridResponsiveSidebarColumn.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import { createRef, Component } from "react";
import PropTypes from "prop-types";
import { Grid, Sidebar, Button, Segment } from "semantic-ui-react";

export class GridResponsiveSidebarColumn extends React.Component {
export class GridResponsiveSidebarColumn extends Component {
render() {
const closeSidebarBtnRef = React.createRef();
const closeSidebarBtnRef = createRef();
const {
mobile,
tablet,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/elements/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// under the terms of the MIT License; see LICENSE file for more details.

import PropTypes from "prop-types";
import React, { Component } from "react";
import { createRef, Component } from "react";
import { Image as SUIImage, Ref } from "semantic-ui-react";
import axios from "axios";

Expand All @@ -27,7 +27,7 @@ export class Image extends Component {
}
}
}
myRef = React.createRef();
myRef = createRef();

setSrc = (currentTarget, src, isFallback = false) => {
if (isFallback) {
Expand Down
66 changes: 32 additions & 34 deletions src/lib/elements/accessibility/InvenioPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,42 @@
// React-Invenio-Forms is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

import React, { Component } from "react";
import { cloneElement } from "react";
import PropTypes from "prop-types";
import { Popup } from "semantic-ui-react";

export class InvenioPopup extends Component {
render() {
const {
popupId,
size,
trigger,
content,
position,
inverted,
ariaLabel,
hoverable,
} = this.props;
export function InvenioPopup(props) {
const {
popupId,
size,
trigger,
content,
position,
inverted,
ariaLabel,
hoverable,
} = props;

return (
<Popup
id={popupId}
size={size}
position={position}
inverted={inverted}
hoverable={hoverable}
on={["hover", "focus"]}
trigger={React.cloneElement(trigger, {
"role": "button",
"tabIndex": 0,
"aria-label": ariaLabel,
})}
content={
<p role="tooltip" aria-live="polite">
{content}
</p>
}
/>
);
}
return (
<Popup
id={popupId}
size={size}
position={position}
inverted={inverted}
hoverable={hoverable}
on={["hover", "focus"]}
trigger={cloneElement(trigger, {
"role": "button",
"tabIndex": 0,
"aria-label": ariaLabel,
})}
content={
<p role="tooltip" aria-live="polite">
{content}
</p>
}
/>
);
}

InvenioPopup.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/elements/bulk_actions/SearchResultsBulkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* under the terms of the MIT License; see LICENSE file for more details.
*/

import React, { Component } from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import { Checkbox, Dropdown } from "semantic-ui-react";
import { BulkActionsContext } from "./context";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BulkActionsContext } from "./context";
import React, { Component } from "react";
import { Component } from "react";
import _hasIn from "lodash/hasIn";
import PropTypes from "prop-types";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/elements/bulk_actions/SearchResultsRowCheckbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BulkActionsContext } from "./context";
import React, { Component } from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import { Checkbox } from "semantic-ui-react";
import _hasIn from "lodash/hasIn";
Expand Down
4 changes: 2 additions & 2 deletions src/lib/elements/bulk_actions/context.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { createContext } from "react";

export const BulkActionsContext = React.createContext({
export const BulkActionsContext = createContext({
bulkActionContext: {},
addToSelected: () => {},
allSelected: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* // under the terms of the MIT License; see LICENSE file for more details.
*/

import React from "react";
import { Image } from "../../../Image";
import { Header } from "semantic-ui-react";
import Overridable from "react-overridable";
Expand Down
57 changes: 27 additions & 30 deletions src/lib/elements/contrib/invenioRDM/users/UserListItemCompact.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Image } from "../../../Image";
import { Item, Label } from "semantic-ui-react";

export class UserListItemCompact extends Component {
render() {
const { id, user, linkToDetailView } = this.props;
const name = user.profile?.full_name || user.username;
return (
<Item className="flex" key={id}>
<Image src={user.links.avatar} avatar loadFallbackFirst />
<Item.Content className="ml-10">
<Item.Header className={!user.description ? "mt-5" : ""}>
{linkToDetailView ? (
<a href={linkToDetailView}>
<b>{name}</b>
</a>
) : (
export function UserListItemCompact(props) {
const { id, user, linkToDetailView } = props;
const name = user.profile?.full_name || user.username;
return (
<Item className="flex" key={id}>
<Image src={user.links.avatar} avatar loadFallbackFirst />
<Item.Content className="ml-10">
<Item.Header className={!user.description ? "mt-5" : ""}>
{linkToDetailView ? (
<a href={linkToDetailView}>
<b>{name}</b>
)}
{user.type === "group" && <Label className="ml-10">Group</Label>}
{user.is_current_user && (
<Label size="tiny" className="primary ml-10">
You
</Label>
)}
</Item.Header>
<Item.Meta>
<div className="truncate-lines-1"> {user.profile?.affiliations}</div>
</Item.Meta>
</Item.Content>
</Item>
);
}
</a>
) : (
<b>{name}</b>
)}
{user.type === "group" && <Label className="ml-10">Group</Label>}
{user.is_current_user && (
<Label size="tiny" className="primary ml-10">
You
</Label>
)}
</Item.Header>
<Item.Meta>
<div className="truncate-lines-1"> {user.profile?.affiliations}</div>
</Item.Meta>
</Item.Content>
</Item>
);
}

UserListItemCompact.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/forms/AccordionField.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import _get from "lodash/get";
import isEmpty from "lodash/isEmpty";
import React, { Component } from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import { Field, FastField } from "formik";
import { Accordion, Container, Icon, Label } from "semantic-ui-react";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/forms/ArrayField.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// React-Invenio-Forms is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

import React, { Component } from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import { getIn, FieldArray } from "formik";
import { Form, Icon } from "semantic-ui-react";
Expand Down
17 changes: 7 additions & 10 deletions src/lib/forms/BaseForm/BaseForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@
// React-Invenio-Forms is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

import React, { Component } from "react";
import PropTypes from "prop-types";
import { Formik } from "formik";
import { Form } from "semantic-ui-react";

export class BaseForm extends Component {
render() {
const { formik, onSubmit, children } = this.props;
return (
<Formik onSubmit={onSubmit} {...formik}>
<Form>{children}</Form>
</Formik>
);
}
export function BaseForm(props) {
const { formik, onSubmit, children } = props;
return (
<Formik onSubmit={onSubmit} {...formik}>
<Form>{children}</Form>
</Formik>
);
}

BaseForm.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/forms/BooleanField.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// React-Invenio-Forms is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

import React, { Component } from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import { FastField, Field, getIn } from "formik";
import { Form } from "semantic-ui-react";
Expand Down
Loading
Loading