import * as React$1 from 'react'; import { ComponentType } from 'react'; import { UseFormReturn } from 'react-hook-form'; import { FileManager as FileManager$1 } from 'hazo_files'; export { FileManager as HazoFilesFileManager } from 'hazo_files'; import * as react_jsx_runtime from 'react/jsx-runtime'; import { ClassValue } from 'clsx'; /** * Core type definitions for hazo_data_forms */ /** * Supported document types for DocLink * - "pdf": PDF documents (opens in embedded viewer) * - "image": Image files (jpg, png, gif, webp - displays inline preview) * - "document": Office documents (docx, xlsx, etc. - download only) * - "other": Any other file type (download only) */ type DocLinkType = "pdf" | "image" | "document" | "other"; /** * Document link configuration for document integration */ interface DocLink { /** Document type - determines how it's displayed */ type: DocLinkType; /** URL/path to the document */ url: string; /** Starting page (PDF only) */ page?: number; /** Optional display name (if not provided, extracted from URL) */ filename?: string; /** File ID for uploaded files (used for deletion) */ file_id?: string; } /** * Uploaded file metadata - stored in form values */ interface UploadedFile { /** Unique identifier for the file */ file_id: string; /** Original filename */ filename: string; /** URL/path where file is stored */ url: string; /** MIME type */ mime_type: string; /** File size in bytes */ size: number; /** Upload timestamp (ISO string) */ uploaded_at: string; /** Optional page number for PDFs (for doc_link navigation) */ page?: number; } /** * Field uploads - array of uploaded files per field */ type FieldUploads = UploadedFile[]; /** * Upload request sent to the upload handler callback */ interface FileUploadRequest { /** The field being uploaded to */ field_id: string; /** Field label for context */ field_label: string; /** The file being uploaded */ file: File; /** Section name containing the field */ section_name?: string; /** Sub-section ID containing the field */ sub_section_id?: string; } /** * Upload result returned from the upload handler callback */ interface FileUploadResult { /** Whether upload succeeded */ success: boolean; /** The uploaded file metadata (on success) */ uploaded_file?: UploadedFile; /** Error message (on failure) */ error?: string; } /** * File upload configuration */ interface FileUploadConfig { /** Enable/disable upload feature globally */ enabled: boolean; /** Allowed MIME types (e.g., ["application/pdf", "image/*"]) */ allowed_types: string[]; /** Max file size in bytes (default: 10MB) */ max_file_size: number; /** Max files per field (default: 5) */ max_files_per_field: number; /** Default upload directory hint (passed to callback) */ default_directory?: string; /** Upload icon color */ upload_icon_color: string; /** Upload icon hover color */ upload_hover_color: string; } /** * File manager configuration * Controls the unified file management button and panel */ interface FileManagerConfig { /** Default display mode: "sidebar" or "dialog" */ display_mode: "sidebar" | "dialog"; /** Icon size */ icon_size: string; /** Icon color when no files */ icon_color: string; /** Icon color on hover */ icon_color_hover: string; /** Icon color when has files */ icon_color_with_files: string; /** Badge background color */ badge_background: string; /** Badge text color */ badge_text_color: string; /** Dialog width */ dialog_width: string; /** Dialog max height */ dialog_max_height: string; /** Button column width */ button_column_width: string; } /** * Help tooltip configuration for field labels * Displays a question mark icon that shows help content on hover */ interface HelpTooltip { /** Custom help message to display */ message?: string; /** Whether to show the calculation formula (for computed fields) */ show_formula?: boolean; /** Custom formula display text (overrides computed_formula for display) */ formula_display?: string; } /** * Style level type (H1-H6) for hierarchical styling */ type StyleLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; /** * Style variant combining type (header/total) and level (h1-h6) * Used to specify styling for sections, sub-sections, and field rows */ type StyleVariant = `header_${StyleLevel}` | `total_${StyleLevel}`; /** * Individual style level configuration (legacy format) * Defines visual properties for each header/total level * @deprecated Use StyleClassDefinition instead */ interface StyleLevelConfig { font_size: string; font_weight: string; font_color: string; background_color: string; indent: string; } /** * Full hierarchical style configuration (legacy format) * Contains styling for all header and total levels (h1-h6) * @deprecated Use StylesConfig instead */ interface HierarchicalStyleConfig { header_h1: StyleLevelConfig; header_h2: StyleLevelConfig; header_h3: StyleLevelConfig; header_h4: StyleLevelConfig; header_h5: StyleLevelConfig; header_h6: StyleLevelConfig; total_h1: StyleLevelConfig; total_h2: StyleLevelConfig; total_h3: StyleLevelConfig; total_h4: StyleLevelConfig; total_h5: StyleLevelConfig; total_h6: StyleLevelConfig; } /** * Design tokens for reusable style values */ interface StyleTokens { colors: Record; fonts: Record; spacing: Record; } /** * Style class definition - CSS-class-like styling * Supports inheritance via 'extends' property * Token references use {category.key} syntax (e.g., "{colors.primary}") */ interface StyleClassDefinition { /** Inherit from another style class */ extends?: string; color?: string; background_color?: string; border_color?: string; border_width?: string; border_radius?: string; font_family?: string; font_size?: string; font_weight?: string; line_height?: string; letter_spacing?: string; padding?: string; padding_x?: string; padding_y?: string; margin?: string; margin_left?: string; margin_top?: string; text_align?: string; min_width?: string; min_height?: string; opacity?: number; indent?: string; } /** * Complete styles configuration loaded from form_styles.json */ interface StylesConfig { meta?: { version?: string; name?: string; description?: string; }; tokens: StyleTokens; styles: Record; } /** * Resolved style after inheritance resolution and token substitution */ interface ResolvedStyle { color?: string; background_color?: string; border_color?: string; border_width?: string; border_radius?: string; font_family?: string; font_size?: string; font_weight?: string; line_height?: string; letter_spacing?: string; padding?: string; padding_x?: string; padding_y?: string; margin?: string; margin_left?: string; margin_top?: string; text_align?: string; min_width?: string; min_height?: string; opacity?: number; indent?: string; } /** * Base field types - built-in renderers available in the library */ type BaseFieldType = "text" | "number" | "date" | "boolean" | "option" | "email" | "tel" | "currency" | "percentage" | "textarea" | "table" | "computed" | "static_text" | "summary_row"; /** * Field type - includes base types and any custom types defined in config * Custom types (like "tfn", "abn") are resolved to base types at runtime */ type FieldType = BaseFieldType | string; /** * Field type definition for configurable field types * Loaded from form_field_types.json */ interface FieldTypeDefinition { /** Which built-in renderer to use */ base_type: BaseFieldType; /** Inherit from another field type definition */ extends?: string; /** Human-readable label for this field type */ label?: string; /** Regex pattern for validation (validates raw/unmasked value) */ pattern?: string; /** Error message when validation fails */ validation_message?: string; /** Display format with X placeholders for digits */ display_format?: string; /** Input mask with # for digit placeholders */ input_mask?: string; /** Default placeholder text */ placeholder?: string; /** Maximum input length (including formatting chars) */ max_length?: number; /** Number of digits (without formatting) */ digit_count?: number; /** HTML inputmode attribute for mobile keyboards */ input_mode?: "text" | "numeric" | "tel" | "email" | "url" | "decimal"; /** Prefix to display before value */ prefix?: string; /** Suffix to display after value */ suffix?: string; /** Style class to apply from form_styles.json */ style_class?: string; /** Default decimal places for numeric types */ decimal_places?: number; /** Minimum value for numeric types */ min?: number; /** Maximum value for numeric types */ max?: number; } /** * Field types configuration loaded from form_field_types.json */ interface FieldTypesConfig { meta?: { version?: string; description?: string; }; field_types: Record; } /** * Option item for select/option fields */ interface OptionItem { label: string; value: string; } /** * Table column definition for table/array fields */ interface TableColumn { id: string; label: string; field_info: Omit; width?: string; /** If true, display a subtotal for this column at the bottom of the table */ subtotal?: boolean; /** Default value for this column when adding new rows */ default_value?: unknown; /** Optional reference value displayed below cell inputs (e.g., prior-year value, benchmark) */ reference_value?: string; } /** * Field information configuration */ interface FieldInfo { field_type: FieldType; required?: boolean; options?: OptionItem[]; min?: number; max?: number; decimal_places?: number; currency_symbol?: string; min_length?: number; max_length?: number; rows?: number; placeholder?: string; disabled?: boolean; computed_formula?: string; computed_dependencies?: string[]; table_columns?: TableColumn[]; table_min_rows?: number; table_max_rows?: number; table_title?: string; /** Default value for this field when no value is provided */ default_value?: unknown; badge?: string; item_code?: string; display_variant?: "label_only" | "value_only" | "inline"; width?: string; text_align?: "left" | "center" | "right"; static_content?: string; summary_fields?: string[]; summary_note?: string; is_worksheet?: boolean; formula_label?: string; } /** * Label position for field layout * - "stacked": Label above the input field (default) * - "inline": Label on the same line as the input field */ type LabelPosition = "stacked" | "inline"; /** * Individual field definition */ interface FormField { id: string; label: string; field_info: FieldInfo; value?: unknown; /** Default value used when no value is provided (used for initial form state) */ default_value?: unknown; /** Array of document links for this field */ doc_links?: DocLink[]; label_position?: LabelPosition; style_variant?: StyleVariant; help_tooltip?: HelpTooltip; /** Field-level override for value column width (e.g., "150px") */ value_width?: string; /** Row variant for special row styling (e.g., highlight row) */ row_variant?: "highlight" | "normal"; /** Optional reference value displayed below the field (e.g., prior-year value, benchmark) */ reference_value?: string; /** * Paired field for dual-column layouts (e.g., Capital gains / Capital losses) * When present, renders both fields on the same row with their own badge+value */ paired_field?: Omit; } /** * Column header definition for multi-column layouts */ interface ColumnHeader { label: string; width?: string; } /** * Field group with orientation */ interface FieldGroup { orientation: "horizontal" | "vertical"; fields: FormField[]; /** Fixed width for badge column when badges should be aligned (e.g., "40px") */ badge_column_width?: string; /** Fixed width for value column when values should be aligned (e.g., "80px") */ value_column_width?: string; /** * Column headers for paired field layouts (e.g., ["Capital gains", "Capital losses"]) * When present, displays column headers above the badge+value columns */ column_headers?: ColumnHeader[]; } /** * Sub-section within a section */ interface SubSection { sub_section_id: string; sub_section_label: string; field_group: FieldGroup; item_code?: string; badge?: string; style_variant?: StyleVariant; } /** * Top-level section */ interface FormSection { section_name: string; sub_sections: SubSection[]; sub_section_layout?: "vertical" | "horizontal"; style_variant?: StyleVariant; } /** * Complete form schema (array of sections) */ type FormSchema = FormSection[]; /** * Form values as a flat key-value map */ type FormValues = Record; /** * Form mode */ type FormMode = "edit" | "view"; /** * PDF panel position */ type PdfPanelPosition = "right" | "left" | "bottom"; /** * Callback event for doc_links click */ interface DocLinkClickEvent { field_id: string; /** All doc_links for this field */ doc_links: DocLink[]; } /** * Form validation errors */ type FormErrors = Record; /** * Config options loaded from INI file and JSON configs */ interface FormConfig { styles_path?: string; field_types_path?: string; doc_link_icon_size: string; doc_link_icon_style: "solid" | "outline"; doc_link_column_width: string; pdf_panel_width: string; pdf_panel_min_width: string; pdf_panel_max_width: string; default_currency_symbol: string; date_format: string; default_decimal_places: number; percentage_suffix: string; enable_pdf_panel?: boolean; collapsible_sections?: boolean; validate_on_blur?: boolean; validate_on_change?: boolean; file_upload: FileUploadConfig; file_manager: FileManagerConfig; styles_config: StylesConfig; field_types_config: FieldTypesConfig; styles: HierarchicalStyleConfig; label_color: string; label_color_required: string; field_border_color: string; field_border_color_focus: string; field_background_color: string; field_background_color_disabled: string; section_header_color: string; section_header_background: string; sub_section_header_color: string; error_color: string; doc_link_icon_color: string; doc_link_hover_color: string; view_mode_background: string; view_mode_border: string; label_font_family: string; label_font_size: string; label_font_weight: string; field_font_family: string; field_font_size: string; section_header_font_size: string; sub_section_header_font_size: string; section_spacing: string; sub_section_spacing: string; field_spacing: string; field_gap_horizontal: string; field_gap_vertical: string; label_field_gap: string; item_code_border_color: string; item_code_background: string; item_code_font_size: string; worksheet_indent: string; worksheet_label_font_weight: string; highlight_row_background: string; badge_background: string; badge_text_color: string; } /** * Partial config for overrides */ type PartialFormConfig = Partial; /** * Default styles configuration */ declare const DEFAULT_STYLES_CONFIG: StylesConfig; /** * Default field types configuration */ declare const DEFAULT_FIELD_TYPES_CONFIG: FieldTypesConfig; /** * Default form configuration values */ declare const DEFAULT_FORM_CONFIG: FormConfig; /** * Logger interface (matches hazo_pdf's Logger interface) * Compatible with hazo_logs package */ interface Logger { info: (message: string, data?: Record) => void; debug: (message: string, data?: Record) => void; warn: (message: string, data?: Record) => void; error: (message: string, data?: Record) => void; } /** * Database connection interface for hazo_connect * Consumers pass their own hazo_connect instance */ interface HazoConnectInstance { /** Execute a query and return results */ query: (sql: string, params?: unknown[]) => Promise; /** Execute a statement (INSERT, UPDATE, DELETE) */ execute: (sql: string, params?: unknown[]) => Promise<{ affected_rows: number; }>; } /** * Services that can be injected into hazo_data_forms */ interface HazoServices { /** Database connection from hazo_connect */ db?: HazoConnectInstance; /** Logger from hazo_logs (compatible with hazo_pdf's Logger) */ logger?: Logger; /** File manager from hazo_files */ file_manager: FileManager$1; /** Custom services for extensibility */ custom?: Record; } /** * Props for HazoServicesProvider */ interface HazoServicesProviderProps { /** Services to provide to all child components */ services?: HazoServices; /** Child components */ children: React$1.ReactNode; } /** * Provider component for injecting services into hazo_data_forms * * Usage: * ```tsx * // App-wide services (recommended - in layout.tsx) * import { HazoServicesProvider } from "hazo_data_forms"; * import { db } from "./db"; * import { logger } from "./logger"; * * export default function Layout({ children }) { * return ( * * {children} * * ); * } * ``` */ declare function HazoServicesProvider({ services, children, }: HazoServicesProviderProps): React$1.ReactElement; /** * Hook to access all injected services * * Usage: * ```tsx * import { useHazoServices } from "hazo_data_forms"; * * function MyComponent() { * const services = useHazoServices(); * // Access services.db, services.logger, services.custom * } * ``` */ declare function useHazoServices(): HazoServices | undefined; /** * Hook to access the logger service * Returns undefined if no logger was provided * * Usage: * ```tsx * import { useHazoLogger } from "hazo_data_forms"; * * function MyComponent() { * const logger = useHazoLogger(); * logger?.info("Component mounted"); * } * ``` */ declare function useHazoLogger(): Logger | undefined; /** * Hook to access the database service * Returns undefined if no database was provided * * Usage: * ```tsx * import { useHazoDb } from "hazo_data_forms"; * * function MyComponent() { * const db = useHazoDb(); * // Query database * const data = await db?.query("SELECT * FROM users"); * } * ``` */ declare function useHazoDb(): HazoConnectInstance | undefined; /** * Hook to access a custom service by key * * Usage: * ```tsx * import { useHazoCustomService } from "hazo_data_forms"; * * function MyComponent() { * const myService = useHazoCustomService("my_service"); * } * ``` */ declare function useHazoCustomService(key: string): T | undefined; /** * Hook to access the file manager service * Returns undefined if no file manager was provided * * Usage: * ```tsx * import { useHazoFileManager } from "hazo_data_forms"; * * function MyComponent() { * const file_manager = useHazoFileManager(); * if (file_manager?.isInitialized()) { * await file_manager.uploadFile(data, "/path/to/file.pdf"); * } * } * ``` */ declare function useHazoFileManager(): FileManager$1 | undefined; /** * Display mode for the file manager */ type FileManagerDisplayMode = "sidebar" | "dialog"; /** * Unified file item that can represent either a doc_link or an uploaded file */ interface FileItem { /** Unique identifier */ id: string; /** Display filename */ filename: string; /** File URL */ url: string; /** File type for icon selection */ type: DocLinkType; /** Source: "doc_link" (schema) or "upload" (user uploaded) */ source: "doc_link" | "upload"; /** Page number for PDFs */ page?: number; /** File ID for uploaded files (for deletion) */ file_id?: string; } /** * Props for the FileManagerButton component */ interface FileManagerButtonProps { /** Total count of files (doc_links + uploads) */ file_count: number; /** Whether the field has any files */ has_files: boolean; /** Click handler */ on_click: () => void; /** Configuration */ config: FormConfig; /** Additional class name */ class_name?: string; /** Tooltip text override */ tooltip_text?: string; /** Whether button is disabled (e.g., view mode without files) */ disabled?: boolean; } /** * Props for the FileManager component */ interface FileManagerProps { /** Array of all files (doc_links converted + uploads) */ files: FileItem[]; /** Whether manager is open */ is_open: boolean; /** Callback to close manager */ on_close: () => void; /** Display mode */ display_mode: FileManagerDisplayMode; /** Config for styling */ config: FormConfig; /** Optional PDF viewer component */ pdf_viewer_component?: React.ComponentType; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ pdf_save_path?: string; /** Enable upload UI */ upload_enabled?: boolean; /** Field label for display */ field_label?: string; /** Field ID for upload context */ field_id?: string; /** Upload handler callback */ on_upload?: (files: File[]) => Promise; /** Delete handler callback (only for uploaded files) */ on_delete?: (file_id: string) => Promise; /** Callback when popout button is clicked. Receives full context to reconstruct FileManager. */ on_popout?: (context: FileManagerPopoutContext) => void; /** Optional className */ class_name?: string; /** Enable file conversion to PDF for supported types */ enable_file_conversion?: boolean; /** Callback when a file is converted to PDF */ on_file_convert?: (converted_pdf: Uint8Array, original_filename: string) => void; /** Logger instance (compatible with hazo_logs and hazo_pdf) */ logger?: Logger; } /** * Props for the FileManagerDialog component */ interface FileManagerDialogProps extends Omit { /** Dialog title override */ title?: string; } /** * Context passed to the popout callback * Contains all information needed to reconstruct the FileManager in a new tab */ interface FileManagerPopoutContext { /** All files in the file manager */ files: FileItem[]; /** Currently selected file */ selected_file: FileItem; /** Index of the selected file */ selected_index: number; /** Field ID (if applicable) */ field_id?: string; /** Field label (if applicable) */ field_label?: string; } /** * Upload progress state for individual files */ interface UploadProgress { filename: string; progress: number; status: "uploading" | "success" | "error"; error?: string; } /** * Props for the FileList component */ interface FileListProps { /** List of files to display */ files: FileItem[]; /** Index of currently selected file */ selected_index: number; /** Callback when a file is selected */ on_select: (index: number) => void; /** Delete handler (only for uploaded files) */ on_delete?: (file_id: string) => Promise; /** Whether upload is enabled */ upload_enabled?: boolean; /** Whether to show the add button */ show_add_button?: boolean; /** Configuration */ config: FormConfig; /** Handler for dropped/selected files */ on_files_dropped?: (files: File[]) => void; /** Whether drag-drop is enabled */ drag_drop_enabled?: boolean; /** File input accept string for file picker */ accept_types?: string; /** Whether upload is in progress */ is_uploading?: boolean; /** Current upload progress */ upload_progress?: UploadProgress[]; } /** * Props for the FileViewer component */ interface FileViewerProps { /** File to display (null for empty state) */ file: FileItem | null; /** Configuration */ config: FormConfig; /** Optional PDF viewer component */ pdf_viewer_component?: React.ComponentType; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ pdf_save_path?: string; /** Whether this file can be deleted (upload mode + uploaded file) */ deletable?: boolean; /** Delete handler */ on_delete?: () => void; /** Enable file conversion to PDF for supported types (images, text, Excel) */ enable_file_conversion?: boolean; /** * Callback when a file is converted to PDF * The caller should handle storing/displaying the converted PDF */ on_convert_to_pdf?: (converted_pdf: Uint8Array, original_filename: string) => void; /** Logger instance (compatible with hazo_logs and hazo_pdf) */ logger?: Logger; } /** * Convert DocLink to FileItem */ declare function doc_link_to_file_item(doc_link: DocLink, index: number): FileItem; /** * File item for multi-file PDF viewer (mirrors hazo_pdf's HazoPdfFileItem) */ interface HazoPdfFileItem { /** Unique identifier for the file */ id: string; /** Display name for the file */ name: string; /** URL to the PDF file */ url: string; /** File type (e.g., "pdf", "image") */ type?: string; /** Optional MIME type (used for conversion detection) */ mime_type?: string; /** Original file size in bytes */ size?: number; /** Whether this file was converted to PDF */ converted?: boolean; /** Custom metadata */ metadata?: Record; } /** * Result from file upload handler (mirrors hazo_pdf's HazoPdfUploadResult) */ interface HazoPdfUploadResult { /** Whether upload was successful */ success: boolean; /** Error message if failed */ error?: string; /** The uploaded file item */ file?: HazoPdfFileItem; } /** * Display mode for the file manager sidebar (mirrors hazo_pdf's HazoPdfFileManagerDisplayMode) */ type HazoPdfFileManagerDisplayMode = "tabs" | "dropdown" | "hidden"; /** * Context passed to popout handler (mirrors hazo_pdf's HazoPdfPopoutContext) */ interface HazoPdfPopoutContext { /** Currently selected file */ current_file: HazoPdfFileItem | null; /** All files in the viewer */ files: HazoPdfFileItem[]; /** Current page number */ page: number; /** Current scale/zoom level */ scale: number | "page-width" | "page-fit" | "auto"; } /** * Props expected by a PDF viewer component * Supports both single-file (url) and multi-file (files) modes */ interface PdfViewerProps { /** URL to display (optional when using files array) */ url?: string; /** Additional CSS class name */ className?: string; /** Callback when an error occurs loading the PDF */ on_error?: (error: Error) => void; /** Default scale/zoom level */ default_scale?: "page-width" | "page-fit" | "auto" | number; /** Callback when PDF is saved/annotated */ on_save?: (pdf_bytes: Uint8Array, filename: string) => void; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ save_path?: string; /** Array of files for multi-file mode */ files?: HazoPdfFileItem[]; /** Callback when a file is selected */ on_file_select?: (file: HazoPdfFileItem) => void; /** Callback when a file is deleted */ on_file_delete?: (file_id: string) => void; /** Callback when a file is uploaded */ on_upload?: (file: File, converted_pdf?: Uint8Array) => Promise; /** Callback when the files array changes */ on_files_change?: (files: HazoPdfFileItem[]) => void; /** Display mode for file manager sidebar */ file_manager_display_mode?: HazoPdfFileManagerDisplayMode; /** Enable popout button to open in new tab */ enable_popout?: boolean; /** Route for popout page (e.g., "/pdf-viewer") */ popout_route?: string; /** Callback when popout button is clicked */ on_popout?: (context: HazoPdfPopoutContext) => void; /** Title to display in the viewer header */ viewer_title?: string; } /** * Props for the HazoDataForm component */ interface HazoDataFormProps { /** * JSON schema defining form structure */ schema: FormSchema; /** * Form mode: 'edit' for editable, 'view' for read-only display * @default 'edit' */ mode?: FormMode; /** * Initial/controlled form values */ values?: FormValues; /** * Default values for uncontrolled mode */ default_values?: FormValues; /** * Callback when any field value changes */ on_change?: (values: FormValues) => void; /** * Callback when a specific field changes */ on_field_change?: (field_id: string, value: unknown) => void; /** * Callback when form is submitted (edit mode) */ on_submit?: (values: FormValues) => void; /** * Callback when a doc_link is clicked */ on_doc_link_click?: (event: DocLinkClickEvent) => void; /** * Whether to show built-in PDF panel when doc_link clicked * Set to false to handle doc_link externally via on_doc_link_click * @default true */ show_pdf_panel?: boolean; /** * Position of the PDF panel relative to form * @default 'right' */ pdf_panel_position?: PdfPanelPosition; /** * Custom PDF panel width (overrides config) */ pdf_panel_width?: string; /** * Whether PDF panel can be resized * @default true */ pdf_panel_resizable?: boolean; /** * PDF viewer component to use (from hazo_pdf or custom) * If not provided, will attempt to dynamically load hazo_pdf * Example: import { PdfViewer } from 'hazo_pdf'; */ pdf_viewer_component?: ComponentType; /** * Base storage path for uploaded files (e.g., "/clients/acme/tax_2024/") * Used with file_manager service for file upload operations */ file_save_path?: string; /** * Optional separate path for PDF saves (e.g., "/clients/acme/tax_2024/pdfs/") * If not provided, falls back to file_save_path * Used with file_manager service for PDF save operations */ pdf_save_path?: string; /** * Path to config INI file * @default '/config/hazo_data_forms_config.ini' */ config_path?: string; /** * Config overrides (takes precedence over INI file) */ config_override?: PartialFormConfig; /** * External validation errors */ errors?: FormErrors; /** * Whether to validate on blur * @default true */ validate_on_blur?: boolean; /** * Whether to validate on change * @default false */ validate_on_change?: boolean; /** * Custom validation function */ validate?: (values: FormValues) => FormErrors; /** * CSS class name for form container */ class_name?: string; /** * Whether to show section headers * @default true */ show_section_headers?: boolean; /** * Whether to show sub-section headers * @default true */ show_sub_section_headers?: boolean; /** * Whether sections are collapsible * @default false */ collapsible_sections?: boolean; /** * Initially collapsed section names */ collapsed_sections?: string[]; /** * Callback to receive react-hook-form methods */ on_form_ready?: (methods: UseFormReturn) => void; /** * Whether to show submit button * @default true (when on_submit is provided) */ show_submit_button?: boolean; /** * Custom submit button text * @default 'Submit' */ submit_button_text?: string; /** * Whether to enable file upload feature for fields * This works in conjunction with config.file_upload.enabled * @default false */ enable_file_upload?: boolean; /** * Callback when an uploaded file is viewed * Use this to handle custom viewing behavior (e.g., open in new tab) * If not provided, PDFs will open in the PDF panel, others in new tab */ on_file_view?: (field_id: string, uploaded_file: UploadedFile) => void; /** * Callback when the popout button is clicked in the file manager * Use this to open the FileManager in a new tab/window * Receives full context (all files, selected file, field info) to reconstruct the view */ on_file_popout?: (context: FileManagerPopoutContext) => void; /** * Enable file conversion to PDF for supported types (images, text, Excel) * Requires hazo_pdf v1.3.2 or later * @default false */ enable_file_conversion?: boolean; /** * Callback when a file is converted to PDF * Use this to handle the converted PDF (e.g., display it, save it, etc.) */ on_file_convert?: (converted_pdf: Uint8Array, original_filename: string) => void; /** * Enable the popout button in the PDF viewer * Allows opening the PDF viewer in a new tab/window * @default false */ enable_pdf_popout?: boolean; /** * Route for the popout page (e.g., "/pdf-viewer") * Only used if enable_pdf_popout is true */ pdf_popout_route?: string; /** * Callback when the PDF popout button is clicked * Receives context about the current viewer state */ on_pdf_popout?: (context: HazoPdfPopoutContext) => void; /** * Services to inject (db, logger, custom) * Alternative to using HazoServicesProvider at app level * * Usage: * ```tsx * * ``` */ services?: HazoServices; } /** * HazoDataForm Component * Main form component that renders dynamic forms from JSON schema */ declare function HazoDataForm({ schema, mode, values, default_values, on_change, on_field_change, on_submit, on_doc_link_click, show_pdf_panel, pdf_panel_position, pdf_panel_width, pdf_panel_resizable, pdf_viewer_component, file_save_path, pdf_save_path, config_path, config_override, errors: external_errors, validate_on_blur, validate_on_change, validate, class_name, show_section_headers, show_sub_section_headers, collapsible_sections, collapsed_sections, on_form_ready, show_submit_button, submit_button_text, enable_file_upload, on_file_view, on_file_popout, enable_file_conversion, on_file_convert, enable_pdf_popout, pdf_popout_route, on_pdf_popout, services, }: HazoDataFormProps): React$1.ReactElement>; /** * hazo_pdf Re-exports Module * * This module provides async access to hazo_pdf conversion utilities. * Using dynamic imports ensures hazo_pdf remains optional and is only * loaded when conversion features are actually needed. */ /** * Supported image MIME types for conversion */ type SupportedImageType = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp'; /** * PDF conversion options */ interface PdfConversionOptions { /** Page size: 'letter' (612x792), 'a4' (595x842), 'legal' (612x1008) */ page_size?: 'letter' | 'a4' | 'legal'; /** Image quality 0.0-1.0 for lossy compression (default: 0.85) */ image_quality?: number; /** How image fits on page: 'fit' (preserve aspect), 'fill' (crop), 'stretch' */ image_fit?: 'fit' | 'fill' | 'stretch'; /** Margin in points (72 points = 1 inch, default: 36) */ margin?: number; /** Font size for text files in points (default: 12) */ font_size?: number; /** Line height multiplier for text files (default: 1.4) */ line_height?: number; } /** * Result from PDF conversion operations */ interface ConversionResult { /** Whether conversion succeeded */ success: boolean; /** Converted PDF as Uint8Array (if success) */ pdf_bytes?: Uint8Array; /** Original filename without extension */ original_name?: string; /** Generated PDF filename */ pdf_filename?: string; /** Original file type that was converted */ source_type?: 'image' | 'text' | 'excel'; /** Number of pages in the resulting PDF */ page_count?: number; /** Error message (if !success) */ error?: string; } /** * Conversion utilities from hazo_pdf */ interface HazoPdfConversionUtils { /** * Convert a file to PDF (auto-detects type) * @param file - The file to convert * @param filename - Original filename (used for output naming) * @param options - Conversion options * @returns Promise */ convert_to_pdf: (file: File | Blob, filename: string, options?: PdfConversionOptions) => Promise; /** * Convert image bytes to PDF * @param image_bytes - Raw image data as Uint8Array * @param mime_type - Image MIME type * @param filename - Original filename * @param options - Conversion options * @returns Promise */ convert_image_to_pdf: (image_bytes: Uint8Array, mime_type: SupportedImageType, filename: string, options?: PdfConversionOptions) => Promise; /** * Convert text content to PDF * @param text_content - Text string to convert * @param filename - Original filename * @param options - Conversion options * @returns Promise */ convert_text_to_pdf: (text_content: string, filename: string, options?: PdfConversionOptions) => Promise; /** * Convert Excel spreadsheet to PDF * @param excel_bytes - Raw Excel data as Uint8Array * @param filename - Original filename * @param options - Conversion options * @returns Promise */ convert_excel_to_pdf: (excel_bytes: Uint8Array, filename: string, options?: PdfConversionOptions) => Promise; /** * Check if a MIME type can be converted to PDF * @param mime_type - The MIME type to check * @returns boolean - Whether conversion is supported */ can_convert_to_pdf: (mime_type: string) => boolean; /** * Check if a MIME type is an image type * @param mime_type - The MIME type to check * @returns boolean */ is_image_type: (mime_type: string) => boolean; /** * Check if a MIME type is a text type * @param mime_type - The MIME type to check * @returns boolean */ is_text_type: (mime_type: string) => boolean; /** * Check if a MIME type is an Excel type * @param mime_type - The MIME type to check * @returns boolean */ is_excel_type: (mime_type: string) => boolean; /** * Get all supported MIME types for conversion * @returns Array of supported MIME types */ get_supported_types: () => string[]; } /** * Dynamically load hazo_pdf conversion utilities * * @example * ```typescript * const utils = await get_hazo_pdf_conversion_utils(); * if (utils.can_convert_to_pdf(file.type)) { * const result = await utils.convert_to_pdf(file, file.name); * if (result.success && result.pdf_bytes) { * // Use result.pdf_bytes * } * } * ``` * * @returns Promise - The conversion utilities * @throws Error if hazo_pdf is not installed */ declare function get_hazo_pdf_conversion_utils(): Promise; /** * Check if hazo_pdf is available * * @example * ```typescript * const available = await is_hazo_pdf_available(); * if (available) { * // Safe to use conversion features * } * ``` * * @returns Promise - Whether hazo_pdf is installed and available */ declare function is_hazo_pdf_available(): Promise; /** * Supported MIME types for conversion (static list for quick checks) * These match the types supported by hazo_pdf v1.4.0 */ declare const CONVERTIBLE_MIME_TYPES: { readonly image: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"]; readonly text: readonly ["text/plain", "text/markdown", "text/csv"]; readonly excel: readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel", "application/vnd.google-apps.spreadsheet"]; }; /** * Quick check if a MIME type can potentially be converted (without loading hazo_pdf) * Use this for UI decisions before actually attempting conversion. * * @param mime_type - The MIME type to check * @returns boolean - Whether the type is potentially convertible */ declare function is_potentially_convertible(mime_type: string): boolean; /** * Props passed to field renderer components */ interface FieldRendererProps { field: FormField; mode: FormMode; value: unknown; error?: string; config: FormConfig; on_change: (value: unknown) => void; on_blur?: () => void; on_doc_link_click?: () => void; /** Callback for row-level doc_links in table fields */ on_row_doc_link_click?: (field_id: string, doc_links: DocLink[]) => void; /** Fixed width for badge column when badges should be aligned */ badge_column_width?: string; /** Fixed width for value column when values should be aligned */ value_column_width?: string; /** Value for the paired field (when field has paired_field defined) */ paired_value?: unknown; /** Change handler for the paired field */ paired_on_change?: (value: unknown) => void; /** Blur handler for the paired field */ paired_on_blur?: () => void; /** Error for the paired field */ paired_error?: string; /** Uploaded files for this field */ field_uploads?: FieldUploads; /** Callback when upload icon is clicked */ on_upload_click?: () => void; /** Whether upload feature is enabled for this field */ upload_enabled?: boolean; } /** * Type definition for field renderer components */ type FieldRenderer$1 = React.ComponentType; /** * Register a custom field renderer */ declare function register_field_renderer(type: string, renderer: FieldRenderer$1): void; /** * Get field renderer by type */ declare function get_field_renderer(type: string): FieldRenderer$1 | undefined; /** * Resolve a field type to its definition from the config * Returns the FieldTypeDefinition if found in config, or null if it's a base type * or not found */ declare function resolve_field_type(field_type: string, config: FormConfig): FieldTypeDefinition | null; /** * Check if a field type requires the MaskedField renderer * (i.e., it has a display_format defined) */ declare function is_masked_field_type(field_type: string, config: FormConfig): boolean; /** * Get the base renderer type for a field type * Custom types resolve to their base_type, built-in types return as-is */ declare function get_base_field_type(field_type: string, config: FormConfig): BaseFieldType | string; /** * Text Field Renderer * Handles text input with optional min/max length validation */ declare function TextField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Number Field Renderer * Handles numeric input with optional min/max and decimal places * Supports inline layout with item_code and badge */ declare function NumberField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Date Field Renderer * Handles date input with configurable display format * Supports paired fields for dual-column layouts */ declare function DateField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, paired_value, paired_on_change, paired_on_blur, paired_error, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Boolean Field Renderer * Handles boolean/checkbox input */ declare function BooleanField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Option Field Renderer * Handles select/dropdown input with predefined options */ declare function OptionField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Email Field Renderer * Handles email input with built-in validation */ declare function EmailField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Tel Field Renderer * Handles telephone number input */ declare function TelField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Currency Field Renderer * Handles currency input with formatting * Supports style_variant for hierarchical styling (total_h1, total_h2, etc.) */ declare function CurrencyField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, paired_value, paired_on_change, paired_on_blur, paired_error, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Percentage Field Renderer * Handles percentage input with formatting */ declare function PercentageField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, badge_column_width, value_column_width, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Textarea Field Renderer * Handles multi-line text input */ declare function TextareaField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Table Field Renderer * Handles array/table data with dynamic rows */ declare function TableField({ field, mode, value, error, config, on_change, on_doc_link_click, on_row_doc_link_click, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Computed Field Renderer * Displays a read-only computed value based on a formula */ declare function ComputedField({ field, mode, value, error, config, on_doc_link_click, field_uploads, on_upload_click, upload_enabled, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Static Text Field Renderer * Displays read-only static text content (instructions, notes, etc.) */ declare function StaticTextField({ field, config, }: FieldRendererProps): react_jsx_runtime.JSX.Element; /** * Summary Row Field Renderer * Displays a read-only summary/total row with special styling * Supports style_variant for hierarchical styling (total_h1, total_h2, etc.) */ declare function SummaryRowField({ field, value, config, on_doc_link_click, badge_column_width, value_column_width, }: FieldRendererProps): react_jsx_runtime.JSX.Element; interface MaskedFieldProps extends FieldRendererProps { /** Field type definition from form_field_types.json */ type_definition: FieldTypeDefinition; } /** * Masked Field Renderer * Generic renderer for pattern-based field types like TFN, ABN, phone numbers, etc. * Configuration is loaded from form_field_types.json */ declare function MaskedField({ field, mode, value, error, config, on_change, on_blur, on_doc_link_click, type_definition, }: MaskedFieldProps): react_jsx_runtime.JSX.Element; /** * Field Renderer Factory Component * Resolves the appropriate renderer based on field_type * * Resolution order: * 1. Check if field_type is defined in field_types_config (from form_field_types.json) * - If it has display_format, use MaskedField * - Otherwise, delegate to base_type renderer with enhanced props * 2. Fall back to directly registered renderers (built-in or legacy) */ declare function FieldRenderer(props: FieldRendererProps): react_jsx_runtime.JSX.Element; interface SubSectionRendererProps { sub_section: SubSection; mode: FormMode; config: FormConfig; show_header?: boolean; on_doc_link_click?: (field_id: string, doc_links: DocLink[], field_label?: string) => void; errors?: FormErrors; upload_enabled?: boolean; form_values?: FormValues; on_upload_click?: (field_id: string, field_label: string) => void; } /** * Sub-section Renderer * Renders a sub-section with its label and field group */ declare function SubSectionRenderer({ sub_section, mode, config, show_header, on_doc_link_click, errors, upload_enabled, form_values, on_upload_click, }: SubSectionRendererProps): react_jsx_runtime.JSX.Element; interface SectionRendererProps { section: FormSection; mode: FormMode; config: FormConfig; show_header?: boolean; show_sub_headers?: boolean; collapsible?: boolean; initially_collapsed?: boolean; on_doc_link_click?: (field_id: string, doc_links: DocLink[], field_label?: string) => void; errors?: FormErrors; upload_enabled?: boolean; form_values?: FormValues; on_upload_click?: (field_id: string, field_label: string, section_name?: string, sub_section_id?: string) => void; } /** * Section Renderer * Renders a top-level section with its sub-sections */ declare function SectionRenderer({ section, mode, config, show_header, show_sub_headers, collapsible, initially_collapsed, on_doc_link_click, errors, upload_enabled, form_values, on_upload_click, }: SectionRendererProps): react_jsx_runtime.JSX.Element; /** * FileManagerButton Component * Unified icon button that shows file count badge * Replaces both DocLinkButton and UploadIconButton */ declare function FileManagerButton({ file_count, has_files, on_click, config, class_name, tooltip_text, disabled, }: FileManagerButtonProps): react_jsx_runtime.JSX.Element; /** * FileManagerDialog Component * Dialog wrapper around FileManager for modal display */ declare function FileManagerDialog({ files, is_open, on_close, config, pdf_viewer_component, file_manager, pdf_save_path, upload_enabled, field_label, field_id, on_upload, on_delete, on_popout, class_name, title, enable_file_conversion, on_file_convert, logger, }: FileManagerDialogProps): react_jsx_runtime.JSX.Element; /** * FileList Component * Horizontal scrollable list of files with integrated dropzone functionality */ declare function FileList({ files, selected_index, on_select, on_delete, upload_enabled, show_add_button, config, on_files_dropped, drag_drop_enabled, accept_types, is_uploading, upload_progress, }: FileListProps): react_jsx_runtime.JSX.Element; /** * FileViewer Component * Displays preview for the selected file (PDF, image, or download prompt) */ declare function FileViewer({ file, config, pdf_viewer_component, file_manager, pdf_save_path, deletable, on_delete, enable_file_conversion, on_convert_to_pdf, logger, }: FileViewerProps): react_jsx_runtime.JSX.Element; interface UploadZoneProps$1 { config: FormConfig; existing_file_count: number; on_upload: (files: File[]) => Promise; on_upload_complete?: () => void; } /** * Drag-and-drop upload zone component */ declare function UploadZone$1({ config, existing_file_count, on_upload, on_upload_complete, }: UploadZoneProps$1): react_jsx_runtime.JSX.Element; /** * Props for the FileManagerPage component */ interface FileManagerPageProps { /** Storage key to read context from sessionStorage (default: "file_viewer_context") */ storage_key?: string; /** Or provide context directly instead of reading from storage */ context?: FileManagerPopoutContext; /** Config for styling */ config: FormConfig; /** PDF viewer component */ pdf_viewer_component?: React$1.ComponentType; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ pdf_save_path?: string; /** Callback when close button is clicked (default: window.close()) */ on_close?: () => void; /** Render prop for error state */ render_error?: (error: string) => React$1.ReactNode; /** Render prop for loading state */ render_loading?: () => React$1.ReactNode; /** Optional className for the container */ class_name?: string; } /** * FileManagerPage Component * Drop-in component for building file viewer popout pages. * Reads context from sessionStorage and renders the FileManager. * Consuming apps can wrap this with their own header/footer/navbar. */ declare function FileManagerPage({ storage_key, context: provided_context, config, pdf_viewer_component, file_manager, pdf_save_path, on_close, render_error, render_loading, class_name, }: FileManagerPageProps): react_jsx_runtime.JSX.Element; /** * FileManager Component * Main file management component that can render as sidebar OR dialog * Displays file list, upload zone, and file viewer */ declare function FileManager({ files, is_open, on_close, display_mode, config, pdf_viewer_component, file_manager, pdf_save_path, upload_enabled, field_label, field_id, on_upload, on_delete, on_popout, class_name, enable_file_conversion, on_file_convert, logger, }: FileManagerProps): react_jsx_runtime.JSX.Element | null; interface FileListItemProps { doc_link: DocLink; is_selected: boolean; on_click: () => void; config: FormConfig; /** Whether this file can be deleted */ deletable?: boolean; /** Callback when delete button is clicked */ on_delete?: () => void; /** Whether deletion is in progress */ delete_in_progress?: boolean; } /** * Individual file item in the file list * Displays as a clickable chip/tab with icon and filename */ declare function FileListItem({ doc_link, is_selected, on_click, deletable, on_delete, delete_in_progress, }: FileListItemProps): react_jsx_runtime.JSX.Element; interface NonPdfContentProps { doc_link: DocLink; filename: string; } /** * Content display for non-PDF files * Shows preview for images, download button for other types */ declare function NonPdfContent({ doc_link, filename }: NonPdfContentProps): react_jsx_runtime.JSX.Element; interface UploadZoneProps { config: FormConfig; existing_file_count: number; on_upload: (files: File[]) => Promise; on_upload_complete?: () => void; } /** * Drag-and-drop upload zone component */ declare function UploadZone({ config, existing_file_count, on_upload, on_upload_complete, }: UploadZoneProps): react_jsx_runtime.JSX.Element; interface DocPanelProps { /** Array of doc_links for the current field */ doc_links: DocLink[]; /** Whether panel is open */ is_open: boolean; /** Callback to close panel */ on_close: () => void; /** Config for styling */ config: FormConfig; /** Optional PDF viewer component (from hazo_pdf or custom) */ pdf_viewer_component?: React$1.ComponentType; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ pdf_save_path?: string; /** Optional className for the panel container */ class_name?: string; /** Enable upload UI mode */ upload_mode?: boolean; /** Field label for display in upload mode */ field_label?: string; /** Upload handler callback */ on_upload?: (files: File[]) => Promise; /** Delete handler callback */ on_delete?: (file_id: string) => Promise; } /** * Document Panel Component * Two-row layout: file list on top, viewer/download on bottom * In upload mode: adds upload zone and delete functionality */ declare function DocPanel({ doc_links, is_open, on_close, config, pdf_viewer_component, file_manager, pdf_save_path, class_name, upload_mode, field_label, on_upload, on_delete, }: DocPanelProps): react_jsx_runtime.JSX.Element | null; interface DocLinkButtonProps { doc_link: DocLink; on_click?: () => void; config: FormConfig; } /** * Doc Link Button * Clickable icon that triggers PDF panel open */ declare function DocLinkButton({ doc_link, on_click, config }: DocLinkButtonProps): react_jsx_runtime.JSX.Element; interface PdfPanelProps { /** Currently active doc_link */ doc_link: DocLink | null; /** Whether panel is open */ is_open: boolean; /** Callback to close panel */ on_close: () => void; /** Config for styling */ config: FormConfig; /** Optional PDF viewer component (from hazo_pdf or custom) */ pdf_viewer_component?: React$1.ComponentType; /** File manager instance for save/load operations */ file_manager?: FileManager$1; /** Path where PDFs should be saved */ pdf_save_path?: string; /** Optional className for the panel container */ class_name?: string; } /** * PDF Panel Component * @deprecated Use DocPanel instead. PdfPanel is kept for backward compatibility. * Wraps DocPanel to provide backward compatibility with single doc_link prop. */ declare function PdfPanel({ doc_link, is_open, on_close, config, pdf_viewer_component, file_manager, pdf_save_path, class_name, }: PdfPanelProps): react_jsx_runtime.JSX.Element; interface UploadIconButtonProps { /** Whether field has existing uploads */ has_uploads: boolean; /** Number of uploaded files */ upload_count: number; /** Click handler */ on_click: () => void; /** Configuration */ config: FormConfig; /** Additional class name */ class_name?: string; } /** * Upload icon button component * Shows upload icon when no files, doc-link style icon with count badge when files exist */ declare function UploadIconButton({ has_uploads, upload_count, on_click, config, class_name, }: UploadIconButtonProps): react_jsx_runtime.JSX.Element; interface FileUploadDialogProps { /** Whether dialog is open */ is_open: boolean; /** Callback when dialog closes */ on_close: () => void; /** Field ID being uploaded to */ field_id: string; /** Field label for display */ field_label: string; /** Existing uploads for this field */ existing_uploads: FieldUploads; /** Upload handler callback */ on_upload: (files: File[]) => Promise; /** Delete handler callback */ on_delete: (file_id: string) => Promise; /** View file callback */ on_view: (uploaded_file: UploadedFile) => void; /** Configuration */ config: FormConfig; } /** * File upload dialog component * Provides drag-and-drop and click-to-select file upload with file management * * @deprecated Use DocPanel with upload_mode=true instead. * The DocPanel provides integrated file management within the document viewer panel, * offering a more intuitive and streamlined user experience. * * Migration: * - Open DocPanel with upload_mode={true} instead of FileUploadDialog * - Pass field's uploaded files as doc_links using uploads_to_doc_links() * - Use on_upload and on_delete props on DocPanel */ declare function FileUploadDialog({ is_open, on_close, field_id, field_label, existing_uploads, on_upload, on_delete, on_view, config, }: FileUploadDialogProps): react_jsx_runtime.JSX.Element; /** * Load and merge form configuration from INI file, JSON configs, and overrides */ declare function useFormConfig(config_path?: string, config_override?: PartialFormConfig): FormConfig; /** * Get a single config value with type safety */ declare function useConfigValue(config: FormConfig, key: K): FormConfig[K]; /** * Style resolver for the new form_styles.json configuration system * Handles token substitution, inheritance resolution, and CSS conversion */ /** * Resolve token references in a value * e.g., "{colors.primary}" -> "#1e3a5f" * e.g., "{spacing.md}" -> "12px" */ declare function resolve_tokens(value: string | undefined, tokens: StyleTokens): string | undefined; /** * Resolve a style class with inheritance chain and token substitution * Uses memoization via the cache parameter for performance */ declare function resolve_style_class(class_name: string, styles_config: StylesConfig, cache?: Map): ResolvedStyle; /** * Convert ResolvedStyle to React inline style object */ declare function to_inline_style(resolved: ResolvedStyle): React.CSSProperties; /** * Get a specific style property value from a resolved style */ declare function get_style_value(resolved: ResolvedStyle, property: K): ResolvedStyle[K]; /** * Create a memoized style resolver for a given styles configuration * This is useful when you need to resolve multiple styles with the same config */ declare function create_style_resolver(styles_config: StylesConfig): { /** * Resolve a style class by name, returns ResolvedStyle */ resolve: (class_name: string) => ResolvedStyle; /** * Resolve a style class and convert to React inline style */ to_style: (class_name: string) => React.CSSProperties; /** * Get a specific property value from a style class */ get_value: (class_name: string, property: K) => ResolvedStyle[K]; /** * Resolve multiple style classes and merge them (later classes override earlier) */ merge: (...class_names: string[]) => ResolvedStyle; /** * Resolve multiple style classes and convert to React inline style */ merge_to_style: (...class_names: string[]) => React.CSSProperties; /** * Clear the resolution cache (useful if styles config changes) */ clear_cache: () => void; /** * Check if a style class exists in the configuration */ has_style: (class_name: string) => boolean; /** * Get all available style class names */ get_style_names: () => string[]; /** * Get the raw tokens from the config */ get_tokens: () => StyleTokens; /** * Resolve a single token value */ resolve_token: (token_path: string) => string | undefined; }; /** * Type for the style resolver returned by create_style_resolver */ type StyleResolver = ReturnType; /** * Helper to merge ResolvedStyle with inline style overrides */ declare function merge_with_overrides(resolved: ResolvedStyle, overrides: React.CSSProperties): React.CSSProperties; /** * Get legacy StyleLevelConfig from new StylesConfig * For backward compatibility with existing code */ declare function get_legacy_style_level(style_variant: string, styles_config: StylesConfig, cache?: Map): { font_size: string; font_weight: string; font_color: string; background_color: string; indent: string; }; /** * Merge Tailwind CSS classes with proper precedence */ declare function cn(...inputs: ClassValue[]): string; /** * Parse a boolean value from string */ declare function parse_boolean(value: string | undefined, default_value: boolean): boolean; /** * Parse a number value from string */ declare function parse_number(value: string | undefined, default_value: number): number; /** * Parse a string value with default */ declare function parse_string(value: string | undefined, default_value: string): string; /** * Format a number as currency */ declare function format_currency(value: number, symbol?: string, decimal_places?: number): string; /** * Format a number as percentage */ declare function format_percentage(value: number, decimal_places?: number, suffix?: string): string; /** * Format a date value for display */ declare function format_date(value: string | Date, format?: string): string; /** * Sanitize a filename for safe storage paths * Removes or replaces characters that are unsafe in file paths */ declare function sanitize_filename(filename: string): string; /** * Generate a unique ID */ declare function generate_id(): string; /** * Deep merge two objects */ declare function deep_merge>(target: T, source: Partial): T; /** * Safely evaluate a computed formula * Supports basic arithmetic operations and TABLE_SUM function for security * * Supported functions: * - TABLE_SUM(table_id, sum_column, filter_column, filter_value) * Sums values from a table column where another column matches a filter value */ declare function evaluate_formula(formula: string, values: Record): number | null; /** * Get the uploads key for a field ID * Uploads are stored with __uploads suffix in form values */ declare function get_uploads_key(field_id: string): string; /** * Extract uploads from form values for a field */ declare function get_field_uploads(values: FormValues, field_id: string): FieldUploads; /** * Check if field has uploads */ declare function has_field_uploads(values: FormValues, field_id: string): boolean; /** * Generate a unique file ID for uploads */ declare function generate_file_id(): string; /** * Format file size for display */ declare function format_file_size(bytes: number): string; /** * Check if a MIME type matches an allowed type pattern * Supports wildcards like "image/*" */ declare function is_mime_type_allowed(mime_type: string, allowed_types: string[]): boolean; /** * Extract filename from URL or path * @param url The URL or file path * @returns The filename, or "Document" if extraction fails */ declare function extract_filename_from_url(url: string): string; /** * Normalize doc_links to always return an array (handles undefined) */ declare function normalize_doc_links(doc_links?: DocLink[]): DocLink[]; /** * Infer DocLinkType from MIME type */ declare function infer_doc_link_type_from_mime(mime_type: string): DocLinkType; /** * Convert UploadedFile to DocLink for display in DocPanel */ declare function uploaded_file_to_doc_link(upload: UploadedFile): DocLink; /** * Convert array of UploadedFiles to DocLinks */ declare function uploads_to_doc_links(uploads: UploadedFile[]): DocLink[]; export { type BaseFieldType, BooleanField, CONVERTIBLE_MIME_TYPES, type ColumnHeader, ComputedField, CurrencyField, DEFAULT_FIELD_TYPES_CONFIG, DEFAULT_FORM_CONFIG, DEFAULT_STYLES_CONFIG, DateField, type DocLink, DocLinkButton, type DocLinkClickEvent, type DocLinkType, DocPanel, type DocPanelProps, EmailField, type FieldGroup, type FieldInfo, type FieldRenderer$1 as FieldRenderer, FieldRenderer as FieldRendererComponent, type FieldRendererProps, type FieldType, type FieldTypeDefinition, type FieldTypesConfig, type FieldUploads, type FileItem, FileList, FileListItem, FileManager, FileManagerButton, type FileManagerButtonProps, type FileManagerConfig, FileManagerDialog, type FileManagerDialogProps, type FileManagerDisplayMode, FileManagerPage, type FileManagerPageProps, type FileManagerPopoutContext, type FileManagerProps, UploadZone$1 as FileManagerUploadZone, type FileUploadConfig, FileUploadDialog, type FileUploadRequest, type FileUploadResult, FileViewer, type FormConfig, type FormErrors, type FormField, type FormMode, type FormSchema, type FormSection, type FormValues, type HazoConnectInstance, HazoDataForm, type HazoDataFormProps, type HazoPdfConversionUtils, type HazoPdfFileItem, type HazoPdfFileManagerDisplayMode, type HazoPdfPopoutContext, type HazoPdfUploadResult, type HazoServices, HazoServicesProvider, type HazoServicesProviderProps, type HelpTooltip, type HierarchicalStyleConfig, type LabelPosition, type Logger, MaskedField, NonPdfContent, NumberField, OptionField, type OptionItem, type PartialFormConfig, PdfPanel, type PdfPanelPosition, type PdfViewerProps, PercentageField, type ResolvedStyle, SectionRenderer, StaticTextField, type StyleClassDefinition, type StyleLevel, type StyleLevelConfig, type StyleResolver, type StyleTokens, type StyleVariant, type StylesConfig, type SubSection, SubSectionRenderer, SummaryRowField, type TableColumn, TableField, TelField, TextField, TextareaField, UploadIconButton, UploadZone, type UploadedFile, cn, create_style_resolver, deep_merge, doc_link_to_file_item, evaluate_formula, extract_filename_from_url, format_currency, format_date, format_file_size, format_percentage, generate_file_id, generate_id, get_base_field_type, get_field_renderer, get_field_uploads, get_hazo_pdf_conversion_utils, get_legacy_style_level, get_style_value, get_uploads_key, has_field_uploads, infer_doc_link_type_from_mime, is_hazo_pdf_available, is_masked_field_type, is_mime_type_allowed, is_potentially_convertible, merge_with_overrides, normalize_doc_links, parse_boolean, parse_number, parse_string, register_field_renderer, resolve_field_type, resolve_style_class, resolve_tokens, sanitize_filename, to_inline_style, uploaded_file_to_doc_link, uploads_to_doc_links, useConfigValue, useFormConfig, useHazoCustomService, useHazoDb, useHazoFileManager, useHazoLogger, useHazoServices };