@hero-design/rn 7.0.4 → 7.1.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.
Files changed (85) hide show
  1. package/.expo/packager-info.json +1 -1
  2. package/babel.config.js +1 -1
  3. package/es/index.js +170 -49
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +169 -46
  6. package/package.json +6 -4
  7. package/playground/components/Card.tsx +75 -92
  8. package/playground/components/FAB.tsx +49 -0
  9. package/playground/index.tsx +3 -1
  10. package/rollup.config.js +11 -2
  11. package/src/components/Badge/index.tsx +12 -6
  12. package/src/components/Card/__tests__/__snapshots__/Card.spec.tsx.snap +4 -4
  13. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +4 -4
  14. package/src/components/Card/index.tsx +16 -3
  15. package/src/components/Divider/StyledDivider.tsx +1 -1
  16. package/src/components/Divider/index.tsx +20 -2
  17. package/src/components/FAB/AnimatedFABIcon.tsx +47 -0
  18. package/src/components/FAB/StyledFABContainer.tsx +14 -0
  19. package/src/components/FAB/StyledFABIcon.tsx +9 -0
  20. package/src/components/FAB/__tests__/AnimatedFABIcon.spec.tsx +20 -0
  21. package/src/components/FAB/__tests__/StyledFABContainer.spec.tsx +18 -0
  22. package/src/components/FAB/__tests__/StyledFABIcon.spec.tsx +16 -0
  23. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +71 -0
  24. package/src/components/FAB/__tests__/__snapshots__/StyledFABContainer.spec.tsx.snap +46 -0
  25. package/src/components/FAB/__tests__/__snapshots__/StyledFABIcon.spec.tsx.snap +21 -0
  26. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +120 -0
  27. package/src/components/FAB/__tests__/index.spec.tsx +58 -0
  28. package/src/components/FAB/index.tsx +56 -0
  29. package/src/components/Icon/index.tsx +8 -8
  30. package/src/components/Typography/Text/{__test__ → __tests__}/StyledText.spec.tsx +0 -0
  31. package/src/components/Typography/Text/{__test__ → __tests__}/__snapshots__/StyledText.spec.tsx.snap +0 -0
  32. package/src/components/Typography/Text/{__test__ → __tests__}/index.spec.tsx +0 -0
  33. package/src/components/Typography/Text/index.tsx +13 -1
  34. package/src/index.ts +4 -0
  35. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +15 -2
  36. package/src/theme/components/card.ts +1 -1
  37. package/src/theme/components/divider.ts +2 -2
  38. package/src/theme/components/fab.ts +21 -0
  39. package/src/theme/global/space.ts +11 -9
  40. package/src/theme/global/typography.ts +11 -9
  41. package/src/theme/index.ts +3 -0
  42. package/src/utils/__tests__/scale.spec.ts +26 -0
  43. package/src/utils/scale.ts +10 -0
  44. package/testUtils/setup.ts +4 -0
  45. package/types/components/Card/StyledCard.d.ts +3 -0
  46. package/types/components/Card/__tests__/Card.spec.d.ts +1 -0
  47. package/types/components/Card/__tests__/StyledCard.spec.d.ts +1 -0
  48. package/types/components/Card/index.d.ts +5 -0
  49. package/types/components/Divider/StyledDivider.d.ts +7 -0
  50. package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +1 -0
  51. package/types/components/Divider/index.d.ts +12 -0
  52. package/types/index.d.ts +4 -3
  53. package/types/playground/components/FAB.d.ts +2 -0
  54. package/types/src/components/Badge/index.d.ts +6 -6
  55. package/types/src/components/Card/index.d.ts +14 -1
  56. package/types/src/components/Divider/index.d.ts +11 -2
  57. package/types/src/components/FAB/AnimatedFABIcon.d.ts +6 -0
  58. package/types/src/components/FAB/StyledFABContainer.d.ts +3 -0
  59. package/types/src/components/FAB/StyledFABIcon.d.ts +3 -0
  60. package/types/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +1 -0
  61. package/types/src/components/FAB/__tests__/StyledFABContainer.spec.d.ts +1 -0
  62. package/types/src/components/FAB/__tests__/StyledFABIcon.spec.d.ts +1 -0
  63. package/types/src/components/FAB/__tests__/index.spec.d.ts +1 -0
  64. package/types/src/components/FAB/index.d.ts +30 -0
  65. package/types/src/components/Icon/index.d.ts +8 -8
  66. package/types/src/components/Typography/Text/__tests__/StyledText.spec.d.ts +1 -0
  67. package/types/src/components/Typography/Text/__tests__/index.spec.d.ts +1 -0
  68. package/types/src/components/Typography/Text/index.d.ts +9 -1
  69. package/types/src/index.d.ts +3 -1
  70. package/types/src/theme/components/divider.d.ts +1 -1
  71. package/types/src/theme/components/fab.d.ts +15 -0
  72. package/types/src/theme/index.d.ts +2 -0
  73. package/types/src/utils/__tests__/scale.spec.d.ts +1 -0
  74. package/types/src/utils/scale.d.ts +2 -0
  75. package/types/theme/__tests__/index.spec.d.ts +1 -0
  76. package/types/theme/components/card.d.ts +10 -0
  77. package/types/theme/components/divider.d.ts +17 -0
  78. package/types/theme/global/borders.d.ts +4 -0
  79. package/types/theme/global/colors.d.ts +2 -0
  80. package/types/theme/global/index.d.ts +5 -0
  81. package/types/theme/index.d.ts +4 -2
  82. package/types/theme/colors.d.ts +0 -24
  83. package/types/theme/components/demoStyle.d.ts +0 -11
  84. package/types/theme/space.d.ts +0 -12
  85. package/types/theme/typography.d.ts +0 -21
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ViewProps } from 'react-native';
2
+ interface CardProps extends ViewProps {
3
+ }
4
+ declare const Card: (props: CardProps) => JSX.Element;
5
+ export default Card;
@@ -0,0 +1,7 @@
1
+ import { View } from 'react-native';
2
+ declare type MarginSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
3
+ declare const StyledDivider: import("styled-components").StyledComponent<typeof View, import("../../theme").Theme, {
4
+ themeMarginHorizontal?: MarginSize | undefined;
5
+ themeMarginVertical?: MarginSize | undefined;
6
+ }, never>;
7
+ export { StyledDivider };
@@ -0,0 +1,12 @@
1
+ interface DividerProps {
2
+ /**
3
+ * Horizontal margin size. There is no margin by default.
4
+ */
5
+ marginHorizontal?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
6
+ /**
7
+ * Vertical margin size. There is no margin by default.
8
+ */
9
+ marginVertical?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
10
+ }
11
+ declare const Divider: ({ marginHorizontal, marginVertical }: DividerProps) => JSX.Element;
12
+ export default Divider;
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ThemeProvider, useTheme } from './styled-components';
1
+ import { ThemeProvider, useTheme } from 'styled-components-native';
2
2
  import theme, { getTheme } from './theme';
