diff --git a/packages/core/src/AlertStack/AlertStack.stories.js b/packages/core/src/AlertStack/AlertStack.stories.js index b21a60bb35..62e98ba7d2 100644 --- a/packages/core/src/AlertStack/AlertStack.stories.js +++ b/packages/core/src/AlertStack/AlertStack.stories.js @@ -3,7 +3,7 @@ import { storiesOf } from '@storybook/react' import { AlertStack } from './AlertStack.js' import { AlertBar } from '../index.js' -storiesOf('Component/Widget/AlertStack', module).add('Default', () => ( +storiesOf('Component/Core/AlertStack', module).add('Default', () => ( First notification - I am at the bottom diff --git a/packages/core/src/Menu/Menu.stories.js b/packages/core/src/Menu/Menu.stories.js index 2a817d6da2..f5a8548a5a 100644 --- a/packages/core/src/Menu/Menu.stories.js +++ b/packages/core/src/Menu/Menu.stories.js @@ -6,7 +6,7 @@ import { Menu } from './Menu.js' const Wrapper = fn =>
{fn()}
-storiesOf('Component/Widget/Menu', module) +storiesOf('Component/Core/Menu', module) .addDecorator(Wrapper) .add('Default', () => ( diff --git a/packages/core/src/Modal/Modal.stories.js b/packages/core/src/Modal/Modal.stories.js index 02cc488ffb..e0ac368bbb 100644 --- a/packages/core/src/Modal/Modal.stories.js +++ b/packages/core/src/Modal/Modal.stories.js @@ -22,7 +22,7 @@ window.onClose = (payload, event) => { const onClose = (...args) => window.onClose(...args) -storiesOf('Component/Widget/Modal', module) +storiesOf('Component/Core/Modal', module) .add('Default: Content', () => ( diff --git a/packages/core/src/StackedTable/StackedTable.stories.js b/packages/core/src/StackedTable/StackedTable.stories.js index 41955e79ea..c382d4c102 100644 --- a/packages/core/src/StackedTable/StackedTable.stories.js +++ b/packages/core/src/StackedTable/StackedTable.stories.js @@ -23,7 +23,7 @@ const CustomCell = props => ( ) -storiesOf('Component/Widget/StackedTable', module) +storiesOf('Component/Core/StackedTable', module) .add('Default', () => ( diff --git a/packages/core/src/Table/Table.stories.js b/packages/core/src/Table/Table.stories.js index bebd2a5d7f..386186ee5b 100644 --- a/packages/core/src/Table/Table.stories.js +++ b/packages/core/src/Table/Table.stories.js @@ -28,7 +28,7 @@ const TableFooterButton = () => ( const TableButton = () => -storiesOf('Component/Widget/Table', module).add('Static layout', () => ( +storiesOf('Component/Core/Table', module).add('Static layout', () => ( @@ -154,7 +154,7 @@ storiesOf('Component/Widget/Table', module).add('Static layout', () => (
)) -storiesOf('Component/Widget/Table', module).add( +storiesOf('Component/Core/Table', module).add( 'Static layout with buttons in dense cells', () => ( diff --git a/packages/widgets/src/HeaderBar/HeaderBar.js b/packages/widgets/src/HeaderBar/HeaderBar.js index d82f377fcc..fa85c7a3b0 100755 --- a/packages/widgets/src/HeaderBar/HeaderBar.js +++ b/packages/widgets/src/HeaderBar/HeaderBar.js @@ -10,8 +10,8 @@ import { Logo } from './Logo.js' import { Title } from './Title.js' import { Notifications } from './Notifications.js' -import './locales' import i18n from '@dhis2/d2-i18n' +import '../locales' const query = { systemInfo: { diff --git a/packages/widgets/src/OrganisationUnitTree.js b/packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.js similarity index 93% rename from packages/widgets/src/OrganisationUnitTree.js rename to packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.js index 7df5ff0f9f..97d8666dfe 100644 --- a/packages/widgets/src/OrganisationUnitTree.js +++ b/packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.js @@ -1,13 +1,13 @@ import React, { useEffect } from 'react' import propTypes from 'prop-types' -import { OrganisationUnitNode } from './OrganisationUnitTree/OrganisationUnitNode' -import { RootError } from './OrganisationUnitTree/RootError' -import { RootLoading } from './OrganisationUnitTree/RootLoading' -import { orgUnitPathPropType } from './OrganisationUnitTree/propTypes' -import { useExpanded } from './OrganisationUnitTree/useExpanded' -import { useForceReload } from './OrganisationUnitTree/useForceReload' -import { useOrgData } from './OrganisationUnitTree/useOrgData' +import { OrganisationUnitNode } from './OrganisationUnitNode.js' +import { RootError } from './RootError.js' +import { RootLoading } from './RootLoading.js' +import { orgUnitPathPropType } from './propTypes.js' +import { useExpanded } from './useExpanded.js' +import { useForceReload } from './useForceReload.js' +import { useOrgData } from './useOrgData.js' /** * @module diff --git a/packages/widgets/src/__demo__/OrganisationUnitTree.stories.js b/packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.stories.js similarity index 99% rename from packages/widgets/src/__demo__/OrganisationUnitTree.stories.js rename to packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.stories.js index 847169012a..a449b3a6d4 100644 --- a/packages/widgets/src/__demo__/OrganisationUnitTree.stories.js +++ b/packages/widgets/src/OrganisationUnitTree/OrganisationUnitTree.stories.js @@ -1,9 +1,10 @@ /* eslint-disable react/no-unescaped-entities,react/prop-types */ import React, { useEffect, useState } from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../index' import { CustomDataProvider, DataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from './OrganisationUnitTree.js' + const log = true const onChange = (...args) => log && console.log('onChange', ...args) const onExpand = (...args) => log && console.log('onExpand', ...args) diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/children_as_child_nodes.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/children_as_child_nodes.stories.e2e.js similarity index 90% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/children_as_child_nodes.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/children_as_child_nodes.stories.e2e.js index 3034110fa7..2996aad2c2 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/children_as_child_nodes.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/children_as_child_nodes.stories.e2e.js @@ -1,7 +1,9 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' + +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' + import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/common.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/common.js similarity index 100% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/common.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/common.js diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/displaying_loading_error.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/displaying_loading_error.stories.e2e.js similarity index 95% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/displaying_loading_error.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/displaying_loading_error.stories.e2e.js index e3db52c438..1354f92155 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/displaying_loading_error.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/displaying_loading_error.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/force_reload.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/force_reload.stories.e2e.js similarity index 96% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/force_reload.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/force_reload.stories.e2e.js index 398943759e..331c3ca6a6 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/force_reload.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/force_reload.stories.e2e.js @@ -1,8 +1,8 @@ import { Button } from '@dhis2/ui-core' import React, { useState } from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/highlight.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/highlight.stories.e2e.js similarity index 91% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/highlight.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/highlight.stories.e2e.js index 8f34456f5f..08d9532a87 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/highlight.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/highlight.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/initially_expanded.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/initially_expanded.stories.e2e.js similarity index 94% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/initially_expanded.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/initially_expanded.stories.e2e.js index b33d3ae583..b4aacedd03 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/initially_expanded.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/initially_expanded.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/loading_state.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/loading_state.stories.e2e.js similarity index 92% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/loading_state.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/loading_state.stories.e2e.js index eee1cd0746..fa8fcc60af 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/loading_state.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/loading_state.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/multi_selection.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/multi_selection.stories.e2e.js similarity index 92% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/multi_selection.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/multi_selection.stories.e2e.js index 3947837414..95dc3e4d33 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/multi_selection.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/multi_selection.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/no_selection.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/no_selection.stories.e2e.js similarity index 95% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/no_selection.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/no_selection.stories.e2e.js index 1e87f6bae7..3bb73f62ce 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/no_selection.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/no_selection.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/path_based_filtering.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/path_based_filtering.stories.e2e.js similarity index 96% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/path_based_filtering.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/path_based_filtering.stories.e2e.js index 6f82dad031..4ef71416bf 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/path_based_filtering.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/path_based_filtering.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/single_selection.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/single_selection.stories.e2e.js similarity index 93% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/single_selection.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/single_selection.stories.e2e.js index 77e93870fc..4ceeca65b1 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/single_selection.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/single_selection.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/__e2e__/OrganisationUnitTree/tree_api.stories.e2e.js b/packages/widgets/src/OrganisationUnitTree/__e2e__/tree_api.stories.e2e.js similarity index 96% rename from packages/widgets/src/__e2e__/OrganisationUnitTree/tree_api.stories.e2e.js rename to packages/widgets/src/OrganisationUnitTree/__e2e__/tree_api.stories.e2e.js index 932e5cd4ab..6c80ac548e 100644 --- a/packages/widgets/src/__e2e__/OrganisationUnitTree/tree_api.stories.e2e.js +++ b/packages/widgets/src/OrganisationUnitTree/__e2e__/tree_api.stories.e2e.js @@ -1,7 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' -import { OrganisationUnitTree } from '../../index' import { CustomDataProvider } from '@dhis2/app-runtime' +import { OrganisationUnitTree } from '../OrganisationUnitTree.js' import { StatefulMultiSelectionWrapper, dataProviderData, diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/computeChildNodes.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/computeChildNodes.test.js index 35501f9e9c..7d1f9e5eca 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/computeChildNodes.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/computeChildNodes.test.js @@ -1,4 +1,4 @@ -import { computeChildNodes } from '../computeChildNodes' +import { computeChildNodes } from '../computeChildNodes.js' describe('computeChildNodes', () => { let node = { path: 'foo/bar' } diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/fromEntries.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/fromEntries.test.js index 8413dba438..f267065f84 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/fromEntries.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/fromEntries.test.js @@ -1,4 +1,4 @@ -import { fromEntries } from '../fromEntries' +import { fromEntries } from '../fromEntries.js' describe('fromEntries', () => { it('should transform an array of entries to an object', () => { diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/hasDescendantSelectedPaths.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/hasDescendantSelectedPaths.test.js index 52ea8a198e..1263666d2b 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/hasDescendantSelectedPaths.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/hasDescendantSelectedPaths.test.js @@ -1,4 +1,4 @@ -import { hasDescendantSelectedPaths } from '../hasDescendantSelectedPaths' +import { hasDescendantSelectedPaths } from '../hasDescendantSelectedPaths.js' describe('hasDescendantSelectedPaths', () => { it('should return true when the path is a parent path of one of the selected paths', () => { diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/useExpanded.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/useExpanded.test.js index 3c50c332a3..23099d3030 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/useExpanded.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/useExpanded.test.js @@ -4,7 +4,7 @@ import { createExpandHandlers, getInitiallyExpandedPaths, } from '../useExpanded/helpers' -import { useExpanded } from '../useExpanded' +import { useExpanded } from '../useExpanded.js' jest.mock('react', () => ({ useState: jest.fn(initialValue => [initialValue, () => null]), diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/useForceReload.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/useForceReload.test.js index 0acea7af61..79c886640a 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/useForceReload.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/useForceReload.test.js @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import { useForceReload } from '../useForceReload' +import { useForceReload } from '../useForceReload.js' jest.mock('react', () => ({ useEffect: jest.fn(callback => callback()), diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/useOpenState.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/useOpenState.test.js index d65e188a19..e09dcee71b 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/useOpenState.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/useOpenState.test.js @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import { useOpenState } from '../useOpenState' +import { useOpenState } from '../useOpenState.js' jest.mock('react', () => ({ useState: jest.fn(), diff --git a/packages/widgets/src/OrganisationUnitTree/__tests__/useOrgData.test.js b/packages/widgets/src/OrganisationUnitTree/__tests__/useOrgData.test.js index 90c3cfb3d0..67653163e8 100644 --- a/packages/widgets/src/OrganisationUnitTree/__tests__/useOrgData.test.js +++ b/packages/widgets/src/OrganisationUnitTree/__tests__/useOrgData.test.js @@ -1,7 +1,10 @@ import { useDataQuery } from '@dhis2/app-runtime' -import { addMissingDisplayNameProps, createQuery } from '../useOrgData/helpers' -import { useOrgData } from '../useOrgData' +import { + addMissingDisplayNameProps, + createQuery, +} from '../useOrgData/helpers.js' +import { useOrgData } from '../useOrgData.js' jest.mock('@dhis2/app-runtime', () => ({ useDataQuery: jest.fn(() => ({ loading: false, error: null, data: {} })), diff --git a/packages/widgets/src/index.js b/packages/widgets/src/index.js index eee5cd6f0f..5cc41c4b4f 100755 --- a/packages/widgets/src/index.js +++ b/packages/widgets/src/index.js @@ -1,5 +1,5 @@ export { HeaderBar } from './HeaderBar/HeaderBar.js' -export { OrganisationUnitTree } from './OrganisationUnitTree' +export { OrganisationUnitTree } from './OrganisationUnitTree/OrganisationUnitTree.js' export { CheckboxField } from './CheckboxField/CheckboxField.js' export { FileInputField } from './FileInputField/FileInputField.js'