utopia-ui 1.0.8 → 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 (44) hide show
  1. package/README.md +31 -73
  2. package/dist/Components/AppShell/AppShell.d.ts +6 -0
  3. package/dist/Components/AppShell/Content.d.ts +6 -0
  4. package/dist/Components/AppShell/NavBar.d.ts +5 -0
  5. package/dist/Components/AppShell/SideBar.d.ts +11 -0
  6. package/dist/Components/AppShell/SidebarSubmenu.d.ts +8 -0
  7. package/dist/Components/AppShell/index.d.ts +3 -0
  8. package/dist/Components/Auth/auth.d.ts +24 -0
  9. package/dist/Components/Auth/authDirectus.d.ts +30 -0
  10. package/dist/Components/Auth/index.d.ts +1 -0
  11. package/dist/Components/Gaming/Modal.d.ts +9 -0
  12. package/dist/Components/Gaming/Quests.d.ts +2 -0
  13. package/dist/Components/Gaming/index.d.ts +2 -0
  14. package/dist/Components/Input/InputText.d.ts +12 -0
  15. package/dist/Components/Input/TextAreaInput.d.ts +11 -0
  16. package/dist/Components/Map/UtopiaMap.d.ts +5 -4
  17. package/dist/Components/Map/UtopiaMap.stories.d.ts +0 -1
  18. package/dist/Components/Map/hooks/useItems.d.ts +3 -1
  19. package/dist/Components/Map/index.d.ts +1 -1
  20. package/dist/Components/Profile/Settings.d.ts +5 -0
  21. package/dist/Components/Profile/index.d.ts +1 -0
  22. package/dist/Components/TitleCard.d.ts +9 -0
  23. package/dist/Components/Typography/Subtitle.d.ts +6 -0
  24. package/dist/index.d.ts +6 -1
  25. package/dist/index.js +658 -167
  26. package/dist/index.js.map +1 -1
  27. package/dist/types.d.ts +8 -8
  28. package/package.json +23 -29
  29. package/dist/Components/Map/AddButton.d.ts +0 -4
  30. package/dist/Components/Map/NewItemPopup.d.ts +0 -9
  31. package/dist/Components/Map/Popup.d.ts +0 -8
  32. package/dist/Components/Map/Subcomponents/EditItemPopup.d.ts +0 -10
  33. package/dist/Components/Map/data.new.d.ts +0 -4
  34. package/dist/Components/Map/hooks/useContext.d.ts +0 -7
  35. package/dist/Components/Map/hooks/useForceUpdate.d.ts +0 -1
  36. package/dist/Components/Map/hooks/useMapContext.d.ts +0 -11
  37. package/dist/Components/Map/hooks/useNewItemPopup.d.ts +0 -12
  38. package/dist/Components/Map/useItems.d.ts +0 -16
  39. package/dist/Components/Map/useLayers.d.ts +0 -18
  40. package/dist/Components/Map/useTags.d.ts +0 -16
  41. package/dist/stories/Button.d.ts +0 -29
  42. package/dist/stories/Header.d.ts +0 -13
  43. package/dist/stories/Page.d.ts +0 -3
  44. package/dist/stories/Page.stories.d.ts +0 -5
