@fluentui-react-native/tester 0.69.5 → 0.69.6
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 +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js +10 -14
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.js +5 -4
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.d.ts +1 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -2
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts +11 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +11 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js +33 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.js +8 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts +2 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.js +2 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts +2 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.js +2 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +11 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js +24 -0
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/StyledPicker.d.ts +3 -0
- package/lib/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Common/StyledPicker.js +12 -0
- package/lib/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -0
- package/lib/FluentTester/TestComponents/Common/styles.d.ts +8 -0
- package/lib/FluentTester/TestComponents/Common/styles.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/styles.js +8 -0
- package/lib/FluentTester/TestComponents/Common/styles.js.map +1 -1
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.js +3 -2
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
- package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.js +5 -10
- package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.js.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.android.js.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.d.ts.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.js +6 -2
- package/lib/FluentTester/theme/ThemePickers.js.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.macos.d.ts.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.macos.js +28 -2
- package/lib/FluentTester/theme/ThemePickers.macos.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js +13 -17
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js +4 -3
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.d.ts +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -2
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts +11 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +11 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js +38 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js +12 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts +2 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.js +5 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts +2 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.js +5 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +11 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js +29 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.d.ts +3 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js +16 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/styles.d.ts +8 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/styles.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/styles.js +8 -0
- package/lib-commonjs/FluentTester/TestComponents/Common/styles.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js +2 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.js +7 -11
- package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.js.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.android.js.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.js +5 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.js.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.macos.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.macos.js +27 -2
- package/lib-commonjs/FluentTester/theme/ThemePickers.macos.js.map +1 -1
- package/package.json +2 -2
- package/src/FluentTester/TestComponents/Avatar/BasicAvatar.tsx +57 -67
- package/src/FluentTester/TestComponents/Callout/CalloutTest.tsx +17 -27
- package/src/FluentTester/TestComponents/Common/AlignmentPicker.tsx +14 -10
- package/src/FluentTester/TestComponents/Common/MenuPicker.desktop.tsx +60 -0
- package/src/FluentTester/TestComponents/Common/MenuPicker.macos.tsx +1 -0
- package/src/FluentTester/TestComponents/Common/MenuPicker.tsx +32 -0
- package/src/FluentTester/TestComponents/Common/MenuPicker.win32.tsx +1 -0
- package/src/FluentTester/TestComponents/Common/MenuPicker.windows.tsx +38 -0
- package/src/FluentTester/TestComponents/Common/StyledPicker.tsx +12 -0
- package/src/FluentTester/TestComponents/Common/styles.ts +8 -0
- package/src/FluentTester/TestComponents/Persona/StandardUsage.tsx +7 -10
- package/src/FluentTester/TestComponents/PersonaCoin/StandardUsage.tsx +13 -24
- package/src/FluentTester/theme/ThemePickers.android.tsx +5 -5
- package/src/FluentTester/theme/ThemePickers.macos.tsx +46 -8
- package/src/FluentTester/theme/ThemePickers.tsx +6 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ScreenRect, Text, View, Switch,
|
|
2
|
+
import { ScreenRect, Text, View, Switch, ScrollView } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
Callout,
|
|
@@ -14,6 +14,7 @@ import { CALLOUT_TESTPAGE } from './consts';
|
|
|
14
14
|
import { Test, TestSection, PlatformStatus } from '../Test';
|
|
15
15
|
import { E2ECalloutTest } from './CalloutE2ETest';
|
|
16
16
|
import { fluentTesterStyles } from '../Common/styles';
|
|
17
|
+
import { MenuPicker } from '../Common/MenuPicker';
|
|
17
18
|
|
|
18
19
|
const StandardCallout: React.FunctionComponent = () => {
|
|
19
20
|
const [showStandardCallout, setShowStandardCallout] = React.useState(false);
|
|
@@ -233,35 +234,24 @@ const StandardCallout: React.FunctionComponent = () => {
|
|
|
233
234
|
<Text>Enable ScrollView Callout</Text>
|
|
234
235
|
</View>
|
|
235
236
|
|
|
236
|
-
<
|
|
237
|
+
<MenuPicker
|
|
237
238
|
prompt="Background Color"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
))}
|
|
244
|
-
</Picker>
|
|
245
|
-
|
|
246
|
-
<Picker
|
|
239
|
+
selected={selectedBackgroundColor || colorDefault}
|
|
240
|
+
onChange={(color) => setSelectedBackgroundColor(color === colorDefault ? undefined : color)}
|
|
241
|
+
collection={colorSelections}
|
|
242
|
+
/>
|
|
243
|
+
<MenuPicker
|
|
247
244
|
prompt="Border Color"
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
))}
|
|
254
|
-
</Picker>
|
|
255
|
-
|
|
256
|
-
<Picker
|
|
245
|
+
selected={selectedBorderColor || colorDefault}
|
|
246
|
+
onChange={(color) => setSelectedBorderColor(color === colorDefault ? undefined : color)}
|
|
247
|
+
collection={colorSelections}
|
|
248
|
+
/>
|
|
249
|
+
<MenuPicker
|
|
257
250
|
prompt="Border Width"
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<Picker.Item label={width} key={index} value={width} />
|
|
263
|
-
))}
|
|
264
|
-
</Picker>
|
|
251
|
+
selected={selectedBorderWidth || borderWidthDefault}
|
|
252
|
+
onChange={(color) => setSelectedBorderWidth(color === colorDefault ? undefined : color)}
|
|
253
|
+
collection={borderWidthSelections}
|
|
254
|
+
/>
|
|
265
255
|
</View>
|
|
266
256
|
|
|
267
257
|
<Separator vertical />
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { undefinedText } from '../PersonaCoin/styles';
|
|
3
3
|
import { IconAlignment } from '@fluentui/react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
5
|
+
import { MenuPicker } from './MenuPicker';
|
|
5
6
|
|
|
6
7
|
const alignmentValues: Array<typeof undefinedText | IconAlignment> = [undefinedText, 'start', 'center', 'end'];
|
|
7
8
|
|
|
8
9
|
interface IAlignmentPickerProps {
|
|
9
10
|
style?: StyleProp<ViewStyle>;
|
|
10
11
|
label: string;
|
|
11
|
-
onSelectionChange: (value: IconAlignment
|
|
12
|
+
onSelectionChange: (value: IconAlignment) => void;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const AlignmentPicker: React.FunctionComponent<IAlignmentPickerProps> = (props: IAlignmentPickerProps) => {
|
|
15
16
|
const { label, onSelectionChange, style } = props;
|
|
17
|
+
const [selectedValue, setSelectedValue] = React.useState<IconAlignment>();
|
|
18
|
+
|
|
16
19
|
return (
|
|
17
|
-
<
|
|
20
|
+
<MenuPicker
|
|
18
21
|
style={style}
|
|
19
22
|
prompt={label}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
selected={selectedValue || undefinedText}
|
|
24
|
+
onChange={(value: IconAlignment, index: number) => {
|
|
25
|
+
const alignmentValue = index == 0 ? undefined : value;
|
|
26
|
+
onSelectionChange(alignmentValue);
|
|
27
|
+
setSelectedValue(alignmentValue);
|
|
28
|
+
}}
|
|
29
|
+
collection={alignmentValues}
|
|
30
|
+
/>
|
|
27
31
|
);
|
|
28
32
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Text, View, StyleSheet } from 'react-native';
|
|
3
|
+
import { Menu, MenuItem, MenuTrigger, MenuPopover, MenuList } from '@fluentui-react-native/menu';
|
|
4
|
+
import { ButtonV1 as Button } from '@fluentui/react-native';
|
|
5
|
+
import { SvgXml } from 'react-native-svg';
|
|
6
|
+
|
|
7
|
+
const chevronXml = `
|
|
8
|
+
<svg width="12" height="16" viewBox="0 0 11 6" color="#000">
|
|
9
|
+
<path fill='currentColor' d='M0.646447 0.646447C0.841709 0.451184 1.15829 0.451184 1.35355 0.646447L5.5 4.79289L9.64645 0.646447C9.84171 0.451185 10.1583 0.451185 10.3536 0.646447C10.5488 0.841709 10.5488 1.15829 10.3536 1.35355L5.85355 5.85355C5.65829 6.04882 5.34171 6.04882 5.14645 5.85355L0.646447 1.35355C0.451184 1.15829 0.451184 0.841709 0.646447 0.646447Z' />
|
|
10
|
+
</svg>`;
|
|
11
|
+
|
|
12
|
+
interface MenuPickerProps {
|
|
13
|
+
prompt?: string;
|
|
14
|
+
selected?: any;
|
|
15
|
+
onChange?: (value: any, index?: number) => void;
|
|
16
|
+
collection?: any[];
|
|
17
|
+
style?: any;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
21
|
+
const { prompt, selected, onChange, collection } = props;
|
|
22
|
+
return (
|
|
23
|
+
<View style={menuPickerStyles.container}>
|
|
24
|
+
<Text style={menuPickerStyles.prompt}>{prompt}</Text>
|
|
25
|
+
<Menu>
|
|
26
|
+
<MenuTrigger>
|
|
27
|
+
<Button>
|
|
28
|
+
<Text>{selected}</Text>
|
|
29
|
+
<View style={menuPickerStyles.chevronContainer}>
|
|
30
|
+
<SvgXml xml={chevronXml} />
|
|
31
|
+
</View>
|
|
32
|
+
</Button>
|
|
33
|
+
</MenuTrigger>
|
|
34
|
+
<MenuPopover>
|
|
35
|
+
<MenuList>
|
|
36
|
+
{collection.map((value, index) => (
|
|
37
|
+
<MenuItem onClick={() => onChange(value, index)} key={index}>
|
|
38
|
+
{value}
|
|
39
|
+
</MenuItem>
|
|
40
|
+
))}
|
|
41
|
+
</MenuList>
|
|
42
|
+
</MenuPopover>
|
|
43
|
+
</Menu>
|
|
44
|
+
</View>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const menuPickerStyles = StyleSheet.create({
|
|
49
|
+
container: {
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
margin: 5,
|
|
53
|
+
},
|
|
54
|
+
prompt: {
|
|
55
|
+
marginRight: 5,
|
|
56
|
+
},
|
|
57
|
+
chevronContainer: {
|
|
58
|
+
padding: 4,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MenuPicker.desktop';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Picker } from '@react-native-picker/picker';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* The MenuPicker was created because the RN Core Picker was deprecated (preventing us from updating to RN 0.66).
|
|
6
|
+
* MenuPicker uses the community Picker package for iOS/Win32 and our own Picker for Win32/MacOS.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface MenuPickerProps {
|
|
10
|
+
prompt?: string;
|
|
11
|
+
selected?: any;
|
|
12
|
+
onChange?: (value: any, index?: number) => void;
|
|
13
|
+
collection?: any[];
|
|
14
|
+
style?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
18
|
+
const { prompt, selected, onChange, collection, style } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Picker
|
|
22
|
+
prompt={prompt}
|
|
23
|
+
selectedValue={selected}
|
|
24
|
+
onValueChange={(itemValue: any, index: number) => onChange(itemValue, index)}
|
|
25
|
+
style={{ ...style }}
|
|
26
|
+
>
|
|
27
|
+
{collection.map((value, index) => (
|
|
28
|
+
<Picker.Item label={value} key={index} value={value} />
|
|
29
|
+
))}
|
|
30
|
+
</Picker>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MenuPicker.desktop';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export * from './MenuPicker.desktop';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button, Text, View, StyleSheet } from 'react-native';
|
|
4
|
+
|
|
5
|
+
interface MenuPickerProps {
|
|
6
|
+
prompt?: string;
|
|
7
|
+
selected?: any;
|
|
8
|
+
onChange?: (value: any, index?: number) => void;
|
|
9
|
+
collection?: any[];
|
|
10
|
+
style?: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
14
|
+
const { prompt, onChange, collection } = props;
|
|
15
|
+
return (
|
|
16
|
+
<View style={menuPickerStyles.container}>
|
|
17
|
+
<Text style={menuPickerStyles.prompt}>{prompt}</Text>
|
|
18
|
+
{collection.map((value, index) => (
|
|
19
|
+
<Button onPress={() => onChange(value, index)} key={index} title={value} />
|
|
20
|
+
))}
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const menuPickerStyles = StyleSheet.create({
|
|
26
|
+
container: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
flexWrap: 'wrap',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
margin: 5,
|
|
31
|
+
},
|
|
32
|
+
prompt: {
|
|
33
|
+
marginRight: 5,
|
|
34
|
+
},
|
|
35
|
+
chevronContainer: {
|
|
36
|
+
padding: 4,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MenuPicker } from './MenuPicker';
|
|
3
|
+
import { ColorValue } from 'react-native';
|
|
4
|
+
import { useTheme } from '@fluentui-react-native/theme-types';
|
|
5
|
+
import { commonTestStyles as commonStyles } from './styles';
|
|
6
|
+
|
|
7
|
+
export const StyledPicker = (props) => {
|
|
8
|
+
const { prompt, selected, onChange, collection } = props;
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const pickerStyles = { color: theme.colors.inputText as ColorValue, ...commonStyles.header };
|
|
11
|
+
return <MenuPicker prompt={prompt} style={pickerStyles} selected={selected} onChange={onChange} collection={collection} />;
|
|
12
|
+
};
|
|
@@ -26,6 +26,14 @@ export const commonTestStyles = StyleSheet.create({
|
|
|
26
26
|
settings: {
|
|
27
27
|
flexGrow: 1,
|
|
28
28
|
},
|
|
29
|
+
settingsPicker: {
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
flex: 1,
|
|
32
|
+
},
|
|
33
|
+
pickerControlled: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
},
|
|
29
37
|
vmargin: {
|
|
30
38
|
marginVertical: 6,
|
|
31
39
|
},
|
|
@@ -2,8 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { Persona, PersonaSize } from '@fluentui/react-native';
|
|
3
3
|
import { rajeshImageUrl } from './styles';
|
|
4
4
|
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
5
|
-
import { View, Text, Switch
|
|
5
|
+
import { View, Text, Switch } from 'react-native';
|
|
6
6
|
import { undefinedText } from '../PersonaCoin/styles';
|
|
7
|
+
import { MenuPicker } from '../Common/MenuPicker';
|
|
7
8
|
|
|
8
9
|
type WithUndefined<T> = T | typeof undefinedText;
|
|
9
10
|
|
|
@@ -53,17 +54,13 @@ export const StandardUsage: React.FunctionComponent = () => {
|
|
|
53
54
|
<SwitchWithLabel label="Show secondary text" value={showSecondary} onValueChange={setShowSecondary} />
|
|
54
55
|
<SwitchWithLabel label="Show tertiary text" value={showTertiary} onValueChange={setShowTertiary} />
|
|
55
56
|
<SwitchWithLabel label="Show optional text" value={showOptional} onValueChange={setShowOptional} />
|
|
56
|
-
|
|
57
|
-
<Picker
|
|
57
|
+
<MenuPicker
|
|
58
58
|
prompt="Size"
|
|
59
59
|
style={commonStyles.header}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<Picker.Item label={size} key={index} value={size} />
|
|
65
|
-
))}
|
|
66
|
-
</Picker>
|
|
60
|
+
selected={imageSize || undefinedText}
|
|
61
|
+
onChange={(size: PersonaSize | typeof undefinedText) => setImageSize(size === undefinedText ? undefined : size)}
|
|
62
|
+
collection={allSizes}
|
|
63
|
+
/>
|
|
67
64
|
</View>
|
|
68
65
|
|
|
69
66
|
<Persona
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PersonaSize, PersonaCoinFluentColor, PersonaCoin, PersonaPresence } from '@fluentui/react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { StyledPicker } from '../Common/StyledPicker';
|
|
4
|
+
import { Switch, View, Text, ColorValue } from 'react-native';
|
|
4
5
|
import { satyaPhotoUrl, undefinedText } from './styles';
|
|
5
6
|
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
6
7
|
import { useTheme } from '@fluentui-react-native/theme-types';
|
|
@@ -46,19 +47,6 @@ const allColors: WithUndefined<PersonaCoinFluentColor>[] = [
|
|
|
46
47
|
|
|
47
48
|
const allPresences: WithUndefined<PersonaPresence>[] = [undefinedText, 'none', 'online', 'offline', 'busy', 'dnd', 'blocked', 'away'];
|
|
48
49
|
|
|
49
|
-
const StyledPicker = (props) => {
|
|
50
|
-
const { prompt, selected, onChange, collection } = props;
|
|
51
|
-
const theme = useTheme();
|
|
52
|
-
const pickerStyles = { color: theme.colors.inputText as ColorValue, ...commonStyles.header };
|
|
53
|
-
return (
|
|
54
|
-
<Picker prompt={prompt} style={pickerStyles} selectedValue={selected} onValueChange={onChange}>
|
|
55
|
-
{collection.map((value, index) => (
|
|
56
|
-
<Picker.Item label={value} key={index} value={value} />
|
|
57
|
-
))}
|
|
58
|
-
</Picker>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
50
|
export const StandardUsage: React.FunctionComponent = () => {
|
|
63
51
|
const [showImage, setShowImage] = React.useState(true);
|
|
64
52
|
const [imageSize, setImageSize] = React.useState<WithUndefined<PersonaSize>>('size72');
|
|
@@ -75,26 +63,27 @@ export const StandardUsage: React.FunctionComponent = () => {
|
|
|
75
63
|
return (
|
|
76
64
|
<View style={commonStyles.root}>
|
|
77
65
|
{/* settings */}
|
|
78
|
-
<View style={commonStyles.
|
|
66
|
+
<View style={commonStyles.settingsPicker}>
|
|
79
67
|
<View style={commonStyles.switch}>
|
|
80
68
|
<Text style={textStyles}>Show image</Text>
|
|
81
69
|
<Switch value={showImage} onValueChange={setShowImage} />
|
|
82
70
|
</View>
|
|
83
|
-
|
|
84
71
|
<StyledPicker prompt="Size" selected={imageSize} onChange={onSizeChange} collection={allSizes} />
|
|
85
72
|
<StyledPicker prompt="Coin color" selected={coinColor} onChange={onColorChange} collection={allColors} />
|
|
86
73
|
<StyledPicker prompt="Presence status" selected={presence} onChange={onPresenceChange} collection={allPresences} />
|
|
87
74
|
</View>
|
|
88
75
|
|
|
89
76
|
{/* component under test */}
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
<View style={commonStyles.pickerControlled}>
|
|
78
|
+
<PersonaCoin
|
|
79
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
80
|
+
initials="SN"
|
|
81
|
+
imageDescription="Photo of Satya Nadella"
|
|
82
|
+
presence={presence === undefinedText ? undefined : presence}
|
|
83
|
+
imageUrl={showImage ? satyaPhotoUrl : undefined}
|
|
84
|
+
coinColorFluent={coinColor === undefinedText ? undefined : coinColor}
|
|
85
|
+
/>
|
|
86
|
+
</View>
|
|
98
87
|
</View>
|
|
99
88
|
);
|
|
100
89
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { Text } from '@fluentui-react-native/experimental-text';
|
|
4
4
|
import { lightnessOptions, testerTheme } from './CustomThemes';
|
|
5
5
|
import { themeChoices, ThemeNames } from './applyTheme';
|
|
6
6
|
import { brandOptions, OfficeBrand } from './applyBrand';
|
|
7
7
|
import { Theme, useTheme } from '@fluentui-react-native/framework';
|
|
8
8
|
import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
|
|
9
|
-
import { Picker } from '@react-native-picker/picker';
|
|
9
|
+
import { Picker, PickerProps } from '@react-native-picker/picker';
|
|
10
10
|
|
|
11
11
|
const getThemedDropdownStyles = themedStyleSheet((t: Theme) => {
|
|
12
12
|
return {
|
|
@@ -52,13 +52,13 @@ export const ThemePickers: React.FunctionComponent = () => {
|
|
|
52
52
|
|
|
53
53
|
type DropdownEntry = { label: string; value: string };
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
type DropdownProps = { initial: string; onValueChange: (value: string) => void; options: DropdownEntry[] };
|
|
56
|
+
|
|
57
|
+
const dropdownProps: Omit<PickerProps, 'onValueChange' | 'selectedValue'> = {
|
|
56
58
|
style: themedPickerStyles.dropdown,
|
|
57
59
|
mode: 'dropdown',
|
|
58
60
|
};
|
|
59
61
|
|
|
60
|
-
type DropdownProps = { initial: string; onValueChange: (value: string) => void; options: DropdownEntry[] };
|
|
61
|
-
|
|
62
62
|
const Dropdown = (props: DropdownProps) => {
|
|
63
63
|
const { initial, onValueChange, options } = props;
|
|
64
64
|
return (
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { Text } from '@fluentui-react-native/experimental-text';
|
|
4
|
-
import {
|
|
4
|
+
import { SvgXml } from 'react-native-svg';
|
|
5
|
+
import { Menu, MenuItem, MenuTrigger, MenuPopover, MenuList } from '@fluentui-react-native/menu';
|
|
6
|
+
import { ButtonV1 as Button } from '@fluentui/react-native';
|
|
5
7
|
import { testerTheme } from './CustomThemes';
|
|
6
8
|
import { themeChoices, ThemeNames } from './applyTheme';
|
|
7
9
|
import { brandOptions, OfficeBrand } from './applyBrand';
|
|
@@ -24,6 +26,17 @@ export const themePickerStyles = StyleSheet.create({
|
|
|
24
26
|
},
|
|
25
27
|
});
|
|
26
28
|
|
|
29
|
+
const themeMenuPickerStyles = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
margin: 5,
|
|
34
|
+
},
|
|
35
|
+
svg: {
|
|
36
|
+
padding: 4,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
27
40
|
type PartPickerEntry = { label: string; value: string };
|
|
28
41
|
|
|
29
42
|
type PartPickerProps = {
|
|
@@ -32,6 +45,37 @@ type PartPickerProps = {
|
|
|
32
45
|
onChange: (value: string) => void;
|
|
33
46
|
};
|
|
34
47
|
|
|
48
|
+
const ThemeMenuPicker = ({ selected, onChange, collection, style }) => {
|
|
49
|
+
const chevronXml = `
|
|
50
|
+
<svg width="12" height="16" viewBox="0 0 11 6" color="#000">
|
|
51
|
+
<path fill='currentColor' d='M0.646447 0.646447C0.841709 0.451184 1.15829 0.451184 1.35355 0.646447L5.5 4.79289L9.64645 0.646447C9.84171 0.451185 10.1583 0.451185 10.3536 0.646447C10.5488 0.841709 10.5488 1.15829 10.3536 1.35355L5.85355 5.85355C5.65829 6.04882 5.34171 6.04882 5.14645 5.85355L0.646447 1.35355C0.451184 1.15829 0.451184 0.841709 0.646447 0.646447Z' />
|
|
52
|
+
</svg>`;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View style={{ ...themeMenuPickerStyles.container, ...style }}>
|
|
56
|
+
<Menu>
|
|
57
|
+
<MenuTrigger>
|
|
58
|
+
<Button>
|
|
59
|
+
<Text>{selected}</Text>
|
|
60
|
+
<View style={themeMenuPickerStyles.svg}>
|
|
61
|
+
<SvgXml xml={chevronXml} />
|
|
62
|
+
</View>
|
|
63
|
+
</Button>
|
|
64
|
+
</MenuTrigger>
|
|
65
|
+
<MenuPopover>
|
|
66
|
+
<MenuList>
|
|
67
|
+
{collection.map((entry: PartPickerEntry, index: number) => (
|
|
68
|
+
<MenuItem onClick={() => onChange(entry.value)} key={`entry${index}`}>
|
|
69
|
+
{entry.label}
|
|
70
|
+
</MenuItem>
|
|
71
|
+
))}
|
|
72
|
+
</MenuList>
|
|
73
|
+
</MenuPopover>
|
|
74
|
+
</Menu>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
35
79
|
export const PartPicker: React.FunctionComponent<PartPickerProps> = (props: PartPickerProps) => {
|
|
36
80
|
const { initial, contents, onChange } = props;
|
|
37
81
|
const [value, setValue] = React.useState(initial);
|
|
@@ -42,13 +86,7 @@ export const PartPicker: React.FunctionComponent<PartPickerProps> = (props: Part
|
|
|
42
86
|
},
|
|
43
87
|
[setValue, onChange],
|
|
44
88
|
);
|
|
45
|
-
return
|
|
46
|
-
<Picker selectedValue={value} style={themePickerStyles.dropdown} onValueChange={onValueChange}>
|
|
47
|
-
{contents.map((entry: PartPickerEntry, index: number) => (
|
|
48
|
-
<Picker.Item label={entry.label} value={entry.value} key={`entry${index}`} />
|
|
49
|
-
))}
|
|
50
|
-
</Picker>
|
|
51
|
-
);
|
|
89
|
+
return <ThemeMenuPicker selected={value} style={themePickerStyles.dropdown} onChange={onValueChange} collection={contents} />;
|
|
52
90
|
};
|
|
53
91
|
|
|
54
92
|
const PickerLabel = Text.customize({ variant: 'bodySemibold' });
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { Text } from '@fluentui-react-native/experimental-text';
|
|
4
4
|
import { lightnessOptions, testerTheme } from './CustomThemes';
|
|
5
5
|
import { themeChoices, ThemeNames } from './applyTheme';
|
|
6
6
|
import { brandOptions, OfficeBrand } from './applyBrand';
|
|
7
7
|
import { ThemeOptions } from '@fluentui-react-native/theme-types';
|
|
8
|
+
import { MenuPicker } from '../TestComponents/Common/MenuPicker';
|
|
8
9
|
|
|
9
10
|
export const themePickerStyles = StyleSheet.create({
|
|
10
11
|
pickerRoot: {
|
|
@@ -42,13 +43,10 @@ export const PartPicker: React.FunctionComponent<PartPickerProps> = (props: Part
|
|
|
42
43
|
},
|
|
43
44
|
[setValue, onChange],
|
|
44
45
|
);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
))}
|
|
50
|
-
</Picker>
|
|
51
|
-
);
|
|
46
|
+
const MenuPickerCollection = contents.map((entry: PartPickerEntry) => {
|
|
47
|
+
return entry.label;
|
|
48
|
+
});
|
|
49
|
+
return <MenuPicker selected={value} style={themePickerStyles.dropdown} onChange={onValueChange} collection={MenuPickerCollection} />;
|
|
52
50
|
};
|
|
53
51
|
|
|
54
52
|
const PickerLabel = Text.customize({ variant: 'bodySemibold' });
|