@fluentui-react-native/apple-theme 0.20.1 → 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.
@@ -4,10 +4,25 @@ import { getIsHighContrast, setIsHighContrast } from '../appleHighContrast.macos
4
4
  import { createAppleTheme } from '../createAppleTheme';
5
5
  import { createMacOSColorAliasTokens, createMacOSShadowAliasTokens } from '../createMacOSAliasTokens';
6
6
 
7
- // For some reason the automatically mocked AccessibilityInfo object is the react-native version, not the
8
- // react-native-macos version, which doesn't contain the isHighContrastEnabled function that is accessed in
9
- // createAppleTheme. Use the actual module instead
10
- jest.dontMock('react-native-macos/Libraries/Components/AccessibilityInfo/AccessibilityInfo');
7
+ jest.mock('react-native-macos/Libraries/Components/AccessibilityInfo/AccessibilityInfo', () => ({
8
+ __esModule: true,
9
+ default: {
10
+ addEventListener: jest.fn(),
11
+ announceForAccessibility: jest.fn(),
12
+ isAccessibilityServiceEnabled: jest.fn(),
13
+ isBoldTextEnabled: jest.fn(),
14
+ isGrayscaleEnabled: jest.fn(),
15
+ isInvertColorsEnabled: jest.fn(),
16
+ isReduceMotionEnabled: jest.fn(),
17
+ prefersCrossFadeTransitions: jest.fn(),
18
+ isReduceTransparencyEnabled: jest.fn(),
19
+ isScreenReaderEnabled: jest.fn(() => Promise.resolve(false)),
20
+ setAccessibilityFocus: jest.fn(),
21
+ sendAccessibilityEvent: jest.fn(),
22
+ getRecommendedTimeoutMillis: jest.fn(),
23
+ isHighContrastEnabled: () => Promise.resolve(false),
24
+ },
25
+ }));
11
26
 
12
27
  const macOSAliasTokensTable: [AppearanceOptions, boolean][] = [
13
28
  ['light', true],
@@ -1,4 +1,6 @@
1
1
  import type { ThemeColorDefinition, AppearanceOptions } from '@fluentui-react-native/theme-types';
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
+ // @ts-ignore
2
4
  import { PlatformColor, DynamicColorMacOS, ColorWithSystemEffectMacOS } from 'react-native-macos';
3
5
 
4
6
  import type { AppleSemanticPalette, FluentUIApplePalette } from './appleColors.types.macos';
@@ -593,15 +595,5 @@ export function fallbackApplePalette(mode: AppearanceOptions): ThemeColorDefinit
593
595
 
594
596
  strokeFocus1: macOSAliasColorTokens.strokeFocus1,
595
597
  strokeFocus2: macOSAliasColorTokens.strokeFocus2,
596
-
597
- redBackground1: macOSAliasColorTokens.redBackground1,
598
- redBackground2: macOSAliasColorTokens.redBackground2,
599
- redBackground3: macOSAliasColorTokens.redBackground3,
600
- redForeground1: macOSAliasColorTokens.redForeground1,
601
- redForeground2: macOSAliasColorTokens.redForeground2,
602
- redForeground3: macOSAliasColorTokens.redForeground3,
603
- redBorderActive: macOSAliasColorTokens.redBorderActive,
604
- redBorder1: macOSAliasColorTokens.redBorder1,
605
- redBorder2: macOSAliasColorTokens.redBorder2,
606
598
  };
607
599
  }
@@ -19,6 +19,8 @@ export function createAppleTheme(): ThemeReference {
19
19
  // Fetch initial system settings for high contrast mode
20
20
  highContrastHandler();
21
21
  // Invalidate theme and set prop when high contrast setting changes
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
22
24
  AccessibilityInfo.addEventListener('highContrastChanged', () => {
23
25
  highContrastHandler();
24
26
  });
@@ -30,6 +32,8 @@ export function createAppleTheme(): ThemeReference {
30
32
  }
31
33
 
32
34
  function highContrastHandler() {
35
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
36
+ // @ts-ignore
33
37
  AccessibilityInfo.isHighContrastEnabled().then((isEnabled) => {
34
38
  setIsHighContrast(isEnabled);
35
39
  appleThemeReference.invalidate();