@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.
Files changed (127) hide show
  1. package/CHANGELOG.json +58 -1
  2. package/CHANGELOG.md +28 -2
  3. package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
  4. package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js +10 -14
  5. package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
  6. package/lib/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
  7. package/lib/FluentTester/TestComponents/Callout/CalloutTest.js +5 -4
  8. package/lib/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
  9. package/lib/FluentTester/TestComponents/Common/AlignmentPicker.d.ts +1 -1
  10. package/lib/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
  11. package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -2
  12. package/lib/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
  13. package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts +11 -0
  14. package/lib/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -0
  15. package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +11 -0
  16. package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -0
  17. package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js +33 -0
  18. package/lib/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -0
  19. package/lib/FluentTester/TestComponents/Common/MenuPicker.js +8 -0
  20. package/lib/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -0
  21. package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts +2 -0
  22. package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts.map +1 -0
  23. package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.js +2 -0
  24. package/lib/FluentTester/TestComponents/Common/MenuPicker.macos.js.map +1 -0
  25. package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts +2 -0
  26. package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts.map +1 -0
  27. package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.js +2 -0
  28. package/lib/FluentTester/TestComponents/Common/MenuPicker.win32.js.map +1 -0
  29. package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +11 -0
  30. package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -0
  31. package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js +24 -0
  32. package/lib/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -0
  33. package/lib/FluentTester/TestComponents/Common/StyledPicker.d.ts +3 -0
  34. package/lib/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -0
  35. package/lib/FluentTester/TestComponents/Common/StyledPicker.js +12 -0
  36. package/lib/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -0
  37. package/lib/FluentTester/TestComponents/Common/styles.d.ts +8 -0
  38. package/lib/FluentTester/TestComponents/Common/styles.d.ts.map +1 -1
  39. package/lib/FluentTester/TestComponents/Common/styles.js +8 -0
  40. package/lib/FluentTester/TestComponents/Common/styles.js.map +1 -1
  41. package/lib/FluentTester/TestComponents/Notification/NotificationTest.d.ts.map +1 -1
  42. package/lib/FluentTester/TestComponents/Notification/NotificationTest.js +12 -4
  43. package/lib/FluentTester/TestComponents/Notification/NotificationTest.js.map +1 -1
  44. package/lib/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
  45. package/lib/FluentTester/TestComponents/Persona/StandardUsage.js +3 -2
  46. package/lib/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
  47. package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.d.ts.map +1 -1
  48. package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.js +5 -10
  49. package/lib/FluentTester/TestComponents/PersonaCoin/StandardUsage.js.map +1 -1
  50. package/lib/FluentTester/theme/ThemePickers.android.js.map +1 -1
  51. package/lib/FluentTester/theme/ThemePickers.d.ts.map +1 -1
  52. package/lib/FluentTester/theme/ThemePickers.js +6 -2
  53. package/lib/FluentTester/theme/ThemePickers.js.map +1 -1
  54. package/lib/FluentTester/theme/ThemePickers.macos.d.ts.map +1 -1
  55. package/lib/FluentTester/theme/ThemePickers.macos.js +28 -2
  56. package/lib/FluentTester/theme/ThemePickers.macos.js.map +1 -1
  57. package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
  58. package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js +13 -17
  59. package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
  60. package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.d.ts.map +1 -1
  61. package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js +4 -3
  62. package/lib-commonjs/FluentTester/TestComponents/Callout/CalloutTest.js.map +1 -1
  63. package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.d.ts +1 -1
  64. package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.d.ts.map +1 -1
  65. package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js +7 -2
  66. package/lib-commonjs/FluentTester/TestComponents/Common/AlignmentPicker.js.map +1 -1
  67. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts +11 -0
  68. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.d.ts.map +1 -0
  69. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts +11 -0
  70. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.d.ts.map +1 -0
  71. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js +38 -0
  72. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.desktop.js.map +1 -0
  73. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js +12 -0
  74. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.js.map +1 -0
  75. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts +2 -0
  76. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.d.ts.map +1 -0
  77. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.js +5 -0
  78. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.macos.js.map +1 -0
  79. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts +2 -0
  80. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.d.ts.map +1 -0
  81. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.js +5 -0
  82. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.win32.js.map +1 -0
  83. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts +11 -0
  84. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.d.ts.map +1 -0
  85. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js +29 -0
  86. package/lib-commonjs/FluentTester/TestComponents/Common/MenuPicker.windows.js.map +1 -0
  87. package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.d.ts +3 -0
  88. package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.d.ts.map +1 -0
  89. package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js +16 -0
  90. package/lib-commonjs/FluentTester/TestComponents/Common/StyledPicker.js.map +1 -0
  91. package/lib-commonjs/FluentTester/TestComponents/Common/styles.d.ts +8 -0
  92. package/lib-commonjs/FluentTester/TestComponents/Common/styles.d.ts.map +1 -1
  93. package/lib-commonjs/FluentTester/TestComponents/Common/styles.js +8 -0
  94. package/lib-commonjs/FluentTester/TestComponents/Common/styles.js.map +1 -1
  95. package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.d.ts.map +1 -1
  96. package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.js +12 -4
  97. package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.js.map +1 -1
  98. package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.d.ts.map +1 -1
  99. package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js +2 -1
  100. package/lib-commonjs/FluentTester/TestComponents/Persona/StandardUsage.js.map +1 -1
  101. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.d.ts.map +1 -1
  102. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.js +7 -11
  103. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/StandardUsage.js.map +1 -1
  104. package/lib-commonjs/FluentTester/theme/ThemePickers.android.js.map +1 -1
  105. package/lib-commonjs/FluentTester/theme/ThemePickers.d.ts.map +1 -1
  106. package/lib-commonjs/FluentTester/theme/ThemePickers.js +5 -1
  107. package/lib-commonjs/FluentTester/theme/ThemePickers.js.map +1 -1
  108. package/lib-commonjs/FluentTester/theme/ThemePickers.macos.d.ts.map +1 -1
  109. package/lib-commonjs/FluentTester/theme/ThemePickers.macos.js +27 -2
  110. package/lib-commonjs/FluentTester/theme/ThemePickers.macos.js.map +1 -1
  111. package/package.json +3 -3
  112. package/src/FluentTester/TestComponents/Avatar/BasicAvatar.tsx +57 -67
  113. package/src/FluentTester/TestComponents/Callout/CalloutTest.tsx +17 -27
  114. package/src/FluentTester/TestComponents/Common/AlignmentPicker.tsx +14 -10
  115. package/src/FluentTester/TestComponents/Common/MenuPicker.desktop.tsx +60 -0
  116. package/src/FluentTester/TestComponents/Common/MenuPicker.macos.tsx +1 -0
  117. package/src/FluentTester/TestComponents/Common/MenuPicker.tsx +32 -0
  118. package/src/FluentTester/TestComponents/Common/MenuPicker.win32.tsx +1 -0
  119. package/src/FluentTester/TestComponents/Common/MenuPicker.windows.tsx +38 -0
  120. package/src/FluentTester/TestComponents/Common/StyledPicker.tsx +12 -0
  121. package/src/FluentTester/TestComponents/Common/styles.ts +8 -0
  122. package/src/FluentTester/TestComponents/Notification/NotificationTest.tsx +28 -4
  123. package/src/FluentTester/TestComponents/Persona/StandardUsage.tsx +7 -10
  124. package/src/FluentTester/TestComponents/PersonaCoin/StandardUsage.tsx +13 -24
  125. package/src/FluentTester/theme/ThemePickers.android.tsx +5 -5
  126. package/src/FluentTester/theme/ThemePickers.macos.tsx +46 -8
  127. 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, Picker, ColorValue, Platform } from 'react-native';
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.settings}>
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
- <Avatar
88
- accessibilityLabel="Fall-back Icon"
89
- accessibilityHint="A picture representing a user"
90
- size={imageSize === undefinedText ? undefined : imageSize}
91
- />
92
- <Avatar
93
- active={active}
94
- activeAppearance={activeAppearance}
95
- size={imageSize === undefinedText ? undefined : imageSize}
96
- name="Satya Nadella"
97
- shape={isSquare ? 'square' : 'circular'}
98
- accessibilityLabel="Photo of Satya Nadella"
99
- badge={{ status: presence === undefinedText ? undefined : presence, outOfOffice }}
100
- imageUrl={showImage ? satyaPhotoUrl : undefined}
101
- avatarColor={avatarColor}
102
- />
103
- <Avatar
104
- active={active}
105
- activeAppearance={activeAppearance}
106
- size={imageSize === undefinedText ? undefined : imageSize}
107
- shape={isSquare ? 'square' : 'circular'}
108
- accessibilityLabel="Icon"
109
- name="* Richard Faynman *"
110
- avatarColor="#ff0099"
111
- initialsColor="yellow"
112
- />
113
- {svgIconsEnabled && (
114
- <>
115
- <Avatar
116
- active={active}
117
- activeAppearance={activeAppearance}
118
- size={imageSize === undefinedText ? undefined : imageSize}
119
- shape={isSquare ? 'square' : 'circular'}
120
- accessibilityLabel="SVG Icon"
121
- icon={{ fontSource: { ...fontBuiltInProps, fontSize: 32 }, color: 'red' }}
122
- avatarColor={avatarColor}
123
- badge={{ status: 'outOfOffice', outOfOffice }}
124
- />
125
- <Avatar
126
- accessibilityHint="A picture representing a user"
127
- active={active}
128
- activeAppearance={activeAppearance}
129
- size={imageSize === undefinedText ? undefined : imageSize}
130
- shape={isSquare ? 'square' : 'circular'}
131
- accessibilityLabel="SVG Icon"
132
- icon={{ svgSource: svgProps }}
133
- avatarColor={avatarColor}
134
- badge={{ status: 'away', outOfOffice }}
135
- idForColor="15"
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, Picker, ScrollView } from 'react-native';
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
- <Picker
237
+ <MenuPicker
237
238
  prompt="Background Color"
238
- selectedValue={selectedBackgroundColor || colorDefault}
239
- onValueChange={(color) => setSelectedBackgroundColor(color === colorDefault ? undefined : color)}
240
- >
241
- {colorSelections.map((color, index) => (
242
- <Picker.Item label={color} key={index} value={color} />
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
- selectedValue={selectedBorderColor || colorDefault}
249
- onValueChange={(color) => setSelectedBorderColor(color === colorDefault ? undefined : color)}
250
- >
251
- {colorSelections.map((color, index) => (
252
- <Picker.Item label={color} key={index} value={color} />
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
- selectedValue={selectedBorderWidth || borderWidthDefault}
259
- onValueChange={(width) => setSelectedBorderWidth(width === borderWidthDefault ? undefined : width)}
260
- >
261
- {borderWidthSelections.map((width, index) => (
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 { Picker, StyleProp, ViewStyle } from 'react-native';
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 | undefined) => void;
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
- <Picker
20
+ <MenuPicker
18
21
  style={style}
19
22
  prompt={label}
20
- selectedValue={undefinedText}
21
- onValueChange={(value, index) => onSelectionChange(index == 0 ? undefined : value)}
22
- >
23
- {alignmentValues.map((alignment, index) => (
24
- <Picker.Item label={alignment} key={index} value={alignment} />
25
- ))}
26
- </Picker>
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 variant={'primary'} endText="Undo">
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 variant={'neutral'} endText="Sign in">
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 variant={'danger'} endText="Retry">
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 variant={'warning'} endText="X">
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, Picker } from 'react-native';
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
- selectedValue={imageSize || undefinedText}
61
- onValueChange={(size) => setImageSize(size === undefinedText ? undefined : size)}
62
- >
63
- {allSizes.map((size, index) => (
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 { Switch, View, Text, Picker, ColorValue } from 'react-native';
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.settings}>
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
- <PersonaCoin
91
- size={imageSize === undefinedText ? undefined : imageSize}
92
- initials="SN"
93
- imageDescription="Photo of Satya Nadella"
94
- presence={presence === undefinedText ? undefined : presence}
95
- imageUrl={showImage ? satyaPhotoUrl : undefined}
96
- coinColorFluent={coinColor === undefinedText ? undefined : coinColor}
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, PickerPropsAndroid } from 'react-native';
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
- const dropdownProps: PickerPropsAndroid = {
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 (