diff --git a/.agent/consumer.md b/.agent/consumer.md index 81be1a0..2d41701 100644 --- a/.agent/consumer.md +++ b/.agent/consumer.md @@ -17,6 +17,12 @@ Before each related task, read the current contents of every matching reference, If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriFrontCommon's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead. +## Class Name Helper + +- `@kri/common/ui` exports `cn` and `ClassValue` from the npm `cn` package (pinned exactly). It replaces `clsx` + `tailwind-merge` with the same public signature and merge results; consumers keep importing `cn` through their `@/lib/utils` re-export. +- `@kri/common` now declares `engines.node >=22` because `cn` requires Node.js 22 or later. +- shadcn CLI may add `cn` to a consumer's own dependencies when installing components; that is expected and harmless. + ## Noti-hub SMS Types - `MessageType.SMS = 21`, `LMS = 22`, `MMS = 23`; `ChannelType.SMS = 2` is unchanged. `SMS_TYPE_ARRAY` and `SmsType` include all three. diff --git a/AGENTS.md b/AGENTS.md index 88d6968..488798a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -229,6 +229,7 @@ When implementation is complete, report in Korean: - Treat the current React version, component style, state management, routing, styling, and test approach as authoritative. - Do not perform unrelated class-to-hook, JavaScript-to-TypeScript, state-library, styling-system, or React-to-Next.js migrations. - Keep components focused and follow the repository's established split between presentation, state, data access, and side effects. +- Do not use nested ternary expressions. Use clear `if`/`else` branches, early returns, or well-named intermediate variables instead; a single, non-nested ternary is acceptable only when it remains immediately readable. - Keep effects dependency-correct and clean up subscriptions, timers, listeners, and in-flight work where applicable. - Use stable semantic keys and preserve accessibility, loading, empty, error, disabled, and success states. - Preserve public component props and shared UI contracts unless a coordinated breaking change is explicitly approved. diff --git a/package-lock.json b/package-lock.json index 5367269..38669ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,16 @@ { "name": "@kri/common", - "version": "0.19.5", + "version": "0.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@kri/common", - "version": "0.19.5", + "version": "0.20.0", "license": "UNLICENSED", "dependencies": { - "clsx": "^2.1.1", - "crypto-js": "^4.2.0", - "tailwind-merge": "^3.4.0" + "cn": "0.5.2", + "crypto-js": "^4.2.0" }, "devDependencies": { "@tanstack/react-query": "^5.90.21", @@ -21,6 +20,9 @@ "react": "^19.2.7", "typescript": "^6.0.3" }, + "engines": { + "node": ">=22" + }, "peerDependencies": { "@tanstack/react-query": ">=5 <6", "jotai": ">=2", @@ -83,13 +85,16 @@ "csstype": "^3.2.2" } }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "node_modules/cn": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/cn/-/cn-0.5.2.tgz", + "integrity": "sha512-wm10E6iuJ37rALOw3D+3cfaXXZSLNMh2uxpQn3dNICqfJM59yXqgbA9/9Iiz155j5kYNLdK6WreNdW3NQtx3OQ==", "license": "MIT", + "bin": { + "cn": "bin/cn.mjs" + }, "engines": { - "node": ">=6" + "node": ">=22" } }, "node_modules/crypto-js": { @@ -145,16 +150,6 @@ "node": ">=0.10.0" } }, - "node_modules/tailwind-merge": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.4.0.tgz", - "integrity": "sha512-uSaO4gnW+b3Y2aWoWfFpX62vn2sR3skfhbjsEnaBI81WD1wBLlHZe5sWf0AqjksNdYTbGBEd0UasQMT3SNV15g==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/dcastil" - } - }, "node_modules/typescript": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", diff --git a/package.json b/package.json index 2dcff2c..3b91bb0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kri/common", - "version": "0.19.5", + "version": "0.20.0", "description": "KRI 프런트엔드 공통 유틸리티", "type": "module", "main": "./dist/index.js", @@ -75,6 +75,9 @@ "common", "typescript" ], + "engines": { + "node": ">=22" + }, "author": "KRI", "license": "UNLICENSED", "private": false, @@ -106,8 +109,7 @@ } }, "dependencies": { - "clsx": "^2.1.1", - "crypto-js": "^4.2.0", - "tailwind-merge": "^3.4.0" + "cn": "0.5.2", + "crypto-js": "^4.2.0" } } diff --git a/src/ui/class-name.ts b/src/ui/class-name.ts index b9109fd..b9f5923 100644 --- a/src/ui/class-name.ts +++ b/src/ui/class-name.ts @@ -1,13 +1,9 @@ -import { clsx, type ClassValue } from "clsx"; - -import { twMerge } from "tailwind-merge"; - /** * 조건부 className을 결합하고 * 충돌하는 Tailwind CSS 클래스를 정리한다. + * + * npm `cn` 패키지(clsx + tailwind-merge 대체, 동일 결과)를 그대로 내보낸다. */ -export const cn = (...inputs: ClassValue[]): string => { - return twMerge(clsx(inputs)); -}; +export { cn } from "cn"; -export type { ClassValue }; +export type { ClassValue } from "cn";