@smartsoft001/claude-plugins 2.176.0 → 2.177.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/skills/angular-components-stacked-list/SKILL.md +48 -3
- package/plugins/smart/skills/angular-components-table/SKILL.md +54 -3
- package/plugins/smart/skills/angular-components-textarea/SKILL.md +65 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/claude-plugins",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.177.0",
|
|
4
4
|
"description": "Installs the smart@smartsoft Claude Code plugin into a project: the agents, skills and hooks this workspace develops with.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -6,12 +6,12 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Stacked List Component
|
|
8
8
|
|
|
9
|
-
The `<smart-stacked-list>` component renders a vertical list of records with optional title, description, per-item icon/avatar, link, badge, action template, and bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `StackedListBaseComponent` defines the shared API — optional `IStackedListOptions` and `cssClass` (alias `class`). `StackedListStandardComponent` is a barebones placeholder concrete implementation. `StackedListComponent` is the public wrapper that renders `StackedListStandardComponent` by default and accepts a custom replacement via `STACKED_LIST_STANDARD_COMPONENT_TOKEN`.
|
|
9
|
+
The `<smart-stacked-list>` component renders a vertical list of records with optional title, description, per-item icon/avatar, link, badge, action template, and bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `StackedListBaseComponent` defines the shared API — optional `IStackedListOptions` and `cssClass` (alias `class`). `StackedListStandardComponent` is a barebones placeholder concrete implementation. `StackedListPresetComponent` is a styled Tailwind drop-in replacement. `StackedListComponent` is the public wrapper that renders `StackedListStandardComponent` by default and accepts a custom replacement (such as the preset) via `STACKED_LIST_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
13
13
|
- Developer wants to use or customize the stacked list component
|
|
14
|
-
- Developer asks about `<smart-stacked-list>`, `StackedListComponent`, `StackedListStandardComponent`, or `StackedListBaseComponent`
|
|
14
|
+
- Developer asks about `<smart-stacked-list>`, `StackedListComponent`, `StackedListStandardComponent`, `StackedListPresetComponent`, or `StackedListBaseComponent`
|
|
15
15
|
|
|
16
16
|
## Components
|
|
17
17
|
|
|
@@ -23,6 +23,10 @@ Main wrapper component. Renders `StackedListStandardComponent` by default. When
|
|
|
23
23
|
|
|
24
24
|
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, and a `<ul role="list">` with one `<li class="item">` per item. Each item renders the icon/avatar (icon template wins over avatar URL), a body group with the title (rendered as `<a class="title">` if `href` is provided, otherwise `<span class="title">`) and optional description/meta, and optional badge/action template slots. When the item list is empty, the optional `emptyTpl` is rendered inside `<div class="empty">`. A bottom `footerTpl` renders inside `<div class="footer">`. 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
25
|
|
|
26
|
+
### StackedListPresetComponent (`<smart-stacked-list-preset>`)
|
|
27
|
+
|
|
28
|
+
Styled variation that extends `StackedListBaseComponent` and is a drop-in replacement for `StackedListStandardComponent`. See [Preset](#preset).
|
|
29
|
+
|
|
26
30
|
### StackedListBaseComponent (abstract)
|
|
27
31
|
|
|
28
32
|
Abstract base directive for extending custom stacked-list implementations. Exposes `options` as an `InputSignal<IStackedListOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
@@ -63,7 +67,46 @@ interface IStackedListItem {
|
|
|
63
67
|
}
|
|
64
68
|
```
|
|
65
69
|
|
|
66
|
-
All properties are optional except `IStackedListItem.title`. The default `StackedListStandardComponent`
|
|
70
|
+
All properties are optional except `IStackedListItem.title`. The default `StackedListStandardComponent` renders every content property but ignores the `withDividers` and `fullWidthOnMobile` layout hints; `StackedListPresetComponent` honours them (see [Preset](#preset)). A section is rendered only when its template/string is provided. Within an item, `iconTpl` wins over `avatarUrl` when both are set.
|
|
71
|
+
|
|
72
|
+
## Preset
|
|
73
|
+
|
|
74
|
+
`StackedListPresetComponent` (selector `smart-stacked-list-preset`) is the styled skin used by the Storybook stories and the docs site. It extends `StackedListBaseComponent`, so it takes the same `options` and `cssClass` inputs.
|
|
75
|
+
|
|
76
|
+
It renders the Tailwind UI stacked list look in `smart:`-prefixed Tailwind v4 classes with a `smart:dark:` variant on every colour:
|
|
77
|
+
|
|
78
|
+
- **Header**: `text-base font-semibold` gray-900 / white title and a `text-sm` gray-500 / gray-400 description.
|
|
79
|
+
- **Rows**: `flex items-center justify-between gap-x-6 py-5`. The leading media is a `size-12` rounded-full avatar (`avatarUrl`) or a gray-100 / gray-800 rounded-full tile wrapping `iconTpl` (the icon template wins). The body shows the title (`text-sm/6 font-semibold`, rendered as a link with hover underline when `href` is set), a truncated `text-xs/5` description and a meta line. `badgeTpl` and `actionTpl` render in a trailing group.
|
|
80
|
+
- **Empty state**: `emptyTpl` renders in a dashed gray-200 / white-10 rounded-lg box when `items` is empty.
|
|
81
|
+
- **Footer**: `footerTpl` renders under the list.
|
|
82
|
+
- **External class**: `cssClass` is appended to the root wrapper.
|
|
83
|
+
|
|
84
|
+
It honours both layout hints that the standard component ignores:
|
|
85
|
+
|
|
86
|
+
| Option | Preset behaviour |
|
|
87
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `withDividers` | `true` draws `divide-y` gray-100 / white-10 hairlines between rows. Unset or `false` separates rows by spacing only. |
|
|
89
|
+
| `fullWidthOnMobile` | `true` renders the list as a white / gray-900 card with a ring. Below `sm` it bleeds to the screen edge (`-mx-4`, square corners); from `sm` up it is a `rounded-xl` card. Rows get `px-4 sm:px-6` padding. |
|
|
90
|
+
|
|
91
|
+
Register it on the token to restyle every `<smart-stacked-list>`:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import {
|
|
95
|
+
STACKED_LIST_STANDARD_COMPONENT_TOKEN,
|
|
96
|
+
StackedListPresetComponent,
|
|
97
|
+
} from '@smartsoft001/angular';
|
|
98
|
+
|
|
99
|
+
providers: [
|
|
100
|
+
{
|
|
101
|
+
provide: STACKED_LIST_STANDARD_COMPONENT_TOKEN,
|
|
102
|
+
useValue: StackedListPresetComponent,
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> `StackedListComponent` renders injected components through `NgComponentOutlet`, which passes inputs by canonical name. For that reason `StackedListPresetComponent` declares `cssClass` as `input<string>('')` **without** the `class` alias. When you use the `<smart-stacked-list-preset>` selector directly, bind `[cssClass]`. On `<smart-stacked-list>` just pass `class` and the wrapper forwards it.
|
|
108
|
+
|
|
109
|
+
The class recipes live in `preset/preset-classes.util.ts`.
|
|
67
110
|
|
|
68
111
|
## STACKED_LIST_STANDARD_COMPONENT_TOKEN
|
|
69
112
|
|
|
@@ -208,6 +251,8 @@ export class MyCustomStackedListComponent extends StackedListBaseComponent {
|
|
|
208
251
|
|
|
209
252
|
- Wrapper: `packages/shared/angular/src/lib/components/stacked-list/stacked-list.component.ts`
|
|
210
253
|
- Standard: `packages/shared/angular/src/lib/components/stacked-list/standard/standard.component.ts`
|
|
254
|
+
- Preset: `packages/shared/angular/src/lib/components/stacked-list/preset/preset.component.ts`
|
|
255
|
+
- Preset class recipes: `packages/shared/angular/src/lib/components/stacked-list/preset/preset-classes.util.ts`
|
|
211
256
|
- Base class: `packages/shared/angular/src/lib/components/stacked-list/base/base.component.ts`
|
|
212
257
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`STACKED_LIST_STANDARD_COMPONENT_TOKEN`)
|
|
213
258
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IStackedListOptions`, `IStackedListItem`)
|
|
@@ -6,12 +6,12 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Table Component
|
|
8
8
|
|
|
9
|
-
The `<smart-table>` component renders a tabular data view with optional title, description, toolbar slot, columns + rows, optional checkbox column, custom per-cell/per-header templates, an empty state slot, and a bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TableBaseComponent` defines the shared API — optional `ITableOptions` and `cssClass` (alias `class`). `TableStandardComponent` is a barebones placeholder concrete implementation. `TableComponent` is the public wrapper that renders `TableStandardComponent` by default and accepts a custom replacement via `TABLE_STANDARD_COMPONENT_TOKEN`.
|
|
9
|
+
The `<smart-table>` component renders a tabular data view with optional title, description, toolbar slot, columns + rows, optional checkbox column, custom per-cell/per-header templates, an empty state slot, and a bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TableBaseComponent` defines the shared API — optional `ITableOptions` and `cssClass` (alias `class`). `TableStandardComponent` is a barebones placeholder concrete implementation. `TableComponent` is the public wrapper that renders `TableStandardComponent` by default and accepts a custom replacement via `TABLE_STANDARD_COMPONENT_TOKEN`. `TablePresetComponent` is the styled Tailwind variation you register on that token (see [Preset](#preset)).
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
13
13
|
- Developer wants to use or customize the table component
|
|
14
|
-
- Developer asks about `<smart-table>`, `TableComponent`, `TableStandardComponent`, or `TableBaseComponent`
|
|
14
|
+
- Developer asks about `<smart-table>`, `TableComponent`, `TableStandardComponent`, `TablePresetComponent`, or `TableBaseComponent`
|
|
15
15
|
|
|
16
16
|
## Components
|
|
17
17
|
|
|
@@ -23,6 +23,10 @@ Main wrapper component. Renders `TableStandardComponent` by default. When `TABLE
|
|
|
23
23
|
|
|
24
24
|
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, optional toolbar slot, and a `<table>` with `<thead>` (one `<th>` per column) and `<tbody>` (one `<tr>` per row, one `<td>` per column reading the value via `row[col.key]`). When `withCheckboxes` is set, an extra checkbox column is rendered before all data columns. Per-column `cellTpl` and `headerTpl` templates override the default text rendering. When `rows` is empty and `emptyTpl` is provided, the empty template is rendered as a single full-width row. A bottom `footerTpl` renders inside `<div class="footer">`. 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
25
|
|
|
26
|
+
### TablePresetComponent (`<smart-table-preset>`)
|
|
27
|
+
|
|
28
|
+
Styled drop-in replacement for `TableStandardComponent`. See [Preset](#preset).
|
|
29
|
+
|
|
26
30
|
### TableBaseComponent (abstract)
|
|
27
31
|
|
|
28
32
|
Abstract base directive for extending custom table implementations. Exposes `options` as an `InputSignal<ITableOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
@@ -66,7 +70,7 @@ interface ITableColumn {
|
|
|
66
70
|
type TableRow = Record<string, unknown>;
|
|
67
71
|
```
|
|
68
72
|
|
|
69
|
-
All properties are optional except `ITableColumn.key`. The default `TableStandardComponent` consumes every property; a section is rendered only when its template/string is provided. `striped`, `stickyHeader`, `withBorder` and `sortable` are hints
|
|
73
|
+
All properties are optional except `ITableColumn.key`. The default `TableStandardComponent` consumes every property; a section is rendered only when its template/string is provided. `striped`, `stickyHeader`, `withBorder`, `align` and `sortable` are layout hints: the standard placeholder ignores them visually (it only sets `data-align`), while `TablePresetComponent` honours every one of them (see [Preset](#preset)).
|
|
70
74
|
|
|
71
75
|
## TABLE_STANDARD_COMPONENT_TOKEN
|
|
72
76
|
|
|
@@ -85,6 +89,51 @@ providers: [
|
|
|
85
89
|
];
|
|
86
90
|
```
|
|
87
91
|
|
|
92
|
+
## Preset
|
|
93
|
+
|
|
94
|
+
`TablePresetComponent` (`<smart-table-preset>`) extends `TableBaseComponent`, so it takes the same `options` input, and it renders everything the standard component renders in the Tailwind UI table look. Every class carries the `smart:` prefix and has an explicit `smart:dark:*` twin. The class recipes live in `preset/preset-classes.util.ts`, which is not exported from the barrel.
|
|
95
|
+
|
|
96
|
+
What it styles:
|
|
97
|
+
|
|
98
|
+
- **Header** (`data-role="header"`, only rendered when there is a title, description or toolbar). The title is an `<h3>` with `text-base font-semibold text-gray-900 dark:text-white`. The description uses `text-sm text-gray-500 dark:text-gray-400`. `toolbarTpl` sits on the right of the header on `sm+` screens.
|
|
99
|
+
- **Table.** `min-w-full divide-y divide-gray-300 dark:divide-white/15`. Header cells use `text-sm font-semibold text-gray-900 dark:text-white`. Body cells use `whitespace-nowrap text-sm`: the first data column is emphasised (`font-medium text-gray-900 dark:text-white`) and the rest are muted (`text-gray-500 dark:text-gray-400`).
|
|
100
|
+
- **Checkbox column** (`withCheckboxes`). Styled checkboxes, with select-all and an indeterminate state in the header. Selected rows are highlighted with `bg-gray-50 dark:bg-gray-800/50`. Selection is internal visual state; the table has no outputs.
|
|
101
|
+
- **Slots.** `cellTpl` gets `{ $implicit: row, column }`. `headerTpl` replaces the label. `emptyTpl` renders in a centred row that spans every column (checkbox column included). `footerTpl` renders under the table.
|
|
102
|
+
- **External class.** Merged onto the root `<div>` next to `w-full`.
|
|
103
|
+
|
|
104
|
+
The options the standard component ignores, which the preset honours:
|
|
105
|
+
|
|
106
|
+
| Option | Preset rendering |
|
|
107
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| default | Rows separated by `divide-y divide-gray-200 dark:divide-white/10`, no frame, outer columns flush with the edges |
|
|
109
|
+
| `striped` | Row dividers replaced by zebra stripes, `even:bg-gray-50 dark:even:bg-gray-800/50` |
|
|
110
|
+
| `withBorder` | Rounded card (`rounded-lg bg-white shadow-sm outline-1 outline-black/5`, `dark:bg-gray-900 dark:outline-white/10`) with a `bg-gray-50 dark:bg-gray-800/75` header, outer cells padded |
|
|
111
|
+
| `stickyHeader` | Body scrolls inside `max-h-96 overflow-y-auto`; header cells are `sticky top-0 z-10 bg-white/75 backdrop-blur-sm dark:bg-gray-900/75` |
|
|
112
|
+
| `column.align` | `text-left` / `text-center` / `text-right` on both the header and the body cells |
|
|
113
|
+
| `column.sortable` | Heading becomes a button with a chevron. Click sorts the rows client-side ascending, click again for descending; `aria-sort` is set on the `<th>`. Numbers sort numerically, text in natural order, empty values last. The active column's chevron gets a `bg-gray-100 dark:bg-gray-800` chip |
|
|
114
|
+
|
|
115
|
+
The flags combine freely (for example striped + bordered + sortable + checkboxes).
|
|
116
|
+
|
|
117
|
+
Because `TableComponent` forwards inputs by canonical name through `NgComponentOutlet`, the preset declares `override cssClass = input<string>('')` (dropping the inherited `class` alias). Pass `class` on `<smart-table>` as usual, or bind `[cssClass]` when you use `<smart-table-preset>` directly.
|
|
118
|
+
|
|
119
|
+
Register it on the token to restyle every `<smart-table>`:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import {
|
|
123
|
+
TABLE_STANDARD_COMPONENT_TOKEN,
|
|
124
|
+
TablePresetComponent,
|
|
125
|
+
} from '@smartsoft001/angular';
|
|
126
|
+
|
|
127
|
+
providers: [
|
|
128
|
+
{
|
|
129
|
+
provide: TABLE_STANDARD_COMPONENT_TOKEN,
|
|
130
|
+
useValue: TablePresetComponent,
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The preset adds no new `ITableOptions` fields; it only consumes the existing API.
|
|
136
|
+
|
|
88
137
|
## Extending the Base Class
|
|
89
138
|
|
|
90
139
|
```typescript
|
|
@@ -211,6 +260,8 @@ export class MyCustomTableComponent extends TableBaseComponent {
|
|
|
211
260
|
|
|
212
261
|
- Wrapper: `packages/shared/angular/src/lib/components/table/table.component.ts`
|
|
213
262
|
- Standard: `packages/shared/angular/src/lib/components/table/standard/standard.component.ts`
|
|
263
|
+
- Preset variation: `packages/shared/angular/src/lib/components/table/preset/preset.component.ts`
|
|
264
|
+
- Preset class recipes: `packages/shared/angular/src/lib/components/table/preset/preset-classes.util.ts`
|
|
214
265
|
- Base class: `packages/shared/angular/src/lib/components/table/base/base.component.ts`
|
|
215
266
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TABLE_STANDARD_COMPONENT_TOKEN`)
|
|
216
267
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ITableOptions`, `ITableColumn`, `TableRow`)
|
|
@@ -6,12 +6,12 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Textarea Component
|
|
8
8
|
|
|
9
|
-
The `<smart-textarea>` component renders a multi-line text input with two-way `value` binding, optional placeholder, disabled state, label, action buttons, avatar/toolbar/preview/footer slots, and a structured `actionClick` output. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TextareaBaseComponent` defines the shared API — `value` (two-way `ModelSignal<string>`), `placeholder`, `disabled`, optional `ITextareaOptions`, `cssClass` (alias `class`), and the `actionClick` output. `TextareaStandardComponent` is a barebones placeholder using a native `<textarea>` element. `TextareaComponent` is the public wrapper that renders `TextareaStandardComponent` by default and accepts a custom replacement via `TEXTAREA_STANDARD_COMPONENT_TOKEN`.
|
|
9
|
+
The `<smart-textarea>` component renders a multi-line text input with two-way `value` binding, optional placeholder, disabled state, label, action buttons, avatar/toolbar/preview/footer slots, and a structured `actionClick` output. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TextareaBaseComponent` defines the shared API — `value` (two-way `ModelSignal<string>`), `placeholder`, `disabled`, optional `ITextareaOptions`, `cssClass` (alias `class`), and the `actionClick` output. `TextareaStandardComponent` is a barebones placeholder using a native `<textarea>` element. `TextareaPresetComponent` is the styled Tailwind variation that honours every option, including `variant` and `autoFocus`. `TextareaComponent` is the public wrapper that renders `TextareaStandardComponent` by default and accepts a custom replacement (such as the preset) via `TEXTAREA_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
13
13
|
- Developer wants to use or customize the textarea component
|
|
14
|
-
- Developer asks about `<smart-textarea>`, `TextareaComponent`, `TextareaStandardComponent`, or `TextareaBaseComponent`
|
|
14
|
+
- Developer asks about `<smart-textarea>`, `<smart-textarea-preset>`, `TextareaComponent`, `TextareaStandardComponent`, `TextareaPresetComponent`, or `TextareaBaseComponent`
|
|
15
15
|
|
|
16
16
|
## Components
|
|
17
17
|
|
|
@@ -23,6 +23,10 @@ Main wrapper. Delegates to `TextareaStandardComponent` by default. When `TEXTARE
|
|
|
23
23
|
|
|
24
24
|
Barebones placeholder using a native `<textarea>`. Renders an outer wrapper, an optional `<label>` (when `options.label` provided), optional avatar/toolbar slots, the `<textarea>` with `[value]` two-way bound through input event, `[disabled]`, `[rows]` (default 3), `[attr.maxlength]`, `[attr.placeholder]`, `[attr.aria-label]`, and an optional row of `<button class="action variant-{variant}">` per `options.actions` entry that emits `{ actionId, value }` via `actionClick` (suppressed when disabled). Optional `previewTpl` and `footerTpl` slots render below the actions row. The external `cssClass` is applied to the root wrapper.
|
|
25
25
|
|
|
26
|
+
### TextareaPresetComponent (`<smart-textarea-preset>`)
|
|
27
|
+
|
|
28
|
+
Styled variation that extends `TextareaBaseComponent` and is a drop-in replacement for `TextareaStandardComponent`. See [Preset](#preset).
|
|
29
|
+
|
|
26
30
|
### TextareaBaseComponent (abstract)
|
|
27
31
|
|
|
28
32
|
Abstract base directive. Exposes:
|
|
@@ -88,6 +92,62 @@ interface ITextareaAction {
|
|
|
88
92
|
}
|
|
89
93
|
```
|
|
90
94
|
|
|
95
|
+
## Preset
|
|
96
|
+
|
|
97
|
+
`TextareaPresetComponent` (selector `smart-textarea-preset`) renders the Tailwind UI comment-form look: white / `gray-900`-friendly surfaces (`bg-white`, `dark:bg-white/5`), `gray-300` / `white/10` outlines with a blue focus ring, `gray-900` / white text, `gray-400` / `gray-500` placeholders and `rounded-lg` fields. Every class is `smart:`-prefixed with an explicit `dark:` variant; the recipes live in `preset/preset-classes.util.ts`.
|
|
98
|
+
|
|
99
|
+
It renders everything the standard component renders (label, avatar, toolbar, field, actions, preview, footer) and additionally honours the options the standard ignores:
|
|
100
|
+
|
|
101
|
+
- **`variant`** picks the layout (default `'simple'`, exposed as `data-variant` on the root):
|
|
102
|
+
|
|
103
|
+
| Variant | Look |
|
|
104
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `simple` | Outlined, rounded field; toolbar (left) and actions (right) in a row below it |
|
|
106
|
+
| `with-avatar-actions` | Borderless field inside an outlined box whose focus ring follows the field; toolbar + actions inside it |
|
|
107
|
+
| `with-underline` | Borderless field on a bottom border that thickens to blue on focus; toolbar + actions below |
|
|
108
|
+
| `with-pill-actions` | Outlined box with a divided (`border-t`) bar inside; action buttons are `rounded-full` pills |
|
|
109
|
+
| `with-preview` | Write / Preview tabs above the field; the Preview tab swaps the field for `previewTpl` |
|
|
110
|
+
|
|
111
|
+
Outside `with-preview`, a `previewTpl` renders as a `gray-50` / `white/5` block below the field.
|
|
112
|
+
|
|
113
|
+
- **`autoFocus`** focuses the field after the first render (and sets the `autofocus` attribute).
|
|
114
|
+
- **`maxLength`** is applied as `maxlength` and also shows a `count/max` counter under the field.
|
|
115
|
+
- **`required`** sets `required` on the field and a red `*` in the label; the label is linked to the field with `for`/`id`.
|
|
116
|
+
- **`avatarTpl`** renders in a column to the left of the body in every variant.
|
|
117
|
+
- **Actions** are styled per `action.variant`: `primary` (solid blue), `secondary` (default: white with a `gray-300` ring, `white/10` in dark mode), `ghost` (text only, gray hover). They are disabled with the field, and clicking one emits `actionClick` with `{ actionId, value }` (never while disabled).
|
|
118
|
+
|
|
119
|
+
Register it on the token to restyle every `<smart-textarea>`:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import {
|
|
123
|
+
TEXTAREA_STANDARD_COMPONENT_TOKEN,
|
|
124
|
+
TextareaPresetComponent,
|
|
125
|
+
} from '@smartsoft001/angular';
|
|
126
|
+
|
|
127
|
+
providers: [
|
|
128
|
+
{
|
|
129
|
+
provide: TEXTAREA_STANDARD_COMPONENT_TOKEN,
|
|
130
|
+
useValue: TextareaPresetComponent,
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<smart-textarea
|
|
137
|
+
[(value)]="comment"
|
|
138
|
+
placeholder="Add your comment..."
|
|
139
|
+
[options]="{
|
|
140
|
+
variant: 'with-avatar-actions',
|
|
141
|
+
avatarTpl: avatar,
|
|
142
|
+
toolbarTpl: toolbar,
|
|
143
|
+
actions: [{ id: 'submit', label: 'Post', variant: 'primary' }],
|
|
144
|
+
}"
|
|
145
|
+
(actionClick)="onAction($event)"
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
> Because `TextareaComponent` renders injected components via `NgComponentOutlet` (which passes inputs by canonical name), `TextareaPresetComponent` overrides `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-textarea-preset>` selector directly, or just pass `class` on `<smart-textarea>` (the wrapper forwards it).
|
|
150
|
+
|
|
91
151
|
## TEXTAREA_STANDARD_COMPONENT_TOKEN
|
|
92
152
|
|
|
93
153
|
```typescript
|
|
@@ -163,6 +223,9 @@ export class MyCustomTextareaComponent extends TextareaBaseComponent {
|
|
|
163
223
|
|
|
164
224
|
- Wrapper: `packages/shared/angular/src/lib/components/textarea/textarea.component.ts`
|
|
165
225
|
- Standard: `packages/shared/angular/src/lib/components/textarea/standard/standard.component.ts`
|
|
226
|
+
- Preset variation: `packages/shared/angular/src/lib/components/textarea/preset/preset.component.ts`
|
|
227
|
+
- Preset class recipes: `packages/shared/angular/src/lib/components/textarea/preset/preset-classes.util.ts`
|
|
166
228
|
- Base class: `packages/shared/angular/src/lib/components/textarea/base/base.component.ts`
|
|
229
|
+
- Stories: `packages/shared/angular/src/lib/components/textarea/textarea.component.stories.ts`
|
|
167
230
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TEXTAREA_STANDARD_COMPONENT_TOKEN`)
|
|
168
231
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ITextareaOptions`, `ITextareaAction`, `SmartTextareaVariant`)
|