UNPKG

@melt-ui/svelte

Version:
211 lines (210 loc) 13.2 kB
/// <reference types="svelte" /> import type { MeltActionReturn } from '../../internal/types.js'; import type { DateValue } from '@internationalized/date'; import { type Updater } from 'svelte/store'; import type { SegmentPart } from './_internal/types.js'; import type { DateFieldEvents } from './events.js'; import type { CreateDateFieldProps } from './types.js'; declare const dateFieldIdParts: readonly ["field", "label", "description", "validation", "day", "month", "year", "hour", "minute", "second", "dayPeriod", "timeZoneName"]; export type DateFieldIdParts = typeof dateFieldIdParts; export declare function createDateField(props?: CreateDateFieldProps): { elements: { field: import("../../internal/helpers/index.js").MeltElement<[{ update: (updater: Updater<DateValue | undefined>, sideEffect?: ((newValue: DateValue | undefined) => void) | undefined) => void; set: (this: void, value: DateValue | undefined) => void; subscribe(this: void, run: import("svelte/store").Subscriber<DateValue | undefined>, invalidate?: import("svelte/store").Invalidator<DateValue | undefined> | undefined): import("svelte/store").Unsubscriber; get: () => DateValue | undefined; destroy?: (() => void) | undefined; }, import("svelte/store").Readable<boolean>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<boolean>>, import("svelte/store").Readable<{ field: string; label: string; description: string; validation: string; }>], <Node_1 extends any>(_node: HTMLElement) => { destroy(): void; }, ([$value, $isInvalid, $disabled, $readonly, $ids]: [DateValue | undefined, boolean, boolean, boolean, { field: string; label: string; description: string; validation: string; }]) => { readonly role: "group"; readonly id: string; readonly 'aria-labelledby': string; readonly 'aria-describedby': string; readonly 'aria-disabled': "true" | undefined; readonly 'aria-readonly': "true" | undefined; readonly 'data-invalid': "" | undefined; readonly 'data-disabled': "" | undefined; }, string>; segment: import("../../internal/helpers/index.js").MeltElement<[import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<import("./_internal/types.js").SegmentValueObj>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<12 | 24 | undefined>>, { get: () => DateValue; set: (this: void, value: DateValue) => void; update: (this: void, updater: Updater<DateValue>) => void; subscribe: (this: void, run: import("svelte/store").Subscriber<DateValue>, invalidate?: import("svelte/store").Invalidator<DateValue> | undefined) => import("svelte/store").Unsubscriber; add: (duration: import("@internationalized/date").DateTimeDuration | import("@internationalized/date").DateDuration) => void; subtract: (duration: import("@internationalized/date").DateTimeDuration | import("@internationalized/date").DateDuration) => void; setDate: (fields: import("@internationalized/date").DateFields | (import("@internationalized/date").DateFields & import("@internationalized/date").TimeFields), disambiguation?: import("@internationalized/date").Disambiguation | undefined) => void; reset: () => void; toWritable: () => { set: (this: void, value: DateValue) => void; subscribe: (this: void, run: import("svelte/store").Subscriber<DateValue>, invalidate?: import("svelte/store").Invalidator<DateValue> | undefined) => import("svelte/store").Unsubscriber; update: (this: void, updater: Updater<DateValue>) => void; get: () => DateValue; }; nextPage: (amount: number) => void; prevPage: (amount: number) => void; }, { update: (updater: Updater<DateValue | undefined>, sideEffect?: ((newValue: DateValue | undefined) => void) | undefined) => void; set: (this: void, value: DateValue | undefined) => void; subscribe(this: void, run: import("svelte/store").Subscriber<DateValue | undefined>, invalidate?: import("svelte/store").Invalidator<DateValue | undefined> | undefined): import("svelte/store").Unsubscriber; get: () => DateValue | undefined; destroy?: (() => void) | undefined; }, import("svelte/store").Readable<boolean>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<Set<SegmentPart>>>, import("svelte/store").Readable<{ field: string; label: string; description: string; validation: string; day: string; month: string; year: string; hour: string; minute: string; second: string; dayPeriod: string; timeZoneName: string; }>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<string>>], (node: HTMLElement) => MeltActionReturn<DateFieldEvents['segment']>, ([$segmentValues, $hourCycle, $placeholder, $value, $isInvalid, $disabled, $readonly, $readonlySegmentsSet, $idValues, _,]: [import("./_internal/types.js").SegmentValueObj, 12 | 24 | undefined, DateValue, DateValue | undefined, boolean, boolean, boolean, Set<SegmentPart>, { field: string; label: string; description: string; validation: string; day: string; month: string; year: string; hour: string; minute: string; second: string; dayPeriod: string; timeZoneName: string; }, string]) => (part: SegmentPart) => { readonly 'aria-invalid': "true" | undefined; readonly 'aria-disabled': "true" | undefined; readonly 'aria-readonly': "true" | undefined; readonly 'data-invalid': "" | undefined; readonly 'data-disabled': "" | undefined; readonly 'data-segment': SegmentPart; } | { readonly id: string; readonly 'aria-labelledby': string; readonly contenteditable: boolean; readonly 'aria-describedby': string | undefined; readonly tabindex: 0 | undefined; readonly 'aria-invalid': "true" | undefined; readonly 'aria-disabled': "true" | undefined; readonly 'aria-readonly': "true" | undefined; readonly 'data-invalid': "" | undefined; readonly 'data-disabled': "" | undefined; readonly 'data-segment': SegmentPart; }, string>; label: import("../../internal/helpers/index.js").MeltElement<[import("svelte/store").Readable<boolean>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<string>>], (node: HTMLElement) => { destroy: () => void; }, ([$isInvalid, $disabled, $labelId]: [boolean, boolean, string]) => { readonly id: string; readonly 'data-invalid': "" | undefined; readonly 'data-disabled': "" | undefined; }, string>; hiddenInput: import("../../internal/helpers/index.js").MeltElement<[import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<string>>, import("svelte/motion").Readable<string | undefined>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<boolean>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<import("svelte/elements.js").HTMLInputTypeAttribute | null | undefined>>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Readable<boolean | undefined>>], (node: HTMLInputElement) => { destroy: () => void; }, ([$value, $name, $disabled, $required, $type, $checked]: [string, string | undefined, boolean, boolean, import("svelte/elements.js").HTMLInputTypeAttribute | null | undefined, boolean | undefined]) => { readonly name: string | undefined; readonly value: string; readonly 'aria-hidden': "true"; readonly hidden: true; readonly disabled: boolean; readonly required: boolean; readonly tabIndex: -1; readonly type: import("svelte/elements.js").HTMLInputTypeAttribute | null | undefined; readonly checked: boolean | undefined; readonly style: string; }, string>; validation: import("../../internal/helpers/index.js").MeltElement<[import("svelte/store").Readable<boolean>, import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<string>>], import("svelte/action").Action<any, any, Record<never, any>>, ([$isInvalid, $validationId]: [boolean, string]) => { readonly id: string; readonly 'data-invalid': "" | undefined; readonly style: string | undefined; }, string>; }; states: { value: { update: (updater: Updater<DateValue | undefined>, sideEffect?: ((newValue: DateValue | undefined) => void) | undefined) => void; set: (this: void, value: DateValue | undefined) => void; subscribe(this: void, run: import("svelte/store").Subscriber<DateValue | undefined>, invalidate?: import("svelte/store").Invalidator<DateValue | undefined> | undefined): import("svelte/store").Unsubscriber; get: () => DateValue | undefined; destroy?: (() => void) | undefined; }; segmentValues: import("../../internal/helpers/index.js").WithGet<import("svelte/store").Writable<import("./_internal/types.js").SegmentValueObj>>; segmentContents: import("svelte/store").Readable<{ part: SegmentPart; value: string; }[]>; segmentContentsObj: import("svelte/store").Readable<import("./_internal/types.js").SegmentContentObj>; placeholder: { set: (this: void, value: DateValue) => void; subscribe: (this: void, run: import("svelte/store").Subscriber<DateValue>, invalidate?: import("svelte/store").Invalidator<DateValue> | undefined) => import("svelte/store").Unsubscriber; update: (this: void, updater: Updater<DateValue>) => void; get: () => DateValue; }; isInvalid: import("svelte/store").Readable<boolean>; }; helpers: { isDateUnavailable: import("svelte/store").Readable<(date: DateValue) => boolean | undefined>; }; options: import("../../internal/helpers/index.js").ToWritableStores<Omit<{ defaultValue?: DateValue | undefined; onValueChange?: import("../../internal/helpers/index.js").ChangeFn<DateValue | undefined> | undefined; value: import("svelte/store").Writable<DateValue | undefined> | undefined; defaultPlaceholder?: DateValue | undefined; placeholder?: import("svelte/store").Writable<DateValue> | undefined; onPlaceholderChange?: import("../../internal/helpers/index.js").ChangeFn<DateValue> | undefined; isDateUnavailable: import("../../internal/helpers/date/index.js").Matcher | undefined; minValue: DateValue | undefined; maxValue: DateValue | undefined; disabled: boolean; readonly: boolean; readonlySegments: ("month" | "day" | "hour" | "minute" | "second" | "year" | "dayPeriod")[] | undefined; hourCycle: 12 | 24 | undefined; locale: string; granularity: import("../../internal/helpers/date/index.js").Granularity | undefined; hideTimeZone: boolean; name: string | undefined; required: boolean; ids?: Partial<{ description: string; label: string; month: string; day: string; hour: string; minute: string; second: string; year: string; dayPeriod: string; timeZoneName: string; field: string; validation: string; }> | undefined; }, "value" | "ids" | "placeholder">>; ids: import("../../internal/helpers/index.js").ToWritableStores<{ description: string; label: string; month: string; day: string; hour: string; minute: string; second: string; year: string; dayPeriod: string; timeZoneName: string; field: string; validation: string; }>; }; export {};