Skip to content

PrimeReact support v6 #4497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

PrimeReact support v6 #4497

wants to merge 15 commits into from

Conversation

jasny
Copy link

@jasny jasny commented Feb 14, 2025

Reasons for making this change

Added PrimeReact theme. PrimeReact is a popular component library for React.

Fixes #2928

PrimeReact is at version 10. A lot has changed since 2022 both v4 to v6 of rjsf and v7 to v10 of primereact. The theme was created from scratch instead of modifying the existing PR. Closes #2723

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • [ ] I've updated the changelog with a description of the PR (will be part of v6)
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

This was referenced Feb 14, 2025
@nickgros nickgros mentioned this pull request Feb 14, 2025
8 tasks
@MarcoFantini
Copy link

Great work! This will be really useful for us!

@heath-freenome
Copy link
Member

@jasny I've merged a few PRs with updates and fixes from main. You'll have to rebase and update your PR. Also, checkout the new Layout Grid in the playground and update the layoutGrid.tsx in the samples directory to add your custom uiSchema for the grid to it.

@heath-freenome
Copy link
Member

heath-freenome commented Apr 17, 2025

@jasny are you planning to complete this theme addition? What do you need from us, if anything to get this over the line?

@jasny
Copy link
Author

jasny commented Apr 19, 2025

@heath-freenome Yes, definitely!

Unfortunately, I've been tied up with work for the past weeks, leaving no room to work on any open-source effort. This is high on my priority list, and I'll pick it up as soon as time allows me.

@heath-freenome
Copy link
Member

@heath-freenome Yes, definitely!

Unfortunately, I've been tied up with work for the past weeks, leaving no room to work on any open-source effort. This is high on my priority list, and I'll pick it up as soon as time allows me.

Sounds good. We'll have the first release of v6 beta hopefully out by the end of April. Since it is a new theme, we can add it in when you are ready

@jasny jasny force-pushed the primereact-v6 branch 2 times, most recently from 143249a to e687f8e Compare April 24, 2025 21:45
@jasny
Copy link
Author

jasny commented Apr 25, 2025

@heath-freenome Can you help with the failing tests? I don't understand what needs to be fixed.

@heath-freenome
Copy link
Member

heath-freenome commented Apr 25, 2025

@heath-freenome Can you help with the failing tests? I don't understand what needs to be fixed.

I noticed you copied from the semantic-ui theme. I wonder if you are picking up stuff that that theme needed that yours doesn't? I added comments about them above.

@jasny Also, you will need to run npm run cs-format to fix the linting errors. Do also consider running npm run build and npm run test before pushing again. Especially after rebasing onto the latest rjsf-v6 since I've merged a few core changes that affect snapshots

@jasny jasny marked this pull request as ready for review April 26, 2025 19:05
@jasny
Copy link
Author

jasny commented Apr 26, 2025

@heath-freenome Please let me know if changes are needed before merging.

Btw, why isn't CI triggered?

@heath-freenome
Copy link
Member

@heath-freenome Please let me know if changes are needed before merging.

Btw, why isn't CI triggered?

Because you are a first time dev, myself or somebody who is marked a reviewer for the project has to trigger it

@jasny jasny force-pushed the primereact-v6 branch 2 times, most recently from 90fb184 to fccb812 Compare April 30, 2025 11:21
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

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

Almost ready to merge. I'll be cutting the first v6 beta release in a few days hopefully

} from '@rjsf/utils';
import { Password } from 'primereact/password';

export default function PasswordWidget<
Copy link
Member

Choose a reason for hiding this comment

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

Can you add JSDoc, feel free to copy from another theme

@heath-freenome heath-freenome deleted the branch rjsf-team:main May 1, 2025 22:41
@heath-freenome heath-freenome reopened this May 1, 2025
@heath-freenome
Copy link
Member

heath-freenome commented May 1, 2025

@jasny sorry about the close. You'll have to rebase on main now and deal with the conflicts

@heath-freenome heath-freenome changed the base branch from rjsf-v6 to main May 1, 2025 23:33
jasny and others added 13 commits May 7, 2025 09:22
Add `PrimeReact Customization` to docs
List `@rjsf/primereact` as them in the docs
Remove unused util functions
Default form test
Add grid test
Mock inject stylesheet.
Mock dropdown, multiselect and slider. They don't work with jsdom.
Update snapshots.
@jasny jasny force-pushed the primereact-v6 branch from fccb812 to 4f0b7ea Compare May 7, 2025 07:48
Set `id` property in `ArrayFieldTitleTemplate`
@jasny jasny force-pushed the primereact-v6 branch from 4f0b7ea to 735dee7 Compare May 7, 2025 07:49
@jasny jasny requested a review from heath-freenome May 7, 2025 08:11
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

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

Just a few little changes and we are ready to merge!

Comment on lines +12 to +16
const { id, description } = props;
if (!description) {
return null;
}
return <span id={id}>{description}</span>;
Copy link
Member

Choose a reason for hiding this comment

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

Please use the new RichDescription component in @rjsf/core

Suggested change
const { id, description } = props;
if (!description) {
return null;
}
return <span id={id}>{description}</span>;
const { id, description, registry, uiSchema } = props;
if (!description) {
return null;
}
return (
<span id={id}>
<RichDescription description={description} registry={registry} uiSchema={uiSchema} />
</span>
);

@@ -0,0 +1,17 @@
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
import { RichDescription } from '@rjsf/core';

export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
props: WidgetProps<T, S, F>,
) {
const multiple = typeof props.multiple === 'undefined' ? false : props.multiple;
Copy link
Member

Choose a reason for hiding this comment

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

This is easier to read and shorter

Suggested change
const multiple = typeof props.multiple === 'undefined' ? false : props.multiple;
const { multiple = false } = props;

placeholder,
readonly,
value,
multiple,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
multiple,
multiple = false,

Comment on lines +107 to +108
multiple = typeof multiple === 'undefined' ? false : multiple;

Copy link
Member

Choose a reason for hiding this comment

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

Using the defaulting above alleviates the need for this

Suggested change
multiple = typeof multiple === 'undefined' ? false : multiple;

@heath-freenome
Copy link
Member

@jasny After making the changes, I suggest rebuilding updating the snapshots

Comment on lines +64 to +65
"@rjsf/core": "^6.x",
"@rjsf/utils": "^6.x",
Copy link
Member

@heath-freenome heath-freenome May 8, 2025

Choose a reason for hiding this comment

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

Suggested change
"@rjsf/core": "^6.x",
"@rjsf/utils": "^6.x",
"@rjsf/core": "^6.0.0-beta",
"@rjsf/utils": "^6.0.0-beta",

Comment on lines +71 to +74
"@rjsf/core": "^6.0.0-alpha.0",
"@rjsf/snapshot-tests": "^6.0.0-alpha.0",
"@rjsf/utils": "^6.0.0-alpha.0",
"@rjsf/validator-ajv8": "^6.0.0-alpha.0",
Copy link
Member

@heath-freenome heath-freenome May 8, 2025

Choose a reason for hiding this comment

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

Suggested change
"@rjsf/core": "^6.0.0-alpha.0",
"@rjsf/snapshot-tests": "^6.0.0-alpha.0",
"@rjsf/utils": "^6.0.0-alpha.0",
"@rjsf/validator-ajv8": "^6.0.0-alpha.0",
"@rjsf/core": "^6.0.0-beta.4",
"@rjsf/snapshot-tests": "^6.0.0-beta.4",
"@rjsf/utils": "^6.0.0-beta.4",
"@rjsf/validator-ajv8": "^6.0.0-beta.4",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Theme Integration with PrimeReact>
3 participants