@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,168 @@
1
+ ---
2
+ name: react-components-select-menu
3
+ description: SmartSelectMenu React component API (@smartsoft001/react) — single-choice select over items with string or number values (a native select by default), controlled value/onValueChange or uncontrolled defaultValue, placeholder and empty slot, the 'select-menu' registry key and the useSelectMenu hook for a custom listbox.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Select Menu (`SmartSelectMenu`)
8
+
9
+ `SmartSelectMenu` lets the user pick one item from `options.items`. `SmartSelectMenuStandard` is a native `<select>`; the chosen option is matched back to its item, so a numeric item value stays a number. The value is controlled (`value` + `onValueChange`) or kept inside (`defaultValue`, `null` by default); `disabled` blocks the choice. The item fields for avatars, icons, statuses and secondary text, and the `variant` option, are there for a custom listbox registered under the `select-menu` key: the standard select shows only the labels. There is no preset.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - A dropdown select of a few values outside a model-driven form (status filter, assignee)
14
+ - Keeping numeric values numeric through the select
15
+ - Providing a rich listbox with avatars or statuses (your own component under the `select-menu` key, on `useSelectMenu`)
16
+
17
+ Inside a form generated from a model, `enum` / `radio` fields render their own inputs (`react-components-input`).
18
+
19
+ ## Exports
20
+
21
+ All from `@smartsoft001/react`.
22
+
23
+ | Export | Kind | What it is |
24
+ | ------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
25
+ | `SmartSelectMenu` | component | Renders the implementation registered as `components['select-menu']` on `SmartProvider`, `SmartSelectMenuStandard` by default. |
26
+ | `SmartSelectMenuStandard` | component | The default select menu: a native `<select>`. |
27
+ | `useSelectMenu` | hook | The behaviour every select menu variant shares: the `value`, controlled through `value` / `onValueChange` or kept internally from `defaultValue`, and `select()`, which ignores the choice while `disabled`. |
28
+
29
+ ## Props and Types
30
+
31
+ ### `SmartSelectMenuProps`
32
+
33
+ | Prop | Type | Default | Description |
34
+ | ---------------- | ---------------------------------- | ------- | --------------------------------------------------------------------------------------------------------- |
35
+ | `value?` | `SelectMenuValue` | — | The selected item value. Leave it `undefined` for an uncontrolled select that starts from `defaultValue`. |
36
+ | `defaultValue?` | `SelectMenuValue` | `null` | Initial value of an uncontrolled select. |
37
+ | `onValueChange?` | `(value: SelectMenuValue) => void` | — | Called with the value of the chosen item. |
38
+ | `disabled?` | `boolean` | `false` | Disables the select; `select()` ignores choices. |
39
+ | `options?` | `ISelectMenuOptions` | — | Items, placeholder, variant and slots. |
40
+ | `className?` | `string` | — | Classes on the root element. |
41
+
42
+ ### `ISelectMenuOptions`
43
+
44
+ | Field | Type | Default | Description |
45
+ | -------------- | ------------------------ | ------- | ----------------------------------------------------------------------------- |
46
+ | `items?` | `ISelectMenuItem[]` | `[]` | The choices. |
47
+ | `placeholder?` | `string` | — | An empty first option. |
48
+ | `variant?` | `SmartSelectMenuVariant` | — | For implementations of your own; the standard native select does not read it. |
49
+ | `emptyTpl?` | `ReactNode` | — | Shown when there are no items. |
50
+ | `ariaLabel?` | `string` | — | Accessible name of the select. |
51
+
52
+ ### `ISelectMenuItem`
53
+
54
+ | Field | Type | Default | Description |
55
+ | ------------ | ------------------------------------------- | -------- | ------------------------------------------------------ |
56
+ | `value` | `string \| number` | required | The value reported through `onValueChange`. |
57
+ | `label` | `string` | required | The option text. |
58
+ | `avatarUrl?` | `string` | — | For a custom listbox (not shown by the native select). |
59
+ | `iconTpl?` | `ReactNode` | — | For a custom listbox (not shown by the native select). |
60
+ | `secondary?` | `string` | — | For a custom listbox (not shown by the native select). |
61
+ | `status?` | `'online' \| 'offline' \| 'busy' \| string` | — | For a custom listbox (not shown by the native select). |
62
+ | `disabled?` | `boolean` | — | Disables the option. |
63
+ | `ariaLabel?` | `string` | — | Accessible name of the option. |
64
+
65
+ ### Related types
66
+
67
+ - `SelectMenuValue`: `string \| number \| null` — The value type: a string, a number or `null`.
68
+ - `SmartSelectMenuVariant`: `'native' \| 'custom' \| 'with-check' \| 'with-status' \| 'with-avatar' \| 'with-secondary' \| 'branded'`
69
+
70
+ ## Usage
71
+
72
+ ```tsx
73
+ import { useState } from 'react';
74
+
75
+ import { SelectMenuValue, SmartSelectMenu } from '@smartsoft001/react';
76
+
77
+ export function PrioritySelect() {
78
+ const [priority, setPriority] = useState<SelectMenuValue>(2);
79
+
80
+ return (
81
+ <SmartSelectMenu
82
+ value={priority}
83
+ onValueChange={setPriority}
84
+ options={{
85
+ ariaLabel: 'Priority',
86
+ placeholder: 'Choose a priority',
87
+ items: [
88
+ { value: 1, label: 'Low' },
89
+ { value: 2, label: 'Normal' },
90
+ { value: 3, label: 'High' },
91
+ ],
92
+ }}
93
+ />
94
+ );
95
+ }
96
+ ```
97
+
98
+ ## Replacing the Implementation
99
+
100
+ `SmartSelectMenu` renders the component registered under the `'select-menu'` key of `SmartProvider`'s `components`, and `SmartSelectMenuStandard` when nothing is registered there. Every `SmartSelectMenu` below the provider then renders the registered component, which receives the same props.
101
+
102
+ There is no preset for this component: register a component of your own that takes `SmartSelectMenuProps`, as shown below, as `components={{ 'select-menu': MySelectMenu }}`. Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
103
+
104
+ ### The `useSelectMenu` hook
105
+
106
+ The behaviour every select menu variant shares: the `value`, controlled through `value` / `onValueChange` or kept internally from `defaultValue`, and `select()`, which ignores the choice while `disabled`.
107
+
108
+ ```ts
109
+ function useSelectMenu({
110
+ value: valueProp,
111
+ defaultValue = null,
112
+ onValueChange,
113
+ disabled = false,
114
+ }: SmartSelectMenuProps);
115
+ ```
116
+
117
+ | Returns | Type | Description |
118
+ | -------- | --------------------------------- | -------------------------------------------------------------------- |
119
+ | `value` | `SelectMenuValue` | The selected value (controlled or internal). |
120
+ | `select` | `(next: SelectMenuValue) => void` | Selects a value and calls `onValueChange`; ignored while `disabled`. |
121
+
122
+ ```tsx
123
+ import { SmartSelectMenuProps, useSelectMenu } from '@smartsoft001/react';
124
+
125
+ export function AvatarListbox(props: SmartSelectMenuProps) {
126
+ const { value, select } = useSelectMenu(props);
127
+
128
+ return (
129
+ <ul
130
+ role="listbox"
131
+ aria-label={props.options?.ariaLabel}
132
+ className={props.className}
133
+ >
134
+ {(props.options?.items ?? []).map((item) => (
135
+ <li
136
+ key={item.value}
137
+ role="option"
138
+ aria-selected={item.value === value}
139
+ aria-disabled={item.disabled}
140
+ onClick={() => !item.disabled && select(item.value)}
141
+ >
142
+ {item.avatarUrl && (
143
+ <img src={item.avatarUrl} alt="" width={24} height={24} />
144
+ )}
145
+ {item.label}
146
+ {item.secondary && <small> {item.secondary}</small>}
147
+ </li>
148
+ ))}
149
+ </ul>
150
+ );
151
+ }
152
+ ```
153
+
154
+ Registered as `components={{ 'select-menu': AvatarListbox }}`, every `SmartSelectMenu` renders it.
155
+
156
+ ## Styling
157
+
158
+ - The native select carries `smart:dark:` variants; `className` is appended to the root element.
159
+
160
+ ## File Locations
161
+
162
+ Source: `packages/shared/react/src/lib/components/select-menu/` in the smartsoft001 repository.
163
+
164
+ - `select-menu.tsx`: `SmartSelectMenu`
165
+ - `select-menu.types.ts`: `SelectMenuValue`, `SmartSelectMenuProps`
166
+ - `standard/select-menu-standard.tsx`: `SmartSelectMenuStandard`
167
+ - `use-select-menu.ts`: `useSelectMenu`
168
+ - `select-menu.stories.tsx`: Storybook stories
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: react-components-sidebar-layout
3
+ description: SmartSidebarLayout React component API (@smartsoft001/react) — app shell with a sidebar (sidebarTpl) beside the main content (children), an optional header, left/right sidebar and condensed width, the 'sidebar-layout' registry key and SmartSidebarLayoutPreset.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Sidebar Layout (`SmartSidebarLayout`)
8
+
9
+ `SmartSidebarLayout` places a sidebar (`options.sidebarTpl`, typically `SmartSidebarNavigation`) beside the main content (`children`), with an optional header zone (`headerTpl`, or `title` in the preset). `sidebarPosition: 'right'` puts the sidebar after the content; `condensed` narrows it in the preset. The standard rendering is semantic markup (`header`, `aside`, `main`).
10
+
11
+ ## When to Use This Skill
12
+
13
+ - An application shell with a left navigation column
14
+ - A settings screen with a side menu
15
+ - Restyling every sidebar layout (the `sidebar-layout` registry key)
16
+
17
+ For three columns see `react-components-multi-column-layout`; for a top-navigation shell, `react-components-stacked-layout`.
18
+
19
+ ## Exports
20
+
21
+ All from `@smartsoft001/react`.
22
+
23
+ | Export | Kind | What it is |
24
+ | ---------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
25
+ | `SmartSidebarLayout` | component | Renders the implementation registered as `components['sidebar-layout']` on `SmartProvider`, `SmartSidebarLayoutStandard` by default. |
26
+ | `SmartSidebarLayoutPreset` | component | Styled sidebar-layout variation (preset). |
27
+ | `SmartSidebarLayoutStandard` | component | The default sidebar layout: an optional `<header>` (`options.headerTpl`), an `<aside>` (`options.sidebarTpl`) and a `<main>` with `children`. |
28
+
29
+ The preset's class helpers (`getSidebarLayoutRootClasses`, `getSidebarLayoutHeaderClasses`, `getSidebarLayoutTitleClasses`, `getSidebarLayoutRowClasses`, `getSidebarLayoutSidebarClasses`, `getSidebarLayoutMainClasses`) are exported too, for a custom implementation that wants the preset look.
30
+
31
+ ## Props and Types
32
+
33
+ ### `SmartSidebarLayoutProps`
34
+
35
+ | Prop | Type | Default | Description |
36
+ | ------------ | ----------------------- | ------- | ---------------------------- |
37
+ | `options?` | `ISidebarLayoutOptions` | — | Sidebar, header and sizes. |
38
+ | `className?` | `string` | — | Classes on the root element. |
39
+ | `children?` | `ReactNode` | — | The main content. |
40
+
41
+ ### `ISidebarLayoutOptions`
42
+
43
+ | Field | Type | Default | Description |
44
+ | ------------------- | ------------------------------------ | ------- | ---------------------------------------------------------------- |
45
+ | `title?` | `string` | — | Heading of the header zone when `headerTpl` is not set (preset). |
46
+ | `sidebarTpl?` | `ReactNode` | — | The sidebar content. |
47
+ | `headerTpl?` | `ReactNode` | — | The header zone. |
48
+ | `sidebarPosition?` | `'left' \| 'right'` | — | `right` renders the sidebar after the content. |
49
+ | `mobileBreakpoint?` | `SmartSidebarLayoutMobileBreakpoint` | — | Declared; neither rendering reads it. |
50
+ | `condensed?` | `boolean` | `false` | Preset: a narrow sidebar (icons only). |
51
+
52
+ ### Related types
53
+
54
+ - `SmartSidebarLayoutMobileBreakpoint`: `'sm' \| 'md' \| 'lg'`
55
+
56
+ ## Usage
57
+
58
+ ```tsx
59
+ import type { ReactNode } from 'react';
60
+
61
+ import {
62
+ SmartSidebarLayoutPreset,
63
+ SmartSidebarNavigation,
64
+ } from '@smartsoft001/react';
65
+
66
+ export function AppLayout({ children }: { children: ReactNode }) {
67
+ return (
68
+ <SmartSidebarLayoutPreset
69
+ options={{
70
+ title: 'Acme',
71
+ sidebarTpl: (
72
+ <SmartSidebarNavigation
73
+ options={{
74
+ items: [
75
+ {
76
+ id: 'dashboard',
77
+ label: 'Dashboard',
78
+ href: '/',
79
+ current: true,
80
+ },
81
+ { id: 'notes', label: 'Notes', href: '/notes', badge: 12 },
82
+ ],
83
+ }}
84
+ />
85
+ ),
86
+ }}
87
+ >
88
+ {children}
89
+ </SmartSidebarLayoutPreset>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## Replacing the Implementation
95
+
96
+ `SmartSidebarLayout` renders the component registered under the `'sidebar-layout'` key of `SmartProvider`'s `components`, and `SmartSidebarLayoutStandard` when nothing is registered there. Every `SmartSidebarLayout` below the provider then renders the registered component, which receives the same props.
97
+
98
+ ```tsx
99
+ import type { ReactNode } from 'react';
100
+
101
+ import { SmartProvider, SmartSidebarLayoutPreset } from '@smartsoft001/react';
102
+
103
+ // A module constant: a new object on every render would change the context.
104
+ const components = { 'sidebar-layout': SmartSidebarLayoutPreset };
105
+
106
+ export function AppProviders({ children }: { children: ReactNode }) {
107
+ return <SmartProvider components={components}>{children}</SmartProvider>;
108
+ }
109
+ ```
110
+
111
+ `SmartSidebarLayoutPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartSidebarLayout`, 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.
112
+
113
+ ```tsx
114
+ import { SmartSidebarLayoutProps } from '@smartsoft001/react';
115
+
116
+ export function GridSidebarLayout({
117
+ options,
118
+ className,
119
+ children,
120
+ }: SmartSidebarLayoutProps) {
121
+ const right = options?.sidebarPosition === 'right';
122
+
123
+ return (
124
+ <div
125
+ className={className}
126
+ style={{
127
+ display: 'grid',
128
+ gridTemplateColumns: right ? '1fr 16rem' : '16rem 1fr',
129
+ minHeight: '100vh',
130
+ }}
131
+ >
132
+ {!right && <aside>{options?.sidebarTpl}</aside>}
133
+ <main>
134
+ {options?.headerTpl}
135
+ {children}
136
+ </main>
137
+ {right && <aside>{options?.sidebarTpl}</aside>}
138
+ </div>
139
+ );
140
+ }
141
+ ```
142
+
143
+ ## Styling
144
+
145
+ - The preset renders a full-height gray page, a white header zone and a bordered white sidebar, with `smart:dark:` variants; the standard rendering has no layout styles.
146
+
147
+ ## File Locations
148
+
149
+ Source: `packages/shared/react/src/lib/components/sidebar-layout/` in the smartsoft001 repository.
150
+
151
+ - `preset/sidebar-layout-preset.tsx`: `SmartSidebarLayoutPreset`
152
+ - `sidebar-layout.tsx`: `SmartSidebarLayout`
153
+ - `sidebar-layout.types.ts`: `SmartSidebarLayoutProps`
154
+ - `standard/sidebar-layout-standard.tsx`: `SmartSidebarLayoutStandard`
155
+ - `sidebar-layout.stories.tsx`: Storybook stories
@@ -0,0 +1,277 @@
1
+ ---
2
+ name: react-components-sidebar-navigation
3
+ description: SmartSidebarNavigation React component API (@smartsoft001/react) — vertical app navigation with a logo, items and titled groups, badges, initials, expandable sections (onItemToggle), a profile link, router links through the navigation adapter, onItemClick, the 'sidebar-navigation' registry key and useSidebarNavigation.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Sidebar Navigation (`SmartSidebarNavigation`)
8
+
9
+ `SmartSidebarNavigation` is the navigation column of an application: an optional logo (light and dark image, or a `tpl` node), `items` (an untitled first group) followed by titled `groups`, and a profile link at the bottom. Items show an icon or an initial and a badge; an expandable item opens its `children` (reported through `onItemToggle({ itemId, expanded })`). Items with an internal `href` render through the navigation adapter's `linkComponent` when one is set; items without `href` are buttons reported through `onItemClick({ itemId })`. There is no preset; the standard rendering is semantic markup with class hooks.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - The left navigation of an application shell (inside `SmartSidebarLayout`)
14
+ - Grouped navigation with section titles, badges and expandable sections
15
+ - Providing the application's own sidebar look (the `sidebar-navigation` registry key) on `useSidebarNavigation`
16
+
17
+ ## Exports
18
+
19
+ All from `@smartsoft001/react`.
20
+
21
+ | Export | Kind | What it is |
22
+ | -------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `SmartSidebarNavigation` | component | Renders the implementation registered as `components['sidebar-navigation']` on `SmartProvider`, `SmartSidebarNavigationStandard` by default. |
24
+ | `SmartSidebarNavigationStandard` | component | The default sidebar navigation rendering. |
25
+ | `useSidebarNavigation` | hook | The behaviour every sidebar navigation variant shares: `options.items` normalised into a first, untitled group followed by `options.groups`; the expanded state of the expandable items, starting from `item.expanded` and flipped by `toggleExpanded` (reported through `onItemToggle`); and the item click. |
26
+
27
+ ## Props and Types
28
+
29
+ ### `SmartSidebarNavigationProps`
30
+
31
+ | Prop | Type | Default | Description |
32
+ | --------------- | ---------------------------------------- | ------- | --------------------------------------------- |
33
+ | `options?` | `ISidebarNavOptions` | — | Logo, items, groups and profile. |
34
+ | `className?` | `string` | — | Classes on the root element. |
35
+ | `onItemClick?` | `(event: ISidebarNavItemClick) => void` | — | A click on an item (or child) without `href`. |
36
+ | `onItemToggle?` | `(event: ISidebarNavItemToggle) => void` | — | An expandable item was opened or closed. |
37
+
38
+ ### `ISidebarNavOptions`
39
+
40
+ | Field | Type | Default | Description |
41
+ | ------------ | ----------------------- | ----------- | ---------------------------------------------------------------------------- |
42
+ | `layout?` | `SmartSidebarNavLayout` | — | Declared (`SmartSidebarNavLayout`); the standard rendering does not read it. |
43
+ | `ariaLabel?` | `string` | `'Sidebar'` | Accessible name of the `nav`. |
44
+ | `logo?` | `ISidebarNavLogo` | — | The brand at the top. |
45
+ | `items?` | `ISidebarNavItem[]` | — | The first, untitled group of items. |
46
+ | `groups?` | `ISidebarNavGroup[]` | — | Further groups, each with a title. |
47
+ | `profile?` | `ISidebarNavProfile` | — | A profile link at the bottom. |
48
+
49
+ ### `ISidebarNavItemClick`
50
+
51
+ | Field | Type | Default | Description |
52
+ | -------- | -------- | -------- | ----------------------------- |
53
+ | `itemId` | `string` | required | The `id` of the clicked item. |
54
+
55
+ ### `ISidebarNavItemToggle`
56
+
57
+ | Field | Type | Default | Description |
58
+ | ---------- | --------- | -------- | ----------------------------- |
59
+ | `itemId` | `string` | required | The `id` of the toggled item. |
60
+ | `expanded` | `boolean` | required | The new expanded state. |
61
+
62
+ ### `ISidebarNavLogo`
63
+
64
+ | Field | Type | Default | Description |
65
+ | ---------- | ----------- | ------- | ----------------------------------------- |
66
+ | `url?` | `string` | — | Logo image. |
67
+ | `urlDark?` | `string` | — | Logo image for dark mode. |
68
+ | `alt?` | `string` | — | Alt text of the logo. |
69
+ | `href?` | `string` | — | Link of the logo. |
70
+ | `tpl?` | `ReactNode` | — | The logo as a node; wins over the images. |
71
+
72
+ ### `ISidebarNavItem`
73
+
74
+ | Field | Type | Default | Description |
75
+ | ------------- | ------------------- | -------- | ------------------------------------------------------------------- |
76
+ | `id` | `string` | required | Reported as `itemId`. |
77
+ | `label?` | `string` | — | Item text. |
78
+ | `href?` | `string` | — | Renders a link (through the navigation adapter for internal paths). |
79
+ | `current?` | `boolean` | — | Marks the current page. |
80
+ | `badge?` | `string \| number` | — | A count or text badge. |
81
+ | `iconTpl?` | `ReactNode` | — | Item icon. |
82
+ | `initial?` | `string` | — | A letter shown instead of an icon (e.g. for teams). |
83
+ | `expandable?` | `boolean` | — | Makes the item a toggle for its `children`. |
84
+ | `expanded?` | `boolean` | — | Initial expanded state. |
85
+ | `children?` | `ISidebarNavItem[]` | — | Nested items of an expandable item. |
86
+
87
+ ### `ISidebarNavGroup`
88
+
89
+ | Field | Type | Default | Description |
90
+ | -------- | ------------------- | -------- | ------------------ |
91
+ | `id?` | `string` | — | Key of the group. |
92
+ | `title?` | `string` | — | Group heading. |
93
+ | `items` | `ISidebarNavItem[]` | required | The group's items. |
94
+
95
+ ### `ISidebarNavProfile`
96
+
97
+ | Field | Type | Default | Description |
98
+ | ------------- | -------- | ------- | ---------------------------------------------- |
99
+ | `name?` | `string` | — | User name. |
100
+ | `avatarUrl?` | `string` | — | Avatar image. |
101
+ | `avatarAlt?` | `string` | — | Alt text of the avatar. |
102
+ | `href?` | `string` | — | Profile link. |
103
+ | `srOnlyText?` | `string` | — | Text for screen readers (e.g. "Your profile"). |
104
+
105
+ ### Related types
106
+
107
+ - `SmartSidebarNavLayout`: `'light' \| 'dark' \| 'with-expandable-sections' \| 'with-secondary-navigation' \| 'brand'`
108
+
109
+ ## Usage
110
+
111
+ ```tsx
112
+ import { SmartSidebarNavigation } from '@smartsoft001/react';
113
+
114
+ export function AppSidebar({ path }: { path: string }) {
115
+ return (
116
+ <SmartSidebarNavigation
117
+ options={{
118
+ logo: {
119
+ url: '/logo.svg',
120
+ urlDark: '/logo-dark.svg',
121
+ alt: 'Acme',
122
+ href: '/',
123
+ },
124
+ items: [
125
+ {
126
+ id: 'dashboard',
127
+ label: 'Dashboard',
128
+ href: '/',
129
+ current: path === '/',
130
+ },
131
+ {
132
+ id: 'notes',
133
+ label: 'Notes',
134
+ href: '/notes',
135
+ badge: 12,
136
+ current: path.startsWith('/notes'),
137
+ },
138
+ {
139
+ id: 'reports',
140
+ label: 'Reports',
141
+ expandable: true,
142
+ children: [
143
+ { id: 'sales', label: 'Sales', href: '/reports/sales' },
144
+ { id: 'traffic', label: 'Traffic', href: '/reports/traffic' },
145
+ ],
146
+ },
147
+ ],
148
+ groups: [
149
+ {
150
+ id: 'teams',
151
+ title: 'Your teams',
152
+ items: [
153
+ {
154
+ id: 'heroicons',
155
+ label: 'Heroicons',
156
+ initial: 'H',
157
+ href: '/teams/heroicons',
158
+ },
159
+ {
160
+ id: 'tailwind',
161
+ label: 'Tailwind Labs',
162
+ initial: 'T',
163
+ href: '/teams/tailwind',
164
+ },
165
+ ],
166
+ },
167
+ ],
168
+ profile: {
169
+ name: 'Tom Cook',
170
+ href: '/profile',
171
+ srOnlyText: 'Your profile',
172
+ },
173
+ }}
174
+ onItemToggle={({ itemId, expanded }) => console.log(itemId, expanded)}
175
+ />
176
+ );
177
+ }
178
+ ```
179
+
180
+ ## Replacing the Implementation
181
+
182
+ `SmartSidebarNavigation` renders the component registered under the `'sidebar-navigation'` key of `SmartProvider`'s `components`, and `SmartSidebarNavigationStandard` when nothing is registered there. Every `SmartSidebarNavigation` below the provider then renders the registered component, which receives the same props.
183
+
184
+ There is no preset for this component: register a component of your own that takes `SmartSidebarNavigationProps`, as shown below, as `components={{ 'sidebar-navigation': MySidebarNavigation }}`. Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
185
+
186
+ ### The `useSidebarNavigation` hook
187
+
188
+ The behaviour every sidebar navigation variant shares: `options.items` normalised into a first, untitled group followed by `options.groups`; the expanded state of the expandable items, starting from `item.expanded` and flipped by `toggleExpanded` (reported through `onItemToggle`); and the item click.
189
+
190
+ ```ts
191
+ function useSidebarNavigation({
192
+ options,
193
+ onItemClick,
194
+ onItemToggle,
195
+ }: SmartSidebarNavigationProps);
196
+ ```
197
+
198
+ | Returns | Type | Description |
199
+ | ---------------- | --------------------------------------- | ----------------------------------------------------------------- |
200
+ | `groups` | `ISidebarNavGroup[]` | `options.items` as a first untitled group, then `options.groups`. |
201
+ | `isExpanded` | `(item: ISidebarNavItem) => boolean` | Whether an expandable item is open. |
202
+ | `toggleExpanded` | `(item: ISidebarNavItem) => void` | Opens or closes an item and reports `onItemToggle`. |
203
+ | `itemClick` | `(itemId: string) => void \| undefined` | Reports a click on an item without `href`. |
204
+
205
+ ```tsx
206
+ import {
207
+ SmartSidebarNavigationProps,
208
+ useSidebarNavigation,
209
+ } from '@smartsoft001/react';
210
+
211
+ export function PlainSidebar(props: SmartSidebarNavigationProps) {
212
+ const { groups, isExpanded, toggleExpanded, itemClick } =
213
+ useSidebarNavigation(props);
214
+
215
+ return (
216
+ <nav
217
+ aria-label={props.options?.ariaLabel ?? 'Sidebar'}
218
+ className={props.className}
219
+ >
220
+ {groups.map((group, index) => (
221
+ <section key={group.id ?? index}>
222
+ {group.title && <h3>{group.title}</h3>}
223
+ <ul>
224
+ {group.items.map((item) => (
225
+ <li key={item.id}>
226
+ {item.expandable ? (
227
+ <button
228
+ type="button"
229
+ aria-expanded={isExpanded(item)}
230
+ onClick={() => toggleExpanded(item)}
231
+ >
232
+ {item.label}
233
+ </button>
234
+ ) : item.href ? (
235
+ <a
236
+ href={item.href}
237
+ aria-current={item.current ? 'page' : undefined}
238
+ >
239
+ {item.label}
240
+ </a>
241
+ ) : (
242
+ <button type="button" onClick={() => itemClick(item.id)}>
243
+ {item.label}
244
+ </button>
245
+ )}
246
+ {item.expandable && isExpanded(item) && (
247
+ <ul>
248
+ {item.children?.map((child) => (
249
+ <li key={child.id}>
250
+ <a href={child.href}>{child.label}</a>
251
+ </li>
252
+ ))}
253
+ </ul>
254
+ )}
255
+ </li>
256
+ ))}
257
+ </ul>
258
+ </section>
259
+ ))}
260
+ </nav>
261
+ );
262
+ }
263
+ ```
264
+
265
+ ## Styling
266
+
267
+ - The standard rendering is unstyled semantic markup with class hooks (`sidebar-logo`, `sidebar-logo-img-dark`, `item-badge`, `item-initial`, ...): style them, or register your own component.
268
+
269
+ ## File Locations
270
+
271
+ Source: `packages/shared/react/src/lib/components/sidebar-navigation/` in the smartsoft001 repository.
272
+
273
+ - `sidebar-navigation.tsx`: `SmartSidebarNavigation`
274
+ - `sidebar-navigation.types.ts`: `ISidebarNavItemClick`, `ISidebarNavItemToggle`, `SmartSidebarNavigationProps`
275
+ - `standard/sidebar-navigation-standard.tsx`: `SmartSidebarNavigationStandard`
276
+ - `use-sidebar-navigation.ts`: `useSidebarNavigation`
277
+ - `sidebar-navigation.stories.tsx`: Storybook stories