@fluentui-react-native/win32-theme 0.39.0 → 0.39.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/NativeModule/_mocks_/getThemingModule.native.d.ts +1 -1
  3. package/lib/NativeModule/_mocks_/getThemingModule.native.js +2 -2
  4. package/lib/NativeModule/fallbackOfficeModule.d.ts +1 -1
  5. package/lib/NativeModule/fallbackOfficeModule.js +163 -163
  6. package/lib/NativeModule/getThemingModule.d.ts +1 -1
  7. package/lib/NativeModule/getThemingModule.js +2 -2
  8. package/lib/NativeModule/getThemingModule.native.d.ts +1 -1
  9. package/lib/NativeModule/getThemingModule.native.js +30 -28
  10. package/lib/NativeModule/hostThemeSetting.d.ts +1 -1
  11. package/lib/NativeModule/hostThemeSetting.js +3 -3
  12. package/lib/NativeModule/index.d.ts +2 -10
  13. package/lib/NativeModule/index.js +1 -1
  14. package/lib/NativeModule/officeThemingModule.d.ts +21 -21
  15. package/lib/NativeModule/officeThemingModule.js +1 -1
  16. package/lib/__tests__/win32-theme.test.d.ts +1 -1
  17. package/lib/__tests__/win32-theme.test.js +47 -47
  18. package/lib/createAliasesFromPalette.d.ts +1 -1
  19. package/lib/createAliasesFromPalette.js +56 -56
  20. package/lib/createBrandedThemeWithAlias.d.ts +1 -1
  21. package/lib/createBrandedThemeWithAlias.js +61 -56
  22. package/lib/createFontAliasTokens.d.ts +1 -1
  23. package/lib/createFontAliasTokens.js +3 -3
  24. package/lib/createOfficeAliasTokens.d.ts +1 -1
  25. package/lib/createOfficeAliasTokens.js +5 -5
  26. package/lib/createOfficeTheme.d.ts +1 -1
  27. package/lib/createOfficeTheme.js +46 -53
  28. package/lib/createPartialOfficeTheme.d.ts +1 -1
  29. package/lib/createPartialOfficeTheme.js +19 -22
  30. package/lib/getOfficeTokens.d.ts +227 -229
  31. package/lib/getOfficeTokens.js +26 -20
  32. package/lib/getThemeTypography.d.ts +1 -1
  33. package/lib/getThemeTypography.js +32 -32
  34. package/lib/highContrast/tokens-alias.d.ts +1 -1
  35. package/lib/highContrast/tokens-alias.js +11 -11
  36. package/lib/index.d.ts +2 -10
  37. package/lib/index.js +1 -1
  38. package/lib/paletteFromOfficeColors.d.ts +1 -1
  39. package/lib/paletteFromOfficeColors.js +114 -114
  40. package/lib-commonjs/NativeModule/_mocks_/getThemingModule.native.d.ts +1 -1
  41. package/lib-commonjs/NativeModule/_mocks_/getThemingModule.native.js +5 -5
  42. package/lib-commonjs/NativeModule/fallbackOfficeModule.d.ts +1 -1
  43. package/lib-commonjs/NativeModule/fallbackOfficeModule.js +165 -165
  44. package/lib-commonjs/NativeModule/getThemingModule.d.ts +1 -1
  45. package/lib-commonjs/NativeModule/getThemingModule.js +5 -5
  46. package/lib-commonjs/NativeModule/getThemingModule.native.d.ts +1 -1
  47. package/lib-commonjs/NativeModule/getThemingModule.native.js +35 -33
  48. package/lib-commonjs/NativeModule/hostThemeSetting.d.ts +1 -1
  49. package/lib-commonjs/NativeModule/hostThemeSetting.js +5 -5
  50. package/lib-commonjs/NativeModule/index.d.ts +2 -10
  51. package/lib-commonjs/NativeModule/index.js +8 -23
  52. package/lib-commonjs/NativeModule/officeThemingModule.d.ts +21 -21
  53. package/lib-commonjs/NativeModule/officeThemingModule.js +3 -3
  54. package/lib-commonjs/__tests__/win32-theme.test.d.ts +1 -1
  55. package/lib-commonjs/__tests__/win32-theme.test.js +57 -57
  56. package/lib-commonjs/createAliasesFromPalette.d.ts +1 -1
  57. package/lib-commonjs/createAliasesFromPalette.js +58 -58
  58. package/lib-commonjs/createBrandedThemeWithAlias.d.ts +1 -1
  59. package/lib-commonjs/createBrandedThemeWithAlias.js +64 -59
  60. package/lib-commonjs/createFontAliasTokens.d.ts +1 -1
  61. package/lib-commonjs/createFontAliasTokens.js +8 -8
  62. package/lib-commonjs/createOfficeAliasTokens.d.ts +1 -1
  63. package/lib-commonjs/createOfficeAliasTokens.js +10 -10
  64. package/lib-commonjs/createOfficeTheme.d.ts +1 -1
  65. package/lib-commonjs/createOfficeTheme.js +57 -66
  66. package/lib-commonjs/createPartialOfficeTheme.d.ts +1 -1
  67. package/lib-commonjs/createPartialOfficeTheme.js +22 -25
  68. package/lib-commonjs/getOfficeTokens.d.ts +227 -229
  69. package/lib-commonjs/getOfficeTokens.js +39 -35
  70. package/lib-commonjs/getThemeTypography.d.ts +1 -1
  71. package/lib-commonjs/getThemeTypography.js +36 -36
  72. package/lib-commonjs/highContrast/tokens-alias.d.ts +1 -1
  73. package/lib-commonjs/highContrast/tokens-alias.js +18 -20
  74. package/lib-commonjs/index.d.ts +2 -10
  75. package/lib-commonjs/index.js +23 -89
  76. package/lib-commonjs/paletteFromOfficeColors.d.ts +1 -1
  77. package/lib-commonjs/paletteFromOfficeColors.js +116 -116
  78. package/package.json +19 -18
