@fluentui-react-native/tester 0.83.0 → 0.84.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 +63 -1
- package/CHANGELOG.md +29 -2
- package/android/build.gradle +7 -2
- package/app.json +23 -0
- package/assets/fluent_app_icon_ios.png +0 -0
- package/assets/fluent_app_icon_macos.png +0 -0
- package/assets/res/drawable/fluent_app_icon_android_background.xml +74 -0
- package/assets/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/assets/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/assets/res/mipmap-hdpi/fluent_app_icon_android.png +0 -0
- package/assets/res/mipmap-hdpi/fluent_app_icon_android_foreground.png +0 -0
- package/assets/res/mipmap-hdpi/fluent_app_icon_android_round.png +0 -0
- package/assets/res/mipmap-mdpi/fluent_app_icon_android.png +0 -0
- package/assets/res/mipmap-mdpi/fluent_app_icon_android_foreground.png +0 -0
- package/assets/res/mipmap-mdpi/fluent_app_icon_android_round.png +0 -0
- package/assets/res/mipmap-xhdpi/fluent_app_icon_android.png +0 -0
- package/assets/res/mipmap-xhdpi/fluent_app_icon_android_foreground.png +0 -0
- package/assets/res/mipmap-xhdpi/fluent_app_icon_android_round.png +0 -0
- package/assets/res/mipmap-xxhdpi/fluent_app_icon_android.png +0 -0
- package/assets/res/mipmap-xxhdpi/fluent_app_icon_android_foreground.png +0 -0
- package/assets/res/mipmap-xxhdpi/fluent_app_icon_android_round.png +0 -0
- package/assets/res/mipmap-xxxhdpi/fluent_app_icon_android.png +0 -0
- package/assets/res/mipmap-xxxhdpi/fluent_app_icon_android_foreground.png +0 -0
- package/assets/res/mipmap-xxxhdpi/fluent_app_icon_android_round.png +0 -0
- package/ios/Podfile.lock +9 -13
- 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/macos/Podfile.lock +223 -227
- package/package.json +5 -5
- 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
|
@@ -1,186 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useState, useCallback } from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
import { BADGE_TESTPAGE } from './consts';
|
|
4
3
|
import { Test, TestSection, PlatformStatus } from '../Test';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
Badge,
|
|
9
|
-
PresenceBadge,
|
|
10
|
-
BadgeAppearance,
|
|
11
|
-
BadgeAppearances,
|
|
12
|
-
BadgeColor,
|
|
13
|
-
BadgeColors,
|
|
14
|
-
BadgeShape,
|
|
15
|
-
BadgeShapes,
|
|
16
|
-
BadgeSize,
|
|
17
|
-
BadgeSizes,
|
|
18
|
-
BadgeIconPosition,
|
|
19
|
-
} from '@fluentui-react-native/badge';
|
|
20
|
-
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
21
|
-
import { StyledPicker } from '../Common/StyledPicker';
|
|
22
|
-
import { satyaPhotoUrl } from './../PersonaCoin/styles';
|
|
23
|
-
import TestSvg from '../../FluentTester/test-data/test.svg';
|
|
24
|
-
import { ToggleButton } from '@fluentui/react-native';
|
|
25
|
-
|
|
26
|
-
const badgeColors: BadgeColor[] = [...BadgeColors];
|
|
27
|
-
const badgeShapes: BadgeShape[] = [...BadgeShapes];
|
|
28
|
-
const badgeSizes: BadgeSize[] = [...BadgeSizes];
|
|
29
|
-
const badgeAppearances: BadgeAppearance[] = [...BadgeAppearances];
|
|
30
|
-
const badgeIconPositions = ['before', 'after'];
|
|
31
|
-
|
|
32
|
-
const StyledBadge = Badge.customize({
|
|
33
|
-
backgroundColor: 'yellow',
|
|
34
|
-
borderColor: '#f09',
|
|
35
|
-
borderWidth: 4,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const BasicBadge: React.FunctionComponent = () => {
|
|
39
|
-
const [badgeAppearance, setBadgeAppearance] = useState<BadgeAppearance>('filled');
|
|
40
|
-
const [badgeColor, setBadgeColor] = useState<BadgeColor>('brand');
|
|
41
|
-
const [shape, setShape] = useState<BadgeShape>('circular');
|
|
42
|
-
const [size, setSize] = useState<BadgeSize>('medium');
|
|
43
|
-
const [showIcon, setShowIcon] = useState(false);
|
|
44
|
-
const [iconPosition, setIconPosition] = useState<BadgeIconPosition>('before');
|
|
45
|
-
|
|
46
|
-
const onBadgeAppearanceChange = useCallback((value) => setBadgeAppearance(value), []);
|
|
47
|
-
const onBadgeColorChange = useCallback((value) => setBadgeColor(value), []);
|
|
48
|
-
const onShapeChange = useCallback((value) => setShape(value), []);
|
|
49
|
-
const onSizeChange = useCallback((value) => setSize(value), []);
|
|
50
|
-
const onIconPositionChange = useCallback((value) => setIconPosition(value), []);
|
|
51
|
-
|
|
52
|
-
const svgProps: SvgIconProps = {
|
|
53
|
-
src: TestSvg,
|
|
54
|
-
viewBox: '0 0 500 500',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const fontBuiltInProps = {
|
|
58
|
-
fontFamily: 'Arial',
|
|
59
|
-
codepoint: 0x2663,
|
|
60
|
-
fontSize: 16,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
64
|
-
const iconProps = { svgSource: svgProps, width: 20, height: 20 };
|
|
65
|
-
const badgeConfig = {
|
|
66
|
-
appearance: badgeAppearance,
|
|
67
|
-
color: badgeColor,
|
|
68
|
-
size,
|
|
69
|
-
shape,
|
|
70
|
-
};
|
|
71
|
-
const badgeContent = size !== 'tiny' && size !== 'extraSmall' ? 'Basic badge' : '';
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<View>
|
|
75
|
-
<View style={{ flexDirection: 'row' }}>
|
|
76
|
-
<View>
|
|
77
|
-
<StyledPicker
|
|
78
|
-
prompt="Badge appearance"
|
|
79
|
-
selected={badgeAppearance}
|
|
80
|
-
onChange={onBadgeAppearanceChange}
|
|
81
|
-
collection={badgeAppearances}
|
|
82
|
-
/>
|
|
83
|
-
<StyledPicker prompt="Badge color" selected={badgeColor} onChange={onBadgeColorChange} collection={badgeColors} />
|
|
84
|
-
<StyledPicker prompt="Shape" selected={shape} onChange={onShapeChange} collection={badgeShapes} />
|
|
85
|
-
<StyledPicker prompt="Size" selected={size} onChange={onSizeChange} collection={badgeSizes} />
|
|
86
|
-
{svgIconsEnabled && (
|
|
87
|
-
<>
|
|
88
|
-
<ToggleButton onClick={() => setShowIcon(!showIcon)} checked={showIcon}>
|
|
89
|
-
Set {showIcon ? ' Hide icon' : ' Show icon'}
|
|
90
|
-
</ToggleButton>
|
|
91
|
-
<StyledPicker
|
|
92
|
-
prompt="Icon position"
|
|
93
|
-
selected={iconPosition}
|
|
94
|
-
onChange={onIconPositionChange}
|
|
95
|
-
collection={badgeIconPositions}
|
|
96
|
-
/>
|
|
97
|
-
</>
|
|
98
|
-
)}
|
|
99
|
-
</View>
|
|
100
|
-
<View style={{ paddingHorizontal: 40, ...commonTestStyles.vmargin }}>
|
|
101
|
-
{svgIconsEnabled && showIcon ? (
|
|
102
|
-
<Badge {...badgeConfig} icon={{ svgSource: svgProps }} iconPosition={iconPosition}>
|
|
103
|
-
{badgeContent}
|
|
104
|
-
</Badge>
|
|
105
|
-
) : (
|
|
106
|
-
<Badge {...badgeConfig}>{badgeContent}</Badge>
|
|
107
|
-
)}
|
|
108
|
-
</View>
|
|
109
|
-
</View>
|
|
110
|
-
<View style={{ flexDirection: 'row' }}>
|
|
111
|
-
{svgIconsEnabled && (
|
|
112
|
-
<>
|
|
113
|
-
<View>
|
|
114
|
-
<Badge size="small" icon={{ svgSource: svgProps }}></Badge>
|
|
115
|
-
<Badge size="medium" icon={{ svgSource: svgProps }}></Badge>
|
|
116
|
-
<Badge size="large" icon={{ svgSource: svgProps }}></Badge>
|
|
117
|
-
<Badge size="extraLarge" icon={{ svgSource: svgProps }}></Badge>
|
|
118
|
-
</View>
|
|
119
|
-
<View>
|
|
120
|
-
<Badge size="small" icon={{ svgSource: svgProps }}>
|
|
121
|
-
999+
|
|
122
|
-
</Badge>
|
|
123
|
-
<Badge size="medium" icon={{ svgSource: svgProps }}>
|
|
124
|
-
999+
|
|
125
|
-
</Badge>
|
|
126
|
-
<Badge size="large" icon={{ svgSource: svgProps }}>
|
|
127
|
-
999+
|
|
128
|
-
</Badge>
|
|
129
|
-
<Badge size="extraLarge" icon={{ svgSource: svgProps }}>
|
|
130
|
-
999+
|
|
131
|
-
</Badge>
|
|
132
|
-
</View>
|
|
133
|
-
<View>
|
|
134
|
-
<Badge icon={{ svgSource: svgProps }} />
|
|
135
|
-
<Badge icon={{ svgSource: svgProps }}>Icon before by default</Badge>
|
|
136
|
-
<Badge icon={{ svgSource: svgProps }} iconPosition="before">
|
|
137
|
-
Icon before
|
|
138
|
-
</Badge>
|
|
139
|
-
<Badge icon={{ svgSource: svgProps }} iconPosition="after">
|
|
140
|
-
Icon after
|
|
141
|
-
</Badge>
|
|
142
|
-
</View>
|
|
143
|
-
</>
|
|
144
|
-
)}
|
|
145
|
-
|
|
146
|
-
<Text>Size</Text>
|
|
147
|
-
<Badge size="tiny" shape="circular" />
|
|
148
|
-
<Badge size="extraSmall" shape="circular" />
|
|
149
|
-
<Badge size="small">Small</Badge>
|
|
150
|
-
<Badge size="medium">Medium</Badge>
|
|
151
|
-
<Badge size="large">Large</Badge>
|
|
152
|
-
<Badge size="extraLarge">Extra Large</Badge>
|
|
153
|
-
</View>
|
|
154
|
-
{svgIconsEnabled && (
|
|
155
|
-
<>
|
|
156
|
-
<Text>Badge with icon</Text>
|
|
157
|
-
<Badge icon={{ svgSource: svgProps }} iconPosition="after">
|
|
158
|
-
<Image source={{ uri: satyaPhotoUrl }} style={{ width: 20, height: 20 }} />
|
|
159
|
-
Badge with
|
|
160
|
-
<Image source={{ uri: satyaPhotoUrl }} style={{ width: 20, height: 20 }} />
|
|
161
|
-
<Text style={{ backgroundColor: 'yellow' }}>optional content</Text>
|
|
162
|
-
</Badge>
|
|
163
|
-
<Badge appearance="outline" icon={iconProps} />
|
|
164
|
-
<Badge icon={{ fontSource: { ...fontBuiltInProps }, color: '#fff' }}>Badge with icon</Badge>
|
|
165
|
-
</>
|
|
166
|
-
)}
|
|
167
|
-
<StyledBadge appearance="outline">Styled badge</StyledBadge>
|
|
168
|
-
{svgIconsEnabled && (
|
|
169
|
-
<>
|
|
170
|
-
<Text>Presence Badge</Text>
|
|
171
|
-
<PresenceBadge status="available" size="extraLarge" />
|
|
172
|
-
<PresenceBadge status="available" outOfOffice={true} size="large" />
|
|
173
|
-
<PresenceBadge status="doNotDisturb" outOfOffice={true} />
|
|
174
|
-
<PresenceBadge status="away" size="small" />
|
|
175
|
-
<PresenceBadge status="busy" size="tiny" />
|
|
176
|
-
<PresenceBadge status="offline" />
|
|
177
|
-
<PresenceBadge status="outOfOffice" />
|
|
178
|
-
<PresenceBadge status="away" />
|
|
179
|
-
</>
|
|
180
|
-
)}
|
|
181
|
-
</View>
|
|
182
|
-
);
|
|
183
|
-
};
|
|
4
|
+
import { BasicBadge } from './BasicBadgeTest';
|
|
5
|
+
import { CounterBadgeTest } from './CounterBadgeTest';
|
|
6
|
+
import { PresenceBadgeTest } from './PresenceBadgeTest';
|
|
184
7
|
|
|
185
8
|
const badgeSections: TestSection[] = [
|
|
186
9
|
{
|
|
@@ -188,6 +11,14 @@ const badgeSections: TestSection[] = [
|
|
|
188
11
|
testID: BADGE_TESTPAGE,
|
|
189
12
|
component: BasicBadge,
|
|
190
13
|
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Counter Badge',
|
|
16
|
+
component: CounterBadgeTest,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Presence Badge',
|
|
20
|
+
component: PresenceBadgeTest,
|
|
21
|
+
},
|
|
191
22
|
];
|
|
192
23
|
|
|
193
24
|
export const BadgeTest: React.FunctionComponent = () => {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
import React, { useState, useCallback } from 'react';
|
|
3
|
+
import { View, Platform, Text, Image } from 'react-native';
|
|
4
|
+
import {
|
|
5
|
+
Badge,
|
|
6
|
+
BadgeAppearance,
|
|
7
|
+
BadgeAppearances,
|
|
8
|
+
BadgeColor,
|
|
9
|
+
BadgeColors,
|
|
10
|
+
BadgeShape,
|
|
11
|
+
BadgeShapes,
|
|
12
|
+
BadgeSize,
|
|
13
|
+
BadgeSizes,
|
|
14
|
+
BadgeIconPosition,
|
|
15
|
+
} from '@fluentui-react-native/badge';
|
|
16
|
+
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
17
|
+
import { StyledPicker } from '../Common/StyledPicker';
|
|
18
|
+
import { satyaPhotoUrl } from './../PersonaCoin/styles';
|
|
19
|
+
import TestSvg from '../../FluentTester/test-data/test.svg';
|
|
20
|
+
import { ToggleButton } from '@fluentui/react-native';
|
|
21
|
+
|
|
22
|
+
const badgeColors: BadgeColor[] = [...BadgeColors];
|
|
23
|
+
const badgeShapes: BadgeShape[] = [...BadgeShapes];
|
|
24
|
+
const badgeSizes: BadgeSize[] = [...BadgeSizes];
|
|
25
|
+
const badgeAppearances: BadgeAppearance[] = [...BadgeAppearances];
|
|
26
|
+
const badgeIconPositions = ['before', 'after'];
|
|
27
|
+
|
|
28
|
+
const BadgeNoBorder = Badge.customize({
|
|
29
|
+
borderColor: 'transparent',
|
|
30
|
+
borderWidth: 0,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const StyledBadge = Badge.customize({
|
|
34
|
+
backgroundColor: 'yellow',
|
|
35
|
+
borderColor: '#f09',
|
|
36
|
+
borderWidth: 4,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const BasicBadge: React.FunctionComponent = () => {
|
|
40
|
+
const [badgeAppearance, setBadgeAppearance] = useState<BadgeAppearance>('filled');
|
|
41
|
+
const [badgeColor, setBadgeColor] = useState<BadgeColor>('brand');
|
|
42
|
+
const [shape, setShape] = useState<BadgeShape>('circular');
|
|
43
|
+
const [size, setSize] = useState<BadgeSize>('medium');
|
|
44
|
+
const [showIcon, setShowIcon] = useState(false);
|
|
45
|
+
const [iconPosition, setIconPosition] = useState<BadgeIconPosition>('before');
|
|
46
|
+
|
|
47
|
+
const onBadgeAppearanceChange = useCallback((value) => setBadgeAppearance(value), []);
|
|
48
|
+
const onBadgeColorChange = useCallback((value) => setBadgeColor(value), []);
|
|
49
|
+
const onShapeChange = useCallback((value) => setShape(value), []);
|
|
50
|
+
const onSizeChange = useCallback((value) => setSize(value), []);
|
|
51
|
+
const onIconPositionChange = useCallback((value) => setIconPosition(value), []);
|
|
52
|
+
|
|
53
|
+
const svgProps: SvgIconProps = {
|
|
54
|
+
src: TestSvg,
|
|
55
|
+
viewBox: '0 0 500 500',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const fontBuiltInProps = {
|
|
59
|
+
fontFamily: 'Arial',
|
|
60
|
+
codepoint: 0x2663,
|
|
61
|
+
fontSize: 16,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
65
|
+
const iconProps = { svgSource: svgProps, width: 20, height: 20 };
|
|
66
|
+
const badgeConfig = {
|
|
67
|
+
appearance: badgeAppearance,
|
|
68
|
+
color: badgeColor,
|
|
69
|
+
size,
|
|
70
|
+
shape,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View>
|
|
75
|
+
<StyledPicker prompt="Badge appearance" selected={badgeAppearance} onChange={onBadgeAppearanceChange} collection={badgeAppearances} />
|
|
76
|
+
<StyledPicker prompt="Badge color" selected={badgeColor} onChange={onBadgeColorChange} collection={badgeColors} />
|
|
77
|
+
<StyledPicker prompt="Shape" selected={shape} onChange={onShapeChange} collection={badgeShapes} />
|
|
78
|
+
<StyledPicker prompt="Size" selected={size} onChange={onSizeChange} collection={badgeSizes} />
|
|
79
|
+
{svgIconsEnabled && (
|
|
80
|
+
<>
|
|
81
|
+
<ToggleButton onClick={() => setShowIcon(!showIcon)} checked={showIcon}>
|
|
82
|
+
Set {showIcon ? ' Hide icon' : ' Show icon'}
|
|
83
|
+
</ToggleButton>
|
|
84
|
+
<StyledPicker prompt="Icon position" selected={iconPosition} onChange={onIconPositionChange} collection={badgeIconPositions} />
|
|
85
|
+
</>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{svgIconsEnabled && showIcon ? (
|
|
89
|
+
<Badge {...badgeConfig} icon={{ svgSource: svgProps }} iconPosition={iconPosition}>
|
|
90
|
+
Basic badge
|
|
91
|
+
</Badge>
|
|
92
|
+
) : (
|
|
93
|
+
<Badge {...badgeConfig}>Basic badge</Badge>
|
|
94
|
+
)}
|
|
95
|
+
|
|
96
|
+
<Text>Size</Text>
|
|
97
|
+
<Badge size="tiny" shape="circular" />
|
|
98
|
+
<Badge size="extraSmall" shape="circular" />
|
|
99
|
+
<Badge size="small">Small</Badge>
|
|
100
|
+
<Badge size="medium">Medium</Badge>
|
|
101
|
+
<Badge size="large">Large</Badge>
|
|
102
|
+
<Badge size="extraLarge">Extra Large</Badge>
|
|
103
|
+
{svgIconsEnabled && (
|
|
104
|
+
<>
|
|
105
|
+
<Text>Badge with icon</Text>
|
|
106
|
+
<Badge icon={{ svgSource: svgProps }} iconPosition="after">
|
|
107
|
+
Badge with
|
|
108
|
+
<Image source={{ uri: satyaPhotoUrl }} style={{ width: 20, height: 20 }} />
|
|
109
|
+
<Text style={{ backgroundColor: 'yellow' }}>optional content</Text>
|
|
110
|
+
</Badge>
|
|
111
|
+
<Badge appearance="outline" icon={iconProps} />
|
|
112
|
+
<Badge icon={{ fontSource: { ...fontBuiltInProps }, color: '#fff' }}>Badge with icon</Badge>
|
|
113
|
+
<Text>Customized Badge</Text>
|
|
114
|
+
<BadgeNoBorder appearance="outline" icon={iconProps} />
|
|
115
|
+
</>
|
|
116
|
+
)}
|
|
117
|
+
<StyledBadge appearance="outline">Styled badge</StyledBadge>
|
|
118
|
+
</View>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, Platform, Text } from 'react-native';
|
|
4
|
+
import { CounterBadge } from '@fluentui-react-native/badge';
|
|
5
|
+
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
6
|
+
import TestSvg from '../../FluentTester/test-data/test.svg';
|
|
7
|
+
|
|
8
|
+
export const CounterBadgeTest: React.FunctionComponent = () => {
|
|
9
|
+
const svgProps: SvgIconProps = {
|
|
10
|
+
src: TestSvg,
|
|
11
|
+
viewBox: '0 0 500 500',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View>
|
|
18
|
+
<Text>Here should be no Badge:</Text>
|
|
19
|
+
<CounterBadge count={0}></CounterBadge>
|
|
20
|
+
<Text>And here is the Badge with showZero = true</Text>
|
|
21
|
+
<CounterBadge count={0} showZero={true}></CounterBadge>
|
|
22
|
+
<CounterBadge color="informative" count={777}></CounterBadge>
|
|
23
|
+
<CounterBadge color="important" overflowCount={1000} count={777}></CounterBadge>
|
|
24
|
+
<CounterBadge color="danger" overflowCount={1000} count={1500}></CounterBadge>
|
|
25
|
+
<CounterBadge count={13}></CounterBadge>
|
|
26
|
+
<CounterBadge count={13}>CounterBadge</CounterBadge>
|
|
27
|
+
{svgIconsEnabled && <CounterBadge count={17} icon={{ svgSource: svgProps }} iconPosition="after" />}
|
|
28
|
+
</View>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, Platform, Text } from 'react-native';
|
|
4
|
+
import { PresenceBadge } from '@fluentui-react-native/badge';
|
|
5
|
+
|
|
6
|
+
export const PresenceBadgeTest: React.FunctionComponent = () => {
|
|
7
|
+
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<View>
|
|
11
|
+
{svgIconsEnabled && (
|
|
12
|
+
<>
|
|
13
|
+
<Text>Presence Badge</Text>
|
|
14
|
+
<PresenceBadge status="available" size="extraLarge" />
|
|
15
|
+
<PresenceBadge status="available" outOfOffice={true} size="large" />
|
|
16
|
+
<PresenceBadge status="doNotDisturb" outOfOffice={true} />
|
|
17
|
+
<PresenceBadge status="away" size="small" />
|
|
18
|
+
<PresenceBadge status="busy" size="tiny" />
|
|
19
|
+
<PresenceBadge status="offline" />
|
|
20
|
+
<PresenceBadge status="outOfOffice" />
|
|
21
|
+
<PresenceBadge status="away" />
|
|
22
|
+
</>
|
|
23
|
+
)}
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -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 />,
|