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

Add mantine UI package #3622

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:
- material-ui
- mui
- semantic-ui
- mantine-ui
- utils
- validator-ajv6
- validator-ajv8
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ body:
- material-ui
- mui
- semantic-ui
- mantine-ui
- utils
- validator-ajv6
- validator-ajv8
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/question_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ body:
- material-ui
- mui
- semantic-ui
- mantine-ui
- utils
- validator-ajv6
- validator-ajv8
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ should change the heading of the (upcoming) version to include a major version b

-->

# 5.9.0
- Add mantine ui

# 5.8.1

## Dev / docs / playground
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
- [Material UI 4](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/material-ui)
- [Material UI 5](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/mui)
- [Semantic UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/semantic-ui)
- [Mantine UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/mantine-ui)


## Documentation

Expand Down
4 changes: 2 additions & 2 deletions packages/antd/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/bootstrap-4/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/chakra-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions packages/docs/docs/advanced-customization/custom-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,12 @@ import { BaseInputTemplateProps } from '@rjsf/utils';
import { getDefaultRegistry } from '@rjsf/core';
import { Templates } from '@rjsf/mui';

const { templates: { BaseInputTemplate } } = getDefaultRegistry(); // To get templates from core
const {
templates: { BaseInputTemplate },
} = getDefaultRegistry(); // To get templates from core
// const { BaseInputTemplate } = Templates; // To get templates from a theme do this

function MyBaseInputTemplate(props: BaseInputTemplateProps)
{
function MyBaseInputTemplate(props: BaseInputTemplateProps) {
const customProps = {};
// get your custom props from where you need to
return <BaseInputTemplate {...props} {...customProps} />;
Expand Down
21 changes: 11 additions & 10 deletions packages/docs/docs/usage/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ meaning that you must load the Bootstrap stylesheet on the page to view the form

## Supported themes

| Theme Name | Status | Package Name / Link |
| --------------------- | --------- | ------------------- |
| antd | Published | `@rjsf/antd` |
| Bootstrap 3 (default) | Published | `@rjsf/core` |
| Bootstrap 4 | Published | `@rjsf/bootstrap-4` |
| Chakra UI | Published | `@rjsf/chakra-ui` |
| fluent-ui | Published | `@rjsf/fluent-ui` |
| material-ui 4 | Published | `@rjsf/material-ui` |
| material-ui 5 | Published | `@rjsf/mui` |
| Semantic UI | Published | `@rjsf/semantic-ui` |
| Theme Name | Status | Package Name / Link |
| --------------------- | ------------- | ------------------- |
| antd | Published | `@rjsf/antd` |
| Bootstrap 3 (default) | Published | `@rjsf/core` |
| Bootstrap 4 | Published | `@rjsf/bootstrap-4` |
| Chakra UI | Published | `@rjsf/chakra-ui` |
| fluent-ui | Published | `@rjsf/fluent-ui` |
| material-ui 4 | Published | `@rjsf/material-ui` |
| material-ui 5 | Published | `@rjsf/mui` |
| Semantic UI | Published | `@rjsf/semantic-ui` |
| Mantine UI | Not Published | `@rjsf/mantine-ui` |

## Using themes

Expand Down
4 changes: 2 additions & 2 deletions packages/fluent-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/mantine-ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": ["../../.eslintrc-typescript"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import", "@emotion"],
"rules": { "@emotion/jsx-import": "error" }
}
163 changes: 163 additions & 0 deletions packages/mantine-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
[![Build Status][build-shield]][build-url]
[![npm][npm-shield]][npm-url]
[![npm downloads][npm-dl-shield]][npm-dl-url]
[![Contributors][contributors-shield]][contributors-url]
[![Apache 2.0 License][license-shield]][license-url]

<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/rjsf-team/react-jsonschema-form">
<img src="./logo.png" alt="Logo" width="340">
</a>

<h3 align="center">@rjsf/mantine-ui</h3>

<p align="center">
Mantine UI theme, fields and widgets for <a href="https://github.com/rjsf-team/react-jsonschema-form/"><code>react-jsonschema-form</code></a>.
<br />
<a href="https://rjsf-team.github.io/react-jsonschema-form/docs/"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://rjsf-team.github.io/react-jsonschema-form/">View Playground</a>
·
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Report Bug</a>
·
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Request Feature</a>
</p>
</p>

<!-- TABLE OF CONTENTS -->

## Table of Contents

