@omnic/widget-locations 1.1.80 → 1.1.82

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.
@@ -1,5 +1,18 @@
1
- import type { FC, ReactNode, RefObject } from "react";
1
+ import type { ChangeEvent, FC, ReactNode, RefObject } from "react";
2
2
  import type { UsePlaceAutocompleteReturn } from '../../hooks/usePlaceAutocomplete';
3
+ /** Props passed to custom input when using render prop. */
4
+ export interface PlaceAutocompleteInputProps {
5
+ value: string;
6
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
7
+ inputRef?: RefObject<HTMLInputElement>;
8
+ onFocus?: () => void;
9
+ onBlur?: () => void;
10
+ onClick?: () => void;
11
+ placeholder?: string;
12
+ name?: string;
13
+ label?: string;
14
+ endAdornment?: ReactNode;
15
+ }
3
16
  interface PlaceAutocompleteProps {
4
17
  autocomplete: UsePlaceAutocompleteReturn;
5
18
  className?: string;
@@ -11,6 +24,8 @@ interface PlaceAutocompleteProps {
11
24
  onClick?: () => void;
12
25
  onFocus?: () => void;
13
26
  onBlur?: () => void;
27
+ /** Custom input. If not provided, default Input is used. */
28
+ children?: (props: PlaceAutocompleteInputProps) => ReactNode;
14
29
  }
15
30
  export declare const PlaceAutocomplete: FC<PlaceAutocompleteProps>;
16
31
  export {};
@@ -1 +1,2 @@
1
1
  export { PlaceAutocomplete } from "./PlaceAutocomplete";
2
+ export type { PlaceAutocompleteInputProps } from "./PlaceAutocomplete";
@@ -1 +1,3 @@
1
- export declare const MapPlaceholder: () => import("react/jsx-runtime").JSX.Element;
1
+ import type { FC } from "react";
2
+ import type { MapPlaceholderProps } from "./types";
3
+ export declare const MapPlaceholder: FC<MapPlaceholderProps>;
@@ -1 +1,2 @@
1
1
  export { MapPlaceholder } from "./MapPlaceholder";
2
+ export type { MapPlaceholderProps } from "./types";
@@ -0,0 +1,4 @@
1
+ import type { MapPlaceholderConfig } from "../../type";
2
+ export interface MapPlaceholderProps {
3
+ config?: MapPlaceholderConfig;
4
+ }
@@ -1,17 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import type { WidgetConfig, WidgetOptions } from '../../types/config';
3
+ import type { Locale } from '../../types/i18n';
3
4
  import type { LocationPoint } from '../../types/points';
4
5
  export type OnSamePointsClick = (data: LocationPoint[]) => void;
5
6
  export interface LaunchConfig {
6
7
  options: WidgetOptions;
7
8
  config: WidgetConfig;
8
9
  }
9
- export type DynamicConfig = Omit<WidgetConfig, "INN" | "gMapKey" | "map">;
10
+ export type MapPlaceholderConfig = Pick<WidgetConfig, "cityName" | "country" | "countryAbbreviation" | "disableDelivery" | "disableGeolocation" | "globalSearch" | "handlers" | "hideCloseButtonOnLocationScreen" | "hideDeliveryTime" | "hideDetails" | "hideFilters" | "hideHeader" | "hideLogo" | "hideMapControls" | "hideSearchInput" | "onCloseLocationSelector" | "onLocationSelect" | "onPointClick" | "onSamePointsClusterClick" | "onWarehouseSelect" | "warehouseSelection" | "skipPointInfo" | "regionName" | "inputs" | "startScreen">;
10
11
  export interface WidgetLocationsContextValue {
11
12
  widgetOutHolderRef: React.RefObject<HTMLDivElement>;
12
13
  widgetLocationsRef: React.RefObject<HTMLDivElement>;
13
14
  launchWidget: (params: LaunchConfig) => void;
14
- setDynamicConfig: (params: DynamicConfig) => void;
15
+ setLocale: (locale: Locale) => void;
16
+ setMapPlaceholderConfig: (config: MapPlaceholderConfig | undefined) => void;
15
17
  }
16
18
  export interface WidgetLocationsContextProps {
17
19
  children: React.ReactNode;
@@ -14,3 +14,5 @@ export * from "./types/points";
14
14
  export * from "./types/regions";
15
15
  export * from "./context/WidgetLocations";
16
16
  export * from "./context/WidgetLocations/components/MapPlaceholder";
17
+ export * from "./components/PlaceAutocomplete";
18
+ export * from "./hooks/usePlaceAutocomplete";