@magicx-eng/ai-autocomplete-react 0.3.0 → 0.4.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/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +180 -165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -166
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -103,6 +103,13 @@ interface UseAIAutocompleteReturn {
|
|
|
103
103
|
isLoading: boolean;
|
|
104
104
|
isFocused: boolean;
|
|
105
105
|
isDropdownOpen: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the active (leading) pill should render selected (full opacity)
|
|
108
|
+
* rather than the de-emphasized `first` tier. In `auto` trigger this is true
|
|
109
|
+
* only while a dropdown option is highlighted; in `manual` it's true once the
|
|
110
|
+
* pill has been tapped (the dropdown is open).
|
|
111
|
+
*/
|
|
112
|
+
isActivePillSelected: boolean;
|
|
106
113
|
placeholderText: string;
|
|
107
114
|
listboxId: string;
|
|
108
115
|
error: Error | null;
|
|
@@ -157,15 +164,27 @@ interface AIAutocompleteDropdownProps {
|
|
|
157
164
|
onPillClick?: (index: number) => void;
|
|
158
165
|
/** Whether to render pills inside the dropdown. Default: true. Tier 2 consumers who render their own pills should set this to false. */
|
|
159
166
|
showPills?: boolean;
|
|
167
|
+
/** Whether the active pill renders selected (full opacity) vs. the `first` tier. Provided by `dropdownProps` from the hook. Default: false. */
|
|
168
|
+
activeSelected?: boolean;
|
|
160
169
|
/** True while a fetch for the latest query is in flight. Replaces options/pills with a skeleton. */
|
|
161
170
|
isLoading?: boolean;
|
|
162
171
|
/** Once the user has tabbed to highlight an option, the footer hint switches from "tab to select" to "→ to skip". Provided by `dropdownProps` from the hook. */
|
|
163
172
|
hasTabbedToHighlight?: boolean;
|
|
173
|
+
/** When the input has no typed text, the footer hint reads "tab to skip" (Tab skips the active pill). Provided by `dropdownProps` from the hook. */
|
|
174
|
+
isInputEmpty?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Where the dropdown opens relative to the input. When `"above"`, the dropdown
|
|
177
|
+
* positions itself above (and reverses its internal layout so options sit
|
|
178
|
+
* nearest the input). Provided by `dropdownProps` from the hook, so headless
|
|
179
|
+
* consumers get the same above/below behavior as Tier 1 with no extra CSS.
|
|
180
|
+
* Default: `"below"`.
|
|
181
|
+
*/
|
|
182
|
+
optionsPosition?: "above" | "below";
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
|
|
167
186
|
|
|
168
|
-
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, isLoading, hasTabbedToHighlight, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
187
|
+
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, activeSelected, isLoading, hasTabbedToHighlight, isInputEmpty, optionsPosition, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
169
188
|
|
|
170
189
|
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
171
190
|
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,13 @@ interface UseAIAutocompleteReturn {
|
|
|
103
103
|
isLoading: boolean;
|
|
104
104
|
isFocused: boolean;
|
|
105
105
|
isDropdownOpen: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the active (leading) pill should render selected (full opacity)
|
|
108
|
+
* rather than the de-emphasized `first` tier. In `auto` trigger this is true
|
|
109
|
+
* only while a dropdown option is highlighted; in `manual` it's true once the
|
|
110
|
+
* pill has been tapped (the dropdown is open).
|
|
111
|
+
*/
|
|
112
|
+
isActivePillSelected: boolean;
|
|
106
113
|
placeholderText: string;
|
|
107
114
|
listboxId: string;
|
|
108
115
|
error: Error | null;
|
|
@@ -157,15 +164,27 @@ interface AIAutocompleteDropdownProps {
|
|
|
157
164
|
onPillClick?: (index: number) => void;
|
|
158
165
|
/** Whether to render pills inside the dropdown. Default: true. Tier 2 consumers who render their own pills should set this to false. */
|
|
159
166
|
showPills?: boolean;
|
|
167
|
+
/** Whether the active pill renders selected (full opacity) vs. the `first` tier. Provided by `dropdownProps` from the hook. Default: false. */
|
|
168
|
+
activeSelected?: boolean;
|
|
160
169
|
/** True while a fetch for the latest query is in flight. Replaces options/pills with a skeleton. */
|
|
161
170
|
isLoading?: boolean;
|
|
162
171
|
/** Once the user has tabbed to highlight an option, the footer hint switches from "tab to select" to "→ to skip". Provided by `dropdownProps` from the hook. */
|
|
163
172
|
hasTabbedToHighlight?: boolean;
|
|
173
|
+
/** When the input has no typed text, the footer hint reads "tab to skip" (Tab skips the active pill). Provided by `dropdownProps` from the hook. */
|
|
174
|
+
isInputEmpty?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Where the dropdown opens relative to the input. When `"above"`, the dropdown
|
|
177
|
+
* positions itself above (and reverses its internal layout so options sit
|
|
178
|
+
* nearest the input). Provided by `dropdownProps` from the hook, so headless
|
|
179
|
+
* consumers get the same above/below behavior as Tier 1 with no extra CSS.
|
|
180
|
+
* Default: `"below"`.
|
|
181
|
+
*/
|
|
182
|
+
optionsPosition?: "above" | "below";
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
|
|
167
186
|
|
|
168
|
-
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, isLoading, hasTabbedToHighlight, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
187
|
+
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, activeSelected, isLoading, hasTabbedToHighlight, isInputEmpty, optionsPosition, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
169
188
|
|
|
170
189
|
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
171
190
|
|