@hoddy-ui/next 2.0.34 → 2.0.36

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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
2
  import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps } from 'react-native';
3
+ import * as index from 'index';
3
4
 
4
5
  type ThemeTypes = "dark" | "light";
5
6
  type ThemeModes = "dark" | "light" | "default";
@@ -24,6 +25,10 @@ type extraColorTypes = {
24
25
  };
25
26
  };
26
27
  };
28
+ interface ThemeActionTypes {
29
+ type: ThemeModes;
30
+ payload?: ThemeTypes;
31
+ }
27
32
  interface ThemeState {
28
33
  value: ThemeTypes;
29
34
  mode: ThemeModes;
@@ -51,6 +56,14 @@ interface AvatarProps {
51
56
  size?: number;
52
57
  style?: ViewStyle;
53
58
  }
59
+ interface AnimatorProps {
60
+ style?: ViewStyle;
61
+ duration?: number;
62
+ children: ReactNode;
63
+ delay?: number;
64
+ animationType?: "easeInEaseOut" | "linear" | "spring";
65
+ type?: "fade" | "slideInLeft" | "slideInRight" | "slideInUp" | "slideInDown";
66
+ }
54
67
  interface ButtonProps {
55
68
  color?: colorTypes;
56
69
  variant?: "text" | "outlined" | "contained";
@@ -133,6 +146,26 @@ interface LocatorProps {
133
146
  renderInput?: (props: LocatorInputProps) => ReactNode;
134
147
  country?: string;
135
148
  }
149
+ interface ListProps {
150
+ style?: ViewStyle;
151
+ children: ReactNode;
152
+ }
153
+ interface ListItemTextProps {
154
+ primary: string;
155
+ divider?: boolean;
156
+ primaryProps?: TypographyProps;
157
+ secondaryProps?: TypographyProps;
158
+ secondary?: string;
159
+ style?: ViewStyle;
160
+ }
161
+ interface ListItemProps {
162
+ link?: boolean;
163
+ divider?: boolean;
164
+ onPress?: () => void;
165
+ index?: number;
166
+ style?: ViewStyle;
167
+ children: ReactNode;
168
+ }
136
169
  interface FormWrapperProps {
137
170
  children: ReactNode;
138
171
  behavior?: "position" | "height" | "padding";
@@ -287,14 +320,26 @@ declare const RatingInput: FC<RatingInputProps>;
287
320
  declare const GridItem: React.FC<GridItemProps>;
288
321
  declare const Grid: React.FC<GridProps>;
289
322
 
290
- declare const getPredictionsFromCoords: (coords: any) => Promise<{
323
+ type predictionType = {
324
+ id: string;
325
+ description: string;
326
+ };
327
+ declare const getPredictionsFromCoords: (coords: {
328
+ latitude: number;
329
+ longitude: number;
330
+ }) => Promise<{
291
331
  description: any;
292
332
  id: any;
293
333
  latLng: {
294
- lst: any;
295
- lng: any;
334
+ lst: number;
335
+ lng: number;
296
336
  };
297
337
  }[]>;
338
+ declare const getPredictionsFromQuery: (query: string, country: string) => Promise<{
339
+ description: any;
340
+ id: any;
341
+ }[]>;
342
+ declare const getLocationFromPlaceId: (place_id: string) => Promise<any>;
298
343
  declare const Locator: React.FC<LocatorProps>;
299
344
 
300
345
  declare const Popup: React.FC<PopupProps>;
@@ -564,7 +609,7 @@ declare const useColors: () => {
564
609
  text: string;
565
610
  };
566
611
  };
567
- declare const useTheme: () => ThemeTypes;
612
+ declare const useTheme: () => index.ThemeTypes;
568
613
  declare const useNavScreenOptions: (type: "stack" | "tab" | "drawer") => any;
569
614
 
570
615
  declare const UIThemeContext: React.Context<ThemeContext>;
@@ -574,4 +619,4 @@ declare const HoddyUI: {
574
619
  initialize: typeof initialize;
575
620
  };
576
621
 
577
- export { AdaptiveStatusBar, AlertX, Avatar, Button, CheckBox, Divider, FormWrapper, Grid, GridItem, IconButton, LinkButton, Locator, OTPInput, Popup, RatingInput, RatingStars, SafeAreaView, SelectMenu, Spinner, TextField, TextField2, Typography, UIThemeContext, UIThemeProvider, HoddyUI as default, getPredictionsFromCoords, showFlashMessage, useColors, useNavScreenOptions, useTheme };
622
+ export { AdaptiveStatusBar, AlertX, type AlertXProps, 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
2
  import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps } from 'react-native';
3
+ import * as index from 'index';
3
4
 
4
5
  type ThemeTypes = "dark" | "light";
5
6
  type ThemeModes = "dark" | "light" | "default";
@@ -24,6 +25,10 @@ type extraColorTypes = {
24
25
  };
25
26
  };
26
27
  };
28
+ interface ThemeActionTypes {
29
+ type: ThemeModes;
30
+ payload?: ThemeTypes;
31
+ }
27
32
  interface ThemeState {
28
33
  value: ThemeTypes;
29
34
  mode: ThemeModes;
@@ -51,6 +56,14 @@ interface AvatarProps {
51
56
  size?: number;
52
57
  style?: ViewStyle;
53
58
  }
59
+ interface AnimatorProps {
60
+ style?: ViewStyle;
61
+ duration?: number;
62
+ children: ReactNode;
63
+ delay?: number;
64
+ animationType?: "easeInEaseOut" | "linear" | "spring";
65
+ type?: "fade" | "slideInLeft" | "slideInRight" | "slideInUp" | "slideInDown";
66
+ }
54
67
  interface ButtonProps {
55
68
  color?: colorTypes;
56
69
  variant?: "text" | "outlined" | "contained";
@@ -133,6 +146,26 @@ interface LocatorProps {
133
146
  renderInput?: (props: LocatorInputProps) => ReactNode;
134
147
  country?: string;
135
148
  }
149
+ interface ListProps {
150
+ style?: ViewStyle;
151
+ children: ReactNode;
152
+ }
153
+ interface ListItemTextProps {
154
+ primary: string;
155
+ divider?: boolean;
156
+ primaryProps?: TypographyProps;
157
+ secondaryProps?: TypographyProps;
158
+ secondary?: string;
159
+ style?: ViewStyle;
160
+ }
161
+ interface ListItemProps {
162
+ link?: boolean;
163
+ divider?: boolean;
164
+ onPress?: () => void;
165
+ index?: number;
166
+ style?: ViewStyle;
167
+ children: ReactNode;
168
+ }
136
169
  interface FormWrapperProps {
137
170
  children: ReactNode;
138
171
  behavior?: "position" | "height" | "padding";
@@ -287,14 +320,26 @@ declare const RatingInput: FC<RatingInputProps>;
287
320
  declare const GridItem: React.FC<GridItemProps>;
288
321
  declare const Grid: React.FC<GridProps>;
289
322
 
290
- declare const getPredictionsFromCoords: (coords: any) => Promise<{
323
+ type predictionType = {
324
+ id: string;
325
+ description: string;
326
+ };
327
+ declare const getPredictionsFromCoords: (coords: {
328
+ latitude: number;
329
+ longitude: number;
330
+ }) => Promise<{
291
331
  description: any;
292
332
  id: any;
293
333
  latLng: {
294
- lst: any;
295
- lng: any;
334
+ lst: number;
335
+ lng: number;
296
336
  };
297
337
  }[]>;
338
+ declare const getPredictionsFromQuery: (query: string, country: string) => Promise<{
339
+ description: any;
340
+ id: any;
341
+ }[]>;
342
+ declare const getLocationFromPlaceId: (place_id: string) => Promise<any>;
298
343
  declare const Locator: React.FC<LocatorProps>;
299
344
 
300
345
  declare const Popup: React.FC<PopupProps>;
@@ -564,7 +609,7 @@ declare const useColors: () => {
564
609
  text: string;
565
610
  };
566
611
  };
567
- declare const useTheme: () => ThemeTypes;
612
+ declare const useTheme: () => index.ThemeTypes;
568
613
  declare const useNavScreenOptions: (type: "stack" | "tab" | "drawer") => any;
569
614
 
570
615
  declare const UIThemeContext: React.Context<ThemeContext>;
@@ -574,4 +619,4 @@ declare const HoddyUI: {
574
619
  initialize: typeof initialize;
575
620
  };
576
621
 
577
- export { AdaptiveStatusBar, AlertX, Avatar, Button, CheckBox, Divider, FormWrapper, Grid, GridItem, IconButton, LinkButton, Locator, OTPInput, Popup, RatingInput, RatingStars, SafeAreaView, SelectMenu, Spinner, TextField, TextField2, Typography, UIThemeContext, UIThemeProvider, HoddyUI as default, getPredictionsFromCoords, showFlashMessage, useColors, useNavScreenOptions, useTheme };
622
+ export { AdaptiveStatusBar, AlertX, type AlertXProps, 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 };
package/dist/index.js CHANGED
@@ -55,7 +55,9 @@ __export(next_exports, {
55
55
  UIThemeContext: () => UIThemeContext,
56
56
  UIThemeProvider: () => UIThemeProvider,
57
57
  default: () => next_default,
58
+ getLocationFromPlaceId: () => getLocationFromPlaceId,
58
59
  getPredictionsFromCoords: () => getPredictionsFromCoords,
60
+ getPredictionsFromQuery: () => getPredictionsFromQuery,
59
61
  showFlashMessage: () => showFlashMessage,
60
62
  useColors: () => useColors,
61
63
  useNavScreenOptions: () => useNavScreenOptions,
@@ -1783,6 +1785,27 @@ var getPredictionsFromCoords = async (coords) => {
1783
1785
  }
1784
1786
  return p;
1785
1787
  };
1788
+ var getPredictionsFromQuery = async (query, country) => {
1789
+ const { GOOGLE_MAP_API_KEY } = getConfig();
1790
+ const endpoint = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}&components=country:${country}&radius=20000&key=${GOOGLE_MAP_API_KEY}`;
1791
+ const res = await (await fetch(endpoint)).json();
1792
+ const p = [];
1793
+ for (let key in res.predictions) {
1794
+ const { description, place_id } = res.predictions[key];
1795
+ p.push({
1796
+ description,
1797
+ id: place_id
1798
+ });
1799
+ }
1800
+ return p;
1801
+ };
1802
+ var getLocationFromPlaceId = async (place_id) => {
1803
+ const { GOOGLE_MAP_API_KEY } = getConfig();
1804
+ const res = await (await fetch(
1805
+ `https://maps.googleapis.com/maps/api/place/details/json?place_id=${place_id}&fields=formatted_address%2Cgeometry&key=${GOOGLE_MAP_API_KEY}`
1806
+ )).json();
1807
+ return res.result;
1808
+ };
1786
1809
  var Locator = ({
1787
1810
  variant = "contained",
1788
1811
  onLocationSelected,
@@ -1822,17 +1845,8 @@ var Locator = ({
1822
1845
  }
1823
1846
  });
1824
1847
  const search = async (query) => {
1825
- const endpoint = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}&components=country:${country}&radius=20000&key=${GOOGLE_MAP_API_KEY}`;
1826
- const res = await (await fetch(endpoint)).json();
1827
- const p = [];
1828
- for (let key in res.predictions) {
1829
- const { description, place_id } = res.predictions[key];
1830
- p.push({
1831
- description,
1832
- id: place_id
1833
- });
1834
- }
1835
- setPrediction(p);
1848
+ const predictions = await getPredictionsFromQuery(query, country);
1849
+ setPrediction(predictions);
1836
1850
  };
1837
1851
  const locateMe = () => {
1838
1852
  const getLoc = async () => {
@@ -1866,16 +1880,14 @@ var Locator = ({
1866
1880
  };
1867
1881
  const locationPressed = async (loc) => {
1868
1882
  setValue(loc.description);
1869
- const res = await (await fetch(
1870
- `https://maps.googleapis.com/maps/api/place/details/json?place_id=${loc.id}&fields=formatted_address%2Cgeometry&key=${GOOGLE_MAP_API_KEY}`
1871
- )).json();
1883
+ const res = await getLocationFromPlaceId(loc.id);
1872
1884
  onLocationSelected(
1873
1885
  {
1874
- latitude: res.result?.geometry.location.lat,
1875
- longitude: res.result?.geometry.location.lng,
1886
+ latitude: res.geometry.location.lat,
1887
+ longitude: res.geometry.location.lng,
1876
1888
  description: loc.description
1877
1889
  },
1878
- res.result?.formatted_address
1890
+ res?.formatted_address
1879
1891
  );
1880
1892
  setChanged(false);
1881
1893
  setPrediction([]);
@@ -2140,7 +2152,9 @@ var next_default = HoddyUI;
2140
2152
  Typography,
2141
2153
  UIThemeContext,
2142
2154
  UIThemeProvider,
2155
+ getLocationFromPlaceId,
2143
2156
  getPredictionsFromCoords,
2157
+ getPredictionsFromQuery,
2144
2158
  showFlashMessage,
2145
2159
  useColors,
2146
2160
  useNavScreenOptions,