@wordpress/components
Version:
UI components for WordPress.
1 lines • 1.63 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":["forwardRef"],"sources":["../../src/color-indicator/index.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { forwardRef } from '@wordpress/element';\nimport type { WordPressComponentProps } from '../context';\nimport type { ColorIndicatorProps } from './types';\n\nfunction UnforwardedColorIndicator(\n\tprops: WordPressComponentProps< ColorIndicatorProps, 'span', false >,\n\tforwardedRef: ForwardedRef< HTMLSpanElement >\n) {\n\tconst { className, colorValue, ...additionalProps } = props;\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ clsx( 'component-color-indicator', className ) }\n\t\t\tstyle={ { background: colorValue } }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\n/**\n * ColorIndicator is a React component that renders a specific color in a\n * circle. It's often used to summarize a collection of used colors in a child\n * component.\n *\n * ```jsx\n * import { ColorIndicator } from '@wordpress/components';\n *\n * const MyColorIndicator = () => <ColorIndicator colorValue=\"#0073aa\" />;\n * ```\n */\nexport const ColorIndicator = forwardRef( UnforwardedColorIndicator );\nColorIndicator.displayName = 'ColorIndicator';\n\nexport default ColorIndicator;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,0BACR,OACA,cACC;CACD,MAAM,EAAE,WAAW,YAAY,GAAG,oBAAoB;CAEtD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACC,YAAA,GAAY,KAAA,QAAA,CAAM,6BAA6B,SAAU;EACzD,OAAQ,EAAE,YAAY,WAAW;EACjC,KAAM;EACN,GAAK;CACL,CAAA;AAEH;;;;;;;;;;;;AAaA,MAAa,kBAAA,GAAiBA,mBAAAA,WAAAA,CAAY,yBAA0B;AACpE,eAAe,cAAc"}