@chayns-components/maps 5.0.0-beta.1000

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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/lib/cjs/components/position-input/PositionInput.js +38 -0
  4. package/lib/cjs/components/position-input/PositionInput.js.map +1 -0
  5. package/lib/cjs/components/position-input/PositionInput.styles.js +19 -0
  6. package/lib/cjs/components/position-input/PositionInput.styles.js.map +1 -0
  7. package/lib/cjs/components/position-input/map-wrapper/MapWrapper.js +180 -0
  8. package/lib/cjs/components/position-input/map-wrapper/MapWrapper.js.map +1 -0
  9. package/lib/cjs/components/position-input/map-wrapper/MapWrapper.styles.js +12 -0
  10. package/lib/cjs/components/position-input/map-wrapper/MapWrapper.styles.js.map +1 -0
  11. package/lib/cjs/components/position-input/map-wrapper/map/Map.js +97 -0
  12. package/lib/cjs/components/position-input/map-wrapper/map/Map.js.map +1 -0
  13. package/lib/cjs/components/position-input/map-wrapper/map/Map.styles.js +13 -0
  14. package/lib/cjs/components/position-input/map-wrapper/map/Map.styles.js.map +1 -0
  15. package/lib/cjs/components/position-input/map-wrapper/map/marker/Marker.js +66 -0
  16. package/lib/cjs/components/position-input/map-wrapper/map/marker/Marker.js.map +1 -0
  17. package/lib/cjs/constants/positionInput.js +24 -0
  18. package/lib/cjs/constants/positionInput.js.map +1 -0
  19. package/lib/cjs/hooks/positionInput.js +37 -0
  20. package/lib/cjs/hooks/positionInput.js.map +1 -0
  21. package/lib/cjs/index.js +14 -0
  22. package/lib/cjs/index.js.map +1 -0
  23. package/lib/cjs/types/positionInput.js +2 -0
  24. package/lib/cjs/types/positionInput.js.map +1 -0
  25. package/lib/esm/components/position-input/PositionInput.js +34 -0
  26. package/lib/esm/components/position-input/PositionInput.js.map +1 -0
  27. package/lib/esm/components/position-input/PositionInput.styles.js +12 -0
  28. package/lib/esm/components/position-input/PositionInput.styles.js.map +1 -0
  29. package/lib/esm/components/position-input/map-wrapper/MapWrapper.js +170 -0
  30. package/lib/esm/components/position-input/map-wrapper/MapWrapper.js.map +1 -0
  31. package/lib/esm/components/position-input/map-wrapper/MapWrapper.styles.js +5 -0
  32. package/lib/esm/components/position-input/map-wrapper/MapWrapper.styles.js.map +1 -0
  33. package/lib/esm/components/position-input/map-wrapper/map/Map.js +89 -0
  34. package/lib/esm/components/position-input/map-wrapper/map/Map.js.map +1 -0
  35. package/lib/esm/components/position-input/map-wrapper/map/Map.styles.js +6 -0
  36. package/lib/esm/components/position-input/map-wrapper/map/Map.styles.js.map +1 -0
  37. package/lib/esm/components/position-input/map-wrapper/map/marker/Marker.js +60 -0
  38. package/lib/esm/components/position-input/map-wrapper/map/marker/Marker.js.map +1 -0
  39. package/lib/esm/constants/positionInput.js +18 -0
  40. package/lib/esm/constants/positionInput.js.map +1 -0
  41. package/lib/esm/hooks/positionInput.js +29 -0
  42. package/lib/esm/hooks/positionInput.js.map +1 -0
  43. package/lib/esm/index.js +3 -0
  44. package/lib/esm/index.js.map +1 -0
  45. package/lib/esm/types/positionInput.js +2 -0
  46. package/lib/esm/types/positionInput.js.map +1 -0
  47. package/lib/types/components/position-input/PositionInput.d.ts +42 -0
  48. package/lib/types/components/position-input/PositionInput.styles.d.ts +2 -0
  49. package/lib/types/components/position-input/map-wrapper/MapWrapper.d.ts +14 -0
  50. package/lib/types/components/position-input/map-wrapper/MapWrapper.styles.d.ts +1 -0
  51. package/lib/types/components/position-input/map-wrapper/map/Map.d.ts +15 -0
  52. package/lib/types/components/position-input/map-wrapper/map/Map.styles.d.ts +1 -0
  53. package/lib/types/components/position-input/map-wrapper/map/marker/Marker.d.ts +12 -0
  54. package/lib/types/constants/positionInput.d.ts +3 -0
  55. package/lib/types/hooks/positionInput.d.ts +2 -0
  56. package/lib/types/index.d.ts +2 -0
  57. package/lib/types/types/positionInput.d.ts +21 -0
  58. package/package.json +90 -0
