UNPKG

@tripetto/block-checkboxes

Version:

Checkboxes block for Tripetto.

61 lines (60 loc) 2.15 kB
/** Dependencies */ import { NodeBlock, Slots, Value } from "@tripetto/runner"; import { ICheckbox } from "./checkbox"; export declare abstract class Checkboxes extends NodeBlock<{ readonly checkboxes?: ICheckbox[]; readonly min?: number; readonly max?: number; readonly required?: boolean; readonly randomize?: boolean; readonly formatSeparator?: | "comma" | "space" | "list" | "bullets" | "numbers" | "conjunction" | "disjunction" | "custom"; formatSeparatorCustom?: string; }> { /** Contains the randomized checkboxes order. */ private randomized?; /** Contains the counter slot. */ readonly counterSlot: Value<number, Slots.Number> | undefined; /** Contains the concatenation slot. */ readonly concatenationSlot: Value<string, Slots.Text> | undefined; /** Contains the score slot. */ readonly scoreSlot: Value<number, Slots.Numeric> | undefined; /** Retrieves if a checked checkbox is required. */ get required(): boolean; private transform; private score; /** Retrieves a checkbox slot. */ checkboxSlot( checkbox: Omit<ICheckbox, "name" | "value" | "description"> ): Value<boolean, Slots.Boolean> | undefined; /** Retrieves if a checkbox is checked. */ isChecked( checkbox: Omit<ICheckbox, "name" | "value" | "description"> ): boolean; /** Sets a checkbox state. */ check( checkbox: Omit<ICheckbox, "name" | "value" | "description">, checked: boolean ): boolean; /** Toggles a checkbox. */ toggle(checkbox: Omit<ICheckbox, "name" | "value" | "description">): void; /** Retrieves the checkboxes. */ checkboxes<T>(props: { readonly tabIndex?: number; readonly markdownifyToJSX: (md: string, lineBreaks?: boolean) => T; }): (Omit<ICheckbox, "name" | "value" | "description"> & { readonly label: T; readonly description?: T; readonly value?: Value<boolean, Slots.Boolean>; readonly tabIndex?: number; readonly disabled: boolean; })[]; validate(): boolean; }