utopia-ui 1.0.7 → 2.0.0

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 (41) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +39 -77
  3. package/dist/Components/AppShell/AppShell.d.ts +6 -0
  4. package/dist/Components/AppShell/Content.d.ts +6 -0
  5. package/dist/Components/AppShell/NavBar.d.ts +5 -0
  6. package/dist/Components/AppShell/SideBar.d.ts +11 -0
  7. package/dist/Components/AppShell/SidebarSubmenu.d.ts +8 -0
  8. package/dist/Components/AppShell/index.d.ts +3 -0
  9. package/dist/Components/Auth/auth.d.ts +24 -0
  10. package/dist/Components/Auth/authDirectus.d.ts +30 -0
  11. package/dist/Components/Auth/index.d.ts +1 -0
  12. package/dist/Components/Gaming/Modal.d.ts +9 -0
  13. package/dist/Components/Gaming/Quests.d.ts +2 -0
  14. package/dist/Components/Gaming/index.d.ts +2 -0
  15. package/dist/Components/Input/InputText.d.ts +12 -0
  16. package/dist/Components/Input/TextAreaInput.d.ts +11 -0
  17. package/dist/Components/Map/Layer.d.ts +3 -0
  18. package/dist/Components/Map/Subcomponents/AddButton.d.ts +4 -0
  19. package/dist/Components/Map/Subcomponents/NewItemPopup.d.ts +10 -0
  20. package/dist/Components/Map/Subcomponents/Popup.d.ts +10 -0
  21. package/dist/Components/Map/Tags.d.ts +5 -0
  22. package/dist/Components/Map/UtopiaMap.d.ts +12 -0
  23. package/dist/Components/Map/UtopiaMap.stories.d.ts +5 -0
  24. package/dist/Components/Map/data.d.ts +4 -0
  25. package/dist/Components/Map/hooks/useItems.d.ts +20 -0
  26. package/dist/Components/Map/hooks/useLayers.d.ts +14 -0
  27. package/dist/Components/Map/hooks/useTags.d.ts +16 -0
  28. package/dist/Components/Map/index.d.ts +3 -0
  29. package/dist/Components/Profile/Settings.d.ts +5 -0
  30. package/dist/Components/Profile/index.d.ts +1 -0
  31. package/dist/Components/TitleCard.d.ts +9 -0
  32. package/dist/Components/Typography/Subtitle.d.ts +6 -0
  33. package/dist/Utils/DynamicHeroIcon.d.ts +5 -0
  34. package/dist/Utils/ReplaceURLs.d.ts +1 -0
  35. package/dist/index.d.ts +6 -16
  36. package/dist/index.js +969 -106
  37. package/dist/index.js.map +1 -1
  38. package/dist/types.d.ts +38 -5
  39. package/package.json +24 -13
  40. package/dist/Components/Map/MarkerPopup.d.ts +0 -8
  41. 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,19 +1,13 @@
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.*
9
-
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.
11
-
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.*
12
7
 
13
- ## Map UI Component
14
- Map UI is a JavaScript Map Library to create nice and easy to use Maps
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.
15
9
 
16
- ### Getting Started
10
+ ## Getting Started
17
11
 
18
12
 
19
13
  install via npm
@@ -21,88 +15,56 @@ install via npm
21
15
  npm install utopia-ui
22
16
  ```
23
17
 
24
- then import in your React App
25
- ```jsx
26
- import UtopiaMap from 'utopia-ui'
27
- ```
18
+ ## Map Component
19
+ The map shows various Layers (places, events, profiles ...) of Irems at their respective position whith nice and informative Popups.
28
20
 
29
- use the [Map UI Component](/docs/utopia-ui/map-components/map)
21
+ Tags, colors and clusters help to retain the overview.
22
+
23
+ use the Map UI Component
30
24
  ```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>
25
+ import { UtopiaMap, Layer, Tags } from 'utopia-ui'
26
+
27
+ <UtopiaMap zoom={5} height='calc(100vh - 64px)' width="100%">
28
+ <Layer
29
+ name='events'
30
+ menuIcon='CalendarIcon'
31
+ menuText='add new event'
32
+ menuColor='#f9a825'
33
+ markerIcon='calendar-days-solid'
34
+ markerShape='square'
35
+ markerDefaultColor='#777'
36
+ data={events} />
37
+ <Layer
38
+ name='places'
39
+ menuIcon='MapPinIcon'
40
+ menuText='add new place'
41
+ menuColor='#2E7D32'
42
+ markerIcon='circle-solid'
43
+ markerShape='circle'
44
+ markerDefaultColor='#777'
45
+ data={places} />
46
+ <Tags data={tags}></Tags>
47
+ </UtopiaMap>
40
48
  ```
41
- You can find some Sample Data (places, events, tags) for test purpose below
49
+ You can find some Sample Data (places, events, tags) for test in the `SamleData/` folder
42
50
 
43
- ### Options
44
51
 
45
52
 
53
+ ### Options
54
+
46
55
  Option | Type | Default | Required | Description
47
56
  --- | --- | --- | --- | ---
48
57
  `height` | `string` |`'400px'` | No | height of the map
49
58
  `width` | `string` |`'100vw'` | No | width of the map
50
59
  `center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
