@hero-design/rn 8.52.2-rc2.0 → 8.53.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 +1 -1
- package/CHANGELOG.md +4 -16
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +997 -700
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +996 -698
- package/package.json +7 -7
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +4 -0
- package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +2 -0
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
- package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +2 -0
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -0
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +6 -0
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -0
- package/src/components/BottomNavigation/StyledBottomNavigation.tsx +60 -0
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +413 -0
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +97 -0
- package/src/components/BottomNavigation/index.tsx +166 -0
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +21 -32
- package/src/components/BottomSheet/index.tsx +1 -1
- package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +21 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +10 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +10 -0
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +16 -0
- package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +1 -0
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +32 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +5 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +7 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -0
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +2 -0
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +4 -0
- package/src/components/Carousel/__tests__/__snapshots__/StyledCarousel.spec.tsx.snap +1 -0
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +803 -1
- package/src/components/Carousel/__tests__/index.spec.tsx +47 -37
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +8 -0
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/Checkbox/index.tsx +13 -1
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
- package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +2 -0
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +15 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +1 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +329 -309
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +12 -0
- package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Error/index.tsx +20 -3
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/FAB/ActionGroup/index.tsx +14 -1
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -0
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +3 -0
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/HeroDesignProvider/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +7 -0
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +2 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +4 -0
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +4 -0
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +9 -0
- package/src/components/Modal/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/PageControl/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +5 -0
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Portal/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +5 -0
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +2 -0
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +1 -0
- package/src/components/Rate/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/RefreshControl/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +1 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +1 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +4 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/SectionHeading/__tests__/index.spec.tsx +1 -0
- package/src/components/SectionHeading/index.tsx +57 -32
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +4 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +42 -128
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +4 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +35 -96
- package/src/components/Skeleton/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
- package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +1 -0
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +24 -0
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +3 -0
- package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +4 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +5 -0
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Tabs/__tests__/SceneView.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/SceneView.spec.tsx.snap +4 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +3 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +10 -0
- package/src/components/Tag/index.tsx +12 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +21 -0
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +17 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +2 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +330 -309
- package/src/components/Toast/StyledToast.tsx +9 -7
- package/src/components/Toast/Toast.tsx +4 -1
- package/src/components/Toast/ToastContainer.tsx +6 -2
- package/src/components/Toast/ToastContext.ts +5 -2
- package/src/components/Toast/ToastProvider.tsx +19 -2
- package/src/components/Toast/__tests__/ToastContainer.spec.tsx +15 -12
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +7 -0
- package/src/components/Toast/__tests__/__snapshots__/ToastContainer.spec.tsx.snap +14 -6
- package/src/components/Toast/types.ts +5 -1
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +3 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +8 -0
- package/src/components/Typography/Body/__tests__/__snapshots__/StyledBody.tsx.snap +16 -0
- package/src/components/Typography/Body/__tests__/__snapshots__/index.spec.tsx.snap +19 -0
- package/src/components/Typography/Caption/__tests__/__snapshots__/StyledCaption.spec.tsx.snap +10 -0
- package/src/components/Typography/Caption/__tests__/__snapshots__/index.spec.tsx.snap +13 -0
- package/src/components/Typography/Label/__tests__/__snapshots__/StyledLabel.tsx.snap +8 -0
- package/src/components/Typography/Label/__tests__/__snapshots__/index.spec.tsx.snap +11 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +20 -0
- package/src/components/Typography/Title/__tests__/__snapshots__/StyledTitle.tsx.snap +20 -0
- package/src/components/Typography/Title/__tests__/__snapshots__/index.spec.tsx.snap +23 -0
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +102 -0
- package/src/theme/components/badge.ts +28 -1
- package/src/theme/components/bottomNavigation.ts +27 -0
- package/src/theme/components/button.ts +24 -0
- package/src/theme/components/carousel.ts +28 -1
- package/src/theme/components/empty.ts +23 -1
- package/src/theme/components/error.ts +32 -1
- package/src/theme/components/fab.ts +13 -2
- package/src/theme/components/pinInput.ts +32 -0
- package/src/theme/components/success.ts +23 -1
- package/src/theme/components/tag.ts +28 -1
- package/src/theme/components/textInput.ts +5 -0
- package/src/theme/getTheme.ts +21 -18
- package/src/types.ts +2 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +52 -0
- package/types/components/BottomNavigation/index.d.ts +45 -0
- package/types/components/Checkbox/index.d.ts +6 -1
- package/types/components/Error/index.d.ts +9 -3
- package/types/components/FAB/ActionGroup/index.d.ts +5 -0
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/SectionHeading/index.d.ts +11 -1
- package/types/components/Tag/index.d.ts +6 -1
- package/types/components/Toast/StyledToast.d.ts +2 -0
- package/types/components/Toast/ToastContext.d.ts +2 -2
- package/types/components/Toast/ToastProvider.d.ts +1 -1
- package/types/components/Toast/index.d.ts +1 -1
- package/types/components/Toast/types.d.ts +5 -1
- package/types/index.d.ts +2 -1
- package/types/theme/components/badge.d.ts +24 -0
- package/types/theme/components/bottomNavigation.d.ts +23 -0
- package/types/theme/components/button.d.ts +20 -0
- package/types/theme/components/carousel.d.ts +24 -0
- package/types/theme/components/empty.d.ts +19 -0
- package/types/theme/components/error.d.ts +27 -0
- package/types/theme/components/fab.d.ts +19 -8
- package/types/theme/components/pinInput.d.ts +27 -0
- package/types/theme/components/success.d.ts +19 -0
- package/types/theme/components/tag.d.ts +24 -0
- package/types/theme/components/textInput.d.ts +5 -0
- package/types/theme/getTheme.d.ts +20 -18
- package/types/types.d.ts +2 -1
|
@@ -4,13 +4,15 @@ import type { ComponentProps } from 'react';
|
|
|
4
4
|
import type { ViewProps } from 'react-native';
|
|
5
5
|
import { IntentType } from './types';
|
|
6
6
|
|
|
7
|
-
const ToastContainerWrapper = styled(View)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const ToastContainerWrapper = styled(View)<{ position: 'top' | 'bottom' }>(
|
|
8
|
+
({ theme, position }) => ({
|
|
9
|
+
...StyleSheet.absoluteFillObject,
|
|
10
|
+
paddingHorizontal: theme.__hd__.toast.space.wrapperVerticalPadding,
|
|
11
|
+
paddingVertical: theme.__hd__.toast.space.wrapperHorizontalPadding,
|
|
12
|
+
flexDirection: position === 'bottom' ? 'column-reverse' : 'column',
|
|
13
|
+
elevation: 9999,
|
|
14
|
+
})
|
|
15
|
+
);
|
|
14
16
|
|
|
15
17
|
const Container = styled(Animated.View)<{
|
|
16
18
|
themeVariant: 'default' | 'round';
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CTAWrapper,
|
|
10
10
|
TextContainer,
|
|
11
11
|
} from './StyledToast';
|
|
12
|
+
import { useToastConfig } from './ToastContext';
|
|
12
13
|
import type { IconName } from '../Icon';
|
|
13
14
|
import type { IntentType, ToastProps } from './types';
|
|
14
15
|
|
|
@@ -58,6 +59,7 @@ const Toast = ({
|
|
|
58
59
|
distance = 0,
|
|
59
60
|
}: ToastProps): JSX.Element => {
|
|
60
61
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
62
|
+
const toastConfig = useToastConfig();
|
|
61
63
|
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
if (autoDismiss && duration >= 0) {
|
|
@@ -84,7 +86,8 @@ const Toast = ({
|
|
|
84
86
|
|
|
85
87
|
const interpolateY = animatedValue.interpolate({
|
|
86
88
|
inputRange: [0, 1],
|
|
87
|
-
outputRange:
|
|
89
|
+
outputRange:
|
|
90
|
+
toastConfig.position === 'top' ? [-20, distance] : [20, -distance],
|
|
88
91
|
});
|
|
89
92
|
|
|
90
93
|
return (
|
|
@@ -38,7 +38,7 @@ const SingleToastDisplay = ({
|
|
|
38
38
|
const ToastContainer = React.forwardRef<
|
|
39
39
|
ToastControllerContextType,
|
|
40
40
|
ToastContainerProps
|
|
41
|
-
>(({ displayType = 'single', style }, ref) => {
|
|
41
|
+
>(({ displayType = 'single', position = 'bottom', style }, ref) => {
|
|
42
42
|
const theme = useTheme();
|
|
43
43
|
const [toastList, setToastList] = useState<ToastItemProps[]>([]);
|
|
44
44
|
|
|
@@ -61,7 +61,11 @@ const ToastContainer = React.forwardRef<
|
|
|
61
61
|
}));
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<ToastContainerWrapper
|
|
64
|
+
<ToastContainerWrapper
|
|
65
|
+
pointerEvents="box-none"
|
|
66
|
+
position={position}
|
|
67
|
+
style={style}
|
|
68
|
+
>
|
|
65
69
|
{displayType === 'single' ? (
|
|
66
70
|
<SingleToastDisplay toastList={toastList} setToastList={setToastList} />
|
|
67
71
|
) : (
|
|
@@ -2,7 +2,7 @@ import { createContext, useContext } from 'react';
|
|
|
2
2
|
import type { ToastContainerProps, ToastProps } from './types';
|
|
3
3
|
|
|
4
4
|
export type ToastControllerContextType = {
|
|
5
|
-
show: (props: ToastProps) => string;
|
|
5
|
+
show: (props: Omit<ToastProps, 'position'>) => string;
|
|
6
6
|
hide: (id: string) => void;
|
|
7
7
|
clearAll: () => void;
|
|
8
8
|
};
|
|
@@ -11,7 +11,10 @@ export const ToastContext = createContext<ToastControllerContextType>(
|
|
|
11
11
|
{} as ToastControllerContextType
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
export type ToastConfigContextType = Pick<
|
|
14
|
+
export type ToastConfigContextType = Pick<
|
|
15
|
+
ToastContainerProps,
|
|
16
|
+
'position' | 'displayType'
|
|
17
|
+
>;
|
|
15
18
|
|
|
16
19
|
export const ToastConfigContext = createContext<ToastConfigContextType>(
|
|
17
20
|
{} as ToastConfigContextType
|
|
@@ -6,6 +6,7 @@ import ToastContainer from './ToastContainer';
|
|
|
6
6
|
import { ToastConfigContext, ToastContext } from './ToastContext';
|
|
7
7
|
import type { ToastControllerContextType } from './ToastContext';
|
|
8
8
|
import type { ToastContainerProps } from './types';
|
|
9
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
9
10
|
|
|
10
11
|
type ToastProviderProps = {
|
|
11
12
|
/**
|
|
@@ -17,7 +18,16 @@ type ToastProviderProps = {
|
|
|
17
18
|
const ToastProvider = ({
|
|
18
19
|
children,
|
|
19
20
|
displayType = 'single',
|
|
21
|
+
position: _position,
|
|
20
22
|
}: ToastProviderProps) => {
|
|
23
|
+
const position: ToastContainerProps['position'] =
|
|
24
|
+
_position === undefined ? 'bottom' : _position;
|
|
25
|
+
|
|
26
|
+
useDeprecation(
|
|
27
|
+
"Toast's position prop is deprecated and will be removed in the next major release.\nPlease remove it.",
|
|
28
|
+
_position !== undefined
|
|
29
|
+
);
|
|
30
|
+
|
|
21
31
|
const toastRef = useRef<ToastControllerContextType>(null);
|
|
22
32
|
// @ts-expect-error: TODO: @tungv Fix this type error
|
|
23
33
|
const [refState, setRefState] = useState<ToastControllerContextType>(null);
|
|
@@ -28,14 +38,21 @@ const ToastProvider = ({
|
|
|
28
38
|
}
|
|
29
39
|
}, []);
|
|
30
40
|
|
|
31
|
-
const config = useMemo(
|
|
41
|
+
const config = useMemo(
|
|
42
|
+
() => ({ displayType, position }),
|
|
43
|
+
[displayType, position]
|
|
44
|
+
);
|
|
32
45
|
|
|
33
46
|
return (
|
|
34
47
|
<ToastContext.Provider value={refState}>
|
|
35
48
|
<View style={{ flex: 1 }}>
|
|
36
49
|
{refState ? children : null}
|
|
37
50
|
<ToastConfigContext.Provider value={config}>
|
|
38
|
-
<ToastContainer
|
|
51
|
+
<ToastContainer
|
|
52
|
+
ref={toastRef}
|
|
53
|
+
displayType={displayType}
|
|
54
|
+
position={position}
|
|
55
|
+
/>
|
|
39
56
|
</ToastConfigContext.Provider>
|
|
40
57
|
</View>
|
|
41
58
|
</ToastContext.Provider>
|
|
@@ -10,18 +10,21 @@ describe('ToastContainer', () => {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it.each`
|
|
13
|
-
displayType
|
|
14
|
-
${'single'}
|
|
15
|
-
${'stack'}
|
|
16
|
-
${'single'}
|
|
17
|
-
${'stack'}
|
|
18
|
-
`(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
displayType | position
|
|
14
|
+
${'single'} | ${'top'}
|
|
15
|
+
${'stack'} | ${'top'}
|
|
16
|
+
${'single'} | ${'bottom'}
|
|
17
|
+
${'stack'} | ${'bottom'}
|
|
18
|
+
`(
|
|
19
|
+
'renders correctly with displayType: $displayType, position: $position',
|
|
20
|
+
({ displayType, position }) => {
|
|
21
|
+
const { toJSON } = renderWithTheme(
|
|
22
|
+
<ToastContainer displayType={displayType} position={position} />
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(toJSON()).toMatchSnapshot();
|
|
26
|
+
}
|
|
27
|
+
);
|
|
25
28
|
|
|
26
29
|
it('show multiple toasts correctly when displayType is stack', () => {
|
|
27
30
|
const toastRef = createRef<ToastControllerContextType>();
|
|
@@ -113,6 +113,7 @@ exports[`Toast Icon render custom icon correctly 1`] = `
|
|
|
113
113
|
</View>
|
|
114
114
|
<View
|
|
115
115
|
pointerEvents="box-none"
|
|
116
|
+
position="bottom"
|
|
116
117
|
style={
|
|
117
118
|
[
|
|
118
119
|
{
|
|
@@ -304,6 +305,7 @@ exports[`Toast renders correctly when intent is error 1`] = `
|
|
|
304
305
|
</View>
|
|
305
306
|
<View
|
|
306
307
|
pointerEvents="box-none"
|
|
308
|
+
position="bottom"
|
|
307
309
|
style={
|
|
308
310
|
[
|
|
309
311
|
{
|
|
@@ -495,6 +497,7 @@ exports[`Toast renders correctly when intent is info 1`] = `
|
|
|
495
497
|
</View>
|
|
496
498
|
<View
|
|
497
499
|
pointerEvents="box-none"
|
|
500
|
+
position="bottom"
|
|
498
501
|
style={
|
|
499
502
|
[
|
|
500
503
|
{
|
|
@@ -659,6 +662,7 @@ exports[`Toast renders correctly when intent is notification 1`] = `
|
|
|
659
662
|
</View>
|
|
660
663
|
<View
|
|
661
664
|
pointerEvents="box-none"
|
|
665
|
+
position="bottom"
|
|
662
666
|
style={
|
|
663
667
|
[
|
|
664
668
|
{
|
|
@@ -823,6 +827,7 @@ exports[`Toast renders correctly when intent is snackbar 1`] = `
|
|
|
823
827
|
</View>
|
|
824
828
|
<View
|
|
825
829
|
pointerEvents="box-none"
|
|
830
|
+
position="bottom"
|
|
826
831
|
style={
|
|
827
832
|
[
|
|
828
833
|
{
|
|
@@ -1014,6 +1019,7 @@ exports[`Toast renders correctly when intent is success 1`] = `
|
|
|
1014
1019
|
</View>
|
|
1015
1020
|
<View
|
|
1016
1021
|
pointerEvents="box-none"
|
|
1022
|
+
position="bottom"
|
|
1017
1023
|
style={
|
|
1018
1024
|
[
|
|
1019
1025
|
{
|
|
@@ -1205,6 +1211,7 @@ exports[`Toast renders correctly when intent is warning 1`] = `
|
|
|
1205
1211
|
</View>
|
|
1206
1212
|
<View
|
|
1207
1213
|
pointerEvents="box-none"
|
|
1214
|
+
position="bottom"
|
|
1208
1215
|
style={
|
|
1209
1216
|
[
|
|
1210
1217
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`ToastContainer renders correctly with displayType: single 1`] = `
|
|
3
|
+
exports[`ToastContainer renders correctly with displayType: single, position: bottom 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
{
|
|
@@ -10,6 +10,7 @@ exports[`ToastContainer renders correctly with displayType: single 1`] = `
|
|
|
10
10
|
>
|
|
11
11
|
<View
|
|
12
12
|
pointerEvents="box-none"
|
|
13
|
+
position="bottom"
|
|
13
14
|
style={
|
|
14
15
|
[
|
|
15
16
|
{
|
|
@@ -29,6 +30,7 @@ exports[`ToastContainer renders correctly with displayType: single 1`] = `
|
|
|
29
30
|
/>
|
|
30
31
|
<View
|
|
31
32
|
pointerEvents="box-none"
|
|
33
|
+
position="bottom"
|
|
32
34
|
style={
|
|
33
35
|
[
|
|
34
36
|
{
|
|
@@ -49,7 +51,7 @@ exports[`ToastContainer renders correctly with displayType: single 1`] = `
|
|
|
49
51
|
</View>
|
|
50
52
|
`;
|
|
51
53
|
|
|
52
|
-
exports[`ToastContainer renders correctly with displayType: single
|
|
54
|
+
exports[`ToastContainer renders correctly with displayType: single, position: top 1`] = `
|
|
53
55
|
<View
|
|
54
56
|
style={
|
|
55
57
|
{
|
|
@@ -59,12 +61,13 @@ exports[`ToastContainer renders correctly with displayType: single 2`] = `
|
|
|
59
61
|
>
|
|
60
62
|
<View
|
|
61
63
|
pointerEvents="box-none"
|
|
64
|
+
position="top"
|
|
62
65
|
style={
|
|
63
66
|
[
|
|
64
67
|
{
|
|
65
68
|
"bottom": 0,
|
|
66
69
|
"elevation": 9999,
|
|
67
|
-
"flexDirection": "column
|
|
70
|
+
"flexDirection": "column",
|
|
68
71
|
"left": 0,
|
|
69
72
|
"paddingHorizontal": 24,
|
|
70
73
|
"paddingVertical": 16,
|
|
@@ -78,6 +81,7 @@ exports[`ToastContainer renders correctly with displayType: single 2`] = `
|
|
|
78
81
|
/>
|
|
79
82
|
<View
|
|
80
83
|
pointerEvents="box-none"
|
|
84
|
+
position="bottom"
|
|
81
85
|
style={
|
|
82
86
|
[
|
|
83
87
|
{
|
|
@@ -98,7 +102,7 @@ exports[`ToastContainer renders correctly with displayType: single 2`] = `
|
|
|
98
102
|
</View>
|
|
99
103
|
`;
|
|
100
104
|
|
|
101
|
-
exports[`ToastContainer renders correctly with displayType: stack 1`] = `
|
|
105
|
+
exports[`ToastContainer renders correctly with displayType: stack, position: bottom 1`] = `
|
|
102
106
|
<View
|
|
103
107
|
style={
|
|
104
108
|
{
|
|
@@ -108,6 +112,7 @@ exports[`ToastContainer renders correctly with displayType: stack 1`] = `
|
|
|
108
112
|
>
|
|
109
113
|
<View
|
|
110
114
|
pointerEvents="box-none"
|
|
115
|
+
position="bottom"
|
|
111
116
|
style={
|
|
112
117
|
[
|
|
113
118
|
{
|
|
@@ -127,6 +132,7 @@ exports[`ToastContainer renders correctly with displayType: stack 1`] = `
|
|
|
127
132
|
/>
|
|
128
133
|
<View
|
|
129
134
|
pointerEvents="box-none"
|
|
135
|
+
position="bottom"
|
|
130
136
|
style={
|
|
131
137
|
[
|
|
132
138
|
{
|
|
@@ -147,7 +153,7 @@ exports[`ToastContainer renders correctly with displayType: stack 1`] = `
|
|
|
147
153
|
</View>
|
|
148
154
|
`;
|
|
149
155
|
|
|
150
|
-
exports[`ToastContainer renders correctly with displayType: stack
|
|
156
|
+
exports[`ToastContainer renders correctly with displayType: stack, position: top 1`] = `
|
|
151
157
|
<View
|
|
152
158
|
style={
|
|
153
159
|
{
|
|
@@ -157,12 +163,13 @@ exports[`ToastContainer renders correctly with displayType: stack 2`] = `
|
|
|
157
163
|
>
|
|
158
164
|
<View
|
|
159
165
|
pointerEvents="box-none"
|
|
166
|
+
position="top"
|
|
160
167
|
style={
|
|
161
168
|
[
|
|
162
169
|
{
|
|
163
170
|
"bottom": 0,
|
|
164
171
|
"elevation": 9999,
|
|
165
|
-
"flexDirection": "column
|
|
172
|
+
"flexDirection": "column",
|
|
166
173
|
"left": 0,
|
|
167
174
|
"paddingHorizontal": 24,
|
|
168
175
|
"paddingVertical": 16,
|
|
@@ -176,6 +183,7 @@ exports[`ToastContainer renders correctly with displayType: stack 2`] = `
|
|
|
176
183
|
/>
|
|
177
184
|
<View
|
|
178
185
|
pointerEvents="box-none"
|
|
186
|
+
position="bottom"
|
|
179
187
|
style={
|
|
180
188
|
[
|
|
181
189
|
{
|
|
@@ -72,6 +72,10 @@ export interface ToastContainerProps {
|
|
|
72
72
|
* Displays multiple toasts at a time or one by one.
|
|
73
73
|
*/
|
|
74
74
|
displayType?: 'single' | 'stack';
|
|
75
|
+
/**
|
|
76
|
+
* Position that the toast message will appear on the screen.
|
|
77
|
+
*/
|
|
78
|
+
position?: 'top' | 'bottom';
|
|
75
79
|
/**
|
|
76
80
|
* Additional style for toasts container.
|
|
77
81
|
*/
|
|
@@ -80,5 +84,5 @@ export interface ToastContainerProps {
|
|
|
80
84
|
|
|
81
85
|
export type ToastItemProps = {
|
|
82
86
|
id: string;
|
|
83
|
-
props: ToastProps
|
|
87
|
+
props: Omit<ToastProps, 'position'>;
|
|
84
88
|
};
|
|
@@ -219,6 +219,7 @@ exports[`ToolbarGroup renders correctly with when align is center 1`] = `
|
|
|
219
219
|
</View>
|
|
220
220
|
<View
|
|
221
221
|
pointerEvents="box-none"
|
|
222
|
+
position="bottom"
|
|
222
223
|
style={
|
|
223
224
|
[
|
|
224
225
|
{
|
|
@@ -458,6 +459,7 @@ exports[`ToolbarGroup renders correctly with when align is left 1`] = `
|
|
|
458
459
|
</View>
|
|
459
460
|
<View
|
|
460
461
|
pointerEvents="box-none"
|
|
462
|
+
position="bottom"
|
|
461
463
|
style={
|
|
462
464
|
[
|
|
463
465
|
{
|
|
@@ -697,6 +699,7 @@ exports[`ToolbarGroup renders correctly with when align is right 1`] = `
|
|
|
697
699
|
</View>
|
|
698
700
|
<View
|
|
699
701
|
pointerEvents="box-none"
|
|
702
|
+
position="bottom"
|
|
700
703
|
style={
|
|
701
704
|
[
|
|
702
705
|
{
|
|
@@ -107,6 +107,7 @@ exports[`ToolbarItems renders correctly when disabled 1`] = `
|
|
|
107
107
|
</View>
|
|
108
108
|
<View
|
|
109
109
|
pointerEvents="box-none"
|
|
110
|
+
position="bottom"
|
|
110
111
|
style={
|
|
111
112
|
[
|
|
112
113
|
{
|
|
@@ -198,6 +199,7 @@ exports[`ToolbarItems renders correctly when intent is danger, icon is undefined
|
|
|
198
199
|
</View>
|
|
199
200
|
<View
|
|
200
201
|
pointerEvents="box-none"
|
|
202
|
+
position="bottom"
|
|
201
203
|
style={
|
|
202
204
|
[
|
|
203
205
|
{
|
|
@@ -289,6 +291,7 @@ exports[`ToolbarItems renders correctly when intent is info, icon is undefined,
|
|
|
289
291
|
</View>
|
|
290
292
|
<View
|
|
291
293
|
pointerEvents="box-none"
|
|
294
|
+
position="bottom"
|
|
292
295
|
style={
|
|
293
296
|
[
|
|
294
297
|
{
|
|
@@ -416,6 +419,7 @@ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outli
|
|
|
416
419
|
</View>
|
|
417
420
|
<View
|
|
418
421
|
pointerEvents="box-none"
|
|
422
|
+
position="bottom"
|
|
419
423
|
style={
|
|
420
424
|
[
|
|
421
425
|
{
|
|
@@ -543,6 +547,7 @@ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outli
|
|
|
543
547
|
</View>
|
|
544
548
|
<View
|
|
545
549
|
pointerEvents="box-none"
|
|
550
|
+
position="bottom"
|
|
546
551
|
style={
|
|
547
552
|
[
|
|
548
553
|
{
|
|
@@ -644,6 +649,7 @@ exports[`ToolbarItems renders correctly when intent is primary, icon is ai-outli
|
|
|
644
649
|
</View>
|
|
645
650
|
<View
|
|
646
651
|
pointerEvents="box-none"
|
|
652
|
+
position="bottom"
|
|
647
653
|
style={
|
|
648
654
|
[
|
|
649
655
|
{
|
|
@@ -735,6 +741,7 @@ exports[`ToolbarItems renders correctly when intent is success, icon is undefine
|
|
|
735
741
|
</View>
|
|
736
742
|
<View
|
|
737
743
|
pointerEvents="box-none"
|
|
744
|
+
position="bottom"
|
|
738
745
|
style={
|
|
739
746
|
[
|
|
740
747
|
{
|
|
@@ -826,6 +833,7 @@ exports[`ToolbarItems renders correctly when intent is warning, icon is undefine
|
|
|
826
833
|
</View>
|
|
827
834
|
<View
|
|
828
835
|
pointerEvents="box-none"
|
|
836
|
+
position="bottom"
|
|
829
837
|
style={
|
|
830
838
|
[
|
|
831
839
|
{
|
|
@@ -29,6 +29,7 @@ exports[`StyledBody has body intent style 1`] = `
|
|
|
29
29
|
</Text>
|
|
30
30
|
<View
|
|
31
31
|
pointerEvents="box-none"
|
|
32
|
+
position="bottom"
|
|
32
33
|
style={
|
|
33
34
|
[
|
|
34
35
|
{
|
|
@@ -78,6 +79,7 @@ exports[`StyledBody has danger intent style 1`] = `
|
|
|
78
79
|
</Text>
|
|
79
80
|
<View
|
|
80
81
|
pointerEvents="box-none"
|
|
82
|
+
position="bottom"
|
|
81
83
|
style={
|
|
82
84
|
[
|
|
83
85
|
{
|
|
@@ -127,6 +129,7 @@ exports[`StyledBody has info intent style 1`] = `
|
|
|
127
129
|
</Text>
|
|
128
130
|
<View
|
|
129
131
|
pointerEvents="box-none"
|
|
132
|
+
position="bottom"
|
|
130
133
|
style={
|
|
131
134
|
[
|
|
132
135
|
{
|
|
@@ -176,6 +179,7 @@ exports[`StyledBody has inverted intent style 1`] = `
|
|
|
176
179
|
</Text>
|
|
177
180
|
<View
|
|
178
181
|
pointerEvents="box-none"
|
|
182
|
+
position="bottom"
|
|
179
183
|
style={
|
|
180
184
|
[
|
|
181
185
|
{
|
|
@@ -225,6 +229,7 @@ exports[`StyledBody has primary intent style 1`] = `
|
|
|
225
229
|
</Text>
|
|
226
230
|
<View
|
|
227
231
|
pointerEvents="box-none"
|
|
232
|
+
position="bottom"
|
|
228
233
|
style={
|
|
229
234
|
[
|
|
230
235
|
{
|
|
@@ -274,6 +279,7 @@ exports[`StyledBody has regular variant and neutral typeface and $fontWeight fon
|
|
|
274
279
|
</Text>
|
|
275
280
|
<View
|
|
276
281
|
pointerEvents="box-none"
|
|
282
|
+
position="bottom"
|
|
277
283
|
style={
|
|
278
284
|
[
|
|
279
285
|
{
|
|
@@ -323,6 +329,7 @@ exports[`StyledBody has regular variant and playful typeface and $fontWeight fon
|
|
|
323
329
|
</Text>
|
|
324
330
|
<View
|
|
325
331
|
pointerEvents="box-none"
|
|
332
|
+
position="bottom"
|
|
326
333
|
style={
|
|
327
334
|
[
|
|
328
335
|
{
|
|
@@ -372,6 +379,7 @@ exports[`StyledBody has regular-bold variant and neutral typeface and $fontWeigh
|
|
|
372
379
|
</Text>
|
|
373
380
|
<View
|
|
374
381
|
pointerEvents="box-none"
|
|
382
|
+
position="bottom"
|
|
375
383
|
style={
|
|
376
384
|
[
|
|
377
385
|
{
|
|
@@ -421,6 +429,7 @@ exports[`StyledBody has regular-bold variant and playful typeface and $fontWeigh
|
|
|
421
429
|
</Text>
|
|
422
430
|
<View
|
|
423
431
|
pointerEvents="box-none"
|
|
432
|
+
position="bottom"
|
|
424
433
|
style={
|
|
425
434
|
[
|
|
426
435
|
{
|
|
@@ -470,6 +479,7 @@ exports[`StyledBody has small variant and neutral typeface and $fontWeight fontW
|
|
|
470
479
|
</Text>
|
|
471
480
|
<View
|
|
472
481
|
pointerEvents="box-none"
|
|
482
|
+
position="bottom"
|
|
473
483
|
style={
|
|
474
484
|
[
|
|
475
485
|
{
|
|
@@ -519,6 +529,7 @@ exports[`StyledBody has small variant and playful typeface and $fontWeight fontW
|
|
|
519
529
|
</Text>
|
|
520
530
|
<View
|
|
521
531
|
pointerEvents="box-none"
|
|
532
|
+
position="bottom"
|
|
522
533
|
style={
|
|
523
534
|
[
|
|
524
535
|
{
|
|
@@ -568,6 +579,7 @@ exports[`StyledBody has small-bold variant and neutral typeface and $fontWeight
|
|
|
568
579
|
</Text>
|
|
569
580
|
<View
|
|
570
581
|
pointerEvents="box-none"
|
|
582
|
+
position="bottom"
|
|
571
583
|
style={
|
|
572
584
|
[
|
|
573
585
|
{
|
|
@@ -617,6 +629,7 @@ exports[`StyledBody has small-bold variant and playful typeface and $fontWeight
|
|
|
617
629
|
</Text>
|
|
618
630
|
<View
|
|
619
631
|
pointerEvents="box-none"
|
|
632
|
+
position="bottom"
|
|
620
633
|
style={
|
|
621
634
|
[
|
|
622
635
|
{
|
|
@@ -666,6 +679,7 @@ exports[`StyledBody has subdued intent style 1`] = `
|
|
|
666
679
|
</Text>
|
|
667
680
|
<View
|
|
668
681
|
pointerEvents="box-none"
|
|
682
|
+
position="bottom"
|
|
669
683
|
style={
|
|
670
684
|
[
|
|
671
685
|
{
|
|
@@ -715,6 +729,7 @@ exports[`StyledBody has success intent style 1`] = `
|
|
|
715
729
|
</Text>
|
|
716
730
|
<View
|
|
717
731
|
pointerEvents="box-none"
|
|
732
|
+
position="bottom"
|
|
718
733
|
style={
|
|
719
734
|
[
|
|
720
735
|
{
|
|
@@ -764,6 +779,7 @@ exports[`StyledBody has warning intent style 1`] = `
|
|
|
764
779
|
</Text>
|
|
765
780
|
<View
|
|
766
781
|
pointerEvents="box-none"
|
|
782
|
+
position="bottom"
|
|
767
783
|
style={
|
|
768
784
|
[
|
|
769
785
|
{
|