@fluentui-react-native/tester 0.76.0 → 0.77.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 +78 -1
- package/CHANGELOG.md +23 -2
- package/lib/FluentTester/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Badge/BadgeTest.js +10 -13
- package/lib/FluentTester/TestComponents/Badge/BadgeTest.js.map +1 -1
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.js +15 -3
- package/lib/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -1
- package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts +7 -4
- package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +1 -8
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js +11 -2
- package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.js +7 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +1 -7
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js +1 -1
- package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -1
- package/lib/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Common/StyledPicker.js +7 -1
- package/lib/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -1
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.js +7 -1
- package/lib/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.d.ts.map +1 -1
- package/lib/FluentTester/theme/ThemePickers.js +6 -9
- package/lib/FluentTester/theme/ThemePickers.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.js +9 -12
- package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js +15 -3
- package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts +7 -4
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +1 -8
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js +11 -2
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js +7 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +1 -7
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js +7 -1
- package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js +7 -1
- package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/theme/ThemePickers.js +6 -9
- package/lib-commonjs/FluentTester/theme/ThemePickers.js.map +1 -1
- package/package.json +10 -10
- package/src/FluentTester/TestComponents/Badge/BadgeTest.tsx +10 -13
- package/src/FluentTester/TestComponents/Callout/CalloutTest.tsx +15 -3
- package/src/FluentTester/TestComponents/Common/AlignmentPicker.tsx +7 -2
- package/src/FluentTester/TestComponents/Common/MenuPicker.desktop.tsx +13 -12
- package/src/FluentTester/TestComponents/Common/MenuPicker.tsx +19 -7
- package/src/FluentTester/TestComponents/Common/MenuPicker.windows.tsx +3 -10
- package/src/FluentTester/TestComponents/Common/StyledPicker.tsx +7 -1
- package/src/FluentTester/TestComponents/Persona/StandardUsage.tsx +8 -1
- package/src/FluentTester/theme/ThemePickers.tsx +7 -9
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { BADGE_TESTPAGE } from './consts';
|
|
4
4
|
import { Test, TestSection, PlatformStatus } from '../Test';
|
|
5
5
|
import { View, Platform, Text } from 'react-native';
|
|
6
|
-
import { Badge,
|
|
6
|
+
import { Badge, PresenceBadge } from '@fluentui-react-native/badge';
|
|
7
7
|
import BadgeSvg from './oof.svg';
|
|
8
8
|
|
|
9
9
|
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
@@ -38,18 +38,18 @@ export const BasicBadge: React.FunctionComponent = () => {
|
|
|
38
38
|
<View>
|
|
39
39
|
<Badge />
|
|
40
40
|
<Text>Appearance</Text>
|
|
41
|
-
<Badge appearance="outline"
|
|
41
|
+
<Badge appearance="outline">Outline badge</Badge>
|
|
42
42
|
<Text>Shape</Text>
|
|
43
|
-
<Badge shape="circular"
|
|
44
|
-
<Badge shape="rounded"
|
|
45
|
-
<Badge shape="square"
|
|
43
|
+
<Badge shape="circular">Circular badge</Badge>
|
|
44
|
+
<Badge shape="rounded">Rounded badge</Badge>
|
|
45
|
+
<Badge shape="square">Square badge</Badge>
|
|
46
46
|
<Text>Size</Text>
|
|
47
47
|
<Badge size="smallest" shape="circular" />
|
|
48
48
|
<Badge size="smaller" shape="circular" />
|
|
49
|
-
<Badge size="small"
|
|
50
|
-
<Badge size="medium"
|
|
51
|
-
<Badge size="large"
|
|
52
|
-
<Badge size="largest"
|
|
49
|
+
<Badge size="small">Small</Badge>
|
|
50
|
+
<Badge size="medium">Medium</Badge>
|
|
51
|
+
<Badge size="large">Large</Badge>
|
|
52
|
+
<Badge size="largest">Largest</Badge>
|
|
53
53
|
{svgIconsEnabled && (
|
|
54
54
|
<>
|
|
55
55
|
<Text>Badge with icon</Text>
|
|
@@ -61,10 +61,7 @@ export const BasicBadge: React.FunctionComponent = () => {
|
|
|
61
61
|
<BadgeNoBorder appearance="outline" icon={iconProps} />
|
|
62
62
|
</>
|
|
63
63
|
)}
|
|
64
|
-
<StyledBadge appearance="outline"
|
|
65
|
-
<Text>Compressible badge</Text>
|
|
66
|
-
<CompressibleBadge />
|
|
67
|
-
<CompressibleBadge text="Basic compressible" />
|
|
64
|
+
<StyledBadge appearance="outline">Styled badge</StyledBadge>
|
|
68
65
|
{svgIconsEnabled && (
|
|
69
66
|
<>
|
|
70
67
|
<Text>Presence Badge</Text>
|
|
@@ -173,12 +173,24 @@ const StandardCallout: React.FunctionComponent = () => {
|
|
|
173
173
|
|
|
174
174
|
const colorDefault: string = 'default';
|
|
175
175
|
const colorSelections: string[] = [colorDefault, 'red', 'green', 'blue'];
|
|
176
|
+
const menuPickerColorCollection = colorSelections.map((color) => {
|
|
177
|
+
return {
|
|
178
|
+
label: color,
|
|
179
|
+
value: color,
|
|
180
|
+
};
|
|
181
|
+
});
|
|
176
182
|
|
|
177
183
|
const [selectedBackgroundColor, setSelectedBackgroundColor] = React.useState<string | undefined>(undefined);
|
|
178
184
|
const [selectedBorderColor, setSelectedBorderColor] = React.useState<string | undefined>(undefined);
|
|
179
185
|
|
|
180
186
|
const borderWidthDefault: string = '1';
|
|
181
187
|
const borderWidthSelections: string[] = ['1', '2', '4', '10'];
|
|
188
|
+
const menuPickerBorderWidthCollection = borderWidthSelections.map((width) => {
|
|
189
|
+
return {
|
|
190
|
+
label: width,
|
|
191
|
+
value: width,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
182
194
|
|
|
183
195
|
const [selectedBorderWidth, setSelectedBorderWidth] = React.useState<string | undefined>(undefined);
|
|
184
196
|
|
|
@@ -238,19 +250,19 @@ const StandardCallout: React.FunctionComponent = () => {
|
|
|
238
250
|
prompt="Background Color"
|
|
239
251
|
selected={selectedBackgroundColor || colorDefault}
|
|
240
252
|
onChange={(color) => setSelectedBackgroundColor(color === colorDefault ? undefined : color)}
|
|
241
|
-
collection={
|
|
253
|
+
collection={menuPickerColorCollection}
|
|
242
254
|
/>
|
|
243
255
|
<MenuPicker
|
|
244
256
|
prompt="Border Color"
|
|
245
257
|
selected={selectedBorderColor || colorDefault}
|
|
246
258
|
onChange={(color) => setSelectedBorderColor(color === colorDefault ? undefined : color)}
|
|
247
|
-
collection={
|
|
259
|
+
collection={menuPickerColorCollection}
|
|
248
260
|
/>
|
|
249
261
|
<MenuPicker
|
|
250
262
|
prompt="Border Width"
|
|
251
263
|
selected={selectedBorderWidth || borderWidthDefault}
|
|
252
264
|
onChange={(color) => setSelectedBorderWidth(color === colorDefault ? undefined : color)}
|
|
253
|
-
collection={
|
|
265
|
+
collection={menuPickerBorderWidthCollection}
|
|
254
266
|
/>
|
|
255
267
|
</View>
|
|
256
268
|
|
|
@@ -15,7 +15,12 @@ interface IAlignmentPickerProps {
|
|
|
15
15
|
export const AlignmentPicker: React.FunctionComponent<IAlignmentPickerProps> = (props: IAlignmentPickerProps) => {
|
|
16
16
|
const { label, onSelectionChange, style } = props;
|
|
17
17
|
const [selectedValue, setSelectedValue] = React.useState<IconAlignment>();
|
|
18
|
-
|
|
18
|
+
const alignmentCollection = alignmentValues.map((value) => {
|
|
19
|
+
return {
|
|
20
|
+
label: value,
|
|
21
|
+
value: value,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
19
24
|
return (
|
|
20
25
|
<MenuPicker
|
|
21
26
|
style={style}
|
|
@@ -26,7 +31,7 @@ export const AlignmentPicker: React.FunctionComponent<IAlignmentPickerProps> = (
|
|
|
26
31
|
onSelectionChange(alignmentValue);
|
|
27
32
|
setSelectedValue(alignmentValue);
|
|
28
33
|
}}
|
|
29
|
-
collection={
|
|
34
|
+
collection={alignmentCollection}
|
|
30
35
|
/>
|
|
31
36
|
);
|
|
32
37
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Text, View, StyleSheet } from 'react-native';
|
|
3
3
|
import { Menu, MenuItem, MenuTrigger, MenuPopover, MenuList } from '@fluentui-react-native/menu';
|
|
4
|
+
import { MenuPickerProps, collectionItem } from './MenuPicker';
|
|
4
5
|
import { ButtonV1 as Button } from '@fluentui/react-native';
|
|
5
6
|
import { SvgXml } from 'react-native-svg';
|
|
6
7
|
|
|
@@ -9,23 +10,23 @@ const chevronXml = `
|
|
|
9
10
|
<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
11
|
</svg>`;
|
|
11
12
|
|
|
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
13
|
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
21
14
|
const { prompt, selected, onChange, collection } = props;
|
|
15
|
+
|
|
16
|
+
let label;
|
|
17
|
+
collection.forEach((item) => {
|
|
18
|
+
if (item.value == selected) {
|
|
19
|
+
label = item.label;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
24
|
<View style={menuPickerStyles.container}>
|
|
24
25
|
<Text style={menuPickerStyles.prompt}>{prompt}</Text>
|
|
25
26
|
<Menu>
|
|
26
27
|
<MenuTrigger>
|
|
27
28
|
<Button>
|
|
28
|
-
<Text>{
|
|
29
|
+
<Text>{label}</Text>
|
|
29
30
|
<View style={menuPickerStyles.chevronContainer}>
|
|
30
31
|
<SvgXml xml={chevronXml} />
|
|
31
32
|
</View>
|
|
@@ -33,9 +34,9 @@ export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: Menu
|
|
|
33
34
|
</MenuTrigger>
|
|
34
35
|
<MenuPopover>
|
|
35
36
|
<MenuList>
|
|
36
|
-
{collection.map((
|
|
37
|
-
<MenuItem onClick={() => onChange(value, index)} key={index}>
|
|
38
|
-
{
|
|
37
|
+
{collection.map((collectionItem: collectionItem, index: number) => (
|
|
38
|
+
<MenuItem onClick={() => onChange(collectionItem.value, index)} key={collectionItem.value ?? index}>
|
|
39
|
+
{collectionItem.label}
|
|
39
40
|
</MenuItem>
|
|
40
41
|
))}
|
|
41
42
|
</MenuList>
|
|
@@ -6,26 +6,38 @@ import { Picker } from '@react-native-picker/picker';
|
|
|
6
6
|
* MenuPicker uses the community Picker package for iOS/Win32 and our own Picker for Win32/MacOS.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
interface
|
|
9
|
+
export interface collectionItem {
|
|
10
|
+
label: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface MenuPickerProps {
|
|
10
15
|
prompt?: string;
|
|
11
|
-
selected?:
|
|
16
|
+
selected?: string;
|
|
12
17
|
onChange?: (value: any, index?: number) => void;
|
|
13
|
-
collection?:
|
|
18
|
+
collection?: collectionItem[];
|
|
14
19
|
style?: any;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
18
23
|
const { prompt, selected, onChange, collection, style } = props;
|
|
24
|
+
let selectedItemKey;
|
|
25
|
+
|
|
26
|
+
collection.forEach((item) => {
|
|
27
|
+
if (item.value == selected) {
|
|
28
|
+
selectedItemKey = item.value;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
19
31
|
|
|
20
32
|
return (
|
|
21
33
|
<Picker
|
|
22
34
|
prompt={prompt}
|
|
23
|
-
selectedValue={
|
|
24
|
-
onValueChange={(
|
|
35
|
+
selectedValue={selectedItemKey}
|
|
36
|
+
onValueChange={(value: string, index: number) => onChange(value, index)}
|
|
25
37
|
style={{ ...style }}
|
|
26
38
|
>
|
|
27
|
-
{collection.map((
|
|
28
|
-
<Picker.Item label={
|
|
39
|
+
{collection.map((item, index) => (
|
|
40
|
+
<Picker.Item label={item.label} key={index} value={item.value} />
|
|
29
41
|
))}
|
|
30
42
|
</Picker>
|
|
31
43
|
);
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
export * from './MenuPicker.desktop';
|
|
2
2
|
import * as React from 'react';
|
|
3
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
|
-
}
|
|
4
|
+
import { MenuPickerProps, collectionItem } from './MenuPicker';
|
|
12
5
|
|
|
13
6
|
export const MenuPicker: React.FunctionComponent<MenuPickerProps> = (props: MenuPickerProps) => {
|
|
14
7
|
const { prompt, onChange, collection } = props;
|
|
15
8
|
return (
|
|
16
9
|
<View style={menuPickerStyles.container}>
|
|
17
10
|
<Text style={menuPickerStyles.prompt}>{prompt}</Text>
|
|
18
|
-
{collection.map((
|
|
19
|
-
<Button onPress={() => onChange(value, index)} key={index} title={
|
|
11
|
+
{collection.map((item: collectionItem, index: number) => (
|
|
12
|
+
<Button onPress={() => onChange(item.value, index)} key={index} title={item.label} />
|
|
20
13
|
))}
|
|
21
14
|
</View>
|
|
22
15
|
);
|
|
@@ -8,5 +8,11 @@ export const StyledPicker = (props) => {
|
|
|
8
8
|
const { prompt, selected, onChange, collection } = props;
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const pickerStyles = { color: theme.colors.inputText as ColorValue, ...commonStyles.header };
|
|
11
|
-
|
|
11
|
+
const styleCollection = collection.map((value) => {
|
|
12
|
+
return {
|
|
13
|
+
label: value,
|
|
14
|
+
value: value,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
return <MenuPicker prompt={prompt} style={pickerStyles} selected={selected} onChange={onChange} collection={styleCollection} />;
|
|
12
18
|
};
|
|
@@ -21,6 +21,13 @@ const allSizes: WithUndefined<PersonaSize>[] = [
|
|
|
21
21
|
'size120',
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
+
const allSizesCollection = allSizes.map((size) => {
|
|
25
|
+
return {
|
|
26
|
+
label: size,
|
|
27
|
+
value: size,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
|
|
24
31
|
interface ISwitchWithLabelProps {
|
|
25
32
|
label: string;
|
|
26
33
|
value: boolean;
|
|
@@ -59,7 +66,7 @@ export const StandardUsage: React.FunctionComponent = () => {
|
|
|
59
66
|
style={commonStyles.header}
|
|
60
67
|
selected={imageSize || undefinedText}
|
|
61
68
|
onChange={(size: PersonaSize | typeof undefinedText) => setImageSize(size === undefinedText ? undefined : size)}
|
|
62
|
-
collection={
|
|
69
|
+
collection={allSizesCollection}
|
|
63
70
|
/>
|
|
64
71
|
</View>
|
|
65
72
|
|
|
@@ -35,18 +35,16 @@ type PartPickerProps = {
|
|
|
35
35
|
|
|
36
36
|
export const PartPicker: React.FunctionComponent<PartPickerProps> = (props: PartPickerProps) => {
|
|
37
37
|
const { initial, contents, onChange } = props;
|
|
38
|
-
const [
|
|
38
|
+
const [selected, setSelected] = React.useState(initial);
|
|
39
39
|
const onValueChange = React.useCallback(
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
onChange(
|
|
40
|
+
(value: string) => {
|
|
41
|
+
setSelected(value);
|
|
42
|
+
onChange(value);
|
|
43
43
|
},
|
|
44
|
-
[
|
|
44
|
+
[setSelected, onChange],
|
|
45
45
|
);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
return <MenuPicker selected={value} style={themePickerStyles.dropdown} onChange={onValueChange} collection={MenuPickerCollection} />;
|
|
46
|
+
|
|
47
|
+
return <MenuPicker selected={selected} style={themePickerStyles.dropdown} onChange={onValueChange} collection={contents} />;
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
const PickerLabel = Text.customize({ variant: 'bodySemibold' });
|