@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,84 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { withTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Dropdown } from 'semantic-ui-react';
|
|
6
|
+
import './ModalDropdown.css';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
onClear: () => void,
|
|
10
|
+
renderModal: ({ onClose: () => void, open: boolean }) => void,
|
|
11
|
+
searchQuery: ?string,
|
|
12
|
+
t: (key: string) => string
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type State = {
|
|
16
|
+
modalVisible: boolean
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class ModalDropdown extends Component<Props, State> {
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new ModalDropdown component.
|
|
22
|
+
*
|
|
23
|
+
* @param props
|
|
24
|
+
*/
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
|
|
28
|
+
this.state = {
|
|
29
|
+
modalVisible: false
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Closes the modal.
|
|
35
|
+
*/
|
|
36
|
+
onClose() {
|
|
37
|
+
this.setState({ modalVisible: false });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Renders the ModalDropdown component.
|
|
42
|
+
*
|
|
43
|
+
* @returns {*}
|
|
44
|
+
*/
|
|
45
|
+
render() {
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<Dropdown
|
|
49
|
+
className='modal-dropdown'
|
|
50
|
+
onClick={() => this.setState({ modalVisible: true })}
|
|
51
|
+
onSearchChange={() => {}}
|
|
52
|
+
open={false}
|
|
53
|
+
search
|
|
54
|
+
selection
|
|
55
|
+
searchQuery={this.props.searchQuery || ''}
|
|
56
|
+
/>
|
|
57
|
+
<Button.Group>
|
|
58
|
+
<Button
|
|
59
|
+
basic
|
|
60
|
+
content={this.props.t('Common.buttons.clear')}
|
|
61
|
+
icon='times'
|
|
62
|
+
onClick={this.props.onClear.bind(this)}
|
|
63
|
+
type='button'
|
|
64
|
+
/>
|
|
65
|
+
</Button.Group>
|
|
66
|
+
{ this.renderModal() }
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Renders the modal.
|
|
73
|
+
*
|
|
74
|
+
* @returns {*}
|
|
75
|
+
*/
|
|
76
|
+
renderModal() {
|
|
77
|
+
return this.props.renderModal({
|
|
78
|
+
onClose: this.onClose.bind(this),
|
|
79
|
+
open: this.state.modalVisible
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default withTranslation()(ModalDropdown);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.nested-accordion .ui.icon.button.accordion-button {
|
|
2
|
+
background-color: transparent;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.nested-accordion .ui.icon.button.accordion-button.hidden i {
|
|
7
|
+
visibility: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.nested-accordion .ui.icon.button.inverted.accordion-button {
|
|
11
|
+
box-shadow: none !important;
|
|
12
|
+
color: #fff;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.nested-accordion .title > .container {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nested-accordion .title > .container > div:first-child {
|
|
23
|
+
flex-grow: 1;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nested-accordion .title > .container > div:first-child > .item-container {
|
|
28
|
+
display: inline-block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.nested-accordion .title > .container > .right-container {
|
|
33
|
+
margin-left: 1em;
|
|
34
|
+
text-align: right;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.nested-accordion .title > .container > .right-container > .row-select-checkbox {
|
|
40
|
+
margin-left: 1.5em;
|
|
41
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React, { Component, type Element } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
Accordion,
|
|
6
|
+
Button
|
|
7
|
+
} from 'semantic-ui-react';
|
|
8
|
+
import _ from 'underscore';
|
|
9
|
+
import './NestedAccordion.css';
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
defaultActive?: Array<number> | Array<any>,
|
|
13
|
+
getChildItems: (item: any) => Array<any>,
|
|
14
|
+
inverted?: boolean,
|
|
15
|
+
isItemActive?: (item: any) => boolean,
|
|
16
|
+
multipleItemTypes?: boolean,
|
|
17
|
+
onItemClick?: (item: any) => void,
|
|
18
|
+
onItemToggle?: (item: any) => void,
|
|
19
|
+
renderItem: (item: any) => string | Element<any>,
|
|
20
|
+
renderRight?: (item: any) => string | Element<any>,
|
|
21
|
+
rootItems: Array<any>,
|
|
22
|
+
showToggle: (item: any) => boolean,
|
|
23
|
+
styled?: boolean,
|
|
24
|
+
toggleOnClick?: boolean
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type State = {
|
|
28
|
+
activeItems: Array<any>
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
class NestedAccordion extends Component<Props, State> {
|
|
32
|
+
static defaultProps: any;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Constructs a new NestedAccordion component.
|
|
36
|
+
*
|
|
37
|
+
* @param props
|
|
38
|
+
*/
|
|
39
|
+
constructor(props: Props) {
|
|
40
|
+
super(props);
|
|
41
|
+
|
|
42
|
+
this.state = {
|
|
43
|
+
activeItems: []
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sets the activeItems on the state if the defaultActive prop changes.
|
|
49
|
+
*
|
|
50
|
+
* @param prevProps
|
|
51
|
+
*/
|
|
52
|
+
componentDidUpdate(prevProps: Props) {
|
|
53
|
+
if (prevProps.defaultActive !== this.props.defaultActive
|
|
54
|
+
&& this.props.defaultActive
|
|
55
|
+
&& this.props.defaultActive.length) {
|
|
56
|
+
const isActive = this.props.defaultActive.some(
|
|
57
|
+
(active) => typeof active !== 'object' || !_.has(active, 'id') || !_.has(active, 'type')
|
|
58
|
+
);
|
|
59
|
+
if (this.props.multipleItemTypes && !isActive) {
|
|
60
|
+
this.setState({ activeItems: this.props.defaultActive });
|
|
61
|
+
} else {
|
|
62
|
+
this.setState({ activeItems: _.map(this.props.defaultActive, (id) => ({ id })) });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the toggle button class names.
|
|
69
|
+
*
|
|
70
|
+
* @param item
|
|
71
|
+
*
|
|
72
|
+
* @returns {string}
|
|
73
|
+
*/
|
|
74
|
+
getButtonClass(item: any) {
|
|
75
|
+
const classNames = ['accordion-button'];
|
|
76
|
+
|
|
77
|
+
if (this.props.showToggle && !this.props.showToggle(item)) {
|
|
78
|
+
classNames.push('hidden');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return classNames.join(' ');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns true if the passed item is active.
|
|
86
|
+
*
|
|
87
|
+
* @param item
|
|
88
|
+
*
|
|
89
|
+
* @returns {boolean}
|
|
90
|
+
*/
|
|
91
|
+
isActive(item: any) {
|
|
92
|
+
let properties = { id: item.id };
|
|
93
|
+
if (this.props.multipleItemTypes && _.has(item, 'type')) {
|
|
94
|
+
properties = { id: item.id, type: item.type };
|
|
95
|
+
}
|
|
96
|
+
return !!_.findWhere(this.state.activeItems, properties);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns true if the passed item is active.
|
|
101
|
+
*
|
|
102
|
+
* @param item
|
|
103
|
+
*
|
|
104
|
+
* @returns {*}
|
|
105
|
+
*/
|
|
106
|
+
isItemActive(item: any) {
|
|
107
|
+
return this.props.isItemActive && this.props.isItemActive(item);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Calls the onItemClick prop. Optionally toggles the item active.
|
|
112
|
+
*
|
|
113
|
+
* @param item
|
|
114
|
+
*/
|
|
115
|
+
onItemClick(item: any) {
|
|
116
|
+
if (this.props.toggleOnClick) {
|
|
117
|
+
this.onItemToggle(item);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.props.onItemClick) {
|
|
121
|
+
this.props.onItemClick(item);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Toggles the passed item and calls the onItemToggle property.
|
|
127
|
+
*
|
|
128
|
+
* @param item
|
|
129
|
+
*/
|
|
130
|
+
onItemToggle(item: any) {
|
|
131
|
+
if (this.props.onItemToggle) {
|
|
132
|
+
this.props.onItemToggle(item);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this.toggleItem(item);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Renders the NestedAccordion component.
|
|
140
|
+
*
|
|
141
|
+
* @returns {*}
|
|
142
|
+
*/
|
|
143
|
+
render() {
|
|
144
|
+
return (
|
|
145
|
+
<Accordion
|
|
146
|
+
className='nested-accordion'
|
|
147
|
+
fluid
|
|
148
|
+
inverted={this.props.inverted}
|
|
149
|
+
panels={_.map(this.props.rootItems, this.renderPanel.bind(this))}
|
|
150
|
+
styled={this.props.styled}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Renders the content for the passed item if the item has child elements.
|
|
157
|
+
*
|
|
158
|
+
* @param item
|
|
159
|
+
*
|
|
160
|
+
* @returns {null|*}
|
|
161
|
+
*/
|
|
162
|
+
renderContent(item: any) {
|
|
163
|
+
const children = this.props.getChildItems(item);
|
|
164
|
+
if (!(children && children.length)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Accordion.Content
|
|
170
|
+
active={this.isActive(item)}
|
|
171
|
+
>
|
|
172
|
+
<div>
|
|
173
|
+
<Accordion.Accordion
|
|
174
|
+
panels={_.map(children, this.renderPanel.bind(this))}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
</Accordion.Content>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Renders the title and content (panel) for the passed item.
|
|
183
|
+
*
|
|
184
|
+
* @param item
|
|
185
|
+
*
|
|
186
|
+
* @returns {*}
|
|
187
|
+
*/
|
|
188
|
+
renderPanel(item: any) {
|
|
189
|
+
return (
|
|
190
|
+
<div key={_.has(item, 'type') ? `${item.type}-${item.id}` : item.id}>
|
|
191
|
+
<Accordion.Title
|
|
192
|
+
active={this.isActive(item)}
|
|
193
|
+
onClick={this.onItemClick.bind(this, item)}
|
|
194
|
+
style={{
|
|
195
|
+
backgroundColor: this.isItemActive(item) ? 'rgba(255, 255, 255, 0.08)' : undefined
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<div
|
|
199
|
+
className='container'
|
|
200
|
+
>
|
|
201
|
+
<div>
|
|
202
|
+
{ this.renderToggle(item) }
|
|
203
|
+
<div
|
|
204
|
+
className='item-container'
|
|
205
|
+
>
|
|
206
|
+
{ this.props.renderItem(item) }
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
{ this.props.renderRight && (
|
|
210
|
+
<div
|
|
211
|
+
className='right-container'
|
|
212
|
+
>
|
|
213
|
+
{ this.props.renderRight(item) }
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
</Accordion.Title>
|
|
218
|
+
{ this.renderContent(item) }
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Renders the open/close toggle for the passed item.
|
|
225
|
+
*
|
|
226
|
+
* @param item
|
|
227
|
+
*
|
|
228
|
+
* @returns {null|*}
|
|
229
|
+
*/
|
|
230
|
+
renderToggle(item: any) {
|
|
231
|
+
return (
|
|
232
|
+
<Button
|
|
233
|
+
compact
|
|
234
|
+
className={this.getButtonClass(item)}
|
|
235
|
+
icon='dropdown'
|
|
236
|
+
inverted={this.props.inverted}
|
|
237
|
+
onClick={(e) => {
|
|
238
|
+
// Since the containing row also has an onclick, we'll want to prevent that from being triggered.
|
|
239
|
+
e.stopPropagation();
|
|
240
|
+
this.onItemToggle(item);
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Toggles the passed item as active.
|
|
248
|
+
*
|
|
249
|
+
* @param item
|
|
250
|
+
*/
|
|
251
|
+
toggleItem(item: any) {
|
|
252
|
+
this.setState((state) => ({
|
|
253
|
+
activeItems: this.isActive(item)
|
|
254
|
+
? _.filter(state.activeItems, (i) => {
|
|
255
|
+
if (this.props.multipleItemTypes && _.has(item, 'type') && _.has(i, 'type')) {
|
|
256
|
+
return i.id !== item.id || i.type !== item.type;
|
|
257
|
+
}
|
|
258
|
+
return i.id !== item.id;
|
|
259
|
+
})
|
|
260
|
+
: [...state.activeItems, item]
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
NestedAccordion.defaultProps = {
|
|
266
|
+
defaultActive: [],
|
|
267
|
+
inverted: false,
|
|
268
|
+
isItemActive: undefined,
|
|
269
|
+
multipleItemTypes: false,
|
|
270
|
+
onItemClick: () => {},
|
|
271
|
+
renderRight: () => {},
|
|
272
|
+
styled: true,
|
|
273
|
+
toggleOnClick: false
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export default NestedAccordion;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Image, Modal } from 'semantic-ui-react';
|
|
5
|
+
import './PhotoViewer.css';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
image: string,
|
|
9
|
+
onClose: () => void,
|
|
10
|
+
open: boolean,
|
|
11
|
+
size?: string
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const PhotoViewer = (props: Props) => (
|
|
15
|
+
<Modal
|
|
16
|
+
centered={false}
|
|
17
|
+
className='photo-viewer'
|
|
18
|
+
closeIcon
|
|
19
|
+
onClose={props.onClose.bind(this)}
|
|
20
|
+
open={props.open}
|
|
21
|
+
size={props.size}
|
|
22
|
+
>
|
|
23
|
+
<Modal.Content>
|
|
24
|
+
<Image
|
|
25
|
+
fluid
|
|
26
|
+
src={props.image}
|
|
27
|
+
/>
|
|
28
|
+
</Modal.Content>
|
|
29
|
+
</Modal>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
PhotoViewer.defaultProps = {
|
|
33
|
+
size: 'small'
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default PhotoViewer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button } from 'semantic-ui-react';
|
|
5
|
+
import './PlayButton.css';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
onClick?: () => void,
|
|
9
|
+
size?: string,
|
|
10
|
+
style?: any
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const PlayButton = (props: Props) => (
|
|
14
|
+
<Button
|
|
15
|
+
className='play-button'
|
|
16
|
+
color='black'
|
|
17
|
+
icon='play'
|
|
18
|
+
onClick={(e) => {
|
|
19
|
+
if (props.onClick) {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
|
|
22
|
+
// $FlowFixMe - Not really an issue since we're checking for props.onClick above.
|
|
23
|
+
props.onClick();
|
|
24
|
+
}
|
|
25
|
+
}}
|
|
26
|
+
size={props.size}
|
|
27
|
+
style={props.style}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
PlayButton.defaultProps = {
|
|
32
|
+
onClick: undefined,
|
|
33
|
+
size: 'massive',
|
|
34
|
+
style: undefined
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default PlayButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.remote-dropdown .extra-option {
|
|
2
|
+
opacity: 0.5;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ui.remote-dropdown .menu .item {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row-reverse;
|
|
8
|
+
justify-content: flex-end;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ui.remote-dropdown .menu .item .description {
|
|
12
|
+
justify-self: flex-start;
|
|
13
|
+
}
|