@aws/address-form-sdk-js 1.5.0 → 1.6.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.
Files changed (32) hide show
  1. package/README.md +13 -12
  2. package/dist/lib/address-form-sdk-js.css +1 -1
  3. package/dist/lib/address-form-sdk.cjs.js +1 -1
  4. package/dist/lib/components/AddressForm/index.d.ts +2 -2
  5. package/dist/lib/components/AddressFormReact/AddressForm.d.ts +2 -0
  6. package/dist/lib/components/AddressFormReact/AddressFormAddressField.d.ts +1 -1
  7. package/dist/lib/components/AddressFormReact/AddressFormContext.d.ts +3 -0
  8. package/dist/lib/components/AddressFormReact/AddressFormCountryField.d.ts +1 -1
  9. package/dist/lib/components/AddressFormReact/AddressFormProvider.d.ts +2 -0
  10. package/dist/lib/components/AddressFormReact/AddressFormTextField.d.ts +1 -1
  11. package/dist/lib/components/AddressFormReact/SubmitButton.d.ts +2 -0
  12. package/dist/lib/components/AddressFormReact/render.d.ts +2 -0
  13. package/dist/lib/components/AmazonLocationProvider/index.d.ts +1 -1
  14. package/dist/lib/components/Button/index.d.ts +1 -1
  15. package/dist/lib/components/CountrySelect/index.d.ts +1 -1
  16. package/dist/lib/components/Flex/index.d.ts +1 -1
  17. package/dist/lib/components/FormField/index.d.ts +1 -1
  18. package/dist/lib/components/Input/index.d.ts +1 -1
  19. package/dist/lib/components/LocateButton/index.d.ts +3 -1
  20. package/dist/lib/components/Map/index.d.ts +1 -1
  21. package/dist/lib/components/MapMarker/index.d.ts +2 -1
  22. package/dist/lib/components/Tooltip/index.d.ts +1 -1
  23. package/dist/lib/components/Typeahead/index.d.ts +3 -1
  24. package/dist/lib/components/Typeahead/use-typeahead-query.d.ts +1 -1
  25. package/dist/lib/icons/Locate.d.ts +1 -1
  26. package/dist/lib/icons/Logo.d.ts +1 -1
  27. package/dist/lib/utils/bounds.d.ts +3 -0
  28. package/dist/standalone/address-form-sdk.css +1 -1
  29. package/dist/standalone/address-form-sdk.umd.js +460 -448
  30. package/dist/standalone/maplibre-gl-shared.mjs +5 -0
  31. package/dist/standalone/maplibre-gl-worker.mjs +5 -0
  32. package/package.json +16 -20
@@ -43,10 +43,10 @@ export interface AddressFormProps {
43
43
  language?: string;
44
44
  politicalView?: string;
45
45
  }
46
- export declare function AddressForm({ fields, typeahead, map, politicalView, language, className, onSubmit, }: AddressFormProps): import("react/jsx-runtime").JSX.Element;
46
+ export declare function AddressForm({ fields, typeahead, map, politicalView, language, className, onSubmit, }: AddressFormProps): import("react").JSX.Element;
47
47
  export interface AddressFormMapProps extends MapProps {
48
48
  adjustablePosition?: boolean;
49
49
  markerPosition?: [number, number];
50
50
  onSaveMarkerPosition?: (position: [number, number]) => void;
51
51
  }
52
- export declare const AddressFormMap: ({ adjustablePosition, markerPosition, onSaveMarkerPosition, onMove, ...mapProps }: AddressFormMapProps) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const AddressFormMap: ({ adjustablePosition, markerPosition, onSaveMarkerPosition, onMove, ...mapProps }: AddressFormMapProps) => import("react").JSX.Element;
@@ -4,6 +4,7 @@ import { AddressFormAddressFieldProps } from './AddressFormAddressField';
4
4
  import { AddressFormCountryFieldProps } from './AddressFormCountryField';
5
5
  import { AddressFormMapProps } from './AddressFormMap';
6
6
  import { AddressFormTextFieldProps } from './AddressFormTextField';
