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

365 lines
9.1 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';
2023-05-02 08:00:39 +00:00
import { ButtonPassThroughOptions } 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 { ClassComponent, GlobalComponentConstructor, PTOptions } 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;
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 passthrough(pt) options.
* @see {@link SpeedDialProps.pt}
*/
export interface SpeedDialPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* 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
*/
2023-05-02 08:00:39 +00:00
button?: ButtonPassThroughOptions;
2023-04-24 12:44:53 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the menu's DOM element.
2023-04-24 12:44:53 +00:00
*/
2023-04-27 07:14:34 +00:00
menu?: SpeedDialPassThroughOptionType;
2023-04-24 12:44:53 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the menu item's DOM element.
2023-04-24 12:44:53 +00:00
*/
2023-04-27 07:14:34 +00:00
menuitem?: SpeedDialPassThroughOptionType;
2023-04-24 12:44:53 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the action's DOM element.
2023-04-24 12:44:53 +00:00
*/
action?: SpeedDialPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the action icon's DOM element.
2023-04-24 12:44:53 +00:00
*/
actionIcon?: SpeedDialPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* 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-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-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;
2022-12-08 11:04:25 +00:00
/**
* Defines a string value that labels an interactive list element.
*/
'aria-label'?: string | undefined;
/**
* Identifier of the underlying list element.
*/
'aria-labelledby'?: string | undefined;
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?: PTOptions<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;
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: {
2022-09-06 12:03:37 +00:00
/**
2023-08-16 06:45:44 +00:00
* Button click function
* @param {Event} event - Browser event.
2022-09-06 12:03:37 +00:00
*/
2023-08-17 07:16:25 +00:00
onClick: (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.
*/
export interface SpeedDialEmits {
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
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
*
*/
2022-09-14 11:26:01 +00:00
declare class SpeedDial extends ClassComponent<SpeedDialProps, SpeedDialSlots, SpeedDialEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
SpeedDial: GlobalComponentConstructor<SpeedDial>;
2022-09-06 12:03:37 +00:00
}
}
export default SpeedDial;