From d2ad0f568557c3fb409caa048c1f7a9a105763b9 Mon Sep 17 00:00:00 2001 From: Arno V Date: Tue, 17 Sep 2024 19:12:19 -0400 Subject: [PATCH] feat(Table): extracting Table as a standalone package (#668) --- .release-please-manifest.json | 3 +- packages/ui-components/package.json | 11 ++-- .../ui-components/src/components/index.ts | 4 +- packages/ui-table/README.md | 3 ++ packages/ui-table/package.json | 51 +++++++++++++++++++ packages/ui-table/postcss.config.cjs | 6 +++ .../src/components/Table/Table.tsx | 0 .../src/components/Table/TableContext.ts | 0 .../src/components/Table/TableTypes.d.ts | 0 .../components/Table/__tests__/Table.test.tsx | 0 .../src/components/Table/utilities.ts | 0 packages/ui-table/src/components/index.ts | 2 + packages/ui-table/src/index.css | 3 ++ packages/ui-table/src/style.ts | 1 + packages/ui-table/src/vite-env.d.ts | 1 + packages/ui-table/tailwind.config.js | 2 + packages/ui-table/tsconfig.json | 4 ++ packages/ui-table/tsup.config.ts | 2 + packages/ui-table/vite.config.ts | 2 + packages/ui-table/vitest.config.js | 4 ++ pnpm-lock.yaml | 37 ++++++++++++++ release-please-config.json | 3 +- 22 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 packages/ui-table/README.md create mode 100644 packages/ui-table/package.json create mode 100644 packages/ui-table/postcss.config.cjs rename packages/{ui-components => ui-table}/src/components/Table/Table.tsx (100%) rename packages/{ui-components => ui-table}/src/components/Table/TableContext.ts (100%) rename packages/{ui-components => ui-table}/src/components/Table/TableTypes.d.ts (100%) rename packages/{ui-components => ui-table}/src/components/Table/__tests__/Table.test.tsx (100%) rename packages/{ui-components => ui-table}/src/components/Table/utilities.ts (100%) create mode 100644 packages/ui-table/src/components/index.ts create mode 100644 packages/ui-table/src/index.css create mode 100644 packages/ui-table/src/style.ts create mode 100644 packages/ui-table/src/vite-env.d.ts create mode 100644 packages/ui-table/tailwind.config.js create mode 100644 packages/ui-table/tsconfig.json create mode 100644 packages/ui-table/tsup.config.ts create mode 100644 packages/ui-table/vite.config.ts create mode 100644 packages/ui-table/vitest.config.js diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 66d51aa6..690fbaeb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -17,5 +17,6 @@ "packages/ui-menu": "1.0.0", "packages/ui-panel": "1.0.0", "packages/ui-pill": "1.0.0", - "packages/ui-spinner": "1.0.0" + "packages/ui-spinner": "1.0.0", + "packages/ui-table": "0.0.0" } diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index 23c99167..24b8d063 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -14,9 +14,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "scripts": { "build:check": "tsc", "build:js": "vite build", @@ -32,8 +30,6 @@ "stats:release": "bundlesize -c bundlesize.config.js -p \"$npm_package_version\" -o stats/stats.json --silent", "stats:report": "bundlesize -c bundlesize.config.js --type report -o tmp/pr-stats.md --silent", "stats": "bundlesize -c bundlesize.config.js -p \"$npm_package_version\"", - "test:coverage:ui": "vitest --coverage --ui", - "test:coverage": "vitest run --coverage", "test:watch": "vitest", "test": "vitest run" }, @@ -61,10 +57,9 @@ "@versini/ui-pill": "workspace:../ui-pill", "@versini/ui-private": "workspace:../ui-private", "@versini/ui-spinner": "workspace:../ui-spinner", + "@versini/ui-table": "workspace:../ui-table", "clsx": "2.1.1", "tailwindcss": "3.4.11" }, - "sideEffects": [ - "**/*.css" - ] + "sideEffects": ["**/*.css"] } diff --git a/packages/ui-components/src/components/index.ts b/packages/ui-components/src/components/index.ts index bec65dd5..bcc1d4ef 100644 --- a/packages/ui-components/src/components/index.ts +++ b/packages/ui-components/src/components/index.ts @@ -15,11 +15,11 @@ import { TableBody, TableCell, TableCellSort, + TableCellSortDirections, TableFooter, TableHead, TableRow, -} from "./Table/Table"; -import { TableCellSortDirections } from "./Table/utilities"; +} from "@versini/ui-table"; export { Anchor, diff --git a/packages/ui-table/README.md b/packages/ui-table/README.md new file mode 100644 index 00000000..962e543c --- /dev/null +++ b/packages/ui-table/README.md @@ -0,0 +1,3 @@ +# @versini/ui-table + +A simple table component for React. diff --git a/packages/ui-table/package.json b/packages/ui-table/package.json new file mode 100644 index 00000000..e12f50d1 --- /dev/null +++ b/packages/ui-table/package.json @@ -0,0 +1,51 @@ +{ + "name": "@versini/ui-table", + "version": "0.0.0", + "license": "MIT", + "author": "Arno Versini", + "publishConfig": { + "access": "public" + }, + "homepage": "https://github.com/aversini/ui-components", + "repository": { + "type": "git", + "url": "git@github.com:aversini/ui-components.git" + }, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": ["dist"], + "scripts": { + "build:check": "tsc", + "build:js": "vite build", + "build:types": "tsup", + "build": "npm-run-all --serial clean build:check build:js build:types", + "clean": "rimraf dist tmp", + "dev:js": "vite build --watch --mode development", + "dev:types": "tsup --watch src", + "dev": "npm-run-all clean --parallel dev:js dev:types", + "lint": "biome lint src", + "start": "static-server dist --port 5173", + "test:coverage:ui": "vitest --coverage --ui", + "test:coverage": "vitest run --coverage", + "test:watch": "vitest", + "test": "vitest run" + }, + "peerDependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@versini/ui-styles": "workspace:../ui-styles" + }, + "dependencies": { + "@floating-ui/react": "0.26.24", + "@tailwindcss/typography": "0.5.15", + "@versini/ui-button": "workspace:../ui-button", + "@versini/ui-icons": "workspace:../ui-icons", + "@versini/ui-private": "workspace:../ui-private", + "clsx": "2.1.1", + "tailwindcss": "3.4.11" + }, + "sideEffects": ["**/*.css"] +} diff --git a/packages/ui-table/postcss.config.cjs b/packages/ui-table/postcss.config.cjs new file mode 100644 index 00000000..e873f1a4 --- /dev/null +++ b/packages/ui-table/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/packages/ui-components/src/components/Table/Table.tsx b/packages/ui-table/src/components/Table/Table.tsx similarity index 100% rename from packages/ui-components/src/components/Table/Table.tsx rename to packages/ui-table/src/components/Table/Table.tsx diff --git a/packages/ui-components/src/components/Table/TableContext.ts b/packages/ui-table/src/components/Table/TableContext.ts similarity index 100% rename from packages/ui-components/src/components/Table/TableContext.ts rename to packages/ui-table/src/components/Table/TableContext.ts diff --git a/packages/ui-components/src/components/Table/TableTypes.d.ts b/packages/ui-table/src/components/Table/TableTypes.d.ts similarity index 100% rename from packages/ui-components/src/components/Table/TableTypes.d.ts rename to packages/ui-table/src/components/Table/TableTypes.d.ts diff --git a/packages/ui-components/src/components/Table/__tests__/Table.test.tsx b/packages/ui-table/src/components/Table/__tests__/Table.test.tsx similarity index 100% rename from packages/ui-components/src/components/Table/__tests__/Table.test.tsx rename to packages/ui-table/src/components/Table/__tests__/Table.test.tsx diff --git a/packages/ui-components/src/components/Table/utilities.ts b/packages/ui-table/src/components/Table/utilities.ts similarity index 100% rename from packages/ui-components/src/components/Table/utilities.ts rename to packages/ui-table/src/components/Table/utilities.ts diff --git a/packages/ui-table/src/components/index.ts b/packages/ui-table/src/components/index.ts new file mode 100644 index 00000000..f93fbc71 --- /dev/null +++ b/packages/ui-table/src/components/index.ts @@ -0,0 +1,2 @@ +export { TableCellSortDirections } from "./Table/utilities"; +export * from "./Table/Table"; diff --git a/packages/ui-table/src/index.css b/packages/ui-table/src/index.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/packages/ui-table/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/ui-table/src/style.ts b/packages/ui-table/src/style.ts new file mode 100644 index 00000000..3a29aed1 --- /dev/null +++ b/packages/ui-table/src/style.ts @@ -0,0 +1 @@ +import "./index.css"; diff --git a/packages/ui-table/src/vite-env.d.ts b/packages/ui-table/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/packages/ui-table/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/ui-table/tailwind.config.js b/packages/ui-table/tailwind.config.js new file mode 100644 index 00000000..42ba260d --- /dev/null +++ b/packages/ui-table/tailwind.config.js @@ -0,0 +1,2 @@ +import { commonTailwindConfigForComponent } from "../../configuration/tailwind.common"; +export default commonTailwindConfigForComponent(); diff --git a/packages/ui-table/tsconfig.json b/packages/ui-table/tsconfig.json new file mode 100644 index 00000000..652d144c --- /dev/null +++ b/packages/ui-table/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../configuration/tsconfig.common.json", + "include": ["src"] +} diff --git a/packages/ui-table/tsup.config.ts b/packages/ui-table/tsup.config.ts new file mode 100644 index 00000000..7490cbb5 --- /dev/null +++ b/packages/ui-table/tsup.config.ts @@ -0,0 +1,2 @@ +import { commonTsupConfig } from "../../configuration/tsup.common"; +export default commonTsupConfig; diff --git a/packages/ui-table/vite.config.ts b/packages/ui-table/vite.config.ts new file mode 100644 index 00000000..f23a2b78 --- /dev/null +++ b/packages/ui-table/vite.config.ts @@ -0,0 +1,2 @@ +import { commonViteConfigForComponent } from "../../configuration/vite.common"; +export default commonViteConfigForComponent(); diff --git a/packages/ui-table/vitest.config.js b/packages/ui-table/vitest.config.js new file mode 100644 index 00000000..028e7ef7 --- /dev/null +++ b/packages/ui-table/vitest.config.js @@ -0,0 +1,4 @@ +import { commonVitestConfig } from "../../configuration/vitestconfig.common"; +import viteConfig from "./vite.config"; + +export default commonVitestConfig(viteConfig); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b58c1aa4..ca0010ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -345,6 +345,9 @@ importers: '@versini/ui-spinner': specifier: workspace:../ui-spinner version: link:../ui-spinner + '@versini/ui-table': + specifier: workspace:../ui-table + version: link:../ui-table clsx: specifier: 2.1.1 version: 2.1.1 @@ -653,6 +656,40 @@ importers: specifier: 18.3.1 version: 18.3.1(react@18.3.1) + packages/ui-table: + dependencies: + '@floating-ui/react': + specifier: 0.26.24 + version: 0.26.24(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tailwindcss/typography': + specifier: 0.5.15 + version: 0.5.15(tailwindcss@3.4.11) + '@versini/ui-button': + specifier: workspace:../ui-button + version: link:../ui-button + '@versini/ui-icons': + specifier: workspace:../ui-icons + version: link:../ui-icons + '@versini/ui-private': + specifier: workspace:../ui-private + version: link:../ui-private + clsx: + specifier: 2.1.1 + version: 2.1.1 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) + tailwindcss: + specifier: 3.4.11 + version: 3.4.11 + devDependencies: + '@versini/ui-styles': + specifier: workspace:../ui-styles + version: link:../ui-styles + packages: '@adobe/css-tools@4.4.0': diff --git a/release-please-config.json b/release-please-config.json index 973930f9..9239fc01 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -18,7 +18,8 @@ "packages/ui-menu": {}, "packages/ui-panel": {}, "packages/ui-pill": {}, - "packages/ui-spinner": {} + "packages/ui-spinner": {}, + "packages/ui-table": {} }, "plugins": ["node-workspace"], "pull-request-header": ":rocket: Automated Release"