@smartsoft001/claude-plugins 2.118.0 → 2.120.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,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-tabs
|
|
3
|
+
description: Tabs component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tabs Component
|
|
8
|
+
|
|
9
|
+
The `<smart-tabs>` component renders a tabbed navigation strip (anchor-based for routing or button-based for in-page selection) with a `<select>` fallback for mobile. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TabsBaseComponent` defines the shared API — `options` (`ITabsOptions`), `selectedId` (two-way `ModelSignal<string | null>`), `cssClass` (alias `class`), and the `tabChange` output. `TabsStandardComponent` is a barebones placeholder using native `<nav>`, `<ul>`, `<a>`, `<button>` and `<select>` elements. `TabsComponent` is the public wrapper that renders `TabsStandardComponent` by default and accepts a custom replacement via `TABS_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the tabs component
|
|
14
|
+
- Developer asks about `<smart-tabs>`, `TabsComponent`, `TabsStandardComponent`, or `TabsBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### TabsComponent (`<smart-tabs>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `TabsStandardComponent` by default. When `TABS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `tabChange` and forwards two-way `selectedId`.
|
|
21
|
+
|
|
22
|
+
### TabsStandardComponent (`<smart-tabs-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, an optional mobile `<select>` (rendered when `options.showMobileSelect` is `true` or unset and `items` is non-empty), and a `<nav class="tabs-desktop">` containing a `<ul class="tabs-list">` of items. Each item renders as `<a class="tab-link">` when `href` is provided, otherwise `<button class="tab-button">` emitting `tabChange` and updating `selectedId`. Adds `current` class and `aria-current="page"` when `item.id === selectedId()`. Supports optional `iconTpl` and `badge` per item.
|
|
25
|
+
|
|
26
|
+
### TabsBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `options: InputSignal<ITabsOptions | undefined>`
|
|
31
|
+
- `selectedId: ModelSignal<string | null>` (default `null`)
|
|
32
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
33
|
+
- `tabChange: OutputEmitterRef<ITabChange>`
|
|
34
|
+
|
|
35
|
+
`ITabChange = { tabId: string }`.
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Inputs
|
|
40
|
+
|
|
41
|
+
| Input | Type | Default | Description |
|
|
42
|
+
| ------------ | ---------------------------------------- | ------- | ------------------------------------------- |
|
|
43
|
+
| `options` | `InputSignal<ITabsOptions \| undefined>` | - | Tabs configuration |
|
|
44
|
+
| `selectedId` | `ModelSignal<string \| null>` | `null` | Two-way bindable currently selected tab id |
|
|
45
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
46
|
+
|
|
47
|
+
### Outputs
|
|
48
|
+
|
|
49
|
+
| Output | Type | Description |
|
|
50
|
+
| ----------- | ------------------------------ | ----------------------------------------- |
|
|
51
|
+
| `tabChange` | `OutputEmitterRef<ITabChange>` | Emitted when a button-type tab is clicked |
|
|
52
|
+
|
|
53
|
+
### ITabsOptions
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
type SmartTabsLayout =
|
|
57
|
+
| 'underline'
|
|
58
|
+
| 'underline-with-icons'
|
|
59
|
+
| 'underline-with-badges'
|
|
60
|
+
| 'underline-full-width'
|
|
61
|
+
| 'pills'
|
|
62
|
+
| 'pills-on-gray'
|
|
63
|
+
| 'pills-with-brand-color'
|
|
64
|
+
| 'bar-with-underline'
|
|
65
|
+
| 'simple';
|
|
66
|
+
|
|
67
|
+
interface ITabsOptions {
|
|
68
|
+
layout?: SmartTabsLayout;
|
|
69
|
+
items?: ITabItem[];
|
|
70
|
+
ariaLabel?: string;
|
|
71
|
+
showMobileSelect?: boolean; // default true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ITabItem {
|
|
75
|
+
id: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
href?: string;
|
|
78
|
+
badge?: string | number;
|
|
79
|
+
iconTpl?: TemplateRef<unknown>;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## TABS_STANDARD_COMPONENT_TOKEN
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { TABS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
87
|
+
|
|
88
|
+
providers: [
|
|
89
|
+
{
|
|
90
|
+
provide: TABS_STANDARD_COMPONENT_TOKEN,
|
|
91
|
+
useValue: MyCustomTabsComponent,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Extending the Base Class
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import {
|
|
100
|
+
ChangeDetectionStrategy,
|
|
101
|
+
Component,
|
|
102
|
+
input,
|
|
103
|
+
ViewEncapsulation,
|
|
104
|
+
} from '@angular/core';
|
|
105
|
+
|
|
106
|
+
import { TabsBaseComponent } from '@smartsoft001/angular';
|
|
107
|
+
|
|
108
|
+
@Component({
|
|
109
|
+
selector: 'my-custom-tabs',
|
|
110
|
+
template: `
|
|
111
|
+
<nav>
|
|
112
|
+
@for (item of options()?.items ?? []; track item.id) {
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
[class.current]="selectedId() === item.id"
|
|
116
|
+
(click)="selectedId.set(item.id); tabChange.emit({ tabId: item.id })"
|
|
117
|
+
>
|
|
118
|
+
{{ item.label }}
|
|
119
|
+
</button>
|
|
120
|
+
}
|
|
121
|
+
</nav>
|
|
122
|
+
`,
|
|
123
|
+
encapsulation: ViewEncapsulation.None,
|
|
124
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
125
|
+
})
|
|
126
|
+
export class MyCustomTabsComponent extends TabsBaseComponent {
|
|
127
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
128
|
+
override cssClass = input<string>('');
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Usage Examples
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<!-- Anchor-based tabs (route navigation) -->
|
|
136
|
+
<smart-tabs
|
|
137
|
+
[selectedId]="'team'"
|
|
138
|
+
[options]="{
|
|
139
|
+
items: [
|
|
140
|
+
{ id: 'account', label: 'My Account', href: '/account' },
|
|
141
|
+
{ id: 'company', label: 'Company', href: '/company' },
|
|
142
|
+
{ id: 'team', label: 'Team Members', href: '/team' },
|
|
143
|
+
{ id: 'billing', label: 'Billing', href: '/billing' },
|
|
144
|
+
],
|
|
145
|
+
}"
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<!-- Button-based tabs with two-way binding -->
|
|
149
|
+
<smart-tabs
|
|
150
|
+
[(selectedId)]="active"
|
|
151
|
+
[options]="{
|
|
152
|
+
layout: 'pills',
|
|
153
|
+
items: [
|
|
154
|
+
{ id: 'overview', label: 'Overview' },
|
|
155
|
+
{ id: 'settings', label: 'Settings' },
|
|
156
|
+
],
|
|
157
|
+
}"
|
|
158
|
+
(tabChange)="onTab($event)"
|
|
159
|
+
/>
|
|
160
|
+
|
|
161
|
+
<!-- With badges -->
|
|
162
|
+
<smart-tabs
|
|
163
|
+
[options]="{
|
|
164
|
+
layout: 'underline-with-badges',
|
|
165
|
+
items: [
|
|
166
|
+
{ id: 'applied', label: 'Applied', badge: 52 },
|
|
167
|
+
{ id: 'interview', label: 'Interview', badge: 4 },
|
|
168
|
+
{ id: 'offer', label: 'Offer' },
|
|
169
|
+
],
|
|
170
|
+
}"
|
|
171
|
+
[(selectedId)]="active"
|
|
172
|
+
/>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## File Locations
|
|
176
|
+
|
|
177
|
+
- Wrapper: `packages/shared/angular/src/lib/components/tabs/tabs.component.ts`
|
|
178
|
+
- Standard: `packages/shared/angular/src/lib/components/tabs/standard/standard.component.ts`
|
|
179
|
+
- Base class: `packages/shared/angular/src/lib/components/tabs/base/base.component.ts`
|
|
180
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TABS_STANDARD_COMPONENT_TOKEN`)
|
|
181
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ITabsOptions`, `ITabItem`, `SmartTabsLayout`)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-textarea
|
|
3
|
+
description: Textarea component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Textarea Component
|
|
8
|
+
|
|
9
|
+
The `<smart-textarea>` component renders a multi-line text input with two-way `value` binding, optional placeholder, disabled state, label, action buttons, avatar/toolbar/preview/footer slots, and a structured `actionClick` output. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TextareaBaseComponent` defines the shared API — `value` (two-way `ModelSignal<string>`), `placeholder`, `disabled`, optional `ITextareaOptions`, `cssClass` (alias `class`), and the `actionClick` output. `TextareaStandardComponent` is a barebones placeholder using a native `<textarea>` element. `TextareaComponent` is the public wrapper that renders `TextareaStandardComponent` by default and accepts a custom replacement via `TEXTAREA_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the textarea component
|
|
14
|
+
- Developer asks about `<smart-textarea>`, `TextareaComponent`, `TextareaStandardComponent`, or `TextareaBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### TextareaComponent (`<smart-textarea>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `TextareaStandardComponent` by default. When `TEXTAREA_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `actionClick`.
|
|
21
|
+
|
|
22
|
+
### TextareaStandardComponent (`<smart-textarea-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using a native `<textarea>`. Renders an outer wrapper, an optional `<label>` (when `options.label` provided), optional avatar/toolbar slots, the `<textarea>` with `[value]` two-way bound through input event, `[disabled]`, `[rows]` (default 3), `[attr.maxlength]`, `[attr.placeholder]`, `[attr.aria-label]`, and an optional row of `<button class="action variant-{variant}">` per `options.actions` entry that emits `{ actionId, value }` via `actionClick` (suppressed when disabled). Optional `previewTpl` and `footerTpl` slots render below the actions row. The external `cssClass` is applied to the root wrapper.
|
|
25
|
+
|
|
26
|
+
### TextareaBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `value: ModelSignal<string>` (default `''`)
|
|
31
|
+
- `placeholder: InputSignal<string>` (default `''`)
|
|
32
|
+
- `disabled: InputSignal<boolean>` (default `false`)
|
|
33
|
+
- `options: InputSignal<ITextareaOptions | undefined>`
|
|
34
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
35
|
+
- `actionClick: OutputEmitterRef<ITextareaActionClick>`
|
|
36
|
+
|
|
37
|
+
`ITextareaActionClick = { actionId: string; value: string }`.
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### Inputs
|
|
42
|
+
|
|
43
|
+
| Input | Type | Default | Description |
|
|
44
|
+
| ------------- | -------------------------------------------- | ------- | ------------------------------------------- |
|
|
45
|
+
| `value` | `ModelSignal<string>` | `''` | Two-way bindable textarea value |
|
|
46
|
+
| `placeholder` | `InputSignal<string>` | `''` | Placeholder text |
|
|
47
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Disabled state |
|
|
48
|
+
| `options` | `InputSignal<ITextareaOptions \| undefined>` | - | Optional configuration |
|
|
49
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
50
|
+
|
|
51
|
+
### Outputs
|
|
52
|
+
|
|
53
|
+
| Output | Type | Description |
|
|
54
|
+
| ------------- | ---------------------------------------- | ---------------------------------------- |
|
|
55
|
+
| `actionClick` | `OutputEmitterRef<ITextareaActionClick>` | Emitted when an action button is clicked |
|
|
56
|
+
|
|
57
|
+
### ITextareaOptions
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
type SmartTextareaVariant =
|
|
61
|
+
| 'simple'
|
|
62
|
+
| 'with-avatar-actions'
|
|
63
|
+
| 'with-underline'
|
|
64
|
+
| 'with-pill-actions'
|
|
65
|
+
| 'with-preview';
|
|
66
|
+
|
|
67
|
+
interface ITextareaOptions {
|
|
68
|
+
rows?: number;
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
variant?: SmartTextareaVariant;
|
|
71
|
+
label?: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
autoFocus?: boolean;
|
|
75
|
+
ariaLabel?: string;
|
|
76
|
+
actions?: ITextareaAction[];
|
|
77
|
+
avatarTpl?: TemplateRef<unknown>;
|
|
78
|
+
toolbarTpl?: TemplateRef<unknown>;
|
|
79
|
+
previewTpl?: TemplateRef<unknown>;
|
|
80
|
+
footerTpl?: TemplateRef<unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ITextareaAction {
|
|
84
|
+
id: string;
|
|
85
|
+
label?: string;
|
|
86
|
+
iconTpl?: TemplateRef<unknown>;
|
|
87
|
+
variant?: 'primary' | 'secondary' | 'ghost';
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## TEXTAREA_STANDARD_COMPONENT_TOKEN
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { TEXTAREA_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
95
|
+
|
|
96
|
+
providers: [
|
|
97
|
+
{
|
|
98
|
+
provide: TEXTAREA_STANDARD_COMPONENT_TOKEN,
|
|
99
|
+
useValue: MyCustomTextareaComponent,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Extending the Base Class
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import {
|
|
108
|
+
ChangeDetectionStrategy,
|
|
109
|
+
Component,
|
|
110
|
+
input,
|
|
111
|
+
ViewEncapsulation,
|
|
112
|
+
} from '@angular/core';
|
|
113
|
+
|
|
114
|
+
import { TextareaBaseComponent } from '@smartsoft001/angular';
|
|
115
|
+
|
|
116
|
+
@Component({
|
|
117
|
+
selector: 'my-custom-textarea',
|
|
118
|
+
template: `
|
|
119
|
+
<textarea
|
|
120
|
+
[value]="value()"
|
|
121
|
+
[disabled]="disabled()"
|
|
122
|
+
[attr.placeholder]="placeholder() || null"
|
|
123
|
+
(input)="value.set($any($event.target).value)"
|
|
124
|
+
></textarea>
|
|
125
|
+
`,
|
|
126
|
+
encapsulation: ViewEncapsulation.None,
|
|
127
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
128
|
+
})
|
|
129
|
+
export class MyCustomTextareaComponent extends TextareaBaseComponent {
|
|
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 two-way bound textarea -->
|
|
139
|
+
<smart-textarea [(value)]="comment" placeholder="Add your comment..." />
|
|
140
|
+
|
|
141
|
+
<!-- With label and rows override -->
|
|
142
|
+
<smart-textarea [(value)]="bio" [options]="{ label: 'Bio', rows: 6 }" />
|
|
143
|
+
|
|
144
|
+
<!-- Disabled state -->
|
|
145
|
+
<smart-textarea [(value)]="readonly" [disabled]="true" />
|
|
146
|
+
|
|
147
|
+
<!-- With actions and maxLength -->
|
|
148
|
+
<smart-textarea
|
|
149
|
+
[(value)]="message"
|
|
150
|
+
[options]="{
|
|
151
|
+
rows: 4,
|
|
152
|
+
maxLength: 280,
|
|
153
|
+
actions: [
|
|
154
|
+
{ id: 'cancel', label: 'Cancel', variant: 'ghost' },
|
|
155
|
+
{ id: 'submit', label: 'Send', variant: 'primary' },
|
|
156
|
+
],
|
|
157
|
+
}"
|
|
158
|
+
(actionClick)="onAction($event)"
|
|
159
|
+
/>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## File Locations
|
|
163
|
+
|
|
164
|
+
- Wrapper: `packages/shared/angular/src/lib/components/textarea/textarea.component.ts`
|
|
165
|
+
- Standard: `packages/shared/angular/src/lib/components/textarea/standard/standard.component.ts`
|
|
166
|
+
- Base class: `packages/shared/angular/src/lib/components/textarea/base/base.component.ts`
|
|
167
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TEXTAREA_STANDARD_COMPONENT_TOKEN`)
|
|
168
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ITextareaOptions`, `ITextareaAction`, `SmartTextareaVariant`)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-toggle
|
|
3
|
+
description: Toggle component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Toggle Component
|
|
8
|
+
|
|
9
|
+
The `<smart-toggle>` component provides a boolean on/off control. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `ToggleBaseComponent` defines the shared API — `value` (two-way `ModelSignal<boolean>`), `disabled`, optional `IToggleOptions`, `cssClass` (alias `class`), and a `toggle()` method that flips the value while respecting the disabled state. `ToggleStandardComponent` is a barebones placeholder concrete implementation. `ToggleComponent` is the public wrapper that renders `ToggleStandardComponent` by default and accepts a custom replacement via `TOGGLE_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the toggle component
|
|
14
|
+
- Developer asks about `<smart-toggle>`, `ToggleComponent`, `ToggleStandardComponent`, or `ToggleBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### ToggleComponent (`<smart-toggle>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `ToggleStandardComponent` by default. When `TOGGLE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### ToggleStandardComponent (`<smart-toggle-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a minimal `<input type="checkbox">` bound to `value` and `disabled`, with an optional `aria-label` from `options.ariaLabel`, and the external `cssClass` applied to the input element. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### ToggleBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom toggle implementations. Exposes `value` as a two-way `ModelSignal<boolean>` (default `false`), `disabled` as an `InputSignal<boolean>` (default `false`), `options` as an `InputSignal<IToggleOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), and a `toggle()` method that calls `value.set(!value())` when `disabled()` is `false`.
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ---------- | ------------------------------------------ | ------- | ---------------------------------------------------------------- |
|
|
36
|
+
| `value` | `ModelSignal<boolean>` | `false` | Toggle on/off state (two-way bindable) |
|
|
37
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Whether the toggle is disabled |
|
|
38
|
+
| `options` | `InputSignal<IToggleOptions \| undefined>` | - | Optional configuration (label, description, ariaLabel, position) |
|
|
39
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
40
|
+
|
|
41
|
+
### IToggleOptions
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
interface IToggleOptions {
|
|
45
|
+
label?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
labelPosition?: 'left' | 'right';
|
|
48
|
+
ariaLabel?: string;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The standard component only consumes `ariaLabel` (placeholder behavior — it is applied directly as the `aria-label` attribute on the checkbox input). The remaining properties — `label`, `description`, and `labelPosition` — are reserved for custom implementations registered through `TOGGLE_STANDARD_COMPONENT_TOKEN` and are ignored by `ToggleStandardComponent`.
|
|
53
|
+
|
|
54
|
+
## TOGGLE_STANDARD_COMPONENT_TOKEN
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { TOGGLE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
InjectionToken that allows replacing the default `ToggleStandardComponent` with a custom implementation. Provide a `Type<ToggleBaseComponent>` to override.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// In your app module or component providers:
|
|
64
|
+
providers: [
|
|
65
|
+
{
|
|
66
|
+
provide: TOGGLE_STANDARD_COMPONENT_TOKEN,
|
|
67
|
+
useValue: MyCustomToggleComponent,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Extending the Base Class
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import {
|
|
76
|
+
ChangeDetectionStrategy,
|
|
77
|
+
Component,
|
|
78
|
+
computed,
|
|
79
|
+
input,
|
|
80
|
+
ViewEncapsulation,
|
|
81
|
+
} from '@angular/core';
|
|
82
|
+
|
|
83
|
+
import { ToggleBaseComponent } from '@smartsoft001/angular';
|
|
84
|
+
|
|
85
|
+
@Component({
|
|
86
|
+
selector: 'my-custom-toggle',
|
|
87
|
+
template: `
|
|
88
|
+
<label [class]="containerClasses()">
|
|
89
|
+
@if (options()?.labelPosition === 'left' && options()?.label) {
|
|
90
|
+
<span>{{ options()?.label }}</span>
|
|
91
|
+
}
|
|
92
|
+
<input
|
|
93
|
+
type="checkbox"
|
|
94
|
+
[checked]="value()"
|
|
95
|
+
[disabled]="disabled()"
|
|
96
|
+
[attr.aria-label]="options()?.ariaLabel"
|
|
97
|
+
(change)="onChange($event)"
|
|
98
|
+
/>
|
|
99
|
+
@if (options()?.labelPosition !== 'left' && options()?.label) {
|
|
100
|
+
<span>{{ options()?.label }}</span>
|
|
101
|
+
}
|
|
102
|
+
@if (options()?.description) {
|
|
103
|
+
<span class="my-toggle-description">{{ options()?.description }}</span>
|
|
104
|
+
}
|
|
105
|
+
</label>
|
|
106
|
+
`,
|
|
107
|
+
encapsulation: ViewEncapsulation.None,
|
|
108
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
109
|
+
})
|
|
110
|
+
export class MyCustomToggleComponent extends ToggleBaseComponent {
|
|
111
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
112
|
+
override cssClass = input<string>('');
|
|
113
|
+
|
|
114
|
+
containerClasses = computed(() => {
|
|
115
|
+
const classes = ['my-toggle-container'];
|
|
116
|
+
const extra = this.cssClass();
|
|
117
|
+
if (extra) classes.push(extra);
|
|
118
|
+
return classes.join(' ');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
onChange(event: Event): void {
|
|
122
|
+
const checked = (event.target as HTMLInputElement).checked;
|
|
123
|
+
this.value.set(checked);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
When extending the base directly, remember to:
|
|
129
|
+
|
|
130
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `TOGGLE_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
131
|
+
- use `this.toggle()` for click-based handlers (it already respects `disabled`), or call `this.value.set(checked)` directly in a `change` event handler.
|
|
132
|
+
|
|
133
|
+
## Usage Examples
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<!-- Basic -->
|
|
137
|
+
<smart-toggle [(value)]="enabled" />
|
|
138
|
+
|
|
139
|
+
<!-- With options -->
|
|
140
|
+
<smart-toggle [(value)]="enabled" [options]="{ ariaLabel: 'Use setting' }" />
|
|
141
|
+
|
|
142
|
+
<!-- Disabled -->
|
|
143
|
+
<smart-toggle [(value)]="enabled" [disabled]="true" />
|
|
144
|
+
|
|
145
|
+
<!-- With external class -->
|
|
146
|
+
<smart-toggle [(value)]="enabled" class="smart:my-2" />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## File Locations
|
|
150
|
+
|
|
151
|
+
- Wrapper: `packages/shared/angular/src/lib/components/toggle/toggle.component.ts`
|
|
152
|
+
- Standard: `packages/shared/angular/src/lib/components/toggle/standard/standard.component.ts`
|
|
153
|
+
- Base class: `packages/shared/angular/src/lib/components/toggle/base/base.component.ts`
|
|
154
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TOGGLE_STANDARD_COMPONENT_TOKEN`)
|
|
155
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IToggleOptions`)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-vertical-navigation
|
|
3
|
+
description: Vertical navigation component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Vertical Navigation Component
|
|
8
|
+
|
|
9
|
+
The `<smart-vertical-navigation>` component renders a sidebar navigation with one or more groups of items. Each item can have an icon (template), an optional badge, an optional initial (used for project-style sidebars), and an `href` (rendered as `<a>`) or no href (rendered as `<button>` emitting `itemClick`). It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `VerticalNavigationBaseComponent` defines the shared API — `options` (`IVerticalNavOptions`), `cssClass` (alias `class`), and the `itemClick` output. `VerticalNavigationStandardComponent` is a barebones placeholder using native `<nav>`, `<ul>`, `<li>`, `<a>` and `<button>` elements. `VerticalNavigationComponent` is the public wrapper that renders `VerticalNavigationStandardComponent` by default and accepts a custom replacement via `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the vertical navigation (sidebar) component
|
|
14
|
+
- Developer asks about `<smart-vertical-navigation>`, `VerticalNavigationComponent`, `VerticalNavigationStandardComponent`, or `VerticalNavigationBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### VerticalNavigationComponent (`<smart-vertical-navigation>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `VerticalNavigationStandardComponent` by default. When `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `itemClick`.
|
|
21
|
+
|
|
22
|
+
### VerticalNavigationStandardComponent (`<smart-vertical-navigation-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul>` of groups. Each group renders an optional `<div class="group-title">` and a `<ul>` of items; each item renders as `<a class="item-link">` (when `href` provided) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get `current` class and `aria-current="page"` when `item.current === true`. Supports `iconTpl`, `initial` (e.g. project letter), `label`, and `badge`.
|
|
25
|
+
|
|
26
|
+
### VerticalNavigationBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `options: InputSignal<IVerticalNavOptions | undefined>`
|
|
31
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
32
|
+
- `itemClick: OutputEmitterRef<IVerticalNavItemClick>`
|
|
33
|
+
- protected `resolvedGroups: Signal<IVerticalNavGroup[]>` — normalizes `options.items` into a single-group structure alongside `options.groups`
|
|
34
|
+
|
|
35
|
+
`IVerticalNavItemClick = { itemId: string }`.
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Inputs
|
|
40
|
+
|
|
41
|
+
| Input | Type | Default | Description |
|
|
42
|
+
| --------- | ----------------------------------------------- | ------- | ------------------------------------------- |
|
|
43
|
+
| `options` | `InputSignal<IVerticalNavOptions \| undefined>` | - | Vertical navigation configuration |
|
|
44
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
45
|
+
|
|
46
|
+
### Outputs
|
|
47
|
+
|
|
48
|
+
| Output | Type | Description |
|
|
49
|
+
| ----------- | ----------------------------------------- | ---------------------------------------------- |
|
|
50
|
+
| `itemClick` | `OutputEmitterRef<IVerticalNavItemClick>` | Emitted when a button-type nav item is clicked |
|
|
51
|
+
|
|
52
|
+
### IVerticalNavOptions
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
type SmartVerticalNavLayout =
|
|
56
|
+
| 'simple'
|
|
57
|
+
| 'with-badges'
|
|
58
|
+
| 'with-icons'
|
|
59
|
+
| 'with-icons-and-badges'
|
|
60
|
+
| 'with-secondary-navigation'
|
|
61
|
+
| 'on-gray';
|
|
62
|
+
|
|
63
|
+
interface IVerticalNavOptions {
|
|
64
|
+
layout?: SmartVerticalNavLayout;
|
|
65
|
+
ariaLabel?: string;
|
|
66
|
+
items?: IVerticalNavItem[];
|
|
67
|
+
groups?: IVerticalNavGroup[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface IVerticalNavGroup {
|
|
71
|
+
id?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
items: IVerticalNavItem[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface IVerticalNavItem {
|
|
77
|
+
id: string;
|
|
78
|
+
label?: string;
|
|
79
|
+
href?: string;
|
|
80
|
+
current?: boolean;
|
|
81
|
+
badge?: string | number;
|
|
82
|
+
iconTpl?: TemplateRef<unknown>;
|
|
83
|
+
initial?: string;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
When both `items` and `groups` are provided, `items` is rendered first as a leading single-group section.
|
|
88
|
+
|
|
89
|
+
## VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
93
|
+
|
|
94
|
+
providers: [
|
|
95
|
+
{
|
|
96
|
+
provide: VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN,
|
|
97
|
+
useValue: MyCustomVerticalNavigationComponent,
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Extending the Base Class
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import {
|
|
106
|
+
ChangeDetectionStrategy,
|
|
107
|
+
Component,
|
|
108
|
+
input,
|
|
109
|
+
ViewEncapsulation,
|
|
110
|
+
} from '@angular/core';
|
|
111
|
+
|
|
112
|
+
import { VerticalNavigationBaseComponent } from '@smartsoft001/angular';
|
|
113
|
+
|
|
114
|
+
@Component({
|
|
115
|
+
selector: 'my-custom-vertical-navigation',
|
|
116
|
+
template: `…`,
|
|
117
|
+
encapsulation: ViewEncapsulation.None,
|
|
118
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
119
|
+
})
|
|
120
|
+
export class MyCustomVerticalNavigationComponent extends VerticalNavigationBaseComponent {
|
|
121
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
122
|
+
override cssClass = input<string>('');
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Usage Examples
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<!-- Flat list -->
|
|
130
|
+
<smart-vertical-navigation
|
|
131
|
+
[options]="{
|
|
132
|
+
items: [
|
|
133
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/', current: true },
|
|
134
|
+
{ id: 'team', label: 'Team', href: '/team' },
|
|
135
|
+
{ id: 'projects', label: 'Projects', href: '/projects', badge: 12 },
|
|
136
|
+
],
|
|
137
|
+
}"
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<!-- With secondary section (groups) -->
|
|
141
|
+
<smart-vertical-navigation
|
|
142
|
+
[options]="{
|
|
143
|
+
items: mainItems,
|
|
144
|
+
groups: [
|
|
145
|
+
{ title: 'Projects', items: projectItems },
|
|
146
|
+
],
|
|
147
|
+
}"
|
|
148
|
+
(itemClick)="onItem($event)"
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## File Locations
|
|
153
|
+
|
|
154
|
+
- Wrapper: `packages/shared/angular/src/lib/components/vertical-navigation/vertical-navigation.component.ts`
|
|
155
|
+
- Standard: `packages/shared/angular/src/lib/components/vertical-navigation/standard/standard.component.ts`
|
|
156
|
+
- Base class: `packages/shared/angular/src/lib/components/vertical-navigation/base/base.component.ts`
|
|
157
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN`)
|
|
158
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IVerticalNavOptions`, `IVerticalNavGroup`, `IVerticalNavItem`, `SmartVerticalNavLayout`)
|