@innovaccer/design-system 2.13.2 → 2.13.4-1

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 (243) hide show
  1. package/core/components/atoms/checkbox/__stories__/Alignment.story.jsx +11 -13
  2. package/core/components/atoms/dropdown/Dropdown.tsx +18 -2
  3. package/core/components/atoms/dropdown/DropdownList.tsx +47 -57
  4. package/core/components/atoms/dropdown/__stories__/LabelInline.story.jsx +58 -0
  5. package/core/components/atoms/dropdown/__stories__/{LabelPositionInDropdown.story.jsx → LabelOnTop.story.jsx} +8 -9
  6. package/core/components/atoms/dropdown/option/DefaultOption.tsx +1 -1
  7. package/core/components/atoms/dropdown/utility.tsx +6 -0
  8. package/core/components/atoms/icon/__stories__/variants/Image.story.jsx +3 -3
  9. package/core/components/css-utilities/Miscellaneous/Miscellaneous.story.tsx +4 -0
  10. package/core/components/molecules/dropzone/FileSelectorUtils.tsx +3 -0
  11. package/core/components/molecules/sidesheet/__stories__/variants/twoSteps.story.jsx +6 -4
  12. package/core/components/organisms/calendar/__stories__/index.story.jsx +4 -6
  13. package/core/components/organisms/dateRangePicker/__stories__/variants/withSingleInput.story.jsx +3 -0
  14. package/core/components/organisms/horizontalNav/__stories__/leftAlign.story.jsx +35 -19
  15. package/core/components/organisms/pageHeader/__stories__/Responsiveness.story.jsx +2 -2
  16. package/core/components/organisms/pageHeader/__stories__/variants/withNavigation.story.jsx +2 -2
  17. package/core/components/organisms/pageHeader/__stories__/variants/withNavigationL1.story.jsx +2 -2
  18. package/core/components/organisms/pageHeader/__stories__/variants/withStepper.story.jsx +2 -2
  19. package/core/components/organisms/pageHeader/__stories__/variants/withStepperL1.story.jsx +2 -2
  20. package/core/components/organisms/pageHeader/__stories__/variants/withTabs.story.jsx +2 -2
  21. package/core/components/organisms/pageHeader/__stories__/variants/withTabsL1.story.jsx +2 -2
  22. package/core/components/organisms/pageHeader/__stories__/withFilter.story.jsx +2 -2
  23. package/core/components/organisms/pageHeader/__stories__/withFilterL1.story.jsx +2 -2
  24. package/core/components/organisms/pageHeader/__stories__/withNavigation.story.jsx +2 -2
  25. package/core/components/organisms/pageHeader/__stories__/withNavigationL1.story.jsx +2 -2
  26. package/core/components/organisms/pageHeader/__stories__/withStepperL1.story.jsx +4 -4
  27. package/core/components/organisms/table/__stories__/TableAsDescriptionList.story.jsx +4 -4
  28. package/core/components/organisms/timePicker/TimePicker.tsx +6 -113
  29. package/core/components/organisms/timePicker/TimePickerWithInput.tsx +124 -0
  30. package/core/components/organisms/timePicker/TimePickerWithSearch.tsx +198 -0
  31. package/core/components/organisms/timePicker/__stories__/TimeIntervals.story.jsx +52 -0
  32. package/core/components/organisms/timePicker/__stories__/disabledOption.story.jsx +52 -0
  33. package/core/components/organisms/timePicker/__stories__/fromTo.story.jsx +72 -0
  34. package/core/components/organisms/timePicker/__stories__/showDuration.story.jsx +52 -0
  35. package/core/components/organisms/timePicker/__stories__/withDatePicker.story.jsx +88 -0
  36. package/core/components/organisms/timePicker/__stories__/{index.story.jsx → withInput.story.jsx} +6 -3
  37. package/core/components/organisms/timePicker/__stories__/withSearch.story.jsx +89 -0
  38. package/core/components/organisms/timePicker/__tests__/TimePickerWithSearch.test.tsx +486 -0
  39. package/core/components/organisms/timePicker/__tests__/__snapshots__/TimePickerWithSearch.test.tsx.snap +169 -0
  40. package/core/components/organisms/timePicker/index.tsx +2 -0
  41. package/core/components/organisms/timePicker/utility/searchUtils.tsx +295 -0
  42. package/core/components/organisms/timePicker/utility/timePickerUtility.tsx +219 -0
  43. package/core/components/organisms/timePicker/utils.tsx +1 -1
  44. package/core/index.tsx +1 -0
  45. package/css/dist/index.css +4 -10
  46. package/css/dist/index.css.map +1 -1
  47. package/css/src/components/dropdown.css +2 -6
  48. package/css/src/components/metricInput.css +1 -0
  49. package/css/src/components/modal.css +1 -2
  50. package/dist/core/components/atoms/dropdown/Dropdown.d.ts +2 -0
  51. package/dist/core/components/atoms/dropdown/DropdownList.d.ts +1 -0
  52. package/dist/core/components/atoms/dropdown/utility.d.ts +1 -0
  53. package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +22 -22
  54. package/dist/core/components/organisms/timePicker/TimePicker.d.ts +5 -13
  55. package/dist/core/components/organisms/timePicker/TimePickerWithInput.d.ts +24 -0
  56. package/dist/core/components/organisms/timePicker/TimePickerWithSearch.d.ts +32 -0
  57. package/dist/core/components/organisms/timePicker/index.d.ts +2 -0
  58. package/dist/core/components/organisms/timePicker/utility/searchUtils.d.ts +7 -0
  59. package/dist/core/components/organisms/timePicker/utility/timePickerUtility.d.ts +19 -0
  60. package/dist/core/index.d.ts +1 -0
  61. package/dist/index.esm.js +709 -46
  62. package/dist/index.js +638 -68
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.umd.js +1 -1
  65. package/dist/index.umd.js.br +0 -0
  66. package/dist/index.umd.js.gz +0 -0
  67. package/docs/.eslintrc.json +32 -1
  68. package/docs/.prettierrc +6 -0
  69. package/docs/README.md +14 -0
  70. package/docs/cypress/e2e/main.cy.js +35 -0
  71. package/docs/cypress/fixtures/example.json +5 -0
  72. package/docs/cypress/support/commands.ts +37 -0
  73. package/docs/cypress/support/e2e.ts +20 -0
  74. package/docs/cypress.config.js +9 -0
  75. package/docs/package.json +16 -2
  76. package/docs/src/components/Colors/Colors.js +13 -41
  77. package/docs/src/components/Container/ComponentsContainer.js +10 -30
  78. package/docs/src/components/Container/Container.js +10 -41
  79. package/docs/src/components/ErrorBoundary.js +9 -3
  80. package/docs/src/components/Footer/Footer.js +11 -10
  81. package/docs/src/components/GlobalSearch/index.js +47 -44
  82. package/docs/src/components/Header/Header.css +4 -0
  83. package/docs/src/components/Header/Header.js +25 -19
  84. package/docs/src/components/Layout.js +110 -172
  85. package/docs/src/components/LeftNav/LeftNav.js +12 -28
  86. package/docs/src/components/Logos/Logos.js +12 -26
  87. package/docs/src/components/MDXHeading.js +12 -18
  88. package/docs/src/components/Meta.js +9 -9
  89. package/docs/src/components/PropsTable/ArgJsDoc.tsx +2 -6
  90. package/docs/src/components/PropsTable/ArgRow.tsx +19 -47
  91. package/docs/src/components/PropsTable/ArgValue.tsx +50 -93
  92. package/docs/src/components/PropsTable/EmptyBlock.tsx +2 -5
  93. package/docs/src/components/PropsTable/SectionRow.tsx +7 -18
  94. package/docs/src/components/PropsTable/Table.tsx +43 -130
  95. package/docs/src/components/PropsTable/generateImports.tsx +1 -3
  96. package/docs/src/components/PropsTable/index.js +94 -140
  97. package/docs/src/components/PropsTable/prism.css +19 -20
  98. package/docs/src/components/Rules/DONTs.js +1 -6
  99. package/docs/src/components/Rules/DOs.js +1 -6
  100. package/docs/src/components/Rules/IconWrapper.js +6 -7
  101. package/docs/src/components/Rules/InlineMessage.js +1 -5
  102. package/docs/src/components/Rules/Rules.js +18 -28
  103. package/docs/src/components/TableOfContent/TableOfContent.js +49 -54
  104. package/docs/src/components/css/global.css +1 -1
  105. package/docs/src/components/css/prism.css +1 -1
  106. package/docs/src/components/css/style.css +7 -3
  107. package/docs/src/components/templates/Default.js +1 -1
  108. package/docs/src/components/templates/Homepage.js +4 -6
  109. package/docs/src/data/components/Overview.js +49 -56
  110. package/docs/src/data/components/images/Calendar.png +0 -0
  111. package/docs/src/data/components/images/MetaList.png +0 -0
  112. package/docs/src/data/components/images/PageHeader.png +0 -0
  113. package/docs/src/data/components/images/TimePicker.png +0 -0
  114. package/docs/src/data/components/images/mobile/Badge.png +0 -0
  115. package/docs/src/data/components/images/mobile/Dropdown.png +0 -0
  116. package/docs/src/data/components/images/mobile/Message.png +0 -0
  117. package/docs/src/data/components/images/mobile/MetaList.png +0 -0
  118. package/docs/src/data/components/images/mobile/Slider.png +0 -0
  119. package/docs/src/data/components/images/mobile/StatusHint.png +0 -0
  120. package/docs/src/data/components/images/mobile/Stepper.png +0 -0
  121. package/docs/src/data/components/index.js +168 -321
  122. package/docs/src/data/components/mobile.js +85 -125
  123. package/docs/src/data/components/overview.css +4 -2
  124. package/docs/src/data/components/patterns.js +25 -59
  125. package/docs/src/data/header-items.yaml +1 -0
  126. package/docs/src/data/nav/components.yaml +1 -7
  127. package/docs/src/pages/404.js +7 -17
  128. package/docs/src/pages/components/avatar/usage.mdx +1 -0
  129. package/docs/src/pages/components/button/usage.mdx +2 -2
  130. package/docs/src/pages/components/calendar/usage.mdx +3 -3
  131. package/docs/src/pages/components/chips/images/actionchip-state.png +0 -0
  132. package/docs/src/pages/components/chips/images/inputchips-state.png +0 -0
  133. package/docs/src/pages/components/chips/images/selectionchip-state.png +0 -0
  134. package/docs/src/pages/components/chips/usage.mdx +24 -2
  135. package/docs/src/pages/components/datePicker/images/datePicker-3.png +0 -0
  136. package/docs/src/pages/components/datePicker/images/datePicker-6.png +0 -0
  137. package/docs/src/pages/components/datePicker/usage.mdx +9 -2
  138. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableField-2.png +0 -0
  139. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableField-3.png +0 -0
  140. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-1.png +0 -0
  141. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-4.png +0 -0
  142. package/docs/src/pages/components/inlineEditableFields/usage.mdx +4 -4
  143. package/docs/src/pages/components/inputs/usage.mdx +7 -7
  144. package/docs/src/pages/components/tabs/images/tabs-1.png +0 -0
  145. package/docs/src/pages/content/button-guidelines/tabs/button-glossary.mdx +1776 -1
  146. package/docs/src/pages/content/button-guidelines/tabs/confusing-buttons.mdx +479 -8
  147. package/docs/src/pages/content/email-guidelines.mdx +3 -3
  148. package/docs/src/pages/content/house-rules/tabs/date,-time-&-numbers.mdx +24 -0
  149. package/docs/src/pages/content/house-rules/tabs/grammer.mdx +42 -2
  150. package/docs/src/pages/content/house-rules/tabs/punctuations.mdx +32 -0
  151. package/docs/src/pages/foundations/colors.mdx +338 -24
  152. package/docs/src/pages/foundations/layout/index.mdx +57 -82
  153. package/docs/src/pages/foundations/response-time.mdx +32 -77
  154. package/docs/src/pages/index.js +92 -121
  155. package/docs/src/pages/mobile/components/badges/images/badge-1.png +0 -0
  156. package/docs/src/pages/mobile/components/badges/images/badge-2.png +0 -0
  157. package/docs/src/pages/mobile/components/badges/images/badge-3.png +0 -0
  158. package/docs/src/pages/mobile/components/badges/images/badge-4.png +0 -0
  159. package/docs/src/pages/mobile/components/badges/images/badge-5.png +0 -0
  160. package/docs/src/pages/mobile/components/badges/usage.mdx +100 -0
  161. package/docs/src/pages/mobile/components/card/images/mcard-1.png +0 -0
  162. package/docs/src/pages/mobile/components/card/images/mcard-2.png +0 -0
  163. package/docs/src/pages/mobile/components/card/images/mcard-3.png +0 -0
  164. package/docs/src/pages/mobile/components/card/images/mcard-4.png +0 -0
  165. package/docs/src/pages/mobile/components/card/images/mcard-5.png +0 -0
  166. package/docs/src/pages/mobile/components/card/images/mcard-6.png +0 -0
  167. package/docs/src/pages/mobile/components/card/usage.mdx +54 -67
  168. package/docs/src/pages/mobile/components/checkbox/images/checkbox-1.png +0 -0
  169. package/docs/src/pages/mobile/components/checkbox/usage.mdx +26 -2
  170. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-1.png +0 -0
  171. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-10.png +0 -0
  172. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-11.png +0 -0
  173. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-2.png +0 -0
  174. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-3.png +0 -0
  175. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-4.png +0 -0
  176. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-5.png +0 -0
  177. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-6.png +0 -0
  178. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-7.png +0 -0
  179. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-8.png +0 -0
  180. package/docs/src/pages/mobile/components/dropdowns/images/dropdown-9.png +0 -0
  181. package/docs/src/pages/mobile/components/dropdowns/usage.mdx +88 -0
  182. package/docs/src/pages/mobile/components/message/images/messages-1.png +0 -0
  183. package/docs/src/pages/mobile/components/message/images/messages-10.png +0 -0
  184. package/docs/src/pages/mobile/components/message/images/messages-11.png +0 -0
  185. package/docs/src/pages/mobile/components/message/images/messages-12.png +0 -0
  186. package/docs/src/pages/mobile/components/message/images/messages-2.png +0 -0
  187. package/docs/src/pages/mobile/components/message/images/messages-3.png +0 -0
  188. package/docs/src/pages/mobile/components/message/images/messages-4.png +0 -0
  189. package/docs/src/pages/mobile/components/message/images/messages-5.png +0 -0
  190. package/docs/src/pages/mobile/components/message/images/messages-6.png +0 -0
  191. package/docs/src/pages/mobile/components/message/images/messages-7.png +0 -0
  192. package/docs/src/pages/mobile/components/message/images/messages-8.png +0 -0
  193. package/docs/src/pages/mobile/components/message/images/messages-9.png +0 -0
  194. package/docs/src/pages/mobile/components/message/usage.mdx +170 -0
  195. package/docs/src/pages/mobile/components/metaList/images/metaList-1.png +0 -0
  196. package/docs/src/pages/mobile/components/metaList/images/metaList-2.png +0 -0
  197. package/docs/src/pages/mobile/components/metaList/images/metaList-3.png +0 -0
  198. package/docs/src/pages/mobile/components/metaList/images/metaList-4.png +0 -0
  199. package/docs/src/pages/mobile/components/metaList/usage.mdx +71 -0
  200. package/docs/src/pages/mobile/components/slider/images/slider-1.png +0 -0
  201. package/docs/src/pages/mobile/components/slider/images/slider-2.png +0 -0
  202. package/docs/src/pages/mobile/components/slider/images/slider-3.png +0 -0
  203. package/docs/src/pages/mobile/components/slider/images/slider-4.png +0 -0
  204. package/docs/src/pages/mobile/components/slider/images/slider-5.png +0 -0
  205. package/docs/src/pages/mobile/components/slider/usage.mdx +83 -0
  206. package/docs/src/pages/mobile/components/statusHint/images/statushint-1.png +0 -0
  207. package/docs/src/pages/mobile/components/statusHint/images/statushint-2.png +0 -0
  208. package/docs/src/pages/mobile/components/statusHint/images/statushint-3.png +0 -0
  209. package/docs/src/pages/mobile/components/statusHint/images/statushint-4.png +0 -0
  210. package/docs/src/pages/mobile/components/statusHint/images/statushint-5.png +0 -0
  211. package/docs/src/pages/mobile/components/statusHint/images/statushint-6.png +0 -0
  212. package/docs/src/pages/mobile/components/statusHint/images/statushint-7.png +0 -0
  213. package/docs/src/pages/mobile/components/statusHint/usage.mdx +108 -0
  214. package/docs/src/pages/mobile/components/steppers/images/stepper-1.png +0 -0
  215. package/docs/src/pages/mobile/components/steppers/images/stepper-2.png +0 -0
  216. package/docs/src/pages/mobile/components/steppers/images/stepper-3.png +0 -0
  217. package/docs/src/pages/mobile/components/steppers/images/stepper-4.png +0 -0
  218. package/docs/src/pages/mobile/components/steppers/images/stepper-5.png +0 -0
  219. package/docs/src/pages/mobile/components/steppers/images/stepper-6.png +0 -0
  220. package/docs/src/pages/mobile/components/steppers/usage.mdx +111 -0
  221. package/docs/src/pages/mobile/foundations/layout/images/layout-2.png +0 -0
  222. package/docs/src/pages/mobile/foundations/layout/index.mdx +3 -1
  223. package/docs/src/pages/mobile/foundations/page-types/index.mdx +0 -214
  224. package/docs/src/pages/mobile/foundations/spacing/index.mdx +5 -0
  225. package/docs/src/pages/mobile/foundations/typography.mdx +1 -1
  226. package/docs/src/pages/patterns/uiStates/usage.mdx +92 -0
  227. package/docs/src/util/Frontmatter.js +4 -4
  228. package/docs/src/util/HeaderItems.js +2 -1
  229. package/docs/src/util/Helpers.js +3 -3
  230. package/docs/src/util/HomeIcons.js +91 -53
  231. package/docs/src/util/InPageNavItems.js +2 -6
  232. package/docs/src/util/Logos.js +2 -2
  233. package/docs/src/util/MdsChangelog.js +5 -10
  234. package/docs/src/util/MediumBlogs.js +13 -13
  235. package/docs/src/util/NavItems.js +14 -17
  236. package/docs/src/util/Search.js +2 -2
  237. package/docs/src/util/StorybookData.js +2 -4
  238. package/docs/src/util/constants.js +1 -5
  239. package/docs/src/util/context/NavContext.js +1 -4
  240. package/docs/src/util/hooks/useMetadata.js +1 -1
  241. package/package.json +1 -1
  242. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-2.png +0 -0
  243. package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-3.png +0 -0
