@exness-ui/default-theme 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @exness-ui/default-theme
2
+
3
+ Exness theme React components
4
+
5
+ ## Features
6
+
7
+ - ES6 syntax, managed with Prettier + Eslint and Stylelint
8
+ - Unit testing via Jest
9
+ - React v16.8 - 17
10
+ - ESM
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ yarn add @exness-ui/default-theme
16
+ // or
17
+ npm i @exness-ui/default-theme
18
+ ```
19
+
20
+ ### Usage
21
+
22
+ ```js
23
+ import { getDefaultThemeOptions, ThemeProvider } from '@exness-ui/default-theme';
24
+
25
+ const MyApp = () => {
26
+ return (
27
+ <ThemeProvider theme={getDefaultThemeOptions({ primaryColor: 'red' })}>
28
+ <App/>
29
+ </ThemeProvider>
30
+ );
31
+ }
32
+ ```
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var react_1 = __importDefault(require("react"));
29
+ var const_1 = require("../const");
30
+ var SelectIcon = function (_a) {
31
+ var _b = _a.fill, fill = _b === void 0 ? const_1.COLORS.greyText : _b, _c = _a.width, width = _c === void 0 ? 12 : _c, _d = _a.height, height = _d === void 0 ? 7 : _d, props = __rest(_a, ["fill", "width", "height"]);
32
+ return (react_1.default.createElement("span", __assign({}, props),
33
+ react_1.default.createElement("svg", { width: width, height: height, viewBox: "0 0 12 7", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
34
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0 1.07692L6 7L12 1.00129L11 0L6 5L1 0L0 1.07692Z", fill: fill }))));
35
+ };
36
+ exports.default = SelectIcon;
package/lib/const.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPOGRAPHY = exports.COLORS = void 0;
4
+ exports.COLORS = {
5
+ yellowCorporate: '#FFCF01',
6
+ yellowHover: '#FFDA33',
7
+ yellowLight: '#FFF5CC',
8
+ headerDropdown: '#2C3033',
9
+ almostBlack: '#37434E',
10
+ almostBlackAlpha10: '#37434E0A',
11
+ greyText: '#7D8184',
12
+ greyBorderButtons: '#B8BABA',
13
+ greyBorderPanels: '#DFDFDF',
14
+ greyBackground: '#F3F3F3',
15
+ white: '#FFF',
16
+ black: '#000',
17
+ green: '#23B14A',
18
+ greenLight: '#CFF5DA',
19
+ red: '#D84027',
20
+ redLight: '#FFE9E6',
21
+ blue: '#0376BC',
22
+ blueLight: '#E6F5FF',
23
+ };
24
+ exports.TYPOGRAPHY = {
25
+ bodySmall: {
26
+ fontWeight: 400,
27
+ fontSize: 12,
28
+ lineHeight: '16px',
29
+ },
30
+ bodyRegular: {
31
+ fontWeight: 400,
32
+ fontSize: 14,
33
+ lineHeight: '20px',
34
+ },
35
+ bodyLarge: {
36
+ fontWeight: 400,
37
+ fontSize: 16,
38
+ lineHeight: '24px',
39
+ },
40
+ };
package/lib/index.js ADDED
@@ -0,0 +1,436 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.exnessRtlTheme = exports.defaultThemeOptions = exports.getDefaultThemeOptions = void 0;
18
+ var styles_1 = require("@mui/material/styles");
19
+ var const_1 = require("./const");
20
+ var SelectIcon_1 = __importDefault(require("./components/SelectIcon"));
21
+ var spacing = (0, styles_1.createTheme)().spacing;
22
+ var getDefaultThemeOptions = function (colors, typography) {
23
+ if (colors === void 0) { colors = const_1.COLORS; }
24
+ if (typography === void 0) { typography = const_1.TYPOGRAPHY; }
25
+ return ({
26
+ palette: {
27
+ primary: {
28
+ main: colors.almostBlack,
29
+ },
30
+ secondary: {
31
+ main: colors.yellowCorporate,
32
+ dark: colors.yellowHover,
33
+ },
34
+ error: {
35
+ main: colors.red,
36
+ light: colors.redLight,
37
+ },
38
+ success: {
39
+ main: colors.green,
40
+ light: colors.greenLight,
41
+ },
42
+ info: {
43
+ main: colors.blue,
44
+ light: colors.blueLight,
45
+ },
46
+ background: {
47
+ default: colors.white,
48
+ },
49
+ text: {
50
+ primary: colors.almostBlack,
51
+ secondary: colors.greyText,
52
+ disabled: colors.greyBorderButtons,
53
+ },
54
+ },
55
+ breakpoints: {
56
+ values: {
57
+ xs: 0,
58
+ sm: 576,
59
+ md: 768,
60
+ lg: 992,
61
+ xl: 1200,
62
+ },
63
+ },
64
+ shape: {
65
+ borderRadius: 2,
66
+ },
67
+ typography: {
68
+ fontFamily: "San Francisco, -apple-system, BlinkMacSystemFont, '.SFNSText-Regular', Roboto, Droid Sans, Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",
69
+ h1: {
70
+ fontSize: 'clamp(2rem, 1.5rem + 2.5vw, 4.5rem)',
71
+ lineHeight: 1.22222222222,
72
+ fontWeight: 700,
73
+ },
74
+ h2: {
75
+ fontSize: 'clamp(1.5rem, 1.2rem + 1.5vw, 3rem)',
76
+ lineHeight: 1.16666666667,
77
+ fontWeight: 700,
78
+ },
79
+ h3: {
80
+ fontSize: 'clamp(1.125rem, 0.95rem + 0.875vw, 2rem)',
81
+ lineHeight: 1.25,
82
+ fontWeight: 700,
83
+ },
84
+ h4: {
85
+ fontSize: 'clamp(0.875rem, 0.75rem + 0.625vw, 1.5rem)',
86
+ lineHeight: 1.33333333333,
87
+ fontWeight: 700,
88
+ },
89
+ h5: {
90
+ fontSize: 'clamp(0.875rem, 0.825rem + 0.25vw, 1.125rem)',
91
+ lineHeight: 1.33333333333,
92
+ fontWeight: 700,
93
+ },
94
+ h6: {
95
+ fontSize: 'clamp(0.75rem, 0.725rem + 0.125vw, 0.875rem)',
96
+ lineHeight: 1.42857142857,
97
+ fontWeight: 700,
98
+ },
99
+ subtitle1: {
100
+ fontSize: 'clamp(1.125rem, 1rem + 0.625vw, 1.75rem)',
101
+ lineHeight: 1.28571428571,
102
+ fontWeight: 400,
103
+ },
104
+ subtitle2: {
105
+ fontSize: 'clamp(0.875rem, 0.75rem + 0.625vw, 1.5rem)',
106
+ lineHeight: 1.33333333333,
107
+ fontWeight: 400,
108
+ },
109
+ button: __assign({}, typography.bodyRegular),
110
+ body1: __assign(__assign({}, typography.bodyRegular), { color: colors.almostBlack }),
111
+ body2: __assign(__assign({}, typography.bodySmall), { color: colors.almostBlack }),
112
+ caption: __assign({}, typography.bodySmall),
113
+ },
114
+ components: {
115
+ MuiLoadingButton: {
116
+ defaultProps: {
117
+ variant: 'contained',
118
+ loadingPosition: 'start',
119
+ },
120
+ styleOverrides: {
121
+ // fix indicator position for not fullWidth loading button
122
+ loadingIndicator: {
123
+ position: 'relative',
124
+ },
125
+ loadingIndicatorStart: {
126
+ left: -10,
127
+ },
128
+ loadingIndicatorEnd: {
129
+ right: -10,
130
+ },
131
+ },
132
+ },
133
+ MuiButton: {
134
+ defaultProps: {
135
+ disableElevation: true,
136
+ variant: 'contained',
137
+ },
138
+ styleOverrides: {
139
+ root: {
140
+ textTransform: 'none',
141
+ '&[disabled]': {
142
+ backgroundColor: colors.greyBackground,
143
+ borderColor: colors.greyBackground,
144
+ color: colors.greyBorderButtons,
145
+ },
146
+ },
147
+ sizeSmall: __assign({}, typography.bodySmall),
148
+ sizeLarge: __assign({}, typography.bodyLarge),
149
+ contained: {
150
+ padding: '10px 25px',
151
+ },
152
+ containedPrimary: {
153
+ backgroundColor: colors.yellowCorporate,
154
+ color: colors.black,
155
+ '&:hover': {
156
+ backgroundColor: colors.yellowHover,
157
+ },
158
+ },
159
+ outlined: {
160
+ padding: '9px 24px',
161
+ },
162
+ outlinedPrimary: {
163
+ background: 'none',
164
+ color: colors.almostBlack,
165
+ borderColor: colors.greyBorderButtons,
166
+ '&:hover': {
167
+ background: 'none',
168
+ borderColor: colors.almostBlack,
169
+ },
170
+ },
171
+ text: {
172
+ padding: 0,
173
+ color: colors.blue,
174
+ minWidth: 0,
175
+ borderRadius: 0,
176
+ '&:hover': {
177
+ background: 'none',
178
+ marginBottom: -1,
179
+ borderBottomWidth: 1,
180
+ borderBottomStyle: 'solid',
181
+ borderBottomColor: colors.blue,
182
+ },
183
+ '&[disabled]': {
184
+ background: 'none',
185
+ color: colors.almostBlack,
186
+ },
187
+ },
188
+ },
189
+ },
190
+ MuiTextField: {
191
+ defaultProps: {
192
+ variant: 'standard',
193
+ fullWidth: true,
194
+ },
195
+ styleOverrides: {
196
+ root: {
197
+ paddingBottom: spacing(2),
198
+ },
199
+ },
200
+ },
201
+ MuiInputLabel: {
202
+ styleOverrides: {
203
+ root: {
204
+ color: colors.greyBorderButtons,
205
+ '&.MuiInputLabel-standard': __assign(__assign({}, typography.bodyRegular), { transform: 'translate(0, 25px) scale(1)' }),
206
+ '&.Mui-focused': {
207
+ color: colors.greyText,
208
+ },
209
+ '&.Mui-error': {
210
+ color: colors.greyBorderButtons,
211
+ },
212
+ },
213
+ shrink: {
214
+ color: colors.greyText,
215
+ '&.MuiInputLabel-standard': {
216
+ transform: 'translate(0, 0) scale(0.85)',
217
+ },
218
+ '&.Mui-error': {
219
+ color: colors.greyText,
220
+ },
221
+ },
222
+ },
223
+ },
224
+ MuiInput: {
225
+ styleOverrides: {
226
+ root: __assign(__assign({}, typography.bodyRegular), { '&.Mui-error:not(.Mui-focused):after': {
227
+ borderWidth: 1,
228
+ } }),
229
+ underline: {
230
+ '&:before': {
231
+ borderColor: colors.greyText,
232
+ },
233
+ '&.Mui-disabled:before': {
234
+ borderBottomStyle: 'solid',
235
+ },
236
+ '&:hover:not(.Mui-disabled):before': {
237
+ borderWidth: 1,
238
+ },
239
+ },
240
+ input: {
241
+ padding: '5px 0 4px',
242
+ },
243
+ },
244
+ },
245
+ MuiFormHelperText: {
246
+ defaultProps: {
247
+ variant: 'standard',
248
+ },
249
+ styleOverrides: {
250
+ root: {
251
+ minHeight: typography.bodySmall.lineHeight,
252
+ },
253
+ },
254
+ },
255
+ MuiRadio: {
256
+ styleOverrides: {
257
+ root: {
258
+ color: colors.greyText,
259
+ '&.Mui-disabled': {
260
+ color: colors.greyBorderPanels,
261
+ },
262
+ },
263
+ },
264
+ },
265
+ MuiFormControlLabel: {
266
+ styleOverrides: {
267
+ root: {
268
+ '&:not(.Mui-disabled):hover .MuiRadio-root, :not(.Mui-disabled):hover .MuiCheckbox-root': {
269
+ backgroundColor: colors.almostBlackAlpha10,
270
+ },
271
+ },
272
+ },
273
+ },
274
+ MuiCheckbox: {
275
+ styleOverrides: {
276
+ root: {
277
+ color: colors.greyText,
278
+ '&.Mui-disabled': {
279
+ color: colors.greyBorderPanels,
280
+ },
281
+ },
282
+ },
283
+ },
284
+ MuiFormControl: {
285
+ defaultProps: {
286
+ variant: 'standard',
287
+ fullWidth: true,
288
+ },
289
+ styleOverrides: {
290
+ root: {
291
+ paddingTop: spacing(0.5),
292
+ },
293
+ },
294
+ },
295
+ MuiSelect: {
296
+ defaultProps: {
297
+ variant: 'standard',
298
+ fullWidth: true,
299
+ IconComponent: SelectIcon_1.default,
300
+ MenuProps: { sx: { marginTop: 1 } },
301
+ },
302
+ styleOverrides: {
303
+ icon: {
304
+ fill: colors.greyText,
305
+ lineHeight: 1,
306
+ },
307
+ select: {
308
+ background: 'none',
309
+ },
310
+ },
311
+ },
312
+ MuiMenu: {
313
+ styleOverrides: {
314
+ paper: {
315
+ borderColor: colors.greyBorderButtons,
316
+ borderWidth: 1,
317
+ borderStyle: 'solid',
318
+ '&.MuiPaper-elevation': {
319
+ boxShadow: '0px 10px 20px rgba(0, 0, 0, 0.1)',
320
+ },
321
+ },
322
+ list: {
323
+ padding: spacing(2, 0),
324
+ },
325
+ },
326
+ },
327
+ MuiMenuItem: {
328
+ styleOverrides: {
329
+ root: {
330
+ padding: spacing(1, 3),
331
+ '&.Mui-selected': {
332
+ background: 'none',
333
+ fontWeight: 700,
334
+ },
335
+ '&:hover, &.Mui-selected:hover, &.Mui-focusVisible': {
336
+ backgroundColor: colors.yellowLight,
337
+ },
338
+ },
339
+ },
340
+ },
341
+ MuiCssBaseline: {
342
+ styleOverrides: {
343
+ '@global': {
344
+ '*:focus': {
345
+ outline: 'none',
346
+ },
347
+ body: {
348
+ fallbacks: [{ minHeight: '100%' }],
349
+ minHeight: 'fill-available',
350
+ // Safari fontSize clamp fix
351
+ minWidth: '1vw',
352
+ },
353
+ html: {
354
+ WebkitFontSmoothing: 'auto',
355
+ fallbacks: [{ height: '100%' }],
356
+ height: 'fill-available',
357
+ },
358
+ '#gatsby-focus-wrapper,#___gatsby': {
359
+ height: '100%',
360
+ },
361
+ },
362
+ },
363
+ },
364
+ MuiAccordion: {
365
+ styleOverrides: {
366
+ root: {
367
+ boxShadow: 'none',
368
+ '&$expanded': {
369
+ margin: 0,
370
+ },
371
+ '&:before': {
372
+ display: 'none',
373
+ },
374
+ },
375
+ },
376
+ },
377
+ MuiAccordionSummary: {
378
+ styleOverrides: {
379
+ root: {
380
+ minHeight: 0,
381
+ margin: 0,
382
+ '&$expanded': {
383
+ margin: 0,
384
+ minHeight: 0,
385
+ },
386
+ },
387
+ content: {
388
+ margin: 0,
389
+ '&$expanded': {
390
+ margin: 0,
391
+ },
392
+ },
393
+ },
394
+ },
395
+ MuiAccordionDetails: {
396
+ styleOverrides: {
397
+ root: {
398
+ display: 'block',
399
+ },
400
+ },
401
+ },
402
+ MuiTouchRipple: {
403
+ styleOverrides: {
404
+ root: {
405
+ backgroundColor: '#1122ff',
406
+ },
407
+ child: {
408
+ width: '120%',
409
+ margin: '-10%',
410
+ borderRadius: '2px',
411
+ },
412
+ childPulsate: {
413
+ width: '120%',
414
+ margin: '-10%',
415
+ borderRadius: '2px',
416
+ },
417
+ ripple: {
418
+ borderRadius: '40px',
419
+ opacity: 0.3,
420
+ animation: 'none',
421
+ },
422
+ rippleVisible: {
423
+ borderRadius: '40px',
424
+ opacity: 0.3,
425
+ animation: 'none',
426
+ },
427
+ },
428
+ },
429
+ },
430
+ });
431
+ };
432
+ exports.getDefaultThemeOptions = getDefaultThemeOptions;
433
+ exports.defaultThemeOptions = (0, exports.getDefaultThemeOptions)();
434
+ var exnessTheme = (0, styles_1.createTheme)(exports.defaultThemeOptions);
435
+ exports.exnessRtlTheme = (0, styles_1.createTheme)(__assign(__assign({}, exports.defaultThemeOptions), { direction: 'rtl' }));
436
+ exports.default = exnessTheme;
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@exness-ui/default-theme",
3
+ "version": "0.0.10",
4
+ "description": "Exness theme React components",
5
+ "private": false,
6
+ "author": {
7
+ "name": "hxnsui"
8
+ },
9
+ "main": "lib/index.js",
10
+ "typings": "types/index.d.ts",
11
+ "scripts": {
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "dependencies": {
15
+ "@mui/material": "^5.9.1",
16
+ "react": "16.8 - 17"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }