utopia-ui 1.0.4 → 1.0.7

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/README.md CHANGED
@@ -15,31 +15,81 @@ Map UI is a JavaScript Map Library to create nice and easy to use Maps
15
15
 
16
16
  ### Getting Started
17
17
 
18
+
18
19
  install via npm
19
- ```
20
+ ```bash
20
21
  npm install utopia-ui
21
22
  ```
22
23
 
23
- import in your React App
24
-
25
- ```
26
- import Map from 'utopia-ui'
24
+ then import in your React App
25
+ ```jsx
26
+ import UtopiaMap from 'utopia-ui'
27
27
  ```
28
28
 
29
- use the Map UI Component
30
-
31
- ```
32
- <Map height='100vh' width='100hw'></Map>
29
+ use the [Map UI Component](/docs/utopia-ui/map-components/map)
30
+ ```jsx
31
+ <UtopiaMap>
32
+ height='360px'
33
+ width='100vw'
34
+ center={[51.3, 9.6]}
35
+ zoom={6}
36
+ places={places}
37
+ events={events}
38
+ tags = {tags}
39
+ </UtopiaMap>
33
40
  ```
41
+ You can find some Sample Data (places, events, tags) for test purpose below
34
42
 
35
43
  ### Options
36
44
 
37
45
 
38
- Option | Type | Default | Description
39
- --- | --- | --- | ---
40
- height | string | - | height of the map
41
- width | string | - | width of the map
46
+ Option | Type | Default | Required | Description
47
+ --- | --- | --- | --- | ---
48
+ `height` | `string` |`'400px'` | No | height of the map
49
+ `width` | `string` |`'100vw'` | No | width of the map
50
+ `center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
51
+ `zoom` | `number` |`10` | No | initial zoom level
52
+ `places` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| | No | Array with Items
53
+ `events` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| | No | Array with Items
54
+ `tags` | [`Tag[]`](https://utopia-os.org/docs/utopia-ui/map-components/tag) | | No | Array with Tags
55
+
56
+ ### Sample Data
57
+ ```jsx
58
+ const places = [{
59
+ "id": 51,
60
+ "name": "Stadtgemüse",
61
+ "text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de",
62
+ "position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
63
+ "tags": [9,13],
64
+ },
65
+ {
66
+ "id": 166,
67
+ "name": "Weidendom",
68
+ "text": "free camping",
69
+ "position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
70
+ "tags": [10,11]
71
+ }];
72
+
73
+ const events = [
74
+ {
75
+ "id": 423,
76
+ "name": "Hackathon",
77
+ "text": "still in progress",
78
+ "position": { "type": "Point", "coordinates": [9.5, 50.62] },
79
+ "start": "2022-03-25T12:00:00",
80
+ "end": "2022-05-12T12:00:00",
81
+ "tags": [10]
82
+ }
83
+ ]
84
+
85
+ const tags = [
86
+ {"id": 9, "name": "Gardening", "color": "#008e5b" },
87
+ {"id": 10, "name": "Art", "color": "#fdc60b" },
88
+ {"id": 11, "name": "Nature", "color": "#8cbb26" },
89
+ {"id": 13, "name": "Market", "color": "#2a71b0" }
90
+ ]
42
91
 
92
+ ```
43
93
 
44
94
  ## Coming Soon
45
95
 
@@ -1,28 +1,8 @@
1
1
  /// <reference types="react" />
2
- export interface IMarkerPopupProps {
3
- item: IMapItem;
2
+ import { Item, Tag } from '../../types';
3
+ export interface MarkerPopupProps {
4
+ item: Item;
5
+ tags: Tag[];
4
6
  }
5
- export interface IMapItem {
6
- id?: string;
7
- date_created?: string;
8
- date_updated?: string | null;
9
- name: string;
10
- text: string;
11
- position: IGeometry;
12
- start?: string;
13
- end?: string;
14
- tags: ITag[];
15
- [key: string]: any;
16
- }
17
- export interface IGeometry {
18
- type: string;
19
- coordinates: number[];
20
- }
21
- export interface ITag {
22
- Tags_id: {
23
- color: string;
24
- id: string;
25
- };
26
- }
27
- declare const MarkerPopup: (props: IMarkerPopupProps) => JSX.Element;
7
+ declare const MarkerPopup: (props: MarkerPopupProps) => JSX.Element;
28
8
  export default MarkerPopup;
@@ -0,0 +1 @@
1
+ export declare const StringFormater: (message: string) => string;
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import "leaflet/dist/leaflet.css";
3
- import { IMapItem } from "./Components/Map/MarkerPopup";
3
+ import { Item, Tag } from "./types";
4
4
  import "./styles.scss";
5
- export interface IMapProps {
5
+ import { LatLng } from "leaflet";
6
+ export interface MapProps {
6
7
  height: string;
7
8
  width: string;
8
- center: number[];
9
+ center: LatLng;
9
10
  zoom: number;
10
- places?: IMapItem[];
11
- events?: IMapItem[];
12
- children?: any;
13
- data?: any;
11
+ places?: Item[];
12
+ events?: Item[];
13
+ tags?: Tag[];
14
14
  }
15
- declare const Map: (props: IMapProps) => JSX.Element;
16
- export default Map;
15
+ declare const UtopiaMap: (props: MapProps) => JSX.Element;
16
+ export { UtopiaMap, Item, Tag };
package/dist/index.js CHANGED
@@ -17,6 +17,9 @@ var reactLeaflet = require('react-leaflet');
17
17
  require('leaflet/dist/leaflet.css');
18
18
  var React = require('react');
19
19
  var L = require('leaflet');
20
+ var MarkerClusterGroup = require('react-leaflet-cluster');
21
+
22
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
23
 
21
24
  function _interopNamespace(e) {
22
25
  if (e && e.__esModule) return e;
@@ -38,6 +41,7 @@ function _interopNamespace(e) {
38
41
 
39
42
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
43
  var L__namespace = /*#__PURE__*/_interopNamespace(L);
44
+ var MarkerClusterGroup__default = /*#__PURE__*/_interopDefaultLegacy(MarkerClusterGroup);
41
45
 
42
46
  var createSvg = function (shape, markerColor, borderColor) {
43
47
  var svgMap = {
@@ -71,32 +75,96 @@ var MarkerIconFactory = function (shape, color1, color2, icon) {
71
75
 
72
76
  var MarkerPopup = function (props) {
73
77
  var item = props.item;
74
- return (React__namespace.createElement(reactLeaflet.Popup, null,
78
+ var tags = props.tags;
79
+ return (React__namespace.createElement(reactLeaflet.Popup, { maxHeight: 377, minWidth: 275, maxWidth: 275, autoPanPadding: [30, 30] },
75
80
  React__namespace.createElement("b", { style: { fontSize: '1.0rem' } }, item.name),
76
- React__namespace.createElement("p", null,
77
- item.start || "",
78
- " ",
79
- item.end || ""),
80
- React__namespace.createElement("p", null, item.text),
81
- item.tags.map(function (tag) { return (React__namespace.createElement("span", { key: tag.Tags_id.id },
82
- "#",
83
- tag.Tags_id.id,
84
- " ")); })));
85
- };
81
+ item.start && item.end &&
82
+ React__namespace.createElement("p", null,
83
+ new Date(item.start).toISOString().substring(0, 10) || "",
84
+ " - ",
85
+ new Date(item.end).toISOString().substring(0, 10) || ""),
86
+ React__namespace.createElement("p", { style: { whiteSpace: "pre-wrap" }, dangerouslySetInnerHTML: { __html: replaceURLs(item.text) } }),
87
+ React__namespace.createElement("p", null, item.tags &&
88
+ tags.map(function (tag) { return (React__namespace.createElement("span", { className: "", style: { fontWeight: "bold", display: "inline-block", color: "#fff", padding: ".2rem", borderRadius: ".2rem", backgroundColor: tag.color, margin: '.2rem', fontSize: "100%" }, key: tag.id },
89
+ "#",
90
+ tag.name)); }))));
91
+ };
92
+ function replaceURLs(message) {
93
+ if (!message)
94
+ return "";
95
+ var urlRegex = /(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm;
96
+ message = message.replace(urlRegex, function (url) {
97
+ var hyperlink = url.replace(' ', '');
98
+ if (!hyperlink.match('^https?:\/\/')) {
99
+ hyperlink = 'http://' + hyperlink;
100
+ }
101
+ return '<a href="' + hyperlink + '" target="_blank" rel="noopener noreferrer">' + url + '</a>';
102
+ });
103
+ var mailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi;
104
+ message = message.replace(mailRegex, function (mail) {
105
+ return '<a href="mailto:' + mail + '">' + mail + '</a>';
106
+ });
107
+ return message;
108
+ }
86
109
 
87
110
  ___$insertStyle(".leaflet-data-marker {\n background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAQCAYAAACcN8ZaAAAB3klEQVR42s3U4UdDURzG8czMXJnJ1Vwzc6VJZjaZJdlMlpQsKdmUFNOUspRSSqUolfQfr+fF98Vx5mwv9qbDx7LdznnO7/7Omej3+/+Ga0QMUYkhbvBgmhzCQxwxibIGrGEF8CQhU+LLtKQkQNqScUgjxRxTBIxbgfgD/BgnhM8kM5KTeclLQYqGkkMRBckzR8ic/mAgd5BAZplsUaqyIg2sDtHg2brUZJk5SmwopErJUWE8SpmTMhNvya60Zd/SNrR4bkeaskG4uiwRZk6yrJEYFibGAxn+scECHTmTnuVCzvmty3PHciB7bGKN6lQkzysPqIrHmpFhYbKUtckC1/Ioz4ZHuZdbuSLYiRxRpSZVWXZVxAzC0R4Ik5SQsu6w8yd5l2/5kg95I9SdXMoZQfYIUjeqEUrgOkXGPeN4TYRhxy8E+ZUf+eS7B7miIoeybVSjKDnm8u3+gH3pDTYwu1igATvs/pXqvBKiR4i2bNJfi1ZfUAnjgrOG8wY2quNzBKuU/ZS+uSFEl5O0xRGuUIlZCcw7xG5QPkeHYUSNV5WXGou2sC3rBC0LjenqCXGO0WEiTJa0Lr4KixdHBrDGuGGiRqCUpFk8pGIpQtCU7p4YPwxYxEMCk1aAMQZh8Ac8PfbIzYPJOwAAAABJRU5ErkJggg==\") no-repeat;\n background-position: 6px 32px;\n}");
88
111
 
89
- var Map = function (props) {
90
- return (React__namespace.createElement(reactLeaflet.MapContainer, { style: { height: props.height, width: props.width }, center: props.center, zoom: props.zoom },
112
+ var UtopiaMap = function (props) {
113
+ var _a;
114
+ var center = new L.LatLng(50.6, 9.5);
115
+ if (props.center)
116
+ center = props.center;
117
+ var zoom = 10;
118
+ if (props.zoom)
119
+ zoom = props.zoom;
120
+ var height = "400px";
121
+ if (props.height)
122
+ height = props.height;
123
+ var width = "100vw";
124
+ if (props.width)
125
+ width = props.width;
126
+ var tagMap = new Map((_a = props.tags) === null || _a === void 0 ? void 0 : _a.map(function (key) { return [key.id, key]; }));
127
+ var getTags = function (item) {
128
+ var tags = [];
129
+ item.tags && item.tags.forEach(function (element) {
130
+ if (tagMap.has(element)) {
131
+ tags.push(tagMap.get(element));
132
+ }
133
+ });
134
+ return tags;
135
+ };
136
+ return (React__namespace.createElement(reactLeaflet.MapContainer, { style: { height: height, width: width }, center: center, zoom: zoom },
91
137
  React__namespace.createElement(reactLeaflet.TileLayer, { attribution: '\u00A9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }),
92
- React__namespace.createElement(reactLeaflet.LayersControl, { position: "topright" },
93
- React__namespace.createElement(reactLeaflet.LayersControl.Overlay, { checked: true, name: "Places" }, props.places &&
94
- (props.places).map(function (place) { return (React__namespace.createElement(reactLeaflet.Marker, { icon: MarkerIconFactory('circle', '#f18e1c', 'RGBA(35, 31, 32, 0.2)', 'circle-solid'), key: place.id, position: [place.position.coordinates[1], place.position.coordinates[0]] },
95
- React__namespace.createElement(MarkerPopup, { item: place }))); })),
96
- React__namespace.createElement(reactLeaflet.LayersControl.Overlay, { checked: true, name: "Events" }, props.events &&
97
- (props.events).map(function (event) { return (React__namespace.createElement(reactLeaflet.Marker, { icon: MarkerIconFactory('square', '#6d398b', 'RGBA(35, 31, 32, 0.2)', 'calendar-days-solid'), key: event.id, position: [event.position.coordinates[1], event.position.coordinates[0]] },
98
- React__namespace.createElement(MarkerPopup, { item: event }))); })))));
138
+ React__namespace.createElement(MarkerClusterGroup__default["default"], { showCoverageOnHover: true, chunkedLoading: true, maxClusterRadius: 50 },
139
+ props.places &&
140
+ props.places.map(function (place) {
141
+ var tags = getTags(place);
142
+ var color1 = "#666";
143
+ var color2 = "RGBA(35, 31, 32, 0.2)";
144
+ if (tags[0]) {
145
+ color1 = tags[0].color;
146
+ }
147
+ if (tags[1]) {
148
+ color2 = tags[1].color;
149
+ }
150
+ return (React__namespace.createElement(reactLeaflet.Marker, { icon: MarkerIconFactory('circle', color1, color2, 'circle-solid'), key: place.id, position: [place.position.coordinates[1], place.position.coordinates[0]] },
151
+ React__namespace.createElement(MarkerPopup, { item: place, tags: tags })));
152
+ }),
153
+ props.events &&
154
+ props.events.map(function (event) {
155
+ var tags = getTags(event);
156
+ var color1 = "#666";
157
+ var color2 = "RGBA(35, 31, 32, 0.2)";
158
+ if (tags[0]) {
159
+ color1 = tags[0].color;
160
+ }
161
+ if (tags[1]) {
162
+ color2 = tags[1].color;
163
+ }
164
+ return (React__namespace.createElement(reactLeaflet.Marker, { icon: MarkerIconFactory('square', color1, color2, 'calendar-days-solid'), key: event.id, position: [event.position.coordinates[1], event.position.coordinates[0]] },
165
+ React__namespace.createElement(MarkerPopup, { item: event, tags: tags })));
166
+ }))));
99
167
  };
100
168
 
101
- exports["default"] = Map;
169
+ exports.UtopiaMap = UtopiaMap;
102
170
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Utils/MarkerIconFactory.ts","../src/Components/Map/MarkerPopup.tsx","../src/index.tsx"],"sourcesContent":["import * as L from 'leaflet';\n\nconst createSvg = (shape:string, markerColor:string, borderColor:string) => {\n var svgMap = {\n circle: '<svg width=\"32\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.5 2.746c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.439-17.863.056-.08a15.422 15.422 0 002.343-6.112c.123-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307\" fill=\"' + markerColor + '\" /><path d=\"M17.488 2.748c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.44-17.863.055-.08a15.422 15.422 0 002.343-6.112c.124-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307m0 1.071c7.68 0 13.929 6.386 13.929 14.236 0 .685-.064 1.423-.193 2.258-.325 2.075-1.059 3.99-2.164 5.667l-.055.078-11.557 16.595L6.032 26.14l-.12-.174a14.256 14.256 0 01-2.105-5.29 14.698 14.698 0 01-.247-2.62c0-7.851 6.249-14.237 13.928-14.237\" fill=\"' + borderColor + '\" opacity=\"1\" /></svg>',\n square: '<svg width=\"33\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M28.205 3.217H6.777c-2.367 0-4.286 1.87-4.286 4.179v19.847c0 2.308 1.919 4.179 4.286 4.179h5.357l5.337 13.58 5.377-13.58h5.357c2.366 0 4.285-1.87 4.285-4.179V7.396c0-2.308-1.919-4.179-4.285-4.179\" fill=\"' + markerColor + '\" /><g opacity=\"1\" transform=\"matrix(1.0714 0 0 -1.0714 -233.22 146.783)\"><path d=\"M244 134h-20c-2.209 0-4-1.746-4-3.9v-18.525c0-2.154 1.791-3.9 4-3.9h5L233.982 95 239 107.675h5c2.209 0 4 1.746 4 3.9V130.1c0 2.154-1.791 3.9-4 3.9m0-1c1.654 0 3-1.301 3-2.9v-18.525c0-1.599-1.346-2.9-3-2.9h-5.68l-.25-.632-4.084-10.318-4.055 10.316-.249.634H224c-1.654 0-3 1.301-3 2.9V130.1c0 1.599 1.346 2.9 3 2.9h20\" fill=\"'+ borderColor +'\" /></g></svg>',\n star: '<svg width=\"34\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M32.92 16.93l-3.525-3.525V8.419a1.983 1.983 0 00-1.983-1.982h-4.985L18.9 2.91a1.984 1.984 0 00-2.803 0l-3.524 3.526H7.588a1.983 1.983 0 00-1.982 1.982v4.986L2.081 16.93a1.982 1.982 0 000 2.803l3.525 3.526v4.984c0 1.096.888 1.983 1.982 1.983h4.986L17.457 45l4.97-14.773h4.985a1.983 1.983 0 001.983-1.983V23.26l3.525-3.526a1.982 1.982 0 000-2.803\" fill=\"' + markerColor + '\" /><g opacity=\".15\" transform=\"matrix(1.0667 0 0 -1.0667 -347.3 97.26)\"><path d=\"M342 89c-.476 0-.951-.181-1.314-.544l-3.305-3.305h-4.673a1.858 1.858 0 01-1.859-1.858v-4.674l-3.305-3.305a1.857 1.857 0 010-2.627l3.305-3.305v-4.674a1.86 1.86 0 011.859-1.859h4.673L341.959 49l4.659 13.849h4.674a1.86 1.86 0 011.859 1.859v4.674l3.305 3.305a1.858 1.858 0 010 2.627l-3.305 3.305v4.674a1.859 1.859 0 01-1.859 1.858h-4.674l-3.304 3.305A1.851 1.851 0 01342 89m0-1a.853.853 0 00.607-.251l3.304-3.305.293-.293h5.088a.86.86 0 00.859-.858v-5.088l3.598-3.598A.852.852 0 00356 74a.85.85 0 00-.251-.606l-3.598-3.598v-5.088a.86.86 0 00-.859-.859h-5.393l-.229-.681-3.702-11.006-3.637 11.001-.227.686h-5.396a.86.86 0 00-.859.859v5.088l-3.598 3.598c-.162.162-.251.377-.251.606s.089.445.251.607l3.598 3.598v5.088a.86.86 0 00.859.858h5.087l3.598 3.598A.853.853 0 00342 88\" fill=\"#231f20\" /></g></svg>',\n penta: '<svg width=\"33\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.872 17.35L9.679 2.993h15.615L33.1 17.35 17.486 44.992z\" fill=\"' + markerColor + '\" /><g opacity=\".15\" transform=\"matrix(1.0769 0 0 -1.0769 -272.731 48.23)\"><path d=\"M276.75 42h-14.5L255 28.668 269.5 3 284 28.668zm-.595-1l6.701-12.323L269.5 5.033l-13.356 23.644L262.845 41z\" fill=\"#231f20\" /></g></svg>'\n };\n return svgMap[shape];\n}\n\nconst addIcon = (icon:string) => {\n switch(icon) {\n case \"circle-solid\":\n return '<svg fill=\"#fff\" style=\"position: relative; top: -38px;left: -1px;\" width=\"13\"xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d=\"M512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256z\"/></svg>';\n break;\n case \"calendar-days-solid\":\n return '<svg fill=\"#fff\" style=\"position: relative; top: -40px;left: 0px;\" width=\"13\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d=\"M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z\"/></svg>';\n break;\n default:\n return \"\";\n } \n}\n\nconst MarkerIconFactory = (shape:string, color1:string, color2:string, icon:string) =>\n{\n return L.divIcon({\n html: `${createSvg(shape, color1, color2)}${addIcon(icon)}`,\n iconAnchor: [17,40],\n popupAnchor: [0,-40],\n iconSize: new L.Point(40, 46),\n className: \"leaflet-data-marker\",\n shadowAnchor: [0, 0]\n });\n}\n\nexport default MarkerIconFactory ;\n","import * as React from 'react'\nimport { Popup } from 'react-leaflet'\n\nexport interface IMarkerPopupProps {\n item: IMapItem;\n}\n\nexport interface IMapItem {\n id?: string,\n date_created?: string,\n date_updated?: string | null,\n name: string,\n text: string,\n position: IGeometry,\n start?: string,\n end?: string,\n tags: ITag[],\n [key: string]:any\n}\n\nexport interface IGeometry {\n type: string;\n coordinates: number[];\n}\n\nexport interface ITag {\n Tags_id :\n {\n color: string;\n id: string;\n }\n}\n\nconst MarkerPopup = (props:IMarkerPopupProps) => {\n const item:IMapItem = props.item;\n return (\n <Popup>\n <b style={{ fontSize: '1.0rem' }}>{item.name}</b>\n\n <p>{item.start || \"\"} {item.end || \"\"}</p>\n\n <p>{item.text}</p>\n {item.tags.map((tag:ITag) => (\n <span key={tag.Tags_id.id}>#{tag.Tags_id.id} </span>\n ))}\n </Popup>\n )\n}\n\nexport default MarkerPopup;\n","import { TileLayer, MapContainer, Marker, LayersControl } from \"react-leaflet\";\nimport \"leaflet/dist/leaflet.css\";\nimport * as React from \"react\";\nimport MarkerIconFactory from './Utils/MarkerIconFactory';\nimport MarkerPopup, { IMapItem } from \"./Components/Map/MarkerPopup\";\nimport \"./styles.scss\"\n\nexport interface IMapProps {\n height: string,\n width: string,\n center: number[],\n zoom: number,\n places?: IMapItem[],\n events?: IMapItem[],\n children?: any,\n data?: any,\n}\n\nconst Map = (props: IMapProps) => {\n return (\n <MapContainer style={{ height: props.height, width: props.width }} center={props.center} zoom={props.zoom} >\n <TileLayer\n attribution='&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors'\n url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\" />\n <LayersControl position=\"topright\">\n <LayersControl.Overlay checked name=\"Places\">\n {props.places &&\n (props.places).map((place: IMapItem) => (\n <Marker icon={MarkerIconFactory('circle', '#f18e1c', 'RGBA(35, 31, 32, 0.2)', 'circle-solid')} key={place.id} position={[place.position.coordinates[1], place.position.coordinates[0]]}>\n <MarkerPopup item={place} />\n </Marker>\n ))\n }\n </LayersControl.Overlay>\n <LayersControl.Overlay checked name=\"Events\">\n {props.events &&\n (props.events).map((event: IMapItem) => (\n <Marker icon={MarkerIconFactory('square', '#6d398b', 'RGBA(35, 31, 32, 0.2)', 'calendar-days-solid')} key={event.id} position={[event.position.coordinates[1], event.position.coordinates[0]]}>\n <MarkerPopup item={event} />\n </Marker>\n ))\n }\n </LayersControl.Overlay>\n </LayersControl>\n </MapContainer>\n\n );\n}\n\nexport default Map;\n"],"names":["L","React","Popup","MapContainer","TileLayer","LayersControl","Marker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,SAAS,GAAG,UAAC,KAAY,EAAE,WAAkB,EAAE,WAAkB,EAAA;AACnE,IAAA,IAAI,MAAM,GAAG;QACT,MAAM,EAAE,8UAA8U,GAAG,WAAW,GAAG,qfAAqf,GAAG,WAAW,GAAG,wBAAwB;QACr4B,MAAM,EAAE,ySAAyS,GAAG,WAAW,GAAG,wZAAwZ,GAAE,WAAW,GAAE,gBAAgB;AACzvB,QAAA,IAAI,EAAI,8bAA8b,GAAG,WAAW,GAAG,i3BAAi3B;AACx0C,QAAA,KAAK,EAAG,+JAA+J,GAAG,WAAW,GAAG,8NAA8N;KACz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,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAA;oBAClLL,gBAAC,CAAA,aAAA,CAAA,WAAW,EAAC,EAAA,IAAI,EAAE,KAAK,EAAI,CAAA,CACvB,EACZ,EAAA,CAAC,CAEc;AACxB,YAAAA,gBAAA,CAAA,aAAA,CAACI,0BAAa,CAAC,OAAO,EAAA,EAAC,OAAO,EAAA,IAAA,EAAC,IAAI,EAAC,QAAQ,EAAA,EACvC,KAAK,CAAC,MAAM;gBACT,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,UAAC,KAAe,EAAA,EAAK,QACpCJ,+BAACK,mBAAM,EAAA,EAAC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,uBAAuB,EAAE,qBAAqB,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAA;AACzL,oBAAAL,gBAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAC,IAAI,EAAE,KAAK,EAAI,CAAA,CACvB,EACZ,EAAA,CAAC,CAEc,CACZ,CACL,EAEjB;AACN;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/Utils/MarkerIconFactory.ts","../src/Components/Map/MarkerPopup.tsx","../src/index.tsx"],"sourcesContent":["import * as L from 'leaflet';\n\nconst createSvg = (shape:string, markerColor:string, borderColor:string) => {\n var svgMap = {\n circle: '<svg width=\"32\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.5 2.746c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.439-17.863.056-.08a15.422 15.422 0 002.343-6.112c.123-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307\" fill=\"' + markerColor + '\" /><path d=\"M17.488 2.748c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.44-17.863.055-.08a15.422 15.422 0 002.343-6.112c.124-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307m0 1.071c7.68 0 13.929 6.386 13.929 14.236 0 .685-.064 1.423-.193 2.258-.325 2.075-1.059 3.99-2.164 5.667l-.055.078-11.557 16.595L6.032 26.14l-.12-.174a14.256 14.256 0 01-2.105-5.29 14.698 14.698 0 01-.247-2.62c0-7.851 6.249-14.237 13.928-14.237\" fill=\"' + borderColor + '\" opacity=\"1\" /></svg>',\n square: '<svg width=\"33\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M28.205 3.217H6.777c-2.367 0-4.286 1.87-4.286 4.179v19.847c0 2.308 1.919 4.179 4.286 4.179h5.357l5.337 13.58 5.377-13.58h5.357c2.366 0 4.285-1.87 4.285-4.179V7.396c0-2.308-1.919-4.179-4.285-4.179\" fill=\"' + markerColor + '\" /><g opacity=\"1\" transform=\"matrix(1.0714 0 0 -1.0714 -233.22 146.783)\"><path d=\"M244 134h-20c-2.209 0-4-1.746-4-3.9v-18.525c0-2.154 1.791-3.9 4-3.9h5L233.982 95 239 107.675h5c2.209 0 4 1.746 4 3.9V130.1c0 2.154-1.791 3.9-4 3.9m0-1c1.654 0 3-1.301 3-2.9v-18.525c0-1.599-1.346-2.9-3-2.9h-5.68l-.25-.632-4.084-10.318-4.055 10.316-.249.634H224c-1.654 0-3 1.301-3 2.9V130.1c0 1.599 1.346 2.9 3 2.9h20\" fill=\"'+ borderColor +'\" /></g></svg>',\n star: '<svg width=\"34\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M32.92 16.93l-3.525-3.525V8.419a1.983 1.983 0 00-1.983-1.982h-4.985L18.9 2.91a1.984 1.984 0 00-2.803 0l-3.524 3.526H7.588a1.983 1.983 0 00-1.982 1.982v4.986L2.081 16.93a1.982 1.982 0 000 2.803l3.525 3.526v4.984c0 1.096.888 1.983 1.982 1.983h4.986L17.457 45l4.97-14.773h4.985a1.983 1.983 0 001.983-1.983V23.26l3.525-3.526a1.982 1.982 0 000-2.803\" fill=\"' + markerColor + '\" /><g opacity=\".15\" transform=\"matrix(1.0667 0 0 -1.0667 -347.3 97.26)\"><path d=\"M342 89c-.476 0-.951-.181-1.314-.544l-3.305-3.305h-4.673a1.858 1.858 0 01-1.859-1.858v-4.674l-3.305-3.305a1.857 1.857 0 010-2.627l3.305-3.305v-4.674a1.86 1.86 0 011.859-1.859h4.673L341.959 49l4.659 13.849h4.674a1.86 1.86 0 011.859 1.859v4.674l3.305 3.305a1.858 1.858 0 010 2.627l-3.305 3.305v4.674a1.859 1.859 0 01-1.859 1.858h-4.674l-3.304 3.305A1.851 1.851 0 01342 89m0-1a.853.853 0 00.607-.251l3.304-3.305.293-.293h5.088a.86.86 0 00.859-.858v-5.088l3.598-3.598A.852.852 0 00356 74a.85.85 0 00-.251-.606l-3.598-3.598v-5.088a.86.86 0 00-.859-.859h-5.393l-.229-.681-3.702-11.006-3.637 11.001-.227.686h-5.396a.86.86 0 00-.859.859v5.088l-3.598 3.598c-.162.162-.251.377-.251.606s.089.445.251.607l3.598 3.598v5.088a.86.86 0 00.859.858h5.087l3.598 3.598A.853.853 0 00342 88\" fill=\"#231f20\" /></g></svg>',\n penta: '<svg width=\"33\" height=\"44\" viewBox=\"0 0 35 45\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.872 17.35L9.679 2.993h15.615L33.1 17.35 17.486 44.992z\" fill=\"' + markerColor + '\" /><g opacity=\".15\" transform=\"matrix(1.0769 0 0 -1.0769 -272.731 48.23)\"><path d=\"M276.75 42h-14.5L255 28.668 269.5 3 284 28.668zm-.595-1l6.701-12.323L269.5 5.033l-13.356 23.644L262.845 41z\" fill=\"#231f20\" /></g></svg>'\n };\n return svgMap[shape];\n}\n\nconst addIcon = (icon:string) => {\n switch(icon) {\n case \"circle-solid\":\n return '<svg fill=\"#fff\" style=\"position: relative; top: -38px;left: -1px;\" width=\"13\"xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d=\"M512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256z\"/></svg>';\n break;\n case \"calendar-days-solid\":\n return '<svg fill=\"#fff\" style=\"position: relative; top: -40px;left: 0px;\" width=\"13\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d=\"M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z\"/></svg>';\n break;\n default:\n return \"\";\n } \n}\n\nconst MarkerIconFactory = (shape:string, color1:string, color2:string, icon:string) =>\n{\n return L.divIcon({\n html: `${createSvg(shape, color1, color2)}${addIcon(icon)}`,\n iconAnchor: [17,40],\n popupAnchor: [0,-40],\n iconSize: new L.Point(40, 46),\n className: \"leaflet-data-marker\",\n shadowAnchor: [0, 0]\n });\n}\n\nexport default MarkerIconFactory ;\n","import * as React from 'react'\nimport { Popup } from 'react-leaflet'\nimport { Item, Tag } from '../../types'\n\nexport interface MarkerPopupProps {\n item: Item,\n tags: Tag[]\n}\n\nconst MarkerPopup = (props: MarkerPopupProps) => {\n const item: Item = props.item;\n const tags: Tag[] = props.tags;\n\n return (\n <Popup maxHeight={377} minWidth={275} maxWidth={275} autoPanPadding={[30,30]}>\n <b style={{ fontSize: '1.0rem' }}>{item.name}</b>\n\n {item.start && item.end &&\n <p>{new Date(item.start).toISOString().substring(0, 10) || \"\"} - {new Date(item.end).toISOString().substring(0, 10) || \"\"}</p>\n }\n\n <p style={{ whiteSpace: \"pre-wrap\" }} dangerouslySetInnerHTML={{ __html: replaceURLs(item.text) }} />\n <p>\n\n {item.tags &&\n tags.map((tag: Tag) => (\n <span className=\"\" style={{ fontWeight: \"bold\", display: \"inline-block\", color: \"#fff\", padding: \".2rem\", borderRadius: \".2rem\", backgroundColor: tag.color, margin: '.2rem', fontSize: \"100%\" }} key={tag.id}>#{tag.name}</span>\n ))\n }\n </p>\n </Popup>\n )\n}\n\nexport default MarkerPopup;\n\n\nfunction replaceURLs(message: string): string {\n if (!message) return \"\";\n\n var urlRegex = /(^| )(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,10}(:[0-9]{1,10})?(\\/.*)?$/gm;\n message = message.replace(urlRegex, function (url) {\n var hyperlink = url.replace(' ', '');\n if (!hyperlink.match('^https?:\\/\\/')) {\n hyperlink = 'http://' + hyperlink;\n }\n return '<a href=\"' + hyperlink + '\" target=\"_blank\" rel=\"noopener noreferrer\">' + url + '</a>'\n });\n\n var mailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)/gi;\n message = message.replace(mailRegex, function (mail) {\n return '<a href=\"mailto:' + mail + '\">' + mail + '</a>'\n });\n\n return message;\n}","import { TileLayer, MapContainer, Marker } from \"react-leaflet\";\nimport \"leaflet/dist/leaflet.css\";\nimport * as React from \"react\";\nimport MarkerIconFactory from './Utils/MarkerIconFactory';\nimport MarkerPopup from \"./Components/Map/MarkerPopup\";\nimport { Item, Tag } from \"./types\"\nimport \"./styles.scss\"\nimport { LatLng } from \"leaflet\";\nimport MarkerClusterGroup from 'react-leaflet-cluster'\n\nexport interface MapProps {\n height: string,\n width: string,\n center: LatLng,\n zoom: number,\n places?: Item[],\n events?: Item[],\n tags?: Tag[],\n}\n\n\nconst UtopiaMap = (props: MapProps) => {\n let center: LatLng = new LatLng(50.6, 9.5);\n if (props.center) center = props.center;\n let zoom: number = 10;\n if (props.zoom) zoom = props.zoom;\n let height: string = \"400px\";\n if (props.height) height = props.height;\n let width: string = \"100vw\";\n if (props.width) width = props.width;\n\n let tagMap = new Map(props.tags?.map(key => [key.id, key]));\n\n const getTags = (item: Item) => {\n let tags: Tag[] = [];\n item.tags && item.tags.forEach(element => {\n if (tagMap.has(element)) { tags.push(tagMap.get(element)!) };\n });\n return tags;\n }\n\n\n return (\n <MapContainer style={{ height: height, width: width }} center={center} zoom={zoom} >\n <TileLayer\n attribution='&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors'\n url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\" />\n <MarkerClusterGroup showCoverageOnHover chunkedLoading maxClusterRadius={50}>\n {props.places &&\n props.places.map((place: Item) => {\n let tags = getTags(place);\n let color1 = \"#666\";\n let color2 = \"RGBA(35, 31, 32, 0.2)\";\n if (tags[0]) {\n color1 = tags[0].color;\n }\n if (tags[1]) {\n color2 = tags[1].color;\n }\n return (\n <Marker icon={MarkerIconFactory('circle', color1, color2, 'circle-solid')} key={place.id} position={[place.position.coordinates[1], place.position.coordinates[0]]}>\n <MarkerPopup item={place} tags={tags} />\n </Marker>\n )\n })\n }\n\n {props.events &&\n props.events.map((event: Item) => {\n let tags = getTags(event);\n let color1 = \"#666\";\n let color2 = \"RGBA(35, 31, 32, 0.2)\";\n if (tags[0]) {\n color1 = tags[0].color;\n }\n if (tags[1]) {\n color2 = tags[1].color;\n }\n return (\n <Marker icon={MarkerIconFactory('square', color1, color2, 'calendar-days-solid')} key={event.id} position={[event.position.coordinates[1], event.position.coordinates[0]]}>\n <MarkerPopup item={event} tags={tags} />\n </Marker>\n )\n })\n }\n </MarkerClusterGroup>\n </MapContainer>\n\n );\n}\n\nexport { UtopiaMap, Item, Tag };\n\n"],"names":["L","React","Popup","LatLng","MapContainer","TileLayer","MarkerClusterGroup","Marker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,SAAS,GAAG,UAAC,KAAY,EAAE,WAAkB,EAAE,WAAkB,EAAA;AACnE,IAAA,IAAI,MAAM,GAAG;QACT,MAAM,EAAE,8UAA8U,GAAG,WAAW,GAAG,qfAAqf,GAAG,WAAW,GAAG,wBAAwB;QACr4B,MAAM,EAAE,ySAAyS,GAAG,WAAW,GAAG,wZAAwZ,GAAE,WAAW,GAAE,gBAAgB;AACzvB,QAAA,IAAI,EAAI,8bAA8b,GAAG,WAAW,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AAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1B,qBAAA;AACD,oBAAA,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE;AACT,wBAAA,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1B,qBAAA;AACD,oBAAA,QACIA,gBAAC,CAAA,aAAA,CAAAM,mBAAM,IAAC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAA;AACrK,wBAAAN,gBAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI,CACnC,EACZ;AACL,iBAAC,CAAC,CAEW,CACV,EAEjB;AACN;;;;"}
@@ -0,0 +1,21 @@
1
+ export interface Item {
2
+ id: number;
3
+ date_created?: string;
4
+ date_updated?: string | null;
5
+ name: string;
6
+ text: string;
7
+ position: Geometry;
8
+ start?: string;
9
+ end?: string;
10
+ tags?: number[];
11
+ [key: string]: any;
12
+ }
13
+ export interface Geometry {
14
+ type: string;
15
+ coordinates: number[];
16
+ }
17
+ export interface Tag {
18
+ color: string;
19
+ id: number;
20
+ name: string;
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utopia-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "Reuseable React Components to build mapping apps for all kinds of communities ",
5
5
  "repository": "https://github.com/utopia-os/utopia-ui",
6
6
  "homepage:": "https://utopia.os/",
@@ -20,7 +20,6 @@
20
20
  "@types/react": "^18.0.14",
21
21
  "@types/react-dom": "^18.0.5",
22
22
  "@types/react-leaflet": "^2.8.2",
23
- "@types/react-leaflet-markercluster": "^3.0.0",
24
23
  "babel-core": "^6.26.3",
25
24
  "babel-runtime": "^6.26.0",
26
25
  "react": "^17.0.2",
@@ -36,7 +35,7 @@
36
35
  },
37
36
  "dependencies": {
38
37
  "leaflet": "^1.8.0",
39
- "react-leaflet": "^4.0.0",
40
- "react-leaflet-markercluster": "^3.0.0-rc1"
38
+ "react-leaflet": "^3.2.5",
39
+ "react-leaflet-cluster": "^1.0.4"
41
40
  }
42
41
  }
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import "leaflet/dist/leaflet.css";
3
- import { IMapItem } from "./include/MarkerPopup";
4
- import "./styles.scss";
5
- export interface IMapProps {
6
- height: string;
7
- width: string;
8
- places?: IMapItem[];
9
- events?: IMapItem[];
10
- }
11
- declare const Map: (props: IMapProps) => JSX.Element;
12
- export default Map;
@@ -1,28 +0,0 @@
1
- /// <reference types="react" />
2
- export interface IMarkerPopupProps {
3
- item: IMapItem;
4
- }
5
- export interface IMapItem {
6
- id?: string;
7
- date_created?: string;
8
- date_updated?: string | null;
9
- name: string;
10
- text: string;
11
- position: IGeometry;
12
- start?: string;
13
- end?: string;
14
- tags: ITag[];
15
- [key: string]: any;
16
- }
17
- export interface IGeometry {
18
- type: string;
19
- coordinates: number[];
20
- }
21
- export interface ITag {
22
- Tags_id: {
23
- color: string;
24
- id: string;
25
- };
26
- }
27
- declare const MarkerPopup: (props: IMarkerPopupProps) => JSX.Element;
28
- export default MarkerPopup;
@@ -1 +0,0 @@
1
- export { default as Map } from "./Map";
@@ -1,19 +0,0 @@
1
- import { IMapItem } from "../Components/Map/MarkerPopup";
2
- export declare const events: IMapItem[];
3
- export declare const places: {
4
- id: string;
5
- date_created: string;
6
- date_updated: string;
7
- name: string;
8
- text: string;
9
- position: {
10
- type: string;
11
- coordinates: number[];
12
- };
13
- tags: {
14
- Tags_id: {
15
- color: string;
16
- id: string;
17
- };
18
- }[];
19
- }[];
@@ -1,29 +0,0 @@
1
- /// <reference types="react" />
2
- import './button.css';
3
- interface ButtonProps {
4
- /**
5
- * Is this the principal call to action on the page?
6
- */
7
- primary?: boolean;
8
- /**
9
- * What background color to use
10
- */
11
- backgroundColor?: string;
12
- /**
13
- * How large should the button be?
14
- */
15
- size?: 'small' | 'medium' | 'large';
16
- /**
17
- * Button contents
18
- */
19
- label: string;
20
- /**
21
- * Optional click handler
22
- */
23
- onClick?: () => void;
24
- }
25
- /**
26
- * Primary UI component for user interaction
27
- */
28
- export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => JSX.Element;
29
- export {};
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import './header.css';
3
- declare type User = {
4
- name: string;
5
- };
6
- interface HeaderProps {
7
- user?: User;
8
- onLogin: () => void;
9
- onLogout: () => void;
10
- onCreateAccount: () => void;
11
- }
12
- export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => JSX.Element;
13
- export {};
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import './page.css';
3
- export declare const Page: React.VFC;
@@ -1,5 +0,0 @@
1
- import { ComponentMeta } from '@storybook/react';
2
- declare const _default: ComponentMeta<React.VFC>;
3
- export default _default;
4
- export declare const LoggedOut: any;
5
- export declare const LoggedIn: any;
@@ -1,3 +0,0 @@
1
- import * as L from 'leaflet';
2
- declare const MarkerIconFactory: (shape: string, color1: string, color2: string, icon: string) => L.DivIcon;
3
- export default MarkerIconFactory;