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