import type { EventEmitter } from '../../stencil-public-runtime'; import type { LocaleProp } from '../../utils/locale'; import type { DateInputBreakpoint, DateInputChangeDetail, DateInputFormat, DateInputSize, DateInputType, 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; /** * The date-input type of the Figma Date Picker page (Types, 470:32035): * - `default` — one date; the calendar has a "Month Year" title. * - `advanced` — one date; the calendar has month and year dropdown chips. * - `date-range` — a start and an end date in one field * (`18/01/2025 - 22/01/2025`); the value changes once both ends are picked. * * The mobile bottom sheet always uses the chips, as in the Figma Breakpoints. * @default 'default' */ type: DateInputType; /** * 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; /** * 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; /** * Language of the built-in labels and error messages, and of the calendar's month and * weekday names, which `mud-date-picker` takes from `Intl`. The typed value itself follows * `format`, not the locale. Unset, the component follows the closest ancestor `lang` * (`` included), else `ro-MD`. */ locale?: LocaleProp; /** * Accessible label for the clear (×) button. Overrides the `locale`'s copy when set to a * non-empty string. * @default 'Șterge' (ro-MD) */ clearLabel?: string; /** * Accessible name of the calendar dialog. Overrides the `locale`'s copy when set to a * non-empty string. * @default 'Selectează data' (ro-MD) */ pickerLabel?: string; /** * Accessible name of the trailing button that opens the calendar. Overrides the `locale`'s * copy when set to a non-empty string. * @default 'Deschide calendarul' (ro-MD) */ openPickerLabel?: string; /** * Message for a day outside 01–31, or (once the month is known) past the number of days in * that month. Carries a `{max}` placeholder. Overrides the `locale`'s copy when set to a * non-empty string. * @default 'Ziua trebuie să fie între 01 și {max}' (ro-MD) */ dayErrorText?: string; /** * Message for a month outside 01–12. Overrides the `locale`'s copy when set to a non-empty * string. * @default 'Luna trebuie să fie între 01 și 12' (ro-MD) */ monthErrorText?: string; /** * Message for a year outside the allowed years. Overrides the `locale`'s copy when set to * a non-empty string. * @default 'Introduceți un an valid' (ro-MD) */ yearErrorText?: string; /** * Message for a complete date that does not otherwise exist. Overrides the `locale`'s copy * when set to a non-empty string. * @default 'Introduceți o dată validă' (ro-MD) */ dateErrorText?: string; /** * Message for a complete date outside `min` / `max`. Overrides the `locale`'s copy when set * to a non-empty string. * @default 'Data este în afara intervalului permis' (ro-MD) */ rangeErrorText?: string; /** * `type="date-range"` only: message for an end date before the start date. Overrides the * `locale`'s copy when set to a non-empty string. * @default 'Data de sfârșit trebuie să fie după data de început' (ro-MD) */ orderErrorText?: string; /** * Message shown when a required field is submitted empty. Overrides the `locale`'s copy * when set to a non-empty string. * @default 'Introduceți data' (ro-MD) */ requiredErrorText?: string; private hasLabelSlot; private hasHelperSlot; private isFocused; private fieldsetDisabled; private pickerOpen; private isMobileViewport; private validationError; /** Set when a form submit found the required field empty; cleared once it holds a value. */ private requiredShown; /** * The host's `aria-label` (attribute or native `ariaLabel` property), moved onto the * internal control when no visible label is present. */ private resolvedAriaLabel?; 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; /** Upper bound substituted into `dayErrorText`'s `{max}` placeholder; 31 until a specific month narrows it. */ private dayRangeMax; private mql?; private stopAriaLabel?; private stopLang?; /** Set when the calendar opens; cleared once focus has moved into it. */ private focusPickerOnRender; /** Whether the next open should move focus into the calendar. */ private focusPickerOnOpen; /** Body `overflow` before the mobile bottom sheet locked page scroll; `undefined` while unlocked. */ private lockedBodyOverflow?; private handleViewportChange; validateVariant(next: DateInputVariant): void; validateSize(next: DateInputSize): void; validateFormat(next: DateInputFormat): void; validateType(next: DateInputType): void; validateBreakpoint(next: DateInputBreakpoint): void; handleValueChange(next: string): void; revalidate(): void; /** * Opening the calendar moves focus into it (dialog pattern) and, for the * modal bottom sheet, locks page scroll behind the scrim. */ handlePickerOpenChange(open: boolean): 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; /** * A form submit (or `checkValidity()`) found the field invalid. When it is a * required field left empty, show the required message under it. */ handleInvalid(): void; /** * Close the popover when focus leaves the field and its popover — Tab past * the last control, or focus moved elsewhere on the page. A view switch * inside the popover briefly drops focus before moving it on, so a focus * loss with no destination is checked again two frames later. */ handleFocusOut(ev: FocusEvent): void; /** Escape closes the popover and returns focus to the trailing-icon trigger. */ handlePopoverKeyDown(ev: KeyboardEvent): void; connectedCallback(): void; disconnectedCallback(): void; componentWillLoad(): void; componentDidRender(): void; formDisabledCallback(disabled: boolean): void; formResetCallback(): void; formStateRestoreCallback(state: string | File | FormData | null): void; /** Effective picker placement once `auto` is resolved against the viewport. */ private resolvedBreakpoint; /** Built-in strings in the resolved locale, with the override props on top. */ private messages; /** Whether focus is on the field, its buttons or anything in its popover. */ private hasFocusWithin; /** Whether the field holds a start and an end date. */ private isRange; /** The field's mask: one date, or two for `type="date-range"`. */ private mask; /** The mask of one date in the configured format. */ private dateMask; /** * The dates in a display value: one, or two for `type="date-range"`, split * at the range separator (the second is empty until typed). */ private dateParts; /** * Reverse of `toIsoDate`: 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; /** * A click anywhere on the field opens the calendar, not only the trailing * button. Focus stays where the click put it — the caret in the input — so * the user can keep typing; only the trailing button moves focus into the * calendar (the dialog pattern). */ private readonly handleFieldClick; private lockPageScroll; private unlockPageScroll; private readonly handlePickerChange; /** The display value a picker selection resolves to, or `''` while a range is half picked. */ private pickedDisplay; /** Close the calendar and hand focus back to the field it filled. */ private closePickerToField; /** * 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. With * `trailingSeparator`, a just-completed valid segment also gets its separator * so the caret jumps to the next segment (Figma 487:7841); an invalid one * keeps the caret in place so the error can be corrected (489:8104). */ private formatMasked; /** Identify which segment the caret currently sits inside. */ private segmentAtPosition; /** * Parse one date in the display format into ISO `YYYY-MM-DD`. Returns `null` * when it is incomplete, malformed, or a non-existent calendar date * (e.g. 31/02/2025). */ private toIsoDate; /** Numeric day / month / year of one complete display date, or `null`. */ private dateDigits; /** Days in a given month, leap years included. */ private daysInMonth; private withinBounds; /** Day and month segments must fall in 01–31 / 01–12; the year is checked once complete. */ private segmentInRange; private yearBounds; /** * Validate a (possibly partial) display value segment by segment, in the * order the segments appear. Incomplete segments are not errors yet. */ private validate; private updateValidation; /** A required, editable field with no value. */ private isValueMissing; private validationMessage; private changeDetail; 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; /** Invalid when the consumer says so or the built-in validation fails. */ private isInvalid; private resolvedVariant; private hasVisibleLabel; /** * Message under the field: the consumer's `errorText` while `invalid` is * set, otherwise the built-in validation message. */ private errorMessage; private hasErrorMessage; private hasHelperMessage; private describedBy; private resolvedPlaceholder; render(): any; }