@kitsy/pdf 0.0.0-stage → 0.2.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/CHANGELOG.md +32 -0
- package/LICENSE +201 -0
- package/NOTICE +16 -0
- package/README.md +256 -2
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/chunk-2K5X7L5J.js +43 -0
- package/dist/chunk-2K5X7L5J.js.map +1 -0
- package/dist/chunk-4EAYBJ6G.js +362 -0
- package/dist/chunk-4EAYBJ6G.js.map +1 -0
- package/dist/chunk-4LBJTDV5.js +165 -0
- package/dist/chunk-4LBJTDV5.js.map +1 -0
- package/dist/chunk-4ZEZ2GLD.js +353 -0
- package/dist/chunk-4ZEZ2GLD.js.map +1 -0
- package/dist/chunk-5OIMR74G.js +273 -0
- package/dist/chunk-5OIMR74G.js.map +1 -0
- package/dist/chunk-6NFNAKWA.js +257 -0
- package/dist/chunk-6NFNAKWA.js.map +1 -0
- package/dist/chunk-7MTEMQLL.js +47 -0
- package/dist/chunk-7MTEMQLL.js.map +1 -0
- package/dist/chunk-7V4SWTUK.js +83 -0
- package/dist/chunk-7V4SWTUK.js.map +1 -0
- package/dist/chunk-7XH7MFZ4.js +295 -0
- package/dist/chunk-7XH7MFZ4.js.map +1 -0
- package/dist/chunk-BK3MYSUS.js +61 -0
- package/dist/chunk-BK3MYSUS.js.map +1 -0
- package/dist/chunk-BLHNKR3S.js +35 -0
- package/dist/chunk-BLHNKR3S.js.map +1 -0
- package/dist/chunk-CCJ43SIX.js +342 -0
- package/dist/chunk-CCJ43SIX.js.map +1 -0
- package/dist/chunk-CNEDWATL.js +210 -0
- package/dist/chunk-CNEDWATL.js.map +1 -0
- package/dist/chunk-CYTWDJE2.js +152 -0
- package/dist/chunk-CYTWDJE2.js.map +1 -0
- package/dist/chunk-DKVOICYZ.js +45 -0
- package/dist/chunk-DKVOICYZ.js.map +1 -0
- package/dist/chunk-DPEJU4P6.js +79 -0
- package/dist/chunk-DPEJU4P6.js.map +1 -0
- package/dist/chunk-DQPABZTU.js +22 -0
- package/dist/chunk-DQPABZTU.js.map +1 -0
- package/dist/chunk-EKHEY3LI.js +46 -0
- package/dist/chunk-EKHEY3LI.js.map +1 -0
- package/dist/chunk-FIEYAKPI.js +421 -0
- package/dist/chunk-FIEYAKPI.js.map +1 -0
- package/dist/chunk-G467LFKC.js +191 -0
- package/dist/chunk-G467LFKC.js.map +1 -0
- package/dist/chunk-GLYWSVSB.js +250 -0
- package/dist/chunk-GLYWSVSB.js.map +1 -0
- package/dist/chunk-GXBIMUO7.js +135 -0
- package/dist/chunk-GXBIMUO7.js.map +1 -0
- package/dist/chunk-H6EERRCR.js +180 -0
- package/dist/chunk-H6EERRCR.js.map +1 -0
- package/dist/chunk-HDTM3LXD.js +35 -0
- package/dist/chunk-HDTM3LXD.js.map +1 -0
- package/dist/chunk-IGMX56C3.js +180 -0
- package/dist/chunk-IGMX56C3.js.map +1 -0
- package/dist/chunk-J4IRICCJ.js +74 -0
- package/dist/chunk-J4IRICCJ.js.map +1 -0
- package/dist/chunk-JXKQ7S6W.js +331 -0
- package/dist/chunk-JXKQ7S6W.js.map +1 -0
- package/dist/chunk-KY6DXS6S.js +34 -0
- package/dist/chunk-KY6DXS6S.js.map +1 -0
- package/dist/chunk-NOFGCYGS.js +22 -0
- package/dist/chunk-NOFGCYGS.js.map +1 -0
- package/dist/chunk-OSHUJRKD.js +131 -0
- package/dist/chunk-OSHUJRKD.js.map +1 -0
- package/dist/chunk-PMH7OWPF.js +40 -0
- package/dist/chunk-PMH7OWPF.js.map +1 -0
- package/dist/chunk-PRBKSX3A.js +299 -0
- package/dist/chunk-PRBKSX3A.js.map +1 -0
- package/dist/chunk-SVPUX7AM.js +48 -0
- package/dist/chunk-SVPUX7AM.js.map +1 -0
- package/dist/chunk-TR6HJ4NO.js +659 -0
- package/dist/chunk-TR6HJ4NO.js.map +1 -0
- package/dist/chunk-TV3E4YUF.js +69 -0
- package/dist/chunk-TV3E4YUF.js.map +1 -0
- package/dist/chunk-VCTN77K2.js +112 -0
- package/dist/chunk-VCTN77K2.js.map +1 -0
- package/dist/chunk-WEOPDD3P.js +120 -0
- package/dist/chunk-WEOPDD3P.js.map +1 -0
- package/dist/chunk-ZBZ7OC6I.js +228 -0
- package/dist/chunk-ZBZ7OC6I.js.map +1 -0
- package/dist/config-CJYo46X9.d.ts +19 -0
- package/dist/index.d.ts +517 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/react/certificate-sign.d.ts +5 -0
- package/dist/react/certificate-sign.js +14 -0
- package/dist/react/certificate-sign.js.map +1 -0
- package/dist/react/compress.d.ts +5 -0
- package/dist/react/compress.js +8 -0
- package/dist/react/compress.js.map +1 -0
- package/dist/react/fill-form.d.ts +5 -0
- package/dist/react/fill-form.js +8 -0
- package/dist/react/fill-form.js.map +1 -0
- package/dist/react/images-to-pdf.d.ts +5 -0
- package/dist/react/images-to-pdf.js +7 -0
- package/dist/react/images-to-pdf.js.map +1 -0
- package/dist/react/merge.d.ts +5 -0
- package/dist/react/merge.js +8 -0
- package/dist/react/merge.js.map +1 -0
- package/dist/react/metadata.d.ts +5 -0
- package/dist/react/metadata.js +8 -0
- package/dist/react/metadata.js.map +1 -0
- package/dist/react/organize.d.ts +5 -0
- package/dist/react/organize.js +12 -0
- package/dist/react/organize.js.map +1 -0
- package/dist/react/pdf-to-images.d.ts +5 -0
- package/dist/react/pdf-to-images.js +13 -0
- package/dist/react/pdf-to-images.js.map +1 -0
- package/dist/react/protect.d.ts +5 -0
- package/dist/react/protect.js +8 -0
- package/dist/react/protect.js.map +1 -0
- package/dist/react/sign.d.ts +5 -0
- package/dist/react/sign.js +13 -0
- package/dist/react/sign.js.map +1 -0
- package/dist/react/split.d.ts +5 -0
- package/dist/react/split.js +11 -0
- package/dist/react/split.js.map +1 -0
- package/dist/react/verify-signatures.d.ts +5 -0
- package/dist/react/verify-signatures.js +8 -0
- package/dist/react/verify-signatures.js.map +1 -0
- package/dist/react/watermark.d.ts +5 -0
- package/dist/react/watermark.js +10 -0
- package/dist/react/watermark.js.map +1 -0
- package/dist/react.d.ts +40 -0
- package/dist/react.js +40 -0
- package/dist/react.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/vite.d.ts +5 -0
- package/dist/vite.js +9 -0
- package/dist/vite.js.map +1 -0
- package/package.json +163 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package are listed here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the package uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/). Before 1.0.0, minor versions may
|
|
6
|
+
include breaking changes.
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - Unreleased
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- USB-token DSC signing through hey's `dsc` service: `findTokenCertificates`,
|
|
13
|
+
`heyTokenSigner`, `HeyDscError` and `HEY_HUB_URL`. The private key stays on
|
|
14
|
+
the token, and the user confirms each signature in a native dialog.
|
|
15
|
+
- `CertSignPdf` has a "USB token" mode next to "Certificate file", with
|
|
16
|
+
one-time setup steps for users who haven't installed hey yet.
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-11-02
|
|
19
|
+
|
|
20
|
+
First public release.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Framework-free core (`@kitsy/pdf`): merge, split, images to PDF, watermark
|
|
25
|
+
and page numbers, metadata, organize pages, visible signatures, PDF to
|
|
26
|
+
images, compress, fill forms, protect / unlock (AES-256), PAdES digital
|
|
27
|
+
signatures with `.pfx` / `.p12` certificates, and signature verification.
|
|
28
|
+
- React UIs (`@kitsy/pdf/react` and `@kitsy/pdf/react/<tool>`), with
|
|
29
|
+
`PdfToolsProvider` for navigation and page chrome.
|
|
30
|
+
- `configurePdf()` for asset URLs and the Producer name; `@kitsy/pdf/vite`
|
|
31
|
+
with ready-made asset URLs for Vite apps.
|
|
32
|
+
- Prebuilt `@kitsy/pdf/styles.css` for apps that do not use Tailwind CSS.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@kitsy/pdf
|
|
2
|
+
Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED
|
|
3
|
+
|
|
4
|
+
This product includes software developed by HEYPKV INNOVATIONS PRIVATE LIMITED
|
|
5
|
+
(https://kitsy.ai).
|
|
6
|
+
|
|
7
|
+
This product depends on third-party open-source software, which is installed
|
|
8
|
+
from npm as dependencies and is not modified or bundled into this package's
|
|
9
|
+
own files. See THIRD_PARTY_NOTICES.md for the list and their licenses.
|
|
10
|
+
|
|
11
|
+
pdf.js is Copyright Mozilla Foundation and is licensed under the Apache
|
|
12
|
+
License, Version 2.0.
|
|
13
|
+
|
|
14
|
+
qpdf is Copyright Jay Berkenbilt and contributors and is licensed under the
|
|
15
|
+
Apache License, Version 2.0. It reaches this package as WebAssembly through
|
|
16
|
+
@neslinesli93/qpdf-wasm.
|
package/README.md
CHANGED
|
@@ -1,3 +1,257 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kitsy/pdf
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PDF tools that run entirely in the browser. Files, certificates and passwords
|
|
4
|
+
never leave the user's device.
|
|
5
|
+
|
|
6
|
+
- **Core** (`@kitsy/pdf`): framework-free functions that take and return bytes.
|
|
7
|
+
- **React UIs** (`@kitsy/pdf/react`): a ready-made page for each tool.
|
|
8
|
+
|
|
9
|
+
| Tool | Core function | React component | Subpath |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| Merge | `mergePdfs` | `MergePdf` | `@kitsy/pdf/react/merge` |
|
|
12
|
+
| Split | `splitPdf` | `SplitPdf` | `@kitsy/pdf/react/split` |
|
|
13
|
+
| Images to PDF | `imagesToPdf` | `ImagesToPdf` | `@kitsy/pdf/react/images-to-pdf` |
|
|
14
|
+
| Watermark & page numbers | `stampPdf` | `WatermarkPdf` | `@kitsy/pdf/react/watermark` |
|
|
15
|
+
| Edit metadata | `readPdfMetadata`, `writePdfMetadata` | `PdfMetadata` | `@kitsy/pdf/react/metadata` |
|
|
16
|
+
| Organize pages | `organizePdf` | `OrganizePdf` | `@kitsy/pdf/react/organize` |
|
|
17
|
+
| Sign (visible) | `applySignatures` | `SignPdf` | `@kitsy/pdf/react/sign` |
|
|
18
|
+
| PDF to images | `renderPageToCanvas` + helpers | `PdfToImages` | `@kitsy/pdf/react/pdf-to-images` |
|
|
19
|
+
| Compress | `compressPdf` | `CompressPdf` | `@kitsy/pdf/react/compress` |
|
|
20
|
+
| Fill forms | `readFormFields`, `fillForm` | `FillPdfForm` | `@kitsy/pdf/react/fill-form` |
|
|
21
|
+
| Protect / unlock (AES-256) | `protectPdf`, `unlockPdf` | `ProtectPdf` | `@kitsy/pdf/react/protect` |
|
|
22
|
+
| Digital signature (`.pfx` / `.p12`, PAdES) | `readPkcs12`, `signPdfWithCertificate` | `CertSignPdf` | `@kitsy/pdf/react/certificate-sign` |
|
|
23
|
+
| Verify signatures | `verifyPdfSignatures` | `VerifyPdfSignatures` | `@kitsy/pdf/react/verify-signatures` |
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install @kitsy/pdf
|
|
29
|
+
# React UIs also need React 18 or later
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The package is ESM only. It works with any modern bundler (Vite, webpack 5,
|
|
33
|
+
Rollup, esbuild) and in Node 20 or later for the operations that don't need a
|
|
34
|
+
browser.
|
|
35
|
+
|
|
36
|
+
## Configure assets (once, at start-up)
|
|
37
|
+
|
|
38
|
+
Page previews use the pdf.js worker, and Protect / Unlock uses qpdf compiled
|
|
39
|
+
to WebAssembly. Your bundler has to serve these files, so tell the package where
|
|
40
|
+
they are.
|
|
41
|
+
|
|
42
|
+
**Vite:**
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import { configurePdf } from "@kitsy/pdf";
|
|
46
|
+
import { viteAssets } from "@kitsy/pdf/vite";
|
|
47
|
+
|
|
48
|
+
configurePdf({ ...viteAssets, producer: "My App" });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`viteAssets` resolves both files from `@kitsy/pdf`'s own dependencies, so the
|
|
52
|
+
worker always matches the pdf.js version in use.
|
|
53
|
+
|
|
54
|
+
**Other bundlers:** copy these files into your public folder, then pass their
|
|
55
|
+
URLs:
|
|
56
|
+
|
|
57
|
+
- `node_modules/pdfjs-dist/build/pdf.worker.min.mjs`
|
|
58
|
+
- `node_modules/@neslinesli93/qpdf-wasm/dist/qpdf.wasm`
|
|
59
|
+
|
|
60
|
+
Use the `pdfjs-dist` copy that `@kitsy/pdf` itself resolves (`npm ls pdfjs-dist`).
|
|
61
|
+
pdf.js requires the worker and the library to be the same version.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
configurePdf({
|
|
65
|
+
pdfjsWorkerSrc: "/pdf.worker.min.mjs",
|
|
66
|
+
qpdfWasmUrl: "/qpdf.wasm",
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
| Option | Needed for | Notes |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| `pdfjsWorkerSrc` | Previews, Organize, PDF to images, visible-signature preview | Required for those tools |
|
|
73
|
+
| `qpdfWasmUrl` | Protect / unlock | Required for that tool |
|
|
74
|
+
| `pdfjsAssetsBase` | Rendering CJK text and unembedded standard fonts | Optional. A folder containing `cmaps/` and `standard_fonts/` copied from `pdfjs-dist` |
|
|
75
|
+
| `producer` | The Producer field of PDFs created from scratch | Default `"@kitsy/pdf"` |
|
|
76
|
+
|
|
77
|
+
Tools that need a missing URL throw an error naming the option.
|
|
78
|
+
|
|
79
|
+
## Core usage
|
|
80
|
+
|
|
81
|
+
Every function takes `ArrayBuffer` or `Uint8Array` input and returns
|
|
82
|
+
`Uint8Array` output.
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import { mergePdfs, splitPdf, stampPdf, protectPdf, browserQpdf } from "@kitsy/pdf";
|
|
86
|
+
|
|
87
|
+
const merged = await mergePdfs([
|
|
88
|
+
{ name: "a.pdf", bytes: aBytes },
|
|
89
|
+
{ name: "b.pdf", bytes: bBytes, pages: "1-3, 5" },
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
const parts = await splitPdf(merged, { mode: "every", every: 2 });
|
|
93
|
+
// parts: [{ name, pageIndices, bytes }, ...]
|
|
94
|
+
|
|
95
|
+
const stamped = await stampPdf(merged, {
|
|
96
|
+
watermark: { text: "CONFIDENTIAL", opacity: 0.15 },
|
|
97
|
+
pageNumbers: { format: "Page {n} of {total}", position: "bottom-center" },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const { bytes: locked } = await protectPdf(stamped, { userPassword: "s3cret", print: "low" }, browserQpdf);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Digital signatures with a certificate
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
import { readPkcs12, webCryptoSigner, signPdfWithCertificate, verifyPdfSignatures } from "@kitsy/pdf";
|
|
107
|
+
|
|
108
|
+
const identity = readPkcs12(pfxBytes, password); // throws CertificatePasswordError on a wrong password
|
|
109
|
+
const signer = await webCryptoSigner(identity); // private key becomes a non-extractable CryptoKey
|
|
110
|
+
identity.privateKeyPkcs8.fill(0);
|
|
111
|
+
|
|
112
|
+
const signed = await signPdfWithCertificate(pdfBytes, signer, {
|
|
113
|
+
reason: "I approve this document",
|
|
114
|
+
location: "Bengaluru",
|
|
115
|
+
visible: { pageIndex: 0, x: 0.6, y: 0.88, width: 0.38, height: 0.09 }, // or null
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const [check] = await verifyPdfSignatures(signed);
|
|
119
|
+
// { intact: true, coversWholeFile: true, signer: { commonName, ... }, signingTime, ... }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Details:
|
|
123
|
+
|
|
124
|
+
- Signatures are PAdES baseline B (`ETSI.CAdES.detached`) using SHA-256 and
|
|
125
|
+
RSA. Adobe Reader, poppler (`pdfsig`) and OpenSSL validate them.
|
|
126
|
+
- `.pfx` / `.p12` files with modern (AES) or legacy (3DES / RC2) encryption are
|
|
127
|
+
supported. Only RSA keys are supported.
|
|
128
|
+
- `signer` is any object of the form `{ certificate, chain?, sign(bytes) }`
|
|
129
|
+
(`RawSigner`). You can plug in a hardware token or remote signer by
|
|
130
|
+
implementing `sign`.
|
|
131
|
+
- `verifyPdfSignatures` checks integrity, whether anything was added after
|
|
132
|
+
signing, and the certificate details. It does **not** check whether the
|
|
133
|
+
certificate is trusted or revoked.
|
|
134
|
+
|
|
135
|
+
### Digital signatures with a USB token
|
|
136
|
+
|
|
137
|
+
USB-token DSCs (ePass2003, ProxKey, Watchdata, mToken, SafeNet and other
|
|
138
|
+
PKCS#11 tokens) sign through [hey](https://github.com/kitsyai/hey) and its
|
|
139
|
+
[dsc](https://github.com/kitsyai/dsc) service on the user's computer. The user
|
|
140
|
+
runs `hey up dsc` once; the private key never leaves the token, and `dsc` shows
|
|
141
|
+
a native confirmation dialog before every signature.
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import { findTokenCertificates, heyTokenSigner, signPdfWithCertificate, HeyDscError } from "@kitsy/pdf";
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
const [token] = await findTokenCertificates(); // [{ id, certificate, label, summary }]
|
|
148
|
+
const signer = heyTokenSigner(token, { document: "contract.pdf" }); // name shown in the dialog
|
|
149
|
+
const signed = await signPdfWithCertificate(pdfBytes, signer, { reason: "I approve this document" });
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (error instanceof HeyDscError) {
|
|
152
|
+
// error.code: "no_hub" | "not_set_up" | "not_running" | "declined" | "pin_incorrect" | "pin_locked" | ...
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Your site's origin must be on the hey hub's allow-list, which you set in hey's
|
|
158
|
+
`dsc` pack. If your site sends a Content-Security-Policy, add
|
|
159
|
+
`http://127.0.0.1:8525` to `connect-src`. `CertSignPdf` (React) includes a
|
|
160
|
+
"USB token" mode with the setup steps for users.
|
|
161
|
+
|
|
162
|
+
## React usage
|
|
163
|
+
|
|
164
|
+
Each component is a full page. Load them lazily through the per-tool subpaths:
|
|
165
|
+
|
|
166
|
+
```jsx
|
|
167
|
+
import { lazy, Suspense } from "react";
|
|
168
|
+
import { PdfToolsProvider } from "@kitsy/pdf/react";
|
|
169
|
+
|
|
170
|
+
const MergePdf = lazy(() => import("@kitsy/pdf/react/merge"));
|
|
171
|
+
|
|
172
|
+
export function MergePage() {
|
|
173
|
+
return (
|
|
174
|
+
<PdfToolsProvider
|
|
175
|
+
backLink={{ href: "/tools", label: "All tools" }}
|
|
176
|
+
renderLink={({ href, className, children }) => (
|
|
177
|
+
<RouterLink to={href} className={className}>{children}</RouterLink>
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<Suspense fallback={null}>
|
|
181
|
+
<MergePdf />
|
|
182
|
+
</Suspense>
|
|
183
|
+
</PdfToolsProvider>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`PdfToolsProvider` is optional. It accepts:
|
|
189
|
+
|
|
190
|
+
- `backLink`: `{ href, label? }`, shown under each tool. Omit it to hide the
|
|
191
|
+
link.
|
|
192
|
+
- `renderLink`: renders links with your router. The default is a plain `<a>`.
|
|
193
|
+
- `header`: a React node shown above the title card, such as your app's
|
|
194
|
+
navigation.
|
|
195
|
+
- `className`: classes for the outer wrapper. The default is `py-8 sm:py-12`.
|
|
196
|
+
|
|
197
|
+
### Styling
|
|
198
|
+
|
|
199
|
+
The components use [Tailwind CSS](https://tailwindcss.com) utility classes.
|
|
200
|
+
Dark mode is driven by a `dark` class on `<html>` or any ancestor element.
|
|
201
|
+
|
|
202
|
+
- **Your app uses Tailwind v4:** add the package to your sources, and use a
|
|
203
|
+
class-based dark variant:
|
|
204
|
+
|
|
205
|
+
```css
|
|
206
|
+
@import "tailwindcss";
|
|
207
|
+
@source "../node_modules/@kitsy/pdf/dist";
|
|
208
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- **Your app doesn't use Tailwind:** import the prebuilt stylesheet. It is
|
|
212
|
+
about 32 KB, and its reset applies only inside the tools' root element.
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
import "@kitsy/pdf/styles.css";
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Icons use [Font Awesome 6 Free](https://fontawesome.com) class names
|
|
219
|
+
(`fa-solid ...`). Load Font Awesome in your app if you want them. Without it,
|
|
220
|
+
the tools still work but show no icons.
|
|
221
|
+
|
|
222
|
+
## Browser support
|
|
223
|
+
|
|
224
|
+
Current Chrome, Edge, Firefox and Safari. These APIs are required:
|
|
225
|
+
|
|
226
|
+
- WebCrypto (`crypto.subtle`)
|
|
227
|
+
- WebAssembly
|
|
228
|
+
- `DecompressionStream`
|
|
229
|
+
- `createImageBitmap`
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
pnpm install
|
|
235
|
+
pnpm run typecheck
|
|
236
|
+
pnpm test
|
|
237
|
+
pnpm run build # dist/ with JS, type definitions and styles.css
|
|
238
|
+
pnpm pack # inspect exactly what would be published
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Publishing
|
|
242
|
+
|
|
243
|
+
1. Update the version in `package.json` and `CHANGELOG.md`.
|
|
244
|
+
2. `pnpm run check` (typecheck, tests, build). `prepublishOnly` runs it
|
|
245
|
+
again.
|
|
246
|
+
3. `npm publish`. The repository's `.npmrc` maps the `@kitsy` scope to the
|
|
247
|
+
public registry (registry.npmjs.org), overriding a user-level mapping to a
|
|
248
|
+
private registry. A command-line `--registry` flag does **not** override a
|
|
249
|
+
scope mapping; `--@kitsy:registry=https://registry.npmjs.org/` does. Check
|
|
250
|
+
the "Publishing to" line of `npm publish --dry-run` first. Log in with
|
|
251
|
+
`npm login --registry=https://registry.npmjs.org/` as a member of the
|
|
252
|
+
`kitsy` npm organisation (with 2FA if the organisation requires it).
|
|
253
|
+
|
|
254
|
+
## License
|
|
255
|
+
|
|
256
|
+
[Apache-2.0](LICENSE). Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED.
|
|
257
|
+
Third-party licenses are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@kitsy/pdf` is licensed under the [Apache License 2.0](LICENSE). It uses the
|
|
4
|
+
open-source packages below. They are installed from npm as dependencies; this
|
|
5
|
+
package does not copy or modify their code. When you bundle an app that uses
|
|
6
|
+
`@kitsy/pdf`, your bundle includes code from these packages, so their licenses
|
|
7
|
+
apply to that bundle too.
|
|
8
|
+
|
|
9
|
+
## Runtime dependencies
|
|
10
|
+
|
|
11
|
+
| Package | License | Used for |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| [pdf-lib](https://github.com/Hopding/pdf-lib) | MIT | Reading and writing PDFs |
|
|
14
|
+
| [@pdf-lib/standard-fonts](https://github.com/Hopding/standard-fonts), [@pdf-lib/upng](https://github.com/Hopding/upng) | MIT | pdf-lib internals |
|
|
15
|
+
| [pako](https://github.com/nodeca/pako) | MIT AND Zlib | Compression (via pdf-lib) |
|
|
16
|
+
| [pdfjs-dist](https://github.com/mozilla/pdf.js) (pdf.js) | Apache-2.0 | Page previews, PDF to images |
|
|
17
|
+
| [@neslinesli93/qpdf-wasm](https://github.com/neslinesli93/qpdf-wasm) | ISC | Encryption and decryption (Protect / Unlock) |
|
|
18
|
+
| [qpdf](https://github.com/qpdf/qpdf) (inside the WebAssembly above) | Apache-2.0 | Encryption and decryption |
|
|
19
|
+
| [pkijs](https://github.com/PeculiarVentures/PKI.js) | BSD-3-Clause | CMS signatures and X.509 certificates |
|
|
20
|
+
| [asn1js](https://github.com/PeculiarVentures/ASN1.js) | BSD-3-Clause | ASN.1 encoding (via pkijs) |
|
|
21
|
+
| [bytestreamjs](https://github.com/PeculiarVentures/ByteStream.js) | BSD-3-Clause | pkijs internals |
|
|
22
|
+
| [pvtsutils](https://github.com/PeculiarVentures/pvtsutils), [pvutils](https://github.com/PeculiarVentures/pvutils) | MIT | pkijs internals |
|
|
23
|
+
| [@noble/hashes](https://github.com/paulmillr/noble-hashes) | MIT | pkijs internals |
|
|
24
|
+
| [tslib](https://github.com/microsoft/tslib) | 0BSD | Helpers used by dependencies |
|
|
25
|
+
| [node-forge](https://github.com/digitalbazaar/forge) | BSD-3-Clause OR GPL-2.0 (used under BSD-3-Clause) | Decrypting `.pfx` / `.p12` certificate files only |
|
|
26
|
+
| [@fontsource/dancing-script](https://github.com/fontsource/font-files) | OFL-1.1 (font), MIT (packaging) | Typed signature style (React UI) |
|
|
27
|
+
| [@fontsource/great-vibes](https://github.com/fontsource/font-files) | OFL-1.1 (font), MIT (packaging) | Typed signature style (React UI) |
|
|
28
|
+
|
|
29
|
+
`pdfjs-dist` also lists `@napi-rs/canvas` (MIT) as an optional dependency for
|
|
30
|
+
Node. Browsers do not use it.
|
|
31
|
+
|
|
32
|
+
## Optional peer dependency
|
|
33
|
+
|
|
34
|
+
| Package | License |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| [react](https://github.com/facebook/react) | MIT |
|
|
37
|
+
|
|
38
|
+
## Not included
|
|
39
|
+
|
|
40
|
+
- Font Awesome: the React UI uses its class names (`fa-solid ...`) for icons
|
|
41
|
+
but does not ship it. If you load it, its own license applies (icons
|
|
42
|
+
CC BY 4.0, fonts SIL OFL 1.1, code MIT).
|
|
43
|
+
- pdf.js CMaps and standard fonts are not shipped. If you serve them (see
|
|
44
|
+
`pdfjsAssetsBase` in the README), they come from `pdfjs-dist` under its
|
|
45
|
+
licenses.
|
|
46
|
+
|
|
47
|
+
The full license text of each package is in its folder under `node_modules`
|
|
48
|
+
after install, and at the links above.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { fieldLabelClass, inputClass } from './chunk-H6EERRCR.js';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function PasswordInput({ id, label, value, onChange, disabled, autoComplete = "new-password", hint = "", inputRef = void 0 }) {
|
|
6
|
+
const [visible, setVisible] = useState(false);
|
|
7
|
+
const hintId = `${id}-hint`;
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: fieldLabelClass, children: label }),
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
"input",
|
|
13
|
+
{
|
|
14
|
+
id,
|
|
15
|
+
ref: inputRef,
|
|
16
|
+
type: visible ? "text" : "password",
|
|
17
|
+
value,
|
|
18
|
+
onChange: (event) => onChange(event.target.value),
|
|
19
|
+
disabled,
|
|
20
|
+
autoComplete,
|
|
21
|
+
spellCheck: false,
|
|
22
|
+
"aria-describedby": hint ? hintId : void 0,
|
|
23
|
+
className: inputClass
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
type: "button",
|
|
30
|
+
onClick: () => setVisible((current) => !current),
|
|
31
|
+
className: "shrink-0 text-xs font-semibold normal-case tracking-normal text-[#1F8CFF]",
|
|
32
|
+
"aria-label": visible ? `Hide ${label}` : `Show ${label}`,
|
|
33
|
+
children: visible ? "Hide" : "Show"
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] }),
|
|
37
|
+
hint ? /* @__PURE__ */ jsx("p", { id: hintId, className: "mt-1 text-[11px] text-slate-500 dark:text-slate-400", children: hint }) : null
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { PasswordInput };
|
|
42
|
+
//# sourceMappingURL=chunk-2K5X7L5J.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-2K5X7L5J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/PasswordInput.tsx"],"names":[],"mappings":";;;;AAIO,SAAS,aAAA,CAAc,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,YAAA,GAAe,cAAA,EAAgB,IAAA,GAAO,EAAA,EAAI,QAAA,GAAW,QAAU,EAAG;AACtI,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,GAAG,EAAE,CAAA,KAAA,CAAA;AACpB,EAAA,4BACG,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,OAAA,EAAA,EAAM,OAAA,EAAS,EAAA,EAAI,SAAA,EAAW,iBAC5B,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,oBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BAAA,EACb,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,EAAA;AAAA,UACA,GAAA,EAAK,QAAA;AAAA,UACL,IAAA,EAAM,UAAU,MAAA,GAAS,UAAA;AAAA,UACzB,KAAA;AAAA,UACA,UAAU,CAAC,KAAA,KAAU,QAAA,CAAS,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,UAChD,QAAA;AAAA,UACA,YAAA;AAAA,UACA,UAAA,EAAY,KAAA;AAAA,UACZ,kBAAA,EAAkB,OAAO,MAAA,GAAS,MAAA;AAAA,UAClC,SAAA,EAAW;AAAA;AAAA,OACb;AAAA,sBACA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,SAAS,MAAM,UAAA,CAAW,CAAC,OAAA,KAAY,CAAC,OAAO,CAAA;AAAA,UAC/C,SAAA,EAAU,2EAAA;AAAA,UACV,cAAY,OAAA,GAAU,CAAA,KAAA,EAAQ,KAAK,CAAA,CAAA,GAAK,QAAQ,KAAK,CAAA,CAAA;AAAA,UAEpD,oBAAU,MAAA,GAAS;AAAA;AAAA;AACtB,KAAA,EACF,CAAA;AAAA,IACC,IAAA,uBACE,GAAA,EAAA,EAAE,EAAA,EAAI,QAAQ,SAAA,EAAU,qDAAA,EACtB,gBACH,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"chunk-2K5X7L5J.js","sourcesContent":["import React, { useState } from \"react\";\nimport { fieldLabelClass, inputClass } from \"./ToolLayout\";\n\n/** A password field with a show/hide toggle; the hint is linked via aria-describedby. */\nexport function PasswordInput({ id, label, value, onChange, disabled, autoComplete = \"new-password\", hint = \"\", inputRef = undefined }) {\n const [visible, setVisible] = useState(false);\n const hintId = `${id}-hint`;\n return (\n <div>\n <label htmlFor={id} className={fieldLabelClass}>\n {label}\n </label>\n <div className=\"mt-2 flex items-center gap-2\">\n <input\n id={id}\n ref={inputRef}\n type={visible ? \"text\" : \"password\"}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n disabled={disabled}\n autoComplete={autoComplete}\n spellCheck={false}\n aria-describedby={hint ? hintId : undefined}\n className={inputClass}\n />\n <button\n type=\"button\"\n onClick={() => setVisible((current) => !current)}\n className=\"shrink-0 text-xs font-semibold normal-case tracking-normal text-[#1F8CFF]\"\n aria-label={visible ? `Hide ${label}` : `Show ${label}`}\n >\n {visible ? \"Hide\" : \"Show\"}\n </button>\n </div>\n {hint ? (\n <p id={hintId} className=\"mt-1 text-[11px] text-slate-500 dark:text-slate-400\">\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n"]}
|