@hero-design/rn 7.3.2 → 7.4.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/README.md +15 -0
- package/.expo/packager-info.json +10 -0
- package/.expo/prebuild/cached-packages.json +4 -0
- package/.expo/settings.json +10 -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/assets/fonts/hero-icons.ttf +0 -0
- package/es/index.js +2012 -1137
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +2016 -1135
- package/package.json +11 -9
- package/playground/.detoxrc.json +49 -0
- package/playground/.prettierrc.json +8 -0
- package/playground/app.json +9 -0
- package/playground/babel.config.js +63 -0
- package/playground/e2e/config.json +9 -0
- package/playground/e2e/environment.js +23 -0
- package/playground/e2e/firstTest.e2e.js +16 -0
- package/{expoEntry.js → playground/expoEntry.js} +1 -1
- 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 +7 -0
- package/playground/ios/MobileHeroDesignPlayground/AppDelegate.h +9 -0
- package/playground/ios/MobileHeroDesignPlayground/AppDelegate.m +75 -0
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/Contents.json +6 -0
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/Contents.json +21 -0
- package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
- package/playground/ios/MobileHeroDesignPlayground/Info.plist +85 -0
- package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground-Bridging-Header.h +3 -0
- package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground.entitlements +8 -0
- package/playground/ios/MobileHeroDesignPlayground/SplashScreen.storyboard +40 -0
- package/playground/ios/MobileHeroDesignPlayground/Supporting/Expo.plist +16 -0
- package/playground/ios/MobileHeroDesignPlayground/main.m +10 -0
- package/playground/ios/MobileHeroDesignPlayground/noop-file.swift +4 -0
- package/playground/ios/MobileHeroDesignPlayground.xcodeproj/project.pbxproj +515 -0
- package/playground/ios/MobileHeroDesignPlayground.xcodeproj/xcshareddata/xcschemes/MobileHeroDesignPlayground.xcscheme +88 -0
- package/playground/ios/MobileHeroDesignPlayground.xcworkspace/contents.xcworkspacedata +10 -0
- package/playground/ios/MobileHeroDesignPlayground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/playground/ios/Podfile +49 -0
- package/playground/ios/Podfile.lock +478 -0
- package/playground/ios/Podfile.properties.json +3 -0
- package/{metro.config.js → playground/metro.config.js} +10 -2
- package/playground/package.json +63 -0
- package/playground/{index.tsx → src/App.tsx} +57 -29
- package/playground/{components → src}/Avatar.tsx +1 -1
- package/playground/{components → src}/Badge.tsx +1 -1
- package/playground/{components → src}/BottomNavigation.tsx +1 -1
- package/playground/src/BottomSheet.tsx +43 -0
- package/playground/src/Button.tsx +170 -0
- package/playground/{components/Button.tsx → src/Button.tsx~origin_master} +0 -0
- package/playground/{components → src}/Card.tsx +1 -1
- package/playground/{components → src}/Collapse.tsx +1 -1
- package/playground/src/ContentNavigator.tsx +65 -0
- package/playground/{components → src}/Divider.tsx +1 -1
- package/playground/{components → src}/Drawer.tsx +1 -1
- package/playground/{components → src}/FAB.tsx +1 -1
- package/playground/{components → src}/Icon.tsx +7 -3
- package/playground/{components → src}/IconButton.tsx +12 -1
- package/playground/{components → src}/Progress.tsx +1 -1
- package/playground/src/Radio.tsx +25 -0
- package/playground/src/SectionHeading.tsx +68 -0
- package/playground/src/Spinner.tsx +19 -0
- package/playground/{components → src}/Tabs.tsx +1 -1
- package/playground/{components → src}/Tag.tsx +1 -1
- package/playground/src/TextInput.tsx +14 -0
- package/playground/{components → src}/Typography.tsx +1 -1
- package/playground/src/emotion.d.ts +7 -0
- package/playground/tsconfig.json +21 -0
- package/src/components/BottomSheet/Footer.tsx +19 -0
- package/src/components/BottomSheet/Header.tsx +49 -0
- package/src/components/BottomSheet/StyledBottomSheet.tsx +75 -0
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +531 -0
- package/src/components/BottomSheet/__tests__/index.spec.tsx +107 -0
- package/src/components/BottomSheet/index.tsx +171 -0
- package/src/components/Button/IconButton.tsx +11 -1
- package/src/components/Collapse/StyledCollapse.tsx +11 -2
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +36 -31
- package/src/components/Collapse/__tests__/index.spec.tsx +1 -13
- package/src/components/Collapse/index.tsx +20 -50
- package/src/components/ContentNavigator/StyledContentNavigator.tsx +15 -0
- package/src/components/ContentNavigator/__tests__/StyledContentNavigator.spec.tsx +19 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +43 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +217 -0
- package/src/components/ContentNavigator/__tests__/index.spec.tsx +74 -0
- package/src/components/ContentNavigator/index.tsx +65 -0
- package/src/components/Icon/HeroIcon/index.tsx +13 -2
- package/src/components/Icon/HeroIcon/selection.json +1 -1
- package/src/components/Icon/IconList.ts +6 -0
- package/src/components/Icon/index.tsx +8 -1
- package/src/components/Radio/Radio.tsx +51 -0
- package/src/components/Radio/RadioGroup.tsx +50 -0
- package/src/components/Radio/StyledRadio.tsx +42 -0
- package/src/components/Radio/__tests__/Radio.spec.tsx +38 -0
- package/src/components/Radio/__tests__/RadioGroup.spec.tsx +36 -0
- package/src/components/Radio/__tests__/StyledRadio.spec.tsx +43 -0
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +160 -0
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +248 -0
- package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +124 -0
- package/src/components/Radio/index.tsx +5 -0
- package/src/components/SectionHeading/StyledHeading.tsx +24 -0
- package/src/components/SectionHeading/__tests__/StyledHeading.tsx +28 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.tsx.snap +48 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +208 -0
- package/src/components/SectionHeading/__tests__/index.spec.tsx +39 -0
- package/src/components/SectionHeading/index.tsx +93 -0
- package/src/components/Spinner/AnimatedSpinner.tsx +55 -0
- package/src/components/Spinner/StyledSpinner.tsx +59 -0
- package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +11 -0
- package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +56 -0
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +118 -0
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +235 -0
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +141 -0
- package/src/components/Spinner/__tests__/index.spec.tsx +12 -0
- package/src/components/Spinner/index.tsx +22 -0
- package/src/components/TextInput/StyledTextInput.tsx +34 -0
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +33 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +88 -0
- package/src/components/TextInput/__tests__/index.spec.tsx +16 -0
- package/src/components/TextInput/index.tsx +61 -0
- package/src/index.ts +12 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +95 -0
- package/src/theme/components/bottomSheet.ts +34 -0
- package/src/theme/components/contentNavigator.ts +11 -0
- package/src/theme/components/icon.ts +1 -0
- package/src/theme/components/radio.ts +34 -0
- package/src/theme/components/spinner.ts +21 -0
- package/src/theme/components/textInput.ts +32 -0
- package/src/theme/global/borders.ts +6 -0
- package/src/theme/global/colors.ts +1 -0
- package/src/theme/index.ts +22 -7
- package/tsconfig.json +11 -3
- package/types/components/Avatar/StyledAvatar.d.ts +45 -0
- package/types/{src/components/Tabs/__tests__/ScrollableTab.spec.d.ts → components/Avatar/__tests__/StyledAvatar.spec.d.ts} +0 -0
- package/types/components/Avatar/__tests__/index.spec.d.ts +1 -0
- package/types/components/Avatar/index.d.ts +25 -0
- package/types/components/Badge/Status.d.ts +24 -0
- package/types/components/Badge/StyledBadge.d.ts +27 -0
- package/types/components/Badge/__tests__/Badge.spec.d.ts +1 -0
- package/types/components/Badge/__tests__/Status.spec.d.ts +1 -0
- package/types/components/Badge/index.d.ts +32 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +51 -0
- package/types/components/BottomNavigation/__tests__/index.spec.d.ts +1 -0
- package/types/components/BottomNavigation/index.d.ts +45 -0
- package/types/components/BottomSheet/Footer.d.ts +6 -0
- package/types/components/BottomSheet/Header.d.ts +8 -0
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +46 -0
- package/types/components/BottomSheet/__tests__/index.spec.d.ts +1 -0
- package/types/components/BottomSheet/index.d.ts +51 -0
- package/types/components/Button/Button.d.ts +57 -0
- package/types/components/Button/IconButton.d.ts +38 -0
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +19 -0
- package/types/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +1 -0
- package/types/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +1 -0
- package/types/components/Button/LoadingIndicator/index.d.ts +26 -0
- package/types/components/Button/StyledButton.d.ts +39 -0
- package/types/components/Button/__tests__/Button.spec.d.ts +1 -0
- package/types/components/Button/__tests__/IconButton.spec.d.ts +1 -0
- package/types/components/Button/__tests__/StyledButton.spec.d.ts +1 -0
- package/types/components/Button/index.d.ts +8 -0
- package/types/components/Card/StyledCard.d.ts +16 -0
- package/types/components/Card/__tests__/StyledCard.spec.d.ts +1 -0
- package/types/components/Card/__tests__/index.spec.d.ts +1 -0
- package/types/components/Card/index.d.ts +22 -0
- package/types/components/Collapse/StyledCollapse.d.ts +25 -0
- package/types/components/Collapse/__tests__/StyledCollapse.spec.d.ts +1 -0
- package/types/components/Collapse/__tests__/index.spec.d.ts +1 -0
- package/types/components/Collapse/index.d.ts +19 -0
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +12 -0
- package/types/components/ContentNavigator/__tests__/StyledContentNavigator.spec.d.ts +1 -0
- package/types/components/ContentNavigator/__tests__/index.spec.d.ts +1 -0
- package/types/components/ContentNavigator/index.d.ts +33 -0
- package/types/components/Divider/StyledDivider.d.ts +12 -0
- package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +1 -0
- package/types/components/Divider/index.d.ts +21 -0
- package/types/components/Drawer/StyledDrawer.d.ts +24 -0
- package/types/components/Drawer/__tests__/index.spec.d.ts +1 -0
- package/types/components/Drawer/index.d.ts +25 -0
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +12 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +29 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +12 -0
- package/types/components/FAB/ActionGroup/__tests__/index.spec.d.ts +1 -0
- package/types/components/FAB/ActionGroup/index.d.ts +34 -0
- package/types/components/FAB/AnimatedFABIcon.d.ts +6 -0
- package/types/components/FAB/FAB.d.ts +34 -0
- package/types/components/FAB/StyledFAB.d.ts +19 -0
- package/types/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +1 -0
- package/types/components/FAB/__tests__/StyledFAB.spec.d.ts +1 -0
- package/types/components/FAB/__tests__/index.spec.d.ts +1 -0
- package/types/components/FAB/index.d.ts +4 -0
- package/types/components/Icon/HeroIcon/index.d.ts +12 -0
- package/types/components/Icon/IconList.d.ts +2 -0
- package/types/components/Icon/__tests__/index.spec.d.ts +1 -0
- package/types/components/Icon/index.d.ts +27 -0
- package/types/components/Icon/utils.d.ts +2 -0
- package/types/components/Progress/ProgressBar.d.ts +18 -0
- package/types/components/Progress/ProgressCircle.d.ts +18 -0
- package/types/components/Progress/StyledProgressBar.d.ts +17 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +37 -0
- package/types/components/Progress/__tests__/index.spec.d.ts +1 -0
- package/types/components/Progress/index.d.ts +5 -0
- package/types/components/Progress/types.d.ts +1 -0
- package/types/components/Radio/Radio.d.ts +26 -0
- package/types/components/Radio/RadioGroup.d.ts +29 -0
- package/types/components/Radio/StyledRadio.d.ts +30 -0
- package/types/components/Radio/__tests__/Radio.spec.d.ts +1 -0
- package/types/components/Radio/__tests__/RadioGroup.spec.d.ts +1 -0
- package/types/components/Radio/__tests__/StyledRadio.spec.d.ts +1 -0
- package/types/components/Radio/index.d.ts +4 -0
- package/types/components/SectionHeading/StyledHeading.d.ts +20 -0
- package/types/components/SectionHeading/__tests__/StyledHeading.d.ts +1 -0
- package/types/components/SectionHeading/__tests__/index.spec.d.ts +1 -0
- package/types/components/SectionHeading/index.d.ts +39 -0
- package/types/components/Spinner/AnimatedSpinner.d.ts +2 -0
- package/types/components/Spinner/StyledSpinner.d.ts +30 -0
- package/types/components/Spinner/__tests__/AnimatedSpinner.spec.d.ts +1 -0
- package/types/components/Spinner/__tests__/StyledSpinner.spec.d.ts +1 -0
- package/types/components/Spinner/__tests__/index.spec.d.ts +1 -0
- package/types/components/Spinner/index.d.ts +10 -0
- package/types/components/Tabs/ActiveTabIndicator.d.ts +8 -0
- package/types/{src/components/Tabs/ScrollableTab.d.ts → components/Tabs/ScrollableTabs.d.ts} +1 -1
- package/types/{src/components/Tabs/StyledScrollableTab.d.ts → components/Tabs/StyledScrollableTabs.d.ts} +0 -1
- package/types/components/Tabs/StyledTabs.d.ts +54 -0
- package/types/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +1 -0
- package/types/components/Tabs/__tests__/index.spec.d.ts +1 -0
- package/types/components/Tabs/index.d.ts +54 -0
- package/types/components/Tabs/utils.d.ts +2 -0
- package/types/components/Tag/StyledTag.d.ts +19 -0
- package/types/components/Tag/__tests__/Tag.spec.d.ts +1 -0
- package/types/components/Tag/index.d.ts +21 -0
- package/types/components/TextInput/StyledTextInput.d.ts +22 -0
- package/types/components/TextInput/__tests__/StyledTextInput.spec.d.ts +1 -0
- package/types/components/TextInput/__tests__/index.spec.d.ts +1 -0
- package/types/components/TextInput/index.d.ts +26 -0
- package/types/components/Typography/Text/StyledText.d.ts +12 -0
- package/types/components/Typography/Text/__tests__/StyledText.spec.d.ts +1 -0
- package/types/components/Typography/Text/__tests__/index.spec.d.ts +1 -0
- package/types/components/Typography/Text/index.d.ts +30 -0
- package/types/components/Typography/index.d.ts +6 -0
- package/types/index.d.ts +25 -0
- package/types/playground/components/IconButton.d.ts +0 -0
- package/types/src/components/Button/Button.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/index.d.ts +0 -0
- package/types/src/components/Button/StyledButton.d.ts +0 -0
- package/types/src/components/Button/__tests__/Button.spec.d.ts +0 -0
- package/types/src/components/Button/__tests__/IconButton.spec.d.ts +0 -0
- package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +0 -0
- package/types/src/theme/components/button.d.ts +0 -0
- package/types/testHelpers/renderWithTheme.d.ts +3 -0
- package/types/theme/__tests__/index.spec.d.ts +1 -0
- package/types/theme/components/avatar.d.ts +32 -0
- package/types/theme/components/badge.d.ts +29 -0
- package/types/theme/components/bottomNavigation.d.ts +23 -0
- package/types/theme/components/bottomSheet.d.ts +29 -0
- package/types/theme/components/button.d.ts +37 -0
- package/types/theme/components/card.d.ts +10 -0
- package/types/theme/components/contentNavigator.d.ts +7 -0
- package/types/theme/components/divider.d.ts +17 -0
- package/types/theme/components/drawer.d.ts +21 -0
- package/types/theme/components/fab.d.ts +51 -0
- package/types/theme/components/icon.d.ts +20 -0
- package/types/theme/components/progress.d.ts +21 -0
- package/types/theme/components/radio.d.ts +25 -0
- package/types/theme/components/spinner.d.ts +15 -0
- package/types/theme/components/tabs.d.ts +27 -0
- package/types/theme/components/tag.d.ts +30 -0
- package/types/theme/components/textInput.d.ts +24 -0
- package/types/theme/components/typography.d.ts +26 -0
- package/types/theme/global/borders.d.ts +14 -0
- package/types/theme/global/colors.d.ts +32 -0
- package/types/theme/global/index.d.ts +42 -0
- package/types/theme/global/scale.d.ts +9 -0
- package/types/theme/global/space.d.ts +13 -0
- package/types/theme/global/typography.d.ts +21 -0
- package/types/theme/index.d.ts +45 -0
- package/types/types.d.ts +5 -0
- package/types/utils/__tests__/scale.spec.d.ts +1 -0
- package/types/utils/helpers.d.ts +2 -0
- package/types/utils/hooks.d.ts +1 -0
- package/types/utils/scale.d.ts +3 -0
- package/app.json +0 -8
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`rendering renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"flex": 1,
|
|
9
|
+
"flexDirection": "row",
|
|
10
|
+
"justifyContent": "space-between",
|
|
11
|
+
},
|
|
12
|
+
undefined,
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
>
|
|
16
|
+
<View
|
|
17
|
+
accessible={true}
|
|
18
|
+
collapsable={false}
|
|
19
|
+
focusable={true}
|
|
20
|
+
nativeID="animatedComponent"
|
|
21
|
+
onClick={[Function]}
|
|
22
|
+
onResponderGrant={[Function]}
|
|
23
|
+
onResponderMove={[Function]}
|
|
24
|
+
onResponderRelease={[Function]}
|
|
25
|
+
onResponderTerminate={[Function]}
|
|
26
|
+
onResponderTerminationRequest={[Function]}
|
|
27
|
+
onStartShouldSetResponder={[Function]}
|
|
28
|
+
style={
|
|
29
|
+
Object {
|
|
30
|
+
"opacity": 1,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
testID="previous-icon-button"
|
|
34
|
+
>
|
|
35
|
+
<HeroIcon
|
|
36
|
+
name="arrow-left"
|
|
37
|
+
style={
|
|
38
|
+
Array [
|
|
39
|
+
Object {
|
|
40
|
+
"color": "#292a2b",
|
|
41
|
+
"fontSize": 24,
|
|
42
|
+
},
|
|
43
|
+
undefined,
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
themeIntent="text"
|
|
47
|
+
themeSize="medium"
|
|
48
|
+
/>
|
|
49
|
+
</View>
|
|
50
|
+
<Text
|
|
51
|
+
style={
|
|
52
|
+
Array [
|
|
53
|
+
Object {
|
|
54
|
+
"color": "#292a2b",
|
|
55
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
56
|
+
"fontSize": 14,
|
|
57
|
+
"letterSpacing": 0.42,
|
|
58
|
+
"lineHeight": 22,
|
|
59
|
+
},
|
|
60
|
+
Array [
|
|
61
|
+
Object {
|
|
62
|
+
"paddingHorizontal": 8,
|
|
63
|
+
},
|
|
64
|
+
undefined,
|
|
65
|
+
],
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
themeFontSize="medium"
|
|
69
|
+
themeFontWeight="semi-bold"
|
|
70
|
+
themeIntent="body"
|
|
71
|
+
>
|
|
72
|
+
20
|
|
73
|
+
</Text>
|
|
74
|
+
<View
|
|
75
|
+
accessible={true}
|
|
76
|
+
collapsable={false}
|
|
77
|
+
focusable={true}
|
|
78
|
+
nativeID="animatedComponent"
|
|
79
|
+
onClick={[Function]}
|
|
80
|
+
onResponderGrant={[Function]}
|
|
81
|
+
onResponderMove={[Function]}
|
|
82
|
+
onResponderRelease={[Function]}
|
|
83
|
+
onResponderTerminate={[Function]}
|
|
84
|
+
onResponderTerminationRequest={[Function]}
|
|
85
|
+
onStartShouldSetResponder={[Function]}
|
|
86
|
+
style={
|
|
87
|
+
Object {
|
|
88
|
+
"opacity": 1,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
testID="next-icon-button"
|
|
92
|
+
>
|
|
93
|
+
<HeroIcon
|
|
94
|
+
name="arrow-right"
|
|
95
|
+
style={
|
|
96
|
+
Array [
|
|
97
|
+
Object {
|
|
98
|
+
"color": "#292a2b",
|
|
99
|
+
"fontSize": 24,
|
|
100
|
+
},
|
|
101
|
+
undefined,
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
themeIntent="text"
|
|
105
|
+
themeSize="medium"
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
exports[`rendering renders correctly when icon buttons are disabled 1`] = `
|
|
112
|
+
<View
|
|
113
|
+
style={
|
|
114
|
+
Array [
|
|
115
|
+
Object {
|
|
116
|
+
"flex": 1,
|
|
117
|
+
"flexDirection": "row",
|
|
118
|
+
"justifyContent": "space-between",
|
|
119
|
+
},
|
|
120
|
+
undefined,
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<View
|
|
125
|
+
accessible={true}
|
|
126
|
+
collapsable={false}
|
|
127
|
+
focusable={true}
|
|
128
|
+
nativeID="animatedComponent"
|
|
129
|
+
onClick={[Function]}
|
|
130
|
+
onResponderGrant={[Function]}
|
|
131
|
+
onResponderMove={[Function]}
|
|
132
|
+
onResponderRelease={[Function]}
|
|
133
|
+
onResponderTerminate={[Function]}
|
|
134
|
+
onResponderTerminationRequest={[Function]}
|
|
135
|
+
onStartShouldSetResponder={[Function]}
|
|
136
|
+
style={
|
|
137
|
+
Object {
|
|
138
|
+
"opacity": 1,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
testID="previous-icon-button"
|
|
142
|
+
>
|
|
143
|
+
<HeroIcon
|
|
144
|
+
name="arrow-left"
|
|
145
|
+
style={
|
|
146
|
+
Array [
|
|
147
|
+
Object {
|
|
148
|
+
"color": "#8b8d92",
|
|
149
|
+
"fontSize": 24,
|
|
150
|
+
},
|
|
151
|
+
undefined,
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
themeIntent="disabled-text"
|
|
155
|
+
themeSize="medium"
|
|
156
|
+
/>
|
|
157
|
+
</View>
|
|
158
|
+
<Text
|
|
159
|
+
style={
|
|
160
|
+
Array [
|
|
161
|
+
Object {
|
|
162
|
+
"color": "#292a2b",
|
|
163
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
164
|
+
"fontSize": 14,
|
|
165
|
+
"letterSpacing": 0.42,
|
|
166
|
+
"lineHeight": 22,
|
|
167
|
+
},
|
|
168
|
+
Array [
|
|
169
|
+
Object {
|
|
170
|
+
"paddingHorizontal": 8,
|
|
171
|
+
},
|
|
172
|
+
undefined,
|
|
173
|
+
],
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
themeFontSize="medium"
|
|
177
|
+
themeFontWeight="semi-bold"
|
|
178
|
+
themeIntent="body"
|
|
179
|
+
>
|
|
180
|
+
20
|
|
181
|
+
</Text>
|
|
182
|
+
<View
|
|
183
|
+
accessible={true}
|
|
184
|
+
collapsable={false}
|
|
185
|
+
focusable={true}
|
|
186
|
+
nativeID="animatedComponent"
|
|
187
|
+
onClick={[Function]}
|
|
188
|
+
onResponderGrant={[Function]}
|
|
189
|
+
onResponderMove={[Function]}
|
|
190
|
+
onResponderRelease={[Function]}
|
|
191
|
+
onResponderTerminate={[Function]}
|
|
192
|
+
onResponderTerminationRequest={[Function]}
|
|
193
|
+
onStartShouldSetResponder={[Function]}
|
|
194
|
+
style={
|
|
195
|
+
Object {
|
|
196
|
+
"opacity": 1,
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
testID="next-icon-button"
|
|
200
|
+
>
|
|
201
|
+
<HeroIcon
|
|
202
|
+
name="arrow-right"
|
|
203
|
+
style={
|
|
204
|
+
Array [
|
|
205
|
+
Object {
|
|
206
|
+
"color": "#8b8d92",
|
|
207
|
+
"fontSize": 24,
|
|
208
|
+
},
|
|
209
|
+
undefined,
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
themeIntent="disabled-text"
|
|
213
|
+
themeSize="medium"
|
|
214
|
+
/>
|
|
215
|
+
</View>
|
|
216
|
+
</View>
|
|
217
|
+
`;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
3
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
import ContentNavigator from '..';
|
|
5
|
+
|
|
6
|
+
describe('rendering', () => {
|
|
7
|
+
it('renders correctly', () => {
|
|
8
|
+
const { toJSON, getByText, queryAllByTestId } = renderWithTheme(
|
|
9
|
+
<ContentNavigator
|
|
10
|
+
value={20}
|
|
11
|
+
onPreviousPress={jest.fn()}
|
|
12
|
+
onNextPress={jest.fn()}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(getByText('20')).toBeDefined();
|
|
17
|
+
expect(toJSON()).toMatchSnapshot();
|
|
18
|
+
expect(queryAllByTestId('previous-icon-button')).toHaveLength(1);
|
|
19
|
+
expect(queryAllByTestId('next-icon-button')).toHaveLength(1);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders correctly when icon buttons are disabled', () => {
|
|
23
|
+
const { toJSON, getByText } = renderWithTheme(
|
|
24
|
+
<ContentNavigator
|
|
25
|
+
value="20"
|
|
26
|
+
onPreviousPress={jest.fn()}
|
|
27
|
+
onNextPress={jest.fn()}
|
|
28
|
+
previousDisabled
|
|
29
|
+
nextDisabled
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
expect(getByText('20')).toBeDefined();
|
|
34
|
+
expect(toJSON()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('behavior', () => {
|
|
39
|
+
it('calls press handlers', () => {
|
|
40
|
+
const prevHandler = jest.fn();
|
|
41
|
+
const nextHandler = jest.fn();
|
|
42
|
+
const { getByTestId } = renderWithTheme(
|
|
43
|
+
<ContentNavigator
|
|
44
|
+
value={20}
|
|
45
|
+
onPreviousPress={prevHandler}
|
|
46
|
+
onNextPress={nextHandler}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
fireEvent.press(getByTestId('previous-icon-button'));
|
|
51
|
+
expect(prevHandler).toBeCalledTimes(1);
|
|
52
|
+
fireEvent.press(getByTestId('next-icon-button'));
|
|
53
|
+
expect(prevHandler).toBeCalledTimes(1);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('does NOT call press handlers when icon buttons are disabled', () => {
|
|
57
|
+
const prevHandler = jest.fn();
|
|
58
|
+
const nextHandler = jest.fn();
|
|
59
|
+
const { getByTestId } = renderWithTheme(
|
|
60
|
+
<ContentNavigator
|
|
61
|
+
value={20}
|
|
62
|
+
onPreviousPress={prevHandler}
|
|
63
|
+
onNextPress={nextHandler}
|
|
64
|
+
previousDisabled
|
|
65
|
+
nextDisabled
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
fireEvent.press(getByTestId('previous-icon-button'));
|
|
70
|
+
expect(prevHandler).toBeCalledTimes(0);
|
|
71
|
+
fireEvent.press(getByTestId('next-icon-button'));
|
|
72
|
+
expect(prevHandler).toBeCalledTimes(0);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { Value, Wrapper } from './StyledContentNavigator';
|
|
4
|
+
import Button from '../Button';
|
|
5
|
+
|
|
6
|
+
interface ContentNavigatorProps {
|
|
7
|
+
/**
|
|
8
|
+
* The navigator's content value.
|
|
9
|
+
*/
|
|
10
|
+
value: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* Handler to handle press event of previous icon.
|
|
13
|
+
*/
|
|
14
|
+
onPreviousPress: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Handler to handle press event of next icon.
|
|
17
|
+
*/
|
|
18
|
+
onNextPress: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the previous icon is disabled.
|
|
21
|
+
*/
|
|
22
|
+
previousDisabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the next icon is disabled.
|
|
25
|
+
*/
|
|
26
|
+
nextDisabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Additional style.
|
|
29
|
+
*/
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
/**
|
|
32
|
+
* Testing id of the component.
|
|
33
|
+
*/
|
|
34
|
+
testID?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ContentNavigator({
|
|
38
|
+
onPreviousPress,
|
|
39
|
+
onNextPress,
|
|
40
|
+
value,
|
|
41
|
+
previousDisabled = false,
|
|
42
|
+
nextDisabled = false,
|
|
43
|
+
testID,
|
|
44
|
+
style,
|
|
45
|
+
}: ContentNavigatorProps) {
|
|
46
|
+
return (
|
|
47
|
+
<Wrapper testID={testID} style={style}>
|
|
48
|
+
<Button.Icon
|
|
49
|
+
icon="arrow-left"
|
|
50
|
+
onPress={onPreviousPress}
|
|
51
|
+
disabled={previousDisabled}
|
|
52
|
+
testID="previous-icon-button"
|
|
53
|
+
/>
|
|
54
|
+
<Value fontWeight="semi-bold">{value}</Value>
|
|
55
|
+
<Button.Icon
|
|
56
|
+
icon="arrow-right"
|
|
57
|
+
onPress={onNextPress}
|
|
58
|
+
disabled={nextDisabled}
|
|
59
|
+
testID="next-icon-button"
|
|
60
|
+
/>
|
|
61
|
+
</Wrapper>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default ContentNavigator;
|
|
@@ -9,7 +9,8 @@ type ThemeIntent =
|
|
|
9
9
|
| 'info'
|
|
10
10
|
| 'danger'
|
|
11
11
|
| 'success'
|
|
12
|
-
| 'warning'
|
|
12
|
+
| 'warning'
|
|
13
|
+
| 'disabled-text';
|
|
13
14
|
|
|
14
15
|
const HeroIcon = createIconSetFromIcoMoon(
|
|
15
16
|
heroIconConfig,
|
|
@@ -17,11 +18,21 @@ const HeroIcon = createIconSetFromIcoMoon(
|
|
|
17
18
|
'hero-icons.ttf'
|
|
18
19
|
);
|
|
19
20
|
|
|
21
|
+
const COLOR_INTENTS = {
|
|
22
|
+
text: 'text',
|
|
23
|
+
primary: 'primary',
|
|
24
|
+
info: 'info',
|
|
25
|
+
danger: 'danger',
|
|
26
|
+
success: 'success',
|
|
27
|
+
warning: 'warning',
|
|
28
|
+
'disabled-text': 'disabledText',
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
20
31
|
const StyledHeroIcon = styled(HeroIcon)<{
|
|
21
32
|
themeSize: ThemeSize;
|
|
22
33
|
themeIntent: ThemeIntent;
|
|
23
34
|
}>(({ themeIntent, themeSize, theme }) => ({
|
|
24
|
-
color: theme.__hd__.icon.colors[themeIntent],
|
|
35
|
+
color: theme.__hd__.icon.colors[COLOR_INTENTS[themeIntent]],
|
|
25
36
|
fontSize: theme.__hd__.icon.sizes[themeSize],
|
|
26
37
|
}));
|
|
27
38
|
|