@@ -1,6 +1,6 @@
1
- import React, { useState } from "react";
2
- import { Heading, Icon, Tooltip } from "@innovaccer/design-system";
3
- import { copyMessage, copyMessageSuccess } from "../util/constants.js";
1
+ import React, { useState } from 'react';
2
+ import { Heading, Icon, Tooltip } from '@innovaccer/design-system';
3
+ import { copyMessage, copyMessageSuccess } from '../util/constants.js';
4
4
 
5
5
  const copyToClipboard = (str) => {
6
6
  navigator.clipboard.writeText(str);
@@ -23,22 +23,20 @@ const MDXHeading = ({ size, headingInfo }) => {
23
23
 
24
24
  if (currURL.includes(id)) {
25
25
  copyToClipboard(currURL);
26
- }
27
- else if (currURL.includes("#")) {
28
- copyToClipboard(currURL.slice(0, currURL.indexOf("#") + 1) + id);
29
- }
30
- else {
31
- copyToClipboard(currURL + "#" + id);
26
+ } else if (currURL.includes('#')) {
27
+ copyToClipboard(currURL.slice(0, currURL.indexOf('#') + 1) + id);
28
+ } else {
29
+ copyToClipboard(currURL + '#' + id);
32
30
  }
33
31
  setTooltipActive(true);
34
32
  setTooltipName(copyMessageSuccess);
35
33
  };
36
34
 
37
35
  const sizeMarginMapper = {
38
- s: "mt-4",
39
- m: "mt-4",
40
- l: "mt-6"
41
- }
36
+ s: 'mt-4',
37
+ m: 'mt-4',
38
+ l: 'mt-6',
39
+ };
42
40
 
