@vsn-ux/ngx-gaia 0.11.4 → 0.11.6

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/DOCS.md CHANGED
@@ -945,6 +945,7 @@ Menu item directive.
945
945
  - `gaMenuItemIcon: GaIconData` - Item icon
946
946
  - `gaMenuItemDescription: string` - Item description
947
947
  - `gaMenuItemShortcut: string` - Keyboard shortcut
948
+ - `gaMenuItemSelected: boolean` - Selected state (default: false)
948
949
 
949
950
  ### `<ga-menu-separator>`
950
951
 
@@ -983,6 +984,37 @@ Menu with trigger
983
984
  </ng-template>
984
985
  ```
985
986
 
987
+ Menu with selected item
988
+
989
+ ```html
990
+ <button gaButton [gaMenuTrigger]="menu">Options</button>
991
+ <ng-template #menu>
992
+ <ga-menu>
993
+ <button
994
+ gaMenuItem
995
+ [gaMenuItemSelected]="selected === 1"
996
+ (click)="selected = 1"
997
+ >
998
+ Option 1
999
+ </button>
1000
+ <button
1001
+ gaMenuItem
1002
+ [gaMenuItemSelected]="selected === 2"
1003
+ (click)="selected = 2"
1004
+ >
1005
+ Option 2
1006
+ </button>
1007
+ <button
1008
+ gaMenuItem
1009
+ [gaMenuItemSelected]="selected === 3"
1010
+ (click)="selected = 3"
1011
+ >
1012
+ Option 3
1013
+ </button>
1014
+ </ga-menu>
1015
+ </ng-template>
1016
+ ```
1017
+
986
1018
  ## Modal
987
1019
 
988
1020
  Modal service and components for creating overlay dialogs.
@@ -1389,6 +1421,18 @@ Individual tab component for tab content.
1389
1421
 
1390
1422
  Directive for explicit tab content template definition.
1391
1423
 
1424
+ ### GaTabsI18n
1425
+
1426
+ Service for tabs internationalization.
1427
+
1428
+ #### Properties:
1429
+
1430
+ - `moreLabel: string` - Label for the overflow menu trigger button (default: 'More')
1431
+
1432
+ ### Providers:
1433
+
1434
+ - `provideGaTabsI18n(value: GaTabsI18n | (() => GaTabsI18n))` - Configure tabs i18n labels
1435
+
1392
1436
  ### Examples:
1393
1437
 
1394
1438
  Basic tabs
@@ -1460,6 +1504,19 @@ Explicit content template
1460
1504
  </ga-tabs>
1461
1505
  ```
1462
1506
 
1507
+ i18n configuration
1508
+
1509
+ ```typescript
1510
+ // Static configuration
1511
+ provideGaTabsI18n({ moreLabel: 'More options' });
1512
+
1513
+ // Factory function with injection context
1514
+ provideGaTabsI18n(() => {
1515
+ const i18n = inject(MyI18nService);
1516
+ return { moreLabel: i18n.translate('tabs.more') };
1517
+ });
1518
+ ```
1519
+
1463
1520
  ## Text Area
1464
1521
 
1465
1522
  Text area directive for multi-line text input.
@@ -1491,6 +1548,114 @@ Text area in form field
1491
1548
  </ga-form-field>
