@fundamental-ngx/ui5-webcomponents-ai 0.58.0-rc.7 → 0.58.0-rc.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,72 @@
1
1
  # ui5-webcomponents-ai
2
2
 
3
- package ui5-webcomponents-ai
3
+ Angular component wrappers around the [@ui5/webcomponents-ai](https://www.npmjs.com/package/@ui5/webcomponents-ai) npm package.
4
+
5
+ ## Overview
6
+
7
+ This library provides Angular components that wrap UI5 AI Web Components, bringing AI-powered UI elements to your Angular applications. These components integrate AI features like prompt inputs and AI-enhanced buttons with Angular's change detection and template syntax.
8
+
9
+ - Angular-friendly API (inputs, outputs, template syntax)
10
+ - TypeScript type definitions
11
+ - Full integration with Angular's change detection
12
+ - Standalone components support
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @fundamental-ngx/ui5-webcomponents-ai
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ Import the AI components you need:
23
+
24
+ ```typescript
25
+ import { Button } from '@fundamental-ngx/ui5-webcomponents-ai/button';
26
+ import { PromptInput } from '@fundamental-ngx/ui5-webcomponents-ai/prompt-input';
27
+
28
+ @Component({
29
+ selector: 'app-example',
30
+ standalone: true,
31
+ imports: [Button, PromptInput],
32
+ template: `
33
+ <ui5-ai-button (click)="handleAIAction()">AI Action</ui5-ai-button>
34
+ <ui5-prompt-input [(value)]="prompt"></ui5-prompt-input>
35
+ `
36
+ })
37
+ export class ExampleComponent {
38
+ prompt = '';
39
+
40
+ handleAIAction() {
41
+ console.log('AI button clicked!');
42
+ }
43
+ }
44
+ ```
45
+
46
+ ### Using Angular Components Inside UI5 Components
47
+
48
+ Angular components often use selectors with hyphens (e.g. `<app-item>`, `<app-value>`).
49
+ UI5 interprets such tags as custom elements and may wait **up to 1 second** for their registration, causing delayed rendering inside components like `<ui5-table-cell>`.
50
+
51
+ To avoid this, configure UI5 to ignore Angular component prefixes:
52
+
53
+ ```ts
54
+ // ui5-init.ts
55
+ import { ignoreCustomElements } from '@ui5/webcomponents-base/dist/IgnoreCustomElements.js';
56
+
57
+ ignoreCustomElements('app-');
58
+ ```
59
+
60
+ Import it before Angular bootstraps:
61
+ ```ts
62
+ // main.ts
63
+ import './ui5-init';
64
+ ```
65
+
66
+ This prevents unnecessary waiting, ensures smooth rendering, and improves performance when mixing Angular components with UI5 Web Components.
67
+
68
+ ## Resources
69
+
70
+ - [UI5 Web Components Documentation](https://ui5.github.io/webcomponents/)
71
+ - [Fundamental NGX Documentation](https://sap.github.io/fundamental-ngx)
72
+ - [GitHub Repository](https://github.com/SAP/fundamental-ngx)
@@ -161,6 +161,33 @@ class Button {
161
161
  [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.
162
162
  */
163
163
  this.ui5ArrowButtonClick = output();
164
+ /**
165
+ * Available slots for content projection in this component.
166
+ *
167
+ * Slots allow you to insert custom content into predefined areas of the web component.
168
+ * Use the `slot` attribute on child elements to target specific slots.
169
+ *
170
+ * - **(default)**: Defines the available states of the component.
171
+ **Note:** Although this slot accepts HTML Elements, it is strongly recommended that
172
+ you only use `ui5-ai-button-state` components in order to preserve the intended design.
173
+ *
174
+ * @example
175
+ * ```html
176
+ * <ui5-ai-button>
177
+ * <div slot="header">Custom header content</div>
178
+ * <p>Default slot content</p>
179
+ * </ui5-ai-button>
180
+ * ```
181
+ *
182
+ * @readonly
183
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
184
+ */
185
+ this.slots = [
186
+ {
187
+ "name": "default",
188
+ "description": "Defines the available states of the component.\n**Note:** Although this slot accepts HTML Elements, it is strongly recommended that\nyou only use `ui5-ai-button-state` components in order to preserve the intended design."
189
+ }
190
+ ];
164
191
  this.elementRef = inject(ElementRef);
165
192
  this.injector = inject(Injector);
166
193
  }
@@ -339,6 +366,31 @@ class Input {
339
366
  * Fired when the user selects the version navigation buttons.
340
367
  */
341
368
  this.ui5VersionChange = output();
369
+ /**
370
+ * Available slots for content projection in this component.
371
+ *
372
+ * Slots allow you to insert custom content into predefined areas of the web component.
373
+ * Use the `slot` attribute on child elements to target specific slots.
374
+ *
375
+ * - **actions**: Defines the items of the menu for the component.
376
+ *
377
+ * @example
378
+ * ```html
379
+ * <ui5-ai-input>
380
+ * <div slot="header">Custom header content</div>
381
+ * <p>Default slot content</p>
382
+ * </ui5-ai-input>
383
+ * ```
384
+ *
385
+ * @readonly
386
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
387
+ */
388
+ this.slots = [
389
+ {
390
+ "name": "actions",
391
+ "description": "Defines the items of the menu for the component."
392
+ }
393
+ ];
342
394
  this.elementRef = inject(ElementRef);
343
395
  this.injector = inject(Injector);
344
396
  }
@@ -472,6 +524,48 @@ class PromptInput {
472
524
  or on focusout.
473
525
  */
474
526
  this.ui5Change = output();
527
+ /**
528
+ * Available slots for content projection in this component.
529
+ *
530
+ * Slots allow you to insert custom content into predefined areas of the web component.
531
+ * Use the `slot` attribute on child elements to target specific slots.
532
+ *
533
+ * - **(default)**: Defines the suggestion items.
534
+
535
+ **Note:** The suggestions would be displayed only if the `showSuggestions`
536
+ property is set to `true`.
537
+
538
+ **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.
539
+ * - **valueStateMessage**: Defines the value state message that will be displayed as pop up under the component.
540
+ The value state message slot should contain only one root element.
541
+
542
+ **Note:** If not specified, a default text (in the respective language) will be displayed.
543
+
544
+ **Note:** The `valueStateMessage` would be displayed,
545
+ when the component is in `Information`, `Critical` or `Negative` value state.
546
+ *
547
+ * @example
548
+ * ```html
549
+ * <ui5-ai-prompt-input>
550
+ * <div slot="header">Custom header content</div>
551
+ * <p>Default slot content</p>
552
+ * </ui5-ai-prompt-input>
553
+ * ```
554
+ *
555
+ * @readonly
556
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
557
+ */
558
+ this.slots = [
559
+ {
560
+ "name": "default",
561
+ "description": "Defines the suggestion items.\n\n**Note:** The suggestions would be displayed only if the `showSuggestions`\nproperty is set to `true`.\n\n**Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items."
562
+ },
563
+ {
564
+ "name": "valueStateMessage",
565
+ "description": "Defines the value state message that will be displayed as pop up under the component.\nThe value state message slot should contain only one root element.\n\n**Note:** If not specified, a default text (in the respective language) will be displayed.\n\n**Note:** The `valueStateMessage` would be displayed,\nwhen the component is in `Information`, `Critical` or `Negative` value state.",
566
+ "since": "2.0.0"
567
+ }
568
+ ];
475
569
  this.elementRef = inject(ElementRef);
476
570
  this.injector = inject(Injector);
477
571
  }
@@ -571,6 +665,31 @@ class TextArea {
571
665
  * Fired when the user requests to stop AI text generation.
572
666
  */
573
667
  this.ui5StopGeneration = output();
668
+ /**
669
+ * Available slots for content projection in this component.
670
+ *
671
+ * Slots allow you to insert custom content into predefined areas of the web component.
672
+ * Use the `slot` attribute on child elements to target specific slots.
673
+ *
674
+ * - **menu**: Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant.
675
+ *
676
+ * @example
677
+ * ```html
678
+ * <ui5-ai-textarea>
679
+ * <div slot="header">Custom header content</div>
680
+ * <p>Default slot content</p>
681
+ * </ui5-ai-textarea>
682
+ * ```
683
+ *
684
+ * @readonly
685
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
686
+ */
687
+ this.slots = [
688
+ {
689
+ "name": "menu",
690
+ "description": "Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant."
691
+ }
692
+ ];
574
693
  this.elementRef = inject(ElementRef);
575
694
  this.injector = inject(Injector);
576
695
  }