import { HighContrastModeDetector, FocusableOption, Highlightable, FocusOrigin } from '@angular/cdk/a11y'; import * as i0 from '@angular/core'; import { InjectionToken, Provider, AfterViewChecked, OnDestroy, EventEmitter, ElementRef, ChangeDetectorRef, QueryList, Version } from '@angular/core'; import { AbstractControl, FormGroupDirective, NgForm, NgControl } from '@angular/forms'; import { Subject, BehaviorSubject, Observable } from 'rxjs'; declare const Breakpoints: { Mobile: string; Tablet: string; Desktop: string; DesktopLarge: string; Desktop2k: string; Desktop4k: string; Desktop5k: string; MobileDevice: string; TabletDevice: string; DesktopDevice: string; MobileDevicePortrait: string; TabletDevicePortrait: string; DesktopDevicePortrait: string; MobileDeviceLandscape: string; TabletDeviceLandscape: string; DesktopDeviceLandscape: string; }; declare const SCALING_FACTOR_4K = 1.5; declare const SCALING_FACTOR_5K = 2; /** @docs-private */ declare function SBB_SANITY_CHECKS_FACTORY(): SanityChecks; /** Injection token that configures whether the SBB sanity checks are enabled. */ declare const SBB_SANITY_CHECKS: InjectionToken; /** * Possible sanity checks that can be enabled. If set to * true/false, all checks will be enabled/disabled. */ type SanityChecks = boolean | GranularSanityChecks; /** Object that can be used to configure the sanity checks granularly. */ interface GranularSanityChecks { doctype: boolean; typography: boolean; version: boolean; } /** * Module that captures anything that should be loaded and/or run for *all* sbb-angular * components. This includes variant, etc. * * This module should be imported to each top-level component module (e.g. SbbTabsModule). */ declare class SbbCommonModule { private _sanityChecks; private _document; /** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */ private _hasDoneGlobalChecks; constructor(highContrastModeDetector: HighContrastModeDetector, _sanityChecks: SanityChecks, _document: Document); /** Gets whether a specific sanity check is enabled. */ private _checkIsEnabled; private _isDarkMode; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** @docs-private */ type Constructor = new (...args: any[]) => T; /** * This is a permissive type for abstract class constructors. * @docs-private */ type AbstractConstructor = abstract new (...args: any[]) => T; /** Provider that defines how form controls behave with regards to displaying error messages. */ declare class SbbErrorStateMatcher { isErrorState(control: AbstractControl | null, form: FormGroupDirective | NgForm | null): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** Error state matcher that matches when a control is invalid and dirty. */ declare class SbbShowOnDirtyErrorStateMatcher implements SbbErrorStateMatcher { isErrorState(control: AbstractControl | null, form: FormGroupDirective | NgForm | null): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Class that tracks the error state of a component. * @docs-private */ declare class _ErrorStateTracker { private _defaultMatcher; ngControl: NgControl | null; private _parentFormGroup; private _parentForm; private _stateChanges; /** Whether the tracker is currently in an error state. */ errorState: boolean; /** User-defined matcher for the error state. */ matcher: SbbErrorStateMatcher; constructor(_defaultMatcher: SbbErrorStateMatcher | null, ngControl: NgControl | null, _parentFormGroup: FormGroupDirective | null, _parentForm: NgForm | null, _stateChanges: Subject); /** Updates the error state based on the provided error state matcher. */ updateErrorState(): void; } /** * This is used to wrap types in a decorator context in order for the wrapped * type to not be in the meta data. This is necessary for type imports (e.g. * import type { ... } from '...') and global types, which are not available * in NodeJS (e.g. Event, MouseEvent, ...). * * e.g. * * import type { ClassDependency1 } from '...'; * * \@Component({ ... }) * class ExampleComponent { * // Meta data contains ClassDependency1, which breaks consumers * constructor(@Inject(DEPENDENCY) private dep1: ClassDependency1) {} * * // Meta data contains Event, which breaks SSR with NodeJS * onEvent(event: Event) { ... } * } * * \@Component({ ... }) * class ExampleComponent { * // Meta data contains undefined instead of ClassDependency1 * constructor(@Inject(DEPENDENCY) private dep1: TypeRef) {} * * // Meta data contains undefined instead of Event * onEvent(event: TypeRef) { ... } * } */ type TypeRef = T; declare const ɵvariant: BehaviorSubject; /** @docs-private */ interface HasVariant { /** Observable holding current variant (`lean` or `standard`) which emits by change */ readonly variant: Observable; /** Returns current active variant as a snapshot */ readonly variantSnapshot: SbbVariant; } /** Possible variant values. */ type SbbVariant = 'standard' | 'lean'; /** Mixin to augment a directive with a variant property. */ declare function mixinVariant>(base: T): AbstractConstructor & T; /** Adapts type `D` to be usable as a date by cdk-based components that work with dates. */ declare abstract class SbbDateAdapter { /** The locale to use for all dates. */ protected _locale: any; /** * Gets the year component of the given date. * @param date The date to extract the year from. * @returns The year component. */ abstract getYear(date: D): number; /** * Gets the month component of the given date. * @param date The date to extract the month from. * @returns The month component (0-indexed, 0 = January). */ abstract getMonth(date: D): number; /** * Gets the date of the month component of the given date. * @param date The date to extract the date of the month from. * @returns The month component (1-indexed, 1 = first of month). */ abstract getDate(date: D): number; /** * Gets the day of the week component of the given date. * @param date The date to extract the day of the week from. * @returns The month component (0-indexed, 0 = Sunday). */ abstract getDayOfWeek(date: D): number; abstract getMonthName(date: D): string; /** * Gets a list of names for the months. * @param style The naming style (e.g. long = 'January', short = 'Jan', narrow = 'J'). * @returns An ordered list of all month names, starting with January. */ abstract getMonthNames(style: 'long' | 'short' | 'narrow'): string[]; /** * Gets a list of names for the dates of the month. * @returns An ordered list of all date of the month names, starting with '1'. */ abstract getDateNames(): string[]; /** * Gets a list of names for the days of the week. * @param style The naming style (e.g. long = 'Sunday', short = 'Sun', narrow = 'S'). * @returns An ordered list of all weekday names, starting with Sunday. */ abstract getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[]; /** * Gets the name for the year of the given date. * @param date The date to get the year name for. * @returns The name of the given year (e.g. '2017'). */ abstract getYearName(date: D): string; /** * Gets the first day of the week. * @returns The first day of the week (0-indexed, 0 = Sunday). */ abstract getFirstDayOfWeek(): number; /** * Gets the number of days in the month of the given date. * @param date The date whose month should be checked. * @returns The number of days in the month of the given date. */ abstract getNumDaysInMonth(date: D): number; /** * Clones the given date. * @param date The date to clone * @returns A new date equal to the given date. */ abstract clone(date: D): D; /** * Creates a date with the given year, month, and date. Does not allow over/under-flow of the * month and date. * @param year The full year of the date. (e.g. 89 means the year 89, not the year 1989). * @param month The month of the date (0-indexed, 0 = January). Must be an integer 0 - 11. * @param date The date of month of the date. Must be an integer 1 - length of the given month. * @returns The new date, or null if invalid. */ abstract createDate(year: number, month: number, date: number): D; /** * Gets today's date. * @returns Today's date. */ abstract today(): D; /** * Parses a date from a user-provided value. * @param value The value to parse. * @returns The parsed date. */ abstract parse(value: any): D | null; /** * Formats a date as a string according to the given format. * @param date The value to format. * @param displayFormat The format to use to display the date as a string. * @returns The formatted date string. */ abstract format(date: D, displayFormat: any): string; /** * Adds the given number of years to the date. Years are counted as if flipping 12 pages on the * calendar for each year and then finding the closest date in the new month. For example when * adding 1 year to Feb 29, 2016, the resulting date will be Feb 28, 2017. * @param date The date to add years to. * @param years The number of years to add (may be negative). * @returns A new date equal to the given one with the specified number of years added. */ abstract addCalendarYears(date: D, years: number): D; /** * Adds the given number of months to the date. Months are counted as if flipping a page on the * calendar for each month and then finding the closest date in the new month. For example when * adding 1 month to Jan 31, 2017, the resulting date will be Feb 28, 2017. * @param date The date to add months to. * @param months The number of months to add (may be negative). * @returns A new date equal to the given one with the specified number of months added. */ abstract addCalendarMonths(date: D, months: number): D; /** * Adds the given number of days to the date. Days are counted as if moving one cell on the * calendar for each day. * @param date The date to add days to. * @param days The number of days to add (may be negative). * @returns A new date equal to the given one with the specified number of days added. */ abstract addCalendarDays(date: D, days: number): D; /** * Gets the RFC 3339 compatible string (https://tools.ietf.org/html/rfc3339) for the given date. * This method is used to generate date strings that are compatible with native HTML attributes * such as the `min` or `max` attribute of an ``. * @param date The date to get the ISO date string for. * @returns The ISO date string date string. */ abstract toIso8601(date: D): string; /** * Checks whether the given object is considered a date instance by this DateAdapter. * @param obj The object to check * @returns Whether the object is a date instance. */ abstract isDateInstance(obj: any): boolean; /** * Checks whether the given date is valid. * @param date The date to check. * @returns Whether the date is valid. */ abstract isValid(date: D): boolean; /** * Gets date instance that is not valid. * @returns An invalid date. */ abstract invalid(): D; /** * Attempts to deserialize a value to a valid date object. This is different from parsing in that * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601 * string). The default implementation does not allow any deserialization, it simply checks that * the given value is already a valid date object or null. The `` will call this * method on all of it's `@Input()` properties that accept dates. It is therefore possible to * support passing values from your backend directly to these properties by overriding this method * to also deserialize the format used by your backend. * @param value The value to be deserialized into a date object. * @returns The deserialized date object, either a valid date, null if the value can be * deserialized into a null date (e.g. the empty string), or an invalid date. */ deserialize(value: any): D | null; /** * Sets the locale used for all dates. * @param locale The new locale. */ setLocale(locale: any): void; /** * Compares two dates. * @param first The first date to compare. * @param second The second date to compare. * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier, * a number greater than 0 if the first date is later. */ compareDate(first: D, second: D): number; /** * Checks if two dates are equal. * @param first The first date to check. * @param second The second date to check. * @returns Whether the two dates are equal. * Null dates are considered equal to other null dates. */ sameDate(first: D | null, second: D | null): boolean; /** * Clamp the given date between min and max dates. * @param date The date to clamp. * @param min The minimum value to allow. If null or omitted no min is enforced. * @param max The maximum value to allow. If null or omitted no max is enforced. * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`, * otherwise `date`. */ clampDate(date: D, min?: D | null, max?: D | null): D; } interface SbbDateFormats { dateInput: any; dateInputPure: any; dateA11yLabel: any; } declare const SBB_DATE_FORMATS: InjectionToken; declare const SBB_DATE_PIPE_DATE_FORMATS: SbbDateFormats; declare const SBB_DATEPICKER_2DIGIT_YEAR_PIVOT: InjectionToken; declare const SBB_DATEPICKER_PREVENT_OVERFLOW: InjectionToken; declare class SbbNativeDateAdapter extends SbbDateAdapter { protected _locale: string; private _datePipe; private _yearPivot; private _titleCasePipe; private readonly _preventOverflow; constructor(_locale: string, yearPivot: number, preventOverflow?: boolean); getYear(date: Date): number; getMonth(date: Date): number; getDate(date: Date): number; getDayOfWeek(date: Date): number; getMonthName(date: Date): string; getMonthNames(style: 'long' | 'short' | 'narrow'): string[]; getDateNames(): string[]; getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[]; getYearName(date: Date): string; getFirstDayOfWeek(): number; getNumDaysInMonth(date: Date): number; clone(date: Date): Date; createDate(year: number, month: number, date: number): Date; today(): Date; parse(value: any): Date | null; format(date: Date, displayFormat: any): string; addCalendarYears(date: Date, years: number): Date; addCalendarMonths(date: Date, months: number): Date; addCalendarDays(date: Date, days: number): Date; toIso8601(date: Date): string; /** * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an * invalid date for all other values. */ deserialize(value: any): Date | null; isDateInstance(obj: any): boolean; isValid(date: Date): boolean; invalid(): Date; protected _splitStringDate(value: string): [number, number, number] | null; protected _parseStringDate(value: string): Date | null; protected _normalizeYear(date: Date): Date; /** Creates a date but allows the month and date to overflow. */ protected _createDateWithOverflow(year: number, month: number, date: number): Date; /** Checks whether a given date string contains an overflowing date. */ private _isOverflowingDate; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class SbbLeanDateAdapter extends SbbNativeDateAdapter { protected _locale: string; constructor(_locale: string, yearPivot: number, preventOverflow?: boolean); protected _parseStringDate(value: string): null | Date; protected _splitStringDate(value: string): [number, number, number] | null; private _parseStringDateLean; private _splitStringDateLean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const SBB_LEAN_DATE_ADAPTER: Provider; declare function provideLeanDateAdapter(): Provider[]; declare function provideNativeDateAdapter(): Provider[]; /** * Describes a parent component that manages a list of options. * Contains properties that the options can inherit. * @docs-private */ interface SbbOptionParentComponent { multiple?: boolean; inertGroups?: boolean; } /** * Injection token used to provide the parent component to options. */ declare const SBB_OPTION_PARENT_COMPONENT: InjectionToken; /** * Injection token that can be used to reference instances of `SbbOptgroup`. It serves as * alternative token to the actual `SbbOptgroup` class which could cause unnecessary * retention of the class and its component metadata. */ declare const SBB_OPTGROUP: InjectionToken; declare class SbbOptgroup { /** Label for the option group. */ label: string; /** Whether the group is disabled. */ disabled: boolean; /** Unique id for the underlying label. */ _labelId: string; /** Whether the group is in inert a11y mode. */ _inert: boolean; constructor(parent?: SbbOptionParentComponent); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_disabled: unknown; } /** Event object emitted by SbbOption when selected or deselected. */ declare class SbbOptionSelectionChange { /** Reference to the option that emitted the event. */ source: SbbOption; /** Whether the change in the option's value was a result of a user action. */ isUserInput: boolean; constructor( /** Reference to the option that emitted the event. */ source: SbbOption, /** Whether the change in the option's value was a result of a user action. */ isUserInput?: boolean); } declare class SbbOption implements AfterViewChecked, OnDestroy, FocusableOption, Highlightable { private _element; private _document; private _changeDetectorRef; private _parent; readonly group: SbbOptgroup; private _selected; private _active; private _mostRecentViewValue; private _originalInnerHtml?; private _highlightValue?; private _highlighted; /** Whether the wrapping component is in multiple selection mode. */ get multiple(): boolean | undefined; /** Whether or not the option is currently selected. */ get selected(): boolean; /** The form value of the option. */ value: T; /** The unique ID of the option. */ id: string; /** Whether the option is disabled. */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** Event emitted when the option is selected or deselected. */ readonly onSelectionChange: EventEmitter>; /** Emits when the state of the option changes and any parents have to be notified. */ readonly _stateChanges: Subject; constructor(_element: ElementRef, _document: any, _changeDetectorRef: ChangeDetectorRef, _parent: SbbOptionParentComponent, group: SbbOptgroup); /** * Whether or not the option is currently active and ready to be selected. * An active option displays styles as if it is focused, but the * focus is actually retained somewhere else. This comes in handy * for components like autocomplete where focus must remain on the input. */ get active(): boolean; /** * The displayed value of the option. It is necessary to show the selected option in the * select's trigger. */ get viewValue(): string; /** Selects the option. */ select(): void; /** Deselects the option. */ deselect(emitEvent?: boolean): void; /** Sets focus onto this option. */ focus(_origin?: FocusOrigin, options?: FocusOptions): void; /** * This method sets display styles on the option to make it appear * active. This is used by the ActiveDescendantKeyManager so key * events will display the proper options as active on arrow key events. */ setActiveStyles(): void; /** * This method removes display styles on the option that made it appear * active. This is used by the ActiveDescendantKeyManager so key * events will display the proper options as active on arrow key events. */ setInactiveStyles(): void; /** Gets the label to be used when determining whether the option should be focused. */ getLabel(): string; /** Ensures the option is selected when activated from the keyboard. */ _handleKeydown(event: TypeRef): void; /** * `Selects the option while indicating the selection came from the user. Used to * determine if the select's view -> model callback should be invoked.` */ _selectViaInteraction(): void; /** Returns the correct tabindex for the option depending on disabled state. */ _getTabIndex(): string; /** Gets the host DOM element. */ _getHostElement(): HTMLElement; ngAfterViewChecked(): void; ngOnDestroy(): void; /** * Highlights a text part of the option by wrapping it with a strong element. * @docs-private */ _highlight(value: string, localeNormalizer?: ((value: string) => string) | null): void; private _findAllTextNodesWithMatch; /** * Replace the content with a (partial) match, with text nodes and span elements * which contain the highlightable content. * @param node The node with (partial) content to highlight. * @param matcher The content to highlight. * @param localeNormalizer function to normalize locale chars */ private _highlightNode; /** Emits the selection change event. */ private _emitSelectionChangeEvent; static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, null, { optional: true; }, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration, "sbb-option", ["sbbOption"], { "value": { "alias": "value"; "required": false; }; "id": { "alias": "id"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "onSelectionChange": "onSelectionChange"; }, never, ["*"], true, never>; static ngAcceptInputType_disabled: unknown; } /** * Counts the amount of option group labels that precede the specified option. * @param optionIndex Index of the option at which to start counting. * @param options Flat list of all of the options. * @param optionGroups Flat list of all of the option groups. * @docs-private */ declare function countGroupLabelsBeforeOption(optionIndex: number, options: QueryList, optionGroups: QueryList): number; /** * Determines the position to which to scroll a panel in order for an option to be into view. * @param optionOffset Offset of the option from the top of the panel. * @param optionHeight Height of the options. * @param currentScrollPosition Current scroll position of the panel. * @param panelHeight Height of the panel. * @docs-private */ declare function getOptionScrollPosition(optionOffset: number, optionHeight: number, currentScrollPosition: number, panelHeight: number): number; declare class SbbOptionHint { /** Unique ID to be used by autocomplete trigger's "aria-controls" property. */ id: string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class SbbPseudoCheckbox { /** Display state of the checkbox. */ state: 'unchecked' | 'checked' | 'indeterminate'; /** Whether the checkbox is disabled. */ disabled: boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class SbbOptionModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** Current version of @sbb-esta/angular. */ declare const VERSION: Version; export { Breakpoints, SBB_DATEPICKER_2DIGIT_YEAR_PIVOT, SBB_DATEPICKER_PREVENT_OVERFLOW, SBB_DATE_FORMATS, SBB_DATE_PIPE_DATE_FORMATS, SBB_LEAN_DATE_ADAPTER, SBB_OPTGROUP, SBB_OPTION_PARENT_COMPONENT, SBB_SANITY_CHECKS, SBB_SANITY_CHECKS_FACTORY, SCALING_FACTOR_4K, SCALING_FACTOR_5K, SbbCommonModule, SbbDateAdapter, SbbErrorStateMatcher, SbbLeanDateAdapter, SbbNativeDateAdapter, SbbOptgroup, SbbOption, SbbOptionHint, SbbOptionModule, SbbOptionSelectionChange, SbbPseudoCheckbox, SbbShowOnDirtyErrorStateMatcher, VERSION, _ErrorStateTracker, countGroupLabelsBeforeOption, getOptionScrollPosition, mixinVariant, provideLeanDateAdapter, provideNativeDateAdapter, ɵvariant }; export type { AbstractConstructor, Constructor, GranularSanityChecks, HasVariant, SanityChecks, SbbDateFormats, SbbOptionParentComponent, SbbVariant, TypeRef };