Skip to content

Commit eb68791

Browse files
Update dist folder [skip ci] (#451)
1 parent df753dc commit eb68791

File tree

10 files changed

+96
-53
lines changed

10 files changed

+96
-53
lines changed

dist/samples/ui-kit-place-search-text/app/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
<gmp-place-list selectable style="display: none;"></gmp-place-list>
2525
</div>
2626
</div>
27-
<gmp-place-details size="large" style="display: none;"></gmp-place-details>
27+
<gmp-place-details style="display: none;">
28+
<gmp-place-details-place-request></gmp-place-details-place-request>
29+
<gmp-place-all-content></gmp-place-all-content>
30+
</gmp-place-details>
2831
</gmp-map>
2932
<!--[END maps_ui_kit_place_search_text_map] -->
3033
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
3134
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "alpha"});</script>
3235
</body>
3336
</html>
34-
<!--[END maps_ui_kit_place_search_text] -->
37+
<!--[END maps_ui_kit_place_search_text] -->

dist/samples/ui-kit-place-search-text/app/index.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ const placeDetails = document.querySelector("gmp-place-details") as any;
1111
let marker = document.querySelector('gmp-advanced-marker') as any;
1212
const textSearchInput = document.getElementById('textSearchInput') as any;
1313
const textSearchButton = document.getElementById('textSearchButton') as HTMLButtonElement;
14+
const placeDetailsRequest = document.querySelector('gmp-place-details-place-request') as any;
1415

1516
/* [END maps_ui_kit_place_search_text_query_selectors] */
1617
/* [START maps_ui_kit_place_search_text_init_map] */
1718
let markers = {};
1819
let infoWindow;
19-
let center = { lat: 37.395641, lng: -122.077627 };
20+
let center = { lat: 37.395641, lng: -122.077627 }; // Mountain View, CA.
2021
let bounds;
2122

2223
async function initMap(): Promise<void> {
@@ -32,21 +33,31 @@ async function initMap(): Promise<void> {
3233
infoWindow = new google.maps.InfoWindow;
3334

3435
// Center the map
35-
let adjustedCenter = offsetLatLngRight(center, -0.005);
36-
map.innerMap.panTo(adjustedCenter);
36+
map.innerMap.panTo(center);
3737
map.innerMap.setZoom(14);
3838

3939
map.innerMap.setOptions({
4040
mapTypeControl: false,
4141
clickableIcons: false,
4242
});
4343

44+
/* [START maps_ui_kit_place_search_tex_event_handlers] */
45+
// Fire when the Place Details Element is loaded.
46+
placeDetails.addEventListener('gmp-load', (event) => {
47+
// Center the info window on the map.
48+
map.innerMap.fitBounds(placeDetails.place.viewport, { top: 500, left: 400 });
49+
});
50+
51+
// Handle clicks on the search button.
4452
textSearchButton.addEventListener('click', searchByTextRequest);
53+
54+
// Handle enter key on text input.
4555
textSearchInput.addEventListener('keydown', (event) => {
4656
if (event.key === 'Enter') {
4757
searchByTextRequest();
4858
}
4959
});
60+
/* [END maps_ui_kit_place_search_tex_event_handlers] */
5061
}
5162
/* [END maps_ui_kit_place_search_text_init_map] */
5263

@@ -83,12 +94,14 @@ async function addMarkers(){
8394
markers[place.id] = marker;
8495
bounds.extend(place.location);
8596
marker.collisionBehavior = google.maps.CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL;
86-
97+
98+
/* [START maps_ui_kit_place_search_text_click_event] */
8799
marker.addListener('gmp-click',(event) => {
88100
if(infoWindow.isOpen){
89101
infoWindow.close();
90102
}
91-
placeDetails.configureFromPlace(place);
103+
// Set the Place Details request to the selected place.
104+
placeDetailsRequest.place = place.id;
92105
placeDetails.style.display = "block";
93106
placeDetails.style.width = "350px";
94107
infoWindow.setOptions({
@@ -103,18 +116,13 @@ async function addMarkers(){
103116
});
104117

105118
});
119+
/* [END maps_ui_kit_place_search_text_click_event] */
106120
map.innerMap.setCenter(bounds.getCenter());
107121
map.innerMap.fitBounds(bounds);
108122
});
109123
}
110124
}
111125
/* [END maps_ui_kit_place_search_text_add_markers] */
112126

113-
// Helper function to offset the map center.
114-
function offsetLatLngRight(latLng, longitudeOffset) {
115-
const newLng = latLng.lng + longitudeOffset;
116-
return new google.maps.LatLng(latLng.lat, newLng);
117-
}
118-
119127
initMap();
120128
/* [END maps_ui_kit_place_search_text] */

dist/samples/ui-kit-place-search-text/dist/assets/index-BGB3W2Xp.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

