@wordpress/components
Version:
UI components for WordPress.
1 lines • 1.99 kB
Source Map (JSON)
{"version":3,"file":"component.cjs","names":["useSurface","View","contextConnect"],"sources":["../../src/surface/component.tsx"],"sourcesContent":["import type { ForwardedRef } from 'react';\nimport deprecated from '@wordpress/deprecated';\nimport { contextConnect } from '../context';\nimport { View } from '../view';\nimport { useSurface } from './hook';\nimport type { SurfaceProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nfunction UnconnectedSurface(\n\tprops: WordPressComponentProps< SurfaceProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tdeprecated( 'wp.components.__experimentalSurface', {\n\t\tsince: '7.2',\n\t\tversion: '7.4',\n\t} );\n\n\tconst surfaceProps = useSurface( props );\n\n\treturn <View { ...surfaceProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Surface` is a core component that renders a primary background color.\n *\n * This component is deprecated. Write your own CSS instead,\n * preferably using the [design tokens](https://wordpress.github.io/gutenberg/?path=/docs/design-system-tokens-introduction--docs)\n * available in `@wordpress/theme`.\n *\n * @deprecated\n *\n * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).\n *\n * ```jsx\n * import {\n *\t__experimentalSurface as Surface,\n *\t__experimentalText as Text,\n * } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<Surface>\n * \t\t\t<Text>Code is Poetry</Text>\n * \t\t</Surface>\n * \t);\n * }\n * ```\n */\nexport const Surface = contextConnect( UnconnectedSurface, 'Surface' );\n\nexport default Surface;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,mBACR,OACA,cACC;CACD,CAAA,GAAA,sBAAA,QAAA,CAAY,uCAAuC;EAClD,OAAO;EACP,SAAS;CACV,CAAE;CAEF,MAAM,gBAAA,GAAeA,UAAAA,WAAAA,CAAY,KAAM;CAEvC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,MAAD;EAAM,GAAK;EAAe,KAAM;CAAgB,CAAA;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,WAAA,GAAUC,oBAAAA,eAAAA,CAAgB,oBAAoB,SAAU"}