/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{ref as e,computed as t,onMounted as l,onBeforeUnmount as r,openBlock as a,createElementBlock as i,createElementVNode as d,normalizeStyle as o,renderSlot as u,toDisplayString as n,normalizeClass as s,withDirectives as c,Fragment as v,renderList as g,vShow as p}from"vue";import './SelectMenu2.css';import './SelectMenu.css';/* empty css               *//* empty css               */import b from"../../../../_virtual/_plugin-vue_export-helper.js";const y=["disabled","title"],m={class:"text-[14px]"},f=["onClick"],x=/* @__PURE__ */b({__name:"SelectMenu",props:{items:{type:Array,required:!0},disabled:{type:Boolean,default:!1},selectedLabel:{type:String,default:""},selectedValue:{type:[String,Number],default:null},valueKey:{type:String,default:"value"},minWidth:{type:[String,Number],default:120},triggerWidth:{type:[String,Number],default:null}},emits:["select"],setup(b,{emit:x}){const h=b,k=x,W=e(null),_=e(!1),w=t(()=>"number"==typeof h.minWidth?`${h.minWidth}px`:h.minWidth||"120px"),S=t(()=>({minWidth:w.value,maxHeight:"240px",overflowY:"auto"})),L=t(()=>null===h.triggerWidth||void 0===h.triggerWidth||""===h.triggerWidth?w.value:"number"==typeof h.triggerWidth?`${h.triggerWidth}px`:h.triggerWidth),V=t(()=>({minWidth:L.value})),K=()=>{h.disabled||(_.value=!_.value)},E=()=>{_.value=!1},$=e=>!(e=>"function"!=typeof e?.canExecute||e.canExecute())(e),j=e=>void 0!==e?.name?e.name:void 0!==e?.id?e.id:e&&h.valueKey&&void 0!==e[h.valueKey]?e[h.valueKey]:h.items.indexOf(e),A=e=>e?void 0!==e.title?e.title:void 0!==e.label?e.label:"":"",C=e=>"function"==typeof e?.isActive?e.isActive():null!==h.selectedValue&&void 0!==h.selectedValue?e?.[h.valueKey]===h.selectedValue:void 0!==e?.active?Boolean(e.active):!!h.selectedLabel&&A(e)===h.selectedLabel,M=t(()=>{if(h.selectedLabel)return h.selectedLabel;if(null!==h.selectedValue&&void 0!==h.selectedValue){const e=h.items.find(e=>e?.[h.valueKey]===h.selectedValue);if(e)return A(e)}const e=h.items.find(e=>C(e));return e?A(e):"Table"}),N=e=>{W.value&&!W.value.contains(e.target)&&E()};return l(()=>{document.addEventListener("click",N)}),r(()=>{document.removeEventListener("click",N)}),(e,t)=>(a(),i("div",{ref_key:"dropdownRef",ref:W,class:"relative"},[d("button",{class:"select-button hover:bg-black/5 hover:border-black/10 hover:text-gray-850 disabled:cursor-not-allowed disabled:opacity-30 relative pr-4 dropdown-trigger dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:border-gray-200 dark:hover:bg-gray-700 dark:hover:border-gray-600",disabled:b.disabled,title:M.value,style:o(V.value),onClick:K},[u(e.$slots,"trigger",{label:M.value},()=>[d("span",m,n(M.value),1)],!0),d("span",{class:s(["absolute right-2 text-[10px] text-gray-600 transition-transform duration-150 dropdown-arrow",{"rotate-180":_.value}])}," ▼ ",2)],12,y),c(d("div",{class:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded shadow-[0_2px_8px_rgba(0,0,0,0.15)] z-[1000] p-1 dark:bg-gray-800 dark:border-gray-700",style:o(S.value)},[(a(!0),i(v,null,g(b.items,t=>(a(),i("div",{key:j(t),class:s(["flex items-center gap-2 p-2 cursor-pointer transition-colors duration-150 text-gray-850 text-[14px] dark:text-gray-100",{"bg-blue-500/15 text-blue-500":C(t),"cursor-not-allowed opacity-30":$(t)}]),onClick:e=>!$(t)&&(e=>{k("select",e),E()})(t)},[u(e.$slots,"option",{item:t},()=>[d("span",null,n(A(t)),1)],!0)],10,f))),128))],4),[[p,_.value]])],512))}},[["__scopeId","data-v-a3ae093b"]]);export{x as default};