@gridui/select 1.1.1 → 1.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/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:
@@ -10,14 +10,13 @@ Combobox, and MultiSelect:
10
10
  @import "@gridui/overlay/styles.css";
11
11
  @import "@gridui/input/styles.css";
12
12
  @import "@gridui/form/styles.css";
13
- @import "@gridui/dropdown-menu/styles.css";
14
13
  @import "@gridui/select/styles.css";
15
14
  ```
16
15
 
17
- Input supplies control styles, Overlay supplies the popup surface and motion,
18
- DropdownMenu supplies option-row styles, and Form hides MultiSelect’s native
19
- multiple-value bridge. Applications own routes, labels,
20
- state persistence, and branding.
16
+ Input supplies control styles. Overlay supplies popup surfaces, motion, option
17
+ rows, group labels, and trailing check slots. Form hides MultiSelect’s native
18
+ multiple-value bridge. Applications own routes, labels, state persistence, and
19
+ branding.
21
20
 
22
21
  See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/select/.changeset/history).
23
22
 
@@ -34,7 +33,9 @@ the selected item over the trigger when space permits, with a viewport-safe
34
33
  fallback. Both modes match the trigger's outer width and limit height to available
35
34
  space. The option list scrolls independently of actions. Standard and small
36
35
  triggers retain 2.75rem and 2.25rem minimum heights. Option labels and descriptions wrap;
37
- the editable input displays one line. `portalContainer` can keep popups within an
36
+ the editable input displays one line. A trailing check slot stays reserved for all
37
+ options; optional icons remain before the label. This matches DropdownMenu and
38
+ ContextMenu, including RTL presentation. `portalContainer` can keep popups within an
38
39
  enclosing overlay's ownership and focus boundary. Inside a Modal or Drawer,
39
40
  use `portalContainer` when the popup must inherit a local theme or custom portal
40
41
  location. Radix layers coordinate nested focus and Escape handling. Attach a
@@ -170,3 +171,27 @@ Cancellation and request ownership also reject late answers from loaders that
170
171
  ignore the signal.
171
172
  `debounceMs` defaults to 150; `enabled={false}` cancels and clears the request.
172
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>;
@@ -4,10 +4,7 @@
4
4
  * @namespace Combobox
5
5
  * @description Combobox
6
6
  */
7
- import type { SelectionProps, SelectionSearchProps } from "../shared/types";
7
+ import type { SelectionProps, SelectionSearchLabels, SelectionSearchProps } from "../shared/types";
8
8
  import { type ComponentPropsWithRef, type FC } from "react";
9
- export type ComboboxProps = Omit<ComponentPropsWithRef<"input">, "children" | "value" | "defaultValue" | "onChange" | "type" | "size"> & SelectionProps & SelectionSearchProps & {
10
- readonly searchLabel: string;
11
- readonly emptyLabel: string;
12
- };
9
+ export type ComboboxProps = Omit<ComponentPropsWithRef<"input">, "children" | "value" | "defaultValue" | "onChange" | "type" | "size"> & SelectionProps & SelectionSearchProps & SelectionSearchLabels;
13
10
  export declare const Combobox: FC<ComboboxProps>;
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";