@mapbox/search-js-web
Advanced tools
Comparing version 1.0.0-beta.10 to 1.0.0-beta.11
import { AutofillOptions, AutofillRetrieveResponse, AutofillSuggestionResponse, Evented, MapboxAutofill } from '@mapbox/search-js-core'; | ||
import { MapboxSearchListboxAutofillType } from './components/MapboxAddressAutofill'; | ||
import { MapboxSearchListbox } from './components/MapboxSearchListbox'; | ||
import { MapboxHTMLEvent } from './MapboxHTMLEvent'; | ||
import { Theme } from './theme'; | ||
import { AddressConfirmOptions } from './components/MapboxAddressConfirmation'; | ||
import { PopoverOptions } from './utils/popover'; | ||
/** | ||
@@ -11,10 +12,35 @@ * @class AutofillInstance | ||
#private; | ||
listbox: MapboxSearchListboxAutofillType; | ||
listbox: MapboxSearchListbox<unknown, import("@mapbox/search-js-core").Suggestion | import("@mapbox/search-js-core").AutofillSuggestion, { | ||
suggestions: (import("@mapbox/search-js-core").Suggestion | import("@mapbox/search-js-core").AutofillSuggestion)[]; | ||
}, unknown>; | ||
constructor(collection: AutofillCollectionType, input: HTMLInputElement, autofillRef: MapboxAutofill); | ||
remove(): void; | ||
} | ||
interface AutofillCollectionOptions { | ||
/** | ||
* @typedef AutofillCollectionOptions | ||
*/ | ||
export interface AutofillCollectionOptions { | ||
/** | ||
* The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
*/ | ||
accessToken?: string; | ||
/** | ||
* Options to pass to the underlying {@link MapboxAutofill} interface. | ||
*/ | ||
options?: Partial<AutofillOptions>; | ||
/** | ||
* The {@link Theme} to use for styling the autofill component. | ||
*/ | ||
theme?: Theme; | ||
/** | ||
* The {@link PopoverOptions} to define popover positioning. | ||
*/ | ||
popoverOptions?: Partial<PopoverOptions>; | ||
/** | ||
* If true, forms autofilled by the browser will prompt the | ||
* {@link confirmAddress} dialog for user confirmation. | ||
* An {@link AddressConfirmOptions} object can also be passed | ||
* to prompt {@link confirmAddress} with custom options. | ||
* Defaults to false. | ||
*/ | ||
confirmOnBrowserAutofill?: boolean | AddressConfirmOptions; | ||
@@ -93,3 +119,3 @@ } | ||
instances: AutofillInstance[]; | ||
constructor({ accessToken, options, theme, confirmOnBrowserAutofill }: AutofillCollectionOptions); | ||
constructor({ accessToken, options, theme, popoverOptions, confirmOnBrowserAutofill }: AutofillCollectionOptions); | ||
/** | ||
@@ -133,2 +159,16 @@ * The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
/** | ||
* The {@link PopoverOptions} to define popover positioning. | ||
* | ||
* @example | ||
* ```typescript | ||
* autofill.popoverOptions = { | ||
* placement: 'top-start', | ||
* flip: true, | ||
* offset: 5 | ||
* }; | ||
* ``` | ||
*/ | ||
get popoverOptions(): Partial<PopoverOptions>; | ||
set popoverOptions(newOptions: Partial<PopoverOptions>); | ||
/** | ||
* If true, forms autofilled by the browser will prompt the | ||
@@ -212,5 +252,3 @@ * {@link confirmAddress} dialog for user confirmation. | ||
* | ||
* @param optionsArg | ||
* @param {string} optionsArg.accessToken - A [Mapbox access token](https://www.mapbox.com/help/create-api-access-token/). | ||
* @param {Partial<AutofillOptions>} [optionsArg.options] - Options to set on the underlying Autofill API. | ||
* @param optionsArg - {@link AutofillCollectionOptions} Object defining options for Autofill search behavior and UI. | ||
* @example | ||
@@ -217,0 +255,0 @@ * <input type="text" autocomplete="street-address" /> |
@@ -7,2 +7,3 @@ import { AutofillOptions, AutofillRetrieveResponse, AutofillSuggestion, AutofillSuggestionResponse } from '@mapbox/search-js-core'; | ||
import { AddressConfirmOptions } from './MapboxAddressConfirmation'; | ||
import { PopoverOptions } from '../utils/popover'; | ||
export declare type MapboxSearchListboxAutofillType = MapboxSearchListbox<AutofillOptions, AutofillSuggestion, AutofillSuggestionResponse, AutofillRetrieveResponse>; | ||
@@ -146,2 +147,20 @@ declare type AutofillEventTypes = { | ||
/** | ||
* The {@link PopoverOptions} to define popover positioning. | ||
* | ||
* @name popoverOptions | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {PopoverOptions} | ||
* @example | ||
* ```typescript | ||
* autofill.popoverOptions = { | ||
* placement: 'top-start', | ||
* flip: true, | ||
* offset: 5 | ||
* }; | ||
* ``` | ||
*/ | ||
get popoverOptions(): Partial<PopoverOptions>; | ||
set popoverOptions(newOptions: Partial<PopoverOptions>); | ||
/** | ||
* If true, forms autofilled by the browser will prompt the | ||
@@ -148,0 +167,0 @@ * {@link confirmAddress} dialog for user confirmation. |
@@ -1,2 +0,2 @@ | ||
import { AutofillFeatureSuggestion, AutofillOptions } from '@mapbox/search-js-core'; | ||
import { ValidateOptions, AutofillFeatureSuggestion } from '@mapbox/search-js-core'; | ||
import { HTMLScopedElement } from './HTMLScopedElement'; | ||
@@ -40,5 +40,5 @@ import { AutofillValueMap } from '../utils/autofill'; | ||
* Autofill API configuration options | ||
* {@link AutofillOptions} | ||
* {@link ValidateOptions} | ||
*/ | ||
options?: Partial<AutofillOptions>; | ||
options?: Partial<ValidateOptions>; | ||
/** | ||
@@ -58,6 +58,8 @@ * If true, a static minimap showing the suggested address location will be displayed in the modal dialog. | ||
* A callback used to pre-confirm an address and skip the UI modal. | ||
* The feature argument contains all address components, as well as an {@link AutofillMatchCode} object, | ||
* The feature argument contains all address components, as well as an {@link MatchCode} object, | ||
* which are used to express the confidence of an address match. | ||
* The callback must return a boolean, with `true` indicating that the address has been pre-confirmed, | ||
* and the UI modal will be skipped and will not be presented to the end-user. | ||
* If left undefined, this defaults to skipping showing the modal when the validated feature's match code | ||
* returns an "exact" match. | ||
*/ | ||
@@ -64,0 +66,0 @@ skipConfirmModal?: (feature: AutofillFeatureSuggestion) => boolean; |
@@ -7,2 +7,3 @@ import { Options, RetrieveResponse, Suggestion, SuggestionResponse } from '@mapbox/search-js-core'; | ||
import { MapboxHTMLEvent } from '../MapboxHTMLEvent'; | ||
import { PopoverOptions } from '../utils/popover'; | ||
export declare type MapboxSearchListboxSearchType = MapboxSearchListbox<Options, Suggestion, SuggestionResponse, RetrieveResponse>; | ||
@@ -169,2 +170,20 @@ declare type SearchEventTypes = { | ||
set theme(theme: Theme); | ||
/** | ||
* The {@link PopoverOptions} to define popover positioning. | ||
* | ||
* @name popoverOptions | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {PopoverOptions} | ||
* @example | ||
* ```typescript | ||
* search.popoverOptions = { | ||
* placement: 'top-start', | ||
* flip: true, | ||
* offset: 5 | ||
* }; | ||
* ``` | ||
*/ | ||
get popoverOptions(): Partial<PopoverOptions>; | ||
set popoverOptions(newOptions: Partial<PopoverOptions>); | ||
connectedCallback(): void; | ||
@@ -171,0 +190,0 @@ disconnectedCallback(): void; |
@@ -5,2 +5,3 @@ import { SearchSession, Suggestion as SearchSuggestion, AutofillSuggestion, FeatureSuggestion, AutofillFeatureSuggestion } from '@mapbox/search-js-core'; | ||
import { Theme } from '../theme'; | ||
import { PopoverOptions } from '../utils/popover'; | ||
declare type ListboxEventTypes<SuggestionResponse, RetrieveResponse> = { | ||
@@ -31,2 +32,4 @@ suggest: MapboxHTMLEvent<SuggestionResponse>; | ||
set theme(theme: Theme); | ||
get popoverOptions(): Partial<PopoverOptions>; | ||
set popoverOptions(newOptions: Partial<PopoverOptions>); | ||
retrieveFeature: FeatureSuggestion | AutofillFeatureSuggestion; | ||
@@ -33,0 +36,0 @@ connectedCallback(): void; |
@@ -12,7 +12,8 @@ /// <reference path="../src/types/custom_elements.d.ts" /> | ||
export { Theme } from './theme'; | ||
export { autofill } from './autofill'; | ||
export { autofill, AutofillCollectionOptions } from './autofill'; | ||
export { confirmAddress } from './confirmAddress'; | ||
export { MapStyleMode, Anchor } from './utils/minimap'; | ||
export { AddressConfirmShowResult } from './utils/confirmation'; | ||
export { getFormAutofillValues, getAutofillSearchText } from './utils/autofill'; | ||
export { getFormAutofillValues, getAutofillSearchText, AutofillValueMap } from './utils/autofill'; | ||
export { PopoverOptions } from './utils/popover'; | ||
export { config } from './config'; |
@@ -45,2 +45,23 @@ import { AutofillFeatureSuggestion, AutofillSuggestion } from '@mapbox/search-js-core'; | ||
}; | ||
/** | ||
* Object mapping WHATWG autocomplete attribute values to corresponding address component strings. | ||
* | ||
* @typedef AutofillValueMap | ||
* @example | ||
* ```typescript | ||
* { | ||
* "street-address"?: string; | ||
* "address-line1"?: string; | ||
* "address-line2"?: string; | ||
* "address-line3"?: string; | ||
* "address-level4"?: string; | ||
* "address-level3"?: string; | ||
* "address-level2"?: string; | ||
* "address-level1"?: string; | ||
* country?: string; | ||
* "country-name"?: string; | ||
* "postal-code"?: string; | ||
* } | ||
* ``` | ||
*/ | ||
export declare type AutofillValueMap = { | ||
@@ -47,0 +68,0 @@ [key in AutofillTokens]?: string; |
/** | ||
* LngLatBounds in [minX, minY, maxX, maxY] order. | ||
*/ | ||
export declare type FlatLngLatBounds = [number, number, number, number]; | ||
/** | ||
* Returns a random ID that is valid as a CSS identifier. | ||
@@ -7,0 +3,0 @@ * |
{ | ||
"name": "@mapbox/search-js-web", | ||
"version": "1.0.0-beta.10", | ||
"version": "1.0.0-beta.11", | ||
"description": "Search web component with form autocomplete.", | ||
@@ -22,7 +22,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@mapbox/search-js-core": "^1.0.0-beta.10", | ||
"@floating-ui/dom": "^0.5.2", | ||
"@mapbox/search-js-core": "^1.0.0-beta.11", | ||
"@mapbox/sphericalmercator": "^1.2.0", | ||
"@popperjs/core": "^2.11.2", | ||
"@turf/bbox": "^6.5.0", | ||
"@turf/bbox-polygon": "^6.5.0", | ||
"focus-trap": "^6.7.3", | ||
@@ -82,2 +80,2 @@ "no-scroll": "^2.1.1" | ||
] | ||
} | ||
} |
@@ -8,3 +8,3 @@ { | ||
"moduleResolution": "node", | ||
"lib": ["dom", "ES2020", "ESNext"], | ||
"lib": ["dom", "ES2020", "ESNext", "dom.iterable"], | ||
// Treat JSX as React. | ||
@@ -11,0 +11,0 @@ "jsx": "react", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
6
67
11353
2830125
19
+ Added@floating-ui/dom@^0.5.2
+ Added@floating-ui/core@0.7.3(transitive)
+ Added@floating-ui/dom@0.5.4(transitive)
- Removed@popperjs/core@^2.11.2
- Removed@turf/bbox@^6.5.0
- Removed@turf/bbox-polygon@^6.5.0
- Removed@popperjs/core@2.11.8(transitive)
- Removed@turf/bbox@6.5.0(transitive)
- Removed@turf/bbox-polygon@6.5.0(transitive)
- Removed@turf/helpers@6.5.0(transitive)
- Removed@turf/meta@6.5.0(transitive)