@hero-design/rn 7.6.1-alpha.0 → 7.8.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 +4528 -432
- package/lib/index.js +4616 -516
- package/package.json +6 -8
- package/rollup.config.js +1 -7
- 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 +20 -0
- package/src/components/Card/DataCard/__tests__/StyledDataCard.spec.tsx +24 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +97 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +156 -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/index.tsx +7 -2
- 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/Collapse/index.tsx +1 -1
- package/src/components/Icon/index.tsx +1 -1
- 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/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/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 +8 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +119 -2
- package/src/theme/components/button.ts +2 -0
- package/src/theme/components/card.ts +8 -1
- package/src/theme/components/checkbox.ts +37 -0
- package/src/theme/components/list.ts +46 -0
- package/src/theme/components/toast.ts +33 -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 +12 -0
- package/tsconfig.json +1 -2
- package/types/components/Alert/StyledAlert.d.ts +0 -0
- package/types/components/Alert/__tests__/index.spec.d.ts +0 -0
- package/types/components/Alert/index.d.ts +0 -0
- 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/{es/components/Card/StyledCard.d.ts → types/components/Card/DataCard/StyledDataCard.d.ts} +5 -6
- package/{es/components/Avatar/__tests__/StyledAvatar.spec.d.ts → types/components/Card/DataCard/__tests__/StyledDataCard.spec.d.ts} +0 -0
- package/{es/components/Avatar → types/components/Card/DataCard}/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/DataCard/index.d.ts +22 -0
- package/types/components/Card/index.d.ts +7 -3
- package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
- package/types/components/Checkbox/__tests__/StyledCheckbox.spec.d.ts +0 -0
- package/types/components/Checkbox/__tests__/index.spec.d.ts +0 -0
- package/types/components/Checkbox/index.d.ts +1 -1
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- 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/{es/components/Badge/__tests__/Badge.spec.d.ts → types/components/List/__tests__/BasicListItem.spec.d.ts} +0 -0
- package/{es/components/Badge/__tests__/Status.spec.d.ts → types/components/List/__tests__/ListItem.spec.d.ts} +0 -0
- package/{es/components/BottomNavigation/__tests__/index.spec.d.ts → types/components/List/__tests__/StyledBasicListItem.spec.d.ts} +0 -0
- package/{es/components/Button/__tests__/index.spec.d.ts → types/components/List/__tests__/StyledListItem.spec.d.ts} +0 -0
- package/types/components/List/index.d.ts +8 -0
- package/types/components/Radio/types.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/SectionHeading/index.d.ts +1 -1
- package/types/components/Select/Footer.d.ts +5 -0
- package/types/components/Select/MultiSelect/Footer.d.ts +0 -0
- 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/StyledMultiSelect.d.ts +0 -0
- package/{es/components/Card/__tests__/StyledCard.spec.d.ts → types/components/Select/MultiSelect/__tests__/Option.spec.d.ts} +0 -0
- package/{es/components/Card/__tests__/index.spec.d.ts → types/components/Select/MultiSelect/__tests__/OptionList.spec.d.ts} +0 -0
- package/types/components/Select/MultiSelect/__tests__/StyledMultiSelect.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/index.d.ts +4 -4
- package/types/components/Select/MultiSelect/types.d.ts +0 -0
- package/types/components/Select/SingleSelect/Option.d.ts +6 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +9 -0
- package/{es/components/Collapse/__tests__/StyledCollapse.spec.d.ts → types/components/Select/SingleSelect/__tests__/Option.spec.d.ts} +0 -0
- package/{es/components/Collapse/__tests__/index.spec.d.ts → types/components/Select/SingleSelect/__tests__/OptionList.spec.d.ts} +0 -0
- package/{es/components/Drawer → types/components/Select/SingleSelect}/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/index.d.ts +35 -0
- package/types/components/Select/StyledSelect.d.ts +26 -0
- package/{es/components/Divider/__tests__/StyledDivider.spec.d.ts → types/components/Select/__tests__/StyledSelect.spec.d.ts} +0 -0
- package/types/components/Select/helpers.d.ts +2 -0
- package/types/components/Select/index.d.ts +3 -3
- package/types/components/Select/types.d.ts +5 -0
- package/types/components/Switch/StyledSwitch.d.ts +0 -0
- package/types/components/Switch/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/Switch/__tests__/index.spec.d.ts +0 -0
- package/types/components/Switch/index.d.ts +1 -1
- 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/FAB/__tests__/AnimatedFABIcon.spec.d.ts → types/components/Toast/__tests__/Toast.spec.d.ts} +0 -0
- package/{es/components/FAB/__tests__/StyledFAB.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/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/{es/components/FAB/__tests__/index.spec.d.ts → types/components/Toolbar/__tests__/ToolbarGroup.spec.d.ts} +0 -0
- package/{es/components/Icon/__tests__/index.spec.d.ts → types/components/Toolbar/__tests__/ToolbarItem.spec.d.ts} +0 -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 +5 -1
- package/types/theme/components/alert.d.ts +0 -0
- package/types/theme/components/button.d.ts +2 -0
- package/types/theme/components/card.d.ts +7 -0
- package/types/theme/components/checkbox.d.ts +0 -0
- package/types/theme/components/list.d.ts +40 -0
- package/types/theme/components/sectionHeading.d.ts +0 -0
- package/types/theme/components/select.d.ts +0 -0
- package/types/theme/components/switch.d.ts +0 -0
- package/types/theme/components/toast.d.ts +24 -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 +8 -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/index.d.ts +0 -32
- package/es/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -52
- package/es/components/BottomNavigation/index.d.ts +0 -45
- package/es/components/Button/IconButton.d.ts +0 -34
- package/es/components/Button/index.d.ts +0 -4
- package/es/components/Card/index.d.ts +0 -22
- package/es/components/Collapse/StyledCollapse.d.ts +0 -15
- package/es/components/Collapse/index.d.ts +0 -23
- package/es/components/Divider/StyledDivider.d.ts +0 -13
- package/es/components/Divider/index.d.ts +0 -21
- package/es/components/Drawer/StyledDrawer.d.ts +0 -25
- 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/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/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/playground/.detoxrc.json +0 -49
- package/playground/.prettierrc.json +0 -8
- 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 -202
- 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/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/Typography.tsx +0 -23
- package/playground/tsconfig.json +0 -21
- package/src/components/Select/MultiSelect/Footer.tsx +0 -15
- package/types/components/SectionHeading/__tests__/StyledHeading.d.ts +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ToastContainer renders correctly with displayType: displayType, position: bottom 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
pointerEvents="box-none"
|
|
6
|
+
position="bottom"
|
|
7
|
+
style={
|
|
8
|
+
Array [
|
|
9
|
+
Object {
|
|
10
|
+
"bottom": 0,
|
|
11
|
+
"elevation": 9999,
|
|
12
|
+
"flexDirection": "column-reverse",
|
|
13
|
+
"left": 0,
|
|
14
|
+
"paddingHorizontal": 24,
|
|
15
|
+
"paddingVertical": 16,
|
|
16
|
+
"position": "absolute",
|
|
17
|
+
"right": 0,
|
|
18
|
+
"top": 0,
|
|
19
|
+
},
|
|
20
|
+
undefined,
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
/>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`ToastContainer renders correctly with displayType: displayType, position: top 1`] = `
|
|
27
|
+
<View
|
|
28
|
+
pointerEvents="box-none"
|
|
29
|
+
position="top"
|
|
30
|
+
style={
|
|
31
|
+
Array [
|
|
32
|
+
Object {
|
|
33
|
+
"bottom": 0,
|
|
34
|
+
"elevation": 9999,
|
|
35
|
+
"flexDirection": "column",
|
|
36
|
+
"left": 0,
|
|
37
|
+
"paddingHorizontal": 24,
|
|
38
|
+
"paddingVertical": 16,
|
|
39
|
+
"position": "absolute",
|
|
40
|
+
"right": 0,
|
|
41
|
+
"top": 0,
|
|
42
|
+
},
|
|
43
|
+
undefined,
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
exports[`ToastContainer renders correctly with displayType: single, position: bottom 1`] = `
|
|
50
|
+
<View
|
|
51
|
+
pointerEvents="box-none"
|
|
52
|
+
position="bottom"
|
|
53
|
+
style={
|
|
54
|
+
Array [
|
|
55
|
+
Object {
|
|
56
|
+
"bottom": 0,
|
|
57
|
+
"elevation": 9999,
|
|
58
|
+
"flexDirection": "column-reverse",
|
|
59
|
+
"left": 0,
|
|
60
|
+
"paddingHorizontal": 24,
|
|
61
|
+
"paddingVertical": 16,
|
|
62
|
+
"position": "absolute",
|
|
63
|
+
"right": 0,
|
|
64
|
+
"top": 0,
|
|
65
|
+
},
|
|
66
|
+
undefined,
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
/>
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
exports[`ToastContainer renders correctly with displayType: single, position: top 1`] = `
|
|
73
|
+
<View
|
|
74
|
+
pointerEvents="box-none"
|
|
75
|
+
position="top"
|
|
76
|
+
style={
|
|
77
|
+
Array [
|
|
78
|
+
Object {
|
|
79
|
+
"bottom": 0,
|
|
80
|
+
"elevation": 9999,
|
|
81
|
+
"flexDirection": "column",
|
|
82
|
+
"left": 0,
|
|
83
|
+
"paddingHorizontal": 24,
|
|
84
|
+
"paddingVertical": 16,
|
|
85
|
+
"position": "absolute",
|
|
86
|
+
"right": 0,
|
|
87
|
+
"top": 0,
|
|
88
|
+
},
|
|
89
|
+
undefined,
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ToastContainer from './ToastContainer';
|
|
2
|
+
import ToastProvider from './ToastProvider';
|
|
3
|
+
import { useToast } from './ToastContext';
|
|
4
|
+
|
|
5
|
+
const Toast = {
|
|
6
|
+
Provider: ToastProvider,
|
|
7
|
+
Container: ToastContainer,
|
|
8
|
+
useToast,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default Toast;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { IconName } from '../Icon';
|
|
4
|
+
|
|
5
|
+
export interface ToastProps {
|
|
6
|
+
/**
|
|
7
|
+
* Toast content.
|
|
8
|
+
*/
|
|
9
|
+
content: string | ReactElement;
|
|
10
|
+
/**
|
|
11
|
+
* Icon name of the Toast.
|
|
12
|
+
* - undefined: use default icon according to Toast intent.
|
|
13
|
+
* - null: no icon at all.
|
|
14
|
+
* - IconName: an icon identifier from hero-design icon list.
|
|
15
|
+
*/
|
|
16
|
+
icon?: null | IconName;
|
|
17
|
+
/**
|
|
18
|
+
* Visual intent color to apply to alert.
|
|
19
|
+
*/
|
|
20
|
+
intent?: 'success' | 'info' | 'warning' | 'error';
|
|
21
|
+
/**
|
|
22
|
+
* Toast variants
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'default' | 'round';
|
|
25
|
+
/**
|
|
26
|
+
* Whether the toast message should be dismissed after the duration expired.
|
|
27
|
+
*/
|
|
28
|
+
autoDismiss?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Duration (in miliseconds) of how long the toast message will be displayed before it disapprears.
|
|
31
|
+
*/
|
|
32
|
+
duration?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Display action button with passed on the right side of the toast message.
|
|
35
|
+
* This action button will will dismiss the toast on pressed.
|
|
36
|
+
*/
|
|
37
|
+
actionLabel?: string | ReactElement;
|
|
38
|
+
/**
|
|
39
|
+
* Callback that will be called when the action button of the toast is pressed.
|
|
40
|
+
*/
|
|
41
|
+
onAction?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback that will be called when the toast message is dismissed.
|
|
44
|
+
*/
|
|
45
|
+
onDismiss?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Addtitional style.
|
|
48
|
+
*/
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ToastContainerProps {
|
|
53
|
+
/**
|
|
54
|
+
* Displays multiple toasts at a time or one by one.
|
|
55
|
+
*/
|
|
56
|
+
displayType?: 'single' | 'stack';
|
|
57
|
+
/**
|
|
58
|
+
* Position that the toast message will appear on the screen.
|
|
59
|
+
*/
|
|
60
|
+
position?: 'top' | 'bottom';
|
|
61
|
+
/**
|
|
62
|
+
* Additional style for toasts container.
|
|
63
|
+
*/
|
|
64
|
+
style?: StyleProp<ViewStyle>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ToastItemProps = {
|
|
68
|
+
id: string;
|
|
69
|
+
props: Omit<ToastProps, 'position'>;
|
|
70
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { TouchableOpacity, View, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const ToolbarWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
bottom: 0,
|
|
7
|
+
left: 0,
|
|
8
|
+
right: 0,
|
|
9
|
+
zIndex: 9999,
|
|
10
|
+
elevation: 9999,
|
|
11
|
+
width: '100%',
|
|
12
|
+
paddingVertical: theme.__hd__.toolbar.space.verticalPadding,
|
|
13
|
+
paddingHorizontal: theme.__hd__.toolbar.space.horizontalPadding,
|
|
14
|
+
borderTopWidth: theme.__hd__.toolbar.borderWidths.default,
|
|
15
|
+
borderColor: theme.__hd__.toolbar.colors.border,
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
backgroundColor: theme.__hd__.toolbar.colors.background,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const alignment = {
|
|
22
|
+
left: 'flex-start',
|
|
23
|
+
center: 'center',
|
|
24
|
+
right: 'flex-end',
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
const ToolbarGroupWrapper = styled(View)<{
|
|
28
|
+
align: 'left' | 'center' | 'right';
|
|
29
|
+
}>(({ align }) => ({
|
|
30
|
+
flex: 1,
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
justifyContent: alignment[align],
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const ToolbarItemWrapper = styled(TouchableOpacity)(({ theme }) => ({
|
|
37
|
+
paddingVertical: theme.__hd__.toolbar.space.verticalPadding,
|
|
38
|
+
paddingHorizontal: theme.__hd__.toolbar.space.horizontalPadding,
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export { ToolbarWrapper, ToolbarGroupWrapper, ToolbarItemWrapper };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarGroupWrapper } from './StyledToolbar';
|
|
3
|
+
import ToolbarItem, { ToolbarItemProps } from './ToolbarItem';
|
|
4
|
+
|
|
5
|
+
export interface ToolbarGroupProps {
|
|
6
|
+
/**
|
|
7
|
+
* List of action items in the toolbar group.
|
|
8
|
+
*/
|
|
9
|
+
items?: ToolbarItemProps[];
|
|
10
|
+
/**
|
|
11
|
+
* Alignment of the items in the group.
|
|
12
|
+
*/
|
|
13
|
+
align: 'left' | 'center' | 'right';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const ToolbarGroup = ({ align = 'right', items = [] }: ToolbarGroupProps) => (
|
|
17
|
+
<ToolbarGroupWrapper align={align}>
|
|
18
|
+
{items.map(({ label, icon, onPress, disabled, intent }) => (
|
|
19
|
+
<ToolbarItem
|
|
20
|
+
key={`${label}-${icon}`}
|
|
21
|
+
label={label}
|
|
22
|
+
icon={icon}
|
|
23
|
+
intent={intent}
|
|
24
|
+
onPress={onPress}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
/>
|
|
27
|
+
))}
|
|
28
|
+
</ToolbarGroupWrapper>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default ToolbarGroup;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Icon, { IconName } from '../Icon';
|
|
3
|
+
import Typography from '../Typography';
|
|
4
|
+
import { ToolbarItemWrapper } from './StyledToolbar';
|
|
5
|
+
|
|
6
|
+
export interface ToolbarItemProps {
|
|
7
|
+
/**
|
|
8
|
+
* Visual intent of the toolbar item.
|
|
9
|
+
*/
|
|
10
|
+
intent?: 'primary' | 'info' | 'success' | 'danger' | 'warning';
|
|
11
|
+
/**
|
|
12
|
+
* Icon of the toolbar item.
|
|
13
|
+
*/
|
|
14
|
+
icon?: IconName;
|
|
15
|
+
/**
|
|
16
|
+
* Action label of the toolbar item.
|
|
17
|
+
*/
|
|
18
|
+
label?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Callback that trigger when user press the toolbar item.
|
|
21
|
+
*/
|
|
22
|
+
onPress?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the toolbar item is disabled.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ToolbarItem = ({
|
|
30
|
+
icon,
|
|
31
|
+
label,
|
|
32
|
+
onPress,
|
|
33
|
+
intent = 'primary',
|
|
34
|
+
disabled = false,
|
|
35
|
+
}: ToolbarItemProps) => (
|
|
36
|
+
<ToolbarItemWrapper onPress={onPress} disabled={disabled}>
|
|
37
|
+
{icon ? (
|
|
38
|
+
<Icon
|
|
39
|
+
icon={icon}
|
|
40
|
+
size={label ? 'medium' : 'large'}
|
|
41
|
+
intent={disabled ? 'disabled-text' : intent}
|
|
42
|
+
testID={`toolbar-item-icon-${icon}`}
|
|
43
|
+
/>
|
|
44
|
+
) : null}
|
|
45
|
+
{label ? (
|
|
46
|
+
<Typography.Text
|
|
47
|
+
fontSize={icon ? 'small' : 'large'}
|
|
48
|
+
fontWeight="semi-bold"
|
|
49
|
+
intent={disabled ? 'subdued' : intent}
|
|
50
|
+
>
|
|
51
|
+
{label}
|
|
52
|
+
</Typography.Text>
|
|
53
|
+
) : null}
|
|
54
|
+
</ToolbarItemWrapper>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export default ToolbarItem;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import ToolbarGroup from '../ToolbarGroup';
|
|
4
|
+
|
|
5
|
+
describe('ToolbarGroup', () => {
|
|
6
|
+
it.each`
|
|
7
|
+
align
|
|
8
|
+
${'left'}
|
|
9
|
+
${'right'}
|
|
10
|
+
${'center'}
|
|
11
|
+
`('renders correctly with when align is $align', ({ align }) => {
|
|
12
|
+
const { toJSON } = renderWithTheme(
|
|
13
|
+
<ToolbarGroup
|
|
14
|
+
align={align}
|
|
15
|
+
items={[
|
|
16
|
+
{
|
|
17
|
+
label: 'Discard',
|
|
18
|
+
icon: 'home',
|
|
19
|
+
onPress: jest.fn(),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Print',
|
|
23
|
+
icon: 'print',
|
|
24
|
+
onPress: jest.fn(),
|
|
25
|
+
},
|
|
26
|
+
]}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
expect(toJSON()).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
import ToolbarItem from '../ToolbarItem';
|
|
5
|
+
|
|
6
|
+
describe('ToolbarItems', () => {
|
|
7
|
+
it.each`
|
|
8
|
+
intent
|
|
9
|
+
${'primary'}
|
|
10
|
+
${'info'}
|
|
11
|
+
${'success'}
|
|
12
|
+
${'danger'}
|
|
13
|
+
${'warning'}
|
|
14
|
+
`('renders correctly when intent is $intent', ({ intent }) => {
|
|
15
|
+
const onPress = jest.fn();
|
|
16
|
+
const { toJSON, getByText, getByTestId } = renderWithTheme(
|
|
17
|
+
<ToolbarItem
|
|
18
|
+
label="Action"
|
|
19
|
+
intent={intent}
|
|
20
|
+
icon="home"
|
|
21
|
+
onPress={onPress}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(toJSON()).toMatchSnapshot();
|
|
26
|
+
expect(getByText('Action')).toBeDefined();
|
|
27
|
+
expect(getByTestId('toolbar-item-icon-home')).toBeDefined();
|
|
28
|
+
|
|
29
|
+
fireEvent.press(getByText('Action'));
|
|
30
|
+
expect(onPress).toBeCalled();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('renders correctly when disabled', () => {
|
|
34
|
+
const onPress = jest.fn();
|
|
35
|
+
const { toJSON, getByText } = renderWithTheme(
|
|
36
|
+
<ToolbarItem
|
|
37
|
+
label="Action"
|
|
38
|
+
icon="home"
|
|
39
|
+
intent="primary"
|
|
40
|
+
onPress={onPress}
|
|
41
|
+
disabled
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(toJSON()).toMatchSnapshot();
|
|
46
|
+
fireEvent.press(getByText('Action'));
|
|
47
|
+
expect(onPress).not.toBeCalled();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('not renders icon when icon prop is not provided', () => {
|
|
51
|
+
const { queryByTestId } = renderWithTheme(
|
|
52
|
+
<ToolbarItem label="Action" intent="primary" />
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect(queryByTestId('toolbar-item-icon')).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|