@majoo-ui/react 1.62.2 → 1.62.4
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.esm.js +473 -373
- package/package.json +1 -1
- package/src/components/mapPicker/MapPicker.d.ts +0 -1
- package/src/components/mapPicker/components/AddressCard.d.ts +7 -0
- package/src/components/mapPicker/components/ButtonSelect.d.ts +7 -0
- package/src/components/mapPicker/components/ChangeView.d.ts +10 -0
- package/src/components/mapPicker/components/InputSearch.d.ts +3 -0
- package/src/components/mapPicker/components/MarkerIcon.d.ts +2 -0
- package/src/components/mapPicker/components/MarkerSvg.d.ts +2 -0
- package/src/components/mapPicker/components/ZoomControls.d.ts +7 -0
- package/src/components/mapPicker/components/index.d.ts +7 -0
- package/src/components/mapPicker/hooks/useMapSearch.d.ts +39 -0
- package/src/components/mapPicker/types/index.d.ts +36 -44
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { InputSearch } from './InputSearch';
|
|
2
|
+
export { ButtonSelect } from './ButtonSelect';
|
|
3
|
+
export { MarkerIcon } from './MarkerIcon';
|
|
4
|
+
export { ZoomControls } from './ZoomControls';
|
|
5
|
+
export { AddressCard } from './AddressCard';
|
|
6
|
+
export { ChangeView } from './ChangeView';
|
|
7
|
+
export { MarkerSvg } from './MarkerSvg';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ISearch } from '../types';
|
|
3
|
+
interface UseMapSearchOptions {
|
|
4
|
+
initialCenter?: {
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number;
|
|
7
|
+
};
|
|
8
|
+
showSelectButton?: boolean;
|
|
9
|
+
onChange?: (mapObject: any, shouldClose: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
interface UseMapSearchReturn {
|
|
12
|
+
center: {
|
|
13
|
+
lat: number;
|
|
14
|
+
lng: number;
|
|
15
|
+
};
|
|
16
|
+
setCenter: React.Dispatch<React.SetStateAction<{
|
|
17
|
+
lat: number;
|
|
18
|
+
lng: number;
|
|
19
|
+
}>>;
|
|
20
|
+
places: ISearch[];
|
|
21
|
+
searchQuery: string;
|
|
22
|
+
searchResult: ISearch[];
|
|
23
|
+
handleSearchChange: (e: {
|
|
24
|
+
target: {
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
}) => void;
|
|
28
|
+
handleSearchSelect: (item: ISearch) => Promise<void>;
|
|
29
|
+
handleSearchLatLng: (latLng: {
|
|
30
|
+
lat: number;
|
|
31
|
+
lng: number;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
getFullAddress: (latLng: {
|
|
34
|
+
lat: number;
|
|
35
|
+
lng: number;
|
|
36
|
+
}) => Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
export declare function useMapSearch({ initialCenter, showSelectButton, onChange, }: UseMapSearchOptions): UseMapSearchReturn;
|
|
39
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { CSS } from '../../../config/stitches.config';
|
|
2
3
|
export interface AddressComponents {
|
|
3
4
|
long_name: string;
|
|
@@ -21,13 +22,9 @@ export interface MapPickerProps {
|
|
|
21
22
|
*/
|
|
22
23
|
css?: CSS;
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Header content to display above the map (e.g., Banner).
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Custom banner description.
|
|
29
|
-
*/
|
|
30
|
-
bannerDescription?: string;
|
|
27
|
+
header?: React.ReactNode;
|
|
31
28
|
/**
|
|
32
29
|
* To binding current address.
|
|
33
30
|
* `{ lat: number, lng: number }`
|
|
@@ -36,11 +33,7 @@ export interface MapPickerProps {
|
|
|
36
33
|
/**
|
|
37
34
|
* Change event handler.
|
|
38
35
|
*/
|
|
39
|
-
onChange
|
|
40
|
-
/**
|
|
41
|
-
* Marker Click event handler.
|
|
42
|
-
*/
|
|
43
|
-
onMarkerClick?: () => void;
|
|
36
|
+
onChange?: (MapObject: any) => void;
|
|
44
37
|
/**
|
|
45
38
|
* Custom radius.
|
|
46
39
|
*/
|
|
@@ -49,12 +42,20 @@ export interface MapPickerProps {
|
|
|
49
42
|
* on Show select button.
|
|
50
43
|
*/
|
|
51
44
|
showSelectButton?: boolean;
|
|
52
|
-
}
|
|
53
|
-
export interface InputMapPickerProps {
|
|
54
45
|
/**
|
|
55
|
-
*
|
|
46
|
+
* Make map view-only (hide search, disable dragging).
|
|
56
47
|
*/
|
|
57
|
-
|
|
48
|
+
readOnly?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Custom text for select location button.
|
|
51
|
+
*/
|
|
52
|
+
selectLocationText?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Custom placeholder for search input.
|
|
55
|
+
*/
|
|
56
|
+
searchPlaceholder?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface InputMapPickerProps extends MapPickerProps {
|
|
58
59
|
/**
|
|
59
60
|
* Custom title of the modal.
|
|
60
61
|
*/
|
|
@@ -67,37 +68,28 @@ export interface InputMapPickerProps {
|
|
|
67
68
|
* Custom InputMap placeholder.
|
|
68
69
|
*/
|
|
69
70
|
placeholder?: string;
|
|
70
|
-
/**
|
|
71
|
-
* State to show or hide the banner.
|
|
72
|
-
*/
|
|
73
|
-
showBanner?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Custom banner description.
|
|
76
|
-
*/
|
|
77
|
-
bannerDescription?: string;
|
|
78
|
-
/**
|
|
79
|
-
* To binding current address.
|
|
80
|
-
* `{ lat: number, lng: number }`
|
|
81
|
-
*/
|
|
82
|
-
value?: LatLng;
|
|
83
|
-
/**
|
|
84
|
-
* Change event handler.
|
|
85
|
-
*/
|
|
86
|
-
onChange: (MapObject: any) => void;
|
|
87
|
-
/**
|
|
88
|
-
* on Marker click event handle
|
|
89
|
-
*/
|
|
90
|
-
onMarkerClick: () => void;
|
|
91
|
-
/**
|
|
92
|
-
* Custom radius.
|
|
93
|
-
*/
|
|
94
|
-
radius?: number;
|
|
95
|
-
/**
|
|
96
|
-
* on Show select button.
|
|
97
|
-
*/
|
|
98
|
-
showSelectButton?: boolean;
|
|
99
71
|
/**
|
|
100
72
|
* Custom input value.
|
|
101
73
|
*/
|
|
102
74
|
customInputValue?: string;
|
|
103
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Search result from OpenStreetMap Nominatim API.
|
|
78
|
+
*/
|
|
79
|
+
export interface ISearch {
|
|
80
|
+
place_id: number;
|
|
81
|
+
lat: string;
|
|
82
|
+
lon: string;
|
|
83
|
+
display_name: string;
|
|
84
|
+
address?: Record<string, string>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Props for InputSearch component.
|
|
88
|
+
*/
|
|
89
|
+
export interface InputSearchProps {
|
|
90
|
+
placeholder: string;
|
|
91
|
+
value: string;
|
|
92
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
93
|
+
onSelect: (item: ISearch) => void;
|
|
94
|
+
list: ISearch[];
|
|
95
|
+
}
|