primevue-mirror/components/lib/slider/Slider.d.ts

216 lines
5.3 KiB
TypeScript
Raw Normal View History

2023-03-01 11:09:05 +00:00
/**
*
* Slider is a component to provide input with a drag handle.
*
* [Live Demo](https://www.primevue.org/slider/)
*
* @module slider
*
*/
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type SliderPassThroughOptionType = SliderPassThroughAttributes | ((options: SliderPassThroughMethodOptions) => SliderPassThroughAttributes | string) | string | null | undefined;
2023-05-07 10:54:26 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface SliderPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-07 10:54:26 +00:00
props: SliderProps;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-07 10:54:26 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link SliderProps.pt}
*/
export interface SliderPassThroughOptions {
/**
* Used to pass attributes to the root's DOM element.
2023-05-07 10:54:26 +00:00
*/
root?: SliderPassThroughOptionType;
/**
* Used to pass attributes to the range's DOM element.
2023-05-07 10:54:26 +00:00
*/
range?: SliderPassThroughOptionType;
/**
* Used to pass attributes to the handle's DOM element.
2023-05-07 10:54:26 +00:00
*/
handle?: SliderPassThroughOptionType;
/**
* Used to pass attributes to the start handler's DOM element.
2023-05-07 10:54:26 +00:00
*/
startHandler?: SliderPassThroughOptionType;
/**
* Used to pass attributes to the end handler's DOM element.
2023-05-07 10:54:26 +00:00
*/
endHandler?: SliderPassThroughOptionType;
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-05-07 10:54:26 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SliderPassThroughAttributes {
[key: string]: any;
}
2023-03-01 11:09:05 +00:00
/**
* Custom slide end event.
2024-05-16 14:05:43 +00:00
* @see {@link SliderEmitsOptions.slideend}
2023-03-01 11:09:05 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface SliderSlideEndEvent {
/**
* Original event
*/
originalEvent: Event;
/**
* New value.
*/
value: number;
}
2023-03-01 11:09:05 +00:00
/**
* Defines valid properties in Slider component.
*/
2022-09-06 12:03:37 +00:00
export interface SliderProps {
/**
* Value of the component.
*/
modelValue?: number | number[] | undefined;
/**
* Mininum boundary value.
2023-03-01 11:09:05 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
min?: number | undefined;
/**
* Maximum boundary value.
2023-03-01 11:09:05 +00:00
* @defaultValue 100
2022-09-06 12:03:37 +00:00
*/
max?: number | undefined;
/**
* Orientation of the slider.
2023-03-08 10:51:52 +00:00
* @defaultValue horizontal
2022-09-06 12:03:37 +00:00
*/
2023-03-01 11:09:05 +00:00
orientation?: 'horizontal' | 'vertical' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Step factor to increment/decrement the value.
2023-03-01 11:09:05 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
step?: number | undefined;
/**
* When speficed, allows two boundary values to be picked.
2023-03-01 11:09:05 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
range?: boolean | undefined;
/**
* When present, it specifies that the component should be disabled.
2023-03-01 11:09:05 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
/**
* Index of the element in tabbing order.
*/
tabindex?: number | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
2023-11-24 12:21:54 +00:00
ariaLabelledby?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Used to define a string that labels the element.
*/
2023-11-24 12:21:54 +00:00
ariaLabel?: string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-05-07 10:54:26 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-07 10:54:26 +00:00
* @type {SliderPassThroughOptions}
*/
pt?: PassThrough<SliderPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-24 14:09:28 +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 11:09:05 +00:00
/**
* Defines valid slots in Slider component.
*/
2022-09-14 11:26:01 +00:00
export interface SliderSlots {}
2022-09-06 12:03:37 +00:00
2023-03-01 11:09:05 +00:00
/**
* Defines valid emits in Slider component.
*/
2024-05-16 14:05:43 +00:00
export interface SliderEmitsOptions {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {number | number[]} value - New value.
*/
2023-03-01 11:09:05 +00:00
'update:modelValue'(value: number | number[]): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on value change.
* @param {number} value - New value
*/
2023-03-01 11:09:05 +00:00
change(value: number): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when slide ends.
* @param {SliderSlideEndEvent} event - Custom slide end event.
*/
2023-03-01 11:09:05 +00:00
slideend(event: SliderSlideEndEvent): void;
2023-03-01 11:09:42 +00:00
}
2022-09-06 12:03:37 +00:00
export declare type SliderEmits = EmitFn<SliderEmitsOptions>;
2023-03-01 11:09:05 +00:00
/**
* **PrimeVue - Slider**
*
* _Slider is a component to provide input with a drag handle._
*
* [Live Demo](https://www.primevue.org/slider/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 11:09:05 +00:00
*
* @group Component
*
*/
declare const Slider: DefineComponent<SliderProps, SliderSlots, SliderEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
Slider: GlobalComponentConstructor<SliderProps, SliderSlots, SliderEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default Slider;