@fluentui-react-native/tester 0.134.23 → 0.134.25
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 +325 -1
- package/CHANGELOG.md +67 -2
- package/lib/fluent-tester/src/FluentTesterApp.d.ts.map +1 -1
- package/lib/fluent-tester/src/FluentTesterApp.js +29 -2
- package/lib/fluent-tester/src/FluentTesterApp.js.map +1 -1
- package/lib/fluent-tester/src/TestComponents/Menu/MenuIcons.d.ts +3 -0
- package/lib/fluent-tester/src/TestComponents/Menu/MenuIcons.d.ts.map +1 -0
- package/lib/fluent-tester/src/TestComponents/Menu/MenuIcons.js +27 -0
- package/lib/fluent-tester/src/TestComponents/Menu/MenuIcons.js.map +1 -0
- package/lib/fluent-tester/src/TestComponents/Menu/MenuTest.d.ts.map +1 -1
- package/lib/fluent-tester/src/TestComponents/Menu/MenuTest.js +5 -0
- package/lib/fluent-tester/src/TestComponents/Menu/MenuTest.js.map +1 -1
- package/lib/fluent-tester/src/TestComponents/Theme/ThemeTest.android.d.ts +3 -0
- package/lib/fluent-tester/src/TestComponents/Theme/ThemeTest.android.d.ts.map +1 -0
- package/lib/fluent-tester/src/TestComponents/Theme/ThemeTest.android.js +100 -0
- package/lib/fluent-tester/src/TestComponents/Theme/ThemeTest.android.js.map +1 -0
- package/lib-commonjs/fluent-tester/src/FluentTesterApp.d.ts.map +1 -1
- package/lib-commonjs/fluent-tester/src/FluentTesterApp.js +28 -1
- package/lib-commonjs/fluent-tester/src/FluentTesterApp.js.map +1 -1
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuIcons.d.ts +3 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuIcons.d.ts.map +1 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuIcons.js +31 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuIcons.js.map +1 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuTest.d.ts.map +1 -1
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuTest.js +5 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Menu/MenuTest.js.map +1 -1
- package/lib-commonjs/fluent-tester/src/TestComponents/Theme/ThemeTest.android.d.ts +3 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Theme/ThemeTest.android.d.ts.map +1 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Theme/ThemeTest.android.js +104 -0
- package/lib-commonjs/fluent-tester/src/TestComponents/Theme/ThemeTest.android.js.map +1 -0
- package/package.json +38 -38
- package/src/FluentTesterApp.tsx +37 -2
- package/src/TestComponents/Menu/MenuIcons.tsx +40 -0
- package/src/TestComponents/Menu/MenuTest.tsx +5 -0
- package/src/TestComponents/Theme/ThemeTest.android.tsx +141 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ColorValue, ViewStyle } from 'react-native';
|
|
3
|
+
import { Text as TextRN, View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { Text } from '@fluentui/react-native';
|
|
7
|
+
import { useFluentTheme } from '@fluentui-react-native/framework';
|
|
8
|
+
import type { Theme } from '@fluentui-react-native/theme-types';
|
|
9
|
+
import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
|
|
10
|
+
|
|
11
|
+
import { THEME_TESTPAGE } from '../../../../E2E/src/Theme/consts';
|
|
12
|
+
import { commonTestStyles } from '../Common/styles';
|
|
13
|
+
import type { TestSection, PlatformStatus } from '../Test';
|
|
14
|
+
import { Test } from '../Test';
|
|
15
|
+
|
|
16
|
+
const getThemedStyles = themedStyleSheet((theme: Theme) => {
|
|
17
|
+
return {
|
|
18
|
+
swatch: {
|
|
19
|
+
color: theme.colors.neutralForeground1,
|
|
20
|
+
},
|
|
21
|
+
rootView: {
|
|
22
|
+
backgroundColor: theme.colors.brandBackground,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
swatchItem: {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
marginVertical: 5,
|
|
32
|
+
},
|
|
33
|
+
panel: {
|
|
34
|
+
...commonTestStyles.view,
|
|
35
|
+
borderWidth: 2,
|
|
36
|
+
padding: 12,
|
|
37
|
+
margin: 8,
|
|
38
|
+
},
|
|
39
|
+
pickerContainer: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
justifyContent: 'space-evenly',
|
|
42
|
+
},
|
|
43
|
+
stackStyle: {
|
|
44
|
+
borderWidth: 2,
|
|
45
|
+
padding: 12,
|
|
46
|
+
margin: 8,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const Panel: React.FunctionComponent = () => {
|
|
51
|
+
const theme = useFluentTheme();
|
|
52
|
+
const themedStyles = getThemedStyles(theme);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View>
|
|
56
|
+
<Text style={{ color: theme.colors.buttonBackgroundChecked }}>buttonBackgroundChecked styled text</Text>
|
|
57
|
+
|
|
58
|
+
<Text style={{ color: theme.colors.neutralForeground1 }}>neutralForeground1 styled text</Text>
|
|
59
|
+
|
|
60
|
+
<Text style={{ color: theme.colors.hostColorPink }}>hostColorPink styled text</Text>
|
|
61
|
+
|
|
62
|
+
<Text style={{ color: theme.colors.hostColorButtonBackground }}>hostColorButtonBackground styled text</Text>
|
|
63
|
+
|
|
64
|
+
<Text style={{ color: theme.colors.hostColorBrandText }}>hostColorBrandText styled text</Text>
|
|
65
|
+
|
|
66
|
+
<TextRN style={{ color: theme.colors.yellowBrandColor }}>yellowBrandColor styled text</TextRN>
|
|
67
|
+
|
|
68
|
+
<TextRN style={themedStyles.swatch}>Styled RN Text</TextRN>
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const getSwatchColorStyle = (name: string, color: ColorValue): ViewStyle => {
|
|
74
|
+
styles[name] = styles[name] || { backgroundColor: color };
|
|
75
|
+
return styles[name];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type SemanticColorProps = { color: ColorValue; name: string };
|
|
79
|
+
const SemanticColor: React.FunctionComponent<SemanticColorProps> = (p: SemanticColorProps) => {
|
|
80
|
+
const themedStyles = getThemedStyles(useFluentTheme());
|
|
81
|
+
return (
|
|
82
|
+
<View style={styles.swatchItem}>
|
|
83
|
+
<View style={[getSwatchColorStyle(p.name, p.color), themedStyles.swatch]} />
|
|
84
|
+
<Text>{p.name}</Text>
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const SwatchList: React.FunctionComponent = () => {
|
|
90
|
+
const theme = useFluentTheme();
|
|
91
|
+
const palette = theme.colors;
|
|
92
|
+
|
|
93
|
+
const aggregator = React.useCallback(
|
|
94
|
+
(key: string) => {
|
|
95
|
+
return { key: key + ' (' + (palette[key] as string) + ')', color: palette[key] };
|
|
96
|
+
},
|
|
97
|
+
[palette],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const flattenArray = React.useCallback(() => {
|
|
101
|
+
return Object.keys(palette).sort().map(aggregator);
|
|
102
|
+
}, [palette, aggregator]);
|
|
103
|
+
|
|
104
|
+
const paletteAsArray = React.useMemo(flattenArray, [flattenArray]);
|
|
105
|
+
const renderSwatch = React.useCallback((item) => {
|
|
106
|
+
const { color, key } = item;
|
|
107
|
+
return <SemanticColor key={key} color={color} name={key} />;
|
|
108
|
+
}, []);
|
|
109
|
+
return (
|
|
110
|
+
<View style={commonTestStyles.view}>
|
|
111
|
+
<Text>getColorsAndroid(theme: ITheme).palette</Text>
|
|
112
|
+
<View style={styles.stackStyle}>{paletteAsArray.map((item) => renderSwatch(item))}</View>
|
|
113
|
+
</View>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
const themeSections: TestSection[] = [
|
|
117
|
+
{
|
|
118
|
+
name: 'Component Examples',
|
|
119
|
+
testID: THEME_TESTPAGE,
|
|
120
|
+
component: Panel,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'Theme.colors',
|
|
124
|
+
component: () => <SwatchList />,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
export const ThemeTest: React.FunctionComponent = () => {
|
|
129
|
+
const status: PlatformStatus = {
|
|
130
|
+
win32Status: 'Beta',
|
|
131
|
+
uwpStatus: 'Experimental',
|
|
132
|
+
iosStatus: 'Experimental',
|
|
133
|
+
macosStatus: 'Experimental',
|
|
134
|
+
androidStatus: 'Beta',
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const description =
|
|
138
|
+
'The entire color palette of the controls is themeable. We provide a set of sensible defaults, but you can override all colors individually.';
|
|
139
|
+
|
|
140
|
+
return <Test name="Theme Test" description={description} sections={themeSections} status={status} />;
|
|
141
|
+
};
|