@databiosphere/findable-ui 25.1.0 → 26.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 (195) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +44 -0
  3. package/lib/common/entities.d.ts +25 -0
  4. package/lib/components/DataDictionary/common/utils.js +10 -8
  5. package/lib/components/DataDictionary/components/Entities/entities.d.ts +1 -1
  6. package/lib/components/DataDictionary/components/Entities/entities.js +2 -2
  7. package/lib/components/DataDictionary/components/Entities/types.d.ts +3 -1
  8. package/lib/components/DataDictionary/components/Entity/entity.d.ts +1 -1
  9. package/lib/components/DataDictionary/components/Entity/entity.js +2 -2
  10. package/lib/components/DataDictionary/components/Entity/types.d.ts +3 -1
  11. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +1 -2
  12. package/lib/components/DataDictionary/components/Table/hook.d.ts +2 -2
  13. package/lib/components/DataDictionary/components/Table/hook.js +2 -3
  14. package/lib/components/DataDictionary/dataDictionary.js +2 -2
  15. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +7 -2
  16. package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +3 -1
  17. package/lib/components/Detail/components/Table/stories/args.d.ts +27 -0
  18. package/lib/components/Detail/components/Table/stories/args.js +100 -0
  19. package/lib/components/Detail/components/Table/stories/constants.d.ts +4 -0
  20. package/lib/components/Detail/components/Table/stories/constants.js +11 -0
  21. package/lib/components/Detail/components/Table/stories/filter/args.d.ts +5 -0
  22. package/lib/components/Detail/components/Table/stories/filter/args.js +50 -0
  23. package/lib/components/Detail/components/Table/stories/filter/filter.stories.d.ts +11 -0
  24. package/lib/components/Detail/components/Table/stories/filter/filter.stories.js +78 -0
  25. package/lib/components/Detail/components/Table/stories/table.stories.d.ts +6 -0
  26. package/lib/components/Detail/components/Table/stories/table.stories.js +19 -0
  27. package/lib/components/Detail/components/Table/table.js +2 -0
  28. package/lib/components/Export/components/ExportMethod/exportMethod.d.ts +2 -2
  29. package/lib/components/Export/components/ExportMethod/exportMethod.styles.js +1 -1
  30. package/lib/components/Filter/components/FilterRange/constants.d.ts +8 -0
  31. package/lib/components/Filter/components/FilterRange/constants.js +27 -0
  32. package/lib/components/Filter/components/FilterRange/filterRange.d.ts +2 -0
  33. package/lib/components/Filter/components/FilterRange/filterRange.js +26 -0
  34. package/lib/components/Filter/components/FilterRange/filterRange.styles.d.ts +4 -0
  35. package/lib/components/Filter/components/FilterRange/filterRange.styles.js +66 -0
  36. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.d.ts +2 -0
  37. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.js +14 -0
  38. package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/types.d.ts +8 -0
  39. package/lib/components/Filter/components/FilterRange/stories/filterRange.stories.d.ts +6 -0
  40. package/lib/components/Filter/components/FilterRange/stories/filterRange.stories.js +9 -0
  41. package/lib/components/Filter/components/FilterRange/types.d.ts +8 -0
  42. package/lib/components/Filter/components/FilterRange/types.js +6 -0
  43. package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.js +1 -2
  44. package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.d.ts +1 -1
  45. package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.js +5 -2
  46. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.d.ts +2 -1
  47. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.js +2 -1
  48. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.js +10 -7
  49. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.d.ts +6 -0
  50. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.js +4 -4
  51. package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.js +1 -2
  52. package/lib/components/Index/components/EntitiesView/components/ChartView/stories/args.js +1 -0
  53. package/lib/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.js +0 -1
  54. package/lib/components/Index/components/EntitiesView/components/ChartView/types.d.ts +2 -0
  55. package/lib/components/Layout/components/Header/components/Content/components/Slogan/slogan.styles.d.ts +1 -1
  56. package/lib/components/Layout/components/Outline/outline.styles.js +1 -2
  57. package/lib/components/Loading/loading.styles.js +2 -1
  58. package/lib/components/Login/components/Button/constants.js +2 -3
  59. package/lib/components/Login/components/Button/types.d.ts +1 -1
  60. package/lib/components/Login/components/Buttons/types.d.ts +1 -1
  61. package/lib/components/Support/components/SupportRequest/components/Dialog/dialog.styles.js +4 -4
  62. package/lib/components/Support/components/ViewSupport/viewSupport.styles.js +2 -2
  63. package/lib/components/Table/columnDef/columnFilters/filterFn.d.ts +13 -0
  64. package/lib/components/Table/columnDef/columnFilters/filterFn.js +22 -0
  65. package/lib/components/Table/common/columnDef.js +2 -0
  66. package/lib/components/Table/common/utils.d.ts +1 -13
  67. package/lib/components/Table/common/utils.js +1 -23
  68. package/lib/components/Table/table.js +3 -1
  69. package/lib/components/TableCreator/tableCreator.js +12 -3
  70. package/lib/components/common/Button/components/ButtonOutline/buttonOutline.styles.js +7 -7
  71. package/lib/components/common/Button/constants.d.ts +2 -0
  72. package/lib/components/common/Button/constants.js +21 -0
  73. package/lib/components/common/LoginDialog/loginDialog.styles.js +2 -3
  74. package/lib/components/types.d.ts +3 -0
  75. package/lib/config/entities.d.ts +3 -3
  76. package/lib/config/utils.js +1 -1
  77. package/lib/hooks/useEntityList.js +2 -1
  78. package/lib/hooks/useEntityService.js +1 -1
  79. package/lib/hooks/useExploreMode/types.d.ts +6 -0
  80. package/lib/hooks/useExploreMode/types.js +6 -0
  81. package/lib/hooks/{useExploreMode.d.ts → useExploreMode/useExploreMode.d.ts} +1 -6
  82. package/lib/hooks/{useExploreMode.js → useExploreMode/useExploreMode.js} +1 -7
  83. package/lib/hooks/useFetchEntity.js +2 -1
  84. package/lib/styles/common/constants/colorMixes.d.ts +18 -0
  85. package/lib/styles/common/constants/colorMixes.js +19 -0
  86. package/lib/styles/common/constants/shadows.d.ts +5 -0
  87. package/lib/styles/common/constants/shadows.js +5 -0
  88. package/lib/styles/common/mui/button.d.ts +10 -2
  89. package/lib/styles/common/mui/button.js +12 -2
  90. package/lib/tests/mui/constants.d.ts +1 -0
  91. package/lib/tests/mui/constants.js +1 -0
  92. package/lib/tests/testIds.d.ts +1 -0
  93. package/lib/tests/testIds.js +1 -0
  94. package/lib/theme/common/components.d.ts +2 -3
  95. package/lib/theme/common/components.js +47 -51
  96. package/lib/theme/common/palette.d.ts +0 -44
  97. package/lib/theme/common/palette.js +27 -82
  98. package/lib/theme/common/shadows.d.ts +2 -28
  99. package/lib/theme/common/shadows.js +27 -32
  100. package/lib/theme/components/muiAlert.js +5 -5
  101. package/lib/theme/theme.js +3 -4
  102. package/lib/views/ExploreView/exploreView.js +2 -2
  103. package/package.json +4 -4
  104. package/src/common/entities.ts +30 -0
  105. package/src/components/DataDictionary/common/utils.ts +12 -8
  106. package/src/components/DataDictionary/components/Entities/entities.tsx +11 -2
  107. package/src/components/DataDictionary/components/Entities/types.ts +3 -1
  108. package/src/components/DataDictionary/components/Entity/entity.tsx +2 -1
  109. package/src/components/DataDictionary/components/Entity/types.ts +3 -1
  110. package/src/components/DataDictionary/components/Table/components/BasicCell/types.ts +1 -2
  111. package/src/components/DataDictionary/components/Table/hook.ts +6 -4
  112. package/src/components/DataDictionary/dataDictionary.tsx +2 -2
  113. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +8 -2
  114. package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +3 -1
  115. package/src/components/Detail/components/Table/stories/args.ts +104 -0
  116. package/src/components/Detail/components/Table/stories/constants.ts +15 -0
  117. package/src/components/Detail/components/Table/stories/filter/args.ts +54 -0
  118. package/src/components/Detail/components/Table/stories/filter/filter.stories.tsx +90 -0
  119. package/src/components/Detail/components/Table/stories/table.stories.tsx +32 -0
  120. package/src/components/Detail/components/Table/table.tsx +2 -0
  121. package/src/components/Export/components/ExportMethod/exportMethod.styles.ts +1 -1
  122. package/src/components/Export/components/ExportMethod/exportMethod.tsx +3 -2
  123. package/src/components/Filter/components/FilterRange/constants.ts +41 -0
  124. package/src/components/Filter/components/FilterRange/filterRange.styles.ts +71 -0
  125. package/src/components/Filter/components/FilterRange/filterRange.tsx +71 -0
  126. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.ts +20 -0
  127. package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/types.ts +9 -0
  128. package/src/components/Filter/components/FilterRange/stories/filterRange.stories.tsx +15 -0
  129. package/src/components/Filter/components/FilterRange/types.ts +9 -0
  130. package/src/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.ts +1 -2
  131. package/src/components/Index/components/EntitiesView/components/ChartView/chartView.tsx +2 -1
  132. package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.ts +3 -1
  133. package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.ts +10 -7
  134. package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.ts +10 -4
  135. package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.tsx +1 -2
  136. package/src/components/Index/components/EntitiesView/components/ChartView/stories/args.ts +1 -0
  137. package/src/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.tsx +0 -1
  138. package/src/components/Index/components/EntitiesView/components/ChartView/types.ts +2 -0
  139. package/src/components/Layout/components/Outline/outline.styles.ts +1 -2
  140. package/src/components/Loading/loading.styles.ts +2 -1
  141. package/src/components/Login/components/Button/constants.ts +2 -3
  142. package/src/components/Login/components/Button/types.ts +1 -1
  143. package/src/components/Login/components/Buttons/types.ts +1 -1
  144. package/src/components/Support/components/SupportRequest/components/Dialog/dialog.styles.ts +4 -4
  145. package/src/components/Support/components/ViewSupport/viewSupport.styles.ts +2 -2
  146. package/src/components/Table/columnDef/columnFilters/filterFn.ts +27 -0
  147. package/src/components/Table/common/columnDef.ts +2 -0
  148. package/src/components/Table/common/utils.ts +1 -27
  149. package/src/components/Table/table.tsx +3 -1
  150. package/src/components/TableCreator/tableCreator.tsx +17 -3
  151. package/src/components/common/Button/components/ButtonOutline/buttonOutline.styles.ts +7 -7
  152. package/src/components/common/Button/constants.ts +23 -0
  153. package/src/components/common/LoginDialog/loginDialog.styles.ts +2 -3
  154. package/src/components/types.ts +4 -0
  155. package/src/config/entities.ts +3 -3
  156. package/src/config/utils.ts +1 -1
  157. package/src/hooks/useEntityList.ts +2 -1
  158. package/src/hooks/useEntityService.ts +1 -1
  159. package/src/hooks/useExploreMode/types.ts +7 -0
  160. package/src/hooks/{useExploreMode.ts → useExploreMode/useExploreMode.ts} +2 -9
  161. package/src/hooks/useFetchEntity.tsx +2 -1
  162. package/src/styles/common/constants/colorMixes.ts +20 -0
  163. package/src/styles/common/constants/shadows.ts +5 -0
  164. package/src/styles/common/mui/button.ts +20 -2
  165. package/src/tests/mui/constants.ts +1 -0
  166. package/src/tests/testIds.ts +1 -0
  167. package/src/theme/common/components.ts +47 -59
  168. package/src/theme/common/palette.ts +27 -86
  169. package/src/theme/common/shadows.ts +28 -33
  170. package/src/theme/components/muiAlert.ts +5 -5
  171. package/src/theme/theme.ts +4 -8
  172. package/src/views/ExploreView/exploreView.tsx +6 -2
  173. package/tests/chart.test.tsx +113 -22
  174. package/tests/chartView.test.tsx +12 -0
  175. package/tests/filterRange.test.tsx +87 -0
  176. package/tests/filterRangeMock.test.tsx +38 -0
  177. package/tests/tableFilter.test.tsx +90 -0
  178. package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +0 -6
  179. package/lib/components/DataDictionary/components/Table/columns/columnDef.js +0 -33
  180. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +0 -5
  181. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +0 -5
  182. package/lib/components/DataDictionary/components/Table/columns/types.d.ts +0 -2
  183. package/lib/styles/common/mixins/shadows.d.ts +0 -3
  184. package/lib/styles/common/mixins/shadows.js +0 -4
  185. package/lib/theme/common/entities.d.ts +0 -6
  186. package/lib/theme/common/entities.js +0 -1
  187. package/src/components/DataDictionary/components/Table/columns/columnDef.ts +0 -47
  188. package/src/components/DataDictionary/components/Table/columns/columnIdentifier.ts +0 -5
  189. package/src/components/DataDictionary/components/Table/columns/types.ts +0 -3
  190. package/src/styles/common/mixins/shadows.ts +0 -7
  191. package/src/theme/common/entities.ts +0 -7
  192. /package/lib/components/{DataDictionary/components/Table/columns → Filter/components/FilterRange/hooks/UseFilterRange}/types.js +0 -0
  193. /package/lib/styles/common/{mui → constants}/palette.d.ts +0 -0
  194. /package/lib/styles/common/{mui → constants}/palette.js +0 -0
  195. /package/src/styles/common/{mui → constants}/palette.ts +0 -0
