mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
f78972ee09
* Add custom item * Remove customcontent parameter from popover * Tests * Cleanup * Cleanup * Lint * Cleanup * Rename custom to html, add enum with item types * Fix tests * Add order test * Update jsdoc * Update changelog * Fix issue with html item not hiding on search * Fix flipper issue * Update changelog
97 lines
1.8 KiB
TypeScript
97 lines
1.8 KiB
TypeScript
import { PopoverItemParams } from '../../../../types';
|
|
|
|
/**
|
|
* Params required to render popover
|
|
*/
|
|
export interface PopoverParams {
|
|
/**
|
|
* Popover items config
|
|
*/
|
|
items: PopoverItemParams[];
|
|
|
|
/**
|
|
* Element of the page that creates 'scope' of the popover.
|
|
* Depending on its size popover position will be calculated
|
|
*/
|
|
scopeElement?: HTMLElement;
|
|
|
|
/**
|
|
* True if popover should contain search field
|
|
*/
|
|
searchable?: boolean;
|
|
|
|
/**
|
|
* Popover texts overrides
|
|
*/
|
|
messages?: PopoverMessages
|
|
|
|
/**
|
|
* CSS class name for popover root element
|
|
*/
|
|
class?: string;
|
|
|
|
/**
|
|
* Popover nesting level. 0 value means that it is a root popover
|
|
*/
|
|
nestingLevel?: number;
|
|
}
|
|
|
|
/**
|
|
* Texts used inside popover
|
|
*/
|
|
export interface PopoverMessages {
|
|
/** Text displayed when search has no results */
|
|
nothingFound?: string;
|
|
|
|
/** Search input label */
|
|
search?: string
|
|
}
|
|
|
|
/**
|
|
* Event that can be triggered by the Popover
|
|
*/
|
|
export enum PopoverEvent {
|
|
/**
|
|
* When popover closes
|
|
*/
|
|
Close = 'close'
|
|
}
|
|
|
|
/**
|
|
* Events fired by the Popover
|
|
*/
|
|
export interface PopoverEventMap {
|
|
/**
|
|
* Fired when popover closes
|
|
*/
|
|
[PopoverEvent.Close]: undefined;
|
|
}
|
|
|
|
/**
|
|
* HTML elements required to display popover
|
|
*/
|
|
export interface PopoverNodes {
|
|
/** Root popover element */
|
|
popover: HTMLElement;
|
|
|
|
/** Wraps all the visible popover elements, has background and rounded corners */
|
|
popoverContainer: HTMLElement;
|
|
|
|
/** Message displayed when no items found while searching */
|
|
nothingFoundMessage: HTMLElement;
|
|
|
|
/** Popover items wrapper */
|
|
items: HTMLElement;
|
|
}
|
|
|
|
/**
|
|
* HTML elements required to display mobile popover
|
|
*/
|
|
export interface PopoverMobileNodes extends PopoverNodes {
|
|
/** Popover header element */
|
|
header: HTMLElement;
|
|
|
|
/** Overlay, displayed under popover on mobile */
|
|
overlay: HTMLElement;
|
|
}
|