@phsa.tec/design-system-react 0.3.1 → 0.3.2
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 +91 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A modern, **fully isolated** React component library built with TypeScript, Tail
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Zero Conflicts** - Fully isolated CSS, won't interfere with your project's styles
|
|
8
|
-
- **Customizable** - Via CSS Variables
|
|
8
|
+
- **Customizable** - Via CSS Variables
|
|
9
9
|
- **Accessible** - Built with Radix UI primitives
|
|
10
10
|
- **Dark Mode** - Native dark theme support
|
|
11
11
|
- **TypeScript** - Full type support
|
|
@@ -28,7 +28,27 @@ pnpm add @phsa.tec/design-system-react
|
|
|
28
28
|
|
|
29
29
|
### Step 1: Add Styles to Your Project
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
You have two options to add the design system styles:
|
|
32
|
+
|
|
33
|
+
#### Option 1: Import CSS Directly (Quick Start)
|
|
34
|
+
|
|
35
|
+
Import the CSS file at the **top** of your project's `globals.css` file:
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
/* globals.css - Import at the top */
|
|
39
|
+
@import "@phsa.tec/design-system-react/styles.css";
|
|
40
|
+
|
|
41
|
+
/* Your other styles below */
|
|
42
|
+
@tailwind base;
|
|
43
|
+
@tailwind components;
|
|
44
|
+
@tailwind utilities;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This will use the default styles. To customize the CSS variables, use Option 2.
|
|
48
|
+
|
|
49
|
+
#### Option 2: Copy to globals.css (Recommended for Customization)
|
|
50
|
+
|
|
51
|
+
Copy the design system styles to your project's `globals.css` (or main CSS file) and customize the CSS variables:
|
|
32
52
|
|
|
33
53
|
```css
|
|
34
54
|
/* globals.css or your main CSS file */
|
|
@@ -42,20 +62,79 @@ Copy the design system styles to your project's `globals.css` (or main CSS file)
|
|
|
42
62
|
:root {
|
|
43
63
|
--background: oklch(100% 0 0);
|
|
44
64
|
--foreground: oklch(25% 0.01 150);
|
|
65
|
+
--card: oklch(100% 0 0);
|
|
66
|
+
--card-foreground: oklch(25% 0.01 150);
|
|
67
|
+
--popover: oklch(100% 0 0);
|
|
68
|
+
--popover-foreground: oklch(25% 0.01 150);
|
|
45
69
|
--primary: oklch(42% 0.15 145);
|
|
46
70
|
--primary-foreground: oklch(98% 0 0);
|
|
47
|
-
|
|
71
|
+
--secondary: oklch(96% 0.02 150);
|
|
72
|
+
--secondary-foreground: oklch(25% 0.01 150);
|
|
73
|
+
--muted: oklch(96% 0.02 150);
|
|
74
|
+
--muted-foreground: oklch(45% 0.01 150);
|
|
75
|
+
--accent: oklch(96% 0.02 150);
|
|
76
|
+
--accent-foreground: oklch(25% 0.01 150);
|
|
77
|
+
--success: oklch(42% 0.15 145);
|
|
78
|
+
--success-foreground: oklch(98% 0 0);
|
|
79
|
+
--warning: oklch(50% 0.18 48);
|
|
80
|
+
--destructive: oklch(60% 0.20 0);
|
|
81
|
+
--destructive-foreground: oklch(98% 0 0);
|
|
82
|
+
--border: oklch(88% 0.03 150);
|
|
83
|
+
--input: oklch(88% 0.03 150);
|
|
84
|
+
--ring: oklch(42% 0.15 145);
|
|
85
|
+
--radius: 0.5rem;
|
|
86
|
+
--sidebar-background: oklch(98% 0.04 150);
|
|
87
|
+
--sidebar-foreground: oklch(30% 0.01 150);
|
|
88
|
+
--sidebar-primary: oklch(42% 0.15 145);
|
|
89
|
+
--sidebar-primary-foreground: oklch(98% 0 0);
|
|
90
|
+
--sidebar-accent: oklch(95% 0.04 150);
|
|
91
|
+
--sidebar-accent-foreground: oklch(25% 0.01 150);
|
|
92
|
+
--sidebar-border: oklch(90% 0.04 150);
|
|
93
|
+
--sidebar-ring: oklch(42% 0.15 145);
|
|
48
94
|
}
|
|
49
95
|
|
|
50
96
|
.dark {
|
|
51
97
|
--background: oklch(4% 0.01 150);
|
|
52
98
|
--foreground: oklch(95% 0.02 150);
|
|
53
|
-
|
|
99
|
+
--card: oklch(4% 0.01 150);
|
|
100
|
+
--card-foreground: oklch(95% 0.02 150);
|
|
101
|
+
--popover: oklch(4% 0.01 150);
|
|
102
|
+
--popover-foreground: oklch(95% 0.02 150);
|
|
103
|
+
--primary: oklch(48% 0.16 145);
|
|
104
|
+
--primary-foreground: oklch(8% 0.01 150);
|
|
105
|
+
--secondary: oklch(12% 0.02 150);
|
|
106
|
+
--secondary-foreground: oklch(95% 0.02 150);
|
|
107
|
+
--muted: oklch(12% 0.02 150);
|
|
108
|
+
--muted-foreground: oklch(60% 0.02 150);
|
|
109
|
+
--accent: oklch(12% 0.02 150);
|
|
110
|
+
--accent-foreground: oklch(95% 0.02 150);
|
|
111
|
+
--destructive: oklch(31% 0.12 0);
|
|
112
|
+
--destructive-foreground: oklch(98% 0 0);
|
|
113
|
+
--border: oklch(18% 0.02 150);
|
|
114
|
+
--input: oklch(18% 0.02 150);
|
|
115
|
+
--ring: oklch(48% 0.16 145);
|
|
116
|
+
--sidebar-background: oklch(8% 0.01 150);
|
|
117
|
+
--sidebar-foreground: oklch(90% 0.02 150);
|
|
118
|
+
--sidebar-primary: oklch(48% 0.16 145);
|
|
119
|
+
--sidebar-primary-foreground: oklch(8% 0.01 150);
|
|
120
|
+
--sidebar-accent: oklch(15% 0.02 150);
|
|
121
|
+
--sidebar-accent-foreground: oklch(90% 0.02 150);
|
|
122
|
+
--sidebar-border: oklch(15% 0.02 150);
|
|
123
|
+
--sidebar-ring: oklch(48% 0.16 145);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@layer base {
|
|
128
|
+
* {
|
|
129
|
+
@apply border-border;
|
|
130
|
+
}
|
|
131
|
+
body {
|
|
132
|
+
@apply bg-background text-foreground;
|
|
54
133
|
}
|
|
55
134
|
}
|
|
56
135
|
```
|
|
57
136
|
|
|
58
|
-
**
|
|
137
|
+
**Tip:** Customize the CSS variables (`--primary`, `--background`, etc.) to match your brand colors and design preferences.
|
|
59
138
|
|
|
60
139
|
### Step 2: Use Components
|
|
61
140
|
|
|
@@ -122,27 +201,6 @@ Simply modify the CSS variables in your `globals.css`:
|
|
|
122
201
|
- Chroma: 0-0.4 (saturation)
|
|
123
202
|
- Hue: 0-360 (color angle)
|
|
124
203
|
|
|
125
|
-
### Option 2: Tailwind Preset (Advanced)
|
|
126
|
-
|
|
127
|
-
If your project uses Tailwind CSS, you can extend with our preset:
|
|
128
|
-
|
|
129
|
-
```js
|
|
130
|
-
// tailwind.config.js
|
|
131
|
-
module.exports = {
|
|
132
|
-
presets: [require("@phsa.tec/design-system-react/tailwind-preset")],
|
|
133
|
-
theme: {
|
|
134
|
-
extend: {
|
|
135
|
-
// Your customizations
|
|
136
|
-
colors: {
|
|
137
|
-
primary: {
|
|
138
|
-
DEFAULT: "#your-color",
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
```
|
|
145
|
-
|
|
146
204
|
## Available CSS Variables
|
|
147
205
|
|
|
148
206
|
### Colors
|
|
@@ -243,9 +301,14 @@ function App() {
|
|
|
243
301
|
```typescript
|
|
244
302
|
// Components
|
|
245
303
|
import { Button, Card } from "@phsa.tec/design-system-react";
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
```css
|
|
307
|
+
/* globals.css - Import at the top (Option 1: Quick start) */
|
|
308
|
+
@import "@phsa.tec/design-system-react/styles.css";
|
|
246
309
|
|
|
247
|
-
|
|
248
|
-
|
|
310
|
+
/* Or copy the full styles to your globals.css (Option 2: For customization) */
|
|
311
|
+
/* See "Basic Usage" section above for details */
|
|
249
312
|
```
|
|
250
313
|
|
|
251
314
|
## Development
|