@phsa.tec/design-system-react 0.1.10 → 0.3.0

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
@@ -1,187 +1,245 @@
1
- # 🎨 PHSA Design System React
1
+ # PHSA Design System React
2
2
 
3
- A modern React component library built with TypeScript, Tailwind CSS, and Radix UI.
3
+ A modern, **fully isolated** React component library built with TypeScript, Tailwind CSS, and Radix UI.
4
4
 
5
- ## 📚 Documentation
5
+ ## Features
6
6
 
7
- 🌐 **[View Live Documentation](https://henriques4nti4go.github.io/phsa-design-system/)**
7
+ - **Zero Conflicts** - Fully isolated CSS, won't interfere with your project's styles
8
+ - **Customizable** - Via CSS Variables or Tailwind Preset
9
+ - **Accessible** - Built with Radix UI primitives
10
+ - **Dark Mode** - Native dark theme support
11
+ - **TypeScript** - Full type support
8
12
 
9
- ## 🚀 Installation
13
+ ## Documentation
14
+
15
+ [View Full Documentation](https://henriques4nti4go.github.io/phsa-design-system/)
16
+
17
+ ## Installation
10
18
 
11
19
  ```bash
12
20
  npm install @phsa.tec/design-system-react
21
+ # or
22
+ yarn add @phsa.tec/design-system-react
23
+ # or
24
+ pnpm add @phsa.tec/design-system-react
13
25
  ```
14
26
 
15
- ## ⚙️ Setup
27
+ ## Basic Usage
16
28
 
17
- ### 1. Import Styles
29
+ ```tsx
30
+ // 1. Import CSS (required)
31
+ import "@phsa.tec/design-system-react/styles.css";
18
32
 
19
- Add this import to your main CSS file or app entry point:
33
+ // 2. Import components
34
+ import { DesignSystemProvider, Button, Card } from "@phsa.tec/design-system-react";
20
35
 
21
- ```typescript
22
- import "@phsa.tec/design-system-react/styles";
36
+ function App() {
37
+ return (
38
+ <DesignSystemProvider>
39
+ <Card>
40
+ <Button>Click me</Button>
41
+ </Card>
42
+ </DesignSystemProvider>
43
+ );
44
+ }
23
45
  ```
24
46
 
25
- ### 2. Configure Tailwind CSS
47
+ ## Customization
26
48
 
27
- Update your `tailwind.config.js`:
49
+ ### Option 1: CSS Variables (Recommended)
28
50
 
29
- ```javascript
51
+ Override CSS variables in your stylesheet:
52
+
53
+ ```css
54
+ /* globals.css */
55
+ :root {
56
+ /* Primary colors */
57
+ --primary: 220 90% 50%;
58
+ --primary-foreground: 0 0% 100%;
59
+ --secondary: 210 40% 96%;
60
+ --secondary-foreground: 222 47% 11%;
61
+
62
+ /* Feedback colors */
63
+ --destructive: 0 84% 60%;
64
+ --success: 142 76% 36%;
65
+ --warning: 38 92% 50%;
66
+
67
+ /* Neutral colors */
68
+ --background: 0 0% 100%;
69
+ --foreground: 222 84% 5%;
70
+ --muted: 210 40% 96%;
71
+ --muted-foreground: 215 16% 47%;
72
+ --border: 214 32% 91%;
73
+
74
+ /* Other */
75
+ --radius: 0.5rem;
76
+ --font-family: "Inter", sans-serif;
77
+ }
78
+
79
+ /* Dark mode */
80
+ .dark {
81
+ --background: 222 84% 5%;
82
+ --foreground: 210 40% 98%;
83
+ /* ... other variables */
84
+ }
85
+ ```
86
+
87
+ ### Option 2: Tailwind Preset (Advanced)
88
+
89
+ If your project uses Tailwind CSS, you can extend with our preset:
90
+
91
+ ```js
92
+ // tailwind.config.js
30
93
  module.exports = {
31
- content: [
32
- "./src/**/*.{js,ts,jsx,tsx}",
33
- "./node_modules/@phsa.tec/design-system-react/**/*.{js,ts,jsx,tsx}",
34
- ],
94
+ presets: [require("@phsa.tec/design-system-react/tailwind-preset")],
35
95
  theme: {
36
96
  extend: {
97
+ // Your customizations
37
98
  colors: {
38
- border: "hsl(var(--border))",
39
- background: "hsl(var(--background))",
40
- foreground: "hsl(var(--foreground))",
41
99
  primary: {
42
- DEFAULT: "hsl(var(--primary))",
43
- foreground: "hsl(var(--primary-foreground))",
44
- },
45
- secondary: {
46
- DEFAULT: "hsl(var(--secondary))",
47
- foreground: "hsl(var(--secondary-foreground))",
48
- },
49
- muted: {
50
- DEFAULT: "hsl(var(--muted))",
51
- foreground: "hsl(var(--muted-foreground))",
52
- },
53
- accent: {
54
- DEFAULT: "hsl(var(--accent))",
55
- foreground: "hsl(var(--accent-foreground))",
56
- },
57
- destructive: {
58
- DEFAULT: "hsl(var(--destructive))",
59
- foreground: "hsl(var(--destructive-foreground))",
60
- },
61
- success: {
62
- DEFAULT: "hsl(var(--success))",
63
- foreground: "hsl(var(--success-foreground))",
100
+ DEFAULT: "#your-color",
64
101
  },
65
102
  },
66
103
  },
67
104
  },
68
- plugins: [require("tailwindcss-animate")],
69
105
  };
70
106
  ```
71
107
 
72
- ### 3. Add CSS Variables
73
-
74
- Add these variables to your global CSS file:
75
-
76
- ```css
77
- @tailwind base;
78
- @tailwind components;
79
- @tailwind utilities;
80
-
81
- @layer base {
82
- :root {
83
- --background: 0 0% 100%;
84
- --foreground: 150 6% 25%;
85
- --primary: 145 63% 42%;
86
- --primary-foreground: 0 0% 98%;
87
- --secondary: 150 10% 96%;
88
- --secondary-foreground: 150 6% 25%;
89
- --muted: 150 10% 96%;
90
- --muted-foreground: 150 6% 45%;
91
- --accent: 150 10% 96%;
92
- --accent-foreground: 150 6% 25%;
93
- --destructive: 0 84.2% 60.2%;
94
- --destructive-foreground: 0 0% 98%;
95
- --success: 145 63% 42%;
96
- --success-foreground: 0 0% 98%;
97
- --border: 150 12% 88%;
98
- --input: 150 12% 88%;
99
- --ring: 145 63% 42%;
100
- --radius: 0.5rem;
101
- }
102
-
103
- .dark {
104
- --background: 150 15% 4%;
105
- --foreground: 150 10% 95%;
106
- --primary: 145 63% 48%;
107
- --primary-foreground: 150 15% 8%;
108
- --secondary: 150 12% 12%;
109
- --secondary-foreground: 150 10% 95%;
110
- --muted: 150 12% 12%;
111
- --muted-foreground: 150 8% 60%;
112
- --accent: 150 12% 12%;
113
- --accent-foreground: 150 10% 95%;
114
- --destructive: 0 62.8% 30.6%;
115
- --destructive-foreground: 0 0% 98%;
116
- --border: 150 12% 18%;
117
- --input: 150 12% 18%;
118
- --ring: 145 63% 48%;
119
- }
120
- }
108
+ ## Available CSS Variables
109
+
110
+ ### Colors
111
+
112
+ | Variable | Description |
113
+ |----------|-------------|
114
+ | `--primary` | Primary color |
115
+ | `--primary-foreground` | Text on primary color |
116
+ | `--secondary` | Secondary color |
117
+ | `--secondary-foreground` | Text on secondary color |
118
+ | `--destructive` | Error/danger color |
119
+ | `--success` | Success color |
120
+ | `--warning` | Warning color |
121
+ | `--muted` | Muted color |
122
+ | `--muted-foreground` | Muted text |
123
+ | `--background` | Page background |
124
+ | `--foreground` | Main text |
125
+ | `--border` | Border color |
126
+ | `--input` | Input color |
127
+ | `--ring` | Focus ring color |
128
+
129
+ ### Layout
130
+
131
+ | Variable | Description | Default |
132
+ |----------|-------------|---------|
133
+ | `--radius` | Base border radius | `0.5rem` |
134
+ | `--font-family` | Font family | `"Roboto"` |
135
+
136
+ ### Spacing
137
+
138
+ | Variable | Description |
139
+ |----------|-------------|
140
+ | `--spacing-xs` | Extra small |
141
+ | `--spacing-sm` | Small |
142
+ | `--spacing-md` | Medium |
143
+ | `--spacing-lg` | Large |
144
+ | `--spacing-xl` | Extra large |
145
+
146
+ ## Available Components
147
+
148
+ ### Layout
149
+ - `Card`, `CardHeader`, `CardContent`, `CardFooter`
150
+ - `Sheet`, `SheetContent`, `SheetHeader`
151
+ - `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`
152
+ - `Separator`
153
+
154
+ ### Forms
155
+ - `Button`
156
+ - `Input`
157
+ - `Select`, `SelectTrigger`, `SelectContent`, `SelectItem`
158
+ - `Checkbox`
159
+ - `Switch`
160
+ - `Label`
161
+
162
+ ### Data Display
163
+ - `DataTable`
164
+ - `Badge`
165
+ - `Avatar`
166
+
167
+ ### Feedback
168
+ - `Dialog`, `DialogContent`, `DialogHeader`
169
+ - `AlertDialog`
170
+ - `Toast`, `Toaster`
171
+ - `Alert`
172
+ - `Spinner`
173
+
174
+ ### Navigation
175
+ - `DropdownMenu`
176
+ - `Command`
177
+ - `Popover`
178
+
179
+ ## Dark Mode
180
+
181
+ Add the `dark` class to the root element:
182
+
183
+ ```tsx
184
+ // With next-themes
185
+ import { ThemeProvider } from "next-themes";
186
+ import { DesignSystemProvider } from "@phsa.tec/design-system-react";
121
187
 
122
- @layer base {
123
- * {
124
- @apply border-border;
125
- }
126
- body {
127
- @apply bg-background text-foreground;
128
- }
188
+ function App() {
189
+ return (
190
+ <ThemeProvider attribute="class" defaultTheme="system">
191
+ <DesignSystemProvider>
192
+ {/* Your app */}
193
+ </DesignSystemProvider>
194
+ </ThemeProvider>
195
+ );
129
196
  }
130
197
  ```
131
198
 
132
- ## 🎯 Usage
199
+ ## Compatibility
200
+
201
+ - Projects **without** Tailwind CSS
202
+ - Projects **with** Tailwind CSS (no conflicts)
203
+ - Next.js, Vite, Create React App
204
+ - React 18+
205
+
206
+ ## Package Exports
133
207
 
134
208
  ```typescript
135
- import {
136
- Button,
137
- Input,
138
- Card,
139
- CardContent,
140
- CardHeader,
141
- CardTitle,
142
- } from "@phsa.tec/design-system-react";
209
+ // Components
210
+ import { Button, Card } from "@phsa.tec/design-system-react";
143
211
 
144
- function App() {
145
- return (
146
- <Card>
147
- <CardHeader>
148
- <CardTitle>Hello World</CardTitle>
149
- </CardHeader>
150
- <CardContent>
151
- <div className="space-y-4">
152
- <Input placeholder="Enter text..." />
153
- <Button>Click me</Button>
154
- </div>
155
- </CardContent>
156
- </Card>
157
- );
158
- }
212
+ // CSS (required)
213
+ import "@phsa.tec/design-system-react/styles.css";
214
+
215
+ // Tailwind Preset (optional)
216
+ // In tailwind.config.js:
217
+ // presets: [require("@phsa.tec/design-system-react/tailwind-preset")]
159
218
  ```
160
219
 
161
- ## 🧩 Available Components
220
+ ## Development
162
221
 
163
- - **Layout**: Card, Sheet, Tabs, Separator
164
- - **Forms**: Input, Button, Select, Checkbox, Switch, Form
165
- - **Data**: DataTable, Badge, Avatar
166
- - **Feedback**: Dialog, AlertDialog, Toast, Alert
167
- - **Navigation**: DropdownMenu, Command
222
+ ```bash
223
+ # Install dependencies
224
+ yarn install
168
225
 
169
- ## 🌙 Dark Mode (Optional)
226
+ # Storybook
227
+ yarn storybook
170
228
 
171
- For theme switching support:
229
+ # Build library
230
+ yarn build:lib
172
231
 
173
- ```bash
174
- npm install next-themes
232
+ # Watch mode
233
+ yarn build:lib:watch
234
+
235
+ # Tests
236
+ yarn test
175
237
  ```
176
238
 
177
- ```typescript
178
- import { ThemeProvider } from "next-themes";
239
+ ## License
179
240
 
180
- function App() {
181
- return (
182
- <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
183
- {/* Your app */}
184
- </ThemeProvider>
185
- );
186
- }
187
- ```
241
+ MIT
242
+
243
+ ---
244
+
245
+ Built by the PHSA team