@wherabouts/react-ui 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.
- package/CHANGELOG.md +27 -0
- package/README.md +176 -0
- package/dist/index.cjs +3113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +113 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +3105 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +288 -0
- package/package.json +54 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { AddressSuggestion, WheraboutsClient } from '@wherabouts/sdk';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
interface AddressWithParsed {
|
|
7
|
+
id: number;
|
|
8
|
+
formattedAddress: string;
|
|
9
|
+
latitude: number;
|
|
10
|
+
longitude: number;
|
|
11
|
+
streetAddress: string;
|
|
12
|
+
suburb: string;
|
|
13
|
+
state: string;
|
|
14
|
+
postcode: string;
|
|
15
|
+
country: string;
|
|
16
|
+
}
|
|
17
|
+
interface AddressI18nStrings {
|
|
18
|
+
noResults: string;
|
|
19
|
+
enterManually: string;
|
|
20
|
+
errorRetry: string;
|
|
21
|
+
geolocationError: string;
|
|
22
|
+
}
|
|
23
|
+
type AddressValidateFn = (address: AddressWithParsed) => Promise<{
|
|
24
|
+
message: string;
|
|
25
|
+
} | null>;
|
|
26
|
+
type AddressSuggestionInput = AddressSuggestion;
|
|
27
|
+
|
|
28
|
+
declare function toAddressWithParsed(suggestion: AddressSuggestion): AddressWithParsed;
|
|
29
|
+
|
|
30
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
31
|
+
|
|
32
|
+
interface AddressAutocompleteProps {
|
|
33
|
+
className?: string;
|
|
34
|
+
client: WheraboutsClient;
|
|
35
|
+
debounceMs?: number;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
enableGeolocation?: boolean;
|
|
38
|
+
error?: string;
|
|
39
|
+
i18nStrings?: Partial<AddressI18nStrings>;
|
|
40
|
+
id?: string;
|
|
41
|
+
maxSuggestions?: number;
|
|
42
|
+
minCharsToSearch?: number;
|
|
43
|
+
onQueryChange?: (query: string) => void;
|
|
44
|
+
onSelect?: (address: AddressWithParsed) => void;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
renderEmpty?: () => ReactNode;
|
|
47
|
+
renderError?: (error: Error | null) => ReactNode;
|
|
48
|
+
renderLoading?: () => ReactNode;
|
|
49
|
+
renderSuggestion?: (address: AddressWithParsed, isActive: boolean) => ReactNode;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
sessionToken?: string;
|
|
52
|
+
userLat?: number;
|
|
53
|
+
userLng?: number;
|
|
54
|
+
}
|
|
55
|
+
declare function AddressAutocomplete({ client, onQueryChange, onSelect, error: externalError, required, disabled, debounceMs, minCharsToSearch, maxSuggestions, enableGeolocation, userLat, userLng, sessionToken, className, placeholder, renderSuggestion, renderEmpty, renderError, renderLoading, i18nStrings: customI18n, id: customId, }: AddressAutocompleteProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
|
|
57
|
+
interface AddressFormFieldProps extends AddressAutocompleteProps {
|
|
58
|
+
label: string;
|
|
59
|
+
labelClassName?: string;
|
|
60
|
+
errorClassName?: string;
|
|
61
|
+
}
|
|
62
|
+
declare function AddressFormField({ label, labelClassName, errorClassName, error, required, disabled, id: customId, className, ...autocompleteProps }: AddressFormFieldProps): ReactNode;
|
|
63
|
+
|
|
64
|
+
interface ReverseGeocodeInputProps {
|
|
65
|
+
client: WheraboutsClient;
|
|
66
|
+
latitude: number | null;
|
|
67
|
+
longitude: number | null;
|
|
68
|
+
onResult?: (result: {
|
|
69
|
+
address: string | null;
|
|
70
|
+
distance: number | null;
|
|
71
|
+
}) => void;
|
|
72
|
+
className?: string;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
id?: string;
|
|
76
|
+
}
|
|
77
|
+
declare function ReverseGeocodeInput({ client, latitude, longitude, onResult, className, disabled, placeholder, id, }: ReverseGeocodeInputProps): ReactNode;
|
|
78
|
+
|
|
79
|
+
interface ForwardGeocodeInputProps {
|
|
80
|
+
client: WheraboutsClient;
|
|
81
|
+
query: string | null;
|
|
82
|
+
onResult?: (result: {
|
|
83
|
+
latitude: number | null;
|
|
84
|
+
longitude: number | null;
|
|
85
|
+
formattedAddress: string | null;
|
|
86
|
+
}) => void;
|
|
87
|
+
className?: string;
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
id?: string;
|
|
91
|
+
}
|
|
92
|
+
declare function ForwardGeocodeInput({ client, query, onResult, className, disabled, placeholder, id, }: ForwardGeocodeInputProps): ReactNode;
|
|
93
|
+
|
|
94
|
+
interface AddressFieldGroupValue {
|
|
95
|
+
street: string;
|
|
96
|
+
suburb: string;
|
|
97
|
+
state: string;
|
|
98
|
+
postcode: string;
|
|
99
|
+
}
|
|
100
|
+
interface AddressFieldGroupProps {
|
|
101
|
+
client: WheraboutsClient;
|
|
102
|
+
value: AddressFieldGroupValue;
|
|
103
|
+
onChange: (value: AddressFieldGroupValue) => void;
|
|
104
|
+
className?: string;
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
streetLabel?: string;
|
|
107
|
+
suburbLabel?: string;
|
|
108
|
+
stateLabel?: string;
|
|
109
|
+
postcodeLabel?: string;
|
|
110
|
+
}
|
|
111
|
+
declare function AddressFieldGroup({ client, value, onChange, className, disabled, streetLabel, suburbLabel, stateLabel, postcodeLabel, }: AddressFieldGroupProps): ReactNode;
|
|
112
|
+
|
|
113
|
+
export { AddressAutocomplete, type AddressAutocompleteProps, AddressFieldGroup, type AddressFieldGroupProps, type AddressFieldGroupValue, AddressFormField, type AddressFormFieldProps, type AddressI18nStrings, type AddressSuggestionInput, type AddressValidateFn, type AddressWithParsed, ForwardGeocodeInput, type ForwardGeocodeInputProps, ReverseGeocodeInput, type ReverseGeocodeInputProps, cn, toAddressWithParsed };
|