Skip to content

Commit

Permalink
Fix/autocomplete ref (#1948)
Browse files Browse the repository at this point in the history
* fix(tabs): selected key prop duplicated type removed

* fix(autocomplete): reference aims to input

* chore(autocomplete): changeset
  • Loading branch information
jrgarciadev authored Nov 10, 2023
1 parent 36775dc commit aab1dbf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-chefs-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/autocomplete": patch
---

Autocomplete Reference aims to input instead of aiming to the wrapper element
5 changes: 5 additions & 0 deletions .changeset/silent-lemons-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/tabs": patch
---

Fix #1938 selectedKey duplicated declaration
7 changes: 2 additions & 5 deletions packages/components/autocomplete/src/use-autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete

// Setup refs and get props for child elements.
const buttonRef = useRef<HTMLButtonElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
const inputWrapperRef = useRef<HTMLDivElement>(null);
const listBoxRef = useRef<HTMLUListElement>(null);
const popoverRef = useRef<HTMLDivElement>(null);
const inputRef = useDOMRef<HTMLInputElement>(ref);
const scrollShadowRef = useDOMRef<HTMLElement>(scrollRefProp);

const slotsProps: {
Expand Down Expand Up @@ -293,8 +293,6 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete

const Component = as || "div";

const domRef = useDOMRef(ref);

const slots = useMemo(
() =>
autocomplete({
Expand All @@ -320,7 +318,6 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
);

const getBaseProps: PropGetter = () => ({
ref: domRef,
"data-invalid": dataAttr(originalProps?.isInvalid),
"data-open": dataAttr(state.isOpen),
className: slots.base({class: baseStyles}),
Expand Down Expand Up @@ -419,7 +416,7 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete

return {
Component,
domRef,
inputRef,
label,
state,
slots,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/tabs/src/use-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface Props extends Omit<HTMLNextUIProps, "children"> {

export type UseTabsProps<T> = Props &
TabsVariantProps &
Omit<TabListStateOptions<T>, "children"> &
Omit<TabListStateOptions<T>, "children" | keyof AriaTabListProps<T>> &
Omit<AriaTabListProps<T>, "children" | "orientation"> &
CollectionProps<T>;

Expand Down

2 comments on commit aab1dbf

@vercel
Copy link

@vercel vercel bot commented on aab1dbf Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on aab1dbf Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.