@performant-software/semantic-components 1.1.3 → 1.1.4-beta.10
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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/main.css +709 -0
- package/package.json +2 -2
- package/src/components/AnnotationLayer.css +329 -0
- package/src/components/FacetSlider.css +2 -0
- package/src/components/FacetSlider.js +8 -4
- package/src/components/LazyDocument.css +3 -0
- package/src/components/LazyDocument.js +26 -9
- package/src/components/TextLayer.css +110 -0
- package/src/components/ViewPDFButton.js +68 -0
- package/src/components/rc-slider.css +267 -0
- package/src/i18n/en.json +3 -2
- package/src/index.js +1 -0
- package/types/components/FacetSlider.js.flow +8 -4
- package/types/components/LazyDocument.js.flow +26 -9
- package/types/components/ViewPDFButton.js.flow +68 -0
- package/types/index.js.flow +1 -0
- package/webpack.config.js +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@performant-software/semantic-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4-beta.10",
|
|
4
4
|
"description": "A package of shared components based on the Semantic UI Framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "webpack --mode production && flow-copy-source -v src types"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@performant-software/shared-components": "^1.1.
|
|
15
|
+
"@performant-software/shared-components": "^1.1.4-beta.10",
|
|
16
16
|
"@react-google-maps/api": "^2.8.1",
|
|
17
17
|
"axios": "^0.26.1",
|
|
18
18
|
"i18next": "^19.4.4",
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/* Copyright 2014 Mozilla Foundation
|
|
2
|
+
*
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
:root {
|
|
17
|
+
--react-pdf-annotation-layer: 1;
|
|
18
|
+
--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");
|
|
19
|
+
--input-focus-border-color: Highlight;
|
|
20
|
+
--input-focus-outline: 1px solid Canvas;
|
|
21
|
+
--input-unfocused-border-color: transparent;
|
|
22
|
+
--input-disabled-border-color: transparent;
|
|
23
|
+
--input-hover-border-color: black;
|
|
24
|
+
--link-outline: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media screen and (forced-colors: active) {
|
|
28
|
+
:root {
|
|
29
|
+
--input-focus-border-color: CanvasText;
|
|
30
|
+
--input-unfocused-border-color: ActiveText;
|
|
31
|
+
--input-disabled-border-color: GrayText;
|
|
32
|
+
--input-hover-border-color: Highlight;
|
|
33
|
+
--link-outline: 1.5px solid LinkText;
|
|
34
|
+
}
|
|
35
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
|
|
36
|
+
.annotationLayer .choiceWidgetAnnotation select:required,
|
|
37
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:required {
|
|
38
|
+
outline: 1.5px solid selectedItem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.annotationLayer .linkAnnotation:hover {
|
|
42
|
+
backdrop-filter: invert(100%);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.annotationLayer {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
transform-origin: 0 0;
|
|
52
|
+
z-index: 3;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.annotationLayer[data-main-rotation='90'] .norotate {
|
|
56
|
+
transform: rotate(270deg) translateX(-100%);
|
|
57
|
+
}
|
|
58
|
+
.annotationLayer[data-main-rotation='180'] .norotate {
|
|
59
|
+
transform: rotate(180deg) translate(-100%, -100%);
|
|
60
|
+
}
|
|
61
|
+
.annotationLayer[data-main-rotation='270'] .norotate {
|
|
62
|
+
transform: rotate(90deg) translateY(-100%);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.annotationLayer canvas {
|
|
66
|
+
position: absolute;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.annotationLayer section {
|
|
72
|
+
position: absolute;
|
|
73
|
+
text-align: initial;
|
|
74
|
+
pointer-events: auto;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
margin: 0;
|
|
77
|
+
transform-origin: 0 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.annotationLayer .linkAnnotation {
|
|
81
|
+
outline: var(--link-outline);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a {
|
|
85
|
+
position: absolute;
|
|
86
|
+
font-size: 1em;
|
|
87
|
+
top: 0;
|
|
88
|
+
left: 0;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a:hover {
|
|
94
|
+
opacity: 0.2;
|
|
95
|
+
background: rgba(255, 255, 0, 1);
|
|
96
|
+
box-shadow: 0 2px 10px rgba(255, 255, 0, 1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.annotationLayer .textAnnotation img {
|
|
100
|
+
position: absolute;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
top: 0;
|
|
105
|
+
left: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea),
|
|
109
|
+
.annotationLayer .choiceWidgetAnnotation select,
|
|
110
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
|
|
111
|
+
background-image: var(--annotation-unfocused-field-background);
|
|
112
|
+
border: 2px solid var(--input-unfocused-border-color);
|
|
113
|
+
box-sizing: border-box;
|
|
114
|
+
font: calc(9px * var(--scale-factor)) sans-serif;
|
|
115
|
+
height: 100%;
|
|
116
|
+
margin: 0;
|
|
117
|
+
vertical-align: top;
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
|
|
122
|
+
.annotationLayer .choiceWidgetAnnotation select:required,
|
|
123
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:required {
|
|
124
|
+
outline: 1.5px solid red;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.annotationLayer .choiceWidgetAnnotation select option {
|
|
128
|
+
padding: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input {
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.annotationLayer .textWidgetAnnotation textarea {
|
|
136
|
+
resize: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea)[disabled],
|
|
140
|
+
.annotationLayer .choiceWidgetAnnotation select[disabled],
|
|
141
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input[disabled] {
|
|
142
|
+
background: none;
|
|
143
|
+
border: 2px solid var(--input-disabled-border-color);
|
|
144
|
+
cursor: not-allowed;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
|
|
148
|
+
.annotationLayer .choiceWidgetAnnotation select:hover,
|
|
149
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:hover {
|
|
150
|
+
border: 2px solid var(--input-hover-border-color);
|
|
151
|
+
}
|
|
152
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
|
|
153
|
+
.annotationLayer .choiceWidgetAnnotation select:hover,
|
|
154
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:hover {
|
|
155
|
+
border-radius: 2px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):focus,
|
|
159
|
+
.annotationLayer .choiceWidgetAnnotation select:focus {
|
|
160
|
+
background: none;
|
|
161
|
+
border: 2px solid var(--input-focus-border-color);
|
|
162
|
+
border-radius: 2px;
|
|
163
|
+
outline: var(--input-focus-outline);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) :focus {
|
|
167
|
+
background-image: none;
|
|
168
|
+
background-color: transparent;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox :focus {
|
|
172
|
+
border: 2px solid var(--input-focus-border-color);
|
|
173
|
+
border-radius: 2px;
|
|
174
|
+
outline: var(--input-focus-outline);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton :focus {
|
|
178
|
+
border: 2px solid var(--input-focus-border-color);
|
|
179
|
+
outline: var(--input-focus-outline);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
|
|
183
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after,
|
|
184
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
|
|
185
|
+
background-color: CanvasText;
|
|
186
|
+
content: '';
|
|
187
|
+
display: block;
|
|
188
|
+
position: absolute;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
|
|
192
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
|
|
193
|
+
height: 80%;
|
|
194
|
+
left: 45%;
|
|
195
|
+
width: 1px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before {
|
|
199
|
+
transform: rotate(45deg);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
|
|
203
|
+
transform: rotate(-45deg);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
|
|
207
|
+
border-radius: 50%;
|
|
208
|
+
height: 50%;
|
|
209
|
+
left: 30%;
|
|
210
|
+
top: 20%;
|
|
211
|
+
width: 50%;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.annotationLayer .textWidgetAnnotation input.comb {
|
|
215
|
+
font-family: monospace;
|
|
216
|
+
padding-left: 2px;
|
|
217
|
+
padding-right: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.annotationLayer .textWidgetAnnotation input.comb:focus {
|
|
221
|
+
/*
|
|
222
|
+
* Letter spacing is placed on the right side of each character. Hence, the
|
|
223
|
+
* letter spacing of the last character may be placed outside the visible
|
|
224
|
+
* area, causing horizontal scrolling. We avoid this by extending the width
|
|
225
|
+
* when the element has focus and revert this when it loses focus.
|
|
226
|
+
*/
|
|
227
|
+
width: 103%;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
|
|
231
|
+
appearance: none;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.annotationLayer .popupTriggerArea {
|
|
235
|
+
height: 100%;
|
|
236
|
+
width: 100%;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.annotationLayer .fileAttachmentAnnotation .popupTriggerArea {
|
|
240
|
+
position: absolute;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.annotationLayer .popupWrapper {
|
|
244
|
+
position: absolute;
|
|
245
|
+
font-size: calc(9px * var(--scale-factor));
|
|
246
|
+
width: 100%;
|
|
247
|
+
min-width: calc(180px * var(--scale-factor));
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.annotationLayer .popup {
|
|
252
|
+
position: absolute;
|
|
253
|
+
max-width: calc(180px * var(--scale-factor));
|
|
254
|
+
background-color: rgba(255, 255, 153, 1);
|
|
255
|
+
box-shadow: 0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor))
|
|
256
|
+
rgba(136, 136, 136, 1);
|
|
257
|
+
border-radius: calc(2px * var(--scale-factor));
|
|
258
|
+
padding: calc(6px * var(--scale-factor));
|
|
259
|
+
margin-left: calc(5px * var(--scale-factor));
|
|
260
|
+
cursor: pointer;
|
|
261
|
+
font: message-box;
|
|
262
|
+
white-space: normal;
|
|
263
|
+
word-wrap: break-word;
|
|
264
|
+
pointer-events: auto;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.annotationLayer .popup > * {
|
|
268
|
+
font-size: calc(9px * var(--scale-factor));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.annotationLayer .popup h1 {
|
|
272
|
+
display: inline-block;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.annotationLayer .popupDate {
|
|
276
|
+
display: inline-block;
|
|
277
|
+
margin-left: calc(5px * var(--scale-factor));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.annotationLayer .popupContent {
|
|
281
|
+
border-top: 1px solid rgba(51, 51, 51, 1);
|
|
282
|
+
margin-top: calc(2px * var(--scale-factor));
|
|
283
|
+
padding-top: calc(2px * var(--scale-factor));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.annotationLayer .richText > * {
|
|
287
|
+
white-space: pre-wrap;
|
|
288
|
+
font-size: calc(9px * var(--scale-factor));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.annotationLayer .highlightAnnotation,
|
|
292
|
+
.annotationLayer .underlineAnnotation,
|
|
293
|
+
.annotationLayer .squigglyAnnotation,
|
|
294
|
+
.annotationLayer .strikeoutAnnotation,
|
|
295
|
+
.annotationLayer .freeTextAnnotation,
|
|
296
|
+
.annotationLayer .lineAnnotation svg line,
|
|
297
|
+
.annotationLayer .squareAnnotation svg rect,
|
|
298
|
+
.annotationLayer .circleAnnotation svg ellipse,
|
|
299
|
+
.annotationLayer .polylineAnnotation svg polyline,
|
|
300
|
+
.annotationLayer .polygonAnnotation svg polygon,
|
|
301
|
+
.annotationLayer .caretAnnotation,
|
|
302
|
+
.annotationLayer .inkAnnotation svg polyline,
|
|
303
|
+
.annotationLayer .stampAnnotation,
|
|
304
|
+
.annotationLayer .fileAttachmentAnnotation {
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.annotationLayer section svg {
|
|
309
|
+
position: absolute;
|
|
310
|
+
width: 100%;
|
|
311
|
+
height: 100%;
|
|
312
|
+
top: 0;
|
|
313
|
+
left: 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.annotationLayer .annotationTextContent {
|
|
317
|
+
position: absolute;
|
|
318
|
+
width: 100%;
|
|
319
|
+
height: 100%;
|
|
320
|
+
opacity: 0;
|
|
321
|
+
color: transparent;
|
|
322
|
+
user-select: none;
|
|
323
|
+
pointer-events: none;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.annotationLayer .annotationTextContent span {
|
|
327
|
+
width: 100%;
|
|
328
|
+
display: inline-block;
|
|
329
|
+
}
|
|
@@ -10,7 +10,11 @@ import React, {
|
|
|
10
10
|
import { Grid } from 'semantic-ui-react';
|
|
11
11
|
import Facet, { type Props as FacetProps } from './Facet';
|
|
12
12
|
import { type RangeSliderProps } from '../types/InstantSearch';
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// This is copied from the rc-slider node_module. SO update if updating versions
|
|
15
|
+
// See https://nextjs.org/docs/messages/css-npm
|
|
16
|
+
// import './rc-slider.css';
|
|
17
|
+
|
|
14
18
|
import './FacetSlider.css';
|
|
15
19
|
|
|
16
20
|
type Props = FacetProps & RangeSliderProps;
|
|
@@ -25,7 +29,7 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
25
29
|
refine,
|
|
26
30
|
} = useRangeSlider(props);
|
|
27
31
|
|
|
28
|
-
const [valueView, setValueView] = useState<Array<number>>([range.min, range.max]);
|
|
32
|
+
const [valueView, setValueView] = useState < Array < number >> ([range.min, range.max]);
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
35
|
* Sets the visibility variable based on the range min and max.
|
|
@@ -72,12 +76,12 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
72
76
|
columns={2}
|
|
73
77
|
>
|
|
74
78
|
<Grid.Column>
|
|
75
|
-
{
|
|
79
|
+
{valueView[0]}
|
|
76
80
|
</Grid.Column>
|
|
77
81
|
<Grid.Column
|
|
78
82
|
textAlign='right'
|
|
79
83
|
>
|
|
80
|
-
{
|
|
84
|
+
{valueView[1]}
|
|
81
85
|
</Grid.Column>
|
|
82
86
|
</Grid>
|
|
83
87
|
</div>
|
|
@@ -14,9 +14,13 @@ import {
|
|
|
14
14
|
import DownloadButton from './DownloadButton';
|
|
15
15
|
import LazyLoader from './LazyLoader';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// These are copied from the react-pdt node_module. This is for NextJS builds
|
|
18
|
+
// see https://nextjs.org/docs/messages/css-npm
|
|
19
|
+
// import './AnnotationLayer.css';
|
|
20
|
+
// import './TextLayer.css';
|
|
21
|
+
|
|
19
22
|
import './LazyDocument.css';
|
|
23
|
+
import ViewPDFButton from './ViewPDFButton';
|
|
20
24
|
|
|
21
25
|
type Props = {
|
|
22
26
|
children?: Node,
|
|
@@ -26,6 +30,8 @@ type Props = {
|
|
|
26
30
|
image?: any,
|
|
27
31
|
pdf?: boolean,
|
|
28
32
|
preview?: ?string,
|
|
33
|
+
view?: Boolean,
|
|
34
|
+
viewUrl?: String,
|
|
29
35
|
size?: string,
|
|
30
36
|
src?: string
|
|
31
37
|
};
|
|
@@ -87,13 +93,13 @@ const LazyDocument = (props: Props) => {
|
|
|
87
93
|
onMouseEnter={() => setDimmer(true)}
|
|
88
94
|
onMouseLeave={() => setDimmer(false)}
|
|
89
95
|
>
|
|
90
|
-
{
|
|
96
|
+
{!loaded && (
|
|
91
97
|
<LazyLoader
|
|
92
98
|
active
|
|
93
99
|
size={props.size}
|
|
94
100
|
/>
|
|
95
101
|
)}
|
|
96
|
-
{
|
|
102
|
+
{!error && props.preview && (
|
|
97
103
|
<Image
|
|
98
104
|
{...props.image}
|
|
99
105
|
className={getClassNames()}
|
|
@@ -109,7 +115,7 @@ const LazyDocument = (props: Props) => {
|
|
|
109
115
|
size={props.size}
|
|
110
116
|
/>
|
|
111
117
|
)}
|
|
112
|
-
{
|
|
118
|
+
{!error && loaded && !props.preview && props.src && props.pdf && (
|
|
113
119
|
<Image
|
|
114
120
|
{...props.image}
|
|
115
121
|
className={getClassNames()}
|
|
@@ -125,7 +131,18 @@ const LazyDocument = (props: Props) => {
|
|
|
125
131
|
</Document>
|
|
126
132
|
</Image>
|
|
127
133
|
)}
|
|
128
|
-
{
|
|
134
|
+
{!error && loaded && props.view && props.viewUrl && props.pdf && dimmer && (
|
|
135
|
+
<Dimmer
|
|
136
|
+
active={dimmer}
|
|
137
|
+
>
|
|
138
|
+
<div
|
|
139
|
+
className='buttons'
|
|
140
|
+
>
|
|
141
|
+
<ViewPDFButton url={props.viewUrl} primary />
|
|
142
|
+
</div>
|
|
143
|
+
</Dimmer>
|
|
144
|
+
)}
|
|
145
|
+
{(error || (!props.preview && !(props.src && props.pdf))) && (
|
|
129
146
|
<Image
|
|
130
147
|
{...props.image}
|
|
131
148
|
className={getClassNames('placeholder-image')}
|
|
@@ -137,20 +154,20 @@ const LazyDocument = (props: Props) => {
|
|
|
137
154
|
/>
|
|
138
155
|
</Image>
|
|
139
156
|
)}
|
|
140
|
-
{
|
|
157
|
+
{(props.download || props.src || props.children) && props.dimmable && (
|
|
141
158
|
<Dimmer
|
|
142
159
|
active={dimmer}
|
|
143
160
|
>
|
|
144
161
|
<div
|
|
145
162
|
className='buttons'
|
|
146
163
|
>
|
|
147
|
-
{
|
|
164
|
+
{props.download && (
|
|
148
165
|
<DownloadButton
|
|
149
166
|
primary
|
|
150
167
|
url={props.download || props.src}
|
|
151
168
|
/>
|
|
152
169
|
)}
|
|
153
|
-
{
|
|
170
|
+
{props.children}
|
|
154
171
|
</div>
|
|
155
172
|
</Dimmer>
|
|
156
173
|
)}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Copyright 2014 Mozilla Foundation
|
|
2
|
+
*
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
:root {
|
|
17
|
+
--react-pdf-text-layer: 1;
|
|
18
|
+
--highlight-bg-color: rgba(180, 0, 170, 1);
|
|
19
|
+
--highlight-selected-bg-color: rgba(0, 100, 0, 1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media screen and (forced-colors: active) {
|
|
23
|
+
:root {
|
|
24
|
+
--highlight-bg-color: Highlight;
|
|
25
|
+
--highlight-selected-bg-color: ButtonText;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-main-rotation='90'] {
|
|
30
|
+
transform: rotate(90deg) translateY(-100%);
|
|
31
|
+
}
|
|
32
|
+
[data-main-rotation='180'] {
|
|
33
|
+
transform: rotate(180deg) translate(-100%, -100%);
|
|
34
|
+
}
|
|
35
|
+
[data-main-rotation='270'] {
|
|
36
|
+
transform: rotate(270deg) translateX(-100%);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.textLayer {
|
|
40
|
+
position: absolute;
|
|
41
|
+
text-align: initial;
|
|
42
|
+
inset: 0;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
line-height: 1;
|
|
45
|
+
text-size-adjust: none;
|
|
46
|
+
forced-color-adjust: none;
|
|
47
|
+
transform-origin: 0 0;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.textLayer :is(span, br) {
|
|
52
|
+
color: transparent;
|
|
53
|
+
position: absolute;
|
|
54
|
+
white-space: pre;
|
|
55
|
+
cursor: text;
|
|
56
|
+
margin: 0;
|
|
57
|
+
transform-origin: 0 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
|
|
61
|
+
* the problem doesn't show up in "text" reference tests. */
|
|
62
|
+
.textLayer span.markedContent {
|
|
63
|
+
top: 0;
|
|
64
|
+
height: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.textLayer .highlight {
|
|
68
|
+
margin: -1px;
|
|
69
|
+
padding: 1px;
|
|
70
|
+
background-color: var(--highlight-bg-color);
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.textLayer .highlight.appended {
|
|
75
|
+
position: initial;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.textLayer .highlight.begin {
|
|
79
|
+
border-radius: 4px 0 0 4px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.textLayer .highlight.end {
|
|
83
|
+
border-radius: 0 4px 4px 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.textLayer .highlight.middle {
|
|
87
|
+
border-radius: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.textLayer .highlight.selected {
|
|
91
|
+
background-color: var(--highlight-selected-bg-color);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
|
|
95
|
+
.textLayer br::selection {
|
|
96
|
+
background: transparent;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.textLayer .endOfContent {
|
|
100
|
+
display: block;
|
|
101
|
+
position: absolute;
|
|
102
|
+
inset: 100% 0 0;
|
|
103
|
+
z-index: -1;
|
|
104
|
+
cursor: default;
|
|
105
|
+
user-select: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.textLayer .endOfContent.active {
|
|
109
|
+
top: 0;
|
|
110
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { Icon, Button } from 'semantic-ui-react';
|
|
5
|
+
import i18n from '../i18n/i18n';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
basic?: boolean,
|
|
9
|
+
className?: string,
|
|
10
|
+
color?: string,
|
|
11
|
+
compact?: boolean,
|
|
12
|
+
primary?: boolean,
|
|
13
|
+
size?: string,
|
|
14
|
+
secondary?: boolean,
|
|
15
|
+
url: string,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ViewPDFButton = (props: Props) => {
|
|
19
|
+
/**
|
|
20
|
+
* Sets the appropriate class names based on the formatting props.
|
|
21
|
+
*
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
const className = useMemo(() => {
|
|
25
|
+
const classNames = ['ui', 'button'];
|
|
26
|
+
|
|
27
|
+
if (props.basic) {
|
|
28
|
+
classNames.push('basic');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (props.className) {
|
|
32
|
+
classNames.push(...props.className.split(' '));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (props.color) {
|
|
36
|
+
classNames.push(props.color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (props.compact) {
|
|
40
|
+
classNames.push('compact');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (props.primary) {
|
|
44
|
+
classNames.push('primary');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (props.secondary) {
|
|
48
|
+
classNames.push('secondary');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (props.size) {
|
|
52
|
+
classNames.push(props.size);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return classNames.join(' ');
|
|
56
|
+
}, [props.basic, props.color]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Button className={className} onClick={() => window.open(props.url, '_blank')}>
|
|
60
|
+
<Icon
|
|
61
|
+
name='file pdf'
|
|
62
|
+
/>
|
|
63
|
+
{i18n.t('Common.buttons.pdf')}
|
|
64
|
+
</Button>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default ViewPDFButton;
|