@mapcomponents/ra-geospatial 1.5.3 → 1.5.5

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 (36) hide show
  1. package/.babelrc +12 -0
  2. package/.storybook/main.ts +19 -0
  3. package/.storybook/manager.js +6 -0
  4. package/.storybook/mapcomponents_logo.png +0 -0
  5. package/.storybook/preview.ts +27 -0
  6. package/.storybook/style.css +20 -0
  7. package/.storybook/wheregroupTheme.js +9 -0
  8. package/README.md +1 -2
  9. package/assets/ra_geospatial_screenshots.png +0 -0
  10. package/eslint.config.cjs +3 -0
  11. package/package.json +28 -42
  12. package/project.json +8 -0
  13. package/src/components/GeospatialInput.stories.tsx +83 -0
  14. package/src/components/GeospatialInput.tsx +14 -17
  15. package/src/components/GeospatialInputMap.tsx +168 -163
  16. package/src/components/GeospatialShow.stories.tsx +84 -0
  17. package/src/components/GeospatialShow.tsx +15 -17
  18. package/src/components/GeospatialShowMap.tsx +53 -58
  19. package/src/contexts/DataContext.jsx +66 -0
  20. package/src/contexts/dataProvider.tsx +30 -0
  21. package/src/contexts/lsDataProvider.js +142 -0
  22. package/src/decorators/ReactAdminDefaultDecorator.tsx +41 -0
  23. package/src/index.ts +2 -2
  24. package/src/layout/GisLayout.jsx +97 -0
  25. package/src/ra_components/Poi.tsx +42 -0
  26. package/src/ra_components/Property.tsx +42 -0
  27. package/src/ra_components/Route.tsx +42 -0
  28. package/src/ra_components/raGeospatialProps.ts +5 -0
  29. package/src/ra_components/raGeospatialWebGisProps.ts +5 -0
  30. package/src/types.d.ts +3 -2
  31. package/tsconfig.json +7 -101
  32. package/tsconfig.lib.json +29 -0
  33. package/vite.config.ts +49 -0
  34. package/dist/index.esm.js +0 -157
  35. package/dist/index.esm.js.map +0 -1
  36. package/rollup.config.js +0 -50
