@smartsoft001/claude-plugins 2.194.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/scaffold-nx-workspace/SKILL.md +1 -1
  6. package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-claude-config.md +13 -9
  7. package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/patch-delta.md +1 -1
  8. package/plugins/{smart → smart-core}/.claude-plugin/README.md +31 -16
  9. package/plugins/{smart → smart-core}/.claude-plugin/merge-permissions.js +7 -6
  10. package/plugins/smart-core/.claude-plugin/plugin.json +5 -0
  11. package/plugins/{smart → smart-core}/.claude-plugin/settings.template.json +2 -2
  12. package/plugins/{smart → smart-core}/hooks/README.md +1 -1
  13. package/plugins/{smart → smart-core}/skills/audit-log/SKILL.md +2 -2
  14. package/plugins/{smart → smart-core}/skills/format-code/SKILL.md +1 -1
  15. package/plugins/smart-react/.claude-plugin/plugin.json +6 -0
  16. package/plugins/smart-react/agents/react-components.md +260 -0
  17. package/plugins/smart-react/skills/react-components-accordion/SKILL.md +204 -0
  18. package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +191 -0
  19. package/plugins/smart-react/skills/react-components-alert/SKILL.md +244 -0
  20. package/plugins/smart-react/skills/react-components-app/SKILL.md +236 -0
  21. package/plugins/smart-react/skills/react-components-avatar/SKILL.md +176 -0
  22. package/plugins/smart-react/skills/react-components-badge/SKILL.md +165 -0
  23. package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +183 -0
  24. package/plugins/smart-react/skills/react-components-button/SKILL.md +239 -0
  25. package/plugins/smart-react/skills/react-components-button-group/SKILL.md +187 -0
  26. package/plugins/smart-react/skills/react-components-calendar/SKILL.md +270 -0
  27. package/plugins/smart-react/skills/react-components-card/SKILL.md +201 -0
  28. package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +133 -0
  29. package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +228 -0
  30. package/plugins/smart-react/skills/react-components-container/SKILL.md +134 -0
  31. package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +186 -0
  32. package/plugins/smart-react/skills/react-components-date-range/SKILL.md +259 -0
  33. package/plugins/smart-react/skills/react-components-description-list/SKILL.md +144 -0
  34. package/plugins/smart-react/skills/react-components-detail/SKILL.md +272 -0
  35. package/plugins/smart-react/skills/react-components-details/SKILL.md +250 -0
  36. package/plugins/smart-react/skills/react-components-divider/SKILL.md +128 -0
  37. package/plugins/smart-react/skills/react-components-drawer/SKILL.md +165 -0
  38. package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +194 -0
  39. package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +202 -0
  40. package/plugins/smart-react/skills/react-components-export/SKILL.md +120 -0
  41. package/plugins/smart-react/skills/react-components-feed/SKILL.md +171 -0
  42. package/plugins/smart-react/skills/react-components-form/SKILL.md +319 -0
  43. package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +172 -0
  44. package/plugins/smart-react/skills/react-components-icon/SKILL.md +117 -0
  45. package/plugins/smart-react/skills/react-components-import/SKILL.md +113 -0
  46. package/plugins/smart-react/skills/react-components-info/SKILL.md +147 -0
  47. package/plugins/smart-react/skills/react-components-input/SKILL.md +406 -0
  48. package/plugins/smart-react/skills/react-components-list/SKILL.md +384 -0
  49. package/plugins/smart-react/skills/react-components-list-container/SKILL.md +105 -0
  50. package/plugins/smart-react/skills/react-components-loader/SKILL.md +126 -0
  51. package/plugins/smart-react/skills/react-components-media-object/SKILL.md +130 -0
  52. package/plugins/smart-react/skills/react-components-modal/SKILL.md +266 -0
  53. package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +155 -0
  54. package/plugins/smart-react/skills/react-components-navbar/SKILL.md +211 -0
  55. package/plugins/smart-react/skills/react-components-notification/SKILL.md +223 -0
  56. package/plugins/smart-react/skills/react-components-overlays/SKILL.md +182 -0
  57. package/plugins/smart-react/skills/react-components-page/SKILL.md +224 -0
  58. package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +155 -0
  59. package/plugins/smart-react/skills/react-components-paging/SKILL.md +183 -0
  60. package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +149 -0
  61. package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +195 -0
  62. package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +150 -0
  63. package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +138 -0
  64. package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +168 -0
  65. package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +155 -0
  66. package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +277 -0
  67. package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +228 -0
  68. package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +146 -0
  69. package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +156 -0
  70. package/plugins/smart-react/skills/react-components-stats/SKILL.md +149 -0
  71. package/plugins/smart-react/skills/react-components-table/SKILL.md +222 -0
  72. package/plugins/smart-react/skills/react-components-tabs/SKILL.md +189 -0
  73. package/plugins/smart-react/skills/react-components-textarea/SKILL.md +202 -0
  74. package/plugins/smart-react/skills/react-components-toggle/SKILL.md +157 -0
  75. package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +212 -0
  76. package/plugins/smart-react/skills/react-forms/SKILL.md +272 -0
  77. package/plugins/smart-react/skills/react-provider/SKILL.md +368 -0
  78. package/plugins/smart-react/skills/smart-crud-react/SKILL.md +410 -0
  79. package/plugins/smart/.claude-plugin/plugin.json +0 -5
  80. /package/plugins/{smart/agents/angular-components/AGENT.md → smart-angular/agents/angular-components.md} +0 -0
  81. /package/plugins/{smart → smart-angular}/skills/angular-components-accordion/SKILL.md +0 -0
  82. /package/plugins/{smart → smart-angular}/skills/angular-components-action-panel/SKILL.md +0 -0
  83. /package/plugins/{smart → smart-angular}/skills/angular-components-alert/SKILL.md +0 -0
  84. /package/plugins/{smart → smart-angular}/skills/angular-components-avatar/SKILL.md +0 -0
  85. /package/plugins/{smart → smart-angular}/skills/angular-components-badge/SKILL.md +0 -0
  86. /package/plugins/{smart → smart-angular}/skills/angular-components-breadcrumbs/SKILL.md +0 -0
  87. /package/plugins/{smart → smart-angular}/skills/angular-components-button/SKILL.md +0 -0
  88. /package/plugins/{smart → smart-angular}/skills/angular-components-button-group/SKILL.md +0 -0
  89. /package/plugins/{smart → smart-angular}/skills/angular-components-calendar/SKILL.md +0 -0
  90. /package/plugins/{smart → smart-angular}/skills/angular-components-card/SKILL.md +0 -0
  91. /package/plugins/{smart → smart-angular}/skills/angular-components-card-heading/SKILL.md +0 -0
  92. /package/plugins/{smart → smart-angular}/skills/angular-components-command-palette/SKILL.md +0 -0
  93. /package/plugins/{smart → smart-angular}/skills/angular-components-container/SKILL.md +0 -0
  94. /package/plugins/{smart → smart-angular}/skills/angular-components-date-edit/SKILL.md +0 -0
  95. /package/plugins/{smart → smart-angular}/skills/angular-components-date-range/SKILL.md +0 -0
  96. /package/plugins/{smart → smart-angular}/skills/angular-components-description-list/SKILL.md +0 -0
  97. /package/plugins/{smart → smart-angular}/skills/angular-components-detail/SKILL.md +0 -0
  98. /package/plugins/{smart → smart-angular}/skills/angular-components-details/SKILL.md +0 -0
  99. /package/plugins/{smart → smart-angular}/skills/angular-components-divider/SKILL.md +0 -0
  100. /package/plugins/{smart → smart-angular}/skills/angular-components-drawer/SKILL.md +0 -0
  101. /package/plugins/{smart → smart-angular}/skills/angular-components-dropdown/SKILL.md +0 -0
  102. /package/plugins/{smart → smart-angular}/skills/angular-components-empty-state/SKILL.md +0 -0
  103. /package/plugins/{smart → smart-angular}/skills/angular-components-feed/SKILL.md +0 -0
  104. /package/plugins/{smart → smart-angular}/skills/angular-components-form/SKILL.md +0 -0
  105. /package/plugins/{smart → smart-angular}/skills/angular-components-grid-list/SKILL.md +0 -0
  106. /package/plugins/{smart → smart-angular}/skills/angular-components-icon/SKILL.md +0 -0
  107. /package/plugins/{smart → smart-angular}/skills/angular-components-info/SKILL.md +0 -0
  108. /package/plugins/{smart → smart-angular}/skills/angular-components-input/SKILL.md +0 -0
  109. /package/plugins/{smart → smart-angular}/skills/angular-components-list/SKILL.md +0 -0
  110. /package/plugins/{smart → smart-angular}/skills/angular-components-list-container/SKILL.md +0 -0
  111. /package/plugins/{smart → smart-angular}/skills/angular-components-media-object/SKILL.md +0 -0
  112. /package/plugins/{smart → smart-angular}/skills/angular-components-modal/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,165 @@
