react-spatial 1.5.3 → 1.5.4
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/components/BaseLayerSwitcher/BaseLayerSwitcher.js +231 -0
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -0
- package/components/BaseLayerSwitcher/index.js +1 -0
- package/components/BaseLayerSwitcher/index.js.map +7 -0
- package/components/BasicMap/BasicMap.js +278 -0
- package/components/BasicMap/BasicMap.js.map +7 -0
- package/components/BasicMap/index.js +1 -0
- package/components/BasicMap/index.js.map +7 -0
- package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.js +93 -320
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -0
- package/components/CanvasSaveButton/index.js +1 -0
- package/components/CanvasSaveButton/index.js.map +7 -0
- package/components/Copyright/Copyright.js +55 -0
- package/components/Copyright/Copyright.js.map +7 -0
- package/components/Copyright/index.js +1 -0
- package/components/Copyright/index.js.map +7 -0
- package/components/FeatureExportButton/FeatureExportButton.js +62 -0
- package/components/FeatureExportButton/FeatureExportButton.js.map +7 -0
- package/components/FeatureExportButton/index.js +1 -0
- package/components/FeatureExportButton/index.js.map +7 -0
- package/components/FitExtent/FitExtent.js +32 -0
- package/components/FitExtent/FitExtent.js.map +7 -0
- package/components/FitExtent/index.js +1 -0
- package/components/FitExtent/index.js.map +7 -0
- package/{src/components → components}/Geolocation/Geolocation.js +61 -144
- package/components/Geolocation/Geolocation.js.map +7 -0
- package/components/Geolocation/index.js +1 -0
- package/components/Geolocation/index.js.map +7 -0
- package/components/LayerTree/LayerTree.js +278 -0
- package/components/LayerTree/LayerTree.js.map +7 -0
- package/components/LayerTree/index.js +1 -0
- package/components/LayerTree/index.js.map +7 -0
- package/components/MousePosition/MousePosition.js +110 -0
- package/components/MousePosition/MousePosition.js.map +7 -0
- package/components/MousePosition/index.js +1 -0
- package/components/MousePosition/index.js.map +7 -0
- package/components/NorthArrow/NorthArrow.js +43 -0
- package/components/NorthArrow/NorthArrow.js.map +7 -0
- package/components/NorthArrow/index.js +1 -0
- package/components/NorthArrow/index.js.map +7 -0
- package/components/Overlay/Overlay.js +122 -0
- package/components/Overlay/Overlay.js.map +7 -0
- package/components/Overlay/index.js +1 -0
- package/components/Overlay/index.js.map +7 -0
- package/components/Permalink/Permalink.js +206 -0
- package/components/Permalink/Permalink.js.map +7 -0
- package/components/Permalink/index.js +1 -0
- package/components/Permalink/index.js.map +7 -0
- package/{src/components → components}/Popup/Popup.js +55 -165
- package/components/Popup/Popup.js.map +7 -0
- package/components/Popup/index.js +1 -0
- package/components/Popup/index.js.map +7 -0
- package/{src/components → components}/ResizeHandler/ResizeHandler.js +15 -50
- package/components/ResizeHandler/ResizeHandler.js.map +7 -0
- package/components/ResizeHandler/index.js +1 -0
- package/components/ResizeHandler/index.js.map +7 -0
- package/components/RouteSchedule/RouteSchedule.js +223 -0
- package/components/RouteSchedule/RouteSchedule.js.map +7 -0
- package/components/RouteSchedule/index.js +1 -0
- package/components/RouteSchedule/index.js.map +7 -0
- package/components/ScaleLine/ScaleLine.js +32 -0
- package/components/ScaleLine/ScaleLine.js.map +7 -0
- package/components/ScaleLine/index.js +1 -0
- package/components/ScaleLine/index.js.map +7 -0
- package/components/StopsFinder/StopsFinder.js +210 -0
- package/components/StopsFinder/StopsFinder.js.map +7 -0
- package/components/StopsFinder/StopsFinderOption.js +51 -0
- package/components/StopsFinder/StopsFinderOption.js.map +7 -0
- package/components/StopsFinder/index.js +1 -0
- package/components/StopsFinder/index.js.map +7 -0
- package/components/Zoom/Zoom.js +130 -0
- package/components/Zoom/Zoom.js.map +7 -0
- package/components/Zoom/index.js +1 -0
- package/components/Zoom/index.js.map +7 -0
- package/package.json +1 -1
- package/{src/propTypes.js → propTypes.js} +12 -16
- package/propTypes.js.map +7 -0
- package/{src/setupTests.js → setupTests.js} +1 -1
- package/setupTests.js.map +7 -0
- package/utils/GlobalsForOle.js +94 -0
- package/utils/GlobalsForOle.js.map +7 -0
- package/utils/KML.js +412 -0
- package/utils/KML.js.map +7 -0
- package/utils/KMLFormat.js +69 -0
- package/utils/KMLFormat.js.map +7 -0
- package/{src/utils → utils}/Styles.js +14 -20
- package/utils/Styles.js.map +7 -0
- package/{src/utils → utils}/getPolygonPattern.js +6 -34
- package/utils/getPolygonPattern.js.map +7 -0
- package/{src/utils → utils}/timeUtils.js +5 -22
- package/utils/timeUtils.js.map +7 -0
- package/.github/workflows/conventional-pr-title.yml +0 -21
- package/.github/workflows/main.yml +0 -28
- package/.husky/commit-msg +0 -4
- package/.husky/post-checkout +0 -4
- package/.husky/post-merge +0 -4
- package/.husky/post-rebase +0 -4
- package/.husky/pre-commit +0 -4
- package/.nvmrc +0 -1
- package/.whitesource +0 -8
- package/CHANGELOG.md +0 -65
- package/DEVELOP.md +0 -113
- package/__mocks__/mapbox-gl.js +0 -11
- package/__mocks__/resize-observer-polyfill.js +0 -9
- package/babel.config.js +0 -3
- package/commitlint.config.js +0 -1
- package/data/topic1.js +0 -119
- package/data/topic2.js +0 -28
- package/doc/README.md +0 -21
- package/doc/doc-config.json +0 -4
- package/pull_request_template.md +0 -16
- package/renovate.json +0 -4
- package/scripts/read-pkg-json.js +0 -17
- package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.js +0 -322
- package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -69
- package/src/components/BaseLayerSwitcher/README.md +0 -61
- package/src/components/BaseLayerSwitcher/__snapshots__/BaseLayerSwitcher.test.js.snap +0 -88
- package/src/components/BaseLayerSwitcher/index.js +0 -1
- package/src/components/BasicMap/BasicMap.js +0 -413
- package/src/components/BasicMap/BasicMap.test.js +0 -281
- package/src/components/BasicMap/README.md +0 -18
- package/src/components/BasicMap/index.js +0 -1
- package/src/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -148
- package/src/components/CanvasSaveButton/README.md +0 -76
- package/src/components/CanvasSaveButton/__snapshots__/CanvasSaveButton.test.js.snap +0 -76
- package/src/components/CanvasSaveButton/index.js +0 -1
- package/src/components/Copyright/Copyright.js +0 -89
- package/src/components/Copyright/Copyright.test.js +0 -134
- package/src/components/Copyright/README.md +0 -36
- package/src/components/Copyright/index.js +0 -1
- package/src/components/FeatureExportButton/FeatureExportButton.js +0 -118
- package/src/components/FeatureExportButton/FeatureExportButton.test.js +0 -417
- package/src/components/FeatureExportButton/README.md +0 -76
- package/src/components/FeatureExportButton/__snapshots__/FeatureExportButton.test.js.snap +0 -67
- package/src/components/FeatureExportButton/index.js +0 -1
- package/src/components/FitExtent/FitExtent.js +0 -62
- package/src/components/FitExtent/FitExtent.test.js +0 -48
- package/src/components/FitExtent/README.md +0 -34
- package/src/components/FitExtent/__snapshots__/FitExtent.test.js.snap +0 -13
- package/src/components/FitExtent/index.js +0 -1
- package/src/components/Geolocation/Geolocation.test.js +0 -267
- package/src/components/Geolocation/README.md +0 -25
- package/src/components/Geolocation/__snapshots__/Geolocation.test.js.snap +0 -92
- package/src/components/Geolocation/index.js +0 -1
- package/src/components/LayerTree/LayerTree.js +0 -487
- package/src/components/LayerTree/LayerTree.test.js +0 -337
- package/src/components/LayerTree/README.md +0 -92
- package/src/components/LayerTree/__snapshots__/LayerTree.test.js.snap +0 -1746
- package/src/components/LayerTree/index.js +0 -1
- package/src/components/MousePosition/MousePosition.js +0 -175
- package/src/components/MousePosition/MousePosition.test.js +0 -132
- package/src/components/MousePosition/README.md +0 -50
- package/src/components/MousePosition/__snapshots__/MousePosition.test.js.snap +0 -76
- package/src/components/MousePosition/index.js +0 -1
- package/src/components/NorthArrow/NorthArrow.js +0 -75
- package/src/components/NorthArrow/NorthArrow.test.js +0 -104
- package/src/components/NorthArrow/README.md +0 -59
- package/src/components/NorthArrow/__snapshots__/NorthArrow.test.js.snap +0 -117
- package/src/components/NorthArrow/index.js +0 -1
- package/src/components/Overlay/Overlay.js +0 -176
- package/src/components/Overlay/Overlay.test.js +0 -149
- package/src/components/Overlay/README.md +0 -59
- package/src/components/Overlay/__snapshots__/Overlay.test.js.snap +0 -9
- package/src/components/Overlay/index.js +0 -1
- package/src/components/Permalink/Permalink.js +0 -326
- package/src/components/Permalink/Permalink.test.js +0 -285
- package/src/components/Permalink/README.md +0 -105
- package/src/components/Permalink/index.js +0 -1
- package/src/components/Popup/Popup.test.js +0 -307
- package/src/components/Popup/README.md +0 -93
- package/src/components/Popup/__snapshots__/Popup.test.js.snap +0 -180
- package/src/components/Popup/index.js +0 -1
- package/src/components/README.md +0 -41
- package/src/components/ResizeHandler/ResizeHandler.test.js +0 -344
- package/src/components/ResizeHandler/index.js +0 -1
- package/src/components/RouteSchedule/README.md +0 -118
- package/src/components/RouteSchedule/RouteSchedule.js +0 -370
- package/src/components/RouteSchedule/RouteSchedule.test.js +0 -113
- package/src/components/RouteSchedule/__snapshots__/RouteSchedule.test.js.snap +0 -248
- package/src/components/RouteSchedule/index.js +0 -1
- package/src/components/ScaleLine/README.md +0 -29
- package/src/components/ScaleLine/ScaleLine.js +0 -50
- package/src/components/ScaleLine/ScaleLine.test.js +0 -30
- package/src/components/ScaleLine/__snapshots__/ScaleLine.test.js.snap +0 -7
- package/src/components/ScaleLine/index.js +0 -1
- package/src/components/StopsFinder/README.md +0 -50
- package/src/components/StopsFinder/StopsFinder.js +0 -284
- package/src/components/StopsFinder/StopsFinder.test.js +0 -17
- package/src/components/StopsFinder/StopsFinderOption.js +0 -61
- package/src/components/StopsFinder/__snapshots__/StopsFinder.test.js.snap +0 -133
- package/src/components/StopsFinder/index.js +0 -1
- package/src/components/Zoom/README.md +0 -25
- package/src/components/Zoom/Zoom.js +0 -180
- package/src/components/Zoom/Zoom.test.js +0 -141
- package/src/components/Zoom/__snapshots__/Zoom.test.js.snap +0 -201
- package/src/components/Zoom/index.js +0 -1
- package/src/styleguidist/ComponentsList.js +0 -52
- package/src/styleguidist/StyleGuide.js +0 -277
- package/src/styleguidist/styleguidist.css +0 -38
- package/src/utils/GlobalsForOle.js +0 -99
- package/src/utils/KML.js +0 -594
- package/src/utils/KML.test.js +0 -337
- package/src/utils/KMLFormat.js +0 -100
- package/src/utils/KMLFormat.test.js +0 -50
- package/src/utils/__snapshots__/KML.test.js.snap.KML-readFeatures()-and-writeFeatures()-should-read-and-write-lineDash-and-fillPattern-style-for-polygon.canvas-image.png +0 -0
- package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-2-(cross)-color-and-(light-blue)-opacity.canvas-image.png +0 -0
- package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-3-(diagonal-line-from-bottom-left-tot-top-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
- package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-4-(diagonal-line-from-top-left-to-bottom-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
- package/src/utils/getPolygonPattern.test.js +0 -61
- package/src/utils/timeUtils.test.js +0 -30
- package/styleguide.config.js +0 -251
- /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.md.scss +0 -0
- /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.scss +0 -0
- /package/{src/components → components}/BasicMap/BasicMap.md.scss +0 -0
- /package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.md.scss +0 -0
- /package/{src/components → components}/Copyright/Copyright.md.scss +0 -0
- /package/{src/components → components}/FeatureExportButton/FeatureExportButton.md.scss +0 -0
- /package/{src/components → components}/FitExtent/FitExtent.md.scss +0 -0
- /package/{src/components → components}/Geolocation/Geolocation.md.scss +0 -0
- /package/{src/components → components}/Geolocation/Geolocation.scss +0 -0
- /package/{src/components → components}/LayerTree/LayerTree.md.scss +0 -0
- /package/{src/components → components}/LayerTree/LayerTree.scss +0 -0
- /package/{src/components → components}/MousePosition/MousePosition.md.scss +0 -0
- /package/{src/components → components}/NorthArrow/NorthArrow.scss +0 -0
- /package/{src/components → components}/Overlay/Overlay.md.scss +0 -0
- /package/{src/components → components}/Overlay/Overlay.scss +0 -0
- /package/{src/components → components}/Permalink/Permalink.md.scss +0 -0
- /package/{src/components → components}/Popup/Popup.md.scss +0 -0
- /package/{src/components → components}/Popup/Popup.scss +0 -0
- /package/{src/components → components}/RouteSchedule/RouteSchedule.md.scss +0 -0
- /package/{src/components → components}/RouteSchedule/RouteSchedule.scss +0 -0
- /package/{src/components → components}/ScaleLine/ScaleLine.scss +0 -0
- /package/{src/components → components}/Zoom/Zoom.md.scss +0 -0
- /package/{src/components → components}/Zoom/Zoom.scss +0 -0
- /package/{src/images → images}/RouteSchedule/firstStation.png +0 -0
- /package/{src/images → images}/RouteSchedule/lastStation.png +0 -0
- /package/{src/images → images}/RouteSchedule/line.png +0 -0
- /package/{src/images → images}/RouteSchedule/station.png +0 -0
- /package/{src/images → images}/baselayer/baselayer.basebright.png +0 -0
- /package/{src/images → images}/baselayer/baselayer.osm.png +0 -0
- /package/{src/images → images}/baselayer/baselayer.travic.png +0 -0
- /package/{src/images → images}/baselayer/open.topo.map.png +0 -0
- /package/{src/images → images}/baselayer/osm.baselayer.hot.png +0 -0
- /package/{src/images → images}/baselayer/osm.baselayer.png +0 -0
- /package/{src/images → images}/favicon.png +0 -0
- /package/{src/images → images}/geops_logo.png +0 -0
- /package/{src/images → images}/geops_logo.svg +0 -0
- /package/{src/images → images}/geops_qr.png +0 -0
- /package/{src/images → images}/mots/bus_poi-blue-01.svg +0 -0
- /package/{src/images → images}/mots/bus_poi-grey-01.svg +0 -0
- /package/{src/images → images}/mots/bus_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/bus_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/bus_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/bus_square-grey-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_poi-blue-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_poi-grey-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/cable_car_square-grey-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_poi-blue-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_poi-grey-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/ferry_square-grey-01.svg +0 -0
- /package/{src/images → images}/mots/funicular_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/funicular_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/funicular_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/gondola_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/rail_poi-blue-01.svg +0 -0
- /package/{src/images → images}/mots/rail_poi-grey-01.svg +0 -0
- /package/{src/images → images}/mots/rail_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/rail_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/rail_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/rail_square-grey-01.svg +0 -0
- /package/{src/images → images}/mots/subway_round blue-01.svg +0 -0
- /package/{src/images → images}/mots/subway_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/tram_poi-blue-01.svg +0 -0
- /package/{src/images → images}/mots/tram_poi-grey-01.svg +0 -0
- /package/{src/images → images}/mots/tram_round-blue-01.svg +0 -0
- /package/{src/images → images}/mots/tram_round-grey-01.svg +0 -0
- /package/{src/images → images}/mots/tram_square-blue-01.svg +0 -0
- /package/{src/images → images}/mots/tram_square-grey-01.svg +0 -0
- /package/{src/images → images}/northArrow.svg +0 -0
- /package/{src/images → images}/northArrow.url.svg +0 -0
- /package/{src/images → images}/northArrowCircle.svg +0 -0
- /package/{src/images → images}/northArrowCircle.url.svg +0 -0
- /package/{src/themes → themes}/README.md +0 -0
- /package/{src/themes → themes}/default/components.scss +0 -0
- /package/{src/themes → themes}/default/examples.scss +0 -0
- /package/{src/themes → themes}/default/index.scss +0 -0
- /package/{src/themes → themes}/default/mixins.scss +0 -0
- /package/{src/themes → themes}/default/variables.scss +0 -0
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`NorthArrow should match snapshot rotated. 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
className="rs-north-arrow"
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"transform": "rotate(45deg)",
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
>
|
|
12
|
-
<svg
|
|
13
|
-
data-file-name="SvgNorthArrow"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
exports[`NorthArrow should match snapshot with children. 1`] = `
|
|
19
|
-
<div
|
|
20
|
-
className="rs-north-arrow"
|
|
21
|
-
style={
|
|
22
|
-
{
|
|
23
|
-
"transform": "rotate(0deg)",
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
>
|
|
27
|
-
<svg
|
|
28
|
-
baseProfile="tiny"
|
|
29
|
-
fill="currentColor"
|
|
30
|
-
height="1em"
|
|
31
|
-
stroke="currentColor"
|
|
32
|
-
strokeWidth="0"
|
|
33
|
-
style={
|
|
34
|
-
{
|
|
35
|
-
"color": undefined,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
version="1.2"
|
|
39
|
-
viewBox="0 0 24 24"
|
|
40
|
-
width="1em"
|
|
41
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
-
>
|
|
43
|
-
<circle
|
|
44
|
-
cx="8.5"
|
|
45
|
-
cy="8.5"
|
|
46
|
-
r="2.5"
|
|
47
|
-
/>
|
|
48
|
-
<path
|
|
49
|
-
d="M16 10c-2 0-3 3-4.5 3s-1.499-1-3.5-1c-2 0-3.001 4-3.001 4h14.001s-1-6-3-6zM20 3h-16c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h16c1.103 0 2-.897 2-2v-12c0-1.103-.897-2-2-2zm0 14h-16v-12h16v12z"
|
|
50
|
-
/>
|
|
51
|
-
</svg>
|
|
52
|
-
</div>
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
exports[`NorthArrow should match snapshot with circle. 1`] = `
|
|
56
|
-
<div
|
|
57
|
-
className="rs-north-arrow"
|
|
58
|
-
style={
|
|
59
|
-
{
|
|
60
|
-
"transform": "rotate(0deg)",
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
>
|
|
64
|
-
<svg
|
|
65
|
-
data-file-name="SvgNorthArrowCircle"
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
exports[`NorthArrow should match snapshot with custom attributes. 1`] = `
|
|
71
|
-
<div
|
|
72
|
-
className="test-class"
|
|
73
|
-
style={
|
|
74
|
-
{
|
|
75
|
-
"transform": "rotate(0deg)",
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
tabIndex={0}
|
|
79
|
-
>
|
|
80
|
-
<svg
|
|
81
|
-
data-file-name="SvgNorthArrow"
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
exports[`NorthArrow should match snapshot with default value. 1`] = `
|
|
87
|
-
<div
|
|
88
|
-
className="rs-north-arrow"
|
|
89
|
-
style={
|
|
90
|
-
{
|
|
91
|
-
"transform": "rotate(0deg)",
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
>
|
|
95
|
-
<svg
|
|
96
|
-
data-file-name="SvgNorthArrow"
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
exports[`NorthArrow should react on view rotation (transform: \`rotate(20deg)\`) 1`] = `
|
|
102
|
-
<div class="rs-north-arrow"
|
|
103
|
-
style="transform: rotate(20deg);"
|
|
104
|
-
>
|
|
105
|
-
<svg data-file-name="SvgNorthArrow">
|
|
106
|
-
</svg>
|
|
107
|
-
</div>
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
exports[`NorthArrow should react on view rotation with offset (transform: \`rotate(10deg)\`) 1`] = `
|
|
111
|
-
<div class="rs-north-arrow"
|
|
112
|
-
style="transform: rotate(10deg);"
|
|
113
|
-
>
|
|
114
|
-
<svg data-file-name="SvgNorthArrow">
|
|
115
|
-
</svg>
|
|
116
|
-
</div>
|
|
117
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './NorthArrow';
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import React, { Component, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Resizable } from 're-resizable';
|
|
4
|
-
import ResizeHandler from '../ResizeHandler';
|
|
5
|
-
|
|
6
|
-
const propTypes = {
|
|
7
|
-
/**
|
|
8
|
-
* CSS class added to container.
|
|
9
|
-
*/
|
|
10
|
-
className: PropTypes.string,
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Children content of the overlay.
|
|
14
|
-
*/
|
|
15
|
-
children: PropTypes.node,
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Observed element to define screen size.
|
|
19
|
-
*/
|
|
20
|
-
observe: PropTypes.oneOfType([
|
|
21
|
-
PropTypes.string,
|
|
22
|
-
PropTypes.node,
|
|
23
|
-
PropTypes.instanceOf(Component),
|
|
24
|
-
PropTypes.shape({ current: PropTypes.node }),
|
|
25
|
-
PropTypes.shape({ current: PropTypes.instanceOf(Component) }),
|
|
26
|
-
]),
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Deactivate the ability to resize the overlay on mobile.
|
|
30
|
-
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
31
|
-
*/
|
|
32
|
-
isMobileResizable: PropTypes.bool,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Size parameters to the Resizable component on mobile.
|
|
36
|
-
* Pass following prop to re-resizable component: 'size', 'defaultSize', 'minHeight' & 'maxHeight'
|
|
37
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
38
|
-
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
39
|
-
*/
|
|
40
|
-
mobileSize: PropTypes.shape({
|
|
41
|
-
minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
42
|
-
maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
43
|
-
defaultSize: PropTypes.shape({
|
|
44
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
45
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
46
|
-
}),
|
|
47
|
-
size: PropTypes.shape({
|
|
48
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
49
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
50
|
-
}),
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Minimal width to consider the observed as mobile.
|
|
55
|
-
* Default is 768px.
|
|
56
|
-
*/
|
|
57
|
-
thresholdWidthForMobile: PropTypes.number,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Callback when stop resizing
|
|
61
|
-
* Pass following prop to re-resizable component
|
|
62
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
63
|
-
*/
|
|
64
|
-
onResizeStop: PropTypes.func,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Callback when start resizing
|
|
68
|
-
* Pass following prop to re-resizable component
|
|
69
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
70
|
-
*/
|
|
71
|
-
onResizeStart: PropTypes.func,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const defaultMobileSize = {
|
|
75
|
-
defaultSize: {
|
|
76
|
-
width: '100%',
|
|
77
|
-
height: '25%',
|
|
78
|
-
},
|
|
79
|
-
size: undefined,
|
|
80
|
-
maximalHeight: '100%',
|
|
81
|
-
minimalHeight: '25%',
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const defaultProps = {
|
|
85
|
-
className: null,
|
|
86
|
-
children: null,
|
|
87
|
-
observe: null,
|
|
88
|
-
isMobileResizable: true,
|
|
89
|
-
mobileSize: defaultMobileSize,
|
|
90
|
-
thresholdWidthForMobile: 768,
|
|
91
|
-
onResizeStop: () => {},
|
|
92
|
-
onResizeStart: () => {},
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The Overlay component creates a resizable, swipable overlay <div\>
|
|
97
|
-
*/
|
|
98
|
-
const Overlay = ({
|
|
99
|
-
observe,
|
|
100
|
-
className,
|
|
101
|
-
children,
|
|
102
|
-
isMobileResizable,
|
|
103
|
-
mobileSize,
|
|
104
|
-
onResizeStop,
|
|
105
|
-
onResizeStart,
|
|
106
|
-
thresholdWidthForMobile,
|
|
107
|
-
}) => {
|
|
108
|
-
const [isMobile, setIsMobile] = useState();
|
|
109
|
-
|
|
110
|
-
const onResize = (entries) => {
|
|
111
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
112
|
-
const { width } = entries[i].contentRect;
|
|
113
|
-
setIsMobile(width <= thresholdWidthForMobile);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
let resizableMobileSize;
|
|
118
|
-
if (mobileSize) {
|
|
119
|
-
resizableMobileSize = { ...defaultMobileSize, ...mobileSize };
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<>
|
|
124
|
-
{observe ? <ResizeHandler observe={observe} onResize={onResize} /> : null}
|
|
125
|
-
{isMobile ? (
|
|
126
|
-
<Resizable
|
|
127
|
-
style={{
|
|
128
|
-
position: 'absolute',
|
|
129
|
-
}}
|
|
130
|
-
enable={{
|
|
131
|
-
top: isMobileResizable,
|
|
132
|
-
right: false,
|
|
133
|
-
bottom: false,
|
|
134
|
-
left: false,
|
|
135
|
-
topRight: false,
|
|
136
|
-
bottomRight: false,
|
|
137
|
-
bottomLeft: false,
|
|
138
|
-
topLeft: false,
|
|
139
|
-
}}
|
|
140
|
-
maxHeight={mobileSize && resizableMobileSize.maximalHeight}
|
|
141
|
-
minHeight={mobileSize && resizableMobileSize.minimalHeight}
|
|
142
|
-
handleComponent={{
|
|
143
|
-
top: <div className="tm-overlay-handler">—</div>,
|
|
144
|
-
}}
|
|
145
|
-
onResizeStart={onResizeStart}
|
|
146
|
-
onResizeStop={onResizeStop}
|
|
147
|
-
handleStyles={{
|
|
148
|
-
top: {
|
|
149
|
-
top: '-20px',
|
|
150
|
-
height: '20px',
|
|
151
|
-
padding: '20px 0',
|
|
152
|
-
width: '100%',
|
|
153
|
-
display: 'flex',
|
|
154
|
-
alignItems: 'center',
|
|
155
|
-
justifyContent: 'center',
|
|
156
|
-
},
|
|
157
|
-
}}
|
|
158
|
-
size={resizableMobileSize.size}
|
|
159
|
-
defaultSize={mobileSize && resizableMobileSize.defaultSize}
|
|
160
|
-
className={`tm-overlay-mobile${className ? ` ${className}` : ''}`}
|
|
161
|
-
>
|
|
162
|
-
<div className="tm-overlay-mobile-content">{children}</div>
|
|
163
|
-
</Resizable>
|
|
164
|
-
) : (
|
|
165
|
-
<div className={`tm-overlay${className ? ` ${className}` : ''}`}>
|
|
166
|
-
{children}
|
|
167
|
-
</div>
|
|
168
|
-
)}
|
|
169
|
-
</>
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
Overlay.propTypes = propTypes;
|
|
174
|
-
Overlay.defaultProps = defaultProps;
|
|
175
|
-
|
|
176
|
-
export default Overlay;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import { configure, mount } from 'enzyme';
|
|
5
|
-
import renderer from 'react-test-renderer';
|
|
6
|
-
import Adapter from '@cfaester/enzyme-adapter-react-18';
|
|
7
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import { Resizable } from 're-resizable';
|
|
9
|
-
import Overlay from './Overlay';
|
|
10
|
-
|
|
11
|
-
jest.mock('resize-observer-polyfill');
|
|
12
|
-
|
|
13
|
-
configure({ adapter: new Adapter() });
|
|
14
|
-
|
|
15
|
-
const propTypes = {
|
|
16
|
-
isMobileResizable: PropTypes.bool,
|
|
17
|
-
thresholdWidthForMobile: PropTypes.number,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultProps = {
|
|
21
|
-
isMobileResizable: undefined,
|
|
22
|
-
thresholdWidthForMobile: undefined,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const BasicComponent = ({ thresholdWidthForMobile, isMobileResizable }) => {
|
|
26
|
-
const [ref, setRef] = useState(null);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<div
|
|
31
|
-
ref={(node) => {
|
|
32
|
-
if (node !== ref) {
|
|
33
|
-
setRef(node);
|
|
34
|
-
}
|
|
35
|
-
}}
|
|
36
|
-
className="observer"
|
|
37
|
-
/>
|
|
38
|
-
<Overlay
|
|
39
|
-
observe={ref}
|
|
40
|
-
thresholdWidthForMobile={thresholdWidthForMobile}
|
|
41
|
-
isMobileResizable={isMobileResizable}
|
|
42
|
-
>
|
|
43
|
-
Test content
|
|
44
|
-
</Overlay>
|
|
45
|
-
</>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
BasicComponent.propTypes = propTypes;
|
|
49
|
-
BasicComponent.defaultProps = defaultProps;
|
|
50
|
-
|
|
51
|
-
describe('Overlay', () => {
|
|
52
|
-
test('should match snapshot.', () => {
|
|
53
|
-
const component = renderer.create(<Overlay>Test content</Overlay>);
|
|
54
|
-
const tree = component.toJSON();
|
|
55
|
-
expect(tree).toMatchSnapshot();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('should react on observe resize.', () => {
|
|
59
|
-
const wrapper = mount(<BasicComponent />);
|
|
60
|
-
const target = wrapper.find('.observer').getDOMNode();
|
|
61
|
-
|
|
62
|
-
act(() => {
|
|
63
|
-
// The mock class set the onResize property, we just have to run it to
|
|
64
|
-
// simulate a resize
|
|
65
|
-
ResizeObserver.onResize([
|
|
66
|
-
{
|
|
67
|
-
target,
|
|
68
|
-
contentRect: {
|
|
69
|
-
width: 200,
|
|
70
|
-
height: 200,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
]);
|
|
74
|
-
});
|
|
75
|
-
wrapper.update();
|
|
76
|
-
|
|
77
|
-
expect(wrapper.find('.tm-overlay').length > 0).toBe(false);
|
|
78
|
-
expect(wrapper.find('.tm-overlay-mobile').length > 0).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('should force mobile overlay display on big screen.', () => {
|
|
82
|
-
const wrapper = mount(
|
|
83
|
-
<BasicComponent thresholdWidthForMobile={Infinity} />,
|
|
84
|
-
);
|
|
85
|
-
const target = wrapper.find('.observer').getDOMNode();
|
|
86
|
-
|
|
87
|
-
act(() => {
|
|
88
|
-
ResizeObserver.onResize([
|
|
89
|
-
{
|
|
90
|
-
target,
|
|
91
|
-
contentRect: {
|
|
92
|
-
width: 1200,
|
|
93
|
-
height: 200,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
]);
|
|
97
|
-
});
|
|
98
|
-
wrapper.update();
|
|
99
|
-
|
|
100
|
-
expect(wrapper.find('.tm-overlay').length > 0).toBe(false);
|
|
101
|
-
expect(wrapper.find('.tm-overlay-mobile').length > 0).toBe(true);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('should allow resizing with top handler on mobile.', () => {
|
|
105
|
-
const wrapper = mount(<BasicComponent />);
|
|
106
|
-
const target = wrapper.find('.observer').getDOMNode();
|
|
107
|
-
|
|
108
|
-
// Force resize to make it mobile.
|
|
109
|
-
act(() => {
|
|
110
|
-
ResizeObserver.onResize([
|
|
111
|
-
{
|
|
112
|
-
target,
|
|
113
|
-
contentRect: {
|
|
114
|
-
width: 200,
|
|
115
|
-
height: 200,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
]);
|
|
119
|
-
});
|
|
120
|
-
wrapper.update();
|
|
121
|
-
|
|
122
|
-
const resizableProps = wrapper.find(Resizable).props();
|
|
123
|
-
|
|
124
|
-
expect(resizableProps.enable.top).toBe(true);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test('should not allow resizing with top handler on mobile.', () => {
|
|
128
|
-
const wrapper = mount(<BasicComponent isMobileResizable={false} />);
|
|
129
|
-
const target = wrapper.find('.observer').getDOMNode();
|
|
130
|
-
|
|
131
|
-
// Force resize to make it mobile.
|
|
132
|
-
act(() => {
|
|
133
|
-
ResizeObserver.onResize([
|
|
134
|
-
{
|
|
135
|
-
target,
|
|
136
|
-
contentRect: {
|
|
137
|
-
width: 200,
|
|
138
|
-
height: 200,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
]);
|
|
142
|
-
});
|
|
143
|
-
wrapper.update();
|
|
144
|
-
|
|
145
|
-
const resizableProps = wrapper.find(Resizable).props();
|
|
146
|
-
|
|
147
|
-
expect(resizableProps.enable.top).toBe(false);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The following example demonstrates the use of Overlay.
|
|
3
|
-
|
|
4
|
-
```jsx
|
|
5
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
6
|
-
import Overlay from 'react-spatial/components/Overlay';
|
|
7
|
-
|
|
8
|
-
function OverlayExample() {
|
|
9
|
-
const [open, setOpen] = useState(true);
|
|
10
|
-
const [ref, setRef] = useState(null);
|
|
11
|
-
const refDiv = useRef(null);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setRef(refDiv);
|
|
15
|
-
}, [refDiv]);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className="tm-overlay-example"
|
|
20
|
-
ref={refDiv}
|
|
21
|
-
>
|
|
22
|
-
<div
|
|
23
|
-
role="button"
|
|
24
|
-
className="tm-clickable-feature"
|
|
25
|
-
onClick={() => {
|
|
26
|
-
setOpen(!open);
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
Toggle Overlay
|
|
30
|
-
</div>
|
|
31
|
-
{open && ref ? (
|
|
32
|
-
<Overlay
|
|
33
|
-
observe={ref.current}
|
|
34
|
-
className="tm-overlay-container"
|
|
35
|
-
mobileSize={{
|
|
36
|
-
minimalHeight: '25%',
|
|
37
|
-
maximalHeight: '80%',
|
|
38
|
-
defaultSize: {
|
|
39
|
-
height: '40%',
|
|
40
|
-
width: '100%',
|
|
41
|
-
},
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
<div
|
|
45
|
-
role="button"
|
|
46
|
-
onClick={() => {
|
|
47
|
-
setOpen(false);
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
Close Overlay
|
|
51
|
-
</div>
|
|
52
|
-
</Overlay>
|
|
53
|
-
) : null}
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
<OverlayExample />;
|
|
59
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Overlay';
|