UNPKG

@copilotkit/a2ui-renderer

Version:

A2UI Renderer for CopilotKit - render A2UI surfaces in React applications

1 lines 1.65 kB
{"version":3,"file":"text.mjs","names":[],"sources":["../../../../src/web-components/catalog/minimal/text.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { CommonSchemas } from \"@a2ui/web_core/v0_9\";\nimport { z } from \"zod\";\nimport { createLitComponent } from \"../../adapter\";\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 = createLitComponent(TextApiDef, ({ props }) => {\n const text = props.text ?? \"\";\n switch (props.variant) {\n case \"h1\":\n return html`<h1>${text}</h1>`;\n case \"h2\":\n return html`<h2>${text}</h2>`;\n case \"h3\":\n return html`<h3>${text}</h3>`;\n case \"h4\":\n return html`<h4>${text}</h4>`;\n case \"h5\":\n return html`<h5>${text}</h5>`;\n case \"caption\":\n return html`<small>${text}</small>`;\n case \"body\":\n default:\n return html`<span>${text}</span>`;\n }\n});\n"],"mappings":";;;;;;AAKA,MAAa,aAAa,EAAE,OAAO;CACjC,MAAM,cAAc;CACpB,SAAS,EAAE,KAAK;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;EAAW;EAAO,CAAC,CAAC,UAAU;CAC9E,CAAC;AAEF,MAAa,aAAa;CACxB,MAAM;CACN,QAAQ;CACT;AAED,MAAa,OAAO,mBAAmB,aAAa,EAAE,YAAY;CAChE,MAAM,OAAO,MAAM,QAAQ;AAC3B,SAAQ,MAAM,SAAd;EACE,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,UACH,QAAO,IAAI,UAAU,KAAK;EAE5B,QACE,QAAO,IAAI,SAAS,KAAK;;EAE7B"}