@@ -188,6 +188,10 @@ export function getMuiDsfrThemeOptions(params: {
188188 "displayedRows" : {
189189 //Fixes: https://user-images.githubusercontent.com/6702424/206063347-65e7d13c-3dea-410c-a0e0-51cf214deba0.png
190190 "margin" : "unset"
191+ } ,
192+ "selectLabel" : {
193+ //Fixes: https://github.com/codegouvfr/react-dsfr/assets/6702424/678a7f69-d4e8-4897-85f0-65c605b46900
194+ "margin" : "unset"
191195 }
192196 }
193197 } ,
@@ -215,25 +219,89 @@ export function getMuiDsfrThemeOptions(params: {
215219 const nonTypedMuiComponents = {
216220 "MuiDataGrid" : {
217221 "styleOverrides" : {
222+ "root" : ( ( ) => {
223+ const set = new WeakSet < Function > ( ) ;
224+
225+ const borderNone = {
226+ "border" : "none"
227+ } ;
228+
229+ return ( params : {
230+ ownerState ?: {
231+ getRowClassName ?: ( params : {
232+ indexRelativeToCurrentPage : number ;
233+ } ) => string ;
234+ } ;
235+ } ) => {
236+ const { ownerState } = params ;
237+
238+ if ( ownerState === undefined ) {
239+ return borderNone ;
240+ }
241+
242+ if (
243+ ownerState . getRowClassName === undefined ||
244+ ! set . has ( ownerState . getRowClassName )
245+ ) {
246+ const originalGetRowClassName = ownerState . getRowClassName ;
247+
248+ ownerState . getRowClassName = params => {
249+ const { indexRelativeToCurrentPage } = params ;
250+
251+ const parityClassName =
252+ indexRelativeToCurrentPage % 2 === 0
253+ ? "even"
254+ : "odd" ;
255+
256+ const className = originalGetRowClassName ?.( params ) ;
257+
258+ return className === undefined
259+ ? parityClassName
260+ : `${ parityClassName } ${ className } ` ;
261+ } ;
262+
263+ set . add ( ownerState . getRowClassName ) ;
264+ }
265+
266+ return borderNone ;
267+ } ;
268+ } ) ( ) ,
218269 "columnHeaders" : {
219270 "backgroundColor" : decisions . background . contrast . grey . default ,
271+ "&&" : {
220272 "borderColor" : decisions . border . plain . grey . default ,
221273 "borderPosition" : "bottom" ,
222274 "borderWidth" : 2
275+ }
223276 } ,
224- "row" : {
225- "&:nth-of-type(2n)" : {
226- "backgroundColor" : decisions . background . contrast . grey . default ,
227- "&:hover" : {
228- "backgroundColor" : decisions . background . contrast . grey . hover
229- }
230- } ,
231- "&:nth-of-type(odd)" : {
232- "backgroundColor" : decisions . background . alt . grey . default ,
233- "&:hover" : {
234- "backgroundColor" : decisions . background . alt . grey . hover
277+ "row" : ( ) => {
278+ const hoveredAndSelected = {
279+ "&.Mui-hovered" : {
280+ "backgroundColor" : fr . colors . decisions . background . contrast . grey . hover
281+ } ,
282+ "&.Mui-selected" : {
283+ "backgroundColor" : fr . colors . decisions . background . contrast . grey . active
284+ } ,
285+ } ;
286+
287+ return {
288+ "&.even" : {
289+ "backgroundColor" :
290+ decisions . background . contrast . grey . default ,
291+ "&:hover" : {
292+ "backgroundColor" :
293+ decisions . background . contrast . grey . hover
294+ } ,
295+ ...hoveredAndSelected
296+ } ,
297+ "&.odd" : {
298+ "backgroundColor" : decisions . background . alt . grey . default ,
299+ "&:hover" : {
300+ "backgroundColor" : decisions . background . alt . grey . hover
301+ } ,
302+ ...hoveredAndSelected
235303 }
236- }
304+ } ;
237305 } ,
238306 "columnSeparator" : {
239307 "display" : "none"
0 commit comments