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

Commit

Permalink
[terra-application] Add subpath exports (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdadn authored May 8, 2024
1 parent 15c824f commit 1f52c9d
Show file tree
Hide file tree
Showing 94 changed files with 393 additions and 241 deletions.
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 */

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

0 comments on commit 1f52c9d

Please sign in to comment.