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

253 lines
6.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';
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 { DefineComponent, DesignToken, EmitFn, 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 {
/**
2023-12-21 08:20:59 +00:00
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
props: AccordionProps;
/**
* Defines current inline state.
*/
state: AccordionState;
/**
* 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-02-28 08:29:30 +00:00
/**
* Custom tab open event.
2024-05-16 14:05:43 +00:00
* @see {@link AccordionEmitsOptions.tab-open}
2023-02-28 08:29:30 +00:00
*/
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.
2024-05-16 14:05:43 +00:00
* @see {@link AccordionEmitsOptions.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.
2024-05-16 14:05:43 +00:00
* @see {@link AccordionEmitsOptions.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 {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: AccordionPassThroughOptionType;
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;
/**
2024-04-24 22:42:28 +00:00
* Current active value state.
*/
2024-04-24 22:42:28 +00:00
d_value: string | string[];
}
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 {
2024-04-24 22:42:28 +00:00
/**
* Value of the active panel or an array of values in multiple mode.
* @defaultValue null
*/
value?: string | string[] | null | undefined;
2022-09-06 12:03:37 +00:00
/**
* 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
2024-04-24 22:42:28 +00:00
* @deprecated since v4. Use value property instead.
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;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
/**
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
*/
2024-05-16 14:05:43 +00:00
export interface AccordionEmitsOptions {
2024-04-24 22:42:28 +00:00
/**
* Emitted when the active panel changes.
* @param {string | string[] | null | undefined} value - Value of new active panel.
*/
'update:value'(value: string | string[] | null | undefined): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the active tab changes.
* @param {number | undefined} value - Index of new active tab.
2024-04-24 22:42:28 +00:00
* @deprecated since v4. Use update:value emit instead.
2022-09-06 12:03:37 +00:00
*/
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.
2024-04-24 22:42:28 +00:00
* @deprecated since v4.
2022-09-06 12:03:37 +00:00
*/
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.
2024-04-24 22:42:28 +00:00
* @deprecated since v4.
2022-09-06 12:03:37 +00:00
*/
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.
2024-04-24 22:42:28 +00:00
* @deprecated since v4.
2022-09-14 11:26:01 +00:00
*/
2023-02-28 08:29:30 +00:00
'tab-click'(event: AccordionClickEvent): void;
}
2022-09-06 12:03:37 +00:00
export declare type AccordionEmits = EmitFn<AccordionEmitsOptions>;
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
*/
declare const Accordion: DefineComponent<AccordionProps, AccordionSlots, AccordionEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
Accordion: GlobalComponentConstructor<AccordionProps, AccordionSlots, AccordionEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default Accordion;