1492
1549
  ```
1493
1550
 
1551
+ ## Toast
1552
+
1553
+ Service-based toast notification system for displaying temporary messages with auto-dismiss functionality.
1554
+
1555
+ ### GaToaster
1556
+
1557
+ Service for displaying toast notifications.
1558
+
1559
+ #### Methods:
1560
+
1561
+ - `show(content: GaToastContent | TemplateRef<any> | { template: TemplateRef<any>, context: any }, duration?: number | null): { id: number, hide: () => void }` - Display a toast notification
1562
+ - `hide(id: number): void` - Hide a specific toast by ID
1563
+ - `hideAll(): void` - Hide all visible toasts
1564
+
1565
+ ### GaToastContent
1566
+
1567
+ Content configuration interface for toast messages.
1568
+
1569
+ #### Properties:
1570
+
1571
+ - `title?: string` - Optional title
1572
+ - `message: string` - Main message content (required)
1573
+ - `variant?: GaToastVariant` - Visual variant ('information' | 'success' | 'warning' | 'error', default: 'information')
1574
+ - `importance?: 'assertive' | 'polite' | 'auto'` - Accessibility importance level (default: 'auto')
1575
+
1576
+ ### Providers:
1577
+
1578
+ - `provideGaToastOptions(options: Partial<GaToastGlobalOptions>)` - Configure global toast options including variant, duration, importance, position, offsetX, and offsetY
1579
+
1580
+ ### Examples:
1581
+
1582
+ Simple toast message
1583
+
1584
+ ```typescript
1585
+ import { GaToaster } from '@vsn-ux/ngx-gaia';
1586
+
1587
+ const toaster = inject(GaToaster);
1588
+ toaster.show({ message: 'Some fancy toast message!' });
1589
+ ```
1590
+
1591
+ Toast with all options
1592
+
1593
+ ```typescript
1594
+ toaster.show(
1595
+ {
1596
+ title: 'Success!',
1597
+ message: 'Your changes have been saved.',
1598
+ variant: 'success',
1599
+ importance: 'polite',
1600
+ },
1601
+ 5000,
1602
+ );
1603
+ ```
1604
+
1605
+ Custom template content
1606
+
1607
+ ```html
1608
+ <ng-template #content let-data let-hide="hide">
1609
+ <ga-alert variant="error">
1610
+ <ga-alert-title>{{ data.title }}</ga-alert-title>
1611
+ {{ data.message }}
1612
+ <button gaButton (click)="hide()">Dismiss</button>
1613
+ </ga-alert>
1614
+ </ng-template>
1615
+ ```
1616
+
1617
+ ```typescript
1618
+ // Pass TemplateRef directly
1619
+ toaster.show(contentTemplateRef);
1620
+
1621
+ // With template and context
1622
+ toaster.show({
1623
+ template: contentTemplateRef,
1624
+ context: { title: 'Error', message: 'Something went wrong' },
1625
+ });
1626
+ ```
1627
+
1628
+ Controlling toast visibility
1629
+
1630
+ ```typescript
1631
+ const toast = toaster.show({ message: 'Some fancy toast message!' });
1632
+
1633
+ // Hide specific toast
1634
+ toast.hide();
1635
+ // or
1636
+ toaster.hide(toast.id);
1637
+
1638
+ // Hide all toasts
1639
+ toaster.hideAll();
1640
+ ```
1641
+
1642
+ Global configuration
1643
+
1644
+ ```typescript
1645
+ import { provideGaToastOptions } from '@vsn-ux/ngx-gaia';
1646
+
1647
+ providers: [
1648
+ provideGaToastOptions({
1649
+ variant: 'information',
1650
+ duration: 5000,
1651
+ importance: 'auto',
1652
+ position: 'top-right',
1653
+ offsetX: '0.8rem',
1654
+ offsetY: '7.2rem',
1655
+ }),
1656
+ ];
1657
+ ```
1658
+
1494
1659
  ## Tooltip
1495
1660
 
1496
1661
  Tooltip directive and component for contextual information overlays.
package/README.md CHANGED
@@ -43,6 +43,15 @@ ng add @vsn-ux/ngx-gaia
43
43
  // @import '@vsn-ux/gaia-styles/all.css';
44
44
  ```
45
45
 
