Files
ipal-kit/src/modules/forms/index.ts
T

52 lines
3.2 KiB
TypeScript

// Files on panel forms (forms.attachments): checked, e-mailed, never stored.
export { fileFieldLimits, FORM_SUBMIT_PATH, getFormAttachments, resolveFormAttachments } from './attachments/config.js'
export type { FormAttachmentsOption, FormFileScanInput, FormFileScanResult, FormSubmitEndpointOptions, ResolvedFormAttachments } from './attachments/config.js'
export { canCarryFiles, fileNoticeText, fixedRecipients, mayCarryFiles } from './attachments/delivery.js'
export { buildFileBlock, fileBlock } from './attachments/fileBlock.js'
export type { AcceptedFormFile, FormFileFailure } from './attachments/fileGate.js'
export { DEFAULT_FORM_FILE_TYPES, describeFileTypes, FORM_FILE_TYPES, formatFileSize, RISKY_FILE_EXTENSIONS, safeFileName } from './attachments/fileTypes.js'
export type { FormFileDetect, FormFileType } from './attachments/fileTypes.js'
// Panel field types: step-by-step forms + multiple choice (enabled by default).
export { checkboxGroupBlock, placeholderField, stepBlock, timeBlock, withPlaceholder } from './builderBlocks.js'
// Pure panel-form logic (steps, values, validation) — the engine of useBuilderForm.
export { fileFieldError, fileFieldRules, initialBuilderValues, inputFields, splitSteps, stepOfField, validateBuilderFields, visibleFields } from './builderLogic.js'
export type { BuilderFile } from './builderLogic.js'
export type { BuilderField, BuilderFileLimits, BuilderFormDoc, BuilderFormTexts, BuilderStep, FieldCondition } from './builderTypes.js'
export { formAnalyticsOnSuccess } from './formAnalytics.js'
export type { FormAnalyticsConfig } from './formAnalytics.js'
// Panel-managed form analytics: fields (config-time) + onSuccess helper (client).
export { buildFormAnalyticsFields } from './formAnalyticsFields.js'
// buildFormsPlugin is config-time (safe anywhere). submitForm is server-only
// (Turnstile secret) — never import it from a client component.
export { buildFormsPlugin } from './formsPluginConfig.js'
// Honeypot anti-spam (pure — client renders the input, server checks it).
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './honeypot.js'
export { checkRateLimit } from './rateLimit.js'
export type { RateLimitArgs } from './rateLimit.js'
export { submitForm } from './submitForm.js'
export type { SubmitFormArgs, SubmitFormResult } from './submitForm.js'
export type { FormsCollectionOverrides, FormsFieldsOverride, FormsOption } from './types.js'
export { useContactForm } from './useContactForm.js'
export type { ContactFormErrors, ContactFormValues, SubmitAction } from './useContactForm.js'
// Generic form engine (any field set) + the standard contact-form preset.
export { useForm } from './useForm.js'
export type { FormErrors, FormSubmitAction, Validator } from './useForm.js'
export { validateSubmission } from './validateSubmission.js'
export type { FormValidationResult } from './validateSubmission.js'
// Composable validation rules (pure — safe on server or client).
export {
buildValidator,
checked,
custom,
email,
isEmail,
localizedRules,
maxLength,
minLength,
pattern,
required,
VALIDATION_MESSAGES,
validationMessages,
} from './validators.js'
export type { Rule, ValidationMessages } from './validators.js'