@foundrykit/utils 1.0.0 → 1.0.1
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/CHANGELOG.md +6 -0
- package/package.json +3 -3
- package/src/config.ts +47 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundrykit/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"eslint": "^9.0.0",
|
|
25
25
|
"tsup": "^8.0.0",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
|
-
"@foundrykit/eslint-config": "1.0.
|
|
28
|
-
"@foundrykit/typescript-config": "1.0.
|
|
27
|
+
"@foundrykit/eslint-config": "1.0.1",
|
|
28
|
+
"@foundrykit/typescript-config": "1.0.1"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsup",
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const utilsConfig: ComponentConfig = {
|
|
4
|
+
name: 'Utils',
|
|
5
|
+
description: 'Utility functions for className merging and common helpers',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['utility', 'helper', 'cn', 'classnames'],
|
|
8
|
+
preview: {
|
|
9
|
+
type: 'static',
|
|
10
|
+
html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><code class="text-xs">cn(...classes)</code></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Basic Usage',
|
|
15
|
+
description: 'Merge class names with cn function',
|
|
16
|
+
code: "cn('px-4 py-2', 'bg-blue-500', { 'opacity-50': disabled })",
|
|
17
|
+
preview: {
|
|
18
|
+
type: 'static',
|
|
19
|
+
html: '<code>cn("px-4 py-2", "bg-blue-500")</code>',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'With Tailwind Merge',
|
|
24
|
+
description: 'Automatically resolves conflicting Tailwind classes',
|
|
25
|
+
code: "cn('px-2', 'px-4') // Returns: 'px-4'",
|
|
26
|
+
preview: {
|
|
27
|
+
type: 'static',
|
|
28
|
+
html: '<code>cn("px-2", "px-4") → "px-4"</code>',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
dependencies: [],
|
|
33
|
+
packageDependencies: ['clsx', 'tailwind-merge'],
|
|
34
|
+
files: ['lib/utils.ts'],
|
|
35
|
+
usageExample: `// Basic usage
|
|
36
|
+
const className = cn('base-class', 'additional-class', {
|
|
37
|
+
'conditional-class': true,
|
|
38
|
+
'another-conditional': false
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// With Tailwind class merging
|
|
42
|
+
const buttonClass = cn(
|
|
43
|
+
'px-2 py-1 rounded',
|
|
44
|
+
'px-4', // This will override px-2
|
|
45
|
+
className
|
|
46
|
+
);`,
|
|
47
|
+
};
|