@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,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-breadcrumbs
|
|
3
|
+
description: Breadcrumbs component API with InjectionToken pattern, configurable separators (chevron/slash/arrow) and four layout variants.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Breadcrumbs Component
|
|
8
|
+
|
|
9
|
+
The `<smart-breadcrumbs>` component renders a list of navigation items separated by visual delimiters (chevron, slash, or arrow shape). It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `BreadcrumbsBaseComponent` defines the shared API — `options` (`IBreadcrumbsOptions`), `cssClass` (alias `class`), and the `itemClick` output. `BreadcrumbsStandardComponent` is a barebones placeholder using native `<nav>`, `<ol>`, `<li>`, `<a>`, and `<button>` elements. `BreadcrumbsComponent` is the public wrapper that renders `BreadcrumbsStandardComponent` by default and accepts a custom replacement via `BREADCRUMBS_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the breadcrumbs component
|
|
14
|
+
- Developer asks about `<smart-breadcrumbs>`, `BreadcrumbsComponent`, `BreadcrumbsStandardComponent`, or `BreadcrumbsBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### BreadcrumbsComponent (`<smart-breadcrumbs>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `BreadcrumbsStandardComponent` by default. When `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `itemClick`.
|
|
21
|
+
|
|
22
|
+
### BreadcrumbsStandardComponent (`<smart-breadcrumbs-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using native HTML. Renders a `<nav class="breadcrumbs">` (with `aria-label` from `options.ariaLabel` or default `"Breadcrumb"`) containing an `<ol>` of items. Each item renders as `<a class="breadcrumbs-link">` (when `href` provided) or `<button class="breadcrumbs-button">` (otherwise, emitting `itemClick`). Items get `current` class and `aria-current="page"` when `item.current === true`. Supports `iconTpl` (e.g. for the home item) and `srOnlyLabel`. Items are joined by a `<span class="breadcrumbs-separator">` with a `data-separator` attribute reflecting `options.separator` (defaults to `chevron`).
|
|
25
|
+
|
|
26
|
+
### BreadcrumbsBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `options: InputSignal<IBreadcrumbsOptions | undefined>`
|
|
31
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
32
|
+
- `itemClick: OutputEmitterRef<IBreadcrumbsItemClick>`
|
|
33
|
+
|
|
34
|
+
`IBreadcrumbsItemClick = { itemId: string }`.
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
### Inputs
|
|
39
|
+
|
|
40
|
+
| Input | Type | Default | Description |
|
|
41
|
+
| --------- | ----------------------------------------------- | ------- | ------------------------------------------- |
|
|
42
|
+
| `options` | `InputSignal<IBreadcrumbsOptions \| undefined>` | - | Breadcrumbs configuration |
|
|
43
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
44
|
+
|
|
45
|
+
### Outputs
|
|
46
|
+
|
|
47
|
+
| Output | Type | Description |
|
|
48
|
+
| ----------- | ----------------------------------------- | ------------------------------------------------ |
|
|
49
|
+
| `itemClick` | `OutputEmitterRef<IBreadcrumbsItemClick>` | Emitted when a button-type breadcrumb is clicked |
|
|
50
|
+
|
|
51
|
+
### IBreadcrumbsOptions
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
type SmartBreadcrumbsLayout =
|
|
55
|
+
| 'contained'
|
|
56
|
+
| 'full-width-bar'
|
|
57
|
+
| 'simple-with-chevrons'
|
|
58
|
+
| 'simple-with-slashes';
|
|
59
|
+
|
|
60
|
+
type SmartBreadcrumbsSeparator = 'chevron' | 'slash' | 'arrow';
|
|
61
|
+
|
|
62
|
+
interface IBreadcrumbsOptions {
|
|
63
|
+
layout?: SmartBreadcrumbsLayout;
|
|
64
|
+
ariaLabel?: string;
|
|
65
|
+
separator?: SmartBreadcrumbsSeparator;
|
|
66
|
+
items: IBreadcrumbItem[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface IBreadcrumbItem {
|
|
70
|
+
id: string;
|
|
71
|
+
label?: string;
|
|
72
|
+
href?: string;
|
|
73
|
+
iconTpl?: TemplateRef<unknown>;
|
|
74
|
+
srOnlyLabel?: string;
|
|
75
|
+
current?: boolean;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## BREADCRUMBS_STANDARD_COMPONENT_TOKEN
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { BREADCRUMBS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
83
|
+
|
|
84
|
+
providers: [
|
|
85
|
+
{
|
|
86
|
+
provide: BREADCRUMBS_STANDARD_COMPONENT_TOKEN,
|
|
87
|
+
useValue: MyCustomBreadcrumbsComponent,
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Extending the Base Class
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import {
|
|
96
|
+
ChangeDetectionStrategy,
|
|
97
|
+
Component,
|
|
98
|
+
input,
|
|
99
|
+
ViewEncapsulation,
|
|
100
|
+
} from '@angular/core';
|
|
101
|
+
|
|
102
|
+
import { BreadcrumbsBaseComponent } from '@smartsoft001/angular';
|
|
103
|
+
|
|
104
|
+
@Component({
|
|
105
|
+
selector: 'my-custom-breadcrumbs',
|
|
106
|
+
template: `…`,
|
|
107
|
+
encapsulation: ViewEncapsulation.None,
|
|
108
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
109
|
+
})
|
|
110
|
+
export class MyCustomBreadcrumbsComponent extends BreadcrumbsBaseComponent {
|
|
111
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
112
|
+
override cssClass = input<string>('');
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Usage Examples
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<!-- Simple chain with home icon and current page -->
|
|
120
|
+
<smart-breadcrumbs
|
|
121
|
+
[options]="{
|
|
122
|
+
items: [
|
|
123
|
+
{ id: 'home', href: '/', iconTpl: homeIcon, srOnlyLabel: 'Home' },
|
|
124
|
+
{ id: 'projects', label: 'Projects', href: '/projects' },
|
|
125
|
+
{ id: 'nero', label: 'Project Nero', href: '/projects/nero', current: true },
|
|
126
|
+
],
|
|
127
|
+
}"
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<!-- With slash separators -->
|
|
131
|
+
<smart-breadcrumbs
|
|
132
|
+
[options]="{
|
|
133
|
+
layout: 'simple-with-slashes',
|
|
134
|
+
separator: 'slash',
|
|
135
|
+
items: items,
|
|
136
|
+
}"
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<!-- Button-style item with click handler -->
|
|
140
|
+
<smart-breadcrumbs
|
|
141
|
+
[options]="{ items: [{ id: 'a', label: 'Step A' }] }"
|
|
142
|
+
(itemClick)="onClick($event)"
|
|
143
|
+
/>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## File Locations
|
|
147
|
+
|
|
148
|
+
- Wrapper: `packages/shared/angular/src/lib/components/breadcrumbs/breadcrumbs.component.ts`
|
|
149
|
+
- Standard: `packages/shared/angular/src/lib/components/breadcrumbs/standard/standard.component.ts`
|
|
150
|
+
- Base class: `packages/shared/angular/src/lib/components/breadcrumbs/base/base.component.ts`
|
|
151
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`BREADCRUMBS_STANDARD_COMPONENT_TOKEN`)
|
|
152
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IBreadcrumbsOptions`, `IBreadcrumbItem`, `SmartBreadcrumbsLayout`, `SmartBreadcrumbsSeparator`)
|
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: angular-components-button
|
|
3
|
-
description: Button component API
|
|
3
|
+
description: Button component API with InjectionToken pattern for custom implementations.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Button Component
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The `<smart-button>` component provides a flexible button wrapper with an InjectionToken-based extension mechanism. It renders a default `ButtonStandardComponent` which can be replaced via `BUTTON_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the button component
|
|
14
|
+
- Developer asks about `<smart-button>` or `ButtonComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### ButtonComponent (`<smart-button>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `ButtonStandardComponent` by default. When `BUTTON_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### ButtonStandardComponent (`<smart-button-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Simple Tailwind-styled button with size-dependent rounding and padding.
|
|
12
25
|
|
|
13
|
-
###
|
|
26
|
+
### ButtonBaseComponent (abstract)
|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
Abstract base directive for extending custom button implementations.
|
|
29
|
+
|
|
30
|
+
## API
|
|
16
31
|
|
|
17
32
|
### Inputs
|
|
18
33
|
|
|
19
|
-
| Input | Type
|
|
20
|
-
| ---------- |
|
|
21
|
-
| `options` | `IButtonOptions
|
|
22
|
-
| `disabled` | `boolean
|
|
23
|
-
| `class` | `string
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ---------- | ----------------------------- | -------- | ------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<IButtonOptions>` | required | Button configuration |
|
|
37
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Disabled state |
|
|
38
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
24
39
|
|
|
25
40
|
### IButtonOptions
|
|
26
41
|
|
|
@@ -33,57 +48,68 @@ interface IButtonOptions {
|
|
|
33
48
|
variant?: SmartVariant; // 'primary' | 'secondary' | 'soft'
|
|
34
49
|
size?: SmartSize; // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
35
50
|
color?: SmartColor; // 22 Tailwind colors, default 'indigo'
|
|
36
|
-
rounded?: boolean;
|
|
37
|
-
circular?: boolean;
|
|
51
|
+
rounded?: boolean;
|
|
52
|
+
circular?: boolean;
|
|
53
|
+
iconPosition?: 'leading' | 'trailing';
|
|
38
54
|
}
|
|
39
55
|
```
|
|
40
56
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Standard (`<smart-button-standard>`)
|
|
44
|
-
|
|
45
|
-
- Border radius based on size: `smart:rounded-sm` (xs/sm), `smart:rounded-md` (md/lg/xl)
|
|
46
|
-
- Supports confirm mode (cancel/confirm buttons)
|
|
47
|
-
|
|
48
|
-
### Rounded (`<smart-button-rounded>`)
|
|
49
|
-
|
|
50
|
-
- Always `smart:rounded-full`
|
|
51
|
-
- Supports confirm mode
|
|
57
|
+
### BUTTON_STANDARD_COMPONENT_TOKEN
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- Icon-only — pass SVG as `<ng-content>`
|
|
57
|
-
- No confirm mode
|
|
59
|
+
```typescript
|
|
60
|
+
import { BUTTON_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
61
|
+
```
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
InjectionToken that allows replacing the default `ButtonStandardComponent` with a custom implementation. Provide a `Type<ButtonBaseComponent>` to override.
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
```typescript
|
|
66
|
+
// In your app module or component providers:
|
|
67
|
+
providers: [
|
|
68
|
+
{
|
|
69
|
+
provide: BUTTON_STANDARD_COMPONENT_TOKEN,
|
|
70
|
+
useValue: MyCustomButtonComponent,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
```
|
|
64
74
|
|
|
65
|
-
##
|
|
75
|
+
## Extending the Base Class
|
|
66
76
|
|
|
67
|
-
|
|
77
|
+
```typescript
|
|
78
|
+
import { Component, computed, ViewEncapsulation } from '@angular/core';
|
|
79
|
+
import { ButtonBaseComponent } from '@smartsoft001/angular';
|
|
80
|
+
|
|
81
|
+
@Component({
|
|
82
|
+
selector: 'my-custom-button',
|
|
83
|
+
template: `
|
|
84
|
+
<button
|
|
85
|
+
[class]="buttonClasses()"
|
|
86
|
+
[disabled]="disabled()"
|
|
87
|
+
(click)="invoke()"
|
|
88
|
+
>
|
|
89
|
+
<ng-content />
|
|
90
|
+
</button>
|
|
91
|
+
`,
|
|
92
|
+
encapsulation: ViewEncapsulation.None,
|
|
93
|
+
})
|
|
94
|
+
export class MyCustomButtonComponent extends ButtonBaseComponent {
|
|
95
|
+
buttonClasses = computed(() => {
|
|
96
|
+
const classes = [...this.variantClasses(), 'my-custom-class'];
|
|
97
|
+
const extra = this.cssClass();
|
|
98
|
+
if (extra) classes.push(extra);
|
|
99
|
+
return classes.join(' ');
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
```
|
|
68
103
|
|
|
69
104
|
## Usage Examples
|
|
70
105
|
|
|
71
106
|
```html
|
|
72
|
-
<!--
|
|
73
|
-
<smart-button [options]="{ click: onClick
|
|
74
|
-
Click me
|
|
75
|
-
</smart-button>
|
|
76
|
-
|
|
77
|
-
<!-- Rounded secondary with color -->
|
|
78
|
-
<smart-button
|
|
79
|
-
[options]="{ click: onClick, variant: 'secondary', size: 'lg', rounded: true, color: 'red' }"
|
|
80
|
-
>
|
|
81
|
-
Delete
|
|
82
|
-
</smart-button>
|
|
107
|
+
<!-- Default button -->
|
|
108
|
+
<smart-button [options]="{ click: onClick }">Save</smart-button>
|
|
83
109
|
|
|
84
|
-
<!--
|
|
85
|
-
<smart-button [options]="{ click: onClick,
|
|
86
|
-
|
|
110
|
+
<!-- With variant and size -->
|
|
111
|
+
<smart-button [options]="{ click: onClick, variant: 'primary', size: 'lg' }">
|
|
112
|
+
Submit
|
|
87
113
|
</smart-button>
|
|
88
114
|
|
|
89
115
|
<!-- With loading -->
|
|
@@ -92,9 +118,7 @@ Uses `COMPONENT_COLORS` from `models/colors.ts`. All 22 Tailwind colors supporte
|
|
|
92
118
|
</smart-button>
|
|
93
119
|
|
|
94
120
|
<!-- With confirm -->
|
|
95
|
-
<smart-button
|
|
96
|
-
[options]="{ click: onDelete, confirm: true, variant: 'primary', color: 'red' }"
|
|
97
|
-
>
|
|
121
|
+
<smart-button [options]="{ click: onDelete, confirm: true, color: 'red' }">
|
|
98
122
|
Delete
|
|
99
123
|
</smart-button>
|
|
100
124
|
|
|
@@ -102,8 +126,11 @@ Uses `COMPONENT_COLORS` from `models/colors.ts`. All 22 Tailwind colors supporte
|
|
|
102
126
|
<smart-button class="smart:mt-4" [options]="opts">Submit</smart-button>
|
|
103
127
|
```
|
|
104
128
|
|
|
105
|
-
##
|
|
129
|
+
## File Locations
|
|
106
130
|
|
|
107
|
-
-
|
|
131
|
+
- Wrapper: `packages/shared/angular/src/lib/components/button/button.component.ts`
|
|
132
|
+
- Standard: `packages/shared/angular/src/lib/components/button/standard/standard.component.ts`
|
|
133
|
+
- Base class: `packages/shared/angular/src/lib/components/button/base/base.component.ts`
|
|
134
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`BUTTON_STANDARD_COMPONENT_TOKEN`)
|
|
135
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IButtonOptions`)
|
|
108
136
|
- Color map: `packages/shared/angular/src/lib/models/colors.ts` (`COMPONENT_COLORS`)
|
|
109
|
-
- Shared types: `SmartVariant`, `SmartSize`, `SmartColor` in `models/interfaces.ts`
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-calendar
|
|
3
|
+
description: Calendar component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Calendar Component
|
|
8
|
+
|
|
9
|
+
The `<smart-calendar>` component renders a date calendar with shared month-grid logic, navigation (prev/next/today), single-day selection, and per-day event awareness. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `CalendarBaseComponent` defines the shared API and contains the date logic (pure month-grid construction, period navigation, day selection, event filtering). `CalendarStandardComponent` is a barebones placeholder concrete implementation that renders a 6×7 month grid. `CalendarComponent` is the public wrapper that renders `CalendarStandardComponent` by default and accepts a custom replacement via `CALENDAR_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the calendar component
|
|
14
|
+
- Developer asks about `<smart-calendar>`, `CalendarComponent`, `CalendarStandardComponent`, or `CalendarBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### CalendarComponent (`<smart-calendar>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `CalendarStandardComponent` by default. When `CALENDAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. The wrapper exposes a two-way `value` model (`Date | null`), an optional `referenceDate` input (defaults to today), and an `events` input.
|
|
21
|
+
|
|
22
|
+
### CalendarStandardComponent (`<smart-calendar-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional toolbar (`<button.prev>`, `<button.today-btn>`, `<button.next>`, optional `toolbarActionsTpl` slot) and a `<div class="view-grid">` with one `<div class="week">` per week and one `<button class="day">` per day. Each day exposes `data-current-month`, `data-today`, and `data-selected` attributes plus an `aria-label` of the date string. If `dayCellTpl` is provided in options, it replaces the default day-number content. The external `cssClass` is applied to the root wrapper. It does not include any visual styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### CalendarBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive containing the shared calendar logic. Exposes inputs and signals for state, plus methods for navigation and selection.
|
|
29
|
+
|
|
30
|
+
**Inputs:** `options` (`ICalendarOptions | undefined`), `value` (`Date | null`, two-way model), `referenceDate` (`Date | undefined`), `events` (`ICalendarEvent[]`), `class` (`string`)
|
|
31
|
+
|
|
32
|
+
**Computed signals:** `view` (current view from options, default `'month'`), `weekStart` (`0 | 1`, default `1`), `showToolbar` (default `true`), `reference` (effective reference date — internal writable, seeded from `referenceDate` input), `monthGrid` (current 6×7 grid).
|
|
33
|
+
|
|
34
|
+
**Methods:** `selectDay(date)`, `goToToday()`, `prevPeriod()`, `nextPeriod()`, `eventsForDay(day)`.
|
|
35
|
+
|
|
36
|
+
**Static method:** `buildMonthGrid(reference, weekStart, selected): ICalendarDayCell[][]` — pure function returning a 6×7 grid suitable for rendering.
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### Inputs
|
|
41
|
+
|
|
42
|
+
| Input | Type | Default | Description |
|
|
43
|
+
| --------------- | -------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `options` | `InputSignal<ICalendarOptions \| undefined>` | - | Configuration (view, weekStart, slot templates, …) |
|
|
45
|
+
| `value` | `ModelSignal<Date \| null>` | `null` | Selected day (two-way binding) |
|
|
46
|
+
| `referenceDate` | `InputSignal<Date \| undefined>` | - | Initial reference date (current month focus). Defaults to today inside the wrapper if undefined |
|
|
47
|
+
| `events` | `InputSignal<ICalendarEvent[]>` | `[]` | Events available for `eventsForDay()` filtering |
|
|
48
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
49
|
+
|
|
50
|
+
### ICalendarOptions
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
type SmartCalendarView = 'month' | 'week' | 'day' | 'year';
|
|
54
|
+
|
|
55
|
+
interface ICalendarOptions {
|
|
56
|
+
view?: SmartCalendarView;
|
|
57
|
+
monthsCount?: 1 | 2 | 12;
|
|
58
|
+
weekStart?: 0 | 1;
|
|
59
|
+
showToolbar?: boolean;
|
|
60
|
+
toolbarActionsTpl?: TemplateRef<unknown>;
|
|
61
|
+
eventListTpl?: TemplateRef<unknown>;
|
|
62
|
+
sidePanelTpl?: TemplateRef<unknown>;
|
|
63
|
+
dayCellTpl?: TemplateRef<unknown>;
|
|
64
|
+
eventTpl?: TemplateRef<unknown>;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### ICalendarEvent
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
interface ICalendarEvent {
|
|
72
|
+
id: string | number;
|
|
73
|
+
start: Date;
|
|
74
|
+
end?: Date;
|
|
75
|
+
title?: string;
|
|
76
|
+
meta?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### ICalendarDayCell
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
interface ICalendarDayCell {
|
|
84
|
+
date: Date;
|
|
85
|
+
isCurrentMonth: boolean;
|
|
86
|
+
isToday: boolean;
|
|
87
|
+
isSelected: boolean;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The default `CalendarStandardComponent` renders the month view; `monthsCount`, `view: 'week' | 'day' | 'year'`, `eventListTpl`, `sidePanelTpl`, and `eventTpl` are hints / slots intended for custom implementations registered via the token. `weekStart` defaults to `1` (Monday).
|
|
92
|
+
|
|
93
|
+
## CALENDAR_STANDARD_COMPONENT_TOKEN
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { CALENDAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
InjectionToken that allows replacing the default `CalendarStandardComponent` with a custom implementation. Provide a `Type<CalendarBaseComponent>` to override.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
providers: [
|
|
103
|
+
{
|
|
104
|
+
provide: CALENDAR_STANDARD_COMPONENT_TOKEN,
|
|
105
|
+
useValue: MyCustomCalendarComponent,
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> **Note:** `NgComponentOutlet` does not propagate output bindings. When a custom component is injected via the token, the `value` two-way binding becomes one-way (input only). Custom implementations should expose their selection events through dedicated outputs (e.g., `valueChange`) and the host application should wire those manually.
|
|
111
|
+
|
|
112
|
+
## Extending the Base Class
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
import {
|
|
116
|
+
ChangeDetectionStrategy,
|
|
117
|
+
Component,
|
|
118
|
+
computed,
|
|
119
|
+
input,
|
|
120
|
+
ViewEncapsulation,
|
|
121
|
+
} from '@angular/core';
|
|
122
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
123
|
+
|
|
124
|
+
import { CalendarBaseComponent } from '@smartsoft001/angular';
|
|
125
|
+
|
|
126
|
+
@Component({
|
|
127
|
+
selector: 'my-custom-calendar',
|
|
128
|
+
template: `
|
|
129
|
+
<div [class]="containerClasses()">
|
|
130
|
+
@if (showToolbar()) {
|
|
131
|
+
<div class="toolbar">
|
|
132
|
+
<button (click)="prevPeriod()">Prev</button>
|
|
133
|
+
<button (click)="goToToday()">Today</button>
|
|
134
|
+
<button (click)="nextPeriod()">Next</button>
|
|
135
|
+
</div>
|
|
136
|
+
}
|
|
137
|
+
<div class="grid">
|
|
138
|
+
@for (week of monthGrid(); track $index) {
|
|
139
|
+
<div class="week">
|
|
140
|
+
@for (cell of week; track cell.date.getTime()) {
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
[attr.data-today]="cell.isToday ? 'true' : null"
|
|
144
|
+
[attr.data-selected]="cell.isSelected ? 'true' : null"
|
|
145
|
+
(click)="selectDay(cell.date)"
|
|
146
|
+
>
|
|
147
|
+
{{ cell.date.getDate() }}
|
|
148
|
+
</button>
|
|
149
|
+
}
|
|
150
|
+
</div>
|
|
151
|
+
}
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
`,
|
|
155
|
+
imports: [NgTemplateOutlet],
|
|
156
|
+
encapsulation: ViewEncapsulation.None,
|
|
157
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
158
|
+
})
|
|
159
|
+
export class MyCustomCalendarComponent extends CalendarBaseComponent {
|
|
160
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
161
|
+
override cssClass = input<string>('');
|
|
162
|
+
|
|
163
|
+
containerClasses = computed(() => {
|
|
164
|
+
const classes = ['my-calendar'];
|
|
165
|
+
const extra = this.cssClass();
|
|
166
|
+
if (extra) classes.push(extra);
|
|
167
|
+
return classes.join(' ');
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Usage Examples
|
|
173
|
+
|
|
174
|
+
```html
|
|
175
|
+
<!-- Basic month calendar with two-way binding -->
|
|
176
|
+
<smart-calendar [(value)]="selected" />
|
|
177
|
+
|
|
178
|
+
<!-- With reference date and events -->
|
|
179
|
+
<smart-calendar
|
|
180
|
+
[(value)]="selected"
|
|
181
|
+
[referenceDate]="january2026"
|
|
182
|
+
[events]="meetings"
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
<!-- Hidden toolbar -->
|
|
186
|
+
<smart-calendar [(value)]="selected" [options]="{ showToolbar: false }" />
|
|
187
|
+
|
|
188
|
+
<!-- Sunday-first weeks -->
|
|
189
|
+
<smart-calendar [(value)]="selected" [options]="{ weekStart: 0 }" />
|
|
190
|
+
|
|
191
|
+
<!-- Custom day cell (renders events in cell) -->
|
|
192
|
+
<ng-template #dayCell let-cell let-events="events">
|
|
193
|
+
<span>{{ cell.date.getDate() }}</span>
|
|
194
|
+
@for (event of events; track event.id) {
|
|
195
|
+
<span class="dot" [title]="event.title"></span>
|
|
196
|
+
}
|
|
197
|
+
</ng-template>
|
|
198
|
+
|
|
199
|
+
<smart-calendar
|
|
200
|
+
[(value)]="selected"
|
|
201
|
+
[events]="meetings"
|
|
202
|
+
[options]="{ dayCellTpl: dayCell }"
|
|
203
|
+
/>
|
|
204
|
+
|
|
205
|
+
<!-- With toolbar action slot -->
|
|
206
|
+
<ng-template #addBtn>
|
|
207
|
+
<button>+ Add event</button>
|
|
208
|
+
</ng-template>
|
|
209
|
+
|
|
210
|
+
<smart-calendar
|
|
211
|
+
[(value)]="selected"
|
|
212
|
+
[options]="{ toolbarActionsTpl: addBtn }"
|
|
213
|
+
/>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## File Locations
|
|
217
|
+
|
|
218
|
+
- Wrapper: `packages/shared/angular/src/lib/components/calendar/calendar.component.ts`
|
|
219
|
+
- Standard: `packages/shared/angular/src/lib/components/calendar/standard/standard.component.ts`
|
|
220
|
+
- Base class: `packages/shared/angular/src/lib/components/calendar/base/base.component.ts`
|
|
221
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CALENDAR_STANDARD_COMPONENT_TOKEN`)
|
|
222
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ICalendarOptions`, `ICalendarEvent`, `ICalendarDayCell`, `SmartCalendarView`)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-card
|
|
3
|
+
description: Card component API, DI token, and base class for @smartsoft001/angular
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Card Component
|
|
8
|
+
|
|
9
|
+
Flexible card container with injectable standard rendering. The `<smart-card>` wrapper renders `CardStandardComponent` by default (a neutral Tailwind placeholder with dark mode). Consumers can replace the standard with a custom variant via `CARD_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to render a card container → use `<smart-card>`
|
|
14
|
+
- Developer wants a custom visual variant → extend `CardBaseComponent` and provide via `CARD_STANDARD_COMPONENT_TOKEN`
|
|
15
|
+
- Developer asks about header/footer sections → set `hasHeader`/`hasFooter` + use `[cardHeader]` / `[cardFooter]` content projection
|
|
16
|
+
|
|
17
|
+
## Public API
|
|
18
|
+
|
|
19
|
+
### Wrapper: `smart-card`
|
|
20
|
+
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
|
+
| ----------- | -------------- | ----------- | --------------------- |
|
|
23
|
+
| `options` | `ICardOptions` | `undefined` | Card configuration |
|
|
24
|
+
| `hasHeader` | `boolean` | `false` | Show header section |
|
|
25
|
+
| `hasFooter` | `boolean` | `false` | Show footer section |
|
|
26
|
+
| `class` | `string` | `''` | Extra container class |
|
|
27
|
+
|
|
28
|
+
### ICardOptions
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
interface ICardOptions {
|
|
32
|
+
title?: string;
|
|
33
|
+
buttons?: Array<IIconButtonOptions>;
|
|
34
|
+
grayFooter?: boolean;
|
|
35
|
+
grayBody?: boolean;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Content Projection
|
|
40
|
+
|
|
41
|
+
| Selector | Description |
|
|
42
|
+
| -------------- | -------------- |
|
|
43
|
+
| `[cardHeader]` | Header content |
|
|
44
|
+
| default | Body content |
|
|
45
|
+
| `[cardFooter]` | Footer content |
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<!-- Basic -->
|
|
51
|
+
<smart-card><p>Content</p></smart-card>
|
|
52
|
+
|
|
53
|
+
<!-- With title in header -->
|
|
54
|
+
<smart-card [options]="{ title: 'Title' }" [hasHeader]="true">
|
|
55
|
+
<p>Body</p>
|
|
56
|
+
</smart-card>
|
|
57
|
+
|
|
58
|
+
<!-- Header + footer + gray footer -->
|
|
59
|
+
<smart-card
|
|
60
|
+
[options]="{ grayFooter: true }"
|
|
61
|
+
[hasHeader]="true"
|
|
62
|
+
[hasFooter]="true"
|
|
63
|
+
>
|
|
64
|
+
<div cardHeader>Custom Header</div>
|
|
65
|
+
<p>Body</p>
|
|
66
|
+
<div cardFooter>Footer</div>
|
|
67
|
+
</smart-card>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Architecture
|
|
71
|
+
|
|
72
|
+
Three-layer pattern mirroring `<smart-button>`:
|
|
73
|
+
|
|
74
|
+
1. **`CardBaseComponent`** (`@Directive()`) — shared signals/inputs (`options`, `hasHeader`, `hasFooter`, `class`, `headerTpl`, `bodyTpl`, `footerTpl`) and computed classes (`sharedContainerClasses`, `headerClasses`, `bodyClasses`, `footerClasses`). Handles divider, gray body/footer, and padding rules.
|
|
75
|
+
2. **`CardStandardComponent`** (selector: `smart-card-standard`) — default concrete implementation extending the base. Neutral Tailwind style with dark mode (`rounded-lg`, `bg-white`, `shadow-sm`, `dark:bg-gray-800/50`, `dark:outline-white/10`).
|
|
76
|
+
3. **`CardComponent`** (selector: `smart-card`) — wrapper. Uses `inject(CARD_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-card-standard>`. Content projection (`[cardHeader]`, default, `[cardFooter]`) is wrapped in local `<ng-template>` refs and passed as inputs (`headerTpl`/`bodyTpl`/`footerTpl`) to the active component.
|
|
77
|
+
|
|
78
|
+
## Overriding with Custom Implementation
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { Component } from '@angular/core';
|
|
82
|
+
import {
|
|
83
|
+
CardBaseComponent,
|
|
84
|
+
CARD_STANDARD_COMPONENT_TOKEN,
|
|
85
|
+
} from '@smartsoft001/angular';
|
|
86
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'smart-card-my-variant',
|
|
90
|
+
imports: [NgTemplateOutlet],
|
|
91
|
+
template: `...custom template using headerTpl()/bodyTpl()/footerTpl()...`,
|
|
92
|
+
})
|
|
93
|
+
export class CardMyVariantComponent extends CardBaseComponent {}
|
|
94
|
+
|
|
95
|
+
// In app bootstrap:
|
|
96
|
+
providers: [
|
|
97
|
+
{ provide: CARD_STANDARD_COMPONENT_TOKEN, useValue: CardMyVariantComponent },
|
|
98
|
+
];
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## File Locations
|
|
102
|
+
|
|
103
|
+
- Wrapper: `packages/shared/angular/src/lib/components/card/card.component.ts`
|
|
104
|
+
- Default: `packages/shared/angular/src/lib/components/card/standard/standard.component.{ts,html}`
|
|
105
|
+
- Base: `packages/shared/angular/src/lib/components/card/base/base.component.ts`
|
|
106
|
+
- Tests: `packages/shared/angular/src/lib/components/card/{card,standard/standard,base/base}.component.spec.ts`
|
|
107
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CARD_STANDARD_COMPONENT_TOKEN`)
|
|
108
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ICardOptions`)
|
|
109
|
+
|
|
110
|
+
## Tailwind Classes
|
|
111
|
+
|
|
112
|
+
All classes use `smart:` prefix. `CardStandardComponent` container: `smart:overflow-hidden smart:rounded-lg smart:bg-white smart:shadow-sm`. Dark mode: `smart:dark:bg-gray-800/50 smart:dark:shadow-none smart:dark:outline smart:dark:-outline-offset-1 smart:dark:outline-white/10`. Divider when header/footer present: `smart:divide-y smart:divide-gray-200 smart:dark:divide-white/10`. Gray body/footer: `smart:bg-gray-50 smart:dark:bg-gray-800/50`.
|