{"version":3,"file":"createRemoteComponent.mjs","names":[],"sources":["../../../src/lib/createRemoteComponent.ts"],"sourcesContent":["import { version } from \"@/version\";\nimport { useControlledRemoteValueProps } from \"@mittwald/flow-react-components/flr-universal\";\nimport { FlowRemoteElement } from \"@mittwald/flow-remote-elements\";\nimport { createRemoteComponent as libCreateRemoteComponent } from \"@mittwald/remote-dom-react\";\nimport { createElement } from \"react\";\n\nconst controlledComponentNames: (keyof HTMLElementTagNameMap)[] = [\n  \"flr-markdown-editor\",\n  \"flr-number-field\",\n  \"flr-password-creation-field\",\n  \"flr-search-field\",\n  \"flr-text-field\",\n  \"flr-text-area\",\n];\n\nexport const createRemoteComponent: typeof libCreateRemoteComponent = (\n  name,\n  element,\n  options,\n) => {\n  const RemoteComponent = libCreateRemoteComponent(name, element, options);\n  return (props) => {\n    const isControlledComponent = controlledComponentNames.includes(\n      name as keyof HTMLElementTagNameMap,\n    );\n\n    return createElement(RemoteComponent, {\n      [FlowRemoteElement.initializationPropertyName]: true,\n      [FlowRemoteElement.versionPropertyName]: version,\n      ...(isControlledComponent ? useControlledRemoteValueProps(props) : props),\n    });\n  };\n};\n"],"mappings":";;;;;;;;AAMA,IAAM,2BAA4D;CAChE;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAa,2BACX,MACA,SACA,YACG;CACH,MAAM,kBAAkB,sBAAyB,MAAM,SAAS,OAAO;CACvE,QAAQ,UAAU;EAChB,MAAM,wBAAwB,yBAAyB,SACrD,IACF;EAEA,OAAO,cAAc,iBAAiB;IACnC,kBAAkB,6BAA6B;IAC/C,kBAAkB,sBAAsB;GACzC,GAAI,wBAAwB,8BAA8B,KAAK,IAAI;EACrE,CAAC;CACH;AACF"}