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

185 lines
4.6 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';
export declare type AccordionPassThroughOptionType = AccordionPassThroughAttributes | ((options: AccordionPassThroughMethodOptions) => AccordionPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface AccordionPassThroughMethodOptions {
props: AccordionProps;
state: AccordionState;
}
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 {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: AccordionPassThroughOptionType;
}
/**
* 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;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {AccordionPassThroughOptions}
*/
pt?: AccordionPassThroughOptions;
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;