utopia-ui 3.0.35 → 3.0.36

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 CHANGED
@@ -26,103 +26,13 @@ It is the base of [Utopia Map](https://github.com/utopia-os/utopia-map) and [Uto
26
26
 
27
27
  ## Getting Started
28
28
 
29
- ### Basic Map
30
- In this tutorial we learn how we create a basic React app with a Map component using [utopia-ui](https://github.com/utopia-os/utopia-ui) library.
31
-
32
- For this tutorial we use Vite to create an empty React app called "utopia-static-map"
33
-
34
- ```shell
35
- npm create vite@latest utopia-static-map -- --template react
36
- ```
37
-
38
- We open our new app in the terminal and install the [utopia-ui](https://github.com/utopia-os/utopia-ui) package
39
-
40
- ```shell
41
- cd utopia-static-map
42
- npm install utopia-ui
43
- ```
44
-
45
- We open our `src/App.jsx` and we replace the content with
46
-
47
- ```jsx
48
- import { UtopiaMap } from "utopia-ui"
49
-
50
- function App() {
51
- return (
52
- <UtopiaMap center={[50.6, 9.5]} zoom={5} height='100dvh' width="100dvw">
53
- </UtopiaMap>
54
- )
55
- }
56
-
57
- export default App
58
-
59
- ```
60
-
61
- Then we start the development server to check out the result in our browser:
62
-
63
- ```shell
64
- npm run dev
65
- ```
66
-
67
- And can open our first map app in the browser 🙂
68
-
69
- ### Static Layers
70
-
71
- Now we add some static content in two layer.
72
-
73
- First we put some sample data in a new file called `src/sample-data.js`
74
-
75
- ```javascript
76
- export const places = [{
77
- "id": 51,
78
- "name": "Stadtgemüse",
79
- "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",
80
- "position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
81
- },
82
- {
83
- "id": 166,
84
- "name": "Weidendom",
85
- "text": "free camping",
86
- "position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
87
- }];
88
-
89
- export const events = [
90
- {
91
- "id": 423,
92
- "name": "Hackathon",
93
- "text": "still in progress",
94
- "position": { "type": "Point", "coordinates": [10.5, 51.62] },
95
- "start": "2022-03-25T12:00:00",
96
- "end": "2022-05-12T12:00:00",
97
- }
98
- ]
99
- ```
100
-
101
- We want to create two Layers. One we want to call *Places* and the other *Events*
102
-
103
- we import our sample data to the `src/App.jsx`
104
-
105
- ```jsx
106
- import { events, places } from "./sample-data"
107
- ```
108
- and than we create our two `<Layer>` inside of our `<UtopiaMap>` component
109
- ```jsx
110
- <UtopiaMap center={[50.6, 15.5]} zoom={5} height='100dvh' width="100dvw">
111
- <Layer
112
- name='events'
113
- markerIcon='calendar'
114
- markerShape='square'
115
- markerDefaultColor='#700'
116
- data={events} />
117
- <Layer
118
- name='places'
119
- markerIcon='point'
120
- markerShape='circle'
121
- markerDefaultColor='#007'
122
- data={places} />
123
- </UtopiaMap>
124
-
125
- ```
29
+ 1. If you want to use **Utopia UI** in your project, check out [`/exampes`](/examples) to see how to use its components.
30
+
31
+ 2. If you like to contribute to our library, see the [Contribution Guide](/CONTRIBUTING.md) to see how to setup a development environment on your local machine.
32
+
33
+ ## Components
34
+
35
+ ![Utopia UI Components](Components.svg)
126
36
 
127
37
  ## Map Component
128
38
  The map shows various Layers (like places, events, profiles ...) of Items at their respective position whith nice and informative Popup and Profiles.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type ContentProps = {
2
+ type ContentProps = {
3
3
  children?: React.ReactNode;
4
4
  };
5
5
  export declare function Content({ children }: ContentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type route = {
2
+ type route = {
3
3
  path: string;
4
4
  icon: JSX.Element;
5
5
  name: string;
@@ -4,7 +4,7 @@ interface AppState {
4
4
  assetsApi: AssetsApi;
5
5
  userType: string;
6
6
  }
7
- declare type UseAppManagerResult = ReturnType<typeof useAppManager>;
7
+ type UseAppManagerResult = ReturnType<typeof useAppManager>;
8
8
  declare function useAppManager(): {
9
9
  state: AppState;
10
10
  setAppState: (newState: Partial<AppState>) => void;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { AssetsApi } from '#types/AssetsApi';
3
- declare type UseAssetManagerResult = ReturnType<typeof useAssetsManager>;
3
+ type UseAssetManagerResult = ReturnType<typeof useAssetsManager>;
4
4
  declare function useAssetsManager(): {
5
5
  api: AssetsApi;
6
6
  setAssetsApi: (api: AssetsApi) => void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type UseQuestManagerResult = ReturnType<typeof useQuestsManager>;
2
+ type UseQuestManagerResult = ReturnType<typeof useQuestsManager>;
3
3
  declare function useQuestsManager(initialOpen: boolean): {
4
4
  open: boolean;
5
5
  setQuestsOpen: (open: boolean) => void;
@@ -1,4 +1,4 @@
1
- declare type SelectBoxProps = {
1
+ type SelectBoxProps = {
2
2
  labelTitle?: string;
3
3
  labelStyle?: string;
4
4
  type?: string;
@@ -1,4 +1,4 @@
1
- declare type TextAreaProps = {
1
+ type TextAreaProps = {
2
2
  labelTitle?: string;
3
3
  labelStyle?: string;
4
4
  containerStyle?: string;
@@ -1,4 +1,4 @@
1
- declare type InputTextProps = {
1
+ type InputTextProps = {
2
2
  labelTitle?: string;
3
3
  labelStyle?: string;
4
4
  type?: string;
@@ -1,4 +1,4 @@
1
1
  import type { UtopiaMapProps } from '#types/UtopiaMapProps';
2
2
  import 'react-toastify/dist/ReactToastify.css';
3
- declare function UtopiaMap(props: UtopiaMapProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function UtopiaMap({ height, width, center, zoom, children, geo, showFilterControl, showGratitudeControl, showLayerControl, infoText, }: UtopiaMapProps): import("react/jsx-runtime").JSX.Element;
4
4
  export { UtopiaMap };
@@ -1,4 +1,4 @@
1
1
  import 'leaflet/dist/leaflet.css';
2
2
  import './UtopiaMap.css';
3
3
  import type { UtopiaMapProps } from '#types/UtopiaMapProps';
4
- export declare function UtopiaMapInner({ height, width, center, zoom, children, geo, showFilterControl, showGratitudeControl, showLayerControl, infoText, }: UtopiaMapProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function UtopiaMapInner({ children, geo, showFilterControl, showGratitudeControl, showLayerControl, infoText, }: UtopiaMapProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type UseClusterRefManagerResult = ReturnType<typeof useClusterRefManager>;
2
+ type UseClusterRefManagerResult = ReturnType<typeof useClusterRefManager>;
3
3
  declare function useClusterRefManager(): {
4
4
  clusterRef: any;
5
5
  setClusterRef: React.Dispatch<React.SetStateAction<React.MutableRefObject<undefined>>>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { LayerProps } from '#types/LayerProps';
3
3
  import type { Tag } from '#types/Tag';
4
- declare type UseFilterManagerResult = ReturnType<typeof useFilterManager>;
4
+ type UseFilterManagerResult = ReturnType<typeof useFilterManager>;
5
5
  declare function useFilterManager(initialTags: Tag[]): {
6
6
  filterTags: Tag[];
7
7
  searchPhrase: string;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { Item } from '#types/Item';
3
3
  import type { LayerProps } from '#types/LayerProps';
4
- declare type UseItemManagerResult = ReturnType<typeof useItemsManager>;
4
+ type UseItemManagerResult = ReturnType<typeof useItemsManager>;
5
5
  declare function useItemsManager(initialItems: Item[]): {
6
6
  items: Item[];
7
7
  addItem: (item: Item) => void;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { LayerProps } from '#types/LayerProps';
3
- declare type UseItemManagerResult = ReturnType<typeof useLayerManager>;
3
+ type UseItemManagerResult = ReturnType<typeof useLayerManager>;
4
4
  declare function useLayerManager(initialLayers: LayerProps[]): {
5
5
  layers: LayerProps[];
6
6
  addLayer: (layer: LayerProps) => void;
@@ -6,7 +6,7 @@ interface LeafletRef {
6
6
  marker: Marker;
7
7
  popup: Popup;
8
8
  }
9
- declare type UseLeafletRefsManagerResult = ReturnType<typeof useLeafletRefsManager>;
9
+ type UseLeafletRefsManagerResult = ReturnType<typeof useLeafletRefsManager>;
10
10
  declare function useLeafletRefsManager(initialLeafletRefs: {}): {
11
11
  leafletRefs: Record<string, LeafletRef>;
12
12
  addMarker: (item: Item, marker: Marker) => void;
@@ -4,7 +4,7 @@ import type { ItemsApi } from '#types/ItemsApi';
4
4
  import type { LayerProps } from '#types/LayerProps';
5
5
  import type { Permission } from '#types/Permission';
6
6
  import type { PermissionAction } from '#types/PermissionAction';
7
- declare type UsePermissionManagerResult = ReturnType<typeof usePermissionsManager>;
7
+ type UsePermissionManagerResult = ReturnType<typeof usePermissionsManager>;
8
8
  declare function usePermissionsManager(initialPermissions: Permission[]): {
9
9
  permissions: Permission[];
10
10
  setPermissionApi: (api: ItemsApi<any>) => void;
@@ -7,7 +7,7 @@ interface PolygonClickedProps {
7
7
  position: LatLng;
8
8
  setItemFormPopup: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>>;
9
9
  }
10
- declare type UseSelectPositionManagerResult = ReturnType<typeof useSelectPositionManager>;
10
+ type UseSelectPositionManagerResult = ReturnType<typeof useSelectPositionManager>;
11
11
  declare function useSelectPositionManager(): {
12
12
  selectPosition: Item | LayerProps | null;
13
13
  setSelectPosition: React.Dispatch<React.SetStateAction<Item | LayerProps | null>>;
@@ -2,7 +2,7 @@
2
2
  import type { Item } from '#types/Item';
3
3
  import type { ItemsApi } from '#types/ItemsApi';
4
4
  import type { Tag } from '#types/Tag';
5
- declare type UseTagManagerResult = ReturnType<typeof useTagsManager>;
5
+ type UseTagManagerResult = ReturnType<typeof useTagsManager>;
6
6
  declare function useTagsManager(initialTags: Tag[]): {
7
7
  tags: Tag[];
8
8
  addTag: (tag: Tag) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemsApi } from '#types/ItemsApi';
2
2
  export declare const AttestationForm: ({ api }: {
3
- api?: ItemsApi<any> | undefined;
3
+ api?: ItemsApi<unknown> | undefined;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
- export declare const EmojiPicker: ({ selectedEmoji, selectedColor, selectedShape, setSelectedEmoji, setSelectedColor, setSelectedShape, }: {
2
- selectedEmoji: any;
3
- selectedColor: any;
4
- selectedShape: any;
5
- setSelectedEmoji: any;
6
- setSelectedColor: any;
7
- setSelectedShape: any;
8
- }) => import("react/jsx-runtime").JSX.Element;
1
+ interface Props {
2
+ selectedEmoji: string;
3
+ selectedColor: string;
4
+ selectedShape: string;
5
+ setSelectedEmoji: (emoji: string) => void;
6
+ setSelectedColor: (color: string) => void;
7
+ setSelectedShape: (shape: string) => void;
8
+ }
9
+ export declare const EmojiPicker: ({ selectedEmoji, selectedColor, selectedShape, setSelectedEmoji, setSelectedColor, setSelectedShape, }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare function containsUUID(str: string): boolean;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import './index.css';
2
2
  export { UtopiaMap, Layer, Tags, Permissions, ItemForm, ItemView, PopupTextAreaInput, PopupStartEndInput, PopupTextInput, PopupButton, TextView, StartEndView, PopupCheckboxInput, } from './Components/Map';
3
3
  export { AppShell, Content, SideBar, Sitemap } from './Components/AppShell';
4
- export { AuthProvider, useAuth, LoginPage, SignupPage, RequestPasswordPage, SetNewPasswordPage, } from './Components/Auth';
4
+ export { AuthProvider, LoginPage, SignupPage, RequestPasswordPage, SetNewPasswordPage, } from './Components/Auth';
5
5
  export { UserSettings, ProfileView, ProfileForm } from './Components/Profile';
6
6
  export { Quests, Modal } from './Components/Gaming';
7
7
  export { TitleCard, CardPage, MapOverlayPage, OverlayItemsIndexPage, MoonCalendar, SelectUser, AttestationForm, MarketView, } from './Components/Templates';