react-spatial 1.2.2 → 1.2.3-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.
- package/LayerService.js +128 -184
- package/LayerService.js.map +7 -1
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +163 -221
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -1
- package/components/BaseLayerSwitcher/index.js +1 -3
- package/components/BaseLayerSwitcher/index.js.map +7 -1
- package/components/BasicMap/BasicMap.js +147 -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 +165 -419
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -1
- package/components/CanvasSaveButton/index.js +1 -3
- package/components/CanvasSaveButton/index.js.map +7 -1
- package/components/Copyright/Copyright.js +29 -70
- 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 +40 -106
- 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/FilterButton/FilterButton.js +41 -106
- package/components/FilterButton/FilterButton.js.map +7 -1
- package/components/FilterButton/index.js +1 -3
- package/components/FilterButton/index.js.map +7 -1
- package/components/FitExtent/FitExtent.js +17 -50
- 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/FollowButton/FollowButton.js +41 -111
- package/components/FollowButton/FollowButton.js.map +7 -1
- package/components/FollowButton/index.js +1 -3
- package/components/FollowButton/index.js.map +7 -1
- package/components/Geolocation/Geolocation.js +104 -213
- package/components/Geolocation/Geolocation.js.map +7 -1
- package/components/Geolocation/index.js +1 -3
- package/components/Geolocation/index.js.map +7 -1
- package/components/LayerTree/LayerTree.js +204 -410
- package/components/LayerTree/LayerTree.js.map +7 -1
- package/components/LayerTree/index.js +1 -3
- package/components/LayerTree/index.js.map +7 -1
- package/components/MousePosition/MousePosition.js +61 -130
- 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 +22 -62
- 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 +83 -130
- 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 +150 -244
- 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 +106 -233
- package/components/Popup/Popup.js.map +7 -1
- package/components/Popup/index.js +1 -3
- package/components/Popup/index.js.map +7 -1
- package/components/ResizeHandler/ResizeHandler.js +58 -113
- 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 +150 -283
- package/components/RouteSchedule/RouteSchedule.js.map +7 -1
- package/components/RouteSchedule/index.js +1 -3
- package/components/RouteSchedule/index.js.map +7 -1
- package/components/ScaleLine/ScaleLine.js +21 -45
- package/components/ScaleLine/ScaleLine.js.map +7 -1
- package/components/ScaleLine/index.js +1 -3
- package/components/ScaleLine/index.js.map +7 -1
- package/components/Search/Search.js +122 -186
- package/components/Search/Search.js.map +7 -1
- package/components/Search/SearchService.js +45 -69
- package/components/Search/SearchService.js.map +7 -1
- package/components/Search/engines/Engine.js +18 -25
- package/components/Search/engines/Engine.js.map +7 -1
- package/components/Search/engines/StopFinder.js +21 -38
- package/components/Search/engines/StopFinder.js.map +7 -1
- package/components/Search/index.js +3 -6
- package/components/Search/index.js.map +7 -1
- package/components/StopsFinder/StopsFinder.js +123 -174
- package/components/StopsFinder/StopsFinder.js.map +7 -1
- package/components/StopsFinder/StopsFinderOption.js +37 -54
- 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/TrackerControl/TrackerControl.js +73 -128
- package/components/TrackerControl/TrackerControl.js.map +7 -1
- package/components/TrackerControl/index.js +1 -3
- package/components/TrackerControl/index.js.map +7 -1
- package/components/Zoom/Zoom.js +69 -112
- package/components/Zoom/Zoom.js.map +7 -1
- package/components/Zoom/index.js +1 -3
- package/components/Zoom/index.js.map +7 -1
- package/package.json +10 -5
- package/propTypes.js +17 -23
- package/propTypes.js.map +7 -1
- package/setupTests.js +2 -4
- package/setupTests.js.map +7 -1
- package/themes/README.md +26 -0
- package/themes/default/components.scss +0 -1
- package/themes/default/examples.scss +0 -1
- package/utils/GlobalsForOle.js +63 -64
- package/utils/GlobalsForOle.js.map +7 -1
- package/utils/KML.js +178 -364
- package/utils/KML.js.map +7 -1
- package/utils/KMLFormat.js +37 -73
- package/utils/KMLFormat.js.map +7 -1
- package/utils/Styles.js +24 -32
- package/utils/Styles.js.map +7 -1
- package/utils/getPolygonPattern.js +11 -44
- package/utils/getPolygonPattern.js.map +7 -1
- package/utils/timeUtils.js +16 -35
- package/utils/timeUtils.js.map +7 -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.test.js +0 -48
- package/components/FilterButton/FilterButton.test.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.test.js +0 -57
- package/components/FollowButton/FollowButton.test.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.test.js +0 -15
- package/components/Search/Search.test.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.test.js +0 -17
- package/components/TrackerControl/TrackerControl.test.js.map +0 -1
- package/components/Zoom/Zoom.test.js +0 -150
- package/components/Zoom/Zoom.test.js.map +0 -1
- 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.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,169 +1,122 @@
|
|
|
1
|
-
import React, { Component, useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Resizable } from
|
|
4
|
-
import ResizeHandler from
|
|
5
|
-
|
|
6
|
-
var propTypes = {
|
|
7
|
-
/**
|
|
8
|
-
* CSS class added to container.
|
|
9
|
-
*/
|
|
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
|
+
const propTypes = {
|
|
10
6
|
className: PropTypes.string,
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Children content of the overlay.
|
|
14
|
-
*/
|
|
15
7
|
children: PropTypes.node,
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Observed element to define screen size.
|
|
19
|
-
*/
|
|
20
8
|
observe: PropTypes.oneOfType([
|
|
21
9
|
PropTypes.string,
|
|
22
10
|
PropTypes.node,
|
|
23
11
|
PropTypes.instanceOf(Component),
|
|
24
12
|
PropTypes.shape({ current: PropTypes.node }),
|
|
25
|
-
PropTypes.shape({ current: PropTypes.instanceOf(Component) })
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Deactivate the ability to resize the overlay on mobile.
|
|
29
|
-
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
30
|
-
*/
|
|
13
|
+
PropTypes.shape({ current: PropTypes.instanceOf(Component) })
|
|
14
|
+
]),
|
|
31
15
|
isMobileResizable: PropTypes.bool,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Size parameters to the Resizable component on mobile.
|
|
35
|
-
* Pass following prop to re-resizable component: 'size', 'defaultSize', 'minHeight' & 'maxHeight'
|
|
36
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
37
|
-
* /!\ This prop is only used if isMobile (observer width < 768px).
|
|
38
|
-
*/
|
|
39
16
|
mobileSize: PropTypes.shape({
|
|
40
17
|
minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
41
18
|
maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
42
19
|
defaultSize: PropTypes.shape({
|
|
43
20
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
44
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
21
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
45
22
|
}),
|
|
46
23
|
size: PropTypes.shape({
|
|
47
24
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
48
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
49
|
-
})
|
|
25
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
26
|
+
})
|
|
50
27
|
}),
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Minimal width to consider the observed as mobile.
|
|
54
|
-
* Default is 768px.
|
|
55
|
-
*/
|
|
56
28
|
thresholdWidthForMobile: PropTypes.number,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Callback when stop resizing
|
|
60
|
-
* Pass following prop to re-resizable component
|
|
61
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
62
|
-
*/
|
|
63
29
|
onResizeStop: PropTypes.func,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Callback when start resizing
|
|
67
|
-
* Pass following prop to re-resizable component
|
|
68
|
-
* (https://github.com/bokuweb/re-resizable)
|
|
69
|
-
*/
|
|
70
|
-
onResizeStart: PropTypes.func,
|
|
30
|
+
onResizeStart: PropTypes.func
|
|
71
31
|
};
|
|
72
|
-
|
|
73
|
-
var defaultMobileSize = {
|
|
32
|
+
const defaultMobileSize = {
|
|
74
33
|
defaultSize: {
|
|
75
|
-
width:
|
|
76
|
-
height:
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "25%"
|
|
77
36
|
},
|
|
78
|
-
size:
|
|
79
|
-
maximalHeight:
|
|
80
|
-
minimalHeight:
|
|
37
|
+
size: void 0,
|
|
38
|
+
maximalHeight: "100%",
|
|
39
|
+
minimalHeight: "25%"
|
|
81
40
|
};
|
|
82
|
-
|
|
83
|
-
var defaultProps = {
|
|
41
|
+
const defaultProps = {
|
|
84
42
|
className: null,
|
|
85
43
|
children: null,
|
|
86
44
|
observe: null,
|
|
87
45
|
isMobileResizable: true,
|
|
88
46
|
mobileSize: defaultMobileSize,
|
|
89
47
|
thresholdWidthForMobile: 768,
|
|
90
|
-
onResizeStop:
|
|
91
|
-
|
|
48
|
+
onResizeStop: () => {
|
|
49
|
+
},
|
|
50
|
+
onResizeStart: () => {
|
|
51
|
+
}
|
|
92
52
|
};
|
|
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;
|
|
53
|
+
const Overlay = ({
|
|
54
|
+
observe,
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
isMobileResizable,
|
|
58
|
+
mobileSize,
|
|
59
|
+
onResizeStop,
|
|
60
|
+
onResizeStart,
|
|
61
|
+
thresholdWidthForMobile
|
|
62
|
+
}) => {
|
|
63
|
+
const [isMobile, setIsMobile] = useState();
|
|
64
|
+
const onResize = (entries) => {
|
|
65
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
66
|
+
const { width } = entries[i].contentRect;
|
|
115
67
|
setIsMobile(width <= thresholdWidthForMobile);
|
|
116
68
|
}
|
|
117
69
|
};
|
|
118
|
-
|
|
119
|
-
var resizableMobileSize;
|
|
70
|
+
let resizableMobileSize;
|
|
120
71
|
if (mobileSize) {
|
|
121
|
-
resizableMobileSize =
|
|
72
|
+
resizableMobileSize = { ...defaultMobileSize, ...mobileSize };
|
|
122
73
|
}
|
|
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
|
-
|
|
74
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, observe ? /* @__PURE__ */ React.createElement(ResizeHandler, {
|
|
75
|
+
observe,
|
|
76
|
+
onResize
|
|
77
|
+
}) : null, isMobile ? /* @__PURE__ */ React.createElement(Resizable, {
|
|
78
|
+
style: {
|
|
79
|
+
position: "absolute"
|
|
80
|
+
},
|
|
81
|
+
enable: {
|
|
82
|
+
top: isMobileResizable,
|
|
83
|
+
right: false,
|
|
84
|
+
bottom: false,
|
|
85
|
+
left: false,
|
|
86
|
+
topRight: false,
|
|
87
|
+
bottomRight: false,
|
|
88
|
+
bottomLeft: false,
|
|
89
|
+
topLeft: false
|
|
90
|
+
},
|
|
91
|
+
maxHeight: mobileSize && resizableMobileSize.maximalHeight,
|
|
92
|
+
minHeight: mobileSize && resizableMobileSize.minimalHeight,
|
|
93
|
+
handleComponent: {
|
|
94
|
+
top: /* @__PURE__ */ React.createElement("div", {
|
|
95
|
+
className: "tm-overlay-handler"
|
|
96
|
+
}, "\u2014")
|
|
97
|
+
},
|
|
98
|
+
onResizeStart,
|
|
99
|
+
onResizeStop,
|
|
100
|
+
handleStyles: {
|
|
101
|
+
top: {
|
|
102
|
+
top: "-20px",
|
|
103
|
+
height: "20px",
|
|
104
|
+
padding: "20px 0",
|
|
105
|
+
width: "100%",
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
size: resizableMobileSize.size,
|
|
112
|
+
defaultSize: mobileSize && resizableMobileSize.defaultSize,
|
|
113
|
+
className: `tm-overlay-mobile${className ? ` ${className}` : ""}`
|
|
114
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
115
|
+
className: "tm-overlay-mobile-content"
|
|
116
|
+
}, children)) : /* @__PURE__ */ React.createElement("div", {
|
|
117
|
+
className: `tm-overlay${className ? ` ${className}` : ""}`
|
|
118
|
+
}, children));
|
|
162
119
|
};
|
|
163
|
-
|
|
164
120
|
Overlay.propTypes = propTypes;
|
|
165
121
|
Overlay.defaultProps = defaultProps;
|
|
166
|
-
|
|
167
122
|
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 React, { Component, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { Resizable } from 're-resizable';\nimport ResizeHandler from '../ResizeHandler';\n\nconst propTypes = {\n /**\n * CSS class added to container.\n */\n className: PropTypes.string,\n\n /**\n * Children content of the overlay.\n */\n children: PropTypes.node,\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 * 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 minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n defaultSize: PropTypes.shape({\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n }),\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 * Minimal width to consider the observed as mobile.\n * Default is 768px.\n */\n thresholdWidthForMobile: PropTypes.number,\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 * 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\nconst defaultMobileSize = {\n defaultSize: {\n width: '100%',\n height: '25%',\n },\n size: undefined,\n maximalHeight: '100%',\n minimalHeight: '25%',\n};\n\nconst defaultProps = {\n className: null,\n children: null,\n observe: null,\n isMobileResizable: true,\n mobileSize: defaultMobileSize,\n thresholdWidthForMobile: 768,\n onResizeStop: () => {},\n onResizeStart: () => {},\n};\n\n/**\n * The Overlay component creates a resizable, swipable overlay <div\\>\n */\nconst Overlay = ({\n observe,\n className,\n children,\n isMobileResizable,\n mobileSize,\n onResizeStop,\n onResizeStart,\n thresholdWidthForMobile,\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 style={{\n position: 'absolute',\n }}\n enable={{\n top: isMobileResizable,\n right: false,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false,\n }}\n maxHeight={mobileSize && resizableMobileSize.maximalHeight}\n minHeight={mobileSize && resizableMobileSize.minimalHeight}\n handleComponent={{\n top: <div className=\"tm-overlay-handler\">—</div>,\n }}\n onResizeStart={onResizeStart}\n onResizeStop={onResizeStop}\n handleStyles={{\n top: {\n top: '-20px',\n height: '20px',\n padding: '20px 0',\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n }}\n size={resizableMobileSize.size}\n defaultSize={mobileSize && resizableMobileSize.defaultSize}\n className={`tm-overlay-mobile${className ? ` ${className}` : ''}`}\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;\nOverlay.defaultProps = defaultProps;\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,wBAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|