utopia-ui 1.0.7 → 1.0.8

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 (39) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +28 -24
  3. package/dist/Components/Map/AddButton.d.ts +4 -0
  4. package/dist/Components/Map/Layer.d.ts +3 -0
  5. package/dist/Components/Map/NewItemPopup.d.ts +9 -0
  6. package/dist/Components/Map/Popup.d.ts +8 -0
  7. package/dist/Components/Map/Subcomponents/AddButton.d.ts +4 -0
  8. package/dist/Components/Map/Subcomponents/EditItemPopup.d.ts +10 -0
  9. package/dist/Components/Map/Subcomponents/NewItemPopup.d.ts +10 -0
  10. package/dist/Components/Map/Subcomponents/Popup.d.ts +10 -0
  11. package/dist/Components/Map/Tags.d.ts +5 -0
  12. package/dist/Components/Map/UtopiaMap.d.ts +11 -0
  13. package/dist/Components/Map/UtopiaMap.stories.d.ts +6 -0
  14. package/dist/Components/Map/data.d.ts +4 -0
  15. package/dist/Components/Map/data.new.d.ts +4 -0
  16. package/dist/Components/Map/hooks/useContext.d.ts +7 -0
  17. package/dist/Components/Map/hooks/useForceUpdate.d.ts +1 -0
  18. package/dist/Components/Map/hooks/useItems.d.ts +18 -0
  19. package/dist/Components/Map/hooks/useLayers.d.ts +14 -0
  20. package/dist/Components/Map/hooks/useMapContext.d.ts +11 -0
  21. package/dist/Components/Map/hooks/useNewItemPopup.d.ts +12 -0
  22. package/dist/Components/Map/hooks/useTags.d.ts +16 -0
  23. package/dist/Components/Map/index.d.ts +3 -0
  24. package/dist/Components/Map/useItems.d.ts +16 -0
  25. package/dist/Components/Map/useLayers.d.ts +18 -0
  26. package/dist/Components/Map/useTags.d.ts +16 -0
  27. package/dist/Utils/DynamicHeroIcon.d.ts +5 -0
  28. package/dist/Utils/ReplaceURLs.d.ts +1 -0
  29. package/dist/index.d.ts +1 -16
  30. package/dist/index.js +463 -91
  31. package/dist/index.js.map +1 -1
  32. package/dist/stories/Button.d.ts +29 -0
  33. package/dist/stories/Header.d.ts +13 -0
  34. package/dist/stories/Page.d.ts +3 -0
  35. package/dist/stories/Page.stories.d.ts +5 -0
  36. package/dist/types.d.ts +38 -5
  37. package/package.json +21 -4
  38. package/dist/Components/Map/MarkerPopup.d.ts +0 -8
  39. package/dist/Utils/StringFormater.d.ts +0 -1
package/LICENSE.md ADDED
@@ -0,0 +1,5 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2
+
3
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,17 +1,19 @@
1
- # Utopia UI
2
- Reuseable React Components to build mapping apps for all kinds of communities with focus of real life action, local connection and positiv impact.
1
+ # Utopia UI [![npm version](https://img.shields.io/npm/v/utopia-ui.svg)](https://www.npmjs.com/package/utopia-ui)
2
+ is a UI Library to build mapping apps with focus of real life action, local connection and positiv impact.
3
3
 
