UNPKG

@stimulus-library/controllers

Version:

A library of useful controllers for Stimulus

51 lines (50 loc) 1.94 kB
import { type Duration } from "date-fns"; import { BaseController } from "@stimulus-library/utilities"; export declare class CountdownController extends BaseController { static values: { deadline: StringConstructor; removeUnused: BooleanConstructor; padZeros: BooleanConstructor; }; static targets: string[]; static classes: string[]; readonly deadlineValue: string; readonly removeUnusedValue: boolean; readonly hasRemoveUnusedValue: boolean; readonly padZerosValue: boolean; readonly hasPadZerosValue: boolean; readonly hasYearsTarget: boolean; readonly yearsTarget: HTMLElement; readonly hasMonthsTarget: boolean; readonly monthsTarget: HTMLElement; readonly hasDaysTarget: boolean; readonly daysTarget: HTMLElement; readonly hasHoursTarget: boolean; readonly hoursTarget: HTMLElement; readonly hasMinutesTarget: boolean; readonly minutesTarget: HTMLElement; readonly hasSecondsTarget: boolean; readonly secondsTarget: HTMLElement; addEndedClasses: (el?: HTMLElement) => void; removeEndedClasses: (el?: HTMLElement) => void; addCountingDownClasses: (el?: HTMLElement) => void; removeCountingDownClasses: (el?: HTMLElement) => void; _timeout: null | ReturnType<typeof window.setTimeout>; get _removeUnused(): boolean; get _padZeros(): boolean; get _deadlineDate(): Date; initialize(): void; connect(): void; disconnect(): void; deadlineValueChanged(): void; _tick(): void; _clearTick(): void; _updateTarget(target: HTMLElement, value: string): void; _removeTargetIfUnused(target: HTMLElement, value: string): void; _years(duration: Duration): string; _months(duration: Duration): string; _days(duration: Duration): string; _hours(duration: Duration): string; _minutes(duration: Duration): string; _seconds(duration: Duration): string; }