osi-cards-lib 1.2.2 → 1.4.0
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 +14 -830
- package/fesm2022/osi-cards-lib.mjs +53 -4
- package/index.d.ts +37 -1
- package/package.json +7 -1
- package/styles/_styles-scoped.scss +110 -0
- package/styles/components/cards/_ai-card.scss +4 -0
- package/styles/core/_bootstrap-reset.scss +293 -0
- package/styles/core/_global-scoped.scss +114 -0
- package/styles/core/_variables-scoped.scss +429 -0
- package/styles/core/variables/_colors-scoped.scss +249 -0
package/README.md
CHANGED
|
@@ -1,862 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# osi-cards-lib
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Standalone OSI Cards library for Angular applications
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
### From npm (Recommended)
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install osi-cards-lib
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The package is available on npm and can be installed directly. This is the easiest and recommended way to use the library.
|
|
14
|
-
|
|
15
|
-
**Package published at:** https://www.npmjs.com/package/osi-cards-lib
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
18
|
-
|
|
19
|
-
The library now supports both Angular 18 and Angular 20, which should resolve most peer dependency conflicts. Simply install:
|
|
20
|
-
|
|
21
7
|
```bash
|
|
22
8
|
npm install osi-cards-lib
|
|
23
9
|
```
|
|
24
10
|
|
|
25
|
-
If you still encounter conflicts, you can use:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install osi-cards-lib --legacy-peer-deps
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
#### Option 2: Update Incompatible Packages
|
|
32
|
-
|
|
33
|
-
If possible, update packages that require Angular 18 to versions compatible with Angular 20:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# Check for Angular 20 compatible versions
|
|
37
|
-
npm view @ng-select/ng-select versions --json
|
|
38
|
-
npm view @angular-slider/ngx-slider versions --json
|
|
39
|
-
|
|
40
|
-
# Install compatible versions if available
|
|
41
|
-
npm install @ng-select/ng-select@latest --legacy-peer-deps
|
|
42
|
-
npm install @angular-slider/ngx-slider@latest --legacy-peer-deps
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### Option 3: Use --force (Use with caution)
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm install osi-cards-lib --force
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Note:** `osi-cards-lib` supports both Angular 18 and Angular 20, making it compatible with a wider range of projects and reducing peer dependency conflicts.
|
|
52
|
-
|
|
53
|
-
**Package published at:** https://www.npmjs.com/package/osi-cards-lib
|
|
54
|
-
|
|
55
|
-
## Peer Dependencies
|
|
56
|
-
|
|
57
|
-
The library supports both Angular 18 and Angular 20. It requires the following peer dependencies:
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"@angular/common": "^18.0.0 || ^20.0.0",
|
|
62
|
-
"@angular/core": "^18.0.0 || ^20.0.0",
|
|
63
|
-
"@angular/animations": "^18.0.0 || ^20.0.0",
|
|
64
|
-
"@angular/platform-browser": "^18.0.0 || ^20.0.0",
|
|
65
|
-
"lucide-angular": "^0.548.0",
|
|
66
|
-
"rxjs": "~7.8.0"
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Note:** The library is compatible with both Angular 18 and Angular 20, which helps avoid peer dependency conflicts with other packages in your project.
|
|
71
|
-
|
|
72
|
-
### Optional Dependencies
|
|
73
|
-
|
|
74
|
-
For enhanced functionality (charts and maps), you can optionally install:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
npm install chart.js leaflet
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
These are optional - the library works without them, but chart and map sections will have limited functionality.
|
|
81
|
-
|
|
82
11
|
## Quick Start
|
|
83
12
|
|
|
84
|
-
### Step 1: Install the Library
|
|
85
|
-
|
|
86
|
-
Install the library using npm:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm install osi-cards-lib
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**For local development** (if using the library from a local path):
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
npm install /path/to/OSI-Cards-1/dist/osi-cards-lib
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Or add to your `package.json`:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"dependencies": {
|
|
103
|
-
"osi-cards-lib": "file:../OSI-Cards-1/dist/osi-cards-lib"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Step 2: Install Peer Dependencies
|
|
109
|
-
|
|
110
|
-
The library requires these peer dependencies. Install them if not already present:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
npm install osi-cards-lib
|
|
114
|
-
npm install @angular/common@^18.0.0 @angular/core@^18.0.0 @angular/animations@^18.0.0 @angular/platform-browser@^18.0.0 lucide-angular@^0.548.0 rxjs@~7.8.0
|
|
115
|
-
# OR for Angular 20:
|
|
116
|
-
npm install @angular/common@^20.0.0 @angular/core@^20.0.0 @angular/animations@^20.0.0 @angular/platform-browser@^20.0.0 lucide-angular@^0.548.0 rxjs@~7.8.0
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Step 3: Import Styles
|
|
120
|
-
|
|
121
|
-
**Option A: Import in your main styles file** (Recommended)
|
|
122
|
-
|
|
123
|
-
Add this to your `src/styles.scss` (or `styles.css`):
|
|
124
|
-
|
|
125
|
-
```scss
|
|
126
|
-
@import 'osi-cards-lib/styles/_styles';
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Option B: Add to angular.json**
|
|
130
|
-
|
|
131
|
-
Add the styles path to your `angular.json`:
|
|
132
|
-
|
|
133
|
-
```json
|
|
134
|
-
{
|
|
135
|
-
"projects": {
|
|
136
|
-
"your-app": {
|
|
137
|
-
"architect": {
|
|
138
|
-
"build": {
|
|
139
|
-
"options": {
|
|
140
|
-
"styles": [
|
|
141
|
-
"node_modules/osi-cards-lib/styles/_styles.scss",
|
|
142
|
-
"src/styles.scss"
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Note:** If you're using Tailwind CSS, you may need to include Tailwind directives in your main styles file. The library styles work independently but some utility classes may require Tailwind.
|
|
153
|
-
|
|
154
|
-
### Step 4: Configure Providers (REQUIRED)
|
|
155
|
-
|
|
156
|
-
**⚠️ IMPORTANT**: The library requires animation providers to function correctly. You must add the provider function to your `app.config.ts`.
|
|
157
|
-
|
|
158
|
-
#### Option A: Using the Library Provider Function (Recommended)
|
|
159
|
-
|
|
160
|
-
Add `provideOSICards()` to your `app.config.ts`:
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
import { ApplicationConfig } from '@angular/core';
|
|
164
|
-
import { provideOSICards } from 'osi-cards-lib';
|
|
165
|
-
|
|
166
|
-
export const appConfig: ApplicationConfig = {
|
|
167
|
-
providers: [
|
|
168
|
-
provideOSICards(), // This provides required animation support
|
|
169
|
-
// ... your other providers
|
|
170
|
-
]
|
|
171
|
-
};
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
This automatically provides all required dependencies including animations.
|
|
175
|
-
|
|
176
|
-
#### Option B: Manual Provider Configuration
|
|
177
|
-
|
|
178
|
-
If you prefer to configure providers manually, you can use Angular's animation providers directly:
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
import { ApplicationConfig } from '@angular/core';
|
|
182
|
-
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
183
|
-
|
|
184
|
-
export const appConfig: ApplicationConfig = {
|
|
185
|
-
providers: [
|
|
186
|
-
provideAnimations(), // Required for component animations
|
|
187
|
-
// ... your other providers
|
|
188
|
-
]
|
|
189
|
-
};
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Note**: For testing or when animations are not desired, you can use `provideNoopAnimations()` instead:
|
|
193
|
-
|
|
194
|
-
```typescript
|
|
195
|
-
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
|
196
|
-
|
|
197
|
-
export const appConfig: ApplicationConfig = {
|
|
198
|
-
providers: [
|
|
199
|
-
provideOSICards({ enableAnimations: false }), // Uses noop animations
|
|
200
|
-
// OR manually:
|
|
201
|
-
// provideNoopAnimations(),
|
|
202
|
-
]
|
|
203
|
-
};
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Step 5: Import and Use the Card Component
|
|
207
|
-
|
|
208
|
-
#### In a Standalone Component
|
|
209
|
-
|
|
210
13
|
```typescript
|
|
211
|
-
import { Component } from '@angular/core';
|
|
212
14
|
import { AICardRendererComponent, AICardConfig } from 'osi-cards-lib';
|
|
213
15
|
|
|
214
16
|
@Component({
|
|
215
|
-
selector: 'app-
|
|
17
|
+
selector: 'app-example',
|
|
216
18
|
standalone: true,
|
|
217
|
-
imports: [AICardRendererComponent],
|
|
19
|
+
imports: [AICardRendererComponent],
|
|
218
20
|
template: `
|
|
219
|
-
<
|
|
220
|
-
<app-ai-card-renderer [cardConfig]="cardConfig"></app-ai-card-renderer>
|
|
221
|
-
</div>
|
|
21
|
+
<app-ai-card-renderer [cardConfig]="card"></app-ai-card-renderer>
|
|
222
22
|
`
|
|
223
23
|
})
|
|
224
|
-
export class
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
cardTitle: 'My Card Title',
|
|
228
|
-
cardSubtitle: 'Optional subtitle',
|
|
229
|
-
sections: [
|
|
230
|
-
{
|
|
231
|
-
title: 'Overview',
|
|
232
|
-
type: 'overview',
|
|
233
|
-
fields: [
|
|
234
|
-
{ label: 'Name', value: 'Example Company' },
|
|
235
|
-
{ label: 'Status', value: 'Active' },
|
|
236
|
-
{ label: 'Industry', value: 'Technology' }
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
#### Complete Example with Event Handlers
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
import { Component } from '@angular/core';
|
|
248
|
-
import { CommonModule } from '@angular/common';
|
|
249
|
-
import {
|
|
250
|
-
AICardRendererComponent,
|
|
251
|
-
AICardConfig,
|
|
252
|
-
CardFieldInteractionEvent
|
|
253
|
-
} from 'osi-cards-lib';
|
|
254
|
-
|
|
255
|
-
@Component({
|
|
256
|
-
selector: 'app-card-example',
|
|
257
|
-
standalone: true,
|
|
258
|
-
imports: [AICardRendererComponent, CommonModule],
|
|
259
|
-
template: `
|
|
260
|
-
<div class="card-container">
|
|
261
|
-
<app-ai-card-renderer
|
|
262
|
-
[cardConfig]="cardConfig"
|
|
263
|
-
[tiltEnabled]="true"
|
|
264
|
-
(fieldInteraction)="onFieldClick($event)"
|
|
265
|
-
(cardInteraction)="onCardInteraction($event)">
|
|
266
|
-
</app-ai-card-renderer>
|
|
267
|
-
</div>
|
|
268
|
-
`,
|
|
269
|
-
styles: [`
|
|
270
|
-
.card-container {
|
|
271
|
-
max-width: 1200px;
|
|
272
|
-
margin: 0 auto;
|
|
273
|
-
padding: 20px;
|
|
274
|
-
}
|
|
275
|
-
`]
|
|
276
|
-
})
|
|
277
|
-
export class CardExampleComponent {
|
|
278
|
-
cardConfig: AICardConfig = {
|
|
279
|
-
cardTitle: 'Company Profile',
|
|
280
|
-
cardSubtitle: 'Detailed company information',
|
|
24
|
+
export class ExampleComponent {
|
|
25
|
+
card: AICardConfig = {
|
|
26
|
+
cardTitle: 'Example Card',
|
|
281
27
|
sections: [
|
|
282
28
|
{
|
|
283
|
-
title: '
|
|
29
|
+
title: 'Info',
|
|
284
30
|
type: 'info',
|
|
285
31
|
fields: [
|
|
286
|
-
{ label: '
|
|
287
|
-
{ label: 'Employees', value: '250' },
|
|
288
|
-
{ label: 'Founded', value: '2010' }
|
|
289
|
-
]
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
title: 'Key Metrics',
|
|
293
|
-
type: 'analytics',
|
|
294
|
-
fields: [
|
|
295
|
-
{
|
|
296
|
-
label: 'Revenue',
|
|
297
|
-
value: 5000000,
|
|
298
|
-
change: 15,
|
|
299
|
-
trend: 'up'
|
|
300
|
-
}
|
|
32
|
+
{ label: 'Name', value: 'Example' }
|
|
301
33
|
]
|
|
302
34
|
}
|
|
303
|
-
],
|
|
304
|
-
actions: [
|
|
305
|
-
{
|
|
306
|
-
type: 'website',
|
|
307
|
-
label: 'Visit Website',
|
|
308
|
-
variant: 'primary',
|
|
309
|
-
url: 'https://example.com'
|
|
310
|
-
}
|
|
311
35
|
]
|
|
312
36
|
};
|
|
313
|
-
|
|
314
|
-
onFieldClick(event: CardFieldInteractionEvent): void {
|
|
315
|
-
console.log('Field clicked:', event);
|
|
316
|
-
// Handle field click logic here
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
onCardInteraction(event: any): void {
|
|
320
|
-
console.log('Card interaction:', event);
|
|
321
|
-
// Handle card interaction logic here
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### Step 5: Import Types (Optional but Recommended)
|
|
327
|
-
|
|
328
|
-
For better TypeScript support, import the types you need:
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
import {
|
|
332
|
-
AICardConfig, // Main card configuration type
|
|
333
|
-
CardSection, // Section configuration type
|
|
334
|
-
CardField, // Field configuration type
|
|
335
|
-
CardAction, // Action configuration type
|
|
336
|
-
CardType, // Card type enum
|
|
337
|
-
SectionType // Section type union
|
|
338
|
-
} from 'osi-cards-lib';
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Step 6: Verify Installation
|
|
342
|
-
|
|
343
|
-
After completing the steps above, verify everything is working:
|
|
344
|
-
|
|
345
|
-
1. ✅ Check that `node_modules/osi-cards-lib` exists
|
|
346
|
-
2. ✅ Verify components can be imported without TypeScript errors
|
|
347
|
-
3. ✅ Ensure styles are applied (check browser DevTools)
|
|
348
|
-
4. ✅ Test rendering a simple card in your application
|
|
349
|
-
5. ✅ Check browser console for any errors
|
|
350
|
-
|
|
351
|
-
### Common Import Patterns
|
|
352
|
-
|
|
353
|
-
#### Importing Multiple Components
|
|
354
|
-
|
|
355
|
-
```typescript
|
|
356
|
-
import {
|
|
357
|
-
AICardRendererComponent,
|
|
358
|
-
MasonryGridComponent,
|
|
359
|
-
CardSkeletonComponent
|
|
360
|
-
} from 'osi-cards-lib';
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
#### Importing Services
|
|
364
|
-
|
|
365
|
-
```typescript
|
|
366
|
-
import {
|
|
367
|
-
IconService,
|
|
368
|
-
SectionNormalizationService,
|
|
369
|
-
MagneticTiltService
|
|
370
|
-
} from 'osi-cards-lib';
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
#### Importing Utilities
|
|
374
|
-
|
|
375
|
-
```typescript
|
|
376
|
-
import {
|
|
377
|
-
// Utility functions are available through the main export
|
|
378
|
-
} from 'osi-cards-lib';
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
See [IMPORT_EXAMPLE.md](./IMPORT_EXAMPLE.md) for comprehensive import examples and advanced usage patterns.
|
|
382
|
-
|
|
383
|
-
## Usage
|
|
384
|
-
|
|
385
|
-
### Basic Card Configuration
|
|
386
|
-
|
|
387
|
-
The card component accepts a `cardConfig` input of type `AICardConfig`. Here's a basic example:
|
|
388
|
-
|
|
389
|
-
```typescript
|
|
390
|
-
import { AICardConfig } from 'osi-cards-lib';
|
|
391
|
-
|
|
392
|
-
const card: AICardConfig = {
|
|
393
|
-
cardTitle: 'Company Profile',
|
|
394
|
-
cardSubtitle: 'Detailed company information',
|
|
395
|
-
sections: [
|
|
396
|
-
{
|
|
397
|
-
title: 'Company Info',
|
|
398
|
-
type: 'info',
|
|
399
|
-
fields: [
|
|
400
|
-
{ label: 'Industry', value: 'Technology' },
|
|
401
|
-
{ label: 'Employees', value: '250' },
|
|
402
|
-
{ label: 'Founded', value: '2010' }
|
|
403
|
-
]
|
|
404
|
-
}
|
|
405
|
-
]
|
|
406
|
-
};
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Using the Card in Your Template
|
|
410
|
-
|
|
411
|
-
```html
|
|
412
|
-
<app-ai-card-renderer [cardConfig]="card"></app-ai-card-renderer>
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### Card Component Inputs
|
|
416
|
-
|
|
417
|
-
The `AICardRendererComponent` accepts the following inputs:
|
|
418
|
-
|
|
419
|
-
- `cardConfig: AICardConfig` - **Required**. The card configuration object
|
|
420
|
-
- `tiltEnabled: boolean` - Enable/disable magnetic tilt effect (default: `true`)
|
|
421
|
-
- `loading: boolean` - Show loading skeleton (default: `false`)
|
|
422
|
-
- `streamingStage: StreamingStage` - Current streaming stage for animations
|
|
423
|
-
|
|
424
|
-
### Card Component Outputs (Events)
|
|
425
|
-
|
|
426
|
-
The component emits the following events:
|
|
427
|
-
|
|
428
|
-
- `cardInteraction` - Emitted when the card is interacted with
|
|
429
|
-
- `fieldInteraction` - Emitted when a field is clicked/interacted
|
|
430
|
-
- `agentAction` - Emitted when an agent action is triggered
|
|
431
|
-
- `questionAction` - Emitted when a question action is triggered
|
|
432
|
-
|
|
433
|
-
Example with event handlers:
|
|
434
|
-
|
|
435
|
-
```typescript
|
|
436
|
-
<app-ai-card-renderer
|
|
437
|
-
[cardConfig]="cardConfig"
|
|
438
|
-
(fieldInteraction)="handleFieldClick($event)"
|
|
439
|
-
(cardInteraction)="handleCardClick($event)">
|
|
440
|
-
</app-ai-card-renderer>
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
### Example Card Configurations
|
|
444
|
-
|
|
445
|
-
#### Simple Info Card
|
|
446
|
-
|
|
447
|
-
```typescript
|
|
448
|
-
const infoCard: AICardConfig = {
|
|
449
|
-
cardTitle: 'Contact Information',
|
|
450
|
-
sections: [
|
|
451
|
-
{
|
|
452
|
-
title: 'Details',
|
|
453
|
-
type: 'info',
|
|
454
|
-
fields: [
|
|
455
|
-
{ label: 'Name', value: 'John Doe' },
|
|
456
|
-
{ label: 'Email', value: 'john@example.com' },
|
|
457
|
-
{ label: 'Phone', value: '+1 234 567 8900' }
|
|
458
|
-
]
|
|
459
|
-
}
|
|
460
|
-
]
|
|
461
|
-
};
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
#### Card with Analytics
|
|
465
|
-
|
|
466
|
-
```typescript
|
|
467
|
-
const analyticsCard: AICardConfig = {
|
|
468
|
-
cardTitle: 'Sales Dashboard',
|
|
469
|
-
sections: [
|
|
470
|
-
{
|
|
471
|
-
title: 'Q4 Performance',
|
|
472
|
-
type: 'analytics',
|
|
473
|
-
fields: [
|
|
474
|
-
{
|
|
475
|
-
label: 'Revenue',
|
|
476
|
-
value: 125000,
|
|
477
|
-
change: 12.5,
|
|
478
|
-
trend: 'up',
|
|
479
|
-
format: 'currency'
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
label: 'Growth',
|
|
483
|
-
value: 8.3,
|
|
484
|
-
change: 2.1,
|
|
485
|
-
trend: 'up',
|
|
486
|
-
format: 'percentage'
|
|
487
|
-
}
|
|
488
|
-
]
|
|
489
|
-
}
|
|
490
|
-
]
|
|
491
|
-
};
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
#### Card with Multiple Sections
|
|
495
|
-
|
|
496
|
-
```typescript
|
|
497
|
-
const multiSectionCard: AICardConfig = {
|
|
498
|
-
cardTitle: 'Company Overview',
|
|
499
|
-
cardSubtitle: 'Complete company profile',
|
|
500
|
-
sections: [
|
|
501
|
-
{
|
|
502
|
-
title: 'Company Info',
|
|
503
|
-
type: 'overview',
|
|
504
|
-
fields: [
|
|
505
|
-
{ label: 'Industry', value: 'Technology' },
|
|
506
|
-
{ label: 'Employees', value: '250' }
|
|
507
|
-
]
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
title: 'Key Metrics',
|
|
511
|
-
type: 'analytics',
|
|
512
|
-
fields: [
|
|
513
|
-
{ label: 'Revenue', value: 5000000, change: 15, trend: 'up' }
|
|
514
|
-
]
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
title: 'Contact',
|
|
518
|
-
type: 'contact-card',
|
|
519
|
-
fields: [
|
|
520
|
-
{
|
|
521
|
-
name: 'John Doe',
|
|
522
|
-
role: 'CEO',
|
|
523
|
-
email: 'john@company.com',
|
|
524
|
-
phone: '+1 234 567 8900'
|
|
525
|
-
}
|
|
526
|
-
]
|
|
527
|
-
}
|
|
528
|
-
],
|
|
529
|
-
actions: [
|
|
530
|
-
{
|
|
531
|
-
type: 'website',
|
|
532
|
-
label: 'Visit Website',
|
|
533
|
-
url: 'https://company.com',
|
|
534
|
-
variant: 'primary'
|
|
535
|
-
}
|
|
536
|
-
]
|
|
537
|
-
};
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
### All Section Types
|
|
541
|
-
|
|
542
|
-
The library supports 20+ section types:
|
|
543
|
-
|
|
544
|
-
- `info` - Key-value pairs
|
|
545
|
-
- `overview` - Compact overview display
|
|
546
|
-
- `analytics` - Metrics with trends
|
|
547
|
-
- `contact-card` - Contact information cards
|
|
548
|
-
- `network-card` - Network relationship cards
|
|
549
|
-
- `map` - Location display (requires Leaflet for full functionality)
|
|
550
|
-
- `financials` - Financial data
|
|
551
|
-
- `event` - Timeline/event display
|
|
552
|
-
- `list` - List items
|
|
553
|
-
- `chart` - Chart visualization (requires Chart.js for full functionality)
|
|
554
|
-
- `product` - Product information
|
|
555
|
-
- `solutions` - Solutions display
|
|
556
|
-
- `quotation` - Quote/testimonial cards
|
|
557
|
-
- `text-reference` - Text references
|
|
558
|
-
- `brand-colors` - Brand color swatches
|
|
559
|
-
- `fallback` - Fallback for unknown types
|
|
560
|
-
|
|
561
|
-
### Component Events
|
|
562
|
-
|
|
563
|
-
```typescript
|
|
564
|
-
<app-ai-card-renderer
|
|
565
|
-
[cardConfig]="cardConfig"
|
|
566
|
-
(cardInteraction)="onCardInteraction($event)"
|
|
567
|
-
(fieldInteraction)="onFieldInteraction($event)"
|
|
568
|
-
(agentAction)="onAgentAction($event)"
|
|
569
|
-
(questionAction)="onQuestionAction($event)">
|
|
570
|
-
</app-ai-card-renderer>
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
### Card Actions
|
|
574
|
-
|
|
575
|
-
Cards support multiple action types:
|
|
576
|
-
|
|
577
|
-
- `mail` - Email actions (requires email configuration)
|
|
578
|
-
- `website` - Open URL
|
|
579
|
-
- `agent` - Trigger agent action
|
|
580
|
-
- `question` - Pre-filled question
|
|
581
|
-
|
|
582
|
-
See `USAGE.md` for detailed API documentation.
|
|
583
|
-
|
|
584
|
-
## Features
|
|
585
|
-
|
|
586
|
-
- ✅ 20+ section types
|
|
587
|
-
- ✅ Fully standalone (no app dependencies)
|
|
588
|
-
- ✅ Magnetic tilt effects
|
|
589
|
-
- ✅ Smooth animations
|
|
590
|
-
- ✅ Responsive masonry layout
|
|
591
|
-
- ✅ TypeScript support
|
|
592
|
-
- ✅ Fully typed interfaces
|
|
593
|
-
- ✅ Accessible (ARIA support)
|
|
594
|
-
- ✅ Customizable styling
|
|
595
|
-
|
|
596
|
-
## Building
|
|
597
|
-
|
|
598
|
-
To build the library:
|
|
599
|
-
|
|
600
|
-
```bash
|
|
601
|
-
ng build osi-cards-lib
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
Output will be in `dist/osi-cards-lib/`.
|
|
605
|
-
|
|
606
|
-
## Distribution
|
|
607
|
-
|
|
608
|
-
### NPM Package
|
|
609
|
-
|
|
610
|
-
```bash
|
|
611
|
-
cd dist/osi-cards-lib
|
|
612
|
-
npm pack
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### Direct Distribution
|
|
616
|
-
|
|
617
|
-
Share the `dist/osi-cards-lib/` folder directly.
|
|
618
|
-
|
|
619
|
-
### Monorepo
|
|
620
|
-
|
|
621
|
-
Use path references in `package.json`:
|
|
622
|
-
|
|
623
|
-
```json
|
|
624
|
-
{
|
|
625
|
-
"dependencies": {
|
|
626
|
-
"osi-cards-lib": "file:../osi-cards-lib/dist/osi-cards-lib"
|
|
627
|
-
}
|
|
628
37
|
}
|
|
629
38
|
```
|
|
630
39
|
|
|
631
|
-
##
|
|
632
|
-
|
|
633
|
-
### Module Not Found
|
|
634
|
-
|
|
635
|
-
**Error**: `Cannot find module 'osi-cards-lib'`
|
|
636
|
-
|
|
637
|
-
**Solutions**:
|
|
638
|
-
- Ensure the library is installed: `npm install osi-cards-lib`
|
|
639
|
-
- If using local path, verify the path in `package.json` is correct
|
|
640
|
-
- Restart your development server after installation
|
|
641
|
-
- Clear `node_modules` and reinstall: `rm -rf node_modules && npm install`
|
|
642
|
-
|
|
643
|
-
### Styles Not Loading
|
|
644
|
-
|
|
645
|
-
**Error**: Components render but styles are not applied
|
|
646
|
-
|
|
647
|
-
**Solutions**:
|
|
648
|
-
- Verify styles are imported in `styles.scss` or `angular.json`
|
|
649
|
-
- Check the import path: `@import 'osi-cards-lib/styles/_styles';`
|
|
650
|
-
- Ensure SCSS is configured in your Angular project
|
|
651
|
-
- Restart the development server after adding styles
|
|
652
|
-
|
|
653
|
-
### Icons Not Showing
|
|
654
|
-
|
|
655
|
-
**Error**: Icons are missing or not displaying
|
|
656
|
-
|
|
657
|
-
**Solutions**:
|
|
658
|
-
- Ensure `lucide-angular` is installed: `npm install lucide-angular@^0.548.0`
|
|
659
|
-
- Verify the version matches the peer dependency requirement
|
|
660
|
-
- Check browser console for icon-related errors
|
|
661
|
-
|
|
662
|
-
### TypeScript Type Errors
|
|
663
|
-
|
|
664
|
-
**Error**: TypeScript cannot find types or interfaces
|
|
665
|
-
|
|
666
|
-
**Solutions**:
|
|
667
|
-
- Restart TypeScript server in your IDE (VS Code: Cmd/Ctrl + Shift + P → "TypeScript: Restart TS Server")
|
|
668
|
-
- Verify the library was built correctly: `ng build osi-cards-lib`
|
|
669
|
-
- Check that `osi-cards-lib` is accessible in `node_modules`
|
|
670
|
-
- Ensure your Angular version is 18.0.0 or higher (18.x or 20.x supported)
|
|
671
|
-
|
|
672
|
-
### Build Errors
|
|
673
|
-
|
|
674
|
-
**Error**: Angular build fails with dependency errors
|
|
675
|
-
|
|
676
|
-
**Solutions**:
|
|
677
|
-
- Verify all peer dependencies are installed
|
|
678
|
-
- Check Angular version compatibility (requires Angular 18+ or 20+)
|
|
679
|
-
- Ensure all imports use the correct paths
|
|
680
|
-
- Clear build cache: `rm -rf .angular && ng build`
|
|
681
|
-
|
|
682
|
-
### Optional Dependencies Not Working
|
|
683
|
-
|
|
684
|
-
**Error**: Charts or maps not rendering properly
|
|
685
|
-
|
|
686
|
-
**Solutions**:
|
|
687
|
-
- Install optional dependencies: `npm install chart.js leaflet`
|
|
688
|
-
- Verify they're listed in your `package.json`
|
|
689
|
-
- Check browser console for specific errors
|
|
690
|
-
- Note: Charts and maps will still render without these, but with limited functionality
|
|
691
|
-
|
|
692
|
-
## Verification Checklist
|
|
693
|
-
|
|
694
|
-
After importing the library, verify:
|
|
695
|
-
|
|
696
|
-
- [ ] Library is installed in `node_modules/osi-cards-lib`
|
|
697
|
-
- [ ] All peer dependencies are installed
|
|
698
|
-
- [ ] **Providers are configured** - `provideOSICards()` added to `app.config.ts`
|
|
699
|
-
- [ ] Components can be imported without TypeScript errors
|
|
700
|
-
- [ ] Styles are imported and applied correctly
|
|
701
|
-
- [ ] Icons are displaying properly
|
|
702
|
-
- [ ] Animations are working (check component entrance animations)
|
|
703
|
-
- [ ] TypeScript types are available and working
|
|
704
|
-
- [ ] No console errors in browser
|
|
705
|
-
- [ ] Components render correctly in the application
|
|
706
|
-
|
|
707
|
-
## Additional Resources
|
|
708
|
-
|
|
709
|
-
- [IMPORT_EXAMPLE.md](./IMPORT_EXAMPLE.md) - Comprehensive import examples and usage patterns
|
|
710
|
-
- [USAGE.md](./USAGE.md) - Detailed API documentation and advanced usage
|
|
711
|
-
|
|
712
|
-
## Troubleshooting
|
|
713
|
-
|
|
714
|
-
### Module Not Found
|
|
715
|
-
|
|
716
|
-
**Error**: `Cannot find module 'osi-cards-lib'`
|
|
717
|
-
|
|
718
|
-
**Solutions**:
|
|
719
|
-
- Ensure the library is installed: `npm install osi-cards-lib`
|
|
720
|
-
- If using local path, verify the path in `package.json` is correct
|
|
721
|
-
- Restart your development server after installation
|
|
722
|
-
- Clear `node_modules` and reinstall: `rm -rf node_modules && npm install`
|
|
723
|
-
|
|
724
|
-
### Styles Not Loading
|
|
725
|
-
|
|
726
|
-
**Error**: Components render but styles are not applied
|
|
727
|
-
|
|
728
|
-
**Solutions**:
|
|
729
|
-
- Verify styles are imported in `styles.scss` or `angular.json`
|
|
730
|
-
- Check the import path: `@import 'osi-cards-lib/styles/_styles';`
|
|
731
|
-
- Ensure SCSS is configured in your Angular project
|
|
732
|
-
- Restart the development server after adding styles
|
|
733
|
-
|
|
734
|
-
### Icons Not Showing
|
|
735
|
-
|
|
736
|
-
**Error**: Icons are missing or not displaying
|
|
737
|
-
|
|
738
|
-
**Solutions**:
|
|
739
|
-
- Ensure `lucide-angular` is installed: `npm install lucide-angular@^0.548.0`
|
|
740
|
-
- Verify the version matches the peer dependency requirement
|
|
741
|
-
- Check browser console for icon-related errors
|
|
742
|
-
|
|
743
|
-
### TypeScript Type Errors
|
|
744
|
-
|
|
745
|
-
**Error**: TypeScript cannot find types or interfaces
|
|
746
|
-
|
|
747
|
-
**Solutions**:
|
|
748
|
-
- Restart TypeScript server in your IDE (VS Code: Cmd/Ctrl + Shift + P → "TypeScript: Restart TS Server")
|
|
749
|
-
- Verify the library was built correctly: `ng build osi-cards-lib`
|
|
750
|
-
- Check that `osi-cards-lib` is accessible in `node_modules`
|
|
751
|
-
- Ensure your Angular version is 18.0.0 or higher (18.x or 20.x supported)
|
|
752
|
-
|
|
753
|
-
### Build Errors
|
|
754
|
-
|
|
755
|
-
**Error**: Angular build fails with dependency errors
|
|
756
|
-
|
|
757
|
-
**Solutions**:
|
|
758
|
-
- Verify all peer dependencies are installed
|
|
759
|
-
- Check Angular version compatibility (requires Angular 18+ or 20+)
|
|
760
|
-
- Ensure all imports use the correct paths
|
|
761
|
-
- Clear build cache: `rm -rf .angular && ng build`
|
|
762
|
-
|
|
763
|
-
### Optional Dependencies Not Working
|
|
764
|
-
|
|
765
|
-
**Error**: Charts or maps not rendering properly
|
|
766
|
-
|
|
767
|
-
**Solutions**:
|
|
768
|
-
- Install optional dependencies: `npm install chart.js leaflet`
|
|
769
|
-
- Verify they're listed in your `package.json`
|
|
770
|
-
- Check browser console for specific errors
|
|
771
|
-
- Note: Charts and maps will still render without these, but with limited functionality
|
|
772
|
-
|
|
773
|
-
## Migration Guide
|
|
774
|
-
|
|
775
|
-
### Migrating from App to Library
|
|
776
|
-
|
|
777
|
-
If you're migrating from using the app directly to using the library:
|
|
778
|
-
|
|
779
|
-
1. **Install the library**:
|
|
780
|
-
```bash
|
|
781
|
-
npm install osi-cards-lib
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
2. **Update imports**:
|
|
785
|
-
```typescript
|
|
786
|
-
// Before
|
|
787
|
-
import { AICardRendererComponent } from './shared/components/cards';
|
|
788
|
-
|
|
789
|
-
// After
|
|
790
|
-
import { AICardRendererComponent } from 'osi-cards-lib';
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
3. **Import styles**:
|
|
794
|
-
```scss
|
|
795
|
-
@import 'osi-cards-lib/styles/_styles';
|
|
796
|
-
```
|
|
797
|
-
|
|
798
|
-
4. **Update service usage**:
|
|
799
|
-
- Services are not exported from the library
|
|
800
|
-
- Use the library components directly
|
|
801
|
-
- Implement your own data providers if needed
|
|
802
|
-
|
|
803
|
-
5. **Update state management**:
|
|
804
|
-
- The library doesn't include NgRx store
|
|
805
|
-
- Manage card state in your application
|
|
806
|
-
- Pass card configs as inputs to components
|
|
807
|
-
|
|
808
|
-
### Breaking Changes
|
|
809
|
-
|
|
810
|
-
#### Version 1.0.0
|
|
811
|
-
|
|
812
|
-
- All components are now standalone
|
|
813
|
-
- Services are not exported (use components directly)
|
|
814
|
-
- NgRx store is not included (manage state in your app)
|
|
815
|
-
|
|
816
|
-
## Advanced Usage
|
|
817
|
-
|
|
818
|
-
### Custom Section Types
|
|
819
|
-
|
|
820
|
-
To add custom section types, extend the library components or create your own:
|
|
821
|
-
|
|
822
|
-
```typescript
|
|
823
|
-
import { BaseSectionComponent } from 'osi-cards-lib';
|
|
824
|
-
|
|
825
|
-
@Component({
|
|
826
|
-
selector: 'app-custom-section',
|
|
827
|
-
standalone: true,
|
|
828
|
-
imports: [CommonModule],
|
|
829
|
-
template: `...`
|
|
830
|
-
})
|
|
831
|
-
export class CustomSectionComponent extends BaseSectionComponent {
|
|
832
|
-
// Custom implementation
|
|
833
|
-
}
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
### Theming
|
|
837
|
-
|
|
838
|
-
Override design tokens in your styles:
|
|
839
|
-
|
|
840
|
-
```scss
|
|
841
|
-
:root {
|
|
842
|
-
--color-brand: #your-color;
|
|
843
|
-
--card-background: rgba(your, values, here);
|
|
844
|
-
--card-padding: 1.5rem;
|
|
845
|
-
}
|
|
846
|
-
```
|
|
847
|
-
|
|
848
|
-
### Performance Optimization
|
|
849
|
-
|
|
850
|
-
- Use OnPush change detection (already enabled)
|
|
851
|
-
- Implement virtual scrolling for large lists
|
|
852
|
-
- Lazy load section components if needed
|
|
853
|
-
- Use trackBy functions with *ngFor
|
|
854
|
-
|
|
855
|
-
## API Reference
|
|
856
|
-
|
|
857
|
-
See [IMPORT_EXAMPLE.md](./IMPORT_EXAMPLE.md) for comprehensive import examples and [USAGE.md](./USAGE.md) for detailed API documentation.
|
|
40
|
+
## Documentation
|
|
858
41
|
|
|
859
|
-
|
|
42
|
+
For complete documentation, visit: https://github.com/Inutilepat83/OSI-Cards
|
|
860
43
|
|
|
861
|
-
|
|
44
|
+
## Version
|
|
862
45
|
|
|
46
|
+
1.3.0
|