@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,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Switch, Typography, useTheme } from '@hero-design/rn';
|
|
5
|
-
|
|
6
|
-
type StateIndex = 'switchOne' | 'switchTwo' | 'switchThree' | 'switchFour';
|
|
7
|
-
|
|
8
|
-
type SwitchStates = {
|
|
9
|
-
switchOne: boolean;
|
|
10
|
-
switchTwo: boolean;
|
|
11
|
-
switchThree: boolean;
|
|
12
|
-
switchFour: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const SwitchPlayground = () => {
|
|
16
|
-
const theme = useTheme();
|
|
17
|
-
|
|
18
|
-
const [isChecked, setIsChecked] = React.useState<SwitchStates>({
|
|
19
|
-
switchOne: true,
|
|
20
|
-
switchTwo: false,
|
|
21
|
-
switchThree: true,
|
|
22
|
-
switchFour: false,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const toggleState = React.useCallback(
|
|
26
|
-
(switchId: StateIndex) =>
|
|
27
|
-
setIsChecked({
|
|
28
|
-
...isChecked,
|
|
29
|
-
[switchId]: !isChecked[switchId],
|
|
30
|
-
}),
|
|
31
|
-
[isChecked]
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<View
|
|
36
|
-
style={{
|
|
37
|
-
margin: theme.space.medium,
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<Typography.Text style={{ marginVertical: theme.space.xsmall }}>
|
|
41
|
-
Medium size
|
|
42
|
-
</Typography.Text>
|
|
43
|
-
<Switch
|
|
44
|
-
checked={isChecked.switchOne}
|
|
45
|
-
onPress={() => toggleState('switchOne')}
|
|
46
|
-
/>
|
|
47
|
-
<Switch
|
|
48
|
-
style={{ marginTop: theme.space.small }}
|
|
49
|
-
checked={isChecked.switchTwo}
|
|
50
|
-
onPress={() => toggleState('switchTwo')}
|
|
51
|
-
/>
|
|
52
|
-
<Switch checked disabled style={{ marginTop: theme.space.small }} />
|
|
53
|
-
<Switch disabled style={{ marginTop: theme.space.small }} />
|
|
54
|
-
|
|
55
|
-
<Typography.Text style={{ marginVertical: theme.space.xsmall }}>
|
|
56
|
-
Small size
|
|
57
|
-
</Typography.Text>
|
|
58
|
-
<Switch
|
|
59
|
-
size="small"
|
|
60
|
-
checked={isChecked.switchThree}
|
|
61
|
-
onPress={() => toggleState('switchThree')}
|
|
62
|
-
/>
|
|
63
|
-
<Switch
|
|
64
|
-
style={{ marginTop: theme.space.small }}
|
|
65
|
-
size="small"
|
|
66
|
-
checked={isChecked.switchFour}
|
|
67
|
-
onPress={() => toggleState('switchFour')}
|
|
68
|
-
/>
|
|
69
|
-
<Switch
|
|
70
|
-
checked
|
|
71
|
-
disabled
|
|
72
|
-
style={{ marginTop: theme.space.small }}
|
|
73
|
-
size="small"
|
|
74
|
-
/>
|
|
75
|
-
<Switch disabled style={{ marginTop: theme.space.small }} size="small" />
|
|
76
|
-
</View>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export default SwitchPlayground;
|
package/playground/src/Tabs.tsx
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
Tabs,
|
|
5
|
-
Typography,
|
|
6
|
-
TabType,
|
|
7
|
-
Icon,
|
|
8
|
-
useTheme,
|
|
9
|
-
IconName,
|
|
10
|
-
} from '@hero-design/rn';
|
|
11
|
-
|
|
12
|
-
const CustomScreen = ({ title }: { title: string }) => (
|
|
13
|
-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
14
|
-
<Typography.Text>{title}</Typography.Text>
|
|
15
|
-
</View>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const CustomItem = ({
|
|
19
|
-
color,
|
|
20
|
-
icon,
|
|
21
|
-
title,
|
|
22
|
-
}: {
|
|
23
|
-
color: string;
|
|
24
|
-
icon: IconName;
|
|
25
|
-
title: string;
|
|
26
|
-
}) => {
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<View style={{ display: 'flex', flexDirection: 'row' }}>
|
|
31
|
-
<Icon
|
|
32
|
-
icon={icon}
|
|
33
|
-
size="small"
|
|
34
|
-
style={{ color, marginEnd: theme.space.small }}
|
|
35
|
-
/>
|
|
36
|
-
<Typography.Text
|
|
37
|
-
fontWeight="semi-bold"
|
|
38
|
-
numberOfLines={1}
|
|
39
|
-
style={{ color }}
|
|
40
|
-
>
|
|
41
|
-
{title}
|
|
42
|
-
</Typography.Text>
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const workTabs: TabType[] = [
|
|
48
|
-
{
|
|
49
|
-
key: 'activity',
|
|
50
|
-
activeItem: 'Activity',
|
|
51
|
-
component: <CustomScreen title="Activity" />,
|
|
52
|
-
showBadge: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: 'news',
|
|
56
|
-
activeItem: `What's new`,
|
|
57
|
-
component: <CustomScreen title="News" />,
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
const WorkScreen = () => {
|
|
62
|
-
const [selectedTabKey, setSelectedTabKey] = React.useState('activity');
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Tabs
|
|
66
|
-
onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
|
|
67
|
-
selectedTabKey={selectedTabKey}
|
|
68
|
-
tabs={workTabs}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const tabs: TabType[] = [
|
|
74
|
-
{
|
|
75
|
-
key: 'work',
|
|
76
|
-
activeItem: ({ color }) => (
|
|
77
|
-
<CustomItem color={color} icon="home-outlined" title="Home" />
|
|
78
|
-
),
|
|
79
|
-
inactiveItem: 'home-outlined',
|
|
80
|
-
component: <WorkScreen />,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
key: 'personal',
|
|
84
|
-
activeItem: ({ color }) => (
|
|
85
|
-
<CustomItem color={color} icon="bell-outlined" title="Notifications" />
|
|
86
|
-
),
|
|
87
|
-
inactiveItem: 'bell-outlined',
|
|
88
|
-
component: <CustomScreen title="Notifications Screen" />,
|
|
89
|
-
showBadge: true,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
key: 'speaker',
|
|
93
|
-
activeItem: ({ color }) => (
|
|
94
|
-
<CustomItem color={color} icon="speaker-outlined" title="Shoutouts" />
|
|
95
|
-
),
|
|
96
|
-
inactiveItem: 'speaker-outlined',
|
|
97
|
-
component: <CustomScreen title="Shoutouts Screen" />,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
key: 'payslips',
|
|
101
|
-
activeItem: 'Payslips',
|
|
102
|
-
component: <CustomScreen title="Payslips Screen" />,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
key: 'leave',
|
|
106
|
-
activeItem: 'Leave',
|
|
107
|
-
component: <CustomScreen title="Leave Screen" />,
|
|
108
|
-
showBadge: true,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
key: 'rosters',
|
|
112
|
-
activeItem: 'Rosters',
|
|
113
|
-
component: <CustomScreen title="Rosters Screen" />,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
key: 'timesheets',
|
|
117
|
-
activeItem: 'Timesheets',
|
|
118
|
-
component: <CustomScreen title="Timesheets Screen" />,
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
const TabsPlayground = () => {
|
|
123
|
-
const [selectedTabKey, setSelectedTabKey] = React.useState('work');
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<Tabs.Scroll
|
|
127
|
-
onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
|
|
128
|
-
selectedTabKey={selectedTabKey}
|
|
129
|
-
tabs={tabs}
|
|
130
|
-
lazy
|
|
131
|
-
lazyPreloadDistance={3}
|
|
132
|
-
/>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export default TabsPlayground;
|
package/playground/src/Tag.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Tag, useTheme } from '@hero-design/rn';
|
|
4
|
-
|
|
5
|
-
const TagPlayground = () => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<View style={{ margin: theme.space.medium }}>
|
|
10
|
-
<View
|
|
11
|
-
style={{
|
|
12
|
-
display: 'flex',
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
marginBottom: theme.space.small,
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
<Tag
|
|
18
|
-
content="APPROVED"
|
|
19
|
-
intent="success"
|
|
20
|
-
style={{ marginEnd: theme.space.small }}
|
|
21
|
-
/>
|
|
22
|
-
<Tag
|
|
23
|
-
content="PENDING"
|
|
24
|
-
intent="warning"
|
|
25
|
-
style={{ marginEnd: theme.space.small }}
|
|
26
|
-
/>
|
|
27
|
-
</View>
|
|
28
|
-
<View
|
|
29
|
-
style={{
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexDirection: 'row',
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<Tag
|
|
35
|
-
content="DECLINED"
|
|
36
|
-
intent="danger"
|
|
37
|
-
style={{ marginEnd: theme.space.small }}
|
|
38
|
-
/>
|
|
39
|
-
<Tag content="SUBMITTED" style={{ marginEnd: theme.space.small }} />
|
|
40
|
-
</View>
|
|
41
|
-
</View>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default TagPlayground;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { TextInput, useTheme } from '@hero-design/rn';
|
|
4
|
-
|
|
5
|
-
const TextInputPlayground = () => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
return (
|
|
8
|
-
<View style={{ padding: theme.space.medium }}>
|
|
9
|
-
<TextInput label="Amount (AUD)" prefix="dollar-sign" />
|
|
10
|
-
</View>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default TextInputPlayground;
|
package/playground/src/Toast.tsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { View, Button } from 'react-native';
|
|
3
|
-
import { Toast, Typography, useTheme } from '@hero-design/rn';
|
|
4
|
-
|
|
5
|
-
type ToastConfig = {
|
|
6
|
-
displayType: 'single' | 'stack';
|
|
7
|
-
position: 'top' | 'bottom';
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const getRandomIntent = () => {
|
|
11
|
-
const intents = ['info', 'success', 'warning', 'error'] as const;
|
|
12
|
-
return intents[Math.floor(Math.random() * 4)];
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const ToastDemo = ({
|
|
16
|
-
config,
|
|
17
|
-
updateConfig,
|
|
18
|
-
}: {
|
|
19
|
-
config: ToastConfig;
|
|
20
|
-
updateConfig: (conf: ToastConfig) => void;
|
|
21
|
-
}) => {
|
|
22
|
-
const theme = useTheme();
|
|
23
|
-
const [permaToastIds, setPermaToastIds] = useState<string[]>([]);
|
|
24
|
-
const toast = Toast.useToast();
|
|
25
|
-
return (
|
|
26
|
-
<View
|
|
27
|
-
style={{
|
|
28
|
-
flex: 1,
|
|
29
|
-
padding: theme.space.medium,
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<Button
|
|
35
|
-
title="Add Random Toast"
|
|
36
|
-
onPress={() =>
|
|
37
|
-
toast.show({
|
|
38
|
-
content: Math.random().toString(),
|
|
39
|
-
intent: getRandomIntent(),
|
|
40
|
-
variant: 'round',
|
|
41
|
-
actionLabel: 'ACTION',
|
|
42
|
-
onAction: () => alert('Clicked'),
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
/>
|
|
46
|
-
<Button
|
|
47
|
-
title="Add Perma Toast"
|
|
48
|
-
onPress={() => {
|
|
49
|
-
const id = toast.show({
|
|
50
|
-
content: `Perma Toast: ${Math.random().toString()}`,
|
|
51
|
-
intent: getRandomIntent(),
|
|
52
|
-
variant: 'round',
|
|
53
|
-
actionLabel: 'UNDO',
|
|
54
|
-
autoDismiss: false,
|
|
55
|
-
});
|
|
56
|
-
setPermaToastIds([id, ...permaToastIds]);
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
<Button
|
|
60
|
-
title="Hide Oldest Perma Toast"
|
|
61
|
-
onPress={() => {
|
|
62
|
-
const id = permaToastIds[permaToastIds.length - 1];
|
|
63
|
-
toast.hide(id);
|
|
64
|
-
setPermaToastIds(permaToastIds.slice(0, -1));
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
<Button
|
|
68
|
-
title="Clear all"
|
|
69
|
-
onPress={() => {
|
|
70
|
-
toast.clearAll();
|
|
71
|
-
setPermaToastIds([]);
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
<View style={{ alignItems: 'center', marginTop: theme.space.large }}>
|
|
75
|
-
<Typography.Text fontSize="large">
|
|
76
|
-
Tap to change settings
|
|
77
|
-
</Typography.Text>
|
|
78
|
-
<Button
|
|
79
|
-
title={`Display Type: ${config.displayType}`}
|
|
80
|
-
onPress={() =>
|
|
81
|
-
updateConfig({
|
|
82
|
-
...config,
|
|
83
|
-
displayType: config.displayType === 'stack' ? 'single' : 'stack',
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
/>
|
|
87
|
-
<Button
|
|
88
|
-
title={`Position: ${config.position}`}
|
|
89
|
-
onPress={() =>
|
|
90
|
-
updateConfig({
|
|
91
|
-
...config,
|
|
92
|
-
position: config.position === 'top' ? 'bottom' : 'top',
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
/>
|
|
96
|
-
</View>
|
|
97
|
-
</View>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const ToastPlayground = () => {
|
|
102
|
-
const [config, setConfig] = useState<ToastConfig>({
|
|
103
|
-
displayType: 'single',
|
|
104
|
-
position: 'top',
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<Toast.Provider displayType={config.displayType} position={config.position}>
|
|
109
|
-
<ToastDemo config={config} updateConfig={conf => setConfig(conf)} />
|
|
110
|
-
</Toast.Provider>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export default ToastPlayground;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Typography, useTheme } from '@hero-design/rn';
|
|
4
|
-
|
|
5
|
-
const TypographyPlayground = () => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<View style={{ padding: theme.space.large }}>
|
|
10
|
-
<Typography.Text fontSize="xlarge" fontWeight="semi-bold">
|
|
11
|
-
This is a title
|
|
12
|
-
</Typography.Text>
|
|
13
|
-
<Typography.Text fontSize="large">This is a subtitle</Typography.Text>
|
|
14
|
-
<Typography.Text>This is a 2nd subtitle</Typography.Text>
|
|
15
|
-
<Typography.Text fontWeight="light">This is body text</Typography.Text>
|
|
16
|
-
<Typography.Text intent="subdued" fontWeight="light">
|
|
17
|
-
This is subdued text
|
|
18
|
-
</Typography.Text>
|
|
19
|
-
</View>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default TypographyPlayground;
|
package/playground/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"outDir": "types",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"jsx": "react-native",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"allowUnreachableCode": false,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"noImplicitThis": true,
|
|
13
|
-
"noUnusedLocals": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"types": ["jest"],
|
|
16
|
-
"typeRoots": ["./src"]
|
|
17
|
-
},
|
|
18
|
-
"include": ["src"],
|
|
19
|
-
"exclude": ["node_modules"],
|
|
20
|
-
"extends": "expo/tsconfig.base"
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import { FooterText } from './StyledMultiSelect';
|
|
4
|
-
|
|
5
|
-
function Footer({ label, onPress }: { label: string; onPress: () => void }) {
|
|
6
|
-
return (
|
|
7
|
-
<TouchableOpacity onPress={onPress}>
|
|
8
|
-
<FooterText fontSize="large" fontWeight="semi-bold">
|
|
9
|
-
{label}
|
|
10
|
-
</FooterText>
|
|
11
|
-
</TouchableOpacity>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default Footer;
|