Skip to content

Commit a85c822

Browse files
authored
Merge pull request #10854 from marmelab/bw-inputs
Fix B&W theme label is invisible for inputs with `standard` variant
2 parents c6b1fcd + 62ffd4f commit a85c822

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

packages/ra-ui-materialui/src/theme/ThemeTester.stories.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const Wrapper = ({ children, themeName, themeType }) => {
103103
);
104104
};
105105

106-
export const ThemeTester = ({ themeName, themeType }) => (
106+
export const ThemeTester = ({ themeName, themeType, inputVariant }) => (
107107
<Wrapper themeName={themeName} themeType={themeType}>
108108
<Snackbar
109109
open
@@ -159,14 +159,15 @@ export const ThemeTester = ({ themeName, themeType }) => (
159159
<Section title="Form Inputs">
160160
<ResourceContextProvider value="posts">
161161
<SimpleForm>
162-
<TextInput source="text" />
163-
<DateInput source="date" />
162+
<TextInput source="text" variant={inputVariant} />
163+
<DateInput source="date" variant={inputVariant} />
164164
<SelectInput
165165
source="select"
166166
choices={[
167167
{ id: 1, name: 'One' },
168168
{ id: 2, name: 'Two' },
169169
]}
170+
variant={inputVariant}
170171
/>
171172
<SelectInput
172173
source="select2"
@@ -175,24 +176,30 @@ export const ThemeTester = ({ themeName, themeType }) => (
175176
{ id: 2, name: 'Two' },
176177
]}
177178
isPending
179+
variant={inputVariant}
178180
/>
179181
<RadioButtonGroupInput
180182
source="radio"
181183
choices={[
182184
{ id: 1, name: 'One' },
183185
{ id: 2, name: 'Two' },
184186
]}
187+
variant={inputVariant}
185188
/>
186189
<CheckboxGroupInput
187190
source="checkbox"
188191
choices={[
189192
{ id: 1, name: 'One' },
190193
{ id: 2, name: 'Two' },
191194
]}
195+
variant={inputVariant}
192196
/>
193-
<BooleanInput source="boolean" />
194-
<PasswordInput source="password" />
195-
<SearchInput source="search" />
197+
<BooleanInput source="boolean" variant={inputVariant} />
198+
<PasswordInput
199+
source="password"
200+
variant={inputVariant}
201+
/>
202+
<SearchInput source="search" variant={inputVariant} />
196203
</SimpleForm>
197204
</ResourceContextProvider>
198205
</Section>
@@ -228,6 +235,7 @@ export const ThemeTester = ({ themeName, themeType }) => (
228235
ThemeTester.args = {
229236
themeName: 'Default',
230237
themeType: 'light',
238+
inputVariant: 'filled',
231239
};
232240
ThemeTester.argTypes = {
233241
themeName: {
@@ -238,6 +246,10 @@ ThemeTester.argTypes = {
238246
control: 'select',
239247
options: ['light', 'dark'],
240248
},
249+
inputVariant: {
250+
control: 'select',
251+
options: ['standard', 'filled', 'outlined'],
252+
},
241253
};
242254

243255
const Separator = () => (

packages/ra-ui-materialui/src/theme/bwTheme.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ const createBWTheme = (mode: 'light' | 'dark'): ThemeOptions => {
179179
MuiListItemButton: {
180180
defaultProps: { disableRipple: true },
181181
},
182-
MuiInputBase: {
182+
MuiFormControl: {
183+
defaultProps: {
184+
margin: 'dense' as const,
185+
fullWidth: true,
186+
},
183187
styleOverrides: {
184188
root: {
185189
backgroundColor: isDarkMode ? commonBlack : commonWhite,
@@ -277,12 +281,6 @@ const createBWTheme = (mode: 'light' | 'dark'): ThemeOptions => {
277281
fullWidth: true,
278282
},
279283
},
280-
MuiFormControl: {
281-
defaultProps: {
282-
margin: 'dense' as const,
283-
fullWidth: true,
284-
},
285-
},
286284
MuiTextField: {
287285
defaultProps: {
288286
variant: 'outlined' as const,

0 commit comments

Comments
 (0)