@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,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-section-heading
|
|
3
|
+
description: Section heading component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Section Heading Component
|
|
8
|
+
|
|
9
|
+
The `<smart-section-heading>` component provides a heading region for sections within a page (positioned between `<smart-page-heading>` and `<smart-card-heading>` in size and scope), with optional slots for label, description, actions, tabs, an input group (search), and a badge. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `SectionHeadingBaseComponent` defines the shared API — optional `ISectionHeadingOptions` and `cssClass` (alias `class`). `SectionHeadingStandardComponent` is a barebones placeholder concrete implementation. `SectionHeadingComponent` is the public wrapper that renders `SectionHeadingStandardComponent` by default and accepts a custom replacement via `SECTION_HEADING_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the section heading component
|
|
14
|
+
- Developer asks about `<smart-section-heading>`, `SectionHeadingComponent`, `SectionHeadingStandardComponent`, or `SectionHeadingBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### SectionHeadingComponent (`<smart-section-heading>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `SectionHeadingStandardComponent` by default. When `SECTION_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### SectionHeadingStandardComponent (`<smart-section-heading-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` with a header row containing `<h3>` (title) with optional inline `<span class="label">`, a description paragraph, and the `badge`/`inputGroup`/`actions` slot on the right. A separate `tabs` row sits beneath the header. Each section is rendered only when its corresponding template/string is provided. The external `cssClass` is applied to the wrapper. 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
|
+
### SectionHeadingBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom section-heading implementations. Exposes `options` as an `InputSignal<ISectionHeadingOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | -------------------------------------------------- | ------- | ----------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<ISectionHeadingOptions \| undefined>` | - | Optional configuration (title, description, slot templates) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### ISectionHeadingOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface ISectionHeadingOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
actionsTpl?: TemplateRef<unknown>;
|
|
47
|
+
tabsTpl?: TemplateRef<unknown>;
|
|
48
|
+
inputGroupTpl?: TemplateRef<unknown>;
|
|
49
|
+
badgeTpl?: TemplateRef<unknown>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
All properties are optional. The default `SectionHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
54
|
+
|
|
55
|
+
## SECTION_HEADING_STANDARD_COMPONENT_TOKEN
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { SECTION_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
InjectionToken that allows replacing the default `SectionHeadingStandardComponent` with a custom implementation. Provide a `Type<SectionHeadingBaseComponent>` to override.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
providers: [
|
|
65
|
+
{
|
|
66
|
+
provide: SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
67
|
+
useValue: MyCustomSectionHeadingComponent,
|
|
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
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
83
|
+
|
|
84
|
+
import { SectionHeadingBaseComponent } from '@smartsoft001/angular';
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
selector: 'my-custom-section-heading',
|
|
88
|
+
template: `
|
|
89
|
+
<div [class]="containerClasses()">
|
|
90
|
+
<div class="header">
|
|
91
|
+
@if (options()?.title) {
|
|
92
|
+
<h3>{{ options()!.title }}</h3>
|
|
93
|
+
}
|
|
94
|
+
@if (options()?.actionsTpl) {
|
|
95
|
+
<div class="actions">
|
|
96
|
+
<ng-container [ngTemplateOutlet]="options()!.actionsTpl!" />
|
|
97
|
+
</div>
|
|
98
|
+
}
|
|
99
|
+
</div>
|
|
100
|
+
@if (options()?.tabsTpl) {
|
|
101
|
+
<div class="tabs">
|
|
102
|
+
<ng-container [ngTemplateOutlet]="options()!.tabsTpl!" />
|
|
103
|
+
</div>
|
|
104
|
+
}
|
|
105
|
+
</div>
|
|
106
|
+
`,
|
|
107
|
+
imports: [NgTemplateOutlet],
|
|
108
|
+
encapsulation: ViewEncapsulation.None,
|
|
109
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
110
|
+
})
|
|
111
|
+
export class MyCustomSectionHeadingComponent extends SectionHeadingBaseComponent {
|
|
112
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
113
|
+
override cssClass = input<string>('');
|
|
114
|
+
|
|
115
|
+
containerClasses = computed(() => {
|
|
116
|
+
const classes = ['my-section-heading'];
|
|
117
|
+
const extra = this.cssClass();
|
|
118
|
+
if (extra) classes.push(extra);
|
|
119
|
+
return classes.join(' ');
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Usage Examples
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<!-- Title only -->
|
|
128
|
+
<smart-section-heading [options]="{ title: 'Applicants' }" />
|
|
129
|
+
|
|
130
|
+
<!-- Title with label -->
|
|
131
|
+
<smart-section-heading
|
|
132
|
+
[options]="{ title: 'Applicants', label: 'in Engineering' }"
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<!-- Title and description -->
|
|
136
|
+
<smart-section-heading
|
|
137
|
+
[options]="{
|
|
138
|
+
title: 'Applicants',
|
|
139
|
+
description: 'Users currently active',
|
|
140
|
+
}"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<!-- With actions -->
|
|
144
|
+
<ng-template #actions>
|
|
145
|
+
<button>Add</button>
|
|
146
|
+
</ng-template>
|
|
147
|
+
|
|
148
|
+
<smart-section-heading
|
|
149
|
+
[options]="{ title: 'Applicants', actionsTpl: actions }"
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<!-- With tabs and search -->
|
|
153
|
+
<ng-template #tabs>
|
|
154
|
+
<a>All</a>
|
|
155
|
+
<a>Active</a>
|
|
156
|
+
</ng-template>
|
|
157
|
+
|
|
158
|
+
<ng-template #search>
|
|
159
|
+
<smart-searchbar />
|
|
160
|
+
</ng-template>
|
|
161
|
+
|
|
162
|
+
<smart-section-heading
|
|
163
|
+
[options]="{
|
|
164
|
+
title: 'Applicants',
|
|
165
|
+
tabsTpl: tabs,
|
|
166
|
+
inputGroupTpl: search,
|
|
167
|
+
}"
|
|
168
|
+
/>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## File Locations
|
|
172
|
+
|
|
173
|
+
- Wrapper: `packages/shared/angular/src/lib/components/section-heading/section-heading.component.ts`
|
|
174
|
+
- Standard: `packages/shared/angular/src/lib/components/section-heading/standard/standard.component.ts`
|
|
175
|
+
- Base class: `packages/shared/angular/src/lib/components/section-heading/base/base.component.ts`
|
|
176
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`SECTION_HEADING_STANDARD_COMPONENT_TOKEN`)
|
|
177
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ISectionHeadingOptions`)
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-select-menu
|
|
3
|
+
description: Select menu component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Select Menu Component
|
|
8
|
+
|
|
9
|
+
The `<smart-select-menu>` component renders a single-select menu with a placeholder, list of items (label/value, optional avatar/secondary text/status/disabled), an optional empty state slot, and a two-way `value` binding. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `SelectMenuBaseComponent` defines the shared API — `value` (two-way `ModelSignal<SelectMenuValue>`), `disabled`, optional `ISelectMenuOptions`, `cssClass` (alias `class`), and a `select(next)` method that updates `value` while respecting the disabled state. `SelectMenuStandardComponent` is a barebones placeholder concrete implementation using a native `<select>` element. `SelectMenuComponent` is the public wrapper that renders `SelectMenuStandardComponent` by default and accepts a custom replacement via `SELECT_MENU_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the select menu component
|
|
14
|
+
- Developer asks about `<smart-select-menu>`, `SelectMenuComponent`, `SelectMenuStandardComponent`, or `SelectMenuBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### SelectMenuComponent (`<smart-select-menu>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `SelectMenuStandardComponent` by default. When `SELECT_MENU_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### SelectMenuStandardComponent (`<smart-select-menu-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation using a native `<select>`. Renders an outer wrapper `<div>`, a `<div class="select-menu">`, and a `<select>` with one `<option>` per item; an optional placeholder is rendered as a disabled first option. Disabled items get the `disabled` attribute on their `<option>`. The `<select>` is disabled when `disabled()` is `true`. On `change`, the standard reads the raw string value, looks up the matching item by `String(value) === String(item.value)` (preserving numeric types), and calls `select()`. When `items` is empty and `emptyTpl` is provided, the empty template is rendered inside `<div class="empty">`. The external `cssClass` is applied to the root wrapper. It does not include any Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### SelectMenuBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom select menu implementations. Exposes:
|
|
29
|
+
|
|
30
|
+
- `value: ModelSignal<SelectMenuValue>` (default `null`) — two-way bindable
|
|
31
|
+
- `disabled: InputSignal<boolean>` (default `false`)
|
|
32
|
+
- `options: InputSignal<ISelectMenuOptions | undefined>`
|
|
33
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
34
|
+
- `select(next: SelectMenuValue): void` — updates `value` only when not disabled
|
|
35
|
+
|
|
36
|
+
`SelectMenuValue` is `string | number | null`.
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### Inputs
|
|
41
|
+
|
|
42
|
+
| Input | Type | Default | Description |
|
|
43
|
+
| ---------- | ---------------------------------------------- | ------- | ----------------------------------------------------------- |
|
|
44
|
+
| `value` | `ModelSignal<SelectMenuValue>` | `null` | Currently selected value (two-way bindable) |
|
|
45
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Whether the menu is disabled |
|
|
46
|
+
| `options` | `InputSignal<ISelectMenuOptions \| undefined>` | - | Optional configuration (items, placeholder, variant, slots) |
|
|
47
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
48
|
+
|
|
49
|
+
### ISelectMenuOptions
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
type SmartSelectMenuVariant =
|
|
53
|
+
| 'native'
|
|
54
|
+
| 'custom'
|
|
55
|
+
| 'with-check'
|
|
56
|
+
| 'with-status'
|
|
57
|
+
| 'with-avatar'
|
|
58
|
+
| 'with-secondary'
|
|
59
|
+
| 'branded';
|
|
60
|
+
|
|
61
|
+
interface ISelectMenuOptions {
|
|
62
|
+
items?: ISelectMenuItem[];
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
variant?: SmartSelectMenuVariant;
|
|
65
|
+
emptyTpl?: TemplateRef<unknown>;
|
|
66
|
+
ariaLabel?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface ISelectMenuItem {
|
|
70
|
+
value: string | number;
|
|
71
|
+
label: string;
|
|
72
|
+
avatarUrl?: string;
|
|
73
|
+
iconTpl?: TemplateRef<unknown>;
|
|
74
|
+
secondary?: string;
|
|
75
|
+
status?: 'online' | 'offline' | 'busy' | string;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
ariaLabel?: string;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The default `SelectMenuStandardComponent` renders `value`, `disabled`, `placeholder`, `items` and `emptyTpl`. `variant`, `avatarUrl`, `iconTpl`, `secondary`, and `status` are hints/data for custom implementations registered via the token.
|
|
82
|
+
|
|
83
|
+
## SELECT_MENU_STANDARD_COMPONENT_TOKEN
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { SELECT_MENU_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
InjectionToken that allows replacing the default `SelectMenuStandardComponent` with a custom implementation. Provide a `Type<SelectMenuBaseComponent>` to override.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
providers: [
|
|
93
|
+
{
|
|
94
|
+
provide: SELECT_MENU_STANDARD_COMPONENT_TOKEN,
|
|
95
|
+
useValue: MyCustomSelectMenuComponent,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Extending the Base Class
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import {
|
|
104
|
+
ChangeDetectionStrategy,
|
|
105
|
+
Component,
|
|
106
|
+
computed,
|
|
107
|
+
input,
|
|
108
|
+
ViewEncapsulation,
|
|
109
|
+
} from '@angular/core';
|
|
110
|
+
|
|
111
|
+
import { SelectMenuBaseComponent } from '@smartsoft001/angular';
|
|
112
|
+
|
|
113
|
+
@Component({
|
|
114
|
+
selector: 'my-custom-select-menu',
|
|
115
|
+
template: `
|
|
116
|
+
<button (click)="open.set(!open())" [disabled]="disabled()">
|
|
117
|
+
{{ currentLabel() ?? options()?.placeholder ?? 'Select' }}
|
|
118
|
+
</button>
|
|
119
|
+
@if (open()) {
|
|
120
|
+
<ul role="listbox">
|
|
121
|
+
@for (item of options()?.items ?? []; track item.value) {
|
|
122
|
+
<li
|
|
123
|
+
role="option"
|
|
124
|
+
[attr.aria-selected]="value() === item.value"
|
|
125
|
+
(click)="!item.disabled && pick(item.value)"
|
|
126
|
+
>
|
|
127
|
+
{{ item.label }}
|
|
128
|
+
</li>
|
|
129
|
+
}
|
|
130
|
+
</ul>
|
|
131
|
+
}
|
|
132
|
+
`,
|
|
133
|
+
encapsulation: ViewEncapsulation.None,
|
|
134
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
135
|
+
})
|
|
136
|
+
export class MyCustomSelectMenuComponent extends SelectMenuBaseComponent {
|
|
137
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
138
|
+
override cssClass = input<string>('');
|
|
139
|
+
|
|
140
|
+
open = signal(false);
|
|
141
|
+
|
|
142
|
+
currentLabel = computed(() => {
|
|
143
|
+
const v = this.value();
|
|
144
|
+
return this.options()?.items?.find((i) => i.value === v)?.label;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
pick(v: string | number): void {
|
|
148
|
+
this.select(v);
|
|
149
|
+
this.open.set(false);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Usage Examples
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<!-- Simple native select with placeholder -->
|
|
158
|
+
<smart-select-menu
|
|
159
|
+
[(value)]="selected"
|
|
160
|
+
[options]="{
|
|
161
|
+
placeholder: 'Choose a country',
|
|
162
|
+
items: [
|
|
163
|
+
{ value: 'pl', label: 'Poland' },
|
|
164
|
+
{ value: 'us', label: 'United States' },
|
|
165
|
+
{ value: 'de', label: 'Germany' },
|
|
166
|
+
],
|
|
167
|
+
}"
|
|
168
|
+
/>
|
|
169
|
+
|
|
170
|
+
<!-- Disabled with current selection -->
|
|
171
|
+
<smart-select-menu
|
|
172
|
+
[(value)]="role"
|
|
173
|
+
[disabled]="true"
|
|
174
|
+
[options]="{
|
|
175
|
+
items: [
|
|
176
|
+
{ value: 'admin', label: 'Admin' },
|
|
177
|
+
{ value: 'user', label: 'User' },
|
|
178
|
+
],
|
|
179
|
+
}"
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
<!-- With per-item disabled -->
|
|
183
|
+
<smart-select-menu
|
|
184
|
+
[(value)]="picked"
|
|
185
|
+
[options]="{
|
|
186
|
+
items: [
|
|
187
|
+
{ value: 'a', label: 'A' },
|
|
188
|
+
{ value: 'b', label: 'B', disabled: true },
|
|
189
|
+
{ value: 'c', label: 'C' },
|
|
190
|
+
],
|
|
191
|
+
}"
|
|
192
|
+
/>
|
|
193
|
+
|
|
194
|
+
<!-- With external class and aria-label -->
|
|
195
|
+
<smart-select-menu
|
|
196
|
+
[(value)]="picked"
|
|
197
|
+
class="smart:w-64"
|
|
198
|
+
[options]="{
|
|
199
|
+
ariaLabel: 'Choose a country',
|
|
200
|
+
items: [{ value: 'pl', label: 'Poland' }],
|
|
201
|
+
}"
|
|
202
|
+
/>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## File Locations
|
|
206
|
+
|
|
207
|
+
- Wrapper: `packages/shared/angular/src/lib/components/select-menu/select-menu.component.ts`
|
|
208
|
+
- Standard: `packages/shared/angular/src/lib/components/select-menu/standard/standard.component.ts`
|
|
209
|
+
- Base class: `packages/shared/angular/src/lib/components/select-menu/base/base.component.ts`
|
|
210
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`SELECT_MENU_STANDARD_COMPONENT_TOKEN`)
|
|
211
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ISelectMenuOptions`, `ISelectMenuItem`, `SmartSelectMenuVariant`)
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-sidebar-layout
|
|
3
|
+
description: Sidebar layout component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sidebar Layout Component
|
|
8
|
+
|
|
9
|
+
The `<smart-sidebar-layout>` component provides a two-column application shell with a sidebar (left or right) and a main content region, with an optional top header. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `SidebarLayoutBaseComponent` defines the shared API — optional `ISidebarLayoutOptions` and `cssClass` (alias `class`). `SidebarLayoutStandardComponent` is a barebones placeholder concrete implementation. `SidebarLayoutComponent` is the public wrapper that renders `SidebarLayoutStandardComponent` by default and accepts a custom replacement via `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the sidebar layout component
|
|
14
|
+
- Developer asks about `<smart-sidebar-layout>`, `SidebarLayoutComponent`, `SidebarLayoutStandardComponent`, or `SidebarLayoutBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### SidebarLayoutComponent (`<smart-sidebar-layout>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `SidebarLayoutStandardComponent` by default. When `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Accepts main content via projected `<ng-content>`.
|
|
21
|
+
|
|
22
|
+
### SidebarLayoutStandardComponent (`<smart-sidebar-layout-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<header>` (when `options.headerTpl` is provided), an `<aside>` for the sidebar, and a `<main>` element that projects `<ng-content>`. The order of `<aside>` and `<main>` swaps based on `options.sidebarPosition` (`'left'` default or `'right'`). The external `cssClass` is applied to the wrapper. 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
|
+
### SidebarLayoutBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom sidebar-layout implementations. Exposes `options` as an `InputSignal<ISidebarLayoutOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | ------------------------------------------------- | ------- | ----------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<ISidebarLayoutOptions \| undefined>` | - | Optional configuration (sidebar template, position, header) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### ISidebarLayoutOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
type SmartSidebarLayoutMobileBreakpoint = 'sm' | 'md' | 'lg';
|
|
43
|
+
|
|
44
|
+
interface ISidebarLayoutOptions {
|
|
45
|
+
title?: string;
|
|
46
|
+
sidebarTpl?: TemplateRef<unknown>;
|
|
47
|
+
headerTpl?: TemplateRef<unknown>;
|
|
48
|
+
sidebarPosition?: 'left' | 'right';
|
|
49
|
+
mobileBreakpoint?: SmartSidebarLayoutMobileBreakpoint;
|
|
50
|
+
condensed?: boolean;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The default `SidebarLayoutStandardComponent` consumes `sidebarTpl`, `headerTpl`, and `sidebarPosition`. `title`, `mobileBreakpoint`, and `condensed` are reserved for custom implementations registered via `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN` and are ignored by `SidebarLayoutStandardComponent`.
|
|
55
|
+
|
|
56
|
+
## SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
InjectionToken that allows replacing the default `SidebarLayoutStandardComponent` with a custom implementation. Provide a `Type<SidebarLayoutBaseComponent>` to override.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// In your app module or component providers:
|
|
66
|
+
providers: [
|
|
67
|
+
{
|
|
68
|
+
provide: SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
69
|
+
useValue: MyCustomSidebarLayoutComponent,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Extending the Base Class
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import {
|
|
78
|
+
ChangeDetectionStrategy,
|
|
79
|
+
Component,
|
|
80
|
+
computed,
|
|
81
|
+
input,
|
|
82
|
+
ViewEncapsulation,
|
|
83
|
+
} from '@angular/core';
|
|
84
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
85
|
+
|
|
86
|
+
import { SidebarLayoutBaseComponent } from '@smartsoft001/angular';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'my-custom-sidebar-layout',
|
|
90
|
+
template: `
|
|
91
|
+
<div [class]="containerClasses()">
|
|
92
|
+
@if (options()?.headerTpl) {
|
|
93
|
+
<header>
|
|
94
|
+
<ng-container [ngTemplateOutlet]="options()!.headerTpl!" />
|
|
95
|
+
</header>
|
|
96
|
+
}
|
|
97
|
+
<aside>
|
|
98
|
+
@if (options()?.sidebarTpl) {
|
|
99
|
+
<ng-container [ngTemplateOutlet]="options()!.sidebarTpl!" />
|
|
100
|
+
}
|
|
101
|
+
</aside>
|
|
102
|
+
<main>
|
|
103
|
+
<ng-content />
|
|
104
|
+
</main>
|
|
105
|
+
</div>
|
|
106
|
+
`,
|
|
107
|
+
imports: [NgTemplateOutlet],
|
|
108
|
+
encapsulation: ViewEncapsulation.None,
|
|
109
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
110
|
+
})
|
|
111
|
+
export class MyCustomSidebarLayoutComponent extends SidebarLayoutBaseComponent {
|
|
112
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
113
|
+
override cssClass = input<string>('');
|
|
114
|
+
|
|
115
|
+
containerClasses = computed(() => {
|
|
116
|
+
const classes = ['my-sidebar-layout'];
|
|
117
|
+
const extra = this.cssClass();
|
|
118
|
+
if (extra) classes.push(extra);
|
|
119
|
+
return classes.join(' ');
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
When extending the base directly, remember to:
|
|
125
|
+
|
|
126
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN`,
|
|
127
|
+
- accept main content via `<ng-content>`,
|
|
128
|
+
- read `options().sidebarPosition` to swap aside/main DOM order if needed.
|
|
129
|
+
|
|
130
|
+
## Usage Examples
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<!-- Basic with main content -->
|
|
134
|
+
<smart-sidebar-layout>
|
|
135
|
+
<h1>Hello</h1>
|
|
136
|
+
</smart-sidebar-layout>
|
|
137
|
+
|
|
138
|
+
<!-- With sidebar template -->
|
|
139
|
+
<ng-template #sidebar>
|
|
140
|
+
<a routerLink="/">Dashboard</a>
|
|
141
|
+
<a routerLink="/team">Team</a>
|
|
142
|
+
</ng-template>
|
|
143
|
+
|
|
144
|
+
<smart-sidebar-layout [options]="{ sidebarTpl: sidebar }">
|
|
145
|
+
<p>Main content</p>
|
|
146
|
+
</smart-sidebar-layout>
|
|
147
|
+
|
|
148
|
+
<!-- Right-positioned sidebar -->
|
|
149
|
+
<smart-sidebar-layout
|
|
150
|
+
[options]="{ sidebarTpl: sidebar, sidebarPosition: 'right' }"
|
|
151
|
+
>
|
|
152
|
+
<p>Main content</p>
|
|
153
|
+
</smart-sidebar-layout>
|
|
154
|
+
|
|
155
|
+
<!-- With top header -->
|
|
156
|
+
<ng-template #header>
|
|
157
|
+
<h1>Dashboard</h1>
|
|
158
|
+
</ng-template>
|
|
159
|
+
|
|
160
|
+
<smart-sidebar-layout [options]="{ sidebarTpl: sidebar, headerTpl: header }">
|
|
161
|
+
<p>Main content</p>
|
|
162
|
+
</smart-sidebar-layout>
|
|
163
|
+
|
|
164
|
+
<!-- With external class -->
|
|
165
|
+
<smart-sidebar-layout class="smart:bg-gray-50">
|
|
166
|
+
<p>Main content</p>
|
|
167
|
+
</smart-sidebar-layout>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## File Locations
|
|
171
|
+
|
|
172
|
+
- Wrapper: `packages/shared/angular/src/lib/components/sidebar-layout/sidebar-layout.component.ts`
|
|
173
|
+
- Standard: `packages/shared/angular/src/lib/components/sidebar-layout/standard/standard.component.ts`
|
|
174
|
+
- Base class: `packages/shared/angular/src/lib/components/sidebar-layout/base/base.component.ts`
|
|
175
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN`)
|
|
176
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ISidebarLayoutOptions`)
|