qpp-style 9.45.0 → 9.45.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.
package/.babelrc CHANGED
@@ -1,10 +1,4 @@
1
1
  {
2
- "presets": [
3
- "@babel/preset-react",
4
- "@babel/preset-env"
5
- ],
6
- "plugins": [
7
- "transform-es2015-modules-umd",
8
- "transform-class-properties"
9
- ]
2
+ "presets": ["@babel/preset-react", "@babel/preset-env"],
3
+ "plugins": ["transform-es2015-modules-umd"]
10
4
  }
package/.browserlistrc ADDED
@@ -0,0 +1,3 @@
1
+ "browserlist": [
2
+ "defaults"
3
+ ]
@@ -2,9 +2,17 @@ import React, { useState, useRef, useEffect } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { Chevron } from "../../lib/Chevron.jsx";
4
4
 
5
- const Accordion = (props) => {
5
+ const Accordion = ({
6
+ title = "",
7
+ subTitle,
8
+ children,
9
+ centerItem,
10
+ rightItem,
11
+ isOpen = false,
12
+ isSticky = false,
13
+ }) => {
6
14
  const content = useRef(null);
7
- const [setActive, setActiveState] = useState(props.isOpen ? "active" : "");
15
+ const [setActive, setActiveState] = useState(isOpen ? "active" : "");
8
16
  const ariaPressed = setActive ? "true" : "false";
9
17
  const getHeight = (node) => {
10
18
  if (node) {
@@ -28,39 +36,37 @@ const Accordion = (props) => {
28
36
  }
29
37
 
30
38
  useEffect(() => {
31
- if (props.isOpen) {
39
+ if (isOpen) {
32
40
  openAccordion();
33
41
  } else {
34
42
  closeAccordion();
35
43
  }
36
- }, [props.isOpen]);
44
+ }, [isOpen]);
37
45
 
38
46
  return (
39
47
  <div className="accordion-section" data-testid="accordion">
40
48
  <button
41
49
  className={`accordion ${setActive} ${
42
- setActive && props.isSticky ? "sticky" : ""
50
+ setActive && isSticky ? "sticky" : ""
43
51
  }`}
44
- aria-label={props.title}
52
+ aria-label={title}
45
53
  aria-pressed={ariaPressed}
46
54
  aria-expanded={ariaPressed}
47
55
  tabIndex="0"
48
56
  onClick={toggleAccordion}
49
57
  >
50
58
  <div className="accordion-left-title">
51
- <p className="accordion-title">{props.title}</p>
52
- {props.subTitle && (
53
- <p className="accordion-subtitle">{props.subTitle}</p>
54
- )}
59
+ <p className="accordion-title">{title}</p>
60
+ {subTitle && <p className="accordion-subtitle">{subTitle}</p>}
55
61
  </div>
56
- {props.centerItem && (
62
+ {centerItem && (
57
63
  <div className="accordion-center">
58
- <p>{props.centerItem}</p>
64
+ <p>{centerItem}</p>
59
65
  </div>
60
66
  )}
61
- {props.rightItem && (
67
+ {rightItem && (
62
68
  <div className="accordion-right">
63
- <p>{props.rightItem}</p>
69
+ <p>{rightItem}</p>
64
70
  </div>
65
71
  )}
66
72
  <div className="chevron-container">
@@ -72,7 +78,7 @@ const Accordion = (props) => {
72
78
  style={{ maxHeight: height }}
73
79
  className="accordion-content"
74
80
  >
75
- <div className="accordion-text dashed-border">{props.children}</div>
81
+ <div className="accordion-text dashed-border">{children}</div>
76
82
  </div>
77
83
  </div>
78
84
  );
@@ -88,10 +94,4 @@ Accordion.propTypes = {
88
94
  isSticky: PropTypes.bool,
89
95
  };
90
96
 
91
- Accordion.defaultProps = {
92
- title: "",
93
- isOpen: false,
94
- isSticky: false,
95
- };
96
-
97
97
  export default Accordion;
@@ -5,14 +5,14 @@ const VARIANTS = ["secondary", "outline", "danger", "white"];
5
5
  const SIZES = ["big"];
6
6
 
7
7
  const Button = ({
8
- children,
8
+ children = null,
9
9
  className,
10
10
  href,
11
- loading,
12
- onClick,
13
- size,
11
+ loading = false,
12
+ onClick = () => {},
13
+ size = null,
14
14
  variant,
15
- type,
15
+ type = "button",
16
16
  ...rest
17
17
  }) => {
18
18
  let btnClass = "qpp-c-button";
@@ -64,17 +64,6 @@ Button.propTypes = {
64
64
  variant: PropTypes.oneOf(VARIANTS),
65
65
  };
66
66
 
67
- Button.defaultProps = {
68
- children: false,
69
- className: "",
70
- href: "",
71
- loading: false,
72
- onClick: () => null,
73
- size: null,
74
- type: "button",
75
- variant: null,
76
- };
77
-
78
67
  export const TextButton = ({ className = "", ...props }) => (
79
68
  <Button className={`qpp-c-button--text ${className}`} {...props} />
80
69
  );
@@ -83,8 +72,4 @@ TextButton.propTypes = {
83
72
  className: PropTypes.string,
84
73
  };
85
74
 
86
- TextButton.defaultProps = {
87
- className: "",
88
- };
89
-
90
75
  export default Button;
@@ -2,19 +2,19 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
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,
5
+ className = "qpp-u-width--100",
6
+ id = null,
7
+ ariaLabelledBy = null,
8
+ ariaLabel = null,
9
+ onChange = () => {},
10
+ dataTestId = null,
11
+ name = null,
12
+ dataType = null,
13
+ disabled = false,
14
+ size = null,
15
+ options = [],
16
16
  children,
17
- parentElement,
17
+ parentElement = "span",
18
18
  ...rest
19
19
  }) => {
20
20
  const dropdownClass = [
@@ -66,20 +66,4 @@ Dropdown.propTypes = {
66
66
  parentElement: PropTypes.string,
67
67
  };
68
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
69
  export default Dropdown;
@@ -5,7 +5,11 @@ import { setUtagLink } from "./utag-helpers";
5
5
  import HeaderMenuItem from "./HeaderMenuItem";
6
6
  import Session from "../Session";
7
7
 
8
- const HeaderAccountMenu = ({ handleClick, isLoginEnabled, isDevPre }) => {
8
+ const HeaderAccountMenu = ({
9
+ handleClick,
10
+ isLoginEnabled,
11
+ isDevPre = false,
12
+ }) => {
9
13
  const { closeMenus, RouterLink, headerContent } = useHeaderState();
10
14
  const { isLoggedIn, firstName, devPreMenuLinks, accountMenuLinks } =
11
15
  headerContent;
@@ -87,8 +91,4 @@ HeaderAccountMenu.propTypes = {
87
91
  handleClick: PropTypes.func.isRequired,
88
92
  };
89
93
 
90
- HeaderAccountMenu.defaultProps = {
91
- isDevPre: false,
92
- };
93
-
94
94
  export default HeaderAccountMenu;
@@ -18,12 +18,12 @@ function jumpToLink(e, id) {
18
18
 
19
19
  const HeaderContainer = ({
20
20
  children,
21
- includeSkipToSidebar,
22
- showCancelButton,
21
+ includeSkipToSidebar = false,
22
+ showCancelButton = false,
23
23
  skipToContentId,
24
- isIESupportPage,
25
- isDevPre,
26
- showSearchBar,
24
+ isIESupportPage = false,
25
+ isDevPre = false,
26
+ showSearchBar = false,
27
27
  }) => {
28
28
  const windowWidth = useWindowWidth();
29
29
  const { currentOpenMenu } = useHeaderState();
@@ -81,12 +81,5 @@ HeaderContainer.propTypes = {
81
81
  isDevPre: PropTypes.object,
82
82
  showSearchBar: PropTypes.bool,
83
83
  };
84
- HeaderContainer.defaultProps = {
85
- includeSkipToSidebar: false,
86
- showCancelButton: false,
87
- skipToContentId: null,
88
- isIESupportPage: false,
89
- showSearchBar: false,
90
- };
91
84
 
92
85
  export default HeaderContainer;
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
3
3
 
4
4
  import { useHeaderState } from "./hooks";
5
5
 
6
- const HeaderLogo = ({ isDevPre, hasSearchBar }) => {
6
+ const HeaderLogo = ({ isDevPre = false, hasSearchBar }) => {
7
7
  const { closeMenus, RouterLink } = useHeaderState();
8
8
  const searchHeaderClass = hasSearchBar ? " header-logo-search" : "";
9
9
  const headerLogoClass = `header-logo${searchHeaderClass}`;
@@ -34,9 +34,9 @@ const excludedClickOutClasses = [
34
34
  const HeaderMenuItem = ({
35
35
  handleClick,
36
36
  isMobileMenuExpanded,
37
- columns,
38
- menuName,
39
- rows,
37
+ columns = [],
38
+ menuName = "",
39
+ rows = [],
40
40
  name,
41
41
  subtitle,
42
42
  className,
@@ -229,11 +229,5 @@ HeaderMenuItem.propTypes = {
229
229
  handleClick: PropTypes.func.isRequired,
230
230
  isMobileMenuExpanded: PropTypes.bool.isRequired,
231
231
  };
232
- HeaderMenuItem.defaultProps = {
233
- menuName: "",
234
- columns: [],
235
- rows: [],
236
- className: null,
237
- };
238
232
 
239
233
  export default HeaderMenuItem;
@@ -13,14 +13,14 @@ import { HeaderStateProvider, useWindowWidth } from "./hooks";
13
13
  import defaultContent from "./default-content.json";
14
14
 
15
15
  const HeaderUI = ({
16
- handleCancel,
17
- includeSkipToSidebar,
18
- isDevPre,
19
- isLoginEnabled,
20
- showCancelButton,
16
+ handleCancel = () => {},
17
+ includeSkipToSidebar = false,
18
+ isDevPre = false,
19
+ isLoginEnabled = true,
20
+ showCancelButton = false,
21
21
  skipToContentId,
22
- RouterLink,
23
- isIESupportPage,
22
+ RouterLink = null,
23
+ isIESupportPage = false,
24
24
  }) => {
25
25
  const [isMobileMenuExpanded, setIsMobileMenuExpanded] = useState(false);
26
26
  const [headerContent, setHeaderContent] = useState({});
@@ -162,18 +162,5 @@ HeaderUI.propTypes = {
162
162
  RouterLink: PropTypes.func,
163
163
  isIESupportPage: PropTypes.bool,
164
164
  };
165
- HeaderUI.defaultProps = {
166
- handleCancel: Function.prototype,
167
- includeSkipToSidebar: false,
168
- isDevPre: false,
169
- isLoginEnabled: true,
170
- performanceYear: 2017,
171
- showCancelButton: false,
172
- showPhysicianCompareLink: false,
173
- showFacilityBasedPreviewLink: false,
174
- skipToContentId: null,
175
- RouterLink: null,
176
- isIESupportPage: false,
177
- };
178
165
 
179
166
  export default HeaderUI;
@@ -18,7 +18,7 @@ export const HeaderStateContext = createContext(null);
18
18
 
19
19
  export const HeaderStateProvider = ({
20
20
  children,
21
- RouterLink,
21
+ RouterLink = null,
22
22
  headerContent, // allow header content from api request available to all child components
23
23
  }) => {
24
24
  const [currentOpenMenu, setCurrentOpenMenu] = useState("");
@@ -53,10 +53,6 @@ HeaderStateProvider.propTypes = {
53
53
  headerContent: PropTypes.object,
54
54
  };
55
55
 
56
- HeaderStateProvider.defaultProps = {
57
- RouterLink: null,
58
- };
59
-
60
56
  export const useHeaderState = () => {
61
57
  const context = useContext(HeaderStateContext);
62
58
  if (context === undefined) {
@@ -36,7 +36,12 @@ const touchHandlers = {
36
36
  /**
37
37
  * Tooltip with styled information icon
38
38
  */
39
- const Infotip = ({ ariaLabel, label, lightIcon, ...props }) => (
39
+ const Infotip = ({
40
+ ariaLabel = "Information",
41
+ label,
42
+ lightIcon = false,
43
+ ...props
44
+ }) => (
40
45
  <InfotipContent label={label} id="info-tip" {...props}>
41
46
  <button
42
47
  type="button"
@@ -62,10 +67,4 @@ Infotip.propTypes = {
62
67
  DEBUG_STYLE: PropTypes.bool,
63
68
  };
64
69
 
65
- Infotip.defaultProps = {
66
- ariaLabel: "Information",
67
- lightIcon: false,
68
- DEBUG_STYLE: undefined,
69
- };
70
-
71
70
  export default Infotip;
@@ -28,6 +28,7 @@ const InfotipContent = ({ children, label, id }) => {
28
28
  </TooltipAnchor>
29
29
  <TooltipAriaKit
30
30
  state={tooltip}
31
+ id={undefined}
31
32
  ariaLabelledBy={undefined}
32
33
  className="tooltip-content"
33
34
  style={cssStyles}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- const InfotipIcon = ({ lightIcon, ...props }) => (
4
+ const InfotipIcon = ({ lightIcon = false, ...props }) => (
5
5
  <svg
6
6
  width="20px"
7
7
  height="20px"
@@ -35,7 +35,3 @@ export default InfotipIcon;
35
35
  InfotipIcon.propTypes = {
36
36
  lightIcon: PropTypes.bool,
37
37
  };
38
-
39
- InfotipIcon.defaultProps = {
40
- lightIcon: false,
41
- };
@@ -6,12 +6,12 @@ import { CloseXIcon2 } from "../../lib/SvgComponents.jsx";
6
6
 
7
7
  const Modal = ({
8
8
  children,
9
- onRequestClose,
9
+ onRequestClose = () => {},
10
10
  title,
11
11
  primary,
12
12
  secondary,
13
- appElement,
14
- isOpen,
13
+ appElement = "body > *:not(.qpp-c-modal)",
14
+ isOpen = false,
15
15
  ...props
16
16
  }) => {
17
17
  const [overflowSeparator, setOverflowSeparator] = useState(false);
@@ -128,13 +128,4 @@ Modal.propTypes = {
128
128
  isOpen: PropTypes.bool,
129
129
  };
130
130
 
131
- Modal.defaultProps = {
132
- onRequestClose: () => {},
133
- title: undefined,
134
- primary: null,
135
- secondary: null,
136
- appElement: "body > *:not(.qpp-c-modal)",
137
- isOpen: false,
138
- };
139
-
140
131
  export default Modal;
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  import LegacyModal from "./LegacyModal";
5
5
  import DsModal from "./Modal";
6
6
 
7
- const Modal = ({ useDesignSystem, ...rest }) => {
7
+ const Modal = ({ useDesignSystem = false, ...rest }) => {
8
8
  if (useDesignSystem) {
9
9
  return <DsModal {...rest} />;
10
10
  }
@@ -14,9 +14,6 @@ const Modal = ({ useDesignSystem, ...rest }) => {
14
14
  Modal.propTypes = {
15
15
  useDesignSystem: PropTypes.bool,
16
16
  };
17
- Modal.defaultProps = {
18
- useDesignSystem: false,
19
- };
20
17
  Modal.displayName = "Modal";
21
18
 
22
19
  export default Modal;
@@ -15,7 +15,17 @@ function debounce(fn, ms) {
15
15
  };
16
16
  }
17
17
 
18
- const NotificationBanner = ({ result }) => {
18
+ const NotificationBanner = ({
19
+ result = {
20
+ content: {
21
+ color: "blue",
22
+ content: null,
23
+ dismissable: true,
24
+ enabled: true,
25
+ label: "Update",
26
+ },
27
+ },
28
+ }) => {
19
29
  const {
20
30
  color = "blue",
21
31
  content,
@@ -200,18 +210,6 @@ NotificationBanner.propTypes = {
200
210
  }),
201
211
  };
202
212
 
203
- NotificationBanner.defaultProps = {
204
- result: {
205
- content: {
206
- color: "blue",
207
- content: null,
208
- dismissable: true,
209
- enabled: true,
210
- label: "Update",
211
- },
212
- },
213
- };
214
-
215
213
  export default withGetConfig(NotificationBanner, {
216
214
  timeout: 5,
217
215
  url: "/config/notification",
@@ -30,9 +30,4 @@ NavLinkContainer.propTypes = {
30
30
  linkActiveFunc: PropTypes.func,
31
31
  };
32
32
 
33
- NavLinkContainer.defaultProps = {
34
- listOfLinks: null,
35
- linkActiveFunc: null,
36
- };
37
-
38
33
  export default NavLinkContainer;
@@ -26,12 +26,12 @@ import defaultMarkup from "./default-markup";
26
26
  // the markup on the page. Then the web component renders
27
27
  // immediately.
28
28
  const SideNavUI = ({
29
- config,
30
- isAltStyle,
29
+ config = {},
30
+ isAltStyle = false,
31
31
  isExpanded,
32
- items,
33
- onCollapsed,
34
- onExpanded,
32
+ items = [],
33
+ onCollapsed = () => {},
34
+ onExpanded = () => {},
35
35
  }) => {
36
36
  const isExpandedPropSet = isExpanded !== undefined;
37
37
  const [isExpandedState, setIsExpandedState] = useState(() => {
@@ -148,13 +148,4 @@ SideNavUI.propTypes = {
148
148
  onExpanded: PropTypes.func,
149
149
  };
150
150
 
151
- SideNavUI.defaultProps = {
152
- config: {},
153
- isAltStyle: false,
154
- isExpanded: undefined,
155
- items: null,
156
- onCollapsed: () => {},
157
- onExpanded: () => {},
158
- };
159
-
160
151
  export default SideNavUI;
@@ -64,10 +64,4 @@ Tabs.propTypes = {
64
64
  selected: PropTypes.string,
65
65
  };
66
66
 
67
- Tabs.defaultProps = {
68
- defaultSelectedId: undefined,
69
- onChange: undefined,
70
- selected: undefined,
71
- };
72
-
73
67
  export default Tabs;