/*!
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
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./SelectMenu2.css');require('./SelectMenu.css');const e=require("vue");/* empty css                  */;/* empty css                 */const t=require("../../../../_virtual/_plugin-vue_export-helper.js"),l=["disabled","title"],r={class:"text-[14px]"},a=["onClick"],i={__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(t,{emit:i}){const o=t,d=i,n=e.ref(null),u=e.ref(!1),s=e.computed(()=>"number"==typeof o.minWidth?`${o.minWidth}px`:o.minWidth||"120px"),c=e.computed(()=>({minWidth:s.value,maxHeight:"240px",overflowY:"auto"})),v=e.computed(()=>null===o.triggerWidth||void 0===o.triggerWidth||""===o.triggerWidth?s.value:"number"==typeof o.triggerWidth?`${o.triggerWidth}px`:o.triggerWidth),p=e.computed(()=>({minWidth:v.value})),g=()=>{o.disabled||(u.value=!u.value)},m=()=>{u.value=!1},b=e=>!(e=>"function"!=typeof e?.canExecute||e.canExecute())(e),y=e=>void 0!==e?.name?e.name:void 0!==e?.id?e.id:e&&o.valueKey&&void 0!==e[o.valueKey]?e[o.valueKey]:o.items.indexOf(e),f=e=>e?void 0!==e.title?e.title:void 0!==e.label?e.label:"":"",x=e=>"function"==typeof e?.isActive?e.isActive():null!==o.selectedValue&&void 0!==o.selectedValue?e?.[o.valueKey]===o.selectedValue:void 0!==e?.active?Boolean(e.active):!!o.selectedLabel&&f(e)===o.selectedLabel,h=e.computed(()=>{if(o.selectedLabel)return o.selectedLabel;if(null!==o.selectedValue&&void 0!==o.selectedValue){const e=o.items.find(e=>e?.[o.valueKey]===o.selectedValue);if(e)return f(e)}const e=o.items.find(e=>x(e));return e?f(e):"Table"}),k=e=>{n.value&&!n.value.contains(e.target)&&m()};return e.onMounted(()=>{document.addEventListener("click",k)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",k)}),(i,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dropdownRef",ref:n,class:"relative"},[e.createElementVNode("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:t.disabled,title:h.value,style:e.normalizeStyle(p.value),onClick:g},[e.renderSlot(i.$slots,"trigger",{label:h.value},()=>[e.createElementVNode("span",r,e.toDisplayString(h.value),1)],!0),e.createElementVNode("span",{class:e.normalizeClass(["absolute right-2 text-[10px] text-gray-600 transition-transform duration-150 dropdown-arrow",{"rotate-180":u.value}])}," ▼ ",2)],12,l),e.withDirectives(e.createElementVNode("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:e.normalizeStyle(c.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,t=>(e.openBlock(),e.createElementBlock("div",{key:y(t),class:e.normalizeClass(["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":x(t),"cursor-not-allowed opacity-30":b(t)}]),onClick:e=>!b(t)&&(e=>{d("select",e),m()})(t)},[e.renderSlot(i.$slots,"option",{item:t},()=>[e.createElementVNode("span",null,e.toDisplayString(f(t)),1)],!0)],10,a))),128))],4),[[e.vShow,u.value]])],512))}},o=t.default(i,[["__scopeId","data-v-a3ae093b"]]);exports.default=o;