4.0.1 • Published 6 months ago

@18f/identity-address-search v4.0.1

Weekly downloads
-
License
CC0-1.0
Repository
github
Last release
6 months ago

@18f/identity-address-search

This is a npm module that provides a React UI component to search for USPS (United States Postal Service) locations. It allows you to retrieve USPS location information based on a full address.

Additionally, this module depends on existing backend services from the Login.gov project. Make sure to have the required backend services or mock services set up and running before using this module.

Installation

You can install this module using npm:

npm install @18f/identity-address-search

Requires React version 17 or greater.

Requires @18f/identity-i18n.

Usage

To use this component, provide callbacks to it for desired behaviors.

import FullAddressSearch from '@18f/identity-address-search';

// Render UI component

return(
    <>
    <FullAddressSearch
            disabled={disabledAddressSearchCallback}
            handleLocationSelect={handleLocationSelect}
            locationsURL={LOCATIONS_URL}
            noInPersonLocationsDisplay={noInPersonLocationsDisplay}
            onFoundLocations={setLocationResultsCallback}
            registerField={registerFieldCallback}
            resultsHeaderComponent={resultsHeaderComponent}
          />
    </>
);

By adding the usesErrorComponent prop to the FullAddressSearch component you can opt in to showing a specialized error message for skipping location selection when a locations endpoint error happens instead of the alert.

import FullAddressSearch from '@18f/identity-address-search';

// Render UI component

return(
    <>
    <FullAddressSearch
            disabled={disabledAddressSearchCallback}
            handleLocationSelect={handleLocationSelect}
            locationsURL={LOCATIONS_URL}
            noInPersonLocationsDisplay={noInPersonLocationsDisplay}
            onFoundLocations={setLocationResultsCallback}
            registerField={registerFieldCallback}
            resultsHeaderComponent={resultsHeaderComponent}
            usesErrorComponent
          />
    </>
);

License

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request or issue, you are agreeing to comply with this waiver of copyright interest.

3.4.0

12 months ago

3.3.0

12 months ago

4.0.1

6 months ago

4.0.0

6 months ago

3.2.0

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

2.2.0-beta0.1

2 years ago

2.2.0-beta0.2

2 years ago

3.0.0

2 years ago

1.0.5

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.4.0

2 years ago

1.0.6-alpha

2 years ago

1.0.5-beta

2 years ago

2.0.0-beta.1

2 years ago

3.0.0-beta0.1

2 years ago

2.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago