UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

189 lines (188 loc) 12 kB
import { ContextState } from '../../DataContext/Context'; import { ContextProps } from '../../../../shared/Context'; import type { FieldProps } from '../../types'; import { FieldProviderProps } from './FieldProvider'; declare function useFieldProvider(props?: Omit<FieldProviderProps, 'children'>): { extend: <T extends FieldProps>(fieldProps: T) => T; inheritedProps: { space?: import("../../../../shared/types").SpaceTypeAll; left?: import("../../../../shared/types").SpaceType; right?: import("../../../../shared/types").SpaceType; label?: React.ReactNode; path?: import("../../types").Path; error?: import("../../types").ErrorProp<unknown>; 'aria-hidden'?: (boolean | "true" | "false") | undefined; value?: unknown; info?: import("../../types").InfoProp<unknown>; 'aria-labelledby'?: string | undefined; 'aria-describedby'?: string | undefined; 'aria-details'?: string | undefined; 'aria-disabled'?: (boolean | "true" | "false") | undefined; innerSpace?: import("../../../../shared/types").SpaceTypeAll | import("../../../../shared/types").SpaceTypeMedia; top?: import("../../../../shared/types").SpaceType; bottom?: import("../../../../shared/types").SpaceType; required?: boolean; defaultValue?: unknown; className?: string; id?: import("../../types").Identifier; placeholder?: React.ReactNode; 'aria-activedescendant'?: string | undefined; 'aria-atomic'?: (boolean | "true" | "false") | undefined; 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined; 'aria-braillelabel'?: string | undefined; 'aria-brailleroledescription'?: string | undefined; 'aria-busy'?: (boolean | "true" | "false") | undefined; 'aria-checked'?: boolean | "false" | "mixed" | "true" | undefined; 'aria-colcount'?: number | undefined; 'aria-colindex'?: number | undefined; 'aria-colindextext'?: string | undefined; 'aria-colspan'?: number | undefined; 'aria-controls'?: string | undefined; 'aria-current'?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; 'aria-description'?: string | undefined; 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; 'aria-errormessage'?: string | undefined; 'aria-expanded'?: (boolean | "true" | "false") | undefined; 'aria-flowto'?: string | undefined; 'aria-grabbed'?: (boolean | "true" | "false") | undefined; 'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; 'aria-keyshortcuts'?: string | undefined; 'aria-label'?: string | undefined; 'aria-level'?: number | undefined; 'aria-live'?: "off" | "assertive" | "polite" | undefined; 'aria-modal'?: (boolean | "true" | "false") | undefined; 'aria-multiline'?: (boolean | "true" | "false") | undefined; 'aria-multiselectable'?: (boolean | "true" | "false") | undefined; 'aria-orientation'?: "horizontal" | "vertical" | undefined; 'aria-owns'?: string | undefined; 'aria-placeholder'?: string | undefined; 'aria-posinset'?: number | undefined; 'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined; 'aria-readonly'?: (boolean | "true" | "false") | undefined; 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined; 'aria-required'?: (boolean | "true" | "false") | undefined; 'aria-roledescription'?: string | undefined; 'aria-rowcount'?: number | undefined; 'aria-rowindex'?: number | undefined; 'aria-rowindextext'?: string | undefined; 'aria-rowspan'?: number | undefined; 'aria-selected'?: (boolean | "true" | "false") | undefined; 'aria-setsize'?: number | undefined; 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined; 'aria-valuemax'?: number | undefined; 'aria-valuemin'?: number | undefined; 'aria-valuenow'?: number | undefined; 'aria-valuetext'?: string | undefined; onFocus?: (value: unknown, additionalArgs?: import("../../types").ProvideAdditionalEventArgs & { errorMessages: import("../../types").DefaultErrorMessages; connectWithPath: (path: import("../../types").Path) => { getValue: () => unknown; }; connectWithItemPath: (path: import("../../types").Path) => { getValue: () => unknown; }; getValueByPath: import("../../hooks/useDataValue").GetValueByPath<unknown>; getSourceValue: import("../../hooks/useDataValue").GetValueByPath<unknown>; setFieldEventListener: (path: import("../../types").Path, type: import("../../DataContext/Context").EventListenerCall["type"], callback: import("../../DataContext/Context").EventListenerCall["callback"]) => void; validators: Record<string, import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>>; props: import("../../types").UseFieldProps<unknown, unknown, import("../../types").DefaultErrorMessages, import("../../types").ProvideAdditionalEventArgs>; dataContext: ContextState; } & { pattern?: string; required?: string; }) => void; onBlur?: (value: unknown, additionalArgs?: import("../../types").ProvideAdditionalEventArgs & { errorMessages: import("../../types").DefaultErrorMessages; connectWithPath: (path: import("../../types").Path) => { getValue: () => unknown; }; connectWithItemPath: (path: import("../../types").Path) => { getValue: () => unknown; }; getValueByPath: import("../../hooks/useDataValue").GetValueByPath<unknown>; getSourceValue: import("../../hooks/useDataValue").GetValueByPath<unknown>; setFieldEventListener: (path: import("../../types").Path, type: import("../../DataContext/Context").EventListenerCall["type"], callback: import("../../DataContext/Context").EventListenerCall["callback"]) => void; validators: Record<string, import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>>; props: import("../../types").UseFieldProps<unknown, unknown, import("../../types").DefaultErrorMessages, import("../../types").ProvideAdditionalEventArgs>; dataContext: ContextState; } & { pattern?: string; required?: string; }) => void; onChange?: (value: unknown, additionalArgs?: import("../../types").ProvideAdditionalEventArgs & { errorMessages: import("../../types").DefaultErrorMessages; connectWithPath: (path: import("../../types").Path) => { getValue: () => unknown; }; connectWithItemPath: (path: import("../../types").Path) => { getValue: () => unknown; }; getValueByPath: import("../../hooks/useDataValue").GetValueByPath<unknown>; getSourceValue: import("../../hooks/useDataValue").GetValueByPath<unknown>; setFieldEventListener: (path: import("../../types").Path, type: import("../../DataContext/Context").EventListenerCall["type"], callback: import("../../DataContext/Context").EventListenerCall["callback"]) => void; validators: Record<string, import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>>; props: import("../../types").UseFieldProps<unknown, unknown, import("../../types").DefaultErrorMessages, import("../../types").ProvideAdditionalEventArgs>; dataContext: ContextState; } & { pattern?: string; required?: string; }) => void | import("../../types").EventReturnWithStateObjectAndSuccess | Promise<void | import("../../types").EventReturnWithStateObjectAndSuccess>; help?: import("../../../../components/help-button/HelpButtonInline").HelpProps; locale?: import("../../DataContext/Provider").Props<import("../..").JsonObject>["locale"]; layout?: "vertical" | "horizontal"; disabled?: boolean; props?: Record<string, unknown>; autoComplete?: HTMLInputElement["autocomplete"] | HTMLTextAreaElement["autocomplete"]; name?: string; readOnly?: boolean; width?: import("../../FieldBlock").FieldBlockWidth; translations?: import("../../DataContext/Provider").Props<import("../..").JsonObject>["translations"]; valueType?: string | number | boolean | Array<string | number | boolean>; labelSrOnly?: boolean; warning?: import("../../types").WarningProp<unknown>; htmlAttributes?: Record<string, unknown>; emptyValue?: unknown; validateInitially?: boolean; continuousValidation?: boolean; validateContinuously?: boolean; schema?: import("../../types").Schema<unknown> | ((props: import("../../types").UseFieldProps<unknown, unknown, import("../../types").DefaultErrorMessages, import("../../types").ProvideAdditionalEventArgs>) => import("../../types").Schema<unknown>); onStatusChange?: (status: import("../../types").FieldStatus) => void; validator?: import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>; onChangeValidator?: import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>; onBlurValidator?: import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>; exportValidators?: Record<string, import("../../types").Validator<unknown, import("../../types").DefaultErrorMessages>>; validateRequired?: (internal: unknown, { emptyValue, required, isChanged, error, }: { emptyValue: unknown; required: boolean; isChanged: boolean; error: import("../..").FormError | undefined; }) => import("../..").FormError | undefined; validateUnchanged?: boolean; errorMessages?: import("../../types").DefaultErrorMessages; transformIn?: (external: unknown) => unknown; transformOut?: (internal: unknown, additionalArgs?: unknown) => unknown; transformValue?: (value: unknown, currentValue?: unknown) => unknown; provideAdditionalArgs?: (value: unknown, additionalArgs?: import("../../types").ProvideAdditionalEventArgs) => import("../../types").ProvideAdditionalEventArgs; toInput?: (external: unknown | unknown) => unknown | unknown; toEvent?: (internal: unknown, type: "onChange" | "onFocus" | "onBlur" | "onBlurValidator") => unknown; fromInput?: (external: unknown | unknown) => unknown; fromExternal?: (external: unknown) => unknown; itemPath?: import("../../types").Path; layoutOptions?: { width?: import("../../FieldBlock").FieldBlockHorizontalLabelWidth; minWidth?: import("../../FieldBlock").FieldBlockHorizontalLabelWidth; maxWidth?: import("../../FieldBlock").FieldBlockHorizontalLabelWidth; }; labelSuffix?: React.ReactNode; labelDescription?: React.ReactNode; labelDescriptionInline?: boolean; labelSize?: "medium" | "large"; contentWidth?: import("../../FieldBlock").FieldBlockWidth; hideHelpButton?: boolean; statusPosition?: "below" | "above"; }; inheritedContext: FieldProps; sharedProviderParams: ContextProps; }; export default useFieldProvider;