@alfadocs/ui-kit-debug 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/otp-input-xQ4Ps5VY.js +279 -0
- package/dist/_chunks/otp-input-xQ4Ps5VY.js.map +1 -0
- package/dist/_chunks/{pdf-viewer-4odMFuFW.js → pdf-viewer-XxWdtKfD.js} +63 -58
- package/dist/_chunks/pdf-viewer-XxWdtKfD.js.map +1 -0
- package/dist/_chunks/{sign-document-BzHTjMVC.js → sign-document-BmAT0kKD.js} +3 -3
- package/dist/_chunks/{sign-document-BzHTjMVC.js.map → sign-document-BmAT0kKD.js.map} +1 -1
- package/dist/_chunks/{signature-capture-CHbrKoA_.js → signature-capture-COi0Uiqu.js} +22 -7
- package/dist/_chunks/signature-capture-COi0Uiqu.js.map +1 -0
- package/dist/_chunks/use-signing-session-CyOZWinp.js +147 -0
- package/dist/_chunks/{use-signing-session-C5evzYmo.js.map → use-signing-session-CyOZWinp.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/otp-input/otp-input.d.ts +13 -1
- package/dist/components/otp-input/otp-input.d.ts.map +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/pdf-viewer/pdf-viewer.d.ts.map +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/components/signature-capture/signature-capture.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-signing-session.d.ts +8 -0
- package/dist/hooks/use-signing-session.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +2 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +2 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +2 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +2 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +2 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +2 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +2 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +2 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +2 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +2 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +2 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +2 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +2 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +2 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +2 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +2 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +2 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/locales/ar.json +2 -1
- package/dist/locales/de.json +2 -1
- package/dist/locales/el.json +2 -1
- package/dist/locales/en.json +2 -1
- package/dist/locales/es.json +2 -1
- package/dist/locales/fr.json +2 -1
- package/dist/locales/hi.json +2 -1
- package/dist/locales/it.json +2 -1
- package/dist/locales/ja.json +2 -1
- package/dist/locales/nl.json +2 -1
- package/dist/locales/pl.json +2 -1
- package/dist/locales/pt.json +2 -1
- package/dist/locales/ro.json +2 -1
- package/dist/locales/ru.json +2 -1
- package/dist/locales/sq.json +2 -1
- package/dist/locales/sv.json +2 -1
- package/dist/locales/tr.json +2 -1
- package/dist/locales/zh.json +2 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/otp-input-Chb9r5vf.js +0 -268
- package/dist/_chunks/otp-input-Chb9r5vf.js.map +0 -1
- package/dist/_chunks/pdf-viewer-4odMFuFW.js.map +0 -1
- package/dist/_chunks/signature-capture-CHbrKoA_.js.map +0 -1
- package/dist/_chunks/use-signing-session-C5evzYmo.js +0 -108
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { jsxs as re, jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ae, useId as se, useRef as R, useState as ne, useEffect as oe, useCallback as S, useMemo as ie, useImperativeHandle as ce } from "react";
|
|
3
|
+
import { c as Z } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as le } from "react-i18next";
|
|
5
|
+
import { u as ue } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as de } from "./use-web-otp-D_utzp6S.js";
|
|
7
|
+
import { u as pe } from "./form-field-context-B3APVHKx.js";
|
|
8
|
+
import { u as fe } from "./registry-nPAVE19X.js";
|
|
9
|
+
const ge = {
|
|
10
|
+
id: "otp-input",
|
|
11
|
+
capabilities: ["edit_inline", "submit"],
|
|
12
|
+
state: {
|
|
13
|
+
value: {
|
|
14
|
+
type: "string",
|
|
15
|
+
descriptionKey: "ui.agent.otpInput.state.value",
|
|
16
|
+
description: "Current digits entered, packed into a single string.",
|
|
17
|
+
read: (a) => a.getValue()
|
|
18
|
+
},
|
|
19
|
+
isComplete: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
descriptionKey: "ui.agent.otpInput.state.isComplete",
|
|
22
|
+
description: "Whether all required digits have been entered.",
|
|
23
|
+
read: (a) => a.isComplete()
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
actions: {
|
|
27
|
+
set_value: {
|
|
28
|
+
safety: "write",
|
|
29
|
+
argsType: "{ value: string }",
|
|
30
|
+
descriptionKey: "ui.agent.otpInput.actions.setValue",
|
|
31
|
+
description: "Replace the entered digits.",
|
|
32
|
+
invoke: (a, n) => {
|
|
33
|
+
a.setValue(n.value);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
clear: {
|
|
37
|
+
safety: "destructive",
|
|
38
|
+
descriptionKey: "ui.agent.otpInput.actions.clear",
|
|
39
|
+
description: "Empty all digit cells. Loses any typed value.",
|
|
40
|
+
invoke: (a) => {
|
|
41
|
+
a.clear();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
focus: {
|
|
45
|
+
safety: "read",
|
|
46
|
+
descriptionKey: "ui.agent.otpInput.actions.focus",
|
|
47
|
+
description: "Move keyboard focus to the active digit cell.",
|
|
48
|
+
invoke: (a) => {
|
|
49
|
+
a.focus();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
domHooks: {
|
|
54
|
+
root: {
|
|
55
|
+
attr: "data-component",
|
|
56
|
+
value: "otp-input",
|
|
57
|
+
description: "Marks the OTPInput wrapper. Completion is observable via state.isComplete; the host onComplete callback fires once when all digits are filled."
|
|
58
|
+
},
|
|
59
|
+
instanceId: {
|
|
60
|
+
attr: "data-component-id",
|
|
61
|
+
sourceProp: "id",
|
|
62
|
+
description: "Sourced from the id prop."
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, me = Z("ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"), he = Z(
|
|
66
|
+
[
|
|
67
|
+
"ds:w-[var(--min-target-size)] ds:h-[var(--min-target-size)]",
|
|
68
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
69
|
+
"ds:border ds:bg-input ds:text-foreground ds:text-center ds:font-medium ds:text-[length:var(--font-size-lg)]",
|
|
70
|
+
"ds:shadow-[var(--shadow-input)]",
|
|
71
|
+
"ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
72
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
73
|
+
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
74
|
+
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50"
|
|
75
|
+
].join(" "),
|
|
76
|
+
{
|
|
77
|
+
variants: {
|
|
78
|
+
tone: {
|
|
79
|
+
default: "ds:border-border",
|
|
80
|
+
error: "ds:border-destructive"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
defaultVariants: { tone: "default" }
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
function z(a) {
|
|
87
|
+
return a.replace(/[\u0660-\u0669]/g, (n) => String(n.charCodeAt(0) - 1632)).replace(/[\u06F0-\u06F9]/g, (n) => String(n.charCodeAt(0) - 1776));
|
|
88
|
+
}
|
|
89
|
+
const ve = 3, be = 10;
|
|
90
|
+
function ye(a) {
|
|
91
|
+
const n = Number.isFinite(a) ? Math.floor(a) : 6;
|
|
92
|
+
return Math.max(ve, Math.min(be, n));
|
|
93
|
+
}
|
|
94
|
+
function k(a, n, g) {
|
|
95
|
+
return (g === "alphanumeric" ? a.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(a).replace(/\D/g, "")).slice(0, n);
|
|
96
|
+
}
|
|
97
|
+
function we(a, n, g) {
|
|
98
|
+
const d = k(a, n, g), p = new Array(n).fill("");
|
|
99
|
+
for (let m = 0; m < d.length; m += 1)
|
|
100
|
+
p[m] = d[m];
|
|
101
|
+
return p;
|
|
102
|
+
}
|
|
103
|
+
const Ie = ae(
|
|
104
|
+
({
|
|
105
|
+
length: a = 6,
|
|
106
|
+
value: n,
|
|
107
|
+
defaultValue: g,
|
|
108
|
+
onChange: d,
|
|
109
|
+
onComplete: p,
|
|
110
|
+
disabled: m,
|
|
111
|
+
error: _,
|
|
112
|
+
label: V,
|
|
113
|
+
id: F,
|
|
114
|
+
className: $,
|
|
115
|
+
webOtp: j = !1,
|
|
116
|
+
name: E,
|
|
117
|
+
mode: i = "numeric"
|
|
118
|
+
}, U) => {
|
|
119
|
+
const { t: G } = le(), r = ye(a), b = pe(), W = se(), K = V ? W : void 0, [q, H] = ue({
|
|
120
|
+
value: n,
|
|
121
|
+
defaultValue: k(g ?? "", r, i)
|
|
122
|
+
}), h = k(q ?? "", r, i), x = we(h, r, i), y = b.disabled || !!m, O = b.invalid || !!_, X = O ? "error" : "default", P = R([]), D = R(h.length === r), f = R(h);
|
|
123
|
+
f.current = h;
|
|
124
|
+
const J = () => {
|
|
125
|
+
const t = h.length;
|
|
126
|
+
return t >= r ? r - 1 : t;
|
|
127
|
+
}, [v, A] = ne(J);
|
|
128
|
+
oe(() => {
|
|
129
|
+
v >= r && A(r - 1);
|
|
130
|
+
}, [v, r]);
|
|
131
|
+
const l = S(
|
|
132
|
+
(t) => {
|
|
133
|
+
const e = Math.max(0, Math.min(r - 1, t));
|
|
134
|
+
A(e);
|
|
135
|
+
const s = P.current[e];
|
|
136
|
+
s && (s.focus(), s.select());
|
|
137
|
+
},
|
|
138
|
+
[r]
|
|
139
|
+
), u = S(
|
|
140
|
+
(t) => {
|
|
141
|
+
const e = k(t, r, i);
|
|
142
|
+
H(e), f.current = e, d == null || d(e), e.length === r ? D.current || (D.current = !0, p == null || p(e)) : D.current = !1;
|
|
143
|
+
},
|
|
144
|
+
[H, r, i, d, p]
|
|
145
|
+
);
|
|
146
|
+
de({
|
|
147
|
+
enabled: j && !y,
|
|
148
|
+
onCode: u
|
|
149
|
+
});
|
|
150
|
+
const Q = (t) => (e) => {
|
|
151
|
+
const s = e.target.value, o = i === "alphanumeric" ? s.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(s).replace(/\D/g, ""), c = f.current;
|
|
152
|
+
if (o.length === 0) {
|
|
153
|
+
if (s === "" && t < c.length) {
|
|
154
|
+
const N = c.slice(0, t) + c.slice(t + 1);
|
|
155
|
+
u(N);
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const w = c.slice(0, t), T = c.slice(t + o.length), C = (w + o + T).slice(0, r);
|
|
160
|
+
u(C);
|
|
161
|
+
const L = Math.min(t + o.length, r - 1);
|
|
162
|
+
l(L);
|
|
163
|
+
}, Y = (t) => (e) => {
|
|
164
|
+
const s = f.current;
|
|
165
|
+
if (e.key === "Backspace") {
|
|
166
|
+
if (s[t]) {
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
const o = s.slice(0, t) + s.slice(t + 1);
|
|
169
|
+
u(o);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (t > 0) {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
const o = s.slice(0, t - 1) + s.slice(t);
|
|
175
|
+
u(o), l(t - 1);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (e.key === "ArrowLeft") {
|
|
180
|
+
e.preventDefault(), t > 0 && l(t - 1);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (e.key === "ArrowRight") {
|
|
184
|
+
e.preventDefault(), t < r - 1 && l(t + 1);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (e.key === "Home") {
|
|
188
|
+
e.preventDefault(), l(0);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
e.key === "End" && (e.preventDefault(), l(r - 1));
|
|
192
|
+
}, ee = (t) => (e) => {
|
|
193
|
+
const o = e.clipboardData.getData("text").replace(/\s+/g, ""), c = i === "alphanumeric" ? o.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(o);
|
|
194
|
+
if (i === "alphanumeric" ? c.length === 0 : !/^[0-9]+$/.test(c))
|
|
195
|
+
return;
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
const w = f.current, T = w.slice(0, t), C = w.slice(t + c.length), L = (T + c + C).slice(0, r);
|
|
198
|
+
u(L);
|
|
199
|
+
const N = Math.min(t + c.length, r - 1);
|
|
200
|
+
l(N);
|
|
201
|
+
}, te = (t) => (e) => {
|
|
202
|
+
A(t), e.currentTarget.select();
|
|
203
|
+
}, B = b.id, M = ie(
|
|
204
|
+
() => ({
|
|
205
|
+
getValue: () => f.current,
|
|
206
|
+
setValue: (t) => u(t),
|
|
207
|
+
clear: () => u(""),
|
|
208
|
+
focus: () => l(v),
|
|
209
|
+
isComplete: () => f.current.length === r
|
|
210
|
+
}),
|
|
211
|
+
[u, l, v, r]
|
|
212
|
+
);
|
|
213
|
+
return fe(ge, M, F), ce(U, () => M, [M]), /* @__PURE__ */ re("div", { className: me({ className: $ }), children: [
|
|
214
|
+
V ? /* @__PURE__ */ I(
|
|
215
|
+
"label",
|
|
216
|
+
{
|
|
217
|
+
id: K,
|
|
218
|
+
htmlFor: `${B}-0`,
|
|
219
|
+
className: "type-label ds:text-foreground",
|
|
220
|
+
children: V
|
|
221
|
+
}
|
|
222
|
+
) : null,
|
|
223
|
+
/* @__PURE__ */ I(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
role: "group",
|
|
227
|
+
dir: "ltr",
|
|
228
|
+
"aria-labelledby": K,
|
|
229
|
+
"aria-invalid": O || void 0,
|
|
230
|
+
"aria-describedby": b.describedBy || void 0,
|
|
231
|
+
"aria-disabled": y || void 0,
|
|
232
|
+
"data-component": "otp-input",
|
|
233
|
+
"data-component-id": F,
|
|
234
|
+
className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
235
|
+
children: x.map((t, e) => {
|
|
236
|
+
const s = !y && e === v;
|
|
237
|
+
return /* @__PURE__ */ I(
|
|
238
|
+
"input",
|
|
239
|
+
{
|
|
240
|
+
ref: (o) => {
|
|
241
|
+
P.current[e] = o;
|
|
242
|
+
},
|
|
243
|
+
id: `${B}-${e}`,
|
|
244
|
+
type: "text",
|
|
245
|
+
inputMode: i === "alphanumeric" ? "text" : "numeric",
|
|
246
|
+
pattern: i === "alphanumeric" ? "[A-Za-z0-9]*" : "[0-9]*",
|
|
247
|
+
autoCapitalize: i === "alphanumeric" ? "characters" : void 0,
|
|
248
|
+
autoComplete: e === 0 ? "one-time-code" : "off",
|
|
249
|
+
maxLength: 1,
|
|
250
|
+
value: t,
|
|
251
|
+
disabled: y,
|
|
252
|
+
tabIndex: s ? 0 : -1,
|
|
253
|
+
"aria-label": G(
|
|
254
|
+
i === "alphanumeric" ? "inputs.otp.charLabel" : "inputs.otp.digitLabel",
|
|
255
|
+
{
|
|
256
|
+
current: e + 1,
|
|
257
|
+
total: r
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
onChange: Q(e),
|
|
261
|
+
onKeyDown: Y(e),
|
|
262
|
+
onPaste: ee(e),
|
|
263
|
+
onFocus: te(e),
|
|
264
|
+
className: he({ tone: X })
|
|
265
|
+
},
|
|
266
|
+
e
|
|
267
|
+
);
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
E ? /* @__PURE__ */ I("input", { type: "hidden", name: E, value: h, readOnly: !0 }) : null
|
|
272
|
+
] });
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
Ie.displayName = "OTPInput";
|
|
276
|
+
export {
|
|
277
|
+
Ie as O
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=otp-input-xQ4Ps5VY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-input-xQ4Ps5VY.js","sources":["../../src/components/otp-input/otp-input.agent.ts","../../src/components/otp-input/otp-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — OTPInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { OTPInputHandle } from './otp-input';\n\nexport const otpInputAgent: AgentAdapter<OTPInputHandle> = {\n id: 'otp-input',\n capabilities: ['edit_inline', 'submit'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.otpInput.state.value',\n description: 'Current digits entered, packed into a single string.',\n read: (handle) => handle.getValue(),\n },\n isComplete: {\n type: 'boolean',\n descriptionKey: 'ui.agent.otpInput.state.isComplete',\n description: 'Whether all required digits have been entered.',\n read: (handle) => handle.isComplete(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n descriptionKey: 'ui.agent.otpInput.actions.setValue',\n description: 'Replace the entered digits.',\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n descriptionKey: 'ui.agent.otpInput.actions.clear',\n description: 'Empty all digit cells. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.otpInput.actions.focus',\n description: 'Move keyboard focus to the active digit cell.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'otp-input',\n description:\n 'Marks the OTPInput wrapper. Completion is observable via state.isComplete; the host onComplete callback fires once when all digits are filled.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ClipboardEvent,\n type FocusEvent,\n type KeyboardEvent,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useWebOtp } from '../../hooks/use-web-otp';\nimport { useFormField } from '../form-field/form-field-context';\nimport { useAgentRegistration } from '../../agent';\nimport { otpInputAgent } from './otp-input.agent';\n\nexport type OTPMode = 'numeric' | 'alphanumeric';\n\n/** Agent-readiness curated handle for OTPInput. */\nexport interface OTPInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n isComplete: () => boolean;\n}\n\nconst wrapperVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]');\n\nconst boxVariants = cva(\n [\n 'ds:w-[var(--min-target-size)] ds:h-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:border ds:bg-input ds:text-foreground ds:text-center ds:font-medium ds:text-[length:var(--font-size-lg)]',\n 'ds:shadow-[var(--shadow-input)]',\n 'ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n tone: {\n default: 'ds:border-border',\n error: 'ds:border-destructive',\n },\n },\n defaultVariants: { tone: 'default' },\n },\n);\n\nexport interface OTPInputProps {\n /**\n * Number of boxes. Default 6. Any integer in [3, 10] is honoured;\n * out-of-range values are clamped (with a DEV warning).\n */\n length?: number;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n onComplete?: (code: string) => void;\n disabled?: boolean;\n error?: boolean;\n label?: string;\n /** Stable id, used to address this instance from the agent runtime. */\n id?: string;\n className?: string;\n /**\n * Opt into Chrome-Android's WebOTP API for one-tap SMS autofill. When\n * the browser surfaces a matching SMS-bound credential, the kit spreads\n * the code across every digit box and fires `onComplete` automatically.\n *\n * Falls back silently to manual entry on Firefox / desktop / iOS — those\n * platforms either don't ship the API at all or rely on the\n * `autocomplete=\"one-time-code\"` QuickType heuristic the kit already\n * applies to the first input.\n *\n * Prerequisites the prop can't enforce: page must be HTTPS, and the SMS\n * body must end with `@<origin> #<code>` on its last line (Chrome's\n * spec — without it the browser refuses to surface the message).\n * Default `false` so the listener stays opt-in.\n */\n webOtp?: boolean;\n /**\n * When set, renders a hidden `<input name={name}>` kept in sync with the\n * packed code so consumers can POST the OTP declaratively, e.g.\n * `sms_code_form[code]`. Default off — no behaviour change.\n */\n name?: string;\n /**\n * Character set. `numeric` (default) accepts digits only (with Arabic-Indic\n * digit folding) — byte-identical to prior behaviour. `alphanumeric` accepts\n * `[A-Za-z0-9]`, uppercases the value, and switches the boxes to text input\n * (for SMS codes that mix letters and digits).\n */\n mode?: OTPMode;\n}\n\nfunction normaliseDigits(str: string): string {\n return str\n .replace(/[\\u0660-\\u0669]/g, (c) => String(c.charCodeAt(0) - 0x0660))\n .replace(/[\\u06F0-\\u06F9]/g, (c) => String(c.charCodeAt(0) - 0x06f0));\n}\n\nconst MIN_LENGTH = 3;\nconst MAX_LENGTH = 10;\n\n/** Clamp an arbitrary length into a sane range; DEV-warn if it had to. */\nfunction resolveLength(length: number): number {\n // Fall back to the default for non-finite input (e.g. `length={parseInt(x)}`\n // yielding NaN) so the component never reaches `new Array(NaN)`.\n const n = Number.isFinite(length) ? Math.floor(length) : 6;\n const clamped = Math.max(MIN_LENGTH, Math.min(MAX_LENGTH, n));\n if (import.meta.env.DEV && clamped !== length) {\n console.warn(\n `[OTPInput] length ${length} is out of range [${MIN_LENGTH}, ${MAX_LENGTH}] \\u2014 clamped to ${clamped}.`,\n );\n }\n return clamped;\n}\n\n/**\n * Filter + normalise a string to the mode's charset, then clamp to length.\n * - `numeric`: Arabic-Indic digits folded to ASCII, then digits only.\n * - `alphanumeric`: `[A-Za-z0-9]` only, uppercased (codes are uppercase and the\n * server compares case-insensitively \\u2014 uppercasing keeps the display and the\n * posted value consistent).\n */\nfunction packValue(value: string, length: number, mode: OTPMode): string {\n const filtered =\n mode === 'alphanumeric'\n ? value.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(value).replace(/\\D/g, '');\n return filtered.slice(0, length);\n}\n\nfunction valueToArray(value: string, length: number, mode: OTPMode): string[] {\n const packed = packValue(value, length, mode);\n const arr = new Array<string>(length).fill('');\n for (let i = 0; i < packed.length; i += 1) {\n arr[i] = packed[i];\n }\n return arr;\n}\n\nexport const OTPInput = forwardRef<OTPInputHandle, OTPInputProps>(\n (\n {\n length: lengthProp = 6,\n value,\n defaultValue,\n onChange,\n onComplete,\n disabled,\n error,\n label,\n id,\n className,\n webOtp = false,\n name,\n mode = 'numeric',\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const length = resolveLength(lengthProp);\n const ctx = useFormField();\n const generatedLabelId = useId();\n const labelId = label ? generatedLabelId : undefined;\n\n const [internalValueRaw, setInternalValue] = useControllableState<string>({\n value,\n defaultValue: packValue(defaultValue ?? '', length, mode),\n });\n const currentValue = packValue(internalValueRaw ?? '', length, mode);\n const digits = valueToArray(currentValue, length, mode);\n\n const effectiveDisabled = ctx.disabled || Boolean(disabled);\n const effectiveError = ctx.invalid || Boolean(error);\n const effectiveTone = effectiveError ? 'error' : 'default';\n\n const inputsRef = useRef<Array<HTMLInputElement | null>>([]);\n const completedRef = useRef(currentValue.length === length);\n const valueRef = useRef(currentValue);\n valueRef.current = currentValue;\n\n const computeInitialIndex = () => {\n const firstEmpty = currentValue.length;\n if (firstEmpty >= length) return length - 1;\n return firstEmpty;\n };\n const [activeIndex, setActiveIndex] = useState<number>(computeInitialIndex);\n\n useEffect(() => {\n if (activeIndex >= length) setActiveIndex(length - 1);\n }, [activeIndex, length]);\n\n const focusBox = useCallback(\n (index: number) => {\n const clamped = Math.max(0, Math.min(length - 1, index));\n setActiveIndex(clamped);\n const node = inputsRef.current[clamped];\n if (node) {\n node.focus();\n node.select();\n }\n },\n [length],\n );\n\n const commit = useCallback(\n (next: string) => {\n const packed = packValue(next, length, mode);\n setInternalValue(packed);\n valueRef.current = packed;\n onChange?.(packed);\n if (packed.length === length) {\n if (!completedRef.current) {\n completedRef.current = true;\n onComplete?.(packed);\n }\n } else {\n completedRef.current = false;\n }\n },\n [setInternalValue, length, mode, onChange, onComplete],\n );\n\n // WebOTP one-tap autofill. The hook silently no-ops when the API is\n // unavailable (Firefox / Safari / desktop Chromium) — `commit()` is\n // the same path manual entry takes, so `onChange` + `onComplete` fire\n // identically whether the digits arrived via SMS, paste, or typing.\n useWebOtp({\n enabled: webOtp && !effectiveDisabled,\n onCode: commit,\n });\n\n const handleChange =\n (index: number) => (event: ChangeEvent<HTMLInputElement>) => {\n const raw = event.target.value;\n const norm =\n mode === 'alphanumeric'\n ? raw.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(raw).replace(/\\D/g, '');\n const current = valueRef.current;\n\n if (norm.length === 0) {\n if (raw === '' && index < current.length) {\n const newValue = current.slice(0, index) + current.slice(index + 1);\n commit(newValue);\n }\n return;\n }\n\n const before = current.slice(0, index);\n const after = current.slice(index + norm.length);\n const newValue = (before + norm + after).slice(0, length);\n commit(newValue);\n\n const focusTarget = Math.min(index + norm.length, length - 1);\n focusBox(focusTarget);\n };\n\n const handleKeyDown =\n (index: number) => (event: KeyboardEvent<HTMLInputElement>) => {\n const current = valueRef.current;\n if (event.key === 'Backspace') {\n if (current[index]) {\n event.preventDefault();\n const newValue = current.slice(0, index) + current.slice(index + 1);\n commit(newValue);\n return;\n }\n if (index > 0) {\n event.preventDefault();\n const newValue = current.slice(0, index - 1) + current.slice(index);\n commit(newValue);\n focusBox(index - 1);\n }\n return;\n }\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n if (index > 0) focusBox(index - 1);\n return;\n }\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n if (index < length - 1) focusBox(index + 1);\n return;\n }\n if (event.key === 'Home') {\n event.preventDefault();\n focusBox(0);\n return;\n }\n if (event.key === 'End') {\n event.preventDefault();\n focusBox(length - 1);\n }\n };\n\n const handlePaste =\n (index: number) => (event: ClipboardEvent<HTMLInputElement>) => {\n const text = event.clipboardData.getData('text');\n const stripped = text.replace(/\\s+/g, '');\n const norm =\n mode === 'alphanumeric'\n ? stripped.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(stripped);\n // numeric: reject the whole paste unless it is all digits (byte-identical\n // to prior behaviour); alphanumeric: accept the stripped [A-Za-z0-9].\n if (\n mode === 'alphanumeric' ? norm.length === 0 : !/^[0-9]+$/.test(norm)\n ) {\n return;\n }\n event.preventDefault();\n const current = valueRef.current;\n const before = current.slice(0, index);\n const after = current.slice(index + norm.length);\n const newValue = (before + norm + after).slice(0, length);\n commit(newValue);\n const focusTarget = Math.min(index + norm.length, length - 1);\n focusBox(focusTarget);\n };\n\n const handleFocus =\n (index: number) => (event: FocusEvent<HTMLInputElement>) => {\n setActiveIndex(index);\n event.currentTarget.select();\n };\n\n const baseId = ctx.id;\n\n const agentHandle = useMemo<OTPInputHandle>(\n () => ({\n getValue: () => valueRef.current,\n setValue: (next) => commit(next),\n clear: () => commit(''),\n focus: () => focusBox(activeIndex),\n isComplete: () => valueRef.current.length === length,\n }),\n [commit, focusBox, activeIndex, length],\n );\n useAgentRegistration(otpInputAgent, agentHandle, id);\n // Expose the same imperative handle to React refs so consumers can\n // focus / read / clear the field (e.g. focus the boxes on a step change).\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n\n return (\n <div className={wrapperVariants({ className })}>\n {label ? (\n <label\n id={labelId}\n htmlFor={`${baseId}-0`}\n className=\"type-label ds:text-foreground\"\n >\n {label}\n </label>\n ) : null}\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- aria-invalid is a global ARIA state; conveys group-level validation */}\n <div\n role=\"group\"\n dir=\"ltr\"\n aria-labelledby={labelId}\n aria-invalid={effectiveError || undefined}\n aria-describedby={ctx.describedBy || undefined}\n aria-disabled={effectiveDisabled || undefined}\n data-component=\"otp-input\"\n data-component-id={id}\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]\"\n >\n {digits.map((digit, index) => {\n const isTabbable = !effectiveDisabled && index === activeIndex;\n return (\n <input\n key={index}\n ref={(node) => {\n inputsRef.current[index] = node;\n }}\n id={`${baseId}-${index}`}\n type=\"text\"\n inputMode={mode === 'alphanumeric' ? 'text' : 'numeric'}\n pattern={mode === 'alphanumeric' ? '[A-Za-z0-9]*' : '[0-9]*'}\n autoCapitalize={\n mode === 'alphanumeric' ? 'characters' : undefined\n }\n autoComplete={index === 0 ? 'one-time-code' : 'off'}\n maxLength={1}\n value={digit}\n disabled={effectiveDisabled}\n tabIndex={isTabbable ? 0 : -1}\n aria-label={t(\n mode === 'alphanumeric'\n ? 'inputs.otp.charLabel'\n : 'inputs.otp.digitLabel',\n {\n current: index + 1,\n total: length,\n },\n )}\n onChange={handleChange(index)}\n onKeyDown={handleKeyDown(index)}\n onPaste={handlePaste(index)}\n onFocus={handleFocus(index)}\n className={boxVariants({ tone: effectiveTone })}\n />\n );\n })}\n </div>\n {name ? (\n <input type=\"hidden\" name={name} value={currentValue} readOnly />\n ) : null}\n </div>\n );\n },\n);\n\nOTPInput.displayName = 'OTPInput';\n"],"names":["otpInputAgent","handle","args","wrapperVariants","cva","boxVariants","normaliseDigits","str","c","MIN_LENGTH","MAX_LENGTH","resolveLength","length","packValue","value","mode","valueToArray","packed","arr","i","OTPInput","forwardRef","lengthProp","defaultValue","onChange","onComplete","disabled","error","label","id","className","webOtp","name","ref","t","useTranslation","ctx","useFormField","generatedLabelId","useId","labelId","internalValueRaw","setInternalValue","useControllableState","currentValue","digits","effectiveDisabled","effectiveError","effectiveTone","inputsRef","useRef","completedRef","valueRef","computeInitialIndex","firstEmpty","activeIndex","setActiveIndex","useState","useEffect","focusBox","useCallback","index","clamped","node","commit","next","useWebOtp","handleChange","event","raw","norm","current","newValue","before","after","focusTarget","handleKeyDown","handlePaste","stripped","handleFocus","baseId","agentHandle","useMemo","useAgentRegistration","useImperativeHandle","jsx","digit","isTabbable"],"mappings":";;;;;;;;AASO,MAAMA,KAA8C;AAAA,EACzD,IAAI;AAAA,EACJ,cAAc,CAAC,eAAe,QAAQ;AAAA,EACtC,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,WAAA;AAAA,IAAW;AAAA,EACtC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ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MAAS,iBAAiB,SAAS;AAAA,gBAC9C,SAASA,MAAS,iBAAiB,iBAAiB;AAAA,gBACpD,gBACEA,MAAS,iBAAiB,eAAe;AAAA,gBAE3C,cAAc8C,MAAU,IAAI,kBAAkB;AAAA,gBAC9C,WAAW;AAAA,gBACX,OAAOyB;AAAA,gBACP,UAAUxC;AAAA,gBACV,UAAUyC,IAAa,IAAI;AAAA,gBAC3B,cAAYrD;AAAA,kBACVnB,MAAS,iBACL,yBACA;AAAA,kBACJ;AAAA,oBACE,SAAS8C,IAAQ;AAAA,oBACjB,OAAOjD;AAAA,kBAAA;AAAA,gBACT;AAAA,gBAEF,UAAUuD,EAAaN,CAAK;AAAA,gBAC5B,WAAWe,EAAcf,CAAK;AAAA,gBAC9B,SAASgB,GAAYhB,CAAK;AAAA,gBAC1B,SAASkB,GAAYlB,CAAK;AAAA,gBAC1B,WAAWxD,GAAY,EAAE,MAAM2C,GAAe;AAAA,cAAA;AAAA,cA7BzCa;AAAA,YAAA;AAAA,UAgCX,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF7B,IACC,gBAAAqD,EAAC,SAAA,EAAM,MAAK,UAAS,MAAArD,GAAY,OAAOY,GAAc,UAAQ,GAAA,CAAC,IAC7D;AAAA,IAAA,GACN;AAAA,EAEJ;AACF;AAEAxB,GAAS,cAAc;"}
|
|
@@ -86,6 +86,11 @@ fe.GlobalWorkerOptions.workerSrc = Ce;
|
|
|
86
86
|
const ke = J(
|
|
87
87
|
[
|
|
88
88
|
"ds:pdf-viewer-alfadocs ds:flex ds:flex-col",
|
|
89
|
+
// Allow the viewer to shrink below its content's intrinsic width when it
|
|
90
|
+
// sits in a constrained flex/grid context (mobile signing flows): without
|
|
91
|
+
// min-inline-size:0 the page canvas's natural width pins the flex item
|
|
92
|
+
// open, fit-width then measures that inflated width and never scales down.
|
|
93
|
+
"ds:min-w-0",
|
|
89
94
|
"ds:gap-[var(--spacing-sm)]",
|
|
90
95
|
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
91
96
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2",
|
|
@@ -191,7 +196,7 @@ function Se(o, t, f) {
|
|
|
191
196
|
const y = window.getComputedStyle(f), h = parseFloat(y.paddingInlineStart || "0") + parseFloat(y.paddingInlineEnd || "0"), g = parseFloat(y.paddingBlockStart || "0") + parseFloat(y.paddingBlockEnd || "0"), x = Math.max(f.clientWidth - h, 1), w = Math.max(f.clientHeight - g, 1), k = t.width, z = t.height;
|
|
192
197
|
return o === "fit-width" ? x / k : Math.min(x / k, w / z);
|
|
193
198
|
}
|
|
194
|
-
const
|
|
199
|
+
const st = Ee(
|
|
195
200
|
({
|
|
196
201
|
id: o,
|
|
197
202
|
src: t,
|
|
@@ -216,14 +221,14 @@ const at = Ee(
|
|
|
216
221
|
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () => H(e.matches);
|
|
217
222
|
return r(), e.addEventListener("change", r), () => e.removeEventListener("change", r);
|
|
218
223
|
}, []);
|
|
219
|
-
const [
|
|
224
|
+
const [a, Q] = b(null), [W, c] = b(null), [l, A] = b(f), [S, m] = b(y), [s, M] = b({ start: Math.max(1, f - 1), end: f + 1 }), [_, te] = b(""), [G, L] = b(!1), [O, me] = b(""), [Ie, Re] = b({ current: 0, total: 0 }), re = V(x), ne = V(w), se = V(k);
|
|
220
225
|
C(() => {
|
|
221
|
-
re.current = x, ne.current = w,
|
|
226
|
+
re.current = x, ne.current = w, se.current = k;
|
|
222
227
|
}, [x, w, k]);
|
|
223
228
|
const de = V(null);
|
|
224
229
|
C(() => {
|
|
225
|
-
de.current =
|
|
226
|
-
}, [
|
|
230
|
+
de.current = a;
|
|
231
|
+
}, [a]), C(() => {
|
|
227
232
|
let e = !1;
|
|
228
233
|
Q(null), c(null);
|
|
229
234
|
const r = {
|
|
@@ -257,7 +262,7 @@ const at = Ee(
|
|
|
257
262
|
var Z;
|
|
258
263
|
if (e) return;
|
|
259
264
|
const R = i instanceof Error ? i : new Error(String(i));
|
|
260
|
-
c(R), (Z =
|
|
265
|
+
c(R), (Z = se.current) == null || Z.call(se, R);
|
|
261
266
|
}
|
|
262
267
|
), () => {
|
|
263
268
|
e = !0, u.destroy();
|
|
@@ -272,14 +277,14 @@ const at = Ee(
|
|
|
272
277
|
};
|
|
273
278
|
}, [t]), C(() => {
|
|
274
279
|
var e;
|
|
275
|
-
|
|
276
|
-
d("pdf.pageOf", { current: l, total:
|
|
280
|
+
a && (te(
|
|
281
|
+
d("pdf.pageOf", { current: l, total: a.numPages })
|
|
277
282
|
), (e = re.current) == null || e.call(re, l));
|
|
278
|
-
}, [l,
|
|
279
|
-
const
|
|
283
|
+
}, [l, a, d]);
|
|
284
|
+
const ae = V(null), ce = V([]), j = K(
|
|
280
285
|
(e) => {
|
|
281
|
-
if (!
|
|
282
|
-
const r = Math.max(1, Math.min(e,
|
|
286
|
+
if (!a) return;
|
|
287
|
+
const r = Math.max(1, Math.min(e, a.numPages));
|
|
283
288
|
A(r);
|
|
284
289
|
const u = ce.current[r - 1];
|
|
285
290
|
u && u.scrollIntoView({
|
|
@@ -287,7 +292,7 @@ const at = Ee(
|
|
|
287
292
|
block: "start"
|
|
288
293
|
});
|
|
289
294
|
},
|
|
290
|
-
[
|
|
295
|
+
[a, p]
|
|
291
296
|
), he = K((e) => {
|
|
292
297
|
m(e);
|
|
293
298
|
}, []), Y = K(() => {
|
|
@@ -306,7 +311,7 @@ const at = Ee(
|
|
|
306
311
|
Le(I, () => le, [le]), Ke(Ge, le, o);
|
|
307
312
|
const Te = K(
|
|
308
313
|
(e) => {
|
|
309
|
-
if (!
|
|
314
|
+
if (!a) return;
|
|
310
315
|
const r = e.metaKey || e.ctrlKey;
|
|
311
316
|
if (e.key === "PageDown") {
|
|
312
317
|
e.preventDefault(), j(l + 1);
|
|
@@ -321,7 +326,7 @@ const at = Ee(
|
|
|
321
326
|
return;
|
|
322
327
|
}
|
|
323
328
|
if (e.key === "End") {
|
|
324
|
-
e.preventDefault(), j(
|
|
329
|
+
e.preventDefault(), j(a.numPages);
|
|
325
330
|
return;
|
|
326
331
|
}
|
|
327
332
|
if (r && e.key.toLowerCase() === "f") {
|
|
@@ -344,13 +349,13 @@ const at = Ee(
|
|
|
344
349
|
}
|
|
345
350
|
r && e.key.toLowerCase() === "p" && (e.preventDefault(), Y());
|
|
346
351
|
},
|
|
347
|
-
[l, j, Y,
|
|
352
|
+
[l, j, Y, a]
|
|
348
353
|
), ue = V(l);
|
|
349
354
|
C(() => {
|
|
350
355
|
ue.current = l;
|
|
351
356
|
}, [l]), C(() => {
|
|
352
|
-
if (!
|
|
353
|
-
const e =
|
|
357
|
+
if (!a) return;
|
|
358
|
+
const e = ae.current;
|
|
354
359
|
if (!e) return;
|
|
355
360
|
const r = /* @__PURE__ */ new Map(), u = new IntersectionObserver(
|
|
356
361
|
(i) => {
|
|
@@ -365,7 +370,7 @@ const at = Ee(
|
|
|
365
370
|
$ > Z && (R = F, Z = $), $ > 0 && (q = Math.min(q, F), U = Math.max(U, F));
|
|
366
371
|
Z > 0 && R !== ue.current && A(R), q !== 1 / 0 && M({
|
|
367
372
|
start: Math.max(1, q - 1),
|
|
368
|
-
end: Math.min(
|
|
373
|
+
end: Math.min(a.numPages, U + 1)
|
|
369
374
|
});
|
|
370
375
|
},
|
|
371
376
|
{ root: e, threshold: [0, 0.25, 0.5, 0.75, 1] }
|
|
@@ -373,10 +378,10 @@ const at = Ee(
|
|
|
373
378
|
return ce.current.forEach((i) => {
|
|
374
379
|
i && u.observe(i);
|
|
375
380
|
}), () => u.disconnect();
|
|
376
|
-
}, [
|
|
381
|
+
}, [a]);
|
|
377
382
|
const [Ae, Oe] = b(0);
|
|
378
383
|
C(() => {
|
|
379
|
-
const e =
|
|
384
|
+
const e = ae.current;
|
|
380
385
|
if (!e || typeof ResizeObserver > "u") return;
|
|
381
386
|
const r = new ResizeObserver(() => {
|
|
382
387
|
(S === "fit-width" || S === "fit-page") && Oe((u) => u + 1);
|
|
@@ -427,10 +432,10 @@ const at = Ee(
|
|
|
427
432
|
"data-pdfjs-worker-src": Ce,
|
|
428
433
|
children: [
|
|
429
434
|
z ? /* @__PURE__ */ n(
|
|
430
|
-
|
|
435
|
+
at,
|
|
431
436
|
{
|
|
432
437
|
currentPage: l,
|
|
433
|
-
numPages: (
|
|
438
|
+
numPages: (a == null ? void 0 : a.numPages) ?? 0,
|
|
434
439
|
zoom: S,
|
|
435
440
|
onPrev: () => j(l - 1),
|
|
436
441
|
onNext: () => j(l + 1),
|
|
@@ -466,24 +471,24 @@ const at = Ee(
|
|
|
466
471
|
/* @__PURE__ */ n(
|
|
467
472
|
"div",
|
|
468
473
|
{
|
|
469
|
-
ref:
|
|
474
|
+
ref: ae,
|
|
470
475
|
className: tt(),
|
|
471
476
|
"data-testid": "pdf-pages-container",
|
|
472
477
|
tabIndex: 0,
|
|
473
478
|
"aria-label": d("pdf.pagesRegionLabel"),
|
|
474
|
-
children:
|
|
479
|
+
children: a ? Array.from({ length: a.numPages }, (e, r) => r + 1).map(
|
|
475
480
|
(e) => /* @__PURE__ */ n(
|
|
476
481
|
ot,
|
|
477
482
|
{
|
|
478
483
|
pageNumber: e,
|
|
479
|
-
totalPages:
|
|
480
|
-
doc:
|
|
484
|
+
totalPages: a.numPages,
|
|
485
|
+
doc: a.doc,
|
|
481
486
|
zoom: S,
|
|
482
487
|
pageRotation: h,
|
|
483
488
|
renderPageOverlay: g,
|
|
484
|
-
container:
|
|
489
|
+
container: ae.current,
|
|
485
490
|
resizeTick: Ae,
|
|
486
|
-
shouldRender: e >=
|
|
491
|
+
shouldRender: e >= s.start && e <= s.end,
|
|
487
492
|
registerRef: (r) => {
|
|
488
493
|
ce.current[e - 1] = r;
|
|
489
494
|
},
|
|
@@ -509,8 +514,8 @@ const at = Ee(
|
|
|
509
514
|
);
|
|
510
515
|
}
|
|
511
516
|
);
|
|
512
|
-
|
|
513
|
-
function
|
|
517
|
+
st.displayName = "PDFViewer";
|
|
518
|
+
function at(o) {
|
|
514
519
|
const { t } = pe(), {
|
|
515
520
|
currentPage: f,
|
|
516
521
|
numPages: y,
|
|
@@ -530,7 +535,7 @@ function st(o) {
|
|
|
530
535
|
searchMatches: E,
|
|
531
536
|
register: p,
|
|
532
537
|
focusIndex: H,
|
|
533
|
-
setFocusIndex:
|
|
538
|
+
setFocusIndex: a,
|
|
534
539
|
onToolbarKeyDown: Q
|
|
535
540
|
} = o, [W, c] = b(String(f));
|
|
536
541
|
C(() => {
|
|
@@ -538,30 +543,30 @@ function st(o) {
|
|
|
538
543
|
}, [f]);
|
|
539
544
|
const l = f <= 1, A = f >= y;
|
|
540
545
|
function S() {
|
|
541
|
-
const
|
|
542
|
-
Number.isFinite(
|
|
546
|
+
const s = Number(W);
|
|
547
|
+
Number.isFinite(s) && s >= 1 ? w(Math.min(s, y)) : c(String(f));
|
|
543
548
|
}
|
|
544
|
-
function m(
|
|
549
|
+
function m(s) {
|
|
545
550
|
return /* @__PURE__ */ n(
|
|
546
551
|
"button",
|
|
547
552
|
{
|
|
548
553
|
type: "button",
|
|
549
|
-
ref: p(
|
|
550
|
-
tabIndex:
|
|
551
|
-
onFocus: () => s
|
|
554
|
+
ref: p(s.index),
|
|
555
|
+
tabIndex: s.index === H ? 0 : -1,
|
|
556
|
+
onFocus: () => a(s.index),
|
|
552
557
|
onKeyDown: Q,
|
|
553
|
-
"aria-label":
|
|
554
|
-
"aria-disabled":
|
|
555
|
-
title:
|
|
558
|
+
"aria-label": s.label,
|
|
559
|
+
"aria-disabled": s.disabled || void 0,
|
|
560
|
+
title: s.label,
|
|
556
561
|
onClick: (M) => {
|
|
557
|
-
if (
|
|
562
|
+
if (s.disabled) {
|
|
558
563
|
M.preventDefault();
|
|
559
564
|
return;
|
|
560
565
|
}
|
|
561
|
-
|
|
566
|
+
s.onActivate();
|
|
562
567
|
},
|
|
563
568
|
className: ze(),
|
|
564
|
-
children:
|
|
569
|
+
children: s.icon
|
|
565
570
|
}
|
|
566
571
|
);
|
|
567
572
|
}
|
|
@@ -605,12 +610,12 @@ function st(o) {
|
|
|
605
610
|
min: 1,
|
|
606
611
|
max: Math.max(y, 1),
|
|
607
612
|
value: W,
|
|
608
|
-
onChange: (
|
|
609
|
-
onKeyDown: (
|
|
610
|
-
|
|
613
|
+
onChange: (s) => c(s.target.value),
|
|
614
|
+
onKeyDown: (s) => {
|
|
615
|
+
s.key === "Enter" && (s.preventDefault(), S());
|
|
611
616
|
},
|
|
612
617
|
onBlur: S,
|
|
613
|
-
onFocus: () =>
|
|
618
|
+
onFocus: () => a(2),
|
|
614
619
|
ref: p(2),
|
|
615
620
|
tabIndex: H === 2 ? 0 : -1,
|
|
616
621
|
"aria-label": t("pdf.currentPageInput"),
|
|
@@ -661,8 +666,8 @@ function st(o) {
|
|
|
661
666
|
{
|
|
662
667
|
"aria-label": t("pdf.zoom.preset"),
|
|
663
668
|
value: typeof h == "number" ? String(h) : h,
|
|
664
|
-
onChange: (
|
|
665
|
-
const M =
|
|
669
|
+
onChange: (s) => {
|
|
670
|
+
const M = s.target.value;
|
|
666
671
|
if (M === "fit-width" || M === "fit-page" || M === "actual-size")
|
|
667
672
|
T(M);
|
|
668
673
|
else {
|
|
@@ -672,14 +677,14 @@ function st(o) {
|
|
|
672
677
|
},
|
|
673
678
|
ref: p(5),
|
|
674
679
|
tabIndex: H === 5 ? 0 : -1,
|
|
675
|
-
onFocus: () =>
|
|
680
|
+
onFocus: () => a(5),
|
|
676
681
|
onKeyDown: Q,
|
|
677
682
|
className: et(),
|
|
678
683
|
children: [
|
|
679
684
|
/* @__PURE__ */ n("option", { value: "fit-width", children: t("pdf.zoom.fitWidth") }),
|
|
680
685
|
/* @__PURE__ */ n("option", { value: "fit-page", children: t("pdf.zoom.fitPage") }),
|
|
681
686
|
/* @__PURE__ */ n("option", { value: "actual-size", children: t("pdf.zoom.actualSize") }),
|
|
682
|
-
nt.filter(X).map((
|
|
687
|
+
nt.filter(X).map((s) => /* @__PURE__ */ n("option", { value: String(s), children: `${Math.round(s * 100)}%` }, s))
|
|
683
688
|
]
|
|
684
689
|
}
|
|
685
690
|
),
|
|
@@ -715,7 +720,7 @@ function st(o) {
|
|
|
715
720
|
type: "search",
|
|
716
721
|
autoFocus: !0,
|
|
717
722
|
value: N,
|
|
718
|
-
onChange: (
|
|
723
|
+
onChange: (s) => v(s.target.value),
|
|
719
724
|
placeholder: t("pdf.search.placeholder"),
|
|
720
725
|
"aria-label": t("pdf.search.placeholder"),
|
|
721
726
|
className: Pe({
|
|
@@ -802,7 +807,7 @@ function ot(o) {
|
|
|
802
807
|
height: Math.floor(S.height)
|
|
803
808
|
});
|
|
804
809
|
}, [p, h, w, k, g]);
|
|
805
|
-
const
|
|
810
|
+
const a = g ?? (p == null ? void 0 : p.rotate) ?? 0;
|
|
806
811
|
C(() => {
|
|
807
812
|
if (!p || !z) {
|
|
808
813
|
const O = P.current;
|
|
@@ -813,7 +818,7 @@ function ot(o) {
|
|
|
813
818
|
if (!c) return;
|
|
814
819
|
const A = c.getContext("2d");
|
|
815
820
|
if (!A) return;
|
|
816
|
-
const S = (O) => g === void 0 ? { scale: O } : { scale: O, rotation: g }, m = p.getViewport(S(1)),
|
|
821
|
+
const S = (O) => g === void 0 ? { scale: O } : { scale: O, rotation: g }, m = p.getViewport(S(1)), s = Se(h, m, w), M = p.getViewport(S(s)), _ = Math.max(1, window.devicePixelRatio || 1);
|
|
817
822
|
c.width = Math.floor(M.width * _), c.height = Math.floor(M.height * _), A.setTransform(_, 0, 0, _, 0, 0);
|
|
818
823
|
const te = p.render({
|
|
819
824
|
canvas: c,
|
|
@@ -905,7 +910,7 @@ function ot(o) {
|
|
|
905
910
|
pageNumber: t,
|
|
906
911
|
pageWidthCss: v.width,
|
|
907
912
|
pageHeightCss: v.height,
|
|
908
|
-
rotation:
|
|
913
|
+
rotation: a
|
|
909
914
|
})
|
|
910
915
|
}
|
|
911
916
|
) : null
|
|
@@ -954,7 +959,7 @@ function Ne(o, t, f) {
|
|
|
954
959
|
}), f(T);
|
|
955
960
|
}
|
|
956
961
|
export {
|
|
957
|
-
|
|
962
|
+
st as P,
|
|
958
963
|
Ge as p
|
|
959
964
|
};
|
|
960
|
-
//# sourceMappingURL=pdf-viewer-
|
|
965
|
+
//# sourceMappingURL=pdf-viewer-XxWdtKfD.js.map
|