@gridui/select 1.3.0 → 1.6.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,15 +1,12 @@
1
1
  # @gridui/select
2
2
 
3
- Core family. Public API: `Autocomplete`, `AutocompleteProps`, `Combobox`, `ComboboxProps`, `MultiSelect`, `MultiSelectProps`, `Select`, `SelectAction`, `SelectGroup`, `SelectOption`, `SelectProps`.
3
+ Core family. Public API: `AutocompleteSuggestions`, `AutocompleteSuggestionsProps`, `AutocompleteInputPropsGetter`, `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:
7
7
 
8
8
  ```css
9
9
  @import "@gridui/theme/styles.css";
10
- @import "@gridui/overlay/styles.css";
11
- @import "@gridui/input/styles.css";
12
- @import "@gridui/form/styles.css";
13
10
  @import "@gridui/select/styles.css";
14
11
  ```
15
12
 
@@ -20,6 +17,16 @@ branding.
20
17
 
21
18
  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).
22
19
 
20
+ ## Styles
21
+
22
+ Load Theme once. Use `@gridui/select/styled` for automatic component CSS in
23
+ CSS-aware bundlers, or keep the CSS-free root import and load `@gridui/select/styles.css`.
24
+ Both entries expose the same root API. The standalone stylesheet includes component
25
+ dependency styles; Theme/reset remain separate. See the
26
+ [integration guide](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/integration.md)
27
+ for static HTML loading, SSR limits, and avoiding duplicate CSS.
28
+
29
+
23
30
  ## Select and Combobox
24
31
 
25
32
  `Select` and `Combobox` share options, actions, selection state, form integration,
@@ -209,3 +216,44 @@ Search result calculation is independent of popup visibility. Closing updates th
209
216
  control and query callbacks immediately while retaining the last open popup
210
217
  content through exit. A rapid reopen renders current results; reduced motion
211
218
  unmounts without waiting for an animation event.
219
+
220
+ Shared animation policy and tempo come from `MotionConfig` in `@gridui/motion`.
221
+ Disabled or reduced-motion policy settles decoration without disabling interaction.
222
+ See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/motion)
223
+ for CSS scopes, portal behavior, and specialized timing contracts.
224
+
225
+ ## Compose suggestions with a host-owned input
226
+
227
+ `AutocompleteSuggestions` owns suggestion filtering, navigation, announcements
228
+ and popup dismissal. It owns no text value, text callback, native form value,
229
+ or text-reset state. Pass the host's current `value`, selection options and
230
+ `onOptionSelect(option)`, then render an input through its `getInputProps` child:
231
+
232
+ ```tsx
233
+ <AutocompleteSuggestions
234
+ value={draft}
235
+ options={options}
236
+ searchLabel="Tag suggestions"
237
+ emptyLabel="Enter a new tag"
238
+ onOptionSelect={option => addTag(option.value)}
239
+ >
240
+ {getInputProps => <input {...getInputProps({
241
+ value: draft,
242
+ onChange: event => setDraft(event.currentTarget.value),
243
+ onKeyDown: handleFreeText,
244
+ })} />}
245
+ </AutocompleteSuggestions>
246
+ ```
247
+
248
+ Forward the returned ref, ARIA attributes and event handlers to one native input
249
+ (or `Input`). Suggestions claim arrow navigation and an explicitly highlighted
250
+ Enter before the input's `onKeyDown`; the host receives only unhandled keys.
251
+ The wrapper's optional `onKeyDown` runs first and may cancel either behavior.
252
+ Pass `disabled`, `readOnly`, `dir` and an external `form` owner to the wrapper
253
+ when applicable. Its form reset listener dismisses the popup while the host
254
+ resets text. `Autocomplete` composes this layer with its own free-text field;
255
+ TagInput composes it with its existing draft and tag state.
256
+
257
+ Search result availability, active-item fallback and clamped navigation reuse
258
+ Interaction's React-free searchable-list model. A defined `errorLabel`, including
259
+ an empty string, removes stale options without losing committed value labels.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Select
4
+ * @namespace AutocompleteSuggestions
5
+ * @description Autocomplete Suggestions
6
+ */
7
+ import type { SelectGroup, SelectionSearchProps, SelectOption } from "../shared/types";
8
+ import { type ComponentPropsWithRef, type FC, type ReactNode } from "react";
9
+ type InputProps = ComponentPropsWithRef<"input">;
10
+ /** Bind a host-owned input. Suggestions claim navigation before the input's own key handler. */
11
+ export type AutocompleteInputPropsGetter = (props: InputProps) => InputProps;
12
+ export type AutocompleteSuggestionsProps = Omit<SelectionSearchProps, "query" | "onQueryChange"> & Pick<InputProps, "disabled" | "readOnly" | "dir" | "onKeyDown" | "form"> & {
13
+ readonly value: string;
14
+ readonly options: readonly (SelectOption | SelectGroup)[];
15
+ readonly searchLabel: string;
16
+ readonly emptyLabel: string;
17
+ readonly portalContainer?: HTMLElement | undefined;
18
+ readonly rootClassName?: string | undefined;
19
+ readonly onOptionSelect: (option: SelectOption) => void;
20
+ readonly children: (getInputProps: AutocompleteInputPropsGetter) => ReactNode;
21
+ };
22
+ /** Own only suggestion navigation and its popup; the host owns text, validation and form reset. */
23
+ export declare const AutocompleteSuggestions: FC<AutocompleteSuggestionsProps>;
24
+ export {};
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@
6
6
  */
7
7
  export type { AutocompleteProps } from "./autocomplete/autocomplete";
8
8
  export { Autocomplete } from "./autocomplete/autocomplete";
9
+ export type { AutocompleteInputPropsGetter, AutocompleteSuggestionsProps } from "./autocomplete-suggestions/autocomplete-suggestions";
10
+ export { AutocompleteSuggestions } from "./autocomplete-suggestions/autocomplete-suggestions";
9
11
  export type { ComboboxProps } from "./combobox/combobox";
10
12
  export { Combobox } from "./combobox/combobox";
11
13
  export type { MultiSelectProps } from "./multi-select/multi-select";