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

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.
Files changed (2) hide show
  1. package/README.md +87 -375
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,54 +1,35 @@
1
- # �� PHSA Design System React
1
+ # 🎨 PHSA Design System React
2
2
 
3
- A comprehensive React design system built with modern tools and best practices, featuring reusable components, consistent styling, and powerful layout solutions.
3
+ A modern React component library built with TypeScript, Tailwind CSS, and Radix UI.
4
4
 
5
- ## 📚 Live Documentation
5
+ ## 📚 Documentation
6
6
 
7
7
  🌐 **[View Live Documentation](https://henriques4nti4go.github.io/phsa-design-system/)**
8
8
 
9
- Explore all components interactively in our Storybook documentation.
10
-
11
- ## ✨ Features
12
-
13
- - 🧩 **50+ Modular Components** - Complete component library with TypeScript
14
- - 🎨 **Tailwind CSS Ready** - Pre-styled components with customizable themes
15
- - 🔧 **Form Management** - Integrated with React Hook Form + Zod validation
16
- - 📊 **Advanced Data Tables** - Built with TanStack Table
17
- - 🌙 **Dark/Light Theme** - Built-in theme switching
18
- - 🔍 **Full TypeScript Support** - Complete type safety
19
- - 📱 **Responsive & Accessible** - Mobile-first and WCAG compliant
20
-
21
9
  ## 🚀 Installation
22
10
 
23
11
  ```bash
24
12
  npm install @phsa.tec/design-system-react
25
13
  ```
26
14
 
27
- ### Required Peer Dependencies
28
-
29
- Install the required peer dependencies in your project:
15
+ ## ⚙️ Setup
30
16
 
31
- ```bash
32
- npm install react react-dom @radix-ui/react-alert-dialog @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-collapsible @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-icons @radix-ui/react-label @radix-ui/react-popover @radix-ui/react-select @radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-toast @radix-ui/react-tooltip class-variance-authority clsx lucide-react tailwind-merge
33
- ```
17
+ ### 1. Import Styles
34
18
 
35
- Or use yarn:
19
+ Add this import to your main CSS file or app entry point:
36
20
 
37
- ```bash
38
- yarn add react react-dom @radix-ui/react-alert-dialog @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-collapsible @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-icons @radix-ui/react-label @radix-ui/react-popover @radix-ui/react-select @radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-toast @radix-ui/react-tooltip class-variance-authority clsx lucide-react tailwind-merge
21
+ ```typescript
22
+ import "@phsa.tec/design-system-react/styles";
39
23
  ```
40
24
 
41
- ## ⚙️ Setup
42
-
43
- ### 1. Configure Tailwind CSS
25
+ ### 2. Configure Tailwind CSS
44
26
 
45
- Add to your `tailwind.config.js`:
27
+ Update your `tailwind.config.js`:
46
28
 
47
29
  ```javascript
48
- /** @type {import('tailwindcss').Config} */
49
30
  module.exports = {
50
31
  content: [
51
- "./src/**/*.{js,ts,jsx,tsx,mdx}",
32
+ "./src/**/*.{js,ts,jsx,tsx}",
52
33
  "./node_modules/@phsa.tec/design-system-react/**/*.{js,ts,jsx,tsx}",
53
34
  ],
54
35
  theme: {
@@ -65,17 +46,32 @@ module.exports = {
65
46
  DEFAULT: "hsl(var(--secondary))",
66
47
  foreground: "hsl(var(--secondary-foreground))",
67
48
  },
68
- // Add more theme colors as needed
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))",
64
+ },
69
65
  },
70
66
  },
71
67
  },
72
- plugins: [],
68
+ plugins: [require("tailwindcss-animate")],
73
69
  };
74
70
  ```
75
71
 
76
- ### 2. Add CSS Variables
72
+ ### 3. Add CSS Variables
77
73
 
78
- Add these CSS variables to your global CSS file (`globals.css` or `index.css`):
74
+ Add these variables to your global CSS file:
79
75
 
80
76
  ```css
81
77
  @tailwind base;
