@performant-software/semantic-components 0.5.1
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/LICENSE +21 -0
- package/README.md +0 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -0
- package/build/main.css +786 -0
- package/index.js +1 -0
- package/package.json +37 -0
- package/src/components/AccordionDataList.css +8 -0
- package/src/components/AccordionDataList.js +224 -0
- package/src/components/AccordionList.css +27 -0
- package/src/components/AccordionList.js +596 -0
- package/src/components/AccordionSelector.css +3 -0
- package/src/components/AccordionSelector.js +359 -0
- package/src/components/ArrowButtons.css +4 -0
- package/src/components/ArrowButtons.js +38 -0
- package/src/components/AssociatedDropdown.css +44 -0
- package/src/components/AssociatedDropdown.js +338 -0
- package/src/components/BooleanIcon.css +0 -0
- package/src/components/BooleanIcon.js +33 -0
- package/src/components/CancelButton.css +0 -0
- package/src/components/CancelButton.js +25 -0
- package/src/components/ColorButton.css +4 -0
- package/src/components/ColorButton.js +34 -0
- package/src/components/ColorPickerModal.css +3 -0
- package/src/components/ColorPickerModal.js +77 -0
- package/src/components/ColumnResize.css +9 -0
- package/src/components/ColumnResize.js +20 -0
- package/src/components/DataList.css +0 -0
- package/src/components/DataList.js +531 -0
- package/src/components/DataTable.css +43 -0
- package/src/components/DataTable.js +596 -0
- package/src/components/DataTableColumnSelector.css +10 -0
- package/src/components/DataTableColumnSelector.js +146 -0
- package/src/components/DateInput.css +6 -0
- package/src/components/DateInput.js +58 -0
- package/src/components/DatePicker.css +72 -0
- package/src/components/DatePicker.js +81 -0
- package/src/components/DescriptorField.css +0 -0
- package/src/components/DescriptorField.js +42 -0
- package/src/components/DownloadButton.css +0 -0
- package/src/components/DownloadButton.js +23 -0
- package/src/components/Draggable.css +0 -0
- package/src/components/Draggable.js +94 -0
- package/src/components/DropdownButton.css +3 -0
- package/src/components/DropdownButton.js +65 -0
- package/src/components/DropdownMenu.css +0 -0
- package/src/components/DropdownMenu.js +68 -0
- package/src/components/EditModal.css +8 -0
- package/src/components/EditModal.js +99 -0
- package/src/components/EditPage.css +7 -0
- package/src/components/EditPage.js +249 -0
- package/src/components/EmbeddedList.css +7 -0
- package/src/components/EmbeddedList.js +278 -0
- package/src/components/FileInputButton.css +0 -0
- package/src/components/FileInputButton.js +54 -0
- package/src/components/FileUpload.css +31 -0
- package/src/components/FileUpload.js +188 -0
- package/src/components/FileUploadModal.css +0 -0
- package/src/components/FileUploadModal.js +408 -0
- package/src/components/FuzzyDate.css +8 -0
- package/src/components/FuzzyDate.js +575 -0
- package/src/components/GoogleMap.css +0 -0
- package/src/components/GoogleMap.js +105 -0
- package/src/components/GooglePlacesSearch.css +0 -0
- package/src/components/GooglePlacesSearch.js +43 -0
- package/src/components/HorizontalCards.css +50 -0
- package/src/components/HorizontalCards.js +226 -0
- package/src/components/ItemCollection.css +3 -0
- package/src/components/ItemCollection.js +159 -0
- package/src/components/ItemList.css +0 -0
- package/src/components/ItemList.js +126 -0
- package/src/components/Items.css +19 -0
- package/src/components/Items.js +365 -0
- package/src/components/ItemsToggle.css +0 -0
- package/src/components/ItemsToggle.js +168 -0
- package/src/components/KeyboardField.css +4 -0
- package/src/components/KeyboardField.js +147 -0
- package/src/components/LazyDocument.css +21 -0
- package/src/components/LazyDocument.js +113 -0
- package/src/components/LazyImage.css +21 -0
- package/src/components/LazyImage.js +119 -0
- package/src/components/LazyVideo.css +21 -0
- package/src/components/LazyVideo.js +131 -0
- package/src/components/LinkButton.css +8 -0
- package/src/components/LinkButton.js +23 -0
- package/src/components/LinkLabel.css +8 -0
- package/src/components/LinkLabel.js +29 -0
- package/src/components/List.css +8 -0
- package/src/components/List.js +761 -0
- package/src/components/ListFilters.css +0 -0
- package/src/components/ListFilters.js +408 -0
- package/src/components/ListLoader.css +8 -0
- package/src/components/ListLoader.js +32 -0
- package/src/components/ListTable.css +3 -0
- package/src/components/ListTable.js +86 -0
- package/src/components/LoginModal.css +7 -0
- package/src/components/LoginModal.js +102 -0
- package/src/components/MasonryGrid.css +48 -0
- package/src/components/MasonryGrid.js +202 -0
- package/src/components/MediaGallery.css +37 -0
- package/src/components/MediaGallery.js +148 -0
- package/src/components/MediaGrid.css +72 -0
- package/src/components/MediaGrid.js +74 -0
- package/src/components/MediaList.css +3 -0
- package/src/components/MediaList.js +98 -0
- package/src/components/ModalDropdown.css +11 -0
- package/src/components/ModalDropdown.js +84 -0
- package/src/components/NestedAccordion.css +41 -0
- package/src/components/NestedAccordion.js +276 -0
- package/src/components/PhotoViewer.css +3 -0
- package/src/components/PhotoViewer.js +36 -0
- package/src/components/PlayButton.css +3 -0
- package/src/components/PlayButton.js +37 -0
- package/src/components/RemoteDropdown.css +13 -0
- package/src/components/RemoteDropdown.js +368 -0
- package/src/components/SaveButton.css +0 -0
- package/src/components/SaveButton.js +31 -0
- package/src/components/Section.css +0 -0
- package/src/components/Section.js +41 -0
- package/src/components/Selectize.css +11 -0
- package/src/components/Selectize.js +297 -0
- package/src/components/SelectizeHeader.css +3 -0
- package/src/components/SelectizeHeader.js +40 -0
- package/src/components/TabbedModal.css +14 -0
- package/src/components/TabbedModal.js +165 -0
- package/src/components/TabsMenu.css +0 -0
- package/src/components/TabsMenu.js +35 -0
- package/src/components/TagsList.css +0 -0
- package/src/components/TagsList.js +43 -0
- package/src/components/Thumbnail.css +0 -0
- package/src/components/Thumbnail.js +47 -0
- package/src/components/Toaster.css +9 -0
- package/src/components/Toaster.js +73 -0
- package/src/components/VideoFrameSelector.css +3 -0
- package/src/components/VideoFrameSelector.js +148 -0
- package/src/components/VideoPlayer.css +3 -0
- package/src/components/VideoPlayer.js +55 -0
- package/src/components/VideoPlayerButton.css +17 -0
- package/src/components/VideoPlayerButton.js +17 -0
- package/src/components/ViewXML.css +0 -0
- package/src/components/ViewXML.js +72 -0
- package/src/i18n/en.json +204 -0
- package/src/i18n/i18n.js +24 -0
- package/src/index.js +76 -0
- package/types/components/AccordionDataList.js.flow +224 -0
- package/types/components/AccordionList.js.flow +596 -0
- package/types/components/AccordionSelector.js.flow +359 -0
- package/types/components/ArrowButtons.js.flow +38 -0
- package/types/components/AssociatedDropdown.js.flow +338 -0
- package/types/components/BooleanIcon.js.flow +33 -0
- package/types/components/CancelButton.js.flow +25 -0
- package/types/components/ColorButton.js.flow +34 -0
- package/types/components/ColorPickerModal.js.flow +77 -0
- package/types/components/ColumnResize.js.flow +20 -0
- package/types/components/DataList.js.flow +531 -0
- package/types/components/DataTable.js.flow +596 -0
- package/types/components/DataTableColumnSelector.js.flow +146 -0
- package/types/components/DataView.js.flow +125 -0
- package/types/components/DateInput.js.flow +58 -0
- package/types/components/DatePicker.js.flow +81 -0
- package/types/components/DescriptorField.js.flow +42 -0
- package/types/components/DownloadButton.js.flow +23 -0
- package/types/components/Draggable.js.flow +94 -0
- package/types/components/DropdownButton.js.flow +65 -0
- package/types/components/DropdownMenu.js.flow +68 -0
- package/types/components/EditModal.js.flow +99 -0
- package/types/components/EditPage.js.flow +249 -0
- package/types/components/EmbeddedList.js.flow +278 -0
- package/types/components/FileInputButton.js.flow +54 -0
- package/types/components/FileUpload.js.flow +188 -0
- package/types/components/FileUploadModal.js.flow +408 -0
- package/types/components/FuzzyDate.js.flow +575 -0
- package/types/components/GoogleMap.js.flow +105 -0
- package/types/components/GooglePlacesSearch.js.flow +43 -0
- package/types/components/HorizontalCards.js.flow +226 -0
- package/types/components/ItemCollection.js.flow +159 -0
- package/types/components/ItemList.js.flow +126 -0
- package/types/components/Items.js.flow +365 -0
- package/types/components/ItemsToggle.js.flow +168 -0
- package/types/components/KeyboardField.js.flow +147 -0
- package/types/components/LazyDocument.js.flow +113 -0
- package/types/components/LazyImage.js.flow +119 -0
- package/types/components/LazyVideo.js.flow +131 -0
- package/types/components/LinkButton.js.flow +23 -0
- package/types/components/LinkLabel.js.flow +29 -0
- package/types/components/List.js.flow +761 -0
- package/types/components/ListFilters.js.flow +408 -0
- package/types/components/ListLoader.js.flow +32 -0
- package/types/components/ListTable.js.flow +86 -0
- package/types/components/LoginModal.js.flow +102 -0
- package/types/components/MasonryGrid.js.flow +202 -0
- package/types/components/MediaGallery.js.flow +148 -0
- package/types/components/MediaGrid.js.flow +74 -0
- package/types/components/MediaList.js.flow +98 -0
- package/types/components/MenuBar.js.flow +77 -0
- package/types/components/MenuSidebar.js.flow +72 -0
- package/types/components/ModalDropdown.js.flow +84 -0
- package/types/components/NestedAccordion.js.flow +276 -0
- package/types/components/PhotoViewer.js.flow +36 -0
- package/types/components/PlayButton.js.flow +37 -0
- package/types/components/RemoteDropdown.js.flow +368 -0
- package/types/components/SaveButton.js.flow +31 -0
- package/types/components/Section.js.flow +41 -0
- package/types/components/Selectize.js.flow +297 -0
- package/types/components/SelectizeHeader.js.flow +40 -0
- package/types/components/TabbedModal.js.flow +165 -0
- package/types/components/TabsMenu.js.flow +35 -0
- package/types/components/TagsList.js.flow +43 -0
- package/types/components/Thumbnail.js.flow +47 -0
- package/types/components/Toaster.js.flow +73 -0
- package/types/components/VideoFrameSelector.js.flow +148 -0
- package/types/components/VideoPlayer.js.flow +55 -0
- package/types/components/VideoPlayerButton.js.flow +17 -0
- package/types/components/ViewXML.js.flow +72 -0
- package/types/hooks/Imageable.js.flow +54 -0
- package/types/i18n/i18n.js.flow +24 -0
- package/types/index.js.flow +78 -0
- package/webpack.config.js +3 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import { Browser } from '@performant-software/shared-components';
|
|
4
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { withTranslation } from 'react-i18next';
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Grid,
|
|
9
|
+
Input,
|
|
10
|
+
Label,
|
|
11
|
+
Modal,
|
|
12
|
+
Segment
|
|
13
|
+
} from 'semantic-ui-react';
|
|
14
|
+
import i18n from '../i18n/i18n';
|
|
15
|
+
import './VideoFrameSelector.css';
|
|
16
|
+
|
|
17
|
+
type Props = {
|
|
18
|
+
button: any,
|
|
19
|
+
defaultInterval: number,
|
|
20
|
+
onSelect: (file: File) => void,
|
|
21
|
+
src: string,
|
|
22
|
+
title: string
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const INTERVAL_STEP = 1;
|
|
26
|
+
const MIN_INTERVAL = 1;
|
|
27
|
+
const MAX_INTERVAL = 300;
|
|
28
|
+
|
|
29
|
+
const VideoFrameSelector = (props: Props) => {
|
|
30
|
+
const [duration, setDuration] = useState(0);
|
|
31
|
+
const [interval, setInterval] = useState(props.defaultInterval);
|
|
32
|
+
const [time, setTime] = useState(0);
|
|
33
|
+
const [modal, setModal] = useState(false);
|
|
34
|
+
|
|
35
|
+
const videoRef = useRef(null);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (videoRef.current) {
|
|
39
|
+
videoRef.current.currentTime = time;
|
|
40
|
+
}
|
|
41
|
+
}, [time]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<Button
|
|
46
|
+
{...props.button}
|
|
47
|
+
onClick={() => setModal(true)}
|
|
48
|
+
/>
|
|
49
|
+
<Modal
|
|
50
|
+
centered={false}
|
|
51
|
+
className='video-frame-selector'
|
|
52
|
+
open={modal}
|
|
53
|
+
size='small'
|
|
54
|
+
>
|
|
55
|
+
<Modal.Header
|
|
56
|
+
content={props.title}
|
|
57
|
+
/>
|
|
58
|
+
<Modal.Content>
|
|
59
|
+
<Segment>
|
|
60
|
+
<video
|
|
61
|
+
crossOrigin='anonymous'
|
|
62
|
+
onLoadedMetadata={() => videoRef.current && setDuration(videoRef.current.duration)}
|
|
63
|
+
ref={videoRef}
|
|
64
|
+
src={props.src}
|
|
65
|
+
/>
|
|
66
|
+
</Segment>
|
|
67
|
+
<Grid
|
|
68
|
+
columns={2}
|
|
69
|
+
>
|
|
70
|
+
<Grid.Column>
|
|
71
|
+
<div>
|
|
72
|
+
<Label
|
|
73
|
+
content={i18n.t('VideoFrameSelector.labels.interval', { count: interval })}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
<Input
|
|
77
|
+
min={MIN_INTERVAL}
|
|
78
|
+
max={MAX_INTERVAL}
|
|
79
|
+
name='duration'
|
|
80
|
+
onChange={(e, { value }) => setInterval(Number(value))}
|
|
81
|
+
step={INTERVAL_STEP}
|
|
82
|
+
type='range'
|
|
83
|
+
value={interval}
|
|
84
|
+
/>
|
|
85
|
+
</Grid.Column>
|
|
86
|
+
<Grid.Column
|
|
87
|
+
textAlign='right'
|
|
88
|
+
>
|
|
89
|
+
<Button
|
|
90
|
+
basic
|
|
91
|
+
disabled={time === 0}
|
|
92
|
+
icon='arrow left'
|
|
93
|
+
onClick={() => setTime(Math.max(time - interval, 0))}
|
|
94
|
+
/>
|
|
95
|
+
<Button
|
|
96
|
+
basic
|
|
97
|
+
disabled={time === duration}
|
|
98
|
+
icon='arrow right'
|
|
99
|
+
onClick={() => setTime(Math.min(time + interval, duration))}
|
|
100
|
+
/>
|
|
101
|
+
</Grid.Column>
|
|
102
|
+
</Grid>
|
|
103
|
+
</Modal.Content>
|
|
104
|
+
<Modal.Actions>
|
|
105
|
+
<Button
|
|
106
|
+
content={i18n.t('Common.buttons.ok')}
|
|
107
|
+
primary
|
|
108
|
+
onClick={() => {
|
|
109
|
+
const video = videoRef.current;
|
|
110
|
+
|
|
111
|
+
if (video && Browser.isBrowser()) {
|
|
112
|
+
const canvas = document.createElement('canvas');
|
|
113
|
+
canvas.width = video.videoWidth;
|
|
114
|
+
canvas.height = video.videoHeight;
|
|
115
|
+
|
|
116
|
+
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
117
|
+
|
|
118
|
+
canvas.toBlob((blob) => {
|
|
119
|
+
const file = new File([blob], 'test.png', { lastModified: new Date().getTime(), type: blob.type });
|
|
120
|
+
props.onSelect(file);
|
|
121
|
+
setModal(false);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
content={i18n.t('Common.buttons.cancel')}
|
|
128
|
+
inverted
|
|
129
|
+
onClick={() => setModal(false)}
|
|
130
|
+
primary
|
|
131
|
+
/>
|
|
132
|
+
</Modal.Actions>
|
|
133
|
+
</Modal>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
VideoFrameSelector.defaultProps = {
|
|
139
|
+
button: {
|
|
140
|
+
basic: true,
|
|
141
|
+
content: i18n.t('VideoFrameSelector.buttons.select'),
|
|
142
|
+
icon: 'image'
|
|
143
|
+
},
|
|
144
|
+
defaultInterval: 15,
|
|
145
|
+
title: i18n.t('VideoFrameSelector.title'),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default withTranslation()(VideoFrameSelector);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, { type Element } from 'react';
|
|
4
|
+
import { Embed, Modal } from 'semantic-ui-react';
|
|
5
|
+
import './VideoPlayer.css';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
autoPlay?: boolean,
|
|
9
|
+
embedded?: boolean,
|
|
10
|
+
icon?: string | Element<any>,
|
|
11
|
+
onClose: () => void,
|
|
12
|
+
open: boolean,
|
|
13
|
+
placeholder?: ?string,
|
|
14
|
+
size?: string,
|
|
15
|
+
video: string
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const VideoPlayer = (props: Props) => (
|
|
19
|
+
<Modal
|
|
20
|
+
centered={false}
|
|
21
|
+
className='video-player'
|
|
22
|
+
closeIcon
|
|
23
|
+
onClose={props.onClose.bind(this)}
|
|
24
|
+
open={props.open}
|
|
25
|
+
size={props.size}
|
|
26
|
+
>
|
|
27
|
+
<Modal.Content>
|
|
28
|
+
{ props.embedded && (
|
|
29
|
+
<Embed
|
|
30
|
+
active={props.autoPlay}
|
|
31
|
+
icon={props.icon}
|
|
32
|
+
iframe={props.autoPlay ? { allow: 'autoplay' } : undefined}
|
|
33
|
+
placeholder={props.placeholder}
|
|
34
|
+
url={`${props.video}${props.autoPlay ? '?autoplay=true' : ''}`}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
{ !props.embedded && (
|
|
38
|
+
<video
|
|
39
|
+
autoPlay={props.autoPlay}
|
|
40
|
+
controls
|
|
41
|
+
src={props.video}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
</Modal.Content>
|
|
45
|
+
</Modal>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
VideoPlayer.defaultProps = {
|
|
49
|
+
autoPlay: false,
|
|
50
|
+
embedded: false,
|
|
51
|
+
icon: 'right circle arrow',
|
|
52
|
+
size: 'small'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default VideoPlayer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PlayButton from './PlayButton';
|
|
5
|
+
import './VideoPlayerButton.css';
|
|
6
|
+
|
|
7
|
+
const VideoPlayerButton = () => (
|
|
8
|
+
<div
|
|
9
|
+
className='icon video-player-button'
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
<PlayButton />
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default VideoPlayerButton;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, { type ComponentType, useState } from 'react';
|
|
4
|
+
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
5
|
+
import { Button, Modal } from 'semantic-ui-react';
|
|
6
|
+
import i18n from '../i18n/i18n';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
highlighter?: any,
|
|
10
|
+
opener: {
|
|
11
|
+
component: ComponentType<any>,
|
|
12
|
+
props: any
|
|
13
|
+
},
|
|
14
|
+
style: any,
|
|
15
|
+
xml: string
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ViewXML = (props: Props) => {
|
|
19
|
+
const [showModal, setShowModal] = useState(false);
|
|
20
|
+
const OpenerComponent = props.opener.component;
|
|
21
|
+
const openerProps = props.opener.props;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<OpenerComponent
|
|
26
|
+
{...openerProps}
|
|
27
|
+
className='view-xml-trigger'
|
|
28
|
+
onClick={() => setShowModal(true)}
|
|
29
|
+
/>
|
|
30
|
+
<Modal
|
|
31
|
+
className='view-xml-modal'
|
|
32
|
+
centered={false}
|
|
33
|
+
open={showModal}
|
|
34
|
+
onClose={() => setShowModal(false)}
|
|
35
|
+
>
|
|
36
|
+
<Modal.Header
|
|
37
|
+
content={i18n.t('ViewXML.title')}
|
|
38
|
+
/>
|
|
39
|
+
<Modal.Content>
|
|
40
|
+
<SyntaxHighlighter
|
|
41
|
+
language='xml'
|
|
42
|
+
style={props.highlighter}
|
|
43
|
+
>
|
|
44
|
+
{ props.xml }
|
|
45
|
+
</SyntaxHighlighter>
|
|
46
|
+
</Modal.Content>
|
|
47
|
+
<Modal.Actions>
|
|
48
|
+
<Button
|
|
49
|
+
content='Close'
|
|
50
|
+
inverted
|
|
51
|
+
primary
|
|
52
|
+
onClick={() => setShowModal(false)}
|
|
53
|
+
/>
|
|
54
|
+
</Modal.Actions>
|
|
55
|
+
</Modal>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
ViewXML.defaultProps = {
|
|
61
|
+
opener: {
|
|
62
|
+
component: Button,
|
|
63
|
+
props: {
|
|
64
|
+
content: i18n.t('ViewXML.buttons.view')
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
style: {
|
|
68
|
+
maxHeight: '70vh'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default ViewXML;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
type ComponentType
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
type Imageable = {
|
|
11
|
+
contextRef: any,
|
|
12
|
+
imageLoaded: boolean,
|
|
13
|
+
onImageLoaded: () => void,
|
|
14
|
+
onImageUnloaded: () => void
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const useImageable = (WrappedComponent: ComponentType<any>) => (props: any) => {
|
|
18
|
+
const [loaded, setLoaded] = useState(false);
|
|
19
|
+
const imageRef = useRef(null);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Since images may be cached, we cannot always rely on the img onLoad event. Here we'll use a ref to check to see
|
|
23
|
+
* if the image has completed loading.
|
|
24
|
+
*/
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const imageInstance = imageRef.current;
|
|
27
|
+
|
|
28
|
+
if (imageInstance && imageInstance.firstChild && imageInstance.firstChild.firstChild) {
|
|
29
|
+
const image = imageInstance.firstChild.firstChild;
|
|
30
|
+
|
|
31
|
+
if (image && image.complete) {
|
|
32
|
+
setLoaded(true);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<WrappedComponent
|
|
39
|
+
{...props}
|
|
40
|
+
contextRef={imageRef}
|
|
41
|
+
imageLoaded={loaded}
|
|
42
|
+
onImageLoaded={() => setLoaded(true)}
|
|
43
|
+
onImageUnloaded={() => setLoaded(false)}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
useImageable
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type {
|
|
53
|
+
Imageable
|
|
54
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
|
|
3
|
+
import en from './en.json';
|
|
4
|
+
|
|
5
|
+
const resources = {
|
|
6
|
+
en: {
|
|
7
|
+
translation: en
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const i18n = i18next.createInstance();
|
|
12
|
+
|
|
13
|
+
i18n
|
|
14
|
+
.init({
|
|
15
|
+
debug: true,
|
|
16
|
+
fallbackLng: 'en',
|
|
17
|
+
lng: 'en',
|
|
18
|
+
interpolation: {
|
|
19
|
+
escapeValue: false,
|
|
20
|
+
},
|
|
21
|
+
resources
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default i18n;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
export { default as AccordionDataList } from './components/AccordionDataList';
|
|
5
|
+
export { default as AccordionList } from './components/AccordionList';
|
|
6
|
+
export { default as AccordionSelector } from './components/AccordionSelector';
|
|
7
|
+
export { default as ArrowButtons } from './components/ArrowButtons';
|
|
8
|
+
export { default as AssociatedDropdown } from './components/AssociatedDropdown';
|
|
9
|
+
export { default as BooleanIcon } from './components/BooleanIcon';
|
|
10
|
+
export { default as CancelButton } from './components/CancelButton';
|
|
11
|
+
export { default as ColorButton } from './components/ColorButton';
|
|
12
|
+
export { default as ColorPickerModal } from './components/ColorPickerModal';
|
|
13
|
+
export { default as useDataList } from './components/DataList';
|
|
14
|
+
export { default as DataTable } from './components/DataTable';
|
|
15
|
+
export { default as DateInput } from './components/DateInput';
|
|
16
|
+
export { default as DatePicker } from './components/DatePicker';
|
|
17
|
+
export { default as DescriptorField } from './components/DescriptorField';
|
|
18
|
+
export { default as DownloadButton } from './components/DownloadButton';
|
|
19
|
+
export { default as Draggable } from './components/Draggable';
|
|
20
|
+
export { default as DropdownButton } from './components/DropdownButton';
|
|
21
|
+
export { default as DropdownMenu } from './components/DropdownMenu';
|
|
22
|
+
export { default as EditModal } from './components/EditModal';
|
|
23
|
+
export { default as EditPage } from './components/EditPage';
|
|
24
|
+
export { default as EmbeddedList } from './components/EmbeddedList';
|
|
25
|
+
export { default as FileInputButton } from './components/FileInputButton';
|
|
26
|
+
export { default as FileUpload } from './components/FileUpload';
|
|
27
|
+
export { default as FileUploadModal } from './components/FileUploadModal';
|
|
28
|
+
export { default as FuzzyDate } from './components/FuzzyDate';
|
|
29
|
+
export { default as GoogleMap } from './components/GoogleMap';
|
|
30
|
+
export { default as GooglePlacesSearch } from './components/GooglePlacesSearch';
|
|
31
|
+
export { default as HorizontalCards } from './components/HorizontalCards';
|
|
32
|
+
export { default as ItemCollection } from './components/ItemCollection';
|
|
33
|
+
export { default as ItemList } from './components/ItemList';
|
|
34
|
+
export { default as Items } from './components/Items';
|
|
35
|
+
export { default as KeyboardField } from './components/KeyboardField';
|
|
36
|
+
export { default as LazyDocument } from './components/LazyDocument';
|
|
37
|
+
export { default as LazyImage } from './components/LazyImage';
|
|
38
|
+
export { default as LazyVideo } from './components/LazyVideo';
|
|
39
|
+
export { default as LinkButton } from './components/LinkButton';
|
|
40
|
+
export { default as ListFilters } from './components/ListFilters';
|
|
41
|
+
export { default as LinkLabel } from './components/LinkLabel';
|
|
42
|
+
export { default as useList } from './components/List';
|
|
43
|
+
export { default as ListLoader } from './components/ListLoader';
|
|
44
|
+
export { default as ListTable } from './components/ListTable';
|
|
45
|
+
export { default as LoginModal } from './components/LoginModal';
|
|
46
|
+
export { default as MasonryGrid } from './components/MasonryGrid';
|
|
47
|
+
export { default as MediaGallery } from './components/MediaGallery';
|
|
48
|
+
export { default as MediaGrid } from './components/MediaGrid';
|
|
49
|
+
export { default as MediaList } from './components/MediaList';
|
|
50
|
+
export { default as MenuBar } from './components/MenuBar';
|
|
51
|
+
export { default as MenuSidebar } from './components/MenuSidebar';
|
|
52
|
+
export { default as ModalDropdown } from './components/ModalDropdown';
|
|
53
|
+
export { default as NestedAccordion } from './components/NestedAccordion';
|
|
54
|
+
export { default as PlayButton } from './components/PlayButton';
|
|
55
|
+
export { default as PhotoViewer } from './components/PhotoViewer';
|
|
56
|
+
export { default as RemoteDropdown } from './components/RemoteDropdown';
|
|
57
|
+
export { default as SaveButton } from './components/SaveButton';
|
|
58
|
+
export { default as Section } from './components/Section';
|
|
59
|
+
export { default as Selectize } from './components/Selectize';
|
|
60
|
+
export { default as SelectizeHeader } from './components/SelectizeHeader';
|
|
61
|
+
export { default as TabbedModal } from './components/TabbedModal';
|
|
62
|
+
export { default as TabsMenu } from './components/TabsMenu';
|
|
63
|
+
export { default as TagsList } from './components/TagsList';
|
|
64
|
+
export { default as Thumbnail } from './components/Thumbnail';
|
|
65
|
+
export { default as Toaster } from './components/Toaster';
|
|
66
|
+
export { default as VideoFrameSelector } from './components/VideoFrameSelector';
|
|
67
|
+
export { default as VideoPlayer } from './components/VideoPlayer';
|
|
68
|
+
export { default as VideoPlayerButton } from './components/VideoPlayerButton';
|
|
69
|
+
export { default as ViewXML } from './components/ViewXML';
|
|
70
|
+
|
|
71
|
+
// Types
|
|
72
|
+
export type { EditPageProps } from './components/EditPage';
|
|
73
|
+
export type { FileUploadProps } from './components/FileUploadModal';
|
|
74
|
+
export type { Props as ListProps } from './components/List';
|
|
75
|
+
|
|
76
|
+
// Constants
|
|
77
|
+
export { SORT_ASCENDING, SORT_DESCENDING } from './components/DataList';
|
|
78
|
+
export { FilterTypes } from './components/ListFilters';
|