@copilotkit/a2ui-renderer
Version:
A2UI Renderer for CopilotKit - render A2UI surfaces in React applications
1 lines • 3.13 kB
Source Map (JSON)
{"version":3,"file":"DateTimeInput.mjs","names":[],"sources":["../../../../../../src/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.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 { DateTimeInputApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { LEAF_MARGIN, STANDARD_BORDER, STANDARD_RADIUS } from \"../utils\";\n\nexport const DateTimeInput = createReactComponent(\n DateTimeInputApi,\n ({ props }) => {\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n props.setValue(e.target.value);\n };\n\n const uniqueId = React.useId();\n\n // Map enableDate/enableTime to input type\n let type = \"datetime-local\";\n if (props.enableDate && !props.enableTime) type = \"date\";\n if (!props.enableDate && props.enableTime) type = \"time\";\n\n const style: React.CSSProperties = {\n padding: \"8px\",\n width: \"100%\",\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n }}\n >\n {props.label && (\n <label\n htmlFor={uniqueId}\n style={{ fontSize: \"14px\", fontWeight: \"bold\" }}\n >\n {props.label}\n </label>\n )}\n <input\n id={uniqueId}\n type={type}\n style={style}\n value={props.value || \"\"}\n onChange={onChange}\n min={typeof props.min === \"string\" ? props.min : undefined}\n max={typeof props.max === \"string\" ? props.max : undefined}\n />\n </div>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,qBAC3B,mBACC,EAAE,YAAY;CACb,MAAM,YAAY,MAA2C;AAC3D,QAAM,SAAS,EAAE,OAAO,MAAM;;CAGhC,MAAM,WAAW,MAAM,OAAO;CAG9B,IAAI,OAAO;AACX,KAAI,MAAM,cAAc,CAAC,MAAM,WAAY,QAAO;AAClD,KAAI,CAAC,MAAM,cAAc,MAAM,WAAY,QAAO;CAElD,MAAM,QAA6B;EACjC,SAAS;EACT,OAAO;EACP,QAAQ;EACR,cAAc;EACd,WAAW;EACZ;AAED,QACE,qBAAC;EACC,OAAO;GACL,SAAS;GACT,eAAe;GACf,KAAK;GACL,OAAO;GACP,QAAQ;GACT;aAEA,MAAM,SACL,oBAAC;GACC,SAAS;GACT,OAAO;IAAE,UAAU;IAAQ,YAAY;IAAQ;aAE9C,MAAM;IACD,EAEV,oBAAC;GACC,IAAI;GACE;GACC;GACP,OAAO,MAAM,SAAS;GACZ;GACV,KAAK,OAAO,MAAM,QAAQ,WAAW,MAAM,MAAM;GACjD,KAAK,OAAO,MAAM,QAAQ,WAAW,MAAM,MAAM;IACjD;GACE;EAGX"}