refactor: remove unnecessary props types (#4530)

* refactor(docs): remove string type as it is included in ReactNode

* refactor: remove unnecessary types

* feat(changeset): add changeset

* chore: remove changeset

* refactor: remove null since ReactNode unions it already
This commit is contained in:
աӄա 2025-01-13 16:23:29 +08:00 committed by GitHub
parent fcdf24a019
commit 26fc514791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 22 additions and 22 deletions

View File

@ -327,19 +327,19 @@ Here's an example of how to customize the accordion styles:
data={[
{
attribute: "children",
type: "ReactNode | string",
type: "ReactNode",
description: "The content of the component.",
default: "-"
},
{
attribute: "title",
type: "ReactNode | string",
type: "ReactNode",
description: "The accordion item title.",
default: "-"
},
{
attribute: "subtitle",
type: "ReactNode | string",
type: "ReactNode",
description: "The accordion item subtitle.",
default: "-"
},

View File

@ -412,7 +412,7 @@ When the `NavbarItem` is active, it will have a `data-active` attribute. You can
data={[
{
attribute: "icon",
type: "ReactNode | ((isOpen: boolean | undefined) => ReactNode | null)",
type: "ReactNode | ((isOpen: boolean | undefined) => ReactNode)",
description: "The icon to render as the navbar menu toggle.",
default: "-"
},

View File

@ -40,7 +40,7 @@ const AccordionItem = forwardRef<"button", AccordionItemProps>((props, ref) => {
const willChange = useWillChange();
const indicatorContent = useMemo<ReactNode | null>(() => {
const indicatorContent = useMemo<ReactNode>(() => {
if (typeof indicator === "function") {
return indicator({indicator: <ChevronIcon />, isOpen, isDisabled});
}

View File

@ -33,15 +33,15 @@ export interface Props<T extends object = {}>
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The accordion item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The accordion item subtitle.
*/
subtitle?: ReactNode | string;
subtitle?: ReactNode;
/**
* The accordion item `expanded` indicator, it's usually an arrow icon.
* If you pass a function, NextUI will expose the current indicator and the open status,

View File

@ -25,15 +25,15 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The listbox item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The listbox item subtitle.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* The listbox item start content.
*/

View File

@ -29,7 +29,7 @@ const ListboxItem = (props: ListboxItemProps) => {
getSelectedIconProps,
} = useListboxItem(props);
const selectedContent = useMemo<ReactNode | null>(() => {
const selectedContent = useMemo<ReactNode>(() => {
const defaultIcon = (
<ListboxSelectedIcon disableAnimation={disableAnimation} isSelected={isSelected} />
);

View File

@ -25,19 +25,19 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The menu item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The menu item subtitle.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* The menu item keyboard shortcut.
*/
shortcut?: ReactNode | string;
shortcut?: ReactNode;
/**
* The menu item start content.
*/

View File

@ -32,7 +32,7 @@ const MenuItem = (props: MenuItemProps) => {
getSelectedIconProps,
} = useMenuItem(props);
const selectedContent = useMemo<ReactNode | null>(() => {
const selectedContent = useMemo<ReactNode>(() => {
const defaultIcon = (
<MenuSelectedIcon disableAnimation={disableAnimation} isSelected={isSelected} />
);

View File

@ -24,7 +24,7 @@ export interface UseSnippetProps extends Omit<HTMLNextUIProps, "onCopy">, Snippe
* The content of the snippet.
* if `string[]` is passed, it will be rendered as a multi-line snippet.
*/
children?: React.ReactNode | string | string[];
children?: React.ReactNode | string[];
/**
* The symbol to show before the snippet.
* @default "$"

View File

@ -4,11 +4,11 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"button", T>, "chi
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The title of the component.
*/
title?: ReactNode | null;
title?: ReactNode;
/**
* A string representation of the item's contents. Use this when the title is not readable.
* This will be used as native `title` attribute.

View File

@ -17,11 +17,11 @@ interface Props {
/**
* The user name.
*/
name: ReactNode | string;
name: ReactNode;
/**
* The user information, like email, phone, etc.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* Whether the user can be focused.
* @default false