@choc-ui/chakra-autocomplete 5.1.8 → 5.2.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/LICENSE +20 -20
- package/README.md +1161 -1117
- package/dist/autocomplete-context.d.ts +3 -3
- package/dist/autocomplete-creatable.d.ts +14 -14
- package/dist/autocomplete-group.d.ts +9 -9
- package/dist/autocomplete-input.d.ts +13 -11
- package/dist/autocomplete-item.d.ts +12 -12
- package/dist/autocomplete-list.d.ts +6 -3
- package/dist/autocomplete-tag.d.ts +9 -9
- package/dist/autocomplete.d.ts +13 -13
- package/dist/components/empty-state.d.ts +3 -3
- package/dist/helpers/fuzzySearch.d.ts +1 -1
- package/dist/helpers/group.d.ts +4 -4
- package/dist/helpers/input.d.ts +1 -1
- package/dist/helpers/items.d.ts +9 -9
- package/dist/helpers/list.d.ts +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.es.js +1973 -1870
- package/dist/index.js +10 -10
- package/dist/types.d.ts +128 -124
- package/dist/use-autocomplete.d.ts +8 -8
- package/package.json +82 -82
package/dist/types.d.ts
CHANGED
|
@@ -1,124 +1,128 @@
|
|
|
1
|
-
import { BoxProps, FlexProps, InputProps, SystemStyleObject, WrapProps } from "@chakra-ui/react";
|
|
2
|
-
import { MaybeRenderProp } from "@chakra-ui/react-utils";
|
|
3
|
-
import React, { Dispatch, SetStateAction } from "react";
|
|
4
|
-
import { AutoCompleteGroupProps } from "./autocomplete-group";
|
|
5
|
-
import { AutoCompleteInputProps } from "./autocomplete-input";
|
|
6
|
-
import { AutoCompleteProps } from "./autocomplete";
|
|
7
|
-
import { AutoCompleteItemProps } from "./autocomplete-item";
|
|
8
|
-
export interface Item {
|
|
9
|
-
value: any;
|
|
10
|
-
label?: any;
|
|
11
|
-
fixed?: boolean;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
itemVal?: any;
|
|
14
|
-
noFilter?: boolean;
|
|
15
|
-
creatable?: boolean;
|
|
16
|
-
originalValue?: any;
|
|
17
|
-
}
|
|
18
|
-
export declare type UseAutoCompleteProps = Partial<{
|
|
19
|
-
closeOnBlur: boolean;
|
|
20
|
-
closeOnSelect: boolean;
|
|
21
|
-
creatable: boolean;
|
|
22
|
-
defaultIsOpen: boolean;
|
|
23
|
-
defaultValue: Item["value"];
|
|
24
|
-
defaultValues: Item["value"][];
|
|
25
|
-
disableFilter: boolean;
|
|
26
|
-
emphasize: boolean | SystemStyleObject;
|
|
27
|
-
emptyState: boolean | MaybeRenderProp<{
|
|
28
|
-
query: Item["value"];
|
|
29
|
-
}>;
|
|
30
|
-
filter: (query: string, optionValue: Item["value"], optionLabel: Item["label"]) => boolean;
|
|
31
|
-
focusInputOnSelect: boolean;
|
|
32
|
-
freeSolo: boolean;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
1
|
+
import { BoxProps, FlexProps, InputProps, SystemStyleObject, WrapProps, PlacementWithLogical } from "@chakra-ui/react";
|
|
2
|
+
import { MaybeRenderProp } from "@chakra-ui/react-utils";
|
|
3
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
4
|
+
import { AutoCompleteGroupProps } from "./autocomplete-group";
|
|
5
|
+
import { AutoCompleteInputProps } from "./autocomplete-input";
|
|
6
|
+
import { AutoCompleteProps } from "./autocomplete";
|
|
7
|
+
import { AutoCompleteItemProps } from "./autocomplete-item";
|
|
8
|
+
export interface Item {
|
|
9
|
+
value: any;
|
|
10
|
+
label?: any;
|
|
11
|
+
fixed?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
itemVal?: any;
|
|
14
|
+
noFilter?: boolean;
|
|
15
|
+
creatable?: boolean;
|
|
16
|
+
originalValue?: any;
|
|
17
|
+
}
|
|
18
|
+
export declare type UseAutoCompleteProps = Partial<{
|
|
19
|
+
closeOnBlur: boolean;
|
|
20
|
+
closeOnSelect: boolean;
|
|
21
|
+
creatable: boolean;
|
|
22
|
+
defaultIsOpen: boolean;
|
|
23
|
+
defaultValue: Item["value"];
|
|
24
|
+
defaultValues: Item["value"][];
|
|
25
|
+
disableFilter: boolean;
|
|
26
|
+
emphasize: boolean | SystemStyleObject;
|
|
27
|
+
emptyState: boolean | MaybeRenderProp<{
|
|
28
|
+
query: Item["value"];
|
|
29
|
+
}>;
|
|
30
|
+
filter: (query: string, optionValue: Item["value"], optionLabel: Item["label"]) => boolean;
|
|
31
|
+
focusInputOnSelect: boolean;
|
|
32
|
+
freeSolo: boolean;
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
isReadOnly: boolean;
|
|
35
|
+
listAllValuesOnFocus: boolean;
|
|
36
|
+
maxSelections: number;
|
|
37
|
+
maxSuggestions: number;
|
|
38
|
+
multiple: boolean;
|
|
39
|
+
onChange: (value: Item["value"] | Item["value"][], item: Item | Item[]) => void;
|
|
40
|
+
onCreateOption: (params: {
|
|
41
|
+
item: Item;
|
|
42
|
+
selectMethod: "mouse" | "keyboard" | null;
|
|
43
|
+
}) => boolean | void;
|
|
44
|
+
onSelectOption: (params: {
|
|
45
|
+
item: Item;
|
|
46
|
+
selectMethod: "mouse" | "keyboard" | null;
|
|
47
|
+
isNewInput?: boolean;
|
|
48
|
+
}) => boolean | void;
|
|
49
|
+
onOptionFocus: (params: {
|
|
50
|
+
item: Item;
|
|
51
|
+
focusMethod: "mouse" | "keyboard" | null;
|
|
52
|
+
isNewInput?: boolean;
|
|
53
|
+
}) => boolean | void;
|
|
54
|
+
onTagRemoved: (removedTag: Item["value"], item: Item, tags: ItemTag[]) => void;
|
|
55
|
+
onReady: (params: OnReadyProps) => void;
|
|
56
|
+
openOnFocus: boolean;
|
|
57
|
+
placement: PlacementWithLogical;
|
|
58
|
+
restoreOnBlurIfEmpty: boolean;
|
|
59
|
+
rollNavigation: boolean;
|
|
60
|
+
selectOnFocus: boolean;
|
|
61
|
+
shouldRenderSuggestions: (value: string) => boolean;
|
|
62
|
+
submitKeys: string[];
|
|
63
|
+
suggestWhenEmpty: boolean;
|
|
64
|
+
value: Item["value"];
|
|
65
|
+
values: Item["value"][];
|
|
66
|
+
}>;
|
|
67
|
+
export declare type ItemTag = {
|
|
68
|
+
label: any;
|
|
69
|
+
onRemove: () => void;
|
|
70
|
+
};
|
|
71
|
+
export declare type OnReadyProps = {
|
|
72
|
+
tags: ItemTag[];
|
|
73
|
+
};
|
|
74
|
+
export declare type InputReturnProps = {
|
|
75
|
+
wrapper: {
|
|
76
|
+
onClick: React.MouseEventHandler<HTMLDivElement>;
|
|
77
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
78
|
+
} & WrapProps;
|
|
79
|
+
input: InputProps;
|
|
80
|
+
};
|
|
81
|
+
export declare type ItemReturnProps = {
|
|
82
|
+
item: FlexProps;
|
|
83
|
+
root: {
|
|
84
|
+
isValidSuggestion: boolean;
|
|
85
|
+
value: AutoCompleteItemProps["value"];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare type ListReturnProps = {
|
|
89
|
+
width: number;
|
|
90
|
+
};
|
|
91
|
+
export declare type GroupReturnProps = {
|
|
92
|
+
divider: {
|
|
93
|
+
hasFirstChild: boolean;
|
|
94
|
+
hasLastChild: boolean;
|
|
95
|
+
};
|
|
96
|
+
group: BoxProps;
|
|
97
|
+
};
|
|
98
|
+
export declare type UseAutoCompleteReturn = {
|
|
99
|
+
autoCompleteProps: AutoCompleteProps;
|
|
100
|
+
children: React.ReactNode;
|
|
101
|
+
filteredList: Item[];
|
|
102
|
+
filteredResults: Item[];
|
|
103
|
+
focusedValue: Item["value"];
|
|
104
|
+
getEmptyStateProps: (component: any) => any;
|
|
105
|
+
getGroupProps: (props: AutoCompleteGroupProps) => GroupReturnProps;
|
|
106
|
+
getInputProps: (props: AutoCompleteInputProps, themeInput?: any) => InputReturnProps;
|
|
107
|
+
getItemProps: (props: AutoCompleteItemProps, creatable?: boolean) => ItemReturnProps;
|
|
108
|
+
getListProps: () => ListReturnProps;
|
|
109
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
110
|
+
interactionRef: React.RefObject<"mouse" | "keyboard" | null>;
|
|
111
|
+
isOpen: boolean;
|
|
112
|
+
isLoading: boolean;
|
|
113
|
+
itemList: Item[];
|
|
114
|
+
listRef: React.RefObject<HTMLDivElement>;
|
|
115
|
+
onClose: () => void;
|
|
116
|
+
onOpen: () => void;
|
|
117
|
+
placement: PlacementWithLogical;
|
|
118
|
+
query: string;
|
|
119
|
+
removeItem: (valueToRemove?: Item["value"], focusInput?: boolean) => void;
|
|
120
|
+
resetItems: (focusInput?: boolean) => void;
|
|
121
|
+
setQuery: Dispatch<SetStateAction<any>>;
|
|
122
|
+
tags: ItemTag[];
|
|
123
|
+
values: Item["value"][];
|
|
124
|
+
};
|
|
125
|
+
export declare type AutoCompleteRefMethods = {
|
|
126
|
+
removeItem: UseAutoCompleteReturn["removeItem"];
|
|
127
|
+
resetItems: UseAutoCompleteReturn["resetItems"];
|
|
128
|
+
} | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AutoCompleteProps } from "./autocomplete";
|
|
2
|
-
import { UseAutoCompleteReturn } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* useAutoComplete that provides all the state and focus management logic
|
|
5
|
-
* for the autocomplete component. It is consumed by the `Autocomplete` component
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare function useAutoComplete(autoCompleteProps: AutoCompleteProps): UseAutoCompleteReturn;
|
|
1
|
+
import { AutoCompleteProps } from "./autocomplete";
|
|
2
|
+
import { UseAutoCompleteReturn } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* useAutoComplete that provides all the state and focus management logic
|
|
5
|
+
* for the autocomplete component. It is consumed by the `Autocomplete` component
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAutoComplete(autoCompleteProps: AutoCompleteProps): UseAutoCompleteReturn;
|
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "5.
|
|
3
|
-
"license": "MIT",
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"typings": "dist/index.d.ts",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=10"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"start": "vite watch",
|
|
15
|
-
"build": "vite build",
|
|
16
|
-
"test": "tsdx test --passWithNoTests",
|
|
17
|
-
"lint": "tsdx lint",
|
|
18
|
-
"postbuild": "tsc --emitDeclarationOnly",
|
|
19
|
-
"size": "size-limit",
|
|
20
|
-
"analyze": "size-limit --why"
|
|
21
|
-
},
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"@chakra-ui/react": "^2.5.5",
|
|
24
|
-
"@emotion/react": "^11.10.0",
|
|
25
|
-
"@emotion/styled": "^11.10.0",
|
|
26
|
-
"framer-motion": ">7.6.14",
|
|
27
|
-
"react": "^18.2.0"
|
|
28
|
-
},
|
|
29
|
-
"husky": {
|
|
30
|
-
"hooks": {
|
|
31
|
-
"pre-commit": "tsdx lint"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"prettier": {
|
|
35
|
-
"printWidth": 80,
|
|
36
|
-
"semi": true,
|
|
37
|
-
"singleQuote": false,
|
|
38
|
-
"trailingComma": "es5"
|
|
39
|
-
},
|
|
40
|
-
"name": "@choc-ui/chakra-autocomplete",
|
|
41
|
-
"author": "anubra266",
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/anubra266/choc-autocomplete.git"
|
|
45
|
-
},
|
|
46
|
-
"size-limit": [
|
|
47
|
-
{
|
|
48
|
-
"path": "dist/chakra-autocomplete.cjs.production.min.js",
|
|
49
|
-
"limit": "10 KB"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"path": "dist/chakra-autocomplete.esm.js",
|
|
53
|
-
"limit": "10 KB"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@babel/core": "^7.18.10",
|
|
58
|
-
"@chakra-ui/react": "^2.5.5",
|
|
59
|
-
"@emotion/react": "^11.10.6",
|
|
60
|
-
"@emotion/styled": "^11.10.6",
|
|
61
|
-
"@size-limit/preset-small-lib": "^5.0.1",
|
|
62
|
-
"@types/react": "^18.0.17",
|
|
63
|
-
"@types/react-dom": "^18.0.6",
|
|
64
|
-
"@vitejs/plugin-react": "2.0.1",
|
|
65
|
-
"babel-loader": "^8.2.5",
|
|
66
|
-
"framer-motion": ">7.6.14",
|
|
67
|
-
"husky": "^7.0.1",
|
|
68
|
-
"react": "^18.2.0",
|
|
69
|
-
"react-dom": "^18.2.0",
|
|
70
|
-
"size-limit": "^5.0.1",
|
|
71
|
-
"tsdx": "^0.14.1",
|
|
72
|
-
"tslib": "^2.3.0",
|
|
73
|
-
"typescript": "^4.7.4",
|
|
74
|
-
"vite": "3.0.8"
|
|
75
|
-
},
|
|
76
|
-
"dependencies": {
|
|
77
|
-
"@chakra-ui/layout": "^2.1.5",
|
|
78
|
-
"@chakra-ui/react-utils": "^2.0.5",
|
|
79
|
-
"@chakra-ui/tag": "^2.0.8",
|
|
80
|
-
"@chakra-ui/utils": "^2.0.8",
|
|
81
|
-
"react-nanny": "2.15.0"
|
|
82
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": "5.2.0",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"typings": "dist/index.d.ts",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=10"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "vite watch",
|
|
15
|
+
"build": "vite build",
|
|
16
|
+
"test": "tsdx test --passWithNoTests",
|
|
17
|
+
"lint": "tsdx lint",
|
|
18
|
+
"postbuild": "tsc --emitDeclarationOnly",
|
|
19
|
+
"size": "size-limit",
|
|
20
|
+
"analyze": "size-limit --why"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@chakra-ui/react": "^2.5.5",
|
|
24
|
+
"@emotion/react": "^11.10.0",
|
|
25
|
+
"@emotion/styled": "^11.10.0",
|
|
26
|
+
"framer-motion": ">7.6.14",
|
|
27
|
+
"react": "^18.2.0"
|
|
28
|
+
},
|
|
29
|
+
"husky": {
|
|
30
|
+
"hooks": {
|
|
31
|
+
"pre-commit": "tsdx lint"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"prettier": {
|
|
35
|
+
"printWidth": 80,
|
|
36
|
+
"semi": true,
|
|
37
|
+
"singleQuote": false,
|
|
38
|
+
"trailingComma": "es5"
|
|
39
|
+
},
|
|
40
|
+
"name": "@choc-ui/chakra-autocomplete",
|
|
41
|
+
"author": "anubra266",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/anubra266/choc-autocomplete.git"
|
|
45
|
+
},
|
|
46
|
+
"size-limit": [
|
|
47
|
+
{
|
|
48
|
+
"path": "dist/chakra-autocomplete.cjs.production.min.js",
|
|
49
|
+
"limit": "10 KB"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "dist/chakra-autocomplete.esm.js",
|
|
53
|
+
"limit": "10 KB"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@babel/core": "^7.18.10",
|
|
58
|
+
"@chakra-ui/react": "^2.5.5",
|
|
59
|
+
"@emotion/react": "^11.10.6",
|
|
60
|
+
"@emotion/styled": "^11.10.6",
|
|
61
|
+
"@size-limit/preset-small-lib": "^5.0.1",
|
|
62
|
+
"@types/react": "^18.0.17",
|
|
63
|
+
"@types/react-dom": "^18.0.6",
|
|
64
|
+
"@vitejs/plugin-react": "2.0.1",
|
|
65
|
+
"babel-loader": "^8.2.5",
|
|
66
|
+
"framer-motion": ">7.6.14",
|
|
67
|
+
"husky": "^7.0.1",
|
|
68
|
+
"react": "^18.2.0",
|
|
69
|
+
"react-dom": "^18.2.0",
|
|
70
|
+
"size-limit": "^5.0.1",
|
|
71
|
+
"tsdx": "^0.14.1",
|
|
72
|
+
"tslib": "^2.3.0",
|
|
73
|
+
"typescript": "^4.7.4",
|
|
74
|
+
"vite": "3.0.8"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@chakra-ui/layout": "^2.1.5",
|
|
78
|
+
"@chakra-ui/react-utils": "^2.0.5",
|
|
79
|
+
"@chakra-ui/tag": "^2.0.8",
|
|
80
|
+
"@chakra-ui/utils": "^2.0.8",
|
|
81
|
+
"react-nanny": "2.15.0"
|
|
82
|
+
}
|
|
83
83
|
}
|