Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-application] Add subpath exports #384

Merged
merged 47 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4696c2a
added named exports
sdadn Apr 25, 2024
da28cb5
Merge branch 'main' into add-named-exports
sdadn May 2, 2024
c1ee405
updated imports
sdadn May 2, 2024
6136f9d
updated imports
sdadn May 2, 2024
56a248e
updated imports
sdadn May 2, 2024
f40ede7
updated imports
sdadn May 3, 2024
6ded1ba
added subpath exports
sdadn May 6, 2024
802642e
Merge branch 'main' into add-named-exports
sdadn May 6, 2024
a8c0c1e
udpated imports
sdadn May 6, 2024
0c214c9
removed extra file
sdadn May 6, 2024
7b9eefa
removed default export
sdadn May 6, 2024
2fa8614
updated CHANGELOG
sdadn May 6, 2024
48310aa
updated exports
sdadn May 6, 2024
25812e1
updated exports
sdadn May 7, 2024
7878311
added new plugin
sdadn May 7, 2024
e6be74c
temp disabled plugins
sdadn May 7, 2024
e66c59b
updated exports
sdadn May 7, 2024
9c0af6b
updated imports in terra-dev-site
sdadn May 7, 2024
3ffc3a4
updated docs imports
sdadn May 7, 2024
2dfc091
updated example imports
sdadn May 7, 2024
16c8925
updated test imports
sdadn May 7, 2024
6cc4153
updated webpack config
sdadn May 7, 2024
dc0ddb0
updated webpack config
sdadn May 7, 2024
0493993
updated webpack
sdadn May 7, 2024
04f19ed
updated plugin
sdadn May 7, 2024
d5a7afc
updated webpack config
sdadn May 7, 2024
792aec9
linter fixes
sdadn May 7, 2024
31bfe82
updated import
sdadn May 7, 2024
65f59de
working dev site
sdadn May 7, 2024
5f0eb98
working dev site
sdadn May 7, 2024
1cdcd49
linter fixes
sdadn May 7, 2024
6018340
updated prop name
sdadn May 7, 2024
f4e7749
updated comment
sdadn May 7, 2024
fdb9a7c
fixed tests
sdadn May 7, 2024
64566ae
cleaned up code
sdadn May 7, 2024
70365b5
Update CHANGELOG.md
sdadn May 7, 2024
e9553e3
updated CHANGELOG
sdadn May 7, 2024
5fdd017
updated CHANGELOGs
sdadn May 7, 2024
b637e60
Update webpack.config.js
sdadn May 7, 2024
d69cec6
updated utils imports
sdadn May 7, 2024
09ab051
Merge branch 'add-named-exports' of github.com:cerner/terra-applicati…
sdadn May 7, 2024
30681f2
Update CHANGELOG.md
sdadn May 7, 2024
09da0ae
Update CHANGELOG.md
sdadn May 7, 2024
fdd6bcd
linter fixes
sdadn May 7, 2024
92fbba1
fixed test
sdadn May 7, 2024
16e75b7
removed unneeded exports
sdadn May 8, 2024
b75803a
added comment to new plugin
sdadn May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/terra-application-docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Changed
* Set minimum Node version to 14.
* Updated docs to utilize the new terra-application imports.

## 3.1.0 - (June 22, 2022)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable import/no-unresolved */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering, which import is causing the need for this? None of them are standing out to me as different from the other imports in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's both the imports

import { ApplicationIntlContext } from 'terra-application/application-intl';
import { ThemeContext } from 'terra-application/theme';

It's weird because they are working in other packages and webpack doesn't complain. If I change the name to something nonexistent like terra-application/theme-test, webpack gives an error so the imports do seem to be working correctly. So I'm not sure why the linter is failing.


import React from 'react';
import classNames from 'classnames/bind';
import { ApplicationIntlContext } from 'terra-application/lib/application-intl';
import { ThemeContext } from 'terra-application/lib/theme';
import { ApplicationIntlContext } from 'terra-application/application-intl';
import { ThemeContext } from 'terra-application/theme';

import styles from './ThemedComponent.module.scss';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import NavigationPrompt from 'terra-application/lib/navigation-prompt';
import NavigationPrompt from 'terra-application/navigation-prompt';

