@copilotkit/a2ui-renderer
Version:
A2UI Renderer for CopilotKit - render A2UI surfaces in React applications
1 lines • 2.3 kB
Source Map (JSON)
{"version":3,"file":"Text.cjs","names":["z","CommonSchemas","createReactComponent"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/minimal/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 { createReactComponent } from \"../../../adapter\";\nimport { z } from \"zod\";\nimport { CommonSchemas } from \"@a2ui/web_core/v0_9\";\n\nexport const TextSchema = z.object({\n text: CommonSchemas.DynamicString,\n variant: z.enum([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"caption\", \"body\"]).optional(),\n});\n\nexport const TextApiDef = {\n name: \"Text\",\n schema: TextSchema,\n};\n\nexport const Text = createReactComponent(TextApiDef, ({ props }) => {\n const text = props.text ?? \"\";\n switch (props.variant) {\n case \"h1\":\n return <h1>{text}</h1>;\n case \"h2\":\n return <h2>{text}</h2>;\n case \"h3\":\n return <h3>{text}</h3>;\n case \"h4\":\n return <h4>{text}</h4>;\n case \"h5\":\n return <h5>{text}</h5>;\n case \"caption\":\n return <small>{text}</small>;\n case \"body\":\n default:\n return <span>{text}</span>;\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,aAAaA,MAAE,OAAO;CACjC,MAAMC,kCAAc;CACpB,SAASD,MAAE,KAAK;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;EAAW;EAAO,CAAC,CAAC,UAAU;CAC9E,CAAC;AAEF,MAAa,aAAa;CACxB,MAAM;CACN,QAAQ;CACT;AAED,MAAa,OAAOE,qCAAqB,aAAa,EAAE,YAAY;CAClE,MAAM,OAAO,MAAM,QAAQ;AAC3B,SAAQ,MAAM,SAAd;EACE,KAAK,KACH,QAAO,2CAAC,kBAAI,OAAU;EACxB,KAAK,KACH,QAAO,2CAAC,kBAAI,OAAU;EACxB,KAAK,KACH,QAAO,2CAAC,kBAAI,OAAU;EACxB,KAAK,KACH,QAAO,2CAAC,kBAAI,OAAU;EACxB,KAAK,KACH,QAAO,2CAAC,kBAAI,OAAU;EACxB,KAAK,UACH,QAAO,2CAAC,qBAAO,OAAa;EAE9B,QACE,QAAO,2CAAC,oBAAM,OAAY;;EAE9B"}