@smartsoft001/claude-plugins 2.119.0 → 2.121.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/package.json +1 -1
- package/plugins/smart/.claude-plugin/plugin.json +1 -1
- package/plugins/smart/agents/angular-components/AGENT.md +212 -11
- package/plugins/smart/skills/angular-components-accordion/SKILL.md +86 -0
- package/plugins/smart/skills/angular-components-action-panel/SKILL.md +195 -0
- package/plugins/smart/skills/angular-components-breadcrumbs/SKILL.md +152 -0
- package/plugins/smart/skills/angular-components-button/SKILL.md +81 -54
- package/plugins/smart/skills/angular-components-calendar/SKILL.md +222 -0
- package/plugins/smart/skills/angular-components-card/SKILL.md +112 -0
- package/plugins/smart/skills/angular-components-card-heading/SKILL.md +156 -0
- package/plugins/smart/skills/angular-components-date-edit/SKILL.md +107 -0
- package/plugins/smart/skills/angular-components-date-range/SKILL.md +149 -0
- package/plugins/smart/skills/angular-components-description-list/SKILL.md +205 -0
- package/plugins/smart/skills/angular-components-detail/SKILL.md +146 -0
- package/plugins/smart/skills/angular-components-details/SKILL.md +123 -0
- package/plugins/smart/skills/angular-components-empty-state/SKILL.md +198 -0
- package/plugins/smart/skills/angular-components-feed/SKILL.md +199 -0
- package/plugins/smart/skills/angular-components-form/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-grid-list/SKILL.md +215 -0
- package/plugins/smart/skills/angular-components-info/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-input/SKILL.md +196 -0
- package/plugins/smart/skills/angular-components-list/SKILL.md +265 -0
- package/plugins/smart/skills/angular-components-multi-column-layout/SKILL.md +174 -0
- package/plugins/smart/skills/angular-components-navbar/SKILL.md +192 -0
- package/plugins/smart/skills/angular-components-page/SKILL.md +230 -0
- package/plugins/smart/skills/angular-components-page-heading/SKILL.md +183 -0
- package/plugins/smart/skills/angular-components-paging/SKILL.md +132 -0
- package/plugins/smart/skills/angular-components-password-strength/SKILL.md +172 -0
- package/plugins/smart/skills/angular-components-progress-bars/SKILL.md +187 -0
- package/plugins/smart/skills/angular-components-searchbar/SKILL.md +167 -0
- package/plugins/smart/skills/angular-components-section-heading/SKILL.md +177 -0
- package/plugins/smart/skills/angular-components-select-menu/SKILL.md +211 -0
- package/plugins/smart/skills/angular-components-sidebar-layout/SKILL.md +176 -0
- package/plugins/smart/skills/angular-components-sidebar-navigation/SKILL.md +225 -0
- package/plugins/smart/skills/angular-components-sign-in-form/SKILL.md +202 -0
- package/plugins/smart/skills/angular-components-stacked-layout/SKILL.md +169 -0
- package/plugins/smart/skills/angular-components-stacked-list/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-stats/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-table/SKILL.md +216 -0
- package/plugins/smart/skills/angular-components-tabs/SKILL.md +181 -0
- package/plugins/smart/skills/angular-components-textarea/SKILL.md +168 -0
- package/plugins/smart/skills/angular-components-toggle/SKILL.md +155 -0
- package/plugins/smart/skills/angular-components-vertical-navigation/SKILL.md +158 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-paging
|
|
3
|
+
description: Paging component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Paging Component
|
|
8
|
+
|
|
9
|
+
The `<smart-paging>` component provides a flexible pagination wrapper with an InjectionToken-based extension mechanism. It renders a default `PagingStandardComponent` which can be replaced via `PAGING_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the paging component
|
|
14
|
+
- Developer asks about `<smart-paging>` or `PagingComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### PagingComponent (`<smart-paging>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `PagingStandardComponent` by default. When `PAGING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### PagingStandardComponent (`<smart-paging-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Simple Tailwind-styled pagination placeholder with prev/next buttons, numeric page buttons (with ellipsis handling) and `aria-current` for the active page. Supports dark mode and disabled states.
|
|
25
|
+
|
|
26
|
+
### PagingBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom paging implementations. Provides signal-based state (`currentPage`, `totalPages`, `pageSize`, `totalItems`, `variant`, `cssClass`), computed helpers (`showingFrom`, `showingTo`, `canGoBack`, `canGoForward`, `pages`) and navigation methods (`goToPage`, `nextPage`, `previousPage`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ------------- | ---------------------------- | --------------- | ------------------------------------------- |
|
|
36
|
+
| `currentPage` | `InputSignal<number>` | `1` | Current active page |
|
|
37
|
+
| `totalPages` | `InputSignal<number>` | `1` | Total number of pages |
|
|
38
|
+
| `pageSize` | `InputSignal<number>` | `10` | Items per page |
|
|
39
|
+
| `totalItems` | `InputSignal<number>` | `0` | Total number of items |
|
|
40
|
+
| `variant` | `InputSignal<PagingVariant>` | `'card-footer'` | Variant hint for extensions |
|
|
41
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
42
|
+
|
|
43
|
+
### Outputs
|
|
44
|
+
|
|
45
|
+
| Output | Type | Description |
|
|
46
|
+
| ------------ | ----------------------- | ------------------------------- |
|
|
47
|
+
| `pageChange` | `OutputEmitter<number>` | Emits the requested page number |
|
|
48
|
+
|
|
49
|
+
### PagingVariant
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
type PagingVariant = 'card-footer' | 'centered' | 'simple';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### PAGING_STANDARD_COMPONENT_TOKEN
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { PAGING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
InjectionToken that allows replacing the default `PagingStandardComponent` with a custom implementation. Provide a `Type<PagingBaseComponent>` to override.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// In your app module or component providers:
|
|
65
|
+
providers: [
|
|
66
|
+
{
|
|
67
|
+
provide: PAGING_STANDARD_COMPONENT_TOKEN,
|
|
68
|
+
useValue: MyCustomPagingComponent,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Extending the Base Class
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
77
|
+
import { PagingBaseComponent } from '@smartsoft001/angular';
|
|
78
|
+
|
|
79
|
+
@Component({
|
|
80
|
+
selector: 'my-custom-paging',
|
|
81
|
+
template: `
|
|
82
|
+
<nav [class]="cssClass()">
|
|
83
|
+
<button [disabled]="!canGoBack()" (click)="previousPage()">Prev</button>
|
|
84
|
+
@for (page of pages(); track $index) {
|
|
85
|
+
@if (page === '...') {
|
|
86
|
+
<span>…</span>
|
|
87
|
+
} @else {
|
|
88
|
+
<button (click)="goToPage(+page)">{{ page }}</button>
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
<button [disabled]="!canGoForward()" (click)="nextPage()">Next</button>
|
|
92
|
+
</nav>
|
|
93
|
+
`,
|
|
94
|
+
encapsulation: ViewEncapsulation.None,
|
|
95
|
+
})
|
|
96
|
+
export class MyCustomPagingComponent extends PagingBaseComponent {}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Usage Examples
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<!-- Default paging -->
|
|
103
|
+
<smart-paging
|
|
104
|
+
[currentPage]="page()"
|
|
105
|
+
[totalPages]="totalPages()"
|
|
106
|
+
(pageChange)="onPageChange($event)"
|
|
107
|
+
></smart-paging>
|
|
108
|
+
|
|
109
|
+
<!-- With total items and custom page size -->
|
|
110
|
+
<smart-paging
|
|
111
|
+
[currentPage]="1"
|
|
112
|
+
[totalPages]="10"
|
|
113
|
+
[pageSize]="25"
|
|
114
|
+
[totalItems]="248"
|
|
115
|
+
(pageChange)="loadPage($event)"
|
|
116
|
+
></smart-paging>
|
|
117
|
+
|
|
118
|
+
<!-- With external class -->
|
|
119
|
+
<smart-paging
|
|
120
|
+
class="smart:mt-4"
|
|
121
|
+
[currentPage]="page()"
|
|
122
|
+
[totalPages]="totalPages()"
|
|
123
|
+
(pageChange)="onPageChange($event)"
|
|
124
|
+
></smart-paging>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## File Locations
|
|
128
|
+
|
|
129
|
+
- Wrapper: `packages/shared/angular/src/lib/components/paging/paging.component.ts`
|
|
130
|
+
- Standard: `packages/shared/angular/src/lib/components/paging/standard/standard.component.ts`
|
|
131
|
+
- Base class: `packages/shared/angular/src/lib/components/paging/base/base.component.ts`
|
|
132
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`PAGING_STANDARD_COMPONENT_TOKEN`)
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-password-strength
|
|
3
|
+
description: Password-strength indicator component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Password Strength Component
|
|
8
|
+
|
|
9
|
+
The `<smart-password-strength>` component renders a three-bar strength indicator with an optional hint list of unmet requirements. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. It renders a default `PasswordStrengthStandardComponent` which can be replaced via `PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the password-strength indicator
|
|
14
|
+
- Developer asks about `<smart-password-strength>`, `PasswordStrengthComponent`, `PasswordStrengthStandardComponent`, or `PasswordStrengthBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### PasswordStrengthComponent (`<smart-password-strength>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `PasswordStrengthStandardComponent` by default. When `PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Forwards the `passwordStrength` output from the injected instance through its own output.
|
|
21
|
+
|
|
22
|
+
### PasswordStrengthStandardComponent (`<smart-password-strength-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Renders:
|
|
25
|
+
|
|
26
|
+
- three bars whose Tailwind classes come from `barClasses()` (filled-left-to-right by strength index),
|
|
27
|
+
- a message `<p>` with a translation key `INPUT.PASSWORD-STRENGTH.{poor|notGood|good}` when applicable,
|
|
28
|
+
- a hint `<ul>` (shown while `showHint()` is `true`) listing unmet requirements via `INPUT.ERRORS.*` keys,
|
|
29
|
+
- dark-mode variants via `smart:dark:*` classes.
|
|
30
|
+
|
|
31
|
+
### PasswordStrengthBaseComponent (abstract)
|
|
32
|
+
|
|
33
|
+
Abstract base directive for extending custom implementations. Exposes signal inputs, the output, the pure strength algorithm, and computed signals for classes and labels.
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### Inputs
|
|
38
|
+
|
|
39
|
+
| Input | Type | Default | Description |
|
|
40
|
+
| ----------------- | ---------------------- | -------- | ------------------------------------------- |
|
|
41
|
+
| `passwordToCheck` | `InputSignal<string>` | required | Password value to evaluate |
|
|
42
|
+
| `showHint` | `InputSignal<boolean>` | required | Show a hint list of unmet requirements |
|
|
43
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
44
|
+
|
|
45
|
+
### Outputs
|
|
46
|
+
|
|
47
|
+
| Output | Type | Description |
|
|
48
|
+
| ------------------ | --------------------------- | ------------------------------------------------------------------------------------- |
|
|
49
|
+
| `passwordStrength` | `OutputEmitterRef<boolean>` | Emits `true` when strength is maximal (lower+upper+symbol+length), `false` otherwise. |
|
|
50
|
+
|
|
51
|
+
### Exposed base signals (available when extending the base)
|
|
52
|
+
|
|
53
|
+
| Signal | Type | Description |
|
|
54
|
+
| -------------------- | ----------------------------------------------------- | ---------------------------------------------------------- |
|
|
55
|
+
| `result()` | `{ lowerLetters; upperLetters; symbols; passLength }` | Flags for detected character classes and length threshold. |
|
|
56
|
+
| `strength()` | `number` (0, 10, 20, 30) | Numeric strength score matching the original algorithm. |
|
|
57
|
+
| `strengthIndex()` | `0 \| 1 \| 2 \| 3` | 0=poor, 1=notGood, 2=good, 3=none/too-weak. |
|
|
58
|
+
| `msg()` | `'' \| 'poor' \| 'notGood' \| 'good'` | Translation-key suffix for the message. |
|
|
59
|
+
| `barClasses()` | `string[]` (length 3) | Tailwind class string per bar. |
|
|
60
|
+
| `msgClass()` | `string` | Tailwind color class for the message `<p>`. |
|
|
61
|
+
| `containerClasses()` | `string` | Base container classes with `cssClass()` appended. |
|
|
62
|
+
|
|
63
|
+
### PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
InjectionToken that allows replacing the default `PasswordStrengthStandardComponent` with a custom implementation. Provide a `Type<PasswordStrengthBaseComponent>` to override.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
providers: [
|
|
73
|
+
{
|
|
74
|
+
provide: PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN,
|
|
75
|
+
useValue: MyCustomPasswordStrengthComponent,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Extending the Base Class
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import {
|
|
84
|
+
ChangeDetectionStrategy,
|
|
85
|
+
Component,
|
|
86
|
+
ViewEncapsulation,
|
|
87
|
+
input,
|
|
88
|
+
} from '@angular/core';
|
|
89
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
90
|
+
|
|
91
|
+
import { PasswordStrengthBaseComponent } from '@smartsoft001/angular';
|
|
92
|
+
|
|
93
|
+
@Component({
|
|
94
|
+
selector: 'my-custom-password-strength',
|
|
95
|
+
template: `
|
|
96
|
+
<div [class]="containerClasses()">
|
|
97
|
+
<div class="my-bars">
|
|
98
|
+
<span [class]="barClasses()[0]"></span>
|
|
99
|
+
<span [class]="barClasses()[1]"></span>
|
|
100
|
+
<span [class]="barClasses()[2]"></span>
|
|
101
|
+
</div>
|
|
102
|
+
@if (msg()) {
|
|
103
|
+
<p [class]="msgClass()">
|
|
104
|
+
{{ 'INPUT.PASSWORD-STRENGTH.' + msg() | translate }}
|
|
105
|
+
</p>
|
|
106
|
+
}
|
|
107
|
+
</div>
|
|
108
|
+
`,
|
|
109
|
+
imports: [TranslatePipe],
|
|
110
|
+
encapsulation: ViewEncapsulation.None,
|
|
111
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
112
|
+
})
|
|
113
|
+
export class MyCustomPasswordStrengthComponent extends PasswordStrengthBaseComponent {
|
|
114
|
+
override cssClass = input<string>('');
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
When extending the base directly, remember to:
|
|
119
|
+
|
|
120
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) when used via `NgComponentOutlet` through `PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
121
|
+
- rely on `barClasses()`, `msgClass()`, and `containerClasses()` for Tailwind class strings rather than recomputing them,
|
|
122
|
+
- do not re-emit `passwordStrength` — the base class does that automatically via an `effect()`.
|
|
123
|
+
|
|
124
|
+
## Usage Examples
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<!-- Basic -->
|
|
128
|
+
<smart-password-strength
|
|
129
|
+
[passwordToCheck]="password"
|
|
130
|
+
[showHint]="false"
|
|
131
|
+
></smart-password-strength>
|
|
132
|
+
|
|
133
|
+
<!-- With hint list of unmet requirements -->
|
|
134
|
+
<smart-password-strength
|
|
135
|
+
[passwordToCheck]="password"
|
|
136
|
+
[showHint]="true"
|
|
137
|
+
></smart-password-strength>
|
|
138
|
+
|
|
139
|
+
<!-- Reacting to strength changes -->
|
|
140
|
+
<smart-password-strength
|
|
141
|
+
[passwordToCheck]="password"
|
|
142
|
+
[showHint]="false"
|
|
143
|
+
(passwordStrength)="onStrong($event)"
|
|
144
|
+
></smart-password-strength>
|
|
145
|
+
|
|
146
|
+
<!-- With external class -->
|
|
147
|
+
<smart-password-strength
|
|
148
|
+
class="smart:max-w-sm"
|
|
149
|
+
[passwordToCheck]="password"
|
|
150
|
+
[showHint]="true"
|
|
151
|
+
></smart-password-strength>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Translation Keys
|
|
155
|
+
|
|
156
|
+
The default template reads the following keys through `TranslatePipe`:
|
|
157
|
+
|
|
158
|
+
- `INPUT.PASSWORD-STRENGTH.poor` — strength === 10
|
|
159
|
+
- `INPUT.PASSWORD-STRENGTH.notGood` — strength === 20
|
|
160
|
+
- `INPUT.PASSWORD-STRENGTH.good` — strength === 30
|
|
161
|
+
- `INPUT.ERRORS.invalidMinLength` — shown when password length ≤ 6 (suffixed with ` 7`)
|
|
162
|
+
- `INPUT.ERRORS.upperLetters` — shown when no uppercase letter detected
|
|
163
|
+
- `INPUT.ERRORS.lowerLetters` — shown when no lowercase letter detected
|
|
164
|
+
- `INPUT.ERRORS.symbols` — shown when no symbol detected
|
|
165
|
+
|
|
166
|
+
## File Locations
|
|
167
|
+
|
|
168
|
+
- Wrapper: `packages/shared/angular/src/lib/components/password-strength/password-strength.component.ts`
|
|
169
|
+
- Standard: `packages/shared/angular/src/lib/components/password-strength/standard/standard.component.ts`
|
|
170
|
+
- Base class: `packages/shared/angular/src/lib/components/password-strength/base/base.component.ts`
|
|
171
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN`)
|
|
172
|
+
- Type union: `packages/shared/angular/src/lib/models/interfaces.ts` (`DynamicComponentType` includes `'password-strength'`)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-progress-bars
|
|
3
|
+
description: Progress indicators with step list (8 visual variants) and percentage progress bar mode. InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Progress Bars Component
|
|
8
|
+
|
|
9
|
+
The `<smart-progress-bars>` component renders either a list of progress steps (with statuses `complete`, `current`, `upcoming`) or a percentage-based bar with optional column labels. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `ProgressBarsBaseComponent` defines the shared API — `options` (`IProgressBarsOptions`), `cssClass` (alias `class`), and the `stepClick` output. `ProgressBarsStandardComponent` is a barebones placeholder using native HTML. `ProgressBarsComponent` is the public wrapper that renders `ProgressBarsStandardComponent` by default and accepts a custom replacement via `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the progress steps / progress bar component
|
|
14
|
+
- Developer asks about `<smart-progress-bars>`, `ProgressBarsComponent`, `ProgressBarsStandardComponent`, or `ProgressBarsBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### ProgressBarsComponent (`<smart-progress-bars>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `ProgressBarsStandardComponent` by default. When `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `stepClick`.
|
|
21
|
+
|
|
22
|
+
### ProgressBarsStandardComponent (`<smart-progress-bars-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder. Two rendering modes selected by `options.layout`:
|
|
25
|
+
|
|
26
|
+
**Step mode (default; layouts `simple`, `panels`, `bullets`, `panels-with-border`, `circles`, `bullets-and-text`, `circles-with-text`):**
|
|
27
|
+
Renders `<nav class="progress-bars">` (with `aria-label` from `options.ariaLabel` or default `"Progress"`) containing an `<ol>` of steps. The `data-layout` attribute reflects `options.layout` so each visual variant can be styled. Each step renders as `<a class="progress-bars-step-link">` (when `href` provided) or `<button class="progress-bars-step-button">` (otherwise emits `stepClick`). Steps get `current` class and `aria-current="step"` when `status === 'current'`. The `data-status` attribute on the `<li>` reflects `status` (defaults to `'upcoming'`). Supports `iconTpl`, `index` (e.g. "02"), `name`, and `description`.
|
|
28
|
+
|
|
29
|
+
**Bar mode (layout `progress-bar`):**
|
|
30
|
+
Renders `<div class="progress-bars-bar-wrapper">` with optional `<h4 class="sr-only">` (from `srOnlyTitle`), optional `<p class="progress-bars-title">` (from `title`), a track + `<div class="progress-bars-fill" role="progressbar">` (width = clamped `value` 0–100), and optional `<div class="progress-bars-columns">` row of column labels (each with `active` class when `column.active === true`).
|
|
31
|
+
|
|
32
|
+
### ProgressBarsBaseComponent (abstract)
|
|
33
|
+
|
|
34
|
+
Abstract base directive. Exposes:
|
|
35
|
+
|
|
36
|
+
- `options: InputSignal<IProgressBarsOptions | undefined>`
|
|
37
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
38
|
+
- `stepClick: OutputEmitterRef<IProgressStepClick>`
|
|
39
|
+
|
|
40
|
+
`IProgressStepClick = { stepId: string }`.
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
### Inputs
|
|
45
|
+
|
|
46
|
+
| Input | Type | Default | Description |
|
|
47
|
+
| --------- | ------------------------------------------------ | ------- | ------------------------------------------- |
|
|
48
|
+
| `options` | `InputSignal<IProgressBarsOptions \| undefined>` | - | Progress configuration |
|
|
49
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
50
|
+
|
|
51
|
+
### Outputs
|
|
52
|
+
|
|
53
|
+
| Output | Type | Description |
|
|
54
|
+
| ----------- | -------------------------------------- | ------------------------------------------ |
|
|
55
|
+
| `stepClick` | `OutputEmitterRef<IProgressStepClick>` | Emitted when a button-type step is clicked |
|
|
56
|
+
|
|
57
|
+
### IProgressBarsOptions
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
type SmartProgressBarsLayout =
|
|
61
|
+
| 'simple'
|
|
62
|
+
| 'panels'
|
|
63
|
+
| 'bullets'
|
|
64
|
+
| 'panels-with-border'
|
|
65
|
+
| 'circles'
|
|
66
|
+
| 'bullets-and-text'
|
|
67
|
+
| 'circles-with-text'
|
|
68
|
+
| 'progress-bar';
|
|
69
|
+
|
|
70
|
+
type SmartProgressStepStatus = 'complete' | 'current' | 'upcoming';
|
|
71
|
+
|
|
72
|
+
interface IProgressStep {
|
|
73
|
+
id: string;
|
|
74
|
+
name?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
status?: SmartProgressStepStatus;
|
|
77
|
+
href?: string;
|
|
78
|
+
iconTpl?: TemplateRef<unknown>;
|
|
79
|
+
index?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface IProgressBarColumn {
|
|
83
|
+
label: string;
|
|
84
|
+
active?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface IProgressBarsOptions {
|
|
88
|
+
layout?: SmartProgressBarsLayout;
|
|
89
|
+
ariaLabel?: string;
|
|
90
|
+
steps?: IProgressStep[]; // for step layouts
|
|
91
|
+
title?: string;
|
|
92
|
+
srOnlyTitle?: string;
|
|
93
|
+
value?: number; // 0-100, only for layout="progress-bar"
|
|
94
|
+
columns?: IProgressBarColumn[]; // only for layout="progress-bar"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## PROGRESS_BARS_STANDARD_COMPONENT_TOKEN
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { PROGRESS_BARS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
102
|
+
|
|
103
|
+
providers: [
|
|
104
|
+
{
|
|
105
|
+
provide: PROGRESS_BARS_STANDARD_COMPONENT_TOKEN,
|
|
106
|
+
useValue: MyCustomProgressBarsComponent,
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Extending the Base Class
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import {
|
|
115
|
+
ChangeDetectionStrategy,
|
|
116
|
+
Component,
|
|
117
|
+
input,
|
|
118
|
+
ViewEncapsulation,
|
|
119
|
+
} from '@angular/core';
|
|
120
|
+
|
|
121
|
+
import { ProgressBarsBaseComponent } from '@smartsoft001/angular';
|
|
122
|
+
|
|
123
|
+
@Component({
|
|
124
|
+
selector: 'my-custom-progress-bars',
|
|
125
|
+
template: `…`,
|
|
126
|
+
encapsulation: ViewEncapsulation.None,
|
|
127
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
128
|
+
})
|
|
129
|
+
export class MyCustomProgressBarsComponent extends ProgressBarsBaseComponent {
|
|
130
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
131
|
+
override cssClass = input<string>('');
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Usage Examples
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<!-- Simple step layout -->
|
|
139
|
+
<smart-progress-bars
|
|
140
|
+
[options]="{
|
|
141
|
+
layout: 'simple',
|
|
142
|
+
steps: [
|
|
143
|
+
{ id: '1', name: 'Job details', status: 'complete', href: '/1' },
|
|
144
|
+
{ id: '2', name: 'Application form', status: 'current', href: '/2' },
|
|
145
|
+
{ id: '3', name: 'Preview', status: 'upcoming', href: '/3' },
|
|
146
|
+
],
|
|
147
|
+
}"
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
<!-- Bullets variant with 'Step 2 of 4' header -->
|
|
151
|
+
<smart-progress-bars
|
|
152
|
+
[options]="{
|
|
153
|
+
layout: 'bullets',
|
|
154
|
+
title: 'Step 2 of 4',
|
|
155
|
+
steps: [
|
|
156
|
+
{ id: '1', status: 'complete', href: '/1' },
|
|
157
|
+
{ id: '2', status: 'current', href: '/2' },
|
|
158
|
+
{ id: '3', status: 'upcoming', href: '/3' },
|
|
159
|
+
{ id: '4', status: 'upcoming', href: '/4' },
|
|
160
|
+
],
|
|
161
|
+
}"
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<!-- Percentage progress bar -->
|
|
165
|
+
<smart-progress-bars
|
|
166
|
+
[options]="{
|
|
167
|
+
layout: 'progress-bar',
|
|
168
|
+
title: 'Migrating MySQL database...',
|
|
169
|
+
srOnlyTitle: 'Status',
|
|
170
|
+
value: 37.5,
|
|
171
|
+
columns: [
|
|
172
|
+
{ label: 'Copying files', active: true },
|
|
173
|
+
{ label: 'Migrating database', active: true },
|
|
174
|
+
{ label: 'Compiling assets' },
|
|
175
|
+
{ label: 'Deployed' },
|
|
176
|
+
],
|
|
177
|
+
}"
|
|
178
|
+
/>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## File Locations
|
|
182
|
+
|
|
183
|
+
- Wrapper: `packages/shared/angular/src/lib/components/progress-bars/progress-bars.component.ts`
|
|
184
|
+
- Standard: `packages/shared/angular/src/lib/components/progress-bars/standard/standard.component.ts`
|
|
185
|
+
- Base class: `packages/shared/angular/src/lib/components/progress-bars/base/base.component.ts`
|
|
186
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`PROGRESS_BARS_STANDARD_COMPONENT_TOKEN`)
|
|
187
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IProgressBarsOptions`, `IProgressStep`, `IProgressBarColumn`, `SmartProgressBarsLayout`, `SmartProgressStepStatus`)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-searchbar
|
|
3
|
+
description: Searchbar component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Searchbar Component
|
|
8
|
+
|
|
9
|
+
The `<smart-searchbar>` component provides a debounced search input with an optional toggle button. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. It renders a default `SearchbarStandardComponent` which can be replaced via `SEARCHBAR_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the searchbar component
|
|
14
|
+
- Developer asks about `<smart-searchbar>`, `SearchbarComponent`, `SearchbarStandardComponent`, or `SearchbarBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### SearchbarComponent (`<smart-searchbar>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `SearchbarStandardComponent` by default. When `SEARCHBAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### SearchbarStandardComponent (`<smart-searchbar-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Renders:
|
|
25
|
+
|
|
26
|
+
- a Tailwind-styled `<input type="search">` bound to a `UntypedFormControl` with `debounceTime` from options,
|
|
27
|
+
- a magnifier SVG icon inside the input,
|
|
28
|
+
- an optional toggle button (shown when `show()` is `false` and `options.showToggleButton` is `true`) that reveals the input,
|
|
29
|
+
- `smart:dark:*` dark-mode classes.
|
|
30
|
+
|
|
31
|
+
### SearchbarBaseComponent (abstract)
|
|
32
|
+
|
|
33
|
+
Abstract base directive for extending custom searchbar implementations. Exposes `options`, `cssClass`, `show` and `text` models, a `control` signal wrapping `UntypedFormControl`, and `setShow()`/`tryHide()` methods. The base class wires `control.valueChanges` through `debounceTime()` in `ngAfterViewInit` and emits into the `text` model.
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### Inputs
|
|
38
|
+
|
|
39
|
+
| Input | Type | Default | Description |
|
|
40
|
+
| --------- | --------------------------------------------- | -------- | ----------------------------------------------- |
|
|
41
|
+
| `options` | `InputSignal<ISearchbarOptions \| undefined>` | - | Searchbar configuration |
|
|
42
|
+
| `show` | `ModelSignal<boolean>` | `true` | Whether the input is visible (two-way bindable) |
|
|
43
|
+
| `text` | `ModelSignal<string>` | required | Debounced search text (two-way bindable) |
|
|
44
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
45
|
+
|
|
46
|
+
### ISearchbarOptions
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
interface ISearchbarOptions {
|
|
50
|
+
placeholder?: string; // translation key; default 'search'
|
|
51
|
+
debounceTime?: number; // ms; default 1000
|
|
52
|
+
showToggleButton?: boolean;
|
|
53
|
+
size?: SmartSize; // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
54
|
+
color?: SmartColor; // 22 Tailwind colors
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The `placeholder` value is rendered through `TranslatePipe`, so it may be a translation key. If no `placeholder` is provided, the key `'search'` is used.
|
|
59
|
+
|
|
60
|
+
## SEARCHBAR_STANDARD_COMPONENT_TOKEN
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { SEARCHBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
InjectionToken that allows replacing the default `SearchbarStandardComponent` with a custom implementation. Provide a `Type<SearchbarBaseComponent>` to override.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// In your app module or component providers:
|
|
70
|
+
providers: [
|
|
71
|
+
{
|
|
72
|
+
provide: SEARCHBAR_STANDARD_COMPONENT_TOKEN,
|
|
73
|
+
useValue: MyCustomSearchbarComponent,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Extending the Base Class
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import {
|
|
82
|
+
ChangeDetectionStrategy,
|
|
83
|
+
Component,
|
|
84
|
+
computed,
|
|
85
|
+
input,
|
|
86
|
+
ViewEncapsulation,
|
|
87
|
+
} from '@angular/core';
|
|
88
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
89
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
90
|
+
|
|
91
|
+
import { SearchbarBaseComponent } from '@smartsoft001/angular';
|
|
92
|
+
|
|
93
|
+
@Component({
|
|
94
|
+
selector: 'my-custom-searchbar',
|
|
95
|
+
template: `
|
|
96
|
+
@if (show()) {
|
|
97
|
+
<div [class]="containerClasses()">
|
|
98
|
+
<input
|
|
99
|
+
type="search"
|
|
100
|
+
[formControl]="control()"
|
|
101
|
+
[placeholder]="options()?.placeholder ?? 'search' | translate"
|
|
102
|
+
(blur)="tryHide()"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
} @else if (options()?.showToggleButton) {
|
|
106
|
+
<button type="button" (click)="setShow()">Search</button>
|
|
107
|
+
}
|
|
108
|
+
`,
|
|
109
|
+
imports: [ReactiveFormsModule, TranslatePipe],
|
|
110
|
+
encapsulation: ViewEncapsulation.None,
|
|
111
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
112
|
+
})
|
|
113
|
+
export class MyCustomSearchbarComponent extends SearchbarBaseComponent {
|
|
114
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
115
|
+
override cssClass = input<string>('');
|
|
116
|
+
|
|
117
|
+
containerClasses = computed(() => {
|
|
118
|
+
const classes = ['my-searchbar-container'];
|
|
119
|
+
const extra = this.cssClass();
|
|
120
|
+
if (extra) classes.push(extra);
|
|
121
|
+
return classes.join(' ');
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
When extending the base directly, remember to:
|
|
127
|
+
|
|
128
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `SEARCHBAR_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
129
|
+
- let the base class handle the `control.valueChanges` subscription — do not re-subscribe to emit into `text`.
|
|
130
|
+
|
|
131
|
+
## Usage Examples
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<!-- Default -->
|
|
135
|
+
<smart-searchbar [(text)]="searchText" />
|
|
136
|
+
|
|
137
|
+
<!-- With options (custom placeholder + debounce) -->
|
|
138
|
+
<smart-searchbar
|
|
139
|
+
[(text)]="searchText"
|
|
140
|
+
[options]="{ placeholder: 'users.search', debounceTime: 300 }"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<!-- Hidden with a toggle button -->
|
|
144
|
+
<smart-searchbar
|
|
145
|
+
[(show)]="searchShown"
|
|
146
|
+
[(text)]="searchText"
|
|
147
|
+
[options]="{ showToggleButton: true }"
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
<!-- With external class -->
|
|
151
|
+
<smart-searchbar class="smart:max-w-md" [(text)]="searchText" />
|
|
152
|
+
|
|
153
|
+
<!-- Two-way binding on both show and text -->
|
|
154
|
+
<smart-searchbar
|
|
155
|
+
[(show)]="isSearchOpen"
|
|
156
|
+
[(text)]="query"
|
|
157
|
+
[options]="{ placeholder: 'search.products', debounceTime: 500, showToggleButton: true }"
|
|
158
|
+
/>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## File Locations
|
|
162
|
+
|
|
163
|
+
- Wrapper: `packages/shared/angular/src/lib/components/searchbar/searchbar.component.ts`
|
|
164
|
+
- Standard: `packages/shared/angular/src/lib/components/searchbar/standard/standard.component.ts`
|
|
165
|
+
- Base class: `packages/shared/angular/src/lib/components/searchbar/base/base.component.ts`
|
|
166
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`SEARCHBAR_STANDARD_COMPONENT_TOKEN`)
|
|
167
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ISearchbarOptions`)
|