@ooopenlab/quiz-form-fields
Version:
Form field type definitions and components for SuperQuiz modules
73 lines (67 loc) • 1.37 kB
text/typescript
// Canonical list of supported field type IDs used by ModalEditor/useFormFields
// Keep these in sync with components/FormFields/useFormFields baseEditors mapping
export const supportedFieldTypes = [
// structural helpers
'divider',
'collapse',
'tab',
// basic inputs/editors
'color',
'switch',
'image',
'imageWithToggle',
'imageInstantUpload',
'imageDragUpload',
'giphy',
'select',
'toggles',
'textarea',
'richtext',
'visualSelect',
'visualImageSelect',
'select-with-grid',
'gachaShellColors',
'choice',
'table',
'radio',
'checkbox',
'audio',
'file',
'privacy',
'custom-colors',
'orders',
'factor-grid',
'result',
'quiz-selector',
'canvas-size',
'coupon',
'cloudFont',
'description',
'div',
'rangeslide',
'button',
'grid',
'grid-boilerplate',
'questionCheckbox',
'title',
'openGraph',
'resultCheckbox',
'urlMode',
'quizSlug',
'inFrame',
'refLinks',
'slider',
'gachaManualPreview',
'gachaManualBanner',
'quickHelper',
'extentInput',
'paragraph',
'canva'
] as const;
export type FieldType = typeof supportedFieldTypes[number];
export function isFieldTypeSupported(x: string): x is FieldType {
return (supportedFieldTypes as readonly string[]).indexOf(x) !== -1;
}
export function listFieldTypes(): FieldType[] {
return [...supportedFieldTypes];
}