dist/samples/ui-kit-place-search-text/dist/assets/index-BwAaQEy9.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/samples/ui-kit-place-search-text/dist/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<head>
1010
<title>Place List Text Search with Google Maps</title>
1111
<meta charset="utf-8">
12-
<script type="module" crossorigin src="./assets/index-BGB3W2Xp.js"></script>
12+
<script type="module" crossorigin src="./assets/index-BwAaQEy9.js"></script>
1313
<link rel="stylesheet" crossorigin href="./assets/index-aU3Z-fv6.css">
1414
</head>
1515
<body>
@@ -24,11 +24,14 @@
2424
<gmp-place-list selectable style="display: none;"></gmp-place-list>
2525
</div>
2626
</div>
27-
<gmp-place-details size="large" style="display: none;"></gmp-place-details>
27+
<gmp-place-details style="display: none;">
28+
<gmp-place-details-place-request></gmp-place-details-place-request>
29+
<gmp-place-all-content></gmp-place-all-content>
30+
</gmp-place-details>
2831
</gmp-map>
2932
<!--[END maps_ui_kit_place_search_text_map] -->
3033
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
3134
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "alpha"});</script>
3235
</body>
3336
</html>
34-
<!--[END maps_ui_kit_place_search_text] -->
37+
<!--[END maps_ui_kit_place_search_text] -->

dist/samples/ui-kit-place-search-text/docs/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
<gmp-place-list selectable style="display: none;"></gmp-place-list>
2525
</div>
2626
</div>
27-
<gmp-place-details size="large" style="display: none;"></gmp-place-details>
27+
<gmp-place-details style="display: none;">
28+
<gmp-place-details-place-request></gmp-place-details-place-request>
29+
<gmp-place-all-content></gmp-place-all-content>
30+
</gmp-place-details>
2831
</gmp-map>
2932
<!--[END maps_ui_kit_place_search_text_map] -->
3033
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
3134
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "alpha"});</script>
3235
</body>
3336
</html>
34-
<!--[END maps_ui_kit_place_search_text] -->
37+
<!--[END maps_ui_kit_place_search_text] -->

dist/samples/ui-kit-place-search-text/docs/index.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ const placeDetails = document.querySelector("gmp-place-details");
1212
let marker = document.querySelector('gmp-advanced-marker');
1313
const textSearchInput = document.getElementById('textSearchInput');
1414
const textSearchButton = document.getElementById('textSearchButton');
15+
const placeDetailsRequest = document.querySelector('gmp-place-details-place-request');
1516
/* [END maps_ui_kit_place_search_text_query_selectors] */
1617
/* [START maps_ui_kit_place_search_text_init_map] */
1718
let markers = {};
1819
let infoWindow;
19-
let center = { lat: 37.395641, lng: -122.077627 };
20+
let center = { lat: 37.395641, lng: -122.077627 }; // Mountain View, CA.
2021
let bounds;
2122
async function initMap() {
2223
const { Map, InfoWindow } = await google.maps.importLibrary("maps");
@@ -25,19 +26,27 @@ async function initMap() {
2526
bounds = new google.maps.LatLngBounds({ lat: 37.37808200917261, lng: -122.13741583377849 }, { lat: 37.416676154341324, lng: -122.02261728794109 });
2627
infoWindow = new google.maps.InfoWindow;
2728
// Center the map
28-
let adjustedCenter = offsetLatLngRight(center, -0.005);
29-
map.innerMap.panTo(adjustedCenter);
29+
map.innerMap.panTo(center);
3030
map.innerMap.setZoom(14);
3131
map.innerMap.setOptions({
3232
mapTypeControl: false,
3333
clickableIcons: false,
3434
});
35+
/* [START maps_ui_kit_place_search_tex_event_handlers] */
36+
// Fire when the Place Details Element is loaded.
37+
placeDetails.addEventListener('gmp-load', (event) => {
38+
// Center the info window on the map.
39+
map.innerMap.fitBounds(placeDetails.place.viewport, { top: 500, left: 400 });
40+
});
41+
// Handle clicks on the search button.
3542
textSearchButton.addEventListener('click', searchByTextRequest);
43+
// Handle enter key on text input.
3644
textSearchInput.addEventListener('keydown', (event) => {
3745
if (event.key === 'Enter') {
3846
searchByTextRequest();
3947
}
4048
});
49+
/* [END maps_ui_kit_place_search_tex_event_handlers] */
4150
}
4251
/* [END maps_ui_kit_place_search_text_init_map] */
4352
/* [START maps_ui_kit_place_search_text_query] */
@@ -69,11 +78,13 @@ async function addMarkers() {
6978
markers[place.id] = marker;
7079
bounds.extend(place.location);
7180
marker.collisionBehavior = google.maps.CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL;
81+
/* [START maps_ui_kit_place_search_text_click_event] */
7282
marker.addListener('gmp-click', (event) => {
7383
if (infoWindow.isOpen) {
7484
infoWindow.close();
7585
}
76-
placeDetails.configureFromPlace(place);
86+
// Set the Place Details request to the selected place.
87+
placeDetailsRequest.place = place.id;
7788
placeDetails.style.display = "block";
7889
placeDetails.style.width = "350px";
7990
infoWindow.setOptions({
@@ -87,16 +98,12 @@ async function addMarkers() {
8798
map.innerMap.fitBounds(place.viewport, { top: 400, left: 400 });
8899
});
89100
});
101+
/* [END maps_ui_kit_place_search_text_click_event] */
90102
map.innerMap.setCenter(bounds.getCenter());
91103
map.innerMap.fitBounds(bounds);
92104
});
93105
}
94106
}
95107
/* [END maps_ui_kit_place_search_text_add_markers] */
96-
// Helper function to offset the map center.
97-
function offsetLatLngRight(latLng, longitudeOffset) {
98-
const newLng = latLng.lng + longitudeOffset;
99-
return new google.maps.LatLng(latLng.lat, newLng);
100-
}
101108
initMap();
102109
/* [END maps_ui_kit_place_search_text] */