@@ -9,71 +9,71 @@ import { fallbackGetPalette, fallbackOfficeModule, getThemingModule } from '../N
9
9
  const officeThemes = ['White', 'Colorful', 'DarkGray', 'Black', 'HighContrast'];
10
10
  const appPrimaries = ['#185abd', '#107c41', '#d83b01', '#80397b', '#0078d4', '#c43e1c'];
11
11
  it('win32Typography test', () => {
12
- expect(win32Typography).toMatchSnapshot();
12
+ expect(win32Typography).toMatchSnapshot();
13
13
  });
14
14
  it('fallbackOfficeModule test', () => {
15
- expect(fallbackOfficeModule).toMatchSnapshot();
16
- expect(fallbackOfficeModule.getConstants()).toMatchSnapshot();
15
+ expect(fallbackOfficeModule).toMatchSnapshot();
16
+ expect(fallbackOfficeModule.getConstants()).toMatchSnapshot();
17
17
  });
18
18
  it('getThemingModule test', () => {
19
- const themingModule = getThemingModule();
20
- expect(themingModule).toMatchSnapshot();
21
- expect(themingModule[0].getConstants()).toMatchSnapshot();
19
+ const themingModule = getThemingModule();
20
+ expect(themingModule).toMatchSnapshot();
21
+ expect(themingModule[0].getConstants()).toMatchSnapshot();
22
22
  });
23
23
  it('createPartialOfficeTheme test', () => {
24
- const themingModule = getThemingModule();
25
- const partialOfficeTheme = createPartialOfficeTheme(themingModule[0]);
26
- expect(partialOfficeTheme).toMatchSnapshot;
24
+ const themingModule = getThemingModule();
25
+ const partialOfficeTheme = createPartialOfficeTheme(themingModule[0]);
26
+ expect(partialOfficeTheme).toMatchSnapshot;
27
27
  });
28
28
  it('createFontAliasTokens test', () => {
29
- const fontAliasToken = createFontAliasTokens();
30
- expect(fontAliasToken).toMatchSnapshot();
29
+ const fontAliasToken = createFontAliasTokens();
30
+ expect(fontAliasToken).toMatchSnapshot();
31
31
  });
32
32
  it('createOfficeTheme test', () => {
33
- const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
34
- expect(officeTheme).toMatchSnapshot();
33
+ const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
34
+ expect(officeTheme).toMatchSnapshot();
35
35
  });
36
36
  it.concurrent.each(officeThemes)('createBrandedThemeWithAlias test themeName: %s', async (themeName) => {
37
- setCurrentHostThemeSetting('Colorful');
38
- const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
39
- const brandedTheme = createBrandedThemeWithAlias(themeName, officeTheme);
40
- expect(brandedTheme).toMatchSnapshot();
37
+ setCurrentHostThemeSetting('Colorful');
38
+ const officeTheme = createOfficeTheme({ paletteName: 'TaskPane', appearance: 'light' }).theme;
39
+ const brandedTheme = createBrandedThemeWithAlias(themeName, officeTheme);
40
+ expect(brandedTheme).toMatchSnapshot();
41
41
  });
42
42
  it.concurrent.each(officeThemes)('createOfficeColorAliasTokens test officeTheme: %s', async (themeName) => {
43
- const colorAliasToken = createOfficeColorAliasTokens(themeName);
44
- expect(colorAliasToken).toMatchSnapshot();
43
+ const colorAliasToken = createOfficeColorAliasTokens(themeName);
44
+ expect(colorAliasToken).toMatchSnapshot();
45
45
  });
46
46
  it.concurrent.each(officeThemes)('createOfficeShadowAliasTokens test officeTheme: %s', async (themeName) => {
47
- const shadowAliasToken = createOfficeShadowAliasTokens(themeName);
48
- expect(shadowAliasToken).toMatchSnapshot();
47
+ const shadowAliasToken = createOfficeShadowAliasTokens(themeName);
48
+ expect(shadowAliasToken).toMatchSnapshot();
49
49
  });
