@linagora/twake-mui 5.0.0 → 5.1.1

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.
@@ -0,0 +1,614 @@
1
+ import { menuItemClasses } from '@mui/material/MenuItem';
2
+ import { alpha, darken } from '@mui/material/styles';
3
+ import React from 'react';
4
+ import { radius } from './radius';
5
+ import AccordionExpandIcon from '../components/AccordionExpandIcon';
6
+ export const lightOverrides = {
7
+ MuiButton: {
8
+ styleOverrides: {
9
+ root: {
10
+ borderRadius: radius.pill,
11
+ boxShadow: 'none',
12
+ '&:hover': {
13
+ boxShadow: 'none'
14
+ },
15
+ '&:active': {
16
+ boxShadow: 'none'
17
+ },
18
+ '&:focus': {
19
+ boxShadow: 'none'
20
+ },
21
+ variants: [
22
+ {
23
+ props: { variant: 'contained', color: 'secondary' },
24
+ style: ({ theme }) => ({
25
+ backgroundColor: theme.palette.secondary.main,
26
+ color: alpha(theme.palette.text.primary, 0.9),
27
+ borderRadius: radius.sm,
28
+ '&:hover': {
29
+ backgroundColor: theme.palette.secondary.dark,
30
+ color: alpha(theme.palette.text.primary, 0.9)
31
+ },
32
+ '&.Mui-disabled': {
33
+ backgroundColor: theme.palette.action.disabledBackground
34
+ }
35
+ })
36
+ },
37
+ {
38
+ props: { size: 'small' },
39
+ style: {
40
+ padding: '6px 16px'
41
+ }
42
+ },
43
+ {
44
+ props: { size: 'medium' },
45
+ style: {
46
+ padding: '9px 24px'
47
+ }
48
+ },
49
+ {
50
+ props: { size: 'large' },
51
+ style: {
52
+ padding: '12px 32px'
53
+ }
54
+ },
55
+ {
56
+ props: { variant: 'contained', size: 'small' },
57
+ style: {
58
+ paddingTop: '7px',
59
+ paddingBottom: '7px'
60
+ }
61
+ },
62
+ {
63
+ props: { variant: 'contained', size: 'medium' },
64
+ style: {
65
+ paddingTop: '10px',
66
+ paddingBottom: '10px'
67
+ }
68
+ },
69
+ {
70
+ props: { variant: 'contained', size: 'large' },
71
+ style: {
72
+ paddingTop: '13px',
73
+ paddingBottom: '13px'
74
+ }
75
+ }
76
+ ]
77
+ },
78
+ contained: {
79
+ boxShadow: 'none',
80
+ '&:hover': {
81
+ boxShadow: 'none'
82
+ },
83
+ '&:active': {
84
+ boxShadow: 'none'
85
+ },
86
+ '&:focus': {
87
+ boxShadow: 'none'
88
+ }
89
+ },
90
+ outlined: ({ theme }) => ({
91
+ backgroundColor: theme.palette.background.paper,
92
+ borderColor: alpha(theme.palette.grey[900], 0.28),
93
+ color: alpha(theme.palette.text.primary, 0.9),
94
+ '&:hover': {
95
+ backgroundColor: alpha(theme.palette.primary.main, 0.04),
96
+ color: theme.palette.primary.main,
97
+ borderColor: alpha(theme.palette.primary.main, 0.32)
98
+ },
99
+ '&.Mui-disabled': {
100
+ backgroundColor: theme.palette.background.paper,
101
+ color: alpha(theme.palette.grey[900], 0.38),
102
+ borderColor: alpha(theme.palette.grey[900], 0.28)
103
+ }
104
+ })
105
+ }
106
+ },
107
+ MuiTextField: {
108
+ defaultProps: {
109
+ size: 'medium'
110
+ },
111
+ styleOverrides: {
112
+ root: {
113
+ '& .MuiOutlinedInput-root': {
114
+ borderRadius: radius.sm,
115
+ '& fieldset': {
116
+ borderRadius: radius.sm
117
+ }
118
+ }
119
+ }
120
+ }
121
+ },
122
+ MuiOutlinedInput: {
123
+ styleOverrides: {
124
+ root: ({ theme }) => ({
125
+ borderRadius: radius.sm,
126
+ '&.Mui-focused fieldset': {
127
+ borderWidth: '1px'
128
+ },
129
+ '& input::placeholder': {
130
+ color: theme.palette.secondary.dark,
131
+ opacity: 1
132
+ },
133
+ '& .MuiSvgIcon-root': {
134
+ fontSize: '18px'
135
+ }
136
+ }),
137
+ input: {
138
+ padding: '11px 16px', // Default medium: 48px height
139
+ height: 'auto',
140
+ lineHeight: '24px',
141
+ variants: [
142
+ {
143
+ props: { size: 'small' },
144
+ style: {
145
+ padding: '8px 16px',
146
+ fontSize: '14px',
147
+ fontWeight: 400,
148
+ lineHeight: '20px',
149
+ minHeight: '26px'
150
+ }
151
+ }
152
+ ]
153
+ }
154
+ },
155
+ variants: [
156
+ {
157
+ props: { size: 'large' },
158
+ style: {
159
+ '& .MuiOutlinedInput-input': {
160
+ padding: '14px 16px' // Large: 54px height
161
+ }
162
+ }
163
+ }
164
+ ]
165
+ },
166
+ MuiInputBase: {
167
+ styleOverrides: {
168
+ root: {
169
+ '&.MuiInputBase-sizeLarge': {
170
+ fontSize: '16px'
171
+ }
172
+ }
173
+ }
174
+ },
175
+ MuiSelect: {
176
+ styleOverrides: {
177
+ root: {
178
+ '&.MuiOutlinedInput-root': {
179
+ '& .MuiSvgIcon-root': {
180
+ fontSize: '25px'
181
+ },
182
+ '&.MuiInputBase-sizeSmall': {
183
+ '& .MuiSelect-select': {
184
+ padding: '10px 25px 10px 15px',
185
+ fontSize: '14px',
186
+ lineHeight: '20px',
187
+ // Note: :has() selector removed due to jsdom compatibility in tests
188
+ // If SVG is present, padding should be handled via component-level sx prop
189
+ '& svg': {
190
+ marginRight: '8px'
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ },
198
+ MuiAutocomplete: {
199
+ styleOverrides: {
200
+ root: {
201
+ // Using "&&" to increase CSS specificity
202
+ '&&': {
203
+ '& .MuiOutlinedInput-root': {
204
+ paddingLeft: '16px',
205
+ borderRadius: radius.sm,
206
+ '& fieldset.MuiOutlinedInput-notchedOutline': {
207
+ borderRadius: radius.sm
208
+ },
209
+ '&.MuiInputBase-sizeSmall': {
210
+ paddingTop: '8px',
211
+ paddingBottom: '8px',
212
+ paddingLeft: '16px',
213
+ '& .MuiAutocomplete-input': {
214
+ padding: '0px 4px 0px 8px'
215
+ }
216
+ }
217
+ }
218
+ }
219
+ },
220
+ // Styling for chips in Autocomplete
221
+ tag: {
222
+ margin: '2px'
223
+ }
224
+ }
225
+ },
226
+ MuiDialog: {
227
+ styleOverrides: {
228
+ paper: {
229
+ borderRadius: radius.md,
230
+ boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.30), 0 4px 8px 3px rgba(0, 0, 0, 0.15)',
231
+ maxWidth: '570px'
232
+ },
233
+ paperFullScreen: {
234
+ borderRadius: 0,
235
+ maxWidth: '100%'
236
+ }
237
+ }
238
+ },
239
+ MuiDialogTitle: {
240
+ styleOverrides: {
241
+ root: ({ theme }) => ({
242
+ ...theme.typography.h3,
243
+ padding: '12px 32px',
244
+ [theme.breakpoints.down('sm')]: {
245
+ ...theme.typography.h4
246
+ }
247
+ })
248
+ }
249
+ },
250
+ MuiDialogContent: {
251
+ styleOverrides: {
252
+ root: {
253
+ padding: '24px 32px'
254
+ }
255
+ }
256
+ },
257
+ MuiDialogActions: {
258
+ styleOverrides: {
259
+ root: {
260
+ padding: '16px 32px'
261
+ }
262
+ }
263
+ },
264
+ MuiPopover: {
265
+ styleOverrides: {
266
+ paper: {
267
+ borderRadius: radius.md,
268
+ boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.30), 0 4px 8px 3px rgba(0, 0, 0, 0.15)'
269
+ }
270
+ }
271
+ },
272
+ MuiChip: {
273
+ styleOverrides: {
274
+ root: {
275
+ '&.square': {
276
+ borderRadius: radius.md
277
+ }
278
+ }
279
+ }
280
+ },
281
+ MuiAvatar: {
282
+ styleOverrides: {
283
+ root: ({ theme }) => ({
284
+ fontWeight: 600,
285
+ '&.size-xs': {
286
+ width: 18,
287
+ height: 18,
288
+ fontSize: '9.109px',
289
+ fontWeight: 500,
290
+ lineHeight: '18.219px',
291
+ '& svg': {
292
+ width: '50%',
293
+ height: '50%'
294
+ }
295
+ },
296
+ '&.size-s': {
297
+ width: 28,
298
+ height: 28,
299
+ fontSize: '12.525px',
300
+ fontWeight: 500,
301
+ lineHeight: '18.219px',
302
+ '& svg': {
303
+ width: '50%',
304
+ height: '50%'
305
+ }
306
+ },
307
+ '&.size-m': {
308
+ width: 36,
309
+ height: 36,
310
+ fontSize: '18.219px',
311
+ fontWeight: 500,
312
+ lineHeight: '27.328px',
313
+ '& svg': {
314
+ width: '50%',
315
+ height: '50%'
316
+ }
317
+ },
318
+ '&.size-l': {
319
+ width: 54,
320
+ height: 54,
321
+ fontSize: '27.328px',
322
+ fontWeight: 600,
323
+ lineHeight: '36.438px',
324
+ '& svg': {
325
+ width: '50%',
326
+ height: '50%'
327
+ }
328
+ },
329
+ '&.size-xl': {
330
+ width: 72,
331
+ height: 72,
332
+ fontSize: '36.438px',
333
+ fontWeight: 600,
334
+ lineHeight: '45.547px',
335
+ '& svg': {
336
+ width: '50%',
337
+ height: '50%'
338
+ }
339
+ },
340
+ '&.disabled': {
341
+ color: theme.palette.primary.contrastText,
342
+ background: theme.palette.grey[300],
343
+ '& img': {
344
+ filter: 'grayscale(1) brightness(2)',
345
+ opacity: 0.5
346
+ }
347
+ },
348
+ '&.displayInline': {
349
+ display: 'inline-flex'
350
+ },
351
+ '&.border': {
352
+ border: `2px solid ${theme.palette.background.paper}`
353
+ },
354
+ '&.innerBorder': {
355
+ boxShadow: `inset 0px 0px 0px 1px ${theme.palette.divider}`
356
+ },
357
+ variants: [
358
+ {
359
+ props: { color: 'default' },
360
+ style: {
361
+ backgroundColor: theme.palette.background.paper,
362
+ color: theme.palette.text.secondary
363
+ }
364
+ }
365
+ ]
366
+ })
367
+ }
368
+ },
369
+ MuiToggleButtonGroup: {
370
+ styleOverrides: {
371
+ root: ({ theme }) => ({
372
+ borderColor: theme.palette.secondary.dark,
373
+ '& .MuiToggleButton-root:not(.Mui-selected)': {
374
+ color: theme.palette.text.secondary,
375
+ backgroundColor: alpha(theme.palette.text.secondary, 0.08),
376
+ '& svg, & .MuiSvgIcon-root': {
377
+ color: theme.palette.text.secondary
378
+ }
379
+ }
380
+ })
381
+ }
382
+ },
383
+ MuiToggleButton: {
384
+ styleOverrides: {
385
+ root: ({ theme }) => ({
386
+ color: theme.palette.text.primary,
387
+ '&.Mui-selected': {
388
+ color: theme.palette.text.primary,
389
+ backgroundColor: 'transparent',
390
+ '&:hover': {
391
+ backgroundColor: 'transparent'
392
+ },
393
+ '& svg, & .MuiSvgIcon-root': {
394
+ color: theme.palette.primary.main
395
+ }
396
+ },
397
+ variants: [
398
+ {
399
+ props: { size: 'medium' },
400
+ style: {
401
+ padding: '9px 24px'
402
+ }
403
+ }
404
+ ]
405
+ })
406
+ }
407
+ },
408
+ MuiIconButton: {
409
+ styleOverrides: {
410
+ root: ({ theme }) => ({
411
+ color: alpha(theme.palette.grey[900], 0.48),
412
+ padding: '4px'
413
+ })
414
+ }
415
+ },
416
+ MuiCheckbox: {
417
+ styleOverrides: {
418
+ root: {
419
+ '&.MuiCheckbox-sizeSmall': {
420
+ padding: '6px'
421
+ }
422
+ }
423
+ }
424
+ },
425
+ MuiBackdrop: {
426
+ styleOverrides: {
427
+ root: {
428
+ variants: [
429
+ {
430
+ props: { invisible: false },
431
+ style: ({ theme }) => ({
432
+ backgroundColor: alpha(theme.palette.text.primary, theme.palette.action.focusOpacity)
433
+ })
434
+ }
435
+ ]
436
+ }
437
+ }
438
+ },
439
+ MuiAccordion: {
440
+ styleOverrides: {
441
+ root: {
442
+ '&::before': {
443
+ display: 'none'
444
+ }
445
+ }
446
+ }
447
+ },
448
+ MuiAccordionSummary: {
449
+ defaultProps: { expandIcon: React.createElement(AccordionExpandIcon, null) },
450
+ styleOverrides: {
451
+ root: ({ theme }) => ({
452
+ backgroundColor: theme.palette.grey[100],
453
+ textTransform: 'uppercase',
454
+ fontWeight: 'bold',
455
+ fontSize: '0.875rem',
456
+ minHeight: '3.5rem',
457
+ padding: 0,
458
+ color: theme.palette.text.primary,
459
+ '&.Mui-expanded': {
460
+ minHeight: '3.5rem'
461
+ }
462
+ }),
463
+ expandIconWrapper: {
464
+ order: 0,
465
+ '&&': {
466
+ marginLeft: '0.3125rem'
467
+ },
468
+ transform: 'rotate(-90deg)',
469
+ '&.Mui-expanded': {
470
+ marginLeft: '0.3125rem',
471
+ transform: 'rotate(0deg)'
472
+ }
473
+ },
474
+ content: {
475
+ margin: '0.75rem 0',
476
+ paddingLeft: '0.5rem',
477
+ paddingRight: '0.25rem',
478
+ order: 1,
479
+ '& > :last-child': {
480
+ paddingRight: 0
481
+ },
482
+ '&.Mui-expanded': {
483
+ margin: '0.75rem 0'
484
+ }
485
+ }
486
+ }
487
+ },
488
+ MuiFab: {
489
+ defaultProps: { size: 'medium' },
490
+ styleOverrides: {
491
+ root: ({ theme }) => ({
492
+ borderRadius: 28,
493
+ width: 96,
494
+ height: 96,
495
+ color: theme.palette.text.primary,
496
+ backgroundColor: theme.palette.background.paper,
497
+ '&:hover': {
498
+ backgroundColor: darken(theme.palette.background.paper, 0.05)
499
+ },
500
+ '@media (hover: none)': {
501
+ backgroundColor: theme.palette.background.paper
502
+ }
503
+ }),
504
+ primary: ({ theme }) => ({
505
+ color: theme.palette.primary.dark,
506
+ backgroundColor: theme.palette.primary.light,
507
+ '&:hover': {
508
+ backgroundColor: darken(theme.palette.primary.light, 0.05)
509
+ },
510
+ '@media (hover: none)': {
511
+ backgroundColor: theme.palette.primary.light
512
+ }
513
+ }),
514
+ extended: {
515
+ borderRadius: 16,
516
+ width: 'auto',
517
+ height: 56,
518
+ minWidth: 56,
519
+ padding: '0 20px',
520
+ '&.MuiFab-sizeSmall': {
521
+ borderRadius: 16,
522
+ width: 'auto',
523
+ height: 42,
524
+ minWidth: 42,
525
+ padding: '0 12px'
526
+ },
527
+ '&.MuiFab-sizeMedium': {
528
+ borderRadius: 16,
529
+ width: 'auto',
530
+ height: 48,
531
+ minWidth: 48,
532
+ padding: '0 16px'
533
+ }
534
+ },
535
+ sizeSmall: {
536
+ borderRadius: 12,
537
+ width: 40,
538
+ height: 40
539
+ },
540
+ sizeMedium: {
541
+ borderRadius: 16,
542
+ width: 56,
543
+ height: 56
544
+ }
545
+ }
546
+ },
547
+ MuiTooltip: {
548
+ defaultProps: { arrow: true },
549
+ styleOverrides: {
550
+ tooltip: ({ theme }) => ({
551
+ backgroundColor: alpha(theme.palette.grey[800], 0.9),
552
+ fontSize: '1rem',
553
+ lineHeight: 1.3,
554
+ borderRadius: '4px',
555
+ padding: '8px 12px'
556
+ })
557
+ }
558
+ },
559
+ MuiCssBaseline: {
560
+ styleOverrides: theme => ({
561
+ '.MuiAccordion-root .MuiListItem-root': {
562
+ padding: '0',
563
+ borderRadius: '4px',
564
+ '&:hover': {
565
+ backgroundColor: alpha(theme.palette.grey[900], 0.04)
566
+ }
567
+ },
568
+ '.MuiAccordion-root .MuiListItem-root label': {
569
+ fontSize: '14px',
570
+ fontStyle: 'normal',
571
+ fontWeight: 400,
572
+ color: alpha(theme.palette.grey[900], 0.9)
573
+ }
574
+ })
575
+ },
576
+ MuiMenuItem: {
577
+ styleOverrides: {
578
+ root: ({ theme }) => ({
579
+ borderRadius: radius.md,
580
+ '&&&:hover': {
581
+ backgroundColor: `${alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)}`
582
+ },
583
+ [`&.${menuItemClasses.selected}`]: {
584
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
585
+ '&:hover': {
586
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity +
587
+ theme.palette.action.hoverOpacity)
588
+ }
589
+ }
590
+ })
591
+ }
592
+ },
593
+ MuiSwipeableDrawer: {
594
+ defaultProps: {
595
+ sx: theme => ({
596
+ '& .MuiDrawer-paper': {
597
+ borderTopLeftRadius: radius.md,
598
+ borderTopRightRadius: radius.md,
599
+ '&::before': {
600
+ content: '""',
601
+ display: 'block',
602
+ width: '64px',
603
+ height: '4px',
604
+ backgroundColor: theme.palette.action.disabledBackground,
605
+ borderRadius: radius.md,
606
+ margin: '12px auto',
607
+ marginTop: '30px',
608
+ flexShrink: 0
609
+ }
610
+ }
611
+ })
612
+ }
613
+ }
614
+ };
@@ -1,6 +1,6 @@
1
1
  import { createTheme } from '@mui/material/styles';
2
- import { makeDarkOverrides } from './makeDarkOverrides';
3
- import { makeLightOverrides } from './makeLightOverrides';
2
+ import { darkOverrides } from './darkOverrides';
3
+ import { lightOverrides } from './lightOverrides';
4
4
  import { makePalette } from './makePalette';
5
5
  import { makeTypography } from './makeTypography';
6
6
  // DatePicker styles are applied through component overrides
@@ -29,7 +29,7 @@ export const makeTheme = (mode = 'light') => {
29
29
  palette,
30
30
  typography
31
31
  });
32
- const components = mode === 'dark' ? makeDarkOverrides(theme) : makeLightOverrides(theme);
32
+ const components = mode === 'dark' ? darkOverrides : lightOverrides;
33
33
  // Create the final theme with components
34
34
  return createTheme({
35
35
  ...theme,
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ declare function ThemePlaygroundContent(): React.ReactElement;
4
+ declare const meta: Meta<typeof ThemePlaygroundContent>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof ThemePlaygroundContent>;
7
+ export declare const Docs: Story;