@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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
5
|
+
import Box from '..';
|
|
6
|
+
|
|
7
|
+
describe('Box', () => {
|
|
8
|
+
it('renders content correctly', () => {
|
|
9
|
+
const { toJSON, getByTestId, getByText } = renderWithTheme(
|
|
10
|
+
<Box testID="box-test-id">
|
|
11
|
+
<Text>Box Content</Text>
|
|
12
|
+
</Box>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(toJSON()).toMatchSnapshot();
|
|
16
|
+
expect(getByTestId('box-test-id')).toBeTruthy();
|
|
17
|
+
expect(getByText('Box Content')).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
it.each`
|
|
20
|
+
color
|
|
21
|
+
${'warning'}
|
|
22
|
+
${'danger'}
|
|
23
|
+
${'success'}
|
|
24
|
+
${'backgroundDark'}
|
|
25
|
+
`('map prop to valid property and correct color from theme', ({ color }) => {
|
|
26
|
+
const { toJSON } = renderWithTheme(
|
|
27
|
+
<Box
|
|
28
|
+
backgroundColor={color}
|
|
29
|
+
borderColor={color}
|
|
30
|
+
borderTopColor={color}
|
|
31
|
+
borderBottomColor={color}
|
|
32
|
+
borderStartColor={color}
|
|
33
|
+
borderEndColor={color}
|
|
34
|
+
borderLeftColor={color}
|
|
35
|
+
borderRightColor={color}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
expect(toJSON()).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it.each`
|
|
43
|
+
color
|
|
44
|
+
${'warning'}
|
|
45
|
+
${'danger'}
|
|
46
|
+
${'success'}
|
|
47
|
+
${'backgroundDark'}
|
|
48
|
+
`(
|
|
49
|
+
'map prop with shortcut name to valid property and correct color from theme',
|
|
50
|
+
({ color }) => {
|
|
51
|
+
const { toJSON } = renderWithTheme(<Box bgColor={color} />);
|
|
52
|
+
|
|
53
|
+
expect(toJSON()).toMatchSnapshot();
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
it.each`
|
|
58
|
+
space
|
|
59
|
+
${'large'}
|
|
60
|
+
${'medium'}
|
|
61
|
+
${'small'}
|
|
62
|
+
${'xlarge'}
|
|
63
|
+
`('map prop to valid property and correct space from theme', ({ space }) => {
|
|
64
|
+
const { toJSON } = renderWithTheme(
|
|
65
|
+
<Box
|
|
66
|
+
margin={space}
|
|
67
|
+
marginBottom={space}
|
|
68
|
+
marginEnd={space}
|
|
69
|
+
marginHorizontal={space}
|
|
70
|
+
marginLeft={space}
|
|
71
|
+
marginRight={space}
|
|
72
|
+
marginStart={space}
|
|
73
|
+
marginTop={space}
|
|
74
|
+
marginVertical={space}
|
|
75
|
+
padding={space}
|
|
76
|
+
paddingBottom={space}
|
|
77
|
+
paddingEnd={space}
|
|
78
|
+
paddingHorizontal={space}
|
|
79
|
+
paddingLeft={space}
|
|
80
|
+
paddingRight={space}
|
|
81
|
+
paddingStart={space}
|
|
82
|
+
paddingTop={space}
|
|
83
|
+
paddingVertical={space}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect(toJSON()).toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it.each`
|
|
91
|
+
radii
|
|
92
|
+
${'base'}
|
|
93
|
+
${'large'}
|
|
94
|
+
${'medium'}
|
|
95
|
+
${'xlarge'}
|
|
96
|
+
${'rounded'}
|
|
97
|
+
`('map prop to valid property and correct radius from theme', ({ radii }) => {
|
|
98
|
+
const { toJSON } = renderWithTheme(
|
|
99
|
+
<Box
|
|
100
|
+
borderBottomEndRadius={radii}
|
|
101
|
+
borderBottomLeftRadius={radii}
|
|
102
|
+
borderBottomRightRadius={radii}
|
|
103
|
+
borderBottomStartRadius={radii}
|
|
104
|
+
borderTopEndRadius={radii}
|
|
105
|
+
borderTopLeftRadius={radii}
|
|
106
|
+
borderTopRightRadius={radii}
|
|
107
|
+
borderTopStartRadius={radii}
|
|
108
|
+
borderRadius={radii}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect(toJSON()).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it.each`
|
|
116
|
+
width
|
|
117
|
+
${'base'}
|
|
118
|
+
${'medium'}
|
|
119
|
+
`(
|
|
120
|
+
'map prop to valid property and correctborderWidth from theme',
|
|
121
|
+
({ width }) => {
|
|
122
|
+
const { toJSON } = renderWithTheme(
|
|
123
|
+
<Box
|
|
124
|
+
borderWidth={width}
|
|
125
|
+
borderBottomWidth={width}
|
|
126
|
+
borderTopWidth={width}
|
|
127
|
+
borderLeftWidth={width}
|
|
128
|
+
borderRightWidth={width}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
expect(toJSON()).toMatchSnapshot();
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
it('allows flex props', () => {
|
|
137
|
+
const { toJSON } = renderWithTheme(
|
|
138
|
+
<Box
|
|
139
|
+
alignContent="center"
|
|
140
|
+
alignItems="flex-end"
|
|
141
|
+
alignSelf="baseline"
|
|
142
|
+
display="flex"
|
|
143
|
+
flex={1}
|
|
144
|
+
flexBasis={20}
|
|
145
|
+
flexDirection="row"
|
|
146
|
+
flexGrow={3}
|
|
147
|
+
flexShrink={5}
|
|
148
|
+
flexWrap="wrap"
|
|
149
|
+
justifyContent="space-around"
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
expect(toJSON()).toMatchSnapshot();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const colors = {
|
|
2
|
+
backgroundColor: {
|
|
3
|
+
property: 'backgroundColor',
|
|
4
|
+
scale: 'colors',
|
|
5
|
+
},
|
|
6
|
+
bgColor: {
|
|
7
|
+
property: 'backgroundColor',
|
|
8
|
+
scale: 'colors',
|
|
9
|
+
},
|
|
10
|
+
borderColor: {
|
|
11
|
+
property: 'borderColor',
|
|
12
|
+
scale: 'colors',
|
|
13
|
+
},
|
|
14
|
+
borderTopColor: {
|
|
15
|
+
property: 'borderTopColor',
|
|
16
|
+
scale: 'colors',
|
|
17
|
+
},
|
|
18
|
+
borderBottomColor: {
|
|
19
|
+
property: 'borderBottomColor',
|
|
20
|
+
scale: 'colors',
|
|
21
|
+
},
|
|
22
|
+
borderStartColor: {
|
|
23
|
+
property: 'borderStartColor',
|
|
24
|
+
scale: 'colors',
|
|
25
|
+
},
|
|
26
|
+
borderEndColor: {
|
|
27
|
+
property: 'borderEndColor',
|
|
28
|
+
scale: 'colors',
|
|
29
|
+
},
|
|
30
|
+
borderLeftColor: {
|
|
31
|
+
property: 'borderLeftColor',
|
|
32
|
+
scale: 'colors',
|
|
33
|
+
},
|
|
34
|
+
borderRightColor: {
|
|
35
|
+
property: 'borderRightColor',
|
|
36
|
+
scale: 'colors',
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
const space = {
|
|
41
|
+
margin: {
|
|
42
|
+
property: 'margin',
|
|
43
|
+
scale: 'space',
|
|
44
|
+
},
|
|
45
|
+
marginBottom: {
|
|
46
|
+
property: 'marginBottom',
|
|
47
|
+
scale: 'space',
|
|
48
|
+
},
|
|
49
|
+
marginEnd: {
|
|
50
|
+
property: 'marginEnd',
|
|
51
|
+
scale: 'space',
|
|
52
|
+
},
|
|
53
|
+
marginHorizontal: {
|
|
54
|
+
property: 'marginHorizontal',
|
|
55
|
+
scale: 'space',
|
|
56
|
+
},
|
|
57
|
+
marginLeft: {
|
|
58
|
+
property: 'marginLeft',
|
|
59
|
+
scale: 'space',
|
|
60
|
+
},
|
|
61
|
+
marginRight: {
|
|
62
|
+
property: 'marginRight',
|
|
63
|
+
scale: 'space',
|
|
64
|
+
},
|
|
65
|
+
marginStart: {
|
|
66
|
+
property: 'marginStart',
|
|
67
|
+
scale: 'space',
|
|
68
|
+
},
|
|
69
|
+
marginTop: {
|
|
70
|
+
property: 'marginTop',
|
|
71
|
+
scale: 'space',
|
|
72
|
+
},
|
|
73
|
+
marginVertical: {
|
|
74
|
+
property: 'marginVertical',
|
|
75
|
+
scale: 'space',
|
|
76
|
+
},
|
|
77
|
+
padding: {
|
|
78
|
+
property: 'padding',
|
|
79
|
+
scale: 'space',
|
|
80
|
+
},
|
|
81
|
+
paddingBottom: {
|
|
82
|
+
property: 'paddingBottom',
|
|
83
|
+
scale: 'space',
|
|
84
|
+
},
|
|
85
|
+
paddingEnd: {
|
|
86
|
+
property: 'paddingEnd',
|
|
87
|
+
scale: 'space',
|
|
88
|
+
},
|
|
89
|
+
paddingHorizontal: {
|
|
90
|
+
property: 'paddingHorizontal',
|
|
91
|
+
scale: 'space',
|
|
92
|
+
},
|
|
93
|
+
paddingLeft: {
|
|
94
|
+
property: 'paddingLeft',
|
|
95
|
+
scale: 'space',
|
|
96
|
+
},
|
|
97
|
+
paddingRight: {
|
|
98
|
+
property: 'paddingRight',
|
|
99
|
+
scale: 'space',
|
|
100
|
+
},
|
|
101
|
+
paddingStart: {
|
|
102
|
+
property: 'paddingStart',
|
|
103
|
+
scale: 'space',
|
|
104
|
+
},
|
|
105
|
+
paddingTop: {
|
|
106
|
+
property: 'paddingTop',
|
|
107
|
+
scale: 'space',
|
|
108
|
+
},
|
|
109
|
+
paddingVertical: {
|
|
110
|
+
property: 'paddingVertical',
|
|
111
|
+
scale: 'space',
|
|
112
|
+
},
|
|
113
|
+
} as const;
|
|
114
|
+
|
|
115
|
+
const radii = {
|
|
116
|
+
borderBottomEndRadius: {
|
|
117
|
+
property: 'borderBottomEndRadius',
|
|
118
|
+
scale: 'radii',
|
|
119
|
+
},
|
|
120
|
+
borderBottomLeftRadius: {
|
|
121
|
+
property: 'borderBottomLeftRadius',
|
|
122
|
+
scale: 'radii',
|
|
123
|
+
},
|
|
124
|
+
borderBottomRightRadius: {
|
|
125
|
+
property: 'borderBottomRightRadius',
|
|
126
|
+
scale: 'radii',
|
|
127
|
+
},
|
|
128
|
+
borderBottomStartRadius: {
|
|
129
|
+
property: 'borderBottomStartRadius',
|
|
130
|
+
scale: 'radii',
|
|
131
|
+
},
|
|
132
|
+
borderTopEndRadius: {
|
|
133
|
+
property: 'borderTopEndRadius',
|
|
134
|
+
scale: 'radii',
|
|
135
|
+
},
|
|
136
|
+
borderTopLeftRadius: {
|
|
137
|
+
property: 'borderTopLeftRadius',
|
|
138
|
+
scale: 'radii',
|
|
139
|
+
},
|
|
140
|
+
borderTopRightRadius: {
|
|
141
|
+
property: 'borderTopRightRadius',
|
|
142
|
+
scale: 'radii',
|
|
143
|
+
},
|
|
144
|
+
borderTopStartRadius: {
|
|
145
|
+
property: 'borderTopStartRadius',
|
|
146
|
+
scale: 'radii',
|
|
147
|
+
},
|
|
148
|
+
borderRadius: {
|
|
149
|
+
property: 'borderRadius',
|
|
150
|
+
scale: 'radii',
|
|
151
|
+
},
|
|
152
|
+
} as const;
|
|
153
|
+
|
|
154
|
+
const borderWidths = {
|
|
155
|
+
borderWidth: {
|
|
156
|
+
property: 'borderWidth',
|
|
157
|
+
scale: 'borderWidths',
|
|
158
|
+
},
|
|
159
|
+
borderBottomWidth: {
|
|
160
|
+
property: 'borderBottomWidth',
|
|
161
|
+
scale: 'borderWidths',
|
|
162
|
+
},
|
|
163
|
+
borderTopWidth: {
|
|
164
|
+
property: 'borderTopWidth',
|
|
165
|
+
scale: 'borderWidths',
|
|
166
|
+
},
|
|
167
|
+
borderLeftWidth: {
|
|
168
|
+
property: 'borderLeftWidth',
|
|
169
|
+
scale: 'borderWidths',
|
|
170
|
+
},
|
|
171
|
+
borderRightWidth: {
|
|
172
|
+
property: 'borderRightWidth',
|
|
173
|
+
scale: 'borderWidths',
|
|
174
|
+
},
|
|
175
|
+
} as const;
|
|
176
|
+
|
|
177
|
+
const config = {
|
|
178
|
+
...colors,
|
|
179
|
+
...space,
|
|
180
|
+
...radii,
|
|
181
|
+
...borderWidths,
|
|
182
|
+
} as const;
|
|
183
|
+
|
|
184
|
+
export const flexPropsKey = [
|
|
185
|
+
'alignContent',
|
|
186
|
+
'alignItems',
|
|
187
|
+
'alignSelf',
|
|
188
|
+
'display',
|
|
189
|
+
'flex',
|
|
190
|
+
'flexBasis',
|
|
191
|
+
'flexDirection',
|
|
192
|
+
'flexGrow',
|
|
193
|
+
'flexShrink',
|
|
194
|
+
'flexWrap',
|
|
195
|
+
'justifyContent',
|
|
196
|
+
] as const;
|
|
197
|
+
|
|
198
|
+
export type ConfigType = typeof config;
|
|
199
|
+
export type FlexPropsKeyType = typeof flexPropsKey[number];
|
|
200
|
+
|
|
201
|
+
export default config;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledBox } from './StyledBox';
|
|
3
|
+
import type { BoxViewProps, FlexStyleProps, StyleProps } from './types';
|
|
4
|
+
|
|
5
|
+
export interface BoxProps extends StyleProps, FlexStyleProps, BoxViewProps {}
|
|
6
|
+
|
|
7
|
+
const Box = ({ children, style, testID, ...otherProps }: BoxProps) => (
|
|
8
|
+
<StyledBox {...otherProps} style={style} testID={testID}>
|
|
9
|
+
{children}
|
|
10
|
+
</StyledBox>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default Box;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { SystemPalette } from '../../theme/global';
|
|
4
|
+
import { BorderWidths, Radii } from '../../theme/global/borders';
|
|
5
|
+
import { Space } from '../../theme/global/space';
|
|
6
|
+
import { ConfigType, FlexPropsKeyType } from './config';
|
|
7
|
+
|
|
8
|
+
export interface ThemeScale {
|
|
9
|
+
colors: keyof SystemPalette;
|
|
10
|
+
space: keyof Space;
|
|
11
|
+
radii: keyof Radii;
|
|
12
|
+
borderWidths: keyof BorderWidths;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type ConfigKeyType = keyof ConfigType;
|
|
16
|
+
|
|
17
|
+
export type StyleProps = {
|
|
18
|
+
[key in ConfigKeyType]?: ThemeScale[ConfigType[key]['scale']];
|
|
19
|
+
};
|
|
20
|
+
export type FlexStyleProps = Pick<
|
|
21
|
+
Omit<ViewStyle, keyof StyleProps>,
|
|
22
|
+
FlexPropsKeyType
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export interface BoxViewProps extends ViewProps {
|
|
26
|
+
/**
|
|
27
|
+
* Box's content.
|
|
28
|
+
*/
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Addtional styles.
|
|
32
|
+
*/
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
/**
|
|
35
|
+
* Testing id of the component.
|
|
36
|
+
*/
|
|
37
|
+
testID?: string;
|
|
38
|
+
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
|
-
import React
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { IconName } from '../Icon';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactChild } from 'react';
|
|
4
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
6
5
|
import LoadingIndicator from './LoadingIndicator';
|
|
7
6
|
import {
|
|
8
|
-
Intent,
|
|
9
7
|
StyledButtonContainer,
|
|
10
8
|
StyledButtonText,
|
|
11
9
|
StyledButtonIconWrapper,
|
|
12
10
|
StyledButtonIcon,
|
|
13
|
-
ThemeVariant,
|
|
14
11
|
} from './StyledButton';
|
|
12
|
+
import type { IconName } from '../Icon';
|
|
13
|
+
import type { Intent, ThemeVariant } from './StyledButton';
|
|
15
14
|
|
|
16
15
|
export interface ButtonProps {
|
|
17
16
|
/**
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
StyleProp,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
TouchableOpacityProps,
|
|
8
|
-
} from 'react-native';
|
|
3
|
+
import { TouchableOpacity } from 'react-native';
|
|
9
4
|
|
|
10
|
-
import
|
|
5
|
+
import type { StyleProp, ViewStyle, TouchableOpacityProps } from 'react-native';
|
|
6
|
+
import Icon from '../Icon';
|
|
7
|
+
import type { IconProps, IconName } from '../Icon';
|
|
11
8
|
|
|
12
9
|
export interface IconButtonProps {
|
|
13
10
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { View
|
|
2
|
-
import styled
|
|
3
|
-
import {
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import styled from '@emotion/native';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import type { ReactNativeStyle } from '@emotion/native';
|
|
5
|
+
import type { Theme } from '@emotion/react';
|
|
4
6
|
|
|
5
7
|
type Intent = 'primary' | 'secondary' | 'danger';
|
|
6
8
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Easing,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
StyleProp,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
ViewProps,
|
|
9
|
-
} from 'react-native';
|
|
2
|
+
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
3
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
10
4
|
import {
|
|
11
5
|
StyledLoadingDot,
|
|
12
6
|
StyledLoadingIndicatorWrapper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TouchableHighlight, View } from 'react-native';
|
|
2
|
-
import styled
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import styled from '@emotion/native';
|
|
3
|
+
import type { ReactNativeStyle } from '@emotion/native';
|
|
4
|
+
import type { Theme } from '@emotion/react';
|
|
5
5
|
import Icon from '../Icon';
|
|
6
6
|
import Typography from '../Typography';
|
|
7
7
|
|
|
@@ -316,6 +316,5 @@ export {
|
|
|
316
316
|
StyledButtonText,
|
|
317
317
|
StyledButtonIconWrapper,
|
|
318
318
|
StyledButtonIcon,
|
|
319
|
-
Intent,
|
|
320
|
-
ThemeVariant,
|
|
321
319
|
};
|
|
320
|
+
export type { Intent, ThemeVariant };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import Icon
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactChild } from 'react';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import Icon from '../../Icon';
|
|
5
5
|
import {
|
|
6
6
|
ButtonContainer,
|
|
7
7
|
IconWrapper,
|
|
8
8
|
ButtonText,
|
|
9
9
|
} from './StyledUtilityButton';
|
|
10
|
+
import type { IconName } from '../../Icon';
|
|
10
11
|
|
|
11
12
|
export interface UtilityButtonProps extends ViewProps {
|
|
12
13
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import Button
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import Button from './Button';
|
|
3
3
|
import IconButton from './IconButton';
|
|
4
4
|
import UtilityButton from './UtilityButton';
|
|
5
|
+
import type { ButtonProps } from './Button';
|
|
5
6
|
|
|
6
7
|
interface CompoundButtonProps extends FunctionComponent<ButtonProps> {
|
|
7
8
|
Icon: typeof IconButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import { TouchableOpacity, View
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
3
4
|
|
|
4
5
|
const StyledContainer = styled(View)(({ theme }) => ({
|
|
5
6
|
backgroundColor: theme.__hd__.calendar.colors.background,
|
|
@@ -60,23 +60,19 @@ describe('Calendar', () => {
|
|
|
60
60
|
const onTitlePress = jest.fn();
|
|
61
61
|
const onPreviousPress = jest.fn();
|
|
62
62
|
const onNextPress = jest.fn();
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
minDate={new Date(2022, 10, 3)}
|
|
77
|
-
maxDate={new Date(2022, 10, 27)}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
63
|
+
const { getByText, queryByText, queryAllByTestId, queryByTestId } =
|
|
64
|
+
renderWithTheme(
|
|
65
|
+
<Calendar
|
|
66
|
+
value={new Date(2022, 10, 5)}
|
|
67
|
+
visibleDate={new Date(2022, 10, 5)}
|
|
68
|
+
onChange={onChange}
|
|
69
|
+
onTitlePress={onTitlePress}
|
|
70
|
+
onPreviousPress={onPreviousPress}
|
|
71
|
+
onNextPress={onNextPress}
|
|
72
|
+
minDate={new Date(2022, 10, 3)}
|
|
73
|
+
maxDate={new Date(2022, 10, 27)}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
80
76
|
|
|
81
77
|
expect(queryAllByTestId('calendar-date-cell')).toHaveLength(25);
|
|
82
78
|
expect(queryAllByTestId('calendar-disabled-cell')).toHaveLength(17);
|
|
@@ -8,9 +8,15 @@ const StyledDataCard = styled(View)(({ theme }) => ({
|
|
|
8
8
|
}));
|
|
9
9
|
|
|
10
10
|
const Indicator = styled(View)<{
|
|
11
|
-
themeIntent:
|
|
11
|
+
themeIntent:
|
|
12
|
+
| 'success'
|
|
13
|
+
| 'info'
|
|
14
|
+
| 'warning'
|
|
15
|
+
| 'danger'
|
|
16
|
+
| 'archived'
|
|
17
|
+
| 'primary';
|
|
12
18
|
}>(({ theme, themeIntent }) => ({
|
|
13
|
-
backgroundColor: theme.__hd__.card.colors
|
|
19
|
+
backgroundColor: theme.__hd__.card.colors[themeIntent],
|
|
14
20
|
width: theme.__hd__.card.sizes.indicatorWidth,
|
|
15
21
|
height: '100%',
|
|
16
22
|
}));
|
|
@@ -48,6 +48,22 @@ exports[`Indicator renders correctly when intent is info 1`] = `
|
|
|
48
48
|
/>
|
|
49
49
|
`;
|
|
50
50
|
|
|
51
|
+
exports[`Indicator renders correctly when intent is primary 1`] = `
|
|
52
|
+
<View
|
|
53
|
+
style={
|
|
54
|
+
Array [
|
|
55
|
+
Object {
|
|
56
|
+
"backgroundColor": "#c38cee",
|
|
57
|
+
"height": "100%",
|
|
58
|
+
"width": 16,
|
|
59
|
+
},
|
|
60
|
+
undefined,
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
themeIntent="primary"
|
|
64
|
+
/>
|
|
65
|
+
`;
|
|
66
|
+
|
|
51
67
|
exports[`Indicator renders correctly when intent is success 1`] = `
|
|
52
68
|
<View
|
|
53
69
|
style={
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
4
|
import { StyledDataCard, Indicator } from './StyledDataCard';
|
|
4
5
|
|
|
5
6
|
export interface DataCardProps extends ViewProps {
|
|
@@ -10,7 +11,7 @@ export interface DataCardProps extends ViewProps {
|
|
|
10
11
|
/**
|
|
11
12
|
* Visual intent color to apply to card.
|
|
12
13
|
*/
|
|
13
|
-
intent?: '
|
|
14
|
+
intent?: 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
14
15
|
/**
|
|
15
16
|
* Additional style.
|
|
16
17
|
*/
|