@smartsoft001/claude-plugins 2.201.0 → 2.203.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-angular/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-angular/skills/angular-components-accordion/SKILL.md +84 -80
- package/plugins/smart-angular/skills/angular-components-action-panel/SKILL.md +35 -60
- package/plugins/smart-angular/skills/angular-components-alert/SKILL.md +24 -29
- package/plugins/smart-angular/skills/angular-components-avatar/SKILL.md +30 -30
- package/plugins/smart-angular/skills/angular-components-badge/SKILL.md +18 -12
- package/plugins/smart-angular/skills/angular-components-breadcrumbs/SKILL.md +27 -10
- package/plugins/smart-angular/skills/angular-components-button/SKILL.md +43 -17
- package/plugins/smart-angular/skills/angular-components-button-group/SKILL.md +26 -14
- package/plugins/smart-angular/skills/angular-components-calendar/SKILL.md +47 -28
- package/plugins/smart-angular/skills/angular-components-card/SKILL.md +29 -22
- package/plugins/smart-angular/skills/angular-components-card-heading/SKILL.md +24 -18
- package/plugins/smart-angular/skills/angular-components-command-palette/SKILL.md +41 -32
- package/plugins/smart-angular/skills/angular-components-container/SKILL.md +21 -20
- package/plugins/smart-angular/skills/angular-components-date-edit/SKILL.md +48 -45
- package/plugins/smart-angular/skills/angular-components-date-range/SKILL.md +72 -82
- package/plugins/smart-angular/skills/angular-components-description-list/SKILL.md +23 -10
- package/plugins/smart-angular/skills/angular-components-detail/SKILL.md +20 -8
- package/plugins/smart-angular/skills/angular-components-details/SKILL.md +64 -13
- package/plugins/smart-angular/skills/angular-components-divider/SKILL.md +36 -18
- package/plugins/smart-angular/skills/angular-components-drawer/SKILL.md +28 -23
- package/plugins/smart-angular/skills/angular-components-dropdown/SKILL.md +35 -16
- package/plugins/smart-angular/skills/angular-components-empty-state/SKILL.md +49 -11
- package/plugins/smart-angular/skills/angular-components-feed/SKILL.md +45 -12
- package/plugins/smart-angular/skills/angular-components-form/SKILL.md +53 -25
- package/plugins/smart-angular/skills/angular-components-grid-list/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-icon/SKILL.md +8 -8
- package/plugins/smart-angular/skills/angular-components-info/SKILL.md +19 -15
- package/plugins/smart-angular/skills/angular-components-input/SKILL.md +86 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +131 -81
- package/plugins/smart-angular/skills/angular-components-list-container/SKILL.md +24 -32
- package/plugins/smart-angular/skills/angular-components-media-object/SKILL.md +19 -17
- package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +78 -17
- package/plugins/smart-angular/skills/angular-components-multi-column-layout/SKILL.md +19 -16
- package/plugins/smart-angular/skills/angular-components-navbar/SKILL.md +38 -21
- package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +32 -33
- package/plugins/smart-angular/skills/angular-components-page/SKILL.md +48 -52
- package/plugins/smart-angular/skills/angular-components-page-heading/SKILL.md +42 -25
- package/plugins/smart-angular/skills/angular-components-paging/SKILL.md +17 -15
- package/plugins/smart-angular/skills/angular-components-password-strength/SKILL.md +21 -19
- package/plugins/smart-angular/skills/angular-components-progress-bars/SKILL.md +61 -24
- package/plugins/smart-angular/skills/angular-components-searchbar/SKILL.md +30 -37
- package/plugins/smart-angular/skills/angular-components-section-heading/SKILL.md +38 -27
- package/plugins/smart-angular/skills/angular-components-select-menu/SKILL.md +33 -17
- package/plugins/smart-angular/skills/angular-components-sidebar-layout/SKILL.md +30 -26
- package/plugins/smart-angular/skills/angular-components-sidebar-navigation/SKILL.md +79 -16
- package/plugins/smart-angular/skills/angular-components-sign-in-form/SKILL.md +64 -24
- package/plugins/smart-angular/skills/angular-components-stacked-layout/SKILL.md +24 -23
- package/plugins/smart-angular/skills/angular-components-stacked-list/SKILL.md +40 -21
- package/plugins/smart-angular/skills/angular-components-stats/SKILL.md +28 -15
- package/plugins/smart-angular/skills/angular-components-table/SKILL.md +42 -22
- package/plugins/smart-angular/skills/angular-components-tabs/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-textarea/SKILL.md +48 -46
- package/plugins/smart-angular/skills/angular-components-toggle/SKILL.md +21 -28
- package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +66 -24
- package/plugins/smart-angular/skills/smart-crud/SKILL.md +5 -2
- package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +11 -11
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +7 -7
- package/plugins/smart-react/skills/react-components-button/SKILL.md +20 -20
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-card/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +25 -16
- package/plugins/smart-react/skills/react-components-details/SKILL.md +16 -16
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-info/SKILL.md +3 -1
- package/plugins/smart-react/skills/react-components-input/SKILL.md +51 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +81 -45
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-overlays/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-page/SKILL.md +5 -5
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +28 -28
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +29 -29
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-table/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +3 -2
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-provider/SKILL.md +1 -1
- package/plugins/smart-react/skills/smart-crud-react/SKILL.md +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/claude-plugins",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.203.0",
|
|
4
4
|
"description": "Installs the smartsoft Claude Code plugins into a project: smart-core (hooks and framework-neutral skills) plus smart-angular or smart-react (the component and CRUD skills and agents of one framework).",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-angular",
|
|
3
3
|
"description": "Smartsoft for Angular projects - the @smartsoft001/angular component skills and their angular-components agent, the Angular CRUD skill and the Nx + Angular SSR workspace scaffold",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.202.0",
|
|
5
5
|
"dependencies": ["smart-core"]
|
|
6
6
|
}
|
|
@@ -1,62 +1,99 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: angular-components-accordion
|
|
3
|
-
description: Accordion
|
|
3
|
+
description: Accordion component API (<smart-accordion>, its preset and the base class for custom implementations).
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Accordion Component
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`<smart-accordion>` is a collapsible section: a header button that toggles a body. The header and body are projected through the `[accordionHeader]` / `[accordionBody]` slots, and the open state is the two-way `show` model. The accordion has **no** injection token: `<smart-accordion>` always renders `<smart-accordion-default>`; for the styled look use `<smart-accordion-preset>` directly, and for a look of your own extend `AccordionBaseComponent`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
13
|
-
- Developer wants
|
|
14
|
-
- Developer
|
|
15
|
-
- Developer
|
|
13
|
+
- Developer wants a collapsible section (FAQ entry, "show details") in an Angular app
|
|
14
|
+
- Developer wants the styled (Preline) accordion: use `<smart-accordion-preset>`
|
|
15
|
+
- Developer wants a custom accordion: extend `AccordionBaseComponent`
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Wrapper: `<smart-accordion>`
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Inputs and models
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
|
+
| --------- | -------------------------------- | ----------- | ------------------------------------------------------------------------ |
|
|
23
|
+
| `show` | `ModelSignal<boolean>` | `false` | Open state, two-way (`[(show)]`); `showChange` reports every change. |
|
|
24
|
+
| `options` | `IAccordionOptions \| undefined` | `undefined` | `open` (initial state, applied once) and `disabled`. |
|
|
25
|
+
| `class` | `string` | `''` | Classes appended to the container (the `cssClass` input, alias `class`). |
|
|
24
26
|
|
|
25
|
-
###
|
|
27
|
+
### Content projection
|
|
26
28
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| `bodyTpl` | `InputSignal<TemplateRef>` | required | Body template |
|
|
29
|
+
| Selector | Description |
|
|
30
|
+
| ------------------- | ---------------------------------------- |
|
|
31
|
+
| `[accordionHeader]` | Content of the header button. |
|
|
32
|
+
| `[accordionBody]` | Content shown while the section is open. |
|
|
33
|
+
|
|
34
|
+
The wrapper passes both slots to `<smart-accordion-default>` as the `headerTpl` / `bodyTpl` templates.
|
|
34
35
|
|
|
35
36
|
### IAccordionOptions
|
|
36
37
|
|
|
38
|
+
| Field | Type | Default | Description |
|
|
39
|
+
| ---------- | --------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `open` | `boolean` | `undefined` | Initial open state. When it is `true` on the first render and `show` is not already `true`, `AccordionBaseComponent.ngOnInit` sets `show` to `true` once and emits `showChange`, in every variant. Later changes of `options.open` are ignored; toggles and `[(show)]` take over. |
|
|
41
|
+
| `disabled` | `boolean` | `false` | `toggle()` does nothing and the header button is rendered disabled. |
|
|
42
|
+
| `animated` | `boolean` | `undefined` | Deprecated: not read by the built-in implementations (no variant animates); available to a custom implementation. |
|
|
43
|
+
|
|
44
|
+
Bind `[(show)]` to a **signal** when you combine it with `options.open`: a plain class field updated during the first change detection raises `NG0100` (ExpressionChangedAfterItHasBeenChecked) in dev mode.
|
|
45
|
+
|
|
37
46
|
```typescript
|
|
38
47
|
interface IAccordionOptions {
|
|
39
|
-
open?: boolean; //
|
|
40
|
-
disabled?: boolean; //
|
|
41
|
-
/** @deprecated
|
|
48
|
+
open?: boolean; // initial state, applied once on the first render
|
|
49
|
+
disabled?: boolean; // toggle() does nothing
|
|
50
|
+
/** @deprecated Not read by any variant. */
|
|
42
51
|
animated?: boolean;
|
|
43
52
|
}
|
|
44
53
|
```
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
### Building blocks of the default rendering
|
|
56
|
+
|
|
57
|
+
`<smart-accordion-default>` (`AccordionDefaultComponent`) is a bordered card made of two exported components you can reuse:
|
|
58
|
+
|
|
59
|
+
| Component | Selector | Inputs |
|
|
60
|
+
| -------------------------- | ------------------------ | ------------------------------------------------------------------------------------------ |
|
|
61
|
+
| `AccordionHeaderComponent` | `smart-accordion-header` | `open` (`boolean`, chevron up while `true`), `disabled` (`boolean`), `cssClass` (`string`) |
|
|
62
|
+
| `AccordionBodyComponent` | `smart-accordion-body` | `cssClass` (`string`) |
|
|
63
|
+
|
|
64
|
+
## AccordionPresetComponent (`<smart-accordion-preset>`)
|
|
65
|
+
|
|
66
|
+
A fully styled accordion based on the Preline bordered accordion. It extends `AccordionBaseComponent`, so it takes the same contract as `AccordionDefaultComponent`: the required `headerTpl` / `bodyTpl` template inputs, the `show` model, `options` and `cssClass` (bound as `[cssClass]`; the base input has no `class` alias).
|
|
67
|
+
|
|
68
|
+
Because there is no token, the preset cannot restyle `<smart-accordion>`, and `provideSmartPresets()` does not change it: render `<smart-accordion-preset>` where you want the styled look and supply the templates yourself.
|
|
69
|
+
|
|
70
|
+
Expand/collapse is driven by the inherited `show` model and `@if`; no Preline JS runtime is needed. The toggle button carries `aria-expanded` / `aria-controls`, the open body is a `region`, the chevron points down while collapsed and up while expanded, and the container border is visible only while open.
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<ng-template #headerTpl>What is the best thing about Switzerland?</ng-template>
|
|
74
|
+
<ng-template #bodyTpl>I don't know, but the flag is a big plus.</ng-template>
|
|
75
|
+
<smart-accordion-preset
|
|
76
|
+
[headerTpl]="headerTpl"
|
|
77
|
+
[bodyTpl]="bodyTpl"
|
|
78
|
+
[(show)]="isOpen"
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## AccordionBaseComponent
|
|
83
|
+
|
|
84
|
+
The abstract directive every variant extends (`AccordionDefaultComponent`, `AccordionPresetComponent`, and yours).
|
|
85
|
+
|
|
86
|
+
### Inputs
|
|
87
|
+
|
|
88
|
+
| Input | Type | Default | Description |
|
|
89
|
+
| ----------- | --------------------------------------------- | ----------- | ------------------------------ |
|
|
90
|
+
| `show` | `ModelSignal<boolean>` | `false` | Two-way binding for open state |
|
|
91
|
+
| `options` | `InputSignal<IAccordionOptions \| undefined>` | `undefined` | Accordion configuration |
|
|
92
|
+
| `cssClass` | `InputSignal<string>` | `''` | External CSS classes |
|
|
93
|
+
| `headerTpl` | `InputSignal<TemplateRef<unknown>>` | required | Header template |
|
|
94
|
+
| `bodyTpl` | `InputSignal<TemplateRef<unknown>>` | required | Body template |
|
|
95
|
+
|
|
96
|
+
### Computed properties
|
|
60
97
|
|
|
61
98
|
| Property | Type | Description |
|
|
62
99
|
| ------------------------ | ------------------ | ------------------------------------------------------- |
|
|
@@ -64,22 +101,24 @@ interface IAccordionOptions {
|
|
|
64
101
|
|
|
65
102
|
### Methods
|
|
66
103
|
|
|
67
|
-
| Method | Description
|
|
68
|
-
| ------------ |
|
|
69
|
-
| `toggle()` | Toggles `show`
|
|
70
|
-
| `ngOnInit()` | Applies `options.open` as the initial state
|
|
104
|
+
| Method | Description |
|
|
105
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|
106
|
+
| `toggle()` | Toggles the `show` model (no-op while `options.disabled`) |
|
|
107
|
+
| `ngOnInit()` | Applies `options.open` as the initial state; a subclass with its own `ngOnInit` calls `super.ngOnInit()` to keep it |
|
|
71
108
|
|
|
72
109
|
## Extending the Base Class
|
|
73
110
|
|
|
74
111
|
```typescript
|
|
112
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
75
113
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
76
114
|
import { AccordionBaseComponent } from '@smartsoft001/angular';
|
|
77
115
|
|
|
78
116
|
@Component({
|
|
79
117
|
selector: 'my-accordion',
|
|
118
|
+
imports: [NgTemplateOutlet],
|
|
80
119
|
template: `
|
|
81
120
|
<div [class]="sharedContainerClasses().join(' ')">
|
|
82
|
-
<button (click)="toggle()">
|
|
121
|
+
<button type="button" (click)="toggle()">
|
|
83
122
|
<ng-container [ngTemplateOutlet]="headerTpl()" />
|
|
84
123
|
</button>
|
|
85
124
|
@if (show()) {
|
|
@@ -94,49 +133,14 @@ import { AccordionBaseComponent } from '@smartsoft001/angular';
|
|
|
94
133
|
export class MyAccordionComponent extends AccordionBaseComponent {}
|
|
95
134
|
```
|
|
96
135
|
|
|
97
|
-
|
|
98
|
-
`options.open` keeps working.
|
|
99
|
-
|
|
100
|
-
## AccordionPresetComponent (`<smart-accordion-preset>`)
|
|
101
|
-
|
|
102
|
-
A fully styled, drop-in accordion concrete based on the Preline bordered
|
|
103
|
-
accordion (FRA-210). It extends `AccordionBaseComponent`, so it consumes the
|
|
104
|
-
exact same contract as `AccordionDefaultComponent`: the `headerTpl` / `bodyTpl`
|
|
105
|
-
required template inputs, the `show` two-way model, `options` and `cssClass`.
|
|
106
|
-
|
|
107
|
-
> **Not token-swappable.** Unlike most preset variations in this library, the
|
|
108
|
-
> accordion has **no** `ACCORDION_STANDARD_COMPONENT_TOKEN` and the
|
|
109
|
-
> `<smart-accordion>` wrapper hard-codes `<smart-accordion-default>`. There is no
|
|
110
|
-
> NgComponentOutlet/DI seam, so the preset cannot be registered to restyle
|
|
111
|
-
> `<smart-accordion>`. **Use it directly via the `<smart-accordion-preset>`
|
|
112
|
-
> selector** and supply the templates yourself.
|
|
113
|
-
|
|
114
|
-
Expand/collapse is driven entirely by the inherited `show` model signal plus
|
|
115
|
-
`@if` — no Preline JS runtime is required. The header arrow is an inline chevron
|
|
116
|
-
(down when collapsed, up when expanded) and the container border becomes visible
|
|
117
|
-
only while open.
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
import { AccordionPresetComponent } from '@smartsoft001/angular';
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
```html
|
|
124
|
-
<ng-template #headerTpl>What is the best thing about Switzerland?</ng-template>
|
|
125
|
-
<ng-template #bodyTpl>I don't know, but the flag is a big plus.</ng-template>
|
|
126
|
-
<smart-accordion-preset
|
|
127
|
-
[headerTpl]="headerTpl"
|
|
128
|
-
[bodyTpl]="bodyTpl"
|
|
129
|
-
[(show)]="isOpen"
|
|
130
|
-
[options]="{ disabled: false }"
|
|
131
|
-
[cssClass]="'my-extra-class'"
|
|
132
|
-
/>
|
|
133
|
-
```
|
|
136
|
+
A custom accordion is rendered by its own selector (there is no token to register it under), with the header and body passed as `<ng-template>` references.
|
|
134
137
|
|
|
135
138
|
## File Locations
|
|
136
139
|
|
|
140
|
+
- Wrapper: `packages/shared/angular/src/lib/components/accordion/accordion.component.ts`
|
|
137
141
|
- Base class: `packages/shared/angular/src/lib/components/accordion/base/base.component.ts`
|
|
138
|
-
- Tests: `packages/shared/angular/src/lib/components/accordion/base/base.component.spec.ts`
|
|
139
142
|
- Default concrete: `packages/shared/angular/src/lib/components/accordion/default/default.component.ts`
|
|
143
|
+
- Header / body: `packages/shared/angular/src/lib/components/accordion/header/header.component.ts`, `.../body/body.component.ts`
|
|
140
144
|
- Preset concrete: `packages/shared/angular/src/lib/components/accordion/preset/preset.component.ts`
|
|
141
|
-
- Preset class recipes: `packages/shared/angular/src/lib/components/accordion/preset/preset-classes.util.ts`
|
|
145
|
+
- Preset class recipes (internal, not exported): `packages/shared/angular/src/lib/components/accordion/preset/preset-classes.util.ts`
|
|
142
146
|
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IAccordionOptions`)
|
|
@@ -17,11 +17,11 @@ The `<smart-action-panel>` component renders a standalone panel with a heading,
|
|
|
17
17
|
|
|
18
18
|
### ActionPanelComponent (`<smart-action-panel>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `ActionPanelStandardComponent` by default. When `ACTION_PANEL_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper. Delegates to `ActionPanelStandardComponent` by default. When `ACTION_PANEL_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passes it the inputs and re-emits its `actionClick`.
|
|
21
21
|
|
|
22
22
|
### ActionPanelStandardComponent (`<smart-action-panel-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<section class="action-panel">` containing an optional `<h3>{{ options.title }}</h3>`, an optional description (string `options.description` rendered as `<p class="description">` or `options.descriptionTpl` rendered via `NgTemplateOutlet`), an optional `<div class="content">` slot from `options.contentTpl`, and an optional `<div class="actions">` row of `<button class="action variant-{variant}">` (or `<a>` when `action.href` is provided) per `options.actions` entry that emits `{ actionId }` via `actionClick`.
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<section class="action-panel">` containing an optional `<h3>{{ options.title }}</h3>`, an optional description (string `options.description` rendered as `<p class="description">` or `options.descriptionTpl` rendered via `NgTemplateOutlet`), an optional `<div class="content">` slot from `options.contentTpl`, and an optional `<div class="actions">` row of `<button class="action variant-{variant}">` (or `<a>` when `action.href` is provided) per `options.actions` entry that emits `{ actionId }` via `actionClick`. It does not vary its markup by `options.layout`.
|
|
25
25
|
|
|
26
26
|
### ActionPanelBaseComponent (abstract)
|
|
27
27
|
|
|
@@ -50,6 +50,27 @@ Abstract base directive. Exposes:
|
|
|
50
50
|
|
|
51
51
|
### IActionPanelOptions
|
|
52
52
|
|
|
53
|
+
| Field | Type | Default | Description |
|
|
54
|
+
| ---------------- | ------------------------ | ----------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| `title` | `string` | `undefined` | Heading of the panel. |
|
|
56
|
+
| `description` | `string` | `undefined` | Text under the heading. |
|
|
57
|
+
| `layout` | `SmartActionPanelLayout` | `'simple'` | Preset only: one of the eight arrangements of `ActionPanelPresetComponent`. The standard does not vary its markup by layout. |
|
|
58
|
+
| `actions` | `IActionPanelAction[]` | `[]` | The buttons / links of the panel. |
|
|
59
|
+
| `descriptionTpl` | `TemplateRef<unknown>` | `undefined` | Replaces `description` with a template. |
|
|
60
|
+
| `contentTpl` | `TemplateRef<unknown>` | `undefined` | Extra content placed in the panel (a toggle, an input, a card). |
|
|
61
|
+
|
|
62
|
+
### IActionPanelAction
|
|
63
|
+
|
|
64
|
+
| Field | Type | Default | Description |
|
|
65
|
+
| --------- | ----------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `id` | `string` | required | Reported as `actionId` by `actionClick`. |
|
|
67
|
+
| `label` | `string` | `undefined` | Text of the button / link. |
|
|
68
|
+
| `href` | `string` | `undefined` | Renders the action as a link instead of a button (no `actionClick`). |
|
|
69
|
+
| `variant` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | `undefined` | Look of the action. The standard only adds the class `variant-<variant>` (`variant-primary` by default for buttons, `variant-link` for links). The preset renders `primary` as a solid button and every other value, or none, as an outline button; in the `with-link` layout every action looks like a link. |
|
|
70
|
+
| `iconTpl` | `TemplateRef<unknown>` | `undefined` | Icon rendered before the label. |
|
|
71
|
+
|
|
72
|
+
`SmartActionPanelLayout` is `'simple' | 'with-link' | 'right-button' | 'top-right-button' | 'with-toggle' | 'with-input' | 'well' | 'payment-method'`.
|
|
73
|
+
|
|
53
74
|
```typescript
|
|
54
75
|
type SmartActionPanelLayout =
|
|
55
76
|
| 'simple'
|
|
@@ -81,6 +102,8 @@ interface IActionPanelAction {
|
|
|
81
102
|
|
|
82
103
|
## ACTION_PANEL_STANDARD_COMPONENT_TOKEN
|
|
83
104
|
|
|
105
|
+
InjectionToken that replaces the default `ActionPanelStandardComponent` with a custom implementation: provide a `Type<ActionPanelBaseComponent>` under `ACTION_PANEL_STANDARD_COMPONENT_TOKEN`. Every `<smart-action-panel>` in that injector renders it, gets the wrapper's inputs (`class` included) and re-emits its `actionClick`.
|
|
106
|
+
|
|
84
107
|
```typescript
|
|
85
108
|
import { ACTION_PANEL_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
86
109
|
|
|
@@ -98,7 +121,6 @@ providers: [
|
|
|
98
121
|
import {
|
|
99
122
|
ChangeDetectionStrategy,
|
|
100
123
|
Component,
|
|
101
|
-
input,
|
|
102
124
|
ViewEncapsulation,
|
|
103
125
|
} from '@angular/core';
|
|
104
126
|
|
|
@@ -107,7 +129,7 @@ import { ActionPanelBaseComponent } from '@smartsoft001/angular';
|
|
|
107
129
|
@Component({
|
|
108
130
|
selector: 'my-custom-action-panel',
|
|
109
131
|
template: `
|
|
110
|
-
<section>
|
|
132
|
+
<section [class]="cssClass()">
|
|
111
133
|
@if (options()?.title) {
|
|
112
134
|
<h3>{{ options()!.title }}</h3>
|
|
113
135
|
}
|
|
@@ -127,10 +149,7 @@ import { ActionPanelBaseComponent } from '@smartsoft001/angular';
|
|
|
127
149
|
encapsulation: ViewEncapsulation.None,
|
|
128
150
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
129
151
|
})
|
|
130
|
-
export class MyCustomActionPanelComponent extends ActionPanelBaseComponent {
|
|
131
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
132
|
-
override cssClass = input<string>('');
|
|
133
|
-
}
|
|
152
|
+
export class MyCustomActionPanelComponent extends ActionPanelBaseComponent {}
|
|
134
153
|
```
|
|
135
154
|
|
|
136
155
|
## Usage Examples
|
|
@@ -157,20 +176,6 @@ export class MyCustomActionPanelComponent extends ActionPanelBaseComponent {
|
|
|
157
176
|
}"
|
|
158
177
|
/>
|
|
159
178
|
|
|
160
|
-
<!-- With multiple actions -->
|
|
161
|
-
<smart-action-panel
|
|
162
|
-
[options]="{
|
|
163
|
-
title: 'Manage subscription',
|
|
164
|
-
description: 'Cancel anytime.',
|
|
165
|
-
layout: 'right-button',
|
|
166
|
-
actions: [
|
|
167
|
-
{ id: 'cancel', label: 'Cancel', variant: 'ghost' },
|
|
168
|
-
{ id: 'change', label: 'Change plan', variant: 'primary' },
|
|
169
|
-
],
|
|
170
|
-
}"
|
|
171
|
-
(actionClick)="onAction($event)"
|
|
172
|
-
/>
|
|
173
|
-
|
|
174
179
|
<!-- With templated content (e.g. embedded toggle/input/well) -->
|
|
175
180
|
<ng-template #payment>
|
|
176
181
|
<div class="payment-method">…</div>
|
|
@@ -196,49 +201,19 @@ export class MyCustomActionPanelComponent extends ActionPanelBaseComponent {
|
|
|
196
201
|
|
|
197
202
|
## Preset
|
|
198
203
|
|
|
199
|
-
`ActionPanelPresetComponent` (
|
|
200
|
-
`action-panel/preset/`) extends `ActionPanelStandardComponent` and restyles the
|
|
201
|
-
panel as a bordered card
|
|
202
|
-
(`rounded-xl border bg-white p-4 shadow-2xs sm:p-6` + dark twin). Title uses
|
|
203
|
-
`text-base font-semibold text-gray-900`, description `text-sm text-gray-500`;
|
|
204
|
-
`descriptionTpl` overrides the description text. Class recipes live in
|
|
205
|
-
`preset-classes.util.ts` (`getActionPanel*Classes`, not barrel-exported).
|
|
204
|
+
`ActionPanelPresetComponent` (`<smart-action-panel-preset>`) extends `ActionPanelStandardComponent` and restyles the panel as a bordered card (`rounded-xl border bg-white p-4 shadow-2xs sm:p-6` + dark twin). Title uses `text-base font-semibold text-gray-900`, description `text-sm text-gray-500`; `descriptionTpl` overrides the description text.
|
|
206
205
|
|
|
207
|
-
|
|
208
|
-
(default `simple`):
|
|
206
|
+
Register it under `ACTION_PANEL_STANDARD_COMPONENT_TOKEN` (`{ provide: ACTION_PANEL_STANDARD_COMPONENT_TOKEN, useValue: ActionPanelPresetComponent }`) to restyle every `<smart-action-panel>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-action-panel-preset>` selector directly. Used directly, it takes the extra classes as `class` or `[cssClass]`.
|
|
209
207
|
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
All eight `SmartActionPanelLayout` values are realized through a `@switch` (default `simple`):
|
|
209
|
+
|
|
210
|
+
- `simple` / `with-input` / `payment-method` — title, description, content slot, then actions stacked below.
|
|
212
211
|
- `with-link` — actions rendered as `text-blue-600 hover:underline` links.
|
|
213
212
|
- `right-button` — flex row, content left, actions right, vertically centered.
|
|
214
213
|
- `top-right-button` — actions in the title row, right-aligned.
|
|
215
214
|
- `with-toggle` — content slot placed beside the text (flex row), actions below.
|
|
216
|
-
- `well` — content and actions wrapped in an inset
|
|
217
|
-
`bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4` panel.
|
|
218
|
-
|
|
219
|
-
Actions map by `variant`: `primary` → solid `bg-blue-600 text-white`, others →
|
|
220
|
-
outline `border-gray-200 bg-white text-gray-800` + dark. `href` actions render
|
|
221
|
-
as `<a>`, the rest as `<button>` calling the inherited `onActionClick(id)`
|
|
222
|
-
(emits `actionClick` with the action id). DOM hooks: `data-role` of
|
|
223
|
-
`panel`/`title`/`description`/`content`/`actions`/`well`, plus per-action
|
|
224
|
-
`data-role="action"` with `data-action-id`; the panel also carries
|
|
225
|
-
`data-layout`.
|
|
226
|
-
|
|
227
|
-
Unlike the standard component, the preset drops the `class` input alias
|
|
228
|
-
(`override cssClass = input<string>('')`) so the wrapper's canonical
|
|
229
|
-
`componentInputs` binding reaches it via `NgComponentOutlet`.
|
|
215
|
+
- `well` — content and actions wrapped in an inset `bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4` panel.
|
|
230
216
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```ts
|
|
234
|
-
providers: [
|
|
235
|
-
{
|
|
236
|
-
provide: ACTION_PANEL_STANDARD_COMPONENT_TOKEN,
|
|
237
|
-
useValue: ActionPanelPresetComponent,
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
```
|
|
217
|
+
Actions map by `variant`: `primary` → solid `bg-blue-600 text-white`, any other value or none → outline `border-gray-200 bg-white text-gray-800` + dark. `href` actions render as `<a>`, the rest as `<button>` emitting `actionClick` with the action id. DOM hooks: `data-role` of `panel`/`title`/`description`/`content`/`actions`/`well`, plus per-action `data-role="action"` with `data-action-id`; the panel also carries `data-layout`.
|
|
241
218
|
|
|
242
|
-
Gaps: `with-toggle` / `with-input` / `payment-method` only position the content
|
|
243
|
-
slot — the interactive control (toggle switch, input, card list) is supplied by
|
|
244
|
-
the caller via `contentTpl`.
|
|
219
|
+
Gaps: `with-toggle` / `with-input` / `payment-method` only position the content slot — the interactive control (toggle switch, input, card list) is supplied by the caller via `contentTpl`.
|
|
@@ -17,7 +17,7 @@ The `<smart-alert>` component is a small confirm dialog: a header, an optional s
|
|
|
17
17
|
|
|
18
18
|
### AlertComponent (`<smart-alert>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `AlertStandardComponent` by default. When `ALERT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Use it inline when the alert is part of a template; use `AlertService` when it has to be opened from code.
|
|
20
|
+
Main wrapper component. Renders `AlertStandardComponent` by default. When `ALERT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passes it `options` and `class` and re-emits its `dismissed`. Use it inline when the alert is part of a template; use `AlertService` when it has to be opened from code.
|
|
21
21
|
|
|
22
22
|
### AlertStandardComponent (`<smart-alert-standard>`)
|
|
23
23
|
|
|
@@ -29,15 +29,15 @@ Keyboard and focus: the first button receives focus when the dialog mounts, `Tab
|
|
|
29
29
|
|
|
30
30
|
Abstract base directive for custom alert implementations. Exposes `options` as `InputSignal<IAlertOptions>` (required), `cssClass` as `InputSignal<string>` (alias `class`), the `dismissed` output, and the computed `buttons()` and `cancelButton()` (the first button whose role is `cancel`, or `null`). Behaviour lives in the base so a custom template only has to bind it:
|
|
31
31
|
|
|
32
|
-
| Member | What it does
|
|
33
|
-
| ----------------------------- |
|
|
34
|
-
| `invoke(button)` | Runs `button.handler` when present, then emits `dismissed` with the button. A handler that returns `false` keeps the dialog open (Ionic semantics). A `cancel` button needs no handler. |
|
|
35
|
-
| `cancel()` | Emits `dismissed` with `cancelButton()` or `null`. Runs no handler.
|
|
36
|
-
| `onEscape()` | Calls `cancel()`; the standard binds it to `document:keydown.escape`.
|
|
37
|
-
| `onBackdropClick(event)` | Calls `cancel()` when the click landed on the backdrop itself and `options.backdropDismiss` is not `false`.
|
|
38
|
-
| `trapFocus(event, container)` | Keeps `Tab` / `Shift+Tab` cycling among the enabled buttons of `container`.
|
|
39
|
-
| `buttonClasses(button)` | The role-based Tailwind classes plus the button's own `cssClass`.
|
|
40
|
-
| `headerId`, `messageId` | Unique ids per instance, for `aria-labelledby` / `aria-describedby`.
|
|
32
|
+
| Member | What it does |
|
|
33
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
+
| `invoke(button)` | Runs `button.handler` when present, then emits `dismissed` with the button. A handler that returns `false` keeps the dialog open (Ionic semantics), except on a button with role `cancel`, which always dismisses. A `cancel` button needs no handler. |
|
|
35
|
+
| `cancel()` | Emits `dismissed` with `cancelButton()` or `null`. Runs no handler. |
|
|
36
|
+
| `onEscape()` | Calls `cancel()`; the standard binds it to `document:keydown.escape`. |
|
|
37
|
+
| `onBackdropClick(event)` | Calls `cancel()` when the click landed on the backdrop itself and `options.backdropDismiss` is not `false`. |
|
|
38
|
+
| `trapFocus(event, container)` | Keeps `Tab` / `Shift+Tab` cycling among the enabled buttons of `container`. |
|
|
39
|
+
| `buttonClasses(button)` | The role-based Tailwind classes plus the button's own `cssClass`. |
|
|
40
|
+
| `headerId`, `messageId` | Unique ids per instance, for `aria-labelledby` / `aria-describedby`. |
|
|
41
41
|
|
|
42
42
|
## AlertService
|
|
43
43
|
|
|
@@ -66,22 +66,22 @@ The service reads `ALERT_STANDARD_COMPONENT_TOKEN` from its own injector, so a r
|
|
|
66
66
|
|
|
67
67
|
### IAlertOptions
|
|
68
68
|
|
|
69
|
-
| Property | Type | Default | Description
|
|
70
|
-
| ----------------- | ---------------- | ------- |
|
|
71
|
-
| `header` | `string` | - | Dialog heading (also the accessible name)
|
|
72
|
-
| `subHeader` | `string` | - | Secondary heading under the header
|
|
73
|
-
| `message` | `string` | - | Body text (also the accessible description)
|
|
74
|
-
| `backdropDismiss` | `boolean` | `true` | Whether a click on the backdrop cancels the alert
|
|
75
|
-
| `buttons` | `IAlertButton[]` | `[]` | Buttons rendered in order,
|
|
69
|
+
| Property | Type | Default | Description |
|
|
70
|
+
| ----------------- | ---------------- | ------- | ------------------------------------------------------------------------- |
|
|
71
|
+
| `header` | `string` | - | Dialog heading (also the accessible name) |
|
|
72
|
+
| `subHeader` | `string` | - | Secondary heading under the header |
|
|
73
|
+
| `message` | `string` | - | Body text (also the accessible description) |
|
|
74
|
+
| `backdropDismiss` | `boolean` | `true` | Whether a click on the backdrop cancels the alert |
|
|
75
|
+
| `buttons` | `IAlertButton[]` | `[]` | Buttons rendered in order, each styled by its `role` (see `IAlertButton`) |
|
|
76
76
|
|
|
77
77
|
### IAlertButton
|
|
78
78
|
|
|
79
|
-
| Property | Type | Default | Description
|
|
80
|
-
| ---------- | ----------------------------------------------------------------- | ------- |
|
|
81
|
-
| `text` | `string` | - | Visible label
|
|
82
|
-
| `role` | `'cancel' \| 'destructive' \| string` | - | `cancel
|
|
83
|
-
| `cssClass` | `string \| string[]` | - | Extra classes appended to the button
|
|
84
|
-
| `handler` | `(value?: unknown) => boolean \| void \| Record<string, unknown>` | - | Runs before the dialog closes;
|
|
79
|
+
| Property | Type | Default | Description |
|
|
80
|
+
| ---------- | ----------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
81
|
+
| `text` | `string` | - | Visible label |
|
|
82
|
+
| `role` | `'cancel' \| 'destructive' \| string` | - | `cancel`: the secondary button, and the button Escape and the backdrop dismiss with (its handler does not run then); `destructive`: red; any other value or none: the blue primary |
|
|
83
|
+
| `cssClass` | `string \| string[]` | - | Extra classes appended to the button |
|
|
84
|
+
| `handler` | `(value?: unknown) => boolean \| void \| Record<string, unknown>` | - | Runs on click, before the dialog closes; returning `false` keeps it open, except on a `cancel` button |
|
|
85
85
|
|
|
86
86
|
## ALERT_STANDARD_COMPONENT_TOKEN
|
|
87
87
|
|
|
@@ -106,7 +106,6 @@ providers: [
|
|
|
106
106
|
import {
|
|
107
107
|
ChangeDetectionStrategy,
|
|
108
108
|
Component,
|
|
109
|
-
input,
|
|
110
109
|
ViewEncapsulation,
|
|
111
110
|
} from '@angular/core';
|
|
112
111
|
|
|
@@ -141,15 +140,11 @@ import { AlertBaseComponent } from '@smartsoft001/angular';
|
|
|
141
140
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
142
141
|
host: { '(document:keydown.escape)': 'onEscape()' },
|
|
143
142
|
})
|
|
144
|
-
export class MyCustomAlertComponent extends AlertBaseComponent {
|
|
145
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
146
|
-
override cssClass = input<string>('');
|
|
147
|
-
}
|
|
143
|
+
export class MyCustomAlertComponent extends AlertBaseComponent {}
|
|
148
144
|
```
|
|
149
145
|
|
|
150
146
|
When extending the base directly, remember to:
|
|
151
147
|
|
|
152
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) — the wrapper and `AlertService` create the component by type, so inputs arrive by canonical name,
|
|
153
148
|
- call `invoke(button)` from every button so handlers run and `dismissed` fires; `AlertService.show()` resolves on that output and nothing else,
|
|
154
149
|
- bind `onEscape()` to the document `keydown.escape` and `trapFocus()` to the panel yourself — the base holds the logic but binds no listeners,
|
|
155
150
|
- move focus into the dialog after it mounts (the standard focuses its first button in `ngAfterViewInit`).
|