UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

82 lines (81 loc) 3.71 kB
import React, { type PropsWithChildren, type RefObject } from 'react'; import { ButtonSizes, ButtonVariants, TextProps } from '..'; import type { BaseProps } from '../component-helpers'; /** * Design tokens */ import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/sub-nav/base.css'; import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/sub-nav/colors-with-modes.css'; export declare const SubNavSubMenuVariants: readonly ["dropdown", "anchor"]; type SubMenuVariants = (typeof SubNavSubMenuVariants)[number]; type SubNavContextType = { portalRef: RefObject<HTMLDivElement>; }; export declare const useSubNavContext: () => SubNavContextType; export type SubNavProps = { hasShadow?: boolean; /** * Allows the SubNav to be used at full width, * removing any internal padding and guttering. */ fullWidth?: boolean; 'data-testid'?: string; } & PropsWithChildren<BaseProps<HTMLElement>>; type SubNavHeadingProps = { href: string; 'data-testid'?: string; } & PropsWithChildren<React.HTMLProps<HTMLAnchorElement>> & BaseProps<HTMLAnchorElement>; type SubNavSubHeadingProps = { href: string; 'data-testid'?: string; } & PropsWithChildren<React.HTMLProps<HTMLAnchorElement>> & BaseProps<HTMLAnchorElement>; type SubNavLinkProps = { href: string; 'data-testid'?: string; variant?: TextProps['variant']; _subMenuVariant?: SubMenuVariants; } & PropsWithChildren<React.HTMLProps<HTMLAnchorElement>> & BaseProps<HTMLAnchorElement>; type SubMenuProps = { variant?: SubMenuVariants; } & React.HTMLAttributes<HTMLUListElement> & BaseProps<HTMLUListElement>; declare function _SubMenu({ children, className, variant, ...props }: SubMenuProps): import("react/jsx-runtime").JSX.Element; type SubNavActionProps = { /** * Required path or location for the action button to link to. */ href: string; /** * Optional sizes for the button. */ size?: (typeof ButtonSizes)[number]; /** * Optional sizes for the button. */ variant?: (typeof ButtonVariants)[number]; } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>; declare function _SubNavAction({ children, href, variant, size, ...rest }: SubNavActionProps): import("react/jsx-runtime").JSX.Element; /** * Use SubNav to display a secondary navigation beneath a primary header. * @see https://primer.style/brand/components/SubNav */ export declare const SubNav: React.NamedExoticComponent<Omit<Omit<SubNavProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & { ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined; }> & { readonly type: React.ForwardRefExoticComponent<Omit<SubNavProps, "ref"> & React.RefAttributes<HTMLDivElement>>; } & { Heading: ({ href, children, className, "data-testid": testID, ...props }: SubNavHeadingProps) => import("react/jsx-runtime").JSX.Element; SubHeading: ({ href, children, className, "data-testid": testID, ...props }: SubNavSubHeadingProps) => import("react/jsx-runtime").JSX.Element; Link: React.ForwardRefExoticComponent<Omit<SubNavLinkProps, "ref"> & React.RefAttributes<HTMLDivElement | HTMLAnchorElement>>; Action: typeof _SubNavAction; SubMenu: typeof _SubMenu; testIds: { root: string; readonly button: string; readonly overlay: string; readonly link: string; readonly heading: string; readonly action: string; readonly subMenu: string; }; }; export {};