46
+ ## Claude Code Integration (Optional)
47
+
48
+ If you use [Claude Code](https://claude.ai/code), you can install the ngx-gaia plugin for better AI assistance with components:
49
+
50
+ ```sh
51
+ /plugin marketplace add visma-software-nordic/claude-code-marketplace
52
+ /plugin install ngx-gaia@visma-software-nordic-marketplace
53
+ ```
54
+
46
55
  ## Browser support
47
56
 
48
57
  Follows PDAB Compatibility Policy:
package/docs/alert.md ADDED
@@ -0,0 +1,107 @@
1
+ # Alert
2
+
3
+ Alert components for displaying contextual notifications with optional progress indicators and dismissal functionality.
4
+
5
+ **Angular module: GaAlertModule**
6
+
7
+ ## `<ga-alert>`
8
+
9
+ Alert component for displaying notifications and contextual information. Uses dynamic ARIA attributes based on variant for proper accessibility.
10
+
11
+ ### Inputs:
12
+
13
+ - `variant: GaAlertVariant` - Visual style ('brand' | 'information' | 'error' | 'warning' | 'success', default: 'brand')
14
+ - `icon: GaIconData` - Custom icon override (default: variant-specific icon, 'brand' has no icon)
15
+ - `dismissible: boolean` - Show dismiss button (default: false)
16
+ - `progress: number | 'indeterminate'` - Progress value 0-100 or indeterminate state
17
+ - `progressLabel: string` - Accessible label for progress bar
18
+ - `progressLabelledBy: string` - ID of element labeling progress bar
19
+ - `role: 'alert' | 'status' | string` - ARIA role override (default: 'alert' for error, 'status' for others)
20
+ - `aria-live: 'assertive' | 'polite' | 'off'` - ARIA live region behavior (default: 'assertive' for error, 'polite' for others)
21
+
22
+ ### Outputs:
23
+
24
+ - `dismiss()` - Emitted when dismiss button is clicked
25
+
26
+ ### Properties:
27
+
28
+ - `progressId: string` - Auto-generated ID for progress bar (use with aria-describedby)
29
+
30
+ ### Default variant icons:
31
+
32
+ - `information` - Info icon
33
+ - `success` - CircleCheck icon
34
+ - `warning` - TriangleAlert icon
35
+ - `error` - OctagonAlert icon
36
+ - `brand` - No icon
37
+
38
+ ## `<ga-alert-title>`
39
+
40
+ Title component projected into alert header.
41
+
42
+ ## `<ga-alert-title-actions>`
43
+
44
+ Container for action buttons in alert header, positioned next to the title.
45
+
46
+ ## GaAlertI18n
47
+
48
+ Abstract class for alert internationalization.
49
+
50
+ ### Properties:
51
+
52
+ - `dismissLabel: string` - Label for dismiss button (default: 'Dismiss')
53
+
54
+ ## Providers:
55
+
56
+ - `provideGaAlertI18n(value: GaAlertI18n | (() => GaAlertI18n))` - Configure alert i18n labels
57
+
58
+ ## Examples:
59
+
60
+ Basic alert with title and dismiss:
61
+
62
+ ```html
63
+ <ga-alert variant="success" [dismissible]="true" (dismiss)="onDismiss()">
64
+ <ga-alert-title>Success!</ga-alert-title>
65
+ Operation completed successfully.
66
+ </ga-alert>
67
+ ```
68
+
69
+ Alert with progress bar:
70
+
71
+ ```html
72
+ <ga-alert variant="information" [progress]="75" progressLabel="Upload progress">
73
+ <ga-alert-title>Uploading...</ga-alert-title>
74
+ Your file is being uploaded.
75
+ </ga-alert>
76
+ ```
77
+
78
+ Alert with title actions:
79
+
80
+ ```html
81
+ <ga-alert>
82
+ <ga-alert-title>Notification</ga-alert-title>
83
+ <ga-alert-title-actions>
84
+ <button [gaIconButton]="MoreIcon" gaIconButtonVariant="ghost">more</button>
85
+ </ga-alert-title-actions>
86
+ This is a notification with actions.
87
+ </ga-alert>
88
+ ```
89
+
90
+ Using progressId for accessibility:
91
+
92
+ ```html
93
+ <ga-alert #alert variant="information" [progress]="50">
94
+ <ga-alert-title>Processing</ga-alert-title>
95
+ </ga-alert>
96
+ <p [attr.aria-describedby]="alert.progressId">Status indicator above</p>
97
+ ```
98
+
99
+ Configuring i18n:
100
+
101
+ ```typescript
102
+ import { provideGaAlertI18n } from '@vsn-ux/ngx-gaia';
103
+
104
+ export const appConfig: ApplicationConfig = {
105
+ providers: [provideGaAlertI18n({ dismissLabel: $localize`Close` })],
106
+ };
107
+ ```
package/docs/badge.md ADDED
@@ -0,0 +1,21 @@
1
+ # Badge
2
+
3
+ Badge component for displaying status indicators and labels.
4
+
5
+ **Angular module: GaBadgeModule**
6
+
7
+ ## `<ga-badge>`
8
+
9
+ ### Inputs
10
+
11
+ - `variant: 'default' | 'default-inverted' | 'information' | 'error' | 'warning' | 'success' | 'muted' | 'disabled'` - Badge variant (default: 'default')
12
+ - `type: 'text' | 'dot'` - Badge type (default: 'text')
13
+
14
+ ## Examples
15
+
16
+ Badge variants
17
+
18
+ ```html
19
+ <ga-badge variant="information" type="text">42</ga-badge>
20
+ <ga-badge variant="error" type="dot"></ga-badge>
21
+ ```
package/docs/button.md ADDED
@@ -0,0 +1,48 @@
1
+ # Button
2
+
3
+ Button directives for interactive elements with loading states and variants.
4
+
5
+ **Angular module: GaButtonModule**
6
+
7
+ ## `[gaButton]`
8
+
9
+ Button directive for styling button and anchor elements.
10
+
11
+ ### Inputs:
12
+
13
+ - `gaButton: GaButtonType | ""` - Button variant ('primary' | 'secondary' | 'ghost' | 'transparent', default: 'secondary')
14
+ - `gaButtonLoading: boolean` - Show loading state (default: false)
15
+ - `gaButtonLoadingLabel: string` - Loading state label
16
+ - `disabled: boolean` - Disabled state (default: false)
17
+
18
+ ## `[gaIconButton]`
19
+
20
+ Icon button directive for buttons with icons.
21
+
22
+ ### Inputs:
23
+
24
+ - `gaIconButton: GaIconData` - Icon to display (required)
25
+ - `gaIconButtonVariant: GaIconButtonVariant` - Button variant (default: 'secondary')
26
+ - `gaIconButtonLoading: boolean` - Show loading state (default: false)
27
+ - `gaIconButtonLoadingLabel: string` - Loading state label
28
+ - `disabled: boolean` - Disabled state (default: false)
29
+
30
+ ## GaButtonI18n
31
+
32
+ Abstract class for button internationalization.
33
+
34
+ ### Properties:
35
+
36
+ - `loadingLabel: string` - Default loading label
37
+
38
+ ## Providers:
39
+
40
+ - `provideGaButtonI18n(value: GaButtonI18n | (() => GaButtonI18n))` - Configure button i18n labels
41
+
42
+ ## Examples:
43
+
44
+ ```html
45
+ <button gaButton="primary">Primary Button</button>
46
+ <button gaButton="secondary" [gaButtonLoading]="isLoading">Save</button>
47
+ <button [gaIconButton]="PlusIcon" gaIconButtonVariant="primary">Add</button>
48
+ ```
package/docs/card.md ADDED
@@ -0,0 +1,42 @@
1
+ # Card
2
+
3
+ Card component for grouping related content.
4
+
5
+ **Angular module: GaCardModule**
6
+
7
+ ## `<ga-card>`
8
+
9
+ ### Inputs
10
+
11
+ - `selectable: boolean` - Can be selected (default: false)
12
+ - `selected: boolean` - Is selected (default: false)
13
+ - `disabled: boolean` - Disabled state (default: false)
14
+
15
+ ## Examples
16
+
17
+ Basic card
18
+
19
+ ```html
20
+ <ga-card>
21
+ <h3>Card Title</h3>
22
+ <p>Card content goes here.</p>
23
+ </ga-card>
24
+ ```
25
+
26
+ Selectable card with selection binding
27
+
28
+ ```html
29
+ <ga-card selectable [selected]="isSelected">
30
+ <h3>Card Title</h3>
31
+ <p>Click to select this card.</p>
32
+ </ga-card>
33
+ ```
34
+
35
+ Disabled card
36
+
37
+ ```html
38
+ <ga-card disabled>
39
+ <h3>Unavailable</h3>
40
+ <p>This card is disabled.</p>
41
+ </ga-card>
42
+ ```
@@ -0,0 +1,47 @@
1
+ # Checkbox
2
+
3
+ Checkbox component for boolean selections.
4
+
5
+ **Angular module: GaCheckboxModule**
6
+
7
+ ## `<ga-checkbox>`
8
+
9
+ ### Inputs:
10
+
11
+ - `value: string | null` - Input value (default: null)
12
+ - `checked: boolean` - Checked state (default: false)
13
+ - `indeterminate: boolean` - Indeterminate state (default: false)
14
+ - `name: string | null` - Input name (default: null)
15
+ - `id: string | null` - Input ID (default: null)
16
+ - `disabled: boolean` - Disabled state (default: false)
17
+ - `required: boolean` - Required state (default: false)
18
+ - `aria-label: string | null` - ARIA label (default: null)
19
+ - `aria-labelledby: string | null` - ARIA labelledby (default: null)
20
+ - `aria-describedby: string | null` - ARIA describedby (default: null)
21
+ - `aria-invalid: string | null` - ARIA invalid override (default: null)
22
+ - `aria-errormessage: string | null` - ARIA error message ID (default: null)
23
+
24
+ ### Outputs:
25
+
26
+ - `checkedChange(value: boolean)` - Emits when checked state changes
27
+ - `indeterminateChange(value: boolean)` - Emits when indeterminate state changes
28
+ - `change(value: boolean)` - **Deprecated**: Use `checkedChange` instead
29
+
30
+ ## `GaCheckboxRequiredValidator`
31
+
32
+ Directive that provides required validation for `ga-checkbox` in template-driven forms.
33
+
34
+ **Selector:** `ga-checkbox[required][formControlName], ga-checkbox[required][formControl], ga-checkbox[required][ngModel]`
35
+
36
+ Automatically applied when using `required` attribute with reactive or template-driven forms.
37
+
38
+ ## Examples:
39
+
40
+ Basic checkbox
41
+
42
+ ```html
43
+ <ga-checkbox [(checked)]="isChecked">Accept terms</ga-checkbox>
44
+ <ga-checkbox [(ngModel)]="value" [indeterminate]="someChecked"
45
+ >Select all</ga-checkbox
46
+ >
47
+ ```
package/docs/chip.md ADDED
@@ -0,0 +1,93 @@
1
+ # Chip
2
+
3
+ Chip components for selectable options in a compact, pill-shaped format.
4
+
5
+ **Angular module: GaChipModule**
6
+
7
+ ## `<ga-chip-listbox>`
8
+
9
+ Container component for managing chip selection and keyboard navigation.
10
+
11
+ ### Inputs:
12
+
13
+ - `value: any | any[]` - Selected value (single value or array for multiple selection)
14
+ - `multiple: boolean` - Enable multiple selection
15
+ - `disabled: boolean` - Disable entire listbox
16
+ - `compareWith: (a: any, b: any) => boolean` - Custom value comparison function
17
+ - `orientation: 'horizontal' | 'vertical'` - Keyboard navigation orientation (default: 'horizontal')
18
+ - `variant: 'default' | 'transparent'` - Visual variant (default: 'default')
19
+
20
+ ### Outputs:
21
+
22
+ - `valueChange: readonly T[]` - Emitted when selection changes
23
+
24
+ ### Methods:
25
+
26
+ - `focus(): void` - Focus the listbox
27
+
28
+ ## `<ga-chip>`
29
+
30
+ Individual chip component for selectable options.
31
+
32
+ ### Inputs:
33
+
34
+ - `value: any` - Chip value (required)
35
+ - `disabled: boolean` - Disable individual chip (default: false)
36
+
37
+ ### Properties:
38
+
39
+ - `selected: Signal<boolean | null>` - Read-only signal indicating if chip is selected
40
+
41
+ ## Examples:
42
+
43
+ Single selection
44
+
45
+ ```html
46
+ <ga-chip-listbox [(value)]="selectedValue">
47
+ <ga-chip value="Apple">Apple</ga-chip>
48
+ <ga-chip value="Banana">Banana</ga-chip>
49
+ <ga-chip value="Orange">Orange</ga-chip>
50
+ </ga-chip-listbox>
51
+ ```
52
+
53
+ Multiple selection
54
+
55
+ ```html
56
+ <ga-chip-listbox [(value)]="selectedValues" multiple>
57
+ <ga-chip value="Apple">Apple</ga-chip>
58
+ <ga-chip value="Banana">Banana</ga-chip>
59
+ <ga-chip value="Orange" disabled>Orange</ga-chip>
60
+ </ga-chip-listbox>
61
+ ```
62
+
63
+ With icons
64
+
65
+ ```html
66
+ <ga-chip-listbox [(value)]="selected" multiple>
67
+ <ga-chip value="Apple">
68
+ <ga-icon [icon]="icons.Apple" size="16" />
69
+ Apple
70
+ </ga-chip>
71
+ <ga-chip #chip value="Grape">
72
+ <ga-icon [icon]="icons.Grape" size="16" />
73
+ Grape @if(chip.selected()){
74
+ <ga-icon [icon]="icons.CircleX" size="24" />
75
+ }
76
+ </ga-chip>
77
+ </ga-chip-listbox>
78
+ ```
79
+
80
+ Custom value comparison
81
+
82
+ ```typescript
83
+ compareUsers(user1: User, user2: User): boolean {
84
+ return user1.id === user2.id;
85
+ }
86
+ ```
87
+
88
+ ```html
89
+ <ga-chip-listbox [value]="selectedUser" [compareWith]="compareUsers">
90
+ <ga-chip [value]="user1">{{ user1.name }}</ga-chip>
91
+ <ga-chip [value]="user2">{{ user2.name }}</ga-chip>
92
+ </ga-chip-listbox>
93
+ ```