@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
|
@@ -17,27 +17,25 @@ The `<smart-calendar>` component renders a date calendar with shared month-grid
|
|
|
17
17
|
|
|
18
18
|
### CalendarComponent (`<smart-calendar>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `CalendarStandardComponent` by default. When `CALENDAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. The wrapper exposes a two-way `value` model (`Date | null`), an optional `referenceDate` input (
|
|
20
|
+
Main wrapper component. Renders `CalendarStandardComponent` by default. When `CALENDAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. The wrapper exposes a two-way `value` model (`Date | null`), an optional `referenceDate` input (today when omitted), an `events` input, `options` and `class`. It passes all of them to the injected component (`referenceDate` included) and writes the injected component's `value` changes back to its own `value` model, so `[(value)]` works the same with the standard, the preset or an implementation of your own.
|
|
21
21
|
|
|
22
22
|
### CalendarStandardComponent (`<smart-calendar-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional toolbar (`<button.prev>`, `<button.today-btn>`, `<button.next>`, optional `toolbarActionsTpl` slot) and a `<div class="view-grid">` with one `<div class="week">` per week and one `<button class="day">` per day. Each day exposes `data-current-month`, `data-today`, and `data-selected` attributes plus an `aria-label` of the date string. The standard marks event days: a day with `eventsForDay(date).length > 0` gets `data-events="<count>"`, its `aria-label` gains the count (e.g. `"Thu Sep 03 2026, 1 event"`, `", 2 events"`; built by the base's `dayAriaLabel(date)`, which the preset uses too), and — without `dayCellTpl` — a `<span class="smart-calendar-event" data-role="event-dot" aria-hidden="true">` marker after the day number. If `dayCellTpl` is provided in options, it replaces the default day content (day number and marker). The
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` (carrying the external classes) containing a `<div class="calendar" data-view>` with an optional toolbar (`<button.prev>`, `<button.today-btn>`, `<button.next>`, optional `toolbarActionsTpl` slot) and a `<div class="view-grid">` with one `<div class="week">` per week and one `<button class="day">` per day. Each day exposes `data-current-month`, `data-today`, and `data-selected` attributes plus an `aria-label` of the date string. The standard marks event days: a day with `eventsForDay(date).length > 0` gets `data-events="<count>"`, its `aria-label` gains the count (e.g. `"Thu Sep 03 2026, 1 event"`, `", 2 events"`; built by the base's `dayAriaLabel(date)`, which the preset uses too), and — without `dayCellTpl` — a `<span class="smart-calendar-event" data-role="event-dot" aria-hidden="true">` marker after the day number. If `dayCellTpl` is provided in options, it replaces the default day content (day number and marker). The toolbar labels (Prev / Today / Next) are not translated. It does not include any visual styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
25
|
|
|
26
26
|
### CalendarPresetComponent (`<smart-calendar-preset>`)
|
|
27
27
|
|
|
28
|
-
Styled single date-picker variation that extends `CalendarBaseComponent` and is a drop-in replacement for `CalendarStandardComponent`. Register it via `CALENDAR_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-calendar>`, or use the `<smart-calendar-preset>` selector directly. It reproduces Preline's single date-picker visual (a `w-80` rounded popover card: month/year navigation header with chevron prev/next buttons, a weekday header row, and a 6×7 grid of circular day buttons) translated to `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants. Month navigation (`prevPeriod`/`nextPeriod`) and day selection (`selectDay`) are driven entirely by Angular signals — the Preline datepicker JS plugin is **not** required. It honors `options.weekStart` (rotates the weekday header; default `1` → Monday) and `options.showToolbar` (toggles the navigation header)
|
|
29
|
-
|
|
30
|
-
> Because `CalendarComponent` renders injected components via `NgComponentOutlet` (which passes inputs by canonical name), `CalendarPresetComponent` overrides `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-calendar-preset>` selector directly, or just pass `class` on `<smart-calendar>` (the wrapper forwards it). Note also that when used through the wrapper the `value` two-way binding is re-applied as a one-way input on every change-detection (and `referenceDate` is not forwarded at all, since its canonical input name is `referenceDateInput`), so for interactive selection / external reference-date control use the `<smart-calendar-preset>` selector directly with `[(value)]` and `[referenceDate]`.
|
|
28
|
+
Styled single date-picker variation that extends `CalendarBaseComponent` and is a drop-in replacement for `CalendarStandardComponent`. Register it via `CALENDAR_STANDARD_COMPONENT_TOKEN` (`{ provide: CALENDAR_STANDARD_COMPONENT_TOKEN, useValue: CalendarPresetComponent }`) to restyle every `<smart-calendar>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-calendar-preset>` selector directly (it takes the extra classes as `class` or `[cssClass]`). It reproduces Preline's single date-picker visual (a `w-80` rounded popover card: month/year navigation header with chevron prev/next buttons, a weekday header row, and a 6×7 grid of circular day buttons) translated to `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants. Month navigation (`prevPeriod`/`nextPeriod`) and day selection (`selectDay`) are driven entirely by Angular signals — the Preline datepicker JS plugin is **not** required. It honors `options.weekStart` (rotates the weekday header; default `1` → Monday) and `options.showToolbar` (toggles the navigation header); it does not render `toolbarActionsTpl`. Selected, today, default, and out-of-month day states each get distinct styling; out-of-month days are rendered disabled. Days that have matching `events` show a small dot marker, and `options.dayCellTpl` overrides the default day content. The month name and the weekday labels are English and not translated.
|
|
31
29
|
|
|
32
30
|
### CalendarBaseComponent (abstract)
|
|
33
31
|
|
|
34
32
|
Abstract base directive containing the shared calendar logic. Exposes inputs and signals for state, plus methods for navigation and selection.
|
|
35
33
|
|
|
36
|
-
**Inputs:** `options` (`ICalendarOptions | undefined`), `value` (`Date | null`, two-way model), `referenceDate` (`Date | undefined`), `events` (`ICalendarEvent[]`), `class` (`string`)
|
|
34
|
+
**Inputs:** `options` (`ICalendarOptions | undefined`), `value` (`Date | null`, two-way model), `referenceDate` (`Date | undefined`; the class property is `referenceDateInput`), `events` (`ICalendarEvent[]`), `class` (`string`, the `cssClass` property)
|
|
37
35
|
|
|
38
|
-
**Computed signals:** `view` (current view from options, default `'month'`), `weekStart` (`0 | 1`, default `1`), `showToolbar` (default `true`), `reference` (
|
|
36
|
+
**Computed signals:** `view` (current view from options, default `'month'`), `weekStart` (`0 | 1`, default `1`), `showToolbar` (default `true`), `reference` (the navigated reference date, read-only; it starts at `referenceDate` or today and jumps back to `referenceDate` whenever that input changes), `monthGrid` (current 6×7 grid).
|
|
39
37
|
|
|
40
|
-
**Methods:** `selectDay(date)
|
|
38
|
+
**Methods:** `selectDay(date)` (sets `value`), `goToToday()`, `prevPeriod()` / `nextPeriod()` (move `reference` one `view` period: a month, 7 days, a day or a year), `eventsForDay(day)`, `dayAriaLabel(day)` (date string plus `", N event(s)"` when the day has events).
|
|
41
39
|
|
|
42
40
|
**Static method:** `buildMonthGrid(reference, weekStart, selected): ICalendarDayCell[][]` — pure function returning a 6×7 grid suitable for rendering.
|
|
43
41
|
|
|
@@ -45,16 +43,28 @@ Abstract base directive containing the shared calendar logic. Exposes inputs and
|
|
|
45
43
|
|
|
46
44
|
### Inputs
|
|
47
45
|
|
|
48
|
-
| Input | Type | Default | Description
|
|
49
|
-
| --------------- | -------------------------------------------- | ------- |
|
|
50
|
-
| `options` | `InputSignal<ICalendarOptions \| undefined>` | - | Configuration (view, weekStart, slot templates
|
|
51
|
-
| `value` | `ModelSignal<Date \| null>` | `null` | Selected day (two-way binding)
|
|
52
|
-
| `referenceDate` | `InputSignal<Date \| undefined>` |
|
|
53
|
-
| `events` | `InputSignal<ICalendarEvent[]>` | `[]` | Events for `eventsForDay()`; the standard and preset mark days that have events
|
|
54
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
46
|
+
| Input | Type | Default | Description |
|
|
47
|
+
| --------------- | -------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `options` | `InputSignal<ICalendarOptions \| undefined>` | - | Configuration (view, weekStart, toolbar, slot templates) |
|
|
49
|
+
| `value` | `ModelSignal<Date \| null>` | `null` | Selected day (two-way binding); `valueChange` reports every selection |
|
|
50
|
+
| `referenceDate` | `InputSignal<Date \| undefined>` | today | The day whose month is shown first; the calendar navigates from there and jumps back to it whenever it changes |
|
|
51
|
+
| `events` | `InputSignal<ICalendarEvent[]>` | `[]` | Events for `eventsForDay()`; the standard and preset mark days that have events |
|
|
52
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
55
53
|
|
|
56
54
|
### ICalendarOptions
|
|
57
55
|
|
|
56
|
+
| Field | Type | Default | Description |
|
|
57
|
+
| ------------------- | ---------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `view` | `SmartCalendarView` | `'month'` | The period Prev / Next move by (`'month'`, `'week'`, `'day'`, `'year'`). The grid is always a month grid; the standard also exposes the value as `data-view`. |
|
|
59
|
+
| `monthsCount` | `1 \| 2 \| 12` | `undefined` | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
|
|
60
|
+
| `weekStart` | `0 \| 1` | `1` | First day of the week: `1` Monday, `0` Sunday. |
|
|
61
|
+
| `showToolbar` | `boolean` | `true` | Shows the navigation toolbar (the standard's Prev / Today / Next, the preset's month header). |
|
|
62
|
+
| `toolbarActionsTpl` | `TemplateRef<unknown>` | `undefined` | Standard only: extra content at the end of the toolbar. The preset does not render it. |
|
|
63
|
+
| `eventListTpl` | `TemplateRef<unknown>` | `undefined` | Not read by the built-in implementations; available to a custom implementation. |
|
|
64
|
+
| `sidePanelTpl` | `TemplateRef<unknown>` | `undefined` | Not read by the built-in implementations; available to a custom implementation. |
|
|
65
|
+
| `dayCellTpl` | `TemplateRef<unknown>` | `undefined` | Replaces the content of every day button. Its context is the day cell as `$implicit` (`ICalendarDayCell`) and the day's events as `events` (`ICalendarEvent[]`): `<ng-template #day let-cell let-events="events">`. |
|
|
66
|
+
| `eventTpl` | `TemplateRef<unknown>` | `undefined` | Not read by the built-in implementations; available to a custom implementation. |
|
|
67
|
+
|
|
58
68
|
```typescript
|
|
59
69
|
type SmartCalendarView = 'month' | 'week' | 'day' | 'year';
|
|
60
70
|
|
|
@@ -73,6 +83,16 @@ interface ICalendarOptions {
|
|
|
73
83
|
|
|
74
84
|
### ICalendarEvent
|
|
75
85
|
|
|
86
|
+
An event marks the day of its `start`.
|
|
87
|
+
|
|
88
|
+
| Field | Type | Default | Description |
|
|
89
|
+
| ------- | ------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
90
|
+
| `id` | `string \| number` | required | Identifies the event. |
|
|
91
|
+
| `start` | `Date` | required | Decides the day the event is listed on (`eventsForDay`). |
|
|
92
|
+
| `end` | `Date` | `undefined` | Not read by the built-in implementations; available to a custom implementation or your `dayCellTpl`. |
|
|
93
|
+
| `title` | `string` | `undefined` | Not rendered by the built-in implementations (the day's accessible name only counts the events); available to a custom implementation or your `dayCellTpl`. |
|
|
94
|
+
| `meta` | `Record<string, unknown>` | `undefined` | Free data for a custom implementation or your `dayCellTpl`. |
|
|
95
|
+
|
|
76
96
|
```typescript
|
|
77
97
|
interface ICalendarEvent {
|
|
78
98
|
id: string | number;
|
|
@@ -85,6 +105,15 @@ interface ICalendarEvent {
|
|
|
85
105
|
|
|
86
106
|
### ICalendarDayCell
|
|
87
107
|
|
|
108
|
+
One day of the month grid (`monthGrid()`, and the `$implicit` context of `dayCellTpl`).
|
|
109
|
+
|
|
110
|
+
| Field | Type | Default | Description |
|
|
111
|
+
| ---------------- | --------- | -------- | ------------------------------------------------------------------- |
|
|
112
|
+
| `date` | `Date` | required | The day. |
|
|
113
|
+
| `isCurrentMonth` | `boolean` | required | `false` for the leading / trailing days of the neighbouring months. |
|
|
114
|
+
| `isToday` | `boolean` | required | The day is today. |
|
|
115
|
+
| `isSelected` | `boolean` | required | The day is the selected `value`. |
|
|
116
|
+
|
|
88
117
|
```typescript
|
|
89
118
|
interface ICalendarDayCell {
|
|
90
119
|
date: Date;
|
|
@@ -94,15 +123,13 @@ interface ICalendarDayCell {
|
|
|
94
123
|
}
|
|
95
124
|
```
|
|
96
125
|
|
|
97
|
-
The default `CalendarStandardComponent` renders the month view; `monthsCount`, `view: 'week' | 'day' | 'year'`, `eventListTpl`, `sidePanelTpl`, and `eventTpl` are hints / slots intended for custom implementations registered via the token. `weekStart` defaults to `1` (Monday).
|
|
98
|
-
|
|
99
126
|
## CALENDAR_STANDARD_COMPONENT_TOKEN
|
|
100
127
|
|
|
101
128
|
```typescript
|
|
102
129
|
import { CALENDAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
103
130
|
```
|
|
104
131
|
|
|
105
|
-
InjectionToken that allows replacing the default `CalendarStandardComponent` with a custom implementation. Provide a `Type<CalendarBaseComponent>` to override.
|
|
132
|
+
InjectionToken that allows replacing the default `CalendarStandardComponent` with a custom implementation. Provide a `Type<CalendarBaseComponent>` to override. The wrapper passes it every input it declares (`referenceDate` and `class` included) and writes its `value` changes back to the wrapper's `value` model, so `[(value)]` on `<smart-calendar>` keeps working.
|
|
106
133
|
|
|
107
134
|
```typescript
|
|
108
135
|
providers: [
|
|
@@ -113,8 +140,6 @@ providers: [
|
|
|
113
140
|
];
|
|
114
141
|
```
|
|
115
142
|
|
|
116
|
-
> **Note:** `NgComponentOutlet` does not propagate output bindings. When a custom component is injected via the token, the `value` two-way binding becomes one-way (input only). Custom implementations should expose their selection events through dedicated outputs (e.g., `valueChange`) and the host application should wire those manually.
|
|
117
|
-
|
|
118
143
|
## Extending the Base Class
|
|
119
144
|
|
|
120
145
|
```typescript
|
|
@@ -122,10 +147,8 @@ import {
|
|
|
122
147
|
ChangeDetectionStrategy,
|
|
123
148
|
Component,
|
|
124
149
|
computed,
|
|
125
|
-
input,
|
|
126
150
|
ViewEncapsulation,
|
|
127
151
|
} from '@angular/core';
|
|
128
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
129
152
|
|
|
130
153
|
import { CalendarBaseComponent } from '@smartsoft001/angular';
|
|
131
154
|
|
|
@@ -158,14 +181,10 @@ import { CalendarBaseComponent } from '@smartsoft001/angular';
|
|
|
158
181
|
</div>
|
|
159
182
|
</div>
|
|
160
183
|
`,
|
|
161
|
-
imports: [NgTemplateOutlet],
|
|
162
184
|
encapsulation: ViewEncapsulation.None,
|
|
163
185
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
164
186
|
})
|
|
165
187
|
export class MyCustomCalendarComponent extends CalendarBaseComponent {
|
|
166
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
167
|
-
override cssClass = input<string>('');
|
|
168
|
-
|
|
169
188
|
containerClasses = computed(() => {
|
|
170
189
|
const classes = ['my-calendar'];
|
|
171
190
|
const extra = this.cssClass();
|
|
@@ -208,7 +227,7 @@ export class MyCustomCalendarComponent extends CalendarBaseComponent {
|
|
|
208
227
|
[options]="{ dayCellTpl: dayCell }"
|
|
209
228
|
/>
|
|
210
229
|
|
|
211
|
-
<!-- With toolbar action slot -->
|
|
230
|
+
<!-- With toolbar action slot (standard only) -->
|
|
212
231
|
<ng-template #addBtn>
|
|
213
232
|
<button>+ Add event</button>
|
|
214
233
|
</ng-template>
|
|
@@ -223,7 +242,7 @@ export class MyCustomCalendarComponent extends CalendarBaseComponent {
|
|
|
223
242
|
|
|
224
243
|
- Wrapper: `packages/shared/angular/src/lib/components/calendar/calendar.component.ts`
|
|
225
244
|
- Standard: `packages/shared/angular/src/lib/components/calendar/standard/standard.component.ts`
|
|
226
|
-
- Preset: `packages/shared/angular/src/lib/components/calendar/preset/preset.component.ts` (selector `smart-calendar-preset`, class recipes in `preset/preset-classes.util.ts
|
|
245
|
+
- Preset: `packages/shared/angular/src/lib/components/calendar/preset/preset.component.ts` (selector `smart-calendar-preset`, class recipes in `preset/preset-classes.util.ts`, internal)
|
|
227
246
|
- Base class: `packages/shared/angular/src/lib/components/calendar/base/base.component.ts`
|
|
228
247
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CALENDAR_STANDARD_COMPONENT_TOKEN`)
|
|
229
248
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ICalendarOptions`, `ICalendarEvent`, `ICalendarDayCell`, `SmartCalendarView`)
|
|
@@ -18,15 +18,22 @@ Flexible card container with injectable standard rendering. The `<smart-card>` w
|
|
|
18
18
|
|
|
19
19
|
### Wrapper: `smart-card`
|
|
20
20
|
|
|
21
|
-
| Input | Type | Default | Description
|
|
22
|
-
| ----------- | -------------- | ----------- |
|
|
23
|
-
| `options` | `ICardOptions` | `undefined` | Card configuration
|
|
24
|
-
| `hasHeader` | `boolean` | `false` |
|
|
25
|
-
| `hasFooter` | `boolean` | `false` |
|
|
26
|
-
| `class` | `string` | `''` | Extra container class
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
|
+
| ----------- | -------------- | ----------- | -------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `options` | `ICardOptions` | `undefined` | Card configuration |
|
|
24
|
+
| `hasHeader` | `boolean` | `false` | Renders the header section. The `[cardHeader]` content and `options.title` show only while `true`. |
|
|
25
|
+
| `hasFooter` | `boolean` | `false` | Renders the footer section. The `[cardFooter]` content shows only while `true`. |
|
|
26
|
+
| `class` | `string` | `''` | Extra container class |
|
|
27
27
|
|
|
28
28
|
### ICardOptions
|
|
29
29
|
|
|
30
|
+
| Field | Type | Default | Description |
|
|
31
|
+
| ------------ | --------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `title` | `string` | `undefined` | Rendered as an `<h3>` at the start of the header, when `hasHeader` is `true`. |
|
|
33
|
+
| `buttons` | `Array<IIconButtonOptions>` | `undefined` | Deprecated: not read by the built-in implementations (standard or preset); available to a custom implementation. Put actions in the `[cardHeader]` / `[cardFooter]` slots instead. |
|
|
34
|
+
| `grayFooter` | `boolean` | `undefined` | Gray background on the footer. |
|
|
35
|
+
| `grayBody` | `boolean` | `undefined` | Gray background on the body. |
|
|
36
|
+
|
|
30
37
|
```typescript
|
|
31
38
|
interface ICardOptions {
|
|
32
39
|
title?: string;
|
|
@@ -37,15 +44,15 @@ interface ICardOptions {
|
|
|
37
44
|
}
|
|
38
45
|
```
|
|
39
46
|
|
|
40
|
-
`
|
|
47
|
+
`IIconButtonOptions` (`icon`, `text`, `handler`, `component`, `type`, `disabled$: Observable<boolean>`, `number`) is shared with the page buttons; the card does not render it.
|
|
41
48
|
|
|
42
49
|
### Content Projection
|
|
43
50
|
|
|
44
|
-
| Selector | Description
|
|
45
|
-
| -------------- |
|
|
46
|
-
| `[cardHeader]` | Header content |
|
|
47
|
-
| default | Body content
|
|
48
|
-
| `[cardFooter]` | Footer content |
|
|
51
|
+
| Selector | Description |
|
|
52
|
+
| -------------- | ------------------------------------- |
|
|
53
|
+
| `[cardHeader]` | Header content (with `hasHeader` set) |
|
|
54
|
+
| default | Body content |
|
|
55
|
+
| `[cardFooter]` | Footer content (with `hasFooter` set) |
|
|
49
56
|
|
|
50
57
|
## Usage
|
|
51
58
|
|
|
@@ -74,19 +81,19 @@ interface ICardOptions {
|
|
|
74
81
|
|
|
75
82
|
Three-layer pattern mirroring `<smart-button>`:
|
|
76
83
|
|
|
77
|
-
1. **`CardBaseComponent`** (`@Directive()`) — shared
|
|
84
|
+
1. **`CardBaseComponent`** (`@Directive()`) — shared inputs (`options`, `hasHeader`, `hasFooter`, `cssClass` with the `class` alias, the optional `headerTpl` / `footerTpl` and the required `bodyTpl`, all `TemplateRef<unknown>`) and computed classes (`sharedContainerClasses`, `headerClasses`, `bodyClasses`, `footerClasses`). Handles divider, gray body/footer, and padding rules.
|
|
78
85
|
2. **`CardStandardComponent`** (selector: `smart-card-standard`) — default concrete implementation extending the base. Neutral Tailwind style with dark mode (`rounded-lg`, `bg-white`, `shadow-sm`, `dark:bg-gray-800/50`, `dark:outline-white/10`).
|
|
79
|
-
3. **`CardComponent`** (selector: `smart-card`) — wrapper. Uses `inject(CARD_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-card-standard>`. Content projection (`[cardHeader]`, default, `[cardFooter]`) is wrapped in local `<ng-template>` refs and passed as inputs (`headerTpl`/`bodyTpl`/`footerTpl`) to the active component
|
|
86
|
+
3. **`CardComponent`** (selector: `smart-card`) — wrapper. Uses `inject(CARD_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-card-standard>`. Content projection (`[cardHeader]`, default, `[cardFooter]`) is wrapped in local `<ng-template>` refs and passed as inputs (`headerTpl`/`bodyTpl`/`footerTpl`) to the active component, together with `options`, `hasHeader`, `hasFooter` and `class`.
|
|
80
87
|
|
|
81
|
-
##
|
|
88
|
+
## Extending the Base Class
|
|
82
89
|
|
|
83
90
|
```typescript
|
|
91
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
84
92
|
import { Component } from '@angular/core';
|
|
85
93
|
import {
|
|
86
94
|
CardBaseComponent,
|
|
87
95
|
CARD_STANDARD_COMPONENT_TOKEN,
|
|
88
96
|
} from '@smartsoft001/angular';
|
|
89
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
90
97
|
|
|
91
98
|
@Component({
|
|
92
99
|
selector: 'smart-card-my-variant',
|
|
@@ -101,11 +108,13 @@ providers: [
|
|
|
101
108
|
];
|
|
102
109
|
```
|
|
103
110
|
|
|
111
|
+
Register the subclass under `CARD_STANDARD_COMPONENT_TOKEN`; every `<smart-card>` in that injector then renders it with the projected sections as `headerTpl` / `bodyTpl` / `footerTpl`.
|
|
112
|
+
|
|
104
113
|
## CardPresetComponent (`smart-card-preset`)
|
|
105
114
|
|
|
106
|
-
Fully-styled, drop-in concrete implementation extending `CardBaseComponent` — a faithful translation of Preline's card (`rounded-xl` surface, `shadow-2xs`, bordered surface header/footer) into `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants. Honours `options.title`, `options.grayBody`, and `options.grayFooter`, and renders the same `headerTpl` / `bodyTpl` / `footerTpl` slots as the base.
|
|
115
|
+
Fully-styled, drop-in concrete implementation extending `CardBaseComponent` — a faithful translation of Preline's card (`rounded-xl` surface, `shadow-2xs`, bordered surface header/footer) into `smart:`-prefixed vanilla Tailwind with explicit `dark:` variants. Honours `options.title`, `options.grayBody`, and `options.grayFooter`, and renders the same `headerTpl` / `bodyTpl` / `footerTpl` slots as the base. It separates the sections with its own borders, not with the base's divider classes.
|
|
107
116
|
|
|
108
|
-
Use it directly via `<smart-card-preset
|
|
117
|
+
Use it directly via `<smart-card-preset>` (it takes the extra classes as `class` or `[cssClass]`), register it through `CARD_STANDARD_COMPONENT_TOKEN` (`{ provide: CARD_STANDARD_COMPONENT_TOKEN, useValue: CardPresetComponent }`) to restyle every `<smart-card>`, or register every preset at once with `provideSmartPresets()`.
|
|
109
118
|
|
|
110
119
|
```typescript
|
|
111
120
|
import {
|
|
@@ -118,13 +127,11 @@ providers: [
|
|
|
118
127
|
];
|
|
119
128
|
```
|
|
120
129
|
|
|
121
|
-
Note: when rendered through the token, `CardComponent` uses `*ngComponentOutlet`, which passes inputs by **canonical name**. The preset therefore overrides the inherited `cssClass` to drop the `class` alias (`override cssClass = input<string>('')`) so extra classes bind correctly. Class recipes live in `preset/preset-classes.util.ts` (`getCardContainerClasses`, `getCardHeaderClasses`, `getCardBodyClasses`, `getCardFooterClasses`).
|
|
122
|
-
|
|
123
130
|
## File Locations
|
|
124
131
|
|
|
125
132
|
- Wrapper: `packages/shared/angular/src/lib/components/card/card.component.ts`
|
|
126
133
|
- Default: `packages/shared/angular/src/lib/components/card/standard/standard.component.{ts,html}`
|
|
127
|
-
- Preset: `packages/shared/angular/src/lib/components/card/preset/preset.component.{ts,html}` + `preset/preset-classes.util.ts`
|
|
134
|
+
- Preset: `packages/shared/angular/src/lib/components/card/preset/preset.component.{ts,html}` + `preset/preset-classes.util.ts` (internal)
|
|
128
135
|
- Base: `packages/shared/angular/src/lib/components/card/base/base.component.ts`
|
|
129
136
|
- Tests: `packages/shared/angular/src/lib/components/card/{card,standard/standard,base/base}.component.spec.ts`
|
|
130
137
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CARD_STANDARD_COMPONENT_TOKEN`)
|
|
@@ -132,4 +139,4 @@ Note: when rendered through the token, `CardComponent` uses `*ngComponentOutlet`
|
|
|
132
139
|
|
|
133
140
|
## Tailwind Classes
|
|
134
141
|
|
|
135
|
-
All classes use `smart:` prefix. `CardStandardComponent` container: `smart:overflow-hidden smart:rounded-lg smart:bg-white smart:shadow-sm`. Dark mode: `smart:dark:bg-gray-800/50 smart:dark:shadow-none smart:dark:outline smart:dark:-outline-offset-1 smart:dark:outline-white/10`. Divider when
|
|
142
|
+
All classes use `smart:` prefix. `CardStandardComponent` container: `smart:overflow-hidden smart:rounded-lg smart:bg-white smart:shadow-sm`. Dark mode: `smart:dark:bg-gray-800/50 smart:dark:shadow-none smart:dark:outline smart:dark:-outline-offset-1 smart:dark:outline-white/10`. Divider between the sections when `hasHeader` or `hasFooter` is set and neither `grayBody` nor `grayFooter` is: `smart:divide-y smart:divide-gray-200 smart:dark:divide-white/10`. Gray body/footer: `smart:bg-gray-50 smart:dark:bg-gray-800/50`.
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Card Heading Component
|
|
8
8
|
|
|
9
|
-
The `<smart-card-heading>` component provides a small composable heading region for cards, with optional slots for avatar, title, description, meta, and actions. It can be used standalone or
|
|
9
|
+
The `<smart-card-heading>` component provides a small composable heading region for cards, with optional slots for avatar, title, description, meta, and actions. It can be used standalone or projected into the `[cardHeader]` slot of `<smart-card>` (with `[hasHeader]="true"`). It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `CardHeadingBaseComponent` defines the shared API — optional `ICardHeadingOptions` and `cssClass` (alias `class`). `CardHeadingStandardComponent` is a barebones placeholder concrete implementation. `CardHeadingComponent` is the public wrapper that renders `CardHeadingStandardComponent` by default and accepts a custom replacement via `CARD_HEADING_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ The `<smart-card-heading>` component provides a small composable heading region
|
|
|
17
17
|
|
|
18
18
|
### CardHeadingComponent (`<smart-card-heading>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `CardHeadingStandardComponent` by default. When `CARD_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
20
|
+
Main wrapper component. Renders `CardHeadingStandardComponent` by default. When `CARD_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet` and passes it `options` and `class`.
|
|
21
21
|
|
|
22
22
|
### CardHeadingStandardComponent (`<smart-card-heading-standard>`)
|
|
23
23
|
|
|
@@ -38,6 +38,17 @@ Abstract base directive for extending custom card-heading implementations. Expos
|
|
|
38
38
|
|
|
39
39
|
### ICardHeadingOptions
|
|
40
40
|
|
|
41
|
+
| Field | Type | Default | Description |
|
|
42
|
+
| -------------- | --------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
|
|
43
|
+
| `title` | `string` | `undefined` | The heading text. |
|
|
44
|
+
| `description` | `string` | `undefined` | Text under the title. |
|
|
45
|
+
| `avatarTpl` | `TemplateRef<unknown>` | `undefined` | An avatar or image. |
|
|
46
|
+
| `actionsTpl` | `TemplateRef<unknown>` | `undefined` | Buttons or a menu. |
|
|
47
|
+
| `metaTpl` | `TemplateRef<unknown>` | `undefined` | Meta information (date, tags, read time); the preset wraps it in a `<dl>` (`author`, `stacked`). |
|
|
48
|
+
| `presentation` | `{ variant?: 'author' \| 'stacked' \| 'overlay' \| 'outline' }` | `undefined` | Preset only: `variant` picks the look (`'author'` by default). The standard ignores it. |
|
|
49
|
+
|
|
50
|
+
All properties are optional. The default `CardHeadingStandardComponent` renders every slot except `presentation`; a section is rendered only when its template/string is provided.
|
|
51
|
+
|
|
41
52
|
```typescript
|
|
42
53
|
interface ICardHeadingOptions {
|
|
43
54
|
title?: string;
|
|
@@ -45,18 +56,19 @@ interface ICardHeadingOptions {
|
|
|
45
56
|
avatarTpl?: TemplateRef<unknown>;
|
|
46
57
|
actionsTpl?: TemplateRef<unknown>;
|
|
47
58
|
metaTpl?: TemplateRef<unknown>;
|
|
59
|
+
presentation?: {
|
|
60
|
+
variant?: 'author' | 'stacked' | 'overlay' | 'outline';
|
|
61
|
+
};
|
|
48
62
|
}
|
|
49
63
|
```
|
|
50
64
|
|
|
51
|
-
All properties are optional. The default `CardHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
52
|
-
|
|
53
65
|
## CARD_HEADING_STANDARD_COMPONENT_TOKEN
|
|
54
66
|
|
|
55
67
|
```typescript
|
|
56
68
|
import { CARD_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
57
69
|
```
|
|
58
70
|
|
|
59
|
-
InjectionToken that allows replacing the default `CardHeadingStandardComponent` with a custom implementation. Provide a `Type<CardHeadingBaseComponent>` to override
|
|
71
|
+
InjectionToken that allows replacing the default `CardHeadingStandardComponent` with a custom implementation. Provide a `Type<CardHeadingBaseComponent>` to override; the wrapper passes it `options` and `class`.
|
|
60
72
|
|
|
61
73
|
```typescript
|
|
62
74
|
providers: [
|
|
@@ -74,7 +86,6 @@ import {
|
|
|
74
86
|
ChangeDetectionStrategy,
|
|
75
87
|
Component,
|
|
76
88
|
computed,
|
|
77
|
-
input,
|
|
78
89
|
ViewEncapsulation,
|
|
79
90
|
} from '@angular/core';
|
|
80
91
|
import { NgTemplateOutlet } from '@angular/common';
|
|
@@ -105,9 +116,6 @@ import { CardHeadingBaseComponent } from '@smartsoft001/angular';
|
|
|
105
116
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
106
117
|
})
|
|
107
118
|
export class MyCustomCardHeadingComponent extends CardHeadingBaseComponent {
|
|
108
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
109
|
-
override cssClass = input<string>('');
|
|
110
|
-
|
|
111
119
|
containerClasses = computed(() => {
|
|
112
120
|
const classes = ['my-card-heading'];
|
|
113
121
|
const extra = this.cssClass();
|
|
@@ -137,12 +145,9 @@ export class MyCustomCardHeadingComponent extends CardHeadingBaseComponent {
|
|
|
137
145
|
[options]="{ title: 'Job Postings', actionsTpl: actions }"
|
|
138
146
|
/>
|
|
139
147
|
|
|
140
|
-
<!-- Inside a smart-card
|
|
141
|
-
<
|
|
142
|
-
<smart-card-heading [options]="{ title: 'Job Postings' }" />
|
|
143
|
-
</ng-template>
|
|
144
|
-
|
|
145
|
-
<smart-card [options]="{ headerTpl: cardHeader }">
|
|
148
|
+
<!-- Inside a smart-card, in its header slot -->
|
|
149
|
+
<smart-card [hasHeader]="true">
|
|
150
|
+
<smart-card-heading cardHeader [options]="{ title: 'Job Postings' }" />
|
|
146
151
|
<p>Card body content</p>
|
|
147
152
|
</smart-card>
|
|
148
153
|
```
|
|
@@ -159,9 +164,8 @@ explicit `smart:dark:*` variants. Content flows from the shared
|
|
|
159
164
|
per-variant zones expose `data-role` hooks (`avatar`, `title`, `description`,
|
|
160
165
|
`meta`, `actions`, plus `title-hover` for the outline variant).
|
|
161
166
|
|
|
162
|
-
|
|
163
|
-
preset
|
|
164
|
-
`class` alias) and merges it into the root card classes.
|
|
167
|
+
The extra classes (`class` on `<smart-card-heading>`, or `class` / `[cssClass]`
|
|
168
|
+
on `<smart-card-heading-preset>`) are merged into the root card classes.
|
|
165
169
|
|
|
166
170
|
| Variant | Look | Slots used |
|
|
167
171
|
| --------- | ----------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
@@ -175,6 +179,8 @@ value).
|
|
|
175
179
|
|
|
176
180
|
### Register the preset
|
|
177
181
|
|
|
182
|
+
Provide `CardHeadingPresetComponent` under `CARD_HEADING_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-card-heading>`, or register every preset at once with `provideSmartPresets()`.
|
|
183
|
+
|
|
178
184
|
```typescript
|
|
179
185
|
import { CARD_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
180
186
|
import { CardHeadingPresetComponent } from '@smartsoft001/angular';
|
|
@@ -17,36 +17,46 @@ The `<smart-command-palette>` component provides a Cmd+K-style overlay that filt
|
|
|
17
17
|
|
|
18
18
|
### CommandPaletteComponent (`<smart-command-palette>`)
|
|
19
19
|
|
|
20
|
-
Main wrapper component. Renders `CommandPaletteStandardComponent` by default. When `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet
|
|
20
|
+
Main wrapper component. Renders `CommandPaletteStandardComponent` by default. When `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passes it every input (`class` included), writes its `open` / `query` changes back to the wrapper's models and re-emits its `runCommand`, so `[(open)]`, `[(query)]` and `(runCommand)` work the same with the standard, the preset or an implementation of your own.
|
|
21
21
|
|
|
22
22
|
### CommandPaletteStandardComponent (`<smart-command-palette-standard>`)
|
|
23
23
|
|
|
24
|
-
Barebones placeholder concrete implementation. Renders a native `<dialog [open]>` containing an `<input type="search">` bound to `query` and a `<ul role="listbox">` with one `<li role="option">` per filtered command. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a native `<dialog [open]>` containing an `<input type="search">` bound to `query` and a `<ul role="listbox">` with one `<li role="option">` per filtered command, or an `options.emptyText` item (`'No results'` by default) when nothing matches. `Escape` anywhere in the document closes an open palette (`onEscape()`, also inherited by the preset), and so does the dialog's `close` event. It ignores `options.variant` and every `ICommand` field but `id` and `label`, and it does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token. The `Cmd+K` global shortcut (open) is left to the application.
|
|
25
25
|
|
|
26
26
|
### CommandPaletteBaseComponent (abstract)
|
|
27
27
|
|
|
28
|
-
Abstract base directive for extending custom command palette implementations. Exposes `commands` as an `InputSignal<ICommand[]>` (default `[]`), `open` and `query` as two-way `ModelSignal`s (defaults `false` / `''`), `options` as an `InputSignal<ICommandPaletteOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), a `filteredCommands` computed (case-insensitive `label` substring), a `selectCommand(commandId)` method that emits the `runCommand` output and sets `open` to `false`, and a `close()` method that sets `open` to `false`.
|
|
28
|
+
Abstract base directive for extending custom command palette implementations. Exposes `commands` as an `InputSignal<ICommand[]>` (default `[]`), `open` and `query` as two-way `ModelSignal`s (defaults `false` / `''`), `options` as an `InputSignal<ICommandPaletteOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), a `filteredCommands` computed (case-insensitive `label` substring), a `selectCommand(commandId)` method that emits the `runCommand` output and sets `open` to `false`, and a `close()` method that sets `open` to `false`. The base binds no keyboard listeners.
|
|
29
29
|
|
|
30
30
|
## API
|
|
31
31
|
|
|
32
32
|
### Inputs
|
|
33
33
|
|
|
34
|
-
| Input | Type | Default | Description
|
|
35
|
-
| ---------- | -------------------------------------------------- | ------- |
|
|
36
|
-
| `commands` | `InputSignal<ICommand[]>` | `[]` | List of commands available in the palette
|
|
37
|
-
| `open` | `ModelSignal<boolean>` | `false` | Visibility state (two-way bindable)
|
|
38
|
-
| `query` | `ModelSignal<string>` | `''` | Search query (two-way bindable)
|
|
39
|
-
| `options` | `InputSignal<ICommandPaletteOptions \| undefined>` | - | Optional configuration
|
|
40
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ---------- | -------------------------------------------------- | ------- | ----------------------------------------------------------------- |
|
|
36
|
+
| `commands` | `InputSignal<ICommand[]>` | `[]` | List of commands available in the palette |
|
|
37
|
+
| `open` | `ModelSignal<boolean>` | `false` | Visibility state (two-way bindable; `openChange` reports changes) |
|
|
38
|
+
| `query` | `ModelSignal<string>` | `''` | Search query (two-way bindable; `queryChange` reports changes) |
|
|
39
|
+
| `options` | `InputSignal<ICommandPaletteOptions \| undefined>` | - | Optional configuration |
|
|
40
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes on the dialog (alias for `cssClass`) |
|
|
41
41
|
|
|
42
42
|
### Outputs
|
|
43
43
|
|
|
44
|
-
| Output | Payload | Description
|
|
45
|
-
| ------------ | ----------------------- |
|
|
46
|
-
| `runCommand` | `{ commandId: string }` | Fired when a user selects a command |
|
|
44
|
+
| Output | Payload | Description |
|
|
45
|
+
| ------------ | ----------------------- | -------------------------------------------------------------- |
|
|
46
|
+
| `runCommand` | `{ commandId: string }` | Fired when a user selects a command, before the palette closes |
|
|
47
47
|
|
|
48
48
|
### ICommand
|
|
49
49
|
|
|
50
|
+
| Field | Type | Default | Description |
|
|
51
|
+
| ------------- | -------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `id` | `string` | required | Reported as `commandId` by `runCommand`. |
|
|
53
|
+
| `label` | `string` | required | Searched and shown. |
|
|
54
|
+
| `icon` | `string` | `undefined` | Preset only: the leading glyph of the `with-icons` variant (`#` when absent). |
|
|
55
|
+
| `group` | `string` | `undefined` | Preset only: the group header of the `with-groups` variant (`Other` when absent). |
|
|
56
|
+
| `href` | `string` | `undefined` | Not read by the built-in implementations (no variant navigates to it); available to a custom implementation or your `runCommand` handler. |
|
|
57
|
+
| `description` | `string` | `undefined` | Preset only: the preview text of the `with-preview` variant. |
|
|
58
|
+
| `imageUrl` | `string` | `undefined` | Preset only: the leading avatar of the `with-images` variant. |
|
|
59
|
+
|
|
50
60
|
```typescript
|
|
51
61
|
interface ICommand {
|
|
52
62
|
id: string;
|
|
@@ -61,6 +71,15 @@ interface ICommand {
|
|
|
61
71
|
|
|
62
72
|
### ICommandPaletteOptions
|
|
63
73
|
|
|
74
|
+
| Field | Type | Default | Description |
|
|
75
|
+
| ------------- | ---------------------------- | -------------- | ------------------------------------------------------------------------------ |
|
|
76
|
+
| `variant` | `SmartCommandPaletteVariant` | `'simple'` | Preset only: the look (see the variants table below). The standard ignores it. |
|
|
77
|
+
| `placeholder` | `string` | `undefined` | Placeholder of the search input. |
|
|
78
|
+
| `emptyText` | `string` | `'No results'` | Shown when nothing matches. |
|
|
79
|
+
| `ariaLabel` | `string` | `undefined` | Accessible name of the search input. |
|
|
80
|
+
|
|
81
|
+
`SmartCommandPaletteVariant` is `'simple' | 'with-padding' | 'with-preview' | 'with-images' | 'with-icons' | 'semi-transparent' | 'with-groups' | 'with-footer'`.
|
|
82
|
+
|
|
64
83
|
```typescript
|
|
65
84
|
interface ICommandPaletteOptions {
|
|
66
85
|
variant?:
|
|
@@ -78,15 +97,13 @@ interface ICommandPaletteOptions {
|
|
|
78
97
|
}
|
|
79
98
|
```
|
|
80
99
|
|
|
81
|
-
The standard component only consumes `placeholder`, `emptyText`, and `ariaLabel`. The `variant` selector is reserved for custom implementations registered through `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`.
|
|
82
|
-
|
|
83
100
|
## COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN
|
|
84
101
|
|
|
85
102
|
```typescript
|
|
86
103
|
import { COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
87
104
|
```
|
|
88
105
|
|
|
89
|
-
InjectionToken that allows replacing the default `CommandPaletteStandardComponent` with a custom implementation. Provide a `Type<CommandPaletteBaseComponent>` to override
|
|
106
|
+
InjectionToken that allows replacing the default `CommandPaletteStandardComponent` with a custom implementation. Provide a `Type<CommandPaletteBaseComponent>` to override; the wrapper passes it every input it declares and forwards its `open`, `query` and `runCommand`.
|
|
90
107
|
|
|
91
108
|
```typescript
|
|
92
109
|
// In your app providers:
|
|
@@ -105,7 +122,6 @@ import {
|
|
|
105
122
|
ChangeDetectionStrategy,
|
|
106
123
|
Component,
|
|
107
124
|
computed,
|
|
108
|
-
input,
|
|
109
125
|
ViewEncapsulation,
|
|
110
126
|
} from '@angular/core';
|
|
111
127
|
|
|
@@ -132,11 +148,9 @@ import { CommandPaletteBaseComponent } from '@smartsoft001/angular';
|
|
|
132
148
|
`,
|
|
133
149
|
encapsulation: ViewEncapsulation.None,
|
|
134
150
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
151
|
+
host: { '(document:keydown.escape)': 'open() && close()' },
|
|
135
152
|
})
|
|
136
153
|
export class MyCustomCommandPaletteComponent extends CommandPaletteBaseComponent {
|
|
137
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
138
|
-
override cssClass = input<string>('');
|
|
139
|
-
|
|
140
154
|
containerClasses = computed(() => {
|
|
141
155
|
const classes = ['my-command-palette'];
|
|
142
156
|
const extra = this.cssClass();
|
|
@@ -153,9 +167,8 @@ export class MyCustomCommandPaletteComponent extends CommandPaletteBaseComponent
|
|
|
153
167
|
|
|
154
168
|
When extending the base directly, remember to:
|
|
155
169
|
|
|
156
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
157
170
|
- call `selectCommand(id)` rather than emitting `runCommand` manually — it already sets `open.set(false)` for you,
|
|
158
|
-
- handle the `Escape` key and
|
|
171
|
+
- handle the `Escape` key (and a global `Cmd+K` shortcut if you want one) yourself: the base binds no keyboard listeners.
|
|
159
172
|
|
|
160
173
|
## Usage Examples
|
|
161
174
|
|
|
@@ -172,7 +185,7 @@ When extending the base directly, remember to:
|
|
|
172
185
|
<smart-command-palette
|
|
173
186
|
[commands]="commands"
|
|
174
187
|
[(open)]="open"
|
|
175
|
-
[options]="{ placeholder: 'Search commands…', emptyText: '
|
|
188
|
+
[options]="{ placeholder: 'Search commands…', emptyText: 'Nothing matches.' }"
|
|
176
189
|
/>
|
|
177
190
|
|
|
178
191
|
<!-- With external class -->
|
|
@@ -202,9 +215,11 @@ function onRunCommand({ commandId }: { commandId: string }): void {
|
|
|
202
215
|
|
|
203
216
|
## Preset
|
|
204
217
|
|
|
205
|
-
`CommandPalettePresetComponent` (`<smart-command-palette-preset>`) is the styled, production-ready replacement for the barebones standard component. It `extends CommandPaletteStandardComponent`, so all filtering (`filteredCommands`), query handling (`onQueryChange`), selection (`selectCommand` → emit `runCommand` + close),
|
|
218
|
+
`CommandPalettePresetComponent` (`<smart-command-palette-preset>`) is the styled, production-ready replacement for the barebones standard component. It `extends CommandPaletteStandardComponent`, so all filtering (`filteredCommands`), query handling (`onQueryChange`), selection (`selectCommand` → emit `runCommand` + close), `close()` and the Escape listener are inherited unchanged; the preset only adds the visual layer driven by `options.variant`.
|
|
206
219
|
|
|
207
|
-
|
|
220
|
+
Register it under `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN` (`{ provide: COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN, useValue: CommandPalettePresetComponent }`) to restyle every `<smart-command-palette>`, register every preset at once with `provideSmartPresets()`, or use the `<smart-command-palette-preset>` selector directly (it takes the extra classes as `class` or `[cssClass]`).
|
|
221
|
+
|
|
222
|
+
The base look is a native `<dialog [open]>` styled `smart:mx-auto smart:mt-16 smart:w-full smart:max-w-xl smart:rounded-xl` with a gray border, white/`dark:bg-gray-800` surface and `smart:shadow-xl`; a search input with a leading magnifier SVG (`ps-11`, `focus:ring-blue-500`); a `<ul role="listbox">` with `smart:divide-y` rows that hover `smart:bg-gray-100 dark:bg-gray-700`; and a centered `smart:text-gray-500` empty state using `options.emptyText` (fallback `No results`). All Tailwind utilities are `smart:`-prefixed with explicit `dark:` twins in the same template; the class recipes are internal to the preset (not exported).
|
|
208
223
|
|
|
209
224
|
### Variants (`options.variant`, default `simple`)
|
|
210
225
|
|
|
@@ -239,17 +254,11 @@ providers: [
|
|
|
239
254
|
];
|
|
240
255
|
```
|
|
241
256
|
|
|
242
|
-
Because `CommandPaletteComponent` forwards inputs canonically through `NgComponentOutlet` (`componentInputs = { commands, open, query, options, cssClass }`), the preset declares `override cssClass = input<string>('')` (dropping the inherited `class` alias) so external classes bind.
|
|
243
|
-
|
|
244
|
-
### Known limitation — model() two-way writeback
|
|
245
|
-
|
|
246
|
-
`open` and `query` are `model()` signals, but the wrapper renders the preset via `NgComponentOutlet`, which passes inputs by value and does not wire an output-side binding. So `[(open)]`/`[(query)]` two-way writeback from the injected preset does **not** propagate back up through the wrapper (a token-path limitation). The preset still updates its own `open`/`query` internally (e.g. `selectCommand` closes the dialog locally, `onQueryChange` filters), and `runCommand` is forwarded normally. If you need the parent's `open`/`query` signals kept in sync, use `<smart-command-palette-preset>` directly with `[(open)]`/`[(query)]` instead of going through the token, or drive `open`/`query` as one-way inputs and react to `runCommand`. This is a wrapper-level constraint and is intentionally not patched here.
|
|
247
|
-
|
|
248
257
|
## File Locations
|
|
249
258
|
|
|
250
259
|
- Wrapper: `packages/shared/angular/src/lib/components/command-palette/command-palette.component.ts`
|
|
251
260
|
- Standard: `packages/shared/angular/src/lib/components/command-palette/standard/standard.component.ts`
|
|
252
|
-
- Preset: `packages/shared/angular/src/lib/components/command-palette/preset/preset.component.ts` (classes in `preset/preset-classes.util.ts
|
|
261
|
+
- Preset: `packages/shared/angular/src/lib/components/command-palette/preset/preset.component.ts` (classes in `preset/preset-classes.util.ts`, internal)
|
|
253
262
|
- Stories: `packages/shared/angular/src/lib/components/command-palette/command-palette.component.stories.ts`
|
|
254
263
|
- Base class: `packages/shared/angular/src/lib/components/command-palette/base/base.component.ts`
|
|
255
264
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`)
|