@vsn-ux/ngx-gaia 0.11.3 → 0.11.5
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 +177 -4
- package/README.md +9 -0
- package/docs/alert.md +105 -0
- package/docs/badge.md +21 -0
- package/docs/button.md +46 -0
- package/docs/card.md +24 -0
- package/docs/checkbox.md +40 -0
- package/docs/chip.md +93 -0
- package/docs/data-select.md +334 -0
- package/docs/datepicker.md +94 -0
- package/docs/form-field.md +144 -0
- package/docs/icon.md +22 -0
- package/docs/input.md +29 -0
- package/docs/link.md +29 -0
- package/docs/menu.md +60 -0
- package/docs/modal.md +86 -0
- package/docs/radio.md +37 -0
- package/docs/segmented-control.md +86 -0
- package/docs/select.md +103 -0
- package/docs/spinner.md +19 -0
- package/docs/switch.md +26 -0
- package/docs/tabs.md +109 -0
- package/docs/textarea.md +30 -0
- package/docs/tooltip.md +43 -0
- package/docs/utils.md +19 -0
- package/fesm2022/vsn-ux-ngx-gaia.mjs +440 -40
- package/fesm2022/vsn-ux-ngx-gaia.mjs.map +1 -1
- package/package.json +1 -1
- package/types/vsn-ux-ngx-gaia.d.ts +146 -6
package/DOCS.md
CHANGED
|
@@ -422,6 +422,10 @@ Data select component that automatically generates options from an items array.
|
|
|
422
422
|
- `closed()` - Emitted when dropdown closes
|
|
423
423
|
- `optionsEndReached()` - Emitted when user scrolls to bottom of options
|
|
424
424
|
|
|
425
|
+
#### Methods:
|
|
426
|
+
|
|
427
|
+
- `focus(): void` - Focus the select trigger
|
|
428
|
+
|
|
425
429
|
### `IGaSelectOption<T>`
|
|
426
430
|
|
|
427
431
|
Type for option items with special properties:
|
|
@@ -941,6 +945,7 @@ Menu item directive.
|
|
|
941
945
|
- `gaMenuItemIcon: GaIconData` - Item icon
|
|
942
946
|
- `gaMenuItemDescription: string` - Item description
|
|
943
947
|
- `gaMenuItemShortcut: string` - Keyboard shortcut
|
|
948
|
+
- `gaMenuItemSelected: boolean` - Selected state (default: false)
|
|
944
949
|
|
|
945
950
|
### `<ga-menu-separator>`
|
|
946
951
|
|
|
@@ -979,6 +984,37 @@ Menu with trigger
|
|
|
979
984
|
</ng-template>
|
|
980
985
|
```
|
|
981
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
|
+
|
|
982
1018
|
## Modal
|
|
983
1019
|
|
|
984
1020
|
Modal service and components for creating overlay dialogs.
|
|
@@ -1211,6 +1247,10 @@ Select component.
|
|
|
1211
1247
|
- `multiple: boolean` - Multiple selection
|
|
1212
1248
|
- `clearable: boolean` - Show clear button
|
|
1213
1249
|
|
|
1250
|
+
#### Methods:
|
|
1251
|
+
|
|
1252
|
+
- `focus(): void` - Focus the select trigger
|
|
1253
|
+
|
|
1214
1254
|
### `<ga-select-dropdown>`
|
|
1215
1255
|
|
|
1216
1256
|
Dropdown container component.
|
|
@@ -1325,9 +1365,9 @@ Switch component for boolean toggle controls.
|
|
|
1325
1365
|
|
|
1326
1366
|
#### Inputs:
|
|
1327
1367
|
|
|
1328
|
-
- `label: string` - Switch label (default: '')
|
|
1329
1368
|
- `checked: boolean` - Checked state (default: false)
|
|
1330
1369
|
- `disabled: boolean` - Disabled state (default: false)
|
|
1370
|
+
- `label: string` - **@deprecated** Use content projection instead (default: '')
|
|
1331
1371
|
|
|
1332
1372
|
#### Outputs:
|
|
1333
1373
|
|
|
@@ -1335,11 +1375,11 @@ Switch component for boolean toggle controls.
|
|
|
1335
1375
|
|
|
1336
1376
|
### Examples:
|
|
1337
1377
|
|
|
1338
|
-
Switch with label
|
|
1378
|
+
Switch with visible label
|
|
1339
1379
|
|
|
1340
1380
|
```html
|
|
1341
|
-
<ga-switch
|
|
1342
|
-
<ga-switch [(ngModel)]="value"
|
|
1381
|
+
<ga-switch [(checked)]="enabled">Enable notifications</ga-switch>
|
|
1382
|
+
<ga-switch [(ngModel)]="value">Dark mode</ga-switch>
|
|
1343
1383
|
```
|
|
1344
1384
|
|
|
1345
1385
|
## Tabs
|
|
@@ -1381,6 +1421,18 @@ Individual tab component for tab content.
|
|
|
1381
1421
|
|
|
1382
1422
|
Directive for explicit tab content template definition.
|
|
1383
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
|
+
|
|
1384
1436
|
### Examples:
|
|
1385
1437
|
|
|
1386
1438
|
Basic tabs
|
|
@@ -1452,6 +1504,19 @@ Explicit content template
|
|
|
1452
1504
|
</ga-tabs>
|
|
1453
1505
|
```
|
|
1454
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
|
+
|
|
1455
1520
|
## Text Area
|
|
1456
1521
|
|
|
1457
1522
|
Text area directive for multi-line text input.
|
|
@@ -1483,6 +1548,114 @@ Text area in form field
|
|
|
1483
1548
|
</ga-form-field>
|
|
1484
1549
|
```
|
|
1485
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
|
+
|
|
1486
1659
|
## Tooltip
|
|
1487
1660
|
|
|
1488
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 ./node_modules/@vsn-ux/ngx-gaia/claude --scope project
|
|
52
|
+
/plugin install ngx-gaia@ngx-gaia --scope project
|
|
53
|
+
```
|
|
54
|
+
|
|
46
55
|
## Browser support
|
|
47
56
|
|
|
48
57
|
Follows PDAB Compatibility Policy:
|
package/docs/alert.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
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 `role="alert"` for screen reader announcements.
|
|
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
|
+
|
|
20
|
+
### Outputs:
|
|
21
|
+
|
|
22
|
+
- `dismiss: EventEmitter<void>` - Emitted when dismiss button is clicked
|
|
23
|
+
|
|
24
|
+
### Properties:
|
|
25
|
+
|
|
26
|
+
- `progressId: string` - Auto-generated ID for progress bar (use with aria-describedby)
|
|
27
|
+
|
|
28
|
+
### Default variant icons:
|
|
29
|
+
|
|
30
|
+
- `information` - Info icon
|
|
31
|
+
- `success` - CircleCheck icon
|
|
32
|
+
- `warning` - TriangleAlert icon
|
|
33
|
+
- `error` - OctagonAlert icon
|
|
34
|
+
- `brand` - No icon
|
|
35
|
+
|
|
36
|
+
## `<ga-alert-title>`
|
|
37
|
+
|
|
38
|
+
Title component projected into alert header.
|
|
39
|
+
|
|
40
|
+
## `<ga-alert-title-actions>`
|
|
41
|
+
|
|
42
|
+
Container for action buttons in alert header, positioned next to the title.
|
|
43
|
+
|
|
44
|
+
## GaAlertI18n
|
|
45
|
+
|
|
46
|
+
Abstract class for alert internationalization.
|
|
47
|
+
|
|
48
|
+
### Properties:
|
|
49
|
+
|
|
50
|
+
- `dismissLabel: string` - Label for dismiss button (default: 'Dismiss')
|
|
51
|
+
|
|
52
|
+
## Providers:
|
|
53
|
+
|
|
54
|
+
- `provideGaAlertI18n(value: GaAlertI18n | (() => GaAlertI18n))` - Configure alert i18n labels
|
|
55
|
+
|
|
56
|
+
## Examples:
|
|
57
|
+
|
|
58
|
+
Basic alert with title and dismiss:
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<ga-alert variant="success" [dismissible]="true" (dismiss)="onDismiss()">
|
|
62
|
+
<ga-alert-title>Success!</ga-alert-title>
|
|
63
|
+
Operation completed successfully.
|
|
64
|
+
</ga-alert>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Alert with progress bar:
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<ga-alert variant="information" [progress]="75" progressLabel="Upload progress">
|
|
71
|
+
<ga-alert-title>Uploading...</ga-alert-title>
|
|
72
|
+
Your file is being uploaded.
|
|
73
|
+
</ga-alert>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Alert with title actions:
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<ga-alert>
|
|
80
|
+
<ga-alert-title>Notification</ga-alert-title>
|
|
81
|
+
<ga-alert-title-actions>
|
|
82
|
+
<button [gaIconButton]="MoreIcon" gaIconButtonVariant="ghost">more</button>
|
|
83
|
+
</ga-alert-title-actions>
|
|
84
|
+
This is a notification with actions.
|
|
85
|
+
</ga-alert>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Using progressId for accessibility:
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<ga-alert #alert variant="information" [progress]="50">
|
|
92
|
+
<ga-alert-title>Processing</ga-alert-title>
|
|
93
|
+
</ga-alert>
|
|
94
|
+
<p [attr.aria-describedby]="alert.progressId">Status indicator above</p>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Configuring i18n:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { provideGaAlertI18n } from '@vsn-ux/ngx-gaia';
|
|
101
|
+
|
|
102
|
+
export const appConfig: ApplicationConfig = {
|
|
103
|
+
providers: [provideGaAlertI18n({ dismissLabel: $localize`Close` })],
|
|
104
|
+
};
|
|
105
|
+
```
|
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,46 @@
|
|
|
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
|
+
|
|
17
|
+
## `[gaIconButton]`
|
|
18
|
+
|
|
19
|
+
Icon button directive for buttons with icons.
|
|
20
|
+
|
|
21
|
+
### Inputs:
|
|
22
|
+
|
|
23
|
+
- `gaIconButton: GaIconData` - Icon to display (required)
|
|
24
|
+
- `gaIconButtonVariant: GaIconButtonVariant` - Button variant (default: 'secondary')
|
|
25
|
+
- `gaIconButtonLoading: boolean` - Show loading state (default: false)
|
|
26
|
+
- `gaIconButtonLoadingLabel: string` - Loading state label
|
|
27
|
+
|
|
28
|
+
## GaButtonI18n
|
|
29
|
+
|
|
30
|
+
Service for button internationalization.
|
|
31
|
+
|
|
32
|
+
### Properties:
|
|
33
|
+
|
|
34
|
+
- `loadingLabel: string` - Default loading label
|
|
35
|
+
|
|
36
|
+
## Providers:
|
|
37
|
+
|
|
38
|
+
- `provideGaButtonI18n(value: GaButtonI18n | (() => GaButtonI18n))` - Configure button i18n labels
|
|
39
|
+
|
|
40
|
+
## Examples:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<button gaButton="primary">Primary Button</button>
|
|
44
|
+
<button gaButton="secondary" [gaButtonLoading]="isLoading">Save</button>
|
|
45
|
+
<button [gaIconButton]="PlusIcon" gaIconButtonVariant="primary">Add</button>
|
|
46
|
+
```
|
package/docs/card.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
Selectable card
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<ga-card selectable [selected]="isSelected">
|
|
21
|
+
<h3>Card Title</h3>
|
|
22
|
+
<p>Card content</p>
|
|
23
|
+
</ga-card>
|
|
24
|
+
```
|
package/docs/checkbox.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
17
|
+
### Outputs:
|
|
18
|
+
|
|
19
|
+
- `checkedChange(value: boolean)` - Emits when checked state changes
|
|
20
|
+
- `indeterminateChange(value: boolean)` - Emits when indeterminate state changes
|
|
21
|
+
- `change(value: boolean)` - **Deprecated**: Use `checkedChange` instead
|
|
22
|
+
|
|
23
|
+
## `GaCheckboxRequiredValidator`
|
|
24
|
+
|
|
25
|
+
Directive that provides required validation for `ga-checkbox` in template-driven forms.
|
|
26
|
+
|
|
27
|
+
**Selector:** `ga-checkbox[required][formControlName], ga-checkbox[required][formControl], ga-checkbox[required][ngModel]`
|
|
28
|
+
|
|
29
|
+
Automatically applied when using `required` attribute with reactive or template-driven forms.
|
|
30
|
+
|
|
31
|
+
## Examples:
|
|
32
|
+
|
|
33
|
+
Basic checkbox
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<ga-checkbox [(checked)]="isChecked">Accept terms</ga-checkbox>
|
|
37
|
+
<ga-checkbox [(ngModel)]="value" [indeterminate]="someChecked"
|
|
38
|
+
>Select all</ga-checkbox
|
|
39
|
+
>
|
|
40
|
+
```
|
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(value: any | any[])` - 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
|
+
```
|