UNPKG

@copilotkit/a2ui-renderer

Version:

A2UI Renderer for CopilotKit - render A2UI surfaces in React applications

1 lines 2.35 kB
{"version":3,"file":"Text.cjs","names":["createReactComponent","TextApi","getBaseLeafStyle"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/Text.tsx"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport { createReactComponent } from \"../../../adapter\";\nimport { TextApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { getBaseLeafStyle } from \"../utils\";\n\nexport const Text = createReactComponent(TextApi, ({ props }) => {\n const text = props.text ?? \"\";\n const style: React.CSSProperties = {\n ...getBaseLeafStyle(),\n display: \"inline-block\",\n };\n\n switch (props.variant) {\n case \"h1\":\n return <h1 style={style}>{text}</h1>;\n case \"h2\":\n return <h2 style={style}>{text}</h2>;\n case \"h3\":\n return <h3 style={style}>{text}</h3>;\n case \"h4\":\n return <h4 style={style}>{text}</h4>;\n case \"h5\":\n return <h5 style={style}>{text}</h5>;\n case \"caption\":\n return (\n <small style={{ ...style, color: \"#666\", textAlign: \"left\" }}>\n {text}\n </small>\n );\n case \"body\":\n default:\n return <span style={style}>{text}</span>;\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,OAAOA,qCAAqBC,4CAAU,EAAE,YAAY;CAC/D,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,QAA6B;EACjC,GAAGC,gCAAkB;EACrB,SAAS;EACV;AAED,SAAQ,MAAM,SAAd;EACE,KAAK,KACH,QAAO,2CAAC;GAAU;aAAQ;IAAU;EACtC,KAAK,KACH,QAAO,2CAAC;GAAU;aAAQ;IAAU;EACtC,KAAK,KACH,QAAO,2CAAC;GAAU;aAAQ;IAAU;EACtC,KAAK,KACH,QAAO,2CAAC;GAAU;aAAQ;IAAU;EACtC,KAAK,KACH,QAAO,2CAAC;GAAU;aAAQ;IAAU;EACtC,KAAK,UACH,QACE,2CAAC;GAAM,OAAO;IAAE,GAAG;IAAO,OAAO;IAAQ,WAAW;IAAQ;aACzD;IACK;EAGZ,QACE,QAAO,2CAAC;GAAY;aAAQ;IAAY;;EAE5C"}