@esds-sangam/utils 0.1.5

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 ADDED
@@ -0,0 +1,29 @@
1
+ # @esds-sangam/utils
2
+
3
+ Shared utility helpers for the ESDS Sangam Design System. Currently includes a Tailwind-aware `cn` helper for safe `className` composition.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @esds-sangam/utils
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { cn } from "@esds-sangam/utils";
15
+
16
+ export function PrimaryButton({ className, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) {
17
+ return (
18
+ <button
19
+ className={cn(
20
+ "inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium",
21
+ "bg-primary-600 text-white hover:bg-primary-700 disabled:bg-neutral-300 disabled:text-neutral-600",
22
+ className
23
+ )}
24
+ {...props}
25
+ />
26
+ );
27
+ }
28
+ ```
29
+
@@ -0,0 +1,18 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ /**
4
+ * Utility Functions
5
+ *
6
+ * Shared helper functions for:
7
+ * - Class name merging
8
+ * - Formatting
9
+ * - Pure utility functions
10
+ */
11
+
12
+ /**
13
+ * Merge Tailwind CSS classes with proper precedence
14
+ * Used throughout the design system for className composition
15
+ */
16
+ declare function cn(...inputs: ClassValue[]): string;
17
+
18
+ export { cn };
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ // src/index.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+ export {
8
+ cn
9
+ };
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@esds-sangam/utils",
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsup src/index.ts --format esm --dts --clean --external clsx --external tailwind-merge",
19
+ "lint": "eslint . --ext .ts",
20
+ "type-check": "tsc --noEmit"
21
+ },
22
+ "dependencies": {
23
+ "clsx": "^2.1.0",
24
+ "tailwind-merge": "^2.2.0"
25
+ },
26
+ "devDependencies": {
27
+ "tsup": "^8.5.1",
28
+ "typescript": "^5.3.0"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }