@madie/madie-design-system 1.2.62 → 2.0.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.
Files changed (118) hide show
  1. package/.eslintrc.js +1 -1
  2. package/.storybook/.babelrc +2 -1
  3. package/.storybook/main.js +3 -11
  4. package/components/AutoComplete/AutoComplete.jsx +1 -1
  5. package/components/Button/Button.stories.js +0 -2
  6. package/components/DateField/DateField.jsx +1 -1
  7. package/components/DateField/DateField.stories.jsx +23 -10
  8. package/components/DateTimeField/DateTimeField.jsx +6 -2
  9. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  10. package/components/Instant/Instant.stories.js +14 -6
  11. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  12. package/components/MadieAlert/index.jsx +5 -5
  13. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
  14. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
  15. package/components/MadieDialog/MadieDialog.stories.js +45 -116
  16. package/components/MadieDialog/index.jsx +4 -2
  17. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
  18. package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
  19. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  20. package/components/Modal/Modal.stories.js +18 -89
  21. package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
  22. package/components/NotificationBanner/index.js +3 -3
  23. package/components/NumberInput/NumberInput.stories.js +51 -63
  24. package/components/Popover/Popover.stories.js +6 -14
  25. package/components/Popover/index.js +2 -2
  26. package/components/RadioButton/RadioButton.jsx +4 -2
  27. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  28. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
  29. package/components/ReadOnlyTextField/index.jsx +1 -1
  30. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  31. package/components/RichTextEditor/index.jsx +14 -15
  32. package/components/Search/Search.stories.js +2 -4
  33. package/components/Select/Select.stories.js +59 -160
  34. package/components/Select/index.jsx +1 -1
  35. package/components/Tabs/Tabs.stories.js +78 -210
  36. package/components/TextArea/TextArea.stories.js +88 -108
  37. package/components/TextArea/index.jsx +1 -1
  38. package/components/TextField/TextField.stories.js +101 -124
  39. package/components/TextField/index.jsx +1 -1
  40. package/components/TimeField/TimeField.stories.js +18 -8
  41. package/components/Toast/Toast.stories.js +42 -102
  42. package/components/TruncateText/TruncateText.stories.js +22 -17
  43. package/components/hooks/useGetConfig.js +2 -2
  44. package/components/index.js +0 -24
  45. package/dist/browser.js +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/react/index.js +182 -51
  48. package/dist/react/index.js.LICENSE.txt +27 -24
  49. package/dist/react/index.js.map +1 -1
  50. package/eslint.config.js +56 -0
  51. package/index.js +7 -9
  52. package/package.json +43 -75
  53. package/test/components/Accordion.test.js +1 -1
  54. package/test/components/AutoComplete.test.js +11 -6
  55. package/test/components/Button.test.js +7 -3
  56. package/test/components/DateField.test.js +25 -29
  57. package/test/components/DateTimeField.test.js +21 -25
  58. package/test/components/Instant.test.js +1 -1
  59. package/test/components/MadieAlert.test.js +22 -22
  60. package/test/components/MadieConfirmDialog.test.js +42 -64
  61. package/test/components/MadieDeleteDialog.test.js +51 -69
  62. package/test/components/MadieDialog.test.js +13 -13
  63. package/test/components/MadieDiscardDialog.test.js +28 -45
  64. package/test/components/MadieSpinner.test.js +12 -17
  65. package/test/components/Modal.test.js +115 -0
  66. package/test/components/Pagination.test.js +2 -2
  67. package/test/components/RadioButton.test.js +7 -7
  68. package/test/components/ReadOnlyTextField.test.js +4 -2
  69. package/test/components/RichTextEditor.test.js +90 -6
  70. package/test/components/Search.test.js +75 -0
  71. package/test/components/Select.test.js +97 -107
  72. package/test/components/Tabs.test.js +22 -24
  73. package/test/components/TextArea.test.js +78 -92
  74. package/test/components/TextField.test.js +128 -147
  75. package/test/components/Toast.test.js +67 -78
  76. package/test/components/TruncateText.test.js +75 -0
  77. package/test/components/index.test.js +23 -0
  78. package/webpack.config.js +0 -1
  79. package/.eslintignore +0 -5
  80. package/components/Alert/Alert.stories.js +0 -70
  81. package/components/Alert/index.js +0 -55
  82. package/components/Breadcrumb/Breadcrumb.md +0 -28
  83. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  84. package/components/Breadcrumb/index.js +0 -92
  85. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  86. package/components/CalloutBox/index.js +0 -109
  87. package/components/Card/Card.stories.js +0 -163
  88. package/components/Card/index.js +0 -144
  89. package/components/Dropdown/Dropdown.stories.js +0 -94
  90. package/components/Dropdown/index.js +0 -85
  91. package/components/Error/Collapsible.jsx +0 -93
  92. package/components/Error/ErrorUI.jsx +0 -31
  93. package/components/Error/error.js +0 -26
  94. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  95. package/components/FlashNotification/index.js +0 -30
  96. package/components/Footer/Footer.stories.js +0 -20
  97. package/components/Footer/FooterUI.jsx +0 -137
  98. package/components/Footer/LegacyFooterUI.jsx +0 -204
  99. package/components/Footer/SocialLinks.jsx +0 -63
  100. package/components/Footer/Subscribe.jsx +0 -34
  101. package/components/Footer/footer.js +0 -30
  102. package/components/Infotip/Infotip.jsx +0 -75
  103. package/components/Infotip/Infotip.stories.js +0 -52
  104. package/components/Infotip/InfotipIcon.jsx +0 -41
  105. package/components/Infotip/index.js +0 -3
  106. package/components/Link/Link.stories.js +0 -82
  107. package/components/Link/index.js +0 -61
  108. package/components/Spinner/index.js +0 -9
  109. package/components/TextInput/TextInput.stories.js +0 -118
  110. package/components/TextInput/index.js +0 -137
  111. package/components/Tooltip/Tooltip.jsx +0 -88
  112. package/components/Tooltip/Tooltip.stories.js +0 -80
  113. package/components/Tooltip/index.js +0 -3
  114. package/components/Tooltip/position.js +0 -76
  115. package/test/components/ErrorUI.test.js +0 -32
  116. package/test/components/FooterUI.test.js +0 -122
  117. package/test/components/Infotip.test.js +0 -76
  118. package/test/components/Tooltip.test.js +0 -147
@@ -1,137 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
-
4
- import LegacyFooterUI from "./LegacyFooterUI";
5
-
6
- const FooterUI = (props) => {
7
- const isNewFooter = props.isNewFooter;
8
- const isIESupportPage = props.isIESupportPage;
9
- const signUpNowLink = props.showHcdResearch
10
- ? "/about/hcd-research"
11
- : "mailto:madie@cms.hhs.gov?subject=Sign up for feedback sessions";
12
-
13
- // Default footer assets
14
- const assets = {
15
- ...{
16
- hhsLogo: (
17
- <img
18
- className="hhs-logo"
19
- alt="Department of Health &amp; Human Services USA"
20
- src="/images/hhs-logo-black.svg"
21
- />
22
- ),
23
- madieLogo: (
24
- <img
25
- className="qpp-logo"
26
- src="/images/qpp_logo_rgb_color.png"
27
- alt="MADiE Measure Authoring Development Integrated Environment logo"
28
- />
29
- ),
30
- },
31
- ...props.assets,
32
- };
33
-
34
- const setLink = (link) => {
35
- return isIESupportPage ? "/" : link;
36
- };
37
-
38
- if (isNewFooter) {
39
- return (
40
- <>
41
- {!isIESupportPage && (
42
- <div className="feedback-session-sign-up" />
43
- )}
44
- <footer aria-label="Site footer" className="global-footer">
45
- <div className="build-version" id="build-version">
46
- {props.buildVersion}
47
- </div>
48
-
49
- <div className="responsive-container">
50
- <div className="other-links">
51
- <hr className="divider-top" />
52
- <ul className="small">
53
- <li>
54
- <a
55
- href={setLink(
56
- "https://harp.cms.gov/login/terms-of-use"
57
- )}
58
- aria-label="Terms of Use"
59
- data-track-category="FooterNav"
60
- data-track-action="OpenTermsOfService"
61
- data-track-label="Terms of Use"
62
- >
63
- Terms of Use
64
- </a>
65
- </li>
66
- <li className="divider"></li>{" "}
67
- <li>
68
- <a
69
- href={setLink(
70
- "https://www.cms.gov/privacy"
71
- )}
72
- aria-label="Privacy Policy"
73
- data-track-category="FooterNav"
74
- data-track-action="OpenPrivacyPolicy"
75
- data-track-label="Privacy Policy"
76
- >
77
- Privacy Policy
78
- </a>
79
- </li>
80
- <li className="divider"></li>{" "}
81
- <li>
82
- <a
83
- href={setLink(
84
- "https://www.hhs.gov/web/governance/digital-strategy/it-policy-archive/hhs-rules-of-behavior-for-the-use-of-hhs-information-and-it-resources-policy.html"
85
- )}
86
- aria-label="Rules of Behavior"
87
- data-track-category="FooterNav"
88
- data-track-action="OpenRulesofBehavior"
89
- data-track-label="Rules of Behavior"
90
- >
91
- Rules of Behavior
92
- </a>
93
- </li>
94
- </ul>
95
- <hr className="divider-bottom" />
96
- </div>
97
- <div className="qpp-hhs-logo-container">
98
- <div className="qpp-logo-container">
99
- {assets.qppLogo}
100
- </div>
101
- <div className="hhs-logo-container">
102
- {assets.hhsLogo}
103
- <p>
104
- A federal government website managed and
105
- paid for by the U.S Centers for Medicare
106
- &amp; Medicaid Services. 7500 Security
107
- Boulevard, Baltimore MD 21244
108
- </p>
109
- </div>
110
- </div>
111
- </div>
112
- </footer>
113
- </>
114
- );
115
- }
116
- return (
117
- <LegacyFooterUI
118
- buildVersion={props.buildVersion}
119
- isFullWidth={props.isFullWidth}
120
- signUpNowLink={signUpNowLink}
121
- />
122
- );
123
- };
124
-
125
- FooterUI.propTypes = {
126
- buildVersion: PropTypes.string,
127
- isFullWidth: PropTypes.bool,
128
- isNewFooter: PropTypes.bool,
129
- isIESupportPage: PropTypes.bool,
130
- showHcdResearch: PropTypes.bool,
131
- assets: PropTypes.shape({
132
- cmsLogo: PropTypes.element,
133
- madieLogo: PropTypes.element,
134
- }),
135
- };
136
-
137
- export default FooterUI;
@@ -1,204 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import InfoTip from "../Infotip/Infotip";
4
-
5
- const infoTipLabel =
6
- "When dialing 711, you will automatically be connected to a TRS Communications Assistant who will relay your conversation to the help desk agent with strict confidentiality.";
7
-
8
- const LegacyFooterUI = ({ buildVersion, isFullWidth, signUpNowLink }) => {
9
- return (
10
- <footer className="legacy-footer">
11
- <div className="build-version" id="build-version">
12
- {buildVersion}
13
- </div>
14
- <div className="banner">
15
- <div
16
- className={
17
- isFullWidth
18
- ? "container-full-width"
19
- : "responsive-container"
20
- }
21
- >
22
- <div className="row">
23
- <div className="col-sm-12 col-md-12 col-lg-12">
24
- <span>Help shape the future of MADiE</span> by
25
- participating in user feedback sessions.{" "}
26
- <a className="email-note-link" href={signUpNowLink}>
27
- Send us an email to sign up
28
- </a>
29
- </div>
30
- </div>
31
- </div>
32
- </div>
33
- <div
34
- className={
35
- isFullWidth
36
- ? "container-full-width"
37
- : "responsive-container"
38
- }
39
- >
40
- <div className="row">
41
- <div
42
- className={
43
- isFullWidth
44
- ? "col-sm-12 col-md-8 col-lg-8"
45
- : "col-sm-8 col-md-9 col-lg-9"
46
- }
47
- >
48
- <div className="logo-container">
49
- <img
50
- src="/images/qpp_logo_reversed.png"
51
- alt="Quality Payment Program"
52
- className="qpp-logo"
53
- />
54
- <div className="social-container">
55
- <a
56
- rel="noopener noreferrer"
57
- target="_blank"
58
- className="social-link"
59
- href="https://twitter.com/CMSGov"
60
- aria-label="Follow us on Twitter. This link opens in a new window."
61
- >
62
- <span className="glyphicon glyphicon-twitter"></span>
63
- </a>
64
- <a
65
- rel="noopener noreferrer"
66
- target="_blank"
67
- className="social-link"
68
- href="https://www.youtube.com/playlist?list=PLaV7m2-zFKpj_6fBsqav6GvFzzq9oOpkk"
69
- aria-label="Follow us on YouTube. This link opens in a new window."
70
- >
71
- <span className="glyphicon glyphicon-youtube"></span>
72
- </a>
73
- </div>
74
- </div>
75
- <div className="links">
76
- <ul>
77
- <li>
78
- <a
79
- href="/developers"
80
- data-track-category="FooterNav"
81
- data-track-action="OpenDeveloperTools"
82
- data-track-label="Quality Payment Program"
83
- >
84
- Developer Tools
85
- </a>
86
- </li>
87
- <li>
88
- <a
89
- href="/about/resource-library"
90
- data-track-category="FooterNav"
91
- data-track-action="OpenEducationAndTools"
92
- data-track-label="Education and Tools"
93
- >
94
- Resource Library
95
- </a>
96
- </li>
97
- <li>
98
- <a
99
- href="/glossary"
100
- data-track-category="FooterNav"
101
- data-track-action="OpenGlossary"
102
- data-track-label="Glossary"
103
- >
104
- Glossary
105
- </a>
106
- </li>
107
- <li>
108
- <a
109
- href="/resources/help-and-support"
110
- data-track-category="FooterNav"
111
- data-track-action="OpenHelpAndSupport"
112
- data-track-label="Help and Support"
113
- >
114
- Help and Support
115
- </a>
116
- </li>
117
- </ul>
118
- <ul className="small">
119
- <li>
120
- <a
121
- href="https://www.cms.gov/privacy"
122
- data-track-category="FooterNav"
123
- data-track-action="OpenPrivacyDisclaimer"
124
- data-track-label="Notice of Privacy and Disclaimer"
125
- >
126
- CMS Privacy Notice
127
- </a>
128
- </li>
129
- <span className="divider"></span>
130
- <li>
131
- <a
132
- href="https://www.cms.gov/About-CMS/Agency-Information/Aboutwebsite/Policiesforaccessibility"
133
- data-track-category="FooterNav"
134
- data-track-action="OpenAccessibility"
135
- data-track-label="Accessibility"
136
- >
137
- Accessibility
138
- </a>
139
- </li>
140
- <span className="divider"></span>
141
- <li>
142
- <a
143
- className="adobe-link"
144
- rel="noopener noreferrer"
145
- target="_blank"
146
- href="https://get.adobe.com/reader"
147
- data-track-category="FooterNav"
148
- data-track-action="DownloadAdobeReader"
149
- data-track-label="AdobeReader"
150
- >
151
- <svg className="icon">
152
- <use xlinkHref="#icon-download" />
153
- </svg>
154
- Download Adobe Reader
155
- </a>
156
- </li>
157
- <span className="divider"></span>
158
- <li>
159
- <a
160
- href="mailto:sb-mat-help@semanticbits.com"
161
- className="email-link"
162
- >
163
- sb-mat-help@semanticbits.com
164
- </a>
165
- </li>
166
- <li>
167
- 1-866-288-8292 (TRS: 711)
168
- <div className="footer-trs-infotip">
169
- <InfoTip
170
- lightIcon
171
- label={infoTipLabel}
172
- />
173
- </div>
174
- </li>
175
- </ul>
176
- </div>
177
- </div>
178
- <div
179
- className={
180
- isFullWidth
181
- ? "col-sm-12 col-md-4 col-lg-4"
182
- : "col-sm-4 col-md-3 col-lg-3"
183
- }
184
- >
185
- <div className="hhs-logo-container">
186
- <img
187
- alt="Department of Health &amp; Human Services USA"
188
- src="/images/hhs-logo-white.svg"
189
- />
190
- </div>
191
- </div>
192
- </div>
193
- </div>
194
- </footer>
195
- );
196
- };
197
-
198
- LegacyFooterUI.propTypes = {
199
- buildVersion: PropTypes.string,
200
- isFullWidth: PropTypes.bool,
201
- signUpNowLink: PropTypes.string,
202
- };
203
-
204
- export default LegacyFooterUI;
@@ -1,63 +0,0 @@
1
- import React from "react";
2
-
3
- const SocialLinks = () => (
4
- <div className="social-container">
5
- <a
6
- rel="noopener noreferrer"
7
- target="_blank"
8
- className="social-link"
9
- href="https://twitter.com/CMSGov"
10
- aria-label="Follow us on Twitter. This link opens in a new window."
11
- >
12
- <svg width="19px" height="16px" viewBox="0 0 19 16">
13
- <g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
14
- <g
15
- transform="translate(-763.000000, -177.000000)"
16
- fill="#242424"
17
- fillRule="nonzero"
18
- >
19
- <g transform="translate(763.000000, 140.000000)">
20
- <g transform="translate(0.000000, 37.000000)">
21
- <path
22
- d="M16.9243259,4.73901817 C16.9243259,4.57725788 16.9243259,4.41549759 16.916868,4.25373729 C17.6626567,3.71698723 18.3114928,3.05524058 18.826087,2.30526104 C18.1250456,2.6067234 17.3867149,2.81260014 16.6260105,2.90083303 C17.4240043,2.43025763 18.0206352,1.68763083 18.3040349,0.812654705 C17.5507884,1.25381914 16.7304209,1.56263424 15.8727639,1.72439454 C14.425934,0.202377237 12.0021209,0.128849832 10.4583384,1.56263424 C9.46643951,2.48172682 9.04133999,3.8566893 9.35457121,5.16547712 C6.28192201,5.01106957 3.41063575,3.5846379 1.47158528,1.22440818 C0.457312727,2.94494947 0.971906889,5.15077164 2.65738922,6.26103547 C2.04584253,6.24632999 1.45666951,6.0845697 0.919701685,5.79046007 C0.919701685,5.80516555 0.919701685,5.81987104 0.919701685,5.83457652 C0.919701685,7.62864522 2.20245815,9.17272074 3.99235089,9.53300502 C3.42555152,9.68741258 2.83637849,9.7094708 2.26212124,9.59917969 C2.76179963,11.1359025 4.20117171,12.1873444 5.83444883,12.2167553 C4.4771135,13.2681972 2.80654695,13.8343583 1.08377519,13.8343583 C0.778001843,13.8343583 0.4722285,13.8123 0.173913043,13.7828891 C1.93397424,14.8784474 3.96251934,15.4666667 6.04326965,15.4666667 C13.0760565,15.4666667 16.9243259,9.71682354 16.9243259,4.73901817 Z"
23
- id="twitter-icon"
24
- ></path>
25
- </g>
26
- </g>
27
- </g>
28
- </g>
29
- </svg>
30
- </a>
31
- <a
32
- rel="noopener noreferrer"
33
- target="_blank"
34
- className="social-link"
35
- href="https://www.youtube.com/playlist?list=PLaV7m2-zFKpj_6fBsqav6GvFzzq9oOpkk"
36
- aria-label="Follow us on YouTube. This link opens in a new window."
37
- >
38
- <svg width="19px" height="14px" viewBox="0 0 19 14">
39
- <g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
40
- <g
41
- transform="translate(-801.000000, -179.000000)"
42
- fill="#242424"
43
- fillRule="nonzero"
44
- >
45
- <g transform="translate(763.000000, 140.000000)">
46
- <g
47
- id="Group"
48
- transform="translate(38.000000, 39.000000)"
49
- >
50
- <path
51
- d="M17.7486957,2.84298208 C17.551087,2.10010036 16.9670652,1.51515412 16.2265217,1.3162724 C14.8843478,0.955555556 9.5,0.955555556 9.5,0.955555556 C9.5,0.955555556 4.11565217,0.955555556 2.77347826,1.3162724 C2.03293478,1.51515412 1.44891304,2.10010036 1.25130435,2.84298208 C0.891304348,4.19030824 0.891304348,7 0.891304348,7 C0.891304348,7 0.891304348,9.80969176 1.25130435,11.1570179 C1.44891304,11.8998996 2.03293478,12.4848459 2.77347826,12.6837276 C4.11565217,13.0444444 9.5,13.0444444 9.5,13.0444444 C9.5,13.0444444 14.8843478,13.0444444 16.2265217,12.6837276 C16.9670652,12.4848459 17.551087,11.8998996 17.7486957,11.1570179 C18.1086957,9.80969176 18.1086957,7 18.1086957,7 C18.1086957,7 18.1086957,4.19030824 17.7486957,2.84298208 Z M7.73913043,9.5513405 L7.73913043,4.4486595 L12.2391304,7 L7.73913043,9.5513405 Z"
52
- id="Youtube-icon"
53
- ></path>
54
- </g>
55
- </g>
56
- </g>
57
- </g>
58
- </svg>
59
- </a>
60
- </div>
61
- );
62
-
63
- export default SocialLinks;
@@ -1,34 +0,0 @@
1
- import React from "react";
2
-
3
- const Subscribe = () => (
4
- <div className="subscriber-form">
5
- <form
6
- action="https://public.govdelivery.com/accounts/USCMS/subscriber/qualify"
7
- target="_blank"
8
- acceptCharset="UTF-8"
9
- method="get"
10
- rel="noopener noreferrer"
11
- >
12
- <input type="hidden" name="topic_id" value="USCMS_12196" />
13
- <label className="sr-only" htmlFor="email-subscribe">
14
- Email address
15
- </label>
16
- <input
17
- id="email-subscribe"
18
- className="form-control"
19
- type="email"
20
- name="email"
21
- placeholder="Enter your Email"
22
- />
23
- <button
24
- className="btn btn-subscribe js-subscribe-submit"
25
- type="submit"
26
- name="commit"
27
- >
28
- Subscribe
29
- </button>
30
- </form>
31
- </div>
32
- );
33
-
34
- export default Subscribe;
@@ -1,30 +0,0 @@
1
- /* global buildVersion */
2
- // buildVersion above is defined in webpack.config.js
3
- import React from "react";
4
- import { render } from "react-dom";
5
- import FooterUI from "./FooterUI";
6
-
7
- /**
8
- * Renders the QPP Footer content.
9
- */
10
- export default class Footer {
11
- /**
12
- * @param {Object} options - An object containing content and config data
13
- * @param {HTMLElement} options.rootElement - Elem inside which to render
14
- */
15
- constructor(options) {
16
- if (options.hasOwnProperty("rootElement")) {
17
- render(
18
- <FooterUI
19
- buildVersion={buildVersion}
20
- isFullWidth={options.isFullWidth}
21
- isNewFooter={options.isNewFooter}
22
- showHcdResearch={options.showHcdResearch}
23
- />,
24
- options.rootElement
25
- );
26
- } else {
27
- render(<FooterUI buildVersion={buildVersion} />, options);
28
- }
29
- }
30
- }
@@ -1,75 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import Tooltip from "../Tooltip";
4
- import InfotipIcon from "./InfotipIcon";
5
-
6
- const BUTTON_SIZE = "16px";
7
-
8
- const buttonStyle = {
9
- background: "transparent",
10
- border: 0,
11
- padding: 0,
12
- width: BUTTON_SIZE,
13
- height: BUTTON_SIZE,
14
- WebkitTouchCallout: "none",
15
- WebkitUserSelect: "none",
16
- userSelect: "none",
17
- };
18
-
19
- // Use basic touch handlers for mobile "tap-to-open" ui. Mobile touch
20
- // is currently not supported by @reach/tooltip; this may change in future.
21
- // Leverages @reach/tooltip "focus" behavior to open tooltip on tap,
22
- // and close tooltip on second tap or loss of focus.
23
- // TODO: We may want to improve this by tracking touch positions to ensure
24
- // that a 'touchend' event must be reasonably close to the tooltip target.
25
- const touchHandlers = {
26
- onTouchStart: (e) => {
27
- e.stopPropagation();
28
- },
29
- onTouchEnd: (e) => {
30
- if (document.activeElement !== e.currentTarget) {
31
- e.preventDefault();
32
- e.currentTarget.focus();
33
- } else {
34
- e.preventDefault();
35
- e.currentTarget.blur();
36
- }
37
- },
38
- };
39
-
40
- /**
41
- * Tooltip with styled information icon
42
- */
43
- const Infotip = ({ label, lightIcon, ...props }) => (
44
- <Tooltip label={label} {...props}>
45
- <button
46
- type="button"
47
- aria-label="Information"
48
- style={buttonStyle}
49
- {...touchHandlers}
50
- >
51
- <InfotipIcon
52
- lightIcon={lightIcon}
53
- width={BUTTON_SIZE}
54
- height={BUTTON_SIZE}
55
- aria-hidden
56
- style={{ float: "left" }}
57
- />
58
- </button>
59
- </Tooltip>
60
- );
61
-
62
- Infotip.propTypes = {
63
- label: PropTypes.string.isRequired,
64
- ariaLabel: PropTypes.string,
65
- lightIcon: PropTypes.bool,
66
- DEBUG_STYLE: PropTypes.bool,
67
- };
68
-
69
- Infotip.defaultProps = {
70
- ariaLabel: undefined,
71
- lightIcon: false,
72
- DEBUG_STYLE: undefined,
73
- };
74
-
75
- export default Infotip;
@@ -1,52 +0,0 @@
1
- import React from "react";
2
- import Infotip from "./index";
3
- import { withKnobs, boolean } from "@storybook/addon-knobs";
4
-
5
- export default {
6
- title: "Infotip",
7
- component: Infotip,
8
- decorators: [
9
- withKnobs,
10
- (storyFn) => (
11
- <div style={{ marginTop: "120px", marginLeft: "100px" }}>
12
- {storyFn()}
13
- </div>
14
- ),
15
- ],
16
- };
17
-
18
- export const ExampleInfoTip = () => (
19
- <Infotip label="Tooltip Content!" lightIcon={boolean("lightIcon", false)} />
20
- );
21
-
22
- ExampleInfoTip.storyName = "qpp themed Infotip";
23
-
24
- export const PositionCollisionInfotip = () => (
25
- <Infotip
26
- DEBUG_STYLE
27
- label="The DEBUG_STYLE prop is supported by the useTooltip hook and should only
28
- be used for development."
29
- />
30
- );
31
-
32
- PositionCollisionInfotip.storyName = "position collision";
33
-
34
- export const LongContentInfotip = () => (
35
- <div style={{ paddingTop: "50px" }}>
36
- <span style={{ marginLeft: "120px" }} />
37
- <Infotip
38
- DEBUG_STYLE
39
- label="Initial Eligibility determination covers data collected from Oct. 1, 2018 to Sept. 31, 2019. Determination was released in Dec. 2019. Final eligibility will be released in Nov. 2020."
40
- />
41
- </div>
42
- );
43
-
44
- LongContentInfotip.storyName = "long content";
45
-
46
- export const LightIconInfotip = () => (
47
- <div style={{ backgroundColor: "#04838A", padding: "20px", width: "16px" }}>
48
- <Infotip lightIcon label="Light Icon Infotip" />
49
- </div>
50
- );
51
-
52
- LightIconInfotip.storyName = "alternate light icon";
@@ -1,41 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
-
4
- const InfotipIcon = ({ lightIcon, ...props }) => (
5
- <svg
6
- width="20px"
7
- height="20px"
8
- viewBox="0 0 20 20"
9
- xmlns="http://www.w3.org/2000/svg"
10
- {...props}
11
- >
12
- <g fill="none" fillRule="evenodd">
13
- <path
14
- d="M9.721 19.158c-4.947 0-8.973-4.126-8.973-9.196C.748 4.892 4.774.766 9.72.766c4.948 0 8.974 4.126 8.974 9.196 0 5.07-4.026 9.196-8.974 9.196z"
15
- fill="#2EB1ED"
16
- fillRule="nonzero"
17
- />
18
- <path
19
- d="M9.721 0C4.361 0 0 4.469 0 9.962c0 5.493 4.36 9.962 9.721 9.962 5.36 0 9.722-4.469 9.722-9.962C19.443 4.469 15.082 0 9.72 0z"
20
- fill={lightIcon ? "#FFF" : "#04838A"}
21
- />
22
- <path
23
- d="M9.721 14.765c-.206 0-.374.112-.374.25v.5c0 .138.168.25.374.25.207 0 .374-.112.374-.25v-.5c0-.138-.167-.25-.374-.25zM9.764 4.706H9.72c-.792 0-1.536.29-2.1.821a2.767 2.767 0 0 0-.89 2.03c0 .197.166.356.373.356s.374-.159.374-.356c0-.577.237-1.118.668-1.523a2.268 2.268 0 0 1 1.607-.615c1.182.016 2.195.98 2.211 2.107.011.743-.373 1.427-1.028 1.83-.995.61-1.589 1.691-1.589 2.89v1.013c0 .197.168.357.374.357.207 0 .374-.16.374-.357v-1.013c0-.941.477-1.82 1.246-2.292.873-.537 1.386-1.448 1.371-2.438-.022-1.527-1.345-2.788-2.948-2.81z"
24
- stroke={lightIcon ? "#04838A" : "#FFF"}
25
- strokeWidth=".5"
26
- fill={lightIcon ? "#04838A" : "#FFF"}
27
- fillRule="nonzero"
28
- />
29
- </g>
30
- </svg>
31
- );
32
-
33
- export default InfotipIcon;
34
-
35
- InfotipIcon.propTypes = {
36
- lightIcon: PropTypes.bool,
37
- };
38
-
39
- InfotipIcon.defaultProps = {
40
- lightIcon: false,
41
- };
@@ -1,3 +0,0 @@
1
- import Infotip from "./Infotip";
2
-
3
- export default Infotip;