npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dgtek-autocomplete-address

v1.0.4

Published

For DGtek portal only. This package uses Google autocomplete and geolocation to check the address to be in the footprint (DGtek buildings and polygons).

Downloads

9

Readme

dgtek-autocomplete-address

Package installation

yarn add dgtek-autocomplete-address

Start package

import DGtekAutocompleteAddress from 'dgtek-autocomplete-address'

window.customElements.define('dgtek-autocomplete-address', DGtekAutocompleteAddress)

Mount component

<dgtek-autocomplete-address />

or

const component = document.body
  .appendChild(document.createElement('dgtek-autocomplete-address'))

Styling elements

You can stylize elements:

document.getElementsByTagName('dgtek-autocomplete-address')[0]
  .setStyleOption('snackBar', 'backgroundColor', '#09b')
  .setStyleOption('snackBar', 'borderRadius', '0px')
  .setStyleOption('snackBar', 'borderColor', '#ff0')
  .setStyleOption('submitButton', 'backgroundColor', '#090')

There are some style properties which you can change:

| Element | Style property | Default value | |-|-|-| | submitButton | borderRadius | 4px | | submitButton | border | 4px solid transparent | | submitButton | backgroundColor | #881f1a | | submitButton | fontFamily | Gilroy, "Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif | | submitButton | fontSize | 16px | | submitButton | color | #fff | | submitButton | padding | 4px 8px | | | | | | input | width | 88% | | input | padding | 12px 16px | | input | border | solid 1px #bbb | | input | borderRadius | 4px | | input | fontFamily | Gilroy, "Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif | | | | | | snackBar | backgroundColor | #881f1aa0 | | snackBar | borderColor | #881f1a | | snackBar | borderRadius | 4px | | snackBar | margin | 8px 16px | | snackBar | color | #fff | | snackBar | fontSize | .875rem | | snackBar | fontFamily | Gilroy, "Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif | | | | | | link | fontFamily | Gilroy, "Segoe UI", SegoeUI, "Helvetica Neue", Helvetica, Arial, sans-serif | | link | fontSize | 14px | | link | color | #ddd |


Catch events

Submit button event:

window.addEventListener('submit-address', function (event) {
  console.log(event.detail)
})

Example of event.detail content:

address: "45 CLARKE ST, SOUTHBANK VIC 3006"
addressComponents: { number1: '45', number2: '', number: '45', street: 'CLARKE', streetType: 'ST', …}
buildingId: null
coordinates: { lat: -37.8269008, lng: 144.9595298 }
estimatedServiceDeliveryTime: ""
status: "polygons-service-available"

The most important here is status

Status possible variants
if address was found in DB:

on-netdb-footprintdb-build-commenceddb-coming-soon

if the address belongs to some polygon

polygons-service-availablepolygons-build-commencedpolygons-coming-soon

otherwise

Failure events

During checking the address, a number of requests will be made to remote server.

Every request can fail.

window.addEventListener('server-error', function (event) {
  console.log(event.detail) /* { error: true, errorType: String, errorMessage: String } */
})

You can catch errors with handler for open-error-popup event:

window.addEventListener('open-error-popup', function (event) {
  console.log(event.detail) /* { error: true, errorType: String, errorMessage: String } */
})