Skip to content

Commit 4c9ab4b

Browse files
author
Alfiya Tarasenko
committed
Release 3.1.0
1 parent debe54d commit 4c9ab4b

24 files changed

Lines changed: 10328 additions & 7916 deletions

BUILD.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Use this guide to set up a local workstation and verify changes before publishin
55

66
## 1. Prerequisites
77

8-
- Node.js 18+ and npm 10+
8+
- Node.js 20.19+ or 22.12+ and npm 10+
99
- For the documentation site: Python 3.9+ with `pip`
1010

1111
## 2. Install Dependencies
@@ -14,7 +14,7 @@ Use this guide to set up a local workstation and verify changes before publishin
1414
npm install
1515
```
1616

17-
This installs all workspace packages, including the demo app dependencies.
17+
This installs the library dependencies. The demo app has its own dependency tree under `example/`.
1818

1919
## 3. Build the Library
2020

@@ -28,8 +28,10 @@ npm run build
2828

2929
## 4. Run Quality Gates
3030

31-
- **Unit tests:** `npm run test`
32-
- **Linting:** `npm run lint`
31+
- **Complete test pipeline:** `npm test`
32+
- **Unit tests only:** `npm run test:unit`
33+
- **Linting only:** `npm run test:lint`
34+
- **Build only:** `npm run build`
3335

3436
These should be clean before submitting changes or publishing.
3537

@@ -50,7 +52,7 @@ The demo showcases three interactive examples:
5052
npm install
5153
npm start # serves the demo on http://localhost:3000
5254
```
53-
3. The demo watches both the library and app; rebuilding the library will refresh the demo automatically.
55+
3. The demo links to the library in the parent directory. After changing the library source, run `npm run build` from the repository root; Vite will then reload the linked output.
5456

