@deix/rossini-core 0.5.3 → 0.6.0

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deix/rossini-core",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "main": "lib/src/index.js",
5
5
  "type": "commonjs",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  export interface AvatarProps {
3
3
  /**
4
4
  * URL address for the logout API.
@@ -49,21 +49,21 @@ const Avatar = ({ logoutUrl, accountSettingsUrl, }) => {
49
49
  const apiClient = (0, utils_1.useAPI)(accountSettingsUrl);
50
50
  const { data: userInfo } = (0, useKeycloak_1.useUserInfo)(apiClient);
51
51
  return (react_1.default.createElement(react_1.default.Fragment, null,
52
- react_1.default.createElement(material_1.Tooltip, { title: userInfo?.preferredUserName || 'Anonymous User' },
53
- react_1.default.createElement(material_1.Avatar, { alt: userInfo?.preferredUserName || 'user-name', sx: {
54
- bgcolor: muiTheme.palette.primary.main,
52
+ react_1.default.createElement(material_1.Tooltip, { title: userInfo?.preferredUserName || "Anonymous User" },
53
+ react_1.default.createElement(material_1.Avatar, { alt: userInfo?.preferredUserName || "user-name", sx: {
55
54
  width: 24,
56
55
  height: 24,
56
+ bgcolor: muiTheme.palette.topbar.contrastText,
57
57
  }, onClick: handleClick })),
58
58
  react_1.default.createElement(material_1.Menu, { anchorEl: anchorEl, open: open, onClose: handleClose, anchorOrigin: {
59
- vertical: 'bottom',
60
- horizontal: 'right',
59
+ vertical: "bottom",
60
+ horizontal: "right",
61
61
  }, transformOrigin: {
62
- vertical: 'top',
63
- horizontal: 'right',
62
+ vertical: "top",
63
+ horizontal: "right",
64
64
  }, PaperProps: {
65
65
  sx: {
66
- padding: '4px',
66
+ padding: "4px",
67
67
  },
68
68
  } },
69
69
  accountSettingsUrl && (react_1.default.createElement(link_1.default, { href: accountSettingsUrl },
@@ -1,5 +1,5 @@
1
- import { FunctionComponent } from 'react';
2
- import { Language, Locale } from '../../../types/languages';
1
+ import { FunctionComponent } from "react";
2
+ import { Language, Locale } from "../../../types/languages";
3
3
  export interface LanguageSelectProps {
4
4
  /**
5
5
  * Internationalization locale.
@@ -1 +1 @@
1
- {"version":3,"file":"LanguageSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/buttons/LanguageSelect/LanguageSelect.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAgBjD,OAAO,EAGL,QAAQ,EACR,MAAM,EACP,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA6EjE,CAAC"}
1
+ {"version":3,"file":"LanguageSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/buttons/LanguageSelect/LanguageSelect.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAiBjD,OAAO,EAGL,QAAQ,EACR,MAAM,EACP,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA+EjE,CAAC"}
@@ -11,14 +11,15 @@ const Language_1 = __importDefault(require("@mui/icons-material/Language"));
11
11
  const material_1 = require("@mui/material");
12
12
  const languages_1 = require("../../../types/languages");
13
13
  const translations_json_1 = __importDefault(require("./translations.json"));
14
- const LanguageSelect = ({ locale = 'en', languages = [
14
+ const LanguageSelect = ({ locale = "en", languages = [
15
15
  {
16
- id: 'en',
17
- label: 'English',
18
- countryCode: 'us',
19
- MUILocale: 'enUS',
16
+ id: "en",
17
+ label: "English",
18
+ countryCode: "us",
19
+ MUILocale: "enUS",
20
20
  },
21
21
  ], }) => {
22
+ const muiTheme = (0, material_1.useTheme)();
22
23
  // Menu controls
23
24
  const [anchorEl, setAnchorEl] = react_1.default.useState(null);
24
25
  const open = Boolean(anchorEl);
@@ -34,18 +35,18 @@ const LanguageSelect = ({ locale = 'en', languages = [
34
35
  };
35
36
  const router = (0, router_1.useRouter)();
36
37
  return (react_1.default.createElement(react_1.default.Fragment, null,
37
- react_1.default.createElement(material_1.Tooltip, { title: translations_json_1.default['tooltip'][locale] },
38
+ react_1.default.createElement(material_1.Tooltip, { title: translations_json_1.default["tooltip"][locale] },
38
39
  react_1.default.createElement(material_1.IconButton, { component: 'span', "aria-label": 'language', onClick: openOptions },
39
- react_1.default.createElement(Language_1.default, null))),
40
+ react_1.default.createElement(Language_1.default, { htmlColor: muiTheme.palette.topbar.contrastText }))),
40
41
  react_1.default.createElement(material_1.Menu, { anchorEl: anchorEl, id: 'language-menu', open: open, onClose: closeOptions, onClick: closeOptions, anchorOrigin: {
41
- vertical: 'bottom',
42
- horizontal: 'right',
42
+ vertical: "bottom",
43
+ horizontal: "right",
43
44
  }, transformOrigin: {
44
- vertical: 'top',
45
- horizontal: 'right',
45
+ vertical: "top",
46
+ horizontal: "right",
46
47
  }, PaperProps: {
47
48
  sx: {
48
- padding: '4px',
49
+ padding: "4px",
49
50
  },
50
51
  } },
51
52
  react_1.default.createElement(material_1.MenuList, { dense: true }, languages?.map((lang) => (react_1.default.createElement(link_1.default, { key: lang.id, href: router.asPath, locale: lang.id },
@@ -1,6 +1,6 @@
1
- import React, { ReactElement } from 'react';
2
- import { Variant } from '@mui/material/styles/createTypography';
3
- import { Locale, StringTranslation } from '../../../../types/languages';
1
+ import React, { ReactElement } from "react";
2
+ import { Variant } from "@mui/material/styles/createTypography";
3
+ import { Locale, StringTranslation } from "../../../../types/languages";
4
4
  export interface SidebarLink {
5
5
  /**
6
6
  * Unique identifier of the link.
@@ -42,12 +42,12 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
42
42
  // Handle default item icon and change color according to selection
43
43
  const icons = (link, selected) => {
44
44
  const color = selected
45
- ? muiTheme.palette.primary.main
46
- : muiTheme.palette.linkNotActive.main;
45
+ ? muiTheme.palette.sidebar.contrastText
46
+ : muiTheme.palette.sidebar.light;
47
47
  return (react_1.default.createElement(material_1.ListItemIcon, { color: color }, link.sidebarIcon ? (link.sidebarIcon(color)) : (react_1.default.createElement(ArrowRightOutlined_1.default, { htmlColor: color }))));
48
48
  };
49
49
  // Persist which items of the sidebar are open to avoid resetting on page change
50
- const [sidebarItemOpen, setSidebarItemOpen] = (0, utils_1.usePersistedState)('sidebarItemOpen', {});
50
+ const [sidebarItemOpen, setSidebarItemOpen] = (0, utils_1.usePersistedState)("sidebarItemOpen", {});
51
51
  const handleOpenSidebarItem = (item) => {
52
52
  const oldOpenState = { ...sidebarItemOpen };
53
53
  oldOpenState[item] =
@@ -81,39 +81,39 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
81
81
  }
82
82
  })
83
83
  .map((link) => {
84
- const selected = link.path === '/'
85
- ? pathname === '/'
84
+ const selected = link.path === "/"
85
+ ? pathname === "/"
86
86
  : pathname.slice(1).startsWith(link.path.slice(1));
87
87
  if (!link.subPages) {
88
88
  return (react_1.default.createElement(link_1.default, { key: link.id, href: link.path },
89
89
  react_1.default.createElement(material_1.ListItemButton, { selected: selected, style: {
90
- paddingLeft: options.level === 1 && open ? '32px' : '22px',
90
+ paddingLeft: options.level === 1 && open ? "32px" : "22px",
91
91
  paddingTop: options.level === 1 ? 0 : 8,
92
92
  paddingBottom: options.level === 1 ? 0 : 8,
93
- borderTopRightRadius: '20px',
94
- borderBottomRightRadius: '20px',
93
+ borderTopRightRadius: "20px",
94
+ borderBottomRightRadius: "20px",
95
95
  } },
96
96
  icons(link, selected),
97
97
  react_1.default.createElement(material_1.ListItemText, { style: {
98
98
  color: selected
99
- ? `${muiTheme.palette.primary.main} !important`
100
- : `${muiTheme.palette.linkNotActive.main} !important`,
101
- marginLeft: '-20px',
102
- visibility: 'visible',
103
- }, disableTypography: true, primary: react_1.default.createElement(material_1.Typography, { variant: link.labelVariant || 'h6', style: selected
104
- ? { color: muiTheme.palette.primary.main }
105
- : { color: muiTheme.palette.linkNotActive.main } }, (0, languages_1.isStringTranslation)(link.label)
99
+ ? `${muiTheme.palette.sidebar.contrastText} !important`
100
+ : `${muiTheme.palette.sidebar.light} !important`,
101
+ marginLeft: "-20px",
102
+ visibility: "visible",
103
+ }, disableTypography: true, primary: react_1.default.createElement(material_1.Typography, { variant: link.labelVariant || "h6", style: selected
104
+ ? { color: muiTheme.palette.sidebar.contrastText }
105
+ : { color: muiTheme.palette.sidebar.light } }, (0, languages_1.isStringTranslation)(link.label)
106
106
  ? link.label[locale]
107
107
  : link.label) }))));
108
108
  }
109
109
  return (react_1.default.createElement("div", { key: link.id },
110
110
  react_1.default.createElement(link_1.default, { href: link.path },
111
111
  react_1.default.createElement(material_1.ListItemButton, { key: link.id, selected: selected, style: {
112
- paddingLeft: '22px',
112
+ paddingLeft: "22px",
113
113
  paddingTop: 8,
114
114
  paddingBottom: 8,
115
- borderTopRightRadius: '20px',
116
- borderBottomRightRadius: '20px',
115
+ borderTopRightRadius: "20px",
116
+ borderBottomRightRadius: "20px",
117
117
  }, onClick: (_evt) => {
118
118
  if (!sidebarItemOpen[link.id]) {
119
119
  handleOpenSidebarItem(link.id);
@@ -122,13 +122,13 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
122
122
  icons(link, selected),
123
123
  react_1.default.createElement(material_1.ListItemText, { style: {
124
124
  color: selected
125
- ? `${muiTheme.palette.primary.main} !important`
126
- : `${muiTheme.palette.linkNotActive.main} !important`,
127
- marginLeft: '-20px',
128
- visibility: 'visible',
129
- }, disableTypography: true, primary: react_1.default.createElement(material_1.Typography, { variant: link.labelVariant || 'h6', style: selected
130
- ? { color: muiTheme.palette.primary.main }
131
- : { color: muiTheme.palette.linkNotActive.main } }, (0, languages_1.isStringTranslation)(link.label)
125
+ ? `${muiTheme.palette.sidebar.contrastText} !important`
126
+ : `${muiTheme.palette.sidebar.light} !important`,
127
+ marginLeft: "-20px",
128
+ visibility: "visible",
129
+ }, disableTypography: true, primary: react_1.default.createElement(material_1.Typography, { variant: link.labelVariant || "h6", style: selected
130
+ ? { color: muiTheme.palette.sidebar.contrastText }
131
+ : { color: muiTheme.palette.sidebar.light } }, (0, languages_1.isStringTranslation)(link.label)
132
132
  ? link.label[locale]
133
133
  : link.label) }),
134
134
  sidebarItemOpen[link.id] ? (react_1.default.createElement(material_1.IconButton, { onClick: (e) => {
@@ -156,40 +156,40 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
156
156
  })
157
157
  // .filter((l) => l.id !== 'settings')
158
158
  .map((link) => {
159
- const selected = link.path === '/'
160
- ? pathname === '/'
159
+ const selected = link.path === "/"
160
+ ? pathname === "/"
161
161
  : pathname.slice(1).startsWith(link.path.slice(1));
162
162
  if (link.subPages) {
163
163
  return (react_1.default.createElement("div", { key: link.id },
164
164
  react_1.default.createElement(material_1.ListItemButton, { selected: selected, style: {
165
- paddingLeft: '22px',
165
+ paddingLeft: "22px",
166
166
  paddingTop: 8,
167
167
  paddingBottom: 8,
168
- borderTopRightRadius: '20px',
169
- borderBottomRightRadius: '20px',
168
+ borderTopRightRadius: "20px",
169
+ borderBottomRightRadius: "20px",
170
170
  }, onClick: (evt) => handleOpenSidebarMenu(link.id, evt) },
171
171
  react_1.default.createElement(material_1.Tooltip, { title: (0, languages_1.isStringTranslation)(link.label)
172
172
  ? link.label[locale]
173
173
  : link.label, placement: 'right', enterDelay: 600, enterNextDelay: 600, arrow: true }, icons(link, selected))),
174
174
  react_1.default.createElement(material_1.Menu, { id: `${link.id}-subpages-menu`, anchorEl: subPagesMenuAnchorEl[link.id], open: Boolean(subPagesMenuAnchorEl[link.id]), onClose: (_evt) => handleCloseSidebarMenu(link.id), anchorOrigin: {
175
- vertical: 'top',
176
- horizontal: 'right',
175
+ vertical: "top",
176
+ horizontal: "right",
177
177
  }, transformOrigin: {
178
- vertical: 'top',
179
- horizontal: 'left',
178
+ vertical: "top",
179
+ horizontal: "left",
180
180
  }, PaperProps: {
181
181
  sx: {
182
- borderRadius: '2px',
183
- padding: '2px',
184
- overflow: 'visible',
182
+ borderRadius: "2px",
183
+ padding: "2px",
184
+ overflow: "visible",
185
185
  },
186
186
  } }, link.subPages.map((subPage) => (react_1.default.createElement(link_1.default, { key: subPage.id, href: subPage.path },
187
187
  react_1.default.createElement(material_1.MenuItem, null,
188
188
  icons(subPage, selected),
189
189
  react_1.default.createElement(material_1.ListItemText, { style: {
190
190
  color: selected
191
- ? `${muiTheme.palette.primary.main} !important`
192
- : `${muiTheme.palette.linkNotActive.main} !important`,
191
+ ? `${muiTheme.palette.sidebar.contrastText} !important`
192
+ : `${muiTheme.palette.sidebar.light} !important`,
193
193
  } }, (0, languages_1.isStringTranslation)(subPage.label)
194
194
  ? subPage.label[locale]
195
195
  : subPage.label))))))));
@@ -197,11 +197,11 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
197
197
  else {
198
198
  return (react_1.default.createElement(link_1.default, { key: link.id, href: link.path },
199
199
  react_1.default.createElement(material_1.ListItemButton, { selected: selected, style: {
200
- paddingLeft: '22px',
200
+ paddingLeft: "22px",
201
201
  paddingTop: 8,
202
202
  paddingBottom: 8,
203
- borderTopRightRadius: '20px',
204
- borderBottomRightRadius: '20px',
203
+ borderTopRightRadius: "20px",
204
+ borderBottomRightRadius: "20px",
205
205
  } },
206
206
  react_1.default.createElement(material_1.Tooltip, { title: (0, languages_1.isStringTranslation)(link.label)
207
207
  ? link.label[locale]
@@ -210,27 +210,27 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
210
210
  }));
211
211
  }
212
212
  };
213
- return (react_1.default.createElement(material_1.Drawer, { anchor: 'left', onClose: onClose, open: open, variant: isMobile ? 'temporary' : 'permanent', sx: {
213
+ return (react_1.default.createElement(material_1.Drawer, { anchor: 'left', onClose: onClose, open: open, variant: isMobile ? "temporary" : "permanent", sx: {
214
214
  flexShrink: 0,
215
- whiteSpace: 'nowrap',
216
- height: '100%',
215
+ whiteSpace: "nowrap",
216
+ height: "100%",
217
217
  width: {
218
- xs: open ? '65%' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
219
- sm: open ? '50%' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
220
- md: open ? '300px' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
218
+ xs: open ? "65%" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
219
+ sm: open ? "50%" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
220
+ md: open ? "300px" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
221
221
  },
222
222
  }, PaperProps: {
223
223
  sx: {
224
224
  // pr: 1,
225
225
  width: {
226
- xs: open ? '65%' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
227
- sm: open ? '50%' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
228
- md: open ? '300px' : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
226
+ xs: open ? "65%" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
227
+ sm: open ? "50%" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
228
+ md: open ? "300px" : `${parseInt(muiTheme.spacing(10), 10) + 1}px`,
229
229
  },
230
230
  background: muiTheme.palette.sidebar.main,
231
231
  },
232
232
  } },
233
- react_1.default.createElement(material_1.List, { style: { marginTop: '19px' } }, handler(links, { level: 0 })),
233
+ react_1.default.createElement(material_1.List, { style: { marginTop: "19px" } }, handler(links, { level: 0 })),
234
234
  react_1.default.createElement("div", { style: { flexGrow: 1 } }),
235
235
  logo));
236
236
  };
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { Language, Locale } from '../../../../types/languages';
3
- import { AvatarProps } from '../../../buttons/Avatar/Avatar';
1
+ import React from "react";
2
+ import { Language, Locale } from "../../../../types/languages";
3
+ import { AvatarProps } from "../../../buttons/Avatar/Avatar";
4
4
  interface TopbarProps {
5
5
  /**
6
6
  * If true the layout has a sidebar.
@@ -30,6 +30,8 @@ interface TopbarProps {
30
30
  * The props to be passed to the Avatar button component.
31
31
  */
32
32
  avatar?: AvatarProps;
33
+ backgroundColor?: string;
34
+ iconsColor?: string;
33
35
  }
