@krrli/cm-designsystem 1.34.10 → 1.34.11
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 +48 -18
- package/dist/tailwind.preset.d.ts +8 -0
- package/dist/tailwind.preset.d.ts.map +1 -0
- package/dist/tailwind.preset.js +29 -0
- package/dist/tokens/index.d.ts +60 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens.js +65 -0
- package/package.json +17 -2
- package/src/base.css +17 -0
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.d.ts.map +0 -1
- package/src/index.css +0 -88
package/README.md
CHANGED
|
@@ -20,7 +20,12 @@ A modern React component library built with TypeScript, Tailwind CSS, and Storyb
|
|
|
20
20
|
|
|
21
21
|
## Usage in Your Project
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The CM Design System provides four key exports:
|
|
24
|
+
|
|
25
|
+
1. **Design Tokens** - Colors, spacing, fonts (framework-agnostic)
|
|
26
|
+
2. **Tailwind Preset** - Pre-configured Tailwind theme
|
|
27
|
+
3. **React Components** - Built with Radix UI + Tailwind
|
|
28
|
+
4. **Base Styles** - Font imports and base CSS
|
|
24
29
|
|
|
25
30
|
### 1. Install the package
|
|
26
31
|
|
|
@@ -28,29 +33,40 @@ To use the components and styles in your project with Tailwind CSS v4:
|
|
|
28
33
|
npm install @krrli/cm-designsystem
|
|
29
34
|
```
|
|
30
35
|
|
|
31
|
-
### 2.
|
|
36
|
+
### 2. Install peer dependencies
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
```bash
|
|
39
|
+
npm install @radix-ui/react-accessible-icon @radix-ui/react-aspect-ratio @radix-ui/react-avatar @radix-ui/react-dialog @radix-ui/react-form @radix-ui/react-tabs @radix-ui/react-toggle
|
|
40
|
+
```
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
@import "tailwindcss";
|
|
42
|
+
### 3. Configure Tailwind CSS
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
@import "@krrli/cm-designsystem/src/index.css";
|
|
44
|
+
Create or update your `tailwind.config.ts`:
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
```typescript
|
|
47
|
+
import type { Config } from "tailwindcss";
|
|
48
|
+
import designSystemPreset from "@krrli/cm-designsystem/tailwind.preset";
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
export default {
|
|
51
|
+
presets: [designSystemPreset],
|
|
52
|
+
content: [
|
|
53
|
+
"./src/**/*.{ts,tsx,js,jsx}",
|
|
54
|
+
// Scan design system components for Tailwind classes
|
|
55
|
+
"./node_modules/@krrli/cm-designsystem/dist/**/*.js",
|
|
56
|
+
],
|
|
57
|
+
} satisfies Config;
|
|
45
58
|
```
|
|
46
59
|
|
|
47
|
-
###
|
|
60
|
+
### 4. Import base styles
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
In your app's CSS file (e.g., `app/globals.css` or `src/index.css`):
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
@import "tailwindcss";
|
|
66
|
+
@import "@krrli/cm-designsystem/base.css";
|
|
51
67
|
```
|
|
52
68
|
|
|
53
|
-
###
|
|
69
|
+
### 5. Use components
|
|
54
70
|
|
|
55
71
|
```tsx
|
|
56
72
|
import { Button } from "@krrli/cm-designsystem";
|
|
@@ -64,11 +80,25 @@ function App() {
|
|
|
64
80
|
}
|
|
65
81
|
```
|
|
66
82
|
|
|
67
|
-
###
|
|
83
|
+
### Optional: Use design tokens directly
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { colors, fonts, spacing } from "@krrli/cm-designsystem/tokens";
|
|
87
|
+
|
|
88
|
+
// Use in your own components
|
|
89
|
+
const customStyle = {
|
|
90
|
+
color: colors.violet[600],
|
|
91
|
+
fontFamily: fonts.poppins.join(", "),
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Architecture Benefits
|
|
68
96
|
|
|
69
|
-
- **
|
|
70
|
-
- **
|
|
71
|
-
- **
|
|
97
|
+
- ✅ **SSR-safe**: No runtime CSS-in-JS
|
|
98
|
+
- ✅ **All responsive variants work**: Your Tailwind scans the design system
|
|
99
|
+
- ✅ **Type-safe tokens**: Import and use tokens directly
|
|
100
|
+
- ✅ **Clean separation**: Tokens, config, components, and styles are separate
|
|
101
|
+
- ✅ **Framework-compatible**: Works with Next.js, Vite, and other tools
|
|
72
102
|
|
|
73
103
|
````
|
|
74
104
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.preset.d.ts","sourceRoot":"","sources":["../src/tailwind.preset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CAwB3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { spacing, fontWeights, fonts, colors } from "./tokens.js";
|
|
2
|
+
const preset = {
|
|
3
|
+
theme: {
|
|
4
|
+
extend: {
|
|
5
|
+
colors: {
|
|
6
|
+
black: colors.black,
|
|
7
|
+
white: colors.white,
|
|
8
|
+
error: colors.error,
|
|
9
|
+
slate: colors.slate,
|
|
10
|
+
pink: colors.pink,
|
|
11
|
+
violet: colors.violet
|
|
12
|
+
},
|
|
13
|
+
fontFamily: {
|
|
14
|
+
poppins: fonts.poppins
|
|
15
|
+
},
|
|
16
|
+
fontWeight: {
|
|
17
|
+
medium: fontWeights.medium,
|
|
18
|
+
semibold: fontWeights.semibold,
|
|
19
|
+
bold: fontWeights.bold
|
|
20
|
+
},
|
|
21
|
+
spacing: {
|
|
22
|
+
base: spacing.base
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
preset as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Tokens
|
|
3
|
+
* Framework-agnostic design values that can be used in any context
|
|
4
|
+
*/
|
|
5
|
+
export declare const colors: {
|
|
6
|
+
readonly black: "oklch(0 0 0)";
|
|
7
|
+
readonly white: "oklch(1 0 0)";
|
|
8
|
+
readonly error: "oklch(57.7% 0.245 27.325)";
|
|
9
|
+
readonly slate: {
|
|
10
|
+
readonly 50: "oklch(0.984 0.003 247.858)";
|
|
11
|
+
readonly 100: "oklch(0.968 0.007 247.896)";
|
|
12
|
+
readonly 200: "oklch(0.929 0.013 255.508)";
|
|
13
|
+
readonly 300: "oklch(0.869 0.022 252.894)";
|
|
14
|
+
readonly 400: "oklch(0.704 0.04 256.788)";
|
|
15
|
+
readonly 500: "oklch(0.554 0.046 257.417)";
|
|
16
|
+
readonly 600: "oklch(0.446 0.043 257.281)";
|
|
17
|
+
readonly 700: "oklch(0.372 0.044 257.287)";
|
|
18
|
+
readonly 800: "oklch(0.279 0.041 260.031)";
|
|
19
|
+
readonly 900: "oklch(0.208 0.042 265.755)";
|
|
20
|
+
readonly 950: "oklch(0.129 0.042 264.695)";
|
|
21
|
+
};
|
|
22
|
+
readonly pink: {
|
|
23
|
+
readonly 50: "oklch(0.971 0.014 343.198)";
|
|
24
|
+
readonly 100: "oklch(0.948 0.028 342.258)";
|
|
25
|
+
readonly 200: "oklch(0.899 0.061 343.231)";
|
|
26
|
+
readonly 300: "oklch(0.823 0.12 346.018)";
|
|
27
|
+
readonly 400: "oklch(0.718 0.202 349.761)";
|
|
28
|
+
readonly 500: "oklch(0.656 0.241 354.308)";
|
|
29
|
+
readonly 600: "oklch(0.592 0.249 0.584)";
|
|
30
|
+
readonly 700: "oklch(0.525 0.223 3.958)";
|
|
31
|
+
readonly 800: "oklch(0.459 0.187 3.815)";
|
|
32
|
+
readonly 900: "oklch(0.408 0.153 2.432)";
|
|
33
|
+
readonly 950: "oklch(0.284 0.109 3.907)";
|
|
34
|
+
};
|
|
35
|
+
readonly violet: {
|
|
36
|
+
readonly 50: "oklch(0.969 0.016 293.756)";
|
|
37
|
+
readonly 100: "oklch(0.943 0.029 294.588)";
|
|
38
|
+
readonly 200: "oklch(0.894 0.057 293.283)";
|
|
39
|
+
readonly 300: "oklch(0.811 0.111 293.571)";
|
|
40
|
+
readonly 400: "oklch(0.702 0.183 293.541)";
|
|
41
|
+
readonly 500: "oklch(0.606 0.25 292.717)";
|
|
42
|
+
readonly 600: "oklch(0.541 0.281 293.009)";
|
|
43
|
+
readonly 700: "oklch(0.491 0.27 292.581)";
|
|
44
|
+
readonly 800: "oklch(0.432 0.232 292.759)";
|
|
45
|
+
readonly 900: "oklch(0.38 0.189 293.745)";
|
|
46
|
+
readonly 950: "oklch(0.283 0.141 291.089)";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const spacing: {
|
|
50
|
+
readonly base: "4px";
|
|
51
|
+
};
|
|
52
|
+
export declare const fonts: {
|
|
53
|
+
readonly poppins: readonly ["Poppins", "sans-serif"];
|
|
54
|
+
};
|
|
55
|
+
export declare const fontWeights: {
|
|
56
|
+
readonly medium: "500";
|
|
57
|
+
readonly semibold: "600";
|
|
58
|
+
readonly bold: "700";
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDT,CAAC;AAEX,eAAO,MAAM,OAAO;;CAEV,CAAC;AAEX,eAAO,MAAM,KAAK;;CAER,CAAC;AAEX,eAAO,MAAM,WAAW;;;;CAId,CAAC"}
|
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const colors = {
|
|
2
|
+
// Base
|
|
3
|
+
black: "oklch(0 0 0)",
|
|
4
|
+
white: "oklch(1 0 0)",
|
|
5
|
+
error: "oklch(57.7% 0.245 27.325)",
|
|
6
|
+
// Slate
|
|
7
|
+
slate: {
|
|
8
|
+
50: "oklch(0.984 0.003 247.858)",
|
|
9
|
+
100: "oklch(0.968 0.007 247.896)",
|
|
10
|
+
200: "oklch(0.929 0.013 255.508)",
|
|
11
|
+
300: "oklch(0.869 0.022 252.894)",
|
|
12
|
+
400: "oklch(0.704 0.04 256.788)",
|
|
13
|
+
500: "oklch(0.554 0.046 257.417)",
|
|
14
|
+
600: "oklch(0.446 0.043 257.281)",
|
|
15
|
+
700: "oklch(0.372 0.044 257.287)",
|
|
16
|
+
800: "oklch(0.279 0.041 260.031)",
|
|
17
|
+
900: "oklch(0.208 0.042 265.755)",
|
|
18
|
+
950: "oklch(0.129 0.042 264.695)"
|
|
19
|
+
},
|
|
20
|
+
// Pink
|
|
21
|
+
pink: {
|
|
22
|
+
50: "oklch(0.971 0.014 343.198)",
|
|
23
|
+
100: "oklch(0.948 0.028 342.258)",
|
|
24
|
+
200: "oklch(0.899 0.061 343.231)",
|
|
25
|
+
300: "oklch(0.823 0.12 346.018)",
|
|
26
|
+
400: "oklch(0.718 0.202 349.761)",
|
|
27
|
+
500: "oklch(0.656 0.241 354.308)",
|
|
28
|
+
600: "oklch(0.592 0.249 0.584)",
|
|
29
|
+
700: "oklch(0.525 0.223 3.958)",
|
|
30
|
+
800: "oklch(0.459 0.187 3.815)",
|
|
31
|
+
900: "oklch(0.408 0.153 2.432)",
|
|
32
|
+
950: "oklch(0.284 0.109 3.907)"
|
|
33
|
+
},
|
|
34
|
+
// Violet
|
|
35
|
+
violet: {
|
|
36
|
+
50: "oklch(0.969 0.016 293.756)",
|
|
37
|
+
100: "oklch(0.943 0.029 294.588)",
|
|
38
|
+
200: "oklch(0.894 0.057 293.283)",
|
|
39
|
+
300: "oklch(0.811 0.111 293.571)",
|
|
40
|
+
400: "oklch(0.702 0.183 293.541)",
|
|
41
|
+
500: "oklch(0.606 0.25 292.717)",
|
|
42
|
+
600: "oklch(0.541 0.281 293.009)",
|
|
43
|
+
700: "oklch(0.491 0.27 292.581)",
|
|
44
|
+
800: "oklch(0.432 0.232 292.759)",
|
|
45
|
+
900: "oklch(0.38 0.189 293.745)",
|
|
46
|
+
950: "oklch(0.283 0.141 291.089)"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const spacing = {
|
|
50
|
+
base: "4px"
|
|
51
|
+
};
|
|
52
|
+
const fonts = {
|
|
53
|
+
poppins: ["Poppins", "sans-serif"]
|
|
54
|
+
};
|
|
55
|
+
const fontWeights = {
|
|
56
|
+
medium: "500",
|
|
57
|
+
semibold: "600",
|
|
58
|
+
bold: "700"
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
colors,
|
|
62
|
+
fontWeights,
|
|
63
|
+
fonts,
|
|
64
|
+
spacing
|
|
65
|
+
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krrli/cm-designsystem",
|
|
3
3
|
"repository": "https://github.com/ost-cas-fea-25-26/cm-designsystem",
|
|
4
|
-
"version": "1.34.
|
|
4
|
+
"version": "1.34.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./tokens": {
|
|
15
|
+
"types": "./dist/tokens/index.d.ts",
|
|
16
|
+
"import": "./dist/tokens/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./tailwind.preset": {
|
|
19
|
+
"types": "./dist/tailwind.preset.d.ts",
|
|
20
|
+
"import": "./dist/tailwind.preset.js"
|
|
21
|
+
},
|
|
22
|
+
"./base.css": "./src/base.css"
|
|
23
|
+
},
|
|
9
24
|
"files": [
|
|
10
25
|
"dist",
|
|
11
|
-
"src/
|
|
26
|
+
"src/base.css"
|
|
12
27
|
],
|
|
13
28
|
"sideEffects": false,
|
|
14
29
|
"publishConfig": {
|
package/src/base.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base styles for CM Design System
|
|
3
|
+
* Import this in your consuming app's CSS file
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* Import Poppins font */
|
|
7
|
+
@import "@fontsource/poppins/400.css";
|
|
8
|
+
@import "@fontsource/poppins/500.css";
|
|
9
|
+
@import "@fontsource/poppins/600.css";
|
|
10
|
+
@import "@fontsource/poppins/700.css";
|
|
11
|
+
|
|
12
|
+
@layer base {
|
|
13
|
+
html {
|
|
14
|
+
font-family: theme("fontFamily.poppins");
|
|
15
|
+
color: theme("colors.slate.600");
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/setupTests.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=setupTests.d.ts.map
|
package/dist/setupTests.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC"}
|
package/src/index.css
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@source "../src/**/*.{ts,tsx,js,jsx}";
|
|
3
|
-
|
|
4
|
-
/* Import Poppins font */
|
|
5
|
-
@import "@fontsource/poppins/400.css";
|
|
6
|
-
@import "@fontsource/poppins/500.css";
|
|
7
|
-
@import "@fontsource/poppins/600.css";
|
|
8
|
-
@import "@fontsource/poppins/700.css";
|
|
9
|
-
|
|
10
|
-
@theme {
|
|
11
|
-
/* -----------------------------------------
|
|
12
|
-
Color
|
|
13
|
-
----------------------------------------- */
|
|
14
|
-
--color-*: initial;
|
|
15
|
-
|
|
16
|
-
/* Base */
|
|
17
|
-
--color-black: oklch(0 0 0);
|
|
18
|
-
--color-white: oklch(1 0 0);
|
|
19
|
-
--color-error: oklch(57.7% 0.245 27.325);
|
|
20
|
-
|
|
21
|
-
/* Slate */
|
|
22
|
-
--color-slate-50: oklch(0.984 0.003 247.858);
|
|
23
|
-
--color-slate-100: oklch(0.968 0.007 247.896);
|
|
24
|
-
--color-slate-200: oklch(0.929 0.013 255.508);
|
|
25
|
-
--color-slate-300: oklch(0.869 0.022 252.894);
|
|
26
|
-
--color-slate-400: oklch(0.704 0.04 256.788);
|
|
27
|
-
--color-slate-500: oklch(0.554 0.046 257.417);
|
|
28
|
-
--color-slate-600: oklch(0.446 0.043 257.281);
|
|
29
|
-
--color-slate-700: oklch(0.372 0.044 257.287);
|
|
30
|
-
--color-slate-800: oklch(0.279 0.041 260.031);
|
|
31
|
-
--color-slate-900: oklch(0.208 0.042 265.755);
|
|
32
|
-
--color-slate-950: oklch(0.129 0.042 264.695);
|
|
33
|
-
|
|
34
|
-
/* Pink */
|
|
35
|
-
--color-pink-50: oklch(0.971 0.014 343.198);
|
|
36
|
-
--color-pink-100: oklch(0.948 0.028 342.258);
|
|
37
|
-
--color-pink-200: oklch(0.899 0.061 343.231);
|
|
38
|
-
--color-pink-300: oklch(0.823 0.12 346.018);
|
|
39
|
-
--color-pink-400: oklch(0.718 0.202 349.761);
|
|
40
|
-
--color-pink-500: oklch(0.656 0.241 354.308);
|
|
41
|
-
--color-pink-600: oklch(0.592 0.249 0.584);
|
|
42
|
-
--color-pink-700: oklch(0.525 0.223 3.958);
|
|
43
|
-
--color-pink-800: oklch(0.459 0.187 3.815);
|
|
44
|
-
--color-pink-900: oklch(0.408 0.153 2.432);
|
|
45
|
-
--color-pink-950: oklch(0.284 0.109 3.907);
|
|
46
|
-
|
|
47
|
-
/* Violet */
|
|
48
|
-
--color-violet-50: oklch(0.969 0.016 293.756);
|
|
49
|
-
--color-violet-100: oklch(0.943 0.029 294.588);
|
|
50
|
-
--color-violet-200: oklch(0.894 0.057 293.283);
|
|
51
|
-
--color-violet-300: oklch(0.811 0.111 293.571);
|
|
52
|
-
--color-violet-400: oklch(0.702 0.183 293.541);
|
|
53
|
-
--color-violet-500: oklch(0.606 0.25 292.717);
|
|
54
|
-
--color-violet-600: oklch(0.541 0.281 293.009);
|
|
55
|
-
--color-violet-700: oklch(0.491 0.27 292.581);
|
|
56
|
-
--color-violet-800: oklch(0.432 0.232 292.759);
|
|
57
|
-
--color-violet-900: oklch(0.38 0.189 293.745);
|
|
58
|
-
--color-violet-950: oklch(0.283 0.141 291.089);
|
|
59
|
-
|
|
60
|
-
/* -----------------------------------------
|
|
61
|
-
Spacing
|
|
62
|
-
----------------------------------------- */
|
|
63
|
-
--spacing-*: initial;
|
|
64
|
-
--spacing: 4px;
|
|
65
|
-
|
|
66
|
-
/* -----------------------------------------
|
|
67
|
-
Typography
|
|
68
|
-
----------------------------------------- */
|
|
69
|
-
/* Font family */
|
|
70
|
-
--font-*: initial;
|
|
71
|
-
--font-poppins: Poppins, sans-serif;
|
|
72
|
-
|
|
73
|
-
/* Font weight */
|
|
74
|
-
--font-weight-*: initial;
|
|
75
|
-
--font-weight-medium: 500;
|
|
76
|
-
--font-weight-semibold: 600;
|
|
77
|
-
--font-weight-bold: 700;
|
|
78
|
-
|
|
79
|
-
/* Text */
|
|
80
|
-
--text-*: initial;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@layer base {
|
|
84
|
-
html {
|
|
85
|
-
font-family: var(--font-poppins);
|
|
86
|
-
color: var(--color-slate-600);
|
|
87
|
-
}
|
|
88
|
-
}
|