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

141 lines
3.5 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';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
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
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.
2023-03-08 10:51:52 +00:00
* @defaultValue pi pi-chevron-right
2022-09-06 12:03:37 +00:00
*/
expandIcon?: string | undefined;
/**
* Icon of an expanded tab.
2023-03-08 10:51:52 +00:00
* @defaultValue pi pi-chevron-down
2022-09-06 12:03:37 +00:00
*/
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;
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-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;