primevue-mirror/components/lib/accordion/Accordion.d.ts

238 lines
6.0 KiB
TypeScript
Raw Normal View History

2023-02-28 08:29:30 +00:00
/**
*
* Accordion groups a collection of contents in tabs.
*
* [Live Demo](https://www.primevue.org/accordion/)
*
* @module accordion
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
2023-05-23 21:10:36 +00:00
import { AccordionTabPassThroughOptionType } from '../accordiontab';
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 { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type AccordionPassThroughOptionType = AccordionPassThroughAttributes | ((options: AccordionPassThroughMethodOptions) => AccordionPassThroughAttributes | string) | string | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface AccordionPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
props: AccordionProps;
/**
* Defines current inline state.
*/
state: AccordionState;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
}
2023-02-28 08:29:30 +00:00
/**
* Custom tab open event.
* @see {@link AccordionEmits.tab-open}
*/
2022-09-06 12:03:37 +00:00
export interface AccordionTabOpenEvent {
/**
* Browser mouse event.
* @type {MouseEvent}
*/
originalEvent: MouseEvent;
/**
* Opened tab index.
*/
index: number;
}
/**
2023-02-28 08:29:30 +00:00
* Custom tab close event.
* @see {@link AccordionEmits.tab-close}
2022-09-06 12:03:37 +00:00
* @extends {AccordionTabOpenEvent}
*/
2022-09-14 11:26:01 +00:00
export interface AccordionTabCloseEvent extends AccordionTabOpenEvent {}
/**
2023-02-28 08:29:30 +00:00
* Custom tab open event.
* @see {@link AccordionEmits.tab-open}
2022-09-14 11:26:01 +00:00
* @extends AccordionTabOpenEvent
*/
export interface AccordionClickEvent extends AccordionTabOpenEvent {}
2022-09-06 12:03:37 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link AccordionProps.pt}
*/
export interface AccordionPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
*/
root?: AccordionPassThroughOptionType;
2023-05-23 21:10:36 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to AccordionTab helper components.
* @deprecated since v3.30.1. Use 'accordiontab' property instead.
2023-05-23 21:10:36 +00:00
*/
tab?: AccordionTabPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to AccordionTab helper components.
*/
accordiontab?: AccordionTabPassThroughOptionType;
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;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface AccordionPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Accordion component.
*/
export interface AccordionState {
/**
* Current id state as a string
*/
id: string;
/**
2023-03-24 15:06:26 +00:00
* Current active index state.
*/
2023-03-24 15:06:26 +00:00
d_activeIndex: number | number[];
}
2023-02-28 08:29:30 +00:00
/**
2023-02-28 10:05:51 +00:00
* Defines valid properties in Accordion component.
2023-02-28 08:29:30 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface AccordionProps {
/**
* When enabled, multiple tabs can be activated at the same time.
2023-02-28 08:29:30 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
multiple?: boolean | undefined;
/**
* Index of the active tab or an array of indexes in multiple mode.
2023-02-28 08:29:30 +00:00
* @defaultValue null
2022-09-06 12:03:37 +00:00
*/
2023-02-28 10:05:51 +00:00
activeIndex?: number | number[] | null | undefined;
2022-09-06 12:03:37 +00:00
/**
* When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css.
2023-02-28 08:29:30 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
lazy?: boolean | undefined;
/**
* Icon of a collapsed tab.
*/
expandIcon?: string | undefined;
/**
* Icon of an expanded tab.
*/
collapseIcon?: string | undefined;
2022-09-14 11:26:01 +00:00
/**
* Index of the element in tabbing order.
2023-02-28 08:29:30 +00:00
* @defaultValue 0
2022-09-14 11:26:01 +00:00
*/
tabindex?: number | undefined;
/**
* When enabled, the focused tab is activated.
2023-02-28 08:29:30 +00:00
* @defaultValue false
2022-09-14 11:26:01 +00:00
*/
selectOnFocus?: boolean | undefined;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
* @type {AccordionPassThroughOptions}
*/
pt?: PassThrough<AccordionPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-23 23:40:14 +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-02-28 08:29:30 +00:00
/**
2023-02-28 10:05:51 +00:00
* Defines valid slots in Accordion slots.
2023-02-28 08:29:30 +00:00
*/
2023-03-01 11:08:29 +00:00
export interface AccordionSlots {
2022-09-06 12:03:37 +00:00
/**
* Default slot to detect AccordionTab components.
*/
2023-02-28 08:29:30 +00:00
default(): VNode[];
/**
2023-10-24 16:08:31 +00:00
* Custom collapse icon template.
*/
collapseicon(): VNode[];
/**
* Custom expand icon template.
*/
expandicon(): VNode[];
2023-03-01 11:08:29 +00:00
}
2022-09-06 12:03:37 +00:00
2023-02-28 08:29:30 +00:00
/**
2023-02-28 10:05:51 +00:00
* Defines valid emits in Accordion component.
2023-02-28 08:29:30 +00:00
*/
export interface AccordionEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the active tab changes.
* @param {number | undefined} value - Index of new active tab.
*/
2023-02-28 08:29:30 +00:00
'update:activeIndex'(value: number | undefined): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a tab gets expanded.
* @param {AccordionTabOpenEvent} event - Custom tab open event.
*/
2023-02-28 08:29:30 +00:00
'tab-open'(event: AccordionTabOpenEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when an active tab is collapsed by clicking on the header.
* @param {AccordionTabCloseEvent} event - Custom tab close event.
*/
2023-02-28 08:29:30 +00:00
'tab-close'(event: AccordionTabCloseEvent): void;
2022-09-14 11:26:01 +00:00
/**
* Callback to invoke when an active tab is clicked.
* @param {AccordionClickEvent} event - Custom tab click event.
*/
2023-02-28 08:29:30 +00:00
'tab-click'(event: AccordionClickEvent): void;
}
2022-09-06 12:03:37 +00:00
2023-02-28 08:29:30 +00:00
/**
* **PrimeVue - Accordion**
*
* _Accordion groups a collection of contents in tabs._
*
* [Live Demo](https://www.primevue.org/accordion/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-02-28 08:29:30 +00:00
*
2023-02-28 10:05:51 +00:00
* @group Component
*
2023-02-28 08:29:30 +00:00
*/
2023-03-01 11:08:29 +00:00
declare class Accordion extends ClassComponent<AccordionProps, AccordionSlots, AccordionEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Accordion: GlobalComponentConstructor<Accordion>;
2022-09-06 12:03:37 +00:00
}
}
export default Accordion;