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';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type ChipPassThroughOptionType = ChipPassThroughAttributes | ((options: ChipPassThroughMethodOptions) => ChipPassThroughAttributes | string) | string | null | undefined;
|
2023-04-21 13:24:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ChipPassThroughMethodOptions {
|
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-04-21 13:24:22 +00:00
|
|
|
props: ChipProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-21 13:24:22 +00:00
|
|
|
state: ChipState;
|
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-04-21 13:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ChipProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ChipPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-04-21 13:24:22 +00:00
|
|
|
*/
|
|
|
|
root?: ChipPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the image's DOM element.
|
2023-04-21 13:24:22 +00:00
|
|
|
*/
|
|
|
|
image?: ChipPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the icon's DOM element.
|
2023-04-21 13:24:22 +00:00
|
|
|
*/
|
|
|
|
icon?: ChipPassThroughOptionType;
|
|
|
|
/**
|
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
|
|
|
*/
|
|
|
|
label?: ChipPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the removeIcon's DOM element.
|
2023-04-21 13:24:22 +00:00
|
|
|
*/
|
|
|
|
removeIcon?: ChipPassThroughOptionType;
|
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.
|
2023-04-18 07:37:05 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
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.
|
2023-04-18 07:37:05 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'removeicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
removeIcon?: string;
|
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}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
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[];
|
2023-04-18 07:37:05 +00:00
|
|
|
/**
|
|
|
|
* Custom icon template.
|
|
|
|
*/
|
|
|
|
icon(): VNode[];
|
2023-04-10 19:42:57 +00:00
|
|
|
/**
|
|
|
|
* Custom remove icon template of chip component.
|
|
|
|
* @param {Object} scope - remove icon slot's params.
|
|
|
|
*/
|
|
|
|
removeicon(scope: {
|
|
|
|
/**
|
|
|
|
* Remove icon click event
|
2023-08-16 06:32:15 +00:00
|
|
|
* @param {Event} event - Browser event
|
2023-10-31 17:21:47 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'removeCallback' property instead.
|
2023-04-10 19:42:57 +00:00
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
onClick: (event: Event) => void;
|
2023-04-10 19:42:57 +00:00
|
|
|
/**
|
|
|
|
* Remove icon keydown event
|
2023-08-16 06:32:15 +00:00
|
|
|
* @param {Event} event - Browser event
|
2023-10-31 17:21:47 +00:00
|
|
|
* @deprecated since v3.39.0. Use 'keydownCallback' property instead.
|
2023-04-10 19:42:57 +00:00
|
|
|
*/
|
2023-08-17 07:16:25 +00:00
|
|
|
onKeydown: (event: Event) => void;
|
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;
|
2023-04-10 19:42:57 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:12:09 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Chip component.
|
|
|
|
*/
|
|
|
|
export interface ChipEmits {
|
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
|
|
|
|
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
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class Chip extends ClassComponent<ChipProps, ChipSlots, ChipEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Chip: GlobalComponentConstructor<Chip>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Chip;
|