@opentripplanner/vehicle-rental-overlay 1.3.0 → 1.3.1

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.
@@ -21,10 +21,14 @@ var templatePropTypes = {
21
21
  children: PropTypes.node,
22
22
 
23
23
  /** The rental vehicle or station to render. */
24
- entity: coreUtils.types.stationType.isRequired
24
+ entity: coreUtils.types.stationType.isRequired,
25
+
26
+ /** leaflet attribute to control tabindex value for keyboaryd-only / SR users */
27
+ keyboard: PropTypes.bool
25
28
  };
26
29
  var templateDefaultProps = {
27
- children: null
30
+ children: null,
31
+ keyboard: false
28
32
  };
29
33
  /**
30
34
  * Renders a shared bike or shared bike dock as a circle
@@ -40,6 +44,7 @@ export var SharedBikeCircle = function SharedBikeCircle(_ref) {
40
44
 
41
45
  var GeneratedMarker = function GeneratedMarker(_ref2) {
42
46
  var children = _ref2.children,
47
+ keyboard = _ref2.keyboard,
43
48
  station = _ref2.entity;
44
49
  var newStrokeColor = strokeColor || fillColor;
45
50
 
@@ -52,6 +57,7 @@ export var SharedBikeCircle = function SharedBikeCircle(_ref) {
52
57
  color: newStrokeColor,
53
58
  fillColor: fillColor,
54
59
  fillOpacity: 1,
60
+ keyboard: keyboard,
55
61
  radius: pixels - (station.isFloatingBike ? 1 : 0),
56
62
  weight: 1
57
63
  }, children);
@@ -68,6 +74,7 @@ export var SharedBikeCircle = function SharedBikeCircle(_ref) {
68
74
 
69
75
  export var HubAndFloatingBike = function HubAndFloatingBike(_ref3) {
70
76
  var children = _ref3.children,
77
+ keyboard = _ref3.keyboard,
71
78
  station = _ref3.entity;
72
79
  var icon;
73
80
 
@@ -83,6 +90,7 @@ export var HubAndFloatingBike = function HubAndFloatingBike(_ref3) {
83
90
 
84
91
  return /*#__PURE__*/React.createElement(Marker, {
85
92
  icon: icon,
93
+ keyboard: keyboard,
86
94
  position: [station.y, station.x]
87
95
  }, children);
88
96
  };
