import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon' import { booleanishConverter, convertUserMenuItem as sharedConvertUserMenuItem } from 'shared-types' /* eslint-disable no-duplicate-imports */ import type { Booleanish, User as SharedUser, Representing as SharedRepresenting, UserMenuItem as SharedUserMenuItem, TInternalMenuItem as SharedTInternalMenuItem, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, IPktHeaderGlobal as ISharedPktHeaderGlobal, } from 'shared-types' export type { Booleanish, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, } /** Which header variant `` renders. */ export type THeaderType = 'service' | 'global' /** Which dropdown/overlay is open in the global header. */ export type TGlobalHeaderMenu = 'none' | 'menu' | 'user' | 'search' export { booleanishConverter } // Re-export with PktIconName typing export type User = SharedUser export type Representing = SharedRepresenting export type UserMenuItem = SharedUserMenuItem export type TInternalMenuItem = SharedTInternalMenuItem /** * Helper to convert UserMenuItem (with target) to internal format */ export const convertUserMenuItem = (item: UserMenuItem): TInternalMenuItem => { return sharedConvertUserMenuItem(item) } /** * Interface for the Header component props */ export interface IPktHeader { /** Hide the Oslo logo */ hideLogo?: Booleanish /** Logo link URL */ logoLink?: string /** Override CDN path for the logo */ logoPath?: string /** Service name displayed in the header */ serviceName?: string /** Service link URL */ serviceLink?: string /** Use compact header height */ compact?: Booleanish /** Header position. 'fixed' fixes to top of viewport, 'relative' follows document flow. Default: 'fixed' */ position?: THeaderPosition /** Scroll behavior. 'hide' hides header on scroll down, 'none' keeps it visible. Default: 'hide' */ scrollBehavior?: THeaderScrollBehavior /** User object for logged-in user */ user?: User /** User menu items */ userMenu?: UserMenuItem[] /** Representation object */ representing?: Representing /** Allow user to change representation */ canChangeRepresentation?: Booleanish /** Logout button placement */ logOutButtonPlacement?: TLogOutButtonPlacement /** Whether there's a logout handler attached (required for logout button to show) */ hasLogOut?: Booleanish /** Show search field */ showSearch?: Booleanish /** Search field placeholder */ searchPlaceholder?: string /** Controlled search value */ searchValue?: string /** Custom breakpoint for responsive behavior in pixels. Default: 1024 */ mobileBreakpoint?: number /** Custom breakpoint for tablet responsive behavior in pixels. Default: 1280 */ tabletBreakpoint?: number /** Which menu is initially open */ openedMenu?: THeaderMenu /** Variant for the slot menu button. Default: 'icon-only' */ slotMenuVariant?: TSlotMenuVariant /** Text for the slot menu button. Default: 'Meny' */ slotMenuText?: string /** Which header variant to render. Default: 'service' */ type?: THeaderType } /** * Interface for the global (kommune-wide) Header element props. * * Extends the framework-agnostic {@link ISharedPktHeaderGlobal} base * (in shared-types), narrowing boolean fields to `Booleanish`, typing * `userMenu` icons as `PktIconName`, and adding the Lit-only `hasLogOut` * signal. */ export interface IPktHeaderGlobal extends Omit< ISharedPktHeaderGlobal, 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu' > { /** Show the search field. Default: true */ showSearch?: Booleanish /** Show the contact link (from the payload's `header.contact`). Default: true */ showContact?: Booleanish /** Allow the user to change representation. */ canChangeRepresentation?: Booleanish /** User menu items. */ userMenu?: UserMenuItem[] /** Whether a logout handler is attached (required for the logout button to show). */ hasLogOut?: Booleanish }