@affinda/react 0.0.16 → 0.0.18

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 CHANGED
@@ -26,13 +26,17 @@ defineCustomElements();
26
26
  ### 2. Use Components
27
27
 
28
28
  ```tsx
29
- import { Button, Navbar, Card } from '@affinda/react';
29
+ import { Button, Navbar, NavItem, Logo } from '@affinda/react';
30
30
 
31
31
  function App() {
32
32
  return (
33
33
  <div>
34
34
  <Navbar>
35
- <Button variant="primary">Get Started</Button>
35
+ <Logo slot="logo" />
36
+ <div slot="start">
37
+ <NavItem href="/products">Products</NavItem>
38
+ </div>
39
+ <Button slot="button" variant="primary">Get Started</Button>
36
40
  </Navbar>
37
41
  </div>
38
42
  );
@@ -127,7 +131,11 @@ The hero section component makes it easy to create marketing page heroes with co
127
131
  import { HeroSection, Heading, Text, Button, PaperclipDecoration } from '@affinda/react';
128
132
 
129
133
  <HeroSection variant="dark" withDecoration={true} minHeight="60vh">
130
- <PaperclipDecoration slot="decoration" />
134
+ {/* Position the paperclip decoration - adjust bottom/right values as needed */}
135
+ <PaperclipDecoration
136
+ slot="decoration"
137
+ style={{ position: 'absolute', bottom: -80, right: -800 }}
138
+ />
131
139
  <Heading level="1" theme="dark" align="center">
132
140
  Harness AI to transform business processes
133
141
  </Heading>
@@ -195,6 +203,35 @@ import { Card, Heading, Text } from '@affinda/react';
195
203
  - `backgroundImage`: URL to background image
196
204
  - `darkOverlay`: boolean - Applies gradient overlay with white text
197
205
 
206
+ ### PaperclipDecoration
207
+
208
+ Decorative SVG paperclip graphic for hero sections.
209
+
210
+ ⚠️ **Important**: When using with `HeroSection`, you must manually position the paperclip using inline styles, as the component uses scoped styles rather than shadow DOM.
211
+
212
+ ```tsx
213
+ import { HeroSection, PaperclipDecoration } from '@affinda/react';
214
+
215
+ <HeroSection variant="dark" withDecoration={true}>
216
+ <PaperclipDecoration
217
+ slot="decoration"
218
+ style={{
219
+ position: 'absolute',
220
+ bottom: -80, // Adjust to move vertically
221
+ right: -800 // Adjust to move horizontally
222
+ }}
223
+ />
224
+ {/* Hero content */}
225
+ </HeroSection>
226
+ ```
227
+
228
+ **Positioning Tips:**
229
+ - **Negative values** move the decoration outside the viewport (creating a partial reveal effect)
230
+ - **bottom**: Controls vertical position (negative = move down/off-screen)
231
+ - **right**: Controls horizontal position (negative = move right/off-screen)
232
+ - Start with `bottom: -80, right: -800` and adjust to taste
233
+ - The paperclip automatically sits behind content (`z-index: 0`)
234
+
198
235
  ## Component Guide
199
236
 
200
237
  ### When to Use Each Component
@@ -321,22 +358,73 @@ import { Card, Heading, Text } from '@affinda/react';
321
358
  #### Navigation
322
359
 
323
360
  **Navbar**
324
- - Site-wide navigation header
325
- - Responsive design with mobile menu support
326
- - Include Logo in the `logo` slot
327
361
 
362
+ ⚠️ **IMPORTANT**: The Navbar component uses **slots** for positioning elements. Items placed as direct children will not be visible. You must wrap them in divs with the appropriate `slot` attribute.
363
+
364
+ Site-wide navigation header with responsive design and mobile menu support.
365
+
366
+ **Required Slots:**
367
+ - `logo` - Brand logo (left side)
368
+ - `start` - Primary navigation links (center-left)
369
+ - `end` - Secondary navigation and actions (right side)
370
+ - `button` - Call-to-action button (far right)
371
+
372
+ ```tsx
373
+ <Navbar>
374
+ {/* Logo slot - required */}
375
+ <Logo slot="logo" />
376
+
377
+ {/* Start slot - main navigation items */}
378
+ <div slot="start">
379
+ <NavItem hierarchy="primary" variant="01" href="/platform">
380
+ Platform
381
+ </NavItem>
382
+ <NavItem hierarchy="primary" variant="01" href="/solutions">
383
+ Solutions
384
+ </NavItem>
385
+ <NavItem hierarchy="primary" variant="01" href="/pricing">
386
+ Pricing
387
+ </NavItem>
388
+ </div>
389
+
390
+ {/* End slot - secondary navigation */}
391
+ <div slot="end">
392
+ <NavItem hierarchy="primary" variant="02" href="/contact">
393
+ Talk to us
394
+ </NavItem>
395
+ <NavItem hierarchy="primary" variant="02" href="/login">
396
+ Log in
397
+ </NavItem>
398
+ </div>
399
+
400
+ {/* Button slot - CTA */}
401
+ <Button slot="button" variant="primary" size="default">
402
+ Try for free
403
+ </Button>
404
+ </Navbar>
405
+ ```
406
+
407
+ **Common Mistake:**
328
408
  ```tsx
