{"version":3,"file":"check-box.mjs","names":[],"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,WAAW,mBAAmB,cAAc,EAAE,YAAY;CACrE,MAAM,UAAU,SAAS,WAAW;CACpC,MAAM,WAAW,MAAM,oBAAoB,MAAM,iBAAiB,SAAS;AAC3E,QAAO,IAAI;;cAEC,SAAS;EACf,SAAS;EACT,eAAe;EACf,QAAQ;EACT,CAAC,CAAC;;;;eAIM,QAAQ;;qBAEF,CAAC,CAAC,MAAM,MAAM;qBACd,MACT,MAAM,SAAU,EAAE,OAA4B,QAAQ,CAAC;kBACjD,SAAS;EACf,QAAQ;EACR,SAAS,WAAW,kBAAkB;EACvC,CAAC,CAAC;;UAGH,MAAM,QACF,IAAI;oBACE,QAAQ;sBACN,SAAS;EACf,QAAQ;EACR,OAAO,WAAW,QAAQ;EAC3B,CAAC,CAAC;iBACA,MAAM,MAAM;iBAEf,QACL;;QAGD,WACI,IAAI;;eAED,MAAM,mBAAmB,GAAG;eAE/B,QACL;;;EAGL"}