@@ -115,9 +123,11 @@ export var GenericMarker = function GenericMarker(_ref4) {
115
123
 
116
124
  var GeneratedMarker = function GeneratedMarker(_ref5) {
117
125
  var children = _ref5.children,
126
+ keyboard = _ref5.keyboard,
118
127
  station = _ref5.entity;
119
128
  return /*#__PURE__*/React.createElement(Marker, {
120
129
  icon: markerIcon,
130
+ keyboard: keyboard,
121
131
  position: [station.y, station.x]
122
132
  }, children);
123
133
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/DefaultMarkers/index.js"],"names":["divIcon","memoize","coreUtils","PropTypes","React","ReactDOMServer","CircleMarker","Marker","floatingBikeIcon","hubIcons","Styled","templatePropTypes","children","node","entity","types","stationType","isRequired","templateDefaultProps","SharedBikeCircle","dockStrokeColor","fillColor","pixels","strokeColor","GeneratedMarker","station","newStrokeColor","isFloatingBike","y","x","propTypes","defaultProps","HubAndFloatingBike","icon","capacity","bikesAvailable","spacesAvailable","pctFull","i","Math","round","getStationMarkerByColor","color","className","iconSize","popupAnchor","html","renderToStaticMarkup","GenericMarker","markerIcon"],"mappings":"AAAA,SAASA,OAAT,QAAwB,SAAxB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,YAAT,EAAuBC,MAAvB,QAAqC,eAArC;AAEA,SAASC,gBAAT,EAA2BC,QAA3B,QAA2C,eAA3C;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACA,IAAMC,iBAAiB,GAAG;AACxB;AACAC,EAAAA,QAAQ,EAAET,SAAS,CAACU,IAFI;;AAGxB;AACAC,EAAAA,MAAM,EAAEZ,SAAS,CAACa,KAAV,CAAgBC,WAAhB,CAA4BC;AAJZ,CAA1B;AAMA,IAAMC,oBAAoB,GAAG;AAC3BN,EAAAA,QAAQ,EAAE;AAD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AAlBA,eAAkB;AAAA,QAAGZ,QAAH,SAAGA,QAAH;AAAA,QAAqBa,OAArB,SAAaX,MAAb;AAAA,wBACtB,oBAAC,MAAD;AAAQ,MAAA,IAAI,EAAEmC,UAAd;AAA0B,MAAA,QAAQ,EAAE,CAACxB,OAAO,CAACG,CAAT,EAAYH,OAAO,CAACI,CAApB;AAApC,OACGjB,QADH,CADsB;AAAA,GAAxB;;AAKAY,EAAAA,eAAe,CAACM,SAAhB,GAA4BnB,iBAA5B;AACAa,EAAAA,eAAe,CAACO,YAAhB,GAA+Bb,oBAA/B;AACA,SAAOM,eAAP;AACD,CAXM","sourcesContent":["import { divIcon } from \"leaflet\";\nimport memoize from \"lodash.memoize\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { CircleMarker, Marker } from \"react-leaflet\";\n\nimport { floatingBikeIcon, hubIcons } from \"../bike-icons\";\nimport * as Styled from \"../styled\";\n\n/**\n * This file contains default marker types for rental vehicles,\n * that can be used when defining the VehicleRentalOverlay's symbol prop:\n * - SharedBikeCircle\n * - GenericMarker\n * - HubAndFloatingBike\n */\n\n// Prop types reused across components.\nconst templatePropTypes = {\n /** The children of the component. */\n children: PropTypes.node,\n /** The rental vehicle or station to render. */\n entity: coreUtils.types.stationType.isRequired\n};\nconst templateDefaultProps = {\n children: null\n};\n\n/**\n * Renders a shared bike or shared bike dock as a circle\n * with predefined colors and size.\n */\nexport const SharedBikeCircle = ({\n dockStrokeColor,\n fillColor = \"gray\",\n pixels,\n strokeColor\n}) => {\n const GeneratedMarker = ({ children, entity: station }) => {\n let newStrokeColor = strokeColor || fillColor;\n\n if (!station.isFloatingBike) {\n newStrokeColor = dockStrokeColor || strokeColor;\n }\n\n return (\n <CircleMarker\n center={[station.y, station.x]}\n color={newStrokeColor}\n fillColor={fillColor}\n fillOpacity={1}\n radius={pixels - (station.isFloatingBike ? 1 : 0)}\n weight={1}\n >\n {children}\n </CircleMarker>\n );\n };\n\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n\n/**\n * A component that renders rental bike entities\n * either as a bike or a bike dock (or hub, showing spaces available).\n */\nexport const HubAndFloatingBike = ({ children, entity: station }) => {\n let icon;\n if (station.isFloatingBike) {\n icon = floatingBikeIcon;\n } else {\n const capacity = station.bikesAvailable + station.spacesAvailable;\n if (capacity === 0) return null;\n const pctFull = station.bikesAvailable / capacity;\n const i = Math.round(pctFull * 9);\n icon = hubIcons[i];\n }\n return (\n <Marker icon={icon} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n};\nHubAndFloatingBike.propTypes = templatePropTypes;\nHubAndFloatingBike.defaultProps = templateDefaultProps;\n\n/**\n * Creates and caches a leaflet element icon based on color.\n */\nconst getStationMarkerByColor = memoize(color =>\n divIcon({\n className: \"\",\n iconSize: [11, 16],\n popupAnchor: [0, -6],\n html: ReactDOMServer.renderToStaticMarkup(\n <Styled.StationMarker color={color} />\n )\n })\n);\n\n/**\n * Helper function to create a leaflet Marker component to render entities\n * using fixed fill color.\n * Usage: GenericMarker({ fillColor: \"#F204B5\" })\n */\nexport const GenericMarker = ({ fillColor = \"gray\" }) => {\n const markerIcon = getStationMarkerByColor(fillColor);\n\n const GeneratedMarker = ({ children, entity: station }) => (\n <Marker icon={markerIcon} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/DefaultMarkers/index.js"],"names":["divIcon","memoize","coreUtils","PropTypes","React","ReactDOMServer","CircleMarker","Marker","floatingBikeIcon","hubIcons","Styled","templatePropTypes","children","node","entity","types","stationType","isRequired","keyboard","bool","templateDefaultProps","SharedBikeCircle","dockStrokeColor","fillColor","pixels","strokeColor","GeneratedMarker","station","newStrokeColor","isFloatingBike","y","x","propTypes","defaultProps","HubAndFloatingBike","icon","capacity","bikesAvailable","spacesAvailable","pctFull","i","Math","round","getStationMarkerByColor","color","className","iconSize","popupAnchor","html","renderToStaticMarkup","GenericMarker","markerIcon"],"mappings":"AAAA,SAASA,OAAT,QAAwB,SAAxB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,YAAT,EAAuBC,MAAvB,QAAqC,eAArC;AAEA,SAASC,gBAAT,EAA2BC,QAA3B,QAA2C,eAA3C;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACA,IAAMC,iBAAiB,GAAG;AACxB;AACAC,EAAAA,QAAQ,EAAET,SAAS,CAACU,IAFI;;AAGxB;AACAC,EAAAA,MAAM,EAAEZ,SAAS,CAACa,KAAV,CAAgBC,WAAhB,CAA4BC,UAJZ;;AAKxB;AACAC,EAAAA,QAAQ,EAAEf,SAAS,CAACgB;AANI,CAA1B;AAQA,IAAMC,oBAAoB,GAAG;AAC3BR,EAAAA,QAAQ,EAAE,IADiB;AAE3BM,EAAAA,QAAQ,EAAE;AAFiB,CAA7B;AAKA;AACA;AACA;AACA;;AACA,OAAO,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAmB,OAK1B;AAAA,MAJJC,eAII,QAJJA,eAII;AAAA,4BAHJC,SAGI;AAAA,MAHJA,SAGI,+BAHQ,MAGR;AAAA,MAFJC,MAEI,QAFJA,MAEI;AAAA,MADJC,WACI,QADJA,WACI;;AACJ,MAAMC,eAAe,GAAG,SAAlBA,eAAkB,QAA6C;AAAA,QAA1Cd,QAA0C,SAA1CA,QAA0C;AAAA,QAAhCM,QAAgC,SAAhCA,QAAgC;AAAA,QAAdS,OAAc,SAA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CAACS,OAAO,CAACG,CAAT,EAAYH,OAAO,CAACI,CAApB;AAHZ,OAKGnB,QALH,CADsB;AAAA,GAAxB;;AASAc,EAAAA,eAAe,CAACM,SAAhB,GAA4BrB,iBAA5B;AACAe,EAAAA,eAAe,CAACO,YAAhB,GAA+Bb,oBAA/B;AACA,SAAOM,eAAP;AACD,CAfM","sourcesContent":["import { divIcon } from \"leaflet\";\nimport memoize from \"lodash.memoize\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { CircleMarker, Marker } from \"react-leaflet\";\n\nimport { floatingBikeIcon, hubIcons } from \"../bike-icons\";\nimport * as Styled from \"../styled\";\n\n/**\n * This file contains default marker types for rental vehicles,\n * that can be used when defining the VehicleRentalOverlay's symbol prop:\n * - SharedBikeCircle\n * - GenericMarker\n * - HubAndFloatingBike\n */\n\n// Prop types reused across components.\nconst templatePropTypes = {\n /** The children of the component. */\n children: PropTypes.node,\n /** The rental vehicle or station to render. */\n entity: coreUtils.types.stationType.isRequired,\n /** leaflet attribute to control tabindex value for keyboaryd-only / SR users */\n keyboard: PropTypes.bool\n};\nconst templateDefaultProps = {\n children: null,\n keyboard: false\n};\n\n/**\n * Renders a shared bike or shared bike dock as a circle\n * with predefined colors and size.\n */\nexport const SharedBikeCircle = ({\n dockStrokeColor,\n fillColor = \"gray\",\n pixels,\n strokeColor\n}) => {\n const GeneratedMarker = ({ children, keyboard, entity: station }) => {\n let newStrokeColor = strokeColor || fillColor;\n\n if (!station.isFloatingBike) {\n newStrokeColor = dockStrokeColor || strokeColor;\n }\n\n return (\n <CircleMarker\n center={[station.y, station.x]}\n color={newStrokeColor}\n fillColor={fillColor}\n fillOpacity={1}\n keyboard={keyboard}\n radius={pixels - (station.isFloatingBike ? 1 : 0)}\n weight={1}\n >\n {children}\n </CircleMarker>\n );\n };\n\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n\n/**\n * A component that renders rental bike entities\n * either as a bike or a bike dock (or hub, showing spaces available).\n */\nexport const HubAndFloatingBike = ({ children, keyboard, entity: station }) => {\n let icon;\n if (station.isFloatingBike) {\n icon = floatingBikeIcon;\n } else {\n const capacity = station.bikesAvailable + station.spacesAvailable;\n if (capacity === 0) return null;\n const pctFull = station.bikesAvailable / capacity;\n const i = Math.round(pctFull * 9);\n icon = hubIcons[i];\n }\n return (\n <Marker icon={icon} keyboard={keyboard} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n};\nHubAndFloatingBike.propTypes = templatePropTypes;\nHubAndFloatingBike.defaultProps = templateDefaultProps;\n\n/**\n * Creates and caches a leaflet element icon based on color.\n */\nconst getStationMarkerByColor = memoize(color =>\n divIcon({\n className: \"\",\n iconSize: [11, 16],\n popupAnchor: [0, -6],\n html: ReactDOMServer.renderToStaticMarkup(\n <Styled.StationMarker color={color} />\n )\n })\n);\n\n/**\n * Helper function to create a leaflet Marker component to render entities\n * using fixed fill color.\n * Usage: GenericMarker({ fillColor: \"#F204B5\" })\n */\nexport const GenericMarker = ({ fillColor = \"gray\" }) => {\n const markerIcon = getStationMarkerByColor(fillColor);\n\n const GeneratedMarker = ({ children, keyboard, entity: station }) => (\n <Marker\n icon={markerIcon}\n keyboard={keyboard}\n position={[station.y, station.x]}\n >\n {children}\n </Marker>\n );\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n"],"file":"index.js"}
@@ -42,10 +42,14 @@ const templatePropTypes = {
42
42
  children: _propTypes.default.node,
43
43
 
44
44
  /** The rental vehicle or station to render. */
45
- entity: _coreUtils.default.types.stationType.isRequired
45
+ entity: _coreUtils.default.types.stationType.isRequired,
46
+
47
+ /** leaflet attribute to control tabindex value for keyboaryd-only / SR users */
48
+ keyboard: _propTypes.default.bool
46
49
  };
