@laerdal/life-react-components 6.0.0-dev.7.full → 6.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 (315) hide show
  1. package/README.md +1 -1
  2. package/dist/Accordion/__tests__/AccordionMenu.test.tsx +42 -0
  3. package/dist/Accordion/__tests__/ContentAccordion.test.tsx +150 -0
  4. package/dist/AuthPage/__tests__/AuthPage.test.tsx +27 -0
  5. package/dist/Banners/__tests__/Banner.test.tsx +47 -0
  6. package/dist/Banners/__tests__/OverviewBanner.test.tsx +20 -0
  7. package/dist/Breadcrumb/__tests__/Breadcrumb.test.tsx +78 -0
  8. package/dist/Button/DualFunctionButton.cjs +4 -4
  9. package/dist/Button/DualFunctionButton.cjs.map +1 -1
  10. package/dist/Button/DualFunctionButton.d.ts +2 -2
  11. package/dist/Button/DualFunctionButton.js +4 -4
  12. package/dist/Button/DualFunctionButton.js.map +1 -1
  13. package/dist/Button/{Button.cjs → TextButton.cjs} +179 -92
  14. package/dist/Button/TextButton.cjs.map +1 -0
  15. package/dist/Button/TextButton.d.ts +70 -0
  16. package/dist/Button/{Button.js → TextButton.js} +178 -91
  17. package/dist/Button/TextButton.js.map +1 -0
  18. package/dist/Button/__tests__/BackButton.test.tsx +32 -0
  19. package/dist/Button/__tests__/Button.test.tsx +45 -0
  20. package/dist/Button/__tests__/DualButton.test.tsx +119 -0
  21. package/dist/Button/__tests__/TextButton.test.tsx +45 -0
  22. package/dist/Button/index.cjs +11 -11
  23. package/dist/Button/index.cjs.map +1 -1
  24. package/dist/Button/index.d.ts +2 -2
  25. package/dist/Button/index.js +2 -2
  26. package/dist/Button/index.js.map +1 -1
  27. package/dist/Card/HorizontalCard/__tests__/HorizontalCard.test.tsx +71 -0
  28. package/dist/Card/VerticalCard/{Card.cjs → VerticalCard.cjs} +62 -26
  29. package/dist/Card/VerticalCard/VerticalCard.cjs.map +1 -0
  30. package/dist/Card/VerticalCard/VerticalCard.d.ts +25 -0
  31. package/dist/Card/VerticalCard/{Card.js → VerticalCard.js} +62 -26
  32. package/dist/Card/VerticalCard/VerticalCard.js.map +1 -0
  33. package/dist/Card/VerticalCard/{CardBottomSection.cjs → VerticalCardBottomSection.cjs} +45 -27
  34. package/dist/Card/VerticalCard/VerticalCardBottomSection.cjs.map +1 -0
  35. package/dist/Card/VerticalCard/VerticalCardBottomSection.d.ts +53 -0
  36. package/dist/Card/VerticalCard/{CardBottomSection.js → VerticalCardBottomSection.js} +45 -27
  37. package/dist/Card/VerticalCard/VerticalCardBottomSection.js.map +1 -0
  38. package/dist/Card/VerticalCard/{CardMiddleSection.cjs → VerticalCardMiddleSection.cjs} +46 -23
  39. package/dist/Card/VerticalCard/VerticalCardMiddleSection.cjs.map +1 -0
  40. package/dist/Card/VerticalCard/VerticalCardMiddleSection.d.ts +42 -0
  41. package/dist/Card/VerticalCard/{CardMiddleSection.js → VerticalCardMiddleSection.js} +45 -23
  42. package/dist/Card/VerticalCard/VerticalCardMiddleSection.js.map +1 -0
  43. package/dist/Card/VerticalCard/{CardTopSection.cjs → VerticalCardTopSection.cjs} +18 -16
  44. package/dist/Card/VerticalCard/VerticalCardTopSection.cjs.map +1 -0
  45. package/dist/Card/VerticalCard/{CardTopSection.d.ts → VerticalCardTopSection.d.ts} +8 -8
  46. package/dist/Card/VerticalCard/{CardTopSection.js → VerticalCardTopSection.js} +17 -15
  47. package/dist/Card/VerticalCard/VerticalCardTopSection.js.map +1 -0
  48. package/dist/Card/VerticalCard/__tests__/VerticalCard.test.tsx +124 -0
  49. package/dist/Card/VerticalCard/index.cjs +25 -25
  50. package/dist/Card/VerticalCard/index.cjs.map +1 -1
  51. package/dist/Card/VerticalCard/index.d.ts +7 -7
  52. package/dist/Card/VerticalCard/index.js +7 -7
  53. package/dist/Card/VerticalCard/index.js.map +1 -1
  54. package/dist/Chips/ActionChip.cjs +6 -0
  55. package/dist/Chips/ActionChip.cjs.map +1 -1
  56. package/dist/Chips/ActionChip.js +6 -0
  57. package/dist/Chips/ActionChip.js.map +1 -1
  58. package/dist/Chips/ChipStyles.cjs +210 -31
  59. package/dist/Chips/ChipStyles.cjs.map +1 -1
  60. package/dist/Chips/ChipStyles.js +210 -31
  61. package/dist/Chips/ChipStyles.js.map +1 -1
  62. package/dist/Chips/ChoiceChips.cjs +1 -1
  63. package/dist/Chips/ChoiceChips.cjs.map +1 -1
  64. package/dist/Chips/ChoiceChips.js +1 -1
  65. package/dist/Chips/ChoiceChips.js.map +1 -1
  66. package/dist/Chips/FilterChip.cjs +8 -1
  67. package/dist/Chips/FilterChip.cjs.map +1 -1
  68. package/dist/Chips/FilterChip.js +8 -1
  69. package/dist/Chips/FilterChip.js.map +1 -1
  70. package/dist/Chips/InputChip.cjs +14 -0
  71. package/dist/Chips/InputChip.cjs.map +1 -1
  72. package/dist/Chips/InputChip.js +14 -0
  73. package/dist/Chips/InputChip.js.map +1 -1
  74. package/dist/Chips/__tests__/ActionChip.test.tsx +94 -0
  75. package/dist/Chips/__tests__/ChoiceChips.test.tsx +79 -0
  76. package/dist/Chips/__tests__/FilterChip.test.tsx +95 -0
  77. package/dist/Chips/__tests__/InputChip.test.tsx +155 -0
  78. package/dist/ChipsInput/ChipInputField.cjs +8 -2
  79. package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
  80. package/dist/ChipsInput/ChipInputField.js +8 -2
  81. package/dist/ChipsInput/ChipInputField.js.map +1 -1
  82. package/dist/ChipsInput/__tests__/ChipDropdownInput.test.tsx +100 -0
  83. package/dist/ChipsInput/__tests__/ChipInputFields.test.tsx +155 -0
  84. package/dist/Dropdown/DropdownContent.cjs +2 -2
  85. package/dist/Dropdown/DropdownContent.cjs.map +1 -1
  86. package/dist/Dropdown/DropdownContent.js +2 -2
  87. package/dist/Dropdown/DropdownContent.js.map +1 -1
  88. package/dist/Dropdown/__tests__/DropdownFilter.test.tsx +39 -0
  89. package/dist/Footer/Components/FooterTop.cjs +3 -0
  90. package/dist/Footer/Components/FooterTop.cjs.map +1 -1
  91. package/dist/Footer/Components/FooterTop.js +3 -0
  92. package/dist/Footer/Components/FooterTop.js.map +1 -1
  93. package/dist/Footer/__tests__/Footer.test.tsx +182 -0
  94. package/dist/GlobalNavigationBar/Logo.cjs +2 -1
  95. package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
  96. package/dist/GlobalNavigationBar/Logo.js +2 -1
  97. package/dist/GlobalNavigationBar/Logo.js.map +1 -1
  98. package/dist/GlobalNavigationBar/__tests__/Logo.test.tsx +39 -0
  99. package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +10 -1
  100. package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
  101. package/dist/GlobalNavigationBar/desktop/MainMenu.js +10 -1
  102. package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
  103. package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs +5 -4
  104. package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -1
  105. package/dist/GlobalNavigationBar/desktop/RightSideNav.js +6 -5
  106. package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -1
  107. package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +1 -1
  108. package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -1
  109. package/dist/GlobalNavigationBar/desktop/UserMenu.js +2 -2
  110. package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -1
  111. package/dist/GlobalNavigationBar/desktop/__tests__/DesktopActions.test.tsx +108 -0
  112. package/dist/GlobalNavigationBar/desktop/__tests__/ExtendedMainMenu.test.tsx +28 -0
  113. package/dist/GlobalNavigationBar/desktop/__tests__/MainMenu.test.tsx +55 -0
  114. package/dist/GlobalNavigationBar/desktop/__tests__/RightSideNav.test.tsx +45 -0
  115. package/dist/GlobalNavigationBar/desktop/__tests__/UserMenu.test.tsx +125 -0
  116. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
  117. package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
  118. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs +1 -1
  119. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs.map +1 -1
  120. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js +2 -2
  121. package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js.map +1 -1
  122. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenu.test.tsx +317 -0
  123. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuContent.test.tsx +294 -0
  124. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuHeader.test.tsx +195 -0
  125. package/dist/GlobalNavigationBar/types.cjs.map +1 -1
  126. package/dist/GlobalNavigationBar/types.d.ts +2 -2
  127. package/dist/GlobalNavigationBar/types.js.map +1 -1
  128. package/dist/HyperLink/HyperLink.cjs +18 -2
  129. package/dist/HyperLink/HyperLink.cjs.map +1 -1
  130. package/dist/HyperLink/HyperLink.d.ts +2 -0
  131. package/dist/HyperLink/HyperLink.js +18 -2
  132. package/dist/HyperLink/HyperLink.js.map +1 -1
  133. package/dist/HyperLink/styling.cjs +4 -0
  134. package/dist/HyperLink/styling.cjs.map +1 -1
  135. package/dist/HyperLink/styling.js +4 -0
  136. package/dist/HyperLink/styling.js.map +1 -1
  137. package/dist/InputFields/DatepickerField.cjs +21 -5
  138. package/dist/InputFields/DatepickerField.cjs.map +1 -1
  139. package/dist/InputFields/DatepickerField.d.ts +1 -1
  140. package/dist/InputFields/DatepickerField.js +21 -5
  141. package/dist/InputFields/DatepickerField.js.map +1 -1
  142. package/dist/InputFields/NumberField.cjs +4 -0
  143. package/dist/InputFields/NumberField.cjs.map +1 -1
  144. package/dist/InputFields/NumberField.js +4 -0
  145. package/dist/InputFields/NumberField.js.map +1 -1
  146. package/dist/InputFields/RadioButton.cjs +2 -2
  147. package/dist/InputFields/RadioButton.cjs.map +1 -1
  148. package/dist/InputFields/RadioButton.d.ts +4 -4
  149. package/dist/InputFields/RadioButton.js +2 -2
  150. package/dist/InputFields/RadioButton.js.map +1 -1
  151. package/dist/InputFields/__tests__/NumberField.test.tsx +67 -0
  152. package/dist/InputFields/__tests__/NumberInput.test.tsx +68 -0
  153. package/dist/InputFields/__tests__/QuickSearch.test.tsx +42 -0
  154. package/dist/InputFields/components/SearchBarInput.cjs +5 -0
  155. package/dist/InputFields/components/SearchBarInput.cjs.map +1 -1
  156. package/dist/InputFields/components/SearchBarInput.js +5 -0
  157. package/dist/InputFields/components/SearchBarInput.js.map +1 -1
  158. package/dist/LinearProgress/__tests__/LinearProgress.test.tsx +25 -0
  159. package/dist/List/__tests__/ListRow.test.tsx +18 -0
  160. package/dist/LoadingPage/__tests__/GlobalLoadingPage.test.tsx +23 -0
  161. package/dist/MiniProductCard/MiniProductCard.cjs +15 -1
  162. package/dist/MiniProductCard/MiniProductCard.cjs.map +1 -1
  163. package/dist/MiniProductCard/MiniProductCard.d.ts +1 -0
  164. package/dist/MiniProductCard/MiniProductCard.js +15 -1
  165. package/dist/MiniProductCard/MiniProductCard.js.map +1 -1
  166. package/dist/Modals/ModalContainer.cjs +102 -83
  167. package/dist/Modals/ModalContainer.cjs.map +1 -1
  168. package/dist/Modals/ModalContainer.d.ts +20 -1
  169. package/dist/Modals/ModalContainer.js +103 -84
  170. package/dist/Modals/ModalContainer.js.map +1 -1
  171. package/dist/Modals/ModalContent.cjs +7 -3
  172. package/dist/Modals/ModalContent.cjs.map +1 -1
  173. package/dist/Modals/ModalContent.js +8 -4
  174. package/dist/Modals/ModalContent.js.map +1 -1
  175. package/dist/Modals/ModalDialog.cjs +2 -2
  176. package/dist/Modals/ModalDialog.cjs.map +1 -1
  177. package/dist/Modals/ModalDialog.js +3 -3
  178. package/dist/Modals/ModalDialog.js.map +1 -1
  179. package/dist/Modals/ModalStyles.cjs +12 -0
  180. package/dist/Modals/ModalStyles.cjs.map +1 -1
  181. package/dist/Modals/ModalStyles.js +12 -0
  182. package/dist/Modals/ModalStyles.js.map +1 -1
  183. package/dist/Modals/ModalTypes.cjs.map +1 -1
  184. package/dist/Modals/ModalTypes.d.ts +3 -3
  185. package/dist/Modals/ModalTypes.js.map +1 -1
  186. package/dist/Modals/__tests__/Modal.test.tsx +169 -0
  187. package/dist/Modals/__tests__/ModalContainer.test.tsx +77 -0
  188. package/dist/Modals/__tests__/ModalContent.test.tsx +126 -0
  189. package/dist/NavItem/NavItem.cjs +7 -1
  190. package/dist/NavItem/NavItem.cjs.map +1 -1
  191. package/dist/NavItem/NavItem.js +7 -1
  192. package/dist/NavItem/NavItem.js.map +1 -1
  193. package/dist/NavItem/__tests__/NavItem.test.ts +6 -0
  194. package/dist/Navigation/NavigationProvider.cjs.map +1 -1
  195. package/dist/Navigation/NavigationProvider.d.ts +3 -0
  196. package/dist/Navigation/NavigationProvider.js.map +1 -1
  197. package/dist/NotificationDot/__tests__/NotificationDot.test.tsx +33 -0
  198. package/dist/Paginator/Paginator.cjs +18 -14
  199. package/dist/Paginator/Paginator.cjs.map +1 -1
  200. package/dist/Paginator/Paginator.d.ts +1 -5
  201. package/dist/Paginator/Paginator.js +18 -14
  202. package/dist/Paginator/Paginator.js.map +1 -1
  203. package/dist/Paginator/__tests__/Paginator.test.tsx +33 -0
  204. package/dist/Popover/Popover.cjs +1 -1
  205. package/dist/Popover/Popover.cjs.map +1 -1
  206. package/dist/Popover/Popover.js +2 -2
  207. package/dist/Popover/Popover.js.map +1 -1
  208. package/dist/Popover/__tests__/Popover.test.tsx +64 -0
  209. package/dist/ProfileButton/__tests__/ProfileButton.test.tsx +31 -0
  210. package/dist/QuizButton/__tests__/QuizButton.test.tsx +53 -0
  211. package/dist/SegmentControl/__tests__/SegmentControl.test.tsx +145 -0
  212. package/dist/SideMenu/SideMenuFooter.cjs +1 -1
  213. package/dist/SideMenu/SideMenuFooter.cjs.map +1 -1
  214. package/dist/SideMenu/SideMenuFooter.js +2 -2
  215. package/dist/SideMenu/SideMenuFooter.js.map +1 -1
  216. package/dist/SideMenu/__tests__/SideMenu.test.tsx +99 -0
  217. package/dist/SideMenu/types.cjs.map +1 -1
  218. package/dist/SideMenu/types.d.ts +2 -2
  219. package/dist/SideMenu/types.js.map +1 -1
  220. package/dist/Switcher/__tests__/SwitcherMenuItem.tsx +14 -0
  221. package/dist/Table/TableBody.cjs +1 -1
  222. package/dist/Table/TableBody.cjs.map +1 -1
  223. package/dist/Table/TableBody.js +2 -2
  224. package/dist/Table/TableBody.js.map +1 -1
  225. package/dist/Table/TableStyles.cjs +4 -1
  226. package/dist/Table/TableStyles.cjs.map +1 -1
  227. package/dist/Table/TableStyles.js +4 -1
  228. package/dist/Table/TableStyles.js.map +1 -1
  229. package/dist/Table/TableTypes.cjs.map +1 -1
  230. package/dist/Table/TableTypes.d.ts +2 -2
  231. package/dist/Table/TableTypes.js.map +1 -1
  232. package/dist/Table/__tests__/Table.test.tsx +499 -0
  233. package/dist/Tabs/VerticalTabs.cjs +1 -0
  234. package/dist/Tabs/VerticalTabs.cjs.map +1 -1
  235. package/dist/Tabs/VerticalTabs.js +1 -0
  236. package/dist/Tabs/VerticalTabs.js.map +1 -1
  237. package/dist/Tabs/__tests__/HorizontalTabs.test.tsx +95 -0
  238. package/dist/Tabs/__tests__/TabLink.test.tsx +40 -0
  239. package/dist/Tabs/__tests__/Tablist.test.tsx +37 -0
  240. package/dist/Tag/Tag.cjs +48 -12
  241. package/dist/Tag/Tag.cjs.map +1 -1
  242. package/dist/Tag/Tag.js +48 -12
  243. package/dist/Tag/Tag.js.map +1 -1
  244. package/dist/Tag/__tests__/Tag.test.tsx +86 -0
  245. package/dist/Tile/TileCommonItems.cjs +1 -1
  246. package/dist/Tile/TileCommonItems.cjs.map +1 -1
  247. package/dist/Tile/TileCommonItems.js +2 -2
  248. package/dist/Tile/TileCommonItems.js.map +1 -1
  249. package/dist/Tile/TileTypes.cjs.map +1 -1
  250. package/dist/Tile/TileTypes.d.ts +2 -2
  251. package/dist/Tile/TileTypes.js.map +1 -1
  252. package/dist/Toasters/Toast.cjs +1 -2
  253. package/dist/Toasters/Toast.cjs.map +1 -1
  254. package/dist/Toasters/Toast.js +2 -3
  255. package/dist/Toasters/Toast.js.map +1 -1
  256. package/dist/Toasters/__tests__/Toast.test.tsx +74 -0
  257. package/dist/Toggles/TogglerStyles.cjs +171 -15
  258. package/dist/Toggles/TogglerStyles.cjs.map +1 -1
  259. package/dist/Toggles/TogglerStyles.js +171 -15
  260. package/dist/Toggles/TogglerStyles.js.map +1 -1
  261. package/dist/Toggles/__tests__/ToggleButton.test.tsx +53 -0
  262. package/dist/Toggles/__tests__/ToggleSwitch.test.tsx +87 -0
  263. package/dist/Tooltips/__tests__/TooltipWrapper.test.tsx +16 -0
  264. package/dist/common/NavigationHelper.cjs +0 -28
  265. package/dist/common/NavigationHelper.cjs.map +1 -1
  266. package/dist/common/NavigationHelper.d.ts +0 -4
  267. package/dist/common/NavigationHelper.js +1 -22
  268. package/dist/common/NavigationHelper.js.map +1 -1
  269. package/dist/styles/colors.cjs +6 -0
  270. package/dist/styles/colors.cjs.map +1 -1
  271. package/dist/styles/colors.d.ts +6 -0
  272. package/dist/styles/colors.js +6 -0
  273. package/dist/styles/colors.js.map +1 -1
  274. package/dist/styles/design-tokens/dark/tokens.css +481 -0
  275. package/dist/styles/design-tokens/light/tokens.css +481 -0
  276. package/dist/styles/design-tokens/rqi_dark/tokens.css +481 -0
  277. package/dist/styles/design-tokens/rqi_light/tokens.css +481 -0
  278. package/dist/styles/global.cjs +4 -4
  279. package/dist/styles/global.cjs.map +1 -1
  280. package/dist/styles/global.js +4 -4
  281. package/dist/styles/global.js.map +1 -1
  282. package/dist/styles/react-datepicker.css +766 -0
  283. package/dist/styles/typography.cjs +4 -1
  284. package/dist/styles/typography.cjs.map +1 -1
  285. package/dist/styles/typography.js +4 -1
  286. package/dist/styles/typography.js.map +1 -1
  287. package/dist/test-utils.cjs +7 -1
  288. package/dist/test-utils.cjs.map +1 -1
  289. package/dist/test-utils.js +7 -1
  290. package/dist/test-utils.js.map +1 -1
  291. package/package.json +11 -6
  292. package/dist/Button/Button.cjs.map +0 -1
  293. package/dist/Button/Button.d.ts +0 -70
  294. package/dist/Button/Button.js.map +0 -1
  295. package/dist/Card/VerticalCard/Card.cjs.map +0 -1
  296. package/dist/Card/VerticalCard/Card.d.ts +0 -24
  297. package/dist/Card/VerticalCard/Card.js.map +0 -1
  298. package/dist/Card/VerticalCard/CardBottomSection.cjs.map +0 -1
  299. package/dist/Card/VerticalCard/CardBottomSection.d.ts +0 -49
  300. package/dist/Card/VerticalCard/CardBottomSection.js.map +0 -1
  301. package/dist/Card/VerticalCard/CardMiddleSection.cjs.map +0 -1
  302. package/dist/Card/VerticalCard/CardMiddleSection.d.ts +0 -37
  303. package/dist/Card/VerticalCard/CardMiddleSection.js.map +0 -1
  304. package/dist/Card/VerticalCard/CardTopSection.cjs.map +0 -1
  305. package/dist/Card/VerticalCard/CardTopSection.js.map +0 -1
  306. package/dist/GlobalNavigationBar/__tests__/GlobalNavigationBar.tests.d.ts +0 -1
  307. package/dist/GlobalNavigationBar/__tests__/Logo.tests.d.ts +0 -1
  308. package/dist/List/__tests__/ListRow.tests.d.ts +0 -1
  309. package/dist/Tabs/__tests__/TabLink.tests.d.ts +0 -1
  310. package/dist/Tabs/__tests__/Tablist.tests.d.ts +0 -2
  311. package/dist/common/Link.cjs +0 -45
  312. package/dist/common/Link.cjs.map +0 -1
  313. package/dist/common/Link.d.ts +0 -9
  314. package/dist/common/Link.js +0 -37
  315. package/dist/common/Link.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TableTypes.js","names":[],"sources":["../../src/Table/TableTypes.ts"],"sourcesContent":["/**\r\n * Types for the table.\r\n */\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {ButtonProps} from '../Button/Button';\r\nimport {IconButtonProps} from '../Button/Iconbutton';\r\nimport {HyperlinkProps} from '../HyperLink/HyperLink';\r\n\r\nexport interface TableProps {\r\n /**\r\n * Optional. The title of the table. If provided, a header row will be rendered.\r\n */\r\n title?: string;\r\n\r\n /**\r\n * Required. An array of TableColumn objects, each representing a column in the table.\r\n */\r\n columns: TableColumn[];\r\n\r\n /**\r\n * Required. An array of objects, each representing a row in the table.\r\n */\r\n rows: any[];\r\n\r\n /**\r\n * Optional. A boolean indicating whether the table should have borders.\r\n */\r\n border?: boolean;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the table should be rendered as an accordion table.\r\n * If set to 'true' then there will be no pagination, and all rows will be shown on the first page without pagination controls.\r\n */\r\n accordion?: boolean;\r\n\r\n /**\r\n * Optional. A boolean indicating initial state of the table if it is shown in 'accordion' mode, if set to true, it will be collapsed.\r\n */\r\n collapsed?: boolean;\r\n\r\n /**\r\n * Optional. The number of rows to show when the table is shown in accordion mode and collapsed.\r\n */\r\n collapsedRows?: number;\r\n\r\n /**\r\n * Optional. An object of type TableSortProps, representing the properties for sorting the table.\r\n */\r\n sortProps?: TableSortProps;\r\n\r\n /**\r\n * Optional. A boolean indicating whether pagination should be done remotely.\r\n */\r\n remoteOperations?: boolean;\r\n\r\n /**\r\n * Optional. An object of type TablePagination, representing the properties for paginating the table.\r\n * Required only if 'remoteOperations' is set to true.\r\n */\r\n pagination?: TablePagination;\r\n\r\n /**\r\n * Optional. A function to be called when the previous page button is clicked.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onPreviousPageClick?: () => void;\r\n\r\n /**\r\n * Optional. A function to be called when the next page button is clicked.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onNextPageClick?: () => void;\r\n\r\n /**\r\n * Optional. A function to be called when the number of rows per page changes.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onRowsPerPageChange?: (count: number) => void;\r\n\r\n /**\r\n * Optional. A function to be called when the sorting direction changes.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onTriggerSortingChange?: (key: string, direction?: TableSortingDirection) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a loading indicator should be shown.\r\n */\r\n showLoadingIndicator?: boolean;\r\n\r\n /**\r\n * Optional. The label to be shown next to the rows per page selector.\r\n * Defaults to 'Rows per page'.\r\n */\r\n rowsPerPageLabel? :string;\r\n\r\n /**\r\n * Optional. The label to be shown when there are no rows in the grid.\r\n * Defaults to 'There are no rows to display'\r\n */\r\n noRowsLabel?: string;\r\n\r\n /**\r\n * Optional. The label to be shown for 'accordion' grid when table is in collapsed state.\r\n * Defaults to 'Show more'\r\n */\r\n showMoreLabel?: string;\r\n\r\n /**\r\n * Optional. The label to be shown for 'accordion' grid when user can 'collapse' some of the rows.\r\n * Defaults to 'Show more'\r\n */\r\n showFewerLabel?: string;\r\n\r\n /**\r\n * Optional. An object representing the properties for a dropdown menu shown in the header of table.\r\n */\r\n menu?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width' | 'itemsType' | 'multiSelect'>;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the rows in the table should be selectable.\r\n */\r\n selectable?: boolean;\r\n\r\n /**\r\n * Optional. A function to be called when some of the rows get selected or unselected.\r\n */\r\n onSelectionChange?: (value: any | any[]) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether multiple rows can be selected at once.\r\n */\r\n multiSelect?: boolean;\r\n\r\n /**\r\n * Optional. The key to be used as the unique identifier for each row.\r\n */\r\n keyExpr?: string;\r\n\r\n /** Optional. Defines initial state of rows (selected/unselected). */\r\n selectedRows?: any[];\r\n\r\n /** Optional. Z-Index html attribute to be set to loading indicator. */\r\n loaderZIndex?: string;\r\n\r\n /** Optional. Sets value for 'table-layout' css props of Table tag.\r\n * If not provided then 'table-layout' will not be set.\r\n */\r\n layout?: TableLayout;\r\n}\r\n\r\nexport interface TableSortProps {\r\n column: string;\r\n direction: TableSortingDirection;\r\n allowClearingSort?: boolean;\r\n}\r\n\r\nexport interface TableColumn {\r\n /**\r\n * Required. The key of the column. This should match a key in the row data.\r\n */\r\n key: string;\r\n\r\n /**\r\n * Optional. The key of the note to be displayed in the column.\r\n */\r\n noteKey?: string;\r\n\r\n /**\r\n * Required. The name of the column. This will be displayed in the column header.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Optional. The value to be used for filtering the column.\r\n */\r\n filterValue?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed in the column.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The width of the column. Can be specified as a string (e.g., '100px') or a number (e.g., 100).\r\n */\r\n width?: string | number;\r\n\r\n /**\r\n * Optional. A function that returns the color for a cell in the column.\r\n */\r\n colorFn?: (row: any, key: string) => string;\r\n\r\n /**\r\n * Optional. The text alignment for the column. Can be 'right', 'left', or 'center'.\r\n */\r\n justify?: TableJustification;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the text in the column should be shortened.\r\n */\r\n shortenText?: boolean;\r\n\r\n /**\r\n * Optional. A function to be called when an action is performed on a cell in the column.\r\n */\r\n action?: (row: any, event: any) => void;\r\n\r\n /**\r\n * Optional. The type of the column. Can be 'text', 'boolean', 'number', 'custom', 'button', 'icon', or 'link'.\r\n */\r\n type?: TableColumnTypes;\r\n\r\n /**\r\n * Optional. Additional properties for the column.\r\n */\r\n additionalProps?: Pick<ButtonProps, 'variant' | 'size' | 'width' | 'icon'> | Pick<IconButtonProps, 'variant' | 'shape' | 'disabled' | 'tooltip'> | Pick<HyperlinkProps, 'variant'>;\r\n\r\n /**\r\n * Optional. A function that returns custom content for a cell in the column.\r\n * Will be used only for button of type 'custom'\r\n */\r\n customContent?: (row: any, key: string) => any;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the column is sortable.\r\n */\r\n sortable?: boolean;\r\n}\r\n\r\nexport type TableColumnTypes = 'text' | 'boolean' | 'number' | 'custom' | 'button' | 'icon' | 'link';\r\n\r\nexport type TableJustification = 'right' | 'left' | 'center';\r\n\r\nexport type TableSortingDirection = 'asc' | 'desc';\r\n\r\nexport type TableLayout = 'auto' | 'fixed';\r\n\r\nexport interface TablePagination {\r\n from: number;\r\n to: number;\r\n total: number;\r\n currentPage: number;\r\n rowsPerPage: number;\r\n}\r\n\r\n// will override component properties in case of button, icon and link\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"TableTypes.js","names":[],"sources":["../../src/Table/TableTypes.ts"],"sourcesContent":["/**\r\n * Types for the table.\r\n */\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {TextButtonProps} from '../Button/TextButton';\r\nimport {IconButtonProps} from '../Button/Iconbutton';\r\nimport {HyperlinkProps} from '../HyperLink/HyperLink';\r\n\r\nexport interface TableProps {\r\n /**\r\n * Optional. The title of the table. If provided, a header row will be rendered.\r\n */\r\n title?: string;\r\n\r\n /**\r\n * Required. An array of TableColumn objects, each representing a column in the table.\r\n */\r\n columns: TableColumn[];\r\n\r\n /**\r\n * Required. An array of objects, each representing a row in the table.\r\n */\r\n rows: any[];\r\n\r\n /**\r\n * Optional. A boolean indicating whether the table should have borders.\r\n */\r\n border?: boolean;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the table should be rendered as an accordion table.\r\n * If set to 'true' then there will be no pagination, and all rows will be shown on the first page without pagination controls.\r\n */\r\n accordion?: boolean;\r\n\r\n /**\r\n * Optional. A boolean indicating initial state of the table if it is shown in 'accordion' mode, if set to true, it will be collapsed.\r\n */\r\n collapsed?: boolean;\r\n\r\n /**\r\n * Optional. The number of rows to show when the table is shown in accordion mode and collapsed.\r\n */\r\n collapsedRows?: number;\r\n\r\n /**\r\n * Optional. An object of type TableSortProps, representing the properties for sorting the table.\r\n */\r\n sortProps?: TableSortProps;\r\n\r\n /**\r\n * Optional. A boolean indicating whether pagination should be done remotely.\r\n */\r\n remoteOperations?: boolean;\r\n\r\n /**\r\n * Optional. An object of type TablePagination, representing the properties for paginating the table.\r\n * Required only if 'remoteOperations' is set to true.\r\n */\r\n pagination?: TablePagination;\r\n\r\n /**\r\n * Optional. A function to be called when the previous page button is clicked.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onPreviousPageClick?: () => void;\r\n\r\n /**\r\n * Optional. A function to be called when the next page button is clicked.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onNextPageClick?: () => void;\r\n\r\n /**\r\n * Optional. A function to be called when the number of rows per page changes.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onRowsPerPageChange?: (count: number) => void;\r\n\r\n /**\r\n * Optional. A function to be called when the sorting direction changes.\r\n * Will be called only if 'remoteOperations' is set to true.\r\n */\r\n onTriggerSortingChange?: (key: string, direction?: TableSortingDirection) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a loading indicator should be shown.\r\n */\r\n showLoadingIndicator?: boolean;\r\n\r\n /**\r\n * Optional. The label to be shown next to the rows per page selector.\r\n * Defaults to 'Rows per page'.\r\n */\r\n rowsPerPageLabel? :string;\r\n\r\n /**\r\n * Optional. The label to be shown when there are no rows in the grid.\r\n * Defaults to 'There are no rows to display'\r\n */\r\n noRowsLabel?: string;\r\n\r\n /**\r\n * Optional. The label to be shown for 'accordion' grid when table is in collapsed state.\r\n * Defaults to 'Show more'\r\n */\r\n showMoreLabel?: string;\r\n\r\n /**\r\n * Optional. The label to be shown for 'accordion' grid when user can 'collapse' some of the rows.\r\n * Defaults to 'Show more'\r\n */\r\n showFewerLabel?: string;\r\n\r\n /**\r\n * Optional. An object representing the properties for a dropdown menu shown in the header of table.\r\n */\r\n menu?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width' | 'itemsType' | 'multiSelect'>;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the rows in the table should be selectable.\r\n */\r\n selectable?: boolean;\r\n\r\n /**\r\n * Optional. A function to be called when some of the rows get selected or unselected.\r\n */\r\n onSelectionChange?: (value: any | any[]) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether multiple rows can be selected at once.\r\n */\r\n multiSelect?: boolean;\r\n\r\n /**\r\n * Optional. The key to be used as the unique identifier for each row.\r\n */\r\n keyExpr?: string;\r\n\r\n /** Optional. Defines initial state of rows (selected/unselected). */\r\n selectedRows?: any[];\r\n\r\n /** Optional. Z-Index html attribute to be set to loading indicator. */\r\n loaderZIndex?: string;\r\n\r\n /** Optional. Sets value for 'table-layout' css props of Table tag.\r\n * If not provided then 'table-layout' will not be set.\r\n */\r\n layout?: TableLayout;\r\n}\r\n\r\nexport interface TableSortProps {\r\n column: string;\r\n direction: TableSortingDirection;\r\n allowClearingSort?: boolean;\r\n}\r\n\r\nexport interface TableColumn {\r\n /**\r\n * Required. The key of the column. This should match a key in the row data.\r\n */\r\n key: string;\r\n\r\n /**\r\n * Optional. The key of the note to be displayed in the column.\r\n */\r\n noteKey?: string;\r\n\r\n /**\r\n * Required. The name of the column. This will be displayed in the column header.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Optional. The value to be used for filtering the column.\r\n */\r\n filterValue?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed in the column.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The width of the column. Can be specified as a string (e.g., '100px') or a number (e.g., 100).\r\n */\r\n width?: string | number;\r\n\r\n /**\r\n * Optional. A function that returns the color for a cell in the column.\r\n */\r\n colorFn?: (row: any, key: string) => string;\r\n\r\n /**\r\n * Optional. The text alignment for the column. Can be 'right', 'left', or 'center'.\r\n */\r\n justify?: TableJustification;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the text in the column should be shortened.\r\n */\r\n shortenText?: boolean;\r\n\r\n /**\r\n * Optional. A function to be called when an action is performed on a cell in the column.\r\n */\r\n action?: (row: any, event: any) => void;\r\n\r\n /**\r\n * Optional. The type of the column. Can be 'text', 'boolean', 'number', 'custom', 'button', 'icon', or 'link'.\r\n */\r\n type?: TableColumnTypes;\r\n\r\n /**\r\n * Optional. Additional properties for the column.\r\n */\r\n additionalProps?: Pick<TextButtonProps, 'variant' | 'size' | 'width' | 'icon'> | Pick<IconButtonProps, 'variant' | 'shape' | 'disabled' | 'tooltip'> | Pick<HyperlinkProps, 'variant'>;\r\n\r\n /**\r\n * Optional. A function that returns custom content for a cell in the column.\r\n * Will be used only for button of type 'custom'\r\n */\r\n customContent?: (row: any, key: string) => any;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the column is sortable.\r\n */\r\n sortable?: boolean;\r\n}\r\n\r\nexport type TableColumnTypes = 'text' | 'boolean' | 'number' | 'custom' | 'button' | 'icon' | 'link';\r\n\r\nexport type TableJustification = 'right' | 'left' | 'center';\r\n\r\nexport type TableSortingDirection = 'asc' | 'desc';\r\n\r\nexport type TableLayout = 'auto' | 'fixed';\r\n\r\nexport interface TablePagination {\r\n from: number;\r\n to: number;\r\n total: number;\r\n currentPage: number;\r\n rowsPerPage: number;\r\n}\r\n\r\n// will override component properties in case of button, icon and link\r\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,499 @@
