@smartsoft001/claude-plugins 2.200.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
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Progress Bars Component
|
|
8
8
|
|
|
9
|
-
The `<smart-progress-bars>` component renders either a list of progress steps (
|
|
9
|
+
The `<smart-progress-bars>` component renders either a list of progress steps (`options.steps`, each `complete`, `current` or `upcoming`) or a percentage-based bar with optional column labels. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `ProgressBarsBaseComponent` defines the shared API — `options` (`IProgressBarsOptions`), `cssClass` (alias `class`), and the `stepClick` output. `ProgressBarsStandardComponent` is a barebones placeholder using native HTML. `ProgressBarsComponent` is the public wrapper that renders `ProgressBarsStandardComponent` by default and accepts a custom replacement via `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -17,28 +17,25 @@ The `<smart-progress-bars>` component renders either a list of progress steps (w
|
|
|
17
17
|
|
|
18
18
|
### ProgressBarsComponent (`<smart-progress-bars>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper. Delegates to `ProgressBarsStandardComponent` by default. When `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper. Delegates to `ProgressBarsStandardComponent` by default. When `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, hands it the `options` and `class` inputs and re-emits its `stepClick`, so `(stepClick)` on `<smart-progress-bars>` works with any implementation.
|
|
21
21
|
|
|
22
22
|
### ProgressBarsStandardComponent (`<smart-progress-bars-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder.
|
|
24
|
+
Barebones placeholder. `options.layout` selects one of two rendering modes.
|
|
25
25
|
|
|
26
|
-
**Step mode (default; layouts `simple`, `panels`, `bullets`, `panels-with-border`, `circles`, `bullets-and-text`, `circles-with-text`)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
**Bar mode (layout `progress-bar`):**
|
|
30
|
-
Renders `<div class="progress-bars-bar-wrapper">` with optional `<h4 class="sr-only">` (from `srOnlyTitle`), optional `<p class="progress-bars-title">` (from `title`), a track + `<div class="progress-bars-fill" role="progressbar">` (width = clamped `value` 0–100), and optional `<div class="progress-bars-columns">` row of column labels (each with `active` class when `column.active === true`).
|
|
26
|
+
- **Step mode** (default; layouts `simple`, `panels`, `bullets`, `panels-with-border`, `circles`, `bullets-and-text`, `circles-with-text`): renders `<nav class="progress-bars">` (with `aria-label` from `options.ariaLabel` or default `"Progress"`), an optional `<p class="progress-bars-title">` from `options.title`, and an `<ol>` of `options.steps`. The `data-layout` attribute reflects `options.layout` so each visual variant can be styled. Each step renders as `<a class="progress-bars-step-link" href>` (when `href` is set) or `<button class="progress-bars-step-button">` (otherwise; a click emits `stepClick` with the step `id`). Steps get the `current` class and `aria-current="step"` when `status === 'current'`. The `data-status` attribute on the `<li>` reflects `status` (default `'upcoming'`). Each step shows `iconTpl` or, without it, `index` (e.g. `"02"`), then `name` and `description`, in every step layout.
|
|
27
|
+
- **Bar mode** (layout `progress-bar`): renders `<div class="progress-bars-bar-wrapper">` with an optional `<h4 class="sr-only">` (from `srOnlyTitle`), an optional `<p class="progress-bars-title">` (from `title`), a track + `<div class="progress-bars-fill" role="progressbar">` (width = `value` clamped to 0–100) and an optional `<div class="progress-bars-columns">` row of column labels (each with the `active` class when `column.active === true`). `ariaLabel` is not used in this mode.
|
|
31
28
|
|
|
32
29
|
### ProgressBarsPresetComponent (`<smart-progress-bars-preset>`)
|
|
33
30
|
|
|
34
|
-
Fully-styled variation that extends `ProgressBarsBaseComponent` and is a drop-in replacement for `ProgressBarsStandardComponent`. Register it via `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-progress-bars>`, or use the `<smart-progress-bars-preset>` selector directly. It renders both modes off the shared `IProgressBarsOptions` API
|
|
31
|
+
Fully-styled variation that extends `ProgressBarsBaseComponent` and is a drop-in replacement for `ProgressBarsStandardComponent`. Register it via `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-progress-bars>`, or use the `<smart-progress-bars-preset>` selector directly. It renders both modes off the shared `IProgressBarsOptions` API.
|
|
35
32
|
|
|
36
|
-
- **Percentage bar** (`layout: 'progress-bar'`): a rounded track + animated `bg-blue-600` fill sized to the clamped `value` (0–100). Shows a title header with a `value%` label when `title` is set, an `sr-only` `<h4>` from `srOnlyTitle`, and a grid of column captions from `columns` (active columns rendered semibold).
|
|
37
|
-
- **Stepper** (all other layouts): a `<nav
|
|
33
|
+
- **Percentage bar** (`layout: 'progress-bar'`): a rounded track + animated `bg-blue-600` fill sized to the clamped `value` (0–100). The track is the `role="progressbar"` element and carries `options.ariaLabel` (default `"Progress"`) as its `aria-label`. Shows a title header with a `value%` label when `title` is set, an `sr-only` `<h4>` from `srOnlyTitle`, and a grid of column captions from `columns` (active columns rendered semibold).
|
|
34
|
+
- **Stepper** (all other layouts): a `<nav>` (labelled by `ariaLabel`) with the optional `title` and an `<ol>` of steps. Markers adapt to the layout — numbered/check circles for `circles`, `circles-with-text`, `panels`, `panels-with-border`; small dots for `bullets`, `bullets-and-text`; a colored top border (no marker) for `simple`. `bullets-and-text` and `circles-with-text` lay out vertically; the other step layouts lay out horizontally, with connector lines between markers for `circles`/`bullets`. A step's `iconTpl` replaces the marker content, so the preset does not show it in the `simple` layout (which has no marker). Completed circle steps show a check SVG; current/upcoming circle steps show `step.index` (falling back to the 1-based position); the dot and `simple` layouts show no index. Each step renders an `<a>` when `step.href` is set, otherwise a `<button>` that emits `stepClick`. Names/markers tint by `status` (`complete`/`current`/`upcoming`).
|
|
38
35
|
|
|
39
|
-
All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants. The class recipes
|
|
36
|
+
All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants. The class recipes are internal to the preset and not exported.
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
`ProgressBarsPresetComponent` declares `cssClass` without the `class` alias: bind `[cssClass]` when you use the `<smart-progress-bars-preset>` selector directly. On `<smart-progress-bars>` pass `class` as usual; the wrapper hands it to whichever implementation renders.
|
|
42
39
|
|
|
43
40
|
### ProgressBarsBaseComponent (abstract)
|
|
44
41
|
|
|
@@ -48,8 +45,6 @@ Abstract base directive. Exposes:
|
|
|
48
45
|
- `cssClass: InputSignal<string>` (alias `class`)
|
|
49
46
|
- `stepClick: OutputEmitterRef<IProgressStepClick>`
|
|
50
47
|
|
|
51
|
-
`IProgressStepClick = { stepId: string }`.
|
|
52
|
-
|
|
53
48
|
## API
|
|
54
49
|
|
|
55
50
|
### Inputs
|
|
@@ -61,12 +56,49 @@ Abstract base directive. Exposes:
|
|
|
61
56
|
|
|
62
57
|
### Outputs
|
|
63
58
|
|
|
64
|
-
| Output | Type | Description
|
|
65
|
-
| ----------- | -------------------------------------- |
|
|
66
|
-
| `stepClick` | `OutputEmitterRef<IProgressStepClick>` | Emitted when a button
|
|
59
|
+
| Output | Type | Description |
|
|
60
|
+
| ----------- | -------------------------------------- | ------------------------------------------------------------- |
|
|
61
|
+
| `stepClick` | `OutputEmitterRef<IProgressStepClick>` | Emitted when a step without `href` (a `<button>`) is clicked. |
|
|
67
62
|
|
|
68
63
|
### IProgressBarsOptions
|
|
69
64
|
|
|
65
|
+
| Field | Type | Default | Description |
|
|
66
|
+
| ------------- | ------------------------- | ------------ | ----------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `layout` | `SmartProgressBarsLayout` | `'simple'` | A step layout, or `progress-bar` for the percentage bar. |
|
|
68
|
+
| `ariaLabel` | `string` | `'Progress'` | Accessible name of the step `<nav>`; the preset also puts it on the bar's `role="progressbar"` track. |
|
|
69
|
+
| `steps` | `IProgressStep[]` | `[]` | The steps of a step layout. |
|
|
70
|
+
| `title` | `string` | - | Title above the steps or the bar (the preset bar also shows the `value%` next to it). |
|
|
71
|
+
| `srOnlyTitle` | `string` | - | Bar mode: a heading for screen readers only. |
|
|
72
|
+
| `value` | `number` | `0` | Bar mode: the percentage, clamped to 0–100. |
|
|
73
|
+
| `columns` | `IProgressBarColumn[]` | `[]` | Bar mode: captions under the bar. |
|
|
74
|
+
|
|
75
|
+
`SmartProgressBarsLayout` is `'simple' | 'panels' | 'bullets' | 'panels-with-border' | 'circles' | 'bullets-and-text' | 'circles-with-text' | 'progress-bar'`.
|
|
76
|
+
|
|
77
|
+
### IProgressStep
|
|
78
|
+
|
|
79
|
+
| Field | Type | Default | Description |
|
|
80
|
+
| ------------- | ------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------- |
|
|
81
|
+
| `id` | `string` | required | Reported as `stepId` by `stepClick`. |
|
|
82
|
+
| `name` | `string` | - | Step name. |
|
|
83
|
+
| `description` | `string` | - | Text under the name, in every step layout. |
|
|
84
|
+
| `status` | `SmartProgressStepStatus` | `'upcoming'` | `'complete'`, `'current'` (adds `aria-current="step"`) or `'upcoming'`. |
|
|
85
|
+
| `href` | `string` | - | Renders the step as a plain `<a href>` (no `stepClick`). |
|
|
86
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Icon of the step; the preset shows it in the marker, so not in the `simple` layout. |
|
|
87
|
+
| `index` | `string` | - | Number of the step (e.g. `'01'`): the standard shows it when there is no `iconTpl`, the preset in circle markers. |
|
|
88
|
+
|
|
89
|
+
### IProgressBarColumn
|
|
90
|
+
|
|
91
|
+
| Field | Type | Default | Description |
|
|
92
|
+
| -------- | --------- | -------- | ----------------------- |
|
|
93
|
+
| `label` | `string` | required | Caption text. |
|
|
94
|
+
| `active` | `boolean` | - | Highlights the caption. |
|
|
95
|
+
|
|
96
|
+
### IProgressStepClick
|
|
97
|
+
|
|
98
|
+
| Field | Type | Default | Description |
|
|
99
|
+
| -------- | -------- | -------- | ----------------------------- |
|
|
100
|
+
| `stepId` | `string` | required | The `id` of the clicked step. |
|
|
101
|
+
|
|
70
102
|
```typescript
|
|
71
103
|
type SmartProgressBarsLayout =
|
|
72
104
|
| 'simple'
|
|
@@ -98,16 +130,22 @@ interface IProgressBarColumn {
|
|
|
98
130
|
interface IProgressBarsOptions {
|
|
99
131
|
layout?: SmartProgressBarsLayout;
|
|
100
132
|
ariaLabel?: string;
|
|
101
|
-
steps?: IProgressStep[]; //
|
|
102
|
-
title?: string;
|
|
103
|
-
srOnlyTitle?: string;
|
|
133
|
+
steps?: IProgressStep[]; // step layouts
|
|
134
|
+
title?: string; // step layouts and the bar
|
|
135
|
+
srOnlyTitle?: string; // only for layout="progress-bar"
|
|
104
136
|
value?: number; // 0-100, only for layout="progress-bar"
|
|
105
137
|
columns?: IProgressBarColumn[]; // only for layout="progress-bar"
|
|
106
138
|
}
|
|
139
|
+
|
|
140
|
+
interface IProgressStepClick {
|
|
141
|
+
stepId: string;
|
|
142
|
+
}
|
|
107
143
|
```
|
|
108
144
|
|
|
109
145
|
## PROGRESS_BARS_STANDARD_COMPONENT_TOKEN
|
|
110
146
|
|
|
147
|
+
Provide a component class extending `ProgressBarsBaseComponent` under `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` to render it in every `<smart-progress-bars>` below that injector, for example `ProgressBarsPresetComponent`. `provideSmartPresets()` registers every preset of the library at once.
|
|
148
|
+
|
|
111
149
|
```typescript
|
|
112
150
|
import { PROGRESS_BARS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
113
151
|
|
|
@@ -125,7 +163,6 @@ providers: [
|
|
|
125
163
|
import {
|
|
126
164
|
ChangeDetectionStrategy,
|
|
127
165
|
Component,
|
|
128
|
-
input,
|
|
129
166
|
ViewEncapsulation,
|
|
130
167
|
} from '@angular/core';
|
|
131
168
|
|
|
@@ -138,8 +175,8 @@ import { ProgressBarsBaseComponent } from '@smartsoft001/angular';
|
|
|
138
175
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
139
176
|
})
|
|
140
177
|
export class MyCustomProgressBarsComponent extends ProgressBarsBaseComponent {
|
|
141
|
-
//
|
|
142
|
-
|
|
178
|
+
// `options()`, `cssClass()` (the wrapper's `class`) and `stepClick` are
|
|
179
|
+
// inherited; the wrapper re-emits `stepClick`.
|
|
143
180
|
}
|
|
144
181
|
```
|
|
145
182
|
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Searchbar Component
|
|
8
8
|
|
|
9
|
-
The `<smart-searchbar>` component provides a debounced search input with an optional toggle button. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. It renders a default `SearchbarStandardComponent` which can be replaced via `SEARCHBAR_STANDARD_COMPONENT_TOKEN`.
|
|
9
|
+
The `<smart-searchbar>` component provides a debounced search input with an optional toggle button. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. It renders a default `SearchbarStandardComponent` which can be replaced via `SEARCHBAR_STANDARD_COMPONENT_TOKEN`. There is no preset for this component.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -17,56 +17,63 @@ The `<smart-searchbar>` component provides a debounced search input with an opti
|
|
|
17
17
|
|
|
18
18
|
### SearchbarComponent (`<smart-searchbar>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `SearchbarStandardComponent` by default. When `SEARCHBAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `SearchbarStandardComponent` by default. When `SEARCHBAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, hands it `options`, `show`, `text` and `class`, and forwards its `show` and `text` changes back, so `[(show)]` and `[(text)]` on `<smart-searchbar>` keep working with any implementation.
|
|
21
21
|
|
|
22
22
|
### SearchbarStandardComponent (`<smart-searchbar-standard>`)
|
|
23
23
|
|
|
24
24
|
Default concrete implementation. Renders:
|
|
25
25
|
|
|
26
|
-
- a Tailwind-styled `<input type="search">` bound to
|
|
27
|
-
- a
|
|
28
|
-
-
|
|
26
|
+
- a Tailwind-styled `<input type="search">` bound to the base `control` (`class` goes on this input), with the `placeholder` passed through `TranslatePipe`,
|
|
27
|
+
- a magnifying-glass SVG icon inside the input,
|
|
28
|
+
- while `show()` is `false`: a toggle button with the same icon when `options.showToggleButton` is `true` (a click shows the input again), otherwise nothing,
|
|
29
29
|
- `smart:dark:*` dark-mode classes.
|
|
30
30
|
|
|
31
|
+
Blurring the input while it is empty sets `show` to `false`.
|
|
32
|
+
|
|
31
33
|
### SearchbarBaseComponent (abstract)
|
|
32
34
|
|
|
33
|
-
Abstract base directive for extending custom searchbar implementations. Exposes `options`, `cssClass
|
|
35
|
+
Abstract base directive for extending custom searchbar implementations. Exposes `options`, `cssClass` (alias `class`), the `show` and `text` models, a `control` signal wrapping an `UntypedFormControl`, and the `setShow()` / `tryHide()` methods (`tryHide()` hides the field only while it is empty). The base class wires `control.valueChanges` through `debounceTime()` in `ngAfterViewInit` and writes the settled value into the `text` model; the debounce is read once there, so a later change of `options.debounceTime` has no effect. A non-empty `text` coming from outside is copied into the control without being reported back.
|
|
34
36
|
|
|
35
37
|
## API
|
|
36
38
|
|
|
37
39
|
### Inputs
|
|
38
40
|
|
|
39
|
-
| Input | Type | Default | Description
|
|
40
|
-
| --------- | --------------------------------------------- | -------- |
|
|
41
|
-
| `options` | `InputSignal<ISearchbarOptions \| undefined>` | - | Searchbar configuration
|
|
42
|
-
| `show` | `ModelSignal<boolean>` | `true` | Whether the input is visible (two-way bindable)
|
|
43
|
-
| `text` | `ModelSignal<string>` | required | Debounced search text (two-way bindable)
|
|
44
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
41
|
+
| Input | Type | Default | Description |
|
|
42
|
+
| --------- | --------------------------------------------- | -------- | ------------------------------------------------------------------ |
|
|
43
|
+
| `options` | `InputSignal<ISearchbarOptions \| undefined>` | - | Searchbar configuration |
|
|
44
|
+
| `show` | `ModelSignal<boolean>` | `true` | Whether the input is visible (two-way bindable) |
|
|
45
|
+
| `text` | `ModelSignal<string>` | required | Debounced search text (two-way bindable); bind it, e.g. `[(text)]` |
|
|
46
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes on the input (alias for `cssClass`) |
|
|
45
47
|
|
|
46
48
|
### ISearchbarOptions
|
|
47
49
|
|
|
50
|
+
| Field | Type | Default | Description |
|
|
51
|
+
| ------------------ | ------------ | ---------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
52
|
+
| `placeholder` | `string` | `'search'` | Placeholder of the input, passed through `TranslatePipe` (a translation key or text). |
|
|
53
|
+
| `debounceTime` | `number` | `1000` | Milliseconds the typing has to settle before `text` changes; read once, after the view is created. |
|
|
54
|
+
| `showToggleButton` | `boolean` | - | While `show` is `false`, renders a magnifying-glass button that shows the input again. |
|
|
55
|
+
| `label` | `string` | - | Not read by the built-in implementations; available to a custom implementation (e.g. as the input's `aria-label`). |
|
|
56
|
+
| `size` | `SmartSize` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
57
|
+
| `color` | `SmartColor` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
58
|
+
|
|
48
59
|
```typescript
|
|
49
60
|
interface ISearchbarOptions {
|
|
50
61
|
placeholder?: string; // translation key; default 'search'
|
|
51
|
-
|
|
62
|
+
label?: string; // not read by the standard implementation
|
|
63
|
+
debounceTime?: number; // ms; default 1000, read once
|
|
52
64
|
showToggleButton?: boolean;
|
|
53
|
-
size?: SmartSize; //
|
|
54
|
-
color?: SmartColor; //
|
|
65
|
+
size?: SmartSize; // not read by the standard implementation
|
|
66
|
+
color?: SmartColor; // not read by the standard implementation
|
|
55
67
|
}
|
|
56
68
|
```
|
|
57
69
|
|
|
58
|
-
The `placeholder` value is rendered through `TranslatePipe`, so it may be a translation key. If no `placeholder` is provided, the key `'search'` is used.
|
|
59
|
-
|
|
60
70
|
## SEARCHBAR_STANDARD_COMPONENT_TOKEN
|
|
61
71
|
|
|
72
|
+
InjectionToken that allows replacing the default `SearchbarStandardComponent` with a custom implementation. Provide a component class extending `SearchbarBaseComponent` under `SEARCHBAR_STANDARD_COMPONENT_TOKEN`; every `<smart-searchbar>` below that injector renders it.
|
|
73
|
+
|
|
62
74
|
```typescript
|
|
63
75
|
import { SEARCHBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
InjectionToken that allows replacing the default `SearchbarStandardComponent` with a custom implementation. Provide a `Type<SearchbarBaseComponent>` to override.
|
|
67
76
|
|
|
68
|
-
```typescript
|
|
69
|
-
// In your app module or component providers:
|
|
70
77
|
providers: [
|
|
71
78
|
{
|
|
72
79
|
provide: SEARCHBAR_STANDARD_COMPONENT_TOKEN,
|
|
@@ -82,7 +89,6 @@ import {
|
|
|
82
89
|
ChangeDetectionStrategy,
|
|
83
90
|
Component,
|
|
84
91
|
computed,
|
|
85
|
-
input,
|
|
86
92
|
ViewEncapsulation,
|
|
87
93
|
} from '@angular/core';
|
|
88
94
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
@@ -111,9 +117,6 @@ import { SearchbarBaseComponent } from '@smartsoft001/angular';
|
|
|
111
117
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
112
118
|
})
|
|
113
119
|
export class MyCustomSearchbarComponent extends SearchbarBaseComponent {
|
|
114
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
115
|
-
override cssClass = input<string>('');
|
|
116
|
-
|
|
117
120
|
containerClasses = computed(() => {
|
|
118
121
|
const classes = ['my-searchbar-container'];
|
|
119
122
|
const extra = this.cssClass();
|
|
@@ -123,10 +126,7 @@ export class MyCustomSearchbarComponent extends SearchbarBaseComponent {
|
|
|
123
126
|
}
|
|
124
127
|
```
|
|
125
128
|
|
|
126
|
-
When extending the base directly,
|
|
127
|
-
|
|
128
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `SEARCHBAR_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
129
|
-
- let the base class handle the `control.valueChanges` subscription — do not re-subscribe to emit into `text`.
|
|
129
|
+
When extending the base directly, let the base class handle the `control.valueChanges` subscription; do not re-subscribe to emit into `text`.
|
|
130
130
|
|
|
131
131
|
## Usage Examples
|
|
132
132
|
|
|
@@ -149,13 +149,6 @@ When extending the base directly, remember to:
|
|
|
149
149
|
|
|
150
150
|
<!-- With external class -->
|
|
151
151
|
<smart-searchbar class="smart:max-w-md" [(text)]="searchText" />
|
|
152
|
-
|
|
153
|
-
<!-- Two-way binding on both show and text -->
|
|
154
|
-
<smart-searchbar
|
|
155
|
-
[(show)]="isSearchOpen"
|
|
156
|
-
[(text)]="query"
|
|
157
|
-
[options]="{ placeholder: 'search.products', debounceTime: 500, showToggleButton: true }"
|
|
158
|
-
/>
|
|
159
152
|
```
|
|
160
153
|
|
|
161
154
|
## File Locations
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Section Heading Component
|
|
8
8
|
|
|
9
|
-
The `<smart-section-heading>` component provides a heading region for sections within a page (positioned between `<smart-page-heading>` and `<smart-card-heading>` in size and scope), with optional slots for label, description, actions, tabs, an input group (search), and
|
|
9
|
+
The `<smart-section-heading>` component provides a heading region for sections within a page (positioned between `<smart-page-heading>` and `<smart-card-heading>` in size and scope), with a title and optional slots for a label, a description, actions, tabs, an input group (search), a badge and, in the preset, an image. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `SectionHeadingBaseComponent` defines the shared API — optional `ISectionHeadingOptions` and `cssClass` (alias `class`). `SectionHeadingStandardComponent` is a barebones placeholder concrete implementation. `SectionHeadingComponent` is the public wrapper that renders `SectionHeadingStandardComponent` by default and accepts a custom replacement via `SECTION_HEADING_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -17,11 +17,11 @@ The `<smart-section-heading>` component provides a heading region for sections w
|
|
|
17
17
|
|
|
18
18
|
### SectionHeadingComponent (`<smart-section-heading>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `SectionHeadingStandardComponent` by default. When `SECTION_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `SectionHeadingStandardComponent` by default. When `SECTION_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and hands it the `options` and `class` inputs.
|
|
21
21
|
|
|
22
22
|
### SectionHeadingStandardComponent (`<smart-section-heading-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder concrete implementation. Renders a wrapper `<div>` with a header row
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` (with the external `cssClass`) holding a header row: an `<h3>` with the `title` and, inside it, an optional `<span class="label">` with the `label`; a `<p class="description">`; then the `badgeTpl`, `inputGroupTpl` and `actionsTpl` slots (`.badge`, `.input-group`, `.actions`). A separate `.tabs` row with `tabsTpl` sits beneath the header. Each part is rendered only when its option is set; the `label` is rendered only together with a `title`. The standard does not read `imageTpl` or `presentation`. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
25
|
|
|
26
26
|
### SectionHeadingBaseComponent (abstract)
|
|
27
27
|
|
|
@@ -38,29 +38,41 @@ Abstract base directive for extending custom section-heading implementations. Ex
|
|
|
38
38
|
|
|
39
39
|
### ISectionHeadingOptions
|
|
40
40
|
|
|
41
|
+
All properties are optional.
|
|
42
|
+
|
|
43
|
+
| Field | Type | Default | Description |
|
|
44
|
+
| --------------- | --------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `title` | `string` | - | The heading (`<h3>` in the standard, `<h2>` in the preset). |
|
|
46
|
+
| `description` | `string` | - | Text under the heading. |
|
|
47
|
+
| `label` | `string` | - | Standard: inline `<span class="label">` inside the title (needs `title`). Preset: eyebrow above the title. |
|
|
48
|
+
| `actionsTpl` | `TemplateRef<unknown>` | - | Action buttons. |
|
|
49
|
+
| `badgeTpl` | `TemplateRef<unknown>` | - | A badge: in the header row (standard) or next to the eyebrow label (preset). |
|
|
50
|
+
| `tabsTpl` | `TemplateRef<unknown>` | - | Standard only: tabs under the header. The preset does not render it. |
|
|
51
|
+
| `inputGroupTpl` | `TemplateRef<unknown>` | - | Standard only: a search or input group in the header row. The preset does not render it. |
|
|
52
|
+
| `imageTpl` | `TemplateRef<unknown>` | - | Preset only: the image column (the template owns the `<img>`). |
|
|
53
|
+
| `presentation` | `{ layout?: 'half' \| 'narrow' \| 'wide' \| 'vertical' }` | - | Preset only: the layout, `half` by default (see the preset section). |
|
|
54
|
+
|
|
41
55
|
```typescript
|
|
42
56
|
interface ISectionHeadingOptions {
|
|
43
57
|
title?: string;
|
|
44
58
|
description?: string;
|
|
45
59
|
label?: string;
|
|
46
60
|
actionsTpl?: TemplateRef<unknown>;
|
|
47
|
-
tabsTpl?: TemplateRef<unknown>;
|
|
48
|
-
inputGroupTpl?: TemplateRef<unknown>;
|
|
61
|
+
tabsTpl?: TemplateRef<unknown>; // standard only
|
|
62
|
+
inputGroupTpl?: TemplateRef<unknown>; // standard only
|
|
49
63
|
badgeTpl?: TemplateRef<unknown>;
|
|
64
|
+
imageTpl?: TemplateRef<unknown>; // preset only
|
|
65
|
+
presentation?: { layout?: 'half' | 'narrow' | 'wide' | 'vertical' }; // preset only
|
|
50
66
|
}
|
|
51
67
|
```
|
|
52
68
|
|
|
53
|
-
All properties are optional. The default `SectionHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
54
|
-
|
|
55
69
|
## SECTION_HEADING_STANDARD_COMPONENT_TOKEN
|
|
56
70
|
|
|
71
|
+
InjectionToken that allows replacing the default `SectionHeadingStandardComponent` with a custom implementation. Provide a component class extending `SectionHeadingBaseComponent` under `SECTION_HEADING_STANDARD_COMPONENT_TOKEN`; every `<smart-section-heading>` below that injector renders it.
|
|
72
|
+
|
|
57
73
|
```typescript
|
|
58
74
|
import { SECTION_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
InjectionToken that allows replacing the default `SectionHeadingStandardComponent` with a custom implementation. Provide a `Type<SectionHeadingBaseComponent>` to override.
|
|
62
75
|
|
|
63
|
-
```typescript
|
|
64
76
|
providers: [
|
|
65
77
|
{
|
|
66
78
|
provide: SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
@@ -76,7 +88,6 @@ import {
|
|
|
76
88
|
ChangeDetectionStrategy,
|
|
77
89
|
Component,
|
|
78
90
|
computed,
|
|
79
|
-
input,
|
|
80
91
|
ViewEncapsulation,
|
|
81
92
|
} from '@angular/core';
|
|
82
93
|
import { NgTemplateOutlet } from '@angular/common';
|
|
@@ -109,9 +120,6 @@ import { SectionHeadingBaseComponent } from '@smartsoft001/angular';
|
|
|
109
120
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
110
121
|
})
|
|
111
122
|
export class MyCustomSectionHeadingComponent extends SectionHeadingBaseComponent {
|
|
112
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
113
|
-
override cssClass = input<string>('');
|
|
114
|
-
|
|
115
123
|
containerClasses = computed(() => {
|
|
116
124
|
const classes = ['my-section-heading'];
|
|
117
125
|
const extra = this.cssClass();
|
|
@@ -142,21 +150,21 @@ export class MyCustomSectionHeadingComponent extends SectionHeadingBaseComponent
|
|
|
142
150
|
|
|
143
151
|
<!-- With actions -->
|
|
144
152
|
<ng-template #actions>
|
|
145
|
-
<button>Add</button>
|
|
153
|
+
<smart-button [options]="addButton">Add</smart-button>
|
|
146
154
|
</ng-template>
|
|
147
155
|
|
|
148
156
|
<smart-section-heading
|
|
149
157
|
[options]="{ title: 'Applicants', actionsTpl: actions }"
|
|
150
158
|
/>
|
|
151
159
|
|
|
152
|
-
<!-- With tabs and search -->
|
|
160
|
+
<!-- With tabs and search (standard only) -->
|
|
153
161
|
<ng-template #tabs>
|
|
154
162
|
<a>All</a>
|
|
155
163
|
<a>Active</a>
|
|
156
164
|
</ng-template>
|
|
157
165
|
|
|
158
166
|
<ng-template #search>
|
|
159
|
-
<smart-searchbar />
|
|
167
|
+
<smart-searchbar [(text)]="query" />
|
|
160
168
|
</ng-template>
|
|
161
169
|
|
|
162
170
|
<smart-section-heading
|
|
@@ -172,18 +180,19 @@ export class MyCustomSectionHeadingComponent extends SectionHeadingBaseComponent
|
|
|
172
180
|
|
|
173
181
|
- Wrapper: `packages/shared/angular/src/lib/components/section-heading/section-heading.component.ts`
|
|
174
182
|
- Standard: `packages/shared/angular/src/lib/components/section-heading/standard/standard.component.ts`
|
|
183
|
+
- Preset: `packages/shared/angular/src/lib/components/section-heading/preset/preset.component.ts`
|
|
175
184
|
- Base class: `packages/shared/angular/src/lib/components/section-heading/base/base.component.ts`
|
|
176
185
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`SECTION_HEADING_STANDARD_COMPONENT_TOKEN`)
|
|
177
186
|
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ISectionHeadingOptions`)
|
|
178
187
|
|
|
179
188
|
## HyperUI preset
|
|
180
189
|
|
|
181
|
-
`SectionHeadingPresetComponent` (`smart-section-heading-preset`) is a HyperUI-styled "content with image" variation. It renders an eyebrow row (label + `badgeTpl`), an `<h2>` title, a description `<p>`, `actionsTpl` below the text, and an optional image column fed by `imageTpl`. Vanilla Tailwind classes are prefixed with `smart:` and ship explicit `smart:dark:*` variants (gray-900 ↔ white for the title, gray-700 ↔ gray-300 for text). Every zone exposes a `data-role` hook: `section`, `grid`, `text`, `image`, `eyebrow`, `actions`.
|
|
190
|
+
`SectionHeadingPresetComponent` (`smart-section-heading-preset`) is a HyperUI-styled "content with image" variation. It renders an eyebrow row (`label` + `badgeTpl`), an `<h2>` title, a description `<p>`, `actionsTpl` below the text, and an optional image column fed by `imageTpl`. Vanilla Tailwind classes are prefixed with `smart:` and ship explicit `smart:dark:*` variants (gray-900 ↔ white for the title, gray-700 ↔ gray-300 for text). Every zone exposes a `data-role` hook: `section`, `grid`, `text`, `image`, `eyebrow`, `actions`.
|
|
182
191
|
|
|
183
|
-
|
|
192
|
+
The preset adds two options the standard ignores.
|
|
184
193
|
|
|
185
|
-
- `imageTpl
|
|
186
|
-
- `presentation
|
|
194
|
+
- `imageTpl` — the image column. The zone is only rendered when this is provided; the template owns the `<img>` and its classes.
|
|
195
|
+
- `presentation.layout` — `'half' | 'narrow' | 'wide' | 'vertical'` (default `half`), described in the table below.
|
|
187
196
|
|
|
188
197
|
| Layout | Grid | Notes |
|
|
189
198
|
| ---------- | --------------------------------------- | ----------------------------------- |
|
|
@@ -194,9 +203,13 @@ export class MyCustomSectionHeadingComponent extends SectionHeadingBaseComponent
|
|
|
194
203
|
|
|
195
204
|
### Register the preset
|
|
196
205
|
|
|
206
|
+
Provide `SectionHeadingPresetComponent` under `SECTION_HEADING_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-section-heading>`, or register every preset of the library at once with `provideSmartPresets()`. Alternatively use `<smart-section-heading-preset>` directly; it declares `cssClass` without the `class` alias, so bind `[cssClass]` there (on `<smart-section-heading>` pass `class` as usual).
|
|
207
|
+
|
|
197
208
|
```ts
|
|
198
|
-
import {
|
|
199
|
-
|
|
209
|
+
import {
|
|
210
|
+
SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
211
|
+
SectionHeadingPresetComponent,
|
|
212
|
+
} from '@smartsoft001/angular';
|
|
200
213
|
|
|
201
214
|
providers: [
|
|
202
215
|
{
|
|
@@ -206,8 +219,6 @@ providers: [
|
|
|
206
219
|
];
|
|
207
220
|
```
|
|
208
221
|
|
|
209
|
-
Registering the token restyles every `<smart-section-heading>`; alternatively use `<smart-section-heading-preset>` directly.
|
|
210
|
-
|
|
211
222
|
### Gaps
|
|
212
223
|
|
|
213
|
-
`tabsTpl` and `inputGroupTpl` are **not**
|
|
224
|
+
`tabsTpl` and `inputGroupTpl` are **not** rendered by this preset (only the standard component renders them). Use the standard component when those slots are needed.
|
|
@@ -17,11 +17,11 @@ The `<smart-select-menu>` component renders a single-select menu with a placehol
|
|
|
17
17
|
|
|
18
18
|
### SelectMenuComponent (`<smart-select-menu>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `SelectMenuStandardComponent` by default. When `SELECT_MENU_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `SelectMenuStandardComponent` by default. When `SELECT_MENU_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, hands it `value`, `disabled`, `options` and `class`, and forwards its `value` changes back, so `[(value)]` on `<smart-select-menu>` works with any implementation. There is no preset for this component.
|
|
21
21
|
|
|
22
22
|
### SelectMenuStandardComponent (`<smart-select-menu-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder concrete implementation using a native `<select>`. Renders an outer wrapper `<div>`, a `<div class="select-menu">`, and a `<select>` with one `<option>` per item; an optional placeholder is rendered as a disabled first option
|
|
24
|
+
Barebones placeholder concrete implementation using a native `<select>`. Renders an outer wrapper `<div>`, a `<div class="select-menu">`, and a `<select>` (with `aria-label` from `options.ariaLabel`) with one `<option>` per item (with the item's `ariaLabel`); an optional placeholder is rendered as a disabled first option, selected while `value` is `null`. Disabled items get the `disabled` attribute on their `<option>`. The `<select>` is disabled when `disabled()` is `true`. On `change`, the standard reads the raw string value, looks up the matching item by `String(value) === String(item.value)` (preserving numeric types), and calls `select()`. When `items` is empty and `emptyTpl` is provided, the empty template is rendered inside `<div class="empty">`. The external `cssClass` is applied to the root wrapper. It does not include any Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
25
|
|
|
26
26
|
### SelectMenuBaseComponent (abstract)
|
|
27
27
|
|
|
@@ -48,6 +48,29 @@ Abstract base directive for extending custom select menu implementations. Expose
|
|
|
48
48
|
|
|
49
49
|
### ISelectMenuOptions
|
|
50
50
|
|
|
51
|
+
| Field | Type | Default | Description |
|
|
52
|
+
| ------------- | ------------------------ | ------- | ----------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `items` | `ISelectMenuItem[]` | `[]` | The choices. |
|
|
54
|
+
| `placeholder` | `string` | - | A disabled first option, selected while `value` is `null`. |
|
|
55
|
+
| `ariaLabel` | `string` | - | Accessible name of the `<select>`. |
|
|
56
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Rendered under the select when `items` is empty. |
|
|
57
|
+
| `variant` | `SmartSelectMenuVariant` | - | Not read by the built-in implementations; available to a custom implementation (e.g. a listbox look). |
|
|
58
|
+
|
|
59
|
+
`SmartSelectMenuVariant` is `'native' | 'custom' | 'with-check' | 'with-status' | 'with-avatar' | 'with-secondary' | 'branded'`.
|
|
60
|
+
|
|
61
|
+
### ISelectMenuItem
|
|
62
|
+
|
|
63
|
+
| Field | Type | Default | Description |
|
|
64
|
+
| ----------- | ------------------------------------------- | -------- | ------------------------------------------------------------------------------- |
|
|
65
|
+
| `value` | `string \| number` | required | The value written to `value`; a numeric value stays a number. |
|
|
66
|
+
| `label` | `string` | required | The option text. |
|
|
67
|
+
| `disabled` | `boolean` | - | Disables the option. |
|
|
68
|
+
| `ariaLabel` | `string` | - | Accessible name of the option. |
|
|
69
|
+
| `avatarUrl` | `string` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
70
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
71
|
+
| `secondary` | `string` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
72
|
+
| `status` | `'online' \| 'offline' \| 'busy' \| string` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
73
|
+
|
|
51
74
|
```typescript
|
|
52
75
|
type SmartSelectMenuVariant =
|
|
53
76
|
| 'native'
|
|
@@ -61,7 +84,7 @@ type SmartSelectMenuVariant =
|
|
|
61
84
|
interface ISelectMenuOptions {
|
|
62
85
|
items?: ISelectMenuItem[];
|
|
63
86
|
placeholder?: string;
|
|
64
|
-
variant?: SmartSelectMenuVariant;
|
|
87
|
+
variant?: SmartSelectMenuVariant; // not read by the standard implementation
|
|
65
88
|
emptyTpl?: TemplateRef<unknown>;
|
|
66
89
|
ariaLabel?: string;
|
|
67
90
|
}
|
|
@@ -69,26 +92,22 @@ interface ISelectMenuOptions {
|
|
|
69
92
|
interface ISelectMenuItem {
|
|
70
93
|
value: string | number;
|
|
71
94
|
label: string;
|
|
72
|
-
avatarUrl?: string;
|
|
73
|
-
iconTpl?: TemplateRef<unknown>;
|
|
74
|
-
secondary?: string;
|
|
75
|
-
status?: 'online' | 'offline' | 'busy' | string;
|
|
95
|
+
avatarUrl?: string; // not read by the standard implementation
|
|
96
|
+
iconTpl?: TemplateRef<unknown>; // not read by the standard implementation
|
|
97
|
+
secondary?: string; // not read by the standard implementation
|
|
98
|
+
status?: 'online' | 'offline' | 'busy' | string; // not read by the standard implementation
|
|
76
99
|
disabled?: boolean;
|
|
77
100
|
ariaLabel?: string;
|
|
78
101
|
}
|
|
79
102
|
```
|
|
80
103
|
|
|
81
|
-
The default `SelectMenuStandardComponent` renders `value`, `disabled`, `placeholder`, `items` and `emptyTpl`. `variant`, `avatarUrl`, `iconTpl`, `secondary`, and `status` are hints/data for custom implementations registered via the token.
|
|
82
|
-
|
|
83
104
|
## SELECT_MENU_STANDARD_COMPONENT_TOKEN
|
|
84
105
|
|
|
106
|
+
InjectionToken that allows replacing the default `SelectMenuStandardComponent` with a custom implementation. Provide a component class extending `SelectMenuBaseComponent` under `SELECT_MENU_STANDARD_COMPONENT_TOKEN`; every `<smart-select-menu>` below that injector renders it.
|
|
107
|
+
|
|
85
108
|
```typescript
|
|
86
109
|
import { SELECT_MENU_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
87
|
-
```
|
|
88
110
|
|
|
89
|
-
InjectionToken that allows replacing the default `SelectMenuStandardComponent` with a custom implementation. Provide a `Type<SelectMenuBaseComponent>` to override.
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
111
|
providers: [
|
|
93
112
|
{
|
|
94
113
|
provide: SELECT_MENU_STANDARD_COMPONENT_TOKEN,
|
|
@@ -104,7 +123,7 @@ import {
|
|
|
104
123
|
ChangeDetectionStrategy,
|
|
105
124
|
Component,
|
|
106
125
|
computed,
|
|
107
|
-
|
|
126
|
+
signal,
|
|
108
127
|
ViewEncapsulation,
|
|
109
128
|
} from '@angular/core';
|
|
110
129
|
|
|
@@ -134,9 +153,6 @@ import { SelectMenuBaseComponent } from '@smartsoft001/angular';
|
|
|
134
153
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
135
154
|
})
|
|
136
155
|
export class MyCustomSelectMenuComponent extends SelectMenuBaseComponent {
|
|
137
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
138
|
-
override cssClass = input<string>('');
|
|
139
|
-
|
|
140
156
|
open = signal(false);
|
|
141
157
|
|
|
142
158
|
currentLabel = computed(() => {
|