@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
62 lines (61 loc) • 2.68 kB
JavaScript
import { jsx as p, jsxs as t } from "react/jsx-runtime";
import { useState as u } from "react";
import { c as o } from "../../clsx-0c6e471a.js";
import { useLocalizationContext as c } from "../../contexts/LocalizationContext.js";
import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
import "../../utils/appConsole.js";
import "../../utils/hooks/useLocalization.js";
import "../../th_TH-d627cd51.js";
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"
}, y = () => {
const [a, m] = u(""), { localeMessages: s } = c(), { setPassword: e, invalidPassword: i } = _(), w = (d) => {
m(d.target.value);
}, n = (d) => {
d.preventDefault(), a && a.trim() && e(a);
}, l = !a.trim();
return /* @__PURE__ */ p("div", { className: o(r["rp-password-overlay"]), children: /* @__PURE__ */ t("div", { className: o(r["rp-password-modal"]), children: [
/* @__PURE__ */ p("div", { className: o(r["rp-password-title"]), children: s == null ? void 0 : s.passwordModalTitle }),
/* @__PURE__ */ p("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__ */ p(
"input",
{
type: "password",
value: a,
onChange: w,
className: o(
r["rp-password-input"],
i && r["rp-password-input-invalid"]
),
placeholder: s == null ? void 0 : s.passwordPlaceholder,
autoComplete: "off"
}
),
/* @__PURE__ */ p("div", { className: o(r["rp-password-message-invalid"]), children: i && /* @__PURE__ */ p("span", { children: s == null ? void 0 : s.passwordError }) })
] }),
/* @__PURE__ */ p(
"button",
{
type: "submit",
disabled: l,
className: o(r["rp-password-submit-button"]),
onClick: n,
children: s == null ? void 0 : s.passwordConfirmLabel
}
)
] })
] }) });
};
export {
y as default
};