@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
49 lines (48 loc) • 2.04 kB
TypeScript
import { InputFileProps } from './InputFile';
export type InputFileLanguage = 'de' | 'en';
export type InputFileTranslations = typeof DS_INPUT_FILE_TRANSLATIONS_EN;
export declare const DS_INPUT_FILE_TRANSLATIONS_EN: {
dragAndDropInstructions: string;
feedbackFileSize: string;
feedbackFileType: string;
fileListRemoveSelectionButtonLabel: string;
fileListPreviewAltText: string;
filesSelectedHint: string;
required: string;
togglePopover: string;
};
export declare const DS_INPUT_FILE_TRANSLATIONS_DE: {
dragAndDropInstructions: string;
feedbackFileSize: string;
feedbackFileType: string;
fileListRemoveSelectionButtonLabel: string;
fileListPreviewAltText: string;
filesSelectedHint: string;
required: string;
togglePopover: string;
};
export declare const DS_INPUT_FILE_TRANSLATIONS: {
[key in InputFileLanguage]: InputFileTranslations;
};
/**
* @param file the File you just got from input.files[0]
* @param acceptAttr the literal string from your <input accept="…">
* @returns true if the file would have been allowed by the browser’s picker UI
*/
export declare const fileMatchesAccept: (file: File, acceptAttr: string) => boolean;
type ValidationProps = Pick<InputFileProps, 'id' | 'label' | 'inputFileButtonProps' | 'hideLabel' | 'popoverContent'>;
/**
* Validates the required props for the `DSInputFile` component.
*
* Ensures that:
* - A unique `id` is provided.
* - A `label` is provided for accessibility (a11y) reasons.
* - If `inputFileButtonProps` is provided, it must include a `label` for accessibility.
*
* Throws descriptive errors if any of the conditions are not met.
*
* @param {ValidationProps} params -The subset of DSInputFile properties to validate. This includes
* properties related to the prefix, suffix, icons and action button of the input.
*/
export declare const validateInputFileProps: ({ id, label, inputFileButtonProps, hideLabel, popoverContent, }: ValidationProps) => void;
export {};