@nationaldesignstudio/react 0.0.1

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 ADDED
@@ -0,0 +1,154 @@
1
+ # @nds-design-system/react
2
+
3
+ React component library for the NDS Design System. Includes design tokens, Tailwind CSS v4 styles, and React components.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @nds-design-system/react
9
+ # or
10
+ bun add @nds-design-system/react
11
+ # or
12
+ pnpm add @nds-design-system/react
13
+ ```
14
+
15
+ ### Peer Dependencies
16
+
17
+ This package requires the following peer dependencies:
18
+
19
+ ```json
20
+ {
21
+ "react": "^18.0.0 || ^19.0.0",
22
+ "react-dom": "^18.0.0 || ^19.0.0",
23
+ "tailwindcss": "^4.0.0"
24
+ }
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### 1. Import Styles
30
+
31
+ Import the styles once in your app's entry point (e.g., `main.tsx`, `App.tsx`, or `globals.css`):
32
+
33
+ ```tsx
34
+ // In your main entry file
35
+ import '@nds-design-system/react/styles.css'
36
+ ```
37
+
38
+ This imports:
39
+ - Design tokens as CSS variables
40
+ - Tailwind CSS v4 theme configuration
41
+ - Typography utility classes
42
+ - The PP Neue Montreal font
43
+
44
+ ### 2. Use Components
45
+
46
+ ```tsx
47
+ import { Button } from '@nds-design-system/react'
48
+
49
+ function App() {
50
+ return (
51
+ <Button variant="primary" size="lg">
52
+ Click me
53
+ </Button>
54
+ )
55
+ }
56
+ ```
57
+
58
+ ### 3. Use Design Tokens
59
+
60
+ The CSS includes all design tokens as CSS variables. Use them directly or via Tailwind classes:
61
+
62
+ ```tsx
63
+ // Using Tailwind classes (design tokens are registered in @theme)
64
+ <div className="text-blue-500 bg-gray-100 p-4">
65
+ Content
66
+ </div>
67
+
68
+ // Using CSS variables directly
69
+ <div style={{ color: 'var(--color-blue-500)' }}>
70
+ Content
71
+ </div>
72
+
73
+ // Using typography composites
74
+ <h1 className="text-product-title-large">
75
+ Heading
76
+ </h1>
77
+ ```
78
+
79
+ ## Components
80
+
81
+ ### Button
82
+
83
+ A versatile button component with multiple variants and sizes.
84
+
85
+ ```tsx
86
+ import { Button } from '@nds-design-system/react'
87
+
88
+ // Variants
89
+ <Button variant="primary">Primary</Button>
90
+ <Button variant="secondary">Secondary</Button>
91
+ <Button variant="destructive">Destructive</Button>
92
+ <Button variant="outline">Outline</Button>
93
+ <Button variant="ghost">Ghost</Button>
94
+ <Button variant="link">Link</Button>
95
+
96
+ // Sizes
97
+ <Button size="sm">Small</Button>
98
+ <Button size="default">Default</Button>
99
+ <Button size="lg">Large</Button>
100
+ <Button size="icon">Icon</Button>
101
+
102
+ // As child (polymorphic)
103
+ <Button asChild>
104
+ <a href="/link">Link Button</a>
105
+ </Button>
106
+ ```
107
+
108
+ ## Utilities
109
+
110
+ ### `cn()`
111
+
112
+ A utility function for merging Tailwind classes with proper precedence:
113
+
114
+ ```tsx
115
+ import { cn } from '@nds-design-system/react'
116
+
117
+ <div className={cn('text-blue-500', isActive && 'text-red-500')}>
118
+ Content
119
+ </div>
120
+ ```
121
+
122
+ ## Package Exports
123
+
124
+ ```tsx
125
+ // Components
126
+ import { Button, buttonVariants } from '@nds-design-system/react'
127
+ import type { ButtonProps } from '@nds-design-system/react'
128
+
129
+ // Utilities
130
+ import { cn } from '@nds-design-system/react'
131
+
132
+ // Styles (import once)
133
+ import '@nds-design-system/react/styles.css'
134
+ ```
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ # Install dependencies
140
+ bun install
141
+
142
+ # Start Storybook for component development
143
+ bun run storybook
144
+
145
+ # Build the library
146
+ bun run build
147
+
148
+ # Type check
149
+ bun run type:check
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT
@@ -0,0 +1,28 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ /**
4
+ * Button component based on Figma BaseKit / Interface / Buttons
5
+ *
6
+ * Variants:
7
+ * - charcoal: Dark filled button (bg-gray-1200, text-gray-100)
8
+ * - charcoalOutline: Dark outlined button (border-alpha-black-30)
9
+ * - charcoalOutlineQuiet: Subtle dark outlined button (border-alpha-black-20)
10
+ * - ivory: Light filled button (bg-gray-50, text-gray-1000)
11
+ * - ivoryOutline: Light outlined button for dark backgrounds (border-gray-50)
12
+ * - ghost: Transparent with subtle border for dark backgrounds
13
+ *
14
+ * Sizes:
15
+ * - lg: Large buttons (px-16, py-12, rounded-12, text-14)
16
+ * - default: Medium buttons (px-16, py-12, rounded-12, text-14)
17
+ * - sm: Small buttons (p-12, rounded-11, text-12)
18
+ * - icon/iconLg/iconSm: Icon-only buttons
19
+ */
20
+ declare const buttonVariants: (props?: ({
21
+ variant?: "charcoal" | "charcoalOutline" | "charcoalOutlineQuiet" | "ivory" | "ivoryOutline" | "ghost" | null | undefined;
22
+ size?: "lg" | "default" | "sm" | "iconLg" | "icon" | "iconSm" | null | undefined;
23
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
24
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
25
+ asChild?: boolean;
26
+ }
27
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
28
+ export { Button, buttonVariants };
@@ -0,0 +1,3 @@
1
+ export type { ButtonProps } from './components/button';
2
+ export { Button, buttonVariants } from './components/button';
3
+ export { cn } from './lib/utils';