diff --git a/packages/ra-ui-materialui/src/defaultTheme.ts b/packages/ra-ui-materialui/src/defaultTheme.ts index e2a3ac0f95d..fb140cd80c9 100644 --- a/packages/ra-ui-materialui/src/defaultTheme.ts +++ b/packages/ra-ui-materialui/src/defaultTheme.ts @@ -11,12 +11,30 @@ const defaultThemeInvariants = { closedWidth: 50, }, components: { + MuiAutocomplete: { + variants: [ + { + props: {}, + style: ({ theme }) => ({ + [theme.breakpoints.down('sm')]: { width: '100%' }, + }), + }, + ], + }, MuiTextField: { defaultProps: { variant: 'filled' as const, margin: 'dense' as const, size: 'small' as const, }, + variants: [ + { + props: {}, + style: ({ theme }) => ({ + [theme.breakpoints.down('sm')]: { width: '100%' }, + }), + }, + ], }, MuiFormControl: { defaultProps: { diff --git a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx index 544b123e7a7..e1efb25af8f 100644 --- a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx +++ b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx @@ -118,6 +118,11 @@ const StyledTextField = styled(TextField, { [`&.${NullableBooleanInputClasses.input}`]: { width: fullWidth ? '100%' : theme.spacing(16), }, + [theme.breakpoints.down('sm')]: { + [`&.${NullableBooleanInputClasses.input}`]: { + width: '100%', + }, + }, })); const getBooleanFromString = (value: string): boolean | null => { diff --git a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx index f4baad6e260..92f074df6f2 100644 --- a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx @@ -445,6 +445,9 @@ const StyledFormControl = styled(FormControl, { overridesResolver: (props, styles) => styles.root, })(({ theme }) => ({ minWidth: theme.spacing(20), + [theme.breakpoints.down('sm')]: { + width: '100%', + }, [`& .${SelectArrayInputClasses.chips}`]: { display: 'flex', flexWrap: 'wrap', diff --git a/packages/ra-ui-materialui/src/input/inputs.stories.tsx b/packages/ra-ui-materialui/src/input/inputs.stories.tsx new file mode 100644 index 00000000000..036bae16762 --- /dev/null +++ b/packages/ra-ui-materialui/src/input/inputs.stories.tsx @@ -0,0 +1,123 @@ +import * as React from 'react'; +import polyglotI18nProvider from 'ra-i18n-polyglot'; +import englishMessages from 'ra-language-english'; + +import { AdminContext } from '../AdminContext'; +import { Create } from '../detail'; +import { SimpleForm } from '../form'; +import { + AutocompleteInput, + CheckboxGroupInput, + TextInput, + DateInput, + AutocompleteArrayInput, + SelectInput, + BooleanInput, + SelectArrayInput, + DateTimeInput, + NullableBooleanInput, + NumberInput, + RadioButtonGroupInput, + TimeInput, + TranslatableInputs, + SearchInput, + PasswordInput, + ImageInput, + ArrayInput, + SimpleFormIterator, +} from './'; +import { ImageField } from '../field'; + +export default { + title: 'ra-ui-materialui/input', +}; + +const i18nProvider = polyglotI18nProvider(() => englishMessages); + +export const AllInputs = () => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); diff --git a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx index b3cda7e8c2f..a3b1fcffe4f 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx @@ -213,6 +213,9 @@ const StyledForm = styled('form', { })(({ theme }) => ({ display: 'flex', flex: '0 1 auto', + [theme.breakpoints.down('sm')]: { + width: '100%', + }, [theme.breakpoints.up('md')]: { flex: '0 1 100%', }, diff --git a/packages/ra-ui-materialui/src/list/filter/FilterFormInput.tsx b/packages/ra-ui-materialui/src/list/filter/FilterFormInput.tsx index d71ea6ad4d3..8d1f8c3ba17 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterFormInput.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterFormInput.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { styled } from '@mui/material/styles'; import PropTypes from 'prop-types'; -import IconButton from '@mui/material/IconButton'; +import { IconButton } from '@mui/material'; import ActionHide from '@mui/icons-material/HighlightOff'; import clsx from 'clsx'; import { useResourceContext, useTranslate } from 'ra-core'; @@ -64,6 +64,9 @@ const Root = styled('div', { display: 'flex', alignItems: 'flex-end', pointerEvents: 'auto', + [theme.breakpoints.down('sm')]: { + width: '100%', + }, [`& .${FilterFormInputClasses.spacer}`]: { width: theme.spacing(2) }, [`& .${FilterFormInputClasses.hideButton}`]: {