@smartsoft001/claude-plugins 2.201.0 → 2.203.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/smart-angular/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-angular/skills/angular-components-accordion/SKILL.md +84 -80
- package/plugins/smart-angular/skills/angular-components-action-panel/SKILL.md +35 -60
- package/plugins/smart-angular/skills/angular-components-alert/SKILL.md +24 -29
- package/plugins/smart-angular/skills/angular-components-avatar/SKILL.md +30 -30
- package/plugins/smart-angular/skills/angular-components-badge/SKILL.md +18 -12
- package/plugins/smart-angular/skills/angular-components-breadcrumbs/SKILL.md +27 -10
- package/plugins/smart-angular/skills/angular-components-button/SKILL.md +43 -17
- package/plugins/smart-angular/skills/angular-components-button-group/SKILL.md +26 -14
- package/plugins/smart-angular/skills/angular-components-calendar/SKILL.md +47 -28
- package/plugins/smart-angular/skills/angular-components-card/SKILL.md +29 -22
- package/plugins/smart-angular/skills/angular-components-card-heading/SKILL.md +24 -18
- package/plugins/smart-angular/skills/angular-components-command-palette/SKILL.md +41 -32
- package/plugins/smart-angular/skills/angular-components-container/SKILL.md +21 -20
- package/plugins/smart-angular/skills/angular-components-date-edit/SKILL.md +48 -45
- package/plugins/smart-angular/skills/angular-components-date-range/SKILL.md +72 -82
- package/plugins/smart-angular/skills/angular-components-description-list/SKILL.md +23 -10
- package/plugins/smart-angular/skills/angular-components-detail/SKILL.md +20 -8
- package/plugins/smart-angular/skills/angular-components-details/SKILL.md +64 -13
- package/plugins/smart-angular/skills/angular-components-divider/SKILL.md +36 -18
- package/plugins/smart-angular/skills/angular-components-drawer/SKILL.md +28 -23
- package/plugins/smart-angular/skills/angular-components-dropdown/SKILL.md +35 -16
- package/plugins/smart-angular/skills/angular-components-empty-state/SKILL.md +49 -11
- package/plugins/smart-angular/skills/angular-components-feed/SKILL.md +45 -12
- package/plugins/smart-angular/skills/angular-components-form/SKILL.md +53 -25
- package/plugins/smart-angular/skills/angular-components-grid-list/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-icon/SKILL.md +8 -8
- package/plugins/smart-angular/skills/angular-components-info/SKILL.md +19 -15
- package/plugins/smart-angular/skills/angular-components-input/SKILL.md +86 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +131 -81
- package/plugins/smart-angular/skills/angular-components-list-container/SKILL.md +24 -32
- package/plugins/smart-angular/skills/angular-components-media-object/SKILL.md +19 -17
- package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +78 -17
- package/plugins/smart-angular/skills/angular-components-multi-column-layout/SKILL.md +19 -16
- package/plugins/smart-angular/skills/angular-components-navbar/SKILL.md +38 -21
- package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +32 -33
- package/plugins/smart-angular/skills/angular-components-page/SKILL.md +48 -52
- package/plugins/smart-angular/skills/angular-components-page-heading/SKILL.md +42 -25
- package/plugins/smart-angular/skills/angular-components-paging/SKILL.md +17 -15
- package/plugins/smart-angular/skills/angular-components-password-strength/SKILL.md +21 -19
- package/plugins/smart-angular/skills/angular-components-progress-bars/SKILL.md +61 -24
- package/plugins/smart-angular/skills/angular-components-searchbar/SKILL.md +30 -37
- package/plugins/smart-angular/skills/angular-components-section-heading/SKILL.md +38 -27
- package/plugins/smart-angular/skills/angular-components-select-menu/SKILL.md +33 -17
- package/plugins/smart-angular/skills/angular-components-sidebar-layout/SKILL.md +30 -26
- package/plugins/smart-angular/skills/angular-components-sidebar-navigation/SKILL.md +79 -16
- package/plugins/smart-angular/skills/angular-components-sign-in-form/SKILL.md +64 -24
- package/plugins/smart-angular/skills/angular-components-stacked-layout/SKILL.md +24 -23
- package/plugins/smart-angular/skills/angular-components-stacked-list/SKILL.md +40 -21
- package/plugins/smart-angular/skills/angular-components-stats/SKILL.md +28 -15
- package/plugins/smart-angular/skills/angular-components-table/SKILL.md +42 -22
- package/plugins/smart-angular/skills/angular-components-tabs/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-textarea/SKILL.md +48 -46
- package/plugins/smart-angular/skills/angular-components-toggle/SKILL.md +21 -28
- package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +66 -24
- package/plugins/smart-angular/skills/smart-crud/SKILL.md +5 -2
- package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +11 -11
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +7 -7
- package/plugins/smart-react/skills/react-components-button/SKILL.md +20 -20
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-card/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +25 -16
- package/plugins/smart-react/skills/react-components-details/SKILL.md +16 -16
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-info/SKILL.md +3 -1
- package/plugins/smart-react/skills/react-components-input/SKILL.md +51 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +81 -45
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-overlays/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-page/SKILL.md +5 -5
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +28 -28
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +29 -29
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-table/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +3 -2
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-provider/SKILL.md +1 -1
- package/plugins/smart-react/skills/smart-crud-react/SKILL.md +2 -2
|
@@ -31,11 +31,11 @@ The preset's class helpers (`getActionPanelCardClasses`, `getActionPanelTitleCla
|
|
|
31
31
|
|
|
32
32
|
### `SmartActionPanelProps`
|
|
33
33
|
|
|
34
|
-
| Prop | Type | Default | Description
|
|
35
|
-
| ---------------- | ------------------------------------------ | ------- |
|
|
36
|
-
| `options?` | `IActionPanelOptions` | — | The panel's content and layout.
|
|
37
|
-
| `className?` | `string` | — | Classes
|
|
38
|
-
| `onActionClick?` | `(event: IActionPanelActionClick) => void` | — | Called when an action without `href` is clicked.
|
|
34
|
+
| Prop | Type | Default | Description |
|
|
35
|
+
| ---------------- | ------------------------------------------ | ------- | --------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `options?` | `IActionPanelOptions` | — | The panel's content and layout. |
|
|
37
|
+
| `className?` | `string` | — | Classes on the root element: the `div` around `section.action-panel` (standard), the card (preset). |
|
|
38
|
+
| `onActionClick?` | `(event: IActionPanelActionClick) => void` | — | Called when an action without `href` is clicked. |
|
|
39
39
|
|
|
40
40
|
### `IActionPanelOptions`
|
|
41
41
|
|
|
@@ -58,13 +58,13 @@ Passed to `onActionClick` when a button action is clicked.
|
|
|
58
58
|
|
|
59
59
|
### `IActionPanelAction`
|
|
60
60
|
|
|
61
|
-
| Field | Type | Default | Description
|
|
62
|
-
| ---------- | ----------------------------------------------- | -------- |
|
|
63
|
-
| `id` | `string` | required | Reported as `actionId` by `onActionClick`.
|
|
64
|
-
| `label?` | `string` | — | Text of the button / link.
|
|
65
|
-
| `href?` | `string` | — | Renders the action as a link instead of a button (no `onActionClick`).
|
|
66
|
-
| `variant?` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | — | Look of the action
|
|
67
|
-
| `iconTpl?` | `ReactNode` | — | Icon rendered with the label.
|
|
61
|
+
| Field | Type | Default | Description |
|
|
62
|
+
| ---------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `id` | `string` | required | Reported as `actionId` by `onActionClick`. |
|
|
64
|
+
| `label?` | `string` | — | Text of the button / link. |
|
|
65
|
+
| `href?` | `string` | — | Renders the action as a link instead of a button (no `onActionClick`). |
|
|
66
|
+
| `variant?` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | — | Look of the action. The standard only adds the class `variant-<variant>` (`variant-primary` by default for buttons, `variant-link` for links). The preset renders `primary` as a solid button and every other value, or none, as an outline button; in the `with-link` layout every action looks like a link. |
|
|
67
|
+
| `iconTpl?` | `ReactNode` | — | Icon rendered with the label. |
|
|
68
68
|
|
|
69
69
|
### Related types
|
|
70
70
|
|
|
@@ -138,7 +138,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
`SmartActionPanelPreset` is the styled (preset) implementation: register it
|
|
141
|
+
`SmartActionPanelPreset` is the styled (preset) implementation: register it under the `'action-panel'` key of `SmartProvider`'s `components`, render it directly in place of `SmartActionPanel`, 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.
|
|
142
142
|
|
|
143
143
|
A custom implementation takes `SmartActionPanelProps` and calls `onActionClick` for its buttons:
|
|
144
144
|
|
|
@@ -145,7 +145,7 @@ export function PublishConfirm({ onPublish }: { onPublish: () => void }) {
|
|
|
145
145
|
|
|
146
146
|
`SmartAlert` renders the component registered under the `'alert'` key of `SmartProvider`'s `components`, and `SmartAlertStandard` when nothing is registered there. Every `SmartAlert` below the provider then renders the registered component, which receives the same props.
|
|
147
147
|
|
|
148
|
-
There is no preset for this component: register a component of your own that takes `SmartAlertProps
|
|
148
|
+
There is no preset for this component: register a component of your own that takes `SmartAlertProps` as `components={{ alert: MyAlert }}` (the example at the end of this section is one). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
149
149
|
|
|
150
150
|
### The `useAlert` hook
|
|
151
151
|
|
|
@@ -226,7 +226,7 @@ export function BrandAlert(props: SmartAlertProps) {
|
|
|
226
226
|
}
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
Registered
|
|
229
|
+
Registered under the `alert` key, it renders both the `SmartAlert`s placed by hand and the dialogs of `AlertService.show`.
|
|
230
230
|
|
|
231
231
|
## Styling
|
|
232
232
|
|
|
@@ -32,16 +32,16 @@ The preset's class helpers (`getAvatarImageClasses`, `getAvatarInitialsClasses`,
|
|
|
32
32
|
|
|
33
33
|
### `SmartAvatarProps`
|
|
34
34
|
|
|
35
|
-
| Prop | Type | Default | Description
|
|
36
|
-
| ----------------------- | ------------------- | ---------- |
|
|
37
|
-
| `imageUrl?` | `string` | — | Picture URL; when missing, the initials or the placeholder are shown.
|
|
38
|
-
| `initials?` | `string` | — | Initials shown when there is no image.
|
|
39
|
-
| `size?` | `SmartAvatarSize` | `'md'` | The size scale (`xs` to `xl`).
|
|
40
|
-
| `shape?` | `SmartAvatarShape` | `'circle'` | `circle` or `rounded` (rounded square).
|
|
41
|
-
| `notificationPosition?` | `'top' \| 'bottom'` | — |
|
|
42
|
-
| `group?` | `IAvatarItem[]` | — | Renders a stacked group instead of one avatar when non-empty.
|
|
43
|
-
| `options?` | `IAvatarOptions` | — | Placeholder type and stack direction.
|
|
44
|
-
| `className?` | `string` | — | Classes on the outermost element (group container, status wrapper or the avatar).
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ----------------------- | ------------------- | ---------- | -------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `imageUrl?` | `string` | — | Picture URL; when missing, the initials or the placeholder are shown. |
|
|
38
|
+
| `initials?` | `string` | — | Initials shown when there is no image. |
|
|
39
|
+
| `size?` | `SmartAvatarSize` | `'md'` | The size scale (`xs` to `xl`). Styled by the preset; `data-size` on the standard. |
|
|
40
|
+
| `shape?` | `SmartAvatarShape` | `'circle'` | `circle` or `rounded` (rounded square). Styled by the preset; `data-shape` on the standard. |
|
|
41
|
+
| `notificationPosition?` | `'top' \| 'bottom'` | — | Preset only: corner of the status dot of a single avatar; no dot when unset. `SmartAvatarStandard` ignores it. |
|
|
42
|
+
| `group?` | `IAvatarItem[]` | — | Renders a stacked group instead of one avatar when non-empty. |
|
|
43
|
+
| `options?` | `IAvatarOptions` | — | Placeholder type and stack direction. |
|
|
44
|
+
| `className?` | `string` | — | Classes on the outermost element (group container, status wrapper or the avatar). |
|
|
45
45
|
|
|
46
46
|
### `IAvatarOptions`
|
|
47
47
|
|
|
@@ -116,7 +116,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
116
116
|
}
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
`SmartAvatarPreset` is the styled (preset) implementation: register it
|
|
119
|
+
`SmartAvatarPreset` is the styled (preset) implementation: register it under the `'avatar'` key of `SmartProvider`'s `components`, render it directly in place of `SmartAvatar`, 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
|
### The `useAvatar` hook
|
|
122
122
|
|
|
@@ -25,7 +25,7 @@ All from `@smartsoft001/react`.
|
|
|
25
25
|
| `SmartBadgeStandard` | component | The default badge rendering: unstyled markup exposing `color`, `size`, `options.variant` and `options.pill` as `data-*` attributes for the application's own CSS. |
|
|
26
26
|
| `useBadge` | hook | The behaviour every badge variant shares: `remove()` reports the click on the remove button through `onRemoved`. |
|
|
27
27
|
|
|
28
|
-
The preset's class helpers (`getBadgeClasses`, `getDotClasses`, `getRemoveClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
28
|
+
The preset's class helpers (`getBadgeClasses`, `getDotClasses`, `getRemoveClasses`) and their `SmartBadgePresetVariant` type (`'solid' | 'soft' | 'outline'`) are exported too, for a custom implementation that wants the preset look.
|
|
29
29
|
|
|
30
30
|
## Props and Types
|
|
31
31
|
|
|
@@ -109,7 +109,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
109
109
|
}
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
`SmartBadgePreset` is the styled (preset) implementation: register it
|
|
112
|
+
`SmartBadgePreset` is the styled (preset) implementation: register it under the `'badge'` key of `SmartProvider`'s `components`, render it directly in place of `SmartBadge`, 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.
|
|
113
113
|
|
|
114
114
|
### The `useBadge` hook
|
|
115
115
|
|
|
@@ -40,12 +40,12 @@ The preset's class helpers (`getBreadcrumbsNavClasses`, `getBreadcrumbsListClass
|
|
|
40
40
|
|
|
41
41
|
### `IBreadcrumbsOptions`
|
|
42
42
|
|
|
43
|
-
| Field | Type | Default | Description
|
|
44
|
-
| ------------ | --------------------------- | -------------- |
|
|
45
|
-
| `layout?` | `SmartBreadcrumbsLayout` | — | `contained` or `full-width-bar` wrap the trail in a bar; `simple-with-slashes` implies the slash separator. Read by the preset; the standard markup ignores it. |
|
|
46
|
-
| `ariaLabel?` | `string` | `'Breadcrumb'` | Accessible name of the `nav`.
|
|
47
|
-
| `separator?` | `SmartBreadcrumbsSeparator` | `'chevron'` | Glyph between items (`data-separator` on the standard markup).
|
|
48
|
-
| `items` | `IBreadcrumbItem[]` | required | The trail, first to last.
|
|
43
|
+
| Field | Type | Default | Description |
|
|
44
|
+
| ------------ | --------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
45
|
+
| `layout?` | `SmartBreadcrumbsLayout` | — | `contained` or `full-width-bar` wrap the trail in a bar; `simple-with-slashes` implies the slash separator; `simple-with-chevrons` changes nothing. Read by the preset only; the standard markup ignores it. |
|
|
46
|
+
| `ariaLabel?` | `string` | `'Breadcrumb'` | Accessible name of the `nav`. |
|
|
47
|
+
| `separator?` | `SmartBreadcrumbsSeparator` | `'chevron'` | Glyph between items (`data-separator` on the standard markup). |
|
|
48
|
+
| `items` | `IBreadcrumbItem[]` | required | The trail, first to last. |
|
|
49
49
|
|
|
50
50
|
### `IBreadcrumbsItemClick`
|
|
51
51
|
|
|
@@ -114,7 +114,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
`SmartBreadcrumbsPreset` is the styled (preset) implementation: register it
|
|
117
|
+
`SmartBreadcrumbsPreset` is the styled (preset) implementation: register it under the `'breadcrumbs'` key of `SmartProvider`'s `components`, render it directly in place of `SmartBreadcrumbs`, 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.
|
|
118
118
|
|
|
119
119
|
### The `useBreadcrumbs` hook
|
|
120
120
|
|
|
@@ -27,33 +27,33 @@ All from `@smartsoft001/react`.
|
|
|
27
27
|
| `SmartButtonStandard` | component | The default button rendering. |
|
|
28
28
|
| `useButton` | hook | The behaviour every button variant shares: the colour classes of the variant, and the confirm mode, where a first click asks for confirmation instead of running `options.click`. |
|
|
29
29
|
|
|
30
|
-
The preset's class helpers (`toButtonPresetVariant`, `getButtonPresetClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
30
|
+
The preset's class helpers (`toButtonPresetVariant`, `getButtonPresetClasses`) and their types (`SmartButtonPresetVariant`: `'solid' | 'outline' | 'soft'`; `ButtonPresetShape`: `{ rounded: boolean; circular: boolean }`) are exported too, for a custom implementation that wants the preset look.
|
|
31
31
|
|
|
32
32
|
## Props and Types
|
|
33
33
|
|
|
34
34
|
### `SmartButtonProps`
|
|
35
35
|
|
|
36
|
-
| Prop | Type | Default | Description
|
|
37
|
-
| ------------ | ---------------- | -------- |
|
|
38
|
-
| `options` | `IButtonOptions` | required | The button configuration; `click` is required.
|
|
39
|
-
| `disabled?` | `boolean` | `false` | Disables the button
|
|
40
|
-
| `className?` | `string` | — | Classes appended to the `<button>`.
|
|
41
|
-
| `children?` | `ReactNode` | — | The label (any `ReactNode`). Replaced by the spinner while `options.loading`.
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
| ------------ | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| `options` | `IButtonOptions` | required | The button configuration; `click` is required. |
|
|
39
|
+
| `disabled?` | `boolean` | `false` | Disables the button; the standard adds `smart:opacity-50 smart:cursor-not-allowed`, the preset `smart:disabled:opacity-50 smart:disabled:pointer-events-none`. |
|
|
40
|
+
| `className?` | `string` | — | Classes appended to the `<button>`. |
|
|
41
|
+
| `children?` | `ReactNode` | — | The label (any `ReactNode`). Replaced by the spinner while `options.loading`. |
|
|
42
42
|
|
|
43
43
|
### `IButtonOptions`
|
|
44
44
|
|
|
45
|
-
| Field | Type | Default | Description
|
|
46
|
-
| --------------- | ------------------------- | ----------- |
|
|
47
|
-
| `type?` | `'submit' \| 'button'` | `'button'` | The `type` attribute of the `<button>`. Use `'submit'` inside a `<form>` of your own.
|
|
48
|
-
| `confirm?` | `boolean` | — | The first click shows Cancel / Confirm buttons (translated `cancel` / `confirm`); `click` runs only after Confirm.
|
|
49
|
-
| `click` | `() => void` | required | Called on click (after the confirmation when `confirm` is set).
|
|
50
|
-
| `loading?` | `boolean` | — | Shows the spinner instead of the label and disables the button.
|
|
51
|
-
| `variant?` | `SmartVariant` | `'primary'` | `primary` (solid), `secondary` (outline) or `soft`.
|
|
52
|
-
| `size?` | `SmartSize` | `'md'` | Padding and text size; `xs` / `sm
|
|
53
|
-
| `color?` | `SmartColor` | `'indigo'` | One of the 22 Tailwind palette names.
|
|
54
|
-
| `rounded?` | `boolean` | — | Pill shape. Read by `SmartButtonPreset` only.
|
|
55
|
-
| `circular?` | `boolean` | — | Square padding plus pill shape, for an icon-only button. Read by `SmartButtonPreset` only.
|
|
56
|
-
| `iconPosition?` | `'leading' \| 'trailing'` | — |
|
|
45
|
+
| Field | Type | Default | Description |
|
|
46
|
+
| --------------- | ------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `type?` | `'submit' \| 'button'` | `'button'` | The `type` attribute of the `<button>`. Use `'submit'` inside a `<form>` of your own. |
|
|
48
|
+
| `confirm?` | `boolean` | — | The first click shows Cancel / Confirm buttons (translated `cancel` / `confirm`); `click` runs only after Confirm. |
|
|
49
|
+
| `click` | `() => void` | required | Called on click (after the confirmation when `confirm` is set). |
|
|
50
|
+
| `loading?` | `boolean` | — | Shows the spinner instead of the label and disables the button. |
|
|
51
|
+
| `variant?` | `SmartVariant` | `'primary'` | `primary` (solid), `secondary` (outline) or `soft`. |
|
|
52
|
+
| `size?` | `SmartSize` | `'md'` | Padding and text size; the standard also uses smaller rounding for `xs` / `sm`. |
|
|
53
|
+
| `color?` | `SmartColor` | `'indigo'` | One of the 22 Tailwind palette names. |
|
|
54
|
+
| `rounded?` | `boolean` | — | Pill shape. Read by `SmartButtonPreset` only. |
|
|
55
|
+
| `circular?` | `boolean` | — | Square padding plus pill shape, for an icon-only button. Read by `SmartButtonPreset` only. |
|
|
56
|
+
| `iconPosition?` | `'leading' \| 'trailing'` | — | Not read by the built-in implementations (`SmartButtonStandard`, `SmartButtonPreset`); available to a custom implementation. |
|
|
57
57
|
|
|
58
58
|
`SmartColor`, `SmartSize`, `SmartVariant` are described in the `react-provider` skill.
|
|
59
59
|
|
|
@@ -143,7 +143,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
`SmartButtonPreset` is the styled (preset) implementation: register it
|
|
146
|
+
`SmartButtonPreset` is the styled (preset) implementation: register it under the `'button'` key of `SmartProvider`'s `components`, render it directly in place of `SmartButton`, 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.
|
|
147
147
|
|
|
148
148
|
### The `useButton` hook
|
|
149
149
|
|
|
@@ -25,7 +25,7 @@ All from `@smartsoft001/react`.
|
|
|
25
25
|
| `SmartButtonGroupStandard` | component | The default button group rendering: an unstyled `role="group"` of toggle buttons with their label and count. |
|
|
26
26
|
| `useButtonGroup` | hook | The behaviour every button group variant shares: the selected button id, controlled through `selected` / `onSelectedChange` or kept internally, and `select(id)`, which selects a button and emits `onButtonClick`. |
|
|
27
27
|
|
|
28
|
-
The preset's class helpers (`getButtonGroupClasses`, `getButtonGroupButtonClasses`, `getButtonGroupCountClasses`, `getButtonGroupIconClasses`, `BUTTON_GROUP_CONTAINER`) are exported too, for a custom implementation that wants the preset look.
|
|
28
|
+
The preset's class helpers (`getButtonGroupClasses`, `getButtonGroupButtonClasses`, `getButtonGroupCountClasses`, `getButtonGroupIconClasses`, `BUTTON_GROUP_CONTAINER`) and the `ButtonGroupPresetSize` type (`'sm' | 'md' | 'lg'`, the size `getButtonGroupButtonClasses` takes; the preset itself always uses `'md'`) are exported too, for a custom implementation that wants the preset look.
|
|
29
29
|
|
|
30
30
|
## Props and Types
|
|
31
31
|
|
|
@@ -126,7 +126,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
126
126
|
}
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
`SmartButtonGroupPreset` is the styled (preset) implementation: register it
|
|
129
|
+
`SmartButtonGroupPreset` is the styled (preset) implementation: register it under the `'button-group'` key of `SmartProvider`'s `components`, render it directly in place of `SmartButtonGroup`, 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.
|
|
130
130
|
|
|
131
131
|
### The `useButtonGroup` hook
|
|
132
132
|
|
|
@@ -45,7 +45,7 @@ The preset's class helpers (`getCalendarPresetDayClasses`, `CALENDAR_PRESET_CONT
|
|
|
45
45
|
|
|
46
46
|
### `SmartCalendarOptions`
|
|
47
47
|
|
|
48
|
-
`ICalendarOptions` with `dayCellTpl` as a render function, called for every day with `SmartCalendarDayCellContext`. `toolbarActionsTpl` has no context, so it stays a `ReactNode`. `eventListTpl`, `sidePanelTpl`, `eventTpl` and `monthsCount` are
|
|
48
|
+
`ICalendarOptions` with `dayCellTpl` as a render function, called for every day with `SmartCalendarDayCellContext`. `toolbarActionsTpl` has no context, so it stays a `ReactNode`. `eventListTpl`, `sidePanelTpl`, `eventTpl` and `monthsCount` are not read by the built-in implementations; they are available to a custom implementation. Extends `Omit<ICalendarOptions, 'dayCellTpl'>`.
|
|
49
49
|
|
|
50
50
|
| Field | Type | Default | Description |
|
|
51
51
|
| ------------- | ----------------------------------------------------- | ------- | -------------------------------------- |
|
|
@@ -58,14 +58,14 @@ The base options; `SmartCalendarOptions` replaces its `dayCellTpl` with a render
|
|
|
58
58
|
| Field | Type | Default | Description |
|
|
59
59
|
| -------------------- | ------------------- | --------- | ----------------------------------------------------------------------------------------- |
|
|
60
60
|
| `view?` | `SmartCalendarView` | `'month'` | The period Prev / Next move by (month, week, day, year). The grid is always a month grid. |
|
|
61
|
-
| `monthsCount?` | `1 \| 2 \| 12` | — |
|
|
61
|
+
| `monthsCount?` | `1 \| 2 \| 12` | — | Not read by the built-in implementations; available to a custom implementation. |
|
|
62
62
|
| `weekStart?` | `0 \| 1` | `1` | `1` Monday, `0` Sunday. |
|
|
63
63
|
| `showToolbar?` | `boolean` | `true` | Shows the Prev / Today / Next toolbar. |
|
|
64
64
|
| `toolbarActionsTpl?` | `ReactNode` | — | Extra content in the toolbar of the standard calendar (the preset does not render it). |
|
|
65
|
-
| `eventListTpl?` | `ReactNode` | — |
|
|
66
|
-
| `sidePanelTpl?` | `ReactNode` | — |
|
|
65
|
+
| `eventListTpl?` | `ReactNode` | — | Not read by the built-in implementations; available to a custom implementation. |
|
|
66
|
+
| `sidePanelTpl?` | `ReactNode` | — | Not read by the built-in implementations; available to a custom implementation. |
|
|
67
67
|
| `dayCellTpl?` | `ReactNode` | — | Overridden by `SmartCalendarOptions.dayCellTpl` (a render function). |
|
|
68
|
-
| `eventTpl?` | `ReactNode` | — |
|
|
68
|
+
| `eventTpl?` | `ReactNode` | — | Not read by the built-in implementations; available to a custom implementation. |
|
|
69
69
|
|
|
70
70
|
### `SmartCalendarDayCellContext`
|
|
71
71
|
|
|
@@ -91,13 +91,13 @@ One day of the month grid.
|
|
|
91
91
|
|
|
92
92
|
An event shown on the day of its `start`.
|
|
93
93
|
|
|
94
|
-
| Field | Type | Default | Description
|
|
95
|
-
| -------- | ------------------------- | -------- |
|
|
96
|
-
| `id` | `string \| number` | required | Identifies the event.
|
|
97
|
-
| `start` | `Date` | required | Start; decides the day the event is listed on.
|
|
98
|
-
| `end?` | `Date` | — |
|
|
99
|
-
| `title?` | `string` | — |
|
|
100
|
-
| `meta?` | `Record<string, unknown>` | — | Free data for your `dayCellTpl`.
|
|
94
|
+
| Field | Type | Default | Description |
|
|
95
|
+
| -------- | ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `id` | `string \| number` | required | Identifies the event. |
|
|
97
|
+
| `start` | `Date` | required | Start; decides the day the event is listed on. |
|
|
98
|
+
| `end?` | `Date` | — | Not read by the built-in implementations; available to a custom implementation or your `dayCellTpl`. |
|
|
99
|
+
| `title?` | `string` | — | Not rendered by the built-in implementations (the day's accessible name only counts the events); available to a custom implementation or your `dayCellTpl`. |
|
|
100
|
+
| `meta?` | `Record<string, unknown>` | — | Free data for a custom implementation or your `dayCellTpl`. |
|
|
101
101
|
|
|
102
102
|
### Related types
|
|
103
103
|
|
|
@@ -173,7 +173,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
173
173
|
}
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
`SmartCalendarPreset` is the styled (preset) implementation: register it
|
|
176
|
+
`SmartCalendarPreset` is the styled (preset) implementation: register it under the `'calendar'` key of `SmartProvider`'s `components`, render it directly in place of `SmartCalendar`, 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.
|
|
177
177
|
|
|
178
178
|
### The `useCalendar` hook
|
|
179
179
|
|
|
@@ -136,7 +136,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
`SmartCardPreset` is the styled (preset) implementation: register it
|
|
139
|
+
`SmartCardPreset` is the styled (preset) implementation: register it under the `'card'` key of `SmartProvider`'s `components`, render it directly in place of `SmartCard`, 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.
|
|
140
140
|
|
|
141
141
|
### The `useCard` hook
|
|
142
142
|
|
|
@@ -24,7 +24,7 @@ All from `@smartsoft001/react`.
|
|
|
24
24
|
| `SmartCardHeadingPreset` | component | HyperUI-styled card heading variation (preset). |
|
|
25
25
|
| `SmartCardHeadingStandard` | component | The default card heading rendering: the avatar, the title, description and meta, and the actions of `options`, each only when given. |
|
|
26
26
|
|
|
27
|
-
The preset's class
|
|
27
|
+
The preset's class helper `getCardHeadingContainerClasses` and its `CardHeadingVariant` type (`'author' | 'stacked' | 'overlay' | 'outline'`) are exported too, for a custom implementation that wants the preset look.
|
|
28
28
|
|
|
29
29
|
## Props and Types
|
|
30
30
|
|
|
@@ -94,7 +94,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
`SmartCardHeadingPreset` is the styled (preset) implementation: register it
|
|
97
|
+
`SmartCardHeadingPreset` is the styled (preset) implementation: register it under the `'card-heading'` key of `SmartProvider`'s `components`, render it directly in place of `SmartCardHeading`, 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.
|
|
98
98
|
|
|
99
99
|
```tsx
|
|
100
100
|
import { SmartCardHeadingProps } from '@smartsoft001/react';
|
|
@@ -52,7 +52,7 @@ The preset's class helpers (`getCommandPaletteDialogClasses`, `getCommandPalette
|
|
|
52
52
|
| `variant?` | `SmartCommandPaletteVariant` | `'simple'` | The preset look; the standard ignores it. |
|
|
53
53
|
| `placeholder?` | `string` | — | Placeholder of the search input. |
|
|
54
54
|
| `emptyText?` | `string` | `'No results'` | Shown when nothing matches. |
|
|
55
|
-
| `ariaLabel?` | `string` | — | Accessible name of the
|
|
55
|
+
| `ariaLabel?` | `string` | — | Accessible name of the search input. |
|
|
56
56
|
|
|
57
57
|
### `ICommandPaletteRunCommand`
|
|
58
58
|
|
|
@@ -140,7 +140,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
140
140
|
}
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
`SmartCommandPalettePreset` is the styled (preset) implementation: register it
|
|
143
|
+
`SmartCommandPalettePreset` is the styled (preset) implementation: register it under the `'command-palette'` key of `SmartProvider`'s `components`, render it directly in place of `SmartCommandPalette`, 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.
|
|
144
144
|
|
|
145
145
|
### The `useCommandPalette` hook
|
|
146
146
|
|
|
@@ -213,7 +213,7 @@ export function InlineCommandList(props: SmartCommandPaletteProps) {
|
|
|
213
213
|
|
|
214
214
|
## Styling
|
|
215
215
|
|
|
216
|
-
- The standard
|
|
216
|
+
- The standard and preset palettes are native `<dialog>` elements: pressing Escape anywhere in the document closes an open palette, and so does the dialog's `close` event. `useCommandPalette` binds no keyboard listener, so a custom implementation handles Escape (and any Ctrl+K shortcut) itself.
|
|
217
217
|
- `SmartCommandPalettePreset` renders the variants `simple`, `with-padding`, `with-preview`, `with-images`, `with-icons`, `semi-transparent`, `with-groups` and `with-footer`, with `smart:dark:` variants.
|
|
218
218
|
|
|
219
219
|
## File Locations
|
|
@@ -38,11 +38,11 @@ The preset's class helpers (`getContainerClasses`) are exported too, for a custo
|
|
|
38
38
|
|
|
39
39
|
### `IContainerOptions`
|
|
40
40
|
|
|
41
|
-
| Field | Type | Default | Description
|
|
42
|
-
| ---------- | ---------------------------------------------- | ------- |
|
|
43
|
-
| `mode?` | `'full-width' \| 'constrained' \| 'container'` | — | In the preset: `container` centres at `max-w-7xl`, `constrained` at `max-w-5xl`, `full-width` (also when unset) spans the width.
|
|
44
|
-
| `padding?` | `'none' \| 'mobile' \| 'always'` | — | In the preset: `always` pads at every breakpoint (`px-4` / `sm:px-6` / `lg:px-8`), `mobile` only below `sm`, `none` not at all.
|
|
45
|
-
| `narrow?` | `boolean` | — |
|
|
41
|
+
| Field | Type | Default | Description |
|
|
42
|
+
| ---------- | ---------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `mode?` | `'full-width' \| 'constrained' \| 'container'` | — | The standard writes it to `data-mode`. In the preset: `container` centres at `max-w-7xl`, `constrained` at `max-w-5xl`, `full-width` (also when unset) spans the width. |
|
|
44
|
+
| `padding?` | `'none' \| 'mobile' \| 'always'` | — | The standard writes it to `data-padding`. In the preset: `always` pads at every breakpoint (`px-4` / `sm:px-6` / `lg:px-8`), `mobile` only below `sm`, `none` not at all. |
|
|
45
|
+
| `narrow?` | `boolean` | — | Preset only (the standard ignores it): centres at `max-w-3xl`, whatever the mode. |
|
|
46
46
|
|
|
47
47
|
## Usage
|
|
48
48
|
|
|
@@ -88,7 +88,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
`SmartContainerPreset` is the styled (preset) implementation: register it
|
|
91
|
+
`SmartContainerPreset` is the styled (preset) implementation: register it under the `'container'` key of `SmartProvider`'s `components`, render it directly in place of `SmartContainer`, 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.
|
|
92
92
|
|
|
93
93
|
```tsx
|
|
94
94
|
import { SmartContainerProps } from '@smartsoft001/react';
|
|
@@ -118,7 +118,7 @@ export function DateFields() {
|
|
|
118
118
|
|
|
119
119
|
## Replacing the Implementation
|
|
120
120
|
|
|
121
|
-
`SmartDateEdit` has no `SmartProvider` registry key: the `variant` prop picks `SmartDateEditStandard` or `SmartDateEditPreset`, and both can be rendered directly with `SmartDateEditVariantProps`. A form's `date` / `dateWithEdit` fields render it through the input field components (see `react-components-input`). For another look, write a component on `useDateEdit` and render it in place of `SmartDateEdit`.
|
|
121
|
+
`SmartDateEdit` has no `SmartProvider` registry key: the `variant` prop picks `SmartDateEditStandard` or `SmartDateEditPreset`, and both can be rendered directly with `SmartDateEditVariantProps`. `SMART_PRESET_COMPONENTS` therefore does not change it; set `variant="preset"` where the calendar popover should render. A form's `date` / `dateWithEdit` fields render it through the input field components (see `react-components-input`). For another look, write a component on `useDateEdit` and render it in place of `SmartDateEdit`.
|
|
122
122
|
|
|
123
123
|
### The `useDateEdit` hook
|
|
124
124
|
|
|
@@ -12,7 +12,7 @@ user-invocable: false
|
|
|
12
12
|
|
|
13
13
|
- Filtering by a period (from / to) or entering a stay, a contract term, a report range
|
|
14
14
|
- Binding a range to a `SmartFormControl`
|
|
15
|
-
- Using the modal's quick picks (today, last 7 days, this month...) or restricting the range length
|
|
15
|
+
- Using the modal's quick picks (today, last 7 days, this month...) or restricting the range length, by rendering `SmartDateRangeModalStandard` yourself (`SmartDateRange` does not show them)
|
|
16
16
|
- Building a range picker of your own on `useDateRange` / `useDateRangeModal`
|
|
17
17
|
|
|
18
18
|
## Exports
|
|
@@ -54,12 +54,12 @@ Props of the date-range variants: the range as a controlled `value` + `onValueCh
|
|
|
54
54
|
|
|
55
55
|
### `SmartDateRangeModalProps`
|
|
56
56
|
|
|
57
|
-
Props of the date-range modal (`SmartDateRangeModalStandard`).
|
|
57
|
+
Props of the date-range modal (`SmartDateRangeModalStandard`). `SmartDateRange` renders the modal with none of them but `previousState`, `onApply` and `onDismiss`, so `showFilterBtns` and `restrictSelectionTo` only take effect when you render the modal yourself, e.g. `<SmartDateRangeModalStandard showFilterBtns ... />` in a picker built on `useDateRange`.
|
|
58
58
|
|
|
59
59
|
| Prop | Type | Default | Description |
|
|
60
60
|
| ---------------------- | -------------------------------- | ------- | ---------------------------------------------------------------------------- |
|
|
61
|
-
| `showFilterBtns?` | `boolean` | `false` | Shows the quick-pick buttons (today, last 7 days, ...).
|
|
62
|
-
| `restrictSelectionTo?` | `number` | `0` | When set, only a range of exactly this many days can be applied.
|
|
61
|
+
| `showFilterBtns?` | `boolean` | `false` | Shows the quick-pick buttons (today, last 7 days, ...). Modal only. |
|
|
62
|
+
| `restrictSelectionTo?` | `number` | `0` | When set, only a range of exactly this many days can be applied. Modal only. |
|
|
63
63
|
| `previousState?` | `CalendarState` | — | The state the modal opens with; without `dateFrom` it selects today. |
|
|
64
64
|
| `onApply?` | `(state: CalendarState) => void` | — | Called with the picked state when the user applies. |
|
|
65
65
|
| `onDismiss?` | `() => void` | — | Called when the modal is closed without applying (backdrop or close button). |
|
|
@@ -104,7 +104,7 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
`SmartDescriptionListPreset` is the styled (preset) implementation: register it
|
|
107
|
+
`SmartDescriptionListPreset` is the styled (preset) implementation: register it under the `'description-list'` key of `SmartProvider`'s `components`, render it directly in place of `SmartDescriptionList`, 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.
|
|
108
108
|
|
|
109
109
|
```tsx
|
|
110
110
|
import { SmartDescriptionListProps } from '@smartsoft001/react';
|
|
@@ -19,24 +19,33 @@ user-invocable: false
|
|
|
19
19
|
|
|
20
20
|
All from `@smartsoft001/react`.
|
|
21
21
|
|
|
22
|
-
| Export
|
|
23
|
-
|
|
|
24
|
-
| `SmartDetail`
|
|
25
|
-
| `SmartDetailText`
|
|
26
|
-
| `useDetail`
|
|
27
|
-
| `useDetailCellValue`
|
|
28
|
-
| `getDefaultDetailFieldComponents`
|
|
29
|
-
| `DETAIL_PRESET_FIELD_COMPONENTS`
|
|
22
|
+
| Export | Kind | What it is |
|
|
23
|
+
| ----------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `SmartDetail` | component | The label of a field and its value, rendered by the detail component of the field type, with the field's info tooltip and a skeleton while there is no item yet. |
|
|
25
|
+
| `SmartDetailText` | component | The text detail: the value of the field, or what `options.cellPipe` makes of it, rendered as HTML. |
|
|
26
|
+
| `useDetail` | hook | What every detail field shares: the item, the key of the field and its value, unwrapped from `options`. |
|
|
27
|
+
| `useDetailCellValue` | hook | The value a text-like detail renders: the list cell of `key` in `item`, the cell pipe's result (or the raw value), translated when it is a string. |
|
|
28
|
+
| `getDefaultDetailFieldComponents` | function | The library's detail component of every `FieldType` that has one. |
|
|
29
|
+
| `DETAIL_PRESET_FIELD_COMPONENTS` | const | The preset detail components, keyed by `FieldType`. |
|
|
30
|
+
| `SmartDetail<Type>` / `SmartDetail<Type>Preset` | component | The standard and preset detail component of each field type (see Field types below), e.g. `SmartDetailEmail`, `SmartDetailEmailPreset`. |
|
|
31
|
+
| `useDetailAddress` | hook | The address of an `address` field (`null` without one) and its `building[/flat]` part. |
|
|
32
|
+
| `useDetailArray` | hook | `childOptions`: the `SmartDetails` options of each element of an `array` field, typed by the element's class. |
|
|
33
|
+
| `useDetailAttachment` | hook | `fileName` (`fileName` or `name` of the file, `null` without either) and `download()`, which opens the file through the file service. |
|
|
34
|
+
| `useDetailEnum` | hook | `values`: the value of an `enum` field, or each of its values when it is an array, as strings. |
|
|
35
|
+
| `useDetailImage` | hook | `imageUrl`: the file service URL of the file in an `image` field, `null` without one. |
|
|
36
|
+
| `useDetailObject` | hook | `childOptions`: the `SmartDetails` options of the nested object of an `object` field, `null` without one. |
|
|
37
|
+
| `useDetailPdf` | hook | `fileName` and `show()`, which opens the PDF through the file service. |
|
|
38
|
+
| `useDetailVideo` | hook | `url`: the file service URL of the video in the field, `null` without one. |
|
|
30
39
|
|
|
31
40
|
## Props and Types
|
|
32
41
|
|
|
33
42
|
### `SmartDetailProps<T = any>`
|
|
34
43
|
|
|
35
|
-
| Prop | Type | Default | Description
|
|
36
|
-
| ------------ | -------------------------------- | -------- |
|
|
37
|
-
| `options` | `IDetailOptions<T> \| undefined` | required | The field to show: key, item, field options
|
|
38
|
-
| `type` | `any` | required | The model class, for the label (`useModelLabel`).
|
|
39
|
-
| `className?` | `string` | — | Forwarded to the field component.
|
|
44
|
+
| Prop | Type | Default | Description |
|
|
45
|
+
| ------------ | -------------------------------- | -------- | ---------------------------------------------------------- |
|
|
46
|
+
| `options` | `IDetailOptions<T> \| undefined` | required | The field to show: key, item, field options and cell pipe. |
|
|
47
|
+
| `type` | `any` | required | The model class, for the label (`useModelLabel`). |
|
|
48
|
+
| `className?` | `string` | — | Forwarded to the field component. |
|
|
40
49
|
|
|
41
50
|
### `SmartDetailFieldProps<T = any>`
|
|
42
51
|
|
|
@@ -54,8 +63,8 @@ The props of every detail field component: `options` and `className`.
|
|
|
54
63
|
| `key` | `string` | required | The field key. |
|
|
55
64
|
| `item?` | `T \| null` | — | The record; `null` / `undefined` shows a skeleton. |
|
|
56
65
|
| `options` | `IFieldOptions` | required | The field's `@Field` options (`getModelFieldOptions(instance, key)`, or the `options` of `getModelFieldsWithOptions`). |
|
|
57
|
-
| `cellPipe?` | `ICellPipe<T>` | — | Formats the value
|
|
58
|
-
| `loading?` | `boolean` | — |
|
|
66
|
+
| `cellPipe?` | `ICellPipe<T>` | — | Formats the value; read by the `text` and `phoneNumberPl` details (standard and preset). |
|
|
67
|
+
| `loading?` | `boolean` | — | Not read by the built-in implementations; available to a custom implementation (`useDetail` returns it). |
|
|
59
68
|
|
|
60
69
|
### `ICellPipe<T>`
|
|
61
70
|
|
|
@@ -152,7 +161,7 @@ export function InvoiceSummary({ invoice }: { invoice: Invoice | null }) {
|
|
|
152
161
|
|
|
153
162
|
## Replacing the Implementation
|
|
154
163
|
|
|
155
|
-
`SmartDetail` has no single registry key: its field components come from `detailFieldComponents` on `SmartProvider`, merged over the library's map. Register the preset set, or a component of your own for one type
|
|
164
|
+
`SmartDetail` has no single registry key: its field components come from `detailFieldComponents` on `SmartProvider`, merged over the library's map. Register the preset set, or a component of your own for one type.
|
|
156
165
|
|
|
157
166
|
```tsx
|
|
158
167
|
import type { ReactNode } from 'react';
|
|
@@ -40,24 +40,24 @@ 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`
|
|
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'` adds the `smart-modal-bottom` class to the modal. |
|
|
48
48
|
|
|
49
49
|
### `IDetailsOptions<T extends IEntity<string>>`
|
|
50
50
|
|
|
51
|
-
| Field | Type | Default | Description
|
|
52
|
-
| --------------------- | -------------------------------- | -------- |
|
|
53
|
-
| `title?` | `string` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` uses it as a page title.
|
|
54
|
-
| `cellPipe?` | `ICellPipe<T>` | — | Formats the values of text-like fields (see `react-components-detail`).
|
|
55
|
-
| `type` | `any` | required | The `@Model` class whose `details` fields are shown.
|
|
56
|
-
| `item` | `T \| null \| undefined` | required | The record (a plain API object is converted to `type`); without one the fields show skeletons.
|
|
57
|
-
| `loading?` | `boolean` | — | Passed to every
|
|
58
|
-
| `itemHandler?` | `((id: string) => void) \| null` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` turns it into a "go to item" button.
|
|
59
|
-
| `removeHandler?` | `((item: T) => void) \| null` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` turns it into a remove button.
|
|
60
|
-
| `componentFactories?` | `IDetailsComponentFactories<T>` | — | Components rendered above (`top`) and below (`bottom`) the fields.
|
|
51
|
+
| Field | Type | Default | Description |
|
|
52
|
+
| --------------------- | -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `title?` | `string` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` uses it as a page title. |
|
|
54
|
+
| `cellPipe?` | `ICellPipe<T>` | — | Formats the values of text-like fields (see `react-components-detail`). |
|
|
55
|
+
| `type` | `any` | required | The `@Model` class whose `details` fields are shown. |
|
|
56
|
+
| `item` | `T \| null \| undefined` | required | The record (a plain API object is converted to `type`); without one the fields show skeletons. |
|
|
57
|
+
| `loading?` | `boolean` | — | Passed to every `SmartDetail`; not read by the built-in implementations; available to a custom implementation. |
|
|
58
|
+
| `itemHandler?` | `((id: string) => void) \| null` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` turns it into a "go to item" button. |
|
|
59
|
+
| `removeHandler?` | `((item: T) => void) \| null` | — | Not rendered by `SmartDetails`; `useDetailsPageOptions` turns it into a remove button. |
|
|
60
|
+
| `componentFactories?` | `IDetailsComponentFactories<T>` | — | Components rendered above (`top`) and below (`bottom`) the fields. |
|
|
61
61
|
|
|
62
62
|
### `UseDetailsModalCallbacks`
|
|
63
63
|
|
|
@@ -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
|
|