@hero-design/rn 7.7.0 → 7.9.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/.turbo/turbo-build.log +2 -2
- package/es/index.js +1775 -333
- package/lib/index.js +1780 -336
- package/package.json +4 -8
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Avatar/index.tsx +1 -1
- package/src/components/Button/Button.tsx +4 -2
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +7 -2
- package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +2 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +40 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +242 -0
- package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +2 -0
- package/src/components/Button/LoadingIndicator/index.tsx +3 -1
- package/src/components/Button/StyledButton.tsx +15 -2
- package/src/components/Button/__tests__/Button.spec.tsx +2 -0
- package/src/components/Button/__tests__/StyledButton.spec.tsx +12 -0
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +314 -0
- package/src/components/Card/DataCard/StyledDataCard.tsx +18 -0
- package/src/components/Card/DataCard/__tests__/StyledDataCard.spec.tsx +24 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +96 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +151 -0
- package/src/components/Card/DataCard/__tests__/index.spec.tsx +30 -0
- package/src/components/Card/DataCard/index.tsx +35 -0
- package/src/components/Card/StyledCard.tsx +1 -3
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +0 -1
- package/src/components/Card/index.tsx +7 -2
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Collapse/index.tsx +1 -1
- package/src/components/Icon/HeroIcon/index.tsx +3 -1
- package/src/components/Icon/index.tsx +3 -2
- package/src/components/List/BasicListItem.tsx +98 -0
- package/src/components/List/ListItem.tsx +142 -0
- package/src/components/List/StyledBasicListItem.tsx +34 -0
- package/src/components/List/StyledListItem.tsx +82 -0
- package/src/components/List/__tests__/BasicListItem.spec.tsx +37 -0
- package/src/components/List/__tests__/ListItem.spec.tsx +110 -0
- package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +24 -0
- package/src/components/List/__tests__/StyledListItem.spec.tsx +48 -0
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +103 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +760 -0
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +105 -0
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +200 -0
- package/src/components/List/index.tsx +14 -0
- package/src/components/SectionHeading/index.tsx +1 -1
- package/src/components/Select/Footer.tsx +13 -0
- package/src/components/Select/MultiSelect/Option.tsx +25 -0
- package/src/components/Select/MultiSelect/OptionList.tsx +30 -63
- package/src/components/Select/MultiSelect/__tests__/Option.spec.tsx +16 -0
- package/src/components/Select/MultiSelect/__tests__/OptionList.spec.tsx +42 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +70 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +627 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +6 -6
- package/src/components/Select/MultiSelect/index.tsx +8 -7
- package/src/components/Select/SingleSelect/Option.tsx +23 -0
- package/src/components/Select/SingleSelect/OptionList.tsx +43 -0
- package/src/components/Select/SingleSelect/__tests__/Option.spec.tsx +16 -0
- package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +42 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +56 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +571 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1430 -0
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +89 -0
- package/src/components/Select/SingleSelect/index.tsx +89 -0
- package/src/components/Select/{MultiSelect/StyledMultiSelect.tsx → StyledSelect.tsx} +1 -1
- package/src/components/Select/{MultiSelect/__tests__/StyledMultiSelect.spec.tsx → __tests__/StyledSelect.spec.tsx} +2 -2
- package/src/components/Select/{MultiSelect/__tests__/__snapshots__/StyledMultiSelect.spec.tsx.snap → __tests__/__snapshots__/StyledSelect.spec.tsx.snap} +0 -0
- package/src/components/Select/helpers.tsx +18 -0
- package/src/components/Select/index.tsx +4 -3
- package/src/components/Select/{MultiSelect/types.ts → types.ts} +0 -0
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +2 -2
- package/src/components/Toolbar/StyledToolbar.tsx +42 -0
- package/src/components/Toolbar/ToolbarGroup.tsx +31 -0
- package/src/components/Toolbar/ToolbarItem.tsx +57 -0
- package/src/components/Toolbar/__tests__/ToolbarGroup.spec.tsx +32 -0
- package/src/components/Toolbar/__tests__/ToolbarItem.spec.tsx +57 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +391 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +355 -0
- package/src/components/Toolbar/index.tsx +18 -0
- package/src/components/Typography/Text/StyledText.tsx +8 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +5 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +110 -0
- package/src/components/Typography/Text/index.tsx +9 -2
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +83 -3
- package/src/theme/components/button.ts +2 -0
- package/src/theme/components/card.ts +13 -2
- package/src/theme/components/icon.ts +1 -0
- package/src/theme/components/list.ts +46 -0
- package/src/theme/components/toolbar.ts +27 -0
- package/src/theme/components/typography.ts +4 -0
- package/src/theme/global/colors.ts +9 -2
- package/src/theme/global/space.ts +2 -0
- package/src/theme/index.ts +6 -0
- package/tsconfig.json +1 -2
- package/types/components/Avatar/index.d.ts +1 -1
- package/types/components/Button/Button.d.ts +2 -2
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +2 -2
- package/types/components/Card/DataCard/StyledDataCard.d.ts +16 -0
- package/types/components/{Select/MultiSelect/__tests__/StyledMultiSelect.spec.d.ts → Card/DataCard/__tests__/StyledDataCard.spec.d.ts} +0 -0
- package/types/components/Card/DataCard/__tests__/index.spec.d.ts +1 -0
- package/types/components/Card/DataCard/index.d.ts +22 -0
- package/types/components/Card/index.d.ts +7 -3
- package/types/components/Checkbox/index.d.ts +1 -1
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/Icon/HeroIcon/index.d.ts +1 -1
- package/types/components/Icon/index.d.ts +2 -2
- package/types/components/List/BasicListItem.d.ts +43 -0
- package/types/components/List/ListItem.d.ts +51 -0
- package/types/components/List/StyledBasicListItem.d.ts +29 -0
- package/types/components/List/StyledListItem.d.ts +51 -0
- package/types/components/List/__tests__/BasicListItem.spec.d.ts +1 -0
- package/types/components/List/__tests__/ListItem.spec.d.ts +1 -0
- package/types/components/List/__tests__/StyledBasicListItem.spec.d.ts +1 -0
- package/types/components/List/__tests__/StyledListItem.spec.d.ts +1 -0
- package/types/components/List/index.d.ts +8 -0
- package/types/components/SectionHeading/index.d.ts +1 -1
- package/types/components/Select/{MultiSelect/Footer.d.ts → Footer.d.ts} +2 -2
- package/types/components/Select/MultiSelect/Option.d.ts +6 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +7 -1
- package/types/components/Select/MultiSelect/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Select/MultiSelect/__tests__/OptionList.spec.d.ts +1 -0
- package/types/components/Select/MultiSelect/index.d.ts +4 -4
- package/types/components/Select/SingleSelect/Option.d.ts +6 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +9 -0
- package/types/components/Select/SingleSelect/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Select/SingleSelect/__tests__/OptionList.spec.d.ts +1 -0
- package/types/components/Select/SingleSelect/__tests__/index.spec.d.ts +1 -0
- package/types/components/Select/SingleSelect/index.d.ts +35 -0
- package/types/components/Select/{MultiSelect/StyledMultiSelect.d.ts → StyledSelect.d.ts} +1 -1
- package/types/components/Select/__tests__/StyledSelect.spec.d.ts +1 -0
- package/types/components/Select/helpers.d.ts +2 -0
- package/types/components/Select/index.d.ts +3 -3
- package/types/components/Select/{MultiSelect/types.d.ts → types.d.ts} +0 -0
- package/types/components/Switch/index.d.ts +1 -1
- package/types/components/Toolbar/StyledToolbar.d.ts +22 -0
- package/types/components/Toolbar/ToolbarGroup.d.ts +13 -0
- package/types/components/Toolbar/ToolbarItem.d.ts +25 -0
- package/types/components/Toolbar/__tests__/ToolbarGroup.spec.d.ts +1 -0
- package/types/components/Toolbar/__tests__/ToolbarItem.spec.d.ts +1 -0
- package/types/components/Toolbar/index.d.ts +11 -0
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/index.d.ts +2 -2
- package/types/index.d.ts +3 -1
- package/types/theme/components/button.d.ts +2 -0
- package/types/theme/components/card.d.ts +10 -0
- package/types/theme/components/icon.d.ts +1 -0
- package/types/theme/components/list.d.ts +40 -0
- package/types/theme/components/toolbar.d.ts +21 -0
- package/types/theme/components/typography.d.ts +4 -0
- package/types/theme/global/colors.d.ts +5 -0
- package/types/theme/global/index.d.ts +5 -0
- package/types/theme/global/space.d.ts +1 -0
- package/types/theme/index.d.ts +4 -0
- package/playground/.detoxrc.json +0 -49
- package/playground/.prettierrc.json +0 -8
- package/playground/.turbo/turbo-type-check.log +0 -7
- package/playground/app.json +0 -9
- package/playground/babel.config.js +0 -63
- package/playground/e2e/config.json +0 -9
- package/playground/e2e/environment.js +0 -23
- package/playground/e2e/firstTest.e2e.js +0 -16
- package/playground/expoEntry.js +0 -5
- package/playground/fonts/be-vietnam-pro-light.ttf +0 -0
- package/playground/fonts/be-vietnam-pro-regular.ttf +0 -0
- package/playground/fonts/be-vietnam-pro-semibold.ttf +0 -0
- package/playground/fonts/hero-icons.ttf +0 -0
- package/playground/index.js +0 -7
- package/playground/ios/MobileHeroDesignPlayground/AppDelegate.h +0 -9
- package/playground/ios/MobileHeroDesignPlayground/AppDelegate.m +0 -75
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/AppIcon.appiconset/Contents.json +0 -38
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/Contents.json +0 -6
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
- package/playground/ios/MobileHeroDesignPlayground/Info.plist +0 -85
- package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground-Bridging-Header.h +0 -3
- package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground.entitlements +0 -8
- package/playground/ios/MobileHeroDesignPlayground/SplashScreen.storyboard +0 -40
- package/playground/ios/MobileHeroDesignPlayground/Supporting/Expo.plist +0 -16
- package/playground/ios/MobileHeroDesignPlayground/main.m +0 -10
- package/playground/ios/MobileHeroDesignPlayground/noop-file.swift +0 -4
- package/playground/ios/MobileHeroDesignPlayground.xcodeproj/project.pbxproj +0 -515
- package/playground/ios/MobileHeroDesignPlayground.xcodeproj/xcshareddata/xcschemes/MobileHeroDesignPlayground.xcscheme +0 -88
- package/playground/ios/MobileHeroDesignPlayground.xcworkspace/contents.xcworkspacedata +0 -10
- package/playground/ios/MobileHeroDesignPlayground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/playground/ios/Podfile +0 -49
- package/playground/ios/Podfile.lock +0 -478
- package/playground/ios/Podfile.properties.json +0 -3
- package/playground/metro.config.js +0 -24
- package/playground/package.json +0 -63
- package/playground/src/Alert.tsx +0 -80
- package/playground/src/App.tsx +0 -210
- package/playground/src/Avatar.tsx +0 -102
- package/playground/src/Badge.tsx +0 -187
- package/playground/src/BottomNavigation.tsx +0 -72
- package/playground/src/BottomSheet.tsx +0 -43
- package/playground/src/Button.tsx +0 -170
- package/playground/src/Card.tsx +0 -342
- package/playground/src/Checkbox.tsx +0 -55
- package/playground/src/Collapse.tsx +0 -99
- package/playground/src/ContentNavigator.tsx +0 -58
- package/playground/src/Divider.tsx +0 -13
- package/playground/src/Drawer.tsx +0 -32
- package/playground/src/FAB.tsx +0 -66
- package/playground/src/Icon.tsx +0 -144
- package/playground/src/IconButton.tsx +0 -78
- package/playground/src/MultipleThemes.tsx +0 -34
- package/playground/src/Progress.tsx +0 -95
- package/playground/src/Radio.tsx +0 -25
- package/playground/src/SectionHeading.tsx +0 -68
- package/playground/src/Select.tsx +0 -32
- package/playground/src/Spinner.tsx +0 -19
- package/playground/src/Switch.tsx +0 -80
- package/playground/src/Tabs.tsx +0 -136
- package/playground/src/Tag.tsx +0 -45
- package/playground/src/TextInput.tsx +0 -14
- package/playground/src/Toast.tsx +0 -114
- package/playground/src/Typography.tsx +0 -23
- package/playground/tsconfig.json +0 -21
- package/src/components/Select/MultiSelect/Footer.tsx +0 -15
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScrollView, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Button, Typography, useTheme } from '@hero-design/rn';
|
|
5
|
-
|
|
6
|
-
const ButtonPlayground = (): JSX.Element => {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
return (
|
|
9
|
-
<ScrollView style={{ padding: theme.space.small }}>
|
|
10
|
-
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
11
|
-
Variants
|
|
12
|
-
</Typography.Text>
|
|
13
|
-
<View
|
|
14
|
-
style={{
|
|
15
|
-
flexDirection: 'column',
|
|
16
|
-
marginBottom: theme.space.large,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
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"
|
|
43
|
-
onPress={() => {}}
|
|
44
|
-
style={{ marginBottom: theme.space.medium }}
|
|
45
|
-
/>
|
|
46
|
-
<Button
|
|
47
|
-
text="Primary (Outlined)"
|
|
48
|
-
variant="outlined"
|
|
49
|
-
intent="primary"
|
|
50
|
-
onPress={() => {}}
|
|
51
|
-
style={{ marginBottom: theme.space.medium }}
|
|
52
|
-
/>
|
|
53
|
-
<Button
|
|
54
|
-
text="Secondary (Outlined)"
|
|
55
|
-
variant="outlined"
|
|
56
|
-
intent="secondary"
|
|
57
|
-
onPress={() => {}}
|
|
58
|
-
style={{ marginBottom: theme.space.medium }}
|
|
59
|
-
/>
|
|
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"
|
|
147
|
-
onPress={() => {}}
|
|
148
|
-
style={{ marginBottom: theme.space.medium }}
|
|
149
|
-
disabled
|
|
150
|
-
/>
|
|
151
|
-
<Button
|
|
152
|
-
text="Filled (Disabled)"
|
|
153
|
-
variant="filled"
|
|
154
|
-
onPress={() => {}}
|
|
155
|
-
style={{ marginBottom: theme.space.medium }}
|
|
156
|
-
disabled
|
|
157
|
-
/>
|
|
158
|
-
<Button
|
|
159
|
-
text="Outlined (Disabled)"
|
|
160
|
-
variant="outlined"
|
|
161
|
-
onPress={() => {}}
|
|
162
|
-
style={{ marginBottom: theme.space.medium }}
|
|
163
|
-
disabled
|
|
164
|
-
/>
|
|
165
|
-
</View>
|
|
166
|
-
</ScrollView>
|
|
167
|
-
);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export default ButtonPlayground;
|
package/playground/src/Card.tsx
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
ViewProps,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
ScrollView,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import palette from '@hero-design/colors';
|
|
10
|
-
import {
|
|
11
|
-
scale,
|
|
12
|
-
Card,
|
|
13
|
-
Typography,
|
|
14
|
-
Icon,
|
|
15
|
-
Divider,
|
|
16
|
-
useTheme,
|
|
17
|
-
} from '@hero-design/rn';
|
|
18
|
-
|
|
19
|
-
type DashboardCardProps = ViewProps & {
|
|
20
|
-
icon: ComponentProps<typeof Icon>['icon'];
|
|
21
|
-
title: string;
|
|
22
|
-
subtitle: string;
|
|
23
|
-
};
|
|
24
|
-
type PendingItemProps = {
|
|
25
|
-
count: number;
|
|
26
|
-
title: string;
|
|
27
|
-
onPress?: () => void;
|
|
28
|
-
wrapperTestID?: string;
|
|
29
|
-
countTestID?: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const PendingItem = ({
|
|
33
|
-
count,
|
|
34
|
-
title,
|
|
35
|
-
onPress,
|
|
36
|
-
wrapperTestID,
|
|
37
|
-
countTestID,
|
|
38
|
-
}: Omit<PendingItemProps, 'isLoading'>) => {
|
|
39
|
-
const theme = useTheme();
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<TouchableOpacity
|
|
43
|
-
onPress={onPress}
|
|
44
|
-
style={{ flex: 1, padding: theme.space.small }}
|
|
45
|
-
testID={wrapperTestID}
|
|
46
|
-
>
|
|
47
|
-
<Typography.Text
|
|
48
|
-
fontSize="xlarge"
|
|
49
|
-
fontWeight="semi-bold"
|
|
50
|
-
style={{
|
|
51
|
-
textAlign: 'center',
|
|
52
|
-
paddingBottom: theme.space.small,
|
|
53
|
-
color: palette.redLight15,
|
|
54
|
-
}}
|
|
55
|
-
testID={countTestID}
|
|
56
|
-
>
|
|
57
|
-
{count}
|
|
58
|
-
</Typography.Text>
|
|
59
|
-
<Typography.Text
|
|
60
|
-
style={{ textAlign: 'center', color: palette.greyDark75 }}
|
|
61
|
-
>
|
|
62
|
-
{title}
|
|
63
|
-
</Typography.Text>
|
|
64
|
-
</TouchableOpacity>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const ApprovalCard = ({ style }: ViewProps) => {
|
|
69
|
-
const theme = useTheme();
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<Card
|
|
73
|
-
style={StyleSheet.flatten([
|
|
74
|
-
{ backgroundColor: palette.greyLight90 },
|
|
75
|
-
style,
|
|
76
|
-
])}
|
|
77
|
-
>
|
|
78
|
-
<View
|
|
79
|
-
style={{
|
|
80
|
-
backgroundColor: palette.redLight60,
|
|
81
|
-
display: 'flex',
|
|
82
|
-
flexDirection: 'row',
|
|
83
|
-
padding: theme.space.medium,
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<Icon
|
|
87
|
-
icon="multiple-users"
|
|
88
|
-
style={{ marginRight: theme.space.small }}
|
|
89
|
-
/>
|
|
90
|
-
<Typography.Text fontWeight="semi-bold" fontSize="large">
|
|
91
|
-
Awaiting your approval
|
|
92
|
-
</Typography.Text>
|
|
93
|
-
</View>
|
|
94
|
-
<View
|
|
95
|
-
style={{ flex: 1, flexDirection: 'row', padding: theme.space.small }}
|
|
96
|
-
>
|
|
97
|
-
<PendingItem count={1} title="Timesheets" />
|
|
98
|
-
<PendingItem count={2} title="Leave Requests" />
|
|
99
|
-
<PendingItem count={7} title="Expense Claims" />
|
|
100
|
-
</View>
|
|
101
|
-
</Card>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const DashboardCard = ({
|
|
106
|
-
style,
|
|
107
|
-
icon,
|
|
108
|
-
title,
|
|
109
|
-
subtitle,
|
|
110
|
-
}: DashboardCardProps) => {
|
|
111
|
-
const theme = useTheme();
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<Card style={StyleSheet.flatten([{ padding: theme.space.small }, style])}>
|
|
115
|
-
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
|
116
|
-
<Icon icon={icon} />
|
|
117
|
-
</View>
|
|
118
|
-
<View
|
|
119
|
-
style={{
|
|
120
|
-
flex: 1,
|
|
121
|
-
justifyContent: 'flex-end',
|
|
122
|
-
margin: theme.space.small,
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
126
|
-
{title}
|
|
127
|
-
</Typography.Text>
|
|
128
|
-
<Typography.Text fontSize="medium">{subtitle}</Typography.Text>
|
|
129
|
-
</View>
|
|
130
|
-
</Card>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const InductionCard = (props: ViewProps) => (
|
|
135
|
-
<DashboardCard
|
|
136
|
-
icon="file-verified"
|
|
137
|
-
title="Induction Content"
|
|
138
|
-
subtitle="2 files to acknowledge"
|
|
139
|
-
{...props}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
const PoliciesCard = (props: ViewProps) => (
|
|
143
|
-
<DashboardCard
|
|
144
|
-
icon="file-secured"
|
|
145
|
-
title="Policies"
|
|
146
|
-
subtitle="1 to acknowledge"
|
|
147
|
-
{...props}
|
|
148
|
-
/>
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const CertificationsCard = (props: ViewProps) => (
|
|
152
|
-
<DashboardCard
|
|
153
|
-
icon="file-certified"
|
|
154
|
-
title="Certifications"
|
|
155
|
-
subtitle="1 to update"
|
|
156
|
-
{...props}
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
const RostersCard = (props: ViewProps) => {
|
|
161
|
-
const theme = useTheme();
|
|
162
|
-
const { style, ...otherProps } = props;
|
|
163
|
-
|
|
164
|
-
return (
|
|
165
|
-
<Card
|
|
166
|
-
{...otherProps}
|
|
167
|
-
style={StyleSheet.flatten([
|
|
168
|
-
{
|
|
169
|
-
flexDirection: 'row',
|
|
170
|
-
alignItems: 'center',
|
|
171
|
-
backgroundColor: palette.greyLight90,
|
|
172
|
-
padding: theme.space.small,
|
|
173
|
-
},
|
|
174
|
-
style,
|
|
175
|
-
])}
|
|
176
|
-
>
|
|
177
|
-
<View style={{ padding: theme.space.small }}>
|
|
178
|
-
<View
|
|
179
|
-
style={{
|
|
180
|
-
padding: theme.space.small,
|
|
181
|
-
backgroundColor: theme.colors.infoLight,
|
|
182
|
-
borderRadius: theme.radii.rounded,
|
|
183
|
-
}}
|
|
184
|
-
>
|
|
185
|
-
<Icon icon="calendar-clock" />
|
|
186
|
-
</View>
|
|
187
|
-
</View>
|
|
188
|
-
<View style={{ flex: 1, marginLeft: theme.space.small }}>
|
|
189
|
-
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
190
|
-
Rosters
|
|
191
|
-
</Typography.Text>
|
|
192
|
-
<Typography.Text fontSize="large">3 shifts this week</Typography.Text>
|
|
193
|
-
</View>
|
|
194
|
-
<Icon icon="arrow-right" />
|
|
195
|
-
</Card>
|
|
196
|
-
);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const MyLeaveCard = (props: ViewProps) => {
|
|
200
|
-
const theme = useTheme();
|
|
201
|
-
const { style, ...otherProps } = props;
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<Card
|
|
205
|
-
{...otherProps}
|
|
206
|
-
style={StyleSheet.flatten([
|
|
207
|
-
{
|
|
208
|
-
backgroundColor: palette.greyLight90,
|
|
209
|
-
},
|
|
210
|
-
style,
|
|
211
|
-
])}
|
|
212
|
-
>
|
|
213
|
-
<View
|
|
214
|
-
style={{
|
|
215
|
-
padding: theme.space.medium,
|
|
216
|
-
justifyContent: 'space-between',
|
|
217
|
-
flexDirection: 'row',
|
|
218
|
-
}}
|
|
219
|
-
>
|
|
220
|
-
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
221
|
-
My Leave
|
|
222
|
-
</Typography.Text>
|
|
223
|
-
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
224
|
-
<Typography.Text fontSize="large" fontWeight="semi-bold">
|
|
225
|
-
Add / view
|
|
226
|
-
</Typography.Text>
|
|
227
|
-
<Icon
|
|
228
|
-
icon="circle-add-outlined"
|
|
229
|
-
size="xsmall"
|
|
230
|
-
style={{ marginLeft: theme.space.small }}
|
|
231
|
-
/>
|
|
232
|
-
</View>
|
|
233
|
-
</View>
|
|
234
|
-
<Divider />
|
|
235
|
-
<View style={{ padding: theme.space.medium }}>
|
|
236
|
-
<Typography.Text
|
|
237
|
-
fontSize="large"
|
|
238
|
-
fontWeight="semi-bold"
|
|
239
|
-
style={{ marginBottom: theme.space.small }}
|
|
240
|
-
>
|
|
241
|
-
Leave Balances
|
|
242
|
-
</Typography.Text>
|
|
243
|
-
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
244
|
-
<Typography.Text fontSize="large">Jury Duty</Typography.Text>
|
|
245
|
-
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
246
|
-
</View>
|
|
247
|
-
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
248
|
-
<Typography.Text fontSize="large">Annual Leave</Typography.Text>
|
|
249
|
-
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
250
|
-
</View>
|
|
251
|
-
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
252
|
-
<Typography.Text fontSize="large">
|
|
253
|
-
Values Champion Award
|
|
254
|
-
</Typography.Text>
|
|
255
|
-
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
256
|
-
</View>
|
|
257
|
-
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
258
|
-
<Typography.Text fontSize="large">
|
|
259
|
-
Family and Domestic
|
|
260
|
-
</Typography.Text>
|
|
261
|
-
<Typography.Text fontWeight="semi-bold">12.06 hrs</Typography.Text>
|
|
262
|
-
</View>
|
|
263
|
-
</View>
|
|
264
|
-
</Card>
|
|
265
|
-
);
|
|
266
|
-
};
|
|
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
|
-
|
|
297
|
-
const CardPlayground = () => {
|
|
298
|
-
const theme = useTheme();
|
|
299
|
-
|
|
300
|
-
return (
|
|
301
|
-
<ScrollView contentContainerStyle={{ padding: theme.space.medium }}>
|
|
302
|
-
<View style={{ flexDirection: 'row', height: scale(216) }}>
|
|
303
|
-
<View style={{ flex: 1, marginRight: theme.space.medium }}>
|
|
304
|
-
<InductionCard
|
|
305
|
-
style={{
|
|
306
|
-
flex: 1,
|
|
307
|
-
backgroundColor: theme.colors.primaryLight,
|
|
308
|
-
}}
|
|
309
|
-
/>
|
|
310
|
-
</View>
|
|
311
|
-
<View style={{ flex: 1 }}>
|
|
312
|
-
<PoliciesCard
|
|
313
|
-
style={{
|
|
314
|
-
flex: 1,
|
|
315
|
-
backgroundColor: theme.colors.infoLight,
|
|
316
|
-
marginBottom: theme.space.medium,
|
|
317
|
-
}}
|
|
318
|
-
testID="policies"
|
|
319
|
-
/>
|
|
320
|
-
<CertificationsCard
|
|
321
|
-
style={{
|
|
322
|
-
flex: 1,
|
|
323
|
-
backgroundColor: theme.colors.infoLight,
|
|
324
|
-
}}
|
|
325
|
-
testID="certifications"
|
|
326
|
-
/>
|
|
327
|
-
</View>
|
|
328
|
-
</View>
|
|
329
|
-
<RostersCard style={{ marginTop: theme.space.medium }} />
|
|
330
|
-
<MyLeaveCard style={{ marginTop: theme.space.medium }} />
|
|
331
|
-
<ApprovalCard style={{ marginTop: theme.space.medium }} />
|
|
332
|
-
<DataCard
|
|
333
|
-
style={{
|
|
334
|
-
marginTop: theme.space.medium,
|
|
335
|
-
backgroundColor: palette.greyLight90,
|
|
336
|
-
}}
|
|
337
|
-
/>
|
|
338
|
-
</ScrollView>
|
|
339
|
-
);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
export default CardPlayground;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Checkbox, Typography, useTheme } from '@hero-design/rn';
|
|
4
|
-
|
|
5
|
-
type StateIndex = 'boxOne' | 'boxTwo';
|
|
6
|
-
|
|
7
|
-
type CheckboxStates = {
|
|
8
|
-
boxOne: boolean;
|
|
9
|
-
boxTwo: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const CheckboxPlayground = () => {
|
|
13
|
-
const theme = useTheme();
|
|
14
|
-
|
|
15
|
-
const [isChecked, setIsChecked] = React.useState<CheckboxStates>({
|
|
16
|
-
boxOne: true,
|
|
17
|
-
boxTwo: false,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const toggleState = React.useCallback(
|
|
21
|
-
(checkboxId: StateIndex) =>
|
|
22
|
-
setIsChecked({
|
|
23
|
-
...isChecked,
|
|
24
|
-
[checkboxId]: !isChecked[checkboxId],
|
|
25
|
-
}),
|
|
26
|
-
[isChecked]
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<View
|
|
31
|
-
style={{
|
|
32
|
-
margin: theme.space.medium,
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<Typography.Text style={{ marginBottom: theme.space.xsmall }}>
|
|
36
|
-
Default usage
|
|
37
|
-
</Typography.Text>
|
|
38
|
-
<View>
|
|
39
|
-
<Checkbox
|
|
40
|
-
checked={isChecked.boxOne}
|
|
41
|
-
onPress={() => toggleState('boxOne')}
|
|
42
|
-
/>
|
|
43
|
-
<Checkbox
|
|
44
|
-
style={{ marginTop: theme.space.small }}
|
|
45
|
-
checked={isChecked.boxTwo}
|
|
46
|
-
onPress={() => toggleState('boxTwo')}
|
|
47
|
-
/>
|
|
48
|
-
<Checkbox style={{ marginTop: theme.space.small }} checked disabled />
|
|
49
|
-
<Checkbox style={{ marginTop: theme.space.small }} disabled />
|
|
50
|
-
</View>
|
|
51
|
-
</View>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default CheckboxPlayground;
|
|
@@ -1,99 +0,0 @@
|
|
|
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 '@hero-design/rn';
|
|
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;
|