@hero-design/rn 7.2.2 → 7.3.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/.expo/packager-info.json +1 -1
- package/.expo/prebuild/cached-packages.json +4 -0
- package/.expo/xcodebuild-error.log +2 -0
- package/.expo/xcodebuild.log +11199 -0
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-build:types.log +2 -0
- package/.turbo/turbo-test.log +131 -0
- package/.turbo/turbo-type-check.log +7 -0
- package/es/index.js +2409 -468
- package/jest.config.js +1 -1
- package/lib/index.js +2430 -484
- package/package.json +4 -2
- package/playground/components/Avatar.tsx +102 -0
- package/playground/components/Badge.tsx +146 -9
- package/playground/components/Button.tsx +138 -35
- package/playground/components/Card.tsx +36 -1
- package/playground/components/Collapse.tsx +99 -0
- package/playground/components/Drawer.tsx +32 -0
- package/playground/components/FAB.tsx +15 -0
- package/playground/components/IconButton.tsx +67 -0
- package/playground/components/Progress.tsx +95 -0
- package/playground/components/Tabs.tsx +106 -14
- package/playground/components/Tag.tsx +45 -0
- package/playground/index.tsx +18 -0
- package/src/components/Avatar/StyledAvatar.tsx +61 -0
- package/src/components/Avatar/__tests__/StyledAvatar.spec.tsx +48 -0
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +87 -0
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +88 -0
- package/src/components/Avatar/__tests__/index.spec.tsx +26 -0
- package/src/components/Avatar/index.tsx +71 -0
- package/src/components/Badge/Status.tsx +77 -0
- package/src/components/Badge/StyledBadge.tsx +38 -26
- package/src/components/Badge/__tests__/Badge.spec.tsx +16 -0
- package/src/components/Badge/__tests__/Status.spec.tsx +27 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +133 -52
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +89 -0
- package/src/components/Badge/index.tsx +77 -19
- package/src/components/Button/Button.tsx +163 -0
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +58 -0
- package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +20 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +101 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +606 -0
- package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +24 -0
- package/src/components/Button/LoadingIndicator/index.tsx +140 -0
- package/src/components/Button/StyledButton.tsx +254 -0
- package/src/components/Button/__tests__/Button.spec.tsx +86 -0
- package/src/components/Button/__tests__/{index.spec.tsx → IconButton.spec.tsx} +0 -0
- package/src/components/Button/__tests__/StyledButton.spec.tsx +154 -0
- package/src/components/Button/__tests__/__snapshots__/{index.spec.tsx.snap → IconButton.spec.tsx.snap} +0 -0
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +895 -0
- package/src/components/Button/index.tsx +10 -2
- package/src/components/Card/StyledCard.tsx +27 -4
- package/src/components/Card/__tests__/StyledCard.spec.tsx +15 -3
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +34 -1
- package/src/components/Card/__tests__/index.spec.tsx +16 -21
- package/src/components/Card/index.tsx +15 -2
- package/src/components/Collapse/StyledCollapse.tsx +15 -0
- package/src/components/Collapse/__tests__/StyledCollapse.spec.tsx +26 -0
- package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +37 -0
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +84 -0
- package/src/components/Collapse/__tests__/index.spec.tsx +42 -0
- package/src/components/Collapse/index.tsx +109 -0
- package/src/components/Divider/index.tsx +1 -1
- package/src/components/Drawer/StyledDrawer.tsx +39 -0
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +244 -0
- package/src/components/Drawer/__tests__/index.spec.tsx +37 -0
- package/src/components/Drawer/index.tsx +93 -0
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +78 -62
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +2 -0
- package/src/components/FAB/ActionGroup/index.tsx +13 -0
- package/src/components/FAB/FAB.tsx +63 -13
- package/src/components/FAB/StyledFAB.tsx +25 -6
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +6 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +7 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +88 -6
- package/src/components/FAB/__tests__/index.spec.tsx +16 -0
- package/src/components/Progress/ProgressBar.tsx +73 -0
- package/src/components/Progress/ProgressCircle.tsx +165 -0
- package/src/components/Progress/StyledProgressBar.tsx +21 -0
- package/src/components/Progress/StyledProgressCircle.tsx +66 -0
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +641 -0
- package/src/components/Progress/__tests__/index.spec.js +46 -0
- package/src/components/Progress/index.tsx +6 -0
- package/src/components/Progress/types.ts +1 -0
- package/src/components/Tabs/ActiveTabIndicator.tsx +37 -0
- package/src/components/Tabs/ScrollableTabs.tsx +216 -0
- package/src/components/Tabs/StyledScrollableTabs.tsx +60 -0
- package/src/components/Tabs/StyledTabs.tsx +30 -44
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +84 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +591 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +317 -224
- package/src/components/Tabs/__tests__/index.spec.tsx +22 -21
- package/src/components/Tabs/index.tsx +155 -114
- package/src/components/Tabs/utils.ts +13 -0
- package/src/components/Tag/StyledTag.tsx +35 -0
- package/src/components/Tag/__tests__/Tag.spec.tsx +41 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +153 -0
- package/src/components/Tag/index.tsx +41 -0
- package/src/components/Typography/Text/index.tsx +1 -1
- package/src/index.ts +10 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +182 -20
- package/src/theme/components/avatar.ts +40 -0
- package/src/theme/components/badge.ts +14 -16
- package/src/theme/components/button.ts +57 -0
- package/src/theme/components/card.ts +8 -2
- package/src/theme/components/drawer.ts +24 -0
- package/src/theme/components/fab.ts +9 -2
- package/src/theme/components/progress.ts +27 -0
- package/src/theme/components/tabs.ts +22 -7
- package/src/theme/components/tag.ts +39 -0
- package/src/theme/global/borders.ts +13 -1
- package/src/theme/global/colors.ts +6 -1
- package/src/theme/global/index.ts +3 -1
- package/src/theme/global/scale.ts +3 -0
- package/src/theme/index.ts +16 -1
- package/src/utils/hooks.ts +10 -0
- package/testUtils/setup.tsx +43 -0
- package/types/playground/components/Avatar.d.ts +2 -0
- package/types/playground/components/Badge.d.ts +0 -0
- package/types/playground/components/BottomNavigation.d.ts +0 -0
- package/types/playground/components/Button.d.ts +0 -0
- package/types/playground/components/Card.d.ts +0 -0
- package/types/playground/components/Collapse.d.ts +2 -0
- package/types/playground/components/Divider.d.ts +0 -0
- package/types/playground/components/Drawer.d.ts +2 -0
- package/types/playground/components/FAB.d.ts +0 -0
- package/types/playground/components/Icon.d.ts +0 -0
- package/types/playground/components/IconButton.d.ts +2 -0
- package/types/playground/components/Progress.d.ts +2 -0
- package/types/playground/components/Tabs.d.ts +0 -0
- package/types/playground/components/Tag.d.ts +2 -0
- package/types/playground/components/Typography.d.ts +0 -0
- package/types/playground/index.d.ts +0 -0
- package/types/src/components/Avatar/StyledAvatar.d.ts +46 -0
- package/types/src/components/{BottomNavigation/__tests__/BottomNavigation.spec.d.ts → Avatar/__tests__/StyledAvatar.spec.d.ts} +0 -0
- package/types/src/components/{Card/__tests__/Card.spec.d.ts → Avatar/__tests__/index.spec.d.ts} +0 -0
- package/types/src/components/Avatar/index.d.ts +25 -0
- package/types/src/components/Badge/Status.d.ts +24 -0
- package/types/src/components/Badge/StyledBadge.d.ts +17 -9
- package/types/src/components/Badge/__tests__/Badge.spec.d.ts +0 -0
- package/types/src/components/{FAB/__tests__/StyledFABContainer.spec.d.ts → Badge/__tests__/Status.spec.d.ts} +0 -0
- package/types/src/components/Badge/index.d.ts +17 -7
- package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/src/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/BottomNavigation/index.d.ts +0 -0
- package/types/src/components/Button/Button.d.ts +57 -0
- package/types/src/components/Button/IconButton.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +20 -0
- package/types/src/components/{FAB/__tests__/StyledFABIcon.spec.d.ts → Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts} +0 -0
- package/types/src/components/{Icon/__tests__/Icon.spec.d.ts → Button/LoadingIndicator/__tests__/index.spec.d.ts} +0 -0
- package/types/src/components/Button/LoadingIndicator/index.d.ts +26 -0
- package/types/src/components/Button/StyledButton.d.ts +40 -0
- package/types/src/components/{Tabs/__tests__/Tabs.spec.d.ts → Button/__tests__/Button.spec.d.ts} +0 -0
- package/types/src/components/Button/__tests__/IconButton.spec.d.ts +1 -0
- package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +1 -0
- package/types/src/components/Button/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Button/index.d.ts +8 -4
- package/types/src/components/Card/StyledCard.d.ts +9 -1
- package/types/src/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
- package/types/src/components/Card/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Card/index.d.ts +5 -1
- package/types/src/components/Collapse/StyledCollapse.d.ts +15 -0
- package/types/src/components/Collapse/__tests__/StyledCollapse.spec.d.ts +1 -0
- package/types/src/components/Collapse/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Collapse/index.d.ts +23 -0
- package/types/src/components/Divider/StyledDivider.d.ts +0 -0
- package/types/src/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
- package/types/src/components/Divider/index.d.ts +0 -0
- package/types/src/components/Drawer/StyledDrawer.d.ts +25 -0
- package/types/src/components/Drawer/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Drawer/index.d.ts +25 -0
- package/types/src/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/index.d.ts +5 -1
- package/types/src/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/src/components/FAB/FAB.d.ts +5 -1
- package/types/src/components/FAB/StyledFAB.d.ts +8 -2
- package/types/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
- package/types/src/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
- package/types/src/components/FAB/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/FAB/index.d.ts +2 -2
- package/types/src/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/src/components/Icon/IconList.d.ts +0 -0
- package/types/src/components/Icon/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Icon/index.d.ts +0 -0
- package/types/src/components/Icon/utils.d.ts +1 -1
- package/types/src/components/Progress/ProgressBar.d.ts +18 -0
- package/types/src/components/Progress/ProgressCircle.d.ts +18 -0
- package/types/src/components/Progress/StyledProgressBar.d.ts +18 -0
- package/types/src/components/Progress/StyledProgressCircle.d.ts +38 -0
- package/types/src/components/Progress/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Progress/index.d.ts +5 -0
- package/types/src/components/Progress/types.d.ts +1 -0
- package/types/src/components/Tabs/ActiveTabIndicator.d.ts +8 -0
- package/types/src/components/Tabs/ScrollableTabs.d.ts +3 -0
- package/types/src/components/Tabs/StyledScrollableTabs.d.ts +61 -0
- package/types/src/components/Tabs/StyledTabs.d.ts +22 -22
- package/types/src/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +1 -0
- package/types/src/components/Tabs/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Tabs/index.d.ts +28 -19
- package/types/src/components/Tabs/utils.d.ts +2 -0
- package/types/src/components/Tag/StyledTag.d.ts +20 -0
- package/types/src/components/Tag/__tests__/Tag.spec.d.ts +1 -0
- package/types/src/components/Tag/index.d.ts +21 -0
- package/types/src/components/Typography/Text/StyledText.d.ts +0 -0
- package/types/src/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
- package/types/src/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Typography/Text/index.d.ts +0 -0
- package/types/src/components/Typography/index.d.ts +0 -0
- package/types/src/index.d.ts +6 -1
- package/types/src/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/src/theme/__tests__/index.spec.d.ts +0 -0
- package/types/src/theme/components/avatar.d.ts +32 -0
- package/types/src/theme/components/badge.d.ts +12 -13
- package/types/src/theme/components/bottomNavigation.d.ts +0 -0
- package/types/src/theme/components/button.d.ts +37 -0
- package/types/src/theme/components/card.d.ts +5 -1
- package/types/src/theme/components/divider.d.ts +0 -0
- package/types/src/theme/components/drawer.d.ts +21 -0
- package/types/src/theme/components/fab.d.ts +8 -1
- package/types/src/theme/components/icon.d.ts +0 -0
- package/types/src/theme/components/progress.d.ts +21 -0
- package/types/src/theme/components/tabs.d.ts +14 -2
- package/types/src/theme/components/tag.d.ts +30 -0
- package/types/src/theme/components/typography.d.ts +0 -0
- package/types/src/theme/global/borders.d.ts +7 -1
- package/types/src/theme/global/colors.d.ts +6 -1
- package/types/src/theme/global/index.d.ts +7 -1
- package/types/src/theme/global/scale.d.ts +1 -0
- package/types/src/theme/global/space.d.ts +0 -0
- package/types/src/theme/global/typography.d.ts +0 -0
- package/types/src/theme/index.d.ts +10 -0
- package/types/src/types.d.ts +0 -0
- package/types/src/utils/__tests__/scale.spec.d.ts +0 -0
- package/types/src/utils/helpers.d.ts +0 -0
- package/types/src/utils/hooks.d.ts +1 -0
- package/types/src/utils/scale.d.ts +0 -0
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +0 -33
- package/testUtils/setup.ts +0 -18
- package/types/src/components/FAB/StyledFABContainer.d.ts +0 -3
- package/types/src/components/FAB/StyledFABIcon.d.ts +0 -3
- package/types/src/styled-components.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/native": "^11.9.3",
|
|
22
22
|
"@emotion/react": "^11.9.3",
|
|
23
|
-
"@hero-design/colors": "7.
|
|
23
|
+
"@hero-design/colors": "7.3.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "17.0.2",
|
|
27
27
|
"react-native": "0.65.1",
|
|
28
|
+
"react-native-pager-view": "^5.4.25",
|
|
28
29
|
"react-native-safe-area-context": "^4.2.5",
|
|
29
30
|
"react-native-vector-icons": "^9.1.0"
|
|
30
31
|
},
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
"prettier": "^2.5.1",
|
|
63
64
|
"react": "17.0.2",
|
|
64
65
|
"react-native": "0.65.1",
|
|
66
|
+
"react-native-pager-view": "^5.4.25",
|
|
65
67
|
"react-native-safe-area-context": "^4.2.5",
|
|
66
68
|
"react-native-screens": "^3.13.1",
|
|
67
69
|
"react-native-vector-icons": "^9.1.0",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert, View } from 'react-native';
|
|
3
|
+
import { Avatar, Typography, useTheme } from '../../src/index';
|
|
4
|
+
|
|
5
|
+
const AvatarPlayground = () => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const source = { uri: 'https://i.pravatar.cc/300' };
|
|
8
|
+
const text = 'MD';
|
|
9
|
+
|
|
10
|
+
const createTwoButtonAlert = () =>
|
|
11
|
+
Alert.alert('Alert Title', 'My Alert Msg', [
|
|
12
|
+
{
|
|
13
|
+
text: 'Cancel',
|
|
14
|
+
onPress: () => {},
|
|
15
|
+
style: 'cancel',
|
|
16
|
+
},
|
|
17
|
+
{ text: 'OK', onPress: () => {} },
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<View
|
|
22
|
+
style={{
|
|
23
|
+
marginVertical: theme.space.medium,
|
|
24
|
+
marginHorizontal: theme.space.medium,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
28
|
+
Avatar with different sizes
|
|
29
|
+
</Typography.Text>
|
|
30
|
+
<View
|
|
31
|
+
style={{
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
marginBottom: theme.space.large,
|
|
34
|
+
alignItems: 'flex-end',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<Avatar source={source} />
|
|
38
|
+
<Avatar
|
|
39
|
+
source={source}
|
|
40
|
+
size="medium"
|
|
41
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
42
|
+
/>
|
|
43
|
+
<Avatar
|
|
44
|
+
source={source}
|
|
45
|
+
size="large"
|
|
46
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
47
|
+
/>
|
|
48
|
+
<Avatar
|
|
49
|
+
source={source}
|
|
50
|
+
size="xlarge"
|
|
51
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
52
|
+
/>
|
|
53
|
+
</View>
|
|
54
|
+
|
|
55
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
56
|
+
Text Avatar with different sizes
|
|
57
|
+
</Typography.Text>
|
|
58
|
+
<View
|
|
59
|
+
style={{
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
marginBottom: theme.space.large,
|
|
62
|
+
alignItems: 'flex-end',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Avatar title={text} />
|
|
66
|
+
<Avatar
|
|
67
|
+
title={text}
|
|
68
|
+
size="medium"
|
|
69
|
+
intent="info"
|
|
70
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
71
|
+
/>
|
|
72
|
+
<Avatar
|
|
73
|
+
title={text}
|
|
74
|
+
size="large"
|
|
75
|
+
intent="success"
|
|
76
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
77
|
+
/>
|
|
78
|
+
<Avatar
|
|
79
|
+
title={text}
|
|
80
|
+
size="xlarge"
|
|
81
|
+
intent="danger"
|
|
82
|
+
style={{ marginLeft: theme.space.xsmall }}
|
|
83
|
+
/>
|
|
84
|
+
</View>
|
|
85
|
+
|
|
86
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
87
|
+
Pressable avatar
|
|
88
|
+
</Typography.Text>
|
|
89
|
+
<View
|
|
90
|
+
style={{
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
marginBottom: theme.space.large,
|
|
93
|
+
alignItems: 'flex-end',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<Avatar source={source} onPress={createTwoButtonAlert} size="large" />
|
|
97
|
+
</View>
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default AvatarPlayground;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Badge, useTheme } from '../../src/index';
|
|
2
|
+
import { Button, View } from 'react-native';
|
|
3
|
+
import { Badge, Icon, Typography, useTheme } from '../../src/index';
|
|
4
4
|
|
|
5
5
|
const BadgePlayground = () => {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
+
const [isVisibleBadge, setIsVisibleBadge] = React.useState(true);
|
|
8
|
+
const [isVisibleStatusBadge, setIsVisibleStatusBadge] = React.useState(true);
|
|
7
9
|
|
|
8
10
|
return (
|
|
9
|
-
<View
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
11
|
+
<View style={{ margin: theme.space.medium }}>
|
|
12
|
+
<Typography.Text fontWeight="semi-bold">Standalone</Typography.Text>
|
|
13
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
14
|
+
Text
|
|
15
|
+
</Typography.Text>
|
|
15
16
|
<View
|
|
16
17
|
style={{
|
|
17
18
|
display: 'flex',
|
|
@@ -34,6 +35,7 @@ const BadgePlayground = () => {
|
|
|
34
35
|
style={{
|
|
35
36
|
display: 'flex',
|
|
36
37
|
flexDirection: 'row',
|
|
38
|
+
marginBottom: theme.space.small,
|
|
37
39
|
}}
|
|
38
40
|
>
|
|
39
41
|
<Badge
|
|
@@ -41,7 +43,142 @@ const BadgePlayground = () => {
|
|
|
41
43
|
intent="danger"
|
|
42
44
|
style={{ marginEnd: theme.space.small }}
|
|
43
45
|
/>
|
|
44
|
-
<Badge
|
|
46
|
+
<Badge
|
|
47
|
+
content="SUBMITTED"
|
|
48
|
+
intent="info"
|
|
49
|
+
style={{ marginEnd: theme.space.small }}
|
|
50
|
+
/>
|
|
51
|
+
<Badge
|
|
52
|
+
content="ARCHIVED"
|
|
53
|
+
intent="archived"
|
|
54
|
+
style={{ marginEnd: theme.space.small }}
|
|
55
|
+
/>
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
59
|
+
Number
|
|
60
|
+
</Typography.Text>
|
|
61
|
+
<View
|
|
62
|
+
style={{
|
|
63
|
+
display: 'flex',
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
marginBottom: theme.space.small,
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<Badge content={9} style={{ marginEnd: theme.space.small }} />
|
|
69
|
+
<Badge content={99} style={{ marginEnd: theme.space.small }} />
|
|
70
|
+
<Badge content={100} />
|
|
71
|
+
</View>
|
|
72
|
+
<View
|
|
73
|
+
style={{
|
|
74
|
+
display: 'flex',
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
marginBottom: theme.space.large,
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<Badge
|
|
80
|
+
content={9}
|
|
81
|
+
style={{ marginEnd: theme.space.small }}
|
|
82
|
+
intent="success"
|
|
83
|
+
/>
|
|
84
|
+
<Badge
|
|
85
|
+
content={9}
|
|
86
|
+
max={5}
|
|
87
|
+
style={{ marginEnd: theme.space.small }}
|
|
88
|
+
intent="warning"
|
|
89
|
+
/>
|
|
90
|
+
<Badge
|
|
91
|
+
content={90}
|
|
92
|
+
max={80}
|
|
93
|
+
intent="danger"
|
|
94
|
+
style={{ marginEnd: theme.space.small }}
|
|
95
|
+
/>
|
|
96
|
+
<Badge
|
|
97
|
+
content={99}
|
|
98
|
+
intent="info"
|
|
99
|
+
style={{ marginEnd: theme.space.small }}
|
|
100
|
+
/>
|
|
101
|
+
<Badge max={999} content={1000} intent="archived" />
|
|
102
|
+
</View>
|
|
103
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
104
|
+
Visible Badge
|
|
105
|
+
</Typography.Text>
|
|
106
|
+
<View
|
|
107
|
+
style={{
|
|
108
|
+
display: 'flex',
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
marginBottom: theme.space.large,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<View
|
|
114
|
+
style={{
|
|
115
|
+
display: 'flex',
|
|
116
|
+
flexDirection: 'row',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
marginEnd: theme.space.medium,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<Typography.Text style={{ marginEnd: theme.space.small }}>
|
|
122
|
+
Notes
|
|
123
|
+
</Typography.Text>
|
|
124
|
+
<Badge content={1} intent="archived" visible={isVisibleBadge} />
|
|
125
|
+
</View>
|
|
126
|
+
<Button
|
|
127
|
+
title="Click"
|
|
128
|
+
onPress={() => setIsVisibleBadge(visible => !visible)}
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
|
|
132
|
+
<Typography.Text fontWeight="semi-bold">Status</Typography.Text>
|
|
133
|
+
<View
|
|
134
|
+
style={{
|
|
135
|
+
display: 'flex',
|
|
136
|
+
flexDirection: 'row',
|
|
137
|
+
marginBottom: theme.space.small,
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
<Badge.Status style={{ marginEnd: theme.space.small }}>
|
|
141
|
+
<Icon icon="bell" size="small" />
|
|
142
|
+
</Badge.Status>
|
|
143
|
+
<Badge.Status intent="warning" style={{ marginEnd: theme.space.small }}>
|
|
144
|
+
<Icon icon="bell" size="small" />
|
|
145
|
+
</Badge.Status>
|
|
146
|
+
<Badge.Status intent="info" style={{ marginEnd: theme.space.small }}>
|
|
147
|
+
<Icon icon="bell" size="small" />
|
|
148
|
+
</Badge.Status>
|
|
149
|
+
<Badge.Status intent="success" style={{ marginEnd: theme.space.small }}>
|
|
150
|
+
<Icon icon="bell" size="small" />
|
|
151
|
+
</Badge.Status>
|
|
152
|
+
<Badge.Status
|
|
153
|
+
intent="archived"
|
|
154
|
+
style={{ marginEnd: theme.space.small }}
|
|
155
|
+
>
|
|
156
|
+
<Icon icon="bell" size="small" />
|
|
157
|
+
</Badge.Status>
|
|
158
|
+
<Badge.Status style={{ marginEnd: theme.space.small }}>
|
|
159
|
+
<Typography.Text>Activity</Typography.Text>
|
|
160
|
+
</Badge.Status>
|
|
161
|
+
</View>
|
|
162
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
163
|
+
Visible Status Badge
|
|
164
|
+
</Typography.Text>
|
|
165
|
+
<View
|
|
166
|
+
style={{
|
|
167
|
+
display: 'flex',
|
|
168
|
+
flexDirection: 'row',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
<Badge.Status
|
|
173
|
+
visible={isVisibleStatusBadge}
|
|
174
|
+
style={{ marginEnd: theme.space.small }}
|
|
175
|
+
>
|
|
176
|
+
<Typography.Text>Activity</Typography.Text>
|
|
177
|
+
</Badge.Status>
|
|
178
|
+
<Button
|
|
179
|
+
title="Click"
|
|
180
|
+
onPress={() => setIsVisibleStatusBadge(visible => !visible)}
|
|
181
|
+
/>
|
|
45
182
|
</View>
|
|
46
183
|
</View>
|
|
47
184
|
);
|
|
@@ -1,66 +1,169 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { Button, Typography, useTheme } from '../../src/index';
|
|
5
5
|
|
|
6
6
|
const ButtonPlayground = (): JSX.Element => {
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
return (
|
|
9
|
-
<
|
|
9
|
+
<ScrollView style={{ padding: theme.space.small }}>
|
|
10
10
|
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
11
|
-
|
|
11
|
+
Variants
|
|
12
12
|
</Typography.Text>
|
|
13
13
|
<View
|
|
14
14
|
style={{
|
|
15
|
-
flexDirection: '
|
|
16
|
-
alignItems: 'center',
|
|
15
|
+
flexDirection: 'column',
|
|
17
16
|
marginBottom: theme.space.large,
|
|
18
17
|
}}
|
|
19
18
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
<View
|
|
20
|
+
style={{
|
|
21
|
+
backgroundColor: theme.colors.primary,
|
|
22
|
+
paddingVertical: theme.space.large,
|
|
23
|
+
marginBottom: theme.space.medium,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<Button
|
|
27
|
+
text="Basic Transparent"
|
|
28
|
+
variant="basic-transparent"
|
|
29
|
+
onPress={() => {}}
|
|
30
|
+
/>
|
|
31
|
+
</View>
|
|
32
|
+
<Button
|
|
33
|
+
text="Primary (Filled)"
|
|
34
|
+
variant="filled"
|
|
35
|
+
intent="primary"
|
|
36
|
+
onPress={() => {}}
|
|
37
|
+
style={{ marginBottom: theme.space.medium }}
|
|
38
|
+
/>
|
|
39
|
+
<Button
|
|
40
|
+
text="Secondary (Filled)"
|
|
41
|
+
variant="filled"
|
|
42
|
+
intent="secondary"
|
|
24
43
|
onPress={() => {}}
|
|
25
|
-
style={{
|
|
44
|
+
style={{ marginBottom: theme.space.medium }}
|
|
26
45
|
/>
|
|
27
|
-
<Button
|
|
28
|
-
|
|
46
|
+
<Button
|
|
47
|
+
text="Primary (Outlined)"
|
|
48
|
+
variant="outlined"
|
|
29
49
|
intent="primary"
|
|
30
|
-
size="xsmall"
|
|
31
50
|
onPress={() => {}}
|
|
32
|
-
style={{
|
|
51
|
+
style={{ marginBottom: theme.space.medium }}
|
|
33
52
|
/>
|
|
34
|
-
<Button
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
<Button
|
|
54
|
+
text="Secondary (Outlined)"
|
|
55
|
+
variant="outlined"
|
|
56
|
+
intent="secondary"
|
|
38
57
|
onPress={() => {}}
|
|
39
|
-
style={{
|
|
58
|
+
style={{ marginBottom: theme.space.medium }}
|
|
40
59
|
/>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
</View>
|
|
61
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
62
|
+
With Icon
|
|
63
|
+
</Typography.Text>
|
|
64
|
+
<View
|
|
65
|
+
style={{
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
marginBottom: theme.space.large,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<Button
|
|
71
|
+
text="Add Item"
|
|
72
|
+
variant="filled"
|
|
73
|
+
intent="primary"
|
|
74
|
+
icon="add"
|
|
75
|
+
onPress={() => {}}
|
|
76
|
+
style={{ marginBottom: theme.space.medium }}
|
|
77
|
+
/>
|
|
78
|
+
<Button
|
|
79
|
+
text="Delete"
|
|
80
|
+
variant="filled"
|
|
81
|
+
intent="primary"
|
|
82
|
+
icon="trash-bin-outlined"
|
|
83
|
+
onPress={() => {}}
|
|
84
|
+
style={{ marginBottom: theme.space.medium }}
|
|
85
|
+
/>
|
|
86
|
+
<Button
|
|
87
|
+
text="More"
|
|
88
|
+
variant="outlined"
|
|
89
|
+
intent="secondary"
|
|
90
|
+
rightIcon="arrow-down"
|
|
91
|
+
onPress={() => {}}
|
|
92
|
+
style={{ marginBottom: theme.space.medium }}
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
95
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
96
|
+
Loading
|
|
97
|
+
</Typography.Text>
|
|
98
|
+
<View
|
|
99
|
+
style={{
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
marginBottom: theme.space.large,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<View
|
|
105
|
+
style={{
|
|
106
|
+
backgroundColor: theme.colors.primary,
|
|
107
|
+
paddingVertical: theme.space.large,
|
|
108
|
+
marginBottom: theme.space.medium,
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<Button
|
|
112
|
+
text="Basic Transparent (Loading)"
|
|
113
|
+
variant="basic-transparent"
|
|
114
|
+
onPress={() => {}}
|
|
115
|
+
loading
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
<Button
|
|
119
|
+
text="Filled (Loading)"
|
|
120
|
+
variant="filled"
|
|
121
|
+
intent="primary"
|
|
122
|
+
onPress={() => {}}
|
|
123
|
+
style={{ marginBottom: theme.space.medium }}
|
|
124
|
+
loading
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
text="Outlined (Loading)"
|
|
128
|
+
variant="outlined"
|
|
129
|
+
intent="primary"
|
|
130
|
+
onPress={() => {}}
|
|
131
|
+
style={{ marginBottom: theme.space.medium }}
|
|
132
|
+
loading
|
|
133
|
+
/>
|
|
134
|
+
</View>
|
|
135
|
+
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
136
|
+
Disabled
|
|
137
|
+
</Typography.Text>
|
|
138
|
+
<View
|
|
139
|
+
style={{
|
|
140
|
+
flexDirection: 'column',
|
|
141
|
+
marginBottom: theme.space.large,
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
<Button
|
|
145
|
+
text="Basic Transparent (Disabled)"
|
|
146
|
+
variant="basic-transparent"
|
|
45
147
|
onPress={() => {}}
|
|
46
|
-
style={{
|
|
148
|
+
style={{ marginBottom: theme.space.medium }}
|
|
149
|
+
disabled
|
|
47
150
|
/>
|
|
48
|
-
<Button
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
size="large"
|
|
151
|
+
<Button
|
|
152
|
+
text="Filled (Disabled)"
|
|
153
|
+
variant="filled"
|
|
52
154
|
onPress={() => {}}
|
|
53
|
-
style={{
|
|
155
|
+
style={{ marginBottom: theme.space.medium }}
|
|
156
|
+
disabled
|
|
54
157
|
/>
|
|
55
|
-
<Button
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
size="xlarge"
|
|
158
|
+
<Button
|
|
159
|
+
text="Outlined (Disabled)"
|
|
160
|
+
variant="outlined"
|
|
59
161
|
onPress={() => {}}
|
|
60
|
-
style={{
|
|
162
|
+
style={{ marginBottom: theme.space.medium }}
|
|
163
|
+
disabled
|
|
61
164
|
/>
|
|
62
165
|
</View>
|
|
63
|
-
</
|
|
166
|
+
</ScrollView>
|
|
64
167
|
);
|
|
65
168
|
};
|
|
66
169
|
|
|
@@ -179,7 +179,7 @@ const RostersCard = (props: ViewProps) => {
|
|
|
179
179
|
style={{
|
|
180
180
|
padding: theme.space.small,
|
|
181
181
|
backgroundColor: theme.colors.infoLight,
|
|
182
|
-
borderRadius:
|
|
182
|
+
borderRadius: theme.radii.rounded,
|
|
183
183
|
}}
|
|
184
184
|
>
|
|
185
185
|
<Icon icon="calendar-clock" />
|
|
@@ -265,6 +265,35 @@ const MyLeaveCard = (props: ViewProps) => {
|
|
|
265
265
|
);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
+
const DataCard = ({ style }: ViewProps) => {
|
|
269
|
+
const theme = useTheme();
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<Card variant="data" style={style}>
|
|
273
|
+
<View style={{ padding: theme.space.medium }}>
|
|
274
|
+
<Typography.Text fontSize="small" intent="subdued">
|
|
275
|
+
Update Key Results
|
|
276
|
+
</Typography.Text>
|
|
277
|
+
<Typography.Text
|
|
278
|
+
fontSize="xlarge"
|
|
279
|
+
fontWeight="semi-bold"
|
|
280
|
+
style={{ marginTop: theme.space.small }}
|
|
281
|
+
>
|
|
282
|
+
CX Global Ready
|
|
283
|
+
</Typography.Text>
|
|
284
|
+
<Typography.Text fontSize="small">From 20% to 25%</Typography.Text>
|
|
285
|
+
<Typography.Text
|
|
286
|
+
fontSize="small"
|
|
287
|
+
intent="subdued"
|
|
288
|
+
style={{ marginTop: theme.space.small }}
|
|
289
|
+
>
|
|
290
|
+
Making progress
|
|
291
|
+
</Typography.Text>
|
|
292
|
+
</View>
|
|
293
|
+
</Card>
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
|
|
268
297
|
const CardPlayground = () => {
|
|
269
298
|
const theme = useTheme();
|
|
270
299
|
|
|
@@ -300,6 +329,12 @@ const CardPlayground = () => {
|
|
|
300
329
|
<RostersCard style={{ marginTop: theme.space.medium }} />
|
|
301
330
|
<MyLeaveCard style={{ marginTop: theme.space.medium }} />
|
|
302
331
|
<ApprovalCard style={{ marginTop: theme.space.medium }} />
|
|
332
|
+
<DataCard
|
|
333
|
+
style={{
|
|
334
|
+
marginTop: theme.space.medium,
|
|
335
|
+
backgroundColor: palette.greyLight90,
|
|
336
|
+
}}
|
|
337
|
+
/>
|
|
303
338
|
</ScrollView>
|
|
304
339
|
);
|
|
305
340
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import palette from '@hero-design/colors';
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
Typography,
|
|
7
|
+
useTheme,
|
|
8
|
+
Button,
|
|
9
|
+
Card,
|
|
10
|
+
Collapse,
|
|
11
|
+
} from '../../src/index';
|
|
12
|
+
|
|
13
|
+
const CollapsePlayground = () => {
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
const source = { uri: 'https://i.pravatar.cc/300' };
|
|
16
|
+
const [isCollapsed, setIsCollapsed] = React.useState<boolean>(true);
|
|
17
|
+
|
|
18
|
+
const toggleContent = useCallback(() => {
|
|
19
|
+
setIsCollapsed(!isCollapsed);
|
|
20
|
+
}, [isCollapsed]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View
|
|
24
|
+
style={{
|
|
25
|
+
marginVertical: theme.space.medium,
|
|
26
|
+
marginHorizontal: theme.space.medium,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<Typography.Text style={{ marginBottom: theme.space.small }}>
|
|
30
|
+
Integrate as Accordion example
|
|
31
|
+
</Typography.Text>
|
|
32
|
+
<View>
|
|
33
|
+
<Card
|
|
34
|
+
style={{
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'space-between',
|
|
39
|
+
backgroundColor: palette.greyLight90,
|
|
40
|
+
padding: theme.space.medium,
|
|
41
|
+
...(isCollapsed
|
|
42
|
+
? {}
|
|
43
|
+
: {
|
|
44
|
+
borderBottomEndRadius: 0,
|
|
45
|
+
borderBottomStartRadius: 0,
|
|
46
|
+
}),
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<View
|
|
50
|
+
style={{
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Avatar source={source} />
|
|
57
|
+
<View
|
|
58
|
+
style={{
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
marginLeft: theme.space.medium,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Typography.Text fontSize="large">Rob Dunn</Typography.Text>
|
|
65
|
+
<Typography.Text fontSize="small" intent="subdued">
|
|
66
|
+
3 OKRS
|
|
67
|
+
</Typography.Text>
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
<Button.Icon
|
|
71
|
+
icon={`carat-${isCollapsed ? 'left' : 'down'}`}
|
|
72
|
+
intent="text"
|
|
73
|
+
size="xsmall"
|
|
74
|
+
onPress={toggleContent}
|
|
75
|
+
style={{ padding: theme.space.small }}
|
|
76
|
+
/>
|
|
77
|
+
</Card>
|
|
78
|
+
<Collapse
|
|
79
|
+
open={!isCollapsed}
|
|
80
|
+
style={{
|
|
81
|
+
backgroundColor: palette.greyLight90,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<View
|
|
85
|
+
style={{
|
|
86
|
+
padding: theme.space.large,
|
|
87
|
+
borderTopWidth: theme.space.xxsmall,
|
|
88
|
+
borderTopColor: palette.greyLight85,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Text>Hidden Content</Text>
|
|
92
|
+
</View>
|
|
93
|
+
</Collapse>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default CollapsePlayground;
|