mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
Fix/autocomplete ref (#1948)
* fix(tabs): selected key prop duplicated type removed * fix(autocomplete): reference aims to input * chore(autocomplete): changeset
This commit is contained in:
parent
36775dceee
commit
aab1dbf77c
5
.changeset/lucky-chefs-remain.md
Normal file
5
.changeset/lucky-chefs-remain.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@nextui-org/autocomplete": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Autocomplete Reference aims to input instead of aiming to the wrapper element
|
||||||
5
.changeset/silent-lemons-mate.md
Normal file
5
.changeset/silent-lemons-mate.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@nextui-org/tabs": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix #1938 selectedKey duplicated declaration
|
||||||
@ -177,10 +177,10 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
|
|||||||
|
|
||||||
// Setup refs and get props for child elements.
|
// Setup refs and get props for child elements.
|
||||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
|
||||||
const inputWrapperRef = useRef<HTMLDivElement>(null);
|
const inputWrapperRef = useRef<HTMLDivElement>(null);
|
||||||
const listBoxRef = useRef<HTMLUListElement>(null);
|
const listBoxRef = useRef<HTMLUListElement>(null);
|
||||||
const popoverRef = useRef<HTMLDivElement>(null);
|
const popoverRef = useRef<HTMLDivElement>(null);
|
||||||
|
const inputRef = useDOMRef<HTMLInputElement>(ref);
|
||||||
const scrollShadowRef = useDOMRef<HTMLElement>(scrollRefProp);
|
const scrollShadowRef = useDOMRef<HTMLElement>(scrollRefProp);
|
||||||
|
|
||||||
const slotsProps: {
|
const slotsProps: {
|
||||||
@ -293,8 +293,6 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
|
|||||||
|
|
||||||
const Component = as || "div";
|
const Component = as || "div";
|
||||||
|
|
||||||
const domRef = useDOMRef(ref);
|
|
||||||
|
|
||||||
const slots = useMemo(
|
const slots = useMemo(
|
||||||
() =>
|
() =>
|
||||||
autocomplete({
|
autocomplete({
|
||||||
@ -320,7 +318,6 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
|
|||||||
);
|
);
|
||||||
|
|
||||||
const getBaseProps: PropGetter = () => ({
|
const getBaseProps: PropGetter = () => ({
|
||||||
ref: domRef,
|
|
||||||
"data-invalid": dataAttr(originalProps?.isInvalid),
|
"data-invalid": dataAttr(originalProps?.isInvalid),
|
||||||
"data-open": dataAttr(state.isOpen),
|
"data-open": dataAttr(state.isOpen),
|
||||||
className: slots.base({class: baseStyles}),
|
className: slots.base({class: baseStyles}),
|
||||||
@ -419,7 +416,7 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
Component,
|
Component,
|
||||||
domRef,
|
inputRef,
|
||||||
label,
|
label,
|
||||||
state,
|
state,
|
||||||
slots,
|
slots,
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export interface Props extends Omit<HTMLNextUIProps, "children"> {
|
|||||||
|
|
||||||
export type UseTabsProps<T> = Props &
|
export type UseTabsProps<T> = Props &
|
||||||
TabsVariantProps &
|
TabsVariantProps &
|
||||||
Omit<TabListStateOptions<T>, "children"> &
|
Omit<TabListStateOptions<T>, "children" | keyof AriaTabListProps<T>> &
|
||||||
Omit<AriaTabListProps<T>, "children" | "orientation"> &
|
Omit<AriaTabListProps<T>, "children" | "orientation"> &
|
||||||
CollectionProps<T>;
|
CollectionProps<T>;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user