@@ -85,96 +81,76 @@ Add these CSS variables to your global CSS file (`globals.css` or `index.css`):
85
81
  @layer base {
86
82
  :root {
87
83
  --background: 0 0% 100%;
88
- --foreground: 222.2 84% 4.9%;
89
- --card: 0 0% 100%;
90
- --card-foreground: 222.2 84% 4.9%;
91
- --popover: 0 0% 100%;
92
- --popover-foreground: 222.2 84% 4.9%;
93
- --primary: 222.2 47.4% 11.2%;
94
- --primary-foreground: 210 40% 98%;
95
- --secondary: 210 40% 96%;
96
- --secondary-foreground: 222.2 84% 4.9%;
97
- --muted: 210 40% 96%;
98
- --muted-foreground: 215.4 16.3% 46.9%;
99
- --accent: 210 40% 96%;
100
- --accent-foreground: 222.2 84% 4.9%;
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%;
101
93
  --destructive: 0 84.2% 60.2%;
102
- --destructive-foreground: 210 40% 98%;
103
- --border: 214.3 31.8% 91.4%;
104
- --input: 214.3 31.8% 91.4%;
105
- --ring: 222.2 84% 4.9%;
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%;
106
100
  --radius: 0.5rem;
107
101
  }
108
102
 
109
103
  .dark {
110
- --background: 222.2 84% 4.9%;
111
- --foreground: 210 40% 98%;
112
- --card: 222.2 84% 4.9%;
113
- --card-foreground: 210 40% 98%;
114
- --popover: 222.2 84% 4.9%;
115
- --popover-foreground: 210 40% 98%;
116
- --primary: 210 40% 98%;
117
- --primary-foreground: 222.2 47.4% 11.2%;
118
- --secondary: 217.2 32.6% 17.5%;
119
- --secondary-foreground: 210 40% 98%;
120
- --muted: 217.2 32.6% 17.5%;
121
- --muted-foreground: 215 20.2% 65.1%;
122
- --accent: 217.2 32.6% 17.5%;
123
- --accent-foreground: 210 40% 98%;
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%;
124
114
  --destructive: 0 62.8% 30.6%;
125
- --destructive-foreground: 210 40% 98%;
126
- --border: 217.2 32.6% 17.5%;
127
- --input: 217.2 32.6% 17.5%;
128
- --ring: 212.7 26.8% 83.9%;
115
+ --destructive-foreground: 0 0% 98%;
116
+ --border: 150 12% 18%;
117
+ --input: 150 12% 18%;
118
+ --ring: 145 63% 48%;
129
119
  }
130
120
  }