@@ -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,2 @@
1
+ export declare const StyledPositionInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
+ export declare const StyledPositionInputSearch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -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 @@
1
+ export declare const StyledMapWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,15 @@
1
+ import { FC, type ReactElement } from 'react';
2
+ import type { Position } from '../../../../types/positionInput';
3
+ export type MapProps = {
4
+ onClick: (event: google.maps.MapMouseEvent) => void;
5
+ onIdle: (event: google.maps.Map) => void;
6
+ onPositionChange: (position: Position) => void;
7
+ children: ReactElement;
8
+ center: Position;
9
+ zoom: number;
10
+ fullscreenControl: boolean;
11
+ mapTypeControl: boolean;
12
+ streetViewControl: boolean;
13
+ };
14
+ declare const Map: FC<MapProps>;
15
+ export default Map;
@@ -0,0 +1 @@
1
+ export declare const StyledMap: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import type { IMarker, Position } from '../../../../../types/positionInput';
3
+ export type MarkerProps = {
4
+ id: number;
5
+ position: Position;
6
+ isDraggable: boolean;
7
+ onChange: (marker: IMarker) => void;
8
+ onRemove: (id: number) => void;
9
+ map?: google.maps.Map;
10
+ };
11
+ declare const Marker: FC<MarkerProps>;
12
+ export default Marker;
@@ -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,2 @@
1
+ import { type EffectCallback } from 'react';
2
+ export declare const useDeepCompareEffectForMaps: (callback: EffectCallback, dependencies: any[]) => void;
@@ -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';
@@ -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
+ }
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@chayns-components/maps",
3
+ "version": "5.0.0-beta.1000",
4
+ "description": "A set of beautiful React components for developing your own applications with chayns.",
5
+ "sideEffects": false,
6
+ "browserslist": [
7
+ ">0.5%",
8
+ "not dead",
9
+ "not op_mini all",
10
+ "not IE 11"
11
+ ],
12
+ "keywords": [
13
+ "chayns",
14
+ "react",
15
+ "components"
16
+ ],
17
+ "author": "Tobit.Software",
18
+ "homepage": "https://github.com/TobitSoftware/chayns-components/tree/main/packages/maps#readme",
19
+ "license": "MIT",
20
+ "types": "lib/types/index.d.ts",
21
+ "main": "lib/cjs/index.js",
22
+ "module": "lib/esm/index.js",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./lib/types/index.d.ts",
26
+ "require": "./lib/cjs/index.js",
27
+ "import": "./lib/esm/index.js"
28
+ }
29
+ },
30
+ "directories": {
31
+ "lib": "lib",
32
+ "test": "__tests__"
33
+ },
34
+ "files": [
35
+ "lib"
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/TobitSoftware/chayns-components.git"
40
+ },
41
+ "scripts": {
42
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
43
+ "build:types": "tsc",
44
+ "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir lib/cjs --extensions=.ts,.tsx --source-maps --ignore=src/stories",
45
+ "build:esm": "cross-env NODE_ENV=esm babel src --out-dir lib/esm --extensions=.ts,.tsx --source-maps --ignore=src/stories",
46
+ "prepublishOnly": "npm run build",
47
+ "watch:js": "npm run build:esm -- --watch",
48
+ "link": "npm link && npm run watch:js"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/TobitSoftware/chayns-components/issues"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/cli": "^7.26.4",
55
+ "@babel/core": "^7.26.0",
56
+ "@babel/preset-env": "^7.26.0",
57
+ "@babel/preset-react": "^7.26.3",
58
+ "@babel/preset-typescript": "^7.26.0",
59
+ "@types/google.maps": "^3.58.1",
60
+ "@types/react": "^18.3.18",
61
+ "@types/react-dom": "^18.3.5",
62
+ "@types/styled-components": "^5.1.34",
63
+ "@types/uuid": "^10.0.0",
64
+ "babel-loader": "^9.2.1",
65
+ "cross-env": "^7.0.3",
66
+ "lerna": "^8.1.9",
67
+ "react": "^18.3.1",
68
+ "react-dom": "^18.3.1",
69
+ "styled-components": "^6.1.14",
70
+ "typescript": "^5.7.3"
71
+ },
72
+ "dependencies": {
73
+ "@chayns-components/core": "^5.0.0-beta.1000",
74
+ "@googlemaps/react-wrapper": "^1.1.42",
75
+ "@googlemaps/typescript-guards": "^2.0.3",
76
+ "@react-google-maps/api": "^2.20.5",
77
+ "fast-equals": "^5.2.2"
78
+ },
79
+ "peerDependencies": {
80
+ "chayns-api": ">=2.0.0",
81
+ "framer-motion": ">=10.18.0",
82
+ "react": ">=18.0.0",
83
+ "react-dom": ">=18.0.0",
84
+ "styled-components": ">=5.3.11"
85
+ },
86
+ "publishConfig": {
87
+ "access": "public"
88
+ },
89
+ "gitHead": "d456c0b87862a3be7d764ba0f16e0b96b22ac2a8"
90
+ }