@@ -94,148 +94,89 @@ const WHITE = {
94
94
  DEFAULT: "#ffffff",
95
95
  };
96
96
 
97
- /**
98
- * Color alpha
99
- */
100
- const ALPHA = {
101
- A04: "0a",
102
- A08: "14",
103
- A32: "52",
104
- A60: "99",
105
- A64: "a3",
106
- A80: "cc",
107
- };
108
-
109
- /**
110
- * Color constants
111
- */
112
- export const alertLight = ALERT.LIGHT;
113
- export const alertLightest = ALERT.LIGHTEST;
114
- export const alertMain = ALERT.MAIN;
115
- export const backgroundDefault = BACKGROUND.DEFAULT;
116
- export const infoContrastText = INFO.CONTRAST_TEXT;
117
- export const infoLight = INFO.LIGHT;
118
- export const infoLightest = INFO.LIGHTEST;
119
- export const infoMain = INFO.MAIN;
120
- export const inkLight = INK.LIGHT;
121
- export const inkMain = INK.MAIN;
122
- export const primaryDark = PRIMARY.DARK;
123
- export const primaryLightest = PRIMARY.LIGHTEST;
124
- export const primaryMain = PRIMARY.MAIN;
125
- export const smokeDark = SMOKE.DARK;
126
- export const smokeLight = SMOKE.LIGHT;
127
- export const smokeLightest = SMOKE.LIGHTEST;
128
- export const smokeMain = SMOKE.MAIN;
129
- export const successLight = SUCCESS.LIGHT;
130
- export const successLightest = SUCCESS.LIGHTEST;
131
- export const successMain = SUCCESS.MAIN;
132
- export const textPrimary = TEXT.PRIMARY;
133
- export const warningContrastText = WARNING.CONTRAST_TEXT;
134
- export const warningLight = WARNING.LIGHT;
135
- export const warningLightest = WARNING.LIGHTEST;
136
- export const warningMain = WARNING.MAIN;
137
- export const black = BLACK.DEFAULT;
138
- export const white = WHITE.DEFAULT;
139
-
140
- /**
141
- * Color alpha constants
142
- */
143
- export const alpha04 = ALPHA.A04;
144
- export const alpha08 = ALPHA.A08;
145
- export const alpha32 = ALPHA.A32;
146
- export const alpha60 = ALPHA.A60;
147
- export const alpha64 = ALPHA.A64;
148
- export const alpha80 = ALPHA.A80;
149
-
150
- /**
151
- * Shades
152
- */
153
- export const black04 = `${black}${alpha04}`;
154
- export const black08 = `${black}${alpha08}`;
155
-
156
97
  /**
157
98
  * Palette Option "Alert"
158
99
  */
