qpp-style 9.41.0 → 9.41.2

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.
@@ -46,6 +46,7 @@ const HeaderSearchBar = () => {
46
46
  id="query"
47
47
  name="query"
48
48
  type="text"
49
+ maxLength="50"
49
50
  />
50
51
  </div>
51
52
  <button
@@ -0,0 +1,182 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import { NavLinkContainer, NavLinkInline, NavLinkDrawer } from "../Links";
5
+ import AnimationGroup from "../AnimationGroup/AnimationGroup";
6
+ import { PracticeDetails, IndividualDetails } from "../Details";
7
+ import SanitizedContent from "../../SanitizedContent";
8
+ import * as SvgComponents from "../../../lib/SvgComponents.jsx";
9
+ import CmsSwitchLink from "../Links/CmsSwitchLink";
10
+
11
+ const DynamicContent = ({
12
+ contentItems,
13
+ className,
14
+ recursionId,
15
+ config,
16
+ isExpandedState,
17
+ expand,
18
+ }) => {
19
+ const { openDrawersByDefault, linkActiveFunc, linkCallback } = config;
20
+ let linkClass = isExpandedState ? "link-inline" : "link-collapsed";
21
+ const containerRecursionId = recursionId ? recursionId : 0;
22
+
23
+ const getDynamicIcon = (icon) => {
24
+ const Component = SvgComponents[icon];
25
+ return Component ? <Component /> : null;
26
+ };
27
+
28
+ const hasDarkerBackground = (darkerBackground) => {
29
+ return darkerBackground ? "hr-smaller-vertical-spacing" : "";
30
+ };
31
+
32
+ const itemsMarkup = (contentItems || []).map((item, index) => {
33
+ const key = `${JSON.stringify(item)}-${index}-${containerRecursionId}`;
34
+
35
+ return (
36
+ {
37
+ divider: (
38
+ <AnimationGroup
39
+ display={isExpandedState}
40
+ key={key}
41
+ darkerBackground={item.darkerBackground}
42
+ >
43
+ <hr className={`${hasDarkerBackground(item.darkerBackground)}`} />
44
+ </AnimationGroup>
45
+ ),
46
+ container: (
47
+ <DynamicContent
48
+ contentItems={item.items}
49
+ className={item.className}
50
+ recursionId={containerRecursionId + 1}
51
+ config={config}
52
+ isExpandedState={isExpandedState}
53
+ />
54
+ ),
55
+ linkBack: (
56
+ <AnimationGroup display={isExpandedState} key={key}>
57
+ <NavLinkInline
58
+ className="link-back"
59
+ icon={getDynamicIcon("ChevronLeft")}
60
+ url={item.url}
61
+ label={item.label}
62
+ linkCallback={linkCallback}
63
+ showLabel={true}
64
+ />
65
+ </AnimationGroup>
66
+ ),
67
+ linkHome: (
68
+ <AnimationGroup display={isExpandedState} key={key}>
69
+ <NavLinkInline
70
+ className="account-home-link"
71
+ icon={getDynamicIcon(item?.icon)}
72
+ url={item.url}
73
+ label={item.label}
74
+ linkCallback={linkCallback}
75
+ showLabel={true}
76
+ />
77
+ </AnimationGroup>
78
+ ),
79
+ practiceDetails: (
80
+ <AnimationGroup
81
+ display={isExpandedState}
82
+ className={"details"}
83
+ key={key}
84
+ >
85
+ <PracticeDetails
86
+ practiceName={item.practiceName}
87
+ {...(!item.practiceTin ? {} : { practiceTin: item.practiceTin })}
88
+ {...(!item.apmEntityId ? {} : { apmEntityId: item.apmEntityId })}
89
+ {...(!item.vgId ? {} : { vgId: item.vgId })}
90
+ {...(!item.cpcPlusId ? {} : { cpcPlusId: item.cpcPlusId })}
91
+ {...(!item.pcfId ? {} : { pcfId: item.pcfId })}
92
+ {...(!item.subgroupId ? {} : { subgroupId: item.subgroupId })}
93
+ />
94
+ </AnimationGroup>
95
+ ),
96
+ individualDetails: (
97
+ <AnimationGroup display={isExpandedState} key={key}>
98
+ <IndividualDetails
99
+ individualName={item.individualName}
100
+ individualNpi={item.individualNpi}
101
+ />
102
+ </AnimationGroup>
103
+ ),
104
+ linkDrawer: (
105
+ <NavLinkDrawer
106
+ key={key}
107
+ isExpanded={isExpandedState}
108
+ isAlwaysOpen={item.isAlwaysOpen}
109
+ openByDefault={openDrawersByDefault}
110
+ rightIcon="chevron-down"
111
+ leftIcon={getDynamicIcon(item?.icon)}
112
+ className={linkClass}
113
+ label={item.label}
114
+ linkActiveFunc={linkActiveFunc}
115
+ linkCallback={linkCallback}
116
+ listOfLinks={item.items}
117
+ url={item.url}
118
+ sidebarExpand={expand}
119
+ isHighlighted={item.isHighlighted}
120
+ darkerBackground={item.darkerBackground}
121
+ leftBorderHighlightDisabled={item.leftBorderHighlightDisabled}
122
+ hideLabelSection={item.hideLabelSection}
123
+ largerDrawerBottomPadding={item.largerDrawerBottomPadding}
124
+ />
125
+ ),
126
+ custom: (
127
+ <AnimationGroup display={isExpandedState} key={key}>
128
+ <SanitizedContent
129
+ html={item.content}
130
+ customClassName={item.customClassName}
131
+ />
132
+ </AnimationGroup>
133
+ ),
134
+ switchLink: (
135
+ <AnimationGroup display={isExpandedState} key={key}>
136
+ <CmsSwitchLink
137
+ linkCallback={linkCallback}
138
+ label={item.label}
139
+ url={item.url}
140
+ />
141
+ </AnimationGroup>
142
+ ),
143
+ }[item.type] || (
144
+ <NavLinkInline
145
+ key={key}
146
+ icon={getDynamicIcon(item?.icon)}
147
+ className={item.className ? item.className : linkClass}
148
+ url={item.url}
149
+ label={item.label}
150
+ linkCallback={linkCallback}
151
+ showLabel={isExpandedState}
152
+ disabled={item.disabled}
153
+ target={item.target}
154
+ />
155
+ )
156
+ );
157
+ });
158
+
159
+ if (className === "link-container") {
160
+ return (
161
+ <div className="animation-flat" key={`nav-link-container-${recursionId}`}>
162
+ <NavLinkContainer
163
+ listOfLinks={itemsMarkup}
164
+ linkActiveFunc={linkActiveFunc}
165
+ />
166
+ </div>
167
+ );
168
+ } else {
169
+ return <div className={className}>{itemsMarkup}</div>;
170
+ }
171
+ };
172
+
173
+ export default DynamicContent;
174
+
175
+ DynamicContent.propTypes = {
176
+ config: PropTypes.object,
177
+ isExpandedState: PropTypes.bool,
178
+ contentItems: PropTypes.array,
179
+ className: PropTypes.string,
180
+ recursionId: PropTypes.number,
181
+ expand: PropTypes.func,
182
+ };
@@ -3,17 +3,8 @@ import PropTypes from "prop-types";
3
3
 
4
4
  import { setSideNavExpanded, isSideNavExpanded } from "../helpers";
5
5
  import { LevelOneContent } from "../Content";
6
- import {
7
- NavLinkContainer,
8
- NavLinkInline,
9
- NavLinkDrawer,
10
- NavLinkToggle,
11
- } from "../Links";
12
- import AnimationGroup from "../AnimationGroup/AnimationGroup";
13
- import { PracticeDetails, IndividualDetails } from "../Details";
14
- import SanitizedContent from "../../SanitizedContent";
15
- import * as SvgComponents from "../../../lib/SvgComponents.jsx";
16
- import CmsSwitchLink from "../Links/CmsSwitchLink";
6
+ import DynamicContent from "./DynamicContent";
7
+ import { NavLinkToggle } from "../Links";
17
8
  import defaultMarkup from "./default-markup";
18
9
 
19
10
  // TODO: For an SSR version of the SideNavUI we would need to have
@@ -112,164 +103,6 @@ const SideNavUI = ({
112
103
  };
113
104
  }, []);
