@pro6pp/infer-react 0.0.2-beta.9 → 0.1.0-beta.19
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/README.md +32 -1
- package/dist/index.cjs +562 -270
- package/dist/index.d.cts +24 -13
- package/dist/index.d.ts +24 -13
- package/dist/index.js +570 -271
- package/dist/styles.css +203 -0
- package/package.json +7 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InferConfig, InferState, InferCore, InferResult } from '@pro6pp/infer-core';
|
|
3
|
-
export { AddressValue, CountryCode, Fetcher, InferConfig, InferResult, InferState, Stage } from '@pro6pp/infer-core';
|
|
2
|
+
import { InferConfig, AddressValue, InferState, InferCore, InferResult } from '@pro6pp/infer-core';
|
|
3
|
+
export { AddressValue, CountryCode, Fetcher, InferConfig, InferResult, InferState, LanguageCode, Stage } from '@pro6pp/infer-core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Extended configuration for the React hook.
|
|
7
|
+
*/
|
|
8
|
+
interface UseInferConfig extends InferConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Initial address value to pre-fill the state with.
|
|
11
|
+
*/
|
|
12
|
+
initialValue?: AddressValue;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* A headless React hook that provides the logic for address search using the Infer API.
|
|
7
16
|
* @param config The engine configuration (authKey, country, etc.).
|
|
8
17
|
* @returns An object containing the current state, the core instance, and pre-bound input props.
|
|
9
18
|
*/
|
|
10
|
-
declare function useInfer(config:
|
|
11
|
-
/** The current UI state (suggestions, loading status, query, etc.). */
|
|
19
|
+
declare function useInfer(config: UseInferConfig): {
|
|
20
|
+
/** The current UI state (suggestions, loading status, query, value, etc.). */
|
|
12
21
|
state: InferState;
|
|
13
22
|
/** The raw InferCore instance for manual control. */
|
|
14
23
|
core: InferCore;
|
|
@@ -18,15 +27,17 @@ declare function useInfer(config: InferConfig): {
|
|
|
18
27
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
28
|
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
29
|
};
|
|
21
|
-
/**
|
|
22
|
-
selectItem: (item: InferResult | string) =>
|
|
23
|
-
/**
|
|
30
|
+
/** Manually select a specific suggestion. */
|
|
31
|
+
selectItem: (item: InferResult | string) => boolean;
|
|
32
|
+
/** Programmatically set the address value. */
|
|
33
|
+
setValue: (address: AddressValue) => void;
|
|
34
|
+
/** Load more results. */
|
|
24
35
|
loadMore: () => void;
|
|
25
36
|
};
|
|
26
37
|
/**
|
|
27
38
|
* Props for the Pro6PPInfer component.
|
|
28
39
|
*/
|
|
29
|
-
interface Pro6PPInferProps extends
|
|
40
|
+
interface Pro6PPInferProps extends UseInferConfig {
|
|
30
41
|
/** Optional CSS class for the wrapper div. */
|
|
31
42
|
className?: string;
|
|
32
43
|
/** Optional inline styles for the wrapper div. */
|
|
@@ -47,10 +58,10 @@ interface Pro6PPInferProps extends InferConfig {
|
|
|
47
58
|
* @default 'No results found'
|
|
48
59
|
*/
|
|
49
60
|
noResultsText?: string;
|
|
50
|
-
/** * The text to show on the
|
|
51
|
-
* @default '
|
|
61
|
+
/** * The text to show on the bottom loading indicator.
|
|
62
|
+
* @default 'Loading more...'
|
|
52
63
|
*/
|
|
53
|
-
|
|
64
|
+
loadingText?: string;
|
|
54
65
|
/** A custom render function for the "no results" state. */
|
|
55
66
|
renderNoResults?: (state: InferState) => React.ReactNode;
|
|
56
67
|
/**
|
|
@@ -63,6 +74,6 @@ interface Pro6PPInferProps extends InferConfig {
|
|
|
63
74
|
* A styled React component for Pro6PP Infer API.
|
|
64
75
|
* Includes styling, keyboard navigation, and loading states.
|
|
65
76
|
*/
|
|
66
|
-
declare const Pro6PPInfer: React.
|
|
77
|
+
declare const Pro6PPInfer: React.ForwardRefExoticComponent<Pro6PPInferProps & React.RefAttributes<HTMLInputElement>>;
|
|
67
78
|
|
|
68
|
-
export { Pro6PPInfer, type Pro6PPInferProps, useInfer };
|
|
79
|
+
export { Pro6PPInfer, type Pro6PPInferProps, type UseInferConfig, useInfer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InferConfig, InferState, InferCore, InferResult } from '@pro6pp/infer-core';
|
|
3
|
-
export { AddressValue, CountryCode, Fetcher, InferConfig, InferResult, InferState, Stage } from '@pro6pp/infer-core';
|
|
2
|
+
import { InferConfig, AddressValue, InferState, InferCore, InferResult } from '@pro6pp/infer-core';
|
|
3
|
+
export { AddressValue, CountryCode, Fetcher, InferConfig, InferResult, InferState, LanguageCode, Stage } from '@pro6pp/infer-core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Extended configuration for the React hook.
|
|
7
|
+
*/
|
|
8
|
+
interface UseInferConfig extends InferConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Initial address value to pre-fill the state with.
|
|
11
|
+
*/
|
|
12
|
+
initialValue?: AddressValue;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* A headless React hook that provides the logic for address search using the Infer API.
|
|
7
16
|
* @param config The engine configuration (authKey, country, etc.).
|
|
8
17
|
* @returns An object containing the current state, the core instance, and pre-bound input props.
|
|
9
18
|
*/
|
|
10
|
-
declare function useInfer(config:
|
|
11
|
-
/** The current UI state (suggestions, loading status, query, etc.). */
|
|
19
|
+
declare function useInfer(config: UseInferConfig): {
|
|
20
|
+
/** The current UI state (suggestions, loading status, query, value, etc.). */
|
|
12
21
|
state: InferState;
|
|
13
22
|
/** The raw InferCore instance for manual control. */
|
|
14
23
|
core: InferCore;
|
|
@@ -18,15 +27,17 @@ declare function useInfer(config: InferConfig): {
|
|
|
18
27
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
28
|
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
29
|
};
|
|
21
|
-
/**
|
|
22
|
-
selectItem: (item: InferResult | string) =>
|
|
23
|
-
/**
|
|
30
|
+
/** Manually select a specific suggestion. */
|
|
31
|
+
selectItem: (item: InferResult | string) => boolean;
|
|
32
|
+
/** Programmatically set the address value. */
|
|
33
|
+
setValue: (address: AddressValue) => void;
|
|
34
|
+
/** Load more results. */
|
|
24
35
|
loadMore: () => void;
|
|
25
36
|
};
|
|
26
37
|
/**
|
|
27
38
|
* Props for the Pro6PPInfer component.
|
|
28
39
|
*/
|
|
29
|
-
interface Pro6PPInferProps extends
|
|
40
|
+
interface Pro6PPInferProps extends UseInferConfig {
|
|
30
41
|
/** Optional CSS class for the wrapper div. */
|
|
31
42
|
className?: string;
|
|
32
43
|
/** Optional inline styles for the wrapper div. */
|
|
@@ -47,10 +58,10 @@ interface Pro6PPInferProps extends InferConfig {
|
|
|
47
58
|
* @default 'No results found'
|
|
48
59
|
*/
|
|
49
60
|
noResultsText?: string;
|
|
50
|
-
/** * The text to show on the
|
|
51
|
-
* @default '
|
|
61
|
+
/** * The text to show on the bottom loading indicator.
|
|
62
|
+
* @default 'Loading more...'
|
|
52
63
|
*/
|
|
53
|
-
|
|
64
|
+
loadingText?: string;
|
|
54
65
|
/** A custom render function for the "no results" state. */
|
|
55
66
|
renderNoResults?: (state: InferState) => React.ReactNode;
|
|
56
67
|
/**
|
|
@@ -63,6 +74,6 @@ interface Pro6PPInferProps extends InferConfig {
|
|
|
63
74
|
* A styled React component for Pro6PP Infer API.
|
|
64
75
|
* Includes styling, keyboard navigation, and loading states.
|
|
65
76
|
*/
|
|
66
|
-
declare const Pro6PPInfer: React.
|
|
77
|
+
declare const Pro6PPInfer: React.ForwardRefExoticComponent<Pro6PPInferProps & React.RefAttributes<HTMLInputElement>>;
|
|
67
78
|
|
|
68
|
-
export { Pro6PPInfer, type Pro6PPInferProps, useInfer };
|
|
79
|
+
export { Pro6PPInfer, type Pro6PPInferProps, type UseInferConfig, useInfer };
|