@hero-design/rn 8.12.5 → 8.13.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.
@@ -0,0 +1,40 @@
1
+ import type { GlobalTheme } from '../global';
2
+
3
+ const getErrorTheme = (theme: GlobalTheme) => {
4
+ const space = {
5
+ titleMarginBottom: theme.space.small,
6
+ imageMarginBottom: theme.space.xlarge,
7
+ wrapperPadding: theme.space.large,
8
+ button: {
9
+ wrapperHorizontalPadding: theme.space.medium,
10
+ wrapperVerticalPadding: theme.space.xxxlarge,
11
+ margin: theme.space.medium,
12
+ padding: theme.space.medium,
13
+ },
14
+ };
15
+
16
+ const sizes = {
17
+ image: theme.sizes['19xlarge'],
18
+ };
19
+
20
+ const colors = {
21
+ title: theme.colors.onDefaultGlobalSurface,
22
+ description: theme.colors.mutedOnDefaultGlobalSurface,
23
+ fullScreenBackground: theme.colors.decorativePrimarySurface,
24
+ inPageBackground: theme.colors.neutralGlobalSurface,
25
+ };
26
+
27
+ const fontSizes = {
28
+ title: theme.fontSizes.xxxlarge,
29
+ description: theme.fontSizes.xlarge,
30
+ };
31
+
32
+ const fonts = {
33
+ title: theme.fonts.playful.semiBold,
34
+ description: theme.fonts.playful.regular,
35
+ };
36
+
37
+ return { fontSizes, colors, sizes, space, fonts };
38
+ };
39
+
40
+ export default getErrorTheme;
@@ -18,6 +18,7 @@ import getDatePickerTheme from './components/datePicker';
18
18
  import getDividerTheme from './components/divider';
19
19
  import getDrawerTheme from './components/drawer';
20
20
  import getEmptyTheme from './components/empty';
21
+ import getErrorTheme from './components/error';
21
22
  import getFABTheme from './components/fab';
22
23
  import getIconTheme from './components/icon';
23
24
  import getImageTheme from './components/image';
@@ -64,6 +65,7 @@ type Theme = GlobalTheme & {
64
65
  divider: ReturnType<typeof getDividerTheme>;
65
66
  drawer: ReturnType<typeof getDrawerTheme>;
66
67
  empty: ReturnType<typeof getEmptyTheme>;
68
+ error: ReturnType<typeof getErrorTheme>;
67
69
  fab: ReturnType<typeof getFABTheme>;
68
70
  icon: ReturnType<typeof getIconTheme>;
69
71
  image: ReturnType<typeof getImageTheme>;
@@ -116,6 +118,7 @@ const getTheme = (
116
118
  divider: getDividerTheme(globalTheme),
117
119
  drawer: getDrawerTheme(globalTheme),
118
120
  empty: getEmptyTheme(globalTheme),
121
+ error: getErrorTheme(globalTheme),
119
122
  fab: getFABTheme(globalTheme),
120
123
  icon: getIconTheme(globalTheme),
121
124
  image: getImageTheme(globalTheme),
@@ -0,0 +1,54 @@
1
+ /// <reference types="react" />
2
+ import { Modal, View } from 'react-native';
3
+ declare type ErrorVariant = 'full-screen' | 'in-page';
4
+ declare const StyledErrorModal: import("@emotion/native").StyledComponent<import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & {
5
+ theme?: import("@emotion/react").Theme | undefined;
6
+ as?: import("react").ElementType<any> | undefined;
7
+ }, {}, {
8
+ ref?: import("react").Ref<Modal> | undefined;
9
+ }>;
10
+ declare const StyledErrorContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: import("react").ElementType<any> | undefined;
13
+ } & {
14
+ themeVariant: ErrorVariant;
15
+ }, {}, {
16
+ ref?: import("react").Ref<View> | undefined;
17
+ }>;
18
+ declare const StyledErrorContent: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
19
+ theme?: import("@emotion/react").Theme | undefined;
20
+ as?: import("react").ElementType<any> | undefined;
21
+ }, {}, {
22
+ ref?: import("react").Ref<View> | undefined;
23
+ }>;
24
+ declare const StyledErrorButtonContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
25
+ theme?: import("@emotion/react").Theme | undefined;
26
+ as?: import("react").ElementType<any> | undefined;
27
+ }, {}, {
28
+ ref?: import("react").Ref<View> | undefined;
29
+ }>;
30
+ declare const StyledErrorButtonPrimary: import("@emotion/native").StyledComponent<import("../Button/Button").ButtonProps & {
31
+ children?: import("react").ReactNode;
32
+ } & {
33
+ theme?: import("@emotion/react").Theme | undefined;
34
+ as?: import("react").ElementType<any> | undefined;
35
+ }, {}, {}>;
36
+ declare const StyledErrorButtonSecondary: import("@emotion/native").StyledComponent<import("../Button/Button").ButtonProps & {
37
+ children?: import("react").ReactNode;
38
+ } & {
39
+ theme?: import("@emotion/react").Theme | undefined;
40
+ as?: import("react").ElementType<any> | undefined;
41
+ }, {}, {}>;
42
+ declare const StyledErrorImage: import("@emotion/native").StyledComponent<import("../Image").ImageProps & {
43
+ theme?: import("@emotion/react").Theme | undefined;
44
+ as?: import("react").ElementType<any> | undefined;
45
+ }, {}, {}>;
46
+ declare const StyledErrorTitle: import("@emotion/native").StyledComponent<import("../..").TextProps & {
47
+ theme?: import("@emotion/react").Theme | undefined;
48
+ as?: import("react").ElementType<any> | undefined;
49
+ }, {}, {}>;
50
+ declare const StyledErrorDescription: import("@emotion/native").StyledComponent<import("../..").TextProps & {
51
+ theme?: import("@emotion/react").Theme | undefined;
52
+ as?: import("react").ElementType<any> | undefined;
53
+ }, {}, {}>;
54
+ export { ErrorVariant, StyledErrorModal, StyledErrorImage, StyledErrorContainer, StyledErrorButtonContainer, StyledErrorButtonPrimary, StyledErrorButtonSecondary, StyledErrorContent, StyledErrorTitle, StyledErrorDescription, };
@@ -0,0 +1,55 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { ImageSourcePropType, ViewProps } from 'react-native';
3
+ import { ErrorVariant } from './StyledError';
4
+ interface ErrorPageProps extends ViewProps {
5
+ /**
6
+ * Variant of the error
7
+ */
8
+ variant?: ErrorVariant;
9
+ /**
10
+ * Title of the error
11
+ */
12
+ title: string;
13
+ /**
14
+ * Description of the error
15
+ */
16
+ description?: string;
17
+ /**
18
+ * Image of the error
19
+ */
20
+ image?: ImageSourcePropType | string;
21
+ /**
22
+ * Testing id of the component.
23
+ */
24
+ testID?: string;
25
+ /**
26
+ * Action button text
27
+ */
28
+ ctaText?: string;
29
+ /**
30
+ * Callback when the action button is pressed.
31
+ */
32
+ onCtaPress?: () => void;
33
+ /**
34
+ * Secondary button text
35
+ */
36
+ secondaryCtaText?: string;
37
+ /**
38
+ * Callback when the secondary button is pressed.
39
+ */
40
+ onSecondaryCtaPress?: () => void;
41
+ }
42
+ declare type ErrorProps = ErrorPageProps & {
43
+ /**
44
+ * Visibility of the error
45
+ */
46
+ visible: boolean;
47
+ };
48
+ /**
49
+ * Renders error page
50
+ *
51
+ * @param {ErrorProps}
52
+ * @return {*} {ReactElement}
53
+ */
54
+ declare const Error: ({ visible, variant, title, description, testID, ctaText, onCtaPress, secondaryCtaText, onSecondaryCtaPress, ...nativeProps }: ErrorProps) => ReactElement;
55
+ export default Error;
package/types/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import DatePicker from './components/DatePicker';
19
19
  import Divider from './components/Divider';
