@smartsoft001/claude-plugins 2.194.0 → 2.196.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +14 -3
- package/README.md +19 -4
- package/package.json +3 -3
- package/plugins/smart-angular/.claude-plugin/plugin.json +6 -0
- package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/SKILL.md +1 -1
- package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-claude-config.md +13 -9
- package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/patch-delta.md +1 -1
- package/plugins/{smart → smart-core}/.claude-plugin/README.md +31 -16
- package/plugins/{smart → smart-core}/.claude-plugin/merge-permissions.js +7 -6
- package/plugins/smart-core/.claude-plugin/plugin.json +5 -0
- package/plugins/{smart → smart-core}/.claude-plugin/settings.template.json +2 -2
- package/plugins/{smart → smart-core}/hooks/README.md +1 -1
- package/plugins/{smart → smart-core}/skills/audit-log/SKILL.md +2 -2
- package/plugins/{smart → smart-core}/skills/format-code/SKILL.md +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +6 -0
- package/plugins/smart-react/agents/react-components.md +260 -0
- package/plugins/smart-react/skills/react-components-accordion/SKILL.md +204 -0
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +191 -0
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +244 -0
- package/plugins/smart-react/skills/react-components-app/SKILL.md +236 -0
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +176 -0
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +165 -0
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +183 -0
- package/plugins/smart-react/skills/react-components-button/SKILL.md +239 -0
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +187 -0
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +270 -0
- package/plugins/smart-react/skills/react-components-card/SKILL.md +201 -0
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +133 -0
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +228 -0
- package/plugins/smart-react/skills/react-components-container/SKILL.md +134 -0
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +186 -0
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +259 -0
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +144 -0
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +272 -0
- package/plugins/smart-react/skills/react-components-details/SKILL.md +250 -0
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +128 -0
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +165 -0
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +194 -0
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +202 -0
- package/plugins/smart-react/skills/react-components-export/SKILL.md +120 -0
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +171 -0
- package/plugins/smart-react/skills/react-components-form/SKILL.md +319 -0
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +172 -0
- package/plugins/smart-react/skills/react-components-icon/SKILL.md +117 -0
- package/plugins/smart-react/skills/react-components-import/SKILL.md +113 -0
- package/plugins/smart-react/skills/react-components-info/SKILL.md +147 -0
- package/plugins/smart-react/skills/react-components-input/SKILL.md +406 -0
- package/plugins/smart-react/skills/react-components-list/SKILL.md +384 -0
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +105 -0
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +126 -0
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +130 -0
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +266 -0
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +155 -0
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +211 -0
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +223 -0
- package/plugins/smart-react/skills/react-components-overlays/SKILL.md +182 -0
- package/plugins/smart-react/skills/react-components-page/SKILL.md +224 -0
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +155 -0
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +183 -0
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +149 -0
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +195 -0
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +150 -0
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +138 -0
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +168 -0
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +155 -0
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +277 -0
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +228 -0
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +146 -0
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +156 -0
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +149 -0
- package/plugins/smart-react/skills/react-components-table/SKILL.md +222 -0
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +189 -0
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +202 -0
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +157 -0
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +212 -0
- package/plugins/smart-react/skills/react-forms/SKILL.md +272 -0
- package/plugins/smart-react/skills/react-provider/SKILL.md +368 -0
- package/plugins/smart-react/skills/smart-crud-react/SKILL.md +410 -0
- package/plugins/smart/.claude-plugin/plugin.json +0 -5
- /package/plugins/{smart/agents/angular-components/AGENT.md → smart-angular/agents/angular-components.md} +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-accordion/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-action-panel/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-alert/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-avatar/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-badge/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-breadcrumbs/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-button/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-button-group/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-calendar/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-card/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-card-heading/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-command-palette/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-container/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-date-edit/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-date-range/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-description-list/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-detail/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-details/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-divider/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-drawer/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-dropdown/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-empty-state/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-feed/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-form/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-grid-list/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-icon/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-info/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-input/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-list/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-list-container/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-media-object/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-modal/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-multi-column-layout/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-navbar/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-notification/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-page/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-page-heading/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-paging/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-password-strength/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-progress-bars/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-searchbar/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-section-heading/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-select-menu/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-sidebar-layout/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-sidebar-navigation/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-sign-in-form/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-stacked-layout/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-stacked-list/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-stats/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-table/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-tabs/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-textarea/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-toggle/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/angular-components-vertical-navigation/SKILL.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-app.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/base-shared-lib.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/references/version-resolution.md +0 -0
- /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/scripts/derive-prefix.sh +0 -0
- /package/plugins/{smart → smart-angular}/skills/scaffold-nx-workspace/scripts/verify-scaffold.sh +0 -0
- /package/plugins/{smart → smart-angular}/skills/smart-crud/SKILL.md +0 -0
- /package/plugins/{smart → smart-core}/hooks/CONFIG.md +0 -0
- /package/plugins/{smart → smart-core}/hooks/audit_logger.py +0 -0
- /package/plugins/{smart → smart-core}/hooks/auto_format.sh +0 -0
- /package/plugins/{smart → smart-core}/hooks/hooks.json +0 -0
- /package/plugins/{smart → smart-core}/hooks/safety_validator.py +0 -0
- /package/plugins/{smart → smart-core}/hooks/sensitive_file_blocker.py +0 -0
- /package/plugins/{smart → smart-core}/hooks/skill_validator.py +0 -0
- /package/plugins/{smart → smart-core}/skills/project-conventions/SKILL.md +0 -0
- /package/plugins/{smart → smart-core}/skills/safety-check/SKILL.md +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-components-sign-in-form
|
|
3
|
+
description: SmartSignInForm React component API (@smartsoft001/react) — email + password sign-in / sign-up form with social provider buttons, forgot-password and switch links, onSubmit/onSocialClick, simple/simple-no-labels/card/split-screen layouts, the 'sign-in-form' registry key, SmartSignInFormPreset and useSignInForm.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sign-in Form (`SmartSignInForm`)
|
|
8
|
+
|
|
9
|
+
`SmartSignInForm` renders an email + password form in `sign-in` (default) or `sign-up` `mode`. Submitting reports `onSubmit({ email, password, mode })`; social provider buttons report `onSocialClick({ providerId, mode })`; both are ignored while `disabled`. Links to "forgot password" (sign-in), sign-up (sign-in) and sign-in (sign-up) are rendered when their hrefs are set. The form does not authenticate anyone: call your API (or `AuthService`) in `onSubmit`. `SmartSignInFormPreset` renders four layouts.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- A login or registration screen
|
|
14
|
+
- Social sign-in buttons (Google, GitHub, ...)
|
|
15
|
+
- A split-screen login with a hero image, or a card login (preset layouts)
|
|
16
|
+
- Restyling every sign-in form (the `sign-in-form` registry key)
|
|
17
|
+
|
|
18
|
+
## Exports
|
|
19
|
+
|
|
20
|
+
All from `@smartsoft001/react`.
|
|
21
|
+
|
|
22
|
+
| Export | Kind | What it is |
|
|
23
|
+
| ------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `SmartSignInForm` | component | Renders the implementation registered as `components['sign-in-form']` on `SmartProvider`, `SmartSignInFormStandard` by default. |
|
|
25
|
+
| `SmartSignInFormPreset` | component | Styled sign-in form variation (preset). |
|
|
26
|
+
| `SmartSignInFormStandard` | component | The default, unstyled sign-in form. |
|
|
27
|
+
| `useSignInForm` | hook | The form logic every sign-in form variant shares: the typed email and password, `submit()` reporting them with the mode, and `socialClick()`; both are ignored while `disabled`. |
|
|
28
|
+
|
|
29
|
+
The preset's class helpers (`getSignInFormContainerClasses`, `getSignInFormCardClasses`, `getSignInFormHeroClasses`, `getSignInFormColumnClasses`, `getSignInFormLabelClasses`, `getSignInFormInputClasses`, `getSignInFormSubmitClasses`, `getSignInFormSocialClasses`, `getSignInFormLinkClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
30
|
+
|
|
31
|
+
## Props and Types
|
|
32
|
+
|
|
33
|
+
### `SmartSignInFormProps`
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ---------------- | ----------------------------------------- | ----------- | --------------------------------------------------------------------------- |
|
|
37
|
+
| `mode?` | `SmartSignInFormMode` | `'sign-in'` | `sign-in` or `sign-up`; picks the default submit label and the links shown. |
|
|
38
|
+
| `disabled?` | `boolean` | `false` | Disables the form; submit and social clicks are ignored. |
|
|
39
|
+
| `options?` | `ISignInFormOptions` | — | Providers, layout, labels, links and slots. |
|
|
40
|
+
| `className?` | `string` | — | Classes on the container. |
|
|
41
|
+
| `onSubmit?` | `(value: ISignInFormSubmit) => void` | — | Called with the typed credentials and the mode. |
|
|
42
|
+
| `onSocialClick?` | `(value: ISignInFormSocialClick) => void` | — | Called when a social sign-in button is clicked. |
|
|
43
|
+
|
|
44
|
+
### `ISignInFormOptions`
|
|
45
|
+
|
|
46
|
+
| Field | Type | Default | Description |
|
|
47
|
+
| ---------------------- | ----------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `socialProviders?` | `ISocialProvider[]` | `[]` | Social sign-in buttons. |
|
|
49
|
+
| `layout?` | `SmartSignInFormLayout` | `'simple'` | Preset: `simple` (default), `simple-no-labels`, `card` or `split-screen`. |
|
|
50
|
+
| `showLabels?` | `boolean` | — | `false` hides the field labels (the `simple-no-labels` preset layout hides them unless this is `true`). |
|
|
51
|
+
| `heroImageUrl?` | `string` | — | Image of the `split-screen` layout. |
|
|
52
|
+
| `forgotPasswordHref?` | `string` | — | "Forgot password" link (sign-in mode). |
|
|
53
|
+
| `signUpHref?` | `string` | — | Link to the sign-up screen (sign-in mode). |
|
|
54
|
+
| `signInHref?` | `string` | — | Link to the sign-in screen (sign-up mode). |
|
|
55
|
+
| `submitLabel?` | `string` | `(mode === 'sign-up' ? 'Sign up' : 'Sign in')` | Submit text; `Sign in` / `Sign up` by default (untranslated). |
|
|
56
|
+
| `emailPlaceholder?` | `string` | — | Placeholder of the email field. |
|
|
57
|
+
| `passwordPlaceholder?` | `string` | — | Placeholder of the password field. |
|
|
58
|
+
| `extraTpl?` | `ReactNode` | — | Extra content (e.g. a "remember me" checkbox or terms). |
|
|
59
|
+
| `ariaLabel?` | `string` | — | Accessible name of the form. |
|
|
60
|
+
|
|
61
|
+
### `ISignInFormSubmit`
|
|
62
|
+
|
|
63
|
+
| Field | Type | Default | Description |
|
|
64
|
+
| ---------- | --------------------- | -------- | ------------------- |
|
|
65
|
+
| `email` | `string` | required | The typed email. |
|
|
66
|
+
| `password` | `string` | required | The typed password. |
|
|
67
|
+
| `mode` | `SmartSignInFormMode` | required | The form mode. |
|
|
68
|
+
|
|
69
|
+
### `ISignInFormSocialClick`
|
|
70
|
+
|
|
71
|
+
| Field | Type | Default | Description |
|
|
72
|
+
| ------------ | --------------------- | -------- | --------------------------------- |
|
|
73
|
+
| `providerId` | `string` | required | The `id` of the clicked provider. |
|
|
74
|
+
| `mode` | `SmartSignInFormMode` | required | The form mode. |
|
|
75
|
+
|
|
76
|
+
### `ISocialProvider`
|
|
77
|
+
|
|
78
|
+
| Field | Type | Default | Description |
|
|
79
|
+
| ---------- | ----------- | -------- | ------------------------- |
|
|
80
|
+
| `id` | `string` | required | Reported as `providerId`. |
|
|
81
|
+
| `label` | `string` | required | Button text. |
|
|
82
|
+
| `iconTpl?` | `ReactNode` | — | Icon node. |
|
|
83
|
+
| `iconUrl?` | `string` | — | Icon image. |
|
|
84
|
+
|
|
85
|
+
### Related types
|
|
86
|
+
|
|
87
|
+
- `SmartSignInFormMode`: `'sign-in' \| 'sign-up'`
|
|
88
|
+
- `SmartSignInFormLayout`: `'simple' \| 'simple-no-labels' \| 'split-screen' \| 'card'`
|
|
89
|
+
|
|
90
|
+
## Usage
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { useState } from 'react';
|
|
94
|
+
|
|
95
|
+
import {
|
|
96
|
+
IAuthToken,
|
|
97
|
+
SmartSignInFormPreset,
|
|
98
|
+
useAuthService,
|
|
99
|
+
useNavigation,
|
|
100
|
+
} from '@smartsoft001/react';
|
|
101
|
+
|
|
102
|
+
// `requestToken` is the application's call to its auth endpoint.
|
|
103
|
+
export function LoginScreen({
|
|
104
|
+
requestToken,
|
|
105
|
+
}: {
|
|
106
|
+
requestToken: (email: string, password: string) => Promise<IAuthToken | null>;
|
|
107
|
+
}) {
|
|
108
|
+
const auth = useAuthService();
|
|
109
|
+
const navigation = useNavigation();
|
|
110
|
+
const [busy, setBusy] = useState(false);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<SmartSignInFormPreset
|
|
114
|
+
disabled={busy}
|
|
115
|
+
options={{
|
|
116
|
+
layout: 'card',
|
|
117
|
+
forgotPasswordHref: '/forgot',
|
|
118
|
+
signUpHref: '/sign-up',
|
|
119
|
+
socialProviders: [{ id: 'google', label: 'Continue with Google' }],
|
|
120
|
+
}}
|
|
121
|
+
onSubmit={async ({ email, password }) => {
|
|
122
|
+
setBusy(true);
|
|
123
|
+
try {
|
|
124
|
+
const token = await requestToken(email, password);
|
|
125
|
+
if (token) {
|
|
126
|
+
auth.setToken(token); // stored under AUTH_TOKEN; the HTTP client sends it as a bearer token
|
|
127
|
+
navigation.navigate('/');
|
|
128
|
+
}
|
|
129
|
+
} finally {
|
|
130
|
+
setBusy(false);
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
onSocialClick={({ providerId }) =>
|
|
134
|
+
window.location.assign(`/auth/${providerId}`)
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Replacing the Implementation
|
|
142
|
+
|
|
143
|
+
`SmartSignInForm` renders the component registered under the `'sign-in-form'` key of `SmartProvider`'s `components`, and `SmartSignInFormStandard` when nothing is registered there. Every `SmartSignInForm` below the provider then renders the registered component, which receives the same props.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import type { ReactNode } from 'react';
|
|
147
|
+
|
|
148
|
+
import { SmartProvider, SmartSignInFormPreset } from '@smartsoft001/react';
|
|
149
|
+
|
|
150
|
+
// A module constant: a new object on every render would change the context.
|
|
151
|
+
const components = { 'sign-in-form': SmartSignInFormPreset };
|
|
152
|
+
|
|
153
|
+
export function AppProviders({ children }: { children: ReactNode }) {
|
|
154
|
+
return <SmartProvider components={components}>{children}</SmartProvider>;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`SmartSignInFormPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartSignInForm`, 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.
|
|
159
|
+
|
|
160
|
+
### The `useSignInForm` hook
|
|
161
|
+
|
|
162
|
+
The form logic every sign-in form variant shares: the typed email and password, `submit()` reporting them with the mode, and `socialClick()`; both are ignored while `disabled`.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
function useSignInForm({
|
|
166
|
+
mode = 'sign-in',
|
|
167
|
+
disabled = false,
|
|
168
|
+
onSubmit,
|
|
169
|
+
onSocialClick,
|
|
170
|
+
}: SmartSignInFormProps);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
| Returns | Type | Description |
|
|
174
|
+
| ------------- | --------------------------------------------- | --------------------------------------------------------------------------- |
|
|
175
|
+
| `email` | `string` | The typed email. |
|
|
176
|
+
| `setEmail` | `Dispatch<SetStateAction<string>>` | Sets the email. |
|
|
177
|
+
| `password` | `string` | The typed password. |
|
|
178
|
+
| `setPassword` | `Dispatch<SetStateAction<string>>` | Sets the password. |
|
|
179
|
+
| `submit` | `(event: FormEvent<HTMLFormElement>) => void` | The form's `onSubmit` handler: prevents the default and reports `onSubmit`. |
|
|
180
|
+
| `socialClick` | `(providerId: string) => void` | Reports `onSocialClick` for a provider. |
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { SmartSignInFormProps, useSignInForm } from '@smartsoft001/react';
|
|
184
|
+
|
|
185
|
+
export function InlineSignIn(props: SmartSignInFormProps) {
|
|
186
|
+
const { email, setEmail, password, setPassword, submit } =
|
|
187
|
+
useSignInForm(props);
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<form
|
|
191
|
+
onSubmit={submit}
|
|
192
|
+
aria-label={props.options?.ariaLabel}
|
|
193
|
+
className={props.className}
|
|
194
|
+
>
|
|
195
|
+
<input
|
|
196
|
+
type="email"
|
|
197
|
+
value={email}
|
|
198
|
+
placeholder="Email"
|
|
199
|
+
onChange={(event) => setEmail(event.target.value)}
|
|
200
|
+
/>
|
|
201
|
+
<input
|
|
202
|
+
type="password"
|
|
203
|
+
value={password}
|
|
204
|
+
placeholder="Password"
|
|
205
|
+
onChange={(event) => setPassword(event.target.value)}
|
|
206
|
+
/>
|
|
207
|
+
<button type="submit" disabled={props.disabled}>
|
|
208
|
+
{props.options?.submitLabel ?? 'Sign in'}
|
|
209
|
+
</button>
|
|
210
|
+
</form>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Styling
|
|
216
|
+
|
|
217
|
+
- The standard form is unstyled (class hooks such as `forgot-password`, `alt-link`, `extra`); `SmartSignInFormPreset` renders the four layouts with `smart:dark:` variants, `className` merged into its container.
|
|
218
|
+
|
|
219
|
+
## File Locations
|
|
220
|
+
|
|
221
|
+
Source: `packages/shared/react/src/lib/components/sign-in-form/` in the smartsoft001 repository.
|
|
222
|
+
|
|
223
|
+
- `preset/sign-in-form-preset.tsx`: `SmartSignInFormPreset`
|
|
224
|
+
- `sign-in-form.tsx`: `SmartSignInForm`
|
|
225
|
+
- `sign-in-form.types.ts`: `SmartSignInFormProps`
|
|
226
|
+
- `standard/sign-in-form-standard.tsx`: `SmartSignInFormStandard`
|
|
227
|
+
- `use-sign-in-form.ts`: `useSignInForm`
|
|
228
|
+
- `sign-in-form.stories.tsx`: Storybook stories
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-components-stacked-layout
|
|
3
|
+
description: SmartStackedLayout React component API (@smartsoft001/react) — top-navigation page shell with a nav slot, a header (or title) and the main content (children) in a container of sm/md/lg/xl/full width, the 'stacked-layout' registry key and SmartStackedLayoutPreset.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stacked Layout (`SmartStackedLayout`)
|
|
8
|
+
|
|
9
|
+
`SmartStackedLayout` stacks a page vertically: navigation on top (`options.navTpl`, typically `SmartNavbar`), a header (`headerTpl`, or `title` as a fallback) and the main content (`children`). `options.containerWidth` sets the width of the content container in the preset (`xl` by default; the standard exposes it as `data-container-width`). The preset wraps `children` in a bordered content card.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- An application or page shell with a top navbar and a page title
|
|
14
|
+
- A dashboard page whose content sits in a centred container
|
|
15
|
+
- Restyling every stacked layout (the `stacked-layout` registry key)
|
|
16
|
+
|
|
17
|
+
For a sidebar shell see `react-components-sidebar-layout`; for several columns, `react-components-multi-column-layout`.
|
|
18
|
+
|
|
19
|
+
## Exports
|
|
20
|
+
|
|
21
|
+
All from `@smartsoft001/react`.
|
|
22
|
+
|
|
23
|
+
| Export | Kind | What it is |
|
|
24
|
+
| ---------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
25
|
+
| `SmartStackedLayout` | component | Renders the implementation registered as `components['stacked-layout']` on `SmartProvider`, `SmartStackedLayoutStandard` by default. |
|
|
26
|
+
| `SmartStackedLayoutPreset` | component | HyperUI-styled stacked-layout variation (preset). |
|
|
27
|
+
| `SmartStackedLayoutStandard` | component | Barebones native-HTML stacked layout. |
|
|
28
|
+
|
|
29
|
+
The preset's class helpers (`getStackedLayoutRootClasses`, `getStackedLayoutHeaderZoneClasses`, `getStackedLayoutContainerClasses`, `getStackedLayoutTitleClasses`, `getStackedLayoutContentCardClasses`) are exported too, for a custom implementation that wants the preset look.
|
|
30
|
+
|
|
31
|
+
## Props and Types
|
|
32
|
+
|
|
33
|
+
### `SmartStackedLayoutProps`
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ------------ | ----------------------- | ------- | ----------------------------- |
|
|
37
|
+
| `options?` | `IStackedLayoutOptions` | — | Navigation, header and width. |
|
|
38
|
+
| `className?` | `string` | — | Classes on the root element. |
|
|
39
|
+
| `children?` | `ReactNode` | — | The main content. |
|
|
40
|
+
|
|
41
|
+
### `IStackedLayoutOptions`
|
|
42
|
+
|
|
43
|
+
| Field | Type | Default | Description |
|
|
44
|
+
| ----------------- | ---------------------------------- | ------- | ------------------------------------------------------------------ |
|
|
45
|
+
| `title?` | `string` | — | Page title (`<h1 data-role="title">`) when `headerTpl` is not set. |
|
|
46
|
+
| `navTpl?` | `ReactNode` | — | Navigation at the top. |
|
|
47
|
+
| `headerTpl?` | `ReactNode` | — | The header; wins over `title`. |
|
|
48
|
+
| `containerWidth?` | `SmartStackedLayoutContainerWidth` | `'xl'` | Width of the content container (preset). |
|
|
49
|
+
|
|
50
|
+
### Related types
|
|
51
|
+
|
|
52
|
+
- `SmartStackedLayoutContainerWidth`: `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'`
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import type { ReactNode } from 'react';
|
|
58
|
+
|
|
59
|
+
import { SmartNavbar, SmartStackedLayoutPreset } from '@smartsoft001/react';
|
|
60
|
+
|
|
61
|
+
export function DashboardLayout({ children }: { children: ReactNode }) {
|
|
62
|
+
return (
|
|
63
|
+
<SmartStackedLayoutPreset
|
|
64
|
+
options={{
|
|
65
|
+
title: 'Dashboard',
|
|
66
|
+
containerWidth: 'lg',
|
|
67
|
+
navTpl: (
|
|
68
|
+
<SmartNavbar
|
|
69
|
+
options={{
|
|
70
|
+
items: [
|
|
71
|
+
{
|
|
72
|
+
id: 'dashboard',
|
|
73
|
+
label: 'Dashboard',
|
|
74
|
+
href: '/',
|
|
75
|
+
current: true,
|
|
76
|
+
},
|
|
77
|
+
{ id: 'reports', label: 'Reports', href: '/reports' },
|
|
78
|
+
],
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
),
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</SmartStackedLayoutPreset>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Replacing the Implementation
|
|
91
|
+
|
|
92
|
+
`SmartStackedLayout` renders the component registered under the `'stacked-layout'` key of `SmartProvider`'s `components`, and `SmartStackedLayoutStandard` when nothing is registered there. Every `SmartStackedLayout` below the provider then renders the registered component, which receives the same props.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import type { ReactNode } from 'react';
|
|
96
|
+
|
|
97
|
+
import { SmartProvider, SmartStackedLayoutPreset } from '@smartsoft001/react';
|
|
98
|
+
|
|
99
|
+
// A module constant: a new object on every render would change the context.
|
|
100
|
+
const components = { 'stacked-layout': SmartStackedLayoutPreset };
|
|
101
|
+
|
|
102
|
+
export function AppProviders({ children }: { children: ReactNode }) {
|
|
103
|
+
return <SmartProvider components={components}>{children}</SmartProvider>;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`SmartStackedLayoutPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartStackedLayout`, or spread `SMART_PRESET_COMPONENTS` on the provider to register every preset at once (see the `react-provider` skill). Pass `components` as a stable object (a module constant or a memoised value), or the context changes on every render.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { SmartStackedLayoutProps } from '@smartsoft001/react';
|
|
111
|
+
|
|
112
|
+
export function PlainStackedLayout({
|
|
113
|
+
options,
|
|
114
|
+
className,
|
|
115
|
+
children,
|
|
116
|
+
}: SmartStackedLayoutProps) {
|
|
117
|
+
return (
|
|
118
|
+
<div className={className}>
|
|
119
|
+
{options?.navTpl}
|
|
120
|
+
{options?.headerTpl ?? <h1>{options?.title}</h1>}
|
|
121
|
+
<main
|
|
122
|
+
style={{
|
|
123
|
+
maxWidth: options?.containerWidth === 'full' ? undefined : '80rem',
|
|
124
|
+
margin: '0 auto',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
{children}
|
|
128
|
+
</main>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Styling
|
|
135
|
+
|
|
136
|
+
- The standard rendering is barebones HTML (`header > nav`, `main`, `data-container-width`); the preset adds the gray page, the white header zone and the content card, with `smart:dark:` variants.
|
|
137
|
+
|
|
138
|
+
## File Locations
|
|
139
|
+
|
|
140
|
+
Source: `packages/shared/react/src/lib/components/stacked-layout/` in the smartsoft001 repository.
|
|
141
|
+
|
|
142
|
+
- `preset/stacked-layout-preset.tsx`: `SmartStackedLayoutPreset`
|
|
143
|
+
- `stacked-layout.tsx`: `SmartStackedLayout`
|
|
144
|
+
- `stacked-layout.types.ts`: `SmartStackedLayoutProps`
|
|
145
|
+
- `standard/stacked-layout-standard.tsx`: `SmartStackedLayoutStandard`
|
|
146
|
+
- `stacked-layout.stories.tsx`: Storybook stories
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-components-stacked-list
|
|
3
|
+
description: SmartStackedList React component API (@smartsoft001/react) — vertical list of rows with avatar or icon, title link, description, meta, badge and action slots, dividers and full-width-on-mobile hints, empty and footer slots, the 'stacked-list' registry key and SmartStackedListPreset.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stacked List (`SmartStackedList`)
|
|
8
|
+
|
|
9
|
+
`SmartStackedList` renders a vertical list of rows from data you hold: each row has a leading avatar (`avatarUrl`) or icon (`iconTpl` wins), a title (a link when `href` is set), a description and a meta line, and trailing badge and action slots. `withDividers` and `fullWidthOnMobile` are layout hints honoured by `SmartStackedListPreset`; the standard rendering is unstyled. `emptyTpl` replaces the rows when there are none.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- A list of people, projects or messages with avatars and actions
|
|
14
|
+
- A simple list from data the page already has (no model metadata)
|
|
15
|
+
- Restyling every stacked list (the `stacked-list` registry key)
|
|
16
|
+
|
|
17
|
+
For a list of model records with sorting, 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
|
+
| `SmartStackedList` | component | Renders the implementation registered as `components['stacked-list']` on `SmartProvider`, `SmartStackedListStandard` by default. |
|
|
26
|
+
| `SmartStackedListPreset` | component | Styled stacked list variation (preset). |
|
|
27
|
+
| `SmartStackedListStandard` | component | The default stacked-list rendering: one `li.item` per item (icon template > avatar, title as a link when `href` is set, description, meta, badge and action slots), the `emptyTpl` when there are no items, then the `footerTpl` slot. |
|
|
28
|
+
|
|
29
|
+
The preset's class helpers (`getStackedListRootClasses`, `getStackedListListClasses`, `getStackedListItemClasses`, `STACKED_LIST_ROOT`, `STACKED_LIST_TITLE`, `STACKED_LIST_DESCRIPTION`, `STACKED_LIST_HEADER`, `STACKED_LIST_DIVIDERS`, `STACKED_LIST_FULL_WIDTH_CARD`, `STACKED_LIST_ITEM`, `STACKED_LIST_ITEM_CARD_PADDING`, `STACKED_LIST_LEAD`, `STACKED_LIST_AVATAR`, `STACKED_LIST_ICON`, `STACKED_LIST_BODY`, `STACKED_LIST_ITEM_TITLE`, `STACKED_LIST_ITEM_TITLE_LINK`, `STACKED_LIST_ITEM_DESCRIPTION`, `STACKED_LIST_ITEM_META`, `STACKED_LIST_TRAIL`, `STACKED_LIST_EMPTY`, `STACKED_LIST_FOOTER`) are exported too, for a custom implementation that wants the preset look.
|
|
30
|
+
|
|
31
|
+
## Props and Types
|
|
32
|
+
|
|
33
|
+
### `SmartStackedListProps`
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ------------ | --------------------- | ------- | ---------------------------- |
|
|
37
|
+
| `options?` | `IStackedListOptions` | — | Header, rows and hints. |
|
|
38
|
+
| `className?` | `string` | — | Classes on the root element. |
|
|
39
|
+
|
|
40
|
+
### `IStackedListOptions`
|
|
41
|
+
|
|
42
|
+
| Field | Type | Default | Description |
|
|
43
|
+
| -------------------- | -------------------- | ------- | ------------------------------------------------------------------------------------- |
|
|
44
|
+
| `title?` | `string` | — | Heading above the list. |
|
|
45
|
+
| `description?` | `string` | — | Text under the heading. |
|
|
46
|
+
| `items?` | `IStackedListItem[]` | `[]` | The rows. |
|
|
47
|
+
| `withDividers?` | `boolean` | — | Preset: hairlines between rows. |
|
|
48
|
+
| `fullWidthOnMobile?` | `boolean` | — | Preset: a card that bleeds to the screen edge below `sm` and is rounded from `sm` up. |
|
|
49
|
+
| `emptyTpl?` | `ReactNode` | — | Shown when there are no rows. |
|
|
50
|
+
| `footerTpl?` | `ReactNode` | — | A slot below the list. |
|
|
51
|
+
|
|
52
|
+
### `IStackedListItem`
|
|
53
|
+
|
|
54
|
+
| Field | Type | Default | Description |
|
|
55
|
+
| -------------- | ----------- | -------- | ------------------------------------- |
|
|
56
|
+
| `id?` | `string` | — | Key of the row. |
|
|
57
|
+
| `title` | `string` | required | Row title; a link when `href` is set. |
|
|
58
|
+
| `description?` | `string` | — | Second line. |
|
|
59
|
+
| `meta?` | `string` | — | Small extra line (date, role). |
|
|
60
|
+
| `avatarUrl?` | `string` | — | Leading avatar. |
|
|
61
|
+
| `iconTpl?` | `ReactNode` | — | Leading icon; wins over `avatarUrl`. |
|
|
62
|
+
| `href?` | `string` | — | Makes the title a link. |
|
|
63
|
+
| `badgeTpl?` | `ReactNode` | — | Trailing badge. |
|
|
64
|
+
| `actionTpl?` | `ReactNode` | — | Trailing action. |
|
|
65
|
+
| `ariaLabel?` | `string` | — | Accessible name of the row. |
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { SmartBadgePreset, SmartStackedListPreset } from '@smartsoft001/react';
|
|
71
|
+
|
|
72
|
+
export function Members() {
|
|
73
|
+
return (
|
|
74
|
+
<SmartStackedListPreset
|
|
75
|
+
options={{
|
|
76
|
+
title: 'Team members',
|
|
77
|
+
withDividers: true,
|
|
78
|
+
items: [
|
|
79
|
+
{
|
|
80
|
+
id: '1',
|
|
81
|
+
title: 'Lindsay Walton',
|
|
82
|
+
description: 'lindsay.walton@example.com',
|
|
83
|
+
meta: 'Joined 12 January 2026',
|
|
84
|
+
avatarUrl: '/avatars/lindsay.jpg',
|
|
85
|
+
badgeTpl: <SmartBadgePreset text="Admin" color="indigo" />,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: '2',
|
|
89
|
+
title: 'Courtney Henry',
|
|
90
|
+
description: 'courtney.henry@example.com',
|
|
91
|
+
href: '/members/2',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
emptyTpl: <p>No members yet.</p>,
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Replacing the Implementation
|
|
102
|
+
|
|
103
|
+
`SmartStackedList` renders the component registered under the `'stacked-list'` key of `SmartProvider`'s `components`, and `SmartStackedListStandard` when nothing is registered there. Every `SmartStackedList` below the provider then renders the registered component, which receives the same props.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import type { ReactNode } from 'react';
|
|
107
|
+
|
|
108
|
+
import { SmartProvider, SmartStackedListPreset } from '@smartsoft001/react';
|
|
109
|
+
|
|
110
|
+
// A module constant: a new object on every render would change the context.
|
|
111
|
+
const components = { 'stacked-list': SmartStackedListPreset };
|
|
112
|
+
|
|
113
|
+
export function AppProviders({ children }: { children: ReactNode }) {
|
|
114
|
+
return <SmartProvider components={components}>{children}</SmartProvider>;
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`SmartStackedListPreset` is the styled (preset) implementation: register it as above, render it directly in place of `SmartStackedList`, 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.
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { SmartStackedListProps } from '@smartsoft001/react';
|
|
122
|
+
|
|
123
|
+
export function CompactStackedList({
|
|
124
|
+
options,
|
|
125
|
+
className,
|
|
126
|
+
}: SmartStackedListProps) {
|
|
127
|
+
const items = options?.items ?? [];
|
|
128
|
+
|
|
129
|
+
if (!items.length) return <>{options?.emptyTpl}</>;
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<ul className={className}>
|
|
133
|
+
{items.map((item, index) => (
|
|
134
|
+
<li key={item.id ?? index} aria-label={item.ariaLabel}>
|
|
135
|
+
{item.href ? <a href={item.href}>{item.title}</a> : item.title}{' '}
|
|
136
|
+
{item.badgeTpl} {item.actionTpl}
|
|
137
|
+
</li>
|
|
138
|
+
))}
|
|
139
|
+
</ul>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Styling
|
|
145
|
+
|
|
146
|
+
- The standard rendering is unstyled (`li.item` per row); the preset carries the Tailwind UI look with `smart:dark:` variants.
|
|
147
|
+
|
|
148
|
+
## File Locations
|
|
149
|
+
|
|
150
|
+
Source: `packages/shared/react/src/lib/components/stacked-list/` in the smartsoft001 repository.
|
|
151
|
+
|
|
152
|
+
- `preset/stacked-list-preset.tsx`: `SmartStackedListPreset`
|
|
153
|
+
- `stacked-list.tsx`: `SmartStackedList`
|
|
154
|
+
- `stacked-list.types.ts`: `SmartStackedListProps`
|
|
155
|
+
- `standard/stacked-list-standard.tsx`: `SmartStackedListStandard`
|
|
156
|
+
- `stacked-list.stories.tsx`: Storybook stories
|