Skip to content
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

fix: Generic support for Chakra UI #3327

Merged
merged 4 commits into from Jan 6, 2023

Conversation

nickgros
Copy link
Contributor

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run 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
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

- Partially fix rjsf-team#3072
- Extract ChakraIconButton to its own file to abstract away React.memo
- Refactor AltDateWidget to extract DateElement component
@@ -16,6 +19,31 @@ const rangeOptions = (start: number, stop: number) => {
return options;
};

function DateElement<
Copy link
Contributor Author

@nickgros nickgros Dec 29, 2022

Choose a reason for hiding this comment

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

This component was originally created within the AltDateWidget component, so I extracted it to prevent potential performance issues where the component may be excessively re-rendered.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should do this for other themes?

@heath-freenome heath-freenome changed the title Generic support for Chakra UI fix: Generic support for Chakra UI Dec 30, 2022
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.

Also, update the main index.tsx (maybe rename to index.ts since it doesn't need to be a .tsx)

import Form from "./Form";

export { default as Form, generateForm } from "./Form";
export { default as Templates, generateTemplates } from "./Templates";
export { default as Theme, generateTheme } from "./Theme";
export { default as Widgets, generateWidgets } from "./Widgets";
export { __createChakraFrameProvider } from "./ChakraFrameProvider";

export type { ChakraUiSchema as UiSchema } from "./utils";

export default Form;

@heath-freenome heath-freenome merged commit db14094 into rjsf-team:main Jan 6, 2023
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
* Generic support for Chakra UI
- Partially fix rjsf-team#3072
- Extract ChakraIconButton to its own file to abstract away React.memo
- Refactor AltDateWidget to extract DateElement component

* Changes from code review

* Update packages/chakra-ui/src/IconButton/index.ts

Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
* Generic support for Chakra UI
- Partially fix rjsf-team#3072
- Extract ChakraIconButton to its own file to abstract away React.memo
- Refactor AltDateWidget to extract DateElement component

* Changes from code review

* Update packages/chakra-ui/src/IconButton/index.ts

Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
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.

Fix Typescript generics support in all themes in the beta
2 participants