cozy-ui 123.0.0 → 123.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,245 +1,1156 @@
1
- import merge from 'lodash/merge'
2
-
3
- import { makeLightNormalCozyOverrides } from './makeLightNormalCozyOverrides'
4
1
  import { alpha, darken } from '../../styles'
2
+ import {
3
+ makeAlertColor,
4
+ makeChipStyleByColor,
5
+ makeSecondaryButtonStyle,
6
+ makeTextButtonStyle,
7
+ makeContainedButtonStyle,
8
+ getFlagshipCssVar
9
+ } from '../helpers'
5
10
 
6
- export const makeLightNormalOverrides = theme => {
7
- const makeOverrides = theme => ({
8
- MuiCheckbox: {
9
- root: {
10
- padding: 8
11
- }
11
+ export const makeLightNormalOverrides = theme => ({
12
+ MuiSelect: {
13
+ iconOutlined: {
14
+ top: 'auto',
15
+ right: 14
12
16
  },
13
- MuiSwitch: {
14
- root: {
15
- width: 50,
16
- height: 40,
17
- padding: '6px 1px'
18
- },
19
- switchBase: {
20
- padding: 5,
21
- top: 5,
22
- color: theme.palette.text.icon,
23
- '& .cozySwitchThumb': {
24
- display: 'flex',
25
- alignItems: 'center',
26
- justifyContent: 'center',
27
- width: 20,
28
- height: 20,
29
- borderRadius: '50%',
30
- boxShadow: theme.shadows[1],
31
- backgroundColor: theme.palette.common.white
32
- }
17
+ outlined: {
18
+ '&&': {
19
+ paddingRight: 39
20
+ }
21
+ }
22
+ },
23
+ MuiOutlinedInput: {
24
+ root: {
25
+ borderRadius: 4,
26
+ '&$disabled': {
27
+ background: theme.palette.background.contrast
33
28
  },
34
- track: {
35
- width: 44,
36
- height: '100%',
37
- borderRadius: 100
29
+ '&$focused $notchedOutline': {
30
+ borderWidth: '0.0625rem'
38
31
  },
39
- thumb: {
40
- width: 20,
41
- height: 20
32
+ '&$error $notchedOutline': {
33
+ borderColor: alpha(
34
+ theme.palette.error.main,
35
+ theme.palette.border.opacity
36
+ )
42
37
  },
43
- colorPrimary: {
44
- '&$disabled + $track': {
45
- opacity: 1,
46
- backgroundColor: theme.palette.action.disabledBackground
38
+ '&$focused&$error $notchedOutline': {
39
+ borderColor: theme.palette.error.main
40
+ },
41
+ '&:hover $notchedOutline': {
42
+ borderColor: theme.palette.text.hint
43
+ },
44
+ '&:hover&$error $notchedOutline': {
45
+ borderColor: theme.palette.error.main
46
+ }
47
+ },
48
+ notchedOutline: {
49
+ borderColor: theme.palette.border.main,
50
+ transition: `border-color ${theme.transitions.duration.shorter}ms`
51
+ },
52
+ input: {
53
+ textAlign: 'left',
54
+ padding: '18.5px 16px'
55
+ },
56
+ inputMarginDense: {
57
+ paddingTop: 14,
58
+ paddingBottom: 15
59
+ }
60
+ },
61
+ MuiInputLabel: {
62
+ outlined: {
63
+ '&$marginDense': {
64
+ transform: 'translate(14px, 14px) scale(1)'
65
+ },
66
+ '&:not($shrink)': {
67
+ '&$error': {
68
+ color: theme.palette.text.secondary
69
+ }
70
+ }
71
+ }
72
+ },
73
+ MuiToggleButtonGroup: {
74
+ groupedHorizontal: {
75
+ '&.rounded': {
76
+ marginRight: 12,
77
+ '&:last-child': {
78
+ marginRight: 0
79
+ },
80
+ '&:not(:first-child)': {
81
+ borderTopLeftRadius: 'inherit',
82
+ borderBottomLeftRadius: 'inherit',
83
+ marginLeft: 'inherit',
84
+ borderLeft: 'inherit'
85
+ },
86
+ '&:not(:last-child)': {
87
+ '&.rounded': {
88
+ borderTopRightRadius: 'inherit',
89
+ borderBottomRightRadius: 'inherit'
90
+ }
91
+ }
92
+ }
93
+ }
94
+ },
95
+ MuiToggleButton: {
96
+ root: {
97
+ borderRadius: 0,
98
+ color: theme.palette.text.secondary,
99
+ border: `1px solid ${theme.palette.border.main}`,
100
+ padding: 15,
101
+ '&$selected': {
102
+ color: theme.palette.text.primary,
103
+ backgroundColor: 'transparent',
104
+ '&:not($disabled)': {
105
+ '&.customColor': {
106
+ '&-primary': {
107
+ color: theme.palette.primary.main
108
+ }
109
+ }
47
110
  }
48
111
  },
49
- colorSecondary: {
50
- '&$checked': {
51
- color: theme.palette.success.main
112
+ '&$disabled': {
113
+ color: theme.palette.text.disabled
114
+ },
115
+ '&.rounded': {
116
+ border: 0,
117
+ borderRadius: theme.shape.borderRadius,
118
+ padding: '10px 12px',
119
+ '&$selected': {
120
+ backgroundColor: theme.palette.action.selected,
121
+ '&:not($disabled)': {
122
+ '&.customColor': {
123
+ '&-primary': {
124
+ color: theme.palette.text.primary,
125
+ backgroundColor: alpha(
126
+ theme.palette.primary.main,
127
+ theme.palette.action.selectedOpacity
128
+ ),
129
+ '&:hover': {
130
+ textDecoration: 'none',
131
+ backgroundColor: alpha(
132
+ theme.palette.primary.main,
133
+ theme.palette.action.activatedOpacity
134
+ ),
135
+ '@media (hover: none)': {
136
+ backgroundColor: 'transparent'
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ },
145
+ sizeSmall: {
146
+ padding: 11,
147
+ '&.rounded': {
148
+ padding: '7px 10px'
149
+ }
150
+ },
151
+ sizeLarge: {
152
+ padding: 19,
153
+ '&.rounded': {
154
+ padding: 12
155
+ }
156
+ }
157
+ },
158
+ MuiButton: {
159
+ root: {
160
+ borderRadius: 100,
161
+
162
+ lineHeight: 'normal',
163
+ padding: '10px 24px',
164
+ '&.customSize': {
165
+ '&-default': {
166
+ height: '2.5rem'
52
167
  },
53
- '&$disabled + $track': {
54
- opacity: 1,
55
- backgroundColor: theme.palette.action.disabledBackground
168
+ '&-auto': {
169
+ minHeight: '2.5rem'
56
170
  }
57
171
  },
58
- disabled: {
59
- '&$checked + $track': {
60
- backgroundColor: theme.palette.action.disabledBackground
172
+ '&.ghost': {
173
+ border: 0,
174
+ // borderStyle: 'dashed !important', // important needed to override disable state
175
+ '&:hover': {
176
+ border: 0
177
+ // borderStyle: 'dashed !important' // important needed to override disable state
178
+ }
179
+ }
180
+ },
181
+ sizeSmall: {
182
+ padding: '10px 16px',
183
+ '&.customSize': {
184
+ '&-default': {
185
+ height: '2.25rem'
61
186
  },
62
- '& .cozySwitchThumb': {
63
- backgroundColor: theme.palette.background.default
187
+ '&-auto': {
188
+ minHeight: '2.25rem'
64
189
  }
190
+ },
191
+ '&$text': {
192
+ padding: '8px 16px'
65
193
  }
66
194
  },
67
- MuiLinearProgress: {
68
- root: {
69
- height: 3
195
+ sizeLarge: {
196
+ padding: '14px 32px',
197
+ '&.customSize': {
198
+ '&-default': {
199
+ height: '3rem'
200
+ },
201
+ '&-auto': {
202
+ minHeight: '3rem'
203
+ }
70
204
  },
71
- colorPrimary: {
72
- backgroundColor: theme.palette.divider
205
+ '&$text': {
206
+ padding: '14px 10px'
73
207
  }
74
208
  },
75
- MuiButton: {
76
- root: {
77
- borderRadius: 100,
78
- padding: '10px 24px',
209
+ text: {
210
+ minWidth: 'auto',
211
+ padding: '10px 8px',
212
+ '&:not($disabled)': {
213
+ '&.customColor': {
214
+ '&-success': makeTextButtonStyle(theme, 'success'),
215
+ '&-warning': makeTextButtonStyle(theme, 'warning'),
216
+ '&-error': makeTextButtonStyle(theme, 'error'),
217
+ '&-info': makeTextButtonStyle(theme, 'info')
218
+ }
219
+ }
220
+ },
221
+ outlined: {
222
+ '&:not($disabled)': {
79
223
  '&.ghost': {
80
- border: 0,
224
+ backgroundColor: theme.palette.background.default,
81
225
  '&:hover': {
82
- border: 0
226
+ backgroundColor: darken(theme.palette.background.default, 0.05),
227
+ '@media (hover: none)': {
228
+ backgroundColor: darken(theme.palette.background.default, 0.05)
229
+ }
83
230
  }
231
+ },
232
+ '&.customColor': {
233
+ '&-primary': {
234
+ color: theme.palette.primary.main,
235
+ borderColor: theme.palette.primary.main,
236
+ '&:hover': {
237
+ backgroundColor: alpha(
238
+ theme.palette.primary.main,
239
+ theme.palette.action.hoverOpacity
240
+ ),
241
+ '@media (hover: none)': {
242
+ backgroundColor: 'transparent'
243
+ }
244
+ },
245
+ '&.ghost': {
246
+ color: theme.palette.text.primary,
247
+ borderColor: theme.palette.background.default
248
+ }
249
+ },
250
+ '&-success': makeSecondaryButtonStyle(theme, 'success'),
251
+ '&-warning': makeSecondaryButtonStyle(theme, 'warning'),
252
+ '&-error': makeSecondaryButtonStyle(theme, 'error'),
253
+ '&-info': makeSecondaryButtonStyle(theme, 'info')
254
+ }
255
+ }
256
+ },
257
+ contained: {
258
+ boxShadow: 0,
259
+ '&:not($disabled)': {
260
+ '&.customColor': {
261
+ '&-success': makeContainedButtonStyle(theme, 'success'),
262
+ '&-warning': makeContainedButtonStyle(theme, 'warning'),
263
+ '&-error': makeContainedButtonStyle(theme, 'error'),
264
+ '&-info': makeContainedButtonStyle(theme, 'info')
84
265
  }
266
+ }
267
+ },
268
+ startIcon: {
269
+ // !important needed to override all sizes
270
+ // should be remove when https://github.com/cozy/cozy-ui/issues/1808 is fixed
271
+ marginLeft: '0 !important'
272
+ }
273
+ },
274
+ MuiTabs: {
275
+ root: {
276
+ '&.segmented': {
277
+ borderRadius: '99px',
278
+ backgroundColor: theme.palette.background.contrast,
279
+ overflow: 'visible',
280
+ minHeight: '2.5rem',
281
+ '& $indicator': {
282
+ top: '1px',
283
+ height: 'calc(100% - 2px)',
284
+ transform: 'scale(0.99)',
285
+ borderRadius: '99px',
286
+ zIndex: 0,
287
+ boxShadow: theme.shadows[1],
288
+ backgroundColor: theme.palette.background.paper
289
+ },
290
+ '& $fixed': {
291
+ overflow: 'visible !important'
292
+ },
293
+ '& $scrollButtons': {
294
+ borderRadius: '99px'
295
+ }
296
+ }
297
+ }
298
+ },
299
+ MuiTab: {
300
+ root: {
301
+ ...theme.typography.subtitle2,
302
+ '&:hover': {
303
+ color: theme.palette.text.primary,
304
+ opacity: 1
85
305
  },
86
- sizeSmall: {
87
- padding: '10px 16px',
88
- '&.customSize': {
89
- '&-default': {
90
- height: '2.25rem'
91
- },
92
- '&-auto': {
93
- minHeight: '2.25rem'
306
+ '&:focus': {
307
+ color: theme.palette.text.primary
308
+ },
309
+ '&.narrowed': {
310
+ minWidth: 'auto',
311
+ [theme.breakpoints.up('sm')]: {
312
+ minWidth: 'auto'
313
+ }
314
+ },
315
+ '&.segmented': {
316
+ ...theme.typography.body2,
317
+ textTransform: 'initial',
318
+ zIndex: 1,
319
+ borderRadius: '99px',
320
+ minHeight: '2.5rem',
321
+ '&$selected': {
322
+ color: theme.palette.text.primary
323
+ }
324
+ }
325
+ }
326
+ },
327
+ MuiAccordion: {
328
+ rounded: {
329
+ borderRadius: theme.shape.borderRadius
330
+ },
331
+ root: {
332
+ boxShadow: '0 4px 12px 0 rgba(0, 0, 0, 0.08)',
333
+ borderWidth: '0.0625rem',
334
+ borderStyle: 'solid',
335
+ borderColor: theme.palette.border.main,
336
+ overflow: 'hidden',
337
+ marginBottom: '1rem'
338
+ }
339
+ },
340
+ MuiAccordionSummary: {
341
+ expanded: {},
342
+ root: {
343
+ backgroundColor: theme.palette.grey[100],
344
+ textTransform: 'uppercase',
345
+ fontWeight: 'bold',
346
+ fontSize: '0.875rem',
347
+ minHeight: '3.5rem',
348
+ padding: 0,
349
+ color: theme.palette.text.primary,
350
+ '&$expanded': {
351
+ minHeight: '3.5rem'
352
+ }
353
+ },
354
+ expandIcon: {
355
+ order: 0,
356
+ '&&': {
357
+ marginLeft: '0.3125rem'
358
+ },
359
+ transform: 'rotate(-90deg)',
360
+ '&$expanded': {
361
+ marginLeft: '0.3125rem',
362
+ transform: 'rotate(0)'
363
+ }
364
+ },
365
+ content: {
366
+ margin: '0.75rem 0',
367
+ paddingLeft: '0.5rem',
368
+ paddingRight: '0.25rem',
369
+ order: 1,
370
+ '& > :last-child': {
371
+ paddingRight: 0
372
+ },
373
+ '&$expanded': {
374
+ margin: '0.75rem 0'
375
+ }
376
+ }
377
+ },
378
+ MuiAccordionDetails: {
379
+ root: {
380
+ padding: 0,
381
+ borderTop: `0.0625rem solid ${theme.palette.border.main}`
382
+ }
383
+ },
384
+ MuiStepConnector: {
385
+ line: {
386
+ borderColor: theme.palette.divider
387
+ }
388
+ },
389
+ MuiStepContent: {
390
+ root: {
391
+ borderColor: theme.palette.divider
392
+ }
393
+ },
394
+ MuiStepLabel: {
395
+ label: {
396
+ ...theme.typography.body1,
397
+ '&$active': {
398
+ ...theme.typography.h6
399
+ },
400
+ '&$completed': {
401
+ ...theme.typography.h6
402
+ }
403
+ }
404
+ },
405
+ MuiListItemIcon: {
406
+ root: {
407
+ minWidth: 'auto',
408
+ width: 32,
409
+ height: 32,
410
+ alignItems: 'center',
411
+ justifyContent: 'center',
412
+ color: theme.palette.text.icon
413
+ }
414
+ },
415
+ MuiListItem: {
416
+ root: {
417
+ gap: 16,
418
+ paddingTop: 12,
419
+ paddingBottom: 12,
420
+ minHeight: 56,
421
+ '&.small': {
422
+ paddingTop: 8,
423
+ paddingBottom: 8,
424
+ minHeight: 48
425
+ },
426
+ '&.large': {
427
+ paddingTop: 16,
428
+ paddingBottom: 16,
429
+ minHeight: 64
430
+ },
431
+ '&.cozyActionsItem': {
432
+ wordBreak: 'break-word'
433
+ }
434
+ },
435
+ dense: {
436
+ paddingTop: 8,
437
+ paddingBottom: 8,
438
+ minHeight: 48,
439
+ '&.small': {
440
+ paddingTop: 4,
441
+ paddingBottom: 4,
442
+ minHeight: 40
443
+ },
444
+ '&.large': {
445
+ paddingTop: 12,
446
+ paddingBottom: 12,
447
+ minHeight: 56
448
+ }
449
+ }
450
+ },
451
+ MuiListSubheader: {
452
+ root: {
453
+ ...theme.typography.subtitle2,
454
+ paddingBottom: 8,
455
+ paddingTop: 8,
456
+ marginBottom: '0.5rem',
457
+ backgroundColor: theme.palette.background.contrast
458
+ },
459
+ sticky: {
460
+ backgroundColor: theme.palette.background.default
461
+ }
462
+ },
463
+ MuiListItemText: {
464
+ root: {
465
+ marginTop: 1,
466
+ marginBottom: 1
467
+ },
468
+ multiline: {
469
+ marginTop: 1,
470
+ marginBottom: 1
471
+ },
472
+ secondary: {
473
+ marginTop: 1
474
+ }
475
+ },
476
+ MuiListItemSecondaryAction: {
477
+ root: {
478
+ right: 0
479
+ }
480
+ },
481
+ MuiMenu: {
482
+ paper: {
483
+ maxWidth: 320
484
+ }
485
+ },
486
+ MuiMenuItem: {
487
+ root: {
488
+ whiteSpace: 'normal',
489
+ overflow: 'auto',
490
+ wordBreak: 'break-word',
491
+ paddingTop: 4,
492
+ paddingBottom: 4,
493
+ [theme.breakpoints.up('sm')]: {
494
+ minHeight: 40
495
+ },
496
+ '&.cozyActionsItem': {
497
+ minWidth: 256
498
+ },
499
+ '& .cozyListItemIcon': {
500
+ width: 16,
501
+ height: 16
502
+ }
503
+ },
504
+ gutters: {
505
+ paddingLeft: 16,
506
+ paddingRight: 16
507
+ }
508
+ },
509
+ MuiFormLabel: {
510
+ root: {
511
+ color: theme.palette.text.secondary,
512
+ '&$disabled&$error': {
513
+ color: theme.palette.text.disabled
514
+ }
515
+ }
516
+ },
517
+ MuiFormHelperText: {
518
+ root: {
519
+ fontStyle: 'italic',
520
+ fontSize: '0.875rem',
521
+ marginTop: 4,
522
+ '&$disabled&$error': {
523
+ color: theme.palette.text.disabled
524
+ }
525
+ }
526
+ },
527
+ MuiDialog: {
528
+ paper: {
529
+ '&.small': {
530
+ width: '480px',
531
+ maxWidth: '480px',
532
+ [theme.breakpoints.down('md')]: {
533
+ margin: '16px',
534
+ padding: '0 8px 8px',
535
+ height: 'auto',
536
+ maxHeight: 'calc(100% - 32px)',
537
+ borderRadius: '6px',
538
+ '& .divider--dialog': {
539
+ marginLeft: '-8px',
540
+ marginRight: '-8px'
94
541
  }
95
- },
96
- '&$text': {
97
- padding: '8px 16px'
98
542
  }
99
543
  },
100
- sizeLarge: {
101
- padding: '14px 32px'
544
+ '&.medium': {
545
+ [theme.breakpoints.up('md')]: {
546
+ width: '544px',
547
+ maxWidth: '544px'
548
+ }
102
549
  },
103
- text: {
104
- padding: '10px 8px'
550
+ '&.large': {
551
+ [theme.breakpoints.up('md')]: {
552
+ width: '800px',
553
+ maxWidth: '800px'
554
+ }
105
555
  },
106
- outlined: {
107
- '&:not($disabled)': {
108
- '&.ghost': {
109
- backgroundColor: theme.palette.background.default,
110
- '&:hover': {
111
- backgroundColor: darken(theme.palette.background.default, 0.05),
112
- '@media (hover: none)': {
113
- backgroundColor: darken(theme.palette.background.default, 0.05)
114
- }
115
- }
116
- },
117
- '&.customColor': {
118
- '&-primary': {
119
- color: theme.palette.primary.main,
120
- borderColor: theme.palette.primary.main,
121
- '&:hover': {
122
- backgroundColor: alpha(
123
- theme.palette.primary.main,
124
- theme.palette.action.hoverOpacity
125
- )
126
- },
127
- '&.ghost': {
128
- color: theme.palette.text.primary,
129
- borderColor: theme.palette.background.default
556
+ '&.full': {
557
+ width: '100%',
558
+ maxWidth: '100%'
559
+ }
560
+ },
561
+ scrollPaper: {
562
+ '&.alignTop': {
563
+ alignItems: 'start'
564
+ }
565
+ },
566
+ paperFullScreen: {
567
+ '& .cozyDialogActions': {
568
+ paddingBottom: `calc(env(safe-area-inset-bottom) + ${getFlagshipCssVar(
569
+ 'bottom'
570
+ )})`
571
+ },
572
+ // Can't do that within the stylus file because we need to only target
573
+ // the fullscreen dialog
574
+ '& [class*="DialogCloseButton"]': {
575
+ transform: `translateY(${getFlagshipCssVar('top')})`
576
+ },
577
+ '& [class*="DialogBackButton"]': {
578
+ transform: `translateY(${getFlagshipCssVar('top')})`
579
+ },
580
+ // 0.75rm === MuiDialogTitle.root.sm
581
+ // we should not target specifically flagship-app since
582
+ // we should only rely on the css var. But this is for
583
+ // another time.
584
+ '.flagship-app & .cozyDialogTitle': {
585
+ paddingTop: `calc(${getFlagshipCssVar('top')} + 0.75rem) !important`
586
+ },
587
+ '.flagship-app & .cozyDialogContent': {
588
+ marginBottom: `${getFlagshipCssVar('bottom')} !important`
589
+ }
590
+ }
591
+ },
592
+ MuiDialogTitle: {
593
+ root: {
594
+ ...theme.typography.h3,
595
+ boxSizing: 'border-box',
596
+ width: '100%',
597
+ padding: '1.5rem 2rem',
598
+ [theme.breakpoints.down('sm')]: {
599
+ ...theme.typography.h4,
600
+ padding: '0.75rem 1rem'
601
+ },
602
+ '&.dialogTitleWithBack': {
603
+ paddingLeft: '4rem', // padding base (2rem) + buttonWidth (1rem) + buttonMargin (1rem)
604
+ [theme.breakpoints.down('sm')]: {
605
+ paddingLeft: '3rem' // padding base (1rem) + buttonWidth (1rem) + buttonMargin (1rem)
606
+ }
607
+ },
608
+ '&.dialogTitleWithClose': {
609
+ paddingRight: '4rem', // padding base (2rem) + buttonWidth (1rem) + buttonMargin (1rem)
610
+ [theme.breakpoints.down('sm')]: {
611
+ paddingRight: '3rem' // padding base (1rem) + buttonWidth (1rem) + buttonMargin (1rem)
612
+ }
613
+ },
614
+ '&.dialogTitleFluid': {
615
+ paddingTop: 0
616
+ }
617
+ }
618
+ },
619
+ MuiDialogContent: {
620
+ root: {
621
+ padding: '24px 32px 0',
622
+ [theme.breakpoints.down('sm')]: {
623
+ padding: '24px 16px 0'
624
+ },
625
+ '&.disableGutters': {
626
+ padding: 0,
627
+ '& .dialogContentInner': {
628
+ marginBottom: 0
629
+ },
630
+ '& .dialogTitleFluidContainer': {
631
+ marginLeft: 0,
632
+ marginRight: 0,
633
+ marginTop: 0
634
+ }
635
+ },
636
+ '& .dialogContentInner': {
637
+ marginBottom: '24px',
638
+ '&.withFluidActions': {
639
+ [theme.breakpoints.down('sm')]: {
640
+ marginBottom: 0,
641
+ display: 'flex',
642
+ flexDirection: 'column',
643
+ height: '100%',
644
+ '& .dialogContentWrapper': {
645
+ flexGrow: 1,
646
+ '&:not(.withActions)': {
647
+ paddingBottom: `calc(env(safe-area-inset-bottom) + ${getFlagshipCssVar(
648
+ 'bottom'
649
+ )} + 16px)`
130
650
  }
651
+ },
652
+ '& .cozyDialogActions': {
653
+ paddingBottom: `calc(env(safe-area-inset-bottom) + ${getFlagshipCssVar(
654
+ 'bottom'
655
+ )} + 16px)`
131
656
  }
132
657
  }
658
+ },
659
+ '& .dialogTitleFluidContainer': {
660
+ marginLeft: '-2rem',
661
+ marginRight: '-2rem',
662
+ [theme.breakpoints.down('sm')]: {
663
+ marginLeft: '-1rem',
664
+ marginRight: '-1rem',
665
+ marginTop: '-0.75rem'
666
+ }
667
+ }
668
+ }
669
+ }
670
+ },
671
+ MuiDialogActions: {
672
+ root: {
673
+ margin: '16px 32px',
674
+ padding: 0,
675
+ [theme.breakpoints.down('sm')]: {
676
+ margin: '8px 16px',
677
+ '& button': {
678
+ flexGrow: 1
679
+ }
680
+ },
681
+ '&.dialogActionsFluid': {
682
+ margin: '24px 0 0'
683
+ },
684
+ '&.columnLayout': {
685
+ display: 'flex',
686
+ flexDirection: 'column-reverse',
687
+ '& button': {
688
+ width: '100%',
689
+ margin: 0,
690
+ '&:not(:first-child)': {
691
+ marginBottom: '8px'
692
+ }
693
+ }
694
+ },
695
+
696
+ // To keep muiV3 behavior
697
+ // TODO check later if we need this behavior
698
+ '&:not(.columnLayout) > :not(:first-child):not(:first-child)': {
699
+ marginLeft: 4
700
+ }
701
+ }
702
+ },
703
+ MuiDivider: {
704
+ inset: {
705
+ marginLeft: 64,
706
+ '&.divider--dialog': {
707
+ marginLeft: 80
708
+ }
709
+ }
710
+ },
711
+ MuiAvatarGroup: {
712
+ root: {
713
+ '& > div:last-child': {
714
+ boxShadow: `inset 0px 0px 0px 1px ${theme.palette.border.main}`
715
+ }
716
+ },
717
+ avatar: {
718
+ border: `2px solid ${theme.palette.background.paper}`
719
+ }
720
+ },
721
+ MuiAvatar: {
722
+ root: {
723
+ fontWeight: 600,
724
+ '&.size': {
725
+ '&-xs': {
726
+ width: 16,
727
+ height: 16,
728
+ fontSize: 8,
729
+ '& svg': {
730
+ width: 10,
731
+ height: 10
732
+ }
733
+ },
734
+ '&-s': {
735
+ width: 24,
736
+ height: 24,
737
+ fontSize: 11,
738
+ '& svg': {
739
+ width: 16,
740
+ height: 16
741
+ }
742
+ },
743
+ '&-m': {
744
+ width: 32,
745
+ height: 32,
746
+ fontSize: 16,
747
+ '& svg': {
748
+ width: 20,
749
+ height: 20
750
+ }
751
+ },
752
+ '&-l': {
753
+ width: 48,
754
+ height: 48,
755
+ fontSize: 24,
756
+ '& svg': {
757
+ width: 28,
758
+ height: 28
759
+ }
760
+ },
761
+ '&-xl': {
762
+ width: 64,
763
+ height: 64,
764
+ fontSize: 32,
765
+ '& svg': {
766
+ width: 36,
767
+ height: 36
768
+ }
133
769
  }
770
+ },
771
+ '&.disabled': {
772
+ color: theme.palette.primary.contrastText,
773
+ background: 'var(--silver)', // should be semantic but used legacy component color for now
774
+ '& img': {
775
+ filter: 'grayscale(1) brightness(2)',
776
+ opacity: 0.5
777
+ }
778
+ },
779
+ '&.border': {
780
+ border: `2px solid ${theme.palette.background.paper}`
781
+ },
782
+ '&.innerBorder': {
783
+ boxShadow: `inset 0px 0px 0px 1px ${theme.palette.border.main}`
784
+ }
785
+ },
786
+ colorDefault: {
787
+ backgroundColor: theme.palette.background.paper,
788
+ color: theme.palette.text.secondary
789
+ }
790
+ },
791
+ MuiCheckbox: {
792
+ root: {
793
+ padding: 8
794
+ },
795
+ colorSecondary: {
796
+ '&$checked': {
797
+ color: theme.palette.error.main
798
+ }
799
+ }
800
+ },
801
+ MuiSwitch: {
802
+ root: {
803
+ width: 50,
804
+ height: 40,
805
+ padding: '6px 1px'
806
+ },
807
+ checked: {
808
+ '& + $track$track': {
809
+ opacity: 1
810
+ }
811
+ },
812
+ switchBase: {
813
+ padding: 5,
814
+ top: 5,
815
+ color: theme.palette.text.icon,
816
+ '& .cozySwitchThumb': {
817
+ display: 'flex',
818
+ alignItems: 'center',
819
+ justifyContent: 'center',
820
+ width: 20,
821
+ height: 20,
822
+ borderRadius: '50%',
823
+ boxShadow: theme.shadows[1],
824
+ backgroundColor: theme.palette.common.white
825
+ },
826
+ '&$checked': {
827
+ transform: 'translateX(15px)'
828
+ }
829
+ },
830
+ thumb: {
831
+ width: 20,
832
+ height: 20,
833
+ backgroundColor: theme.palette.common.white
834
+ },
835
+ track: {
836
+ width: 44,
837
+ height: '100%',
838
+ borderRadius: 100,
839
+ opacity: 1,
840
+ backgroundColor: theme.palette.text.disabled
841
+ },
842
+ colorPrimary: {
843
+ '&$disabled + $track': {
844
+ opacity: 1,
845
+ backgroundColor: theme.palette.action.disabledBackground
134
846
  }
135
847
  },
136
- MuiIconButton: {
137
- root: {
138
- '&.small': {
139
- padding: 8
848
+ colorSecondary: {
849
+ '&$checked': {
850
+ color: theme.palette.success.main,
851
+ '&$disabled + $track': {
852
+ opacity: 1,
853
+ backgroundColor: theme.palette.action.disabledBackground
140
854
  },
141
- '&.xlarge': {
142
- padding: 20
855
+ '& + $track': {
856
+ backgroundColor: theme.palette.success.main
143
857
  }
144
858
  }
145
859
  },
146
- MuiTooltip: {
147
- tooltip: {
148
- backgroundColor: alpha(theme.palette.grey[800], 0.9),
149
- borderRadius: '4px',
150
- padding: '8px 12px'
860
+ disabled: {
861
+ '&$checked + $track': {
862
+ backgroundColor: theme.palette.action.disabledBackground
863
+ },
864
+ '& .cozySwitchThumb': {
865
+ backgroundColor: theme.palette.background.default
866
+ },
867
+ '& $thumb': {
868
+ backgroundColor: theme.palette.common.white
151
869
  }
870
+ }
871
+ },
872
+ MuiLinearProgress: {
873
+ root: {
874
+ height: 3
152
875
  },
153
- MuiFab: {
154
- root: {
155
- borderRadius: 28,
156
- width: 96,
157
- height: 96
876
+ colorPrimary: {
877
+ backgroundColor: theme.palette.divider
878
+ }
879
+ },
880
+ MuiTooltip: {
881
+ tooltip: {
882
+ backgroundColor: alpha(theme.palette.grey[800], 0.9),
883
+ fontSize: '1rem',
884
+ lineHeight: '1.3',
885
+ borderRadius: '4px',
886
+ padding: '8px 12px'
887
+ }
888
+ },
889
+ MuiIconButton: {
890
+ root: {
891
+ color: theme.palette.text.secondary,
892
+ '&.small': {
893
+ padding: 8
894
+ },
895
+ '&.medium': {
896
+ padding: 12
897
+ },
898
+ '&.large': {
899
+ padding: 16
158
900
  },
159
- primary: {
160
- color: theme.palette.primary.dark,
161
- backgroundColor: theme.palette.primary.light,
901
+ '&.xlarge': {
902
+ padding: 20
903
+ },
904
+ '&.dialogIconButton': {
905
+ backgroundColor: theme.palette.background.paper,
162
906
  '&:hover': {
163
- backgroundColor: darken(theme.palette.primary.light, 0.05),
164
- '@media (hover: none)': {
165
- backgroundColor: theme.palette.primary.light
907
+ backgroundColor: theme.palette.action.selected
908
+ }
909
+ },
910
+ '&.cozyStyles': {
911
+ '&-error': {
912
+ color: theme.palette.error.main,
913
+ '&:hover': {
914
+ backgroundColor: alpha(
915
+ theme.palette.error.main,
916
+ theme.palette.action.hoverOpacity
917
+ ),
918
+ '@media (hover: none)': {
919
+ backgroundColor: 'transparent'
920
+ }
166
921
  }
167
922
  }
923
+ }
924
+ }
925
+ },
926
+ MuiBadge: {
927
+ badge: {
928
+ boxSizing: 'content-box',
929
+ padding: 0,
930
+ borderRadius: '100%',
931
+ '&.badgeBorder': {
932
+ border: `2px solid ${theme.palette.background.paper}`
168
933
  },
169
- extended: {
170
- borderRadius: 16,
171
- '&$sizeSmall': {
172
- borderRadius: 16,
173
- height: 42,
174
- minWidth: 42
934
+ '&.badgeSizeLarge': {
935
+ fontSize: '.6875rem',
936
+ height: '1rem',
937
+ minWidth: '1rem'
938
+ },
939
+ '&.badgeSizeMedium': {
940
+ height: '.875rem',
941
+ minWidth: '.875rem',
942
+ fontSize: '.625rem'
943
+ },
944
+ '&.badgeSizeSmall': {
945
+ height: '.75rem',
946
+ minWidth: '.75rem',
947
+ fontSize: '.5rem'
948
+ }
949
+ },
950
+ colorPrimary: {
951
+ '&.colorSuccess': {
952
+ backgroundColor: theme.palette.success.main,
953
+ color: theme.palette.success.contrastText
954
+ },
955
+ '&.colorWarning': {
956
+ backgroundColor: theme.palette.warning.main,
957
+ color: theme.palette.warning.contrastText
958
+ },
959
+ '&.colorInfo': {
960
+ backgroundColor: theme.palette.info.main,
961
+ color: theme.palette.info.contrastText
962
+ }
963
+ },
964
+ anchorOriginTopRightRectangular: {
965
+ transform: 'scale(1) translate(37%, -37%)'
966
+ },
967
+ anchorOriginBottomRightRectangular: {
968
+ transform: 'scale(1) translate(37%, 37%)'
969
+ },
970
+ anchorOriginBottomLeftRectangular: {
971
+ transform: 'scale(1) translate(-37%, 37%)'
972
+ },
973
+ anchorOriginTopLeftRectangular: {
974
+ transform: 'scale(1) translate(-37%, -37%)'
975
+ },
976
+ dot: {
977
+ borderRadius: '100%',
978
+ padding: 0,
979
+ '&.badgeSizeLarge': {
980
+ height: '.625rem',
981
+ minWidth: '.625rem'
982
+ },
983
+ '&.badgeSizeMedium': {
984
+ height: '.5rem',
985
+ minWidth: '.5rem'
986
+ },
987
+ '&.badgeSizeSmall': {
988
+ height: '.375rem',
989
+ minWidth: '.375rem'
990
+ }
991
+ }
992
+ },
993
+ MuiRadio: {
994
+ root: {
995
+ padding: '12px',
996
+ '&$disabled svg': {
997
+ borderRadius: '50%',
998
+ backgroundColor: theme.palette.background.contrast,
999
+ fill: theme.palette.border.disabled
1000
+ },
1001
+ '&:not($checked) svg': {
1002
+ fill: theme.palette.border.main
1003
+ }
1004
+ },
1005
+ colorPrimary: {
1006
+ '&$checked svg': {
1007
+ fill: theme.palette.primary.main
1008
+ },
1009
+ '&$disabled&$checked svg': {
1010
+ fill: theme.palette.text.disabled
1011
+ }
1012
+ },
1013
+ colorSecondary: {
1014
+ '&$checked svg': {
1015
+ fill: theme.palette.error.main
1016
+ },
1017
+ '&$disabled&$checked svg': {
1018
+ fill: theme.palette.text.disabled
1019
+ }
1020
+ }
1021
+ },
1022
+ MuiChip: {
1023
+ root: {
1024
+ '&.noLabel': {
1025
+ width: '32px',
1026
+ '& $label': {
1027
+ display: 'none'
175
1028
  },
176
- '&$sizeMedium': {
177
- borderRadius: 16
1029
+ '& $icon': {
1030
+ margin: 0
178
1031
  }
179
1032
  },
180
- sizeSmall: {
181
- borderRadius: 12
1033
+ '&.customColor': {
1034
+ '&-primary': makeChipStyleByColor(theme, 'primary'),
1035
+ '&-success': makeChipStyleByColor(theme, 'success'),
1036
+ '&-error': makeChipStyleByColor(theme, 'error'),
1037
+ '&-warning': makeChipStyleByColor(theme, 'warning'),
1038
+ '&-info': makeChipStyleByColor(theme, 'info')
1039
+ }
1040
+ }
1041
+ },
1042
+ MuiAlert: {
1043
+ root: {
1044
+ padding: '8px 16px',
1045
+ '&.cozyStyles': {
1046
+ '&-primary': makeAlertColor(theme, 'primary'),
1047
+ '&-secondary': makeAlertColor(theme, 'secondary'),
1048
+ '&-success': makeAlertColor(theme, 'success'),
1049
+ '&-error': makeAlertColor(theme, 'error'),
1050
+ '&-warning': makeAlertColor(theme, 'warning'),
1051
+ '&-info': makeAlertColor(theme, 'info')
182
1052
  },
183
- sizeMedium: {
184
- borderRadius: 16,
185
- width: 56,
186
- height: 56
1053
+ '& $icon': {
1054
+ paddingTop: '9px'
1055
+ },
1056
+ '&.block': {
1057
+ flexWrap: 'wrap',
1058
+ '& $action': {
1059
+ width: '100%',
1060
+ paddingLeft: 0,
1061
+ justifyContent: 'end'
1062
+ }
187
1063
  }
188
1064
  },
189
- MuiAvatarGroup: {
190
- root: {
191
- '& > div:last-child': {
192
- boxShadow: `inset 0px 0px 0px 1px ${theme.palette.border.main}`
193
- }
1065
+ message: {
1066
+ flex: 'auto',
1067
+ display: 'flex',
1068
+ alignItems: 'center',
1069
+ flexWrap: 'wrap'
1070
+ },
1071
+ action: {
1072
+ marginRight: '-8px'
1073
+ }
1074
+ },
1075
+ MuiAlertTitle: {
1076
+ root: {
1077
+ width: '100%',
1078
+ fontWeight: 'bold'
1079
+ }
1080
+ },
1081
+ MuiSnackbarContent: {
1082
+ root: {
1083
+ padding: '4px 12px',
1084
+ backgroundColor: theme.palette.grey[600]
1085
+ }
1086
+ },
1087
+ MuiFab: {
1088
+ root: {
1089
+ borderRadius: 28,
1090
+ width: 96,
1091
+ height: 96,
1092
+ color: theme.palette.text.primary,
1093
+ backgroundColor: theme.palette.background.paper,
1094
+ '&:hover': {
1095
+ backgroundColor: darken(theme.palette.background.paper, 0.05)
1096
+ },
1097
+ '@media (hover: none)': {
1098
+ backgroundColor: theme.palette.background.paper
194
1099
  }
195
1100
  },
196
- MuiAvatar: {
197
- root: {
198
- '&.size': {
199
- '&-xs': {
200
- '& svg': {
201
- width: 10,
202
- height: 10
203
- }
204
- },
205
- '&-s': {
206
- fontSize: 11,
207
- '& svg': {
208
- width: 16,
209
- height: 16
210
- }
211
- },
212
- '&-m': {
213
- '& svg': {
214
- width: 20,
215
- height: 20
216
- }
217
- },
218
- '&-l': {
219
- '& svg': {
220
- width: 28,
221
- height: 28
222
- }
223
- },
224
- '&-xl': {
225
- '& svg': {
226
- width: 36,
227
- height: 36
228
- }
229
- }
1101
+ primary: {
1102
+ color: theme.palette.primary.dark,
1103
+ backgroundColor: theme.palette.primary.light,
1104
+ '&:hover': {
1105
+ backgroundColor: darken(theme.palette.primary.light, 0.05),
1106
+ '@media (hover: none)': {
1107
+ backgroundColor: theme.palette.primary.light
230
1108
  }
1109
+ }
1110
+ },
1111
+ extended: {
1112
+ borderRadius: 16,
1113
+ height: 56,
1114
+ minWidth: 56,
1115
+ padding: '0 20px',
1116
+ '&$sizeSmall': {
1117
+ borderRadius: 16,
1118
+ height: 42,
1119
+ minWidth: 42,
1120
+ padding: '0 12px'
231
1121
  },
232
- colorDefault: {
233
- backgroundColor: theme.palette.background.paper,
234
- color: theme.palette.text.secondary
1122
+ '&$sizeMedium': {
1123
+ borderRadius: 16,
1124
+ height: 48,
1125
+ minWidth: 48,
1126
+ padding: '0 16px'
235
1127
  }
1128
+ },
1129
+ sizeSmall: {
1130
+ borderRadius: 12
1131
+ },
1132
+ sizeMedium: {
1133
+ borderRadius: 16,
1134
+ width: 56,
1135
+ height: 56
236
1136
  }
237
- })
238
-
239
- const Overrides = merge(
240
- makeLightNormalCozyOverrides(theme),
241
- makeOverrides(theme)
242
- )
243
-
244
- return Overrides
245
- }
1137
+ },
1138
+ MuiMobileStepper: {
1139
+ root: {
1140
+ background: 'transparent',
1141
+ height: 40,
1142
+ padding: 0
1143
+ },
1144
+ dot: {
1145
+ backgroundColor: 'transparent',
1146
+ width: '10px',
1147
+ height: '10px',
1148
+ margin: '0 3px',
1149
+ border: `1px solid ${theme.palette.border.main}`,
1150
+ boxSizing: 'border-box'
1151
+ },
1152
+ dotActive: {
1153
+ border: 'none'
1154
+ }
1155
+ }
1156
+ })