primevue-mirror/components/lib/chip/Chip.d.ts

207 lines
4.8 KiB
TypeScript
Raw Normal View History

2023-03-01 13:12:09 +00:00
/**
*
* Chip represents people using icons, labels and images.
*
* [Live Demo](https://www.primevue.org/chip)
*
* @module chip
*
*/
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
2024-04-08 12:20:42 +00:00
export declare type ChipPassThroughOptionType<T = any> = ChipPassThroughAttributes | ((options: ChipPassThroughMethodOptions<T>) => ChipPassThroughAttributes | string) | string | null | undefined;
2023-04-21 13:24:22 +00:00
/**
* Custom passthrough(pt) option method.
*/
2024-04-08 12:20:42 +00:00
export interface ChipPassThroughMethodOptions<T> {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-21 13:24:22 +00:00
props: ChipProps;
/**
* Defines current inline state.
*/
2023-04-21 13:24:22 +00:00
state: ChipState;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
2024-04-08 12:20:42 +00:00
parent: T;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-04-21 13:24:22 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link ChipProps.pt}
*/
2024-04-08 12:20:42 +00:00
export interface ChipPassThroughOptions<T = any> {
2023-04-21 13:24:22 +00:00
/**
* Used to pass attributes to the root's DOM element.
2023-04-21 13:24:22 +00:00
*/
2024-04-08 12:20:42 +00:00
root?: ChipPassThroughOptionType<T>;
2023-04-21 13:24:22 +00:00
/**
* Used to pass attributes to the image's DOM element.
2023-04-21 13:24:22 +00:00
*/
2024-04-08 12:20:42 +00:00
image?: ChipPassThroughOptionType<T>;
2023-04-21 13:24:22 +00:00
/**
* Used to pass attributes to the icon's DOM element.
2023-04-21 13:24:22 +00:00
*/
2024-04-08 12:20:42 +00:00
icon?: ChipPassThroughOptionType<T>;
2023-04-21 13:24:22 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the label' DOM element.
2023-04-21 13:24:22 +00:00
*/
2024-04-08 12:20:42 +00:00
label?: ChipPassThroughOptionType<T>;
2023-04-21 13:24:22 +00:00
/**
* Used to pass attributes to the removeIcon's DOM element.
2023-04-21 13:24:22 +00:00
*/
2024-04-08 12:20:42 +00:00
removeIcon?: ChipPassThroughOptionType<T>;
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-04-21 13:24:22 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface ChipPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Chip component.
*/
export interface ChipState {
/**
* Current visible state as a boolean.
* @defaultValue true
*/
visible: boolean;
}
2023-03-01 13:12:09 +00:00
/**
* Defines valid properties in Chip component.
*/
2022-09-06 12:03:37 +00:00
export interface ChipProps {
/**
* Defines the text to display.
*/
label?: string;
/**
* Defines the icon to display.
*/
icon?: string;
/**
* Defines the image to display.
*/
image?: string;
/**
* Whether to display a remove icon.
2023-03-01 13:12:09 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
removable?: boolean;
/**
* Icon of the remove element.
*/
removeIcon?: string;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-04-21 13:24:22 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-21 13:24:22 +00:00
* @type {ChipPassThroughOptions}
*/
pt?: PassThrough<ChipPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-24 07:39:02 +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-03-01 13:12:09 +00:00
/**
* Defines valid slots in Chip component.
*/
2022-09-06 12:03:37 +00:00
export interface ChipSlots {
/**
* Content can easily be customized with the default slot instead of using the built-in modes.
*/
2023-03-01 13:12:09 +00:00
default(): VNode[];
/**
* Custom icon template.
*/
icon(): VNode[];
/**
* Custom remove icon template of chip component.
* @param {Object} scope - remove icon slot's params.
*/
removeicon(scope: {
2023-10-31 17:21:47 +00:00
/**
* Remove icon click event
* @param {Event} event - Browser event
*/
removeCallback: (event: Event) => void;
/**
* Remove icon keydown event
* @param {Event} event - Browser event
*/
keydownCallback: (event: Event) => void;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 13:12:09 +00:00
/**
* Defines valid properties in Chip component.
*/
2024-05-16 14:05:43 +00:00
export interface ChipEmitsOptions {
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a chip is removed.
* @param {Event} event - Browser event.
*/
2023-03-01 13:12:09 +00:00
remove(event: Event): void;
}
2022-09-06 12:03:37 +00:00
export declare type ChipEmits = EmitFn<ChipEmitsOptions>;
2023-03-01 13:12:09 +00:00
/**
* **PrimeVue - Chip**
*
* _Chip represents people using icons, labels and images._
*
* [Live Demo](https://www.primevue.org/chip/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*
2023-03-01 13:12:09 +00:00
*/
declare const Chip: DefineComponent<ChipProps, ChipSlots, ChipEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
Chip: GlobalComponentConstructor<ChipProps, ChipSlots, ChipEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default Chip;