@hoddy-ui/core 2.5.43 → 2.5.46

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/index.ts CHANGED
@@ -3,7 +3,6 @@ import { initialize } from "./src/config";
3
3
  // Components
4
4
  export { default as AdaptiveStatusBar } from "./src/Components/AdaptiveStatusBar";
5
5
  export { default as AlertX } from "./src/Components/AlertX";
6
- export * from "./src/Components/Animators/Animator";
7
6
  export { default as Avatar } from "./src/Components/Avatar";
8
7
  export * from "./src/Components/Button";
9
8
  export { default as Button } from "./src/Components/Button";
@@ -25,9 +24,9 @@ export { default as Typography } from "./src/Components/Typography";
25
24
 
26
25
  // Animation hooks
27
26
  export * from "./src/Components/Animators/hooks";
27
+ export * from "./src/Components/Animators/Animator";
28
28
 
29
29
  // Others
30
- // export * from "./src/config";
31
30
  export * from "./src/hooks";
32
31
  export * from "./src/theme";
33
32
 
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
- import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ScrollView, TextInput } from 'react-native';
2
+ import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ViewProps, ScrollView, View, TextInput } from 'react-native';
3
3
 
4
4
  type ThemeTypes = "dark" | "light";
5
5
  type ThemeModes = "dark" | "light" | "default";
