UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 2.18 kB
import e from"primevue/icons/timescircle";import{openBlock as n,createElementBlock as i,normalizeClass as o,renderSlot as t,Fragment as l,createBlock as c,resolveDynamicComponent as s,createCommentVNode as a,toDisplayString as r}from"vue";var p={name:"Chip",emits:["remove"],props:{label:{type:String,default:null},icon:{type:String,default:null},image:{type:String,default:null},removable:{type:Boolean,default:!1},removeIcon:{type:String,default:void 0}},data:()=>({visible:!0}),methods:{onKeydown(e){"Enter"!==e.key&&"Backspace"!==e.key||this.close(e)},close(e){this.visible=!1,this.$emit("remove",e)}},computed:{containerClass(){return["p-chip p-component",{"p-chip-image":null!=this.image}]}},components:{TimesCircleIcon:e}};const d=["aria-label"],m=["src"],h={key:3,class:"p-chip-text"};!function(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===i&&o.firstChild?o.insertBefore(t,o.firstChild):o.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}}("\n.p-chip {\n display: inline-flex;\n align-items: center;\n}\n.p-chip-text {\n line-height: 1.5;\n}\n.p-chip-icon.pi {\n line-height: 1.5;\n}\n.p-chip-remove-icon {\n line-height: 1.5;\n cursor: pointer;\n}\n.p-chip img {\n border-radius: 50%;\n}\n"),p.render=function(e,p,u,y,v,f){return v.visible?(n(),i("div",{key:0,class:o(f.containerClass),"aria-label":u.label},[t(e.$slots,"default"),e.$slots.default?a("",!0):(n(),i(l,{key:0},[u.image?(n(),i("img",{key:0,src:u.image},null,8,m)):e.$slots.icon?(n(),c(s(e.$slots.icon),{key:1,class:"p-chip-icon"})):u.icon?(n(),i("span",{key:2,class:o(["p-chip-icon",u.icon])},null,2)):a("",!0),u.label?(n(),i("div",h,r(u.label),1)):a("",!0)],64)),u.removable?t(e.$slots,"removeicon",{key:1,onClick:f.close,onKeydown:f.onKeydown},(()=>[(n(),c(s(u.removeIcon?"span":"TimesCircleIcon"),{tabindex:"0",class:o(["p-chip-remove-icon",u.removeIcon]),onClick:f.close,onKeydown:f.onKeydown},null,40,["class","onClick","onKeydown"]))])):a("",!0)],10,d)):a("",!0)};export{p as default};