@smartsoft001/claude-plugins 2.202.0 → 2.204.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.
Files changed (22) hide show
  1. package/package.json +1 -1
  2. package/plugins/smart-angular/.claude-plugin/plugin.json +1 -1
  3. package/plugins/smart-angular/skills/angular-components-details/SKILL.md +32 -4
  4. package/plugins/smart-angular/skills/angular-components-input/SKILL.md +24 -16
  5. package/plugins/smart-angular/skills/angular-components-list/SKILL.md +79 -36
  6. package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +81 -13
  7. package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +51 -1
  8. package/plugins/smart-angular/skills/angular-components-page/SKILL.md +7 -5
  9. package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +3 -3
  10. package/plugins/smart-angular/skills/smart-crud/SKILL.md +5 -2
  11. package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
  12. package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
  13. package/plugins/smart-react/skills/react-components-details/SKILL.md +6 -6
  14. package/plugins/smart-react/skills/react-components-input/SKILL.md +10 -0
  15. package/plugins/smart-react/skills/react-components-list/SKILL.md +66 -33
  16. package/plugins/smart-react/skills/react-components-modal/SKILL.md +24 -12
  17. package/plugins/smart-react/skills/react-components-notification/SKILL.md +1 -1
  18. package/plugins/smart-react/skills/react-components-overlays/SKILL.md +15 -14
  19. package/plugins/smart-react/skills/react-components-page/SKILL.md +5 -5
  20. package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +3 -3
  21. package/plugins/smart-react/skills/react-provider/SKILL.md +1 -1
  22. package/plugins/smart-react/skills/smart-crud-react/SKILL.md +2 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: angular-components-notification
3
- description: Notification component API with InjectionToken pattern for custom implementations.
3
+ description: Notification component API with InjectionToken pattern for custom implementations, and ToastService for showing toasts from code.
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -12,6 +12,7 @@ The `<smart-notification>` component displays a transient or persistent message
12
12
 
13
13
  - Developer wants to use or customize the notification component
14
14
  - Developer asks about `<smart-notification>`, `NotificationComponent`, `NotificationStandardComponent`, or `NotificationBaseComponent`
15
+ - Developer wants to show a toast from code (`ToastService`), or toasts and `ErrorService` errors do not appear
15
16
 
16
17
  ## Components
17
18
 
@@ -185,6 +186,54 @@ The inherited `cssClass` (input alias `class`) receives the class passed to `<sm
185
186
  - The dismiss button carries `aria-label="Close"` since its visible content is the `×` glyph.
186
187
  - Custom implementations should preserve `role="status"` and `aria-live` to keep this contract.
187
188
 
189
+ ## Toasts from code
190
+
191
+ `ToastService` (provided by `SharedServicesModule`) shows short messages at the bottom of the screen. While it has toasts it mounts one host at the end of `<body>`: a stack fixed to the bottom of the viewport (centred, right-aligned from `sm`, above the modals), every toast rendered through `<smart-notification>`. The implementation registered for `NOTIFICATION_STANDARD_COMPONENT_TOKEN` (the preset with `provideSmartPresets()`) therefore restyles the toasts too; the standard one renders them unstyled. A toast shows its `title` as the heading with the `message` under it, or the `message` alone, and its `buttons` as the notification's actions. It closes itself after `duration` ms, on its close button, or once the handler of one of its buttons ran. `ErrorService.log(error)` and the file inputs report their errors through it.
192
+
193
+ | Member | What it does |
194
+ | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
195
+ | `info(options: IToastOptions): Promise<void>` | Shows an info toast, announced politely (`aria-live="polite"`). |
196
+ | `error(options: IToastOptions): Promise<void>` | Shows an error toast, announced assertively (`aria-live="assertive"`), unless an error lock is held. |
197
+ | `dismiss(id: number): void` | Closes a toast. |
198
+ | `addLockError()` / `removeLockError()` | Holds / releases an error lock, counted in the static `ToastService.lockError` (never below zero). While a lock is held, error toasts are swallowed, e.g. during a sign-out that makes requests fail. |
199
+ | `toasts: Signal<IToast[]>` | The toasts shown, oldest first (`IToast` adds `id` and `type: 'error' \| 'info'` to the options). |
200
+
201
+ | `IToastOptions` field | Type | Default | Description |
202
+ | --------------------- | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
203
+ | `title` | `string` | - | The heading; the message goes under it. |
204
+ | `message` | `string` | required | The text; the heading when there is no title. |
205
+ | `duration` | `number` | `2000` | Milliseconds before the toast closes itself; a missing, zero or negative value means 2000. |
206
+ | `buttons` | `IToastButton[]` | - | `{ text, position: 'start' \| 'end', handler }`: a click runs `handler`, then closes the toast. `position` is kept for compatibility; the actions keep the given order. |
207
+
208
+ A toast without buttons renders in the `simple` notification variant, a message with buttons in `condensed`, and a title with a message and buttons in `with-actions-below`, which keeps the message under the title.
209
+
210
+ ```typescript
211
+ import { inject, Injectable } from '@angular/core';
212
+
213
+ import { ToastService } from '@smartsoft001/angular';
214
+
215
+ @Injectable()
216
+ export class SaveAction {
217
+ private toastService = inject(ToastService);
218
+
219
+ async run(save: () => Promise<void>, undo: () => void): Promise<void> {
220
+ try {
221
+ await save();
222
+ await this.toastService.info({
223
+ message: 'Saved',
224
+ buttons: [{ text: 'Undo', position: 'end', handler: undo }],
225
+ });
226
+ } catch {
227
+ await this.toastService.error({
228
+ title: 'Saving failed',
229
+ message: 'Try again in a moment.',
230
+ duration: 5000,
231
+ });
232
+ }
233
+ }
234
+ }
235
+ ```
236
+
188
237
  ## Usage Examples
189
238
 
190
239
  ```html
@@ -231,3 +280,4 @@ The inherited `cssClass` (input alias `class`) receives the class passed to `<sm
231
280
  - Base class: `packages/shared/angular/src/lib/components/notification/base/base.component.ts`
232
281
  - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`NOTIFICATION_STANDARD_COMPONENT_TOKEN`)
233
282
  - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`INotificationAction`, `INotificationOptions`, `SmartNotificationVariant`)
283
+ - Toasts: `packages/shared/angular/src/lib/services/toast/toast.service.ts` (`ToastService`, `IToastOptions`, `IToastButton`, `IToast`) and its host `toast-host.component.ts`
@@ -22,7 +22,7 @@ Main wrapper component. Always renders via `NgComponentOutlet`, forwarding `opti
22
22
 
