@fluentui-react-native/tester 0.69.5 → 0.70.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 +58 -1
- package/CHANGELOG.md +28 -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/Notification/NotificationTest.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.js +12 -4
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.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/Notification/NotificationTest.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.js +12 -4
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.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 +3 -3
- 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/Notification/NotificationTest.tsx +28 -4
- 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,12 +1,13 @@
|
|
|
1
1
|
import React, { useState, useCallback, FunctionComponent } from 'react';
|
|
2
2
|
import { AvatarSize, AvatarSizes, AvatarColor, AvatarColors, Avatar, AvatarActive } from '@fluentui-react-native/avatar';
|
|
3
3
|
import { PresenceBadgeStatuses, PresenceBadgeStatus } from '@fluentui-react-native/badge';
|
|
4
|
-
import { Switch, View, Text,
|
|
4
|
+
import { Switch, View, Text, ColorValue, Platform } from 'react-native';
|
|
5
5
|
import { satyaPhotoUrl, undefinedText } from './../PersonaCoin/styles';
|
|
6
6
|
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
7
7
|
import { useTheme } from '@fluentui-react-native/theme-types';
|
|
8
8
|
import TestSvg from '../../test-data/test.svg';
|
|
9
9
|
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
10
|
+
import { StyledPicker } from '../Common/StyledPicker';
|
|
10
11
|
|
|
11
12
|
type WithUndefined<T> = T | typeof undefinedText;
|
|
12
13
|
|
|
@@ -16,19 +17,6 @@ const avatarColors: AvatarColor[] = ['neutral', 'brand', 'colorful', ...AvatarCo
|
|
|
16
17
|
const allSizes: WithUndefined<AvatarSize>[] = [undefinedText, ...AvatarSizes];
|
|
17
18
|
const allPresences: WithUndefined<PresenceBadgeStatus>[] = [undefinedText, ...PresenceBadgeStatuses];
|
|
18
19
|
|
|
19
|
-
const StyledPicker = (props) => {
|
|
20
|
-
const { prompt, selected, onChange, collection } = props;
|
|
21
|
-
const theme = useTheme();
|
|
22
|
-
const pickerStyles = { color: theme.colors.inputText as ColorValue, ...commonStyles.header };
|
|
23
|
-
return (
|
|
24
|
-
<Picker prompt={prompt} style={pickerStyles} selectedValue={selected} onValueChange={onChange}>
|
|
25
|
-
{collection.map((value, index) => (
|
|
26
|
-
<Picker.Item label={value} key={index} value={value} />
|
|
27
|
-
))}
|
|
28
|
-
</Picker>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
20
|
export const StandardUsage: FunctionComponent = () => {
|
|
33
21
|
const [isSquare, setSquare] = useState(false);
|
|
34
22
|
const [showImage, setShowImage] = useState(true);
|
|
@@ -64,7 +52,7 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
64
52
|
|
|
65
53
|
return (
|
|
66
54
|
<View style={commonStyles.root}>
|
|
67
|
-
<View style={commonStyles.
|
|
55
|
+
<View style={commonStyles.settingsPicker}>
|
|
68
56
|
<View style={commonStyles.switch}>
|
|
69
57
|
<Text style={textStyles}>Show image</Text>
|
|
70
58
|
<Switch value={showImage} onValueChange={setShowImage} />
|
|
@@ -84,58 +72,60 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
84
72
|
<StyledPicker prompt="Avatar Color" selected={avatarColor} onChange={onAvatarColorChange} collection={avatarColors} />
|
|
85
73
|
<StyledPicker prompt="Presence status" selected={presence} onChange={onPresenceChange} collection={allPresences} />
|
|
86
74
|
</View>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
75
|
+
<View style={commonStyles.pickerControlled}>
|
|
76
|
+
<Avatar
|
|
77
|
+
accessibilityLabel="Fall-back Icon"
|
|
78
|
+
accessibilityHint="A picture representing a user"
|
|
79
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
80
|
+
/>
|
|
81
|
+
<Avatar
|
|
82
|
+
active={active}
|
|
83
|
+
activeAppearance={activeAppearance}
|
|
84
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
85
|
+
name="Satya Nadella"
|
|
86
|
+
shape={isSquare ? 'square' : 'circular'}
|
|
87
|
+
accessibilityLabel="Photo of Satya Nadella"
|
|
88
|
+
badge={{ status: presence === undefinedText ? undefined : presence, outOfOffice }}
|
|
89
|
+
imageUrl={showImage ? satyaPhotoUrl : undefined}
|
|
90
|
+
avatarColor={avatarColor}
|
|
91
|
+
/>
|
|
92
|
+
<Avatar
|
|
93
|
+
active={active}
|
|
94
|
+
activeAppearance={activeAppearance}
|
|
95
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
96
|
+
shape={isSquare ? 'square' : 'circular'}
|
|
97
|
+
accessibilityLabel="Icon"
|
|
98
|
+
name="* Richard Faynman *"
|
|
99
|
+
avatarColor="#ff0099"
|
|
100
|
+
initialsColor="yellow"
|
|
101
|
+
/>
|
|
102
|
+
{svgIconsEnabled && (
|
|
103
|
+
<>
|
|
104
|
+
<Avatar
|
|
105
|
+
active={active}
|
|
106
|
+
activeAppearance={activeAppearance}
|
|
107
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
108
|
+
shape={isSquare ? 'square' : 'circular'}
|
|
109
|
+
accessibilityLabel="SVG Icon"
|
|
110
|
+
icon={{ fontSource: { ...fontBuiltInProps, fontSize: 32 }, color: 'red' }}
|
|
111
|
+
avatarColor={avatarColor}
|
|
112
|
+
badge={{ status: 'outOfOffice', outOfOffice }}
|
|
113
|
+
/>
|
|
114
|
+
<Avatar
|
|
115
|
+
accessibilityHint="A picture representing a user"
|
|
116
|
+
active={active}
|
|
117
|
+
activeAppearance={activeAppearance}
|
|
118
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
119
|
+
shape={isSquare ? 'square' : 'circular'}
|
|
120
|
+
accessibilityLabel="SVG Icon"
|
|
121
|
+
icon={{ svgSource: svgProps }}
|
|
122
|
+
avatarColor={avatarColor}
|
|
123
|
+
badge={{ status: 'away', outOfOffice }}
|
|
124
|
+
idForColor="15"
|
|
125
|
+
/>
|
|
126
|
+
</>
|
|
127
|
+
)}
|
|
128
|
+
</View>
|
|
139
129
|
</View>
|
|
140
130
|
);
|
|
141
131
|
};
|
|
@@ -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
|
},
|
|
@@ -4,7 +4,13 @@ import { Test, TestSection, PlatformStatus } from '../Test';
|
|
|
4
4
|
|
|
5
5
|
const PrimaryTest: React.FunctionComponent = () => {
|
|
6
6
|
return (
|
|
7
|
-
<Notification
|
|
7
|
+
<Notification
|
|
8
|
+
variant={'primary'}
|
|
9
|
+
action="Undo"
|
|
10
|
+
onPress={() => {
|
|
11
|
+
console.log('Notification tapped');
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
8
14
|
Mail Archived
|
|
9
15
|
</Notification>
|
|
10
16
|
);
|
|
@@ -12,7 +18,13 @@ const PrimaryTest: React.FunctionComponent = () => {
|
|
|
12
18
|
|
|
13
19
|
const NeutralTest: React.FunctionComponent = () => {
|
|
14
20
|
return (
|
|
15
|
-
<Notification
|
|
21
|
+
<Notification
|
|
22
|
+
variant={'neutral'}
|
|
23
|
+
action="Sign in"
|
|
24
|
+
onPress={() => {
|
|
25
|
+
console.log('Notification tapped');
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
16
28
|
Some items require you to sign in to view them
|
|
17
29
|
</Notification>
|
|
18
30
|
);
|
|
@@ -20,7 +32,13 @@ const NeutralTest: React.FunctionComponent = () => {
|
|
|
20
32
|
|
|
21
33
|
const DangerTest: React.FunctionComponent = () => {
|
|
22
34
|
return (
|
|
23
|
-
<Notification
|
|
35
|
+
<Notification
|
|
36
|
+
variant={'danger'}
|
|
37
|
+
action="Retry"
|
|
38
|
+
onPress={() => {
|
|
39
|
+
console.log('Notification tapped');
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
24
42
|
There was a problem, and your recent changes may not have saved
|
|
25
43
|
</Notification>
|
|
26
44
|
);
|
|
@@ -28,7 +46,13 @@ const DangerTest: React.FunctionComponent = () => {
|
|
|
28
46
|
|
|
29
47
|
const WarningTest: React.FunctionComponent = () => {
|
|
30
48
|
return (
|
|
31
|
-
<Notification
|
|
49
|
+
<Notification
|
|
50
|
+
variant={'warning'}
|
|
51
|
+
action="X"
|
|
52
|
+
onPress={() => {
|
|
53
|
+
console.log('Notification tapped');
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
32
56
|
Read Only
|
|
33
57
|
</Notification>
|
|
34
58
|
);
|
|
@@ -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 (
|