@partbot/stockist-map 0.1.0

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.
@@ -0,0 +1,2 @@
1
+ import type { StockistMapProps } from "./types";
2
+ export declare function StockistMap({ token, configUrl, config: providedConfig, theme, initialQuery, initialRadiusKm, className, }: StockistMapProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Coordinate, StockistHit, StockistSearchProps } from "./types";
2
+ declare const RESULT_LIMIT = 3;
3
+ declare const SEARCH_RADIUS_KM = 50;
4
+ declare function resultsWithDistance(hits: StockistHit[], center: Coordinate | null): StockistHit[];
5
+ export declare function StockistSearch({ token, configUrl, config: providedConfig, theme, initialQuery, viewAllUrl, className, }: StockistSearchProps): import("react/jsx-runtime").JSX.Element;
6
+ export { RESULT_LIMIT, SEARCH_RADIUS_KM, resultsWithDistance };
@@ -0,0 +1,9 @@
1
+ import type { SearchOptions, StockistHit, StockistMapConfig, StockistMapTheme, StockistSearchResult } from "./types";
2
+ export declare const DEFAULT_THEME: StockistMapTheme;
3
+ export declare function contrastTextColor(backgroundColor: string, dark?: string, light?: string): string;
4
+ export declare function normalizeTheme(theme?: Partial<StockistMapTheme>): StockistMapTheme;
5
+ export declare function tokenConfigUrl(token: string, appUrl?: string): string;
6
+ export declare function buildSearchUrl(baseUrl: string, options?: SearchOptions): string;
7
+ export declare function loadConfig(configUrl: string): Promise<StockistMapConfig>;
8
+ export declare function searchStockistResults(searchUrl: string, options?: SearchOptions): Promise<StockistSearchResult>;
9
+ export declare function searchStockists(searchUrl: string, options?: SearchOptions): Promise<StockistHit[]>;
@@ -0,0 +1,32 @@
1
+ import * as React from "react";
2
+ type Variant = "default" | "secondary" | "outline" | "ghost" | "destructive";
3
+ type Size = "default" | "sm" | "lg" | "icon";
4
+ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
5
+ variant?: Variant;
6
+ size?: Size;
7
+ };
8
+ export declare function Button({ className, variant, size, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function Input({ className, ...props }: React.InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
10
+ type NativeSelectProps = Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> & {
11
+ size?: "sm" | "default";
12
+ };
13
+ export declare function NativeSelect({ className, size, ...props }: NativeSelectProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function NativeSelectOption({ className, ...props }: React.OptionHTMLAttributes<HTMLOptionElement>): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Card({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
16
+ export declare function CardHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
17
+ export declare function CardTitle({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function CardDescription({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
19
+ export declare function CardContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
20
+ export declare function CardFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
21
+ type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & {
22
+ variant?: "default" | "secondary" | "outline" | "destructive";
23
+ };
24
+ export declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
25
+ type AlertProps = React.HTMLAttributes<HTMLDivElement> & {
26
+ variant?: "default" | "destructive";
27
+ };
28
+ export declare function Alert({ className, variant, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function AlertTitle({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
30
+ export declare function AlertDescription({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
31
+ export declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
32
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Coordinate } from "./types";
2
+ export declare function distanceKm(from: Coordinate, to: Coordinate): number;
3
+ export declare function formatDistance(value: number): string;
@@ -0,0 +1 @@
1
+ export declare function locationErrorMessage(error: GeolocationPositionError): string;
@@ -0,0 +1,29 @@
1
+ import { StockistMap } from "./StockistMap";
2
+ import type { StockistMapProps } from "./types";
3
+ export { StockistMap };
4
+ export type { Coordinate, StockistHit, StockistMapConfig, StockistMapProps, StockistMapTheme, StockistSearchProps, } from "./types";
5
+ export { buildSearchUrl, contrastTextColor, loadConfig, normalizeTheme, searchStockistResults, searchStockists, tokenConfigUrl, } from "./client";
6
+ export { distanceKm, formatDistance } from "./distance";
7
+ export declare function mountStockistMap(element: Element, options: StockistMapProps): import("react-dom/client").Root;
8
+ export declare class PartbotStockistMapElement extends HTMLElement {
9
+ static observedAttributes: string[];
10
+ private root?;
11
+ private mountElement?;
12
+ connectedCallback(): void;
13
+ disconnectedCallback(): void;
14
+ attributeChangedCallback(): void;
15
+ private renderStockistMap;
16
+ private stockistMapProps;
17
+ }
18
+ export declare function defineStockistMapElement(): void;
19
+ declare global {
20
+ interface Window {
21
+ PartbotStockistMap?: {
22
+ defineCustomElement: typeof defineStockistMapElement;
23
+ mount: typeof mountStockistMap;
24
+ };
25
+ }
26
+ interface HTMLElementTagNameMap {
27
+ "partbot-stockist-map": PartbotStockistMapElement;
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ export declare function normalizeWebsiteUrl(value?: string | null): string | null;
2
+ export declare function googleMapsDirectionsUrl(coordinate: {
3
+ lat: number;
4
+ lng: number;
5
+ }): string;
@@ -0,0 +1,28 @@
1
+ import { StockistSearch } from "./StockistSearch";
2
+ import type { StockistSearchProps } from "./types";
3
+ export { StockistSearch };
4
+ export type { StockistSearchProps } from "./types";
5
+ export declare function mountStockistSearch(element: Element, options: StockistSearchProps): import("react-dom/client").Root;
6
+ declare const HTMLElementBase: typeof HTMLElement;
7
+ export declare class PartbotStockistSearchElement extends HTMLElementBase {
8
+ static observedAttributes: string[];
9
+ private root?;
10
+ private mountElement?;
11
+ connectedCallback(): void;
12
+ disconnectedCallback(): void;
13
+ attributeChangedCallback(): void;
14
+ private renderStockistSearch;
15
+ private stockistSearchProps;
16
+ }
17
+ export declare function defineStockistSearchElement(): void;
18
+ declare global {
19
+ interface Window {
20
+ PartbotStockistSearch?: {
21
+ defineCustomElement: typeof defineStockistSearchElement;
22
+ mount: typeof mountStockistSearch;
23
+ };
24
+ }
25
+ interface HTMLElementTagNameMap {
26
+ "partbot-stockist-search": PartbotStockistSearchElement;
27
+ }
28
+ }