23
23
  ### PageStandardComponent (`<smart-page-standard>`)
24
24
 
25
- Default concrete implementation and the value for `baseMap['standard']`. Renders a Tailwind-styled header with the translated title, optional back button, optional search input, `endButtons` via `<smart-button>`, and a body section driven by `options.bodyTpl`. It renders no wrapper element and does not apply the `class` (header and body are siblings); of the slot templates it renders only `bodyTpl`.
25
+ Default concrete implementation and the value for `baseMap['standard']`. Renders a Tailwind-styled header with the translated title, optional back button, optional search input, `endButtons` via `<smart-button>`, and a body section driven by `options.bodyTpl`. Header and body sit in one root element (`data-role="page"`) that takes the `class` (`cssClass`, declared without the alias like the preset's); of the slot templates it renders only `bodyTpl`.
26
26
 
27
27
  ### PageBaseComponent (abstract)
28
28
 
@@ -32,10 +32,10 @@ Abstract base directive for extending custom page variants. Exposes `options`, `
32
32
 
33
33
  ### Inputs
34
34
 
35
- | Input | Type | Default | Description |
36
- | --------- | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
37
- | `options` | `InputSignal<IPageOptions\|null>` | - | Page configuration (see `IPageOptions`) |
38
- | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`), forwarded to the variant; the preset puts them on its root, the standard variant ignores them |
35
+ | Input | Type | Default | Description |
36
+ | --------- | --------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
37
+ | `options` | `InputSignal<IPageOptions\|null>` | - | Page configuration (see `IPageOptions`) |
38
+ | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`), forwarded to the variant; the standard and preset variants put them on their root (`data-role="page"`) |
39
39
 
40
40
  ### SmartPageVariant
41
41
 
@@ -217,6 +217,8 @@ export class MyCustomPageComponent extends PageBaseComponent {}
217
217
  </smart-page>
218
218
  ```
219
219
 
220
+ The class lands on the root element of the variant (`data-role="page"`), in the standard page and in the preset alike.
221
+
220
222
  ## Preset
221
223
 
222
224
  `PagePresetComponent` (`<smart-page-preset>`) is a styled `'preset'` variant that extends `PageStandardComponent`. It renders a full application-shell layout instead of the plain standard header: a bordered `<header>`, a gray page body and a content card. Every utility is `smart:`-prefixed with explicit `smart:dark:*` twins.
@@ -21,11 +21,11 @@ Main wrapper. Delegates to `VerticalNavigationStandardComponent` by default. Whe
21
21
 
22
22
  ### VerticalNavigationStandardComponent (`<smart-vertical-navigation-standard>`)
23
23
 
24
- Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul class="groups">` with one `<li class="group">` per group. Each group renders an optional `<div class="group-title">` and a `<ul class="items">`; each item renders as `<a class="item-link">` (when `href` is provided; a click follows the link) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get the `current` class and `aria-current="page"` when `item.current === true`. Inside an item: `iconTpl` (or, without it, `initial`), `label` and `badge`. The standard does not read `options.layout` and adds no styles: the class hooks are for your CSS.
24
+ Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul class="groups">` with one `<li class="group">` per group. Each group renders an optional `<div class="group-title">` and a `<ul class="items">`, which the title names (`aria-labelledby`); each item renders as `<a class="item-link">` (when `href` is provided; a click follows the link) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get the `current` class and `aria-current="page"` when `item.current === true`. Inside an item: `iconTpl` (or, without it, `initial`), `label` and `badge`. The standard does not read `options.layout` and adds no styles: the class hooks are for your CSS.
25
25
 
26
26
  ### VerticalNavigationPresetComponent (`<smart-vertical-navigation-preset>`)
27
27
 
28
- Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Register it through `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-vertical-navigation>`, or use the `<smart-vertical-navigation-preset>` selector directly. Renders the Preline vertical-tabs look: each group is its own `<nav>` (all with the `aria-label` from `options.ariaLabel`, default `"Sidebar"`), preceded by its title when set, with a trailing border (`border-e-2`); each item is a tab (`<a>` for `href`, `<button>` emitting `itemClick` otherwise) with its own trailing border. The `current` item gains the primary accent (`border-blue-600`, `text-blue-600`, `font-medium`) and `aria-current="page"`; inactive items are muted gray with a primary hover/focus. Supports `iconTpl`, `initial`, `label` and `badge`. It does not read `options.layout` either. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
28
+ Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Register it through `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-vertical-navigation>`, or use the `<smart-vertical-navigation-preset>` selector directly. Renders the Preline vertical-tabs look: one `<nav>` landmark (named by `options.ariaLabel`, default `"Sidebar"`) with a trailing border (`border-e-2`) holds every group; a group is its title, when set, followed by a `<ul role="list">` of the items that the title names (`aria-labelledby`), so a screen reader announces one navigation and a list per group ("Workspace", "Account"). Each item is a tab (`<a>` for `href`, `<button>` emitting `itemClick` otherwise) with its own trailing border, inside an `<li>`. The `current` item gains the primary accent (`border-blue-600`, `text-blue-600`, `font-medium`) and `aria-current="page"`; inactive items are muted gray with a primary hover/focus. Supports `iconTpl`, `initial`, `label` and `badge`. It does not read `options.layout` either. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
29
29
 
30
30
  > `VerticalNavigationPresetComponent` declares `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-vertical-navigation-preset>` selector directly, or just pass `class` on `<smart-vertical-navigation>` (the wrapper forwards it). With the preset registered through the token, `(itemClick)` on `<smart-vertical-navigation>` works as with the standard.
31
31
 
@@ -59,7 +59,7 @@ Abstract base directive. Exposes:
59
59
  | ----------- | ------------------------ | ----------- | ----------------------------------------------------------------------------------------------------- |
60
60
  | `items` | `IVerticalNavItem[]` | `[]` | Items of a first, untitled group. |
61
61
  | `groups` | `IVerticalNavGroup[]` | `[]` | Further groups, rendered after `items`. |
62
- | `ariaLabel` | `string` | `'Sidebar'` | Accessible name of the navigation (in the preset, of every group's `<nav>`). |
62
+ | `ariaLabel` | `string` | `'Sidebar'` | Accessible name of the navigation's one `<nav>` landmark (the groups are lists named by their title). |
63
63
  | `layout` | `SmartVerticalNavLayout` | - | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
64
64
 
65
65
  `SmartVerticalNavLayout` is `'simple' | 'with-badges' | 'with-icons' | 'with-icons-and-badges' | 'with-secondary-navigation' | 'on-gray'`.
@@ -63,13 +63,16 @@ registers the NgRx reducer (`NgrxStoreService.addReducer(config.entity, …)`) a
63
63
  ### `CrudFullConfig<T>` (extends `CrudConfig<T>`)
64
64
 
65
65
  - `title: string`
66
- - `details?` / `edit?` — `boolean | { cellPipe?; components?: { top?; bottom? } }`
66
+ - `details?` / `edit?` — `boolean | { cellPipe?; components?: { top?; bottom? } }`; with `details`
67
+ every row of the list also gets a details action that opens the record in a modal (`DetailsPage`)
67
68
  - `add?` — `boolean | { components?: { top?; bottom? } }`
68
69
  - `remove?` / `search?` / `export?` — `boolean`
69
70
  - `pagination?: { limit: number }` — the backend (`CrudShellNestjsModule.forRoot`) caps a page at
70
71
  `maxQueryLimit` (default 100), so a list without `pagination` shows at most that many rows;
71
72
  exports use `maxExportLimit` (default 10000) and are refused with 400 rather than truncated
72
- - `sort?` — `boolean | { default?: string; defaultDesc?: boolean }`
73
+ - `sort?` — `boolean | { default?: string; defaultDesc?: boolean }`: the first read sorts by
74
+ `default`, and the desktop list headers sort the list (a click reads again with `sortBy` /
75
+ `sortDesc` from the first page)
73
76
  - `list?` — `{ cellPipe?; components?: { top?; multi? }; mode?: ListMode; paginationMode?: PaginationMode; resetQuery?: 'beforeInit'; groups?: Array<ICrudListGroup> }`
74
77
  - `buttons?: Array<IIconButtonOptions>`
75
78
  - `inputComponents?: { [key: string]: Type<InputBaseComponent<T>> }`
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "smart-core",
3
3
  "description": "Smartsoft core for every project - safety validation, audit logging and auto-formatting hooks, plus the framework-neutral skills (audit-log, format-code, project-conventions, safety-check)",
4
- "version": "2.201.0"
4
+ "version": "2.203.0"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-react",
3
3
  "description": "Smartsoft for React projects - the @smartsoft001/react component, provider and forms skills, their react-components agent, and the React CRUD skill (@smartsoft001/crud-shell-react)",
4
- "version": "2.201.0",
4
+ "version": "2.203.0",
5
5
  "dependencies": ["smart-core"]
6
6
  }
@@ -40,11 +40,11 @@ All from `@smartsoft001/react`.
40
40
 
41
41
  What `useDetailsModal` opens: a component and its params.
42
42
 
43
- | Field | Type | Default | Description |
44
- | ----------- | ----------------------- | ---------- | ---------------------------------------------------------------- |
45
- | `component` | `ComponentType<any>` | required | Rendered in the modal, with `params` as its `value` prop. |
46
- | `params` | `any` | required | Passed to the component as its `value` prop. |
47
- | `mode?` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show` (the modal host does not read it). |
43
+ | Field | Type | Default | Description |
44
+ | ----------- | ----------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `component` | `ComponentType<any>` | required | Rendered in the modal, with `params` as its `value` prop. |
46
+ | `params` | `any` | required | Passed to the component as its `value` prop. |
47
+ | `mode?` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show`; `'bottom'` opens a bottom sheet (the `bottom-sheet` variant) with the `smart-modal-bottom` class. |
48
48
 
49
49
  ### `IDetailsOptions<T extends IEntity<string>>`
50
50
 
@@ -100,7 +100,7 @@ Formats a value: `transform(item, key, translate?)` returns text (sanitised) or
100
100
 
101
101
  ## In a modal
102
102
 
103
- `useDetailsModal({ component, params, mode? }, { onShowed?, onDismissed? })` returns a click handler that opens `component` in a modal through `ModalService`, with `{ value: params }` as its props, and resolves once the modal closed. `SmartDetailsPage` is the component made for it: it renders `SmartDetails` of `value` full width, with the application style applied. `useDetailsPageOptions(value)` returns page options (title, a remove button for `removeHandler`, a forward button for `itemHandler`) for a page layout of your own around it.
103
+ `SmartList` opens the same page for its `details` option, with the item loaded after the modal opened (see `react-components-list`). `useDetailsModal({ component, params, mode? }, { onShowed?, onDismissed? })` returns a click handler that opens `component` in a modal through `ModalService`, with `{ value: params }` as its props, and resolves once the modal closed. `SmartDetailsPage` is the component made for it: it renders `SmartDetails` of `value` full width, with the application style applied. `useDetailsPageOptions(value)` returns page options (title, a remove button for `removeHandler`, a forward button for `itemHandler`) for a page layout of your own around it.
104
104
 
105
105
  ## Usage
106
106
 
@@ -161,6 +161,16 @@ Props of the rich-text editor of `longText` fields.
161
161
 
162
162
  Uploading fields need a file service: give `SmartProvider` a `fileServiceConfig` (`{ apiUrl }`) or a `fileService`; without one, a picked file is not uploaded. Files go to `<apiUrl>/attachments`.
163
163
 
164
+ ## Possibilities
165
+
166
+ The `radio` and `check` fields (standard and preset) and the preset `enum` list their possibilities from, in this order of precedence:
167
+
168
+ 1. the model possibilities provider (`modelPossibilitiesProvider` on `SmartProvider`), asked with `{ type, key, instance }` (the model's class, the field key and the form's value) when the field mounts and again 500 ms after the form's value last changed, as long as it returns a list or a promise of one (a `null` or `undefined` result is ignored);
169
+ 2. else `options.possibilities`;
170
+ 3. else the field's own `possibilities` (read through the first item of an array model): an object map `{ text: id }`, such as an enum, as a list for `radio` and the preset `enum`, a list as it is for `check`.
171
+
172
+ The `check` fields check each possibility whose `id` is in the value (or equals it). The standard `enum` lists the keys of the enum in `fieldOptions.possibilities` and asks no provider. `useInputPossibilities` returns the first two sources (the provider's, else the input options'), so a custom field adds its own fallback.
173
+
164
174
  ## Labels, info and messages
