Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 1 addition & 133 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@kyper/input": "^6.1.0",
"@kyper/institutionlogo": "^3.1.0",
"@kyper/messagebox": "^3.1.0",
"@kyper/mui": "^4.5.0",
"@kyper/progressindicators": "^3.1.0",
"@kyper/select": "^2.0.0",
"@kyper/selectionbox": "^2.1.0",
Expand Down
88 changes: 42 additions & 46 deletions src/ConnectedTokenProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from 'react'
import { RootState } from 'src/redux/Store'
import _isEmpty from 'lodash/isEmpty'
import { useSelector } from 'react-redux'

import { Theme, ThemeProvider } from '@mui/material'
import { deepmerge } from '@mui/utils'

import { createMXTheme, Icon, IconWeight } from '@kyper/mui'
import { createMXTheme, Icon, IconWeight } from '@mxenabled/mxui'
import { TokenProvider, THEMES } from '@kyper/tokenprovider'

import { getTokenProviderValues } from 'src/redux/selectors/ClientColorScheme'
import { getPrimarySeedColor } from 'src/redux/selectors/ClientColorScheme'

declare module '@mui/material/styles' {
interface PaletteColor {
Expand All @@ -23,30 +22,6 @@ declare module '@mui/material/styles' {
}
}

interface ColorScheme {
Brand100?: string
Brand200?: string
Brand300?: string
Brand400?: string
Brand500?: string
}

export const clientThemeOverrides = (colorScheme: ColorScheme) => {
if (!_isEmpty(colorScheme)) {
return {
palette: {
primary: {
lighter: colorScheme.Brand100,
light: colorScheme.Brand200,
main: colorScheme.Brand300,
dark: colorScheme.Brand400,
darker: colorScheme.Brand500,
},
},
}
}
return {}
}
const connectThemeOverrides = (palette: Theme['palette']) => ({
components: {
MuiTypography: {
Expand All @@ -55,11 +30,6 @@ const connectThemeOverrides = (palette: Theme['palette']) => ({
// Sets the default color of text. Can override singluar usage with color prop.
color: palette?.text?.primary,
},
// TODO: Remove once we fully migrate to @mxenabled/mxui as it would apply the right theme styles automatically.
subtitle2: {
fontSize: '13px',
lineHeight: '20px',
},
},
},
MuiAccordion: {
Expand Down Expand Up @@ -111,12 +81,6 @@ const connectThemeOverrides = (palette: Theme['palette']) => ({
},
MuiFormLabel: {
styleOverrides: {
root: {
'&.MuiFormLabel-root': {
fontSize: '13px',
lineHeight: '20px',
},
},
asterisk: {
color: '#E32727',
'&$error': {
Expand Down Expand Up @@ -149,6 +113,20 @@ const connectThemeOverrides = (palette: Theme['palette']) => ({
},
},
},
MuiLink: {
defaultProps: {
sx: {
display: 'inline-flex',
alignItems: 'center',
'&:hover': {
textDecoration: 'underline',
},
'&:focus': {
textDecoration: 'underline',
},
},
},
},
},
})

Expand All @@ -157,27 +135,45 @@ interface Props {
}

export const ConnectedTokenProvider = ({ children }: Props): React.ReactNode => {
// Client custom tokens from batcave
const clientCustomTokens = useSelector(getTokenProviderValues)
// Client primary seed color from batcave
const clientPrimarySeedColor = useSelector(getPrimarySeedColor)
// "Light" or "Dark"
const colorScheme = useSelector((state: RootState) => state.config.color_scheme)
// Dark mode: true or false
const isDarkModeEnabled: boolean = colorScheme === THEMES.DARK
// Theme object with MX overrides
const mxTheme = createMXTheme(isDarkModeEnabled ? 'dark' : 'light')
const mxTheme = createMXTheme(isDarkModeEnabled ? 'dark' : 'light', {
paletteOptions: {
// Override primary color with widget_brand_color from batcave if it exists or use primary_300 from batcave and
// let the rest of the palette colors be generated by MXUI.
primary: clientPrimarySeedColor,
},
})

const combinedTheme = deepmerge(
mxTheme,
deepmerge(
clientThemeOverrides(clientCustomTokens.tokenOverrides.Color), // Theme object with client custom overrides
connectThemeOverrides(mxTheme.palette as Theme['palette']), // Theme object with connect overrides
),
connectThemeOverrides(mxTheme.palette as Theme['palette']), // Theme object with connect overrides
)

const kyperTokenOverrides = {
Color: {
Brand100: isDarkModeEnabled ? mxTheme.palette.primary[800] : mxTheme.palette.primary[100],
Brand200: mxTheme.palette.primary.light,
Brand300: mxTheme.palette.primary.main,
Brand400: mxTheme.palette.primary.dark,
Brand500: isDarkModeEnabled ? mxTheme.palette.primary[50] : mxTheme.palette.primary[900],
Primary100: isDarkModeEnabled ? mxTheme.palette.primary[800] : mxTheme.palette.primary[100],
Primary200: mxTheme.palette.primary.light,
Primary300: mxTheme.palette.primary.main,
Primary400: mxTheme.palette.primary.dark,
Primary500: isDarkModeEnabled ? mxTheme.palette.primary[50] : mxTheme.palette.primary[900],
},
}

return (
<TokenProvider
theme={isDarkModeEnabled ? THEMES.DARK : colorScheme}
tokenOverrides={clientCustomTokens.tokenOverrides}
tokenOverrides={kyperTokenOverrides}
>
<ThemeProvider theme={combinedTheme}>{children}</ThemeProvider>
</TokenProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ActionTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react'
import PropTypes from 'prop-types'

import { useTokens } from '@kyper/tokenprovider'
import { Text } from '@kyper/mui'
import { ChevronRightIcon } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'
import { ChevronRightIcon } from '@mxenabled/mxui'
import { Button } from '@mui/material'

export const ActionTile = (props) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionableUtilityRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react'

import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'
import { useTokens } from '@kyper/tokenprovider'
import { Button } from '@mui/material'

Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigError.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'
import { useTokens } from '@kyper/tokenprovider'
import { Container } from 'src/components/Container'
import { AttentionFilled } from '@kyper/icon/AttentionFilled'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectLogoHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react'
import { useSelector } from 'react-redux'
import { InstitutionLogo } from '@kyper/mui'
import { InstitutionLogo } from '@mxenabled/mxui'
import { useTokens } from '@kyper/tokenprovider'

import { selectColorScheme } from 'src/redux/reducers/configSlice'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectSuccessSurvey.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useImperativeHandle, useContext } from 'react'
import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'
import { Button, TextField } from '@mui/material'
import ToggleButton from '@mui/material/ToggleButton'
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataCluster.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from 'react'
import PropTypes from 'prop-types'
import { useTokens } from '@kyper/tokenprovider'
import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'

export const DataCluster = (props) => {
const tokens = useTokens()
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataClusterDropDown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { useTokens } from '@kyper/mui'
import { useTokens } from '@mxenabled/mxui'
import {
Accordion,
AccordionSummary,
Expand All @@ -10,7 +10,7 @@ import {
Icon,
Stack,
} from '@mui/material'
import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'

import { __ } from 'src/utilities/Intl'

Expand Down
2 changes: 1 addition & 1 deletion src/components/DayOfMonthPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import _range from 'lodash/range'

import { useTokens } from '@kyper/tokenprovider'
import { Button } from '@kyper/button'
import { Text } from '@kyper/mui'
import { Text } from '@mxenabled/mxui'

import { fadeOut } from 'src/utilities/Animation'
import { __ } from 'src/utilities/Intl'
Expand Down
Loading
Loading