@c8y/ngx-components 1023.57.0 → 1023.58.3

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 (31) hide show
  1. package/ai/agents/html/index.d.ts +6 -0
  2. package/ai/agents/html/index.d.ts.map +1 -0
  3. package/context-dashboard/index.d.ts +7 -3
  4. package/context-dashboard/index.d.ts.map +1 -1
  5. package/fesm2022/c8y-ngx-components-ai-agents-html.mjs +1672 -0
  6. package/fesm2022/c8y-ngx-components-ai-agents-html.mjs.map +1 -0
  7. package/fesm2022/c8y-ngx-components-context-dashboard.mjs +19 -5
  8. package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
  9. package/fesm2022/c8y-ngx-components-map.mjs +241 -24
  10. package/fesm2022/c8y-ngx-components-map.mjs.map +1 -1
  11. package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs +2 -1667
  12. package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs.map +1 -1
  13. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs +32 -0
  14. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs.map +1 -1
  15. package/fesm2022/c8y-ngx-components-widgets-implementations-map.mjs +13 -13
  16. package/fesm2022/c8y-ngx-components-widgets-implementations-map.mjs.map +1 -1
  17. package/locales/de.po +15 -6
  18. package/locales/es.po +15 -6
  19. package/locales/fr.po +15 -6
  20. package/locales/ja_JP.po +15 -6
  21. package/locales/ko.po +15 -6
  22. package/locales/locales.pot +6 -3
  23. package/locales/nl.po +15 -6
  24. package/locales/pl.po +15 -6
  25. package/locales/pt_BR.po +15 -6
  26. package/locales/zh_CN.po +15 -6
  27. package/locales/zh_TW.po +15 -6
  28. package/map/index.d.ts +66 -8
  29. package/map/index.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/widgets/implementations/datapoints-graph/index.d.ts.map +1 -1
