qpp-style 9.11.3 → 9.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ const excludedClickOutClasses = [
33
33
 
34
34
  const HeaderMenuItem = ({
35
35
  handleClick,
36
+ isMobileMenuExpanded,
36
37
  columns,
37
38
  menuName,
38
39
  rows,
@@ -76,12 +77,19 @@ const HeaderMenuItem = ({
76
77
  ) {
77
78
  return;
78
79
  }
80
+ setOpenMobileSubMenu('')
79
81
  closeMenus();
80
82
  };
81
83
  document.addEventListener('mousedown', listener);
82
84
  return () => document.removeEventListener('mousedown', listener);
83
85
  }, [menuRef]);
84
86
 
87
+ useEffect(() => {
88
+ if (!isMobileMenuExpanded || !isOpen){
89
+ setOpenMobileSubMenu('')
90
+ }
91
+ }, [isMobileMenuExpanded, isOpen])
92
+
85
93
  return (
86
94
  <li
87
95
  key={`header-item-${menuIdentifier}`}
@@ -162,7 +170,7 @@ const HeaderMenuItem = ({
162
170
  >
163
171
  <Accordion
164
172
  title={c.heading}
165
- isOpen={openMobileSubMenu === c.heading}
173
+ isOpen={isMobileMenuExpanded && openMobileSubMenu === c.heading}
166
174
  >
167
175
  <ul>
168
176
  {c.items.map((item) => {
@@ -212,6 +220,7 @@ HeaderMenuItem.propTypes = {
212
220
  subtitle: PropTypes.string.isRequired,
213
221
  className: PropTypes.string,
214
222
  handleClick: PropTypes.func.isRequired,
223
+ isMobileMenuExpanded: PropTypes.bool.isRequired,
215
224
  };
216
225
  HeaderMenuItem.defaultProps = {
217
226
  menuName: '',
@@ -111,6 +111,7 @@ const HeaderUI = ({
111
111
  handleClick={() => {
112
112
  setIsMobileMenuExpanded(!isMobileMenuExpanded);
113
113
  }}
114
+ isMobileMenuExpanded={isMobileMenuExpanded}
114
115
  key={header.name}
115
116
  {...header}
116
117
  />
@@ -4,11 +4,26 @@ import axios from 'axios';
4
4
  import CloseIcon from '@material-ui/icons/Close';
5
5
 
6
6
  import { TextButton } from '../Button';
7
- import { deleteImpersonatedUser, revertQppHasAuthsCookie } from '../../session/logout';
7
+ import {
8
+ deleteImpersonatedUser,
9
+ revertQppHasAuthsCookie,
10
+ } from '../../session/logout';
11
+
12
+ const getViewType = (viewType) => ({
13
+ username: 'HARP ID',
14
+ npi: 'NPI',
15
+ tin: 'TIN',
16
+ apm_id: 'APM Entity',
17
+ cms_id: 'Registry',
18
+ vg_id: 'Virtual Group',
19
+ }[viewType]);
8
20
 
9
21
  const ImpersonatorBanner = () => {
10
- const { qpp_auth_token: token = null, qpp_impersonated_user: user = null } =
11
- cookie.parse(document.cookie);
22
+ const {
23
+ qpp_auth_token: token = null,
24
+ qpp_impersonated_user: user = null,
25
+ qpp_impersonated_type: viewType = null,
26
+ } = cookie.parse(document.cookie);
12
27
 
13
28
  const className = [
14
29
  'qpp-u-display--flex',
@@ -21,14 +36,17 @@ const ImpersonatorBanner = () => {
21
36
  ].join(' ');
22
37
 
23
38
  const onClick = () => {
24
- const fn = () => {
25
- deleteImpersonatedUser({ qpp_impersonated_user: user });
39
+ const fn = () => {
40
+ deleteImpersonatedUser({
41
+ qpp_impersonated_user: user,
42
+ qpp_impersonated_type: viewType,
43
+ });
26
44
  // Set qpp_has_authorizations cookie back to impersonator's value
27
45
  revertQppHasAuthsCookie();
28
46
  window.location.reload();
29
47
  };
30
48
  return axios
31
- .delete('/api/auth/users/impersonate', {
49
+ .delete('/api/auth/helpdesk/view', {
32
50
  headers: {
33
51
  Accept: 'application/vnd.qpp.cms.gov.v1+json',
34
52
  Authorization: `Bearer ${token}`,
@@ -42,11 +60,10 @@ const ImpersonatorBanner = () => {
42
60
  user && (
43
61
  <div className={className}>
44
62
  <div>
45
- VIEW ONLY | You are currently impersonating HARP user:{' '}
46
- <strong>{user}</strong>
63
+ VIEW ONLY | You are currently viewing {getViewType(viewType)}: <strong>{user}</strong>
47
64
  </div>
48
65
  <TextButton onClick={onClick} className="qpp-u-color--gray-80">
49
- Exit Impersonation Mode
66
+ Exit View Mode
50
67
  <CloseIcon />
51
68
  </TextButton>
52
69
  </div>
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import DSLink from './index';
3
+ import { withKnobs } from '@storybook/addon-knobs';
4
+ import OpenInNewIcon from '@material-ui/icons/OpenInNew';
5
+
6
+ export default {
7
+ title: 'Link',
8
+ component: DSLink,
9
+ decorators: [withKnobs],
10
+ };
11
+
12
+ export const LinkLabel = () => <DSLink href="#">Link Label</DSLink>;
13
+
14
+ export const LinkColorVariants = () => (
15
+ <>
16
+ <div className=" qpp-dark-background qpp-u-padding--16">
17
+ <DSLink href="#" variant="white">
18
+ Link Label
19
+ </DSLink>
20
+ </div>
21
+ <p>
22
+ <DSLink href="#" variant="gray">
23
+ Link Label
24
+ </DSLink>
25
+ </p>
26
+ </>
27
+ );
28
+
29
+ export const inlineLinks = () => (
30
+ <div className="qpp-u-padding--16">
31
+ <p className="qpp-u-width--60">
32
+ Aenean lacinia <DSLink href="#">inline link</DSLink> nulla sed{' '}
33
+ <DSLink href="#">inline link</DSLink>. Integer posuere erat a ante
34
+ venenatis dapibus posuere velit aliquet. Integer posuere erat a ante
35
+ venenatis <DSLink href="#">inline link</DSLink> dapibus posuere velit
36
+ aliquet.
37
+ </p>
38
+ </div>
39
+ );
40
+
41
+ export const inlineLinksDarkBackground = () => (
42
+ <div className="qpp-dark-background qpp-u-padding--16">
43
+ Aenean lacinia{' '}
44
+ <DSLink href="#" variant="white">
45
+ inline link
46
+ </DSLink>{' '}
47
+ nulla sed{' '}
48
+ <DSLink href="#" variant="white">
49
+ inline link
50
+ </DSLink>
51
+ . Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
52
+ Integer posuere erat a ante venenatis{' '}
53
+ <DSLink href="#" variant="white">
54
+ inline link
55
+ </DSLink>{' '}
56
+ dapibus posuere velit aliquet.
57
+ </div>
58
+ );
59
+
60
+ export const linkWithIcon = () => {
61
+ const icon = <OpenInNewIcon classes={{ root: 'qpp-icon-mat' }} />;
62
+ return (
63
+ <div className="qpp-u-padding--16">
64
+ <DSLink href="#">
65
+ Standalone Link With Icon
66
+ {icon}
67
+ </DSLink>{' '}
68
+ <p className=" qpp-u-width--60">
69
+ Aenean lacinia{' '}
70
+ <DSLink href="#">
71
+ inline link
72
+ {icon}
73
+ </DSLink>{' '}
74
+ nulla sed <DSLink href="#">inline link {icon}</DSLink>. Integer posuere
75
+ erat a ante venenatis dapibus posuere velit aliquet. Integer posuere
76
+ erat a ante venenatis <DSLink href="#">inline link {icon}</DSLink>{' '}
77
+ dapibus posuere velit aliquet.
78
+ </p>
79
+ </div>
80
+ );
81
+ };
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const VARIANTS = ['white', 'gray'];
5
+
6
+ const DSLink = ({
7
+ className,
8
+ href,
9
+ download,
10
+ ariaLabel,
11
+ onClick,
12
+ children,
13
+ variant,
14
+ ...rest
15
+ }) => {
16
+ let linkClass = 'qpp-c-link';
17
+ if (VARIANTS.includes(variant)) {
18
+ variant === 'gray'
19
+ ? (linkClass = linkClass.concat(' ', 'qpp-u-color--gray-60'))
20
+ : (linkClass = linkClass.concat(' ', `qpp-u-color--${variant}`));
21
+ }
22
+
23
+ if (className) {
24
+ linkClass = linkClass.concat(' ', className);
25
+ }
26
+
27
+ return (
28
+ <a
29
+ aria-label={ariaLabel}
30
+ className={linkClass || ''}
31
+ href={href}
32
+ download={download}
33
+ onClick={onClick}
34
+ {...rest}
35
+ >
36
+ {children}
37
+ </a>
38
+ );
39
+ };
40
+
41
+ DSLink.propTypes = {
42
+ children: PropTypes.node,
43
+ className: PropTypes.string,
44
+ href: PropTypes.string,
45
+ ariaLabel: PropTypes.string,
46
+ onClick: PropTypes.func,
47
+ download: PropTypes.bool,
48
+ variant: PropTypes.oneOf(VARIANTS),
49
+ };
50
+
51
+ DSLink.defaultProps = {
52
+ children: null,
53
+ className: '',
54
+ href: '',
55
+ ariaLabel: null,
56
+ onClick: () => null,
57
+ download: false,
58
+ variant: null,
59
+ };
60
+
61
+ export default DSLink;
@@ -48,9 +48,10 @@ const getIcon = (url) =>
48
48
  '/user/targeted-review/#/landing': TargetIcon,
49
49
  '/user/test-data': MyTestDataIcon,
50
50
  '/user/self-nomination/#/landing': IndividualReporting,
51
+ '/user/reviewers': DashboardIcon,
51
52
  '/reviewer/exception': HardshipIcon,
52
53
  '/reviewer/targeted-review': TargetIcon,
53
- '/reviewer/self-nomination': IndividualReporting,
54
+ '/self-nomination': IndividualReporting,
54
55
  }[url] || null);
55
56
 
56
57
  const LevelOneContent = ({
@@ -115,7 +116,7 @@ const LevelOneContent = ({
115
116
  '/reviewer/targeted-review': (internalReviewerNames || []).includes(
116
117
  'QPP Targeted Review & Exceptions'
117
118
  ),
118
- '/reviewer/self-nomination': (internalReviewerNames || []).includes(
119
+ '/self-nomination': (internalReviewerNames || []).includes(
119
120
  'QPP Self-Nomination'
120
121
  ),
121
122
 
@@ -43,8 +43,8 @@
43
43
  "label": "Manage Access",
44
44
  "listOfLinks": [
45
45
  {
46
- "url": "/user/impersonate",
47
- "label": "QPP User Impersonation"
46
+ "url": "/user/helpdesk-viewing-tool",
47
+ "label": "Viewing Tool"
48
48
  },
49
49
  {
50
50
  "url": "/user/self-nomination/#/landing",
@@ -78,7 +78,7 @@
78
78
  ],
79
79
  "internalReviewers": [
80
80
  {
81
- "url": "/user/submissions",
81
+ "url": "/user/reviewers",
82
82
  "label": "Dashboard Home"
83
83
  },
84
84
  {
@@ -91,7 +91,7 @@
91
91
  "label": "Targeted Review"
92
92
  },
93
93
  {
94
- "url": "/reviewer/self-nomination",
94
+ "url": "/self-nomination",
95
95
  "label": "Self Nomination"
96
96
  }
97
97
  ],
@@ -17,6 +17,7 @@ import Infotip from './Infotip';
17
17
  import Search from './Search';
18
18
  import TextInput from './TextInput';
19
19
  import Dropdown from './Dropdown';
20
+ import DSLink from './Link';
20
21
  import {
21
22
  MyApplicationsIcon,
22
23
  UserSignInIcon,
@@ -121,4 +122,5 @@ export {
121
122
  TextInput,
122
123
  Dropdown,
123
124
  Tooltip,
125
+ DSLink,
124
126
  };