@hoddy-ui/next 2.0.35 → 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
@@ -324,14 +324,22 @@ type predictionType = {
324
324
  id: string;
325
325
  description: string;
326
326
  };
327
- declare const getPredictionsFromCoords: (coords: any) => Promise<{
327
+ declare const getPredictionsFromCoords: (coords: {
328
+ latitude: number;
329
+ longitude: number;
330
+ }) => Promise<{
328
331
  description: any;
329
332
  id: any;
330
333
  latLng: {
331
- lst: any;
332
- lng: any;
334
+ lst: number;
335
+ lng: number;
333
336
  };
334
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>;
335
343
  declare const Locator: React.FC<LocatorProps>;
336
344
 
337
345
  declare const Popup: React.FC<PopupProps>;
@@ -611,4 +619,4 @@ declare const HoddyUI: {
611
619
  initialize: typeof initialize;
612
620
  };
613
621
 
614
- 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, getPredictionsFromCoords, type locatorLocation, type predictionType, 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
@@ -324,14 +324,22 @@ type predictionType = {
324
324
  id: string;
325
325
  description: string;
326
326
  };
327
- declare const getPredictionsFromCoords: (coords: any) => Promise<{
327
+ declare const getPredictionsFromCoords: (coords: {
328
+ latitude: number;
329
+ longitude: number;
330
+ }) => Promise<{
328
331
  description: any;
329
332
  id: any;
330
333
  latLng: {
331
- lst: any;
332
- lng: any;
334
+ lst: number;
335
+ lng: number;
333
336
  };
334
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>;
335
343
  declare const Locator: React.FC<LocatorProps>;
336
344
 
337
345
  declare const Popup: React.FC<PopupProps>;
@@ -611,4 +619,4 @@ declare const HoddyUI: {
611
619
  initialize: typeof initialize;
612
620
  };
613
621
 
614
- 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, getPredictionsFromCoords, type locatorLocation, type predictionType, 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,