UNPKG

@wordpress/icons

Version:
8 lines (7 loc) 1.12 kB
{ "version": 3, "sources": ["../../src/icon/index.ts"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { cloneElement, forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport type { ReactElement } from 'react';\nimport type { SVGProps } from '@wordpress/primitives';\n\nexport interface IconProps extends SVGProps {\n\t/**\n\t * The SVG component to render\n\t */\n\ticon: ReactElement;\n\t/**\n\t * The size of the icon in pixels\n\t *\n\t * @default 24\n\t */\n\tsize?: number;\n}\n\n/**\n * Return an SVG icon.\n *\n * @param props The component props.\n *\n * @return Icon component\n */\nexport default forwardRef< HTMLElement, IconProps >(\n\t( { icon, size = 24, ...props }: IconProps, ref ) => {\n\t\treturn cloneElement( icon, {\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...props,\n\t\t\tref,\n\t\t} );\n\t}\n);\n"], "mappings": ";AAGA,SAAS,cAAc,kBAAkB;AA4BzC,IAAO,eAAQ;AAAA,EACd,CAAE,EAAE,MAAM,OAAO,IAAI,GAAG,MAAM,GAAc,QAAS;AACpD,WAAO,aAAc,MAAM;AAAA,MAC1B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,MACH;AAAA,IACD,CAAE;AAAA,EACH;AACD;", "names": [] }