Skip to content

Commit

Permalink
chore: props omitted in the component itself
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Dec 1, 2024
1 parent 1523ca7 commit e4bd399
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .changeset/ten-experts-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@nextui-org/listbox": patch
"@nextui-org/menu": patch
"@nextui-org/theme": patch
---

Virtualization support added to Listbox and Menu
2 changes: 1 addition & 1 deletion packages/components/listbox/src/base/listbox-item-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
}

export type ListboxItemBaseProps<T extends object = {}> = Props<T> &
ListboxItemVariantProps &
Omit<ListboxItemVariantProps, "hasDescriptionTextChild" | "hasTitleTextChild"> &
Omit<AriaOptionProps, "key"> &
FocusableProps &
PressEvents;
Expand Down
3 changes: 2 additions & 1 deletion packages/components/listbox/src/listbox-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {useMemo, ReactNode} from "react";
import {UseListboxItemProps, useListboxItem} from "./use-listbox-item";
import {ListboxSelectedIcon} from "./listbox-selected-icon";

export interface ListboxItemProps<T extends object = object> extends UseListboxItemProps<T> {}
export interface ListboxItemProps<T extends object = object>
extends Omit<UseListboxItemProps<T>, "hasDescriptionTextChild" | "hasTitleTextChild"> {}

/**
* @internal
Expand Down
11 changes: 5 additions & 6 deletions packages/components/listbox/src/use-listbox-item.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {ListboxItemBaseProps} from "./base/listbox-item-base";
import type {MenuItemVariantProps} from "@nextui-org/theme";

import {useMemo, useRef, useCallback, Fragment} from "react";
import {listboxItem, MenuItemVariantProps} from "@nextui-org/theme";
import {listboxItem} from "@nextui-org/theme";
import {
HTMLNextUIProps,
mapPropsVariants,
Expand All @@ -24,15 +25,13 @@ interface Props<T extends object> extends ListboxItemBaseProps<T> {
}

export type UseListboxItemProps<T extends object> = Props<T> &
Omit<HTMLNextUIProps<"li">, keyof Props<T>>;
Omit<HTMLNextUIProps<"li">, keyof Props<T>> &
MenuItemVariantProps;

export function useListboxItem<T extends object>(originalProps: UseListboxItemProps<T>) {
const globalContext = useProviderContext();

const [props, variantProps] = mapPropsVariants(
originalProps,
listboxItem.variantKeys as (keyof MenuItemVariantProps)[],
);
const [props, variantProps] = mapPropsVariants(originalProps, listboxItem.variantKeys);

const {
as,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/menu/src/base/menu-item-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
}

export type MenuItemBaseProps<T extends object = {}> = Props<T> &
MenuItemVariantProps &
Omit<MenuItemVariantProps, "hasDescriptionTextChild" | "hasTitleTextChild"> &
AriaMenuItemProps &
FocusableProps &
PressEvents;
Expand Down
3 changes: 2 additions & 1 deletion packages/components/menu/src/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {useMemo, ReactNode} from "react";
import {UseMenuItemProps, useMenuItem} from "./use-menu-item";
import {MenuSelectedIcon} from "./menu-selected-icon";

export interface MenuItemProps<T extends object = object> extends UseMenuItemProps<T> {}
export interface MenuItemProps<T extends object = object>
extends Omit<UseMenuItemProps<T>, "hasDescriptionTextChild" | "hasTitleTextChild"> {}

/**
* @internal
Expand Down
5 changes: 1 addition & 4 deletions packages/core/theme/src/components/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,7 @@ export type MenuVariantProps = VariantProps<typeof menu>;
export type MenuSlots = keyof ReturnType<typeof menu>;
export type MenuSectionVariantProps = VariantProps<typeof menuSection>;
export type MenuSectionSlots = keyof ReturnType<typeof menuSection>;
export type MenuItemVariantProps = Omit<
VariantProps<typeof menuItem>,
"hasDescriptionTextChild" | "hasTitleTextChild"
>;
export type MenuItemVariantProps = VariantProps<typeof menuItem>;
export type MenuItemSlots = keyof ReturnType<typeof menuItem>;

export {menu, menuItem, menuSection};

0 comments on commit e4bd399

Please sign in to comment.