@primer/react
Version:
An implementation of GitHub's Primer Design System using React
71 lines • 3.83 kB
TypeScript
import { type Icon } from '@primer/octicons-react';
import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
import React from 'react';
import type { ActionListTrailingActionProps, ActionListDividerProps, ActionListLeadingVisualProps, ActionListTrailingVisualProps, ActionListGroupHeadingProps } from '../ActionList';
import { type PolymorphicProps } from '../utils/modern-polymorphic';
export type NavListProps = {
children: React.ReactNode;
} & React.ComponentProps<'nav'>;
export type NavListItemProps<As extends React.ElementType = React.ElementType> = PolymorphicProps<As, 'a', {
children: React.ReactNode;
defaultOpen?: boolean;
href?: string;
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
inactiveText?: string;
}>;
export type NavListSubNavProps = {
children: React.ReactNode;
};
export type NavListLeadingVisualProps = ActionListLeadingVisualProps;
export type NavListTrailingVisualProps = ActionListTrailingVisualProps;
export type NavListDividerProps = ActionListDividerProps;
export type NavListTrailingActionProps = ActionListTrailingActionProps;
export type NavListGroupProps = React.HTMLAttributes<HTMLLIElement> & {
children: React.ReactNode;
title?: string;
};
type GroupItem = {
text: string;
trailingVisual?: Icon | string;
leadingVisual?: Icon;
trailingAction?: ActionListTrailingActionProps;
'data-expand-focus-target'?: string;
} & Omit<NavListItemProps, 'children'>;
export type NavListGroupExpandProps = {
label?: string;
pages?: number;
items: GroupItem[];
renderItem?: (item: GroupItem) => React.ReactNode;
};
export declare const GroupExpand: React.ForwardRefExoticComponent<NavListGroupExpandProps & React.RefAttributes<HTMLButtonElement>>;
export type NavListGroupHeadingProps = ActionListGroupHeadingProps;
export declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref"> & React.RefAttributes<HTMLElement>> & {
Description: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("..").ActionListDescriptionProps>>;
Item: (<As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
children: React.ReactNode;
defaultOpen?: boolean;
href?: string;
'aria-current'?: "page" | "step" | "location" | "date" | "time" | "true" | "false" | boolean;
inactiveText?: string;
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
children: React.ReactNode;
defaultOpen?: boolean;
href?: string;
'aria-current'?: "page" | "step" | "location" | "date" | "time" | "true" | "false" | boolean;
inactiveText?: string;
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
as?: As | undefined;
} & React.RefAttributes<unknown>) => React.ReactNode) & {
displayName: string;
};
SubNav: PolymorphicForwardRefComponent<"ul", NavListSubNavProps>;
LeadingVisual: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("../ActionList/Visuals").VisualProps>>;
TrailingVisual: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("../ActionList/Visuals").VisualProps>>;
TrailingAction: PolymorphicForwardRefComponent<"a" | "button", ActionListTrailingActionProps>;
Divider: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<ActionListDividerProps>>;
Group: React.FC<NavListGroupProps>;
GroupExpand: React.ForwardRefExoticComponent<NavListGroupExpandProps & React.RefAttributes<HTMLButtonElement>>;
GroupHeading: React.FC<ActionListGroupHeadingProps>;
};
export {};
//# sourceMappingURL=NavList.d.ts.map