1
+ import React from 'react';
2
+ /**
3
+ * Import React libraries.
4
+ */
5
+ import { render } from '../../test-utils';
6
+
7
+ /**
8
+ * Import custom components.
9
+ */
10
+ import { Table } from '../index';
11
+
12
+ /**
13
+ * Import third-party libraries.
14
+ */
15
+ import 'jest-styled-components';
16
+
17
+ /**
18
+ * Import custom types.
19
+ */
20
+ import { TableColumn } from '../TableTypes';
21
+ import {StyledTableBodyRow, StyledTableFooterCollapseButton} from '../TableStyles';
22
+ import { act } from "react";
23
+
24
+
25
+
26
+ describe('<Table />', () => {
27
+ it('Renders the Table', () => {
28
+ const columns: TableColumn[] = [
29
+ {
30
+ key: 'column1',
31
+ name: 'Column 1',
32
+ },
33
+ {
34
+ key: 'column2',
35
+ name: 'Column 2',
36
+ },
37
+ ];
38
+ const rows: any[] = [
39
+ {
40
+ column1: 'Test content',
41
+ column2: 'Test content 2',
42
+ },
43
+ ];
44
+ const { getByTestId } = render(<Table rows={rows} columns={columns} title="Test title" />);
45
+ expect(getByTestId('TestTable')).toBeDefined();
46
+ });
47
+
48
+ describe('Table Header Row Tests', () => {
49
+ it('Should render table header row in case title is passed', () => {
50
+ const columns: TableColumn[] = [
51
+ {
52
+ key: 'column1',
53
+ name: 'Column 1',
54
+ },
55
+ {
56
+ key: 'column2',
57
+ name: 'Column 2',
58
+ },
59
+ ];
60
+ const rows: any[] = [
61
+ {
62
+ column1: 'Test content',
63
+ column2: 'Test content 2',
64
+ },
65
+ ];
66
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} title="Test title" />);
67
+ expect(queryByTestId('TestTableHeaderRow')).not.toBeNull();
68
+ });
69
+
70
+ it('Should not render table header row in case title is passed', () => {
71
+ const columns: TableColumn[] = [
72
+ {
73
+ key: 'column1',
74
+ name: 'Column 1',
75
+ },
76
+ {
77
+ key: 'column2',
78
+ name: 'Column 2',
79
+ },
80
+ ];
81
+ const rows: any[] = [
82
+ {
83
+ column1: 'Test content',
84
+ column2: 'Test content 2',
85
+ },
86
+ ];
87
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} />);
88
+ expect(queryByTestId('TestTableHeaderRow')).toBeNull();
89
+ });
90
+
91
+ describe('Table Header Row functional tests', () => {
92
+ it('Should have title', () => {
93
+ const columns: TableColumn[] = [
94
+ {
95
+ key: 'column1',
96
+ name: 'Column 1',
97
+ },
98
+ {
99
+ key: 'column2',
100
+ name: 'Column 2',
101
+ },
102
+ ];
103
+ const rows: any[] = [
104
+ {
105
+ column1: 'Test content',
106
+ column2: 'Test content 2',
107
+ },
108
+ ];
109
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} title="Test Title" />);
110
+ const tableHeaderRow = queryByTestId('TestTableHeaderRow');
111
+ expect(tableHeaderRow?.children[0].children[0].textContent).toContain('Test Title');
112
+ });
113
+
114
+ it('Should have options menu', () => {
115
+ const columns: TableColumn[] = [
116
+ {
117
+ key: 'column1',
118
+ name: 'Column 1',
119
+ },
120
+ {
121
+ key: 'column2',
122
+ name: 'Column 2',
123
+ },
124
+ ];
125
+ const rows: any[] = [
126
+ {
127
+ column1: 'Test content',
128
+ column2: 'Test content 2',
129
+ },
130
+ ];
131
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} title="Test Title" />);
132
+ expect(queryByTestId('TestTableHeaderRow')?.getElementsByTagName('svg')).not.toBeNull();
133
+ });
134
+ });
135
+ });
136
+
137
+ describe('Table Column Header Row Tests', () => {
138
+ it('Should render column header row', () => {
139
+ const columns: TableColumn[] = [
140
+ {
141
+ key: 'column1',
142
+ name: 'Column 1',
143
+ },
144
+ {
145
+ key: 'column2',
146
+ name: 'Column 2',
147
+ },
148
+ ];
149
+ const rows: any[] = [
150
+ {
151
+ column1: 'Test content',
152
+ column2: 'Test content 2',
153
+ },
154
+ ];
155
+ const { getByTestId } = render(<Table rows={rows} columns={columns} />);
156
+ expect(getByTestId('TestTableColumnHeaderRow')).not.toBeNull();
157
+ });
158
+
159
+ it('Should render two columns in the column header row', () => {
160
+ const columns: TableColumn[] = [
161
+ {
162
+ key: 'column1',
163
+ name: 'Column 1',
164
+ },
165
+ {
166
+ key: 'column2',
167
+ name: 'Column 2',
168
+ },
169
+ ];
170
+ const rows: any[] = [
171
+ {
172
+ column1: 'Test content',
173
+ column2: 'Test content 2',
174
+ },
175
+ ];
176
+ const { getByTestId } = render(<Table rows={rows} columns={columns} />);
177
+ expect(getByTestId('TestTableColumnHeaderRow').children.length).toEqual(2);
178
+ });
179
+
180
+ it('Should render correct column names in the column header row', () => {
181
+ const columns: TableColumn[] = [
182
+ {
183
+ key: 'column1',
184
+ name: 'Column 1',
185
+ },
186
+ {
187
+ key: 'column2',
188
+ name: 'Column 2',
189
+ },
190
+ ];
191
+ const rows: any[] = [
192
+ {
193
+ column1: 'Test content',
194
+ column2: 'Test content 2',
195
+ },
196
+ ];
197
+ const { getByTestId } = render(<Table rows={rows} columns={columns} />);
198
+ expect(getByTestId('TestTableColumnHeaderRow').children[0].textContent).toEqual('Column 1');
199
+ expect(getByTestId('TestTableColumnHeaderRow').children[1].textContent).toEqual('Column 2');
200
+ });
201
+
202
+ it('Should render columns without no-border class in the column header row, in case title is passed', () => {
203
+ const columns: TableColumn[] = [
204
+ {
205
+ key: 'column1',
206
+ name: 'Column 1',
207
+ },
208
+ {
209
+ key: 'column2',
210
+ name: 'Column 2',
211
+ },
212
+ ];
213
+ const rows: any[] = [
214
+ {
215
+ column1: 'Test content',
216
+ column2: 'Test content 2',
217
+ },
218
+ ];
219
+ const { getByTestId } = render(<Table rows={rows} columns={columns} title="test title" />);
220
+ expect(getByTestId('TestTableColumnHeaderRow').children[0].classList.contains('no-border')).toBe(false);
221
+ expect(getByTestId('TestTableColumnHeaderRow').children[1].classList.contains('no-border')).toBe(false);
222
+ });
223
+
224
+ });
225
+
226
+ describe('Table Body Row tests', () => {
227
+ it('Should not render "No Data" row in case there are rows', () => {
228
+ const columns: TableColumn[] = [
229
+ {
230
+ key: 'column1',
231
+ name: 'Column 1',
232
+ },
233
+ {
234
+ key: 'column2',
235
+ name: 'Column 2',
236
+ },
237
+ ];
238
+ const rows: any[] = [
239
+ {
240
+ column1: 'Test content',
241
+ column2: 'Test content 2',
242
+ },
243
+ ];
244
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} />);
245
+ expect(queryByTestId('TestTableNoDataRow')).toBeNull();
246
+ });
247
+
248
+ it('Should render "No Data" row in case there are no rows', () => {
249
+ const columns: TableColumn[] = [
250
+ {
251
+ key: 'column1',
252
+ name: 'Column 1',
253
+ },
254
+ {
255
+ key: 'column2',
256
+ name: 'Column 2',
257
+ },
258
+ ];
259
+ const rows: any[] = [];
260
+ const { queryByTestId } = render(<Table rows={rows} columns={columns} />);
261
+ expect(queryByTestId('TestTableNoDataRow')).not.toBeNull();
262
+ expect(queryByTestId('TestTableNoDataRow')?.textContent).toEqual('There are no rows to display');
263
+ });
264
+
265
+ it('Should render a data row with correct content for each row that is passed', () => {
266
+ const columns: TableColumn[] = [
267
+ {
268
+ key: 'column1',
269
+ name: 'Column 1',
270
+ },
271
+ {
272
+ key: 'column2',
273
+ name: 'Column 2',
274
+ },
275
+ ];
276
+ const rows: any[] = [
277
+ {
278
+ column1: 'Test content',
279
+ column2: 'Test content 2',
280
+ },
281
+ ];
282
+ const { getByTestId } = render(<Table rows={rows} columns={columns} />);
283
+ expect(getByTestId('TestTableDataRow')).toBeDefined();
284
+ expect(getByTestId('TestTableDataRow').children.length).toEqual(2);
285
+ expect(getByTestId('TestTableDataRow').children[0].textContent).toEqual('Test content');
286
+ expect(getByTestId('TestTableDataRow').children[1].textContent).toEqual('Test content 2');
287
+ });
288
+ });
289
+
290
+ it('Should render footer row', () => {
291
+ const columns: TableColumn[] = [
292
+ {
293
+ key: 'column1',
294
+ name: 'Column 1',
295
+ },
296
+ {
297
+ key: 'column2',
298
+ name: 'Column 2',
299
+ },
300
+ ];
301
+ const rows: any[] = [
302
+ {
303
+ column1: 'Test content',
304
+ column2: 'Test content 2',
305
+ },
306
+ ];
307
+ const { getByTestId } = render(<Table rows={rows} columns={columns} />);
308
+ expect(getByTestId('TestTableFooterRow')).toBeDefined();
309
+ });
310
+
311
+ describe('Table Accordion tests', () => {
312
+ it('Should render collapse button when configured as accordion', () => {
313
+ const columns: TableColumn[] = [
314
+ {
315
+ key: 'column1',
316
+ name: 'Column 1',
317
+ },
318
+ {
319
+ key: 'column2',
320
+ name: 'Column 2',
321
+ },
322
+ ];
323
+ const rows: any[] = [
324
+ {
325
+ column1: 'Test content',
326
+ column2: 'Test content 2',
327
+ },
328
+ {
329
+ column1: 'Test content',
330
+ column2: 'Test content 2',
331
+ },
332
+ {
333
+ column1: 'Test content',
334
+ column2: 'Test content 2',
335
+ },
336
+ {
337
+ column1: 'Test content',
338
+ column2: 'Test content 2',
339
+ },
340
+ ];
341
+ const wrapper = render(<Table rows={rows} columns={columns} accordion={true} collapsedRows={3}/>);
342
+
343
+ expect(wrapper.container.querySelectorAll(`${StyledTableFooterCollapseButton}`)).toHaveLength(1);
344
+ });
345
+
346
+ it('Should not render all items when collapsed', () => {
347
+ const columns: TableColumn[] = [
348
+ {
349
+ key: 'column1',
350
+ name: 'Column 1',
351
+ },
352
+ {
353
+ key: 'column2',
354
+ name: 'Column 2',
355
+ },
356
+ ];
357
+ const rows: any[] = [
358
+ {
359
+ column1: 'Test content',
360
+ column2: 'Test content 2',
361
+ },
362
+ {
363
+ column1: 'Test content',
364
+ column2: 'Test content 2',
365
+ },
366
+ {
367
+ column1: 'Test content',
368
+ column2: 'Test content 2',
369
+ },
370
+ {
371
+ column1: 'Test content',
372
+ column2: 'Test content 2',
373
+ },
374
+ ];
375
+ const wrapper = render(<Table rows={rows} columns={columns} accordion={true} collapsedRows={3}/>);
376
+
377
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(3);
378
+ });
379
+
380
+ it('Should render all items when not collapsed', () => {
381
+ const columns: TableColumn[] = [
382
+ {
383
+ key: 'column1',
384
+ name: 'Column 1',
385
+ },
386
+ {
387
+ key: 'column2',
388
+ name: 'Column 2',
389
+ },
390
+ ];
391
+ const rows: any[] = [
392
+ {
393
+ column1: 'Test content',
394
+ column2: 'Test content 2',
395
+ },
396
+ {
397
+ column1: 'Test content',
398
+ column2: 'Test content 2',
399
+ },
400
+ {
401
+ column1: 'Test content',
402
+ column2: 'Test content 2',
403
+ },
404
+ {
405
+ column1: 'Test content',
406
+ column2: 'Test content 2',
407
+ },
408
+ ];
409
+ const wrapper = render(<Table rows={rows} columns={columns} accordion={true} collapsedRows={3}
410
+ collapsed={false}/>);
411
+
412
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(4);
413
+ });
414
+
415
+ it('Should expand when show more button is clicked', () => {
416
+ const columns: TableColumn[] = [
417
+ {
418
+ key: 'column1',
419
+ name: 'Column 1',
420
+ },
421
+ {
422
+ key: 'column2',
423
+ name: 'Column 2',
424
+ },
425
+ ];
426
+ const rows: any[] = [
427
+ {
428
+ column1: 'Test content',
429
+ column2: 'Test content 2',
430
+ },
431
+ {
432
+ column1: 'Test content',
433
+ column2: 'Test content 2',
434
+ },
435
+ {
436
+ column1: 'Test content',
437
+ column2: 'Test content 2',
438
+ },
439
+ {
440
+ column1: 'Test content',
441
+ column2: 'Test content 2',
442
+ },
443
+ ];
444
+ const wrapper = render(<Table rows={rows} columns={columns} accordion={true} collapsedRows={3}
445
+ collapsed={true}/>);
446
+
447
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(3);
448
+
449
+ act(() => {
450
+ let button = wrapper.container.querySelectorAll(`${StyledTableFooterCollapseButton}`)[0] as HTMLButtonElement;
451
+ button.click();
452
+ })
453
+
454
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(4);
455
+ });
456
+
457
+ it('Should collapse when show less button is clicked', () => {
458
+ const columns: TableColumn[] = [
459
+ {
460
+ key: 'column1',
461
+ name: 'Column 1',
462
+ },
463
+ {
464
+ key: 'column2',
465
+ name: 'Column 2',
466
+ },
467
+ ];
468
+ const rows: any[] = [
469
+ {
470
+ column1: 'Test content',
471
+ column2: 'Test content 2',
472
+ },
473
+ {
474
+ column1: 'Test content',
475
+ column2: 'Test content 2',
476
+ },
477
+ {
478
+ column1: 'Test content',
479
+ column2: 'Test content 2',
480
+ },
481
+ {
482
+ column1: 'Test content',
483
+ column2: 'Test content 2',
484
+ },
485
+ ];
486
+ const wrapper = render(<Table rows={rows} columns={columns} accordion={true} collapsedRows={3}
487
+ collapsed={false}/>);
488
+
489
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(4);
490
+
491
+ act(() => {
492
+ let button = wrapper.container.querySelectorAll(`${StyledTableFooterCollapseButton}`)[0] as HTMLButtonElement;
493
+ button.click();
494
+ })
495
+
496
+ expect(wrapper.container.querySelectorAll(`${StyledTableBodyRow}`)).toHaveLength(3);
497
+ });
498
+ });
499
+ });
@@ -33,6 +33,7 @@ const VerticalTabs = _ref => {
33
33
  onLinkClick: e => {
34
34
  if (entry.onClick) {
35
35
  entry.onClick(e);
36
+ e.preventDefault && e.preventDefault();
36
37
  }
37
38
  }
38
39
  }, entry.to))
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalTabs.cjs","names":["React","_interopRequireWildcard","require","_Tabs","_interopRequireDefault","_TabLink","_types","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","VerticalTabs","_ref","size","entries","jsx","Size","Large","children","map","entry","href","to","requiredLine","optionalLine","endLineIcon","OptionalLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","onLinkClick","onClick","propTypes","_propTypes","arrayOf","shape","string","isRequired","node","bool","func","oneOf","_default","exports"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport Tabs from './Tabs';\r\nimport TabLink from './TabLink';\r\nimport { BaseProps } from '../icons';\r\nimport { Size } from '../types';\r\n\r\nexport interface VerticalTabEntry {\r\n /**\r\n * Required. The main text to be displayed on the tab.\r\n */\r\n requiredLine: string;\r\n\r\n /**\r\n * Optional. The secondary text to be displayed on the tab link under the required line.\r\n */\r\n optionalLine?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed next to the secondary text on the tab link under the required line.\r\n */\r\n optionalLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The icon to be displayed at the end of the tab.\r\n */\r\n endLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Required. The URL to which the tab links.\r\n */\r\n to: string;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the tab is disabled.\r\n * If true, the tab will be unclickable and will have a disabled appearance.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Optional. The handler function to be called when the tab is clicked.\r\n */\r\n onClick?: (e: React.MouseEvent) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a notification dot should be shown on the tab.\r\n */\r\n showNotificationDot?: boolean;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'critical' or 'positive'. Defaults to 'Critical'\r\n */\r\n variant?: 'critical' | 'positive';\r\n}\r\n\r\nexport interface VerticalTabsProps {\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n entries: VerticalTabEntry[];\r\n}\r\n\r\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\r\n return (\r\n <Tabs size={size ?? Size.Large}>\r\n {entries?.map((entry: VerticalTabEntry) => (\r\n <TabLink\r\n key={entry.to}\r\n href={entry.to}\r\n requiredLine={entry.requiredLine}\r\n optionalLine={entry.optionalLine}\r\n endLineIcon={entry.endLineIcon}\r\n OptionalLineIcon={entry.optionalLineIcon}\r\n disabled={entry.disabled}\r\n showNotificationDot={entry.showNotificationDot}\r\n size={size}\r\n variant={entry.variant}\r\n onLinkClick={(e) => {\r\n if (entry.onClick) {\r\n entry.onClick(e);\r\n }\r\n }}/>\r\n ))}\r\n </Tabs>\r\n );\r\n};\r\n\r\nexport default VerticalTabs;\r\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"VerticalTabs.cjs","names":["React","_interopRequireWildcard","require","_Tabs","_interopRequireDefault","_TabLink","_types","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","VerticalTabs","_ref","size","entries","jsx","Size","Large","children","map","entry","href","to","requiredLine","optionalLine","endLineIcon","OptionalLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","onLinkClick","onClick","preventDefault","propTypes","_propTypes","arrayOf","shape","string","isRequired","node","bool","func","oneOf","_default","exports"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport Tabs from './Tabs';\r\nimport TabLink from './TabLink';\r\nimport { BaseProps } from '../icons';\r\nimport { Size } from '../types';\r\n\r\nexport interface VerticalTabEntry {\r\n /**\r\n * Required. The main text to be displayed on the tab.\r\n */\r\n requiredLine: string;\r\n\r\n /**\r\n * Optional. The secondary text to be displayed on the tab link under the required line.\r\n */\r\n optionalLine?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed next to the secondary text on the tab link under the required line.\r\n */\r\n optionalLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The icon to be displayed at the end of the tab.\r\n */\r\n endLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Required. The URL to which the tab links.\r\n */\r\n to: string;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the tab is disabled.\r\n * If true, the tab will be unclickable and will have a disabled appearance.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Optional. The handler function to be called when the tab is clicked.\r\n */\r\n onClick?: (e: React.MouseEvent) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a notification dot should be shown on the tab.\r\n */\r\n showNotificationDot?: boolean;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'critical' or 'positive'. Defaults to 'Critical'\r\n */\r\n variant?: 'critical' | 'positive';\r\n}\r\n\r\nexport interface VerticalTabsProps {\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n entries: VerticalTabEntry[];\r\n}\r\n\r\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\r\n return (\r\n <Tabs size={size ?? Size.Large}>\r\n {entries?.map((entry: VerticalTabEntry) => (\r\n <TabLink\r\n key={entry.to}\r\n href={entry.to}\r\n requiredLine={entry.requiredLine}\r\n optionalLine={entry.optionalLine}\r\n endLineIcon={entry.endLineIcon}\r\n OptionalLineIcon={entry.optionalLineIcon}\r\n disabled={entry.disabled}\r\n showNotificationDot={entry.showNotificationDot}\r\n size={size}\r\n variant={entry.variant}\r\n onLinkClick={(e) => {\r\n if (entry.onClick) {\r\n entry.onClick(e);\r\n e.preventDefault && e.preventDefault();\r\n }\r\n }}/>\r\n ))}\r\n </Tabs>\r\n );\r\n};\r\n\r\nexport default VerticalTabs;\r\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAAgC,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAuDhC,MAAMW,YAAY,GAAGC,IAAA,IAA0C;EAAA,IAAzC;IAAEC,IAAI;IAAEC;EAA2B,CAAC,GAAAF,IAAA;EACxD,oBACE,IAAAtB,WAAA,CAAAyB,GAAA,EAAC7B,KAAA,CAAAW,OAAI;IAACgB,IAAI,EAAEA,IAAI,IAAIG,WAAI,CAACC,KAAM;IAAAC,QAAA,EAC5BJ,OAAO,EAAEK,GAAG,CAAEC,KAAuB,iBACpC,IAAA9B,WAAA,CAAAyB,GAAA,EAAC3B,QAAA,CAAAS,OAAO;MAENwB,IAAI,EAAED,KAAK,CAACE,EAAG;MACfC,YAAY,EAAEH,KAAK,CAACG,YAAa;MACjCC,YAAY,EAAEJ,KAAK,CAACI,YAAa;MACjCC,WAAW,EAAEL,KAAK,CAACK,WAAY;MAC/BC,gBAAgB,EAAEN,KAAK,CAACO,gBAAiB;MACzCC,QAAQ,EAAER,KAAK,CAACQ,QAAS;MACzBC,mBAAmB,EAAET,KAAK,CAACS,mBAAoB;MAC/ChB,IAAI,EAAEA,IAAK;MACXiB,OAAO,EAAEV,KAAK,CAACU,OAAQ;MACvBC,WAAW,EAAGvC,CAAC,IAAK;QAClB,IAAI4B,KAAK,CAACY,OAAO,EAAE;UACjBZ,KAAK,CAACY,OAAO,CAACxC,CAAC,CAAC;UAChBA,CAAC,CAACyC,cAAc,IAAIzC,CAAC,CAACyC,cAAc,CAAC,CAAC;QACxC;MACF;IAAE,GAfGb,KAAK,CAACE,EAeR,CACN;EAAC,CACE,CAAC;AAEX,CAAC;AAACX,YAAA,CAAAuB,SAAA;EA3BApB,OAAO,EAAAqB,UAAA,CAAAtC,OAAA,CAAAuC,OAAA,CAAAD,UAAA,CAAAtC,OAAA,CAAAwC,KAAA;IA9CPd,YAAY,EAAAY,UAAA,CAAAtC,OAAA,CAAAyC,MAAA,CAAAC,UAAA;IAKZf,YAAY,EAAAW,UAAA,CAAAtC,OAAA,CAAAyC,MAAA;IAKZX,gBAAgB,EAAAQ,UAAA,CAAAtC,OAAA,CAAA2C,IAAA;IAKhBf,WAAW,EAAAU,UAAA,CAAAtC,OAAA,CAAA2C,IAAA;IAKXlB,EAAE,EAAAa,UAAA,CAAAtC,OAAA,CAAAyC,MAAA,CAAAC,UAAA;IAMFX,QAAQ,EAAAO,UAAA,CAAAtC,OAAA,CAAA4C,IAAA;IAKRT,OAAO,EAAAG,UAAA,CAAAtC,OAAA,CAAA6C,IAAA;IAKPb,mBAAmB,EAAAM,UAAA,CAAAtC,OAAA,CAAA4C,IAAA;IAKnBX,OAAO,EAAAK,UAAA,CAAAtC,OAAA,CAAA8C,KAAA,EAAG,UAAU,EAAG,UAAU;EAAA,IAAAJ;AAAA;AAAA,IAAAK,QAAA,GAAAC,OAAA,CAAAhD,OAAA,GAkCpBc,YAAY","ignoreList":[]}
@@ -24,6 +24,7 @@ const VerticalTabs = _ref => {
24
24
  onLinkClick: e => {
25
25
  if (entry.onClick) {
26
26
  entry.onClick(e);
27
+ e.preventDefault && e.preventDefault();
27
28
  }
28
29
  }
29
30
  }, entry.to))
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalTabs.js","names":["React","Tabs","TabLink","Size","jsx","_jsx","VerticalTabs","_ref","size","entries","Large","children","map","entry","href","to","requiredLine","optionalLine","endLineIcon","OptionalLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","onLinkClick","e","onClick","propTypes","_pt","arrayOf","shape","string","isRequired","node","bool","func","oneOf"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport Tabs from './Tabs';\r\nimport TabLink from './TabLink';\r\nimport { BaseProps } from '../icons';\r\nimport { Size } from '../types';\r\n\r\nexport interface VerticalTabEntry {\r\n /**\r\n * Required. The main text to be displayed on the tab.\r\n */\r\n requiredLine: string;\r\n\r\n /**\r\n * Optional. The secondary text to be displayed on the tab link under the required line.\r\n */\r\n optionalLine?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed next to the secondary text on the tab link under the required line.\r\n */\r\n optionalLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The icon to be displayed at the end of the tab.\r\n */\r\n endLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Required. The URL to which the tab links.\r\n */\r\n to: string;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the tab is disabled.\r\n * If true, the tab will be unclickable and will have a disabled appearance.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Optional. The handler function to be called when the tab is clicked.\r\n */\r\n onClick?: (e: React.MouseEvent) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a notification dot should be shown on the tab.\r\n */\r\n showNotificationDot?: boolean;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'critical' or 'positive'. Defaults to 'Critical'\r\n */\r\n variant?: 'critical' | 'positive';\r\n}\r\n\r\nexport interface VerticalTabsProps {\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n entries: VerticalTabEntry[];\r\n}\r\n\r\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\r\n return (\r\n <Tabs size={size ?? Size.Large}>\r\n {entries?.map((entry: VerticalTabEntry) => (\r\n <TabLink\r\n key={entry.to}\r\n href={entry.to}\r\n requiredLine={entry.requiredLine}\r\n optionalLine={entry.optionalLine}\r\n endLineIcon={entry.endLineIcon}\r\n OptionalLineIcon={entry.optionalLineIcon}\r\n disabled={entry.disabled}\r\n showNotificationDot={entry.showNotificationDot}\r\n size={size}\r\n variant={entry.variant}\r\n onLinkClick={(e) => {\r\n if (entry.onClick) {\r\n entry.onClick(e);\r\n }\r\n }}/>\r\n ))}\r\n </Tabs>\r\n );\r\n};\r\n\r\nexport default VerticalTabs;\r\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,OAAO,MAAM,WAAW;AAE/B,SAASC,IAAI,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuDhC,MAAMC,YAAY,GAAGC,IAAA,IAA0C;EAAA,IAAzC;IAAEC,IAAI;IAAEC;EAA2B,CAAC,GAAAF,IAAA;EACxD,oBACEF,IAAA,CAACJ,IAAI;IAACO,IAAI,EAAEA,IAAI,IAAIL,IAAI,CAACO,KAAM;IAAAC,QAAA,EAC5BF,OAAO,EAAEG,GAAG,CAAEC,KAAuB,iBACpCR,IAAA,CAACH,OAAO;MAENY,IAAI,EAAED,KAAK,CAACE,EAAG;MACfC,YAAY,EAAEH,KAAK,CAACG,YAAa;MACjCC,YAAY,EAAEJ,KAAK,CAACI,YAAa;MACjCC,WAAW,EAAEL,KAAK,CAACK,WAAY;MAC/BC,gBAAgB,EAAEN,KAAK,CAACO,gBAAiB;MACzCC,QAAQ,EAAER,KAAK,CAACQ,QAAS;MACzBC,mBAAmB,EAAET,KAAK,CAACS,mBAAoB;MAC/Cd,IAAI,EAAEA,IAAK;MACXe,OAAO,EAAEV,KAAK,CAACU,OAAQ;MACvBC,WAAW,EAAGC,CAAC,IAAK;QAClB,IAAIZ,KAAK,CAACa,OAAO,EAAE;UACjBb,KAAK,CAACa,OAAO,CAACD,CAAC,CAAC;QAClB;MACF;IAAE,GAdGZ,KAAK,CAACE,EAcR,CACN;EAAC,CACE,CAAC;AAEX,CAAC;AAACT,YAAA,CAAAqB,SAAA;EA1BAlB,OAAO,EAAAmB,GAAA,CAAAC,OAAA,CAAAD,GAAA,CAAAE,KAAA;IA9CPd,YAAY,EAAAY,GAAA,CAAAG,MAAA,CAAAC,UAAA;IAKZf,YAAY,EAAAW,GAAA,CAAAG,MAAA;IAKZX,gBAAgB,EAAAQ,GAAA,CAAAK,IAAA;IAKhBf,WAAW,EAAAU,GAAA,CAAAK,IAAA;IAKXlB,EAAE,EAAAa,GAAA,CAAAG,MAAA,CAAAC,UAAA;IAMFX,QAAQ,EAAAO,GAAA,CAAAM,IAAA;IAKRR,OAAO,EAAAE,GAAA,CAAAO,IAAA;IAKPb,mBAAmB,EAAAM,GAAA,CAAAM,IAAA;IAKnBX,OAAO,EAAAK,GAAA,CAAAQ,KAAA,EAAG,UAAU,EAAG,UAAU;EAAA,IAAAJ;AAAA;AAiCnC,eAAe1B,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"VerticalTabs.js","names":["React","Tabs","TabLink","Size","jsx","_jsx","VerticalTabs","_ref","size","entries","Large","children","map","entry","href","to","requiredLine","optionalLine","endLineIcon","OptionalLineIcon","optionalLineIcon","disabled","showNotificationDot","variant","onLinkClick","e","onClick","preventDefault","propTypes","_pt","arrayOf","shape","string","isRequired","node","bool","func","oneOf"],"sources":["../../src/Tabs/VerticalTabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport Tabs from './Tabs';\r\nimport TabLink from './TabLink';\r\nimport { BaseProps } from '../icons';\r\nimport { Size } from '../types';\r\n\r\nexport interface VerticalTabEntry {\r\n /**\r\n * Required. The main text to be displayed on the tab.\r\n */\r\n requiredLine: string;\r\n\r\n /**\r\n * Optional. The secondary text to be displayed on the tab link under the required line.\r\n */\r\n optionalLine?: string;\r\n\r\n /**\r\n * Optional. The icon to be displayed next to the secondary text on the tab link under the required line.\r\n */\r\n optionalLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The icon to be displayed at the end of the tab.\r\n */\r\n endLineIcon?: React.ReactNode;\r\n\r\n /**\r\n * Required. The URL to which the tab links.\r\n */\r\n to: string;\r\n\r\n /**\r\n * Optional. A boolean indicating whether the tab is disabled.\r\n * If true, the tab will be unclickable and will have a disabled appearance.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Optional. The handler function to be called when the tab is clicked.\r\n */\r\n onClick?: (e: React.MouseEvent) => void;\r\n\r\n /**\r\n * Optional. A boolean indicating whether a notification dot should be shown on the tab.\r\n */\r\n showNotificationDot?: boolean;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'critical' or 'positive'. Defaults to 'Critical'\r\n */\r\n variant?: 'critical' | 'positive';\r\n}\r\n\r\nexport interface VerticalTabsProps {\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n entries: VerticalTabEntry[];\r\n}\r\n\r\nconst VerticalTabs = ({ size, entries }: VerticalTabsProps) => {\r\n return (\r\n <Tabs size={size ?? Size.Large}>\r\n {entries?.map((entry: VerticalTabEntry) => (\r\n <TabLink\r\n key={entry.to}\r\n href={entry.to}\r\n requiredLine={entry.requiredLine}\r\n optionalLine={entry.optionalLine}\r\n endLineIcon={entry.endLineIcon}\r\n OptionalLineIcon={entry.optionalLineIcon}\r\n disabled={entry.disabled}\r\n showNotificationDot={entry.showNotificationDot}\r\n size={size}\r\n variant={entry.variant}\r\n onLinkClick={(e) => {\r\n if (entry.onClick) {\r\n entry.onClick(e);\r\n e.preventDefault && e.preventDefault();\r\n }\r\n }}/>\r\n ))}\r\n </Tabs>\r\n );\r\n};\r\n\r\nexport default VerticalTabs;\r\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,OAAO,MAAM,WAAW;AAE/B,SAASC,IAAI,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuDhC,MAAMC,YAAY,GAAGC,IAAA,IAA0C;EAAA,IAAzC;IAAEC,IAAI;IAAEC;EAA2B,CAAC,GAAAF,IAAA;EACxD,oBACEF,IAAA,CAACJ,IAAI;IAACO,IAAI,EAAEA,IAAI,IAAIL,IAAI,CAACO,KAAM;IAAAC,QAAA,EAC5BF,OAAO,EAAEG,GAAG,CAAEC,KAAuB,iBACpCR,IAAA,CAACH,OAAO;MAENY,IAAI,EAAED,KAAK,CAACE,EAAG;MACfC,YAAY,EAAEH,KAAK,CAACG,YAAa;MACjCC,YAAY,EAAEJ,KAAK,CAACI,YAAa;MACjCC,WAAW,EAAEL,KAAK,CAACK,WAAY;MAC/BC,gBAAgB,EAAEN,KAAK,CAACO,gBAAiB;MACzCC,QAAQ,EAAER,KAAK,CAACQ,QAAS;MACzBC,mBAAmB,EAAET,KAAK,CAACS,mBAAoB;MAC/Cd,IAAI,EAAEA,IAAK;MACXe,OAAO,EAAEV,KAAK,CAACU,OAAQ;MACvBC,WAAW,EAAGC,CAAC,IAAK;QAClB,IAAIZ,KAAK,CAACa,OAAO,EAAE;UACjBb,KAAK,CAACa,OAAO,CAACD,CAAC,CAAC;UAChBA,CAAC,CAACE,cAAc,IAAIF,CAAC,CAACE,cAAc,CAAC,CAAC;QACxC;MACF;IAAE,GAfGd,KAAK,CAACE,EAeR,CACN;EAAC,CACE,CAAC;AAEX,CAAC;AAACT,YAAA,CAAAsB,SAAA;EA3BAnB,OAAO,EAAAoB,GAAA,CAAAC,OAAA,CAAAD,GAAA,CAAAE,KAAA;IA9CPf,YAAY,EAAAa,GAAA,CAAAG,MAAA,CAAAC,UAAA;IAKZhB,YAAY,EAAAY,GAAA,CAAAG,MAAA;IAKZZ,gBAAgB,EAAAS,GAAA,CAAAK,IAAA;IAKhBhB,WAAW,EAAAW,GAAA,CAAAK,IAAA;IAKXnB,EAAE,EAAAc,GAAA,CAAAG,MAAA,CAAAC,UAAA;IAMFZ,QAAQ,EAAAQ,GAAA,CAAAM,IAAA;IAKRT,OAAO,EAAAG,GAAA,CAAAO,IAAA;IAKPd,mBAAmB,EAAAO,GAAA,CAAAM,IAAA;IAKnBZ,OAAO,EAAAM,GAAA,CAAAQ,KAAA,EAAG,UAAU,EAAG,UAAU;EAAA,IAAAJ;AAAA;AAkCnC,eAAe3B,YAAY","ignoreList":[]}