import { type PropertyValues } from 'lit'; import { UiElement } from '../shared/element.js'; import type { ContentSwitcherSize } from '../content-switcher/content-switcher.js'; import type { TooltipPlacement } from '../tooltip/tooltip.js'; import '../content-switcher/content-switcher.js'; import { type CarbonTheme, type ThemeChangeDetail, type ThemeMode } from '../../core/theme.js'; export type { CarbonTheme, ThemeChangeDetail, ThemeMode } from '../../core/theme.js'; /** * Lets a person pick the light, dark or system theme (no Carbon counterpart; the user chose an icon * content switcher, as the theme setting of IBM Cloud). The choice shows on `` as * `light-theme` / `dark-theme` (white / g100 by default; system follows the OS while it changes) and * is remembered in `localStorage` under `storage-key` (`""` = not remembered). It starts on the * remembered mode, else `value`, else what `` shows. Picking one fires * `ui-theme-change` { mode, theme }; every switcher on the page, and in other tabs, follows. Setting * `value` applies and remembers it too (e.g. from a profile saved on the server). Put * `themeScript()` from the core in `` so a reload paints the remembered theme at once. * * @csspart switcher - The `` * @csspart item - Each `` * @fires ui-theme-change - The person picked a mode: { mode, theme } */ export declare class UiThemeSwitcher extends UiElement { static readonly styles: import("lit").CSSResult; /** The mode shown: light, dark or system. */ value?: ThemeMode; /** The Carbon theme of "light" (white or g10). */ lightTheme: CarbonTheme; /** The Carbon theme of "dark" (g90 or g100). */ darkTheme: CarbonTheme; /** The `localStorage` key; empty = don't remember. */ storageKey: string; size: ContentSwitcherSize; lowContrast: boolean; /** Where the icons' tooltips show (Carbon `IconSwitch` `align`). */ tooltipPlacement: TooltipPlacement; /** Names the group; defaults to the translation of "Theme". */ label: string; private readonly localize; private stopWatching?; /** Set while the value comes from the page itself (start, another switcher, another tab): shown, not saved again. */ private quiet; connectedCallback(): void; disconnectedCallback(): void; protected updated(changed: PropertyValues): void; private apply; /** Follow another switcher on this page. */ private readonly onPageChange; /** Follow a pick made in another tab. */ private readonly onStorage; private onChange; render(): import("lit-html").TemplateResult<1>; } export interface UiThemeSwitcherEventMap extends HTMLElementEventMap { 'ui-theme-change': CustomEvent; } /** Typed listeners for UiThemeSwitcher's events (declaration merging with the class). */ export interface UiThemeSwitcher { addEventListener(type: K, listener: (this: UiThemeSwitcher, event: UiThemeSwitcherEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiThemeSwitcher, event: UiThemeSwitcherEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-theme-switcher': UiThemeSwitcher; } }