diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index afe5195e..a6cc16b0 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -56,6 +56,7 @@ "@versini/ui-main": "workspace:../ui-main", "@versini/ui-menu": "workspace:../ui-menu", "@versini/ui-panel": "workspace:../ui-panel", + "@versini/ui-pill": "workspace:../ui-pill", "@versini/ui-private": "workspace:../ui-private", "clsx": "2.1.1", "tailwindcss": "3.4.11" diff --git a/packages/ui-components/src/components/index.ts b/packages/ui-components/src/components/index.ts index 66ed9217..ec935e88 100644 --- a/packages/ui-components/src/components/index.ts +++ b/packages/ui-components/src/components/index.ts @@ -7,8 +7,8 @@ import { Header } from "@versini/ui-header"; import { Main } from "@versini/ui-main"; import { Menu, MenuItem, MenuSeparator } from "@versini/ui-menu"; import { Panel } from "@versini/ui-panel"; +import { Pill } from "@versini/ui-pill"; -import { Pill } from "./Pill/Pill"; import { Spinner } from "./Spinner/Spinner"; import { Table, diff --git a/packages/ui-pill/README.md b/packages/ui-pill/README.md new file mode 100644 index 00000000..84f5c8f0 --- /dev/null +++ b/packages/ui-pill/README.md @@ -0,0 +1,3 @@ +# @versini/ui-pill + +A simple pill component for React. diff --git a/packages/ui-pill/package.json b/packages/ui-pill/package.json new file mode 100644 index 00000000..f47fb598 --- /dev/null +++ b/packages/ui-pill/package.json @@ -0,0 +1,48 @@ +{ + "name": "@versini/ui-pill", + "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": { + "@tailwindcss/typography": "0.5.15", + "@versini/ui-private": "workspace:../ui-private", + "clsx": "2.1.1", + "tailwindcss": "3.4.11" + }, + "sideEffects": ["**/*.css"] +} diff --git a/packages/ui-pill/postcss.config.cjs b/packages/ui-pill/postcss.config.cjs new file mode 100644 index 00000000..e873f1a4 --- /dev/null +++ b/packages/ui-pill/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/packages/ui-pill/src/common/constants.ts b/packages/ui-pill/src/common/constants.ts new file mode 100644 index 00000000..fdb6f5ee --- /dev/null +++ b/packages/ui-pill/src/common/constants.ts @@ -0,0 +1 @@ +export const PILL_CLASSNAME = "av-pill"; diff --git a/packages/ui-components/src/components/Pill/Pill.tsx b/packages/ui-pill/src/components/Pill/Pill.tsx similarity index 100% rename from packages/ui-components/src/components/Pill/Pill.tsx rename to packages/ui-pill/src/components/Pill/Pill.tsx diff --git a/packages/ui-components/src/components/Pill/PillTypes.d.ts b/packages/ui-pill/src/components/Pill/PillTypes.d.ts similarity index 100% rename from packages/ui-components/src/components/Pill/PillTypes.d.ts rename to packages/ui-pill/src/components/Pill/PillTypes.d.ts diff --git a/packages/ui-components/src/components/Pill/__tests__/Pill.test.tsx b/packages/ui-pill/src/components/Pill/__tests__/Pill.test.tsx similarity index 95% rename from packages/ui-components/src/components/Pill/__tests__/Pill.test.tsx rename to packages/ui-pill/src/components/Pill/__tests__/Pill.test.tsx index 5859115d..57cc2e0e 100644 --- a/packages/ui-components/src/components/Pill/__tests__/Pill.test.tsx +++ b/packages/ui-pill/src/components/Pill/__tests__/Pill.test.tsx @@ -1,8 +1,6 @@ import { render, screen } from "@testing-library/react"; - -import { Pill } from "../.."; +import { PILL_CLASSNAME, Pill } from "../.."; import { expectToHaveClasses } from "../../../../../../configuration/tests-helpers"; -import { PILL_CLASSNAME } from "../../../common/constants"; describe("Pill (exceptions)", () => { it("should be able to require/import from root", () => { diff --git a/packages/ui-components/src/components/Pill/utilities.ts b/packages/ui-pill/src/components/Pill/utilities.ts similarity index 100% rename from packages/ui-components/src/components/Pill/utilities.ts rename to packages/ui-pill/src/components/Pill/utilities.ts diff --git a/packages/ui-pill/src/components/index.ts b/packages/ui-pill/src/components/index.ts new file mode 100644 index 00000000..5401d60a --- /dev/null +++ b/packages/ui-pill/src/components/index.ts @@ -0,0 +1,2 @@ +export * from "../common/constants"; +export * from "./Pill/Pill"; diff --git a/packages/ui-pill/src/index.css b/packages/ui-pill/src/index.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/packages/ui-pill/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/ui-pill/src/style.ts b/packages/ui-pill/src/style.ts new file mode 100644 index 00000000..3a29aed1 --- /dev/null +++ b/packages/ui-pill/src/style.ts @@ -0,0 +1 @@ +import "./index.css"; diff --git a/packages/ui-pill/src/vite-env.d.ts b/packages/ui-pill/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/packages/ui-pill/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/ui-pill/tailwind.config.js b/packages/ui-pill/tailwind.config.js new file mode 100644 index 00000000..42ba260d --- /dev/null +++ b/packages/ui-pill/tailwind.config.js @@ -0,0 +1,2 @@ +import { commonTailwindConfigForComponent } from "../../configuration/tailwind.common"; +export default commonTailwindConfigForComponent(); diff --git a/packages/ui-pill/tsconfig.json b/packages/ui-pill/tsconfig.json new file mode 100644 index 00000000..652d144c --- /dev/null +++ b/packages/ui-pill/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../configuration/tsconfig.common.json", + "include": ["src"] +} diff --git a/packages/ui-pill/tsup.config.ts b/packages/ui-pill/tsup.config.ts new file mode 100644 index 00000000..7490cbb5 --- /dev/null +++ b/packages/ui-pill/tsup.config.ts @@ -0,0 +1,2 @@ +import { commonTsupConfig } from "../../configuration/tsup.common"; +export default commonTsupConfig; diff --git a/packages/ui-pill/vite.config.ts b/packages/ui-pill/vite.config.ts new file mode 100644 index 00000000..f23a2b78 --- /dev/null +++ b/packages/ui-pill/vite.config.ts @@ -0,0 +1,2 @@ +import { commonViteConfigForComponent } from "../../configuration/vite.common"; +export default commonViteConfigForComponent(); diff --git a/packages/ui-pill/vitest.config.js b/packages/ui-pill/vitest.config.js new file mode 100644 index 00000000..028e7ef7 --- /dev/null +++ b/packages/ui-pill/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 b67967f9..d3c75922 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -336,6 +336,9 @@ importers: '@versini/ui-panel': specifier: workspace:../ui-panel version: link:../ui-panel + '@versini/ui-pill': + specifier: workspace:../ui-pill + version: link:../ui-pill '@versini/ui-private': specifier: workspace:../ui-private version: link:../ui-private @@ -541,6 +544,31 @@ importers: specifier: workspace:../ui-styles version: link:../ui-styles + packages/ui-pill: + dependencies: + '@tailwindcss/typography': + specifier: 0.5.15 + version: 0.5.15(tailwindcss@3.4.11) + '@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/ui-private: dependencies: '@floating-ui/react':