@yext/pages-components 1.0.4 → 1.0.6

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/dist/index.d.ts CHANGED
@@ -618,348 +618,566 @@ type LinkProps = CTALinkProps | HREFLinkProps;
618
618
  */
619
619
  declare const Link: React$1.ForwardRefExoticComponent<(Omit<HREFLinkProps, "ref"> | Omit<CTAWithChildrenLinkProps, "ref"> | Omit<CTAWithoutChildrenLinkProps, "ref">) & React$1.RefAttributes<HTMLAnchorElement>>;
620
620
 
621
+ declare enum Unit {
622
+ DEGREE = "deg",
623
+ KILOMETER = "km",
624
+ MILE = "mi",
625
+ RADIAN = "r"
626
+ }
627
+ declare enum Projection {
628
+ MERCATOR = "mercator",
629
+ SPHERICAL = "spherical"
630
+ }
631
+
621
632
  /**
622
633
  * This class represents a point on a sphere defined by latitude and longitude.
623
634
  * Latitude is a degree number in the range [-90, 90].
624
635
  * Longitude is a degree number without limits but is normalized to [-180, 180).
625
636
  */
626
637
  declare class Coordinate$1 {
638
+ _lat: number;
639
+ _lon: number;
627
640
  /**
628
641
  * Constructor takes either 1 or 2 arguments.
629
642
  * 2 arguments: latitude and longitude.
630
- * 1 argument: an object with at least one {@link module:@yext/components-geo~Coordinate~LATITUDE_ALIASES latitude alias}
631
- * and one one {@link module:@yext/components-geo~CoordinateCoordinate~LONGITUDE_ALIASES longitude alias}.
632
- * @param {number|Object} latitudeOrObject
633
- * @param {number} [longitude] Optional only if the first argument is a {@link module:@yext/components-geo~Coordinate Coordinate}-like object
643
+ * 1 argument: an object with at least one {@link LATITUDE_ALIASES | latitude alias}
644
+ * and one one {@link LONGITUDE_ALIASES | longitude alias}.
645
+ * @param longitude - Optional only if the first argument is a {@link Coordinate}-like object
634
646
  */
635
- constructor(latitudeOrObject: number | Object, longitude?: number | undefined);
636
- set latitude(newLat: number);
647
+ constructor(latitudeOrObject: number | object, long?: number);
637
648
  /**
638
649
  * Degrees latitude in the range [-90, 90].
639
650
  * If setting a value outside this range, it will be set to -90 or 90, whichever is closer.
640
- * @type {number}
641
651
  */
642
652
  get latitude(): number;
643
- set longitude(newLon: number);
653
+ set latitude(newLat: number);
644
654
  /**
645
655
  * Degrees longitude in the range [-Infinity, Infinity].
646
- * @type {number}
647
656
  */
648
657
  get longitude(): number;
658
+ set longitude(newLon: number);
649
659
  /**
650
660
  * Degrees longitude in the range [-180, 180).
651
661
  * If the coordinate's longitude is outside this range, the equivalent value within it is used.
652
- * Examples: 123 => 123, 270 => -90, -541 => 179
653
- * @type {number}
662
+ * Examples: 123 =\> 123, 270 =\> -90, -541 =\> 179
654
663
  */
655
664
  get normalLon(): number;
656
- _lat: number | undefined;
657
- _lon: number | undefined;
658
665
  /**
659
666
  * Add distance to the coordinate to change its position.
660
- * @param {number} latDist latitude distance
661
- * @param {number} lonDist longitude distance
662
- * @param {module:@yext/components-geo~Unit} [unit=Unit.DEGREE] The unit of latDist and lonDist
663
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
667
+ * @param latDist - latitude distance
668
+ * @param lonDist - longitude distance
669
+ * @param unit - The unit of latDist and lonDist
670
+ * @param projection - The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
664
671
  */
665
- add(latDist: number, lonDist: number, unit?: any, projection?: any): void;
672
+ add(latDist: number, lonDist: number, unit?: Unit, projection?: Projection): void;
666
673
  /**
667
674
  * Calculate the distance from this coordinate to another coordinate.
668
- * @param {module:@yext/components-geo~Coordinate} coordinate
669
- * @param {module:@yext/components-geo~Unit} [unit=Unit.MILE] The unit of distance
670
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
671
- * @returns {number} Distance in the requested unit
675
+ * @param unit - The unit of distance
676
+ * @param projection - The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
677
+ * @returns Distance in the requested unit
672
678
  */
673
- distanceTo(coordinate: any, unit?: any, projection?: any): number;
679
+ distanceTo(coordinate: Coordinate$1, unit?: Unit, projection?: Projection): number;
674
680
  /**
675
681
  * Test if this coordinate has the same latitude and longitude as another.
676
- * @param {module:@yext/components-geo~Coordinate} coordinate
677
- * @returns {boolean}
678
682
  */
679
- equals(coordinate: any): boolean;
683
+ equals(coordinate: Coordinate$1): boolean;
680
684
  /**
681
685
  * Get the coordinate as a string that can be used in a search query.
682
- * Example: {latitude: -45, longitude: 123} => '-45,123'
683
- * @returns {string}
686
+ * Example: \{latitude: -45, longitude: 123\} =\> '-45,123'
684
687
  */
685
688
  searchQueryString(): string;
686
689
  }
687
690
 
688
691
  /**
689
692
  * This class represents a bounded coordinate region of a sphere.
690
- * The bounds are defined by two {@link module:@yext/components-geo~Coordinate Coordinates}: southwest and northeast.
693
+ * The bounds are defined by two {@link Coordinates}: southwest and northeast.
691
694
  * If the northeast coordinate does not have a greater latitude and longitude than the soutwest
692
695
  * coordinate, the behavior of this object is undefined.
693
696
  */
694
697
  declare class GeoBounds {
698
+ _ne: Coordinate$1;
699
+ _sw: Coordinate$1;
695
700
  /**
696
- * Create a new {@link module:@yext/components-geo~GeoBounds GeoBounds} with minimal area that
701
+ * Create a new {@link GeoBounds} with minimal area that
697
702
  * contains all the given coordinates
698
- * @param {module:@yext/components-geo~Coordinate[]} coordinates
699
- * @returns {module:@yext/components-geo~GeoBounds}
700
703
  */
701
- static fit(coordinates: any): any;
704
+ static fit(coordinates: Coordinate$1[]): GeoBounds;
702
705
  /**
703
- * @param {module:@yext/components-geo~Coordinate} sw Southwest coordinate
704
- * @param {module:@yext/components-geo~Coordinate} ne Northeast coordinate
706
+ * @param sw - Southwest coordinate
707
+ * @param ne - Northeast coordinate
705
708
  */
706
- constructor(sw: any, ne: any);
707
- _ne: Coordinate$1;
708
- _sw: Coordinate$1;
709
- set ne(newNE: any);
709
+ constructor(sw: Coordinate$1, ne: Coordinate$1);
710
710
  /**
711
711
  * Northeast coordinate
712
- * @type {module:@yext/components-geo~Coordinate}
713
712
  */
714
- get ne(): any;
715
- set sw(newSW: any);
713
+ get ne(): Coordinate$1;
714
+ set ne(newNE: Coordinate$1);
716
715
  /**
717
716
  * Southwest coordinate
718
- * @type {module:@yext/components-geo~Coordinate}
719
717
  */
720
- get sw(): any;
718
+ get sw(): Coordinate$1;
719
+ set sw(newSW: Coordinate$1);
721
720
  /**
722
721
  * Whether the coordinate lies within the region defined by the bounds.
723
- * {@link module:@yext/components-geo~Coordinate#normalLon Normalized longitudes} are used for the
722
+ * {@link Normalized | longitudes} are used for the
724
723
  * bounds and the coordinate.
725
- * @param {module:@yext/components-geo~Coordinate} coordinate
726
- * @returns {boolean}
727
724
  */
728
- contains(coordinate: any): boolean;
725
+ contains(coordinate: Coordinate$1): boolean;
729
726
  /**
730
727
  * Extend the bounds if necessary so that the coordinate is contained by them.
731
- * @param {module:@yext/components-geo~Coordinate} coordinate
732
728
  */
733
- extend(coordinate: any): void;
729
+ extend(coordinate: Coordinate$1): void;
734
730
  /**
735
731
  * Calculate the center of the bounds using the given projection.
736
732
  * To find the visual center on a Mercator map, use Projection.MERCATOR.
737
733
  * To find the center for geolocation or geosearch purposes, use Projection.SPHERICAL.
738
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL]
739
- * @returns {module:@yext/components-geo~Coordinate}
740
734
  */
741
- getCenter(projection?: any): any;
735
+ getCenter(projection?: Projection): Coordinate$1;
742
736
  }
