diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b3920a60..74684c39 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -19,5 +19,6 @@ "packages/ui-styles": "1.9.8", "packages/ui-system": "1.4.11", "packages/ui-table": "1.0.1", + "packages/ui-textinput": "0.0.0", "packages/ui-toggle": "1.0.0" } diff --git a/packages/ui-form/package.json b/packages/ui-form/package.json index d6598579..ed430d69 100644 --- a/packages/ui-form/package.json +++ b/packages/ui-form/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", @@ -48,11 +46,10 @@ }, "dependencies": { "@versini/ui-hooks": "workspace:../ui-hooks", + "@versini/ui-textinput": "workspace:../ui-textinput", "@versini/ui-toggle": "workspace:../ui-toggle", "@versini/ui-private": "workspace:../ui-private", "clsx": "2.1.1" }, - "sideEffects": [ - "**/*.css" - ] + "sideEffects": ["**/*.css"] } diff --git a/packages/ui-form/src/common/constants.ts b/packages/ui-form/src/common/constants.ts index 69b01546..b15e0029 100644 --- a/packages/ui-form/src/common/constants.ts +++ b/packages/ui-form/src/common/constants.ts @@ -1,8 +1,3 @@ -export const TEXT_INPUT_CLASSNAME = "av-text-input"; -export const TEXT_INPUT_SIMPLE_CLASSNAME = "av-text-input-simple"; -export const TEXT_INPUT_WRAPPER_CLASSNAME = "av-text-input-wrapper"; -export const TEXT_INPUT_HELPER_TEXT_CLASSNAME = "av-text-input-helper-text"; - export const TEXT_AREA_CLASSNAME = "av-text-area"; export const TEXT_AREA_WRAPPER_CLASSNAME = "av-text-area-wrapper"; export const TEXT_AREA_HELPER_TEXT_CLASSNAME = "av-text-area-helper-text"; diff --git a/packages/ui-form/src/components/index.ts b/packages/ui-form/src/components/index.ts index 0d93c57b..1b2aa881 100644 --- a/packages/ui-form/src/components/index.ts +++ b/packages/ui-form/src/components/index.ts @@ -1,7 +1,6 @@ +import { TextInput, TextInputMask } from "@versini/ui-textinput"; import { Toggle } from "@versini/ui-toggle"; import { TextArea } from "./TextArea/TextArea"; -import { TextInput } from "./TextInput/TextInput"; -import { TextInputMask } from "./TextInput/TextInputMask"; export { TextArea, TextInput, TextInputMask, Toggle }; diff --git a/packages/ui-textinput/README.md b/packages/ui-textinput/README.md new file mode 100644 index 00000000..8d2c7ae5 --- /dev/null +++ b/packages/ui-textinput/README.md @@ -0,0 +1,3 @@ +# @versini/ui-textinput + +A simple text input component for React. diff --git a/packages/ui-textinput/package.json b/packages/ui-textinput/package.json new file mode 100644 index 00000000..0ae76c89 --- /dev/null +++ b/packages/ui-textinput/package.json @@ -0,0 +1,51 @@ +{ + "name": "@versini/ui-textinput", + "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-button": "workspace:../ui-button", + "@versini/ui-icons": "workspace:../ui-icons", + "@versini/ui-styles": "workspace:../ui-styles" + }, + "dependencies": { + "@tailwindcss/typography": "0.5.15", + "@versini/ui-hooks": "workspace:../ui-hooks", + "@versini/ui-private": "workspace:../ui-private", + "clsx": "2.1.1", + "tailwindcss": "3.4.12" + }, + "sideEffects": ["**/*.css"] +} diff --git a/packages/ui-textinput/postcss.config.cjs b/packages/ui-textinput/postcss.config.cjs new file mode 100644 index 00000000..e873f1a4 --- /dev/null +++ b/packages/ui-textinput/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/packages/ui-textinput/src/common/constants.ts b/packages/ui-textinput/src/common/constants.ts new file mode 100644 index 00000000..7b830252 --- /dev/null +++ b/packages/ui-textinput/src/common/constants.ts @@ -0,0 +1,4 @@ +export const TEXT_INPUT_CLASSNAME = "av-text-input"; +export const TEXT_INPUT_SIMPLE_CLASSNAME = "av-text-input-simple"; +export const TEXT_INPUT_WRAPPER_CLASSNAME = "av-text-input-wrapper"; +export const TEXT_INPUT_HELPER_TEXT_CLASSNAME = "av-text-input-helper-text"; diff --git a/packages/ui-form/src/components/TextInput/TextInput.tsx b/packages/ui-textinput/src/components/TextInput/TextInput.tsx similarity index 100% rename from packages/ui-form/src/components/TextInput/TextInput.tsx rename to packages/ui-textinput/src/components/TextInput/TextInput.tsx diff --git a/packages/ui-form/src/components/TextInput/TextInputMask.tsx b/packages/ui-textinput/src/components/TextInput/TextInputMask.tsx similarity index 100% rename from packages/ui-form/src/components/TextInput/TextInputMask.tsx rename to packages/ui-textinput/src/components/TextInput/TextInputMask.tsx diff --git a/packages/ui-form/src/components/TextInput/TextInputTypes.d.ts b/packages/ui-textinput/src/components/TextInput/TextInputTypes.d.ts similarity index 100% rename from packages/ui-form/src/components/TextInput/TextInputTypes.d.ts rename to packages/ui-textinput/src/components/TextInput/TextInputTypes.d.ts diff --git a/packages/ui-form/src/components/TextInput/__tests__/TextInput.test.tsx b/packages/ui-textinput/src/components/TextInput/__tests__/TextInput.test.tsx similarity index 98% rename from packages/ui-form/src/components/TextInput/__tests__/TextInput.test.tsx rename to packages/ui-textinput/src/components/TextInput/__tests__/TextInput.test.tsx index d97ab226..5aaa8369 100644 --- a/packages/ui-form/src/components/TextInput/__tests__/TextInput.test.tsx +++ b/packages/ui-textinput/src/components/TextInput/__tests__/TextInput.test.tsx @@ -1,9 +1,8 @@ import { act, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import { TextInput } from "../.."; +import { TEXT_INPUT_CLASSNAME, TextInput } from "../.."; import { expectToHaveClasses } from "../../../../../../configuration/tests-helpers"; -import { TEXT_INPUT_CLASSNAME } from "../../../common/constants"; describe("TextInput (exceptions)", () => { it("should be able to require/import from root", () => { diff --git a/packages/ui-form/src/components/TextInput/__tests__/TextInputMask.test.tsx b/packages/ui-textinput/src/components/TextInput/__tests__/TextInputMask.test.tsx similarity index 100% rename from packages/ui-form/src/components/TextInput/__tests__/TextInputMask.test.tsx rename to packages/ui-textinput/src/components/TextInput/__tests__/TextInputMask.test.tsx diff --git a/packages/ui-form/src/components/TextInput/utilities.ts b/packages/ui-textinput/src/components/TextInput/utilities.ts similarity index 100% rename from packages/ui-form/src/components/TextInput/utilities.ts rename to packages/ui-textinput/src/components/TextInput/utilities.ts diff --git a/packages/ui-textinput/src/components/index.ts b/packages/ui-textinput/src/components/index.ts new file mode 100644 index 00000000..a070cc60 --- /dev/null +++ b/packages/ui-textinput/src/components/index.ts @@ -0,0 +1,3 @@ +export * from "../common/constants"; +export * from "./TextInput/TextInput"; +export * from "./TextInput/TextInputMask"; diff --git a/packages/ui-textinput/src/index.css b/packages/ui-textinput/src/index.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/packages/ui-textinput/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/ui-textinput/src/style.ts b/packages/ui-textinput/src/style.ts new file mode 100644 index 00000000..3a29aed1 --- /dev/null +++ b/packages/ui-textinput/src/style.ts @@ -0,0 +1 @@ +import "./index.css"; diff --git a/packages/ui-textinput/src/vite-env.d.ts b/packages/ui-textinput/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/packages/ui-textinput/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/ui-textinput/tailwind.config.js b/packages/ui-textinput/tailwind.config.js new file mode 100644 index 00000000..42ba260d --- /dev/null +++ b/packages/ui-textinput/tailwind.config.js @@ -0,0 +1,2 @@ +import { commonTailwindConfigForComponent } from "../../configuration/tailwind.common"; +export default commonTailwindConfigForComponent(); diff --git a/packages/ui-textinput/tsconfig.json b/packages/ui-textinput/tsconfig.json new file mode 100644 index 00000000..652d144c --- /dev/null +++ b/packages/ui-textinput/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../configuration/tsconfig.common.json", + "include": ["src"] +} diff --git a/packages/ui-textinput/tsup.config.ts b/packages/ui-textinput/tsup.config.ts new file mode 100644 index 00000000..7490cbb5 --- /dev/null +++ b/packages/ui-textinput/tsup.config.ts @@ -0,0 +1,2 @@ +import { commonTsupConfig } from "../../configuration/tsup.common"; +export default commonTsupConfig; diff --git a/packages/ui-textinput/vite.config.ts b/packages/ui-textinput/vite.config.ts new file mode 100644 index 00000000..f23a2b78 --- /dev/null +++ b/packages/ui-textinput/vite.config.ts @@ -0,0 +1,2 @@ +import { commonViteConfigForComponent } from "../../configuration/vite.common"; +export default commonViteConfigForComponent(); diff --git a/packages/ui-textinput/vitest.config.js b/packages/ui-textinput/vitest.config.js new file mode 100644 index 00000000..028e7ef7 --- /dev/null +++ b/packages/ui-textinput/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 adf8eb63..c3f34093 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -379,6 +379,9 @@ importers: '@versini/ui-private': specifier: workspace:../ui-private version: link:../ui-private + '@versini/ui-textinput': + specifier: workspace:../ui-textinput + version: link:../ui-textinput '@versini/ui-toggle': specifier: workspace:../ui-toggle version: link:../ui-toggle @@ -669,6 +672,40 @@ importers: specifier: workspace:../ui-styles version: link:../ui-styles + packages/ui-textinput: + dependencies: + '@tailwindcss/typography': + specifier: 0.5.15 + version: 0.5.15(tailwindcss@3.4.12) + '@versini/ui-hooks': + specifier: workspace:../ui-hooks + version: link:../ui-hooks + '@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.12 + version: 3.4.12 + devDependencies: + '@versini/ui-button': + specifier: workspace:../ui-button + version: link:../ui-button + '@versini/ui-icons': + specifier: workspace:../ui-icons + version: link:../ui-icons + '@versini/ui-styles': + specifier: workspace:../ui-styles + version: link:../ui-styles + packages/ui-toggle: dependencies: '@tailwindcss/typography': diff --git a/release-please-config.json b/release-please-config.json index b4a91b5e..54b1c57f 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -20,6 +20,7 @@ "packages/ui-styles": {}, "packages/ui-system": {}, "packages/ui-table": {}, + "packages/ui-textinput": {}, "packages/ui-toggle": {} }, "plugins": ["node-workspace"],