@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":"Button.mjs","names":[],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/minimal/components/Button.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 { z } from \"zod\";\nimport { CommonSchemas } from \"@a2ui/web_core/v0_9\";\n\nexport const ButtonSchema = z.object({\n child: CommonSchemas.ComponentId,\n action: CommonSchemas.Action,\n variant: z.enum([\"primary\", \"borderless\"]).optional(),\n});\n\nexport const ButtonApiDef = {\n name: \"Button\",\n schema: ButtonSchema,\n};\n\nexport const Button = createReactComponent(\n ButtonApiDef,\n ({ props, buildChild }) => {\n const style: React.CSSProperties = {\n padding: \"8px 16px\",\n cursor: \"pointer\",\n border: props.variant === \"borderless\" ? \"none\" : \"1px solid #ccc\",\n backgroundColor: props.variant === \"primary\" ? \"#007bff\" : \"transparent\",\n color: props.variant === \"primary\" ? \"#fff\" : \"inherit\",\n borderRadius: \"4px\",\n };\n\n return (\n <button style={style} onClick={props.action}>\n {props.child ? buildChild(props.child) : null}\n </button>\n );\n },\n);\n"],"mappings":";;;;;;;AAqBA,MAAa,eAAe,EAAE,OAAO;CACnC,OAAO,cAAc;CACrB,QAAQ,cAAc;CACtB,SAAS,EAAE,KAAK,CAAC,WAAW,aAAa,CAAC,CAAC,UAAU;CACtD,CAAC;AAEF,MAAa,eAAe;CAC1B,MAAM;CACN,QAAQ;CACT;AAED,MAAa,SAAS,qBACpB,eACC,EAAE,OAAO,iBAAiB;AAUzB,QACE,oBAAC;EAAO,OAVyB;GACjC,SAAS;GACT,QAAQ;GACR,QAAQ,MAAM,YAAY,eAAe,SAAS;GAClD,iBAAiB,MAAM,YAAY,YAAY,YAAY;GAC3D,OAAO,MAAM,YAAY,YAAY,SAAS;GAC9C,cAAc;GACf;EAGuB,SAAS,MAAM;YAClC,MAAM,QAAQ,WAAW,MAAM,MAAM,GAAG;GAClC;EAGd"}