159
100
  export const alert: PaletteColorOptions = {
160
- light: alertLight,
161
- lightest: alertLightest,
162
- main: alertMain,
101
+ light: ALERT.LIGHT,
102
+ lightest: ALERT.LIGHTEST,
103
+ main: ALERT.MAIN,
163
104
  };
164
105
 
165
106
  /**
166
107
  * Palette Option "Background"
167
108
  */
168
109
  export const background: Pick<TypeBackground, "default"> = {
169
- default: backgroundDefault,
110
+ default: BACKGROUND.DEFAULT,
170
111
  };
171
112
 
172
113
  /**
173
114
  * Palette Option "Common"
174
115
  */
175
116
  export const common: CommonColors = {
176
- black: black,
177
- white: white,
117
+ black: BLACK.DEFAULT,
118
+ white: WHITE.DEFAULT,
178
119
  };
179
120
 
180
121
  /**
181
122
  * Palette Option "Info"
182
123
  */
183
124
  export const info: PaletteColorOptions = {
184
- contrastText: infoContrastText,
185
- light: infoLight,
186
- lightest: infoLightest,
187
- main: infoMain,
125
+ contrastText: INFO.CONTRAST_TEXT,
126
+ light: INFO.LIGHT,
127
+ lightest: INFO.LIGHTEST,
128
+ main: INFO.MAIN,
188
129
  };
