@fluentui-react-native/win32-theme 0.19.2 → 0.21.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/CHANGELOG.json +88 -1
- package/CHANGELOG.md +33 -2
- package/lib/NativeModule/getThemingModule.native.d.ts +0 -6
- package/lib/NativeModule/getThemingModule.native.d.ts.map +1 -1
- package/lib/NativeModule/getThemingModule.native.js +1 -6
- package/lib/NativeModule/getThemingModule.native.js.map +1 -1
- package/lib/__tests__/win32-theme.test.d.ts +2 -0
- package/lib/__tests__/win32-theme.test.d.ts.map +1 -0
- package/lib/__tests__/win32-theme.test.js +100 -0
- package/lib/__tests__/win32-theme.test.js.map +1 -0
- package/lib/createAliasesFromPalette.d.ts.map +1 -1
- package/lib/createAliasesFromPalette.js +1 -13
- package/lib/createAliasesFromPalette.js.map +1 -1
- package/lib-commonjs/NativeModule/getThemingModule.native.d.ts +0 -6
- package/lib-commonjs/NativeModule/getThemingModule.native.d.ts.map +1 -1
- package/lib-commonjs/NativeModule/getThemingModule.native.js +1 -6
- package/lib-commonjs/NativeModule/getThemingModule.native.js.map +1 -1
- package/lib-commonjs/__tests__/win32-theme.test.d.ts +2 -0
- package/lib-commonjs/__tests__/win32-theme.test.d.ts.map +1 -0
- package/lib-commonjs/__tests__/win32-theme.test.js +102 -0
- package/lib-commonjs/__tests__/win32-theme.test.js.map +1 -0
- package/lib-commonjs/createAliasesFromPalette.d.ts.map +1 -1
- package/lib-commonjs/createAliasesFromPalette.js +1 -13
- package/lib-commonjs/createAliasesFromPalette.js.map +1 -1
- package/package.json +11 -11
- package/src/NativeModule/getThemingModule.native.ts +5 -11
- package/src/__tests__/__snapshots__/win32-theme.test.ts.snap +3904 -0
- package/src/__tests__/win32-theme.test.ts +89 -0
- package/src/createAliasesFromPalette.ts +1 -13
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createOfficeTheme } from '../createOfficeTheme';
|
|
2
|
+
import { createPartialOfficeTheme } from '../createPartialOfficeTheme';
|
|
3
|
+
import { fallbackGetPalette, fallbackOfficeModule, getThemingModule } from '../NativeModule/index';
|
|
4
|
+
import { createOfficeColorAliasTokens, createOfficeShadowAliasTokens } from '../createOfficeAliasTokens';
|
|
5
|
+
import { createFontAliasTokens } from '../createFontAliasTokens';
|
|
6
|
+
import { createBrandedThemeWithAlias, getCurrentBrandAliasTokens } from '../createBrandedThemeWithAlias';
|
|
7
|
+
import { win32Typography } from '../getThemeTypography';
|
|
8
|
+
|
|
9
|
+
const officeThemes = ['White', 'Colorful', 'DarkGray', 'Black', 'HighContrast'];
|
|
10
|
+
const appPrimaries = ['#185abd', '#107c41', '#d83b01', '#80397b', '#0078d4', '#c43e1c'];
|
|
11
|
+
|
|
12
|
+
it('win32Typography test', () => {
|
|
13
|
+
expect(win32Typography).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('fallbackOfficeModule test', () => {
|
|
17
|
+
expect(fallbackOfficeModule).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('getThemingModule test', () => {
|
|
21
|
+
const themingModule = getThemingModule();
|
|
22
|
+
expect(themingModule).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('createPartialOfficeTheme test', () => {
|
|
26
|
+
const themingModule = getThemingModule();
|
|
27
|
+
const partialOfficeTheme = createPartialOfficeTheme(themingModule[0]);
|
|
28
|
+
expect(partialOfficeTheme).toMatchSnapshot;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('createFontAliasTokens test', () => {
|
|
32
|
+
const fontAliasToken = createFontAliasTokens();
|
|
33
|
+
expect(fontAliasToken).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('createOfficeTheme test', () => {
|
|
37
|
+
const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
|
|
38
|
+
expect(officeTheme).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it.concurrent.each(officeThemes)('createBrandedThemeWithAlias test themeName: %s', async (themeName: string) => {
|
|
42
|
+
const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
|
|
43
|
+
const brandedTheme = createBrandedThemeWithAlias(themeName, officeTheme);
|
|
44
|
+
expect(brandedTheme).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it.concurrent.each(officeThemes)('createOfficeColorAliasTokens test officeTheme: %s', async (themeName: string) => {
|
|
48
|
+
const colorAliasToken = createOfficeColorAliasTokens(themeName);
|
|
49
|
+
expect(colorAliasToken).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it.concurrent.each(officeThemes)('createOfficeShadowAliasTokens test officeTheme: %s', async (themeName: string) => {
|
|
53
|
+
const shadowAliasToken = createOfficeShadowAliasTokens(themeName);
|
|
54
|
+
expect(shadowAliasToken).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('fallbackGetPalette test', () => {
|
|
58
|
+
it('TaskPane palette', () => {
|
|
59
|
+
const fallbackPalette = fallbackGetPalette('TaskPane');
|
|
60
|
+
expect(fallbackPalette).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('Random palette', () => {
|
|
64
|
+
/**
|
|
65
|
+
* RedColors is just a random pallette, we're just testing to see what happens
|
|
66
|
+
* if we use anything other than the TaskPane palette.
|
|
67
|
+
* */
|
|
68
|
+
const fallbackPalette = fallbackGetPalette('RedColors');
|
|
69
|
+
expect(fallbackPalette).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('getCurrentBrandAliasTokens test', () => {
|
|
74
|
+
it.concurrent.each(appPrimaries)('themeName: White, appPrimary: %s', async (appPrimary: string) => {
|
|
75
|
+
const brandAliasTokens = getCurrentBrandAliasTokens('White', appPrimary);
|
|
76
|
+
expect(brandAliasTokens).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it.concurrent.each(appPrimaries)('themeName: Colorful, appPrimary: %s', async (appPrimary: string) => {
|
|
80
|
+
const brandAliasTokens = getCurrentBrandAliasTokens('Colorful', appPrimary);
|
|
81
|
+
expect(brandAliasTokens).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Tests the variation of the alias tokens for when isWhiteOrColorfulTheme is not true
|
|
85
|
+
it.concurrent.each(appPrimaries)('themeName: null, appPrimary: %s', async (appPrimary: string) => {
|
|
86
|
+
const brandAliasTokens = getCurrentBrandAliasTokens(null, appPrimary);
|
|
87
|
+
expect(brandAliasTokens).toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -4,19 +4,7 @@ export function createAliasesFromPalette(palette: OfficePalette, isHighContrast:
|
|
|
4
4
|
// Workaround for getting checkmark to have correct color in HC
|
|
5
5
|
// while native code doesn't support PlatformColor
|
|
6
6
|
if (isHighContrast) {
|
|
7
|
-
return {
|
|
8
|
-
neutralForeground1: palette.Text,
|
|
9
|
-
neutralForeground1Hover: palette.TextHover,
|
|
10
|
-
neutralForeground1Pressed: palette.TextPressed,
|
|
11
|
-
neutralForeground1Selected: palette.TextSelected,
|
|
12
|
-
neutralForeground2: palette.TextSecondary,
|
|
13
|
-
neutralForeground3: palette.TextSecondary,
|
|
14
|
-
neutralForeground4: palette.TextCtlSubtlePlaceholder,
|
|
15
|
-
neutralForegroundDisabled: palette.TextDisabled,
|
|
16
|
-
neutralForegroundOnBrand: palette.TextCtlEmphasis,
|
|
17
|
-
neutralForegroundOnBrandHover: palette.TextCtlEmphasisHover,
|
|
18
|
-
neutralForegroundOnBrandPressed: palette.TextCtlEmphasisPressed,
|
|
19
|
-
};
|
|
7
|
+
return {};
|
|
20
8
|
}
|
|
21
9
|
|
|
22
10
|
return {
|