ngx-strata 0.2.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/icons/check.svg +1 -0
- package/assets/styles/components/accordion.scss +12 -1
- package/assets/styles/components/action-menu.scss +1 -1
- package/assets/styles/components/avatar.scss +66 -14
- package/assets/styles/components/badge.scss +134 -0
- package/assets/styles/components/button.scss +54 -9
- package/assets/styles/components/checkbox.scss +10 -2
- package/assets/styles/components/divider.scss +5 -3
- package/assets/styles/components/file-upload.scss +113 -0
- package/assets/styles/components/image-cropper.scss +201 -0
- package/assets/styles/components/input-field.scss +39 -9
- package/assets/styles/components/item.scss +1 -1
- package/assets/styles/components/modal.scss +106 -1
- package/assets/styles/components/notification.scss +30 -1
- package/assets/styles/components/otp.scss +132 -0
- package/assets/styles/components/pagination.scss +13 -3
- package/assets/styles/components/progress.scss +2 -2
- package/assets/styles/components/radio.scss +3 -2
- package/assets/styles/components/segmented-control.scss +43 -11
- package/assets/styles/components/select.scss +36 -7
- package/assets/styles/components/sidemenu.scss +56 -2
- package/assets/styles/components/slider.scss +30 -2
- package/assets/styles/components/stepper.scss +378 -0
- package/assets/styles/components/table.scss +1 -1
- package/assets/styles/components/tabs.scss +1 -1
- package/assets/styles/components/toggle.scss +1 -0
- package/assets/styles/components/tooltip.scss +9 -6
- package/assets/styles/public-api.scss +6 -1
- package/assets/styles/semantics/color-semantic.scss +38 -0
- package/dist/strata/strata.css +1 -1
- package/fesm2022/ngx-strata-src-lib-testing.mjs +33 -0
- package/fesm2022/ngx-strata-src-lib-testing.mjs.map +1 -0
- package/fesm2022/ngx-strata.mjs +2904 -1228
- package/fesm2022/ngx-strata.mjs.map +1 -1
- package/package.json +5 -1
- package/skills/ngx-strata/SKILL.md +44 -18
- package/skills/ngx-strata/components/accordion.md +9 -7
- package/skills/ngx-strata/components/action-menu.md +14 -3
- package/skills/ngx-strata/components/avatar.md +22 -10
- package/skills/ngx-strata/components/badge.md +54 -0
- package/skills/ngx-strata/components/checkbox.md +32 -5
- package/skills/ngx-strata/components/file-upload.md +50 -0
- package/skills/ngx-strata/components/icon.md +12 -7
- package/skills/ngx-strata/components/image-cropper.md +83 -0
- package/skills/ngx-strata/components/item.md +4 -3
- package/skills/ngx-strata/components/modal.md +180 -31
- package/skills/ngx-strata/components/notification.md +50 -14
- package/skills/ngx-strata/components/otp.md +68 -0
- package/skills/ngx-strata/components/pagination.md +6 -3
- package/skills/ngx-strata/components/radio.md +30 -10
- package/skills/ngx-strata/components/segmented-control.md +40 -19
- package/skills/ngx-strata/components/sidemenu.md +27 -6
- package/skills/ngx-strata/components/single-select.md +47 -15
- package/skills/ngx-strata/components/slider.md +35 -6
- package/skills/ngx-strata/components/stepper.md +64 -0
- package/skills/ngx-strata/components/testing.md +33 -0
- package/skills/ngx-strata/components/toggle.md +29 -5
- package/types/ngx-strata-src-lib-testing.d.ts +21 -0
- package/types/ngx-strata.d.ts +753 -371
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
# ngx-strata: modal Feature
|
|
2
2
|
|
|
3
|
-
This file contains the AI documentation for the `modal` feature and
|
|
3
|
+
This file contains the AI documentation for the `modal` feature, its configuration, and related components.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Modals in `ngx-strata` are opened **programmatically** using the `ModalService`. Do **NOT** use `<st-modal>` declaratively in your application templates. The `<st-modal-container>` is automatically provided by `<st-shell>`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Components & Directives
|
|
12
|
+
|
|
13
|
+
### ModalFooter (`<st-modal-footer>`)
|
|
14
|
+
- **Selector**: `st-modal-footer`
|
|
15
|
+
- **Imports**: `StrataModalFooterComponent`
|
|
16
|
+
- **Inputs**:
|
|
17
|
+
- `[justification] ('start' | 'center' | 'end' | 'space-between')` (defaults to `'end'`)
|
|
18
|
+
- **Usage**:
|
|
19
|
+
- Place `<st-modal-footer>` at the bottom of your injected modal content template.
|
|
20
|
+
- Automatically stretches edge-to-edge against the modal borders.
|
|
21
|
+
- Pinned with `position: sticky; bottom: 0;` so it remains visible when modal content scrolls.
|
|
22
|
+
- **Always pair with `<st-button-group>`** to format buttons with built-in spacing and alignment. Avoid using raw `<div>` tags or manual margins.
|
|
23
|
+
|
|
24
|
+
### AlertContent (`<st-alert-content>`)
|
|
6
25
|
- **Selector**: `st-alert-content`
|
|
7
26
|
- **Imports**: `StrataAlertContentComponent`
|
|
8
27
|
- **Inputs**:
|
|
@@ -13,32 +32,80 @@ This file contains the AI documentation for the `modal` feature and its related
|
|
|
13
32
|
- `[affirmativeButton] (string)`
|
|
14
33
|
- `[cancelButton] (string | undefined)`
|
|
15
34
|
|
|
16
|
-
|
|
35
|
+
### Modal (`<st-modal>`)
|
|
17
36
|
- **Selector**: `st-modal`
|
|
18
37
|
- **Imports**: `StrataModalComponent`
|
|
19
38
|
- **Inputs**:
|
|
20
39
|
- `[configuration] (ModalConfiguration)`
|
|
40
|
+
- `[size] (ModalSize)`
|
|
41
|
+
- `[variant] (ModalVariant)`
|
|
21
42
|
|
|
22
|
-
|
|
43
|
+
### ModalContainer (`<st-modal-container>`)
|
|
23
44
|
- **Selector**: `st-modal-container`
|
|
24
45
|
- **Imports**: `StrataModalContainerComponent`
|
|
46
|
+
- **Note**: Handled automatically by `<st-shell>`.
|
|
25
47
|
|
|
26
|
-
|
|
48
|
+
### ModalHeader (`<st-modal-header>`)
|
|
27
49
|
- **Selector**: `st-modal-header`
|
|
28
50
|
- **Imports**: `StrataModalHeaderComponent`
|
|
29
51
|
- **Inputs**:
|
|
30
52
|
- `[title] (string | null | undefined)`
|
|
31
53
|
- `[showCloseButton] (boolean)`
|
|
54
|
+
- **Note**: Handled automatically based on `ModalConfiguration`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## ModalConfiguration
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
export interface ModalConfiguration {
|
|
62
|
+
component: Type<unknown>;
|
|
63
|
+
title?: string;
|
|
64
|
+
size?: ModalSize; // 'xs' | 'sm' | 'md' | 'lg' (default: 'md')
|
|
65
|
+
variant?: ModalVariant; // 'default' | 'raised' (default: 'default')
|
|
66
|
+
hideCloseButton?: boolean; // default: false
|
|
67
|
+
disableBackdropClosure?: boolean; // default: false
|
|
68
|
+
inputs?: Record<string, unknown>; // Inputs forwarded to injected component
|
|
69
|
+
onModalClosed?: (value?: unknown) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type ModalSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
73
|
+
export type ModalVariant = 'default' | 'raised';
|
|
74
|
+
```
|
|
32
75
|
|
|
33
|
-
|
|
76
|
+
### Choosing `variant`:
|
|
77
|
+
- `'default'`: Uses `--st-color-bg-default` (the standard page background). This is the default for all modals. It allows nested components like `st-card` to sit on top with clean visual elevation and contrast.
|
|
78
|
+
- `'raised'`: Uses `--st-color-bg-raised` (the elevated surface background). Used automatically by `showAlert()` and recommended when the modal is a simple dialog or confirmation prompt without nested cards.
|
|
34
79
|
|
|
35
|
-
|
|
80
|
+
### Responsive Behavior & Mobile Sizing:
|
|
81
|
+
- **`xs` (Alerts) and `sm` modals**: Remain centered dialog boxes on all screen sizes, preserving their standard viewport margins, borders, and rounded corners.
|
|
82
|
+
- **`md` (default) and `lg` modals**: Automatically adapt to **full-screen mode** (`100vw` by `100dvh`) on screens under `768px` (`< 768px`), with `border-radius: 0` and `border: none`. The content area flexes to fill available vertical space, and `<st-modal-footer>` stays pinned to the bottom of the screen.
|
|
36
83
|
|
|
37
|
-
|
|
38
|
-
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## AlertConfiguration
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
export interface AlertConfiguration {
|
|
90
|
+
message: string;
|
|
91
|
+
affirmativeButton: string;
|
|
92
|
+
title?: string;
|
|
93
|
+
cancelButton?: string;
|
|
94
|
+
icon?: string;
|
|
95
|
+
theme?: Theme; // 'info' | 'success' | 'warning' | 'danger' | 'brand'
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Usage Examples
|
|
102
|
+
|
|
103
|
+
### 1. Opening a Custom Modal with a Footer
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
39
106
|
import { Component, inject } from '@angular/core';
|
|
40
107
|
import { ModalService } from 'ngx-strata';
|
|
41
|
-
import {
|
|
108
|
+
import { MySettingsModalComponent } from './my-settings-modal.component';
|
|
42
109
|
|
|
43
110
|
@Component({...})
|
|
44
111
|
export class MyComponent {
|
|
@@ -46,51 +113,133 @@ export class MyComponent {
|
|
|
46
113
|
|
|
47
114
|
openSettings() {
|
|
48
115
|
this.modalService.showModal({
|
|
49
|
-
component:
|
|
50
|
-
title: '
|
|
51
|
-
size: '
|
|
116
|
+
component: MySettingsModalComponent,
|
|
117
|
+
title: 'Project Settings',
|
|
118
|
+
size: 'md',
|
|
119
|
+
variant: 'default',
|
|
120
|
+
onModalClosed: (result) => {
|
|
121
|
+
if (result) {
|
|
122
|
+
// Handled result
|
|
123
|
+
}
|
|
124
|
+
}
|
|
52
125
|
});
|
|
53
126
|
}
|
|
54
127
|
}
|
|
55
128
|
```
|
|
56
129
|
|
|
57
|
-
### 2. The Modal Content Component
|
|
58
|
-
|
|
130
|
+
### 2. The Modal Content Component (with `<st-modal-footer>`)
|
|
131
|
+
|
|
132
|
+
Inside the injected component, inject `StrataModalRef` to trigger closing. Combine `<st-modal-footer>` with `<st-button-group>` for actions:
|
|
59
133
|
|
|
60
134
|
```typescript
|
|
61
135
|
import { Component, inject } from '@angular/core';
|
|
62
|
-
import {
|
|
136
|
+
import {
|
|
137
|
+
StrataModalRef,
|
|
138
|
+
StrataModalFooterComponent,
|
|
139
|
+
StrataButtonGroupComponent,
|
|
140
|
+
StrataButtonDirective
|
|
141
|
+
} from 'ngx-strata';
|
|
63
142
|
|
|
64
143
|
@Component({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
imports: [
|
|
145
|
+
StrataModalFooterComponent,
|
|
146
|
+
StrataButtonGroupComponent,
|
|
147
|
+
StrataButtonDirective
|
|
148
|
+
],
|
|
149
|
+
template: `
|
|
150
|
+
<p class="st-body-m">Configure your project settings here.</p>
|
|
151
|
+
|
|
152
|
+
<!-- Standard End-Aligned Actions -->
|
|
153
|
+
<st-modal-footer>
|
|
154
|
+
<st-button-group justification="end">
|
|
155
|
+
<button stButton variant="secondary" (click)="cancel()">Cancel</button>
|
|
156
|
+
<button stButton variant="primary" (click)="save()">Save Changes</button>
|
|
157
|
+
</st-button-group>
|
|
158
|
+
</st-modal-footer>
|
|
159
|
+
`
|
|
72
160
|
})
|
|
73
|
-
export class
|
|
161
|
+
export class MySettingsModalComponent {
|
|
74
162
|
private modalRef = inject(StrataModalRef);
|
|
75
163
|
|
|
76
|
-
|
|
164
|
+
cancel() {
|
|
77
165
|
this.modalRef.close();
|
|
78
166
|
}
|
|
79
167
|
|
|
80
168
|
save() {
|
|
81
|
-
|
|
82
|
-
this.modalRef.close(true); // Can pass data back
|
|
169
|
+
this.modalRef.close({ saved: true });
|
|
83
170
|
}
|
|
84
171
|
}
|
|
85
172
|
```
|
|
86
173
|
|
|
174
|
+
### 3. Split Footer Actions (Left Action + Right Group)
|
|
175
|
+
|
|
176
|
+
When a secondary action (like "Delete" or "Reset") should appear on the left while primary actions sit on the right:
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<st-modal-footer>
|
|
180
|
+
<button stButton variant="ghost" (click)="reset()">Reset Defaults</button>
|
|
181
|
+
<st-button-group justification="end">
|
|
182
|
+
<button stButton variant="secondary" (click)="cancel()">Cancel</button>
|
|
183
|
+
<button stButton variant="primary" (click)="save()">Save</button>
|
|
184
|
+
</st-button-group>
|
|
185
|
+
</st-modal-footer>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 4. Opening a Standard Alert
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { Component, inject } from '@angular/core';
|
|
192
|
+
import { ModalService } from 'ngx-strata';
|
|
193
|
+
|
|
194
|
+
@Component({...})
|
|
195
|
+
export class MyComponent {
|
|
196
|
+
private modalService = inject(ModalService);
|
|
197
|
+
|
|
198
|
+
confirmDelete() {
|
|
199
|
+
this.modalService.showAlert({
|
|
200
|
+
title: 'Delete Item',
|
|
201
|
+
message: 'Are you sure you want to delete this item? This cannot be undone.',
|
|
202
|
+
affirmativeButton: 'Delete',
|
|
203
|
+
cancelButton: 'Cancel',
|
|
204
|
+
theme: 'danger',
|
|
205
|
+
icon: 'warning'
|
|
206
|
+
}, (confirmed) => {
|
|
207
|
+
if (confirmed) {
|
|
208
|
+
// Proceed with deletion
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
87
217
|
## CSS Custom Properties
|
|
88
|
-
|
|
89
|
-
|
|
218
|
+
|
|
219
|
+
The modal and modal footer expose internal CSS custom properties mapped to design tokens:
|
|
220
|
+
|
|
221
|
+
### Modal (`st-modal`)
|
|
222
|
+
- `--st-modal-bg-color`: Background color of the modal (defaults to `var(--st-color-bg-default)`).
|
|
90
223
|
- `--st-modal-border-radius`: Border radius of the modal (defaults to `var(--st-border-radius-sm)`).
|
|
91
|
-
- `--st-modal-padding`: Inner padding of the modal (defaults to `var(--st-size-md)`).
|
|
224
|
+
- `--st-modal-padding`: Inner padding of the modal content (defaults to `var(--st-size-md)`).
|
|
92
225
|
- `--st-modal-covered-modal-filter`: CSS filter applied to covered modals (defaults to `brightness(70%)`).
|
|
93
226
|
- `--st-modal-viewport-margin`: Viewport safety margin when calculating max-height (defaults to `var(--st-size-md)`).
|
|
94
227
|
|
|
95
|
-
|
|
228
|
+
### Modal Footer (`st-modal-footer`)
|
|
229
|
+
- `--st-modal-footer-bg`: Background color of the footer (defaults to `var(--st-modal-bg-color)`).
|
|
230
|
+
- `--st-modal-footer-border-color`: Border divider color (defaults to `var(--st-border)`).
|
|
231
|
+
- `--st-modal-footer-padding`: Padding inside the footer (defaults to `var(--st-size-xs) var(--st-size-sm)`).
|
|
232
|
+
- `--st-modal-footer-gap`: Gap between elements in the footer (defaults to `var(--st-size-xs)`).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Accessibility & Keyboard Navigation
|
|
237
|
+
- **ARIA Roles**: `<st-modal>` automatically includes `role="dialog"` and `aria-modal="true"`.
|
|
238
|
+
- **Focus Trapping**: Tabbing through interactive elements inside the modal wraps around automatically (`Tab` and `Shift + Tab`).
|
|
239
|
+
- **Focus Restoration**: Focus is returned to the element that originally had focus prior to opening the modal upon closure.
|
|
240
|
+
- **Escape Key Dismissal**: Pressing the `Escape` key dismisses the topmost modal unless `disableBackdropClosure: true` is configured.
|
|
96
241
|
|
|
242
|
+
> **Note to AI Agents**:
|
|
243
|
+
> - Always use modern Angular Signals (`input()`, `output()`) for data/event bindings.
|
|
244
|
+
> - Do NOT use raw HTML `<button>`, `<input>`, or `<select>` when `ngx-strata` equivalents exist.
|
|
245
|
+
> - Always use `<st-button-group>` to arrange action buttons within `<st-modal-footer>`.
|
|
@@ -5,17 +5,36 @@ This file contains the AI documentation for the `notification` feature and its r
|
|
|
5
5
|
## Notification (`<st-notification>`)
|
|
6
6
|
- **Selector**: `st-notification`
|
|
7
7
|
- **Imports**: `StrataNotificationComponent`
|
|
8
|
+
- **Inputs**:
|
|
9
|
+
- `[message] (string, required)`: The notification message.
|
|
10
|
+
- `[icon] (string | undefined)`: Optional icon name to display.
|
|
11
|
+
- `[dismissible] (boolean)`: Whether to display a close button. Defaults to `false`.
|
|
12
|
+
- **Outputs**:
|
|
13
|
+
- `(dismiss) (void)`: Emitted when the close button is clicked.
|
|
8
14
|
|
|
9
15
|
## NotificationContainer (`<st-notification-container>`)
|
|
10
16
|
- **Selector**: `st-notification-container`
|
|
11
17
|
- **Imports**: `StrataNotificationContainerComponent`
|
|
12
18
|
|
|
13
|
-
##
|
|
19
|
+
## NotificationService
|
|
20
|
+
Notifications are managed programmatically via `NotificationService`.
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
### NotificationConfiguration
|
|
23
|
+
- `message: string`
|
|
24
|
+
- `icon?: string`
|
|
25
|
+
- `theme?: 'info' | 'success' | 'warning' | 'danger' | 'brand'` (defaults to `'info'`)
|
|
26
|
+
- `duration?: number` (defaults to `3000`ms. Set to `0` for persistent notifications)
|
|
27
|
+
- `dismissible?: boolean` (defaults to `false` when duration > 0, and defaults to `true` when `duration === 0`)
|
|
16
28
|
|
|
17
|
-
###
|
|
18
|
-
|
|
29
|
+
### Return Handle (`StrataNotificationRef`)
|
|
30
|
+
Calling `showNotification(config)` returns a `StrataNotificationRef`:
|
|
31
|
+
- `id: string`
|
|
32
|
+
- `dismiss(): void`
|
|
33
|
+
|
|
34
|
+
## Usage Examples
|
|
35
|
+
|
|
36
|
+
### 1. Standard Auto-dismissing Notification
|
|
37
|
+
```typescript
|
|
19
38
|
import { Component, inject } from '@angular/core';
|
|
20
39
|
import { NotificationService } from 'ngx-strata';
|
|
21
40
|
|
|
@@ -24,23 +43,40 @@ export class MyComponent {
|
|
|
24
43
|
private notificationService = inject(NotificationService);
|
|
25
44
|
|
|
26
45
|
showSuccess() {
|
|
27
|
-
this.notificationService.
|
|
28
|
-
title: 'Upload Complete',
|
|
46
|
+
this.notificationService.showNotification({
|
|
29
47
|
message: 'Your file has been successfully uploaded.',
|
|
30
48
|
theme: 'success',
|
|
31
|
-
icon: '
|
|
49
|
+
icon: 'check'
|
|
32
50
|
});
|
|
33
51
|
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
### 2. Dismissible & Persistent Notification with Programmatic Handle
|
|
56
|
+
```typescript
|
|
57
|
+
@Component({...})
|
|
58
|
+
export class UploadComponent {
|
|
59
|
+
private notificationService = inject(NotificationService);
|
|
60
|
+
|
|
61
|
+
async uploadFile() {
|
|
62
|
+
const ref = this.notificationService.showNotification({
|
|
63
|
+
message: 'Uploading file...',
|
|
64
|
+
duration: 0,
|
|
65
|
+
dismissible: true
|
|
41
66
|
});
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
await this.api.upload();
|
|
70
|
+
ref.dismiss();
|
|
71
|
+
this.notificationService.showNotification({
|
|
72
|
+
message: 'Upload complete!',
|
|
73
|
+
theme: 'success'
|
|
74
|
+
});
|
|
75
|
+
} catch {
|
|
76
|
+
ref.dismiss();
|
|
77
|
+
}
|
|
42
78
|
}
|
|
43
79
|
}
|
|
44
|
-
|
|
80
|
+
```
|
|
45
81
|
|
|
46
82
|
> **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# ngx-strata: otp Feature
|
|
2
|
+
|
|
3
|
+
This file contains the AI documentation for the `otp` feature and its related components.
|
|
4
|
+
|
|
5
|
+
## Otp (`<st-otp>`)
|
|
6
|
+
- **Selector**: `st-otp`
|
|
7
|
+
- **Imports**: `StrataOtpComponent`
|
|
8
|
+
- **Inputs & Models**:
|
|
9
|
+
- `[(value)] (model<string>)`: Current OTP value string.
|
|
10
|
+
- `[(state)] (model<OtpState>)`: Component state (`'idle' | 'loading' | 'success' | 'error'`).
|
|
11
|
+
- `[length] (number)`: Number of input slots (default `6`).
|
|
12
|
+
- `[type] (OtpType)`: Input character mode (`'number' | 'alphanumeric' | 'password'`). Default `'number'`.
|
|
13
|
+
- `[uppercase] (boolean)`: Automatically uppercase alphanumeric characters (default `true`).
|
|
14
|
+
- `[mask] (boolean)`: Mask characters like a password (default `false`).
|
|
15
|
+
- `[size] (OtpSize)`: Size variant (`'sm' | 'md' | 'lg'`). Default `'md'`.
|
|
16
|
+
- `[clearOnError] (boolean)`: Automatically clear input slots when entering `'error'` state (default `false`).
|
|
17
|
+
- `[clearOnErrorDelay] (number)`: Delay in milliseconds before auto-clearing on error (default `800`).
|
|
18
|
+
- `[resetErrorOnInput] (boolean)`: Automatically reset error state to `'idle'` as soon as user types or edits (default `true`).
|
|
19
|
+
- `[loading] (boolean)`: Convenience boolean flag for loading state (displays centered loading overlay without layout shift).
|
|
20
|
+
- `[error] (boolean | string)`: Convenience flag or error message for error state.
|
|
21
|
+
- `[success] (boolean)`: Convenience boolean flag for success state.
|
|
22
|
+
- `[errorMessage] (string | undefined)`: Error text displayed below slots.
|
|
23
|
+
- `[helperText] (string | undefined)`: Informational helper text displayed below slots.
|
|
24
|
+
- `[disabled] (boolean)`: Whether input slots are disabled.
|
|
25
|
+
- `[readonly] (boolean)`: Whether input slots are read-only.
|
|
26
|
+
- `[autofocus] (boolean)`: Focus the first slot on mount (default `false`).
|
|
27
|
+
- **Outputs**:
|
|
28
|
+
- `(completed)`: Emitted with full string when all slots are filled.
|
|
29
|
+
- `(valueChange)`: Emitted with new string whenever value changes.
|
|
30
|
+
- `(stateChange)`: Emitted whenever state changes.
|
|
31
|
+
- `(errorReset)`: Emitted when error state resets via user typing, `clear()`, or `clearOnError`.
|
|
32
|
+
|
|
33
|
+
## Form Integration
|
|
34
|
+
Implements `ControlValueAccessor` (CVA). Compatible with Reactive Forms (`formControlName`, `[formControl]`) and template-driven forms (`[(ngModel)]`).
|
|
35
|
+
|
|
36
|
+
## Usage Examples
|
|
37
|
+
|
|
38
|
+
### 1. Basic 6-Digit Verification with Completion Handler
|
|
39
|
+
```html
|
|
40
|
+
<st-otp
|
|
41
|
+
[length]="6"
|
|
42
|
+
type="number"
|
|
43
|
+
(completed)="verifyCode($event)">
|
|
44
|
+
</st-otp>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Two-Way State, Auto-Clear on Error, & Loading Overlay
|
|
48
|
+
```html
|
|
49
|
+
<st-otp
|
|
50
|
+
[length]="6"
|
|
51
|
+
[(state)]="otpState"
|
|
52
|
+
[clearOnError]="true"
|
|
53
|
+
[clearOnErrorDelay]="1000"
|
|
54
|
+
[errorMessage]="errorMessage()"
|
|
55
|
+
(completed)="onOtpComplete($event)">
|
|
56
|
+
</st-otp>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Reactive Forms Integration
|
|
60
|
+
```html
|
|
61
|
+
<st-otp
|
|
62
|
+
[formControl]="otpControl"
|
|
63
|
+
[length]="4"
|
|
64
|
+
type="number">
|
|
65
|
+
</st-otp>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
|
|
@@ -6,15 +6,18 @@ This file contains the AI documentation for the `pagination` feature and its rel
|
|
|
6
6
|
- **Selector**: `st-pagination`
|
|
7
7
|
- **Imports**: `StrataPaginationComponent`
|
|
8
8
|
- **Inputs**:
|
|
9
|
-
- `[totalPages] (number)
|
|
10
|
-
- `[
|
|
9
|
+
- `[totalPages] (number, required)`: Total number of pages available.
|
|
10
|
+
- `[(currentPage)] (model<number>)`: Two-way bound current active page (1-based). Defaults to `1`.
|
|
11
|
+
- `[hideNextPreviousAtStartEnd] (boolean)`: When true, hides Previous at page 1 and Next at last page. Defaults to `false`.
|
|
11
12
|
- **Outputs**:
|
|
12
|
-
- `(pageSelected)
|
|
13
|
+
- `(pageSelected) (number)`: Emitted when the user selects a page or uses next/previous controls.
|
|
14
|
+
- **Accessibility**: Host automatically exposes `role="navigation"` and `aria-label="Pagination"`. Active page button has `aria-current="page"`. Gaps are rendered as non-interactive `<span class="pagination-ellipsis" aria-hidden="true">...</span>`.
|
|
13
15
|
|
|
14
16
|
## Usage Example
|
|
15
17
|
|
|
16
18
|
```html
|
|
17
19
|
<st-pagination
|
|
20
|
+
[(currentPage)]="currentPage"
|
|
18
21
|
[totalPages]="10"
|
|
19
22
|
(pageSelected)="loadPage($event)">
|
|
20
23
|
</st-pagination>
|
|
@@ -5,25 +5,45 @@ This file contains the AI documentation for the `radio` feature and its related
|
|
|
5
5
|
## Radio (`<st-radio>`)
|
|
6
6
|
- **Selector**: `st-radio`
|
|
7
7
|
- **Imports**: `StrataRadioComponent`
|
|
8
|
-
- **Inputs**:
|
|
9
|
-
- `[value] (string)
|
|
10
|
-
- `[label] (string | undefined)
|
|
11
|
-
- `[
|
|
8
|
+
- **Inputs & Models**:
|
|
9
|
+
- `[value] (string)`: Unique value represented by this radio item. Required.
|
|
10
|
+
- `[label] (string | undefined)`: Label text displayed next to the radio circle.
|
|
11
|
+
- `[(checked)] (model<boolean>)`: Whether this radio item is active.
|
|
12
|
+
- `[disabled] (boolean)`: Disables user interaction on this specific radio.
|
|
12
13
|
- **Outputs**:
|
|
13
|
-
- `(
|
|
14
|
+
- `(selected)`: Emitted when the radio button is selected.
|
|
14
15
|
|
|
15
16
|
## RadioGroup (`<st-radio-group>`)
|
|
16
17
|
- **Selector**: `st-radio-group`
|
|
17
18
|
- **Imports**: `StrataRadioGroupComponent`
|
|
19
|
+
- **Inputs & Models**:
|
|
20
|
+
- `[(value)] (model<string>)`: Current active radio value in the group.
|
|
21
|
+
- `[disabled] (boolean)`: Disables all radio buttons in the group.
|
|
22
|
+
- **Outputs**:
|
|
23
|
+
- `(valueChange)`: Emitted whenever the group selection changes.
|
|
24
|
+
|
|
25
|
+
## Form Integration
|
|
26
|
+
Implements `ControlValueAccessor` (CVA) on `<st-radio-group>`. Compatible with Reactive Forms (`formControlName`, `[formControl]`) and template-driven forms (`[(ngModel)]`). Supports keyboard arrow navigation (Up/Down/Left/Right) across options.
|
|
18
27
|
|
|
19
|
-
## Usage
|
|
28
|
+
## Usage Examples
|
|
20
29
|
|
|
30
|
+
### 1. Two-Way Binding with Radio Group
|
|
21
31
|
```html
|
|
22
|
-
<st-radio-group [(
|
|
23
|
-
<st-radio value="
|
|
24
|
-
<st-radio value="
|
|
25
|
-
<st-radio value="
|
|
32
|
+
<st-radio-group [(value)]="selectedTier">
|
|
33
|
+
<st-radio value="free" label="Free Tier"></st-radio>
|
|
34
|
+
<st-radio value="pro" label="Pro Tier"></st-radio>
|
|
35
|
+
<st-radio value="enterprise" label="Enterprise" [disabled]="true"></st-radio>
|
|
36
|
+
</st-radio-group>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Reactive Forms Integration
|
|
40
|
+
```html
|
|
41
|
+
<st-radio-group [formControl]="themeControl">
|
|
42
|
+
<st-radio value="light" label="Light Mode"></st-radio>
|
|
43
|
+
<st-radio value="dark" label="Dark Mode"></st-radio>
|
|
44
|
+
<st-radio value="system" label="System Default"></st-radio>
|
|
26
45
|
</st-radio-group>
|
|
27
46
|
```
|
|
28
47
|
|
|
29
48
|
> **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
|
|
49
|
+
|
|
@@ -5,34 +5,55 @@ This file contains the AI documentation for the `segmented-control` feature and
|
|
|
5
5
|
## SegmentedControl (`<st-segmented-control>`)
|
|
6
6
|
- **Selector**: `st-segmented-control`
|
|
7
7
|
- **Imports**: `StrataSegmentedControlComponent`
|
|
8
|
-
- **Inputs**:
|
|
9
|
-
- `[
|
|
8
|
+
- **Inputs & Models**:
|
|
9
|
+
- `[(value)] (model<string>)`: Current active segment value (maps to selected child item's `value` or `text`).
|
|
10
|
+
- `[disabled] (boolean)`: Disables the entire segmented control and all child items.
|
|
11
|
+
- `[size] ('sm' | 'md' | 'lg')`: Size variant (default `'md'`).
|
|
12
|
+
- `[fullWidth] (boolean)`: Whether items stretch equally to fill the parent width.
|
|
13
|
+
- **Outputs**:
|
|
14
|
+
- `(valueChange)`: Emitted whenever the active segment value changes.
|
|
10
15
|
|
|
11
16
|
## SegmentedControlItem (`<st-segmented-control-item>`)
|
|
12
17
|
- **Selector**: `st-segmented-control-item`
|
|
13
18
|
- **Imports**: `StrataSegmentedControlItemComponent`
|
|
14
|
-
- **Inputs**:
|
|
15
|
-
- `[text] (string)
|
|
16
|
-
- `[
|
|
19
|
+
- **Inputs & Models**:
|
|
20
|
+
- `[text] (string)`: Display label text. Required.
|
|
21
|
+
- `[value] (string | undefined)`: Form value associated with item (defaults to `text` if omitted).
|
|
22
|
+
- `[(selected)] (model<boolean>)`: Whether item is selected.
|
|
23
|
+
- `[disabled] (boolean)`: Disables this individual item.
|
|
17
24
|
- **Outputs**:
|
|
18
|
-
- `(selectionChanged)
|
|
25
|
+
- `(selectionChanged)`: Emitted when the item becomes selected.
|
|
26
|
+
|
|
27
|
+
## Form Integration
|
|
28
|
+
Implements `ControlValueAccessor` (CVA). Compatible with Reactive Forms (`formControlName`, `[formControl]`) and template-driven forms (`[(ngModel)]`). Supports keyboard Space/Enter selection.
|
|
29
|
+
|
|
30
|
+
## Usage Examples
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
### 1. Two-Way Value Binding
|
|
33
|
+
```html
|
|
34
|
+
<st-segmented-control [(value)]="currentView">
|
|
35
|
+
<st-segmented-control-item text="List" value="list"></st-segmented-control-item>
|
|
36
|
+
<st-segmented-control-item text="Grid" value="grid"></st-segmented-control-item>
|
|
37
|
+
<st-segmented-control-item text="Kanban" value="kanban"></st-segmented-control-item>
|
|
38
|
+
</st-segmented-control>
|
|
39
|
+
```
|
|
21
40
|
|
|
41
|
+
### 2. Reactive Forms Integration
|
|
22
42
|
```html
|
|
23
|
-
<st-segmented-control [
|
|
24
|
-
<st-segmented-control-item
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
<st-segmented-control [formControl]="billingCycleControl">
|
|
44
|
+
<st-segmented-control-item text="Monthly" value="monthly"></st-segmented-control-item>
|
|
45
|
+
<st-segmented-control-item text="Annual (Save 20%)" value="annual"></st-segmented-control-item>
|
|
46
|
+
</st-segmented-control>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Full Width with Size Variants
|
|
50
|
+
```html
|
|
51
|
+
<st-segmented-control [fullWidth]="true" size="sm" [(value)]="activeTab">
|
|
52
|
+
<st-segmented-control-item text="Overview" value="overview"></st-segmented-control-item>
|
|
53
|
+
<st-segmented-control-item text="Analytics" value="analytics"></st-segmented-control-item>
|
|
54
|
+
<st-segmented-control-item text="Settings" value="settings"></st-segmented-control-item>
|
|
35
55
|
</st-segmented-control>
|
|
36
56
|
```
|
|
37
57
|
|
|
38
58
|
> **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
|
|
59
|
+
|
|
@@ -1,41 +1,62 @@
|
|
|
1
1
|
# ngx-strata: sidemenu Feature
|
|
2
2
|
|
|
3
|
-
This file contains the AI documentation for the `sidemenu` feature and its
|
|
3
|
+
This file contains the AI documentation for the `sidemenu` feature and its
|
|
4
|
+
related components.
|
|
4
5
|
|
|
5
6
|
## SidemenuItem (`[stSidemenuItem]`)
|
|
7
|
+
|
|
6
8
|
- **Selector**: `[stSidemenuItem]`
|
|
7
9
|
- **Imports**: `StrataSidemenuItemDirective`
|
|
8
10
|
- **Inputs**:
|
|
9
11
|
- `[active] (boolean)`
|
|
12
|
+
- `[secondaryActionIcon] (string)`
|
|
13
|
+
- **Outputs**:
|
|
14
|
+
- `(secondaryAction) (MouseEvent)`
|
|
10
15
|
|
|
11
16
|
## Sidemenu (`<st-sidemenu>`)
|
|
17
|
+
|
|
12
18
|
- **Selector**: `st-sidemenu`
|
|
13
19
|
- **Imports**: `StrataSidemenuComponent`
|
|
14
20
|
|
|
15
21
|
## SidemenuItemGroup (`<st-sidemenu-item-group>`)
|
|
22
|
+
|
|
16
23
|
- **Selector**: `st-sidemenu-item-group`
|
|
17
24
|
- **Imports**: `StrataSidemenuItemGroupComponent`
|
|
18
25
|
- **Inputs**:
|
|
19
|
-
- `[label] (string)`
|
|
26
|
+
- `[label] (string, required)`
|
|
27
|
+
- `[routerLink] (string | any[])`
|
|
28
|
+
- `[href] (string)`
|
|
29
|
+
- `[active] (boolean)`
|
|
20
30
|
|
|
21
31
|
## SidemenuSection (`<st-sidemenu-section>`)
|
|
32
|
+
|
|
22
33
|
- **Selector**: `st-sidemenu-section`
|
|
23
34
|
- **Imports**: `StrataSidemenuSectionComponent`
|
|
24
35
|
- **Inputs**:
|
|
25
36
|
- `[label] (string)`
|
|
26
37
|
|
|
27
|
-
> **Note to AI Agents**: Prioritize using these components over raw HTML equivalents. Use modern Angular Signals (input(), input.required(), and output()) for all data/event bindings. Do not use legacy @Input() or @Output() decorators.
|
|
28
38
|
## Usage Example
|
|
29
39
|
|
|
30
40
|
```html
|
|
31
41
|
<st-sidemenu>
|
|
32
42
|
<st-sidemenu-section label="Main Menu">
|
|
43
|
+
<!-- Standard group toggle -->
|
|
33
44
|
<st-sidemenu-item-group label="Dashboard">
|
|
34
|
-
<
|
|
35
|
-
<
|
|
45
|
+
<a stSidemenuItem href="/overview">Overview</a>
|
|
46
|
+
<a stSidemenuItem href="/analytics">Analytics</a>
|
|
47
|
+
</st-sidemenu-item-group>
|
|
48
|
+
|
|
49
|
+
<!-- Navigable group header (click header navigates, chevron toggles sub-items) -->
|
|
50
|
+
<st-sidemenu-item-group label="Projects" routerLink="/projects">
|
|
51
|
+
<a stSidemenuItem routerLink="/projects/alpha">Alpha</a>
|
|
52
|
+
<a stSidemenuItem routerLink="/projects/beta">Beta</a>
|
|
36
53
|
</st-sidemenu-item-group>
|
|
37
54
|
</st-sidemenu-section>
|
|
38
55
|
</st-sidemenu>
|
|
39
56
|
```
|
|
40
57
|
|
|
41
|
-
> **Note to AI Agents**: Prioritize using these components over raw HTML
|
|
58
|
+
> **Note to AI Agents**: Prioritize using these components over raw HTML
|
|
59
|
+
> equivalents. Use modern Angular Signals (input(), input.required(), and
|
|
60
|
+
> output()) for all data/event bindings. Do not use legacy @Input() or @Output()
|
|
61
|
+
> decorators.
|
|
62
|
+
|