@performant-software/geospatial 2.1.2-beta.2 → 2.1.2-beta.3

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 (151) hide show
  1. package/dist/index.cjs178.js +1 -1
  2. package/dist/index.cjs178.js.map +1 -1
  3. package/dist/index.cjs179.js +1 -1
  4. package/dist/index.cjs179.js.map +1 -1
  5. package/dist/index.cjs180.js +4 -1
  6. package/dist/index.cjs180.js.map +1 -1
  7. package/dist/index.cjs181.js +1 -1
  8. package/dist/index.cjs181.js.map +1 -1
  9. package/dist/index.cjs182.js +1 -1
  10. package/dist/index.cjs182.js.map +1 -1
  11. package/dist/index.cjs183.js +1 -1
  12. package/dist/index.cjs183.js.map +1 -1
  13. package/dist/index.cjs184.js +1 -1
  14. package/dist/index.cjs184.js.map +1 -1
  15. package/dist/index.cjs185.js +1 -1
  16. package/dist/index.cjs185.js.map +1 -1
  17. package/dist/index.cjs186.js +1 -1
  18. package/dist/index.cjs186.js.map +1 -1
  19. package/dist/index.cjs187.js +1 -1
  20. package/dist/index.cjs187.js.map +1 -1
  21. package/dist/index.cjs188.js +1 -4
  22. package/dist/index.cjs188.js.map +1 -1
  23. package/dist/index.cjs189.js +1 -1
  24. package/dist/index.cjs189.js.map +1 -1
  25. package/dist/index.cjs190.js +1 -1
  26. package/dist/index.cjs190.js.map +1 -1
  27. package/dist/index.cjs191.js +1 -1
  28. package/dist/index.cjs191.js.map +1 -1
  29. package/dist/index.cjs192.js +1 -1
  30. package/dist/index.cjs192.js.map +1 -1
  31. package/dist/index.cjs193.js +1 -1
  32. package/dist/index.cjs193.js.map +1 -1
  33. package/dist/index.cjs194.js +1 -1
  34. package/dist/index.cjs194.js.map +1 -1
  35. package/dist/index.cjs195.js +1 -1
  36. package/dist/index.cjs195.js.map +1 -1
  37. package/dist/index.cjs196.js +1 -1
  38. package/dist/index.cjs196.js.map +1 -1
  39. package/dist/index.cjs197.js +1 -1
  40. package/dist/index.cjs197.js.map +1 -1
  41. package/dist/index.cjs198.js +1 -1
  42. package/dist/index.cjs198.js.map +1 -1
  43. package/dist/index.cjs199.js +1 -1
  44. package/dist/index.cjs199.js.map +1 -1
  45. package/dist/index.cjs200.js +1 -1
  46. package/dist/index.cjs200.js.map +1 -1
  47. package/dist/index.cjs228.js +1 -1
  48. package/dist/index.cjs234.js +1 -1
  49. package/dist/index.cjs237.js +1 -1
  50. package/dist/index.cjs240.js +1 -1
  51. package/dist/index.cjs243.js +1 -1
  52. package/dist/index.cjs245.js +1 -1
  53. package/dist/index.cjs248.js +1 -1
  54. package/dist/index.cjs249.js +1 -1
  55. package/dist/index.cjs252.js +1 -1
  56. package/dist/index.cjs252.js.map +1 -1
  57. package/dist/index.cjs253.js +1 -1
  58. package/dist/index.cjs253.js.map +1 -1
  59. package/dist/index.cjs254.js +1 -1
  60. package/dist/index.cjs51.js +1 -1
  61. package/dist/index.cjs53.js +1 -1
  62. package/dist/index.cjs62.js +1 -1
  63. package/dist/index.cjs63.js +1 -1
  64. package/dist/index.cjs64.js +1 -1
  65. package/dist/index.cjs65.js +1 -1
  66. package/dist/index.cjs66.js +1 -1
  67. package/dist/index.cjs67.js +1 -1
  68. package/dist/index.cjs68.js +1 -1
  69. package/dist/index.cjs69.js +1 -1
  70. package/dist/index.cjs70.js +1 -1
  71. package/dist/index.cjs71.js +1 -1
  72. package/dist/index.cjs72.js +1 -1
  73. package/dist/index.cjs8.js +1 -1
  74. package/dist/index.cjs8.js.map +1 -1
  75. package/dist/index.es178.js +7 -320
  76. package/dist/index.es178.js.map +1 -1
  77. package/dist/index.es179.js +144 -71
  78. package/dist/index.es179.js.map +1 -1
  79. package/dist/index.es180.js +12197 -3
  80. package/dist/index.es180.js.map +1 -1
  81. package/dist/index.es181.js +3 -18
  82. package/dist/index.es181.js.map +1 -1
  83. package/dist/index.es182.js +3 -13
  84. package/dist/index.es182.js.map +1 -1
  85. package/dist/index.es183.js +33 -28
  86. package/dist/index.es183.js.map +1 -1
  87. package/dist/index.es184.js +3 -7
  88. package/dist/index.es184.js.map +1 -1
  89. package/dist/index.es185.js +23 -2
  90. package/dist/index.es185.js.map +1 -1
  91. package/dist/index.es186.js +2 -10
  92. package/dist/index.es186.js.map +1 -1
  93. package/dist/index.es187.js +3 -150
  94. package/dist/index.es187.js.map +1 -1
  95. package/dist/index.es188.js +2 -12199
  96. package/dist/index.es188.js.map +1 -1
  97. package/dist/index.es189.js +34 -3
  98. package/dist/index.es189.js.map +1 -1
  99. package/dist/index.es190.js +14 -2
  100. package/dist/index.es190.js.map +1 -1
  101. package/dist/index.es191.js +13 -35
  102. package/dist/index.es191.js.map +1 -1
  103. package/dist/index.es192.js +11 -3
  104. package/dist/index.es192.js.map +1 -1
  105. package/dist/index.es193.js +319 -21
  106. package/dist/index.es193.js.map +1 -1
  107. package/dist/index.es194.js +77 -2
  108. package/dist/index.es194.js.map +1 -1
  109. package/dist/index.es195.js +5 -3
  110. package/dist/index.es195.js.map +1 -1
  111. package/dist/index.es196.js +18 -2
  112. package/dist/index.es196.js.map +1 -1
  113. package/dist/index.es197.js +10 -31
  114. package/dist/index.es197.js.map +1 -1
  115. package/dist/index.es198.js +31 -13
  116. package/dist/index.es198.js.map +1 -1
  117. package/dist/index.es199.js +4 -13
  118. package/dist/index.es199.js.map +1 -1
  119. package/dist/index.es200.js +2 -9
  120. package/dist/index.es200.js.map +1 -1
  121. package/dist/index.es228.js +1 -1
  122. package/dist/index.es234.js +1 -1
  123. package/dist/index.es237.js +1 -1
  124. package/dist/index.es240.js +1 -1
  125. package/dist/index.es243.js +2 -2
  126. package/dist/index.es245.js +1 -1
  127. package/dist/index.es248.js +1 -1
  128. package/dist/index.es249.js +1 -1
  129. package/dist/index.es252.js +15 -4
  130. package/dist/index.es252.js.map +1 -1
  131. package/dist/index.es253.js +4 -15
  132. package/dist/index.es253.js.map +1 -1
  133. package/dist/index.es254.js +2 -2
  134. package/dist/index.es51.js +1 -1
  135. package/dist/index.es53.js +12 -12
  136. package/dist/index.es62.js +1 -1
  137. package/dist/index.es63.js +4 -4
  138. package/dist/index.es64.js +2 -2
  139. package/dist/index.es65.js +2 -2
  140. package/dist/index.es66.js +1 -1
  141. package/dist/index.es67.js +1 -1
  142. package/dist/index.es68.js +1 -1
  143. package/dist/index.es69.js +1 -1
  144. package/dist/index.es70.js +1 -1
  145. package/dist/index.es71.js +2 -2
  146. package/dist/index.es72.js +2 -2
  147. package/dist/index.es8.js +0 -1
  148. package/dist/index.es8.js.map +1 -1
  149. package/package.json +1 -1
  150. package/src/components/MapDraw.js +0 -1
  151. package/types/components/MapDraw.js.flow +0 -1
