@geops/rvf-mobility-web-component 0.1.35 → 0.1.36
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/CHANGELOG.md +10 -0
- package/index.html +2 -2
- package/index.js +262 -262
- package/package.json +1 -1
- package/src/RvfSearch/RvfSearch.tsx +28 -0
- package/src/RvfSearch/index.tsx +1 -0
- package/src/Search/index.tsx +1 -1
- package/src/StopsSearch/StopsSearch.tsx +6 -6
- package/src/icons/Search/Search.tsx +39 -0
- package/src/icons/Search/index.tsx +1 -0
- package/src/icons/Search/search.svg +16 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@geops/rvf-mobility-web-component",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
4
|
"description": "Web components for rvf in the domains of mobility and logistics.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.36",
|
|
6
6
|
"homepage": "https://rvf-mobility-web-component-geops.vercel.app/",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "index.js",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { memo } from "preact/compat";
|
|
2
|
+
import { useCallback } from "preact/hooks";
|
|
3
|
+
|
|
4
|
+
import StopsSearch from "../StopsSearch";
|
|
5
|
+
import centerOnStation from "../utils/centerOnStation";
|
|
6
|
+
import { RVF_EXTENT_4326 } from "../utils/constants";
|
|
7
|
+
import useMapContext from "../utils/hooks/useMapContext";
|
|
8
|
+
|
|
9
|
+
function RvfSearch() {
|
|
10
|
+
const { apikey, map, stopsurl } = useMapContext();
|
|
11
|
+
|
|
12
|
+
const onSelect = useCallback(
|
|
13
|
+
(selected) => {
|
|
14
|
+
return centerOnStation(selected, map);
|
|
15
|
+
},
|
|
16
|
+
[map],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<StopsSearch
|
|
21
|
+
apikey={apikey}
|
|
22
|
+
bbox={RVF_EXTENT_4326.join(",")}
|
|
23
|
+
onselect={onSelect}
|
|
24
|
+
url={stopsurl}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export default memo(RvfSearch);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./RvfSearch";
|
package/src/Search/index.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "
|
|
1
|
+
export { default } from "../RvfSearch";
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
useRef,
|
|
11
11
|
useState,
|
|
12
12
|
} from "preact/hooks";
|
|
13
|
-
import { FaSearch } from "react-icons/fa";
|
|
14
|
-
import { MdClose } from "react-icons/md";
|
|
15
13
|
|
|
14
|
+
import Cancel from "../icons/Cancel";
|
|
15
|
+
import Search from "../icons/Search";
|
|
16
16
|
// @ts-expect-error tailwind must be added for the search web component
|
|
17
17
|
import tailwind from "../style.css";
|
|
18
18
|
import i18n from "../utils/i18n";
|
|
@@ -203,8 +203,8 @@ function StopsSearch({
|
|
|
203
203
|
}
|
|
204
204
|
ref={myRef}
|
|
205
205
|
>
|
|
206
|
-
<div className={"flex items-center "}>
|
|
207
|
-
<
|
|
206
|
+
<div className={"flex items-center text-grey"}>
|
|
207
|
+
<Search className="size-4" />
|
|
208
208
|
</div>
|
|
209
209
|
<div className={"flex grow overflow-hidden border-b-2 border-solid"}>
|
|
210
210
|
<input
|
|
@@ -234,13 +234,13 @@ function StopsSearch({
|
|
|
234
234
|
setResults(undefined);
|
|
235
235
|
}}
|
|
236
236
|
>
|
|
237
|
-
<
|
|
237
|
+
<Cancel className="size-4 text-grey" />
|
|
238
238
|
</button>
|
|
239
239
|
)}
|
|
240
240
|
</div>
|
|
241
241
|
</div>
|
|
242
242
|
|
|
243
|
-
<div className="
|
|
243
|
+
<div className="flex grow overflow-auto rounded-md rounded-t-none bg-white shadow">
|
|
244
244
|
{results && results.length === 0 && (
|
|
245
245
|
<div
|
|
246
246
|
className={
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function Search({ ...props }) {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
height="24px"
|
|
5
|
+
version="1.1"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
width="24px"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<title>iconfont/search</title>
|
|
12
|
+
<defs>
|
|
13
|
+
<polygon id="path-1" points="0 0 20 0 20 20 0 20"></polygon>
|
|
14
|
+
</defs>
|
|
15
|
+
<g
|
|
16
|
+
fill="none"
|
|
17
|
+
fillRule="evenodd"
|
|
18
|
+
id="iconfont/search"
|
|
19
|
+
stroke="none"
|
|
20
|
+
strokeWidth="1"
|
|
21
|
+
>
|
|
22
|
+
<g id="Group-3-Copy" transform="translate(2, 2)">
|
|
23
|
+
<mask fill="white" id="mask-2">
|
|
24
|
+
<use xlinkHref="#path-1"></use>
|
|
25
|
+
</mask>
|
|
26
|
+
<g id="Clip-2"></g>
|
|
27
|
+
<path
|
|
28
|
+
d="M14.0345333,13.8617333 C14.0025333,13.8864 13.9718667,13.9137333 13.9432,13.9430667 C13.9138667,13.9724 13.8865333,14.0030667 13.8632,14.0350667 C12.6038667,15.2517333 10.8892,15.9997333 8.99986667,15.9997333 C5.13386667,15.9997333 1.99986667,12.8657333 1.99986667,8.99973333 C1.99986667,5.13373333 5.13386667,1.99973333 8.99986667,1.99973333 C12.8658667,1.99973333 15.9998667,5.13373333 15.9998667,8.99973333 C15.9998667,10.8890667 15.2512,12.6037333 14.0345333,13.8617333 M19.7072,18.2930667 L16.0318667,14.6177333 C17.2632,13.0784 17.9998667,11.1250667 17.9998667,8.99973333 C17.9998667,4.02973333 13.9705333,-0.000266666667 8.99986667,-0.000266666667 C4.0292,-0.000266666667 -0.000133333333,4.02973333 -0.000133333333,8.99973333 C-0.000133333333,13.9704 4.0292,17.9997333 8.99986667,17.9997333 C11.1252,17.9997333 13.0785333,17.2637333 14.6178667,16.0317333 L18.2932,19.7070667 C18.6832,20.0977333 19.3165333,20.0977333 19.7072,19.7070667 C20.0978667,19.3164 20.0978667,18.6837333 19.7072,18.2930667"
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
id="Fill-1"
|
|
31
|
+
mask="url(#mask-2)"
|
|
32
|
+
></path>
|
|
33
|
+
</g>
|
|
34
|
+
</g>
|
|
35
|
+
</svg>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default Search;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Search";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>iconfont/search</title>
|
|
4
|
+
<defs>
|
|
5
|
+
<polygon id="path-1" points="0 0 20 0 20 20 0 20"></polygon>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="iconfont/search" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
8
|
+
<g id="Group-3-Copy" transform="translate(2, 2)">
|
|
9
|
+
<mask id="mask-2" fill="white">
|
|
10
|
+
<use xlink:href="#path-1"></use>
|
|
11
|
+
</mask>
|
|
12
|
+
<g id="Clip-2"></g>
|
|
13
|
+
<path d="M14.0345333,13.8617333 C14.0025333,13.8864 13.9718667,13.9137333 13.9432,13.9430667 C13.9138667,13.9724 13.8865333,14.0030667 13.8632,14.0350667 C12.6038667,15.2517333 10.8892,15.9997333 8.99986667,15.9997333 C5.13386667,15.9997333 1.99986667,12.8657333 1.99986667,8.99973333 C1.99986667,5.13373333 5.13386667,1.99973333 8.99986667,1.99973333 C12.8658667,1.99973333 15.9998667,5.13373333 15.9998667,8.99973333 C15.9998667,10.8890667 15.2512,12.6037333 14.0345333,13.8617333 M19.7072,18.2930667 L16.0318667,14.6177333 C17.2632,13.0784 17.9998667,11.1250667 17.9998667,8.99973333 C17.9998667,4.02973333 13.9705333,-0.000266666667 8.99986667,-0.000266666667 C4.0292,-0.000266666667 -0.000133333333,4.02973333 -0.000133333333,8.99973333 C-0.000133333333,13.9704 4.0292,17.9997333 8.99986667,17.9997333 C11.1252,17.9997333 13.0785333,17.2637333 14.6178667,16.0317333 L18.2932,19.7070667 C18.6832,20.0977333 19.3165333,20.0977333 19.7072,19.7070667 C20.0978667,19.3164 20.0978667,18.6837333 19.7072,18.2930667" id="Fill-1" fill="#000000" mask="url(#mask-2)"></path>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|