31 lines
839 B
TypeScript
31 lines
839 B
TypeScript
import {
|
|
NumberField,
|
|
type NumberFieldProps,
|
|
numberFieldVariants,
|
|
} from "../../packages/vue/src";
|
|
const valid: NumberFieldProps = {
|
|
modelValue: null,
|
|
defaultValue: 2,
|
|
minValue: 0,
|
|
maxValue: 10,
|
|
step: 0.1,
|
|
locale: "de-DE",
|
|
variant: "secondary",
|
|
validationBehavior: "aria",
|
|
validate: (value) => (value === null ? "Required" : true),
|
|
};
|
|
// @ts-expect-error public value is numeric, not a localized display string
|
|
const invalidValue: NumberFieldProps = { modelValue: "1.234,5" };
|
|
// @ts-expect-error unsupported variant
|
|
const invalidVariant: NumberFieldProps = { variant: "ghost" };
|
|
// @ts-expect-error no async validation protocol
|
|
const invalidValidator: NumberFieldProps = { validate: async () => true };
|
|
void [
|
|
NumberField,
|
|
valid,
|
|
invalidValue,
|
|
invalidVariant,
|
|
invalidValidator,
|
|
numberFieldVariants,
|
|
];
|