react-pdf-highlighter-plus 1.1.1 → 1.1.3

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.
@@ -0,0 +1,15 @@
1
+ .MouseSelection {
2
+ position: absolute;
3
+ border: 1px dashed #333;
4
+ background: rgba(153,193,218,255);
5
+ mix-blend-mode: multiply;
6
+ }
7
+ /* Internet Explorer support method */
8
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
9
+ .MouseSelection {opacity: 0.5 }
10
+ }
11
+
12
+ /* Microsoft Edge Browser 12+ (All) - @supports method */
13
+ @supports (-ms-ime-align:auto) {
14
+ .MouseSelection {opacity: 0.5 }
15
+ }
@@ -0,0 +1,91 @@
1
+ .PdfHighlighter {
2
+ position: absolute;
3
+ overflow: auto;
4
+ width: 100%;
5
+ height: 100%;
6
+ /* background-color is now controlled via inline style for theming */
7
+ }
8
+
9
+ /* Style the scrollbar */
10
+ .PdfHighlighter::-webkit-scrollbar {
11
+ width: 10px;
12
+ height: 10px;
13
+ }
14
+
15
+ .PdfHighlighter::-webkit-scrollbar-thumb {
16
+ background-color: #9f9f9f;
17
+ border-radius: 5px;
18
+ }
19
+
20
+ .PdfHighlighter::-webkit-scrollbar-thumb:hover {
21
+ background-color: #d1d1d1;
22
+ }
23
+
24
+ .PdfHighlighter::-webkit-scrollbar-track {
25
+ background-color: #2c2c2c;
26
+ border-radius: 5px;
27
+ }
28
+
29
+ .PdfHighlighter::-webkit-scrollbar-track-piece {
30
+ background-color: #2c2c2c;
31
+ }
32
+
33
+ .PdfHighlighter__tip-container {
34
+ z-index: 6;
35
+ position: absolute;
36
+ }
37
+
38
+ .PdfHighlighter--disable-selection {
39
+ user-select: none;
40
+ pointer-events: none;
41
+ }
42
+
43
+ .PdfHighlighter--freetext-mode {
44
+ cursor: crosshair;
45
+ }
46
+
47
+ .PdfHighlighter--freetext-mode .pdfViewer,
48
+ .PdfHighlighter--freetext-mode .textLayer {
49
+ cursor: crosshair;
50
+ }
51
+
52
+ .PdfHighlighter--image-mode {
53
+ cursor: crosshair;
54
+ }
55
+
56
+ .PdfHighlighter--image-mode .pdfViewer,
57
+ .PdfHighlighter--image-mode .textLayer {
58
+ cursor: crosshair;
59
+ }
60
+
61
+ .PdfHighlighter--drawing-mode {
62
+ cursor: crosshair;
63
+ }
64
+
65
+ .PdfHighlighter--drawing-mode .pdfViewer,
66
+ .PdfHighlighter--drawing-mode .textLayer {
67
+ cursor: crosshair;
68
+ }
69
+
70
+ .PdfHighlighter--area-mode {
71
+ cursor: crosshair;
72
+ }
73
+
74
+ .PdfHighlighter--area-mode .pdfViewer,
75
+ .PdfHighlighter--area-mode .textLayer {
76
+ cursor: crosshair;
77
+ }
78
+
79
+ /* Dark mode - softer inversion for comfortable reading
80
+ Uses 0.9 intensity by default for a dark gray (~#1a1a1a) instead of pure black.
81
+ The brightness adjustment helps maintain readability.
82
+ Note: These are fallback values - actual intensity is controlled via inline styles
83
+ when darkModeInvertIntensity is customized in the theme prop. */
84
+ .PdfHighlighter--dark .page {
85
+ filter: invert(0.9) hue-rotate(180deg) brightness(1.05);
86
+ }
87
+
88
+ /* Double-invert highlights to preserve their original colors */
89
+ .PdfHighlighter--dark .PdfHighlighter__highlight-layer {
90
+ filter: invert(0.9) hue-rotate(180deg) brightness(0.95);
91
+ }
@@ -0,0 +1,47 @@
1
+ .ShapeCanvas {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ cursor: crosshair;
8
+ z-index: 1000;
9
+ background: rgba(0, 0, 0, 0.1);
10
+ }
11
+
12
+ .ShapeCanvas__controls {
13
+ position: fixed;
14
+ bottom: 20px;
15
+ left: 50%;
16
+ transform: translateX(-50%);
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: center;
20
+ gap: 12px;
21
+ z-index: 1002;
22
+ }
23
+
24
+ .ShapeCanvas__hint {
25
+ background: rgba(0, 0, 0, 0.8);
26
+ color: white;
27
+ padding: 8px 16px;
28
+ border-radius: 6px;
29
+ font-size: 14px;
30
+ white-space: nowrap;
31
+ }
32
+
33
+ .ShapeCanvas__cancelButton {
34
+ padding: 8px 20px;
35
+ background: #f44336;
36
+ color: white;
37
+ border: none;
38
+ border-radius: 4px;
39
+ cursor: pointer;
40
+ font-size: 14px;
41
+ font-weight: 500;
42
+ transition: background 0.2s;
43
+ }
44
+
45
+ .ShapeCanvas__cancelButton:hover {
46
+ background: #d32f2f;
47
+ }
@@ -0,0 +1,182 @@
1
+ .ShapeHighlight {
2
+ position: absolute;
3
+ }
4
+
5
+ .ShapeHighlight__rnd {
6
+ cursor: move;
7
+ }
8
+
9
+ .ShapeHighlight__container {
10
+ width: 100%;
11
+ height: 100%;
12
+ position: relative;
13
+ }
14
+
15
+ .ShapeHighlight__svg {
16
+ width: 100%;
17
+ height: 100%;
18
+ display: block;
19
+ }
20
+
21
+ .ShapeHighlight--scrolledTo .ShapeHighlight__svg rect,
22
+ .ShapeHighlight--scrolledTo .ShapeHighlight__svg ellipse,
23
+ .ShapeHighlight--scrolledTo .ShapeHighlight__svg line {
24
+ stroke: #ff4141 !important;
25
+ }
26
+
27
+ .ShapeHighlight--scrolledTo .ShapeHighlight__svg polygon {
28
+ fill: #ff4141 !important;
29
+ }
30
+
31
+ /* Toolbar wrapper - creates hover bridge between toolbar and shape */
32
+ .ShapeHighlight__toolbar-wrapper {
33
+ z-index: 10;
34
+ }
35
+
36
+ /* Toolbar - appears on hover */
37
+ .ShapeHighlight__toolbar {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 4px;
41
+ padding: 2px 4px;
42
+ background: rgba(0, 0, 0, 0.7);
43
+ border-radius: 4px;
44
+ opacity: 0;
45
+ pointer-events: none;
46
+ transition: opacity 0.2s ease;
47
+ }
48
+
49
+ .ShapeHighlight__toolbar--visible {
50
+ opacity: 1;
51
+ pointer-events: auto;
52
+ }
53
+
54
+ .ShapeHighlight__style-button,
55
+ .ShapeHighlight__delete-button {
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ width: 20px;
60
+ height: 20px;
61
+ border: none;
62
+ background: transparent;
63
+ cursor: pointer;
64
+ color: white;
65
+ border-radius: 3px;
66
+ padding: 0;
67
+ transition: background 0.2s;
68
+ }
69
+
70
+ .ShapeHighlight__style-button:hover {
71
+ background: rgba(255, 255, 255, 0.2);
72
+ }
73
+
74
+ .ShapeHighlight__delete-button:hover {
75
+ background: rgba(255, 100, 100, 0.6);
76
+ }
77
+
78
+ /* Style Panel */
79
+ .ShapeHighlight__style-panel {
80
+ margin-top: 4px;
81
+ background: rgba(0, 0, 0, 0.9);
82
+ border-radius: 6px;
83
+ padding: 8px;
84
+ min-width: 180px;
85
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
86
+ }
87
+
88
+ .ShapeHighlight__style-row {
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: space-between;
92
+ margin-bottom: 8px;
93
+ }
94
+
95
+ .ShapeHighlight__style-row:last-child {
96
+ margin-bottom: 0;
97
+ }
98
+
99
+ .ShapeHighlight__style-row label {
100
+ color: #ccc;
101
+ font-size: 11px;
102
+ text-transform: uppercase;
103
+ letter-spacing: 0.5px;
104
+ margin-right: 8px;
105
+ }
106
+
107
+ /* Color options */
108
+ .ShapeHighlight__color-options {
109
+ display: flex;
110
+ align-items: center;
111
+ gap: 6px;
112
+ }
113
+
114
+ .ShapeHighlight__color-presets {
115
+ display: flex;
116
+ gap: 4px;
117
+ }
118
+
119
+ .ShapeHighlight__color-preset {
120
+ width: 18px;
121
+ height: 18px;
122
+ border: 2px solid transparent;
123
+ border-radius: 50%;
124
+ cursor: pointer;
125
+ transition: transform 0.2s, border-color 0.2s;
126
+ padding: 0;
127
+ }
128
+
129
+ .ShapeHighlight__color-preset:hover {
130
+ transform: scale(1.15);
131
+ }
132
+
133
+ .ShapeHighlight__color-preset.active {
134
+ border-color: #b958ff;
135
+ }
136
+
137
+ .ShapeHighlight__color-options input[type="color"] {
138
+ width: 24px;
139
+ height: 24px;
140
+ padding: 0;
141
+ border: none;
142
+ border-radius: 4px;
143
+ cursor: pointer;
144
+ background: transparent;
145
+ }
146
+
147
+ .ShapeHighlight__color-options input[type="color"]::-webkit-color-swatch-wrapper {
148
+ padding: 0;
149
+ }
150
+
151
+ .ShapeHighlight__color-options input[type="color"]::-webkit-color-swatch {
152
+ border: 1px solid #666;
153
+ border-radius: 4px;
154
+ }
155
+
156
+ /* Stroke width options */
157
+ .ShapeHighlight__width-options {
158
+ display: flex;
159
+ gap: 4px;
160
+ }
161
+
162
+ .ShapeHighlight__width-button {
163
+ padding: 4px 8px;
164
+ background: transparent;
165
+ border: 1px solid #666;
166
+ border-radius: 4px;
167
+ cursor: pointer;
168
+ color: #ccc;
169
+ font-size: 11px;
170
+ transition: all 0.2s;
171
+ }
172
+
173
+ .ShapeHighlight__width-button:hover {
174
+ border-color: #b958ff;
175
+ color: white;
176
+ }
177
+
178
+ .ShapeHighlight__width-button.active {
179
+ background: rgba(185, 88, 255, 0.2);
180
+ border-color: #b958ff;
181
+ color: #b958ff;
182
+ }
@@ -0,0 +1,83 @@
1
+ .SignaturePad__overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ background: rgba(0, 0, 0, 0.5);
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ z-index: 10000;
12
+ }
13
+
14
+ .SignaturePad__modal {
15
+ background: white;
16
+ border-radius: 8px;
17
+ padding: 16px;
18
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
19
+ }
20
+
21
+ .SignaturePad__title {
22
+ margin: 0 0 12px 0;
23
+ font-size: 16px;
24
+ font-weight: 600;
25
+ color: #333;
26
+ }
27
+
28
+ .SignaturePad__canvas {
29
+ display: block;
30
+ border: 1px solid #ccc;
31
+ border-radius: 4px;
32
+ cursor: crosshair;
33
+ touch-action: none;
34
+ background: white;
35
+ }
36
+
37
+ .SignaturePad__buttons {
38
+ display: flex;
39
+ gap: 8px;
40
+ margin-top: 12px;
41
+ justify-content: flex-end;
42
+ }
43
+
44
+ .SignaturePad__button {
45
+ padding: 8px 16px;
46
+ font-size: 14px;
47
+ border-radius: 4px;
48
+ cursor: pointer;
49
+ transition: background-color 0.2s, border-color 0.2s;
50
+ }
51
+
52
+ .SignaturePad__button--clear {
53
+ background: white;
54
+ border: 1px solid #ccc;
55
+ color: #666;
56
+ }
57
+
58
+ .SignaturePad__button--clear:hover {
59
+ background: #f5f5f5;
60
+ border-color: #999;
61
+ }
62
+
63
+ .SignaturePad__button--cancel {
64
+ background: white;
65
+ border: 1px solid #ccc;
66
+ color: #666;
67
+ }
68
+
69
+ .SignaturePad__button--cancel:hover {
70
+ background: #f5f5f5;
71
+ border-color: #999;
72
+ }
73
+
74
+ .SignaturePad__button--done {
75
+ background: #2196f3;
76
+ border: 1px solid #2196f3;
77
+ color: white;
78
+ }
79
+
80
+ .SignaturePad__button--done:hover {
81
+ background: #1976d2;
82
+ border-color: #1976d2;
83
+ }
@@ -0,0 +1,199 @@
1
+ .TextHighlight {
2
+ position: absolute;
3
+ }
4
+
5
+ .TextHighlight__parts {
6
+ opacity: 1;
7
+ }
8
+
9
+ .TextHighlight__part {
10
+ cursor: pointer;
11
+ position: absolute;
12
+ background: rgba(255, 226, 143, 1);
13
+ transition: background 0.3s;
14
+ }
15
+
16
+ .TextHighlight--scrolledTo .TextHighlight__part {
17
+ background: #ff4141;
18
+ }
19
+
20
+ /* Toolbar wrapper - creates hover bridge between toolbar and highlight */
21
+ .TextHighlight__toolbar-wrapper {
22
+ z-index: 10;
23
+ }
24
+
25
+ /* Toolbar - appears on hover */
26
+ .TextHighlight__toolbar {
27
+ display: flex;
28
+ align-items: center;
29
+ gap: 4px;
30
+ padding: 2px 4px;
31
+ background: rgba(0, 0, 0, 0.7);
32
+ border-radius: 4px;
33
+ opacity: 0;
34
+ pointer-events: none;
35
+ transition: opacity 0.2s ease;
36
+ }
37
+
38
+ .TextHighlight__toolbar--visible {
39
+ opacity: 1;
40
+ pointer-events: auto;
41
+ }
42
+
43
+ .TextHighlight__style-button,
44
+ .TextHighlight__delete-button {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ width: 20px;
49
+ height: 20px;
50
+ border: none;
51
+ background: transparent;
52
+ cursor: pointer;
53
+ color: white;
54
+ border-radius: 3px;
55
+ padding: 0;
56
+ transition: background 0.2s;
57
+ }
58
+
59
+ .TextHighlight__style-button:hover {
60
+ background: rgba(255, 255, 255, 0.2);
61
+ }
62
+
63
+ .TextHighlight__delete-button:hover {
64
+ background: rgba(255, 100, 100, 0.6);
65
+ }
66
+
67
+ /* Style Panel */
68
+ .TextHighlight__style-panel {
69
+ margin-top: 4px;
70
+ background: rgba(0, 0, 0, 0.9);
71
+ border-radius: 6px;
72
+ padding: 8px;
73
+ min-width: 180px;
74
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
75
+ }
76
+
77
+ .TextHighlight__style-row {
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: space-between;
81
+ margin-bottom: 8px;
82
+ }
83
+
84
+ .TextHighlight__style-row:last-child {
85
+ margin-bottom: 0;
86
+ }
87
+
88
+ .TextHighlight__style-row label {
89
+ color: #ccc;
90
+ font-size: 11px;
91
+ text-transform: uppercase;
92
+ letter-spacing: 0.5px;
93
+ margin-right: 8px;
94
+ }
95
+
96
+ /* Style type buttons (highlight, underline, strikethrough) */
97
+ .TextHighlight__style-buttons {
98
+ display: flex;
99
+ gap: 4px;
100
+ }
101
+
102
+ .TextHighlight__style-type-button {
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ width: 28px;
107
+ height: 28px;
108
+ padding: 0;
109
+ background: transparent;
110
+ border: 1px solid #666;
111
+ border-radius: 4px;
112
+ cursor: pointer;
113
+ color: #f5f5f5;
114
+ transition: all 0.2s;
115
+ }
116
+
117
+ .TextHighlight__style-type-button:hover {
118
+ border-color: #b958ff;
119
+ }
120
+
121
+ .TextHighlight__style-type-button.active {
122
+ color: #b958ff;
123
+ border-color: #b958ff;
124
+ background: rgba(185, 88, 255, 0.2);
125
+ }
126
+
127
+ /* Color options */
128
+ .TextHighlight__color-options {
129
+ display: flex;
130
+ align-items: center;
131
+ gap: 6px;
132
+ }
133
+
134
+ .TextHighlight__color-presets {
135
+ display: flex;
136
+ gap: 4px;
137
+ }
138
+
139
+ .TextHighlight__color-preset {
140
+ width: 18px;
141
+ height: 18px;
142
+ border: 2px solid transparent;
143
+ border-radius: 50%;
144
+ cursor: pointer;
145
+ transition: transform 0.2s, border-color 0.2s;
146
+ padding: 0;
147
+ }
148
+
149
+ .TextHighlight__color-preset:hover {
150
+ transform: scale(1.15);
151
+ }
152
+
153
+ .TextHighlight__color-preset.active {
154
+ border-color: #b958ff;
155
+ }
156
+
157
+ .TextHighlight__color-options input[type="color"] {
158
+ width: 24px;
159
+ height: 24px;
160
+ padding: 0;
161
+ border: none;
162
+ border-radius: 4px;
163
+ cursor: pointer;
164
+ background: transparent;
165
+ }
166
+
167
+ .TextHighlight__color-options input[type="color"]::-webkit-color-swatch-wrapper {
168
+ padding: 0;
169
+ }
170
+
171
+ .TextHighlight__color-options input[type="color"]::-webkit-color-swatch {
172
+ border: 1px solid #666;
173
+ border-radius: 4px;
174
+ }
175
+
176
+ /* Underline style */
177
+ .TextHighlight__part--underline {
178
+ background: transparent !important;
179
+ border-bottom: 2px solid currentColor;
180
+ }
181
+
182
+ /* Strikethrough style */
183
+ .TextHighlight__part.TextHighlight__part--strikethrough {
184
+ background: transparent !important;
185
+ overflow: visible;
186
+ }
187
+
188
+ .TextHighlight__part.TextHighlight__part--strikethrough::after {
189
+ content: "";
190
+ position: absolute;
191
+ left: 0;
192
+ right: 0;
193
+ top: 50%;
194
+ height: 2px;
195
+ background-color: currentColor;
196
+ transform: translateY(-50%);
197
+ pointer-events: none;
198
+ z-index: 1;
199
+ }
@@ -0,0 +1,41 @@
1
+ /* overrides for pdf_viewer.css from PDF.JS web viewer */
2
+
3
+ .textLayer {
4
+ z-index: 2;
5
+ opacity: 1;
6
+ mix-blend-mode: multiply;
7
+ display: flex;
8
+ }
9
+
10
+ .annotationLayer {
11
+ position: absolute;
12
+ top: 0;
13
+
14
+ z-index: 3;
15
+ }
16
+
17
+ html
18
+ body
19
+ .textLayer
20
+ > div:not(.PdfHighlighter__highlight-layer):not(.TextHighlight):not(.TextHighlight-icon) {
21
+ opacity: 1;
22
+ mix-blend-mode: multiply;
23
+ }
24
+
25
+ .textLayer ::selection {
26
+ mix-blend-mode: multiply;
27
+ }
28
+
29
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
30
+ .textLayer {opacity: 0.5;}
31
+ }
32
+
33
+ /* Internet Explorer support method */
34
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
35
+ .textLayer {opacity: 0.5 }
36
+ }
37
+
38
+ /* Microsoft Edge Browser 12+ (All) - @supports method */
39
+ @supports (-ms-ime-align:auto) {
40
+ .textLayer {opacity: 0.5 }
41
+ }
@@ -0,0 +1,13 @@
1
+ /* Combined styles for react-pdf-highlighter-plus */
2
+ @import "./pdf_viewer.css";
3
+ @import "./PdfHighlighter.css";
4
+ @import "./MouseSelection.css";
5
+ @import "./TextHighlight.css";
6
+ @import "./AreaHighlight.css";
7
+ @import "./FreetextHighlight.css";
8
+ @import "./ImageHighlight.css";
9
+ @import "./DrawingHighlight.css";
10
+ @import "./DrawingCanvas.css";
11
+ @import "./SignaturePad.css";
12
+ @import "./ShapeCanvas.css";
13
+ @import "./ShapeHighlight.css";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-pdf-highlighter-plus",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.3",
5
5
  "description": "Set of modern React components for PDF highlighting",
6
6
  "author": "Edward Ha <quocvietha08@gmail.com>",
7
7
  "license": "MIT",
@@ -30,11 +30,21 @@
30
30
  "exports": {
31
31
  ".": {
32
32
  "types": "./dist/esm/index.d.ts",
33
- "import": "./dist/esm/index.js"
33
+ "import": "./dist/esm/index.js",
34
+ "default": "./dist/esm/index.js"
34
35
  },
35
- "./style/style.css": "./dist/esm/style/style.css",
36
- "./style/pdf_viewer.css": "./dist/esm/style/pdf_viewer.css",
37
- "./style/*.css": "./dist/esm/style/*.css"
36
+ "./style/style.css": {
37
+ "import": "./dist/esm/style/style.css",
38
+ "default": "./dist/esm/style/style.css"
39
+ },
40
+ "./style/pdf_viewer.css": {
41
+ "import": "./dist/esm/style/pdf_viewer.css",
42
+ "default": "./dist/esm/style/pdf_viewer.css"
43
+ },
44
+ "./style/*.css": {
45
+ "import": "./dist/esm/style/*.css",
46
+ "default": "./dist/esm/style/*.css"
47
+ }
38
48
  },
39
49
  "scripts": {
40
50
  "start": "npm run dev",