@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/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ interface AuthFormProps {
|
|
|
134
134
|
/** (signup) Link back to the sign-in page */
|
|
135
135
|
signInHref?: string;
|
|
136
136
|
forgotPasswordHref?: string;
|
|
137
|
+
/** Brand node — in centered layout renders above the card; in split layout renders inside the card */
|
|
137
138
|
brand?: React.ReactNode;
|
|
138
139
|
/** Error message displayed below the form fields */
|
|
139
140
|
error?: string;
|
package/dist/index.js
CHANGED
|
@@ -254,8 +254,11 @@ function AppShell({
|
|
|
254
254
|
return inner;
|
|
255
255
|
}
|
|
256
256
|
var defaultRenderLink2 = ({ href, children, className }) => /* @__PURE__ */ jsx("a", { href, className, children });
|
|
257
|
-
function CenteredAuth({ children }) {
|
|
258
|
-
return /* @__PURE__ */
|
|
257
|
+
function CenteredAuth({ children, brand, className }) {
|
|
258
|
+
return /* @__PURE__ */ jsxs("section", { className: cn$1("flex min-h-screen flex-col justify-center bg-background py-12 px-4 sm:px-6 lg:px-8", className), children: [
|
|
259
|
+
brand && /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md text-center mb-8", children: brand }),
|
|
260
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md", children })
|
|
261
|
+
] });
|
|
259
262
|
}
|
|
260
263
|
function SplitAuth({ children, panel }) {
|
|
261
264
|
const defaultPanel = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
@@ -300,7 +303,7 @@ function DefaultForm({
|
|
|
300
303
|
renderLink = defaultRenderLink2
|
|
301
304
|
}) {
|
|
302
305
|
const isSignUp = mode === "signup";
|
|
303
|
-
return /* @__PURE__ */ jsxs(Card
|
|
306
|
+
return /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
|
|
304
307
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
305
308
|
brand && /* @__PURE__ */ jsx("div", { className: "mb-2", children: brand }),
|
|
306
309
|
/* @__PURE__ */ jsx(CardTitle, { children: isSignUp ? "Create an account" : "Sign in" }),
|
|
@@ -310,11 +313,11 @@ function DefaultForm({
|
|
|
310
313
|
/* @__PURE__ */ jsxs("form", { onSubmit, className: "space-y-4", children: [
|
|
311
314
|
isSignUp && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
312
315
|
/* @__PURE__ */ jsx(Label, { htmlFor: "auth-name", children: "Name" }),
|
|
313
|
-
/* @__PURE__ */ jsx(Input
|
|
316
|
+
/* @__PURE__ */ jsx(Input, { id: "auth-name", name: "name", type: "text", placeholder: "Your name", autoComplete: "name" })
|
|
314
317
|
] }),
|
|
315
318
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
316
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "auth-email", children: "Email" }),
|
|
317
|
-
/* @__PURE__ */ jsx(Input
|
|
319
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "auth-email", children: "Email address" }),
|
|
320
|
+
/* @__PURE__ */ jsx(Input, { id: "auth-email", name: "email", type: "email", placeholder: "name@company.com", autoComplete: "email" })
|
|
318
321
|
] }),
|
|
319
322
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
320
323
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -326,7 +329,7 @@ function DefaultForm({
|
|
|
326
329
|
})
|
|
327
330
|
] }),
|
|
328
331
|
/* @__PURE__ */ jsx(
|
|
329
|
-
Input
|
|
332
|
+
Input,
|
|
330
333
|
{
|
|
331
334
|
id: "auth-password",
|
|
332
335
|
name: "password",
|
|
@@ -338,8 +341,8 @@ function DefaultForm({
|
|
|
338
341
|
] }),
|
|
339
342
|
error && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: error }),
|
|
340
343
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
341
|
-
/* @__PURE__ */ jsx(Button
|
|
342
|
-
onSso && /* @__PURE__ */ jsx(Button
|
|
344
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", className: "w-full", disabled: loading, children: loading ? "Please wait\u2026" : isSignUp ? "Create account" : "Sign in" }),
|
|
345
|
+
onSso && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", className: "w-full", onClick: onSso, disabled: loading, children: "Use SSO" })
|
|
343
346
|
] })
|
|
344
347
|
] }),
|
|
345
348
|
/* @__PURE__ */ jsx("p", { className: "text-center text-xs text-muted-foreground", children: isSignUp ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -361,11 +364,13 @@ function AuthSection({
|
|
|
361
364
|
className,
|
|
362
365
|
...formProps
|
|
363
366
|
}) {
|
|
364
|
-
const form = children ?? /* @__PURE__ */ jsx(DefaultForm, { ...formProps });
|
|
365
367
|
if (layout === "split") {
|
|
366
|
-
|
|
368
|
+
const form2 = children ?? /* @__PURE__ */ jsx(DefaultForm, { ...formProps });
|
|
369
|
+
return /* @__PURE__ */ jsx("div", { className: cn$1("h-full", className), children: /* @__PURE__ */ jsx(SplitAuth, { panel, children: form2 }) });
|
|
367
370
|
}
|
|
368
|
-
|
|
371
|
+
const { brand, ...restFormProps } = formProps;
|
|
372
|
+
const form = children ?? /* @__PURE__ */ jsx(DefaultForm, { ...restFormProps });
|
|
373
|
+
return /* @__PURE__ */ jsx(CenteredAuth, { brand, className, children: form });
|
|
369
374
|
}
|
|
370
375
|
function EmptyState({ icon: Icon, title, description, action, className, ...props }) {
|
|
371
376
|
return /* @__PURE__ */ jsxs(
|