import { TimecodeInputProps } from "../timecodeInput/TimecodeInput.mjs"; import "../timecodeInput/index.mjs"; import React from "react"; import { RationalTime, TimecodeFormatOptions, TimecodeParseOptions } from "@techsquidtv/canvas-timeline-utils"; //#region src/timecodeField/TimecodeField.d.ts /** * Reason a `TimecodeField` committed the current draft text. */ type TimecodeFieldCommitReason = 'enter' | 'blur'; /** * Details passed when a `TimecodeField` commits a valid value. */ interface TimecodeFieldCommitDetails { /** Parsed seconds from the committed draft text. */ seconds: number; /** Parsed time converted to `RationalTime` at the field's configured timebase. */ time: RationalTime; /** User-entered text that produced the committed value. */ text: string; /** Interaction that committed the value. */ reason: TimecodeFieldCommitReason; } /** * Props for the compact inline timecode editing root. */ interface TimecodeFieldRootProps extends Omit, 'children' | 'onChange'> { /** Current field value as seconds or `RationalTime`. */ value: number | RationalTime; /** Duration used to size fixed-width display slots. Defaults to the current value. */ duration?: number | RationalTime; /** Human-readable name used for default trigger and input labels. */ ariaLabel: string; /** Called when the user commits valid timecode text. */ onCommit: (seconds: number, details: TimecodeFieldCommitDetails) => void | Promise; /** Optional label used in trigger accessibility text instead of the formatted value. */ valueLabel?: string; /** Formatting options used for the trigger text and draft value when editing starts. */ formatOptions?: TimecodeFormatOptions; /** Parsing options used for draft validation and commit. */ parseOptions?: TimecodeParseOptions; /** Tick rate used for `details.time`. Defaults to the value rate, or `60000` for seconds. */ timebase?: number; /** Disables trigger activation and cancels active editing when true. */ disabled?: boolean; /** Controlled editing state. */ editing?: boolean; /** Initial editing state when uncontrolled. */ defaultEditing?: boolean; /** Called when the field requests an editing state change. */ onEditingChange?: (editing: boolean) => void; /** Field parts. Defaults to the compact trigger plus the temporary editing input. */ children?: React.ReactNode; } /** * Props for the compact displayed timecode value. */ interface TimecodeFieldTriggerProps extends React.ButtonHTMLAttributes { /** Custom display content. Defaults to the formatted timecode value. */ children?: React.ReactNode; } /** * Props for the temporary typed timecode editor. */ interface TimecodeFieldInputProps extends Omit { /** Adds design-system classes to the active input. */ className?: string; /** Called with draft text as the user types, after internal state updates. */ onValueChange?: TimecodeInputProps['onValueChange']; } /** * Compact displayed value for `TimecodeField`. * * Renders while the field is not editing so dense timeline chrome can read like * text instead of a form. Clicking it starts editing unless the field or trigger * is disabled. * * @param props - Native button props and optional custom trigger content. * @returns A button that opens the temporary inline timecode input. */ declare const TimecodeFieldTrigger: React.ForwardRefExoticComponent>; /** * Temporary typed editor for `TimecodeField`. * * Renders only while the field is editing. Enter commits valid text, Escape * cancels, and blur commits valid text or cancels invalid text. * * @param props - `TimecodeInput` props for the editable control. * @returns A `TimecodeInput` plus screen-reader hint and error text. */ declare const TimecodeFieldInput: React.ForwardRefExoticComponent & React.RefAttributes>; /** * Root state manager for compact label-to-input timecode editing. * * Use `TimecodeField.Root` around `TimecodeField.Trigger` and * `TimecodeField.Input` when playhead clocks, clip boundaries, trim controls, or * other dense editor chrome should show a stable timecode value until the user * chooses to type a precise correction. The root owns draft state, validation, * keyboard handling, blur behavior, focus restoration, and width reservation * while leaving timeline mutation to your `onCommit` handler. * * @param props - Inline editing state, value, parser/formatter options, and span props. * @returns A span containing the active `TimecodeField` part. */ declare const TimecodeFieldRoot: React.ForwardRefExoticComponent>; /** * Compact timecode field parts. * * `TimecodeField.Root` owns editing state. `TimecodeField.Trigger` renders the * compact displayed value, and `TimecodeField.Input` renders the temporary * `TimecodeInput` used for typed edits. */ declare const TimecodeField: { /** Root state manager that swaps between compact display and typed editing. */ Root: React.ForwardRefExoticComponent>; /** Button that displays the formatted timecode and starts editing on activation. */ Trigger: React.ForwardRefExoticComponent>; /** Temporary `TimecodeInput` rendered while the field is actively editing. */ Input: React.ForwardRefExoticComponent & React.RefAttributes>; }; //#endregion export { TimecodeField, TimecodeFieldCommitDetails, TimecodeFieldCommitReason, TimecodeFieldInput, TimecodeFieldInputProps, TimecodeFieldRoot, TimecodeFieldRootProps, TimecodeFieldTrigger, TimecodeFieldTriggerProps }; //# sourceMappingURL=TimecodeField.d.mts.map