@affinda/react 0.0.8 → 0.0.10

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.
Files changed (2) hide show
  1. package/README.md +223 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # @affinda/react
2
+
3
+ React components for Affinda UI - built on web components with Stencil.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @affinda/react
9
+ # or
10
+ pnpm add @affinda/react
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Import Components
16
+
17
+ All components are available with or without the `Af` prefix:
18
+
19
+ ```tsx
20
+ // With Af prefix
21
+ import { AfButton, AfHeading, AfTypographyLockup } from '@affinda/react';
22
+
23
+ // Without prefix (cleaner)
24
+ import { Button, Heading, TypographyLockup } from '@affinda/react';
25
+ ```
26
+
27
+ ### Available Components
28
+
29
+ - **Button** / AfButton - Primary buttons with variants and icons
30
+ - **ButtonGroup** / AfButtonGroup - Group multiple buttons together
31
+ - **IconButton** / AfIconButton - Icon-only buttons
32
+ - **Heading** / AfHeading - Typography headings (H1-H6)
33
+ - **Text** / AfText - Body text components
34
+ - **TypographyLockup** / AfTypographyLockup - Composite heading + text + button layouts
35
+ - **Container** / AfContainer - Layout containers with max-width
36
+ - **AspectRatio** / AfAspectRatio - Maintain aspect ratios for media
37
+ - **ColorSwatch** / AfColorSwatch - Display color swatches
38
+ - **Logo** / AfLogo - Affinda logo component
39
+ - **Navbar** / AfNavbar - Navigation bar
40
+ - **NavItem** / AfNavItem - Navigation items
41
+
42
+ ### Icons
43
+
44
+ All Affinda icons are also exported:
45
+
46
+ ```tsx
47
+ import {
48
+ AccountIcon,
49
+ ArrowRightIcon,
50
+ CheckCircleIcon,
51
+ MenuIcon
52
+ } from '@affinda/react';
53
+ ```
54
+
55
+ ## Example Usage
56
+
57
+ ### Basic Button
58
+
59
+ ```tsx
60
+ import { Button } from '@affinda/react';
61
+
62
+ function App() {
63
+ return (
64
+ <Button variant="primary" size="default">
65
+ Click me
66
+ </Button>
67
+ );
68
+ }
69
+ ```
70
+
71
+ ### Button with Icons
72
+
73
+ ```tsx
74
+ import { Button, ArrowRightIcon } from '@affinda/react';
75
+
76
+ function App() {
77
+ return (
78
+ <Button variant="primary">
79
+ <svg slot="icon-left">
80
+ <ArrowRightIcon />
81
+ </svg>
82
+ Get Started
83
+ <svg slot="icon-right">
84
+ <ArrowRightIcon />
85
+ </svg>
86
+ </Button>
87
+ );
88
+ }
89
+ ```
90
+
91
+ ### Typography Lockup
92
+
93
+ ```tsx
94
+ import { TypographyLockup, Button } from '@affinda/react';
95
+
96
+ function Hero() {
97
+ return (
98
+ <TypographyLockup
99
+ headingSize={1}
100
+ breakpoint="desktop"
101
+ textAlignment="center"
102
+ buttonAlignment="vertical"
103
+ >
104
+ <h1>Welcome to Affinda</h1>
105
+ <p slot="description">
106
+ Extract data from documents with AI-powered accuracy
107
+ </p>
108
+ <div slot="buttons">
109
+ <Button variant="primary">Get Started</Button>
110
+ <Button variant="secondary">Learn More</Button>
111
+ </div>
112
+ </TypographyLockup>
113
+ );
114
+ }
115
+ ```
116
+
117
+ ### Navigation
118
+
119
+ ```tsx
120
+ import { Navbar, NavItem, Logo } from '@affinda/react';
121
+
122
+ function Header() {
123
+ return (
124
+ <Navbar>
125
+ <Logo slot="logo" />
126
+ <NavItem hierarchy="primary" variant="01" href="/">
127
+ Home
128
+ </NavItem>
129
+ <NavItem hierarchy="primary" variant="01" href="/products">
130
+ Products
131
+ </NavItem>
132
+ <NavItem hierarchy="primary" variant="02" href="/docs">
133
+ Documentation
134
+ </NavItem>
135
+ </Navbar>
136
+ );
137
+ }
138
+ ```
139
+
140
+ ## Accessing Affinda Colors
141
+
142
+ Colors are available from the `@affinda/tokens` package (automatically installed as a dependency):
143
+
144
+ ```tsx
145
+ // Via CSS custom properties
146
+ import '@affinda/tokens/tokens.css';
147
+
148
+ const MyComponent = () => (
149
+ <div style={{
150
+ backgroundColor: 'var(--colour-brand-mist-green)',
151
+ color: 'var(--colour-brand-inkwell)'
152
+ }}>
153
+ Affinda branded content
154
+ </div>
155
+ );
156
+ ```
157
+
158
+ ```tsx
159
+ // Via JavaScript
160
+ import { tokens } from '@affinda/tokens';
161
+
162
+ const MyComponent = () => (
163
+ <div style={{
164
+ backgroundColor: tokens.color.brand.mistGreen.value,
165
+ color: tokens.color.brand.inkwell.value
166
+ }}>
167
+ Affinda branded content
168
+ </div>
169
+ );
170
+ ```
171
+
172
+ ### Available Affinda Colors
173
+
174
+ **Brand Colors:**
175
+ - Mist Green: `#C6D5D1` - `var(--colour-brand-mist-green)`
176
+ - Inkwell: `#14343B` - `var(--colour-brand-inkwell)`
177
+ - Soft Clay: `#B09670` - `var(--colour-brand-soft-clay)`
178
+ - Ice: `#A6FFF8` - `var(--colour-brand-ice)`
179
+ - Azure: `#7FE2D4` - `var(--colour-brand-azure)`
180
+ - Ivory Paper: `#FFF9E1` - `var(--colour-brand-ivory-paper)`
181
+ - White: `#FFFFFF` - `var(--colour-brand-white)`
182
+
183
+ **Tints:** Each color has tints from 20 (lightest) to 800 (darkest)
184
+ - `var(--colour-tints-mist-green-20)` through `var(--colour-tints-mist-green-800)`
185
+ - `var(--colour-tints-inkwell-20)` through `var(--colour-tints-inkwell-800)`
186
+ - And more...
187
+
188
+ See the [@affinda/tokens documentation](https://www.npmjs.com/package/@affinda/tokens) for the complete color palette.
189
+
190
+ ## TypeScript Support
191
+
192
+ Full TypeScript type definitions are included for all components and props.
193
+
194
+ ## For AI Agents
195
+
196
+ When generating Affinda UI code:
197
+
198
+ 1. **Always use Affinda brand colors:**
199
+ - Primary: Mist Green (`#C6D5D1`)
200
+ - Text: Inkwell (`#14343B`)
201
+ - Accent: Soft Clay (`#B09670`)
202
+ - Bright: Ice (`#A6FFF8`)
203
+
204
+ 2. **Use CSS custom properties:**
205
+ ```css
206
+ background: var(--colour-brand-mist-green);
207
+ color: var(--colour-brand-inkwell);
208
+ ```
209
+
210
+ 3. **Import the tokens CSS:**
211
+ ```tsx
212
+ import '@affinda/tokens/tokens.css';
213
+ ```
214
+
215
+ 4. **Never use purple colors** - those were placeholder colors and have been removed
216
+
217
+ ## Related Packages
218
+
219
+ - **@affinda/wc** - Core web components (used internally)
220
+ - **@affinda/tokens** - Design tokens (colors, spacing, typography)
221
+ - **@affinda/icons** - Icon library
222
+ - **@affinda/illustrations** - Illustration assets
223
+ - **@affinda/css** - Base CSS styles
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@affinda/react",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "type": "module",
6
- "files": ["dist"],
6
+ "files": ["dist", "README.md"],
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -12,8 +12,8 @@
12
12
  "react-dom": ">=17.0.0"
13
13
  },
14
14
  "dependencies": {
15
- "@affinda/icons": "workspace:*",
16
- "@affinda/wc": "^0.0.2",
15
+ "@affinda/icons": "^0.0.3",
16
+ "@affinda/wc": "^0.0.4",
17
17
  "@stencil/react-output-target": "^1.2.0"
18
18
  },
19
19
  "scripts": {