@salesforce/webapp-template-feature-react-authentication-experimental 1.3.4
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.txt +82 -0
- package/README.md +77 -0
- package/dist/.a4drules/build-validation.md +81 -0
- package/dist/.a4drules/code-quality.md +150 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +211 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/dist/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/dist/.a4drules/graphql.md +98 -0
- package/dist/.a4drules/images.md +13 -0
- package/dist/.a4drules/react.md +361 -0
- package/dist/.a4drules/react_image_processing.md +45 -0
- package/dist/.a4drules/typescript.md +224 -0
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +19 -0
- package/dist/README.md +18 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/.prettierignore +9 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/.prettierrc +11 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/eslint.config.js +113 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/feature-react-authentication.webapplication-meta.xml +7 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/index.html +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/package.json +42 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/api/graphql-operations-types.ts +127 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/app.tsx +16 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/appLayout.tsx +9 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/icons/book.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/icons/copy.svg +4 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/icons/rocket.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/icons/star.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/images/codey-1.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/images/codey-2.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/images/codey-3.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/assets/images/vibe-codey.svg +194 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/alerts/status-alert.tsx +45 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/auth/authentication-route.tsx +21 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/auth/private-route.tsx +36 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/footers/footer-link.tsx +36 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/forms/auth-form.tsx +79 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/forms/submit-button.tsx +49 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/layout/card-layout.tsx +23 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/layout/centered-page-layout.tsx +73 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/layout/loading-page.tsx +46 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/alert.tsx +65 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/button.tsx +56 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/card.tsx +77 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/field.tsx +111 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/index.ts +71 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/input.tsx +19 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/label.tsx +19 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/pagination.tsx +99 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/select.tsx +151 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/skeleton.tsx +7 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/spinner.tsx +21 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/table.tsx +114 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/components/ui/tabs.tsx +115 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/context/AuthContext.tsx +83 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/hooks/form.tsx +116 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/lib/utils.ts +6 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/About.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/ChangePassword.tsx +105 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/ForgotPassword.tsx +67 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/Home.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/Login.tsx +84 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/NotFound.tsx +18 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/Profile.tsx +146 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/Register.tsx +117 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/ResetPassword.tsx +101 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/routes.tsx +77 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/styles/global.css +94 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/utils/authenticationConfig.ts +52 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/utils/helpers.ts +161 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/tsconfig.json +36 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/tsconfig.node.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/vite-env.d.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/vite.config.ts +82 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/vitest-env.d.ts +2 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/vitest.config.ts +11 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/vitest.setup.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/webapplication.json +7 -0
- package/dist/jest.config.js +6 -0
- package/dist/package.json +37 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +31 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
|
2
|
+
|
|
3
|
+
interface CardLayoutProps {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Card layout component for authentication pages.
|
|
11
|
+
* Provides CardHeader with title and optional description, and CardContent.
|
|
12
|
+
*/
|
|
13
|
+
export function CardLayout({ title, description, children }: CardLayoutProps) {
|
|
14
|
+
return (
|
|
15
|
+
<Card>
|
|
16
|
+
<CardHeader>
|
|
17
|
+
<CardTitle className="text-2xl">{title}</CardTitle>
|
|
18
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
19
|
+
</CardHeader>
|
|
20
|
+
<CardContent>{children}</CardContent>
|
|
21
|
+
</Card>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Variant styles for the content container's maximum width.
|
|
6
|
+
* Controls the maximum width of the inner content area within the page layout.
|
|
7
|
+
*/
|
|
8
|
+
const contentContainerVariants = cva("w-full", {
|
|
9
|
+
variants: {
|
|
10
|
+
contentMaxWidth: {
|
|
11
|
+
sm: "max-w-sm",
|
|
12
|
+
md: "max-w-md",
|
|
13
|
+
lg: "max-w-lg",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
contentMaxWidth: "sm",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Props for the CenteredPageLayout component.
|
|
23
|
+
*/
|
|
24
|
+
interface CenteredPageLayoutProps
|
|
25
|
+
extends React.ComponentProps<"div">,
|
|
26
|
+
VariantProps<typeof contentContainerVariants> {
|
|
27
|
+
/** The content to be displayed within the page layout */
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum width of the content container.
|
|
31
|
+
* @default "sm"
|
|
32
|
+
*/
|
|
33
|
+
contentMaxWidth?: "sm" | "md" | "lg";
|
|
34
|
+
/**
|
|
35
|
+
* Optional page title. If provided, will render a <title> component that React will place in the document head.
|
|
36
|
+
*/
|
|
37
|
+
title?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* CenteredPageLayout component that provides consistent page structure and spacing.
|
|
42
|
+
*
|
|
43
|
+
* This component creates a full-viewport-height container that centers its content
|
|
44
|
+
* both horizontally and vertically. The inner content area has a configurable maximum width
|
|
45
|
+
* to prevent content from becoming too wide on large screens.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <CenteredPageLayout contentMaxWidth="md">
|
|
50
|
+
* <YourPageContent />
|
|
51
|
+
* </CenteredPageLayout>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function CenteredPageLayout({
|
|
55
|
+
contentMaxWidth,
|
|
56
|
+
className,
|
|
57
|
+
children,
|
|
58
|
+
title,
|
|
59
|
+
...props
|
|
60
|
+
}: CenteredPageLayoutProps) {
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{title && <title>{title}</title>}
|
|
64
|
+
<main
|
|
65
|
+
className={cn("flex min-h-svh w-full items-center justify-center p-6 md:p-10", className)}
|
|
66
|
+
data-slot="page-layout"
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
<div className={contentContainerVariants({ contentMaxWidth })}>{children}</div>
|
|
70
|
+
</main>
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { CenteredPageLayout } from "./centered-page-layout";
|
|
3
|
+
import { Spinner } from "../ui/spinner";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Spinner size variants based on content width.
|
|
7
|
+
*/
|
|
8
|
+
const spinnerVariants = cva("", {
|
|
9
|
+
variants: {
|
|
10
|
+
contentMaxWidth: {
|
|
11
|
+
sm: "size-6",
|
|
12
|
+
md: "size-8",
|
|
13
|
+
lg: "size-10",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
contentMaxWidth: "sm",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
interface LoadingPageProps extends VariantProps<typeof spinnerVariants> {
|
|
22
|
+
/**
|
|
23
|
+
* Maximum width of the content container. Also scales the spinner size.
|
|
24
|
+
* @default "sm"
|
|
25
|
+
*/
|
|
26
|
+
contentMaxWidth?: "sm" | "md" | "lg";
|
|
27
|
+
/**
|
|
28
|
+
* Accessible label for screen readers.
|
|
29
|
+
* @default "Loading…"
|
|
30
|
+
*/
|
|
31
|
+
loadingText?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Full-page loading indicator with centered spinner.
|
|
36
|
+
*/
|
|
37
|
+
export function LoadingPage({ contentMaxWidth, loadingText = "Loading…" }: LoadingPageProps) {
|
|
38
|
+
return (
|
|
39
|
+
<CenteredPageLayout contentMaxWidth={contentMaxWidth}>
|
|
40
|
+
<div className="flex justify-center" role="status" aria-live="polite">
|
|
41
|
+
<Spinner className={spinnerVariants({ contentMaxWidth })} aria-hidden="true" />
|
|
42
|
+
<span className="sr-only">{loadingText}</span>
|
|
43
|
+
</div>
|
|
44
|
+
</CenteredPageLayout>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(
|
|
6
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-card text-card-foreground",
|
|
11
|
+
destructive:
|
|
12
|
+
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
function Alert({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
role,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
data-slot="alert"
|
|
30
|
+
role={role ?? (variant === "destructive" ? "alert" : "status")}
|
|
31
|
+
className={cn(alertVariants({ variant }), className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Maintenance/A11y: Added 'asChild' pattern or a simple 'as' prop
|
|
38
|
+
// to allow rendering semantic headings (h1-h6).
|
|
39
|
+
interface AlertTitleProps extends React.ComponentProps<"div"> {
|
|
40
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "p";
|
|
41
|
+
}
|
|
42
|
+
function AlertTitle({ className, as: Component = "div", ...props }: AlertTitleProps) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
data-slot="alert-title"
|
|
46
|
+
className={cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
data-slot="alert-description"
|
|
56
|
+
className={cn(
|
|
57
|
+
"col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
+
outline:
|
|
16
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
18
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
19
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
23
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
24
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
25
|
+
icon: "size-9",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
function Button({
|
|
36
|
+
className,
|
|
37
|
+
variant,
|
|
38
|
+
size,
|
|
39
|
+
asChild = false,
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<"button"> &
|
|
42
|
+
VariantProps<typeof buttonVariants> & {
|
|
43
|
+
asChild?: boolean;
|
|
44
|
+
}) {
|
|
45
|
+
const Comp = asChild ? Slot : "button";
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Comp
|
|
49
|
+
data-slot="button"
|
|
50
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils";
|
|
2
|
+
|
|
3
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="card"
|
|
7
|
+
className={cn(
|
|
8
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
9
|
+
className,
|
|
10
|
+
)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
data-slot="card-header"
|
|
20
|
+
className={cn(
|
|
21
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function CardTitle({
|
|
30
|
+
className,
|
|
31
|
+
as: Component = "h3",
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<"div"> & { as?: any }) {
|
|
34
|
+
return (
|
|
35
|
+
<Component
|
|
36
|
+
data-slot="card-title"
|
|
37
|
+
className={cn("leading-none font-semibold tracking-tight", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
data-slot="card-description"
|
|
47
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
data-slot="card-action"
|
|
57
|
+
className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
64
|
+
return <div data-slot="card-content" className={cn("px-6", className)} {...props} />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
data-slot="card-footer"
|
|
71
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { Label } from "./label";
|
|
5
|
+
|
|
6
|
+
function Field({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "vertical",
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<"div"> & {
|
|
11
|
+
orientation?: "horizontal" | "vertical";
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
data-slot="field"
|
|
16
|
+
data-orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"grid gap-2",
|
|
19
|
+
orientation === "horizontal" && "flex flex-wrap items-center gap-x-3 gap-y-1.5",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {
|
|
28
|
+
return (
|
|
29
|
+
<Label
|
|
30
|
+
data-slot="field-label"
|
|
31
|
+
className={cn(
|
|
32
|
+
"data-[disabled]:opacity-50 group-data-[disabled]:opacity-50 peer-disabled:opacity-50",
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
41
|
+
return (
|
|
42
|
+
<p
|
|
43
|
+
data-slot="field-description"
|
|
44
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function FieldError({
|
|
51
|
+
className,
|
|
52
|
+
errors,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<"p"> & { errors?: (Error | undefined | null)[] }) {
|
|
55
|
+
const errorMessages = errors?.filter(Boolean).map((e) => e?.message);
|
|
56
|
+
|
|
57
|
+
if (!errorMessages?.length) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<p
|
|
63
|
+
data-slot="field-error"
|
|
64
|
+
className={cn("text-destructive text-sm", className)}
|
|
65
|
+
aria-live="polite"
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{errorMessages.join(", ")}
|
|
69
|
+
</p>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return <div data-slot="field-group" className={cn("grid gap-6", className)} {...props} />;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
78
|
+
return <fieldset data-slot="field-set" className={cn("grid gap-4", className)} {...props} />;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function FieldLegend({ className, ...props }: React.ComponentProps<"legend">) {
|
|
82
|
+
return (
|
|
83
|
+
<legend
|
|
84
|
+
data-slot="field-legend"
|
|
85
|
+
className={cn("text-foreground font-medium leading-none", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function FieldSeparator({ className, ...props }: React.ComponentProps<"div">) {
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
data-slot="field-separator"
|
|
95
|
+
role="separator"
|
|
96
|
+
className={cn("bg-border -mx-6 h-px", className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
Field,
|
|
104
|
+
FieldDescription,
|
|
105
|
+
FieldError,
|
|
106
|
+
FieldGroup,
|
|
107
|
+
FieldLabel,
|
|
108
|
+
FieldLegend,
|
|
109
|
+
FieldSeparator,
|
|
110
|
+
FieldSet,
|
|
111
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Components Index
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all UI components for easier imports.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* import { Button, Input, Tabs } from "@/components/ui"
|
|
8
|
+
*
|
|
9
|
+
* Instead of:
|
|
10
|
+
* import { Button } from "@/components/ui/button"
|
|
11
|
+
* import { Input } from "@/components/ui/input"
|
|
12
|
+
* import { Tabs } from "@/components/ui/tabs"
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export { Alert, AlertTitle, AlertDescription } from "./alert";
|
|
16
|
+
export { Button, buttonVariants } from "./button";
|
|
17
|
+
export {
|
|
18
|
+
Card,
|
|
19
|
+
CardHeader,
|
|
20
|
+
CardFooter,
|
|
21
|
+
CardTitle,
|
|
22
|
+
CardAction,
|
|
23
|
+
CardDescription,
|
|
24
|
+
CardContent,
|
|
25
|
+
} from "./card";
|
|
26
|
+
export {
|
|
27
|
+
Field,
|
|
28
|
+
FieldDescription,
|
|
29
|
+
FieldError,
|
|
30
|
+
FieldGroup,
|
|
31
|
+
FieldLabel,
|
|
32
|
+
FieldLegend,
|
|
33
|
+
FieldSeparator,
|
|
34
|
+
FieldSet,
|
|
35
|
+
} from "./field";
|
|
36
|
+
export { Input } from "./input";
|
|
37
|
+
export { Label } from "./label";
|
|
38
|
+
export {
|
|
39
|
+
Select,
|
|
40
|
+
SelectGroup,
|
|
41
|
+
SelectValue,
|
|
42
|
+
SelectTrigger,
|
|
43
|
+
SelectContent,
|
|
44
|
+
SelectLabel,
|
|
45
|
+
SelectItem,
|
|
46
|
+
SelectSeparator,
|
|
47
|
+
SelectScrollUpButton,
|
|
48
|
+
SelectScrollDownButton,
|
|
49
|
+
} from "./select";
|
|
50
|
+
export { Spinner } from "./spinner";
|
|
51
|
+
export { Skeleton } from "./skeleton";
|
|
52
|
+
export {
|
|
53
|
+
Table,
|
|
54
|
+
TableHeader,
|
|
55
|
+
TableBody,
|
|
56
|
+
TableFooter,
|
|
57
|
+
TableHead,
|
|
58
|
+
TableRow,
|
|
59
|
+
TableCell,
|
|
60
|
+
TableCaption,
|
|
61
|
+
} from "./table";
|
|
62
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
|
|
63
|
+
export {
|
|
64
|
+
Pagination,
|
|
65
|
+
PaginationContent,
|
|
66
|
+
PaginationEllipsis,
|
|
67
|
+
PaginationItem,
|
|
68
|
+
PaginationLink,
|
|
69
|
+
PaginationNext,
|
|
70
|
+
PaginationPrevious,
|
|
71
|
+
} from "./pagination";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils";
|
|
2
|
+
|
|
3
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
4
|
+
return (
|
|
5
|
+
<input
|
|
6
|
+
type={type}
|
|
7
|
+
data-slot="input"
|
|
8
|
+
className={cn(
|
|
9
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
10
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
11
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Input };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
7
|
+
return (
|
|
8
|
+
<LabelPrimitive.Root
|
|
9
|
+
data-slot="label"
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex items-center gap-2 text-sm font-medium leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Label };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { Button, buttonVariants } from "./button";
|
|
6
|
+
|
|
7
|
+
const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
|
|
8
|
+
<nav
|
|
9
|
+
role="navigation"
|
|
10
|
+
aria-label="pagination"
|
|
11
|
+
className={cn("flex justify-center", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
Pagination.displayName = "Pagination";
|
|
16
|
+
|
|
17
|
+
const PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(
|
|
18
|
+
({ className, ...props }, ref) => (
|
|
19
|
+
<ul ref={ref} className={cn("flex flex-row items-center gap-1", className)} {...props} />
|
|
20
|
+
),
|
|
21
|
+
);
|
|
22
|
+
PaginationContent.displayName = "PaginationContent";
|
|
23
|
+
|
|
24
|
+
const PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(
|
|
25
|
+
({ className, ...props }, ref) => <li ref={ref} className={cn("", className)} {...props} />,
|
|
26
|
+
);
|
|
27
|
+
PaginationItem.displayName = "PaginationItem";
|
|
28
|
+
|
|
29
|
+
type PaginationLinkProps = {
|
|
30
|
+
isActive?: boolean;
|
|
31
|
+
} & React.ComponentProps<"button">;
|
|
32
|
+
|
|
33
|
+
const PaginationLink = ({ className, isActive, disabled, ...props }: PaginationLinkProps) => (
|
|
34
|
+
<button
|
|
35
|
+
aria-current={isActive ? "page" : undefined}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
className={cn(
|
|
38
|
+
buttonVariants({
|
|
39
|
+
variant: isActive ? "default" : "outline",
|
|
40
|
+
size: "sm",
|
|
41
|
+
}),
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
PaginationLink.displayName = "PaginationLink";
|
|
48
|
+
|
|
49
|
+
const PaginationPrevious = ({
|
|
50
|
+
className,
|
|
51
|
+
disabled,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof Button>) => (
|
|
54
|
+
<PaginationLink
|
|
55
|
+
aria-label="Go to previous page"
|
|
56
|
+
className={cn("gap-1 pl-2.5", className)}
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
<ChevronLeft className="h-4 w-4" />
|
|
61
|
+
<span>Previous</span>
|
|
62
|
+
</PaginationLink>
|
|
63
|
+
);
|
|
64
|
+
PaginationPrevious.displayName = "PaginationPrevious";
|
|
65
|
+
|
|
66
|
+
const PaginationNext = ({ className, disabled, ...props }: React.ComponentProps<typeof Button>) => (
|
|
67
|
+
<PaginationLink
|
|
68
|
+
aria-label="Go to next page"
|
|
69
|
+
className={cn("gap-1 pr-2.5", className)}
|
|
70
|
+
disabled={disabled}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
<span>Next</span>
|
|
74
|
+
<ChevronRight className="h-4 w-4" />
|
|
75
|
+
</PaginationLink>
|
|
76
|
+
);
|
|
77
|
+
PaginationNext.displayName = "PaginationNext";
|
|
78
|
+
|
|
79
|
+
const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
|
|
80
|
+
<span
|
|
81
|
+
aria-hidden
|
|
82
|
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
>
|
|
85
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
86
|
+
<span className="sr-only">More pages</span>
|
|
87
|
+
</span>
|
|
88
|
+
);
|
|
89
|
+
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
Pagination,
|
|
93
|
+
PaginationContent,
|
|
94
|
+
PaginationEllipsis,
|
|
95
|
+
PaginationItem,
|
|
96
|
+
PaginationLink,
|
|
97
|
+
PaginationNext,
|
|
98
|
+
PaginationPrevious,
|
|
99
|
+
};
|