@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,149 @@
1
+ ---
2
+ name: react-components-stats
3
+ description: SmartStats React component API (@smartsoft001/react) — KPI blocks with label, value, previous value, change badge coloured by trend, icon and action slots in 1–4 columns, the 'stats' registry key and SmartStatsPreset.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Stats (`SmartStats`)
8
+
9
+ `SmartStats` shows key figures: each item has a `label`, a big `value`, and optionally a `previousValue` line, a `change` text coloured by `trend` (`up`, `down`, `neutral`), an icon and an action. `SmartStatsStandard` is an unstyled title and `<dl>` (the change carries `data-trend`); `SmartStatsPreset` renders a responsive grid of stat blocks with `options.columns` (3 by default).
10
+
11
+ ## When to Use This Skill
12
+
13
+ - A dashboard row of KPIs (revenue, users, conversion) with trends
14
+ - Restyling every stats block (the `stats` registry key)
15
+
16
+ ## Exports
17
+
18
+ All from `@smartsoft001/react`.
19
+
20
+ | Export | Kind | What it is |
21
+ | -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22
+ | `SmartStats` | component | Renders the implementation registered as `components.stats` on `SmartProvider`, `SmartStatsStandard` by default. |
23
+ | `SmartStatsPreset` | component | Styled stats variation (preset). |
24
+ | `SmartStatsStandard` | component | The default stats rendering: an unstyled title and a `<dl>` with one item per stat (icon, label, value, previous value, change tagged with `data-trend`, action). |
25
+
26
+ The preset's class helpers (`getStatsContainerClasses`, `getStatsGridClasses`, `getStatsTitleClasses`, `getStatsLabelClasses`, `getStatsValueClasses`, `getStatsSubClasses`, `getStatsIconWrapClasses`, `getStatsActionClasses`, `getStatsChangeClasses`) are exported too, for a custom implementation that wants the preset look.
27
+
28
+ ## Props and Types
29
+
30
+ ### `SmartStatsProps`
31
+
32
+ | Prop | Type | Default | Description |
33
+ | ------------ | --------------- | ------- | ---------------------------- |
34
+ | `options?` | `IStatsOptions` | — | Title, items and columns. |
35
+ | `className?` | `string` | — | Classes on the root element. |
36
+
37
+ ### `IStatsOptions`
38
+
39
+ | Field | Type | Default | Description |
40
+ | ---------- | ------------------ | -------- | ----------------------------------------- |
41
+ | `title?` | `string` | — | Heading above the stats. |
42
+ | `items` | `IStatItem[]` | required | The figures. |
43
+ | `columns?` | `1 \| 2 \| 3 \| 4` | `3` | Preset: number of columns (3 by default). |
44
+
45
+ ### `IStatItem`
46
+
47
+ | Field | Type | Default | Description |
48
+ | ---------------- | ----------------------------- | -------- | ----------------------------------------------------------------------------- |
49
+ | `label` | `string` | required | What the figure is. |
50
+ | `value` | `string \| number` | required | The figure. |
51
+ | `previousValue?` | `string \| number` | — | A muted sub-line (previous value or context text). |
52
+ | `change?` | `string` | — | The change text (e.g. `+4.75%`). |
53
+ | `trend?` | `'up' \| 'down' \| 'neutral'` | — | Colours the change: `up`, `down` or `neutral` (`data-trend` in the standard). |
54
+ | `iconTpl?` | `ReactNode` | — | Leading icon. |
55
+ | `actionTpl?` | `ReactNode` | — | An action (e.g. "View all"). |
56
+ | `ariaLabel?` | `string` | — | Accessible name of the item. |
57
+
58
+ ## Usage
59
+
60
+ ```tsx
61
+ import { SmartStatsPreset } from '@smartsoft001/react';
62
+
63
+ export function RevenueStats() {
64
+ return (
65
+ <SmartStatsPreset
66
+ options={{
67
+ title: 'Last 30 days',
68
+ columns: 3,
69
+ items: [
70
+ {
71
+ label: 'Revenue',
72
+ value: '$405,091',
73
+ previousValue: 'from $380,200',
74
+ change: '+6.5%',
75
+ trend: 'up',
76
+ },
77
+ {
78
+ label: 'Overdue invoices',
79
+ value: '$12,787',
80
+ change: '+54%',
81
+ trend: 'down',
82
+ },
83
+ {
84
+ label: 'Active users',
85
+ value: 2_100,
86
+ change: '0%',
87
+ trend: 'neutral',
88
+ },
89
+ ],
90
+ }}
91
+ />
92
+ );
93
+ }
94
+ ```
95
+
96
+ ## Replacing the Implementation
97
+
98
+ `SmartStats` renders the component registered under the `'stats'` key of `SmartProvider`'s `components`, and `SmartStatsStandard` when nothing is registered there. Every `SmartStats` below the provider then renders the registered component, which receives the same props.
99
+
100
+ ```tsx
101
+ import type { ReactNode } from 'react';
102
+
103
+ import { SmartProvider, SmartStatsPreset } from '@smartsoft001/react';
104
+
105
+ // A module constant: a new object on every render would change the context.
106
+ const components = { stats: SmartStatsPreset };
107
+
108
+ export function AppProviders({ children }: { children: ReactNode }) {
109
+ return <SmartProvider components={components}>{children}</SmartProvider>;
110
+ }
111
+ ```
112
+
113
+ `SmartStatsPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartStats`, 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.
114
+
115
+ ```tsx
116
+ import { SmartStatsProps } from '@smartsoft001/react';
117
+
118
+ export function InlineStats({ options, className }: SmartStatsProps) {
119
+ return (
120
+ <dl className={className}>
121
+ {(options?.items ?? []).map((item) => (
122
+ <div key={item.label}>
123
+ <dt>{item.label}</dt>
124
+ <dd>
125
+ {item.value}{' '}
126
+ {item.change && (
127
+ <small data-trend={item.trend}>{item.change}</small>
128
+ )}
129
+ </dd>
130
+ </div>
131
+ ))}
132
+ </dl>
133
+ );
134
+ }
135
+ ```
136
+
137
+ ## Styling
138
+
139
+ - The preset colours the change badge by `trend` and carries `smart:dark:` variants; the standard rendering is unstyled.
140
+
141
+ ## File Locations
142
+
143
+ Source: `packages/shared/react/src/lib/components/stats/` in the smartsoft001 repository.
144
+
145
+ - `preset/stats-preset.tsx`: `SmartStatsPreset`
146
+ - `standard/stats-standard.tsx`: `SmartStatsStandard`
147
+ - `stats.tsx`: `SmartStats`
148
+ - `stats.types.ts`: `SmartStatsProps`
149
+ - `stats.stories.tsx`: Storybook stories
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: react-components-table
3
+ description: SmartTable React component API (@smartsoft001/react) — data table from columns and rows (TableRow records) with cellTpl render functions, header templates, alignment, sortable columns, checkboxes, striped/sticky/bordered options, toolbar, empty and footer slots, the 'table' registry key and SmartTablePreset.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Table (`SmartTable`)
8
+
9
+ `SmartTable` renders a `<table>` from `options.columns` and `options.rows` (plain records). A column's `cellTpl` is a node or a **render function** of `{ row, column }`; without it the cell shows `row[column.key]` as text. `SmartTableStandard` is unstyled and ignores the visual hints; `SmartTablePreset` honours `striped`, `stickyHeader`, `withBorder`, per-column `align`, client-side sorting of `sortable` columns (with `aria-sort`) and a checkbox column with select-all. Sort and selection are internal to the preset and **not reported** to the parent.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Showing tabular data the page already holds (users, invoices, logs)
14
+ - Custom cell content (badges, links, buttons) through `cellTpl`
15
+ - Restyling every table (the `table` registry key)
16
+
17
+ For a list of model records driven by `@Field` metadata, with paging and row actions, use `SmartList` (`react-components-list`).
18
+
19
+ ## Exports
20
+
21
+ All from `@smartsoft001/react`.
22
+
23
+ | Export | Kind | What it is |
24
+ | -------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
25
+ | `SmartTable` | component | Renders the implementation registered as `components.table` on `SmartProvider`, `SmartTableStandard` by default. |
26
+ | `SmartTablePreset` | component | Styled table variation (preset). |
27
+ | `SmartTableStandard` | component | The default table rendering: an unstyled title, description and toolbar, a `<table>` (only when there are columns) with an optional checkbox column, the `emptyTpl` row when there are no rows, and the footer slot. |
28
+ | `renderTableCell` | function | The content of a body cell: the column's `cellTpl` (called with the `{ row, column }` context when it is a function), otherwise `row[column.key]` as text, empty for `null` / `undefined`. |
29
+
30
+ The preset's class helpers (`getTableFrameClasses`, `getTableScrollClasses`, `getTableHeadClasses`, `getTableBodyClasses`, `getTableHeaderCellClasses`, `getTableRowClasses`, `getTableCellClasses`, `getTableSortIconClasses`, `TABLE_ROOT`, `TABLE_HEADER`, `TABLE_HEADER_TEXT`, `TABLE_TITLE`, `TABLE_DESCRIPTION`, `TABLE_TOOLBAR`, `TABLE_TABLE`, `TABLE_CHECKBOX_CELL`, `TABLE_CHECKBOX`, `TABLE_SORT_BUTTON`, `TABLE_EMPTY`, `TABLE_FOOTER`) are exported too, for a custom implementation that wants the preset look.
31
+
32
+ ## Props and Types
33
+
34
+ ### `SmartTableProps`
35
+
36
+ | Prop | Type | Default | Description |
37
+ | ------------ | -------------------- | ------- | ------------------------------- |
38
+ | `options?` | `ISmartTableOptions` | — | Columns, rows, hints and slots. |
39
+ | `className?` | `string` | — | Classes on the root element. |
40
+
41
+ ### `ISmartTableOptions`
42
+
43
+ `ITableOptions` with `ISmartTableColumn` columns. Extends `Omit<ITableOptions`, `'columns'>`.
44
+
45
+ | Field | Type | Default | Description |
46
+ | ---------- | --------------------- | ------- | ------------ |
47
+ | `columns?` | `ISmartTableColumn[]` | `[]` | The columns. |
48
+
49
+ ### `ITableOptions`
50
+
51
+ The base options; `ISmartTableOptions` replaces its `columns`.
52
+
53
+ | Field | Type | Default | Description |
54
+ | ----------------- | ---------------- | ------- | ----------------------------------------------------------------------------------------------------- |
55
+ | `title?` | `string` | — | Heading above the table. |
56
+ | `description?` | `string` | — | Text under the heading. |
57
+ | `columns?` | `ITableColumn[]` | `[]` | See `ISmartTableOptions.columns`. |
58
+ | `rows?` | `TableRow[]` | `[]` | The rows, as records. |
59
+ | `striped?` | `boolean` | — | Preset: zebra rows. |
60
+ | `stickyHeader?` | `boolean` | — | Preset: the header sticks while scrolling. |
61
+ | `withCheckboxes?` | `boolean` | — | A checkbox column (select-all and row highlight in the preset; plain unbound inputs in the standard). |
62
+ | `withBorder?` | `boolean` | — | Preset: a bordered card frame. |
63
+ | `emptyTpl?` | `ReactNode` | — | Row shown when there are no rows. |
64
+ | `footerTpl?` | `ReactNode` | — | A slot below the table. |
65
+ | `toolbarTpl?` | `ReactNode` | — | A slot above the table (filters, buttons). |
66
+
67
+ ### `SmartTableCellContext`
68
+
69
+ What a `cellTpl` render function receives: the cell's `row` and `column`.
70
+
71
+ | Field | Type | Default | Description |
72
+ | -------- | ------------------- | -------- | -------------------------- |
73
+ | `row` | `TableRow` | required | The row being rendered. |
74
+ | `column` | `ISmartTableColumn` | required | The column being rendered. |
75
+
76
+ ### `ISmartTableColumn`
77
+
78
+ `ITableColumn` whose `cellTpl` may be a render function of the cell's row and column. `headerTpl` has no context and stays a `ReactNode`. Extends `Omit<ITableColumn`, `'cellTpl'>`.
79
+
80
+ | Field | Type | Default | Description |
81
+ | ---------- | ------------------- | ------- | -------------------------------------------------- |
82
+ | `cellTpl?` | `SmartTableCellTpl` | — | A node, or a render function of `{ row, column }`. |
83
+
84
+ ### `ITableColumn`
85
+
86
+ The base column; `ISmartTableColumn` widens its `cellTpl`.
87
+
88
+ | Field | Type | Default | Description |
89
+ | ------------ | ------------------------------- | -------- | ----------------------------------------------------------- |
90
+ | `key` | `string` | required | The row field shown in the column. |
91
+ | `label?` | `string` | — | Header text. |
92
+ | `align?` | `'left' \| 'center' \| 'right'` | — | Preset: cell alignment. |
93
+ | `sortable?` | `boolean` | — | Preset: a clickable header that sorts the rows client-side. |
94
+ | `cellTpl?` | `ReactNode` | — | See `ISmartTableColumn.cellTpl`. |
95
+ | `headerTpl?` | `ReactNode` | — | Header content as a node; wins over `label`. |
96
+ | `ariaLabel?` | `string` | — | Accessible name of the header cell. |
97
+
98
+ ### Related types
99
+
100
+ - `SmartTableCellTpl`: `ReactNode \| ((context: SmartTableCellContext) => ReactNode)` — A node, or a render function of the cell context.
101
+ - `TableRow`: `Record<string, unknown>` — A row: a record of field values.
102
+
103
+ ## Usage
104
+
105
+ ```tsx
106
+ import { SmartBadgePreset, SmartTablePreset } from '@smartsoft001/react';
107
+
108
+ export function Seats({ onEdit }: { onEdit: (email: string) => void }) {
109
+ return (
110
+ <SmartTablePreset
111
+ options={{
112
+ title: 'Users',
113
+ striped: true,
114
+ withBorder: true,
115
+ columns: [
116
+ { key: 'name', label: 'Name', sortable: true },
117
+ {
118
+ key: 'role',
119
+ label: 'Role',
120
+ cellTpl: ({ row }) => (
121
+ <SmartBadgePreset text={String(row['role'])} />
122
+ ),
123
+ },
124
+ { key: 'seats', label: 'Seats', align: 'right', sortable: true },
125
+ {
126
+ key: 'actions',
127
+ label: '',
128
+ cellTpl: ({ row }) => (
129
+ <button
130
+ type="button"
131
+ onClick={() => onEdit(String(row['email']))}
132
+ >
133
+ Edit
134
+ </button>
135
+ ),
136
+ },
137
+ ],
138
+ rows: [
139
+ {
140
+ name: 'Lindsay Walton',
141
+ role: 'Developer',
142
+ email: 'lindsay@example.com',
143
+ seats: 3,
144
+ },
145
+ {
146
+ name: 'Courtney Henry',
147
+ role: 'Designer',
148
+ email: 'courtney@example.com',
149
+ seats: 1,
150
+ },
151
+ ],
152
+ emptyTpl: <span>No users.</span>,
153
+ }}
154
+ />
155
+ );
156
+ }
157
+ ```
158
+
159
+ ## Replacing the Implementation
160
+
161
+ `SmartTable` renders the component registered under the `'table'` key of `SmartProvider`'s `components`, and `SmartTableStandard` when nothing is registered there. Every `SmartTable` below the provider then renders the registered component, which receives the same props.
162
+
163
+ ```tsx
164
+ import type { ReactNode } from 'react';
165
+
166
+ import { SmartProvider, SmartTablePreset } from '@smartsoft001/react';
167
+
168
+ // A module constant: a new object on every render would change the context.
169
+ const components = { table: SmartTablePreset };
170
+
171
+ export function AppProviders({ children }: { children: ReactNode }) {
172
+ return <SmartProvider components={components}>{children}</SmartProvider>;
173
+ }
174
+ ```
175
+
176
+ `SmartTablePreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartTable`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
177
+
178
+ `renderTableCell(row, column)` is the cell rule every rendering uses (the `cellTpl`, else `row[column.key]` as text), so a custom table stays consistent:
179
+
180
+ ```tsx
181
+ import { renderTableCell, SmartTableProps } from '@smartsoft001/react';
182
+
183
+ export function PlainTable({ options, className }: SmartTableProps) {
184
+ const columns = options?.columns ?? [];
185
+
186
+ return (
187
+ <table className={className}>
188
+ <thead>
189
+ <tr>
190
+ {columns.map((column) => (
191
+ <th key={column.key}>{column.headerTpl ?? column.label}</th>
192
+ ))}
193
+ </tr>
194
+ </thead>
195
+ <tbody>
196
+ {(options?.rows ?? []).map((row, index) => (
197
+ <tr key={index}>
198
+ {columns.map((column) => (
199
+ <td key={column.key}>{renderTableCell(row, column)}</td>
200
+ ))}
201
+ </tr>
202
+ ))}
203
+ </tbody>
204
+ </table>
205
+ );
206
+ }
207
+ ```
208
+
209
+ ## Styling
210
+
211
+ - `SmartTableStandard` renders the table only when there are columns, with no visual styles; `SmartTablePreset` carries the Tailwind UI look with `smart:dark:` variants.
212
+
213
+ ## File Locations
214
+
215
+ Source: `packages/shared/react/src/lib/components/table/` in the smartsoft001 repository.
216
+
217
+ - `preset/table-preset.tsx`: `SmartTablePreset`
218
+ - `standard/table-standard.tsx`: `SmartTableStandard`
219
+ - `table-cell.ts`: `renderTableCell`
220
+ - `table.tsx`: `SmartTable`
221
+ - `table.types.ts`: `SmartTableCellContext`, `SmartTableCellTpl`, `ISmartTableColumn`, `ISmartTableOptions`, `SmartTableProps`
222
+ - `table.stories.tsx`: Storybook stories
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: react-components-tabs
3
+ description: SmartTabs React component API (@smartsoft001/react) — tab navigation (buttons or router links) with icons and badges, controlled selectedId or uncontrolled defaultSelectedId, onTabChange, a mobile select, nine layouts, the 'tabs' registry key, SmartTabsPreset and useTabs.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Tabs (`SmartTabs`)
8
+
9
+ `SmartTabs` renders the tab strip only; the parent renders the content of the selected tab. Tabs are buttons that select themselves, or links (`href`, rendered through the navigation adapter's `linkComponent` for internal paths). The selection is controlled (`selectedId` + `onSelectedIdChange`) or kept inside (`defaultSelectedId`); `onTabChange({ tabId })` reports every choice. Unless `options.showMobileSelect` is `false`, a `<select>` of the tabs is rendered too: the preset shows it below `sm` and the strip from `sm` up, the standard rendering marks the two with the `tabs-mobile` / `tabs-desktop` class hooks for your CSS. `SmartTabsPreset` renders the nine `layout`s with `role="tablist"` / `tab`, `aria-selected` and `aria-controls={item.id}` (give your panel that id).
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Switching between sections of a page (Overview / Settings / Members)
14
+ - Tabs that are links to sub-routes, with the current one highlighted
15
+ - Tabs with icons or counts (`underline-with-icons`, `underline-with-badges`)
16
+ - Restyling every tab strip (the `tabs` registry key)
17
+
18
+ ## Exports
19
+
20
+ All from `@smartsoft001/react`.
21
+
22
+ | Export | Kind | What it is |
23
+ | ------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `SmartTabs` | component | Renders the implementation registered as `components.tabs` on `SmartProvider`, `SmartTabsStandard` by default. |
25
+ | `SmartTabsPreset` | component | Styled tabs variation (preset). |
26
+ | `SmartTabsStandard` | component | The default tabs rendering. |
27
+ | `useTabs` | hook | The behaviour every tabs variant shares: the selection, controlled through `selectedId` or kept internally when that prop is `undefined`, and `selectTab`, which selects a tab and reports it through `onSelectedIdChange` and `onTabChange`. |
28
+
29
+ The preset's class helpers (`getTabsContainerClasses`, `getTabsNavClasses`, `getTabsTriggerClasses`, `getTabsBadgeClasses`, `getTabsIconClasses`, `getTabsMobileSelectClasses`) are exported too, for a custom implementation that wants the preset look.
30
+
31
+ ## Props and Types
32
+
33
+ ### `SmartTabsProps`
34
+
35
+ | Prop | Type | Default | Description |
36
+ | --------------------- | ------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------- |
37
+ | `options?` | `ITabsOptions` | — | Items, layout, accessible name and the mobile select. |
38
+ | `selectedId?` | `string \| null` | — | The id of the selected tab (`null` for none). Leave it `undefined` to let the component keep the selection. |
39
+ | `defaultSelectedId?` | `string \| null` | `null` | The initial selection of an uncontrolled component. |
40
+ | `onSelectedIdChange?` | `(selectedId: string) => void` | — | Called with the id of the selected tab. |
41
+ | `onTabChange?` | `(event: ITabChange) => void` | — | A tab was chosen (button click, preset link click or mobile select). |
42
+ | `className?` | `string` | — | Classes on the root element. |
43
+
44
+ ### `ITabsOptions`
45
+
46
+ | Field | Type | Default | Description |
47
+ | ------------------- | ----------------- | ------------- | --------------------------------------------------------------------------------------------------------------- |
48
+ | `layout?` | `SmartTabsLayout` | `'underline'` | Preset look; the standard rendering ignores it. |
49
+ | `items?` | `ITabItem[]` | `[]` | The tabs. |
50
+ | `ariaLabel?` | `string` | `'Tabs'` | Accessible name of the strip; the standard mobile select uses it too, with `'Select a tab'` as its own default. |
51
+ | `showMobileSelect?` | `boolean` | `true` | Renders a `<select>` of the tabs for small screens. |
52
+
53
+ ### `ITabChange`
54
+
55
+ | Field | Type | Default | Description |
56
+ | ------- | -------- | -------- | --------------------------- |
57
+ | `tabId` | `string` | required | The `id` of the chosen tab. |
58
+
59
+ ### `ITabItem`
60
+
61
+ | Field | Type | Default | Description |
62
+ | ---------- | ------------------ | -------- | -------------------------------------------------------------------------------------------------- |
63
+ | `id` | `string` | required | Identifies the tab (`selectedId`, `tabId`, and the preset's `aria-controls`). |
64
+ | `label?` | `string` | — | Tab text. |
65
+ | `href?` | `string` | — | Renders the tab as a link; the standard rendering follows the link without changing the selection. |
66
+ | `badge?` | `string \| number` | — | A count or text badge. |
67
+ | `iconTpl?` | `ReactNode` | — | Icon before the label. |
68
+
69
+ ### Related types
70
+
71
+ - `SmartTabsLayout`: `'underline' \| 'underline-with-icons' \| 'underline-with-badges' \| 'underline-full-width' \| 'pills' \| 'pills-on-gray' \| 'pills-with-brand-color' \| 'bar-with-underline' \| 'simple'`
72
+
73
+ ## Usage
74
+
75
+ ```tsx
76
+ import { useState } from 'react';
77
+
78
+ import { SmartTabsPreset } from '@smartsoft001/react';
79
+
80
+ export function ProjectTabs() {
81
+ const [tab, setTab] = useState('overview');
82
+
83
+ return (
84
+ <>
85
+ <SmartTabsPreset
86
+ selectedId={tab}
87
+ onSelectedIdChange={setTab}
88
+ options={{
89
+ layout: 'underline-with-badges',
90
+ ariaLabel: 'Project sections',
91
+ items: [
92
+ { id: 'overview', label: 'Overview' },
93
+ { id: 'members', label: 'Members', badge: 4 },
94
+ { id: 'settings', label: 'Settings' },
95
+ ],
96
+ }}
97
+ />
98
+ <section id={tab} role="tabpanel">
99
+ {tab === 'overview' && <p>Overview…</p>}
100
+ {tab === 'members' && <p>Members…</p>}
101
+ {tab === 'settings' && <p>Settings…</p>}
102
+ </section>
103
+ </>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ## Replacing the Implementation
109
+
110
+ `SmartTabs` renders the component registered under the `'tabs'` key of `SmartProvider`'s `components`, and `SmartTabsStandard` when nothing is registered there. Every `SmartTabs` below the provider then renders the registered component, which receives the same props.
111
+
112
+ ```tsx
113
+ import type { ReactNode } from 'react';
114
+
115
+ import { SmartProvider, SmartTabsPreset } from '@smartsoft001/react';
116
+
117
+ // A module constant: a new object on every render would change the context.
118
+ const components = { tabs: SmartTabsPreset };
119
+
120
+ export function AppProviders({ children }: { children: ReactNode }) {
121
+ return <SmartProvider components={components}>{children}</SmartProvider>;
122
+ }
123
+ ```
124
+
125
+ `SmartTabsPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartTabs`, 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.
126
+
127
+ ### The `useTabs` hook
128
+
129
+ The behaviour every tabs variant shares: the selection, controlled through `selectedId` or kept internally when that prop is `undefined`, and `selectTab`, which selects a tab and reports it through `onSelectedIdChange` and `onTabChange`.
130
+
131
+ ```ts
132
+ function useTabs({
133
+ selectedId,
134
+ defaultSelectedId = null,
135
+ onSelectedIdChange,
136
+ onTabChange,
137
+ }: SmartTabsProps);
138
+ ```
139
+
140
+ | Returns | Type | Description |
141
+ | ------------ | ------------------------- | ----------------------------------------------------------------- |
142
+ | `selectedId` | `string \| null` | The selected id (controlled or internal). |
143
+ | `selectTab` | `(tabId: string) => void` | Selects a tab and reports `onSelectedIdChange` and `onTabChange`. |
144
+
145
+ ```tsx
146
+ import { SmartTabsProps, useTabs } from '@smartsoft001/react';
147
+
148
+ export function SegmentTabs(props: SmartTabsProps) {
149
+ const { selectedId, selectTab } = useTabs(props);
150
+ const items = props.options?.items ?? [];
151
+ const current = selectedId ?? items[0]?.id;
152
+
153
+ return (
154
+ <div
155
+ role="tablist"
156
+ aria-label={props.options?.ariaLabel}
157
+ className={props.className}
158
+ >
159
+ {items.map((item) => (
160
+ <button
161
+ key={item.id}
162
+ type="button"
163
+ role="tab"
164
+ aria-selected={item.id === current}
165
+ onClick={() => selectTab(item.id)}
166
+ >
167
+ {item.label}
168
+ {item.badge !== undefined && <span> {item.badge}</span>}
169
+ </button>
170
+ ))}
171
+ </div>
172
+ );
173
+ }
174
+ ```
175
+
176
+ ## Styling
177
+
178
+ - The standard rendering is unstyled; the preset treats the first item as current when nothing is selected and carries `smart:dark:` variants.
179
+
180
+ ## File Locations
181
+
182
+ Source: `packages/shared/react/src/lib/components/tabs/` in the smartsoft001 repository.
183
+
184
+ - `preset/tabs-preset.tsx`: `SmartTabsPreset`
185
+ - `standard/tabs-standard.tsx`: `SmartTabsStandard`
186
+ - `tabs.tsx`: `SmartTabs`
187
+ - `tabs.types.ts`: `ITabChange`, `SmartTabsProps`
188
+ - `use-tabs.ts`: `useTabs`
189
+ - `tabs.stories.tsx`: Storybook stories