import{a7 as e,aV as l,a$ as o,aX as i,b0 as a,a as c,b1 as n,Q as t,ax as s,b2 as r,aB as d,g as u,aU as p}from"./index.3938ccd1.js";const b={xs:8,sm:10,md:14,lg:20,xl:24};var v=e({name:"QChip",props:{...l,...o,dense:Boolean,icon:String,iconRight:String,iconRemove:String,iconSelected:String,label:[String,Number],color:String,textColor:String,modelValue:{type:Boolean,default:!0},selected:{type:Boolean,default:null},square:Boolean,outline:Boolean,clickable:Boolean,removable:Boolean,removeAriaLabel:String,tabindex:[String,Number],disable:Boolean,ripple:{type:[Boolean,Object],default:!0}},emits:["update:modelValue","update:selected","remove","click"],setup(e,{slots:l,emit:o}){const{proxy:{$q:v}}=u(),h=i(e,v),m=a(e,b),q=c((()=>!0===e.selected||void 0!==e.icon)),g=c((()=>!0===e.selected?e.iconSelected||v.iconSet.chip.selected:e.icon)),_=c((()=>e.iconRemove||v.iconSet.chip.remove)),f=c((()=>!1===e.disable&&(!0===e.clickable||null!==e.selected))),k=c((()=>{const l=!0===e.outline&&e.color||e.textColor;return"q-chip row inline no-wrap items-center"+(!1===e.outline&&void 0!==e.color?` bg-${e.color}`:"")+(l?` text-${l} q-chip--colored`:"")+(!0===e.disable?" disabled":"")+(!0===e.dense?" q-chip--dense":"")+(!0===e.outline?" q-chip--outline":"")+(!0===e.selected?" q-chip--selected":"")+(!0===f.value?" q-chip--clickable cursor-pointer non-selectable q-hoverable":"")+(!0===e.square?" q-chip--square":"")+(!0===h.value?" q-chip--dark q-dark":"")})),x=c((()=>{const l=!0===e.disable?{tabindex:-1,"aria-disabled":"true"}:{tabindex:e.tabindex||0};return{chip:l,remove:{...l,role:"button","aria-hidden":"false","aria-label":e.removeAriaLabel||v.lang.label.remove}}}));function S(e){13===e.keyCode&&y(e)}function y(l){e.disable||(o("update:selected",!e.selected),o("click",l))}function B(l){void 0!==l.keyCode&&13!==l.keyCode||(p(l),!1===e.disable&&(o("update:modelValue",!1),o("remove")))}return()=>{if(!1===e.modelValue)return;const o={class:k.value,style:m.value};return!0===f.value&&Object.assign(o,x.value.chip,{onClick:y,onKeyup:S}),n("div",o,function(){const o=[];!0===f.value&&o.push(t("div",{class:"q-focus-helper"})),!0===q.value&&o.push(t(s,{class:"q-chip__icon q-chip__icon--left",name:g.value}));const i=void 0!==e.label?[t("div",{class:"ellipsis"},[e.label])]:void 0;return o.push(t("div",{class:"q-chip__content col row no-wrap items-center q-anchor--skip"},r(l.default,i))),e.iconRight&&o.push(t(s,{class:"q-chip__icon q-chip__icon--right",name:e.iconRight})),!0===e.removable&&o.push(t(s,{class:"q-chip__icon q-chip__icon--remove cursor-pointer",name:_.value,...x.value.remove,onClick:B,onKeyup:B})),o}(),"ripple",!1!==e.ripple&&!0!==e.disable,(()=>[[d,e.ripple]]))}}});export{v as Q};
