UNPKG

@oslokommune/punkt-react

Version:

React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo

17 lines (16 loc) 744 B
import { RefObject } from 'react'; /** * When `uploadStrategy="custom"` and the upload is marked `required`, the * native `required` attribute can't do the work (the input isn't posted). * This hook attaches a submit listener to the containing `<form>` that * prevents submission if the queue is empty, and surfaces a validation * error via `onMissingFiles`. * * Passive in `form` strategy — native validation handles that case. */ export declare const useRequiredFormValidation: (fileInputRef: RefObject<HTMLInputElement | null>, { uploadStrategy, required, currentFileCount, onMissingFiles, }: { uploadStrategy: "form" | "custom"; required: boolean; currentFileCount: number; onMissingFiles: () => void; }) => void;