import{_ as e,b as t,s as n}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as r}from"./create-CGAkPJkS.js";import{m as i}from"./dom-BXiDqs7-.js";import{t as a}from"./Ripple-DUI3t__o.js";import{i as o,l as s,n as c,s as l,t as u}from"./QIcon-cTVL6ikA.js";import{n as d,t as f}from"./use-dark-B6e4te0z.js";var p={xs:8,sm:10,md:14,lg:20,xl:24},m=r({name:`QChip`,props:{...d,...s,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(r,{slots:s,emit:d}){let{proxy:{$q:m}}=e(),h=f(r,m),g=l(r,p),_=n(()=>r.selected||r.icon!==void 0),v=n(()=>r.selected?r.iconSelected||m.iconSet.chip.selected:r.icon),y=n(()=>r.iconRemove||m.iconSet.chip.remove),b=n(()=>!r.disable&&(r.clickable||r.selected!==null)),x=n(()=>{let e=r.outline&&r.color||r.textColor;return`q-chip row inline no-wrap items-center`+(!r.outline&&r.color!==void 0?` bg-${r.color}`:``)+(e?` text-${e} q-chip--colored`:``)+(r.disable?` disabled`:``)+(r.dense?` q-chip--dense`:``)+(r.outline?` q-chip--outline`:``)+(r.selected?` q-chip--selected`:``)+(b.value?` q-chip--clickable cursor-pointer non-selectable q-hoverable`:``)+(r.square?` q-chip--square`:``)+(h.value?` q-chip--dark q-dark`:``)}),S=n(()=>{let e=r.disable?{tabindex:-1,"aria-disabled":`true`}:{tabindex:r.tabindex||0};return{chip:e,remove:{...e,role:`button`,"aria-hidden":`false`,"aria-label":r.removeAriaLabel||m.lang.label.remove}}});function C(e){e.keyCode===13&&w(e)}function w(e){r.disable||(d(`update:selected`,!r.selected),d(`click`,e))}function T(e){(e.keyCode===void 0||e.keyCode===13)&&(i(e),r.disable||(d(`update:modelValue`,!1),d(`remove`)))}function E(){let e=[];b.value&&e.push(t(`div`,{class:`q-focus-helper`})),_.value&&e.push(t(u,{class:`q-chip__icon q-chip__icon--left`,name:v.value}));let n=r.label===void 0?void 0:[t(`div`,{class:`ellipsis`},[r.label])];return e.push(t(`div`,{class:`q-chip__content col row no-wrap items-center q-anchor--skip`},o(s.default,n))),r.iconRight&&e.push(t(u,{class:`q-chip__icon q-chip__icon--right`,name:r.iconRight})),r.removable&&e.push(t(u,{class:`q-chip__icon q-chip__icon--remove cursor-pointer`,name:y.value,...S.value.remove,onClick:T,onKeyup:T})),e}return()=>{if(!r.modelValue)return;let e={class:x.value,style:g.value};return b.value&&Object.assign(e,S.value.chip,{onClick:w,onKeyup:C}),c(`div`,e,E(),`ripple`,r.ripple!==!1&&!r.disable,()=>[[a,r.ripple]])}}});export{m as t};