@react-fabric/map 1.0.0-beta.58

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/css/styles.css +40 -0
  4. package/dist/cjs/constants/index.js +49 -0
  5. package/dist/cjs/index.js +69 -0
  6. package/dist/cjs/layers/Json.js +31 -0
  7. package/dist/cjs/layers/Marker.js +47 -0
  8. package/dist/cjs/markers/Fill.js +80 -0
  9. package/dist/cjs/markers/Pin.js +92 -0
  10. package/dist/cjs/renderers/Heatmap.js +62 -0
  11. package/dist/cjs/renderers/Simple.js +51 -0
  12. package/dist/cjs/tools/BasemapGallery.js +80 -0
  13. package/dist/cjs/tools/Home.js +134 -0
  14. package/dist/cjs/tools/LayerList.js +43 -0
  15. package/dist/cjs/tools/ScaleBar.js +36 -0
  16. package/dist/cjs/tools/Zoom.js +40 -0
  17. package/dist/cjs/viewer/Context.js +132 -0
  18. package/dist/cjs/viewer/Viewer.js +29 -0
  19. package/dist/esm/constants/index.js +48 -0
  20. package/dist/esm/index.js +68 -0
  21. package/dist/esm/layers/Json.js +31 -0
  22. package/dist/esm/layers/Marker.js +46 -0
  23. package/dist/esm/markers/Fill.js +80 -0
  24. package/dist/esm/markers/Pin.js +92 -0
  25. package/dist/esm/renderers/Heatmap.js +62 -0
  26. package/dist/esm/renderers/Simple.js +51 -0
  27. package/dist/esm/tools/BasemapGallery.js +80 -0
  28. package/dist/esm/tools/Home.js +115 -0
  29. package/dist/esm/tools/LayerList.js +43 -0
  30. package/dist/esm/tools/ScaleBar.js +36 -0
  31. package/dist/esm/tools/Zoom.js +40 -0
  32. package/dist/esm/viewer/Context.js +131 -0
  33. package/dist/esm/viewer/Viewer.js +29 -0
  34. package/dist/types/constants/index.d.ts +22 -0
  35. package/dist/types/index.d.ts +73 -0
  36. package/dist/types/layers/Json.d.ts +1 -0
  37. package/dist/types/layers/Marker.d.ts +14 -0
  38. package/dist/types/markers/Fill.d.ts +12 -0
  39. package/dist/types/markers/Pin.d.ts +16 -0
  40. package/dist/types/renderers/Cluster.d.ts +19 -0
  41. package/dist/types/renderers/Heatmap.d.ts +18 -0
  42. package/dist/types/renderers/Simple.d.ts +38 -0
  43. package/dist/types/tools/BasemapGallery.d.ts +4 -0
  44. package/dist/types/tools/Home.d.ts +4 -0
  45. package/dist/types/tools/LayerList.d.ts +3 -0
  46. package/dist/types/tools/ScaleBar.d.ts +2 -0
  47. package/dist/types/tools/Zoom.d.ts +2 -0
  48. package/dist/types/types/index.d.ts +34 -0
  49. package/dist/types/viewer/Context.d.ts +16 -0
  50. package/dist/types/viewer/Viewer.d.ts +3 -0
  51. package/package.json +61 -0
  52. package/src/constants/index.ts +44 -0
  53. package/src/index.ts +65 -0
  54. package/src/layers/Json.tsx +52 -0
  55. package/src/layers/Marker.tsx +83 -0
  56. package/src/markers/Fill.tsx +117 -0
  57. package/src/markers/Pin.tsx +136 -0
  58. package/src/renderers/Cluster.tsx +99 -0
  59. package/src/renderers/Heatmap.tsx +99 -0
  60. package/src/renderers/Simple.tsx +97 -0
  61. package/src/tools/BasemapGallery.tsx +91 -0
  62. package/src/tools/Home.tsx +134 -0
  63. package/src/tools/LayerList.tsx +41 -0
  64. package/src/tools/ScaleBar.tsx +29 -0
  65. package/src/tools/Zoom.tsx +31 -0
  66. package/src/types/index.ts +54 -0
  67. package/src/viewer/Context.tsx +160 -0
  68. package/src/viewer/Viewer.tsx +42 -0