const ExampleComponent = () => {
const [hasPendingState, setHasPendingState] = useState(false);
Expand Down
4 changes: 4 additions & 0 deletions packages/terra-application/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Breaking Changes:
* Added subpath exports for terra-application submodules. This replaces the old exports that utilize the exact path.
* Removed default `ApplicationBase` import. `ApplicationBase` will now need to be imported from `terra-application/application-base`.

* Changed
* Dropped support for Node 8, 10 & 12. Node 14 is now the minimum required version.
* Locked `intl-locales-supported` to `1.8.11`.
Expand Down
34 changes: 33 additions & 1 deletion packages/terra-application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,39 @@
"engines": {
"node": "14"
},
"main": "lib/application-base/ApplicationBase.js",
"exports": {
"./action-menu": "./lib/action-menu/index.js",
"./application-base": "./lib/application-base/index.js",
"./application-container": "./lib/application-container/index.js",
"./application-error-boundary": "./lib/application-error-boundary/index.js",
"./application-intl": "./lib/application-intl/index.js",
"./application-loading-overlay": "./lib/application-loading-overlay/index.js",
"./application-navigation": "./lib/application-navigation/index.js",
"./application-status-overlay": "./lib/application-status-overlay/index.js",
"./breakpoints": "./lib/breakpoints/index.js",
"./disclosure-manager": "./lib/disclosure-manager/index.js",
"./modal-manager": "./lib/modal-manager/index.js",
"./navigation-prompt": "./lib/navigation-prompt/index.js",
"./notification-banner": "./lib/notification-banner/index.js",
"./slide-panel-manager": "./lib/slide-panel-manager/index.js",
"./terra-dev-site": "./lib/terra-dev-site/index.js",
"./theme": "./lib/theme/index.js",
"./utils": "./lib/utils/index.js",
"./workspace": "./lib/workspace/index.js",
"./utils/event-emitter": "./lib/utils/event-emitter/index.js",
"./utils/logger": "./lib/utils/logger/index.js",
"./package.json": "./package.json",
"./*": "./*",
"./application-base/*": "./lib/application-base/*",
"./application-error-boundary/*": "./lib/application-error-boundary/*",
"./application-loading-overlay/*": "./lib/application-loading-overlay/*",
"./application-navigation/*": "./lib/application-navigation/*",
"./application-status-overlay/*": "./lib/application-status-overlay/*",
"./breakpoints/*": "./lib/breakpoints/*",
"./modal-manager/*": "./lib/modal-manager/*",
"./slide-panel-manager/*": "./lib/slide-panel-manager/*",
"./workspace/*": "./lib/workspace/*"
},
"files": [
"lib",
"src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ApplicationStatusOverlayProvider } from '../application-status-overlay'
import { NavigationPromptCheckpoint } from '../navigation-prompt';
import getBrowserLocale from './private/getBrowserLocale';
import useTestOverrides from './private/useTestOverrides';
import Logger from '../utils/logger';
import { Logger } from '../utils';

import './private/initializeInert';
import './baseStyles';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './Base.scss';
import Logger from '../utils/logger';
import { Logger } from '../utils';

// Checks to run when not in production
if (process.env.NODE_ENV !== 'production') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hasIntlData from 'intl-locales-supported';
import loadLocaleData from './loadLocaleData';
import logger from '../../utils/logger';
import { Logger } from '../../utils';

const supportedIntlConstructors = (polyfill) => {
/**
Expand Down Expand Up @@ -52,7 +52,7 @@ const loadIntl = (locale, polyfill) => {
if (!hasIntlData([locale], supportedIntlConstructors(polyfill))) {
return loadLocaleData(locale, polyfill).catch((error) => {
if (fallbackLocale) {
logger.warn(`${error.message} Using ${fallbackLocale} data as the fallback locale data.`);
Logger.warn(`${error.message} Using ${fallbackLocale} data as the fallback locale data.`);
if (!hasIntlData([fallbackLocale], supportedIntlConstructors(polyfill))) {
return loadLocaleData(fallbackLocale, polyfill);
}
Expand All @@ -62,7 +62,7 @@ const loadIntl = (locale, polyfill) => {

return Promise.resolve();
}).catch((error) => {
logger.warn(`${error.message} Using en data as the fallback locale data.`);
Logger.warn(`${error.message} Using en data as the fallback locale data.`);

if (!hasIntlData(['en'], supportedIntlConstructors(polyfill))) {
return loadLocaleData('en', polyfill);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-unresolved */
import logger from '../../utils/logger';
import { Logger } from '../../utils';

const loadTranslationsFile = (locale) => {
switch (locale) {
Expand Down Expand Up @@ -44,15 +44,15 @@ const loadTranslations = (locale) => {
const fallbackLocale = locale.split('-').length > 1 ? locale.split('-')[0] : false;

return loadTranslationsFile(locale).catch((error) => {
logger.warn(`${error.message} Using ${fallbackLocale} data as the fallback locale.`);
Logger.warn(`${error.message} Using ${fallbackLocale} data as the fallback locale.`);

if (fallbackLocale) {
return loadTranslationsFile(fallbackLocale);
}

return Promise.reject(error);
}).catch((error) => {
logger.warn(`${error.message} Using en as the fallback locale.`);
Logger.warn(`${error.message} Using en as the fallback locale.`);

return loadTranslationsFile('en');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import StatusView from 'terra-status-view';
import { injectIntl } from 'react-intl';
import logger from '../utils/logger';
import { Logger } from '../utils';

const propTypes = {
/**
Expand Down Expand Up @@ -79,7 +79,7 @@ class ApplicationErrorBoundary extends React.Component {
* the ApplicationErrorBoundary to update again to ensure that the StatusView remains presented until the
* next update occurs.
*/
logger.error(error);
Logger.error(error);
this.errorRef.current = error;
this.setState({ error: undefined });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropsTable from 'terra-application/lib/application-base/ApplicationBase?dev-site-props-table';
import PropsTable from 'terra-application/application-base/ApplicationBase?dev-site-props-table';

# ApplicationBase

Expand All @@ -9,7 +9,7 @@ The ApplicationBase component is the entrypoint into the Terra application frame
## Usage

```jsx
import ApplicationBase from 'terra-application/lib/application-base';
import ApplicationBase from 'terra-application/application-base';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropsTable from 'terra-application/lib/application-error-boundary/ApplicationErrorBoundary?dev-site-props-table';
import PropsTable from 'terra-application/application-error-boundary/ApplicationErrorBoundary?dev-site-props-table';
import ApplicationErrorBoundaryExample from './example/ApplicationErrorBoundaryExample?dev-site-example';

# ApplicationErrorBoundary
Expand All @@ -8,7 +8,7 @@ The ApplicationErrorBoundary catches exceptions thrown during its children's ren
## Usage

```jsx
import ApplicationErrorBoundary from 'terra-application/lib/application-error-boundary';
import ApplicationErrorBoundary from 'terra-application/application-error-boundary';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ present a loading overlay.
## Usage

```jsx
import ApplicationLoadingOverlay from 'terra-application/lib/application-loading-overlay';
import ApplicationLoadingOverlay from 'terra-application/application-loading-overlay';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ApplicationLoadingOverlayProviderProps from 'terra-application/lib/application-loading-overlay/ApplicationLoadingOverlayProvider?dev-site-props-table';
import ApplicationLoadingOverlayProviderProps from 'terra-application/application-loading-overlay/ApplicationLoadingOverlayProvider?dev-site-props-table';

# ApplicationLoadingOverlayProvider

Expand All @@ -18,7 +18,7 @@ with the darkest specified style being honored.
## Usage

```jsx
import { ApplicationLoadingOverlayProvider } from 'terra-application/lib/application-loading-overlay';
import { ApplicationLoadingOverlayProvider } from 'terra-application/application-loading-overlay';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropsTable from 'terra-application/lib/application-navigation/ApplicationNavigation?dev-site-props-table';
import ApplicationNavigationWorkspaceProps from 'terra-application/lib/application-navigation/private/workspace-layout/ApplicationNavigationWorkspace?dev-site-props-table';
import PropsTable from 'terra-application/application-navigation/ApplicationNavigation?dev-site-props-table';
import ApplicationNavigationWorkspaceProps from 'terra-application/application-navigation/private/workspace-layout/ApplicationNavigationWorkspace?dev-site-props-table';

import ApplicationNavigationExample from './example/ApplicationNavigationExample?dev-site-example';
import ApplicationNavigationWorkspaceExample from './example/ApplicationNavigationWorkspaceExample?dev-site-example';
Expand All @@ -13,7 +13,7 @@ The ApplicationNavigation component provides a styled layout and controls used f
## Usage

```jsx
import ApplicationNavigation from 'terra-application/lib/application-navigation';
import ApplicationNavigation from 'terra-application/application-navigation';
```

## Required Contexts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ present a staus view.
## Usage

```jsx
import ApplicationStatusOverlay from 'terra-application/lib/application-status-overlay';
import ApplicationStatusOverlay from 'terra-application/application-status-overlay';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ApplicationStatusOverlayProviderProps from 'terra-application/lib/application-status-overlay/ApplicationStatusOverlayProvider?dev-site-props-table';
import ApplicationStatusOverlayProviderProps from 'terra-application/application-status-overlay/ApplicationStatusOverlayProvider?dev-site-props-table';

# ApplicationStatusOverlayProvider

Expand All @@ -15,7 +15,7 @@ are rendered at the same time, with the last rendered ApplicationStatusOverlay g
## Usage

```jsx
import { ApplicationStatusOverlayProvider } from 'terra-application/lib/application-status-overlay';
import { ApplicationStatusOverlayProvider } from 'terra-application/application-status-overlay';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropsTable from 'terra-application/lib/modal-manager/ModalManager?dev-site-props-table';
import PropsTable from 'terra-application/modal-manager/ModalManager?dev-site-props-table';

# ModalManager

Expand All @@ -8,7 +8,7 @@ The ModalManager exposes its children to modal presentation APIs through the
## Usage

```jsx
import ModalManager from 'terra-application/lib/modal-manager';
import ModalManager from 'terra-application/modal-manager';
```

## Props
Expand Down Expand Up @@ -145,8 +145,8 @@ For application content that needs more specific dimensional control of modal si
```jsx
import React from 'react';
import Button from 'terra-button';
import ModalManager, { disclosureType } from 'terra-application/lib/modal-manager';
import { withDisclosureManager, DisclosureManagerContext, DisclosureManagerHeaderAdapter } from 'terra-application/lib/disclosure-manager';
import ModalManager, { disclosureType } from 'terra-application/modal-manager';
import { withDisclosureManager, DisclosureManagerContext, DisclosureManagerHeaderAdapter } from 'terra-application/disclosure-manager';
import CollapsibleMenuView from 'terra-collapsible-menu-view';

const ModalComponentB = () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ of pending actions or unsaved changes to the framework.
## Usage

```jsx
import NavigationPrompt from 'terra-application/lib/navigation-prompt';
import NavigationPrompt from 'terra-application/navigation-prompt';
```

## Props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ influence its navigational workflows as necessary.
## Usage

```jsx
import { NavigationPromptCheckpoint } from 'terra-application/lib/navigation-prompt';
import { NavigationPromptCheckpoint } from 'terra-application/navigation-prompt';
```

## Props
Expand Down Expand Up @@ -63,7 +63,7 @@ to match the prompt messaging provided by the components within `terra-applicati
```jsx
import React, { useContext, useRef } from 'react';
import { useIntl } from 'react-intl';
import { NavigationPromptCheckpoint, getUnsavedChangesPromptOptions } from 'terra-application/lib/navigation-prompt';
import { NavigationPromptCheckpoint, getUnsavedChangesPromptOptions } from 'terra-application/navigation-prompt';

const ExampleComponent = () => {
const checkpointRef = useRef();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropsTable from 'terra-application/lib/slide-panel-manager/SlidePanelManager?dev-site-props-table';
import PropsTable from 'terra-application/slide-panel-manager/SlidePanelManager?dev-site-props-table';

<Badge />

Expand All @@ -10,7 +10,7 @@ The SlidePanelManager exposes its children to panel presentation APIs through th
## Usage

```jsx
import SlidePanelManager from 'terra-application/lib/slide-panel-manager';
import SlidePanelManager from 'terra-application/slide-panel-manager';
```

## Props
Expand Down Expand Up @@ -89,8 +89,8 @@ and each component in the disclosure stack will be decorated with the same acces
```jsx
import React from 'react';
import Button from 'terra-button';
import SlidePanelManager, { disclosureType } from 'terra-application/lib/slide-panel-manager';
import { withDisclosureManager, DisclosureManagerContext, DisclosureManagerHeaderAdapter } from 'terra-application/lib/disclosure-manager';
import SlidePanelManager, { disclosureType } from 'terra-application/slide-panel-manager';
import { withDisclosureManager, DisclosureManagerContext, DisclosureManagerHeaderAdapter } from 'terra-application/disclosure-manager';
import CollapsibleMenuView from 'terra-collapsible-menu-view';

const PanelComponentB = () => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WorkspaceContentProps from 'terra-application/lib/workspace/WorkspaceContent?dev-site-props-table';
import WorkspaceContentStatusOverlayProps from 'terra-application/lib/workspace/overlays/WorkspaceContentStatusOverlay?dev-site-props-table';
import WorkspaceContentStatusOverlayButtonProps from 'terra-application/lib/workspace/shared/StatusLayoutButton?dev-site-props-table';
import WorkspaceContentActivityOverlayProps from 'terra-application/lib/workspace/overlays/WorkspaceContentActivityOverlay?dev-site-props-table';
import WorkspaceContentProps from 'terra-application/workspace/WorkspaceContent?dev-site-props-table';
import WorkspaceContentStatusOverlayProps from 'terra-application/workspace/overlays/WorkspaceContentStatusOverlay?dev-site-props-table';
import WorkspaceContentStatusOverlayButtonProps from 'terra-application/workspace/shared/StatusLayoutButton?dev-site-props-table';
import WorkspaceContentActivityOverlayProps from 'terra-application/workspace/overlays/WorkspaceContentActivityOverlay?dev-site-props-table';

import { Notice } from '@cerner/terra-docs';

Expand All @@ -12,7 +12,7 @@ The WorkspaceContent component is essential for integrating into the workspace.
## Usage

```jsx
import { WorkspaceContent } from 'terra-application/lib/workspace';
import { WorkspaceContent } from 'terra-application/workspace';
```

Please see the [How To Create Workspace Content](/application/terra-application/how-to/create-workspace-content) guide for more usage information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useContext } from 'react';
import { useIntl } from 'react-intl';
import { ThemeContext } from 'terra-application/lib/theme';
import { ActiveBreakpointContext } from 'terra-application/lib/breakpoints';
import ApplicationLoadingOverlay from 'terra-application/lib/application-loading-overlay';
import ApplicationBase from 'terra-application/lib/application-base';
import NavigationPrompt from 'terra-application/lib/navigation-prompt';
import { ThemeContext } from 'terra-application/theme';
import { ActiveBreakpointContext } from 'terra-application/breakpoints';
import ApplicationLoadingOverlay from 'terra-application/application-loading-overlay';
import ApplicationBase from 'terra-application/application-base';
import NavigationPrompt from 'terra-application/navigation-prompt';

const ApplicationContentExample = () => {
const [isLoading, setIsLoading] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames/bind';

import ApplicationErrorBoundary from 'terra-application/lib/application-error-boundary/ApplicationErrorBoundary';
import ApplicationErrorBoundary from 'terra-application/application-error-boundary';
import styles from './ApplicationErrorBoundaryExample.module.scss';

const cx = classNames.bind(styles);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import classNames from 'classnames/bind';
import ApplicationLoadingOverlay from 'terra-application/lib/application-loading-overlay/ApplicationLoadingOverlay';
import ApplicationLoadingOverlayProvider from 'terra-application/lib/application-loading-overlay/ApplicationLoadingOverlayProvider';
import ApplicationLoadingOverlay from 'terra-application/application-loading-overlay/ApplicationLoadingOverlay';
import ApplicationLoadingOverlayProvider from 'terra-application/application-loading-overlay/ApplicationLoadingOverlayProvider';

import styles from './ApplicationErrorBoundaryExample.module.scss';

Expand Down
Loading
Loading