diff --git a/package.json b/package.json index 33272abf..3294eb11 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "utopia-ui", - "version": "1.0.8", + "version": "2.0.1", "description": "Reuseable React Components to build mapping apps for all kinds of communities ", "repository": "https://github.com/utopia-os/utopia-ui", "homepage:": "https://utopia.os/", "module": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "build": "rollup -c", "start": "rollup -c -w" diff --git a/rollup.config.js b/rollup.config.js index 643e2423..ea9d4a8b 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -18,5 +18,5 @@ export default { }), typescript() ], - external: ['react', 'react-dom', 'leaflet', 'react-leaflet', 'react-leaflet-cluster', 'leaflet/dist/leaflet.css', '@heroicons/react/20/solid'] + external: ['react', 'react-dom', 'leaflet', 'react-leaflet', 'react-toastify' , 'react-toastify/dist/ReactToastify.css', 'tw-elements' ,'react-router-dom', 'react-leaflet-cluster', 'leaflet/dist/leaflet.css', '@heroicons/react/20/solid'] } \ No newline at end of file diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index 13344ad7..5107e53d 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import { Marker } from 'react-leaflet' -import { Item, Tag, Layer as LayerProps } from '../../types' +import { Item, Tag, LayerProps } from '../../types' import MarkerIconFactory from '../../Utils/MarkerIconFactory' import { Popup } from './Subcomponents/Popup' import { useTags } from './hooks/useTags' diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index 7200741d..adf231b9 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -1,7 +1,7 @@ import { TileLayer, MapContainer, useMapEvents } from "react-leaflet"; import "leaflet/dist/leaflet.css"; import * as React from "react"; -import { Item, Tag, ItemsApi, Layer, UtopiaMap as UtopiaMapProps } from "../../types" +import { Item, Tag, ItemsApi, LayerProps, UtopiaMapProps } from "../../types" import "./UtopiaMap.css" import { LatLng } from "leaflet"; import MarkerClusterGroup from 'react-leaflet-cluster' @@ -14,7 +14,7 @@ import { LayersProvider } from "./hooks/useLayers"; export interface MapEventListenerProps { - selectMode: Layer | null, + selectMode: LayerProps | null, setSelectMode: React.Dispatch, setNewItemPopup: React.Dispatch> } @@ -42,7 +42,7 @@ function UtopiaMap({ children } : UtopiaMapProps) { - const [selectMode, setSelectMode] = useState(null); + const [selectMode, setSelectMode] = useState(null); const [newItemPopup, setNewItemPopup] = useState(null); diff --git a/src/types.ts b/src/types.ts index f2d342ed..66056108 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,7 @@ import { LatLng } from "leaflet"; import { NewItemPopupProps } from "./Components/Map/Subcomponents/NewItemPopup"; -export interface UtopiaMap { +export interface UtopiaMapProps { height?: string, width?: string, center?: LatLng, @@ -10,7 +10,7 @@ export interface UtopiaMap { children?: React.ReactNode, } -export interface Layer { +export interface LayerProps { data?: Item[], children?: React.ReactNode name: string, @@ -21,7 +21,7 @@ export interface Layer { markerShape: string, markerDefaultColor: string, tags?: Tag[], - api?: ItemsApi, + api?: ItemsApi, setNewItemPopup?: React.Dispatch> } @@ -36,7 +36,7 @@ export class Item { start?: string; end?: string; tags?: number[]; - constructor(id:string|number,name:string,text:string,position:Geometry, layer: Layer){ + constructor(id:string|number,name:string,text:string,position:Geometry, layer: LayerProps){ this.id = id; this.name = name; this.text = text; @@ -60,9 +60,9 @@ export interface Tag { name: string; } -export interface ItemsApi { +export interface ItemsApi { getItems(): Promise, - addItem(item : Item): Promise, - updateItem(item : Item): Promise, + addItem(item : T): Promise, + updateItem(item : T): Promise, deleteItem(id : number): Promise, } \ No newline at end of file