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';
|
2024-04-15 08:08:42 +00:00
|
|
|
import { ButtonPassThroughOptions, ButtonProps } from '../button';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2024-05-16 10:50:43 +00:00
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +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-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-04-21 13:42:00 +00:00
|
|
|
props: ScrollTopProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-21 13:42:00 +00:00
|
|
|
state: ScrollTopState;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
2023-12-05 11:06:32 +00:00
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
|
|
|
/**
|
2023-09-05 08:50:46 +00:00
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-04-21 13:42:00 +00:00
|
|
|
}
|
|
|
|
|
2024-04-15 08:08:42 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ScrollTopSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: ScrollTopProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: ScrollTopState;
|
|
|
|
}
|
|
|
|
|
2023-04-21 13:42:00 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ScrollTopProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ScrollTopPassThroughOptions {
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the previous button's DOM element.
|
2024-04-15 08:08:42 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-04-21 13:42:00 +00:00
|
|
|
*/
|
2024-04-15 08:08:42 +00:00
|
|
|
root?: ButtonPassThroughOptions<ScrollTopSharedPassThroughMethodOptions>;
|
2023-04-21 13:42:00 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the previous button's DOM element.
|
2024-04-15 08:08:42 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-04-21 13:42:00 +00:00
|
|
|
*/
|
2024-04-15 08:08:42 +00:00
|
|
|
button?: ButtonPassThroughOptions<ScrollTopSharedPassThroughMethodOptions>;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-11-07 06:16:39 +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.
|
|
|
|
*/
|
|
|
|
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;
|
2024-04-15 08:08:42 +00:00
|
|
|
/**
|
|
|
|
* Used to pass all properties of the ButtonProps to the Button component.
|
|
|
|
* @type {ButtonProps}
|
2024-05-25 10:21:50 +00:00
|
|
|
* @defaultValue { rounded: true }
|
2024-04-15 08:08:42 +00:00
|
|
|
*/
|
|
|
|
buttonProps?: object | undefined;
|
2024-04-02 08:24:31 +00:00
|
|
|
/**
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
*/
|
|
|
|
dt?: DesignToken<any>;
|
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}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<ScrollTopPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
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.
|
|
|
|
*/
|
2023-04-07 23:06:45 +00:00
|
|
|
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.
|
|
|
|
*/
|
2024-05-16 14:05:43 +00:00
|
|
|
export interface ScrollTopEmitsOptions {}
|
2024-05-16 10:50:43 +00:00
|
|
|
|
|
|
|
export declare type ScrollTopEmits = EmitFn<ScrollTopEmitsOptions>;
|
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
|
2024-05-16 10:50:43 +00:00
|
|
|
*
|
2023-03-01 13:12:34 +00:00
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
declare const ScrollTop: DefineComponent<ScrollTopProps, ScrollTopSlots, ScrollTopEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
ScrollTop: GlobalComponentConstructor<ScrollTopProps, ScrollTopSlots, ScrollTopEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ScrollTop;
|