UNPKG

@copilotkit/a2ui-renderer

Version:

A2UI Renderer for CopilotKit - render A2UI surfaces in React applications

1 lines 3.52 kB
{"version":3,"file":"Column.cjs","names":["z","CommonSchemas","createReactComponent","ChildList"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/minimal/components/Column.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\";\nimport { ChildList } from \"./ChildList\";\n\nexport const ColumnSchema = z.object({\n children: CommonSchemas.ChildList,\n justify: z\n .enum([\n \"start\",\n \"center\",\n \"end\",\n \"spaceBetween\",\n \"spaceAround\",\n \"spaceEvenly\",\n \"stretch\",\n ])\n .optional(),\n align: z.enum([\"center\", \"end\", \"start\", \"stretch\"]).optional(),\n});\n\nconst mapJustify = (j?: string) => {\n switch (j) {\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"spaceAround\":\n return \"space-around\";\n case \"spaceBetween\":\n return \"space-between\";\n case \"spaceEvenly\":\n return \"space-evenly\";\n case \"start\":\n return \"flex-start\";\n case \"stretch\":\n return \"stretch\";\n default:\n return \"flex-start\";\n }\n};\n\nconst mapAlign = (a?: string) => {\n switch (a) {\n case \"start\":\n return \"flex-start\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"stretch\":\n return \"stretch\";\n default:\n return \"stretch\";\n }\n};\n\nexport const ColumnApiDef = {\n name: \"Column\",\n schema: ColumnSchema,\n};\n\nexport const Column = createReactComponent(\n ColumnApiDef,\n ({ props, buildChild }) => {\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: mapJustify(props.justify),\n alignItems: mapAlign(props.align),\n gap: \"8px\",\n }}\n >\n <ChildList childList={props.children} buildChild={buildChild} />\n </div>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,eAAeA,MAAE,OAAO;CACnC,UAAUC,kCAAc;CACxB,SAASD,MACN,KAAK;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,CACD,UAAU;CACb,OAAOA,MAAE,KAAK;EAAC;EAAU;EAAO;EAAS;EAAU,CAAC,CAAC,UAAU;CAChE,CAAC;AAEF,MAAM,cAAc,MAAe;AACjC,SAAQ,GAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,eACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAM,YAAY,MAAe;AAC/B,SAAQ,GAAR;EACE,KAAK,QACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,eAAe;CAC1B,MAAM;CACN,QAAQ;CACT;AAED,MAAa,SAASE,qCACpB,eACC,EAAE,OAAO,iBAAiB;AACzB,QACE,2CAAC;EACC,OAAO;GACL,SAAS;GACT,eAAe;GACf,gBAAgB,WAAW,MAAM,QAAQ;GACzC,YAAY,SAAS,MAAM,MAAM;GACjC,KAAK;GACN;YAED,2CAACC;GAAU,WAAW,MAAM;GAAsB;IAAc;GAC5D;EAGX"}