@j2inn/fin5-ui-utils 6.0.1 → 6.0.2
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.
|
@@ -7,34 +7,41 @@ exports.useFin5ColorScheme = void 0;
|
|
|
7
7
|
const ui_1 = require("@j2inn/ui");
|
|
8
8
|
const react_jss_1 = require("react-jss");
|
|
9
9
|
const fin5Top_1 = require("../../fin5Top/fin5Top");
|
|
10
|
+
const react_1 = require("react");
|
|
10
11
|
function useFin5ColorScheme() {
|
|
11
12
|
const theme = (0, react_jss_1.useTheme)();
|
|
12
13
|
const colorScheme = (0, fin5Top_1.getFin5top)()?.app.GetColorScheme?.();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
const brandedTheme = (0, react_1.useMemo)(() => {
|
|
15
|
+
if (!colorScheme) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return (0, ui_1.GenerateTheme)({
|
|
19
|
+
light: {
|
|
20
|
+
...ui_1.DEFAULT_THEME.light,
|
|
21
|
+
bodyBg: colorScheme.bodyBackground,
|
|
22
|
+
bgColor: (0, ui_1.lighten)(colorScheme.bodyBackground, 5),
|
|
23
|
+
},
|
|
24
|
+
dark: {
|
|
25
|
+
...ui_1.DEFAULT_THEME.dark,
|
|
26
|
+
bodyBg: colorScheme.bodyBackground,
|
|
27
|
+
bgColor: (0, ui_1.lighten)(colorScheme.bodyBackground, 5),
|
|
28
|
+
},
|
|
29
|
+
palette: {
|
|
30
|
+
...ui_1.DEFAULT_THEME.palette,
|
|
31
|
+
primary: colorScheme.primary,
|
|
32
|
+
secondary: (0, ui_1.tint)(colorScheme.primary, 20),
|
|
33
|
+
accent: (0, ui_1.shade)(colorScheme.primary, 20),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}, [
|
|
37
|
+
colorScheme?.primary,
|
|
38
|
+
colorScheme?.bodyBackground,
|
|
39
|
+
colorScheme?.sidebarBackground,
|
|
40
|
+
]);
|
|
41
|
+
if (brandedTheme && theme.type === 'light') {
|
|
35
42
|
return brandedTheme.light;
|
|
36
43
|
}
|
|
37
|
-
if (theme.type === 'dark') {
|
|
44
|
+
if (brandedTheme && theme.type === 'dark') {
|
|
38
45
|
return brandedTheme.dark;
|
|
39
46
|
}
|
|
40
47
|
return theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFin5ColorScheme.js","sourceRoot":"","sources":["../../../src/react/hooks/useFin5ColorScheme.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,kCAOkB;AAClB,yCAAoC;AACpC,mDAAkD;
|
|
1
|
+
{"version":3,"file":"useFin5ColorScheme.js","sourceRoot":"","sources":["../../../src/react/hooks/useFin5ColorScheme.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,kCAOkB;AAClB,yCAAoC;AACpC,mDAAkD;AAClD,iCAA+B;AAE/B,SAAgB,kBAAkB;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAQ,GAAY,CAAA;IAClC,MAAM,WAAW,GAAG,IAAA,oBAAU,GAAE,EAAE,GAAG,CAAC,cAAc,EAAE,EAAE,CAAA;IACxD,MAAM,YAAY,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACjC,IAAI,CAAC,WAAW,EAAE;YACjB,OAAO,SAAS,CAAA;SAChB;QAED,OAAO,IAAA,kBAAa,EAAC;YACpB,KAAK,EAAE;gBACN,GAAG,kBAAa,CAAC,KAAK;gBACtB,MAAM,EAAE,WAAW,CAAC,cAAc;gBAClC,OAAO,EAAE,IAAA,YAAO,EAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;aAC/C;YACD,IAAI,EAAE;gBACL,GAAG,kBAAa,CAAC,IAAI;gBACrB,MAAM,EAAE,WAAW,CAAC,cAAc;gBAClC,OAAO,EAAE,IAAA,YAAO,EAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;aAC/C;YACD,OAAO,EAAE;gBACR,GAAG,kBAAa,CAAC,OAAO;gBACxB,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,SAAS,EAAE,IAAA,SAAI,EAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;gBACxC,MAAM,EAAE,IAAA,UAAK,EAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;aACtC;SACD,CAAC,CAAA;IACH,CAAC,EAAE;QACF,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,iBAAiB;KAC9B,CAAC,CAAA;IAEF,IAAI,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;QAC3C,OAAO,YAAY,CAAC,KAAK,CAAA;KACzB;IAED,IAAI,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;QAC1C,OAAO,YAAY,CAAC,IAAI,CAAA;KACxB;IAED,OAAO,KAAK,CAAA;AACb,CAAC;AAzCD,gDAyCC"}
|
|
@@ -4,34 +4,41 @@
|
|
|
4
4
|
import { DEFAULT_THEME, GenerateTheme, lighten, shade, tint, } from '@j2inn/ui';
|
|
5
5
|
import { useTheme } from 'react-jss';
|
|
6
6
|
import { getFin5top } from '../../fin5Top/fin5Top';
|
|
7
|
+
import { useMemo } from 'react';
|
|
7
8
|
export function useFin5ColorScheme() {
|
|
8
9
|
const theme = useTheme();
|
|
9
10
|
const colorScheme = getFin5top()?.app.GetColorScheme?.();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
const brandedTheme = useMemo(() => {
|
|
12
|
+
if (!colorScheme) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return GenerateTheme({
|
|
16
|
+
light: {
|
|
17
|
+
...DEFAULT_THEME.light,
|
|
18
|
+
bodyBg: colorScheme.bodyBackground,
|
|
19
|
+
bgColor: lighten(colorScheme.bodyBackground, 5),
|
|
20
|
+
},
|
|
21
|
+
dark: {
|
|
22
|
+
...DEFAULT_THEME.dark,
|
|
23
|
+
bodyBg: colorScheme.bodyBackground,
|
|
24
|
+
bgColor: lighten(colorScheme.bodyBackground, 5),
|
|
25
|
+
},
|
|
26
|
+
palette: {
|
|
27
|
+
...DEFAULT_THEME.palette,
|
|
28
|
+
primary: colorScheme.primary,
|
|
29
|
+
secondary: tint(colorScheme.primary, 20),
|
|
30
|
+
accent: shade(colorScheme.primary, 20),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}, [
|
|
34
|
+
colorScheme?.primary,
|
|
35
|
+
colorScheme?.bodyBackground,
|
|
36
|
+
colorScheme?.sidebarBackground,
|
|
37
|
+
]);
|
|
38
|
+
if (brandedTheme && theme.type === 'light') {
|
|
32
39
|
return brandedTheme.light;
|
|
33
40
|
}
|
|
34
|
-
if (theme.type === 'dark') {
|
|
41
|
+
if (brandedTheme && theme.type === 'dark') {
|
|
35
42
|
return brandedTheme.dark;
|
|
36
43
|
}
|
|
37
44
|
return theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFin5ColorScheme.js","sourceRoot":"","sources":["../../../src/react/hooks/useFin5ColorScheme.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACN,aAAa,EACb,aAAa,EACb,OAAO,EACP,KA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