Skip to content

Commit 57e77e9

Browse files
authored
Merge pull request #129 from kit-data-manager/deps
Update dependencies
2 parents eb9d925 + 36edc17 commit 57e77e9

25 files changed

+1784
-2313
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# See https://pre-commit.com for more information
2-
# See https://pre-commit.com/hooks.html for more hooks
31
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.2.0
6-
hooks:
7-
- id: trailing-whitespace
8-
- id: check-yaml
9-
- id: check-added-large-files
102
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
113
rev: "v0.7.3"
124
hooks:

.storybook/decorators/RootClass.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decorator } from "@storybook/react"
1+
import { Decorator } from "@storybook/react-vite"
22

33
export const withRootClass: Decorator = (Story) => {
44
return (

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { StorybookConfig } from "@storybook/react-vite"
22

33
const config: StorybookConfig = {
44
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)", "../src/**/*.mdx"],
5-
addons: ["@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/addon-themes", "@storybook/addon-docs"],
5+
addons: ["@storybook/addon-themes", "@storybook/addon-docs"],
66
framework: {
77
name: "@storybook/react-vite",
88
options: {}

.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Preview } from "@storybook/react"
1+
import type { Preview } from "@storybook/react-vite"
22
import { withThemeByClassName } from "@storybook/addon-themes"
33

44
import "../src/index.css"

package-lock.json

Lines changed: 1543 additions & 2185 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@
5454
"class-variance-authority": "^0.7.1",
5555
"clsx": "^2.1.1",
5656
"embla-carousel-react": "^8.5.2",
57-
"lucide-react": "^0.511.0",
57+
"lucide-react": "^0.515.0",
5858
"luxon": "^3.5.0",
59-
"react": "^18.3.1",
60-
"react-dom": "^18.3.1",
6159
"swr": "^2.3.0",
6260
"tailwind-merge": "^3.0.1",
6361
"usehooks-ts": "^3.1.0",
@@ -68,39 +66,35 @@
6866
"@babel/core": "^7.26.0",
6967
"@babel/preset-env": "^7.26.0",
7068
"@babel/preset-react": "^7.26.3",
69+
"@elastic/elasticsearch": "^9.0.2",
7170
"@eslint-react/eslint-plugin": "^1.23.2",
7271
"@eslint/eslintrc": "^3.2.0",
7372
"@eslint/js": "^9.15.0",
74-
"@storybook/addon-docs": "^8.5.0",
75-
"@storybook/addon-essentials": "^8.4.7",
76-
"@storybook/addon-interactions": "^8.4.7",
77-
"@storybook/addon-onboarding": "^8.4.7",
78-
"@storybook/addon-themes": "^8.4.7",
79-
"@storybook/blocks": "^8.4.7",
80-
"@storybook/react": "^8.4.7",
81-
"@storybook/react-vite": "^8.4.7",
82-
"@storybook/test": "^8.4.7",
83-
"@storybook/test-runner": "^0.22.0",
73+
"@storybook/addon-docs": "^9.0.9",
74+
"@storybook/addon-onboarding": "^9.0.9",
75+
"@storybook/addon-themes": "^9.0.9",
76+
"@storybook/react-vite": "^9.0.9",
77+
"@storybook/test-runner": "^0.23.0",
8478
"@types/luxon": "^3.4.2",
85-
"@types/react": "^18.3.12",
86-
"@types/react-dom": "^18.3.1",
79+
"@types/react": "^19",
80+
"@types/react-dom": "^19",
8781
"@vitejs/plugin-react": "^4.3.4",
8882
"autoprefixer": "^10.4.20",
8983
"babel-loader": "^10.0.0",
90-
"chromatic": "^11.20.2",
84+
"chromatic": "^12.2.0",
9185
"css-loader": "^7.1.2",
9286
"eslint": "^9.15.0",
9387
"eslint-config-next": "^15.1.5",
9488
"eslint-plugin-react-hooks": "^5.0.0",
9589
"eslint-plugin-react-refresh": "^0.4.14",
96-
"eslint-plugin-storybook": "^0.12.0",
90+
"eslint-plugin-storybook": "^9.0.9",
9791
"eslint-plugin-tailwindcss": "^3.18.0",
9892
"globals": "^16.0.0",
9993
"postcss": "^8.4.49",
10094
"postcss-loader": "^8.1.1",
10195
"postcss-nested": "^7.0.2",
10296
"prettier": "^3.4.2",
103-
"storybook": "^8.4.7",
97+
"storybook": "^9.0.9",
10498
"style-loader": "^4.0.0",
10599
"tailwindcss": "^3.4.16",
106100
"tailwindcss-animate": "^1.0.7",
@@ -113,6 +107,10 @@
113107
"webpack": "^5.97.1",
114108
"webpack-cli": "^6.0.1"
115109
},
110+
"peerDependencies": {
111+
"react": "^18 || ^19",
112+
"react-dom": "^18 || ^19"
113+
},
116114
"files": [
117115
"dist"
118116
],
@@ -137,5 +135,8 @@
137135
"url": "https://orcid.org/0009-0003-2196-9187",
138136
"email": "christopher.raquet@kit.edu"
139137
}
140-
]
138+
],
139+
"overrides": {
140+
"storybook": "$storybook"
141+
}
141142
}

