import React, { PropsWithChildren } from 'react'; /** * Design tokens */ import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/subdomain-nav-bar/colors-with-modes.css'; export type SubdomainNavBarMenuLabels = { /** * Visible and accessible label for the closed narrow menu control. */ menuLabel: string; /** * Visible and accessible label for the open narrow menu control. */ closeLabel: string; /** * Visible and accessible label for the desktop overflow menu control. */ overflowMenuLabel: string; }; export type SubdomainNavBarVariant = 'default' | 'featured'; export type SubdomainNavBarProps = Omit, 'children' | 'title'> & { /** * Valid child elements are `SubdomainNavBar.Link`, `SubdomainNavBar.PrimaryAction`, * `SubdomainNavBar.SecondaryAction` and `SubdomainNavBar.Search` */ children?: React.ReactNode | React.ReactElement | React.ReactElement | React.ReactElement; /** * Fixes the navigation bar to the top of the viewport. Defaults to `true`. */ fixed?: boolean; /** * Fill the maximum width of the parent container. Defaults to `false`. */ fullWidth?: boolean; /** * Sets the navigation layout. Defaults to `default`. */ variant?: SubdomainNavBarVariant; /** * Optional React element rendered after the navigation links. */ leadingComponent?: React.ReactElement; /** * Optional React element rendered after the actions. */ trailingComponent?: React.ReactElement; /** * The title or name of the subdomain. Appears adjacent to the logo and is required for communicating content to assistive technologies. */ title: string; /** * The URL for the site. Typically used to link the titleText prop value to the site root. */ titleHref?: string; /** * Optionally change the URL of the logo */ logoHref?: string; /** * When the menu is opened or closed on narrow viewports, this callback is called with the new open state. */ onNarrowMenuToggle?: (isOpen: boolean) => void; /** * Customizable visible and accessible menu labels. */ menuLabels?: Partial; /** * ID of the element that receives focus when the skip-to-content link is activated. * Defaults to the first rendered `main` element that is not hidden from assistive technologies. */ skipToContentTargetId?: string; }; export type SubdomainNavBarHandle = HTMLElement & { openSearch: () => void; closeSearch: () => void; }; export type SubdomainNavBarLinkProps = { href: string; isExternal?: boolean; } & React.DetailedHTMLProps, HTMLLIElement> & Pick, 'rel' | 'target'>; declare function Link({ href, className, children, isExternal, 'aria-current': ariaCurrent, 'aria-hidden': ariaHidden, rel, tabIndex, target, ...rest }: PropsWithChildren): React.JSX.Element; export type SubdomainNavBarSearchResultProps = { title: string; description: string; url: string; date: string; category?: string; group?: string; isExternal?: boolean; }; export type SubdomainNavBarSearchResultGroupProps = { title: string; results: SubdomainNavBarSearchResultProps[]; }; export type SubdomainNavBarSearchResults = SubdomainNavBarSearchResultProps[] | SubdomainNavBarSearchResultGroupProps[]; export type SubdomainNavBarSearchLabels = { /** * Accessible label for the search input. Defaults to "Search". */ searchLabel: string; /** * Visible and accessible label for the close action. Defaults to "Close". */ closeLabel: string; /** * Accessible label for an untitled search result group. Defaults to "Results". */ resultsLabel: string; /** * Accessible label for grouped search results without a search term. Defaults to "Search results". */ searchResultsLabel: string; /** * Formats the default search placeholder and dialog label using the navigation title. */ formatSearchWithTitle: (title: string) => string; /** * Formats the accessible label for the responsive search trigger. */ formatSearchTrigger: (placeholder: string) => string; /** * Formats the visible heading for ungrouped search results. */ formatResultsHeading: (searchTerm: string) => string; /** * Formats the accessible label for grouped search results. */ formatResultsLabel: (searchTerm: string) => string; /** * Formats the search result count announcement. */ formatSuggestions: (count: number) => string; }; export type SubdomainNavBarSearchProps = { onSubmit: (e: React.FormEvent) => void; onChange: (e: React.ChangeEvent) => void; active?: boolean; className?: string; title?: string; onSearchOpen?: () => void; onSearchClose?: () => void; /** * Placeholder text shown in the search trigger and the opened search input. */ placeholder?: string; /** * Optional keyboard shortcut hint shown in the search trigger. Pass an empty string to hide it. */ shortcutLabel?: string; /** * Optional global keyboard shortcut that opens the search dialog. Omit or pass `false` to disable it. * Supports single keys and modifier combinations, such as `/` or `Command+Option+k`. */ keyboardShortcut?: string | false; searchResults?: SubdomainNavBarSearchResults; searchTerm?: string; /** * Customizable visible and accessible search text. Unspecified labels use the English defaults. */ labels?: Partial; }; type CTAActionProps = { href: string; } & React.HTMLAttributes; declare function PrimaryAction({ children, href, ...rest }: PropsWithChildren): React.JSX.Element; declare function SecondaryAction({ children, href, ...rest }: PropsWithChildren): React.JSX.Element; export declare const SubdomainNavBar: React.ForwardRefExoticComponent, "title" | "children"> & { /** * Valid child elements are `SubdomainNavBar.Link`, `SubdomainNavBar.PrimaryAction`, * `SubdomainNavBar.SecondaryAction` and `SubdomainNavBar.Search` */ children?: React.ReactNode | React.ReactElement | React.ReactElement | React.ReactElement; /** * Fixes the navigation bar to the top of the viewport. Defaults to `true`. */ fixed?: boolean; /** * Fill the maximum width of the parent container. Defaults to `false`. */ fullWidth?: boolean; /** * Sets the navigation layout. Defaults to `default`. */ variant?: SubdomainNavBarVariant; /** * Optional React element rendered after the navigation links. */ leadingComponent?: React.ReactElement; /** * Optional React element rendered after the actions. */ trailingComponent?: React.ReactElement; /** * The title or name of the subdomain. Appears adjacent to the logo and is required for communicating content to assistive technologies. */ title: string; /** * The URL for the site. Typically used to link the titleText prop value to the site root. */ titleHref?: string; /** * Optionally change the URL of the logo */ logoHref?: string; /** * When the menu is opened or closed on narrow viewports, this callback is called with the new open state. */ onNarrowMenuToggle?: (isOpen: boolean) => void; /** * Customizable visible and accessible menu labels. */ menuLabels?: Partial; /** * ID of the element that receives focus when the skip-to-content link is activated. * Defaults to the first rendered `main` element that is not hidden from assistive technologies. */ skipToContentTargetId?: string; } & React.RefAttributes> & { Link: typeof Link; Search: React.ForwardRefExoticComponent>; PrimaryAction: typeof PrimaryAction; SecondaryAction: typeof SecondaryAction; testIds: { root: string; readonly innerContainer: string; readonly menuButton: string; readonly menuLinks: string; readonly liveRegion: string; }; }; export {}; //# sourceMappingURL=SubdomainNavBar.d.ts.map