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

173 lines
3.9 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';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2023-04-21 13:24:22 +00:00
export declare type ChipPassThroughOptionType = ChipPassThroughAttributes | ((options: ChipPassThroughMethodOptions) => ChipPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface ChipPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-04-21 13:24:22 +00:00
props: ChipProps;
state: ChipState;
}
/**
* Custom passthrough(pt) options.
* @see {@link ChipProps.pt}
*/
export interface ChipPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: ChipPassThroughOptionType;
/**
* Uses to pass attributes to the image's DOM element.
*/
image?: ChipPassThroughOptionType;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: ChipPassThroughOptionType;
/**
* Uses to pass attributes to the label' DOM element.
*/
label?: ChipPassThroughOptionType;
/**
* Uses to pass attributes to the removeIcon's DOM element.
*/
removeIcon?: ChipPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @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.
* @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.
* @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
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {ChipPassThroughOptions}
*/
pt?: ChipPassThroughOptions;
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: {
/**
* Remove icon click event
*/
onClick(): void;
/**
* Remove icon keydown event
*/
onKeydown(): void;
}): 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;