@wix/design-system
Version:
@wix/design-system
84 lines (73 loc) • 2.92 kB
TypeScript
import * as React from 'react';
type SidebarItemNextSpecificProps = {
children?: React.ReactNode;
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook?: string;
/** Specifies a CSS class name to be appended to the component’s root element.
* @internal
*/
className?: string;
/** An element/array of elements to appear at the end of the text. max number of elements to pass is 2 */
suffix?: React.ReactNode;
/** An element to appear at the start of the text. */
prefix?: React.ReactNode;
/** A callback to be triggered on mouse enter */
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
/** A callback to be triggered on mouse leave */
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
/** Indicates whether to display the item as disabled */
disabled?: boolean;
/** A callback to be triggered on click */
onClick?: React.MouseEventHandler<HTMLButtonElement>;
/** unique identifier per item, used to mark it for navigation and selection */
itemKey?: string;
/** Defines one of the aria roles to provide semantic meaning to content */
role?: string;
/** Content of the tooltip shown when the sidebar is minimized */
minimizedTooltipContent?: React.ReactNode;
};
/**
* Omit SidebarItemNext specific properties.
*/
type OmitHTMLAttributes<T> = Omit<T, keyof SidebarItemNextSpecificProps>;
export type SidebarItemNextWithAsProp<T> =
| SidebarItemNextAsButtonProps<T>
| SidebarItemNextAsAnchorProps<T>
| SidebarItemNextGenericProps<T>
| SidebarItemNextAsComponentProps<T>;
type SidebarItemNextAsButtonProps<T> = OmitHTMLAttributes<
React.ButtonHTMLAttributes<HTMLButtonElement>
> &
T & {
/** render as some other component or DOM tag */
as?: 'button';
/** A callback to be triggered on click */
onClick?: React.MouseEventHandler<HTMLButtonElement>;
};
type SidebarItemNextAsAnchorProps<T> = OmitHTMLAttributes<
React.AnchorHTMLAttributes<HTMLAnchorElement>
> &
T & {
/** render as some other component or DOM tag */
as: 'a';
/** A callback to be triggered on click */
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
};
type SidebarItemNextGenericProps<T> = T & {
/** render as some other component or DOM tag */
as: keyof Omit<HTMLElementTagNameMap, 'a' | 'button'>;
/** A callback to be triggered on click */
onClick?: React.MouseEventHandler<HTMLElement>;
[additionalProps: string]: any;
};
type SidebarItemNextAsComponentProps<T> = T & {
/** render as some other component or DOM tag */
as: React.ComponentType<any>;
/** A callback to be triggered on click */
onClick?: React.MouseEventHandler<HTMLElement>;
[additionalProps: string]: any;
};
export type SidebarItemNextProps =
SidebarItemNextWithAsProp<SidebarItemNextSpecificProps>;
declare const SidebarItemNext: React.FC<SidebarItemNextProps>;
export default SidebarItemNext;