UNPKG

oneframe-react

Version:

Oneframe React ## Components, Hooks, Helper Functions & State Management

21 lines (20 loc) 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); const react_google_recaptcha_1 = __importDefault(require("react-google-recaptcha")); const lodash_1 = require("lodash"); const prop_types_1 = __importDefault(require("prop-types")); const ReCaptcha = (props) => { const { siteKey, size, onChange } = props; return react_1.default.createElement(react_google_recaptcha_1.default, { sitekey: siteKey, onChange: (val) => onChange && onChange(val), size: size || 'normal' }); }; ReCaptcha.propTypes = { size: prop_types_1.default.oneOf(['compact', 'normal', 'invisible', undefined]), siteKey: prop_types_1.default.string.isRequired, onChange: prop_types_1.default.func, }; exports.ReCaptchaTmp = ReCaptcha; exports.default = react_1.default.memo(ReCaptcha, (p, n) => lodash_1.isEqual(p.siteKey, n.siteKey) && lodash_1.isEqual(p.size, n.size));