diff --git a/packages/app/package.json b/packages/app/package.json index 5c13b0b879..3803ce2123 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -25,6 +25,7 @@ }, "dependencies": { "@dhis2/d2-i18n": "^1.0.3", + "@dhis2/d2-ui-analytics": "^0.0.12", "@dhis2/d2-ui-core": "5.1.3", "@dhis2/d2-ui-file-menu": "5.2.11", "@dhis2/d2-ui-interpretations": "5.2.10", diff --git a/packages/app/src/components/AddToLayoutButton/styles/DropDownButton.style.js b/packages/app/src/components/AddToLayoutButton/styles/DropDownButton.style.js index 53530d0d98..dda2418711 100644 --- a/packages/app/src/components/AddToLayoutButton/styles/DropDownButton.style.js +++ b/packages/app/src/components/AddToLayoutButton/styles/DropDownButton.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default { arrowDown: { diff --git a/packages/app/src/components/AxisSetup/styles/AxisSetup.style.js b/packages/app/src/components/AxisSetup/styles/AxisSetup.style.js index 7e104e4254..897a5bb646 100644 --- a/packages/app/src/components/AxisSetup/styles/AxisSetup.style.js +++ b/packages/app/src/components/AxisSetup/styles/AxisSetup.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default { tableContainer: { diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/DataDimension.js b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/DataDimension.js index 0219700a63..e5ac9f7676 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/DataDimension.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/DataDimension.js @@ -8,7 +8,7 @@ import debounce from 'lodash-es/debounce'; import keyBy from 'lodash-es/keyBy'; import isEqual from 'lodash-es/isEqual'; -import { ItemSelector } from 'analytics-shared'; +import { ItemSelector } from '@dhis2/d2-ui-analytics'; import DataTypes from './DataTypesSelector'; import Groups from './Groups'; import FilterField from '../FilterField'; diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/DataTypesSelector.style.js b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/DataTypesSelector.style.js index d184d1cb65..71a0ab8496 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/DataTypesSelector.style.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/DataTypesSelector.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../../modules/colors'; export const styles = { container: { diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/Groups.style.js b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/Groups.style.js index c00a6ee9a1..0f65d3b977 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/Groups.style.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/DataDimension/styles/Groups.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../../modules/colors'; export const styles = { container: { diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/DynamicDimension/DynamicDimension.js b/packages/app/src/components/DimensionsPanel/Dialogs/DynamicDimension/DynamicDimension.js index 774859d98a..eebc40f90c 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/DynamicDimension/DynamicDimension.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/DynamicDimension/DynamicDimension.js @@ -5,7 +5,7 @@ import DialogTitle from '@material-ui/core/DialogTitle'; import DialogContent from '@material-ui/core/DialogContent'; import i18n from '@dhis2/d2-i18n'; import keyBy from 'lodash-es/keyBy'; -import { ItemSelector } from 'analytics-shared'; +import { ItemSelector } from '@dhis2/d2-ui-analytics'; import FilterField from '../FilterField'; diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/OrgUnitDimension/OrgUnitDimension.js b/packages/app/src/components/DimensionsPanel/Dialogs/OrgUnitDimension/OrgUnitDimension.js index 934c9e3d79..60f97fa90b 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/OrgUnitDimension/OrgUnitDimension.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/OrgUnitDimension/OrgUnitDimension.js @@ -5,7 +5,7 @@ import DialogContent from '@material-ui/core/DialogContent'; import DialogTitle from '@material-ui/core/DialogTitle'; import i18n from '@dhis2/d2-i18n'; import PropTypes from 'prop-types'; -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; import { OrgUnitSelector, userOrgUnits } from '@dhis2/d2-ui-org-unit-dialog'; import { diff --git a/packages/app/src/components/DimensionsPanel/Dialogs/styles/FilterField.style.js b/packages/app/src/components/DimensionsPanel/Dialogs/styles/FilterField.style.js index 9fe1b6574a..e5b761307f 100644 --- a/packages/app/src/components/DimensionsPanel/Dialogs/styles/FilterField.style.js +++ b/packages/app/src/components/DimensionsPanel/Dialogs/styles/FilterField.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; export const styles = { container: { diff --git a/packages/app/src/components/DimensionsPanel/Filter/styles/Filter.style.js b/packages/app/src/components/DimensionsPanel/Filter/styles/Filter.style.js index 8bc5a1f27e..fcea2841d4 100644 --- a/packages/app/src/components/DimensionsPanel/Filter/styles/Filter.style.js +++ b/packages/app/src/components/DimensionsPanel/Filter/styles/Filter.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; export const styles = { searchIcon: { diff --git a/packages/app/src/components/DimensionsPanel/List/styles/DimensionItem.style.js b/packages/app/src/components/DimensionsPanel/List/styles/DimensionItem.style.js index 1a0ec4fda9..a3a554016a 100644 --- a/packages/app/src/components/DimensionsPanel/List/styles/DimensionItem.style.js +++ b/packages/app/src/components/DimensionsPanel/List/styles/DimensionItem.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; export const styles = { text: { diff --git a/packages/app/src/components/DimensionsPanel/List/styles/RecommendedIcon.style.js b/packages/app/src/components/DimensionsPanel/List/styles/RecommendedIcon.style.js index 9b59ecccd9..6fc49f3e5c 100644 --- a/packages/app/src/components/DimensionsPanel/List/styles/RecommendedIcon.style.js +++ b/packages/app/src/components/DimensionsPanel/List/styles/RecommendedIcon.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; export const styles = { toolTip: { diff --git a/packages/app/src/components/DimensionsPanel/styles/DimensionsPanel.style.js b/packages/app/src/components/DimensionsPanel/styles/DimensionsPanel.style.js index a243cec1db..b61b0cc9d9 100644 --- a/packages/app/src/components/DimensionsPanel/styles/DimensionsPanel.style.js +++ b/packages/app/src/components/DimensionsPanel/styles/DimensionsPanel.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export const styles = { divContainer: { diff --git a/packages/app/src/components/Layout/DefaultLayout/styles/DefaultAxis.style.js b/packages/app/src/components/Layout/DefaultLayout/styles/DefaultAxis.style.js index 1de926447f..9cf5f93d65 100644 --- a/packages/app/src/components/Layout/DefaultLayout/styles/DefaultAxis.style.js +++ b/packages/app/src/components/Layout/DefaultLayout/styles/DefaultAxis.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../../modules/colors'; import defaultLayoutStyle from './DefaultLayout.style'; import * as layoutStyle from '../../styles/style'; diff --git a/packages/app/src/components/Layout/styles/Chip.style.js b/packages/app/src/components/Layout/styles/Chip.style.js index 6d76185d3b..2c346c5af1 100644 --- a/packages/app/src/components/Layout/styles/Chip.style.js +++ b/packages/app/src/components/Layout/styles/Chip.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; import * as layoutStyle from './style'; export const styles = { diff --git a/packages/app/src/components/Layout/styles/Tooltip.style.js b/packages/app/src/components/Layout/styles/Tooltip.style.js index 8e86e98288..dff48f2ae5 100644 --- a/packages/app/src/components/Layout/styles/Tooltip.style.js +++ b/packages/app/src/components/Layout/styles/Tooltip.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export const styles = { tooltip: { diff --git a/packages/app/src/components/Layout/styles/style.js b/packages/app/src/components/Layout/styles/style.js index 76fc083c22..e59d3cd47c 100644 --- a/packages/app/src/components/Layout/styles/style.js +++ b/packages/app/src/components/Layout/styles/style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; // Layout export const LAYOUT_HEIGHT = '78px'; diff --git a/packages/app/src/components/Snackbar/styles/Snackbar.style.js b/packages/app/src/components/Snackbar/styles/Snackbar.style.js index c4a850ff04..08f09217b8 100644 --- a/packages/app/src/components/Snackbar/styles/Snackbar.style.js +++ b/packages/app/src/components/Snackbar/styles/Snackbar.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default theme => ({ container: { diff --git a/packages/app/src/components/TitleBar/styles/TitleBar.style.js b/packages/app/src/components/TitleBar/styles/TitleBar.style.js index 96980e10a7..1043a06896 100644 --- a/packages/app/src/components/TitleBar/styles/TitleBar.style.js +++ b/packages/app/src/components/TitleBar/styles/TitleBar.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default { titleBar: { diff --git a/packages/app/src/components/UpdateButton/styles/UpdateButton.style.js b/packages/app/src/components/UpdateButton/styles/UpdateButton.style.js index f333fb8e72..519e222900 100644 --- a/packages/app/src/components/UpdateButton/styles/UpdateButton.style.js +++ b/packages/app/src/components/UpdateButton/styles/UpdateButton.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default { flat: { diff --git a/packages/app/src/components/Visualization/styles/BlankCanvas.style.js b/packages/app/src/components/Visualization/styles/BlankCanvas.style.js index 547cda4fdc..2982a53502 100644 --- a/packages/app/src/components/Visualization/styles/BlankCanvas.style.js +++ b/packages/app/src/components/Visualization/styles/BlankCanvas.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; const error = { fontWeight: 'bold', diff --git a/packages/app/src/components/VisualizationTypeSelector/styles/VisualizationTypeSelector.style.js b/packages/app/src/components/VisualizationTypeSelector/styles/VisualizationTypeSelector.style.js index 9b82ec7cc7..eeb4d2d790 100644 --- a/packages/app/src/components/VisualizationTypeSelector/styles/VisualizationTypeSelector.style.js +++ b/packages/app/src/components/VisualizationTypeSelector/styles/VisualizationTypeSelector.style.js @@ -1,4 +1,4 @@ -import { colors } from 'analytics-shared'; +import { colors } from '../../../modules/colors'; export default { button: { diff --git a/packages/shared/src/modules/colors.js b/packages/app/src/modules/colors.js similarity index 100% rename from packages/shared/src/modules/colors.js rename to packages/app/src/modules/colors.js diff --git a/packages/shared/package.json b/packages/shared/package.json deleted file mode 100644 index 94490b2bf0..0000000000 --- a/packages/shared/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "analytics-shared", - "version": "1.0.0", - "description": "analytics shared components and modules", - "author": "Jen Jones Arnesen ", - "license": "BSD-3-Clause", - "private": true, - "main": "./build/index.js", - "scripts": { - "clean": "rm -rf ./build/*", - "build": "npm run clean && NODE_ENV=production npm run build:es && NODE_ENV=production npm run build:css", - "build:es": "babel src --out-dir build --copy-files --verbose", - "build:css": "cp ./src/components/ItemSelector/ItemSelector.css ./build/", - "test": "jest --config=../../jest.config.js --watch", - "watch": "npm run build --watch" - }, - "browserslist": [ - ">0.5%", - "last 2 versions", - "Firefox ESR", - "ie 11", - "not dead" - ], - "dependencies": { - "@dhis2/d2-i18n": "^1.0.4", - "@material-ui/core": "^3.9.2", - "@material-ui/icons": "^3.0.2", - "lodash-es": "^4.17.11", - "prop-types": "^15.6.2", - "react": "^16.7.0", - "react-beautiful-dnd": "^10.0.4", - "react-dom": "^16.7.0" - } -} diff --git a/packages/shared/src/components/ItemSelector/Item.js b/packages/shared/src/components/ItemSelector/Item.js deleted file mode 100644 index 7b849cc9ac..0000000000 --- a/packages/shared/src/components/ItemSelector/Item.js +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { colors } from '../../modules/colors'; -import RemoveDimensionButton from './buttons/RemoveDimensionButton'; -import ItemIcon from './ItemIcon'; -import { styles } from './styles/Item.style'; - -const Icon = ({ selected, highlighted }) => { - const { grey, white, accentSecondary } = colors; - const bgColor = !selected ? grey : highlighted ? white : accentSecondary; - - return ; -}; - -const onClickWrapper = (id, index, onClick) => event => - onClick(event.metaKey || event.ctrlKey, event.shiftKey, index, id); - -export const Item = ({ - selected, - highlighted, - id, - index, - onRemoveItem, - onClick, - name, - isGhost, -}) => { - const selectedState = selected ? 'selected' : 'unselected'; - const divClassName = [`${selectedState}-list-item`] - .concat(isGhost ? 'ghost' : '') - .join(' '); - - return ( -
- - - {name} - - {selected && ( - onRemoveItem(id)} - /> - )} -
- ); -}; - -Item.defualtProps = { - onRemoveItem: () => null, - onClick: () => null, -}; - -Item.propTypes = { - id: PropTypes.string.isRequired, - index: PropTypes.number.isRequired, - name: PropTypes.string.isRequired, - highlighted: PropTypes.bool.isRequired, - onClick: PropTypes.func, - onRemoveItem: PropTypes.func, - selected: PropTypes.bool, - isGhost: PropTypes.bool, -}; - -export default Item; diff --git a/packages/shared/src/components/ItemSelector/ItemIcon.js b/packages/shared/src/components/ItemSelector/ItemIcon.js deleted file mode 100644 index 45452fab0f..0000000000 --- a/packages/shared/src/components/ItemSelector/ItemIcon.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; - -const ItemIcon = ({ backgroundColor }) => ( -
-); - -export default ItemIcon; diff --git a/packages/shared/src/components/ItemSelector/ItemSelector.css b/packages/shared/src/components/ItemSelector/ItemSelector.css deleted file mode 100644 index d3ae2c55de..0000000000 --- a/packages/shared/src/components/ItemSelector/ItemSelector.css +++ /dev/null @@ -1,76 +0,0 @@ -.item-selector-item { - display: flex; - margin: 2px; -} - -.item-selector-item.selected { - z-index: 10000; -} - -.item-selector-list { - user-select: none; - list-style: none; - border-bottom: 0px; - padding-left: 0px; - margin: 0px; -} - -.item-selector-arrow-forward-button, -.item-selector-arrow-back-button { - outline: none; - min-width: 39px; - padding: 0px; - border-radius: 4px; - background-color: white; - box-shadow: 0px 2px 5px #b1b1b1; - position: absolute; - left: 452px; -} - -.item-selector-arrow-forward-button { - top: 277px; -} - -.item-selector-arrow-back-button { - top: 347px; -} - -.unselected-item-label { - font-size: 14px; - padding: 2px 5px 2px 2px; -} - -.selected-item-label { - font-size: 14px; - padding: 2px; -} - -.unselected-list-item, -.selected-list-item { - display: flex; - align-items: center; - padding: 3px; - border-radius: 4px; - cursor: pointer; -} - -.unselected-list-item:hover { - background-color: #e0e0e0; -} - -.selected-list-item { - background-color: #b2dfdb; -} - -.ghost { - transition: opacity 0.2s ease; - opacity: 0.2; -} - -.selected-list-item:hover { - background-color: #86c4bf; -} - -.item-selector-item:focus { - outline: none; -} diff --git a/packages/shared/src/components/ItemSelector/ItemSelector.js b/packages/shared/src/components/ItemSelector/ItemSelector.js deleted file mode 100644 index 8fe52279f0..0000000000 --- a/packages/shared/src/components/ItemSelector/ItemSelector.js +++ /dev/null @@ -1,76 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import PropTypes from 'prop-types'; -import UnselectedItems from './UnselectedItems'; -import SelectedItems from './SelectedItems'; - -import './ItemSelector.css'; - -const style = { - container: { - marginRight: 55, - display: 'flex', - flexDirection: 'column', - width: 420, - height: 534, - border: '1px solid #e0e0e0', - }, -}; - -class ItemSelector extends Component { - render() { - const { - unselected, - selected, - itemClassName, - children: filterZone, - } = this.props; - - return ( - -
- {filterZone} - -
- -
- ); - } -} - -ItemSelector.defaultProps = { - unselected: { - filterText: '', - }, -}; - -ItemSelector.propTypes = { - unselected: PropTypes.shape({ - items: PropTypes.arrayOf( - PropTypes.shape({ - id: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - }) - ).isRequired, - onSelect: PropTypes.func.isRequired, - filterText: PropTypes.string, - requestMoreItems: PropTypes.func, - }), - selected: PropTypes.shape({ - items: PropTypes.arrayOf( - PropTypes.shape({ - id: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - }) - ).isRequired, - dialogId: PropTypes.string, - onDeselect: PropTypes.func.isRequired, - onReorder: PropTypes.func.isRequired, - }), - itemClassName: PropTypes.string, -}; - -export default ItemSelector; diff --git a/packages/shared/src/components/ItemSelector/SelectedItems.js b/packages/shared/src/components/ItemSelector/SelectedItems.js deleted file mode 100644 index 3e837a86dd..0000000000 --- a/packages/shared/src/components/ItemSelector/SelectedItems.js +++ /dev/null @@ -1,285 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import i18n from '@dhis2/d2-i18n'; -import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd'; -import sortBy from 'lodash-es/sortBy'; - -import Item from './Item'; -import { ArrowButton as UnAssignButton } from './buttons/ArrowButton'; -import { SelectButton as DeselectAllButton } from './buttons/SelectButton'; - -import { toggler } from './modules/toggler'; - -import { styles } from './styles/SelectedItems.style'; - -const Subtitle = () => ( -
- {i18n.t('Selected Data')} -
-); - -const ItemsList = ({ styles, innerRef, children }) => ( -
    - {children} -
-); - -const CLONE_INDEX = 9999; // a high number to not influence the actual item list - -export class SelectedItems extends Component { - state = { highlighted: [], lastClickedIndex: 0, draggingId: null }; - - onDeselectHighlighted = () => { - this.props.onDeselect(this.state.highlighted); - this.setState({ highlighted: [] }); - }; - - onDeselectOne = id => { - const highlighted = this.state.highlighted.filter( - highlightedId => highlightedId !== id - ); - - this.props.onDeselect([id]); - this.setState({ highlighted }); - }; - - onDeselectAll = () => { - this.props.onDeselect(this.props.items.map(item => item.id)); - this.setState({ highlighted: [] }); - }; - - toggleHighlight = (isCtrlPressed, isShiftPressed, index, id) => { - const newState = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - this.state.lastClickedIndex, - this.state.highlighted, - this.props.items.map(item => item.id) - ); - - this.setState({ - highlighted: newState.ids, - lastClickedIndex: newState.lastClickedIndex, - }); - }; - - isMultiDrag = draggableId => { - return ( - this.state.highlighted.includes(draggableId) && - this.state.highlighted.length > 1 - ); - }; - - onDragStart = start => { - const id = start.draggableId; - const selected = this.state.highlighted.find(itemId => itemId === id); - - // if dragging an item that is not highlighted, unhighlight all items - if (!selected) { - this.setState({ highlighted: [] }); - } - - this.setState({ draggingId: start.draggableId }); - }; - - reorderList = (destination, source, draggableId) => { - const list = Array.from(this.props.items.map(item => item.id)); - - if (this.isMultiDrag(draggableId)) { - const indexedItemsToMove = sortBy( - this.state.highlighted.map(item => { - return { - item, - idx: this.props.items - .map(item => item.id) - .indexOf(item), - }; - }), - 'idx' - ); - - let destinationIndex = destination.index; - - if ( - destinationIndex < this.props.items.length - 1 && - destinationIndex > 1 - ) { - indexedItemsToMove.forEach(indexed => { - if (indexed.idx < destinationIndex) { - --destinationIndex; - } - }); - } - - indexedItemsToMove.forEach(indexed => { - const idx = list.indexOf(indexed.item); - list.splice(idx, 1); - }); - - indexedItemsToMove.forEach((indexed, i) => { - list.splice(destinationIndex + i, 0, indexed.item); - }); - } else { - list.splice(source.index, 1); - list.splice(destination.index, 0, draggableId); - } - - return list; - }; - - onDragEnd = ({ destination, source, draggableId }) => { - this.setState({ draggingId: null }); - - if (destination === null) { - return; - } - - if ( - destination.draggableId === source.draggableId && - destination.index === source.index - ) { - return; - } - - const newList = this.reorderList(destination, source, draggableId); - - this.props.onReorder(newList); - }; - - renderListItem = ({ id, name }, index) => ( - - {(provided, snapshot) => { - const isDraggedItem = - snapshot.isDragging && - this.state.highlighted.length > 1 && - this.state.highlighted.includes(this.state.draggingId); - - const isGhost = - this.state.highlighted.includes(id) && - Boolean(this.state.draggingId) && - this.state.draggingId !== id; - - const itemText = isDraggedItem - ? `${this.state.highlighted.length} items` - : name; - - return ( -
  • this.onDeselectOne(id)} - {...provided.draggableProps} - {...provided.dragHandleProps} - ref={provided.innerRef} - > - -
  • - ); - }} -
    - ); - - renderCloneItem = ({ id, name }, index) => { - const cloneId = `${id}-clone`; - return ( - - {provided => ( -
  • - -
  • - )} -
    - ); - }; - - getItemListWithClone = () => { - let list = []; - - this.props.items.forEach(item => { - list.push(item); - - const isDraggedItem = - this.isMultiDrag(this.state.draggingId) && - this.state.draggingId === item.id; - - if (isDraggedItem) { - list.push({ id: item.id, name: item.name, clone: true }); - } - }); - - return list; - }; - - render = () => { - const dimensions = this.getItemListWithClone().map((item, i) => - item.clone - ? this.renderCloneItem(item, i) - : this.renderListItem(item, i) - ); - - return ( -
    - - - - {provided => ( - - {dimensions} - {provided.placeholder} - - )} - - - - -
    - ); - }; -} - -SelectedItems.propTypes = { - items: PropTypes.array.isRequired, - onDeselect: PropTypes.func.isRequired, - onReorder: PropTypes.func.isRequired, -}; - -export default SelectedItems; diff --git a/packages/shared/src/components/ItemSelector/UnselectedItems.js b/packages/shared/src/components/ItemSelector/UnselectedItems.js deleted file mode 100644 index 542afbdfce..0000000000 --- a/packages/shared/src/components/ItemSelector/UnselectedItems.js +++ /dev/null @@ -1,138 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import PropTypes from 'prop-types'; -import i18n from '@dhis2/d2-i18n'; -import throttle from 'lodash-es/throttle'; -import Item from './Item'; -import { ArrowButton as AssignButton } from './buttons/ArrowButton'; -import { SelectButton as SelectAllButton } from './buttons/SelectButton'; -import { toggler } from './modules/toggler'; -import { styles } from './styles/UnselectedItems.style'; - -export class UnselectedItems extends Component { - constructor(props) { - super(props); - this.scrolElRef = React.createRef(); - } - - state = { highlighted: [], lastClickedIndex: 0 }; - - onSelectClick = () => { - this.props.onSelect(this.state.highlighted); - this.setState({ highlighted: [] }); - }; - - onSelectAllClick = () => { - this.props.onSelect(this.props.items.map(i => i.id)); - this.setState({ highlighted: [] }); - }; - - onDoubleClickItem = id => { - const highlighted = this.state.highlighted.filter( - dataDimId => dataDimId !== id - ); - - this.setState({ highlighted }); - this.props.onSelect([id]); - }; - - filterTextContains = displayName => - displayName.toLowerCase().includes(this.props.filterText.toLowerCase()); - - filterItems = (item, index) => - this.filterTextContains(item.name) - ? this.renderListItem(item, index) - : null; - - toggleHighlight = (isCtrlPressed, isShiftPressed, index, id) => { - const newState = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - this.state.lastClickedIndex, - this.state.highlighted, - this.props.items.map(item => item.id) - ); - - this.setState({ - highlighted: newState.ids, - lastClickedIndex: newState.lastClickedIndex, - }); - }; - - renderListItem = (dataDim, index) => ( -
  • this.onDoubleClickItem(dataDim.id)} - > - -
  • - ); - - requestMoreItems = throttle(() => { - const node = this.scrolElRef.current; - - if (node) { - const bottom = - node.scrollHeight - node.scrollTop === node.clientHeight; - if (bottom) { - this.props.requestMoreItems(); - } - } - }, 1000); - - render = () => { - const listItems = this.props.items.map((item, index) => - this.props.filterText.length - ? this.filterItems(item, index) - : this.renderListItem(item, index) - ); - - return ( - -
    -
      {listItems}
    -
    - - -
    - ); - }; -} - -UnselectedItems.propTypes = { - items: PropTypes.arrayOf( - PropTypes.shape({ - id: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - }) - ).isRequired, - onSelect: PropTypes.func.isRequired, - filterText: PropTypes.string, - requestMoreItems: PropTypes.func, -}; - -UnselectedItems.defaultProps = { - requestMoreItems: () => null, -}; - -export default UnselectedItems; diff --git a/packages/shared/src/components/ItemSelector/__tests__/Item.spec.js b/packages/shared/src/components/ItemSelector/__tests__/Item.spec.js deleted file mode 100644 index 4c5008463b..0000000000 --- a/packages/shared/src/components/ItemSelector/__tests__/Item.spec.js +++ /dev/null @@ -1,140 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import Item from '../Item'; -import RemoveDimensionButton from '../buttons/RemoveDimensionButton'; -import ItemIcon from '../ItemIcon'; -import { colors } from '../../../modules/colors'; - -describe('The Item component ', () => { - let props; - let shallowItem; - - const item = () => { - if (!shallowItem) { - shallowItem = shallow(); - } - return shallowItem; - }; - - beforeEach(() => { - props = { - id: 'testID', - index: 0, - name: 'displayTestName', - highlighted: false, - onClick: jest.fn(), - }; - shallowItem = undefined; - }); - - it('renders a div containing everything else', () => { - const wrappingDiv = item() - .find('div') - .first(); - - expect( - item() - .find('div') - .first() - ).toHaveLength(1); - expect(wrappingDiv.children()).toEqual(item().children()); - }); - - it('renders when prop "selected" is true ', () => { - const icon = item() - .find('Icon') - .dive() - .find(ItemIcon); - - expect(icon.prop('backgroundColor')).toEqual(colors.grey); - }); - - it('renders a when props highlighted and selected are true', () => { - props.highlighted = true; - props.selected = true; - - const icon = item() - .find('Icon') - .dive() - .find(ItemIcon); - - expect(icon.prop('backgroundColor')).toEqual(colors.white); - }); - - it('renders when className is equal to "selected" ', () => { - props.selected = true; - - const icon = item() - .find('Icon') - .dive() - .find(ItemIcon); - - expect(icon.prop('backgroundColor')).toEqual(colors.accentSecondary); - }); - - it('should not render a for unselected item ', () => { - const removeButton = item().find(RemoveDimensionButton); - - expect(removeButton.length).toEqual(0); - }); - - it('renders for selected item ', () => { - props.selected = true; - - const removeButton = item().find(RemoveDimensionButton); - - expect(removeButton.length).toEqual(1); - }); - - describe('onClick', () => { - it('fires onClick property', () => { - item() - .props() - .onClick({ preventDefault: () => undefined }); - - expect(props.onClick).toBeCalledTimes(1); - }); - - it('fires onClick with correct arguments when metaKey pressed', () => { - item() - .props() - .onClick({ - preventDefault: () => undefined, - metaKey: true, - ctrlKey: false, - shiftKey: false, - }); - - expect(props.onClick).toBeCalledTimes(1); - expect(props.onClick).toBeCalledWith(true, false, 0, 'testID'); - }); - - it('fires onClick with correct arguments when ctrlKey pressed', () => { - item() - .props() - .onClick({ - preventDefault: () => undefined, - metaKey: false, - ctrlKey: true, - shiftKey: false, - }); - - expect(props.onClick).toBeCalledTimes(1); - expect(props.onClick).toBeCalledWith(true, false, 0, 'testID'); - }); - - it('fires onClick with correct arguments when shiftKey pressed', () => { - item() - .props() - .onClick({ - preventDefault: () => undefined, - metaKey: false, - ctrlKey: false, - shiftKey: true, - }); - - expect(props.onClick).toBeCalledTimes(1); - expect(props.onClick).toBeCalledWith(false, true, 0, 'testID'); - }); - }); -}); diff --git a/packages/shared/src/components/ItemSelector/__tests__/SelectedItems.spec.js b/packages/shared/src/components/ItemSelector/__tests__/SelectedItems.spec.js deleted file mode 100644 index bc47b75e31..0000000000 --- a/packages/shared/src/components/ItemSelector/__tests__/SelectedItems.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import { SelectedItems } from '../SelectedItems'; - -describe('The SelectedItems component', () => { - let props; - let selectedItemsWrapper; - - const selectedItems = () => { - if (!selectedItemsWrapper) { - selectedItemsWrapper = mount(); - } - return selectedItemsWrapper; - }; - - beforeEach(() => { - props = { - items: [], - onDeselect: jest.fn(), - onReorder: jest.fn(), - }; - selectedItemsWrapper = undefined; - }); - - describe('list with items', () => { - beforeEach(() => { - props.items = [ - { - id: 'rb', - name: 'rainbow', - }, - { id: 'rr', name: 'rarity' }, - ]; - }); - - it('triggers onDeselect when item double-clicked', () => { - selectedItems() - .find('li') - .first() - .simulate('doubleClick'); - - expect(props.onDeselect).toHaveBeenCalled(); - expect(props.onDeselect).toHaveBeenCalledWith(['rb']); - }); - - it('triggers onDeselect when Deselect All button clicked', () => { - selectedItems() - .find('SelectButton') - .first() - .simulate('click'); - - expect(props.onDeselect).toHaveBeenCalled(); - expect(props.onDeselect).toHaveBeenCalledWith(['rb', 'rr']); - }); - - it('triggers onDeselect when "unassign" button clicked', () => { - const list = selectedItems(); - - list.find('Item') - .first() - .simulate('click', false, false, 0, 'rb'); - - const onClickFn = list.find('ArrowButton').prop('onClick'); - - onClickFn(); // enzyme simulate was not working - - expect(props.onDeselect).toHaveBeenCalled(); - expect(props.onDeselect).toHaveBeenCalledWith(['rb']); - }); - }); -}); diff --git a/packages/shared/src/components/ItemSelector/__tests__/UnselectedItems.spec.js b/packages/shared/src/components/ItemSelector/__tests__/UnselectedItems.spec.js deleted file mode 100644 index dae41ddd46..0000000000 --- a/packages/shared/src/components/ItemSelector/__tests__/UnselectedItems.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import { UnselectedItems } from '../UnselectedItems'; - -describe('UnselectedItems component', () => { - let props; - let shallowItems; - const unselectedItems = () => { - if (!shallowItems) { - shallowItems = shallow(); - } - return shallowItems; - }; - - beforeEach(() => { - props = { - items: [], - filterText: '', - onSelect: jest.fn(), - requestMoreItems: jest.fn(), - }; - shallowItems = undefined; - }); - - it('matches the snapshot when list is empty', () => { - expect(unselectedItems()).toMatchSnapshot(); - }); - - describe('list with items', () => { - beforeEach(() => { - props.items = [ - { - id: 'rb', - name: 'rainbow', - }, - { id: 'rr', name: 'rarity' }, - ]; - }); - - it('matches the snapshot when list has items', () => { - expect(unselectedItems()).toMatchSnapshot(); - }); - - it('triggers onSelect all when "select all" button clicked', () => { - unselectedItems() - .find('SelectButton') - .simulate('click'); - - expect(props.onSelect).toHaveBeenCalled(); - expect(props.onSelect).toHaveBeenCalledWith(['rb', 'rr']); - }); - - it('triggers onSelect when item double-clicked', () => { - unselectedItems() - .find('li') - .first() - .simulate('doubleClick'); - - expect(props.onSelect).toHaveBeenCalled(); - expect(props.onSelect).toHaveBeenCalledWith(['rb']); - }); - - it('triggers onSelect when "assign" button clicked', () => { - const list = unselectedItems(); - list.find('Item') - .first() - .simulate('click', false, false, 0, 'rb'); - - list.find('ArrowButton') - .first() - .simulate('click'); - - expect(props.onSelect).toHaveBeenCalled(); - expect(props.onSelect).toHaveBeenCalledWith(['rb']); - }); - - it('renders only items matching the filter', () => { - props.filterText = 'b'; - const items = unselectedItems().find('Item'); - - expect(items.length).toEqual(1); - expect(items.dive().text()).toEqual( - expect.stringContaining('rainbow') - ); - }); - }); -}); diff --git a/packages/shared/src/components/ItemSelector/__tests__/__snapshots__/UnselectedItems.spec.js.snap b/packages/shared/src/components/ItemSelector/__tests__/__snapshots__/UnselectedItems.spec.js.snap deleted file mode 100644 index ace4b155a6..0000000000 --- a/packages/shared/src/components/ItemSelector/__tests__/__snapshots__/UnselectedItems.spec.js.snap +++ /dev/null @@ -1,94 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UnselectedItems component list with items matches the snapshot when list has items 1`] = ` - -
    -
      -
    • - -
    • -
    • - -
    • -
    -
    - - -
    -`; - -exports[`UnselectedItems component matches the snapshot when list is empty 1`] = ` - -
    -
      -
    - - -
    -`; diff --git a/packages/shared/src/components/ItemSelector/buttons/ArrowButton.js b/packages/shared/src/components/ItemSelector/buttons/ArrowButton.js deleted file mode 100644 index 9638b02e70..0000000000 --- a/packages/shared/src/components/ItemSelector/buttons/ArrowButton.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import IconButton from '@material-ui/core/IconButton'; -import ArrowForward from '@material-ui/icons/ArrowForward'; -import ArrowBack from '@material-ui/icons/ArrowBack'; -import { styles } from '../styles/buttons.style'; - -export const ArrowButton = ({ className, onClick, iconType }) => ( -
    - - {iconType === 'arrowForward' ? ( - - ) : ( - - )} - -
    -); - -export default ArrowButton; diff --git a/packages/shared/src/components/ItemSelector/buttons/RemoveDimensionButton.js b/packages/shared/src/components/ItemSelector/buttons/RemoveDimensionButton.js deleted file mode 100644 index 4512387829..0000000000 --- a/packages/shared/src/components/ItemSelector/buttons/RemoveDimensionButton.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import IconButton from '@material-ui/core/IconButton'; -import Close from '@material-ui/icons/Close'; -import { styles } from '../styles/buttons.style'; - -export const RemoveDimensionButton = ({ highlighted, onClick }) => ( - { - e.stopPropagation(); - onClick(); - }} - > - - -); - -RemoveDimensionButton.propTypes = { - highlighted: PropTypes.bool.isRequired, - onClick: PropTypes.func.isRequired, -}; - -export default RemoveDimensionButton; diff --git a/packages/shared/src/components/ItemSelector/buttons/SelectButton.js b/packages/shared/src/components/ItemSelector/buttons/SelectButton.js deleted file mode 100644 index 56d5cfdc10..0000000000 --- a/packages/shared/src/components/ItemSelector/buttons/SelectButton.js +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import Button from '@material-ui/core/Button'; -import { styles } from '../styles/buttons.style'; - -export const SelectButton = ({ style, onClick, label }) => ( - -); diff --git a/packages/shared/src/components/ItemSelector/modules/__tests__/toggler.spec.js b/packages/shared/src/components/ItemSelector/modules/__tests__/toggler.spec.js deleted file mode 100644 index 202f54abc2..0000000000 --- a/packages/shared/src/components/ItemSelector/modules/__tests__/toggler.spec.js +++ /dev/null @@ -1,237 +0,0 @@ -import { toggler } from '../toggler'; - -describe('using the toggler ', () => { - let id; - let isCtrlPressed; - let isShiftPressed; - let index; - let lastClickedIndex; - let highlightedIds; - let items; - - describe('with only mouse click', () => { - beforeEach(() => { - id = 'id'; - isCtrlPressed = false; - isShiftPressed = false; - index = 1; - lastClickedIndex = 0; - highlightedIds = ['stuff', 'here']; - items = ['some', 'id', 'strings']; - }); - - it('should not add duplicate items', () => { - id = 'some'; - - const expectedResult = { - ids: [id], - lastClickedIndex: index, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toStrictEqual(expectedResult); - }); - - it('should update the lastClickedIndex', () => { - const expectedResult = { - ids: id, - lastClickedIndex: index, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult.lastClickedIndex).toEqual( - expectedResult.lastClickedIndex - ); - }); - - it('should remove all items and replace the contens with only the given value (id)', () => { - const expectedResult = { - ids: [id], - lastClickedIndex: index, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toEqual(expectedResult); - }); - }); - - describe('with shift key pressed', () => { - beforeEach(() => { - id = 'ones'; - isCtrlPressed = false; - isShiftPressed = true; - index = 1; - lastClickedIndex = 0; - highlightedIds = ['ones', 'stuff', 'here']; - items = [ - 'ones', - 'some', - 'id', - 'strings', - 'stuff', - 'here', - 'as', - 'well', - ]; - }); - - it('should not update the lastClickedIndex', () => { - const expectedResult = { - ids: items, - lastClickedIndex: lastClickedIndex, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult.lastClickedIndex).toStrictEqual( - expectedResult.lastClickedIndex - ); - }); - - it('should keep the highlighted ids and not add duplicate items', () => { - const expectedResult = { - ids: ['some', 'ones', 'stuff', 'here'], - lastClickedIndex: lastClickedIndex, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toEqual(expectedResult); - }); - - it('should add items from lastClickedIndex to current index into the array', () => { - const expectedResult = { - ids: ['some', 'ones', 'stuff', 'here'], - lastClickedIndex: lastClickedIndex, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toEqual(expectedResult); - }); - }); - - describe('with meta key pressed', () => { - beforeEach(() => { - id = 'ones'; - isCtrlPressed = true; - isShiftPressed = false; - index = 0; - lastClickedIndex = 2; - highlightedIds = ['stuff', 'here']; - items = ['ones', 'stuff', 'here']; - }); - - it('should not add duplicate items', () => { - id = 'stuff'; - - const expectedResult = { - ids: ['here'], - lastClickedIndex: lastClickedIndex, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toStrictEqual(expectedResult); - }); - - it('should be able to add one item and update the lastClickedIndex', () => { - const expectedResult = { - ids: highlightedIds.concat(id), - lastClickedIndex: index, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toStrictEqual(expectedResult); - }); - - it('should be able to remove one item without updating lastClickedIndex', () => { - id = 'here'; - - const expectedResult = { - ids: ['stuff'], - lastClickedIndex: lastClickedIndex, - }; - - const actualResult = toggler( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items - ); - - expect(actualResult).toStrictEqual(expectedResult); - }); - }); -}); diff --git a/packages/shared/src/components/ItemSelector/modules/toggler.js b/packages/shared/src/components/ItemSelector/modules/toggler.js deleted file mode 100644 index 72d292a136..0000000000 --- a/packages/shared/src/components/ItemSelector/modules/toggler.js +++ /dev/null @@ -1,68 +0,0 @@ -export const toggler = ( - id, - isCtrlPressed, - isShiftPressed, - index, - lastClickedIndex, - highlightedIds, - items -) => { - let ids; - let newIndex = lastClickedIndex; - - if (!isCtrlPressed && !isShiftPressed) { - ids = [id]; - newIndex = index; - } else if (isShiftPressed) { - const minIndex = getMinIndex(lastClickedIndex, index); - const maxIndex = getMaxIndex(lastClickedIndex, index); - - ids = mergeIds(highlightedIds, items, minIndex, maxIndex); - } else { - const newArr = updateArray(highlightedIds, id, lastClickedIndex, index); - ids = newArr.ids; - newIndex = newArr.newIndex; - } - - return { - ids, - lastClickedIndex: newIndex, - }; -}; - -const getMinIndex = (lastClickedIndex, index) => - lastClickedIndex > index ? index : lastClickedIndex; - -const getMaxIndex = (lastClickedIndex, index) => - lastClickedIndex < index ? index : lastClickedIndex; - -const mergeIds = (highlightedIds, items, minIndex, maxIndex) => - highlightedIds.length - ? items - .slice(minIndex, maxIndex + 1) - .filter(id => !highlightedIds.includes(id)) - .concat(highlightedIds) - : items.slice(minIndex, maxIndex + 1); - -const updateArray = (highlightedIds, id, lastClickedIndex, index) => { - let ids; - let newIndex = lastClickedIndex; - - const idIndex = highlightedIds.findIndex( - highlightedId => highlightedId === id - ); - - if (idIndex >= 0) { - ids = highlightedIds - .slice(0, idIndex) - .concat(highlightedIds.slice(idIndex + 1)); - } else { - ids = [...highlightedIds, id]; - newIndex = index; - } - - return { - ids, - newIndex, - }; -}; diff --git a/packages/shared/src/components/ItemSelector/styles/Item.style.js b/packages/shared/src/components/ItemSelector/styles/Item.style.js deleted file mode 100644 index b0e0526890..0000000000 --- a/packages/shared/src/components/ItemSelector/styles/Item.style.js +++ /dev/null @@ -1,10 +0,0 @@ -import { colors } from '../../../modules/colors'; - -export const styles = { - highlightedItem: { - backgroundColor: colors.accentSecondaryDark, - }, - highlightedText: { - color: colors.white, - }, -}; diff --git a/packages/shared/src/components/ItemSelector/styles/SelectedItems.style.js b/packages/shared/src/components/ItemSelector/styles/SelectedItems.style.js deleted file mode 100644 index a340852a81..0000000000 --- a/packages/shared/src/components/ItemSelector/styles/SelectedItems.style.js +++ /dev/null @@ -1,35 +0,0 @@ -import { colors } from '../../../modules/colors'; - -export const styles = { - container: { - border: `1px solid ${colors.greyLight}`, - height: '534px', - width: '278px', - }, - subTitleContainer: { - borderBottom: `1px solid ${colors.greyLight}`, - height: '42px', - }, - subTitleText: { - position: 'relative', - fontFamily: 'Roboto', - color: colors.black, - fontSize: '15px', - fontWeight: '500', - height: '20px', - top: '12px', - left: '8px', - }, - list: { - userSelect: 'none', - listStyle: 'none', - overflowY: 'scroll', - height: '455px', - paddingLeft: '0px', - margin: '0px', - }, - deselectButton: { - margin: '0 auto', - display: 'block', - }, -}; diff --git a/packages/shared/src/components/ItemSelector/styles/UnselectedItems.style.js b/packages/shared/src/components/ItemSelector/styles/UnselectedItems.style.js deleted file mode 100644 index 1f7c558bc2..0000000000 --- a/packages/shared/src/components/ItemSelector/styles/UnselectedItems.style.js +++ /dev/null @@ -1,7 +0,0 @@ -export const styles = { - selectButton: { - margin: '0 auto', - display: 'block', - }, - unselectedItems: { flex: '1', overflowY: 'auto' }, -}; diff --git a/packages/shared/src/components/ItemSelector/styles/buttons.style.js b/packages/shared/src/components/ItemSelector/styles/buttons.style.js deleted file mode 100644 index d044c585e9..0000000000 --- a/packages/shared/src/components/ItemSelector/styles/buttons.style.js +++ /dev/null @@ -1,39 +0,0 @@ -import { colors } from '../../../modules/colors'; - -export const styles = { - arrowButton: { - padding: '0px', - minWidth: '40px', - width: '40px', - minHeight: '36px', - height: '36px', - backgroundColor: colors.white, - }, - arrowIcon: { - height: '20px', - width: '24px', - fill: colors.greyDark, - }, - buttonText: { - fontSize: '13px', - letterSpacing: '0.46', - }, - deleteButton: { - border: 'none', - outline: 'none', - background: 'none', - padding: '0px', - height: '18px', - width: '18px', - }, - close: { - fill: colors.accentSecondary, - height: '13px', - width: '10px', - }, - highlightedClose: { - fill: colors.white, - height: '13px', - width: '10px', - }, -}; diff --git a/packages/shared/src/index.js b/packages/shared/src/index.js deleted file mode 100644 index 5d70aed225..0000000000 --- a/packages/shared/src/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import ItemSelector from './components/ItemSelector/ItemSelector'; -import { colors } from './modules/colors'; - -export { ItemSelector, colors }; diff --git a/yarn.lock b/yarn.lock index 603a9d3a92..ffa1d0f18b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -179,6 +179,21 @@ dependencies: i18next "^10.3" +"@dhis2/d2-ui-analytics@^0.0.12": + version "0.0.12" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-analytics/-/d2-ui-analytics-0.0.12.tgz#c2c96fd1f7b7a00727187493ee6bcac13794dcf9" + integrity sha512-/UE9BPBYnPYN+rOaiEzQng4bbQmkCgGURG9+kohsoAgLaHgzrntqk5hYnDGOZpxd9QT4P+oh4Da96sO89CksHA== + dependencies: + "@dhis2/d2-i18n" "^1.0.4" + "@dhis2/d2-ui-org-unit-dialog" "5.3.1" + "@dhis2/d2-ui-period-selector-dialog" "^5.3.1" + "@material-ui/core" "^3.9.3" + "@material-ui/icons" "^3.0.2" + classnames "^2.2.6" + lodash "^4.17.11" + react-beautiful-dnd "^10.1.1" + styled-jsx "^3.2.1" + "@dhis2/d2-ui-core@5.1.3": version "5.1.3" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-5.1.3.tgz#b2804af5224a5188d8aa9dda753b878e0d4ab65e" @@ -209,6 +224,16 @@ lodash "^4.17.10" material-ui "^0.20.0" +"@dhis2/d2-ui-core@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-core/-/d2-ui-core-5.3.1.tgz#73d8c91b7191f4e6813201598848ea379f3417eb" + integrity sha512-g/Ub9bCyDFIs3FPtSDOt4m+aRGBUX0R+cmcSRCNn7+pW2b9VS8yjRm5pfCvm+sv+PkfAmEt1jaOIwb9SA5AOsA== + dependencies: + babel-runtime "^6.26.0" + d2 "~31.7" + lodash "^4.17.10" + material-ui "^0.20.0" + "@dhis2/d2-ui-favorites-dialog@5.2.11": version "5.2.11" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-favorites-dialog/-/d2-ui-favorites-dialog-5.2.11.tgz#8ab79d465519afa9b519e4df60591264ddfbce55" @@ -280,6 +305,17 @@ "@material-ui/icons" "^3.0.1" prop-types "^15.5.10" +"@dhis2/d2-ui-org-unit-dialog@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-dialog/-/d2-ui-org-unit-dialog-5.3.1.tgz#291fc5e1160b9820a8c1ee4bebc99c6b944b26b5" + integrity sha512-ZTYPcvWaeC37vJSWvMDND0E9p85JcJzq5uym4wPjpzeckq5PWPzj/95emPjLEzneD6XTBpmr1hMwBA7G5z/G0w== + dependencies: + "@dhis2/d2-i18n" "^1.0.3" + "@dhis2/d2-ui-org-unit-tree" "5.3.1" + "@material-ui/core" "^3.3.1" + "@material-ui/icons" "^3.0.1" + prop-types "^15.5.10" + "@dhis2/d2-ui-org-unit-tree@5.1.3": version "5.1.3" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-tree/-/d2-ui-org-unit-tree-5.1.3.tgz#60605ef4b585e7e5aa07406fa1c51f67be0c986b" @@ -292,6 +328,18 @@ recompose "^0.26.0" rxjs "^5.5.7" +"@dhis2/d2-ui-org-unit-tree@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-tree/-/d2-ui-org-unit-tree-5.3.1.tgz#168144886c4b7f872822066a97181f9636884cc4" + integrity sha512-T0hYR6rc9foawFsqI+p7e3Dz6EtUORaXhvAXw+DYfilahe+7NDC/LYBU7CF3ri/pyA4N88LFi3U+zF8XPP253Q== + dependencies: + "@dhis2/d2-ui-core" "5.3.1" + "@material-ui/core" "^3.3.1" + babel-runtime "^6.26.0" + prop-types "^15.5.10" + recompose "^0.26.0" + rxjs "^5.5.7" + "@dhis2/d2-ui-period-selector-dialog@5.1.3": version "5.1.3" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-period-selector-dialog/-/d2-ui-period-selector-dialog-5.1.3.tgz#5087880da94058b0fc9113a5b14ccb46c149f22c" @@ -307,6 +355,21 @@ react-sortable-hoc "^0.8.4" redux "^4.0.1" +"@dhis2/d2-ui-period-selector-dialog@^5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-period-selector-dialog/-/d2-ui-period-selector-dialog-5.3.1.tgz#9a5e81a2b5b5cd2980ab3ae9f9a88163503dc545" + integrity sha512-Bm+dyRcplgmkw9Iutnqrb7JN9kciPljpiNo7ZmOIRODYdRMKRwhCtmolAWOOdjPjrYFKAyYvd942C0BjYz5W4g== + dependencies: + "@dhis2/d2-i18n" "^1.0.4" + "@material-ui/core" "^3.3.1" + "@material-ui/icons" "^3.0.1" + babel-runtime "^6.26.0" + lodash "^4.17.11" + prop-types "^15.6.0" + react-redux "^5.0.7" + react-sortable-hoc "^0.8.4" + redux "^4.0.1" + "@dhis2/d2-ui-rich-text@5.2.10": version "5.2.10" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-rich-text/-/d2-ui-rich-text-5.2.10.tgz#ce636dcb0e1a571d1ad96494e305ce13b1fb8654" @@ -1034,7 +1097,7 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" -"@material-ui/core@^3.1.2", "@material-ui/core@^3.3.1", "@material-ui/core@^3.9.2": +"@material-ui/core@^3.1.2", "@material-ui/core@^3.3.1": version "3.9.2" resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-3.9.2.tgz#41ed1a470e981d199829eb5d9317a671c66a6f7d" integrity sha512-aukR3mSH3g115St2OnqoeMRtmxzxxx+Mch7pFKRV3Tz3URExBlZwOolimjxKZpG4LGec8HlhREawafLsDzjVWQ== @@ -1067,6 +1130,39 @@ recompose "0.28.0 - 0.30.0" warning "^4.0.1" +"@material-ui/core@^3.9.3": + version "3.9.3" + resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-3.9.3.tgz#d378c1f4beb18df9a534ca7258c2c33fb8e0e51f" + integrity sha512-REIj62+zEvTgI/C//YL4fZxrCVIySygmpZglsu/Nl5jPqy3CDjZv1F9ubBYorHqmRgeVPh64EghMMWqk4egmfg== + dependencies: + "@babel/runtime" "^7.2.0" + "@material-ui/system" "^3.0.0-alpha.0" + "@material-ui/utils" "^3.0.0-alpha.2" + "@types/jss" "^9.5.6" + "@types/react-transition-group" "^2.0.8" + brcast "^3.0.1" + classnames "^2.2.5" + csstype "^2.5.2" + debounce "^1.1.0" + deepmerge "^3.0.0" + dom-helpers "^3.2.1" + hoist-non-react-statics "^3.2.1" + is-plain-object "^2.0.4" + jss "^9.8.7" + jss-camel-case "^6.0.0" + jss-default-unit "^8.0.2" + jss-global "^3.0.0" + jss-nested "^6.0.1" + jss-props-sort "^6.0.0" + jss-vendor-prefixer "^7.0.0" + normalize-scroll-left "^0.1.2" + popper.js "^1.14.1" + prop-types "^15.6.0" + react-event-listener "^0.6.2" + react-transition-group "^2.2.1" + recompose "0.28.0 - 0.30.0" + warning "^4.0.1" + "@material-ui/icons@^3.0.1", "@material-ui/icons@^3.0.2": version "3.0.2" resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-3.0.2.tgz#d67a6dd1ec8312d3a88ec97944a63daeef24fe10" @@ -4314,6 +4410,13 @@ d2@~31.4: dependencies: whatwg-fetch "^2.0.3" +d2@~31.7: + version "31.7.0" + resolved "https://registry.yarnpkg.com/d2/-/d2-31.7.0.tgz#3a843240fecaafdf213da78b55aed9b8611ee22e" + integrity sha512-+ubKyPWKxUz90g5RHCYIt4KxKPzcCOBvDS7X0076XSycecfx4qvtkGBcKyFmXdz27iwTLUpNtruL9pUK9aTi/A== + dependencies: + isomorphic-fetch "^2.2.1" + d3-color@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.0.1.tgz#73cc91f4ee3f12e00ca06b1596a7c83cf104723a" @@ -7475,7 +7578,7 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^2.1.1: +isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= @@ -10946,7 +11049,7 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-beautiful-dnd@^10.0.4: +react-beautiful-dnd@^10.0.4, react-beautiful-dnd@^10.1.1: version "10.1.1" resolved "https://registry.yarnpkg.com/react-beautiful-dnd/-/react-beautiful-dnd-10.1.1.tgz#d753088d77d7632e77cf8a8935fafcffa38f574b" integrity sha512-TdE06Shfp56wm28EzjgC56EEMgGI5PDHejJ2bxuAZvZr8CVsbksklsJC06Hxf0MSL7FHbflL/RpkJck9isuxHg== @@ -10984,7 +11087,7 @@ react-dev-utils@^5.0.2: strip-ansi "3.0.1" text-table "0.2.0" -react-dom@^16.6.0, react-dom@^16.7.0: +react-dom@^16.6.0: version "16.8.6" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== @@ -11103,7 +11206,7 @@ react-transition-group@^2.2.1: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react@^16.6.0, react@^16.7.0: +react@^16.6.0: version "16.8.6" resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==