@cosmkiwi/nz-address-elements 0.1.0 → 0.1.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.
- package/README.md +54 -0
- package/package.json +6 -1
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @cosmkiwi/nz-address-elements
|
|
2
|
+
|
|
3
|
+
Zero-dependency vanilla Web Component (`<nz-address-search>`) for New Zealand address autocomplete — works in **React, Vue, Angular, Astro, and plain HTML**. Powered by [`@cosmkiwi/nz-address`](https://www.npmjs.com/package/@cosmkiwi/nz-address) (2.43M+ LINZ addresses, zero API keys).
|
|
4
|
+
|
|
5
|
+
* **Live demo:** https://cosm.kiwi/nz-address/
|
|
6
|
+
* **GitHub:** https://github.com/CosmKiwi/nz-address
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @cosmkiwi/nz-address-elements
|
|
12
|
+
# or: npm install @cosmkiwi/nz-address-elements
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or drop the standalone 32 KB browser bundle straight into plain HTML:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<nz-address-search id="addr"></nz-address-search>
|
|
19
|
+
<script type="module" src="https://cosm.kiwi/nz-address/nz-address-search.bundle.js"></script>
|
|
20
|
+
<script type="module">
|
|
21
|
+
document.getElementById("addr").addEventListener("select", (e) => {
|
|
22
|
+
console.log(e.detail); // { fullAddress, streetAddress, suburb, cityOrTa, lat, lon, ... }
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Module Usage (React / Vue / Vite)
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import "@cosmkiwi/nz-address-elements";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<nz-address-search
|
|
35
|
+
cdn-url="https://cosm.kiwi/nz-address/data"
|
|
36
|
+
placeholder="Enter a New Zealand address..."
|
|
37
|
+
max-results="8"
|
|
38
|
+
min-verify-chars="3"
|
|
39
|
+
probe-limit="16"
|
|
40
|
+
></nz-address-search>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Attributes & Events
|
|
44
|
+
|
|
45
|
+
* **Attributes:** `cdn-url`, `placeholder`, `value`, `max-results` (default `8`), `min-verify-chars` (default `3`), `probe-limit` (default `16`), `disabled`.
|
|
46
|
+
* **Events:**
|
|
47
|
+
* `select` — `CustomEvent<ResolvedAddress>` fired when a verified LINZ address is chosen.
|
|
48
|
+
* `telemetry` — `CustomEvent<NZAddressTelemetryEventDetail>` with Stage 1 ms & Stage 2 Range bytes.
|
|
49
|
+
* **Theming:** Uses Shadow DOM with CSS custom properties (`--nz-addr-bg`, `--nz-addr-fg`, `--nz-addr-border`, `--nz-addr-accent`, `--nz-addr-muted`, `--nz-addr-hover-bg`, `--nz-addr-radius`, `--nz-addr-font`).
|
|
50
|
+
|
|
51
|
+
## Licensing & LINZ Attribution
|
|
52
|
+
|
|
53
|
+
* **Code:** MIT License
|
|
54
|
+
* **Address Data:** Land Information New Zealand (LINZ) Data Service (`NZ Addresses`, Layer ID `123113`), **CC BY 4.0** Crown Copyright.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmkiwi/nz-address-elements",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Zero-dependency Web Component (<nz-address-search>) for React, Vue, Astro, and vanilla HTML",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"linz"
|
|
35
35
|
],
|
|
36
36
|
"homepage": "https://cosm.kiwi/nz-address/",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/CosmKiwi/nz-address.git",
|
|
40
|
+
"directory": "packages/web-component"
|
|
41
|
+
},
|
|
37
42
|
"dependencies": {
|
|
38
43
|
"@cosmkiwi/nz-address": "0.1.0"
|
|
39
44
|
},
|