50
50
  describe('fallbackGetPalette test', () => {
51
- it('TaskPane palette', () => {
52
- const fallbackPalette = fallbackGetPalette('TaskPane');
53
- expect(fallbackPalette).toMatchSnapshot();
54
- });
55
- it('Random palette', () => {
56
- /**
57
- * RedColors is just a random pallette, we're just testing to see what happens
58
- * if we use anything other than the TaskPane palette.
59
- * */
60
- const fallbackPalette = fallbackGetPalette('RedColors');
61
- expect(fallbackPalette).toMatchSnapshot();
62
- });
51
+ it('TaskPane palette', () => {
52
+ const fallbackPalette = fallbackGetPalette('TaskPane');
53
+ expect(fallbackPalette).toMatchSnapshot();
54
+ });
55
+ it('Random palette', () => {
56
+ /**
57
+ * RedColors is just a random pallette, we're just testing to see what happens
58
+ * if we use anything other than the TaskPane palette.
59
+ * */
60
+ const fallbackPalette = fallbackGetPalette('RedColors');
61
+ expect(fallbackPalette).toMatchSnapshot();
62
+ });
63
63
  });
64
64
  describe('getCurrentBrandAliasTokens test', () => {
65
- it.concurrent.each(appPrimaries)('themeName: White, appPrimary: %s', async (appPrimary) => {
66
- const brandAliasTokens = getCurrentBrandAliasTokens('White', appPrimary);
67
- expect(brandAliasTokens).toMatchSnapshot();
68
- });
69
- it.concurrent.each(appPrimaries)('themeName: Colorful, appPrimary: %s', async (appPrimary) => {
70
- const brandAliasTokens = getCurrentBrandAliasTokens('Colorful', appPrimary);
71
- expect(brandAliasTokens).toMatchSnapshot();
72
- });
73
- // Tests the variation of the alias tokens for when isWhiteOrColorfulTheme is not true
74
- it.concurrent.each(appPrimaries)('themeName: null, appPrimary: %s', async (appPrimary) => {
75
- const brandAliasTokens = getCurrentBrandAliasTokens(null, appPrimary);
76
- expect(brandAliasTokens).toMatchSnapshot();
77
- });
65
+ it.concurrent.each(appPrimaries)('themeName: White, appPrimary: %s', async (appPrimary) => {
66
+ const brandAliasTokens = getCurrentBrandAliasTokens('White', appPrimary);
67
+ expect(brandAliasTokens).toMatchSnapshot();
68
+ });
69
+ it.concurrent.each(appPrimaries)('themeName: Colorful, appPrimary: %s', async (appPrimary) => {
70
+ const brandAliasTokens = getCurrentBrandAliasTokens('Colorful', appPrimary);
71
+ expect(brandAliasTokens).toMatchSnapshot();
72
+ });
73
+ // Tests the variation of the alias tokens for when isWhiteOrColorfulTheme is not true
74
+ it.concurrent.each(appPrimaries)('themeName: null, appPrimary: %s', async (appPrimary) => {
75
+ const brandAliasTokens = getCurrentBrandAliasTokens(null, appPrimary);
76
+ expect(brandAliasTokens).toMatchSnapshot();
77
+ });
78
78
  });
79
- //# sourceMappingURL=win32-theme.test.js.map
79
+ //# sourceMappingURL=win32-theme.test.js.map
@@ -1,3 +1,3 @@
1
1
  import type { AliasColorTokens, OfficePalette } from '@fluentui-react-native/theme-types';
2
2
  export declare function createAliasesFromPalette(palette: OfficePalette, isHighContrast: boolean): Partial<AliasColorTokens>;