@@ -231,6 +231,7 @@ interface TypographyProps extends TextProps {
231
231
  color?: colorTypes | (string & {});
232
232
  style?: StyleProp<TextStyle | ViewStyle>;
233
233
  textCase?: "capitalize" | "uppercase" | "lowercase" | undefined;
234
+ lineHeight?: number;
234
235
  variant?: "caption" | "body1" | "body2" | "h6" | "h5" | "h4" | "h3" | "h2" | "h1";
235
236
  align?: "center" | "left" | "right";
236
237
  gutterBottom?: number;
@@ -240,9 +241,8 @@ interface TypographyProps extends TextProps {
240
241
  fontSize?: number;
241
242
  fontWeight?: 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
242
243
  }
243
- interface SafeAreaViewProps {
244
+ interface SafeAreaViewProps extends ViewProps {
244
245
  children: ReactNode;
245
- style?: ViewStyle;
246
246
  }
247
247
  interface SelectMenuProps {
248
248
  open: boolean;
@@ -438,7 +438,7 @@ declare const Locator: React.FC<LocatorProps>;
438
438
 
439
439
  declare const Popup: React.FC<PopupProps>;
440
440
 
441
- declare const SafeAreaView: React.FC<SafeAreaViewProps>;
441
+ declare const SafeAreaView: React.ForwardRefExoticComponent<SafeAreaViewProps & React.RefAttributes<View>>;
442
442
 
443
443
  declare const Divider: FC<DividerProps>;
444
444
 
@@ -713,8 +713,156 @@ declare const useNavScreenOptions: (type: "stack" | "tab" | "drawer") => any;
713
713
  declare const UIThemeContext: React.Context<ThemeContext>;
714
714
  declare const UIThemeProvider: ({ children }: ThemeProviderProps) => React.JSX.Element;
715
715
 
716
+ declare const useAppState: () => {
717
+ isActive: boolean;
718
+ };
719
+
720
+ interface UseBlinkAnimationProps {
721
+ delay?: number;
722
+ blinkDuration?: number;
723
+ minOpacity?: number;
724
+ maxOpacity?: number;
725
+ }
726
+ declare const useBlinkAnimation: ({ delay, blinkDuration, minOpacity, maxOpacity, }?: UseBlinkAnimationProps) => {
727
+ animatedStyle: {
728
+ opacity: number;
729
+ };
730
+ };
731
+
732
+ interface UseFadeAnimationProps {
733
+ duration?: number;
734
+ delay?: number;
735
+ closeAfter?: number | null;
736
+ }
737
+ declare const useFadeAnimation: ({ duration, delay, closeAfter, }?: UseFadeAnimationProps) => {
738
+ animatedStyle: {
739
+ opacity: number;
740
+ };
741
+ };
742
+
743
+ interface UseFloatAnimationProps {
744
+ duration?: number;
745
+ delay?: number;
746
+ closeAfter?: number | null;
747
+ closeDuration?: number;
748
+ floatDistance?: number;
749
+ floatDuration?: number;
750
+ }
751
+ declare const useFloatAnimation: ({ duration, delay, closeAfter, closeDuration, floatDistance, floatDuration, }?: UseFloatAnimationProps) => {
752
+ animatedStyle: {
753
+ opacity: number;
754
+ transform: {
755
+ translateY: number;
756
+ }[];
757
+ };
758
+ };
759
+
760
+ interface UseGrowAnimationProps {
761
+ duration?: number;
762
+ delay?: number;
763
+ closeAfter?: number | null;
764
+ initialScale?: number;
765
+ }
766
+ declare const useGrowAnimation: ({ duration, delay, closeAfter, initialScale, }?: UseGrowAnimationProps) => {
767
+ animatedStyle: {
768
+ transform: {
769
+ scale: number;
770
+ }[];
771
+ };
772
+ };
773
+
774
+ interface UseRollAnimationProps {
775
+ duration?: number;
776
+ delay?: number;
777
+ closeAfter?: number | null;
778
+ initialTranslateY?: number;
779
+ initialRotate?: string;
780
+ }
781
+ declare const useRollAnimation: ({ duration, delay, closeAfter, initialTranslateY, initialRotate, }?: UseRollAnimationProps) => {
782
+ animatedStyle: {
783
+ transform: ({
784
+ translateY: number;
785
+ rotate?: undefined;
786
+ } | {
787
+ rotate: string;
788
+ translateY?: undefined;
789
+ })[];
790
+ };
791
+ };
792
+
793
+ interface UseSlideAnimationProps {
794
+ duration?: number;
795
+ delay?: number;
796
+ direction?: "up" | "down" | "left" | "right";
797
+ closeAfter?: number | null;
798
+ initialValue?: number;
799
+ }
800
+ declare const useSlideAnimation: ({ duration, delay, direction, closeAfter, initialValue, }?: UseSlideAnimationProps) => {
801
+ animatedStyle: {
802
+ transform: {
803
+ translateY: number;
804
+ }[];
805
+ } | {
806
+ transform: {
807
+ translateX: number;
808
+ }[];
809
+ };
810
+ };
811
+
812
+ interface UseThrownUpAnimationProps {
813
+ delay?: number;
814
+ closeAfter?: number | null;
815
+ }
816
+ declare const useThrownUpAnimation: ({ delay, closeAfter, }?: UseThrownUpAnimationProps) => {
817
+ animatedStyle: {
818
+ transform: {
819
+ translateY: number;
820
+ }[];
821
+ opacity: number;
822
+ };
823
+ };
824
+
825
+ /**
826
+ * Unified Animator component that handles multiple animation types with type-safe props.
827
+ *
828
+ * Each animation type only accepts its relevant props, ensuring type safety and better developer experience.
829
+ *
830
+ * @example
831
+ * // Fade animation - only accepts base props
832
+ * <Animator type="fade" duration={1000} closeAfter={3000}>
833
+ * <Text>This will fade in and out</Text>
834
+ * </Animator>
835
+ *
836
+ * @example
837
+ * // Slide animation - only accepts direction and initialValue props
838
+ * <Animator type="slide" direction="up" duration={800} closeAfter={2000}>
839
+ * <View>This will slide up from bottom</View>
840
+ * </Animator>
841
+ *
842
+ * @example
843
+ * // Grow animation - only accepts initialScale prop
844
+ * <Animator type="grow" initialScale={0.5} duration={600}>
845
+ * <Button>This will grow from 50% scale</Button>
846
+ * </Animator>
847
+ *
848
+ * @example
849
+ * // Blink animation - only accepts blink-specific props
850
+ * <Animator type="blink" blinkDuration={1000} minOpacity={0.3}>
851
+ * <Icon>This will blink continuously</Icon>
852
+ * </Animator>
853
+ *
854
+ * @example
855
+ * // TypeScript will show errors for invalid prop combinations:
856
+ * // ❌ This will cause a TypeScript error:
857
+ * // <Animator type="fade" direction="up"> // direction is not valid for fade
858
+ * //
859
+ * // ✅ This is correct:
860
+ * // <Animator type="slide" direction="up">
861
+ */
862
+ declare const Animator: FC<AnimatorProps>;
863
+
716
864
  declare const HoddyUI: {
717
865
  initialize: typeof initialize;
718
866
  };
719
867
 
720
- export { AdaptiveStatusBar, AlertX, type AlertXProps, type AnimationType, type AnimatorProps, Avatar, type AvatarProps, Button, type ButtonProps, CheckBox, type CheckboxProps, Divider, type DividerProps, type FlashMessageProps, FormWrapper, type FormWrapperProps, Grid, GridItem, type GridItemProps, type GridProps, IconButton, type IconButtonProps, LinkButton, type LinkButtonProps, type ListItemProps, type ListItemTextProps, type ListProps, Locator, type LocatorInputProps, type LocatorProps, OTPInput, type OTPInputProps, Popup, type PopupProps, RatingInput, type RatingInputProps, RatingStars, type RatingStarsProps, SafeAreaView, type SafeAreaViewProps, SelectMenu, type SelectMenuProps, Spinner, type SpinnerProps, TextField, TextField2, type TextFieldProps, type ThemeActionTypes, type ThemeContext, type ThemeModes, type ThemeProviderProps, type ThemeState, type ThemeTypes, Typography, type TypographyProps, UIThemeContext, UIThemeProvider, type colorTypes, HoddyUI as default, type extraColorTypes, getLocationFromPlaceId, getPredictionsFromCoords, getPredictionsFromQuery, type locatorLocation, type predictionType, showFlashMessage, useColors, useNavScreenOptions, useTheme, useThemeContext };
868
+ export { AdaptiveStatusBar, AlertX, type AlertXProps, type AnimationType, Animator, type AnimatorProps, Avatar, type AvatarProps, Button, type ButtonProps, CheckBox, type CheckboxProps, Divider, type DividerProps, type FlashMessageProps, FormWrapper, type FormWrapperProps, Grid, GridItem, type GridItemProps, type GridProps, IconButton, type IconButtonProps, LinkButton, type LinkButtonProps, type ListItemProps, type ListItemTextProps, type ListProps, Locator, type LocatorInputProps, type LocatorProps, OTPInput, type OTPInputProps, Popup, type PopupProps, RatingInput, type RatingInputProps, RatingStars, type RatingStarsProps, SafeAreaView, type SafeAreaViewProps, SelectMenu, type SelectMenuProps, Spinner, type SpinnerProps, TextField, TextField2, type TextFieldProps, type ThemeActionTypes, type ThemeContext, type ThemeModes, type ThemeProviderProps, type ThemeState, type ThemeTypes, Typography, type TypographyProps, UIThemeContext, UIThemeProvider, type colorTypes, HoddyUI as default, type extraColorTypes, getLocationFromPlaceId, getPredictionsFromCoords, getPredictionsFromQuery, type locatorLocation, type predictionType, showFlashMessage, useAppState, useBlinkAnimation, useColors, useFadeAnimation, useFloatAnimation, useGrowAnimation, useNavScreenOptions, useRollAnimation, useSlideAnimation, useTheme, useThemeContext, useThrownUpAnimation };
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
- import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ScrollView, TextInput } from 'react-native';
2
+ import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ViewProps, ScrollView, View, TextInput } from 'react-native';
3
3
 
4
4
  type ThemeTypes = "dark" | "light";
5
5
  type ThemeModes = "dark" | "light" | "default";
@@ -231,6 +231,7 @@ interface TypographyProps extends TextProps {
231
231
  color?: colorTypes | (string & {});
232
232
  style?: StyleProp<TextStyle | ViewStyle>;
233
233
  textCase?: "capitalize" | "uppercase" | "lowercase" | undefined;
234
+ lineHeight?: number;
234
235
  variant?: "caption" | "body1" | "body2" | "h6" | "h5" | "h4" | "h3" | "h2" | "h1";
235
236
  align?: "center" | "left" | "right";
236
237
  gutterBottom?: number;
@@ -240,9 +241,8 @@ interface TypographyProps extends TextProps {
240
241
  fontSize?: number;
241
242
  fontWeight?: 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
242
243
  }
243
- interface SafeAreaViewProps {
244
+ interface SafeAreaViewProps extends ViewProps {
244
245
  children: ReactNode;
245
- style?: ViewStyle;
246
246
  }
247
247
  interface SelectMenuProps {
248
248
  open: boolean;
@@ -438,7 +438,7 @@ declare const Locator: React.FC<LocatorProps>;
438
438
 
439
439
  declare const Popup: React.FC<PopupProps>;
440
440
 
441
- declare const SafeAreaView: React.FC<SafeAreaViewProps>;
441
+ declare const SafeAreaView: React.ForwardRefExoticComponent<SafeAreaViewProps & React.RefAttributes<View>>;
442
442
 
443
443
  declare const Divider: FC<DividerProps>;
444
444
 
@@ -713,8 +713,156 @@ declare const useNavScreenOptions: (type: "stack" | "tab" | "drawer") => any;
713
713
  declare const UIThemeContext: React.Context<ThemeContext>;
714
714
  declare const UIThemeProvider: ({ children }: ThemeProviderProps) => React.JSX.Element;
715
715
 
716
+ declare const useAppState: () => {
717
+ isActive: boolean;
718
+ };
719
+
720
+ interface UseBlinkAnimationProps {
721
+ delay?: number;
722
+ blinkDuration?: number;
723
+ minOpacity?: number;
724
+ maxOpacity?: number;
725
+ }
726
+ declare const useBlinkAnimation: ({ delay, blinkDuration, minOpacity, maxOpacity, }?: UseBlinkAnimationProps) => {
727
+ animatedStyle: {
728
+ opacity: number;
729
+ };
730
+ };
731
+
732
+ interface UseFadeAnimationProps {
733
+ duration?: number;
734
+ delay?: number;
735
+ closeAfter?: number | null;
736
+ }
737
+ declare const useFadeAnimation: ({ duration, delay, closeAfter, }?: UseFadeAnimationProps) => {
738
+ animatedStyle: {
739
+ opacity: number;
740
+ };
741
+ };
742
+
743
+ interface UseFloatAnimationProps {
744
+ duration?: number;
745
+ delay?: number;
746
+ closeAfter?: number | null;
747
+ closeDuration?: number;
748
+ floatDistance?: number;
749
+ floatDuration?: number;
750
+ }
751
+ declare const useFloatAnimation: ({ duration, delay, closeAfter, closeDuration, floatDistance, floatDuration, }?: UseFloatAnimationProps) => {
752
+ animatedStyle: {
753
+ opacity: number;
754
+ transform: {
755
+ translateY: number;
756
+ }[];
757
+ };
758
+ };
759
+
760
+ interface UseGrowAnimationProps {
761
+ duration?: number;
762
+ delay?: number;
763
+ closeAfter?: number | null;
764
+ initialScale?: number;
765
+ }
766
+ declare const useGrowAnimation: ({ duration, delay, closeAfter, initialScale, }?: UseGrowAnimationProps) => {
767
+ animatedStyle: {
768
+ transform: {
769
+ scale: number;
770
+ }[];
771
+ };
772
+ };
773
+
774
+ interface UseRollAnimationProps {
775
+ duration?: number;
776
+ delay?: number;
777
+ closeAfter?: number | null;
778
+ initialTranslateY?: number;
779
+ initialRotate?: string;
780
+ }
781
+ declare const useRollAnimation: ({ duration, delay, closeAfter, initialTranslateY, initialRotate, }?: UseRollAnimationProps) => {
782
+ animatedStyle: {
783
+ transform: ({
784
+ translateY: number;
785
+ rotate?: undefined;
786
+ } | {
787
+ rotate: string;
788
+ translateY?: undefined;
789
+ })[];
790
+ };
791
+ };
792
+
793
+ interface UseSlideAnimationProps {
794
+ duration?: number;
795
+ delay?: number;
796
+ direction?: "up" | "down" | "left" | "right";
797
+ closeAfter?: number | null;
798
+ initialValue?: number;
799
+ }
800
+ declare const useSlideAnimation: ({ duration, delay, direction, closeAfter, initialValue, }?: UseSlideAnimationProps) => {
801
+ animatedStyle: {
802
+ transform: {
803
+ translateY: number;
804
+ }[];
805
+ } | {
806
+ transform: {
807
+ translateX: number;
808
+ }[];
809
+ };
810
+ };
811
+
812
+ interface UseThrownUpAnimationProps {
813
+ delay?: number;
814
+ closeAfter?: number | null;
815
+ }
816
+ declare const useThrownUpAnimation: ({ delay, closeAfter, }?: UseThrownUpAnimationProps) => {
817
+ animatedStyle: {
818
+ transform: {
819
+ translateY: number;
820
+ }[];
821
+ opacity: number;
822
+ };
823
+ };
824
+
825
+ /**
826
+ * Unified Animator component that handles multiple animation types with type-safe props.
827
+ *
828
+ * Each animation type only accepts its relevant props, ensuring type safety and better developer experience.
829
+ *
830
+ * @example
831
+ * // Fade animation - only accepts base props
832
+ * <Animator type="fade" duration={1000} closeAfter={3000}>
833
+ * <Text>This will fade in and out</Text>
834
+ * </Animator>
835
+ *
836
+ * @example
837
+ * // Slide animation - only accepts direction and initialValue props
838
+ * <Animator type="slide" direction="up" duration={800} closeAfter={2000}>
839
+ * <View>This will slide up from bottom</View>
840
+ * </Animator>
841
+ *
842
+ * @example
843
+ * // Grow animation - only accepts initialScale prop
844
+ * <Animator type="grow" initialScale={0.5} duration={600}>
845
+ * <Button>This will grow from 50% scale</Button>
846
+ * </Animator>
847
+ *
848
+ * @example
849
+ * // Blink animation - only accepts blink-specific props
850
+ * <Animator type="blink" blinkDuration={1000} minOpacity={0.3}>
851
+ * <Icon>This will blink continuously</Icon>
852
+ * </Animator>
853
+ *
854
+ * @example
855
+ * // TypeScript will show errors for invalid prop combinations:
856
+ * // ❌ This will cause a TypeScript error:
857
+ * // <Animator type="fade" direction="up"> // direction is not valid for fade
858
+ * //
859
+ * // ✅ This is correct:
860
+ * // <Animator type="slide" direction="up">
861
+ */
862
+ declare const Animator: FC<AnimatorProps>;
863
+
716
864
  declare const HoddyUI: {
717
865
  initialize: typeof initialize;
718
866
  };
719
867
 
720
- export { AdaptiveStatusBar, AlertX, type AlertXProps, type AnimationType, type AnimatorProps, Avatar, type AvatarProps, Button, type ButtonProps, CheckBox, type CheckboxProps, Divider, type DividerProps, type FlashMessageProps, FormWrapper, type FormWrapperProps, Grid, GridItem, type GridItemProps, type GridProps, IconButton, type IconButtonProps, LinkButton, type LinkButtonProps, type ListItemProps, type ListItemTextProps, type ListProps, Locator, type LocatorInputProps, type LocatorProps, OTPInput, type OTPInputProps, Popup, type PopupProps, RatingInput, type RatingInputProps, RatingStars, type RatingStarsProps, SafeAreaView, type SafeAreaViewProps, SelectMenu, type SelectMenuProps, Spinner, type SpinnerProps, TextField, TextField2, type TextFieldProps, type ThemeActionTypes, type ThemeContext, type ThemeModes, type ThemeProviderProps, type ThemeState, type ThemeTypes, Typography, type TypographyProps, UIThemeContext, UIThemeProvider, type colorTypes, HoddyUI as default, type extraColorTypes, getLocationFromPlaceId, getPredictionsFromCoords, getPredictionsFromQuery, type locatorLocation, type predictionType, showFlashMessage, useColors, useNavScreenOptions, useTheme, useThemeContext };
868
+ export { AdaptiveStatusBar, AlertX, type AlertXProps, type AnimationType, Animator, type AnimatorProps, Avatar, type AvatarProps, Button, type ButtonProps, CheckBox, type CheckboxProps, Divider, type DividerProps, type FlashMessageProps, FormWrapper, type FormWrapperProps, Grid, GridItem, type GridItemProps, type GridProps, IconButton, type IconButtonProps, LinkButton, type LinkButtonProps, type ListItemProps, type ListItemTextProps, type ListProps, Locator, type LocatorInputProps, type LocatorProps, OTPInput, type OTPInputProps, Popup, type PopupProps, RatingInput, type RatingInputProps, RatingStars, type RatingStarsProps, SafeAreaView, type SafeAreaViewProps, SelectMenu, type SelectMenuProps, Spinner, type SpinnerProps, TextField, TextField2, type TextFieldProps, type ThemeActionTypes, type ThemeContext, type ThemeModes, type ThemeProviderProps, type ThemeState, type ThemeTypes, Typography, type TypographyProps, UIThemeContext, UIThemeProvider, type colorTypes, HoddyUI as default, type extraColorTypes, getLocationFromPlaceId, getPredictionsFromCoords, getPredictionsFromQuery, type locatorLocation, type predictionType, showFlashMessage, useAppState, useBlinkAnimation, useColors, useFadeAnimation, useFloatAnimation, useGrowAnimation, useNavScreenOptions, useRollAnimation, useSlideAnimation, useTheme, useThemeContext, useThrownUpAnimation };