{"version":3,"file":"JobSelector.CX0DPH-O.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/Ep9q6mjDwxUybOfVo4QE/heMZ1XDi8gV7gfPXjmZ7/JobSelector.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";export default function JobSelector(props){const{options,placeholder,tint,bgColor,textColor,borderRadius,padding,fontSize,inputName,required}=props;const[isOpen,setIsOpen]=React.useState(false);const[selected,setSelected]=React.useState(\"\");const[isError,setIsError]=React.useState(false)// State lỗi\n;const containerRef=React.useRef(null);React.useEffect(()=>{const handleClickOutside=event=>{if(containerRef.current&&!containerRef.current.contains(event.target)){setIsOpen(false);}};document.addEventListener(\"mousedown\",handleClickOutside);return()=>document.removeEventListener(\"mousedown\",handleClickOutside);},[]);const handleSelect=option=>{setSelected(option);setIsOpen(false);setIsError(false)// Chọn xong thì hết lỗi\n;};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",position:\"relative\",fontFamily:\"Inter, sans-serif\"},children:[/*#__PURE__*/_jsx(\"input\",{tabIndex:-1,autoComplete:\"off\",style:{opacity:0,width:\"100%\",height:\"1px\",position:\"absolute\",bottom:0,left:0,pointerEvents:\"none\",zIndex:-1},value:selected,required:required,onInvalid:e=>{e.preventDefault()// Ngăn popup mặc định xấu xí\n;setIsError(true)// Bật viền đỏ\n;}}),/*#__PURE__*/_jsxs(\"div\",{onClick:()=>setIsOpen(!isOpen),style:{width:\"100%\",padding:`${padding}px`,background:bgColor,color:selected?textColor:\"#999\",// Nếu lỗi thì viền đỏ, không thì như cũ\nborder:`1px solid ${isError?\"#FF4444\":isOpen?tint:\"#E5E5E5\"}`,borderRadius:`${borderRadius}px`,fontSize:`${fontSize}px`,cursor:\"pointer\",display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",transition:\"border 0.2s\",userSelect:\"none\"},children:[/*#__PURE__*/_jsx(\"span\",{children:selected||placeholder}),/*#__PURE__*/_jsx(motion.svg,{animate:{rotate:isOpen?180:0},width:\"12\",height:\"12\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:selected?textColor:\"#999\",strokeWidth:\"3\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 9l6 6 6-6\"})})]}),/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:inputName,value:selected}),/*#__PURE__*/_jsx(AnimatePresence,{children:isOpen&&/*#__PURE__*/_jsx(motion.ul,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},style:{position:\"absolute\",top:\"110%\",left:0,right:0,background:bgColor,border:\"1px solid #E5E5E5\",borderRadius:`${borderRadius}px`,boxShadow:\"0 10px 20px rgba(0,0,0,0.1)\",padding:\"5px\",margin:0,listStyle:\"none\",zIndex:100,maxHeight:\"200px\",overflowY:\"auto\"},children:options.map((option,index)=>/*#__PURE__*/_jsx(\"li\",{onClick:()=>handleSelect(option),style:{padding:\"10px\",fontSize:`${fontSize}px`,color:textColor,cursor:\"pointer\",borderRadius:`${borderRadius-2}px`,transition:\"0.2s\"},onMouseEnter:e=>e.currentTarget.style.background=\"#F5F5F5\",onMouseLeave:e=>e.currentTarget.style.background=\"transparent\",children:option},index))})})]});}addPropertyControls(JobSelector,{required:{type:ControlType.Boolean,title:\"Required\",defaultValue:true},inputName:{type:ControlType.String,title:\"Input Name\",defaultValue:\"JobPosition\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Chọn vị tr\\xed...\"},options:{type:ControlType.Array,control:{type:ControlType.String},defaultValue:[\"Designer\",\"Developer\",\"Marketing\",\"HR Manager\"],title:\"Danh s\\xe1ch\"},tint:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#0099FF\"},bgColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#333333\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:12},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:14}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"JobSelector\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./JobSelector.map"],"mappings":"uPAA2L,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,UAAQ,cAAY,OAAK,UAAQ,YAAU,eAAa,UAAQ,WAAS,YAAU,YAAU,EAAW,CAAC,EAAO,GAAWA,EAAe,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAe,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAe,GAAM,CACpd,EAAaC,EAAa,KAAK,CAAC,MAAoB,CAAC,IAAM,EAAmB,GAAO,CAAI,EAAa,SAAS,CAAC,EAAa,QAAQ,SAAS,EAAM,OAAO,EAAE,EAAU,GAAM,EAA8D,OAA1D,SAAS,iBAAiB,YAAY,EAAmB,KAAW,SAAS,oBAAoB,YAAY,EAAmB,EAAG,EAAE,CAAC,CAAC,IAAM,EAAa,GAAQ,CAAC,EAAY,EAAO,CAAC,EAAU,GAAM,CAAC,EAAW,GAAM,EAC9Y,OAAoB,EAAM,MAAM,CAAC,IAAI,EAAa,MAAM,CAAC,MAAM,OAAO,SAAS,WAAW,WAAW,oBAAoB,CAAC,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS,GAAG,aAAa,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,OAAO,OAAO,MAAM,SAAS,WAAW,OAAO,EAAE,KAAK,EAAE,cAAc,OAAO,OAAO,GAAG,CAAC,MAAM,EAAkB,WAAS,UAAU,GAAG,CAAC,EAAE,gBAAgB,CAChX,EAAW,GAAK,EACd,CAAC,CA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