/** * Translations. */ export type TranslationsType = { /** * The text in English. */ en?: string; /** * The text in Arabic. */ ar?: string; /** * The text in Bengali. */ bn?: string; /** * The text in German. */ de?: string; /** * The text in Spanish. */ es?: string; /** * The text in French. */ fr?: string; /** * The text in Japanese. */ ja?: string; /** * The text in Portuguese. */ pt?: string; /** * The text in Chinese. */ zh?: string; }; /** * Get the shared form field params. * * @param {Object} params * @param {string} formDelimiter * @returns {Array.} */ export function composeSharedFieldParams( params: any, formDelimiter: string, ): Array; /** * Get the id, CSS class names and other HTML attributes. * * @param {Object} params * @returns {Array.} */ export function composeAttrs(params: any): Array; /** * Translations. * * @typedef {Object} TranslationsType * @property {string} [en] The text in English. * @property {string} [ar] The text in Arabic. * @property {string} [bn] The text in Bengali. * @property {string} [de] The text in German. * @property {string} [es] The text in Spanish. * @property {string} [fr] The text in French. * @property {string} [ja] The text in Japanese. * @property {string} [pt] The text in Portuguese. * @property {string} [zh] The text in Chinese. */ /** * Given the localization and object of translations, get the localized string. * * @param {string} localization * @param {TranslationsType} translations * @returns {string} */ export function translate( localization: string, translations: TranslationsType, ): string; export class Composer { /** * The page or form settings. * * @typedef {Object} SettingsType * @property {"all-slides"} [autofocus] If set to `"all-slides"`, when a new slide becomes active (including the first slide on page load), the very first form field will be auto-focused. * @property {string} [accent] The primary color (must be HTML name, hex code, or RGB) used on buttons, form fields, etc. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {string} [accentForeground] The text color (must be HTML name, hex code, or RGB) used on `accent` background, for example, the text on buttons. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {string} [backdropOpacity] Sets an overlay of the `background-color` on top of the background image. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {string} [backgroundColor] The `background-color` of the page (must be HTML name, hex code, or RGB). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {string} [backgroundImage] The `background-image` of the page. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {string} [brand] An image of your logo added to the header of the page in the top-left corner (must be valid Markdown image). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {"center"|"end"|"stretch"} [buttonAlignment] Set the alignment of the slide CTA buttons. * @property {string} [color] The `color` of the text on the page (must be HTML name, hex code, or RGB). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). * @property {"light"|"dark"} [colorScheme] The default or initial color scheme of the page. Default is `"light"`. * @property {"domain-wide"|"isolate"} [colorSchemeScope] Determines how color scheme preference is saved and applied. Default is `"domain-wide"`. * @property {"show"} [colorSchemeToggle] If set to `"show"`, a toggle button will be available in the footer. * @property {string} [cssPrefix] Prefix added to all CSS classes. Default is `"fmd-"`. * @property {string} [cta] Adds a call to action link styled as a button on the header (must be valid Markdown link). * @property {"ltr"|"rtl"} [dir] The direction of the page's text. Default is `"ltr"`. * @property {string} [favicon] The favicon of the page. * @property {"sm"} [fieldSize] If set to `"sm"`, the size of form fields will be made smaller. * @property {string} [fontFamily] The `font-family` used on the page. * @property {string} [fontImportUrl] URL to import custom fonts (must be valid CSS for the `@import` property). * @property {"sm"|"lg"} [fontSize] Makes the `font-size` of everything on the page smaller or larger. * @property {string} [formDelimiter] Used to separate parameters when creating form fields. Default is `"|"`. * @property {"hide"|"show"} [formsmdBranding] Controls visibility of the Forms.md branding. * @property {"classic"} [formStyle] If set to `"classic"`, the form fields will have a classic appearance. * @property {"hide"|"show"} [footer] Controls visibility of the footer. * @property {"json"|"csv"|"tsv"} [getFormat] The format for reading data. Default is `"json"`. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). * @property {string} [getObjectsName] Name used for objects when reading data. Default is `"objects"`. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). * @property {string} [getUrl] URL for reading data. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). * @property {"hide"|"show"|"align"} [header] Controls header visibility and alignment. * @property {"anchored"} [headings] If set to `"anchored"`, all headings will contain an anchor link. * @property {string} [id] Identifier for the page or form. * @property {"classic"} [labelStyle] If set to `"classic"`, the question and description of form fields will be made smaller. * @property {keyof typeof translations} [localization] Sets the language for automatic translation. Default is `"en"`. * @property {string} [metaAuthor] Sets the author metadata. * @property {string} [metaDescription] Sets the description metadata. * @property {string} [metaImage] Sets the Open Graph image. * @property {string} [metaKeywords] Sets the keywords metadata. * @property {string} [metaType] Sets the Open Graph type. * @property {string} [metaUrl] Sets the Open Graph URL. * @property {"form-slides"|"slides"|"single"} [page] Determines the layout of the page. Default is `"form-slides"`. * @property {"hide"|"show"|"decorative"} [pageProgress] Controls visibility and function of the page progress. * @property {"hide"|"show"} [placeholders] Controls visibility of input placeholders. * @property {string} [postSheetName] When sending responses directly to Google Sheets, this specifies which sheet to save responses to. * @property {string} [postUrl] URL to send form responses to using POST request. * @property {"show"} [restartButton] If set to `"show"`, the restart button will be visible. * @property {"none"|"pill"} [rounded] Controls rounding of buttons and UI elements. * @property {"hide"|"show"} [slideControls] Controls visibility of next and previous buttons. * @property {string} [slideDelimiter] Specifies where new slides are created. Default is `"---"`. * @property {string} [submitButtonText] Custom text for submit buttons. * @property {string} [title] The title of the page. * @property {"start"} [verticalAlignment] If set to `"start"`, content is aligned to the top of the page vertically. */ /** * Create an instance of the class. * * @param {SettingsType} settings */ constructor(settings: { /** * If set to `"all-slides"`, when a new slide becomes active (including the first slide on page load), the very first form field will be auto-focused. */ autofocus?: "all-slides"; /** * The primary color (must be HTML name, hex code, or RGB) used on buttons, form fields, etc. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ accent?: string; /** * The text color (must be HTML name, hex code, or RGB) used on `accent` background, for example, the text on buttons. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ accentForeground?: string; /** * Sets an overlay of the `background-color` on top of the background image. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ backdropOpacity?: string; /** * The `background-color` of the page (must be HTML name, hex code, or RGB). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ backgroundColor?: string; /** * The `background-image` of the page. [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ backgroundImage?: string; /** * An image of your logo added to the header of the page in the top-left corner (must be valid Markdown image). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ brand?: string; /** * Set the alignment of the slide CTA buttons. */ buttonAlignment?: "center" | "end" | "stretch"; /** * The `color` of the text on the page (must be HTML name, hex code, or RGB). [Supports up to two values](https://formsmd.gitbook.io/docs/settings#different-values-for-light-mode-and-dark-mode). */ color?: string; /** * The default or initial color scheme of the page. Default is `"light"`. */ colorScheme?: "light" | "dark"; /** * Determines how color scheme preference is saved and applied. Default is `"domain-wide"`. */ colorSchemeScope?: "domain-wide" | "isolate"; /** * If set to `"show"`, a toggle button will be available in the footer. */ colorSchemeToggle?: "show"; /** * Prefix added to all CSS classes. Default is `"fmd-"`. */ cssPrefix?: string; /** * Adds a call to action link styled as a button on the header (must be valid Markdown link). */ cta?: string; /** * The direction of the page's text. Default is `"ltr"`. */ dir?: "ltr" | "rtl"; /** * The favicon of the page. */ favicon?: string; /** * If set to `"sm"`, the size of form fields will be made smaller. */ fieldSize?: "sm"; /** * The `font-family` used on the page. */ fontFamily?: string; /** * URL to import custom fonts (must be valid CSS for the `@import` property). */ fontImportUrl?: string; /** * Makes the `font-size` of everything on the page smaller or larger. */ fontSize?: "sm" | "lg"; /** * Used to separate parameters when creating form fields. Default is `"|"`. */ formDelimiter?: string; /** * Controls visibility of the Forms.md branding. */ formsmdBranding?: "hide" | "show"; /** * If set to `"classic"`, the form fields will have a classic appearance. */ formStyle?: "classic"; /** * Controls visibility of the footer. */ footer?: "hide" | "show"; /** * The format for reading data. Default is `"json"`. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). */ getFormat?: "json" | "csv" | "tsv"; /** * Name used for objects when reading data. Default is `"objects"`. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). */ getObjectsName?: string; /** * URL for reading data. [Read docs](https://formsmd.gitbook.io/docs/set-and-read-data). */ getUrl?: string; /** * Controls header visibility and alignment. */ header?: "hide" | "show" | "align"; /** * If set to `"anchored"`, all headings will contain an anchor link. */ headings?: "anchored"; /** * Identifier for the page or form. */ id?: string; /** * If set to `"classic"`, the question and description of form fields will be made smaller. */ labelStyle?: "classic"; /** * Sets the language for automatic translation. Default is `"en"`. */ localization?: keyof typeof translations; /** * Sets the author metadata. */ metaAuthor?: string; /** * Sets the description metadata. */ metaDescription?: string; /** * Sets the Open Graph image. */ metaImage?: string; /** * Sets the keywords metadata. */ metaKeywords?: string; /** * Sets the Open Graph type. */ metaType?: string; /** * Sets the Open Graph URL. */ metaUrl?: string; /** * Determines the layout of the page. Default is `"form-slides"`. */ page?: "form-slides" | "slides" | "single"; /** * Controls visibility and function of the page progress. */ pageProgress?: "hide" | "show" | "decorative"; /** * Controls visibility of input placeholders. */ placeholders?: "hide" | "show"; /** * When sending responses directly to Google Sheets, this specifies which sheet to save responses to. */ postSheetName?: string; /** * URL to send form responses to using POST request. */ postUrl?: string; /** * If set to `"show"`, the restart button will be visible. */ restartButton?: "show"; /** * Controls rounding of buttons and UI elements. */ rounded?: "none" | "pill"; /** * Controls visibility of next and previous buttons. */ slideControls?: "hide" | "show"; /** * Specifies where new slides are created. Default is `"---"`. */ slideDelimiter?: string; /** * Custom text for submit buttons. */ submitButtonText?: string; /** * The title of the page. */ title?: string; /** * If set to `"start"`, content is aligned to the top of the page vertically. */ verticalAlignment?: "start"; }); template: string; settings: {}; passedSettings: {}; /** * HTML attribute. * * @typedef {Object} HTMLAttributeType * @property {string} name The name of the attribute. * @property {string} value The value of the attribute. */ /** * Display condition. * * @typedef {Object} DisplayConditionType * @property {Array.} dependencies The names of the form fields or data to use in the condition. * @property {string} condition The actual condition. */ /** * Params shared between all form fields. * * @typedef {Object} FormFieldSharedParamsType * @property {string} question The main question of the form field. * @property {true} [required] When set, the field becomes required. * @property {string} [description] Any extra information that the user may need to fill out the form. * @property {"sm"} [fieldSize] When set to `"sm"`, the font sizes of the question, description, and answer are made smaller. * @property {"classic"} [labelStyle] When set to `"classic"`, the question and description of the form field are made smaller. * @property {true} [subfield] When set, the question and description of the form field are made smaller. * @property {true} [disabled] When set, the input is disabled. * @property {true} [autofocus] When set, the input will be automatically focused when the parent slide becomes active, or immediately after page load. * @property {string} [id] The id attribute of the form field. * @property {Array.} [classNames] The CSS class names of the form field. * @property {Array.} [attrs] Other HTML attributes of the form field. * @property {DisplayConditionType} [displayCondition] Display condition for the form field. */ /** * Text input params. * * @typedef {Object} TextInputParamsType * @property {string} [placeholder] Sets the `placeholder` attribute of the input. * @property {true} [multiline] When set, the input accepts values with one or more lines because the `