import * as react from 'react'; import react__default, { ChangeEventHandler } from 'react'; import { FieldValues, FieldPath, UseControllerProps, ControllerRenderProps, ControllerFieldState, FieldPathByValue } from 'react-hook-form'; import { StrictFormFieldProps, StrictCheckboxProps, FormFieldProps, StrictMenuProps, StrictButtonProps, StrictDropdownProps, SemanticICONS } from 'semantic-ui-react'; import { DatePickerProps } from 'react-date-picker'; import { DateTimePickerProps } from 'react-datetime-picker'; import { DateRangePickerProps } from '@wojtekmaj/react-daterange-picker'; import { DateTimeRangePickerProps } from '@wojtekmaj/react-datetimerange-picker'; import { JSONEditorPropsOptional } from 'vanilla-jsoneditor'; import { NumericFormatProps } from 'react-number-format'; import { UsePhoneInputConfig } from 'react-international-phone'; import { RRStackJson, DescribeConfig } from '@karmaniverous/rrstack'; import { UseRRStackProps } from '@karmaniverous/rrstack/react'; import { EditorProps } from 'react-draft-wysiwyg'; /** * Minimal logging interface accepted by components and hooks for optional diagnostics. * * Pass `console` or a custom logger that implements the standard Console methods. * Typical usage: * - debug: verbose diagnostic messages useful during development and tests * - log: general informational messages * - warn: non-fatal issues worth highlighting * - error: errors and assertions */ type Logger = Pick; type IsUnion = T extends unknown ? [U] extends [T] ? false : true : never; type LiteralString = string extends S ? never : IsUnion extends true ? never : S; type PrefixProps = LiteralString extends never ? never : { [K in keyof T as K extends string ? `${Prefix}${Capitalize}` : never]: T[K]; }; type HookFormProps = FieldPath> = PrefixProps, 'hook'> & { logger?: Logger; }; interface HookFormCheckboxProps = FieldPath> extends HookFormProps, Omit, PrefixProps { checkLabel?: string; leftLabel?: string; rightLabel?: string; uncheckLabel?: string; } declare const HookFormCheckbox: = FieldPath>({ checkLabel, label, leftLabel, rightLabel, uncheckLabel, ...props }: HookFormCheckboxProps) => react.JSX.Element; interface HookFormDatePickerProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'datePicker'>, PrefixProps, 'timePicker'> { showIncludeTime?: boolean; utc?: boolean; } declare const HookFormDatePicker: = FieldPath>(props: HookFormDatePickerProps) => react.JSX.Element; type DateRange = [Date | null, Date | null]; declare const extractTimestamps: (dateRange: DateRange) => (number | undefined)[]; type Presets = Record DateRange); epoch: 'past' | 'present' | 'future'; }>; declare const defaultPresets: Presets; declare const filterPresets: (epochs: Presets[string]["epoch"][], presets?: Presets) => Presets; interface HookFormDateRangePickerProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'datePicker'>, PrefixProps, 'timePicker'> { presets?: Presets; showIncludeTime?: boolean; utc?: boolean; } declare const HookFormDateRangePicker: = FieldPath>({ presets, ...props }: HookFormDateRangePickerProps) => react.JSX.Element; interface HookFormFieldProps, TName extends FieldPath = FieldPath> extends HookFormProps, Omit { children?: FormFieldProps['children'] | ((field: ControllerRenderProps, fieldState: ControllerFieldState) => FormFieldProps['children']); onChange?: (event: React.SyntheticEvent, data: C) => void; } declare const HookFormField: , TName extends FieldPath = FieldPath>(props: HookFormFieldProps) => react.JSX.Element; interface HookFormJsonEditorProps = FieldPath> extends HookFormProps, Omit, PrefixProps>, 'json'> { } declare const HookFormJsonEditor: = FieldPath>(props: HookFormJsonEditorProps) => react.JSX.Element; interface HookFormMenuProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'menu'> { } declare const HookFormMenu: = FieldPath>(props: HookFormMenuProps) => react.JSX.Element; interface HookFormNumericProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'numeric'> { onChange?: ChangeEventHandler; } declare const HookFormNumeric: = FieldPath>({ label, ...props }: HookFormNumericProps) => react.JSX.Element; interface HookFormPhoneProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'phone'> { phonePlaceholderNumberChar?: string; mobileBreakpoint?: number; isValidating?: boolean; /** * Enable typeahead on the country selector. Off by default: the search * variant renders a real text input inside the selector, which puts a * caret in the tab order where users expect a button — tabbing from the * previous field lands in the country filter and typed digits filter * countries instead of dialling. The non-search dropdown is still fully * keyboard operable (arrows, Enter, letter-jump). */ countrySearch?: boolean; } declare const HookFormPhone: = FieldPath>(props: HookFormPhoneProps) => react.JSX.Element; declare const isPhoneValid: (phone: string) => boolean; type RRStackJsonRule = NonNullable[number]; type RRStackJsonRuleOptions = NonNullable; type HookFormRRStackRuleOptionsData = Omit & { byhour?: string; byminute?: string; bymonthday?: string; ends?: Date | null; freq: NonNullable | 'span'; starts?: Date | null; }; type HookFormRRStackRuleData = Omit & { options: HookFormRRStackRuleOptionsData; }; type HookFormRRStackData = Omit & { rules: HookFormRRStackRuleData[]; }; type HookFormRRStackPath = FieldPathByValue; /** * Map the RHF UI schedule (UI-friendly types) to the rrstack engine schedule. * - 'span' → undefined freq * - Date | null → epoch ms | undefined * - tolerant CSV text → number[] * - arrays pass through unchanged * Assumes timezone has been validated upstream. */ declare const rhf2rrstack: (rhf: HookFormRRStackData, opts?: { endDatesInclusive?: boolean; }) => RRStackJson; /** * Reverse mapping of {@link rhf2rrstack}: rrstack → RHF UI shape. * * - Converts epoch clamps (starts/ends) to Date objects in the rule timezone * using epochToWallDate, preserving wall time semantics. * - Restores 'span' when rrstack freq is undefined. * - Maps numeric arrays back to tolerant CSV text for byhour/byminute/bymonthday. * - Keeps array options (bymonth/byweekday/bysetpos) as number[] or undefined. * - Optional endDatesInclusive reversal: * • When true and an rrstack `ends` falls exactly at local midnight, subtract * one calendar day so the UI reflects the original end date (date-only). */ declare const rrstack2rhf: (rrstack: RRStackJson, opts?: { endDatesInclusive?: boolean; }) => HookFormRRStackData; interface HookFormRRStackProps = HookFormRRStackPath> extends HookFormProps, Omit, PrefixProps, PrefixProps, 'rrstack'> { timestampFormat?: string; endDatesInclusive?: boolean; } declare const HookFormRRStack: = HookFormRRStackPath>(props: HookFormRRStackProps) => react.JSX.Element; type Sort = [ NonNullable | 'auto', boolean ]; interface HookFormSortProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'button'>, PrefixProps, 'dropdown'> { ascIcon?: SemanticICONS; descIcon?: SemanticICONS; sortOptions?: StrictDropdownProps['options']; dropdownOptions?: StrictDropdownProps['options']; } declare const HookFormSort: = FieldPath>({ ascIcon, descIcon, sortOptions, dropdownOptions, ...props }: HookFormSortProps) => react.JSX.Element; interface WysiwygEditorProps extends Omit { onChange: (value: string) => void; value?: string | null; } interface HookFormWysiwygEditorProps = FieldPath> extends HookFormProps, Omit, PrefixProps, 'wysiwyg'> { } declare const HookFormWysiwygEditor: = FieldPath>(props: HookFormWysiwygEditorProps) => react__default.JSX.Element; export { HookFormCheckbox, HookFormDatePicker, HookFormDateRangePicker, HookFormField, HookFormJsonEditor, HookFormMenu, HookFormNumeric, HookFormPhone, HookFormRRStack, HookFormSort, HookFormWysiwygEditor, defaultPresets, extractTimestamps, filterPresets, isPhoneValid, rhf2rrstack, rrstack2rhf }; export type { DateRange, HookFormCheckboxProps, HookFormDatePickerProps, HookFormDateRangePickerProps, HookFormFieldProps, HookFormJsonEditorProps, HookFormMenuProps, HookFormNumericProps, HookFormPhoneProps, HookFormRRStackData, HookFormRRStackPath, HookFormRRStackProps, HookFormRRStackRuleData, HookFormRRStackRuleOptionsData, HookFormSortProps, HookFormWysiwygEditorProps, Logger, Presets, Sort };