@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
|
@@ -18,7 +18,7 @@ The `<smart-avatar>` component renders a user/entity avatar in either single or
|
|
|
18
18
|
|
|
19
19
|
### AvatarComponent (`<smart-avatar>`)
|
|
20
20
|
|
|
21
|
-
Main wrapper component. Renders `AvatarStandardComponent` by default. When `AVATAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
21
|
+
Main wrapper component. Renders `AvatarStandardComponent` by default. When `AVATAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and passes it every input, `class` included.
|
|
22
22
|
|
|
23
23
|
### AvatarStandardComponent (`<smart-avatar-standard>`)
|
|
24
24
|
|
|
@@ -31,9 +31,9 @@ It does not include Tailwind UI styling — it exists solely as the default stru
|
|
|
31
31
|
|
|
32
32
|
### AvatarPresetComponent (`<smart-avatar-preset>`)
|
|
33
33
|
|
|
34
|
-
Styled variation that extends `AvatarBaseComponent` and is a drop-in replacement for `AvatarStandardComponent`. Register it via `AVATAR_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-avatar>`, or use the `<smart-avatar-preset>` selector directly. It renders three content modes — an `<img>` (when `imageUrl` is set), an initials chip (when `initials` is set or `options.placeholderType === 'initials'`), or an SVG icon placeholder (the default) — across the full `SmartAvatarSize` scale (`xs`→`size-8`, `sm`→`size-9.5`, `md`→`size-11`, `lg`→`size-15.5`, `xl`→`size-20`) in both `circle` (`rounded-full`) and `rounded` (`rounded-lg`) shapes. When `notificationPosition` (`top`/`bottom`) is set the avatar is wrapped in a `relative` container with a corner status dot; when `group()` is non-empty it renders an overlapping stacked group (negative `-space-x-2`, ringed members), reversed when `options.stackDirection === 'bottom-to-top'`. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants
|
|
34
|
+
Styled variation that extends `AvatarBaseComponent` and is a drop-in replacement for `AvatarStandardComponent`. Register it via `AVATAR_STANDARD_COMPONENT_TOKEN` (`{ provide: AVATAR_STANDARD_COMPONENT_TOKEN, useValue: AvatarPresetComponent }`) to restyle every `<smart-avatar>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-avatar-preset>` selector directly. It renders three content modes — an `<img>` (when `imageUrl` is set), an initials chip (when `initials` is set or `options.placeholderType === 'initials'`), or an SVG icon placeholder (the default) — across the full `SmartAvatarSize` scale (`xs`→`size-8`, `sm`→`size-9.5`, `md`→`size-11`, `lg`→`size-15.5`, `xl`→`size-20`) in both `circle` (`rounded-full`) and `rounded` (`rounded-lg`) shapes. When `notificationPosition` (`top`/`bottom`) is set the avatar is wrapped in a `relative` container with a corner status dot; when `group()` is non-empty it renders an overlapping stacked group (negative `-space-x-2`, ringed members), reversed when `options.stackDirection === 'bottom-to-top'`. In group mode the status dot is not rendered. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset (not exported).
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Used directly, `<smart-avatar-preset>` takes the extra classes as `class` or `[cssClass]`; on `<smart-avatar>` pass `class` and the wrapper forwards it.
|
|
37
37
|
|
|
38
38
|
### AvatarBaseComponent (abstract)
|
|
39
39
|
|
|
@@ -53,19 +53,27 @@ Abstract base directive for extending custom avatar implementations. Static `sma
|
|
|
53
53
|
|
|
54
54
|
### Inputs
|
|
55
55
|
|
|
56
|
-
| Input | Type | Default | Description
|
|
57
|
-
| ---------------------- | --------------------------------------------- | ---------- |
|
|
58
|
-
| `imageUrl` | `InputSignal<string \| undefined>` | - | URL of the avatar image (single mode)
|
|
59
|
-
| `initials` | `InputSignal<string \| undefined>` | - | Initials shown when no `imageUrl` is provided (single mode)
|
|
60
|
-
| `size` | `InputSignal<SmartAvatarSize>` | `'md'` | Avatar size: `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'`
|
|
61
|
-
| `shape` | `InputSignal<SmartAvatarShape>` | `'circle'` | Avatar shape: `'circle' \| 'rounded'`
|
|
62
|
-
| `notificationPosition` | `InputSignal<'top' \| 'bottom' \| undefined>` | - |
|
|
63
|
-
| `group` | `InputSignal<IAvatarItem[] \| undefined>` | - | When set, renders a group of avatars instead of a single one
|
|
64
|
-
| `options` | `InputSignal<IAvatarOptions \| undefined>` | - | Optional configuration (placeholder type, stack direction)
|
|
65
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
56
|
+
| Input | Type | Default | Description |
|
|
57
|
+
| ---------------------- | --------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `imageUrl` | `InputSignal<string \| undefined>` | - | URL of the avatar image (single mode) |
|
|
59
|
+
| `initials` | `InputSignal<string \| undefined>` | - | Initials shown when no `imageUrl` is provided (single mode) |
|
|
60
|
+
| `size` | `InputSignal<SmartAvatarSize>` | `'md'` | Avatar size: `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'`. Styled by the preset; the standard exposes it as `data-size` |
|
|
61
|
+
| `shape` | `InputSignal<SmartAvatarShape>` | `'circle'` | Avatar shape: `'circle' \| 'rounded'`. Styled by the preset; the standard exposes it as `data-shape` |
|
|
62
|
+
| `notificationPosition` | `InputSignal<'top' \| 'bottom' \| undefined>` | - | Preset only: the corner of the status dot (single mode). The standard does not render it |
|
|
63
|
+
| `group` | `InputSignal<IAvatarItem[] \| undefined>` | - | When set, renders a group of avatars instead of a single one |
|
|
64
|
+
| `options` | `InputSignal<IAvatarOptions \| undefined>` | - | Optional configuration (placeholder type, stack direction) |
|
|
65
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
66
66
|
|
|
67
67
|
### IAvatarItem
|
|
68
68
|
|
|
69
|
+
One avatar of a `group`. Each item must have a unique `id` (used as the `@for` track key). When `imageUrl` is present the item renders as an `<img>`; otherwise as `initials`.
|
|
70
|
+
|
|
71
|
+
| Field | Type | Default | Description |
|
|
72
|
+
| ---------- | -------- | ----------- | ---------------------------------- |
|
|
73
|
+
| `id` | `string` | required | Key of the item. |
|
|
74
|
+
| `imageUrl` | `string` | `undefined` | Picture URL. |
|
|
75
|
+
| `initials` | `string` | `undefined` | Initials when there is no picture. |
|
|
76
|
+
|
|
69
77
|
```typescript
|
|
70
78
|
interface IAvatarItem {
|
|
71
79
|
id: string;
|
|
@@ -74,10 +82,13 @@ interface IAvatarItem {
|
|
|
74
82
|
}
|
|
75
83
|
```
|
|
76
84
|
|
|
77
|
-
Each item in a group must have a unique `id` (used as the `@for` track key). When `imageUrl` is present the item renders as an `<img>`; otherwise as `initials`.
|
|
78
|
-
|
|
79
85
|
### IAvatarOptions
|
|
80
86
|
|
|
87
|
+
| Field | Type | Default | Description |
|
|
88
|
+
| ----------------- | ------------------------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `placeholderType` | `'icon' \| 'initials'` | `'icon'` | The fallback of a single avatar without `imageUrl`. `initials` are shown whenever they are set; without them `AvatarPresetComponent` renders an SVG icon (`'icon'`) or an empty initials chip (`'initials'`), while `AvatarStandardComponent` renders a `·` placeholder and exposes the value as `data-placeholder-type`. Not used in group mode. |
|
|
90
|
+
| `stackDirection` | `'top-to-bottom' \| 'bottom-to-top'` | `'top-to-bottom'` | Stacking order of a `group`. Styled by the preset (`'bottom-to-top'` reverses the overlapping stack); the standard exposes it as `data-stack-direction` on the group container (the root `<span>`, only in group mode), so plain CSS can target it. |
|
|
91
|
+
|
|
81
92
|
```typescript
|
|
82
93
|
interface IAvatarOptions {
|
|
83
94
|
placeholderType?: 'icon' | 'initials';
|
|
@@ -85,9 +96,6 @@ interface IAvatarOptions {
|
|
|
85
96
|
}
|
|
86
97
|
```
|
|
87
98
|
|
|
88
|
-
- **`placeholderType`** (default `'icon'`) — the fallback when there is no `imageUrl`. Both variants follow the same rule: `initials` are shown whenever they are set. Without initials, `AvatarPresetComponent` renders an SVG icon (`'icon'`) or an empty initials chip (`'initials'`), while `AvatarStandardComponent` renders a `·` placeholder. The standard also exposes the value as `data-placeholder-type` on its root `<span>`.
|
|
89
|
-
- **`stackDirection`** (default `'top-to-bottom'`) — purely visual, styled by the preset (`'bottom-to-top'` reverses the overlapping stack). The standard exposes it as `data-stack-direction` on the group container (the root `<span>`, only in group mode), so plain CSS can target it.
|
|
90
|
-
|
|
91
99
|
### Single vs Group Mode
|
|
92
100
|
|
|
93
101
|
The component automatically detects mode from `group()`:
|
|
@@ -101,7 +109,7 @@ The component automatically detects mode from `group()`:
|
|
|
101
109
|
import { AVATAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
102
110
|
```
|
|
103
111
|
|
|
104
|
-
InjectionToken that allows replacing the default `AvatarStandardComponent` with a custom implementation. Provide a `Type<AvatarBaseComponent>` to override.
|
|
112
|
+
InjectionToken that allows replacing the default `AvatarStandardComponent` with a custom implementation. Provide a `Type<AvatarBaseComponent>` to override; the wrapper passes it every input it declares, `class` included.
|
|
105
113
|
|
|
106
114
|
```typescript
|
|
107
115
|
// In your app module or component providers:
|
|
@@ -120,7 +128,6 @@ import {
|
|
|
120
128
|
ChangeDetectionStrategy,
|
|
121
129
|
Component,
|
|
122
130
|
computed,
|
|
123
|
-
input,
|
|
124
131
|
ViewEncapsulation,
|
|
125
132
|
} from '@angular/core';
|
|
126
133
|
|
|
@@ -163,9 +170,6 @@ import { AvatarBaseComponent } from '@smartsoft001/angular';
|
|
|
163
170
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
164
171
|
})
|
|
165
172
|
export class MyCustomAvatarComponent extends AvatarBaseComponent {
|
|
166
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
167
|
-
override cssClass = input<string>('');
|
|
168
|
-
|
|
169
173
|
containerClasses = computed(() => {
|
|
170
174
|
const classes = [
|
|
171
175
|
'my-avatar',
|
|
@@ -181,7 +185,6 @@ export class MyCustomAvatarComponent extends AvatarBaseComponent {
|
|
|
181
185
|
|
|
182
186
|
When extending the base directly, remember to:
|
|
183
187
|
|
|
184
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `AVATAR_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
185
188
|
- branch on `isGroup()` to render either the group iteration or the single-avatar fallback chain (`imageUrl` -> `initials` -> placeholder),
|
|
186
189
|
- track `@for` by `item.id` (the `IAvatarItem` contract).
|
|
187
190
|
|
|
@@ -203,14 +206,11 @@ When extending the base directly, remember to:
|
|
|
203
206
|
]"
|
|
204
207
|
/>
|
|
205
208
|
|
|
206
|
-
<!-- With
|
|
209
|
+
<!-- With a status dot (rendered by the preset) -->
|
|
207
210
|
<smart-avatar [imageUrl]="user.photo" notificationPosition="top" />
|
|
208
211
|
|
|
209
|
-
<!--
|
|
210
|
-
<smart-avatar
|
|
211
|
-
[imageUrl]="user.photo"
|
|
212
|
-
[options]="{ placeholderType: 'initials', stackDirection: 'top-to-bottom' }"
|
|
213
|
-
/>
|
|
212
|
+
<!-- Without picture or initials: an empty initials chip instead of the icon (preset) -->
|
|
213
|
+
<smart-avatar size="lg" [options]="{ placeholderType: 'initials' }" />
|
|
214
214
|
|
|
215
215
|
<!-- With external class -->
|
|
216
216
|
<smart-avatar [imageUrl]="user.photo" class="smart:m-2" />
|
|
@@ -17,7 +17,7 @@ The `<smart-badge>` component renders a small inline status / label indicator. I
|
|
|
17
17
|
|
|
18
18
|
### BadgeComponent (`<smart-badge>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `BadgeStandardComponent` by default. When `BADGE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `BadgeStandardComponent` by default. When `BADGE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and passes it every input, `class` included. Re-emits `removed` from whichever component it renders.
|
|
21
21
|
|
|
22
22
|
### BadgeStandardComponent (`<smart-badge-standard>`)
|
|
23
23
|
|
|
@@ -25,9 +25,9 @@ Barebones placeholder concrete implementation. Renders a `<span>` host with `dat
|
|
|
25
25
|
|
|
26
26
|
### BadgePresetComponent (`<smart-badge-preset>`)
|
|
27
27
|
|
|
28
|
-
Styled variation that extends `BadgeBaseComponent` and is a drop-in replacement for `BadgeStandardComponent`. Register it via `BADGE_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-badge>`, or use the `<smart-badge-preset>` selector directly. It groups the **solid / soft / outline** color presets into a single component, selected through `options.variant` (default `'soft'`), across the full `SmartBadgeColor` palette. Honors `options.pill` (default `true` → `rounded-full`; `false` → `rounded-md`), `size` (`sm`/`md`), `options.withDot` (leading SVG dot), and `options.withRemove` (remove button emitting `removed`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants
|
|
28
|
+
Styled variation that extends `BadgeBaseComponent` and is a drop-in replacement for `BadgeStandardComponent`. Register it via `BADGE_STANDARD_COMPONENT_TOKEN` (`{ provide: BADGE_STANDARD_COMPONENT_TOKEN, useValue: BadgePresetComponent }`) to restyle every `<smart-badge>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-badge-preset>` selector directly. It groups the **solid / soft / outline** color presets into a single component, selected through `options.variant` (default `'soft'`), across the full `SmartBadgeColor` palette. Honors `options.pill` (default `true` → `rounded-full`; `false` → `rounded-md`), `size` (`sm`/`md`), `options.withDot` (leading SVG dot), and `options.withRemove` (remove button emitting `removed`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the per-variant/color class recipes are internal to the preset (not exported).
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Used directly, `<smart-badge-preset>` takes the extra classes as `class` or `[cssClass]`; on `<smart-badge>` pass `class` and the wrapper forwards it.
|
|
31
31
|
|
|
32
32
|
### BadgeBaseComponent (abstract)
|
|
33
33
|
|
|
@@ -53,6 +53,8 @@ Abstract base directive for extending custom badge implementations. Exposes `tex
|
|
|
53
53
|
|
|
54
54
|
### SmartBadgeColor
|
|
55
55
|
|
|
56
|
+
`SmartBadgeColor` is `'gray' | 'red' | 'yellow' | 'green' | 'blue' | 'indigo' | 'purple' | 'pink'`. The preset styles every colour; the standard exposes it as `data-color`.
|
|
57
|
+
|
|
56
58
|
```typescript
|
|
57
59
|
type SmartBadgeColor =
|
|
58
60
|
'gray' | 'red' | 'yellow' | 'green' | 'blue' | 'indigo' | 'purple' | 'pink';
|
|
@@ -60,6 +62,13 @@ type SmartBadgeColor =
|
|
|
60
62
|
|
|
61
63
|
### IBadgeOptions
|
|
62
64
|
|
|
65
|
+
| Field | Type | Default | Description |
|
|
66
|
+
| ------------ | -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `variant` | `'solid' \| 'soft' \| 'outline'` | `'soft'` | Styled by the preset: `solid` filled with inverse text, `soft` tinted with same-hue text, `outline` transparent with a coloured border. The standard does not style it; it exposes it as `data-variant`. |
|
|
68
|
+
| `pill` | `boolean` | `true` | Fully rounded pill; `false` renders `rounded-md` corners. Styled by the preset; the standard exposes it as `data-pill="true" \| "false"`. |
|
|
69
|
+
| `withDot` | `boolean` | `false` | Renders a coloured dot before the text (a `•` in the standard, an SVG dot in the preset). |
|
|
70
|
+
| `withRemove` | `boolean` | `false` | Renders a remove button that emits `removed`. |
|
|
71
|
+
|
|
63
72
|
```typescript
|
|
64
73
|
interface IBadgeOptions {
|
|
65
74
|
/** Visual style: 'solid' | 'soft' | 'outline' (consumed by BadgePresetComponent; default 'soft'). */
|
|
@@ -79,7 +88,7 @@ interface IBadgeOptions {
|
|
|
79
88
|
import { BADGE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
80
89
|
```
|
|
81
90
|
|
|
82
|
-
InjectionToken that allows replacing the default `BadgeStandardComponent` with a custom implementation. Provide a `Type<BadgeBaseComponent>` to override
|
|
91
|
+
InjectionToken that allows replacing the default `BadgeStandardComponent` with a custom implementation. Provide a `Type<BadgeBaseComponent>` to override; the wrapper passes it every input it declares, `class` included, and re-emits its `removed`.
|
|
83
92
|
|
|
84
93
|
```typescript
|
|
85
94
|
// In your app module or component providers:
|
|
@@ -98,7 +107,6 @@ import {
|
|
|
98
107
|
ChangeDetectionStrategy,
|
|
99
108
|
Component,
|
|
100
109
|
computed,
|
|
101
|
-
input,
|
|
102
110
|
ViewEncapsulation,
|
|
103
111
|
} from '@angular/core';
|
|
104
112
|
|
|
@@ -123,12 +131,9 @@ import { BadgeBaseComponent } from '@smartsoft001/angular';
|
|
|
123
131
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
124
132
|
})
|
|
125
133
|
export class MyCustomBadgeComponent extends BadgeBaseComponent {
|
|
126
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
127
|
-
override cssClass = input<string>('');
|
|
128
|
-
|
|
129
134
|
containerClasses = computed(() => {
|
|
130
135
|
const classes = ['my-badge-container'];
|
|
131
|
-
if (this.options()?.pill) classes.push('my-badge-pill');
|
|
136
|
+
if (this.options()?.pill !== false) classes.push('my-badge-pill');
|
|
132
137
|
if (this.options()?.variant === 'outline') classes.push('my-badge-outline');
|
|
133
138
|
const extra = this.cssClass();
|
|
134
139
|
if (extra) classes.push(extra);
|
|
@@ -139,7 +144,7 @@ export class MyCustomBadgeComponent extends BadgeBaseComponent {
|
|
|
139
144
|
|
|
140
145
|
When extending the base directly, remember to:
|
|
141
146
|
|
|
142
|
-
-
|
|
147
|
+
- treat a missing `options.pill` as `true` and a missing `options.variant` as `'soft'`, like the built-in variants,
|
|
143
148
|
- call `this.remove()` from your remove button click handler so the `removed` output is emitted consistently.
|
|
144
149
|
|
|
145
150
|
## Usage Examples
|
|
@@ -171,7 +176,8 @@ When extending the base directly, remember to:
|
|
|
171
176
|
### Using the preset variation
|
|
172
177
|
|
|
173
178
|
```typescript
|
|
174
|
-
// Register globally (or in a feature's providers) to restyle every <smart-badge
|
|
179
|
+
// Register globally (or in a feature's providers) to restyle every <smart-badge>,
|
|
180
|
+
// or call provideSmartPresets() to register every preset at once.
|
|
175
181
|
import {
|
|
176
182
|
BADGE_STANDARD_COMPONENT_TOKEN,
|
|
177
183
|
BadgePresetComponent,
|
|
@@ -193,7 +199,7 @@ providers: [
|
|
|
193
199
|
[options]="{ variant: 'soft', pill: false }"
|
|
194
200
|
/>
|
|
195
201
|
|
|
196
|
-
<!-- Or use the variation selector directly (
|
|
202
|
+
<!-- Or use the variation selector directly (class or [cssClass]) -->
|
|
197
203
|
<smart-badge-preset
|
|
198
204
|
text="Beta"
|
|
199
205
|
color="purple"
|
|
@@ -17,17 +17,17 @@ The `<smart-breadcrumbs>` component renders a list of navigation items separated
|
|
|
17
17
|
|
|
18
18
|
### BreadcrumbsComponent (`<smart-breadcrumbs>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `BreadcrumbsStandardComponent` by default. When `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `itemClick
|
|
20
|
+
Main wrapper. Delegates to `BreadcrumbsStandardComponent` by default. When `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and passes it `options` and `class`. Re-emits `itemClick` from whichever component it renders.
|
|
21
21
|
|
|
22
22
|
### BreadcrumbsStandardComponent (`<smart-breadcrumbs-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder using native HTML. Renders a `<nav class="breadcrumbs">` (with `aria-label` from `options.ariaLabel` or default `"Breadcrumb"`) containing an `<ol>` of items. Each item renders as `<a class="breadcrumbs-link">` (when `href` provided) or `<button class="breadcrumbs-button">` (otherwise, emitting `itemClick`). Items get `current` class and `aria-current="page"` when `item.current === true`. Supports `iconTpl` (e.g. for the home item) and `srOnlyLabel`. Items are joined by a `<span class="breadcrumbs-separator">` with a `data-separator` attribute reflecting `options.separator` (defaults to `chevron`).
|
|
24
|
+
Barebones placeholder using native HTML. Renders a `<nav class="breadcrumbs">` (with `aria-label` from `options.ariaLabel` or default `"Breadcrumb"`) containing an `<ol>` of items. Each item renders as `<a class="breadcrumbs-link">` (when `href` provided) or `<button class="breadcrumbs-button">` (otherwise, emitting `itemClick`). Items get `current` class and `aria-current="page"` when `item.current === true`. Supports `iconTpl` (e.g. for the home item) and `srOnlyLabel`. Items are joined by a `<span class="breadcrumbs-separator">` with a `data-separator` attribute reflecting `options.separator` (defaults to `chevron`). It ignores `options.layout`.
|
|
25
25
|
|
|
26
26
|
### BreadcrumbsPresetComponent (`<smart-breadcrumbs-preset>`)
|
|
27
27
|
|
|
28
|
-
Styled variation that extends `BreadcrumbsBaseComponent` and is a drop-in replacement for `BreadcrumbsStandardComponent`. Register it via `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-breadcrumbs>`, or use the `<smart-breadcrumbs-preset>` selector directly. Translates the Preline breadcrumb: muted links (`text-gray-
|
|
28
|
+
Styled variation that extends `BreadcrumbsBaseComponent` and is a drop-in replacement for `BreadcrumbsStandardComponent`. Register it via `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` (`{ provide: BREADCRUMBS_STANDARD_COMPONENT_TOKEN, useValue: BreadcrumbsPresetComponent }`) to restyle every `<smart-breadcrumbs>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-breadcrumbs-preset>` selector directly. Translates the Preline breadcrumb: muted links (`text-gray-600`) that brighten to blue on hover/focus, a bold non-link current crumb (`font-semibold text-gray-900`), and a configurable separator SVG between crumbs selected via `options.separator` — `chevron` (default), `slash` (drawn slightly larger), or `arrow`. The `options.layout` field wraps the bar: `contained` (inline padded gray panel with rounded corners) and `full-width-bar` (full-width gray bar with top/bottom borders); the `simple-with-slashes` layout also implies a slash separator when `separator` is unset; `simple-with-chevrons` changes nothing (no wrapper, and the chevron is already the default separator). Items render as `<a>` (when `href` is set and not current), `<button>` (no href → emits `itemClick`), or a plain `<span>` (when `current`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset (not exported).
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Used directly, `<smart-breadcrumbs-preset>` takes the extra classes as `class` or `[cssClass]`; on `<smart-breadcrumbs>` pass `class` and the wrapper forwards it.
|
|
31
31
|
|
|
32
32
|
### BreadcrumbsBaseComponent (abstract)
|
|
33
33
|
|
|
@@ -56,6 +56,26 @@ Abstract base directive. Exposes:
|
|
|
56
56
|
|
|
57
57
|
### IBreadcrumbsOptions
|
|
58
58
|
|
|
59
|
+
| Field | Type | Default | Description |
|
|
60
|
+
| ----------- | --------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `layout` | `SmartBreadcrumbsLayout` | `undefined` | Preset only: `contained` or `full-width-bar` wrap the trail in a gray bar; `simple-with-slashes` implies the slash separator; `simple-with-chevrons` changes nothing. The standard ignores it. |
|
|
62
|
+
| `ariaLabel` | `string` | `'Breadcrumb'` | Accessible name of the `nav`. |
|
|
63
|
+
| `separator` | `SmartBreadcrumbsSeparator` | `'chevron'` | Glyph between items: `'chevron'`, `'slash'` or `'arrow'`, drawn by the preset; the standard exposes it as `data-separator`. |
|
|
64
|
+
| `items` | `IBreadcrumbItem[]` | required | The trail, first to last. |
|
|
65
|
+
|
|
66
|
+
### IBreadcrumbItem
|
|
67
|
+
|
|
68
|
+
| Field | Type | Default | Description |
|
|
69
|
+
| ------------- | ---------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
|
|
70
|
+
| `id` | `string` | required | Reported as `itemId` by `itemClick`. |
|
|
71
|
+
| `label` | `string` | `undefined` | Visible text. |
|
|
72
|
+
| `href` | `string` | `undefined` | Renders the item as a link; without it the item is a button that emits `itemClick`. |
|
|
73
|
+
| `iconTpl` | `TemplateRef<unknown>` | `undefined` | Icon before the label (e.g. a home icon). |
|
|
74
|
+
| `srOnlyLabel` | `string` | `undefined` | Text for screen readers only, for an icon-only item. |
|
|
75
|
+
| `current` | `boolean` | `undefined` | Marks the current page (`aria-current="page"`); the preset renders it as plain text, not a link. |
|
|
76
|
+
|
|
77
|
+
`SmartBreadcrumbsLayout` is `'contained' | 'full-width-bar' | 'simple-with-chevrons' | 'simple-with-slashes'`; `SmartBreadcrumbsSeparator` is `'chevron' | 'slash' | 'arrow'`.
|
|
78
|
+
|
|
59
79
|
```typescript
|
|
60
80
|
type SmartBreadcrumbsLayout =
|
|
61
81
|
| 'contained'
|
|
@@ -84,6 +104,8 @@ interface IBreadcrumbItem {
|
|
|
84
104
|
|
|
85
105
|
## BREADCRUMBS_STANDARD_COMPONENT_TOKEN
|
|
86
106
|
|
|
107
|
+
InjectionToken that replaces the default `BreadcrumbsStandardComponent` with a custom implementation: provide a `Type<BreadcrumbsBaseComponent>`. The wrapper passes it `options` and `class` and re-emits its `itemClick`.
|
|
108
|
+
|
|
87
109
|
```typescript
|
|
88
110
|
import { BREADCRUMBS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
89
111
|
|
|
@@ -101,7 +123,6 @@ providers: [
|
|
|
101
123
|
import {
|
|
102
124
|
ChangeDetectionStrategy,
|
|
103
125
|
Component,
|
|
104
|
-
input,
|
|
105
126
|
ViewEncapsulation,
|
|
106
127
|
} from '@angular/core';
|
|
107
128
|
|
|
@@ -113,10 +134,7 @@ import { BreadcrumbsBaseComponent } from '@smartsoft001/angular';
|
|
|
113
134
|
encapsulation: ViewEncapsulation.None,
|
|
114
135
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
115
136
|
})
|
|
116
|
-
export class MyCustomBreadcrumbsComponent extends BreadcrumbsBaseComponent {
|
|
117
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
118
|
-
override cssClass = input<string>('');
|
|
119
|
-
}
|
|
137
|
+
export class MyCustomBreadcrumbsComponent extends BreadcrumbsBaseComponent {}
|
|
120
138
|
```
|
|
121
139
|
|
|
122
140
|
## Usage Examples
|
|
@@ -136,7 +154,6 @@ export class MyCustomBreadcrumbsComponent extends BreadcrumbsBaseComponent {
|
|
|
136
154
|
<!-- With slash separators -->
|
|
137
155
|
<smart-breadcrumbs
|
|
138
156
|
[options]="{
|
|
139
|
-
layout: 'simple-with-slashes',
|
|
140
157
|
separator: 'slash',
|
|
141
158
|
items: items,
|
|
142
159
|
}"
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Button Component
|
|
8
8
|
|
|
9
|
-
The `<smart-button>` component
|
|
9
|
+
The `<smart-button>` component is the button of `@smartsoft001/angular`. It is configured through an `IButtonOptions` object (`click` plus the look: `variant`, `color`, `size`, `rounded`, `circular`), renders its projected content as the label, shows a spinner while `options.loading()` is `true`, and with `options.confirm` turns the first click into a Cancel / Confirm pair before `click` runs. It renders a default `ButtonStandardComponent` which can be replaced via `BUTTON_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -17,17 +17,17 @@ The `<smart-button>` component provides a flexible button wrapper with an Inject
|
|
|
17
17
|
|
|
18
18
|
### ButtonComponent (`<smart-button>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `ButtonStandardComponent` by default. When `BUTTON_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `ButtonStandardComponent` by default. When `BUTTON_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passes it every input (`class` included) and projects the label into the injected component's first `<ng-content>`.
|
|
21
21
|
|
|
22
22
|
### ButtonStandardComponent (`<smart-button-standard>`)
|
|
23
23
|
|
|
24
|
-
Default concrete implementation
|
|
24
|
+
Default concrete implementation: a Tailwind-styled `<button>` coloured by `COMPONENT_COLORS[color][variant]`, with size-dependent padding and rounding (`rounded-sm` for `xs` / `sm`, `rounded-md` otherwise). It does not read `rounded`, `circular` or `iconPosition`.
|
|
25
25
|
|
|
26
26
|
### ButtonPresetComponent (`<smart-button-preset>`)
|
|
27
27
|
|
|
28
|
-
Fully-styled, drop-in preset implementation extending `ButtonBaseComponent`. Register it through `BUTTON_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-button>`, or use the `<smart-button-preset>` selector directly.
|
|
28
|
+
Fully-styled, drop-in preset implementation extending `ButtonBaseComponent`. Register it through `BUTTON_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-button>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-button-preset>` selector directly (it takes the extra classes as `class` or `[cssClass]`).
|
|
29
29
|
|
|
30
|
-
Groups the Preline button types into one component, selected via the existing `options.variant`: `primary` → solid, `secondary` → outline, `soft` → soft. Works across the full `SmartColor` palette and every `SmartSize`, and honours `options.rounded` (pill), `options.circular` (square padding + pill), `options.loading`, `options.confirm`, and the `disabled` input. All classes are `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants.
|
|
30
|
+
Groups the Preline button types into one component, selected via the existing `options.variant`: `primary` → solid, `secondary` → outline, `soft` → soft. Works across the full `SmartColor` palette and every `SmartSize`, and honours `options.rounded` (pill), `options.circular` (square padding + pill), `options.loading`, `options.confirm`, and the `disabled` input (`disabled:opacity-50 disabled:pointer-events-none`). All classes are `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants.
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
33
|
providers: [
|
|
@@ -38,24 +38,49 @@ providers: [
|
|
|
38
38
|
];
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Because `ButtonComponent` renders the injected component via `NgComponentOutlet`, inputs are passed by **canonical name** — `ButtonPresetComponent` therefore overrides `cssClass` as a plain `input<string>('')` (dropping the inherited `class` alias). The wrapper passes its projected content (the label) to the injected component's `<ng-content>`, so the label shows through the token path as well as with `<smart-button-preset>` used directly.
|
|
42
|
-
|
|
43
41
|
### ButtonBaseComponent (abstract)
|
|
44
42
|
|
|
45
|
-
Abstract base directive for extending custom button implementations.
|
|
43
|
+
Abstract base directive for extending custom button implementations. It holds the inputs and the confirm mode.
|
|
44
|
+
|
|
45
|
+
| Member | Type | Description |
|
|
46
|
+
| ----------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `mode` | `WritableSignal<'default' \| 'confirm'>` | `'confirm'` after a first click on a `confirm` button, `'default'` otherwise. |
|
|
48
|
+
| `variantClasses` | `Signal<string[]>` | The colour classes of `options.variant` / `options.color` from `COMPONENT_COLORS`, plus `smart:opacity-50 smart:cursor-not-allowed` while `disabled`. |
|
|
49
|
+
| `invoke()` | method | The click handler: runs `options.click`, or enters the confirm mode when `options.confirm`. |
|
|
50
|
+
| `confirmInvoke()` | method | Runs `options.click` and leaves the confirm mode. |
|
|
51
|
+
| `confirmCancel()` | method | Leaves the confirm mode without running `click`. |
|
|
46
52
|
|
|
47
53
|
## API
|
|
48
54
|
|
|
49
55
|
### Inputs
|
|
50
56
|
|
|
51
|
-
| Input | Type | Default | Description
|
|
52
|
-
| ---------- | ----------------------------- | -------- |
|
|
53
|
-
| `options` | `InputSignal<IButtonOptions>` | required | Button configuration
|
|
54
|
-
| `disabled` | `InputSignal<boolean>` | `false` |
|
|
55
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
57
|
+
| Input | Type | Default | Description |
|
|
58
|
+
| ---------- | ----------------------------- | -------- | ---------------------------------------------------------------------- |
|
|
59
|
+
| `options` | `InputSignal<IButtonOptions>` | required | Button configuration |
|
|
60
|
+
| `disabled` | `InputSignal<boolean>` | `false` | Disables the `<button>` |
|
|
61
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes appended to the `<button>` (alias for `cssClass`) |
|
|
62
|
+
|
|
63
|
+
### Content projection
|
|
64
|
+
|
|
65
|
+
| Selector | Description |
|
|
66
|
+
| -------- | --------------------------------------------------------------------- |
|
|
67
|
+
| default | The label. Replaced by the spinner while `options.loading()` is true. |
|
|
56
68
|
|
|
57
69
|
### IButtonOptions
|
|
58
70
|
|
|
71
|
+
| Field | Type | Default | Description |
|
|
72
|
+
| -------------- | ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
73
|
+
| `type` | `'submit' \| 'button'` | `'button'` | The `type` attribute of the `<button>`. Use `'submit'` inside a `<form>` of your own. |
|
|
74
|
+
| `confirm` | `boolean` | `undefined` | The first click shows Cancel / Confirm buttons (translated `cancel` / `confirm`); `click` runs only after Confirm. |
|
|
75
|
+
| `click` | `() => void` | required | Called on click (after the confirmation when `confirm` is set). |
|
|
76
|
+
| `loading` | `Signal<boolean>` | `undefined` | While it reads `true`, the spinner replaces the label and the button is disabled. |
|
|
77
|
+
| `variant` | `SmartVariant` | `'primary'` | `primary` (solid), `secondary` (outline) or `soft`. |
|
|
78
|
+
| `size` | `SmartSize` | `'md'` | Padding and text size (`xs` to `xl`); the standard also uses smaller rounding for `xs` / `sm`. |
|
|
79
|
+
| `color` | `SmartColor` | `'indigo'` | One of the 22 Tailwind palette names. |
|
|
80
|
+
| `rounded` | `boolean` | `undefined` | Preset only: pill shape. The standard ignores it. |
|
|
81
|
+
| `circular` | `boolean` | `undefined` | Preset only: square padding plus pill shape, for an icon-only button. The standard ignores it. |
|
|
82
|
+
| `iconPosition` | `'leading' \| 'trailing'` | `undefined` | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
|
|
83
|
+
|
|
59
84
|
```typescript
|
|
60
85
|
interface IButtonOptions {
|
|
61
86
|
type?: 'submit' | 'button';
|
|
@@ -77,7 +102,7 @@ interface IButtonOptions {
|
|
|
77
102
|
import { BUTTON_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
78
103
|
```
|
|
79
104
|
|
|
80
|
-
InjectionToken that allows replacing the default `ButtonStandardComponent` with a custom implementation. Provide a `Type<ButtonBaseComponent>` to override
|
|
105
|
+
InjectionToken that allows replacing the default `ButtonStandardComponent` with a custom implementation. Provide a `Type<ButtonBaseComponent>` to override; every `<smart-button>` in that injector renders it, with the label projected into its `<ng-content>`.
|
|
81
106
|
|
|
82
107
|
```typescript
|
|
83
108
|
// In your app module or component providers:
|
|
@@ -99,6 +124,7 @@ import { ButtonBaseComponent } from '@smartsoft001/angular';
|
|
|
99
124
|
selector: 'my-custom-button',
|
|
100
125
|
template: `
|
|
101
126
|
<button
|
|
127
|
+
type="button"
|
|
102
128
|
[class]="buttonClasses()"
|
|
103
129
|
[disabled]="disabled()"
|
|
104
130
|
(click)="invoke()"
|
|
@@ -125,11 +151,11 @@ export class MyCustomButtonComponent extends ButtonBaseComponent {
|
|
|
125
151
|
<smart-button [options]="{ click: onClick }">Save</smart-button>
|
|
126
152
|
|
|
127
153
|
<!-- With variant and size -->
|
|
128
|
-
<smart-button [options]="{ click: onClick, variant: '
|
|
154
|
+
<smart-button [options]="{ click: onClick, variant: 'secondary', size: 'lg' }">
|
|
129
155
|
Submit
|
|
130
156
|
</smart-button>
|
|
131
157
|
|
|
132
|
-
<!-- With loading -->
|
|
158
|
+
<!-- With loading (a Signal<boolean>) -->
|
|
133
159
|
<smart-button [options]="{ click: onClick, loading: loadingSignal }">
|
|
134
160
|
Save
|
|
135
161
|
</smart-button>
|
|
@@ -147,7 +173,7 @@ export class MyCustomButtonComponent extends ButtonBaseComponent {
|
|
|
147
173
|
|
|
148
174
|
- Wrapper: `packages/shared/angular/src/lib/components/button/button.component.ts`
|
|
149
175
|
- Standard: `packages/shared/angular/src/lib/components/button/standard/standard.component.ts`
|
|
150
|
-
- Preset: `packages/shared/angular/src/lib/components/button/preset/preset.component.ts` (classes: `preset/preset-classes.util.ts
|
|
176
|
+
- Preset: `packages/shared/angular/src/lib/components/button/preset/preset.component.ts` (classes: `preset/preset-classes.util.ts`, internal)
|
|
151
177
|
- Base class: `packages/shared/angular/src/lib/components/button/base/base.component.ts`
|
|
152
178
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`BUTTON_STANDARD_COMPONENT_TOKEN`)
|
|
153
179
|
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IButtonOptions`)
|
|
@@ -18,19 +18,17 @@ The `<smart-button-group>` component renders a horizontal group of related butto
|
|
|
18
18
|
|
|
19
19
|
### ButtonGroupComponent (`<smart-button-group>`)
|
|
20
20
|
|
|
21
|
-
Main wrapper component. Renders `ButtonGroupStandardComponent` by default. When `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
21
|
+
Main wrapper component. Renders `ButtonGroupStandardComponent` by default. When `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passes it every input (`class` included), and forwards its `selected` changes and `buttonClick` to the wrapper.
|
|
22
22
|
|
|
23
23
|
### ButtonGroupStandardComponent (`<smart-button-group-standard>`)
|
|
24
24
|
|
|
25
|
-
Default concrete implementation. Renders
|
|
25
|
+
Default concrete implementation. Renders an unstyled `<div role="group">` containing one `<button>` per item (`aria-pressed` on the selected one), with optional label and count spans. It does not render `icon` and ignores `options.variant`.
|
|
26
26
|
|
|
27
27
|
### ButtonGroupPresetComponent (`<smart-button-group-preset>`)
|
|
28
28
|
|
|
29
|
-
Fully-styled, drop-in concrete implementation (Preline button-group look) that extends `ButtonGroupBaseComponent`. Renders a segmented control with a `bg-white`/`dark:bg-gray-800` surface, shared borders collapsed via `-ms-px`, and rounded ends. The segment matching `selected` is emphasised (`aria-pressed="true"` + blue text). `options.variant` adjusts per-button content: `icon-only` hides labels (and sets `aria-label`), `with-stat` styles the count pill with the blue stat palette; all other variants render the basic label + count layout.
|
|
29
|
+
Fully-styled, drop-in concrete implementation (Preline button-group look) that extends `ButtonGroupBaseComponent`. Renders a segmented control with a `bg-white`/`dark:bg-gray-800` surface, shared borders collapsed via `-ms-px`, and rounded ends. The segment matching `selected` is emphasised (`aria-pressed="true"` + blue text). Each button shows its `icon` text before the label. `options.variant` adjusts per-button content: `icon-only` hides labels (and sets `aria-label`), `with-stat` styles the count pill with the blue stat palette; all other variants (`basic`, `with-dropdown`, `with-checkbox-select`) render the basic label + count layout. Every segment uses one medium size.
|
|
30
30
|
|
|
31
|
-
Register it through `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-button-group>`, or use the `<smart-button-group-preset>` selector directly.
|
|
32
|
-
|
|
33
|
-
> NgComponentOutlet note: when registered through the token, the wrapper passes inputs by **canonical name**, so the preset overrides the inherited `class` alias with a plain `cssClass = input<string>('')` so external classes still bind.
|
|
31
|
+
Register it through `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN` (`{ provide: BUTTON_GROUP_STANDARD_COMPONENT_TOKEN, useValue: ButtonGroupPresetComponent }`) to restyle every `<smart-button-group>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-button-group-preset>` selector directly (it takes the extra classes as `class` or `[cssClass]`).
|
|
34
32
|
|
|
35
33
|
### ButtonGroupBaseComponent (abstract)
|
|
36
34
|
|
|
@@ -40,16 +38,24 @@ Abstract base directive (`@Directive()`) for extending custom button-group imple
|
|
|
40
38
|
|
|
41
39
|
### Inputs / Models / Outputs
|
|
42
40
|
|
|
43
|
-
| Name | Kind | Type | Default | Description
|
|
44
|
-
| ------------- | ------ | ----------------------------------------------------------------------------------------- | ----------- |
|
|
45
|
-
| `buttons` | input | `IButtonGroupButton[]` | `[]` | Array of button definitions
|
|
46
|
-
| `options` | input | `IButtonGroupOptions \| undefined` | `undefined` | Group-wide options (variant, etc.)
|
|
47
|
-
| `selected` | model | `string \| undefined` | `undefined` | Two-way bound id of the currently selected button |
|
|
48
|
-
| `class` | input | `string` | `''` | External CSS classes (alias for `cssClass`)
|
|
49
|
-
| `buttonClick` | output | `IButtonGroupButtonClick` (`{ buttonId: string }`, exported from `@smartsoft001/angular`) | - | Emitted when a button is clicked
|
|
41
|
+
| Name | Kind | Type | Default | Description |
|
|
42
|
+
| ------------- | ------ | ----------------------------------------------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------- |
|
|
43
|
+
| `buttons` | input | `IButtonGroupButton[]` | `[]` | Array of button definitions |
|
|
44
|
+
| `options` | input | `IButtonGroupOptions \| undefined` | `undefined` | Group-wide options (variant, etc.) |
|
|
45
|
+
| `selected` | model | `string \| undefined` | `undefined` | Two-way bound id of the currently selected button; `selectedChange` reports a click |
|
|
46
|
+
| `class` | input | `string` | `''` | External CSS classes (alias for `cssClass`) |
|
|
47
|
+
| `buttonClick` | output | `IButtonGroupButtonClick` (`{ buttonId: string }`, exported from `@smartsoft001/angular`) | - | Emitted when a button is clicked |
|
|
50
48
|
|
|
51
49
|
### IButtonGroupButton
|
|
52
50
|
|
|
51
|
+
| Field | Type | Default | Description |
|
|
52
|
+
| ---------- | --------- | ----------- | ------------------------------------------------------------------------------ |
|
|
53
|
+
| `id` | `string` | required | Identifies the button in `selected` and `buttonClick`. |
|
|
54
|
+
| `label` | `string` | `undefined` | Visible text (moved to `aria-label` by the preset's `icon-only` variant). |
|
|
55
|
+
| `icon` | `string` | `undefined` | Preset only: text or glyph rendered before the label. The standard ignores it. |
|
|
56
|
+
| `disabled` | `boolean` | `undefined` | Disables the button. |
|
|
57
|
+
| `count` | `number` | `undefined` | A number shown after the label. |
|
|
58
|
+
|
|
53
59
|
```typescript
|
|
54
60
|
interface IButtonGroupButton {
|
|
55
61
|
id: string;
|
|
@@ -62,6 +68,12 @@ interface IButtonGroupButton {
|
|
|
62
68
|
|
|
63
69
|
### IButtonGroupOptions
|
|
64
70
|
|
|
71
|
+
| Field | Type | Default | Description |
|
|
72
|
+
| --------- | ------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| `variant` | `SmartButtonGroupVariant` | `'basic'` | Preset only: `icon-only` hides the labels, `with-stat` styles the count as a blue pill; `with-dropdown` and `with-checkbox-select` render like `basic`. The standard ignores it. |
|
|
74
|
+
|
|
75
|
+
`SmartButtonGroupVariant` is `'basic' | 'icon-only' | 'with-stat' | 'with-dropdown' | 'with-checkbox-select'`.
|
|
76
|
+
|
|
65
77
|
```typescript
|
|
66
78
|
type SmartButtonGroupVariant =
|
|
67
79
|
| 'basic'
|
|
@@ -81,7 +93,7 @@ interface IButtonGroupOptions {
|
|
|
81
93
|
import { BUTTON_GROUP_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
82
94
|
```
|
|
83
95
|
|
|
84
|
-
InjectionToken that allows replacing the default `ButtonGroupStandardComponent` with a custom implementation. Provide a `Type<ButtonGroupBaseComponent>` to override
|
|
96
|
+
InjectionToken that allows replacing the default `ButtonGroupStandardComponent` with a custom implementation. Provide a `Type<ButtonGroupBaseComponent>` to override; the wrapper passes it every input it declares, `class` included, and forwards its `selected` changes and `buttonClick`.
|
|
85
97
|
|
|
86
98
|
```typescript
|
|
87
99
|
// In your app module or component providers:
|