20
20
  import Drawer from './components/Drawer';
21
21
  import Empty from './components/Empty';
22
+ import Error from './components/Error';
22
23
  import FAB from './components/FAB';
23
24
  import Icon from './components/Icon';
24
25
  import Image from './components/Image';
@@ -42,5 +43,5 @@ import Typography from './components/Typography';
42
43
  import RefreshControl from './components/RefreshControl';
43
44
  import RichTextEditor from './components/RichTextEditor';
44
45
  import PageControl from './components/PageControl';
45
- export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, Image, List, PinInput, Progress, PageControl, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
46
+ export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, Icon, Image, List, PinInput, Progress, PageControl, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
46
47
  export * from './types';
@@ -0,0 +1,32 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getErrorTheme: (theme: GlobalTheme) => {
3
+ fontSizes: {
4
+ title: number;
5
+ description: number;
6
+ };
7
+ colors: {
8
+ title: string;
9
+ description: string;
10
+ fullScreenBackground: string;
11
+ inPageBackground: string;
12
+ };
13
+ sizes: {
14
+ image: number;
15
+ };
16
+ space: {
17
+ titleMarginBottom: number;
18
+ imageMarginBottom: number;
19
+ wrapperPadding: number;
20
+ button: {
21
+ wrapperHorizontalPadding: number;
22
+ wrapperVerticalPadding: number;
23
+ margin: number;
24
+ padding: number;
25
+ };
26
+ };
27
+ fonts: {
28
+ title: string;
29
+ description: string;
30
+ };
31
+ };
32
+ export default getErrorTheme;
@@ -16,6 +16,7 @@ import getDatePickerTheme from './components/datePicker';
16
16
  import getDividerTheme from './components/divider';
17
17
  import getDrawerTheme from './components/drawer';
18
18
  import getEmptyTheme from './components/empty';
19
+ import getErrorTheme from './components/error';
19
20
  import getFABTheme from './components/fab';
20
21
  import getIconTheme from './components/icon';
21
22
  import getImageTheme from './components/image';
@@ -60,6 +61,7 @@ declare type Theme = GlobalTheme & {
60
61
  divider: ReturnType<typeof getDividerTheme>;
61
62
  drawer: ReturnType<typeof getDrawerTheme>;
62
63
  empty: ReturnType<typeof getEmptyTheme>;
64
+ error: ReturnType<typeof getErrorTheme>;
63
65
  fab: ReturnType<typeof getFABTheme>;
64
66
  icon: ReturnType<typeof getIconTheme>;
65
67
  image: ReturnType<typeof getImageTheme>;