react-spatial 2.0.0-beta.1 → 2.0.0-beta.2
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/README.md +5 -10
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +243 -220
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -1
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.scss +6 -5
- package/components/BaseLayerSwitcher/index.js +1 -3
- package/components/BaseLayerSwitcher/index.js.map +7 -1
- package/components/BasicMap/BasicMap.js +165 -285
- package/components/BasicMap/BasicMap.js.map +7 -1
- package/components/BasicMap/index.js +1 -3
- package/components/BasicMap/index.js.map +7 -1
- package/components/CanvasSaveButton/CanvasSaveButton.js +434 -556
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -1
- package/components/CanvasSaveButton/CanvasSaveButton.md.scss +1 -1
- package/components/CanvasSaveButton/index.js +1 -3
- package/components/CanvasSaveButton/index.js.map +7 -1
- package/components/Copyright/Copyright.js +44 -77
- package/components/Copyright/Copyright.js.map +7 -1
- package/components/Copyright/index.js +1 -3
- package/components/Copyright/index.js.map +7 -1
- package/components/FeatureExportButton/FeatureExportButton.js +44 -92
- package/components/FeatureExportButton/FeatureExportButton.js.map +7 -1
- package/components/FeatureExportButton/index.js +1 -3
- package/components/FeatureExportButton/index.js.map +7 -1
- package/components/FitExtent/FitExtent.js +31 -46
- package/components/FitExtent/FitExtent.js.map +7 -1
- package/components/FitExtent/index.js +1 -3
- package/components/FitExtent/index.js.map +7 -1
- package/components/Geolocation/Geolocation.js +158 -228
- package/components/Geolocation/Geolocation.js.map +7 -1
- package/components/Geolocation/Geolocation.scss +7 -5
- package/components/Geolocation/index.js +1 -3
- package/components/Geolocation/index.js.map +7 -1
- package/components/LayerTree/LayerTree.js +359 -357
- package/components/LayerTree/LayerTree.js.map +7 -1
- package/components/LayerTree/LayerTree.scss +4 -6
- package/components/LayerTree/index.js +1 -3
- package/components/LayerTree/index.js.map +7 -1
- package/components/MousePosition/MousePosition.js +71 -109
- package/components/MousePosition/MousePosition.js.map +7 -1
- package/components/MousePosition/index.js +1 -3
- package/components/MousePosition/index.js.map +7 -1
- package/components/NorthArrow/NorthArrow.js +37 -61
- package/components/NorthArrow/NorthArrow.js.map +7 -1
- package/components/NorthArrow/index.js +1 -3
- package/components/NorthArrow/index.js.map +7 -1
- package/components/Overlay/Overlay.js +93 -123
- package/components/Overlay/Overlay.js.map +7 -1
- package/components/Overlay/index.js +1 -3
- package/components/Overlay/index.js.map +7 -1
- package/components/Permalink/Permalink.js +194 -229
- package/components/Permalink/Permalink.js.map +7 -1
- package/components/Permalink/index.js +1 -3
- package/components/Permalink/index.js.map +7 -1
- package/components/Popup/Popup.js +139 -215
- package/components/Popup/Popup.js.map +7 -1
- package/components/Popup/Popup.md.scss +1 -0
- package/components/Popup/Popup.scss +3 -1
- package/components/Popup/index.js +1 -3
- package/components/Popup/index.js.map +7 -1
- package/components/ResizeHandler/ResizeHandler.js +88 -137
- package/components/ResizeHandler/ResizeHandler.js.map +7 -1
- package/components/ResizeHandler/index.js +1 -3
- package/components/ResizeHandler/index.js.map +7 -1
- package/components/RouteSchedule/RouteSchedule.js +227 -277
- package/components/RouteSchedule/RouteSchedule.js.map +7 -1
- package/components/RouteSchedule/RouteSchedule.md.scss +4 -2
- package/components/RouteSchedule/RouteSchedule.scss +12 -23
- package/components/RouteSchedule/index.js +1 -3
- package/components/RouteSchedule/index.js.map +7 -1
- package/components/ScaleLine/ScaleLine.js +17 -39
- package/components/ScaleLine/ScaleLine.js.map +7 -1
- package/components/ScaleLine/ScaleLine.scss +6 -4
- package/components/ScaleLine/index.js +1 -3
- package/components/ScaleLine/index.js.map +7 -1
- package/components/StopsFinder/StopsFinder.js +134 -162
- package/components/StopsFinder/StopsFinder.js.map +7 -1
- package/components/StopsFinder/StopsFinderOption.js +30 -60
- package/components/StopsFinder/StopsFinderOption.js.map +7 -1
- package/components/StopsFinder/index.js +1 -3
- package/components/StopsFinder/index.js.map +7 -1
- package/components/Zoom/Zoom.js +102 -106
- package/components/Zoom/Zoom.js.map +7 -1
- package/components/Zoom/Zoom.md.scss +3 -1
- package/components/Zoom/Zoom.scss +7 -5
- package/components/Zoom/index.js +1 -3
- package/components/Zoom/index.js.map +7 -1
- package/images/geops_qr.png +0 -0
- package/package.json +88 -182
- package/propTypes.js +36 -24
- package/propTypes.js.map +7 -1
- package/setupTests.js +21 -4
- package/setupTests.js.map +7 -1
- package/themes/README.md +26 -0
- package/themes/default/components.scss +9 -14
- package/themes/default/examples.scss +20 -20
- package/themes/default/index.scss +3 -3
- package/themes/default/mixins.scss +7 -5
- package/themes/default/variables.scss +27 -25
- package/utils/GlobalsForOle.js +72 -73
- package/utils/GlobalsForOle.js.map +7 -1
- package/utils/KML.js +320 -381
- package/utils/KML.js.map +7 -1
- package/utils/Styles.js +25 -33
- package/utils/Styles.js.map +7 -1
- package/utils/getLayersAsFlatArray.js +14 -0
- package/utils/getLayersAsFlatArray.js.map +7 -0
- package/utils/getPolygonPattern.js +11 -44
- package/utils/getPolygonPattern.js.map +7 -1
- package/utils/timeUtils.js +20 -35
- package/utils/timeUtils.js.map +7 -1
- package/LayerService.js +0 -193
- package/LayerService.js.map +0 -1
- package/LayerService.test.js +0 -160
- package/LayerService.test.js.map +0 -1
- package/Projections.js +0 -16
- package/Projections.js.map +0 -1
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -88
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js.map +0 -1
- package/components/BaseLayerToggler/BaseLayerToggler.js +0 -490
- package/components/BaseLayerToggler/BaseLayerToggler.js.map +0 -1
- package/components/BaseLayerToggler/BaseLayerToggler.md.scss +0 -9
- package/components/BaseLayerToggler/BaseLayerToggler.scss +0 -49
- package/components/BaseLayerToggler/BaseLayerToggler.test.js +0 -127
- package/components/BaseLayerToggler/BaseLayerToggler.test.js.map +0 -1
- package/components/BaseLayerToggler/index.js +0 -3
- package/components/BaseLayerToggler/index.js.map +0 -1
- package/components/BasicMap/BasicMap.test.js +0 -288
- package/components/BasicMap/BasicMap.test.js.map +0 -1
- package/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -173
- package/components/CanvasSaveButton/CanvasSaveButton.test.js.map +0 -1
- package/components/Copyright/Copyright.test.js +0 -133
- package/components/Copyright/Copyright.test.js.map +0 -1
- package/components/FeatureExportButton/FeatureExportButton.test.js +0 -407
- package/components/FeatureExportButton/FeatureExportButton.test.js.map +0 -1
- package/components/FilterButton/FilterButton.js +0 -131
- package/components/FilterButton/FilterButton.js.map +0 -1
- package/components/FilterButton/FilterButton.scss +0 -36
- package/components/FilterButton/FilterButton.test.js +0 -48
- package/components/FilterButton/FilterButton.test.js.map +0 -1
- package/components/FilterButton/index.js +0 -3
- package/components/FilterButton/index.js.map +0 -1
- package/components/FitExtent/FitExtent.test.js +0 -44
- package/components/FitExtent/FitExtent.test.js.map +0 -1
- package/components/FollowButton/FollowButton.js +0 -143
- package/components/FollowButton/FollowButton.js.map +0 -1
- package/components/FollowButton/FollowButton.scss +0 -36
- package/components/FollowButton/FollowButton.test.js +0 -57
- package/components/FollowButton/FollowButton.test.js.map +0 -1
- package/components/FollowButton/index.js +0 -3
- package/components/FollowButton/index.js.map +0 -1
- package/components/Geolocation/Geolocation.test.js +0 -263
- package/components/Geolocation/Geolocation.test.js.map +0 -1
- package/components/LayerTree/LayerTree.test.js +0 -323
- package/components/LayerTree/LayerTree.test.js.map +0 -1
- package/components/MousePosition/MousePosition.test.js +0 -125
- package/components/MousePosition/MousePosition.test.js.map +0 -1
- package/components/NorthArrow/NorthArrow.test.js +0 -106
- package/components/NorthArrow/NorthArrow.test.js.map +0 -1
- package/components/Overlay/Overlay.test.js +0 -145
- package/components/Overlay/Overlay.test.js.map +0 -1
- package/components/Permalink/Permalink.test.js +0 -267
- package/components/Permalink/Permalink.test.js.map +0 -1
- package/components/Popup/Popup.test.js +0 -291
- package/components/Popup/Popup.test.js.map +0 -1
- package/components/ResizeHandler/ResizeHandler.test.js +0 -410
- package/components/ResizeHandler/ResizeHandler.test.js.map +0 -1
- package/components/RouteSchedule/RouteSchedule.test.js +0 -102
- package/components/RouteSchedule/RouteSchedule.test.js.map +0 -1
- package/components/ScaleLine/ScaleLine.test.js +0 -32
- package/components/ScaleLine/ScaleLine.test.js.map +0 -1
- package/components/Search/Search.js +0 -230
- package/components/Search/Search.js.map +0 -1
- package/components/Search/Search.md.scss +0 -4
- package/components/Search/Search.scss +0 -78
- package/components/Search/Search.test.js +0 -15
- package/components/Search/Search.test.js.map +0 -1
- package/components/Search/SearchService.js +0 -72
- package/components/Search/SearchService.js.map +0 -1
- package/components/Search/engines/Engine.js +0 -26
- package/components/Search/engines/Engine.js.map +0 -1
- package/components/Search/engines/StopFinder.js +0 -47
- package/components/Search/engines/StopFinder.js.map +0 -1
- package/components/Search/index.js +0 -6
- package/components/Search/index.js.map +0 -1
- package/components/StopsFinder/StopsFinder.test.js +0 -19
- package/components/StopsFinder/StopsFinder.test.js.map +0 -1
- package/components/TrackerControl/TrackerControl.js +0 -171
- package/components/TrackerControl/TrackerControl.js.map +0 -1
- package/components/TrackerControl/TrackerControl.scss +0 -30
- package/components/TrackerControl/TrackerControl.test.js +0 -17
- package/components/TrackerControl/TrackerControl.test.js.map +0 -1
- package/components/TrackerControl/index.js +0 -3
- package/components/TrackerControl/index.js.map +0 -1
- package/components/Zoom/Zoom.test.js +0 -150
- package/components/Zoom/Zoom.test.js.map +0 -1
- package/images/FilterButton/filter.svg +0 -1
- package/images/FollowButton/follow.svg +0 -1
- package/images/baselayer/osm.baselayer.hot.png +0 -0
- package/images/baselayer/osm.baselayer.png +0 -0
- package/styleguidist/ComponentsList.js +0 -52
- package/styleguidist/ComponentsList.js.map +0 -1
- package/styleguidist/StyleGuide.js +0 -253
- package/styleguidist/StyleGuide.js.map +0 -1
- package/utils/KML.test.js +0 -163
- package/utils/KML.test.js.map +0 -1
- package/utils/KMLFormat.js +0 -105
- package/utils/KMLFormat.js.map +0 -1
- package/utils/KMLFormat.test.js +0 -22
- package/utils/KMLFormat.test.js.map +0 -1
- package/utils/getPolygonPattern.test.js +0 -66
- package/utils/getPolygonPattern.test.js.map +0 -1
- package/utils/timeUtils.test.js +0 -32
- package/utils/timeUtils.test.js.map +0 -1
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/NorthArrow/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default } from \"./NorthArrow\";\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import ResizeHandler from
|
|
5
|
-
|
|
6
|
-
var propTypes = {
|
|
7
|
-
/**
|
|
8
|
-
* CSS class added to container.
|
|
9
|
-
*/
|
|
10
|
-
className: PropTypes.string,
|
|
11
|
-
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import { Resizable } from "re-resizable";
|
|
3
|
+
import React, { Component, useState } from "react";
|
|
4
|
+
import ResizeHandler from "../ResizeHandler";
|
|
5
|
+
const propTypes = {
|
|
12
6
|
/**
|
|
13
7
|
* Children content of the overlay.
|
|
14
8
|
*/
|
|
15
9
|
children: PropTypes.node,
|
|
16
|
-
|
|
17
10
|
/**
|
|
18
|
-
*
|
|
11
|
+
* CSS class added to container.
|
|
19
12
|
*/
|
|
20
|
-
|
|
21
|
-
PropTypes.string,
|
|
22
|
-
PropTypes.instanceOf(Element),
|
|
23
|
-
PropTypes.instanceOf(Component),
|
|
24
|
-
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
|
25
|
-
PropTypes.shape({ current: PropTypes.instanceOf(Component) }) ]),
|
|
26
|
-
|
|
13
|
+
className: PropTypes.string,
|
|
27
14
|
/**
|
|
28
15
|
* Deactivate the ability to resize the overlay on mobile.
|
|
29
16
|
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
30
17
|
*/
|
|
31
18
|
isMobileResizable: PropTypes.bool,
|
|
32
|
-
|
|
33
19
|
/**
|
|
34
20
|
* Size parameters to the Resizable component on mobile.
|
|
35
21
|
* Pass following prop to re-resizable component: 'size', 'defaultSize', 'minHeight' & 'maxHeight'
|
|
@@ -37,133 +23,117 @@ var propTypes = {
|
|
|
37
23
|
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
38
24
|
*/
|
|
39
25
|
mobileSize: PropTypes.shape({
|
|
40
|
-
minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
41
|
-
maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
42
26
|
defaultSize: PropTypes.shape({
|
|
43
27
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
44
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
28
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
45
29
|
}),
|
|
30
|
+
maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
31
|
+
minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
46
32
|
size: PropTypes.shape({
|
|
47
33
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
48
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
49
|
-
})
|
|
34
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
35
|
+
})
|
|
50
36
|
}),
|
|
51
|
-
|
|
52
37
|
/**
|
|
53
|
-
*
|
|
54
|
-
* Default is 768px.
|
|
38
|
+
* Observed element to define screen size.
|
|
55
39
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
observe: PropTypes.oneOfType([
|
|
41
|
+
PropTypes.string,
|
|
42
|
+
PropTypes.node,
|
|
43
|
+
PropTypes.instanceOf(Component),
|
|
44
|
+
PropTypes.shape({ current: PropTypes.node }),
|
|
45
|
+
PropTypes.shape({ current: PropTypes.instanceOf(Component) })
|
|
46
|
+
]),
|
|
58
47
|
/**
|
|
59
|
-
* Callback when
|
|
48
|
+
* Callback when start resizing
|
|
60
49
|
* Pass following prop to re-resizable component
|
|
61
50
|
* (https://github.com/bokuweb/re-resizable)
|
|
62
51
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
onResizeStart: PropTypes.func,
|
|
65
53
|
/**
|
|
66
|
-
* Callback when
|
|
54
|
+
* Callback when stop resizing
|
|
67
55
|
* Pass following prop to re-resizable component
|
|
68
56
|
* (https://github.com/bokuweb/re-resizable)
|
|
69
57
|
*/
|
|
70
|
-
|
|
58
|
+
onResizeStop: PropTypes.func,
|
|
59
|
+
/**
|
|
60
|
+
* Minimal width to consider the observed as mobile.
|
|
61
|
+
* Default is 768px.
|
|
62
|
+
*/
|
|
63
|
+
thresholdWidthForMobile: PropTypes.number
|
|
71
64
|
};
|
|
72
|
-
|
|
73
|
-
var defaultMobileSize = {
|
|
65
|
+
const defaultMobileSize = {
|
|
74
66
|
defaultSize: {
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
height: "25%",
|
|
68
|
+
width: "100%"
|
|
77
69
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
maximalHeight: "100%",
|
|
71
|
+
minimalHeight: "25%",
|
|
72
|
+
size: void 0
|
|
81
73
|
};
|
|
82
|
-
|
|
83
|
-
var defaultProps = {
|
|
84
|
-
className: null,
|
|
85
|
-
children: null,
|
|
86
|
-
observe: null,
|
|
87
|
-
isMobileResizable: true,
|
|
88
|
-
mobileSize: defaultMobileSize,
|
|
89
|
-
thresholdWidthForMobile: 768,
|
|
90
|
-
onResizeStop: function () {},
|
|
91
|
-
onResizeStart: function () {},
|
|
74
|
+
const emptyFunc = () => {
|
|
92
75
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var ref$1 = useState();
|
|
108
|
-
var isMobile = ref$1[0];
|
|
109
|
-
var setIsMobile = ref$1[1];
|
|
110
|
-
|
|
111
|
-
var onResize = function (entries) {
|
|
112
|
-
for (var i = 0; i < entries.length; i += 1) {
|
|
113
|
-
var ref = entries[i].contentRect;
|
|
114
|
-
var width = ref.width;
|
|
76
|
+
function Overlay({
|
|
77
|
+
children = null,
|
|
78
|
+
className = null,
|
|
79
|
+
isMobileResizable = true,
|
|
80
|
+
mobileSize = defaultMobileSize,
|
|
81
|
+
observe = null,
|
|
82
|
+
onResizeStart = emptyFunc,
|
|
83
|
+
onResizeStop = emptyFunc,
|
|
84
|
+
thresholdWidthForMobile = 768
|
|
85
|
+
}) {
|
|
86
|
+
const [isMobile, setIsMobile] = useState();
|
|
87
|
+
const onResize = (entries) => {
|
|
88
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
89
|
+
const { width } = entries[i].contentRect;
|
|
115
90
|
setIsMobile(width <= thresholdWidthForMobile);
|
|
116
91
|
}
|
|
117
92
|
};
|
|
118
|
-
|
|
119
|
-
var resizableMobileSize;
|
|
93
|
+
let resizableMobileSize;
|
|
120
94
|
if (mobileSize) {
|
|
121
|
-
resizableMobileSize =
|
|
95
|
+
resizableMobileSize = { ...defaultMobileSize, ...mobileSize };
|
|
122
96
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
};
|
|
163
|
-
|
|
97
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, observe ? /* @__PURE__ */ React.createElement(ResizeHandler, { observe, onResize }) : null, isMobile ? /* @__PURE__ */ React.createElement(
|
|
98
|
+
Resizable,
|
|
99
|
+
{
|
|
100
|
+
className: `tm-overlay-mobile${className ? ` ${className}` : ""}`,
|
|
101
|
+
defaultSize: mobileSize && resizableMobileSize.defaultSize,
|
|
102
|
+
enable: {
|
|
103
|
+
bottom: false,
|
|
104
|
+
bottomLeft: false,
|
|
105
|
+
bottomRight: false,
|
|
106
|
+
left: false,
|
|
107
|
+
right: false,
|
|
108
|
+
top: isMobileResizable,
|
|
109
|
+
topLeft: false,
|
|
110
|
+
topRight: false
|
|
111
|
+
},
|
|
112
|
+
handleComponent: {
|
|
113
|
+
top: /* @__PURE__ */ React.createElement("div", { className: "tm-overlay-handler" }, "\u2014")
|
|
114
|
+
},
|
|
115
|
+
handleStyles: {
|
|
116
|
+
top: {
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
display: "flex",
|
|
119
|
+
height: "20px",
|
|
120
|
+
justifyContent: "center",
|
|
121
|
+
padding: "20px 0",
|
|
122
|
+
top: "-20px",
|
|
123
|
+
width: "100%"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
maxHeight: mobileSize && resizableMobileSize.maximalHeight,
|
|
127
|
+
minHeight: mobileSize && resizableMobileSize.minimalHeight,
|
|
128
|
+
onResizeStart,
|
|
129
|
+
onResizeStop,
|
|
130
|
+
size: resizableMobileSize.size,
|
|
131
|
+
style: {
|
|
132
|
+
position: "absolute"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
/* @__PURE__ */ React.createElement("div", { className: "tm-overlay-mobile-content" }, children)
|
|
136
|
+
) : /* @__PURE__ */ React.createElement("div", { className: `tm-overlay${className ? ` ${className}` : ""}` }, children));
|
|
137
|
+
}
|
|
164
138
|
Overlay.propTypes = propTypes;
|
|
165
|
-
Overlay.defaultProps = defaultProps;
|
|
166
|
-
|
|
167
139
|
export default Overlay;
|
|
168
|
-
|
|
169
|
-
//# sourceMappingURL=Overlay.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Overlay/Overlay.js"],
|
|
4
|
+
"sourcesContent": ["import PropTypes from \"prop-types\";\nimport { Resizable } from \"re-resizable\";\nimport React, { Component, useState } from \"react\";\n\nimport ResizeHandler from \"../ResizeHandler\";\n\nconst propTypes = {\n /**\n * Children content of the overlay.\n */\n children: PropTypes.node,\n\n /**\n * CSS class added to container.\n */\n className: PropTypes.string,\n\n /**\n * Deactivate the ability to resize the overlay on mobile.\n * /!\\ This prop is only used if isMobile (observer width < 768px).\n */\n isMobileResizable: PropTypes.bool,\n\n /**\n * Size parameters to the Resizable component on mobile.\n * Pass following prop to re-resizable component: 'size', 'defaultSize', 'minHeight' & 'maxHeight'\n * (https://github.com/bokuweb/re-resizable)\n * /!\\ This prop is only used if isMobile (observer width < 768px).\n */\n mobileSize: PropTypes.shape({\n defaultSize: PropTypes.shape({\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n }),\n maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n size: PropTypes.shape({\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n }),\n }),\n\n /**\n * Observed element to define screen size.\n */\n observe: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.instanceOf(Component),\n PropTypes.shape({ current: PropTypes.node }),\n PropTypes.shape({ current: PropTypes.instanceOf(Component) }),\n ]),\n\n /**\n * Callback when start resizing\n * Pass following prop to re-resizable component\n * (https://github.com/bokuweb/re-resizable)\n */\n onResizeStart: PropTypes.func,\n\n /**\n * Callback when stop resizing\n * Pass following prop to re-resizable component\n * (https://github.com/bokuweb/re-resizable)\n */\n onResizeStop: PropTypes.func,\n\n /**\n * Minimal width to consider the observed as mobile.\n * Default is 768px.\n */\n thresholdWidthForMobile: PropTypes.number,\n};\n\nconst defaultMobileSize = {\n defaultSize: {\n height: \"25%\",\n width: \"100%\",\n },\n maximalHeight: \"100%\",\n minimalHeight: \"25%\",\n size: undefined,\n};\n\nconst emptyFunc = () => {};\n/**\n * The Overlay component creates a resizable, swipable overlay <div\\>\n */\nfunction Overlay({\n children = null,\n className = null,\n isMobileResizable = true,\n mobileSize = defaultMobileSize,\n observe = null,\n onResizeStart = emptyFunc,\n onResizeStop = emptyFunc,\n thresholdWidthForMobile = 768,\n}) {\n const [isMobile, setIsMobile] = useState();\n\n const onResize = (entries) => {\n for (let i = 0; i < entries.length; i += 1) {\n const { width } = entries[i].contentRect;\n setIsMobile(width <= thresholdWidthForMobile);\n }\n };\n\n let resizableMobileSize;\n if (mobileSize) {\n resizableMobileSize = { ...defaultMobileSize, ...mobileSize };\n }\n\n return (\n <>\n {observe ? <ResizeHandler observe={observe} onResize={onResize} /> : null}\n {isMobile ? (\n <Resizable\n className={`tm-overlay-mobile${className ? ` ${className}` : \"\"}`}\n defaultSize={mobileSize && resizableMobileSize.defaultSize}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: false,\n right: false,\n top: isMobileResizable,\n topLeft: false,\n topRight: false,\n }}\n handleComponent={{\n top: <div className=\"tm-overlay-handler\">—</div>,\n }}\n handleStyles={{\n top: {\n alignItems: \"center\",\n display: \"flex\",\n height: \"20px\",\n justifyContent: \"center\",\n padding: \"20px 0\",\n top: \"-20px\",\n width: \"100%\",\n },\n }}\n maxHeight={mobileSize && resizableMobileSize.maximalHeight}\n minHeight={mobileSize && resizableMobileSize.minimalHeight}\n onResizeStart={onResizeStart}\n onResizeStop={onResizeStop}\n size={resizableMobileSize.size}\n style={{\n position: \"absolute\",\n }}\n >\n <div className=\"tm-overlay-mobile-content\">{children}</div>\n </Resizable>\n ) : (\n <div className={`tm-overlay${className ? ` ${className}` : \"\"}`}>\n {children}\n </div>\n )}\n </>\n );\n}\n\nOverlay.propTypes = propTypes;\n\nexport default Overlay;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Overlay/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default } from \"./Overlay\";\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|