@smartsoft001/claude-plugins 2.201.0 → 2.202.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 +35 -12
- 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 +78 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +85 -78
- 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 +23 -16
- 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 +46 -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-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 +10 -10
- 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 +41 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +34 -31
- 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 +8 -8
- 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-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 +7 -7
|
@@ -17,11 +17,11 @@ The `<smart-textarea>` component renders a multi-line text input with two-way `v
|
|
|
17
17
|
|
|
18
18
|
### TextareaComponent (`<smart-textarea>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `TextareaStandardComponent` by default. When `TEXTAREA_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `actionClick
|
|
20
|
+
Main wrapper. Delegates to `TextareaStandardComponent` by default. When `TEXTAREA_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and hands it `value`, `placeholder`, `disabled`, `options` and `class`. Re-emits `actionClick` and forwards two-way `value` of whichever implementation renders (the standard, the preset or a custom one).
|
|
21
21
|
|
|
22
22
|
### TextareaStandardComponent (`<smart-textarea-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder using a native `<textarea>`. Renders an outer wrapper
|
|
24
|
+
Barebones placeholder using a native `<textarea>`. Renders an outer wrapper with `cssClass` around a `.textarea` block: an optional `<label>` (when `options.label` is set; it is not linked to the field, so give the field `options.ariaLabel` for an accessible name), optional `.avatar` and `.toolbar` slots, the `<textarea>` (`value` written back on input, `disabled`, `rows` default 3, `maxlength`, `placeholder`, `name`, `aria-label` and `required` from the options), and an optional `.actions` row with one `<button class="action variant-{variant}">` per `options.actions` entry (variant default `secondary`; `iconTpl` and `label` inside). A click emits `{ actionId, value }` through `actionClick`, never while disabled. Optional `.preview` (`previewTpl`) and `.footer` (`footerTpl`) slots render below the actions row. The standard ignores `options.variant` and `options.autoFocus` and adds no styles: the class hooks are for your CSS.
|
|
25
25
|
|
|
26
26
|
### TextareaPresetComponent (`<smart-textarea-preset>`)
|
|
27
27
|
|
|
@@ -38,8 +38,6 @@ Abstract base directive. Exposes:
|
|
|
38
38
|
- `cssClass: InputSignal<string>` (alias `class`)
|
|
39
39
|
- `actionClick: OutputEmitterRef<ITextareaActionClick>`
|
|
40
40
|
|
|
41
|
-
`ITextareaActionClick = { actionId: string; value: string }`.
|
|
42
|
-
|
|
43
41
|
## API
|
|
44
42
|
|
|
45
43
|
### Inputs
|
|
@@ -48,55 +46,57 @@ Abstract base directive. Exposes:
|
|
|
48
46
|
| ------------- | -------------------------------------------- | ------- | ------------------------------------------- |
|
|
49
47
|
| `value` | `ModelSignal<string>` | `''` | Two-way bindable textarea value |
|
|
50
48
|
| `placeholder` | `InputSignal<string>` | `''` | Placeholder text |
|
|
51
|
-
| `disabled` | `InputSignal<boolean>` | `false` |
|
|
49
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Disables the field and the action buttons |
|
|
52
50
|
| `options` | `InputSignal<ITextareaOptions \| undefined>` | - | Optional configuration |
|
|
53
51
|
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
54
52
|
|
|
55
53
|
### Outputs
|
|
56
54
|
|
|
57
|
-
| Output | Type | Description
|
|
58
|
-
| ------------- | ---------------------------------------- |
|
|
59
|
-
| `actionClick` | `OutputEmitterRef<ITextareaActionClick>` | Emitted when an action button is clicked |
|
|
55
|
+
| Output | Type | Description |
|
|
56
|
+
| ------------- | ---------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
57
|
+
| `actionClick` | `OutputEmitterRef<ITextareaActionClick>` | Emitted when an action button is clicked, with the current text; never while disabled. |
|
|
60
58
|
|
|
61
59
|
### ITextareaOptions
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
61
|
+
| Field | Type | Default | Description |
|
|
62
|
+
| ------------ | ---------------------- | ---------- | --------------------------------------------------------------------------------- |
|
|
63
|
+
| `rows` | `number` | `3` | Visible text rows. |
|
|
64
|
+
| `maxLength` | `number` | - | `maxlength` of the field; the preset also shows a `count/max` counter. |
|
|
65
|
+
| `variant` | `SmartTextareaVariant` | `'simple'` | Preset only: the layout (see the preset section). The standard ignores it. |
|
|
66
|
+
| `label` | `string` | - | Label above the field (the preset links it to the field; the standard does not). |
|
|
67
|
+
| `name` | `string` | - | `name` attribute of the field. |
|
|
68
|
+
| `required` | `boolean` | `false` | Sets `required` on the field; the preset also shows a red `*` in the label. |
|
|
69
|
+
| `autoFocus` | `boolean` | `false` | Preset only: focuses the field after the first render. The standard ignores it. |
|
|
70
|
+
| `ariaLabel` | `string` | - | `aria-label` of the field. |
|
|
71
|
+
| `actions` | `ITextareaAction[]` | `[]` | Buttons below (or, in some preset variants, inside) the field. |
|
|
72
|
+
| `avatarTpl` | `TemplateRef<unknown>` | - | Avatar slot (the preset renders it in a column left of the field). |
|
|
73
|
+
| `toolbarTpl` | `TemplateRef<unknown>` | - | Toolbar slot (e.g. attach / mention buttons). |
|
|
74
|
+
| `previewTpl` | `TemplateRef<unknown>` | - | Preview content; the preset's `with-preview` variant shows it on the Preview tab. |
|
|
75
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Footer slot below everything else. |
|
|
76
|
+
|
|
77
|
+
`SmartTextareaVariant` is `'simple' | 'with-avatar-actions' | 'with-underline' | 'with-pill-actions' | 'with-preview'`.
|
|
78
|
+
|
|
79
|
+
### ITextareaAction
|
|
80
|
+
|
|
81
|
+
| Field | Type | Default | Description |
|
|
82
|
+
| --------- | ------------------------------------- | ------------- | ------------------------------------------------------------------------------- |
|
|
83
|
+
| `id` | `string` | required | Reported as `actionId` in `actionClick`. |
|
|
84
|
+
| `label` | `string` | - | Button text (the preset uses the `id` as `aria-label` of a button without one). |
|
|
85
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Icon before the label. |
|
|
86
|
+
| `variant` | `'primary' \| 'secondary' \| 'ghost'` | `'secondary'` | Look of the button (`variant-{variant}` class in the standard). |
|
|
87
|
+
|
|
88
|
+
### ITextareaActionClick
|
|
89
|
+
|
|
90
|
+
| Field | Type | Default | Description |
|
|
91
|
+
| ---------- | -------- | -------- | ------------------------------------------- |
|
|
92
|
+
| `actionId` | `string` | required | The `id` of the clicked action. |
|
|
93
|
+
| `value` | `string` | required | The text of the field at the time of click. |
|
|
94
94
|
|
|
95
95
|
## Preset
|
|
96
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
|
|
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 class recipes are internal to the preset and not exported.
|
|
98
98
|
|
|
99
|
-
It renders everything the standard component renders (label, avatar, toolbar, field, actions, preview, footer) and additionally honours the options the standard ignores
|
|
99
|
+
It renders everything the standard component renders (label, avatar, toolbar, field, actions, preview, footer) and additionally honours the options the standard ignores.
|
|
100
100
|
|
|
101
101
|
- **`variant`** picks the layout (default `'simple'`, exposed as `data-variant` on the root):
|
|
102
102
|
|
|
@@ -116,7 +116,7 @@ It renders everything the standard component renders (label, avatar, toolbar, fi
|
|
|
116
116
|
- **`avatarTpl`** renders in a column to the left of the body in every variant.
|
|
117
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
118
|
|
|
119
|
-
Register it on
|
|
119
|
+
Register it on `TEXTAREA_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-textarea>`, or register every preset at once with `provideSmartPresets()`.
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
import {
|
|
@@ -146,10 +146,12 @@ providers: [
|
|
|
146
146
|
/>
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
>
|
|
149
|
+
> `TextareaPresetComponent` declares `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). With the preset registered through the token, `[(value)]` and `(actionClick)` on `<smart-textarea>` work as with the standard.
|
|
150
150
|
|
|
151
151
|
## TEXTAREA_STANDARD_COMPONENT_TOKEN
|
|
152
152
|
|
|
153
|
+
Provide a component class extending `TextareaBaseComponent` under `TEXTAREA_STANDARD_COMPONENT_TOKEN`; every `<smart-textarea>` below that injector renders it.
|
|
154
|
+
|
|
153
155
|
```typescript
|
|
154
156
|
import { TEXTAREA_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
155
157
|
|
|
@@ -167,7 +169,6 @@ providers: [
|
|
|
167
169
|
import {
|
|
168
170
|
ChangeDetectionStrategy,
|
|
169
171
|
Component,
|
|
170
|
-
input,
|
|
171
172
|
ViewEncapsulation,
|
|
172
173
|
} from '@angular/core';
|
|
173
174
|
|
|
@@ -187,8 +188,9 @@ import { TextareaBaseComponent } from '@smartsoft001/angular';
|
|
|
187
188
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
188
189
|
})
|
|
189
190
|
export class MyCustomTextareaComponent extends TextareaBaseComponent {
|
|
190
|
-
//
|
|
191
|
-
|
|
191
|
+
// `value` (a model the wrapper binds two-way), `placeholder()`, `disabled()`,
|
|
192
|
+
// `options()`, `cssClass()` and `actionClick` (re-emitted by the wrapper)
|
|
193
|
+
// are inherited.
|
|
192
194
|
}
|
|
193
195
|
```
|
|
194
196
|
|
|
@@ -17,21 +17,21 @@ The `<smart-toggle>` component provides a boolean on/off control. It follows the
|
|
|
17
17
|
|
|
18
18
|
### ToggleComponent (`<smart-toggle>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `ToggleStandardComponent` by default. When `TOGGLE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `ToggleStandardComponent` by default. When `TOGGLE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, hands it `value`, `disabled`, `options` and `class`, and forwards two-way `value` of whichever implementation renders (the standard, the preset or a custom one).
|
|
21
21
|
|
|
22
22
|
### ToggleStandardComponent (`<smart-toggle-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones native-HTML implementation. Renders a `<span class="smart-toggle" data-label-position="…">` containing a minimal `<input type="checkbox">` bound to `value` and `disabled`, with the external `cssClass` applied to the input element. `options.label` renders in a `<label class="smart-toggle-label" for="…">` associated with the checkbox (so it is the accessible name), and `options.description` in a `<span class="smart-toggle-description">` referenced by the checkbox's `aria-describedby`. Both live in a `<span class="smart-toggle-text" data-role="text">` placed after the checkbox, or before it when `options.labelPosition === 'left'` (default `'right'`). `options.ariaLabel` is applied as the checkbox's `aria-label` only when there is no `label`. It
|
|
24
|
+
Barebones native-HTML implementation. Renders a `<span class="smart-toggle" data-label-position="…">` containing a minimal `<input type="checkbox">` bound to `value` and `disabled`, with the external `cssClass` applied to the input element. `options.label` renders in a `<label class="smart-toggle-label" for="…">` associated with the checkbox (so it is the accessible name), and `options.description` in a `<span class="smart-toggle-description">` referenced by the checkbox's `aria-describedby`. Both live in a `<span class="smart-toggle-text" data-role="text">` placed after the checkbox, or before it when `options.labelPosition === 'left'` (default `'right'`). `options.ariaLabel` is applied as the checkbox's `aria-label` only when there is no `label`. It adds no styles.
|
|
25
25
|
|
|
26
26
|
### TogglePresetComponent (`<smart-toggle-preset>`)
|
|
27
27
|
|
|
28
|
-
Styled variation that extends `ToggleBaseComponent` and is a drop-in replacement for `ToggleStandardComponent`. Register it via `TOGGLE_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-toggle>`, or use the `<smart-toggle-preset>` selector directly. It renders the Preline **default switch**: a hidden
|
|
28
|
+
Styled variation that extends `ToggleBaseComponent` and is a drop-in replacement for `ToggleStandardComponent`. Register it via `TOGGLE_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-toggle>`, or use the `<smart-toggle-preset>` selector directly. It renders the Preline **default switch**: a visually hidden `<input type="checkbox">` (with `peer sr-only`) drives the track / thumb visuals through `peer-checked` / `peer-disabled` states, while the `value` model holds the checked state (updated via the checkbox `change` event). Like the standard, `options.label` is a `<label for>` of the checkbox (its accessible name), `options.description` is referenced by the checkbox's `aria-describedby`, both sit beside the switch on the side given by `options.labelPosition` (default `'right'`), and `options.ariaLabel` names the checkbox only when there is no `label`. The external `cssClass` goes on the root `<div>`. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
|
|
29
29
|
|
|
30
|
-
>
|
|
30
|
+
> `TogglePresetComponent` declares `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-toggle-preset>` selector directly, or just pass `class` on `<smart-toggle>` (the wrapper forwards it). With the preset registered through the token, `[(value)]` on `<smart-toggle>` works as with the standard. The Preline doc's size, soft-color, rounded, icon, tooltip and validation-state variants are **not** exposed, because `IToggleOptions` has no size/variant/color fields; the preset renders the default medium pill switch in the primary (blue) color.
|
|
31
31
|
|
|
32
32
|
### ToggleBaseComponent (abstract)
|
|
33
33
|
|
|
34
|
-
Abstract base directive for extending custom toggle implementations. Exposes `value` as a two-way `ModelSignal<boolean>` (default `false`), `disabled` as an `InputSignal<boolean>` (default `false`), `options` as an `InputSignal<IToggleOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), and a `toggle()` method that
|
|
34
|
+
Abstract base directive for extending custom toggle implementations. Exposes `value` as a two-way `ModelSignal<boolean>` (default `false`), `disabled` as an `InputSignal<boolean>` (default `false`), `options` as an `InputSignal<IToggleOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), and a `toggle()` method that flips `value` unless `disabled()` is `true`.
|
|
35
35
|
|
|
36
36
|
## API
|
|
37
37
|
|
|
@@ -46,6 +46,15 @@ Abstract base directive for extending custom toggle implementations. Exposes `va
|
|
|
46
46
|
|
|
47
47
|
### IToggleOptions
|
|
48
48
|
|
|
49
|
+
| Field | Type | Default | Description |
|
|
50
|
+
| --------------- | ------------------- | --------- | --------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `label` | `string` | - | Visible label, a `<label for>` of the checkbox, so it is the accessible name. |
|
|
52
|
+
| `description` | `string` | - | Help text under the label, referenced by the checkbox's `aria-describedby`. |
|
|
53
|
+
| `labelPosition` | `'left' \| 'right'` | `'right'` | `'left'` puts the label and description before the switch, otherwise they go after it. |
|
|
54
|
+
| `ariaLabel` | `string` | - | `aria-label` of the checkbox, applied only when there is no `label`; set it for label-less toggles. |
|
|
55
|
+
|
|
56
|
+
Both `ToggleStandardComponent` and `TogglePresetComponent` honour every field.
|
|
57
|
+
|
|
49
58
|
```typescript
|
|
50
59
|
interface IToggleOptions {
|
|
51
60
|
label?: string;
|
|
@@ -55,18 +64,13 @@ interface IToggleOptions {
|
|
|
55
64
|
}
|
|
56
65
|
```
|
|
57
66
|
|
|
58
|
-
Both `ToggleStandardComponent` and `TogglePresetComponent` honour every property: `label` (the checkbox's accessible name — a `<label for>` in the standard), `description` (referenced by `aria-describedby` in the standard), `labelPosition` (`'left'` puts the text before the switch, otherwise it goes after — default `'right'`) and `ariaLabel` (the standard uses it only when there is no visible `label`; set it for label-less toggles).
|
|
59
|
-
|
|
60
67
|
## TOGGLE_STANDARD_COMPONENT_TOKEN
|
|
61
68
|
|
|
69
|
+
InjectionToken that replaces the default `ToggleStandardComponent` with a custom implementation. Provide a component class extending `ToggleBaseComponent`; every `<smart-toggle>` below that injector renders it.
|
|
70
|
+
|
|
62
71
|
```typescript
|
|
63
72
|
import { TOGGLE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
64
|
-
```
|
|
65
73
|
|
|
66
|
-
InjectionToken that allows replacing the default `ToggleStandardComponent` with a custom implementation. Provide a `Type<ToggleBaseComponent>` to override.
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
// In your app module or component providers:
|
|
70
74
|
providers: [
|
|
71
75
|
{
|
|
72
76
|
provide: TOGGLE_STANDARD_COMPONENT_TOKEN,
|
|
@@ -82,7 +86,6 @@ import {
|
|
|
82
86
|
ChangeDetectionStrategy,
|
|
83
87
|
Component,
|
|
84
88
|
computed,
|
|
85
|
-
input,
|
|
86
89
|
ViewEncapsulation,
|
|
87
90
|
} from '@angular/core';
|
|
88
91
|
|
|
@@ -114,27 +117,17 @@ import { ToggleBaseComponent } from '@smartsoft001/angular';
|
|
|
114
117
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
115
118
|
})
|
|
116
119
|
export class MyCustomToggleComponent extends ToggleBaseComponent {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
containerClasses = computed(() => {
|
|
121
|
-
const classes = ['my-toggle-container'];
|
|
122
|
-
const extra = this.cssClass();
|
|
123
|
-
if (extra) classes.push(extra);
|
|
124
|
-
return classes.join(' ');
|
|
125
|
-
});
|
|
120
|
+
containerClasses = computed(() =>
|
|
121
|
+
['my-toggle-container', this.cssClass()].filter(Boolean).join(' '),
|
|
122
|
+
);
|
|
126
123
|
|
|
127
124
|
onChange(event: Event): void {
|
|
128
|
-
|
|
129
|
-
this.value.set(checked);
|
|
125
|
+
this.value.set((event.target as HTMLInputElement).checked);
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
```
|
|
133
129
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `TOGGLE_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
137
|
-
- use `this.toggle()` for click-based handlers (it already respects `disabled`), or call `this.value.set(checked)` directly in a `change` event handler.
|
|
130
|
+
`value` (a model the wrapper binds two-way), `disabled()`, `options()`, `cssClass()` and `toggle()` are inherited. Use `this.toggle()` in a click handler (it already respects `disabled`), or call `this.value.set(checked)` in a `change` handler.
|
|
138
131
|
|
|
139
132
|
## Usage Examples
|
|
140
133
|
|
|
@@ -17,15 +17,17 @@ The `<smart-vertical-navigation>` component renders a sidebar navigation with on
|
|
|
17
17
|
|
|
18
18
|
### VerticalNavigationComponent (`<smart-vertical-navigation>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `VerticalNavigationStandardComponent` by default. When `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `itemClick
|
|
20
|
+
Main wrapper. Delegates to `VerticalNavigationStandardComponent` by default. When `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and hands it `options` and `class`. Re-emits `itemClick` of whichever implementation renders (the standard, the preset or a custom one).
|
|
21
21
|
|
|
22
22
|
### VerticalNavigationStandardComponent (`<smart-vertical-navigation-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul>`
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul class="groups">` with one `<li class="group">` per group. Each group renders an optional `<div class="group-title">` and a `<ul class="items">`; each item renders as `<a class="item-link">` (when `href` is provided; a click follows the link) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get the `current` class and `aria-current="page"` when `item.current === true`. Inside an item: `iconTpl` (or, without it, `initial`), `label` and `badge`. The standard does not read `options.layout` and adds no styles: the class hooks are for your CSS.
|
|
25
25
|
|
|
26
26
|
### VerticalNavigationPresetComponent (`<smart-vertical-navigation-preset>`)
|
|
27
27
|
|
|
28
|
-
Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Renders the Preline vertical-tabs look:
|
|
28
|
+
Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Register it through `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-vertical-navigation>`, or use the `<smart-vertical-navigation-preset>` selector directly. Renders the Preline vertical-tabs look: each group is its own `<nav>` (all with the `aria-label` from `options.ariaLabel`, default `"Sidebar"`), preceded by its title when set, with a trailing border (`border-e-2`); each item is a tab (`<a>` for `href`, `<button>` emitting `itemClick` otherwise) with its own trailing border. The `current` item gains the primary accent (`border-blue-600`, `text-blue-600`, `font-medium`) and `aria-current="page"`; inactive items are muted gray with a primary hover/focus. Supports `iconTpl`, `initial`, `label` and `badge`. It does not read `options.layout` either. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
|
|
29
|
+
|
|
30
|
+
> `VerticalNavigationPresetComponent` declares `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-vertical-navigation-preset>` selector directly, or just pass `class` on `<smart-vertical-navigation>` (the wrapper forwards it). With the preset registered through the token, `(itemClick)` on `<smart-vertical-navigation>` works as with the standard.
|
|
29
31
|
|
|
30
32
|
### VerticalNavigationBaseComponent (abstract)
|
|
31
33
|
|
|
@@ -34,9 +36,7 @@ Abstract base directive. Exposes:
|
|
|
34
36
|
- `options: InputSignal<IVerticalNavOptions | undefined>`
|
|
35
37
|
- `cssClass: InputSignal<string>` (alias `class`)
|
|
36
38
|
- `itemClick: OutputEmitterRef<IVerticalNavItemClick>`
|
|
37
|
-
- protected `resolvedGroups: Signal<IVerticalNavGroup[]
|
|
38
|
-
|
|
39
|
-
`IVerticalNavItemClick = { itemId: string }`.
|
|
39
|
+
- protected `resolvedGroups: Signal<IVerticalNavGroup[]>`: `options.items` as a first, untitled group, followed by `options.groups`
|
|
40
40
|
|
|
41
41
|
## API
|
|
42
42
|
|
|
@@ -49,23 +49,50 @@ Abstract base directive. Exposes:
|
|
|
49
49
|
|
|
50
50
|
### Outputs
|
|
51
51
|
|
|
52
|
-
| Output | Type | Description
|
|
53
|
-
| ----------- | ----------------------------------------- |
|
|
54
|
-
| `itemClick` | `OutputEmitterRef<IVerticalNavItemClick>` | Emitted when a button
|
|
52
|
+
| Output | Type | Description |
|
|
53
|
+
| ----------- | ----------------------------------------- | ---------------------------------------------------------- |
|
|
54
|
+
| `itemClick` | `OutputEmitterRef<IVerticalNavItemClick>` | Emitted when an item without `href` (a button) is clicked. |
|
|
55
55
|
|
|
56
56
|
### IVerticalNavOptions
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
| Field | Type | Default | Description |
|
|
59
|
+
| ----------- | ------------------------ | ----------- | ----------------------------------------------------------------------------------------------------- |
|
|
60
|
+
| `items` | `IVerticalNavItem[]` | `[]` | Items of a first, untitled group. |
|
|
61
|
+
| `groups` | `IVerticalNavGroup[]` | `[]` | Further groups, rendered after `items`. |
|
|
62
|
+
| `ariaLabel` | `string` | `'Sidebar'` | Accessible name of the navigation (in the preset, of every group's `<nav>`). |
|
|
63
|
+
| `layout` | `SmartVerticalNavLayout` | - | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
|
|
64
|
+
|
|
65
|
+
`SmartVerticalNavLayout` is `'simple' | 'with-badges' | 'with-icons' | 'with-icons-and-badges' | 'with-secondary-navigation' | 'on-gray'`.
|
|
66
|
+
|
|
67
|
+
### IVerticalNavGroup
|
|
68
|
+
|
|
69
|
+
| Field | Type | Default | Description |
|
|
70
|
+
| ------- | -------------------- | -------- | ---------------------------------------------- |
|
|
71
|
+
| `id` | `string` | - | Track key of the group (the index without it). |
|
|
72
|
+
| `title` | `string` | - | Heading above the group's items. |
|
|
73
|
+
| `items` | `IVerticalNavItem[]` | required | The group's items. |
|
|
74
|
+
|
|
75
|
+
### IVerticalNavItem
|
|
66
76
|
|
|
77
|
+
| Field | Type | Default | Description |
|
|
78
|
+
| --------- | ---------------------- | -------- | --------------------------------------------------------------------------------- |
|
|
79
|
+
| `id` | `string` | required | Reported as `itemId` in `itemClick`. |
|
|
80
|
+
| `label` | `string` | - | Item text. |
|
|
81
|
+
| `href` | `string` | - | Renders the item as a link; without it the item is a button emitting `itemClick`. |
|
|
82
|
+
| `current` | `boolean` | `false` | Marks the item as the current page (`aria-current="page"`). |
|
|
83
|
+
| `badge` | `string \| number` | - | A count or text badge after the label. |
|
|
84
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Icon before the label. |
|
|
85
|
+
| `initial` | `string` | - | A letter shown before the label when there is no `iconTpl` (project lists). |
|
|
86
|
+
|
|
87
|
+
### IVerticalNavItemClick
|
|
88
|
+
|
|
89
|
+
| Field | Type | Default | Description |
|
|
90
|
+
| -------- | -------- | -------- | ----------------------------- |
|
|
91
|
+
| `itemId` | `string` | required | The `id` of the clicked item. |
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
67
94
|
interface IVerticalNavOptions {
|
|
68
|
-
layout?: SmartVerticalNavLayout;
|
|
95
|
+
layout?: SmartVerticalNavLayout; // not read by the built-in implementations
|
|
69
96
|
ariaLabel?: string;
|
|
70
97
|
items?: IVerticalNavItem[];
|
|
71
98
|
groups?: IVerticalNavGroup[];
|
|
@@ -88,10 +115,10 @@ interface IVerticalNavItem {
|
|
|
88
115
|
}
|
|
89
116
|
```
|
|
90
117
|
|
|
91
|
-
When both `items` and `groups` are provided, `items` is rendered first as a leading single-group section.
|
|
92
|
-
|
|
93
118
|
## VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN
|
|
94
119
|
|
|
120
|
+
Provide a component class extending `VerticalNavigationBaseComponent` under `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN`; every `<smart-vertical-navigation>` below that injector renders it.
|
|
121
|
+
|
|
95
122
|
```typescript
|
|
96
123
|
import { VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
97
124
|
|
|
@@ -109,7 +136,7 @@ providers: [
|
|
|
109
136
|
import {
|
|
110
137
|
ChangeDetectionStrategy,
|
|
111
138
|
Component,
|
|
112
|
-
|
|
139
|
+
computed,
|
|
113
140
|
ViewEncapsulation,
|
|
114
141
|
} from '@angular/core';
|
|
115
142
|
|
|
@@ -117,13 +144,27 @@ import { VerticalNavigationBaseComponent } from '@smartsoft001/angular';
|
|
|
117
144
|
|
|
118
145
|
@Component({
|
|
119
146
|
selector: 'my-custom-vertical-navigation',
|
|
120
|
-
template:
|
|
147
|
+
template: `
|
|
148
|
+
<nav
|
|
149
|
+
[class]="cssClass()"
|
|
150
|
+
[attr.aria-label]="options()?.ariaLabel ?? 'Sidebar'"
|
|
151
|
+
>
|
|
152
|
+
@for (group of groups(); track group.id ?? $index) {
|
|
153
|
+
@for (item of group.items; track item.id) {
|
|
154
|
+
<button type="button" (click)="itemClick.emit({ itemId: item.id })">
|
|
155
|
+
{{ item.label }}
|
|
156
|
+
</button>
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</nav>
|
|
160
|
+
`,
|
|
121
161
|
encapsulation: ViewEncapsulation.None,
|
|
122
162
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
123
163
|
})
|
|
124
164
|
export class MyCustomVerticalNavigationComponent extends VerticalNavigationBaseComponent {
|
|
125
|
-
//
|
|
126
|
-
|
|
165
|
+
// `options()`, `cssClass()`, `itemClick` (re-emitted by the wrapper) and the
|
|
166
|
+
// protected `resolvedGroups` are inherited.
|
|
167
|
+
protected groups = computed(() => this.resolvedGroups());
|
|
127
168
|
}
|
|
128
169
|
```
|
|
129
170
|
|
|
@@ -158,6 +199,7 @@ export class MyCustomVerticalNavigationComponent extends VerticalNavigationBaseC
|
|
|
158
199
|
- Wrapper: `packages/shared/angular/src/lib/components/vertical-navigation/vertical-navigation.component.ts`
|
|
159
200
|
- Standard: `packages/shared/angular/src/lib/components/vertical-navigation/standard/standard.component.ts`
|
|
160
201
|
- Preset: `packages/shared/angular/src/lib/components/vertical-navigation/preset/preset.component.ts`
|
|
202
|
+
- Stories: `packages/shared/angular/src/lib/components/vertical-navigation/vertical-navigation.component.stories.ts`
|
|
161
203
|
- Base class: `packages/shared/angular/src/lib/components/vertical-navigation/base/base.component.ts`
|
|
162
204
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN`)
|
|
163
205
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IVerticalNavOptions`, `IVerticalNavGroup`, `IVerticalNavItem`, `SmartVerticalNavLayout`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-core",
|
|
3
3
|
"description": "Smartsoft core for every project - safety validation, audit logging and auto-formatting hooks, plus the framework-neutral skills (audit-log, format-code, project-conventions, safety-check)",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.201.0"
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-react",
|
|
3
3
|
"description": "Smartsoft for React projects - the @smartsoft001/react component, provider and forms skills, their react-components agent, and the React CRUD skill (@smartsoft001/crud-shell-react)",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.201.0",
|
|
5
5
|
"dependencies": ["smart-core"]
|
|
6
6
|
}
|
|
@@ -31,11 +31,11 @@ The preset's class helpers (`getActionPanelCardClasses`, `getActionPanelTitleCla
|
|
|
31
31
|
|
|
32
32
|
### `SmartActionPanelProps`
|
|
33
33
|
|
|
34
|
-
| Prop | Type | Default | Description
|
|
35
|
-
| ---------------- | ------------------------------------------ | ------- |
|
|
36
|
-
| `options?` | `IActionPanelOptions` | — | The panel's content and layout.
|
|
37
|
-
| `className?` | `string` | — | Classes
|
|
38
|
-
| `onActionClick?` | `(event: IActionPanelActionClick) => void` | — | Called when an action without `href` is clicked.
|
|
34
|
+
| Prop | Type | Default | Description |
|
|
35
|
+
| ---------------- | ------------------------------------------ | ------- | --------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `options?` | `IActionPanelOptions` | — | The panel's content and layout. |
|
|
37
|
+
| `className?` | `string` | — | Classes on the root element: the `div` around `section.action-panel` (standard), the card (preset). |
|
|
38
|
+
| `onActionClick?` | `(event: IActionPanelActionClick) => void` | — | Called when an action without `href` is clicked. |
|
|
39
39
|
|
|
40
40
|
### `IActionPanelOptions`
|
|
41
41
|
|
|
@@ -58,13 +58,13 @@ Passed to `onActionClick` when a button action is clicked.
|
|
|
58
58
|
|
|
59
59
|
### `IActionPanelAction`
|
|
60
60
|
|
|
61
|
-
| Field | Type | Default | Description
|
|
62
|
-
| ---------- | ----------------------------------------------- | -------- |
|
|
63
|
-
| `id` | `string` | required | Reported as `actionId` by `onActionClick`.
|
|
64
|
-
| `label?` | `string` | — | Text of the button / link.
|
|
65
|
-
| `href?` | `string` | — | Renders the action as a link instead of a button (no `onActionClick`).
|
|
66
|
-
| `variant?` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | — | Look of the action
|
|
67
|
-
| `iconTpl?` | `ReactNode` | — | Icon rendered with the label.
|
|
61
|
+
| Field | Type | Default | Description |
|
|
62
|
+
| ---------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `id` | `string` | required | Reported as `actionId` by `onActionClick`. |
|
|
64
|
+
| `label?` | `string` | — | Text of the button / link. |
|
|
65
|
+
| `href?` | `string` | — | Renders the action as a link instead of a button (no `onActionClick`). |
|
|
66
|
+
| `variant?` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | — | 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. |
|
|
67
|
+
| `iconTpl?` | `ReactNode` | — | Icon rendered with the label. |
|
|
68
68
|
|
|
69
69
|
### Related types
|
|
70
70
|
|
|
@@ -138,7 +138,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
`SmartActionPanelPreset` is the styled (preset) implementation: register it
|
|
141
|
+
`SmartActionPanelPreset` is the styled (preset) implementation: register it under the `'action-panel'` key of `SmartProvider`'s `components`, render it directly in place of `SmartActionPanel`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
142
142
|
|
|
143
143
|
A custom implementation takes `SmartActionPanelProps` and calls `onActionClick` for its buttons:
|
|
144
144
|
|
|
@@ -145,7 +145,7 @@ export function PublishConfirm({ onPublish }: { onPublish: () => void }) {
|
|
|
145
145
|
|
|
146
146
|
`SmartAlert` renders the component registered under the `'alert'` key of `SmartProvider`'s `components`, and `SmartAlertStandard` when nothing is registered there. Every `SmartAlert` below the provider then renders the registered component, which receives the same props.
|
|
147
147
|
|
|
148
|
-
There is no preset for this component: register a component of your own that takes `SmartAlertProps
|
|
148
|
+
There is no preset for this component: register a component of your own that takes `SmartAlertProps` as `components={{ alert: MyAlert }}` (the example at the end of this section is one). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
149
149
|
|
|
150
150
|
### The `useAlert` hook
|
|
151
151
|
|
|
@@ -226,7 +226,7 @@ export function BrandAlert(props: SmartAlertProps) {
|
|
|
226
226
|
}
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
Registered
|
|
229
|
+
Registered under the `alert` key, it renders both the `SmartAlert`s placed by hand and the dialogs of `AlertService.show`.
|
|
230
230
|
|
|
231
231
|
## Styling
|
|
232
232
|
|
|
@@ -32,16 +32,16 @@ The preset's class helpers (`getAvatarImageClasses`, `getAvatarInitialsClasses`,
|
|
|
32
32
|
|
|
33
33
|
### `SmartAvatarProps`
|
|
34
34
|
|
|
35
|
-
| Prop | Type | Default | Description
|
|
36
|
-
| ----------------------- | ------------------- | ---------- |
|
|
37
|
-
| `imageUrl?` | `string` | — | Picture URL; when missing, the initials or the placeholder are shown.
|
|
38
|
-
| `initials?` | `string` | — | Initials shown when there is no image.
|
|
39
|
-
| `size?` | `SmartAvatarSize` | `'md'` | The size scale (`xs` to `xl`).
|
|
40
|
-
| `shape?` | `SmartAvatarShape` | `'circle'` | `circle` or `rounded` (rounded square).
|
|
41
|
-
| `notificationPosition?` | `'top' \| 'bottom'` | — |
|
|
42
|
-
| `group?` | `IAvatarItem[]` | — | Renders a stacked group instead of one avatar when non-empty.
|
|
43
|
-
| `options?` | `IAvatarOptions` | — | Placeholder type and stack direction.
|
|
44
|
-
| `className?` | `string` | — | Classes on the outermost element (group container, status wrapper or the avatar).
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ----------------------- | ------------------- | ---------- | -------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `imageUrl?` | `string` | — | Picture URL; when missing, the initials or the placeholder are shown. |
|
|
38
|
+
| `initials?` | `string` | — | Initials shown when there is no image. |
|
|
39
|
+
| `size?` | `SmartAvatarSize` | `'md'` | The size scale (`xs` to `xl`). Styled by the preset; `data-size` on the standard. |
|
|
40
|
+
| `shape?` | `SmartAvatarShape` | `'circle'` | `circle` or `rounded` (rounded square). Styled by the preset; `data-shape` on the standard. |
|
|
41
|
+
| `notificationPosition?` | `'top' \| 'bottom'` | — | Preset only: corner of the status dot of a single avatar; no dot when unset. `SmartAvatarStandard` ignores it. |
|
|
42
|
+
| `group?` | `IAvatarItem[]` | — | Renders a stacked group instead of one avatar when non-empty. |
|
|
43
|
+
| `options?` | `IAvatarOptions` | — | Placeholder type and stack direction. |
|
|
44
|
+
| `className?` | `string` | — | Classes on the outermost element (group container, status wrapper or the avatar). |
|
|
45
45
|
|
|
46
46
|
### `IAvatarOptions`
|
|
47
47
|
|
|
@@ -116,7 +116,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
116
116
|
}
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
`SmartAvatarPreset` is the styled (preset) implementation: register it
|
|
119
|
+
`SmartAvatarPreset` is the styled (preset) implementation: register it under the `'avatar'` key of `SmartProvider`'s `components`, render it directly in place of `SmartAvatar`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
120
120
|
|
|
121
121
|
### The `useAvatar` hook
|
|
122
122
|
|
|
@@ -25,7 +25,7 @@ All from `@smartsoft001/react`.
|
|
|
25
25
|
| `SmartBadgeStandard` | component | The default badge rendering: unstyled markup exposing `color`, `size`, `options.variant` and `options.pill` as `data-*` attributes for the application's own CSS. |
|
|
26
26
|
| `useBadge` | hook | The behaviour every badge variant shares: `remove()` reports the click on the remove button through `onRemoved`. |
|
|
27
27
|
|
|
28
|
-
The preset's class helpers (`getBadgeClasses`, `getDotClasses`, `getRemoveClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
28
|
+
The preset's class helpers (`getBadgeClasses`, `getDotClasses`, `getRemoveClasses`) and their `SmartBadgePresetVariant` type (`'solid' | 'soft' | 'outline'`) are exported too, for a custom implementation that wants the preset look.
|
|
29
29
|
|
|
30
30
|
## Props and Types
|
|
31
31
|
|
|
@@ -109,7 +109,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
109
109
|
}
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
`SmartBadgePreset` is the styled (preset) implementation: register it
|
|
112
|
+
`SmartBadgePreset` is the styled (preset) implementation: register it under the `'badge'` key of `SmartProvider`'s `components`, render it directly in place of `SmartBadge`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
113
113
|
|
|
114
114
|
### The `useBadge` hook
|
|
115
115
|
|