@deix/rossini-core 0.5.0 → 0.5.1
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/display/StyledValue/StyledValue.d.ts +2 -2
- package/lib/src/components/display/StyledValue/StyledValue.d.ts.map +1 -1
- package/lib/src/components/display/StyledValue/StyledValue.js +25 -56
- package/lib/src/components/index.d.ts +1 -1
- package/lib/src/components/index.d.ts.map +1 -1
- package/lib/src/components/layout/StandardLayout/StandardLayout.d.ts +5 -0
- package/lib/src/components/layout/StandardLayout/StandardLayout.d.ts.map +1 -1
- package/lib/src/components/layout/StandardLayout/StandardLayout.js +2 -2
- package/lib/src/components/layout/components/Footer/Footer.d.ts +8 -0
- package/lib/src/components/layout/components/Footer/Footer.d.ts.map +1 -1
- package/lib/src/components/layout/components/Footer/Footer.js +5 -4
- package/lib/src/components/layout/components/Sidebar/Sidebar.js +7 -7
- package/lib/src/components/layout/components/Topbar/Topbar.d.ts +5 -1
- package/lib/src/components/layout/components/Topbar/Topbar.d.ts.map +1 -1
- package/lib/src/components/layout/components/Topbar/Topbar.js +2 -2
- package/lib/src/components/progress/CircularLoading/CircularLoading.d.ts +6 -2
- package/lib/src/components/progress/CircularLoading/CircularLoading.d.ts.map +1 -1
- package/lib/src/components/progress/CircularLoading/CircularLoading.js +4 -2
- package/lib/src/components/progress/index.d.ts +1 -1
- package/lib/src/components/progress/index.d.ts.map +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.d.ts.map +1 -1
- 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 +16 -12
- package/lib/src/utils/provider/ThemeProvider.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/src/components/progress/types.d.ts +0 -5
- package/lib/src/components/progress/types.d.ts.map +0 -1
- package/lib/src/components/progress/types.js +0 -2
package/lib/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { AxiosRequestConfig } from 'axios';
|
|
3
3
|
import { CardProps, TypographyProps } from '@mui/material';
|
|
4
|
-
import { ImprovementChipProps } from './ImprovementChip';
|
|
5
4
|
import { StringTranslation } from '../../../types';
|
|
5
|
+
import { ImprovementChipProps } from './ImprovementChip';
|
|
6
6
|
export interface FetchedValue {
|
|
7
7
|
baseURL?: string;
|
|
8
8
|
endpoint: string;
|
|
@@ -16,7 +16,7 @@ export interface StyledValueProps {
|
|
|
16
16
|
icon?: ReactNode;
|
|
17
17
|
framed?: boolean;
|
|
18
18
|
raised?: boolean;
|
|
19
|
-
|
|
19
|
+
backgroundColor: string;
|
|
20
20
|
valueTypographyProps?: TypographyProps;
|
|
21
21
|
captionTypographyProps?: TypographyProps;
|
|
22
22
|
detailsTypographyProps?: TypographyProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/StyledValue/StyledValue.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"StyledValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/StyledValue/StyledValue.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAIL,SAAS,EAIT,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAuB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAwB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAMD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,CAAC;IAC9C,aAAa,CAAC,EAAE,OAAO,CACrB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CACtD,CAAC;IACF,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACrC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACzD,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkH3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,45 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 =
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
30
7
|
const material_1 = require("@mui/material");
|
|
31
|
-
const hooks_1 = require("./hooks");
|
|
32
|
-
const ImprovementChip_1 = __importDefault(require("./ImprovementChip"));
|
|
33
8
|
const types_1 = require("../../../types");
|
|
34
9
|
const utils_1 = require("../../../utils");
|
|
10
|
+
const hooks_1 = require("./hooks");
|
|
11
|
+
const ImprovementChip_1 = __importDefault(require("./ImprovementChip"));
|
|
35
12
|
const isFetchedValue = (value) => {
|
|
36
13
|
return value.endpoint !== undefined;
|
|
37
14
|
};
|
|
38
15
|
const StyledValue = (props) => {
|
|
39
|
-
const { caption, details, formatOptions = {}, icon, raised = false, framed = false, loading = false,
|
|
16
|
+
const { caption, details, formatOptions = {}, icon, raised = false, framed = false, loading = false, backgroundColor, valueTypographyProps = {
|
|
40
17
|
variant: 'h3',
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
color: 'primary',
|
|
19
|
+
}, captionTypographyProps = { variant: 'subtitle2', color: 'textPrimary' }, detailsTypographyProps = { variant: 'caption', color: 'textSecondary' }, cardProps, onCardClick, improvement, } = props;
|
|
43
20
|
const locale = (0, utils_1.useLocale)();
|
|
44
21
|
// Value
|
|
45
22
|
const apiClient = (0, utils_1.useAPI)(props.value && isFetchedValue(props.value) ? props.value.baseURL : undefined);
|
|
@@ -61,38 +38,30 @@ const StyledValue = (props) => {
|
|
|
61
38
|
}
|
|
62
39
|
return (react_1.default.createElement(material_1.Card, { ...cardProps, raised: raised, sx: {
|
|
63
40
|
...cardStyle,
|
|
64
|
-
backgroundColor
|
|
65
|
-
? muiTheme.palette.primary.main
|
|
66
|
-
: muiTheme.palette.background.paper,
|
|
41
|
+
backgroundColor,
|
|
67
42
|
height: '100%',
|
|
43
|
+
p: 0,
|
|
44
|
+
'&:last-child': {
|
|
45
|
+
paddingBottom: 0,
|
|
46
|
+
},
|
|
68
47
|
} },
|
|
69
|
-
react_1.default.createElement(material_1.CardActionArea, { onClick: onCardClick
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
48
|
+
react_1.default.createElement(material_1.CardActionArea, { onClick: onCardClick, sx: {
|
|
49
|
+
p: 2,
|
|
50
|
+
'&:last-child': {
|
|
51
|
+
paddingBottom: 2,
|
|
52
|
+
},
|
|
53
|
+
} },
|
|
54
|
+
react_1.default.createElement(material_1.Grid, { container: true, spacing: 1, alignItems: 'center' },
|
|
55
|
+
icon && (react_1.default.createElement(material_1.Grid, { item: true, xs: 4 }, icon)),
|
|
56
|
+
react_1.default.createElement(material_1.Grid, { item: true, xs: icon ? 8 : 12 },
|
|
75
57
|
react_1.default.createElement(material_1.Grid, { container: true, spacing: 0 },
|
|
76
58
|
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
77
|
-
react_1.default.createElement(material_1.
|
|
78
|
-
react_1.default.createElement(material_1.
|
|
79
|
-
|
|
80
|
-
improvement && (react_1.default.createElement(material_1.Grid, { item: true, xs: 12, md: 6 },
|
|
81
|
-
react_1.default.createElement(ImprovementChip_1.default, { ...improvement }))))),
|
|
59
|
+
react_1.default.createElement(material_1.Box, { sx: { display: 'flex', justifyContent: 'space-between' } },
|
|
60
|
+
react_1.default.createElement(material_1.Typography, { ...valueTypographyProps }, loading || isLoading || value === undefined ? (react_1.default.createElement(material_1.Skeleton, null)) : (stringValue)),
|
|
61
|
+
improvement && react_1.default.createElement(ImprovementChip_1.default, { ...improvement }))),
|
|
82
62
|
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
83
|
-
react_1.default.createElement(material_1.Typography, {
|
|
63
|
+
react_1.default.createElement(material_1.Typography, { ...captionTypographyProps }, captionString)),
|
|
84
64
|
details && (react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
85
|
-
react_1.default.createElement(material_1.Typography, {
|
|
86
|
-
!icon && (react_1.default.createElement(material_1.Grid, { container: true, spacing: 0 },
|
|
87
|
-
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
88
|
-
react_1.default.createElement(material_1.Grid, { container: true, justifyContent: 'stretch' },
|
|
89
|
-
react_1.default.createElement(material_1.Grid, { item: true, xs: 12, md: 6 },
|
|
90
|
-
react_1.default.createElement(material_1.Typography, { color: highlighted ? 'secondary' : 'primary', ...valueTypographyProps }, loading || isLoading || value === undefined ? (react_1.default.createElement(material_1.Skeleton, null)) : (stringValue))),
|
|
91
|
-
improvement && (react_1.default.createElement(material_1.Grid, { item: true, xs: 12, md: 6 },
|
|
92
|
-
react_1.default.createElement(ImprovementChip_1.default, { ...improvement }))))),
|
|
93
|
-
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
94
|
-
react_1.default.createElement(material_1.Typography, { variant: 'subtitle2', color: highlighted ? 'white' : 'textPrimary', ...captionTypographyProps }, captionString)),
|
|
95
|
-
details && (react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
96
|
-
react_1.default.createElement(material_1.Typography, { variant: 'caption', color: highlighted ? 'white' : 'textSecondary', ...detailsTypographyProps }, detailsString))))))));
|
|
65
|
+
react_1.default.createElement(material_1.Typography, { ...detailsTypographyProps }, detailsString)))))))));
|
|
97
66
|
};
|
|
98
67
|
exports.default = StyledValue;
|
|
@@ -5,5 +5,5 @@ export type { AccordionProps, StyledValueProps, ImprovementChipProps, FetchedVal
|
|
|
5
5
|
export { MinimalLayout, StandardLayout } from './layout';
|
|
6
6
|
export type { AppLogoInfo, FooterProps, SidebarLink, SidebarProps, } from './layout';
|
|
7
7
|
export { CircularLoading } from './progress';
|
|
8
|
-
export type {
|
|
8
|
+
export type { CircularLoadingProps } from './progress';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACtE,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACpE,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACtE,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACpE,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { AppLogoInfo } from '../components/AppLogo/AppLogo';
|
|
3
3
|
import { FooterProps } from '../components/Footer/Footer';
|
|
4
4
|
import { SidebarLink } from '../components/Sidebar/Sidebar';
|
|
5
|
+
import { Language } from '../../../types/languages';
|
|
5
6
|
import { AvatarProps } from '../../buttons/Avatar/Avatar';
|
|
6
7
|
interface StandardLayoutProps {
|
|
7
8
|
/**
|
|
@@ -36,6 +37,10 @@ interface StandardLayoutProps {
|
|
|
36
37
|
* The properties to be passed to the footer component.
|
|
37
38
|
*/
|
|
38
39
|
footer?: FooterProps;
|
|
40
|
+
/**
|
|
41
|
+
* List of language options
|
|
42
|
+
*/
|
|
43
|
+
languages?: Language[];
|
|
39
44
|
}
|
|
40
45
|
declare const StandardLayout: React.FC<StandardLayoutProps>;
|
|
41
46
|
export default StandardLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,QAAQ,EAAU,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,UAAU,mBAAmB;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA8GjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -15,7 +15,7 @@ const TopLine_1 = __importDefault(require("../components/Topline/TopLine"));
|
|
|
15
15
|
const utils_1 = require("../../../utils");
|
|
16
16
|
const ServerDown_1 = __importDefault(require("../assets/ServerDown"));
|
|
17
17
|
const translations_json_1 = __importDefault(require("./translations.json"));
|
|
18
|
-
const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, children, }) => {
|
|
18
|
+
const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, languages, children, }) => {
|
|
19
19
|
const theme = (0, material_1.useTheme)();
|
|
20
20
|
const router = (0, router_1.useRouter)();
|
|
21
21
|
const locale = router.locale || 'en';
|
|
@@ -34,7 +34,7 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
|
|
|
34
34
|
width: '100%',
|
|
35
35
|
background: theme.palette.background.default,
|
|
36
36
|
} },
|
|
37
|
-
react_1.default.createElement(Topbar_1.default, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, avatar: avatar }),
|
|
37
|
+
react_1.default.createElement(Topbar_1.default, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, languages: languages, avatar: avatar }),
|
|
38
38
|
isLoading && react_1.default.createElement(progress_1.CircularLoading, { locale: locale }),
|
|
39
39
|
!isLoading && isError && (react_1.default.createElement(material_1.Box, { sx: {
|
|
40
40
|
flexGrow: 1,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
interface ApplicationInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}
|
|
2
6
|
export interface FooterProps {
|
|
3
7
|
/**
|
|
4
8
|
* Logo.
|
|
@@ -12,6 +16,10 @@ export interface FooterProps {
|
|
|
12
16
|
* Link to be rerouted to when the text is clicked.
|
|
13
17
|
*/
|
|
14
18
|
textURL?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The UI info (name and version)
|
|
21
|
+
*/
|
|
22
|
+
uiInfo?: ApplicationInfo;
|
|
15
23
|
/**
|
|
16
24
|
* The URL for the backend API. This will send a request to /info for the name and version of the API and show this information. If this is not provided or if the fetch fails nothing is shown in the footer.
|
|
17
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layout/components/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASzC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkFjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -9,8 +9,9 @@ const react_query_1 = require("react-query");
|
|
|
9
9
|
const package_json_1 = __importDefault(require("../../../../../package.json"));
|
|
10
10
|
const index_1 = require("../../../../utils/index");
|
|
11
11
|
const DeixLogo_1 = __importDefault(require("../../assets/DeixLogo"));
|
|
12
|
-
const Footer = ({ logo = react_1.default.createElement(DeixLogo_1.default, null), text = 'Deix Srl', textURL = 'https://deixsrl.com', apiURL, children, }) => {
|
|
12
|
+
const Footer = ({ logo = react_1.default.createElement(DeixLogo_1.default, null), text = 'Deix Srl', textURL = 'https://deixsrl.com', uiInfo = { name: package_json_1.default.name, version: `v${package_json_1.default.version}` }, apiURL, children, }) => {
|
|
13
13
|
const muiTheme = (0, material_1.useTheme)();
|
|
14
|
+
// Get App Info (name and version)
|
|
14
15
|
// Get API info (name and version) from backend
|
|
15
16
|
const apiClient = (0, index_1.useAPI)(apiURL);
|
|
16
17
|
const getAPIInfo = async () => {
|
|
@@ -53,9 +54,9 @@ const Footer = ({ logo = react_1.default.createElement(DeixLogo_1.default, null)
|
|
|
53
54
|
color: muiTheme.palette.text.secondary,
|
|
54
55
|
marginLeft: '5px',
|
|
55
56
|
} },
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
57
|
+
uiInfo.name,
|
|
58
|
+
" ",
|
|
59
|
+
uiInfo.version,
|
|
59
60
|
' ',
|
|
60
61
|
apiInfo ? `(${apiInfo.name} ${apiInfo.version})` : ''),
|
|
61
62
|
children)));
|
|
@@ -215,17 +215,17 @@ const Sidebar = ({ links, open, isMobile, logo, locale, onClose, }) => {
|
|
|
215
215
|
whiteSpace: 'nowrap',
|
|
216
216
|
height: '100%',
|
|
217
217
|
width: {
|
|
218
|
-
xs: open ? '65%' : `${parseInt(muiTheme.spacing(
|
|
219
|
-
sm: open ? '50%' : `${parseInt(muiTheme.spacing(
|
|
220
|
-
md: open ? '300px' : `${parseInt(muiTheme.spacing(
|
|
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
|
-
pr: 1,
|
|
224
|
+
// pr: 1,
|
|
225
225
|
width: {
|
|
226
|
-
xs: open ? '65%' : `${parseInt(muiTheme.spacing(
|
|
227
|
-
sm: open ? '50%' : `${parseInt(muiTheme.spacing(
|
|
228
|
-
md: open ? '300px' : `${parseInt(muiTheme.spacing(
|
|
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
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Locale } from '../../../../types/languages';
|
|
2
|
+
import { Language, Locale } from '../../../../types/languages';
|
|
3
3
|
import { AvatarProps } from '../../../buttons/Avatar/Avatar';
|
|
4
4
|
interface TopbarProps {
|
|
5
5
|
/**
|
|
@@ -14,6 +14,10 @@ interface TopbarProps {
|
|
|
14
14
|
* Internationalization locale.
|
|
15
15
|
*/
|
|
16
16
|
locale: Locale;
|
|
17
|
+
/**
|
|
18
|
+
* List of language options
|
|
19
|
+
*/
|
|
20
|
+
languages?: Language[];
|
|
17
21
|
/**
|
|
18
22
|
* Function to call when closing the sidebar
|
|
19
23
|
*/
|
|
@@ -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,MAAM,EAAE,MAAM,6BAA6B,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;CACtB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8DjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -38,7 +38,7 @@ 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, avatar, } = props;
|
|
41
|
+
const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, } = props;
|
|
42
42
|
const { resolvedTheme, setTheme } = (0, next_themes_1.useTheme)();
|
|
43
43
|
const muiTheme = (0, material_1.useTheme)();
|
|
44
44
|
const SidebarIcon = open ? (react_1.default.createElement(MenuOpenTwoTone_1.default, { color: 'primary' })) : (react_1.default.createElement(MenuTwoTone_1.default, { color: 'primary' }));
|
|
@@ -49,7 +49,7 @@ const Topbar = (props) => {
|
|
|
49
49
|
react_1.default.createElement(material_1.Tooltip, { title: menuMessage, arrow: true },
|
|
50
50
|
react_1.default.createElement(material_1.IconButton, { color: 'inherit', "aria-label": 'open drawer', onClick: () => (open ? onSidebarClose() : onSidebarOpen()), edge: 'start' }, SidebarIcon)),
|
|
51
51
|
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
52
|
-
react_1.default.createElement(index_1.LanguageSelect, { locale: locale }),
|
|
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
55
|
react_1.default.createElement(material_1.Tooltip, { title: resolvedTheme === 'light'
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Locale, StringTranslation } from '../../../types';
|
|
3
|
+
export interface CircularLoadingProps {
|
|
4
|
+
locale?: Locale;
|
|
5
|
+
label?: string | StringTranslation;
|
|
6
|
+
}
|
|
7
|
+
declare const CircularLoading: React.FC<CircularLoadingProps>;
|
|
4
8
|
export default CircularLoading;
|
|
5
9
|
//# sourceMappingURL=CircularLoading.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularLoading.d.ts","sourceRoot":"","sources":["../../../../../src/components/progress/CircularLoading/CircularLoading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CircularLoading.d.ts","sourceRoot":"","sources":["../../../../../src/components/progress/CircularLoading/CircularLoading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAuB,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEhF,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACpC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmBnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const translations_json_1 = __importDefault(require("./translations.json"));
|
|
9
|
-
const
|
|
9
|
+
const types_1 = require("../../../types");
|
|
10
|
+
const CircularLoading = ({ locale = 'en', label = translations_json_1.default['loading'], }) => {
|
|
11
|
+
const labelString = (0, types_1.isStringTranslation)(label) ? label[locale] : label;
|
|
10
12
|
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
11
13
|
display: 'flex',
|
|
12
14
|
flexDirection: 'column',
|
|
@@ -15,6 +17,6 @@ const CircularLoading = ({ locale = 'en' }) => {
|
|
|
15
17
|
height: '100%',
|
|
16
18
|
} },
|
|
17
19
|
react_1.default.createElement(material_1.CircularProgress, null),
|
|
18
|
-
react_1.default.createElement(material_1.Typography, { variant: 'body1' },
|
|
20
|
+
react_1.default.createElement(material_1.Typography, { variant: 'body1' }, labelString)));
|
|
19
21
|
};
|
|
20
22
|
exports.default = CircularLoading;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC/E,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC/E,YAAY,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Accordion, Avatar, CircularLoading, ImprovementChip, LanguageSelect, MinimalLayout, StandardLayout, StyledValue, ToggleButtonGroup, } from './components';
|
|
2
|
-
export type { AccordionProps, AppLogoInfo, AvatarProps, ButtonGroupOption, FetchedValue, FooterProps, ImprovementChipProps, LanguageSelectProps,
|
|
2
|
+
export type { AccordionProps, AppLogoInfo, AvatarProps, ButtonGroupOption, FetchedValue, FooterProps, ImprovementChipProps, LanguageSelectProps, CircularLoadingProps, SidebarLink, SidebarProps, StyledValueProps, ToggleButtonGroupProps, } from './components';
|
|
3
3
|
export { isStringTranslation } from './types';
|
|
4
4
|
export type { DBRow, DBRows, Language, Locale, PaginatedResponse, Query, StringTranslation, } from './types';
|
|
5
5
|
export { camelToSnake, colorToRgb, commonStart, dateDiff, getTextColor, getTimeStr, hexToRgb, isValidDate, PageProvider, stringToColor, toLocalStandardDateString, toTitleCase, useAPI, useLocale, usePersistedState, useUserInfo, } from './utils';
|
package/lib/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EACV,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,KAAK,EACL,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,WAAW,EACX,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Use a variable stored persistently on local storage.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} name the name of the variable in local storage.
|
|
5
|
-
* @param {T} defaultValue the default value
|
|
5
|
+
* @param {T} defaultValue the default value
|
|
6
6
|
*/
|
|
7
7
|
declare function usePersistedState<T>(name: string, defaultValue: T): [T, (value: T) => void];
|
|
8
8
|
export default usePersistedState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersistedState.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePersistedState.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,GACd,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":"AAEA;;;;;GAKG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CA8BzB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -5,32 +5,36 @@ const react_1 = require("react");
|
|
|
5
5
|
* Use a variable stored persistently on local storage.
|
|
6
6
|
*
|
|
7
7
|
* @param {string} name the name of the variable in local storage.
|
|
8
|
-
* @param {T} defaultValue the default value
|
|
8
|
+
* @param {T} defaultValue the default value
|
|
9
9
|
*/
|
|
10
10
|
function usePersistedState(name, defaultValue) {
|
|
11
|
-
const [value, setValue] = (0, react_1.useState)(
|
|
11
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
12
|
+
const firstRender = (0, react_1.useRef)(true);
|
|
13
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
14
|
+
firstRender.current = false;
|
|
12
15
|
try {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
else {
|
|
18
|
-
window.localStorage.setItem(name, JSON.stringify(defaultValue));
|
|
19
|
-
return defaultValue;
|
|
16
|
+
const localValueString = window.localStorage.getItem(name);
|
|
17
|
+
if (localValueString) {
|
|
18
|
+
const localValue = JSON.parse(localValueString);
|
|
19
|
+
setValue(localValue);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
catch (err) {
|
|
23
|
-
|
|
23
|
+
console.log(err);
|
|
24
|
+
window.localStorage.removeItem(name);
|
|
24
25
|
}
|
|
25
|
-
});
|
|
26
|
+
}, [name, setValue]);
|
|
26
27
|
(0, react_1.useEffect)(() => {
|
|
28
|
+
if (firstRender) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
27
31
|
try {
|
|
28
32
|
window.localStorage.setItem(name, JSON.stringify(value));
|
|
29
33
|
}
|
|
30
34
|
catch (err) {
|
|
31
35
|
console.error(err);
|
|
32
36
|
}
|
|
33
|
-
}, [value]);
|
|
37
|
+
}, [name, value]);
|
|
34
38
|
return [value, setValue];
|
|
35
39
|
}
|
|
36
40
|
exports.default = usePersistedState;
|
|
@@ -38,7 +38,7 @@ const ThemeProvider = ({ children, lightPalette, darkPalette }) => {
|
|
|
38
38
|
if (resolvedTheme) {
|
|
39
39
|
setCurrentTheme((0, theme_1.adaptiveTheme)(resolvedTheme, locale, lightPalette, darkPalette));
|
|
40
40
|
}
|
|
41
|
-
}, [resolvedTheme, locale]);
|
|
41
|
+
}, [lightPalette, darkPalette, resolvedTheme, locale]);
|
|
42
42
|
return (react_1.default.createElement(material_1.ThemeProvider, { theme: currentTheme },
|
|
43
43
|
react_1.default.createElement(material_1.CssBaseline, null),
|
|
44
44
|
react_1.default.createElement(material_1.GlobalStyles, { styles: theme_1.globalStyles }),
|