@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,35 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
|
+
import { StyledDataCard, Indicator } from './StyledDataCard';
|
|
4
|
+
|
|
5
|
+
export interface DataCardProps extends ViewProps {
|
|
6
|
+
/**
|
|
7
|
+
* Card's content.
|
|
8
|
+
*/
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Visual intent color to apply to card.
|
|
12
|
+
*/
|
|
13
|
+
intent?: 'success' | 'info' | 'warning' | 'danger' | 'archived';
|
|
14
|
+
/**
|
|
15
|
+
* Additional style.
|
|
16
|
+
*/
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
/**
|
|
19
|
+
* Testing id of the component.
|
|
20
|
+
*/
|
|
21
|
+
testID?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DataCard = ({
|
|
25
|
+
intent = 'info',
|
|
26
|
+
children,
|
|
27
|
+
...nativeProps
|
|
28
|
+
}: DataCardProps): JSX.Element => (
|
|
29
|
+
<StyledDataCard {...nativeProps}>
|
|
30
|
+
<Indicator themeIntent={intent} testID="data-card-indicator" />
|
|
31
|
+
{children}
|
|
32
|
+
</StyledDataCard>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default DataCard;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
|
+
import DataCard from './DataCard';
|
|
3
4
|
import { StyledCard, LeftDataCard } from './StyledCard';
|
|
4
5
|
|
|
5
6
|
interface CardProps extends ViewProps {
|
|
@@ -9,10 +10,12 @@ interface CardProps extends ViewProps {
|
|
|
9
10
|
children?: ReactNode;
|
|
10
11
|
/**
|
|
11
12
|
* Card type.
|
|
13
|
+
* This is now deprecated. If you want to use "data" variant, please use Card.Data instead.
|
|
14
|
+
* @deprecated
|
|
12
15
|
*/
|
|
13
16
|
variant?: 'basic' | 'data';
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* Additional style.
|
|
16
19
|
*/
|
|
17
20
|
style?: StyleProp<ViewStyle>;
|
|
18
21
|
/**
|
|
@@ -32,4 +35,6 @@ const Card = ({
|
|
|
32
35
|
</StyledCard>
|
|
33
36
|
);
|
|
34
37
|
|
|
35
|
-
export default Card
|
|
38
|
+
export default Object.assign(Card, {
|
|
39
|
+
Data: DataCard,
|
|
40
|
+
});
|
|
@@ -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
|
+
* Additional 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,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import Icon, { IconName } from '../Icon';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
import {
|
|
7
|
+
StyledPrefixContainer,
|
|
8
|
+
StyledSuffixContainer,
|
|
9
|
+
StyledTitleContainer,
|
|
10
|
+
StyledListItemContainer,
|
|
11
|
+
} from './StyledBasicListItem';
|
|
12
|
+
|
|
13
|
+
export interface ListItemProps {
|
|
14
|
+
/**
|
|
15
|
+
* Name of Icon or component to render on the left side of title.
|
|
16
|
+
*/
|
|
17
|
+
prefix?: IconName | React.ReactElement;
|
|
18
|
+
/**
|
|
19
|
+
* Name of Icon or component to render on the right side of title.
|
|
20
|
+
*/
|
|
21
|
+
suffix?: IconName | React.ReactElement;
|
|
22
|
+
/**
|
|
23
|
+
* The title of the component.
|
|
24
|
+
*/
|
|
25
|
+
title: string;
|
|
26
|
+
/**
|
|
27
|
+
* The subtile title of the component.
|
|
28
|
+
*/
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the component is disabled. Default value is false
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the component is selected. Default value is false
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Additional wrapper style.
|
|
40
|
+
*/
|
|
41
|
+
style?: StyleProp<ViewStyle>;
|
|
42
|
+
/**
|
|
43
|
+
* Testing id of the component.
|
|
44
|
+
*/
|
|
45
|
+
testID?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Set the handler to handle press event.
|
|
48
|
+
*/
|
|
49
|
+
onPress?: () => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const BasicListItem = ({
|
|
53
|
+
prefix,
|
|
54
|
+
suffix,
|
|
55
|
+
title,
|
|
56
|
+
subtitle,
|
|
57
|
+
style,
|
|
58
|
+
testID,
|
|
59
|
+
selected = false,
|
|
60
|
+
disabled = false,
|
|
61
|
+
onPress,
|
|
62
|
+
}: ListItemProps): JSX.Element => (
|
|
63
|
+
<StyledListItemContainer
|
|
64
|
+
style={style}
|
|
65
|
+
testID={testID}
|
|
66
|
+
themeSelected={selected}
|
|
67
|
+
themeDisabled={disabled}
|
|
68
|
+
onPress={onPress}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
>
|
|
71
|
+
{prefix && (
|
|
72
|
+
<StyledPrefixContainer>
|
|
73
|
+
{typeof prefix === 'string' ? <Icon icon={prefix} /> : prefix}
|
|
74
|
+
</StyledPrefixContainer>
|
|
75
|
+
)}
|
|
76
|
+
<StyledTitleContainer>
|
|
77
|
+
<Typography.Text intent="body" fontSize="large">
|
|
78
|
+
{title}
|
|
79
|
+
</Typography.Text>
|
|
80
|
+
{subtitle && (
|
|
81
|
+
<Typography.Text intent="subdued" fontSize="small">
|
|
82
|
+
{subtitle}
|
|
83
|
+
</Typography.Text>
|
|
84
|
+
)}
|
|
85
|
+
</StyledTitleContainer>
|
|
86
|
+
{suffix && (
|
|
87
|
+
<StyledSuffixContainer>
|
|
88
|
+
{typeof suffix === 'string' ? (
|
|
89
|
+
<Icon icon={suffix} intent="text" size="small" />
|
|
90
|
+
) : (
|
|
91
|
+
suffix
|
|
92
|
+
)}
|
|
93
|
+
</StyledSuffixContainer>
|
|
94
|
+
)}
|
|
95
|
+
</StyledListItemContainer>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
export default BasicListItem;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { StyleProp, ViewStyle, View } from 'react-native';
|
|
4
|
+
import Icon, { IconName } from '../Icon';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
import {
|
|
7
|
+
StyledListItemContainer,
|
|
8
|
+
StyledChildrenContainer,
|
|
9
|
+
StyledLeadingStatus,
|
|
10
|
+
StyledContentContainer,
|
|
11
|
+
StyledPrefixContainer,
|
|
12
|
+
StyledSuffixContainer,
|
|
13
|
+
StyledTitleContainer,
|
|
14
|
+
} from './StyledListItem';
|
|
15
|
+
|
|
16
|
+
export interface ListItemProps {
|
|
17
|
+
/**
|
|
18
|
+
* Name of Icon or ReactElement to render on the left side of title.
|
|
19
|
+
*/
|
|
20
|
+
prefix?: IconName | React.ReactElement;
|
|
21
|
+
/**
|
|
22
|
+
* Name of Icon or ReactElement to render on the right side of title.
|
|
23
|
+
*/
|
|
24
|
+
suffix?: IconName | React.ReactElement;
|
|
25
|
+
/**
|
|
26
|
+
* The title of the component.
|
|
27
|
+
*/
|
|
28
|
+
title?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The subtile title of the component.
|
|
31
|
+
*/
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Additional wrapper style.
|
|
35
|
+
*/
|
|
36
|
+
style?: StyleProp<ViewStyle>;
|
|
37
|
+
/**
|
|
38
|
+
* Children to be rendered inside the component.
|
|
39
|
+
*/
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Leading status of the component
|
|
43
|
+
* */
|
|
44
|
+
leadingStatus?: 'success' | 'warning' | 'danger' | 'info' | 'archived';
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
* Card styles. Default is `full-width`
|
|
48
|
+
*/
|
|
49
|
+
variant?: 'full-width' | 'card';
|
|
50
|
+
/**
|
|
51
|
+
* Whether the component is disabled. Default value is false
|
|
52
|
+
*/
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/** * Whether the component is selected. Default value is false
|
|
55
|
+
*/
|
|
56
|
+
selected?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Testing id of the component.
|
|
59
|
+
*/
|
|
60
|
+
testID?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Set the handler to handle press event.
|
|
63
|
+
*/
|
|
64
|
+
onPress?: () => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const ListItem = ({
|
|
68
|
+
prefix,
|
|
69
|
+
suffix,
|
|
70
|
+
title,
|
|
71
|
+
subtitle,
|
|
72
|
+
style,
|
|
73
|
+
testID,
|
|
74
|
+
selected = false,
|
|
75
|
+
children,
|
|
76
|
+
leadingStatus,
|
|
77
|
+
variant = 'full-width',
|
|
78
|
+
onPress,
|
|
79
|
+
disabled = false,
|
|
80
|
+
}: ListItemProps): JSX.Element => (
|
|
81
|
+
<StyledListItemContainer
|
|
82
|
+
style={style}
|
|
83
|
+
testID={testID}
|
|
84
|
+
themeSelected={selected}
|
|
85
|
+
themeVariant={variant}
|
|
86
|
+
onPress={onPress}
|
|
87
|
+
disabled={disabled}
|
|
88
|
+
>
|
|
89
|
+
{leadingStatus && (
|
|
90
|
+
<StyledLeadingStatus
|
|
91
|
+
themeLeadingStatusIntent={leadingStatus}
|
|
92
|
+
testID="leadingStatus"
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
<StyledContentContainer>
|
|
96
|
+
<View
|
|
97
|
+
style={{
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{prefix && (
|
|
103
|
+
<StyledPrefixContainer>
|
|
104
|
+
{typeof prefix === 'string' ? <Icon icon={prefix} /> : prefix}
|
|
105
|
+
</StyledPrefixContainer>
|
|
106
|
+
)}
|
|
107
|
+
<StyledTitleContainer>
|
|
108
|
+
<Typography.Text
|
|
109
|
+
intent="body"
|
|
110
|
+
fontSize="large"
|
|
111
|
+
fontWeight="semi-bold"
|
|
112
|
+
>
|
|
113
|
+
{title}
|
|
114
|
+
</Typography.Text>
|
|
115
|
+
{subtitle && (
|
|
116
|
+
<Typography.Text intent="subdued" fontSize="small">
|
|
117
|
+
{subtitle}
|
|
118
|
+
</Typography.Text>
|
|
119
|
+
)}
|
|
120
|
+
</StyledTitleContainer>
|
|
121
|
+
{suffix && (
|
|
122
|
+
<StyledSuffixContainer>
|
|
123
|
+
{typeof suffix === 'string' ? (
|
|
124
|
+
<Icon
|
|
125
|
+
icon={suffix}
|
|
126
|
+
intent={disabled ? 'disabled-text' : 'primary'}
|
|
127
|
+
size="small"
|
|
128
|
+
/>
|
|
129
|
+
) : (
|
|
130
|
+
suffix
|
|
131
|
+
)}
|
|
132
|
+
</StyledSuffixContainer>
|
|
133
|
+
)}
|
|
134
|
+
</View>
|
|
135
|
+
{children && (
|
|
136
|
+
<StyledChildrenContainer>{children}</StyledChildrenContainer>
|
|
137
|
+
)}
|
|
138
|
+
</StyledContentContainer>
|
|
139
|
+
</StyledListItemContainer>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
export default ListItem;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const StyledPrefixContainer = styled(View)(({ theme }) => ({
|
|
5
|
+
marginRight: theme.__hd__.list.space.prefixContainerMarginRight,
|
|
6
|
+
}));
|
|
7
|
+
const StyledSuffixContainer = styled(View)(({ theme }) => ({
|
|
8
|
+
marginLeft: theme.__hd__.list.space.suffixContainerMarginLeft,
|
|
9
|
+
}));
|
|
10
|
+
const StyledTitleContainer = styled(View)(() => ({
|
|
11
|
+
flex: 1,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const StyledListItemContainer = styled(TouchableOpacity)<{
|
|
15
|
+
themeSelected?: boolean;
|
|
16
|
+
themeDisabled?: boolean;
|
|
17
|
+
}>(({ theme, themeSelected, themeDisabled }) => ({
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
flex: 1,
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
backgroundColor: themeSelected
|
|
22
|
+
? theme.__hd__.select.colors.checkedOption
|
|
23
|
+
: theme.__hd__.select.colors.option,
|
|
24
|
+
padding: theme.__hd__.list.space.listItemContainerPadding,
|
|
25
|
+
opacity: themeDisabled
|
|
26
|
+
? theme.__hd__.list.opacity.disabled
|
|
27
|
+
: theme.__hd__.list.opacity.enabled,
|
|
28
|
+
}));
|
|
29
|
+
export {
|
|
30
|
+
StyledListItemContainer,
|
|
31
|
+
StyledPrefixContainer,
|
|
32
|
+
StyledTitleContainer,
|
|
33
|
+
StyledSuffixContainer,
|
|
34
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import styled from '@emotion/native';
|
|
3
|
+
|
|
4
|
+
export type Variant = 'full-width' | 'card';
|
|
5
|
+
export type LeadingStatusIntent =
|
|
6
|
+
| 'success'
|
|
7
|
+
| 'warning'
|
|
8
|
+
| 'danger'
|
|
9
|
+
| 'info'
|
|
10
|
+
| 'archived';
|
|
11
|
+
|
|
12
|
+
const StyledListItemContainer = styled(TouchableOpacity)<{
|
|
13
|
+
themeSelected?: boolean;
|
|
14
|
+
themeVariant?: Variant;
|
|
15
|
+
}>(({ theme, themeSelected = false, themeVariant = 'basic' }) => {
|
|
16
|
+
const sharedStyles = {
|
|
17
|
+
flexDirection: 'row' as const,
|
|
18
|
+
backgroundColor: themeSelected
|
|
19
|
+
? theme.__hd__.list.colors.checkedListItemContainerBackground
|
|
20
|
+
: theme.__hd__.list.colors.listItemContainerBackground,
|
|
21
|
+
padding: theme.__hd__.list.space.listItemContainerPadding,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
switch (themeVariant) {
|
|
25
|
+
case 'basic':
|
|
26
|
+
return sharedStyles;
|
|
27
|
+
case 'card':
|
|
28
|
+
return {
|
|
29
|
+
...sharedStyles,
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
borderRadius: theme.__hd__.list.radii.card,
|
|
32
|
+
shadowColor: theme.colors.shadow,
|
|
33
|
+
shadowRadius: theme.__hd__.list.radii.cardShadow,
|
|
34
|
+
shadowOffset: theme.__hd__.list.offsets.cardShadow,
|
|
35
|
+
shadowOpacity: theme.__hd__.list.opacity.cardShadow,
|
|
36
|
+
};
|
|
37
|
+
default:
|
|
38
|
+
return sharedStyles;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const StyledContentContainer = styled(View)(() => ({
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
flex: 1,
|
|
45
|
+
flexGrow: 2,
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const StyledChildrenContainer = styled(View)(() => ({
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
justifyContent: 'flex-start',
|
|
51
|
+
alignItems: 'flex-start',
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
const StyledLeadingStatus = styled(View)<{
|
|
55
|
+
themeLeadingStatusIntent: LeadingStatusIntent;
|
|
56
|
+
}>(({ theme, themeLeadingStatusIntent }) => ({
|
|
57
|
+
width: theme.__hd__.list.widths.leadingStatus,
|
|
58
|
+
marginRight: theme.__hd__.list.space.leadingStatusMarginRight,
|
|
59
|
+
borderRadius: theme.__hd__.list.radii.leadingStatus,
|
|
60
|
+
backgroundColor:
|
|
61
|
+
theme.__hd__.list.colors.leadingStatus[themeLeadingStatusIntent],
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
const StyledPrefixContainer = styled(View)(({ theme }) => ({
|
|
65
|
+
marginRight: theme.__hd__.list.space.prefixContainerMarginRight,
|
|
66
|
+
}));
|
|
67
|
+
const StyledSuffixContainer = styled(View)(({ theme }) => ({
|
|
68
|
+
marginLeft: theme.__hd__.list.space.suffixContainerMarginLeft,
|
|
69
|
+
}));
|
|
70
|
+
const StyledTitleContainer = styled(View)(() => ({
|
|
71
|
+
flex: 1,
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
StyledListItemContainer,
|
|
76
|
+
StyledContentContainer,
|
|
77
|
+
StyledChildrenContainer,
|
|
78
|
+
StyledLeadingStatus,
|
|
79
|
+
StyledPrefixContainer,
|
|
80
|
+
StyledTitleContainer,
|
|
81
|
+
StyledSuffixContainer,
|
|
82
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
import BasicListItem from '../BasicListItem';
|
|
5
|
+
|
|
6
|
+
describe('BasicListItem', () => {
|
|
7
|
+
it('renders correctly', () => {
|
|
8
|
+
const wrapper = renderWithTheme(
|
|
9
|
+
<BasicListItem
|
|
10
|
+
title="List item"
|
|
11
|
+
subtitle="subtitle"
|
|
12
|
+
suffix="checkmark"
|
|
13
|
+
testID="basic-list-item"
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
17
|
+
expect(wrapper.queryAllByTestId('basic-list-item')).toHaveLength(1);
|
|
18
|
+
expect(wrapper.queryAllByText('List item')).toHaveLength(1);
|
|
19
|
+
expect(wrapper.queryAllByText('subtitle')).toHaveLength(1);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('onPress', () => {
|
|
23
|
+
const onPress = jest.fn();
|
|
24
|
+
const { getByTestId } = renderWithTheme(
|
|
25
|
+
<BasicListItem
|
|
26
|
+
title="List item"
|
|
27
|
+
subtitle="subtitle"
|
|
28
|
+
suffix="checkmark"
|
|
29
|
+
testID="basic-list-item"
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
fireEvent.press(getByTestId('basic-list-item'));
|
|
35
|
+
expect(onPress).toHaveBeenCalledTimes(1);
|
|
36
|
+
});
|
|
37
|
+
});
|