189
130
 
190
131
  /**
191
132
  * Palette Option "Ink"
192
133
  */
193
134
  export const ink: PaletteColorOptions = {
194
- light: inkLight,
195
- main: inkMain,
135
+ light: INK.LIGHT,
136
+ main: INK.MAIN,
196
137
  };
197
138
 
198
139
  /**
199
140
  * Palette Option "Primary"
200
141
  */
201
142
  export const primary: PaletteColorOptions = {
202
- dark: primaryDark,
203
- lightest: primaryLightest,
204
- main: primaryMain,
143
+ dark: PRIMARY.DARK,
144
+ lightest: PRIMARY.LIGHTEST,
145
+ main: PRIMARY.MAIN,
205
146
  };
206
147
 
207
148
  /**
208
149
  * Palette Option "Smoke"
209
150
  */
210
151
  export const smoke: PaletteColorOptions = {
211
- dark: smokeDark,
212
- light: smokeLight,
213
- lightest: smokeLightest,
214
- main: smokeMain,
152
+ dark: SMOKE.DARK,
153
+ light: SMOKE.LIGHT,
154
+ lightest: SMOKE.LIGHTEST,
155
+ main: SMOKE.MAIN,
215
156
  };
216
157
 
217
158
  /**
218
159
  * Palette Option "Success"
219
160
  */
220
161
  export const success: PaletteColorOptions = {
221
- light: successLight,
222
- lightest: successLightest,
223
- main: successMain,
162
+ light: SUCCESS.LIGHT,
163
+ lightest: SUCCESS.LIGHTEST,
164
+ main: SUCCESS.MAIN,
224
165
  };
225
166
 
226
167
  /**
227
168
  * Palette Option "Text"
228
169
  */
229
170
  export const text: Pick<TypeText, "primary"> = {
230
- primary: textPrimary,
171
+ primary: TEXT.PRIMARY,
231
172
  };
232
173
 
233
174
  /**
234
175
  * Palette Option "Warning"
235
176
  */
236
177
  export const warning: PaletteColorOptions = {
237
- contrastText: warningContrastText,
238
- light: warningLight,
239
- lightest: warningLightest,
240
- main: warningMain,
178
+ contrastText: WARNING.CONTRAST_TEXT,
179
+ light: WARNING.LIGHT,
180
+ lightest: WARNING.LIGHTEST,
181
+ main: WARNING.MAIN,
241
182
  };
@@ -1,34 +1,29 @@
1
- /*
2
- * Elevation
3
- */
4
- enum ELEVATION {
5
- E00 = "none",
6
- E01 = "0 1px 4px 0 #00000012",
7
- E02 = "0 8px 8px -4px #10182808, 0 20px 24px -4px #10182814",
8
- }
1
+ import { Shadows } from "@mui/material";
9
2
 
10
- /**
11
- * Stroke
12
- */
13
- enum STROKE {
14
- BOTTOM = "inset 0 -1px 0 0",
15
- TOP = "inset 0 1px 0 0",
16
- }
17
-
18
- /**
19
- * Elevation constants
20
- */
21
- export const elevation00 = ELEVATION.E00;
22
- export const elevation01 = ELEVATION.E01;
23
- export const elevation02 = ELEVATION.E02;
24
-
25
- /**
26
- * Shadows constants
27
- */
28
- export const shadows = [elevation00, elevation01, elevation02];
29
-
30
- /**
31
- * Stroke constants
32
- */
33
- export const strokeBottom = STROKE.BOTTOM;
34
- export const strokeTop = STROKE.TOP;
3
+ export const shadows: Shadows = [
4
+ "none",
5
+ "0 1px 4px 0 #00000012",
6
+ "0 8px 8px -4px #10182808, 0 20px 24px -4px #10182814",
7
+ "none",
8
+ "none",
9
+ "none",
10
+ "none",
11
+ "none",
12
+ "none",
13
+ "none",
14
+ "none",
15
+ "none",
16
+ "none",
17
+ "none",
18
+ "none",
19
+ "none",
20
+ "none",
21
+ "none",
22
+ "none",
23
+ "none",
24
+ "none",
25
+ "none",
26
+ "none",
27
+ "none",
28
+ "none",
29
+ ];
@@ -3,10 +3,10 @@ import { ErrorIcon } from "../../components/common/CustomIcon/components/ErrorIc
3
3
  import { InfoIcon } from "../../components/common/CustomIcon/components/InfoIcon/infoIcon";
