utopia-ui 3.0.82 → 3.0.84

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/dist/index.d.ts CHANGED
@@ -1,40 +1,71 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { GeoJsonObject, Geometry, Point } from 'geojson';
3
3
  export { Point } from 'geojson';
4
- import { LatLng } from 'leaflet';
5
- export { Popup } from 'leaflet';
4
+ import * as react from 'react';
6
5
  import { Key } from 'react';
7
6
  export { default as SVG } from 'react-inlinesvg';
7
+ export { Popup } from 'leaflet';
8
8
 
9
9
  /**
10
- * @category Types
11
- */
12
- interface Tag {
13
- color: string
14
- id: string
15
- name: string
16
- offer_or_need?: boolean
17
- }
18
-
19
- interface UtopiaMapProps {
20
- height?: string
21
- width?: string
22
- center?: [number, number]
23
- zoom?: number
24
- tags?: Tag[]
25
- children?: React.ReactNode
26
- geo?: GeoJsonObject
27
- showFilterControl?: boolean
28
- showLayerControl?: boolean
29
- showGratitudeControl?: boolean
30
- infoText?: string
31
- donationWidget?: boolean
32
- }
33
-
34
- /**
10
+ * This component creates the map.
11
+ * ```tsx
12
+ * <UtopiaMap center={[50.6, 9.5]} zoom={5} height="100dvh" width="100dvw" />
13
+ * ```
14
+ * You can define its {@link Layer | `Layers`} as supcomponents.
15
+ * ```tsx
16
+ * <UtopiaMap center={[50.6, 15.5]} zoom={5} height="100dvh" width="100dvw">
17
+ * <Layer
18
+ * name="events"
19
+ * markerIcon="calendar"
20
+ * markerShape="square"
21
+ * markerDefaultColor="#700"
22
+ * data={events}
23
+ * />
24
+ * <Layer
25
+ * name="places"
26
+ * markerIcon="point"
27
+ * markerShape="circle"
28
+ * markerDefaultColor="#007"
29
+ * data={places}
30
+ * />
31
+ * </UtopiaMap>
32
+ * ```
33
+ * You can also pass {@link Tags | `Tags`} or {@link Permissions | `Permissions`} as subcomponents.
34
+ * ```tsx
35
+ * <UtopiaMap center={[50.6, 15.5]} zoom={5} height="100dvh" width="100dvw">
36
+ * ...
37
+ * <Tags data={tags} />
38
+ * <Permissions data={permissions} />
39
+ * </UtopiaMap>
40
+ * ```
35
41
  * @category Map
36
42
  */
37
- declare function UtopiaMap({ height, width, center, zoom, children, geo, showFilterControl, showGratitudeControl, showLayerControl, infoText, donationWidget, }: UtopiaMapProps): react_jsx_runtime.JSX.Element;
43
+ declare function UtopiaMap({ height, width, center, zoom, children, geo, showFilterControl, showGratitudeControl, showLayerControl, showThemeControl, defaultTheme, donationWidget, }: {
44
+ /** height of the map (default '500px') */
45
+ height?: string;
46
+ /** width of the map (default '100%') */
47
+ width?: string;
48
+ /** initial centered position of the map (default [50.6, 9.5]) */
49
+ center?: [number, number];
50
+ /** initial zoom level of the map (default 10) */
51
+ zoom?: number;
52
+ /** React child-components */
53
+ children?: React.ReactNode;
54
+ /** GeoJSON to display on the map */
55
+ geo?: GeoJsonObject;
56
+ /** show the filter control widget (default false) */
57
+ showFilterControl?: boolean;
58
+ /** show the gratitude control widget (default false) */
59
+ showLayerControl?: boolean;
60
+ /** show the layer control widget (default true) */
61
+ showGratitudeControl?: boolean;
62
+ /** show a widget to switch the theme */
63
+ showThemeControl?: boolean;
64
+ /** the defaut theme */
65
+ defaultTheme?: string;
66
+ /** ask to donate to the Utopia Project OpenCollective campaign (default false) */
67
+ donationWidget?: boolean;
68
+ }): react_jsx_runtime.JSX.Element;
38
69
 
39
70
  /**
40
71
  * @category Types
@@ -125,6 +156,7 @@ interface Item {
125
156
  telephone?: string
126
157
  next_appointment?: string
127
158
  gallery?: GalleryItem[]
159
+ openCollectiveSlug?: string
128
160
 
129
161
  // {
130
162
  // coordinates: [number, number]
@@ -145,14 +177,6 @@ interface Item {
145
177
  } */
