@smartsoft001/claude-plugins 2.193.0 → 2.195.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/.claude-plugin/marketplace.json +14 -3
  2. package/README.md +19 -4
  3. package/package.json +3 -3
  4. package/plugins/smart-angular/.claude-plugin/plugin.json +6 -0
  5. package/plugins/{smart → smart-angular}/skills/angular-components-button/SKILL.md +1 -1
  6. package/plugins/{smart → smart-angular}/skills/angular-components-container/SKILL.md +8 -8
  7. package/plugins/{smart → smart-angular}/skills/angular-components-drawer/SKILL.md +5 -9
  8. package/plugins/{smart → smart-angular}/skills/angular-components-list-container/SKILL.md +2 -5
  9. package/plugins/{smart → smart-angular}/skills/angular-components-media-object/SKILL.md +1 -1
  10. package/plugins/{smart → smart-angular}/skills/angular-components-modal/SKILL.md +1 -1
  11. package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/SKILL.md +1 -1
  12. package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-claude-config.md +13 -9
  13. package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/patch-delta.md +1 -1
  14. package/plugins/{smart → smart-core}/.claude-plugin/README.md +31 -16
  15. package/plugins/{smart → smart-core}/.claude-plugin/merge-permissions.js +7 -6
  16. package/plugins/smart-core/.claude-plugin/plugin.json +5 -0
  17. package/plugins/{smart → smart-core}/.claude-plugin/settings.template.json +2 -2
  18. package/plugins/{smart → smart-core}/hooks/README.md +1 -1
  19. package/plugins/{smart → smart-core}/skills/audit-log/SKILL.md +2 -2
  20. package/plugins/{smart → smart-core}/skills/format-code/SKILL.md +1 -1
  21. package/plugins/smart-react/.claude-plugin/plugin.json +6 -0
  22. package/plugins/smart-react/agents/react-components.md +260 -0
  23. package/plugins/smart-react/skills/react-components-accordion/SKILL.md +204 -0
  24. package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +191 -0
  25. package/plugins/smart-react/skills/react-components-alert/SKILL.md +244 -0
  26. package/plugins/smart-react/skills/react-components-app/SKILL.md +236 -0
  27. package/plugins/smart-react/skills/react-components-avatar/SKILL.md +176 -0
  28. package/plugins/smart-react/skills/react-components-badge/SKILL.md +165 -0
  29. package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +183 -0
  30. package/plugins/smart-react/skills/react-components-button/SKILL.md +239 -0
  31. package/plugins/smart-react/skills/react-components-button-group/SKILL.md +187 -0
  32. package/plugins/smart-react/skills/react-components-calendar/SKILL.md +270 -0
  33. package/plugins/smart-react/skills/react-components-card/SKILL.md +201 -0
  34. package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +133 -0
  35. package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +228 -0
  36. package/plugins/smart-react/skills/react-components-container/SKILL.md +134 -0
  37. package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +186 -0
  38. package/plugins/smart-react/skills/react-components-date-range/SKILL.md +259 -0
  39. package/plugins/smart-react/skills/react-components-description-list/SKILL.md +144 -0
  40. package/plugins/smart-react/skills/react-components-detail/SKILL.md +272 -0
  41. package/plugins/smart-react/skills/react-components-details/SKILL.md +250 -0
  42. package/plugins/smart-react/skills/react-components-divider/SKILL.md +128 -0
  43. package/plugins/smart-react/skills/react-components-drawer/SKILL.md +165 -0
  44. package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +194 -0
  45. package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +202 -0
  46. package/plugins/smart-react/skills/react-components-export/SKILL.md +120 -0
  47. package/plugins/smart-react/skills/react-components-feed/SKILL.md +171 -0
  48. package/plugins/smart-react/skills/react-components-form/SKILL.md +319 -0
  49. package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +172 -0
  50. package/plugins/smart-react/skills/react-components-icon/SKILL.md +117 -0
  51. package/plugins/smart-react/skills/react-components-import/SKILL.md +113 -0
  52. package/plugins/smart-react/skills/react-components-info/SKILL.md +147 -0
  53. package/plugins/smart-react/skills/react-components-input/SKILL.md +406 -0
  54. package/plugins/smart-react/skills/react-components-list/SKILL.md +384 -0
  55. package/plugins/smart-react/skills/react-components-list-container/SKILL.md +105 -0
  56. package/plugins/smart-react/skills/react-components-loader/SKILL.md +126 -0
  57. package/plugins/smart-react/skills/react-components-media-object/SKILL.md +130 -0
  58. package/plugins/smart-react/skills/react-components-modal/SKILL.md +266 -0
  59. package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +155 -0
  60. package/plugins/smart-react/skills/react-components-navbar/SKILL.md +211 -0
  61. package/plugins/smart-react/skills/react-components-notification/SKILL.md +223 -0
  62. package/plugins/smart-react/skills/react-components-overlays/SKILL.md +182 -0
  63. package/plugins/smart-react/skills/react-components-page/SKILL.md +224 -0
  64. package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +155 -0
  65. package/plugins/smart-react/skills/react-components-paging/SKILL.md +183 -0
  66. package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +149 -0
  67. package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +195 -0
  68. package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +150 -0
  69. package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +138 -0
  70. package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +168 -0
  71. package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +155 -0
  72. package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +277 -0
  73. package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +228 -0
  74. package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +146 -0
  75. package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +156 -0
  76. package/plugins/smart-react/skills/react-components-stats/SKILL.md +149 -0
  77. package/plugins/smart-react/skills/react-components-table/SKILL.md +222 -0
  78. package/plugins/smart-react/skills/react-components-tabs/SKILL.md +189 -0
  79. package/plugins/smart-react/skills/react-components-textarea/SKILL.md +202 -0
  80. package/plugins/smart-react/skills/react-components-toggle/SKILL.md +157 -0
  81. package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +212 -0
  82. package/plugins/smart-react/skills/react-forms/SKILL.md +272 -0
  83. package/plugins/smart-react/skills/react-provider/SKILL.md +368 -0
  84. package/plugins/smart-react/skills/smart-crud-react/SKILL.md +410 -0
  85. package/plugins/smart/.claude-plugin/plugin.json +0 -5
  86. /package/plugins/{smart/agents/angular-components/AGENT.md → smart-angular/agents/angular-components.md} +0 -0
  87. /package/plugins/{smart → smart-angular}/skills/angular-components-accordion/SKILL.md +0 -0
  88. /package/plugins/{smart → smart-angular}/skills/angular-components-action-panel/SKILL.md +0 -0
  89. /package/plugins/{smart → smart-angular}/skills/angular-components-alert/SKILL.md +0 -0
  90. /package/plugins/{smart → smart-angular}/skills/angular-components-avatar/SKILL.md +0 -0
  91. /package/plugins/{smart → smart-angular}/skills/angular-components-badge/SKILL.md +0 -0
  92. /package/plugins/{smart → smart-angular}/skills/angular-components-breadcrumbs/SKILL.md +0 -0
  93. /package/plugins/{smart → smart-angular}/skills/angular-components-button-group/SKILL.md +0 -0
  94. /package/plugins/{smart → smart-angular}/skills/angular-components-calendar/SKILL.md +0 -0
  95. /package/plugins/{smart → smart-angular}/skills/angular-components-card/SKILL.md +0 -0
  96. /package/plugins/{smart → smart-angular}/skills/angular-components-card-heading/SKILL.md +0 -0
  97. /package/plugins/{smart → smart-angular}/skills/angular-components-command-palette/SKILL.md +0 -0
  98. /package/plugins/{smart → smart-angular}/skills/angular-components-date-edit/SKILL.md +0 -0
  99. /package/plugins/{smart → smart-angular}/skills/angular-components-date-range/SKILL.md +0 -0
  100. /package/plugins/{smart → smart-angular}/skills/angular-components-description-list/SKILL.md +0 -0
  101. /package/plugins/{smart → smart-angular}/skills/angular-components-detail/SKILL.md +0 -0
  102. /package/plugins/{smart → smart-angular}/skills/angular-components-details/SKILL.md +0 -0
  103. /package/plugins/{smart → smart-angular}/skills/angular-components-divider/SKILL.md +0 -0
  104. /package/plugins/{smart → smart-angular}/skills/angular-components-dropdown/SKILL.md +0 -0
  105. /package/plugins/{smart → smart-angular}/skills/angular-components-empty-state/SKILL.md +0 -0
  106. /package/plugins/{smart → smart-angular}/skills/angular-components-feed/SKILL.md +0 -0
  107. /package/plugins/{smart → smart-angular}/skills/angular-components-form/SKILL.md +0 -0
  108. /package/plugins/{smart → smart-angular}/skills/angular-components-grid-list/SKILL.md +0 -0
  109. /package/plugins/{smart → smart-angular}/skills/angular-components-icon/SKILL.md +0 -0
  110. /package/plugins/{smart → smart-angular}/skills/angular-components-info/SKILL.md +0 -0
  111. /package/plugins/{smart → smart-angular}/skills/angular-components-input/SKILL.md +0 -0
  112. /package/plugins/{smart → smart-angular}/skills/angular-components-list/SKILL.md +0 -0
  113. /package/plugins/{smart → smart-angular}/skills/angular-components-multi-column-layout/SKILL.md +0 -0
  114. /package/plugins/{smart → smart-angular}/skills/angular-components-navbar/SKILL.md +0 -0
  115. /package/plugins/{smart → smart-angular}/skills/angular-components-notification/SKILL.md +0 -0
  116. /package/plugins/{smart → smart-angular}/skills/angular-components-page/SKILL.md +0 -0
  117. /package/plugins/{smart → smart-angular}/skills/angular-components-page-heading/SKILL.md +0 -0
  118. /package/plugins/{smart → smart-angular}/skills/angular-components-paging/SKILL.md +0 -0
  119. /package/plugins/{smart → smart-angular}/skills/angular-components-password-strength/SKILL.md +0 -0
  120. /package/plugins/{smart → smart-angular}/skills/angular-components-progress-bars/SKILL.md +0 -0
  121. /package/plugins/{smart → smart-angular}/skills/angular-components-searchbar/SKILL.md +0 -0
  122. /package/plugins/{smart → smart-angular}/skills/angular-components-section-heading/SKILL.md +0 -0
  123. /package/plugins/{smart → smart-angular}/skills/angular-components-select-menu/SKILL.md +0 -0
  124. /package/plugins/{smart → smart-angular}/skills/angular-components-sidebar-layout/SKILL.md +0 -0
  125. /package/plugins/{smart → smart-angular}/skills/angular-components-sidebar-navigation/SKILL.md +0 -0
  126. /package/plugins/{smart → smart-angular}/skills/angular-components-sign-in-form/SKILL.md +0 -0
  127. /package/plugins/{smart → smart-angular}/skills/angular-components-stacked-layout/SKILL.md +0 -0
  128. /package/plugins/{smart → smart-angular}/skills/angular-components-stacked-list/SKILL.md +0 -0
  129. /package/plugins/{smart → smart-angular}/skills/angular-components-stats/SKILL.md +0 -0
  130. /package/plugins/{smart → smart-angular}/skills/angular-components-table/SKILL.md +0 -0
  131. /package/plugins/{smart → smart-angular}/skills/angular-components-tabs/SKILL.md +0 -0
  132. /package/plugins/{smart → smart-angular}/skills/angular-components-textarea/SKILL.md +0 -0
  133. /package/plugins/{smart → smart-angular}/skills/angular-components-toggle/SKILL.md +0 -0
  134. /package/plugins/{smart → smart-angular}/skills/angular-components-vertical-navigation/SKILL.md +0 -0
  135. /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-app.md +0 -0
  136. /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-shared-lib.md +0 -0
  137. /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/version-resolution.md +0 -0
  138. /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/scripts/derive-prefix.sh +0 -0
  139. /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/scripts/verify-scaffold.sh +0 -0
  140. /package/plugins/{smart → smart-angular}/skills/smart-crud/SKILL.md +0 -0
  141. /package/plugins/{smart → smart-core}/hooks/CONFIG.md +0 -0
  142. /package/plugins/{smart → smart-core}/hooks/audit_logger.py +0 -0
  143. /package/plugins/{smart → smart-core}/hooks/auto_format.sh +0 -0
  144. /package/plugins/{smart → smart-core}/hooks/hooks.json +0 -0
  145. /package/plugins/{smart → smart-core}/hooks/safety_validator.py +0 -0
  146. /package/plugins/{smart → smart-core}/hooks/sensitive_file_blocker.py +0 -0
  147. /package/plugins/{smart → smart-core}/hooks/skill_validator.py +0 -0
  148. /package/plugins/{smart → smart-core}/skills/project-conventions/SKILL.md +0 -0
  149. /package/plugins/{smart → smart-core}/skills/safety-check/SKILL.md +0 -0
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: react-components-app
3
+ description: SmartApp React component API (@smartsoft001/react) — the application shell (IAppOptions with provider, logo, menu items, style), the 'app' registry key and the useApp hook that keeps the menu, document title, favicon and permission classes for a shell of your own.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # App (`SmartApp`)
8
+
9
+ `SmartApp` is the application shell. It takes an `IAppOptions` object (the signed-in user through `provider`, a `logo`, the `menu` items and a `style` map) and wraps `children`. The default `SmartAppStandard` renders **only a root element** running `useApp` (document title, menu items on the `MenuService`, CSS variables, permission classes, favicon): it draws no menu, logo or user. An application that wants a visible shell registers its own component under the `app` key, built on `useApp`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Wrapping the routes of a React application in the library's shell
14
+ - Putting the menu items on the `MenuService`, keeping the document title in sync with the URL, applying the style settings
15
+ - Rendering a navigation menu, the logo, the user name and a logout button (a shell of your own on `useApp`)
16
+ - Rendering the end panel (`MenuService.openEnd`) that CRUD filters and the multiselect panel open
17
+
18
+ ## Exports
19
+
20
+ All from `@smartsoft001/react`.
21
+
22
+ | Export | Kind | What it is |
23
+ | ------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `SmartApp` | component | The application shell: renders the implementation registered as `components.app` on `SmartProvider`, `SmartAppStandard` by default. |
25
+ | `SmartAppStandard` | component | The default application shell: only a root element running `useApp` (title, menu items, style, permission classes, favicon) around `children`. |
26
+ | `useApp` | hook | The logic of an application shell: - puts `options.menu.items` on the `MenuService` and returns its items (none without `options.menu`) and `showMenu` (logged in or `menu.showForAnonymous`, unless the menu service is disabled); - returns `logged`, `username` and `logo`, and `logout()` from `options.provider`; - keeps `selectedPath` on the current URL and the document title on it (`AppService.initTitle()` once, then `updateTitle(url)` for the current URL and after every navigation); - writes `options.style` on the root element (`StyleService`), adds the `auth-permissions-<permission>` classes of a logged user to it and sets `logo` on the `#app-favicon` link. |
27
+
28
+ ## Props and Types
29
+
30
+ ### `SmartAppProps`
31
+
32
+ | Prop | Type | Default | Description |
33
+ | ------------ | ------------- | -------- | ---------------------------- |
34
+ | `options` | `IAppOptions` | required | The shell configuration. |
35
+ | `className?` | `string` | — | Classes of the root element. |
36
+ | `children?` | `ReactNode` | — | The application content. |
37
+
38
+ ### `IAppOptions`
39
+
40
+ | Field | Type | Default | Description |
41
+ | ---------- | ------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------- |
42
+ | `provider` | `IAppProvider` | required | The signed-in user: `logged`, `username`, `logout()`. |
43
+ | `logo?` | `string` | — | Logo URL; also set as the `href` of the `#app-favicon` link. |
44
+ | `menu?` | `{ showForAnonymous?: boolean; items?: IMenuItem[]; }` | — | The menu: `items`, and `showForAnonymous` to show it before sign-in. |
45
+ | `style?` | `IStyle` | — | Style settings written as CSS custom properties on the root element (`StyleService`). |
46
+
47
+ ### `IAppProvider`
48
+
49
+ What the app shell needs to know about the signed-in user.
50
+
51
+ | Field | Type | Default | Description |
52
+ | ---------- | ------------ | -------- | --------------------------------------- |
53
+ | `logged` | `boolean` | required | Whether a user is signed in. |
54
+ | `username` | `string` | required | Shown by a shell that renders the user. |
55
+ | `logout` | `() => void` | required | Called by the shell's logout action. |
56
+
57
+ ### `IMenuItem`
58
+
59
+ | Field | Type | Default | Description |
60
+ | ------------ | --------------------------- | ------- | ------------------------------------------------------------------- |
61
+ | `mode?` | `'divider' \| 'default'` | — | `'divider'` renders a separator instead of an entry. |
62
+ | `route?` | `string` | — | The URL the entry navigates to; `selectedPath` is compared with it. |
63
+ | `click?` | `(arg0: IMenuItem) => void` | — | Called instead of navigating. |
64
+ | `caption?` | `string` | — | Label (a translation key or text). |
65
+ | `component?` | `any` | — | A component rendered for the entry. |
66
+ | `icon?` | `string` | — | Icon name for a shell that renders icons. |
67
+ | `infos?` | `Array<{ text: string }>` | — | Small badges or notes next to the entry. |
68
+
69
+ ### Related types
70
+
71
+ - `IStyle`: `Record<string, string \| undefined>` — Style settings (colour, font, button metrics, breakpoints), keyed by setting name.
72
+
73
+ ## The end menu
74
+
75
+ CRUD screens open their filters and multiselect panel with `MenuService.openEnd({ component, props })`. `MenuService` only keeps that request in its `endContent` store and `SmartAppStandard` renders no menu, so a shell that wants those panels renders `endContent` itself (as in the custom shell below) and closes it with `useMenuService().closeEnd()`.
76
+
77
+ ## Usage
78
+
79
+ ```tsx
80
+ import type { ReactNode } from 'react';
81
+
82
+ import { IAppOptions, SmartApp } from '@smartsoft001/react';
83
+
84
+ const options: IAppOptions = {
85
+ provider: {
86
+ logged: true,
87
+ username: 'anna',
88
+ logout: () => window.location.assign('/login'),
89
+ },
90
+ logo: '/logo.svg',
91
+ menu: {
92
+ items: [
93
+ { route: '/notes', caption: 'Notes' },
94
+ { mode: 'divider' },
95
+ { route: '/settings', caption: 'Settings' },
96
+ ],
97
+ },
98
+ };
99
+
100
+ export function Shell({ children }: { children: ReactNode }) {
101
+ return <SmartApp options={options}>{children}</SmartApp>;
102
+ }
103
+ ```
104
+
105
+ In a real application `provider` is built from the auth state (e.g. `useAuthService().isAuthenticated()`), and memoised.
106
+
107
+ ## Replacing the Implementation
108
+
109
+ `SmartApp` renders the component registered under the `'app'` key of `SmartProvider`'s `components`, and `SmartAppStandard` when nothing is registered there. Every `SmartApp` below the provider then renders the registered component, which receives the same props.
110
+
111
+ There is no preset for this component: register a component of your own that takes `SmartAppProps`, as shown below, as `components={{ app: MyApp }}`. Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
112
+
113
+ ### The `useApp` hook
114
+
115
+ The logic of an application shell:
116
+
117
+ - puts `options.menu.items` on the `MenuService` and returns its items (none without `options.menu`) and `showMenu` (logged in or `menu.showForAnonymous`, unless the menu service is disabled);
118
+ - returns `logged`, `username` and `logo`, and `logout()` from `options.provider`;
119
+ - keeps `selectedPath` on the current URL and the document title on it (`AppService.initTitle()` once, then `updateTitle(url)` for the current URL and after every navigation);
120
+ - writes `options.style` on the root element (`StyleService`), adds the `auth-permissions-<permission>` classes of a logged user to it and sets `logo` on the `#app-favicon` link. Attach `rootRef` to the shell's root element. `endContent` is what `MenuService.openEnd` asked to show in the end menu.
121
+
122
+ ```ts
123
+ function useApp({ options, className }: SmartAppProps);
124
+ ```
125
+
126
+ | Returns | Type | Description |
127
+ | -------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------- |
128
+ | `rootRef` | `RefObject<HTMLDivElement \| null>` | Attach to the shell's root element: the style, permission classes and favicon are applied through it. |
129
+ | `selectedPath` | `string` | The current URL (path + query), updated on every navigation. |
130
+ | `showMenu` | `boolean` | `true` when logged in or `menu.showForAnonymous`, unless the `MenuService` is disabled. |
131
+ | `menuItems` | `IMenuItem[]` | The items of the `MenuService` (set from `options.menu.items`). |
132
+ | `logged` | `boolean` | `options.provider.logged`. |
133
+ | `username` | `string` | `options.provider.username`. |
134
+ | `logo` | `string \| undefined` | `options.logo`. |
135
+ | `endContent` | `IMenuEndContent \| null` | What `MenuService.openEnd` asked the end menu to show (`{ component, props }`), or `null`. |
136
+ | `logout` | `() => void` | Calls `options.provider.logout()`. |
137
+
138
+ ```tsx
139
+ import type { ReactNode } from 'react';
140
+
141
+ import {
142
+ SmartAppProps,
143
+ SmartProvider,
144
+ useApp,
145
+ useMenuService,
146
+ useNavigation,
147
+ } from '@smartsoft001/react';
148
+
149
+ export function AppShell(props: SmartAppProps) {
150
+ const {
151
+ rootRef,
152
+ showMenu,
153
+ menuItems,
154
+ selectedPath,
155
+ logged,
156
+ username,
157
+ logo,
158
+ endContent,
159
+ logout,
160
+ } = useApp(props);
161
+ const navigation = useNavigation();
162
+ const menu = useMenuService();
163
+ const End = endContent?.component;
164
+
165
+ return (
166
+ <div ref={rootRef} className={props.className}>
167
+ <header className="flex items-center gap-4">
168
+ {logo && <img src={logo} alt="" className="h-8" />}
169
+ {logged && (
170
+ <>
171
+ <span>{username}</span>
172
+ <button type="button" onClick={logout}>
173
+ Log out
174
+ </button>
175
+ </>
176
+ )}
177
+ </header>
178
+ {showMenu && (
179
+ <nav>
180
+ {menuItems.map((item, index) =>
181
+ item.mode === 'divider' ? (
182
+ <hr key={index} />
183
+ ) : (
184
+ <a
185
+ key={item.route ?? index}
186
+ href={item.route}
187
+ aria-current={
188
+ item.route && selectedPath.startsWith(item.route)
189
+ ? 'page'
190
+ : undefined
191
+ }
192
+ onClick={(event) => {
193
+ event.preventDefault();
194
+ if (item.click) item.click(item);
195
+ else if (item.route) navigation.navigate(item.route);
196
+ }}
197
+ >
198
+ {item.caption}
199
+ </a>
200
+ ),
201
+ )}
202
+ </nav>
203
+ )}
204
+ <main>{props.children}</main>
205
+ {End && (
206
+ <aside>
207
+ <button type="button" onClick={() => void menu.closeEnd()}>
208
+ Close
209
+ </button>
210
+ <End {...(endContent?.props ?? {})} />
211
+ </aside>
212
+ )}
213
+ </div>
214
+ );
215
+ }
216
+
217
+ const components = { app: AppShell };
218
+
219
+ export function Root({ children }: { children: ReactNode }) {
220
+ return <SmartProvider components={components}>{children}</SmartProvider>;
221
+ }
222
+ ```
223
+
224
+ ## Styling
225
+
226
+ - `className` goes on the root element.
227
+ - `options.style` is written as CSS custom properties on the root element; a logged user's permissions are added to it as `auth-permissions-<permission>` classes, so CSS can show or hide parts per permission.
228
+
229
+ ## File Locations
230
+
231
+ Source: `packages/shared/react/src/lib/components/app/` in the smartsoft001 repository.
232
+
233
+ - `app.tsx`: `SmartApp`
234
+ - `app.types.ts`: `SmartAppProps`
235
+ - `standard/app-standard.tsx`: `SmartAppStandard`
236
+ - `use-app.ts`: `useApp`
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: react-components-avatar
3
+ description: SmartAvatar React component API (@smartsoft001/react) — user picture with image/initials/icon placeholder, sizes, circle/rounded shapes, status dot and stacked groups, the 'avatar' registry key, SmartAvatarPreset and useAvatar.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Avatar (`SmartAvatar`)
8
+
9
+ `SmartAvatar` shows a user picture: an image (`imageUrl`), initials, or a placeholder, in five sizes and two shapes, with an optional status dot in a corner (`notificationPosition`). With a non-empty `group` it renders a stack of avatars instead. `SmartAvatarStandard` (the default) is **unstyled markup** that exposes `size`, `shape`, the placeholder type and the stack direction as `data-*` attributes for your own CSS; the styled look comes from `SmartAvatarPreset`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Showing a user's picture or initials in a list, header or comment
14
+ - Showing a stacked group of participants (`group`)
15
+ - Adding an online/notification dot (`notificationPosition`)
16
+ - Styling avatars through the preset or your own CSS on the `data-*` attributes
17
+
18
+ ## Exports
19
+
20
+ All from `@smartsoft001/react`.
21
+
22
+ | Export | Kind | What it is |
23
+ | --------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `SmartAvatar` | component | Renders the implementation registered as `components.avatar` on `SmartProvider`, `SmartAvatarStandard` by default. |
25
+ | `SmartAvatarPreset` | component | Styled avatar variation (preset). |
26
+ | `SmartAvatarStandard` | component | The default avatar rendering: unstyled markup exposing `size`, `shape`, `options.placeholderType` and, for a group, `options.stackDirection` as `data-*` attributes. |
27
+ | `useAvatar` | hook | The state every avatar variant shares: whether `group` holds avatars to stack. |
28
+
29
+ The preset's class helpers (`getAvatarImageClasses`, `getAvatarInitialsClasses`, `getAvatarIconWrapperClasses`, `getAvatarStatusClasses`, `getAvatarGroupContainerClasses`, `getAvatarGroupItemImageClasses`, `getAvatarGroupItemInitialsClasses`, `AVATAR_STATUS_WRAPPER`) are exported too, for a custom implementation that wants the preset look.
30
+
31
+ ## Props and Types
32
+
33
+ ### `SmartAvatarProps`
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'` | — | Corner of the status dot; no dot when unset. |
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
+
46
+ ### `IAvatarOptions`
47
+
48
+ | Field | Type | Default | Description |
49
+ | ------------------ | ------------------------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
+ | `placeholderType?` | `'icon' \| 'initials'` | `'icon'` | Fallback shown when there is no `imageUrl` (default `'icon'`). Initials are shown whenever `initials` is set; otherwise `SmartAvatarPreset` renders an SVG icon (`'icon'`) or an empty initials chip (`'initials'`), and `SmartAvatarStandard` renders a `·` placeholder. The standard also exposes the value as the `data-placeholder-type` attribute on its root element. |
51
+ | `stackDirection?` | `'top-to-bottom' \| 'bottom-to-top'` | `'top-to-bottom'` | Stacking order of a `group` (default `'top-to-bottom'`). Purely visual: styled by `SmartAvatarPreset` (`'bottom-to-top'` reverses the stack); `SmartAvatarStandard` exposes it as the `data-stack-direction` attribute on the group container. |
52
+
53
+ ### `IAvatarItem`
54
+
55
+ One avatar of a `group`.
56
+
57
+ | Field | Type | Default | Description |
58
+ | ----------- | -------- | -------- | ---------------------------------- |
59
+ | `id` | `string` | required | Key of the item. |
60
+ | `imageUrl?` | `string` | — | Picture URL. |
61
+ | `initials?` | `string` | — | Initials when there is no picture. |
62
+
63
+ ### Related types
64
+
65
+ - `SmartAvatarSize`: `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` — Size scale of the avatar.
66
+ - `SmartAvatarShape`: `'circle' \| 'rounded'` — `circle` or `rounded` (rounded square).
67
+
68
+ ## Usage
69
+
70
+ ```tsx
71
+ import { SmartAvatar, SmartAvatarPreset } from '@smartsoft001/react';
72
+
73
+ export function Participants() {
74
+ return (
75
+ <div className="flex items-center gap-6">
76
+ <SmartAvatarPreset
77
+ imageUrl="/avatars/anna.jpg"
78
+ size="lg"
79
+ notificationPosition="top"
80
+ />
81
+ <SmartAvatarPreset
82
+ initials="JK"
83
+ shape="rounded"
84
+ options={{ placeholderType: 'initials' }}
85
+ />
86
+ <SmartAvatarPreset
87
+ size="sm"
88
+ group={[
89
+ { id: '1', imageUrl: '/avatars/anna.jpg' },
90
+ { id: '2', initials: 'JK' },
91
+ { id: '3', initials: 'MN' },
92
+ ]}
93
+ options={{ stackDirection: 'bottom-to-top' }}
94
+ />
95
+ {/* Through the registry: the standard markup unless a preset is registered. */}
96
+ <SmartAvatar initials="AB" />
97
+ </div>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ## Replacing the Implementation
103
+
104
+ `SmartAvatar` renders the component registered under the `'avatar'` key of `SmartProvider`'s `components`, and `SmartAvatarStandard` when nothing is registered there. Every `SmartAvatar` below the provider then renders the registered component, which receives the same props.
105
+
106
+ ```tsx
107
+ import type { ReactNode } from 'react';
108
+
109
+ import { SmartProvider, SmartAvatarPreset } from '@smartsoft001/react';
110
+
111
+ // A module constant: a new object on every render would change the context.
112
+ const components = { avatar: SmartAvatarPreset };
113
+
114
+ export function AppProviders({ children }: { children: ReactNode }) {
115
+ return <SmartProvider components={components}>{children}</SmartProvider>;
116
+ }
117
+ ```
118
+
119
+ `SmartAvatarPreset` is the styled (preset) implementation: register it as above, 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
+
121
+ ### The `useAvatar` hook
122
+
123
+ The state every avatar variant shares: whether `group` holds avatars to stack.
124
+
125
+ ```ts
126
+ function useAvatar({ group }: Pick<SmartAvatarProps, 'group'>);
127
+ ```
128
+
129
+ | Returns | Type | Description |
130
+ | --------- | --------- | ------------------------------------------- |
131
+ | `isGroup` | `boolean` | `true` when `group` holds avatars to stack. |
132
+
133
+ ```tsx
134
+ import { SmartAvatarProps, useAvatar } from '@smartsoft001/react';
135
+
136
+ export function InitialsAvatar({
137
+ imageUrl,
138
+ initials,
139
+ group,
140
+ className,
141
+ }: SmartAvatarProps) {
142
+ const { isGroup } = useAvatar({ group });
143
+
144
+ if (isGroup) {
145
+ return (
146
+ <div className={className}>
147
+ {group?.map((item) => (
148
+ <span key={item.id}>{item.initials}</span>
149
+ ))}
150
+ </div>
151
+ );
152
+ }
153
+
154
+ return imageUrl ? (
155
+ <img src={imageUrl} alt="" className={className} />
156
+ ) : (
157
+ <span className={className}>{initials ?? '?'}</span>
158
+ );
159
+ }
160
+ ```
161
+
162
+ ## Styling
163
+
164
+ - `SmartAvatarStandard` carries no visual styling: style it with your own CSS on `data-size`, `data-shape`, `data-placeholder-type` and, for a group container, `data-stack-direction`.
165
+ - `SmartAvatarPreset` styles every size, both shapes, the status dot and the stacked group, with `smart:dark:` variants; `options.stackDirection: 'bottom-to-top'` reverses the stack there.
166
+
167
+ ## File Locations
168
+
169
+ Source: `packages/shared/react/src/lib/components/avatar/` in the smartsoft001 repository.
170
+
171
+ - `avatar.tsx`: `SmartAvatar`
172
+ - `avatar.types.ts`: `SmartAvatarProps`
173
+ - `preset/avatar-preset.tsx`: `SmartAvatarPreset`
174
+ - `standard/avatar-standard.tsx`: `SmartAvatarStandard`
175
+ - `use-avatar.ts`: `useAvatar`
176
+ - `avatar.stories.tsx`: Storybook stories
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: react-components-badge
3
+ description: SmartBadge React component API (@smartsoft001/react) — small status label with colour, size, solid/soft/outline variant, pill, dot and remove button (onRemoved), the 'badge' registry key, SmartBadgePreset and useBadge.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Badge (`SmartBadge`)
8
+
9
+ `SmartBadge` is a small label for a status or a tag: `text`, a `color` from the badge palette, two sizes, and `options` for the variant (`solid`, `soft`, `outline`), pill shape, a leading dot and a remove button reported through `onRemoved`. `SmartBadgeStandard` (the default) is **unstyled markup** exposing `color`, `size`, `variant` and `pill` as `data-*` attributes; `SmartBadgePreset` is the styled look.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Showing a status ("Active", "Overdue") or a tag next to an item
14
+ - A removable chip (`options.withRemove` + `onRemoved`), e.g. an active filter
15
+ - Restyling every badge (the `badge` registry key)
16
+
17
+ ## Exports
18
+
19
+ All from `@smartsoft001/react`.
20
+
21
+ | Export | Kind | What it is |
22
+ | -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `SmartBadge` | component | Renders the implementation registered as `components.badge` on `SmartProvider`, `SmartBadgeStandard` by default. |
24
+ | `SmartBadgePreset` | component | Styled badge variation (preset). |
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
+ | `useBadge` | hook | The behaviour every badge variant shares: `remove()` reports the click on the remove button through `onRemoved`. |
27
+
28
+ The preset's class helpers (`getBadgeClasses`, `getDotClasses`, `getRemoveClasses`) are exported too, for a custom implementation that wants the preset look.
29
+
30
+ ## Props and Types
31
+
32
+ ### `SmartBadgeProps`
33
+
34
+ | Prop | Type | Default | Description |
35
+ | ------------ | ----------------- | -------- | -------------------------------------------------- |
36
+ | `text` | `string` | required | The label. |
37
+ | `color?` | `SmartBadgeColor` | `'gray'` | Colour from the badge palette. |
38
+ | `size?` | `'sm' \| 'md'` | `'md'` | `sm` or `md`. |
39
+ | `options?` | `IBadgeOptions` | — | Variant, pill shape, dot and remove button. |
40
+ | `className?` | `string` | — | Classes on the root element. |
41
+ | `onRemoved?` | `() => void` | — | Click on the remove button (`options.withRemove`). |
42
+
43
+ ### `IBadgeOptions`
44
+
45
+ | Field | Type | Default | Description |
46
+ | ------------- | -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47
+ | `variant?` | `'solid' \| 'soft' \| 'outline'` | `'soft'` | Visual style variant (default `'soft'`). Styled by `SmartBadgePreset`: • `solid` — filled background with inverse text • `soft` — tinted background with same-hue text • `outline` — transparent background with colored border + text `SmartBadgeStandard` does not style it; it exposes the value as the `data-variant` attribute on its root element. |
48
+ | `pill?` | `boolean` | `true` | Fully rounded pill shape (default `true`); `false` renders `rounded-md` corners. Styled by `SmartBadgePreset`; `SmartBadgeStandard` exposes it as `data-pill="true" \| "false"` on its root element. |
49
+ | `withDot?` | `boolean` | — | Renders a coloured dot before the text. |
50
+ | `withRemove?` | `boolean` | — | Renders a remove button that calls `onRemoved`. |
51
+
52
+ ### Related types
53
+
54
+ - `SmartBadgeColor`: `'gray' \| 'red' \| 'yellow' \| 'green' \| 'blue' \| 'indigo' \| 'purple' \| 'pink'` — The colours a badge can take.
55
+
56
+ ## Usage
57
+
58
+ ```tsx
59
+ import { useState } from 'react';
60
+
61
+ import { SmartBadge, SmartBadgePreset } from '@smartsoft001/react';
62
+
63
+ export function Tags() {
64
+ const [tags, setTags] = useState(['react', 'tailwind']);
65
+
66
+ return (
67
+ <div className="flex gap-2">
68
+ <SmartBadgePreset
69
+ text="Active"
70
+ color="green"
71
+ options={{ withDot: true }}
72
+ />
73
+ <SmartBadgePreset
74
+ text="Overdue"
75
+ color="red"
76
+ size="sm"
77
+ options={{ variant: 'solid', pill: false }}
78
+ />
79
+ {tags.map((tag) => (
80
+ <SmartBadge
81
+ key={tag}
82
+ text={tag}
83
+ color="indigo"
84
+ options={{ variant: 'outline', withRemove: true }}
85
+ onRemoved={() =>
86
+ setTags((current) => current.filter((t) => t !== tag))
87
+ }
88
+ />
89
+ ))}
90
+ </div>
91
+ );
92
+ }
93
+ ```
94
+
95
+ ## Replacing the Implementation
96
+
97
+ `SmartBadge` renders the component registered under the `'badge'` key of `SmartProvider`'s `components`, and `SmartBadgeStandard` when nothing is registered there. Every `SmartBadge` below the provider then renders the registered component, which receives the same props.
98
+
99
+ ```tsx
100
+ import type { ReactNode } from 'react';
101
+
102
+ import { SmartProvider, SmartBadgePreset } from '@smartsoft001/react';
103
+
104
+ // A module constant: a new object on every render would change the context.
105
+ const components = { badge: SmartBadgePreset };
106
+
107
+ export function AppProviders({ children }: { children: ReactNode }) {
108
+ return <SmartProvider components={components}>{children}</SmartProvider>;
109
+ }
110
+ ```
111
+
112
+ `SmartBadgePreset` is the styled (preset) implementation: register it as above, 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
+
114
+ ### The `useBadge` hook
115
+
116
+ The behaviour every badge variant shares: `remove()` reports the click on the remove button through `onRemoved`.
117
+
118
+ ```ts
119
+ function useBadge({ onRemoved }: Pick<SmartBadgeProps, 'onRemoved'>);
120
+ ```
121
+
122
+ | Returns | Type | Description |
123
+ | -------- | ------------ | --------------------------------------------- |
124
+ | `remove` | `() => void` | Reports the remove click through `onRemoved`. |
125
+
126
+ ```tsx
127
+ import { SmartBadgeProps, useBadge } from '@smartsoft001/react';
128
+
129
+ export function TagBadge({
130
+ text,
131
+ color = 'gray',
132
+ options,
133
+ className,
134
+ onRemoved,
135
+ }: SmartBadgeProps) {
136
+ const { remove } = useBadge({ onRemoved });
137
+
138
+ return (
139
+ <span className={className} data-color={color}>
140
+ {text}
141
+ {options?.withRemove && (
142
+ <button type="button" aria-label={`Remove ${text}`} onClick={remove}>
143
+ ×
144
+ </button>
145
+ )}
146
+ </span>
147
+ );
148
+ }
149
+ ```
150
+
151
+ ## Styling
152
+
153
+ - `SmartBadgeStandard` carries no visual styling: style `data-color`, `data-size`, `data-variant` and `data-pill` with your own CSS.
154
+ - `SmartBadgePreset` styles the three variants across the `SmartBadgeColor` palette, with `smart:dark:` variants.
155
+
156
+ ## File Locations
157
+
158
+ Source: `packages/shared/react/src/lib/components/badge/` in the smartsoft001 repository.
159
+
160
+ - `badge.tsx`: `SmartBadge`
161
+ - `badge.types.ts`: `SmartBadgeProps`
162
+ - `preset/badge-preset.tsx`: `SmartBadgePreset`
163
+ - `standard/badge-standard.tsx`: `SmartBadgeStandard`
164
+ - `use-badge.ts`: `useBadge`
165
+ - `badge.stories.tsx`: Storybook stories