@hero-design/rn 7.6.1-alpha.0 → 7.7.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 +2 -2
- package/.turbo/turbo-publish:npm.log +0 -0
- package/es/index.js +2953 -295
- package/lib/index.js +3119 -459
- package/package.json +4 -2
- package/playground/.turbo/turbo-type-check.log +7 -0
- package/playground/package.json +3 -3
- package/playground/src/App.tsx +8 -0
- package/playground/src/Checkbox.tsx +55 -0
- package/playground/src/Toast.tsx +114 -0
- package/rollup.config.js +1 -7
- package/src/components/Checkbox/StyledCheckbox.tsx +18 -0
- package/src/components/Checkbox/__tests__/StyledCheckbox.spec.tsx +10 -0
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +31 -0
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +63 -0
- package/src/components/Checkbox/__tests__/index.spec.tsx +24 -0
- package/src/components/Checkbox/index.tsx +58 -0
- package/src/components/Toast/StyledToast.tsx +65 -0
- package/src/components/Toast/Toast.tsx +123 -0
- package/src/components/Toast/ToastContainer.tsx +88 -0
- package/src/components/Toast/ToastContext.ts +25 -0
- package/src/components/Toast/ToastProvider.tsx +53 -0
- package/src/components/Toast/__tests__/Toast.spec.tsx +125 -0
- package/src/components/Toast/__tests__/ToastContainer.spec.tsx +107 -0
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +655 -0
- package/src/components/Toast/__tests__/__snapshots__/ToastContainer.spec.tsx.snap +93 -0
- package/src/components/Toast/index.tsx +11 -0
- package/src/components/Toast/types.ts +70 -0
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +41 -0
- package/src/theme/components/checkbox.ts +37 -0
- package/src/theme/components/toast.ts +33 -0
- package/src/theme/index.ts +6 -0
- package/types/components/Avatar/StyledAvatar.d.ts +0 -0
- package/types/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -0
- package/types/components/Avatar/__tests__/index.spec.d.ts +0 -0
- package/types/components/Avatar/index.d.ts +0 -0
- package/types/components/Badge/Status.d.ts +0 -0
- package/types/components/Badge/StyledBadge.d.ts +0 -0
- package/types/components/Badge/__tests__/Badge.spec.d.ts +0 -0
- package/types/components/Badge/__tests__/Status.spec.d.ts +0 -0
- package/types/components/Badge/index.d.ts +0 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomNavigation/index.d.ts +0 -0
- package/types/components/BottomSheet/Footer.d.ts +0 -0
- package/types/components/BottomSheet/Header.d.ts +0 -0
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
- package/types/components/BottomSheet/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomSheet/index.d.ts +0 -0
- package/types/components/Button/Button.d.ts +0 -0
- package/types/components/Button/IconButton.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
- package/types/components/Button/StyledButton.d.ts +0 -0
- package/types/components/Button/__tests__/Button.spec.d.ts +0 -0
- package/types/components/Button/__tests__/IconButton.spec.d.ts +0 -0
- package/types/components/Button/__tests__/StyledButton.spec.d.ts +0 -0
- package/types/components/Button/index.d.ts +0 -0
- package/types/components/Card/StyledCard.d.ts +0 -0
- package/types/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
- package/types/components/Card/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/index.d.ts +0 -0
- package/types/components/Collapse/StyledCollapse.d.ts +0 -0
- package/types/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -0
- package/types/components/Collapse/__tests__/index.spec.d.ts +0 -0
- package/types/components/Collapse/index.d.ts +0 -0
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/StyledContentNavigator.spec.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/index.spec.d.ts +0 -0
- package/types/components/ContentNavigator/index.d.ts +0 -0
- package/types/components/Divider/StyledDivider.d.ts +0 -0
- package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
- package/types/components/Divider/index.d.ts +0 -0
- package/types/components/Drawer/StyledDrawer.d.ts +0 -0
- package/types/components/Drawer/__tests__/index.spec.d.ts +0 -0
- package/types/components/Drawer/index.d.ts +0 -0
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/ActionGroup/index.d.ts +0 -0
- package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/components/FAB/FAB.d.ts +0 -0
- package/types/components/FAB/StyledFAB.d.ts +0 -0
- package/types/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/index.d.ts +0 -0
- package/types/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/components/Icon/IconList.d.ts +0 -0
- package/types/components/Icon/__tests__/index.spec.d.ts +0 -0
- package/types/components/Icon/index.d.ts +0 -0
- package/types/components/Icon/utils.d.ts +0 -0
- package/types/components/Progress/ProgressBar.d.ts +0 -0
- package/types/components/Progress/ProgressCircle.d.ts +0 -0
- package/types/components/Progress/StyledProgressBar.d.ts +0 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
- package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
- package/types/components/Progress/index.d.ts +0 -0
- package/types/components/Progress/types.d.ts +0 -0
- package/types/components/Radio/Radio.d.ts +0 -0
- package/types/components/Radio/RadioGroup.d.ts +0 -0
- package/types/components/Radio/StyledRadio.d.ts +0 -0
- package/types/components/Radio/__tests__/Radio.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/RadioGroup.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/StyledRadio.spec.d.ts +0 -0
- package/types/components/Radio/index.d.ts +0 -0
- package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/index.spec.d.ts +0 -0
- package/types/components/SectionHeading/index.d.ts +0 -0
- package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
- package/types/components/Spinner/StyledSpinner.d.ts +0 -0
- package/types/components/Spinner/__tests__/AnimatedSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/StyledSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/index.spec.d.ts +0 -0
- package/types/components/Spinner/index.d.ts +0 -0
- package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
- package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledTabs.d.ts +0 -0
- package/types/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -0
- package/types/components/Tabs/__tests__/index.spec.d.ts +0 -0
- package/types/components/Tabs/index.d.ts +0 -0
- package/types/components/Tabs/utils.d.ts +0 -0
- package/types/components/Tag/StyledTag.d.ts +0 -0
- package/types/components/Tag/__tests__/Tag.spec.d.ts +0 -0
- package/types/components/Tag/index.d.ts +0 -0
- package/types/components/TextInput/StyledTextInput.d.ts +0 -0
- package/types/components/TextInput/__tests__/StyledTextInput.spec.d.ts +0 -0
- package/types/components/TextInput/__tests__/index.spec.d.ts +0 -0
- package/types/components/TextInput/index.d.ts +0 -0
- package/types/components/Toast/StyledToast.d.ts +45 -0
- package/types/components/Toast/Toast.d.ts +3 -0
- package/types/components/Toast/ToastContainer.d.ts +5 -0
- package/types/components/Toast/ToastContext.d.ts +11 -0
- package/types/components/Toast/ToastProvider.d.ts +10 -0
- package/{es/components/Avatar/__tests__/StyledAvatar.spec.d.ts → types/components/Toast/__tests__/Toast.spec.d.ts} +0 -0
- package/{es/components/Avatar/__tests__/index.spec.d.ts → types/components/Toast/__tests__/ToastContainer.spec.d.ts} +0 -0
- package/types/components/Toast/index.d.ts +8 -0
- package/types/components/Toast/types.d.ts +67 -0
- package/types/components/Typography/Text/StyledText.d.ts +0 -0
- package/types/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
- package/types/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
- package/types/components/Typography/Text/index.d.ts +0 -0
- package/types/components/Typography/index.d.ts +0 -0
- package/types/index.d.ts +3 -1
- package/types/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/theme/__tests__/index.spec.d.ts +0 -0
- package/types/theme/components/avatar.d.ts +0 -0
- package/types/theme/components/badge.d.ts +0 -0
- package/types/theme/components/bottomNavigation.d.ts +0 -0
- package/types/theme/components/bottomSheet.d.ts +0 -0
- package/types/theme/components/button.d.ts +0 -0
- package/types/theme/components/card.d.ts +0 -0
- package/types/theme/components/contentNavigator.d.ts +0 -0
- package/types/theme/components/divider.d.ts +0 -0
- package/types/theme/components/drawer.d.ts +0 -0
- package/types/theme/components/fab.d.ts +0 -0
- package/types/theme/components/icon.d.ts +0 -0
- package/types/theme/components/progress.d.ts +0 -0
- package/types/theme/components/radio.d.ts +0 -0
- package/types/theme/components/spinner.d.ts +0 -0
- package/types/theme/components/tabs.d.ts +0 -0
- package/types/theme/components/tag.d.ts +0 -0
- package/types/theme/components/textInput.d.ts +0 -0
- package/types/theme/components/toast.d.ts +24 -0
- package/types/theme/components/typography.d.ts +0 -0
- package/types/theme/global/borders.d.ts +0 -0
- package/types/theme/global/colors.d.ts +0 -0
- package/types/theme/global/index.d.ts +0 -0
- package/types/theme/global/scale.d.ts +0 -0
- package/types/theme/global/space.d.ts +0 -0
- package/types/theme/global/typography.d.ts +0 -0
- package/types/theme/index.d.ts +4 -0
- package/types/types.d.ts +0 -0
- package/types/utils/__tests__/scale.spec.d.ts +0 -0
- package/types/utils/helpers.d.ts +0 -0
- package/types/utils/hooks.d.ts +0 -0
- package/types/utils/scale.d.ts +0 -0
- package/.turbo/turbo-build:types.log +0 -2
- package/.turbo/turbo-build:watch.log +0 -1
- package/.turbo/turbo-lint.log +0 -2
- package/.turbo/turbo-type-check.log +0 -2
- package/es/components/Avatar/StyledAvatar.d.ts +0 -46
- package/es/components/Avatar/index.d.ts +0 -25
- package/es/components/Badge/Status.d.ts +0 -24
- package/es/components/Badge/StyledBadge.d.ts +0 -28
- package/es/components/Badge/__tests__/Badge.spec.d.ts +0 -1
- package/es/components/Badge/__tests__/Status.spec.d.ts +0 -1
- package/es/components/Badge/index.d.ts +0 -32
- package/es/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -52
- package/es/components/BottomNavigation/__tests__/index.spec.d.ts +0 -1
- package/es/components/BottomNavigation/index.d.ts +0 -45
- package/es/components/Button/IconButton.d.ts +0 -34
- package/es/components/Button/__tests__/index.spec.d.ts +0 -1
- package/es/components/Button/index.d.ts +0 -4
- package/es/components/Card/StyledCard.d.ts +0 -17
- package/es/components/Card/__tests__/StyledCard.spec.d.ts +0 -1
- package/es/components/Card/__tests__/index.spec.d.ts +0 -1
- package/es/components/Card/index.d.ts +0 -22
- package/es/components/Collapse/StyledCollapse.d.ts +0 -15
- package/es/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -1
- package/es/components/Collapse/__tests__/index.spec.d.ts +0 -1
- package/es/components/Collapse/index.d.ts +0 -23
- package/es/components/Divider/StyledDivider.d.ts +0 -13
- package/es/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -1
- package/es/components/Divider/index.d.ts +0 -21
- package/es/components/Drawer/StyledDrawer.d.ts +0 -25
- package/es/components/Drawer/__tests__/index.spec.d.ts +0 -1
- package/es/components/Drawer/index.d.ts +0 -25
- package/es/components/FAB/ActionGroup/ActionItem.d.ts +0 -12
- package/es/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -30
- package/es/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -13
- package/es/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -1
- package/es/components/FAB/ActionGroup/index.d.ts +0 -34
- package/es/components/FAB/AnimatedFABIcon.d.ts +0 -6
- package/es/components/FAB/FAB.d.ts +0 -34
- package/es/components/FAB/StyledFAB.d.ts +0 -20
- package/es/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -1
- package/es/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -1
- package/es/components/FAB/__tests__/index.spec.d.ts +0 -1
- package/es/components/FAB/index.d.ts +0 -4
- package/es/components/Icon/HeroIcon/index.d.ts +0 -13
- package/es/components/Icon/IconList.d.ts +0 -2
- package/es/components/Icon/__tests__/index.spec.d.ts +0 -1
- package/es/components/Icon/index.d.ts +0 -27
- package/es/components/Icon/utils.d.ts +0 -2
- package/es/components/Progress/ProgressBar.d.ts +0 -18
- package/es/components/Progress/ProgressCircle.d.ts +0 -18
- package/es/components/Progress/StyledProgressBar.d.ts +0 -18
- package/es/components/Progress/StyledProgressCircle.d.ts +0 -38
- package/es/components/Progress/index.d.ts +0 -5
- package/es/components/Progress/types.d.ts +0 -1
- package/es/components/Tabs/ActiveTabIndicator.d.ts +0 -8
- package/es/components/Tabs/ScrollableTabs.d.ts +0 -3
- package/es/components/Tabs/StyledScrollableTabs.d.ts +0 -61
- package/es/components/Tabs/StyledTabs.d.ts +0 -55
- package/es/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -1
- package/es/components/Tabs/__tests__/index.spec.d.ts +0 -1
- package/es/components/Tabs/index.d.ts +0 -54
- package/es/components/Tabs/utils.d.ts +0 -2
- package/es/components/Tag/StyledTag.d.ts +0 -20
- package/es/components/Tag/__tests__/Tag.spec.d.ts +0 -1
- package/es/components/Tag/index.d.ts +0 -21
- package/es/components/Typography/Text/StyledText.d.ts +0 -13
- package/es/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -1
- package/es/components/Typography/Text/__tests__/index.spec.d.ts +0 -1
- package/es/components/Typography/Text/index.d.ts +0 -30
- package/es/components/Typography/index.d.ts +0 -6
- package/es/index.d.ts +0 -19
- package/es/theme/__tests__/index.spec.d.ts +0 -1
- package/es/theme/components/avatar.d.ts +0 -32
- package/es/theme/components/badge.d.ts +0 -29
- package/es/theme/components/bottomNavigation.d.ts +0 -23
- package/es/theme/components/card.d.ts +0 -10
- package/es/theme/components/divider.d.ts +0 -17
- package/es/theme/components/drawer.d.ts +0 -21
- package/es/theme/components/fab.d.ts +0 -51
- package/es/theme/components/icon.d.ts +0 -19
- package/es/theme/components/progress.d.ts +0 -21
- package/es/theme/components/tabs.d.ts +0 -27
- package/es/theme/components/tag.d.ts +0 -30
- package/es/theme/components/typography.d.ts +0 -26
- package/es/theme/global/borders.d.ts +0 -11
- package/es/theme/global/colors.d.ts +0 -29
- package/es/theme/global/index.d.ts +0 -39
- package/es/theme/global/scale.d.ts +0 -9
- package/es/theme/global/space.d.ts +0 -13
- package/es/theme/global/typography.d.ts +0 -21
- package/es/theme/index.d.ts +0 -33
- package/es/types.d.ts +0 -5
- package/es/utils/__tests__/scale.spec.d.ts +0 -1
- package/es/utils/helpers.d.ts +0 -2
- package/es/utils/hooks.d.ts +0 -1
- package/es/utils/scale.d.ts +0 -3
- package/lib/components/Avatar/StyledAvatar.d.ts +0 -46
- package/lib/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -1
- package/lib/components/Avatar/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Avatar/index.d.ts +0 -25
- package/lib/components/Badge/Status.d.ts +0 -24
- package/lib/components/Badge/StyledBadge.d.ts +0 -28
- package/lib/components/Badge/__tests__/Badge.spec.d.ts +0 -1
- package/lib/components/Badge/__tests__/Status.spec.d.ts +0 -1
- package/lib/components/Badge/index.d.ts +0 -32
- package/lib/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -52
- package/lib/components/BottomNavigation/__tests__/index.spec.d.ts +0 -1
- package/lib/components/BottomNavigation/index.d.ts +0 -45
- package/lib/components/Button/IconButton.d.ts +0 -34
- package/lib/components/Button/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Button/index.d.ts +0 -4
- package/lib/components/Card/StyledCard.d.ts +0 -17
- package/lib/components/Card/__tests__/StyledCard.spec.d.ts +0 -1
- package/lib/components/Card/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Card/index.d.ts +0 -22
- package/lib/components/Collapse/StyledCollapse.d.ts +0 -15
- package/lib/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -1
- package/lib/components/Collapse/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Collapse/index.d.ts +0 -23
- package/lib/components/Divider/StyledDivider.d.ts +0 -13
- package/lib/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -1
- package/lib/components/Divider/index.d.ts +0 -21
- package/lib/components/Drawer/StyledDrawer.d.ts +0 -25
- package/lib/components/Drawer/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Drawer/index.d.ts +0 -25
- package/lib/components/FAB/ActionGroup/ActionItem.d.ts +0 -12
- package/lib/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -30
- package/lib/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -13
- package/lib/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -1
- package/lib/components/FAB/ActionGroup/index.d.ts +0 -34
- package/lib/components/FAB/AnimatedFABIcon.d.ts +0 -6
- package/lib/components/FAB/FAB.d.ts +0 -34
- package/lib/components/FAB/StyledFAB.d.ts +0 -20
- package/lib/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -1
- package/lib/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -1
- package/lib/components/FAB/__tests__/index.spec.d.ts +0 -1
- package/lib/components/FAB/index.d.ts +0 -4
- package/lib/components/Icon/HeroIcon/index.d.ts +0 -13
- package/lib/components/Icon/IconList.d.ts +0 -2
- package/lib/components/Icon/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Icon/index.d.ts +0 -27
- package/lib/components/Icon/utils.d.ts +0 -2
- package/lib/components/Progress/ProgressBar.d.ts +0 -18
- package/lib/components/Progress/ProgressCircle.d.ts +0 -18
- package/lib/components/Progress/StyledProgressBar.d.ts +0 -18
- package/lib/components/Progress/StyledProgressCircle.d.ts +0 -38
- package/lib/components/Progress/index.d.ts +0 -5
- package/lib/components/Progress/types.d.ts +0 -1
- package/lib/components/Tabs/ActiveTabIndicator.d.ts +0 -8
- package/lib/components/Tabs/ScrollableTabs.d.ts +0 -3
- package/lib/components/Tabs/StyledScrollableTabs.d.ts +0 -61
- package/lib/components/Tabs/StyledTabs.d.ts +0 -55
- package/lib/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -1
- package/lib/components/Tabs/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Tabs/index.d.ts +0 -54
- package/lib/components/Tabs/utils.d.ts +0 -2
- package/lib/components/Tag/StyledTag.d.ts +0 -20
- package/lib/components/Tag/__tests__/Tag.spec.d.ts +0 -1
- package/lib/components/Tag/index.d.ts +0 -21
- package/lib/components/Typography/Text/StyledText.d.ts +0 -13
- package/lib/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -1
- package/lib/components/Typography/Text/__tests__/index.spec.d.ts +0 -1
- package/lib/components/Typography/Text/index.d.ts +0 -30
- package/lib/components/Typography/index.d.ts +0 -6
- package/lib/index.d.ts +0 -19
- package/lib/theme/__tests__/index.spec.d.ts +0 -1
- package/lib/theme/components/avatar.d.ts +0 -32
- package/lib/theme/components/badge.d.ts +0 -29
- package/lib/theme/components/bottomNavigation.d.ts +0 -23
- package/lib/theme/components/card.d.ts +0 -10
- package/lib/theme/components/divider.d.ts +0 -17
- package/lib/theme/components/drawer.d.ts +0 -21
- package/lib/theme/components/fab.d.ts +0 -51
- package/lib/theme/components/icon.d.ts +0 -19
- package/lib/theme/components/progress.d.ts +0 -21
- package/lib/theme/components/tabs.d.ts +0 -27
- package/lib/theme/components/tag.d.ts +0 -30
- package/lib/theme/components/typography.d.ts +0 -26
- package/lib/theme/global/borders.d.ts +0 -11
- package/lib/theme/global/colors.d.ts +0 -29
- package/lib/theme/global/index.d.ts +0 -39
- package/lib/theme/global/scale.d.ts +0 -9
- package/lib/theme/global/space.d.ts +0 -13
- package/lib/theme/global/typography.d.ts +0 -21
- package/lib/theme/index.d.ts +0 -33
- package/lib/types.d.ts +0 -5
- package/lib/utils/__tests__/scale.spec.d.ts +0 -1
- package/lib/utils/helpers.d.ts +0 -2
- package/lib/utils/hooks.d.ts +0 -1
- package/lib/utils/scale.d.ts +0 -3
- package/types/components/SectionHeading/__tests__/StyledHeading.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"react-native": "src/index.ts",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --ignore-path ../../.gitignore",
|
|
10
11
|
"type-check": "tsc --noEmit",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@emotion/native": "^11.9.3",
|
|
26
27
|
"@emotion/react": "^11.9.3",
|
|
27
|
-
"@hero-design/colors": "7.
|
|
28
|
+
"@hero-design/colors": "7.7.0"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
31
|
"react": "17.0.2",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"@babel/preset-env": "^7.16.11",
|
|
39
40
|
"@babel/preset-react": "^7.16.7",
|
|
40
41
|
"@babel/preset-typescript": "^7.17.12",
|
|
42
|
+
"@babel/runtime": "^7.18.9",
|
|
41
43
|
"@emotion/jest": "^11.9.3",
|
|
42
44
|
"@rollup/plugin-babel": "^5.3.1",
|
|
43
45
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[36m@hero-design/playground:type-check[0m: cache hit, replaying output [2m7c10418dc02a32a7[0m
|
|
2
|
+
[36m@hero-design/playground:type-check: [0mwarning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
|
|
3
|
+
[36m@hero-design/playground:type-check: [0m$ tsc --noEmit --w
|
|
4
|
+
[36m@hero-design/playground:type-check: [0mc2:47:14 PM - Starting compilation in watch mode...
|
|
5
|
+
[36m@hero-design/playground:type-check: [0m
|
|
6
|
+
[36m@hero-design/playground:type-check: [0m
|
|
7
|
+
[36m@hero-design/playground:type-check: [0m2:47:15 PM - Found 0 errors. Watching for file changes.
|
package/playground/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/playground",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint src expoEntry.js --ext .js,.jsx,.ts,.tsx --ignore-path ../../../.gitignore",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"visual-test": "detox build -c ios.sim.release && detox test -c ios.sim.release"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@hero-design/colors": "7.
|
|
17
|
-
"@hero-design/rn": "7.
|
|
16
|
+
"@hero-design/colors": "7.7.0",
|
|
17
|
+
"@hero-design/rn": "7.7.0",
|
|
18
18
|
"@react-native-community/masked-view": "^0.1.11",
|
|
19
19
|
"@react-navigation/core": "^6.3.0",
|
|
20
20
|
"@react-navigation/native": "^6.0.12",
|
package/playground/src/App.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import BottomSheet from './BottomSheet';
|
|
|
24
24
|
import Button from './Button';
|
|
25
25
|
import CardPlayground from './Card';
|
|
26
26
|
import CollapsePlayground from './Collapse';
|
|
27
|
+
import CheckboxPlayground from './Checkbox';
|
|
27
28
|
import ContentNavigatorPlayground from './ContentNavigator';
|
|
28
29
|
import DividerPlayground from './Divider';
|
|
29
30
|
import DrawerPlayground from './Drawer';
|
|
@@ -39,6 +40,7 @@ import SwitchPlayground from './Switch';
|
|
|
39
40
|
import TabsPlayground from './Tabs';
|
|
40
41
|
import TagPlayground from './Tag';
|
|
41
42
|
import TextInputPlayground from './TextInput';
|
|
43
|
+
import ToastPlayground from './Toast';
|
|
42
44
|
import TypographyPlayground from './Typography';
|
|
43
45
|
import MultipleThemesPlayground from './MultipleThemes';
|
|
44
46
|
|
|
@@ -56,6 +58,7 @@ type RootStackParamList = {
|
|
|
56
58
|
Button: undefined;
|
|
57
59
|
Card: undefined;
|
|
58
60
|
Collapse: undefined;
|
|
61
|
+
Checkbox: undefined;
|
|
59
62
|
ContentNavigator: undefined;
|
|
60
63
|
Divider: undefined;
|
|
61
64
|
Drawer: undefined;
|
|
@@ -72,6 +75,7 @@ type RootStackParamList = {
|
|
|
72
75
|
Tabs: undefined;
|
|
73
76
|
Tag: undefined;
|
|
74
77
|
TextInput: undefined;
|
|
78
|
+
Toast: undefined;
|
|
75
79
|
Typography: undefined;
|
|
76
80
|
MultipleThemes: undefined;
|
|
77
81
|
};
|
|
@@ -89,6 +93,7 @@ const components = [
|
|
|
89
93
|
{ name: 'Button', component: Button },
|
|
90
94
|
{ name: 'Card', component: CardPlayground },
|
|
91
95
|
{ name: 'Collapse', component: CollapsePlayground },
|
|
96
|
+
{ name: 'Checkbox', component: CheckboxPlayground },
|
|
92
97
|
{ name: 'ContentNavigator', component: ContentNavigatorPlayground },
|
|
93
98
|
{ name: 'Divider', component: DividerPlayground },
|
|
94
99
|
{ name: 'Drawer', component: DrawerPlayground },
|
|
@@ -104,6 +109,7 @@ const components = [
|
|
|
104
109
|
{ name: 'Tabs', component: TabsPlayground },
|
|
105
110
|
{ name: 'Tag', component: TagPlayground },
|
|
106
111
|
{ name: 'TextInput', component: TextInputPlayground },
|
|
112
|
+
{ name: 'Toast', component: ToastPlayground },
|
|
107
113
|
{ name: 'Typography', component: TypographyPlayground },
|
|
108
114
|
{ name: 'MultipleThemes', component: MultipleThemesPlayground },
|
|
109
115
|
] as const;
|
|
@@ -138,6 +144,8 @@ const ComponentList = ({ navigation }: Navigation) => (
|
|
|
138
144
|
data={components}
|
|
139
145
|
renderItem={({ item }) => (
|
|
140
146
|
<>
|
|
147
|
+
{/* work around to make ts-ignore work inside return component
|
|
148
|
+
// @ts-ignore */}
|
|
141
149
|
<TouchableOpacity onPress={() => navigation.navigate(item.name)}>
|
|
142
150
|
<ComponentItem name={item.name} />
|
|
143
151
|
</TouchableOpacity>
|
|
@@ -0,0 +1,55 @@
|
|
|
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;
|
|
@@ -0,0 +1,114 @@
|
|
|
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;
|
package/rollup.config.js
CHANGED
|
@@ -22,13 +22,7 @@ export default {
|
|
|
22
22
|
format: 'esm',
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
-
external: [
|
|
26
|
-
'react',
|
|
27
|
-
'react-native',
|
|
28
|
-
'react-native-safe-area-context',
|
|
29
|
-
'react-native-vector-icons',
|
|
30
|
-
'react-native-pager-view',
|
|
31
|
-
],
|
|
25
|
+
external: ['react', 'react-native', 'react-native-safe-area-context'],
|
|
32
26
|
plugins: [
|
|
33
27
|
replace({
|
|
34
28
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const StyledWrapper = styled(TouchableOpacity)(({ theme, disabled }) => ({
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'row',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
height: theme.__hd__.checkbox.sizes.base,
|
|
9
|
+
width: theme.__hd__.checkbox.sizes.base,
|
|
10
|
+
borderRadius: theme.__hd__.checkbox.radii.base,
|
|
11
|
+
borderWidth: theme.__hd__.checkbox.borderWidths.default,
|
|
12
|
+
borderColor: disabled
|
|
13
|
+
? theme.__hd__.checkbox.colors.disabled
|
|
14
|
+
: theme.__hd__.checkbox.colors.borderColor,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
export { StyledWrapper };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import { StyledWrapper } from '../StyledCheckbox';
|
|
4
|
+
|
|
5
|
+
describe('StyledWrapper', () => {
|
|
6
|
+
it('renders correct style', () => {
|
|
7
|
+
const { toJSON } = renderWithTheme(<StyledWrapper />);
|
|
8
|
+
expect(toJSON()).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`StyledWrapper renders correct style 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
accessible={true}
|
|
6
|
+
collapsable={false}
|
|
7
|
+
focusable={false}
|
|
8
|
+
nativeID="animatedComponent"
|
|
9
|
+
onClick={[Function]}
|
|
10
|
+
onResponderGrant={[Function]}
|
|
11
|
+
onResponderMove={[Function]}
|
|
12
|
+
onResponderRelease={[Function]}
|
|
13
|
+
onResponderTerminate={[Function]}
|
|
14
|
+
onResponderTerminationRequest={[Function]}
|
|
15
|
+
onStartShouldSetResponder={[Function]}
|
|
16
|
+
style={
|
|
17
|
+
Object {
|
|
18
|
+
"borderColor": "#7622d7",
|
|
19
|
+
"borderRadius": 4,
|
|
20
|
+
"borderWidth": 2,
|
|
21
|
+
"display": "flex",
|
|
22
|
+
"flexDirection": "row",
|
|
23
|
+
"height": 24,
|
|
24
|
+
"justifyContent": "center",
|
|
25
|
+
"opacity": 1,
|
|
26
|
+
"overflow": "hidden",
|
|
27
|
+
"width": 24,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Checkbox renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
accessible={true}
|
|
6
|
+
collapsable={false}
|
|
7
|
+
focusable={false}
|
|
8
|
+
nativeID="animatedComponent"
|
|
9
|
+
onClick={[Function]}
|
|
10
|
+
onResponderGrant={[Function]}
|
|
11
|
+
onResponderMove={[Function]}
|
|
12
|
+
onResponderRelease={[Function]}
|
|
13
|
+
onResponderTerminate={[Function]}
|
|
14
|
+
onResponderTerminationRequest={[Function]}
|
|
15
|
+
onStartShouldSetResponder={[Function]}
|
|
16
|
+
style={
|
|
17
|
+
Object {
|
|
18
|
+
"borderColor": "#7622d7",
|
|
19
|
+
"borderRadius": 4,
|
|
20
|
+
"borderWidth": 2,
|
|
21
|
+
"display": "flex",
|
|
22
|
+
"flexDirection": "row",
|
|
23
|
+
"height": 24,
|
|
24
|
+
"justifyContent": "center",
|
|
25
|
+
"opacity": 1,
|
|
26
|
+
"overflow": "hidden",
|
|
27
|
+
"width": 24,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
testID="checkbox"
|
|
31
|
+
/>
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
exports[`Checkbox trigger press function correctly 1`] = `
|
|
35
|
+
<View
|
|
36
|
+
accessible={true}
|
|
37
|
+
collapsable={false}
|
|
38
|
+
focusable={true}
|
|
39
|
+
nativeID="animatedComponent"
|
|
40
|
+
onClick={[Function]}
|
|
41
|
+
onResponderGrant={[Function]}
|
|
42
|
+
onResponderMove={[Function]}
|
|
43
|
+
onResponderRelease={[Function]}
|
|
44
|
+
onResponderTerminate={[Function]}
|
|
45
|
+
onResponderTerminationRequest={[Function]}
|
|
46
|
+
onStartShouldSetResponder={[Function]}
|
|
47
|
+
style={
|
|
48
|
+
Object {
|
|
49
|
+
"borderColor": "#7622d7",
|
|
50
|
+
"borderRadius": 4,
|
|
51
|
+
"borderWidth": 2,
|
|
52
|
+
"display": "flex",
|
|
53
|
+
"flexDirection": "row",
|
|
54
|
+
"height": 24,
|
|
55
|
+
"justifyContent": "center",
|
|
56
|
+
"opacity": 1,
|
|
57
|
+
"overflow": "hidden",
|
|
58
|
+
"width": 24,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
testID="checkbox"
|
|
62
|
+
/>
|
|
63
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
3
|
+
|
|
4
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
5
|
+
import Checkbox from '..';
|
|
6
|
+
|
|
7
|
+
describe('Checkbox', () => {
|
|
8
|
+
it('renders correctly', () => {
|
|
9
|
+
const wrapper = renderWithTheme(<Checkbox testID="checkbox" />);
|
|
10
|
+
expect(wrapper.queryAllByTestId('checkbox')).toHaveLength(1);
|
|
11
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('trigger press function correctly', () => {
|
|
15
|
+
const pressFn = jest.fn();
|
|
16
|
+
const wrapper = renderWithTheme(
|
|
17
|
+
<Checkbox testID="checkbox" onPress={pressFn} />
|
|
18
|
+
);
|
|
19
|
+
fireEvent.press(wrapper.getByTestId('checkbox'));
|
|
20
|
+
|
|
21
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
22
|
+
expect(pressFn).toBeCalled();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import theme from '../../theme';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
import { StyledWrapper } from './StyledCheckbox';
|
|
6
|
+
|
|
7
|
+
export interface CheckboxProps {
|
|
8
|
+
/**
|
|
9
|
+
* Control whether the switch is checked
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the switch is disabled
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Event handler.
|
|
18
|
+
*/
|
|
19
|
+
onPress?: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Addditional style.
|
|
22
|
+
*/
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
/**
|
|
25
|
+
* Testing id of the component.
|
|
26
|
+
*/
|
|
27
|
+
testID?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const CheckBox = ({
|
|
31
|
+
checked,
|
|
32
|
+
disabled,
|
|
33
|
+
onPress,
|
|
34
|
+
style,
|
|
35
|
+
testID,
|
|
36
|
+
}: CheckboxProps) => (
|
|
37
|
+
<StyledWrapper
|
|
38
|
+
onPress={onPress}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
style={style}
|
|
41
|
+
testID={testID}
|
|
42
|
+
>
|
|
43
|
+
{checked && (
|
|
44
|
+
<Icon
|
|
45
|
+
icon="circle-ok"
|
|
46
|
+
intent="primary"
|
|
47
|
+
size="large"
|
|
48
|
+
style={{
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: theme.__hd__.checkbox.space.iconTop,
|
|
51
|
+
...(disabled ? { color: theme.__hd__.checkbox.colors.disabled } : {}),
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</StyledWrapper>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export default CheckBox;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Animated,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
View,
|
|
8
|
+
ViewProps,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
const ToastContainerWrapper = styled(View)<{ position: 'top' | 'bottom' }>(
|
|
12
|
+
({ theme, position }) => ({
|
|
13
|
+
...StyleSheet.absoluteFillObject,
|
|
14
|
+
paddingHorizontal: theme.__hd__.toast.space.largePadding,
|
|
15
|
+
paddingVertical: theme.__hd__.toast.space.mediumPadding,
|
|
16
|
+
flexDirection: position === 'bottom' ? 'column-reverse' : 'column',
|
|
17
|
+
elevation: 9999,
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const Container = styled(Animated.View)<{
|
|
22
|
+
themeVariant: 'default' | 'round';
|
|
23
|
+
themeIntent: 'success' | 'info' | 'warning' | 'error';
|
|
24
|
+
}>(({ theme, themeVariant, themeIntent }) => ({
|
|
25
|
+
borderRadius: themeVariant === 'round' ? theme.__hd__.toast.radii.default : 0,
|
|
26
|
+
backgroundColor: theme.__hd__.toast.colors[themeIntent],
|
|
27
|
+
minHeight: theme.__hd__.toast.sizes.height,
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const IconContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
paddingLeft: theme.__hd__.toast.space.mediumPadding,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const TextContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
37
|
+
paddingHorizontal: theme.__hd__.toast.space.mediumPadding,
|
|
38
|
+
flex: 1,
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const ContentContainer = styled(View)<{ showDivider: boolean }>(
|
|
42
|
+
({ theme, showDivider }) => ({
|
|
43
|
+
paddingVertical: theme.__hd__.toast.space.mediumPadding,
|
|
44
|
+
flex: 1,
|
|
45
|
+
borderRightWidth: showDivider ? theme.__hd__.toast.borderWidths.base : 0,
|
|
46
|
+
borderColor: theme.__hd__.toast.colors.divider,
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const CTAWrapper = styled(TouchableOpacity)<
|
|
52
|
+
ComponentProps<typeof TouchableOpacity>
|
|
53
|
+
>(({ theme }) => ({
|
|
54
|
+
paddingHorizontal: theme.__hd__.alert.space.padding,
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
ToastContainerWrapper,
|
|
60
|
+
Container,
|
|
61
|
+
ContentContainer,
|
|
62
|
+
TextContainer,
|
|
63
|
+
IconContainer,
|
|
64
|
+
CTAWrapper,
|
|
65
|
+
};
|