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.
- package/README.md +31 -73
- package/dist/Components/AppShell/AppShell.d.ts +6 -0
- package/dist/Components/AppShell/Content.d.ts +6 -0
- package/dist/Components/AppShell/NavBar.d.ts +5 -0
- package/dist/Components/AppShell/SideBar.d.ts +11 -0
- package/dist/Components/AppShell/SidebarSubmenu.d.ts +8 -0
- package/dist/Components/AppShell/index.d.ts +3 -0
- package/dist/Components/Auth/auth.d.ts +24 -0
- package/dist/Components/Auth/authDirectus.d.ts +30 -0
- package/dist/Components/Auth/index.d.ts +1 -0
- package/dist/Components/Gaming/Modal.d.ts +9 -0
- package/dist/Components/Gaming/Quests.d.ts +2 -0
- package/dist/Components/Gaming/index.d.ts +2 -0
- package/dist/Components/Input/InputText.d.ts +12 -0
- package/dist/Components/Input/TextAreaInput.d.ts +11 -0
- package/dist/Components/Map/UtopiaMap.d.ts +5 -4
- package/dist/Components/Map/UtopiaMap.stories.d.ts +0 -1
- package/dist/Components/Map/hooks/useItems.d.ts +3 -1
- package/dist/Components/Map/index.d.ts +1 -1
- package/dist/Components/Profile/Settings.d.ts +5 -0
- package/dist/Components/Profile/index.d.ts +1 -0
- package/dist/Components/TitleCard.d.ts +9 -0
- package/dist/Components/Typography/Subtitle.d.ts +6 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +658 -167
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/package.json +23 -29
- package/dist/Components/Map/AddButton.d.ts +0 -4
- package/dist/Components/Map/NewItemPopup.d.ts +0 -9
- package/dist/Components/Map/Popup.d.ts +0 -8
- package/dist/Components/Map/Subcomponents/EditItemPopup.d.ts +0 -10
- package/dist/Components/Map/data.new.d.ts +0 -4
- package/dist/Components/Map/hooks/useContext.d.ts +0 -7
- package/dist/Components/Map/hooks/useForceUpdate.d.ts +0 -1
- package/dist/Components/Map/hooks/useMapContext.d.ts +0 -11
- package/dist/Components/Map/hooks/useNewItemPopup.d.ts +0 -12
- package/dist/Components/Map/useItems.d.ts +0 -16
- package/dist/Components/Map/useLayers.d.ts +0 -18
- package/dist/Components/Map/useTags.d.ts +0 -16
- package/dist/stories/Button.d.ts +0 -29
- package/dist/stories/Header.d.ts +0 -13
- package/dist/stories/Page.d.ts +0 -3
- 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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
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
|
-
|
|
93
|
-
|
|
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,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,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,
|
|
4
|
-
import "
|
|
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<
|
|
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,
|
|
12
|
+
export { UtopiaMap, Item, Tag, ItemsApi };
|
|
@@ -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 {};
|
|
@@ -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;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export { UtopiaMap, Layer, Tags, 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";
|