@deix/rossini-core 0.4.2 → 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/README.md +1 -11
- package/lib/package.json +47 -36
- package/lib/src/components/buttons/Avatar/Avatar.d.ts.map +1 -1
- package/lib/src/components/buttons/Avatar/Avatar.js +59 -31
- package/lib/src/components/buttons/LanguageSelect/LanguageSelect.js +39 -34
- package/lib/src/components/buttons/ToggleButtonGroup/ToggleButtonGroup.js +37 -13
- package/lib/src/components/buttons/index.js +9 -3
- package/lib/src/components/display/Accordion/Accordion.d.ts.map +1 -1
- package/lib/src/components/display/Accordion/Accordion.js +23 -41
- package/lib/src/components/display/StyledValue/ImprovementChip.d.ts +13 -0
- package/lib/src/components/display/StyledValue/ImprovementChip.d.ts.map +1 -0
- package/lib/src/components/display/StyledValue/ImprovementChip.js +33 -0
- package/lib/src/components/display/StyledValue/StyledValue.d.ts +30 -0
- package/lib/src/components/display/StyledValue/StyledValue.d.ts.map +1 -0
- package/lib/src/components/display/StyledValue/StyledValue.js +67 -0
- package/lib/src/components/display/StyledValue/hooks.d.ts +4 -0
- package/lib/src/components/display/StyledValue/hooks.d.ts.map +1 -0
- package/lib/src/components/display/StyledValue/hooks.js +32 -0
- package/lib/src/components/display/index.d.ts +4 -0
- package/lib/src/components/display/index.d.ts.map +1 -1
- package/lib/src/components/display/index.js +12 -1
- package/lib/src/components/index.d.ts +4 -4
- package/lib/src/components/index.d.ts.map +1 -1
- package/lib/src/components/index.js +16 -4
- package/lib/src/components/layout/MinimalLayout/MinimalLayout.d.ts.map +1 -1
- package/lib/src/components/layout/MinimalLayout/MinimalLayout.js +28 -36
- 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 +36 -44
- package/lib/src/components/layout/assets/DeixLogo.d.ts +8 -0
- package/lib/src/components/layout/assets/DeixLogo.d.ts.map +1 -0
- package/lib/src/components/layout/assets/DeixLogo.js +20 -0
- package/lib/src/components/layout/assets/DeixLogo.tsx +36 -0
- package/lib/src/components/layout/assets/ServerDown.d.ts +8 -0
- package/lib/src/components/layout/assets/ServerDown.d.ts.map +1 -0
- package/lib/src/components/layout/assets/ServerDown.js +60 -0
- package/lib/src/components/layout/assets/ServerDown.tsx +231 -0
- package/lib/src/components/layout/components/AppLogo/AppLogo.js +17 -13
- package/lib/src/components/layout/components/Footer/Footer.d.ts +11 -4
- package/lib/src/components/layout/components/Footer/Footer.d.ts.map +1 -1
- package/lib/src/components/layout/components/Footer/Footer.js +34 -71
- package/lib/src/components/layout/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/src/components/layout/components/Sidebar/Sidebar.js +111 -90
- package/lib/src/components/layout/components/Topbar/ElevationScroll.d.ts.map +1 -1
- package/lib/src/components/layout/components/Topbar/ElevationScroll.js +11 -7
- package/lib/src/components/layout/components/Topbar/Topbar.d.ts +9 -1
- package/lib/src/components/layout/components/Topbar/Topbar.d.ts.map +1 -1
- package/lib/src/components/layout/components/Topbar/Topbar.js +59 -44
- package/lib/src/components/layout/components/Topbar/Topbar.styles.d.ts +2 -2
- package/lib/src/components/layout/components/Topbar/Topbar.styles.js +15 -7
- package/lib/src/components/layout/components/Topline/TopLine.js +11 -6
- package/lib/src/components/layout/index.js +10 -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 +15 -9
- package/lib/src/components/progress/index.d.ts +1 -2
- package/lib/src/components/progress/index.d.ts.map +1 -1
- package/lib/src/components/progress/index.js +8 -2
- package/lib/src/index.d.ts +3 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +32 -3
- package/lib/src/types/api.js +2 -1
- package/lib/src/types/index.d.ts +1 -1
- package/lib/src/types/index.d.ts.map +1 -1
- package/lib/src/types/index.js +5 -1
- package/lib/src/types/languages.js +6 -2
- package/lib/src/types/palette.d.ts.map +1 -1
- package/lib/src/types/palette.js +2 -1
- package/lib/src/utils/helpers/colorHelpers.js +16 -11
- package/lib/src/utils/helpers/dateHelpers.js +24 -17
- package/lib/src/utils/helpers/index.js +17 -3
- package/lib/src/utils/helpers/stringHelpers.js +25 -26
- package/lib/src/utils/hooks/index.js +14 -4
- package/lib/src/utils/hooks/useAPI.d.ts +1 -1
- package/lib/src/utils/hooks/useAPI.d.ts.map +1 -1
- package/lib/src/utils/hooks/useAPI.js +16 -9
- package/lib/src/utils/hooks/useKeycloak.d.ts +1 -1
- package/lib/src/utils/hooks/useKeycloak.d.ts.map +1 -1
- package/lib/src/utils/hooks/useKeycloak.js +28 -67
- package/lib/src/utils/hooks/useLocale.d.ts.map +1 -1
- package/lib/src/utils/hooks/useLocale.js +8 -4
- 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 +21 -15
- package/lib/src/utils/index.js +25 -3
- package/lib/src/utils/provider/PageProvider.d.ts.map +1 -1
- package/lib/src/utils/provider/PageProvider.js +18 -16
- package/lib/src/utils/provider/ThemeProvider.js +41 -17
- package/lib/src/utils/theme/components/MuiAccordion.js +3 -1
- package/lib/src/utils/theme/components/MuiCard.js +3 -1
- package/lib/src/utils/theme/components/MuiCardHeader.js +3 -1
- package/lib/src/utils/theme/components/MuiFormControl.js +3 -1
- package/lib/src/utils/theme/components/MuiGrid.js +3 -1
- package/lib/src/utils/theme/components/MuiPaper.js +3 -1
- package/lib/src/utils/theme/components/MuiTypography.js +3 -1
- package/lib/src/utils/theme/components/index.d.ts +2 -2
- package/lib/src/utils/theme/components/index.d.ts.map +1 -1
- package/lib/src/utils/theme/components/index.js +21 -15
- package/lib/src/utils/theme/createEmotionCache.js +9 -3
- package/lib/src/utils/theme/index.d.ts +2 -1
- package/lib/src/utils/theme/index.d.ts.map +1 -1
- package/lib/src/utils/theme/index.js +73 -17
- package/lib/src/utils/theme/palette/index.d.ts.map +1 -1
- package/lib/src/utils/theme/palette/index.js +24 -22
- package/lib/src/utils/theme/typography.js +4 -2
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +47 -36
- package/lib/src/components/progress/DotWaveLoading/DotWaveLoading.d.ts +0 -5
- package/lib/src/components/progress/DotWaveLoading/DotWaveLoading.d.ts.map +0 -1
- package/lib/src/components/progress/DotWaveLoading/DotWaveLoading.js +0 -18
- package/lib/src/components/progress/DotWaveLoading/translations.json +0 -8
- 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 -1
- package/lib/src/utils/theme/palette/defaultColors.json +0 -68
- package/lib/tsconfig-lib.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -2,15 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
Rossini helps you build UI fast by providing a series of components and utilities featuring the Deix style.
|
|
4
4
|
|
|
5
|
-
This library exploits [Storybook](https://storybook.js.org/docs/react/get-started/introduction) to generate the documentation of the available components.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
To launch the Storybook in your local environment execute
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install
|
|
13
|
-
npm run storybook
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
This will make available the Storybook interface on `localhost:6006`. Browse stories by navigating to them in the sidebar.
|
|
6
|
+
Take a look at the [docs](https://docs.deix.ai/rossini-core) to see components exported by rossini-core.
|
package/lib/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deix/rossini-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"main": "lib/src/index.js",
|
|
5
|
+
"type": "commonjs",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/deix-ai/rossini-core.git"
|
|
@@ -13,52 +14,59 @@
|
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
16
|
"lint": "next lint",
|
|
16
|
-
"build
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"build": "tsc -p tsconfig.json && cp -r src/components/layout/assets/ lib/src/components/layout/",
|
|
18
|
+
"prepare": "tsc -p tsconfig.json && cp -r src/components/layout/assets/ lib/src/components/layout/",
|
|
19
|
+
"storybook": "storybook dev -p 6006",
|
|
20
|
+
"build-storybook": "storybook build"
|
|
19
21
|
},
|
|
20
22
|
"peerDependencies": {
|
|
21
|
-
"@
|
|
23
|
+
"@emotion/react": "^11.10.5",
|
|
24
|
+
"@emotion/styled": "^11.10.5",
|
|
25
|
+
"@fontsource/raleway": "^4.5.12",
|
|
26
|
+
"@mui/icons-material": "^5.11.0",
|
|
27
|
+
"@mui/material": "^5.11.8",
|
|
28
|
+
"@types/react": "^18.0.28",
|
|
22
29
|
"@types/react-dom": "^18.0.8",
|
|
30
|
+
"axios": "^1.3.2",
|
|
31
|
+
"next": "^13.1.3",
|
|
32
|
+
"next-themes": "^0.2.1",
|
|
23
33
|
"react": "^18.2.0",
|
|
24
|
-
"react-dom": "^18.2.0"
|
|
34
|
+
"react-dom": "^18.2.0",
|
|
35
|
+
"react-query": "^3.39.3"
|
|
25
36
|
},
|
|
26
37
|
"devDependencies": {
|
|
27
|
-
"@babel/core": "^7.
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
38
|
+
"@babel/core": "^7.21.3",
|
|
39
|
+
"@emotion/react": "^11.10.6",
|
|
40
|
+
"@emotion/styled": "^11.10.6",
|
|
41
|
+
"@fontsource/raleway": "^4.5.12",
|
|
42
|
+
"@mui/icons-material": "^5.11.11",
|
|
43
|
+
"@mui/material": "^5.11.13",
|
|
44
|
+
"@storybook/addon-essentials": "^7.0.0-rc.2",
|
|
45
|
+
"@storybook/nextjs": "^7.0.0-rc.2",
|
|
46
|
+
"@storybook/react": "^7.0.0-rc.2",
|
|
47
|
+
"@storybook/testing-library": "^0.0.14-next.1",
|
|
48
|
+
"@types/node": "^18.15.3",
|
|
49
|
+
"@types/react": "^18.0.28",
|
|
50
|
+
"@types/react-dom": "^18.0.11",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
52
|
+
"axios": "^1.3.4",
|
|
37
53
|
"babel-loader": "^9.1.2",
|
|
38
54
|
"commitizen": "^4.3.0",
|
|
39
55
|
"cz-conventional-changelog": "^3.3.0",
|
|
40
|
-
"eslint": "8.
|
|
41
|
-
"eslint-config-next": "^13.
|
|
42
|
-
"eslint-config-prettier": "^8.
|
|
56
|
+
"eslint": "^8.36.0",
|
|
57
|
+
"eslint-config-next": "^13.2.4",
|
|
58
|
+
"eslint-config-prettier": "^8.7.0",
|
|
43
59
|
"eslint-plugin-prettier": "^4.2.1",
|
|
44
|
-
"eslint-plugin-storybook": "^0.6.
|
|
45
|
-
"
|
|
46
|
-
"react-docgen-typescript-plugin": "^1.0.2",
|
|
47
|
-
"react-dom": "18.2.0",
|
|
48
|
-
"storybook-addon-next-router": "^4.0.2",
|
|
49
|
-
"typescript": "4.9.4"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@emotion/react": "^11.10.5",
|
|
53
|
-
"@emotion/styled": "^11.10.5",
|
|
54
|
-
"@fontsource/raleway": "^4.5.12",
|
|
55
|
-
"@mui/icons-material": "^5.11.0",
|
|
56
|
-
"@mui/material": "^5.11.5",
|
|
57
|
-
"@uiball/loaders": "^1.2.6",
|
|
58
|
-
"axios": "1.2.2",
|
|
59
|
-
"next": "13.1.3",
|
|
60
|
+
"eslint-plugin-storybook": "^0.6.11",
|
|
61
|
+
"next": "^13.2.4",
|
|
60
62
|
"next-themes": "^0.2.1",
|
|
61
|
-
"react
|
|
63
|
+
"react": "^18.2.0",
|
|
64
|
+
"react-docgen-typescript-plugin": "^1.0.5",
|
|
65
|
+
"react-dom": "^18.2.0",
|
|
66
|
+
"react-query": "^3.39.3",
|
|
67
|
+
"storybook": "^7.0.0-rc.2",
|
|
68
|
+
"ts-loader": "^9.4.2",
|
|
69
|
+
"typescript": "4.9.5"
|
|
62
70
|
},
|
|
63
71
|
"resolutions": {
|
|
64
72
|
"@storybook/react-docgen-typescript-plugin": "npm:react-docgen-typescript-plugin@1.0.2"
|
|
@@ -70,5 +78,8 @@
|
|
|
70
78
|
"commitizen": {
|
|
71
79
|
"path": "./node_modules/cz-conventional-changelog"
|
|
72
80
|
}
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@emotion/babel-plugin": "^11.10.6"
|
|
73
84
|
}
|
|
74
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/components/buttons/Avatar/Avatar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/components/buttons/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAmBxC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4ExC,CAAC"}
|
|
@@ -1,33 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Avatar = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const link_1 = __importDefault(require("next/link"));
|
|
32
|
+
const Face_1 = __importDefault(require("@mui/icons-material/Face"));
|
|
33
|
+
const Logout_1 = __importDefault(require("@mui/icons-material/Logout"));
|
|
34
|
+
const material_1 = require("@mui/material");
|
|
35
|
+
const utils_1 = require("../../../utils");
|
|
36
|
+
const useKeycloak_1 = require("../../../utils/hooks/useKeycloak");
|
|
37
|
+
const Avatar = ({ logoutUrl, accountSettingsUrl, }) => {
|
|
38
|
+
const muiTheme = (0, material_1.useTheme)();
|
|
11
39
|
// Menu
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
40
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
41
|
+
const open = Boolean(anchorEl);
|
|
42
|
+
const handleClick = (event) => {
|
|
15
43
|
setAnchorEl(event.currentTarget);
|
|
16
44
|
};
|
|
17
|
-
|
|
45
|
+
const handleClose = () => {
|
|
18
46
|
setAnchorEl(null);
|
|
19
47
|
};
|
|
20
48
|
// User data
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
|
|
25
|
-
|
|
49
|
+
const apiClient = (0, utils_1.useAPI)(accountSettingsUrl);
|
|
50
|
+
const { data: userInfo } = (0, useKeycloak_1.useUserInfo)(apiClient);
|
|
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: {
|
|
26
54
|
bgcolor: muiTheme.palette.primary.main,
|
|
27
55
|
width: 24,
|
|
28
56
|
height: 24,
|
|
29
57
|
}, onClick: handleClick })),
|
|
30
|
-
|
|
58
|
+
react_1.default.createElement(material_1.Menu, { anchorEl: anchorEl, open: open, onClose: handleClose, anchorOrigin: {
|
|
31
59
|
vertical: 'bottom',
|
|
32
60
|
horizontal: 'right',
|
|
33
61
|
}, transformOrigin: {
|
|
@@ -38,15 +66,15 @@ export var Avatar = function (_a) {
|
|
|
38
66
|
padding: '4px',
|
|
39
67
|
},
|
|
40
68
|
} },
|
|
41
|
-
accountSettingsUrl && (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
logoutUrl && (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
accountSettingsUrl && (react_1.default.createElement(link_1.default, { href: accountSettingsUrl },
|
|
70
|
+
react_1.default.createElement(material_1.MenuItem, { onClick: handleClose },
|
|
71
|
+
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
72
|
+
react_1.default.createElement(Face_1.default, { fontSize: 'small' })),
|
|
73
|
+
react_1.default.createElement(material_1.ListItemText, null, "Account")))),
|
|
74
|
+
logoutUrl && (react_1.default.createElement(link_1.default, { href: logoutUrl },
|
|
75
|
+
react_1.default.createElement(material_1.MenuItem, { onClick: handleClose },
|
|
76
|
+
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
77
|
+
react_1.default.createElement(Logout_1.default, { fontSize: 'small' })),
|
|
78
|
+
react_1.default.createElement(material_1.ListItemText, null, "Logout")))))));
|
|
51
79
|
};
|
|
52
|
-
|
|
80
|
+
exports.Avatar = Avatar;
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LanguageSelect = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const link_1 = __importDefault(require("next/link"));
|
|
9
|
+
const router_1 = require("next/router");
|
|
10
|
+
const Language_1 = __importDefault(require("@mui/icons-material/Language"));
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const languages_1 = require("../../../types/languages");
|
|
13
|
+
const translations_json_1 = __importDefault(require("./translations.json"));
|
|
14
|
+
const LanguageSelect = ({ locale = 'en', languages = [
|
|
15
|
+
{
|
|
16
|
+
id: 'en',
|
|
17
|
+
label: 'English',
|
|
18
|
+
countryCode: 'us',
|
|
19
|
+
MUILocale: 'enUS',
|
|
20
|
+
},
|
|
21
|
+
], }) => {
|
|
17
22
|
// Menu controls
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
const [anchorEl, setAnchorEl] = react_1.default.useState(null);
|
|
24
|
+
const open = Boolean(anchorEl);
|
|
25
|
+
const openOptions = (evt) => {
|
|
21
26
|
setAnchorEl(evt.currentTarget);
|
|
22
27
|
};
|
|
23
|
-
|
|
28
|
+
const closeOptions = () => {
|
|
24
29
|
setAnchorEl(null);
|
|
25
30
|
};
|
|
26
31
|
// Set the current language
|
|
27
|
-
|
|
28
|
-
document.cookie =
|
|
32
|
+
const setLocale = (locale) => {
|
|
33
|
+
document.cookie = `NEXT_LOCALE=${locale}; max-age=31536000; path=/`;
|
|
29
34
|
};
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const router = (0, router_1.useRouter)();
|
|
36
|
+
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.IconButton, { component: 'span', "aria-label": 'language', onClick: openOptions },
|
|
39
|
+
react_1.default.createElement(Language_1.default, null))),
|
|
40
|
+
react_1.default.createElement(material_1.Menu, { anchorEl: anchorEl, id: 'language-menu', open: open, onClose: closeOptions, onClick: closeOptions, anchorOrigin: {
|
|
36
41
|
vertical: 'bottom',
|
|
37
42
|
horizontal: 'right',
|
|
38
43
|
}, transformOrigin: {
|
|
@@ -43,10 +48,10 @@ export var LanguageSelect = function (_a) {
|
|
|
43
48
|
padding: '4px',
|
|
44
49
|
},
|
|
45
50
|
} },
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
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 },
|
|
52
|
+
react_1.default.createElement(material_1.MenuItem, { selected: lang.id === locale, onClick: () => setLocale(lang.id) },
|
|
53
|
+
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
54
|
+
react_1.default.createElement("span", null, languages_1.flagIcons[lang.countryCode])),
|
|
55
|
+
react_1.default.createElement(material_1.ListItemText, null, lang.label)))))))));
|
|
51
56
|
};
|
|
52
|
-
|
|
57
|
+
exports.LanguageSelect = LanguageSelect;
|
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ToggleButtonGroup = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const material_1 = require("@mui/material");
|
|
29
|
+
const useLocale_1 = require("../../../utils/hooks/useLocale");
|
|
30
|
+
const ToggleButtonGroup = ({ onChange, options, size = 'small', value, }) => {
|
|
31
|
+
const locale = (0, useLocale_1.useLocale)();
|
|
7
32
|
// Handle selection
|
|
8
|
-
|
|
9
|
-
|
|
33
|
+
const [selected, setSelected] = (0, react_1.useState)('');
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
10
35
|
if (value) {
|
|
11
36
|
setSelected(value);
|
|
12
37
|
}
|
|
13
38
|
}, [value]);
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
React.createElement(Button, { key: opt.id, size: size, color: 'primary', disabled: opt.disabled, variant: opt.id === selected ? 'contained' : 'outlined', onClick: function () { return onChange(opt.id); } }, opt.label[locale])));
|
|
39
|
+
return (react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center' } }, options.map((opt) => {
|
|
40
|
+
return (react_1.default.createElement(material_1.Tooltip, { key: opt.id, title: opt.tooltip?.[locale] || '' },
|
|
41
|
+
react_1.default.createElement(material_1.Button, { key: opt.id, size: size, color: 'primary', disabled: opt.disabled, variant: opt.id === selected ? 'contained' : 'outlined', onClick: () => onChange(opt.id) }, opt.label[locale])));
|
|
18
42
|
})));
|
|
19
43
|
};
|
|
20
|
-
|
|
44
|
+
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToggleButtonGroup = exports.LanguageSelect = exports.Avatar = void 0;
|
|
4
|
+
var Avatar_1 = require("./Avatar/Avatar");
|
|
5
|
+
Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return Avatar_1.Avatar; } });
|
|
6
|
+
var LanguageSelect_1 = require("./LanguageSelect/LanguageSelect");
|
|
7
|
+
Object.defineProperty(exports, "LanguageSelect", { enumerable: true, get: function () { return LanguageSelect_1.LanguageSelect; } });
|
|
8
|
+
var ToggleButtonGroup_1 = require("./ToggleButtonGroup/ToggleButtonGroup");
|
|
9
|
+
Object.defineProperty(exports, "ToggleButtonGroup", { enumerable: true, get: function () { return ToggleButtonGroup_1.ToggleButtonGroup; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAGL,cAAc,IAAI,iBAAiB,EAInC,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAuB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,UAAU,qBAAqB;IAC7B;;OAEG;IACH,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACzC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAChD,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAEnC,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqCvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
4
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var titleString = isStringTranslation(title) ? title[locale] : title;
|
|
32
|
-
var subtitleString = subtitle && isStringTranslation(subtitle) ? subtitle[locale] : subtitle;
|
|
33
|
-
return (React.createElement(Tooltip, { title: tooltip || '' },
|
|
34
|
-
React.createElement(React.Fragment, null,
|
|
35
|
-
React.createElement(MUIAccordion, __assign({}, muiProps),
|
|
36
|
-
React.createElement(AccordionSummary, { expandIcon: expandIcon },
|
|
37
|
-
icon && React.createElement("div", { style: { marginRight: '16px' } }, icon),
|
|
38
|
-
React.createElement(Typography, __assign({}, titleProps), titleString)),
|
|
39
|
-
React.createElement(AccordionDetails, null,
|
|
40
|
-
React.createElement(React.Fragment, null,
|
|
41
|
-
subtitle && (React.createElement(Typography, __assign({}, subtitleProps), subtitleString)),
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const ExpandMore_1 = __importDefault(require("@mui/icons-material/ExpandMore"));
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const types_1 = require("../../../types");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const Accordion = ({ title, titleProps = { variant: 'h6', color: 'textPrimary' }, subtitle, subtitleProps = { variant: 'subtitle1', gutterBottom: true }, icon, tooltip, expandIcon = react_1.default.createElement(ExpandMore_1.default, null), children, ...muiProps }) => {
|
|
12
|
+
const locale = (0, utils_1.useLocale)();
|
|
13
|
+
const titleString = (0, types_1.isStringTranslation)(title) ? title[locale] : title;
|
|
14
|
+
const subtitleString = subtitle && (0, types_1.isStringTranslation)(subtitle) ? subtitle[locale] : subtitle;
|
|
15
|
+
return (react_1.default.createElement(material_1.Tooltip, { title: tooltip || '' },
|
|
16
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
+
react_1.default.createElement(material_1.Accordion, { ...muiProps },
|
|
18
|
+
react_1.default.createElement(material_1.AccordionSummary, { expandIcon: expandIcon },
|
|
19
|
+
icon && react_1.default.createElement("div", { style: { marginRight: '16px' } }, icon),
|
|
20
|
+
react_1.default.createElement(material_1.Typography, { ...titleProps }, titleString)),
|
|
21
|
+
react_1.default.createElement(material_1.AccordionDetails, null,
|
|
22
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
23
|
+
subtitle && (react_1.default.createElement(material_1.Typography, { ...subtitleProps }, subtitleString)),
|
|
42
24
|
children))))));
|
|
43
25
|
};
|
|
44
|
-
|
|
26
|
+
exports.default = Accordion;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChipProps } from '@mui/material';
|
|
3
|
+
import { StringTranslation } from '../../../types';
|
|
4
|
+
type DeltaType = 'decrease' | 'moderateDecrease' | 'unchanged' | 'moderateIncrease' | 'increase';
|
|
5
|
+
export interface ImprovementChipProps extends ChipProps {
|
|
6
|
+
deltaType: DeltaType;
|
|
7
|
+
deltaValue: number;
|
|
8
|
+
isIncreasePositive?: boolean;
|
|
9
|
+
tooltip?: StringTranslation | string;
|
|
10
|
+
}
|
|
11
|
+
declare const ImprovementChip: React.FC<ImprovementChipProps>;
|
|
12
|
+
export default ImprovementChip;
|
|
13
|
+
//# sourceMappingURL=ImprovementChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImprovementChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/StyledValue/ImprovementChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAQ,SAAS,EAAW,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAuB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExE,KAAK,SAAS,GACV,UAAU,GACV,kBAAkB,GAClB,WAAW,GACX,kBAAkB,GAClB,UAAU,CAAC;AAEf,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACtC;AA8BD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0BnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const utils_1 = require("../../../utils");
|
|
10
|
+
const types_1 = require("../../../types");
|
|
11
|
+
const colorMap = (isIncreasePositive) => ({
|
|
12
|
+
decrease: isIncreasePositive ? 'error' : 'success',
|
|
13
|
+
moderateDecrease: 'warning',
|
|
14
|
+
unchanged: 'info',
|
|
15
|
+
moderateIncrease: 'warning',
|
|
16
|
+
increase: isIncreasePositive ? 'success' : 'error',
|
|
17
|
+
});
|
|
18
|
+
const iconMap = (size) => ({
|
|
19
|
+
decrease: react_1.default.createElement(icons_material_1.South, { fontSize: size }),
|
|
20
|
+
moderateDecrease: react_1.default.createElement(icons_material_1.SouthEast, { fontSize: size }),
|
|
21
|
+
unchanged: react_1.default.createElement(icons_material_1.East, { fontSize: size }),
|
|
22
|
+
moderateIncrease: react_1.default.createElement(icons_material_1.NorthEast, { fontSize: size }),
|
|
23
|
+
increase: react_1.default.createElement(icons_material_1.North, { fontSize: size }),
|
|
24
|
+
});
|
|
25
|
+
const ImprovementChip = ({ deltaType, deltaValue, isIncreasePositive = true, tooltip, size = 'small', color, }) => {
|
|
26
|
+
const locale = (0, utils_1.useLocale)();
|
|
27
|
+
const colors = colorMap(isIncreasePositive);
|
|
28
|
+
const icons = iconMap(size);
|
|
29
|
+
const tooltipString = tooltip && (0, types_1.isStringTranslation)(tooltip) ? tooltip[locale] : tooltip;
|
|
30
|
+
return (react_1.default.createElement(material_1.Tooltip, { title: tooltipString || '' },
|
|
31
|
+
react_1.default.createElement(material_1.Chip, { icon: icons[deltaType], label: `${deltaValue}%`, color: color || colors[deltaType], size: size })));
|
|
32
|
+
};
|
|
33
|
+
exports.default = ImprovementChip;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { CardProps, TypographyProps } from '@mui/material';
|
|
4
|
+
import { StringTranslation } from '../../../types';
|
|
5
|
+
import { ImprovementChipProps } from './ImprovementChip';
|
|
6
|
+
export interface FetchedValue {
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
config?: AxiosRequestConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface StyledValueProps {
|
|
12
|
+
value?: number | string | Date | FetchedValue;
|
|
13
|
+
formatOptions?: Partial<Intl.DateTimeFormatOptions | Intl.NumberFormatOptions>;
|
|
14
|
+
caption: string | StringTranslation;
|
|
15
|
+
details?: string | StringTranslation;
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
framed?: boolean;
|
|
18
|
+
raised?: boolean;
|
|
19
|
+
backgroundColor: string;
|
|
20
|
+
valueTypographyProps?: TypographyProps;
|
|
21
|
+
captionTypographyProps?: TypographyProps;
|
|
22
|
+
detailsTypographyProps?: TypographyProps;
|
|
23
|
+
cardProps?: CardProps;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
onCardClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
26
|
+
improvement?: ImprovementChipProps;
|
|
27
|
+
}
|
|
28
|
+
declare const StyledValue: React.FC<StyledValueProps>;
|
|
29
|
+
export default StyledValue;
|
|
30
|
+
//# sourceMappingURL=StyledValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|