From d84286be8272d5c87c2aa2fc625bfa7453d43620 Mon Sep 17 00:00:00 2001 From: Ray Messina Date: Thu, 28 Sep 2023 23:13:54 -0500 Subject: [PATCH 1/3] removal of components --- .../write-react-owners-to-csv.js.html | 3 +- .../src/write-react-owners-to-csv.js | 3 +- .../LoadingIndicator/LoadingIndicator.jsx | 81 ------------------- .../LoadingIndicator/LoadingIndicator.mdx | 29 ------- .../LoadingIndicator.unit.spec.jsx | 68 ---------------- 5 files changed, 2 insertions(+), 182 deletions(-) delete mode 100644 packages/react-components/src/components/LoadingIndicator/LoadingIndicator.jsx delete mode 100644 packages/react-components/src/components/LoadingIndicator/LoadingIndicator.mdx delete mode 100644 packages/react-components/src/components/LoadingIndicator/LoadingIndicator.unit.spec.jsx diff --git a/packages/design-system-dashboard-cli/coverage/lcov-report/write-react-owners-to-csv.js.html b/packages/design-system-dashboard-cli/coverage/lcov-report/write-react-owners-to-csv.js.html index 59ad019fd..7672acd43 100644 --- a/packages/design-system-dashboard-cli/coverage/lcov-report/write-react-owners-to-csv.js.html +++ b/packages/design-system-dashboard-cli/coverage/lcov-report/write-react-owners-to-csv.js.html @@ -334,11 +334,10 @@

All files write-react-owners-to-csv.js

