@upbudget/belvo-js
Version:
React component for Belvo
27 lines • 885 B
JavaScript
import React, { cloneElement, forwardRef } from "react";
import { useBelvoWidget } from "../hooks/use-belvo-widget";
const BelvoConnectButton = forwardRef(({ asChild, children, config }, ref) => {
const { connect, scriptReady } = useBelvoWidget(config);
const common = {
ref,
disabled: !scriptReady,
onClick: () => connect()
};
if (asChild && children && typeof children.props === "object") {
return cloneElement(children, { ...common, ...children.props });
}
return /* @__PURE__ */ React.createElement(
"button",
{
type: "button",
...common,
className: "inline-flex items-center rounded-md bg-indigo-600 px-4 py-2 text-white disabled:opacity-50"
},
"Conectar Conta Banc\xE1ria"
);
});
BelvoConnectButton.displayName = "BelvoConnectButton";
export {
BelvoConnectButton
};
//# sourceMappingURL=belvo-widget-button.js.map