34
36
  declare const Topbar: React.FC<TopbarProps>;
35
37
  export default Topbar;
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIrE,UAAU,WAAW;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8DjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIrE,UAAU,WAAW;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgEjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -38,11 +38,11 @@ const ElevationScroll_1 = __importDefault(require("./ElevationScroll"));
38
38
  const S = __importStar(require("./Topbar.styles"));
39
39
  const translations_json_1 = __importDefault(require("./translations.json"));
40
40
  const Topbar = (props) => {
41
- const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, } = props;
41
+ const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, backgroundColor, iconsColor, } = props;
42
42
  const { resolvedTheme, setTheme } = (0, next_themes_1.useTheme)();
43
43
  const muiTheme = (0, material_1.useTheme)();
44
- const SidebarIcon = open ? (react_1.default.createElement(MenuOpenTwoTone_1.default, { color: 'primary' })) : (react_1.default.createElement(MenuTwoTone_1.default, { color: 'primary' }));
45
- const menuMessage = open ? translations_json_1.default['menuClose'][locale] : translations_json_1.default['menuOpen'][locale];
44
+ const SidebarIcon = open ? (react_1.default.createElement(MenuOpenTwoTone_1.default, { htmlColor: muiTheme.palette.topbar.contrastText })) : (react_1.default.createElement(MenuTwoTone_1.default, { htmlColor: muiTheme.palette.topbar.contrastText }));
45
+ const menuMessage = open ? translations_json_1.default["menuClose"][locale] : translations_json_1.default["menuOpen"][locale];
46
46
  return (react_1.default.createElement(ElevationScroll_1.default, { ...props },
47
47
  react_1.default.createElement(S.StyledAppBar, { position: 'static', theme: muiTheme },
48
48
  react_1.default.createElement(material_1.Toolbar, null,
@@ -52,10 +52,10 @@ const Topbar = (props) => {
52
52
  react_1.default.createElement(index_1.LanguageSelect, { locale: locale, languages: languages }),
53
53
  react_1.default.createElement(material_1.IconButton, { component: 'span', "aria-label": 'user options' },
54
54
  react_1.default.createElement(Avatar_1.Avatar, { ...avatar })),
55
- react_1.default.createElement(material_1.Tooltip, { title: resolvedTheme === 'light'
56
- ? translations_json_1.default['enableDark'][locale]
57
- : translations_json_1.default['disableDark'][locale] },
58
- react_1.default.createElement(material_1.IconButton, { component: 'span', "aria-label": 'toggle dark mode', onClick: () => setTheme(resolvedTheme === 'light' ? 'dark' : 'light') },
59
- react_1.default.createElement(ModeNight_1.default, null)))))));
55
+ react_1.default.createElement(material_1.Tooltip, { title: resolvedTheme === "light"
56
+ ? translations_json_1.default["enableDark"][locale]
57
+ : translations_json_1.default["disableDark"][locale] },
58
+ react_1.default.createElement(material_1.IconButton, { component: 'span', "aria-label": 'toggle dark mode', onClick: () => setTheme(resolvedTheme === "light" ? "dark" : "light") },
59
+ react_1.default.createElement(ModeNight_1.default, { htmlColor: muiTheme.palette.topbar.contrastText })))))));
60
60
  };
