UNPKG

@wordpress/components

Version:
1 lines • 1.44 kB
{"version":3,"file":"component.cjs","names":["useScrollable","View","contextConnect"],"sources":["../../src/scrollable/component.tsx"],"sourcesContent":["import type { ForwardedRef } from 'react';\nimport type { WordPressComponentProps } from '../context';\nimport { contextConnect } from '../context';\nimport { View } from '../view';\nimport { useScrollable } from './hook';\nimport type { ScrollableProps } from './types';\n\nexport function UnconnectedScrollable(\n\tprops: WordPressComponentProps< ScrollableProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst scrollableProps = useScrollable( props );\n\n\treturn <View { ...scrollableProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Scrollable` is a layout component that content in a scrollable container.\n *\n * ```jsx\n * import { __experimentalScrollable as Scrollable } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Scrollable style={ { maxHeight: 200 } }>\n * \t\t\t<div style={ { height: 500 } }>...</div>\n * \t\t</Scrollable>\n * \t);\n * }\n * ```\n */\nexport const Scrollable = contextConnect( UnconnectedScrollable, 'Scrollable' );\n\nexport default Scrollable;\n"],"mappings":";;;;;;;;;;AAOA,SAAgB,sBACf,OACA,cACC;CACD,MAAM,mBAAA,GAAkBA,UAAAA,cAAAA,CAAe,KAAM;CAE7C,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,MAAD;EAAM,GAAK;EAAkB,KAAM;CAAgB,CAAA;AAC3D;;;;;;;;;;;;;;;;AAiBA,MAAa,cAAA,GAAaC,oBAAAA,eAAAA,CAAgB,uBAAuB,YAAa"}