@taruvi/navkit 0.0.43 → 0.0.44

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.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@taruvi/navkit",
3
- "version": "0.0.43",
4
- "main": "src/App.tsx",
3
+ "version": "0.0.44",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.js",
5
6
  "type": "module",
6
7
  "scripts": {
7
8
  "dev": "vite",
package/src/App.styles.ts CHANGED
@@ -77,10 +77,11 @@ export const getAppStyles = (mode: ThemeMode) => {
77
77
  overflow: 'hidden',
78
78
  },
79
79
  toolbar: {
80
- backgroundColor: '#2B97FF',
80
+ backgroundColor: '#004369',
81
81
  boxShadow: ' 0px 0px 10px 2px rgba(0, 0, 0, 0.3)',
82
82
  justifyContent: 'space-between',
83
- minHeight: dimensions.navHeight,
83
+ minHeight: `${dimensions.navHeight} !important`,
84
+ height: dimensions.navHeight,
84
85
  },
85
86
  leftSection: {
86
87
  display: 'flex',
package/src/App.tsx CHANGED
@@ -13,7 +13,7 @@ import taruviLogoWhite from "./assets/taruvi-logo-white.png";
13
13
  import type { Client } from "@taruvi/sdk"
14
14
 
15
15
  const NavkitContent = () => {
16
- const { isUserAuthenticated, siteSettings, appSettings, appSettingsLoaded, appName, userData, jwtToken, themeMode } = useNavigation();
16
+ const { isUserAuthenticated, siteSettings, appSettings, appSettingsLoaded, appName, userData, jwtToken, themeMode, navbarColor, iconColor } = useNavigation();
17
17
  const resolvedAppName = appName || appSettings?.displayName
18
18
  const showTaruviLogo = appSettingsLoaded && !resolvedAppName && !appSettings?.icon
19
19
  const styles = getAppStyles(themeMode)
@@ -36,7 +36,7 @@ const NavkitContent = () => {
36
36
  />
37
37
  )}
38
38
  <AppBar position="static" sx={styles.appBar}>
39
- <Toolbar sx={styles.toolbar}>
39
+ <Toolbar sx={{ ...styles.toolbar, ...(navbarColor && { backgroundColor: navbarColor }) }}>
40
40
  <Box component={"a"} href="/" sx={styles.leftSection}>
41
41
  {showTaruviLogo ? (
42
42
  <Box component="img" src={taruviLogoWhite} sx={styles.taruviSpaceLogo} />
@@ -52,7 +52,7 @@ const NavkitContent = () => {
52
52
  ) : null}
53
53
  </Box>
54
54
  <Box component={"div"} sx={styles.rightSection}>
55
- <Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} />
55
+ <Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} iconColor={iconColor} />
56
56
  <Box
57
57
  onClick={() => {
58
58
  if (isUserAuthenticated) {
@@ -79,7 +79,7 @@ const NavkitContent = () => {
79
79
  <Box component="img" src={taruviLogo} sx={styles.appLauncherLogo} />
80
80
  )}
81
81
  </Box>
82
- {isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)} />}
82
+ {isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)} iconColor={iconColor} />}
83
83
  </Box>
84
84
  </Toolbar>
85
85
  </AppBar>
@@ -121,11 +121,13 @@ interface NavkitProps {
121
121
  client: Client
122
122
  appName?: string
123
123
  getTheme?: (theme: 'light' | 'dark') => void
124
+ navbarColor?: string
125
+ iconColor?: string
124
126
  }
125
127
 