@@ -0,0 +1,131 @@
1
+ 'use client';
2
+
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
+ import Basemap from '@arcgis/core/Basemap';
5
+ import Point from '@arcgis/core/geometry/Point';
6
+ import SpatialReference from '@arcgis/core/geometry/SpatialReference';
7
+ import VectorTileLayer from '@arcgis/core/layers/VectorTileLayer';
8
+ import { ArcgisScene, ArcgisMap } from '@arcgis/map-components-react';
9
+ import '@arcgis/map-components/components/arcgis-map';
10
+ import '@arcgis/map-components/components/arcgis-popup';
11
+ import '@arcgis/map-components/components/arcgis-scene';
12
+ import { CalciteButton } from '@esri/calcite-components-react';
13
+ import { getLatitudeLongitude } from '@react-fabric/utilities';
14
+ import { useState, useMemo, useEffect, useContext, createContext } from 'react';
15
+ import { BASEMAPS, DEFAULT_VIEWPOINT } from '../constants/index.js';
16
+ import { jsx, jsxs } from 'react/jsx-runtime';
17
+
18
+ var Context = /*#__PURE__*/createContext({});
19
+ var MapProvider = function MapProvider(_ref) {
20
+ var children = _ref.children,
21
+ onClick = _ref.onClick,
22
+ _ref$basemaps = _ref.basemaps,
23
+ basemaps = _ref$basemaps === void 0 ? BASEMAPS : _ref$basemaps,
24
+ _ref$center = _ref.center,
25
+ center = _ref$center === void 0 ? DEFAULT_VIEWPOINT.point : _ref$center,
26
+ _ref$zoom = _ref.zoom,
27
+ zoom = _ref$zoom === void 0 ? DEFAULT_VIEWPOINT.zoom : _ref$zoom,
28
+ _ref$enable3D = _ref.enable3D,
29
+ enable3D = _ref$enable3D === void 0 ? false : _ref$enable3D,
30
+ _ref$disableDrag = _ref.disableDrag,
31
+ disableDrag = _ref$disableDrag === void 0 ? false : _ref$disableDrag,
32
+ _ref$disableZoom = _ref.disableZoom,
33
+ disableZoom = _ref$disableZoom === void 0 ? false : _ref$disableZoom;
34
+ var _useState = useState(null),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ map = _useState2[0],
37
+ setMap = _useState2[1];
38
+ var _useState3 = useState(),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ view = _useState4[0],
41
+ setView = _useState4[1];
42
+ var _useState5 = useState(false),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ is3D = _useState6[0],
45
+ setIs3D = _useState6[1];
46
+ var defaultBaseMap = useMemo(function () {
47
+ var _basemaps$find;
48
+ return (_basemaps$find = basemaps.find(function (b) {
49
+ return b["default"];
50
+ })) !== null && _basemaps$find !== void 0 ? _basemaps$find : basemaps[0];
51
+ }, [basemaps]);
52
+ useEffect(function () {
53
+ view === null || view === void 0 || view.navigation.set("actionMap", {
54
+ dragPrimary: disableDrag ? "none" : "pan",
55
+ dragSecondary: !disableDrag && is3D ? "rotate" : "none",
56
+ dragTertiary: disableZoom ? "none" : "zoom",
57
+ mouseWheel: disableZoom ? "none" : "zoom"
58
+ });
59
+ }, [view, disableDrag, disableZoom, is3D]);
60
+ useEffect(function () {
61
+ if (view && onClick) {
62
+ var handleClick = view.on("click", function (event) {
63
+ var _event$mapPoint$latit, _event$mapPoint$longi;
64
+ event.button === 0 && onClick({
65
+ latitude: (_event$mapPoint$latit = event.mapPoint.latitude) !== null && _event$mapPoint$latit !== void 0 ? _event$mapPoint$latit : 0,
66
+ longitude: (_event$mapPoint$longi = event.mapPoint.longitude) !== null && _event$mapPoint$longi !== void 0 ? _event$mapPoint$longi : 0
67
+ });
68
+ });
69
+ return function () {
70
+ handleClick.remove();
71
+ };
72
+ }
73
+ }, [view, onClick]);
74
+ var E = useMemo(function () {
75
+ return enable3D && is3D ? ArcgisScene : ArcgisMap;
76
+ }, [is3D, enable3D]);
77
+ return /*#__PURE__*/jsx(Context.Provider, {
78
+ value: {
79
+ map: map,
80
+ view: view,
81
+ is3D: is3D,
82
+ disableDrag: disableDrag,
83
+ disableZoom: disableZoom,
84
+ basemaps: basemaps,
85
+ center: center,
86
+ zoom: zoom
87
+ },
88
+ children: /*#__PURE__*/jsxs(E, {
89
+ onArcgisViewReadyChange: function onArcgisViewReadyChange(e) {
90
+ e.target.map && setMap(e.target.map);
91
+ e.target.view && setView(e.target.view);
92
+ },
93
+ className: "area-content overflow-hidden",
94
+ basemap: new Basemap({
95
+ baseLayers: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.layers.map(function (layer) {
96
+ return new VectorTileLayer("url" in layer ? {
97
+ url: layer.url
98
+ } : {
99
+ portalItem: {
100
+ id: layer.portalId
101
+ }
102
+ });
103
+ }),
104
+ title: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.title,
105
+ thumbnailUrl: defaultBaseMap === null || defaultBaseMap === void 0 ? void 0 : defaultBaseMap.thumbnail
106
+ }),
107
+ zoom: zoom,
108
+ center: new Point(getLatitudeLongitude(center)),
109
+ spatialReference: new SpatialReference({
110
+ wkid: 3857
111
+ }),
112
+ children: [enable3D && /*#__PURE__*/jsx(CalciteButton, {
113
+ appearance: "solid",
114
+ kind: "neutral",
115
+ slot: "top-right",
116
+ className: "mb-2",
117
+ iconStart: is3D ? "layer-basemap" : "globe",
118
+ onClick: function onClick() {
119
+ return setIs3D(function (n) {
120
+ return !n;
121
+ });
122
+ }
123
+ }), children]
124
+ })
125
+ });
126
+ };
127
+ var useMap = function useMap() {
128
+ return useContext(Context);
129
+ };
130
+
131
+ export { MapProvider, useMap };
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
+ import '@arcgis/core/assets/esri/themes/light/main.css';
6
+ import { useIsDark, Section } from '@react-fabric/core';
7
+ import { useEffect } from 'react';
8
+ import { MapProvider } from './Context.js';
9
+ import { jsx } from 'react/jsx-runtime';
10
+
11
+ var _excluded = ["children"];
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ var MapViewer = function MapViewer(_ref) {
15
+ var children = _ref.children,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+ var isDark = useIsDark();
18
+ useEffect(function () {
19
+ document.documentElement.classList.toggle("calcite-mode-dark", isDark);
20
+ }, [isDark]);
21
+ return /*#__PURE__*/jsx(Section, {
22
+ className: "relative",
23
+ children: /*#__PURE__*/jsx(MapProvider, _objectSpread(_objectSpread({}, props), {}, {
24
+ children: children
25
+ }))
26
+ });
27
+ };
28
+
29
+ export { MapViewer };
@@ -0,0 +1,22 @@
1
+ export declare const BASEMAPS: ({
2
+ default: boolean;
3
+ title: string;
4
+ thumbnail: string;
5
+ layers: {
6
+ url: string;
7
+ }[];
8
+ } | {
9
+ title: string;
10
+ thumbnail: string;
11
+ layers: {
12
+ url: string;
13
+ }[];
14
+ default?: undefined;
15
+ })[];
16
+ export declare const DEFAULT_VIEWPOINT: {
17
+ point: {
18
+ latitude: number;
19
+ longitude: number;
20
+ };
21
+ zoom: number;
22
+ };
@@ -0,0 +1,73 @@
1
+ export declare const setArcgisAssetsPath: (path: string) => void;
2
+ export { MapViewer } from "./viewer/Viewer";
3
+ export declare namespace MapTools {
4
+ const BasemapGallery: () => import("react/jsx-runtime").JSX.Element;
5
+ const LayerList: () => import("react/jsx-runtime").JSX.Element;
6
+ const Zoom: () => false | import("react/jsx-runtime").JSX.Element;
7
+ const ScaleBar: () => import("react/jsx-runtime").JSX.Element;
8
+ const Home: ({ enableHistory }: {
9
+ enableHistory?: boolean;
10
+ }) => false | import("react/jsx-runtime").JSX.Element;
11
+ }
12
+ export declare namespace MapLayers {
13
+ const Markers: ({ children, ...props }: Omit<__esri.GraphicsLayerProperties, "graphics"> & {
14
+ children?: import("react").ReactElement<(({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
15
+ coords: import("@react-fabric/utilities").LngLatLike[];
16
+ color?: string;
17
+ style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
18
+ borderWidth?: string | number;
19
+ borderColor?: string;
20
+ animate?: boolean;
21
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
22
+ coords: import("@react-fabric/utilities").LngLatLike;
23
+ size?: string | number;
24
+ color?: string;
25
+ path?: string;
26
+ style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
27
+ borderWidth?: string | number;
28
+ borderColor?: string;
29
+ animate?: boolean;
30
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<(({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
31
+ coords: import("@react-fabric/utilities").LngLatLike[];
32
+ color?: string;
33
+ style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
34
+ borderWidth?: string | number;
35
+ borderColor?: string;
36
+ animate?: boolean;
37
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null) | (({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
38
+ coords: import("@react-fabric/utilities").LngLatLike;
39
+ size?: string | number;
40
+ color?: string;
41
+ path?: string;
42
+ style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
43
+ borderWidth?: string | number;
44
+ borderColor?: string;
45
+ animate?: boolean;
46
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null), string | import("react").JSXElementConstructor<any>>[];
47
+ }) => import("react/jsx-runtime").JSX.Element;
48
+ const Json: (props: __esri.GeoJSONLayerProperties) => null;
49
+ }
50
+ export declare namespace MapMarkers {
51
+ const Fill: ({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
52
+ coords: import("@react-fabric/utilities").LngLatLike[];
53
+ color?: string;
54
+ style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
55
+ borderWidth?: string | number;
56
+ borderColor?: string;
57
+ animate?: boolean;
58
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
59
+ const Pin: ({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
60
+ coords: import("@react-fabric/utilities").LngLatLike;
61
+ size?: string | number;
62
+ color?: string;
63
+ path?: string;
64
+ style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | ("pin" | "pin-radius" | "marker" | "marker-radius");
65
+ borderWidth?: string | number;
66
+ borderColor?: string;
67
+ animate?: boolean;
68
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
69
+ }
70
+ export declare namespace MapRenderers {
71
+ const useSimple: (props?: import("./renderers/Simple").Props) => __esri.SimpleRenderer;
72
+ const useHeatmap: (props?: import("./renderers/Heatmap").Props) => __esri.HeatmapRenderer;
73
+ }
@@ -0,0 +1 @@
1
+ export declare const JsonLayer: (props: __esri.GeoJSONLayerProperties) => null;
@@ -0,0 +1,14 @@
1
+ import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
2
+ import "@arcgis/map-components/components/arcgis-features";
3
+ import { ReactElement } from "react";
4
+ import { Fill } from "../markers/Fill";
5
+ import { Pin } from "../markers/Pin";
6
+ type MarkerChildren = ReactElement<typeof Fill | typeof Pin>;
7
+ /**
8
+ * MarkerLayer component for displaying a layer of markers on the map.
9
+ */
10
+ export declare const MarkerLayer: ({ children, ...props }: Omit<__esri.GraphicsLayerProperties, "graphics"> & {
11
+ children?: MarkerChildren | MarkerChildren[];
12
+ }) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const useMarkerLayer: () => GraphicsLayer;
14
+ export {};
@@ -0,0 +1,12 @@
1
+ import { LngLatLike } from "@react-fabric/utilities";
2
+ /**
3
+ * Fill graphic for displaying a fill polygon on the map.
4
+ */
5
+ export declare const Fill: ({ coords, style, color, borderWidth, borderColor, animate, ...props }: {
6
+ coords: LngLatLike[];
7
+ color?: string;
8
+ style?: "backward-diagonal" | "cross" | "diagonal-cross" | "forward-diagonal" | "horizontal" | "none" | "solid" | "vertical";
9
+ borderWidth?: string | number;
10
+ borderColor?: string;
11
+ animate?: boolean;
12
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
@@ -0,0 +1,16 @@
1
+ import { LngLatLike } from "@react-fabric/utilities";
2
+ type Markers = "pin" | "pin-radius" | "marker" | "marker-radius";
3
+ /**
4
+ * Pin graphic for displaying a pin on the map.
5
+ */
6
+ export declare const Pin: ({ coords, style, size, color, path, borderWidth, borderColor, animate, ...props }: {
7
+ coords: LngLatLike;
8
+ size?: string | number;
9
+ color?: string;
10
+ path?: string;
11
+ style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle" | Markers;
12
+ borderWidth?: string | number;
13
+ borderColor?: string;
14
+ animate?: boolean;
15
+ } & Omit<__esri.GraphicProperties, "geometry" | "symbol">) => null;
16
+ export {};
@@ -0,0 +1,19 @@
1
+ import HeatmapRenderer from "@arcgis/core/renderers/HeatmapRenderer";
2
+ interface Props {
3
+ /**
4
+ * Field name to be used for heatmap intensity
5
+ */
6
+ field: string;
7
+ /**
8
+ * Colors for the heatmap gradient. Default is a red to yellow gradient.
9
+ *
10
+ * [color]: creates a color gradient from light to dark
11
+ * [color1, color2]: creates a gradient from color1 to color2
12
+ * [color1, color2, color3]: creates a multi-stop gradient color1 to color2 to color3
13
+ */
14
+ colors?: string[];
15
+ minDensity?: __esri.HeatmapRendererProperties["minDensity"];
16
+ maxDensity?: __esri.HeatmapRendererProperties["maxDensity"];
17
+ }
18
+ export declare const useHeatmapRenderer: (props?: Props) => HeatmapRenderer;
19
+ export {};
@@ -0,0 +1,18 @@
1
+ import HeatmapRenderer from "@arcgis/core/renderers/HeatmapRenderer";
2
+ export interface Props {
3
+ /**
4
+ * Field name to be used for heatmap intensity
5
+ */
6
+ field: string;
7
+ /**
8
+ * Colors for the heatmap gradient. Default is a red to yellow gradient.
9
+ *
10
+ * [color]: creates a color gradient from light to dark
11
+ * [color1, color2]: creates a gradient from color1 to color2
12
+ * [color1, color2, color3]: creates a multi-stop gradient color1 to color2 to color3
13
+ */
14
+ colors?: string[];
15
+ minDensity?: __esri.HeatmapRendererProperties["minDensity"];
16
+ maxDensity?: __esri.HeatmapRendererProperties["maxDensity"];
17
+ }
18
+ export declare const useHeatmapRenderer: (props?: Props) => HeatmapRenderer;
@@ -0,0 +1,38 @@
1
+ import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer";
2
+ export interface Props {
3
+ /**
4
+ * Color of the marker fill. Default is "blue"
5
+ */
6
+ color?: string;
7
+ /**
8
+ * Size of the marker. Default is 4
9
+ */
10
+ size?: number | string;
11
+ /**
12
+ * Path to a custom marker icon.
13
+ */
14
+ path?: string;
15
+ /**
16
+ * Style of the marker. Default is "circle"
17
+ */
18
+ style?: "circle" | "square" | "cross" | "x" | "diamond" | "triangle";
19
+ /**
20
+ * Border color of the marker. Default is "white"
21
+ */
22
+ borderColor?: string;
23
+ /**
24
+ * Border width of the marker. Default is 1
25
+ */
26
+ borderWidth?: number;
27
+ sizeField?: string;
28
+ sizeStops?: Array<{
29
+ value: number;
30
+ size: number | string;
31
+ }>;
32
+ colorField?: string;
33
+ colorStops?: Array<{
34
+ value: number;
35
+ color: string;
36
+ }>;
37
+ }
38
+ export declare const useSimpleRenderer: (props?: Props) => SimpleRenderer;
@@ -0,0 +1,4 @@
1
+ import "@arcgis/map-components/components/arcgis-basemap-gallery";
2
+ import "@arcgis/map-components/components/arcgis-basemap-layer-list";
3
+ import "@arcgis/map-components/components/arcgis-expand";
4
+ export declare const BasemapGallery: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import "@arcgis/map-components/components/arcgis-placement";
2
+ export declare const Home: ({ enableHistory }: {
3
+ enableHistory?: boolean;
4
+ }) => false | import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import "@arcgis/map-components/components/arcgis-expand";
2
+ import "@arcgis/map-components/components/arcgis-layer-list";
3
+ export declare const LayerList: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import "@arcgis/map-components/components/arcgis-scale-bar";
2
+ export declare const ScaleBar: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import "@arcgis/map-components/components/arcgis-zoom";
2
+ export declare const Zoom: () => false | import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { LngLatLike } from "@react-fabric/utilities";
2
+ import { ReactNode } from "react";
3
+ export interface FabricBaseMap {
4
+ title?: string;
5
+ thumbnail?: string;
6
+ default?: boolean;
7
+ layers: Array<{
8
+ url: string;
9
+ } | {
10
+ portalId: string;
11
+ }>;
12
+ }
13
+ export interface MapViewerProps {
14
+ children?: ReactNode;
15
+ /**
16
+ * Initial center position of the map viewer.
17
+ */
18
+ center?: LngLatLike;
19
+ /**
20
+ * Initial zoom level of the map viewer.
21
+ */
22
+ zoom?: number;
23
+ /**
24
+ * Basemaps to be used in the map viewer.
25
+ */
26
+ basemaps?: FabricBaseMap[];
27
+ enable3D?: boolean;
28
+ disableZoom?: boolean;
29
+ disableDrag?: boolean;
30
+ onClick?: (loc: {
31
+ latitude: number;
32
+ longitude: number;
33
+ }) => void;
34
+ }
@@ -0,0 +1,16 @@
1
+ import "@arcgis/map-components/components/arcgis-map";
2
+ import "@arcgis/map-components/components/arcgis-popup";
3
+ import "@arcgis/map-components/components/arcgis-scene";
4
+ import { LngLatLike } from "@react-fabric/utilities";
5
+ import { FabricBaseMap, MapViewerProps } from "../types";
6
+ export declare const MapProvider: ({ children, onClick, basemaps, center, zoom, enable3D, disableDrag, disableZoom, }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const useMap: () => {
8
+ map?: __esri.Map | null;
9
+ view?: __esri.MapView | __esri.SceneView;
10
+ disableDrag?: boolean;
11
+ disableZoom?: boolean;
12
+ basemaps: FabricBaseMap[];
13
+ center: LngLatLike;
14
+ zoom: number;
15
+ is3D: boolean;
16
+ };
@@ -0,0 +1,3 @@
1
+ import "@arcgis/core/assets/esri/themes/light/main.css";
2
+ import { MapViewerProps } from "../types";
3
+ export declare const MapViewer: ({ children, ...props }: MapViewerProps) => import("react/jsx-runtime").JSX.Element;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@react-fabric/map",
3
+ "version": "1.0.0-beta.58",
4
+ "description": "RUF: ArcGIS Map Component for React",
5
+ "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
+ "license": "MIT",
7
+ "repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/map",
8
+ "source": "src/index.ts",
9
+ "main": "dist/cjs/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "types": "dist/types/index.d.ts",
12
+ "directories": {
13
+ "src": "src",
14
+ "styles": "css",
15
+ "test": "tests"
16
+ },
17
+ "files": [
18
+ "css",
19
+ "src",
20
+ "dist"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "registry": "https://registry.npmjs.org/"
25
+ },
26
+ "scripts": {
27
+ "makelink": "yarn link",
28
+ "removelink": "yarn unlink",
29
+ "prebuild": "rm -rf ./dist",
30
+ "build:dts": "tsc -p ./tsconfig.build.json",
31
+ "build:rollup": "rollup -c ../../rollup.config.mjs",
32
+ "build": "npm-run-all -p build:rollup build:dts",
33
+ "watch:dts": "tsc -w -p ./tsconfig.build.json",
34
+ "watch:rollup": "rollup -w -c ../../rollup.config.mjs",
35
+ "watch": "npm-run-all -p watch:rollup watch:dts"
36
+ },
37
+ "dependencies": {
38
+ "@arcgis/core": "~4.34.5",
39
+ "@arcgis/map-components-react": "~4.34.5",
40
+ "@esri/calcite-components-react": "~3.3.3",
41
+ "@floating-ui/react": "~0.27.16",
42
+ "@react-fabric/core": "^1.0.0-beta.58",
43
+ "@react-fabric/utilities": "^1.0.0-beta.58",
44
+ "color": "~5.0.2"
45
+ },
46
+ "peerDependencies": {
47
+ "i18next": "~25.6.0",
48
+ "react": "~19.2.0",
49
+ "react-dom": "~19.2.0",
50
+ "react-i18next": "~16.2.1"
51
+ },
52
+ "devDependencies": {
53
+ "@types/dom-to-image": "~2.6.7",
54
+ "@types/highlight.js": "~10.1.0"
55
+ },
56
+ "engines": {
57
+ "node": ">=18.12.0",
58
+ "npm": ">=8.19.0"
59
+ },
60
+ "gitHead": "7e66f8c498e37a40e410ecafff2ea6b31505dc1a"
61
+ }
@@ -0,0 +1,44 @@
1
+ /*
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2025 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ export const BASEMAPS = [
25
+ {
26
+ default: true,
27
+ title: "OpenFreeMap Bright",
28
+ thumbnail: "/assets/map/bright.png",
29
+ layers: [{ url: "https://tiles.openfreemap.org/styles/bright" }],
30
+ },
31
+ {
32
+ title: "OpenFreeMap Grayscale",
33
+ thumbnail: "/assets/map/gray.png",
34
+ layers: [{ url: "https://tiles.openfreemap.org/styles/positron" }],
35
+ },
36
+ ];
37
+
38
+ export const DEFAULT_VIEWPOINT = {
39
+ point: {
40
+ latitude: 24.449448,
41
+ longitude: 54.529321,
42
+ },
43
+ zoom: 11,
44
+ };
package/src/index.ts ADDED
@@ -0,0 +1,65 @@
1
+ /*
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2025 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ import esriConfig from "@arcgis/core/config";
25
+
26
+ esriConfig.assetsPath = "/assets/@arcgis";
27
+ export const setArcgisAssetsPath = (path: string) => {
28
+ esriConfig.assetsPath = path;
29
+ };
30
+
31
+ export { MapViewer } from "./viewer/Viewer";
32
+
33
+ import { BasemapGallery as _BasemapGallery } from "./tools/BasemapGallery";
34
+ import { Home as _Home } from "./tools/Home";
35
+ import { LayerList as _LayerList } from "./tools/LayerList";
36
+ import { ScaleBar as _ScaleBar } from "./tools/ScaleBar";
37
+ import { Zoom as _Zoom } from "./tools/Zoom";
38
+ export namespace MapTools {
39
+ export const BasemapGallery = _BasemapGallery;
40
+ export const LayerList = _LayerList;
41
+ export const Zoom = _Zoom;
42
+ export const ScaleBar = _ScaleBar;
43
+ export const Home = _Home;
44
+ }
45
+
46
+ import { JsonLayer } from "./layers/Json";
47
+ import { MarkerLayer } from "./layers/Marker";
48
+ export namespace MapLayers {
49
+ export const Markers = MarkerLayer;
50
+ export const Json = JsonLayer;
51
+ }
52
+
53
+ import { Fill as _Fill } from "./markers/Fill";
54
+ import { Pin as _Pin } from "./markers/Pin";
55
+ export namespace MapMarkers {
56
+ export const Fill = _Fill;
57
+ export const Pin = _Pin;
58
+ }
59
+
60
+ import { useHeatmapRenderer } from "./renderers/Heatmap";
61
+ import { useSimpleRenderer } from "./renderers/Simple";
62
+ export namespace MapRenderers {
63
+ export const useSimple = useSimpleRenderer;
64
+ export const useHeatmap = useHeatmapRenderer;
65
+ }