2
0

feat(inputs): Add Date input

This commit is contained in:
Baptiste Arnaud
2022-01-10 08:05:03 +01:00
parent ce1b23a0e7
commit 8cba7ff37b
21 changed files with 305 additions and 100 deletions

View File

@ -0,0 +1,2 @@
export * from './steps'
export * from './inputs'

View File

@ -1,36 +1,18 @@
export type Step = StartStep | BubbleStep | InputStep
export type BubbleStep = TextStep
import { StepBase } from './steps'
export type InputStep =
| TextInputStep
| NumberInputStep
| EmailInputStep
| UrlInputStep
export type StepType = 'start' | BubbleStepType | InputStepType
export enum BubbleStepType {
TEXT = 'text',
}
| DateInputStep
export enum InputStepType {
TEXT = 'text input',
NUMBER = 'number input',
EMAIL = 'email input',
URL = 'url input',
}
export type StepBase = { id: string; blockId: string; target?: Target }
export type StartStep = StepBase & {
type: 'start'
label: string
}
export type TextStep = StepBase & {
type: BubbleStepType.TEXT
content: { html: string; richText: unknown[]; plainText: string }
DATE = 'date input',
}
export type TextInputStep = StepBase & {
@ -53,6 +35,17 @@ export type UrlInputStep = StepBase & {
options?: UrlInputOptions
}
export type DateInputStep = StepBase & {
type: InputStepType.DATE
options?: DateInputOptions
}
export type DateInputOptions = {
labels?: { button?: string; from?: string; to?: string }
hasTime?: boolean
isRange?: boolean
}
export type EmailInputOptions = InputOptionsBase
export type UrlInputOptions = InputOptionsBase
@ -70,5 +63,3 @@ export type NumberInputOptions = InputOptionsBase & {
max?: number
step?: number
}
export type Target = { blockId: string; stepId?: string }

View File

@ -0,0 +1,25 @@
import { InputStep, InputStepType } from './inputs'
export type Step = StartStep | BubbleStep | InputStep
export type BubbleStep = TextStep
export type StepType = 'start' | BubbleStepType | InputStepType
export enum BubbleStepType {
TEXT = 'text',
}
export type StepBase = { id: string; blockId: string; target?: Target }
export type StartStep = StepBase & {
type: 'start'
label: string
}
export type TextStep = StepBase & {
type: BubbleStepType.TEXT
content: { html: string; richText: unknown[]; plainText: string }
}
export type Target = { blockId: string; stepId?: string }

View File

@ -1,7 +1,7 @@
import { Typebot as TypebotFromPrisma } from 'db'
import { Table } from '../utils'
import { Settings } from './settings'
import { Step } from './steps'
import { Step } from './steps/steps'
import { Theme } from './theme'
export type Typebot = Omit<