7
+ import { CenterBounds } from '../../utils/bounds';
7
8
  export interface AddressFormData {
8
9
  placeId?: string;
9
10
  addressLineOne?: string;
@@ -27,6 +28,7 @@ export interface AddressFormProps extends AddressFormContentProps {
27
28
  placeTypes?: AutocompleteFilterPlaceType[];
28
29
  initialMapCenter?: [number, number];
29
30
  initialMapZoom?: number;
31
+ centerBounds?: CenterBounds;
30
32
  }
31
33
  interface ChildComponents {
32
34
  AddressField: FunctionComponent<AddressFormAddressFieldProps>;
@@ -8,4 +8,4 @@ export interface AddressFormAddressFieldProps {
8
8
  placeholder?: string;
9
9
  className?: string;
10
10
  }
11
- export declare const AddressFormAddressField: import('react').MemoExoticComponent<({ name, label, className, showCurrentLocation, apiName, placeholder }: AddressFormAddressFieldProps) => import("react/jsx-runtime").JSX.Element>;
11
+ export declare const AddressFormAddressField: import('react').MemoExoticComponent<({ name, label, className, showCurrentLocation, apiName, placeholder }: AddressFormAddressFieldProps) => import("react").JSX.Element>;
@@ -1,6 +1,7 @@
1
1
  import { AutocompleteFilterPlaceType } from '@aws-sdk/client-geo-places';
2
2
  import { AddressFormData } from './AddressForm';
3
3
  import { TypeaheadAPIName } from '../Typeahead/use-typeahead-query';
4
+ import { CenterBounds } from '../../utils/bounds';
4
5
  export interface MapViewState {
5
6
  longitude: number;
6
7
  latitude: number;
@@ -19,6 +20,8 @@ export interface AddressFormContextType {
19
20
  showCurrentCountryResultsOnly?: boolean;
20
21
  allowedCountries?: string[];
21
22
  placeTypes?: AutocompleteFilterPlaceType[];
23
+ centerBounds?: CenterBounds;
24
+ isAdjustedPositionOutOfBounds?: boolean;
22
25
  isAutofill: boolean;
23
26
  setIsAutofill: (isAutofill: boolean) => void;
24
27
  typeaheadApiName: TypeaheadAPIName | null;
@@ -5,4 +5,4 @@ export interface AddressFormCountryFieldProps {
5
5
  label: string;
6
6
  placeholder?: string;
7
7
  }
8
- export declare const AddressFormCountryField: import('react').MemoExoticComponent<({ name, className, label, placeholder }: AddressFormCountryFieldProps) => import("react/jsx-runtime").JSX.Element>;
8
+ export declare const AddressFormCountryField: import('react').MemoExoticComponent<({ name, className, label, placeholder }: AddressFormCountryFieldProps) => import("react").JSX.Element>;
@@ -1,5 +1,6 @@
1
1
  import { AutocompleteFilterPlaceType, GeoPlacesClient } from '@aws-sdk/client-geo-places';
2
2
  import { FunctionComponent, PropsWithChildren } from 'react';
3
+ import { CenterBounds } from '../../utils/bounds';
3
4
  export interface AddressFormProps extends PropsWithChildren {
4
5
  apiKey?: string;
5
6
  region: string;
@@ -11,5 +12,6 @@ export interface AddressFormProps extends PropsWithChildren {
11
12
  client?: GeoPlacesClient;
12
13
  initialMapCenter?: [number, number];
13
14
  initialMapZoom?: number;
15
+ centerBounds?: CenterBounds;
14
16
  }
15
17
  export declare const AddressFormProvider: FunctionComponent<AddressFormProps>;
@@ -5,4 +5,4 @@ export interface AddressFormTextFieldProps {
5
5
  label: string;
6
6
  placeholder?: string;
7
7
  }
8
- export declare const AddressFormTextField: import('react').MemoExoticComponent<({ name, className, label, placeholder }: AddressFormTextFieldProps) => import("react/jsx-runtime").JSX.Element>;
8
+ export declare const AddressFormTextField: import('react').MemoExoticComponent<({ name, className, label, placeholder }: AddressFormTextFieldProps) => import("react").JSX.Element>;
@@ -0,0 +1,2 @@
1
+ import { ComponentProps, FunctionComponent } from 'react';
2
+ export declare const SubmitButton: FunctionComponent<ComponentProps<"button">>;
@@ -1,5 +1,6 @@
1
1
  import { AutocompleteFilterPlaceType } from '@aws-sdk/client-geo-places';
2
2
  import { SubmitHandler } from './AddressForm';
3
+ import { CenterBounds } from '../../utils/bounds';
3
4
  export interface RenderParams {
4
5
  root: string;
5
6
  apiKey: string;
@@ -12,5 +13,6 @@ export interface RenderParams {
12
13
  onSubmit?: SubmitHandler;
13
14
  initialMapCenter?: [number, number];
14
15
  initialMapZoom?: number;
16
+ centerBounds?: CenterBounds;
15
17
  }
16
18
  export declare const render: ({ root: selector, ...formProps }: RenderParams) => void;
@@ -5,5 +5,5 @@ type AmazonLocationProviderProps = PropsWithChildren & {
5
5
  region: string;
6
6
  client?: GeoPlacesClient;
7
7
  };
8
- export declare function AmazonLocationProvider({ apiKey, region, children, client }: AmazonLocationProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function AmazonLocationProvider({ apiKey, region, children, client }: AmazonLocationProviderProps): import("react").JSX.Element;
9
9
  export {};
@@ -4,4 +4,4 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
4
4
  disabled?: boolean;
5
5
  size?: "small" | "medium" | "large";
6
6
  }
7
- export declare function Button({ children, className, variant, size, disabled, ...restProps }: ButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Button({ children, className, variant, size, disabled, ...restProps }: ButtonProps): import("react").JSX.Element;
@@ -14,5 +14,5 @@ interface MultiCountrySelectProps extends BaseCountrySelectProps {
14
14
  onChange: (value: string[]) => void;
15
15
  }
16
16
  export type CountrySelectProps = (SingleCountrySelectProps | MultiCountrySelectProps) & Omit<InputProps, "value" | "onChange" | "id">;
17
- export declare const CountrySelect: ({ id, value, onChange, allowedCountries: defaultAllowedCountries, multiple, ...inputProps }: CountrySelectProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const CountrySelect: ({ id, value, onChange, allowedCountries: defaultAllowedCountries, multiple, ...inputProps }: CountrySelectProps) => import("react").JSX.Element;
18
18
  export {};
@@ -4,4 +4,4 @@ export interface FlexProps extends ComponentProps<"div"> {
4
4
  gap?: number | string;
5
5
  flex?: boolean;
6
6
  }
7
- export declare function Flex({ direction, gap, children, className, flex, ...rest }: FlexProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Flex({ direction, gap, children, className, flex, ...rest }: FlexProps): import("react").JSX.Element;
@@ -4,4 +4,4 @@ export interface FormFieldProps {
4
4
  children: React.ReactNode;
5
5
  className?: string;
6
6
  }
7
- export declare function FormField({ id, label, children, className }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function FormField({ id, label, children, className }: FormFieldProps): import("react").JSX.Element;
@@ -3,4 +3,4 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
3
3
  disabled?: boolean;
4
4
  placeholder?: string;
5
5
  }
6
- export declare function Input({ className, placeholder, disabled, ...restProps }: InputProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Input({ className, placeholder, disabled, ...restProps }: InputProps): import("react").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import { TypeaheadOutput } from '../Typeahead/index.tsx';
3
+ import { CenterBounds } from '../../utils/bounds.ts';
3
4
  interface LocateButtonProps extends ComponentProps<"button"> {
4
5
  onLocate: (address: TypeaheadOutput) => void;
5
6
  className?: string;
7
+ queryBounds?: CenterBounds;
6
8
  }
7
- export declare function LocateButton({ onLocate, className, ...restProps }: LocateButtonProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function LocateButton({ onLocate, className, queryBounds, ...restProps }: LocateButtonProps): import("react").JSX.Element;
8
10
  export {};
@@ -13,4 +13,4 @@ export interface MapProps extends Omit<MapLibreMapProps, "mapStyle"> {
13
13
  */
14
14
  mapsEndpointOverride?: string;
15
15
  }
16
- export declare function Map({ mapStyle: extendedMapStyle, politicalView, showNavigationControl, mapsEndpointOverride, children, ...rest }: MapProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Map({ mapStyle: extendedMapStyle, politicalView, showNavigationControl, mapsEndpointOverride, children, ...rest }: MapProps): import("react").JSX.Element;
@@ -3,7 +3,8 @@ export interface MapMarkerProps {
3
3
  adjustablePosition?: boolean;
4
4
  markerPosition?: [number, number];
5
5
  hasAdjustedPosition?: boolean;
6
+ isOutOfBounds?: boolean;
6
7
  onReset?: () => void;
7
8
  colorScheme?: ColorScheme;
8
9
  }
9
- export declare function MapMarker({ adjustablePosition, markerPosition, hasAdjustedPosition, onReset, colorScheme, }: MapMarkerProps): import("react/jsx-runtime").JSX.Element | null;
10
+ export declare function MapMarker({ adjustablePosition, markerPosition, hasAdjustedPosition, isOutOfBounds, onReset, colorScheme, }: MapMarkerProps): import("react").JSX.Element | null;
@@ -3,5 +3,5 @@ interface TooltipProps {
3
3
  text: string;
4
4
  show?: boolean;
5
5
  }
6
- export declare function Tooltip({ text, show, children }: PropsWithChildren<TooltipProps>): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Tooltip({ text, show, children }: PropsWithChildren<TooltipProps>): import("react").JSX.Element;
7
7
  export {};
@@ -1,5 +1,6 @@
1
1
  import { Address } from '@aws-sdk/client-geo-places';
2
2
  import { TypeaheadAPIInput, TypeaheadAPIName } from './use-typeahead-query.ts';
3
+ import { CenterBounds } from '../../utils/bounds.ts';
3
4
  export interface TypeaheadOutput {
4
5
  placeId?: string;
5
6
  addressLineOneField?: string;
@@ -20,5 +21,6 @@ export interface TypeaheadProps {
20
21
  showCurrentLocation?: boolean;
21
22
  debounce?: number;
22
23
  skipNextQuery?: boolean;
24
+ queryBounds?: CenterBounds;
23
25
  }
24
- export declare const Typeahead: ({ apiName, ...props }: TypeaheadProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Typeahead: ({ apiName, ...props }: TypeaheadProps) => import("react").JSX.Element;
@@ -11,4 +11,4 @@ export interface TypeaheadResultItem {
11
11
  title: string;
12
12
  placeId: string;
13
13
  }
14
- export declare const useTypeaheadQuery: ({ client, apiName, apiInput, enabled }: UseTypeaheadParams) => import('@tanstack/react-query').UseQueryResult<TypeaheadResultItem[], Error>;
14
+ export declare const useTypeaheadQuery: ({ client, apiName, apiInput, enabled }: UseTypeaheadParams) => import('@tanstack/react-query').UseQueryResult<NoInfer<TypeaheadResultItem[]>, Error>;
@@ -1 +1 @@
1
- export declare const Locate: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const Locate: () => import("react").JSX.Element;
@@ -2,5 +2,5 @@ import { ComponentProps } from 'react';
2
2
  interface LogoProps extends ComponentProps<"a"> {
3
3
  mode: "Light" | "Dark";
4
4
  }
5
- export declare const Logo: ({ mode, ...rest }: LogoProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Logo: ({ mode, ...rest }: LogoProps) => import("react").JSX.Element;
6
6
  export {};
@@ -0,0 +1,3 @@
1
+ export type CenterBounds = [[number, number], [number, number]];
2
+ export declare const clampCenterToBounds: (center: [number, number], bounds?: CenterBounds) => [number, number];
3
+ export declare const isCenterWithinBounds: (center: [number, number], bounds?: CenterBounds) => boolean;