@databiosphere/findable-ui 32.1.1 → 33.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "32.1.1"
2
+ ".": "33.0.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [33.0.0](https://github.com/DataBiosphere/findable-ui/compare/v32.1.1...v33.0.0) (2025-05-23)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * updated allowed annotation values #489 ([#498](https://github.com/DataBiosphere/findable-ui/issues/498))
9
+
10
+ ### Features
11
+
12
+ * updated allowed annotation values [#489](https://github.com/DataBiosphere/findable-ui/issues/489) ([#498](https://github.com/DataBiosphere/findable-ui/issues/498)) ([78a6d4c](https://github.com/DataBiosphere/findable-ui/commit/78a6d4ca3bd798079ae1596078eb91ae2a1b9ab2))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * fix incorrect labels on filters ([#499](https://github.com/DataBiosphere/findable-ui/issues/499)) ([#500](https://github.com/DataBiosphere/findable-ui/issues/500)) ([d6d85e4](https://github.com/DataBiosphere/findable-ui/commit/d6d85e4d04e2d9b6f441a9a2105a1bd31baf560f))
18
+
3
19
  ## [32.1.1](https://github.com/DataBiosphere/findable-ui/compare/v32.1.0...v32.1.1) (2025-05-22)
4
20
 
5
21
 
@@ -9,7 +9,7 @@ import { CategoryConfig } from "./types";
9
9
  * @returns category config.
10
10
  */
11
11
  export declare function findCategoryConfig<V extends VIEW_KIND>(viewKind: V, key: Category["key"], configs: CategoryConfig[]): Extract<CategoryConfig, {
12
- viewKind: V;
12
+ viewKind?: V;
13
13
  }> | undefined;
14
14
  /**
15
15
  * Returns the range category config for the given category config key.
@@ -7,7 +7,11 @@ import { VIEW_KIND } from "../views/types";
7
7
  * @returns category config.
8
8
  */
9
9
  export function findCategoryConfig(viewKind, key, configs) {
10
- return configs.find((c) => c.viewKind === viewKind && c.key === key);
10
+ return configs.find((c) =>
11
+ // When `viewKind` is undefined, it corresponds to a `SelectCategoryConfig`.
12
+ // This predicate ensures that `viewKind` is either explicitly matched or treated as undefined
13
+ // for compatibility with `SelectCategoryConfig` and other explicitly defined view kinds.
14
+ (c.viewKind === undefined || c.viewKind === viewKind) && c.key === key);
11
15
  }
12
16
  /**
13
17
  * Returns the range category config for the given category config key.
@@ -3,9 +3,7 @@ import { ColumnDef, RowData } from "@tanstack/react-table";
3
3
  * Model of a value of a metadata class.
4
4
  */
5
5
  export interface Attribute {
6
- annotations?: {
7
- [key in keyof DataDictionaryPrefix]: string;
8
- };
6
+ annotations?: Record<string, string | string[] | undefined>;
9
7
  description: string;
10
8
  example?: string;
11
9
  multivalued: boolean;
@@ -10,12 +10,12 @@ import { View } from "./dataDictionary.styles";
10
10
  import { useDataDictionary } from "./hooks/UseDataDictionary/hook";
11
11
  import { useLayoutSpacing } from "./hooks/UseLayoutSpacing/hook";
12
12
  export const DataDictionary = ({ className, EntitiesLayout = DefaultEntitiesLayout, Outline = DefaultOutline, OutlineLayout = DefaultOutlineLayout, Title = DefaultTitle, TitleLayout = DefaultTitleLayout, }) => {
13
- const { classes, columnDefs } = useDataDictionary();
13
+ const { classes, columnDefs, title } = useDataDictionary();
14
14
  const { spacing } = useLayoutSpacing();
15
15
  const outline = useMemo(() => buildClassesOutline(classes), [classes]);
16
16
  return (React.createElement(View, { className: className },
17
17
  React.createElement(TitleLayout, { ...spacing },
18
- React.createElement(Title, null)),
18
+ React.createElement(Title, { title: title })),
19
19
  React.createElement(OutlineLayout, { ...spacing },
20
20
  React.createElement(Outline, { outline: outline })),
21
21
  React.createElement(EntitiesLayout, { ...spacing },
@@ -6,6 +6,7 @@ export const useDataDictionary = () => {
6
6
  return useMemo(() => {
7
7
  const classes = dataDictionaryConfig?.dataDictionary?.classes || [];
8
8
  const columnDefs = dataDictionaryConfig?.columnDefs || [];
9
- return { classes, columnDefs };
9
+ const title = dataDictionaryConfig?.dataDictionary?.title || "";
10
+ return { classes, columnDefs, title };
10
11
  }, [dataDictionaryConfig]);
11
12
  };
@@ -3,4 +3,5 @@ import { Attribute, Class } from "../../../../common/entities";
3
3
  export interface UseDataDictionary<T extends RowData = Attribute> {
4
4
  classes: Class<T>[];
5
5
  columnDefs: ColumnDef<T, T[keyof T]>[];
6
+ title: string;
6
7
  }
@@ -3,6 +3,9 @@ import styled from "@emotion/styled";
3
3
  import { AppBar as MAppBar } from "@mui/material";
4
4
  import { smokeMain } from "../../../../styles/common/mixins/colors";
5
5
  import { HEADER_HEIGHT } from "./common/constants";
6
+ // See https://github.com/emotion-js/emotion/issues/1105.
7
+ // See https://github.com/emotion-js/emotion/releases/tag/%40emotion%2Fcache%4011.10.2.
8
+ const ignoreSsrWarning = "/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */";
6
9
  export const AppBar = styled(MAppBar) `
7
10
  border-bottom: 1px solid ${smokeMain};
8
11
 
@@ -31,7 +34,7 @@ export const Left = styled.div `
31
34
  justify-content: flex-start;
32
35
 
33
36
  .MuiButton-navPrimary {
34
- &:first-of-type {
37
+ &:first-child:not(style)${ignoreSsrWarning} { {
35
38
  margin-left: 24px;
36
39
  }
37
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "32.1.1",
3
+ "version": "33.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -13,10 +13,13 @@ export function findCategoryConfig<V extends VIEW_KIND>(
13
13
  viewKind: V,
14
14
  key: Category["key"],
15
15
  configs: CategoryConfig[]
16
- ): Extract<CategoryConfig, { viewKind: V }> | undefined {
16
+ ): Extract<CategoryConfig, { viewKind?: V }> | undefined {
17
17
  return configs.find(
18
- (c): c is Extract<CategoryConfig, { viewKind: V }> =>
19
- c.viewKind === viewKind && c.key === key
18
+ (c): c is Extract<CategoryConfig, { viewKind?: V }> =>
19
+ // When `viewKind` is undefined, it corresponds to a `SelectCategoryConfig`.
20
+ // This predicate ensures that `viewKind` is either explicitly matched or treated as undefined
21
+ // for compatibility with `SelectCategoryConfig` and other explicitly defined view kinds.
22
+ (c.viewKind === undefined || c.viewKind === viewKind) && c.key === key
20
23
  );
21
24
  }
22
25
 
@@ -4,9 +4,8 @@ import { ColumnDef, RowData } from "@tanstack/react-table";
4
4
  * Model of a value of a metadata class.
5
5
  */
6
6
  export interface Attribute {
7
- annotations?: {
8
- [key in keyof DataDictionaryPrefix]: string; // Prefix to fragment mapping, e.g. cxg: "batch_condition".
9
- };
7
+ // Prefix to fragment mapping, e.g. cxg: "batch_condition", or, general tags e.g. tier: "Tier 1" and bionetwork: ["gut"]
8
+ annotations?: Record<string, string | string[] | undefined>; // 'undefined' allows for mix of keys across attributes e.g. tier, or tier and cxg, or cxg
10
9
  description: string;
11
10
  example?: string; // Free text example of attribute
12
11
  multivalued: boolean; // True if attribute can have multiple values
@@ -21,13 +21,13 @@ export const DataDictionary = <T extends RowData = Attribute>({
21
21
  Title = DefaultTitle,
22
22
  TitleLayout = DefaultTitleLayout,
23
23
  }: DataDictionaryProps): JSX.Element => {
24
- const { classes, columnDefs } = useDataDictionary<T>();
24
+ const { classes, columnDefs, title } = useDataDictionary<T>();
25
25
  const { spacing } = useLayoutSpacing();
26
26
  const outline = useMemo(() => buildClassesOutline(classes), [classes]);
27
27
  return (
28
28
  <View className={className}>
29
29
  <TitleLayout {...spacing}>
30
- <Title />
30
+ <Title title={title} />
31
31
  </TitleLayout>
32
32
  <OutlineLayout {...spacing}>
33
33
  <Outline outline={outline} />
@@ -18,6 +18,7 @@ export const useDataDictionary = <
18
18
  return useMemo(() => {
19
19
  const classes = dataDictionaryConfig?.dataDictionary?.classes || [];
20
20
  const columnDefs = dataDictionaryConfig?.columnDefs || [];
21
- return { classes, columnDefs };
21
+ const title = dataDictionaryConfig?.dataDictionary?.title || "";
22
+ return { classes, columnDefs, title };
22
23
  }, [dataDictionaryConfig]);
23
24
  };
@@ -4,4 +4,5 @@ import { Attribute, Class } from "../../../../common/entities";
4
4
  export interface UseDataDictionary<T extends RowData = Attribute> {
5
5
  classes: Class<T>[];
6
6
  columnDefs: ColumnDef<T, T[keyof T]>[];
7
+ title: string;
7
8
  }
@@ -4,6 +4,11 @@ import { AppBar as MAppBar } from "@mui/material";
4
4
  import { smokeMain } from "../../../../styles/common/mixins/colors";
5
5
  import { HEADER_HEIGHT } from "./common/constants";
6
6
 
7
+ // See https://github.com/emotion-js/emotion/issues/1105.
8
+ // See https://github.com/emotion-js/emotion/releases/tag/%40emotion%2Fcache%4011.10.2.
9
+ const ignoreSsrWarning =
10
+ "/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */";
11
+
7
12
  export const AppBar = styled(MAppBar)`
8
13
  border-bottom: 1px solid ${smokeMain};
9
14
 
@@ -34,7 +39,7 @@ export const Left = styled.div`
34
39
  justify-content: flex-start;
35
40
 
36
41
  .MuiButton-navPrimary {
37
- &:first-of-type {
42
+ &:first-child:not(style)${ignoreSsrWarning} { {
38
43
  margin-left: 24px;
39
44
  }
40
45
  }