47
50
  const templateDefaultProps = {
48
- children: null
51
+ children: null,
52
+ keyboard: false
49
53
  };
50
54
  /**
51
55
  * Renders a shared bike or shared bike dock as a circle
@@ -60,6 +64,7 @@ const SharedBikeCircle = ({
60
64
  }) => {
61
65
  const GeneratedMarker = ({
62
66
  children,
67
+ keyboard,
63
68
  entity: station
64
69
  }) => {
65
70
  let newStrokeColor = strokeColor || fillColor;
@@ -73,6 +78,7 @@ const SharedBikeCircle = ({
73
78
  color: newStrokeColor,
74
79
  fillColor: fillColor,
75
80
  fillOpacity: 1,
81
+ keyboard: keyboard,
76
82
  radius: pixels - (station.isFloatingBike ? 1 : 0),
77
83
  weight: 1
78
84
  }, children);
@@ -92,6 +98,7 @@ exports.SharedBikeCircle = SharedBikeCircle;
92
98
 
93
99
  const HubAndFloatingBike = ({
94
100
  children,
101
+ keyboard,
95
102
  entity: station
96
103
  }) => {
97
104
  let icon;
@@ -108,6 +115,7 @@ const HubAndFloatingBike = ({
108
115
 
109
116
  return /*#__PURE__*/_react.default.createElement(_reactLeaflet.Marker, {
110
117
  icon: icon,
118
+ keyboard: keyboard,
111
119
  position: [station.y, station.x]
112
120
  }, children);
