@techv/design-system 0.1.5 → 0.1.6
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 +70 -37
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ A React component library and design token system. Single package — install on
|
|
|
6
6
|
|
|
7
7
|
| Peer dependency | Version |
|
|
8
8
|
|---|---|
|
|
9
|
-
| react | ^18.0.0 |
|
|
10
|
-
| react-dom | ^18.0.0 |
|
|
9
|
+
| react | ^17.0.0 \| ^18.0.0 \| ^19.0.0 |
|
|
10
|
+
| react-dom | ^17.0.0 \| ^18.0.0 \| ^19.0.0 |
|
|
11
11
|
| styled-components | ^6.1.0 |
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -135,7 +135,41 @@ import { IconButton } from '@techv/design-system';
|
|
|
135
135
|
|
|
136
136
|
## Utility Classes
|
|
137
137
|
|
|
138
|
-
Import `@techv/design-system/utility.css` to
|
|
138
|
+
Import `@techv/design-system/utility.css` to style elements with classNames — no inline styles needed.
|
|
139
|
+
|
|
140
|
+
### Background colors
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<div>
|
|
144
|
+
{/* Solid colors */}
|
|
145
|
+
<div className="bg-indigo-500 p-4">Indigo 500</div>
|
|
146
|
+
<div className="bg-red-500 p-4">Red 500</div>
|
|
147
|
+
<div className="bg-green-500 p-4">Green 500</div>
|
|
148
|
+
|
|
149
|
+
{/* Light tints — cards, badges, alerts */}
|
|
150
|
+
<div className="bg-indigo-50 tx-indigo-700 p-4 br-lg">Indigo tint</div>
|
|
151
|
+
<div className="bg-green-50 tx-green-700 p-4 br-lg">Success tint</div>
|
|
152
|
+
<div className="bg-red-50 tx-red-700 p-4 br-lg">Danger tint</div>
|
|
153
|
+
<div className="bg-amber-50 tx-amber-700 p-4 br-lg">Warning tint</div>
|
|
154
|
+
|
|
155
|
+
{/* Neutral */}
|
|
156
|
+
<div className="bg-gray-100 p-4">Light gray</div>
|
|
157
|
+
<div className="bg-gray-800 tx-white p-4">Dark gray</div>
|
|
158
|
+
<div className="bg-white p-4">White</div>
|
|
159
|
+
<div className="bg-black tx-white p-4">Black</div>
|
|
160
|
+
</div>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Color weight guide**
|
|
164
|
+
|
|
165
|
+
| Weight | Use case |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `50` | Very light tint — backgrounds, alerts |
|
|
168
|
+
| `100–200` | Soft highlight |
|
|
169
|
+
| `300–400` | Muted fill |
|
|
170
|
+
| `500` | Primary color |
|
|
171
|
+
| `600–700` | Hover / pressed state |
|
|
172
|
+
| `800–900` | Dark / high contrast |
|
|
139
173
|
|
|
140
174
|
### Badge
|
|
141
175
|
|
|
@@ -148,15 +182,17 @@ Import `@techv/design-system/utility.css` to use className-based styling. Classe
|
|
|
148
182
|
### Alert / status banner
|
|
149
183
|
|
|
150
184
|
```tsx
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
185
|
+
type AlertType = 'success' | 'danger' | 'warning';
|
|
186
|
+
|
|
187
|
+
const alertStyles: Record<AlertType, string> = {
|
|
188
|
+
success: 'bg-green-50 tx-green-700 bd-green-300 border bw-1',
|
|
189
|
+
danger: 'bg-red-50 tx-red-700 bd-red-300 border bw-1',
|
|
190
|
+
warning: 'bg-amber-50 tx-amber-700 bd-amber-300 border bw-1',
|
|
191
|
+
};
|
|
157
192
|
|
|
193
|
+
function Alert({ type, message }: { type: AlertType; message: string }) {
|
|
158
194
|
return (
|
|
159
|
-
<div role="alert" className={`${
|
|
195
|
+
<div role="alert" className={`${alertStyles[type]} px-4 py-2 br-md fs-sm`}>
|
|
160
196
|
{message}
|
|
161
197
|
</div>
|
|
162
198
|
);
|
|
@@ -192,6 +228,18 @@ function Tag({ label }: { label: string }) {
|
|
|
192
228
|
}
|
|
193
229
|
```
|
|
194
230
|
|
|
231
|
+
### Animated element
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
function FadeInBox({ children }: { children: React.ReactNode }) {
|
|
235
|
+
return (
|
|
236
|
+
<div className="bg-indigo-50 br-xl p-6" style={{ transition: 'opacity var(--duration-normal) var(--ease-standard)' }}>
|
|
237
|
+
{children}
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
195
243
|
### Flex layout
|
|
196
244
|
|
|
197
245
|
```tsx
|
|
@@ -328,34 +376,9 @@ box-shadow: var(--sh-3);
|
|
|
328
376
|
|
|
329
377
|
---
|
|
330
378
|
|
|
331
|
-
##
|
|
332
|
-
|
|
333
|
-
Import token values for use in styled-components or dynamic styles:
|
|
334
|
-
|
|
335
|
-
```tsx
|
|
336
|
-
import { bg, tx, bd, fl, spacing, fs, fw, lh, ta, br, bw, sh, op, duration, ease } from '@techv/design-system';
|
|
337
|
-
```
|
|
379
|
+
## Using tokens in styled-components
|
|
338
380
|
|
|
339
|
-
|
|
340
|
-
|---|---|---|
|
|
341
|
-
| `colors` | Full color palette | `colors.red[500]` → `'#EF4444'` |
|
|
342
|
-
| `bg` | Background colors (alias of colors) | `bg.indigo[50]` → `'#EEF2FF'` |
|
|
343
|
-
| `tx` | Text colors (alias of colors) | `tx.gray[700]` → `'#374151'` |
|
|
344
|
-
| `bd` | Border colors (alias of colors) | `bd.gray[200]` → `'#E5E7EB'` |
|
|
345
|
-
| `fl` | SVG fill colors (alias of colors) | `fl.green[400]` → `'#4ADE80'` |
|
|
346
|
-
| `spacing` | 4px-base numeric scale | `spacing[4]` → `'16px'` |
|
|
347
|
-
| `fs` | Font sizes | `fs.sm` → `'14px'` |
|
|
348
|
-
| `fw` | Font weights | `fw[7]` → `'700'` |
|
|
349
|
-
| `lh` | Line heights | `lh.base` → `1.5` |
|
|
350
|
-
| `ta` | Text alignment | `ta.c` → `'center'` |
|
|
351
|
-
| `br` | Border radius | `br.full` → `'9999px'` |
|
|
352
|
-
| `bw` | Border widths | `bw[1]` → `'1px'` |
|
|
353
|
-
| `sh` | Shadows | `sh[3]` → md elevation |
|
|
354
|
-
| `op` | Opacity | `op[50]` → `'0.5'` |
|
|
355
|
-
| `duration` | Animation durations | `duration.normal` → `'200ms'` |
|
|
356
|
-
| `ease` | Easing curves | `ease.standard` |
|
|
357
|
-
|
|
358
|
-
### Using tokens in styled-components
|
|
381
|
+
Import token values for use in styled-components:
|
|
359
382
|
|
|
360
383
|
```tsx
|
|
361
384
|
import styled from 'styled-components';
|
|
@@ -381,6 +404,16 @@ const Body = styled.p`
|
|
|
381
404
|
`;
|
|
382
405
|
```
|
|
383
406
|
|
|
407
|
+
**Available token exports**
|
|
408
|
+
|
|
409
|
+
| Export | Example |
|
|
410
|
+
|---|---|
|
|
411
|
+
| `bg`, `tx`, `bd`, `fl`, `colors` | `bg.indigo[50]`, `tx.gray[700]` |
|
|
412
|
+
| `spacing` | `spacing[4]` → `'16px'` |
|
|
413
|
+
| `fs`, `fw`, `lh`, `ta` | `fs.sm`, `fw[6]` |
|
|
414
|
+
| `br`, `bw`, `sh`, `op` | `br.full`, `sh[3]` |
|
|
415
|
+
| `duration`, `ease` | `duration.normal`, `ease.standard` |
|
|
416
|
+
|
|
384
417
|
---
|
|
385
418
|
|
|
386
419
|
## Dark mode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techv/design-system",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"author": "Pranav V K <pranavvk@techversantinfotech.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"./dist/utility.css"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"react": "^18.0.0",
|
|
33
|
-
"react-dom": "^18.0.0",
|
|
32
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
33
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
34
34
|
"styled-components": "^6.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|