Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing material theme string widgets (#1789)
* Add missing material UI string widgets * Update snapshots for new widgets * Update snapshots for additional format types * Support full parameter options for TextField and disable shrink on Date widgets * Fix types and update snapshots * Fix formatting for datetime widget * Update snapshots * Fix test
- Loading branch information
Showing
20 changed files
with
996 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,8 @@ | ||
import React from "react"; | ||
import TextWidget, { TextWidgetProps } from "../TextWidget"; | ||
|
||
const ColorWidget = (props: TextWidgetProps) => { | ||
return <TextWidget type="color" {...props} />; | ||
}; | ||
|
||
export default ColorWidget; |
This file contains 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,2 @@ | ||
export { default } from "./ColorWidget"; | ||
export * from "./ColorWidget"; |
26 changes: 26 additions & 0 deletions
26
packages/material-ui/src/DateTimeWidget/DateTimeWidget.tsx
This file contains 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,26 @@ | ||
import React from "react"; | ||
import { utils } from "@rjsf/core"; | ||
import TextWidget, { TextWidgetProps } from "../TextWidget"; | ||
|
||
const { localToUTC, utcToLocal } = utils; | ||
|
||
const DateTimeWidget = (props: TextWidgetProps) => { | ||
const value = utcToLocal(props.value); | ||
const onChange = (value: any) => { | ||
props.onChange(localToUTC(value)); | ||
}; | ||
|
||
return ( | ||
<TextWidget | ||
type="datetime-local" | ||
InputLabelProps={{ | ||
shrink: true, | ||
}} | ||
{...props} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
); | ||
}; | ||
|
||
export default DateTimeWidget; |
This file contains 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,2 @@ | ||
export { default } from "./DateTimeWidget"; | ||
export * from "./DateTimeWidget"; |
This file contains 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,16 @@ | ||
import React from "react"; | ||
import TextWidget, { TextWidgetProps } from "../TextWidget"; | ||
|
||
const DateWidget = (props: TextWidgetProps) => { | ||
return ( | ||
<TextWidget | ||
type="date" | ||
InputLabelProps={{ | ||
shrink: true, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default DateWidget; |
This file contains 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,2 @@ | ||
export { default } from "./DateWidget"; | ||
export * from "./DateWidget"; |
This file contains 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,8 @@ | ||
import React from "react"; | ||
import TextWidget, { TextWidgetProps } from "../TextWidget"; | ||
|
||
const EmailWidget = (props: TextWidgetProps) => { | ||
return <TextWidget type="email" {...props} />; | ||
}; | ||
|
||
export default EmailWidget; |
This file contains 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,2 @@ | ||
export { default } from './EmailWidget'; | ||
export * from './EmailWidget'; |
This file contains 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 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,8 @@ | ||
import React from "react"; | ||
import TextWidget, { TextWidgetProps } from "../TextWidget"; | ||
|
||
const URLWidget = (props: TextWidgetProps) => { | ||
return <TextWidget type="url" {...props} />; | ||
}; | ||
|
||
export default URLWidget; |
This file contains 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,2 @@ | ||
export { default } from "./URLWidget"; | ||
export * from "./URLWidget"; |
This file contains 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 |
---|---|---|
@@ -1,21 +1,31 @@ | ||
import CheckboxWidget from '../CheckboxWidget/CheckboxWidget'; | ||
import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget'; | ||
import PasswordWidget from '../PasswordWidget/PasswordWidget'; | ||
import RadioWidget from '../RadioWidget/RadioWidget'; | ||
import RangeWidget from '../RangeWidget/RangeWidget'; | ||
import SelectWidget from '../SelectWidget/SelectWidget'; | ||
import TextareaWidget from '../TextareaWidget/TextareaWidget'; | ||
import TextWidget from '../TextWidget/TextWidget'; | ||
import UpDownWidget from '../UpDownWidget/UpDownWidget'; | ||
import CheckboxWidget from "../CheckboxWidget/CheckboxWidget"; | ||
import CheckboxesWidget from "../CheckboxesWidget/CheckboxesWidget"; | ||
import ColorWidget from "../ColorWidget/ColorWidget"; | ||
import DateWidget from "../DateWidget/DateWidget"; | ||
import DateTimeWidget from "../DateTimeWidget/DateTimeWidget"; | ||
import EmailWidget from "../EmailWidget/EmailWidget"; | ||
import PasswordWidget from "../PasswordWidget/PasswordWidget"; | ||
import RadioWidget from "../RadioWidget/RadioWidget"; | ||
import RangeWidget from "../RangeWidget/RangeWidget"; | ||
import SelectWidget from "../SelectWidget/SelectWidget"; | ||
import TextareaWidget from "../TextareaWidget/TextareaWidget"; | ||
import TextWidget from "../TextWidget/TextWidget"; | ||
import UpDownWidget from "../UpDownWidget/UpDownWidget"; | ||
import URLWidget from "../URLWidget/URLWidget"; | ||
|
||
export default { | ||
CheckboxWidget, | ||
CheckboxesWidget, | ||
ColorWidget, | ||
DateWidget, | ||
DateTimeWidget, | ||
EmailWidget, | ||
PasswordWidget, | ||
RadioWidget, | ||
RangeWidget, | ||
SelectWidget, | ||
TextareaWidget, | ||
TextWidget, | ||
UpDownWidget, | ||
URLWidget, | ||
}; |
This file contains 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.