114
105
 
115
- const getDynamicContent = (contentItems, className, recursionId) => {
116
- const { openDrawersByDefault, linkActiveFunc, linkCallback } = config;
117
- let linkClass = isExpandedState ? "link-inline" : "link-collapsed";
118
- const containerRecursionId = recursionId || 0;
119
-
120
- const getDynamicIcon = (icon) => {
121
- const Component = SvgComponents[icon];
122
- return Component ? <Component /> : null;
123
- };
124
-
125
- const hasDarkerBackground = (darkerBackground) => {
126
- return darkerBackground ? "hr-smaller-vertical-spacing" : "";
127
- };
128
-
129
- const itemsMarkup = (contentItems || []).map((item, index) => {
130
- const key = `${JSON.stringify(item)}-${index}-${containerRecursionId}`;
131
-
132
- return (
133
- {
134
- divider: (
135
- <AnimationGroup
136
- display={isExpandedState}
137
- key={key}
138
- darkerBackground={item.darkerBackground}
139
- >
140
- <hr className={`${hasDarkerBackground(item.darkerBackground)}`} />
141
- </AnimationGroup>
142
- ),
143
- container: getDynamicContent(
144
- item.items,
145
- item.className,
146
- containerRecursionId + 1,
147
- ),
148
- linkBack: (
149
- <AnimationGroup display={isExpandedState} key={key}>
150
- <NavLinkInline
151
- className="link-back"
152
- icon={getDynamicIcon("ChevronLeft")}
153
- url={item.url}
154
- label={item.label}
155
- linkCallback={linkCallback}
156
- showLabel={true}
157
- />
158
- </AnimationGroup>
159
- ),
160
- linkHome: (
161
- <AnimationGroup display={isExpandedState} key={key}>
162
- <NavLinkInline
163
- className="account-home-link"
164
- icon={getDynamicIcon(item?.icon)}
165
- url={item.url}
166
- label={item.label}
167
- linkCallback={linkCallback}
168
- showLabel={true}
169
- />
170
- </AnimationGroup>
171
- ),
172
- practiceDetails: (
173
- <AnimationGroup
174
- display={isExpandedState}
175
- className={"details"}
176
- key={key}
177
- >
178
- <PracticeDetails
179
- practiceName={item.practiceName}
180
- {...(!item.practiceTin
181
- ? {}
182
- : { practiceTin: item.practiceTin })}
183
- {...(!item.apmEntityId
184
- ? {}
185
- : { apmEntityId: item.apmEntityId })}
186
- {...(!item.vgId ? {} : { vgId: item.vgId })}
187
- {...(!item.cpcPlusId ? {} : { cpcPlusId: item.cpcPlusId })}
188
- {...(!item.pcfId ? {} : { pcfId: item.pcfId })}
189
- {...(!item.subgroupId ? {} : { subgroupId: item.subgroupId })}
190
- />
191
- </AnimationGroup>
192
- ),
193
- individualDetails: (
194
- <AnimationGroup display={isExpandedState} key={key}>
195
- <IndividualDetails
196
- individualName={item.individualName}
197
- individualNpi={item.individualNpi}
198
- />
199
- </AnimationGroup>
200
- ),
201
- linkDrawer: (
202
- <NavLinkDrawer
203
- key={key}
204
- isExpanded={isExpandedState}
205
- isAlwaysOpen={item.isAlwaysOpen}
206
- openByDefault={openDrawersByDefault}
207
- rightIcon="chevron-down"
208
- leftIcon={getDynamicIcon(item?.icon)}
209
- className={linkClass}
210
- label={item.label}
211
- linkActiveFunc={linkActiveFunc}
212
- linkCallback={linkCallback}
213
- listOfLinks={item.items}
214
- url={item.url}
215
- sidebarExpand={expand}
216
- isHighlighted={item.isHighlighted}
217
- darkerBackground={item.darkerBackground}
218
- leftBorderHighlightDisabled={item.leftBorderHighlightDisabled}
219
- hideLabelSection={item.hideLabelSection}
220
- largerDrawerBottomPadding={item.largerDrawerBottomPadding}
221
- />
222
- ),
223
- custom: (
224
- <AnimationGroup display={isExpandedState} key={key}>
225
- <SanitizedContent
226
- html={item.content}
227
- customClassName={item.customClassName}
228
- />
229
- </AnimationGroup>
230
- ),
231
- switchLink: (
232
- <AnimationGroup display={isExpandedState} key={key}>
233
- <CmsSwitchLink
234
- linkCallback={linkCallback}
235
- label={item.label}
236
- url={item.url}
237
- />
238
- </AnimationGroup>
239
- ),
240
- }[item.type] || (
241
- <NavLinkInline
242
- key={key}
243
- icon={getDynamicIcon(item?.icon)}
244
- className={item.className ? item.className : linkClass}
245
- url={item.url}
246
- label={item.label}
247
- linkCallback={linkCallback}
248
- showLabel={isExpandedState}
249
- disabled={item.disabled}
250
- target={item.target}
251
- />
252
- )
253
- );
254
- });
255
-
256
- if (className === "link-container") {
257
- return (
258
- <div
259
- className="animation-flat"
260
- key={`nav-link-container-${recursionId}`}
261
- >
262
- <NavLinkContainer
263
- listOfLinks={itemsMarkup}
264
- linkActiveFunc={linkActiveFunc}
265
- />
266
- </div>
267
- );
268
- } else {
269
- return <div className={className}>{itemsMarkup}</div>;
270
- }
271
- };
272
-
273
106
  const content = !items?.length ? (
274
107
  <LevelOneContent
275
108
  levelOneContent={sideNavContent}
@@ -277,10 +110,12 @@ const SideNavUI = ({
277
110
  config={config}
278
111
  />
279
112
  ) : (
280
- getDynamicContent(
281
- items,
282
- "sidebar-content" + (isAltStyle ? " alt-style" : ""),
283
- )
113
+ <DynamicContent
114
+ contentItems={items}
115
+ className={"sidebar-content" + (isAltStyle ? " alt-style" : "")}
116
+ config={config}
117
+ isExpandedState={isExpandedState}
118
+ />
284
119
  );
285
120
 
286
121
  return (