4
4
  Check [utopia-os.org](https://utopia-os.org) for more information
5
5
 
6
- *This Library is in early alpha stage. You are very welcome to participate in the development*
7
-
8
- *A Django-based Proof of Concept can be found @ [new.docutopia.de](https://new.docutopia.de). This map can be edited freely you can register to create an account and place them on the map. The project is no longer maintained.*
6
+ *In early 2021, we developed a Django-based Proof of Concept, which can be found @ [new.docutopia.de](https://new.docutopia.de). This map can be edited freely you can register to create an account and place them on the map.*
9
7
 
10
- Utopia UI is a fully new approach to create a Open Source Library of JavaScript Components which should fit the needs of many different projects and communities.
8
+ Utopia UI is the approach to create a Open Source Library of JavaScript Components which should bring useful maps and apps to all kind of projects and communities.
11
9
 
12
10
 
13
11
  ## Map UI Component
14
- Map UI is a JavaScript Map Library to create nice and easy to use Maps
12
+ The Map Component based on [leaflet](https://leafletjs.com) is the crystalisation point of Utopia OS.
13
+
14
+ The map shows places, events and people at their respective position whith nice and informative Popups. Tags, colors and clusters help to retain the overview.
15
+
16
+ Include it somewhere in your React Application, pass some data and the required props.
15
17
 
16
18
  ### Getting Started
17
19
 
@@ -26,33 +28,20 @@ then import in your React App
26
28
  import UtopiaMap from 'utopia-ui'
27
29
  ```
28
30
 
29
- use the [Map UI Component](/docs/utopia-ui/map-components/map)
31
+ use the Map UI Component
30
32
  ```jsx
31
- <UtopiaMap>
33
+ <UtopiaMap
32
34
  height='360px'
33
35
  width='100vw'
34
36
  center={[51.3, 9.6]}
35
37
  zoom={6}
36
38
  places={places}
37
39
  events={events}
38
- tags = {tags}
40
+ tags = {tags}>
39
41
  </UtopiaMap>
40
42
  ```
41
43
  You can find some Sample Data (places, events, tags) for test purpose below
42
44
 
43
- ### Options
44
-
45
-
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
45
  ### Sample Data
57
46
  ```jsx
58
47
  const places = [{
@@ -91,6 +80,19 @@ const tags = [
91
80
 
92
81
  ```
93
82
 
83
+ ### Options
84
+
85
+
86
+ Option | Type | Default | Required | Description
87
+ --- | --- | --- | --- | ---
88
+ `height` | `string` |`'400px'` | No | height of the map
89
+ `width` | `string` |`'100vw'` | No | width of the map
90
+ `center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
91
+ `zoom` | `number` |`10` | No | initial zoom level
92
+ `places` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| `[]` | No | Array with Items
93
+ `events` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| `[]` | No | Array with Items
94
+ `tags` | [`Tag[]`](https://utopia-os.org/docs/utopia-ui/map-components/tag) | `[]` | No | Array with Tags
95
+
94
96
  ## Coming Soon
95
97
 
96
98
  * Profile UI Component
@@ -103,6 +105,8 @@ const tags = [
103
105
 
104
106
  ## Join the community
105
107
 
106
- *We are looking for Web Developer, UX Designer, Community Manager, Visionaries, Artists, etc. who like to support this Vision.*
108
+ *This Library is in early alpha stage. You are very welcome to participate in the development*
109
+
110
+ *We are looking for Web Developer, UX Designer, Community Manager, Visionaries, Artists, etc. who like to support this Vision.*
107
111
 
108
112
  [https://t.me/utopiaOS](https://t.me/utopiaOS)
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ export default function AddButton({ setSelectMode }: {
3
+ setSelectMode: React.Dispatch<React.SetStateAction<any>>;
4
+ }): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { Layer as LayerProps } from '../../types';
3
+ export declare const Layer: (props: LayerProps) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { LatLng } from 'leaflet';
3
+ import { Layer } from '../../types';
4
+ export interface NewItemPopupProps {
5
+ position: LatLng;
6
+ layer: Layer;
7
+ setNewItemPopup: React.Dispatch<React.SetStateAction<any>>;
8
+ }
9
+ export default function NewItemPopup(props: NewItemPopupProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Item, Tag } from '../../types';
3
+ export interface UtopiaPopupProps {
4
+ item: Item;
5
+ tags: Tag[];
6
+ }
7
+ declare const Popup: (props: UtopiaPopupProps) => JSX.Element;
8
+ export { Popup };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ export default function AddButton({ setSelectMode }: {
3
+ setSelectMode: React.Dispatch<React.SetStateAction<any>>;
4
+ }): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { LatLng } from 'leaflet';
3
+ import { Layer, Item } from '../../../types';
4
+ export interface EditItemPopupProps {
5
+ position: LatLng;
6
+ layer: Layer;
7
+ item?: Item;
8
+ setEditItemPopup: React.Dispatch<React.SetStateAction<any>>;
9
+ }
10
+ export default function EditItemPopup(props: EditItemPopupProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { LatLng } from 'leaflet';
3
+ import { Layer, Item } from '../../../types';
4
+ export interface NewItemPopupProps {
5
+ position: LatLng;
6
+ layer: Layer;
7
+ item?: Item;
8
+ setNewItemPopup: React.Dispatch<React.SetStateAction<any>>;
9
+ }
10
+ export default function NewItemPopup(props: NewItemPopupProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { Item, Tag } from '../../../types';
3
+ import { NewItemPopupProps } from './NewItemPopup';
4
+ export interface UtopiaPopupProps {
5
+ item: Item;
6
+ tags: Tag[];
7
+ setNewItemPopup?: React.Dispatch<React.SetStateAction<NewItemPopupProps | null>>;
8
+ }
9
+ declare const Popup: (props: UtopiaPopupProps) => JSX.Element;
10
+ export { Popup };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Tag } from '../../types';
3
+ export declare function Tags({ data }: {
4
+ data: Tag[];
5
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import "leaflet/dist/leaflet.css";
2
+ import * as React from "react";
3
+ import { Item, Tag, API, Layer, UtopiaMap as UtopiaMapProps } from "../../types";
4
+ import "../../index.css";
5
+ export interface MapEventListenerProps {
6
+ selectMode: Layer | null;
7
+ setSelectMode: React.Dispatch<React.SetStateAction<any>>;
8
+ setNewItemPopup: React.Dispatch<React.SetStateAction<any>>;
9
+ }
10
+ declare function UtopiaMap({ height, width, center, zoom, children }: UtopiaMapProps): JSX.Element;
11
+ export { UtopiaMap, Item, Tag, API };
@@ -0,0 +1,6 @@
1
+ import { ComponentMeta } from "@storybook/react";
2
+ import { UtopiaMap } from "./UtopiaMap";
3
+ declare const _default: ComponentMeta<typeof UtopiaMap>;
4
+ export default _default;
5
+ export declare const Custom: any;
6
+ export declare const BadSalzschlirf: any;
@@ -0,0 +1,4 @@
1
+ import { Item, Tag } from "../../types";
2
+ export declare const tags: Tag[];
3
+ export declare const events: Item[];
4
+ export declare const places: Item[];
@@ -0,0 +1,4 @@
1
+ import { Item, Tag } from "../../types";
2
+ export declare const tags: Tag[];
3
+ export declare const events: Item[];
4
+ export declare const places: Item[];
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { NewItemPopupProps } from "../Subcomponents/NewItemPopup";
3
+ declare function useNewItem(): {
4
+ newItemPopup: NewItemPopupProps | null;
5
+ setNewItemPopup: import("react").Dispatch<import("react").SetStateAction<NewItemPopupProps | null>>;
6
+ };
7
+ export default useNewItem;
@@ -0,0 +1 @@
1
+ export declare function useForceUpdate(): () => void;
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { Item } from "../../../types";
3
+ declare type UseItemManagerResult = ReturnType<typeof useItemsManager>;
4
+ declare function useItemsManager(initialItems: Item[]): {
5
+ items: Item[];
6
+ addItem: (item: Item) => void;
7
+ updateItem: (item: Item) => void;
8
+ removeItem: (item: Item) => void;
9
+ };
10
+ export declare const ItemsProvider: React.FunctionComponent<{
11
+ initialItems: Item[];
12
+ children?: React.ReactNode;
13
+ }>;
14
+ export declare const useItems: () => Item[];
15
+ export declare const useAddItem: () => UseItemManagerResult["addItem"];
16
+ export declare const useUpdateItem: () => UseItemManagerResult["updateItem"];
17
+ export declare const useRemoveItem: () => UseItemManagerResult["removeItem"];
18
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { Layer } from "../../../types";
3
+ declare type UseItemManagerResult = ReturnType<typeof useLayerManager>;
4
+ declare function useLayerManager(initialLayers: Layer[]): {
5
+ layers: Layer[];
6
+ addLayer: (layer: Layer) => void;
7
+ };
8
+ export declare const LayersProvider: React.FunctionComponent<{
9
+ initialLayers: Layer[];
10
+ children?: React.ReactNode;
11
+ }>;
12
+ export declare const useLayers: () => Layer[];
13
+ export declare const useAddLayer: () => UseItemManagerResult["addLayer"];
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { Layer } from "../../../types";
3
+ import { NewItemPopupProps } from "../Subcomponents/NewItemPopup";
4
+ export declare const MapContextProvider: React.FunctionComponent<{
5
+ initialValues: {
6
+ selectMode: null;
7
+ newItemPopup: null;
8
+ };
9
+ children?: React.ReactNode;
10
+ }>;
11
+ export declare const useMapContext: () => (Layer | React.Dispatch<React.SetStateAction<Layer | null>> | NewItemPopupProps | React.Dispatch<React.SetStateAction<NewItemPopupProps | null>> | null)[];
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { NewItemPopupProps } from "../Subcomponents/NewItemPopup";
3
+ declare type ContextType = {
4
+ newItemPopup: NewItemPopupProps | null;
5
+ setNewItemPopup: (value: NewItemPopupProps | null) => void;
6
+ };
7
+ export declare const NewItemPopupProvider: (prop: {
8
+ value?: string;
9
+ children: JSX.Element | JSX.Element[];
10
+ }) => JSX.Element;
11
+ declare const useNewItemPopup: () => ContextType;
12
+ export default useNewItemPopup;
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { Tag } from "../../../types";
3
+ declare type UseTagManagerResult = ReturnType<typeof useTagsManager>;
4
+ declare function useTagsManager(initialTags: Tag[]): {
5
+ tags: Tag[];
6
+ addTag: (tag: Tag) => void;
7
+ removeTag: (id: number) => void;
8
+ };
9
+ export declare const TagsProvider: React.FunctionComponent<{
10
+ initialTags: Tag[];
11
+ children?: React.ReactNode;
12
+ }>;
13
+ export declare const useTags: () => Tag[];
14
+ export declare const useAddTag: () => UseTagManagerResult["addTag"];
15
+ export declare const useRemoveTag: () => UseTagManagerResult["removeTag"];
16
+ export {};
@@ -0,0 +1,3 @@
1
+ export { UtopiaMap, Item, Tag, API } from './UtopiaMap';
2
+ export { Layer } from './Layer';
3
+ export { Tags } from "./Tags";
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { Item } from "../../types";
3
+ declare type UseItemManagerResult = ReturnType<typeof useItemsManager>;
4
+ declare function useItemsManager(initialItems: Item[]): {
5
+ items: Item[];
6
+ addItem: (item: Item) => void;
7
+ removeItem: (id: number) => void;
8
+ };
9
+ export declare const ItemsProvider: React.FunctionComponent<{
10
+ initialItems: Item[];
11
+ children?: React.ReactNode;
12
+ }>;
13
+ export declare const useItems: () => Item[];
14
+ export declare const useAddItem: () => UseItemManagerResult["addItem"];
15
+ export declare const useRemoveItem: () => UseItemManagerResult["removeItem"];
16
+ export {};
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { Item, Layer } from "../../types";
3
+ declare type UseItemManagerResult = ReturnType<typeof useLayerManager>;
4
+ declare function useLayerManager(initialLayers: Map<string, Layer>): {
5
+ layers: Map<string, Layer>;
6
+ addLayer: (layer: Layer) => void;
7
+ addItem: (item: Item, layer: Layer) => void;
8
+ removeItem: (id: number, layer: Layer) => void;
9
+ };
10
+ export declare const LayersProvider: React.FunctionComponent<{
11
+ initialLayers: Map<string, Layer>;
12
+ children?: React.ReactNode;
13
+ }>;
14
+ export declare const useLayers: () => Map<string, Layer>;
15
+ export declare const useAddLayer: () => UseItemManagerResult["addLayer"];
16
+ export declare const useAddItem: () => UseItemManagerResult["addItem"];
17
+ export declare const useRemoveItem: () => UseItemManagerResult["removeItem"];
18
+ export {};
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { Tag } from "../../types";
3
+ declare type UseTagManagerResult = ReturnType<typeof useTagsManager>;
4
+ declare function useTagsManager(initialTags: Tag[]): {
5
+ tags: Tag[];
6
+ addTag: (tag: Tag) => void;
7
+ removeTag: (id: number) => void;
8
+ };
9
+ export declare const TagsProvider: React.FunctionComponent<{
10
+ initialTags: Tag[];
11
+ children?: React.ReactNode;
12
+ }>;
13
+ export declare const useTags: () => Tag[];
14
+ export declare const useAddTag: () => UseTagManagerResult["addTag"];
15
+ export declare const useRemoveTag: () => UseTagManagerResult["removeTag"];
16
+ export {};
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ declare const DynamicHeroIcon: FC<{
3
+ icon: string;
4
+ }>;
5
+ export default DynamicHeroIcon;
@@ -0,0 +1 @@
1
+ export declare function replaceURLs(message: string): string;
package/dist/index.d.ts CHANGED
@@ -1,16 +1 @@
1
- /// <reference types="react" />
2
- import "leaflet/dist/leaflet.css";
3
- import { Item, Tag } from "./types";
4
- import "./styles.scss";
5
- import { LatLng } from "leaflet";
6
- export interface MapProps {
7
- height: string;
8
- width: string;
9
- center: LatLng;
10
- zoom: number;
11
- places?: Item[];
12
- events?: Item[];
13
- tags?: Tag[];
14
- }
15
- declare const UtopiaMap: (props: MapProps) => JSX.Element;
16
- export { UtopiaMap, Item, Tag };
1
+ export { UtopiaMap, Layer, Tags, Item, Tag, API } from './Components/Map/index';