@opentripplanner/vehicle-rental-overlay 1.3.0 → 1.4.0

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.
@@ -1,90 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
-
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
- import React, { Component } from "react";
13
- import VehicleRentalOverlay from ".";
14
-
15
- /**
16
- * This class is a necessary intermediary to handle events proxied from the
17
- * parent @opentripplanner/base-map component handlers to this component.
18
- * Without this interface, there would be no way to detect when a user would
19
- * hide this layer from view on the Leaflet map. The visible property influences
20
- * and sets the Leaflet Layer Control which then is handled by the
21
- * @opentripplanner/base-map component and then delivered to the
22
- * `onOverlayAdded` and `onOverlayRemoved` handlers which then finally set this
23
- * component's state which is then finally used by the vehicle rental overlay
24
- * to properly manage the requesting of vehicle rentals.
25
- */
26
- var LeafletLayerControlInterface = /*#__PURE__*/function (_Component) {
27
- _inherits(LeafletLayerControlInterface, _Component);
28
-
29
- var _super = _createSuper(LeafletLayerControlInterface);
30
-
31
- function LeafletLayerControlInterface(props) {
32
- var _this;
33
-
34
- _classCallCheck(this, LeafletLayerControlInterface);
35
-
36
- _this = _super.call(this, props);
37
-
38
- _this.onOverlayAdded = function () {
39
- _this.setState({
40
- visible: true
41
- });
42
- };
43
-
44
- _this.onOverlayRemoved = function () {
45
- _this.setState({
46
- visible: false
47
- });
48
- };
49
-
50
- _this.state = {
51
- visible: props.visible
52
- };
53
- return _this;
54
- }
55
- /**
56
- * Upon mounting, this class calls the register overlay property that the
57
- * @opentripplanner/base-map package has injected into the props.
58
- */
59
-
60
-
61
- _createClass(LeafletLayerControlInterface, [{
62
- key: "componentDidMount",
63
- value: function componentDidMount() {
64
- var registerOverlay = this.props.registerOverlay;
65
- registerOverlay(this);
66
- }
67
- /**
68
- * A handler function for when this layer is toggled on by the user via the
69
- * leaflet layer control.
70
- */
71
-
72
- }, {
73
- key: "render",
74
- value: function render() {
75
- var visible = this.state.visible;
76
- return (
77
- /*#__PURE__*/
78
- // eslint-disable-next-line react/jsx-props-no-spreading
79
- React.createElement(VehicleRentalOverlay, _extends({}, this.props, {
80
- visible: visible
81
- }))
82
- );
83
- }
84
- }]);
85
-
86
- return LeafletLayerControlInterface;
87
- }(Component);
88
-
89
- export { LeafletLayerControlInterface as default };
90
- //# sourceMappingURL=leaflet-layer-control-interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/leaflet-layer-control-interface.tsx"],"names":["React","Component","VehicleRentalOverlay","LeafletLayerControlInterface","props","onOverlayAdded","setState","visible","onOverlayRemoved","state","registerOverlay"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AAEA,OAAOC,oBAAP,MAAiC,GAAjC;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACqBC,4B;;;;;AAInB,wCAAYC,KAAZ,EAA0B;AAAA;;AAAA;;AACxB,8BAAMA,KAAN;;AADwB,UAkB1BC,cAlB0B,GAkBT,YAAM;AACrB,YAAKC,QAAL,CAAc;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAd;AACD,KApByB;;AAAA,UA0B1BC,gBA1B0B,GA0BP,YAAM;AACvB,YAAKF,QAAL,CAAc;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAd;AACD,KA5ByB;;AAExB,UAAKE,KAAL,GAAa;AAAEF,MAAAA,OAAO,EAAEH,KAAK,CAACG;AAAjB,KAAb;AAFwB;AAGzB;AAED;AACF;AACA;AACA;;;;;WACE,6BAAoB;AAClB,UAAQG,eAAR,GAA4B,KAAKN,KAAjC,CAAQM,eAAR;AACAA,MAAAA,eAAe,CAAC,IAAD,CAAf;AACD;AAED;AACF;AACA;AACA;;;;WAaE,kBAAS;AACP,UAAQH,OAAR,GAAoB,KAAKE,KAAzB,CAAQF,OAAR;AACA;AAAA;AACE;AACA,4BAAC,oBAAD,eAA0B,KAAKH,KAA/B;AAAsC,UAAA,OAAO,EAAEG;AAA/C;AAFF;AAID;;;;EAxCuDN,S;;SAArCE,4B","sourcesContent":["import React, { Component } from \"react\";\n\nimport VehicleRentalOverlay from \".\";\n\ntype Props = {\n /**\n * This method is created by the @opentripplanner/base-map package when\n * mounting user-defined layers. This will allow the component to subscribe to\n * various leaflet events that then get forwarded on to this component.\n */\n registerOverlay: (component: Component) => void;\n /**\n * Whether or not to initially display the rental vehicles. Once the component\n * is mounted the subscribed events of a user toggling on or off the layer via\n * the layer control item will subsequently control the display of the\n * component.\n */\n visible?: boolean;\n};\n\ntype State = {\n /**\n * An internal state variable used to determine whether or not to display the\n * rental vehicles for this layer.\n */\n visible: boolean;\n};\n\n/**\n * This class is a necessary intermediary to handle events proxied from the\n * parent @opentripplanner/base-map component handlers to this component.\n * Without this interface, there would be no way to detect when a user would\n * hide this layer from view on the Leaflet map. The visible property influences\n * and sets the Leaflet Layer Control which then is handled by the\n * @opentripplanner/base-map component and then delivered to the\n * `onOverlayAdded` and `onOverlayRemoved` handlers which then finally set this\n * component's state which is then finally used by the vehicle rental overlay\n * to properly manage the requesting of vehicle rentals.\n */\nexport default class LeafletLayerControlInterface extends Component<\n Props,\n State\n> {\n constructor(props: Props) {\n super(props);\n this.state = { visible: props.visible };\n }\n\n /**\n * Upon mounting, this class calls the register overlay property that the\n * @opentripplanner/base-map package has injected into the props.\n */\n componentDidMount() {\n const { registerOverlay } = this.props;\n registerOverlay(this);\n }\n\n /**\n * A handler function for when this layer is toggled on by the user via the\n * leaflet layer control.\n */\n onOverlayAdded = () => {\n this.setState({ visible: true });\n };\n\n /**\n * A handler function for when this layer is toggled off by the user via the\n * leaflet layer control.\n */\n onOverlayRemoved = () => {\n this.setState({ visible: false });\n };\n\n render() {\n const { visible } = this.state;\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <VehicleRentalOverlay {...this.props} visible={visible} />\n );\n }\n}\n"],"file":"leaflet-layer-control-interface.js"}
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _react = _interopRequireWildcard(require("react"));
13
-
14
- var _ = _interopRequireDefault(require("."));
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- /**
21
- * This class is a necessary intermediary to handle events proxied from the
22
- * parent @opentripplanner/base-map component handlers to this component.
23
- * Without this interface, there would be no way to detect when a user would
24
- * hide this layer from view on the Leaflet map. The visible property influences
25
- * and sets the Leaflet Layer Control which then is handled by the
26
- * @opentripplanner/base-map component and then delivered to the
27
- * `onOverlayAdded` and `onOverlayRemoved` handlers which then finally set this
28
- * component's state which is then finally used by the vehicle rental overlay
29
- * to properly manage the requesting of vehicle rentals.
30
- */
31
- class LeafletLayerControlInterface extends _react.Component {
32
- constructor(props) {
33
- super(props);
34
-
35
- this.onOverlayAdded = () => {
36
- this.setState({
37
- visible: true
38
- });
39
- };
40
-
41
- this.onOverlayRemoved = () => {
42
- this.setState({
43
- visible: false
44
- });
45
- };
46
-
47
- this.state = {
48
- visible: props.visible
49
- };
50
- }
51
- /**
52
- * Upon mounting, this class calls the register overlay property that the
53
- * @opentripplanner/base-map package has injected into the props.
54
- */
55
-
56
-
57
- componentDidMount() {
58
- const {
59
- registerOverlay
60
- } = this.props;
61
- registerOverlay(this);
62
- }
63
- /**
64
- * A handler function for when this layer is toggled on by the user via the
65
- * leaflet layer control.
66
- */
67
-
68
-
69
- render() {
70
- const {
71
- visible
72
- } = this.state;
73
- return (
74
- /*#__PURE__*/
75
- // eslint-disable-next-line react/jsx-props-no-spreading
76
- _react.default.createElement(_.default, (0, _extends2.default)({}, this.props, {
77
- visible: visible
78
- }))
79
- );
80
- }
81
-
82
- }
83
-
84
- exports.default = LeafletLayerControlInterface;
85
- //# sourceMappingURL=leaflet-layer-control-interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/leaflet-layer-control-interface.tsx"],"names":["LeafletLayerControlInterface","Component","constructor","props","onOverlayAdded","setState","visible","onOverlayRemoved","state","componentDidMount","registerOverlay","render"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMA,4BAAN,SAA2CC,gBAA3C,CAGb;AACAC,EAAAA,WAAW,CAACC,KAAD,EAAe;AACxB,UAAMA,KAAN;;AADwB,SAkB1BC,cAlB0B,GAkBT,MAAM;AACrB,WAAKC,QAAL,CAAc;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAd;AACD,KApByB;;AAAA,SA0B1BC,gBA1B0B,GA0BP,MAAM;AACvB,WAAKF,QAAL,CAAc;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAd;AACD,KA5ByB;;AAExB,SAAKE,KAAL,GAAa;AAAEF,MAAAA,OAAO,EAAEH,KAAK,CAACG;AAAjB,KAAb;AACD;AAED;AACF;AACA;AACA;;;AACEG,EAAAA,iBAAiB,GAAG;AAClB,UAAM;AAAEC,MAAAA;AAAF,QAAsB,KAAKP,KAAjC;AACAO,IAAAA,eAAe,CAAC,IAAD,CAAf;AACD;AAED;AACF;AACA;AACA;;;AAaEC,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEL,MAAAA;AAAF,QAAc,KAAKE,KAAzB;AACA;AAAA;AACE;AACA,mCAAC,SAAD,6BAA0B,KAAKL,KAA/B;AAAsC,QAAA,OAAO,EAAEG;AAA/C;AAFF;AAID;;AArCD","sourcesContent":["import React, { Component } from \"react\";\n\nimport VehicleRentalOverlay from \".\";\n\ntype Props = {\n /**\n * This method is created by the @opentripplanner/base-map package when\n * mounting user-defined layers. This will allow the component to subscribe to\n * various leaflet events that then get forwarded on to this component.\n */\n registerOverlay: (component: Component) => void;\n /**\n * Whether or not to initially display the rental vehicles. Once the component\n * is mounted the subscribed events of a user toggling on or off the layer via\n * the layer control item will subsequently control the display of the\n * component.\n */\n visible?: boolean;\n};\n\ntype State = {\n /**\n * An internal state variable used to determine whether or not to display the\n * rental vehicles for this layer.\n */\n visible: boolean;\n};\n\n/**\n * This class is a necessary intermediary to handle events proxied from the\n * parent @opentripplanner/base-map component handlers to this component.\n * Without this interface, there would be no way to detect when a user would\n * hide this layer from view on the Leaflet map. The visible property influences\n * and sets the Leaflet Layer Control which then is handled by the\n * @opentripplanner/base-map component and then delivered to the\n * `onOverlayAdded` and `onOverlayRemoved` handlers which then finally set this\n * component's state which is then finally used by the vehicle rental overlay\n * to properly manage the requesting of vehicle rentals.\n */\nexport default class LeafletLayerControlInterface extends Component<\n Props,\n State\n> {\n constructor(props: Props) {\n super(props);\n this.state = { visible: props.visible };\n }\n\n /**\n * Upon mounting, this class calls the register overlay property that the\n * @opentripplanner/base-map package has injected into the props.\n */\n componentDidMount() {\n const { registerOverlay } = this.props;\n registerOverlay(this);\n }\n\n /**\n * A handler function for when this layer is toggled on by the user via the\n * leaflet layer control.\n */\n onOverlayAdded = () => {\n this.setState({ visible: true });\n };\n\n /**\n * A handler function for when this layer is toggled off by the user via the\n * leaflet layer control.\n */\n onOverlayRemoved = () => {\n this.setState({ visible: false });\n };\n\n render() {\n const { visible } = this.state;\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <VehicleRentalOverlay {...this.props} visible={visible} />\n );\n }\n}\n"],"file":"leaflet-layer-control-interface.js"}
@@ -1,81 +0,0 @@
1
- import React, { Component } from "react";
2
-
3
- import VehicleRentalOverlay from ".";
4
-
5
- type Props = {
6
- /**
7
- * This method is created by the @opentripplanner/base-map package when
8
- * mounting user-defined layers. This will allow the component to subscribe to
9
- * various leaflet events that then get forwarded on to this component.
10
- */
11
- registerOverlay: (component: Component) => void;
12
- /**
13
- * Whether or not to initially display the rental vehicles. Once the component
14
- * is mounted the subscribed events of a user toggling on or off the layer via
15
- * the layer control item will subsequently control the display of the
16
- * component.
17
- */
18
- visible?: boolean;
19
- };
20
-
21
- type State = {
22
- /**
23
- * An internal state variable used to determine whether or not to display the
24
- * rental vehicles for this layer.
25
- */
26
- visible: boolean;
27
- };
28
-
29
- /**
30
- * This class is a necessary intermediary to handle events proxied from the
31
- * parent @opentripplanner/base-map component handlers to this component.
32
- * Without this interface, there would be no way to detect when a user would
33
- * hide this layer from view on the Leaflet map. The visible property influences
34
- * and sets the Leaflet Layer Control which then is handled by the
35
- * @opentripplanner/base-map component and then delivered to the
36
- * `onOverlayAdded` and `onOverlayRemoved` handlers which then finally set this
37
- * component's state which is then finally used by the vehicle rental overlay
38
- * to properly manage the requesting of vehicle rentals.
39
- */
40
- export default class LeafletLayerControlInterface extends Component<
41
- Props,
42
- State
43
- > {
44
- constructor(props: Props) {
45
- super(props);
46
- this.state = { visible: props.visible };
47
- }
48
-
49
- /**
50
- * Upon mounting, this class calls the register overlay property that the
51
- * @opentripplanner/base-map package has injected into the props.
52
- */
53
- componentDidMount() {
54
- const { registerOverlay } = this.props;
55
- registerOverlay(this);
56
- }
57
-
58
- /**
59
- * A handler function for when this layer is toggled on by the user via the
60
- * leaflet layer control.
61
- */
62
- onOverlayAdded = () => {
63
- this.setState({ visible: true });
64
- };
65
-
66
- /**
67
- * A handler function for when this layer is toggled off by the user via the
68
- * leaflet layer control.
69
- */
70
- onOverlayRemoved = () => {
71
- this.setState({ visible: false });
72
- };
73
-
74
- render() {
75
- const { visible } = this.state;
76
- return (
77
- // eslint-disable-next-line react/jsx-props-no-spreading
78
- <VehicleRentalOverlay {...this.props} visible={visible} />
79
- );
80
- }
81
- }