@copilotkit/a2ui-renderer
Version:
A2UI Renderer for CopilotKit - render A2UI surfaces in React applications
1 lines • 2.37 kB
Source Map (JSON)
{"version":3,"file":"ChildList.mjs","names":[],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/ChildList.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 { type ComponentContext } from \"@a2ui/web_core/v0_9\";\n\nexport const ChildList: React.FC<{\n childList: unknown;\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => React.ReactNode;\n}> = ({ childList, buildChild }) => {\n if (Array.isArray(childList)) {\n return (\n <>\n {childList.map((item: unknown, i: number) => {\n // The new binder outputs objects like { id: string, basePath: string } for arrays of structural nodes\n if (item && typeof item === \"object\" && \"id\" in item) {\n const node = item as { id: string; basePath?: string };\n return (\n <React.Fragment key={`${node.id}-${i}`}>\n {buildChild(node.id, node.basePath)}\n </React.Fragment>\n );\n }\n // Fallback for static string lists\n if (typeof item === \"string\") {\n return (\n <React.Fragment key={`${item}-${i}`}>\n {buildChild(item)}\n </React.Fragment>\n );\n }\n return null;\n })}\n </>\n );\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,aAIP,EAAE,WAAW,iBAAiB;AAClC,KAAI,MAAM,QAAQ,UAAU,CAC1B,QACE,0CACG,UAAU,KAAK,MAAe,MAAc;AAE3C,MAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,MAAM;GACpD,MAAM,OAAO;AACb,UACE,oBAAC,MAAM,sBACJ,WAAW,KAAK,IAAI,KAAK,SAAS,IADhB,GAAG,KAAK,GAAG,GAAG,IAElB;;AAIrB,MAAI,OAAO,SAAS,SAClB,QACE,oBAAC,MAAM,sBACJ,WAAW,KAAK,IADE,GAAG,KAAK,GAAG,IAEf;AAGrB,SAAO;GACP,GACD;AAIP,QAAO"}