Skip to content

Commit 730a368

Browse files
committed
fix css
1 parent 1350a83 commit 730a368

File tree

5 files changed

+60
-56
lines changed

5 files changed

+60
-56
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#Goong Geocoder
2-
---
3-
4-
A geocoder control for [goong-js](https://docs.goong.io/docs/api) using the [Goong Places API](https://docs.goong.io/docs/rest/place/).
1+
# Goong Geocoder
52

3+
A geocoder control for [goong-js](https://docs.goong.io/docs/javascript) using the [Goong Places API](https://docs.goong.io/docs/rest/place/).
64

75
**If you are supporting older browsers, you will need a Promise polyfill.**
86
[es6-promise](https://github.com/stefanpenner/es6-promise) is a good one, if you're uncertain.
@@ -20,9 +18,12 @@ var GoongGeocoder = require('@goongmaps/goong-geocoder');
2018
<script src='https://cdn.jsdelivr.net/npm/@goongmaps/goong-geocoder/dist/goong-geocoder.min.js'></script>
2119
<link href="https://cdn.jsdelivr.net/npm/@goongmaps/goong-geocoder/dist/goong-geocoder.css" rel="stylesheet" type="text/css"/>
2220
```
23-
### Using without a Map
21+
### Examples
22+
#### Using within Map
23+
https://docs.goong.io/docs/example/add-a-geocoder/
24+
#### Using without a Map
2425
It is possible to use the plugin without it being placed as a control on a goong-js map.
25-
26+
https://docs.goong.io/docs/example/goong-geocoder-without-map/
2627
### Deeper dive
2728

2829
#### API Documentation

lib/goong-geocoder.css

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
/* Basics */
3-
.goongjs-ctrl-geocoder,
4-
.goongjs-ctrl-geocoder *,
5-
.goongjs-ctrl-geocoder *:after,
6-
.goongjs-ctrl-geocoder *:before {
3+
.mapboxgl-ctrl-geocoder,
4+
.mapboxgl-ctrl-geocoder *,
5+
.mapboxgl-ctrl-geocoder *:after,
6+
.mapboxgl-ctrl-geocoder *:before {
77
box-sizing: border-box;
88
}
99

10-
.goongjs-ctrl-geocoder {
10+
.mapboxgl-ctrl-geocoder {
1111
font-size: 18px;
1212
line-height: 24px;
1313
font-family: "Open Sans", "Helvetica Neue", Arial, Helvetica, sans-serif;
@@ -20,7 +20,7 @@
2020
transition: width .25s, min-width .25s;
2121
}
2222

23-
.goongjs-ctrl-geocoder--input {
23+
.mapboxgl-ctrl-geocoder--input {
2424
font: inherit;
2525
width: 100%;
2626
border: 0;
@@ -35,40 +35,40 @@
3535
overflow: hidden;
3636
}
3737

38-
.goongjs-ctrl-geocoder--input::-ms-clear {
38+
.mapboxgl-ctrl-geocoder--input::-ms-clear {
3939
display: none; /* hide input clear button in IE */
4040
}
4141

42-
.goongjs-ctrl-geocoder--input:focus {
42+
.mapboxgl-ctrl-geocoder--input:focus {
4343
color: #404040; /* fallback */
4444
color: rgba(0, 0, 0, 0.75);
4545
outline: 0;
4646
box-shadow: none;
4747
outline: thin dotted\8;
4848
}
4949

50-
.goongjs-ctrl-geocoder .goongjs-ctrl-geocoder--pin-right > * {
50+
.mapboxgl-ctrl-geocoder .mapboxgl-ctrl-geocoder--pin-right > * {
5151
z-index: 2;
5252
position: absolute;
5353
right: 8px;
5454
top: 7px;
5555
display: none;
5656
}
5757

58-
.goongjs-ctrl-geocoder,
59-
.goongjs-ctrl-geocoder .suggestions {
58+
.mapboxgl-ctrl-geocoder,
59+
.mapboxgl-ctrl-geocoder .suggestions {
6060
box-shadow: 0 0 10px 2px rgba(0,0,0,.1);
6161
}
6262

6363
/* Collapsed */
64-
.goongjs-ctrl-geocoder.goongjs-ctrl-geocoder--collapsed {
64+
.mapboxgl-ctrl-geocoder.mapboxgl-ctrl-geocoder--collapsed {
6565
width: 50px;
6666
min-width: 50px;
6767
transition: width .25s, min-width .25s;
6868
}
6969

7070
/* Suggestions */
71-
.goongjs-ctrl-geocoder .suggestions {
71+
.mapboxgl-ctrl-geocoder .suggestions {
7272
background-color: #fff;
7373
border-radius: 4px;
7474
left: 0;
@@ -84,56 +84,56 @@
8484
font-size: 15px;
8585
}
8686

87-
.goongjs-ctrl-bottom-left .suggestions,
88-
.goongjs-ctrl-bottom-right .suggestions {
87+
.mapboxgl-ctrl-bottom-left .suggestions,
88+
.mapboxgl-ctrl-bottom-right .suggestions {
8989
top: auto;
9090
bottom: 100%;
9191
}
9292

93-
.goongjs-ctrl-geocoder .suggestions > li > a {
93+
.mapboxgl-ctrl-geocoder .suggestions > li > a {
9494
cursor: default;
9595
display: block;
9696
padding: 6px 12px;
9797
color: #404040;
9898
}
9999

100-
.goongjs-ctrl-geocoder .suggestions > .active > a,
101-
.goongjs-ctrl-geocoder .suggestions > li > a:hover {
100+
.mapboxgl-ctrl-geocoder .suggestions > .active > a,
101+
.mapboxgl-ctrl-geocoder .suggestions > li > a:hover {
102102
color: #404040;
103103
background-color: #f3f3f3;
104104
text-decoration: none;
105105
cursor: pointer;
106106
}
107107

108-
.goongjs-ctrl-geocoder--suggestion-title {
108+
.mapboxgl-ctrl-geocoder--suggestion-title {
109109
font-weight: bold;
110110
}
111111

112-
.goongjs-ctrl-geocoder--suggestion-title,
113-
.goongjs-ctrl-geocoder--suggestion-address {
112+
.mapboxgl-ctrl-geocoder--suggestion-title,
113+
.mapboxgl-ctrl-geocoder--suggestion-address {
114114
text-overflow: ellipsis;
115115
overflow: hidden;
116116
white-space: nowrap;
117117
}
118118

119119
/* Icons */
120-
.goongjs-ctrl-geocoder--icon {
120+
.mapboxgl-ctrl-geocoder--icon {
121121
display: inline-block;
122122
vertical-align: middle;
123123
speak: none;
124124
fill: #757575;
125125
top: 15px;
126126
}
127127

128-
.goongjs-ctrl-geocoder--icon-search {
128+
.mapboxgl-ctrl-geocoder--icon-search {
129129
position: absolute;
130130
top: 13px;
131131
left: 12px;
132132
width: 23px;
133133
height: 23px;
134134
}
135135

136-
.goongjs-ctrl-geocoder--button {
136+
.mapboxgl-ctrl-geocoder--button {
137137
padding: 0;
138138
margin: 0;
139139
border: none;
@@ -142,18 +142,18 @@
142142
line-height: 1;
143143
}
144144

145-
.goongjs-ctrl-geocoder--icon-close {
145+
.mapboxgl-ctrl-geocoder--icon-close {
146146
width: 20px;
147147
height: 20px;
148148
margin-top: 8px;
149149
margin-right: 3px;
150150
}
151151

152-
.goongjs-ctrl-geocoder--button:hover .goongjs-ctrl-geocoder--icon-close {
152+
.mapboxgl-ctrl-geocoder--button:hover .mapboxgl-ctrl-geocoder--icon-close {
153153
fill: #909090;
154154
}
155155

156-
.goongjs-ctrl-geocoder--icon-loading {
156+
.mapboxgl-ctrl-geocoder--icon-loading {
157157
width: 26px;
158158
height: 26px;
159159
margin-top: 5px;
@@ -189,44 +189,44 @@
189189
/* Media queries*/
190190
@media screen and (min-width: 640px) {
191191

192-
.goongjs-ctrl-geocoder.goongjs-ctrl-geocoder--collapsed {
192+
.mapboxgl-ctrl-geocoder.mapboxgl-ctrl-geocoder--collapsed {
193193
width: 36px;
194194
min-width: 36px;
195195
}
196196

197-
.goongjs-ctrl-geocoder {
197+
.mapboxgl-ctrl-geocoder {
198198
width: 33.3333%;
199199
font-size: 15px;
200200
line-height: 20px;
201201
max-width: 360px;
202202
}
203-
.goongjs-ctrl-geocoder .suggestions {
203+
.mapboxgl-ctrl-geocoder .suggestions {
204204
font-size: 13px;
205205
}
206206

207-
.goongjs-ctrl-geocoder--icon {
207+
.mapboxgl-ctrl-geocoder--icon {
208208
top: 8px;
209209
}
210210

211-
.goongjs-ctrl-geocoder--icon-close {
211+
.mapboxgl-ctrl-geocoder--icon-close {
212212
width: 16px;
213213
height: 16px;
214214
margin-top: 3px;
215215
margin-right: 0;
216216
}
217217

218-
.goongjs-ctrl-geocoder--icon-search {
218+
.mapboxgl-ctrl-geocoder--icon-search {
219219
left: 7px;
220220
width: 20px;
221221
height: 20px;
222222
}
223223

224-
.goongjs-ctrl-geocoder--input {
224+
.mapboxgl-ctrl-geocoder--input {
225225
height: 36px;
226226
padding: 6px 35px;
227227
}
228228

229-
.goongjs-ctrl-geocoder--icon-loading {
229+
.mapboxgl-ctrl-geocoder--icon-loading {
230230
width: 26px;
231231
height: 26px;
232232
margin-top: -2px;

lib/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ GoongGeocoder.prototype = {
7272
},
7373
render: function render(item) {
7474
var placeName = item.structured_formatting;
75-
return '<div class="goongjs-ctrl-geocoder--suggestion"><div class="goongjs-ctrl-geocoder--suggestion-title">' + placeName.main_text + '</div><div class="goongjs-ctrl-geocoder--suggestion-address">' + placeName.secondary_text + '</div></div>';
75+
return '<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">' + placeName.main_text + '</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">' + placeName.secondary_text + '</div></div>';
7676
}
7777
},
7878
request: null,
@@ -144,11 +144,11 @@ GoongGeocoder.prototype = {
144144
this._clear = this._clear.bind(this);
145145
this._clearOnBlur = this._clearOnBlur.bind(this);
146146
var el = this.container = document.createElement('div');
147-
el.className = 'goongjs-ctrl-geocoder goongjs-ctrl';
147+
el.className = 'mapboxgl-ctrl-geocoder mapboxgl-ctrl';
148148
var searchIcon = this.createIcon('search', '<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');
149149
this._inputEl = document.createElement('input');
150150
this._inputEl.type = 'text';
151-
this._inputEl.className = 'goongjs-ctrl-geocoder--input';
151+
this._inputEl.className = 'mapboxgl-ctrl-geocoder--input';
152152
this.setPlaceholder();
153153

154154
if (this.options.collapsed) {
@@ -177,14 +177,14 @@ GoongGeocoder.prototype = {
177177
}.bind(this));
178178

179179
var actions = document.createElement('div');
180-
actions.classList.add('goongjs-ctrl-geocoder--pin-right');
180+
actions.classList.add('mapboxgl-ctrl-geocoder--pin-right');
181181
this._clearEl = document.createElement('button');
182182

183183
this._clearEl.setAttribute('aria-label', 'Clear');
184184

185185
this._clearEl.addEventListener('click', this.clear);
186186

187-
this._clearEl.className = 'goongjs-ctrl-geocoder--button';
187+
this._clearEl.className = 'mapboxgl-ctrl-geocoder--button';
188188
var buttonIcon = this.createIcon('close', '<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');
189189

190190
this._clearEl.appendChild(buttonIcon);
@@ -225,7 +225,7 @@ GoongGeocoder.prototype = {
225225
},
226226
createIcon: function (name, path) {
227227
var icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
228-
icon.setAttribute('class', 'goongjs-ctrl-geocoder--icon goongjs-ctrl-geocoder--icon-' + name);
228+
icon.setAttribute('class', 'mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-' + name);
229229
icon.setAttribute('viewBox', '0 0 18 18');
230230
icon.setAttribute('xml:space', 'preserve');
231231
icon.setAttribute('width', 18);
@@ -479,10 +479,10 @@ GoongGeocoder.prototype = {
479479
},
480480
_collapse: function () {
481481
// do not collapse if input is in focus
482-
if (!this._inputEl.value && this._inputEl !== document.activeElement) this.container.classList.add('goongjs-ctrl-geocoder--collapsed');
482+
if (!this._inputEl.value && this._inputEl !== document.activeElement) this.container.classList.add('mapboxgl-ctrl-geocoder--collapsed');
483483
},
484484
_unCollapse: function () {
485-
this.container.classList.remove('goongjs-ctrl-geocoder--collapsed');
485+
this.container.classList.remove('mapboxgl-ctrl-geocoder--collapsed');
486486
},
487487

488488
/**
@@ -501,7 +501,7 @@ GoongGeocoder.prototype = {
501501
this._renderMessage(errorMessage);
502502
},
503503
_renderNoResults: function () {
504-
var errorMessage = "<div class='goong-js-geocoder--error goongjs-gl-geocoder--no-results'>No results found</div>";
504+
var errorMessage = "<div class='goong-js-geocoder--error mapboxgl-gl-geocoder--no-results'>No results found</div>";
505505

506506
this._renderMessage(errorMessage);
507507
},
@@ -548,9 +548,9 @@ GoongGeocoder.prototype = {
548548
* Get input
549549
* @returns current input
550550
*/
551-
getInput: function() {
551+
getInput: function() {
552552
return this._inputEl.value;
553-
},
553+
},
554554
/**
555555
* Set proximity
556556
* @param {Object} proximity The new `options.proximity` value. This is a geographical point given as an object with `latitude` and `longitude` properties.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@goongmaps/goong-geocoder",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A geocoder control for Goong JS",
55
"main": "lib/index.js",
66
"unpkg": "dist/goong-geocoder.min.js",
@@ -20,6 +20,9 @@
2020
"node": ">=6"
2121
},
2222
"keywords": [
23+
"geocoding",
24+
"autocomplete-search",
25+
"goong-io",
2326
"goong",
2427
"geocoder",
2528
"osm",

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,9 +1898,9 @@ camelcase@^5.0.0:
18981898
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
18991899

19001900
caniuse-lite@^1.0.30001035:
1901-
version "1.0.30001035"
1902-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001035.tgz#2bb53b8aa4716b2ed08e088d4dc816a5fe089a1e"
1903-
integrity sha512-C1ZxgkuA4/bUEdMbU5WrGY4+UhMFFiXrgNAfxiMIqWgFTWfv/xsZCS2xEHT2LMq7xAZfuAnu6mcqyDl0ZR6wLQ==
1901+
version "1.0.30001232"
1902+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001232.tgz"
1903+
integrity sha512-e4Gyp7P8vqC2qV2iHA+cJNf/yqUKOShXQOJHQt81OHxlIZl/j/j3soEA0adAQi8CPUQgvOdDENyQ5kd6a6mNSg==
19041904

19051905
caseless@~0.12.0:
19061906
version "0.12.0"

0 commit comments

Comments
 (0)