3
- //# sourceMappingURL=createAliasesFromPalette.d.ts.map
3
+ //# sourceMappingURL=createAliasesFromPalette.d.ts.map
@@ -1,58 +1,58 @@
1
1
  export function createAliasesFromPalette(palette, isHighContrast) {
2
- // Workaround for getting checkmark to have correct color in HC
3
- // while native code doesn't support PlatformColor
4
- if (isHighContrast) {
5
- return {};
6
- }
7
- return {
8
- neutralForeground1: palette.Text,
9
- neutralForeground1Hover: palette.TextHover,
10
- neutralForeground1Pressed: palette.TextPressed,
11
- neutralForeground1Selected: palette.TextSelected,
12
- neutralForeground2: palette.TextSecondary,
13
- neutralForeground2Hover: palette.TextSecondaryHover,
14
- neutralForeground2Pressed: palette.TextSecondaryPressed,
15
- neutralForeground2Selected: palette.TextSecondarySelected,
16
- neutralForeground4: palette.TextTextBoxPlaceholder,
17
- neutralForegroundDisabled: palette.TextDisabled,
18
- compoundBrandForeground1: palette.TextEmphasis,
19
- compoundBrandForeground1Hover: palette.TextEmphasisHover,
20
- compoundBrandForeground1Pressed: palette.TextEmphasisPressed,
21
- neutralForegroundOnBrand: palette.TextCtlEmphasis,
22
- neutralForegroundOnBrandHover: palette.TextCtlEmphasisHover,
23
- neutralForegroundOnBrandPressed: palette.TextCtlEmphasisPressed,
24
- neutralForegroundInvertedLink: palette.BkgToggleSwitchOff,
25
- neutralForegroundInvertedLinkHover: palette.BkgToggleSwitchOffHover,
26
- neutralForegroundInvertedLinkPressed: palette.BkgToggleSwitchOffPressed,
27
- neutralBackground1: palette.Bkg,
28
- neutralBackground1Hover: palette.BkgHover,
29
- neutralBackground1Pressed: palette.BkgPressed,
30
- neutralBackground1Selected: palette.BkgSelected,
31
- neutralBackground2: palette.BkgHeader,
32
- neutralBackground2Hover: palette.BkgSubtle,
33
- neutralBackground3: palette.BkgSubtle,
34
- neutralBackgroundInverted: palette.BkgSelectionHighlight,
35
- neutralBackgroundDisabled: palette.BkgCtlDisabled,
36
- neutralStencil1: palette.SliderBuffer,
37
- brandBackground: palette.BkgCtlEmphasis,
38
- brandBackgroundHover: palette.BkgCtlEmphasisHover,
39
- brandBackgroundPressed: palette.BkgCtlEmphasisPressed,
40
- compoundBrandBackground1: palette.BkgToggleSwitchOn,
41
- compoundBrandBackground1Hover: palette.BkgToggleSwitchOnHover,
42
- compoundBrandBackground1Pressed: palette.BkgToggleSwitchOnPressed,
43
- neutralStrokeAccessible: palette.StrokeOnlySelected,
44
- neutralStrokeAccessibleHover: palette.StrokeOnlyHover,
45
- neutralStrokeAccessiblePressed: palette.StrokeOnlyPressed,
46
- neutralStroke1: palette.StrokeCtl,
47
- neutralStroke1Hover: palette.StrokeSelectedHover,
48
- neutralStroke1Pressed: palette.StrokeOverPressed,
49
- neutralStroke2: palette.SliderBuffer,
50
- brandStroke1: palette.AccentEmphasis,
51
- compoundBrandStroke1: palette.StrokeToggleSwitchOn,
52
- compoundBrandStroke1Hover: palette.StrokeToggleSwitchOnHover,
53
- compoundBrandStroke1Pressed: palette.StrokeToggleSwitchOnPressed,
54
- neutralStrokeDisabled: palette.StrokeCtlDisabled,
55
- strokeFocus2: palette.StrokeKeyboard,
56
- };
2
+ // Workaround for getting checkmark to have correct color in HC
3
+ // while native code doesn't support PlatformColor
4
+ if (isHighContrast) {
5
+ return {};
6
+ }
7
+ return {
8
+ neutralForeground1: palette.Text,
9
+ neutralForeground1Hover: palette.TextHover,
10
+ neutralForeground1Pressed: palette.TextPressed,
11
+ neutralForeground1Selected: palette.TextSelected,
12
+ neutralForeground2: palette.TextSecondary,
13
+ neutralForeground2Hover: palette.TextSecondaryHover,
14
+ neutralForeground2Pressed: palette.TextSecondaryPressed,
15
+ neutralForeground2Selected: palette.TextSecondarySelected,
16
+ neutralForeground4: palette.TextTextBoxPlaceholder,
17
+ neutralForegroundDisabled: palette.TextDisabled,
18
+ compoundBrandForeground1: palette.TextEmphasis,
19
+ compoundBrandForeground1Hover: palette.TextEmphasisHover,
20
+ compoundBrandForeground1Pressed: palette.TextEmphasisPressed,
21
+ neutralForegroundOnBrand: palette.TextCtlEmphasis,
22
+ neutralForegroundOnBrandHover: palette.TextCtlEmphasisHover,
23
+ neutralForegroundOnBrandPressed: palette.TextCtlEmphasisPressed,
24
+ neutralForegroundInvertedLink: palette.BkgToggleSwitchOff,
25
+ neutralForegroundInvertedLinkHover: palette.BkgToggleSwitchOffHover,
26
+ neutralForegroundInvertedLinkPressed: palette.BkgToggleSwitchOffPressed,
27
+ neutralBackground1: palette.Bkg,
28
+ neutralBackground1Hover: palette.BkgHover,
29
+ neutralBackground1Pressed: palette.BkgPressed,
30
+ neutralBackground1Selected: palette.BkgSelected,
31
+ neutralBackground2: palette.BkgHeader,
32
+ neutralBackground2Hover: palette.BkgSubtle,
33
+ neutralBackground3: palette.BkgSubtle,
34
+ neutralBackgroundInverted: palette.BkgSelectionHighlight,
35
+ neutralBackgroundDisabled: palette.BkgCtlDisabled,
36
+ neutralStencil1: palette.SliderBuffer,
37
+ brandBackground: palette.BkgCtlEmphasis,
38
+ brandBackgroundHover: palette.BkgCtlEmphasisHover,
39
+ brandBackgroundPressed: palette.BkgCtlEmphasisPressed,
40
+ compoundBrandBackground1: palette.BkgToggleSwitchOn,
41
+ compoundBrandBackground1Hover: palette.BkgToggleSwitchOnHover,
42
+ compoundBrandBackground1Pressed: palette.BkgToggleSwitchOnPressed,
43
+ neutralStrokeAccessible: palette.StrokeOnlySelected,
44
+ neutralStrokeAccessibleHover: palette.StrokeOnlyHover,
45
+ neutralStrokeAccessiblePressed: palette.StrokeOnlyPressed,
46
+ neutralStroke1: palette.StrokeCtl,
47
+ neutralStroke1Hover: palette.StrokeSelectedHover,
48
+ neutralStroke1Pressed: palette.StrokeOverPressed,
49
+ neutralStroke2: palette.SliderBuffer,
50
+ brandStroke1: palette.AccentEmphasis,
51
+ compoundBrandStroke1: palette.StrokeToggleSwitchOn,
52
+ compoundBrandStroke1Hover: palette.StrokeToggleSwitchOnHover,
53
+ compoundBrandStroke1Pressed: palette.StrokeToggleSwitchOnPressed,
54
+ neutralStrokeDisabled: palette.StrokeCtlDisabled,
55
+ strokeFocus2: palette.StrokeKeyboard,
56
+ };
57
57
  }
