@hemerson/design-system 0.6.0 → 0.7.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.
@@ -0,0 +1,20 @@
1
+ import { type InputHTMLAttributes, type ReactNode } from "react";
2
+ export interface TypeaheadProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange"> {
3
+ label: ReactNode;
4
+ value?: string;
5
+ defaultValue?: string;
6
+ /** Called with the text on every keystroke and when a suggestion is picked. */
7
+ onChange?: (value: string) => void;
8
+ /** Values to suggest; repeats are shown once. Any text is still accepted. */
9
+ suggestions: string[];
10
+ /** Most suggestions shown at once. Default 8. */
11
+ maxSuggestions?: number;
12
+ hint?: ReactNode;
13
+ error?: ReactNode;
14
+ /** Locale for matching without case. Default "pt-BR". */
15
+ locale?: string;
16
+ }
17
+ /** The suggestions that contain the text, those that start with it first. */
18
+ export declare function matchSuggestions(suggestions: string[], text: string, locale?: string, max?: number): string[];
19
+ /** A text field that suggests values as you type, in a glass list. Free text is still allowed. */
20
+ export declare function Typeahead({ label, value, defaultValue, onChange, suggestions, maxSuggestions, hint, error, locale, id, className, disabled, ...rest }: TypeaheadProps): import("react").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -23,6 +23,8 @@ export type { InputProps } from "./components/Input/Input";
23
23
  export { Select } from "./components/Select/Select";
24
24
  export { DateInput } from "./components/DateInput/DateInput";
25
25
  export type { DateInputProps } from "./components/DateInput/DateInput";
26
+ export { Typeahead } from "./components/Typeahead/Typeahead";
27
+ export type { TypeaheadProps } from "./components/Typeahead/Typeahead";
26
28
  export type { SelectOption, SelectProps } from "./components/Select/Select";
27
29
  export { Checkbox } from "./components/Checkbox/Checkbox";
28
30
  export type { CheckboxProps } from "./components/Checkbox/Checkbox";