@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
1 lines • 1.42 kB
Source Map (JSON)
{"version":3,"sources":["../src/figure/figure.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface FigureProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @example\n *\n * ```tsx\n * <Figure>\n * <img src=\"https://placedog.net/500/280\" alt=\"A very good dog\" />\n * <figcaption>Dogs are the best</figcaption>\n * </Figure>\n * ```\n */\nexport const Figure = forwardRef<HTMLQuoteElement, FigureProps>(\n ({ children, asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"figure\";\n return (\n <Component ref={ref} className={clsx(\"hds-figure\", className as undefined)} {...rest}>\n {children}\n </Component>\n );\n },\n);\nFigure.displayName = \"Figure\";\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AA2BrB;AAJC,IAAM,SAAS;AAAA,EACpB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,YAAU,SAAS,UA1BxB,IA0BG,IAAmC,iBAAnC,IAAmC,CAAjC,YAAU,WAAS;AACpB,UAAM,YAAY,UAAU,OAAO;AACnC,WACE,oBAAC,0CAAU,KAAU,WAAW,KAAK,cAAc,SAAsB,KAAO,OAA/E,EACE,WACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}