43
41
  return (
44
42
  <div
@@ -47,11 +45,7 @@ const MDXHeading = ({ size, headingInfo }) => {
47
45
  onMouseLeave={onMouseLeaveHandler}
48
46
  className={`d-inline-flex w-100 align-items-center ${sizeMarginMapper[size]}`}
49
47
  >
50
- <Heading
51
- className="mr-4"
52
- size={size}
53
- {...headingInfo}
54
- />
48
+ <Heading className="mr-4" size={size} {...headingInfo} />
55
49
  <div className="cursor-pointer d-flex">
56
50
  {isHovered && (
57
51
  <Tooltip
@@ -6,7 +6,7 @@ const favicon = '/icons/favicon_io/favicon-16x16.png';
6
6
  const faviconLarge = '/icons/favicon_io/favicon-32x32.png';
7
7
  const faviconApple = '/icons/favicon_io/apple-touch-icon.png';
8
8
  const cardImage = '/icons/card-image.png';
9
- const GA_MEASUREMENT_ID = "G-HTLCYE0XZT";
9
+ const GA_MEASUREMENT_ID = 'G-HTLCYE0XZT';
10
10
 
11
11
  const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter, relativePagePath }) => {
12
12
  const { title, description, keywords, lang } = useMetadata();
@@ -32,9 +32,11 @@ const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter,
32
32
 
33
33
  function embedGoogleAnalytics() {
34
34
  // <!-- Global site tag (gtag.js) - Google Analytics -->
35
- if (typeof window !== "undefined") {
35
+ if (typeof window !== 'undefined') {
36
36
  window.dataLayer = window.dataLayer || [];
37
- function gtag() { window.dataLayer && window.dataLayer.push(arguments); }
37
+ function gtag() {
38
+ window.dataLayer && window.dataLayer.push(arguments);
39
+ }
38
40
  gtag('js', new Date());
39
41
  gtag('config', GA_MEASUREMENT_ID);
40
42
  }
@@ -105,14 +107,12 @@ const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter,
105
107
  ]}
106
108
  >
107
109
  <html lang={lang} />
108
- <link rel='icon' href={favicon} />
109
- <link rel='icon' href={faviconLarge} />
110
- <link rel='icon' href={faviconApple} />
110
+ <link rel="icon" href={favicon} />
111
+ <link rel="icon" href={faviconLarge} />
112
+ <link rel="icon" href={faviconApple} />
111
113
  {/* <!-- Global site tag (gtag.js) - Google Analytics --> */}
112
114
  <script async src={`https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`}></script>
113
- <script>
114
- {embedGoogleAnalytics()}
115
- </script>
115
+ <script>{embedGoogleAnalytics()}</script>
116
116
  </Helmet>
117
117
  );
118
118
  };
@@ -63,13 +63,9 @@ export const Table = styled.table(({ theme }) => ({
63
63
  }));
64
64
 
65
65
  export const ArgJsDoc: FC<ArgJsDocArgs> = ({ tags }) => {
66
- const params = (tags.params || []).filter(
67
- (x) => x.description
68
- );
66
+ const params = (tags.params || []).filter((x) => x.description);
69
67
  const hasDisplayableParams = params.length !== 0;
70
- const hasDisplayableReturns =
71
- tags.returns != null &&
72
- tags.returns.description != null;
68
+ const hasDisplayableReturns = tags.returns != null && tags.returns.description != null;
73
69
 
74
70
  if (!hasDisplayableParams && !hasDisplayableReturns) {
75
71
  return null;
@@ -44,15 +44,13 @@ const Description = styled.div(() => ({
44
44
  },
45
45
  }));
46
46
 
47
- const Type = styled.div<{ hasDescription: boolean }>(
48
- ({ hasDescription }) => ({
49
- color:
50
- theme.base === 'light'
51
- ? transparentize(0.1, theme.color.defaultText)
52
- : transparentize(0.2, theme.color.defaultText),
53
- marginTop: hasDescription ? 4 : 0,
54
- })
55
- );
47
+ const Type = styled.div<{ hasDescription: boolean }>(({ hasDescription }) => ({
48
+ color:
49
+ theme.base === 'light'
50
+ ? transparentize(0.1, theme.color.defaultText)
51
+ : transparentize(0.2, theme.color.defaultText),
52
+ marginTop: hasDescription ? 4 : 0,
53
+ }));
56
54
 
57
55
  const TypeWithJsDoc = styled.div<{
58
56
  hasDescription: boolean;
@@ -65,35 +63,24 @@ const TypeWithJsDoc = styled.div<{
65
63
  marginBottom: 12,
66
64
  }));
67
65
 
68
- const StyledTd = styled.td<{ expandable: boolean }>(
69
- ({ expandable }) => ({
70
- paddingLeft: '20px',
71
- })
72
- );
66
+ const StyledTd = styled.td<{ expandable: boolean }>(({ expandable }) => ({
67
+ paddingLeft: '20px',
68
+ }));
73
69
 
74
70
  export const ArgRow: FC<ArgRowProps> = (props) => {
75
- const {
76
- row,
77
- updateArgs,
78
- compact,
79
- initialExpandedArgs,
80
- } = props;
71
+ const { row, updateArgs, compact, initialExpandedArgs } = props;
81
72
  const { name, description } = row;
82
73
  const table = (row.table || {}) as TableAnnotation;
83
74
  const type = table.type || row.type;
84
- const defaultValue =
85
- table.defaultValue || row.defaultValue;
75
+ const defaultValue = table.defaultValue || row.defaultValue;
86
76
  const required = row.type?.required;
87
- const hasDescription =
88
- description != null && description !== '';
77
+ const hasDescription = description != null && description !== '';
89
78
 
90
79
  return (
91
80
  <tr>
92
81
  <StyledTd expandable={true}>
93
82
  <Name>{name}</Name>
94
- {required ? (
95
- <Required title="Required">*</Required>
96
- ) : null}
83
+ {required ? <Required title="Required">*</Required> : null}
97
84
  </StyledTd>
98
85
  {compact ? null : (
99
86
  <td>
@@ -104,39 +91,24 @@ export const ArgRow: FC<ArgRowProps> = (props) => {
104
91
  )}
105
92
  {table.jsDocTags != null ? (
106
93
  <>
107
- <TypeWithJsDoc
108
- hasDescription={hasDescription}
109
- >
110
- <ArgValue
111
- value={type}
112
- initialExpandedArgs={initialExpandedArgs}
113
- />
94
+ <TypeWithJsDoc hasDescription={hasDescription}>
95
+ <ArgValue value={type} initialExpandedArgs={initialExpandedArgs} />
114
96
  </TypeWithJsDoc>
115
97
  <ArgJsDoc tags={table.jsDocTags} />
116
98
  </>
117
99
  ) : (
118
100
  <Type hasDescription={hasDescription}>
119
- <ArgValue
120
- value={type}
121
- initialExpandedArgs={initialExpandedArgs}
122
- />
101
+ <ArgValue value={type} initialExpandedArgs={initialExpandedArgs} />
123
102
  </Type>
124
103
  )}
125
104
  </td>
126
105
  )}
127
106
  {compact ? null : (
128
107
  <td>
129
- <ArgValue
130
- value={defaultValue}
131
- initialExpandedArgs={initialExpandedArgs}
132
- />
108
+ <ArgValue value={defaultValue} initialExpandedArgs={initialExpandedArgs} />
133
109
  </td>
134
110
  )}
135
- {updateArgs ? (
136
- <td>
137
- {/* <ArgControl {...(props as ArgControlProps)} /> */}
138
- </td>
139
- ) : null}
111
+ {updateArgs ? <td>{/* <ArgControl {...(props as ArgControlProps)} /> */}</td> : null}
140
112
  </tr>
141
113
  );
142
114
  };
