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={[ data={[
{ {
attribute: "children", attribute: "children",
type: "ReactNode | string", type: "ReactNode",
description: "The content of the component.", description: "The content of the component.",
default: "-" default: "-"
}, },
{ {
attribute: "title", attribute: "title",
type: "ReactNode | string", type: "ReactNode",
description: "The accordion item title.", description: "The accordion item title.",
default: "-" default: "-"
}, },
{ {
attribute: "subtitle", attribute: "subtitle",
type: "ReactNode | string", type: "ReactNode",
description: "The accordion item subtitle.", description: "The accordion item subtitle.",
default: "-" default: "-"
}, },

View File

@ -412,7 +412,7 @@ When the `NavbarItem` is active, it will have a `data-active` attribute. You can
data={[ data={[
{ {
attribute: "icon", 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.", description: "The icon to render as the navbar menu toggle.",
default: "-" default: "-"
}, },

View File

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

View File

@ -33,15 +33,15 @@ export interface Props<T extends object = {}>
/** /**
* The content of the component. * The content of the component.
*/ */
children?: ReactNode | null; children?: ReactNode;
/** /**
* The accordion item title. * The accordion item title.
*/ */
title?: ReactNode | string; title?: ReactNode;
/** /**
* The accordion item subtitle. * The accordion item subtitle.
*/ */
subtitle?: ReactNode | string; subtitle?: ReactNode;
/** /**
* The accordion item `expanded` indicator, it's usually an arrow icon. * 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, * 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. * The content of the component.
*/ */
children?: ReactNode | null; children?: ReactNode;
/** /**
* The listbox item title. * The listbox item title.
*/ */
title?: ReactNode | string; title?: ReactNode;
/** /**
* The listbox item subtitle. * The listbox item subtitle.
*/ */
description?: ReactNode | string; description?: ReactNode;
/** /**
* The listbox item start content. * The listbox item start content.
*/ */

View File

@ -29,7 +29,7 @@ const ListboxItem = (props: ListboxItemProps) => {
getSelectedIconProps, getSelectedIconProps,
} = useListboxItem(props); } = useListboxItem(props);
const selectedContent = useMemo<ReactNode | null>(() => { const selectedContent = useMemo<ReactNode>(() => {
const defaultIcon = ( const defaultIcon = (
<ListboxSelectedIcon disableAnimation={disableAnimation} isSelected={isSelected} /> <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. * The content of the component.
*/ */
children?: ReactNode | null; children?: ReactNode;
/** /**
* The menu item title. * The menu item title.
*/ */
title?: ReactNode | string; title?: ReactNode;
/** /**
* The menu item subtitle. * The menu item subtitle.
*/ */
description?: ReactNode | string; description?: ReactNode;
/** /**
* The menu item keyboard shortcut. * The menu item keyboard shortcut.
*/ */
shortcut?: ReactNode | string; shortcut?: ReactNode;
/** /**
* The menu item start content. * The menu item start content.
*/ */

View File

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

View File

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

View File

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

View File

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