- [Table of Contents](#table-of-contents)
- [About The Project](#about-the-project)
- [Built With](#built-with)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Optional Mantine UI Theme properties](#optional-mantine-ui-theme-properties)
- [Custom Mantine uiSchema Mantine Property](#custom-mantine-uischema-mantine-property)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [Contact](#contact)

<!-- ABOUT THE PROJECT -->

## About The Project

[![@rjsf/mantine-ui Screen Shot][product-screenshot]](https://rjsf-team.github.io/@rjsf/mantine-ui)

Exports `mantine-ui` theme, fields and widgets for `react-jsonschema-form`.

### Built With

- [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form/)
- [Mantine UI](https://mantine.dev/)
- [TypeScript](https://www.typescriptlang.org/)

<!-- GETTING STARTED -->

## Getting Started

### Prerequisites


- `@mantine/core >=5.7.1`
- `@mantine/hooks >=5.7.1`
- `react >= 17.0.0`
- `tabler-icons-react >=1.56.0`


Refer to the [rjsf installation guide](https://rjsf-team.github.io/react-jsonschema-form/docs/#installation) and [mantine-ui installation guide](https://mantine.dev/pages/getting-started/) and for more details.

---

### Installation

```bash
yarn add @mantine/core@^5.7.1 @mantine/hooks@^5.7.1 tabler-icons-react@^1.56.0
```

```bash
yarn add @rjsf/mantine-ui @rjsf/core
```

<!-- USAGE EXAMPLES -->

## Usage

```js
import Form from '@rjsf/mantine-ui';
```

or

```js
import { withTheme } from '@rjsf/core';
import { Theme as MantineUITheme } from '@rjsf/mantine-ui';

// Make modifications to the theme with your own fields and widgets

const Form = withTheme(MantineUITheme);
```

## Optional Mantine UI Theme properties

- To pass additional properties to widgets, see this [guide](https://rjsf-team.github.io/react-jsonschema-form/docs/usage/objects#additional-properties).

You can use `MantineProvider`, to customize the components at a theme level.\
And, `uiSchema` allows for the use of a `"mantine"` `"ui:option"` to customize the styling of the form widgets.

#### Custom Mantine uiSchema Mantine Property

```json
{
"ui:options": {
"mantine": {
"sx": {
"margin": "0 auto"
}
}
}
}
```

It accepts the theme accessible [style props](https://mantine-ui.com/docs/features/style-props) provided by [Mantine](https://mantine-ui.com/docs/getting-started) and [Emotion](https://emotion.sh/docs/introduction).

<!-- ROADMAP -->

## Roadmap

See the [open issues](https://github.com/rjsf-team/react-jsonschema-form/issues) for a list of proposed features (and known issues).

<!-- CONTRIBUTING -->

## Contributing

Read our [contributors' guide](https://rjsf-team.github.io/react-jsonschema-form/docs/contributing/) to get started.

<!-- CONTACT -->

## Contact

rjsf team: [https://github.com/orgs/rjsf-team/people](https://github.com/orgs/rjsf-team/people)

GitHub repository: [https://github.com/rjsf-team/react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form)

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[build-shield]: https://github.com/rjsf-team/react-jsonschema-form/workflows/CI/badge.svg
[build-url]: https://github.com/rjsf-team/react-jsonschema-form/actions
[contributors-shield]: https://img.shields.io/github/contributors/rjsf-team/react-jsonschema-form.svg
[contributors-url]: https://github.com/rjsf-team/react-jsonschema-form/graphs/contributors
[license-shield]: https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square
[license-url]: https://choosealicense.com/licenses/apache-2.0/
[npm-shield]: https://img.shields.io/npm/v/@rjsf/mantine-ui/latest.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@rjsf/mantine-ui
[npm-dl-shield]: https://img.shields.io/npm/dm/@rjsf/mantine-ui.svg?style=flat-square
[npm-dl-url]: https://www.npmjs.com/package/@rjsf/mantine-ui
[product-screenshot]: ./screenshot.png
11 changes: 11 additions & 0 deletions packages/mantine-ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
moduleNameMapper: {
'^react$': '<rootDir>/node_modules/react',
'^react-dom$': '<rootDir>/node_modules/react-dom',
},
snapshotSerializers: ['@emotion/jest/serializer'],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
browsers: ['chrome', 'firefox', 'safari'],
},
};
Binary file added packages/mantine-ui/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading