@abhir9/pd-design-system 0.1.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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/index.cjs +1399 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1071 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1477 -0
- package/dist/index.d.ts +1477 -0
- package/dist/index.js +1331 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +38 -0
- package/package.json +140 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-01-XX
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of @pd-design/system
|
|
13
|
+
- Token system (base and semantic tokens)
|
|
14
|
+
- Theme system with CSS variables
|
|
15
|
+
- Headless primitives layer
|
|
16
|
+
- Adapter layer (shadcn support)
|
|
17
|
+
- Public components:
|
|
18
|
+
- Button
|
|
19
|
+
- Input
|
|
20
|
+
- Select
|
|
21
|
+
- Checkbox
|
|
22
|
+
- Radio
|
|
23
|
+
- Switch
|
|
24
|
+
- Modal
|
|
25
|
+
- Tooltip
|
|
26
|
+
- Dropdown
|
|
27
|
+
- Toast
|
|
28
|
+
- Storybook integration
|
|
29
|
+
- Full TypeScript support
|
|
30
|
+
- Light/Dark mode support
|
|
31
|
+
- Theme provider
|
|
32
|
+
- Configuration API
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
- Props-only API (no className required)
|
|
37
|
+
- Full TypeScript autocomplete
|
|
38
|
+
- Variant system (variant, intent, size, state)
|
|
39
|
+
- Adapter switching without app changes
|
|
40
|
+
- Semantic versioning
|
|
41
|
+
- Tree-shakable build
|
|
42
|
+
- ESM + CJS output
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PD Design System
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# @pd-design/system
|
|
2
|
+
|
|
3
|
+
Production-grade design system with adapter layer support. Built for teams who need a flexible, type-safe component library that can work with different UI engines without changing application code.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
This design system follows a **headless-first, adapter-based architecture**:
|
|
8
|
+
|
|
9
|
+
- **Props-only API**: Consumers use only props and variants, no className required
|
|
10
|
+
- **Full TypeScript**: Complete autocomplete and type safety
|
|
11
|
+
- **Adapter Layer**: Switch between UI engines (shadcn, Material, etc.) without app changes
|
|
12
|
+
- **Semantic Tokens**: Intent-based design tokens that work across themes
|
|
13
|
+
- **Framework Agnostic**: Design tokens and semantics are framework-agnostic
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @pd-design/system
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { ThemeProvider, Button, Input } from '@pd-design/system';
|
|
25
|
+
import '@pd-design/system/styles';
|
|
26
|
+
|
|
27
|
+
function App() {
|
|
28
|
+
return (
|
|
29
|
+
<ThemeProvider adapter="shadcn" theme="base" mode="light">
|
|
30
|
+
<Button variant="primary" intent="danger" size="md">
|
|
31
|
+
Delete
|
|
32
|
+
</Button>
|
|
33
|
+
<Input placeholder="Enter text..." size="md" />
|
|
34
|
+
</ThemeProvider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
Configure the design system globally:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { setDesignSystemConfig } from '@pd-design/system';
|
|
45
|
+
|
|
46
|
+
// Set adapter (shadcn or material)
|
|
47
|
+
setDesignSystemConfig({
|
|
48
|
+
adapter: 'shadcn',
|
|
49
|
+
theme: 'base',
|
|
50
|
+
mode: 'light',
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or use the `ThemeProvider`:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<ThemeProvider adapter="shadcn" theme="base" mode="light">
|
|
58
|
+
{/* Your app */}
|
|
59
|
+
</ThemeProvider>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Components
|
|
63
|
+
|
|
64
|
+
### Button
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Button
|
|
68
|
+
variant="primary" // primary | secondary | ghost | outline
|
|
69
|
+
intent="danger" // primary | success | warning | danger | neutral
|
|
70
|
+
size="md" // sm | md | lg
|
|
71
|
+
loading={false}
|
|
72
|
+
disabled={false}
|
|
73
|
+
>
|
|
74
|
+
Click me
|
|
75
|
+
</Button>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Input
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Input
|
|
82
|
+
size="md" // sm | md | lg
|
|
83
|
+
error={false}
|
|
84
|
+
disabled={false}
|
|
85
|
+
placeholder="Enter text..."
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Select
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<Select placeholder="Choose an option..." size="md">
|
|
93
|
+
<SelectItem value="1">Option 1</SelectItem>
|
|
94
|
+
<SelectItem value="2">Option 2</SelectItem>
|
|
95
|
+
</Select>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Checkbox
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<Checkbox
|
|
102
|
+
checked={isChecked}
|
|
103
|
+
onCheckedChange={setIsChecked}
|
|
104
|
+
size="md"
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Radio
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<RadioGroup value={value} onValueChange={setValue}>
|
|
112
|
+
<div className="flex items-center space-x-2">
|
|
113
|
+
<RadioItem value="option1" id="r1" />
|
|
114
|
+
<label htmlFor="r1">Option 1</label>
|
|
115
|
+
</div>
|
|
116
|
+
</RadioGroup>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Switch
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<Switch
|
|
123
|
+
checked={isOn}
|
|
124
|
+
onCheckedChange={setIsOn}
|
|
125
|
+
size="md"
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Modal
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<Modal open={open} onOpenChange={setOpen}>
|
|
133
|
+
<ModalTrigger asChild>
|
|
134
|
+
<Button>Open Modal</Button>
|
|
135
|
+
</ModalTrigger>
|
|
136
|
+
<ModalContent>
|
|
137
|
+
<ModalHeader>
|
|
138
|
+
<ModalTitle>Title</ModalTitle>
|
|
139
|
+
<ModalDescription>Description</ModalDescription>
|
|
140
|
+
</ModalHeader>
|
|
141
|
+
<ModalClose asChild>
|
|
142
|
+
<Button>Close</Button>
|
|
143
|
+
</ModalClose>
|
|
144
|
+
</ModalContent>
|
|
145
|
+
</Modal>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Tooltip
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<Tooltip content="This is a tooltip" side="top">
|
|
152
|
+
<Button>Hover me</Button>
|
|
153
|
+
</Tooltip>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Dropdown
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<Dropdown trigger={<Button>Menu</Button>}>
|
|
160
|
+
<DropdownItem>Profile</DropdownItem>
|
|
161
|
+
<DropdownItem>Settings</DropdownItem>
|
|
162
|
+
<DropdownSeparator />
|
|
163
|
+
<DropdownItem>Logout</DropdownItem>
|
|
164
|
+
</Dropdown>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Toast
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
<ToastProvider>
|
|
171
|
+
<Toast
|
|
172
|
+
open={open}
|
|
173
|
+
onOpenChange={setOpen}
|
|
174
|
+
title="Success"
|
|
175
|
+
description="Action completed"
|
|
176
|
+
intent="success"
|
|
177
|
+
/>
|
|
178
|
+
</ToastProvider>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Variant System
|
|
182
|
+
|
|
183
|
+
All components follow a strict, typed variant system:
|
|
184
|
+
|
|
185
|
+
- **variant**: `primary` | `secondary` | `ghost` | `outline`
|
|
186
|
+
- **intent**: `primary` | `success` | `warning` | `danger` | `neutral`
|
|
187
|
+
- **size**: `sm` | `md` | `lg`
|
|
188
|
+
- **state**: `loading` | `disabled`
|
|
189
|
+
|
|
190
|
+
No arbitrary strings or raw class overrides are allowed.
|
|
191
|
+
|
|
192
|
+
## Theming
|
|
193
|
+
|
|
194
|
+
The design system uses CSS variables as the public contract. Themes can be switched without rebuilding:
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
<ThemeProvider theme="base" mode="dark">
|
|
198
|
+
{/* Dark mode */}
|
|
199
|
+
</ThemeProvider>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Custom Themes
|
|
203
|
+
|
|
204
|
+
You can extend themes by overriding CSS variables:
|
|
205
|
+
|
|
206
|
+
```css
|
|
207
|
+
:root {
|
|
208
|
+
--pd-intent-primary: #your-color;
|
|
209
|
+
--pd-intent-primary-hover: #your-hover-color;
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Adapter Layer
|
|
214
|
+
|
|
215
|
+
The adapter layer allows switching UI engines without changing application code:
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
// Switch from shadcn to material
|
|
219
|
+
setDesignSystemConfig({ adapter: 'material' });
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Currently supported adapters:
|
|
223
|
+
- **shadcn**: Radix UI + Tailwind CSS
|
|
224
|
+
- **material**: Material UI (coming soon)
|
|
225
|
+
|
|
226
|
+
## Storybook
|
|
227
|
+
|
|
228
|
+
View all components and variants in Storybook:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npm run storybook
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Storybook includes:
|
|
235
|
+
- All component variants
|
|
236
|
+
- Interactive controls
|
|
237
|
+
- Theme switcher (light/dark)
|
|
238
|
+
- Adapter switcher
|
|
239
|
+
- Accessibility panel
|
|
240
|
+
- Code snippets
|
|
241
|
+
|
|
242
|
+
## Architecture
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
src/
|
|
246
|
+
├── tokens/ # Base & semantic tokens
|
|
247
|
+
├── theme/ # Theme system & provider
|
|
248
|
+
├── primitives/ # Headless components
|
|
249
|
+
├── adapters/ # UI engine adapters
|
|
250
|
+
└── components/ # Public components
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## TypeScript
|
|
254
|
+
|
|
255
|
+
Full TypeScript support with autocomplete:
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
<Button
|
|
259
|
+
variant="primary" // ✅ Autocomplete
|
|
260
|
+
intent="danger" // ✅ Autocomplete
|
|
261
|
+
size="md" // ✅ Autocomplete
|
|
262
|
+
/>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Accessibility
|
|
266
|
+
|
|
267
|
+
- Radix UI primitives for ARIA compliance
|
|
268
|
+
- Keyboard navigation support
|
|
269
|
+
- Focus ring standards
|
|
270
|
+
- Screen reader labels
|
|
271
|
+
- Contrast-safe tokens
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|