import { JSXInterface } from '../jsx'; import { CSSResultGroup, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core'; import '../checkbox/index.js'; import '../icon/index.js'; import type { ItemData, ItemDivider, ItemHeader, ItemText, ItemType } from './helpers/types'; export type { ItemType, ItemText, ItemHeader, ItemDivider, ItemData }; /** * Used as a basic building block to compose complex custom elements, * additionally it can be used by applications * to create simple menus or navigation panels. * * @attr {string} value - The content of this attribute represents the value of the item. * @prop {string} [value=""] - The content of this attribute represents the value of the item. * * @attr {boolean} disabled - Set disabled state. * @prop {boolean} [disabled=false] - Set disabled state. * * @slot left - Used to render the content on the left of the label. * @slot right - Used to render the content on the right of the label. */ export declare class Item extends ControlElement { /** * Element version number * @returns version number */ static get version(): string; /** * `CSSResultGroup` that will be used to style the host, * slotted children and the internal template of the element. * @returns CSS template */ static get styles(): CSSResultGroup; /** * The text for the label indicating the meaning of the item. * By having both `label` and content, content always takes priority */ label: string | null; /** * If defined value can be `text`, `header` or `divider` * @type {ItemType | null} */ type: ItemType | null; /** * Set the icon name from the ef-icon list */ icon: string | null; /** * Indicates that the item is selected */ selected: boolean; /** * Is the item part of a multiple selection */ multiple: boolean; /** * Highlight the item */ highlighted: boolean; /** * The`subLabel` property represents the text beneath the label. * By having both `subLabel` and content, content always takes priority */ subLabel: string | null; /** * Specifies which element an item is bound to */ for: string | null; /** * Reference to the label element */ private labelRef; /** * Reference to the subLabel element */ private subLabelRef; /** * Reference to the slot element */ private slotRef; /** * True, if there is no slotted content */ private isSlotEmpty; /** * @param node that should be checked * @returns whether node can be ignored. */ private isIgnorable; /** * Checks slotted children nodes and updates component to refresh label and sub-label templates. * @param event slotchange * @returns {void} */ private checkSlotChildren; /** * Handles aria-selected or aria-checked when toggle between single and multiple selection mode * @returns {void} **/ private multipleChanged; /** * Handles aria when selected state changes * @returns {void} */ private selectedChanged; /** * Control State behaviour will update tabindex based on the property * @returns {void} */ private typeChanged; /** * Called after the component is first rendered * @param changedProperties Properties which have changed * @returns {void} */ protected firstUpdated(changedProperties: PropertyValues): void; /** * Invoked before update() to compute values needed during the update. * @param changedProperties changed properties * @returns {void} */ protected willUpdate(changedProperties: PropertyValues): void; /** * Get Item content * @returns return item content from slot or label and sub-label */ private getItemContent; /** * Get element overflown * @param element Target element * @returns return true if element is overflown. */ private isItemElementOverflown; /** * Get item overflown * @returns return true if an item is overflown. */ private isItemOverflown; /** * Get icon template if icon attribute is defined */ private get iconTemplate(); /** * Get subLabel template if it is defined and no slot content present */ private get subLabelTemplate(); /** * Get label template if it is defined and no slot content present */ private get labelTemplate(); /** * Get slot content */ private get slotContent(); /** * Get template for `for` attribute. * This is usually used with menus when an item needs to reference an element */ private get forTemplate(); /** * Get template for `multiple` attribute. * This is usually used with lists, when an item can be part of a multiple selection */ private get multipleTemplate(); /** * Return true if the item can be highlighted. True if not disabled and type is Text * @prop {boolean} highlightable * @default true * @returns whether element is highlightable */ get highlightable(): boolean; /** * A `TemplateResult` that will be used * to render the updated internal template. * @returns Render template */ protected render(): TemplateResult; } declare global { interface HTMLElementTagNameMap { 'ef-item': Item; } } declare global { interface HTMLElementTagNameMap { 'ef-item': Item; } namespace JSX { interface IntrinsicElements { 'ef-item': Partial | JSXInterface.ControlHTMLAttributes; } } } export {};