@@ -22,39 +22,34 @@ interface ArgSummaryProps {
22
22
 
23
23
  const ITEMS_BEFORE_EXPANSION = 8;
24
24
 
25
- const Summary = styled.div<{ isExpanded?: boolean }>(
26
- ({ isExpanded }) => ({
27
- display: 'flex',
28
- flexDirection: isExpanded ? 'column' : 'row',
29
- flexWrap: 'wrap',
30
- alignItems: 'flex-start',
31
- marginBottom: '-4px',
32
- minWidth: 100,
33
- })
34
- );
35
-
36
- const Text = styled.span<{ simple?: boolean }>(
37
- codeCommon,
38
- ({ simple = false }) => ({
39
- flex: '0 0 auto',
40
- fontFamily: theme.typography.fonts.mono,
41
- fontSize: '12px',
42
- wordBreak: 'break-word',
43
- whiteSpace: 'normal',
44
- maxWidth: '100%',
45
- margin: 0,
46
- marginRight: '4px',
47
- marginBottom: '4px',
48
- paddingTop: '2px',
49
- paddingBottom: '2px',
50
- lineHeight: '13px',
51
- ...(simple && {
52
- background: 'transparent',
53
- border: '0 none',
54
- paddingLeft: 0,
55
- }),
56
- })
57
- );
25
+ const Summary = styled.div<{ isExpanded?: boolean }>(({ isExpanded }) => ({
26
+ display: 'flex',
27
+ flexDirection: isExpanded ? 'column' : 'row',
28
+ flexWrap: 'wrap',
29
+ alignItems: 'flex-start',
30
+ marginBottom: '-4px',
31
+ minWidth: 100,
32
+ }));
33
+
34
+ const Text = styled.span<{ simple?: boolean }>(codeCommon, ({ simple = false }) => ({
35
+ flex: '0 0 auto',
36
+ fontFamily: theme.typography.fonts.mono,
37
+ fontSize: '12px',
38
+ wordBreak: 'break-word',
39
+ whiteSpace: 'normal',
40
+ maxWidth: '100%',
41
+ margin: 0,
42
+ marginRight: '4px',
43
+ marginBottom: '4px',
44
+ paddingTop: '2px',
45
+ paddingBottom: '2px',
46
+ lineHeight: '13px',
47
+ ...(simple && {
48
+ background: 'transparent',
49
+ border: '0 none',
50
+ paddingLeft: 0,
51
+ }),
52
+ }));
58
53
 
59
54
  const ExpandButton = styled.button<{}>(() => ({
60
55
  fontFamily: theme.typography?.fonts.mono,
@@ -64,18 +59,15 @@ const ExpandButton = styled.button<{}>(() => ({
64
59
  border: 'none',
65
60
  }));
66
61
 
67
- const Expandable = styled.div<{}>(
68
- codeCommon,
69
- ({ theme }) => ({
70
- fontFamily: theme.typography?.fonts.mono,
71
- color: theme.color?.secondary,
72
- fontSize: theme.typography?.size.s1, // overrides codeCommon
73
- margin: 0,
74
- whiteSpace: 'nowrap',
75
- display: 'flex',
76
- alignItems: 'center',
77
- })
78
- );
62
+ const Expandable = styled.div<{}>(codeCommon, ({ theme }) => ({
63
+ fontFamily: theme.typography?.fonts.mono,
64
+ color: theme.color?.secondary,
65
+ fontSize: theme.typography?.size.s1, // overrides codeCommon
66
+ margin: 0,
67
+ whiteSpace: 'nowrap',
68
+ display: 'flex',
69
+ alignItems: 'center',
70
+ }));
79
71
 
80
72
  const EmptyArg = () => {
81
73
  return <span>-</span>;
@@ -88,50 +80,32 @@ const ArgText: FC<ArgTextProps> = ({ text, simple }) => {
88
80
  const getSummaryItems = (summary: string) => {
89
81
  if (!summary) return [summary];
90
82
  const splittedItems = summary.split('|');
91
- const summaryItems = splittedItems.map((value) =>
92
- value.trim()
93
- );
83
+ const summaryItems = splittedItems.map((value) => value.trim());
94
84
 
95
85
  return uniq(summaryItems);
96
86
  };
97
87
 
98
- const renderSummaryItems = (
99
- summaryItems: string[],
100
- isExpanded = true
101
- ) => {
88
+ const renderSummaryItems = (summaryItems: string[], isExpanded = true) => {
102
89
  let items = summaryItems;
103
90
  if (!isExpanded) {
104
91
  items = summaryItems.slice(0, ITEMS_BEFORE_EXPANSION);
105
92
  }
106
93
 
107
- return items.map((item) => (
108
- <ArgText key={item} text={item === '' ? '""' : item} />
109
- ));
94
+ return items.map((item) => <ArgText key={item} text={item === '' ? '""' : item} />);
110
95
  };
111
96
 
112
- const ArgSummary: FC<ArgSummaryProps> = ({
113
- value,
114
- initialExpandedArgs,
115
- }) => {
97
+ const ArgSummary: FC<ArgSummaryProps> = ({ value, initialExpandedArgs }) => {
116
98
  const { summary, detail } = value;
117
99
 
118
- const [isExpanded, setIsExpanded] = useState(
119
- initialExpandedArgs || false
120
- );
100
+ const [isExpanded, setIsExpanded] = useState(initialExpandedArgs || false);
121
101
 
122
- if (summary === undefined || summary === null)
123
- return null;
102
+ if (summary === undefined || summary === null) return null;
124
103
  // summary is used for the default value
125
104
  // below check fixes not displaying default values for boolean typescript vars
126
- const summaryAsString =
127
- typeof summary.toString === 'function'
128
- ? summary.toString()
129
- : summary;
105
+ const summaryAsString = typeof summary.toString === 'function' ? summary.toString() : summary;
130
106
 
131
107
  if (detail == null) {
132
- const cannotBeSafelySplitted = /[(){}[\]<>]/.test(
133
- summaryAsString
134
- );
108
+ const cannotBeSafelySplitted = /[(){}[\]<>]/.test(summaryAsString);
135
109
 
136
110
  if (cannotBeSafelySplitted) {
137
111
  return <ArgText text={summaryAsString} />;
@@ -139,20 +113,13 @@ const ArgSummary: FC<ArgSummaryProps> = ({
139
113
 
140
114
  const summaryItems = getSummaryItems(summaryAsString);
141
115
  const itemsCount = summaryItems.length;
142
- const hasManyItems =
143
- itemsCount > ITEMS_BEFORE_EXPANSION;
116
+ const hasManyItems = itemsCount > ITEMS_BEFORE_EXPANSION;
144
117
 
145
118
  return hasManyItems ? (
146
119
  <Summary isExpanded={isExpanded}>
147
120
  {renderSummaryItems(summaryItems, isExpanded)}
148
- <ExpandButton
149
- onClick={() => setIsExpanded(!isExpanded)}
150
- >
151
- {isExpanded
152
- ? 'Show less...'
153
- : `Show ${
154
- itemsCount - ITEMS_BEFORE_EXPANSION
155
- } more...`}
121
+ <ExpandButton onClick={() => setIsExpanded(!isExpanded)}>
122
+ {isExpanded ? 'Show less...' : `Show ${itemsCount - ITEMS_BEFORE_EXPANSION} more...`}
156
123
  </ExpandButton>
157
124
  </Summary>
158
125
  ) : (
@@ -167,16 +134,6 @@ const ArgSummary: FC<ArgSummaryProps> = ({
167
134
  );
168
135
  };
169
136
 
170
- export const ArgValue: FC<ArgValueProps> = ({
171
- value,
172
- initialExpandedArgs,
173
- }) => {
174
- return value == null ? (
175
- <EmptyArg />
176
- ) : (
177
- <ArgSummary
178
- value={value}
179
- initialExpandedArgs={initialExpandedArgs}
180
- />
181
- );
137
+ export const ArgValue: FC<ArgValueProps> = ({ value, initialExpandedArgs }) => {
138
+ return value == null ? <EmptyArg /> : <ArgSummary value={value} initialExpandedArgs={initialExpandedArgs} />;
182
139
  };
@@ -3,8 +3,7 @@ import { styled } from '@storybook/theming';
3
3
  import { withReset } from './Shared';
4
4
 
5
5
  const Wrapper = styled.div<{}>(withReset, ({ theme }) => ({
6
- backgroundColor:
7
- theme.base === 'light' ? 'rgba(0,0,0,.01)' : 'rgba(255,255,255,.01)',
6
+ backgroundColor: theme.base === 'light' ? 'rgba(0,0,0,.01)' : 'rgba(255,255,255,.01)',
8
7
  borderRadius: theme.appBorderRadius,
9
8
  border: `1px dashed ${theme.appBorderColor}`,
10
9
  display: 'flex',
@@ -17,6 +16,4 @@ const Wrapper = styled.div<{}>(withReset, ({ theme }) => ({
17
16
  // fontSize: theme.typography.size.s2,
18
17
  }));
19
18
 
20
- export const EmptyBlock = (props: any) => (
21
- <Wrapper {...props} className="docblock-emptyblock" />
22
- );
19
+ export const EmptyBlock = (props: any) => <Wrapper {...props} className="docblock-emptyblock" />;
@@ -80,28 +80,21 @@ export const SectionRow: FC<SectionRowProps> = ({
80
80
  colSpan = 3,
81
81
  }) => {
82
82
  const [expanded, setExpanded] = useState(initialExpanded);
83
- const Level =
84
- level === 'subsection' ? Subsection : Section;
83
+ const Level = level === 'subsection' ? Subsection : Section;
85
84
  // @ts-ignore
86
85
  const itemCount = children?.length || 0;
87
- const caption =
88
- level === 'subsection'
89
- ? `${itemCount} item${itemCount !== 1 ? 's' : ''}`
90
- : '';
86
+ const caption = level === 'subsection' ? `${itemCount} item${itemCount !== 1 ? 's' : ''}` : '';
91
87
  const icon = expanded ? 'arrowdown' : 'arrowright';
92
88
 
93
- const helperText = `${expanded ? 'Hide' : 'Side'} ${
94
- level === 'subsection' ? itemCount : label
95
- } item${itemCount !== 1 ? 's' : ''}`;
89
+ const helperText = `${expanded ? 'Hide' : 'Side'} ${level === 'subsection' ? itemCount : label} item${
90
+ itemCount !== 1 ? 's' : ''
91
+ }`;
96
92
 
97
93
  return (
98
94
  <>
99
95
  <StyledTr title={helperText}>
100
96
  <Level colSpan={1}>
101
- <ClickIntercept
102
- onClick={(e) => setExpanded(!expanded)}
103
- tabIndex={0}
104
- >
97
+ <ClickIntercept onClick={(e) => setExpanded(!expanded)} tabIndex={0}>
105
98
  {helperText}
106
99
  </ClickIntercept>
107
100
  <FlexWrapper>
@@ -110,11 +103,7 @@ export const SectionRow: FC<SectionRowProps> = ({
110
103
  </FlexWrapper>
111
104
  </Level>
112
105
  <StyledTd colSpan={colSpan - 1}>
113
- <ClickIntercept
114
- onClick={(e) => setExpanded(!expanded)}
115
- tabIndex={-1}
116
- style={{ outline: 'none' }}
117
- >
106
+ <ClickIntercept onClick={(e) => setExpanded(!expanded)} tabIndex={-1} style={{ outline: 'none' }}>
118
107
  {helperText}
119
108
  </ClickIntercept>
120
109
  {expanded ? null : caption}