409
+ // ❌ WRONG - Direct children are ignored
410
+ <Navbar>
411
+ <Logo />
412
+ <NavItem href="/home">Home</NavItem>
413
+ </Navbar>
414
+
415
+ // ✅ CORRECT - Use slots
329
416
  <Navbar>
330
417
  <Logo slot="logo" />
331
- <NavItem hierarchy="primary" href="/">Home</NavItem>
332
- <NavItem hierarchy="primary" href="/about">About</NavItem>
333
- <NavItem hierarchy="secondary" href="/login">Log In</NavItem>
418
+ <div slot="start">
419
+ <NavItem href="/home">Home</NavItem>
420
+ </div>
334
421
  </Navbar>
335
422
  ```
336
423
 
337
424
  **NavItem**
338
425
  - Individual navigation links
339
426
  - Hierarchy: `primary` (main nav), `secondary` (utility nav)
427
+ - Variant: `"01"` (primary links), `"02"` (secondary/utility links)
340
428
  - Variant: Controls visual style
341
429
 
342
430
  #### Social Proof & Testimonials
@@ -489,21 +577,26 @@ function Hero() {
489
577
  ### Navigation
490
578
 
491
579
  ```tsx
492
- import { Navbar, NavItem, Logo } from '@affinda/react';
580
+ import { Navbar, NavItem, Logo, Button } from '@affinda/react';
493
581
 
494
582
  function Header() {
495
583
  return (
496
584
  <Navbar>
497
585
  <Logo slot="logo" />
498
- <NavItem hierarchy="primary" variant="01" href="/">
499
- Home
500
- </NavItem>
501
- <NavItem hierarchy="primary" variant="01" href="/products">
502
- Products
503
- </NavItem>
504
- <NavItem hierarchy="primary" variant="02" href="/docs">
505
- Documentation
506
- </NavItem>
586
+ <div slot="start">
587
+ <NavItem hierarchy="primary" variant="01" href="/">
588
+ Home
589
+ </NavItem>
590
+ <NavItem hierarchy="primary" variant="01" href="/products">
591
+ Products
592
+ </NavItem>
593
+ </div>
594
+ <div slot="end">
595
+ <NavItem hierarchy="primary" variant="02" href="/docs">
596
+ Documentation
597
+ </NavItem>
598
+ </div>
599
+ <Button slot="button" variant="primary">Get Started</Button>
507
600
  </Navbar>
508
601
  );
509
602
  }
@@ -5,6 +5,6 @@ import * as React from 'react';
5
5
  * Decorative paperclip vector graphic for hero sections
6
6
  */
7
7
  export function PaperclipDecoration({ className, style }) {
8
- const svgStyle = Object.assign({ display: 'block' }, style || {});
9
- return (_jsx("svg", { preserveAspectRatio: "none", width: "100%", height: "100%", style: svgStyle, viewBox: "0 0 1212 753", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": true, children: _jsx("path", { d: "M1102.14 107.875C1031.8 37.1138 939.128 -1.47247 840.61 0.0430067H358.674L262.104 156.72H841.87C842.558 156.72 843.36 156.72 844.047 156.72C900.638 156.72 953.791 178.869 994 219.32C1035.24 260.821 1058.04 316.311 1058.04 375.647C1058.04 497.468 960.665 596.44 841.068 596.44H251.335C197.609 596.44 153.848 551.908 153.848 497.235C153.848 442.561 197.723 397.33 251.221 395.698H779.208L878.872 239.021H248.586C111.577 242.519 0 358.277 0 497.235C0 636.192 112.723 753 251.335 753H841.068C1045.55 753 1212 583.617 1212 375.531C1212 273.994 1173.05 178.985 1102.26 107.758L1102.14 107.875Z", fill: "white", fillOpacity: 0.06 }) }));
8
+ const svgStyle = Object.assign({ display: 'block', position: 'absolute' }, style || {});
9
+ return (_jsx("svg", { preserveAspectRatio: "none", width: "100%", height: "100%", style: style, viewBox: "0 0 1212 753", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": true, children: _jsx("path", { d: "M1102.14 107.875C1031.8 37.1138 939.128 -1.47247 840.61 0.0430067H358.674L262.104 156.72H841.87C842.558 156.72 843.36 156.72 844.047 156.72C900.638 156.72 953.791 178.869 994 219.32C1035.24 260.821 1058.04 316.311 1058.04 375.647C1058.04 497.468 960.665 596.44 841.068 596.44H251.335C197.609 596.44 153.848 551.908 153.848 497.235C153.848 442.561 197.723 397.33 251.221 395.698H779.208L878.872 239.021H248.586C111.577 242.519 0 358.277 0 497.235C0 636.192 112.723 753 251.335 753H841.068C1045.55 753 1212 583.617 1212 375.531C1212 273.994 1173.05 178.985 1102.26 107.758L1102.14 107.875Z", fill: "white", fillOpacity: 0.06 }) }));
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@affinda/react",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "pnpm run clean && tsc -p tsconfig.json",
24
+ "dev": "tsc -p tsconfig.json --watch",
24
25
  "clean": "rm -rf dist"
25
26
  }
26
27
  }