@gridui/select 1.1.2 → 1.2.1
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 +25 -1
- package/dist/autocomplete/autocomplete.d.ts +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +438 -211
- package/dist/index.js.map +4 -4
- package/docs/catalog.json +25 -3
- package/docs/reference/README.md +7 -0
- package/docs/reference/autocomplete.md +127 -0
- package/docs/reference/combobox.md +149 -0
- package/docs/reference/multi-select.md +139 -0
- package/docs/reference/select.md +121 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gridui/select
|
|
2
2
|
|
|
3
|
-
Core family. Public API: `Combobox`, `ComboboxProps`, `MultiSelect`, `MultiSelectProps`, `Select`, `SelectAction`, `SelectGroup`, `SelectOption`, `SelectProps`.
|
|
3
|
+
Core family. Public API: `Autocomplete`, `AutocompleteProps`, `Combobox`, `ComboboxProps`, `MultiSelect`, `MultiSelectProps`, `Select`, `SelectAction`, `SelectGroup`, `SelectOption`, `SelectProps`.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/select`. Load these styles in order for Select,
|
|
6
6
|
Combobox, and MultiSelect:
|
|
@@ -171,3 +171,27 @@ Cancellation and request ownership also reject late answers from loaders that
|
|
|
171
171
|
ignore the signal.
|
|
172
172
|
`debounceMs` defaults to 150; `enabled={false}` cancels and clears the request.
|
|
173
173
|
This helper is also useful when supplying remote items to CommandPalette.
|
|
174
|
+
|
|
175
|
+
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
176
|
+
|
|
177
|
+
## Free-text Autocomplete
|
|
178
|
+
|
|
179
|
+
Autocomplete accepts arbitrary strings and optionally suggests SelectOption or
|
|
180
|
+
SelectGroup entries. Its value/defaultValue is the submitted text, not an option
|
|
181
|
+
identifier. A chosen option writes its label and calls onOptionSelect(option).
|
|
182
|
+
Use native name, form, required, pattern, refs and onChange on the visible input;
|
|
183
|
+
there is no hidden selected-value mirror. Native reset restores uncontrolled
|
|
184
|
+
initial text. Controlled resets remain application-owned.
|
|
185
|
+
|
|
186
|
+
Typing opens suggestions without selecting one. Up/Down explicitly highlights
|
|
187
|
+
an option; Enter accepts a highlighted enabled option. Without a highlight Enter
|
|
188
|
+
retains normal form submission. Escape and outside dismissal preserve free text.
|
|
189
|
+
Tab leaves normally. IME confirmation does not select a suggestion. Read-only,
|
|
190
|
+
disabled and inherited fieldset states prevent selection, including stale portals.
|
|
191
|
+
|
|
192
|
+
Provide searchLabel and emptyLabel, plus loadingLabel/errorLabel as needed.
|
|
193
|
+
filterOptions=false accepts caller-filtered results; loading/error states remove
|
|
194
|
+
stale options. Supply useAsyncOptions with the controlled text value for remote
|
|
195
|
+
suggestions. Applications own request and caching policy. className/style/ref
|
|
196
|
+
address the input; rootClassName addresses its anchor. portalContainer and dir
|
|
197
|
+
follow the same overlay contract as Combobox.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Select
|
|
4
|
+
* @namespace Autocomplete
|
|
5
|
+
* @description Autocomplete
|
|
6
|
+
*/
|
|
7
|
+
import type { SelectGroup, SelectionSearchProps, SelectOption } from "../shared/types";
|
|
8
|
+
import { type InputProps } from "@gridui/input";
|
|
9
|
+
import { type FC } from "react";
|
|
10
|
+
export type AutocompleteProps = Omit<InputProps, "value" | "defaultValue" | "type"> & Omit<SelectionSearchProps, "query" | "onQueryChange"> & {
|
|
11
|
+
readonly value?: string | undefined;
|
|
12
|
+
readonly defaultValue?: string | undefined;
|
|
13
|
+
readonly options: readonly (SelectOption | SelectGroup)[];
|
|
14
|
+
readonly searchLabel: string;
|
|
15
|
+
readonly emptyLabel: string;
|
|
16
|
+
readonly portalContainer?: HTMLElement | undefined;
|
|
17
|
+
readonly rootClassName?: string;
|
|
18
|
+
readonly onOptionSelect?: (option: SelectOption) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const Autocomplete: FC<AutocompleteProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* @namespace Root
|
|
5
5
|
* @description Index
|
|
6
6
|
*/
|
|
7
|
+
export type { AutocompleteProps } from "./autocomplete/autocomplete";
|
|
8
|
+
export { Autocomplete } from "./autocomplete/autocomplete";
|
|
7
9
|
export type { ComboboxProps } from "./combobox/combobox";
|
|
8
10
|
export { Combobox } from "./combobox/combobox";
|
|
9
11
|
export type { MultiSelectProps } from "./multi-select/multi-select";
|