4
4
  import { SuccessIcon } from "../../components/common/CustomIcon/components/SuccessIcon/successIcon";
5
5
  import { WarningIcon } from "../../components/common/CustomIcon/components/WarningIcon/warningIcon";
6
+ import { COLOR_MIXES } from "../../styles/common/constants/colorMixes";
6
7
  import { SIZE } from "../../styles/common/constants/size";
7
8
  import { COLOR, SEVERITY, VARIANT } from "../../styles/common/mui/alert";
8
9
  import { FONT_SIZE } from "../../styles/common/mui/icon";
9
- import { alpha32 } from "../common/palette";
10
10
  import { TEXT_BODY_500 } from "../common/typography";
11
11
 
12
12
  export const MuiAlert = (theme: Theme): Components["MuiAlert"] => {
@@ -42,7 +42,7 @@ export const MuiAlert = (theme: Theme): Components["MuiAlert"] => {
42
42
  props: { severity: SEVERITY.ERROR },
43
43
  style: {
44
44
  backgroundColor: theme.palette.alert.lightest,
45
- border: `1px solid ${theme.palette.alert.main}${alpha32}`,
45
+ border: `1px solid ${COLOR_MIXES.ALERT_MAIN_32}`,
46
46
  // eslint-disable-next-line sort-keys -- disabling key order for readability
47
47
  "& .MuiAlert-icon": {
48
48
  color: theme.palette.alert.main,
@@ -53,7 +53,7 @@ export const MuiAlert = (theme: Theme): Components["MuiAlert"] => {
53
53
  props: { severity: SEVERITY.INFO },
54
54
  style: {
55
55
  backgroundColor: theme.palette.info.lightest,
56
- border: `1px solid ${theme.palette.info.main}${alpha32}`,
56
+ border: `1px solid ${COLOR_MIXES.INFO_MAIN_32}`,
57
57
  // eslint-disable-next-line sort-keys -- disabling key order for readability
58
58
  "& .MuiAlert-icon": {
59
59
  color: theme.palette.info.main,
@@ -64,7 +64,7 @@ export const MuiAlert = (theme: Theme): Components["MuiAlert"] => {
64
64
  props: { severity: SEVERITY.SUCCESS },
65
65
  style: {
66
66
  backgroundColor: theme.palette.success.lightest,
67
- border: `1px solid ${theme.palette.success.main}${alpha32}`,
67
+ border: `1px solid ${COLOR_MIXES.SUCCESS_MAIN_32}`,
68
68
  // eslint-disable-next-line sort-keys -- disabling key order for readability
69
69
  "& .MuiAlert-icon": {
70
70
  color: theme.palette.success.main,
@@ -75,7 +75,7 @@ export const MuiAlert = (theme: Theme): Components["MuiAlert"] => {
75
75
  props: { severity: SEVERITY.WARNING },
76
76
  style: {
77
77
  backgroundColor: theme.palette.warning.lightest,
78
- border: `1px solid ${theme.palette.warning.main}${alpha32}`,
78
+ border: `1px solid ${COLOR_MIXES.WARNING_MAIN_32}`,
79
79
  // eslint-disable-next-line sort-keys -- disabling key order for readability
80
80
  "& .MuiAlert-icon": {
81
81
  color: theme.palette.warning.main,
@@ -1,4 +1,4 @@
1
- import { createTheme, Shadows, Theme, ThemeOptions } from "@mui/material";
1
+ import { createTheme, Theme, ThemeOptions } from "@mui/material";
2
2
  import { deepmerge } from "@mui/utils";
3
3
  import * as B from "./common/breakpoints";
4
4
  import * as C from "./common/components";
@@ -42,6 +42,7 @@ export function createAppTheme(customOptions: ThemeOptions = {}): Theme {
42
42
  text: P.text,
43
43
  warning: P.warning,
44
44
  },
45
+ shadows,
45
46
  spacing: 4,
46
47
  typography: {
47
48
  [T.TEXT_BODY_400]: T.textBody400,
@@ -67,11 +68,6 @@ export function createAppTheme(customOptions: ThemeOptions = {}): Theme {
67
68
  )
68
69
  );
69
70
 
70
- // Default shadow overrides.
71
- theme.shadows = [...theme.shadows].map(
72
- (shadow, s) => shadows[s] || shadow
73
- ) as Shadows;
74
-
75
71
  // Theme components.
76
72
  theme.components = {
77
73
  MuiAccordion: C.MuiAccordion(theme),
@@ -80,7 +76,7 @@ export function createAppTheme(customOptions: ThemeOptions = {}): Theme {
80
76
  MuiAlert: M.MuiAlert(theme),
81
77
  MuiAlertTitle: M.MuiAlertTitle,
82
78
  MuiAppBar: C.MuiAppBar,
83
- MuiBackdrop: C.MuiBackdrop(theme),
79
+ MuiBackdrop: C.MuiBackdrop,
84
80
  MuiBreadcrumbs: C.MuiBreadcrumbs(theme),
85
81
  MuiButton: C.MuiButton(theme),
86
82
  MuiButtonBase: C.MuiButtonBase(theme),
@@ -90,7 +86,7 @@ export function createAppTheme(customOptions: ThemeOptions = {}): Theme {
90
86
  MuiChip: C.MuiChip(theme),
91
87
  MuiCircularProgress: C.MuiCircularProgress(theme),
92
88
  MuiCssBaseline: C.MuiCssBaseline(theme),
93
- MuiDialog: C.MuiDialog(theme),
89
+ MuiDialog: C.MuiDialog,
94
90
  MuiDialogActions: C.MuiDialogActions,
95
91
  MuiDialogContent: C.MuiDialogContent(theme),
96
92
  MuiDialogTitle: C.MuiDialogTitle(theme),
@@ -53,7 +53,7 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
53
53
  const { config, entityConfig } = useConfig(); // Get app level config.
54
54
  const { exploreDispatch, exploreState } = useExploreState(); // Get the useReducer state and dispatch for "Explore".
55
55
  const { explorerTitle, summaryConfig, trackingConfig } = config;
56
- const { listView } = entityConfig;
56
+ const { label, listView } = entityConfig;
57
57
  const { listHero, subTitleHero } = listView || {};
58
58
  const { categoryGroups, categoryViews, filterCount, loading } = exploreState;
59
59
  const { response: summaryResponse } = useSummary(); // Fetch summary.
@@ -166,7 +166,11 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
166
166
  <IndexView
167
167
  className={props.className}
168
168
  chart={
169
- <ChartView categoryFilters={categoryFilters} loading={loading} />
169
+ <ChartView
170
+ categoryFilters={categoryFilters}
171
+ entityName={label}
172
+ loading={loading}
173
+ />
170
174
  }
171
175
  list={<EntityList entityListType={entityListType} />}
172
176
  ListHero={renderComponent(listHero)}
@@ -2,9 +2,15 @@ import { composeStories } from "@storybook/react";
2
2
  import { render, screen } from "@testing-library/react";
3
3
  import React from "react";
4
4
  import { SelectCategoryValueView } from "../src/common/entities";
5
+ import { parseTranslate } from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils";
5
6
  import { CHART_TEST_ID } from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants";
6
7
  import * as stories from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories";
7
- import { PALETTE } from "../src/styles/common/mui/palette";
8
+ import { PALETTE } from "../src/styles/common/constants/palette";
9
+
10
+ const CLASSNAMES = {
11
+ TEXT_CATEGORY_LABEL: "text-category-label",
12
+ TEXT_COUNT: "text-count",
13
+ };
8
14
 
9
15
  const { Default, Selected } = composeStories(stories);
10
16
 
@@ -29,30 +35,35 @@ describe("Chart", () => {
29
35
  });
30
36
 
31
37
  describe("category labels and counts", () => {
32
- const countSet = new Set(DATA.map(mapCount));
33
- const labelSet = new Set(DATA.map(mapLabel));
38
+ const counts = DATA.map(mapCount);
39
+ const labels = DATA.map(mapLabel);
34
40
  let countTextEls: NodeListOf<SVGElement>;
35
41
  let labelTextEls: NodeListOf<SVGElement>;
42
+ let titleTextEls: NodeListOf<SVGElement>;
36
43
 
37
44
  beforeEach(() => {
38
45
  render(<Default testId={CHART_TEST_ID} />);
39
- countTextEls = getEls("text-count", "text");
40
- labelTextEls = getEls("text-category-label", "text");
46
+ countTextEls = getEls(CLASSNAMES.TEXT_COUNT, "text");
47
+ labelTextEls = getEls(CLASSNAMES.TEXT_CATEGORY_LABEL, "text");
48
+ titleTextEls = getEls(CLASSNAMES.TEXT_CATEGORY_LABEL, "title");
41
49
  });
42
50
 
43
- it("renders category labels", () => {
44
- expect(labelTextEls.length).toEqual(labelSet.size);
45
- labelTextEls.forEach(({ textContent }) => {
46
- expect(textContent).toBeDefined();
47
- expect(labelSet.has(textContent || "")).toBeTruthy();
51
+ it("renders category labels and matching titles", () => {
52
+ expect(labelTextEls.length).toEqual(labels.length);
53
+ expect(titleTextEls.length).toEqual(labels.length);
54
+ labelTextEls.forEach((el, i) => {
55
+ const labelText = getLabelText(el);
56
+ const titleText = titleTextEls[i].textContent || "";
57
+ expect(labels.some((l) => l.includes(labelText))).toBeTruthy();
58
+ expect(labels.includes(titleText)).toBeTruthy();
48
59
  });
49
60
  });
50
61
 
51
62
  it("renders category counts", () => {
52
- expect(countTextEls.length).toEqual(countSet.size);
63
+ expect(countTextEls.length).toEqual(counts.length);
53
64
  countTextEls.forEach(({ textContent }) => {
54
65
  expect(textContent).toBeDefined();
55
- expect(countSet.has(textContent || "")).toBeTruthy();
66
+ expect(counts.includes(textContent || "")).toBeTruthy();
56
67
  });
57
68
  });
58
69
  });
@@ -60,18 +71,21 @@ describe("Chart", () => {
60
71
  describe("category labels with selected values", () => {
61
72
  it("renders selected category labels with '(selected)'", () => {
62
73
  render(<Selected testId={CHART_TEST_ID} />);
63
- const textEls = getEls("text-category-label", "text");
64
- for (let i = 0; i < SELECTED_DATA.length; i++) {
65
- const selectedData = SELECTED_DATA[i];
66
- const textEl = textEls[i];
74
+ const textEls = getEls(CLASSNAMES.TEXT_CATEGORY_LABEL, "text");
75
+ const titleEls = getEls(CLASSNAMES.TEXT_CATEGORY_LABEL, "title");
76
+ SELECTED_DATA.forEach((selectedData, i) => {
77
+ const labelText = getLabelText(textEls[i]);
78
+ const titleText = titleEls[i].textContent || "";
67
79
  if (selectedData.selected) {
68
- expect(textEl.textContent).toEqual(
69
- `${selectedData.label} (selected)`
70
- );
71
- continue;
80
+ const expected = `${selectedData.label} (selected)`;
81
+ expect(titleText).toEqual(expected);
82
+ expect(expected.includes(labelText)).toBeTruthy();
83
+ return;
72
84
  }
73
- expect(textEl.textContent).toEqual(selectedData.label);
74
- }
85
+ const expected = selectedData.label;
86
+ expect(titleText).toEqual(expected);
87
+ expect(expected.includes(labelText)).toBeTruthy();
88
+ });
75
89
  });
76
90
  });
77
91
 
@@ -108,8 +122,31 @@ describe("Chart", () => {
108
122
  expect([...barEls].some(isFillPrimaryMain)).toBeTruthy();
109
123
  });
110
124
  });
125
+
126
+ describe("bars sorted by count", () => {
127
+ it("renders bars in descending order of count", () => {
128
+ render(<Default testId={CHART_TEST_ID} />);
129
+ // Order data by count in descending order.
130
+ const counts = [...DATA].sort(sortByCount).map(mapCount);
131
+ // Sort count <text> elements by their transform’s translate‑Y (vertical) value, since they’re rendered in data order.
132
+ const countTextEls = getEls(CLASSNAMES.TEXT_COUNT, "text");
133
+ const textContents = [...countTextEls]
134
+ .sort(sortByTransform)
135
+ .map(mapTextContent);
136
+ expect(textContents).toEqual(counts);
137
+ });
138
+ });
111
139
  });
112
140
 
141
+ /**
142
+ * Finds the first text node within the given SVGElement.
143
+ * @param el - The SVG element to search for a text node.
144
+ * @returns The first text node found within the element.
145
+ */
146
+ function findTextNode(el: SVGElement): Node | undefined {
147
+ return [...el.childNodes].find(({ nodeType }) => nodeType === Node.TEXT_NODE);
148
+ }
149
+
113
150
  /**
114
151
  * Get the SVG group element for a given class name.
115
152
  * @param className - Class name.
@@ -133,6 +170,17 @@ function getEls(className: string, selectors: string): NodeListOf<SVGElement> {
133
170
  return gEls[0].querySelectorAll(selectors);
134
171
  }
135
172
 
173
+ /**
174
+ * Retrieves the label text from a given SVGElement by extracting and processing its text content.
175
+ * @param el - The SVGElement from which the label text is to be retrieved.
176
+ * @returns The processed label text derived from the SVGElement.
177
+ */
178
+ function getLabelText(el: SVGElement): string {
179
+ const labelText = stripTrailingEllipsis(findTextNode(el)?.textContent);
180
+ expect(labelText).toBeDefined();
181
+ return labelText || "";
182
+ }
183
+
136
184
  /**
137
185
  * Check if the fill attribute of the element is #C5E3FC.
138
186
  * @param element - Element to check.
@@ -168,3 +216,46 @@ function mapCount(categoryValueView: SelectCategoryValueView): string {
168
216
  function mapLabel(categoryValueView: SelectCategoryValueView): string {
169
217
  return categoryValueView.label;
170
218
  }
219
+
220
+ /**
221
+ * Maps the text content of an SVG element to a string.
222
+ * @param el - SVG element.
223
+ * @returns Text content as a string.
224
+ */
225
+ function mapTextContent(el: SVGElement): string | null {
226
+ return el.textContent;
227
+ }
228
+
229
+ /**
230
+ * Sorts category value views by count in descending order.
231
+ * @param a - First category value view.
232
+ * @param b - Second category value view.
233
+ * @returns Sorted category value views.
234
+ */
235
+ function sortByCount(
236
+ a: SelectCategoryValueView,
237
+ b: SelectCategoryValueView
238
+ ): number {
239
+ return b.count - a.count;
240
+ }
241
+
242
+ /**
243
+ * Sorts SVG elements by their "y" transform attribute.
244
+ * @param a - First SVG element.
245
+ * @param b - Second SVG element.
246
+ * @returns Sorted SVG elements.
247
+ */
248
+ function sortByTransform(a: SVGElement, b: SVGElement): number {
249
+ const aTransform = parseTranslate(a.getAttribute("transform"));
250
+ const bTransform = parseTranslate(b.getAttribute("transform"));
251
+ return aTransform[1] - bTransform[1];
252
+ }
253
+
254
+ /**
255
+ * Strips trailing ellipsis from a string.
256
+ * @param text - The input string.
257
+ * @returns The string without trailing ellipsis.
258
+ */
259
+ function stripTrailingEllipsis(text?: string | null): string {
260
+ return (text || "").replace(/…{1,3}$/, "");
261
+ }
@@ -28,6 +28,18 @@ describe("ChartView", () => {
28
28
  expect(categoryLabels.length).toBe(2);
29
29
  });
30
30
 
31
+ it("renders chart titles correctly", () => {
32
+ render(<Default />);
33
+ const {
34
+ args: { entityName },
35
+ } = Default;
36
+ ["Biological Sex", "Genus Species"].forEach((category) => {
37
+ expect(
38
+ screen.getByText(new RegExp(`${entityName} per ${category}`))
39
+ ).toBeDefined();
40
+ });
41
+ });
42
+
31
43
  it("renders charts for each category", () => {
32
44
  render(<Default />);
33
45
  const svgEls = document.querySelectorAll("svg");
@@ -0,0 +1,87 @@
1
+ import { composeStories } from "@storybook/react";
2
+ import { fireEvent, render, screen } from "@testing-library/react";
3
+ import React from "react";
4
+ import * as stories from "../src/components/Filter/components/FilterRange/stories/filterRange.stories";
5
+ import { MUI_CLASSES } from "../src/tests/mui/constants";
6
+ import { TEST_IDS } from "../src/tests/testIds";
7
+ import { getClassNames } from "../src/utils/tests";
8
+
9
+ const BETWEEN = "Between";
10
+ const GREATER_THAN = "Greater Than";
11
+ const LESS_THAN = "Less Than";
12
+
13
+ const { Default } = composeStories(stories);
14
+
15
+ describe("FilterRange", () => {
16
+ let filterEl: HTMLFormElement;
17
+
18
+ beforeEach(() => {
19
+ render(<Default />);
20
+ filterEl = screen.getByTestId(TEST_IDS.FILTER_RANGE);
21
+ });
22
+
23
+ describe("Operator BETWEEN", () => {
24
+ it("renders the toggle buttons with correct text", () => {
25
+ expect(screen.getByRole("button", { name: BETWEEN })).toBeDefined();
26
+ expect(screen.getByRole("button", { name: LESS_THAN })).toBeDefined();
27
+ expect(screen.getByRole("button", { name: GREATER_THAN })).toBeDefined();
28
+ });
29
+
30
+ it("renders BETWEEN toggle button as selected", () => {
31
+ expect(
32
+ getClassNames(screen.getByRole("button", { name: BETWEEN }))
33
+ ).toContain(MUI_CLASSES.SELECTED);
34
+ });
35
+
36
+ it("renders BETWEEN input fields with correct labels", () => {
37
+ expect(filterEl.querySelectorAll("label")).toHaveLength(2);
38
+ expect(filterEl.querySelectorAll("input")).toHaveLength(2);
39
+ expect(filterEl.querySelector('label[for="between"]')).toBeDefined();
40
+ expect(filterEl.querySelector('label[for="between-to"]')).toBeDefined();
41
+ expect(filterEl.querySelector('input[name="between"]')).toBeDefined();
42
+ expect(filterEl.querySelector('input[name="between-to"]')).toBeDefined();
43
+ });
44
+
45
+ it("renders filter button", () => {
46
+ expect(screen.getByText("Filter")).toBeDefined();
47
+ });
48
+ });
49
+
50
+ describe("Operator LESS THAN", () => {
51
+ beforeEach(() => {
52
+ fireEvent.click(screen.getByRole("button", { name: LESS_THAN }));
53
+ });
54
+
55
+ it("renders LESS THAN toggle button as selected", () => {
56
+ expect(
57
+ getClassNames(screen.getByRole("button", { name: LESS_THAN }))
58
+ ).toContain(MUI_CLASSES.SELECTED);
59
+ });
60
+
61
+ it("renders LESS THAN input field with correct label", () => {
62
+ expect(filterEl.querySelectorAll("label")).toHaveLength(1);
63
+ expect(filterEl.querySelectorAll("input")).toHaveLength(1);
64
+ expect(filterEl.querySelector('label[for="lessThan"]')).toBeDefined();
65
+ expect(filterEl.querySelector('input[name="lessThan"]')).toBeDefined();
66
+ });
67
+ });
68
+
69
+ describe("Operator GREATER THAN", () => {
70
+ beforeEach(() => {
71
+ fireEvent.click(screen.getByRole("button", { name: GREATER_THAN }));
72
+ });
73
+
74
+ it("renders GREATER THAN toggle button as selected", () => {
75
+ expect(
76
+ getClassNames(screen.getByRole("button", { name: GREATER_THAN }))
77
+ ).toContain(MUI_CLASSES.SELECTED);
78
+ });
79
+
80
+ it("renders GREATER THAN input field with correct label", () => {
81
+ expect(filterEl.querySelectorAll("label")).toHaveLength(1);
82
+ expect(filterEl.querySelectorAll("input")).toHaveLength(1);
83
+ expect(filterEl.querySelector('label[for="greaterThan"]')).toBeDefined();
84
+ expect(filterEl.querySelector('input[name="greaterThan"]')).toBeDefined();
85
+ });
86
+ });
87
+ });