@fluentui-react-native/tester 0.170.4 → 0.170.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.
@@ -4,6 +4,7 @@ import { StyleSheet, Switch, Text, TextInput, View } from 'react-native';
4
4
 
5
5
  import { ButtonV1 as Button, ToggleButton } from '@fluentui/react-native';
6
6
  import { Separator } from '@fluentui/react-native';
7
+ import { TextV1 } from '@fluentui-react-native/text';
7
8
  import {
8
9
  Circle,
9
10
  Defs,
@@ -32,6 +33,9 @@ const styles = StyleSheet.create({
32
33
  backgroundColor: 'green',
33
34
  color: 'purple',
34
35
  },
36
+ textInlineSvg: {
37
+ textTransform: 'uppercase',
38
+ },
35
39
  });
36
40
 
37
41
  const RectTest: React.FunctionComponent = () => {
@@ -58,9 +62,40 @@ const RectTest: React.FunctionComponent = () => {
58
62
  );
59
63
  };
60
64
 
65
+ const RichTextInlineSvgTest: React.FunctionComponent = () => {
66
+ const [showInline, setShowInline] = React.useState(false);
67
+ const [isGreen, setIsGreen] = React.useState(true);
68
+
69
+ const toggleShowInline = React.useCallback(() => {
70
+ setShowInline(!showInline);
71
+ }, [showInline]);
72
+ const toggleRectFill = React.useCallback(() => {
73
+ setIsGreen(!isGreen);
74
+ }, [isGreen]);
75
+
76
+ return (
77
+ <>
78
+ <TextV1 style={styles.textInlineSvg} font="base" weight="medium" truncate>
79
+ Left [
80
+ {showInline ? (
81
+ <Svg width="50" height="50" viewBox="0 0 50 50">
82
+ <Rect width="50" height="50" fill="red" />
83
+ <Rect x="20" width="20" height="20" fill={isGreen ? 'green' : 'blue'} />
84
+ </Svg>
85
+ ) : (
86
+ 'Svg will go here'
87
+ )}
88
+ ] Right
89
+ </TextV1>
90
+ <Button onClick={toggleShowInline}>{showInline ? 'Remove inline svg' : 'Insert inline svg'}</Button>
91
+ <Button onClick={toggleRectFill}>{isGreen ? 'Change to Blue' : 'Change to Green'}</Button>
92
+ </>
93
+ );
94
+ };
95
+
61
96
  const CircleTest: React.FunctionComponent = () => {
62
97
  return (
63
- <Svg width="50" height="50">
98
+ <Svg width="50" height="50" accessible={true} accessibilityLabel="SVG Circle Test" accessibilityRole="image">
64
99
  <Circle cx="25" cy="25" r="20" fill="red" stroke="black" />
65
100
  </Svg>
66
101
  );
@@ -68,7 +103,7 @@ const CircleTest: React.FunctionComponent = () => {
68
103
 
69
104
  const LineTest: React.FunctionComponent = () => {
70
105
  return (
71
- <Svg width="50" height="50">
106
+ <Svg width="50" height="50" accessible={true} accessibilityLabel="SVG Line Test" accessibilityRole="image">
72
107
  <Line x1="10" y1="10" x2="20" y2="20" fill="red" stroke="black" />
73
108
  </Svg>
74
109
  );
@@ -76,7 +111,7 @@ const LineTest: React.FunctionComponent = () => {
76
111
 
77
112
  const PathTest: React.FunctionComponent = () => {
78
113
  return (
79
- <Svg width="100" height="100">
114
+ <Svg width="100" height="100" accessible={true} accessibilityLabel="SVG Path Test" accessibilityRole="image">
80
115
  <Path d="M 0 0 A 10 10 0 0,1 0 100" fill="magenta" stroke="purple" id="path" />
81
116
  </Svg>
82
117
  );
@@ -84,7 +119,7 @@ const PathTest: React.FunctionComponent = () => {
84
119
 
85
120
  const PolygonTest: React.FunctionComponent = () => {
86
121
  return (
87
- <Svg height="100" width="100">
122
+ <Svg height="100" width="100" accessible={true} accessibilityLabel="SVG Polygon Test" accessibilityRole="image">
88
123
  <Polygon points="40,5 70,80 25,95" fill="lime" stroke="purple" strokeWidth="1" />
89
124
  </Svg>
90
125
  );
@@ -92,7 +127,16 @@ const PolygonTest: React.FunctionComponent = () => {
92
127
 
93
128
  const LinearGradientTest: React.FunctionComponent = () => {
94
129
  return (
95
- <Svg height="100" width="100" style={{ backgroundColor: 'black' }} viewBox="0 0 10 10" color="yellow">
130
+ <Svg
131
+ height="100"
132
+ width="100"
133
+ style={{ backgroundColor: 'black' }}
134
+ viewBox="0 0 10 10"
135
+ color="yellow"
136
+ accessible={true}
137
+ accessibilityLabel="SVG Linear Gradient Test"
138
+ accessibilityRole="image"
139
+ >
96
140
  <Defs>
97
141
  <LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0">
98
142
  <Stop offset="0" stopColor="green" stopOpacity="1" />
@@ -106,7 +150,16 @@ const LinearGradientTest: React.FunctionComponent = () => {
106
150
 
107
151
  const RadialGradientTest: React.FunctionComponent = () => {
108
152
  return (
109
- <Svg height="100" width="100" style={{ backgroundColor: 'black' }} viewBox="0 0 10 10" color="yellow">
153
+ <Svg
154
+ height="100"
155
+ width="100"
156
+ style={{ backgroundColor: 'black' }}
157
+ viewBox="0 0 10 10"
158
+ color="yellow"
159
+ accessible={true}
160
+ accessibilityLabel="SVG Radial Gradient Test"
161
+ accessibilityRole="image"
162
+ >
110
163
  <Defs>
111
164
  <RadialGradient id="grad2">
112
165
  <Stop offset="0" stopColor="blue" />
@@ -120,7 +173,15 @@ const RadialGradientTest: React.FunctionComponent = () => {
120
173
 
121
174
  const RadialGradientTransformTest: React.FunctionComponent = () => {
122
175
  return (
123
- <Svg width={256} height={256} viewBox="0 0 48 48" fill="none">
176
+ <Svg
177
+ width={256}
178
+ height={256}
179
+ viewBox="0 0 48 48"
180
+ fill="none"
181
+ accessible={true}
182
+ accessibilityLabel="SVG Radial Gradient Transform Test"
183
+ accessibilityRole="image"
184
+ >
124
185
  <Rect width={48} height={48} fill="url(#paint0_radial_1533_187044)" />
125
186
  <Rect x={10} y={10} width={10} height={10} fill="red" />
126
187
  <Defs>
@@ -142,7 +203,7 @@ const RadialGradientTransformTest: React.FunctionComponent = () => {
142
203
 
143
204
  const RectCircleTest: React.FunctionComponent = () => {
144
205
  return (
145
- <Svg height="200" width="200">
206
+ <Svg height="200" width="200" accessible={true} accessibilityLabel="SVG Rect and Circle Test" accessibilityRole="image">
146
207
  <Defs>
147
208
  <G id="shape">
148
209
  <G>
@@ -158,7 +219,9 @@ const RectCircleTest: React.FunctionComponent = () => {
158
219
  };
159
220
 
160
221
  const BundledSvgTest: React.FunctionComponent = () => {
161
- return <TestSvg width={200} height={200} color="red" />;
222
+ return (
223
+ <TestSvg width={200} height={200} color="red" accessible={true} accessibilityLabel="SVG Bundled svg Test" accessibilityRole="image" />
224
+ );
162
225
  };
163
226
 
164
227
  const RemoteSvgTest: React.FunctionComponent = () => {
@@ -169,10 +232,13 @@ const RemoteSvgTest: React.FunctionComponent = () => {
169
232
  <View>
170
233
  <SvgUri
171
234
  style={styles.svg}
172
- viewBox="0 0 200 200"
235
+ viewBox="0 0 600 600"
173
236
  width="100"
174
237
  height="100"
175
238
  uri="https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
239
+ accessible={true}
240
+ accessibilityLabel="SVG Uri Test"
241
+ accessibilityRole="image"
176
242
  />
177
243
  {shouldShowLocalNetwork && (
178
244
  <SvgUri
@@ -183,6 +249,9 @@ const RemoteSvgTest: React.FunctionComponent = () => {
183
249
  width="100"
184
250
  height="100"
185
251
  uri="http://10.122.222.112:8080/accessible-icon-brands.svg"
252
+ accessible={true}
253
+ accessibilityLabel="SVG Uri Test"
254
+ accessibilityRole="image"
186
255
  />
187
256
  )}
188
257
  </View>
@@ -240,7 +309,7 @@ const CustomSvgInputTest: React.FunctionComponent = () => {
240
309
  </View>
241
310
  <Separator />
242
311
  {showParse && <Text>{dataText}</Text>}
243
- <SvgXml width="256" height="256" xml={svgText} />
312
+ <SvgXml width="256" height="256" xml={svgText} accessible={true} accessibilityLabel="Custom Svg Test" accessibilityRole="image" />
244
313
  </View>
245
314
  );
246
315
  };
@@ -259,6 +328,10 @@ const svgSections: TestSection[] = [
259
328
  name: 'Circle',
260
329
  component: CircleTest,
261
330
  },
331
+ {
332
+ name: 'RichTextInlineSvg',
333
+ component: RichTextInlineSvgTest,
334
+ },
262
335
  {
263
336
  name: 'Line',
264
337
  component: LineTest,