@wordpress/components
Version:
UI components for WordPress.
1 lines • 1.48 kB
Source Map (JSON)
{"version":3,"file":"component.mjs","names":[],"sources":["../../src/view/component.tsx"],"sourcesContent":["import { forwardRef } from '@wordpress/element';\nimport type { WordPressComponentProps } from '../context';\nimport { PolymorphicElement } from '../utils/polymorphic-element';\n\ntype ViewProps< T extends React.ElementType > = WordPressComponentProps<\n\t{},\n\tT\n> & {\n\t/**\n\t * Legacy Emotion prop accepted as a no-op by `View` so it does not leak to\n\t * the rendered element.\n\t *\n\t * @deprecated This prop no longer has any effect.\n\t * @ignore\n\t */\n\tcss?: unknown;\n};\n\nfunction UnforwardedView< T extends React.ElementType = 'div' >(\n\t{ css, ...restProps }: ViewProps< T >,\n\tref: React.ForwardedRef< any >\n) {\n\tvoid css;\n\treturn <PolymorphicElement ref={ ref } { ...restProps } />;\n}\n\n/**\n * `View` is a core component that renders everything in the library.\n * It is the principle component in the entire library.\n *\n * ```jsx\n * import { View } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<View>\n * \t\t\t Code is Poetry\n * \t\t</View>\n * \t);\n * }\n * ```\n */\nexport const View = Object.assign( forwardRef( UnforwardedView ), {\n\tselector: '.components-view',\n} );\n\nexport default View;\n"],"mappings":";;;;AAkBA,SAAS,gBACR,EAAE,KAAK,GAAG,aACV,KACC;CAED,OAAO,oBAAC,oBAAD;EAA0B;EAAM,GAAK;CAAa,CAAA;AAC1D;;;;;;;;;;;;;;;;;AAkBA,MAAa,OAAO,OAAO,OAAQ,WAAY,eAAgB,GAAG,EACjE,UAAU,mBACX,CAAE"}