import { TaskStatus } from '../../utils/common/task-statuses.enum'; import { Hint } from '../../utils/common/common.interface'; import { Language } from '../../utils/common/language-types'; import { HeadingLevel } from '../../utils/common/common.interface'; import { HeaderLanguageToggleEventDetails } from '../../utils/events/common-events.interface'; export type TaskHeadingLevel = Extract; /** * Ontario Task represents an individual task item and status within a task list. * * For component guidance, see: * - https://designsystem.ontario.ca/components/detail/task-list.html * - https://designsystem.ontario.ca/developer-docs/components/ontario-task/ */ export declare class OntarioTask { el: HTMLElement; hintTextRef?: HTMLOntarioHintTextElement | undefined; /** * Specifies the label of the task. * * This is required to provide the name of the task. */ label: string; /** * A unique id for the task. * * This is required. */ taskId: string; /** * Specifies an optional link associated with the task. * * If provided, clicking the task will navigate to this URL. */ link?: string; /** * Disables the task link when set to `true`. * * Default is `false`, meaning the link will be active if provided. */ deactivateLink: boolean; /** * The language of the component. * * This is used for translations, and is by default set through event listeners checking for a language property from the header. If no language is passed, it will default to English. */ language?: Language; /** * Used to include the ontario-hint-text component for the task. * * This is optional. */ hintText?: string | Hint; /** * Defines the status of the task. * * Falls back to the default status if not provided, or if an unrecognized value is passed. */ taskStatus: TaskStatus; /** * Allows consumers to define the heading level for the task label. * * Accepts 'h2', 'h3' or 'h4'. Default is 'h3'. */ headingLevel: TaskHeadingLevel; /** * The hint text options are re-assigned to the internalHintText state. */ private internalHintText; /** * Mutable variable, for internal use only. * * Set the task's status state depending on validation result. */ private taskStatusState; /** * Watch for changes in `headingLevel` prop to validate its value. */ validateHeadingLevel(newValue: string): void; /** * Watch for changes in `hintText` prop and parse it if available. * * If a `hintText` prop is passed, the `constructHintTextObject` function will convert it to the correct format, * and the result will be stored in the `internalHintText` state. */ private parseHintText; /** * Watch for changes in `taskStatus` prop to validate its value. */ validateTaskStatus(newValue: TaskStatus): void; /** * Listen for app language settings on the window to update the component language. */ handleSetAppLanguage(event: CustomEvent): void; /** * Handles an update to the language should the user request a language update from the language toggle. * @param {CustomEvent} - The language that has been selected. */ handleHeaderLanguageToggled(event: CustomEvent): void; /** * Determines the badge colour based on the current `taskStatusState`. * * @returns {TaskBadgeColour} */ private getBadgeColour; /** * Provides a translated task status string based on the current language. */ private getTranslatedTaskStatus; /** * Renders hint text if available. */ private renderHintText; /** * Returns the class name(s) for the task label. */ private getClass; /** * Logs a warning to the console if the `taskStatus` prop is set to an invalid value. * * This function informs developers that the provided `taskStatus` is not recognized * and resets the status to the default value of `'notStarted'`. The warning message * specifies the valid task statuses to help guide correct usage. * * @returns The default task status `'notStarted'`. */ private warnAndGetDefaultTaskStatus; /** * Renders the task label and status content. * * This includes dynamically rendering the heading element (h2, h3, or h4) based on the `headingLevel` prop, * as well as the badge indicating the task status. */ private renderTaskContent; /** * After the component loads, retrieve the hint text ID (if available) from the hintText component, * and set it for the `aria-describedby` attribute. */ componentDidLoad(): Promise; /** * Lifecycle method: before the component loads, parse the hint text and * validate language and task status and heading level. */ componentWillLoad(): Promise; render(): any; }