3
- import ExampleComponent from './components/ExampleComponent';
4
- export { theme, getTheme, useTheme, ThemeProvider, ExampleComponent };
3
+ import Divider from './components/Divider';
4
+ import Card from './components/Card';
5
+ export { theme, getTheme, useTheme, ThemeProvider, Divider, Card };
@@ -0,0 +1,2 @@
1
+ declare const FABPlayground: () => JSX.Element;
2
+ export default FABPlayground;
@@ -1,16 +1,16 @@
1
- import { StyleProp, ViewStyle } from 'react-native';
1
+ import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
2
  import { ReactElement } from 'react';
3
- interface BadgeProps {
3
+ interface BadgeProps extends ViewProps {
4
4
  /**
5
- * Content of the `Badge`.
5
+ * Content of the Badge.
6
6
  */
7
7
  content: string;
8
8
  /**
9
- * Visual intent color to apply to `Badge`.
9
+ * Visual intent color to apply to Badge.
10
10
  */
11
11
  intent?: 'success' | 'warning' | 'danger' | 'info';
12
12
  /**
13
- * Addditional style to be applied for `Badge`.
13
+ * Addditional style.
14
14
  */
15
15
  style?: StyleProp<ViewStyle>;
16
16
  /**
@@ -18,5 +18,5 @@ interface BadgeProps {
18
18
  */
19
19
  testID?: string;
20
20
  }
21
- declare const Badge: ({ content, intent, style, testID, }: BadgeProps) => ReactElement;
21
+ declare const Badge: ({ content, intent, style, testID, ...nativeProps }: BadgeProps) => ReactElement;
22
22
  export default Badge;
@@ -1,5 +1,18 @@
1
- import { ViewProps } from 'react-native';
1
+ import { ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
3
  interface CardProps extends ViewProps {
4
+ /**
5
+ * Card's content.
6
+ */
7
+ children?: ReactNode;
8
+ /**
9
+ * Addditional style.
10
+ */
11
+ style?: StyleProp<ViewStyle>;
12
+ /**
13
+ * Testing id of the component.
14
+ */
15
+ testID?: string;
3
16
  }
4
17
  declare const Card: (props: CardProps) => JSX.Element;
5
18
  export default Card;
@@ -1,4 +1,5 @@
1
- interface DividerProps {
1
+ import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
+ interface DividerProps extends ViewProps {
2
3
  /**
3
4
  * Horizontal margin size. There is no margin by default.
4
5
  */
@@ -7,6 +8,14 @@ interface DividerProps {
7
8
  * Vertical margin size. There is no margin by default.
8
9
  */
9
10
  marginVertical?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
11
+ /**
12
+ * Addditional style.
13
+ */
14
+ style?: StyleProp<ViewStyle>;
15
+ /**
16
+ * Testing id of the component.
17
+ */
18
+ testID?: string;
10
19
  }
11
- declare const Divider: ({ marginHorizontal, marginVertical }: DividerProps) => JSX.Element;
20
+ declare const Divider: ({ marginHorizontal, marginVertical, style, testID, ...nativeProps }: DividerProps) => JSX.Element;
12
21
  export default Divider;
@@ -0,0 +1,6 @@
1
+ import { IconProps } from '../Icon';
2
+ declare type Props = {
3
+ active?: boolean;
4
+ } & IconProps;
5
+ declare const AnimatedFABIcon: ({ active, ...iconProps }: Props) => JSX.Element;
6
+ export { AnimatedFABIcon };
@@ -0,0 +1,3 @@
1
+ import { TouchableHighlight, TouchableHighlightProps } from 'react-native';
2
+ declare const StyledFABContainer: import("styled-components").StyledComponent<typeof TouchableHighlight, import("../../theme").Theme, TouchableHighlightProps, never>;
3
+ export { StyledFABContainer };
@@ -0,0 +1,3 @@
1
+ import { IconProps } from '../Icon';
2
+ declare const StyledFABIcon: import("styled-components").StyledComponent<({ icon, style, size, intent, testID, }: IconProps) => JSX.Element, import("../../theme").Theme, IconProps, never>;
3
+ export { StyledFABIcon };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ import { IconProps } from '../Icon';
3
+ interface FABProps {
4
+ /**
5
+ * Name of the Icon.
6
+ */
7
+ icon: IconProps['icon'];
8
+ /**
9
+ * This function is called on pressing the button.
10
+ * */
11
+ onPress?: () => void;
12
+ /**
13
+ * Specify if the button is animated.
14
+ */
15
+ animated?: boolean;
16
+ /**
17
+ * Specify if the button is in active state. It only works if animated is true.
18
+ */
19
+ active?: boolean;
20
+ /**
21
+ * Addditional style.
22
+ */
23
+ style?: StyleProp<ViewStyle>;
24
+ /**
25
+ * Testing id of the component.
26
+ */
27
+ testID?: string;
28
+ }
29
+ declare const FAB: ({ onPress, icon, animated, testID, active, style }: FABProps) => JSX.Element;
30
+ export default FAB;
@@ -1,23 +1,23 @@
1
- import { StyleProp, ViewStyle } from 'react-native';
1
+ import { StyleProp, TextStyle } from 'react-native';
2
2
  import IconList from './IconList';
3
3
  declare type IconName = typeof IconList[number];
4
- interface IconProps {
4
+ export interface IconProps {
5
5
  /**
6
- * Name of the `Icon`.
6
+ * Name of the Icon.
7
7
  */
8
8
  icon: IconName;
9
9
  /**
10
- * Addditional style to be applied for `Icon`.
10
+ * Intent of the Icon.
11
11
  */
12
- style?: StyleProp<ViewStyle>;
12
+ intent?: 'text' | 'primary' | 'info' | 'danger' | 'success' | 'warning';
13
13
  /**
14
- * Size of the `Icon`.
14
+ * Size of the Icon.
15
15
  */
16
16
  size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
17
17
  /**
18
- * Intent of the `Icon`.
18
+ * Addditional style.
19
19
  */
20
- intent?: 'text' | 'primary' | 'info' | 'danger' | 'success' | 'warning';
20
+ style?: StyleProp<TextStyle>;
21
21
  /**
22
22
  * Testing id of the component.
23
23
  */
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { TextProps as NativeTextProps } from 'react-native';
2
+ import { TextProps as NativeTextProps, StyleProp, TextStyle } from 'react-native';
3
3
  interface TextProps extends NativeTextProps {
4
4
  /**
5
5
  * Text content.
@@ -17,6 +17,14 @@ interface TextProps extends NativeTextProps {
17
17
  * Visual intent color to apply to the text.
18
18
  */
19
19
  intent?: 'body' | 'subdued';
20
+ /**
21
+ * Addditional style.
22
+ */
23
+ style?: StyleProp<TextStyle>;
24
+ /**
25
+ * Testing id of the component.
26
+ */
27
+ testID?: string;
20
28
  }
21
29
  declare const Text: ({ children, fontSize, fontWeight, intent, ...nativeProps }: TextProps) => JSX.Element;
22
30
  export default Text;
@@ -1,8 +1,10 @@
1
1
  import { ThemeProvider, useTheme } from 'styled-components-native';
2
2
  import theme, { getTheme } from './theme';
3
+ import { scale } from './utils/scale';
3
4
  import Badge from './components/Badge';
4
5
  import Card from './components/Card';
5
6
  import Divider from './components/Divider';
6
7
  import Icon from './components/Icon';
7
8
  import Typography from './components/Typography';
8
- export { theme, getTheme, useTheme, ThemeProvider, Badge, Card, Divider, Icon, Typography, };
9
+ import FAB from './components/FAB';
10
+ export { theme, getTheme, useTheme, scale, ThemeProvider, Badge, Card, Divider, Icon, Typography, FAB, };
@@ -10,7 +10,7 @@ declare const getDividerTheme: (theme: GlobalTheme) => {
10
10
  large: string;
11
11
  xlarge: string;
12
12
  };
13
- borderWiths: {
13
+ borderWidths: {
14
14
  default: string;
15
15
  };
16
16
  };
@@ -0,0 +1,15 @@
1
+ import { GlobalTheme } from '../global';
2
+ declare const getFABTheme: (theme: GlobalTheme) => {
3
+ fontSizes: {
4
+ default: string;
5
+ };
6
+ colors: {
7
+ buttonBackground: string;
8
+ icon: string;
9
+ };
10
+ sizes: {
11
+ width: string;
12
+ height: string;
13
+ };
14
+ };
15
+ export default getFABTheme;
@@ -4,6 +4,7 @@ import getCardTheme from './components/card';
4
4
  import getDividerTheme from './components/divider';
5
5
  import getIconTheme from './components/icon';
6
6
  import getTypographyTheme from './components/typography';
7
+ import getFABTheme from './components/fab';
7
8
  declare type Theme = GlobalTheme & {
8
9
  __hd__: {
9
10
  badge: ReturnType<typeof getBadgeTheme>;
@@ -11,6 +12,7 @@ declare type Theme = GlobalTheme & {
11
12
  divider: ReturnType<typeof getDividerTheme>;
12
13
  icon: ReturnType<typeof getIconTheme>;
13
14
  typography: ReturnType<typeof getTypographyTheme>;
15
+ fab: ReturnType<typeof getFABTheme>;
14
16
  };
15
17
  };
16
18
  declare const getTheme: (theme?: GlobalTheme) => Theme;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const BASE_WIDTH = 390;
2
+ export declare const scale: (size: number) => number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { GlobalTheme } from '../global';
2
+ declare const getCardTheme: (theme: GlobalTheme) => {
3
+ radii: {
4
+ default: string;
5
+ };
6
+ padding: {
7
+ default: string;
8
+ };
9
+ };
10
+ export default getCardTheme;
@@ -0,0 +1,17 @@
1
+ import { GlobalTheme } from '../global';
2
+ declare const getDividerTheme: (theme: GlobalTheme) => {
3
+ colors: {
4
+ default: string;
5
+ };
6
+ space: {
7
+ xsmall: string;
8
+ small: string;
9
+ medium: string;
10
+ large: string;
11
+ xlarge: string;
12
+ };
13
+ borderWiths: {
14
+ default: string;
15
+ };
16
+ };
17
+ export default getDividerTheme;
@@ -0,0 +1,4 @@
1
+ declare const borderWidths: {
2
+ base: number;
3
+ };
4
+ export { borderWidths };
@@ -16,9 +16,11 @@ declare const systemPalette: {
16
16
  warningDark: string;
17
17
  warningBackground: string;
18
18
  platformBackground: string;
19
+ backgroundLight: string;
19
20
  backgroundDark: string;
20
21
  text: string;
21
22
  disabledText: string;
22
23
  invertedText: string;
24
+ outline: string;
23
25
  };
24
26
  export { palette, systemPalette };
@@ -16,10 +16,12 @@ declare const globalTheme: {
16
16
  warningDark: string;
17
17
  warningBackground: string;
18
18
  platformBackground: string;
19
+ backgroundLight: string;
19
20
  backgroundDark: string;
20
21
  text: string;
21
22
  disabledText: string;
22
23
  invertedText: string;
24
+ outline: string;
23
25
  };
24
26
  space: {
25
27
  xxsmall: number;
@@ -52,6 +54,9 @@ declare const globalTheme: {
52
54
  small: number;
53
55
  xsmall: number;
54
56
  };
57
+ borderWidths: {
58
+ base: number;
59
+ };
55
60
  };
56
61
  declare type GlobalTheme = typeof globalTheme;
57
62
  export { GlobalTheme };
@@ -1,8 +1,10 @@
1
1
  import { GlobalTheme } from './global';
2
- import getExampleComponentTheme from './components/exampleComponent';
2
+ import getDividerTheme from './components/divider';
3
+ import getCardTheme from './components/card';
3
4
  declare type Theme = GlobalTheme & {
4
5
  __hd__: {
5
- exampleComponent: ReturnType<typeof getExampleComponentTheme>;
6
+ divider: ReturnType<typeof getDividerTheme>;
7
+ card: ReturnType<typeof getCardTheme>;
6
8
  };
7
9
  };
8
10
  declare const getTheme: (theme?: GlobalTheme) => Theme;
@@ -1,24 +0,0 @@
1
- import { palette } from '@hero-design/colors';
2
- declare const systemPalette: {
3
- primary: string;
4
- primaryLight: string;
5
- info: string;
6
- infoLight: string;
7
- infoBackground: string;
8
- success: string;
9
- successDark: string;
10
- successLight: string;
11
- successBackground: string;
12
- danger: string;
13
- dangerLight: string;
14
- dangerBackground: string;
15
- warning: string;
16
- warningDark: string;
17
- warningBackground: string;
18
- platformBackground: string;
19
- backgroundDark: string;
20
- text: string;
21
- disabledText: string;
22
- invertedText: string;
23
- };
24
- export { palette, systemPalette };
@@ -1,11 +0,0 @@
1
- declare const demoStyleColors: {
2
- primaryBg: string;
3
- dangerBg: string;
4
- warningBg: string;
5
- };
6
- declare const demoStyleSpace: {
7
- smallMargin: number;
8
- mediumMargin: number;
9
- largeMargin: number;
10
- };
11
- export { demoStyleColors, demoStyleSpace };
@@ -1,12 +0,0 @@
1
- declare const space: {
2
- xxsmall: number;
3
- xsmall: number;
4
- small: number;
5
- medium: number;
6
- large: number;
7
- xlarge: number;
8
- xxlarge: number;
9
- xxxlarge: number;
10
- xxxxlarge: number;
11
- };
12
- export { space };
@@ -1,21 +0,0 @@
1
- declare const fontSizes: {
2
- xlarge: number;
3
- large: number;
4
- medium: number;
5
- small: number;
6
- xsmall: number;
7
- };
8
- declare const fontWeights: {
9
- light: number;
10
- regular: number;
11
- semiBold: number;
12
- bold: number;
13
- };
14
- declare const lineHeights: {
15
- xlarge: number;
16
- large: number;
17
- medium: number;
18
- small: number;
19
- xsmall: number;
20
- };
21
- export { fontSizes, fontWeights, lineHeights };