@@ -1,5 +1,5 @@
1
1
  import { memo as m, useRef as u, useEffect as l } from "react";
2
- import { applyReactStyle as a } from "./index.es182.js";
2
+ import { applyReactStyle as a } from "./index.es197.js";
3
3
  import f from "./index.es14.js";
4
4
  function r(t) {
5
5
  const i = f(({ mapLib: c }) => new c.ScaleControl(t), {
@@ -1,7 +1,7 @@
1
1
  import { useContext as m, useRef as L, useState as g, useMemo as x, useEffect as h } from "react";
2
2
  import { MapContext as b } from "./index.es63.js";
3
- import d from "./index.es184.js";
4
- import { deepEqual as l } from "./index.es183.js";
3
+ import d from "./index.es199.js";
4
+ import { deepEqual as l } from "./index.es198.js";
5
5
  function k(t, e, a, o) {
6
6
  if (d(a.id === o.id, "layer id changed"), d(a.type === o.type, "layer type changed"), a.type === "custom" || o.type === "custom")
7
7
  return;
@@ -1,8 +1,8 @@
1
1
  import * as u from "react";
2
2
  import { useContext as f, useRef as y, useState as m, useMemo as g, useEffect as S, cloneElement as h } from "react";
3
3
  import { MapContext as C } from "./index.es63.js";
4
- import s from "./index.es184.js";
5
- import { deepEqual as v } from "./index.es183.js";
4
+ import s from "./index.es199.js";
5
+ import { deepEqual as v } from "./index.es198.js";
6
6
  let x = 0;
7
7
  function U(t, e, a) {
8
8
  if (t.style && t.style._loaded) {
package/dist/index.es8.js CHANGED
@@ -85,7 +85,6 @@ const _ = 2, M = 1e3, a = {
85
85
  O,
86
86
  {
87
87
  apiKey: t.apiKey,
88
- collapsed: !0,
89
88
  marker: !1,
90
89
  position: "top-left",
91
90
  onSelection: u,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es8.js","sources":["../src/components/MapDraw.js"],"sourcesContent":["// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, { type MapboxMap } from 'react-map-gl';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport GeocodingControl from './GeocodingControl';\nimport MapUtils from '../utils/Map';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * MapTiler API key.\n */\n apiKey?: string,\n\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * Controls the type of GeoJSON data returned from the MapTiler Geocoding API.\n */\n geocoding?: undefined | 'point' | 'polygon',\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Callback fired when an item is selected from the geocoding dropdown.\n */\n onGeocodingSelection?: (data: any) => void,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point',\n polygon: 'Polygon'\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapboxMap>();\n\n /**\n * Returns true if the passed geometry type is valid. MapTiler fires the onSelection callback twice: Once after\n * selecting the record from the list (with a point geometry), and once after making a call to the server for the\n * full record (polygon geometry). We should on fire the onGeocodingSelection callback and add the geometry to the\n * map once.\n *\n * @type {function({geometry: {type: *}}): *}\n */\n const isValid = useCallback(({ geometry: { type } }) => (\n (props.geocoding === 'point' && type === GeometryTypes.point)\n || (props.geocoding === 'polygon' && type === GeometryTypes.polygon)\n ), [props.geocoding]);\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => props.onChange(drawRef.current.getAll()), [props.onChange]);\n\n /**\n * Adds the selected geometry to the map.\n *\n * @type {(function({detail: *}): void)|*}\n */\n const onSelection = useCallback(({ detail }) => {\n if (isValid(detail)) {\n // Add the geometry to the map\n drawRef.current.add(detail.geometry);\n\n // Trigger the onChange prop\n onChange();\n\n // Call the onGeocoding selection callback\n props.onGeocodingSelection(detail);\n }\n }, [isValid, onChange, props.onGeocodingSelection]);\n\n /**\n * Sets the map style URL.\n *\n * @type {string}\n */\n const mapStyleUrl = useMemo(() => `${props.mapStyle}?key=${props.apiKey}`, [props.apiKey, props.mapStyle]);\n\n /**\n * Sets the element map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Sets the bounding box for the current geometry\n const bbox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n if (bbox) {\n mapRef.current.fitBounds(bbox, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n onLoad={() => setLoaded(true)}\n mapLib={maplibregl}\n ref={mapRef}\n style={style}\n mapStyle={mapStyleUrl}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.geocoding && (\n <GeocodingControl\n apiKey={props.apiKey}\n collapsed\n marker={false}\n position='top-left'\n onSelection={onSelection}\n showResultMarkers={false}\n />\n )}\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n"],"names":["MapboxDraw","DEFAULT_BUFFER","DEFAULT_ZOOM_DELAY","GeometryTypes","MapDraw","props","loaded","setLoaded","useState","drawRef","useRef","mapRef","isValid","useCallback","type","onChange","onSelection","detail","mapStyleUrl","useMemo","style","useEffect","bbox","MapUtils","_","geometry","feature","jsxs","Map","maplibregl","jsx","DrawControl","GeocodingControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBAA,EAAW,UAAU,QAAQ,eAAe;AAC5CA,EAAW,UAAU,QAAQ,iBAAiB;AAC9CA,EAAW,UAAU,QAAQ,gBAAgB;AAwD7C,MAAMC,IAAiB,GACjBC,IAAqB,KAErBC,IAAgB;AAAA,EACpB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,SAAS;AACX,GAMMC,IAAU,CAACC,MAAiB;AAChC,QAAM,CAACC,GAAQC,CAAS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AA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,oBAAoB;AAAA,MACpB,QAAQ,MAAMrB,EAAU,EAAI;AAAA,MAC5B,QAAQsB;AAAA,MACR,KAAKlB;AAAA,MACL,OAAAS;AAAA,MACA,UAAUF;AAAA,MAEV,UAAA;AAAA,QAAAY,gBAAAA,EAAA;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAKtB;AAAA,YACL,UAAU;AAAA,cACR,aAAa;AAAA,cACb,OAAO;AAAA,cACP,SAAS;AAAA,cACT,OAAO;AAAA,YACT;AAAA,YACA,wBAAwB;AAAA,YACxB,UAAUM;AAAA,YACV,UAAUA;AAAA,YACV,UAAUA;AAAA,YACV,UAAS;AAAA,UAAA;AAAA,QACX;AAAA,QACEV,EAAM,aACNyB,gBAAAA,EAAA;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,QAAQ3B,EAAM;AAAA,YACd,WAAS;AAAA,YACT,QAAQ;AAAA,YACR,UAAS;AAAA,YACT,aAAAW;AAAA,YACA,mBAAmB;AAAA,UAAA;AAAA,QACrB;AAAA,QAEAX,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGd;AAEAD,EAAQ,eAAe;AAAA,EACrB,QAAQH;AAAA,EACR,cAAcC;AAChB;"}
1
+ {"version":3,"file":"index.es8.js","sources":["../src/components/MapDraw.js"],"sourcesContent":["// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, { type MapboxMap } from 'react-map-gl';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport GeocodingControl from './GeocodingControl';\nimport MapUtils from '../utils/Map';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * MapTiler API key.\n */\n apiKey?: string,\n\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * Controls the type of GeoJSON data returned from the MapTiler Geocoding API.\n */\n geocoding?: undefined | 'point' | 'polygon',\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Callback fired when an item is selected from the geocoding dropdown.\n */\n onGeocodingSelection?: (data: any) => void,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point',\n polygon: 'Polygon'\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapboxMap>();\n\n /**\n * Returns true if the passed geometry type is valid. MapTiler fires the onSelection callback twice: Once after\n * selecting the record from the list (with a point geometry), and once after making a call to the server for the\n * full record (polygon geometry). We should on fire the onGeocodingSelection callback and add the geometry to the\n * map once.\n *\n * @type {function({geometry: {type: *}}): *}\n */\n const isValid = useCallback(({ geometry: { type } }) => (\n (props.geocoding === 'point' && type === GeometryTypes.point)\n || (props.geocoding === 'polygon' && type === GeometryTypes.polygon)\n ), [props.geocoding]);\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => props.onChange(drawRef.current.getAll()), [props.onChange]);\n\n /**\n * Adds the selected geometry to the map.\n *\n * @type {(function({detail: *}): void)|*}\n */\n const onSelection = useCallback(({ detail }) => {\n if (isValid(detail)) {\n // Add the geometry to the map\n drawRef.current.add(detail.geometry);\n\n // Trigger the onChange prop\n onChange();\n\n // Call the onGeocoding selection callback\n props.onGeocodingSelection(detail);\n }\n }, [isValid, onChange, props.onGeocodingSelection]);\n\n /**\n * Sets the map style URL.\n *\n * @type {string}\n */\n const mapStyleUrl = useMemo(() => `${props.mapStyle}?key=${props.apiKey}`, [props.apiKey, props.mapStyle]);\n\n /**\n * Sets the element map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Sets the bounding box for the current geometry\n const bbox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n if (bbox) {\n mapRef.current.fitBounds(bbox, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n onLoad={() => setLoaded(true)}\n mapLib={maplibregl}\n ref={mapRef}\n style={style}\n mapStyle={mapStyleUrl}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.geocoding && (\n <GeocodingControl\n apiKey={props.apiKey}\n marker={false}\n position='top-left'\n onSelection={onSelection}\n showResultMarkers={false}\n />\n )}\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n"],"names":["MapboxDraw","DEFAULT_BUFFER","DEFAULT_ZOOM_DELAY","GeometryTypes","MapDraw","props","loaded","setLoaded","useState","drawRef","useRef","mapRef","isValid","useCallback","type","onChange","onSelection","detail","mapStyleUrl","useMemo","style","useEffect","bbox","MapUtils","_","geometry","feature","jsxs","Map","maplibregl","jsx","DrawControl","GeocodingControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBAA,EAAW,UAAU,QAAQ,eAAe;AAC5CA,EAAW,UAAU,QAAQ,iBAAiB;AAC9CA,EAAW,UAAU,QAAQ,gBAAgB;AAwD7C,MAAMC,IAAiB,GACjBC,IAAqB,KAErBC,IAAgB;AAAA,EACpB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,SAAS;AACX,GAMMC,IAAU,CAACC,MAAiB;AAChC,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCC,IAAUC,KACVC,IAASD,KAUTE,IAAUC,EAAY,CAAC,EAAE,UAAU,EAAE,MAAAC,EAAK,EAAA,MAC7CT,EAAM,cAAc,WAAWS,MAASX,EAAc,SACnDE,EAAM,cAAc,aAAaS,MAASX,EAAc,SAC3D,CAACE,EAAM,SAAS,CAAC,GAOdU,IAAWF,EAAY,MAAMR,EAAM,SAASI,EAAQ,QAAQ,OAAQ,CAAA,GAAG,CAACJ,EAAM,QAAQ,CAAC,GAOvFW,IAAcH,EAAY,CAAC,EAAE,QAAAI,QAAa;AAC1C,IAAAL,EAAQK,CAAM,MAERR,EAAA,QAAQ,IAAIQ,EAAO,QAAQ,GAG1BF,KAGTV,EAAM,qBAAqBY,CAAM;AAAA,KAElC,CAACL,GAASG,GAAUV,EAAM,oBAAoB,CAAC,GAO5Ca,IAAcC,EAAQ,M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,EAAM;AAAA,YACd,QAAQ;AAAA,YACR,UAAS;AAAA,YACT,aAAAW;AAAA,YACA,mBAAmB;AAAA,UAAA;AAAA,QACrB;AAAA,QAEAX,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGd;AAEAD,EAAQ,eAAe;AAAA,EACrB,QAAQH;AAAA,EACR,cAAcC;AAChB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/geospatial",
3
- "version": "2.1.2-beta.2",
3
+ "version": "2.1.2-beta.3",
4
4
  "description": "A package of components for all things map-related.",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs.js",
@@ -197,7 +197,6 @@ const MapDraw = (props: Props) => {
197
197
  { props.geocoding && (
198
198
  <GeocodingControl
199
199
  apiKey={props.apiKey}
200
- collapsed
201
200
  marker={false}
202
201
  position='top-left'
203
202
  onSelection={onSelection}
@@ -197,7 +197,6 @@ const MapDraw = (props: Props) => {
197
197
  { props.geocoding && (
198
198
  <GeocodingControl
199
199
  apiKey={props.apiKey}
200
- collapsed
201
200
  marker={false}
202
201
  position='top-left'
203
202
  onSelection={onSelection}