{"version":3,"file":"InterviewDepartmentFilter.cFCl5zRL.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/cgm1KzuRdSrOmHCi9c43/SCuFV9VCUgv6m1IQXAY2/InterviewDepartmentFilter.js"],"sourcesContent":["// 部署フィルターをピルボタンで表示するコンポーネント\n// Framer標準のCMS select要素を検出し、ボタンクリックでselectのvalueを変更して\n// Framer内蔵のフィルタリング機能をそのまま活用する\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useCallback,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";/**\n * CMSフィルター（ピルボタン）\n *\n * Framer CMS の select フィルターと連動し、ピルボタン UI で表示する\n * interview、news等のCMSコンテンツで使用可能\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function CMSFilter(props){const{allLabel=\"すべて\",categories=\"営業技術, 営業補佐, 製造設計, 製缶, 組立\",accentColor=\"rgb(5, 80, 174)\",textColor=\"rgb(5, 80, 174)\",activeTextColor=\"#FFFFFF\",hoverBgColor=\"rgba(5, 80, 174, 0.08)\",borderWidth=1.5,borderRadius=9999,alignment=\"center\",gap=8,paddingV=5,paddingH=16,font,selectName=\"\",style}=props;const[active,setActive]=useState(\"_all_\");const[options,setOptions]=useState([]);const containerRef=useRef(null);// select要素を検出してオプションを取得\nuseEffect(()=>{if(typeof window===\"undefined\")return;if(RenderTarget.current()!==RenderTarget.preview){// エディタ上ではpropsからカテゴリを生成\nconst cats=categories.split(\",\").map(c=>c.trim()).filter(Boolean);const opts=[{value:\"_all_\",label:allLabel},...cats.map(c=>({value:c,label:c}))];startTransition(()=>setOptions(opts));return;}// プレビュー/公開サイトでは実際のselect要素からオプションを読み取る\nconst findSelect=()=>{// selectName が指定されていればそれで検索\nif(selectName){return document.querySelector(`select[name=\"${selectName}\"]`);}// なければ framer-form-input クラスの select を探す\nreturn document.querySelector(\"select.framer-form-input\");};// MutationObserverでselect要素の出現を待つ\nlet observer=null;const initFromSelect=()=>{const select=findSelect();if(!select)return false;const opts=[];for(const opt of Array.from(select.options)){if(opt.value){opts.push({value:opt.value,label:opt.textContent||opt.value});}}if(opts.length>0){startTransition(()=>{setOptions(opts);setActive(select.value||\"_all_\");});// select要素の親ラッパーを非表示にする\nconst wrapper=select.closest(\".framer-form-input-wrapper\");if(wrapper){wrapper.style.display=\"none\";}// ssr-variant ラッパーも非表示\nconst ssrVariant=select.closest(\".ssr-variant\");if(ssrVariant){ssrVariant.style.position=\"absolute\";ssrVariant.style.opacity=\"0\";ssrVariant.style.pointerEvents=\"none\";ssrVariant.style.height=\"0\";ssrVariant.style.overflow=\"hidden\";}}return opts.length>0;};// 即座に試行\nif(!initFromSelect()){// select がまだDOMにない場合は監視\nobserver=new MutationObserver(()=>{if(initFromSelect()){observer?.disconnect();}});observer.observe(document.body,{childList:true,subtree:true});}return()=>{observer?.disconnect();};},[allLabel,categories,selectName]);// ボタンクリック時にselect要素のvalueを変更してイベントを発火\nconst handleClick=useCallback(value=>{startTransition(()=>setActive(value));if(typeof window===\"undefined\")return;if(RenderTarget.current()!==RenderTarget.preview)return;const findSelect=()=>{if(selectName){return document.querySelector(`select[name=\"${selectName}\"]`);}return document.querySelector(\"select.framer-form-input\");};const select=findSelect();if(!select)return;// selectのvalueを設定\nselect.value=value;// Framerがリッスンしているイベントを発火\nconst nativeInputValueSetter=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,\"value\")?.set;if(nativeInputValueSetter){nativeInputValueSetter.call(select,value);}select.dispatchEvent(new Event(\"change\",{bubbles:true}));select.dispatchEvent(new Event(\"input\",{bubbles:true}));},[selectName]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,position:\"relative\",display:\"flex\",flexWrap:\"wrap\",justifyContent:alignment,gap},role:\"tablist\",\"aria-label\":\"部署フィルター\",children:options.map(opt=>{const isActive=opt.value===active;return /*#__PURE__*/_jsx(motion.button,{role:\"tab\",\"aria-selected\":isActive,onClick:()=>handleClick(opt.value),animate:isActive?\"active\":\"inactive\",variants:{inactive:{backgroundColor:\"transparent\",color:textColor,borderColor:accentColor},active:{backgroundColor:accentColor,color:activeTextColor,borderColor:accentColor}},whileHover:isActive?{}:{backgroundColor:hoverBgColor},whileTap:{scale:.95},transition:{type:\"tween\",duration:.2,ease:[.4,0,.2,1]},style:{padding:`${paddingV}px ${paddingH}px`,borderRadius,borderWidth,borderStyle:\"solid\",cursor:\"pointer\",whiteSpace:\"nowrap\",outline:\"none\",...font},children:opt.label},opt.value);})});}addPropertyControls(CMSFilter,{allLabel:{type:ControlType.String,title:\"「全て」ラベル\",defaultValue:\"すべて\"},categories:{type:ControlType.String,title:\"カテゴリ一覧\",defaultValue:\"営業技術, 営業補佐, 製造設計, 製缶, 組立\",displayTextArea:true,description:\"カンマ区切りでカテゴリ名を入力（エディタ用）\"},selectName:{type:ControlType.String,title:\"Select名\",defaultValue:\"\",description:\"Framer CMS フィルターのselect name属性（空欄で自動検出）\"},accentColor:{type:ControlType.Color,title:\"アクセント色\",defaultValue:\"rgb(5, 80, 174)\"},textColor:{type:ControlType.Color,title:\"テキスト色\",defaultValue:\"rgb(5, 80, 174)\"},activeTextColor:{type:ControlType.Color,title:\"選択時テキスト色\",defaultValue:\"#FFFFFF\"},hoverBgColor:{type:ControlType.Color,title:\"ホバー時背景\",defaultValue:\"rgba(5, 80, 174, 0.08)\"},alignment:{type:ControlType.Enum,title:\"配置\",defaultValue:\"center\",options:[\"flex-start\",\"center\",\"flex-end\"],optionTitles:[\"左揃え\",\"中央揃え\",\"右揃え\"]},borderRadius:{type:ControlType.Number,title:\"角丸\",defaultValue:9999,min:0,max:9999,step:1,unit:\"px\"},borderWidth:{type:ControlType.Number,title:\"ボーダー幅\",defaultValue:1.5,min:0,max:4,step:.5,unit:\"px\"},gap:{type:ControlType.Number,title:\"ボタン間隔\",defaultValue:8,min:0,max:24,step:2,unit:\"px\"},paddingV:{type:ControlType.Number,title:\"上下パディング\",defaultValue:5,min:2,max:16,step:1,unit:\"px\"},paddingH:{type:ControlType.Number,title:\"左右パディング\",defaultValue:16,min:4,max:32,step:2,unit:\"px\"},font:{type:ControlType.Font,title:\"フォント\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"13px\",variant:\"Medium\",lineHeight:\"1.6em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSFilter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"600\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"40\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InterviewDepartmentFilter.map"],"mappings":"4QAcG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,WAAS,MAAM,aAAW,2BAA2B,cAAY,kBAAkB,YAAU,kBAAkB,kBAAgB,UAAU,eAAa,yBAAyB,cAAY,IAAI,eAAa,KAAK,YAAU,SAAS,MAAI,EAAE,WAAS,EAAE,WAAS,GAAG,OAAK,aAAW,GAAG,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,QAAQ,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAC,CAAO,EAAaC,EAAO,KAAK,CACnc,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,GAAG,EAAa,SAAS,GAAG,EAAa,QAAQ,CACtG,IAAM,EAAK,EAAW,MAAM,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAO,EAAK,CAAC,CAAC,MAAM,QAAQ,MAAM,EAAS,CAAC,GAAG,EAAK,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAoB,EAAW,EAAK,CAAC,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