61
61
  exports.default = Topbar;
@@ -1,14 +1,14 @@
1
- declare module '@mui/material/styles/createPalette' {
1
+ declare module "@mui/material/styles/createPalette" {
2
2
  interface Palette {
3
3
  gradient: SimplePaletteColorOptions;
4
4
  linkNotActive: SimplePaletteColorOptions;
5
- sidebar: SimplePaletteColorOptions;
5
+ sidebar: Required<SimplePaletteColorOptions>;
6
6
  topbar: SimplePaletteColorOptions;
7
7
  }
8
8
  interface PaletteOptions {
9
9
  gradient: SimplePaletteColorOptions;
10
10
  linkNotActive: SimplePaletteColorOptions;
11
- sidebar: SimplePaletteColorOptions;
11
+ sidebar: Required<SimplePaletteColorOptions>;
12
12
  topbar: SimplePaletteColorOptions;
13
13
  }
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../src/types/palette.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,oCAAoC,CAAC;IAClD,UAAU,OAAO;QACf,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,yBAAyB,CAAC;QACnC,MAAM,EAAE,yBAAyB,CAAC;KACnC;IACD,UAAU,cAAc;QACtB,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,yBAAyB,CAAC;QACnC,MAAM,EAAE,yBAAyB,CAAC;KACnC;CACF;AAED,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../src/types/palette.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,oCAAoC,CAAC;IAClD,UAAU,OAAO;QACf,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC7C,MAAM,EAAE,yBAAyB,CAAC;KACnC;IACD,UAAU,cAAc;QACtB,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC7C,MAAM,EAAE,yBAAyB,CAAC;KACnC;CACF;AAED,OAAO,EAAE,CAAC"}
@@ -11,7 +11,6 @@ function usePersistedState(name, defaultValue) {
11
11
  const [value, setValue] = (0, react_1.useState)(defaultValue);
12
12
  const firstRender = (0, react_1.useRef)(true);
13
13
  (0, react_1.useEffect)(() => {
14
- firstRender.current = false;
15
14
  try {
16
15
  const localValueString = window.localStorage.getItem(name);
17
16
  if (localValueString) {
@@ -26,6 +25,7 @@ function usePersistedState(name, defaultValue) {
26
25
  }, [name, setValue]);
27
26
  (0, react_1.useEffect)(() => {
28
27
  if (firstRender.current) {
28
+ firstRender.current = false;
29
29
  return;
30
30
  }
31
31
  try {
@@ -1,5 +1,5 @@
1
- import { PaletteOptions } from '@mui/material/styles';
2
- export type AllowedTheme = NonNullable<PaletteOptions['mode']>;
1
+ import { PaletteOptions } from "@mui/material/styles";
2
+ export type AllowedTheme = NonNullable<PaletteOptions["mode"]>;
3
3
  export declare const DEFAULT_THEME: AllowedTheme;
4
4
  export declare const defaultLightPalette: PaletteOptions;
5
5
  export declare const defaultDarkPalette: PaletteOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/theme/palette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,YAAsB,CAAC;AAEnD,eAAO,MAAM,mBAAmB,EAAE,cAsCjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAoChC,CAAC;AAEF,eAAO,MAAM,eAAe,SACpB,YAAY,iBACH,cAAc,gBACf,cAAc,KAC3B,cAQF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/theme/palette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,YAAsB,CAAC;AAEnD,eAAO,MAAM,mBAAmB,EAAE,cA2CjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAyChC,CAAC;AAEF,eAAO,MAAM,eAAe,SACpB,YAAY,iBACH,cAAc,gBACf,cAAc,KAC3B,cAQF,CAAC"}
@@ -1,82 +1,92 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.adaptivePalette = exports.defaultDarkPalette = exports.defaultLightPalette = exports.DEFAULT_THEME = void 0;
4
- exports.DEFAULT_THEME = 'light';
4
+ exports.DEFAULT_THEME = "light";
5
5
  exports.defaultLightPalette = {
6
- mode: 'light',
6
+ mode: "light",
7
7
  gradient: {
8
8
  main: `linear-gradient(90deg, #008080, #00283D)`,
9
9
  },
10
10
  primary: {
11
- main: '#008080',
11
+ main: "#008080",
12
12
  },
13
13
  secondary: {
14
- main: '#E2634E',
14
+ main: "#E2634E",
15
15
  },
16
16
  success: {
17
- main: '#26B540',
17
+ main: "#26B540",
18
18
  },
19
19
  info: {
20
- main: '#2466F4',
20
+ main: "#2466F4",
21
21
  },
22
22
  warning: {
23
- main: '#EA8A04',
23
+ main: "#EA8A04",
24
24
  },
25
25
  error: {
26
- main: '#D3343F',
26
+ main: "#D3343F",
27
27
  },
28
28
  background: {
29
- default: '#fafafa',
30
- paper: '#ffffff',
29
+ default: "#fafafa",
30
+ paper: "#ffffff",
31
31
  },
32
32
  text: {
33
- secondary: 'rgba(0,0,0,0.54)',
34
- primary: 'rgba(0,0,0,0.87)',
35
- disabled: 'rgba(0,0,0,0.38)',
33
+ secondary: "rgba(0,0,0,0.54)",
34
+ primary: "rgba(0,0,0,0.87)",
35
+ disabled: "rgba(0,0,0,0.38)",
36
36
  },
37
- divider: 'rgba(0,0,0,0.12)',
37
+ divider: "rgba(0,0,0,0.12)",
38
38
  linkNotActive: {
39
- main: '#afafaf',
39
+ main: "#afafaf",
40
40
  },
41
- sidebar: { main: '#fafafa' },
42
- topbar: { main: '#fafafa' },
41
+ sidebar: {
42
+ main: "#fafafa",
43
+ contrastText: "#008080",
44
+ light: "#afafaf",
45
+ dark: "#00283D",
46
+ },
47
+ topbar: { main: "#fafafa", contrastText: "#008080" },
43
48
  };
44
49
  exports.defaultDarkPalette = {
45
- mode: 'dark',
50
+ mode: "dark",
46
51
  gradient: {
47
52
  main: `linear-gradient(90deg, #2CB2A7, #C6F8E7)`,
48
53
  },
49
54
  primary: {
50
- main: '#2CB2A7',
55
+ main: "#2CB2A7",
51
56
  },
52
57
  secondary: {
53
- main: '#E2634E',
58
+ main: "#E2634E",
54
59
  },
55
60
  success: {
56
- main: '#26B540',
61
+ main: "#26B540",
57
62
  },
58
63
  info: {
59
- main: '#2466F4',
64
+ main: "#2466F4",
60
65
  },
61
66
  warning: {
62
- main: '#EA8A04',
67
+ main: "#EA8A04",
63
68
  },
64
69
  error: {
65
- main: '#D3343F',
70
+ main: "#D3343F",
66
71
  },
67
72
  background: {
68
- default: '#303030',
69
- paper: '#424242',
73
+ default: "#303030",
74
+ paper: "#424242",
70
75
  },
71
76
  text: {
72
- primary: '#ffffff',
73
- secondary: 'rgba(255,255,255,0.7)',
74
- disabled: 'rgba(255,255,255,0.5)',
75
- },
76
- divider: 'rgba(255,255,255,0.12)',
77
- linkNotActive: { main: '#afafaf' },
78
- sidebar: { main: '#303030' },
79
- topbar: { main: '#303030' },
77
+ primary: "#ffffff",
78
+ secondary: "rgba(255,255,255,0.7)",
79
+ disabled: "rgba(255,255,255,0.5)",
80
+ },
81
+ divider: "rgba(255,255,255,0.12)",
82
+ linkNotActive: { main: "#afafaf" },
83
+ sidebar: {
84
+ main: "#303030",
85
+ contrastText: "#2CB2A7",
86
+ dark: "#000000",
87
+ light: "#afafaf",
88
+ },
89
+ topbar: { main: "#303030", contrastText: "#ffffff" },
80
90
  };
81
91
  const adaptivePalette = (mode, lightPalette, darkPalette) => {
82
92
  let light = exports.defaultLightPalette;
@@ -85,6 +95,6 @@ const adaptivePalette = (mode, lightPalette, darkPalette) => {
85
95
  light = lightPalette;
86
96
  dark = darkPalette;
87
97
  }
88
- return mode === 'light' ? light : dark;
98
+ return mode === "light" ? light : dark;
89
99
  };
90
100
  exports.adaptivePalette = adaptivePalette;