@ -0,0 +1,6 @@
|
||||
import { defaultButtonLabel } from '../constants'
|
||||
import { NumberInputBlock } from './schema'
|
||||
|
||||
export const defaultNumberInputOptions = {
|
||||
labels: { button: defaultButtonLabel, placeholder: 'Type a number...' },
|
||||
} as const satisfies NumberInputBlock['options']
|
1
packages/schemas/features/blocks/inputs/number/index.ts
Normal file
1
packages/schemas/features/blocks/inputs/number/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './schema'
|
24
packages/schemas/features/blocks/inputs/number/schema.ts
Normal file
24
packages/schemas/features/blocks/inputs/number/schema.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { z } from 'zod'
|
||||
import { variableStringSchema } from '../../../utils'
|
||||
import { optionBaseSchema, blockBaseSchema } from '../../shared'
|
||||
import { InputBlockType } from '../constants'
|
||||
import { textInputOptionsBaseSchema } from '../text'
|
||||
|
||||
export const numberInputOptionsSchema = optionBaseSchema
|
||||
.merge(textInputOptionsBaseSchema)
|
||||
.merge(
|
||||
z.object({
|
||||
min: z.number().or(variableStringSchema).optional(),
|
||||
max: z.number().or(variableStringSchema).optional(),
|
||||
step: z.number().or(variableStringSchema).optional(),
|
||||
})
|
||||
)
|
||||
|
||||
export const numberInputSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([InputBlockType.NUMBER]),
|
||||
options: numberInputOptionsSchema.optional(),
|
||||
})
|
||||
)
|
||||
|
||||
export type NumberInputBlock = z.infer<typeof numberInputSchema>
|
Reference in New Issue
Block a user