@chayns-components/maps 5.0.0-beta.433

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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/lib/components/position-input/PositionInput.d.ts +42 -0
  4. package/lib/components/position-input/PositionInput.js +41 -0
  5. package/lib/components/position-input/PositionInput.js.map +1 -0
  6. package/lib/components/position-input/PositionInput.styles.d.ts +3 -0
  7. package/lib/components/position-input/PositionInput.styles.js +19 -0
  8. package/lib/components/position-input/PositionInput.styles.js.map +1 -0
  9. package/lib/components/position-input/map-wrapper/MapWrapper.d.ts +14 -0
  10. package/lib/components/position-input/map-wrapper/MapWrapper.js +179 -0
  11. package/lib/components/position-input/map-wrapper/MapWrapper.js.map +1 -0
  12. package/lib/components/position-input/map-wrapper/MapWrapper.styles.d.ts +2 -0
  13. package/lib/components/position-input/map-wrapper/MapWrapper.styles.js +12 -0
  14. package/lib/components/position-input/map-wrapper/MapWrapper.styles.js.map +1 -0
  15. package/lib/components/position-input/map-wrapper/map/Map.d.ts +16 -0
  16. package/lib/components/position-input/map-wrapper/map/Map.js +97 -0
  17. package/lib/components/position-input/map-wrapper/map/Map.js.map +1 -0
  18. package/lib/components/position-input/map-wrapper/map/Map.styles.d.ts +2 -0
  19. package/lib/components/position-input/map-wrapper/map/Map.styles.js +13 -0
  20. package/lib/components/position-input/map-wrapper/map/Map.styles.js.map +1 -0
  21. package/lib/components/position-input/map-wrapper/map/marker/Marker.d.ts +13 -0
  22. package/lib/components/position-input/map-wrapper/map/marker/Marker.js +66 -0
  23. package/lib/components/position-input/map-wrapper/map/marker/Marker.js.map +1 -0
  24. package/lib/constants/positionInput.d.ts +3 -0
  25. package/lib/constants/positionInput.js +24 -0
  26. package/lib/constants/positionInput.js.map +1 -0
  27. package/lib/hooks/positionInput.d.ts +2 -0
  28. package/lib/hooks/positionInput.js +37 -0
  29. package/lib/hooks/positionInput.js.map +1 -0
  30. package/lib/index.d.ts +2 -0
  31. package/lib/index.js +14 -0
  32. package/lib/index.js.map +1 -0
  33. package/lib/types/positionInput.d.ts +21 -0
  34. package/lib/types/positionInput.js +2 -0
  35. package/lib/types/positionInput.js.map +1 -0
  36. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Tobit Laboratories AG
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ <div align="center">
2
+ <h1>
3
+ <img src="https://raw.githubusercontent.com/TobitSoftware/chayns-components/master/assets/logo.png" width="600px" alt="chayns-components" />
4
+ </h1>
5
+ <p>A set of beautiful React components for developing your own applications with chayns.</p>
6
+ <div>
7
+ <img src="https://img.shields.io/npm/dm/@chayns-components/typewriter.svg?style=for-the-badge" alt="" />
8
+ <img src="https://img.shields.io/npm/v/@chayns-components/typewriter?style=for-the-badge" alt="" />
9
+ <img src="https://img.shields.io/github/license/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
10
+ <img src="https://img.shields.io/github/contributors/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
11
+ </div>
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## Installation
17
+
18
+ First you need to install the gallery part of the chayns-components.
19
+
20
+ ```bash
21
+ # NPM
22
+ npm install @chayns-components/maps
23
+
24
+ # Yarn
25
+ yarn add @chayns-components/maps
26
+ ```
27
+
28
+ > **Information:** Since the components have now been implemented with the styled-components
29
+ > library, the styles are delivered directly with the components. There is no need to load an extra
30
+ > stylesheet anymore.
31
+
32
+ ## Usage
33
+
34
+ For detailed usage visit the [storybook](https://components.chayns.site/storybook).
@@ -0,0 +1,42 @@
1
+ import { FC } from 'react';
2
+ import type { IMarker, PolygonOptions, Position } from '../../types/positionInput';
3
+ export type PositionInputProps = {
4
+ /**
5
+ * The api token for google maps.
6
+ */
7
+ apiToken: string;
8
+ /**
9
+ * The position of the center of the map on the initial render.
10
+ */
11
+ initialPosition?: Position;
12
+ /**
13
+ * Markers that should be displayed.
14
+ */
15
+ markers?: IMarker[];
16
+ /**
17
+ * Function to be executed when a marker is added.
18
+ */
19
+ onMarkerAdd: (marker: IMarker) => void;
20
+ /**
21
+ * Function to be executed when a marker position is changed.
22
+ */
23
+ onMarkerChange: (markers: IMarker[]) => void;
24
+ /**
25
+ * Function to be executed when a marker is removed.
26
+ */
27
+ onMarkerRemove: (id: number) => void;
28
+ /**
29
+ * Options to style the polygon.
30
+ */
31
+ polygonOptions?: PolygonOptions;
32
+ /**
33
+ * The placeholder of the search input.
34
+ */
35
+ searchPlaceholder?: string;
36
+ /**
37
+ * The zoom of the map.
38
+ */
39
+ zoom?: number;
40
+ };
41
+ declare const PositionInput: FC<PositionInputProps>;
42
+ export default PositionInput;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _PositionInput = require("./PositionInput.styles");
9
+ var _core = require("@chayns-components/core");
10
+ var _MapWrapper = _interopRequireDefault(require("./map-wrapper/MapWrapper"));
11
+ var _positionInput = require("../../constants/positionInput");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ const PositionInput = _ref => {
14
+ let {
15
+ searchPlaceholder,
16
+ apiToken,
17
+ polygonOptions = _positionInput.DEFAULT_POLYGON_OPTIONS,
18
+ initialPosition = _positionInput.DEFAULT_POSITION,
19
+ zoom = 13,
20
+ markers,
21
+ onMarkerRemove,
22
+ onMarkerChange,
23
+ onMarkerAdd
24
+ } = _ref;
25
+ return /*#__PURE__*/_react.default.createElement(_PositionInput.StyledPositionInput, null, /*#__PURE__*/_react.default.createElement(_PositionInput.StyledPositionInputSearch, null, /*#__PURE__*/_react.default.createElement(_core.Input, {
26
+ id: "auto-complete-input",
27
+ placeholder: searchPlaceholder
28
+ })), /*#__PURE__*/_react.default.createElement(_MapWrapper.default, {
29
+ apiToken: apiToken,
30
+ polygonOptions: polygonOptions,
31
+ initialPosition: initialPosition,
32
+ initialZoom: zoom,
33
+ markers: markers,
34
+ onMarkerAdd: onMarkerAdd,
35
+ onMarkerChange: onMarkerChange,
36
+ onMarkerRemove: onMarkerRemove
37
+ }));
38
+ };
39
+ PositionInput.displayName = 'PositionInput';
40
+ var _default = exports.default = PositionInput;
41
+ //# sourceMappingURL=PositionInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PositionInput.js","names":["_react","_interopRequireDefault","require","_PositionInput","_core","_MapWrapper","_positionInput","obj","__esModule","default","PositionInput","_ref","searchPlaceholder","apiToken","polygonOptions","DEFAULT_POLYGON_OPTIONS","initialPosition","DEFAULT_POSITION","zoom","markers","onMarkerRemove","onMarkerChange","onMarkerAdd","createElement","StyledPositionInput","StyledPositionInputSearch","Input","id","placeholder","initialZoom","displayName","_default","exports"],"sources":["../../../src/components/position-input/PositionInput.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyledPositionInput, StyledPositionInputSearch } from './PositionInput.styles';\nimport { Input } from '@chayns-components/core';\nimport MapWrapper from './map-wrapper/MapWrapper';\nimport type { IMarker, PolygonOptions, Position } from '../../types/positionInput';\nimport { DEFAULT_POLYGON_OPTIONS, DEFAULT_POSITION } from '../../constants/positionInput';\n\nexport type PositionInputProps = {\n /**\n * The api token for google maps.\n */\n apiToken: string;\n /**\n * The position of the center of the map on the initial render.\n */\n initialPosition?: Position;\n /**\n * Markers that should be displayed.\n */\n markers?: IMarker[];\n /**\n * Function to be executed when a marker is added.\n */\n onMarkerAdd: (marker: IMarker) => void;\n /**\n * Function to be executed when a marker position is changed.\n */\n onMarkerChange: (markers: IMarker[]) => void;\n /**\n * Function to be executed when a marker is removed.\n */\n onMarkerRemove: (id: number) => void;\n /**\n * Options to style the polygon.\n */\n polygonOptions?: PolygonOptions;\n /**\n * The placeholder of the search input.\n */\n searchPlaceholder?: string;\n /**\n * The zoom of the map.\n */\n zoom?: number;\n};\n\nconst PositionInput: FC<PositionInputProps> = ({\n searchPlaceholder,\n apiToken,\n polygonOptions = DEFAULT_POLYGON_OPTIONS,\n initialPosition = DEFAULT_POSITION,\n zoom = 13,\n markers,\n onMarkerRemove,\n onMarkerChange,\n onMarkerAdd,\n}) => (\n <StyledPositionInput>\n <StyledPositionInputSearch>\n <Input id=\"auto-complete-input\" placeholder={searchPlaceholder} />\n </StyledPositionInputSearch>\n <MapWrapper\n apiToken={apiToken}\n polygonOptions={polygonOptions}\n initialPosition={initialPosition}\n initialZoom={zoom}\n markers={markers}\n onMarkerAdd={onMarkerAdd}\n onMarkerChange={onMarkerChange}\n onMarkerRemove={onMarkerRemove}\n />\n </StyledPositionInput>\n);\n\nPositionInput.displayName = 'PositionInput';\n\nexport default PositionInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAA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("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
3
+ export declare const StyledPositionInputSearch: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledPositionInputSearch = exports.StyledPositionInput = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledPositionInput = exports.StyledPositionInput = _styledComponents.default.div`
10
+ position: relative;
11
+ `;
12
+ const StyledPositionInputSearch = exports.StyledPositionInputSearch = _styledComponents.default.div`
13
+ position: absolute;
14
+ width: 300px;
15
+ left: 8px;
16
+ top: 8px;
17
+ z-index: 3;
18
+ `;
19
+ //# sourceMappingURL=PositionInput.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PositionInput.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledPositionInput","exports","styled","div","StyledPositionInputSearch"],"sources":["../../../src/components/position-input/PositionInput.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledPositionInput = styled.div`\n position: relative;\n`;\n\nexport const StyledPositionInputSearch = styled.div`\n position: absolute;\n width: 300px;\n left: 8px;\n top: 8px;\n z-index: 3;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC9C;AACA,CAAC;AAEM,MAAMC,yBAAyB,GAAAH,OAAA,CAAAG,yBAAA,GAAGF,yBAAM,CAACC,GAAI;AACpD;AACA;AACA;AACA;AACA;AACA,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { FC } from 'react';
2
+ import type { IMarker, PolygonOptions, Position } from '../../../types/positionInput';
3
+ export type MapWrapperProps = {
4
+ apiToken: string;
5
+ polygonOptions: PolygonOptions;
6
+ initialZoom: number;
7
+ initialPosition: Position;
8
+ markers?: IMarker[];
9
+ onMarkerAdd?: (marker: IMarker) => void;
10
+ onMarkerRemove?: (id: number) => void;
11
+ onMarkerChange?: (markers: IMarker[]) => void;
12
+ };
13
+ declare const MapWrapper: FC<MapWrapperProps>;
14
+ export default MapWrapper;
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactWrapper = require("@googlemaps/react-wrapper");
9
+ var _MapWrapper = require("./MapWrapper.styles");
10
+ var _api = require("@react-google-maps/api");
11
+ var _Marker = _interopRequireDefault(require("./map/marker/Marker"));
12
+ var _Map = _interopRequireDefault(require("./map/Map"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ const MapWrapper = _ref => {
17
+ let {
18
+ apiToken,
19
+ polygonOptions,
20
+ initialZoom,
21
+ initialPosition,
22
+ markers,
23
+ onMarkerAdd,
24
+ onMarkerRemove,
25
+ onMarkerChange
26
+ } = _ref;
27
+ const [polygonPath, setPolygonPath] = (0, _react.useState)();
28
+ const [canPolyDraw, setCanPolyDraw] = (0, _react.useState)(false);
29
+ const [zoom, setZoom] = (0, _react.useState)(initialZoom);
30
+ const [center, setCenter] = (0, _react.useState)(initialPosition);
31
+ const [internalMarkers, setInternalMarkers] = (0, _react.useState)();
32
+ const [map, setMap] = (0, _react.useState)();
33
+ (0, _react.useEffect)(() => {
34
+ if (markers) {
35
+ setInternalMarkers(markers);
36
+ }
37
+ }, [markers]);
38
+ const handleClick = (0, _react.useCallback)(e => {
39
+ const latLng = e.latLng?.toJSON();
40
+ if (!latLng) {
41
+ return;
42
+ }
43
+ setInternalMarkers(prevState => {
44
+ if (prevState && prevState.length >= 2) {
45
+ return prevState;
46
+ }
47
+ const newMarker = {
48
+ position: {
49
+ lat: latLng.lat,
50
+ lng: latLng.lng
51
+ },
52
+ id: prevState ? prevState.length : 0
53
+ };
54
+ if (typeof onMarkerAdd === 'function') {
55
+ onMarkerAdd(newMarker);
56
+ }
57
+ return prevState ? [...prevState, newMarker] : [newMarker];
58
+ });
59
+ }, [onMarkerAdd]);
60
+ (0, _react.useEffect)(() => {
61
+ if (!internalMarkers) {
62
+ return;
63
+ }
64
+ if (internalMarkers.length !== 2) {
65
+ setCanPolyDraw(false);
66
+ return;
67
+ }
68
+ const path = [{
69
+ lat: internalMarkers[0]?.position.lat ?? 0,
70
+ lng: internalMarkers[0]?.position.lng ?? 0
71
+ }, {
72
+ lat: internalMarkers[0]?.position.lat ?? 0,
73
+ lng: internalMarkers[1]?.position.lng ?? 0
74
+ }, {
75
+ lat: internalMarkers[1]?.position.lat ?? 0,
76
+ lng: internalMarkers[1]?.position.lng ?? 0
77
+ }, {
78
+ lat: internalMarkers[1]?.position.lat ?? 0,
79
+ lng: internalMarkers[0]?.position.lng ?? 0
80
+ }];
81
+ const maxLat = path.reduce((prev, current) => prev.lat > current.lat ? prev : current);
82
+ const minLat = path.reduce((prev, current) => prev.lat < current.lat ? prev : current);
83
+ const maxLng = path.reduce((prev, current) => prev.lng > current.lng ? prev : current);
84
+ const minLng = path.reduce((prev, current) => prev.lng < current.lng ? prev : current);
85
+ const topLeft = path.find(item => item.lat === maxLat.lat && item.lng === minLng.lng);
86
+ const bottomRight = path.find(item => item.lat === minLat.lat && item.lng === maxLng.lng);
87
+ if (!topLeft || !bottomRight) {
88
+ return;
89
+ }
90
+ const centerLat = (topLeft.lat + bottomRight.lat) / 2;
91
+ const centerLng = (topLeft.lng + bottomRight.lng) / 2;
92
+ const polygonCenter = {
93
+ lat: centerLat,
94
+ lng: centerLng
95
+ };
96
+ if (!polygonCenter) {
97
+ return;
98
+ }
99
+ setCanPolyDraw(true);
100
+ setPolygonPath(path);
101
+ }, [internalMarkers]);
102
+ const handleIdle = m => {
103
+ setMap(m);
104
+ setZoom(m.getZoom() ?? 0);
105
+ setCenter(m.getCenter()?.toJSON() ?? {
106
+ lat: 0,
107
+ lng: 0
108
+ });
109
+ };
110
+ const handlePositionChange = position => {
111
+ setCenter(position);
112
+ };
113
+ const handleMarkerChange = (0, _react.useCallback)(marker => {
114
+ setInternalMarkers(prevState => {
115
+ const updatedMarkers = (prevState ?? []).map(prevMarker => {
116
+ if (prevMarker.id === marker.id) {
117
+ return {
118
+ ...prevMarker,
119
+ position: marker.position
120
+ };
121
+ }
122
+ return prevMarker;
123
+ });
124
+ if (typeof onMarkerChange === 'function') {
125
+ onMarkerChange(updatedMarkers);
126
+ }
127
+ return updatedMarkers;
128
+ });
129
+ }, [onMarkerChange]);
130
+ const handleMarkerRemove = (0, _react.useCallback)(id => {
131
+ setInternalMarkers(prevState => {
132
+ if (typeof onMarkerRemove === 'function') {
133
+ onMarkerRemove(id);
134
+ }
135
+ return prevState ? prevState.filter(marker => marker.id !== id) : [];
136
+ });
137
+ }, [onMarkerRemove]);
138
+ const markerList = (0, _react.useMemo)(() => {
139
+ const items = [];
140
+ if (!internalMarkers) {
141
+ return items;
142
+ }
143
+ internalMarkers.forEach(_ref2 => {
144
+ let {
145
+ id,
146
+ position
147
+ } = _ref2;
148
+ items.push( /*#__PURE__*/_react.default.createElement(_Marker.default, {
149
+ key: `marker_${id}`,
150
+ id: id,
151
+ position: position,
152
+ isDraggable: true,
153
+ map: map,
154
+ onChange: handleMarkerChange,
155
+ onRemove: handleMarkerRemove
156
+ }));
157
+ });
158
+ return items;
159
+ }, [handleMarkerChange, handleMarkerRemove, internalMarkers, map]);
160
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_MapWrapper.StyledMapWrapper, null, /*#__PURE__*/_react.default.createElement(_reactWrapper.Wrapper, {
161
+ apiKey: apiToken,
162
+ libraries: ['places']
163
+ }, /*#__PURE__*/_react.default.createElement(_Map.default, {
164
+ onClick: handleClick,
165
+ onIdle: handleIdle,
166
+ onPositionChange: handlePositionChange,
167
+ center: center,
168
+ zoom: zoom,
169
+ fullscreenControl: false,
170
+ mapTypeControl: false,
171
+ streetViewControl: false
172
+ }, markerList, canPolyDraw && /*#__PURE__*/_react.default.createElement(_api.Polygon, {
173
+ path: polygonPath,
174
+ options: polygonOptions
175
+ })))), [apiToken, handleClick, center, zoom, markerList, canPolyDraw, polygonPath, polygonOptions]);
176
+ };
177
+ MapWrapper.displayName = 'MapWrapper';
178
+ var _default = exports.default = MapWrapper;
179
+ //# sourceMappingURL=MapWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapWrapper.js","names":["_react","_interopRequireWildcard","require","_reactWrapper","_MapWrapper","_api","_Marker","_interopRequireDefault","_Map","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","MapWrapper","_ref","apiToken","polygonOptions","initialZoom","initialPosition","markers","onMarkerAdd","onMarkerRemove","onMarkerChange","polygonPath","setPolygonPath","useState","canPolyDraw","setCanPolyDraw","zoom","setZoom","center","setCenter","internalMarkers","setInternalMarkers","map","setMap","useEffect","handleClick","useCallback","latLng","toJSON","prevState","length","newMarker","position","lat","lng","id","path","maxLat","reduce","prev","current","minLat","maxLng","minLng","topLeft","find","item","bottomRight","centerLat","centerLng","polygonCenter","handleIdle","m","getZoom","getCenter","handlePositionChange","handleMarkerChange","marker","updatedMarkers","prevMarker","handleMarkerRemove","filter","markerList","useMemo","items","forEach","_ref2","push","createElement","key","isDraggable","onChange","onRemove","StyledMapWrapper","Wrapper","apiKey","libraries","onClick","onIdle","onPositionChange","fullscreenControl","mapTypeControl","streetViewControl","Polygon","options","displayName","_default","exports"],"sources":["../../../../src/components/position-input/map-wrapper/MapWrapper.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Wrapper } from '@googlemaps/react-wrapper';\nimport { StyledMapWrapper } from './MapWrapper.styles';\nimport type { IMarker, PolygonOptions, Position } from '../../../types/positionInput';\nimport { Polygon } from '@react-google-maps/api';\nimport Marker from './map/marker/Marker';\nimport Map from './map/Map';\n\nexport type MapWrapperProps = {\n apiToken: string;\n polygonOptions: PolygonOptions;\n initialZoom: number;\n initialPosition: Position;\n markers?: IMarker[];\n onMarkerAdd?: (marker: IMarker) => void;\n onMarkerRemove?: (id: number) => void;\n onMarkerChange?: (markers: IMarker[]) => void;\n};\n\nconst MapWrapper: FC<MapWrapperProps> = ({\n apiToken,\n polygonOptions,\n initialZoom,\n initialPosition,\n markers,\n onMarkerAdd,\n onMarkerRemove,\n onMarkerChange,\n}) => {\n const [polygonPath, setPolygonPath] = useState<Position[]>();\n const [canPolyDraw, setCanPolyDraw] = useState(false);\n const [zoom, setZoom] = useState(initialZoom);\n const [center, setCenter] = useState<Position>(initialPosition);\n const [internalMarkers, setInternalMarkers] = useState<IMarker[]>();\n const [map, setMap] = useState<google.maps.Map>();\n\n useEffect(() => {\n if (markers) {\n setInternalMarkers(markers);\n }\n }, [markers]);\n\n const handleClick = useCallback(\n (e: google.maps.MapMouseEvent) => {\n const latLng = e.latLng?.toJSON();\n\n if (!latLng) {\n return;\n }\n\n setInternalMarkers((prevState) => {\n if (prevState && prevState.length >= 2) {\n return prevState;\n }\n\n const newMarker: IMarker = {\n position: { lat: latLng.lat, lng: latLng.lng },\n id: prevState ? prevState.length : 0,\n };\n\n if (typeof onMarkerAdd === 'function') {\n onMarkerAdd(newMarker);\n }\n\n return prevState ? [...prevState, newMarker] : [newMarker];\n });\n },\n [onMarkerAdd],\n );\n\n useEffect(() => {\n if (!internalMarkers) {\n return;\n }\n\n if (internalMarkers.length !== 2) {\n setCanPolyDraw(false);\n\n return;\n }\n\n const path: Position[] = [\n {\n lat: internalMarkers[0]?.position.lat ?? 0,\n lng: internalMarkers[0]?.position.lng ?? 0,\n },\n {\n lat: internalMarkers[0]?.position.lat ?? 0,\n lng: internalMarkers[1]?.position.lng ?? 0,\n },\n {\n lat: internalMarkers[1]?.position.lat ?? 0,\n lng: internalMarkers[1]?.position.lng ?? 0,\n },\n {\n lat: internalMarkers[1]?.position.lat ?? 0,\n lng: internalMarkers[0]?.position.lng ?? 0,\n },\n ];\n\n const maxLat = path.reduce((prev, current) => (prev.lat > current.lat ? prev : current));\n const minLat = path.reduce((prev, current) => (prev.lat < current.lat ? prev : current));\n const maxLng = path.reduce((prev, current) => (prev.lng > current.lng ? prev : current));\n const minLng = path.reduce((prev, current) => (prev.lng < current.lng ? prev : current));\n\n const topLeft = path.find((item) => item.lat === maxLat.lat && item.lng === minLng.lng);\n const bottomRight = path.find((item) => item.lat === minLat.lat && item.lng === maxLng.lng);\n\n if (!topLeft || !bottomRight) {\n return;\n }\n\n const centerLat = (topLeft.lat + bottomRight.lat) / 2;\n const centerLng = (topLeft.lng + bottomRight.lng) / 2;\n\n const polygonCenter = {\n lat: centerLat,\n lng: centerLng,\n };\n\n if (!polygonCenter) {\n return;\n }\n\n setCanPolyDraw(true);\n setPolygonPath(path);\n }, [internalMarkers]);\n\n const handleIdle = (m: google.maps.Map) => {\n setMap(m);\n setZoom(m.getZoom() ?? 0);\n setCenter(m.getCenter()?.toJSON() ?? { lat: 0, lng: 0 });\n };\n\n const handlePositionChange = (position: Position) => {\n setCenter(position);\n };\n\n const handleMarkerChange = useCallback(\n (marker: IMarker) => {\n setInternalMarkers((prevState) => {\n const updatedMarkers = (prevState ?? []).map((prevMarker) => {\n if (prevMarker.id === marker.id) {\n return { ...prevMarker, position: marker.position };\n }\n return prevMarker;\n });\n\n if (typeof onMarkerChange === 'function') {\n onMarkerChange(updatedMarkers);\n }\n\n return updatedMarkers;\n });\n },\n [onMarkerChange],\n );\n\n const handleMarkerRemove = useCallback(\n (id: number) => {\n setInternalMarkers((prevState) => {\n if (typeof onMarkerRemove === 'function') {\n onMarkerRemove(id);\n }\n\n return prevState ? prevState.filter((marker) => marker.id !== id) : [];\n });\n },\n [onMarkerRemove],\n );\n\n const markerList = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!internalMarkers) {\n return items;\n }\n\n internalMarkers.forEach(({ id, position }) => {\n items.push(\n <Marker\n key={`marker_${id}`}\n id={id}\n position={position}\n isDraggable\n map={map}\n onChange={handleMarkerChange}\n onRemove={handleMarkerRemove}\n />,\n );\n });\n\n return items;\n }, [handleMarkerChange, handleMarkerRemove, internalMarkers, map]);\n\n return useMemo(\n () => (\n <StyledMapWrapper>\n <Wrapper apiKey={apiToken} libraries={['places']}>\n {/* ToDo find better solution */}\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore */}\n <Map\n onClick={handleClick}\n onIdle={handleIdle}\n onPositionChange={handlePositionChange}\n center={center}\n zoom={zoom}\n fullscreenControl={false}\n mapTypeControl={false}\n streetViewControl={false}\n >\n {markerList}\n {canPolyDraw && <Polygon path={polygonPath} options={polygonOptions} />}\n </Map>\n </Wrapper>\n </StyledMapWrapper>\n ),\n [apiToken, handleClick, center, zoom, markerList, canPolyDraw, polygonPath, polygonOptions],\n );\n};\n\nMapWrapper.displayName = 'MapWrapper';\n\nexport default MapWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,IAAA,GAAAD,sBAAA,CAAAL,OAAA;AAA4B,SAAAK,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAY,CAAA,SAAAI,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K;EAChB,CAAC,EAAE,CAACR,kBAAkB,EAAEI,kBAAkB,EAAExC,eAAe,EAAEE,GAAG,CAAC,CAAC;EAElE,OAAO,IAAAyC,cAAO,EACV,mBACI7F,MAAA,CAAAW,OAAA,CAAAuF,aAAA,CAAC9F,WAAA,CAAAmG,gBAAgB,qBACbvG,MAAA,CAAAW,OAAA,CAAAuF,aAAA,CAAC/F,aAAA,CAAAqG,OAAO;IAACC,MAAM,EAAExE,QAAS;IAACyE,SAAS,EAAE,CAAC,QAAQ;EAAE,gBAI7C1G,MAAA,CAAAW,OAAA,CAAAuF,aAAA,CAAC1F,IAAA,CAAAG,OAAG;IACAgG,OAAO,EAAEpD,WAAY;IACrBqD,MAAM,EAAE3B,UAAW;IACnB4B,gBAAgB,EAAExB,oBAAqB;IACvCrC,MAAM,EAAEA,MAAO;IACfF,IAAI,EAAEA,IAAK;IACXgE,iBAAiB,EAAE,KAAM;IACzBC,cAAc,EAAE,KAAM;IACtBC,iBAAiB,EAAE;EAAM,GAExBpB,UAAU,EACVhD,WAAW,iBAAI5C,MAAA,CAAAW,OAAA,CAAAuF,aAAA,CAAC7F,IAAA,CAAA4G,OAAO;IAAC/C,IAAI,EAAEzB,WAAY;IAACyE,OAAO,EAAEhF;EAAe,CAAE,CACrE,CACA,CACK,CACrB,EACD,CAACD,QAAQ,EAAEsB,WAAW,EAAEP,MAAM,EAAEF,IAAI,EAAE8C,UAAU,EAAEhD,WAAW,EAAEH,WAAW,EAAEP,cAAc,CAC9F,CAAC;AACL,CAAC;AAEDH,UAAU,CAACoF,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1G,OAAA,GAEvBoB,UAAU"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledMapWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledMapWrapper = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledMapWrapper = exports.StyledMapWrapper = _styledComponents.default.div`
10
+ height: 500px;
11
+ `;
12
+ //# sourceMappingURL=MapWrapper.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapWrapper.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledMapWrapper","exports","styled","div"],"sources":["../../../../src/components/position-input/map-wrapper/MapWrapper.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledMapWrapper = styled.div`\n height: 500px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC3C;AACA,CAAC"}
@@ -0,0 +1,16 @@
1
+ /// <reference types="google.maps" />
2
+ import { FC, type ReactElement } from 'react';
3
+ import type { Position } from '../../../../types/positionInput';
4
+ export type MapProps = {
5
+ onClick: (event: google.maps.MapMouseEvent) => void;
6
+ onIdle: (event: google.maps.Map) => void;
7
+ onPositionChange: (position: Position) => void;
8
+ children: ReactElement;
9
+ center: Position;
10
+ zoom: number;
11
+ fullscreenControl: boolean;
12
+ mapTypeControl: boolean;
13
+ streetViewControl: boolean;
14
+ };
15
+ declare const Map: FC<MapProps>;
16
+ export default Map;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Map = require("./Map.styles");
9
+ var _positionInput = require("../../../../hooks/positionInput");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ const Map = _ref => {
13
+ let {
14
+ mapTypeControl,
15
+ fullscreenControl,
16
+ streetViewControl,
17
+ children,
18
+ onClick,
19
+ onIdle,
20
+ zoom,
21
+ center,
22
+ onPositionChange
23
+ } = _ref;
24
+ const [map, setMap] = (0, _react.useState)();
25
+ const ref = (0, _react.useRef)(null);
26
+ (0, _react.useEffect)(() => {
27
+ if (ref.current && !map) {
28
+ setMap(new window.google.maps.Map(ref.current, {}));
29
+ const input = document.getElementById('auto-complete-input');
30
+ if (!input) {
31
+ return;
32
+ }
33
+ const autoComplete = new google.maps.places.Autocomplete(input, {
34
+ // componentRestrictions: { country: ["de"] },
35
+ fields: ['address_component', 'geometry'],
36
+ types: ['(cities)']
37
+ });
38
+ input.placeholder = '';
39
+ autoComplete.addListener('place_changed', () => {
40
+ const place = autoComplete.getPlace();
41
+ const placeLocation = place.geometry?.location;
42
+ if (!placeLocation) {
43
+ return;
44
+ }
45
+ onPositionChange({
46
+ lat: placeLocation.lat(),
47
+ lng: placeLocation.lng()
48
+ });
49
+ });
50
+ }
51
+ }, [ref, map, onPositionChange]);
52
+ (0, _react.useEffect)(() => {
53
+ if (map) {
54
+ map.setCenter(center);
55
+ }
56
+ }, [center, map]);
57
+
58
+ // because React does not do deep comparisons, a custom hook is used
59
+ // see discussion in https://github.com/googlemaps/js-samples/issues/946
60
+ (0, _positionInput.useDeepCompareEffectForMaps)(() => {
61
+ if (map) {
62
+ map.setOptions({
63
+ mapTypeControl,
64
+ fullscreenControl,
65
+ streetViewControl,
66
+ zoom
67
+ });
68
+ }
69
+ }, [map]);
70
+ (0, _react.useEffect)(() => {
71
+ if (map) {
72
+ ['click', 'idle'].forEach(eventName => google.maps.event.clearListeners(map, eventName));
73
+ if (onClick) {
74
+ map.addListener('click', onClick);
75
+ }
76
+ if (onIdle) {
77
+ map.addListener('idle', () => onIdle(map));
78
+ }
79
+ }
80
+ }, [map, onClick, onIdle]);
81
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Map.StyledMap, {
82
+ ref: ref
83
+ }), _react.default.Children.map(children, child => {
84
+ if ( /*#__PURE__*/_react.default.isValidElement(child)) {
85
+ // set the map prop on the child component
86
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
+ // @ts-ignore
88
+ return /*#__PURE__*/_react.default.cloneElement(child, {
89
+ map
90
+ });
91
+ }
92
+ return null;
93
+ }));
94
+ };
95
+ Map.displayName = 'Map';
96
+ var _default = exports.default = Map;
97
+ //# sourceMappingURL=Map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.js","names":["_react","_interopRequireWildcard","require","_Map","_positionInput","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Map","_ref","mapTypeControl","fullscreenControl","streetViewControl","children","onClick","onIdle","zoom","center","onPositionChange","map","setMap","useState","ref","useRef","useEffect","current","window","google","maps","input","document","getElementById","autoComplete","places","Autocomplete","fields","types","placeholder","addListener","place","getPlace","placeLocation","geometry","location","lat","lng","setCenter","useDeepCompareEffectForMaps","setOptions","forEach","eventName","event","clearListeners","createElement","Fragment","StyledMap","React","Children","child","isValidElement","cloneElement","displayName","_default","exports"],"sources":["../../../../../src/components/position-input/map-wrapper/map/Map.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useEffect, useRef, useState } from 'react';\nimport { StyledMap } from './Map.styles';\nimport type { Position } from '../../../../types/positionInput';\nimport { useDeepCompareEffectForMaps } from '../../../../hooks/positionInput';\n\nexport type MapProps = {\n onClick: (event: google.maps.MapMouseEvent) => void;\n onIdle: (event: google.maps.Map) => void;\n onPositionChange: (position: Position) => void;\n children: ReactElement;\n center: Position;\n zoom: number;\n fullscreenControl: boolean;\n mapTypeControl: boolean;\n streetViewControl: boolean;\n};\n\nconst Map: FC<MapProps> = ({\n mapTypeControl,\n fullscreenControl,\n streetViewControl,\n children,\n onClick,\n onIdle,\n zoom,\n center,\n onPositionChange,\n}) => {\n const [map, setMap] = useState<google.maps.Map>();\n\n const ref = useRef(null);\n\n useEffect(() => {\n if (ref.current && !map) {\n setMap(new window.google.maps.Map(ref.current, {}));\n\n const input = document.getElementById('auto-complete-input') as HTMLInputElement;\n\n if (!input) {\n return;\n }\n\n const autoComplete = new google.maps.places.Autocomplete(input, {\n // componentRestrictions: { country: [\"de\"] },\n fields: ['address_component', 'geometry'],\n types: ['(cities)'],\n });\n\n input.placeholder = '';\n\n autoComplete.addListener('place_changed', () => {\n const place = autoComplete.getPlace();\n\n const placeLocation = place.geometry?.location;\n\n if (!placeLocation) {\n return;\n }\n\n onPositionChange({ lat: placeLocation.lat(), lng: placeLocation.lng() });\n });\n }\n }, [ref, map, onPositionChange]);\n\n useEffect(() => {\n if (map) {\n map.setCenter(center);\n }\n }, [center, map]);\n\n // because React does not do deep comparisons, a custom hook is used\n // see discussion in https://github.com/googlemaps/js-samples/issues/946\n useDeepCompareEffectForMaps(() => {\n if (map) {\n map.setOptions({ mapTypeControl, fullscreenControl, streetViewControl, zoom });\n }\n }, [map]);\n\n useEffect(() => {\n if (map) {\n ['click', 'idle'].forEach((eventName) =>\n google.maps.event.clearListeners(map, eventName),\n );\n\n if (onClick) {\n map.addListener('click', onClick);\n }\n\n if (onIdle) {\n map.addListener('idle', () => onIdle(map));\n }\n }\n }, [map, onClick, onIdle]);\n\n return (\n <>\n <StyledMap ref={ref} />\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n // set the map prop on the child component\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return React.cloneElement(child, { map });\n }\n return null;\n })}\n </>\n );\n};\n\nMap.displayName = 'Map';\n\nexport default Map;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AAA8E,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA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vB,MAAM,CAACI,GAAG,CAAC,CAAC;MAC9C;IACJ;EACJ,CAAC,EAAE,CAACA,GAAG,EAAEL,OAAO,EAAEC,MAAM,CAAC,CAAC;EAE1B,oBACIjC,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAAAvE,MAAA,CAAAW,OAAA,CAAA6D,QAAA,qBACIxE,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAACpE,IAAA,CAAAsE,SAAS;IAACjC,GAAG,EAAEA;EAAI,CAAE,CAAC,EACtBkC,cAAK,CAACC,QAAQ,CAACtC,GAAG,CAACN,QAAQ,EAAG6C,KAAK,IAAK;IACrC,kBAAIF,cAAK,CAACG,cAAc,CAACD,KAAK,CAAC,EAAE;MAC7B;MACA;MACA;MACA,oBAAOF,cAAK,CAACI,YAAY,CAACF,KAAK,EAAE;QAAEvC;MAAI,CAAC,CAAC;IAC7C;IACA,OAAO,IAAI;EACf,CAAC,CACH,CAAC;AAEX,CAAC;AAEDX,GAAG,CAACqD,WAAW,GAAG,KAAK;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtE,OAAA,GAETe,GAAG"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledMap: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledMap = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledMap = exports.StyledMap = _styledComponents.default.div`
10
+ height: 100%;
11
+ width: 100%;
12
+ `;
13
+ //# sourceMappingURL=Map.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledMap","exports","styled","div"],"sources":["../../../../../src/components/position-input/map-wrapper/map/Map.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledMap = styled.div`\n height: 100%;\n width: 100%;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,yBAAM,CAACC,GAAI;AACpC;AACA;AACA,CAAC"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="google.maps" />
2
+ import { FC } from 'react';
3
+ import type { IMarker, Position } from '../../../../../types/positionInput';
4
+ export type MarkerProps = {
5
+ id: number;
6
+ position: Position;
7
+ isDraggable: boolean;
8
+ onChange: (marker: IMarker) => void;
9
+ onRemove: (id: number) => void;
10
+ map?: google.maps.Map;
11
+ };
12
+ declare const Marker: FC<MarkerProps>;
13
+ export default Marker;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ const Marker = _ref => {
9
+ let {
10
+ id,
11
+ isDraggable,
12
+ position,
13
+ onChange,
14
+ onRemove,
15
+ map
16
+ } = _ref;
17
+ const [pin, setPin] = (0, _react.useState)();
18
+ (0, _react.useEffect)(() => {
19
+ if (pin) {
20
+ google.maps.event.addListener(pin, 'dragend', evt => {
21
+ const newLat = evt.latLng?.lat();
22
+ const newLng = evt.latLng?.lng();
23
+ if (!newLat || !newLng) {
24
+ return;
25
+ }
26
+ onChange({
27
+ id,
28
+ position: {
29
+ lng: newLng,
30
+ lat: newLat
31
+ }
32
+ });
33
+ });
34
+ google.maps.event.addListener(pin, 'rightclick', () => {
35
+ onRemove(id);
36
+ });
37
+ }
38
+ }, [pin, id, onChange, onRemove]);
39
+ (0, _react.useEffect)(() => {
40
+ if (!pin) {
41
+ setPin(new google.maps.Marker({
42
+ map
43
+ }));
44
+ }
45
+
46
+ // remove marker from map on unmount
47
+ return () => {
48
+ if (pin) {
49
+ pin.setMap(null);
50
+ }
51
+ };
52
+ }, [pin, map]);
53
+ (0, _react.useEffect)(() => {
54
+ if (pin) {
55
+ pin.setOptions({
56
+ draggable: isDraggable,
57
+ position,
58
+ map
59
+ });
60
+ }
61
+ }, [pin, isDraggable, position, map]);
62
+ return null;
63
+ };
64
+ Marker.displayName = 'Marker';
65
+ var _default = exports.default = Marker;
66
+ //# sourceMappingURL=Marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Marker.js","names":["_react","require","Marker","_ref","id","isDraggable","position","onChange","onRemove","map","pin","setPin","useState","useEffect","google","maps","event","addListener","evt","newLat","latLng","lat","newLng","lng","setMap","setOptions","draggable","displayName","_default","exports","default"],"sources":["../../../../../../src/components/position-input/map-wrapper/map/marker/Marker.tsx"],"sourcesContent":["import { FC, useEffect, useState } from 'react';\nimport type { IMarker, Position } from '../../../../../types/positionInput';\n\nexport type MarkerProps = {\n id: number;\n position: Position;\n isDraggable: boolean;\n onChange: (marker: IMarker) => void;\n onRemove: (id: number) => void;\n map?: google.maps.Map;\n};\n\nconst Marker: FC<MarkerProps> = ({ id, isDraggable, position, onChange, onRemove, map }) => {\n const [pin, setPin] = useState<google.maps.Marker>();\n\n useEffect(() => {\n if (pin) {\n google.maps.event.addListener(pin, 'dragend', (evt: google.maps.MapMouseEvent) => {\n const newLat = evt.latLng?.lat();\n const newLng = evt.latLng?.lng();\n\n if (!newLat || !newLng) {\n return;\n }\n\n onChange({ id, position: { lng: newLng, lat: newLat } });\n });\n\n google.maps.event.addListener(pin, 'rightclick', () => {\n onRemove(id);\n });\n }\n }, [pin, id, onChange, onRemove]);\n\n useEffect(() => {\n if (!pin) {\n setPin(new google.maps.Marker({ map }));\n }\n\n // remove marker from map on unmount\n return () => {\n if (pin) {\n pin.setMap(null);\n }\n };\n }, [pin, map]);\n\n useEffect(() => {\n if (pin) {\n pin.setOptions({\n draggable: isDraggable,\n position,\n map,\n });\n }\n }, [pin, isDraggable, position, map]);\n\n return null;\n};\n\nMarker.displayName = 'Marker';\n\nexport default Marker;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAYA,MAAMC,MAAuB,GAAGC,IAAA,IAA4D;EAAA,IAA3D;IAAEC,EAAE;IAAEC,WAAW;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAI,CAAC,GAAAN,IAAA;EACnF,MAAM,CAACO,GAAG,EAAEC,MAAM,CAAC,GAAG,IAAAC,eAAQ,EAAqB,CAAC;EAEpD,IAAAC,gBAAS,EAAC,MAAM;IACZ,IAAIH,GAAG,EAAE;MACLI,MAAM,CAACC,IAAI,CAACC,KAAK,CAACC,WAAW,CAACP,GAAG,EAAE,SAAS,EAAGQ,GAA8B,IAAK;QAC9E,MAAMC,MAAM,GAAGD,GAAG,CAACE,MAAM,EAAEC,GAAG,CAAC,CAAC;QAChC,MAAMC,MAAM,GAAGJ,GAAG,CAACE,MAAM,EAAEG,GAAG,CAAC,CAAC;QAEhC,IAAI,CAACJ,MAAM,IAAI,CAACG,MAAM,EAAE;UACpB;QACJ;QAEAf,QAAQ,CAAC;UAAEH,EAAE;UAAEE,QAAQ,EAAE;YAAEiB,GAAG,EAAED,MAAM;YAAED,GAAG,EAAEF;UAAO;QAAE,CAAC,CAAC;MAC5D,CAAC,CAAC;MAEFL,MAAM,CAACC,IAAI,CAACC,KAAK,CAACC,WAAW,CAACP,GAAG,EAAE,YAAY,EAAE,MAAM;QACnDF,QAAQ,CAACJ,EAAE,CAAC;MAChB,CAAC,CAAC;IACN;EACJ,CAAC,EAAE,CAACM,GAAG,EAAEN,EAAE,EAAEG,QAAQ,EAAEC,QAAQ,CAAC,CAAC;EAEjC,IAAAK,gBAAS,EAAC,MAAM;IACZ,IAAI,CAACH,GAAG,EAAE;MACNC,MAAM,CAAC,IAAIG,MAAM,CAACC,IAAI,CAACb,MAAM,CAAC;QAAEO;MAAI,CAAC,CAAC,CAAC;IAC3C;;IAEA;IACA,OAAO,MAAM;MACT,IAAIC,GAAG,EAAE;QACLA,GAAG,CAACc,MAAM,CAAC,IAAI,CAAC;MACpB;IACJ,CAAC;EACL,CAAC,EAAE,CAACd,GAAG,EAAED,GAAG,CAAC,CAAC;EAEd,IAAAI,gBAAS,EAAC,MAAM;IACZ,IAAIH,GAAG,EAAE;MACLA,GAAG,CAACe,UAAU,CAAC;QACXC,SAAS,EAAErB,WAAW;QACtBC,QAAQ;QACRG;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,EAAE,CAACC,GAAG,EAAEL,WAAW,EAAEC,QAAQ,EAAEG,GAAG,CAAC,CAAC;EAErC,OAAO,IAAI;AACf,CAAC;AAEDP,MAAM,CAACyB,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEf5B,MAAM"}
@@ -0,0 +1,3 @@
1
+ import type { PolygonOptions, Position } from '../types/positionInput';
2
+ export declare const DEFAULT_POLYGON_OPTIONS: PolygonOptions;
3
+ export declare const DEFAULT_POSITION: Position;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_POSITION = exports.DEFAULT_POLYGON_OPTIONS = void 0;
7
+ const DEFAULT_POLYGON_OPTIONS = exports.DEFAULT_POLYGON_OPTIONS = {
8
+ strokeColor: '#000000',
9
+ strokeOpacity: 0.8,
10
+ strokeWeight: 1,
11
+ fillColor: '#808080',
12
+ fillOpacity: 0.25,
13
+ clickable: false,
14
+ draggable: false,
15
+ editable: false,
16
+ visible: true,
17
+ radius: 30000,
18
+ zIndex: 1
19
+ };
20
+ const DEFAULT_POSITION = exports.DEFAULT_POSITION = {
21
+ lat: 52.067450969671796,
22
+ lng: 7.017417
23
+ };
24
+ //# sourceMappingURL=positionInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionInput.js","names":["DEFAULT_POLYGON_OPTIONS","exports","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","clickable","draggable","editable","visible","radius","zIndex","DEFAULT_POSITION","lat","lng"],"sources":["../../src/constants/positionInput.ts"],"sourcesContent":["import type { PolygonOptions, Position } from '../types/positionInput';\n\nexport const DEFAULT_POLYGON_OPTIONS: PolygonOptions = {\n strokeColor: '#000000',\n strokeOpacity: 0.8,\n strokeWeight: 1,\n fillColor: '#808080',\n fillOpacity: 0.25,\n clickable: false,\n draggable: false,\n editable: false,\n visible: true,\n radius: 30000,\n zIndex: 1,\n};\n\nexport const DEFAULT_POSITION: Position = {\n lat: 52.067450969671796,\n lng: 7.017417,\n};\n"],"mappings":";;;;;;AAEO,MAAMA,uBAAuC,GAAAC,OAAA,CAAAD,uBAAA,GAAG;EACnDE,WAAW,EAAE,SAAS;EACtBC,aAAa,EAAE,GAAG;EAClBC,YAAY,EAAE,CAAC;EACfC,SAAS,EAAE,SAAS;EACpBC,WAAW,EAAE,IAAI;EACjBC,SAAS,EAAE,KAAK;EAChBC,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,KAAK;EACfC,OAAO,EAAE,IAAI;EACbC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE;AACZ,CAAC;AAEM,MAAMC,gBAA0B,GAAAZ,OAAA,CAAAY,gBAAA,GAAG;EACtCC,GAAG,EAAE,kBAAkB;EACvBC,GAAG,EAAE;AACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type EffectCallback } from 'react';
2
+ export declare const useDeepCompareEffectForMaps: (callback: EffectCallback, dependencies: any[]) => void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useDeepCompareEffectForMaps = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _fastEquals = require("fast-equals");
9
+ var _typescriptGuards = require("@googlemaps/typescript-guards");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ // Note do not touch!
13
+
14
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
15
+ // @ts-ignore
16
+ const deepCompareEqualsForMaps = (0, _fastEquals.createCustomEqual)(deepEqual => (a, b) => {
17
+ if ((0, _typescriptGuards.isLatLngLiteral)(a) || a instanceof google.maps.LatLng || (0, _typescriptGuards.isLatLngLiteral)(b) || b instanceof google.maps.LatLng) {
18
+ return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
19
+ }
20
+
21
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
22
+ return deepEqual(a, b);
23
+ });
24
+ const useDeepCompareMemoize = value => {
25
+ const ref = _react.default.useRef();
26
+ if (!deepCompareEqualsForMaps(value, ref.current)) {
27
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
28
+ ref.current = value;
29
+ }
30
+ return ref.current;
31
+ };
32
+ const useDeepCompareEffectForMaps = (callback, dependencies) => {
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ (0, _react.useEffect)(callback, dependencies.map(useDeepCompareMemoize));
35
+ };
36
+ exports.useDeepCompareEffectForMaps = useDeepCompareEffectForMaps;
37
+ //# sourceMappingURL=positionInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionInput.js","names":["_react","_interopRequireWildcard","require","_fastEquals","_typescriptGuards","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","deepCompareEqualsForMaps","createCustomEqual","deepEqual","b","isLatLngLiteral","google","maps","LatLng","equals","useDeepCompareMemoize","value","ref","React","useRef","current","useDeepCompareEffectForMaps","callback","dependencies","useEffect","map","exports"],"sources":["../../src/hooks/positionInput.tsx"],"sourcesContent":["import React, { type EffectCallback, useEffect } from 'react';\nimport { createCustomEqual } from 'fast-equals';\nimport { isLatLngLiteral } from '@googlemaps/typescript-guards';\n\n// Note do not touch!\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nconst deepCompareEqualsForMaps = createCustomEqual((deepEqual) => (a, b) => {\n if (\n isLatLngLiteral(a) ||\n a instanceof google.maps.LatLng ||\n isLatLngLiteral(b) ||\n b instanceof google.maps.LatLng\n ) {\n return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return\n return deepEqual(a, b);\n});\n\nconst useDeepCompareMemoize = (value: any) => {\n const ref = React.useRef();\n\n if (!deepCompareEqualsForMaps(value, ref.current)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ref.current = value;\n }\n\n return ref.current;\n};\n\nexport const useDeepCompareEffectForMaps = (callback: EffectCallback, dependencies: any[]) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(callback, dependencies.map(useDeepCompareMemoize));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAAgE,SAA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AACd,CAAC,CAAC,IAClBA,CAAC,YAAYe,MAAM,CAACC,IAAI,CAACC,MAAM,IAC/B,IAAAH,iCAAe,EAACD,CAAC,CAAC,IAClBA,CAAC,YAAYE,MAAM,CAACC,IAAI,CAACC,MAAM,EACjC;IACE,OAAO,IAAIF,MAAM,CAACC,IAAI,CAACC,MAAM,CAACjB,CAAC,CAAC,CAACkB,MAAM,CAAC,IAAIH,MAAM,CAACC,IAAI,CAACC,MAAM,CAACJ,CAAC,CAAC,CAAC;EACtE;;EAEA;EACA,OAAOD,SAAS,CAACZ,CAAC,EAAEa,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAMM,qBAAqB,GAAIC,KAAU,IAAK;EAC1C,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAC,CAAC;EAE1B,IAAI,CAACb,wBAAwB,CAACU,KAAK,EAAEC,GAAG,CAACG,OAAO,CAAC,EAAE;IAC/C;IACAH,GAAG,CAACG,OAAO,GAAGJ,KAAK;EACvB;EAEA,OAAOC,GAAG,CAACG,OAAO;AACtB,CAAC;AAEM,MAAMC,2BAA2B,GAAGA,CAACC,QAAwB,EAAEC,YAAmB,KAAK;EAC1F;EACA,IAAAC,gBAAS,EAACF,QAAQ,EAAEC,YAAY,CAACE,GAAG,CAACV,qBAAqB,CAAC,CAAC;AAChE,CAAC;AAACW,OAAA,CAAAL,2BAAA,GAAAA,2BAAA"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as PositionInput } from './components/position-input/PositionInput';
2
+ export type { PolygonOptions, Position, IMarker as Marker } from './types/positionInput';
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "PositionInput", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _PositionInput.default;
10
+ }
11
+ });
12
+ var _PositionInput = _interopRequireDefault(require("./components/position-input/PositionInput"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_PositionInput","_interopRequireDefault","require","obj","__esModule","default"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as PositionInput } from './components/position-input/PositionInput';\nexport type { PolygonOptions, Position, IMarker as Marker } from './types/positionInput';\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAqF,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -0,0 +1,21 @@
1
+ export interface PolygonOptions {
2
+ strokeColor: string;
3
+ strokeOpacity: number;
4
+ strokeWeight: number;
5
+ fillColor: string;
6
+ fillOpacity: number;
7
+ clickable: boolean;
8
+ draggable: boolean;
9
+ editable: boolean;
10
+ visible: boolean;
11
+ radius: number;
12
+ zIndex: number;
13
+ }
14
+ export interface Position {
15
+ lat: number;
16
+ lng: number;
17
+ }
18
+ export interface IMarker {
19
+ position: Position;
20
+ id: number;
21
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=positionInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionInput.js","names":[],"sources":["../../src/types/positionInput.ts"],"sourcesContent":["export interface PolygonOptions {\n strokeColor: string;\n strokeOpacity: number;\n strokeWeight: number;\n fillColor: string;\n fillOpacity: number;\n clickable: boolean;\n draggable: boolean;\n editable: boolean;\n visible: boolean;\n radius: number;\n zIndex: number;\n}\n\nexport interface Position {\n lat: number;\n lng: number;\n}\n\nexport interface IMarker {\n position: Position;\n id: number;\n}\n"],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@chayns-components/maps",
3
+ "version": "5.0.0-beta.433",
4
+ "description": "A set of beautiful React components for developing your own applications with chayns.",
5
+ "keywords": [
6
+ "chayns",
7
+ "react",
8
+ "components"
9
+ ],
10
+ "author": "Tobit.Software",
11
+ "homepage": "https://github.com/TobitSoftware/chayns-components/tree/main/packages/maps#readme",
12
+ "license": "MIT",
13
+ "main": "lib/index.js",
14
+ "types": "lib/index.d.ts",
15
+ "directories": {
16
+ "lib": "lib",
17
+ "test": "__tests__"
18
+ },
19
+ "files": [
20
+ "lib"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/TobitSoftware/chayns-components.git"
25
+ },
26
+ "scripts": {
27
+ "build": "npm run build:js && npm run build:types",
28
+ "build:js": "babel src --out-dir lib --extensions=.ts,.tsx --source-maps --ignore=src/stories",
29
+ "build:types": "tsc",
30
+ "prepublishOnly": "npm run build"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/TobitSoftware/chayns-components/issues"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/cli": "^7.23.4",
37
+ "@babel/core": "^7.23.7",
38
+ "@babel/preset-env": "^7.23.8",
39
+ "@babel/preset-react": "^7.23.3",
40
+ "@babel/preset-typescript": "^7.23.3",
41
+ "@types/google.maps": "^3.55.1",
42
+ "@types/react": "^18.2.48",
43
+ "@types/react-dom": "^18.2.18",
44
+ "@types/styled-components": "^5.1.34",
45
+ "@types/uuid": "^9.0.7",
46
+ "babel-loader": "^9.1.3",
47
+ "lerna": "^8.0.2",
48
+ "react": "^18.2.0",
49
+ "react-dom": "^18.2.0",
50
+ "styled-components": "^6.1.8",
51
+ "typescript": "^5.3.3"
52
+ },
53
+ "dependencies": {
54
+ "@chayns-components/core": "^5.0.0-beta.433",
55
+ "@googlemaps/react-wrapper": "^1.1.35",
56
+ "@googlemaps/typescript-guards": "^2.0.3",
57
+ "@react-google-maps/api": "^2.19.2",
58
+ "fast-equals": "^5.0.1"
59
+ },
60
+ "peerDependencies": {
61
+ "react": ">=16.14.0",
62
+ "react-dom": ">=16.14.0",
63
+ "styled-components": "^5.3.11"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "gitHead": "c7d263ad6fb63db654408f2b56f15e6b04ab8f76"
69
+ }