remix-utils-rt
Version:
This package contains simple utility functions to use with [React Router](https://reactrouter.com/home).
12 lines • 1.22 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from "react";
const HoneypotContext = React.createContext({});
export function HoneypotInputs({ label = "Please leave this field blank", }) {
let context = React.useContext(HoneypotContext);
let { nameFieldName = "name__confirm", validFromFieldName = "from__confirm", encryptedValidFrom, } = context;
return (_jsxs("div", { id: `${nameFieldName}_wrap`, style: { display: "none" }, "aria-hidden": "true", children: [_jsx("label", { htmlFor: nameFieldName, children: label }), _jsx("input", { id: nameFieldName, name: nameFieldName, type: "text", defaultValue: "", autoComplete: "nope", tabIndex: -1 }), validFromFieldName && encryptedValidFrom ? (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: validFromFieldName, children: label }), _jsx("input", { id: validFromFieldName, name: validFromFieldName, type: "text", value: encryptedValidFrom, readOnly: true, autoComplete: "off", tabIndex: -1 })] })) : null] }));
}
export function HoneypotProvider({ children, ...context }) {
return (_jsx(HoneypotContext.Provider, { value: context, children: children }));
}
//# sourceMappingURL=honeypot.js.map