@fluentui-react-native/tester 0.83.1 → 0.84.1
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 +64 -1
- package/CHANGELOG.md +29 -2
- package/lib/TestComponents/Badge/BadgeTest.d.ts +1 -2
- package/lib/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
- package/lib/TestComponents/Badge/BadgeTest.js +12 -108
- package/lib/TestComponents/Badge/BadgeTest.js.map +1 -1
- package/lib/TestComponents/Badge/BasicBadgeTest.d.ts +3 -0
- package/lib/TestComponents/Badge/BasicBadgeTest.d.ts.map +1 -0
- package/lib/TestComponents/Badge/BasicBadgeTest.js +83 -0
- package/lib/TestComponents/Badge/BasicBadgeTest.js.map +1 -0
- package/lib/TestComponents/Badge/CounterBadgeTest.d.ts +3 -0
- package/lib/TestComponents/Badge/CounterBadgeTest.d.ts.map +1 -0
- package/lib/TestComponents/Badge/CounterBadgeTest.js +24 -0
- package/lib/TestComponents/Badge/CounterBadgeTest.js.map +1 -0
- package/lib/TestComponents/Badge/PresenceBadgeTest.d.ts +3 -0
- package/lib/TestComponents/Badge/PresenceBadgeTest.d.ts.map +1 -0
- package/lib/TestComponents/Badge/PresenceBadgeTest.js +18 -0
- package/lib/TestComponents/Badge/PresenceBadgeTest.js.map +1 -0
- package/lib/TestComponents/Switch/CustomizedSwitch.d.ts +3 -0
- package/lib/TestComponents/Switch/CustomizedSwitch.d.ts.map +1 -0
- package/lib/TestComponents/Switch/CustomizedSwitch.js +159 -0
- package/lib/TestComponents/Switch/CustomizedSwitch.js.map +1 -0
- package/lib/TestComponents/Switch/Switch.d.ts.map +1 -1
- package/lib/TestComponents/Switch/Switch.js +5 -0
- package/lib/TestComponents/Switch/Switch.js.map +1 -1
- package/lib-commonjs/TestComponents/Badge/BadgeTest.d.ts +1 -2
- package/lib-commonjs/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
- package/lib-commonjs/TestComponents/Badge/BadgeTest.js +15 -111
- package/lib-commonjs/TestComponents/Badge/BadgeTest.js.map +1 -1
- package/lib-commonjs/TestComponents/Badge/BasicBadgeTest.d.ts +3 -0
- package/lib-commonjs/TestComponents/Badge/BasicBadgeTest.d.ts.map +1 -0
- package/lib-commonjs/TestComponents/Badge/BasicBadgeTest.js +87 -0
- package/lib-commonjs/TestComponents/Badge/BasicBadgeTest.js.map +1 -0
- package/lib-commonjs/TestComponents/Badge/CounterBadgeTest.d.ts +3 -0
- package/lib-commonjs/TestComponents/Badge/CounterBadgeTest.d.ts.map +1 -0
- package/lib-commonjs/TestComponents/Badge/CounterBadgeTest.js +29 -0
- package/lib-commonjs/TestComponents/Badge/CounterBadgeTest.js.map +1 -0
- package/lib-commonjs/TestComponents/Badge/PresenceBadgeTest.d.ts +3 -0
- package/lib-commonjs/TestComponents/Badge/PresenceBadgeTest.d.ts.map +1 -0
- package/lib-commonjs/TestComponents/Badge/PresenceBadgeTest.js +23 -0
- package/lib-commonjs/TestComponents/Badge/PresenceBadgeTest.js.map +1 -0
- package/lib-commonjs/TestComponents/Switch/CustomizedSwitch.d.ts +3 -0
- package/lib-commonjs/TestComponents/Switch/CustomizedSwitch.d.ts.map +1 -0
- package/lib-commonjs/TestComponents/Switch/CustomizedSwitch.js +164 -0
- package/lib-commonjs/TestComponents/Switch/CustomizedSwitch.js.map +1 -0
- package/lib-commonjs/TestComponents/Switch/Switch.d.ts.map +1 -1
- package/lib-commonjs/TestComponents/Switch/Switch.js +5 -0
- package/lib-commonjs/TestComponents/Switch/Switch.js.map +1 -1
- package/package.json +4 -4
- package/src/TestComponents/Badge/BadgeTest.tsx +12 -181
- package/src/TestComponents/Badge/BasicBadgeTest.tsx +120 -0
- package/src/TestComponents/Badge/CounterBadgeTest.tsx +30 -0
- package/src/TestComponents/Badge/PresenceBadgeTest.tsx +26 -0
- package/src/TestComponents/Switch/CustomizedSwitch.tsx +281 -0
- package/src/TestComponents/Switch/Switch.tsx +5 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, TextInput, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { Switch, SwitchTokens } from '@fluentui-react-native/switch';
|
|
4
|
+
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
tokensRow: {
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
marginBottom: 10,
|
|
10
|
+
},
|
|
11
|
+
tokensColumn: {
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
margin: 10,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const CustomizedSwitch: React.FunctionComponent = () => {
|
|
18
|
+
const [trackColor, setTrackColor] = React.useState<string>('blue');
|
|
19
|
+
const [thumbColorOn, setThumbColorOn] = React.useState<string>('white');
|
|
20
|
+
const [thumbColorOff, setThumbColorOff] = React.useState<string>('grey');
|
|
21
|
+
const [thumbSize, setThumbSize] = React.useState<number>(20);
|
|
22
|
+
const [trackWidth, setTrackWidth] = React.useState<number>(100);
|
|
23
|
+
const [trackHeight, setTrackHeight] = React.useState<number>(30);
|
|
24
|
+
const [focusStrokeColor, setFocusStrokeColor] = React.useState<string>('black');
|
|
25
|
+
const [focusBorderRadius, setFocusBorderRadius] = React.useState<number>(4);
|
|
26
|
+
const [focusBorderWidth, setFocusBorderWidth] = React.useState<number>(1);
|
|
27
|
+
const [thumbRadius, setThumbRadius] = React.useState<number>(20);
|
|
28
|
+
const [padding, setPadding] = React.useState<number>(4);
|
|
29
|
+
const [color, setColor] = React.useState<string>('black');
|
|
30
|
+
const [minWidth, setMinWidth] = React.useState<number>(trackWidth);
|
|
31
|
+
const [minHeight, setMinHeight] = React.useState<number>(trackHeight);
|
|
32
|
+
const [borderWidth, setBorderWidth] = React.useState<number>(1);
|
|
33
|
+
const [borderRadius, setBorderRadius] = React.useState<number>(20);
|
|
34
|
+
const [borderColor, setBorderColor] = React.useState<string>(trackColor);
|
|
35
|
+
|
|
36
|
+
const CustomSwitch = React.useMemo(() => {
|
|
37
|
+
const tokens: SwitchTokens = {
|
|
38
|
+
trackWidth,
|
|
39
|
+
trackHeight,
|
|
40
|
+
minWidth,
|
|
41
|
+
minHeight,
|
|
42
|
+
thumbSize,
|
|
43
|
+
thumbRadius,
|
|
44
|
+
padding,
|
|
45
|
+
color,
|
|
46
|
+
borderWidth,
|
|
47
|
+
borderRadius,
|
|
48
|
+
|
|
49
|
+
toggleOn: {
|
|
50
|
+
thumbColor: thumbColorOn,
|
|
51
|
+
trackColor,
|
|
52
|
+
borderColor,
|
|
53
|
+
|
|
54
|
+
hovered: {
|
|
55
|
+
borderColor,
|
|
56
|
+
trackColor,
|
|
57
|
+
thumbColor: thumbColorOn,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
pressed: {
|
|
61
|
+
borderColor: trackColor,
|
|
62
|
+
trackColor,
|
|
63
|
+
thumbColor: thumbColorOn,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
toggleOff: {
|
|
68
|
+
thumbColor: thumbColorOff,
|
|
69
|
+
|
|
70
|
+
hovered: {
|
|
71
|
+
thumbColor: thumbColorOff,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
pressed: {
|
|
75
|
+
thumbColor: thumbColorOff,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
focused: {
|
|
80
|
+
focusBorderRadius,
|
|
81
|
+
focusStrokeColor,
|
|
82
|
+
focusBorderWidth,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return Switch.customize(tokens);
|
|
86
|
+
}, [
|
|
87
|
+
trackColor,
|
|
88
|
+
thumbColorOn,
|
|
89
|
+
thumbColorOff,
|
|
90
|
+
thumbSize,
|
|
91
|
+
thumbRadius,
|
|
92
|
+
trackWidth,
|
|
93
|
+
trackHeight,
|
|
94
|
+
focusStrokeColor,
|
|
95
|
+
focusBorderRadius,
|
|
96
|
+
focusBorderWidth,
|
|
97
|
+
padding,
|
|
98
|
+
color,
|
|
99
|
+
minWidth,
|
|
100
|
+
minHeight,
|
|
101
|
+
borderWidth,
|
|
102
|
+
borderRadius,
|
|
103
|
+
borderColor,
|
|
104
|
+
]);
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<View style={styles.tokensColumn}>
|
|
108
|
+
<View style={styles.tokensRow}>
|
|
109
|
+
<View>
|
|
110
|
+
<Text>Track Tokens</Text>
|
|
111
|
+
<TextInput
|
|
112
|
+
accessibilityLabel="Track color"
|
|
113
|
+
style={commonStyles.textBox}
|
|
114
|
+
placeholder="Track color"
|
|
115
|
+
blurOnSubmit={true}
|
|
116
|
+
onSubmitEditing={(e) => {
|
|
117
|
+
setTrackColor(e.nativeEvent.text);
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
<TextInput
|
|
121
|
+
accessibilityLabel="Track border color"
|
|
122
|
+
style={commonStyles.textBox}
|
|
123
|
+
placeholder="Track border color"
|
|
124
|
+
blurOnSubmit={true}
|
|
125
|
+
onSubmitEditing={(e) => {
|
|
126
|
+
setBorderColor(e.nativeEvent.text);
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
<TextInput
|
|
130
|
+
accessibilityLabel="Track width"
|
|
131
|
+
style={commonStyles.textBox}
|
|
132
|
+
placeholder="Track width"
|
|
133
|
+
blurOnSubmit={true}
|
|
134
|
+
onSubmitEditing={(e) => {
|
|
135
|
+
setTrackWidth(parseInt(e.nativeEvent.text.toString()));
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
<TextInput
|
|
139
|
+
accessibilityLabel="Track height"
|
|
140
|
+
style={commonStyles.textBox}
|
|
141
|
+
placeholder="Track height"
|
|
142
|
+
blurOnSubmit={true}
|
|
143
|
+
onSubmitEditing={(e) => {
|
|
144
|
+
setTrackHeight(parseInt(e.nativeEvent.text.toString()));
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
<TextInput
|
|
148
|
+
accessibilityLabel="Track border width"
|
|
149
|
+
style={commonStyles.textBox}
|
|
150
|
+
placeholder="Track border width"
|
|
151
|
+
blurOnSubmit={true}
|
|
152
|
+
onSubmitEditing={(e) => {
|
|
153
|
+
setBorderWidth(parseInt(e.nativeEvent.text.toString()));
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
<TextInput
|
|
157
|
+
accessibilityLabel="Track border radius"
|
|
158
|
+
style={commonStyles.textBox}
|
|
159
|
+
placeholder="Track border radius"
|
|
160
|
+
blurOnSubmit={true}
|
|
161
|
+
onSubmitEditing={(e) => {
|
|
162
|
+
setBorderRadius(parseInt(e.nativeEvent.text.toString()));
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
</View>
|
|
166
|
+
<View>
|
|
167
|
+
<Text>Thumb Tokens</Text>
|
|
168
|
+
<TextInput
|
|
169
|
+
accessibilityLabel="Thumb on color"
|
|
170
|
+
style={commonStyles.textBox}
|
|
171
|
+
placeholder="Thumb on color"
|
|
172
|
+
blurOnSubmit={true}
|
|
173
|
+
onSubmitEditing={(e) => {
|
|
174
|
+
setThumbColorOn(e.nativeEvent.text);
|
|
175
|
+
}}
|
|
176
|
+
/>
|
|
177
|
+
<TextInput
|
|
178
|
+
accessibilityLabel="Thumb off color"
|
|
179
|
+
style={commonStyles.textBox}
|
|
180
|
+
placeholder="Thumb off color"
|
|
181
|
+
blurOnSubmit={true}
|
|
182
|
+
onSubmitEditing={(e) => {
|
|
183
|
+
setThumbColorOff(e.nativeEvent.text);
|
|
184
|
+
}}
|
|
185
|
+
/>
|
|
186
|
+
<TextInput
|
|
187
|
+
accessibilityLabel="Thumb size"
|
|
188
|
+
style={commonStyles.textBox}
|
|
189
|
+
placeholder="Thumb size"
|
|
190
|
+
blurOnSubmit={true}
|
|
191
|
+
onSubmitEditing={(e) => {
|
|
192
|
+
setThumbSize(parseInt(e.nativeEvent.text));
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
<TextInput
|
|
196
|
+
accessibilityLabel="Thumb radius"
|
|
197
|
+
style={commonStyles.textBox}
|
|
198
|
+
placeholder="Thumb radius"
|
|
199
|
+
blurOnSubmit={true}
|
|
200
|
+
onSubmitEditing={(e) => {
|
|
201
|
+
setThumbRadius(parseInt(e.nativeEvent.text));
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
</View>
|
|
205
|
+
</View>
|
|
206
|
+
<View style={styles.tokensRow}>
|
|
207
|
+
<View>
|
|
208
|
+
<Text>Focus Stroke Tokens</Text>
|
|
209
|
+
<TextInput
|
|
210
|
+
accessibilityLabel="Focus stroke color"
|
|
211
|
+
style={commonStyles.textBox}
|
|
212
|
+
placeholder="Focus stroke color"
|
|
213
|
+
blurOnSubmit={true}
|
|
214
|
+
onSubmitEditing={(e) => {
|
|
215
|
+
setFocusStrokeColor(e.nativeEvent.text);
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
<TextInput
|
|
219
|
+
accessibilityLabel="Focus stroke border radius"
|
|
220
|
+
style={commonStyles.textBox}
|
|
221
|
+
placeholder="Focus stroke border radius"
|
|
222
|
+
blurOnSubmit={true}
|
|
223
|
+
onSubmitEditing={(e) => {
|
|
224
|
+
setFocusBorderRadius(parseInt(e.nativeEvent.text));
|
|
225
|
+
}}
|
|
226
|
+
/>
|
|
227
|
+
<TextInput
|
|
228
|
+
accessibilityLabel="Focus stroke border width"
|
|
229
|
+
style={commonStyles.textBox}
|
|
230
|
+
placeholder="Focus stroke border width"
|
|
231
|
+
blurOnSubmit={true}
|
|
232
|
+
onSubmitEditing={(e) => {
|
|
233
|
+
setFocusBorderWidth(parseInt(e.nativeEvent.text));
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
</View>
|
|
237
|
+
<View>
|
|
238
|
+
<Text>Other Tokens</Text>
|
|
239
|
+
<TextInput
|
|
240
|
+
accessibilityLabel="Minimum width"
|
|
241
|
+
style={commonStyles.textBox}
|
|
242
|
+
placeholder="Minimum width"
|
|
243
|
+
blurOnSubmit={true}
|
|
244
|
+
onSubmitEditing={(e) => {
|
|
245
|
+
setMinWidth(parseInt(e.nativeEvent.text));
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
<TextInput
|
|
249
|
+
accessibilityLabel="Minimum height"
|
|
250
|
+
style={commonStyles.textBox}
|
|
251
|
+
placeholder="Minimum height"
|
|
252
|
+
blurOnSubmit={true}
|
|
253
|
+
onSubmitEditing={(e) => {
|
|
254
|
+
setMinHeight(parseInt(e.nativeEvent.text));
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
<TextInput
|
|
258
|
+
accessibilityLabel="Padding"
|
|
259
|
+
style={commonStyles.textBox}
|
|
260
|
+
placeholder="Padding"
|
|
261
|
+
blurOnSubmit={true}
|
|
262
|
+
onSubmitEditing={(e) => {
|
|
263
|
+
setPadding(parseInt(e.nativeEvent.text));
|
|
264
|
+
}}
|
|
265
|
+
/>
|
|
266
|
+
<TextInput
|
|
267
|
+
accessibilityLabel="Text colors"
|
|
268
|
+
style={commonStyles.textBox}
|
|
269
|
+
placeholder="Text colors"
|
|
270
|
+
blurOnSubmit={true}
|
|
271
|
+
onSubmitEditing={(e) => {
|
|
272
|
+
setColor(e.nativeEvent.text);
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
</View>
|
|
276
|
+
</View>
|
|
277
|
+
|
|
278
|
+
<CustomSwitch label="Custom Switch" onText="On" offText="Off" accessibilityLabel="Custom Switch" />
|
|
279
|
+
</View>
|
|
280
|
+
);
|
|
281
|
+
};
|
|
@@ -7,6 +7,7 @@ import { E2ESwitchTest } from './E2ESwitchTest';
|
|
|
7
7
|
import { commonTestStyles } from '../Common/styles';
|
|
8
8
|
import { ButtonV1 as Button } from '@fluentui-react-native/button';
|
|
9
9
|
import { InteractionEvent } from '@fluentui-react-native/interactive-hooks';
|
|
10
|
+
import { CustomizedSwitch } from './CustomizedSwitch';
|
|
10
11
|
|
|
11
12
|
const styles = StyleSheet.create({
|
|
12
13
|
square: {
|
|
@@ -104,6 +105,10 @@ const toggleSections: TestSection[] = [
|
|
|
104
105
|
name: 'On/Off Text',
|
|
105
106
|
component: () => <OnOffText />,
|
|
106
107
|
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Customized Tokens',
|
|
110
|
+
component: () => <CustomizedSwitch />,
|
|
111
|
+
},
|
|
107
112
|
{
|
|
108
113
|
name: 'Switch E2E Testing',
|
|
109
114
|
component: () => <E2ESwitchTest />,
|