2
0

feat(inputs): Add number input

This commit is contained in:
Baptiste Arnaud
2022-01-08 07:40:55 +01:00
parent 2a040308db
commit d54ebc0cbe
33 changed files with 467 additions and 207 deletions

View File

@ -2,34 +2,53 @@ export type Step = StartStep | BubbleStep | InputStep
export type BubbleStep = TextStep
export type InputStep = TextInputStep
export type InputStep = TextInputStep | NumberInputStep
export enum StepType {
START = 'start',
export type StepType = 'start' | BubbleStepType | InputStepType
export enum BubbleStepType {
TEXT = 'text',
TEXT_INPUT = 'text input',
}
export enum InputStepType {
TEXT = 'text input',
NUMBER = 'number input',
}
export type StepBase = { id: string; blockId: string; target?: Target }
export type StartStep = StepBase & {
type: StepType.START
type: 'start'
label: string
}
export type TextStep = StepBase & {
type: StepType.TEXT
type: BubbleStepType.TEXT
content: { html: string; richText: unknown[]; plainText: string }
}
export type TextInputStep = StepBase & {
type: StepType.TEXT_INPUT
type: InputStepType.TEXT
options?: TextInputOptions
}
export type TextInputOptions = {
export type NumberInputStep = StepBase & {
type: InputStepType.NUMBER
options?: NumberInputOptions
}
type InputOptionsBase = {
labels?: { placeholder?: string; button?: string }
}
export type TextInputOptions = InputOptionsBase & {
isLong?: boolean
}
export type NumberInputOptions = InputOptionsBase & {
min?: number
max?: number
step?: number
}
export type Target = { blockId: string; stepId?: string }