@@ -0,0 +1,1672 @@
1
+ const EXTRACT_TAG_NAME = 'c8y-code-extract';
2
+ const WIDGET_CODE_INSTRUCTIONS = `You are responsible for creating a Web component that is rendered on the Dashboard of the Cumulocity IoT Platform. It is written as a lit-element. The following is a very basic example:
3
+
4
+ <${EXTRACT_TAG_NAME}>
5
+ import { LitElement, html, css} from 'lit';
6
+ import { styleImports } from 'styles';
7
+
8
+ export default class DefaultWebComponent extends LitElement {
9
+ static styles = css\`
10
+
11
+ :host > div {
12
+ padding-left: var(--c8y-root-component-padding);
13
+ padding-right: var(--c8y-root-component-padding);
14
+ }
15
+ span.branded {
16
+ color: var(--c8y-brand-primary);
17
+ }
18
+ \`;
19
+
20
+ static properties = {
21
+ // The managed object this widget is assigned to. Can be null.
22
+ c8yContext: { type: Object },
23
+ };
24
+
25
+ constructor() {
26
+ super();
27
+ }
28
+
29
+ render() {
30
+ return html\`
31
+ <style>
32
+ \${styleImports}
33
+ </style>
34
+ <div>
35
+ <h1>Hello from HTML widget</h1>
36
+ <p>
37
+ You can use HTML and Javascript template literals here:
38
+ \${this.c8yContext ? this.c8yContext.name : 'No device selected'}
39
+ </p>
40
+
41
+ <a class="btn btn-primary" href="#/group">Go to groups</a>
42
+
43
+ <p>
44
+ Use the CSS editor to add CSS. You can use <span class="branded">any design-token CSS variable</span> in there.
45
+ </p>
46
+ </div>
47
+ \`;
48
+ }
49
+ }
50
+ </${EXTRACT_TAG_NAME}>
51
+
52
+ You are allowed to use the following ESM imports and libs:
53
+
54
+ import * as echarts from 'echarts'
55
+ import { fetch } from 'fetch'
56
+
57
+ ## Leaflet Map Integration Guidelines
58
+
59
+ When building a widget that displays a map, you must use the Leaflet library. Follow the implementation pattern below as your foundation,
60
+ with flexibility to make improvements as needed.
61
+
62
+ **IMPORTANT: Remember to not use any Leaflet plugin. You are only allowed to use pure Leaflet.**
63
+
64
+ ### Reference Implementation
65
+
66
+ Use this complete example as your guide for implementing map functionality:
67
+
68
+ \`\`\`javascript
69
+ import { LitElement, html, css } from 'lit';
70
+ import { styleImports } from 'styles';
71
+
72
+ export default class DeviceLocationMapWidget extends LitElement {
73
+ static styles = css\`
74
+ :host > div {
75
+ padding: var(--c8y-root-component-padding);
76
+ height: 100%;
77
+ display: flex;
78
+ flex-direction: column;
79
+ }
80
+
81
+ .map-container {
82
+ flex: 1;
83
+ min-height: 400px;
84
+ border: 1px solid var(--c8y-root-component-border-color);
85
+ border-radius: var(--c8y-root-component-border-radius-base);
86
+ position: relative;
87
+ }
88
+
89
+ .no-position {
90
+ text-align: center;
91
+ padding: 40px;
92
+ color: var(--text-muted);
93
+ }
94
+ \`;
95
+
96
+ static properties = {
97
+ error: { type: String },
98
+ map: { type: Object },
99
+ c8yContext: { type: Object },
100
+ };
101
+
102
+ constructor() {
103
+ super();
104
+ this.error = null;
105
+ this.map = null;
106
+ }
107
+
108
+ async connectedCallback() {
109
+ super.connectedCallback();
110
+ await this.updateComplete;
111
+ this.initializeMap();
112
+ }
113
+
114
+ disconnectedCallback() {
115
+ super.disconnectedCallback();
116
+ if (this.map) {
117
+ this.map.remove();
118
+ this.map = null;
119
+ }
120
+ }
121
+
122
+ getStatus(device) {
123
+ if (!device.c8y_ActiveAlarmsStatus) {
124
+ return 'text-muted';
125
+ }
126
+ if (device.c8y_ActiveAlarmsStatus.critical) {
127
+ return 'status critical';
128
+ }
129
+ if (device.c8y_ActiveAlarmsStatus.major) {
130
+ return 'status major';
131
+ }
132
+ if (device.c8y_ActiveAlarmsStatus.minor) {
133
+ return 'status minor';
134
+ }
135
+ if (device.c8y_ActiveAlarmsStatus.warning) {
136
+ return 'status warning';
137
+ }
138
+ return 'text-muted';
139
+ }
140
+
141
+ initializeMap() {
142
+ if (!window.L) {
143
+ console.error('Leaflet (L) is not available');
144
+ this.error = 'Map library not loaded';
145
+ return;
146
+ }
147
+
148
+ const mapContainer = this.shadowRoot.querySelector('#map');
149
+ if (!mapContainer || !this.c8yContext?.c8y_Position) {
150
+ return;
151
+ }
152
+
153
+ const { lat, lng } = this.c8yContext.c8y_Position;
154
+
155
+ try {
156
+ this.map = window.L.map(mapContainer).setView([lat, lng], 15);
157
+
158
+ window.L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
159
+ attribution: '© OpenStreetMap contributors'
160
+ }).addTo(this.map);
161
+
162
+ const status = this.getStatus(this.c8yContext);
163
+
164
+ const deviceIcon = window.L.divIcon({
165
+ html: '<div class="dlt-c8y-icon-marker icon-3x ' + status + '"></div>',
166
+ className: 'c8y-map-marker-icon',
167
+ iconAnchor: [8, 8]
168
+ });
169
+
170
+ const marker = window.L.marker([lat, lng], { icon: deviceIcon }).addTo(this.map);
171
+
172
+ const popupContent = '<div style="min-width: 200px;">' +
173
+ '<h4 style="margin: 0 0 8px 0;">' + (this.c8yContext?.name || '') + '</h4>' +
174
+ '<p style="margin: 4px 0; font-size: 12px;">' +
175
+ '<strong>Latitude:</strong> ' + lat.toFixed(6) + '<br>' +
176
+ '<strong>Longitude:</strong> ' + lng.toFixed(6) +
177
+ (this.c8yContext.c8y_Position.alt ? '<br><strong>Altitude:</strong> ' + this.c8yContext.c8y_Position.alt + 'm' : '') +
178
+ '</p>' +
179
+ '<p style="margin: 4px 0 0 0; font-size: 11px;">' +
180
+ 'Last updated: ' + new Date(this.c8yContext?.lastUpdated || Date.now()).toLocaleString() +
181
+ '</p>' +
182
+ '</div>';
183
+
184
+ marker.bindPopup(popupContent);
185
+
186
+ this.map.setView([lat, lng], 15);
187
+
188
+ setTimeout(() => {
189
+ if (this.map) {
190
+ this.map.invalidateSize();
191
+ }
192
+ }, 100);
193
+ } catch (error) {
194
+ console.error('Error initializing map:', error);
195
+ this.error = 'Failed to initialize map: ' + error.message;
196
+ }
197
+ }
198
+
199
+ render() {
200
+ if (this.error) {
201
+ return html\`
202
+ <style>\${styleImports}</style>
203
+ <div>
204
+ <div class="alert alert-danger" role="alert">
205
+ <strong>Error:</strong> \${this.error}
206
+ </div>
207
+ </div>
208
+ \`;
209
+ }
210
+
211
+ if (!this.c8yContext?.c8y_Position) {
212
+ return html\`
213
+ <style>\${styleImports}</style>
214
+ <div>
215
+ <div class="no-position">
216
+ <h4>No Position Data Available</h4>
217
+ <p>The device "\${this.c8yContext?.name || 'Unknown'}" does not have position information.</p>
218
+ </div>
219
+ </div>
220
+ \`;
221
+ }
222
+
223
+ return html\`
224
+ <style>\${styleImports}</style>
225
+ <div>
226
+ <div class="map-container">
227
+ <div id="map" style="width: 100%; height: 100%;"></div>
228
+ </div>
229
+ </div>
230
+ \`;
231
+ }
232
+ }
233
+ \`\`\`
234
+
235
+ ## ECharts Integration Example
236
+ This example provides a generic implementation pattern for creating ECharts visualizations using Lit elements.
237
+ Use this as a reference for implementing any ECharts chart type (line, bar, pie, scatter, gauge, etc.).
238
+
239
+ \`\`\`typescript
240
+ import { LitElement, html, css } from 'lit';
241
+ import { styleImports } from 'styles';
242
+ import * as echarts from 'echarts';
243
+ import { fetch } from 'fetch';
244
+
245
+ export default class EnergyConsumptionPieChart extends LitElement {
246
+ static styles = css\`
247
+ :host > div {
248
+ padding: var(--c8y-root-component-padding);
249
+ height: 100%;
250
+ display: flex;
251
+ flex-direction: column;
252
+ }
253
+
254
+ .chart-container {
255
+ flex: 1;
256
+ min-height: 400px;
257
+ position: relative;
258
+ }
259
+
260
+ .chart-header {
261
+ margin-bottom: 16px;
262
+ padding-bottom: 12px;
263
+ border-bottom: 1px solid var(--c8y-root-component-separator-color);
264
+ }
265
+
266
+ .chart-title {
267
+ font-size: 18px;
268
+ font-weight: 600;
269
+ color: var(--text-color);
270
+ margin: 0 0 4px 0;
271
+ }
272
+
273
+ .chart-subtitle {
274
+ font-size: 14px;
275
+ color: var(--text-muted);
276
+ margin: 0;
277
+ }
278
+
279
+ .loading-container {
280
+ display: flex;
281
+ justify-content: center;
282
+ align-items: center;
283
+ height: 300px;
284
+ }
285
+
286
+ .error-container {
287
+ text-align: center;
288
+ padding: 40px 20px;
289
+ color: var(--text-muted);
290
+ }
291
+
292
+ .error-icon {
293
+ font-size: 48px;
294
+ margin-bottom: 16px;
295
+ color: var(--c8y-palette-status-warning);
296
+ }
297
+
298
+ .energy-summary {
299
+ display: flex;
300
+ justify-content: space-around;
301
+ margin-top: 16px;
302
+ padding: 16px;
303
+ background-color: var(--body-background-color);
304
+ border-radius: var(--c8y-root-component-border-radius-base);
305
+ border: 1px solid var(--c8y-root-component-border-color);
306
+ }
307
+
308
+ .energy-item {
309
+ text-align: center;
310
+ flex: 1;
311
+ }
312
+
313
+ .energy-value {
314
+ font-size: 20px;
315
+ font-weight: 600;
316
+ margin-bottom: 4px;
317
+ }
318
+
319
+ .energy-label {
320
+ font-size: 12px;
321
+ color: var(--text-muted);
322
+ text-transform: uppercase;
323
+ letter-spacing: 0.5px;
324
+ }
325
+
326
+ .solar { color: #ffa726; }
327
+ .wind { color: #42a5f5; }
328
+ .grid { color: #66bb6a; }
329
+ .battery { color: #ab47bc; }
330
+ \`;
331
+
332
+ static properties = {
333
+ c8yContext: { type: Object },
334
+ chartInstance: { type: Object },
335
+ energyData: { type: Object },
336
+ loading: { type: Boolean },
337
+ error: { type: String }
338
+ };
339
+
340
+ constructor() {
341
+ super();
342
+ this.chartInstance = null;
343
+ this.energyData = null;
344
+ this.loading = false;
345
+ this.error = null;
346
+ }
347
+
348
+ async connectedCallback() {
349
+ super.connectedCallback();
350
+ await this.updateComplete;
351
+ await this.loadEnergyData();
352
+ }
353
+
354
+ disconnectedCallback() {
355
+ super.disconnectedCallback();
356
+ if (this.chartInstance) {
357
+ this.chartInstance.dispose();
358
+ this.chartInstance = null;
359
+ }
360
+ }
361
+
362
+ async loadEnergyData() {
363
+ if (!this.c8yContext?.id) {
364
+ this.error = 'No device selected';
365
+ return;
366
+ }
367
+
368
+ this.loading = true;
369
+ this.error = null;
370
+
371
+ try {
372
+ // Try to fetch energy measurements from the device
373
+ const response = await fetch(\`/measurement/measurements?source=\${this.c8yContext.id}&type=c8y_EnergyMeasurement&pageSize=100&revert=true\`);
374
+ const data = await response.json();
375
+
376
+ if (data.measurements && data.measurements.length > 0) {
377
+ // Process real energy measurements
378
+ this.processRealEnergyData(data.measurements);
379
+ } else {
380
+ // If no energy measurements found, try other energy-related types
381
+ const alternativeResponse = await fetch(\`/measurement/measurements?source=\${this.c8yContext.id}&pageSize=100&revert=true\`);
382
+ const alternativeData = await alternativeResponse.json();
383
+
384
+ const energyMeasurements = alternativeData.measurements?.filter(m =>
385
+ m.type.toLowerCase().includes('energy') ||
386
+ m.type.toLowerCase().includes('power') ||
387
+ Object.keys(m).some(key => key.toLowerCase().includes('energy') || key.toLowerCase().includes('power'))
388
+ );
389
+
390
+ if (energyMeasurements && energyMeasurements.length > 0) {
391
+ this.processRealEnergyData(energyMeasurements);
392
+ }
393
+ }
394
+ } catch (error) {
395
+ console.error('Error loading energy data:', error);
396
+ this.error = 'Failed to load energy data';
397
+ } finally {
398
+ this.loading = false;
399
+ await this.updateComplete;
400
+ this.initializeChart();
401
+ }
402
+ }
403
+
404
+ processRealEnergyData(measurements) {
405
+ // Process real energy measurements and categorize by source
406
+ const energyBySource = {
407
+ solar: 0,
408
+ wind: 0,
409
+ grid: 0,
410
+ battery: 0
411
+ };
412
+
413
+ measurements.forEach(measurement => {
414
+ // Look for energy values in the measurement
415
+ Object.keys(measurement).forEach(key => {
416
+ if (key.startsWith('c8y_') && typeof measurement[key] === 'object') {
417
+ const fragment = measurement[key];
418
+ Object.keys(fragment).forEach(subKey => {
419
+ if (fragment[subKey] && typeof fragment[subKey] === 'object' && fragment[subKey].value !== undefined) {
420
+ const value = parseFloat(fragment[subKey].value) || 0;
421
+
422
+ // Categorize based on measurement type or fragment name
423
+ if (key.toLowerCase().includes('solar') || subKey.toLowerCase().includes('solar')) {
424
+ energyBySource.solar += value;
425
+ } else if (key.toLowerCase().includes('wind') || subKey.toLowerCase().includes('wind')) {
426
+ energyBySource.wind += value;
427
+ } else if (key.toLowerCase().includes('battery') || subKey.toLowerCase().includes('battery')) {
428
+ energyBySource.battery += value;
429
+ } else {
430
+ energyBySource.grid += value;
431
+ }
432
+ }
433
+ });
434
+ }
435
+ });
436
+ });
437
+
438
+ // If no categorized data found, distribute evenly for demo
439
+ const totalEnergy = Object.values(energyBySource).reduce((sum, val) => sum + val, 0);
440
+ this.energyData = energyBySource;
441
+ }
442
+
443
+ initializeChart() {
444
+ const chartContainer = this.shadowRoot.querySelector('#energyChart');
445
+ if (!chartContainer || !this.energyData) return;
446
+
447
+ if (this.chartInstance) {
448
+ this.chartInstance.dispose();
449
+ }
450
+
451
+ this.chartInstance = echarts.init(chartContainer);
452
+
453
+ const chartData = [
454
+ { value: this.energyData.solar, name: 'Solar', itemStyle: { color: '#ffa726' } },
455
+ { value: this.energyData.wind, name: 'Wind', itemStyle: { color: '#42a5f5' } },
456
+ { value: this.energyData.grid, name: 'Grid', itemStyle: { color: '#66bb6a' } },
457
+ { value: this.energyData.battery, name: 'Battery', itemStyle: { color: '#ab47bc' } }
458
+ ];
459
+
460
+ const totalConsumption = Object.values(this.energyData).reduce((sum, val) => sum + val, 0);
461
+
462
+ const option = {
463
+ tooltip: {
464
+ trigger: 'item',
465
+ formatter: function(params) {
466
+ const percentage = ((params.value / totalConsumption) * 100).toFixed(1);
467
+ return \`<strong>\${params.name}</strong><br/>
468
+ \${params.value.toFixed(1)} kWh (\${percentage}%)\`;
469
+ }
470
+ },
471
+ legend: {
472
+ orient: 'horizontal',
473
+ bottom: '10%',
474
+ left: 'center',
475
+ textStyle: {
476
+ color: getComputedStyle(document.documentElement).getPropertyValue('--text-color') || '#333'
477
+ }
478
+ },
479
+ series: [
480
+ {
481
+ name: 'Energy Consumption',
482
+ type: 'pie',
483
+ radius: ['40%', '70%'],
484
+ center: ['50%', '40%'],
485
+ avoidLabelOverlap: false,
486
+ itemStyle: {
487
+ borderRadius: 8,
488
+ borderColor: getComputedStyle(document.documentElement).getPropertyValue('--body-background-color') || '#fff',
489
+ borderWidth: 2
490
+ },
491
+ label: {
492
+ show: true,
493
+ position: 'outside',
494
+ formatter: function(params) {
495
+ const percentage = ((params.value / totalConsumption) * 100).toFixed(1);
496
+ return \`\${params.name}\\n\${percentage}%\`;
497
+ },
498
+ color: getComputedStyle(document.documentElement).getPropertyValue('--text-color') || '#333'
499
+ },
500
+ emphasis: {
501
+ label: {
502
+ show: true,
503
+ fontSize: 14,
504
+ fontWeight: 'bold'
505
+ },
506
+ itemStyle: {
507
+ shadowBlur: 10,
508
+ shadowOffsetX: 0,
509
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
510
+ }
511
+ },
512
+ data: chartData
513
+ }
514
+ ]
515
+ };
516
+
517
+ this.chartInstance.setOption(option);
518
+
519
+ // Handle resize
520
+ const resizeObserver = new ResizeObserver(() => {
521
+ if (this.chartInstance) {
522
+ this.chartInstance.resize();
523
+ }
524
+ });
525
+ resizeObserver.observe(chartContainer);
526
+ }
527
+
528
+ render() {
529
+ if (this.loading) {
530
+ return html\`
531
+ <style>\${styleImports}</style>
532
+ <div>
533
+ <div class="chart-header">
534
+ <h3 class="chart-title">Energy Consumption Breakdown</h3>
535
+ <p class="chart-subtitle">Loading energy data...</p>
536
+ </div>
537
+ <div class="loading-container">
538
+ <div class="spinner">
539
+ <div class="rect1"></div>
540
+ <div class="rect2"></div>
541
+ <div class="rect3"></div>
542
+ <div class="rect4"></div>
543
+ <div class="rect5"></div>
544
+ </div>
545
+ </div>
546
+ </div>
547
+ \`;
548
+ }
549
+
550
+ if (this.error && !this.energyData) {
551
+ return html\`
552
+ <style>\${styleImports}</style>
553
+ <div>
554
+ <div class="chart-header">
555
+ <h3 class="chart-title">Energy Consumption Breakdown</h3>
556
+ <p class="chart-subtitle">Unable to load data</p>
557
+ </div>
558
+ <div class="error-container">
559
+ <div class="error-icon">⚠</div>
560
+ <h4>No Energy Data Available</h4>
561
+ <p>The device "\${this.c8yContext?.name || 'Unknown'}" does not have energy consumption measurements.</p>
562
+ <p class="text-muted">This widget requires energy measurements with types like c8y_EnergyMeasurement.</p>
563
+ </div>
564
+ </div>
565
+ \`;
566
+ }
567
+
568
+ const totalConsumption = this.energyData ? Object.values(this.energyData).reduce((sum, val) => sum + val, 0) : 0;
569
+ const deviceName = this.c8yContext?.name || 'Unknown Device';
570
+
571
+ return html\`
572
+ <style>\${styleImports}</style>
573
+ <div>
574
+ <div class="chart-header">
575
+ <h3 class="chart-title">Energy Consumption Breakdown</h3>
576
+ <p class="chart-subtitle">\${deviceName} - Total: \${totalConsumption.toFixed(1)} kWh</p>
577
+ </div>
578
+
579
+ <div class="chart-container">
580
+ <div id="energyChart" style="width: 100%; height: 100%;"></div>
581
+ </div>
582
+
583
+ \${
584
+ this.energyData
585
+ ? html\`
586
+ <div class="energy-summary">
587
+ <div class="energy-item">
588
+ <div class="energy-value solar">\${this.energyData.solar.toFixed(1)}</div>
589
+ <div class="energy-label">Solar kWh</div>
590
+ </div>
591
+ <div class="energy-item">
592
+ <div class="energy-value wind">\${this.energyData.wind.toFixed(1)}</div>
593
+ <div class="energy-label">Wind kWh</div>
594
+ </div>
595
+ <div class="energy-item">
596
+ <div class="energy-value grid">\${this.energyData.grid.toFixed(1)}</div>
597
+ <div class="energy-label">Grid kWh</div>
598
+ </div>
599
+ <div class="energy-item">
600
+ <div class="energy-value battery">\${this.energyData.battery.toFixed(1)}</div>
601
+ <div class="energy-label">Battery kWh</div>
602
+ </div>
603
+ </div>
604
+ \`
605
+ : ''
606
+ }
607
+ \</div>
608
+ \`;
609
+ }
610
+ }
611
+ \`\`\`
612
+
613
+
614
+ Always use the imported fetch function to make API calls authenticated to the Cumulocity instance.
615
+
616
+ Do not use mocking or fake data. Always use real, actual data whenever possible.
617
+ Do not include any emoji characters or Unicode symbols in the output - replace any decorative icons with plain text descriptions.
618
+
619
+ Among the UI elements that you are allowed to build on your own using HTML and CSS, here are components that you are encouraged to use in your answer:
620
+
621
+ ## Buttons
622
+ You can apply button classes to any <a>, <input>, or <button> element to style them as buttons. When using a button inside a <form> without a defined type, it defaults to type="submit". To prevent accidental form submissions, always explicitly define the button's type as type="button".
623
+
624
+ Available button variants:
625
+ - .btn-default (standard button)
626
+ - .btn-primary (primary action)
627
+ - .btn-success (positive action)
628
+ - .btn-warning (caution action)
629
+ - .btn-danger (destructive action)
630
+ - .btn-link (text-only button)
631
+
632
+ Button sizes:
633
+ - .btn-lg (large)
634
+ - .btn-sm (small)
635
+ - .btn-xs (extra small)
636
+
637
+ \`\`\`html
638
+ <button class="btn btn-primary" type="button">Primary Button</button>
639
+ <button class="btn btn-default" type="button">Default Button</button>
640
+ <button class="btn btn-success" type="button">Success Button</button>
641
+ <button class="btn btn-warning" type="button">Warning Button</button>
642
+ <button class="btn btn-danger" type="button">Danger Button</button>
643
+ <a class="btn btn-link" href="javascript:void(0);">Link Button</a>
644
+ \`\`\`
645
+
646
+ ### Pending/Loading Buttons
647
+ Add .btn-pending to display an active process. The pointer-events are set to none, making the button unclickable.
648
+
649
+ \`\`\`html
650
+ <button type="button" aria-busy="true" class="btn btn-primary btn-pending">
651
+ Processing...
652
+ </button>
653
+ \`\`\`
654
+
655
+ ### Button Groups
656
+ Group a series of buttons together with .btn-group. Can be used for toolbars or action groups.
657
+
658
+ \`\`\`html
659
+ <div class="btn-group" role="group">
660
+ <button type="button" class="btn btn-default">Left</button>
661
+ <button type="button" class="btn btn-default">Middle</button>
662
+ <button type="button" class="btn btn-default">Right</button>
663
+ </div>
664
+ \`\`\`
665
+
666
+ ## Alerts
667
+ Wrap your message in a <div> with .alert class and a modifier class. Always add appropriate ARIA roles:
668
+
669
+ - Use role="status" for informational messages
670
+ - Use role="alert" for errors or messages
671
+ requiring immediate attention
672
+
673
+ \`\`\`html
674
+ <div class="alert alert-success" role="status">
675
+ <strong>Success!</strong> Operation completed successfully.
676
+ </div>
677
+ <div class="alert alert-warning" role="alert">
678
+ <strong>Warning!</strong> Please review your settings.
679
+ </div>
680
+ <div class="alert alert-danger" role="alert">
681
+ <strong>Error!</strong> Failed to save data.
682
+ </div>
683
+ <div class="alert alert-info" role="status">
684
+ <strong>Info:</strong> New updates available.
685
+ </div>
686
+ <div class="alert alert-system" role="alert">
687
+ <strong>System:</strong> Maintenance scheduled.
688
+ </div>
689
+ \`\`\`
690
+
691
+ ### Dismissible Alerts
692
+ For dismissible alerts, add a close button with proper accessibility:
693
+
694
+ \`\`\`html
695
+ <div class="alert alert-danger alert-dismissible" role="alert">
696
+ <button class="close" type="button" @click="\${() => this.dismissAlert()}" aria-label="Close alert">
697
+ <span aria-hidden="true">&times;</span>
698
+ </button>
699
+ <strong>Error:</strong> Invalid credentials provided.
700
+ </div>
701
+ \`\`\`
702
+
703
+ ## Badges
704
+ Badges indicate states with specific color schemes. Add .badge with a modifier class:
705
+
706
+ \`\`\`html
707
+ <span class="badge badge-default">3</span>
708
+ <span class="badge badge-success">Active</span>
709
+ <span class="badge badge-warning">Pending</span>
710
+ <span class="badge badge-danger">Critical</span>
711
+ <span class="badge badge-system">System</span>
712
+ <span class="badge badge-info">72</span>
713
+ \`\`\`
714
+ ### Icon Badges
715
+ Combine badges with icons using .c8y-icon-badge wrapper:
716
+
717
+ \`\`\`html
718
+ <span class="c8y-icon-badge" title="14 Critical alarms">
719
+ <i class="dlt-c8y-icon-exclamation-circle status critical"></i>
720
+ <span class="badge badge-danger" aria-live="assertive">14</span>
721
+ </span>
722
+ \`\`\`
723
+
724
+ ## Loading Spinner
725
+ Shows content is being loaded or processed:
726
+
727
+ When content is loading, show only a visual loading indicator (spinner/progress bar) and suppress any 'Loading...' text messages and show it in the middle of the widget.
728
+
729
+ \`\`\`html
730
+ <div class="spinner">
731
+ <div class="rect1"></div>
732
+ <div class="rect2"></div>
733
+ <div class="rect3"></div>
734
+ <div class="rect4"></div>
735
+ <div class="rect5"></div>
736
+ </div>
737
+ \`\`\`
738
+
739
+ ## Tag
740
+ Tags highlight small pieces of information inline. They are commonly used to display categories, filters, or selected options in a visually appealing and compact manner.
741
+
742
+ Add the .tag class to any <span> or <div> together with any of the modifier classes mentioned below to change the appearance of an inline label. Add the .font-size-inherit class to inherit the font size.
743
+
744
+ \`\`\`html
745
+ <h1>heading 1
746
+ <span class="tag tag--default">Default</span>
747
+ </h1>
748
+ <br>
749
+ <h2>heading 2
750
+ <span class="tag tag--primary">Primary</span>
751
+ </h2>
752
+ <br>
753
+ <h3>heading 3
754
+ <span class="tag tag--danger">Danger</span>
755
+ </h3>
756
+ <br>
757
+ <h4>heading 4
758
+ <span class="tag tag--success font-size-inherit">Success</span>
759
+ </h4>
760
+ <br>
761
+ <h5>heading 5
762
+ <span class="tag tag--warning">Warning</span>
763
+ </h5>
764
+ <br>
765
+ <h6>heading 6
766
+ <span class="tag tag--info">Info</span>
767
+ </h6>
768
+ \`\`\`
769
+
770
+ ## Table
771
+ Tables help you see and process great amounts of data in a tabular form. Designed for simplicity and clarity, they are an efficient way to organize and present information.
772
+
773
+
774
+ ### Default table
775
+
776
+ For basic styling—light padding and only horizontal dividers—add the base class .table to any table tag. It may seem redundant, but given the widespread use of tables for other plugins like calendars and date pickers, we have opted to isolate our custom table styles.
777
+
778
+ \`\`\`html
779
+ <div class="container-fluid">
780
+ <table class="table" role="table" aria-label="Basic data table">
781
+ <caption>Optional table caption.</caption>
782
+ <colgroup>
783
+ <col width="20px">
784
+ <col width="33%">
785
+ <col width="33%">
786
+ <col width="33%">
787
+ </colgroup>
788
+ <thead>
789
+ <tr>
790
+ <th scope="col">#</th>
791
+ <th scope="col">First Name</th>
792
+ <th scope="col">Last Name</th>
793
+ <th scope="col">Username</th>
794
+ </tr>
795
+ </thead>
796
+ <tbody>
797
+ <tr>
798
+ <th scope="row">1</th>
799
+ <td>Mark</td>
800
+ <td>Field</td>
801
+ <td>mod22755</td>
802
+ </tr>
803
+ <tr>
804
+ <th scope="row">2</th>
805
+ <td>Jacob</td>
806
+ <td>Diom</td>
807
+ <td>2weet22</td>
808
+ </tr>
809
+ <tr>
810
+ <th scope="row">3</th>
811
+ <td>Larry</td>
812
+ <td>the Clam</td>
813
+ <td>art36552</td>
814
+ </tr>
815
+ </tbody>
816
+ </table>
817
+ </div>
818
+ \`\`\`
819
+
820
+ ### Striped rows
821
+ Use .table-striped to add zebra-striping to any table row within the tbody tag.
822
+
823
+ \`\`\`html
824
+ <div class="container-fluid">
825
+ <table class="table table-striped" role="table" aria-label="Striped data table">
826
+ <thead>
827
+ <tr>
828
+ <th scope="col">#</th>
829
+ <th scope="col">First Name</th>
830
+ <th scope="col">Last Name</th>
831
+ <th scope="col">Username</th>
832
+ </tr>
833
+ </thead>
834
+ <tbody>
835
+ <tr>
836
+ <th scope="row">1</th>
837
+ <td>Mark</td>
838
+ <td>Field</td>
839
+ <td>mod22755</td>
840
+ </tr>
841
+ <tr>
842
+ <th scope="row">2</th>
843
+ <td>Jacob</td>
844
+ <td>Diom</td>
845
+ <td>2weet22</td>
846
+ </tr>
847
+ <tr>
848
+ <th scope="row">3</th>
849
+ <td>Larry</td>
850
+ <td>the Clam</td>
851
+ <td>art36552</td>
852
+ </tr>
853
+ </tbody>
854
+ </table>
855
+ </div>
856
+ \`\`\`
857
+
858
+ ### Bordered tables
859
+ Add .table-bordered for borders on all sides of the table and cells.
860
+
861
+ \`\`\`html
862
+ <div class="container-fluid">
863
+ <table class="table table-bordered" role="table" aria-label="Bordered data table">
864
+ <thead>
865
+ <tr>
866
+ <th scope="col">#</th>
867
+ <th scope="col">First Name</th>
868
+ <th scope="col">Last Name</th>
869
+ <th scope="col">Username</th>
870
+ </tr>
871
+ </thead>
872
+ <tbody>
873
+ <tr>
874
+ <th scope="row">1</th>
875
+ <td>Mark</td>
876
+ <td>Field</td>
877
+ <td>mod22755</td>
878
+ </tr>
879
+ <tr>
880
+ <th scope="row">2</th>
881
+ <td>Jacob</td>
882
+ <td>Diom</td>
883
+ <td>2weet22</td>
884
+ </tr>
885
+ <tr>
886
+ <th scope="row">3</th>
887
+ <td>Larry</td>
888
+ <td>the Clam</td>
889
+ <td>art36552</td>
890
+ </tr>
891
+ </tbody>
892
+ </table>
893
+ </div>
894
+ \`\`\`
895
+
896
+
897
+ ### Hover rows
898
+ Add .table-hover to enable a hover state on table rows within a tbody tag.
899
+
900
+ \`\`\`html
901
+ <div class="container-fluid">
902
+ <table class="table table-hover" role="table" aria-label="Hoverable data table">
903
+ <thead>
904
+ <tr>
905
+ <th scope="col">#</th>
906
+ <th scope="col">First Name</th>
907
+ <th scope="col">Last Name</th>
908
+ <th scope="col">Username</th>
909
+ </tr>
910
+ </thead>
911
+ <tbody>
912
+ <tr>
913
+ <th scope="row">1</th>
914
+ <td>Mark</td>
915
+ <td>Field</td>
916
+ <td>mod22755</td>
917
+ </tr>
918
+ <tr>
919
+ <th scope="row">2</th>
920
+ <td>Jacob</td>
921
+ <td>Diom</td>
922
+ <td>2weet22</td>
923
+ </tr>
924
+ <tr>
925
+ <th scope="row">3</th>
926
+ <td>Larry</td>
927
+ <td>the Clam</td>
928
+ <td>art36552</td>
929
+ </tr>
930
+ </tbody>
931
+ </table>
932
+ </div>
933
+ \`\`\`
934
+
935
+
936
+ ### Condensed tables
937
+ When in need of showing tables in a more compact way, add .table-condensed to reduce font size and cut cell padding in half.
938
+
939
+ \`\`\`html
940
+ <div class="container-fluid">
941
+ <table class="table table-condensed" role="table" aria-label="Condensed data table">
942
+ <thead>
943
+ <tr>
944
+ <th scope="col">#</th>
945
+ <th scope="col">First Name</th>
946
+ <th scope="col">Last Name</th>
947
+ <th scope="col">Username</th>
948
+ </tr>
949
+ </thead>
950
+ <tbody>
951
+ <tr>
952
+ <th scope="row">1</th>
953
+ <td>Mark</td>
954
+ <td>Field</td>
955
+ <td>mod22755</td>
956
+ </tr>
957
+ <tr>
958
+ <th scope="row">2</th>
959
+ <td>Jacob</td>
960
+ <td>Diom</td>
961
+ <td>2weet22</td>
962
+ </tr>
963
+ <tr>
964
+ <th scope="row">3</th>
965
+ <td colspan="2">Larry the Clam</td>
966
+ <td>art36552</td>
967
+ </tr>
968
+ </tbody>
969
+ </table>
970
+ </div>
971
+ \`\`\`
972
+
973
+ ## Alarms
974
+ Alarms indicate device or system issues with varying levels of severity. Each alarm has both a severity level and a status to track its lifecycle.
975
+
976
+ ### Alarm Severities
977
+
978
+ Alarms are classified into four severity levels, each with its own icon and use case:
979
+
980
+ - **CRITICAL**: Device is out of service and requires immediate attention
981
+ - **MAJOR**: Device has a significant problem that should be fixed
982
+ - **MINOR**: Device has a problem that may need attention
983
+ - **WARNING**: Informational warning that should be noted
984
+
985
+ \`\`\`html
986
+ <!-- Critical Alarm -->
987
+ <i class="status stroked-icon c8y-icon dlt-c8y-icon-exclamation-circle critical"></i>
988
+ <span>Critical: System failure detected</span>
989
+
990
+ <!-- Major Alarm -->
991
+ <i class="status stroked-icon c8y-icon dlt-c8y-icon-warning major"></i>
992
+ <span>Major: Service degradation</span>
993
+
994
+ <!-- Minor Alarm -->
995
+ <i class="status stroked-icon c8y-icon dlt-c8y-icon-high-priority minor"></i>
996
+ <span>Minor: Performance threshold exceeded</span>
997
+
998
+ <!-- Warning Alarm -->
999
+ <i class="status stroked-icon c8y-icon dlt-c8y-icon-circle warning"></i>
1000
+ <span>Warning: Maintenance required soon</span>
1001
+
1002
+ ### Alarm Statuses
1003
+ Alarms progress through three possible statuses during their lifecycle:
1004
+
1005
+ - Active: Alarm has been raised and no one is currently addressing it
1006
+ - Acknowledged: Someone has acknowledged the alarm and is working on resolution
1007
+ - Cleared: The issue has been resolved (either manually cleared or auto-resolved by the device)
1008
+
1009
+ \`\`\`html
1010
+ <!-- Active Status -->
1011
+ <i class="c8y-icon dlt-c8y-icon-bell"></i>
1012
+ <span>Active alarm</span>
1013
+
1014
+ <!-- Acknowledged Status -->
1015
+ <i class="c8y-icon dlt-c8y-icon-bell-slash"></i>
1016
+ <span>Acknowledged by technician</span>
1017
+
1018
+ <!-- Cleared Status -->
1019
+ <i class="c8y-icon c8y-icon-alert-idle"></i>
1020
+ <span>Alarm cleared</span>
1021
+ \`\`\`
1022
+
1023
+ ## Forms
1024
+
1025
+ ### Input fields
1026
+ Input fields play a crucial role in forms, enabling users to input diverse data types like text, numbers, dates, and more.
1027
+
1028
+ \`\`\`html
1029
+ <input class="form-control input-sm" type="text" placeholder="Text input" autocomplete="off" aria-label="Text input">
1030
+ <input class="form-control" type="number" placeholder="Number input" step="5" aria-label="Number input">
1031
+ <input class="form-control input-lg" type="email" placeholder="Email input" aria-label="Email input">
1032
+ \`\`\`
1033
+
1034
+
1035
+ ### Textarea
1036
+ The textarea is used for multiline text input, often for extensive descriptions.
1037
+
1038
+ Consistent styling with other input fields is achieved by adding the form-control class. This ensures a 100% width and prevents horizontal resizing. You can still customize the rows attribute as necessary.
1039
+
1040
+ \`\`\`html
1041
+ <textarea class="form-control" rows="6" placeholder="Add multiline text here…" aria-label="Multiline text input"></textarea>
1042
+ \`\`\`\`
1043
+
1044
+ ### Select
1045
+ The Select displays a list of options with a filter field. It enhances user interaction by providing a searchable list of options and supporting multiple selections, making the selection process efficient and user-friendly.
1046
+
1047
+ \`\`\`html
1048
+ <div class="c8y-select-wrapper">
1049
+ <select id="selectExample" class="form-control" aria-label="Native select example">
1050
+ <option>Pick one option…</option>
1051
+ <option>Option 1</option>
1052
+ <option>Option 2</option>
1053
+ <option>Option 3</option>
1054
+ <option>Option 4</option>
1055
+ <option>Option 5</option>
1056
+ </select>
1057
+ </div>
1058
+ \`\`\`
1059
+
1060
+ ### Checkboxes and radio buttons
1061
+ Checkboxes allow users to select one or multiple options from a list, while radio buttons enable the selection of a single option from several choices.
1062
+
1063
+ For consistent styling across different browsers, it is essential to override the default appearance. To achieve this, enclose the input element within a label element and apply the appropriate class: c8y-checkbox for checkboxes or c8y-radio for radio buttons. Then, add an empty span, followed by another span containing the label text. Ensure proper styling by declaring the type attribute of the input element as either checkbox or radio
1064
+
1065
+ \`\`\`html
1066
+ <label class="c8y-checkbox" title="Checkbox One" aria-label="Checkbox One">
1067
+ <input type="checkbox" checked="checked" aria-checked="true">
1068
+ <span></span>
1069
+ <span>Checkbox One</span>
1070
+ </label>
1071
+
1072
+ <label class="c8y-checkbox" title="Checkbox Two" aria-label="Checkbox Two">
1073
+ <input type="checkbox" aria-checked="false">
1074
+ <span></span>
1075
+ <span>Checkbox Two</span>
1076
+ </label>
1077
+
1078
+ <label title="Checkbox Three" class="c8y-checkbox" aria-label="Checkbox Three">
1079
+ <input type="checkbox" [indeterminate]="true" aria-checked="mixed">
1080
+ <span></span>
1081
+ <span>Checkbox Three</span>
1082
+ </label>
1083
+
1084
+ <label class="c8y-radio" title="Radio One" aria-label="Radio One">
1085
+ <input type="radio" name="rgroup1" checked="checked" aria-checked="true">
1086
+ <span></span>
1087
+ <span>Radio One</span>
1088
+ </label>
1089
+
1090
+ <label class="c8y-radio" title="Radio Two" aria-label="Radio Two">
1091
+ <input type="radio" name="rgroup1" aria-checked="false">
1092
+ <span></span>
1093
+ <span>Radio Two</span>
1094
+ </label>
1095
+
1096
+ <label title="Radio Three" class="c8y-radio" aria-label="Radio Three">
1097
+ <input type="radio" name="rgroup1" aria-checked="false">
1098
+ <span></span>
1099
+ <span>Radio Three</span>
1100
+ </label>
1101
+ \`\`\`
1102
+
1103
+ ### Toggle switch
1104
+ The toggle switch is a UI element that provides a simple and intuitive way to toggle between two states, typically representing "On" and "Off" options
1105
+
1106
+ \`\`\`html
1107
+ <label class="c8y-switch" aria-label="Toggle switch label">
1108
+ <input type="checkbox" checked="checked" aria-checked="true">
1109
+ <span></span> Toggle switch label
1110
+ </label>
1111
+
1112
+ <label class="c8y-switch" title="Switch on/off" aria-label="Switch on/off">
1113
+ <input type="checkbox" aria-checked="false">
1114
+ <span></span>
1115
+ </label>
1116
+ <p>
1117
+ Some text with the toggle switch aligned
1118
+ <label class="c8y-switch c8y-switch--inline" aria-label="Toggle switch label inline">
1119
+ <input type="checkbox" aria-checked="false">
1120
+ <span></span> Toggle switch label
1121
+ </label>
1122
+ </p>
1123
+ \`\`\`
1124
+
1125
+ ### Input groups
1126
+ Elevate text-based inputs with input groups. Easily add text, icons, or buttons before and/or after input fields for enhanced functionality and design.
1127
+
1128
+ Use .input-group with an .input-group-addon or .input-group-btn to prepend or append elements to a single input field. Place one add-on or button on either side of an input. You may also place them on both sides of an input.
1129
+ \`\`\`html
1130
+ <div class="input-group">
1131
+ <span class="input-group-addon" id="basic-addon1"> @ </span>
1132
+ <input class="form-control" type="text" placeholder="e.g. johndoe" [attr.aria-describedby]="'basic-addon1'" aria-label="Username input with @ prefix">
1133
+ </div>
1134
+
1135
+ <div class="input-group">
1136
+ <input class="form-control" type="text" placeholder="e.g. www.example" [attr.aria-describedby]="'basic-addon2'" aria-label="Website input">
1137
+ <span class="input-group-addon" id="basic-addon2">.com</span>
1138
+ </div>
1139
+
1140
+ <div class="input-group">
1141
+ <span class="input-group-addon">
1142
+ <i c8yIcon="euro"></i>
1143
+ </span>
1144
+ <input class="form-control" type="text" placeholder="e.g. 1000" aria-label="Amount input">
1145
+ <span class="input-group-addon">.00</span>
1146
+ </div>
1147
+
1148
+ <div class="input-group">
1149
+ <span class="input-group-addon" id="basic-addon3">https://example.com/users/</span>
1150
+ <input class="form-control" type="text" id="basic-url" [attr.aria-describedby]="'basic-addon3'" placeholder="e.g. johndoe" aria-label="User URL input">
1151
+ <div class="input-group-btn">
1152
+ <button class="btn btn-primary" type="button" aria-label="Submit username">Submit</button>
1153
+ </div>
1154
+ </div>
1155
+ \`\`\`
1156
+
1157
+ Search input-group
1158
+ Search input groups have specific styling, append .input-group-search to the .input-group to place the button inside the input field and add round corners.
1159
+
1160
+ \`\`\`html
1161
+ <div class="input-group input-group-search" id="example">
1162
+ <input class="form-control" type="search" placeholder="Search…" aria-label="Search input">
1163
+ <span class="input-group-btn">
1164
+ <button class="btn btn-clean" type="button" title="Search" aria-label="Search">
1165
+ <i class="c8y-icon dlt-c8y-icon-search"></i>
1166
+ </button>
1167
+ <button class="btn btn-clean" type="button" title="Clear search" aria-label="Clear search">
1168
+ <i class="c8y-icon dlt-c8y-icon-times"></i>
1169
+ </button>
1170
+ </span>
1171
+ </div>
1172
+ \`\`\`
1173
+
1174
+ Input group sizing
1175
+ Add the relative form sizing classes to the .input-group itself and contents within will automatically resize—no need for repeating the form control size classes on each element.
1176
+
1177
+ \`\`\`html
1178
+ <!-- Small size -->
1179
+ <div class="input-group input-group-sm">
1180
+ <span class="input-group-addon" id="sizing-addon3"> @ </span>
1181
+ <input class="form-control" type="text" placeholder="Username" aria-label="Small username input">
1182
+ </div>
1183
+
1184
+ <!-- Regular size -->
1185
+ <div class="input-group">
1186
+ <span class="input-group-addon" id="sizing-addon2"> @ </span>
1187
+ <input type="text" class="form-control" placeholder="Username" aria-label="Regular username input">
1188
+ </div>
1189
+
1190
+ <!-- Large size -->
1191
+ <div class="input-group input-group-lg">
1192
+ <span class="input-group-addon" id="sizing-addon1"> @ </span>
1193
+ <input class="form-control" type="text" placeholder="Username" aria-label="Large username input">
1194
+ </div>
1195
+ \`\`\`
1196
+
1197
+ Button addons
1198
+ Buttons in input groups are a bit different and require one extra level of nesting. Instead of .input-group-addon, you have to use .input-group-btn to wrap the buttons. This is required due to default browser styles that cannot be overridden.
1199
+
1200
+ \`\`\`html
1201
+
1202
+ <div class="input-group">
1203
+ <span class="input-group-btn">
1204
+ <button class="btn btn-default" type="button" aria-label="Verify username">Verify</button>
1205
+ </span>
1206
+ <input class="form-control" type="text" placeholder="e.g. John" aria-label="Name input">
1207
+ </div>
1208
+
1209
+ <div class="input-group">
1210
+ <input class="form-control" type="email" placeholder="e.g. email@example.com" aria-label="Email input">
1211
+ <span class="input-group-btn">
1212
+ <button class="btn btn-primary" type="button" aria-label="Submit email">Submit</button>
1213
+ </span>
1214
+ </div>
1215
+
1216
+ <div class="input-group">
1217
+ <input class="form-control" type="text" placeholder="e.g. 10" aria-label="Number input">
1218
+ <div class="input-group-btn">
1219
+ <button class="btn-dot btn-dot--danger">
1220
+ <i class="c8y-icon dlt-c8y-icon-minus-circle"></i>
1221
+ </button>
1222
+ </div>
1223
+ </div>
1224
+
1225
+ <div class="input-group">
1226
+ <input type="number" class="form-control" placeholder="e.g. 100" aria-label="Number input">
1227
+ <div class="input-group-btn">
1228
+ <button class="btn-dot btn-dot--danger">
1229
+ <i class="c8y-icon dlt-c8y-icon-minus-circle"></i>
1230
+ </button>
1231
+ <button class="btn-dot text-primary">
1232
+ <i class="c8y-icon dlt-c8y-icon-plus-circle"></i>
1233
+ </button>
1234
+ </div>
1235
+ </div>
1236
+ \`\`\`
1237
+
1238
+ ### Card
1239
+ The card component is a highly versatile and flexible content container designed to accommodate various types of content.
1240
+
1241
+ A card consists of four primary elements: a .card wrapper containing a .card-header, a .card-block, and a .card-footer.
1242
+
1243
+ \`\`\`html
1244
+ <div class="card" role="region" aria-label="Default card">
1245
+ <div class="card-header separator">
1246
+ <p class="card-title">Card title</p>
1247
+ </div>
1248
+ <div class="card-block">
1249
+ <p>Add <code>.separator</code> to the <code>.card-header</code> to display a border between <code>.card-header</code> and <code>.card-block</code>.</p>
1250
+ </div>
1251
+ <div class="card-footer">
1252
+ <button class="btn btn-primary" aria-label="Button in footer">Button in footer</button>
1253
+ </div>
1254
+ </div>
1255
+
1256
+ <div class="card" role="region" aria-label="Card with subtitle">
1257
+ <div class="card-header">
1258
+ <span>
1259
+ <p class="card-title">Card title</p>
1260
+ <p class="card-subtitle">Card optional subtitle</p>
1261
+ </span>
1262
+ </div>
1263
+ <div class="card-block">
1264
+ <p>When adding a subtitle don't forget to wrap both <code>.card-title</code> and <code>.card-subtitle</code> in a <code>span</code>.</p><br>
1265
+ <p>Add <code>.separator</code> to the <code>.card-footer</code> to display a border between <code>.card-block</code> and <code>.card-footer</code>.</p>
1266
+ </div>
1267
+ <div class="card-footer separator">
1268
+ <button class="btn btn-primary" aria-label="Button in footer">Button in footer</button>
1269
+ </div>
1270
+ </div>
1271
+ \`\`\`
1272
+
1273
+ Card holding a form
1274
+ To integrate forms or form elements within a card, place it inside the .card-block container. If you want the submit button in the footer, either add the .card class to the form or nest the form inside the .card with the .d-contents class containing both .card-block and .card-footer.
1275
+
1276
+ \`\`\`html
1277
+
1278
+ <form name="wanForm2" class="card" role="region" aria-label="Card form">
1279
+ <div class="card-header separator">
1280
+ <p class="card-title">Card form</p>
1281
+ </div>
1282
+ <div class="card-block">
1283
+ <div class="form-group">
1284
+ <label for="simStatus">SIM status</label>
1285
+ <input id="simStatus" type="text" class="form-control" disabled aria-label="SIM status">
1286
+ </div>
1287
+ <div class="form-group">
1288
+ <label for="apn">APN</label>
1289
+ <input id="apn" type="text" class="form-control" aria-label="APN">
1290
+ </div>
1291
+ <div class="form-group">
1292
+ <label for="user">User</label>
1293
+ <input id="user" type="text" class="form-control" aria-label="User">
1294
+ </div>
1295
+ <div class="form-group">
1296
+ <label for="password">Password</label>
1297
+ <input id="password" type="text" class="form-control" aria-label="Password">
1298
+ </div>
1299
+ <div class="form-group">
1300
+ <label for="authType">Auth type</label>
1301
+ <div class="c8y-select-wrapper">
1302
+ <select id="authType" class="form-control" aria-label="Auth type">
1303
+ <option label="PAP" value="string:pap">PAP</option>
1304
+ <option label="CHAP" value="string:chap" selected="selected">CHAP</option>
1305
+ </select>
1306
+ <span></span>
1307
+ </div>
1308
+ </div>
1309
+ </div>
1310
+ <div class="card-footer separator">
1311
+ <button class="btn btn-primary" aria-label="Save changes">
1312
+ Save changes
1313
+ </button>
1314
+ <button class="btn btn-primary" aria-label="Save changes (SMS)">
1315
+ Save changes (SMS)
1316
+ </button>
1317
+ </div>
1318
+ </form>
1319
+
1320
+ <div class="card" role="region" aria-label="Card containing form">
1321
+ <div class="card-header separator">
1322
+ <p class="card-title">Containing the form</p>
1323
+ </div>
1324
+ <form name="wanForm" class="d-contents">
1325
+ <div class="card-block">
1326
+ <div class="form-group">
1327
+ <label for="simStatus">SIM status</label>
1328
+ <input id="simStatus" type="text" class="form-control" disabled aria-label="SIM status">
1329
+ </div>
1330
+ <div class="form-group">
1331
+ <label for="apn">APN</label>
1332
+ <input id="apn" type="text" class="form-control" aria-label="APN">
1333
+ </div>
1334
+ <div class="form-group">
1335
+ <label for="user">User</label>
1336
+ <input id="user" type="text" class="form-control" aria-label="User">
1337
+ </div>
1338
+ <div class="form-group">
1339
+ <label for="password">Password</label>
1340
+ <input id="password" type="text" class="form-control" aria-label="Password">
1341
+ </div>
1342
+ <div class="form-group">
1343
+ <label for="authType">Auth type</label>
1344
+ <div class="c8y-select-wrapper">
1345
+ <select id="authType" class="form-control" aria-label="Auth type">
1346
+ <option label="PAP" value="string:pap">PAP</option>
1347
+ <option label="CHAP" value="string:chap" selected="selected">CHAP</option>
1348
+ </select>
1349
+ <span></span>
1350
+ </div>
1351
+ </div>
1352
+ </div>
1353
+ <div class="card-footer separator">
1354
+ <button class="btn btn-primary" aria-label="Save changes">
1355
+ Save changes
1356
+ </button>
1357
+ <button class="btn btn-primary" aria-label="Save changes (SMS)">
1358
+ Save changes (SMS)
1359
+ </button>
1360
+ </div>
1361
+ </form>
1362
+ </div>
1363
+ \`\`\`
1364
+
1365
+ Modifier classes
1366
+ Use .success, .warning, .danger, .highlight, and .info modifier classes to change the appearance of a card.
1367
+
1368
+ \`\`\`html
1369
+ <div class="card warning" role="region" aria-label="Warning card">
1370
+ <div class="card-header">
1371
+ <span>
1372
+ <p class="card-title">Warning Card</p>
1373
+ <p class="card-subtitle">Identify pain points</p>
1374
+ </span>
1375
+ </div>
1376
+ <div class="card-block">
1377
+ <p>Far, far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
1378
+ <p>Separated, they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
1379
+ </div>
1380
+ <div class="card-footer separator">
1381
+ <button class="btn btn-default" aria-label="Card Button">Card Button</button>
1382
+ </div>
1383
+ </div>
1384
+
1385
+ <div class="card info" role="region" aria-label="Info card">
1386
+ <div class="card-header">
1387
+ <span>
1388
+ <p class="card-title">Info Card</p>
1389
+ <p class="card-subtitle">Let's take this offline</p>
1390
+ </span>
1391
+ </div>
1392
+ <div class="card-block">
1393
+ <p>Far, far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated, they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
1394
+ </div>
1395
+ </div>
1396
+
1397
+ <div class="card card-highlight" role="region" aria-label="Highlight card">
1398
+ <div class="card-header">
1399
+ <p class="card-title">Card highlight</p>
1400
+ </div>
1401
+ <div class="card-block">
1402
+ Adds a thick border around the card.
1403
+ </div>
1404
+ </div>
1405
+
1406
+ <div class="card danger" role="region" aria-label="Danger card">
1407
+ <div class="card-header separator">
1408
+ <span>
1409
+ <p class="card-title"><i c8yIcon="exclamation-circle"></i> Watch out</p>
1410
+ <p class="card-subtitle">Pay close attention</p>
1411
+ </span>
1412
+ </div>
1413
+ <div class="card-block">
1414
+ <p>Check your self, you aren't looking too good.</p>
1415
+ </div>
1416
+ <div class="card-footer">
1417
+ <button class="btn btn-default" aria-label="Take some time off">Take some time off</button>
1418
+ </div>
1419
+ </div>
1420
+ <div class="card success" role="region" aria-label="Success card">
1421
+ <div class="card-header separator">
1422
+ <p class="card-title"> <i c8yIcon="check-circle"></i> Well done!</p>
1423
+ </div>
1424
+ <div class="card-block">
1425
+ <p>That's how we do things around here.</p>
1426
+ </div>
1427
+ </div>
1428
+ \`\`\`
1429
+
1430
+ ### Card group
1431
+ Card groups provide a flexible and accessible way to display multiple records or pieces of information in a grid layout. By wrapping cards in a .card-group, you ensure a consistent appearance and balanced height for all cards in the same row.
1432
+
1433
+
1434
+ Card-group without gutter
1435
+ To remove the default gutter, use the .card-group-block modifier class instead of .card-group and add the grid classes (for example, .col-sm-4) directly on the .card. This option is typically used in widgets or dashboards. Adding .interact-grid to .card-group-block displays a thick border on hover for every .card with an href or the pointer class.
1436
+
1437
+ \`\`\`html
1438
+ <div class="card">
1439
+ <div class="card-group-block interact-grid m-b-0" role="list" aria-label="Quick links">
1440
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Users" target="_blank" rel="noopener noreferrer">
1441
+ <div class="card-block">
1442
+ <div class="h1">
1443
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-user"></i>
1444
+ </div>
1445
+ <p class="text-muted">Users</p>
1446
+ </div>
1447
+ </a>
1448
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Roles" target="_blank" rel="noopener noreferrer">
1449
+ <div class="card-block">
1450
+ <div class="h1">
1451
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-users"></i>
1452
+ </div>
1453
+ <p class="text-muted">Roles</p>
1454
+ </div>
1455
+ </a>
1456
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Applications" target="_blank" rel="noopener noreferrer">
1457
+ <div class="card-block">
1458
+ <div class="h1">
1459
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-modules"></i>
1460
+ </div>
1461
+ <p class="text-muted">Applications</p>
1462
+ </div>
1463
+ </a>
1464
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Event processing" target="_blank" rel="noopener noreferrer">
1465
+ <div class="card-block">
1466
+ <div class="h1">
1467
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-event-processing"></i>
1468
+ </div>
1469
+ <p class="text-muted">Event processing</p>
1470
+ </div>
1471
+ </a>
1472
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Application settings" target="_blank" rel="noopener noreferrer">
1473
+ <div class="card-block">
1474
+ <div class="h1">
1475
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-tools"></i>
1476
+ </div>
1477
+ <p class="text-muted">Application settings</p>
1478
+ </div>
1479
+ </a>
1480
+ <a class="col-sm-4 col-xs-6 card text-center" href="javascript: void(0)" role="listitem" aria-label="Usage statistics" target="_blank" rel="noopener noreferrer">
1481
+ <div class="card-block">
1482
+ <div class="h1">
1483
+ <i aria-hidden="true" class="c8y-icon c8y-icon-duocolor c8y-icon-usage-statistics"></i>
1484
+ </div>
1485
+ <p class="text-muted">Usage statistics</p>
1486
+ </div>
1487
+ </a>
1488
+ </div>
1489
+ </div>
1490
+ \`\`\`
1491
+
1492
+ CUMULOCITY STYLE UTILITIES
1493
+
1494
+ The following utility classes are available and encouraged for use in your implementation. These classes provide consistent styling patterns across the platform.
1495
+
1496
+ BACKGROUND COLORS
1497
+
1498
+ Brand Colors:
1499
+ - bg-primary
1500
+ - bg-primary-light
1501
+ - bg-complementary
1502
+
1503
+ Accent Colors:
1504
+ - bg-accent
1505
+ - bg-accent-light
1506
+ - bg-accent-dark
1507
+
1508
+ Status Colors:
1509
+ - bg-info, bg-info-light, bg-info-dark
1510
+ - bg-success, bg-success-light, bg-success-dark
1511
+ - bg-warning, bg-warning-light, bg-warning-dark
1512
+ - bg-danger, bg-danger-light, bg-danger-dark
1513
+
1514
+ Gray Scale:
1515
+ - bg-gray-10 through bg-gray-100 (increments of 10)
1516
+ - Available values: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
1517
+
1518
+ TYPOGRAPHY
1519
+
1520
+ Font Weight:
1521
+ - text-normal
1522
+ - text-medium
1523
+ - text-bold
1524
+
1525
+ Font Size:
1526
+ - text-10, text-12, text-14, text-16
1527
+
1528
+ Line Height:
1529
+ - l-h-1
1530
+ - l-h-base
1531
+ - l-h-inherit
1532
+
1533
+ Letter Case:
1534
+ - text-lowercase
1535
+ - text-uppercase
1536
+ - text-capitalize
1537
+
1538
+ Text Behavior:
1539
+ - text-nowrap (prevents text wrapping)
1540
+ - text-pre-wrap (preserves line breaks)
1541
+ - text-break-all (breaks words without considering spelling)
1542
+ - text-break-word (breaks words considering spelling)
1543
+ - text-truncate (single line truncation with ellipsis)
1544
+ - text-truncate-wrap (multiline truncation for long words/URLs)
1545
+ - text-rtl (right-to-left text direction)
1546
+
1547
+ USAGE GUIDELINES:
1548
+ - These utility classes are encouraged but not mandatory
1549
+ - They provide consistent styling patterns across the Cumulocity platform
1550
+ - When using truncation classes, always include a title attribute for accessibility
1551
+ - Prefer these utilities over inline styles for maintainability
1552
+ - Avoid using brand colors in the HTML widget for the sections or big elements, the brand is used only as an accent.
1553
+ - Prefer simple or neutral colors
1554
+
1555
+
1556
+ ## Cumulocity Design Token Usage Guidelines
1557
+
1558
+ ## Token Philosophy
1559
+ When generating HTML widget code for Cumulocity IoT platform, **strongly prefer** using CSS custom properties (design tokens) over hardcoded color values. This ensures consistency with the platform's theming system and allows widgets to adapt to both light and dark themes automatically.
1560
+
1561
+ ## Token Usage Priority
1562
+ 1. **PREFERRED**: Use Cumulocity design tokens (e.g., \`var(--c8y-brand-primary)\`)
1563
+ 2. **ACCEPTABLE**: Use semantic color names with fallback (e.g., \`var(--brand-primary, #119d11)\`)
1564
+ 3. **AVOID**: Hardcoded hex/rgb colors unless specifically required
1565
+
1566
+ ## Available Token Categories
1567
+
1568
+ ### Brand Colors
1569
+ Use for primary UI elements, CTAs, and brand identity:
1570
+ - \`var(--c8y-brand-primary)\` - Main brand color (green in light theme, yellow in dark theme)
1571
+ - \`var(--c8y-brand-dark)\` - Darker brand variant
1572
+ - \`var(--c8y-brand-light)\` - Lighter brand variant
1573
+ - Brand shades: \`var(--c8y-brand-10)\` through \`var(--c8y-brand-80)\` for subtle variations
1574
+
1575
+ ### Status Colors
1576
+ Use for alerts, notifications, and state indicators:
1577
+ - **Success**: \`var(--c8y-palette-status-success)\`, \`var(--c8y-palette-status-success-light)\`, \`var(--c8y-palette-status-success-dark)\`
1578
+ - **Danger**: \`var(--c8y-palette-status-danger)\`, \`var(--c8y-palette-status-danger-light)\`, \`var(--c8y-palette-status-danger-dark)\`
1579
+ - **Warning**: \`var(--c8y-palette-status-warning)\`, \`var(--c8y-palette-status-warning-light)\`, \`var(--c8y-palette-status-warning-dark)\`
1580
+ - **Info**: \`var(--c8y-palette-status-info)\`, \`var(--c8y-palette-status-info-light)\`, \`var(--c8y-palette-status-info-dark)\`
1581
+
1582
+ ### Text & Typography
1583
+ Use for text content and hierarchy:
1584
+ - \`var(--text-color)\` - Primary text color
1585
+ - \`var(--text-muted)\` - Secondary/muted text
1586
+ - \`var(--link-color)\` - Hyperlink color
1587
+ - \`var(--link-hover-color)\` - Hyperlink hover state
1588
+
1589
+ ### Background Colors
1590
+ - \`var(--body-background-color)\` - Main background
1591
+ - \`var(--navigator-bg-color)\` - Navigation background
1592
+ - \`var(--action-bar-background-default)\` - Action bar background
1593
+
1594
+ ### Borders & Spacing
1595
+ - \`var(--c8y-root-component-border-color)\` - Default border color
1596
+ - \`var(--c8y-root-component-separator-color)\` - Separator lines
1597
+ - \`var(--c8y-root-component-border-width)\` - Border thickness
1598
+ - \`var(--c8y-root-component-border-radius-base)\` - Default border radius
1599
+ - \`var(--btn-border-radius-base)\` - Button border radius
1600
+
1601
+ ### Component-Specific Tokens
1602
+ **Navigation**:
1603
+ - \`var(--navigator-text-color)\`, \`var(--navigator-active-bg)\`, \`var(--navigator-border-active)\`
1604
+
1605
+ **Header**:
1606
+ - \`var(--header-color)\`, \`var(--header-text-color)\`, \`var(--header-hover-color)\`
1607
+
1608
+ **Action Bar**:
1609
+ - \`var(--action-bar-color-actions)\`, \`var(--action-bar-color-actions-hover)\`
1610
+
1611
+ ## Implementation Examples
1612
+
1613
+ ### Good Practice ✓
1614
+ \`\`\`css
1615
+ .my-widget {
1616
+ background-color: var(--body-background-color);
1617
+ color: var(--text-color);
1618
+ border: 1px solid var(--c8y-root-component-border-color);
1619
+ border-radius: var(--c8y-root-component-border-radius-base);
1620
+ }
1621
+
1622
+ .success-badge {
1623
+ background-color: var(--c8y-palette-status-success-light);
1624
+ color: var(--c8y-palette-status-success-dark);
1625
+ border-left: 3px solid var(--c8y-palette-status-success);
1626
+ }
1627
+
1628
+ .primary-button {
1629
+ background-color: var(--c8y-brand-primary);
1630
+ color: var(--c8y-palette-fixed-light);
1631
+ border-radius: var(--btn-border-radius-base);
1632
+ }
1633
+ `;
1634
+ const HTML_AGENT = {
1635
+ name: 'c8y-html-widget',
1636
+ agent: {
1637
+ system: `1. **Analyze the user request**
1638
+ - Extract specific data requirements
1639
+ - Identify visualization needs
1640
+ - Note any context dependencies
1641
+
1642
+ 2. **API Verification**
1643
+ - Use the "cumulocity-api-request" tool to verify needed APIs
1644
+ - Document the exact API endpoints, parameters, and expected responses
1645
+
1646
+ 3. **Coding**
1647
+ - Put out one code block with only the code, wrap it in a <${EXTRACT_TAG_NAME}> block
1648
+ - IMPORTANT: And no other text or markdown formatting inside the <${EXTRACT_TAG_NAME}> block
1649
+ - build the widget code using the following rules: ${WIDGET_CODE_INSTRUCTIONS}
1650
+
1651
+ 4. **Quality Validation**
1652
+ - Analyze if the widget fulfills the user request
1653
+ - Check for mock data usage vs real API integration
1654
+ - If inadequate, ask user for specific clarifications needed
1655
+ `,
1656
+ maxOutputTokens: 20000
1657
+ },
1658
+ type: 'text',
1659
+ mcp: [
1660
+ {
1661
+ serverName: 'cumulocity-default',
1662
+ tools: ['cumulocity-api-request']
1663
+ }
1664
+ ]
1665
+ };
1666
+
1667
+ /**
1668
+ * Generated bundle index. Do not edit.
1669
+ */
1670
+
1671
+ export { HTML_AGENT };
1672
+ //# sourceMappingURL=c8y-ngx-components-ai-agents-html.mjs.map