@hero-design/rn 7.18.0 → 7.19.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/.turbo/turbo-build.log +2 -2
- package/es/index.js +155 -143
- package/lib/index.js +155 -143
- package/package.json +2 -2
- 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 +3 -2
- package/src/components/Alert/index.tsx +5 -3
- package/src/components/Avatar/index.tsx +2 -2
- 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/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/Card/DataCard/index.tsx +3 -2
- package/src/components/Card/index.tsx +3 -2
- 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/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 +5 -3
- 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 +4 -7
- package/src/components/RichTextEditor/index.tsx +6 -6
- 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__/index.spec.tsx.snap +605 -585
- 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__/index.spec.tsx.snap +602 -582
- 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/StyledSpinner.tsx +2 -1
- package/src/components/Spinner/index.tsx +3 -3
- 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 +1 -1
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +4 -2
- package/src/components/Tabs/__tests__/index.spec.tsx +4 -2
- package/src/components/Tabs/index.tsx +7 -13
- package/src/components/Tag/index.tsx +1 -1
- 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 +3 -8
- package/src/components/Toast/Toast.tsx +3 -2
- package/src/components/Toast/ToastContainer.tsx +2 -2
- package/src/components/Toast/ToastContext.ts +1 -1
- package/src/components/Toast/ToastProvider.tsx +5 -7
- package/src/components/Toast/__tests__/ToastContainer.spec.tsx +1 -1
- package/src/components/Toast/types.ts +3 -3
- 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/index.tsx +3 -2
- package/src/testHelpers/renderWithTheme.tsx +2 -1
- package/src/theme/ThemeProvider.ts +1 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +24 -26
- package/src/theme/components/accordion.ts +1 -1
- package/src/theme/components/alert.ts +1 -1
- package/src/theme/components/avatar.ts +1 -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 +1 -1
- 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 +1 -1
- package/src/theme/components/select.ts +1 -1
- package/src/theme/components/spinner.ts +1 -1
- package/src/theme/components/switch.ts +7 -8
- package/src/theme/components/tabs.ts +1 -1
- package/src/theme/components/tag.ts +1 -1
- package/src/theme/components/textInput.ts +1 -1
- package/src/theme/components/toast.ts +1 -1
- package/src/theme/components/toolbar.ts +1 -1
- package/src/theme/components/typography.ts +1 -1
- package/src/theme/getTheme.ts +4 -11
- package/src/theme/global/borders.ts +2 -1
- package/src/theme/global/colors/swag.ts +2 -3
- package/src/theme/global/colors/work.ts +1 -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 +4 -9
- package/types/components/Accordion/AccordionItem.d.ts +3 -3
- package/types/components/Accordion/index.d.ts +3 -2
- package/types/components/Alert/StyledAlert.d.ts +2 -1
- package/types/components/Alert/index.d.ts +3 -3
- package/types/components/Avatar/index.d.ts +1 -1
- package/types/components/Badge/Status.d.ts +2 -2
- package/types/components/Badge/index.d.ts +2 -1
- 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 +1 -1
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +2 -1
- package/types/components/BottomSheet/index.d.ts +2 -2
- 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 +3 -2
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +3 -2
- 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 +2 -1
- package/types/components/Card/DataCard/index.d.ts +2 -2
- package/types/components/Card/index.d.ts +2 -2
- package/types/components/Checkbox/StyledCheckbox.d.ts +21 -3
- package/types/components/Checkbox/index.d.ts +11 -3
- package/types/components/Collapse/index.d.ts +2 -2
- 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 +2 -1
- package/types/components/DatePicker/index.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +1 -1
- 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 +2 -1
- package/types/components/Drawer/index.d.ts +1 -1
- 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 +3 -2
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +3 -2
- 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 +3 -2
- package/types/components/Icon/AnimatedIcon.d.ts +1 -1
- 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/PinInput/PinCell.d.ts +1 -1
- 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 +3 -2
- package/types/components/Progress/StyledProgressCircle.d.ts +3 -2
- 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 +2 -12
- package/types/components/RichTextEditor/RichTextEditor.d.ts +3 -2
- package/types/components/RichTextEditor/index.d.ts +3 -2
- package/types/components/SectionHeading/index.d.ts +3 -3
- package/types/components/Select/MultiSelect/Option.d.ts +1 -1
- 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 +1 -1
- 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/helpers.d.ts +1 -1
- package/types/components/Select/index.d.ts +4 -3
- package/types/components/Select/types.d.ts +3 -3
- package/types/components/Spinner/StyledSpinner.d.ts +2 -1
- package/types/components/Spinner/index.d.ts +2 -2
- package/types/components/Switch/StyledSwitch.d.ts +3 -18
- package/types/components/{Radio/__tests__/StyledRadio.spec.d.ts → Switch/__tests__/StyledSwitch.spec.d.ts} +0 -0
- package/types/components/Switch/index.d.ts +3 -2
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +3 -3
- package/types/components/Tag/index.d.ts +1 -1
- package/types/components/TextInput/index.d.ts +3 -3
- package/types/components/TimePicker/StyledTimePicker.d.ts +2 -1
- 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 +2 -1
- 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 +3 -3
- package/types/components/Toolbar/StyledToolbar.d.ts +2 -1
- 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/index.d.ts +2 -2
- package/types/testHelpers/renderWithTheme.d.ts +1 -1
- package/types/theme/ThemeProvider.d.ts +1 -1
- package/types/theme/components/accordion.d.ts +1 -1
- package/types/theme/components/alert.d.ts +1 -1
- package/types/theme/components/avatar.d.ts +1 -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 +1 -1
- 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 +1 -1
- package/types/theme/components/switch.d.ts +7 -6
- package/types/theme/components/tabs.d.ts +1 -1
- package/types/theme/components/tag.d.ts +1 -1
- package/types/theme/components/textInput.d.ts +1 -1
- package/types/theme/components/toast.d.ts +1 -1
- package/types/theme/components/toolbar.d.ts +1 -1
- package/types/theme/components/typography.d.ts +1 -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/work.d.ts +1 -1
- package/types/theme/global/index.d.ts +5 -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/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/types/components/Switch/__tests__/StyledHeading.spec.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
3
4
|
|
|
4
5
|
const StyledPickerWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
5
6
|
height: theme.__hd__.timePicker.sizes.height,
|
|
@@ -4,7 +4,7 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
4
4
|
import formatTime from 'date-fns/fp/format';
|
|
5
5
|
|
|
6
6
|
import TextInput from '../TextInput';
|
|
7
|
-
import { TimePickerProps } from './types';
|
|
7
|
+
import type { TimePickerProps } from './types';
|
|
8
8
|
|
|
9
9
|
const TimePickerAndroid = ({
|
|
10
10
|
value,
|
|
@@ -7,7 +7,7 @@ import BottomSheet from '../BottomSheet';
|
|
|
7
7
|
import TextInput from '../TextInput';
|
|
8
8
|
import Typography from '../Typography';
|
|
9
9
|
import { StyledPickerWrapper } from './StyledTimePicker';
|
|
10
|
-
import { TimePickerProps } from './types';
|
|
10
|
+
import type { TimePickerProps } from './types';
|
|
11
11
|
|
|
12
12
|
const TimePickerIOS = ({
|
|
13
13
|
value,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { fireEvent } from '@testing-library/react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ModalProps } from 'react-native';
|
|
4
|
-
|
|
3
|
+
import type { ModalProps } from 'react-native';
|
|
5
4
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
5
|
import TimePickerIOS from '../TimePickerIOS';
|
|
7
6
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import TimePickerAndroid from './TimePickerAndroid';
|
|
4
4
|
import TimePickerIOS from './TimePickerIOS';
|
|
5
|
-
import { TimePickerProps } from './types';
|
|
5
|
+
import type { TimePickerProps } from './types';
|
|
6
6
|
|
|
7
7
|
const TimePicker = (props: TimePickerProps) => {
|
|
8
8
|
if (Platform.OS === 'ios') {
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
View,
|
|
8
|
-
ViewProps,
|
|
9
|
-
} from 'react-native';
|
|
2
|
+
import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
import type { ViewProps } from 'react-native';
|
|
10
5
|
|
|
11
6
|
const ToastContainerWrapper = styled(View)<{ position: 'top' | 'bottom' }>(
|
|
12
7
|
({ theme, position }) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import { Animated, LayoutAnimation } from 'react-native';
|
|
3
|
-
import Icon
|
|
3
|
+
import Icon from '../Icon';
|
|
4
4
|
import Typography from '../Typography';
|
|
5
5
|
import {
|
|
6
6
|
Container,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
TextContainer,
|
|
11
11
|
} from './StyledToast';
|
|
12
12
|
import { useToastConfig } from './ToastContext';
|
|
13
|
-
import {
|
|
13
|
+
import type { IconName } from '../Icon';
|
|
14
|
+
import type { ToastProps } from './types';
|
|
14
15
|
|
|
15
16
|
const getIntentIcon = (
|
|
16
17
|
intent: 'success' | 'info' | 'warning' | 'error'
|
|
@@ -3,8 +3,8 @@ import { useTheme } from '@emotion/react';
|
|
|
3
3
|
|
|
4
4
|
import Toast from './Toast';
|
|
5
5
|
import { ToastContainerWrapper } from './StyledToast';
|
|
6
|
-
import { ToastContainerProps, ToastItemProps } from './types';
|
|
7
|
-
import { ToastControllerContextType } from './ToastContext';
|
|
6
|
+
import type { ToastContainerProps, ToastItemProps } from './types';
|
|
7
|
+
import type { ToastControllerContextType } from './ToastContext';
|
|
8
8
|
|
|
9
9
|
const generateID = () =>
|
|
10
10
|
(performance.now().toString(36) + Math.random().toString(36)).replace(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
-
import { ToastContainerProps, ToastProps } from './types';
|
|
2
|
+
import type { ToastContainerProps, ToastProps } from './types';
|
|
3
3
|
|
|
4
4
|
export type ToastControllerContextType = {
|
|
5
5
|
show: (props: Omit<ToastProps, 'position'>) => string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useRef, useState, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
3
4
|
import ToastContainer from './ToastContainer';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ToastControllerContextType,
|
|
8
|
-
} from './ToastContext';
|
|
9
|
-
import { ToastContainerProps } from './types';
|
|
5
|
+
import { ToastConfigContext, ToastContext } from './ToastContext';
|
|
6
|
+
import type { ToastControllerContextType } from './ToastContext';
|
|
7
|
+
import type { ToastContainerProps } from './types';
|
|
10
8
|
|
|
11
9
|
type ToastProviderProps = {
|
|
12
10
|
/**
|
|
@@ -2,7 +2,7 @@ import { act } from '@testing-library/react-native';
|
|
|
2
2
|
import React, { createRef } from 'react';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import ToastContainer from '../ToastContainer';
|
|
5
|
-
import { ToastControllerContextType } from '../ToastContext';
|
|
5
|
+
import type { ToastControllerContextType } from '../ToastContext';
|
|
6
6
|
|
|
7
7
|
describe('ToastContainer', () => {
|
|
8
8
|
afterEach(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { IconName } from '../Icon';
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { IconName } from '../Icon';
|
|
4
4
|
|
|
5
5
|
export interface ToastProps {
|
|
6
6
|
/**
|
|
@@ -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 ToolbarWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
5
6
|
position: 'absolute',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarGroupWrapper } from './StyledToolbar';
|
|
3
|
-
import ToolbarItem
|
|
3
|
+
import ToolbarItem from './ToolbarItem';
|
|
4
|
+
import type { ToolbarItemProps } from './ToolbarItem';
|
|
4
5
|
|
|
5
6
|
export interface ToolbarGroupProps {
|
|
6
7
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Icon
|
|
2
|
+
import Icon from '../Icon';
|
|
3
3
|
import Typography from '../Typography';
|
|
4
4
|
import { ToolbarItemWrapper } from './StyledToolbar';
|
|
5
|
+
import type { IconName } from '../Icon';
|
|
5
6
|
|
|
6
7
|
export interface ToolbarItemProps {
|
|
7
8
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render
|
|
2
|
+
import { render } from '@testing-library/react-native'; // eslint-disable-line import/no-extraneous-dependencies
|
|
3
3
|
import { ThemeProvider } from '@emotion/react';
|
|
4
|
+
import type { RenderOptions } from '@testing-library/react-native';
|
|
4
5
|
import { theme } from '../index';
|
|
5
6
|
|
|
6
7
|
const renderWithTheme = (ui: JSX.Element, options?: RenderOptions) =>
|
|
@@ -245,21 +245,24 @@ Object {
|
|
|
245
245
|
},
|
|
246
246
|
"checkbox": Object {
|
|
247
247
|
"borderWidths": Object {
|
|
248
|
-
"
|
|
248
|
+
"icon": 2,
|
|
249
|
+
"wrapper": 1,
|
|
249
250
|
},
|
|
250
251
|
"colors": Object {
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
"text": "#ffffff",
|
|
252
|
+
"default": "#001f23",
|
|
253
|
+
"disabledBorder": "#808f91",
|
|
254
254
|
},
|
|
255
255
|
"radii": Object {
|
|
256
|
-
"
|
|
256
|
+
"icon": 4,
|
|
257
|
+
"wrapper": 8,
|
|
257
258
|
},
|
|
258
259
|
"sizes": Object {
|
|
259
|
-
"
|
|
260
|
+
"icon": 20,
|
|
260
261
|
},
|
|
261
262
|
"space": Object {
|
|
262
|
-
"
|
|
263
|
+
"iconDescriptionPadding": 12,
|
|
264
|
+
"iconTop": -3,
|
|
265
|
+
"wrapperPadding": 16,
|
|
263
266
|
},
|
|
264
267
|
},
|
|
265
268
|
"contentNavigator": Object {
|
|
@@ -424,12 +427,6 @@ Object {
|
|
|
424
427
|
},
|
|
425
428
|
"listItemContainerBackground": "#ffffff",
|
|
426
429
|
},
|
|
427
|
-
"offsets": Object {
|
|
428
|
-
"cardShadow": Object {
|
|
429
|
-
"height": 2,
|
|
430
|
-
"width": 0,
|
|
431
|
-
},
|
|
432
|
-
},
|
|
433
430
|
"opacity": Object {
|
|
434
431
|
"cardShadow": 1,
|
|
435
432
|
"disabled": 0.38,
|
|
@@ -440,6 +437,13 @@ Object {
|
|
|
440
437
|
"cardShadow": 4,
|
|
441
438
|
"leadingStatus": 999,
|
|
442
439
|
},
|
|
440
|
+
"shadows": Object {
|
|
441
|
+
"cardElevation": 10,
|
|
442
|
+
"cardOffset": Object {
|
|
443
|
+
"height": 2,
|
|
444
|
+
"width": 0,
|
|
445
|
+
},
|
|
446
|
+
},
|
|
443
447
|
"space": Object {
|
|
444
448
|
"leadingStatusMarginRight": 8,
|
|
445
449
|
"listItemContainerPadding": 16,
|
|
@@ -506,13 +510,7 @@ Object {
|
|
|
506
510
|
"circle": 2,
|
|
507
511
|
},
|
|
508
512
|
"colors": Object {
|
|
509
|
-
"
|
|
510
|
-
"checkedWrapper": "#f3e6f6",
|
|
511
|
-
"circle": "#000000",
|
|
512
|
-
"wrapper": "#ffffff",
|
|
513
|
-
},
|
|
514
|
-
"radii": Object {
|
|
515
|
-
"wrapper": 4,
|
|
513
|
+
"circle": "#001f23",
|
|
516
514
|
},
|
|
517
515
|
"sizes": Object {
|
|
518
516
|
"circle": 20,
|
|
@@ -521,7 +519,6 @@ Object {
|
|
|
521
519
|
"space": Object {
|
|
522
520
|
"circleLeftMargin": 8,
|
|
523
521
|
"groupTopMargin": 4,
|
|
524
|
-
"wrapperPadding": 16,
|
|
525
522
|
},
|
|
526
523
|
},
|
|
527
524
|
"richTextEditor": Object {
|
|
@@ -590,12 +587,13 @@ Object {
|
|
|
590
587
|
},
|
|
591
588
|
},
|
|
592
589
|
"switch": Object {
|
|
593
|
-
"borderWidths": Object {
|
|
594
|
-
"default": 1,
|
|
595
|
-
},
|
|
596
590
|
"colors": Object {
|
|
597
|
-
"
|
|
598
|
-
|
|
591
|
+
"backgroundColors": Object {
|
|
592
|
+
"checked": "#8505a2",
|
|
593
|
+
"disabled-checked": "#c282d1",
|
|
594
|
+
"disabled-unchecked": "#ccced1",
|
|
595
|
+
"unchecked": "#808f91",
|
|
596
|
+
},
|
|
599
597
|
"thumb": "#ffffff",
|
|
600
598
|
},
|
|
601
599
|
"heights": Object {
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { GlobalTheme } from '../global';
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
|
+
import { scale } from '../../utils/scale';
|
|
2
3
|
|
|
3
4
|
const getCheckboxTheme = (theme: GlobalTheme) => {
|
|
4
5
|
const colors = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
disabled: theme.colors.inactiveBackground,
|
|
6
|
+
default: theme.colors.globalPrimary,
|
|
7
|
+
disabledBorder: theme.colors.globalPrimaryLight,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const space = {
|
|
11
11
|
// to remove the empty space above the check icon
|
|
12
12
|
// and also to center the check mark
|
|
13
|
-
iconTop: -
|
|
13
|
+
iconTop: -scale(3),
|
|
14
|
+
wrapperPadding: theme.space.medium,
|
|
15
|
+
iconDescriptionPadding: theme.space.smallMedium,
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
const sizes = {
|
|
17
|
-
|
|
19
|
+
icon: scale(20),
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
const radii = {
|
|
21
|
-
|
|
23
|
+
wrapper: theme.radii.medium,
|
|
24
|
+
icon: theme.radii.base,
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
const borderWidths = {
|
|
25
|
-
|
|
28
|
+
wrapper: theme.borderWidths.base,
|
|
29
|
+
icon: theme.borderWidths.medium,
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobalTheme } from '../global';
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
2
|
|
|
3
3
|
const getListTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const colors = {
|
|
@@ -27,8 +27,9 @@ const getListTheme = (theme: GlobalTheme) => {
|
|
|
27
27
|
leadingStatus: theme.radii.rounded,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const shadows = {
|
|
31
|
+
cardOffset: { width: 0, height: 2 },
|
|
32
|
+
cardElevation: 10,
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const widths = {
|
|
@@ -41,7 +42,7 @@ const getListTheme = (theme: GlobalTheme) => {
|
|
|
41
42
|
cardShadow: 1,
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
return { colors, space, radii,
|
|
45
|
+
return { colors, space, radii, widths, opacity, shadows };
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
export default getListTheme;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { scale } from '../../utils/scale';
|
|
2
|
-
import { GlobalTheme } from '../global';
|
|
2
|
+
import type { GlobalTheme } from '../global';
|
|
3
3
|
|
|
4
4
|
const getRadioTheme = (theme: GlobalTheme) => {
|
|
5
5
|
const colors = {
|
|
6
|
-
circle: theme.colors.
|
|
7
|
-
checkedCircle: theme.colors.primary,
|
|
8
|
-
wrapper: theme.colors.platformBackground,
|
|
9
|
-
checkedWrapper: theme.colors.primaryBackground,
|
|
6
|
+
circle: theme.colors.globalPrimary,
|
|
10
7
|
};
|
|
11
8
|
|
|
12
9
|
const space = {
|
|
13
|
-
wrapperPadding: theme.space.medium, // left padding should be 12 according to the design
|
|
14
10
|
circleLeftMargin: theme.space.small,
|
|
15
11
|
groupTopMargin: theme.space.xsmall,
|
|
16
12
|
};
|
|
@@ -24,11 +20,7 @@ const getRadioTheme = (theme: GlobalTheme) => {
|
|
|
24
20
|
circle: theme.borderWidths.medium,
|
|
25
21
|
};
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
wrapper: theme.radii.base,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return { sizes, borderWidths, space, colors, radii };
|
|
23
|
+
return { sizes, borderWidths, space, colors };
|
|
32
24
|
};
|
|
33
25
|
|
|
34
26
|
export default getRadioTheme;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { GlobalTheme } from '../global';
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
2
|
|
|
3
3
|
const getSwitchTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const colors = {
|
|
5
|
+
backgroundColors: {
|
|
6
|
+
checked: theme.colors.primary,
|
|
7
|
+
unchecked: theme.colors.globalPrimaryLight,
|
|
8
|
+
'disabled-checked': theme.colors.primaryLight,
|
|
9
|
+
'disabled-unchecked': theme.colors.archived,
|
|
10
|
+
},
|
|
5
11
|
thumb: theme.colors.platformBackground,
|
|
6
|
-
active: theme.colors.primary,
|
|
7
|
-
inactive: theme.colors.inactiveBackground,
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
const thumbSizes = {
|
|
@@ -32,10 +36,6 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
32
36
|
rounded: theme.radii.rounded,
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
const borderWidths = {
|
|
36
|
-
default: theme.borderWidths.base,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
39
|
return {
|
|
40
40
|
colors,
|
|
41
41
|
thumbSizes,
|
|
@@ -43,7 +43,6 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
43
43
|
heights,
|
|
44
44
|
spaces,
|
|
45
45
|
radii,
|
|
46
|
-
borderWidths,
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
48
|
|