165
175
 
166
176
  - The label is the label provider's (`modelLabelProvider` on `SmartProvider`) or the translation of `MODEL.<key>` (see `react-provider`).
@@ -1,17 +1,18 @@
1
1
  ---
2
2
  name: react-components-list
3
- description: SmartList React component API (@smartsoft001/react) — list of model records whose columns come from @Field({ list }) metadata, fed by an IListProvider (list, loading), in desktop/mobile/masonryGrid modes, with item navigation, confirmed remove, multi-select, pagination (single page or infinite scroll) and cell pipes; listModeComponents / LIST_PRESET_MODE_COMPONENTS, the 'list' registry key and the useList hook.
3
+ description: SmartList React component API (@smartsoft001/react) — list of model records whose columns come from @Field({ list }) metadata, fed by an IListProvider (list, loading), in desktop/mobile/masonryGrid modes, with item navigation, confirmed remove, multi-select, sortable headers, details in a modal, pagination (single page or infinite scroll) and cell pipes; listModeComponents / LIST_PRESET_MODE_COMPONENTS, the 'list' registry key and the useList hook.
4
4
  user-invocable: false
5
5
  ---
6
6
 
7
7
  # List (`SmartList`)
8
8
 
9
- `SmartList` renders records of a `@Model` class. Its columns are the model's fields marked `@Field({ list: ... })`, sorted by `list.order`; its rows come from `options.provider.list`, and `provider.loading` shows the loader (and suppresses the "no results" text). `options.mode` picks the layout: `ListMode.desktop` (a table, the default), `ListMode.mobile` (stacked rows) or `ListMode.masonryGrid` (image tiles). Row actions are opt-in: `item` adds a "go to item" action (navigate to `routingPrefix + id` through the navigation adapter, or call `select(id)`), `remove` a remove action confirmed with an alert, `select: 'multi'` a checkbox column. The list **does not fetch**: the provider's owner loads the data (CRUD screens wire all of this from a `CrudFullConfig`).
9
+ `SmartList` renders records of a `@Model` class. Its columns are the model's fields marked `@Field({ list: ... })`, sorted by `list.order`; its rows come from `options.provider.list`, and `provider.loading` shows the loader (and suppresses the "no results" text). `options.mode` picks the layout: `ListMode.desktop` (a table, the default), `ListMode.mobile` (stacked rows) or `ListMode.masonryGrid` (image tiles). Row actions are opt-in: `item` adds a "go to item" action (navigate to `routingPrefix + id` through the navigation adapter, or call `select(id)`), `remove` a remove action confirmed with an alert, `details` a details action that opens the record in a modal, `select: 'multi'` a checkbox column. With `sort` the desktop headers are sort buttons. The list **does not fetch**: the provider's owner loads the data, also sorted (`provider.getData`) or by pages (CRUD screens wire all of this from a `CrudFullConfig`).
10
10
 
11
11
  ## When to Use This Skill
12
12
 
13
13
  - Showing records of a model with columns taken from `@Field({ list })`
14
- - Row actions: navigate to an item, remove with confirmation, multi-select
14
+ - Row actions: navigate to an item, remove with confirmation, details in a modal, multi-select
15
+ - Sortable column headers (`sort`)
15
16
  - Paging through a provider (`pagination`), single page or infinite scroll
16
17
  - Choosing the layout per mode, or the preset table look (`presentation`)
17
18
  - Replacing a mode's component (`listModeComponents`) or the whole list (`components.list`), building on `useList`
