UNPKG

@wordpress/components

Version:
1 lines • 1.41 kB
{"version":3,"file":"component.cjs","names":["useText","View","contextConnect"],"sources":["../../src/text/component.tsx"],"sourcesContent":["import type { WordPressComponentProps } from '../context';\nimport { contextConnect } from '../context';\nimport { View } from '../view';\nimport useText from './hook';\nimport type { Props } from './types';\n\n/**\n * @param props\n * @param forwardedRef\n */\nfunction UnconnectedText(\n\tprops: WordPressComponentProps< Props, 'span' >,\n\tforwardedRef: React.ForwardedRef< any >\n) {\n\tconst textProps = useText( props );\n\n\treturn <View as=\"span\" { ...textProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Text` is a core component that renders text in the library, using the\n * library's typography system.\n *\n * `Text` can be used to render any text-content, like an HTML `p` or `span`.\n *\n * @example\n *\n * ```jsx\n * import { __experimentalText as Text } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn <Text>Code is Poetry</Text>;\n * }\n * ```\n */\nexport const Text = contextConnect( UnconnectedText, 'Text' );\nexport default Text;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,gBACR,OACA,cACC;CACD,MAAM,aAAA,GAAYA,UAAAA,QAAAA,CAAS,KAAM;CAEjC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,MAAD;EAAM,IAAG;EAAO,GAAK;EAAY,KAAM;CAAgB,CAAA;AAC/D;;;;;;;;;;;;;;;;;AAkBA,MAAa,QAAA,GAAOC,oBAAAA,eAAAA,CAAgB,iBAAiB,MAAO"}