feat(inputs): ✨ Add number input
This commit is contained in:
@ -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 }
|
||||
|
Reference in New Issue
Block a user