@databiosphere/findable-ui 29.0.2 → 31.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 (283) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +35 -0
  3. package/lib/common/categories/config/types.d.ts +28 -0
  4. package/lib/common/categories/config/utils.d.ts +31 -0
  5. package/lib/common/categories/config/utils.js +29 -0
  6. package/lib/common/categories/models/range/typeGuards.d.ts +14 -0
  7. package/lib/common/categories/models/range/typeGuards.js +18 -0
  8. package/lib/common/categories/models/range/types.d.ts +15 -0
  9. package/lib/common/categories/models/range/types.js +1 -0
  10. package/lib/common/categories/models/range/utils.d.ts +23 -0
  11. package/lib/common/categories/models/range/utils.js +41 -0
  12. package/lib/common/categories/models/select/utils.d.ts +8 -0
  13. package/lib/common/categories/models/select/utils.js +16 -0
  14. package/lib/common/categories/models/types.d.ts +6 -0
  15. package/lib/common/categories/models/types.js +1 -0
  16. package/lib/common/categories/views/common/types.d.ts +10 -0
  17. package/lib/common/categories/views/common/types.js +1 -0
  18. package/lib/common/categories/views/range/typeGuards.d.ts +8 -0
  19. package/lib/common/categories/views/range/typeGuards.js +8 -0
  20. package/lib/common/categories/views/range/types.d.ts +19 -0
  21. package/lib/common/categories/views/range/types.js +1 -0
  22. package/lib/common/categories/views/range/utils.d.ts +12 -0
  23. package/lib/common/categories/views/range/utils.js +24 -0
  24. package/lib/common/categories/views/select/typeGuards.d.ts +8 -0
  25. package/lib/common/categories/views/select/typeGuards.js +8 -0
  26. package/lib/common/categories/views/select/types.d.ts +7 -0
  27. package/lib/common/categories/views/select/types.js +1 -0
  28. package/lib/common/categories/views/types.d.ts +13 -0
  29. package/lib/common/categories/views/types.js +8 -0
  30. package/lib/common/entities.d.ts +8 -23
  31. package/lib/components/DataDictionary/components/Entities/entities.d.ts +3 -1
  32. package/lib/components/DataDictionary/components/Entities/entities.js +1 -1
  33. package/lib/components/DataDictionary/components/Entities/types.d.ts +5 -5
  34. package/lib/components/DataDictionary/components/Entity/entity.d.ts +3 -1
  35. package/lib/components/DataDictionary/components/Entity/entity.js +6 -6
  36. package/lib/components/DataDictionary/components/Entity/types.d.ts +5 -5
  37. package/lib/components/DataDictionary/components/Outline/utils.d.ts +3 -2
  38. package/lib/components/DataDictionary/components/Table/components/BasicCell/basicCell.d.ts +3 -2
  39. package/lib/components/DataDictionary/components/Table/components/BasicCell/basicCell.js +6 -2
  40. package/lib/components/DataDictionary/components/Table/components/BasicCell/utils.d.ts +9 -0
  41. package/lib/components/DataDictionary/components/Table/components/BasicCell/utils.js +12 -0
  42. package/lib/components/DataDictionary/components/Table/hook.d.ts +3 -3
  43. package/lib/components/DataDictionary/components/Table/hook.js +3 -1
  44. package/lib/components/DataDictionary/components/Table/options/core/constants.d.ts +2 -3
  45. package/lib/components/DataDictionary/components/Table/options/hook.d.ts +2 -2
  46. package/lib/components/DataDictionary/components/Table/options/sorting/constants.d.ts +2 -3
  47. package/lib/components/DataDictionary/components/Table/table.d.ts +2 -1
  48. package/lib/components/DataDictionary/components/Table/table.js +1 -1
  49. package/lib/components/DataDictionary/components/Table/types.d.ts +3 -4
  50. package/lib/components/DataDictionary/dataDictionary.d.ts +3 -1
  51. package/lib/components/DataDictionary/dataDictionary.styles.js +2 -3
  52. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.d.ts +3 -1
  53. package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +5 -5
  54. package/lib/components/Filter/components/Filter/filter.d.ts +2 -2
  55. package/lib/components/Filter/components/Filter/filter.js +11 -3
  56. package/lib/components/Filter/components/Filter/stories/args.d.ts +5 -0
  57. package/lib/components/Filter/components/Filter/stories/args.js +19 -0
  58. package/lib/components/Filter/components/Filter/stories/filter.stories.d.ts +8 -0
  59. package/lib/components/Filter/components/Filter/stories/filter.stories.js +21 -0
  60. package/lib/components/Filter/components/FilterMenu/filterMenu.js +2 -2
  61. package/lib/components/Filter/components/FilterMenu/filterMenu.styles.d.ts +1 -1
  62. package/lib/components/Filter/components/FilterMenu/filterMenu.styles.js +1 -1
  63. package/lib/components/Filter/components/FilterRange/constants.d.ts +0 -2
  64. package/lib/components/Filter/components/FilterRange/constants.js +0 -5
  65. package/lib/components/Filter/components/FilterRange/filterRange.d.ts +1 -1
  66. package/lib/components/Filter/components/FilterRange/filterRange.js +50 -21
  67. package/lib/components/Filter/components/FilterRange/filterRange.styles.js +58 -10
  68. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.d.ts +5 -0
  69. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.js +5 -0
  70. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.d.ts +2 -2
  71. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.js +32 -7
  72. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.d.ts +6 -0
  73. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.js +50 -0
  74. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/types.d.ts +26 -3
  75. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/types.js +6 -1
  76. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.d.ts +15 -0
  77. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.js +25 -0
  78. package/lib/components/Filter/components/FilterRange/stories/args.d.ts +3 -0
  79. package/lib/components/Filter/components/FilterRange/stories/args.js +13 -0
  80. package/lib/components/Filter/components/FilterRange/stories/filterRange.stories.js +2 -2
  81. package/lib/components/Filter/components/FilterRange/types.d.ts +10 -6
  82. package/lib/components/Filter/components/FilterRange/types.js +1 -6
  83. package/lib/components/Filter/components/FilterRange/utils.d.ts +8 -0
  84. package/lib/components/Filter/components/FilterRange/utils.js +15 -0
  85. package/lib/components/Filter/components/FilterTag/stories/args.d.ts +5 -0
  86. package/lib/components/Filter/components/FilterTag/stories/args.js +17 -0
  87. package/lib/components/Filter/components/FilterTag/stories/filterTag.stories.d.ts +8 -0
  88. package/lib/components/Filter/components/FilterTag/stories/filterTag.stories.js +21 -0
  89. package/lib/components/Filter/components/FilterTag/utils.d.ts +10 -0
  90. package/lib/components/Filter/components/FilterTag/utils.js +40 -0
  91. package/lib/components/Filter/components/Filters/filters.d.ts +2 -2
  92. package/lib/components/Filter/components/Filters/filters.js +15 -8
  93. package/lib/components/Filter/components/Filters/stories/args.d.ts +3 -0
  94. package/lib/components/Filter/components/Filters/stories/args.js +15 -0
  95. package/lib/components/Filter/components/Filters/stories/constants.d.ts +22 -0
  96. package/lib/components/Filter/components/Filters/stories/constants.js +134 -0
  97. package/lib/components/Filter/components/Filters/stories/filters.stories.d.ts +6 -0
  98. package/lib/components/Filter/components/Filters/stories/filters.stories.js +15 -0
  99. package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.d.ts +1 -1
  100. package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +5 -5
  101. package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeListItem/variableSizeListItem.js +2 -1
  102. package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.d.ts +3 -2
  103. package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.js +6 -4
  104. package/lib/components/Filter/components/VariableSizeListItem/variableSizeListItem.js +2 -1
  105. package/lib/components/Index/components/EntitiesView/components/ChartView/utils.js +2 -0
  106. package/lib/components/Index/table/hook.js +4 -0
  107. package/lib/components/MarkdownRenderer/components/Anchor/anchor.d.ts +19 -0
  108. package/lib/components/MarkdownRenderer/components/Anchor/anchor.js +21 -0
  109. package/lib/components/MarkdownRenderer/components/Table/table.d.ts +3 -0
  110. package/lib/components/MarkdownRenderer/components/Table/table.js +5 -0
  111. package/lib/components/MarkdownRenderer/components/Table/table.styles.d.ts +4 -0
  112. package/lib/components/MarkdownRenderer/components/Table/table.styles.js +40 -0
  113. package/lib/components/MarkdownRenderer/constants.d.ts +2 -0
  114. package/lib/components/MarkdownRenderer/constants.js +6 -0
  115. package/lib/components/MarkdownRenderer/markdownRenderer.d.ts +2 -0
  116. package/lib/components/MarkdownRenderer/markdownRenderer.js +45 -0
  117. package/lib/components/MarkdownRenderer/markdownRenderer.styles.d.ts +4 -0
  118. package/lib/components/MarkdownRenderer/markdownRenderer.styles.js +13 -0
  119. package/lib/components/MarkdownRenderer/types.d.ts +6 -0
  120. package/lib/components/MarkdownRenderer/types.js +1 -0
  121. package/lib/components/Table/columnDef/accessorFn/typeGuards.d.ts +9 -0
  122. package/lib/components/Table/columnDef/accessorFn/typeGuards.js +10 -0
  123. package/lib/components/Table/common/utils.d.ts +2 -2
  124. package/lib/components/Table/common/utils.js +28 -13
  125. package/lib/components/Table/components/TableCell/components/ChipCell/chipCell.d.ts +4 -0
  126. package/lib/components/Table/components/TableCell/components/ChipCell/chipCell.js +8 -0
  127. package/lib/components/Table/components/TableCell/components/LinkCell/linkCell.d.ts +4 -0
  128. package/lib/components/Table/components/TableCell/components/LinkCell/linkCell.js +21 -0
  129. package/lib/components/Table/components/TableCell/components/LinkCell/stories/args.d.ts +6 -0
  130. package/lib/components/Table/components/TableCell/components/LinkCell/stories/args.js +27 -0
  131. package/lib/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.d.ts +9 -0
  132. package/lib/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.js +18 -0
  133. package/lib/components/Table/components/TableCell/components/LinkCell/stories/types.d.ts +3 -0
  134. package/lib/components/Table/components/TableCell/components/LinkCell/stories/types.js +1 -0
  135. package/lib/components/Table/components/TableCell/components/LinkCell/utils.d.ts +22 -0
  136. package/lib/components/Table/components/TableCell/components/LinkCell/utils.js +45 -0
  137. package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.d.ts +4 -0
  138. package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.js +13 -0
  139. package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.d.ts +3 -0
  140. package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.js +30 -0
  141. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/args.d.ts +4 -0
  142. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/args.js +10 -0
  143. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/constants.d.ts +5 -0
  144. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/constants.js +9 -0
  145. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.d.ts +7 -0
  146. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.js +25 -0
  147. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.d.ts +3 -0
  148. package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.js +1 -0
  149. package/lib/components/Table/components/TableCell/components/MarkdownCell/types.d.ts +3 -0
  150. package/lib/components/Table/components/TableCell/components/MarkdownCell/types.js +1 -0
  151. package/lib/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.d.ts +8 -0
  152. package/lib/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.js +46 -0
  153. package/lib/components/common/Link/typeGuards.d.ts +13 -0
  154. package/lib/components/common/Link/typeGuards.js +21 -0
  155. package/lib/config/entities.d.ts +2 -11
  156. package/lib/hooks/useCategoryFilter.d.ts +8 -13
  157. package/lib/hooks/useCategoryFilter.js +31 -28
  158. package/lib/providers/exploreState/entities.d.ts +5 -3
  159. package/lib/providers/exploreState/payloads/entities.d.ts +6 -2
  160. package/lib/providers/exploreState.d.ts +3 -2
  161. package/lib/providers/exploreState.js +1 -1
  162. package/lib/styles/common/mui/typography.js +1 -0
  163. package/lib/tests/utils.d.ts +24 -0
  164. package/lib/tests/utils.js +34 -0
  165. package/lib/theme/common/components.js +19 -1
  166. package/lib/views/ExploreView/exploreView.js +10 -8
  167. package/package.json +7 -1
  168. package/src/common/categories/config/types.ts +42 -0
  169. package/src/common/categories/config/utils.ts +47 -0
  170. package/src/common/categories/models/range/typeGuards.ts +24 -0
  171. package/src/common/categories/models/range/types.ts +17 -0
  172. package/src/common/categories/models/range/utils.ts +51 -0
  173. package/src/common/categories/models/select/utils.ts +23 -0
  174. package/src/common/categories/models/types.ts +7 -0
  175. package/src/common/categories/views/common/types.ts +11 -0
  176. package/src/common/categories/views/range/typeGuards.ts +13 -0
  177. package/src/common/categories/views/range/types.ts +21 -0
  178. package/src/common/categories/views/range/utils.ts +35 -0
  179. package/src/common/categories/views/select/typeGuards.ts +13 -0
  180. package/src/common/categories/views/select/types.ts +8 -0
  181. package/src/common/categories/views/types.ts +15 -0
  182. package/src/common/entities.ts +8 -26
  183. package/src/components/DataDictionary/components/Entities/entities.tsx +7 -5
  184. package/src/components/DataDictionary/components/Entities/types.ts +5 -9
  185. package/src/components/DataDictionary/components/Entity/entity.tsx +9 -7
  186. package/src/components/DataDictionary/components/Entity/types.ts +5 -9
  187. package/src/components/DataDictionary/components/Outline/utils.ts +5 -2
  188. package/src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsx +12 -4
  189. package/src/components/DataDictionary/components/Table/components/BasicCell/utils.ts +13 -0
  190. package/src/components/DataDictionary/components/Table/hook.ts +16 -8
  191. package/src/components/DataDictionary/components/Table/options/core/constants.ts +2 -3
  192. package/src/components/DataDictionary/components/Table/options/hook.ts +3 -3
  193. package/src/components/DataDictionary/components/Table/options/sorting/constants.ts +2 -6
  194. package/src/components/DataDictionary/components/Table/table.tsx +4 -1
  195. package/src/components/DataDictionary/components/Table/types.ts +3 -4
  196. package/src/components/DataDictionary/dataDictionary.styles.ts +2 -3
  197. package/src/components/DataDictionary/dataDictionary.tsx +4 -2
  198. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +9 -2
  199. package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +5 -9
  200. package/src/components/Filter/components/Filter/filter.tsx +38 -13
  201. package/src/components/Filter/components/Filter/stories/args.ts +24 -0
  202. package/src/components/Filter/components/Filter/stories/filter.stories.tsx +32 -0
  203. package/src/components/Filter/components/FilterMenu/filterMenu.styles.ts +1 -1
  204. package/src/components/Filter/components/FilterMenu/filterMenu.tsx +7 -3
  205. package/src/components/Filter/components/FilterRange/constants.ts +0 -7
  206. package/src/components/Filter/components/FilterRange/filterRange.styles.ts +58 -14
  207. package/src/components/Filter/components/FilterRange/filterRange.tsx +112 -40
  208. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.ts +5 -0
  209. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.ts +51 -10
  210. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.ts +60 -0
  211. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/types.ts +34 -3
  212. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.ts +32 -0
  213. package/src/components/Filter/components/FilterRange/stories/args.ts +16 -0
  214. package/src/components/Filter/components/FilterRange/stories/filterRange.stories.tsx +2 -2
  215. package/src/components/Filter/components/FilterRange/types.ts +12 -6
  216. package/src/components/Filter/components/FilterRange/utils.ts +16 -0
  217. package/src/components/Filter/components/FilterTag/stories/args.ts +22 -0
  218. package/src/components/Filter/components/FilterTag/stories/filterTag.stories.tsx +32 -0
  219. package/src/components/Filter/components/FilterTag/utils.ts +57 -0
  220. package/src/components/Filter/components/Filters/filters.tsx +21 -12
  221. package/src/components/Filter/components/Filters/stories/args.ts +24 -0
  222. package/src/components/Filter/components/Filters/stories/constants.ts +151 -0
  223. package/src/components/Filter/components/Filters/stories/filters.stories.tsx +24 -0
  224. package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +32 -29
  225. package/src/components/Filter/components/SearchAllFilters/components/VariableSizeListItem/variableSizeListItem.tsx +9 -1
  226. package/src/components/Filter/components/SearchAllFilters/searchAllFilters.tsx +12 -6
  227. package/src/components/Filter/components/VariableSizeListItem/variableSizeListItem.tsx +2 -1
  228. package/src/components/Index/components/EntitiesView/components/ChartView/utils.ts +2 -0
  229. package/src/components/Index/table/hook.ts +4 -0
  230. package/src/components/MarkdownRenderer/components/Anchor/anchor.tsx +34 -0
  231. package/src/components/MarkdownRenderer/components/Table/table.styles.ts +41 -0
  232. package/src/components/MarkdownRenderer/components/Table/table.tsx +13 -0
  233. package/src/components/MarkdownRenderer/constants.ts +8 -0
  234. package/src/components/MarkdownRenderer/markdownRenderer.styles.ts +16 -0
  235. package/src/components/MarkdownRenderer/markdownRenderer.tsx +62 -0
  236. package/src/components/MarkdownRenderer/types.ts +7 -0
  237. package/src/components/Table/columnDef/accessorFn/typeGuards.ts +15 -0
  238. package/src/components/Table/common/utils.ts +37 -16
  239. package/src/components/Table/components/TableCell/components/ChipCell/chipCell.tsx +16 -0
  240. package/src/components/Table/components/TableCell/components/LinkCell/linkCell.tsx +64 -0
  241. package/src/components/Table/components/TableCell/components/LinkCell/stories/args.ts +35 -0
  242. package/src/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.tsx +32 -0
  243. package/src/components/Table/components/TableCell/components/LinkCell/stories/types.ts +4 -0
  244. package/src/components/Table/components/TableCell/components/LinkCell/utils.ts +59 -0
  245. package/src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.ts +31 -0
  246. package/src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.tsx +29 -0
  247. package/src/components/Table/components/TableCell/components/MarkdownCell/stories/args.ts +17 -0
  248. package/src/components/Table/components/TableCell/components/MarkdownCell/stories/constants.ts +11 -0
  249. package/src/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.tsx +37 -0
  250. package/src/components/Table/components/TableCell/components/MarkdownCell/stories/types.ts +4 -0
  251. package/src/components/Table/components/TableCell/components/MarkdownCell/types.ts +3 -0
  252. package/src/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.ts +64 -0
  253. package/src/components/common/Link/typeGuards.ts +35 -0
  254. package/src/config/entities.ts +1 -14
  255. package/src/hooks/useCategoryFilter.ts +56 -53
  256. package/src/providers/exploreState/entities.ts +3 -3
  257. package/src/providers/exploreState/initializer/utils.ts +1 -1
  258. package/src/providers/exploreState/payloads/entities.ts +5 -2
  259. package/src/providers/exploreState.tsx +5 -3
  260. package/src/styles/common/mui/typography.ts +1 -0
  261. package/src/tests/utils.ts +44 -0
  262. package/src/theme/common/components.ts +19 -1
  263. package/src/views/ExploreView/exploreView.tsx +17 -22
  264. package/tests/filter.test.tsx +100 -0
  265. package/tests/filterRange.test.tsx +331 -46
  266. package/tests/filters.test.tsx +61 -0
  267. package/tests/getFacetedMinMaxValues.test.ts +166 -0
  268. package/tests/linkCell.test.tsx +89 -0
  269. package/tests/markdownCell.test.tsx +53 -0
  270. package/types/data-explorer-ui.d.ts +2 -0
  271. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +0 -3
  272. package/lib/components/Filter/components/Filter/filter.stories.d.ts +0 -25
  273. package/lib/components/Filter/components/Filter/filter.stories.js +0 -42
  274. package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +0 -16
  275. package/lib/components/Filter/components/FilterTag/filterTag.stories.js +0 -17
  276. package/lib/components/Filter/components/Filters/filters.stories.d.ts +0 -6
  277. package/lib/components/Filter/components/Filters/filters.stories.js +0 -91
  278. package/src/components/DataDictionary/components/Table/components/BasicCell/types.ts +0 -7
  279. package/src/components/Filter/components/Filter/filter.stories.tsx +0 -52
  280. package/src/components/Filter/components/FilterTag/filterTag.stories.tsx +0 -23
  281. package/src/components/Filter/components/Filters/filters.stories.tsx +0 -101
  282. package/tests/filterRangeMock.test.tsx +0 -38
  283. /package/lib/{components/DataDictionary/components/Table/components/BasicCell → common/categories/config}/types.js +0 -0
