import{a6 as e,aU as l,a_ as o,aW as a,a$ as i,a as n,b0 as c,Q as t,aw as s,b1 as r,aA as d,g as u,aT as p}from"./index.9313841a.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=a(e,v),m=i(e,b),q=n((()=>!0===e.selected||void 0!==e.icon)),g=n((()=>!0===e.selected?e.iconSelected||v.iconSet.chip.selected:e.icon)),_=n((()=>e.iconRemove||v.iconSet.chip.remove)),f=n((()=>!1===e.disable&&(!0===e.clickable||null!==e.selected))),k=n((()=>{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":"")})),S=n((()=>{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 x(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,S.value.chip,{onClick:y,onKeyup:x}),c("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 a=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,a))),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,...S.value.remove,onClick:B,onKeyup:B})),o}(),"ripple",!1!==e.ripple&&!0!==e.disable,(()=>[[d,e.ripple]]))}}});export{v as Q};