1
+ ---
2
+ name: react-components-drawer
3
+ description: SmartDrawer React component API (@smartsoft001/react) — side panel (offcanvas) with a title and close button, controlled open/onOpenChange or uncontrolled defaultOpen, onClosed, left/right position, wide and overlay options, the 'drawer' registry key, SmartDrawerPreset and useDrawer.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Drawer (`SmartDrawer`)
8
+
9
+ `SmartDrawer` is a side panel (`role="dialog"`) that slides in from the right (or left) with a header holding the `title` and a close button, and `children` as the body. Its open state is controlled (`open` + `onOpenChange`) or kept inside (`defaultOpen`). Closing through the close button or the overlay calls `onClosed`. It renders nothing while closed.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Showing details, a form or filters in a side panel without leaving the page
14
+ - Opening and closing a panel from the parent (`open` + `onOpenChange`)
15
+ - Choosing the side, the width and a backdrop (`options.position`, `wide`, `withOverlay`)
16
+ - Restyling every drawer (the `drawer` registry key) or building one on `useDrawer`
17
+
18
+ ## Exports
19
+
20
+ All from `@smartsoft001/react`.
21
+
22
+ | Export | Kind | What it is |
23
+ | --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
24
+ | `SmartDrawer` | component | Renders the implementation registered as `components.drawer` on `SmartProvider`, `SmartDrawerStandard` by default. |
25
+ | `SmartDrawerPreset` | component | Styled drawer (offcanvas) variation (preset). |
26
+ | `SmartDrawerStandard` | component | The default drawer rendering. |
27
+ | `useDrawer` | hook | The behaviour every drawer variant shares: the `open` state, controlled through `open` / `onOpenChange` or kept internally from `defaultOpen`, and `close()`, which hides the drawer and reports `onClosed`. |
28
+
29
+ The preset's class helpers (`getDrawerPanelClasses`, `getDrawerBackdropClasses`, `getDrawerHeaderClasses`, `getDrawerTitleClasses`, `getDrawerCloseClasses`, `getDrawerBodyClasses`) are exported too, for a custom implementation that wants the preset look.
30
+
31
+ ## Props and Types
32
+
33
+ ### `SmartDrawerProps`
34
+
35
+ | Prop | Type | Default | Description |
36
+ | --------------- | ------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
37
+ | `open?` | `boolean` | — | Whether the drawer is shown. Leave it `undefined` for an uncontrolled drawer that starts from `defaultOpen`. |
38
+ | `defaultOpen?` | `boolean` | `false` | Initial `open` of an uncontrolled drawer. |
39
+ | `onOpenChange?` | `(open: boolean) => void` | — | Called when the drawer opens or closes. |
40
+ | `title?` | `string` | — | Heading of the panel; the standard drawer renders the header (with the close button) only when it is set. |
41
+ | `options?` | `IDrawerOptions` | — | Side, width, backdrop and header look. |
42
+ | `className?` | `string` | — | Classes on the panel. |
43
+ | `onClosed?` | `() => void` | — | Called after the drawer closed itself (close button / overlay click). |
44
+ | `children?` | `ReactNode` | — | The body of the panel. |
45
+
46
+ ### `IDrawerOptions`
47
+
48
+ | Field | Type | Default | Description |
49
+ | ---------------- | -------------------- | --------- | --------------------------------------------------------------------------- |
50
+ | `position?` | `'left' \| 'right'` | `'right'` | The side the panel opens on. |
51
+ | `wide?` | `boolean` | — | A wider panel (preset). |
52
+ | `withOverlay?` | `boolean` | — | Renders a backdrop; a click on it closes the drawer. |
53
+ | `brandedHeader?` | `boolean` | — | A coloured header (preset). |
54
+ | `stickyFooter?` | `boolean` | — | Declared; not read by the standard or preset drawer. |
55
+ | `variant?` | `SmartDrawerVariant` | — | Declared (`SmartDrawerVariant`); not read by the standard or preset drawer. |
56
+
57
+ ### Related types
58
+
59
+ - `SmartDrawerVariant`: `'empty' \| 'create-form' \| 'user-profile' \| 'contact-list' \| 'file-details'`
60
+
61
+ ## Usage
62
+
63
+ ```tsx
64
+ import { useState } from 'react';
65
+
66
+ import { SmartButton, SmartDrawer } from '@smartsoft001/react';
67
+
68
+ export function OrderDrawer() {
69
+ const [open, setOpen] = useState(false);
70
+
71
+ return (
72
+ <>
73
+ <SmartButton options={{ click: () => setOpen(true) }}>
74
+ Show order
75
+ </SmartButton>
76
+ <SmartDrawer
77
+ open={open}
78
+ onOpenChange={setOpen}
79
+ title="Order #1024"
80
+ options={{ position: 'right', withOverlay: true, wide: true }}
81
+ >
82
+ <p>3 items, shipped yesterday.</p>
83
+ </SmartDrawer>
84
+ </>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ## Replacing the Implementation
90
+
91
+ `SmartDrawer` renders the component registered under the `'drawer'` key of `SmartProvider`'s `components`, and `SmartDrawerStandard` when nothing is registered there. Every `SmartDrawer` below the provider then renders the registered component, which receives the same props.
92
+
93
+ ```tsx
94
+ import type { ReactNode } from 'react';
95
+
96
+ import { SmartProvider, SmartDrawerPreset } from '@smartsoft001/react';
97
+
98
+ // A module constant: a new object on every render would change the context.
99
+ const components = { drawer: SmartDrawerPreset };
100
+
101
+ export function AppProviders({ children }: { children: ReactNode }) {
102
+ return <SmartProvider components={components}>{children}</SmartProvider>;
103
+ }
104
+ ```
105
+
106
+ `SmartDrawerPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartDrawer`, 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.
107
+
108
+ ### The `useDrawer` hook
109
+
110
+ The behaviour every drawer variant shares: the `open` state, controlled through `open` / `onOpenChange` or kept internally from `defaultOpen`, and `close()`, which hides the drawer and reports `onClosed`.
111
+
112
+ ```ts
113
+ function useDrawer({
114
+ open: openProp,
115
+ defaultOpen = false,
116
+ onOpenChange,
117
+ onClosed,
118
+ }: SmartDrawerProps);
119
+ ```
120
+
121
+ | Returns | Type | Description |
122
+ | --------- | -------------------------- | ------------------------------------------------------------------- |
123
+ | `open` | `boolean` | The open state (controlled or internal). |
124
+ | `setOpen` | `(value: boolean) => void` | Sets the state and calls `onOpenChange`. |
125
+ | `close` | `() => void` | Closes the drawer, calls `onOpenChange(false)` and then `onClosed`. |
126
+
127
+ ```tsx
128
+ import { SmartDrawerProps, useDrawer } from '@smartsoft001/react';
129
+
130
+ export function BottomSheet(props: SmartDrawerProps) {
131
+ const { open, close } = useDrawer(props);
132
+
133
+ if (!open) return null;
134
+
135
+ return (
136
+ <div
137
+ role="dialog"
138
+ aria-modal="true"
139
+ aria-label={props.title}
140
+ className={props.className}
141
+ >
142
+ <button type="button" aria-label="Close" onClick={close}>
143
+ ×
144
+ </button>
145
+ {props.children}
146
+ </div>
147
+ );
148
+ }
149
+ ```
150
+
151
+ ## Styling
152
+
153
+ - The standard drawer is unstyled markup (`data-position`, a `.drawer-overlay` backdrop); register or render `SmartDrawerPreset` for the sliding panel look with `smart:dark:` variants.
154
+ - `className` is appended to the panel.
155
+
156
+ ## File Locations
157
+
158
+ Source: `packages/shared/react/src/lib/components/drawer/` in the smartsoft001 repository.
159
+
160
+ - `drawer.tsx`: `SmartDrawer`
161
+ - `drawer.types.ts`: `SmartDrawerProps`
162
+ - `preset/drawer-preset.tsx`: `SmartDrawerPreset`
163
+ - `standard/drawer-standard.tsx`: `SmartDrawerStandard`
164
+ - `use-drawer.ts`: `useDrawer`
165
+ - `drawer.stories.tsx`: Storybook stories
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: react-components-dropdown
3
+ description: SmartDropdown React component API (@smartsoft001/react) — trigger button with a menu of items (dividers, icons, disabled, header), controlled open/onOpenChange or uncontrolled defaultOpen, onSelectedItem, the 'dropdown' registry key, SmartDropdownPreset and useDropdown.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Dropdown (`SmartDropdown`)
8
+
9
+ `SmartDropdown` renders a trigger button and, while open, a menu (`role="menu"`) of `items`. Choosing an item reports `onSelectedItem({ itemId })` and closes the menu. The open state is controlled (`open` + `onOpenChange`) or kept inside (`defaultOpen`). The trigger shows `triggerLabel`; without it the standard trigger renders `children` (the preset shows `Actions` instead and ignores `children`).
10
+
11
+ ## When to Use This Skill
12
+
13
+ - An "Options" / "Actions" menu next to a record or in a toolbar
14
+ - Grouping items with dividers, icons or a header (variants)
15
+ - Restyling every dropdown (the `dropdown` registry key) or building one on `useDropdown`
16
+
17
+ ## Exports
18
+
19
+ All from `@smartsoft001/react`.
20
+
21
+ | Export | Kind | What it is |
22
+ | ----------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `SmartDropdown` | component | Renders the implementation registered as `components.dropdown` on `SmartProvider`, `SmartDropdownStandard` by default. |
24
+ | `SmartDropdownPreset` | component | Styled dropdown variation (preset). |
25
+ | `SmartDropdownStandard` | component | The default dropdown rendering. |
26
+ | `useDropdown` | hook | The behaviour every dropdown variant shares: the `open` state, controlled through `open` / `onOpenChange` or kept internally from `defaultOpen`; `toggle()`, `close()`, and `selectItem(id)`, which reports `onSelectedItem` and closes the menu. |
27
+
28
+ The preset's class helpers (`getDropdownTriggerClasses`, `getDropdownMenuClasses`, `getDropdownChevronClasses`, `DROPDOWN_CONTAINER`, `DROPDOWN_GROUP`, `DROPDOWN_ITEM`, `DROPDOWN_ICON`, `DROPDOWN_HEADER`, `DROPDOWN_HEADER_TEXT`) are exported too, for a custom implementation that wants the preset look.
29
+
30
+ ## Props and Types
31
+
32
+ ### `SmartDropdownProps`
33
+
34
+ | Prop | Type | Default | Description |
35
+ | ----------------- | ------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
36
+ | `items?` | `IDropdownItem[]` | `[]` | The menu items. |
37
+ | `triggerLabel?` | `string` | — | Trigger text; without it the standard trigger renders `children`. |
38
+ | `open?` | `boolean` | — | Whether the menu is shown. Leave it `undefined` for an uncontrolled dropdown that starts from `defaultOpen`. |
39
+ | `defaultOpen?` | `boolean` | `false` | Initial `open` of an uncontrolled dropdown. |
40
+ | `onOpenChange?` | `(open: boolean) => void` | — | Called when the menu opens or closes. |
41
+ | `options?` | `IDropdownOptions` | — | Variant and header label. |
42
+ | `className?` | `string` | — | Classes on the root element. |
43
+ | `onSelectedItem?` | `(value: { itemId: string }) => void` | — | An item was selected; the menu closes afterwards. |
44
+ | `children?` | `ReactNode` | — | Trigger content of the standard dropdown when `triggerLabel` is not set. |
45
+
46
+ ### `IDropdownOptions`
47
+
48
+ | Field | Type | Default | Description |
49
+ | -------------- | ---------------------- | ---------- | ----------------------------------------------------------------------------- |
50
+ | `variant?` | `SmartDropdownVariant` | `'simple'` | The look (`simple`, `with-dividers`, `with-icons`, `minimal`, `with-header`). |
51
+ | `headerLabel?` | `string` | — | Header text of the `with-header` variant. |
52
+
53
+ ### `IDropdownItem`
54
+
55
+ | Field | Type | Default | Description |
56
+ | ----------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
57
+ | `id` | `string` | required | Reported as `itemId`. |
58
+ | `label` | `string` | required | Item text. |
59
+ | `icon?` | `string` | — | Text or glyph shown before the label by the preset's `with-icons` / `with-header` variants. |
60
+ | `href?` | `string` | — | Declared; no variant renders it as a link (navigate in `onSelectedItem`). |
61
+ | `disabled?` | `boolean` | — | Disables the item. |
62
+ | `divider?` | `boolean` | — | Makes the entry a separator (the preset's `with-dividers` variant splits the menu into sections there; other preset variants hide it). |
63
+
64
+ ### Related types
65
+
66
+ - `SmartDropdownVariant`: `'simple' \| 'with-dividers' \| 'with-icons' \| 'minimal' \| 'with-header'`
67
+
68
+ ## Usage
69
+
70
+ ```tsx
71
+ import { SmartDropdown, SmartDropdownPreset } from '@smartsoft001/react';
72
+
73
+ const ITEMS = [
74
+ { id: 'edit', label: 'Edit' },
75
+ { id: 'duplicate', label: 'Duplicate' },
76
+ { id: 'sep', label: '', divider: true },
77
+ { id: 'delete', label: 'Delete' },
78
+ ];
79
+
80
+ export function RowActions({ onAction }: { onAction: (id: string) => void }) {
81
+ return (
82
+ <>
83
+ <SmartDropdownPreset
84
+ items={ITEMS}
85
+ triggerLabel="Options"
86
+ options={{ variant: 'with-dividers' }}
87
+ onSelectedItem={({ itemId }) => onAction(itemId)}
88
+ />
89
+
90
+ {/* Standard trigger with custom content. */}
91
+ <SmartDropdown
92
+ items={ITEMS}
93
+ onSelectedItem={({ itemId }) => onAction(itemId)}
94
+ >
95
+ ⋯
96
+ </SmartDropdown>
97
+ </>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ## Replacing the Implementation
103
+
104
+ `SmartDropdown` renders the component registered under the `'dropdown'` key of `SmartProvider`'s `components`, and `SmartDropdownStandard` when nothing is registered there. Every `SmartDropdown` 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, SmartDropdownPreset } from '@smartsoft001/react';
110
+
111
+ // A module constant: a new object on every render would change the context.
112
+ const components = { dropdown: SmartDropdownPreset };
113
+
114
+ export function AppProviders({ children }: { children: ReactNode }) {
115
+ return <SmartProvider components={components}>{children}</SmartProvider>;
116
+ }
117
+ ```
118
+
119
+ `SmartDropdownPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartDropdown`, 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 `useDropdown` hook
122
+
123
+ The behaviour every dropdown variant shares: the `open` state, controlled through `open` / `onOpenChange` or kept internally from `defaultOpen`; `toggle()`, `close()`, and `selectItem(id)`, which reports `onSelectedItem` and closes the menu.
124
+
125
+ ```ts
126
+ function useDropdown({
127
+ open: openProp,
128
+ defaultOpen = false,
129
+ onOpenChange,
130
+ onSelectedItem,
131
+ }: SmartDropdownProps);
132
+ ```
133
+
134
+ | Returns | Type | Description |
135
+ | ------------ | -------------------------- | --------------------------------------------------------- |
136
+ | `open` | `boolean` | The open state (controlled or internal). |
137
+ | `setOpen` | `(value: boolean) => void` | Sets the state and calls `onOpenChange`. |
138
+ | `toggle` | `() => void` | Opens or closes the menu. |
139
+ | `close` | `() => void` | Closes the menu. |
140
+ | `selectItem` | `(itemId: string) => void` | Reports `onSelectedItem({ itemId })` and closes the menu. |
141
+
142
+ ```tsx
143
+ import { SmartDropdownProps, useDropdown } from '@smartsoft001/react';
144
+
145
+ export function KebabMenu(props: SmartDropdownProps) {
146
+ const { open, toggle, selectItem } = useDropdown(props);
147
+
148
+ return (
149
+ <div className={props.className}>
150
+ <button
151
+ type="button"
152
+ aria-haspopup="menu"
153
+ aria-expanded={open}
154
+ onClick={toggle}
155
+ >
156
+ {props.triggerLabel ?? '⋮'}
157
+ </button>
158
+ {open && (
159
+ <ul role="menu">
160
+ {(props.items ?? [])
161
+ .filter((item) => !item.divider)
162
+ .map((item) => (
163
+ <li key={item.id} role="menuitem">
164
+ <button
165
+ type="button"
166
+ disabled={item.disabled}
167
+ onClick={() => selectItem(item.id)}
168
+ >
169
+ {item.label}
170
+ </button>
171
+ </li>
172
+ ))}
173
+ </ul>
174
+ )}
175
+ </div>
176
+ );
177
+ }
178
+ ```
179
+
180
+ ## Styling
181
+
182
+ - The standard dropdown is unstyled (`smart-dropdown-trigger`, `smart-dropdown-header` class hooks); `SmartDropdownPreset` keeps `aria-haspopup` / `aria-expanded` and adds the menu look with `smart:dark:` variants.
183
+ - `className` is appended to the root element.
184
+
185
+ ## File Locations
186
+
187
+ Source: `packages/shared/react/src/lib/components/dropdown/` in the smartsoft001 repository.
188
+
189
+ - `dropdown.tsx`: `SmartDropdown`
190
+ - `dropdown.types.ts`: `SmartDropdownProps`
191
+ - `preset/dropdown-preset.tsx`: `SmartDropdownPreset`
192
+ - `standard/dropdown-standard.tsx`: `SmartDropdownStandard`
193
+ - `use-dropdown.ts`: `useDropdown`
194
+ - `dropdown.stories.tsx`: Storybook stories
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: react-components-empty-state
3
+ description: SmartEmptyState React component API (@smartsoft001/react) — placeholder for an empty list or first-run screen with icon, title, description, actions, suggested items, a form slot and a footer link, onActionClick/onItemClick, the 'empty-state' registry key and SmartEmptyStatePreset.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Empty State (`SmartEmptyState`)
8
+
9
+ `SmartEmptyState` fills the space where content would be: an icon, a title and description, a row of actions, an optional list of suggested items (starting points, templates, recommendations), a form slot and a footer link. Actions and items with `href` render as links; the others as buttons reported through `onActionClick({ actionId })` / `onItemClick({ itemId })`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - A list or table with no rows yet ("No projects — create your first one")
14
+ - A first-run screen offering starting points or templates (`items`)
15
+ - Inviting the user with an inline form (`formTpl`), e.g. "Add team members"
16
+ - Restyling every empty state (the `empty-state` registry key)
17
+
18
+ ## Exports
19
+
20
+ All from `@smartsoft001/react`.
21
+
22
+ | Export | Kind | What it is |
23
+ | ------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `SmartEmptyState` | component | Renders the implementation registered as `components['empty-state']` on `SmartProvider`, `SmartEmptyStateStandard` by default. |
25
+ | `SmartEmptyStatePreset` | component | Styled empty-state variation (preset). |
26
+ | `SmartEmptyStateStandard` | component | The default empty-state rendering: icon, title, description, form slot, actions (anchors when `href` is set, otherwise buttons calling `onActionClick`), an optional items list (anchors or buttons calling `onItemClick`) and a footer link. |
27
+
28
+ The preset's class helpers (`getEmptyStateActionClasses`, `EMPTY_STATE_CONTAINER`, `EMPTY_STATE_ICON_WRAP`, `EMPTY_STATE_TITLE`, `EMPTY_STATE_DESCRIPTION`, `EMPTY_STATE_FORM`, `EMPTY_STATE_FOOTER_LINK`, `EMPTY_STATE_FOOTER_WRAP`, `EMPTY_STATE_ACTIONS`, `EMPTY_STATE_ITEMS_TITLE`, `EMPTY_STATE_ITEMS_LIST`, `EMPTY_STATE_ITEM`, `EMPTY_STATE_ITEM_ICON`, `EMPTY_STATE_ITEM_IMAGE`, `EMPTY_STATE_ITEM_CONTENT`, `EMPTY_STATE_ITEM_TITLE`, `EMPTY_STATE_ITEM_DESCRIPTION`, `EMPTY_STATE_ITEM_META`) are exported too, for a custom implementation that wants the preset look.
29
+
30
+ ## Props and Types
31
+
32
+ ### `SmartEmptyStateProps`
33
+
34
+ | Prop | Type | Default | Description |
35
+ | ---------------- | ----------------------------------------- | ------- | ------------------------------------------------ |
36
+ | `options?` | `IEmptyStateOptions` | — | Content of the empty state. |
37
+ | `className?` | `string` | — | Classes on the root element. |
38
+ | `onActionClick?` | `(event: IEmptyStateActionClick) => void` | — | Called when an action without `href` is clicked. |
39
+ | `onItemClick?` | `(event: IEmptyStateItemClick) => void` | — | Called when an item without `href` is clicked. |
40
+
41
+ ### `IEmptyStateOptions`
42
+
43
+ | Field | Type | Default | Description |
44
+ | ------------------ | ----------------------- | ------- | ------------------------------------------------------------------------------------------- |
45
+ | `title?` | `string` | — | Heading. |
46
+ | `description?` | `string` | — | Text under the heading. |
47
+ | `layout?` | `SmartEmptyStateLayout` | — | Declared (`SmartEmptyStateLayout`); neither the standard nor the preset rendering reads it. |
48
+ | `iconTpl?` | `ReactNode` | — | Icon or illustration above the title. |
49
+ | `actions?` | `IEmptyStateAction[]` | `[]` | Buttons / links under the description. |
50
+ | `items?` | `IEmptyStateItem[]` | `[]` | Suggested items listed below. |
51
+ | `itemsTitle?` | `string` | — | Heading of the items list. |
52
+ | `formTpl?` | `ReactNode` | — | A form slot (e.g. an invite input). |
53
+ | `footerLinkLabel?` | `string` | — | Text of the footer link. |
54
+ | `footerLinkHref?` | `string` | — | Target of the footer link. |
55
+
56
+ ### `IEmptyStateActionClick`
57
+
58
+ Payload of `onActionClick`.
59
+
60
+ | Field | Type | Default | Description |
61
+ | ---------- | -------- | -------- | ------------------------------- |
62
+ | `actionId` | `string` | required | The `id` of the clicked action. |
63
+
64
+ ### `IEmptyStateItemClick`
65
+
66
+ Payload of `onItemClick`.
67
+
68
+ | Field | Type | Default | Description |
69
+ | -------- | -------- | -------- | ----------------------------- |
70
+ | `itemId` | `string` | required | The `id` of the clicked item. |
71
+
72
+ ### `IEmptyStateAction`
73
+
74
+ | Field | Type | Default | Description |
75
+ | ---------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------------ |
76
+ | `id` | `string` | required | Reported as `actionId`. |
77
+ | `label?` | `string` | — | Button / link text. |
78
+ | `href?` | `string` | — | Renders a link instead of a button. |
79
+ | `variant?` | `'primary' \| 'secondary' \| 'ghost' \| 'link'` | — | Look of the action (the preset defaults to `link` with `href`, `primary` otherwise). |
80
+ | `iconTpl?` | `ReactNode` | — | Icon next to the label. |
81
+
82
+ ### `IEmptyStateItem`
83
+
84
+ | Field | Type | Default | Description |
85
+ | -------------- | ----------- | -------- | ----------------------------------------------- |
86
+ | `id` | `string` | required | Reported as `itemId`. |
87
+ | `title?` | `string` | — | Item title. |
88
+ | `description?` | `string` | — | Item text. |
89
+ | `href?` | `string` | — | Renders the item as a link instead of a button. |
90
+ | `iconTpl?` | `ReactNode` | — | Item icon. |
91
+ | `imageUrl?` | `string` | — | Item image. |
92
+ | `imageAlt?` | `string` | — | Alt text of the image. |
93
+ | `meta?` | `string` | — | Small extra text. |
94
+
95
+ ### Related types
96
+
97
+ - `SmartEmptyStateLayout`: `'simple' \| 'dashed-border' \| 'starting-points' \| 'with-recommendations' \| 'with-templates' \| 'with-recommendations-grid'`
98
+
99
+ ## Usage
100
+
101
+ ```tsx
102
+ import { SmartEmptyState } from '@smartsoft001/react';
103
+
104
+ export function NoProjects({
105
+ onCreate,
106
+ onTemplate,
107
+ }: {
108
+ onCreate: () => void;
109
+ onTemplate: (id: string) => void;
110
+ }) {
111
+ return (
112
+ <SmartEmptyState
113
+ options={{
114
+ title: 'No projects',
115
+ description: 'Get started by creating a new project.',
116
+ actions: [
117
+ { id: 'create', label: 'New project', variant: 'primary' },
118
+ { id: 'docs', label: 'Read the guide', href: '/docs/projects' },
119
+ ],
120
+ itemsTitle: 'Or start from a template',
121
+ items: [
122
+ {
123
+ id: 'kanban',
124
+ title: 'Kanban board',
125
+ description: 'Track work in columns.',
126
+ },
127
+ {
128
+ id: 'roadmap',
129
+ title: 'Roadmap',
130
+ description: 'Plan quarters ahead.',
131
+ },
132
+ ],
133
+ }}
134
+ onActionClick={({ actionId }) => {
135
+ if (actionId === 'create') onCreate();
136
+ }}
137
+ onItemClick={({ itemId }) => onTemplate(itemId)}
138
+ />
139
+ );
140
+ }
141
+ ```
142
+
143
+ ## Replacing the Implementation
144
+
145
+ `SmartEmptyState` renders the component registered under the `'empty-state'` key of `SmartProvider`'s `components`, and `SmartEmptyStateStandard` when nothing is registered there. Every `SmartEmptyState` below the provider then renders the registered component, which receives the same props.
146
+
147
+ ```tsx
148
+ import type { ReactNode } from 'react';
149
+
150
+ import { SmartProvider, SmartEmptyStatePreset } from '@smartsoft001/react';
151
+
152
+ // A module constant: a new object on every render would change the context.
153
+ const components = { 'empty-state': SmartEmptyStatePreset };
154
+
155
+ export function AppProviders({ children }: { children: ReactNode }) {
156
+ return <SmartProvider components={components}>{children}</SmartProvider>;
157
+ }
158
+ ```
159
+
160
+ `SmartEmptyStatePreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartEmptyState`, 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.
161
+
162
+ ```tsx
163
+ import { SmartEmptyStateProps } from '@smartsoft001/react';
164
+
165
+ export function MinimalEmptyState({
166
+ options,
167
+ className,
168
+ onActionClick,
169
+ }: SmartEmptyStateProps) {
170
+ return (
171
+ <div className={className} role="status">
172
+ {options?.iconTpl}
173
+ <h3>{options?.title}</h3>
174
+ <p>{options?.description}</p>
175
+ {options?.actions?.map((action) => (
176
+ <button
177
+ key={action.id}
178
+ type="button"
179
+ onClick={() => onActionClick?.({ actionId: action.id })}
180
+ >
181
+ {action.label}
182
+ </button>
183
+ ))}
184
+ </div>
185
+ );
186
+ }
187
+ ```
188
+
189
+ ## Styling
190
+
191
+ - The standard rendering is unstyled markup with class hooks (`title`, `form`, `items-title`, ...); `SmartEmptyStatePreset` renders the centred block (icon tile, title, description, link and actions) with `smart:dark:` variants.
192
+ - `className` is appended to the root element.
193
+
194
+ ## File Locations
195
+
196
+ Source: `packages/shared/react/src/lib/components/empty-state/` in the smartsoft001 repository.
197
+
198
+ - `empty-state.tsx`: `SmartEmptyState`
199
+ - `empty-state.types.ts`: `IEmptyStateActionClick`, `IEmptyStateItemClick`, `SmartEmptyStateProps`
200
+ - `preset/empty-state-preset.tsx`: `SmartEmptyStatePreset`
201
+ - `standard/empty-state-standard.tsx`: `SmartEmptyStateStandard`
202
+ - `empty-state.stories.tsx`: Storybook stories