package/README.md CHANGED
@@ -7,15 +7,7 @@ Check [utopia-os.org](https://utopia-os.org) for more information
7
7
 
8
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.
9
9
 
10
-
11
- ## Map UI Component
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.
17
-
18
- ### Getting Started
10
+ ## Getting Started
19
11
 
20
12
 
21
13
  install via npm
@@ -23,85 +15,51 @@ install via npm
23
15
  npm install utopia-ui
24
16
  ```
25
17
 
26
- then import in your React App
27
- ```jsx
28
- import UtopiaMap from 'utopia-ui'
29
- ```
18
+ ## Map Component
19
+ The map shows various Layers (places, events, profiles ...) of Irems at their respective position whith nice and informative Popups.
20
+
21
+ Tags, colors and clusters help to retain the overview.
30
22
 
31
23
  use the Map UI Component
32
24
  ```jsx
33
- <UtopiaMap
34
- height='360px'
35
- width='100vw'
36
- center={[51.3, 9.6]}
37
- zoom={6}
38
- places={places}
39
- events={events}
40
- tags = {tags}>
41
- </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>
42
48
  ```
43
- 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
44
50
 
45
- ### Sample Data
46
- ```jsx
47
- const places = [{
48
- "id": 51,
49
- "name": "Stadtgemüse",
50
- "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",
51
- "position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
52
- "tags": [9,13],
53
- },
54
- {
55
- "id": 166,
56
- "name": "Weidendom",
57
- "text": "free camping",
58
- "position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
59
- "tags": [10,11]
60
- }];
61
-
62
- const events = [
63
- {
64
- "id": 423,
65
- "name": "Hackathon",
66
- "text": "still in progress",
67
- "position": { "type": "Point", "coordinates": [9.5, 50.62] },
68
- "start": "2022-03-25T12:00:00",
69
- "end": "2022-05-12T12:00:00",
70
- "tags": [10]
71
- }
72
- ]
73
-
74
- const tags = [
75
- {"id": 9, "name": "Gardening", "color": "#008e5b" },
76
- {"id": 10, "name": "Art", "color": "#fdc60b" },
77
- {"id": 11, "name": "Nature", "color": "#8cbb26" },
78
- {"id": 13, "name": "Market", "color": "#2a71b0" }
79
- ]
80
51
 
81
- ```
82
52
 
83
53
  ### Options
84
54
 
85
-
86
55
  Option | Type | Default | Required | Description
87
56
  --- | --- | --- | --- | ---
88
57
  `height` | `string` |`'400px'` | No | height of the map
89
58
  `width` | `string` |`'100vw'` | No | width of the map
90
59
  `center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
91
60
  `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
-
96
- ## Coming Soon
97
-
98
- * Profile UI Component
99
- * Market UI Component
100
- * Calendar UI Component
101
- * Friends
102
- * Groups
103
- * Tags & Colors
104
- * Gamification Elements
61
+
62
+
105
63
 
106
64
  ## Join the community
107
65
 
@@ -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;
@@ -1,11 +1,12 @@
1
1
  import "leaflet/dist/leaflet.css";
2
2
  import * as React from "react";
3
- import { Item, Tag, API, Layer, UtopiaMap as UtopiaMapProps } from "../../types";
4
- import "../../index.css";
3
+ import { Item, Tag, ItemsApi, Layer, UtopiaMap as UtopiaMapProps } from "../../types";
4
+ import "./UtopiaMap.css";
5
5
  export interface MapEventListenerProps {
6
6
  selectMode: Layer | null;
7
- setSelectMode: React.Dispatch<React.SetStateAction<any>>;
7
+ setSelectMode: React.Dispatch<any>;
8
8
  setNewItemPopup: React.Dispatch<React.SetStateAction<any>>;
9
9
  }
10
+ /** This is a description of the foo function. */
10
11
  declare function UtopiaMap({ height, width, center, zoom, children }: UtopiaMapProps): JSX.Element;
11
- export { UtopiaMap, Item, Tag, API };
12
+ export { UtopiaMap, Item, Tag, ItemsApi };
@@ -1,4 +1,3 @@
1
- import { ComponentMeta } from "@storybook/react";
2
1
  import { UtopiaMap } from "./UtopiaMap";
3
2
  declare const _default: ComponentMeta<typeof UtopiaMap>;
4
3
  export default _default;
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
- import { Item } from "../../../types";
2
+ import { Item, Layer } from "../../../types";
3
3
  declare type UseItemManagerResult = ReturnType<typeof useItemsManager>;
4
4
  declare function useItemsManager(initialItems: Item[]): {
5
5
  items: Item[];
6
6
  addItem: (item: Item) => void;
7
7
  updateItem: (item: Item) => void;
8
8
  removeItem: (item: Item) => void;
9
+ resetItems: (layer: Layer) => void;
9
10
  };
10
11
  export declare const ItemsProvider: React.FunctionComponent<{
11
12
  initialItems: Item[];
@@ -15,4 +16,5 @@ export declare const useItems: () => Item[];
15
16
  export declare const useAddItem: () => UseItemManagerResult["addItem"];
16
17
  export declare const useUpdateItem: () => UseItemManagerResult["updateItem"];
17
18
  export declare const useRemoveItem: () => UseItemManagerResult["removeItem"];
19
+ export declare const useResetItems: () => UseItemManagerResult["resetItems"];
18
20
  export {};
@@ -1,3 +1,3 @@
1
- export { UtopiaMap, Item, Tag, API } from './UtopiaMap';
1
+ export { UtopiaMap, Item, Tag, ItemsApi } from './UtopiaMap';
2
2
  export { Layer } from './Layer';
3
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;
package/dist/index.d.ts CHANGED
@@ -1 +1,6 @@
1
- export { UtopiaMap, Layer, Tags, Item, Tag, API } from './Components/Map/index';
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";