5557
## 6. Preview / Build the Documentation Site
5658

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Geoapify GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ It provides an easy-to-use React wrapper for the [Geoapify Geocoding Autocomplet
2525
* Customizable design: easily style or theme your component.
2626
* Accessible with keyboard navigation and ARIA support.
2727
* Rich results including coordinates, structured address, and metadata.
28-
* Compatible with React 18–19.
28+
* Compatible with React 19.
2929

3030
## Quick Start
3131

@@ -69,7 +69,7 @@ Wrap your component with the `GeoapifyContext` and provide your API key:
6969
</GeoapifyContext>
7070
```
7171

72-
Tip: Store your API key in an environment variable and reference it as `process.env.REACT_APP_GEOAPIFY_KEY` for better maintainability.
72+
Tip: Store your API key in your framework's client-side environment configuration (for example, `import.meta.env.VITE_GEOAPIFY_KEY` in Vite). Client-side API keys are visible in the browser, so configure suitable key restrictions in your Geoapify project.
7373

7474
### 4. Use the component
7575

@@ -110,7 +110,7 @@ const onSuggestionsChange = (list) => {
110110
| 1.2.x – 1.3.x | >= 17.0.0 |
111111
| 1.4.x – 1.5.x | >= 18.0.0 |
112112
| 2.0.x – 2.2.x | >= 18.0.0, <= 19.x.x |
113-
| 3.0.x | >= 19.0.0, <= 19.x.x |
113+
| 3.0.x – 3.1.x | >= 19.0.0, <= 19.x.x |
114114

115115
> If you prefer to use the library directly without React bindings, check the **[Standalone Usage](https://geoapify.github.io/react-geocoder-autocomplete/standalone-usage/)** section.
116116
@@ -133,7 +133,7 @@ The component includes many options for configuration and customization. Below a
133133
| Property | Direction | Description |
134134
| --------------------- | --------- | --------------------------------------------------------------------------------- |
135135
| `placeholder` | Prop | Sets the placeholder text for the input field. |
136-
| `type` | Prop | Defines the type of location to search for — e.g. `city`, `street`, or `amenity`. |
136+
| `type` | Prop | Defines the type of location to search for — e.g. `city`, `locality`, `street`, or `amenity`. |
137137
| `lang` | Prop | Sets the language of suggestions and results. |
138138
| `limit` | Prop | Limits the number of suggestions displayed. |
139139
| `debounceDelay` | Prop | Adds a short delay before sending requests, improving performance. |
@@ -279,7 +279,9 @@ Adds boundary or geometry data (where available) to the selected feature.
279279
<GeoapifyGeocoderAutocomplete
280280
addCategorySearch={true}
281281
showPlacesByCategoryList={true}
282-
placesByCategoryFilter={{ categories: ['cafe', 'restaurant'] }}
282+
placesByCategoryFilter={{
283+
circle: { lon: 13.405, lat: 52.52, radiusMeters: 5000 }
284+
}}
283285
onPlaceByCategorySelect={onPoiSelected}
284286
/>
285287
</GeoapifyContext>
@@ -291,7 +293,7 @@ const onPoiSelected = ({ place, index }) => {
291293
};
292294
```
293295

294-
Enables category-based search for nearby Points of Interest (POIs) below the input field, filtered by category.
296+
Enables category-based search and displays nearby Points of Interest (POIs) below the input. The circle filter restricts results to five kilometers around central Berlin.
295297

296298
**Used properties:**
297299
`addCategorySearch`, `showPlacesByCategoryList`, `placesByCategoryFilter`, `onPlaceByCategorySelect`
@@ -345,7 +347,7 @@ const onClear = (item) => {
345347
```tsx
346348
<GeoapifyContext apiKey="YOUR_API_KEY">
347349
<GeoapifyGeocoderAutocomplete
348-
filterByCountryCode={['DE']}
350+
filterByCountryCode={['de']}
349351
biasByProximity={{ lon: 13.405, lat: 52.52 }}
350352
addDetails={true}
351353
placeSelect={onPlaceSelected}

docs-site/docs/api-reference.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The React Geocoder Autocomplete component exposes several **props** and **callba
88
| ----------------------------- | ---------------------------------------------------- | --------- | ---------------------------------------------------------------- |
99
| `value` | `string` | Prop | Current value of the input field. |
1010
| `placeholder` | `string` | Prop | Text shown when the input is empty. |
11-
| `type` | `LocationType` | Prop | Type of place to search for (`country`, `city`, `street`, etc.). |
11+
| `type` | `LocationType` | Prop | Type of place to search for (`country`, `state`, `city`, `locality`, `postcode`, `street`, or `amenity`). |
1212
| `lang` | `SupportedLanguage` | Prop | Language of suggestions and results. |
1313
| `limit` | `number` | Prop | Max number of suggestions to show. |
1414
| `debounceDelay` | `number` | Prop | Delay (ms) before sending requests after typing. |
@@ -20,6 +20,8 @@ The React Geocoder Autocomplete component exposes several **props** and **callba
2020
| `biasByCountryCode` | `ByCountryCodeOptions` | Prop | Prioritize results from certain countries. |
2121
| `biasByCircle` | `ByCircleOptions` | Prop | Bias results within a circle. |
2222
| `biasByRect` | `ByRectOptions` | Prop | Bias results within a rectangle. |
23+
| `position` | `GeoPosition` | Prop | Deprecated alias for `biasByProximity`. |
24+
| `countryCodes` | `CountyCode[]` | Prop | Deprecated alias for `filterByCountryCode`. |
2325
| `skipIcons` | `boolean` | Prop | Hide icons in the suggestions list. |
2426
| `addDetails` | `boolean` | Prop | Include detailed place info in results. |
2527
| `allowNonVerifiedHouseNumber` | `boolean` | Prop | Allow house numbers not verified in data. |
@@ -30,8 +32,8 @@ The React Geocoder Autocomplete component exposes several **props** and **callba
3032
| `hidePlacesByCategoryListAfterSelect` | `boolean` | Prop | Hide POI list after selection. |
3133
| `enablePlacesByCategoryLazyLoading` | `boolean` | Prop | Load additional POI items dynamically. |
3234
| `placesByCategoryLimit` | `number` | Prop | Max number of POIs to display. |
33-
| `placesByCategoryFilter` | `object` | Prop | Filters for category-based search. |
34-
| `placesByCategoryBias` | `object` | Prop | Bias rules for category-based search. |
35+
| `placesByCategoryFilter` | `Record<string, ByCircleOptions \| ByRectOptions \| string>` | Prop | Geographic filters for category-based search. |
36+
| `placesByCategoryBias` | `Record<string, ByCircleOptions \| ByRectOptions \| ByProximityOptions>` | Prop | Geographic bias rules for category-based search. |
3537
| `preprocessHook` | `(value: string) => string` | Prop | Modify input before request. |
3638
| `postprocessHook` | `(feature: any) => string` | Prop | Modify selected result before display. |
3739
| `suggestionsFilter` | `(features: any[]) => any[]` | Prop | Filter suggestions before display. |
@@ -98,7 +100,7 @@ const placeholderText = 'Search for a location';
98100
### `type` (Prop)
99101

100102
**Type:** `LocationType`
101-
**Description:** Defines the type of place to search for — such as `'country'`, `'city'`, `'postcode'`, `'street'`, or `'amenity'`.
103+
**Description:** Defines the type of place to search for: `'country'`, `'state'`, `'city'`, `'locality'`, `'postcode'`, `'street'`, or `'amenity'`.
102104

103105
**Example:**
104106

@@ -181,7 +183,7 @@ const debounceTime = 400;
181183
```
182184

183185
```jsx
184-
const allowedCountries = ['US', 'CA']; // Only show addresses in the US and Canada
186+
const allowedCountries = ['us', 'ca']; // Only show addresses in the US and Canada
185187
```
186188

187189

@@ -279,7 +281,7 @@ const userLocation = { lon: -73.935242, lat: 40.73061 };
279281
```
280282

281283
```jsx
282-
const preferredCountries = ['US'];
284+
const preferredCountries = ['us'];
283285
```
284286

285287

@@ -327,6 +329,26 @@ const preferredRegion = {
327329
};
328330
```
329331

332+
### `position` (Deprecated Prop)
333+
334+
**Type:** `GeoPosition`
335+
**Description:** Deprecated alias for `biasByProximity`. Use `biasByProximity` in new code.
336+
337+
```jsx
338+
<GeoapifyGeocoderAutocomplete
339+
biasByProximity={{ lon: -73.935242, lat: 40.73061 }}
340+
/>
341+
```
342+
343+
### `countryCodes` (Deprecated Prop)
344+
345+
**Type:** `CountyCode[]`
346+
**Description:** Deprecated alias for `filterByCountryCode`. Use `filterByCountryCode` in new code.
347+
348+
```jsx
349+
<GeoapifyGeocoderAutocomplete filterByCountryCode={['us', 'ca']} />
350+
```
351+
330352
### `skipIcons` (Prop)
331353

332354
**Type:** `boolean`
@@ -483,8 +505,8 @@ const maxPlaces = 10;
483505

484506
### `placesByCategoryFilter` (Prop)
485507

486-
**Type:** `object`
487-
**Description:** Defines filters for category-based searches, such as location or category constraints.
508+
**Type:** `Record<string, ByCircleOptions | ByRectOptions | string>`
509+
**Description:** Defines geographic filters for category-based searches. Supported keys are `circle`, `rect`, `place`, and `geometry`.
488510

489511
**Example:**
490512

@@ -499,13 +521,13 @@ const maxPlaces = 10;
499521

500522
```jsx
501523
const placesByCategoryFilter = {
502-
filter: { circle: { lon: -73.935242, lat: 40.73061, radiusMeters: 5000 } }
524+
circle: { lon: -73.935242, lat: 40.73061, radiusMeters: 5000 }
503525
};
504526
```
505527

506528
### `placesByCategoryBias` (Prop)
507529

508-
**Type:** `object`
530+
**Type:** `Record<string, ByCircleOptions | ByRectOptions | ByProximityOptions>`
509531
**Description:** Adds bias rules for category-based search, prioritizing results in certain areas.
510532

511533
**Example:**
@@ -521,7 +543,7 @@ const placesByCategoryFilter = {
521543

522544
```jsx
523545
const placesByCategoryBias = {
524-
bias: { proximity: { lon: -73.935242, lat: 40.73061 } }
546+
proximity: { lon: -73.935242, lat: 40.73061 }
525547
};
526548
```
527549

docs-site/docs/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ It's designed to offer a fast, accessible, and customizable autocomplete experie
2727

2828
* **Rich structured output** – Emits detailed selection events containing coordinates, formatted addresses, and Geoapify metadata that can be directly used in your app logic.
2929

30-
* **React compatibility**Works with React 18 and newer versions. The recommended setup is **React 18+** for the best performance and API alignment.
30+
* **React compatibility**Version 3.x supports React 19. See the compatibility table in the project README when using an earlier React release.
3131

3232
## Learn More
3333

@@ -38,4 +38,3 @@ It's designed to offer a fast, accessible, and customizable autocomplete experie
3838
- [Geoapify Geocoding API documentation](https://apidocs.geoapify.com/docs/geocoding/)
3939
- [GitHub repository](https://github.com/geoapify/react-geocoder-autocomplete)
4040
- [Geoapify Developer Portal](https://www.geoapify.com/)
41-

docs-site/docs/quick-start.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ To use the component, you need a **Geoapify API key**.
2121
1. Sign up at [myprojects.geoapify.com](https://myprojects.geoapify.com/) and create a project.
2222
2. Copy your API key from the project dashboard.
2323
3. Start with the **Free plan** (5 requests/sec) and upgrade as needed.
24-
4. Store the key securely — for example, in an `.env` file:
24+
4. Store the key in your framework's client-side environment configuration. For example, with Vite:
2525

2626
```bash
27-
REACT_APP_GEOAPIFY_KEY=YOUR_API_KEY
27+
VITE_GEOAPIFY_KEY=YOUR_API_KEY
2828
```
2929

30+
```jsx
31+
const apiKey = import.meta.env.VITE_GEOAPIFY_KEY;
32+
```
33+
34+
Client-side API keys are visible in the browser, so configure suitable key restrictions in your Geoapify project.
35+
3036
## Integrating the Component into Your React Project
3137

3238
### 1. Importing Styles
@@ -142,4 +148,3 @@ Now that you've added the component and verified it works, you can:
142148
* [Geocoding API](https://apidocs.geoapify.com/docs/geocoding)
143149
* [Places API](https://apidocs.geoapify.com/docs/places)
144150
* [Geoapify Playground](https://apidocs.geoapify.com/playground/geocoding)
145-

example/README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
This example was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1+
# React Geocoder Autocomplete Example
22

3-
It is linked to the react-geocoder-autocomplete package in the parent directory for development purposes.
3+
This Vite application demonstrates the local `@geoapify/react-geocoder-autocomplete` package from the parent directory.
44

5-
You can run `npm install` and then `npm start` to test your package.
5+
## Run locally
6+
7+
1. Replace the demo key in `src/config.js` with your Geoapify API key.
8+
2. Install and start the example:
9+
10+
```bash
11+
npm install
12+
npm start
13+
```
14+
15+
3. Open [http://localhost:3000](http://localhost:3000).
16+
17+
The example links React, React DOM, and the component library from the repository root. After changing the library source, rebuild it from the root:
18+
19+
```bash
20+
npm run build
21+
```
22+
23+
## Production build
24+
25+
```bash
26+
npm run build
27+
npm run preview
28+
```

example/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<body>
1515
<noscript>You need to enable JavaScript to run this app.</noscript>
1616
<div id="root"></div>
17-
<script type="module" src="/src/index.js"></script>
17+
<script type="module" src="/src/index.jsx"></script>
1818
</body>
1919
</html>
20-

0 commit comments

Comments
 (0)