58
- //# sourceMappingURL=createAliasesFromPalette.js.map
58
+ //# sourceMappingURL=createAliasesFromPalette.js.map
@@ -2,4 +2,4 @@ import type { ColorValue } from 'react-native';
2
2
  import type { Theme, PartialTheme, AliasColorTokens } from '@fluentui-react-native/theme-types';
3
3
  export declare function createBrandedThemeWithAlias(themeName: string, theme: Theme): PartialTheme;
4
4
  export declare function getCurrentBrandAliasTokens(themeName: string, appPrimary: ColorValue): Partial<AliasColorTokens>;
5
- //# sourceMappingURL=createBrandedThemeWithAlias.d.ts.map
5
+ //# sourceMappingURL=createBrandedThemeWithAlias.d.ts.map
@@ -1,64 +1,69 @@
1
1
  import { globalTokens } from '@fluentui-react-native/theme-tokens';
2
2
  export function createBrandedThemeWithAlias(themeName, theme) {
3
- if (themeName === 'HighContrast' || !theme.host.colors) {
4
- return {};
5
- }
6
- return {
7
- colors: getCurrentBrandAliasTokens(themeName, theme.host.colors.AppPrimary),
8
- };
3
+ if (themeName === 'HighContrast' || !theme.host.colors) {
4
+ return {};
5
+ }
6
+ return {
7
+ colors: getCurrentBrandAliasTokens(themeName, theme.host.colors.AppPrimary),
8
+ };
9
9
  }
10
10
  export function getCurrentBrandAliasTokens(themeName, appPrimary) {
11
- const appColors = getAppColors(appPrimary);
12
- const isWhiteOrColorfulTheme = themeName === 'White' || themeName === 'Colorful';
13
- return {
14
- neutralForeground2BrandHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
15
- neutralForeground2BrandPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
16
- neutralForeground2BrandSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
17
- neutralForeground3BrandHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
18
- neutralForeground3BrandPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
19
- neutralForeground3BrandSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
20
- brandForegroundLink: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
21
- brandForegroundLinkHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
22
- brandForegroundLinkPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
23
- brandForegroundLinkSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
24
- compoundBrandForeground1: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
25
- compoundBrandForeground1Hover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
26
- compoundBrandForeground1Pressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
27
- brandForeground1: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
28
- brandForeground2: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
29
- brandBackground: appColors.primary,
30
- brandBackgroundHover: appColors.shade10,
31
- brandBackgroundPressed: appColors.shade30,
32
- brandBackgroundSelected: appColors.shade20,
33
- compoundBrandBackground1: appColors.primary,
34
- compoundBrandBackground1Hover: appColors.shade10,
35
- compoundBrandBackground1Pressed: appColors.shade20,
36
- brandBackgroundStatic: appColors.primary,
37
- brandBackground2: appColors.tint40,
38
- neutralStrokeAccessibleSelected: appColors.primary,
39
- brandStroke1: appColors.primary,
40
- brandStroke2: appColors.tint40,
41
- compoundBrandStroke1: appColors.primary,
42
- compoundBrandStroke1Hover: appColors.shade10,
43
- compoundBrandStroke1Pressed: appColors.shade20,
44
- };
11
+ const appColors = getAppColors(appPrimary);
12
+ const isWhiteOrColorfulTheme = themeName === 'White' || themeName === 'Colorful';
13
+ return {
14
+ neutralForeground2BrandHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
15
+ neutralForeground2BrandPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
16
+ neutralForeground2BrandSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
17
+ neutralForeground3BrandHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
18
+ neutralForeground3BrandPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
19
+ neutralForeground3BrandSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
20
+ brandForegroundLink: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
21
+ brandForegroundLinkHover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
22
+ brandForegroundLinkPressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
23
+ brandForegroundLinkSelected: isWhiteOrColorfulTheme ? appColors.shade20 : appColors.tint40,
24
+ compoundBrandForeground1: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
25
+ compoundBrandForeground1Hover: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
26
+ compoundBrandForeground1Pressed: isWhiteOrColorfulTheme ? appColors.shade30 : appColors.tint10,
27
+ brandForeground1: isWhiteOrColorfulTheme ? appColors.primary : appColors.tint30,
28
+ brandForeground2: isWhiteOrColorfulTheme ? appColors.shade10 : appColors.tint40,
29
+ brandBackground: appColors.primary,
30
+ brandBackgroundHover: appColors.shade10,
31
+ brandBackgroundPressed: appColors.shade30,
32
+ brandBackgroundSelected: appColors.shade20,
33
+ compoundBrandBackground1: appColors.primary,
34
+ compoundBrandBackground1Hover: appColors.shade10,
35
+ compoundBrandBackground1Pressed: appColors.shade20,
36
+ brandBackgroundStatic: appColors.primary,
37
+ brandBackground2: appColors.tint40,
38
+ neutralStrokeAccessibleSelected: appColors.primary,
39
+ brandStroke1: appColors.primary,
40
+ brandStroke2: appColors.tint40,
41
+ compoundBrandStroke1: appColors.primary,
42
+ compoundBrandStroke1Hover: appColors.shade10,
43
+ compoundBrandStroke1Pressed: appColors.shade20,
44
+ };
45
45
  }
