2023-03-02 11:03:01 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Tooltip directive provides advisory information for a component.
|
|
|
|
*
|
2023-03-03 14:17:03 +00:00
|
|
|
* [Live Demo](https://primevue.org/tooltip)
|
2023-03-02 14:25:05 +00:00
|
|
|
*
|
|
|
|
* @module tooltip
|
|
|
|
*
|
2023-03-02 11:03:01 +00:00
|
|
|
*/
|
2023-03-02 09:31:36 +00:00
|
|
|
import { DirectiveBinding, ObjectDirective } from 'vue';
|
2023-07-06 11:09:01 +00:00
|
|
|
import { DirectiveHooks } from '../basedirective';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { PassThrough } from '../ts-helpers';
|
2023-07-06 11:09:01 +00:00
|
|
|
|
2023-07-31 07:47:30 +00:00
|
|
|
export declare type TooltipDirectivePassThroughOptionType = TooltipDirectivePassThroughAttributes | ((options: TooltipPassThroughMethodOptions) => TooltipDirectivePassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface TooltipPassThroughMethodOptions {
|
|
|
|
context: TooltipContext;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-07-31 07:47:30 +00:00
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Defines options of Tooltip.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
export interface TooltipOptions {
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Text of the tooltip.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
value?: string | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When present, it specifies that the component should be disabled.
|
|
|
|
* @defaultValue false
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
disabled?: boolean | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When present, it adds a custom id to the tooltip.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
id?: string | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When present, it adds a custom class to the tooltip.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
class?: string | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-11-02 10:50:06 +00:00
|
|
|
* By default the tooltip contents are not rendered as text. Set to false to support html tags in the content.
|
|
|
|
* @defaultValue true
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
escape?: boolean | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Automatically adjusts the element position when there is not enough space on the selected position.
|
|
|
|
* @defaultValue true
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
fitContent?: boolean | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When present, it adds a custom delay to the tooltip's display.
|
|
|
|
* @defaultValue 0
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
showDelay?: number | undefined;
|
|
|
|
/**
|
|
|
|
* When present, it adds a custom delay to the tooltip's hiding.
|
|
|
|
* @defaultValue 0
|
|
|
|
*/
|
|
|
|
hideDelay?: number | undefined;
|
|
|
|
/**
|
2023-10-17 07:11:39 +00:00
|
|
|
* Whether to hide tooltip when hovering over tooltip content.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
2023-10-17 07:12:58 +00:00
|
|
|
autoHide?: boolean | undefined;
|
2023-10-17 07:11:39 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @type {TooltipDirectivePassThroughOptions}
|
2023-06-23 09:47:31 +00:00
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<TooltipDirectivePassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-07-06 10:11:23 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2023-06-21 13:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link TooltipOptions.pt}
|
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
export interface TooltipDirectivePassThroughOptions {
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
root?: TooltipDirectivePassThroughOptionType;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the text's DOM element.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
text?: TooltipDirectivePassThroughOptionType;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the arrow's DOM element.
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
arrow?: TooltipDirectivePassThroughOptionType;
|
|
|
|
/**
|
2023-11-07 06:16:39 +00:00
|
|
|
* Used to manage all lifecycle hooks.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseDirective.DirectiveHooks}
|
|
|
|
*/
|
|
|
|
hooks?: DirectiveHooks;
|
2023-06-21 13:58:32 +00:00
|
|
|
}
|
|
|
|
|
2023-03-02 10:54:16 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Custom passthrough attributes for each DOM elements
|
2023-03-02 10:54:16 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
export interface TooltipDirectivePassThroughAttributes {
|
|
|
|
[key: string]: any;
|
2023-06-23 09:47:31 +00:00
|
|
|
}
|
|
|
|
|
2023-07-31 07:47:30 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in Tooltip directive.
|
|
|
|
*/
|
|
|
|
export interface TooltipContext {
|
|
|
|
/**
|
|
|
|
* Current top position state as a boolean.
|
|
|
|
*/
|
|
|
|
top: boolean;
|
|
|
|
/**
|
|
|
|
* Current right position state as a boolean.
|
|
|
|
*/
|
|
|
|
right: boolean;
|
|
|
|
/**
|
|
|
|
* Current bottom position state as a boolean.
|
|
|
|
*/
|
|
|
|
bottom: boolean;
|
|
|
|
/**
|
|
|
|
* Current left position state as a boolean.
|
|
|
|
*/
|
|
|
|
left: boolean;
|
|
|
|
}
|
|
|
|
|
2023-06-23 09:47:31 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Defines modifiers of Tooltip.
|
2023-06-23 09:47:31 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
export interface TooltipDirectiveModifiers {
|
2023-04-09 15:11:41 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Right position for Tooltip.
|
|
|
|
* @defaultValue true
|
2023-04-09 15:11:41 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
right?: boolean | undefined;
|
2023-04-09 15:11:41 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Left position for Tooltip.
|
|
|
|
* @defaultValue false
|
2023-04-09 15:11:41 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
left?: boolean | undefined;
|
2023-06-21 13:58:32 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Top position for Tooltip.
|
|
|
|
* @defaultValue false
|
2023-06-21 13:58:32 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
top?: boolean | undefined;
|
2023-03-02 10:54:16 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Bottom position for Tooltip.
|
|
|
|
* @defaultValue false
|
2023-03-02 10:54:16 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
bottom?: boolean | undefined;
|
2023-03-02 10:54:16 +00:00
|
|
|
/**
|
2023-07-06 11:09:01 +00:00
|
|
|
* Focus event for Tooltip.
|
|
|
|
* @defaultValue true
|
2023-03-02 10:54:16 +00:00
|
|
|
*/
|
2023-07-06 11:09:01 +00:00
|
|
|
focus?: boolean | undefined;
|
2023-03-02 14:25:05 +00:00
|
|
|
}
|
2023-03-02 09:31:36 +00:00
|
|
|
|
2023-03-02 10:54:16 +00:00
|
|
|
/**
|
|
|
|
* Binding of Tooltip directive.
|
|
|
|
*/
|
2023-03-02 09:31:36 +00:00
|
|
|
export interface TooltipDirectiveBinding extends Omit<DirectiveBinding, 'modifiers' | 'value'> {
|
|
|
|
/**
|
2023-03-02 09:53:55 +00:00
|
|
|
* Value of the tooltip.
|
2023-03-02 09:31:36 +00:00
|
|
|
*/
|
2023-03-02 09:53:55 +00:00
|
|
|
value?: string | TooltipOptions | undefined;
|
2023-03-02 09:31:36 +00:00
|
|
|
/**
|
2023-03-02 09:53:55 +00:00
|
|
|
* Modifiers of the tooltip.
|
2023-03-02 09:31:36 +00:00
|
|
|
* @type {TooltipDirectiveModifiers}
|
|
|
|
*/
|
|
|
|
modifiers?: TooltipDirectiveModifiers | undefined;
|
2023-03-01 14:57:18 +00:00
|
|
|
}
|
|
|
|
|
2023-03-02 10:54:16 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Tooltip**
|
|
|
|
*
|
|
|
|
* _Tooltip directive provides advisory information for a component._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tooltip/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-02 10:54:16 +00:00
|
|
|
*
|
|
|
|
*/
|
2023-03-02 09:31:36 +00:00
|
|
|
declare const Tooltip: ObjectDirective;
|
|
|
|
|
2022-09-06 12:03:37 +00:00
|
|
|
export default Tooltip;
|