@smartsoft001/claude-plugins 2.201.0 → 2.203.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/smart-angular/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-angular/skills/angular-components-accordion/SKILL.md +84 -80
- package/plugins/smart-angular/skills/angular-components-action-panel/SKILL.md +35 -60
- package/plugins/smart-angular/skills/angular-components-alert/SKILL.md +24 -29
- package/plugins/smart-angular/skills/angular-components-avatar/SKILL.md +30 -30
- package/plugins/smart-angular/skills/angular-components-badge/SKILL.md +18 -12
- package/plugins/smart-angular/skills/angular-components-breadcrumbs/SKILL.md +27 -10
- package/plugins/smart-angular/skills/angular-components-button/SKILL.md +43 -17
- package/plugins/smart-angular/skills/angular-components-button-group/SKILL.md +26 -14
- package/plugins/smart-angular/skills/angular-components-calendar/SKILL.md +47 -28
- package/plugins/smart-angular/skills/angular-components-card/SKILL.md +29 -22
- package/plugins/smart-angular/skills/angular-components-card-heading/SKILL.md +24 -18
- package/plugins/smart-angular/skills/angular-components-command-palette/SKILL.md +41 -32
- package/plugins/smart-angular/skills/angular-components-container/SKILL.md +21 -20
- package/plugins/smart-angular/skills/angular-components-date-edit/SKILL.md +48 -45
- package/plugins/smart-angular/skills/angular-components-date-range/SKILL.md +72 -82
- package/plugins/smart-angular/skills/angular-components-description-list/SKILL.md +23 -10
- package/plugins/smart-angular/skills/angular-components-detail/SKILL.md +20 -8
- package/plugins/smart-angular/skills/angular-components-details/SKILL.md +64 -13
- package/plugins/smart-angular/skills/angular-components-divider/SKILL.md +36 -18
- package/plugins/smart-angular/skills/angular-components-drawer/SKILL.md +28 -23
- package/plugins/smart-angular/skills/angular-components-dropdown/SKILL.md +35 -16
- package/plugins/smart-angular/skills/angular-components-empty-state/SKILL.md +49 -11
- package/plugins/smart-angular/skills/angular-components-feed/SKILL.md +45 -12
- package/plugins/smart-angular/skills/angular-components-form/SKILL.md +53 -25
- package/plugins/smart-angular/skills/angular-components-grid-list/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-icon/SKILL.md +8 -8
- package/plugins/smart-angular/skills/angular-components-info/SKILL.md +19 -15
- package/plugins/smart-angular/skills/angular-components-input/SKILL.md +86 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +131 -81
- package/plugins/smart-angular/skills/angular-components-list-container/SKILL.md +24 -32
- package/plugins/smart-angular/skills/angular-components-media-object/SKILL.md +19 -17
- package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +78 -17
- package/plugins/smart-angular/skills/angular-components-multi-column-layout/SKILL.md +19 -16
- package/plugins/smart-angular/skills/angular-components-navbar/SKILL.md +38 -21
- package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +32 -33
- package/plugins/smart-angular/skills/angular-components-page/SKILL.md +48 -52
- package/plugins/smart-angular/skills/angular-components-page-heading/SKILL.md +42 -25
- package/plugins/smart-angular/skills/angular-components-paging/SKILL.md +17 -15
- package/plugins/smart-angular/skills/angular-components-password-strength/SKILL.md +21 -19
- package/plugins/smart-angular/skills/angular-components-progress-bars/SKILL.md +61 -24
- package/plugins/smart-angular/skills/angular-components-searchbar/SKILL.md +30 -37
- package/plugins/smart-angular/skills/angular-components-section-heading/SKILL.md +38 -27
- package/plugins/smart-angular/skills/angular-components-select-menu/SKILL.md +33 -17
- package/plugins/smart-angular/skills/angular-components-sidebar-layout/SKILL.md +30 -26
- package/plugins/smart-angular/skills/angular-components-sidebar-navigation/SKILL.md +79 -16
- package/plugins/smart-angular/skills/angular-components-sign-in-form/SKILL.md +64 -24
- package/plugins/smart-angular/skills/angular-components-stacked-layout/SKILL.md +24 -23
- package/plugins/smart-angular/skills/angular-components-stacked-list/SKILL.md +40 -21
- package/plugins/smart-angular/skills/angular-components-stats/SKILL.md +28 -15
- package/plugins/smart-angular/skills/angular-components-table/SKILL.md +42 -22
- package/plugins/smart-angular/skills/angular-components-tabs/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-textarea/SKILL.md +48 -46
- package/plugins/smart-angular/skills/angular-components-toggle/SKILL.md +21 -28
- package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +66 -24
- package/plugins/smart-angular/skills/smart-crud/SKILL.md +5 -2
- package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +11 -11
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +7 -7
- package/plugins/smart-react/skills/react-components-button/SKILL.md +20 -20
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-card/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +25 -16
- package/plugins/smart-react/skills/react-components-details/SKILL.md +16 -16
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-info/SKILL.md +3 -1
- package/plugins/smart-react/skills/react-components-input/SKILL.md +51 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +81 -45
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-overlays/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-page/SKILL.md +5 -5
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +28 -28
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +29 -29
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-table/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +3 -2
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-provider/SKILL.md +1 -1
- package/plugins/smart-react/skills/smart-crud-react/SKILL.md +2 -2
|
@@ -24,7 +24,7 @@ Main wrapper component. Renders `ListContainerStandardComponent` by default. Whe
|
|
|
24
24
|
Barebones placeholder concrete implementation. Renders a `<div role="list">` that:
|
|
25
25
|
|
|
26
26
|
- exposes the variant value via `data-variant` (omitted when `options` is not provided),
|
|
27
|
-
- applies the external `cssClass` directly on
|
|
27
|
+
- applies the external `cssClass` directly on that `<div>`,
|
|
28
28
|
- projects all children via `<ng-content />`.
|
|
29
29
|
|
|
30
30
|
It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
@@ -37,13 +37,20 @@ Abstract base directive for extending custom list container implementations. Exp
|
|
|
37
37
|
|
|
38
38
|
### Inputs
|
|
39
39
|
|
|
40
|
-
| Input | Type | Default | Description
|
|
41
|
-
| --------- | ------------------------------------------------- | ------- |
|
|
42
|
-
| `options` | `InputSignal<IListContainerOptions \| undefined>` | - | Optional configuration (variant
|
|
43
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
40
|
+
| Input | Type | Default | Description |
|
|
41
|
+
| --------- | ------------------------------------------------- | ------- | ------------------------------------------------------- |
|
|
42
|
+
| `options` | `InputSignal<IListContainerOptions \| undefined>` | - | Optional configuration (`variant`, `fullWidthOnMobile`) |
|
|
43
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
44
44
|
|
|
45
45
|
### IListContainerOptions
|
|
46
46
|
|
|
47
|
+
| Field | Type | Default | Description |
|
|
48
|
+
| ------------------- | --------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `variant` | `SmartListContainerVariant` | - | Exposed as the `data-variant` attribute of the `role="list"` element, a hook for your CSS or a custom implementation; the standard adds no styles for it. |
|
|
50
|
+
| `fullWidthOnMobile` | `boolean` | - | Not read by the built-in implementation; available to a custom implementation (edge-to-edge on small screens). |
|
|
51
|
+
|
|
52
|
+
`SmartListContainerVariant` is `'simple-dividers' | 'card-dividers' | 'separate-cards' | 'flat-card-dividers'`.
|
|
53
|
+
|
|
47
54
|
```typescript
|
|
48
55
|
interface IListContainerOptions {
|
|
49
56
|
variant?: SmartListContainerVariant;
|
|
@@ -51,21 +58,18 @@ interface IListContainerOptions {
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
type SmartListContainerVariant =
|
|
54
|
-
'simple' | 'card' | 'separate-cards' | 'flat-card-dividers';
|
|
61
|
+
'simple-dividers' | 'card-dividers' | 'separate-cards' | 'flat-card-dividers';
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
There is no preset for this component: register a component of your own through the token for a styled container.
|
|
58
65
|
|
|
59
66
|
## LIST_CONTAINER_STANDARD_COMPONENT_TOKEN
|
|
60
67
|
|
|
68
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `ListContainerStandardComponent` with a custom implementation. Provide a `Type<ListContainerBaseComponent>` in your application or component providers.
|
|
69
|
+
|
|
61
70
|
```typescript
|
|
62
71
|
import { LIST_CONTAINER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
InjectionToken that allows replacing the default `ListContainerStandardComponent` with a custom implementation. Provide a `Type<ListContainerBaseComponent>` to override.
|
|
66
72
|
|
|
67
|
-
```typescript
|
|
68
|
-
// In your app module or component providers:
|
|
69
73
|
providers: [
|
|
70
74
|
{
|
|
71
75
|
provide: LIST_CONTAINER_STANDARD_COMPONENT_TOKEN,
|
|
@@ -81,7 +85,6 @@ import {
|
|
|
81
85
|
ChangeDetectionStrategy,
|
|
82
86
|
Component,
|
|
83
87
|
computed,
|
|
84
|
-
input,
|
|
85
88
|
ViewEncapsulation,
|
|
86
89
|
} from '@angular/core';
|
|
87
90
|
|
|
@@ -90,17 +93,14 @@ import { ListContainerBaseComponent } from '@smartsoft001/angular';
|
|
|
90
93
|
@Component({
|
|
91
94
|
selector: 'my-custom-list-container',
|
|
92
95
|
template: `
|
|
93
|
-
<
|
|
96
|
+
<ul role="list" [class]="containerClasses()">
|
|
94
97
|
<ng-content />
|
|
95
|
-
</
|
|
98
|
+
</ul>
|
|
96
99
|
`,
|
|
97
100
|
encapsulation: ViewEncapsulation.None,
|
|
98
101
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
99
102
|
})
|
|
100
103
|
export class MyCustomListContainerComponent extends ListContainerBaseComponent {
|
|
101
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
102
|
-
override cssClass = input<string>('');
|
|
103
|
-
|
|
104
104
|
containerClasses = computed(() => {
|
|
105
105
|
const classes = ['my-list-container'];
|
|
106
106
|
const variant = this.options()?.variant;
|
|
@@ -115,33 +115,25 @@ export class MyCustomListContainerComponent extends ListContainerBaseComponent {
|
|
|
115
115
|
}
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
121
|
-
- include `<ng-content />` in your template so consumers can project list items.
|
|
118
|
+
The inherited `cssClass` (input alias `class`) receives the class passed to `<smart-list-container>`, and the wrapper projects its content into the implementation's default `<ng-content />` (wrapped in one `display: contents` element), so include `<ng-content />` in the template.
|
|
122
119
|
|
|
123
120
|
## Usage Examples
|
|
124
121
|
|
|
125
122
|
```html
|
|
126
123
|
<!-- Basic -->
|
|
127
124
|
<smart-list-container>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
125
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
126
|
+
<div role="listitem">Courtney Henry joined the team</div>
|
|
130
127
|
</smart-list-container>
|
|
131
128
|
|
|
132
|
-
<!-- With variant -->
|
|
129
|
+
<!-- With a variant hook (data-variant="separate-cards") -->
|
|
133
130
|
<smart-list-container [options]="{ variant: 'separate-cards' }">
|
|
134
|
-
<
|
|
135
|
-
</smart-list-container>
|
|
136
|
-
|
|
137
|
-
<!-- Full width on mobile (consumed by custom implementations) -->
|
|
138
|
-
<smart-list-container [options]="{ variant: 'card', fullWidthOnMobile: true }">
|
|
139
|
-
<smart-list-item />
|
|
131
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
140
132
|
</smart-list-container>
|
|
141
133
|
|
|
142
134
|
<!-- With external class -->
|
|
143
135
|
<smart-list-container class="smart:my-2">
|
|
144
|
-
<
|
|
136
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
145
137
|
</smart-list-container>
|
|
146
138
|
```
|
|
147
139
|
|
|
@@ -45,6 +45,14 @@ The wrapper projects body content via `<ng-content />` into the `.smart-media-ob
|
|
|
45
45
|
|
|
46
46
|
### IMediaObjectOptions
|
|
47
47
|
|
|
48
|
+
| Field | Type | Default | Description |
|
|
49
|
+
| ------------ | ---------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `alignment` | `'top' \| 'center' \| 'bottom' \| 'stretched'` | - | Vertical alignment of the image against the body; the standard exposes it as `data-alignment` (only when set), the preset aligns the row. |
|
|
51
|
+
| `position` | `'left' \| 'right'` | `'left'` | Side of the image; the standard exposes it as `data-position`, the preset reverses the row for `'right'`. |
|
|
52
|
+
| `responsive` | `boolean` | `false` | Preset only: stacks the image above the body on small screens. |
|
|
53
|
+
| `nested` | `boolean` | `false` | Preset only: the spacing of a media object nested in another one. |
|
|
54
|
+
| `wide` | `boolean` | `false` | Preset only: a wider image (`w-32`). |
|
|
55
|
+
|
|
48
56
|
```typescript
|
|
49
57
|
interface IMediaObjectOptions {
|
|
50
58
|
alignment?: 'top' | 'center' | 'bottom' | 'stretched';
|
|
@@ -55,21 +63,13 @@ interface IMediaObjectOptions {
|
|
|
55
63
|
}
|
|
56
64
|
```
|
|
57
65
|
|
|
58
|
-
The standard renders:
|
|
59
|
-
|
|
60
|
-
- `data-position` attribute: defaults to `'left'` when not provided
|
|
61
|
-
- `data-alignment` attribute: only set when `options.alignment` is provided
|
|
62
|
-
|
|
63
66
|
### MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN
|
|
64
67
|
|
|
68
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `MediaObjectStandardComponent` with a custom implementation. Provide a `Type<MediaObjectBaseComponent>` in your application or component providers; `provideSmartPresets()` provides `MediaObjectPresetComponent` for it together with every other preset.
|
|
69
|
+
|
|
65
70
|
```typescript
|
|
66
71
|
import { MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
InjectionToken that allows replacing the default `MediaObjectStandardComponent` with a custom implementation. Provide a `Type<MediaObjectBaseComponent>` to override.
|
|
70
72
|
|
|
71
|
-
```typescript
|
|
72
|
-
// In your app module or component providers:
|
|
73
73
|
providers: [
|
|
74
74
|
{
|
|
75
75
|
provide: MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN,
|
|
@@ -97,6 +97,8 @@ import { MediaObjectBaseComponent } from '@smartsoft001/angular';
|
|
|
97
97
|
export class MyCustomMediaObjectComponent extends MediaObjectBaseComponent {}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
The wrapper forwards `mediaUrl`, `mediaAlt`, `options` and the `class` (into the inherited `cssClass`), and projects its content into the implementation's default `<ng-content />`.
|
|
101
|
+
|
|
100
102
|
## Usage Examples
|
|
101
103
|
|
|
102
104
|
```html
|
|
@@ -142,9 +144,11 @@ export class MyCustomMediaObjectComponent extends MediaObjectBaseComponent {}
|
|
|
142
144
|
|
|
143
145
|
`MediaObjectPresetComponent` (selector `smart-media-object-preset`) is a styled,
|
|
144
146
|
drop-in replacement for the standard component. It extends
|
|
145
|
-
`MediaObjectStandardComponent` and reuses
|
|
146
|
-
(
|
|
147
|
-
|
|
147
|
+
`MediaObjectStandardComponent` and reuses its inputs, so registering it through
|
|
148
|
+
the token (or with `provideSmartPresets()`) restyles every `<smart-media-object>`.
|
|
149
|
+
It declares `cssClass` without the `class` alias: on the
|
|
150
|
+
`<smart-media-object-preset>` selector bind `[cssClass]`; on
|
|
151
|
+
`<smart-media-object>` pass `class` as usual.
|
|
148
152
|
|
|
149
153
|
Look: a flex row (`smart:flex smart:gap-4`) with a rounded, cover-fitted
|
|
150
154
|
thumbnail (`smart:size-16 smart:rounded-lg smart:object-cover smart:shrink-0`)
|
|
@@ -170,7 +174,7 @@ aware.
|
|
|
170
174
|
`smart-media-object-body` marker class is preserved for content projection
|
|
171
175
|
parity with the standard component.
|
|
172
176
|
|
|
173
|
-
Register it as the standard replacement
|
|
177
|
+
Register it as the standard replacement by providing it for `MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN`.
|
|
174
178
|
|
|
175
179
|
```ts
|
|
176
180
|
import { MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
@@ -184,9 +188,7 @@ providers: [
|
|
|
184
188
|
],
|
|
185
189
|
```
|
|
186
190
|
|
|
187
|
-
|
|
188
|
-
(`getMediaObjectRootClasses`, `getMediaObjectMediaClasses`,
|
|
189
|
-
`getMediaObjectBodyClasses`).
|
|
191
|
+
The class recipes are internal to the preset (not exported).
|
|
190
192
|
|
|
191
193
|
Gaps: the media is always an `<img>` (no icon/video slot), and `wide` uses a
|
|
192
194
|
fixed `w-32`/`h-16` footprint rather than an intrinsic aspect ratio.
|
|
@@ -12,12 +12,13 @@ The `<smart-modal>` component provides a dialog overlay with title, description,
|
|
|
12
12
|
|
|
13
13
|
- Developer wants to use or customize the modal/dialog component
|
|
14
14
|
- Developer asks about `<smart-modal>`, `ModalComponent`, `ModalStandardComponent`, or `ModalBaseComponent`
|
|
15
|
+
- Developer wants to open a component in a modal from code and await its result (`ModalService`)
|
|
15
16
|
|
|
16
17
|
## Components
|
|
17
18
|
|
|
18
19
|
### ModalComponent (`<smart-modal>`)
|
|
19
20
|
|
|
20
|
-
Main wrapper component. Renders `ModalStandardComponent` by default. When `MODAL_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
21
|
+
Main wrapper component. Renders `ModalStandardComponent` by default. When `MODAL_STANDARD_COMPONENT_TOKEN` is provided (or `provideSmartPresets()` registers the preset), renders the injected component via `NgComponentOutlet` and forwards its inputs, its projected content, the `actionClick` and `closed` outputs and the `open` model changes. A footer action **keeps the modal open**: set `open` to `false` in the `(actionClick)` handler.
|
|
21
22
|
|
|
22
23
|
### ModalStandardComponent (`<smart-modal-standard>`)
|
|
23
24
|
|
|
@@ -25,11 +26,11 @@ Barebones placeholder concrete implementation. Renders a native `<dialog [open]
|
|
|
25
26
|
|
|
26
27
|
### ModalPresetComponent (`<smart-modal-preset>`)
|
|
27
28
|
|
|
28
|
-
Styled variation that extends `ModalBaseComponent` and is a drop-in replacement for `ModalStandardComponent`. Register it via `MODAL_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-modal>`, or use the `<smart-modal-preset>` selector directly. It renders a translated Preline overlay — a full-screen scrollable backdrop hosting a `rounded-xl` card with a header (`title` + optional dismiss `×`), a body (`description` + projected content), and a footer of action buttons. The look is selected through `options.variant` (default `'centered'`): `centered`/`alert` are vertically centered (`alert` is narrower), `wide` is a top-aligned large dialog, and `left-aligned-buttons` left-aligns the footer. `options.footerStyle: 'gray'` tints the footer, and action buttons are styled by their `variant` (`primary`/`secondary`/`danger`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants
|
|
29
|
+
Styled variation that extends `ModalBaseComponent` and is a drop-in replacement for `ModalStandardComponent`. Register it via `MODAL_STANDARD_COMPONENT_TOKEN` (or with `provideSmartPresets()`) to restyle every `<smart-modal>`, or use the `<smart-modal-preset>` selector directly. It renders a translated Preline overlay — a full-screen scrollable backdrop hosting a `rounded-xl` card with a header (`title` + optional dismiss `×`), a body (`description` + projected content), and a footer of action buttons. The look is selected through `options.variant` (default `'centered'`): `centered`/`alert` are vertically centered (`alert` is narrower), `wide` is a top-aligned large dialog, and `left-aligned-buttons` left-aligns the footer. `options.footerStyle: 'gray'` tints the footer, and action buttons are styled by their `variant` (`primary`/`secondary`/`danger`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset (not exported).
|
|
29
30
|
|
|
30
|
-
> **Preline JS is NOT used.** Open/close is driven entirely by the existing `open` model signal + `@if` (no `HSOverlay`, no `data-hs-*`). The component binds its own dismiss UX: clicking the backdrop and pressing `Escape` both call `close()` (which sets `open` to `false` and emits `closed`). The dialog ARIA contract is preserved (`role="dialog"`, `aria-modal="true"`, `aria-labelledby` when `title` is set, else `aria-label` from `options.ariaLabel`). The header dismiss `×` button is only shown when `options.withDismiss` is `true`.
|
|
31
|
+
> **Preline JS is NOT used.** Open/close is driven entirely by the existing `open` model signal + `@if` (no `HSOverlay`, no `data-hs-*`). The component binds its own dismiss UX: clicking the backdrop and pressing `Escape` both call `close()` (which sets `open` to `false` and emits `closed`). With preset modals stacked (a modal opened from a modal), `Escape` closes only the one on top. The dialog ARIA contract is preserved (`role="dialog"`, `aria-modal="true"`, `aria-labelledby` when `title` is set, else `aria-label` from `options.ariaLabel`). The header dismiss `×` button is only shown when `options.withDismiss` is `true`.
|
|
31
32
|
>
|
|
32
|
-
>
|
|
33
|
+
> `ModalPresetComponent` declares `cssClass` without the `class` alias (applied to the centering wrapper): bind it as `[cssClass]` on the `<smart-modal-preset>` selector, or pass `class` on `<smart-modal>` (the wrapper forwards it).
|
|
33
34
|
|
|
34
35
|
### ModalBaseComponent (abstract)
|
|
35
36
|
|
|
@@ -57,6 +58,12 @@ Abstract base directive for extending custom modal implementations. Exposes `ope
|
|
|
57
58
|
|
|
58
59
|
### IModalAction
|
|
59
60
|
|
|
61
|
+
| Field | Type | Default | Description |
|
|
62
|
+
| --------- | -------------------------------------- | ----------- | -------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `id` | `string` | required | Reported as `actionId` by `actionClick`. |
|
|
64
|
+
| `label` | `string` | required | Button text. |
|
|
65
|
+
| `variant` | `'primary' \| 'secondary' \| 'danger'` | `'primary'` | The standard exposes it as `data-variant` on the button; the preset styles the button by it. |
|
|
66
|
+
|
|
60
67
|
```typescript
|
|
61
68
|
interface IModalAction {
|
|
62
69
|
id: string;
|
|
@@ -67,6 +74,13 @@ interface IModalAction {
|
|
|
67
74
|
|
|
68
75
|
### IModalOptions
|
|
69
76
|
|
|
77
|
+
| Field | Type | Default | Description |
|
|
78
|
+
| ------------- | ----------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `variant` | `'centered' \| 'wide' \| 'alert' \| 'left-aligned-buttons'` | `'centered'` | Preset only: `centered` and `alert` (narrower) are vertically centred, `wide` is a top-aligned large dialog, `left-aligned-buttons` left-aligns the footer. |
|
|
80
|
+
| `withDismiss` | `boolean` | `false` | Renders a close (×) button that calls `close()`. |
|
|
81
|
+
| `footerStyle` | `'default' \| 'gray'` | `'default'` | Preset only: `gray` gives the footer a gray background. |
|
|
82
|
+
| `ariaLabel` | `string` | - | The `aria-label` of the dialog when there is no `title`. |
|
|
83
|
+
|
|
70
84
|
```typescript
|
|
71
85
|
interface IModalOptions {
|
|
72
86
|
variant?: 'centered' | 'wide' | 'alert' | 'left-aligned-buttons';
|
|
@@ -76,17 +90,15 @@ interface IModalOptions {
|
|
|
76
90
|
}
|
|
77
91
|
```
|
|
78
92
|
|
|
79
|
-
The default `ModalStandardComponent` consumes `withDismiss`
|
|
93
|
+
The default `ModalStandardComponent` consumes `withDismiss` and `ariaLabel`; `variant` and `footerStyle` are read by `ModalPresetComponent` (and are available to a custom implementation).
|
|
80
94
|
|
|
81
95
|
## MODAL_STANDARD_COMPONENT_TOKEN
|
|
82
96
|
|
|
97
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `ModalStandardComponent` with a custom implementation. Provide a `Type<ModalBaseComponent>` in your application or component providers; `provideSmartPresets()` provides `ModalPresetComponent` for it together with every other preset.
|
|
98
|
+
|
|
83
99
|
```typescript
|
|
84
100
|
import { MODAL_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
85
|
-
```
|
|
86
101
|
|
|
87
|
-
InjectionToken that allows replacing the default `ModalStandardComponent` with a custom implementation. Provide a `Type<ModalBaseComponent>` to override.
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
102
|
providers: [
|
|
91
103
|
{
|
|
92
104
|
provide: MODAL_STANDARD_COMPONENT_TOKEN,
|
|
@@ -105,7 +117,6 @@ providers: [
|
|
|
105
117
|
import {
|
|
106
118
|
ChangeDetectionStrategy,
|
|
107
119
|
Component,
|
|
108
|
-
input,
|
|
109
120
|
ViewEncapsulation,
|
|
110
121
|
} from '@angular/core';
|
|
111
122
|
|
|
@@ -126,6 +137,7 @@ import { ModalBaseComponent } from '@smartsoft001/angular';
|
|
|
126
137
|
@if (description()) {
|
|
127
138
|
<p>{{ description() }}</p>
|
|
128
139
|
}
|
|
140
|
+
<ng-content />
|
|
129
141
|
<footer>
|
|
130
142
|
@for (action of actions(); track action.id) {
|
|
131
143
|
<button (click)="invokeAction(action.id)">{{ action.label }}</button>
|
|
@@ -136,15 +148,11 @@ import { ModalBaseComponent } from '@smartsoft001/angular';
|
|
|
136
148
|
encapsulation: ViewEncapsulation.None,
|
|
137
149
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
138
150
|
})
|
|
139
|
-
export class MyCustomModalComponent extends ModalBaseComponent {
|
|
140
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
141
|
-
override cssClass = input<string>('');
|
|
142
|
-
}
|
|
151
|
+
export class MyCustomModalComponent extends ModalBaseComponent {}
|
|
143
152
|
```
|
|
144
153
|
|
|
145
|
-
When extending the base directly, remember to:
|
|
154
|
+
The inherited `cssClass` (input alias `class`) receives the class passed to `<smart-modal>`. When extending the base directly, remember to:
|
|
146
155
|
|
|
147
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) when the component is used via `NgComponentOutlet` through `MODAL_STANDARD_COMPONENT_TOKEN`,
|
|
148
156
|
- call `invokeAction(id)` to emit `actionClick`, and `close()` to emit `closed` and set `open.set(false)`,
|
|
149
157
|
- implement `Escape` key handling and backdrop click yourself if you want native UX — the base does not bind any keyboard or backdrop listeners.
|
|
150
158
|
|
|
@@ -174,13 +182,66 @@ When extending the base directly, remember to:
|
|
|
174
182
|
<smart-modal [(open)]="open" class="smart:p-4" />
|
|
175
183
|
```
|
|
176
184
|
|
|
185
|
+
## Opening a component in a modal from code
|
|
186
|
+
|
|
187
|
+
`ModalService.show(options)` (provided by `SharedServicesModule`) creates `options.component` inside a `<smart-modal>` at the end of `<body>` and resolves with an `IModal`. The modal is the implementation registered for `MODAL_STANDARD_COMPONENT_TOKEN` (the preset with `provideSmartPresets()`) and shows its close button (`withDismiss`). `props` become the component's inputs (keys it does not declare as inputs are left out), and a component that declares a `dismiss` input gets the function that closes its modal. A component can also inject `ModalService` and call `dismiss(data)`: it resolves to the service that opened it. The modals stack; `ModalService.dismiss(data)` closes the one opened last. Closing a modal restores the focus to the element focused before it opened.
|
|
188
|
+
|
|
189
|
+
| Option | Type | Default | Description |
|
|
190
|
+
| ----------------- | ----------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
191
|
+
| `component` | `any` | required | The component rendered in the modal. |
|
|
192
|
+
| `props` | `any` | - | Its inputs, by input name. |
|
|
193
|
+
| `mode` | `'default' \| 'bottom'` | `'default'` | `'bottom'` adds the `smart-modal-bottom` class to the modal for the application to style; the modal element carries `data-mode`. |
|
|
194
|
+
| `cssClass` | `string[]` | - | Classes passed to the modal as `class`. |
|
|
195
|
+
| `backdropDismiss` | `boolean` | `true` | `false` keeps the modal open on a click on its backdrop and on Escape; its close button and `dismiss()` still close it. |
|
|
196
|
+
| `injector` | `Injector` | - | The injector the component resolves its dependencies from (e.g. the opener's `inject(Injector)`), the service's otherwise. |
|
|
197
|
+
|
|
198
|
+
| `IModal` member | Type | Description |
|
|
199
|
+
| ---------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
200
|
+
| `dismiss(data?)` | `(data?: any) => void` | Closes the modal. |
|
|
201
|
+
| `onDidDismiss()` | `() => Promise<{ data: any }>` | Resolves once the modal is closed, with the data it was closed with; `{ data: null }` for its close button, the backdrop or Escape. |
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { Component, inject, input } from '@angular/core';
|
|
205
|
+
|
|
206
|
+
import { ModalService } from '@smartsoft001/angular';
|
|
207
|
+
|
|
208
|
+
@Component({
|
|
209
|
+
selector: 'app-rename-form',
|
|
210
|
+
template: `
|
|
211
|
+
<input #name [value]="name()" />
|
|
212
|
+
<button type="button" (click)="dismiss()?.(name.value)">Save</button>
|
|
213
|
+
`,
|
|
214
|
+
})
|
|
215
|
+
export class RenameFormComponent {
|
|
216
|
+
name = input('');
|
|
217
|
+
dismiss = input<(data?: unknown) => void>();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export class RenameAction {
|
|
221
|
+
private modalService = inject(ModalService);
|
|
222
|
+
|
|
223
|
+
async rename(name: string): Promise<string | null> {
|
|
224
|
+
const modal = await this.modalService.show({
|
|
225
|
+
component: RenameFormComponent,
|
|
226
|
+
props: { name },
|
|
227
|
+
});
|
|
228
|
+
const { data } = await modal.onDidDismiss();
|
|
229
|
+
|
|
230
|
+
return typeof data === 'string' ? data : null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`[smartDetails]` and `DetailsPage` (see `angular-components-details`) open details through the same service.
|
|
236
|
+
|
|
177
237
|
## File Locations
|
|
178
238
|
|
|
179
239
|
- Wrapper: `packages/shared/angular/src/lib/components/modal/modal.component.ts`
|
|
180
240
|
- Standard: `packages/shared/angular/src/lib/components/modal/standard/standard.component.ts`
|
|
181
241
|
- Preset variation: `packages/shared/angular/src/lib/components/modal/preset/preset.component.ts`
|
|
182
|
-
- Preset class recipes: `packages/shared/angular/src/lib/components/modal/preset/preset-classes.util.ts`
|
|
242
|
+
- Preset class recipes (internal, not exported): `packages/shared/angular/src/lib/components/modal/preset/preset-classes.util.ts`
|
|
183
243
|
- Base class: `packages/shared/angular/src/lib/components/modal/base/base.component.ts`
|
|
184
244
|
- Stories: `packages/shared/angular/src/lib/components/modal/modal.component.stories.ts`
|
|
185
245
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`MODAL_STANDARD_COMPONENT_TOKEN`)
|
|
186
246
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IModalAction`, `IModalOptions`)
|
|
247
|
+
- Service: `packages/shared/angular/src/lib/services/modal/modal.service.ts` (`ModalService`, `IModalServiceOptions`, `IModal`)
|
|
@@ -17,7 +17,7 @@ The `<smart-multi-column-layout>` component provides a three-column application
|
|
|
17
17
|
|
|
18
18
|
### MultiColumnLayoutComponent (`<smart-multi-column-layout>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `MultiColumnLayoutStandardComponent` by default. When `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Accepts main content via projected `<ng-content
|
|
20
|
+
Main wrapper component. Renders `MultiColumnLayoutStandardComponent` by default. When `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN` is provided (or `provideSmartPresets()` registers the preset), renders the injected component via `NgComponentOutlet`, forwarding `options` and the `class`. Accepts main content via projected `<ng-content>`, which reaches the injected component's default `<ng-content />` as well.
|
|
21
21
|
|
|
22
22
|
### MultiColumnLayoutStandardComponent (`<smart-multi-column-layout-standard>`)
|
|
23
23
|
|
|
@@ -31,13 +31,22 @@ Abstract base directive for extending custom multi-column-layout implementations
|
|
|
31
31
|
|
|
32
32
|
### Inputs
|
|
33
33
|
|
|
34
|
-
| Input | Type | Default | Description
|
|
35
|
-
| --------- | ----------------------------------------------------- | ------- |
|
|
36
|
-
| `options` | `InputSignal<IMultiColumnLayoutOptions \| undefined>` | - | Optional configuration (
|
|
37
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | ----------------------------------------------------- | ------- | ----------------------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<IMultiColumnLayoutOptions \| undefined>` | - | Optional configuration (header, nav and secondary slots, title, widths) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
38
|
|
|
39
39
|
### IMultiColumnLayoutOptions
|
|
40
40
|
|
|
41
|
+
| Field | Type | Default | Description |
|
|
42
|
+
| ---------------- | ------------------------- | -------- | ----------------------------------------------------------------------------------- |
|
|
43
|
+
| `headerTpl` | `TemplateRef<unknown>` | - | The header zone (`<header>`); wins over `title` in the preset. |
|
|
44
|
+
| `navTpl` | `TemplateRef<unknown>` | - | The navigation column (`<aside class="nav">`). |
|
|
45
|
+
| `secondaryTpl` | `TemplateRef<unknown>` | - | The secondary column (`<aside class="secondary">`), e.g. details or activity. |
|
|
46
|
+
| `title` | `string` | - | Preset only: an `<h1>` in the header zone when `headerTpl` is not set. |
|
|
47
|
+
| `width` | `'full' \| 'constrained'` | `'full'` | Preset only: `constrained` caps the main content container at `max-w-7xl`, centred. |
|
|
48
|
+
| `secondaryWidth` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Preset only: the width of the secondary column (`w-64`, `w-80`, `w-96`). |
|
|
49
|
+
|
|
41
50
|
```typescript
|
|
42
51
|
type SmartMultiColumnLayoutWidth = 'full' | 'constrained';
|
|
43
52
|
type SmartMultiColumnLayoutSecondaryWidth = 'sm' | 'md' | 'lg';
|
|
@@ -52,17 +61,15 @@ interface IMultiColumnLayoutOptions {
|
|
|
52
61
|
}
|
|
53
62
|
```
|
|
54
63
|
|
|
55
|
-
The default `MultiColumnLayoutStandardComponent` consumes `navTpl`, `secondaryTpl
|
|
64
|
+
The default `MultiColumnLayoutStandardComponent` consumes `navTpl`, `secondaryTpl` and `headerTpl`; `title`, `width` and `secondaryWidth` are read by `MultiColumnLayoutPresetComponent` (and are available to a custom implementation).
|
|
56
65
|
|
|
57
66
|
## MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN
|
|
58
67
|
|
|
68
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `MultiColumnLayoutStandardComponent` with a custom implementation. Provide a `Type<MultiColumnLayoutBaseComponent>` in your application or component providers; `provideSmartPresets()` provides `MultiColumnLayoutPresetComponent` for it together with every other preset.
|
|
69
|
+
|
|
59
70
|
```typescript
|
|
60
71
|
import { MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
61
|
-
```
|
|
62
72
|
|
|
63
|
-
InjectionToken that allows replacing the default `MultiColumnLayoutStandardComponent` with a custom implementation. Provide a `Type<MultiColumnLayoutBaseComponent>` to override.
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
73
|
providers: [
|
|
67
74
|
{
|
|
68
75
|
provide: MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
@@ -78,7 +85,6 @@ import {
|
|
|
78
85
|
ChangeDetectionStrategy,
|
|
79
86
|
Component,
|
|
80
87
|
computed,
|
|
81
|
-
input,
|
|
82
88
|
ViewEncapsulation,
|
|
83
89
|
} from '@angular/core';
|
|
84
90
|
import { NgTemplateOutlet } from '@angular/common';
|
|
@@ -114,9 +120,6 @@ import { MultiColumnLayoutBaseComponent } from '@smartsoft001/angular';
|
|
|
114
120
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
115
121
|
})
|
|
116
122
|
export class MyCustomMultiColumnLayoutComponent extends MultiColumnLayoutBaseComponent {
|
|
117
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
118
|
-
override cssClass = input<string>('');
|
|
119
|
-
|
|
120
123
|
containerClasses = computed(() => {
|
|
121
124
|
const classes = ['my-multi-column-layout'];
|
|
122
125
|
const extra = this.cssClass();
|
|
@@ -194,7 +197,7 @@ The preset consumes the full `IMultiColumnLayoutOptions` surface (the standard c
|
|
|
194
197
|
- `secondaryWidth` — `'sm'` → `w-64` (default), `'md'` → `w-80`, `'lg'` → `w-96`.
|
|
195
198
|
- `headerTpl` / `title`, `navTpl`, `secondaryTpl` — as above.
|
|
196
199
|
|
|
197
|
-
|
|
200
|
+
The class recipes are internal to the preset (not exported).
|
|
198
201
|
|
|
199
202
|
### Token registration
|
|
200
203
|
|
|
@@ -210,7 +213,7 @@ providers: [
|
|
|
210
213
|
];
|
|
211
214
|
```
|
|
212
215
|
|
|
213
|
-
|
|
216
|
+
Provide it for `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN` as above, or use `provideSmartPresets()`. The preset declares `cssClass` without the `class` alias: on the `<smart-multi-column-layout-preset>` selector bind `[cssClass]`; on `<smart-multi-column-layout>` pass `class` as usual.
|
|
214
217
|
|
|
215
218
|
### Gaps
|
|
216
219
|
|
|
@@ -17,17 +17,17 @@ The `<smart-navbar>` component renders a top navigation bar with a logo, primary
|
|
|
17
17
|
|
|
18
18
|
### NavbarComponent (`<smart-navbar>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `NavbarStandardComponent` by default. When `NAVBAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
20
|
+
Main wrapper. Delegates to `NavbarStandardComponent` by default. When `NAVBAR_STANDARD_COMPONENT_TOKEN` is provided (or `provideSmartPresets()` registers the preset), renders the injected component via `NgComponentOutlet`. In both cases it forwards `options` and the `class`, re-emits `itemClick` and keeps the two-way `mobileMenuOpen` in sync. Items with an `href` render as plain `<a [href]>` links (no `routerLink`, so a click loads the URL); items without `href` are buttons reported through `itemClick`.
|
|
21
21
|
|
|
22
22
|
### NavbarStandardComponent (`<smart-navbar-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="navbar">` containing a mobile menu toggle button, optional logo (`logoTpl` or `<img>` from `logoUrl`/`logoAlt`, wrapped in `<a>` when `logoHref` provided), a primary `<ul>` of items (each rendered as `<a class="item-link">` when `href` is provided, otherwise `<button class="item-button">` emitting `itemClick`; gets `current` class when `item.current === true`), and template-ref slots `searchTpl` / `actionTpl` / `notificationTpl` / `userMenuTpl`. Optionally renders a `<nav class="navbar-secondary">` row when `options.secondaryItems` is non-empty, and a `.mobile-menu` panel when `mobileMenuOpen()` is `true`.
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="navbar">` containing a mobile menu toggle button, optional logo (`logoTpl` as is, or an `<img>` from `logoUrl`/`logoAlt`, wrapped in `<a>` when `logoHref` is provided), a primary `<ul>` of items (each rendered as `<a class="item-link">` when `href` is provided, otherwise `<button class="item-button">` emitting `itemClick`; gets `current` class when `item.current === true`; `iconTpl` before the label), and template-ref slots `searchTpl` / `actionTpl` / `notificationTpl` / `userMenuTpl`. Optionally renders a `<nav class="navbar-secondary">` row when `options.secondaryItems` is non-empty, and a `.mobile-menu` panel when `mobileMenuOpen()` is `true`.
|
|
25
25
|
|
|
26
26
|
### NavbarPresetComponent (`<smart-navbar-preset>`)
|
|
27
27
|
|
|
28
|
-
Fully-styled, drop-in concrete implementation extending `NavbarBaseComponent`, translating the Preline collapsible navbar look to `smart:`-prefixed Tailwind classes with explicit `dark:` variants. Renders a `<header>` with a brand/logo slot (`logoTpl`, or `<img>` from `logoUrl`/`logoAlt`, wrapped in `<a>` when `logoHref` is set), a responsive primary link row (anchors for items with `href`, otherwise buttons emitting `itemClick`; `current` items get the active/`aria-current="page"` styling), the `searchTpl` / `actionTpl` / `notificationTpl` / `userMenuTpl` slots, an optional secondary link row from `secondaryItems`, and a mobile menu toggle. The mobile collapse is driven entirely by the two-way `mobileMenuOpen` signal (`@if` + `(click)`), so no Preline JS runtime is needed. `options.dark` switches to the solid dark color variant and `options.menuButtonOnLeft` moves the toggle ahead of the brand.
|
|
28
|
+
Fully-styled, drop-in concrete implementation extending `NavbarBaseComponent`, translating the Preline collapsible navbar look to `smart:`-prefixed Tailwind classes with explicit `dark:` variants. Renders a `<header>` with a brand/logo slot (`logoTpl`, or `<img>` from `logoUrl`/`logoAlt`, either wrapped in `<a>` when `logoHref` is set), a responsive primary link row (anchors for items with `href`, otherwise buttons emitting `itemClick`; `current` items get the active/`aria-current="page"` styling), the `searchTpl` / `actionTpl` / `notificationTpl` / `userMenuTpl` slots, an optional secondary link row from `secondaryItems`, and a mobile menu toggle. The mobile collapse is driven entirely by the two-way `mobileMenuOpen` signal (`@if` + `(click)`), so no Preline JS runtime is needed. `options.dark` switches to the solid dark color variant and `options.menuButtonOnLeft` moves the toggle ahead of the brand.
|
|
29
29
|
|
|
30
|
-
Register it via `NAVBAR_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-navbar>`, or use the `<smart-navbar-preset>` selector directly.
|
|
30
|
+
Register it via `NAVBAR_STANDARD_COMPONENT_TOKEN` (or with `provideSmartPresets()`) to restyle every `<smart-navbar>`, or use the `<smart-navbar-preset>` selector directly. The preset declares `cssClass` without the `class` alias: on the `<smart-navbar-preset>` selector bind `[cssClass]`; on `<smart-navbar>` pass `class` as usual.
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
33
|
import {
|
|
@@ -72,16 +72,35 @@ Abstract base directive. Exposes:
|
|
|
72
72
|
|
|
73
73
|
### INavbarOptions
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
| Field | Type | Default | Description |
|
|
76
|
+
| ------------------ | ---------------------- | ------- | ------------------------------------------------------------------------------------- |
|
|
77
|
+
| `logoTpl` | `TemplateRef<unknown>` | - | The brand as a template; wins over the logo image. |
|
|
78
|
+
| `logoUrl` | `string` | - | Logo image URL. |
|
|
79
|
+
| `logoAlt` | `string` | `''` | Alt text of the logo image. |
|
|
80
|
+
| `logoHref` | `string` | - | Link of the logo (the standard links the image only, the preset links `logoTpl` too). |
|
|
81
|
+
| `items` | `INavbarItem[]` | `[]` | The primary links (also listed in the mobile menu of the standard). |
|
|
82
|
+
| `secondaryItems` | `INavbarItem[]` | `[]` | A second row of links. |
|
|
83
|
+
| `searchTpl` | `TemplateRef<unknown>` | - | Search slot. |
|
|
84
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Quick-action slot (e.g. a "New" button). |
|
|
85
|
+
| `notificationTpl` | `TemplateRef<unknown>` | - | Notifications slot. |
|
|
86
|
+
| `userMenuTpl` | `TemplateRef<unknown>` | - | User menu slot (e.g. an avatar dropdown). |
|
|
87
|
+
| `dark` | `boolean` | `false` | Preset only: the solid dark colour variant. |
|
|
88
|
+
| `menuButtonOnLeft` | `boolean` | `false` | Preset only: places the mobile menu button before the brand. |
|
|
89
|
+
| `layout` | `SmartNavbarLayout` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
90
|
+
|
|
91
|
+
`SmartNavbarLayout` is `'simple' | 'simple-with-menu-on-left' | 'with-quick-action' | 'with-search' | 'with-centered-search' | 'with-secondary-links' | 'with-column-layout'`.
|
|
92
|
+
|
|
93
|
+
### INavbarItem
|
|
94
|
+
|
|
95
|
+
| Field | Type | Default | Description |
|
|
96
|
+
| --------- | ---------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
97
|
+
| `id` | `string` | required | Reported as `itemId` by `itemClick`. |
|
|
98
|
+
| `label` | `string` | - | Link text. |
|
|
99
|
+
| `href` | `string` | - | Renders a plain `<a [href]>`; without it the item is a button (`itemClick`). |
|
|
100
|
+
| `current` | `boolean` | - | Marks the current page (`current` class; `aria-current="page"` in the preset). |
|
|
101
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Icon before the label (primary row only). |
|
|
84
102
|
|
|
103
|
+
```typescript
|
|
85
104
|
interface INavbarOptions {
|
|
86
105
|
layout?: SmartNavbarLayout;
|
|
87
106
|
dark?: boolean;
|
|
@@ -107,8 +126,12 @@ interface INavbarItem {
|
|
|
107
126
|
}
|
|
108
127
|
```
|
|
109
128
|
|
|
129
|
+
The wrapper does not move `current` itself: to highlight the clicked item, keep the current id in your component and rebuild `items` with `current: item.id === activeId` in the `(itemClick)` handler.
|
|
130
|
+
|
|
110
131
|
## NAVBAR_STANDARD_COMPONENT_TOKEN
|
|
111
132
|
|
|
133
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `NavbarStandardComponent` with a custom implementation. Provide a `Type<NavbarBaseComponent>` in your application or component providers; `provideSmartPresets()` provides `NavbarPresetComponent` for it together with every other preset.
|
|
134
|
+
|
|
112
135
|
```typescript
|
|
113
136
|
import { NAVBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
114
137
|
|
|
@@ -126,7 +149,6 @@ providers: [
|
|
|
126
149
|
import {
|
|
127
150
|
ChangeDetectionStrategy,
|
|
128
151
|
Component,
|
|
129
|
-
input,
|
|
130
152
|
ViewEncapsulation,
|
|
131
153
|
} from '@angular/core';
|
|
132
154
|
|
|
@@ -150,10 +172,7 @@ import { NavbarBaseComponent } from '@smartsoft001/angular';
|
|
|
150
172
|
encapsulation: ViewEncapsulation.None,
|
|
151
173
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
152
174
|
})
|
|
153
|
-
export class MyCustomNavbarComponent extends NavbarBaseComponent {
|
|
154
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
155
|
-
override cssClass = input<string>('');
|
|
156
|
-
}
|
|
175
|
+
export class MyCustomNavbarComponent extends NavbarBaseComponent {}
|
|
157
176
|
```
|
|
158
177
|
|
|
159
178
|
## Usage Examples
|
|
@@ -162,7 +181,7 @@ export class MyCustomNavbarComponent extends NavbarBaseComponent {
|
|
|
162
181
|
<!-- Simple navbar -->
|
|
163
182
|
<smart-navbar
|
|
164
183
|
[options]="{
|
|
165
|
-
logoUrl: '/
|
|
184
|
+
logoUrl: 'https://tailwindcss.com/plus-assets/img/logos/mark.svg?color=indigo&shade=600',
|
|
166
185
|
logoAlt: 'Acme',
|
|
167
186
|
logoHref: '/',
|
|
168
187
|
items: [
|
|
@@ -183,7 +202,6 @@ export class MyCustomNavbarComponent extends NavbarBaseComponent {
|
|
|
183
202
|
|
|
184
203
|
<smart-navbar
|
|
185
204
|
[options]="{
|
|
186
|
-
layout: 'with-search',
|
|
187
205
|
items: items,
|
|
188
206
|
searchTpl: search,
|
|
189
207
|
userMenuTpl: userMenu,
|
|
@@ -196,7 +214,6 @@ export class MyCustomNavbarComponent extends NavbarBaseComponent {
|
|
|
196
214
|
[(mobileMenuOpen)]="open"
|
|
197
215
|
[options]="{
|
|
198
216
|
dark: true,
|
|
199
|
-
layout: 'with-secondary-links',
|
|
200
217
|
items: primary,
|
|
201
218
|
secondaryItems: secondary,
|
|
202
219
|
}"
|