@molecule/app-auth-shell-react 1.0.3 → 1.0.5
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/LICENSE +111 -24
- package/README.md +200 -200
- package/package.json +14 -14
package/LICENSE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
@@ -34,21 +35,33 @@
|
|
|
34
35
|
|
|
35
36
|
"Work" shall mean the work of authorship, whether in Source or
|
|
36
37
|
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
38
40
|
|
|
39
41
|
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
42
|
form, that is based on (or derived from) the Work and for which the
|
|
41
43
|
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
-
represent, as a whole, an original work of authorship.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
49
62
|
|
|
50
63
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
-
on behalf of whom a Contribution has been received by
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
52
65
|
subsequently incorporated within the Work.
|
|
53
66
|
|
|
54
67
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
@@ -61,8 +74,18 @@
|
|
|
61
74
|
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
75
|
this License, each Contributor hereby grants to You a perpetual,
|
|
63
76
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
-
|
|
65
|
-
and otherwise transfer the Work
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
66
89
|
|
|
67
90
|
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
91
|
Work or Derivative Works thereof in any medium, with or without
|
|
@@ -84,23 +107,87 @@
|
|
|
84
107
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
108
|
distribution, then any Derivative Works that You distribute must
|
|
86
109
|
include a readable copy of the attribution notices contained
|
|
87
|
-
within such NOTICE file
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
90
138
|
|
|
91
139
|
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
-
names, trademarks, service marks, or product names of the Licensor
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
93
143
|
|
|
94
144
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
-
agreed to in writing, Licensor provides the Work
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
104
191
|
|
|
105
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-16T23:33:09.342Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-auth-shell-react
|
|
10
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
11
|
`@molecule/app-auth-shell-react` — centered glassmorphic shell for
|
|
16
12
|
auth pages (Login, Signup, ForgotPassword, ResetPassword).
|
|
17
13
|
|
|
@@ -35,6 +31,10 @@ primitives it is built from — `AuthShellContainer`, `AuthShellDecoration`,
|
|
|
35
31
|
plus a two-column family for the "brand panel + form card" split layout:
|
|
36
32
|
`AuthShellSplit` > `AuthShellSplitRow` > (`AuthShellPanel` + `AuthShellCardColumn`).
|
|
37
33
|
|
|
34
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
35
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
36
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
37
|
+
|
|
38
38
|
## Quick Start
|
|
39
39
|
|
|
40
40
|
```tsx
|
|
@@ -86,47 +86,6 @@ npm install -D @types/react
|
|
|
86
86
|
|
|
87
87
|
### Interfaces
|
|
88
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
89
|
#### `AuthFormStateProviderProps`
|
|
131
90
|
|
|
132
91
|
Props for {@link AuthFormStateProvider}.
|
|
@@ -143,38 +102,22 @@ interface AuthFormStateProviderProps {
|
|
|
143
102
|
}
|
|
144
103
|
```
|
|
145
104
|
|
|
146
|
-
#### `
|
|
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
|
-
```
|
|
105
|
+
#### `AuthShellContainerProps`
|
|
157
106
|
|
|
158
|
-
|
|
107
|
+
Outer full-screen container — centered Flex, padded, with optional
|
|
108
|
+
absolute-positioned background decoration child.
|
|
159
109
|
|
|
160
|
-
|
|
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`.
|
|
110
|
+
Compose with `<AuthShellCard>` (and friends) inside.
|
|
165
111
|
|
|
166
112
|
```typescript
|
|
167
|
-
interface
|
|
113
|
+
interface AuthShellContainerProps {
|
|
168
114
|
children: ReactNode
|
|
169
|
-
/**
|
|
115
|
+
/** Optional CSS background applied to the container. */
|
|
116
|
+
style?: CSSProperties
|
|
117
|
+
/** Optional extra className appended after defaults. */
|
|
170
118
|
className?: string
|
|
171
|
-
/**
|
|
172
|
-
|
|
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'
|
|
119
|
+
/** Layout direction. Defaults to centered-Flex; pass `'column'` for a vertical stack (top-bar / main / footer). */
|
|
120
|
+
layout?: 'centered' | 'column'
|
|
178
121
|
}
|
|
179
122
|
```
|
|
180
123
|
|
|
@@ -202,25 +145,6 @@ interface AuthShellCardProps {
|
|
|
202
145
|
}
|
|
203
146
|
```
|
|
204
147
|
|
|
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
148
|
#### `AuthShellHeadingProps`
|
|
225
149
|
|
|
226
150
|
Heading block — optional eyebrow + h1 + optional subheading. All centered.
|
|
@@ -238,6 +162,64 @@ interface AuthShellHeadingProps {
|
|
|
238
162
|
}
|
|
239
163
|
```
|
|
240
164
|
|
|
165
|
+
#### `AuthShellBackLinkProps`
|
|
166
|
+
|
|
167
|
+
"Back to home" link (or custom destination) rendered below the card.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
interface AuthShellBackLinkProps {
|
|
171
|
+
to?: string
|
|
172
|
+
/** Translated label override; falls back to `auth.backHome` → "Back to home". */
|
|
173
|
+
label?: string
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### `AuthShellSplitProps`
|
|
178
|
+
|
|
179
|
+
Outer frame for the two-column "decorated brand panel + card" auth
|
|
180
|
+
layout — the dominant shape across the fleet's polished auth pages.
|
|
181
|
+
|
|
182
|
+
A `min-h-screen` vertical stack: compose an `<AuthShellSplitRow>` (the
|
|
183
|
+
brand-panel + card-column row) as a child, and optionally a site
|
|
184
|
+
`<Footer />` after it. The row flexes to fill, so the footer sits at
|
|
185
|
+
the bottom.
|
|
186
|
+
|
|
187
|
+
Provides only the structural concern (`flex-col` + `min-h-screen`).
|
|
188
|
+
Background, text color, and font are per-app — pass them via
|
|
189
|
+
`className`.
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
interface AuthShellSplitProps extends HTMLAttributes<HTMLDivElement> {
|
|
193
|
+
children: ReactNode
|
|
194
|
+
/** Cosmetic classes (background, text color, font) for the outer container. */
|
|
195
|
+
className?: string
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### `AuthShellSplitRowProps`
|
|
200
|
+
|
|
201
|
+
The vertically-flexed two-column row inside `<AuthShellSplit>` —
|
|
202
|
+
compose `<AuthShellPanel>` and `<AuthShellCardColumn>` as its
|
|
203
|
+
children. Split out from `<AuthShellSplit>` so a site `<Footer />`
|
|
204
|
+
can sit below the row as a sibling child rather than a slot prop.
|
|
205
|
+
|
|
206
|
+
Provides only the `flex-1` vertical fill (so the row stretches and
|
|
207
|
+
any sibling footer sits at the bottom). The two-column layout itself
|
|
208
|
+
is the caller's choice — pass `className` with `cm.flex({})` for a
|
|
209
|
+
flex row or `cm.grid({ cols: 2 })` (or a custom grid template) so the
|
|
210
|
+
primitive never fights a grid-based shell.
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
interface AuthShellSplitRowProps extends HTMLAttributes<HTMLElement> {
|
|
214
|
+
children: ReactNode
|
|
215
|
+
/**
|
|
216
|
+
* Layout classes for the row — typically `cm.flex({})` or
|
|
217
|
+
* `cm.grid({ cols: 2 })`. Appended after the `flex-1` vertical fill.
|
|
218
|
+
*/
|
|
219
|
+
className?: string
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
241
223
|
#### `AuthShellPanelProps`
|
|
242
224
|
|
|
243
225
|
A decorative `<aside>` that collapses on mobile (`hidden lg:flex`, the
|
|
@@ -256,6 +238,29 @@ interface AuthShellPanelProps extends HTMLAttributes<HTMLElement> {
|
|
|
256
238
|
}
|
|
257
239
|
```
|
|
258
240
|
|
|
241
|
+
#### `AuthShellCardColumnProps`
|
|
242
|
+
|
|
243
|
+
A `<section>` (or `<main>`, via `as`) that centers its children on
|
|
244
|
+
both axes — the form-card half of `<AuthShellSplit>`, or the centered
|
|
245
|
+
content column of a header / main / footer stacked auth layout.
|
|
246
|
+
Provides only the `flex` centering; pass `className` for width ratio,
|
|
247
|
+
padding, and `flex-1`.
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
interface AuthShellCardColumnProps extends HTMLAttributes<HTMLElement> {
|
|
251
|
+
children: ReactNode
|
|
252
|
+
/** Cosmetic classes — width ratio, padding. */
|
|
253
|
+
className?: string
|
|
254
|
+
/**
|
|
255
|
+
* Element to render. Defaults to `'section'`; pass `'main'` when the
|
|
256
|
+
* card column is the auth page's primary content landmark — i.e. the
|
|
257
|
+
* shell is not already wrapped in `<AuthShellSplitRow>` (which is
|
|
258
|
+
* itself a `<main>`, so nesting another would be invalid).
|
|
259
|
+
*/
|
|
260
|
+
as?: 'section' | 'main'
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
259
264
|
#### `AuthShellProps`
|
|
260
265
|
|
|
261
266
|
Convenience preset for the most common layout: centered glass card
|
|
@@ -294,49 +299,18 @@ interface AuthShellProps {
|
|
|
294
299
|
}
|
|
295
300
|
```
|
|
296
301
|
|
|
297
|
-
#### `
|
|
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.
|
|
302
|
+
#### `AuthFormFields`
|
|
325
303
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
flex row or `cm.grid({ cols: 2 })` (or a custom grid template) so the
|
|
330
|
-
primitive never fights a grid-based shell.
|
|
304
|
+
Shared auth form field values. `email` is the canonical cross-view
|
|
305
|
+
field; additional string fields (e.g. a name carried from Signup) may
|
|
306
|
+
be stored alongside it.
|
|
331
307
|
|
|
332
308
|
```typescript
|
|
333
|
-
interface
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
*/
|
|
339
|
-
className?: string
|
|
309
|
+
interface AuthFormFields {
|
|
310
|
+
/** Email address, shared across all auth views. */
|
|
311
|
+
email?: string
|
|
312
|
+
/** Any other shared string field (e.g. `name`). */
|
|
313
|
+
[field: string]: string | undefined
|
|
340
314
|
}
|
|
341
315
|
```
|
|
342
316
|
|
|
@@ -362,6 +336,32 @@ interface UseAuthFormStateOptions {
|
|
|
362
336
|
}
|
|
363
337
|
```
|
|
364
338
|
|
|
339
|
+
#### `AuthFormState`
|
|
340
|
+
|
|
341
|
+
The value returned by {@link useAuthFormState} (and provided through
|
|
342
|
+
the AuthShell form-state context).
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
interface AuthFormState {
|
|
346
|
+
/** Current field values (email + any shared fields). */
|
|
347
|
+
fields: AuthFormFields
|
|
348
|
+
/**
|
|
349
|
+
* `true` once the initial read from storage has completed. Useful for
|
|
350
|
+
* deferring autofocus/validation until persisted values are loaded.
|
|
351
|
+
*/
|
|
352
|
+
hydrated: boolean
|
|
353
|
+
/** Sets a single field and persists the new state. */
|
|
354
|
+
setField: (name: string, value: string) => void
|
|
355
|
+
/** Merges a patch of fields and persists the new state. */
|
|
356
|
+
setFields: (patch: AuthFormFields) => void
|
|
357
|
+
/**
|
|
358
|
+
* Clears all persisted auth form state and removes the storage key.
|
|
359
|
+
* Call this from the successful-auth handler.
|
|
360
|
+
*/
|
|
361
|
+
clear: () => void
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
365
|
### Functions
|
|
366
366
|
|
|
367
367
|
#### `AuthFormStateProvider(props)`
|
|
@@ -382,35 +382,38 @@ function AuthFormStateProvider({
|
|
|
382
382
|
|
|
383
383
|
**Returns:** The provider element.
|
|
384
384
|
|
|
385
|
-
#### `
|
|
385
|
+
#### `useAuthFormStateContext()`
|
|
386
386
|
|
|
387
|
-
|
|
387
|
+
Reads the shared auth form state from the nearest
|
|
388
|
+
{@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
388
389
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
```typescript
|
|
391
|
+
function useAuthFormStateContext(): AuthFormState
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
**Returns:** The shared {@link AuthFormState}.
|
|
395
|
+
|
|
396
|
+
#### `AuthShellContainer(props)`
|
|
397
|
+
|
|
398
|
+
Full-screen container with centered-flex or column layout and optional background decoration support.
|
|
392
399
|
|
|
393
400
|
```typescript
|
|
394
|
-
function
|
|
395
|
-
heading,
|
|
396
|
-
subheading,
|
|
401
|
+
function AuthShellContainer({
|
|
397
402
|
children,
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
showBackLink = true,
|
|
403
|
-
formStateStorage,
|
|
404
|
-
formStateKey,
|
|
405
|
-
}: AuthShellProps): JSX.Element
|
|
403
|
+
style,
|
|
404
|
+
className,
|
|
405
|
+
layout = 'centered',
|
|
406
|
+
}: AuthShellContainerProps): JSX.Element
|
|
406
407
|
```
|
|
407
408
|
|
|
408
|
-
#### `
|
|
409
|
+
#### `AuthShellDecoration(props)`
|
|
409
410
|
|
|
410
|
-
|
|
411
|
+
Absolute-positioned background decoration layer — orbs, mesh gradients,
|
|
412
|
+
radial glows. Children render inside a `pointer-events-none absolute
|
|
413
|
+
inset-0 -z-10 overflow-hidden` wrapper.
|
|
411
414
|
|
|
412
415
|
```typescript
|
|
413
|
-
function
|
|
416
|
+
function AuthShellDecoration({ children }: { children: ReactNode }): JSX.Element
|
|
414
417
|
```
|
|
415
418
|
|
|
416
419
|
#### `AuthShellCard(props)`
|
|
@@ -428,62 +431,50 @@ function AuthShellCard({
|
|
|
428
431
|
}: AuthShellCardProps): JSX.Element
|
|
429
432
|
```
|
|
430
433
|
|
|
431
|
-
#### `
|
|
434
|
+
#### `AuthShellHeading(props)`
|
|
432
435
|
|
|
433
|
-
Centered
|
|
436
|
+
Centered heading block with optional eyebrow tag, h1 title, and subheading paragraph.
|
|
434
437
|
|
|
435
438
|
```typescript
|
|
436
|
-
function
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
function AuthShellHeading({
|
|
440
|
+
heading,
|
|
441
|
+
subheading,
|
|
442
|
+
eyebrow,
|
|
443
|
+
headingClassName,
|
|
444
|
+
headingStyle,
|
|
445
|
+
}: AuthShellHeadingProps): JSX.Element
|
|
442
446
|
```
|
|
443
447
|
|
|
444
|
-
#### `
|
|
448
|
+
#### `AuthShellFooter(props)`
|
|
445
449
|
|
|
446
|
-
|
|
450
|
+
Footer inside the card — small text with a top border.
|
|
447
451
|
|
|
448
452
|
```typescript
|
|
449
|
-
function
|
|
450
|
-
children,
|
|
451
|
-
style,
|
|
452
|
-
className,
|
|
453
|
-
layout = 'centered',
|
|
454
|
-
}: AuthShellContainerProps): JSX.Element
|
|
453
|
+
function AuthShellFooter({ children }: { children: ReactNode }): JSX.Element
|
|
455
454
|
```
|
|
456
455
|
|
|
457
|
-
#### `
|
|
456
|
+
#### `AuthShellBackLink(props)`
|
|
458
457
|
|
|
459
|
-
|
|
460
|
-
radial glows. Children render inside a `pointer-events-none absolute
|
|
461
|
-
inset-0 -z-10 overflow-hidden` wrapper.
|
|
458
|
+
Back-navigation link rendered below the card, defaulting to "Back to home" via i18n.
|
|
462
459
|
|
|
463
460
|
```typescript
|
|
464
|
-
function
|
|
461
|
+
function AuthShellBackLink({ to = '/', label }: AuthShellBackLinkProps): JSX.Element
|
|
465
462
|
```
|
|
466
463
|
|
|
467
|
-
#### `
|
|
464
|
+
#### `AuthShellSplit(props)`
|
|
468
465
|
|
|
469
|
-
|
|
466
|
+
Outer min-h-screen flex-col frame for the two-column brand-panel + card auth layout.
|
|
470
467
|
|
|
471
468
|
```typescript
|
|
472
|
-
function
|
|
469
|
+
function AuthShellSplit({ children, className, ...rest }: AuthShellSplitProps): JSX.Element
|
|
473
470
|
```
|
|
474
471
|
|
|
475
|
-
#### `
|
|
472
|
+
#### `AuthShellSplitRow(props)`
|
|
476
473
|
|
|
477
|
-
|
|
474
|
+
Vertically-filling flex-1 row inside AuthShellSplit that holds the brand panel and card column.
|
|
478
475
|
|
|
479
476
|
```typescript
|
|
480
|
-
function
|
|
481
|
-
heading,
|
|
482
|
-
subheading,
|
|
483
|
-
eyebrow,
|
|
484
|
-
headingClassName,
|
|
485
|
-
headingStyle,
|
|
486
|
-
}: AuthShellHeadingProps): JSX.Element
|
|
477
|
+
function AuthShellSplitRow({ children, className, ...rest }: AuthShellSplitRowProps): JSX.Element
|
|
487
478
|
```
|
|
488
479
|
|
|
489
480
|
#### `AuthShellPanel(props)`
|
|
@@ -494,20 +485,40 @@ Decorative aside that collapses on mobile (hidden lg:flex) for the brand-panel h
|
|
|
494
485
|
function AuthShellPanel({ children, className, ...rest }: AuthShellPanelProps): JSX.Element
|
|
495
486
|
```
|
|
496
487
|
|
|
497
|
-
#### `
|
|
488
|
+
#### `AuthShellCardColumn(props)`
|
|
498
489
|
|
|
499
|
-
|
|
490
|
+
Centered-flex section or main column for the form-card half of a split or stacked auth layout.
|
|
500
491
|
|
|
501
492
|
```typescript
|
|
502
|
-
function
|
|
493
|
+
function AuthShellCardColumn({
|
|
494
|
+
children,
|
|
495
|
+
className,
|
|
496
|
+
as = 'section',
|
|
497
|
+
...rest
|
|
498
|
+
}: AuthShellCardColumnProps): JSX.Element
|
|
503
499
|
```
|
|
504
500
|
|
|
505
|
-
#### `
|
|
501
|
+
#### `AuthShell(props)`
|
|
506
502
|
|
|
507
|
-
|
|
503
|
+
Convenience preset composing container, decoration, card, heading, footer, and back-link into a single component.
|
|
504
|
+
|
|
505
|
+
Wraps its content in an `<AuthFormStateProvider>` so every form
|
|
506
|
+
rendered inside inherits cross-view email persistence via
|
|
507
|
+
`useAuthFormStateContext()`.
|
|
508
508
|
|
|
509
509
|
```typescript
|
|
510
|
-
function
|
|
510
|
+
function AuthShell({
|
|
511
|
+
heading,
|
|
512
|
+
subheading,
|
|
513
|
+
children,
|
|
514
|
+
footer,
|
|
515
|
+
brand,
|
|
516
|
+
decoration,
|
|
517
|
+
backTo = '/',
|
|
518
|
+
showBackLink = true,
|
|
519
|
+
formStateStorage,
|
|
520
|
+
formStateKey,
|
|
521
|
+
}: AuthShellProps): JSX.Element
|
|
511
522
|
```
|
|
512
523
|
|
|
513
524
|
#### `useAuthFormState(options)`
|
|
@@ -524,17 +535,6 @@ function useAuthFormState(options?: UseAuthFormStateOptions): AuthFormState
|
|
|
524
535
|
|
|
525
536
|
**Returns:** The current fields plus `setField`/`setFields`/`clear` and a `hydrated` flag.
|
|
526
537
|
|
|
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
538
|
### Constants
|
|
539
539
|
|
|
540
540
|
#### `DEFAULT_AUTH_FORM_STATE_KEY`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-auth-shell-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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
5
|
"homepage": "https://www.molecule.dev/packages/app-auth-shell-react",
|
|
6
6
|
"type": "module",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"react-router": "^7.0.0 || ^8.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@molecule/app-logger": "1.0.
|
|
47
|
-
"@molecule/app-react": "1.
|
|
48
|
-
"@molecule/app-storage": "1.0.
|
|
49
|
-
"@molecule/app-ui": "1.
|
|
50
|
-
"@testing-library/react": "16.3.
|
|
51
|
-
"@types/node": "26.
|
|
52
|
-
"@types/react": "19.
|
|
53
|
-
"@types/react-dom": "19.
|
|
54
|
-
"jsdom": "30.
|
|
55
|
-
"react": "19.
|
|
56
|
-
"react-dom": "19.
|
|
57
|
-
"react-router": "8.
|
|
46
|
+
"@molecule/app-logger": "1.0.3",
|
|
47
|
+
"@molecule/app-react": "1.10.1",
|
|
48
|
+
"@molecule/app-storage": "1.0.4",
|
|
49
|
+
"@molecule/app-ui": "1.3.8",
|
|
50
|
+
"@testing-library/react": "16.3.3",
|
|
51
|
+
"@types/node": "26.6.5",
|
|
52
|
+
"@types/react": "19.3.0",
|
|
53
|
+
"@types/react-dom": "19.3.0",
|
|
54
|
+
"jsdom": "30.1.3",
|
|
55
|
+
"react": "19.3.1",
|
|
56
|
+
"react-dom": "19.3.1",
|
|
57
|
+
"react-router": "8.5.0",
|
|
58
58
|
"typescript": "6.0.3",
|
|
59
|
-
"vitest": "4.1.
|
|
59
|
+
"vitest": "4.1.12"
|
|
60
60
|
}
|
|
61
61
|
}
|