primevue-mirror/components/lib/scrolltop/ScrollTop.d.ts

140 lines
3.7 KiB
TypeScript
Raw Normal View History

2023-03-01 13:12:34 +00:00
/**
*
* ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.
*
* [Live Demo](https://www.primevue.org/scrolltop/)
*
* @module scrolltop
*
*/
2023-08-02 14:07:22 +00:00
import { TransitionProps, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type ScrollTopPassThroughOptionType = ScrollTopPassThroughAttributes | ((options: ScrollTopPassThroughMethodOptions) => ScrollTopPassThroughAttributes | string) | string | null | undefined;
2023-04-21 13:42:00 +00:00
2023-08-02 14:07:22 +00:00
export declare type ScrollTopPassThroughTransitionType = TransitionProps | ((options: ScrollTopPassThroughMethodOptions) => TransitionProps) | undefined;
2023-04-21 13:42:00 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface ScrollTopPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-04-21 13:42:00 +00:00
props: ScrollTopProps;
state: ScrollTopState;
}
/**
* Custom passthrough(pt) options.
* @see {@link ScrollTopProps.pt}
*/
export interface ScrollTopPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-21 13:42:00 +00:00
*/
root?: ScrollTopPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the icon's DOM element.
2023-04-21 13:42:00 +00:00
*/
icon?: ScrollTopPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to manage all lifecycle hooks
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-08-02 12:02:36 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: ScrollTopPassThroughTransitionType;
2023-04-21 13:42:00 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface ScrollTopPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in ScrollTop component.
*/
export interface ScrollTopState {
/**
* Current visible state as a boolean.
* @defaultValue false
*/
visible: boolean;
}
2023-03-01 13:12:34 +00:00
/**
* Defines valid properties in ScrollTop component.
*/
2022-09-06 12:03:37 +00:00
export interface ScrollTopProps {
/**
* Target of the ScrollTop.
2023-03-08 10:51:52 +00:00
* @defaultValue window
2022-09-06 12:03:37 +00:00
*/
2023-03-01 13:12:34 +00:00
target?: 'window' | 'parent' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Defines the threshold value of the vertical scroll position of the target to toggle the visibility.
2023-03-01 13:12:34 +00:00
* @defaultValue 400
2022-09-06 12:03:37 +00:00
*/
threshold?: number | undefined;
/**
* Icon to display.
2023-04-18 13:42:36 +00:00
* @deprecated since v3.27.0. Use 'icon' slot.
2022-09-06 12:03:37 +00:00
*/
icon?: string | undefined;
/**
* Defines the scrolling behaviour, 'smooth' adds an animation and 'auto' scrolls with a jump.
2023-03-08 10:51:52 +00:00
* @defaultValue smooth
2022-09-06 12:03:37 +00:00
*/
behavior?: string | undefined;
2023-04-21 13:42:00 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-21 13:42:00 +00:00
* @type {ScrollTopPassThroughOptions}
*/
pt?: PTOptions<ScrollTopPassThroughOptions>;
2023-05-24 10:09:45 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
2022-09-06 12:03:37 +00:00
}
2023-03-01 13:12:34 +00:00
/**
* Defines valid slots in ScrollTop component.
*/
export interface ScrollTopSlots {
/**
* Custom scrolltop icon template.
*/
icon(): VNode[];
}
2022-09-06 12:03:37 +00:00
2023-03-01 13:12:34 +00:00
/**
* Defines valid emits in ScrollTop component.
*/
export interface ScrollTopEmits {}
2022-09-06 12:03:37 +00:00
2023-03-01 13:12:34 +00:00
/**
* **PrimeVue - ScrollTop**
*
* _ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly._
*
* [Live Demo](https://www.primevue.org/scrolltop/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2022-09-14 11:26:01 +00:00
declare class ScrollTop extends ClassComponent<ScrollTopProps, ScrollTopSlots, ScrollTopEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
ScrollTop: GlobalComponentConstructor<ScrollTop>;
2022-09-06 12:03:37 +00:00
}
}
export default ScrollTop;