add inputmode to string and number

This commit is contained in:
Matt Hill
2023-03-30 11:55:37 -06:00
parent 3e708ab796
commit ae22958556

View File

@@ -38,26 +38,26 @@ export type ValueSpecOf<T extends ValueType> = T extends "string"
export interface ValueSpecString extends ListValueSpecString, WithStandalone { export interface ValueSpecString extends ListValueSpecString, WithStandalone {
type: "string"; type: "string";
default: null | DefaultString; default: DefaultString | null;
nullable: boolean; nullable: boolean;
} }
export interface ValueSpecTextarea extends WithStandalone { export interface ValueSpecTextarea extends WithStandalone {
type: "textarea"; type: "textarea";
placeholder: null | string; placeholder: string | null;
nullable: boolean; nullable: boolean;
} }
export interface ValueSpecNumber extends ListValueSpecNumber, WithStandalone { export interface ValueSpecNumber extends ListValueSpecNumber, WithStandalone {
type: "number"; type: "number";
nullable: boolean; nullable: boolean;
default: null | number; default: number | null;
} }
export interface ValueSpecSelect extends SelectBase, WithStandalone { export interface ValueSpecSelect extends SelectBase, WithStandalone {
type: "select"; type: "select";
nullable: boolean; nullable: boolean;
default: null | string; default: string | null;
} }
export interface ValueSpecMultiselect extends SelectBase, WithStandalone { export interface ValueSpecMultiselect extends SelectBase, WithStandalone {
@@ -69,13 +69,13 @@ export interface ValueSpecMultiselect extends SelectBase, WithStandalone {
export interface ValueSpecBoolean extends WithStandalone { export interface ValueSpecBoolean extends WithStandalone {
type: "boolean"; type: "boolean";
default: null | boolean; default: boolean | null;
} }
export interface ValueSpecUnion extends WithStandalone { export interface ValueSpecUnion extends WithStandalone {
type: "union"; type: "union";
nullable: boolean; nullable: boolean;
default: null | string; default: string | null;
variants: Record<string, { name: string; spec: InputSpec }>; variants: Record<string, { name: string; spec: InputSpec }>;
} }
@@ -92,8 +92,8 @@ export interface ValueSpecObject extends WithStandalone {
export interface WithStandalone { export interface WithStandalone {
name: string; name: string;
description: null | string; description: string | null;
warning: null | string; warning: string | null;
} }
export interface SelectBase { export interface SelectBase {
@@ -139,18 +139,20 @@ export function isValueSpecListOf<S extends ListValueSpecType>(
} }
export interface ListValueSpecString { export interface ListValueSpecString {
pattern: null | string; pattern: string | null;
patternDescription: null | string; patternDescription: string | null;
masked: boolean; masked: boolean;
placeholder: null | string; inputmode: 'text' | 'email' | 'tel' | 'url'
placeholder: string | null;
} }
export interface ListValueSpecNumber { export interface ListValueSpecNumber {
/** '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules */ /** '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules */
range: string; range: string;
integral: boolean; integral: boolean; // default = false
units: null | string; units: string | null;
placeholder: null | string; inputmode: 'numeric' | 'decimal' // default = 'decimal'
placeholder: string | null;
} }
export interface ListValueSpecObject { export interface ListValueSpecObject {
@@ -159,7 +161,7 @@ export interface ListValueSpecObject {
/** indicates whether duplicates can be permitted in the list */ /** indicates whether duplicates can be permitted in the list */
uniqueBy: UniqueBy; uniqueBy: UniqueBy;
/** this should be a handlebars template which can make use of the entire config which corresponds to 'spec' */ /** this should be a handlebars template which can make use of the entire config which corresponds to 'spec' */
displayAs: null | string; displayAs: string | null;
} }
export type UniqueBy = export type UniqueBy =