'Checkbox', 'ExpandingGroup', 'IconSearch', - 'LoadingIndicator', 'TextInput', ];   -const hasMigrationScript = ['AlertBox', 'LoadingIndicator']; +const hasMigrationScript = ['AlertBox'];   function cleanPath(pathToClean) { const cwd = process.cwd(); diff --git a/packages/design-system-dashboard-cli/src/write-react-owners-to-csv.js b/packages/design-system-dashboard-cli/src/write-react-owners-to-csv.js index 7c83ef96e..406d99145 100644 --- a/packages/design-system-dashboard-cli/src/write-react-owners-to-csv.js +++ b/packages/design-system-dashboard-cli/src/write-react-owners-to-csv.js @@ -10,12 +10,11 @@ const componentsToKeep = [ 'Checkbox', 'ExpandingGroup', 'IconSearch', - 'LoadingIndicator', 'Modal', 'TextInput', ]; -const hasMigrationScript = ['AlertBox', 'LoadingIndicator']; +const hasMigrationScript = ['AlertBox']; function cleanPath(pathToClean) { const cwd = process.cwd(); diff --git a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.jsx b/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.jsx deleted file mode 100644 index eac66a0d2..000000000 --- a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.jsx +++ /dev/null @@ -1,81 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import dispatchAnalyticsEvent from '../../helpers/analytics'; - -/** - * **Note:** This component is deprecated in favor of the `` Web Component - */ -export default class LoadingIndicator extends React.Component { - constructor(props) { - super(props); - - // This state variable is used as a constant to get a diff - // between initial mount and unmount - this.state = { loadingStartTime: Date.now() }; - } - - componentDidMount() { - if (this.props.setFocus && this.spinnerDiv) { - this.spinnerDiv.focus(); - } - } - - componentWillUnmount() { - if (this.props.enableAnalytics) { - dispatchAnalyticsEvent({ - componentName: 'LoadingIndicator', - action: 'displayed', - details: { - displayTime: Date.now() - this.state.loadingStartTime, - message: this.props.message, - }, - }); - } - } - - render() { - const { message } = this.props; - const { label } = this.props; - - return ( -
-
{ - this.spinnerDiv = div; - }} - className="loading-indicator" - role="progressbar" - aria-label={label} - aria-valuetext={message} - tabIndex="0" - /> - {message} -
- ); - } -} - -LoadingIndicator.propTypes = { - /** - * The message visible on screen when loading - */ - message: PropTypes.string.isRequired, - /** - * Set to true if the loading indicator should capture focus - */ - setFocus: PropTypes.bool, - /** - * An aXe label - */ - label: PropTypes.string, - /** - * Analytics tracking function(s) will be called. Form components - * are disabled by default due to PII/PHI concerns. - */ - enableAnalytics: PropTypes.bool, -}; - -LoadingIndicator.defaultProps = { - setFocus: false, - label: 'Loading', -}; diff --git a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.mdx b/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.mdx deleted file mode 100644 index 742ec1d6e..000000000 --- a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: LoadingIndicator -name: LoadingIndicator -tags: indicator, component ---- - -import LoadingIndicator from './LoadingIndicator' - -### Code: - -```javascript -import LoadingIndicator from '@department-of-veterans-affairs/component-library/LoadingIndicator' - -
- -
-``` - -### Rendered Component - -
- -
diff --git a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.unit.spec.jsx b/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.unit.spec.jsx deleted file mode 100644 index 242b53973..000000000 --- a/packages/react-components/src/components/LoadingIndicator/LoadingIndicator.unit.spec.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import { expect } from 'chai'; -import React from 'react'; -import sinon from 'sinon'; -import { - axeCheck, - mountToDiv, - testAnalytics, -} from '../../helpers/test-helpers'; - -import LoadingIndicator from './LoadingIndicator.jsx'; - -describe('', () => { - it('should not focus if setFocus is not set', () => { - const component = ( - - ); - const mountedComponent = mountToDiv(component, 'loadingContainer'); - - expect(document.activeElement.classList.contains('loading-indicator')).to.be - .false; - mountedComponent.unmount(); - }); - - it('should focus if setFocus is set', () => { - const component = ( - - ); - const mountedComponent = mountToDiv(component, 'loadingContainer'); - - expect(document.activeElement.classList.contains('loading-indicator')).to.be - .true; - mountedComponent.unmount(); - }); - - it('should pass aXe check', () => - axeCheck()); - - describe('analytics event', function () { - it('should be triggered when component is unmounted', () => { - const component = ( - - ); - - const mountedComponent = mountToDiv(component, 'loadingContainer'); - const spy = testAnalytics(mountedComponent, () => { - mountedComponent.unmount(); - }); - - expect( - spy.calledWith( - sinon.match.has('detail', { - componentName: 'LoadingIndicator', - action: 'displayed', - details: { - displayTime: sinon.match.number, - message: 'Loading', - }, - version: sinon.match.string, - }), - ), - ).to.be.true; - }); - }); -}); From 09844fc933afe848e49690bfb34f6a3e40f8592d Mon Sep 17 00:00:00 2001 From: Ray Messina Date: Thu, 5 Oct 2023 14:56:35 -0500 Subject: [PATCH 2/3] removes React LoadingIndicator from index files --- packages/react-components/index.js | 2 -- packages/react-components/src/index.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/react-components/index.js b/packages/react-components/index.js index 163cd4a3c..641a0cf56 100644 --- a/packages/react-components/index.js +++ b/packages/react-components/index.js @@ -4,7 +4,6 @@ import Checkbox from './Checkbox'; import ExpandingGroup from './ExpandingGroup'; import IconBase from './IconBase'; import IconSearch from './IconSearch'; -import LoadingIndicator from './LoadingIndicator'; import MaintenanceBanner from './MaintenanceBanner'; import Modal from './Modal'; import TextInput from './TextInput'; @@ -19,7 +18,6 @@ export { ExpandingGroup, IconBase, IconSearch, - LoadingIndicator, MaintenanceBanner, Modal, TextInput, diff --git a/packages/react-components/src/index.js b/packages/react-components/src/index.js index 4ebad73cf..1f0de2182 100644 --- a/packages/react-components/src/index.js +++ b/packages/react-components/src/index.js @@ -4,7 +4,6 @@ import Checkbox from './components/Checkbox/Checkbox'; import ExpandingGroup from './components/ExpandingGroup/ExpandingGroup'; import IconBase from './components/IconBase/IconBase'; import IconSearch from './components/IconSearch/IconSearch'; -import LoadingIndicator from './components/LoadingIndicator/LoadingIndicator'; import MaintenanceBanner from './components/MaintenanceBanner/MaintenanceBanner'; import Modal from './components/Modal/Modal'; import TextInput from './components/TextInput/TextInput'; @@ -17,7 +16,6 @@ export { ExpandingGroup, IconBase, IconSearch, - LoadingIndicator, MaintenanceBanner, Modal, TextInput, From f2840940c67aa5ccbb95f94faebd4e52e1583162 Mon Sep 17 00:00:00 2001 From: Ray Messina Date: Wed, 11 Oct 2023 22:34:36 -0500 Subject: [PATCH 3/3] updates react-component version number to 21.0.0 --- packages/react-components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-components/package.json b/packages/react-components/package.json index ce1420947..672391016 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -1,6 +1,6 @@ { "name": "@department-of-veterans-affairs/react-components", - "version": "20.0.0", + "version": "21.0.0", "description": "VA.gov component library in React", "keywords": [ "react",