@hero-design/rn 7.18.1 → 7.20.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/.eslintrc.json +6 -1
- package/.turbo/turbo-build.log +2 -2
- package/es/index.js +726 -336
- package/lib/index.js +727 -336
- package/package.json +4 -4
- package/src/components/Accordion/AccordionItem.tsx +5 -4
- package/src/components/Accordion/__tests__/index.spec.tsx +2 -1
- package/src/components/Accordion/index.tsx +3 -2
- package/src/components/Alert/StyledAlert.tsx +8 -7
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +140 -19
- package/src/components/Alert/__tests__/index.spec.tsx +21 -0
- package/src/components/Alert/index.tsx +18 -9
- package/src/components/Avatar/StyledAvatar.tsx +2 -1
- package/src/components/Avatar/index.tsx +4 -3
- package/src/components/Badge/Status.tsx +4 -2
- package/src/components/Badge/index.tsx +2 -1
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +4 -2
- package/src/components/BottomNavigation/index.tsx +6 -8
- package/src/components/BottomSheet/Footer.tsx +2 -1
- package/src/components/BottomSheet/Header.tsx +2 -1
- package/src/components/BottomSheet/StyledBottomSheet.tsx +2 -2
- package/src/components/BottomSheet/index.tsx +4 -8
- package/src/components/Box/StyledBox.tsx +54 -0
- package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +605 -0
- package/src/components/Box/__tests__/helpers.spec.ts +14 -0
- package/src/components/Box/__tests__/index.spec.tsx +155 -0
- package/src/components/Box/config.ts +201 -0
- package/src/components/Box/helpers.ts +10 -0
- package/src/components/Box/index.tsx +13 -0
- package/src/components/Box/types.ts +38 -0
- package/src/components/Button/Button.tsx +5 -6
- package/src/components/Button/IconButton.tsx +4 -7
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +5 -3
- package/src/components/Button/LoadingIndicator/index.tsx +2 -8
- package/src/components/Button/StyledButton.tsx +4 -5
- package/src/components/Button/UtilityButton/index.tsx +5 -4
- package/src/components/Button/index.tsx +3 -2
- package/src/components/Calendar/StyledCalendar.tsx +2 -1
- package/src/components/Calendar/__tests__/index.spec.tsx +13 -17
- package/src/components/Card/DataCard/StyledDataCard.tsx +8 -2
- package/src/components/Card/DataCard/__tests__/StyledDataCard.spec.tsx +1 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +16 -0
- package/src/components/Card/DataCard/index.tsx +4 -3
- package/src/components/Card/StyledCard.tsx +12 -19
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +147 -0
- package/src/components/Card/__tests__/index.spec.tsx +18 -0
- package/src/components/Card/index.tsx +9 -3
- package/src/components/Checkbox/StyledCheckbox.tsx +44 -14
- package/src/components/Checkbox/__tests__/StyledCheckbox.spec.tsx +28 -3
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +95 -9
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +337 -23
- package/src/components/Checkbox/__tests__/index.spec.tsx +38 -7
- package/src/components/Checkbox/index.tsx +35 -18
- package/src/components/Collapse/index.tsx +4 -8
- package/src/components/ContentNavigator/index.tsx +1 -1
- package/src/components/DatePicker/DatePickerAndroid.tsx +1 -1
- package/src/components/DatePicker/DatePickerIOS.tsx +1 -1
- package/src/components/DatePicker/StyledDatePicker.tsx +2 -1
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +1 -2
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/Divider/index.tsx +1 -1
- package/src/components/Drawer/DragableDrawer/helpers.ts +3 -4
- package/src/components/Drawer/DragableDrawer/index.tsx +3 -2
- package/src/components/Drawer/StyledDrawer.tsx +3 -2
- package/src/components/Drawer/index.tsx +2 -1
- package/src/components/Empty/index.tsx +1 -2
- package/src/components/FAB/ActionGroup/ActionItem.tsx +3 -2
- package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +4 -3
- package/src/components/FAB/ActionGroup/StyledActionItem.tsx +4 -2
- package/src/components/FAB/ActionGroup/index.tsx +11 -11
- package/src/components/FAB/AnimatedFABIcon.tsx +1 -1
- package/src/components/FAB/FAB.tsx +2 -2
- package/src/components/FAB/StyledFAB.tsx +4 -7
- package/src/components/Icon/AnimatedIcon.tsx +2 -1
- package/src/components/Icon/index.tsx +1 -1
- package/src/components/List/BasicListItem.tsx +3 -3
- package/src/components/List/ListItem.tsx +6 -3
- package/src/components/List/StyledListItem.tsx +2 -1
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +13 -27
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +2 -0
- package/src/components/PinInput/PinCell.tsx +1 -1
- package/src/components/PinInput/index.tsx +3 -7
- package/src/components/Progress/ProgressBar.tsx +2 -1
- package/src/components/Progress/ProgressCircle.tsx +3 -9
- package/src/components/Progress/StyledProgressBar.tsx +3 -3
- package/src/components/Progress/StyledProgressCircle.tsx +3 -3
- package/src/components/Radio/Radio.tsx +20 -14
- package/src/components/Radio/RadioGroup.tsx +5 -3
- package/src/components/Radio/StyledRadio.tsx +12 -29
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +84 -50
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +124 -73
- package/src/components/RichTextEditor/EditorToolbar.tsx +4 -8
- package/src/components/RichTextEditor/RichTextEditor.tsx +5 -14
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -6
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +2 -6
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +8 -15
- package/src/components/RichTextEditor/index.tsx +6 -6
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/SectionHeading/index.tsx +5 -4
- package/src/components/Select/MultiSelect/Option.tsx +2 -1
- package/src/components/Select/MultiSelect/OptionList.tsx +3 -3
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +22 -20
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +609 -589
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +1 -1
- package/src/components/Select/MultiSelect/index.tsx +20 -16
- package/src/components/Select/SingleSelect/Option.tsx +2 -1
- package/src/components/Select/SingleSelect/OptionList.tsx +3 -3
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +22 -20
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +606 -586
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +1 -1
- package/src/components/Select/SingleSelect/index.tsx +20 -16
- package/src/components/Select/StyledOptionList.tsx +11 -9
- package/src/components/Select/helpers.tsx +1 -1
- package/src/components/Select/index.tsx +6 -4
- package/src/components/Select/types.ts +3 -3
- package/src/components/Spinner/AnimatedSpinner.tsx +7 -7
- package/src/components/Spinner/StyledSpinner.tsx +26 -20
- package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +1 -1
- package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +32 -16
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +14 -12
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +273 -31
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +14 -12
- package/src/components/Spinner/index.tsx +13 -5
- package/src/components/Switch/StyledSwitch.tsx +10 -26
- package/src/components/Switch/__tests__/StyledSwitch.spec.tsx +25 -0
- package/src/components/Switch/__tests__/__snapshots__/{StyledHeading.spec.tsx.snap → StyledSwitch.spec.tsx.snap} +45 -18
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +26 -52
- package/src/components/Switch/index.tsx +23 -20
- package/src/components/Tabs/ScrollableTabs.tsx +10 -5
- package/src/components/Tabs/StyledScrollableTabs.tsx +6 -5
- package/src/components/Tabs/StyledTabs.tsx +6 -0
- package/src/components/Tabs/TabWithBadge.tsx +68 -0
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +17 -2
- package/src/components/Tabs/__tests__/TabWithBadge.spec.tsx +48 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +205 -43
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +165 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +135 -34
- package/src/components/Tabs/__tests__/index.spec.tsx +16 -2
- package/src/components/Tabs/index.tsx +17 -16
- package/src/components/Tag/StyledTag.tsx +1 -11
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +4 -4
- package/src/components/Tag/index.tsx +3 -3
- package/src/components/TextInput/__tests__/index.spec.tsx +10 -14
- package/src/components/TextInput/index.tsx +5 -5
- package/src/components/TimePicker/StyledTimePicker.tsx +2 -1
- package/src/components/TimePicker/TimePickerAndroid.tsx +1 -1
- package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
- package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +1 -2
- package/src/components/TimePicker/index.tsx +1 -1
- package/src/components/TimePicker/types.ts +1 -1
- package/src/components/Toast/StyledToast.tsx +16 -15
- package/src/components/Toast/Toast.tsx +36 -10
- package/src/components/Toast/ToastContainer.tsx +2 -2
- package/src/components/Toast/ToastContext.ts +1 -1
- package/src/components/Toast/ToastProvider.tsx +20 -19
- package/src/components/Toast/__tests__/Toast.spec.tsx +17 -0
- package/src/components/Toast/__tests__/ToastContainer.spec.tsx +1 -1
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +299 -19
- package/src/components/Toast/types.ts +18 -4
- package/src/components/Toolbar/StyledToolbar.tsx +2 -1
- package/src/components/Toolbar/ToolbarGroup.tsx +2 -1
- package/src/components/Toolbar/ToolbarItem.tsx +2 -1
- package/src/components/Toolbar/index.tsx +2 -1
- package/src/components/Typography/Text/StyledText.tsx +7 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
- package/src/components/Typography/Text/index.tsx +10 -3
- package/src/index.ts +2 -0
- package/src/testHelpers/renderWithTheme.tsx +2 -1
- package/src/theme/ThemeProvider.ts +1 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +100 -49
- package/src/theme/components/.eslintrc.json +10 -0
- package/src/theme/components/accordion.ts +1 -1
- package/src/theme/components/alert.ts +6 -2
- package/src/theme/components/avatar.ts +3 -1
- package/src/theme/components/badge.ts +1 -1
- package/src/theme/components/bottomNavigation.ts +1 -1
- package/src/theme/components/bottomSheet.ts +1 -1
- package/src/theme/components/button.ts +1 -1
- package/src/theme/components/calendar.ts +1 -1
- package/src/theme/components/card.ts +7 -8
- package/src/theme/components/checkbox.ts +12 -8
- package/src/theme/components/contentNavigator.ts +1 -1
- package/src/theme/components/divider.ts +1 -1
- package/src/theme/components/drawer.ts +1 -1
- package/src/theme/components/empty.ts +1 -1
- package/src/theme/components/fab.ts +1 -1
- package/src/theme/components/icon.ts +1 -1
- package/src/theme/components/list.ts +5 -4
- package/src/theme/components/pinInput.ts +1 -1
- package/src/theme/components/progress.ts +1 -1
- package/src/theme/components/radio.ts +3 -11
- package/src/theme/components/richTextEditor.ts +1 -1
- package/src/theme/components/sectionHeading.ts +2 -2
- package/src/theme/components/select.ts +1 -1
- package/src/theme/components/spinner.ts +20 -8
- package/src/theme/components/switch.ts +7 -8
- package/src/theme/components/tabs.ts +4 -3
- package/src/theme/components/tag.ts +14 -14
- package/src/theme/components/textInput.ts +1 -1
- package/src/theme/components/toast.ts +18 -4
- package/src/theme/components/toolbar.ts +1 -1
- package/src/theme/components/typography.ts +3 -1
- package/src/theme/getTheme.ts +4 -11
- package/src/theme/global/borders.ts +2 -1
- package/src/theme/global/colors/swag.ts +25 -3
- package/src/theme/global/colors/types.ts +23 -0
- package/src/theme/global/colors/work.ts +6 -2
- package/src/theme/global/index.ts +6 -11
- package/src/theme/global/scale.ts +2 -1
- package/src/theme/global/space.ts +2 -1
- package/src/theme/global/typography.ts +2 -8
- package/src/theme/index.ts +5 -2
- package/src/types.ts +9 -10
- package/testUtils/setup.tsx +2 -0
- package/tsconfig.json +5 -21
- package/types/components/Accordion/AccordionItem.d.ts +3 -3
- package/types/components/Accordion/StyledAccordion.d.ts +14 -14
- package/types/components/Accordion/index.d.ts +3 -2
- package/types/components/Alert/StyledAlert.d.ts +18 -17
- package/types/components/Alert/index.d.ts +4 -4
- package/types/components/Avatar/StyledAvatar.d.ts +16 -16
- package/types/components/Avatar/index.d.ts +3 -3
- package/types/components/Badge/Status.d.ts +2 -2
- package/types/components/Badge/StyledBadge.d.ts +7 -7
- package/types/components/Badge/index.d.ts +2 -1
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +21 -21
- package/types/components/BottomNavigation/index.d.ts +3 -3
- package/types/components/BottomSheet/Footer.d.ts +1 -1
- package/types/components/BottomSheet/Header.d.ts +2 -2
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +21 -20
- package/types/components/BottomSheet/index.d.ts +2 -2
- package/types/components/Box/StyledBox.d.ts +15 -0
- package/types/components/{Radio/__tests__/StyledRadio.spec.d.ts → Box/__tests__/helpers.spec.d.ts} +0 -0
- package/types/components/{Switch/__tests__/StyledHeading.spec.d.ts → Box/__tests__/index.spec.d.ts} +0 -0
- package/types/components/Box/config.d.ts +170 -0
- package/types/components/Box/helpers.d.ts +1 -0
- package/types/components/Box/index.d.ts +5 -0
- package/types/components/Box/types.d.ts +31 -0
- package/types/components/Button/Button.d.ts +4 -4
- package/types/components/Button/IconButton.d.ts +2 -2
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +10 -9
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +19 -18
- package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +8 -8
- package/types/components/Button/UtilityButton/index.d.ts +3 -3
- package/types/components/Button/index.d.ts +2 -2
- package/types/components/Calendar/StyledCalendar.d.ts +27 -26
- package/types/components/Calendar/helpers.d.ts +2 -2
- package/types/components/Card/DataCard/StyledDataCard.d.ts +7 -7
- package/types/components/Card/DataCard/index.d.ts +3 -3
- package/types/components/Card/StyledCard.d.ts +7 -6
- package/types/components/Card/index.d.ts +7 -3
- package/types/components/Checkbox/StyledCheckbox.d.ts +24 -6
- package/types/components/Checkbox/index.d.ts +11 -3
- package/types/components/Collapse/StyledCollapse.d.ts +8 -8
- package/types/components/Collapse/index.d.ts +2 -2
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +5 -5
- package/types/components/ContentNavigator/index.d.ts +1 -1
- package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
- package/types/components/DatePicker/StyledDatePicker.d.ts +5 -4
- package/types/components/DatePicker/index.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +1 -1
- package/types/components/Divider/StyledDivider.d.ts +5 -5
- package/types/components/Divider/index.d.ts +1 -1
- package/types/components/Drawer/DragableDrawer/index.d.ts +1 -1
- package/types/components/Drawer/StyledDrawer.d.ts +21 -20
- package/types/components/Drawer/index.d.ts +1 -1
- package/types/components/Empty/StyledEmpty.d.ts +12 -12
- package/types/components/Empty/index.d.ts +1 -1
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +2 -2
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +14 -13
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +10 -9
- package/types/components/FAB/ActionGroup/index.d.ts +3 -3
- package/types/components/FAB/AnimatedFABIcon.d.ts +1 -1
- package/types/components/FAB/FAB.d.ts +2 -2
- package/types/components/FAB/StyledFAB.d.ts +11 -10
- package/types/components/Icon/AnimatedIcon.d.ts +1 -1
- package/types/components/Icon/HeroIcon/index.d.ts +3 -3
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/List/BasicListItem.d.ts +2 -2
- package/types/components/List/ListItem.d.ts +4 -3
- package/types/components/List/StyledBasicListItem.d.ts +14 -14
- package/types/components/List/StyledListItem.d.ts +23 -23
- package/types/components/PinInput/PinCell.d.ts +1 -1
- package/types/components/PinInput/StyledPinInput.d.ts +30 -30
- package/types/components/PinInput/index.d.ts +2 -2
- package/types/components/Progress/ProgressBar.d.ts +1 -1
- package/types/components/Progress/ProgressCircle.d.ts +1 -1
- package/types/components/Progress/StyledProgressBar.d.ts +8 -7
- package/types/components/Progress/StyledProgressCircle.d.ts +21 -20
- package/types/components/Radio/Radio.d.ts +2 -2
- package/types/components/Radio/RadioGroup.d.ts +3 -3
- package/types/components/Radio/StyledRadio.d.ts +11 -21
- package/types/components/RichTextEditor/EditorToolbar.d.ts +1 -1
- package/types/components/RichTextEditor/MentionList.d.ts +1 -1
- package/types/components/RichTextEditor/RichTextEditor.d.ts +3 -2
- package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +6 -6
- package/types/components/RichTextEditor/StyledToolbar.d.ts +9 -9
- package/types/components/RichTextEditor/index.d.ts +5 -4
- package/types/components/SectionHeading/StyledHeading.d.ts +9 -9
- package/types/components/SectionHeading/index.d.ts +3 -3
- package/types/components/Select/MultiSelect/Option.d.ts +2 -2
- package/types/components/Select/MultiSelect/OptionList.d.ts +2 -2
- package/types/components/Select/MultiSelect/index.d.ts +1 -1
- package/types/components/Select/SingleSelect/Option.d.ts +2 -2
- package/types/components/Select/SingleSelect/OptionList.d.ts +2 -2
- package/types/components/Select/SingleSelect/index.d.ts +1 -1
- package/types/components/Select/StyledOptionList.d.ts +4 -4
- package/types/components/Select/StyledSelect.d.ts +11 -11
- package/types/components/Select/helpers.d.ts +2 -2
- package/types/components/Select/index.d.ts +4 -3
- package/types/components/Select/types.d.ts +3 -3
- package/types/components/Spinner/AnimatedSpinner.d.ts +3 -1
- package/types/components/Spinner/StyledSpinner.d.ts +16 -13
- package/types/components/Spinner/index.d.ts +7 -3
- package/types/components/Switch/StyledSwitch.d.ts +8 -23
- package/types/components/Switch/__tests__/StyledSwitch.spec.d.ts +1 -0
- package/types/components/Switch/index.d.ts +3 -2
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/StyledScrollableTabs.d.ts +24 -22
- package/types/components/Tabs/StyledTabs.d.ts +26 -20
- package/types/components/Tabs/TabWithBadge.d.ts +17 -0
- package/types/components/Tabs/__tests__/TabWithBadge.spec.d.ts +1 -0
- package/types/components/Tabs/index.d.ts +4 -2
- package/types/components/Tag/StyledTag.d.ts +6 -6
- package/types/components/Tag/index.d.ts +2 -2
- package/types/components/TextInput/StyledTextInput.d.ts +44 -44
- package/types/components/TextInput/index.d.ts +8 -8
- package/types/components/TimePicker/StyledTimePicker.d.ts +5 -4
- package/types/components/TimePicker/TimePickerAndroid.d.ts +1 -1
- package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
- package/types/components/TimePicker/index.d.ts +1 -1
- package/types/components/TimePicker/types.d.ts +1 -1
- package/types/components/Toast/StyledToast.d.ts +21 -19
- package/types/components/Toast/Toast.d.ts +1 -1
- package/types/components/Toast/ToastContainer.d.ts +2 -2
- package/types/components/Toast/ToastContext.d.ts +1 -1
- package/types/components/Toast/ToastProvider.d.ts +2 -2
- package/types/components/Toast/types.d.ts +5 -4
- package/types/components/Toolbar/StyledToolbar.d.ts +11 -10
- package/types/components/Toolbar/ToolbarGroup.d.ts +1 -1
- package/types/components/Toolbar/ToolbarItem.d.ts +1 -1
- package/types/components/Toolbar/index.d.ts +1 -1
- package/types/components/Typography/Text/StyledText.d.ts +4 -4
- package/types/components/Typography/Text/index.d.ts +3 -3
- package/types/index.d.ts +2 -1
- package/types/testHelpers/renderWithTheme.d.ts +2 -2
- package/types/theme/ThemeProvider.d.ts +1 -1
- package/types/theme/ThemeSwitcher.d.ts +1 -1
- package/types/theme/components/accordion.d.ts +1 -1
- package/types/theme/components/alert.d.ts +6 -2
- package/types/theme/components/avatar.d.ts +3 -1
- package/types/theme/components/badge.d.ts +1 -1
- package/types/theme/components/bottomNavigation.d.ts +1 -1
- package/types/theme/components/bottomSheet.d.ts +1 -1
- package/types/theme/components/button.d.ts +1 -1
- package/types/theme/components/calendar.d.ts +1 -1
- package/types/theme/components/card.d.ts +7 -8
- package/types/theme/components/checkbox.d.ts +10 -7
- package/types/theme/components/contentNavigator.d.ts +1 -1
- package/types/theme/components/divider.d.ts +1 -1
- package/types/theme/components/drawer.d.ts +1 -1
- package/types/theme/components/empty.d.ts +1 -1
- package/types/theme/components/fab.d.ts +1 -1
- package/types/theme/components/icon.d.ts +1 -1
- package/types/theme/components/list.d.ts +8 -7
- package/types/theme/components/pinInput.d.ts +1 -1
- package/types/theme/components/progress.d.ts +1 -1
- package/types/theme/components/radio.d.ts +1 -8
- package/types/theme/components/richTextEditor.d.ts +1 -1
- package/types/theme/components/sectionHeading.d.ts +1 -1
- package/types/theme/components/select.d.ts +1 -1
- package/types/theme/components/spinner.d.ts +18 -6
- package/types/theme/components/switch.d.ts +7 -6
- package/types/theme/components/tabs.d.ts +2 -1
- package/types/theme/components/tag.d.ts +3 -3
- package/types/theme/components/textInput.d.ts +1 -1
- package/types/theme/components/toast.d.ts +19 -3
- package/types/theme/components/toolbar.d.ts +1 -1
- package/types/theme/components/typography.d.ts +3 -1
- package/types/theme/getTheme.d.ts +2 -2
- package/types/theme/global/borders.d.ts +2 -1
- package/types/theme/global/colors/swag.d.ts +1 -1
- package/types/theme/global/colors/types.d.ts +17 -0
- package/types/theme/global/colors/work.d.ts +1 -1
- package/types/theme/global/index.d.ts +22 -3
- package/types/theme/global/scale.d.ts +2 -1
- package/types/theme/global/space.d.ts +2 -1
- package/types/theme/global/typography.d.ts +2 -1
- package/types/theme/index.d.ts +4 -2
- package/types/types.d.ts +9 -8
- package/types/utils/hooks.d.ts +1 -1
- package/src/components/Radio/__tests__/StyledRadio.spec.tsx +0 -43
- package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +0 -124
- package/src/components/Switch/__tests__/StyledHeading.spec.tsx +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.20.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/native": "^11.9.3",
|
|
22
22
|
"@emotion/react": "^11.9.3",
|
|
23
|
-
"@hero-design/colors": "7.
|
|
23
|
+
"@hero-design/colors": "7.20.0",
|
|
24
24
|
"date-fns": "^2.16.1",
|
|
25
25
|
"events": "^3.2.0",
|
|
26
26
|
"hero-editor": "^1.9.9"
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"eslint-config-prettier": "^8.5.0",
|
|
63
63
|
"eslint-plugin-import": "^2.25.4",
|
|
64
64
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
65
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
65
66
|
"eslint-plugin-react": "^7.28.0",
|
|
66
67
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
67
68
|
"jest": "^27.3.1",
|
|
@@ -76,7 +77,6 @@
|
|
|
76
77
|
"rollup": "^2.68.0",
|
|
77
78
|
"rollup-plugin-copy": "^3.4.0",
|
|
78
79
|
"rollup-plugin-flow": "^1.1.1",
|
|
79
|
-
"ts-jest": "^27.0.7"
|
|
80
|
-
"typescript": "^4.5.5"
|
|
80
|
+
"ts-jest": "^27.0.7"
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import {
|
|
4
5
|
StyledCollapse,
|
|
5
6
|
StyledHeaderWrapper,
|
|
6
7
|
StyledItemWrapper,
|
|
7
|
-
Variant,
|
|
8
8
|
} from './StyledAccordion';
|
|
9
9
|
import Typography from '../Typography';
|
|
10
10
|
import Icon from '../Icon';
|
|
11
|
+
import type { Variant } from './StyledAccordion';
|
|
11
12
|
|
|
12
13
|
export type AccordionItemProps = {
|
|
13
14
|
header: string | ReactElement;
|
|
@@ -38,7 +39,7 @@ const AccordionItem = ({
|
|
|
38
39
|
header
|
|
39
40
|
)}
|
|
40
41
|
<Icon
|
|
41
|
-
icon={
|
|
42
|
+
icon={open ? 'arrow-up' : 'arrow-down'}
|
|
42
43
|
intent="primary"
|
|
43
44
|
size="small"
|
|
44
45
|
/>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
3
|
import Typography from '../../Typography';
|
|
4
|
-
import Accordion
|
|
4
|
+
import Accordion from '..';
|
|
5
|
+
import type { AccordionProps } from '..';
|
|
5
6
|
|
|
6
7
|
const AccordionExample = (props: Omit<AccordionProps<string>, 'items'>) => (
|
|
7
8
|
<Accordion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import type { Key, ReactElement } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import AccordionItem from './AccordionItem';
|
|
4
5
|
import { Spacer, StyledWrapper } from './StyledAccordion';
|
|
5
6
|
import { usePropsOrInternalState } from './utils';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
import type { ViewProps } from 'react-native';
|
|
4
5
|
|
|
5
6
|
const Container = styled(View)<{
|
|
6
7
|
themeVariant: 'default' | 'round';
|
|
7
|
-
themeIntent: 'success' | 'info' | 'warning' | 'error';
|
|
8
|
+
themeIntent: 'success' | 'info' | 'warning' | 'error' | 'notification';
|
|
8
9
|
}>(({ theme, themeVariant = 'default', themeIntent }) => ({
|
|
9
10
|
borderRadius: themeVariant === 'round' ? theme.__hd__.alert.radii.default : 0,
|
|
10
11
|
backgroundColor: theme.__hd__.alert.colors[themeIntent],
|
|
@@ -14,17 +15,17 @@ const Container = styled(View)<{
|
|
|
14
15
|
|
|
15
16
|
const IconContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
16
17
|
alignItems: 'center',
|
|
17
|
-
paddingLeft: theme.__hd__.alert.space.
|
|
18
|
+
paddingLeft: theme.__hd__.alert.space.iconLeftPadding,
|
|
18
19
|
}));
|
|
19
20
|
|
|
20
21
|
const TextContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
21
|
-
paddingHorizontal: theme.__hd__.alert.space.
|
|
22
|
+
paddingHorizontal: theme.__hd__.alert.space.textPaddingHorizontal,
|
|
22
23
|
flex: 1,
|
|
23
24
|
}));
|
|
24
25
|
|
|
25
26
|
const ContentContainer = styled(View)<{ showDivider: boolean }>(
|
|
26
27
|
({ theme, showDivider }) => ({
|
|
27
|
-
paddingVertical: theme.__hd__.alert.space.
|
|
28
|
+
paddingVertical: theme.__hd__.alert.space.contentPaddingHorizontal,
|
|
28
29
|
flex: 1,
|
|
29
30
|
borderRightWidth: showDivider ? theme.__hd__.alert.borderWidths.base : 0,
|
|
30
31
|
borderColor: theme.__hd__.alert.colors.divider,
|
|
@@ -35,7 +36,7 @@ const ContentContainer = styled(View)<{ showDivider: boolean }>(
|
|
|
35
36
|
const CTAWrapper = styled(TouchableOpacity)<
|
|
36
37
|
ComponentProps<typeof TouchableOpacity>
|
|
37
38
|
>(({ theme }) => ({
|
|
38
|
-
paddingHorizontal: theme.__hd__.alert.space.
|
|
39
|
+
paddingHorizontal: theme.__hd__.alert.space.ctaPadding,
|
|
39
40
|
justifyContent: 'center',
|
|
40
41
|
}));
|
|
41
42
|
|
|
@@ -25,7 +25,7 @@ exports[`Alert Icon render custom icon correctly 1`] = `
|
|
|
25
25
|
"borderRightWidth": 0,
|
|
26
26
|
"flex": 1,
|
|
27
27
|
"flexDirection": "row",
|
|
28
|
-
"paddingVertical":
|
|
28
|
+
"paddingVertical": 12,
|
|
29
29
|
},
|
|
30
30
|
undefined,
|
|
31
31
|
]
|
|
@@ -36,7 +36,7 @@ exports[`Alert Icon render custom icon correctly 1`] = `
|
|
|
36
36
|
Array [
|
|
37
37
|
Object {
|
|
38
38
|
"alignItems": "center",
|
|
39
|
-
"paddingLeft":
|
|
39
|
+
"paddingLeft": 12,
|
|
40
40
|
},
|
|
41
41
|
undefined,
|
|
42
42
|
]
|
|
@@ -63,7 +63,7 @@ exports[`Alert Icon render custom icon correctly 1`] = `
|
|
|
63
63
|
Array [
|
|
64
64
|
Object {
|
|
65
65
|
"flex": 1,
|
|
66
|
-
"paddingHorizontal":
|
|
66
|
+
"paddingHorizontal": 12,
|
|
67
67
|
},
|
|
68
68
|
undefined,
|
|
69
69
|
]
|
|
@@ -118,7 +118,7 @@ exports[`Alert renders correctly when intent is error 1`] = `
|
|
|
118
118
|
"borderRightWidth": 1,
|
|
119
119
|
"flex": 1,
|
|
120
120
|
"flexDirection": "row",
|
|
121
|
-
"paddingVertical":
|
|
121
|
+
"paddingVertical": 12,
|
|
122
122
|
},
|
|
123
123
|
undefined,
|
|
124
124
|
]
|
|
@@ -129,7 +129,7 @@ exports[`Alert renders correctly when intent is error 1`] = `
|
|
|
129
129
|
Array [
|
|
130
130
|
Object {
|
|
131
131
|
"alignItems": "center",
|
|
132
|
-
"paddingLeft":
|
|
132
|
+
"paddingLeft": 12,
|
|
133
133
|
},
|
|
134
134
|
undefined,
|
|
135
135
|
]
|
|
@@ -156,7 +156,7 @@ exports[`Alert renders correctly when intent is error 1`] = `
|
|
|
156
156
|
Array [
|
|
157
157
|
Object {
|
|
158
158
|
"flex": 1,
|
|
159
|
-
"paddingHorizontal":
|
|
159
|
+
"paddingHorizontal": 12,
|
|
160
160
|
},
|
|
161
161
|
undefined,
|
|
162
162
|
]
|
|
@@ -218,7 +218,7 @@ exports[`Alert renders correctly when intent is error 1`] = `
|
|
|
218
218
|
Object {
|
|
219
219
|
"justifyContent": "center",
|
|
220
220
|
"opacity": 1,
|
|
221
|
-
"paddingHorizontal":
|
|
221
|
+
"paddingHorizontal": 12,
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
testID="alert-close-icon"
|
|
@@ -266,7 +266,7 @@ exports[`Alert renders correctly when intent is info 1`] = `
|
|
|
266
266
|
"borderRightWidth": 1,
|
|
267
267
|
"flex": 1,
|
|
268
268
|
"flexDirection": "row",
|
|
269
|
-
"paddingVertical":
|
|
269
|
+
"paddingVertical": 12,
|
|
270
270
|
},
|
|
271
271
|
undefined,
|
|
272
272
|
]
|
|
@@ -277,7 +277,7 @@ exports[`Alert renders correctly when intent is info 1`] = `
|
|
|
277
277
|
Array [
|
|
278
278
|
Object {
|
|
279
279
|
"alignItems": "center",
|
|
280
|
-
"paddingLeft":
|
|
280
|
+
"paddingLeft": 12,
|
|
281
281
|
},
|
|
282
282
|
undefined,
|
|
283
283
|
]
|
|
@@ -304,7 +304,7 @@ exports[`Alert renders correctly when intent is info 1`] = `
|
|
|
304
304
|
Array [
|
|
305
305
|
Object {
|
|
306
306
|
"flex": 1,
|
|
307
|
-
"paddingHorizontal":
|
|
307
|
+
"paddingHorizontal": 12,
|
|
308
308
|
},
|
|
309
309
|
undefined,
|
|
310
310
|
]
|
|
@@ -366,7 +366,128 @@ exports[`Alert renders correctly when intent is info 1`] = `
|
|
|
366
366
|
Object {
|
|
367
367
|
"justifyContent": "center",
|
|
368
368
|
"opacity": 1,
|
|
369
|
-
"paddingHorizontal":
|
|
369
|
+
"paddingHorizontal": 12,
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
testID="alert-close-icon"
|
|
373
|
+
>
|
|
374
|
+
<HeroIcon
|
|
375
|
+
name="cancel"
|
|
376
|
+
style={
|
|
377
|
+
Array [
|
|
378
|
+
Object {
|
|
379
|
+
"color": "#001f23",
|
|
380
|
+
"fontSize": 20,
|
|
381
|
+
},
|
|
382
|
+
undefined,
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
themeIntent="text"
|
|
386
|
+
themeSize="small"
|
|
387
|
+
/>
|
|
388
|
+
</View>
|
|
389
|
+
</View>
|
|
390
|
+
`;
|
|
391
|
+
|
|
392
|
+
exports[`Alert renders correctly when intent is notification 1`] = `
|
|
393
|
+
<View
|
|
394
|
+
style={
|
|
395
|
+
Array [
|
|
396
|
+
Object {
|
|
397
|
+
"backgroundColor": "#ffffff",
|
|
398
|
+
"borderRadius": 0,
|
|
399
|
+
"flexDirection": "row",
|
|
400
|
+
"minHeight": 48,
|
|
401
|
+
},
|
|
402
|
+
undefined,
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
themeIntent="notification"
|
|
406
|
+
themeVariant="default"
|
|
407
|
+
>
|
|
408
|
+
<View
|
|
409
|
+
showDivider={true}
|
|
410
|
+
style={
|
|
411
|
+
Array [
|
|
412
|
+
Object {
|
|
413
|
+
"borderColor": "#e8e9ea",
|
|
414
|
+
"borderRightWidth": 1,
|
|
415
|
+
"flex": 1,
|
|
416
|
+
"flexDirection": "row",
|
|
417
|
+
"paddingVertical": 12,
|
|
418
|
+
},
|
|
419
|
+
undefined,
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
>
|
|
423
|
+
<View
|
|
424
|
+
style={
|
|
425
|
+
Array [
|
|
426
|
+
Object {
|
|
427
|
+
"flex": 1,
|
|
428
|
+
"paddingHorizontal": 12,
|
|
429
|
+
},
|
|
430
|
+
undefined,
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
>
|
|
434
|
+
<Text
|
|
435
|
+
style={
|
|
436
|
+
Array [
|
|
437
|
+
Object {
|
|
438
|
+
"color": "#001f23",
|
|
439
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
440
|
+
"fontSize": 14,
|
|
441
|
+
"letterSpacing": 0.42,
|
|
442
|
+
"lineHeight": 22,
|
|
443
|
+
},
|
|
444
|
+
undefined,
|
|
445
|
+
]
|
|
446
|
+
}
|
|
447
|
+
themeFontSize="medium"
|
|
448
|
+
themeFontWeight="semi-bold"
|
|
449
|
+
themeIntent="body"
|
|
450
|
+
>
|
|
451
|
+
Title
|
|
452
|
+
</Text>
|
|
453
|
+
<Text
|
|
454
|
+
style={
|
|
455
|
+
Array [
|
|
456
|
+
Object {
|
|
457
|
+
"color": "#001f23",
|
|
458
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
459
|
+
"fontSize": 14,
|
|
460
|
+
"letterSpacing": 0.42,
|
|
461
|
+
"lineHeight": 22,
|
|
462
|
+
},
|
|
463
|
+
undefined,
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
themeFontSize="medium"
|
|
467
|
+
themeFontWeight="regular"
|
|
468
|
+
themeIntent="body"
|
|
469
|
+
>
|
|
470
|
+
Content
|
|
471
|
+
</Text>
|
|
472
|
+
</View>
|
|
473
|
+
</View>
|
|
474
|
+
<View
|
|
475
|
+
accessible={true}
|
|
476
|
+
collapsable={false}
|
|
477
|
+
focusable={true}
|
|
478
|
+
nativeID="animatedComponent"
|
|
479
|
+
onClick={[Function]}
|
|
480
|
+
onResponderGrant={[Function]}
|
|
481
|
+
onResponderMove={[Function]}
|
|
482
|
+
onResponderRelease={[Function]}
|
|
483
|
+
onResponderTerminate={[Function]}
|
|
484
|
+
onResponderTerminationRequest={[Function]}
|
|
485
|
+
onStartShouldSetResponder={[Function]}
|
|
486
|
+
style={
|
|
487
|
+
Object {
|
|
488
|
+
"justifyContent": "center",
|
|
489
|
+
"opacity": 1,
|
|
490
|
+
"paddingHorizontal": 12,
|
|
370
491
|
}
|
|
371
492
|
}
|
|
372
493
|
testID="alert-close-icon"
|
|
@@ -414,7 +535,7 @@ exports[`Alert renders correctly when intent is success 1`] = `
|
|
|
414
535
|
"borderRightWidth": 1,
|
|
415
536
|
"flex": 1,
|
|
416
537
|
"flexDirection": "row",
|
|
417
|
-
"paddingVertical":
|
|
538
|
+
"paddingVertical": 12,
|
|
418
539
|
},
|
|
419
540
|
undefined,
|
|
420
541
|
]
|
|
@@ -425,7 +546,7 @@ exports[`Alert renders correctly when intent is success 1`] = `
|
|
|
425
546
|
Array [
|
|
426
547
|
Object {
|
|
427
548
|
"alignItems": "center",
|
|
428
|
-
"paddingLeft":
|
|
549
|
+
"paddingLeft": 12,
|
|
429
550
|
},
|
|
430
551
|
undefined,
|
|
431
552
|
]
|
|
@@ -452,7 +573,7 @@ exports[`Alert renders correctly when intent is success 1`] = `
|
|
|
452
573
|
Array [
|
|
453
574
|
Object {
|
|
454
575
|
"flex": 1,
|
|
455
|
-
"paddingHorizontal":
|
|
576
|
+
"paddingHorizontal": 12,
|
|
456
577
|
},
|
|
457
578
|
undefined,
|
|
458
579
|
]
|
|
@@ -514,7 +635,7 @@ exports[`Alert renders correctly when intent is success 1`] = `
|
|
|
514
635
|
Object {
|
|
515
636
|
"justifyContent": "center",
|
|
516
637
|
"opacity": 1,
|
|
517
|
-
"paddingHorizontal":
|
|
638
|
+
"paddingHorizontal": 12,
|
|
518
639
|
}
|
|
519
640
|
}
|
|
520
641
|
testID="alert-close-icon"
|
|
@@ -562,7 +683,7 @@ exports[`Alert renders correctly when intent is warning 1`] = `
|
|
|
562
683
|
"borderRightWidth": 1,
|
|
563
684
|
"flex": 1,
|
|
564
685
|
"flexDirection": "row",
|
|
565
|
-
"paddingVertical":
|
|
686
|
+
"paddingVertical": 12,
|
|
566
687
|
},
|
|
567
688
|
undefined,
|
|
568
689
|
]
|
|
@@ -573,7 +694,7 @@ exports[`Alert renders correctly when intent is warning 1`] = `
|
|
|
573
694
|
Array [
|
|
574
695
|
Object {
|
|
575
696
|
"alignItems": "center",
|
|
576
|
-
"paddingLeft":
|
|
697
|
+
"paddingLeft": 12,
|
|
577
698
|
},
|
|
578
699
|
undefined,
|
|
579
700
|
]
|
|
@@ -600,7 +721,7 @@ exports[`Alert renders correctly when intent is warning 1`] = `
|
|
|
600
721
|
Array [
|
|
601
722
|
Object {
|
|
602
723
|
"flex": 1,
|
|
603
|
-
"paddingHorizontal":
|
|
724
|
+
"paddingHorizontal": 12,
|
|
604
725
|
},
|
|
605
726
|
undefined,
|
|
606
727
|
]
|
|
@@ -662,7 +783,7 @@ exports[`Alert renders correctly when intent is warning 1`] = `
|
|
|
662
783
|
Object {
|
|
663
784
|
"justifyContent": "center",
|
|
664
785
|
"opacity": 1,
|
|
665
|
-
"paddingHorizontal":
|
|
786
|
+
"paddingHorizontal": 12,
|
|
666
787
|
}
|
|
667
788
|
}
|
|
668
789
|
testID="alert-close-icon"
|
|
@@ -21,12 +21,33 @@ describe('Alert', () => {
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
expect(toJSON()).toMatchSnapshot();
|
|
24
|
+
// Has default icon
|
|
24
25
|
expect(getByTestId('alert-left-icon')).toBeDefined();
|
|
26
|
+
|
|
25
27
|
expect(getByText('Title')).toBeDefined();
|
|
26
28
|
expect(getByText('Content')).toBeDefined();
|
|
27
29
|
expect(getByTestId('alert-close-icon')).toBeDefined();
|
|
28
30
|
});
|
|
29
31
|
|
|
32
|
+
it('renders correctly when intent is notification', () => {
|
|
33
|
+
const { toJSON, getByText, queryByTestId } = renderWithTheme(
|
|
34
|
+
<Alert
|
|
35
|
+
title="Title"
|
|
36
|
+
content="Content"
|
|
37
|
+
intent="notification"
|
|
38
|
+
onClose={jest.fn()}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
expect(toJSON()).toMatchSnapshot();
|
|
43
|
+
// Has no default icon
|
|
44
|
+
expect(queryByTestId('alert-left-icon')).toBeNull();
|
|
45
|
+
|
|
46
|
+
expect(getByText('Title')).toBeDefined();
|
|
47
|
+
expect(getByText('Content')).toBeDefined();
|
|
48
|
+
expect(queryByTestId('alert-close-icon')).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
|
|
30
51
|
describe('Icon', () => {
|
|
31
52
|
it('not render icon when icon prop is null', () => {
|
|
32
53
|
const { queryByTestId } = renderWithTheme(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import Icon from '../Icon';
|
|
4
5
|
import Typography from '../Typography';
|
|
5
6
|
import {
|
|
6
7
|
Container,
|
|
@@ -9,10 +10,11 @@ import {
|
|
|
9
10
|
IconContainer,
|
|
10
11
|
TextContainer,
|
|
11
12
|
} from './StyledAlert';
|
|
13
|
+
import type { IconName } from '../Icon';
|
|
12
14
|
|
|
13
15
|
const getIntentIcon = (
|
|
14
|
-
intent: 'success' | 'info' | 'warning' | 'error'
|
|
15
|
-
)
|
|
16
|
+
intent: 'success' | 'info' | 'warning' | 'error' | 'notification'
|
|
17
|
+
) => {
|
|
16
18
|
switch (intent) {
|
|
17
19
|
case 'success':
|
|
18
20
|
return 'circle-ok';
|
|
@@ -22,9 +24,18 @@ const getIntentIcon = (
|
|
|
22
24
|
return 'circle-info';
|
|
23
25
|
case 'error':
|
|
24
26
|
return 'circle-warning';
|
|
27
|
+
default:
|
|
28
|
+
return undefined;
|
|
25
29
|
}
|
|
26
30
|
};
|
|
27
31
|
|
|
32
|
+
const AlertIcon = ({ icon }: { icon?: IconName }) =>
|
|
33
|
+
icon ? (
|
|
34
|
+
<IconContainer testID="alert-left-icon">
|
|
35
|
+
<Icon icon={icon} size="small" />
|
|
36
|
+
</IconContainer>
|
|
37
|
+
) : null;
|
|
38
|
+
|
|
28
39
|
interface AlertProps {
|
|
29
40
|
/**
|
|
30
41
|
* Alert title.
|
|
@@ -44,7 +55,7 @@ interface AlertProps {
|
|
|
44
55
|
/**
|
|
45
56
|
* Visual intent color to apply to alert.
|
|
46
57
|
*/
|
|
47
|
-
intent?: 'success' | 'info' | 'warning' | 'error';
|
|
58
|
+
intent?: 'success' | 'info' | 'warning' | 'error' | 'notification';
|
|
48
59
|
/**
|
|
49
60
|
* Closing callback. When onClose is available, an X button will be rendered on the right side of alert. The callback will be called when user clicks on X button.
|
|
50
61
|
*/
|
|
@@ -81,9 +92,7 @@ const Alert = ({
|
|
|
81
92
|
>
|
|
82
93
|
<ContentContainer showDivider={!!onClose}>
|
|
83
94
|
{icon !== null ? (
|
|
84
|
-
<
|
|
85
|
-
<Icon icon={icon || getIntentIcon(intent)} size="small" />
|
|
86
|
-
</IconContainer>
|
|
95
|
+
<AlertIcon icon={icon || getIntentIcon(intent)} />
|
|
87
96
|
) : null}
|
|
88
97
|
<TextContainer>
|
|
89
98
|
{typeof title === 'string' ? (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type {
|
|
2
3
|
ImageSourcePropType,
|
|
3
4
|
StyleProp,
|
|
4
5
|
ViewProps,
|
|
5
6
|
ViewStyle,
|
|
6
7
|
} from 'react-native';
|
|
7
|
-
import React from 'react';
|
|
8
8
|
import {
|
|
9
9
|
StyledImage,
|
|
10
10
|
StyledPressable,
|
|
@@ -32,7 +32,8 @@ interface AvatarProps extends ViewProps {
|
|
|
32
32
|
| 'xlarge'
|
|
33
33
|
| 'xxlarge'
|
|
34
34
|
| 'xxxlarge'
|
|
35
|
-
| 'xxxxlarge'
|
|
35
|
+
| 'xxxxlarge'
|
|
36
|
+
| 'xxxxxlarge';
|
|
36
37
|
/**
|
|
37
38
|
* Additional style.
|
|
38
39
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { View,
|
|
2
|
-
import React
|
|
1
|
+
import { View, Animated } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
3
5
|
import { StyledStatus } from './StyledBadge';
|
|
4
6
|
|
|
5
7
|
export interface StatusProps extends ViewProps {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Animated
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import { StyledView, StyledText } from './StyledBadge';
|
|
4
5
|
import BadgeStatus from './Status';
|
|
5
6
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Text } from 'react-native';
|
|
3
3
|
import { fireEvent } from '@testing-library/react-native';
|
|
4
4
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
5
6
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
|
-
import BottomNavigation
|
|
7
|
+
import BottomNavigation from '..';
|
|
8
|
+
import type { BottomNavigationTabType } from '..';
|
|
7
9
|
|
|
8
10
|
const TestComponent = (
|
|
9
11
|
props: Omit<
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
TouchableWithoutFeedback,
|
|
4
|
-
StyleProp,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
ViewProps,
|
|
7
|
-
} from 'react-native';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
8
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
-
import
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
6
|
+
import Icon from '../Icon';
|
|
10
7
|
import { isHeroIcon } from '../Icon/utils';
|
|
11
8
|
import {
|
|
12
9
|
BottomBar,
|
|
@@ -18,6 +15,7 @@ import {
|
|
|
18
15
|
StyledBottomBarText,
|
|
19
16
|
} from './StyledBottomNavigation';
|
|
20
17
|
import { isIOS } from '../../utils/helpers';
|
|
18
|
+
import type { IconName } from '../Icon';
|
|
21
19
|
|
|
22
20
|
export type BottomNavigationTabType = {
|
|
23
21
|
key: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
3
4
|
import Button from '../Button';
|
|
4
5
|
import Divider from '../Divider';
|
|
5
6
|
import Typography from '../Typography';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import { ComponentProps } from 'react';
|
|
3
2
|
import {
|
|
4
3
|
Animated,
|
|
5
4
|
Pressable,
|
|
6
5
|
SafeAreaView,
|
|
7
6
|
StyleSheet,
|
|
8
7
|
View,
|
|
9
|
-
ViewProps,
|
|
10
8
|
} from 'react-native';
|
|
9
|
+
import type { ComponentProps } from 'react';
|
|
10
|
+
import type { ViewProps } from 'react-native';
|
|
11
11
|
|
|
12
12
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
13
13
|
const AnimatedSafeAreaView = Animated.createAnimatedComponent(SafeAreaView);
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import { Animated, Easing, Modal, StyleProp, ViewStyle } from 'react-native';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, Easing, Modal } from 'react-native';
|
|
3
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
9
5
|
import Footer from './Footer';
|
|
10
6
|
import Header from './Header';
|
|
11
7
|
import {
|