src/components/ReactSearchComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export function ReactSearchComponent({
124124
isLoading
125125
})}
126126
>
127-
{({ wasSearched, isLoading }: SearchContextState) => {
127+
{({ wasSearched, isLoading }) => {
128128
return (
129129
<ErrorBoundary view={ErrorView}>
130130
<Layout

src/components/ReactSearchComponentContext.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"use client"
22

3-
import type { ResponseState } from "@elastic/search-ui"
4-
import type ElasticsearchAPIConnector from "@elastic/search-ui-elasticsearch-connector"
53
import { createContext } from "react"
64
import { SearchConfig } from "@/lib/config/SearchConfig"
5+
import { estypes } from "@elastic/elasticsearch"
76

87
/**
98
* Extends the elasticsearch SearchContext with additional utilities
@@ -22,14 +21,13 @@ export interface ReactSearchComponentContext {
2221
* @param query
2322
* @return May return undefined if the elastic connector is not reachable (`SearchProvider` not mounted)
2423
*/
25-
searchForBackground: (query: string) => Promise<ResponseState | undefined>
24+
searchForBackground: (query: string) => Promise<estypes.SearchHit[] | undefined>
2625

2726
/**
2827
* The current search term
2928
*/
3029
searchTerm: string
3130

32-
elasticConnector?: ElasticsearchAPIConnector
3331
config: SearchConfig
3432
}
3533

@@ -41,10 +39,7 @@ export const ReactSearchComponentContext = createContext<ReactSearchComponentCon
4139
console.error(`ReactSearchComponentContext not mounted, but searchFor was executed`)
4240
},
4341
searchTerm: "",
44-
get elasticConnector() {
45-
return undefined
46-
},
47-
async searchForBackground(): Promise<ResponseState | undefined> {
42+
async searchForBackground(): Promise<estypes.SearchHit[] | undefined> {
4843
console.error(`ReactSearchComponentContext not mounted, but searchFor was executed`)
4944
return undefined
5045
},

src/components/ReactSearchComponentContextProvider.tsx

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import type { SearchConfig } from "@/lib/config/SearchConfig"
22
import type { SearchContextState } from "@elastic/search-ui"
33
import type { PropsWithChildren } from "react"
44
import { ReactSearchComponentContext } from "@/components/ReactSearchComponentContext"
5-
import { SearchConfigBuilder } from "@/lib/config/SearchConfigBuilder"
6-
import { arrayToObjectEntries } from "@/lib/utils"
75
import { WithSearch } from "@elastic/react-search-ui"
8-
import { useCallback, useMemo } from "react"
6+
import { useCallback } from "react"
7+
import { backgroundSearchQuery } from "@/lib/queries"
98

109
/**
1110
* Extends the elasticsearch SearchContext with additional functionality. This provider automatically
@@ -14,54 +13,16 @@ import { useCallback, useMemo } from "react"
1413
* @constructor
1514
*/
1615
export function ReactSearchComponentContextProvider(props: PropsWithChildren & { config: SearchConfig }) {
17-
const connector = useMemo(() => {
18-
try {
19-
return new SearchConfigBuilder(props.config).buildConnector()
20-
} catch (e) {
21-
console.error("Failed to build connector in ReactSearchComponentContextProvider", e)
22-
return undefined
23-
}
24-
}, [props.config])
25-
2616
const searchForBackground = useCallback(
2717
async (query: string) => {
28-
if (!connector) return
18+
console.log("Background query")
19+
const res = await backgroundSearchQuery(props.config, query)
2920

30-
// Hacky but works
31-
return connector.onSearch(
32-
{ searchTerm: query, resultsPerPage: 20 },
33-
{
34-
result_fields: arrayToObjectEntries(props.config.indices[0].resultFields),
35-
searchTerm: query,
36-
search_fields: arrayToObjectEntries(props.config.indices[0].searchFields),
37-
resultsPerPage: 20
38-
}
39-
)
21+
return res.hits.hits
4022
},
41-
[connector, props.config.indices]
23+
[props.config]
4224
)
4325

44-
// Fallback for testing without elastic context
45-
if (!connector) {
46-
console.warn(
47-
"Using fallback context for ReactSearchComponentContextProvider as elastic config is invalid. Elastic-related features will not work."
48-
)
49-
return (
50-
<ReactSearchComponentContext.Provider
51-
value={{
52-
searchTerm: "",
53-
searchFor: () => {},
54-
searchForBackground: async () => {
55-
return undefined
56-
},
57-
config: props.config
58-
}}
59-
>
60-
{props.children}
61-
</ReactSearchComponentContext.Provider>
62-
)
63-
}
64-
6526
return (
6627
<WithSearch
6728
mapContextToProps={({ searchTerm, setSearchTerm, clearFilters, setSort }: SearchContextState) => ({
@@ -71,22 +32,21 @@ export function ReactSearchComponentContextProvider(props: PropsWithChildren & {
7132
setSort
7233
})}
7334
>
74-
{({ searchTerm, setSearchTerm, clearFilters, setSort }: SearchContextState) => {
35+
{({ searchTerm, setSearchTerm, clearFilters, setSort }) => {
7536
return (
7637
<ReactSearchComponentContext.Provider
7738
value={{
7839
searchTerm: searchTerm ?? "",
7940
searchFor: (query: string) => {
80-
clearFilters()
81-
setSearchTerm(query)
82-
setSort([{ field: "_score", direction: "desc" }], "desc")
41+
if (clearFilters) clearFilters()
42+
if (setSearchTerm) setSearchTerm(query)
43+
if (setSort) setSort([{ field: "_score", direction: "desc" }], "desc")
8344
window.scrollTo({
8445
top: 0,
8546
left: 0,
8647
behavior: "smooth"
8748
})
8849
},
89-
elasticConnector: connector,
9050
searchForBackground,
9151
config: props.config
9252
}}

src/components/graph/RelationsGraphModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export function RelationsGraphModal({
4949
searchFor: localSearchFor,
5050
searchTerm: searchContext.searchTerm,
5151
searchForBackground: searchContext.searchForBackground,
52-
elasticConnector: searchContext.elasticConnector,
5352
config: searchContext.config
5453
}}
5554
>

0 commit comments

Comments
 (0)