@@ -22,25 +23,27 @@ For data that is not a model (plain rows), use `SmartTable` or `SmartStackedList
22
23
 
23
24
  All from `@smartsoft001/react`.
24
25
 
25
- | Export | Kind | What it is |
26
- | ---------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
- | `SmartList` | component | Resolves the list `fields` of `options.type` (the fields with `list` options, sorted by `list.order`) and renders the implementation of `options.mode` (desktop by default): the one registered in `listModeComponents` on `SmartProvider` (e.g. `LIST_PRESET_MODE_COMPONENTS`), else `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`. |
28
- | `SmartListDesktop` | component | The desktop list: a table with one column per list field, plus the multi-select, remove and item columns, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
29
- | `SmartListDesktopPreset` | component | Preline-styled desktop list variation. |
30
- | `SmartListMasonryGrid` | component | The masonry-grid list: a grid of tiles with the item's image (the model's first image field, lazy loaded) over its non-image cells, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
31
- | `SmartListMasonryGridPreset` | component | Preline-styled masonry-grid list variation: keeps the masonry column layout and renders every item as a Preline card, the image on a rounded top, the first non-image column as the title and the others as text. |
32
- | `SmartListMobile` | component | The mobile list: a stacked list with one paragraph per cell and the remove / item buttons, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
33
- | `SmartListMobilePreset` | component | Preline-styled mobile list variation: a responsive grid of cards. |
34
- | `useListFileUrl` | hook | The download URL of an image cell's attachment (`''` without a file service). |
35
- | `useList` | hook | The behaviour every list mode shares: the column `keys` (permissions via `useAuthService()`, dynamic `__array` columns), the provider `list` and `loading`, the `sort` options, the remove flow (a confirm alert, then `remove.provider.invoke(id)`), item navigation (`useNavigation().navigate(routingPrefix + id)` or `item.options.select`), the details provider (`select` / `unselect`, `detailsComponent` and its props) and the pagination (`loadNextPage` / `loadPrevPage`, `handlePageChange`). |
36
- | `isListImageKey` | function | Whether a column is an image field of the model. |
37
- | `getListTitleKey` | function | The first non-image column (the card title of the mobile and masonry presets). |
38
- | `LIST_PRESET_MODE_COMPONENTS` | const | Preline-styled list mode presets, keyed by `ListMode`. |
39
- | `useListDesktop` | hook | The desktop table logic: `useList` plus the table columns (`desktopKeys`: `selectMulti`, the keys, `removeAction`, `itemAction`), the multi selection reported through `provider.onChangeMultiSelected` and cleared by `provider.onCleanMultiSelected$`, and the `top` component factory. |
40
- | `useListMasonryGrid` | hook | The masonry-grid logic: `useList` plus `listWithImages`, every item paired with the value of the model's first image field. |
41
- | `LIST_DESKTOP_STICKY_HEADER_STYLE` | const | The inline style of the sticky header cells of `SmartListDesktop` (`position: sticky`, `top: 0`). |
42
-
43
- The preset's class helpers (`getListDesktopContainerClasses`, `getListDesktopTableClasses`, `getListDesktopHeaderRowClasses`, `getListDesktopHeaderCellClasses`, `getListDesktopRowClasses`, `getListDesktopCellClasses`) are exported too, for a custom implementation that wants the preset look.
26
+ | Export | Kind | What it is |
27
+ | ------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | `SmartList` | component | Resolves the list `fields` of `options.type` (the fields with `list` options, sorted by `list.order`) and renders the implementation of `options.mode` (desktop by default): the one registered in `listModeComponents` on `SmartProvider` (e.g. `LIST_PRESET_MODE_COMPONENTS`), else `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`. |
29
+ | `SmartListDesktop` | component | The desktop list: a table with one column per list field, plus the multi-select, details, remove and item columns, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`); with `options.sort` the field headers are sort buttons. |
30
+ | `SmartListDesktopPreset` | component | Preline-styled desktop list variation. |
31
+ | `SmartListMasonryGrid` | component | The masonry-grid list: a grid of tiles with the item's image (the model's first image field, lazy loaded) over its non-image cells, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`); with `options.details` every tile gets a details button. |
32
+ | `SmartListMasonryGridPreset` | component | Preline-styled masonry-grid list variation: keeps the masonry column layout and renders every item as a Preline card, the image on a rounded top, the first non-image column as the title and the others as text. |
33
+ | `SmartListMobile` | component | The mobile list: a stacked list with one paragraph per cell and the details / remove / item buttons, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
34
+ | `SmartListMobilePreset` | component | Preline-styled mobile list variation: a responsive grid of cards. |
35
+ | `useListFileUrl` | hook | The download URL of an image cell's attachment (`''` without a file service). |
36
+ | `useList` | hook | The behaviour every list mode shares: the column `keys` (permissions via `useAuthService()`, dynamic `__array` columns), the provider `list` and `loading`, the `sort` options, the remove flow (a confirm alert, then `remove.provider.invoke(id)`), item navigation (`useNavigation().navigate(routingPrefix + id)` or `item.options.select`), the details provider (`select` / `unselect`, `detailsComponent` and its props, `detailsHandler`), the sort (`sortBy`, `activeSort`) and the pagination (`loadNextPage` / `loadPrevPage`, `handlePageChange`, infinite scroll). |
37
+ | `SmartListDetailsModal` | component | What the details action opens through `ModalService`: the details component (`SmartDetailsPage` by default) with the list's current `IDetailsOptions` as `value`, read from a store the list keeps up to date. |
38
+ | `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator`, `isListSortableKey` | function | The sort helpers of `useList`: the start sort of a `sort` option, the sort after a header click, the `aria-sort` and the arrow of a header, whether a column sorts. |
39
+ | `isListImageKey` | function | Whether a column is an image field of the model. |
40
+ | `getListTitleKey` | function | The first non-image column (the card title of the mobile and masonry presets). |
41
+ | `LIST_PRESET_MODE_COMPONENTS` | const | Preline-styled list mode presets, keyed by `ListMode`. |
42
+ | `useListDesktop` | hook | The desktop table logic: `useList` plus the table columns (`desktopKeys`: `selectMulti`, the keys, `detailsAction`, `removeAction`, `itemAction`), the multi selection reported through `provider.onChangeMultiSelected` and cleared by `provider.onCleanMultiSelected$`, and the `top` component factory. |
43
+ | `useListMasonryGrid` | hook | The masonry-grid logic: `useList` plus `listWithImages`, every item paired with the value of the model's first image field. |
44
+ | `LIST_DESKTOP_STICKY_HEADER_STYLE` | const | The inline style of the sticky header cells of `SmartListDesktop` (`position: sticky`, `top: 0`). |
45
+
46
+ The preset's class helpers (`getListDesktopContainerClasses`, `getListDesktopTableClasses`, `getListDesktopHeaderRowClasses`, `getListDesktopHeaderCellClasses`, `getListDesktopSortButtonClasses`, `getListDesktopSortIndicatorClasses`, `getListDesktopRowClasses`, `getListDesktopCellClasses`) are exported too, for a custom implementation that wants the preset look.
44
47
 
45
48
  ## Props and Types
46
49
 
@@ -72,8 +75,8 @@ Props of a list mode implementation (`SmartListDesktop`, `SmartListMobile`, `Sma
72
75
  | `pagination?` | `IListPaginationOptions` | — | Paging state and loaders: with `PaginationMode.singlePage` the modes render the pager below the rows, with `PaginationMode.infiniteScroll` they load the next page when the end of the rows scrolls into view. |
73
76
  | `cellPipe?` | `ICellPipe<T>` | — | Formats cells: `transform(item, key, translate?)` returns text (sanitised) or `trustHtml(html)`. |
74
77
  | `componentFactories?` | `IListComponentFactories<T>` | — | `top`: a component rendered above the rows. |
