import { EventEmitter } from '../../stencil-public-runtime'; import type { DateInputBreakpoint, DateInputChangeDetail, DateInputFormat, DateInputSize, DateInputTypingDetail, DateInputVariant } from './mud-date-input.types'; /** * Date Input — segment-masked date entry molecule. * * Pattern B (atom-interactive, form-associated): renders its own `` * inside shadow DOM and overlays a ghost format hint that lets the unfilled * `DD/MM/YYYY` segments stay visible while the user types — matching the * "focus: date-populated / month-populated / fully-populated" Figma states. * * @element mud-date-input * * @slot label - Rich label content, replaces the `label` prop when present. * @slot helper - Rich helper / hint content, replaces the `helper-text` prop. Hidden when invalid + error-text is shown. */ export declare class MudDateInput { /** * Color treatment. `destructive` is forced when `invalid` is set. * @default 'default' */ variant: DateInputVariant; /** * Visual size rung. * @default 'md' */ size: DateInputSize; /** * Display format. The component accepts only the digits the format permits * and rewrites the value with the separator inline as the user types. * @default 'DD/MM/YYYY' */ format: DateInputFormat; /** * Calendar-popover placement. `auto` opens a desktop dropdown on wide * viewports and a full-width bottom sheet on narrow ones; `desktop` / `mobile` * force one layout. * @default 'auto' */ breakpoint: DateInputBreakpoint; /** * Disables interactivity. The internal control receives `aria-disabled` and * the native `disabled` attribute. * @default false */ disabled: boolean; /** * Marks the field as mandatory. Adds a red asterisk to the label and sets * `aria-required` on the internal control. * @default false */ required: boolean; /** * Renders the field read-only. The control remains focusable and copyable. * @default false */ readonly: boolean; /** * Forces destructive visuals regardless of `variant`. Sets `aria-invalid`. * Use together with `errorText` to surface the message. * @default false */ invalid: boolean; /** * Current display value, matching the configured `format` (e.g. `15/04/2025`). * Reflects to the host attribute. Internal entry rewrites this prop as the * user types — consumers can read it back at any time. * @default '' */ value: string; /** Form-control `name`. Used during form submission. */ name?: string; /** * Inclusive lower bound in ISO `YYYY-MM-DD`. The validator rejects entries * below this date with an `out-of-range` error. */ min?: string; /** * Inclusive upper bound in ISO `YYYY-MM-DD`. The validator rejects entries * above this date with an `out-of-range` error. */ max?: string; /** Plain-text label. Use the `label` slot for richer content. */ label?: string; /** Plain-text helper / hint shown below the control. */ helperText?: string; /** * Plain-text error message shown below the control when `invalid` is set. * When present it replaces `helperText` and pairs with the error icon. */ errorText?: string; /** * Placeholder shown when the control is empty. Defaults to the format * pattern (`DD/MM/YYYY` / `MM/DD/YYYY` / `YYYY-MM-DD`). */ placeholder?: string; /** * Accessible name. Mirrors to the internal control's `aria-label` when no * visible label is present. */ ariaLabel?: string; /** * Shows a trailing clear (×) button while the field holds a value, wiping the * entry in one click. Matches the Figma `clearButton` axis shown in the * Focus / Filled states. The button never appears while the field is empty, * disabled, or read-only. Opt-in, mirroring the Figma boolean axis. * @default false */ clearable: boolean; /** Accessible label for the clear (×) button. */ clearLabel: string; private hasLabelSlot; private hasHelperSlot; private isFocused; private fieldsetDisabled; private pickerOpen; private isMobileViewport; host: HTMLMudDateInputElement; internals: ElementInternals; /** * Fires on every keystroke. `detail.value` is the current display value; * `detail.isoValue` is the ISO `YYYY-MM-DD` when fully populated and valid, * otherwise `null`. `detail.segment` is the segment under the caret. */ mudInput: EventEmitter; /** * Fires when the value is committed (typically on `blur` or `Enter`). * `detail.value` is the committed display value; `detail.isoValue` is the * ISO `YYYY-MM-DD` when fully populated and valid, otherwise `null`. */ mudChange: EventEmitter; /** Fires when the internal control gains focus. The native `FocusEvent` is forwarded as-is. */ mudFocus: EventEmitter; /** Fires when the internal control loses focus. The native `FocusEvent` is forwarded as-is. */ mudBlur: EventEmitter; /** Fires when the user empties the field via the clear (×) button. */ mudClear: EventEmitter; private readonly instanceId; private readonly labelId; private readonly helperId; private readonly errorId; private initialValue; private mql?; private handleViewportChange; connectedCallback(): void; disconnectedCallback(): void; componentWillLoad(): void; validateVariant(next: DateInputVariant): void; validateSize(next: DateInputSize): void; validateFormat(next: DateInputFormat): void; validateBreakpoint(next: DateInputBreakpoint): void; /** Effective picker placement once `auto` is resolved against the viewport. */ private resolvedBreakpoint; handleValueChange(next: string): void; formDisabledCallback(disabled: boolean): void; formResetCallback(): void; formStateRestoreCallback(state: string | File | FormData | null): void; /** * Close the popover when a click lands outside the input (light DOM or * shadow DOM). The picker itself lives inside the input's shadow, so the * composedPath includes both surfaces. */ handleOutsideClick(ev: MouseEvent): void; /** Escape closes the popover and returns focus to the trailing-icon trigger. */ handlePopoverKeyDown(ev: KeyboardEvent): void; private spec; /** * Reverse of `toIsoValue`: format an ISO `YYYY-MM-DD` into the configured * display pattern (DD/MM/YYYY, MM/DD/YYYY, etc.). Used when the popover * picker emits a selection and we need to mirror it back into the masked * field. */ private fromIsoValue; private readonly togglePicker; private readonly handlePickerChange; /** * Re-format a raw input string into the configured pattern. * Strips everything that isn't a digit, then walks the segment spec and * inserts the separator after each segment when the next one starts. */ private formatMasked; /** Identify which segment the caret currently sits inside. */ private segmentAtPosition; /** Split the typed prefix into typed / remaining parts for the ghost overlay. */ private ghostParts; /** * Parse a display value into ISO `YYYY-MM-DD`. Returns `null` when the value * is incomplete, malformed, or designates a non-existent calendar date * (e.g. 31/02/2025). */ private toIsoValue; private withinBounds; private detail; private onLabelSlotChange; private onHelperSlotChange; private slotHasContent; private handleInput; private handleChange; private handleFocus; private handleBlur; private handleClearClick; /** The clear (×) button is gated on having an editable, non-empty value. */ private shouldShowClear; private handleKeyDown; private isInert; private resolvedVariant; private hasVisibleLabel; private hasErrorMessage; private hasHelperMessage; private describedBy; private resolvedPlaceholder; render(): any; }