import { FreqType, RecurrenceState, EndType, RecurrenceItems, RecurrenceHandlers, DropdownData } from './types'; /** * Public API returned by the `useRecurrenceEditor` hook. * * Extends `RecurrenceState` and supplies derived data sources, helper * functions and event handlers intended for use by a recurrence editor UI. * * @public * @property {Date} startingDate - The initial date used to calculate rule parts. * @property {DropdownData[]} monthDataSource - Localized list of months for a month dropdown. * @property {DropdownData[]} monthPosDataSource - Positions in month (first, second, last, etc.). * @property {{ text: string; value: FreqType }[]} freqDataSource - Localized frequency labels. * @property {{ text: string; value: EndType }[]} endDataSource - Localized end-type labels. * @property {RecurrenceItems[]} dayDataSource - Localized day labels for full-width display. * @property {RecurrenceItems[]} weekDayDataSource - Localized day labels for compact/week display. * @property {number|null} maxDate - Number of days in the selected month (or `null`). * @property {(state: RecurrenceState) => string} generateRule - Generates an RRULE string for an arbitrary state. * @property {() => string} buildRecurrenceRule - Builds an RRULE string from the current state. * @property {(monthName: string) => void} updateMaxDate - Updates `maxDate` given a localized month name. * @property {RecurrenceHandlers} handlers - Collection of UI event handlers for editor controls. * * @example * const editor = useRecurrenceEditor('FREQ=DAILY;', new Date(), ['DAILY','WEEKLY'], ['Count','Until'], 0); * const rrule = editor.buildRecurrenceRule(); */ export interface RecurrenceEditorResult extends RecurrenceState { startingDate: Date; monthDataSource: DropdownData[]; monthPosDataSource: DropdownData[]; freqDataSource: Array<{ text: string; value: FreqType; }>; endDataSource: Array<{ text: string; value: EndType; }>; dayDataSource: RecurrenceItems[]; weekDayDataSource: RecurrenceItems[]; maxDate: number | null; generateRule: (state: RecurrenceState) => string; buildRecurrenceRule: () => string; updateMaxDate: (monthName: string) => void; handlers: RecurrenceHandlers; alertDialogOpen: boolean; setAlertDialogOpen: (open: boolean) => void; } /** * Hook that prepares state, localized data sources and helper functions * for a recurrence editor UI. * * The hook centralizes conversion between the UI-friendly form state and * RFC-style recurrence rules (RRULE strings). It returns the current * `RecurrenceState` extended by additional helpers and localized dropdown * data needed by input controls. * * @param {string} value - Initial recurrence rule string (RRULE). May be empty. * @param {Date} startDate - The event start date used when computing rule parts. * @param {FreqType[]} frequencies - Allowed frequency values (e.g. ['DAILY','WEEKLY']). * @param {EndType[]} endTypes - Allowed end types (e.g. ['Count','Until']). * @param {number} firstDayOfWeek - Locale-specific index of first day (0 = Sunday). * @returns {RecurrenceEditorResult} Returns a `RecurrenceEditorResult` object containing the state, * localized data sources, helpers to build RRULE strings and UI handlers. * * @example * const editor = useRecurrenceEditor('FREQ=WEEKLY;BYDAY=MO,WE;', new Date(), ['WEEKLY','MONTHLY'], ['Count','Until'], 1, 'Alert', 'Until date cannot be earlier than start date'); * // use editor.handlers.onFreqChange as the dropdown change handler */ export declare function useRecurrenceEditor(value: string, startDate: Date, frequencies: FreqType[], endTypes: EndType[], firstDayOfWeek: number): RecurrenceEditorResult;