@gridui/select 1.0.6 → 1.1.2

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
@@ -7,17 +7,16 @@ Combobox, and MultiSelect:
7
7
 
8
8
  ```css
9
9
  @import "@gridui/theme/styles.css";
10
+ @import "@gridui/overlay/styles.css";
10
11
  @import "@gridui/input/styles.css";
11
12
  @import "@gridui/form/styles.css";
12
- @import "@gridui/overlay/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
@@ -119,7 +120,7 @@ execute actions. The client hydrates before popup interaction;
119
120
  keep server and client initial values/options identical. Browser verification
120
121
  hydrates real Node-rendered HTML and exercises selection, reset, filtering,
121
122
  independent actions, focus handoff, and empty results across the viewport matrix.
122
- Remote search and implicit option creation are not included. Use MultiSelect for multiple selection.
123
+ Remote search uses the controlled search contract below. Implicit option creation is not included. Use MultiSelect for multiple selection.
123
124
 
124
125
 
125
126
  ## Implementation and lifecycle
@@ -149,3 +150,24 @@ callers choose initial focus and dismissal policy. MultiSelect uses Form's
149
150
  ListFieldControl with useListField for the native multiple-value bridge. Internal parts
150
151
  are not package exports. See the selection contract
151
152
  for keyboard, form, server-rendering, and focus guarantees protected by browser tests.
153
+
154
+ ## Controlled and asynchronous search
155
+
156
+ Combobox and MultiSelect accept `query` / `onQueryChange`. Closing their popup
157
+ requests an empty query and preserves the selected value. Omit `query` to retain
158
+ local search. `filterOptions={false}` renders caller-filtered results without a
159
+ second local filter. `loading` and `errorLabel` temporarily remove selectable
160
+ results, so a stale response cannot be selected while a request is pending.
161
+ Supply localized `loadingLabel`, `errorLabel`, and optionally `resultCountLabel`
162
+ for the polite status region. Native form values remain available during search.
163
+
164
+ `useAsyncOptions({ query, loadOptions, debounceMs, enabled })` is an optional
165
+ request helper. It returns `options`, `loading`, `error`, and the corresponding
166
+ `query`. `loadOptions(query, signal)` owns fetching and caching. Keep its identity
167
+ stable, forward the AbortSignal to fetch, and map errors to application copy.
168
+ A newer query or a changed loader identity clears the preceding results
169
+ immediately, including when the same query moves to another data source.
170
+ Cancellation and request ownership also reject late answers from loaders that
171
+ ignore the signal.
172
+ `debounceMs` defaults to 150; `enabled={false}` cancels and clears the request.
173
+ This helper is also useful when supplying remote items to CommandPalette.
@@ -4,10 +4,7 @@
4
4
  * @namespace Combobox
5
5
  * @description Combobox
6
6
  */
7
- import type { SelectionProps } 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 & {
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
@@ -13,3 +13,7 @@ export { Select } from "./select/select";
13
13
  export type { SelectAction } from "./shared/types";
14
14
  export type { SelectGroup } from "./shared/types";
15
15
  export type { SelectOption } from "./shared/types";
16
+ export type { SelectionSearchProps } from "./shared/types";
17
+ export type { AsyncOptionsLoader, AsyncOptionsState } from "./use-async-options/request";
18
+ export type { UseAsyncOptionsOptions } from "./use-async-options/use-async-options";
19
+ export { useAsyncOptions } from "./use-async-options/use-async-options";