@performant-software/semantic-components 1.1.5-beta.1 → 1.1.5
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 +273 -0
- package/package.json +2 -2
- package/src/components/FacetSlider.css +2 -0
- package/src/components/FacetSlider.js +4 -4
- package/src/components/LazyDocument.css +6 -0
- package/src/components/LazyDocument.js +9 -9
- package/src/components/List.js +14 -4
- package/src/components/ViewPDFButton.js +68 -0
- package/src/i18n/en.json +3 -2
- package/src/index.js +1 -0
- package/types/components/FacetSlider.js.flow +4 -4
- package/types/components/LazyDocument.js.flow +9 -9
- package/types/components/List.js.flow +14 -4
- package/types/components/ViewPDFButton.js.flow +68 -0
- package/types/index.js.flow +1 -0
- package/webpack.config.js +4 -0
package/build/main.css
CHANGED
|
@@ -512,6 +512,274 @@ div.react-calendar {
|
|
|
512
512
|
margin-top: 1em;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
+
.rc-slider {
|
|
516
|
+
position: relative;
|
|
517
|
+
width: 100%;
|
|
518
|
+
height: 14px;
|
|
519
|
+
padding: 5px 0;
|
|
520
|
+
border-radius: 6px;
|
|
521
|
+
touch-action: none;
|
|
522
|
+
box-sizing: border-box;
|
|
523
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
524
|
+
}
|
|
525
|
+
.rc-slider * {
|
|
526
|
+
box-sizing: border-box;
|
|
527
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
528
|
+
}
|
|
529
|
+
.rc-slider-rail {
|
|
530
|
+
position: absolute;
|
|
531
|
+
width: 100%;
|
|
532
|
+
height: 4px;
|
|
533
|
+
background-color: #e9e9e9;
|
|
534
|
+
border-radius: 6px;
|
|
535
|
+
}
|
|
536
|
+
.rc-slider-track {
|
|
537
|
+
position: absolute;
|
|
538
|
+
height: 4px;
|
|
539
|
+
background-color: #abe2fb;
|
|
540
|
+
border-radius: 6px;
|
|
541
|
+
}
|
|
542
|
+
.rc-slider-track-draggable {
|
|
543
|
+
z-index: 1;
|
|
544
|
+
box-sizing: content-box;
|
|
545
|
+
background-clip: content-box;
|
|
546
|
+
border-top: 5px solid rgba(0, 0, 0, 0);
|
|
547
|
+
border-bottom: 5px solid rgba(0, 0, 0, 0);
|
|
548
|
+
transform: translateY(-5px);
|
|
549
|
+
}
|
|
550
|
+
.rc-slider-handle {
|
|
551
|
+
position: absolute;
|
|
552
|
+
width: 14px;
|
|
553
|
+
height: 14px;
|
|
554
|
+
margin-top: -5px;
|
|
555
|
+
background-color: #fff;
|
|
556
|
+
border: solid 2px #96dbfa;
|
|
557
|
+
border-radius: 50%;
|
|
558
|
+
cursor: pointer;
|
|
559
|
+
cursor: -webkit-grab;
|
|
560
|
+
cursor: grab;
|
|
561
|
+
opacity: 0.8;
|
|
562
|
+
touch-action: pan-x;
|
|
563
|
+
}
|
|
564
|
+
.rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging {
|
|
565
|
+
border-color: #57c5f7;
|
|
566
|
+
box-shadow: 0 0 0 5px #96dbfa;
|
|
567
|
+
}
|
|
568
|
+
.rc-slider-handle:focus {
|
|
569
|
+
outline: none;
|
|
570
|
+
box-shadow: none;
|
|
571
|
+
}
|
|
572
|
+
.rc-slider-handle:focus-visible {
|
|
573
|
+
border-color: #2db7f5;
|
|
574
|
+
box-shadow: 0 0 0 3px #96dbfa;
|
|
575
|
+
}
|
|
576
|
+
.rc-slider-handle-click-focused:focus {
|
|
577
|
+
border-color: #96dbfa;
|
|
578
|
+
box-shadow: unset;
|
|
579
|
+
}
|
|
580
|
+
.rc-slider-handle:hover {
|
|
581
|
+
border-color: #57c5f7;
|
|
582
|
+
}
|
|
583
|
+
.rc-slider-handle:active {
|
|
584
|
+
border-color: #57c5f7;
|
|
585
|
+
box-shadow: 0 0 5px #57c5f7;
|
|
586
|
+
cursor: -webkit-grabbing;
|
|
587
|
+
cursor: grabbing;
|
|
588
|
+
}
|
|
589
|
+
.rc-slider-mark {
|
|
590
|
+
position: absolute;
|
|
591
|
+
top: 18px;
|
|
592
|
+
left: 0;
|
|
593
|
+
width: 100%;
|
|
594
|
+
font-size: 12px;
|
|
595
|
+
}
|
|
596
|
+
.rc-slider-mark-text {
|
|
597
|
+
position: absolute;
|
|
598
|
+
display: inline-block;
|
|
599
|
+
color: #999;
|
|
600
|
+
text-align: center;
|
|
601
|
+
vertical-align: middle;
|
|
602
|
+
cursor: pointer;
|
|
603
|
+
}
|
|
604
|
+
.rc-slider-mark-text-active {
|
|
605
|
+
color: #666;
|
|
606
|
+
}
|
|
607
|
+
.rc-slider-step {
|
|
608
|
+
position: absolute;
|
|
609
|
+
width: 100%;
|
|
610
|
+
height: 4px;
|
|
611
|
+
background: transparent;
|
|
612
|
+
}
|
|
613
|
+
.rc-slider-dot {
|
|
614
|
+
position: absolute;
|
|
615
|
+
bottom: -2px;
|
|
616
|
+
width: 8px;
|
|
617
|
+
height: 8px;
|
|
618
|
+
vertical-align: middle;
|
|
619
|
+
background-color: #fff;
|
|
620
|
+
border: 2px solid #e9e9e9;
|
|
621
|
+
border-radius: 50%;
|
|
622
|
+
cursor: pointer;
|
|
623
|
+
}
|
|
624
|
+
.rc-slider-dot-active {
|
|
625
|
+
border-color: #96dbfa;
|
|
626
|
+
}
|
|
627
|
+
.rc-slider-dot-reverse {
|
|
628
|
+
margin-right: -4px;
|
|
629
|
+
}
|
|
630
|
+
.rc-slider-disabled {
|
|
631
|
+
background-color: #e9e9e9;
|
|
632
|
+
}
|
|
633
|
+
.rc-slider-disabled .rc-slider-track {
|
|
634
|
+
background-color: #ccc;
|
|
635
|
+
}
|
|
636
|
+
.rc-slider-disabled .rc-slider-handle,
|
|
637
|
+
.rc-slider-disabled .rc-slider-dot {
|
|
638
|
+
background-color: #fff;
|
|
639
|
+
border-color: #ccc;
|
|
640
|
+
box-shadow: none;
|
|
641
|
+
cursor: not-allowed;
|
|
642
|
+
}
|
|
643
|
+
.rc-slider-disabled .rc-slider-mark-text,
|
|
644
|
+
.rc-slider-disabled .rc-slider-dot {
|
|
645
|
+
cursor: not-allowed !important;
|
|
646
|
+
}
|
|
647
|
+
.rc-slider-vertical {
|
|
648
|
+
width: 14px;
|
|
649
|
+
height: 100%;
|
|
650
|
+
padding: 0 5px;
|
|
651
|
+
}
|
|
652
|
+
.rc-slider-vertical .rc-slider-rail {
|
|
653
|
+
width: 4px;
|
|
654
|
+
height: 100%;
|
|
655
|
+
}
|
|
656
|
+
.rc-slider-vertical .rc-slider-track {
|
|
657
|
+
bottom: 0;
|
|
658
|
+
left: 5px;
|
|
659
|
+
width: 4px;
|
|
660
|
+
}
|
|
661
|
+
.rc-slider-vertical .rc-slider-track-draggable {
|
|
662
|
+
border-top: 0;
|
|
663
|
+
border-bottom: 0;
|
|
664
|
+
border-right: 5px solid rgba(0, 0, 0, 0);
|
|
665
|
+
border-left: 5px solid rgba(0, 0, 0, 0);
|
|
666
|
+
transform: translateX(-5px);
|
|
667
|
+
}
|
|
668
|
+
.rc-slider-vertical .rc-slider-handle {
|
|
669
|
+
margin-top: 0;
|
|
670
|
+
margin-left: -5px;
|
|
671
|
+
touch-action: pan-y;
|
|
672
|
+
}
|
|
673
|
+
.rc-slider-vertical .rc-slider-mark {
|
|
674
|
+
top: 0;
|
|
675
|
+
left: 18px;
|
|
676
|
+
height: 100%;
|
|
677
|
+
}
|
|
678
|
+
.rc-slider-vertical .rc-slider-step {
|
|
679
|
+
width: 4px;
|
|
680
|
+
height: 100%;
|
|
681
|
+
}
|
|
682
|
+
.rc-slider-vertical .rc-slider-dot {
|
|
683
|
+
margin-left: -2px;
|
|
684
|
+
}
|
|
685
|
+
.rc-slider-tooltip-zoom-down-enter,
|
|
686
|
+
.rc-slider-tooltip-zoom-down-appear {
|
|
687
|
+
display: block !important;
|
|
688
|
+
animation-duration: 0.3s;
|
|
689
|
+
animation-fill-mode: both;
|
|
690
|
+
animation-play-state: paused;
|
|
691
|
+
}
|
|
692
|
+
.rc-slider-tooltip-zoom-down-leave {
|
|
693
|
+
display: block !important;
|
|
694
|
+
animation-duration: 0.3s;
|
|
695
|
+
animation-fill-mode: both;
|
|
696
|
+
animation-play-state: paused;
|
|
697
|
+
}
|
|
698
|
+
.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,
|
|
699
|
+
.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {
|
|
700
|
+
animation-name: rcSliderTooltipZoomDownIn;
|
|
701
|
+
animation-play-state: running;
|
|
702
|
+
}
|
|
703
|
+
.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {
|
|
704
|
+
animation-name: rcSliderTooltipZoomDownOut;
|
|
705
|
+
animation-play-state: running;
|
|
706
|
+
}
|
|
707
|
+
.rc-slider-tooltip-zoom-down-enter,
|
|
708
|
+
.rc-slider-tooltip-zoom-down-appear {
|
|
709
|
+
transform: scale(0, 0);
|
|
710
|
+
animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
|
711
|
+
}
|
|
712
|
+
.rc-slider-tooltip-zoom-down-leave {
|
|
713
|
+
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
|
|
714
|
+
}
|
|
715
|
+
@keyframes rcSliderTooltipZoomDownIn {
|
|
716
|
+
0% {
|
|
717
|
+
transform: scale(0, 0);
|
|
718
|
+
transform-origin: 50% 100%;
|
|
719
|
+
opacity: 0;
|
|
720
|
+
}
|
|
721
|
+
100% {
|
|
722
|
+
transform: scale(1, 1);
|
|
723
|
+
transform-origin: 50% 100%;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
@keyframes rcSliderTooltipZoomDownOut {
|
|
727
|
+
0% {
|
|
728
|
+
transform: scale(1, 1);
|
|
729
|
+
transform-origin: 50% 100%;
|
|
730
|
+
}
|
|
731
|
+
100% {
|
|
732
|
+
transform: scale(0, 0);
|
|
733
|
+
transform-origin: 50% 100%;
|
|
734
|
+
opacity: 0;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
.rc-slider-tooltip {
|
|
738
|
+
position: absolute;
|
|
739
|
+
top: -9999px;
|
|
740
|
+
left: -9999px;
|
|
741
|
+
visibility: visible;
|
|
742
|
+
box-sizing: border-box;
|
|
743
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
744
|
+
}
|
|
745
|
+
.rc-slider-tooltip * {
|
|
746
|
+
box-sizing: border-box;
|
|
747
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
748
|
+
}
|
|
749
|
+
.rc-slider-tooltip-hidden {
|
|
750
|
+
display: none;
|
|
751
|
+
}
|
|
752
|
+
.rc-slider-tooltip-placement-top {
|
|
753
|
+
padding: 4px 0 8px 0;
|
|
754
|
+
}
|
|
755
|
+
.rc-slider-tooltip-inner {
|
|
756
|
+
min-width: 24px;
|
|
757
|
+
height: 24px;
|
|
758
|
+
padding: 6px 2px;
|
|
759
|
+
color: #fff;
|
|
760
|
+
font-size: 12px;
|
|
761
|
+
line-height: 1;
|
|
762
|
+
text-align: center;
|
|
763
|
+
text-decoration: none;
|
|
764
|
+
background-color: #6c6c6c;
|
|
765
|
+
border-radius: 6px;
|
|
766
|
+
box-shadow: 0 0 4px #d9d9d9;
|
|
767
|
+
}
|
|
768
|
+
.rc-slider-tooltip-arrow {
|
|
769
|
+
position: absolute;
|
|
770
|
+
width: 0;
|
|
771
|
+
height: 0;
|
|
772
|
+
border-color: transparent;
|
|
773
|
+
border-style: solid;
|
|
774
|
+
}
|
|
775
|
+
.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {
|
|
776
|
+
bottom: 4px;
|
|
777
|
+
left: 50%;
|
|
778
|
+
margin-left: -4px;
|
|
779
|
+
border-width: 4px 4px 0;
|
|
780
|
+
border-top-color: #6c6c6c;
|
|
781
|
+
}
|
|
782
|
+
|
|
515
783
|
.facet-slider > .ui.grid {
|
|
516
784
|
margin-top: 0em;
|
|
517
785
|
}
|
|
@@ -716,6 +984,7 @@ div.react-calendar {
|
|
|
716
984
|
.lazy-document.ui.segment .buttons {
|
|
717
985
|
display: flex;
|
|
718
986
|
flex-direction: column;
|
|
987
|
+
z-index: 1000;
|
|
719
988
|
}
|
|
720
989
|
.lazy-document.ui.segment .buttons .ui.button {
|
|
721
990
|
margin-top: 5px;
|
|
@@ -735,6 +1004,10 @@ div.react-calendar {
|
|
|
735
1004
|
.lazy-document > .image.hidden {
|
|
736
1005
|
display: none;
|
|
737
1006
|
}
|
|
1007
|
+
.pdf-container {
|
|
1008
|
+
width: 200px;
|
|
1009
|
+
height: 300px;
|
|
1010
|
+
}
|
|
738
1011
|
|
|
739
1012
|
.photo-viewer {
|
|
740
1013
|
padding: 30px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@performant-software/semantic-components",
|
|
3
|
-
"version": "1.1.5
|
|
3
|
+
"version": "1.1.5",
|
|
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.5
|
|
15
|
+
"@performant-software/shared-components": "^1.1.5",
|
|
16
16
|
"@react-google-maps/api": "^2.8.1",
|
|
17
17
|
"axios": "^0.26.1",
|
|
18
18
|
"i18next": "^19.4.4",
|
|
@@ -10,7 +10,7 @@ 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
14
|
import './FacetSlider.css';
|
|
15
15
|
|
|
16
16
|
type Props = FacetProps & RangeSliderProps;
|
|
@@ -25,7 +25,7 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
25
25
|
refine,
|
|
26
26
|
} = useRangeSlider(props);
|
|
27
27
|
|
|
28
|
-
const [valueView, setValueView] = useState<Array<number>>([range.min, range.max]);
|
|
28
|
+
const [valueView, setValueView] = useState < Array < number >> ([range.min, range.max]);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Sets the visibility variable based on the range min and max.
|
|
@@ -72,12 +72,12 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
72
72
|
columns={2}
|
|
73
73
|
>
|
|
74
74
|
<Grid.Column>
|
|
75
|
-
{
|
|
75
|
+
{valueView[0]}
|
|
76
76
|
</Grid.Column>
|
|
77
77
|
<Grid.Column
|
|
78
78
|
textAlign='right'
|
|
79
79
|
>
|
|
80
|
-
{
|
|
80
|
+
{valueView[1]}
|
|
81
81
|
</Grid.Column>
|
|
82
82
|
</Grid>
|
|
83
83
|
</div>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.lazy-document.ui.segment .buttons {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
+
z-index: 1000;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.lazy-document.ui.segment .buttons .ui.button {
|
|
@@ -30,3 +31,8 @@
|
|
|
30
31
|
.lazy-document > .image.hidden {
|
|
31
32
|
display: none;
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
.pdf-container {
|
|
36
|
+
width: 200px;
|
|
37
|
+
height: 300px;
|
|
38
|
+
}
|
|
@@ -14,8 +14,6 @@ import {
|
|
|
14
14
|
import DownloadButton from './DownloadButton';
|
|
15
15
|
import LazyLoader from './LazyLoader';
|
|
16
16
|
|
|
17
|
-
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|
18
|
-
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
|
19
17
|
import './LazyDocument.css';
|
|
20
18
|
|
|
21
19
|
type Props = {
|
|
@@ -87,13 +85,13 @@ const LazyDocument = (props: Props) => {
|
|
|
87
85
|
onMouseEnter={() => setDimmer(true)}
|
|
88
86
|
onMouseLeave={() => setDimmer(false)}
|
|
89
87
|
>
|
|
90
|
-
{
|
|
88
|
+
{!loaded && (
|
|
91
89
|
<LazyLoader
|
|
92
90
|
active
|
|
93
91
|
size={props.size}
|
|
94
92
|
/>
|
|
95
93
|
)}
|
|
96
|
-
{
|
|
94
|
+
{!error && props.preview && (
|
|
97
95
|
<Image
|
|
98
96
|
{...props.image}
|
|
99
97
|
className={getClassNames()}
|
|
@@ -109,7 +107,7 @@ const LazyDocument = (props: Props) => {
|
|
|
109
107
|
size={props.size}
|
|
110
108
|
/>
|
|
111
109
|
)}
|
|
112
|
-
{
|
|
110
|
+
{!error && loaded && !props.preview && props.src && props.pdf && (
|
|
113
111
|
<Image
|
|
114
112
|
{...props.image}
|
|
115
113
|
className={getClassNames()}
|
|
@@ -121,11 +119,13 @@ const LazyDocument = (props: Props) => {
|
|
|
121
119
|
>
|
|
122
120
|
<Page
|
|
123
121
|
pageNumber={1}
|
|
122
|
+
renderTextLayer={false}
|
|
123
|
+
renderAnnotationLayer={false}
|
|
124
124
|
/>
|
|
125
125
|
</Document>
|
|
126
126
|
</Image>
|
|
127
127
|
)}
|
|
128
|
-
{
|
|
128
|
+
{(error || (!props.preview && !(props.src && props.pdf))) && (
|
|
129
129
|
<Image
|
|
130
130
|
{...props.image}
|
|
131
131
|
className={getClassNames('placeholder-image')}
|
|
@@ -137,20 +137,20 @@ const LazyDocument = (props: Props) => {
|
|
|
137
137
|
/>
|
|
138
138
|
</Image>
|
|
139
139
|
)}
|
|
140
|
-
{
|
|
140
|
+
{(props.download || props.src || props.children) && props.dimmable && (
|
|
141
141
|
<Dimmer
|
|
142
142
|
active={dimmer}
|
|
143
143
|
>
|
|
144
144
|
<div
|
|
145
145
|
className='buttons'
|
|
146
146
|
>
|
|
147
|
-
{
|
|
147
|
+
{props.download && (
|
|
148
148
|
<DownloadButton
|
|
149
149
|
primary
|
|
150
150
|
url={props.download || props.src}
|
|
151
151
|
/>
|
|
152
152
|
)}
|
|
153
|
-
{
|
|
153
|
+
{props.children}
|
|
154
154
|
</div>
|
|
155
155
|
</Dimmer>
|
|
156
156
|
)}
|
package/src/components/List.js
CHANGED
|
@@ -197,6 +197,11 @@ type Props = {
|
|
|
197
197
|
*/
|
|
198
198
|
renderSearch?: () => Element<any>,
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Returns true if the renderSearch prop should be used to render a search input element.
|
|
202
|
+
*/
|
|
203
|
+
searchable?: boolean,
|
|
204
|
+
|
|
200
205
|
/**
|
|
201
206
|
* If set to <code>true</code>, checkboxes will render as the first table column, allowing each row to be selectable.
|
|
202
207
|
* The consuming component is responsible for tracking the selected items.
|
|
@@ -841,10 +846,15 @@ const useList = (WrappedComponent: ComponentType<any>) => (
|
|
|
841
846
|
filters,
|
|
842
847
|
perPageOptions,
|
|
843
848
|
renderListHeader,
|
|
844
|
-
renderSearch
|
|
849
|
+
renderSearch,
|
|
850
|
+
searchable
|
|
845
851
|
} = this.props;
|
|
846
852
|
|
|
847
|
-
|
|
853
|
+
const hasFilters = filters && filters.component;
|
|
854
|
+
const hasSearch = searchable && renderSearch;
|
|
855
|
+
const headerContent = renderListHeader && renderListHeader();
|
|
856
|
+
|
|
857
|
+
if (hasFilters || perPageOptions || headerContent || hasSearch) {
|
|
848
858
|
renderHeader = true;
|
|
849
859
|
}
|
|
850
860
|
|
|
@@ -879,9 +889,9 @@ const useList = (WrappedComponent: ComponentType<any>) => (
|
|
|
879
889
|
secondary
|
|
880
890
|
className='flex-end-menu'
|
|
881
891
|
>
|
|
882
|
-
{
|
|
892
|
+
{ headerContent && (
|
|
883
893
|
<Menu.Menu className='list-header-menu'>
|
|
884
|
-
{
|
|
894
|
+
{ headerContent }
|
|
885
895
|
</Menu.Menu>
|
|
886
896
|
)}
|
|
887
897
|
<Menu.Menu>
|
|
@@ -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;
|
package/src/i18n/en.json
CHANGED
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"save": "Save",
|
|
58
58
|
"search": "Search",
|
|
59
59
|
"show": "Show",
|
|
60
|
-
"upload": "Upload"
|
|
60
|
+
"upload": "Upload",
|
|
61
|
+
"pdf": "View PDF"
|
|
61
62
|
},
|
|
62
63
|
"errors": {
|
|
63
64
|
"save": "There was an error saving the record.",
|
|
@@ -331,4 +332,4 @@
|
|
|
331
332
|
},
|
|
332
333
|
"title": "XML"
|
|
333
334
|
}
|
|
334
|
-
}
|
|
335
|
+
}
|
package/src/index.js
CHANGED
|
@@ -99,6 +99,7 @@ export { default as Toaster } from './components/Toaster';
|
|
|
99
99
|
export { default as VideoFrameSelector } from './components/VideoFrameSelector';
|
|
100
100
|
export { default as VideoPlayer } from './components/VideoPlayer';
|
|
101
101
|
export { default as VideoPlayerButton } from './components/VideoPlayerButton';
|
|
102
|
+
export { default as ViewPDFButton } from './components/ViewPDFButton';
|
|
102
103
|
export { default as ViewXML } from './components/ViewXML';
|
|
103
104
|
|
|
104
105
|
// Context
|
|
@@ -10,7 +10,7 @@ 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
14
|
import './FacetSlider.css';
|
|
15
15
|
|
|
16
16
|
type Props = FacetProps & RangeSliderProps;
|
|
@@ -25,7 +25,7 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
25
25
|
refine,
|
|
26
26
|
} = useRangeSlider(props);
|
|
27
27
|
|
|
28
|
-
const [valueView, setValueView] = useState<Array<number>>([range.min, range.max]);
|
|
28
|
+
const [valueView, setValueView] = useState < Array < number >> ([range.min, range.max]);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Sets the visibility variable based on the range min and max.
|
|
@@ -72,12 +72,12 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl
|
|
|
72
72
|
columns={2}
|
|
73
73
|
>
|
|
74
74
|
<Grid.Column>
|
|
75
|
-
{
|
|
75
|
+
{valueView[0]}
|
|
76
76
|
</Grid.Column>
|
|
77
77
|
<Grid.Column
|
|
78
78
|
textAlign='right'
|
|
79
79
|
>
|
|
80
|
-
{
|
|
80
|
+
{valueView[1]}
|
|
81
81
|
</Grid.Column>
|
|
82
82
|
</Grid>
|
|
83
83
|
</div>
|
|
@@ -14,8 +14,6 @@ import {
|
|
|
14
14
|
import DownloadButton from './DownloadButton';
|
|
15
15
|
import LazyLoader from './LazyLoader';
|
|
16
16
|
|
|
17
|
-
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|
18
|
-
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
|
19
17
|
import './LazyDocument.css';
|
|
20
18
|
|
|
21
19
|
type Props = {
|
|
@@ -87,13 +85,13 @@ const LazyDocument = (props: Props) => {
|
|
|
87
85
|
onMouseEnter={() => setDimmer(true)}
|
|
88
86
|
onMouseLeave={() => setDimmer(false)}
|
|
89
87
|
>
|
|
90
|
-
{
|
|
88
|
+
{!loaded && (
|
|
91
89
|
<LazyLoader
|
|
92
90
|
active
|
|
93
91
|
size={props.size}
|
|
94
92
|
/>
|
|
95
93
|
)}
|
|
96
|
-
{
|
|
94
|
+
{!error && props.preview && (
|
|
97
95
|
<Image
|
|
98
96
|
{...props.image}
|
|
99
97
|
className={getClassNames()}
|
|
@@ -109,7 +107,7 @@ const LazyDocument = (props: Props) => {
|
|
|
109
107
|
size={props.size}
|
|
110
108
|
/>
|
|
111
109
|
)}
|
|
112
|
-
{
|
|
110
|
+
{!error && loaded && !props.preview && props.src && props.pdf && (
|
|
113
111
|
<Image
|
|
114
112
|
{...props.image}
|
|
115
113
|
className={getClassNames()}
|
|
@@ -121,11 +119,13 @@ const LazyDocument = (props: Props) => {
|
|
|
121
119
|
>
|
|
122
120
|
<Page
|
|
123
121
|
pageNumber={1}
|
|
122
|
+
renderTextLayer={false}
|
|
123
|
+
renderAnnotationLayer={false}
|
|
124
124
|
/>
|
|
125
125
|
</Document>
|
|
126
126
|
</Image>
|
|
127
127
|
)}
|
|
128
|
-
{
|
|
128
|
+
{(error || (!props.preview && !(props.src && props.pdf))) && (
|
|
129
129
|
<Image
|
|
130
130
|
{...props.image}
|
|
131
131
|
className={getClassNames('placeholder-image')}
|
|
@@ -137,20 +137,20 @@ const LazyDocument = (props: Props) => {
|
|
|
137
137
|
/>
|
|
138
138
|
</Image>
|
|
139
139
|
)}
|
|
140
|
-
{
|
|
140
|
+
{(props.download || props.src || props.children) && props.dimmable && (
|
|
141
141
|
<Dimmer
|
|
142
142
|
active={dimmer}
|
|
143
143
|
>
|
|
144
144
|
<div
|
|
145
145
|
className='buttons'
|
|
146
146
|
>
|
|
147
|
-
{
|
|
147
|
+
{props.download && (
|
|
148
148
|
<DownloadButton
|
|
149
149
|
primary
|
|
150
150
|
url={props.download || props.src}
|
|
151
151
|
/>
|
|
152
152
|
)}
|
|
153
|
-
{
|
|
153
|
+
{props.children}
|
|
154
154
|
</div>
|
|
155
155
|
</Dimmer>
|
|
156
156
|
)}
|