51
60
  `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
- ]
91
61
 
92
- ```
93
-
94
- ## Coming Soon
95
62
 
96
- * Profile UI Component
97
- * Market UI Component
98
- * Calendar UI Component
99
- * Friends
100
- * Groups
101
- * Tags & Colors
102
- * Gamification Elements
103
63
 
104
64
  ## Join the community
105
65
 
106
- *We are looking for Web Developer, UX Designer, Community Manager, Visionaries, Artists, etc. who like to support this Vision.*
66
+ *This Library is in early alpha stage. You are very welcome to participate in the development*
67
+
68
+ *We are looking for Web Developer, UX Designer, Community Manager, Visionaries, Artists, etc. who like to support this Vision.*
107
69
 
108
70
  [https://t.me/utopiaOS](https://t.me/utopiaOS)
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare function AppShell({ name, useAuth, children }: {
3
+ name: any;
4
+ useAuth: any;
5
+ children: any;
6
+ }): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ declare type ContentProps = {
3
+ children?: React.ReactNode;
4
+ };
5
+ export declare function Content({ children }: ContentProps): JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export default function NavBar({ name, useAuth }: {
3
+ name: string;
4
+ useAuth: any;
5
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ declare type route = {
3
+ path: string;
4
+ icon: JSX.Element;
5
+ name: string;
6
+ submenu?: route;
7
+ };
8
+ export declare function SideBar({ routes }: {
9
+ routes: route[];
10
+ }): JSX.Element;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare function SidebarSubmenu({ submenu, name, icon }: {
3
+ path: string;
4
+ icon: JSX.Element;
5
+ name: string;
6
+ submenu?: any | undefined;
7
+ }): JSX.Element;
8
+ export default SidebarSubmenu;
@@ -0,0 +1,3 @@
1
+ export { AppShell } from "./AppShell";
2
+ export { SideBar } from "./SideBar";
3
+ export { Content } from "./Content";
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { AuthCredentials, UserItem } from "@directus/sdk";
3
+ declare type AuthProviderProps = {
4
+ children?: React.ReactNode;
5
+ };
6
+ export declare type MyUserItem = {
7
+ id: string;
8
+ first_name: string;
9
+ description: string;
10
+ email: string;
11
+ password: string;
12
+ };
13
+ declare type AuthContextProps = {
14
+ isAuthenticated: Boolean;
15
+ user: UserItem | null;
16
+ login: (credentials: AuthCredentials) => Promise<UserItem | undefined>;
17
+ loading: Boolean;
18
+ logout: () => void;
19
+ updateUser: (user: MyUserItem) => any;
20
+ token: String | null;
21
+ };
22
+ export declare const AuthProvider: ({ children }: AuthProviderProps) => JSX.Element;
23
+ export declare const useAuth: () => AuthContextProps;
24
+ export {};
@@ -0,0 +1,30 @@
1
+ import * as React from "react";
2
+ declare type AuthProviderProps = {
3
+ directus: any;
4
+ children?: React.ReactNode;
5
+ };
6
+ declare type AuthCredentials = {
7
+ email: string;
8
+ password: string;
9
+ otp?: string | undefined;
10
+ };
11
+ export declare type MyUserItem = {
12
+ id: string;
13
+ avatar: string;
14
+ first_name: string;
15
+ description: string;
16
+ email: string;
17
+ password: string;
18
+ };
19
+ declare type AuthContextProps = {
20
+ isAuthenticated: Boolean;
21
+ user: MyUserItem | null;
22
+ login: (credentials: AuthCredentials) => Promise<MyUserItem | undefined>;
23
+ loading: Boolean;
24
+ logout: () => void;
25
+ updateUser: (user: MyUserItem) => any;
26
+ token: String | null;
27
+ };
28
+ export declare const AuthProviderDirectus: ({ directus, children }: AuthProviderProps) => JSX.Element;
29
+ export declare const useAuthDirectus: () => AuthContextProps;
30
+ export {};
@@ -0,0 +1 @@
1
+ export { AuthProviderDirectus, useAuthDirectus } from "./authDirectus";
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare type ModalProps = {
3
+ clickAction: () => void;
4
+ };
5
+ export declare function Welcome1({ clickAction }: ModalProps): JSX.Element;
6
+ export declare function Welcome2({ clickAction }: ModalProps): JSX.Element;
7
+ export declare function Welcome3({ clickAction }: ModalProps): JSX.Element;
8
+ export declare function Modal(): JSX.Element;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Quests(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { Modal } from './Modal';
2
+ export { Quests } from './Quests';
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ declare type InputTextProps = {
3
+ labelTitle?: string;
4
+ labelStyle?: string;
5
+ type?: string;
6
+ containerStyle?: string;
7
+ defaultValue: string;
8
+ placeholder?: string;
9
+ updateFormValue: (value: string) => void;
10
+ };
11
+ declare function InputText({ labelTitle, labelStyle, type, containerStyle, defaultValue, placeholder, updateFormValue }: InputTextProps): JSX.Element;
12
+ export default InputText;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ declare type TextAreaProps = {
3
+ labelTitle: string;
4
+ labelStyle?: string;
5
+ containerStyle?: string;
6
+ defaultValue: string;
7
+ placeholder?: string;
8
+ updateFormValue: (value: string) => void;
9
+ };
10
+ declare function TextAreaInput({ labelTitle, labelStyle, containerStyle, defaultValue, placeholder, updateFormValue }: TextAreaProps): JSX.Element;
11
+ export default TextAreaInput;
@@ -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,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 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,12 @@
1
+ import "leaflet/dist/leaflet.css";
2
+ import * as React from "react";
3
+ import { Item, Tag, ItemsApi, Layer, UtopiaMap as UtopiaMapProps } from "../../types";
4
+ import "./UtopiaMap.css";
5
+ export interface MapEventListenerProps {
6
+ selectMode: Layer | null;
7
+ setSelectMode: React.Dispatch<any>;
8
+ setNewItemPopup: React.Dispatch<React.SetStateAction<any>>;
9
+ }
10
+ /** This is a description of the foo function. */
11
+ declare function UtopiaMap({ height, width, center, zoom, children }: UtopiaMapProps): JSX.Element;
12
+ export { UtopiaMap, Item, Tag, ItemsApi };
@@ -0,0 +1,5 @@
1
+ import { UtopiaMap } from "./UtopiaMap";
2
+ declare const _default: ComponentMeta<typeof UtopiaMap>;
3
+ export default _default;
4
+ export declare const Custom: any;
5
+ 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,20 @@
1
+ import * as React from "react";
2
+ import { Item, Layer } 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
+ resetItems: (layer: Layer) => void;
10
+ };
11
+ export declare const ItemsProvider: React.FunctionComponent<{
12
+ initialItems: Item[];
13
+ children?: React.ReactNode;
14
+ }>;
15
+ export declare const useItems: () => Item[];
16
+ export declare const useAddItem: () => UseItemManagerResult["addItem"];
17
+ export declare const useUpdateItem: () => UseItemManagerResult["updateItem"];
18
+ export declare const useRemoveItem: () => UseItemManagerResult["removeItem"];
19
+ export declare const useResetItems: () => UseItemManagerResult["resetItems"];
20
+ 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,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, ItemsApi } from './UtopiaMap';
2
+ export { Layer } from './Layer';
3
+ export { Tags } from "./Tags";
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import 'react-toastify/dist/ReactToastify.css';
3
+ export declare function Settings({ useAuth }: {
4
+ useAuth: any;
5
+ }): JSX.Element;
@@ -0,0 +1 @@
1
+ export { Settings } from './Settings';
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ interface TitleCardProps {
3
+ title: string;
4
+ children: React.ReactNode;
5
+ topMargin: string;
6
+ TopSideButtons?: any;
7
+ }
8
+ declare function TitleCard({ title, children, topMargin, TopSideButtons }: TitleCardProps): JSX.Element;
9
+ export default TitleCard;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare function Subtitle({ styleClass, children }: {
3
+ styleClass: any;
4
+ children: any;
5
+ }): JSX.Element;
6
+ export default Subtitle;
@@ -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,6 @@
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, ItemsApi } from './Components/Map/index';
2
+ export { AppShell, Content, SideBar } from "./Components/AppShell";
3
+ export { AuthProviderDirectus, useAuthDirectus } from "./Components/Auth";
4
+ export { Settings } from './Components/Profile';
5
+ export { Quests, Modal } from './Components/Gaming';
6
+ import "./index.css";