@olwiba/ui 0.0.30 → 0.0.32
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/dist/index.d.ts +1 -0
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AuthSection.tsx +23 -12
package/package.json
CHANGED
package/src/app/AuthSection.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { Badge,
|
|
4
|
+
import { Building2, ShieldCheck, Sparkles } from 'lucide-react';
|
|
5
|
+
import { Badge, CardContent, CardDescription, CardHeader, CardTitle, Label, cn } from '@olwiba/cn';
|
|
6
|
+
import { Button } from '../primitives/Button';
|
|
7
|
+
import { Card } from '../primitives/Card';
|
|
8
|
+
import { Input } from '../primitives/Input';
|
|
6
9
|
import type { AppShellRenderLink } from './AppShell';
|
|
7
10
|
|
|
8
11
|
const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) => (
|
|
@@ -11,10 +14,15 @@ const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) =>
|
|
|
11
14
|
|
|
12
15
|
// ─── Centered layout ──────────────────────────────────────────────────────────
|
|
13
16
|
|
|
14
|
-
function CenteredAuth({ children }: { children: React.ReactNode }) {
|
|
17
|
+
function CenteredAuth({ children, brand, className }: { children: React.ReactNode; brand?: React.ReactNode; className?: string }) {
|
|
15
18
|
return (
|
|
16
|
-
<section className=
|
|
17
|
-
|
|
19
|
+
<section className={cn('flex min-h-screen flex-col justify-center bg-background py-12 px-4 sm:px-6 lg:px-8', className)}>
|
|
20
|
+
{brand && (
|
|
21
|
+
<div className="mx-auto w-full max-w-md text-center mb-8">
|
|
22
|
+
{brand}
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
<div className="mx-auto w-full max-w-md">
|
|
18
26
|
{children}
|
|
19
27
|
</div>
|
|
20
28
|
</section>
|
|
@@ -66,6 +74,7 @@ export interface AuthFormProps {
|
|
|
66
74
|
/** (signup) Link back to the sign-in page */
|
|
67
75
|
signInHref?: string;
|
|
68
76
|
forgotPasswordHref?: string;
|
|
77
|
+
/** Brand node — in centered layout renders above the card; in split layout renders inside the card */
|
|
69
78
|
brand?: React.ReactNode;
|
|
70
79
|
/** Error message displayed below the form fields */
|
|
71
80
|
error?: string;
|
|
@@ -90,7 +99,7 @@ function DefaultForm({
|
|
|
90
99
|
const isSignUp = mode === 'signup';
|
|
91
100
|
|
|
92
101
|
return (
|
|
93
|
-
<Card className="w-full
|
|
102
|
+
<Card className="w-full">
|
|
94
103
|
<CardHeader>
|
|
95
104
|
{brand && <div className="mb-2">{brand}</div>}
|
|
96
105
|
<CardTitle>{isSignUp ? 'Create an account' : 'Sign in'}</CardTitle>
|
|
@@ -109,7 +118,7 @@ function DefaultForm({
|
|
|
109
118
|
</div>
|
|
110
119
|
)}
|
|
111
120
|
<div className="space-y-2">
|
|
112
|
-
<Label htmlFor="auth-email">Email</Label>
|
|
121
|
+
<Label htmlFor="auth-email">Email address</Label>
|
|
113
122
|
<Input id="auth-email" name="email" type="email" placeholder="name@company.com" autoComplete="email" />
|
|
114
123
|
</div>
|
|
115
124
|
<div className="space-y-2">
|
|
@@ -182,9 +191,8 @@ export function AuthSection({
|
|
|
182
191
|
className,
|
|
183
192
|
...formProps
|
|
184
193
|
}: AuthSectionProps) {
|
|
185
|
-
const form = children ?? <DefaultForm {...formProps} />;
|
|
186
|
-
|
|
187
194
|
if (layout === 'split') {
|
|
195
|
+
const form = children ?? <DefaultForm {...formProps} />;
|
|
188
196
|
return (
|
|
189
197
|
<div className={cn('h-full', className)}>
|
|
190
198
|
<SplitAuth panel={panel}>{form}</SplitAuth>
|
|
@@ -192,9 +200,12 @@ export function AuthSection({
|
|
|
192
200
|
);
|
|
193
201
|
}
|
|
194
202
|
|
|
203
|
+
// Centered: brand renders above the card, not inside it
|
|
204
|
+
const { brand, ...restFormProps } = formProps;
|
|
205
|
+
const form = children ?? <DefaultForm {...restFormProps} />;
|
|
195
206
|
return (
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
</
|
|
207
|
+
<CenteredAuth brand={brand} className={className}>
|
|
208
|
+
{form}
|
|
209
|
+
</CenteredAuth>
|
|
199
210
|
);
|
|
200
211
|
}
|