@smartsoft001/claude-plugins 2.201.0 → 2.202.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/smart-angular/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-angular/skills/angular-components-accordion/SKILL.md +84 -80
- package/plugins/smart-angular/skills/angular-components-action-panel/SKILL.md +35 -60
- package/plugins/smart-angular/skills/angular-components-alert/SKILL.md +24 -29
- package/plugins/smart-angular/skills/angular-components-avatar/SKILL.md +30 -30
- package/plugins/smart-angular/skills/angular-components-badge/SKILL.md +18 -12
- package/plugins/smart-angular/skills/angular-components-breadcrumbs/SKILL.md +27 -10
- package/plugins/smart-angular/skills/angular-components-button/SKILL.md +43 -17
- package/plugins/smart-angular/skills/angular-components-button-group/SKILL.md +26 -14
- package/plugins/smart-angular/skills/angular-components-calendar/SKILL.md +47 -28
- package/plugins/smart-angular/skills/angular-components-card/SKILL.md +29 -22
- package/plugins/smart-angular/skills/angular-components-card-heading/SKILL.md +24 -18
- package/plugins/smart-angular/skills/angular-components-command-palette/SKILL.md +41 -32
- package/plugins/smart-angular/skills/angular-components-container/SKILL.md +21 -20
- package/plugins/smart-angular/skills/angular-components-date-edit/SKILL.md +48 -45
- package/plugins/smart-angular/skills/angular-components-date-range/SKILL.md +72 -82
- package/plugins/smart-angular/skills/angular-components-description-list/SKILL.md +23 -10
- package/plugins/smart-angular/skills/angular-components-detail/SKILL.md +20 -8
- package/plugins/smart-angular/skills/angular-components-details/SKILL.md +35 -12
- package/plugins/smart-angular/skills/angular-components-divider/SKILL.md +36 -18
- package/plugins/smart-angular/skills/angular-components-drawer/SKILL.md +28 -23
- package/plugins/smart-angular/skills/angular-components-dropdown/SKILL.md +35 -16
- package/plugins/smart-angular/skills/angular-components-empty-state/SKILL.md +49 -11
- package/plugins/smart-angular/skills/angular-components-feed/SKILL.md +45 -12
- package/plugins/smart-angular/skills/angular-components-form/SKILL.md +53 -25
- package/plugins/smart-angular/skills/angular-components-grid-list/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-icon/SKILL.md +8 -8
- package/plugins/smart-angular/skills/angular-components-info/SKILL.md +19 -15
- package/plugins/smart-angular/skills/angular-components-input/SKILL.md +78 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +85 -78
- package/plugins/smart-angular/skills/angular-components-list-container/SKILL.md +24 -32
- package/plugins/smart-angular/skills/angular-components-media-object/SKILL.md +19 -17
- package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +23 -16
- package/plugins/smart-angular/skills/angular-components-multi-column-layout/SKILL.md +19 -16
- package/plugins/smart-angular/skills/angular-components-navbar/SKILL.md +38 -21
- package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +32 -33
- package/plugins/smart-angular/skills/angular-components-page/SKILL.md +46 -52
- package/plugins/smart-angular/skills/angular-components-page-heading/SKILL.md +42 -25
- package/plugins/smart-angular/skills/angular-components-paging/SKILL.md +17 -15
- package/plugins/smart-angular/skills/angular-components-password-strength/SKILL.md +21 -19
- package/plugins/smart-angular/skills/angular-components-progress-bars/SKILL.md +61 -24
- package/plugins/smart-angular/skills/angular-components-searchbar/SKILL.md +30 -37
- package/plugins/smart-angular/skills/angular-components-section-heading/SKILL.md +38 -27
- package/plugins/smart-angular/skills/angular-components-select-menu/SKILL.md +33 -17
- package/plugins/smart-angular/skills/angular-components-sidebar-layout/SKILL.md +30 -26
- package/plugins/smart-angular/skills/angular-components-sidebar-navigation/SKILL.md +79 -16
- package/plugins/smart-angular/skills/angular-components-sign-in-form/SKILL.md +64 -24
- package/plugins/smart-angular/skills/angular-components-stacked-layout/SKILL.md +24 -23
- package/plugins/smart-angular/skills/angular-components-stacked-list/SKILL.md +40 -21
- package/plugins/smart-angular/skills/angular-components-stats/SKILL.md +28 -15
- package/plugins/smart-angular/skills/angular-components-table/SKILL.md +42 -22
- package/plugins/smart-angular/skills/angular-components-tabs/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-textarea/SKILL.md +48 -46
- package/plugins/smart-angular/skills/angular-components-toggle/SKILL.md +21 -28
- package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +66 -24
- package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +11 -11
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +7 -7
- package/plugins/smart-react/skills/react-components-button/SKILL.md +20 -20
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-card/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +25 -16
- package/plugins/smart-react/skills/react-components-details/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-info/SKILL.md +3 -1
- package/plugins/smart-react/skills/react-components-input/SKILL.md +41 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +34 -31
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +28 -28
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +29 -29
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-table/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +3 -2
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +7 -7
|
@@ -33,6 +33,28 @@ All from `@smartsoft001/react`.
|
|
|
33
33
|
| `getInputErrorMessages` | function | The messages a field shows for its validation errors, in a fixed order. |
|
|
34
34
|
| `resolveInputFieldOptions` | function | The options of the field an input renders, merged with the options of the form's mode: a `<key>Confirm` control takes the options of `<key>`, and an array model is read through its first item. |
|
|
35
35
|
| `INPUT_PRESET_FIELD_COMPONENTS` | const | The Preline-styled field presets, by `FieldType`. |
|
|
36
|
+
| `LONG_TEXT_TOOLBAR` | const | The full menu of `SmartRichTextEditor` (its default `toolbar`), typed `SmartRichTextToolbar`. |
|
|
37
|
+
|
|
38
|
+
Every field component of the table under "Field types" is exported too (`SmartInputText`, `SmartInputTextPreset`, ...), with the hooks their standard and preset variants share. Use them in a custom field component of the same type.
|
|
39
|
+
|
|
40
|
+
| Hook / function | What it is |
|
|
41
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| `useInputAddressPart` | Binds the input of one part of an `address` group to its control (value, dirty on change, touched on blur, disabled with the part) and gives an `id` for its label. |
|
|
43
|
+
| `useInputArray` | The `array` field: the item forms, `add()`, `remove(index)`, `move(from, to)`, `getItemDragProps(index)` and `isStatic` (`possibilities.static`). |
|
|
44
|
+
| `useInputCheck` | The `check` field: the possibilities (provider, input options, else the model field's), kept checked in line with the value, and `toggle(item)`. |
|
|
45
|
+
| `syncInputCheckPossibilities` | The possibilities with `checked` set from a value (what `useInputCheck` uses). |
|
|
46
|
+
| `useInputColor` | The `color` field: the shown colour, picking and clearing (`null`). |
|
|
47
|
+
| `useInputImage` | `useInput` and `useInputFile` plus the preview URL of the `image` field and the `logo` preset. |
|
|
48
|
+
| `useInputInts` | The `ints` field: one row per number plus a trailing row to add one. |
|
|
49
|
+
| `useInputNip` | `useInput` plus the `invalidNip` validator added to the control. |
|
|
50
|
+
| `useInputObject` | The `object` field: the options of the nested form, one tree level deeper. |
|
|
51
|
+
| `useInputPassword` | The `password` field: the strength rating and the `passwordStrength` validator it drives. |
|
|
52
|
+
| `useInputPhoneNumberPl` | `useInput` plus the `minLength(9)` / `maxLength(9)` validators. |
|
|
53
|
+
| `useInputRadio` | The `radio` field: the possibilities (provider, input options, else the model field's object map). |
|
|
54
|
+
| `getModelFieldPossibilitiesList` | The model field's `possibilities` object map as a list (the fallback of the radio and enum preset fields). |
|
|
55
|
+
| `useInputVideo` | `useInput` and `useInputFile` plus the player of the `video` fields. |
|
|
56
|
+
| `useInputFileDropZone` | The drop zone of the `pdf`, `video` and `attachment` presets (click / Enter / Space opens the picker, a drop uploads like a picked file); options `UseInputFileDropZoneOptions`. |
|
|
57
|
+
| `toNumberValue` | The value of a number `<input>`: empty is `null`, else `parseFloat`. |
|
|
36
58
|
|
|
37
59
|
The preset's class helpers (`getInputEmailPresetClasses`, `getInputEmailPresetLabelClasses`, `getInputNipPresetClasses`, `getInputNipPresetLabelClasses`, `getInputPhoneNumberPlPresetClasses`, `getInputPhoneNumberPlPresetLabelClasses`, `getInputPhoneNumberPlPresetWrapperClasses`, `getInputPhoneNumberPlPresetPrefixClasses`, `getInputPhoneNumberPresetClasses`, `getInputPhoneNumberPresetLabelClasses`, `getInputTextPresetClasses`, `getInputTextPresetLabelClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
38
60
|
|
|
@@ -67,24 +89,26 @@ The props every field component receives from `<SmartInput>`: the input options
|
|
|
67
89
|
|
|
68
90
|
Props of the rich-text editor of `longText` fields.
|
|
69
91
|
|
|
70
|
-
| Prop | Type | Default
|
|
71
|
-
| -------------- | ------------------------ |
|
|
72
|
-
| `value?` | `string \| null` | —
|
|
73
|
-
| `placeholder?` | `string` | —
|
|
74
|
-
| `disabled?` | `boolean` | `false`
|
|
75
|
-
| `toolbar?` | `SmartRichTextToolbar` |
|
|
76
|
-
| `labelledBy?` | `string` | —
|
|
77
|
-
| `onChange?` | `(html: string) => void` | —
|
|
78
|
-
| `onBlur?` | `() => void` | —
|
|
92
|
+
| Prop | Type | Default | Description |
|
|
93
|
+
| -------------- | ------------------------ | ------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `value?` | `string \| null` | — | The HTML to edit; rendered sanitised when it does not come from here. |
|
|
95
|
+
| `placeholder?` | `string` | — | Placeholder of the empty editor. |
|
|
96
|
+
| `disabled?` | `boolean` | `false` | Makes the editor read-only. |
|
|
97
|
+
| `toolbar?` | `SmartRichTextToolbar` | `LONG_TEXT_TOOLBAR` | The menu groups; the full menu (formatting, lists, headings, link, image, colours, alignment) by default. |
|
|
98
|
+
| `labelledBy?` | `string` | — | The id of the element labelling the editor. |
|
|
99
|
+
| `onChange?` | `(html: string) => void` | — | Called with the HTML of the content after every change. |
|
|
100
|
+
| `onBlur?` | `() => void` | — | Called when the editor loses the focus. |
|
|
101
|
+
|
|
102
|
+
`SmartRichTextToolbar` is `SmartRichTextToolbarItem[][]`, one array per group of the menu. An item is a `SmartRichTextToggle` (`'bold'`, `'italic'`, `'underline'`, `'strike'`, `'code'`, `'blockquote'`, `'ordered_list'`, `'bullet_list'`, `'align_left'`, `'align_center'`, `'align_right'`, `'align_justify'`), a `SmartRichTextColorKind` (`'text_color'`, `'background_color'`), `'link'`, `'image'` or `{ heading: SmartRichTextHeading[] }` (`'h1'` to `'h6'`). All these types are exported.
|
|
79
103
|
|
|
80
104
|
### `IInputOptions`
|
|
81
105
|
|
|
82
|
-
| Field | Type | Default
|
|
83
|
-
| ---------------- | ------------------------- |
|
|
84
|
-
| `treeLevel` | `number` | required
|
|
85
|
-
| `control` | `SmartAbstractControl` | required
|
|
86
|
-
| `possibilities?` | `SmartPossibility[]` | —
|
|
87
|
-
| `component?` | `InputComponentType<any>` |
|
|
106
|
+
| Field | Type | Default | Description |
|
|
107
|
+
| ---------------- | ------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| `treeLevel` | `number` | required | Nesting depth (0 at the top; nested object / array forms go one deeper). |
|
|
109
|
+
| `control` | `SmartAbstractControl` | required | The control of the field (`form.controls[fieldKey]`). |
|
|
110
|
+
| `possibilities?` | `SmartPossibility[]` | — | The options of a `radio`, `check` or preset `enum` field: the model possibilities provider's win over them, they win over the field's own `possibilities`. The standard `enum` (the enum's keys) and the other types do not read them. |
|
|
111
|
+
| `component?` | `InputComponentType<any>` | the component of the field's type | A field component used instead of the type's one. |
|
|
88
112
|
|
|
89
113
|
### `IInputFromFieldOptions<T>`
|
|
90
114
|
|
|
@@ -121,7 +145,7 @@ Props of the rich-text editor of `longText` fields.
|
|
|
121
145
|
| `dateWithEdit` | `SmartInputDateWithEdit` | `SmartInputDateWithEditPreset` | `SmartDateEdit` (digit inputs) bound to the control. |
|
|
122
146
|
| `dateRange` | `SmartInputDateRange` | `SmartInputDateRangePreset` | `IDateRange` value; the standard uses `SmartDateRange`, the preset two native date inputs. |
|
|
123
147
|
| `nip` | `SmartInputNip` | `SmartInputNipPreset` | Adds the NIP check (`invalidNip`) to the control. |
|
|
124
|
-
| `pesel` | `SmartInputPesel` | `SmartInputPeselPreset` | **
|
|
148
|
+
| `pesel` | `SmartInputPesel` | `SmartInputPeselPreset` | The form factory adds the `pesel` check; **differs**: the preset adds its own `invalidPesel` check to the control too (same message). |
|
|
125
149
|
| `phoneNumber` | `SmartInputPhoneNumber` | `SmartInputPhoneNumberPreset` | `type="tel"`; the form factory adds the `phoneNumber` check. |
|
|
126
150
|
| `phoneNumberPl` | `SmartInputPhoneNumberPl` | `SmartInputPhoneNumberPlPreset` | Exactly 9 characters (`minlength` / `maxlength`); the preset shows a `+48` addon. |
|
|
127
151
|
| `color` | `SmartInputColor` | `SmartInputColorPreset` | Native colour picker with a clear button. |
|
|
@@ -141,7 +165,7 @@ Uploading fields need a file service: give `SmartProvider` a `fileServiceConfig`
|
|
|
141
165
|
|
|
142
166
|
- The label is the label provider's (`modelLabelProvider` on `SmartProvider`) or the translation of `MODEL.<key>` (see `react-provider`).
|
|
143
167
|
- A field with `info: '...'` shows a `SmartInfo` tooltip; a field with `hide: true` (for the mode) renders nothing.
|
|
144
|
-
- Messages are shown once the control is touched, from its errors, in a fixed order: `required` (which hides `confirm`), `confirm`, `invalidNip`, `invalidUnique`, `email`, `phoneNumber`, `pesel
|
|
168
|
+
- Messages are shown once the control is touched, from its errors, in a fixed order: `required` (which hides `confirm`), `confirm`, `invalidNip`, `invalidUnique`, `email`, `phoneNumber`, `pesel` or `invalidPesel` (one message), `minlength`, `maxlength`, `min`, `max`, and `customMessage` (its value is shown as is). The texts come from `INPUT.ERRORS.*` translations. `getInputErrorMessages(errors, t)` returns that list for a custom message component.
|
|
145
169
|
|
|
146
170
|
## Choosing the component of a field
|
|
147
171
|
|
|
@@ -22,20 +22,23 @@ For data that is not a model (plain rows), use `SmartTable` or `SmartStackedList
|
|
|
22
22
|
|
|
23
23
|
All from `@smartsoft001/react`.
|
|
24
24
|
|
|
25
|
-
| Export
|
|
26
|
-
|
|
|
27
|
-
| `SmartList`
|
|
28
|
-
| `SmartListDesktop`
|
|
29
|
-
| `SmartListDesktopPreset`
|
|
30
|
-
| `SmartListMasonryGrid`
|
|
31
|
-
| `SmartListMasonryGridPreset`
|
|
32
|
-
| `SmartListMobile`
|
|
33
|
-
| `SmartListMobilePreset`
|
|
34
|
-
| `useListFileUrl`
|
|
35
|
-
| `useList`
|
|
36
|
-
| `isListImageKey`
|
|
37
|
-
| `getListTitleKey`
|
|
38
|
-
| `LIST_PRESET_MODE_COMPONENTS`
|
|
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`). |
|
|
39
42
|
|
|
40
43
|
The preset's class helpers (`getListDesktopContainerClasses`, `getListDesktopTableClasses`, `getListDesktopHeaderRowClasses`, `getListDesktopHeaderCellClasses`, `getListDesktopRowClasses`, `getListDesktopCellClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
41
44
|
|
|
@@ -61,20 +64,20 @@ Props of a list mode implementation (`SmartListDesktop`, `SmartListMobile`, `Sma
|
|
|
61
64
|
|
|
62
65
|
### `IListOptions<T>`
|
|
63
66
|
|
|
64
|
-
| Field | Type | Default | Description
|
|
65
|
-
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
66
|
-
| `provider` | `IListProvider<T>` | required | Where the rows come from (`list`, `loading`), and the multi-selection callbacks.
|
|
67
|
-
| `type` | `any` | required | The `@Model` class whose `list` fields are the columns.
|
|
68
|
-
| `mode?` | `ListMode` | — | `ListMode.desktop` (default), `ListMode.mobile` or `ListMode.masonryGrid`.
|
|
69
|
-
| `pagination?` | `IListPaginationOptions` | — | Paging state and loaders
|
|
70
|
-
| `cellPipe?` | `ICellPipe<T>` | — | Formats cells: `transform(item, key, translate?)` returns text (sanitised) or `trustHtml(html)`.
|
|
71
|
-
| `componentFactories?` | `IListComponentFactories<T>` | — | `top`: a component rendered above the rows.
|
|
72
|
-
| `sort?` | `\| boolean \| { default?: string; defaultDesc?: boolean; }` | `{}` | Passed to the mode components (`useList().sort`); the library's modes render no sort controls.
|
|
73
|
-
| `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.
|
|
74
|
-
| `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.
|
|
75
|
-
| `remove?` | `\| boolean \| { provider?: IRemoveProvider<T>; }` | — | Adds the remove action: an alert (`OBJECT.confirmDelete`) then `provider.invoke(id)`; `provider.check(item)` hides it per row.
|
|
76
|
-
| `select?` | `'multi'` | — | `'multi'` adds a checkbox column (desktop); changes go to `provider.onChangeMultiSelected`.
|
|
77
|
-
| `presentation?` | `{ variant?: 'default' \| 'striped' \| 'bordered' \| 'borderless'; hoverable?: boolean; header?: 'default' \| 'muted' \| 'none'; }` | `{}` | Desktop preset look: `variant` (`default`, `striped`, `bordered`, `borderless`), `hoverable`, `header` (`default`, `muted`, `none`).
|
|
67
|
+
| Field | Type | Default | Description |
|
|
68
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| `provider` | `IListProvider<T>` | required | Where the rows come from (`list`, `loading`), and the multi-selection callbacks. |
|
|
70
|
+
| `type` | `any` | required | The `@Model` class whose `list` fields are the columns. |
|
|
71
|
+
| `mode?` | `ListMode` | — | `ListMode.desktop` (default), `ListMode.mobile` or `ListMode.masonryGrid`. |
|
|
72
|
+
| `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
|
+
| `cellPipe?` | `ICellPipe<T>` | — | Formats cells: `transform(item, key, translate?)` returns text (sanitised) or `trustHtml(html)`. |
|
|
74
|
+
| `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. |
|
|
77
|
+
| `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
|
+
| `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
|
+
| `select?` | `'multi'` | — | `'multi'` adds a checkbox column (desktop); changes go to `provider.onChangeMultiSelected`. |
|
|
80
|
+
| `presentation?` | `{ variant?: 'default' \| 'striped' \| 'bordered' \| 'borderless'; hoverable?: boolean; header?: 'default' \| 'muted' \| 'none'; }` | `{}` | Desktop preset look: `variant` (`default`, `striped`, `bordered`, `borderless`), `hoverable`, `header` (`default`, `muted`, `none`). |
|
|
78
81
|
|
|
79
82
|
### `IListInternalOptions<T>`
|
|
80
83
|
|
|
@@ -89,7 +92,7 @@ What mode components receive: `IListOptions` plus the resolved `fields`. Extends
|
|
|
89
92
|
| Field | Type | Default | Description |
|
|
90
93
|
| -------------- | ------------------------ | -------- | ----------------------------------------------------------------------- |
|
|
91
94
|
| `mode?` | `PaginationMode` | — | `PaginationMode.singlePage` (pager) or `PaginationMode.infiniteScroll`. |
|
|
92
|
-
| `limit` | `number` | required | Page size.
|
|
95
|
+
| `limit` | `number` | required | Page size, for the provider's owner; the list does not read it. |
|
|
93
96
|
| `loadNextPage` | `() => Promise<boolean>` | required | Loads the next page; resolves whether there is a further one. |
|
|
94
97
|
| `loadPrevPage` | `() => Promise<boolean>` | required | Loads the previous page; resolves whether there is a further one. |
|
|
95
98
|
| `page` | `number` | required | Current page. |
|
|
@@ -312,7 +315,7 @@ function useList<T extends IEntity<string>>({ options }: SmartListModeProps<T>);
|
|
|
312
315
|
import type { IEntity } from '@smartsoft001/domain-core';
|
|
313
316
|
import { SmartListModeProps, SmartPaging, useList } from '@smartsoft001/react';
|
|
314
317
|
|
|
315
|
-
export function
|
|
318
|
+
export function CustomList<T extends IEntity<string>>(
|
|
316
319
|
props: SmartListModeProps<T>,
|
|
317
320
|
) {
|
|
318
321
|
const {
|
|
@@ -358,7 +361,7 @@ export function CardList<T extends IEntity<string>>(
|
|
|
358
361
|
}
|
|
359
362
|
```
|
|
360
363
|
|
|
361
|
-
Register it for one mode with `listModeComponents={{ [ListMode.
|
|
364
|
+
Register it for one mode with `listModeComponents={{ [ListMode.desktop]: CustomList }}`, or for every mode with `components={{ list: CustomList }}`.
|
|
362
365
|
|
|
363
366
|
## Styling
|
|
364
367
|
|
|
@@ -37,10 +37,10 @@ All from `@smartsoft001/react`.
|
|
|
37
37
|
|
|
38
38
|
### `IListContainerOptions`
|
|
39
39
|
|
|
40
|
-
| Field | Type | Default | Description
|
|
41
|
-
| -------------------- | --------------------------- | ------- |
|
|
42
|
-
| `variant?` | `SmartListContainerVariant` | — | Exposed as `data-variant
|
|
43
|
-
| `fullWidthOnMobile?` | `boolean` | — |
|
|
40
|
+
| Field | Type | Default | Description |
|
|
41
|
+
| -------------------- | --------------------------- | ------- | -------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| `variant?` | `SmartListContainerVariant` | — | Exposed as `data-variant`, a hook for your CSS or a custom implementation; the standard adds no styles for it. |
|
|
43
|
+
| `fullWidthOnMobile?` | `boolean` | — | Not read by the built-in implementation; available to a custom implementation (edge-to-edge on small screens). |
|
|
44
44
|
|
|
45
45
|
### Related types
|
|
46
46
|
|
|
@@ -65,12 +65,12 @@ export function Team() {
|
|
|
65
65
|
|
|
66
66
|
`SmartListContainer` renders the component registered under the `'list-container'` key of `SmartProvider`'s `components`, and `SmartListContainerStandard` when nothing is registered there. Every `SmartListContainer` below the provider then renders the registered component, which receives the same props.
|
|
67
67
|
|
|
68
|
-
There is no preset for this component: register a component of your own that takes `SmartListContainerProps`, as shown below, as `components={{ 'list-container':
|
|
68
|
+
There is no preset for this component: register a component of your own that takes `SmartListContainerProps`, as shown below, as `components={{ 'list-container': CustomListContainer }}`. Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
69
69
|
|
|
70
70
|
```tsx
|
|
71
71
|
import { SmartListContainerProps } from '@smartsoft001/react';
|
|
72
72
|
|
|
73
|
-
export function
|
|
73
|
+
export function CustomListContainer({
|
|
74
74
|
options,
|
|
75
75
|
className,
|
|
76
76
|
children,
|
|
@@ -72,7 +72,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
`SmartLoaderPreset` is the styled (preset) implementation: register it
|
|
75
|
+
`SmartLoaderPreset` is the styled (preset) implementation: register it under the `'loader'` key of `SmartProvider`'s `components`, render it directly in place of `SmartLoader`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
76
76
|
|
|
77
77
|
### The `useLoader` hook
|
|
78
78
|
|
|
@@ -91,7 +91,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
`SmartMediaObjectPreset` is the styled (preset) implementation: register it
|
|
94
|
+
`SmartMediaObjectPreset` is the styled (preset) implementation: register it under the `'media-object'` key of `SmartProvider`'s `components`, render it directly in place of `SmartMediaObject`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
95
95
|
|
|
96
96
|
```tsx
|
|
97
97
|
import { SmartMediaObjectProps } from '@smartsoft001/react';
|
|
@@ -67,11 +67,11 @@ Payload of `onActionClick`.
|
|
|
67
67
|
|
|
68
68
|
### `IModalAction`
|
|
69
69
|
|
|
70
|
-
| Field | Type | Default
|
|
71
|
-
| ---------- | ------------------------- |
|
|
72
|
-
| `id` | `string` | required
|
|
73
|
-
| `label` | `string` | required
|
|
74
|
-
| `variant?` | `SmartModalActionVariant` | `'
|
|
70
|
+
| Field | Type | Default | Description |
|
|
71
|
+
| ---------- | ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
72
|
+
| `id` | `string` | required | Reported as `actionId`. |
|
|
73
|
+
| `label` | `string` | required | Button text. |
|
|
74
|
+
| `variant?` | `SmartModalActionVariant` | `'primary'` | `primary`, `secondary` or `danger`; the standard exposes it as `data-variant`, the preset styles the button by it. |
|
|
75
75
|
|
|
76
76
|
### Related types
|
|
77
77
|
|
|
@@ -185,7 +185,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
185
185
|
}
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
`SmartModalPreset` is the styled (preset) implementation: register it
|
|
188
|
+
`SmartModalPreset` is the styled (preset) implementation: register it under the `'modal'` key of `SmartProvider`'s `components`, render it directly in place of `SmartModal`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
189
189
|
|
|
190
190
|
### The `useModal` hook
|
|
191
191
|
|
|
@@ -211,7 +211,7 @@ function useModal({
|
|
|
211
211
|
```tsx
|
|
212
212
|
import { SmartModalProps, useModal } from '@smartsoft001/react';
|
|
213
213
|
|
|
214
|
-
export function
|
|
214
|
+
export function CustomModal(props: SmartModalProps) {
|
|
215
215
|
const { open, close, invokeAction } = useModal(props);
|
|
216
216
|
|
|
217
217
|
if (!open) return null;
|
|
@@ -247,7 +247,7 @@ export function SheetModal(props: SmartModalProps) {
|
|
|
247
247
|
}
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
Registered as `components={{ modal:
|
|
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`).
|
|
251
251
|
|
|
252
252
|
## Styling
|
|
253
253
|
|
|
@@ -116,7 +116,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
116
116
|
}
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
`SmartMultiColumnLayoutPreset` is the styled (preset) implementation: register it
|
|
119
|
+
`SmartMultiColumnLayoutPreset` is the styled (preset) implementation: register it under the `'multi-column-layout'` key of `SmartProvider`'s `components`, render it directly in place of `SmartMultiColumnLayout`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
120
120
|
|
|
121
121
|
```tsx
|
|
122
122
|
import { SmartMultiColumnLayoutProps } from '@smartsoft001/react';
|
|
@@ -131,7 +131,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
131
131
|
}
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
`SmartNavbarPreset` is the styled (preset) implementation: register it
|
|
134
|
+
`SmartNavbarPreset` is the styled (preset) implementation: register it under the `'navbar'` key of `SmartProvider`'s `components`, render it directly in place of `SmartNavbar`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
135
135
|
|
|
136
136
|
### The `useNavbar` hook
|
|
137
137
|
|
|
@@ -62,11 +62,11 @@ Payload of `onActionClick`.
|
|
|
62
62
|
|
|
63
63
|
### `INotificationAction`
|
|
64
64
|
|
|
65
|
-
| Field | Type | Default
|
|
66
|
-
| ---------- | -------------------------- |
|
|
67
|
-
| `id` | `string` | required
|
|
68
|
-
| `label` | `string` | required
|
|
69
|
-
| `variant?` | `'primary' \| 'secondary'` | `'
|
|
65
|
+
| Field | Type | Default | Description |
|
|
66
|
+
| ---------- | -------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `id` | `string` | required | Reported as `actionId`. |
|
|
68
|
+
| `label` | `string` | required | Button text. |
|
|
69
|
+
| `variant?` | `'primary' \| 'secondary'` | `'primary'` | `primary` or `secondary` look; the standard exposes it as `data-variant`, the preset styles the action by it. |
|
|
70
70
|
|
|
71
71
|
### Related types
|
|
72
72
|
|
|
@@ -154,7 +154,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
154
154
|
}
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
`SmartNotificationPreset` is the styled (preset) implementation: register it
|
|
157
|
+
`SmartNotificationPreset` is the styled (preset) implementation: register it under the `'notification'` key of `SmartProvider`'s `components`, render it directly in place of `SmartNotification`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
158
158
|
|
|
159
159
|
### The `useNotification` hook
|
|
160
160
|
|
|
@@ -175,7 +175,7 @@ function useNotification({
|
|
|
175
175
|
```tsx
|
|
176
176
|
import { SmartNotificationProps, useNotification } from '@smartsoft001/react';
|
|
177
177
|
|
|
178
|
-
export function
|
|
178
|
+
export function CustomNotification(props: SmartNotificationProps) {
|
|
179
179
|
const { dismiss, invokeAction } = useNotification(props);
|
|
180
180
|
|
|
181
181
|
return (
|
|
@@ -205,11 +205,11 @@ export function BannerNotification(props: SmartNotificationProps) {
|
|
|
205
205
|
}
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
Registered as `components={{ notification:
|
|
208
|
+
Registered as `components={{ notification: CustomNotification }}`, it also renders the toasts of `ToastService`.
|
|
209
209
|
|
|
210
210
|
## Styling
|
|
211
211
|
|
|
212
|
-
-
|
|
212
|
+
- `SmartNotificationStandard` is unstyled semantic markup (no classes); `SmartNotificationPreset` renders the six toast looks with `smart:dark:` variants and labels itself with a `useId()`-based id.
|
|
213
213
|
|
|
214
214
|
## File Locations
|
|
215
215
|
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Page Heading (`SmartPageHeading`)
|
|
8
8
|
|
|
9
|
-
`SmartPageHeading` renders the heading of a page from `options`: a title and subtitle plus `ReactNode` slots (breadcrumbs, banner, avatar, logo, meta, stats, actions, filters, nav), each rendered only when given. The standard rendering is unstyled: breadcrumbs and banner above a `<header>` with the title and the other slots. `SmartPageHeadingPreset` renders a navbar-like `<header>` (logo
|
|
9
|
+
`SmartPageHeading` renders the heading of a page from `options`: a title and subtitle plus `ReactNode` slots (breadcrumbs, banner, avatar, logo, meta, stats, actions, filters, nav), each rendered only when given. The standard rendering is unstyled: breadcrumbs and banner above a `<header>` with the title and the other slots. `SmartPageHeadingPreset` renders a navbar-like `<header>` (a brand zone with the logo, the title as an `<h1>` and the subtitle, a desktop nav, actions or avatar, a mobile toggle) laid out by `options.presentation.layout`; it reads only `title`, `subtitle`, `logoTpl`, `navTpl`, `actionsTpl`, `avatarTpl` and `presentation`, so the breadcrumbs, banner, meta, stats and filters slots are rendered by the standard heading only.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ All from `@smartsoft001/react`.
|
|
|
26
26
|
| `SmartPageHeadingPreset` | component | HyperUI-styled page heading variation (preset). |
|
|
27
27
|
| `SmartPageHeadingStandard` | component | The default page heading rendering: unstyled breadcrumbs and banner slots above a `<header>` holding the title, subtitle and the avatar / logo / meta / stats / actions / filters slots. |
|
|
28
28
|
|
|
29
|
-
The preset's class helpers (`getPageHeadingHeaderClasses`, `getPageHeadingBarClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
29
|
+
The preset's class helpers (`getPageHeadingHeaderClasses`, `getPageHeadingBarClasses`) and the `PageHeadingPresetLayout` type (`'links-left' | 'links-center' | 'links-right' | 'user'`) are exported too, for a custom implementation that wants the preset look.
|
|
30
30
|
|
|
31
31
|
## Props and Types
|
|
32
32
|
|
|
@@ -41,15 +41,15 @@ The preset's class helpers (`getPageHeadingHeaderClasses`, `getPageHeadingBarCla
|
|
|
41
41
|
|
|
42
42
|
| Field | Type | Default | Description |
|
|
43
43
|
| ----------------- | ------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------- |
|
|
44
|
-
| `title?` | `string` | — | The page title (the preset
|
|
45
|
-
| `subtitle?` | `string` | — | Text under the title
|
|
44
|
+
| `title?` | `string` | — | The page title, an `<h1>` (the preset puts it in the brand zone, after the logo). |
|
|
45
|
+
| `subtitle?` | `string` | — | Text under the title. |
|
|
46
46
|
| `breadcrumbsTpl?` | `ReactNode` | — | Breadcrumbs above the header (standard). |
|
|
47
47
|
| `metaTpl?` | `ReactNode` | — | Meta information: dates, location, counts (standard). |
|
|
48
48
|
| `avatarTpl?` | `ReactNode` | — | An avatar (the preset's `user` layout shows it in place of the actions). |
|
|
49
49
|
| `bannerTpl?` | `ReactNode` | — | A banner image above the header (standard). |
|
|
50
50
|
| `actionsTpl?` | `ReactNode` | — | Action buttons. |
|
|
51
51
|
| `statsTpl?` | `ReactNode` | — | A stats row (standard). |
|
|
52
|
-
| `logoTpl?` | `ReactNode` | — |
|
|
52
|
+
| `logoTpl?` | `ReactNode` | — | A logo (the preset's brand zone, before the title). |
|
|
53
53
|
| `filtersTpl?` | `ReactNode` | — | Filter controls (standard). |
|
|
54
54
|
| `navTpl?` | `ReactNode` | — | Navigation links (the preset's desktop nav zone and mobile panel). |
|
|
55
55
|
| `presentation?` | `{ layout?: 'links-left' \| 'links-center' \| 'links-right' \| 'user'; }` | — | `layout` of the preset: `links-left` (default), `links-center`, `links-right` or `user`. |
|
|
@@ -117,7 +117,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
117
117
|
}
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
`SmartPageHeadingPreset` is the styled (preset) implementation: register it
|
|
120
|
+
`SmartPageHeadingPreset` is the styled (preset) implementation: register it under the `'page-heading'` key of `SmartProvider`'s `components`, render it directly in place of `SmartPageHeading`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
121
121
|
|
|
122
122
|
```tsx
|
|
123
123
|
import { SmartPageHeadingProps } from '@smartsoft001/react';
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Paging (`SmartPaging`)
|
|
8
8
|
|
|
9
|
-
`SmartPaging` renders pagination controls: previous / next buttons around a page list with `'...'` gaps (all pages up to 7, otherwise the first, the last and the neighbours of the current one), and, in the preset's `card-footer` variant, a "Showing x to y of z results" summary. The page is **owned by the parent**: pass `currentPage` and update it from `onPageChange(page)`. Navigation beyond the first or last page is ignored.
|
|
9
|
+
`SmartPaging` renders pagination controls: previous / next buttons around a page list with `'...'` gaps (all pages up to 7, otherwise the first, the last and the neighbours of the current one), and, in the preset's `card-footer` variant, a "Showing x to y of z results" summary. The page is **owned by the parent**: pass `currentPage` and update it from `onPageChange(page)`. Navigation beyond the first or last page is ignored; clicking the current page still reports it.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -27,21 +27,21 @@ All from `@smartsoft001/react`.
|
|
|
27
27
|
| `SmartPagingStandard` | component | The default paging rendering: translated prev / next buttons around the page list. |
|
|
28
28
|
| `usePaging` | hook | The behaviour every paging variant shares: the "showing x to y" range, the page list with `'...'` gaps (all pages up to 7, otherwise the first, the last and the neighbours of the current one), and the guarded navigation that reports the requested page through `onPageChange`. |
|
|
29
29
|
|
|
30
|
-
The preset's class helpers (`getPagingContainerClasses`, `getPagingNavClasses`, `getPagingPageClasses`, `PAGING_ELLIPSIS_CLASSES`, `PAGING_RESULTS_CLASSES`, `PAGING_PAGE_LIST_CLASSES`, `PAGING_NAV_BUTTON_CLASSES`) are exported too, for a custom implementation that wants the preset look.
|
|
30
|
+
The preset's class helpers (`getPagingContainerClasses`, `getPagingNavClasses`, `getPagingPageClasses`, `PAGING_ELLIPSIS_CLASSES`, `PAGING_RESULTS_CLASSES`, `PAGING_PAGE_LIST_CLASSES`, `PAGING_NAV_BUTTON_CLASSES`) and their `SmartPagingPresetVariant` type (the same union as `PagingVariant`) are exported too, for a custom implementation that wants the preset look.
|
|
31
31
|
|
|
32
32
|
## Props and Types
|
|
33
33
|
|
|
34
34
|
### `SmartPagingProps`
|
|
35
35
|
|
|
36
|
-
| Prop | Type | Default | Description
|
|
37
|
-
| --------------- | ------------------------ | --------------- |
|
|
38
|
-
| `currentPage?` | `number` | `1` | The current page, 1-based.
|
|
39
|
-
| `totalPages?` | `number` | `1` | Number of pages.
|
|
40
|
-
| `pageSize?` | `number` | `10` | Items per page, for the summary.
|
|
41
|
-
| `totalItems?` | `number` | `0` | Total number of items, for the summary.
|
|
42
|
-
| `variant?` | `PagingVariant` | `'card-footer'` | The layout (preset); the standard exposes it as `data-variant`.
|
|
43
|
-
| `className?` | `string` | — | Classes on the `<nav>`.
|
|
44
|
-
| `onPageChange?` | `(page: number) => void` | — | Called with the requested page.
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
| --------------- | ------------------------ | --------------- | ------------------------------------------------------------------ |
|
|
38
|
+
| `currentPage?` | `number` | `1` | The current page, 1-based. |
|
|
39
|
+
| `totalPages?` | `number` | `1` | Number of pages. |
|
|
40
|
+
| `pageSize?` | `number` | `10` | Items per page, for the preset's `card-footer` summary. |
|
|
41
|
+
| `totalItems?` | `number` | `0` | Total number of items, for the preset's `card-footer` summary. |
|
|
42
|
+
| `variant?` | `PagingVariant` | `'card-footer'` | The layout (preset); the standard exposes it as `data-variant`. |
|
|
43
|
+
| `className?` | `string` | — | Classes on the root: the standard's `<nav>`, the preset's `<div>`. |
|
|
44
|
+
| `onPageChange?` | `(page: number) => void` | — | Called with the requested page. |
|
|
45
45
|
|
|
46
46
|
### Related types
|
|
47
47
|
|
|
@@ -97,7 +97,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
`SmartPagingPreset` is the styled (preset) implementation: register it
|
|
100
|
+
`SmartPagingPreset` is the styled (preset) implementation: register it under the `'paging'` key of `SmartProvider`'s `components`, render it directly in place of `SmartPaging`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
101
101
|
|
|
102
102
|
### The `usePaging` hook
|
|
103
103
|
|
|
@@ -114,21 +114,21 @@ function usePaging({
|
|
|
114
114
|
}: SmartPagingProps);
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
| Returns | Type | Description
|
|
118
|
-
| -------------- | ------------------------ |
|
|
119
|
-
| `currentPage` | `number` | `currentPage` with its default.
|
|
120
|
-
| `totalPages` | `number` | `totalPages` with its default.
|
|
121
|
-
| `pageSize` | `number` | `pageSize` with its default.
|
|
122
|
-
| `totalItems` | `number` | `totalItems` with its default.
|
|
123
|
-
| `variant` | `PagingVariant` | `variant` with its default.
|
|
124
|
-
| `showingFrom` | `number` | First item number of the current page.
|
|
125
|
-
| `showingTo` | `number` | Last item number of the current page.
|
|
126
|
-
| `canGoBack` | `boolean` | `currentPage > 1`.
|
|
127
|
-
| `canGoForward` | `boolean` | `currentPage < totalPages`.
|
|
128
|
-
| `pages` | `(number \| "...")[]` | The page numbers to render, with `'...'` gaps.
|
|
129
|
-
| `goToPage` | `(page: number) => void` | Reports a page through `onPageChange` (ignored when out of range
|
|
130
|
-
| `nextPage` | `() => void` | Reports the next page.
|
|
131
|
-
| `previousPage` | `() => void` | Reports the previous page.
|
|
117
|
+
| Returns | Type | Description |
|
|
118
|
+
| -------------- | ------------------------ | ------------------------------------------------------------------ |
|
|
119
|
+
| `currentPage` | `number` | `currentPage` with its default. |
|
|
120
|
+
| `totalPages` | `number` | `totalPages` with its default. |
|
|
121
|
+
| `pageSize` | `number` | `pageSize` with its default. |
|
|
122
|
+
| `totalItems` | `number` | `totalItems` with its default. |
|
|
123
|
+
| `variant` | `PagingVariant` | `variant` with its default. |
|
|
124
|
+
| `showingFrom` | `number` | First item number of the current page. |
|
|
125
|
+
| `showingTo` | `number` | Last item number of the current page. |
|
|
126
|
+
| `canGoBack` | `boolean` | `currentPage > 1`. |
|
|
127
|
+
| `canGoForward` | `boolean` | `currentPage < totalPages`. |
|
|
128
|
+
| `pages` | `(number \| "...")[]` | The page numbers to render, with `'...'` gaps. |
|
|
129
|
+
| `goToPage` | `(page: number) => void` | Reports a page through `onPageChange` (ignored when out of range). |
|
|
130
|
+
| `nextPage` | `() => void` | Reports the next page. |
|
|
131
|
+
| `previousPage` | `() => void` | Reports the previous page. |
|
|
132
132
|
|
|
133
133
|
```tsx
|
|
134
134
|
import { SmartPagingProps, usePaging } from '@smartsoft001/react';
|
|
@@ -169,7 +169,7 @@ export function PageSelect(props: SmartPagingProps) {
|
|
|
169
169
|
|
|
170
170
|
## Styling
|
|
171
171
|
|
|
172
|
-
- `SmartPagingStandard` renders translated prev / next buttons and the page list; `SmartPagingPreset` renders the three layouts with `smart:dark:` variants, but its "Showing x to y of z results", "Previous" and "Next" texts are not translated.
|
|
172
|
+
- `SmartPagingStandard` renders translated prev / next buttons and the page list, without a summary (`pageSize`, `totalItems` and `variant` change nothing visible there); `SmartPagingPreset` renders the three layouts with `smart:dark:` variants, but its "Showing x to y of z results", "Previous" and "Next" texts are not translated.
|
|
173
173
|
|
|
174
174
|
## File Locations
|
|
175
175
|
|