import { VariantProps } from 'class-variance-authority'; import * as i0 from '@angular/core'; import { ModelSignal, InputSignal, OutputEmitterRef, WritableSignal, Signal } from '@angular/core'; import { ControlValueAccessor, Validator, NgControl, ValidationErrors } from '@angular/forms'; import { FormFieldControl, ErrorStateMatcher, FormFieldAppearance } from 'ngx-com/components/form-field'; /** * Types and interfaces for the TimePicker component. */ /** Value type for the standalone time picker */ interface ComTimeValue { /** Hours (0-23, always stored in 24h format internally) */ hours: number; /** Minutes (0-59) */ minutes: number; /** Seconds (0-59) */ seconds: number; } /** Creates a ComTimeValue */ declare function createTimeValue(hours?: number, minutes?: number, seconds?: number): ComTimeValue; /** * Compares two ComTimeValue objects. * @returns negative if a < b, 0 if equal, positive if a > b */ declare function compareTime(a: ComTimeValue, b: ComTimeValue): number; declare function generateTimePickerId(): string; /** Size variants for time picker */ type TimePickerSize = 'sm' | 'default' | 'lg'; /** Visual variant */ type TimePickerVariant = 'standalone' | 'embedded' | 'naked'; /** Validation state */ type TimePickerState = 'default' | 'error' | 'success'; /** Period for 12-hour format */ type TimePeriod = 'AM' | 'PM'; /** Segment type */ type TimeSegment = 'hours' | 'minutes' | 'seconds'; /** * CVA variants for the time picker container. * * @tokens `--color-input-background`, `--color-input-foreground`, `--color-input-border`, * `--color-ring`, `--color-warn`, `--color-success`, `--radius-input` */ declare const timepickerContainerVariants: (props?: { variant?: TimePickerVariant; size?: TimePickerSize; state?: TimePickerState; }) => string; type TimepickerContainerVariants = VariantProps; /** * CVA variants for the disabled state of time picker. * * @tokens `--color-disabled`, `--color-disabled-foreground` */ declare const timepickerDisabledVariants: () => string; type TimepickerDisabledVariants = VariantProps; /** * CVA variants for each time segment input. * * @tokens `--color-primary-subtle`, `--color-primary-subtle-foreground`, `--radius-interactive-sm` */ declare const timepickerSegmentVariants: (props?: { size?: TimePickerSize; }) => string; type TimepickerSegmentVariants = VariantProps; /** * CVA variants for the colon separator. * * @tokens `--color-muted-foreground` */ declare const timepickerSeparatorVariants: (props?: { size?: TimePickerSize; }) => string; type TimepickerSeparatorVariants = VariantProps; /** * CVA variants for the AM/PM toggle button. * * @tokens `--color-muted`, `--color-muted-foreground`, `--color-muted-hover`, `--color-ring`, * `--radius-control-sm` */ declare const timepickerPeriodVariants: (props?: { size?: TimePickerSize; }) => string; type TimepickerPeriodVariants = VariantProps; /** * CVA variants for the time section divider in datepicker panel. * * @tokens `--color-border-subtle` */ declare const timepickerSectionVariants: (props?: { size?: TimePickerSize; }) => string; type TimepickerSectionVariants = VariantProps; /** * CVA variants for time labels in date range picker. * * @tokens `--color-muted-foreground` */ declare const timepickerLabelVariants: (props?: { size?: TimePickerSize; }) => string; type TimepickerLabelVariants = VariantProps; /** * Time picker component with segmented numeric input fields. * Supports standalone usage with ControlValueAccessor and embedded usage * within datepicker/date-range-picker panels. * * Visual layout: `[HH] : [MM] : [SS] [AM|PM]` * * @tokens `--color-input-background`, `--color-input-foreground`, `--color-input-border`, * `--color-ring`, `--color-primary-subtle`, `--color-primary-subtle-foreground`, * `--color-muted`, `--color-muted-foreground`, `--color-muted-hover`, * `--color-disabled`, `--color-disabled-foreground`, * `--color-warn`, `--color-success`, `--color-border` * * @example * ```html * * * * * * * * * * * * ``` */ declare class ComTimePicker implements ControlValueAccessor, FormFieldControl, Validator { private readonly localeId; readonly ngControl: NgControl | null; private readonly defaultErrorStateMatcher; private readonly parentForm; private readonly parentFormGroup; private readonly timepickerId; private readonly hoursInputRef; private readonly minutesInputRef; private readonly secondsInputRef; private readonly periodButtonRef; /** Current time value. */ readonly value: ModelSignal; /** Whether the time picker is disabled. */ readonly disabled: ModelSignal; /** Whether the time picker is required. */ readonly required: InputSignal; /** Whether to show the seconds segment. */ readonly showSeconds: InputSignal; /** 12h vs 24h format. `null` = auto-detect from locale. */ readonly use12HourFormat: InputSignal; /** Step interval for minutes. */ readonly minuteStep: InputSignal; /** Step interval for seconds. */ readonly secondStep: InputSignal; /** Minimum selectable time. */ readonly minTime: InputSignal; /** Maximum selectable time. */ readonly maxTime: InputSignal; /** Visual variant. */ readonly variant: InputSignal; /** Size variant. */ readonly size: InputSignal; /** Validation state. */ readonly state: InputSignal; /** Accessible label for the group. */ readonly ariaLabel: InputSignal; /** Additional CSS classes. */ readonly userClass: InputSignal; /** Placeholder text for empty segments. */ readonly placeholder: InputSignal; /** Custom error state matcher for determining when to show errors. */ readonly errorStateMatcher: InputSignal; readonly touched: ModelSignal; readonly invalid: InputSignal; readonly sfErrors: InputSignal; /** Emitted when time value changes. */ readonly timeChange: OutputEmitterRef; /** Internal value state. */ readonly internalValue: WritableSignal; /** Which segment is currently focused. */ readonly activeSegment: WritableSignal; /** Pending typed digits for auto-advance. */ readonly pendingDigits: WritableSignal; /** Live announcements for screen readers. */ readonly liveAnnouncement: WritableSignal; /** IDs for aria-describedby (set by form-field). */ private readonly _describedByIds; /** Form field appearance (set by form-field). */ private readonly _appearance; /** Whether the time picker is focused. Implements FormFieldControl. */ readonly focused: Signal; /** Whether the label should float. */ readonly shouldLabelFloat: Signal; /** Whether the control is in an error state. Implements FormFieldControl. */ readonly errorState: Signal; /** Structured validation errors from Signal Forms. */ readonly errors: Signal; /** Unique ID for the control (maps to hours input). Implements FormFieldControl. */ readonly id: Signal; /** * Effective state combining manual state with automatic error detection. */ readonly effectiveState: Signal; /** Combined aria-describedby from form-field. */ readonly effectiveAriaDescribedBy: Signal; /** Whether to use 12-hour format. */ readonly is12Hour: Signal; /** Current period (AM/PM). */ readonly period: Signal; /** Display hours (converted from 24h to 12h when needed). */ readonly displayHours: Signal; /** Formatted hours string. */ readonly formattedHours: Signal; /** Formatted minutes string. */ readonly formattedMinutes: Signal; /** Formatted seconds string. */ readonly formattedSeconds: Signal; /** Container classes. */ readonly containerClasses: Signal; /** Segment input classes. */ readonly segmentClasses: Signal; /** Separator classes. */ readonly separatorClasses: Signal; /** Period button classes. */ readonly periodClasses: Signal; private onChange; private onTouched; private onValidatorChange; constructor(); writeValue(value: ComTimeValue | null): void; registerOnChange(fn: (value: ComTimeValue | null) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; validate(): ValidationErrors | null; registerOnValidatorChange(fn: () => void): void; protected onSegmentFocus(segment: TimeSegment): void; protected onSegmentBlur(segment: TimeSegment): void; protected onSegmentInput(event: Event, segment: TimeSegment): void; protected onSegmentKeydown(event: KeyboardEvent, segment: TimeSegment): void; protected onPeriodKeydown(event: KeyboardEvent): void; protected togglePeriod(): void; /** * Called when the form field container is clicked. * Implements FormFieldControl. */ onContainerClick(_event: MouseEvent): void; /** * Sets the describedBy IDs from the form field. * Called by the parent form field component. */ setDescribedByIds(ids: string): void; /** * Sets the appearance for styling. * Called by the parent form field component. */ setAppearance(appearance: FormFieldAppearance): void; private setPeriod; private incrementSegment; private handleDigitInput; private snapToStep; private setSegmentToMin; private setSegmentToMax; private focusNextSegment; private focusPrevSegment; private updateValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { ComTimePicker, compareTime, createTimeValue, generateTimePickerId, timepickerContainerVariants, timepickerDisabledVariants, timepickerLabelVariants, timepickerPeriodVariants, timepickerSectionVariants, timepickerSegmentVariants, timepickerSeparatorVariants }; export type { ComTimeValue, TimePeriod, TimePickerSize, TimePickerState, TimePickerVariant, TimeSegment, TimepickerContainerVariants, TimepickerDisabledVariants, TimepickerLabelVariants, TimepickerPeriodVariants, TimepickerSectionVariants, TimepickerSegmentVariants, TimepickerSeparatorVariants };