-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add support for customization with MUI theme to fields and delete buttons #10770
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1b8b5ee
Customizable email field and add basic story to test it.
Madeorsk 0beabe6
Customizable date field and add basic story to test it.
Madeorsk 91255d9
Customizable number field and add basic story to test it.
Madeorsk a1ee185
Customizable rich text field and improve stories to test it.
Madeorsk 3a4240d
Customizable select field and improve stories to test it.
Madeorsk 4ddc8f9
Customizable text field and add basic story to test it.
Madeorsk d4b3ca3
Customizable url field and add basic story to test it.
Madeorsk 0a1efc9
Customizable reference many count and improve stories to test it.
Madeorsk 3747ebc
Customizable delete button.
Madeorsk 97954a9
Easier ReferenceManyCount theming.
Madeorsk 16d9841
Easier ReferenceField theming.
Madeorsk a27f996
Add theme provider to reference fields stories to test theming.
Madeorsk d83e645
Add stories to test themes and fix ReferenceField and ReferenceOneFie…
Madeorsk 54d0084
Remove unused import and variable.
Madeorsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { Paper, Stack } from '@mui/material'; | ||
| import * as React from 'react'; | ||
|
|
||
| import { DateField, DateFieldProps } from './DateField'; | ||
| import { AdminContext } from '../AdminContext'; | ||
| import { defaultDarkTheme, defaultLightTheme } from '../theme'; | ||
|
|
||
| export default { title: 'ra-ui-materialui/fields/DateField' }; | ||
|
|
||
| export const Basic = ({ | ||
| value, | ||
| theme, | ||
| ...props | ||
| }: Partial<DateFieldProps> & { value?: Date | string; theme?: string }) => { | ||
| return ( | ||
| <AdminContext | ||
| theme={theme === 'light' ? defaultLightTheme : defaultDarkTheme} | ||
| > | ||
| <Paper sx={{ p: 2 }}> | ||
| <Stack direction="row"> | ||
| <DateField record={{ value }} source="value" {...props} /> | ||
| </Stack> | ||
| </Paper> | ||
| </AdminContext> | ||
| ); | ||
| }; | ||
|
|
||
| Basic.argTypes = { | ||
| value: { | ||
| options: ['now', 'string', 'empty', 'undefined'], | ||
| mapping: { | ||
| now: new Date(), | ||
| string: '2025-03-25 12:52:11', | ||
| empty: '', | ||
| undefined: undefined, | ||
| }, | ||
| control: { type: 'select' }, | ||
| }, | ||
| theme: { | ||
| options: ['light', 'dark'], | ||
| control: { type: 'select' }, | ||
| }, | ||
| }; | ||
| Basic.args = { | ||
| theme: 'light', | ||
| value: 'now', | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/ra-ui-materialui/src/field/EmailField.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { Paper, Stack } from '@mui/material'; | ||
| import * as React from 'react'; | ||
|
|
||
| import { EmailField, EmailFieldProps } from './EmailField'; | ||
| import { AdminContext } from '../AdminContext'; | ||
| import { defaultDarkTheme, defaultLightTheme } from '../theme'; | ||
|
|
||
| export default { title: 'ra-ui-materialui/fields/EmailField' }; | ||
|
|
||
| export const Basic = ({ | ||
| value, | ||
| theme, | ||
| ...props | ||
| }: Partial<EmailFieldProps> & { value?: string; theme?: string }) => { | ||
| return ( | ||
| <AdminContext | ||
| theme={theme === 'light' ? defaultLightTheme : defaultDarkTheme} | ||
| > | ||
| <Paper sx={{ p: 2 }}> | ||
| <Stack direction="row"> | ||
| <EmailField record={{ value }} source="value" {...props} /> | ||
| </Stack> | ||
| </Paper> | ||
| </AdminContext> | ||
| ); | ||
| }; | ||
|
|
||
| Basic.argTypes = { | ||
| value: { | ||
| options: ['filled', 'empty', 'undefined'], | ||
| mapping: { | ||
| filled: 'test@test.test', | ||
| empty: '', | ||
| undefined: undefined, | ||
| }, | ||
| control: { type: 'select' }, | ||
| }, | ||
| theme: { | ||
| options: ['light', 'dark'], | ||
| control: { type: 'select' }, | ||
| }, | ||
| }; | ||
| Basic.args = { | ||
| theme: 'light', | ||
| value: 'filled', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.