46
46
  function getAppColors(primaryColor) {
47
- if (typeof primaryColor === 'string') {
48
- if (primaryColor.toLowerCase() === '#185abd') {
49
- return globalTokens.color.word;
50
- } else if (primaryColor.toLowerCase() === '#107c41') {
51
- return globalTokens.color.excel;
52
- } else if (primaryColor.toLowerCase() === '#d83b01') {
53
- return globalTokens.color.office;
54
- } else if (primaryColor.toLowerCase() === '#80397b' || primaryColor.toLowerCase() === '#7719aa') {
55
- return globalTokens.color.oneNote;
56
- } else if (primaryColor.toLowerCase() === '#0078d4') {
57
- return globalTokens.color.outlook;
58
- } else if (primaryColor.toLowerCase() === '#c43e1c') {
59
- return globalTokens.color.powerPoint;
47
+ if (typeof primaryColor === 'string') {
48
+ if (primaryColor.toLowerCase() === '#185abd') {
49
+ return globalTokens.color.word;
50
+ }
51
+ else if (primaryColor.toLowerCase() === '#107c41') {
52
+ return globalTokens.color.excel;
53
+ }
54
+ else if (primaryColor.toLowerCase() === '#d83b01') {
55
+ return globalTokens.color.office;
56
+ }
57
+ else if (primaryColor.toLowerCase() === '#80397b' || primaryColor.toLowerCase() === '#7719aa') {
58
+ return globalTokens.color.oneNote;
59
+ }
60
+ else if (primaryColor.toLowerCase() === '#0078d4') {
61
+ return globalTokens.color.outlook;
62
+ }
63
+ else if (primaryColor.toLowerCase() === '#c43e1c') {
64
+ return globalTokens.color.powerPoint;
65
+ }
60
66
  }
61
- }
62
- return globalTokens.color.brand;
67
+ return globalTokens.color.brand;
63
68
  }
64
- //# sourceMappingURL=createBrandedThemeWithAlias.js.map
69
+ //# sourceMappingURL=createBrandedThemeWithAlias.js.map
@@ -2,4 +2,4 @@ import type { Variants } from '@fluentui-react-native/theme-types';
2
2
  declare function createFontAliasTokensWorker(): Partial<Variants>;
3
3
  export declare const createFontAliasTokens: typeof createFontAliasTokensWorker;
4
4
  export {};
5
- //# sourceMappingURL=createFontAliasTokens.d.ts.map
5
+ //# sourceMappingURL=createFontAliasTokens.d.ts.map
@@ -2,8 +2,8 @@ import { memoize } from '@fluentui-react-native/framework-base';
2
2
  import { mapFontPipelineToTheme } from '@fluentui-react-native/theming-utils';
3
3
  import { getOfficeAliasTokens } from './getOfficeTokens';
4
4
  function createFontAliasTokensWorker() {
5
- const aliasTokens = getOfficeAliasTokens('Colorful');
6
- return mapFontPipelineToTheme(aliasTokens);
5
+ const aliasTokens = getOfficeAliasTokens('Colorful');
6
+ return mapFontPipelineToTheme(aliasTokens);
7
7
  }
8
8
  export const createFontAliasTokens = memoize(createFontAliasTokensWorker);
9
- //# sourceMappingURL=createFontAliasTokens.js.map
9
+ //# sourceMappingURL=createFontAliasTokens.js.map
@@ -4,4 +4,4 @@ export declare const createOfficeColorAliasTokens: typeof createOfficeColorAlias
4
4
  declare function createOfficeShadowAliasTokensWorker(officeTheme: string): ThemeShadowDefinition;
5
5
  export declare const createOfficeShadowAliasTokens: typeof createOfficeShadowAliasTokensWorker;
6
6
  export {};
7
- //# sourceMappingURL=createOfficeAliasTokens.d.ts.map
7
+ //# sourceMappingURL=createOfficeAliasTokens.d.ts.map
@@ -2,13 +2,13 @@ import { memoize } from '@fluentui-react-native/framework-base';
2
2
  import { mapPipelineToShadow, mapPipelineToTheme } from '@fluentui-react-native/theming-utils';
3
3
  import { getOfficeAliasTokens, getOfficeShadowTokens } from './getOfficeTokens';
4
4
  function createOfficeColorAliasTokensWorker(officeTheme) {
5
- const aliasTokens = getOfficeAliasTokens(officeTheme);
6
- return mapPipelineToTheme(aliasTokens);
5
+ const aliasTokens = getOfficeAliasTokens(officeTheme);
6
+ return mapPipelineToTheme(aliasTokens);
7
7
  }
8
8
  export const createOfficeColorAliasTokens = memoize(createOfficeColorAliasTokensWorker);
9
9
  function createOfficeShadowAliasTokensWorker(officeTheme) {
10
- const aliasTokens = getOfficeShadowTokens(officeTheme);
11
- return mapPipelineToShadow(aliasTokens);
10
+ const aliasTokens = getOfficeShadowTokens(officeTheme);
11
+ return mapPipelineToShadow(aliasTokens);
12
12
  }
13
13
  export const createOfficeShadowAliasTokens = memoize(createOfficeShadowAliasTokensWorker);
14
- //# sourceMappingURL=createOfficeAliasTokens.js.map
14
+ //# sourceMappingURL=createOfficeAliasTokens.js.map
@@ -10,4 +10,4 @@ import type { ThemeOptions } from '@fluentui-react-native/theme-types';
10
10
  * @param paletteName - optional specifier for the currently active office palette
11
11
  */
12
12
  export declare function createOfficeTheme(options?: ThemeOptions): ThemeReference;
13
- //# sourceMappingURL=createOfficeTheme.d.ts.map
13
+ //# sourceMappingURL=createOfficeTheme.d.ts.map
@@ -8,8 +8,8 @@ import { win32Typography } from './getThemeTypography';
8
8
  import { getThemingModule } from './NativeModule/getThemingModule';
9
9
  import { getCurrentHostThemeSetting, setCurrentHostThemeSetting } from './NativeModule/hostThemeSetting';
10
10
  function handlePaletteCall(palette) {
11
- const exception = palette;
12
- return exception && exception.message !== undefined ? undefined : palette;
11
+ const exception = palette;
12
+ return exception && exception.message !== undefined ? undefined : palette;
13
13
  }
14
14
  /**
15
15
  * create a theme reference for an Office win32 theme. This will be based upon the standard
@@ -21,55 +21,48 @@ function handlePaletteCall(palette) {
21
21
  * @param paletteName - optional specifier for the currently active office palette
22
22
  */
23
23
  export function createOfficeTheme(options = {}) {
24
- const [module, emitter] = getThemingModule();
25
- const ref = { module, emitter, themeName: getCurrentHostThemeSetting() || '' };
26
- const { paletteName } = options;
27
- const themeRef = new ThemeReference(
28
- createDefaultTheme(options),
29
- () => {
30
- const name = paletteName || 'WhiteColors';
31
- const palette = handlePaletteCall(ref.module.getPalette(name));
32
- return createPartialOfficeTheme(module, ref.themeName, palette);
33
- },
34
- () => {
35
- if (!ref.themeName || ref.themeName === '') {
36
- return {};
37
- }
38
- return {
39
- shadows: { ...createOfficeShadowAliasTokens(ref.themeName) },
40
- typography: win32Typography(),
41
- };
42
- },
43
- () => {
44
- if (!ref.themeName || ref.themeName === '') {
45
- return {};
46
- }
47
- return {
48
- colors: { ...createOfficeColorAliasTokens(ref.themeName) },
49
- typography: win32Typography(),
50
- };
51
- },
52
- (theme) => {
53
- return createBrandedThemeWithAlias(ref.themeName, theme);
54
- },
55
- (theme) => {
56
- if (!theme.host.palette) {
57
- return {};
58
- }
59
- return {
60
- ...(paletteName !== undefined && { colors: createAliasesFromPalette(theme.host.palette, ref.themeName === 'HighContrast') }),
61
- typography: win32Typography(),
62
- };
63
- },
64
- );
65
- // set up the callback for theme changes on the native side
66
- const onPlatformDefaultsChanged = (args) => {
67
- ref.themeName = (args && args.hostThemeSetting) || ref.themeName;
68
- setCurrentHostThemeSetting(ref.themeName);
69
- themeRef.invalidate();
70
- };
71
- emitter && emitter.addListener('onPlatformDefaultsChanged', onPlatformDefaultsChanged);
72
- // now return the theme reference
73
- return themeRef;
24
+ const [module, emitter] = getThemingModule();
25
+ const ref = { module, emitter, themeName: getCurrentHostThemeSetting() || '' };
26
+ const { paletteName } = options;
27
+ const themeRef = new ThemeReference(createDefaultTheme(options), () => {
28
+ const name = paletteName || 'WhiteColors';
29
+ const palette = handlePaletteCall(ref.module.getPalette(name));
30
+ return createPartialOfficeTheme(module, ref.themeName, palette);
31
+ }, () => {
32
+ if (!ref.themeName || ref.themeName === '') {
33
+ return {};
34
+ }
35
+ return {
36
+ shadows: { ...createOfficeShadowAliasTokens(ref.themeName) },
37
+ typography: win32Typography(),
38
+ };
39
+ }, () => {
40
+ if (!ref.themeName || ref.themeName === '') {
41
+ return {};
42
+ }
43
+ return {
44
+ colors: { ...createOfficeColorAliasTokens(ref.themeName) },
45
+ typography: win32Typography(),
46
+ };
47
+ }, (theme) => {
48
+ return createBrandedThemeWithAlias(ref.themeName, theme);
49
+ }, (theme) => {
50
+ if (!theme.host.palette) {
51
+ return {};
52
+ }
53
+ return {
54
+ ...(paletteName !== undefined && { colors: createAliasesFromPalette(theme.host.palette, ref.themeName === 'HighContrast') }),
55
+ typography: win32Typography(),
56
+ };
57
+ });
58
+ // set up the callback for theme changes on the native side
59
+ const onPlatformDefaultsChanged = (args) => {
60
+ ref.themeName = (args && args.hostThemeSetting) || ref.themeName;
61
+ setCurrentHostThemeSetting(ref.themeName);
62
+ themeRef.invalidate();
63
+ };
64
+ emitter && emitter.addListener('onPlatformDefaultsChanged', onPlatformDefaultsChanged);
65
+ // now return the theme reference
66
+ return themeRef;
74
67
  }
75
- //# sourceMappingURL=createOfficeTheme.js.map
68
+ //# sourceMappingURL=createOfficeTheme.js.map
@@ -7,4 +7,4 @@ import type { OfficeThemingModule } from './NativeModule/officeThemingModule';
7
7
  * @param palette - Office palette colors, if they have been successfully retrieved
8
8
  */
9
9
  export declare function createPartialOfficeTheme(module: OfficeThemingModule, themeName?: string, palette?: OfficePalette): PartialTheme;
10
- //# sourceMappingURL=createPartialOfficeTheme.d.ts.map
10
+ //# sourceMappingURL=createPartialOfficeTheme.d.ts.map
@@ -1,13 +1,10 @@
1
1
  import { paletteFromOfficeColors } from './paletteFromOfficeColors';
2
2
  const getRamps = (module) => {
3
- return Object.keys(module.getConstants().ramps).reduce((total, colorRamp) => {
4
- return Object.assign(
5
- total,
6
- ...module.getConstants().rampNames[colorRamp].map((rampValueName, index) => {
7
- return { [rampValueName]: module.getConstants().ramps[colorRamp][index] };
8
- }),
9
- );
10
- }, {});
3
+ return Object.keys(module.getConstants().ramps).reduce((total, colorRamp) => {
4
+ return Object.assign(total, ...module.getConstants().rampNames[colorRamp].map((rampValueName, index) => {
5
+ return { [rampValueName]: module.getConstants().ramps[colorRamp][index] };
6
+ }));
7
+ }, {});
11
8
  };
12
9
  /**
13
10
  * create a partial theme with overrides from the office native module
@@ -16,18 +13,18 @@ const getRamps = (module) => {
16
13
  * @param palette - Office palette colors, if they have been successfully retrieved
17
14
  */
18
15
  export function createPartialOfficeTheme(module, themeName, palette) {
19
- return {
20
- colors: {
21
- ...(palette && paletteFromOfficeColors(palette)),
22
- },
23
- typography: module.getConstants().fluentTypography,
24
- host: {
25
- // Office Semantic Colors
26
- palette: palette || {},
27
- // Office Branding Colors
28
- colors: getRamps(module),
29
- },
30
- ...(themeName ? { name: themeName } : undefined),
31
- };
16
+ return {
17
+ colors: {
18
+ ...(palette && paletteFromOfficeColors(palette)),
19
+ },
20
+ typography: module.getConstants().fluentTypography,
21
+ host: {
22
+ // Office Semantic Colors
23
+ palette: palette || {},
24
+ // Office Branding Colors
25
+ colors: getRamps(module),
26
+ },
27
+ ...(themeName ? { name: themeName } : undefined),
28
+ };
32
29
  }
33
- //# sourceMappingURL=createPartialOfficeTheme.js.map
30
+ //# sourceMappingURL=createPartialOfficeTheme.js.map