@hero-design/rn 8.10.0 → 8.11.1

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 (37) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +293 -82
  3. package/lib/index.js +293 -82
  4. package/package.json +5 -5
  5. package/src/components/Card/index.tsx +1 -1
  6. package/src/components/Carousel/CardCarousel.tsx +218 -0
  7. package/src/components/Carousel/StyledCardCarousel.tsx +40 -0
  8. package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +105 -0
  9. package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +38 -0
  10. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +289 -0
  11. package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +109 -0
  12. package/src/components/Carousel/contants.ts +10 -0
  13. package/src/components/Carousel/index.tsx +4 -1
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +0 -1
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +0 -1
  16. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
  17. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
  18. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
  19. package/src/components/TextInput/StyledTextInput.tsx +1 -2
  20. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +5 -6
  21. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +6 -20
  22. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +0 -2
  23. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +0 -2
  24. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +24 -4
  25. package/src/theme/components/cardCarousel.ts +28 -0
  26. package/src/theme/components/textInput.ts +2 -6
  27. package/src/theme/getTheme.ts +3 -0
  28. package/src/types.ts +2 -0
  29. package/types/components/Card/index.d.ts +1 -1
  30. package/types/components/Carousel/CardCarousel.d.ts +40 -0
  31. package/types/components/Carousel/StyledCardCarousel.d.ts +31 -0
  32. package/types/components/Carousel/contants.d.ts +2 -0
  33. package/types/components/Carousel/index.d.ts +5 -3
  34. package/types/theme/components/cardCarousel.d.ts +25 -0
  35. package/types/theme/components/textInput.d.ts +1 -4
  36. package/types/theme/getTheme.d.ts +2 -0
  37. package/types/types.d.ts +2 -1
package/src/types.ts CHANGED
@@ -14,6 +14,7 @@ import type {
14
14
  } from './components/Select/types';
15
15
  import { SwipeableProps } from './components/Swipeable';
16
16
  import { TextProps } from './components/Typography/Text';
17
+ import { CardCarouselHandles } from './components/Carousel/CardCarousel';
17
18
 
