primevue-mirror/components/lib/fieldset/Fieldset.d.ts

188 lines
4.6 KiB
TypeScript
Raw Normal View History

2023-02-28 16:44:09 +00:00
/**
*
* Fieldset is a grouping component with the optional content toggle feature.
*
* [Live Demo](https://www.primevue.org/fieldset/)
*
* @module fieldset
*
*/
import { AnchorHTMLAttributes, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type FieldsetPassThroughOptionType = FieldsetPassThroughAttributes | ((options: FieldsetPassThroughMethodOptions) => FieldsetPassThroughAttributes | string) | string | null | undefined;
2023-03-24 15:07:46 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface FieldsetPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-03-24 15:07:46 +00:00
props: FieldsetProps;
state: FieldsetState;
}
2023-02-28 16:44:09 +00:00
/**
* Custom toggle event.
2023-03-06 20:35:39 +00:00
* @see {@link FieldsetEmits.toggle}
2023-02-28 16:44:09 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface FieldsetToggleEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Collapsed state as a boolean
*/
value: boolean;
}
2023-03-24 15:07:46 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link FieldsetProps.pt}
*/
export interface FieldsetPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the legend's DOM element.
*/
legend?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler's DOM element.
*/
toggler?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler icon's DOM element.
*/
2023-04-19 08:00:52 +00:00
togglerIcon?: FieldsetPassThroughOptionType;
2023-04-03 11:07:22 +00:00
/**
* Uses to pass attributes to the legend title's DOM element.
*/
2023-04-19 08:00:52 +00:00
legendTitle?: FieldsetPassThroughOptionType;
2023-03-24 15:07:46 +00:00
/**
* Uses to pass attributes to the toggleable content's DOM element.
*/
2023-04-19 08:00:52 +00:00
toggleableContent?: FieldsetPassThroughOptionType;
2023-03-24 15:07:46 +00:00
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: FieldsetPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-03-24 15:07:46 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface FieldsetPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Fieldset component.
*/
export interface FieldsetState {
/**
* Current collapsed state as a boolean.
* @defaultValue false
*/
d_collapsed: boolean;
}
2023-02-28 16:44:09 +00:00
/**
* Defines valid properties in Fieldset component.
*/
2022-09-06 12:03:37 +00:00
export interface FieldsetProps {
/**
* Header text of the fieldset.
*/
legend?: string | undefined;
/**
* When specified, content can toggled by clicking the legend.
2023-02-28 16:44:09 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
toggleable?: boolean | undefined;
/**
* Defines the default visibility state of the content.
2023-02-28 16:44:09 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
collapsed?: boolean | undefined;
2022-09-14 11:26:01 +00:00
/**
* Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component.
2023-03-24 15:07:46 +00:00
* @deprecated since v3.26.0. Use 'pt' property instead.
2022-09-14 11:26:01 +00:00
*/
toggleButtonProps?: AnchorHTMLAttributes | undefined;
2023-03-24 15:07:46 +00:00
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {FieldsetPassThroughOptions}
*/
pt?: FieldsetPassThroughOptions;
2023-05-16 10:43:21 +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 16:44:09 +00:00
/**
* Defines valid slots in Fieldset slots.
*/
2022-09-06 12:03:37 +00:00
export interface FieldsetSlots {
/**
* Default content slot.
*/
default: () => VNode[];
/**
* Custom legend template.
*/
legend: () => VNode[];
2023-03-24 15:07:46 +00:00
/**
* Custom toggler icon template.
*/
togglericon: () => VNode[];
2022-09-06 12:03:37 +00:00
}
2023-02-28 16:44:09 +00:00
/**
* Defines valid emits in Fildset component.
*/
export interface FieldsetEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the collapsed changes.
* @param {boolean} value - New value.
*/
2023-02-28 16:44:09 +00:00
'update:collapsed'(value: boolean): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a tab gets expanded or collapsed.
* @param {FieldsetToggleEvent} event - Custom toggle event.
*/
2023-02-28 16:44:09 +00:00
toggle(event: FieldsetToggleEvent): void;
}
2022-09-06 12:03:37 +00:00
2023-02-28 16:44:09 +00:00
/**
* **PrimeVue - Fieldset**
*
* _Fieldset is a grouping component with the optional content toggle feature._
*
* [Live Demo](https://www.primevue.org/fieldset/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-02-28 16:44:09 +00:00
*
* @group Component
*
*/
2023-03-01 12:30:54 +00:00
declare class Fieldset extends ClassComponent<FieldsetProps, FieldsetSlots, FieldsetEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Fieldset: GlobalComponentConstructor<Fieldset>;
2022-09-06 12:03:37 +00:00
}
}
export default Fieldset;