UNPKG

@e280/authlocal

Version:

User-sovereign login system for everybody

35 lines (33 loc) 1.01 kB
import { debounce, html, shadowView } from "@benev/slate"; import stylesCss from "./styles.css.js"; import themeCss from "../../../theme.css.js"; import { inputString } from "../../../../tools/input-string.js"; export const Confirmer = shadowView(use => (options) => { use.name("confirmer"); use.styles(themeCss, stylesCss); const primed = use.signal(false); const onInput = debounce(100, (proposed) => { primed.value = proposed === options.requiredText; }); function clickConfirm() { if (primed.value) options.onConfirmed(); } return html ` <p>To confirm, enter <code theme-code>${options.requiredText}</code> exactly</p> <div class=box> <input type="text" theme-inputty theme-insetty @input="${inputString(onInput)}" /> <button theme-button theme-loud theme-angry ?disabled="${!primed.value}" @click="${clickConfirm}"> ${options.buttonLabel()} </button> </div> `; }); //# sourceMappingURL=view.js.map