@krrli/cm-designsystem 1.34.9 → 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 CHANGED
@@ -20,32 +20,88 @@ A modern React component library built with TypeScript, Tailwind CSS, and Storyb
20
20
 
21
21
  ## Usage in Your Project
22
22
 
23
- To use the components and styles in your project:
23
+ The CM Design System provides four key exports:
24
24
 
25
- 1. Install the package:
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
29
+
30
+ ### 1. Install the package
31
+
32
+ ```bash
33
+ npm install @krrli/cm-designsystem
34
+ ```
35
+
36
+ ### 2. Install peer dependencies
26
37
 
27
38
  ```bash
28
- npm i @krrli/cm-designsystem
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
+ ```
41
+
42
+ ### 3. Configure Tailwind CSS
43
+
44
+ Create or update your `tailwind.config.ts`:
45
+
46
+ ```typescript
47
+ import type { Config } from "tailwindcss";
48
+ import designSystemPreset from "@krrli/cm-designsystem/tailwind.preset";
49
+
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;
29
58
  ```
30
59
 
31
- 2. Import the bundled CSS in your app entry (e.g., `main.tsx` or `App.tsx`):
60
+ ### 4. Import base styles
32
61
 
33
- ```js
34
- import "cm-designsystem/dist/cm-designsystem.css";
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";
35
67
  ```
36
68
 
37
- 3. Import and use components as needed:
69
+ ### 5. Use components
38
70
 
39
- ```js
40
- import { Button } from "cm-designsystem";
71
+ ```tsx
72
+ import { Button } from "@krrli/cm-designsystem";
41
73
 
42
74
  function App() {
43
75
  return (
44
- <Button label="Click me" intent="primary" size="md" onClick={() => {}} />
76
+ <Button intent="primary" size="md" onClick={() => console.log("Clicked!")}>
77
+ Click me
78
+ </Button>
45
79
  );
46
80
  }
47
81
  ```
48
82
 
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
96
+
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
102
+
103
+ ````
104
+
49
105
  ---
50
106
 
51
107
  ## Technical Stack
@@ -71,7 +127,7 @@ npm install
71
127
 
72
128
  # Start Storybook development server
73
129
  npm run storybook
74
- ```
130
+ ````
75
131
 
76
132
  Storybook will be available at [http://localhost:6006](http://localhost:6006)
77
133
 
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { AccessibleIcon } from "@radix-ui/react-accessible-icon";
3
- import { cn, tv } from "tailwind-variants";
3
+ import { tv, cn } from "tailwind-variants";
4
4
  const iconStyles = tv({
5
5
  base: ["w-4", "h-4"]
6
6
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AAErB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- /* empty css */
2
1
  import { Avatar } from "./components/avatar/Avatar.js";
3
2
  import { BrandingGallery } from "./components/branding/BrandingGallery.js";
4
3
  import { Button } from "./components/button/Button.js";
@@ -0,0 +1,8 @@
1
+ import { Config } from 'tailwindcss';
2
+ /**
3
+ * Tailwind CSS Preset for CM Design System
4
+ * Import this preset in your tailwind.config.ts
5
+ */
6
+ declare const preset: Partial<Config>;
7
+ export default preset;
8
+ //# sourceMappingURL=tailwind.preset.d.ts.map
@@ -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,13 +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.9",
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
- "dist"
25
+ "dist",
26
+ "src/base.css"
11
27
  ],
12
28
  "sideEffects": false,
13
29
  "publishConfig": {
@@ -32,6 +48,7 @@
32
48
  "e2e:update": "npm run build-storybook & docker run --rm -i -e TEST_BASE_URL=http://localhost:6006 -e CI=true -v ./playwright-report:/app/playwright-report -v ./test-results:/app/test-results -v ./storybook-static:/app/storybook-static -v ./tests:/app/tests -v ./playwright.config.ts:/app/playwright.config.ts cm-designsystem-visual-testing sh -c \"npx http-server /app/storybook-static -p 6006 & npx playwright test --update-snapshots\""
33
49
  },
34
50
  "dependencies": {
51
+ "@fontsource/poppins": "^5.2.7",
35
52
  "tailwind-variants": "3.2.2"
36
53
  },
37
54
  "peerDependencies": {
@@ -49,10 +66,10 @@
49
66
  "@chromatic-com/storybook": "4.1.3",
50
67
  "@eslint/js": "9.39.2",
51
68
  "@playwright/test": "1.57.0",
52
- "@storybook/addon-a11y": "10.1.10",
53
- "@storybook/addon-docs": "10.1.10",
54
- "@storybook/addon-vitest": "10.1.10",
55
- "@storybook/react-vite": "10.1.10",
69
+ "@storybook/addon-a11y": "10.1.11",
70
+ "@storybook/addon-docs": "10.1.11",
71
+ "@storybook/addon-vitest": "10.1.11",
72
+ "@storybook/react-vite": "10.1.11",
56
73
  "@tailwindcss/vite": "4.1.18",
57
74
  "@testing-library/dom": "10.4.1",
58
75
  "@testing-library/jest-dom": "6.9.1",
@@ -73,7 +90,7 @@
73
90
  "eslint-plugin-react": "7.37.5",
74
91
  "eslint-plugin-react-hooks": "7.0.1",
75
92
  "eslint-plugin-react-refresh": "0.4.26",
76
- "eslint-plugin-storybook": "10.1.10",
93
+ "eslint-plugin-storybook": "10.1.11",
77
94
  "eslint-plugin-unused-imports": "4.3.0",
78
95
  "globals": "16.5.0",
79
96
  "jsdom": "27.4.0",
@@ -83,11 +100,11 @@
83
100
  "prettier-plugin-tailwindcss": "0.7.2",
84
101
  "rollup-preserve-directives": "1.1.3",
85
102
  "semantic-release": "25.0.2",
86
- "storybook": "10.1.10",
103
+ "storybook": "10.1.11",
87
104
  "tailwind-merge": "3.4.0",
88
105
  "tailwindcss": "4.1.18",
89
106
  "typescript": "5.9.3",
90
- "typescript-eslint": "8.50.1",
107
+ "typescript-eslint": "8.51.0",
91
108
  "vite": "7.3.0",
92
109
  "vite-plugin-dts": "4.5.4",
93
110
  "vite-plugin-svgr": "^4.5.0",
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
+ }