UNPKG

@copilotkit/a2ui-renderer

Version:

A2UI Renderer for CopilotKit - render A2UI surfaces in React applications

1 lines 2.4 kB
{"version":3,"file":"check-box.cjs","names":["createLitComponent","CheckBoxApi","uniqueId","LEAF_MARGIN","nothing"],"sources":["../../../../src/web-components/catalog/basic/check-box.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { CheckBoxApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { createLitComponent } from \"../../adapter\";\nimport { uniqueId } from \"./ids\";\nimport { LEAF_MARGIN } from \"./utils\";\n\nexport const CheckBox = createLitComponent(CheckBoxApi, ({ props }) => {\n const inputId = uniqueId(\"checkbox\");\n const hasError = props.validationErrors && props.validationErrors.length > 0;\n return html`\n <div\n style=${styleMap({\n display: \"flex\",\n flexDirection: \"column\",\n margin: LEAF_MARGIN,\n })}\n >\n <div style=\"display: flex; align-items: center; gap: 8px;\">\n <input\n id=${inputId}\n type=\"checkbox\"\n .checked=${!!props.value}\n @change=${(e: Event) =>\n props.setValue((e.target as HTMLInputElement).checked)}\n style=${styleMap({\n cursor: \"pointer\",\n outline: hasError ? \"1px solid red\" : \"none\",\n })}\n />\n ${\n props.label\n ? html`<label\n for=${inputId}\n style=${styleMap({\n cursor: \"pointer\",\n color: hasError ? \"red\" : \"inherit\",\n })}\n >${props.label}</label\n >`\n : nothing\n }\n </div>\n ${\n hasError\n ? html`<span\n style=\"font-size: 12px; color: red; margin-top: 4px;\"\n >${props.validationErrors?.[0]}</span\n >`\n : nothing\n }\n </div>\n `;\n});\n"],"mappings":";;;;;;;;AAOA,MAAa,WAAWA,mCAAmBC,gDAAc,EAAE,YAAY;CACrE,MAAM,UAAUC,qBAAS,WAAW;CACpC,MAAM,WAAW,MAAM,oBAAoB,MAAM,iBAAiB,SAAS;AAC3E,QAAO,QAAI;;wDAEU;EACf,SAAS;EACT,eAAe;EACf,QAAQC;EACT,CAAC,CAAC;;;;eAIM,QAAQ;;qBAEF,CAAC,CAAC,MAAM,MAAM;qBACd,MACT,MAAM,SAAU,EAAE,OAA4B,QAAQ,CAAC;4DACxC;EACf,QAAQ;EACR,SAAS,WAAW,kBAAkB;EACvC,CAAC,CAAC;;UAGH,MAAM,QACF,QAAI;oBACE,QAAQ;gEACG;EACf,QAAQ;EACR,OAAO,WAAW,QAAQ;EAC3B,CAAC,CAAC;iBACA,MAAM,MAAM;iBAEfC,YACL;;QAGD,WACI,QAAI;;eAED,MAAM,mBAAmB,GAAG;eAE/BA,YACL;;;EAGL"}