import{C as e,ft as t,m as n,o as r,s as i,u as a,ut as o}from"./runtime-core.esm-bundler-DTXUv7Wx.js";import{t as s}from"./Icon-CtR1FGIT.js";var c={class:`inline-flex items-center rounded-pill border border-line bg-paper font-sans`},l=[`disabled`,`aria-label`],u=[`disabled`,`aria-label`],d={__name:`QuantityStepper`,props:{modelValue:{type:Number,required:!0},min:{type:Number,default:0},max:{type:Number,default:1/0},disabled:{type:Boolean,default:!1},size:{type:String,default:`md`,validator:e=>[`sm`,`md`].includes(e)},decreaseLabel:{type:String,default:`Decrease`},increaseLabel:{type:String,default:`Increase`}},emits:[`update:modelValue`,`decrease`,`increase`],setup(d,{emit:f}){let p=d,m=f,h={sm:{btn:`w-8 h-8`,icon:14,label:`text-[13px]`},md:{btn:`w-9 h-9`,icon:16,label:`text-[14px]`}},g=r(()=>h[p.size]),_=r(()=>!p.disabled&&p.modelValue>p.min),v=r(()=>!p.disabled&&p.modelValue<p.max);function y(){if(!_.value)return;let e=p.modelValue-1;m(`update:modelValue`,e),m(`decrease`,e)}function b(){if(!v.value)return;let e=p.modelValue+1;m(`update:modelValue`,e),m(`increase`,e)}return(r,f)=>(e(),a(`div`,c,[i(`button`,{type:`button`,class:o([g.value.btn,`inline-flex items-center justify-center rounded-l-pill text-brand transition-colors`,`hover:bg-brand-wash disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`]),disabled:!_.value,"aria-label":d.decreaseLabel,onClick:y},[n(s,{name:`minus`,size:g.value.icon},null,8,[`size`])],10,l),i(`span`,{class:o([`min-w-[2ch] px-2 font-semibold text-ink tabular-nums text-center`,g.value.label]),"aria-live":`polite`},t(d.modelValue),3),i(`button`,{type:`button`,class:o([g.value.btn,`inline-flex items-center justify-center rounded-r-pill text-brand transition-colors`,`hover:bg-brand-wash disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`]),disabled:!v.value,"aria-label":d.increaseLabel,onClick:b},[n(s,{name:`plus`,size:g.value.icon},null,8,[`size`])],10,u)]))}};export{d as t};