UNPKG

@dojima-ui/theme

Version:

A dojima theme used across webpages developed in organisation.

692 lines (675 loc) 26.7 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var material = require('@mui/material'); var React = require('react'); var grey = require('@mui/material/colors/grey'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var grey__default = /*#__PURE__*/_interopDefaultLegacy(grey); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var Typography = { h1: { fontWeight: 600, fontSize: '2.375rem', letterSpacing: 'normal', }, h2: { fontWeight: 600, fontSize: '2rem', letterSpacing: 'normal', lineHeight: 1.04, // 1.04 * 16 = 16.64 }, h3: { fontWeight: 600, fontSize: '1.875rem', letterSpacing: 'normal', lineHeight: 0.68, // 0.68 * 16 = 10.88 }, h4: { fontWeight: 600, fontSize: '1.6875rem', letterSpacing: 'normal', }, h5: { fontWeight: 600, fontSize: '1.5rem', letterSpacing: 'normal', lineHeight: 0.86, // 0.86 * 16 = 13.76 }, h6: { fontWeight: 600, fontSize: '1.25rem', letterSpacing: 'normal', lineHeight: 0.75, }, subtitle1: { fontWeight: 500, fontSize: '1.25rem', lineHeight: 1.75, letterSpacing: '0.00938em', }, subtitle2: { fontWeight: 500, fontSize: '1rem', lineHeight: 1.57, letterSpacing: '0.00714em', }, body1: { fontWeight: 400, fontSize: '1rem', lineHeight: 1.5, letterSpacing: '0.00938em', }, body2: { fontWeight: 400, fontSize: '0.875rem', lineHeight: 1.43, letterSpacing: '0.01071em', }, caption: { fontWeight: 400, fontSize: '0.75rem', lineHeight: 1.66, letterSpacing: '0.03333em', }, button: { fontWeight: 400, fontSize: '0.75rem', letterSpacing: 'normal', lineHeight: 1.33, textTransform: 'none', // texttransform property can't be imported here and as type }, overline: { fontWeight: 400, fontSize: '0.625rem', lineHeight: 1.1, letterSpacing: 'normal', textTransform: 'none', // texttransform property can't be imported here and as type }, }; var typography = /*#__PURE__*/Object.freeze({ __proto__: null, 'default': Typography }); var shadows = [ 'none', '0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)', '0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)', '0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)', '0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)', '0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)', '0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)', '0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)', '0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)', '0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)', '0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)', '0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)', '0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)', '0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)', '0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)', '0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)', '0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)', '0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)', '0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)', '0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)', '0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)', '0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)', '0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)', '0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)', '0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)', ]; var black = '#000'; var white = '#fff'; var buttonHoverColor = '#9ebbbb'; var commonRed = '#f15855'; var commonGreen = '#01a0b3'; var commonLightGreen = 'rgba(232,244,225,0.5)'; var commonBackgroundImage = 'linear-gradient(to bottom, #40cddf, #5e79e9)'; var commonBackgroundColor = 'rgba(1, 160, 179, 0.05)'; var primaryLight = '#e1aa75'; var primaryMain = '#ff751f'; var primaryDark = '#c54500'; var secondaryLight = '#ff8b82'; var secondaryMain = '#f15855'; var secondaryDark = '#b8202c'; var successMain = '#1ca345'; var infoMain = '#0081ff'; var errorMain = '#de3f44'; var warningMain = '#ffc001'; var blackMain = '#212426'; var black50 = '#8b8b8b'; var black70 = '#5d5d5d'; var black30 = '#b9b9b9'; var black5 = '#f3f3f3'; var whiteHeadings = '#cfd0d0'; var whiteSubHeadings = '#8c8e8f'; var whiteAssestive = '#4b4e4f'; var whitePlaceholders = '#343739'; var colors = /*#__PURE__*/Object.freeze({ __proto__: null, black: black, white: white, buttonHoverColor: buttonHoverColor, commonRed: commonRed, commonGreen: commonGreen, commonLightGreen: commonLightGreen, commonBackgroundImage: commonBackgroundImage, commonBackgroundColor: commonBackgroundColor, primaryLight: primaryLight, primaryMain: primaryMain, primaryDark: primaryDark, secondaryLight: secondaryLight, secondaryMain: secondaryMain, secondaryDark: secondaryDark, successMain: successMain, infoMain: infoMain, errorMain: errorMain, warningMain: warningMain, blackMain: blackMain, black50: black50, black70: black70, black30: black30, black5: black5, whiteHeadings: whiteHeadings, whiteSubHeadings: whiteSubHeadings, whiteAssestive: whiteAssestive, whitePlaceholders: whitePlaceholders }); var DojimaTheme = function (_a) { var isDark = _a.isDark; var theme = React__default["default"].useMemo(function () { return material.createTheme({ breakpoints: { keys: ['xs', 'sm', 'md', 'lg', 'xl'], values: { xs: 0, sm: 600, md: 960, lg: 1280, xl: 1920 } }, direction: 'ltr', typography: __assign({ fontFamily: 'Poppins', // The default font size of the Material Specification. fontSize: 16, fontWeightLight: 300, fontWeightRegular: 400, fontWeightMedium: 500, fontWeightBold: 700, // Tell Material-UI what's the font-size on the html element. // 16px is the default font-size used by browsers. htmlFontSize: 16 }, Typography), shadows: shadows, palette: { common: { black: black, white: white }, mode: !isDark ? 'dark' : 'light', background: { // dark: isDark ? black : white, default: isDark ? white : material.colors.grey[900], paper: isDark ? white : material.colors.grey[800] }, primary: { main: isDark ? primaryMain : black, light: isDark ? primaryLight : commonLightGreen, dark: isDark ? primaryDark : commonGreen, contrastText: isDark ? white : white }, secondary: { main: isDark ? secondaryMain : white, light: isDark ? secondaryLight : white, dark: isDark ? secondaryDark : white, contrastText: isDark ? black : white }, text: { primary: isDark ? '#17252A' : material.colors.lightGreen[500], secondary: isDark ? primaryMain : material.colors.lightGreen[500], disabled: isDark ? grey__default["default"][600] : material.colors.lightGreen[900] // hint: isDark ? black : colors.lightGreen[900], }, divider: 'rgba(0, 0, 0, 0.12)', error: { main: errorMain, light: '#e57373', dark: '#d32f2f', contrastText: white }, warning: { main: warningMain, light: '#ffb74d', dark: '#f57c00', contrastText: 'rgba(0, 0, 0, 0.87)' }, info: { main: infoMain, light: '#64b5f6', dark: '#1976d2', contrastText: white }, success: { main: successMain, light: '#81c784', dark: '#388e3c', contrastText: 'rgba(0, 0, 0, 0.87)' }, grey: { 50: white, 100: black5, 200: whiteHeadings, 300: black30, 400: black50, 500: whiteSubHeadings, 600: black70, 700: whiteAssestive, 800: whitePlaceholders, 900: blackMain }, contrastThreshold: 3, tonalOffset: 0.2, action: { active: 'rgba(0, 0, 0, 0.54)', hover: 'rgba(0, 0, 0, 0.04)', hoverOpacity: 0.04, selected: 'rgba(0, 0, 0, 0.08)', selectedOpacity: 0.08, disabled: 'rgba(0, 0, 0, 0.26)', disabledBackground: 'rgba(0, 0, 0, 0.12)', disabledOpacity: 0.38, focus: 'rgba(0, 0, 0, 0.12)', focusOpacity: 0.12, activatedOpacity: 0.12 } }, shape: { borderRadius: 4 }, components: { MuiButton: { styleOverrides: { root: { '& .MuiButtonBase-root.Mui-disabled': { backgroundColor: 'rgba(0, 0, 0, 0.3)', backgroundImage: grey__default["default"][200] }, fontSize: '0.9375rem' }, contained: { '&:disabled': { backgroundImage: 'none' }, boxShadow: 'none', '&:hover': { boxShadow: 'none' } }, outlined: { // background: white, // '&:hover':{ // backgroundColor: black // } }, /* Styles applied to the root element if `variant="contained"` and `color="primary"`. */ containedPrimary: { // minWidth: '18.75rem', // minHeight: '3.125rem', borderRadius: '0.5rem', fontSize: '0.9375rem', backgroundImage: 'linear-gradient(to left, #40cddf, #5e79e9)', '&:hover': { // color: white, // backgroundColor: buttonHover, // boxShadow: // '0 1.1875rem 1.75rem 0 rgba(86, 86, 86, 0.2), 0 1rem 0.75rem 0 rgba(86, 86, 86, 0.18), 1rem 0 1rem 0 rgba(86, 86, 86, 0.18)', // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: buttonHoverColor, alignSelf: 'center' } }, '@media (max-width: 1024px)': { fontSize: '0.9375rem', fontFamily: 'Poppins', borderRadius: '0.25rem' } }, textPrimary: { color: primaryLight, '&:hover': { backgroundColor: 'transparent', // boxShadow: // '0 1.1875rem 1.75rem 0 rgba(86, 86, 86, 0.2), 0 1rem 0.75rem 0 rgba(86, 86, 86, 0.18), 1rem 0 1rem 0 rgba(86, 86, 86, 0.18)', // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: buttonHoverColor, alignSelf: 'center' } } } } }, MuiTextField: { styleOverrides: { root: { '& .MuiInputBase-root.Mui-disabled': { color: 'rgba(0, 0, 0, 0.5)' // (default alpha is 0.38) }, '@media (max-width: 1024px)': { '& .MuiFormLabel-root': { // lineHeight: 0, // fontSize: '0.625rem' }, '& .MuiInputBase-root': { paddingRight: '0.2rem' } } } } }, MuiFormControlLabel: { styleOverrides: { label: { fontSize: '0.9375rem', color: 'rgba(0, 0, 0, 0.8)' } } }, MuiRadio: { styleOverrides: { root: {}, colorSecondary: { color: primaryLight, '&$checked': { color: primaryLight } } } }, MuiCheckbox: { styleOverrides: { colorSecondary: { color: primaryLight, '&$checked': { color: primaryLight } } } }, MuiStepLabel: { styleOverrides: { root: { fontFamily: 'Poppins', fontSize: '0.875rem' } } }, MuiInputLabel: { styleOverrides: { root: { '&$disabled': { color: 'rgba(0,0,0,0.3)' } }, outlined: { '&$shrink': { transform: 'translate(0px, -6px) scale(0.75)' } } } } } }); }, [isDark]); return theme; }; var StoryBookTheme = material.createTheme({ breakpoints: { keys: ['xs', 'sm', 'md', 'lg', 'xl'], values: { xs: 0, sm: 600, md: 960, lg: 1280, xl: 1920 } }, direction: 'ltr', typography: __assign({ fontFamily: 'Poppins', // The default font size of the Material Specification. fontSize: 16, fontWeightLight: 300, fontWeightRegular: 400, fontWeightMedium: 500, fontWeightBold: 700, // Tell Material-UI what's the font-size on the html element. // 16px is the default font-size used by browsers. htmlFontSize: 16 }, Typography), shadows: shadows, palette: { common: { black: black, white: white }, mode: 'light', background: { // dark: isDark ? black : white, default: white , paper: white }, primary: { main: primaryMain , light: primaryLight , dark: primaryDark , contrastText: white }, secondary: { main: secondaryMain , light: secondaryLight , dark: secondaryDark , contrastText: black }, text: { primary: '#17252A' , secondary: primaryMain , disabled: grey__default["default"][600] // hint: isDark ? black : colors.lightGreen[900], }, divider: 'rgba(0, 0, 0, 0.12)', error: { main: '#f44336', light: '#e57373', dark: '#d32f2f', contrastText: white }, warning: { main: '#ff9800', light: '#ffb74d', dark: '#f57c00', contrastText: 'rgba(0, 0, 0, 0.87)' }, info: { main: '#2196f3', light: '#64b5f6', dark: '#1976d2', contrastText: white }, success: { main: '#4caf50', light: '#81c784', dark: '#388e3c', contrastText: 'rgba(0, 0, 0, 0.87)' }, contrastThreshold: 3, tonalOffset: 0.2, action: { active: 'rgba(0, 0, 0, 0.54)', hover: 'rgba(0, 0, 0, 0.04)', hoverOpacity: 0.04, selected: 'rgba(0, 0, 0, 0.08)', selectedOpacity: 0.08, disabled: 'rgba(0, 0, 0, 0.26)', disabledBackground: 'rgba(0, 0, 0, 0.12)', disabledOpacity: 0.38, focus: 'rgba(0, 0, 0, 0.12)', focusOpacity: 0.12, activatedOpacity: 0.12 } }, shape: { borderRadius: 4 }, components: { MuiButton: { styleOverrides: { root: { '& .MuiButtonBase-root.Mui-disabled': { backgroundColor: 'rgba(0, 0, 0, 0.3)', backgroundImage: grey__default["default"][200] }, fontSize: '0.9375rem' }, contained: { '&:disabled': { backgroundImage: 'none' }, boxShadow: 'none', '&:hover': { boxShadow: 'none' } }, outlined: { // background: white, // '&:hover':{ // backgroundColor: black // } }, /* Styles applied to the root element if `variant="contained"` and `color="primary"`. */ containedPrimary: { // minWidth: '18.75rem', // minHeight: '3.125rem', borderRadius: '0.5rem', fontSize: '0.9375rem', backgroundImage: 'linear-gradient(to left, #40cddf, #5e79e9)', '&:hover': { // color: white, // backgroundColor: buttonHover, // boxShadow: // '0 1.1875rem 1.75rem 0 rgba(86, 86, 86, 0.2), 0 1rem 0.75rem 0 rgba(86, 86, 86, 0.18), 1rem 0 1rem 0 rgba(86, 86, 86, 0.18)', // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: buttonHoverColor, alignSelf: 'center' } }, '@media (max-width: 1024px)': { fontSize: '0.9375rem', fontFamily: 'Poppins', borderRadius: '0.25rem' } }, textPrimary: { color: primaryLight, '&:hover': { backgroundColor: 'transparent', // boxShadow: // '0 1.1875rem 1.75rem 0 rgba(86, 86, 86, 0.2), 0 1rem 0.75rem 0 rgba(86, 86, 86, 0.18), 1rem 0 1rem 0 rgba(86, 86, 86, 0.18)', // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: buttonHoverColor, alignSelf: 'center' } } } } }, MuiTextField: { styleOverrides: { root: { '& .MuiInputBase-root.Mui-disabled': { color: 'rgba(0, 0, 0, 0.5)' // (default alpha is 0.38) }, '@media (max-width: 1024px)': { '& .MuiFormLabel-root': { // lineHeight: 0, // fontSize: '0.625rem' }, '& .MuiInputBase-root': { paddingRight: '0.2rem' } } } } }, MuiFormControlLabel: { styleOverrides: { label: { fontSize: '0.9375rem', color: 'rgba(0, 0, 0, 0.8)' } } }, MuiRadio: { styleOverrides: { root: {}, colorSecondary: { color: primaryLight, '&$checked': { color: primaryLight } } } }, MuiCheckbox: { styleOverrides: { colorSecondary: { color: primaryLight, '&$checked': { color: primaryLight } } } }, MuiStepLabel: { styleOverrides: { root: { fontFamily: 'Poppins', fontSize: '0.875rem' } } }, MuiInputLabel: { styleOverrides: { root: { '&$disabled': { color: 'rgba(0,0,0,0.3)' } }, outlined: { '&$shrink': { transform: 'translate(0px, -6px) scale(0.75)' } } } } } }); exports.StoryBookTheme = StoryBookTheme; exports.colors = colors; exports["default"] = DojimaTheme; exports.typography = typography; //# sourceMappingURL=index.js.map