UNPKG

@synergy-design-system/components

Version:

This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define

88 lines (87 loc) 3.81 kB
import type { CSSResultGroup } from 'lit'; import SynergyElement from '../../internal/synergy-element.js'; import SynIcon from '../icon/icon.js'; import type SynSideNav from '../side-nav/side-nav.component.js'; /** * @summary The <syn-header /> element provides a generic application header * that can be used to add applications name, toolbar and primary navigation. * * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-header--docs * @status stable * @since 1.10.0 * * @slot label - The label for the header * @slot logo - The logo that should be displayed. Will fall back to the SICK logo if not provided * @slot meta-navigation - The meta-navigation is used to add various application toolbar icons * Best used with `<syn-icon-button />` and `<syn-drop-down />` * @slot navigation - This slot can be used to add an optional horizontal navigation * @slot open-burger-menu-icon - An icon to use in lieu of the default burger-menu=open state. * The default close icon is a 'x'. * @slot closed-burger-menu-icon - An icon to use in lieu of the default burger-menu=closed state. * The default open icon is a burger menu. * * @event syn-burger-menu-closed - Emitted when the burger menu is toggled to closed * @event syn-burger-menu-hidden - Emitted when the burger menu is toggled to hidden * @event syn-burger-menu-open - Emitted when the burger menu is toggled to open * * @csspart base - The component's base wrapper * @csspart content - The wrapper most content items reside * @csspart logo - The wrapper the application logo resides in * @csspart label - The element wrapping the application name * @csspart meta-navigation - The Item wrapping the optional application menu * @csspart navigation - The wrapper that is holding the optional top navigation section * @csspart burger-menu-toggle-button - The button that toggles the burger menu */ export default class SynHeader extends SynergyElement { static styles: CSSResultGroup; static dependencies: { 'syn-icon': typeof SynIcon; }; private readonly hasSlotController; private readonly localize; /** * Internal mutation observer */ private mutationObserver; private isSideNavAnimating; /** * The headers label. If you need to display HTML, use the `label` slot instead. */ label: string; /** * Defines the current visibility and icon of the burger-menu icon. * The menu button is added automatically if the component finds a syn-side-nav in * variant="default". * The following values can be used: * - hidden: The burger menu is not visible * - open: The burger menu is visible and shows the close icon * - closed: The burger menu is visible and shows the open icon */ burgerMenu: 'hidden' | 'open' | 'closed'; /** * The side nav */ private sideNav; private toggleBurgerMenu; private handleBurgerMenuToggle; /** * Automatically update the burger menu icon based * on the state of the side-nav, if one is connected. */ private updateBurgerMenuBasedOnSideNav; handleBurgerMenu(): void; connectedCallback(): void; firstUpdated(): void; disconnectedCallback(): void; /** * Connect a `syn-side-nav` to add automatic interaction of the header with the side navigation * like showing the burger menu icon and open / close handling. * * If no side navigation is connected, the header will use the first `syn-side-nav` element it * finds. * * @param sideNav The side navigation to connect to the header */ connectSideNavigation(sideNav: SynSideNav | null): void; render(): import("lit").TemplateResult; }