131
- ```
132
-
133
- ### 3. Theme Provider (Optional)
134
121
 
135
- For dark/light mode support, wrap your app with the theme provider:
136
-
137
- ```tsx
138
- import { ThemeProvider } from "next-themes";
139
-
140
- function App() {
141
- return (
142
- <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
143
- {/* Your app components */}
144
- </ThemeProvider>
145
- );
122
+ @layer base {
123
+ * {
124
+ @apply border-border;
125
+ }
126
+ body {
127
+ @apply bg-background text-foreground;
128
+ }
146
129
  }
147
130
  ```
148
131
 
149
- ## 🎯 Usage Examples
132
+ ## 🎯 Usage
150
133
 
151
- ### Basic Components
152
-
153
- ```tsx
134
+ ```typescript
154
135
  import {
155
136
  Button,
156
137
  Input,
157
- Badge,
158
138
  Card,
159
139
  CardContent,
160
140
  CardHeader,
161
141
  CardTitle,
162
142
  } from "@phsa.tec/design-system-react";
163
143
 
164
- function MyComponent() {
144
+ function App() {
165
145
  return (
166
146
  <Card>
167
147
  <CardHeader>
168
- <CardTitle>Welcome</CardTitle>
148
+ <CardTitle>Hello World</CardTitle>
169
149
  </CardHeader>
170
150
  <CardContent>
171
151
  <div className="space-y-4">
172
- <Input placeholder="Enter your name" />
173
- <div className="flex gap-2">
174
- <Button>Primary Action</Button>
175
- <Button variant="secondary">Secondary</Button>
176
- </div>
177
- <Badge>New Feature</Badge>
152
+ <Input placeholder="Enter text..." />
153
+ <Button>Click me</Button>
178
154
  </div>
179
155
  </CardContent>
180
156
  </Card>
@@ -182,294 +158,30 @@ function MyComponent() {
182
158
  }
183
159
  ```
184
160
 
185
- ### Form Example with Validation
186
-
187
- ```tsx
188
- import {
189
- Form,
190
- FormControl,
191
- FormField,
192
- FormItem,
193
- FormLabel,
194
- FormMessage,
195
- Input,
196
- Button,
197
- Select,
198
- SelectContent,
199
- SelectItem,
200
- SelectTrigger,
201
- SelectValue,
202
- } from "@phsa.tec/design-system-react";
203
- import { useForm } from "react-hook-form";
204
- import { zodResolver } from "@hookform/resolvers/zod";
205
- import * as z from "zod";
206
-
207
- const formSchema = z.object({
208
- name: z.string().min(2, "Name must be at least 2 characters"),
209
- email: z.string().email("Invalid email address"),
210
- role: z.string().min(1, "Please select a role"),
211
- });
212
-
213
- function UserForm() {
214
- const form = useForm<z.infer<typeof formSchema>>({
215
- resolver: zodResolver(formSchema),
216
- defaultValues: {
217
- name: "",
218
- email: "",
219
- role: "",
220
- },
221
- });
222
-
223
- function onSubmit(values: z.infer<typeof formSchema>) {
224
- console.log(values);
225
- }
226
-
227
- return (
228
- <Form {...form}>
229
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
230
- <FormField
231
- control={form.control}
232
- name="name"
233
- render={({ field }) => (
234
- <FormItem>
235
- <FormLabel>Name</FormLabel>
236
- <FormControl>
237
- <Input placeholder="John Doe" {...field} />
238
- </FormControl>
239
- <FormMessage />
240
- </FormItem>
241
- )}
242
- />
243
-
244
- <FormField
245
- control={form.control}
246
- name="email"
247
- render={({ field }) => (
248
- <FormItem>
249
- <FormLabel>Email</FormLabel>
250
- <FormControl>
251
- <Input placeholder="john@example.com" {...field} />
252
- </FormControl>
253
- <FormMessage />
254
- </FormItem>
255
- )}
256
- />
257
-
258
- <FormField
259
- control={form.control}
260
- name="role"
261
- render={({ field }) => (
262
- <FormItem>
263
- <FormLabel>Role</FormLabel>
264
- <Select onValueChange={field.onChange} defaultValue={field.value}>
265
- <FormControl>
266
- <SelectTrigger>
267
- <SelectValue placeholder="Select a role" />
268
- </SelectTrigger>
269
- </FormControl>
270
- <SelectContent>
271
- <SelectItem value="admin">Admin</SelectItem>
272
- <SelectItem value="user">User</SelectItem>
273
- <SelectItem value="viewer">Viewer</SelectItem>
274
- </SelectContent>
275
- </Select>
276
- <FormMessage />
277
- </FormItem>
278
- )}
279
- />
280
-
281
- <Button type="submit">Submit</Button>
282
- </form>
283
- </Form>
284
- );
285
- }
286
- ```
287
-
288
- ### Data Table Example
289
-
290
- ```tsx
291
- import { DataTable } from "@phsa.tec/design-system-react";
292
- import { ColumnDef } from "@tanstack/react-table";
293
-
294
- type User = {
295
- id: string;
296
- name: string;
297
- email: string;
298
- role: string;
299
- };
300
-
301
- const columns: ColumnDef<User>[] = [
302
- {
303
- accessorKey: "name",
304
- header: "Name",
305
- },
306
- {
307
- accessorKey: "email",
308
- header: "Email",
309
- },
310
- {
311
- accessorKey: "role",
312
- header: "Role",
313
- },
314
- ];
315
-
316
- function UsersTable() {
317
- const data: User[] = [
318
- { id: "1", name: "John Doe", email: "john@example.com", role: "Admin" },
319
- { id: "2", name: "Jane Smith", email: "jane@example.com", role: "User" },
320
- ];
321
-
322
- return (
323
- <DataTable
324
- columns={columns}
325
- data={data}
326
- searchKey="name"
327
- searchPlaceholder="Search users..."
328
- />
329
- );
330
- }
331
- ```
332
-
333
- ### Dialog/Modal Example
334
-
335
- ```tsx
336
- import {
337
- Dialog,
338
- DialogContent,
339
- DialogDescription,
340
- DialogHeader,
341
- DialogTitle,
342
- DialogTrigger,
343
- Button,
344
- } from "@phsa.tec/design-system-react";
345
-
346
- function MyDialog() {
347
- return (
348
- <Dialog>
349
- <DialogTrigger asChild>
350
- <Button>Open Dialog</Button>
351
- </DialogTrigger>
352
- <DialogContent>
353
- <DialogHeader>
354
- <DialogTitle>Confirm Action</DialogTitle>
355
- <DialogDescription>
356
- This action cannot be undone. Are you sure you want to continue?
357
- </DialogDescription>
358
- </DialogHeader>
359
- <div className="flex justify-end space-x-2">
360
- <Button variant="outline">Cancel</Button>
361
- <Button>Confirm</Button>
362
- </div>
363
- </DialogContent>
364
- </Dialog>
365
- );
366
- }
367
- ```
368
-
369
161
  ## 🧩 Available Components
370
162
 
371
- ### Layout
372
-
373
- - `Card`, `CardContent`, `CardHeader`, `CardTitle`, `CardDescription`
374
- - `Sheet`, `SheetContent`, `SheetHeader`, `SheetTitle`
375
- - `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`
376
- - `Separator`
377
-
378
- ### Data Display
379
-
380
- - `DataTable` - Advanced table with sorting, filtering, pagination
381
- - `Badge` - Status indicators
382
- - `Avatar`, `AvatarImage`, `AvatarFallback`
383
- - `Tooltip`, `TooltipContent`, `TooltipProvider`, `TooltipTrigger`
384
-
385
- ### Data Input
386
-
387
- - `Input` - Text input with validation
388
- - `Button` - Customizable button component
389
- - `Select`, `SelectContent`, `SelectItem`, `SelectTrigger`, `SelectValue`
390
- - `Checkbox` - Checkbox input
391
- - `Switch` - Toggle switch
392
- - `Form`, `FormControl`, `FormField`, `FormItem`, `FormLabel`, `FormMessage`
393
-
394
- ### Feedback
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
395
168
 
396
- - `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`, `DialogTrigger`
397
- - `AlertDialog`, `AlertDialogAction`, `AlertDialogCancel`
398
- - `Toast` - Notification system
399
- - `Alert`, `AlertDescription`, `AlertTitle`
169
+ ## 🌙 Dark Mode (Optional)
400
170
 
401
- ### Navigation
171
+ For theme switching support:
402
172
 
403
- - `DropdownMenu`, `DropdownMenuContent`, `DropdownMenuItem`
404
- - `Command`, `CommandDialog`, `CommandInput`, `CommandList`
405
-
406
- ## 🎨 Customization
407
-
408
- ### Component Variants
409
-
410
- Most components support multiple variants:
411
-
412
- ```tsx
413
- // Button variants
414
- <Button variant="default">Default</Button>
415
- <Button variant="destructive">Delete</Button>
416
- <Button variant="outline">Outline</Button>
417
- <Button variant="secondary">Secondary</Button>
418
- <Button variant="ghost">Ghost</Button>
419
- <Button variant="link">Link</Button>
420
-
421
- // Button sizes
422
- <Button size="sm">Small</Button>
423
- <Button size="default">Default</Button>
424
- <Button size="lg">Large</Button>
425
- ```
426
-
427
- ### Custom Styling
428
-
429
- Components accept custom className props:
430
-
431
- ```tsx
432
- <Button className="bg-purple-500 hover:bg-purple-600">
433
- Custom Purple Button
434
- </Button>
173
+ ```bash
174
+ npm install next-themes
435
175
  ```
436
176
 
437
- ## 🔧 TypeScript Support
438
-
439
- All components are fully typed with TypeScript:
440
-
441
- ```tsx
442
- import type { ButtonProps } from "@phsa.tec/design-system-react";
443
-
444
- interface CustomButtonProps extends ButtonProps {
445
- isLoading?: boolean;
446
- }
177
+ ```typescript
178
+ import { ThemeProvider } from "next-themes";
447
179
 
448
- function CustomButton({ isLoading, children, ...props }: CustomButtonProps) {
180
+ function App() {
449
181
  return (
450
- <Button disabled={isLoading} {...props}>
451
- {isLoading ? "Loading..." : children}
452
- </Button>
182
+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
183
+ {/* Your app */}
184
+ </ThemeProvider>
453
185
  );
454
186
  }
455
187
  ```
456
-
457
- ## 📚 Documentation & Storybook
458
-
459
- - **Live Documentation**: [https://henriques4nti4go.github.io/phsa-design-system/](https://henriques4nti4go.github.io/phsa-design-system/)
460
- - **Interactive Examples**: All components include interactive Storybook stories
461
- - **Props Documentation**: Complete API reference for all components
462
-
463
- ## 🤝 Support & Contributing
464
-
465
- - **Issues**: [GitHub Issues](https://github.com/henriques4nti4go/phsa-design-system/issues)
466
- - **Repository**: [GitHub](https://github.com/henriques4nti4go/phsa-design-system)
467
- - **NPM Package**: [@phsa.tec/design-system-react](https://www.npmjs.com/package/@phsa.tec/design-system-react)
468
-
469
- ## 📄 License
470
-
471
- MIT License - see the [LICENSE](LICENSE) file for details.
472
-
473
- ---
474
-
475
- Built with ❤️ using React, TypeScript, Tailwind CSS, and Radix UI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phsa.tec/design-system-react",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",