@swisper.ai/design-system 0.0.2

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,476 @@
1
+ import { createTheme } from '@mui/material/styles';
2
+ import * as tokens from '../dist/js/tokens';
3
+ const DEFAULT_PADDING_STEP = 8;
4
+ // Constants from frontend theme
5
+ export const paperXMargin = 20;
6
+ export const paperYMargin = 20;
7
+ export const doublePaperXMargin = paperXMargin * 2;
8
+ export const doublePaperYMargin = paperYMargin * 2;
9
+ export const tertiaryColor = '#B6C2D1';
10
+ const defaultTheme = createTheme({
11
+ palette: {
12
+ action: {
13
+ disabled: '#F9FBFC61',
14
+ disabledBackground: '#F9FBFC61',
15
+ },
16
+ steel: {
17
+ 100: tokens.SwisperCoreColorSteel100,
18
+ // 150: tokens.SwisperCoreColorSteel150,
19
+ 200: tokens.SwisperCoreColorSteel200,
20
+ // 250: tokens.SwisperCoreColorSteel250,
21
+ 300: tokens.SwisperCoreColorSteel300,
22
+ 400: tokens.SwisperCoreColorSteel400,
23
+ 500: tokens.SwisperCoreColorSteel500,
24
+ 600: tokens.SwisperCoreColorSteel600,
25
+ // 650: tokens.SwisperCoreColorSteel650,
26
+ 700: tokens.SwisperCoreColorSteel700,
27
+ 800: tokens.SwisperCoreColorSteel800,
28
+ 900: tokens.SwisperCoreColorSteel900,
29
+ },
30
+ blue: {
31
+ 100: tokens.SwisperCoreColorBlue100,
32
+ 300: tokens.SwisperCoreColorBlue300,
33
+ 400: tokens.SwisperCoreColorBlue400,
34
+ 500: tokens.SwisperCoreColorBlue500,
35
+ 600: tokens.SwisperCoreColorBlue600,
36
+ 700: tokens.SwisperCoreColorBlue700,
37
+ 800: tokens.SwisperCoreColorBlue800,
38
+ },
39
+ lagoon: {
40
+ // 5: tokens.SwisperCoreColorLagoon5,
41
+ },
42
+ },
43
+ typography: {
44
+ fontSize: 16,
45
+ fontWeightLight: 300,
46
+ fontWeightRegular: 400,
47
+ fontWeightMedium: 500,
48
+ fontWeightBold: 700,
49
+ htmlFontSize: 16,
50
+ fontFamily: '"Noto Sans", sans-serif',
51
+ h1: {
52
+ fontSize: '2rem', // 32px
53
+ lineHeight: '140%',
54
+ letterSpacing: 0,
55
+ },
56
+ h2: {
57
+ fontSize: '1.750rem', // 28px
58
+ lineHeight: '140%',
59
+ letterSpacing: 0,
60
+ },
61
+ h3: {
62
+ fontSize: '1.5rem', // 24px
63
+ fontWeight: 'medium',
64
+ lineHeight: '140%',
65
+ letterSpacing: 0,
66
+ },
67
+ h4: {
68
+ fontSize: '1.25rem', // 20px
69
+ fontWeight: 'medium',
70
+ lineHeight: '140%',
71
+ letterSpacing: 0,
72
+ },
73
+ h5: {
74
+ fontSize: '1.5rem', // 18px
75
+ fontWeight: 700,
76
+ lineHeight: '140%',
77
+ letterSpacing: 0,
78
+ },
79
+ h6: {
80
+ fontSize: '1.125rem', // 16px
81
+ fontWeight: 600,
82
+ lineHeight: '140%',
83
+ letterSpacing: 0,
84
+ },
85
+ body1: {
86
+ fontSize: '1rem', // 16px
87
+ lineHeight: '160%',
88
+ letterSpacing: 0,
89
+ },
90
+ body2: {
91
+ fontSize: '0.875rem', // 14px
92
+ fontWeight: 400,
93
+ lineHeight: '160%',
94
+ letterSpacing: 0,
95
+ },
96
+ caption: {
97
+ fontSize: '0.75rem', // 12px
98
+ lineHeight: '130%', // 16px
99
+ letterSpacing: '0.16px',
100
+ },
101
+ subtitle1: {
102
+ fontSize: '1rem', // 16px
103
+ fontWeight: 400,
104
+ lineHeight: 1.75, // 28px
105
+ letterSpacing: '0.15px',
106
+ },
107
+ subtitle2: {
108
+ fontSize: '0.875rem', // 14px
109
+ fontWeight: 500,
110
+ lineHeight: 1.57, // 22px
111
+ letterSpacing: '0.1px',
112
+ },
113
+ overline: {
114
+ fontSize: '0.75rem', // 12px
115
+ fontWeight: 400,
116
+ lineHeight: 1.5, // 18px
117
+ letterSpacing: '1.92px',
118
+ textTransform: 'uppercase',
119
+ },
120
+ },
121
+ spacing: DEFAULT_PADDING_STEP,
122
+ shape: {
123
+ borderRadius: Number(tokens.SwisperCoreBorderRadius50),
124
+ },
125
+ components: {
126
+ MuiSvgIcon: {
127
+ styleOverrides: {
128
+ root: {
129
+ '&.MuiSvgIcon-fontSizeInherit': {
130
+ width: '100%',
131
+ height: '100%',
132
+ },
133
+ '&.MuiSvgIcon-fontSizeSmall': {
134
+ width: '1.25rem' /* 20px */,
135
+ height: '1.25rem' /* 20px */,
136
+ },
137
+ '&.MuiSvgIcon-fontSizeMedium': {
138
+ width: '1.5rem' /* 24px */,
139
+ height: '1.5rem' /* 24px */,
140
+ },
141
+ '&.MuiSvgIcon-fontSizeLarge': {
142
+ width: '2.188rem' /* 35px */,
143
+ height: '2.188rem' /* 35px */,
144
+ },
145
+ },
146
+ },
147
+ defaultProps: {
148
+ fontSize: 'medium',
149
+ },
150
+ },
151
+ MuiIconButton: {},
152
+ },
153
+ });
154
+ const darkTheme = createTheme(defaultTheme, {
155
+ palette: {
156
+ mode: 'dark',
157
+ primary: {
158
+ main: tokens.SwisperDarkColorPrimaryMain,
159
+ },
160
+ secondary: {
161
+ main: '#B6C2D1',
162
+ },
163
+ error: {
164
+ main: '#FF5252',
165
+ },
166
+ background: {
167
+ default: tokens.SwisperDarkColorGlobalBg,
168
+ },
169
+ text: {
170
+ primary: tokens.SwisperDarkColorGlobalFgBase,
171
+ secondary: '#FFFFFFB2',
172
+ tertiary: tertiaryColor,
173
+ },
174
+ warning: {
175
+ dark: '#F57C00',
176
+ },
177
+ },
178
+ shape: {
179
+ borderRadius: Number(tokens.SwisperCoreBorderRadius100),
180
+ },
181
+ components: {
182
+ MuiIconButton: {
183
+ styleOverrides: {
184
+ root: {
185
+ color: tertiaryColor,
186
+ '&:hover': {
187
+ color: 'white',
188
+ },
189
+ },
190
+ },
191
+ },
192
+ MuiAppBar: {
193
+ defaultProps: {
194
+ elevation: 0,
195
+ },
196
+ styleOverrides: {
197
+ root: {
198
+ backgroundColor: tokens.SwisperDarkColorGlobalBg,
199
+ elevation: 0,
200
+ padding: 16,
201
+ paddingBottom: 0,
202
+ minHeight: 0,
203
+ margin: 0,
204
+ },
205
+ },
206
+ },
207
+ MuiToolbar: {
208
+ styleOverrides: {
209
+ root: ({ theme }) => ({
210
+ minHeight: 0,
211
+ padding: 0,
212
+ [theme.breakpoints.up('sm')]: {
213
+ minHeight: 0,
214
+ padding: 0,
215
+ },
216
+ }),
217
+ },
218
+ },
219
+ MuiPaper: {
220
+ defaultProps: {
221
+ elevation: 0,
222
+ },
223
+ styleOverrides: {
224
+ root: {
225
+ backgroundColor: tokens.SwisperDarkColorGlobalSurface,
226
+ color: tokens.SwisperDarkColorGlobalFgBase,
227
+ borderRadius: Number(tokens.SwisperCoreBorderRadius100),
228
+ border: 0,
229
+ padding: 16,
230
+ margin: `${paperYMargin}px ${paperXMargin}px`,
231
+ },
232
+ elevation16: {
233
+ '&.MuiPaper-elevation': {
234
+ margin: 0,
235
+ height: 'calc(100vh)',
236
+ },
237
+ },
238
+ },
239
+ },
240
+ MuiDrawer: {
241
+ styleOverrides: {
242
+ paper: {
243
+ backgroundColor: tokens.SwisperDarkColorGlobalBg,
244
+ borderRight: 0,
245
+ borderRadius: 0,
246
+ borderTopRightRadius: '16px',
247
+ borderBottomRightRadius: '16px',
248
+ height: `calc(100vh - 64px - ${doublePaperYMargin}px)`, // Using default header height
249
+ marginTop: `calc(64px + ${paperYMargin}px)`, // Using default header height
250
+ width: 280, // Default SIDEMENU_WIDTH
251
+ boxSizing: 'border-box',
252
+ },
253
+ },
254
+ },
255
+ MuiSelect: {
256
+ styleOverrides: {
257
+ root: {
258
+ '&::before': {
259
+ borderBottom: '0px',
260
+ },
261
+ '&.MuiInput-root:hover': {
262
+ '&::before': {
263
+ borderBottom: '0px',
264
+ },
265
+ },
266
+ '& .MuiSelect-iconOutlined': {
267
+ color: 'inherit',
268
+ },
269
+ },
270
+ select: {
271
+ '& .MuiSelect-iconOutlined': {
272
+ color: 'inherit',
273
+ },
274
+ },
275
+ },
276
+ },
277
+ MuiPopover: {
278
+ styleOverrides: {
279
+ paper: {
280
+ margin: '8px',
281
+ padding: '8px',
282
+ },
283
+ },
284
+ },
285
+ MuiTextField: {
286
+ styleOverrides: {
287
+ root: {
288
+ '& .MuiInputBase-input::placeholder': {
289
+ color: '#F9FBFC4D',
290
+ },
291
+ },
292
+ },
293
+ },
294
+ MuiButton: {
295
+ styleOverrides: {
296
+ root: {
297
+ textTransform: 'none',
298
+ },
299
+ },
300
+ },
301
+ MuiDialog: {
302
+ styleOverrides: {
303
+ paper: {
304
+ elevation: 16,
305
+ borderRadius: '10px',
306
+ margin: `${paperYMargin}px ${paperXMargin}px`,
307
+ padding: 0,
308
+ background: '#141923',
309
+ },
310
+ },
311
+ },
312
+ MuiDialogContent: {
313
+ styleOverrides: {
314
+ root: {
315
+ backgroundColor: '#222834',
316
+ padding: '0px 24px',
317
+ },
318
+ },
319
+ },
320
+ MuiDialogTitle: {
321
+ styleOverrides: {
322
+ root: {
323
+ backgroundColor: '#222834',
324
+ padding: '16px 24px',
325
+ display: 'flex',
326
+ justifyContent: 'space-between',
327
+ alignItems: 'center',
328
+ fontWeight: 600,
329
+ fontSize: '1.25rem',
330
+ lineHeight: '24px',
331
+ },
332
+ },
333
+ },
334
+ MuiFormControlLabel: {
335
+ styleOverrides: {
336
+ root: {
337
+ margin: 0,
338
+ },
339
+ },
340
+ },
341
+ MuiMenu: {
342
+ styleOverrides: {
343
+ root: {},
344
+ paper: {
345
+ background: '#202730',
346
+ border: '1px solid #202730',
347
+ boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.9)',
348
+ borderRadius: '4px',
349
+ padding: 0,
350
+ },
351
+ list: {
352
+ padding: '12px',
353
+ overflowY: 'scroll',
354
+ },
355
+ },
356
+ },
357
+ MuiMenuItem: {
358
+ styleOverrides: {
359
+ root: {
360
+ gap: '0',
361
+ padding: '8px',
362
+ borderRadius: '8px',
363
+ minHeight: '40px',
364
+ fontStyle: 'normal',
365
+ fontWeight: 700,
366
+ fontSize: '16px',
367
+ lineHeight: '24px',
368
+ letterSpacing: '0.15px',
369
+ color: '#FFFFFF',
370
+ '& .MuiListItemText-root': {
371
+ minWidth: '40px',
372
+ },
373
+ '& .MuiDivider-root': {
374
+ margin: '0',
375
+ backgroundColor: 'red',
376
+ },
377
+ '&:hover': {
378
+ backgroundColor: '#2E3442',
379
+ },
380
+ '&:hover .MuiListItemIcon-root': {
381
+ color: '#FFFFFF',
382
+ },
383
+ '&.Mui-selected': {
384
+ backgroundColor: '#2E3442',
385
+ },
386
+ '&.Mui-selected:hover': {
387
+ backgroundColor: '#2E3442',
388
+ },
389
+ },
390
+ },
391
+ },
392
+ MuiListItemIcon: {
393
+ styleOverrides: {
394
+ root: {
395
+ color: '#FFFFFF8F',
396
+ minWidth: '40px',
397
+ },
398
+ },
399
+ },
400
+ MuiInputBase: {
401
+ styleOverrides: {
402
+ input: {
403
+ '&::placeholder': {
404
+ color: '#F9FBFC4D',
405
+ },
406
+ '&:-webkit-autofill': {
407
+ backgroundColor: 'red',
408
+ color: 'red',
409
+ },
410
+ },
411
+ },
412
+ },
413
+ MuiCheckbox: {
414
+ styleOverrides: {
415
+ root: {
416
+ '& .MuiSvgIcon-root': {
417
+ fill: '#FFFFFF8F',
418
+ },
419
+ '&.Mui-checked .MuiSvgIcon-root': {
420
+ fill: tokens.SwisperDarkColorPrimaryMain,
421
+ },
422
+ },
423
+ },
424
+ },
425
+ MuiTable: {
426
+ styleOverrides: {
427
+ root: {
428
+ backgroundColor: 'transparent',
429
+ },
430
+ },
431
+ },
432
+ MuiTableHead: {},
433
+ MuiTableBody: {},
434
+ MuiTableRow: {},
435
+ MuiTableCell: {
436
+ styleOverrides: {
437
+ root: {
438
+ backgroundColor: 'transparent',
439
+ padding: '8px',
440
+ borderBottom: 'none',
441
+ '&:first-child': {
442
+ paddingLeft: '16px',
443
+ },
444
+ '&:last-child': {
445
+ paddingRight: '16px',
446
+ },
447
+ fontFamily: 'var(--font-noto-sans)',
448
+ fontStyle: 'normal',
449
+ fontWeight: '400',
450
+ fontSize: '16px',
451
+ lineHeight: '150%',
452
+ color: '#FFFFFF',
453
+ '&[data-header]': {
454
+ color: '#FFFFFFB2',
455
+ backgroundColor: '#5C647C1A',
456
+ },
457
+ },
458
+ },
459
+ },
460
+ },
461
+ });
462
+ const lightTheme = createTheme(defaultTheme, {
463
+ palette: {
464
+ mode: 'light',
465
+ },
466
+ components: {
467
+ MuiDialog: {
468
+ styleOverrides: {
469
+ sx: {
470
+ backgroundColor: 'transparent',
471
+ },
472
+ },
473
+ },
474
+ },
475
+ });
476
+ export { lightTheme, darkTheme };