743
737
 
744
738
  /**
745
- * An interactive map that supports various map providers, such as Google Maps and Mapbox, with a
746
- * single API. Code written using this class functions approximately the same regardless of the map
747
- * provider used. Any map provider can be supported via an instance of {@link module:@yext/components-maps~MapProvider MapProvider}.
739
+ * {@link ProviderMap} options class
748
740
  */
749
- declare class Map$1 {
741
+ declare class ProviderMapOptions {
750
742
  /**
751
- * The {@link module:@yext/components-maps~MapProvider MapProvider} for the map must be loaded
752
- * before calling this constructor.
753
- * @param {module:@yext/components-maps~MapOptions} options
754
- */
755
- constructor(options: any);
756
- _defaultCenter: any;
757
- _defaultZoom: any;
758
- _legendPins: any;
759
- _provider: any;
760
- _singlePinZoom: any;
761
- _wrapper: any;
762
- _padding: {};
763
- _cachedBounds: GeoBounds | null;
764
- _resolveIdle: () => null;
765
- _resolveMoving: () => null;
766
- _idlePromise: Promise<void>;
767
- _panHandlerRunning: boolean;
768
- _panStartHandlerRunning: boolean;
769
- _map: any;
770
- _currentBounds: any;
743
+ * @param wrapper - The wrapper element that the map will be inserted into
744
+ */
745
+ providerMapClass: typeof ProviderMap;
746
+ wrapper: HTMLElement | null;
747
+ controlEnabled: boolean;
748
+ panHandler: PanHandler;
749
+ panStartHandler: PanStartHandler;
750
+ providerOptions: {
751
+ [key: string]: any;
752
+ };
753
+ constructor(provider: MapProvider, wrapper: HTMLElement | null);
771
754
  /**
772
- * Set the map bounds so that all the given coordinates are within the {@link module:@yext/components-maps~MapOptions#withPadding padded}
773
- * view.
774
- * @param {module:@yext/components-tsx-geo~Coordinate[]} coordinates
775
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
776
- * @param {number} [maxZoom=singlePinZoom] The max zoom level after fitting. Uses {@link module:@yext/components-maps~MapOptions#withSinglePinZoom singlePinZoom}
777
- * by default.
755
+ * @param controlEnabled - Whether the user can interact with the map
778
756
  */
779
- fitCoordinates(coordinates: any, animated?: boolean | undefined, maxZoom?: number | undefined): void;
757
+ withControlEnabled(controlEnabled: boolean): ProviderMapOptions;
780
758
  /**
781
- * Get the current visible region of the map. If the map is zoomed out to show multiple copies of
782
- * the world, the longitude bounds will be outside [-180, 180) but the center will always be
783
- * within [-180, 180).
784
- * @returns {module:@yext/components-tsx-geo~GeoBounds}
759
+ * @param panHandler - Function called after the map bounds change
785
760
  */
786
- getBounds(): any;
761
+ withPanHandler(panHandler: PanHandler): ProviderMapOptions;
787
762
  /**
788
- * @returns {module:@yext/components-tsx-geo~Coordinate} The center of the current visible region of
789
- * the map
763
+ * @param panStartHandler - Function called before the map bounds change
790
764
  */
791
- getCenter(): any;
765
+ withPanStartHandler(panStartHandler: PanStartHandler): ProviderMapOptions;
792
766
  /**
793
- * Intended for internal use only
794
- * @returns {module:@yext/components-maps~ProviderMap} The map's {@link module:@yext/components-maps~ProviderMap ProviderMap}
795
- * instance
767
+ * @param providerOptions - A free-form object used to set any additional provider-specific
768
+ * options, usually by passing the object to the map's constructor
796
769
  */
797
- getProviderMap(): any;
770
+ withProviderOptions(providerOptions: object): ProviderMapOptions;
798
771
  /**
799
- * To standardize zoom for all providers, zoom level is calculated with this formula:
800
- * zoom = log2(pixel width of equator) - 8.
801
- * At zoom = 0, the entire world is 256 pixels wide.
802
- * At zoom = 1, the entire world is 512 pixels wide.
803
- * Zoom 2 → 1024 pixels, zoom 3 → 2056 pixels, etc.
804
- * Negative and non-integer zoom levels are valid and follow the formula.
805
- * @returns {number} The current zoom level of the map
772
+ * @returns An instance of a subclass of {@link ProviderMap}
773
+ * for the given {@link MapProvider}
774
+ */
775
+ build(): ProviderMap;
776
+ }
777
+ /**
778
+ * This class is an interface that should be implemented for each map provider, such as Google Maps.
779
+ * It is used as an API for a {@link Map} to control a
780
+ * provider-specific map instance. Ideally, this class should have minimal functionality so that
781
+ * adding a new provider is easy and behavior is as consistent as possible across all providers.
782
+ */
783
+ declare class ProviderMap {
784
+ /**
785
+ * The constructor creates a map instance using the provider's API and initializes it with all the
786
+ * given options. See {@link ProviderMapOptions}
787
+ * for the supported options.
788
+ */
789
+ _panHandler: PanHandler;
790
+ _panStartHandler: PanStartHandler;
791
+ constructor(options: ProviderMapOptions);
792
+ /**
793
+ * The current center of the map
794
+ */
795
+ getCenter(): Coordinate$1;
796
+ /**
797
+ * Zoom level complies with the specifications in {@link Map#getZoom}
798
+ * @returns The current zoom level of the map
806
799
  */
807
800
  getZoom(): number;
808
801
  /**
809
- * Returns when the map is not moving.
810
- * Use map.idle().then(callback) to run callback immediately if the map is currently idle or once
811
- * the map becomes idle if it's not.
802
+ * @param coordinate - The new center for the map
803
+ * @param animated - Whether to transition smoothly to the new center
812
804
  */
813
- idle(): Promise<void>;
805
+ setCenter(_: Coordinate$1, __: boolean): void;
814
806
  /**
815
- * Returns when the map is moving.
816
- * Use map.moving().then(callback) to run callback immediately if the map is currently moving or
817
- * once the map starts moving if it's not.
807
+ * Zoom level complies with the specifications in {@link Map#getZoom}
808
+ * @param zoom - The new zoom level for the map
809
+ * @param animated - Whether to transition smoothly to the new zoom
818
810
  */
819
- moving(): Promise<void>;
811
+ setZoom(_: number, __: boolean): void;
820
812
  /**
821
- * @returns {module:@yext/components-maps~MapPinOptions} A {@link module:@yext/components-maps~MapPinOptions MapPinOptions}
822
- * instance with the same provider as this map
813
+ * @param center - Must be convertible to {@link Coordinate}
814
+ * @param animated - Whether to transition smoothly to the new bounds
815
+ * @see ProviderMap#setZoom
816
+ * @see ProviderMap#setCenter
817
+ */
818
+ setZoomCenter(zoom: number, center: Coordinate$1, animated: boolean): void;
819
+ }
820
+
821
+ /**
822
+ * {@link ProviderPin} options class
823
+ */
824
+ declare class ProviderPinOptions {
825
+ providerPinClass: typeof ProviderPin;
826
+ clickHandler: PinClickHandler;
827
+ focusHandler: PinFocusHandler;
828
+ hoverHandler: PinHoverHandler;
829
+ icons: {
830
+ [key: string]: string;
831
+ };
832
+ hasPinUrl: boolean;
833
+ constructor(provider: MapProvider);
834
+ /**
835
+ * @param clickHandler - Function called when the pin is clicked
823
836
  */
824
- newPinOptions(): any;
837
+ withClickHandler(clickHandler: PinClickHandler): ProviderPinOptions;
825
838
  /**
826
- * Called when the map has finished moving, at most once per animation frame.
827
- * Passes the current and previous bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanHandler MapOptions#withPanHandler}
839
+ * @param focusHandler - Function called when the pin becomes (un)focused
828
840
  */
829
- panHandler(): void;
841
+ withFocusHandler(focusHandler: PinFocusHandler): ProviderPinOptions;
830
842
  /**
831
- * Called when the map has started moving, at most once per animation frame.
832
- * Passes the current bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanStartHandler MapOptions#withPanStartHandler}
843
+ * @param hoverHandler - Function called when the pin becomes (un)hovered
833
844
  */
834
- panStartHandler(): void;
845
+ withHoverHandler(hoverHandler: PinHoverHandler): ProviderPinOptions;
835
846
  /**
836
- * @param {Object} bounds
837
- * @param {Object} bounds.ne The northeast corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
838
- * @param {Object} bounds.sw The southwest corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
839
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
840
- * @param {Object} [padding={}]
841
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
842
- * pixels between the map's bottom edge and a pin
843
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
844
- * pixels between the map's left edge and a pin
845
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
846
- * pixels between the map's right edge and a pin
847
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
848
- * pixels between the map's top edge and a pin
849
- * @param {number} [maxZoom=Infinity]
850
- */
851
- setBounds({ ne, sw }: {
852
- ne: Object;
853
- sw: Object;
854
- }, animated?: boolean | undefined, padding?: Object | undefined, maxZoom?: number | undefined): void;
855
- /**
856
- * @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
857
- * @param {boolean} [animated=false] Whether to transition smoothly to the new center
858
- */
859
- setCenter(coordinate: Object, animated?: boolean | undefined): void;
860
- /**
861
- * Padding is used by {@link module:@yext/components-maps~Map#fitCoordinates Map#fitCoordinates}.
862
- * Padding can either be constant values or funtions that return a padding value.
863
- * Constant values are good if the map should always have the same padding on every breakpoint.
864
- * Functions are useful if the map should have different padding at different breakpoints/layouts.
865
- * The function can check window.innerWidth or any other condition before returning a number.
866
- * @param {Object} padding
867
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
868
- * pixels between the map's bottom edge and a pin
869
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
870
- * pixels between the map's left edge and a pin
871
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
872
- * pixels between the map's right edge and a pin
873
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
874
- * pixels between the map's top edge and a pin
875
- * @returns {module:@yext/components-maps~Map}
847
+ * Similar to {@link MapPinOptions#withIcon},
848
+ * but all icons are given as a map of key =\> icon. If a provider pin instance needs an icon to be
849
+ * a specialized class rather than a simple URL, the icons in this object can be converted in this
850
+ * function and assigned back to the icons object instead of being recreated from the URL every
851
+ * time the pin's icon changes.
852
+ * @param icons - Map of a string key to the URL or data URI of an image
876
853
  */
877
- setPadding({ bottom, left, right, top, }: Object): any;
854
+ withIcons(icons: {
855
+ [key: string]: string;
856
+ }): ProviderPinOptions;
878
857
  /**
879
- * @param {module:@yext/components-maps~Map~panHandler} panHandler
858
+ * @param hasPinUrl - Pass through from MapPin class
859
+ * @returns
880
860
  */
881
- setPanHandler(panHandler: any): void;
882
- _panHandler: any;
861
+ withHasPinUrl(hasPinUrl: boolean): this;
883
862
  /**
884
- * @param {module:@yext/components-maps~Map~panStartHandler} panStartHandler
863
+ * @returns An instance of a subclass of {@link ProviderPin}
864
+ * for the given {@link MapProvider}
885
865
  */
886
- setPanStartHandler(panStartHandler: any): void;
887
- _panStartHandler: any;
866
+ build(): ProviderPin;
867
+ }
868
+ /**
869
+ * This class is an interface that should be implemented for each map provider, such as Google Maps.
870
+ * It is used as an API for a {@link MapPin} to control a
871
+ * provider-specific pin instance. Ideally, this class should have minimal functionality so that
872
+ * adding a new provider is easy and behavior is as consistent as possible across all providers.
873
+ */
874
+ declare class ProviderPin {
875
+ _clickHandler: PinClickHandler;
876
+ _focusHandler: PinFocusHandler;
877
+ _hoverHandler: PinHoverHandler;
878
+ _icons: {
879
+ [key: string]: string;
880
+ };
888
881
  /**
889
- * @param {number} zoom
890
- * @param {boolean} [animated=false] Whether to transition smoothly to the new zoom
891
- * @see module:@yext/components-maps~Map#getZoom
882
+ * The constructor creates a pin instance using the provider's API and initializes it with all the
883
+ * given options. See {@link ProviderPinOptions}
884
+ * for the supported options.
892
885
  */
893
- setZoom(zoom: number, animated?: boolean | undefined): void;
886
+ constructor(options: ProviderPinOptions);
894
887
  /**
895
- * @param {number} zoom
896
- * @param {Object} center Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
897
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
898
- * @see module:@yext/components-maps~Map#setZoom
899
- * @see module:@yext/components-maps~Map#setCenter
888
+ * @param coordinate - The position of the pin
900
889
  */
901
- setZoomCenter(zoom: number, center: Object, animated?: boolean | undefined): void;
890
+ setCoordinate(_: Coordinate$1): void;
902
891
  /**
903
- * Set the map state to idle
904
- * @protected
892
+ * Remove the pin from its current map and, if newMap is not null, add it to the new map.
893
+ * @param newMap - The new map -- if null, the pin will not be
894
+ * shown on any map
895
+ * @param currentMap - The current map -- if null, the pin is
896
+ * not shown on any map
905
897
  */
906
- protected _setIdle(): void;
907
- _movingPromise: Promise<any> | undefined;
898
+ setMap(_: Map$1 | null, __: Map$1 | null): void;
908
899
  /**
909
- * Set the map state to moving
910
- * @protected
900
+ * Apply the given properties to modify the appearance of the pin.
901
+ * @see PinProperties
902
+ */
903
+ setProperties(_: PinProperties): void;
904
+ }
905
+
906
+ type ProviderLoadFunction = (resolve: () => void, reject: () => void, apiKey: string, options: object) => void;
907
+ /**
908
+ * {@link MapProvider} options class
909
+ */
910
+ declare class MapProviderOptions {
911
+ loadFunction: ProviderLoadFunction;
912
+ mapClass: typeof ProviderMap;
913
+ pinClass: typeof ProviderPin;
914
+ providerName: string;
915
+ constructor();
916
+ withLoadFunction(loadFunction: ProviderLoadFunction): MapProviderOptions;
917
+ /**
918
+ * @param mapClass - Subclass of {@link ProviderMap}
919
+ * for the provider
920
+ */
921
+ withMapClass(mapClass: typeof ProviderMap): MapProviderOptions;
922
+ /**
923
+ * @param pinClass - Subclass of {@link ProviderPin} for the provider
924
+ */
925
+ withPinClass(pinClass: typeof ProviderPin): MapProviderOptions;
926
+ /**
927
+ * @param providerName - Name of the map provider
928
+ */
929
+ withProviderName(providerName: string): MapProviderOptions;
930
+ build(): MapProvider;
931
+ }
932
+ /**
933
+ * This class is used for loading the API for a map provider such as Google Maps and creating {@link ProviderMap}
934
+ * and {@link ProviderPin} instances.
935
+ * Provider map implementations return an instance of this class for their provider that you can use
936
+ * to load the API and pass in to {@link MapOptions} and {@link MapPinOptions} objects as the provider.
937
+ * Example using {@link GoogleMaps}, an instance of this
938
+ * class: GoogleMaps.load().then(() =\> map = new MapOptions().withProvider(GoogleMaps).build());
939
+ */
940
+ declare class MapProvider {
941
+ _loadFunction: ProviderLoadFunction;
942
+ _mapClass: typeof ProviderMap;
943
+ _pinClass: typeof ProviderPin;
944
+ _providerName: string;
945
+ _loadPromise: Promise<void>;
946
+ _resolveLoad?: () => void;
947
+ _rejectLoad?: () => void;
948
+ _apiKey: string;
949
+ _loadInvoked: boolean;
950
+ _loaded: boolean;
951
+ _options: any;
952
+ constructor(options: MapProviderOptions);
953
+ /**
954
+ * Returns true if the map provider has been successfully loaded
955
+ */
956
+ get loaded(): boolean;
957
+ /**
958
+ * @see ~MapProviderOptions#withMapClass
959
+ */
960
+ getMapClass(): typeof ProviderMap;
961
+ /**
962
+ * @see MapProviderOptions#withPinClass
963
+ */
964
+ getPinClass(): typeof ProviderPin;
965
+ /**
966
+ * @see MapProviderOptions#withProviderName
967
+ */
968
+ getProviderName(): string;
969
+ /**
970
+ * Call {@link loadFunction}
971
+ * and resolve or reject when loading succeeds or fails
972
+ * @param apiKey - Provider API key -- uses value from {@link MapProvider#setLoadOptions}
973
+ * if not passed
974
+ * @param options - Additional provider-specific options -- uses value from {@link MapProvider#setLoadOptions}
975
+ * if not passed
976
+ */
977
+ load(apiKey?: string, options?: any): Promise<void>;
978
+ /**
979
+ * Resolves or rejects when the map provider has loaded successfully or unsuccessfully
980
+ */
981
+ ready(): Promise<void>;
982
+ /**
983
+ * Set the API key and provider options used on load. Does nothing if load was already called.
984
+ * @param apiKey - Provider API key
985
+ * @param options - Additional provider-specific options
986
+ */
987
+ setLoadOptions(apiKey: string, options?: object | null): void;
988
+ }
989
+
990
+ /**
991
+ * This class is used to set the appearance of a {@link MapPin}.
992
+ * Most properties are supported by all providers, but some are only supported by providers that
993
+ * implement {@link HTMLProviderPin}.
994
+ */
995
+ declare class PinProperties {
996
+ _anchorX: number;
997
+ _anchorY: number;
998
+ _height: number;
999
+ _icon: string;
1000
+ _srText: string;
1001
+ _width: number;
1002
+ _zIndex: number;
1003
+ _class: string;
1004
+ _element: HTMLElement | null;
1005
+ constructor();
1006
+ /**
1007
+ * @returns The point in the pin that should be positioned over the coordinate, from 0
1008
+ * (left edge) to 1 (right edge)
1009
+ */
1010
+ getAnchorX(): number;
1011
+ /**
1012
+ * @returns The point in the pin that should be positioned over the coordinate, from 0
1013
+ * (top edge) to 1 (bottom edge)
1014
+ */
1015
+ getAnchorY(): number;
1016
+ /**
1017
+ * {@link HTMLProviderPins} only
1018
+ * @returns The class of the wrapper element for an HTML pin
1019
+ */
1020
+ getClass(): string;
1021
+ /**
1022
+ * {@link HTMLProviderPins} only
1023
+ * @returns The HTML pin element
1024
+ */
1025
+ getElement(): HTMLElement | null;
1026
+ /**
1027
+ * @returns The pixel height of the pin
1028
+ */
1029
+ getHeight(): number;
1030
+ /**
1031
+ * This returns a string key that can be used with {@link MapPin#getIcon}
1032
+ * to get the icon image for a pin.
1033
+ * @returns The unique name of the icon
1034
+ */
1035
+ getIcon(): string;
1036
+ /**
1037
+ * @returns The text that a screen reader reads when focused on the pin
1038
+ */
1039
+ getSRText(): string;
1040
+ /**
1041
+ * @returns The pixel width of the pin
1042
+ */
1043
+ getWidth(): number;
1044
+ /**
1045
+ * @returns The z-index of the pin
1046
+ */
1047
+ getZIndex(): number;
1048
+ /**
1049
+ * @see PinProperties#getAnchorX
1050
+ */
1051
+ setAnchorX(anchorX: number): PinProperties;
1052
+ /**
1053
+ * @see PinProperties#getAnchorY
1054
+ */
1055
+ setAnchorY(anchorY: number): PinProperties;
1056
+ /**
1057
+ * @see PinProperties#getClass
1058
+ */
1059
+ setClass(className: string): PinProperties;
1060
+ /**
1061
+ * @see PinProperties#getElement
1062
+ */
1063
+ setElement(element: HTMLElement): PinProperties;
1064
+ /**
1065
+ * @see PinProperties#getHeight
1066
+ */
1067
+ setHeight(height: number): PinProperties;
1068
+ /**
1069
+ * @see PinProperties#getIcon
1070
+ */
1071
+ setIcon(icon: string): PinProperties;
1072
+ /**
1073
+ * @see PinProperties#getSRText
1074
+ */
1075
+ setSRText(srText: string): PinProperties;
1076
+ /**
1077
+ * @see PinProperties#getWidth
1078
+ */
1079
+ setWidth(width: number): PinProperties;
1080
+ /**
1081
+ * @see PinProperties#getZIndex
911
1082
  */
912
- protected _setMoving(): void;
1083
+ setZIndex(zIndex: number): PinProperties;
913
1084
  }
914
1085
 
1086
+ type PropertiesForStatus = (status: object) => PinProperties;
1087
+ type PinClickHandler = () => void;
1088
+ type PinFocusHandler = (focused: boolean) => void;
1089
+ type PinHoverHandler = (hovered: boolean) => void;
1090
+ /**
1091
+ * {@link MapPin} options class
1092
+ */
1093
+ declare class MapPinOptions {
1094
+ /**
1095
+ * Initialize with default options
1096
+ */
1097
+ coordinate: Coordinate$1;
1098
+ hideOffscreen: boolean;
1099
+ icons: {
1100
+ [key: string]: string;
1101
+ };
1102
+ propertiesForStatus: PropertiesForStatus;
1103
+ provider: MapProvider | null;
1104
+ type: string;
1105
+ hasPinUrl: boolean;
1106
+ constructor();
1107
+ /**
1108
+ * @param coordinate - Must be convertible to {@link Coordinate}
1109
+ */
1110
+ withCoordinate(coordinate: Coordinate$1): MapPinOptions;
1111
+ /**
1112
+ * @param hideOffscreen - If true, the pin will only be rendered if it's in the visible
1113
+ * portion of the map to improve performance
1114
+ */
1115
+ withHideOffscreen(hideOffscreen: boolean): MapPinOptions;
1116
+ /**
1117
+ * @param key - The unique name for the icon, used in {@link PinProperties#getIcon}
1118
+ * and {@link PinProperties#setIcon}
1119
+ * @param icon - The URL or data URI of the icon image
1120
+ */
1121
+ withIcon(key: string, icon: string): MapPinOptions;
1122
+ withPropertiesForStatus(propertiesForStatus: PropertiesForStatus): MapPinOptions;
1123
+ withProvider(provider: MapProvider | null): MapPinOptions;
1124
+ /**
1125
+ * @param hasPinUrl - If true, the pin's HTML element will be a div instead of a button since there is a nested anchor tag within the pin. This will fix current accessibility issues.
1126
+ */
1127
+ withHasPinUrl(hasPinUrl: boolean): MapPinOptions;
1128
+ /**
1129
+ * @param type - A string describing the type of the pin
1130
+ */
1131
+ withType(type: string): MapPinOptions;
1132
+ build(): MapPin;
1133
+ }
915
1134
  /**
916
- * A pin for a {@link module:@yext/components-maps~Map Map} that displays at a given {@link module:@yext/components-tsx-geo~Coordinate Coordinate}.
1135
+ * A pin for a {@link Map} that displays at a given {@link Coordinate}.
917
1136
  * A MapPin can be displayed on at most one Map at a time. Pins support event handlers for clicking,
918
1137
  * hovering, and focusing. The pin can change its appearance based on its current status, which is
919
- * changed by {@link module:@yext/components-maps~MapPin#setStatus setStatus}.
1138
+ * changed by {@link setStatus}.
920
1139
  */
921
1140
  declare class MapPin {
922
- /**
923
- * @param {module:@yext/components-maps~MapPinOptions} options
924
- */
925
- constructor(options: any);
926
- _coordinate: any;
927
- _hideOffscreen: any;
928
- _icons: any;
929
- _propertiesForStatus: any;
930
- _type: any;
931
- _clickHandler: () => null;
932
- _focusHandler: (focused: any) => null;
933
- _hoverHandler: (hovered: any) => null;
1141
+ _coordinate: Coordinate$1;
1142
+ _hideOffscreen: boolean;
1143
+ _icons: {
1144
+ [key: string]: string;
1145
+ };
1146
+ _propertiesForStatus: PropertiesForStatus;
1147
+ _type: string;
1148
+ _clickHandler: PinClickHandler;
1149
+ _focusHandler: PinFocusHandler;
1150
+ _hoverHandler: PinHoverHandler;
934
1151
  _hidden: boolean;
935
- _cancelHiddenUpdater: () => null;
936
- _map: any;
937
- _pin: any;
938
- _status: {};
1152
+ _cancelHiddenUpdater: () => void;
1153
+ _map: Map$1 | null;
1154
+ _pin: ProviderPin;
1155
+ _status: object;
1156
+ constructor(options: MapPinOptions);
939
1157
  /**
940
- * @returns {module:@yext/components-tsx-geo~Coordinate} The coordinate of the pin
1158
+ * @returns The coordinate of the pin
941
1159
  */
942
- getCoordinate(): any;
1160
+ getCoordinate(): Coordinate$1;
943
1161
  /**
944
1162
  * Get the icon for a string key, such as 'default', 'hovered', or 'selected'
945
- * @param {string} key The unique name of the icon
946
- * @returns {string} The URL or data URI of the icon image
947
- * @see module:@yext/components-maps~MapPinOptions#withIcon
1163
+ * @param key - The unique name of the icon
1164
+ * @returns The URL or data URI of the icon image
1165
+ * @see MapPinOptions#withIcon
948
1166
  */
949
1167
  getIcon(key: string): string;
950
1168
  /**
951
- * @returns {module:@yext/components-maps~Map} The map that the pin is currently on, or null if
1169
+ * @returns The map that the pin is currently on, or null if
952
1170
  * not on a map
953
1171
  */
954
- getMap(): any;
1172
+ getMap(): Map$1 | null;
955
1173
  /**
956
1174
  * Intended for internal use only
957
- * @returns {module:@yext/components-maps~ProviderPin} The pin's {@link module:@yext/components-maps~ProviderPin ProviderPin}
1175
+ * @returns The pin's {@link ProviderPin}
958
1176
  * instance
959
1177
  */
960
- getProviderPin(): any;
1178
+ getProviderPin(): ProviderPin;
961
1179
  /**
962
- * @returns {string} The string describing the type of pin
1180
+ * @returns The string describing the type of pin
963
1181
  */
964
1182
  getType(): string;
965
1183
  /**
@@ -968,107 +1186,269 @@ declare class MapPin {
968
1186
  remove(): void;
969
1187
  /**
970
1188
  * Set a handler function for when the pin is clicked, replacing any previously set click handler.
971
- * @param {module:@yext/components-maps~PinClickHandler} clickHandler
972
1189
  */
973
- setClickHandler(clickHandler: any): void;
1190
+ setClickHandler(clickHandler: PinClickHandler): void;
974
1191
  /**
975
- * @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
1192
+ * @param coordinate - Must be convertible to {@link Coordinate}
976
1193
  */
977
- setCoordinate(coordinate: Object): void;
1194
+ setCoordinate(coordinate: Coordinate$1): void;
978
1195
  /**
979
1196
  * Set a handler function for when the pin is (un)focused, replacing any previously set focus handler.
980
- * @param {module:@yext/components-maps~PinFocusHandler} focusHandler
981
1197
  */
982
- setFocusHandler(focusHandler: any): void;
1198
+ setFocusHandler(focusHandler: PinFocusHandler): void;
983
1199
  /**
984
1200
  * Set a handler function for when the pin is (un)hovered, replacing any previously set hover handler.
985
- * @param {module:@yext/components-maps~PinHoverHandler} hoverHandler
986
1201
  */
987
- setHoverHandler(hoverHandler: any): void;
1202
+ setHoverHandler(hoverHandler: PinHoverHandler): void;
988
1203
  /**
989
1204
  * Add the pin to a map, removing it from its current map if on one.
990
- * @param {?Map} map
991
1205
  */
992
1206
  setMap(map: Map$1 | null): void;
993
1207
  /**
994
1208
  * Assign all properties in an object to the pin's status.
995
- * Example: if the pin's status is { a: true, b: true }, passing in { a: false, c: true } will
996
- * change the pin's status to { a: false, b: true, c: true }
997
- * @param {Object} status
1209
+ * Example: if the pin's status is \{ a: true, b: true \}, passing in \{ a: false, c: true \} will
1210
+ * change the pin's status to \{ a: false, b: true, c: true \}
998
1211
  */
999
- setStatus(status: Object): void;
1212
+ setStatus(status: object): void;
1000
1213
  /**
1001
1214
  * Add or remove the pin from the map based on whether its coordinate is within the current bounds
1002
- * @protected
1003
1215
  */
1004
- protected _hideIfOffscreen(): void;
1216
+ _hideIfOffscreen(): void;
1005
1217
  }
1006
1218
 
1219
+ type PaddingFunction = () => number;
1220
+ type PanHandler = (previousBounds?: GeoBounds, currentBounds?: GeoBounds) => void;
1221
+ type PanStartHandler = (currentBounds?: GeoBounds) => void;
1222
+ type PaddingObject = {
1223
+ bottom?: number | PaddingFunction;
1224
+ left?: number | PaddingFunction;
1225
+ right?: number | PaddingFunction;
1226
+ top?: number | PaddingFunction;
1227
+ };
1007
1228
  /**
1008
- * This class is used for loading the API for a map provider such as Google Maps and creating {@link module:@yext/components-maps~ProviderMap ProviderMap}
1009
- * and {@link module:@yext/components-maps~ProviderPin ProviderPin} instances.
1010
- * Provider map implementations return an instance of this class for their provider that you can use
1011
- * to load the API and pass in to {@link module:@yext/components-maps~MapOptions MapOptions} and {@link module:@yext/components-maps~MapPinOptions MapPinOptions} objects as the provider.
1012
- * Example using {@link module:@yext/components-maps~GoogleMaps GoogleMaps}, an instance of this
1013
- * class: GoogleMaps.load().then(() => map = new MapOptions().withProvider(GoogleMaps).build());
1229
+ * {@link Map} options class
1014
1230
  */
1015
- declare class MapProvider {
1231
+ declare class MapOptions {
1232
+ controlEnabled: boolean;
1233
+ defaultCenter: Coordinate$1;
1234
+ defaultZoom: number;
1235
+ legendPins: MapPin[];
1236
+ padding: PaddingObject;
1237
+ panHandler: PanHandler;
1238
+ panStartHandler: PanStartHandler;
1239
+ provider: MapProvider | null;
1240
+ providerOptions: ProviderMapOptions | object;
1241
+ singlePinZoom: number;
1242
+ wrapper: HTMLElement | null;
1016
1243
  /**
1017
- * @param {module:@yext/components-maps~MapProviderOptions} options
1244
+ * Initialize with default options
1018
1245
  */
1019
- constructor(options: any);
1020
- _loadFunction: any;
1021
- _mapClass: any;
1022
- _pinClass: any;
1023
- _providerName: any;
1024
- _loadPromise: Promise<any>;
1025
- _resolveLoad: (value: any) => void;
1026
- _rejectLoad: (reason?: any) => void;
1027
- _apiKey: string;
1028
- _loadInvoked: boolean;
1029
- _loaded: boolean;
1030
- _options: {};
1246
+ constructor();
1031
1247
  /**
1032
- * Returns true if the map provider has been successfully loaded
1033
- * @type {boolean}
1248
+ * @param controlEnabled - Whether the user can move and zoom the map
1034
1249
  */
1035
- get loaded(): boolean;
1250
+ withControlEnabled(controlEnabled: boolean): MapOptions;
1036
1251
  /**
1037
- * @returns {module:@yext/components-maps~ProviderMap}
1038
- * @see module:@yext/components-maps~MapProviderOptions#withMapClass
1252
+ * @param defaultCenter - The center on initial load and
1253
+ * when calling {@link Map#fitCoordinates} with an empty array
1039
1254
  */
1040
- getMapClass(): any;
1255
+ withDefaultCenter(defaultCenter: Coordinate$1): MapOptions;
1041
1256
  /**
1042
- * @returns {module:@yext/components-maps~ProviderPin}
1043
- * @see module:@yext/components-maps~MapProviderOptions#withPinClass
1257
+ * @param defaultZoom - The zoom on initial load and when calling {@link Map#fitCoordinates}
1258
+ * with an empty array
1044
1259
  */
1045
- getPinClass(): any;
1260
+ withDefaultZoom(defaultZoom: number): MapOptions;
1046
1261
  /**
1047
- * @returns {string}
1048
- * @see module:@yext/components-maps~MapProviderOptions#withProviderName
1262
+ * GENERATOR TODO Map legend not yet implemented
1263
+ * @param legendPins - Pins used to construct the map legend
1049
1264
  */
1050
- getProviderName(): string;
1265
+ withLegendPins(legendPins: MapPin[]): MapOptions;
1051
1266
  /**
1052
- * Call {@link module:@yext/components-maps~MapPinOptions~loadFunction MapPinOptions~loadFunction}
1053
- * and resolve or reject when loading succeeds or fails
1054
- * @async
1055
- * @param {string} [apiKey] Provider API key -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
1056
- * if not passed
1057
- * @param {Object} [options] Additional provider-specific options -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
1058
- * if not passed
1267
+ * Padding is used by {@link Map#fitCoordinates}.
1268
+ * Padding can either be constant values or funtions that return a padding value.
1269
+ * See {@link Map#setPadding} for more information.
1270
+ * @see {@link Map#setPadding}
1059
1271
  */
1060
- load(apiKey?: string | undefined, options?: Object | undefined): Promise<void>;
1272
+ withPadding(padding: {
1273
+ bottom: number | PaddingFunction;
1274
+ left: number | PaddingFunction;
1275
+ right: number | PaddingFunction;
1276
+ top: number | PaddingFunction;
1277
+ }): MapOptions;
1278
+ withPanHandler(panHandler: PanHandler): MapOptions;
1279
+ withPanStartHandler(panStartHandler: PanStartHandler): MapOptions;
1061
1280
  /**
1062
- * Resolves or rejects when the map provider has loaded successfully or unsuccessfully
1063
- * @async
1281
+ * The {@link MapProvider} must be loaded before
1282
+ * constructing the {@link Map}.
1064
1283
  */
1065
- ready(): Promise<void>;
1284
+ withProvider(provider: MapProvider): MapOptions;
1066
1285
  /**
1067
- * Set the API key and provider options used on load. Does nothing if load was already called.
1068
- * @param {string} apiKey Provider API key
1069
- * @param {?Object} [options=null] Additional provider-specific options
1286
+ * @param providerOptions - A free-form object used to set any additional provider-specific
1287
+ * options in the {@link ProviderMap}
1288
+ */
1289
+ withProviderOptions(providerOptions: object): MapOptions;
1290
+ /**
1291
+ * @param singlePinZoom - The zoom when calling {@link Map#fitCoordinates}
1292
+ * with an array containing one coordinate
1293
+ */
1294
+ withSinglePinZoom(singlePinZoom: number): MapOptions;
1295
+ /**
1296
+ * @param wrapper - The wrapper element that the map will be inserted into. The
1297
+ * existing contents of the element will be removed.
1070
1298
  */
1071
- setLoadOptions(apiKey: string, options?: Object | null | undefined): void;
1299
+ withWrapper(wrapper: HTMLElement | null): MapOptions;
1300
+ build(): Map$1;
1301
+ }
1302
+ /**
1303
+ * An interactive map that supports various map providers, such as Google Maps and Mapbox, with a
1304
+ * single API. Code written using this class functions approximately the same regardless of the map
1305
+ * provider used. Any map provider can be supported via an instance of {@link MapProvider}.
1306
+ */
1307
+ declare class Map$1 {
1308
+ /**
1309
+ * The {@link MapProvider} for the map must be loaded
1310
+ * before calling this constructor.
1311
+ */
1312
+ _defaultCenter: Coordinate$1;
1313
+ _defaultZoom: number;
1314
+ _legendPins: MapPin[];
1315
+ _padding: PaddingObject;
1316
+ _provider: MapProvider | null;
1317
+ _singlePinZoom: number;
1318
+ _wrapper: HTMLElement | null;
1319
+ _cachedBounds: GeoBounds | null;
1320
+ _resolveIdle: () => void;
1321
+ _resolveMoving: () => void;
1322
+ _idlePromise: Promise<void>;
1323
+ _panHandlerRunning: boolean;
1324
+ _panStartHandlerRunning: boolean;
1325
+ _currentBounds: GeoBounds;
1326
+ _movingPromise?: Promise<void>;
1327
+ _panHandler?: PanHandler;
1328
+ _panStartHandler?: PanStartHandler;
1329
+ _map: ProviderMap;
1330
+ constructor(options: MapOptions);
1331
+ /**
1332
+ * Set the map bounds so that all the given coordinates are within the {@link padded}
1333
+ * view.
1334
+ * @param animated - Whether to transition smoothly to the new bounds
1335
+ * @param maxZoom - The max zoom level after fitting. Uses {@link singlePinZoom}
1336
+ * by default.
1337
+ */
1338
+ fitCoordinates(coordinates: Coordinate$1[], animated?: boolean, maxZoom?: number): void;
1339
+ /**
1340
+ * Get the current visible region of the map. If the map is zoomed out to show multiple copies of
1341
+ * the world, the longitude bounds will be outside [-180, 180) but the center will always be
1342
+ * within [-180, 180).
1343
+ */
1344
+ getBounds(): GeoBounds;
1345
+ /**
1346
+ * @returns The center of the current visible region of
1347
+ * the map
1348
+ */
1349
+ getCenter(): Coordinate$1;
1350
+ /**
1351
+ * Intended for internal use only
1352
+ * @returns The map's {@link ProviderMap}
1353
+ * instance
1354
+ */
1355
+ getProviderMap(): ProviderMap;
1356
+ /**
1357
+ * To standardize zoom for all providers, zoom level is calculated with this formula:
1358
+ * zoom = log2(pixel width of equator) - 8.
1359
+ * At zoom = 0, the entire world is 256 pixels wide.
1360
+ * At zoom = 1, the entire world is 512 pixels wide.
1361
+ * Zoom 2 → 1024 pixels, zoom 3 → 2056 pixels, etc.
1362
+ * Negative and non-integer zoom levels are valid and follow the formula.
1363
+ * @returns The current zoom level of the map
1364
+ */
1365
+ getZoom(): number;
1366
+ /**
1367
+ * Returns when the map is not moving.
1368
+ * Use map.idle().then(callback) to run callback immediately if the map is currently idle or once
1369
+ * the map becomes idle if it's not.
1370
+ */
1371
+ idle(): Promise<void>;
1372
+ /**
1373
+ * Returns when the map is moving.
1374
+ * Use map.moving().then(callback) to run callback immediately if the map is currently moving or
1375
+ * once the map starts moving if it's not.
1376
+ */
1377
+ moving(): Promise<void>;
1378
+ /**
1379
+ * @returns A {@link MapPinOptions}
1380
+ * instance with the same provider as this map
1381
+ */
1382
+ newPinOptions(): MapPinOptions;
1383
+ /**
1384
+ * Called when the map has finished moving, at most once per animation frame.
1385
+ * Passes the current and previous bounds to the custom pan handler given by {@link MapOptions#withPanHandler}
1386
+ */
1387
+ panHandler(): void;
1388
+ /**
1389
+ * Called when the map has started moving, at most once per animation frame.
1390
+ * Passes the current bounds to the custom pan handler given by {@link MapOptions#withPanStartHandler}
1391
+ */
1392
+ panStartHandler(): void;
1393
+ /**
1394
+ * @param bounds - bounds.ne: The northeast corner of the bounds -- must be convertible to {@link Coordinate}
1395
+ * bounds.se: The southwest corner of the bounds -- must be convertible to {@link Coordinate}
1396
+ * @param animated - Whether to transition smoothly to the new bounds
1397
+ * @param padding - padding.bottom: Minimum number of pixels between the map's bottom edge and a pin
1398
+ * padding.left: Minimum number of pixels between the map's left edge and a pin
1399
+ * padding.right: Minimum number of pixels between the map's right edge and a pin
1400
+ * padding.top: Minimum number of pixels between the map's top edge and a pin
1401
+ */
1402
+ setBounds({ ne, sw }: GeoBounds, animated?: boolean, padding?: {
1403
+ bottom?: number | PaddingFunction;
1404
+ left?: number | PaddingFunction;
1405
+ right?: number | PaddingFunction;
1406
+ top?: number | PaddingFunction;
1407
+ }, maxZoom?: number): void;
1408
+ /**
1409
+ * @param coordinate - Must be convertible to {@link Coordinate}
1410
+ * @param animated - Whether to transition smoothly to the new center
1411
+ */
1412
+ setCenter(coordinate: object, animated?: boolean): void;
1413
+ /**
1414
+ * Padding is used by {@link Map#fitCoordinates}.
1415
+ * Padding can either be constant values or funtions that return a padding value.
1416
+ * Constant values are good if the map should always have the same padding on every breakpoint.
1417
+ * Functions are useful if the map should have different padding at different breakpoints/layouts.
1418
+ * The function can check window.innerWidth or any other condition before returning a number.
1419
+ * @param padding - padding.bottom: Minimum number of pixels between the map's bottom edge and a pin
1420
+ * padding.left: Minimum number of pixels between the map's left edge and a pin
1421
+ * padding.right: Minimum number of pixels between the map's right edge and a pin
1422
+ * padding.top: Minimum number of pixels between the map's top edge and a pin
1423
+ */
1424
+ setPadding({ bottom, left, right, top, }: {
1425
+ bottom?: number | PaddingFunction;
1426
+ left?: number | PaddingFunction;
1427
+ right?: number | PaddingFunction;
1428
+ top?: number | PaddingFunction;
1429
+ }): Map$1;
1430
+ setPanHandler(panHandler: PanHandler): void;
1431
+ setPanStartHandler(panStartHandler: PanStartHandler): void;
1432
+ /**
1433
+ * @param animated - Whether to transition smoothly to the new zoom
1434
+ * @see Map#getZoom
1435
+ */
1436
+ setZoom(zoom: number, animated?: boolean): void;
1437
+ /**
1438
+ * @param center - Must be convertible to {@link Coordinate}
1439
+ * @param animated - Whether to transition smoothly to the new bounds
1440
+ * @see Map#setZoom
1441
+ * @see Map#setCenter
1442
+ */
1443
+ setZoomCenter(zoom: number, center: Coordinate$1, animated?: boolean): void;
1444
+ /**
1445
+ * Set the map state to idle
1446
+ */
1447
+ _setIdle(): void;
1448
+ /**
1449
+ * Set the map state to moving
1450
+ */
1451
+ _setMoving(): void;
1072
1452
  }
1073
1453
 
1074
1454
  interface Coordinate {
@@ -1089,14 +1469,14 @@ interface MapProps {
1089
1469
  defaultCenter?: Coordinate;
1090
1470
  defaultZoom?: number;
1091
1471
  mapRef?: React__default.MutableRefObject<Map$1 | null>;
1092
- padding?: number | {
1093
- bottom: number | (() => number);
1094
- left: number | (() => number);
1095
- right: number | (() => number);
1096
- top: number | (() => number);
1472
+ padding?: {
1473
+ bottom: number | PaddingFunction;
1474
+ left: number | PaddingFunction;
1475
+ right: number | PaddingFunction;
1476
+ top: number | PaddingFunction;
1097
1477
  };
1098
- panHandler?: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void;
1099
- panStartHandler?: (currentBounds: GeoBounds) => void;
1478
+ panHandler?: PanHandler;
1479
+ panStartHandler?: PanStartHandler;
1100
1480
  provider?: MapProvider;
1101
1481
  providerOptions?: {
1102
1482
  [key: string]: any;
@@ -1534,31 +1914,33 @@ declare const Product: (document: Record<string, any>, schemaType?: string) => {
1534
1914
  type RTF2 = {
1535
1915
  json?: Record<string, any>;
1536
1916
  };
1537
- type FAQ = {
1917
+ type FAQ = PlainTextFAQ | RichTextFAQ;
1918
+ type PlainTextFAQ = {
1538
1919
  question: string;
1539
1920
  answer: string;
1540
- } | {
1921
+ };
1922
+ type RichTextFAQ = {
1541
1923
  question: string;
1542
1924
  answerV2: RTF2;
1543
1925
  };
1544
1926
  declare const FAQPage: (data: FAQ[]) => {
1545
1927
  "@context": string;
1546
1928
  "@type": string;
1547
- mainEntity: {
1929
+ mainEntity: ({
1548
1930
  "@type": string;
1549
1931
  name: string;
1550
1932
  acceptedAnswer: {
1551
1933
  "@type": string;
1552
1934
  text: string;
1553
1935
  };
1554
- }[];
1936
+ } | undefined)[];
1555
1937
  };
1556
1938
 
1557
1939
  type Location = {
1558
1940
  name?: string;
1559
1941
  address?: AddressType;
1560
1942
  };
1561
- declare const AddressSchema: (address?: AddressType) => {
1943
+ declare const AddressSchema: (address?: AddressType) => false | {
1562
1944
  address: {
1563
1945
  "@type": string;
1564
1946
  streetAddress: string;
@@ -1567,8 +1949,8 @@ declare const AddressSchema: (address?: AddressType) => {
1567
1949
  postalCode: string;
1568
1950
  addressCountry: string;
1569
1951
  };
1570
- } | undefined;
1571
- declare const LocationSchema: (location?: Location) => {
1952
+ };
1953
+ declare const LocationSchema: (location?: Location) => false | {
1572
1954
  address?: {
1573
1955
  "@type": string;
1574
1956
  streetAddress: string;
@@ -1579,7 +1961,7 @@ declare const LocationSchema: (location?: Location) => {
1579
1961
  } | undefined;
1580
1962
  "@type": string;
1581
1963
  name: string | undefined;
1582
- } | undefined;
1964
+ };
1583
1965
 
1584
1966
  declare const OpeningHoursSchema: (hours?: HoursType) => {
1585
1967
  openingHours?: undefined;
@@ -1595,7 +1977,7 @@ type Offer = {
1595
1977
  itemCondition?: string;
1596
1978
  availability?: string;
1597
1979
  };
1598
- declare const OfferSchema: (offer?: Offer) => {
1980
+ declare const OfferSchema: (offer?: Offer) => false | {
1599
1981
  offers: {
1600
1982
  "@type": string;
1601
1983
  url: string | undefined;
@@ -1605,25 +1987,25 @@ declare const OfferSchema: (offer?: Offer) => {
1605
1987
  itemCondition: string | undefined;
1606
1988
  availability: string | undefined;
1607
1989
  };
1608
- } | undefined;
1990
+ };
1609
1991
 
1610
1992
  type Organization = {
1611
1993
  name?: string;
1612
1994
  url?: string;
1613
1995
  };
1614
- declare const PerformerSchema: (performers?: string[]) => {
1996
+ declare const PerformerSchema: (performers?: string[]) => false | {
1615
1997
  performer: {
1616
1998
  "@type": string;
1617
1999
  name: string;
1618
2000
  };
1619
- } | undefined;
1620
- declare const OrganizationSchema: (org?: Organization) => {
2001
+ };
2002
+ declare const OrganizationSchema: (org?: Organization) => false | {
1621
2003
  organizer: {
1622
2004
  "@type": string;
1623
2005
  name: string | undefined;
1624
2006
  url: string | undefined;
1625
2007
  };
1626
- } | undefined;
2008
+ };
1627
2009
 
1628
2010
  type PhotoGallery = Photo[];
1629
2011
  type Photo = {
@@ -1634,9 +2016,9 @@ declare const PhotoGallerySchema: (gallery?: PhotoGallery) => {
1634
2016
  } | {
1635
2017
  image: string[];
1636
2018
  };
1637
- declare const PhotoSchema: (photo?: Photo) => {
2019
+ declare const PhotoSchema: (photo?: Photo) => false | {
1638
2020
  image: string;
1639
- } | undefined;
2021
+ };
1640
2022
 
1641
2023
  type Review = {
1642
2024
  ratingValue?: string;
@@ -1647,7 +2029,7 @@ type AggregateRating = {
1647
2029
  ratingValue?: string;
1648
2030
  reviewCount?: string;
1649
2031
  };
1650
- declare const ReviewSchema: (review?: Review) => {
2032
+ declare const ReviewSchema: (review?: Review) => false | {
1651
2033
  review: {
1652
2034
  "@type": string;
1653
2035
  reviewRating: {
@@ -1660,7 +2042,7 @@ declare const ReviewSchema: (review?: Review) => {
1660
2042
  name: string | undefined;
1661
2043
  };
1662
2044
  };
1663
- } | undefined;
2045
+ };
1664
2046
  declare const AggregateRatingSchema: (rating?: AggregateRating) => {
1665
2047
  aggregateRating: {
1666
2048
  "@type": string;
@@ -1669,34 +2051,16 @@ declare const AggregateRatingSchema: (rating?: AggregateRating) => {
1669
2051
  };
1670
2052
  } | undefined;
1671
2053
 
1672
- /**
1673
- * @type {module:@yext/components-maps~MapProvider}
1674
- */
1675
- declare const BaiduMaps: any;
2054
+ declare const BaiduMaps: MapProvider;
1676
2055
 
1677
- /**
1678
- * @type {module:@yext/components-maps~MapProvider}
1679
- */
1680
- declare const BingMaps: any;
2056
+ declare const BingMaps: MapProvider;
1681
2057
 
1682
- /**
1683
- * @type {module:@yext/components-maps~MapProvider}
1684
- */
1685
- declare const GoogleMaps: any;
2058
+ declare const GoogleMaps: MapProvider;
1686
2059
 
1687
- /**
1688
- * @type {module:@yext/components-maps~MapProvider}
1689
- */
1690
- declare const MapboxMaps: any;
2060
+ declare const MapboxMaps: MapProvider;
1691
2061
 
1692
- /**
1693
- * @type {module:@yext/components-maps~MapProvider}
1694
- */
1695
- declare const LeafletMaps: any;
2062
+ declare const LeafletMaps: MapProvider;
1696
2063
 
1697
- /**
1698
- * @type {module:@yext/components-maps~MapProvider}
1699
- */
1700
- declare const MapQuestMaps: any;
2064
+ declare const MapQuestMaps: MapProvider;
1701
2065
 
1702
2066
  export { Address, type AddressLine, type AddressLineProps, type AddressProps, AddressSchema, type AddressType, type AggregateRating, AggregateRatingSchema, Analytics, AnalyticsContext, AnalyticsProvider, AnalyticsScopeProvider, BaiduMaps, BaseSchema, BingMaps, type CTA, type CTAWithChildrenLinkProps, type CTAWithoutChildrenLinkProps, type ClusterTemplateProps, Clusterer, type ClustererContextType, type ClustererProps, type ComplexImageType, type Coordinate, Coordinate$1 as CoordinateClass, Day, type DayOfWeekNames, type DayType, type DirectionCoordinate, Event, FAQPage, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, LocalBusiness, type Location, LocationMap, type LocationMapProps, LocationSchema, Map, type MapContextType, type MapProps, type MapProvider$1 as MapProvider, MapProviderOption, MapQuestMaps, MapboxMaps, Marker, type MarkerProps, type Offer, OfferSchema, OpeningHoursSchema, type Organization, OrganizationSchema, PerformerSchema, type PhotoGallery, PhotoGallerySchema, PhotoSchema, type PinStoreType, Product, type Review, ReviewSchema, SchemaWrapper, type ThumbnailType, type WeekType, debuggingParamDetected, getDirections, useAnalytics, useClusterContext, useIdentify, useMapContext, usePageView, useScope, useTrack };