package/.babelrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nx/react/babel",
5
+ {
6
+ "runtime": "automatic",
7
+ "useBuiltIns": "usage"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": []
12
+ }
@@ -0,0 +1,19 @@
1
+ import type { StorybookConfig } from '@storybook/react-vite';
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ['../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
5
+ framework: {
6
+ name: '@storybook/react-vite',
7
+ options: {
8
+ builder: {
9
+ viteConfigPath: 'vite.config.ts',
10
+ },
11
+ },
12
+ },
13
+ };
14
+
15
+ export default config;
16
+
17
+ // To customize your Vite configuration you can use the viteFinal field.
18
+ // Check https://storybook.js.org/docs/react/builders/vite#configuration
19
+ // and https://nx.dev/recipes/storybook/custom-builder-configs
@@ -0,0 +1,6 @@
1
+ import { addons } from "@storybook/addons";
2
+ import wheregroupTheme from "./wheregroupTheme";
3
+
4
+ addons.setConfig({
5
+ theme: wheregroupTheme,
6
+ });
@@ -0,0 +1,27 @@
1
+ import './style.css';
2
+
3
+ export const parameters = {
4
+ docs: {
5
+ inlineStories: false,
6
+ },
7
+ actions: { argTypesRegex: '^on[A-Z].*' },
8
+
9
+ };
10
+
11
+ export const globalTypes = {
12
+ theme: {
13
+ name: 'Theme',
14
+ title: 'Theme',
15
+ description: 'Theme for your components',
16
+ defaultValue: 'light',
17
+ toolbar: {
18
+ icon: 'paintbrush',
19
+ dynamicTitle: true,
20
+ items: [
21
+ { value: 'light', left: '☀️', title: 'Light mode' },
22
+ { value: 'dark', left: '🌙', title: 'Dark mode' },
23
+ ],
24
+ },
25
+ },
26
+ };
27
+ export const tags = ['autodocs'];
@@ -0,0 +1,20 @@
1
+ .docs-story > div:first-child{
2
+ z-index:0;
3
+ }
4
+
5
+ .docs-story > div > div:first-child, .innerZoomElementWrapper, .innerZoomElementWrapper > div:first-child, .innerZoomElementWrapper > div:first-child > div:first-child{
6
+
7
+ position: absolute;
8
+ top: 0;
9
+ bottom: 0;
10
+ left: 0;
11
+ right: 0;
12
+ }
13
+
14
+ .docs-story > div > div:first-child{
15
+ height: initial;
16
+ }
17
+
18
+ .innerZoomElementWrapper > div > div > div:first-child{
19
+ height: 100% !important;
20
+ }
@@ -0,0 +1,9 @@
1
+ import { create } from 'storybook/theming';
2
+ import logo from './mapcomponents_logo.png';
3
+
4
+ export default create({
5
+ base: 'light',
6
+ brandTitle: 'WhereGroup GmbH',
7
+ brandUrl: 'https://wheregroup.com',
8
+ brandImage: logo,
9
+ });
package/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/@mapcomponents%2Fra-geospatial.svg)](https://badge.fury.io/js/@mapcomponents%2Fra-geospatial) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) ![downloads](https://img.shields.io/npm/dt/@mapcomponents%2Fra-geospatial.svg) ![downloads](https://img.shields.io/npm/dm/@mapcomponents%2Fra-geospatial.svg)
6
6
 
7
-
8
7
  Input and view components to work with geospatial data in react admin. This package is based on @mapcomponents/react-maplibre and uses MapLibre-gl to display geospatial data on a map.
9
8
 
10
9
  ![RaGeospatialInput & RaGeospatialShow](https://github.com/mapcomponents/ra-geospatial/blob/main/assets/ra_geospatial_screenshots.png?raw=true)
@@ -72,4 +71,4 @@ export const PoiShow = () => (
72
71
  </SimpleShowLayout>
73
72
  </Show>
74
73
  );
75
- ```
74
+ ```
@@ -0,0 +1,3 @@
1
+ const baseConfig = require('../../eslint.config.mjs').default;
2
+
3
+ module.exports = [...baseConfig];
package/package.json CHANGED
@@ -1,43 +1,29 @@
1
1
  {
2
- "name": "@mapcomponents/ra-geospatial",
3
- "version": "1.5.3",
4
- "description": "",
5
- "private": false,
6
- "main": "index.js",
7
- "license": "MIT",
8
- "module": "dist/index.esm.js",
9
- "source": "src/index.ts",
10
- "types": "dist/index.d.ts",
11
- "type": "module",
12
- "scripts": {
13
- "build": "rollup -c",
14
- "test": "echo \"Error: no test specified\" && exit 1"
15
- },
16
- "author": "",
17
- "dependencies": {
18
- "@turf/turf": "^6.5.0",
19
- "maplibre-gl": "^2.4.0"
20
- },
21
- "devDependencies": {
22
- "@babel/core": "^7.20.12",
23
- "@mapcomponents/react-maplibre": "^0.1.69",
24
- "@rollup/plugin-alias": "^4.0.3",
25
- "@rollup/plugin-babel": "^6.0.3",
26
- "@rollup/plugin-commonjs": "^24.0.1",
27
- "@rollup/plugin-node-resolve": "^15.0.1",
28
- "@rollup/plugin-url": "^8.0.1",
29
- "@turf/helpers": "^6.5.0",
30
- "@types/wellknown": "^0.5.4",
31
- "react": "^18.2.0",
32
- "react-admin": "^4.7.2",
33
- "rollup": "^3.12.0",
34
- "rollup-plugin-delete": "^2.0.0",
35
- "rollup-plugin-import-css": "^3.1.0",
36
- "rollup-plugin-peer-deps-external": "^2.2.4",
37
- "rollup-plugin-postcss": "^4.0.2",
38
- "rollup-plugin-typescript2": "^0.34.1",
39
- "typescript": "^4.9.5",
40
- "wellknown": "^0.5.0"
41
- },
42
- "gitHead": "8570f4d4c3bd5e74a14d80c456a5d7a2039ee285"
43
- }
2
+ "name": "@mapcomponents/ra-geospatial",
3
+ "version": "1.5.5",
4
+ "main": "src/index.ts",
5
+ "types": "./index.d.ts",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./index.mjs",
10
+ "require": "./index.js"
11
+ }
12
+ },
13
+ "dependencies": {
14
+ "@emotion/react": "^11.14.0",
15
+ "@emotion/styled": "^11.14.1",
16
+ "@mapcomponents/react-maplibre": "^1.3.3",
17
+ "@mui/icons-material": "^7.2.0",
18
+ "@mui/material": "^7.2.0",
19
+ "@turf/helpers": "^7.2.0",
20
+ "@turf/turf": "^7.2.0",
21
+ "@types/geojson": "^7946.0.16",
22
+ "lodash": "^4.17.21",
23
+ "maplibre-gl": "^5.6.1",
24
+ "ra-data-fakerest": "^5.10.0",
25
+ "react-admin": "^5.10.0",
26
+ "react-router-dom": "^7.7.1",
27
+ "wellknown": "^0.5.0"
28
+ }
29
+ }
package/project.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "ra-geospatial",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/ra-geospatial/src",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "targets": {}
8
+ }
@@ -0,0 +1,83 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import GeospatialInput from './GeospatialInput';
3
+ import { ReactAdminDefaultDecorator } from '../decorators/ReactAdminDefaultDecorator';
4
+ import { PoiEdit, PoiEditWebGis } from '../ra_components/Poi';
5
+ import { PropertyEdit, PropertyEditWebGis } from '../ra_components/Property';
6
+ import { RouteEdit, RouteEditWebGis } from '../ra_components/Route';
7
+ import GisLayout from '../layout/GisLayout';
8
+
9
+ const meta = {
10
+ component: GeospatialInput,
11
+ title: 'MapComponents/GeospatialInput',
12
+ decorators: [ReactAdminDefaultDecorator],
13
+ } satisfies Meta<typeof GeospatialInput>;
14
+
15
+ export default meta;
16
+
17
+ export const PoisEdit = PoiEdit.bind({});
18
+
19
+ PoisEdit.args = {
20
+ primary: true,
21
+ embeddedMap: true,
22
+ };
23
+
24
+ PoisEdit.parameters = {
25
+ name: 'pois',
26
+ };
27
+ export const PropertiesEdit = PropertyEdit.bind({});
28
+
29
+ PropertiesEdit.args = {
30
+ primary: true,
31
+ embeddedMap: true,
32
+ };
33
+
34
+ PropertiesEdit.parameters = {
35
+ name: 'properties',
36
+ };
37
+
38
+ export const RoutesEdit = RouteEdit.bind({});
39
+
40
+ RoutesEdit.args = {
41
+ primary: true,
42
+ embeddedMap: true,
43
+ };
44
+
45
+ RoutesEdit.parameters = {
46
+ name: 'routes',
47
+ };
48
+
49
+ export const PoisEditGIS = PoiEditWebGis.bind({});
50
+
51
+ PoisEditGIS.args = {
52
+ primary: true,
53
+ embeddedMap: false,
54
+ };
55
+
56
+ PoisEditGIS.parameters = {
57
+ name: 'pois',
58
+ layout: GisLayout,
59
+ };
60
+
61
+ export const PropertiesEditGIS = PropertyEditWebGis.bind({});
62
+
63
+ PropertiesEditGIS.args = {
64
+ primary: true,
65
+ embeddedMap: false,
66
+ };
67
+
68
+ PropertiesEditGIS.parameters = {
69
+ name: 'properties',
70
+ layout: GisLayout,
71
+ };
72
+
73
+ export const RoutesEditGIS = RouteEditWebGis.bind({});
74
+
75
+ RoutesEditGIS.args = {
76
+ primary: true,
77
+ embeddedMap: false,
78
+ };
79
+
80
+ RoutesEditGIS.parameters = {
81
+ name: 'routes',
82
+ layout: GisLayout,
83
+ };
@@ -1,24 +1,21 @@
1
- import React from "react";
2
- import { MapComponentsProvider } from "@mapcomponents/react-maplibre";
3
- import GeometryInputMap, {
4
- GeospatialInputMapProps,
5
- } from "./GeospatialInputMap.js";
1
+ import { MapComponentsProvider } from '@mapcomponents/react-maplibre';
2
+ import GeospatialInputMap, { GeospatialInputMapProps } from './GeospatialInputMap.js';
6
3
 
7
4
  function GeospatialInput(props: GeospatialInputMapProps) {
8
- return (
9
- <>
10
- {props.embeddedMap ? (
11
- <MapComponentsProvider>
12
- <GeometryInputMap {...props} />
13
- </MapComponentsProvider>
14
- ) : (
15
- <GeometryInputMap {...props} />
16
- )}
17
- </>
18
- );
5
+ return (
6
+ <>
7
+ {props.embeddedMap ? (
8
+ <MapComponentsProvider>
9
+ <GeospatialInputMap {...props} />
10
+ </MapComponentsProvider>
11
+ ) : (
12
+ <GeospatialInputMap {...props} />
13
+ )}
14
+ </>
15
+ );
19
16
  }
20
17
  GeospatialInput.defaultProps = {
21
- embeddedMap: true,
18
+ embeddedMap: true,
22
19
  };
23
20
 
24
21
  export default GeospatialInput;