@molecule/app-auth-shell-react 1.0.0 → 1.0.2
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/README.md +585 -0
- package/package.json +18 -11
package/README.md
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:50:06.638Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-auth-shell-react
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
`@molecule/app-auth-shell-react` — centered glassmorphic shell for
|
|
16
|
+
auth pages (Login, Signup, ForgotPassword, ResetPassword).
|
|
17
|
+
|
|
18
|
+
Apps pass per-app `decoration` (orbs, gradient backdrop) and
|
|
19
|
+
`brand` (logo + tagline) as ReactNode props. The shell handles
|
|
20
|
+
layout, the glass card, heading/subheading, body slot, footer,
|
|
21
|
+
and the "Back to home" link.
|
|
22
|
+
|
|
23
|
+
The shell also wraps its content in an `<AuthFormStateProvider>`, so
|
|
24
|
+
any form rendered inside inherits cross-view email persistence — the
|
|
25
|
+
email typed on one auth view (Login/Signup/Forgot/Reset) is carried to
|
|
26
|
+
the next and cleared on successful auth. Forms read it via
|
|
27
|
+
`useAuthFormStateContext()`; the underlying `useAuthFormState` hook is
|
|
28
|
+
also exported for standalone use. Persistence flows through the
|
|
29
|
+
`@molecule/app-storage` `StorageProvider` abstraction (never raw
|
|
30
|
+
`sessionStorage`), defaulting to a process-shared in-memory store.
|
|
31
|
+
|
|
32
|
+
Besides the `AuthShell` preset, the package exports the composable
|
|
33
|
+
primitives it is built from — `AuthShellContainer`, `AuthShellDecoration`,
|
|
34
|
+
`AuthShellCard`, `AuthShellHeading`, `AuthShellFooter`, `AuthShellBackLink` —
|
|
35
|
+
plus a two-column family for the "brand panel + form card" split layout:
|
|
36
|
+
`AuthShellSplit` > `AuthShellSplitRow` > (`AuthShellPanel` + `AuthShellCardColumn`).
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { AuthShell, useAuthFormStateContext } from '@molecule/app-auth-shell-react'
|
|
42
|
+
import { createSessionStorageProvider } from '@molecule/app-storage-localstorage'
|
|
43
|
+
import { AuthBrandHeader } from './AuthBrandHeader.js'
|
|
44
|
+
import { Orbs } from './Orbs.js'
|
|
45
|
+
|
|
46
|
+
const sessionStore = createSessionStorageProvider({ prefix: 'auth_' })
|
|
47
|
+
|
|
48
|
+
function LoginForm() {
|
|
49
|
+
const { fields, setField, clear } = useAuthFormStateContext()
|
|
50
|
+
// bind <input value={fields.email} onChange={(e) => setField('email', e.target.value)} />
|
|
51
|
+
// call clear() after a successful sign-in
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function Login() {
|
|
55
|
+
return (
|
|
56
|
+
<AuthShell
|
|
57
|
+
heading="Sign in"
|
|
58
|
+
subheading="Welcome back."
|
|
59
|
+
brand={<AuthBrandHeader />}
|
|
60
|
+
decoration={<Orbs />}
|
|
61
|
+
formStateStorage={sessionStore}
|
|
62
|
+
footer={
|
|
63
|
+
<p>
|
|
64
|
+
No account? <Link to="/signup">Sign up</Link>
|
|
65
|
+
</p>
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
<LoginForm />
|
|
69
|
+
</AuthShell>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Type
|
|
75
|
+
|
|
76
|
+
`feature`
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install @molecule/app-auth-shell-react @molecule/app-logger @molecule/app-react @molecule/app-storage @molecule/app-ui react react-router
|
|
82
|
+
npm install -D @types/react
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
|
|
87
|
+
### Interfaces
|
|
88
|
+
|
|
89
|
+
#### `AuthFormFields`
|
|
90
|
+
|
|
91
|
+
Shared auth form field values. `email` is the canonical cross-view
|
|
92
|
+
field; additional string fields (e.g. a name carried from Signup) may
|
|
93
|
+
be stored alongside it.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
interface AuthFormFields {
|
|
97
|
+
/** Email address, shared across all auth views. */
|
|
98
|
+
email?: string
|
|
99
|
+
/** Any other shared string field (e.g. `name`). */
|
|
100
|
+
[field: string]: string | undefined
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### `AuthFormState`
|
|
105
|
+
|
|
106
|
+
The value returned by {@link useAuthFormState} (and provided through
|
|
107
|
+
the AuthShell form-state context).
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
interface AuthFormState {
|
|
111
|
+
/** Current field values (email + any shared fields). */
|
|
112
|
+
fields: AuthFormFields
|
|
113
|
+
/**
|
|
114
|
+
* `true` once the initial read from storage has completed. Useful for
|
|
115
|
+
* deferring autofocus/validation until persisted values are loaded.
|
|
116
|
+
*/
|
|
117
|
+
hydrated: boolean
|
|
118
|
+
/** Sets a single field and persists the new state. */
|
|
119
|
+
setField: (name: string, value: string) => void
|
|
120
|
+
/** Merges a patch of fields and persists the new state. */
|
|
121
|
+
setFields: (patch: AuthFormFields) => void
|
|
122
|
+
/**
|
|
123
|
+
* Clears all persisted auth form state and removes the storage key.
|
|
124
|
+
* Call this from the successful-auth handler.
|
|
125
|
+
*/
|
|
126
|
+
clear: () => void
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### `AuthFormStateProviderProps`
|
|
131
|
+
|
|
132
|
+
Props for {@link AuthFormStateProvider}.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
interface AuthFormStateProviderProps {
|
|
136
|
+
children: ReactNode
|
|
137
|
+
/** Storage provider backing persistence (defaults to a shared in-memory provider). */
|
|
138
|
+
storage?: StorageProvider
|
|
139
|
+
/** Storage key for the persisted fields. */
|
|
140
|
+
storageKey?: string
|
|
141
|
+
/** Seed values used before hydration / when storage is empty. */
|
|
142
|
+
initialFields?: AuthFormFields
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### `AuthShellBackLinkProps`
|
|
147
|
+
|
|
148
|
+
"Back to home" link (or custom destination) rendered below the card.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
interface AuthShellBackLinkProps {
|
|
152
|
+
to?: string
|
|
153
|
+
/** Translated label override; falls back to `auth.backHome` → "Back to home". */
|
|
154
|
+
label?: string
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### `AuthShellCardColumnProps`
|
|
159
|
+
|
|
160
|
+
A `<section>` (or `<main>`, via `as`) that centers its children on
|
|
161
|
+
both axes — the form-card half of `<AuthShellSplit>`, or the centered
|
|
162
|
+
content column of a header / main / footer stacked auth layout.
|
|
163
|
+
Provides only the `flex` centering; pass `className` for width ratio,
|
|
164
|
+
padding, and `flex-1`.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
interface AuthShellCardColumnProps extends HTMLAttributes<HTMLElement> {
|
|
168
|
+
children: ReactNode
|
|
169
|
+
/** Cosmetic classes — width ratio, padding. */
|
|
170
|
+
className?: string
|
|
171
|
+
/**
|
|
172
|
+
* Element to render. Defaults to `'section'`; pass `'main'` when the
|
|
173
|
+
* card column is the auth page's primary content landmark — i.e. the
|
|
174
|
+
* shell is not already wrapped in `<AuthShellSplitRow>` (which is
|
|
175
|
+
* itself a `<main>`, so nesting another would be invalid).
|
|
176
|
+
*/
|
|
177
|
+
as?: 'section' | 'main'
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### `AuthShellCardProps`
|
|
182
|
+
|
|
183
|
+
The centered glassmorphic card surface. Layout (flex column + padding)
|
|
184
|
+
is fixed; the visible surface (rounded / bg / border / shadow) is the
|
|
185
|
+
default glass treatment, replaceable per-app via `surfaceClassName`.
|
|
186
|
+
|
|
187
|
+
Pass `outerClassName` to override the outer `<main>` width / max-width
|
|
188
|
+
constraint (default `max-w-md`).
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
interface AuthShellCardProps {
|
|
192
|
+
children: ReactNode
|
|
193
|
+
/** Override the default glass surface (rounded + bg + border + shadow). */
|
|
194
|
+
surfaceClassName?: string
|
|
195
|
+
/** Extra layout classes to append (after flex/padding defaults). */
|
|
196
|
+
className?: string
|
|
197
|
+
/** Override the outer `<main>` wrapper classes (defaults to `cm.w('full') max-w-md relative z-10`). */
|
|
198
|
+
outerClassName?: string
|
|
199
|
+
/** data-mol-id pass-through for E2E selectors. */
|
|
200
|
+
dataMolId?: string
|
|
201
|
+
style?: CSSProperties
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### `AuthShellContainerProps`
|
|
206
|
+
|
|
207
|
+
Outer full-screen container — centered Flex, padded, with optional
|
|
208
|
+
absolute-positioned background decoration child.
|
|
209
|
+
|
|
210
|
+
Compose with `<AuthShellCard>` (and friends) inside.
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
interface AuthShellContainerProps {
|
|
214
|
+
children: ReactNode
|
|
215
|
+
/** Optional CSS background applied to the container. */
|
|
216
|
+
style?: CSSProperties
|
|
217
|
+
/** Optional extra className appended after defaults. */
|
|
218
|
+
className?: string
|
|
219
|
+
/** Layout direction. Defaults to centered-Flex; pass `'column'` for a vertical stack (top-bar / main / footer). */
|
|
220
|
+
layout?: 'centered' | 'column'
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### `AuthShellHeadingProps`
|
|
225
|
+
|
|
226
|
+
Heading block — optional eyebrow + h1 + optional subheading. All centered.
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
interface AuthShellHeadingProps {
|
|
230
|
+
heading: string
|
|
231
|
+
subheading?: string
|
|
232
|
+
/** Optional small uppercase tag rendered above the heading. */
|
|
233
|
+
eyebrow?: string
|
|
234
|
+
/** Optional override for the h1 className (e.g. custom font-family). */
|
|
235
|
+
headingClassName?: string
|
|
236
|
+
/** Optional override for the h1 style. */
|
|
237
|
+
headingStyle?: CSSProperties
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### `AuthShellPanelProps`
|
|
242
|
+
|
|
243
|
+
A decorative `<aside>` that collapses on mobile (`hidden lg:flex`, the
|
|
244
|
+
one universally-shared concern) — the brand-panel half of
|
|
245
|
+
`<AuthShellSplit>`, or the decorative column of any grid-based auth
|
|
246
|
+
layout. Fill it with the app's bespoke decoration, wordmark, social
|
|
247
|
+
proof, etc. Pass `className` for width ratio, padding, gradient, and
|
|
248
|
+
positioning; extra props (`style`, `aria-*`, `data-*`) pass through to
|
|
249
|
+
the `<aside>`.
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
interface AuthShellPanelProps extends HTMLAttributes<HTMLElement> {
|
|
253
|
+
children: ReactNode
|
|
254
|
+
/** Cosmetic classes — width ratio, padding, gradient, positioning. */
|
|
255
|
+
className?: string
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### `AuthShellProps`
|
|
260
|
+
|
|
261
|
+
Convenience preset for the most common layout: centered glass card
|
|
262
|
+
with optional decoration, brand panel, heading, body, footer, and a
|
|
263
|
+
"Back to home" link below the card. Equivalent to manually composing
|
|
264
|
+
`<AuthShellContainer>` + `<AuthShellDecoration>` + `<AuthShellCard>`
|
|
265
|
+
|
|
266
|
+
- `<AuthShellHeading>` + `<AuthShellFooter>` + `<AuthShellBackLink>`.
|
|
267
|
+
|
|
268
|
+
For the two-column "brand panel + card" shape, use `<AuthShellSplit>`
|
|
269
|
+
|
|
270
|
+
- `<AuthShellPanel>` + `<AuthShellCardColumn>` instead.
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
interface AuthShellProps {
|
|
274
|
+
heading: string
|
|
275
|
+
subheading: string
|
|
276
|
+
children: ReactNode
|
|
277
|
+
footer?: ReactNode
|
|
278
|
+
brand?: ReactNode
|
|
279
|
+
decoration?: ReactNode
|
|
280
|
+
backTo?: string
|
|
281
|
+
showBackLink?: boolean
|
|
282
|
+
/**
|
|
283
|
+
* Storage provider backing the cross-view auth form persistence
|
|
284
|
+
* (email shared across Login/Signup/Forgot/Reset, cleared on success).
|
|
285
|
+
* Defaults to a process-shared in-memory store; inject
|
|
286
|
+
* `createSessionStorageProvider()` from
|
|
287
|
+
* `@molecule/app-storage-localstorage` for tab-scoped persistence. The
|
|
288
|
+
* shell renders an `<AuthFormStateProvider>`, so forms inside read it
|
|
289
|
+
* via `useAuthFormStateContext()`.
|
|
290
|
+
*/
|
|
291
|
+
formStateStorage?: StorageProvider
|
|
292
|
+
/** Storage key for the persisted auth form state. */
|
|
293
|
+
formStateKey?: string
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### `AuthShellSplitProps`
|
|
298
|
+
|
|
299
|
+
Outer frame for the two-column "decorated brand panel + card" auth
|
|
300
|
+
layout — the dominant shape across the fleet's polished auth pages.
|
|
301
|
+
|
|
302
|
+
A `min-h-screen` vertical stack: compose an `<AuthShellSplitRow>` (the
|
|
303
|
+
brand-panel + card-column row) as a child, and optionally a site
|
|
304
|
+
`<Footer />` after it. The row flexes to fill, so the footer sits at
|
|
305
|
+
the bottom.
|
|
306
|
+
|
|
307
|
+
Provides only the structural concern (`flex-col` + `min-h-screen`).
|
|
308
|
+
Background, text color, and font are per-app — pass them via
|
|
309
|
+
`className`.
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
interface AuthShellSplitProps extends HTMLAttributes<HTMLDivElement> {
|
|
313
|
+
children: ReactNode
|
|
314
|
+
/** Cosmetic classes (background, text color, font) for the outer container. */
|
|
315
|
+
className?: string
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### `AuthShellSplitRowProps`
|
|
320
|
+
|
|
321
|
+
The vertically-flexed two-column row inside `<AuthShellSplit>` —
|
|
322
|
+
compose `<AuthShellPanel>` and `<AuthShellCardColumn>` as its
|
|
323
|
+
children. Split out from `<AuthShellSplit>` so a site `<Footer />`
|
|
324
|
+
can sit below the row as a sibling child rather than a slot prop.
|
|
325
|
+
|
|
326
|
+
Provides only the `flex-1` vertical fill (so the row stretches and
|
|
327
|
+
any sibling footer sits at the bottom). The two-column layout itself
|
|
328
|
+
is the caller's choice — pass `className` with `cm.flex({})` for a
|
|
329
|
+
flex row or `cm.grid({ cols: 2 })` (or a custom grid template) so the
|
|
330
|
+
primitive never fights a grid-based shell.
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
interface AuthShellSplitRowProps extends HTMLAttributes<HTMLElement> {
|
|
334
|
+
children: ReactNode
|
|
335
|
+
/**
|
|
336
|
+
* Layout classes for the row — typically `cm.flex({})` or
|
|
337
|
+
* `cm.grid({ cols: 2 })`. Appended after the `flex-1` vertical fill.
|
|
338
|
+
*/
|
|
339
|
+
className?: string
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### `UseAuthFormStateOptions`
|
|
344
|
+
|
|
345
|
+
Options for {@link useAuthFormState}.
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
interface UseAuthFormStateOptions {
|
|
349
|
+
/**
|
|
350
|
+
* Storage provider backing persistence. Defaults to a process-shared
|
|
351
|
+
* in-memory provider (per the no-raw-storage rule), which still gives
|
|
352
|
+
* cross-view persistence within a single SPA session. Inject
|
|
353
|
+
* `createSessionStorageProvider()` from
|
|
354
|
+
* `@molecule/app-storage-localstorage` for tab-scoped persistence that
|
|
355
|
+
* also survives a full reload.
|
|
356
|
+
*/
|
|
357
|
+
storage?: StorageProvider
|
|
358
|
+
/** Storage key for the persisted fields. Defaults to `molecule.auth.form-state`. */
|
|
359
|
+
storageKey?: string
|
|
360
|
+
/** Seed values used before hydration completes / when storage is empty. */
|
|
361
|
+
initialFields?: AuthFormFields
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Functions
|
|
366
|
+
|
|
367
|
+
#### `AuthFormStateProvider(props)`
|
|
368
|
+
|
|
369
|
+
Provides a single {@link useAuthFormState} instance to all descendants
|
|
370
|
+
via React context, so sibling/child auth forms share the same email.
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
function AuthFormStateProvider({
|
|
374
|
+
children,
|
|
375
|
+
storage,
|
|
376
|
+
storageKey,
|
|
377
|
+
initialFields,
|
|
378
|
+
}: AuthFormStateProviderProps): JSX.Element
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
- `props` — Children plus optional storage provider, key, and seed fields.
|
|
382
|
+
|
|
383
|
+
**Returns:** The provider element.
|
|
384
|
+
|
|
385
|
+
#### `AuthShell(props)`
|
|
386
|
+
|
|
387
|
+
Convenience preset composing container, decoration, card, heading, footer, and back-link into a single component.
|
|
388
|
+
|
|
389
|
+
Wraps its content in an `<AuthFormStateProvider>` so every form
|
|
390
|
+
rendered inside inherits cross-view email persistence via
|
|
391
|
+
`useAuthFormStateContext()`.
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
function AuthShell({
|
|
395
|
+
heading,
|
|
396
|
+
subheading,
|
|
397
|
+
children,
|
|
398
|
+
footer,
|
|
399
|
+
brand,
|
|
400
|
+
decoration,
|
|
401
|
+
backTo = '/',
|
|
402
|
+
showBackLink = true,
|
|
403
|
+
formStateStorage,
|
|
404
|
+
formStateKey,
|
|
405
|
+
}: AuthShellProps): JSX.Element
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### `AuthShellBackLink(props)`
|
|
409
|
+
|
|
410
|
+
Back-navigation link rendered below the card, defaulting to "Back to home" via i18n.
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
function AuthShellBackLink({ to = '/', label }: AuthShellBackLinkProps): JSX.Element
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
#### `AuthShellCard(props)`
|
|
417
|
+
|
|
418
|
+
Centered glassmorphic card surface with fixed flex-column layout and configurable surface treatment.
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
function AuthShellCard({
|
|
422
|
+
children,
|
|
423
|
+
surfaceClassName,
|
|
424
|
+
className,
|
|
425
|
+
outerClassName,
|
|
426
|
+
dataMolId,
|
|
427
|
+
style,
|
|
428
|
+
}: AuthShellCardProps): JSX.Element
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
#### `AuthShellCardColumn(props)`
|
|
432
|
+
|
|
433
|
+
Centered-flex section or main column for the form-card half of a split or stacked auth layout.
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
function AuthShellCardColumn({
|
|
437
|
+
children,
|
|
438
|
+
className,
|
|
439
|
+
as = 'section',
|
|
440
|
+
...rest
|
|
441
|
+
}: AuthShellCardColumnProps): JSX.Element
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### `AuthShellContainer(props)`
|
|
445
|
+
|
|
446
|
+
Full-screen container with centered-flex or column layout and optional background decoration support.
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
function AuthShellContainer({
|
|
450
|
+
children,
|
|
451
|
+
style,
|
|
452
|
+
className,
|
|
453
|
+
layout = 'centered',
|
|
454
|
+
}: AuthShellContainerProps): JSX.Element
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
#### `AuthShellDecoration(props)`
|
|
458
|
+
|
|
459
|
+
Absolute-positioned background decoration layer — orbs, mesh gradients,
|
|
460
|
+
radial glows. Children render inside a `pointer-events-none absolute
|
|
461
|
+
inset-0 -z-10 overflow-hidden` wrapper.
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
function AuthShellDecoration({ children }: { children: ReactNode }): JSX.Element
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
#### `AuthShellFooter(props)`
|
|
468
|
+
|
|
469
|
+
Footer inside the card — small text with a top border.
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
function AuthShellFooter({ children }: { children: ReactNode }): JSX.Element
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
#### `AuthShellHeading(props)`
|
|
476
|
+
|
|
477
|
+
Centered heading block with optional eyebrow tag, h1 title, and subheading paragraph.
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
function AuthShellHeading({
|
|
481
|
+
heading,
|
|
482
|
+
subheading,
|
|
483
|
+
eyebrow,
|
|
484
|
+
headingClassName,
|
|
485
|
+
headingStyle,
|
|
486
|
+
}: AuthShellHeadingProps): JSX.Element
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
#### `AuthShellPanel(props)`
|
|
490
|
+
|
|
491
|
+
Decorative aside that collapses on mobile (hidden lg:flex) for the brand-panel half of a split auth layout.
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
function AuthShellPanel({ children, className, ...rest }: AuthShellPanelProps): JSX.Element
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
#### `AuthShellSplit(props)`
|
|
498
|
+
|
|
499
|
+
Outer min-h-screen flex-col frame for the two-column brand-panel + card auth layout.
|
|
500
|
+
|
|
501
|
+
```typescript
|
|
502
|
+
function AuthShellSplit({ children, className, ...rest }: AuthShellSplitProps): JSX.Element
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
#### `AuthShellSplitRow(props)`
|
|
506
|
+
|
|
507
|
+
Vertically-filling flex-1 row inside AuthShellSplit that holds the brand panel and card column.
|
|
508
|
+
|
|
509
|
+
```typescript
|
|
510
|
+
function AuthShellSplitRow({ children, className, ...rest }: AuthShellSplitRowProps): JSX.Element
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
#### `useAuthFormState(options)`
|
|
514
|
+
|
|
515
|
+
React hook holding email + shared auth fields, persisted across auth
|
|
516
|
+
views via an injectable `StorageProvider` and cleared on successful
|
|
517
|
+
auth.
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
function useAuthFormState(options?: UseAuthFormStateOptions): AuthFormState
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
- `options` — Optional storage provider, storage key, and seed fields.
|
|
524
|
+
|
|
525
|
+
**Returns:** The current fields plus `setField`/`setFields`/`clear` and a `hydrated` flag.
|
|
526
|
+
|
|
527
|
+
#### `useAuthFormStateContext()`
|
|
528
|
+
|
|
529
|
+
Reads the shared auth form state from the nearest
|
|
530
|
+
{@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
531
|
+
|
|
532
|
+
```typescript
|
|
533
|
+
function useAuthFormStateContext(): AuthFormState
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**Returns:** The shared {@link AuthFormState}.
|
|
537
|
+
|
|
538
|
+
### Constants
|
|
539
|
+
|
|
540
|
+
#### `DEFAULT_AUTH_FORM_STATE_KEY`
|
|
541
|
+
|
|
542
|
+
Default storage key for persisted auth form fields.
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
const DEFAULT_AUTH_FORM_STATE_KEY: 'molecule.auth.form-state'
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
## Injection Notes
|
|
549
|
+
|
|
550
|
+
### Requirements
|
|
551
|
+
|
|
552
|
+
Peer dependencies:
|
|
553
|
+
|
|
554
|
+
- `@molecule/app-logger` ^1.0.1
|
|
555
|
+
- `@molecule/app-react` ^1.0.1
|
|
556
|
+
- `@molecule/app-storage` ^1.0.1
|
|
557
|
+
- `@molecule/app-ui` ^1.0.1
|
|
558
|
+
- `react` ^18.0.0 || ^19.0.0
|
|
559
|
+
- `react-router` ^7.0.0 || ^8.0.0
|
|
560
|
+
|
|
561
|
+
### Runtime Dependencies
|
|
562
|
+
|
|
563
|
+
- `@molecule/app-logger`
|
|
564
|
+
- `@molecule/app-react`
|
|
565
|
+
- `@molecule/app-storage`
|
|
566
|
+
- `@molecule/app-ui`
|
|
567
|
+
- `react`
|
|
568
|
+
- `react-router`
|
|
569
|
+
|
|
570
|
+
`AuthShell` renders a react-router `<Link>` ("Back to home") by default,
|
|
571
|
+
so it MUST be rendered inside a `<Router>`; pass `showBackLink={false}`
|
|
572
|
+
in router-less setups. The back link's arrow uses the Material Symbols
|
|
573
|
+
icon font — load it, or the glyph renders as text. The default glass
|
|
574
|
+
card treatment (`rounded-3xl`, translucent surface, backdrop blur) and
|
|
575
|
+
the panel's `hidden lg:flex` collapse are Tailwind classes resolved by
|
|
576
|
+
the wired ClassMap bond's theme tokens — on a non-Tailwind ClassMap,
|
|
577
|
+
override via `surfaceClassName` / `className`. Form-state persistence
|
|
578
|
+
defaults to a process-shared in-memory store (survives route swaps, not
|
|
579
|
+
reloads) — inject `createSessionStorageProvider()` for reload-safe,
|
|
580
|
+
tab-scoped persistence. Translations come from the companion
|
|
581
|
+
`@molecule/app-locales-auth-shell` locale bond.
|
|
582
|
+
|
|
583
|
+
## Translations
|
|
584
|
+
|
|
585
|
+
Translation strings are provided by `@molecule/app-locales-auth-shell`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-auth-shell-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Auth-page layout shell — centered card with heading/subheading/form/footer + back-link below. Composable children for per-app decorative background + brand mark.",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-auth-shell-react",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +18,8 @@
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
|
-
"dist"
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
21
23
|
],
|
|
22
24
|
"keywords": [
|
|
23
25
|
"molecule",
|
|
@@ -27,19 +29,24 @@
|
|
|
27
29
|
"react"
|
|
28
30
|
],
|
|
29
31
|
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/auth-shell-react"
|
|
36
|
+
},
|
|
30
37
|
"peerDependencies": {
|
|
31
|
-
"@molecule/app-logger": "^1.0.
|
|
32
|
-
"@molecule/app-react": "^1.0.
|
|
33
|
-
"@molecule/app-storage": "^1.0.
|
|
34
|
-
"@molecule/app-ui": "^1.0.
|
|
38
|
+
"@molecule/app-logger": "^1.0.1",
|
|
39
|
+
"@molecule/app-react": "^1.0.1",
|
|
40
|
+
"@molecule/app-storage": "^1.0.1",
|
|
41
|
+
"@molecule/app-ui": "^1.0.1",
|
|
35
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
36
43
|
"react-router": "^7.0.0 || ^8.0.0"
|
|
37
44
|
},
|
|
38
45
|
"devDependencies": {
|
|
39
|
-
"@molecule/app-logger": "1.0.
|
|
40
|
-
"@molecule/app-react": "1.
|
|
41
|
-
"@molecule/app-storage": "1.0.
|
|
42
|
-
"@molecule/app-ui": "1.
|
|
46
|
+
"@molecule/app-logger": "1.0.2",
|
|
47
|
+
"@molecule/app-react": "1.5.1",
|
|
48
|
+
"@molecule/app-storage": "1.0.2",
|
|
49
|
+
"@molecule/app-ui": "1.1.1",
|
|
43
50
|
"@testing-library/react": "16.3.2",
|
|
44
51
|
"@types/node": "26.1.2",
|
|
45
52
|
"@types/react": "19.2.17",
|
|
@@ -49,6 +56,6 @@
|
|
|
49
56
|
"react-dom": "19.2.8",
|
|
50
57
|
"react-router": "8.3.0",
|
|
51
58
|
"typescript": "6.0.3",
|
|
52
|
-
"vitest": "4.1.
|
|
59
|
+
"vitest": "4.1.11"
|
|
53
60
|
}
|
|
54
61
|
}
|