primevue-mirror/components/lib/speeddial/SpeedDial.d.ts

421 lines
11 KiB
TypeScript
Raw Normal View History

2023-03-01 12:06:30 +00:00
/**
*
* When pressed, a floating action button can display multiple primary actions that can be performed on a page.
*
* [Live Demo](https://www.primevue.org/speeddial/)
*
* @module speeddial
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2024-04-09 11:24:04 +00:00
import { ButtonPassThroughOptions, ButtonProps } from '../button';
2022-09-06 12:03:37 +00:00
import { MenuItem } from '../menuitem';
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 SpeedDialPassThroughOptionType = SpeedDialPassThroughAttributes | ((options: SpeedDialPassThroughMethodOptions) => SpeedDialPassThroughAttributes | string) | string | null | undefined;
2023-04-24 12:44:53 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface SpeedDialPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-24 12:44:53 +00:00
props: SpeedDialProps;
/**
* Defines current inline state.
*/
2023-04-24 12:44:53 +00:00
state: SpeedDialState;
/**
* Defines current options.
*/
2023-04-28 09:45:36 +00:00
context: SpeedDialContext;
/**
* 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-04-24 12:44:53 +00:00
}
/**
* Custom shared passthrough(pt) option method.
*/
export interface SpeedDialSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: SpeedDialProps;
/**
* Defines current inline state.
*/
state: SpeedDialState;
}
2023-04-24 12:44:53 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link SpeedDialProps.pt}
*/
export interface SpeedDialPassThroughOptions {
/**
* Used to pass attributes to the root's DOM element.
2023-04-24 12:44:53 +00:00
*/
root?: SpeedDialPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-02 08:00:39 +00:00
* @see {@link ButtonPassThroughOptions}
2023-04-24 12:44:53 +00:00
*/
2024-05-06 15:23:01 +00:00
pcButton?: ButtonPassThroughOptions<SpeedDialSharedPassThroughMethodOptions>;
2023-04-24 12:44:53 +00:00
/**
* Used to pass attributes to the list's DOM element.
2023-04-24 12:44:53 +00:00
*/
2024-05-06 13:10:13 +00:00
list?: SpeedDialPassThroughOptionType;
2023-04-24 12:44:53 +00:00
/**
* Used to pass attributes to the item's DOM element.
2023-04-24 12:44:53 +00:00
*/
2024-05-06 13:10:13 +00:00
item?: SpeedDialPassThroughOptionType;
2023-04-24 12:44:53 +00:00
/**
2024-04-09 11:24:04 +00:00
* Used to pass attributes to the action's Button component.
* @see {@link ButtonPassThroughOptions}
2023-04-24 12:44:53 +00:00
*/
2024-04-09 11:24:04 +00:00
action?: ButtonPassThroughOptions<SpeedDialSharedPassThroughMethodOptions>;
2023-04-24 12:44:53 +00:00
/**
* Used to pass attributes to the action icon's DOM element.
2023-04-24 12:44:53 +00:00
*/
actionIcon?: SpeedDialPassThroughOptionType;
/**
* Used to pass attributes to the mask's DOM element.
2023-04-24 12:44:53 +00:00
*/
mask?: SpeedDialPassThroughOptionType;
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-04-24 12:44:53 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SpeedDialPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in SpeedDial component.
*/
export interface SpeedDialState {
/**
* List of items' id.
*/
id: string;
/**
* Current visible state as a boolean.
* @defaultValue false
*/
visible: boolean;
/**
* Current click state of component as a boolean.
* @defaultValue false
*/
isItemClicked: boolean;
/**
* Current focus state as a boolean.
* @defaultValue false
*/
focused: boolean;
/**
* Current focused option index as a number.
* @defaultValue -1
*/
focusedOptionIndex: number;
}
2023-04-28 09:45:36 +00:00
/**
* Defines current options in SpeedDial component.
*/
export interface SpeedDialContext {
/**
* Current active state of menuitem as a boolean.
* @defaultValue false
*/
active: boolean;
2023-07-27 14:32:30 +00:00
/**
* Current hidden state of menuitem as a boolean.
* @defaultValue false
*/
hidden: boolean;
2023-04-28 09:45:36 +00:00
}
2023-03-01 12:06:30 +00:00
/**
* Defines tooltip options.
* @see {@link SpeedDialProps.tooltipOptions}
*/
2022-09-06 12:03:37 +00:00
export interface SpeedDialTooltipOptions {
/**
* Event to show the tooltip, valid values are hover and focus.
*/
2023-03-01 12:06:30 +00:00
event: 'hover' | 'focus' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Position of element.
2023-03-08 10:51:52 +00:00
* @defaultValue bottom
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:06:30 +00:00
position: 'bottom' | 'top' | 'left' | 'right' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Optional options.
*/
2023-03-01 12:06:30 +00:00
[key: string]: any;
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:06:30 +00:00
/**
* Defines valid properties in SpeedDial component.
*/
2022-09-06 12:03:37 +00:00
export interface SpeedDialProps {
/**
* MenuModel instance to define the action items.
*/
model?: MenuItem[] | undefined;
/**
* Specifies the visibility of the overlay.
2023-03-01 12:06:30 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
visible?: boolean | undefined;
/**
* Specifies the opening direction of actions.
2023-03-08 10:51:52 +00:00
* @defaultValue up
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:06:30 +00:00
direction?: 'up' | 'down' | 'left' | 'right' | 'up-left' | 'up-right' | 'down-left' | 'down-right' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Transition delay step for each action item.
2023-03-01 12:06:30 +00:00
* @defaultValue 30
2022-09-06 12:03:37 +00:00
*/
transitionDelay?: number | undefined;
/**
* Specifies the opening type of actions.
2023-03-08 10:51:52 +00:00
* @defaultValue linear
2022-09-06 12:03:37 +00:00
*/
2023-03-01 12:06:30 +00:00
type?: 'linear' | 'circle' | 'semi-circle' | 'quarter-circle' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Radius for *circle types.
2023-03-01 12:06:30 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
radius?: number | undefined;
/**
* Whether to show a mask element behind the speeddial.
2023-03-01 12:06:30 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
mask?: boolean | undefined;
/**
* Whether the component is disabled.
2023-03-01 12:06:30 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
/**
* Whether the actions close when clicked outside.
2023-03-01 12:06:30 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
hideOnClickOutside?: boolean | undefined;
/**
* Style class of the button element.
*/
buttonClass?: any;
/**
* Inline style of the mask element.
*/
maskStyle?: any;
/**
* Style class of the mask element.
*/
maskClass?: string | undefined;
/**
* Show icon of the button element.
* @deprecated since v3.27.0. Use 'showicon' slot.
2022-09-06 12:03:37 +00:00
*/
showIcon?: string | undefined;
/**
* Hide icon of the button element.
* @deprecated since v3.27.0. Use 'hideicon' slot.
2022-09-06 12:03:37 +00:00
*/
hideIcon?: string | undefined;
/**
* Defined to rotate showIcon when hideIcon is not present.
2023-03-01 12:06:30 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
rotateAnimation?: boolean | undefined;
/**
* Style class of the element.
*/
class?: any;
/**
* Inline style of the element.
*/
style?: any;
/**
* Whether to display the tooltip on items. The modifiers of Tooltip can be used like an object in it. Valid keys are 'event' and 'position'.
2023-03-01 12:06:30 +00:00
* @type {SpeedDialTooltipOptions}
2022-09-06 12:03:37 +00:00
*/
tooltipOptions?: SpeedDialTooltipOptions;
2024-04-09 11:24:04 +00:00
/**
* Used to pass all properties of the ButtonProps to the button component.
* @type {ButtonProps}
* @defaultValue { rounded: true }
*/
buttonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the item component.
* @type {ButtonProps}
2024-05-03 08:04:11 +00:00
* @defaultValue { severity: 'secondary', rounded: true, size: 'small' }
2024-04-09 11:24:04 +00:00
*/
actionButtonProps?: object | undefined;
2022-12-08 11:04:25 +00:00
/**
* Defines a string value that labels an interactive list element.
*/
2023-11-24 12:21:54 +00:00
ariaLabel?: string | undefined;
2022-12-08 11:04:25 +00:00
/**
* Identifier of the underlying list element.
*/
2023-11-24 12:21:54 +00:00
ariaLabelledby?: string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-04-24 12:44:53 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-24 12:44:53 +00:00
* @type {SpeedDialPassThroughOptions}
*/
pt?: PassThrough<SpeedDialPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-30 14:55:13 +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 12:06:30 +00:00
/**
* Defines valid slots in SpeedDial component.
*/
2022-09-06 12:03:37 +00:00
export interface SpeedDialSlots {
/**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
2023-03-01 12:06:30 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Menuitem instance
2023-03-01 12:06:30 +00:00
* @type {MenuItem}
2022-09-06 12:03:37 +00:00
*/
item: MenuItem;
/**
2023-08-16 06:45:44 +00:00
* Item click function
* @param {Event} event - Browser event.
*/
2023-08-17 07:16:25 +00:00
onClick: (event: Event) => void;
2024-04-09 11:24:04 +00:00
/**
* Button click function
* @param {Event} event - Browser event.
*/
toggleCallback: (event: Event) => void;
2023-03-01 12:06:30 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom button template.
* @param {Object} scope - button slot's params.
*/
2023-03-01 12:06:30 +00:00
button(scope: {
2024-04-09 11:24:04 +00:00
/**
* Visible state of the item
*/
visible: boolean;
2022-09-06 12:03:37 +00:00
/**
2023-08-16 06:45:44 +00:00
* Button click function
* @param {Event} event - Browser event.
2023-10-31 17:21:47 +00:00
* @deprecated since v3.39.0. Use 'toggleCallback' property instead.
2022-09-06 12:03:37 +00:00
*/
2023-08-17 07:16:25 +00:00
onClick: (event: Event) => void;
2023-10-31 17:21:47 +00:00
/**
* Button click function
* @param {Event} event - Browser event.
*/
toggleCallback: (event: Event) => void;
2023-03-01 12:06:30 +00:00
}): VNode[];
/**
* Custom icon template.
* @param {Object} scope - icon slot's params.
*/
icon(scope: {
/**
2023-08-16 06:45:44 +00:00
* Visible state of the item
*/
visible: boolean;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 12:06:30 +00:00
/**
* Defines valid emits in SpeedDial component.
*/
2024-05-16 14:05:43 +00:00
export interface SpeedDialEmitsOptions {
2022-09-06 12:03:37 +00:00
/**
* Fired when the button element clicked.
* @param {Event} event - Browser event.
*/
2023-03-01 12:06:30 +00:00
click(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Fired when the actions are visible.
*/
2023-03-01 12:06:30 +00:00
show(): void;
2022-09-06 12:03:37 +00:00
/**
* Fired when the actions are hidden.
*/
2023-03-01 12:06:30 +00:00
hide(): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the component receives focus.
* @param {Event} event - Browser event.
*/
2023-03-01 12:06:30 +00:00
focus(event: Event): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the component loses focus.
* @param {Event} event - Browser event.
*/
2023-03-01 12:06:30 +00:00
blur(event: Event): void;
}
2022-09-06 12:03:37 +00:00
export declare type SpeedDialEmits = EmitFn<SpeedDialEmitsOptions>;
2023-03-01 12:06:30 +00:00
/**
* **PrimeVue - SpeedDial**
*
* _When pressed, a floating action button can display multiple primary actions that can be performed on a page._
*
* [Live Demo](https://www.primevue.org/speeddial/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 12:06:30 +00:00
*
* @group Component
*
*/
declare const SpeedDial: DefineComponent<SpeedDialProps, SpeedDialSlots, SpeedDialEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
SpeedDial: GlobalComponentConstructor<SpeedDialProps, SpeedDialSlots, SpeedDialEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default SpeedDial;