{"version":3,"file":"RankingCollapse.BFSn1vtJ.mjs","names":["useState","useMemo","Children","useCallback"],"sources":["https:/framerusercontent.com/modules/9BvRBCYWGzxuWyHpBMWK/qW42clJX7pMEXHqpbYyr/RankingCollapse.js"],"sourcesContent":["/**\n * User request:\n * Create Framer code overrides for ranking-card body collapse on a Japanese supplement LP.\n * The override is applied to the body frame, keeps the first N children visible, collapses children from index N onward,\n * appends a full-width toggle button, supports split variants (default/after3/after4/after6),\n * avoids extra gaps in a vertical stack, is SSR/static-render safe, and uses framer/framer-motion only.\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{Children,startTransition,useCallback,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion,useReducedMotion}from\"framer-motion\";function createRankingCollapseImplementation(visibleCount,Component){return function RankingCollapseWithVisibleCount(props){const isStaticRenderer=useIsStaticRenderer();const prefersReducedMotion=useReducedMotion();const[expanded,setExpanded]=useState(isStaticRenderer);const allChildren=useMemo(()=>Children.toArray(props.children),[props.children]);const alwaysVisibleChildren=useMemo(()=>allChildren.slice(0,visibleCount),[allChildren,visibleCount]);const collapsibleChildren=useMemo(()=>allChildren.slice(visibleCount),[allChildren,visibleCount]);const hasCollapsibleContent=collapsibleChildren.length>0;const isOpen=isStaticRenderer||expanded;const handleToggle=useCallback(()=>{if(isStaticRenderer)return;startTransition(()=>{setExpanded(prev=>!prev);});},[isStaticRenderer]);if(!hasCollapsibleContent){return /*#__PURE__*/_jsx(Component,{...props});}return /*#__PURE__*/_jsxs(Component,{...props,children:[alwaysVisibleChildren,prefersReducedMotion?isOpen?/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":false,style:{position:\"relative\",width:\"100%\"},children:collapsibleChildren}):null:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:isOpen?/*#__PURE__*/_jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:\"auto\",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:[.22,1,.36,1]},style:{position:\"relative\",width:\"100%\",overflow:\"hidden\"},\"aria-hidden\":false,children:collapsibleChildren},\"ranking-collapse-content\"):null}),!isStaticRenderer&&/*#__PURE__*/_jsxs(\"button\",{type:\"button\",role:\"button\",\"aria-expanded\":isOpen,\"aria-label\":isOpen?\"詳細を閉じる\":\"商品の詳細を見る\",onClick:handleToggle,style:{position:\"relative\",width:\"100%\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,background:\"#FFFFFF\",color:\"#15344A\",border:\"1px solid #D6E7F2\",borderRadius:999,padding:\"12px 18px\",fontSize:\"14px\",fontWeight:700,lineHeight:1.2,cursor:\"pointer\",appearance:\"none\",WebkitAppearance:\"none\",outline:\"none\",boxShadow:\"none\",WebkitTapHighlightColor:\"transparent\",touchAction:\"manipulation\"},children:[/*#__PURE__*/_jsx(\"span\",{children:isOpen?\"詳細を閉じる\":\"商品の詳細を見る\"}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{lineHeight:1},children:isOpen?\"▴\":\"▾\"})]})]});};}export function withRankingCollapse(Component){return createRankingCollapseImplementation(5,Component);}export function withRankingCollapseAfter3(Component){return createRankingCollapseImplementation(3,Component);}export function withRankingCollapseAfter4(Component){return createRankingCollapseImplementation(4,Component);}export function withRankingCollapseAfter6(Component){return createRankingCollapseImplementation(6,Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withRankingCollapseAfter4\":{\"type\":\"reactHoc\",\"name\":\"withRankingCollapseAfter4\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRankingCollapseAfter6\":{\"type\":\"reactHoc\",\"name\":\"withRankingCollapseAfter6\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRankingCollapseAfter3\":{\"type\":\"reactHoc\",\"name\":\"withRankingCollapseAfter3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRankingCollapse\":{\"type\":\"reactHoc\",\"name\":\"withRankingCollapse\",\"annotations\":{\"framerContractVersion\":\"1\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