113
121
  };
@@ -140,9 +148,11 @@ const GenericMarker = ({
140
148
 
141
149
  const GeneratedMarker = ({
142
150
  children,
151
+ keyboard,
143
152
  entity: station
144
153
  }) => /*#__PURE__*/_react.default.createElement(_reactLeaflet.Marker, {
145
154
  icon: markerIcon,
155
+ keyboard: keyboard,
146
156
  position: [station.y, station.x]
147
157
  }, children);
148
158
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/DefaultMarkers/index.js"],"names":["templatePropTypes","children","PropTypes","node","entity","coreUtils","types","stationType","isRequired","templateDefaultProps","SharedBikeCircle","dockStrokeColor","fillColor","pixels","strokeColor","GeneratedMarker","station","newStrokeColor","isFloatingBike","y","x","propTypes","defaultProps","HubAndFloatingBike","icon","floatingBikeIcon","capacity","bikesAvailable","spacesAvailable","pctFull","i","Math","round","hubIcons","getStationMarkerByColor","color","className","iconSize","popupAnchor","html","React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AAhC;AAWA;AACA;AACA;AACA;AACA;;AACO,MAAMO,aAAa,GAAG,CAAC;AAAE9B,EAAAA,SAAS,GAAG;AAAd,CAAD,KAA4B;AACvD,QAAM+B,UAAU,GAAGT,uBAAuB,CAACtB,SAAD,CAA1C;;AAEA,QAAMG,eAAe,GAAG,CAAC;AAAEd,IAAAA,QAAF;AAAYG,IAAAA,MAAM,EAAEY;AAApB,GAAD,kBACtB,6BAAC,oBAAD;AAAQ,IAAA,IAAI,EAAE2B,UAAd;AAA0B,IAAA,QAAQ,EAAE,CAAC3B,OAAO,CAACG,CAAT,EAAYH,OAAO,CAACI,CAApB;AAApC,KACGnB,QADH,CADF;;AAKAc,EAAAA,eAAe,CAACM,SAAhB,GAA4BrB,iBAA5B;AACAe,EAAAA,eAAe,CAACO,YAAhB,GAA+Bb,oBAA/B;AACA,SAAOM,eAAP;AACD,CAXM","sourcesContent":["import { divIcon } from \"leaflet\";\nimport memoize from \"lodash.memoize\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { CircleMarker, Marker } from \"react-leaflet\";\n\nimport { floatingBikeIcon, hubIcons } from \"../bike-icons\";\nimport * as Styled from \"../styled\";\n\n/**\n * This file contains default marker types for rental vehicles,\n * that can be used when defining the VehicleRentalOverlay's symbol prop:\n * - SharedBikeCircle\n * - GenericMarker\n * - HubAndFloatingBike\n */\n\n// Prop types reused across components.\nconst templatePropTypes = {\n /** The children of the component. */\n children: PropTypes.node,\n /** The rental vehicle or station to render. */\n entity: coreUtils.types.stationType.isRequired\n};\nconst templateDefaultProps = {\n children: null\n};\n\n/**\n * Renders a shared bike or shared bike dock as a circle\n * with predefined colors and size.\n */\nexport const SharedBikeCircle = ({\n dockStrokeColor,\n fillColor = \"gray\",\n pixels,\n strokeColor\n}) => {\n const GeneratedMarker = ({ children, entity: station }) => {\n let newStrokeColor = strokeColor || fillColor;\n\n if (!station.isFloatingBike) {\n newStrokeColor = dockStrokeColor || strokeColor;\n }\n\n return (\n <CircleMarker\n center={[station.y, station.x]}\n color={newStrokeColor}\n fillColor={fillColor}\n fillOpacity={1}\n radius={pixels - (station.isFloatingBike ? 1 : 0)}\n weight={1}\n >\n {children}\n </CircleMarker>\n );\n };\n\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n\n/**\n * A component that renders rental bike entities\n * either as a bike or a bike dock (or hub, showing spaces available).\n */\nexport const HubAndFloatingBike = ({ children, entity: station }) => {\n let icon;\n if (station.isFloatingBike) {\n icon = floatingBikeIcon;\n } else {\n const capacity = station.bikesAvailable + station.spacesAvailable;\n if (capacity === 0) return null;\n const pctFull = station.bikesAvailable / capacity;\n const i = Math.round(pctFull * 9);\n icon = hubIcons[i];\n }\n return (\n <Marker icon={icon} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n};\nHubAndFloatingBike.propTypes = templatePropTypes;\nHubAndFloatingBike.defaultProps = templateDefaultProps;\n\n/**\n * Creates and caches a leaflet element icon based on color.\n */\nconst getStationMarkerByColor = memoize(color =>\n divIcon({\n className: \"\",\n iconSize: [11, 16],\n popupAnchor: [0, -6],\n html: ReactDOMServer.renderToStaticMarkup(\n <Styled.StationMarker color={color} />\n )\n })\n);\n\n/**\n * Helper function to create a leaflet Marker component to render entities\n * using fixed fill color.\n * Usage: GenericMarker({ fillColor: \"#F204B5\" })\n */\nexport const GenericMarker = ({ fillColor = \"gray\" }) => {\n const markerIcon = getStationMarkerByColor(fillColor);\n\n const GeneratedMarker = ({ children, entity: station }) => (\n <Marker icon={markerIcon} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/DefaultMarkers/index.js"],"names":["templatePropTypes","children","PropTypes","node","entity","coreUtils","types","stationType","isRequired","keyboard","bool","templateDefaultProps","SharedBikeCircle","dockStrokeColor","fillColor","pixels","strokeColor","GeneratedMarker","station","newStrokeColor","isFloatingBike","y","x","propTypes","defaultProps","HubAndFloatingBike","icon","floatingBikeIcon","capacity","bikesAvailable","spacesAvailable","pctFull","i","Math","round","hubIcons","getStationMarkerByColor","color","className","iconSize","popupAnchor","html","ReactDOMServer","renderToStaticMarkup","GenericMarker","markerIcon"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA,MAAMA,iBAAiB,GAAG;AACxB;AACAC,EAAAA,QAAQ,EAAEC,mBAAUC,IAFI;;AAGxB;AACAC,EAAAA,MAAM,EAAEC,mBAAUC,KAAV,CAAgBC,WAAhB,CAA4BC,UAJZ;;AAKxB;AACAC,EAAAA,QAAQ,EAAEP,mBAAUQ;AANI,CAA1B;AAQA,MAAMC,oBAAoB,GAAG;AAC3BV,EAAAA,QAAQ,EAAE,IADiB;AAE3BQ,EAAAA,QAAQ,EAAE;AAFiB,CAA7B;AAKA;AACA;AACA;AACA;;AACO,MAAMG,gBAAgB,GAAG,CAAC;AAC/BC,EAAAA,eAD+B;AAE/BC,EAAAA,SAAS,GAAG,MAFmB;AAG/BC,EAAAA,MAH+B;AAI/BC,EAAAA;AAJ+B,CAAD,KAK1B;AACJ,QAAMC,eAAe,GAAG,CAAC;AAAEhB,IAAAA,QAAF;AAAYQ,IAAAA,QAAZ;AAAsBL,IAAAA,MAAM,EAAEc;AAA9B,GAAD,KAA6C;AACnE,QAAIC,cAAc,GAAGH,WAAW,IAAIF,SAApC;;AAEA,QAAI,CAACI,OAAO,CAACE,cAAb,EAA6B;AAC3BD,MAAAA,cAAc,GAAGN,eAAe,IAAIG,WAApC;AACD;;AAED,wBACE,6BAAC,0BAAD;AACE,MAAA,MAAM,EAAE,CAACE,OAAO,CAACG,CAAT,E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BPwB,kBAAkB,CAACF,SAAnB,GAA+BvB,iBAA/B;AACAyB,kBAAkB,CAACD,YAAnB,GAAkCb,oBAAlC;AAEA;AACA;AACA;;AACA,MAAMyB,uBAAuB,GAAG,qBAAQC,KAAK,IAC3C,sBAAQ;AACNC,EAAAA,SAAS,EAAE,EADL;AAENC,EAAAA,QAAQ,EAAE,CAAC,EAAD,EAAK,EAAL,CAFJ;AAGNC,EAAAA,WAAW,EAAE,CAAC,CAAD,EAAI,CAAC,CAAL,CAHP;AAINC,EAAAA,IAAI,EAAEC,gBAAeC,oBAAf,eACJ,6BAAC,MAAD,CAAQ,aAAR;AAAsB,IAAA,KAAK,EAAEN;AAA7B,IADI;AAJA,CAAR,CAD8B,CAAhC;AAWA;AACA;AACA;AACA;AACA;;AACO,MAAMO,aAAa,GAAG,CAAC;AAAE9B,EAAAA,SAAS,GAAG;AAAd,CAAD,KAA4B;AACvD,QAAM+B,UAAU,GAAGT,uBAAuB,CAACtB,SAAD,CAA1C;;AAEA,QAAMG,eAAe,GAAG,CAAC;AAAEhB,IAAAA,QAAF;AAAYQ,IAAAA,QAAZ;AAAsBL,IAAAA,MAAM,EAAEc;AAA9B,GAAD,kBACtB,6BAAC,oBAAD;AACE,IAAA,IAAI,EAAE2B,UADR;AAEE,IAAA,QAAQ,EAAEpC,QAFZ;AAGE,IAAA,QAAQ,EAAE,CAACS,OAAO,CAACG,CAAT,EAAYH,OAAO,CAACI,CAApB;AAHZ,KAKGrB,QALH,CADF;;AASAgB,EAAAA,eAAe,CAACM,SAAhB,GAA4BvB,iBAA5B;AACAiB,EAAAA,eAAe,CAACO,YAAhB,GAA+Bb,oBAA/B;AACA,SAAOM,eAAP;AACD,CAfM","sourcesContent":["import { divIcon } from \"leaflet\";\nimport memoize from \"lodash.memoize\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport ReactDOMServer from \"react-dom/server\";\nimport { CircleMarker, Marker } from \"react-leaflet\";\n\nimport { floatingBikeIcon, hubIcons } from \"../bike-icons\";\nimport * as Styled from \"../styled\";\n\n/**\n * This file contains default marker types for rental vehicles,\n * that can be used when defining the VehicleRentalOverlay's symbol prop:\n * - SharedBikeCircle\n * - GenericMarker\n * - HubAndFloatingBike\n */\n\n// Prop types reused across components.\nconst templatePropTypes = {\n /** The children of the component. */\n children: PropTypes.node,\n /** The rental vehicle or station to render. */\n entity: coreUtils.types.stationType.isRequired,\n /** leaflet attribute to control tabindex value for keyboaryd-only / SR users */\n keyboard: PropTypes.bool\n};\nconst templateDefaultProps = {\n children: null,\n keyboard: false\n};\n\n/**\n * Renders a shared bike or shared bike dock as a circle\n * with predefined colors and size.\n */\nexport const SharedBikeCircle = ({\n dockStrokeColor,\n fillColor = \"gray\",\n pixels,\n strokeColor\n}) => {\n const GeneratedMarker = ({ children, keyboard, entity: station }) => {\n let newStrokeColor = strokeColor || fillColor;\n\n if (!station.isFloatingBike) {\n newStrokeColor = dockStrokeColor || strokeColor;\n }\n\n return (\n <CircleMarker\n center={[station.y, station.x]}\n color={newStrokeColor}\n fillColor={fillColor}\n fillOpacity={1}\n keyboard={keyboard}\n radius={pixels - (station.isFloatingBike ? 1 : 0)}\n weight={1}\n >\n {children}\n </CircleMarker>\n );\n };\n\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n\n/**\n * A component that renders rental bike entities\n * either as a bike or a bike dock (or hub, showing spaces available).\n */\nexport const HubAndFloatingBike = ({ children, keyboard, entity: station }) => {\n let icon;\n if (station.isFloatingBike) {\n icon = floatingBikeIcon;\n } else {\n const capacity = station.bikesAvailable + station.spacesAvailable;\n if (capacity === 0) return null;\n const pctFull = station.bikesAvailable / capacity;\n const i = Math.round(pctFull * 9);\n icon = hubIcons[i];\n }\n return (\n <Marker icon={icon} keyboard={keyboard} position={[station.y, station.x]}>\n {children}\n </Marker>\n );\n};\nHubAndFloatingBike.propTypes = templatePropTypes;\nHubAndFloatingBike.defaultProps = templateDefaultProps;\n\n/**\n * Creates and caches a leaflet element icon based on color.\n */\nconst getStationMarkerByColor = memoize(color =>\n divIcon({\n className: \"\",\n iconSize: [11, 16],\n popupAnchor: [0, -6],\n html: ReactDOMServer.renderToStaticMarkup(\n <Styled.StationMarker color={color} />\n )\n })\n);\n\n/**\n * Helper function to create a leaflet Marker component to render entities\n * using fixed fill color.\n * Usage: GenericMarker({ fillColor: \"#F204B5\" })\n */\nexport const GenericMarker = ({ fillColor = \"gray\" }) => {\n const markerIcon = getStationMarkerByColor(fillColor);\n\n const GeneratedMarker = ({ children, keyboard, entity: station }) => (\n <Marker\n icon={markerIcon}\n keyboard={keyboard}\n position={[station.y, station.x]}\n >\n {children}\n </Marker>\n );\n GeneratedMarker.propTypes = templatePropTypes;\n GeneratedMarker.defaultProps = templateDefaultProps;\n return GeneratedMarker;\n};\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentripplanner/vehicle-rental-overlay",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A map overlay to show vehicle rentals from a specific company",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -18,15 +18,16 @@
18
18
  "url": "git+https://github.com/opentripplanner/otp-ui.git"
19
19
  },
20
20
  "dependencies": {
21
- "@opentripplanner/from-to-location-picker": "^1.2.1",
22
- "@opentripplanner/zoom-based-markers": "^1.2.0",
23
- "@opentripplanner/core-utils": "^4.1.0",
21
+ "@opentripplanner/base-map": "^2.0.0",
22
+ "@opentripplanner/core-utils": "^4.5.0",
23
+ "@opentripplanner/from-to-location-picker": "^1.3.0",
24
+ "@opentripplanner/zoom-based-markers": "^1.2.1",
25
+ "@styled-icons/fa-solid": "^10.34.0",
24
26
  "lodash.memoize": "^4.1.2",
25
- "prop-types": "^15.7.2",
26
- "@styled-icons/fa-solid": "^10.34.0"
27
+ "prop-types": "^15.7.2"
27
28
  },
28
29
  "peerDependencies": {
29
- "@opentripplanner/base-map": "^1.2.0",
30
+ "@opentripplanner/base-map": "^2.0.0",
30
31
  "react": "^16.14.0",
31
32
  "react-dom": "^16.8.6",
32
33
  "react-leaflet": "^2.6.1",
@@ -22,10 +22,13 @@ const templatePropTypes = {
22
22
  /** The children of the component. */
23
23
  children: PropTypes.node,
24
24
  /** The rental vehicle or station to render. */
25
- entity: coreUtils.types.stationType.isRequired
25
+ entity: coreUtils.types.stationType.isRequired,
26
+ /** leaflet attribute to control tabindex value for keyboaryd-only / SR users */
27
+ keyboard: PropTypes.bool
26
28
  };
27
29
  const templateDefaultProps = {
28
- children: null
30
+ children: null,
31
+ keyboard: false
29
32
  };
30
33
 
31
34
  /**
@@ -38,7 +41,7 @@ export const SharedBikeCircle = ({
38
41
  pixels,
39
42
  strokeColor
40
43
  }) => {
41
- const GeneratedMarker = ({ children, entity: station }) => {
44
+ const GeneratedMarker = ({ children, keyboard, entity: station }) => {
42
45
  let newStrokeColor = strokeColor || fillColor;
43
46
 
44
47
  if (!station.isFloatingBike) {
@@ -51,6 +54,7 @@ export const SharedBikeCircle = ({
51
54
  color={newStrokeColor}
52
55
  fillColor={fillColor}
53
56
  fillOpacity={1}
57
+ keyboard={keyboard}
54
58
  radius={pixels - (station.isFloatingBike ? 1 : 0)}
55
59
  weight={1}
56
60
  >
@@ -68,7 +72,7 @@ export const SharedBikeCircle = ({
68
72
  * A component that renders rental bike entities
69
73
  * either as a bike or a bike dock (or hub, showing spaces available).
70
74
  */
71
- export const HubAndFloatingBike = ({ children, entity: station }) => {
75
+ export const HubAndFloatingBike = ({ children, keyboard, entity: station }) => {
72
76
  let icon;
73
77
  if (station.isFloatingBike) {
74
78
  icon = floatingBikeIcon;
@@ -80,7 +84,7 @@ export const HubAndFloatingBike = ({ children, entity: station }) => {
80
84
  icon = hubIcons[i];
81
85
  }
82
86
  return (
83
- <Marker icon={icon} position={[station.y, station.x]}>
87
+ <Marker icon={icon} keyboard={keyboard} position={[station.y, station.x]}>
84
88
  {children}
85
89
  </Marker>
86
90
  );
@@ -110,8 +114,12 @@ const getStationMarkerByColor = memoize(color =>
110
114
  export const GenericMarker = ({ fillColor = "gray" }) => {
111
115
  const markerIcon = getStationMarkerByColor(fillColor);
112
116
 
113
- const GeneratedMarker = ({ children, entity: station }) => (
114
- <Marker icon={markerIcon} position={[station.y, station.x]}>
117
+ const GeneratedMarker = ({ children, keyboard, entity: station }) => (
118
+ <Marker
119
+ icon={markerIcon}
120
+ keyboard={keyboard}
121
+ position={[station.y, station.x]}
122
+ >
115
123
  {children}
116
124
  </Marker>
117
125
  );