diff --git a/frontend/apps/editor3d/app/src/components/reusable/SearchFilter/index.tsx b/frontend/apps/editor3d/app/src/components/reusable/SearchFilter/index.tsx deleted file mode 100644 index 73642fa5e6..0000000000 --- a/frontend/apps/editor3d/app/src/components/reusable/SearchFilter/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from "./SearchFilter"; diff --git a/frontend/apps/editor3d/app/src/components/reusable/index.ts b/frontend/apps/editor3d/app/src/components/reusable/index.ts index f67c770d44..d5f5a2949b 100644 --- a/frontend/apps/editor3d/app/src/components/reusable/index.ts +++ b/frontend/apps/editor3d/app/src/components/reusable/index.ts @@ -1,4 +1,3 @@ -export * from "./SearchFilter"; export * from "./UploadModal"; export * from "./UploadModal3D"; export * from "./UploadModalMedia"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabAnimations.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabAnimations.tsx index be9c0f1b80..7eb8ddec4f 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabAnimations.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabAnimations.tsx @@ -8,9 +8,9 @@ import { MediaFileAnimationType, } from "~/enums"; import { - SearchFilter, UploadModal, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Pagination } from "@storyteller/ui-pagination"; import { Button, FilterButtons } from "@storyteller/ui-button"; import { ItemElements } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabCharacters.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabCharacters.tsx index e9f10f8626..2cea1e6444 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabCharacters.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabCharacters.tsx @@ -10,9 +10,9 @@ import { } from "~/enums"; import { MediaItem } from "~/pages/PageEnigma/models"; import { - SearchFilter, UploadModal, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Pagination } from "@storyteller/ui-pagination"; import { Button, FilterButtons } from "@storyteller/ui-button"; import { ItemElements } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabExpressions.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabExpressions.tsx index 25674ea0d1..b9fb84346e 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabExpressions.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CharactersComboTabs/subtabExpressions.tsx @@ -6,9 +6,9 @@ import { MediaFileAnimationType, } from "~/enums"; import { - SearchFilter, UploadModal, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Pagination } from "@storyteller/ui-pagination"; import { Button, FilterButtons } from "@storyteller/ui-button"; import { ItemElements } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CreaturesTab.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CreaturesTab.tsx index 6e4c0f6dfa..9315a123fe 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CreaturesTab.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/CreaturesTab.tsx @@ -13,9 +13,9 @@ import { ItemElements, } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; import { - SearchFilter, UploadModal3D, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Pagination } from "@storyteller/ui-pagination"; import { Button, FilterButtons } from "@storyteller/ui-button" diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/ObjectsTab.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/ObjectsTab.tsx index 8ed0f572e9..440bf07fb8 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/ObjectsTab.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/ObjectsTab.tsx @@ -14,9 +14,9 @@ import { ItemElements, } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; import { - SearchFilter, UploadModal3D, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Pagination } from "@storyteller/ui-pagination"; import { Button, FilterButtons } from "@storyteller/ui-button" import { isAnyStatusFetching } from "../utilities"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabImagePlanes.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabImagePlanes.tsx index 18a9e2e40f..9b411c6a24 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabImagePlanes.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabImagePlanes.tsx @@ -6,9 +6,9 @@ import { IMAGEPLANE_FILE_TYPE, } from "~/enums"; import { - SearchFilter, UploadModalMedia, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Button } from "@storyteller/ui-button"; import { Pagination } from "@storyteller/ui-pagination"; import { ItemElements } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabVideoPlanes.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabVideoPlanes.tsx index 60403fcc2a..06ed532c24 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabVideoPlanes.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/PlanesTab/subTabVideoPlanes.tsx @@ -6,9 +6,9 @@ import { VIDEOPLANE_FILE_TYPE, } from "~/enums"; import { - SearchFilter, UploadModalMedia, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Button } from "@storyteller/ui-button"; import { Pagination } from "@storyteller/ui-pagination"; import { ItemElements } from "~/pages/PageEnigma/comps/SidePanelTabs/sharedComps"; diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/SetsTab.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/SetsTab.tsx index c2d0fa7365..99f8135f8c 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/SetsTab.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/comps/SidePanelTabs/tabComps/SetsTab.tsx @@ -12,9 +12,9 @@ import { } from "~/enums"; import { - SearchFilter, UploadModal3D, } from "~/components"; +import { SearchFilter } from "@storyteller/ui-search"; import { Button, FilterButtons } from "@storyteller/ui-button" import { diff --git a/frontend/apps/editor3d/tsconfig.json b/frontend/apps/editor3d/tsconfig.json index 7c29500f6e..974da3c401 100644 --- a/frontend/apps/editor3d/tsconfig.json +++ b/frontend/apps/editor3d/tsconfig.json @@ -28,12 +28,21 @@ "noEmit": true }, "references": [ + { + "path": "../../libs/components/pagination" + }, + { + "path": "../../libs/components/search" + }, { "path": "../../libs/components/badge" }, { "path": "../../libs/components/lightbox-modal" }, + { + "path": "../../libs/components/button-icon" + }, { "path": "../../libs/components/loading-spinner" }, @@ -118,12 +127,6 @@ { "path": "../../libs/components/input" }, - { - "path": "../../libs/components/button-icon" - }, - { - "path": "../../libs/components/pagination" - }, { "path": "../../libs/tauri-utils" } diff --git a/frontend/libs/components/search/.babelrc b/frontend/libs/components/search/.babelrc new file mode 100644 index 0000000000..1ea870ead4 --- /dev/null +++ b/frontend/libs/components/search/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nx/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/frontend/libs/components/search/README.md b/frontend/libs/components/search/README.md new file mode 100644 index 0000000000..c357670f5f --- /dev/null +++ b/frontend/libs/components/search/README.md @@ -0,0 +1,7 @@ +# @storyteller/ui-search + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test @storyteller/ui-search` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/frontend/libs/components/search/package.json b/frontend/libs/components/search/package.json new file mode 100644 index 0000000000..23828ee123 --- /dev/null +++ b/frontend/libs/components/search/package.json @@ -0,0 +1,17 @@ +{ + "name": "@storyteller/ui-search", + "version": "0.0.1", + "type": "module", + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "development": "./src/index.ts", + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + } +} diff --git a/frontend/libs/components/search/src/index.ts b/frontend/libs/components/search/src/index.ts new file mode 100644 index 0000000000..ca0b195e31 --- /dev/null +++ b/frontend/libs/components/search/src/index.ts @@ -0,0 +1 @@ +export * from './lib/SearchFilter'; diff --git a/frontend/apps/editor3d/app/src/components/reusable/SearchFilter/SearchFilter.tsx b/frontend/libs/components/search/src/lib/SearchFilter.tsx similarity index 99% rename from frontend/apps/editor3d/app/src/components/reusable/SearchFilter/SearchFilter.tsx rename to frontend/libs/components/search/src/lib/SearchFilter.tsx index e202511176..1bb5d9b743 100644 --- a/frontend/apps/editor3d/app/src/components/reusable/SearchFilter/SearchFilter.tsx +++ b/frontend/libs/components/search/src/lib/SearchFilter.tsx @@ -1,4 +1,3 @@ -// TODO: DELETE import { faCircleXmark, faFilterList, diff --git a/frontend/libs/components/search/tsconfig.json b/frontend/libs/components/search/tsconfig.json new file mode 100644 index 0000000000..dad1342a53 --- /dev/null +++ b/frontend/libs/components/search/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [], + "include": [], + "references": [ + { + "path": "../tooltip" + }, + { + "path": "../button" + }, + { + "path": "../input" + }, + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../../tsconfig.base.json" +} diff --git a/frontend/libs/components/search/tsconfig.lib.json b/frontend/libs/components/search/tsconfig.lib.json new file mode 100644 index 0000000000..e85dddf642 --- /dev/null +++ b/frontend/libs/components/search/tsconfig.lib.json @@ -0,0 +1,56 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "vite/client" + ], + "rootDir": "src", + "jsx": "react-jsx", + "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo" + }, + "exclude": [ + "out-tsc", + "dist", + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx", + "vite.config.ts", + "vite.config.mts", + "vitest.config.ts", + "vitest.config.mts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx" + ], + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ], + "references": [ + { + "path": "../tooltip/tsconfig.lib.json" + }, + { + "path": "../button/tsconfig.lib.json" + }, + { + "path": "../input/tsconfig.lib.json" + } + ] +} diff --git a/frontend/libs/components/search/tsconfig.spec.json b/frontend/libs/components/search/tsconfig.spec.json new file mode 100644 index 0000000000..18b7de51b8 --- /dev/null +++ b/frontend/libs/components/search/tsconfig.spec.json @@ -0,0 +1,34 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./out-tsc/vitest", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ], + "jsx": "react-jsx" + }, + "include": [ + "vite.config.ts", + "vite.config.mts", + "vitest.config.ts", + "vitest.config.mts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/frontend/libs/components/search/vite.config.ts b/frontend/libs/components/search/vite.config.ts new file mode 100644 index 0000000000..780de9122c --- /dev/null +++ b/frontend/libs/components/search/vite.config.ts @@ -0,0 +1,49 @@ +/// +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import dts from 'vite-plugin-dts'; +import * as path from 'path'; + +export default defineConfig(() => ({ + root: __dirname, + cacheDir: '../../../node_modules/.vite/libs/components/search', + plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + outDir: './dist', + emptyOutDir: true, + reportCompressedSize: true, + commonjsOptions: { + transformMixedEsModules: true, + }, + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: '@storyteller/ui-search', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es' as const] + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react','react-dom','react/jsx-runtime'] + }, + }, + test: { + watch: false, + globals: true, + environment: 'jsdom', + include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + reporters: ['default'], + coverage: { + reportsDirectory: './test-output/vitest/coverage', + provider: 'v8' as const, + } + }, +})); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 44ea81f51e..29f890dc82 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1393,6 +1393,10 @@ "name": "@storyteller/ui-promptbox", "version": "0.0.1" }, + "libs/components/search": { + "name": "@storyteller/ui-search", + "version": "0.0.1" + }, "libs/components/select": { "name": "@storyteller/ui-select", "version": "0.0.1" @@ -9259,6 +9263,10 @@ "resolved": "libs/components/promptbox", "link": true }, + "node_modules/@storyteller/ui-search": { + "resolved": "libs/components/search", + "link": true + }, "node_modules/@storyteller/ui-select": { "resolved": "libs/components/select", "link": true diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index f79b1e2582..e6afaff036 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -122,6 +122,9 @@ }, { "path": "./libs/components/pagination" + }, + { + "path": "./libs/components/search" } ] }