@affinda/react 0.0.10 → 0.0.12
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 +56 -2
- package/dist/generated/components.d.ts +3 -0
- package/dist/generated/components.js +9 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,11 +5,65 @@ React components for Affinda UI - built on web components with Stencil.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @affinda/react
|
|
8
|
+
npm install @affinda/react @affinda/css
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @affinda/react
|
|
10
|
+
pnpm add @affinda/react @affinda/css
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### 1. Import Styles and Initialize Components
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// In your main.tsx or index.tsx
|
|
19
|
+
import '@affinda/css'; // Loads reset, fonts, tokens, base styles
|
|
20
|
+
import { defineCustomElements } from '@affinda/wc/loader';
|
|
21
|
+
|
|
22
|
+
// Initialize web components
|
|
23
|
+
defineCustomElements();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Use Components
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Button, Navbar, Card } from '@affinda/react';
|
|
30
|
+
|
|
31
|
+
function App() {
|
|
32
|
+
return (
|
|
33
|
+
<div>
|
|
34
|
+
<Navbar>
|
|
35
|
+
<Button variant="primary">Get Started</Button>
|
|
36
|
+
</Navbar>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Load NeuSans Font (Recommended)
|
|
43
|
+
|
|
44
|
+
Affinda components use the **NeuSans** font family. To get the authentic Affinda look:
|
|
45
|
+
|
|
46
|
+
1. Obtain NeuSans font files (contact Affinda or your design team)
|
|
47
|
+
2. Add @font-face declarations in your global CSS:
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
@font-face {
|
|
51
|
+
font-family: 'NeuSans';
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-weight: 500; /* Book weight for headings */
|
|
54
|
+
src: url('/fonts/NeuSans-Book.woff2') format('woff2');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@font-face {
|
|
58
|
+
font-family: 'NeuSans';
|
|
59
|
+
font-style: normal;
|
|
60
|
+
font-weight: 400; /* Regular weight */
|
|
61
|
+
src: url('/fonts/NeuSans-Regular.woff2') format('woff2');
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Don't have NeuSans?** The components will gracefully fall back to Inter and system fonts.
|
|
66
|
+
|
|
13
67
|
## Usage
|
|
14
68
|
|
|
15
69
|
### Import Components
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { AfAspectRatio as AfAspectRatioElement } from "@affinda/wc/dist/components/af-aspect-ratio.js";
|
|
6
6
|
import { AfButtonGroup as AfButtonGroupElement } from "@affinda/wc/dist/components/af-button-group.js";
|
|
7
7
|
import { AfButton as AfButtonElement } from "@affinda/wc/dist/components/af-button.js";
|
|
8
|
+
import { AfCard as AfCardElement } from "@affinda/wc/dist/components/af-card.js";
|
|
8
9
|
import { AfColorSwatch as AfColorSwatchElement } from "@affinda/wc/dist/components/af-color-swatch.js";
|
|
9
10
|
import { AfContainer as AfContainerElement } from "@affinda/wc/dist/components/af-container.js";
|
|
10
11
|
import { AfHeading as AfHeadingElement } from "@affinda/wc/dist/components/af-heading.js";
|
|
@@ -21,6 +22,8 @@ export type AfButtonEvents = NonNullable<unknown>;
|
|
|
21
22
|
export declare const AfButton: StencilReactComponent<AfButtonElement, AfButtonEvents>;
|
|
22
23
|
export type AfButtonGroupEvents = NonNullable<unknown>;
|
|
23
24
|
export declare const AfButtonGroup: StencilReactComponent<AfButtonGroupElement, AfButtonGroupEvents>;
|
|
25
|
+
export type AfCardEvents = NonNullable<unknown>;
|
|
26
|
+
export declare const AfCard: StencilReactComponent<AfCardElement, AfCardEvents>;
|
|
24
27
|
export type AfColorSwatchEvents = NonNullable<unknown>;
|
|
25
28
|
export declare const AfColorSwatch: StencilReactComponent<AfColorSwatchElement, AfColorSwatchEvents>;
|
|
26
29
|
export type AfContainerEvents = NonNullable<unknown>;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { AfAspectRatio as AfAspectRatioElement, defineCustomElement as defineAfAspectRatio } from "@affinda/wc/dist/components/af-aspect-ratio.js";
|
|
8
8
|
import { AfButtonGroup as AfButtonGroupElement, defineCustomElement as defineAfButtonGroup } from "@affinda/wc/dist/components/af-button-group.js";
|
|
9
9
|
import { AfButton as AfButtonElement, defineCustomElement as defineAfButton } from "@affinda/wc/dist/components/af-button.js";
|
|
10
|
+
import { AfCard as AfCardElement, defineCustomElement as defineAfCard } from "@affinda/wc/dist/components/af-card.js";
|
|
10
11
|
import { AfColorSwatch as AfColorSwatchElement, defineCustomElement as defineAfColorSwatch } from "@affinda/wc/dist/components/af-color-swatch.js";
|
|
11
12
|
import { AfContainer as AfContainerElement, defineCustomElement as defineAfContainer } from "@affinda/wc/dist/components/af-container.js";
|
|
12
13
|
import { AfHeading as AfHeadingElement, defineCustomElement as defineAfHeading } from "@affinda/wc/dist/components/af-heading.js";
|
|
@@ -42,6 +43,14 @@ export const AfButtonGroup = /*@__PURE__*/ createComponent({
|
|
|
42
43
|
events: {},
|
|
43
44
|
defineCustomElement: defineAfButtonGroup
|
|
44
45
|
});
|
|
46
|
+
export const AfCard = /*@__PURE__*/ createComponent({
|
|
47
|
+
tagName: 'af-card',
|
|
48
|
+
elementClass: AfCardElement,
|
|
49
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
50
|
+
react: React,
|
|
51
|
+
events: {},
|
|
52
|
+
defineCustomElement: defineAfCard
|
|
53
|
+
});
|
|
45
54
|
export const AfColorSwatch = /*@__PURE__*/ createComponent({
|
|
46
55
|
tagName: 'af-color-swatch',
|
|
47
56
|
elementClass: AfColorSwatchElement,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export * from './generated/components.js';
|
|
2
|
-
export
|
|
3
|
-
export { AfAspectRatio as AspectRatio, AfButton as Button, AfButtonGroup as ButtonGroup, AfColorSwatch as ColorSwatch, AfContainer as Container, AfHeading as Heading, AfIconButton as IconButton, AfLogo as Logo, AfNavItem as NavItem, AfNavbar as Navbar, AfText as Text, AfTypographyLockup as TypographyLockup } from './generated/components.js';
|
|
2
|
+
export { AfAspectRatio as AspectRatio, AfButton as Button, AfButtonGroup as ButtonGroup, AfCard as Card, AfColorSwatch as ColorSwatch, AfContainer as Container, AfHeading as Heading, AfIconButton as IconButton, AfLogo as Logo, AfNavItem as NavItem, AfNavbar as Navbar, AfText as Text, AfTypographyLockup as TypographyLockup } from './generated/components.js';
|
|
4
3
|
export * from '@affinda/icons/react';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Export everything from generated components (includes Af-prefixed names)
|
|
2
2
|
export * from './generated/components.js';
|
|
3
|
-
|
|
3
|
+
// Note: defineCustomElements should be imported directly from @affinda/wc/loader/index.js in your app
|
|
4
4
|
// Re-export components without the 'Af' prefix for cleaner React usage
|
|
5
|
-
export { AfAspectRatio as AspectRatio, AfButton as Button, AfButtonGroup as ButtonGroup, AfColorSwatch as ColorSwatch, AfContainer as Container, AfHeading as Heading, AfIconButton as IconButton, AfLogo as Logo, AfNavItem as NavItem, AfNavbar as Navbar, AfText as Text, AfTypographyLockup as TypographyLockup } from './generated/components.js';
|
|
5
|
+
export { AfAspectRatio as AspectRatio, AfButton as Button, AfButtonGroup as ButtonGroup, AfCard as Card, AfColorSwatch as ColorSwatch, AfContainer as Container, AfHeading as Heading, AfIconButton as IconButton, AfLogo as Logo, AfNavItem as NavItem, AfNavbar as Navbar, AfText as Text, AfTypographyLockup as TypographyLockup } from './generated/components.js';
|
|
6
6
|
// Re-export React icon components from icons package
|
|
7
7
|
export * from '@affinda/icons/react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affinda/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": ["dist", "README.md"],
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@affinda/icons": "^0.0.3",
|
|
16
|
-
"@affinda/wc": "^0.0.
|
|
16
|
+
"@affinda/wc": "^0.0.6",
|
|
17
17
|
"@stencil/react-output-target": "^1.2.0"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|