UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

34 lines (33 loc) 1.65 kB
import type { RefObject } from 'react'; import type { OverwriteMode, SectionSelectionMode, SegmentedFieldInputConfig } from './types'; export declare function getDisplayValue({ value, placeholder, length, }: { value: string; placeholder: string; length: number; }): string; export declare function insertChar(value: string, char: string, position: number, { overwriteMode, maxLength, }: { overwriteMode: OverwriteMode; maxLength: number; }): string; export declare function removeChar(value: string, position: number): string; export declare function extractValidChars(value: string, mask: RegExp[]): string; export declare function joinValues(values: Record<string, string>, delimiter?: string): string; export declare function distributeValueFromStart({ value, inputs, existingValues, }: { value: string; inputs: SegmentedFieldInputConfig[]; existingValues: Record<string, string>; }): { [x: string]: string; }; export declare function insertCharIntoSection({ char, inputId, overwriteMode, valuesRef, inputs, caretPositionsRef, sectionSelectionModeRef, onChange, focusSection, setSectionCaret, }: { char: string; inputId: string; overwriteMode: OverwriteMode; valuesRef: RefObject<Record<string, string>>; inputs: SegmentedFieldInputConfig[]; caretPositionsRef: RefObject<Record<string, number>>; sectionSelectionModeRef: RefObject<Record<string, SectionSelectionMode>>; onChange: (inputId: string, value: string) => void; focusSection: (inputId: string, mode: 'all' | 'start' | 'end') => void; setSectionCaret: (inputId: string, position: number) => void; }): boolean;