@deix/rossini-core 1.0.3 → 1.0.5
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 +1 -1
- package/lib/src/components/layout/components/AppLogo/AppLogo.d.ts.map +1 -1
- package/lib/src/components/layout/components/AppLogo/AppLogo.js +1 -0
- package/lib/src/components/layout/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/src/components/layout/components/Sidebar/Sidebar.js +5 -5
- package/lib/src/utils/hooks/usePersistedState.d.ts +1 -1
- package/lib/src/utils/hooks/usePersistedState.d.ts.map +1 -1
- package/lib/src/utils/hooks/usePersistedState.js +12 -8
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppLogo.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/AppLogo/AppLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM/C,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;CAChC;AACD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"AppLogo.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/AppLogo/AppLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM/C,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;CAChC;AACD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAsCnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -15,6 +15,7 @@ const AppLogo = ({ name = package_json_1.default.name.charAt(0).toUpperCase() +
|
|
|
15
15
|
flexWrap: 'wrap',
|
|
16
16
|
alignItems: 'center',
|
|
17
17
|
justifyContent: 'center',
|
|
18
|
+
marginBottom: 4,
|
|
18
19
|
} },
|
|
19
20
|
logoSource && (react_1.default.createElement(image_1.default, { src: logoSource, alt: 'logo', width: 36, height: 36 })),
|
|
20
21
|
open && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAuBtD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAEhE,OAAO,EAEL,MAAM,EACN,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AACD,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAuBtD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAEhE,OAAO,EAEL,MAAM,EACN,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AACD,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA6VnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -38,7 +38,7 @@ const languages_1 = require("../../../../types/languages");
|
|
|
38
38
|
const utils_1 = require("../../../../utils");
|
|
39
39
|
const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
40
40
|
const muiTheme = (0, material_2.useTheme)();
|
|
41
|
-
const { pathname } = (0, router_1.useRouter)();
|
|
41
|
+
const { pathname, query } = (0, router_1.useRouter)();
|
|
42
42
|
// Handle default item icon and change color according to selection
|
|
43
43
|
const icons = (link, selected) => {
|
|
44
44
|
const color = selected
|
|
@@ -85,7 +85,7 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
|
85
85
|
? pathname === '/'
|
|
86
86
|
: pathname.slice(1).startsWith(link.path.slice(1));
|
|
87
87
|
if (!link.subPages) {
|
|
88
|
-
return (react_1.default.createElement(link_1.default, { key: link.id, href: link.path },
|
|
88
|
+
return (react_1.default.createElement(link_1.default, { key: link.id, href: { pathname: link.path, query } },
|
|
89
89
|
react_1.default.createElement(material_1.ListItemButton, { selected: selected, style: {
|
|
90
90
|
paddingLeft: options.level === 1 && open ? '32px' : '22px',
|
|
91
91
|
paddingTop: options.level === 1 ? 0 : 8,
|
|
@@ -107,7 +107,7 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
|
107
107
|
: link.label) }))));
|
|
108
108
|
}
|
|
109
109
|
return (react_1.default.createElement("div", { key: link.id },
|
|
110
|
-
react_1.default.createElement(link_1.default, { href: link.path },
|
|
110
|
+
react_1.default.createElement(link_1.default, { href: { pathname: link.path, query } },
|
|
111
111
|
react_1.default.createElement(material_1.ListItemButton, { key: link.id, selected: selected, style: {
|
|
112
112
|
paddingLeft: '22px',
|
|
113
113
|
paddingTop: 8,
|
|
@@ -183,7 +183,7 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
|
183
183
|
padding: '2px',
|
|
184
184
|
overflow: 'visible',
|
|
185
185
|
},
|
|
186
|
-
} }, link.subPages.map((subPage) => (react_1.default.createElement(link_1.default, { key: subPage.id, href: subPage.path },
|
|
186
|
+
} }, link.subPages.map((subPage) => (react_1.default.createElement(link_1.default, { key: subPage.id, href: { pathname: subPage.path, query } },
|
|
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: {
|
|
@@ -195,7 +195,7 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
|
195
195
|
: subPage.label))))))));
|
|
196
196
|
}
|
|
197
197
|
else {
|
|
198
|
-
return (react_1.default.createElement(link_1.default, { key: link.id, href: link.path },
|
|
198
|
+
return (react_1.default.createElement(link_1.default, { key: link.id, href: { pathname: link.path, query } },
|
|
199
199
|
react_1.default.createElement(material_1.ListItemButton, { selected: selected, style: {
|
|
200
200
|
paddingLeft: '22px',
|
|
201
201
|
paddingTop: 8,
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* @param {T} defaultValue the default value
|
|
6
6
|
* @param {"local" | "session"} storage the type of storage where to persist the state
|
|
7
7
|
*/
|
|
8
|
-
declare function usePersistedState<T>(name: string, defaultValue: T, storage?:
|
|
8
|
+
declare function usePersistedState<T>(name: string, defaultValue: T, storage?: 'local' | 'session'): [T, (value: T) => void];
|
|
9
9
|
export default usePersistedState;
|
|
10
10
|
//# sourceMappingURL=usePersistedState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersistedState.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePersistedState.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,EACf,OAAO,GAAE,OAAO,GAAG,SAAmB,GACrC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"usePersistedState.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePersistedState.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,EACf,OAAO,GAAE,OAAO,GAAG,SAAmB,GACrC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAwDzB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const storageMap = {
|
|
5
|
-
local:
|
|
6
|
-
session:
|
|
5
|
+
local: 'localStorage',
|
|
6
|
+
session: 'sessionStorage',
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Use a variable stored persistently on local storage.
|
|
@@ -12,12 +12,12 @@ const storageMap = {
|
|
|
12
12
|
* @param {T} defaultValue the default value
|
|
13
13
|
* @param {"local" | "session"} storage the type of storage where to persist the state
|
|
14
14
|
*/
|
|
15
|
-
function usePersistedState(name, defaultValue, storage =
|
|
15
|
+
function usePersistedState(name, defaultValue, storage = 'local') {
|
|
16
16
|
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
17
17
|
const firstRender = (0, react_1.useRef)(true);
|
|
18
18
|
(0, react_1.useEffect)(() => {
|
|
19
19
|
try {
|
|
20
|
-
if (storage ===
|
|
20
|
+
if (storage === 'local') {
|
|
21
21
|
const localValueString = window.localStorage.getItem(name);
|
|
22
22
|
if (localValueString) {
|
|
23
23
|
const localValue = JSON.parse(localValueString);
|
|
@@ -34,7 +34,7 @@ function usePersistedState(name, defaultValue, storage = "local") {
|
|
|
34
34
|
}
|
|
35
35
|
catch (err) {
|
|
36
36
|
console.log(err);
|
|
37
|
-
if (storage ===
|
|
37
|
+
if (storage === 'local') {
|
|
38
38
|
window.localStorage.removeItem(name);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
@@ -48,11 +48,15 @@ function usePersistedState(name, defaultValue, storage = "local") {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
try {
|
|
51
|
-
if (storage ===
|
|
52
|
-
window.localStorage.setItem(name, JSON.stringify(value)
|
|
51
|
+
if (storage === 'local') {
|
|
52
|
+
window.localStorage.setItem(name, JSON.stringify(value, (_k, v) => {
|
|
53
|
+
return v === undefined ? null : v;
|
|
54
|
+
}));
|
|
53
55
|
}
|
|
54
56
|
else {
|
|
55
|
-
window.sessionStorage.setItem(name, JSON.stringify(value)
|
|
57
|
+
window.sessionStorage.setItem(name, JSON.stringify(value, (_k, v) => {
|
|
58
|
+
return v === undefined ? null : v;
|
|
59
|
+
}));
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
catch (err) {
|