@phsa.tec/design-system-react 0.1.0 โ 0.1.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 +265 -19
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,36 +1,282 @@
|
|
|
1
|
-
|
|
1
|
+
# ๐จ PHSA Design System
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive React design system built with modern tools and best practices, featuring reusable components, consistent styling, and powerful layout solutions.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## โจ Features
|
|
6
|
+
|
|
7
|
+
- ๐งฉ **Modular Components** - Reusable React components built with TypeScript
|
|
8
|
+
- ๐ญ **Storybook Integration** - Interactive component documentation and testing
|
|
9
|
+
- ๐จ **Tailwind CSS** - Utility-first CSS framework for rapid styling
|
|
10
|
+
- ๐ง **Form Management** - Integrated with React Hook Form for robust form handling
|
|
11
|
+
- ๐ **Data Tables** - Advanced table components with TanStack Table
|
|
12
|
+
- ๐ **Theme Support** - Dark/light mode with next-themes
|
|
13
|
+
- ๐ **Type Safety** - Full TypeScript support
|
|
14
|
+
- ๐งช **Testing Ready** - Jest and Testing Library setup
|
|
15
|
+
- ๐ฑ **Responsive Design** - Mobile-first approach
|
|
16
|
+
|
|
17
|
+
## ๐ ๏ธ Tech Stack
|
|
18
|
+
|
|
19
|
+
- **Framework**: Next.js 15
|
|
20
|
+
- **UI Library**: Radix UI primitives
|
|
21
|
+
- **Styling**: Tailwind CSS
|
|
22
|
+
- **State Management**: Zustand
|
|
23
|
+
- **Forms**: React Hook Form + Zod validation
|
|
24
|
+
- **Data Fetching**: TanStack Query
|
|
25
|
+
- **Icons**: Lucide React
|
|
26
|
+
- **Documentation**: Storybook
|
|
27
|
+
- **Testing**: Jest + Testing Library
|
|
28
|
+
- **Language**: TypeScript
|
|
29
|
+
|
|
30
|
+
## ๐ Getting Started
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
|
|
34
|
+
Make sure you have Node.js installed on your machine (version 18 or higher recommended).
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
|
|
38
|
+
#### Option 1: Install from npm (Recommended)
|
|
39
|
+
|
|
40
|
+
Install the published package directly from npm:
|
|
6
41
|
|
|
7
42
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
# or
|
|
10
|
-
yarn dev
|
|
43
|
+
npm install @phsa.tec/design-system-react
|
|
11
44
|
# or
|
|
12
|
-
|
|
45
|
+
yarn add @phsa.tec/design-system-react
|
|
13
46
|
# or
|
|
14
|
-
|
|
47
|
+
pnpm add @phsa.tec/design-system-react
|
|
15
48
|
```
|
|
16
49
|
|
|
17
|
-
|
|
50
|
+
View the package on npm: [https://www.npmjs.com/package/@phsa.tec/design-system-react](https://www.npmjs.com/package/@phsa.tec/design-system-react)
|
|
18
51
|
|
|
19
|
-
|
|
52
|
+
#### Option 2: Development Setup
|
|
53
|
+
|
|
54
|
+
For contributing or local development:
|
|
55
|
+
|
|
56
|
+
1. **Clone the repository**
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone <repository-url>
|
|
60
|
+
cd phsa-design-system
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
2. **Install dependencies**
|
|
64
|
+
```bash
|
|
65
|
+
npm install
|
|
66
|
+
# or
|
|
67
|
+
yarn install
|
|
68
|
+
# or
|
|
69
|
+
pnpm install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### ๐ Running the Project
|
|
73
|
+
|
|
74
|
+
#### Development Server
|
|
75
|
+
|
|
76
|
+
Start the Next.js development server:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run dev
|
|
80
|
+
```
|
|
20
81
|
|
|
21
|
-
|
|
82
|
+
Open [http://localhost:3000](http://localhost:3000) to view the application.
|
|
22
83
|
|
|
23
|
-
|
|
84
|
+
#### Storybook
|
|
85
|
+
|
|
86
|
+
Launch Storybook for component development and documentation:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run storybook
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Open [http://localhost:6006](http://localhost:6006) to view the component library.
|
|
93
|
+
|
|
94
|
+
#### Build for Production
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run build
|
|
98
|
+
npm run start
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Testing
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm run test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Linting
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm run lint
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## ๐ Project Structure
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
src/
|
|
117
|
+
โโโ components/ # Reusable components
|
|
118
|
+
โ โโโ ui/ # Base UI components
|
|
119
|
+
โ โโโ layout/ # Layout components (Crud, etc.)
|
|
120
|
+
โ โโโ dataInput/ # Form input components
|
|
121
|
+
โโโ hooks/ # Custom React hooks
|
|
122
|
+
โโโ lib/ # Utility functions
|
|
123
|
+
โโโ styles/ # Global styles
|
|
124
|
+
โโโ types/ # TypeScript type definitions
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This README provides a comprehensive overview of your design system project, including:
|
|
128
|
+
|
|
129
|
+
1. **Clear project description** with emoji icons for visual appeal
|
|
130
|
+
2. **Feature highlights** showcasing the main capabilities
|
|
131
|
+
3. **Complete tech stack** listing all major dependencies
|
|
132
|
+
4. **Step-by-step setup instructions** for new developers
|
|
133
|
+
5. **Project structure** to help navigate the codebase
|
|
134
|
+
6. **Component documentation** explaining key features
|
|
135
|
+
7. **Theming and configuration** guides
|
|
136
|
+
8. **Contributing guidelines** for team collaboration
|
|
137
|
+
9. **Scripts reference** for quick command lookup
|
|
138
|
+
10. **Professional formatting** with proper sections and styling
|
|
139
|
+
|
|
140
|
+
The README is written in English as requested and provides everything a developer would need to understand, set up, and contribute to your design system project.
|
|
141
|
+
|
|
142
|
+
## ๐งฉ Key Components
|
|
143
|
+
|
|
144
|
+
### Layout Components
|
|
145
|
+
|
|
146
|
+
- **CrudLayout** - Complete CRUD operations layout with forms, tables, and modals
|
|
147
|
+
- **DataTable** - Advanced table component with sorting, filtering, and pagination
|
|
148
|
+
|
|
149
|
+
### Form Components
|
|
150
|
+
|
|
151
|
+
- **Input** - Flexible input component with validation
|
|
152
|
+
- **Button** - Customizable button with variants
|
|
153
|
+
- **Select** - Dropdown selection component
|
|
154
|
+
- **Form controls** - Checkbox, Switch, and more
|
|
155
|
+
|
|
156
|
+
### UI Components
|
|
157
|
+
|
|
158
|
+
- **Dialog/Modal** - Accessible modal components
|
|
159
|
+
- **Toast** - Notification system
|
|
160
|
+
- **Avatar** - User avatar component
|
|
161
|
+
- **Tooltip** - Contextual help tooltips
|
|
162
|
+
|
|
163
|
+
## ๐ Documentation
|
|
164
|
+
|
|
165
|
+
Visit our Storybook documentation to explore all available components:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npm run storybook
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Each component includes:
|
|
172
|
+
|
|
173
|
+
- ๐ **Usage examples**
|
|
174
|
+
- โ๏ธ **Props documentation**
|
|
175
|
+
- ๐ฎ **Interactive controls**
|
|
176
|
+
- ๐ก **Best practices**
|
|
177
|
+
|
|
178
|
+
## ๐จ Theming
|
|
179
|
+
|
|
180
|
+
The design system supports customizable themes through Tailwind CSS and next-themes:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { ThemeProvider } from "next-themes";
|
|
184
|
+
|
|
185
|
+
function App() {
|
|
186
|
+
return (
|
|
187
|
+
<ThemeProvider attribute="class" defaultTheme="system">
|
|
188
|
+
{/* Your app */}
|
|
189
|
+
</ThemeProvider>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## ๐ง Configuration
|
|
195
|
+
|
|
196
|
+
### Tailwind CSS
|
|
197
|
+
|
|
198
|
+
Customize the design tokens in `tailwind.config.js`:
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
module.exports = {
|
|
202
|
+
theme: {
|
|
203
|
+
extend: {
|
|
204
|
+
colors: {
|
|
205
|
+
// Your custom colors
|
|
206
|
+
},
|
|
207
|
+
spacing: {
|
|
208
|
+
// Your custom spacing
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Component Variants
|
|
216
|
+
|
|
217
|
+
Components use `class-variance-authority` for consistent variant management:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
const buttonVariants = cva(
|
|
221
|
+
"inline-flex items-center justify-center rounded-md",
|
|
222
|
+
{
|
|
223
|
+
variants: {
|
|
224
|
+
variant: {
|
|
225
|
+
default: "bg-primary text-primary-foreground",
|
|
226
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## ๐ค Contributing
|
|
234
|
+
|
|
235
|
+
1. Fork the repository
|
|
236
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
237
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
238
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
239
|
+
5. Open a Pull Request
|
|
240
|
+
|
|
241
|
+
### Development Guidelines
|
|
242
|
+
|
|
243
|
+
- Follow TypeScript best practices
|
|
244
|
+
- Add Storybook stories for new components
|
|
245
|
+
- Include tests for complex logic
|
|
246
|
+
- Follow the existing code style
|
|
247
|
+
- Update documentation as needed
|
|
248
|
+
|
|
249
|
+
## ๐ Scripts Reference
|
|
250
|
+
|
|
251
|
+
| Command | Description |
|
|
252
|
+
| ------------------------- | ------------------------ |
|
|
253
|
+
| `npm run dev` | Start development server |
|
|
254
|
+
| `npm run build` | Build for production |
|
|
255
|
+
| `npm run start` | Start production server |
|
|
256
|
+
| `npm run lint` | Run ESLint |
|
|
257
|
+
| `npm run storybook` | Start Storybook |
|
|
258
|
+
| `npm run build-storybook` | Build Storybook |
|
|
259
|
+
| `npm run test` | Run tests |
|
|
260
|
+
|
|
261
|
+
## ๐ฆ Publishing
|
|
262
|
+
|
|
263
|
+
This package is configured for publishing to npm:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm publish
|
|
267
|
+
```
|
|
24
268
|
|
|
25
|
-
|
|
269
|
+
## ๐ License
|
|
26
270
|
|
|
27
|
-
|
|
28
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
271
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
29
272
|
|
|
30
|
-
|
|
273
|
+
## ๐ Acknowledgments
|
|
31
274
|
|
|
32
|
-
|
|
275
|
+
- [Radix UI](https://radix-ui.com/) for accessible component primitives
|
|
276
|
+
- [Tailwind CSS](https://tailwindcss.com/) for the utility-first CSS framework
|
|
277
|
+
- [Shadcn/ui](https://ui.shadcn.com/) for component inspiration
|
|
278
|
+
- [Storybook](https://storybook.js.org/) for component documentation
|
|
33
279
|
|
|
34
|
-
|
|
280
|
+
---
|
|
35
281
|
|
|
36
|
-
|
|
282
|
+
Built with โค๏ธ by the PHSA team
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phsa.tec/design-system-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -84,5 +84,13 @@
|
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
|
+
},
|
|
88
|
+
"repository": {
|
|
89
|
+
"type": "git",
|
|
90
|
+
"url": "https://github.com/henriques4nti4go/phsa-design-system"
|
|
91
|
+
},
|
|
92
|
+
"homepage": "https://github.com/henriques4nti4go/phsa-design-system#readme",
|
|
93
|
+
"bugs": {
|
|
94
|
+
"url": "https://github.com/henriques4nti4go/phsa-design-system/issues"
|
|
87
95
|
}
|
|
88
96
|
}
|