qpp-style 9.6.10 → 9.7.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.
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import Dropdown from './index';
3
+ import { withKnobs } from '@storybook/addon-knobs';
4
+
5
+ export default {
6
+ title: 'Dropdown',
7
+ component: Dropdown,
8
+ decorators: [withKnobs],
9
+ };
10
+
11
+ export const DropdownField = () => (
12
+ <Dropdown
13
+ id="id-example"
14
+ value="value-example"
15
+ name="name-example"
16
+ ariaLabel="arial label example"
17
+ options={[
18
+ { name: 'Name 1', value: 'Value 1' },
19
+ { name: 'Name 2', value: 'Value 2' },
20
+ { name: 'Name 3', value: 'Value 3' },
21
+ ]}
22
+ />
23
+ );
24
+
25
+ export const DropdownFieldAutoWidth = () => (
26
+ <Dropdown
27
+ id="id-example"
28
+ value="value-example"
29
+ name="name-example"
30
+ ariaLabel="arial label example"
31
+ className="qpp-u-width--auto"
32
+ options={[
33
+ { name: 'Name 1', value: 'Value 1' },
34
+ { name: 'Name 2', value: 'Value 2' },
35
+ { name: 'Name 3', value: 'Value 3' },
36
+ ]}
37
+ />
38
+ );
39
+
40
+ export const DisabledDropdown = () => (
41
+ <Dropdown
42
+ disabled
43
+ id="id-example"
44
+ value="value-example"
45
+ name="name-example"
46
+ ariaLabel="arial label example"
47
+ options={[
48
+ { name: 'Name 1', value: 'Value 1' },
49
+ { name: 'Name 2', value: 'Value 2' },
50
+ { name: 'Name 3', value: 'Value 3' },
51
+ ]}
52
+ />
53
+ );
54
+
55
+ export const DropdownBigVariant = () => (
56
+ <Dropdown
57
+ id="id-example"
58
+ value="value-example"
59
+ name="name-example"
60
+ ariaLabel="arial label example"
61
+ size="big"
62
+ options={[
63
+ { name: 'Name 1', value: 'Value 1' },
64
+ { name: 'Name 2', value: 'Value 2' },
65
+ { name: 'Name 3', value: 'Value 3' },
66
+ ]}
67
+ />
68
+ );
69
+
70
+ export const DropdownWithDisabledOption = () => (
71
+ <Dropdown
72
+ id="id-example"
73
+ value="value-example"
74
+ name="name-example"
75
+ ariaLabel="arial label example"
76
+ options={[
77
+ { disabled: true, name: 'Select Category', value: 'default' },
78
+ { name: 'Name 1', value: 'Value 1' },
79
+ { name: 'Name 2', value: 'Value 2' },
80
+ ]}
81
+ />
82
+ );
83
+
84
+ export const DropdownUsingChildrenProp = () => (
85
+ <Dropdown
86
+ id="id-example"
87
+ value="value-example"
88
+ name="name-example"
89
+ ariaLabel="arial label example"
90
+ >
91
+ <option value="Value 1">Name 1</option>
92
+ <option value="Value 2">Name 2</option>
93
+ </Dropdown>
94
+ );
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const Dropdown = ({
5
+ className,
6
+ id,
7
+ ariaLabelledBy,
8
+ ariaLabel,
9
+ onChange,
10
+ dataTestId,
11
+ name,
12
+ dataType,
13
+ disabled,
14
+ size,
15
+ options,
16
+ children,
17
+ parentElement,
18
+ ...rest
19
+ }) => {
20
+ const dropdownClass = [
21
+ 'qpp-c-dropdown',
22
+ size === 'big' && 'qpp-c-dropdown--big',
23
+ className,
24
+ ]
25
+ .filter(Boolean)
26
+ .join(' ');
27
+
28
+ return (
29
+ <select
30
+ id={id}
31
+ aria-labelledby={ariaLabelledBy}
32
+ aria-label={ariaLabel}
33
+ className={dropdownClass || ''}
34
+ onChange={onChange}
35
+ data-testid={dataTestId}
36
+ name={name}
37
+ disabled={disabled}
38
+ data-type={dataType}
39
+ {...rest}
40
+ >
41
+ {children}
42
+ {options.map(({ disabled, name, value }) => (
43
+ <option disabled={disabled} key={value} value={value}>
44
+ {name}
45
+ </option>
46
+ ))}
47
+ </select>
48
+ );
49
+ };
50
+
51
+ Dropdown.propTypes = {
52
+ children: PropTypes.node,
53
+ className: PropTypes.string,
54
+ id: PropTypes.string,
55
+ ariaLabelledBy: PropTypes.string,
56
+ ariaLabel: PropTypes.string,
57
+ onChange: PropTypes.func,
58
+ value: PropTypes.string,
59
+ defaultValue: PropTypes.string,
60
+ dataTestId: PropTypes.string,
61
+ name: PropTypes.string,
62
+ dataType: PropTypes.string,
63
+ disabled: PropTypes.bool,
64
+ size: PropTypes.oneOf(['big']),
65
+ options: PropTypes.array,
66
+ parentElement: PropTypes.string,
67
+ };
68
+
69
+ Dropdown.defaultProps = {
70
+ children: false,
71
+ className: 'qpp-u-width--100',
72
+ id: null,
73
+ ariaLabelledBy: null,
74
+ ariaLabel: null,
75
+ onChange: () => null,
76
+ dataTestId: null,
77
+ name: null,
78
+ dataType: null,
79
+ disabled: false,
80
+ size: null,
81
+ options: [],
82
+ parentElement: 'span',
83
+ };
84
+
85
+ export default Dropdown;
@@ -47,6 +47,7 @@ const LevelTwoContent = ({
47
47
  isApmPaymentDetailsPage,
48
48
  useTooltips,
49
49
  cpcPlusId,
50
+ pcfId,
50
51
  } = {},
51
52
  }) => {
52
53
  const linkClass = isExpanded ? 'link-inline' : 'link-collapsed';
@@ -173,6 +174,7 @@ const LevelTwoContent = ({
173
174
  {...(!apmEntityId ? {} : { apmEntityId })}
174
175
  {...(!vgId ? {} : { vgId })}
175
176
  {...(!cpcPlusId ? {} : { cpcPlusId })}
177
+ {...(!pcfId ? {} : { pcfId })}
176
178
  />
177
179
  <hr />
178
180
  </AnimationGroup>
@@ -7,10 +7,13 @@ const PracticeDetails = ({
7
7
  apmEntityId,
8
8
  vgId,
9
9
  cpcPlusId,
10
+ pcfId
10
11
  }) => {
11
12
  function renderId() {
12
13
  if (cpcPlusId) {
13
14
  return <p className="practice-tin">CPC+ ID: {cpcPlusId}</p>;
15
+ } else if (pcfId) {
16
+ return <p className="practice-tin">PCF ID: {pcfId}</p>;
14
17
  } else if (apmEntityId) {
15
18
  return <p className="practice-tin">APM Entity ID: {apmEntityId}</p>;
16
19
  } else if (vgId) {
@@ -36,6 +39,7 @@ PracticeDetails.propTypes = {
36
39
  apmEntityId: PropTypes.string,
37
40
  vgId: PropTypes.string,
38
41
  cpcPlusId: PropTypes.string,
42
+ pcfId: PropTypes.string,
39
43
  };
40
44
 
41
45
  export default PracticeDetails;
@@ -20,6 +20,7 @@ const NavLinkDrawer = ({
20
20
  sidebarExpand,
21
21
  staticDrawer,
22
22
  url,
23
+ isHighlighted
23
24
  }) => {
24
25
  const [isOpen, setIsOpen] = useState(openByDefault);
25
26
 
@@ -60,6 +61,22 @@ const NavLinkDrawer = ({
60
61
  );
61
62
  const expandedClass = currentPage ? 'expanded' : '';
62
63
 
64
+ const renderLeftIcon = (leftIcon) => {
65
+ if (leftIcon) {
66
+ return (<svg
67
+ className={`left-icon${isAlwaysOpen ? ' always-open' : ''}`}
68
+ aria-hidden="true"
69
+ focusable="false"
70
+ >
71
+ {leftIcon}
72
+ </svg>)
73
+ }
74
+ }
75
+
76
+ const highlightTitle = (isHighlighted) => {
77
+ return isHighlighted ? 'highlight' : '';
78
+ }
79
+
63
80
  useEffect(() => {
64
81
  if (disabled) {
65
82
  setIsOpen(false);
@@ -130,18 +147,12 @@ const NavLinkDrawer = ({
130
147
  {...(isAlwaysOpen || disabled
131
148
  ? { disabled: isAlwaysOpen || disabled }
132
149
  : {})}
133
- className={`${className} ${expandedClass} ${
150
+ className={`${className} ${expandedClass} ${highlightTitle(isHighlighted)} ${
134
151
  currentPage ? 'currentPage' : ''
135
152
  }`}
136
153
  >
137
154
  <div className={isExpanded ? 'link-body' : 'link-body collapsed'}>
138
- <svg
139
- className={`left-icon${isAlwaysOpen ? ' always-open' : ''}`}
140
- aria-hidden="true"
141
- focusable="false"
142
- >
143
- {leftIcon}
144
- </svg>
155
+ {renderLeftIcon(leftIcon)}
145
156
  <AnimationGroup display={isExpanded}>
146
157
  <span>{label}</span>
147
158
  </AnimationGroup>
@@ -188,6 +199,7 @@ NavLinkDrawer.propTypes = {
188
199
  staticDrawer: PropTypes.bool,
189
200
  items: PropTypes.object,
190
201
  url: PropTypes.string,
202
+ isHighlighted: PropTypes.bool
191
203
  };
192
204
 
193
205
  export default NavLinkDrawer;
@@ -237,6 +237,35 @@ const demoItems = [
237
237
  {
238
238
  type: 'divider',
239
239
  },
240
+ {
241
+ type: 'linkDrawer',
242
+ isAlwaysOpen: false,
243
+ label: 'Highlighted Link Drawer No Icon',
244
+ isHighlighted: true,
245
+ items: [
246
+ {
247
+ type: 'link',
248
+ className: 'foo',
249
+ label: 'Link 1',
250
+ url: 'https://qpp.cms.gov',
251
+ },
252
+ {
253
+ type: 'link',
254
+ className: 'bar',
255
+ label: 'Link 2',
256
+ url: 'https://qpp.cms.gov',
257
+ },
258
+ {
259
+ type: 'link',
260
+ className: 'baz',
261
+ label: 'Link 3',
262
+ url: 'https://qpp.cms.gov',
263
+ },
264
+ ],
265
+ },
266
+ {
267
+ type: 'divider',
268
+ },
240
269
  {
241
270
  type: 'custom',
242
271
  content: `
@@ -318,6 +347,7 @@ export const LevelTwoUsage = () => (
318
347
  practiceTin: text('practiceTin', 'PRACTICE_TIN', CONFIG_GROUP_ID),
319
348
  apmEntityId: text('apmEntityId', 'APM_ENTITY_ID', CONFIG_GROUP_ID),
320
349
  cpcPlusId: text('cpcPlusId', 'CPC_PLUS_ID', CONFIG_GROUP_ID),
350
+ pcfId: text('pcfId', 'PCF_ID', CONFIG_GROUP_ID),
321
351
  vgId: text('vgId', 'VG ID', CONFIG_GROUP_ID),
322
352
  roleAbbr: text('roleAbbr', 'ROLE-ABBR', CONFIG_GROUP_ID),
323
353
  performanceYear: text(
@@ -145,6 +145,7 @@ const SideNavUI = ({
145
145
  : { apmEntityId: item.apmEntityId })}
146
146
  {...(!item.vgId ? {} : { vgId: item.vgId })}
147
147
  {...(!item.cpcPlusId ? {} : { cpcPlusId: item.cpcPlusId })}
148
+ {...(!item.pcfId ? {} : { pcfId: item.pcfId })}
148
149
  />
149
150
  </AnimationGroup>
150
151
  ),
@@ -171,6 +172,7 @@ const SideNavUI = ({
171
172
  listOfLinks={item.items}
172
173
  url={item.url}
173
174
  sidebarExpand={expand}
175
+ isHighlighted={item.isHighlighted}
174
176
  />
175
177
  ),
176
178
  custom: (
@@ -16,6 +16,7 @@ import Tooltip from './Tooltip';
16
16
  import Infotip from './Infotip';
17
17
  import Search from './Search';
18
18
  import TextInput from './TextInput';
19
+ import Dropdown from './Dropdown';
19
20
  import {
20
21
  MyApplicationsIcon,
21
22
  UserSignInIcon,
@@ -118,5 +119,6 @@ export {
118
119
  Tabs,
119
120
  TextButton,
120
121
  TextInput,
122
+ Dropdown,
121
123
  Tooltip,
122
124
  };