@pattern-stack/frontend-patterns 0.0.1 → 0.0.3
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/README.md +6 -6
- package/package.json +3 -5
- package/src/App.css +0 -42
- package/src/App.tsx +0 -54
- package/src/__tests__/README.md +0 -221
- package/src/__tests__/atoms/hooks/simple-hooks.test.ts +0 -44
- package/src/__tests__/atoms/ui/button.test.tsx +0 -68
- package/src/__tests__/atoms/utils/simple.test.ts +0 -18
- package/src/__tests__/atoms/utils/utils.test.ts +0 -77
- package/src/__tests__/features/auth/simple-auth.test.tsx +0 -40
- package/src/__tests__/molecules/layout/simple-layout.test.tsx +0 -81
- package/src/__tests__/organisms/showcase/simple-showcase.test.tsx +0 -167
- package/src/__tests__/setup.ts +0 -51
- package/src/__tests__/utils.tsx +0 -123
- package/src/atoms/composed/Accordion/Accordion.tsx +0 -271
- package/src/atoms/composed/Accordion/index.ts +0 -1
- package/src/atoms/composed/Alert/Alert.tsx +0 -132
- package/src/atoms/composed/Alert/index.ts +0 -1
- package/src/atoms/composed/Breadcrumb/Breadcrumb.tsx +0 -83
- package/src/atoms/composed/Breadcrumb/index.ts +0 -1
- package/src/atoms/composed/Chart/Chart.tsx +0 -425
- package/src/atoms/composed/Chart/index.ts +0 -2
- package/src/atoms/composed/ColorSwatch/ColorSwatch.tsx +0 -72
- package/src/atoms/composed/ColorSwatch/index.ts +0 -1
- package/src/atoms/composed/DarkModeToggle.tsx +0 -66
- package/src/atoms/composed/DataBadge/DataBadge.tsx +0 -81
- package/src/atoms/composed/DataBadge/index.ts +0 -1
- package/src/atoms/composed/DataTable/DataTable.tsx +0 -394
- package/src/atoms/composed/DataTable/TableCellWithTooltip.tsx +0 -41
- package/src/atoms/composed/DataTable/index.ts +0 -2
- package/src/atoms/composed/DateTimePicker/DateTimePicker.tsx +0 -611
- package/src/atoms/composed/DateTimePicker/index.ts +0 -2
- package/src/atoms/composed/DetailedCard/DetailedCard.tsx +0 -181
- package/src/atoms/composed/DetailedCard/index.ts +0 -2
- package/src/atoms/composed/EmptyState/EmptyState.tsx +0 -90
- package/src/atoms/composed/EmptyState/index.ts +0 -1
- package/src/atoms/composed/FileUpload/FileUpload.tsx +0 -477
- package/src/atoms/composed/FileUpload/index.ts +0 -2
- package/src/atoms/composed/FormField/FormField.tsx +0 -92
- package/src/atoms/composed/FormField/index.ts +0 -1
- package/src/atoms/composed/GlobalSearch/GlobalSearch.tsx +0 -37
- package/src/atoms/composed/GlobalSearch/index.ts +0 -1
- package/src/atoms/composed/IconBadge/IconBadge.tsx +0 -95
- package/src/atoms/composed/IconBadge/index.ts +0 -2
- package/src/atoms/composed/Modal/Modal.tsx +0 -223
- package/src/atoms/composed/Modal/index.ts +0 -2
- package/src/atoms/composed/PaletteSwitcher.tsx +0 -386
- package/src/atoms/composed/ProgressBar/ProgressBar.tsx +0 -116
- package/src/atoms/composed/ProgressBar/index.ts +0 -1
- package/src/atoms/composed/StatCard/StatCard.tsx +0 -219
- package/src/atoms/composed/StatCard/index.ts +0 -1
- package/src/atoms/composed/StyleGuide.tsx +0 -717
- package/src/atoms/composed/Toast/Toast.tsx +0 -219
- package/src/atoms/composed/Toast/index.ts +0 -1
- package/src/atoms/composed/Tooltip/Tooltip.tsx +0 -213
- package/src/atoms/composed/Tooltip/index.ts +0 -1
- package/src/atoms/composed/UserAvatar/UserAvatar.tsx +0 -139
- package/src/atoms/composed/UserAvatar/index.ts +0 -1
- package/src/atoms/composed/UserMenu/UserMenu.tsx +0 -16
- package/src/atoms/composed/UserMenu/index.ts +0 -1
- package/src/atoms/composed/index.ts +0 -29
- package/src/atoms/hooks/useApi.ts +0 -80
- package/src/atoms/hooks/useHealth.ts +0 -17
- package/src/atoms/index.ts +0 -13
- package/src/atoms/services/api/client.ts +0 -134
- package/src/atoms/services/auth-service.ts +0 -248
- package/src/atoms/services/health.ts +0 -15
- package/src/atoms/services/index.ts +0 -3
- package/src/atoms/shared/config/constants.ts +0 -17
- package/src/atoms/shared/config/dashboard-sizes.ts +0 -111
- package/src/atoms/shared/config/environment.ts +0 -10
- package/src/atoms/shared/index.ts +0 -4
- package/src/atoms/shared/styles/color-palettes.css +0 -566
- package/src/atoms/types/auth.ts +0 -62
- package/src/atoms/types/generated.ts +0 -1469
- package/src/atoms/types/index.ts +0 -4
- package/src/atoms/types/loading.ts +0 -28
- package/src/atoms/ui/Badge.tsx +0 -30
- package/src/atoms/ui/ErrorBoundary.tsx +0 -59
- package/src/atoms/ui/Select.tsx +0 -53
- package/src/atoms/ui/Switch.tsx +0 -42
- package/src/atoms/ui/Tabs.tsx +0 -118
- package/src/atoms/ui/avatar.tsx +0 -48
- package/src/atoms/ui/button.tsx +0 -70
- package/src/atoms/ui/card.tsx +0 -76
- package/src/atoms/ui/dropdown-menu.tsx +0 -199
- package/src/atoms/ui/index.ts +0 -39
- package/src/atoms/ui/input.tsx +0 -23
- package/src/atoms/ui/label.tsx +0 -23
- package/src/atoms/ui/skeleton.tsx +0 -13
- package/src/atoms/ui/spinner.tsx +0 -49
- package/src/atoms/ui/table.tsx +0 -116
- package/src/atoms/utils/animations.ts +0 -135
- package/src/atoms/utils/tooltip-helpers.ts +0 -140
- package/src/atoms/utils/utils.ts +0 -9
- package/src/features/auth/components/LoginForm.tsx +0 -168
- package/src/features/auth/components/LogoutButton.tsx +0 -19
- package/src/features/auth/components/ProtectedRoute.tsx +0 -60
- package/src/features/auth/components/index.ts +0 -4
- package/src/features/auth/hooks/index.ts +0 -2
- package/src/features/auth/hooks/useAuth.tsx +0 -205
- package/src/features/auth/hooks/usePermissions.ts +0 -35
- package/src/features/auth/index.ts +0 -2
- package/src/features/index.ts +0 -2
- package/src/index.css +0 -704
- package/src/index.ts +0 -13
- package/src/main.tsx +0 -48
- package/src/molecules/.gitkeep +0 -0
- package/src/molecules/forms/FormGroup.tsx +0 -75
- package/src/molecules/forms/SearchInput.tsx +0 -259
- package/src/molecules/forms/index.ts +0 -4
- package/src/molecules/index.ts +0 -4
- package/src/molecules/layout/AppHeader/AppHeader.tsx +0 -42
- package/src/molecules/layout/AppHeader/index.ts +0 -1
- package/src/molecules/layout/AppLayout.tsx +0 -29
- package/src/molecules/layout/PageTemplate.tsx +0 -87
- package/src/molecules/layout/SectionHeader/SectionHeader.tsx +0 -87
- package/src/molecules/layout/SectionHeader/index.ts +0 -1
- package/src/molecules/layout/ShowcaseSection.tsx +0 -57
- package/src/molecules/layout/Sidebar.tsx +0 -144
- package/src/molecules/layout/SidebarButton/SidebarButton.tsx +0 -99
- package/src/molecules/layout/SidebarButton/index.ts +0 -1
- package/src/molecules/layout/SidebarContext.tsx +0 -31
- package/src/molecules/layout/index.ts +0 -7
- package/src/molecules/navigation/NavMenu.tsx +0 -188
- package/src/molecules/navigation/Pagination.tsx +0 -172
- package/src/molecules/navigation/index.ts +0 -4
- package/src/organisms/index.ts +0 -5
- package/src/organisms/showcase/ComponentShowcasePage.tsx +0 -2496
- package/src/organisms/showcase/index.ts +0 -1
- package/src/pages/AdminShowcase/AdminCRUDShowcase.tsx +0 -242
- package/src/pages/AdminShowcase/AdminDashboardShowcase.tsx +0 -171
- package/src/pages/AdminShowcase/AdminDetailShowcase.tsx +0 -385
- package/src/pages/AdminShowcase/index.tsx +0 -3
- package/src/pages/ComponentShowcase/BadgesShowcase.tsx +0 -188
- package/src/pages/ComponentShowcase/CardsShowcase.tsx +0 -392
- package/src/pages/ComponentShowcase/PalettesShowcase.tsx +0 -207
- package/src/pages/ComponentShowcase/StatesShowcase.tsx +0 -485
- package/src/pages/ComponentShowcase/TablesShowcase.tsx +0 -134
- package/src/pages/ComponentShowcase/TypographyShowcase.tsx +0 -255
- package/src/pages/ComponentShowcase/index.tsx +0 -188
- package/src/pages/index.ts +0 -2
- package/src/templates/AuthTemplate.tsx +0 -216
- package/src/templates/ComponentShowcaseTemplate.tsx +0 -173
- package/src/templates/DashboardTemplate.tsx +0 -232
- package/src/templates/DataTemplate.tsx +0 -319
- package/src/templates/admin/AdminCRUDTemplate.tsx +0 -630
- package/src/templates/admin/AdminDashboardTemplate.tsx +0 -351
- package/src/templates/admin/AdminDetailTemplate.tsx +0 -563
- package/src/templates/admin/index.ts +0 -29
- package/src/templates/factory.tsx +0 -169
- package/src/templates/index.ts +0 -37
- package/src/vite-env.d.ts +0 -1
package/src/atoms/types/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base interface for components that support loading states
|
|
3
|
-
*/
|
|
4
|
-
export interface ILoadable {
|
|
5
|
-
/** Whether the component is in a loading state */
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Interface for list components that support configurable loading item counts
|
|
11
|
-
*/
|
|
12
|
-
export interface IListLoadable extends ILoadable {
|
|
13
|
-
/** Number of skeleton items to show when loading */
|
|
14
|
-
loadingItemCount?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Common loading states for data components
|
|
19
|
-
*/
|
|
20
|
-
export type LoadingState = 'idle' | 'loading' | 'error' | 'success';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Props for components that need loading state management
|
|
24
|
-
*/
|
|
25
|
-
export interface LoadingStateProps {
|
|
26
|
-
loadingState?: LoadingState;
|
|
27
|
-
error?: string | null;
|
|
28
|
-
}
|
package/src/atoms/ui/Badge.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { cn } from '../utils/utils';
|
|
3
|
-
|
|
4
|
-
interface BadgeProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
|
7
|
-
size?: 'sm' | 'md' | 'lg';
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Badge = ({ children, variant = 'default', size = 'md', className }: BadgeProps) => {
|
|
12
|
-
const baseClasses = 'inline-flex items-center rounded-full font-medium transition-all duration-150';
|
|
13
|
-
const sizeClasses = {
|
|
14
|
-
sm: 'px-2 py-0.5 text-xs',
|
|
15
|
-
md: 'px-2.5 py-1 text-xs',
|
|
16
|
-
lg: 'px-3 py-1.5 text-sm'
|
|
17
|
-
};
|
|
18
|
-
const variantClasses = {
|
|
19
|
-
default: 'bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20',
|
|
20
|
-
secondary: 'bg-gray-100 text-gray-700 border border-gray-200 hover:bg-gray-200',
|
|
21
|
-
destructive: 'bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive/20',
|
|
22
|
-
outline: 'border border-gray-300 text-gray-700 bg-white hover:bg-gray-50'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<span className={cn(baseClasses, sizeClasses[size], variantClasses[variant], className)}>
|
|
27
|
-
{children}
|
|
28
|
-
</span>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
import type { ErrorInfo, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
fallback?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface State {
|
|
10
|
-
hasError: boolean;
|
|
11
|
-
error?: Error;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class ErrorBoundary extends Component<Props, State> {
|
|
15
|
-
public state: State = {
|
|
16
|
-
hasError: false,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
public static getDerivedStateFromError(error: Error): State {
|
|
20
|
-
return { hasError: true, error };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
24
|
-
console.error('ErrorBoundary caught an error:', error, errorInfo);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public render() {
|
|
28
|
-
if (this.state.hasError) {
|
|
29
|
-
if (this.props.fallback) {
|
|
30
|
-
return this.props.fallback;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className="p-6 bg-destructive/10 border border-destructive/20 rounded-[--radius]">
|
|
35
|
-
<h3 className="text-destructive font-medium mb-2">Something went wrong</h3>
|
|
36
|
-
<p className="text-muted-foreground text-sm mb-4">
|
|
37
|
-
An unexpected error occurred. Please refresh the page or try again later.
|
|
38
|
-
</p>
|
|
39
|
-
<details className="text-xs text-destructive/80">
|
|
40
|
-
<summary className="cursor-pointer">Error details</summary>
|
|
41
|
-
<pre className="mt-2 whitespace-pre-wrap">
|
|
42
|
-
{this.state.error?.message}
|
|
43
|
-
{'\n'}
|
|
44
|
-
{this.state.error?.stack}
|
|
45
|
-
</pre>
|
|
46
|
-
</details>
|
|
47
|
-
<button
|
|
48
|
-
onClick={() => window.location.reload()}
|
|
49
|
-
className="mt-4 px-4 py-2 bg-destructive text-destructive-foreground rounded-[--radius] hover:bg-destructive/90 text-sm"
|
|
50
|
-
>
|
|
51
|
-
Reload Page
|
|
52
|
-
</button>
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return this.props.children;
|
|
58
|
-
}
|
|
59
|
-
}
|
package/src/atoms/ui/Select.tsx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { cn } from '../utils/utils';
|
|
3
|
-
|
|
4
|
-
interface SelectProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
onValueChange?: (value: string) => void;
|
|
7
|
-
defaultValue?: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Select = ({ children }: SelectProps) => (
|
|
12
|
-
<div className="relative">{children}</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
interface SelectTriggerProps {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
className?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const SelectTrigger = ({ children, className }: SelectTriggerProps) => (
|
|
21
|
-
<button className={cn("flex h-10 w-full items-center justify-between rounded-[--radius] border px-3 py-2 text-sm", className)}>
|
|
22
|
-
{children}
|
|
23
|
-
</button>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
interface SelectValueProps {
|
|
27
|
-
placeholder?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const SelectValue = ({ placeholder }: SelectValueProps) => (
|
|
31
|
-
<span className="text-muted-foreground">{placeholder}</span>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
interface SelectContentProps {
|
|
35
|
-
children: React.ReactNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const SelectContent = ({ children }: SelectContentProps) => (
|
|
39
|
-
<div className="absolute top-full left-0 z-50 w-full rounded-[--radius] border bg-popover shadow-[0_10px_15px_-3px_rgb(0_0_0_/_0.1),0_4px_6px_-4px_rgb(0_0_0_/_0.1)]">
|
|
40
|
-
{children}
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
interface SelectItemProps {
|
|
45
|
-
children: React.ReactNode;
|
|
46
|
-
value: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const SelectItem = ({ children }: SelectItemProps) => (
|
|
50
|
-
<div className="relative flex w-full cursor-default select-none items-center rounded-[calc(var(--radius)-2px)] py-1.5 px-2 text-sm hover:bg-accent hover:text-accent-foreground">
|
|
51
|
-
{children}
|
|
52
|
-
</div>
|
|
53
|
-
);
|
package/src/atoms/ui/Switch.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { cn } from '../utils/utils';
|
|
2
|
-
|
|
3
|
-
interface SwitchProps {
|
|
4
|
-
checked?: boolean;
|
|
5
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
6
|
-
className?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Switch = ({ checked, onCheckedChange, className, disabled }: SwitchProps) => {
|
|
11
|
-
return (
|
|
12
|
-
<button
|
|
13
|
-
type="button"
|
|
14
|
-
role="switch"
|
|
15
|
-
aria-checked={checked}
|
|
16
|
-
data-1p-ignore
|
|
17
|
-
data-lpignore="true"
|
|
18
|
-
className={cn(
|
|
19
|
-
'relative inline-flex h-6 w-11 items-center rounded-full transition-all duration-200',
|
|
20
|
-
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
21
|
-
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
22
|
-
checked
|
|
23
|
-
? 'bg-category-1 shadow-sm'
|
|
24
|
-
: 'bg-muted border-2 border-border shadow-inner',
|
|
25
|
-
!disabled && 'hover:shadow-md',
|
|
26
|
-
className
|
|
27
|
-
)}
|
|
28
|
-
onClick={() => !disabled && onCheckedChange?.(!checked)}
|
|
29
|
-
disabled={disabled}
|
|
30
|
-
>
|
|
31
|
-
<span
|
|
32
|
-
className={cn(
|
|
33
|
-
'inline-block h-4 w-4 transform rounded-full transition-all duration-200 shadow-md',
|
|
34
|
-
'ring-0 bg-background border border-border/20',
|
|
35
|
-
checked
|
|
36
|
-
? 'translate-x-5 bg-white border-white/50'
|
|
37
|
-
: 'translate-x-0.5 bg-background'
|
|
38
|
-
)}
|
|
39
|
-
/>
|
|
40
|
-
</button>
|
|
41
|
-
);
|
|
42
|
-
};
|
package/src/atoms/ui/Tabs.tsx
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext, useState } from 'react';
|
|
2
|
-
import { cn } from '../utils/utils';
|
|
3
|
-
import { getAnimationClasses, animationPresets } from '../utils/animations';
|
|
4
|
-
|
|
5
|
-
interface TabsContextType {
|
|
6
|
-
activeTab: string;
|
|
7
|
-
setActiveTab: (tab: string) => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const TabsContext = createContext<TabsContextType | null>(null);
|
|
11
|
-
|
|
12
|
-
interface TabsProps {
|
|
13
|
-
children: React.ReactNode;
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
value?: string;
|
|
16
|
-
onValueChange?: (value: string) => void;
|
|
17
|
-
className?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const Tabs = ({ children, defaultValue, value, onValueChange, className }: TabsProps) => {
|
|
21
|
-
const [internalActiveTab, setInternalActiveTab] = useState(defaultValue || '');
|
|
22
|
-
|
|
23
|
-
const activeTab = value !== undefined ? value : internalActiveTab;
|
|
24
|
-
const setActiveTab = (tab: string) => {
|
|
25
|
-
if (onValueChange) {
|
|
26
|
-
onValueChange(tab);
|
|
27
|
-
} else {
|
|
28
|
-
setInternalActiveTab(tab);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<TabsContext.Provider value={{ activeTab, setActiveTab }}>
|
|
34
|
-
<div className={className}>{children}</div>
|
|
35
|
-
</TabsContext.Provider>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
interface TabsListProps {
|
|
40
|
-
children: React.ReactNode;
|
|
41
|
-
className?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const TabsList = ({ children, className }: TabsListProps) => (
|
|
45
|
-
<div
|
|
46
|
-
className={cn(
|
|
47
|
-
'h-auto min-h-10 items-center justify-center rounded-lg bg-card border border-border shadow-sm',
|
|
48
|
-
'flex flex-wrap gap-1 sm:gap-2 lg:gap-3 w-full lg:w-fit mx-auto mb-6 p-1',
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
data-component-name="TabsList"
|
|
52
|
-
>
|
|
53
|
-
{children}
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
interface TabsTriggerProps {
|
|
58
|
-
children: React.ReactNode;
|
|
59
|
-
value: string;
|
|
60
|
-
className?: string;
|
|
61
|
-
category?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
62
|
-
'data-category'?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const TabsTrigger = ({ children, value, className, category, 'data-category': dataCategory }: TabsTriggerProps) => {
|
|
66
|
-
// Use data-category if provided, otherwise fallback to category prop, then default to 1
|
|
67
|
-
const effectiveCategory = dataCategory ? parseInt(dataCategory) as 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 : category || 1;
|
|
68
|
-
const context = useContext(TabsContext);
|
|
69
|
-
const isActive = context?.activeTab === value;
|
|
70
|
-
|
|
71
|
-
const activeStyles = isActive ? {
|
|
72
|
-
backgroundColor: `hsl(var(--category-${effectiveCategory}) / 0.15)`,
|
|
73
|
-
color: `hsl(var(--category-${effectiveCategory}))`,
|
|
74
|
-
borderColor: `hsl(var(--category-${effectiveCategory}) / 0.3)`,
|
|
75
|
-
boxShadow: 'var(--shadow-sm)'
|
|
76
|
-
} : {};
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<button
|
|
80
|
-
className={cn(
|
|
81
|
-
'w-auto flex-grow items-center justify-center whitespace-nowrap rounded-md px-1 sm:px-2 md:px-3 py-1 sm:py-2 text-sm font-medium',
|
|
82
|
-
// Always have a border to prevent layout shifts
|
|
83
|
-
'border',
|
|
84
|
-
isActive
|
|
85
|
-
? '' // Remove class-based styling when using inline styles
|
|
86
|
-
: cn(
|
|
87
|
-
'text-muted-foreground hover:text-foreground border-transparent hover:bg-muted/80',
|
|
88
|
-
getAnimationClasses(animationPresets.tab)
|
|
89
|
-
),
|
|
90
|
-
className
|
|
91
|
-
)}
|
|
92
|
-
style={activeStyles}
|
|
93
|
-
onClick={() => context?.setActiveTab(value)}
|
|
94
|
-
data-component-name="TabsTrigger"
|
|
95
|
-
>
|
|
96
|
-
{children}
|
|
97
|
-
</button>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
interface TabsContentProps {
|
|
102
|
-
children: React.ReactNode;
|
|
103
|
-
value: string;
|
|
104
|
-
className?: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const TabsContent = ({ children, value, className }: TabsContentProps) => {
|
|
108
|
-
const context = useContext(TabsContext);
|
|
109
|
-
const isActive = context?.activeTab === value;
|
|
110
|
-
|
|
111
|
-
if (!isActive) return null;
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<div className={cn('mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', className)}>
|
|
115
|
-
{children}
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
};
|
package/src/atoms/ui/avatar.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
|
3
|
-
|
|
4
|
-
import { cn } from '../utils/utils'
|
|
5
|
-
|
|
6
|
-
const Avatar = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
9
|
-
>(({ className, ...props }, ref) => (
|
|
10
|
-
<AvatarPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
))
|
|
19
|
-
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
20
|
-
|
|
21
|
-
const AvatarImage = React.forwardRef<
|
|
22
|
-
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
23
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
24
|
-
>(({ className, ...props }, ref) => (
|
|
25
|
-
<AvatarPrimitive.Image
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn("aspect-square h-full w-full", className)}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
))
|
|
31
|
-
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
32
|
-
|
|
33
|
-
const AvatarFallback = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
36
|
-
>(({ className, ...props }, ref) => (
|
|
37
|
-
<AvatarPrimitive.Fallback
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn(
|
|
40
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
41
|
-
className
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
))
|
|
46
|
-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
47
|
-
|
|
48
|
-
export { Avatar, AvatarImage, AvatarFallback }
|
package/src/atoms/ui/button.tsx
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
-
import { cn } from '../utils/utils'
|
|
5
|
-
import { Tooltip } from '../composed/Tooltip'
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-lg text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98]",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-gradient-to-r from-primary to-primary/90 text-primary-foreground hover:from-primary/90 hover:to-primary/80 shadow-sm hover:shadow-md",
|
|
13
|
-
destructive:
|
|
14
|
-
"bg-gradient-to-r from-destructive to-destructive/90 text-destructive-foreground hover:from-destructive/90 hover:to-destructive/80 shadow-sm hover:shadow-md",
|
|
15
|
-
outline:
|
|
16
|
-
"border border-gray-300 bg-white hover:bg-gray-50 hover:border-primary/50 shadow-sm",
|
|
17
|
-
secondary:
|
|
18
|
-
"bg-gray-100 text-gray-900 hover:bg-gray-200 shadow-sm",
|
|
19
|
-
ghost: "hover:bg-muted/80 hover:text-foreground",
|
|
20
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
-
},
|
|
22
|
-
size: {
|
|
23
|
-
default: "h-10 px-5 py-2",
|
|
24
|
-
sm: "h-9 rounded-lg px-3 text-xs",
|
|
25
|
-
lg: "h-12 rounded-lg px-8 text-base",
|
|
26
|
-
icon: "h-10 w-10",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: "default",
|
|
31
|
-
size: "default",
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
export interface ButtonProps
|
|
37
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
38
|
-
VariantProps<typeof buttonVariants> {
|
|
39
|
-
asChild?: boolean
|
|
40
|
-
/** Tooltip to show on hover (especially useful for icon-only buttons) */
|
|
41
|
-
tooltip?: string
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
45
|
-
({ className, variant, size, asChild = false, tooltip, ...props }, ref) => {
|
|
46
|
-
const Comp = asChild ? Slot : "button"
|
|
47
|
-
|
|
48
|
-
const button = (
|
|
49
|
-
<Comp
|
|
50
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
51
|
-
ref={ref}
|
|
52
|
-
{...props}
|
|
53
|
-
/>
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
// Show tooltip for icon-only buttons or when explicitly provided
|
|
57
|
-
if (tooltip && !asChild) {
|
|
58
|
-
return (
|
|
59
|
-
<Tooltip content={tooltip} position="top" size="sm">
|
|
60
|
-
{button}
|
|
61
|
-
</Tooltip>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return button
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
Button.displayName = "Button"
|
|
69
|
-
|
|
70
|
-
export { Button, buttonVariants }
|
package/src/atoms/ui/card.tsx
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cn } from '../utils/utils'
|
|
3
|
-
|
|
4
|
-
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
category?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Card = React.forwardRef<HTMLDivElement, CardProps>(
|
|
9
|
-
({ className, category, style, ...props }, ref) => {
|
|
10
|
-
return (
|
|
11
|
-
<div
|
|
12
|
-
ref={ref}
|
|
13
|
-
className={cn(
|
|
14
|
-
"rounded-lg border border-border bg-card text-card-foreground shadow-sm hover:shadow-md",
|
|
15
|
-
category && [
|
|
16
|
-
"border-l-4 hover:border-border/80",
|
|
17
|
-
`card-category-${category}`
|
|
18
|
-
],
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
style={style}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
Card.displayName = "Card"
|
|
28
|
-
|
|
29
|
-
const CardHeader = React.forwardRef<
|
|
30
|
-
HTMLDivElement,
|
|
31
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
32
|
-
>(({ className, ...props }, ref) => (
|
|
33
|
-
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
34
|
-
))
|
|
35
|
-
CardHeader.displayName = "CardHeader"
|
|
36
|
-
|
|
37
|
-
const CardTitle = React.forwardRef<
|
|
38
|
-
HTMLParagraphElement,
|
|
39
|
-
React.HTMLAttributes<HTMLHeadingElement>
|
|
40
|
-
>(({ className, ...props }, ref) => (
|
|
41
|
-
<h3
|
|
42
|
-
ref={ref}
|
|
43
|
-
className={cn(
|
|
44
|
-
"text-2xl font-semibold leading-none tracking-tight",
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
))
|
|
50
|
-
CardTitle.displayName = "CardTitle"
|
|
51
|
-
|
|
52
|
-
const CardDescription = React.forwardRef<
|
|
53
|
-
HTMLParagraphElement,
|
|
54
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
55
|
-
>(({ className, ...props }, ref) => (
|
|
56
|
-
<p ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
57
|
-
))
|
|
58
|
-
CardDescription.displayName = "CardDescription"
|
|
59
|
-
|
|
60
|
-
const CardContent = React.forwardRef<
|
|
61
|
-
HTMLDivElement,
|
|
62
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
63
|
-
>(({ className, ...props }, ref) => (
|
|
64
|
-
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
65
|
-
))
|
|
66
|
-
CardContent.displayName = "CardContent"
|
|
67
|
-
|
|
68
|
-
const CardFooter = React.forwardRef<
|
|
69
|
-
HTMLDivElement,
|
|
70
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
71
|
-
>(({ className, ...props }, ref) => (
|
|
72
|
-
<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
|
|
73
|
-
))
|
|
74
|
-
CardFooter.displayName = "CardFooter"
|
|
75
|
-
|
|
76
|
-
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|