Baseline: stan przed refaktoryzacja struktury

This commit is contained in:
tisachi
2026-09-04 19:06:19 +02:00
commit 1c8594ad96
369 changed files with 71407 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import type { ReactNode } from 'react';
import { cn } from '../../lib/utils';
function ErrorText({ children, className }: { children: ReactNode; className?: string }) {
return <div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-danger', className)}>{children}</div>;
}
function SuccessText({ children, className }: { children: ReactNode; className?: string }) {
return <div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-accent-text', className)}>{children}</div>;
}
export { ErrorText, SuccessText };

View File

@@ -0,0 +1,31 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../../lib/utils';
const badgeVariants = cva(
'inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[0.75rem] font-bold whitespace-nowrap',
{
variants: {
color: {
green: 'bg-accent/14 text-accent-text',
gray: 'bg-dim/13 text-dim',
red: 'bg-danger/12 text-danger',
yellow: 'bg-warn/13 text-warn',
blue: 'bg-info/13 text-info',
},
},
defaultVariants: {
color: 'gray',
},
},
);
export interface BadgeProps
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, color, ...props }: BadgeProps) {
return <span data-slot="badge" className={cn(badgeVariants({ color }), className)} {...props} />;
}
export { Badge, badgeVariants };

View File

@@ -0,0 +1,47 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../../lib/utils';
const buttonVariants = cva(
'inline-flex items-center justify-center gap-2 rounded-[10px] font-bold whitespace-nowrap cursor-pointer transition-all duration-150 disabled:cursor-not-allowed disabled:opacity-50 active:scale-[.985] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 focus-visible:ring-offset-2 focus-visible:ring-offset-bg',
{
variants: {
variant: {
primary: 'bg-(image:--btn-grad) text-accent-ink shadow-(--btn-shadow) hover:brightness-105',
secondary:
'bg-card/60 text-ink border border-line shadow-card hover:border-accent/55 hover:text-accent-text',
danger: 'bg-transparent text-danger border border-danger/45 hover:bg-danger/10',
ghost: 'bg-transparent text-dim hover:text-ink hover:bg-line/30',
},
size: {
md: 'h-10 px-[18px] text-[0.875rem]',
sm: 'h-8 px-3 text-[0.8125rem] rounded-lg',
},
},
defaultVariants: {
variant: 'primary',
size: 'md',
},
},
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
Omit<VariantProps<typeof buttonVariants>, 'size'> {
size?: 'md' | 'sm';
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, type = 'button', ...props }, ref) => (
<button
type={type}
data-slot="button"
className={cn(buttonVariants({ variant, size }), className)}
ref={ref}
{...props}
/>
),
);
Button.displayName = 'Button';
export { Button, buttonVariants };

View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import { cn } from '../../lib/utils';
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div
ref={ref}
data-slot="card"
className={cn('bg-(image:--card-grad) border border-line rounded-lg shadow-card p-5 sm:p-6 mb-4', className)}
{...props}
/>
),
);
Card.displayName = 'Card';
export { Card };

View File

@@ -0,0 +1,101 @@
import * as React from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { cn } from '../../lib/utils';
const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger;
const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close;
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
'fixed inset-0 z-50 bg-black/60 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=open]:fade-in-0 duration-200',
className,
)}
ref={ref}
{...props}
/>
));
DialogOverlay.displayName = 'DialogOverlay';
/**
* Content: bottom-sheet na mobile (przylega do dołu, zaokrąglone góra),
* wyśrodkowany panel na desktopie. max-h 85vh ze scrollowaniem.
*/
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
ref={ref}
className={cn(
'fixed inset-x-0 bottom-0 z-50 max-h-[85vh] w-full overflow-y-auto rounded-t-2xl border border-line bg-card p-5 shadow-card',
'sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl',
'duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-bottom-2',
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
className,
)}
{...props}
>
{children}
</DialogPrimitive.Content>
</DialogPortal>
));
DialogContent.displayName = 'DialogContent';
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div data-slot="dialog-header" className={cn('mb-4 flex items-center justify-between gap-3', className)} {...props} />
);
DialogHeader.displayName = 'DialogHeader';
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div data-slot="dialog-footer" className={cn('mt-5 flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-end', className)} {...props} />
);
DialogFooter.displayName = 'DialogFooter';
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
data-slot="dialog-title"
ref={ref}
className={cn('text-[1.05rem] font-semibold', className)}
{...props}
/>
));
DialogTitle.displayName = 'DialogTitle';
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
data-slot="dialog-description"
ref={ref}
className={cn('text-dim text-[0.95rem]', className)}
{...props}
/>
));
DialogDescription.displayName = 'DialogDescription';
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
};

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import { Label } from './label';
import { cn } from '../../lib/utils';
interface FieldProps extends React.HTMLAttributes<HTMLDivElement> {
label: string;
}
function Field({ className, label, children, ...props }: FieldProps) {
return (
<div data-slot="field" className={cn('mb-3.5', className)} {...props}>
<Label>{label}</Label>
{children}
</div>
);
}
export { Field };