75
- | `sort?` | `\| boolean \| { default?: string; defaultDesc?: boolean; }` | `{}` | Passed to the mode components (`useList().sort`); the library's modes render no sort controls. |
76
- | `details?` | `\| boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: ComponentType<any>; }` | — | Requires a `provider` (`IDetailsProvider`) when set; `useList` exposes `select` / `unselect`, `detailsComponent` and its props for a mode that shows details. The library's modes do not render them. |
78
+ | `sort?` | `\| boolean \| { default?: string; defaultDesc?: boolean; }` | — | Makes the field headers of the desktop modes sort buttons; `default` / `defaultDesc` is the sort they show at first (see [Sorting](#sorting)). |
79
+ | `details?` | `\| boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: ComponentType<any>; }` | — | Adds a details action (`show`) to every item that opens `component` (`SmartDetailsPage` by default) in a modal; requires a `provider` (`IDetailsProvider`). See [Details](#details). |
77
80
  | `item?` | `\| boolean \| { options?: ItemOptions; }` | — | Adds the item action: `{ options: { routingPrefix, edit } }` navigates to `routingPrefix + id`, `{ options: { select, edit } }` calls `select(id)`. Setting `item` without `options` throws. |
78
81
  | `remove?` | `\| boolean \| { provider?: IRemoveProvider<T>; }` | — | Adds the remove action: an alert (`OBJECT.confirmDelete`) then `provider.invoke(id)`; `provider.check(item)` hides it per row. |
79
82
  | `select?` | `'multi'` | — | `'multi'` adds a checkbox column (desktop); changes go to `provider.onChangeMultiSelected`. |
@@ -100,13 +103,13 @@ What mode components receive: `IListOptions` plus the resolved `fields`. Extends
100
103
 
101
104
  ### `IListProvider<T>`
102
105
 
103
- | Field | Type | Default | Description |
104
- | ------------------------ | -------------------------- | -------- | ----------------------------------------------------------------------------------------- |
105
- | `getData` | `(filter: any) => void` | required | Declared for the provider's owner (CRUD providers read with it); the list never calls it. |
106
- | `onChangeMultiSelected?` | `(list: Array<T>) => void` | — | Called with the selected records when `select: 'multi'`. |
107
- | `onCleanMultiSelected$?` | `SmartSubscribable<void>` | — | Clears the multi-selection whenever it emits. |
108
- | `list` | `T[]` | required | The records to show. |
109
- | `loading` | `boolean` | required | Shows the loader while `true`. |
106
+ | Field | Type | Default | Description |
107
+ | ------------------------ | -------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
108
+ | `getData` | `(filter: any) => void` | required | Reads the data again with `filter` merged in; a sortable header calls it with `{ offset: 0, sortBy, sortDesc }`. |
109
+ | `onChangeMultiSelected?` | `(list: Array<T>) => void` | — | Called with the selected records when `select: 'multi'`. |
110
+ | `onCleanMultiSelected$?` | `SmartSubscribable<void>` | — | Clears the multi-selection whenever it emits. |
111
+ | `list` | `T[]` | required | The records to show. |
112
+ | `loading` | `boolean` | required | Shows the loader while `true`. |
110
113
 
111
114
  ### `ICellPipe<T>`
112
115
 
@@ -169,6 +172,13 @@ Anything with a `subscribe(listener)` that returns an `unsubscribe()` handle, e.
169
172
  | `select` | `(id: string) => void` | required | Called with the id instead of navigating. |
170
173
  | `edit` | `boolean` | required | Whether the target opens for editing (passed along). |
171
174
 
175
+ ### `IListSortState` and `IListSortFilter`
176
+
177
+ | Type | Fields |
178
+ | ----------------- | -------------------------------------------------------------------------------------- |
179
+ | `IListSortState` | `key: string`, `desc: boolean`: the sort a list shows (`useList().activeSort`). |
180
+ | `IListSortFilter` | `offset: 0`, `sortBy: string`, `sortDesc: boolean`: what a header passes to `getData`. |
181
+
172
182
  ### Related types
173
183
 
174
184
  - `ListMode` (enum): `mobile = 'mobile', desktop = 'desktop', masonryGrid = 'masonryGrid'` — The list layouts.
@@ -241,6 +251,20 @@ export function NoteList({
241
251
 
242
252
  Memoise `options`: `SmartList` recomputes its internal options whenever the object changes.
243
253
 
254
+ ## Sorting
255
+
256
+ With `sort` set (`true`, or `{ default?, defaultDesc? }`), every field header of `SmartListDesktop` and `SmartListDesktopPreset` is a sort button with an arrow: `↕` on the headers that do not sort the list, `↑` / `↓` on the active one, which also carries `aria-sort` (`ascending` / `descending`). A click on another column sorts by it in ascending order, a click on the active column turns the direction around. The list does not sort the rows itself: it calls `provider.getData({ offset: 0, sortBy, sortDesc })` and the provider loads the rows in that order, from the first page. The CRUD list page (`@smartsoft001/crud-shell-react`) merges that filter into its `ICrudFilter` and passes the filter's sort back as `sort`. The expanded columns of a `dynamic` field do not sort; the mobile and masonry modes have no headers.
257
+
258
+ `sort.default` and `sort.defaultDesc` only set the header shown at first. The clicked sort stays while other options change and starts over from `sort.default` when `sort` is a new object, so keep `sort` stable (a constant or a memoised value).
259
+
260
+ ## Details
261
+
262
+ With `details: { provider }`, every item gets a details action, labelled with the `show` translation (`data-role="details"`): a column of the desktop table and a button in the mobile rows and the masonry tiles (standard and presets). `useList().detailsHandler(item)` clears the provider (`clearData()`), opens `SmartListDetailsModal` in a bottom sheet through `ModalService` (mode `'bottom'`, rendered by `SmartModalHost`, see `react-components-overlays`) around `details.component`, or `SmartDetailsPage` by default, and asks the provider for the item (`getData(id)`). The modal reads `detailsComponentProps` (`IDetailsOptions`: `item` and `loading` from the provider, `type`, the list's `itemHandler` / `removeHandler`, `details.componentFactories`) from a store the list updates, so it shows the item once the provider has loaded it. Without a `provider`, setting `details` throws `Must set details provider`.
263
+
264
+ ## Infinite scroll
265
+
266
+ With `pagination.mode` set to `PaginationMode.infiniteScroll` and `page < totalPages`, every mode renders an empty `<div data-role="infinite-scroll" aria-hidden="true">` after its items, watched by an `IntersectionObserver`. When it scrolls into view the list calls `pagination.loadNextPage()` (never twice at the same time), and it watches it again after every page. On the last page the element is gone; without `IntersectionObserver` (server rendering) nothing loads. `pagination.limit` is not read by the list.
267
+
244
268
  ## Replacing the Implementation
245
269
 
246
270
  - **Per mode**: `listModeComponents` on `SmartProvider` maps a `ListMode` to a component taking `SmartListModeProps` (merged over `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`). `LIST_PRESET_MODE_COMPONENTS` registers the Preline-styled `SmartListDesktopPreset`, `SmartListMobilePreset` and `SmartListMasonryGridPreset`.
@@ -298,8 +322,9 @@ function useList<T extends IEntity<string>>({ options }: SmartListModeProps<T>);
298
322
  | `removeHandler` | `((item: T) => void) \| null` | Confirms and removes a record (`null` without `remove`). |
299
323
  | `checkRemoveHandler` | `((item: T) => boolean) \| undefined` | `remove.provider.check`. |
300
324
  | `itemHandler` | `((id: string) => void) \| null` | Navigates to / selects an id (`null` without `item`). |
301
- | `detailsComponent` | `ComponentType<any> \| null` | `details.component`, `null` without it. |
302
- | `detailsComponentProps` | `IDetailsOptions<T> \| null` | The `IDetailsOptions` for `detailsComponent`. |
325
+ | `detailsComponent` | `ComponentType<any> \| null` | `details.component`, `null` without it (the details action then opens `SmartDetailsPage`). |
326
+ | `detailsComponentProps` | `IDetailsOptions<T> \| null` | The `IDetailsOptions` the details component gets as `value`, `null` without `details`. |
327
+ | `detailsHandler` | `((item: T) => void) \| null` | Opens the details of an item in a modal (`null` without `details`). |
303
328
  | `select` | `((id: string) => void) \| undefined` | `details.provider.getData`. |
304
329
  | `unselect` | `(() => void) \| undefined` | `details.provider.clearData`. |
305
330
  | `detailsButtonOptions` | `IButtonOptions` | `IButtonOptions` that close the details (`unselect`). |
@@ -310,6 +335,12 @@ function useList<T extends IEntity<string>>({ options }: SmartListModeProps<T>);
310
335
  | `handlePageChange` | `(nextPage: number) => void` | Moves to a page through the loaders (for `SmartPaging`'s `onPageChange`). |
311
336
  | `infiniteScroll` | `boolean` | `true` with `PaginationMode.infiniteScroll` and a next page. |
312
337
  | `infiniteScrollRef` | `RefObject<HTMLDivElement \| null>` | Attach to an element after the rows; the next page loads when it scrolls into view. |
338
+ | `sortable` | `boolean` | `true` with `options.sort`. |
339
+ | `activeSort` | `IListSortState \| null` | The sort the headers show. |
340
+ | `isSortable` | `(key: string) => boolean` | Whether the header of a column sorts. |
341
+ | `sortBy` | `(key: string) => void` | Sorts by a column through `provider.getData({ offset: 0, sortBy, sortDesc })`. |
342
+ | `getAriaSort` | `(key: string) => 'ascending' \| 'descending' \| null` | The `aria-sort` of a header (only the active one has it). |
343
+ | `getSortIndicator` | `(key: string) => string` | The arrow of a header: `↑`, `↓`, or `↕` when it is not active. |
313
344
 
314
345
  ```tsx
315
346
  import type { IEntity } from '@smartsoft001/domain-core';
@@ -374,6 +405,8 @@ Source: `packages/shared/react/src/lib/components/list/` in the smartsoft001 rep
374
405
  - `desktop/list-desktop.tsx`: `SmartListDesktop`
375
406
  - `desktop/preset/list-desktop-preset.tsx`: `SmartListDesktopPreset`
376
407
  - `desktop/use-list-desktop.ts`: `useListDesktop`, `LIST_DESKTOP_STICKY_HEADER_STYLE`
408
+ - `list-details-modal.tsx`: `SmartListDetailsModal`
409
+ - `list-sort.ts`: `IListSortState`, `IListSortFilter`, `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator`, `isListSortableKey`
377
410
  - `list-title-key.ts`: `isListImageKey`, `getListTitleKey`
378
411
  - `list.tsx`: `SmartList`
379
412
  - `list.types.ts`: `SmartListProps`, `SmartListModeProps`
@@ -6,7 +6,7 @@ user-invocable: false
6
6
 
7
7
  # Modal (`SmartModal`)
8
8
 
9
- `SmartModal` is a dialog with a title, a description, a body (`children`) and footer buttons (`actions`). A footer button reports `onActionClick({ actionId })` and **keeps the modal open**: close it yourself (set `open` to `false`). The open state is controlled (`open` + `onOpenChange`) or kept inside (`defaultOpen`); closing through the dismiss button, the backdrop or Escape calls `onClosed`. `SmartModalStandard` is a native `<dialog>` shown through its `open` attribute; `SmartModalPreset` is a styled overlay with four variants. The modal host of `SmartProvider` renders `useModalService().show(...)` requests through the same `modal` key.
9
+ `SmartModal` is a dialog with a title, a description, a body (`children`) and footer buttons (`actions`). A footer button reports `onActionClick({ actionId })` and **keeps the modal open**: close it yourself (set `open` to `false`). The open state is controlled (`open` + `onOpenChange`) or kept inside (`defaultOpen`); closing through the dismiss button, the backdrop or Escape calls `onClosed`. `SmartModalStandard` is a native `<dialog>` shown through its `open` attribute; `SmartModalPreset` is a styled overlay with five variants, one of them a bottom sheet (`bottom-sheet`), which the standard docks to the bottom of the viewport as well. The modal host of `SmartProvider` renders `useModalService().show(...)` requests through the same `modal` key.
10
10
 
11
11
  ## When to Use This Skill
12
12
 
@@ -50,12 +50,24 @@ The preset's class helpers (`getModalWrapperClasses`, `getModalPanelClasses`, `g
50
50
 
51
51
  ### `IModalOptions`
52
52
 
53
- | Field | Type | Default | Description |
54
- | -------------- | ----------------------- | ------------ | --------------------------------------------------------------------- |
55
- | `variant?` | `SmartModalVariant` | `'centered'` | Preset layout: `centered`, `wide`, `alert` or `left-aligned-buttons`. |
56
- | `withDismiss?` | `boolean` | — | Shows a close (×) button that closes the modal. |
57
- | `footerStyle?` | `SmartModalFooterStyle` | `'default'` | Preset: `gray` gives the footer a gray background. |
58
- | `ariaLabel?` | `string` | — | Accessible name when there is no title. |
53
+ | Field | Type | Default | Description |
54
+ | -------------- | ----------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
55
+ | `variant?` | `SmartModalVariant` | `'centered'` | The layout, one of the variants in the Variants table; the standard exposes it as `data-variant` and positions only `bottom-sheet`. |
56
+ | `withDismiss?` | `boolean` | — | Shows a close (×) button that closes the modal. |
57
+ | `footerStyle?` | `SmartModalFooterStyle` | `'default'` | Preset: `gray` gives the footer a gray background. |
58
+ | `ariaLabel?` | `string` | — | Accessible name when there is no title. |
59
+
60
+ ### Variants
61
+
62
+ The values of `SmartModalVariant`, the layouts of `options.variant`.
63
+
64
+ | Variant | `SmartModalPreset` | `SmartModalStandard` |
65
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | `centered` (default) | A card centred vertically, `max-w-lg` from `sm`. | The browser's dialog layout. |
67
+ | `wide` | A top-aligned card, `max-w-4xl` from `lg`. | The browser's dialog layout. |
68
+ | `alert` | A narrower centred card, `max-w-md` from `sm`. | The browser's dialog layout. |
69
+ | `left-aligned-buttons` | Like `centered`, with the footer buttons aligned to the left. | The browser's dialog layout. |
70
+ | `bottom-sheet` | A sheet docked to the bottom of the viewport: full width, centred under `max-w-2xl` with rounded top corners from `sm`, at most 85% of the viewport high with the body scrolling, padded by the bottom safe area. Same backdrop, Escape and close button as the others. | The `<dialog>` fixed to the bottom of the viewport (`z-[80]`), full width, `max-w-2xl` with rounded top corners from `sm`, at most 85% of the viewport high and scrolling. |
59
71
 
60
72
  ### `IModalActionClick`
61
73
 
@@ -76,12 +88,12 @@ Payload of `onActionClick`.
76
88
  ### Related types
77
89
 
78
90
  - `SmartModalActionVariant`: `'primary' \| 'secondary' \| 'danger'`
79
- - `SmartModalVariant`: `'centered' \| 'wide' \| 'alert' \| 'left-aligned-buttons'`
91
+ - `SmartModalVariant`: `'centered' \| 'wide' \| 'alert' \| 'left-aligned-buttons' \| 'bottom-sheet'`
80
92
  - `SmartModalFooterStyle`: `'default' \| 'gray'`
81
93
 
82
94
  ## Opening a component in a modal from code
83
95
 
84
- `useModalService().show({ component, props })` opens `component` inside a `SmartModal` rendered by the modal host of `SmartProvider` (see `react-components-overlays`). The component receives its `props` and a `dismiss(data)` prop; `onDidDismiss()` resolves with `{ data }`. `useModalService().dismiss(data)` closes the modal opened last.
96
+ `useModalService().show({ component, props })` opens `component` inside a `SmartModal` with its close button, rendered by the modal host of `SmartProvider` (see `react-components-overlays`, which also describes `mode`, `cssClass` and `backdropDismiss`). `mode: 'bottom'` opens it as a bottom sheet (the `bottom-sheet` variant); `SmartList` opens its details that way. The component receives its `props` and a `dismiss(data)` prop; `onDidDismiss()` resolves with `{ data }`, `{ data: null }` when the modal closed itself. `useModalService().dismiss(data)` closes the modal opened last.
85
97
 
86
98
  ```tsx
87
99
  import { SmartButton, useModalService } from '@smartsoft001/react';
@@ -247,12 +259,12 @@ export function CustomModal(props: SmartModalProps) {
247
259
  }
248
260
  ```
249
261
 
250
- Registered as `components={{ modal: CustomModal }}`, it renders both the `SmartModal`s placed by hand and the modals of `ModalService.show` (which pass `open`, `className` from `cssClass`, `onClosed` and the component as `children`).
262
+ Registered as `components={{ modal: CustomModal }}`, it renders both the `SmartModal`s placed by hand and the modals of `ModalService.show` (which pass `open`, `className` from `cssClass`, `options` with `withDismiss: true` and, for `mode: 'bottom'`, `variant: 'bottom-sheet'`, `onClosed` and the component as `children`). Lay out the `bottom-sheet` variant as a bottom sheet so those modals keep their look.
251
263
 
252
264
  ## Styling
253
265
 
254
- - `SmartModalStandard` is always in the DOM as a `<dialog>` and shown through its `open` attribute; its native `close` event closes the modal too. Action buttons carry `data-variant`.
255
- - `SmartModalPreset` renders inline with a `fixed` backdrop over the viewport; a click on the backdrop itself or Escape closes it. It carries `smart:dark:` variants.
266
+ - `SmartModalStandard` is always in the DOM as a `<dialog>` and shown through its `open` attribute; its native `close` event closes the modal too. The dialog carries `options.variant` as `data-variant`, action buttons their own `data-variant`. Only the `bottom-sheet` variant is positioned (fixed to the bottom of the viewport, full width up to `max-w-2xl`, at most 85% of the viewport high and scrolling); `className` comes after its classes.
267
+ - `SmartModalPreset` renders inline with a `fixed` backdrop over the viewport; a click on the backdrop itself or Escape closes it; with preset modals stacked, Escape closes only the one on top. The `bottom-sheet` variant docks the panel to the bottom of the viewport, with a max height and a scrolling body. It carries `smart:dark:` variants.
256
268
 
257
269
  ## File Locations
258
270
 
@@ -74,7 +74,7 @@ Payload of `onActionClick`.
74
74
 
75
75
  ## Toasts from code
76
76
 
77
- `ToastService` keeps a queue of toasts that the toast host of `SmartProvider` (`SmartToastHost`, part of `SmartOverlays`) renders at the bottom of the screen through `SmartNotification`. A toast closes itself after `duration` ms (2000 by default) or on its close button.
77
+ `ToastService` keeps a queue of toasts that the toast host of `SmartProvider` (`SmartToastHost`, part of `SmartOverlays`) renders at the bottom of the screen through `SmartNotification`. A toast closes itself after `duration` ms (2000 by default), on its close button, or once the handler of one of its buttons ran. Errors are announced assertively, infos politely.
78
78
 
79
79
  ```tsx
80
80
  import { SmartButton, useToastService } from '@smartsoft001/react';