@nationaldesignstudio/react 0.0.6 → 0.0.7
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 +24 -22
- package/dist/tokens.css +5662 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @nationaldesignstudio/react
|
|
2
2
|
|
|
3
|
-
React component library for the NDS Design System. Includes design tokens
|
|
3
|
+
React component library for the NDS Design System. Includes design tokens for Tailwind CSS v4 and React components.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @nationaldesignstudio/react
|
|
9
9
|
# or
|
|
10
|
-
bun add @
|
|
10
|
+
bun add @nationaldesignstudio/react
|
|
11
11
|
# or
|
|
12
|
-
pnpm add @
|
|
12
|
+
pnpm add @nationaldesignstudio/react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Peer Dependencies
|
|
@@ -26,25 +26,25 @@ This package requires the following peer dependencies:
|
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
|
-
### 1. Import
|
|
29
|
+
### 1. Import Tokens
|
|
30
30
|
|
|
31
|
-
Import the
|
|
31
|
+
Import the tokens in your CSS file where you import Tailwind:
|
|
32
32
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
import
|
|
33
|
+
```css
|
|
34
|
+
/* In your main CSS file (e.g., globals.css, styles.css) */
|
|
35
|
+
@import "tailwindcss";
|
|
36
|
+
@import "@nationaldesignstudio/react/tokens.css";
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
This imports:
|
|
39
|
-
- Design tokens as CSS variables
|
|
40
|
-
- Tailwind CSS v4 theme configuration
|
|
41
|
-
- Typography utility classes
|
|
42
|
-
- The PP Neue Montreal font
|
|
40
|
+
- Design tokens as CSS variables (`:root` block)
|
|
41
|
+
- Tailwind CSS v4 `@theme` configuration
|
|
42
|
+
- Typography and spacing utility classes
|
|
43
43
|
|
|
44
44
|
### 2. Use Components
|
|
45
45
|
|
|
46
46
|
```tsx
|
|
47
|
-
import { Button } from '@
|
|
47
|
+
import { Button } from '@nationaldesignstudio/react'
|
|
48
48
|
|
|
49
49
|
function App() {
|
|
50
50
|
return (
|
|
@@ -133,7 +133,7 @@ For fixed typography that doesn't change with screen size:
|
|
|
133
133
|
A versatile button component with multiple variants and sizes.
|
|
134
134
|
|
|
135
135
|
```tsx
|
|
136
|
-
import { Button } from '@
|
|
136
|
+
import { Button } from '@nationaldesignstudio/react'
|
|
137
137
|
|
|
138
138
|
// Variants
|
|
139
139
|
<Button variant="primary">Primary</Button>
|
|
@@ -162,7 +162,7 @@ import { Button } from '@nds-design-system/react'
|
|
|
162
162
|
A utility function for merging Tailwind classes with proper precedence:
|
|
163
163
|
|
|
164
164
|
```tsx
|
|
165
|
-
import { cn } from '@
|
|
165
|
+
import { cn } from '@nationaldesignstudio/react'
|
|
166
166
|
|
|
167
167
|
<div className={cn('text-blue-500', isActive && 'text-red-500')}>
|
|
168
168
|
Content
|
|
@@ -173,14 +173,16 @@ import { cn } from '@nds-design-system/react'
|
|
|
173
173
|
|
|
174
174
|
```tsx
|
|
175
175
|
// Components
|
|
176
|
-
import { Button, buttonVariants } from '@
|
|
177
|
-
import type { ButtonProps } from '@
|
|
176
|
+
import { Button, buttonVariants } from '@nationaldesignstudio/react'
|
|
177
|
+
import type { ButtonProps } from '@nationaldesignstudio/react'
|
|
178
178
|
|
|
179
179
|
// Utilities
|
|
180
|
-
import { cn } from '@
|
|
180
|
+
import { cn } from '@nationaldesignstudio/react'
|
|
181
|
+
```
|
|
181
182
|
|
|
182
|
-
|
|
183
|
-
import
|
|
183
|
+
```css
|
|
184
|
+
/* Tokens (import in your CSS file) */
|
|
185
|
+
@import "@nationaldesignstudio/react/tokens.css";
|
|
184
186
|
```
|
|
185
187
|
|
|
186
188
|
## Development
|