@@ -0,0 +1,89 @@
1
+ import { matchers } from "@emotion/jest";
2
+ import { composeStories } from "@storybook/react";
3
+ import "@testing-library/jest-dom";
4
+ import { render, screen } from "@testing-library/react";
5
+ import React from "react";
6
+ import {
7
+ ANCHOR_TARGET,
8
+ REL_ATTRIBUTE,
9
+ } from "../src/components/Links/common/entities";
10
+ import * as stories from "../src/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories";
11
+
12
+ expect.extend(matchers);
13
+
14
+ const { ClientSide, External, Invalid, WithCustomStyle } =
15
+ composeStories(stories);
16
+
17
+ const STYLE_RULE_PROPERTIES = {
18
+ TEXT_DECORATION: "text-decoration",
19
+ };
20
+
21
+ const STYLE_RULE_VALUES = {
22
+ NONE: "none",
23
+ UNDERLINE: "underline",
24
+ };
25
+
26
+ describe("TableCell, LinkCell", () => {
27
+ it("renders client-side link", async () => {
28
+ render(<ClientSide />);
29
+ const anchorEl = screen.getByText("Explore");
30
+ expect(anchorEl).toBeDefined();
31
+ expect(anchorEl?.getAttribute("href")).toBe("/");
32
+ expect(anchorEl?.getAttribute("rel")).toBe(REL_ATTRIBUTE.NO_OPENER);
33
+ expect(anchorEl?.getAttribute("target")).toBe(ANCHOR_TARGET.SELF);
34
+ // Expect MuiLink-underlineAlways class and underline style.
35
+ expect(anchorEl).toHaveClass("MuiLink-underlineAlways");
36
+ expect(anchorEl).toHaveStyleRule(
37
+ STYLE_RULE_PROPERTIES.TEXT_DECORATION,
38
+ STYLE_RULE_VALUES.UNDERLINE
39
+ );
40
+ });
41
+
42
+ it("renders external link", async () => {
43
+ render(<External />);
44
+ const anchorEl = screen.getByText("Explore");
45
+ expect(anchorEl).toBeDefined();
46
+ expect(anchorEl?.getAttribute("href")).toBe("https://www.example.com");
47
+ expect(anchorEl?.getAttribute("rel")).toBe(
48
+ REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
49
+ );
50
+ expect(anchorEl?.getAttribute("target")).toBe(ANCHOR_TARGET.BLANK);
51
+ // Expect MuiLink-underlineAlways class and underline style.
52
+ expect(anchorEl).toHaveClass("MuiLink-underlineAlways");
53
+ expect(anchorEl).toHaveStyleRule(
54
+ STYLE_RULE_PROPERTIES.TEXT_DECORATION,
55
+ STYLE_RULE_VALUES.UNDERLINE
56
+ );
57
+ });
58
+
59
+ it("renders plain text for invalid link", () => {
60
+ render(<Invalid />);
61
+ const spanEl = screen.getByText("Explore");
62
+ expect(spanEl.tagName).toBe("SPAN");
63
+ expect(spanEl.getAttribute("href")).toBeNull();
64
+ expect(spanEl.getAttribute("rel")).toBeNull();
65
+ expect(spanEl.getAttribute("target")).toBeNull();
66
+ // Expect no MuiLink-root class and no underline style.
67
+ expect(spanEl).not.toHaveClass("MuiLink-root");
68
+ expect(spanEl).not.toHaveStyleRule(
69
+ STYLE_RULE_PROPERTIES.TEXT_DECORATION,
70
+ STYLE_RULE_VALUES.UNDERLINE
71
+ );
72
+ });
73
+
74
+ it("renders link with custom link props", async () => {
75
+ render(<WithCustomStyle />);
76
+ const anchorEl = screen.getByText("Explore");
77
+ // Expect MuiLink-underlineNone class and no underline style.
78
+ expect(anchorEl).toHaveClass("MuiLink-underlineNone");
79
+ expect(anchorEl).toHaveStyleRule(
80
+ STYLE_RULE_PROPERTIES.TEXT_DECORATION,
81
+ STYLE_RULE_VALUES.NONE
82
+ );
83
+ expect(anchorEl).toHaveStyleRule(
84
+ STYLE_RULE_PROPERTIES.TEXT_DECORATION,
85
+ STYLE_RULE_VALUES.NONE,
86
+ { target: ":hover" }
87
+ );
88
+ });
89
+ });
@@ -0,0 +1,53 @@
1
+ import { matchers } from "@emotion/jest";
2
+ import { composeStories } from "@storybook/react";
3
+ import { Column } from "@tanstack/react-table";
4
+ import "@testing-library/jest-dom";
5
+ import { render, screen } from "@testing-library/react";
6
+ import React from "react";
7
+ import {
8
+ ANCHOR_TARGET,
9
+ REL_ATTRIBUTE,
10
+ } from "../src/components/Links/common/entities";
11
+ import { STYLED_ANCHOR } from "../src/components/Table/components/TableCell/components/MarkdownCell/stories/constants";
12
+ import * as stories from "../src/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories";
13
+ import { MarkdownCellProps } from "../src/components/Table/components/TableCell/components/MarkdownCell/types";
14
+
15
+ expect.extend(matchers);
16
+
17
+ const { Default, WithHtml } = composeStories(stories);
18
+
19
+ describe("MarkdownCell", () => {
20
+ it("renders the markdown content", async () => {
21
+ render(<Default />);
22
+ expect(await screen.findByText("UBERON:0000955")).toBeInTheDocument();
23
+ });
24
+
25
+ it("renders HTML and anchor elements", async () => {
26
+ render(<WithHtml />);
27
+ const anchorEl = await screen.findByText("example link");
28
+ expect(anchorEl).toBeInTheDocument();
29
+ expect(anchorEl.getAttribute("href")).toBe("https://www.example.com");
30
+ expect(anchorEl.getAttribute("target")).toBe(ANCHOR_TARGET.BLANK);
31
+ expect(anchorEl.getAttribute("rel")).toBe(
32
+ REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
33
+ );
34
+ expect(anchorEl).toHaveClass("MuiLink-root");
35
+ });
36
+
37
+ it("applies the correct className and component", async () => {
38
+ render(
39
+ <WithHtml
40
+ className="css-pygqsj"
41
+ column={
42
+ {
43
+ columnDef: { meta: { components: { a: STYLED_ANCHOR } } },
44
+ } as unknown as Column<unknown, MarkdownCellProps>
45
+ }
46
+ />
47
+ );
48
+ const anchorEl = await screen.findByText("example link");
49
+ expect(anchorEl).toHaveStyleRule("background-color", "green");
50
+ expect(anchorEl).toHaveStyleRule("color", "white");
51
+ expect(anchorEl.closest(".css-pygqsj")).toBeInTheDocument();
52
+ });
53
+ });
@@ -19,6 +19,7 @@ import type {} from "@mui/material/Toolbar";
19
19
  import type {} from "@mui/material/Typography";