146
178
  }
147
179
 
148
- interface ItemFormPopupProps {
149
- position: LatLng
150
- layer: LayerProps
151
- item?: Item
152
- children?: React.ReactNode
153
- setItemFormPopup?: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>>
154
- }
155
-
156
180
  interface ItemType {
157
181
  name: string
158
182
  show_name_input: boolean
@@ -194,20 +218,79 @@ interface LayerProps {
194
218
  public_edit_items?: boolean
195
219
  listed?: boolean
196
220
  item_presets?: Record<string, unknown>
197
- setItemFormPopup?: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>>
198
- itemFormPopup?: ItemFormPopupProps | null
199
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
- clusterRef?: any
201
221
  }
202
222
 
203
223
  /**
204
- * @category Map
224
+ * Tags are used to tag items within the app and the map and to filter by keywords. Every tag has a color.
225
+ * @example
226
+ * ```ts
227
+ * export const tags: Tag[] = [
228
+ * {
229
+ * "id": "e19f46a7-77a4-4a50-99a2-a942dce843a3",
230
+ * "name": "nature",
231
+ * "color": "#9bc53d"
232
+ * },
233
+ * {
234
+ * "id": "2c2099a6-23ac-4308-b91c-86eefeff3a1d",
235
+ * "name": "utopia",
236
+ * "color": "#c3423f"
237
+ * },
238
+ * {
239
+ * "id": "48b2de97-2b9e-432b-b230-7bdc9a5fb6c0",
240
+ * "name": "map",
241
+ * "color": "#5bc0eb"
242
+ * },
243
+ * {
244
+ * "id": "c88f52e6-357b-45fb-a171-9c2b1dceeb8e",
245
+ * "name": "food",
246
+ * "color": "#6761a8"
247
+ * },
248
+ * {
249
+ * "id": "8928cb92-a3c1-4d83-9495-c2eb4fac0bbe",
250
+ * "name": "permaculture",
251
+ * "color": "#44344f"
252
+ * },
253
+ *];
254
+ ```
255
+ * @category Types
205
256
  */
206
- declare const Layer: ({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, userProfileLayer, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef, }: LayerProps) => react_jsx_runtime.JSX.Element;
257
+ interface Tag {
258
+ color: string
259
+ id: string
260
+ name: string
261
+ offer_or_need?: boolean
262
+ }
207
263
 
208
264
  /**
209
265
  * @category Map
210
266
  */
267
+ declare const Layer: ({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, userProfileLayer, customEditLink, customEditParameter, public_edit_items, listed, }: LayerProps) => react_jsx_runtime.JSX.Element;
268
+
269
+ /**
270
+ * This Components injects Tags comming from an {@link ItemsApi | `API`}
271
+ * ```tsx
272
+ * <Tags api={tagsApi} />
273
+ * ```
274
+ * or from on {@link Tag| `Array`}
275
+ * ```tsx
276
+ * <Tags data={tags} />
277
+ * ```
278
+ * Can be child of {@link AppShell | `AppShell`}
279
+ * ```tsx
280
+ * <AppShell>
281
+ * ...
282
+ * <Tags api={tagsApi} />
283
+ * </AppShell>
284
+ * ```
285
+ * Or child of {@link UtopiaMap | `UtopiaMap`}
286
+ * ```tsx
287
+ * <UtopiaMap>
288
+ * ...
289
+ * <Tags api={tagsApi} />
290
+ * </UtopiaMap>
291
+ * ```
292
+ * @category Map
293
+ */
211
294
  declare function Tags({ data, api }: {
212
295
  data?: Tag[];
213
296
  api?: ItemsApi<Tag>;
@@ -239,111 +322,38 @@ interface Permission {
239
322
  }
240
323
 
241
324
  /**
242
- * @category Types
325
+ * This Components injects Permissions comming from an {@link ItemsApi | `API`}
326
+ * ```tsx
327
+ * <Permissions api={itemsApiInstance} adminRole="8141dee8-8e10-48d0-baf1-680aea271298" />
328
+ * ```
329
+ * or from on {@link Permission| `Array`}
330
+ * ```tsx
331
+ * <Permissions data={permissions} adminRole="8141dee8-8e10-48d0-baf1-680aea271298" />
332
+ * ```
333
+ * Can be child of {@link AppShell | `AppShell`}
334
+ * ```tsx
335
+ * <AppShell>
336
+ * ...
337
+ * <Permissions api={itemsApiInstance} adminRole="8141dee8-8e10-48d0-baf1-680aea271298" />
338
+ * </AppShell>
339
+ * ```
340
+ * Or child of {@link UtopiaMap | `UtopiaMap`}
341
+ * ```tsx
342
+ * <UtopiaMap>
343
+ * ...
344
+ * <Permissions api={itemsApiInstance} adminRole="8141dee8-8e10-48d0-baf1-680aea271298" />
345
+ * </UtopiaMap>
346
+ * ```
347
+ * @category Map
243
348
  */
244
- interface PermissionsProps {
349
+ declare function Permissions({ data, api, adminRole, }: {
350
+ /** Array with all the permissions inside */
245
351
  data?: Permission[];
352
+ /** API to fetch all the permissions from a server */
246
353
  api?: ItemsApi<Permission>;
354
+ /** UUID of the admin role which has always all the permissions */
247
355
  adminRole?: string;
248
- }
249
-
250
- /**
251
- * @category Map
252
- */
253
- declare function Permissions({ data, api, adminRole }: PermissionsProps): react_jsx_runtime.JSX.Element;
254
-
255
- /**
256
- * @category Map
257
- */
258
- declare const ItemForm: {
259
- ({ children, item, title, setPopupTitle, }: {
260
- children?: React.ReactNode;
261
- item?: Item;
262
- title?: string;
263
- setPopupTitle?: React.Dispatch<React.SetStateAction<string>>;
264
- }): react_jsx_runtime.JSX.Element;
265
- __TYPE: string;
266
- };
267
-
268
- /**
269
- * @category Map
270
- */
271
- declare const ItemView: {
272
- ({ children, item }: {
273
- children?: React.ReactNode;
274
- item?: Item;
275
- }): react_jsx_runtime.JSX.Element;
276
- __TYPE: string;
277
- };
278
-
279
- /**
280
- * @category Map
281
- */
282
- declare const PopupTextAreaInput: ({ dataField, placeholder, style, item, }: {
283
- dataField: string;
284
- placeholder: string;
285
- style?: string;
286
- item?: Item;
287
- }) => react_jsx_runtime.JSX.Element;
288
-
289
- interface StartEndInputProps {
290
- item?: Item;
291
- showLabels?: boolean;
292
- updateStartValue?: (value: string) => void;
293
- updateEndValue?: (value: string) => void;
294
- }
295
- /**
296
- * @category Map
297
- */
298
- declare const PopupStartEndInput: ({ item, showLabels, updateStartValue, updateEndValue, }: StartEndInputProps) => react_jsx_runtime.JSX.Element;
299
-
300
- /**
301
- * @category Map
302
- */
303
- declare const PopupTextInput: ({ dataField, placeholder, style, item, }: {
304
- dataField: string;
305
- placeholder: string;
306
- style?: string;
307
- item?: Item;
308
- }) => react_jsx_runtime.JSX.Element;
309
-
310
- /**
311
- * @category Map
312
- */
313
- declare const PopupCheckboxInput: ({ dataField, label, item, }: {
314
- dataField: string;
315
- label: string;
316
- item?: Item;
317
- }) => react_jsx_runtime.JSX.Element;
318
-
319
- /**
320
- * @category Map
321
- */
322
- declare const TextView: ({ item, itemId, text, truncate, rawText, itemTextField, }: {
323
- item?: Item;
324
- itemId?: string;
325
- text?: string;
326
- truncate?: boolean;
327
- rawText?: string;
328
- itemTextField?: string;
329
- }) => react_jsx_runtime.JSX.Element;
330
-
331
- /**
332
- * @category Map
333
- */
334
- declare const StartEndView: ({ item }: {
335
- item?: Item;
336
- }) => react_jsx_runtime.JSX.Element;
337
-
338
- /**
339
- * @category Map
340
- */
341
- declare const PopupButton: ({ url, parameterField, text, item, }: {
342
- url: string;
343
- parameterField?: string;
344
- text: string;
345
- item?: Item;
346
- }) => react_jsx_runtime.JSX.Element;
356
+ }): react_jsx_runtime.JSX.Element;
347
357
 
348
358
  /**
349
359
  * @category Types
@@ -356,11 +366,12 @@ interface AssetsApi {
356
366
  /**
357
367
  * @category AppShell
358
368
  */
359
- declare function AppShell({ appName, children, assetsApi, embedded, }: {
369
+ declare function AppShell({ appName, children, assetsApi, embedded, openCollectiveApiKey, }: {
360
370
  appName: string;
361
371
  children: React.ReactNode;
362
372
  assetsApi: AssetsApi;
363
373
  embedded?: boolean;
374
+ openCollectiveApiKey?: string;
364
375
  }): react_jsx_runtime.JSX.Element;
365
376
 
366
377
  interface Route {
@@ -559,6 +570,63 @@ interface InputTextProps {
559
570
  */
560
571
  declare function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required, updateFormValue, }: InputTextProps): react_jsx_runtime.JSX.Element;
561
572
 
573
+ interface StartEndInputProps {
574
+ item?: Item;
575
+ showLabels?: boolean;
576
+ updateStartValue?: (value: string) => void;
577
+ updateEndValue?: (value: string) => void;
578
+ }
579
+
580
+ /**
581
+ * @category Item
582
+ */
583
+ declare const PopupForm: ({ children }: {
584
+ children?: React.ReactNode;
585
+ }) => react_jsx_runtime.JSX.Element;
586
+
587
+ /**
588
+ * @category Item
589
+ */
590
+ declare const PopupView: ({ children }: {
591
+ children?: React.ReactNode;
592
+ }) => (react_jsx_runtime.JSX.Element | null)[];
593
+
594
+ declare const TextView: react.ComponentType<Omit<{
595
+ item?: Item;
596
+ itemId?: string;
597
+ text?: string;
598
+ truncate?: boolean;
599
+ rawText?: string;
600
+ itemTextField?: string;
601
+ }, "item">>;
602
+ declare const StartEndView: react.ComponentType<Omit<{
603
+ item?: Item;
604
+ }, "item">>;
605
+ declare const PopupTextInput: react.ComponentType<Omit<{
606
+ dataField: string;
607
+ placeholder: string;
608
+ style?: string;
609
+ item?: Item;
610
+ }, "item">>;
611
+ declare const PopupButton: react.ComponentType<Omit<{
612
+ url: string;
613
+ parameterField?: string;
614
+ text: string;
615
+ item?: Item;
616
+ }, "item">>;
617
+ declare const PopupCheckboxInput: react.ComponentType<Omit<{
618
+ dataField: string;
619
+ label: string;
620
+ item?: Item;
621
+ }, "item">>;
622
+ declare const PopupTextAreaInput: react.ComponentType<Omit<{
623
+ dataField: string;
624
+ placeholder: string;
625
+ style?: string;
626
+ item?: Item;
627
+ }, "item">>;
628
+ declare const PopupStartEndInput: react.ComponentType<Omit<StartEndInputProps, "item">>;
629
+
562
630
  declare global {
563
631
  interface Window {
564
632
  my_modal_3: {
@@ -567,4 +635,4 @@ declare global {
567
635
  }
568
636
  }
569
637
 
570
- export { AppShell, type AssetsApi, AttestationForm, AuthProvider, CardPage, Content, type Item, ItemForm, ItemView, type ItemsApi, Layer, type LayerProps, LoginPage, MapOverlayPage, MarketView, Modal, OverlayItemsIndexPage, type Permission, Permissions, type PermissionsProps, PopupButton, PopupCheckboxInput, PopupStartEndInput, PopupTextAreaInput, PopupTextInput, ProfileForm, ProfileView, Quests, RequestPasswordPage, SelectUser, SetNewPasswordPage, SideBar, SignupPage, StartEndView, type Tag, Tags, TextAreaInput, TextInput, TextView, TitleCard, type UserApi, type UserItem, UserSettings, UtopiaMap };
638
+ export { AppShell, type AssetsApi, AttestationForm, AuthProvider, CardPage, Content, type Item, type ItemsApi, Layer, type LayerProps, LoginPage, MapOverlayPage, MarketView, Modal, OverlayItemsIndexPage, type Permission, Permissions, PopupButton, PopupCheckboxInput, PopupForm, PopupStartEndInput, PopupTextAreaInput, PopupTextInput, PopupView, ProfileForm, ProfileView, Quests, RequestPasswordPage, SelectUser, SetNewPasswordPage, SideBar, SignupPage, StartEndView, type Tag, Tags, TextAreaInput, TextInput, TextView, TitleCard, type UserApi, type UserItem, UserSettings, UtopiaMap };