{"version":3,"file":"Tabs.cjs","names":["createReactComponent","TabsApi","LEAF_MARGIN"],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/Tabs.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 { useState } from \"react\";\nimport { createReactComponent } from \"../../../adapter\";\nimport { TabsApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { LEAF_MARGIN } from \"../utils\";\n\n// The type of a tab is deeply nested into the TabsApi schema, and\n// it seems z.infer is not inferring it correctly (?). We use `any` for now.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype _Tab = any;\n\nexport const Tabs = createReactComponent(TabsApi, ({ props, buildChild }) => {\n  const [selectedIndex, setSelectedIndex] = useState(0);\n\n  const tabs = props.tabs || [];\n  const activeTab = tabs[selectedIndex];\n\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        flexDirection: \"column\",\n        width: \"100%\",\n        margin: LEAF_MARGIN,\n      }}\n    >\n      <div\n        style={{\n          display: \"flex\",\n          borderBottom: \"1px solid #ccc\",\n          marginBottom: \"8px\",\n        }}\n      >\n        {tabs.map((tab: _Tab, i: number) => (\n          <button\n            key={i}\n            onClick={() => setSelectedIndex(i)}\n            style={{\n              padding: \"8px 16px\",\n              border: \"none\",\n              background: \"none\",\n              borderBottom:\n                selectedIndex === i\n                  ? \"2px solid var(--a2ui-primary-color, #007bff)\"\n                  : \"none\",\n              fontWeight: selectedIndex === i ? \"bold\" : \"normal\",\n              cursor: \"pointer\",\n              color:\n                selectedIndex === i\n                  ? \"var(--a2ui-primary-color, #007bff)\"\n                  : \"inherit\",\n            }}\n          >\n            {tab.title}\n          </button>\n        ))}\n      </div>\n      <div style={{ flex: 1 }}>\n        {activeTab ? buildChild(activeTab.child) : null}\n      </div>\n    </div>\n  );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,OAAOA,qCAAqBC,4CAAU,EAAE,OAAO,iBAAiB;CAC3E,MAAM,CAAC,eAAe,wCAA6B,EAAE;CAErD,MAAM,OAAO,MAAM,QAAQ,EAAE;CAC7B,MAAM,YAAY,KAAK;AAEvB,QACE,4CAAC;EACC,OAAO;GACL,SAAS;GACT,eAAe;GACf,OAAO;GACP,QAAQC;GACT;aAED,2CAAC;GACC,OAAO;IACL,SAAS;IACT,cAAc;IACd,cAAc;IACf;aAEA,KAAK,KAAK,KAAW,MACpB,2CAAC;IAEC,eAAe,iBAAiB,EAAE;IAClC,OAAO;KACL,SAAS;KACT,QAAQ;KACR,YAAY;KACZ,cACE,kBAAkB,IACd,iDACA;KACN,YAAY,kBAAkB,IAAI,SAAS;KAC3C,QAAQ;KACR,OACE,kBAAkB,IACd,uCACA;KACP;cAEA,IAAI;MAlBA,EAmBE,CACT;IACE,EACN,2CAAC;GAAI,OAAO,EAAE,MAAM,GAAG;aACpB,YAAY,WAAW,UAAU,MAAM,GAAG;IACvC;GACF;EAER"}