diff --git a/bun.lockb b/bun.lockb
index 6c10088..8a534ae 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index 7ee1ff8..35e9aed 100644
--- a/package.json
+++ b/package.json
@@ -12,14 +12,17 @@
"dependencies": {
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
+ "@tailwindcss/forms": "^0.5.6",
"@tanstack/react-query": "^4.35.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
- "react-select": "^5.7.5"
+ "react-select": "^5.7.5",
+ "react-window": "^1.8.9"
},
"devDependencies": {
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
+ "@types/react-window": "^1.8.6",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@vitejs/plugin-react-swc": "^3.0.0",
diff --git a/src/ComboBox2.tsx b/src/ComboBox2.tsx
new file mode 100644
index 0000000..19e8d26
--- /dev/null
+++ b/src/ComboBox2.tsx
@@ -0,0 +1,26 @@
+import {useQuery} from "@tanstack/react-query";
+import Select, {createFilter} from "react-select";
+
+export default function Example() {
+ const {data: options, isLoading} = useQuery({
+ queryKey: ['obsidian-metadata'],
+ initialData: [],
+ queryFn: async () => {
+ const response = await fetch("http://100.115.154.44:9002/metadata")
+ const fullData: any[] = await response.json();
+
+ return fullData.map(md => ({
+ value: md.relativePath as string,
+ label: md.fileName as string
+ }));
+ },
+ });
+
+ return ;
+}
diff --git a/src/TA.tsx b/src/TA.tsx
new file mode 100644
index 0000000..973e7a1
--- /dev/null
+++ b/src/TA.tsx
@@ -0,0 +1,103 @@
+import {ReactNode} from "react";
+import AsyncSelect from "react-select/async";
+import {FixedSizeList as List} from "react-window";
+import Select, {createFilter, MenuListProps} from "react-select";
+
+import {useQuery} from "@tanstack/react-query";
+
+const height = 35;
+
+function MenuList(props: MenuListProps) {
+ const {
+ options,
+ children,
+ maxHeight,
+ getValue
+ } = props as Omit & {
+ children: ReactNode[]
+ };
+
+ const [value] = getValue();
+ const initialOffset = options.indexOf(value) * height;
+
+ return (
+ {({
+ index,
+ style
+ }) => {children[index]}
}
+
);
+}
+
+const TestSelect = (vendorOptions: any) => {
+ const options: {
+ value: string,
+ label: string
+ }[] = [];
+ for (let i = 0; i < vendorOptions["vendorOptions"].length; i = i + 1) {
+ options.push({
+ value: vendorOptions["vendorOptions"][i],
+ label: `${vendorOptions["vendorOptions"][i]}`
+ });
+ }
+
+ const loadOptions = (_inputValue: unknown, callback: (options: {
+ value: string,
+ label: string
+ }[]) => void) => {
+ setTimeout(() => {
+ callback(options);
+ }, 1000);
+ };
+
+ const TestSelectComponent = () => {
+ return (
+
+ )
+ }
+
+ return (
+
+ )
+}
+
+export function LargeSelect() {
+ const {
+ data: options,
+ isLoading,
+ } = useQuery({
+ queryKey: ['obsidian-metadata'],
+ initialData: [],
+ queryFn: async () => {
+ const response = await fetch("http://100.115.154.44:9002/metadata")
+ const fullData: any[] = await response.json();
+
+ return fullData.map(md => ({
+ value: md.relativePath as string,
+ label: md.fileName as string
+ }));
+ },
+ });
+
+ return (
+
+
+
+ )
+}
+
+
+export default TestSelect
diff --git a/src/main.tsx b/src/main.tsx
index ff6a505..9b1d62a 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,15 +1,15 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import './index.css'
-import Combobox from "./ComboBox.tsx";
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
+import {LargeSelect} from "./TA.tsx";
const queryClient = new QueryClient()
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
-
+
,
)
diff --git a/tailwind.config.js b/tailwind.config.js
index d37737f..bafb353 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -7,6 +7,8 @@ export default {
theme: {
extend: {},
},
- plugins: [],
+ plugins: [
+ require('@tailwindcss/forms')
+ ],
}
diff --git a/vite.config.ts b/vite.config.ts
index 861b04b..41dd742 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,7 +1,10 @@
-import { defineConfig } from 'vite'
+import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
- plugins: [react()],
+ plugins: [react()],
+ server: {
+ host: '0.0.0.0'
+ }
})