@performant-software/semantic-components 0.5.13 → 0.5.16-beta.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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/main.css +35 -0
- package/package.json +6 -4
- package/src/components/AudioPlayer.css +3 -0
- package/src/components/AudioPlayer.js +36 -0
- package/src/components/LazyAudio.css +23 -0
- package/src/components/LazyAudio.js +123 -0
- package/src/components/LazyDocument.css +2 -0
- package/src/components/LazyDocument.js +6 -13
- package/src/components/LazyImage.css +3 -1
- package/src/components/LazyImage.js +10 -8
- package/src/components/LazyVideo.css +8 -1
- package/src/components/ReferenceCodeFormDropdown.js +5 -2
- package/src/i18n/en.json +5 -0
- package/src/index.js +2 -0
- package/types/components/AudioPlayer.js.flow +36 -0
- package/types/components/LazyAudio.js.flow +123 -0
- package/types/components/LazyDocument.js.flow +6 -13
- package/types/components/LazyImage.js.flow +10 -8
- package/types/components/ReferenceCodeFormDropdown.js.flow +5 -2
- package/types/index.js.flow +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
|
-
import React, { useState,
|
|
3
|
+
import React, { useState, type Node } from 'react';
|
|
4
4
|
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
5
5
|
import {
|
|
6
6
|
Dimmer,
|
|
@@ -20,6 +20,7 @@ type Props = {
|
|
|
20
20
|
dimmable?: boolean,
|
|
21
21
|
duration?: number,
|
|
22
22
|
image?: any,
|
|
23
|
+
pdf?: boolean,
|
|
23
24
|
preview?: ?string,
|
|
24
25
|
size?: string,
|
|
25
26
|
src?: string
|
|
@@ -28,15 +29,6 @@ type Props = {
|
|
|
28
29
|
const LazyDocument = (props: Props) => {
|
|
29
30
|
const [visible, setVisible] = useState(false);
|
|
30
31
|
const [dimmer, setDimmer] = useState(false);
|
|
31
|
-
const [contentType, setContentType] = useState('');
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (props.src && !props.preview) {
|
|
35
|
-
fetch(props.src)
|
|
36
|
-
.then((response) => response.blob())
|
|
37
|
-
.then((blob) => setContentType(blob.type));
|
|
38
|
-
}
|
|
39
|
-
}, [props.preview, props.src]);
|
|
40
32
|
|
|
41
33
|
if (!visible) {
|
|
42
34
|
return (
|
|
@@ -75,7 +67,7 @@ const LazyDocument = (props: Props) => {
|
|
|
75
67
|
size={props.size}
|
|
76
68
|
/>
|
|
77
69
|
)}
|
|
78
|
-
{ !props.preview && props.src &&
|
|
70
|
+
{ !props.preview && props.src && props.pdf && (
|
|
79
71
|
<Image
|
|
80
72
|
{...props.image}
|
|
81
73
|
size={props.size}
|
|
@@ -89,7 +81,7 @@ const LazyDocument = (props: Props) => {
|
|
|
89
81
|
</Document>
|
|
90
82
|
</Image>
|
|
91
83
|
)}
|
|
92
|
-
{ !props.preview && (
|
|
84
|
+
{ !props.preview && !(props.src && props.pdf) && (
|
|
93
85
|
<Image
|
|
94
86
|
{...props.image}
|
|
95
87
|
className='placeholder-image'
|
|
@@ -113,7 +105,7 @@ const LazyDocument = (props: Props) => {
|
|
|
113
105
|
content={i18n.t('LazyDocument.buttons.download')}
|
|
114
106
|
icon='cloud download'
|
|
115
107
|
primary
|
|
116
|
-
url={props.src
|
|
108
|
+
url={props.src}
|
|
117
109
|
/>
|
|
118
110
|
)}
|
|
119
111
|
{ props.children }
|
|
@@ -129,6 +121,7 @@ const LazyDocument = (props: Props) => {
|
|
|
129
121
|
LazyDocument.defaultProps = {
|
|
130
122
|
dimmable: true,
|
|
131
123
|
duration: 1000,
|
|
124
|
+
pdf: false,
|
|
132
125
|
preview: undefined,
|
|
133
126
|
size: 'medium',
|
|
134
127
|
src: undefined
|
|
@@ -60,14 +60,14 @@ const LazyImage = (props: Props) => {
|
|
|
60
60
|
onMouseEnter={() => setDimmer(true)}
|
|
61
61
|
onMouseLeave={() => setDimmer(false)}
|
|
62
62
|
>
|
|
63
|
-
{ props.src && (
|
|
63
|
+
{ (props.preview || props.src) && (
|
|
64
64
|
<Image
|
|
65
65
|
{...props.image}
|
|
66
66
|
size={props.size}
|
|
67
67
|
src={props.preview || props.src}
|
|
68
68
|
/>
|
|
69
69
|
)}
|
|
70
|
-
{ !props.src && (
|
|
70
|
+
{ !(props.preview || props.src) && (
|
|
71
71
|
<Image
|
|
72
72
|
{...props.image}
|
|
73
73
|
className='placeholder-image'
|
|
@@ -100,12 +100,14 @@ const LazyImage = (props: Props) => {
|
|
|
100
100
|
)}
|
|
101
101
|
</Dimmer.Dimmable>
|
|
102
102
|
</Transition>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
{ props.src && (
|
|
104
|
+
<PhotoViewer
|
|
105
|
+
image={props.src}
|
|
106
|
+
onClose={() => setModal(false)}
|
|
107
|
+
open={modal}
|
|
108
|
+
size='large'
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
109
111
|
</>
|
|
110
112
|
);
|
|
111
113
|
};
|
|
@@ -50,12 +50,15 @@ const ReferenceCodeFormDropdown: ComponentType<any> = (props: Props) => {
|
|
|
50
50
|
{ modal && (
|
|
51
51
|
<EditModal
|
|
52
52
|
component={ReferenceTableModal}
|
|
53
|
-
item={{ id: referenceTable }}
|
|
53
|
+
item={{ id: referenceTable, key: referenceTable }}
|
|
54
54
|
onClose={() => setModal(false)}
|
|
55
55
|
onInitialize={(key) => (
|
|
56
56
|
ReferenceTablesService
|
|
57
57
|
.fetchByKey(key)
|
|
58
|
-
.then(({ data }) =>
|
|
58
|
+
.then(({ data }) => ({
|
|
59
|
+
...data.reference_table,
|
|
60
|
+
key
|
|
61
|
+
}))
|
|
59
62
|
)}
|
|
60
63
|
onSave={(record) => (
|
|
61
64
|
ReferenceTablesService
|
package/types/index.js.flow
CHANGED
|
@@ -9,6 +9,7 @@ export { default as AccordionList } from './components/AccordionList';
|
|
|
9
9
|
export { default as AccordionSelector } from './components/AccordionSelector';
|
|
10
10
|
export { default as ArrowButtons } from './components/ArrowButtons';
|
|
11
11
|
export { default as AssociatedDropdown } from './components/AssociatedDropdown';
|
|
12
|
+
export { default as AudioPlayer } from './components/AudioPlayer';
|
|
12
13
|
export { default as BooleanIcon } from './components/BooleanIcon';
|
|
13
14
|
export { default as CancelButton } from './components/CancelButton';
|
|
14
15
|
export { default as ColorButton } from './components/ColorButton';
|
|
@@ -39,6 +40,7 @@ export { default as ItemList } from './components/ItemList';
|
|
|
39
40
|
export { default as Items } from './components/Items';
|
|
40
41
|
export { default as KeyboardField } from './components/KeyboardField';
|
|
41
42
|
export { default as KeyValuePairs } from './components/KeyValuePairs';
|
|
43
|
+
export { default as LazyAudio } from './components/LazyAudio';
|
|
42
44
|
export { default as LazyDocument } from './components/LazyDocument';
|
|
43
45
|
export { default as LazyImage } from './components/LazyImage';
|
|
44
46
|
export { default as LazyVideo } from './components/LazyVideo';
|