2023-03-02 11:35:08 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Focus Trap keeps focus within a certain DOM element while tabbing.
|
|
|
|
*
|
2023-03-03 14:17:03 +00:00
|
|
|
* [Live Demo](https://primevue.org/focustrap)
|
2023-03-02 14:25:05 +00:00
|
|
|
*
|
|
|
|
* @module focustrap
|
2023-03-02 11:35:08 +00:00
|
|
|
*/
|
|
|
|
import { DirectiveBinding, ObjectDirective } from 'vue';
|
2022-12-08 11:04:25 +00:00
|
|
|
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Defines options of FocusTrap.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
export interface FocusTrapOptions {
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When present, it specifies that the directive should be disabled.
|
|
|
|
* @defaultValue false
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
disabled?: boolean | undefined;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* When When disabled, focustrap will not focus by default.
|
|
|
|
* @defaultValue true
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
autoFocus?: boolean | undefined;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @type {FocusTrapDirectivePassThroughOptions}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
pt?: FocusTrapDirectivePassThroughOptions;
|
2023-06-22 13:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link FocusTrapOptions.pt}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
export interface FocusTrapDirectivePassThroughOptions {
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Uses to pass attributes to the root's DOM element.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @see {@link FocusTrapDirectivePassThroughDirectiveOptions}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
root?: FocusTrapDirectivePassThroughDirectiveOptions;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Uses to pass attributes to the first focusable element's DOM element.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @see {@link FocusTrapDirectivePassThroughDirectiveOptions}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
firstFocusableElement?: FocusTrapDirectivePassThroughDirectiveOptions;
|
2023-06-23 09:47:31 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the last focusable element's DOM element.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @see {@link FocusTrapDirectivePassThroughDirectiveOptions}
|
2023-06-23 09:47:31 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
lastFocusableElement?: FocusTrapDirectivePassThroughDirectiveOptions;
|
2023-06-22 13:53:04 +00:00
|
|
|
}
|
|
|
|
|
2023-06-23 09:47:31 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) directive options.
|
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
export interface FocusTrapDirectivePassThroughDirectiveOptions {
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the life cycle hooks.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @see {@link FocusTrapDirectivePassThroughHooksOptions}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
hooks?: FocusTrapDirectivePassThroughHooksOptions;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the styles.
|
2023-06-23 14:51:42 +00:00
|
|
|
* @see {@link FocusTrapDirectivePassThroughCSSOptions}
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
css?: FocusTrapDirectivePassThroughCSSOptions;
|
2023-06-22 13:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Custom passthrough(pt) hooks options.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
export interface FocusTrapDirectivePassThroughHooksOptions {
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Called before bound element's attributes or event listeners are applied.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
created?: DirectiveBinding;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Called right before the element is inserted into the DOM.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
beforeMount?: DirectiveBinding;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Called when the bound element's parent component and all its children are mounted.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
mounted?: DirectiveBinding;
|
|
|
|
/**
|
|
|
|
* Called before the parent component is updated.
|
|
|
|
*/
|
|
|
|
beforeUpdate?: DirectiveBinding;
|
|
|
|
/**
|
|
|
|
* Called after the parent component and all of its children have updated all of its children have updated.
|
|
|
|
*/
|
|
|
|
updated?: DirectiveBinding;
|
|
|
|
/**
|
|
|
|
* Called before the parent component is unmounted.
|
|
|
|
*/
|
|
|
|
beforeUnmount?: DirectiveBinding;
|
|
|
|
/**
|
|
|
|
* Called when the parent component is unmounted.
|
|
|
|
*/
|
|
|
|
unmounted?: DirectiveBinding;
|
2023-06-22 13:53:04 +00:00
|
|
|
}
|
|
|
|
|
2023-03-02 11:35:08 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Custom passthrough(pt) css options.
|
2023-03-02 11:35:08 +00:00
|
|
|
*/
|
2023-06-23 14:51:42 +00:00
|
|
|
export interface FocusTrapDirectivePassThroughCSSOptions {
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Style class of the element.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
class?: any;
|
2023-06-22 13:53:04 +00:00
|
|
|
/**
|
2023-06-23 09:47:31 +00:00
|
|
|
* Inline style of the element.
|
2023-06-22 13:53:04 +00:00
|
|
|
*/
|
2023-06-23 09:47:31 +00:00
|
|
|
style?: any;
|
2023-03-02 11:35:08 +00:00
|
|
|
}
|
2022-12-08 11:04:25 +00:00
|
|
|
|
2023-03-02 11:35:08 +00:00
|
|
|
/**
|
|
|
|
* Binding of FocusTrap directive.
|
|
|
|
*/
|
|
|
|
export interface FocusTrapDirectiveBinding extends Omit<DirectiveBinding, 'modifiers' | 'value'> {
|
|
|
|
/**
|
|
|
|
* Value of the FocusTrap.
|
|
|
|
*/
|
|
|
|
value?: FocusTrapOptions | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* **PrimeVue - FocusTrap**
|
|
|
|
*
|
|
|
|
* _FocusTrap directive provides advisory information for a component._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/focustrap/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-02 11:35:08 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
declare const FocusTrap: ObjectDirective;
|
|
|
|
|
|
|
|
export default FocusTrap;
|