@scania/tegel
Version:
Tegel Design System
79 lines (78 loc) • 3.59 kB
TypeScript
import { EventEmitter } from '../../stencil-public-runtime';
export declare class TdsDatetime {
/** Text-input for focus state */
private textInput;
/** Boolean indicator to trigger input validation */
private shouldValidate;
/** Sets an input type */
type: 'datetime-local' | 'date' | 'month' | 'week' | 'time';
/** Value of the input text */
value: string;
/** Sets min value.<br/>Example for different types:<br/>datetime="2023-01-31T00:00"<br/>date="2023-01-01"<br/>month="2023-01"<br/>week="2023-W02"<br/>time="15:00" */
min?: string;
/** Sets max value.<br/>Example for different types:<br/>datetime="2023-01-31T00:00"<br/>date="2023-01-01"<br/>month="2023-01"<br/>week="2023-W02"<br/>time="15:00" */
max?: string;
/** Default value of the component.<br/>Format for date-time: yyyy-MM-ddTHH:mm.<br/>Format for date: yyyy-MM-dd.<br/>Format for month: yyyy-MM.<br/>Format for week: yyyy-Www.<br/>Format for time: HH:mm. */
defaultValue: string | 'none';
/** Set input in disabled state */
disabled: boolean;
/** Size of the input */
size: 'sm' | 'md' | 'lg';
/** Resets min width rule */
noMinWidth: boolean;
/** Set the variant of the Datetime component. */
modeVariant: 'primary' | 'secondary' | null;
/** Name property. Uses a unique ID as fallback if not specified. */
name: string;
/** Switches between success and error state. */
state?: 'none' | 'success' | 'error';
/** Autofocus for input */
autofocus: boolean;
/** Label text for the component */
label: string;
/** Position of the label */
labelPosition: 'inside' | 'outside' | 'no-label';
/** Default contextual helper text for the component for states = success or none */
helper: string;
/** Contextual helper text for the component for error state */
helperError?: string;
/** Contextual helper text for the component when input is invalid */
helperErrorInvalid?: string;
/** Value for the aria-label attribute */
tdsAriaLabel?: string;
/** Function for additional validation based on business rules */
customValidator?: (value: string) => boolean;
/** Listen to the focus state of the input */
focusInput: boolean;
/** Change event for the Datetime */
tdsChange: EventEmitter;
/** Blur event for the Datetime */
tdsBlur: EventEmitter<FocusEvent>;
/** Focus event for the Datetime */
tdsFocus: EventEmitter<FocusEvent>;
/** Input event for the Datetime */
tdsInput: EventEmitter<InputEvent>;
/** Method that resets the value of the Datetime, using defaultValue if is not 'none' */
reset(): Promise<void>;
/** Method that sets the value of the datetime element */
setValue(newValue: string): Promise<void>;
/** Method to programmatically focus the datetime element */
focusElement(): Promise<void>;
nativeValidation: () => boolean;
getDefaultValue: () => string;
componentWillLoad(): void;
componentDidRender(): void;
handleFocusIn(): void;
handleFocusOut(): void;
onValueChanged(): void;
validateDate(): void;
handleInput(e: InputEvent): void;
handleChange(e: Event): void;
/** Set the input as focus when clicking the whole Datetime with suffix/prefix */
handleFocusClick(e: FocusEvent): void;
/** Set the input as focus when clicking the whole Datetime with suffix/prefix */
handleBlur(e: FocusEvent): void;
/** Method that resets the dateteime without emitting an event. */
private internalReset;
render(): any;
}