@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.
- package/CHANGELOG.json +109 -1
- package/CHANGELOG.md +31 -2
- package/lib/__tests__/apple-theme.test.js +19 -4
- package/lib/__tests__/apple-theme.test.js.map +1 -1
- package/lib/appleColors.macos.d.ts.map +1 -1
- package/lib/appleColors.macos.js +2 -9
- package/lib/appleColors.macos.js.map +1 -1
- package/lib/createAppleTheme.macos.d.ts.map +1 -1
- package/lib/createAppleTheme.macos.js +4 -0
- package/lib/createAppleTheme.macos.js.map +1 -1
- package/lib-commonjs/__tests__/apple-theme.test.js +19 -4
- package/lib-commonjs/__tests__/apple-theme.test.js.map +1 -1
- package/lib-commonjs/appleColors.macos.d.ts.map +1 -1
- package/lib-commonjs/appleColors.macos.js +2 -9
- package/lib-commonjs/appleColors.macos.js.map +1 -1
- package/lib-commonjs/createAppleTheme.macos.d.ts.map +1 -1
- package/lib-commonjs/createAppleTheme.macos.js +4 -0
- package/lib-commonjs/createAppleTheme.macos.js.map +1 -1
- package/package.json +18 -19
- package/src/__tests__/__snapshots__/apple-theme.test.ts.snap +2009 -1862
- package/src/__tests__/apple-theme.test.ts +19 -4
- package/src/appleColors.macos.ts +2 -10
- package/src/createAppleTheme.macos.ts +4 -0
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
jest.
|
|
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],
|
package/src/appleColors.macos.ts
CHANGED
|
@@ -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();
|