UNPKG

@kform/react

Version:

React integration for KForm.

53 lines (52 loc) 2.44 kB
import { BigDecimal, BigInteger, Char, Schema } from "@kform/core"; /** Minimum Kotlin `Byte` value. */ export declare const BYTE_MIN_VALUE = -128; /** Maximum Kotlin `Byte` value. */ export declare const BYTE_MAX_VALUE = 127; /** Minimum Kotlin {@link Char} value. */ export declare const CHAR_MIN_VALUE: Char; /** Maximum Kotlin {@link Char} value. */ export declare const CHAR_MAX_VALUE: Char; /** Minimum Kotlin `Short` value. */ export declare const SHORT_MIN_VALUE = -32768; /** Maximum Kotlin `Short` value. */ export declare const SHORT_MAX_VALUE = 32767; /** Minimum Kotlin `Int` value. */ export declare const INT_MIN_VALUE = -2147483648; /** Maximum Kotlin `Int` value. */ export declare const INT_MAX_VALUE = 2147483647; /** Minimum Kotlin `Long` value. */ export declare const LONG_MIN_VALUE = -9223372036854775808n; /** Maximum Kotlin `Long` value. */ export declare const LONG_MAX_VALUE = 9223372036854775807n; /** Supported numeric types. */ export type Numeric = number | bigint | Char | BigInteger | BigDecimal | string; /** * Formats a numeric {@link value} as a string, given its {@link schema}. * * @param value Numeric value to format as a string. * @param schema Schema of the numeric {@link value}. * @returns String representation of the numeric {@link value}. */ export declare function formatNumericAsString<T extends Numeric | null = Numeric | null>(value: T | undefined, schema: Schema<T>): string; /** * Parses a formatted numeric [value]{@link formattedValue} as a numeric value, * given the {@link schema} of the expected numeric value. * * @param formattedValue Formatted value to parse as a numeric value. * @param schema Schema of the expected numeric value. * @returns Numeric representation of the [formatted value]{@link formattedValue} * according to {@link schema}. */ export declare function parseStringAsNumeric<T extends Numeric | null = Numeric | null>(formattedValue: string, schema: Schema<T>): T; /** * Returns the minimum and maximum numeric values supported by the given numeric * {@link schema}, or `undefined` if there are no such limits. * * @param schema Numeric schema for which to get mininum/maximum values. * @returns Minimum/maximum supported numeric value of {@link schema}. */ export declare function numericTypeMinMax<T extends Numeric | null = Numeric | null>(schema: Schema<T>): { min: NonNullable<T> | undefined; max: NonNullable<T> | undefined; };