@pdf-viewer/react
Version:
The PDF Viewer component for React and Next.js
59 lines (58 loc) • 2.56 kB
JavaScript
import { jsx as a, jsxs as t } from "react/jsx-runtime";
import { useState as c } from "react";
import { c as o } from "../../clsx-0c6e471a.js";
import { useLocalizationContext as u } from "../../contexts/LocalizationContext.js";
import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
import '../../assets/PasswordModal.css';const r = {
"rp-password-overlay": "_rp-password-overlay_18s56_1",
"rp-password-modal": "_rp-password-modal_18s56_13",
"rp-password-title": "_rp-password-title_18s56_27",
"rp-password-content": "_rp-password-content_18s56_35",
"rp-password-form": "_rp-password-form_18s56_41",
"rp-password-input": "_rp-password-input_18s56_45",
"rp-password-input-invalid": "_rp-password-input-invalid_18s56_62",
"rp-password-message-invalid": "_rp-password-message-invalid_18s56_66",
"rp-password-submit-button": "_rp-password-submit-button_18s56_72"
}, C = () => {
const [p, e] = c(""), { localeMessages: s } = u(), { setPassword: l, invalidPassword: i } = _(), m = (d) => {
e(d.target.value);
}, n = (d) => {
d.preventDefault(), p && p.trim() && l(p);
}, w = !p.trim();
return /* @__PURE__ */ a("div", { className: o(r["rp-password-overlay"]), children: /* @__PURE__ */ t("div", { className: o(r["rp-password-modal"]), children: [
/* @__PURE__ */ a("div", { className: o(r["rp-password-title"]), children: s == null ? void 0 : s.passwordModalTitle }),
/* @__PURE__ */ a("div", { className: o(r["rp-password-content"]), children: s == null ? void 0 : s.passwordModalMessage }),
/* @__PURE__ */ t("form", { onSubmit: n, children: [
/* @__PURE__ */ t("div", { className: o(r["rp-password-form"]), children: [
/* @__PURE__ */ a(
"input",
{
type: "password",
value: p,
onChange: m,
className: o(
r["rp-password-input"],
i && r["rp-password-input-invalid"]
),
placeholder: "Enter password",
autoComplete: "off"
}
),
/* @__PURE__ */ a("div", { className: o(r["rp-password-message-invalid"]), children: i && /* @__PURE__ */ a("span", { children: "Incorrect password" }) })
] }),
/* @__PURE__ */ a(
"button",
{
type: "submit",
disabled: w,
className: o(r["rp-password-submit-button"]),
onClick: n,
children: s == null ? void 0 : s.passwordConfirmLabel
}
)
] })
] }) });
};
export {
C as default
};