dist/samples/ui-kit-place-search-text/docs/index.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ const placeDetails = document.querySelector("gmp-place-details") as any;
1111
let marker = document.querySelector('gmp-advanced-marker') as any;
1212
const textSearchInput = document.getElementById('textSearchInput') as any;
1313
const textSearchButton = document.getElementById('textSearchButton') as HTMLButtonElement;
14+
const placeDetailsRequest = document.querySelector('gmp-place-details-place-request') as any;
1415

1516
/* [END maps_ui_kit_place_search_text_query_selectors] */
1617
/* [START maps_ui_kit_place_search_text_init_map] */
1718
let markers = {};
1819
let infoWindow;
19-
let center = { lat: 37.395641, lng: -122.077627 };
20+
let center = { lat: 37.395641, lng: -122.077627 }; // Mountain View, CA.
2021
let bounds;
2122

2223
async function initMap(): Promise<void> {
@@ -32,21 +33,31 @@ async function initMap(): Promise<void> {
3233
infoWindow = new google.maps.InfoWindow;
3334

3435
// Center the map
35-
let adjustedCenter = offsetLatLngRight(center, -0.005);
36-
map.innerMap.panTo(adjustedCenter);
36+
map.innerMap.panTo(center);
3737
map.innerMap.setZoom(14);
3838

3939
map.innerMap.setOptions({
4040
mapTypeControl: false,
4141
clickableIcons: false,
4242
});
4343

44+
/* [START maps_ui_kit_place_search_tex_event_handlers] */
45+
// Fire when the Place Details Element is loaded.
46+
placeDetails.addEventListener('gmp-load', (event) => {
47+
// Center the info window on the map.
48+
map.innerMap.fitBounds(placeDetails.place.viewport, { top: 500, left: 400 });
49+
});
50+
51+
// Handle clicks on the search button.
4452
textSearchButton.addEventListener('click', searchByTextRequest);
53+
54+
// Handle enter key on text input.
4555
textSearchInput.addEventListener('keydown', (event) => {
4656
if (event.key === 'Enter') {
4757
searchByTextRequest();
4858
}
4959
});
60+
/* [END maps_ui_kit_place_search_tex_event_handlers] */
5061
}
5162
/* [END maps_ui_kit_place_search_text_init_map] */
5263

@@ -83,12 +94,14 @@ async function addMarkers(){
8394
markers[place.id] = marker;
8495
bounds.extend(place.location);
8596
marker.collisionBehavior = google.maps.CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL;
86-
97+
98+
/* [START maps_ui_kit_place_search_text_click_event] */
8799
marker.addListener('gmp-click',(event) => {
88100
if(infoWindow.isOpen){
89101
infoWindow.close();
90102
}
91-
placeDetails.configureFromPlace(place);
103+
// Set the Place Details request to the selected place.
104+
placeDetailsRequest.place = place.id;
92105
placeDetails.style.display = "block";
93106
placeDetails.style.width = "350px";
94107
infoWindow.setOptions({
@@ -103,18 +116,13 @@ async function addMarkers(){
103116
});
104117

105118
});
119+
/* [END maps_ui_kit_place_search_text_click_event] */
106120
map.innerMap.setCenter(bounds.getCenter());
107121
map.innerMap.fitBounds(bounds);
108122
});
109123
}
110124
}
111125
/* [END maps_ui_kit_place_search_text_add_markers] */
112126

113-
// Helper function to offset the map center.
114-
function offsetLatLngRight(latLng, longitudeOffset) {
115-
const newLng = latLng.lng + longitudeOffset;
116-
return new google.maps.LatLng(latLng.lat, newLng);
117-
}
118-
119127
initMap();
120128
/* [END maps_ui_kit_place_search_text] */

0 commit comments

Comments
 (0)