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
|
|
|
|
*
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
import { AnchorHTMLAttributes, TransitionProps, 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';
|
2024-05-16 10:50:43 +00:00
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type FieldsetPassThroughOptionType = FieldsetPassThroughAttributes | ((options: FieldsetPassThroughMethodOptions) => FieldsetPassThroughAttributes | string) | string | null | undefined;
|
2023-03-24 15:07:46 +00:00
|
|
|
|
2023-08-02 14:07:22 +00:00
|
|
|
export declare type FieldsetPassThroughTransitionType = TransitionProps | ((options: FieldsetPassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
2023-03-24 15:07:46 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface FieldsetPassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-03-24 15:07:46 +00:00
|
|
|
props: FieldsetProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-03-24 15:07:46 +00:00
|
|
|
state: FieldsetState;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-03-24 15:07:46 +00:00
|
|
|
}
|
|
|
|
|
2023-02-28 16:44:09 +00:00
|
|
|
/**
|
|
|
|
* Custom toggle event.
|
2024-05-16 14:05:43 +00:00
|
|
|
* @see {@link FieldsetEmitsOptions.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 {
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
|
|
|
root?: FieldsetPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the legend's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
|
|
|
legend?: FieldsetPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the toggler's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
|
|
|
toggler?: FieldsetPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the toggle icon's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
2024-04-30 14:09:06 +00:00
|
|
|
toggleIcon?: FieldsetPassThroughOptionType;
|
2024-05-11 14:33:17 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the legend label's DOM element.
|
2024-05-11 14:33:17 +00:00
|
|
|
*/
|
|
|
|
toggleButton?: FieldsetPassThroughOptionType;
|
2023-04-03 11:07:22 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the legend label's DOM element.
|
2023-04-03 11:07:22 +00:00
|
|
|
*/
|
2024-04-30 14:09:06 +00:00
|
|
|
legendLabel?: FieldsetPassThroughOptionType;
|
2023-03-24 15:07:46 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the content container's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
2024-04-30 14:09:06 +00:00
|
|
|
contentContainer?: FieldsetPassThroughOptionType;
|
2023-03-24 15:07:46 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the content's DOM element.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
|
|
|
content?: FieldsetPassThroughOptionType;
|
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;
|
2023-08-02 12:00:59 +00:00
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
transition?: FieldsetPassThroughTransitionType;
|
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
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used 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
|
|
|
*/
|
2023-03-06 08:29:54 +00:00
|
|
|
toggleButtonProps?: AnchorHTMLAttributes | undefined;
|
2024-04-02 08:24:31 +00:00
|
|
|
/**
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
*/
|
|
|
|
dt?: DesignToken<any>;
|
2023-03-24 15:07:46 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-03-24 15:07:46 +00:00
|
|
|
* @type {FieldsetPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<FieldsetPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
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.
|
2024-05-10 09:47:23 +00:00
|
|
|
* @param {Object} scope - legend slot's params.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2024-05-10 09:47:23 +00:00
|
|
|
legend(scope: {
|
|
|
|
/**
|
|
|
|
* Toggle function.
|
|
|
|
* @param {Event} event - Browser event
|
|
|
|
*/
|
|
|
|
toggleCallback: (event: Event) => void;
|
|
|
|
}): VNode[];
|
2023-03-24 15:07:46 +00:00
|
|
|
/**
|
2024-04-30 14:09:06 +00:00
|
|
|
* @deprecated since v4.0. Use the 'toggleicon' slot instead.
|
2023-03-24 15:07:46 +00:00
|
|
|
* Custom toggler icon template.
|
2024-04-30 14:09:06 +00:00
|
|
|
* @param {Object} scope - toggler icon slot's params.
|
2023-03-24 15:07:46 +00:00
|
|
|
*/
|
2024-04-30 14:09:06 +00:00
|
|
|
togglericon(scope: {
|
|
|
|
/**
|
|
|
|
* Collapsed state as a boolean
|
|
|
|
*/
|
|
|
|
collapsed: boolean;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom toggler icon template.
|
|
|
|
* @param {Object} scope - toggler icon slot's params.
|
|
|
|
*/
|
|
|
|
toggleicon(scope: {
|
|
|
|
/**
|
|
|
|
* Collapsed state as a boolean
|
|
|
|
*/
|
|
|
|
collapsed: boolean;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-02-28 16:44:09 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Fildset component.
|
|
|
|
*/
|
2024-05-16 14:05:43 +00:00
|
|
|
export interface FieldsetEmitsOptions {
|
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
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
export declare type FieldsetEmits = EmitFn<FieldsetEmitsOptions>;
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
declare const Fieldset: DefineComponent<FieldsetProps, FieldsetSlots, FieldsetEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
Fieldset: GlobalComponentConstructor<FieldsetProps, FieldsetSlots, FieldsetEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Fieldset;
|