18
19
  export type {
19
20
  BottomNavigationTabType,
@@ -30,4 +31,5 @@ export type {
30
31
  TextProps,
31
32
  TextInputHandles,
32
33
  Theme,
34
+ CardCarouselHandles,
33
35
  };
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
3
- interface CardProps extends ViewProps {
3
+ export interface CardProps extends ViewProps {
4
4
  /**
5
5
  * Card's content.
6
6
  */
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export declare type CardCarouselHandles = {
4
+ snapToIndex: (index: number) => void;
5
+ };
6
+ export interface CardCarouselProps {
7
+ /**
8
+ * Whether to scroll automatically.
9
+ */
10
+ autoPlay?: boolean;
11
+ /**
12
+ * Set interval of each slide.
13
+ */
14
+ autoPlayInterval?: number;
15
+ /**
16
+ * onItemIndexChange event handler receiving index of selected Item.
17
+ */
18
+ onItemIndexChange?: (index: number) => void;
19
+ /**
20
+ * Carousel data.
21
+ */
22
+ items: any[];
23
+ /**
24
+ * Indicates hide or show page control.
25
+ */
26
+ hidePageControl?: boolean;
27
+ /**
28
+ * Additional styles
29
+ */
30
+ style?: StyleProp<ViewStyle>;
31
+ /**
32
+ * Testing id of the component.
33
+ */
34
+ testID?: string;
35
+ /**
36
+ * Component ref.
37
+ */
38
+ ref?: React.Ref<CardCarouselHandles>;
39
+ }
40
+ export declare const CardCarousel: React.ForwardRefExoticComponent<Pick<CardCarouselProps, "style" | "testID" | "items" | "onItemIndexChange" | "hidePageControl" | "autoPlay" | "autoPlayInterval"> & React.RefAttributes<CardCarouselHandles>>;
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import { View, ViewProps } from 'react-native';
3
+ import { CardProps } from '../Card';
4
+ import { PageControlProps } from '../PageControl';
5
+ declare const StyledPageControl: import("@emotion/native").StyledComponent<PageControlProps & {
6
+ theme?: import("@emotion/react").Theme | undefined;
7
+ as?: import("react").ElementType<any> | undefined;
8
+ }, {}, {}>;
9
+ declare const StyledWrapper: import("@emotion/native").StyledComponent<ViewProps & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ as?: import("react").ElementType<any> | undefined;
12
+ }, {}, {
13
+ ref?: import("react").Ref<View> | undefined;
14
+ }>;
15
+ declare const StyledCard: import("@emotion/native").StyledComponent<CardProps & {
16
+ theme?: import("@emotion/react").Theme | undefined;
17
+ as?: import("react").ElementType<any> | undefined;
18
+ }, {}, {}>;
19
+ declare const StyledShadow: import("@emotion/native").StyledComponent<ViewProps & {
20
+ theme?: import("@emotion/react").Theme | undefined;
21
+ as?: import("react").ElementType<any> | undefined;
22
+ }, {}, {
23
+ ref?: import("react").Ref<View> | undefined;
24
+ }>;
25
+ declare const StyledItemWrapper: import("@emotion/native").StyledComponent<ViewProps & {
26
+ theme?: import("@emotion/react").Theme | undefined;
27
+ as?: import("react").ElementType<any> | undefined;
28
+ }, {}, {
29
+ ref?: import("react").Ref<View> | undefined;
30
+ }>;
31
+ export { StyledCard, StyledShadow, StyledItemWrapper, StyledWrapper, StyledPageControl, };
@@ -0,0 +1,2 @@
1
+ export declare const ITEM_WIDTH_RATE = 0.85;
2
+ export declare const VIEW_POSITION_CENTER = 0.5;
@@ -1,4 +1,4 @@
1
- import { Dispatch, SetStateAction } from 'react';
1
+ import React, { Dispatch, SetStateAction } from 'react';
2
2
  import { StyleProp, ViewProps, ViewStyle } from 'react-native';
3
3
  import { CarouselData } from './types';
4
4
  interface CarouselProps extends ViewProps {
@@ -32,5 +32,7 @@ interface CarouselProps extends ViewProps {
32
32
  selectedItemIndex?: number;
33
33
  }
34
34
  export declare function useStateFromProp<T>(initialValue: T): [T, Dispatch<SetStateAction<T>>];
35
- declare const Carousel: ({ items, onItemIndexChange, renderActions, selectedItemIndex, style, shouldShowPagination, ...nativeProps }: CarouselProps) => JSX.Element;
36
- export default Carousel;
35
+ declare const _default: (({ items, onItemIndexChange, renderActions, selectedItemIndex, style, shouldShowPagination, ...nativeProps }: CarouselProps) => JSX.Element) & {
36
+ Card: React.ForwardRefExoticComponent<Pick<import("./CardCarousel").CardCarouselProps, "style" | "testID" | "items" | "onItemIndexChange" | "hidePageControl" | "autoPlay" | "autoPlayInterval"> & React.RefAttributes<import("./CardCarousel").CardCarouselHandles>>;
37
+ };
38
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getCardCarouselTheme: (theme: GlobalTheme) => {
3
+ shadows: {
4
+ offset: {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ opacity: number;
9
+ radius: number;
10
+ elevation: number;
11
+ };
12
+ colors: {
13
+ shadow: string;
14
+ carouselItemBackground: string;
15
+ };
16
+ space: {
17
+ pageControlMarginTop: number;
18
+ carouselItemSpacing: number;
19
+ contentContainerPaddingHorizontal: number;
20
+ };
21
+ radii: {
22
+ card: number;
23
+ };
24
+ };
25
+ export default getCardCarouselTheme;
@@ -52,6 +52,7 @@ declare const getTextInputTheme: (theme: GlobalTheme) => {
52
52
  maxLengthLabelMarginLeft: number;
53
53
  errorAndHelpTextContainerPaddingLeft: number;
54
54
  containerMarginTop: number;
55
+ labelInsideTextInputMarginTop: number;
55
56
  };
56
57
  fontSizes: {
57
58
  text: number;
@@ -69,10 +70,6 @@ declare const getTextInputTheme: (theme: GlobalTheme) => {
69
70
  radii: {
70
71
  container: number;
71
72
  };
72
- lineHeights: {
73
- text: number;
74
- labelInsideTextInput: number;
75
- };
76
73
  sizes: {
77
74
  errorAndHelpTextContainerHeight: number;
78
75
  };
@@ -9,6 +9,7 @@ import getButtonTheme from './components/button';
9
9
  import getCalendarTheme from './components/calendar';
10
10
  import getCardTheme from './components/card';
11
11
  import getCarouselTheme from './components/carousel';
12
+ import getCardCarouselTheme from './components/cardCarousel';
12
13
  import getCheckboxTheme from './components/checkbox';
13
14
  import getContentNavigatorTheme from './components/contentNavigator';
14
15
  import getDatePickerTheme from './components/datePicker';
@@ -52,6 +53,7 @@ declare type Theme = GlobalTheme & {
52
53
  calendar: ReturnType<typeof getCalendarTheme>;
53
54
  card: ReturnType<typeof getCardTheme>;
54
55
  carousel: ReturnType<typeof getCarouselTheme>;
56
+ cardCarousel: ReturnType<typeof getCardCarouselTheme>;
55
57
  checkbox: ReturnType<typeof getCheckboxTheme>;
56
58
  contentNavigator: ReturnType<typeof getContentNavigatorTheme>;
57
59
  datePicker: ReturnType<typeof getDatePickerTheme>;
package/types/types.d.ts CHANGED
@@ -8,4 +8,5 @@ import type { Theme } from './theme';
8
8
  import type { ListRenderOptionInfo, SectionListRenderOptionInfo } from './components/Select/types';
9
9
  import { SwipeableProps } from './components/Swipeable';
10
10
  import { TextProps } from './components/Typography/Text';
11
- export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, };
11
+ import { CardCarouselHandles } from './components/Carousel/CardCarousel';
12
+ export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, CardCarouselHandles, };