20
20
  import type {} from "@tanstack/react-table";
21
21
  import { RowData } from "@tanstack/react-table";
22
+ import { Components } from "rehype-react";
22
23
  import { DataLayer } from "../src/common/analytics/entities";
23
24
  import { DataDictionaryAnnotation } from "../src/common/entities";
24
25
  import {
@@ -230,6 +231,7 @@ declare module "@tanstack/react-table" {
230
231
  align?: TableCellProps["align"];
231
232
  annotation?: DataDictionaryAnnotation;
232
233
  columnPinned?: boolean;
234
+ components?: Partial<Components>; // For `MarkdownRendererCell` component.
233
235
  header?: string;
234
236
  width?: GridTrackSize;
235
237
  }
@@ -1,3 +0,0 @@
1
- import { CellContext } from "@tanstack/react-table";
2
- import { Attribute, AttributeValueTypes } from "../../../../../../common/entities";
3
- export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
@@ -1,25 +0,0 @@
1
- import { StoryObj } from "@storybook/react";
2
- import React from "react";
3
- declare const meta: {
4
- argTypes: {
5
- tags: {
6
- control: {
7
- disable: true;
8
- };
9
- };
10
- };
11
- component: ({ categorySection, categoryView, closeAncestor, isFilterDrawer, onFilter, tags, trackFilterOpened, }: import("./filter").FilterProps) => JSX.Element;
12
- decorators: ((Story: import("@storybook/core/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
13
- categorySection?: string | undefined;
14
- categoryView: import("../../../../common/entities").SelectCategoryView;
15
- closeAncestor?: (() => void) | undefined;
16
- isFilterDrawer: boolean;
17
- onFilter: import("../../../../hooks/useCategoryFilter").OnFilterFn;
18
- tags?: React.ReactNode;
19
- trackFilterOpened?: import("../../../../config/entities").TrackFilterOpenedFunction | undefined;
20
- }>) => JSX.Element)[];
21
- title: string;
22
- };
23
- export default meta;
24
- type Story = StoryObj<typeof meta>;
25
- export declare const FilterStory: Story;
@@ -1,42 +0,0 @@
1
- import React from "react";
2
- import { Filter } from "./filter";
3
- const meta = {
4
- argTypes: {
5
- tags: { control: { disable: true } },
6
- },
7
- component: Filter,
8
- decorators: [
9
- (Story) => (React.createElement("div", { style: { padding: "8px 12px 8px 16px", width: 264 } },
10
- React.createElement(Story, null))),
11
- ],
12
- title: "Components/Filter/Filter",
13
- };
14
- export default meta;
15
- const onFilter = () => {
16
- // onFilter function
17
- };
18
- export const FilterStory = {
19
- args: {
20
- categoryView: {
21
- isDisabled: false,
22
- key: "genusSpecies",
23
- label: "Genus Species",
24
- values: [
25
- {
26
- count: 12,
27
- key: "homoSapiens",
28
- label: "Homo sapiens",
29
- selected: false,
30
- },
31
- {
32
- count: 6,
33
- key: "musMusculus",
34
- label: "Mus musculus",
35
- selected: false,
36
- },
37
- ],
38
- },
39
- isFilterDrawer: false,
40
- onFilter,
41
- },
42
- };
@@ -1,16 +0,0 @@
1
- import { StoryObj } from "@storybook/react";
2
- declare const meta: {
3
- argTypes: {
4
- label: {
5
- control: "text";
6
- };
7
- superseded: {
8
- control: "boolean";
9
- };
10
- };
11
- component: ({ label, onRemove, superseded, }: import("./filterTag").FilterTagProps) => JSX.Element;
12
- title: string;
13
- };
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
- export declare const FilterTagStory: Story;
@@ -1,17 +0,0 @@
1
- import { FilterTag } from "./filterTag";
2
- const meta = {
3
- argTypes: {
4
- label: { control: "text" },
5
- superseded: { control: "boolean" },
6
- },
7
- component: FilterTag,
8
- title: "Components/Filter/FilterTag",
9
- };
10
- export default meta;
11
- export const FilterTagStory = {
12
- args: {
13
- label: "Male",
14
- onRemove: () => { },
15
- superseded: false,
16
- },
17
- };
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { Filters } from "./filters";
3
- declare const _default: Meta<typeof Filters>;
4
- export default _default;
5
- type Story = StoryObj<typeof Filters>;
6
- export declare const FiltersStory: Story;
@@ -1,91 +0,0 @@
1
- import React from "react";
2
- import { FilterMenuStory } from "../FilterMenu/filterMenu.stories";
3
- import { Filters } from "./filters";
4
- export default {
5
- argTypes: {
6
- categories: { control: { disable: true } },
7
- onFilter: { control: { disable: true } },
8
- },
9
- component: Filters,
10
- decorators: [
11
- (Story) => (React.createElement("div", { style: { width: 264 } },
12
- React.createElement(Story, null))),
13
- ],
14
- title: "Components/Filter/Filters",
15
- };
16
- const onFilter = () => {
17
- // onFilter function
18
- };
19
- const defaultValues = [
20
- {
21
- count: 1,
22
- key: "item1",
23
- label: "Item 1",
24
- selected: false,
25
- },
26
- {
27
- count: 10,
28
- key: "item2",
29
- label: "Item 2",
30
- selected: false,
31
- },
32
- ];
33
- export const FiltersStory = {
34
- args: {
35
- categoryFilters: [
36
- {
37
- categoryViews: [
38
- {
39
- isDisabled: false,
40
- key: "genusSpecies",
41
- label: "Genus Species",
42
- values: [
43
- {
44
- count: 12,
45
- key: "homoSapiens",
46
- label: "Homo sapiens",
47
- selected: false,
48
- },
49
- {
50
- count: 6,
51
- key: "musMusculus",
52
- label: "Mus musculus",
53
- selected: false,
54
- },
55
- ],
56
- },
57
- ],
58
- },
59
- {
60
- categoryViews: [
61
- {
62
- isDisabled: false,
63
- key: "donorDisease",
64
- label: "Donor Disease",
65
- values: FilterMenuStory.args?.values || defaultValues,
66
- },
67
- {
68
- isDisabled: true,
69
- key: "anatomicalEntity",
70
- label: "Anatomical Entity",
71
- values: [
72
- {
73
- count: 12,
74
- key: "oralCavity",
75
- label: "oral cavity",
76
- selected: true,
77
- },
78
- {
79
- count: 6,
80
- key: "pancreas",
81
- label: "pancreas",
82
- selected: false,
83
- },
84
- ],
85
- },
86
- ],
87
- },
88
- ],
89
- onFilter: onFilter,
90
- },
91
- };
@@ -1,7 +0,0 @@
1
- import { CellContext } from "@tanstack/react-table";
2
- import {
3
- Attribute,
4
- AttributeValueTypes,
5
- } from "../../../../../../common/entities";
6
-
7
- export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
@@ -1,52 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import React from "react";
3
- import { Filter } from "./filter";
4
-
5
- const meta = {
6
- argTypes: {
7
- tags: { control: { disable: true } },
8
- },
9
- component: Filter,
10
- decorators: [
11
- (Story): JSX.Element => (
12
- <div style={{ padding: "8px 12px 8px 16px", width: 264 }}>
13
- <Story />
14
- </div>
15
- ),
16
- ],
17
- title: "Components/Filter/Filter",
18
- } satisfies Meta<typeof Filter>;
19
-
20
- export default meta;
21
-
22
- type Story = StoryObj<typeof meta>;
23
-
24
- const onFilter = (): void => {
25
- // onFilter function
26
- };
27
-
28
- export const FilterStory: Story = {
29
- args: {
30
- categoryView: {
31
- isDisabled: false,
32
- key: "genusSpecies",
33
- label: "Genus Species",
34
- values: [
35
- {
36
- count: 12,
37
- key: "homoSapiens",
38
- label: "Homo sapiens",
39
- selected: false,
40
- },
41
- {
42
- count: 6,
43
- key: "musMusculus",
44
- label: "Mus musculus",
45
- selected: false,
46
- },
47
- ],
48
- },
49
- isFilterDrawer: false,
50
- onFilter,
51
- },
52
- };
@@ -1,23 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import { FilterTag } from "./filterTag";
3
-
4
- const meta = {
5
- argTypes: {
6
- label: { control: "text" },
7
- superseded: { control: "boolean" },
8
- },
9
- component: FilterTag,
10
- title: "Components/Filter/FilterTag",
11
- } satisfies Meta<typeof FilterTag>;
12
-
13
- export default meta;
14
-
15
- type Story = StoryObj<typeof meta>;
16
-
17
- export const FilterTagStory: Story = {
18
- args: {
19
- label: "Male",
20
- onRemove: () => {},
21
- superseded: false,
22
- },
23
- };
@@ -1,101 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import React from "react";
3
- import { FilterMenuStory } from "../FilterMenu/filterMenu.stories";
4
- import { Filters } from "./filters";
5
-
6
- export default {
7
- argTypes: {
8
- categories: { control: { disable: true } },
9
- onFilter: { control: { disable: true } },
10
- },
11
- component: Filters,
12
- decorators: [
13
- (Story): JSX.Element => (
14
- <div style={{ width: 264 }}>
15
- <Story />
16
- </div>
17
- ),
18
- ],
19
- title: "Components/Filter/Filters",
20
- } as Meta<typeof Filters>;
21
-
22
- type Story = StoryObj<typeof Filters>;
23
-
24
- const onFilter = (): void => {
25
- // onFilter function
26
- };
27
-
28
- const defaultValues = [
29
- {
30
- count: 1,
31
- key: "item1",
32
- label: "Item 1",
33
- selected: false,
34
- },
35
- {
36
- count: 10,
37
- key: "item2",
38
- label: "Item 2",
39
- selected: false,
40
- },
41
- ];
42
-
43
- export const FiltersStory: Story = {
44
- args: {
45
- categoryFilters: [
46
- {
47
- categoryViews: [
48
- {
49
- isDisabled: false,
50
- key: "genusSpecies",
51
- label: "Genus Species",
52
- values: [
53
- {
54
- count: 12,
55
- key: "homoSapiens",
56
- label: "Homo sapiens",
57
- selected: false,
58
- },
59
- {
60
- count: 6,
61
- key: "musMusculus",
62
- label: "Mus musculus",
63
- selected: false,
64
- },
65
- ],
66
- },
67
- ],
68
- },
69
- {
70
- categoryViews: [
71
- {
72
- isDisabled: false,
73
- key: "donorDisease",
74
- label: "Donor Disease",
75
- values: FilterMenuStory.args?.values || defaultValues,
76
- },
77
- {
78
- isDisabled: true,
79
- key: "anatomicalEntity",
80
- label: "Anatomical Entity",
81
- values: [
82
- {
83
- count: 12,
84
- key: "oralCavity",
85
- label: "oral cavity",
86
- selected: true,
87
- },
88
- {
89
- count: 6,
90
- key: "pancreas",
91
- label: "pancreas",
92
- selected: false,
93
- },
94
- ],
95
- },
96
- ],
97
- },
98
- ],
99
- onFilter: onFilter,
100
- },
101
- };
@@ -1,38 +0,0 @@
1
- import { jest } from "@jest/globals";
2
- import { composeStories } from "@storybook/react";
3
- import { render, screen } from "@testing-library/react";
4
- import React, { FormEvent } from "react";
5
- import { RANGE_OPERATOR } from "../src/components/Filter/components/FilterRange/types";
6
-
7
- const ON_SUBMIT = jest.fn();
8
-
9
- jest.unstable_mockModule(
10
- "../src/components/Filter/components/FilterRange/hooks/UseFilterRange/hook",
11
- () => ({
12
- useFilterRange: jest.fn(() => ({
13
- onChange: jest.fn(),
14
- onSubmit: (e: FormEvent): void => {
15
- e.preventDefault();
16
- ON_SUBMIT(e);
17
- },
18
- value: RANGE_OPERATOR.BETWEEN,
19
- })),
20
- })
21
- );
22
-
23
- const stories = await import(
24
- "../src/components/Filter/components/FilterRange/stories/filterRange.stories"
25
- );
26
- const { Default } = composeStories(stories);
27
-
28
- describe("FilterRangeWithMockedHook", () => {
29
- describe("submit button", () => {
30
- beforeEach(() => {
31
- render(<Default />);
32
- });
33
- it("has a submit button that can be clicked", () => {
34
- screen.getByText("Filter").click();
35
- expect(ON_SUBMIT).toHaveBeenCalledTimes(1);
36
- });
37
- });
38
- });