UNPKG

@wordpress/block-editor

Version:
8 lines (7 loc) 2.12 kB
{ "version": 3, "sources": ["../../../src/components/list-view/leaf.js"], "sourcesContent": ["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisDragged,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tclientId: props[ 'data-block' ],\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ clsx( 'block-editor-list-view-leaf', className ) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"], "mappings": ";AAGA,SAAS,gBAAgB;AACzB,OAAO,UAAU;AAKjB,SAAS,6BAA6B,mBAAmB;AACzD,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAK3B,OAAO,wBAAwB;AA4B5B;AA1BH,IAAM,sBAAsB,SAAU,WAAY;AAElD,IAAM,eAAe;AAAA,EACpB,CACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ,GACA,QACI;AACJ,UAAM,eAAe,mBAAoB;AAAA,MACxC,UAAU,MAAO,YAAa;AAAA,MAC9B,iBAAiB;AAAA,MACjB,0BAA0B;AAAA,IAC3B,CAAE;AAEF,UAAM,YAAY,aAAc,CAAE,KAAK,YAAa,CAAE;AAEtD,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,WAAY,KAAM,+BAA+B,SAAU;AAAA,QAC3D;AAAA,QACA,eAAgB;AAAA,QAChB,SAAU;AAAA,QACV,YAAa;AAAA,QACX,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEF;AACD;AAEA,IAAO,eAAQ;", "names": [] }