126
- const Navkit = ({ client, getTheme, appName }: NavkitProps) => {
128
+ const Navkit = ({ client, getTheme, appName, navbarColor, iconColor }: NavkitProps) => {
127
129
  return (
128
- <NavkitProvider client={client} onThemeChange={getTheme} appName={appName}>
130
+ <NavkitProvider client={client} onThemeChange={getTheme} appName={appName} navbarColor={navbarColor} iconColor={iconColor}>
129
131
  <NavkitContent />
130
132
  </NavkitProvider>
131
133
  )
@@ -19,7 +19,7 @@ const getInitialTheme = (): ThemeMode => {
19
19
 
20
20
  export const NavigationContext = createContext<NavigationContextType | undefined>(undefined)
21
21
 
22
- export const NavkitProvider = ({ children, client, onThemeChange, appName }: NavkitProviderProps) => {
22
+ export const NavkitProvider = ({ children, client, onThemeChange, appName, navbarColor, iconColor }: NavkitProviderProps) => {
23
23
  const auth = new Auth(client)
24
24
 
25
25
  const user = useRef<any>(null)
@@ -176,7 +176,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
176
176
  }, [themeMode, onThemeChange])
177
177
 
178
178
  return (
179
- <NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appSettingsLoaded, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
179
+ <NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appSettingsLoaded, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme, navbarColor, iconColor }}>
180
180
  {children}
181
181
  </NavigationContext.Provider>
182
182
  )
@@ -4,9 +4,9 @@ import { useNavigation } from '../../NavkitContext'
4
4
 
5
5
  const ProfileIcon = ({ color }: { color?: string }) => (
6
6
  <SvgIcon viewBox="0 0 22 22" sx={{ fontSize: 23, display: 'block' }}>
7
- <path d="M10.9921 20.9849C16.511 20.9849 20.9849 16.511 20.9849 10.9921C20.9849 5.4732 16.511 0.999268 10.9921 0.999268C5.47322 0.999268 0.999283 5.4732 0.999283 10.9921C0.999283 16.511 5.47322 20.9849 10.9921 20.9849Z" stroke={color || "#ffffff"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
8
- <path d="M10.9921 11.9914C12.6478 11.9914 13.9899 10.6492 13.9899 8.99357C13.9899 7.33791 12.6478 5.99573 10.9921 5.99573C9.33644 5.99573 7.99426 7.33791 7.99426 8.99357C7.99426 10.6492 9.33644 11.9914 10.9921 11.9914Z" stroke={color || "#ffffff"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
9
- <path d="M5.99569 19.6479V17.9871C5.99569 17.457 6.20625 16.9487 6.58106 16.5739C6.95586 16.1991 7.4642 15.9885 7.99425 15.9885H13.9899C14.52 15.9885 15.0283 16.1991 15.4031 16.5739C15.7779 16.9487 15.9885 17.457 15.9885 17.9871V19.6479" stroke={color || "#ffffff"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
7
+ <path d="M10.9921 20.9849C16.511 20.9849 20.9849 16.511 20.9849 10.9921C20.9849 5.4732 16.511 0.999268 10.9921 0.999268C5.47322 0.999268 0.999283 5.4732 0.999283 10.9921C0.999283 16.511 5.47322 20.9849 10.9921 20.9849Z" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
8
+ <path d="M10.9921 11.9914C12.6478 11.9914 13.9899 10.6492 13.9899 8.99357C13.9899 7.33791 12.6478 5.99573 10.9921 5.99573C9.33644 5.99573 7.99426 7.33791 7.99426 8.99357C7.99426 10.6492 9.33644 11.9914 10.9921 11.9914Z" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
9
+ <path d="M5.99569 19.6479V17.9871C5.99569 17.457 6.20625 16.9487 6.58106 16.5739C6.95586 16.1991 7.4642 15.9885 7.99425 15.9885H13.9899C14.52 15.9885 15.0283 16.1991 15.4031 16.5739C15.7779 16.9487 15.9885 17.457 15.9885 17.9871V19.6479" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
10
10
  </SvgIcon>
11
11
  )
12
12
 
@@ -10,7 +10,7 @@ export const shortcutsStyles = {
10
10
  mobileTrigger: {
11
11
  display: { xs: 'flex', md: 'none' },
12
12
  ml: spacing.sm,
13
- color: '#ffffff',
13
+ color: '#9DE5FD',
14
14
  },
15
15
  shortcut: {
16
16
  display: 'flex',
@@ -25,6 +25,6 @@ export const shortcutsStyles = {
25
25
  },
26
26
  iconStyle: {
27
27
  fontSize: '23px',
28
- color: '#ffffff',
28
+ color: colours.text.secondary,
29
29
  },
30
30
  }
@@ -6,7 +6,7 @@ import { useNavigation } from '../../NavkitContext'
6
6
 
7
7
  const ChatIcon = ({ color }: { color?: string }) => (
8
8
  <SvgIcon viewBox="-2 -2 24 24" sx={{ fontSize: 23, display: 'block', position: 'relative', top: 2 }}>
9
- <path d="M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0Z" fill={color || "#ffffff"}/>
9
+ <path d="M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0Z" fill={color || "#9DE5FD"}/>
10
10
  </SvgIcon>
11
11
  )
12
12
 
@@ -65,7 +65,7 @@ const Shortcuts = (props: ShortcutsProps) => {
65
65
  >
66
66
  <FontAwesomeIcon
67
67
  icon={["fas", "ellipsis-v"]}
68
- style={{ ...shortcutsStyles.iconStyle, color: iconColor || '#ffffff' }}
68
+ style={{ ...shortcutsStyles.iconStyle, color: iconColor || '#9DE5FD' }}
69
69
  />
70
70
  </IconButton>
71
71
  )}
package/src/types.ts CHANGED
@@ -42,6 +42,8 @@ export interface NavigationContextType {
42
42
  auth: Auth
43
43
  themeMode: ThemeMode
44
44
  toggleTheme: () => void
45
+ navbarColor?: string
46
+ iconColor?: string
45
47
  }
46
48
 
47
49
  export interface NavkitProviderProps {
@@ -49,4 +51,6 @@ export interface NavkitProviderProps {
49
51
  client: Client
50
52
  onThemeChange?: (theme: ThemeMode) => void
51
53
  appName?: string
54
+ navbarColor?: string
55
+ iconColor?: string
52
56
  }
package/vite.config.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineConfig } from 'vite'
2
2
  import react from '@vitejs/plugin-react'
3
+ import { resolve } from 'path'
3
4
 
4
5
  // https://vite.dev/config/
5
6
  export default defineConfig({
@@ -10,4 +11,26 @@ export default defineConfig({
10
11
  },
11
12
  }),
12
13
  ],
14
+ build: {
15
+ lib: {
16
+ entry: resolve(__dirname, 'src/App.tsx'),
17
+ formats: ['es'],
18
+ fileName: 'index',
19
+ },
20
+ rollupOptions: {
21
+ external: [
22
+ 'react',
23
+ 'react-dom',
24
+ 'react/jsx-runtime',
25
+ '@mui/material',
26
+ '@mui/icons-material',
27
+ '@emotion/react',
28
+ '@emotion/styled',
29
+ '@fortawesome/fontawesome-svg-core',
30
+ '@fortawesome/free-solid-svg-icons',
31
+ '@fortawesome/free-regular-svg-icons',
32
+ '@fortawesome/react-fontawesome',
33
+ ],
34
+ },
35
+ },
13
36
  })