@mysetup/classnames 2.0.0 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,29 +1,52 @@
1
1
  # @mysetup/classnames
2
2
 
3
- `classNames` is a utility function that merges classes conditionally and removes Tailwind CSS style conflicts.
3
+ Merge conditional class names and resolve Tailwind conflicts with one helper.
4
4
 
5
- Based on [clsx](https://github.com/lukeed/clsx) and [tailwind-merge](https://github.com/dcastil/tailwind-merge).
5
+ ## Installation
6
6
 
7
- ## Usage
7
+ ```bash
8
+ pnpm add @mysetup/classnames
9
+ ```
10
+
11
+ ## Supported libraries and runtimes
8
12
 
9
- By passing the `className` prop as the last argument to the `classNames` function, it allows us to override styles in another component.
13
+ | Supported | Notes |
14
+ | --------- | ---------------------- |
15
+ | Vite | Full support |
16
+ | Next.js | Full support |
17
+ | Node.js | Full support |
18
+ | React | Works in any React app |
10
19
 
11
- Typically with Tailwind CSS the only way to override `w-10` with `w-5` is to remove `w-10`. `classNames` takes care of those conflicts automatically.
20
+ ## Usage
12
21
 
13
22
  ```tsx
14
23
  import { classNames } from "@mysetup/classnames";
15
24
 
16
- interface BoxProps {
25
+ export function Button({
26
+ active,
27
+ className,
28
+ }: {
29
+ active?: boolean;
17
30
  className?: string;
31
+ }) {
32
+ return (
33
+ <button
34
+ className={classNames(
35
+ "rounded-md px-4 py-2 text-sm font-medium",
36
+ active
37
+ ? "bg-slate-900 text-white"
38
+ : "bg-slate-100 text-slate-900",
39
+ className,
40
+ )}
41
+ >
42
+ Save
43
+ </button>
44
+ );
18
45
  }
46
+ ```
19
47
 
20
- export const Box = function Box({ className }: BoxProps) {
21
- const classes = classNames("h-10 w-10 bg-black", className);
22
-
23
- return <div className={classes} />; // <div class="h-10 w-10 bg-black" />
24
- };
48
+ ## API
25
49
 
26
- export const SmallBox = function SmallBox() {
27
- return <Box className="h-5 w-5" />; // <div class="h-5 w-5 bg-black" />
28
- };
50
+ ```ts
51
+ classNames(...classes: ClassValue[]): string
29
52
  ```
@@ -1,4 +1,3 @@
1
1
  import type { ClassValue } from "clsx";
2
2
  export type { ClassValue };
3
3
  export declare const classNames: (...classes: ClassValue[]) => string;
4
- //# sourceMappingURL=classnames.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from "./classnames";
2
- //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,48 +1,58 @@
1
1
  {
2
- "name": "@mysetup/classnames",
3
- "version": "2.0.0",
4
- "license": "MIT",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist"
8
- ],
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.js"
14
- },
15
- "./package.json": "./package.json"
2
+ "name": "@mysetup/classnames",
3
+ "version": "2.0.4",
4
+ "description": "Utility for merging clsx and tailwind-merge class names.",
5
+ "author": "krishnaraj <krishnaraj.webdev@gmail.com>",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "classnames",
9
+ "clsx",
10
+ "tailwind-merge",
11
+ "tailwindcss",
12
+ "typescript"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.js"
16
28
  },
17
- "scripts": {
18
- "build": "rm -rf ./dist && tsc -p tsconfig.build.json",
19
- "lint": "eslint .",
20
- "typecheck": "tsc --noEmit",
21
- "test": "jest",
22
- "test:coverage": "jest --coverage",
23
- "format": "prettier --write \"**/*.{ts,tsx,md,js}\"",
24
- "checks": "pnpm typecheck && pnpm lint && pnpm test",
25
- "clean": "rm -rf node_modules .swc dist pnpm-lock.yaml && echo \"✅ Successfully removed \""
26
- },
27
- "dependencies": {
28
- "clsx": "^2.1.1",
29
- "tailwind-merge": "^3.0.1"
30
- },
31
- "devDependencies": {
32
- "@eslint/eslintrc": "^3.3.1",
33
- "@eslint/js": "^9.36.0",
34
- "@mysetup/eslint-config": "latest",
35
- "@mysetup/jest-config": "latest",
36
- "@mysetup/prettier-config": "latest",
37
- "@mysetup/tsconfig": "latest",
38
- "@types/jest": "^29.5.14",
39
- "eslint": "9.32.0",
40
- "jest": "^29.7.0",
41
- "typescript": "5.5.4"
42
- },
43
- "prettier": "@mysetup/prettier-config",
44
- "engines": {
45
- "node": ">=20.15.1"
46
- },
47
- "packageManager": "pnpm@9.9.0"
48
- }
29
+ "./package.json": "./package.json"
30
+ },
31
+ "dependencies": {
32
+ "clsx": "^2.1.1",
33
+ "tailwind-merge": "^3.0.1"
34
+ },
35
+ "devDependencies": {
36
+ "@types/jest": "^29.5.14",
37
+ "jest": "^29.7.0",
38
+ "typescript": "5.5.4",
39
+ "@mysetup/tsconfig": "^2.0.4",
40
+ "@mysetup/jest-config": "^2.0.4",
41
+ "@mysetup/eslint-config": "^2.0.5",
42
+ "@mysetup/prettier-config": "^2.0.4"
43
+ },
44
+ "prettier": "@mysetup/prettier-config",
45
+ "engines": {
46
+ "node": ">=20.15.1"
47
+ },
48
+ "scripts": {
49
+ "build": "node ../scripts/package-fs.cjs remove dist && tsc -p tsconfig.build.json",
50
+ "lint": "node ../scripts/run-eslint.cjs .",
51
+ "typecheck": "tsc --noEmit",
52
+ "test": "jest",
53
+ "test:coverage": "jest --coverage",
54
+ "format": "prettier --write \"**/*.{ts,tsx,md,js}\"",
55
+ "checks": "pnpm typecheck && pnpm lint && pnpm test && pnpm build",
56
+ "clean": "node ../scripts/package-fs.cjs remove node_modules .swc dist pnpm-lock.yaml && echo \"Cleaned\""
57
+ }
58
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"classnames.d.ts","sourceRoot":"","sources":["../classnames.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,eAAO,MAAM,UAAU,eAAgB,UAAU,EAAE,WAA2B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}