@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 +201 -143
- package/dist/index.d.mts +84 -35
- package/dist/index.d.ts +84 -35
- package/dist/index.js +581 -468
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +575 -470
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -2534
- package/dist/tailwind-preset.d.mts +21 -0
- package/dist/tailwind-preset.d.ts +21 -0
- package/dist/tailwind-preset.js +101 -0
- package/dist/tailwind-preset.js.map +1 -0
- package/dist/tailwind-preset.mjs +81 -0
- package/dist/tailwind-preset.mjs.map +1 -0
- package/package.json +15 -6
- package/dist/styles.css.map +0 -1
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,187 +1,245 @@
|
|
|
1
|
-
#
|
|
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
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
##
|
|
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
|
-
##
|
|
27
|
+
## Basic Usage
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
```tsx
|
|
30
|
+
// 1. Import CSS (required)
|
|
31
|
+
import "@phsa.tec/design-system-react/styles.css";
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
// 2. Import components
|
|
34
|
+
import { DesignSystemProvider, Button, Card } from "@phsa.tec/design-system-react";
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
47
|
+
## Customization
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
### Option 1: CSS Variables (Recommended)
|
|
28
50
|
|
|
29
|
-
|
|
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
|
-
|
|
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: "
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
##
|
|
220
|
+
## Development
|
|
162
221
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- **Feedback**: Dialog, AlertDialog, Toast, Alert
|
|
167
|
-
- **Navigation**: DropdownMenu, Command
|
|
222
|
+
```bash
|
|
223
|
+
# Install dependencies
|
|
224
|
+
yarn install
|
|
168
225
|
|
|
169
|
-
|
|
226
|
+
# Storybook
|
|
227
|
+
yarn storybook
|
|
170
228
|
|
|
171
|
-
|
|
229
|
+
# Build library
|
|
230
|
+
yarn build:lib
|
|
172
231
|
|
|
173
|
-
|
|
174
|
-
|
|
232
|
+
# Watch mode
|
|
233
|
+
yarn build:lib:watch
|
|
234
|
+
|
|
235
|
+
# Tests
|
|
236
|
+
yarn test
|
|
175
237
|
```
|
|
176
238
|
|
|
177
|
-
|
|
178
|
-
import { ThemeProvider } from "next-themes";
|
|
239
|
+
## License
|
|
179
240
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
```
|
|
241
|
+
MIT
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
Built by the PHSA team
|