@deix/rossini-core 0.4.2 → 0.5.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/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 +98 -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 +3 -3
- 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.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 +3 -4
- package/lib/src/components/layout/components/Footer/Footer.d.ts.map +1 -1
- package/lib/src/components/layout/components/Footer/Footer.js +32 -70
- package/lib/src/components/layout/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/src/components/layout/components/Sidebar/Sidebar.js +110 -89
- 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 +4 -0
- 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.js +13 -9
- package/lib/src/components/progress/index.d.ts +0 -1
- package/lib/src/components/progress/index.d.ts.map +1 -1
- package/lib/src/components/progress/index.js +8 -2
- package/lib/src/components/progress/types.js +2 -1
- 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.js +10 -8
- 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 +40 -16
- 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/utils/theme/palette/defaultColors.json +0 -68
- package/lib/tsconfig-lib.tsbuildinfo +0 -1
|
@@ -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,
|
|
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,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.CircularLoading = void 0;
|
|
7
|
+
var CircularLoading_1 = require("./CircularLoading/CircularLoading");
|
|
8
|
+
Object.defineProperty(exports, "CircularLoading", { enumerable: true, get: function () { return __importDefault(CircularLoading_1).default; } });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Accordion, Avatar, CircularLoading,
|
|
2
|
-
export type { AccordionProps, AppLogoInfo, AvatarProps, ButtonGroupOption, FooterProps, LanguageSelectProps, LoaderProps, SidebarLink, SidebarProps, ToggleButtonGroupProps, } from './components';
|
|
1
|
+
export { Accordion, Avatar, CircularLoading, ImprovementChip, LanguageSelect, MinimalLayout, StandardLayout, StyledValue, ToggleButtonGroup, } from './components';
|
|
2
|
+
export type { AccordionProps, AppLogoInfo, AvatarProps, ButtonGroupOption, FetchedValue, FooterProps, ImprovementChipProps, LanguageSelectProps, LoaderProps, SidebarLink, SidebarProps, StyledValueProps, ToggleButtonGroupProps, } from './components';
|
|
3
3
|
export { isStringTranslation } from './types';
|
|
4
|
-
export type { DBRow, DBRows, Locale, PaginatedResponse, Query, StringTranslation, } from './types';
|
|
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';
|
|
6
6
|
export type { UserInfo } from './utils';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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,WAAW,EACX,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"}
|
package/lib/src/index.js
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUserInfo = exports.usePersistedState = exports.useLocale = exports.useAPI = exports.toTitleCase = exports.toLocalStandardDateString = exports.stringToColor = exports.PageProvider = exports.isValidDate = exports.hexToRgb = exports.getTimeStr = exports.getTextColor = exports.dateDiff = exports.commonStart = exports.colorToRgb = exports.camelToSnake = exports.isStringTranslation = exports.ToggleButtonGroup = exports.StyledValue = exports.StandardLayout = exports.MinimalLayout = exports.LanguageSelect = exports.ImprovementChip = exports.CircularLoading = exports.Avatar = exports.Accordion = void 0;
|
|
4
|
+
var components_1 = require("./components");
|
|
5
|
+
Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return components_1.Accordion; } });
|
|
6
|
+
Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return components_1.Avatar; } });
|
|
7
|
+
Object.defineProperty(exports, "CircularLoading", { enumerable: true, get: function () { return components_1.CircularLoading; } });
|
|
8
|
+
Object.defineProperty(exports, "ImprovementChip", { enumerable: true, get: function () { return components_1.ImprovementChip; } });
|
|
9
|
+
Object.defineProperty(exports, "LanguageSelect", { enumerable: true, get: function () { return components_1.LanguageSelect; } });
|
|
10
|
+
Object.defineProperty(exports, "MinimalLayout", { enumerable: true, get: function () { return components_1.MinimalLayout; } });
|
|
11
|
+
Object.defineProperty(exports, "StandardLayout", { enumerable: true, get: function () { return components_1.StandardLayout; } });
|
|
12
|
+
Object.defineProperty(exports, "StyledValue", { enumerable: true, get: function () { return components_1.StyledValue; } });
|
|
13
|
+
Object.defineProperty(exports, "ToggleButtonGroup", { enumerable: true, get: function () { return components_1.ToggleButtonGroup; } });
|
|
14
|
+
var types_1 = require("./types");
|
|
15
|
+
Object.defineProperty(exports, "isStringTranslation", { enumerable: true, get: function () { return types_1.isStringTranslation; } });
|
|
16
|
+
var utils_1 = require("./utils");
|
|
17
|
+
Object.defineProperty(exports, "camelToSnake", { enumerable: true, get: function () { return utils_1.camelToSnake; } });
|
|
18
|
+
Object.defineProperty(exports, "colorToRgb", { enumerable: true, get: function () { return utils_1.colorToRgb; } });
|
|
19
|
+
Object.defineProperty(exports, "commonStart", { enumerable: true, get: function () { return utils_1.commonStart; } });
|
|
20
|
+
Object.defineProperty(exports, "dateDiff", { enumerable: true, get: function () { return utils_1.dateDiff; } });
|
|
21
|
+
Object.defineProperty(exports, "getTextColor", { enumerable: true, get: function () { return utils_1.getTextColor; } });
|
|
22
|
+
Object.defineProperty(exports, "getTimeStr", { enumerable: true, get: function () { return utils_1.getTimeStr; } });
|
|
23
|
+
Object.defineProperty(exports, "hexToRgb", { enumerable: true, get: function () { return utils_1.hexToRgb; } });
|
|
24
|
+
Object.defineProperty(exports, "isValidDate", { enumerable: true, get: function () { return utils_1.isValidDate; } });
|
|
25
|
+
Object.defineProperty(exports, "PageProvider", { enumerable: true, get: function () { return utils_1.PageProvider; } });
|
|
26
|
+
Object.defineProperty(exports, "stringToColor", { enumerable: true, get: function () { return utils_1.stringToColor; } });
|
|
27
|
+
Object.defineProperty(exports, "toLocalStandardDateString", { enumerable: true, get: function () { return utils_1.toLocalStandardDateString; } });
|
|
28
|
+
Object.defineProperty(exports, "toTitleCase", { enumerable: true, get: function () { return utils_1.toTitleCase; } });
|
|
29
|
+
Object.defineProperty(exports, "useAPI", { enumerable: true, get: function () { return utils_1.useAPI; } });
|
|
30
|
+
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return utils_1.useLocale; } });
|
|
31
|
+
Object.defineProperty(exports, "usePersistedState", { enumerable: true, get: function () { return utils_1.usePersistedState; } });
|
|
32
|
+
Object.defineProperty(exports, "useUserInfo", { enumerable: true, get: function () { return utils_1.useUserInfo; } });
|
package/lib/src/types/api.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { DBRow, DBRows, PaginatedResponse, Query } from './api';
|
|
2
|
+
export type { Locale, Language, StringTranslation } from './languages';
|
|
2
3
|
export { isStringTranslation } from './languages';
|
|
3
|
-
export type { Locale, StringTranslation } from './languages';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/lib/src/types/index.js
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStringTranslation = void 0;
|
|
4
|
+
var languages_1 = require("./languages");
|
|
5
|
+
Object.defineProperty(exports, "isStringTranslation", { enumerable: true, get: function () { return languages_1.isStringTranslation; } });
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flagIcons = exports.isStringTranslation = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Type guard for StringTranslation type.
|
|
3
6
|
*
|
|
4
7
|
* @param {unknown} value the value whose type needs checking.
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
const isStringTranslation = (value) => {
|
|
7
10
|
return value.en !== undefined;
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.isStringTranslation = isStringTranslation;
|
|
13
|
+
exports.flagIcons = {
|
|
10
14
|
us: '🇺🇸',
|
|
11
15
|
it: '🇮🇹',
|
|
12
16
|
de: '🇩🇪',
|
|
@@ -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,
|
|
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"}
|
package/lib/src/types/palette.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTextColor = exports.getBrightness = exports.colorToRgb = exports.hexToRgb = void 0;
|
|
1
4
|
function colourNameToHex(colour) {
|
|
2
|
-
|
|
5
|
+
const colours = {
|
|
3
6
|
aliceblue: '#f0f8ff',
|
|
4
7
|
antiquewhite: '#faebd7',
|
|
5
8
|
aqua: '#00ffff',
|
|
@@ -147,8 +150,8 @@ function colourNameToHex(colour) {
|
|
|
147
150
|
}
|
|
148
151
|
return false;
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
function hexToRgb(hex) {
|
|
154
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
152
155
|
return result
|
|
153
156
|
? [
|
|
154
157
|
parseInt(result[1], 16),
|
|
@@ -157,17 +160,19 @@ export function hexToRgb(hex) {
|
|
|
157
160
|
]
|
|
158
161
|
: null;
|
|
159
162
|
}
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
exports.hexToRgb = hexToRgb;
|
|
164
|
+
const colorToRgb = (colour) => {
|
|
165
|
+
const hexColor = colour.charAt(0) === '#' ? colour : colourNameToHex(colour);
|
|
162
166
|
return hexColor ? hexToRgb(hexColor) : [0, 0, 0];
|
|
163
167
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
exports.colorToRgb = colorToRgb;
|
|
169
|
+
const getBrightness = (rgb) => rgb ? Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000) : 0;
|
|
170
|
+
exports.getBrightness = getBrightness;
|
|
171
|
+
const getTextColor = (background_rgb) => {
|
|
168
172
|
// it give black or white color based on background color
|
|
169
|
-
|
|
170
|
-
? colorToRgb(background_rgb)
|
|
173
|
+
const brightness = (0, exports.getBrightness)(typeof background_rgb === 'string'
|
|
174
|
+
? (0, exports.colorToRgb)(background_rgb)
|
|
171
175
|
: background_rgb);
|
|
172
176
|
return brightness > 125 ? 'black' : 'white';
|
|
173
177
|
};
|
|
178
|
+
exports.getTextColor = getTextColor;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLocalStandardDateString = exports.isValidDate = exports.getTimeStr = exports.dateDiff = void 0;
|
|
4
|
+
const dateDiff = (date1, date2) => {
|
|
5
|
+
let elapsedSeconds = Math.abs(date2.getTime() - date1.getTime()) / 1000; // in seconds
|
|
6
|
+
const elapsedDays = Math.floor(elapsedSeconds / 86400);
|
|
4
7
|
elapsedSeconds -= elapsedDays * 86400;
|
|
5
|
-
|
|
8
|
+
const elapsedHours = Math.floor(elapsedSeconds / 3600) % 24;
|
|
6
9
|
elapsedSeconds -= elapsedHours * 3600;
|
|
7
|
-
|
|
10
|
+
const elapsedMinutes = Math.floor(elapsedSeconds / 60) % 60;
|
|
8
11
|
elapsedSeconds -= elapsedMinutes * 60;
|
|
9
12
|
return {
|
|
10
13
|
days: elapsedDays,
|
|
@@ -13,25 +16,28 @@ export var dateDiff = function (date1, date2) {
|
|
|
13
16
|
seconds: elapsedSeconds,
|
|
14
17
|
};
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
exports.dateDiff = dateDiff;
|
|
20
|
+
const getTimeStr = (value) => {
|
|
17
21
|
// converts hours in a string {xx}h {yy}m {zz}s
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const hv = Math.floor(value);
|
|
23
|
+
let restv = value - hv;
|
|
24
|
+
const mv = Math.floor(restv * 60);
|
|
21
25
|
restv = restv * 60 - mv;
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const sv = Math.floor(restv * 60);
|
|
27
|
+
const retStr = `${hv}h ${mv}m ${sv}s`;
|
|
24
28
|
return retStr;
|
|
25
29
|
};
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
exports.getTimeStr = getTimeStr;
|
|
31
|
+
const isValidDate = (d) => {
|
|
32
|
+
const date = new Date(d);
|
|
28
33
|
return date instanceof Date && !isNaN(date.getDate());
|
|
29
34
|
};
|
|
30
|
-
|
|
35
|
+
exports.isValidDate = isValidDate;
|
|
36
|
+
const toLocalStandardDateString = (d) => {
|
|
31
37
|
// converts date to locale YYYY/MM/DD format
|
|
32
|
-
if (isValidDate(d)) {
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
if ((0, exports.isValidDate)(d)) {
|
|
39
|
+
const date = new Date(d);
|
|
40
|
+
const isoDateTime = new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
|
35
41
|
.toISOString()
|
|
36
42
|
.split('T')[0];
|
|
37
43
|
return isoDateTime;
|
|
@@ -41,3 +47,4 @@ export var toLocalStandardDateString = function (d) {
|
|
|
41
47
|
return undefined;
|
|
42
48
|
}
|
|
43
49
|
};
|
|
50
|
+
exports.toLocalStandardDateString = toLocalStandardDateString;
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toTitleCase = exports.stringToColor = exports.commonStart = exports.camelToSnake = exports.toLocalStandardDateString = exports.isValidDate = exports.getTimeStr = exports.dateDiff = exports.hexToRgb = exports.getTextColor = exports.colorToRgb = void 0;
|
|
4
|
+
var colorHelpers_1 = require("./colorHelpers");
|
|
5
|
+
Object.defineProperty(exports, "colorToRgb", { enumerable: true, get: function () { return colorHelpers_1.colorToRgb; } });
|
|
6
|
+
Object.defineProperty(exports, "getTextColor", { enumerable: true, get: function () { return colorHelpers_1.getTextColor; } });
|
|
7
|
+
Object.defineProperty(exports, "hexToRgb", { enumerable: true, get: function () { return colorHelpers_1.hexToRgb; } });
|
|
8
|
+
var dateHelpers_1 = require("./dateHelpers");
|
|
9
|
+
Object.defineProperty(exports, "dateDiff", { enumerable: true, get: function () { return dateHelpers_1.dateDiff; } });
|
|
10
|
+
Object.defineProperty(exports, "getTimeStr", { enumerable: true, get: function () { return dateHelpers_1.getTimeStr; } });
|
|
11
|
+
Object.defineProperty(exports, "isValidDate", { enumerable: true, get: function () { return dateHelpers_1.isValidDate; } });
|
|
12
|
+
Object.defineProperty(exports, "toLocalStandardDateString", { enumerable: true, get: function () { return dateHelpers_1.toLocalStandardDateString; } });
|
|
13
|
+
var stringHelpers_1 = require("./stringHelpers");
|
|
14
|
+
Object.defineProperty(exports, "camelToSnake", { enumerable: true, get: function () { return stringHelpers_1.camelToSnake; } });
|
|
15
|
+
Object.defineProperty(exports, "commonStart", { enumerable: true, get: function () { return stringHelpers_1.commonStart; } });
|
|
16
|
+
Object.defineProperty(exports, "stringToColor", { enumerable: true, get: function () { return stringHelpers_1.stringToColor; } });
|
|
17
|
+
Object.defineProperty(exports, "toTitleCase", { enumerable: true, get: function () { return stringHelpers_1.toTitleCase; } });
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export var stringToColor = function (string) {
|
|
17
|
-
var hash = 0;
|
|
18
|
-
var i;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commonStart = exports.stringToColor = exports.toTitleCase = exports.snakeToCamel = exports.camelToSnake = void 0;
|
|
4
|
+
const camelToSnake = (inputString) => inputString.replace(/[\w]([A-Z])/g, (m) => `${m[0]}-${m[1]}`).toLowerCase();
|
|
5
|
+
exports.camelToSnake = camelToSnake;
|
|
6
|
+
const snakeToCamel = (inputString) => inputString.replace(/([-_][a-z])/g, (subStr) => subStr.toUpperCase().replace('-', '').replace('_', ''));
|
|
7
|
+
exports.snakeToCamel = snakeToCamel;
|
|
8
|
+
const toTitleCase = (inputString, sep = '_') => inputString
|
|
9
|
+
.split(sep)
|
|
10
|
+
.map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase())
|
|
11
|
+
.join(' ');
|
|
12
|
+
exports.toTitleCase = toTitleCase;
|
|
13
|
+
const stringToColor = (string) => {
|
|
14
|
+
let hash = 0;
|
|
15
|
+
let i;
|
|
19
16
|
/* eslint-disable no-bitwise */
|
|
20
17
|
for (i = 0; i < string.length; i += 1) {
|
|
21
18
|
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
let color = '#';
|
|
24
21
|
for (i = 0; i < 3; i += 1) {
|
|
25
|
-
|
|
26
|
-
color +=
|
|
22
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
23
|
+
color += `00${value.toString(16)}`.slice(-2);
|
|
27
24
|
}
|
|
28
25
|
/* eslint-enable no-bitwise */
|
|
29
26
|
return color;
|
|
30
27
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
exports.stringToColor = stringToColor;
|
|
29
|
+
const commonStart = (strings) => {
|
|
30
|
+
const sortedList = strings.slice().sort();
|
|
31
|
+
const first = sortedList[0];
|
|
32
|
+
const last = sortedList[sortedList.length - 1];
|
|
33
|
+
let i = 0;
|
|
36
34
|
while (i < first.length && first.charAt(i) === last.charAt(i)) {
|
|
37
35
|
i++;
|
|
38
36
|
}
|
|
39
37
|
return first.substring(0, i);
|
|
40
38
|
};
|
|
39
|
+
exports.commonStart = commonStart;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.usePersistedState = exports.useLocale = exports.useUserInfo = exports.useAPI = void 0;
|
|
7
|
+
var useAPI_1 = require("./useAPI");
|
|
8
|
+
Object.defineProperty(exports, "useAPI", { enumerable: true, get: function () { return __importDefault(useAPI_1).default; } });
|
|
9
|
+
var useKeycloak_1 = require("./useKeycloak");
|
|
10
|
+
Object.defineProperty(exports, "useUserInfo", { enumerable: true, get: function () { return useKeycloak_1.useUserInfo; } });
|
|
11
|
+
var useLocale_1 = require("./useLocale");
|
|
12
|
+
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return useLocale_1.useLocale; } });
|
|
13
|
+
var usePersistedState_1 = require("./usePersistedState");
|
|
14
|
+
Object.defineProperty(exports, "usePersistedState", { enumerable: true, get: function () { return __importDefault(usePersistedState_1).default; } });
|
|
@@ -5,6 +5,6 @@ import { AxiosInstance } from 'axios';
|
|
|
5
5
|
* @param {string} baseURL the API address.
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
declare const useAPI: (baseURL?: string) => AxiosInstance;
|
|
8
|
+
declare const useAPI: (baseURL?: string) => AxiosInstance | undefined;
|
|
9
9
|
export default useAPI;
|
|
10
10
|
//# sourceMappingURL=useAPI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAPI.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useAPI.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,aAAc,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"useAPI.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useAPI.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,aAAc,MAAM,KAAG,aAAa,GAAG,SASlD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
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 axios_1 = __importDefault(require("axios"));
|
|
2
7
|
/**
|
|
3
8
|
* Create an Axios instance.
|
|
4
9
|
*
|
|
5
10
|
* @param {string} baseURL the API address.
|
|
6
11
|
* @returns
|
|
7
12
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const useAPI = (baseURL) => {
|
|
14
|
+
if (baseURL) {
|
|
15
|
+
return axios_1.default.create({
|
|
16
|
+
baseURL,
|
|
17
|
+
headers: {
|
|
18
|
+
Accept: 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
15
22
|
};
|
|
16
|
-
|
|
23
|
+
exports.default = useAPI;
|
|
@@ -13,5 +13,5 @@ export interface UserInfo {
|
|
|
13
13
|
*/
|
|
14
14
|
preferredUserName: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const useUserInfo: (apiClient
|
|
16
|
+
export declare const useUserInfo: (apiClient?: AxiosInstance) => import("react-query").UseQueryResult<UserInfo | undefined, unknown>;
|
|
17
17
|
//# sourceMappingURL=useKeycloak.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeycloak.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useKeycloak.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useKeycloak.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useKeycloak.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAuBD,eAAO,MAAM,WAAW,eAAgB,aAAa,wEAKjD,CAAC"}
|
|
@@ -1,69 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUserInfo = void 0;
|
|
4
|
+
const react_query_1 = require("react-query");
|
|
5
|
+
const getUserInfo = async (apiClient) => {
|
|
6
|
+
if (apiClient) {
|
|
7
|
+
const fetch = apiClient
|
|
8
|
+
.get('oauth2/userinfo')
|
|
9
|
+
.then((result) => {
|
|
10
|
+
console.log('User Info', result.data);
|
|
11
|
+
return result.data;
|
|
12
|
+
})
|
|
13
|
+
.catch((err) => {
|
|
14
|
+
console.error('Could not get user info');
|
|
15
|
+
console.error(err);
|
|
16
|
+
return {
|
|
17
|
+
email: '',
|
|
18
|
+
user: 'anonymous',
|
|
19
|
+
preferredUserName: 'anonymous',
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
return await fetch;
|
|
35
23
|
}
|
|
36
24
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
fetch = apiClient
|
|
44
|
-
.get('oauth2/userinfo')
|
|
45
|
-
.then(function (result) {
|
|
46
|
-
console.log('User Info', result.data);
|
|
47
|
-
return result.data;
|
|
48
|
-
})
|
|
49
|
-
.catch(function (err) {
|
|
50
|
-
console.error('Could not get user info');
|
|
51
|
-
console.error(err);
|
|
52
|
-
return {
|
|
53
|
-
email: '',
|
|
54
|
-
user: 'anonymous',
|
|
55
|
-
preferredUserName: 'anonymous',
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
return [4 /*yield*/, fetch];
|
|
59
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}); };
|
|
63
|
-
export var useUserInfo = function (apiClient) {
|
|
64
|
-
return useQuery('user-info', function () { return getUserInfo(apiClient); }, {
|
|
65
|
-
keepPreviousData: true,
|
|
66
|
-
staleTime: Infinity,
|
|
67
|
-
cacheTime: Infinity,
|
|
68
|
-
});
|
|
69
|
-
};
|
|
25
|
+
const useUserInfo = (apiClient) => (0, react_query_1.useQuery)('user-info', () => getUserInfo(apiClient), {
|
|
26
|
+
keepPreviousData: true,
|
|
27
|
+
staleTime: Infinity,
|
|
28
|
+
cacheTime: Infinity,
|
|
29
|
+
});
|
|
30
|
+
exports.useUserInfo = useUserInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,SAAS,QAAO,MAK5B,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLocale = void 0;
|
|
4
|
+
const router_1 = require("next/router");
|
|
2
5
|
/**
|
|
3
6
|
* Gets the internationalization locale
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const useLocale = () => {
|
|
9
|
+
const router = (0, router_1.useRouter)();
|
|
10
|
+
const locale = router.locale || 'en';
|
|
8
11
|
return locale;
|
|
9
12
|
};
|
|
13
|
+
exports.useLocale = useLocale;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
2
4
|
/**
|
|
3
5
|
* Use a variable stored persistently on local storage.
|
|
4
6
|
*
|
|
@@ -6,11 +8,11 @@ import { useEffect, useState } from 'react';
|
|
|
6
8
|
* @param {T} defaultValue the default value. The first time the hook is called the variable is created with this value.
|
|
7
9
|
*/
|
|
8
10
|
function usePersistedState(name, defaultValue) {
|
|
9
|
-
|
|
11
|
+
const [value, setValue] = (0, react_1.useState)(() => {
|
|
10
12
|
try {
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
return JSON.parse(
|
|
13
|
+
const value = window.localStorage.getItem(name);
|
|
14
|
+
if (value) {
|
|
15
|
+
return JSON.parse(value);
|
|
14
16
|
}
|
|
15
17
|
else {
|
|
16
18
|
window.localStorage.setItem(name, JSON.stringify(defaultValue));
|
|
@@ -20,8 +22,8 @@ function usePersistedState(name, defaultValue) {
|
|
|
20
22
|
catch (err) {
|
|
21
23
|
return defaultValue;
|
|
22
24
|
}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
+
});
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
25
27
|
try {
|
|
26
28
|
window.localStorage.setItem(name, JSON.stringify(value));
|
|
27
29
|
}
|
|
@@ -31,4 +33,4 @@ function usePersistedState(name, defaultValue) {
|
|
|
31
33
|
}, [value]);
|
|
32
34
|
return [value, setValue];
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
exports.default = usePersistedState;
|