View File

@@ -0,0 +1,31 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../../lib/utils';
const inputVariants = cva(
'w-full bg-input border border-line rounded-[10px] text-ink font-[inherit] placeholder:text-dim/70 shadow-(--inset-shadow) transition-shadow duration-150 focus:outline-none focus:border-accent-text focus:ring-[3px] focus:ring-accent/18 disabled:cursor-not-allowed disabled:opacity-50',
{
variants: {
size: {
md: 'h-10 px-3 text-[0.95rem]',
sm: 'h-8 px-3 text-[0.875rem]',
},
},
defaultVariants: {
size: 'md',
},
},
);
export interface InputProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>,
VariantProps<typeof inputVariants> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, size, type, ...props }, ref) => (
<input type={type} data-slot="input" className={cn(inputVariants({ size }), className)} ref={ref} {...props} />
),
);
Input.displayName = 'Input';
export { Input, inputVariants };

View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import { cn } from '../../lib/utils';
const Label = React.forwardRef<HTMLLabelElement, React.LabelHTMLAttributes<HTMLLabelElement>>(
({ className, ...props }, ref) => (
<label
ref={ref}
data-slot="label"
className={cn('block mb-1.5 text-dim text-[11px] font-bold uppercase tracking-[0.1em]', className)}
{...props}
/>
),
);
Label.displayName = 'Label';
export { Label };

View File

@@ -0,0 +1,14 @@
import { cn } from '../../lib/utils';
function Progress({ percent, className }: { percent: number; className?: string }) {
return (
<div data-slot="progress" className={cn('h-2 overflow-hidden rounded-full bg-input', className)}>
<div
className="h-full rounded-full bg-(image:--progress-grad) transition-[width] duration-300"
style={{ width: `${Math.max(0, Math.min(100, percent))}%` }}
/>
</div>
);
}
export { Progress };

View File

@@ -0,0 +1,23 @@
import * as React from 'react';
import * as SeparatorPrimitive from '@radix-ui/react-separator';
import { cn } from '../../lib/utils';
const Separator = React.forwardRef<
React.ElementRef<typeof SeparatorPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
<SeparatorPrimitive.Root
ref={ref}
data-slot="separator"
decorative={decorative}
orientation={orientation}
className={cn(
'shrink-0 bg-line data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
className,
)}
{...props}
/>
));
Separator.displayName = 'Separator';
export { Separator };

View File

@@ -0,0 +1,8 @@
import * as React from 'react';
import { cn } from '../../lib/utils';
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div data-slot="skeleton" className={cn('skeleton-shimmer rounded-lg', className)} {...props} />;
}
export { Skeleton };

View File

@@ -0,0 +1,31 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../../lib/utils';
const textareaVariants = cva(
'w-full bg-input border border-line rounded-[10px] text-ink font-[inherit] placeholder:text-dim/70 shadow-(--inset-shadow) transition-shadow duration-150 focus:outline-none focus:border-accent-text focus:ring-[3px] focus:ring-accent/18 disabled:cursor-not-allowed disabled:opacity-50',
{
variants: {
size: {
md: 'px-3 py-2.5 text-[0.95rem]',
sm: 'px-3 py-1.5 text-[0.875rem]',
},
},
defaultVariants: {
size: 'md',
},
},
);
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement>,
VariantProps<typeof textareaVariants> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, size, ...props }, ref) => (
<textarea data-slot="textarea" className={cn(textareaVariants({ size }), className)} ref={ref} {...props} />
),
);
Textarea.displayName = 'Textarea';
export { Textarea, textareaVariants };