@beyondcorp/beyond-ui 1.0.19 → 1.0.21
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/components/Alert/Alert.example.d.ts +2 -0
- package/dist/components/Alert/Alert.example.js +7 -0
- package/dist/components/Alert/Alert.example.js.map +1 -0
- package/dist/components/Auth/AuthShowcase.d.ts +5 -0
- package/dist/components/Auth/AuthShowcase.js +105 -0
- package/dist/components/Auth/AuthShowcase.js.map +1 -0
- package/dist/components/Auth/LoginForm.d.ts +12 -0
- package/dist/components/Auth/LoginForm.example.d.ts +2 -0
- package/dist/components/Auth/LoginForm.example.js +9 -0
- package/dist/components/Auth/LoginForm.example.js.map +1 -0
- package/dist/components/Auth/LoginForm.js +48 -0
- package/dist/components/Auth/LoginForm.js.map +1 -0
- package/dist/components/Auth/PasswordResetForm.d.ts +9 -0
- package/dist/components/Auth/PasswordResetForm.example.d.ts +2 -0
- package/dist/components/Auth/PasswordResetForm.example.js +20 -0
- package/dist/components/Auth/PasswordResetForm.example.js.map +1 -0
- package/dist/components/Auth/PasswordResetForm.js +30 -0
- package/dist/components/Auth/PasswordResetForm.js.map +1 -0
- package/dist/components/Auth/ProtectedRoute.example.d.ts +7 -0
- package/dist/components/Auth/ProtectedRoute.example.js +16 -0
- package/dist/components/Auth/ProtectedRoute.example.js.map +1 -0
- package/dist/components/Auth/SignupForm.d.ts +11 -0
- package/dist/components/Auth/SignupForm.example.d.ts +2 -0
- package/dist/components/Auth/SignupForm.example.js +9 -0
- package/dist/components/Auth/SignupForm.example.js.map +1 -0
- package/dist/components/Auth/SignupForm.js +59 -0
- package/dist/components/Auth/SignupForm.js.map +1 -0
- package/dist/components/Avatar/Avatar.example.d.ts +2 -0
- package/dist/components/Avatar/Avatar.example.js +7 -0
- package/dist/components/Avatar/Avatar.example.js.map +1 -0
- package/dist/components/Badge/Badge.example.d.ts +2 -0
- package/dist/components/Badge/Badge.example.js +7 -0
- package/dist/components/Badge/Badge.example.js.map +1 -0
- package/dist/components/Button/Button.example.d.ts +2 -0
- package/dist/components/Button/Button.example.js +7 -0
- package/dist/components/Button/Button.example.js.map +1 -0
- package/dist/components/Card/Card.example.d.ts +2 -0
- package/dist/components/Card/Card.example.js +7 -0
- package/dist/components/Card/Card.example.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.example.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.example.js +7 -0
- package/dist/components/Checkbox/Checkbox.example.js.map +1 -0
- package/dist/components/ComponentShowcase/ComponentShowcase.js +34 -435
- package/dist/components/ComponentShowcase/ComponentShowcase.js.map +1 -1
- package/dist/components/ComponentShowcase/componentDocs.d.ts +225 -0
- package/dist/components/ComponentShowcase/componentDocs.js +205 -0
- package/dist/components/ComponentShowcase/componentDocs.js.map +1 -0
- package/dist/components/ComponentShowcase/showcaseRegistry.d.ts +1 -0
- package/dist/components/ComponentShowcase/showcaseRegistry.js +64 -0
- package/dist/components/ComponentShowcase/showcaseRegistry.js.map +1 -0
- package/dist/components/DashboardGrid/DashboardGrid.example.d.ts +2 -0
- package/dist/components/DashboardGrid/DashboardGrid.example.js +7 -0
- package/dist/components/DashboardGrid/DashboardGrid.example.js.map +1 -0
- package/dist/components/DashboardHeader/DashboardHeader.example.d.ts +2 -0
- package/dist/components/DashboardHeader/DashboardHeader.example.js +7 -0
- package/dist/components/DashboardHeader/DashboardHeader.example.js.map +1 -0
- package/dist/components/DashboardLayout/DashboardLayout.example.d.ts +2 -0
- package/dist/components/DashboardLayout/DashboardLayout.example.js +7 -0
- package/dist/components/DashboardLayout/DashboardLayout.example.js.map +1 -0
- package/dist/components/Input/Input.example.d.ts +2 -0
- package/dist/components/Input/Input.example.js +7 -0
- package/dist/components/Input/Input.example.js.map +1 -0
- package/dist/components/Modal/Modal.example.d.ts +2 -0
- package/dist/components/Modal/Modal.example.js +12 -0
- package/dist/components/Modal/Modal.example.js.map +1 -0
- package/dist/components/Navbar/Navbar.d.ts +1 -1
- package/dist/components/Navbar/Navbar.example.d.ts +2 -0
- package/dist/components/Navbar/Navbar.example.js +7 -0
- package/dist/components/Navbar/Navbar.example.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.example.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.example.js +21 -0
- package/dist/components/Sidebar/Sidebar.example.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.example.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.example.js +7 -0
- package/dist/components/Skeleton/Skeleton.example.js.map +1 -0
- package/dist/components/Spinner/Spinner.example.d.ts +2 -0
- package/dist/components/Spinner/Spinner.example.js +8 -0
- package/dist/components/Spinner/Spinner.example.js.map +1 -0
- package/dist/components/StatsCard/StatsCard.example.d.ts +2 -0
- package/dist/components/StatsCard/StatsCard.example.js +16 -0
- package/dist/components/StatsCard/StatsCard.example.js.map +1 -0
- package/dist/components/Switch/Switch.example.d.ts +2 -0
- package/dist/components/Switch/Switch.example.js +7 -0
- package/dist/components/Switch/Switch.example.js.map +1 -0
- package/dist/components/Tabs/Tabs.example.d.ts +2 -0
- package/dist/components/Tabs/Tabs.example.js +11 -0
- package/dist/components/Tabs/Tabs.example.js.map +1 -0
- package/dist/components/Textarea/Textarea.example.d.ts +2 -0
- package/dist/components/Textarea/Textarea.example.js +7 -0
- package/dist/components/Textarea/Textarea.example.js.map +1 -0
- package/dist/components/Toast/Toast.example.d.ts +2 -0
- package/dist/components/Toast/Toast.example.js +8 -0
- package/dist/components/Toast/Toast.example.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/validation.d.ts +21 -0
- package/dist/utils/validation.js +65 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +9 -3
|
@@ -1,148 +1,25 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { Layout, AlertCircle, BarChart3, MousePointer,
|
|
4
|
+
import { Layout, Shield, AlertCircle, BarChart3, MousePointer, Palette, ChevronRight, Search, ChevronDown, Monitor, Tablet, Smartphone, Sun, Moon, Eye, Code, Settings, Check, Copy, Book } from 'lucide-react';
|
|
5
5
|
import { cn } from '../../utils/cn.js';
|
|
6
6
|
import { Button } from '../Button/Button.js';
|
|
7
7
|
import { Input } from '../Input/Input.js';
|
|
8
|
-
import { Textarea } from '../Textarea/Textarea.js';
|
|
9
|
-
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
10
|
-
import { Navbar } from '../Navbar/Navbar.js';
|
|
11
|
-
import { Sidebar } from '../Sidebar/Sidebar.js';
|
|
12
|
-
import { DashboardGrid } from '../DashboardGrid/DashboardGrid.js';
|
|
13
|
-
import { DashboardLayout } from '../DashboardLayout/DashboardLayout.js';
|
|
14
|
-
import { Card, CardHeader, CardTitle, CardContent } from '../Card/Card.js';
|
|
15
8
|
import { Badge } from '../Badge/Badge.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { showToast, Toast } from '../Toast/Toast.js';
|
|
20
|
-
import { Tabs, TabsList, TabsTrigger, TabsContent } from '../Tabs/Tabs.js';
|
|
21
|
-
import { StatsCard } from '../StatsCard/StatsCard.js';
|
|
22
|
-
import { Switch } from '../Switch/Switch.js';
|
|
23
|
-
import { Spinner } from '../Spinner/Spinner.js';
|
|
24
|
-
import { Skeleton } from '../Skeleton/Skeleton.js';
|
|
25
|
-
import { DataTableShowcase } from '../DataTable/DataTableShowcase.js';
|
|
9
|
+
import { Toast, showToast } from '../Toast/Toast.js';
|
|
10
|
+
import { showcaseRegistry } from './showcaseRegistry.js';
|
|
11
|
+
import { componentDocs } from './componentDocs.js';
|
|
26
12
|
|
|
27
|
-
// STORY INSPIRED DEMOS:
|
|
28
|
-
function ShowcaseButtonDemo() {
|
|
29
|
-
return (jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [jsx(Button, { variant: "primary", children: "Primary" }), jsx(Button, { variant: "secondary", children: "Secondary" }), jsx(Button, { variant: "danger", children: "Danger" }), jsx(Button, { variant: "success", children: "Success" }), jsx(Button, { variant: "warning", children: "Warning" }), jsx(Button, { variant: "outline", children: "Outline" }), jsx(Button, { variant: "ghost", children: "Ghost" }), jsx(Button, { variant: "link", children: "Link" })] }));
|
|
30
|
-
}
|
|
31
|
-
function ShowcaseInputDemo() {
|
|
32
|
-
const [v, setV] = React.useState("");
|
|
33
|
-
return (jsxs("div", { className: "space-y-4 max-w-md", children: [jsx(Input, { placeholder: "Default input", value: v, onChange: e => setV(e.target.value) }), jsx(Input, { placeholder: "Success state", variant: "success" }), jsx(Input, { placeholder: "Error state", variant: "error" }), jsxs("div", { className: "space-y-2", children: [jsx(Input, { placeholder: "Small", inputSize: "sm" }), jsx(Input, { placeholder: "Medium", inputSize: "md" }), jsx(Input, { placeholder: "Large", inputSize: "lg" })] })] }));
|
|
34
|
-
}
|
|
35
|
-
function ShowcaseTextareaDemo() {
|
|
36
|
-
const [tv, setTv] = React.useState("");
|
|
37
|
-
return (jsxs("div", { className: "space-y-4 max-w-md", children: [jsx(Textarea, { placeholder: "Default textarea", value: tv, onChange: e => setTv(e.target.value) }), jsx(Textarea, { placeholder: "Success state", variant: "success" }), jsx(Textarea, { placeholder: "Error state", variant: "error" }), jsxs("div", { className: "space-y-2", children: [jsx(Textarea, { placeholder: "Small (default)" }), jsx(Textarea, { placeholder: "Disabled", disabled: true })] })] }));
|
|
38
|
-
}
|
|
39
|
-
function ShowcaseSwitchDemo() {
|
|
40
|
-
const [checked, setChecked] = React.useState(false);
|
|
41
|
-
return (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center gap-2", children: [jsx(Switch, { checked: checked, onCheckedChange: setChecked }), jsx("span", { children: "Default" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Switch, { checked: true }), jsx("span", { children: "Checked" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Switch, { disabled: true }), jsx("span", { children: "Disabled" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Switch, { size: "sm" }), jsx("span", { children: "Small" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Switch, { size: "lg" }), jsx("span", { children: "Large" })] })] }));
|
|
42
|
-
}
|
|
43
|
-
function ShowcaseCheckboxDemo() {
|
|
44
|
-
const [checked, setChecked] = React.useState(false);
|
|
45
|
-
return (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center gap-2", children: [jsx(Checkbox, { checked: checked, onChange: () => setChecked(!checked) }), " ", jsx("span", { children: "Default" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Checkbox, { checked: true }), " ", jsx("span", { children: "Checked" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Checkbox, { disabled: true }), " ", jsx("span", { children: "Disabled" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Checkbox, { size: "sm" }), " ", jsx("span", { children: "Small" })] }), jsxs("label", { className: "flex items-center gap-2", children: [jsx(Checkbox, { size: "lg" }), " ", jsx("span", { children: "Large" })] })] }));
|
|
46
|
-
}
|
|
47
|
-
function ShowcaseCardDemo() {
|
|
48
|
-
return (jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [jsxs(Card, { children: [jsx(CardHeader, { children: jsx(CardTitle, { children: "Default Card" }) }), jsx(CardContent, { children: jsx("p", { className: "text-gray-600", children: "This is a default card with standard styling." }) })] }), jsxs(Card, { variant: "elevated", children: [jsx(CardHeader, { children: jsx(CardTitle, { children: "Elevated Card" }) }), jsx(CardContent, { children: jsx("p", { className: "text-gray-600", children: "This card has elevated shadow styling." }) })] })] }));
|
|
49
|
-
}
|
|
50
|
-
function ShowcaseBadgeDemo() {
|
|
51
|
-
return (jsxs("div", { className: "flex flex-wrap gap-2", children: [jsx(Badge, { children: "Default" }), jsx(Badge, { variant: "secondary", children: "Secondary" }), jsx(Badge, { variant: "success", children: "Success" }), jsx(Badge, { variant: "danger", children: "Danger" }), jsx(Badge, { variant: "warning", children: "Warning" }), jsx(Badge, { variant: "outline", children: "Outline" })] }));
|
|
52
|
-
}
|
|
53
|
-
function ShowcaseAvatarDemo() {
|
|
54
|
-
return (jsxs("div", { className: "flex gap-4", children: [jsxs(Avatar, { children: [jsx(AvatarImage, { src: "https://randomuser.me/api/portraits/men/32.jpg" }), jsx(AvatarFallback, { children: "AB" })] }), jsxs(Avatar, { children: [jsx(AvatarImage, { src: "" }), jsx(AvatarFallback, { children: "CD" })] }), jsxs(Avatar, { children: [jsx(AvatarImage, { src: "https://randomuser.me/api/portraits/women/44.jpg" }), jsx(AvatarFallback, { children: "EF" })] })] }));
|
|
55
|
-
}
|
|
56
|
-
function ShowcaseModalDemo() {
|
|
57
|
-
const [open, setOpen] = React.useState(false);
|
|
58
|
-
return (jsxs("div", { children: [jsx(Button, { onClick: () => setOpen(true), children: "Show Modal" }), jsxs(Modal, { open: open, onOpenChange: setOpen, children: [jsx(ModalHeader, { children: jsx(ModalTitle, { children: "Demo Modal" }) }), jsx(ModalContent, { children: jsx("p", { children: "This is a basic modal dialog." }) }), jsx(ModalFooter, { children: jsx(Button, { variant: "primary", onClick: () => setOpen(false), children: "Close" }) })] })] }));
|
|
59
|
-
}
|
|
60
|
-
function ShowcaseToastDemo() {
|
|
61
|
-
return (jsxs(Fragment, { children: [jsx(Button, { onClick: () => showToast.success("This is a toast notification!"), children: "Show Toast" }), jsx(Toast, {})] }));
|
|
62
|
-
}
|
|
63
|
-
function ShowcaseSpinnerDemo() {
|
|
64
|
-
return (jsxs("div", { className: "space-y-4", children: [jsx(Spinner, {}), jsxs("div", { className: "flex gap-2 items-center", children: [jsx(Spinner, {}), " ", jsx("span", { children: "Loading data..." })] }), jsxs(Button, { variant: "primary", disabled: true, children: [jsx(Spinner, { className: "mr-2 h-4 w-4" }), " Processing"] })] }));
|
|
65
|
-
}
|
|
66
|
-
const showcasePreviewMap = {
|
|
67
|
-
button: ShowcaseButtonDemo,
|
|
68
|
-
input: ShowcaseInputDemo,
|
|
69
|
-
textarea: ShowcaseTextareaDemo,
|
|
70
|
-
checkbox: ShowcaseCheckboxDemo,
|
|
71
|
-
switch: ShowcaseSwitchDemo,
|
|
72
|
-
card: ShowcaseCardDemo,
|
|
73
|
-
badge: ShowcaseBadgeDemo,
|
|
74
|
-
avatar: ShowcaseAvatarDemo,
|
|
75
|
-
alert: ShowcaseAlertDemo,
|
|
76
|
-
statscard: ShowcaseStatsCardDemo,
|
|
77
|
-
tabs: ShowcaseTabsDemo,
|
|
78
|
-
modal: ShowcaseModalDemo,
|
|
79
|
-
toast: ShowcaseToastDemo,
|
|
80
|
-
spinner: ShowcaseSpinnerDemo,
|
|
81
|
-
skeleton: function ShowcaseSkeletonDemo() {
|
|
82
|
-
return (jsxs("div", { className: "space-y-4 max-w-md", children: [jsx(Skeleton, { className: "h-8 w-1/2" }), jsx(Skeleton, { className: "h-4 w-3/4" }), jsxs("div", { className: "flex gap-2", children: [jsx(Skeleton, { className: "h-8 w-8 rounded-full" }), jsx(Skeleton, { className: "h-8 w-32" })] }), jsx(Skeleton, { className: "h-24 w-full" })] }));
|
|
83
|
-
},
|
|
84
|
-
navbar: function ShowcaseNavbarDemo() {
|
|
85
|
-
return (jsx(Navbar, { children: jsxs("div", { className: "flex w-full items-center justify-between px-4", children: [jsx("span", { className: "font-semibold text-lg", children: "Beyond UI" }), jsxs("nav", { className: "flex gap-4 ml-auto", children: [jsx("a", { href: "#", className: "text-blue-500", children: "Home" }), jsx("a", { href: "#", className: "text-blue-500", children: "Features" }), jsx("a", { href: "#", className: "text-blue-500", children: "Pricing" })] }), jsx("div", { className: "ml-6", children: jsx("button", { className: "rounded bg-primary-600 text-white px-3 py-1 text-sm", children: "Profile" }) })] }) }));
|
|
86
|
-
},
|
|
87
|
-
sidebar: function ShowcaseSidebarDemo() {
|
|
88
|
-
const menuItems = [
|
|
89
|
-
{ id: "dashboard", label: "Dashboard", icon: jsx(BarChart3, { className: "h-5 w-5" }) },
|
|
90
|
-
{ id: "settings", label: "Settings", icon: jsx(Settings, { className: "h-5 w-5" }) },
|
|
91
|
-
{ id: "profile", label: "Profile", icon: jsx(User, { className: "h-5 w-5" }) }
|
|
92
|
-
];
|
|
93
|
-
// Override Sidebar's fixed class for preview
|
|
94
|
-
return (jsx("div", { className: "w-[260px] h-[480px] bg-white border rounded overflow-auto flex items-stretch", children: jsx(Sidebar, { menuItems: menuItems, className: "static relative w-full h-full border-none shadow-none" }) }));
|
|
95
|
-
},
|
|
96
|
-
"dashboard-grid": function ShowcaseDashboardGridDemo() {
|
|
97
|
-
return (jsxs(DashboardGrid, { children: [jsx("div", { className: "p-4 bg-white rounded shadow", children: "Widget 1" }), jsx("div", { className: "p-4 bg-white rounded shadow", children: "Widget 2" }), jsx("div", { className: "p-4 bg-white rounded shadow", children: "Widget 3" }), jsx("div", { className: "p-4 bg-white rounded shadow", children: "Widget 4" })] }));
|
|
98
|
-
},
|
|
99
|
-
"dashboard-header": function ShowcaseDashboardHeaderDemo() {
|
|
100
|
-
return (jsxs("div", { className: "flex justify-between items-center py-4 border-b", children: [jsxs("div", { children: [jsx("h2", { className: "text-xl font-semibold", children: "Dashboard" }), jsx("span", { className: "text-gray-500 text-sm", children: "Insights & analytics" })] }), jsx(Button, { variant: "outline", children: "Settings" })] }));
|
|
101
|
-
},
|
|
102
|
-
"dashboard-layout": function ShowcaseDashboardLayoutDemo() {
|
|
103
|
-
const sidebarMenuItems = [
|
|
104
|
-
{ id: "dashboard", label: "Dashboard", icon: jsx(BarChart3, { className: "h-4 w-4" }) },
|
|
105
|
-
{ id: "users", label: "Users", icon: jsx(User, { className: "h-4 w-4" }) },
|
|
106
|
-
{ id: "settings", label: "Settings", icon: jsx(Settings, { className: "h-4 w-4" }) },
|
|
107
|
-
];
|
|
108
|
-
// Contain DashboardLayout for preview: override min-h-screen, sizing
|
|
109
|
-
return (jsx("div", { className: "w-[600px] h-[480px] bg-white border rounded overflow-auto flex items-stretch", children: jsx(DashboardLayout, { sidebarMenuItems: sidebarMenuItems, className: "relative w-full min-h-0 h-full", sidebarClassName: "static relative w-full h-full border-none shadow-none", disableSidebarMargin: true, children: jsxs("div", { className: "p-6 h-full", children: [jsx("h2", { className: "text-lg font-semibold mb-2", children: "Welcome to DashboardLayout" }), jsx("p", { className: "mb-4 text-gray-600", children: "Main content appears here. The sidebar and header are real reusable components." }), jsx(Button, { variant: "primary", children: "Dashboard Action" })] }) }) }));
|
|
110
|
-
},
|
|
111
|
-
datatable: DataTableShowcase,
|
|
112
|
-
};
|
|
113
|
-
function ShowcaseAlertDemo() {
|
|
114
|
-
return (jsxs("div", { className: "space-y-4", children: [jsxs(Alert, { variant: "info", children: [jsx(AlertTitle, { children: "Information" }), jsx(AlertDescription, { children: "This is an informational alert message." })] }), jsxs(Alert, { variant: "success", children: [jsx(AlertTitle, { children: "Success" }), jsx(AlertDescription, { children: "Operation completed successfully!" })] }), jsxs(Alert, { variant: "warning", children: [jsx(AlertTitle, { children: "Warning" }), jsx(AlertDescription, { children: "Please review your input before proceeding." })] }), jsxs(Alert, { variant: "danger", children: [jsx(AlertTitle, { children: "Error" }), jsx(AlertDescription, { children: "Something went wrong. Please try again." })] })] }));
|
|
115
|
-
}
|
|
116
|
-
function ShowcaseStatsCardDemo() {
|
|
117
|
-
return (jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [jsx(StatsCard, { title: "Total Users", value: "2,543", trend: {
|
|
118
|
-
direction: "up",
|
|
119
|
-
value: "+12%",
|
|
120
|
-
label: "from last month"
|
|
121
|
-
}, icon: jsx(BarChart3, { className: "h-6 w-6 text-primary-600" }) }), jsx(StatsCard, { variant: "gradient", color: "success", title: "Revenue", value: "$45,231", trend: {
|
|
122
|
-
direction: "up",
|
|
123
|
-
value: "+8.2%",
|
|
124
|
-
label: "from last month"
|
|
125
|
-
}, icon: jsx(BarChart3, { className: "h-6 w-6" }) })] }));
|
|
126
|
-
}
|
|
127
|
-
function ShowcaseTabsDemo() {
|
|
128
|
-
const [activeTab, setActiveTab] = React.useState("tab-1");
|
|
129
|
-
return (jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, children: [jsxs(TabsList, { children: [jsx(TabsTrigger, { value: "tab-1", children: "Tab One" }), jsx(TabsTrigger, { value: "tab-2", children: "Tab Two" }), jsx(TabsTrigger, { value: "tab-3", children: "Tab Three" })] }), jsx(TabsContent, { value: "tab-1", children: jsx("span", { className: "block p-4", children: "Content for Tab One" }) }), jsx(TabsContent, { value: "tab-2", children: jsx("span", { className: "block p-4", children: "Content for Tab Two" }) }), jsx(TabsContent, { value: "tab-3", children: jsx("span", { className: "block p-4", children: "Content for Tab Three" }) })] }));
|
|
130
|
-
}
|
|
131
|
-
Object.assign(showcasePreviewMap, {
|
|
132
|
-
alert: ShowcaseAlertDemo,
|
|
133
|
-
statscard: ShowcaseStatsCardDemo,
|
|
134
|
-
tabs: ShowcaseTabsDemo,
|
|
135
|
-
});
|
|
136
13
|
// Component categories and their items
|
|
137
14
|
const componentCategories = {
|
|
138
|
-
|
|
15
|
+
Forms: {
|
|
139
16
|
icon: jsx(MousePointer, { className: "h-4 w-4" }),
|
|
140
17
|
components: [
|
|
141
18
|
{ name: "Button", id: "button" },
|
|
142
19
|
{ name: "Input", id: "input" },
|
|
143
20
|
{ name: "Textarea", id: "textarea" },
|
|
144
21
|
{ name: "Checkbox", id: "checkbox" },
|
|
145
|
-
{ name: "Switch", id: "switch" }
|
|
22
|
+
{ name: "Switch", id: "switch" }
|
|
146
23
|
]
|
|
147
24
|
},
|
|
148
25
|
"Data Display": {
|
|
@@ -153,320 +30,39 @@ const componentCategories = {
|
|
|
153
30
|
{ name: "Avatar", id: "avatar" },
|
|
154
31
|
{ name: "StatsCard", id: "statscard" },
|
|
155
32
|
{ name: "Tabs", id: "tabs" },
|
|
156
|
-
{ name: "DataTable", id: "datatable" }
|
|
33
|
+
{ name: "DataTable", id: "datatable" }
|
|
157
34
|
]
|
|
158
35
|
},
|
|
159
|
-
|
|
36
|
+
Feedback: {
|
|
160
37
|
icon: jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
161
38
|
components: [
|
|
162
39
|
{ name: "Alert", id: "alert" },
|
|
163
40
|
{ name: "Toast", id: "toast" },
|
|
164
41
|
{ name: "Modal", id: "modal" },
|
|
165
42
|
{ name: "Spinner", id: "spinner" },
|
|
166
|
-
{ name: "Skeleton", id: "skeleton" }
|
|
43
|
+
{ name: "Skeleton", id: "skeleton" }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
Authentication: {
|
|
47
|
+
icon: jsx(Shield, { className: "h-4 w-4" }),
|
|
48
|
+
components: [
|
|
49
|
+
{ name: "Auth System", id: "auth" },
|
|
50
|
+
{ name: "Login Page", id: "login" },
|
|
51
|
+
{ name: "Signup Page", id: "signup" },
|
|
52
|
+
{ name: "Password Reset", id: "password-reset" },
|
|
53
|
+
{ name: "!isAuthenticated Shield", id: "shield" },
|
|
167
54
|
]
|
|
168
55
|
},
|
|
169
|
-
|
|
56
|
+
Layout: {
|
|
170
57
|
icon: jsx(Layout, { className: "h-4 w-4" }),
|
|
171
58
|
components: [
|
|
172
59
|
{ name: "DashboardLayout", id: "dashboard-layout" },
|
|
173
60
|
{ name: "DashboardGrid", id: "dashboard-grid" },
|
|
174
61
|
{ name: "Sidebar", id: "sidebar" },
|
|
175
|
-
{ name: "Navbar", id: "navbar" }
|
|
62
|
+
{ name: "Navbar", id: "navbar" }
|
|
176
63
|
]
|
|
177
64
|
}
|
|
178
65
|
};
|
|
179
|
-
// Component examples and documentation
|
|
180
|
-
const componentDocs = {
|
|
181
|
-
button: {
|
|
182
|
-
name: "Button",
|
|
183
|
-
description: "A versatile button component with multiple variants and sizes.",
|
|
184
|
-
example: `<Button variant="primary" size="md">
|
|
185
|
-
Click me
|
|
186
|
-
</Button>`,
|
|
187
|
-
props: [
|
|
188
|
-
{ name: "variant", type: "string", default: "primary", description: "Button style variant" },
|
|
189
|
-
{ name: "size", type: "string", default: "md", description: "Button size" },
|
|
190
|
-
{ name: "disabled", type: "boolean", default: "false", description: "Disable the button" },
|
|
191
|
-
],
|
|
192
|
-
component: null
|
|
193
|
-
},
|
|
194
|
-
input: {
|
|
195
|
-
name: "Input",
|
|
196
|
-
description: "A flexible input component with validation states and different sizes.",
|
|
197
|
-
example: `<Input
|
|
198
|
-
placeholder="Enter your email"
|
|
199
|
-
variant="default"
|
|
200
|
-
inputSize="md"
|
|
201
|
-
/>`,
|
|
202
|
-
props: [
|
|
203
|
-
{ name: "variant", type: "string", default: "default", description: "Input validation state" },
|
|
204
|
-
{ name: "inputSize", type: "string", default: "md", description: "Input size" },
|
|
205
|
-
{ name: "placeholder", type: "string", default: "", description: "Placeholder text" },
|
|
206
|
-
],
|
|
207
|
-
component: null
|
|
208
|
-
},
|
|
209
|
-
checkbox: {
|
|
210
|
-
name: "Checkbox",
|
|
211
|
-
description: "A standard checkbox component for forms. Supports checked, unchecked, disabled, and size variants.",
|
|
212
|
-
example: `<Checkbox checked={true} onChange={() => {}} />`,
|
|
213
|
-
props: [
|
|
214
|
-
{ name: "checked", type: "boolean", default: "false", description: "Whether the checkbox is checked" },
|
|
215
|
-
{ name: "onChange", type: "(event) => void", description: "Callback when checkbox changes" },
|
|
216
|
-
{ name: "disabled", type: "boolean", default: "false", description: "Disable the checkbox" },
|
|
217
|
-
{ name: "size", type: `"sm" | "md" | "lg"`, default: "md", description: "Size of the checkbox" },
|
|
218
|
-
],
|
|
219
|
-
component: showcasePreviewMap["checkbox"]
|
|
220
|
-
},
|
|
221
|
-
switch: {
|
|
222
|
-
name: "Switch",
|
|
223
|
-
description: "A toggle switch component for representing boolean states. Supports size variants and disabled state.",
|
|
224
|
-
example: `<Switch checked={true} onCheckedChange={() => {}} />`,
|
|
225
|
-
props: [
|
|
226
|
-
{ name: "checked", type: "boolean", default: "false", description: "Whether the switch is on" },
|
|
227
|
-
{ name: "onCheckedChange", type: "(checked: boolean) => void", description: "Callback when switch state changes" },
|
|
228
|
-
{ name: "disabled", type: "boolean", default: "false", description: "Disable the switch" },
|
|
229
|
-
{ name: "size", type: `"sm" | "md" | "lg"`, default: "md", description: "Size of the switch" },
|
|
230
|
-
],
|
|
231
|
-
component: showcasePreviewMap["switch"]
|
|
232
|
-
},
|
|
233
|
-
textarea: {
|
|
234
|
-
name: "Textarea",
|
|
235
|
-
description: "A multi-line input control suitable for entering longer blocks of text. Supports success/error states and various sizes.",
|
|
236
|
-
example: `<Textarea placeholder="Enter your message..." variant="default" />`,
|
|
237
|
-
props: [
|
|
238
|
-
{ name: "variant", type: "string", default: "default", description: "Textarea validation state" },
|
|
239
|
-
{ name: "rows", type: "number", default: "3", description: "Number of visible text lines" },
|
|
240
|
-
{ name: "disabled", type: "boolean", default: "false", description: "Disabled state" },
|
|
241
|
-
{ name: "placeholder", type: "string", default: "", description: "Placeholder text" },
|
|
242
|
-
],
|
|
243
|
-
component: showcasePreviewMap["textarea"]
|
|
244
|
-
},
|
|
245
|
-
card: {
|
|
246
|
-
name: "Card",
|
|
247
|
-
description: "A flexible container component for grouping related content.",
|
|
248
|
-
example: `<Card>
|
|
249
|
-
<CardHeader>
|
|
250
|
-
<CardTitle>Card Title</CardTitle>
|
|
251
|
-
</CardHeader>
|
|
252
|
-
<CardContent>
|
|
253
|
-
Card content goes here.
|
|
254
|
-
</CardContent>
|
|
255
|
-
</Card>`,
|
|
256
|
-
props: [
|
|
257
|
-
{ name: "variant", type: "string", default: "default", description: "Card style variant" },
|
|
258
|
-
{ name: "padding", type: "string", default: "md", description: "Card padding size" },
|
|
259
|
-
],
|
|
260
|
-
component: null
|
|
261
|
-
},
|
|
262
|
-
avatar: {
|
|
263
|
-
name: "Avatar",
|
|
264
|
-
description: "Displays a user's profile image or initials, with customizable size and fallback.",
|
|
265
|
-
example: '<Avatar size="sm"><AvatarImage src="https://randomuser.me/api/portraits/men/32.jpg" alt="User"/><AvatarFallback>AB</AvatarFallback></Avatar>',
|
|
266
|
-
props: [
|
|
267
|
-
{ name: "size", type: '"sm" | "md" | "lg"', default: "md", description: "Avatar size" },
|
|
268
|
-
{ name: "children", type: "ReactNode", required: true, description: "Avatar image and fallback" }
|
|
269
|
-
],
|
|
270
|
-
component: showcasePreviewMap["avatar"]
|
|
271
|
-
},
|
|
272
|
-
badge: {
|
|
273
|
-
name: "Badge",
|
|
274
|
-
description: "A small, customizable tag for displaying statuses or labels.",
|
|
275
|
-
example: `<Badge variant="default">Default</Badge>`,
|
|
276
|
-
props: [
|
|
277
|
-
{ name: "variant", type: `"default" | "secondary" | "success" | "danger" | "warning" | "outline"`, default: "default", description: "Badge color or style variant" },
|
|
278
|
-
{ name: "children", type: "ReactNode", required: true, description: "Badge label content" }
|
|
279
|
-
],
|
|
280
|
-
component: showcasePreviewMap["badge"]
|
|
281
|
-
},
|
|
282
|
-
tabs: {
|
|
283
|
-
name: "Tabs",
|
|
284
|
-
description: "A flexible tabbed navigation component. Allows users to switch between views.",
|
|
285
|
-
example: `<Tabs value="tab-1" onValueChange={() => {}}>
|
|
286
|
-
<TabsList>
|
|
287
|
-
<TabsTrigger value="tab-1">Tab 1</TabsTrigger>
|
|
288
|
-
<TabsTrigger value="tab-2">Tab 2</TabsTrigger>
|
|
289
|
-
</TabsList>
|
|
290
|
-
<TabsContent value="tab-1">Content 1</TabsContent>
|
|
291
|
-
<TabsContent value="tab-2">Content 2</TabsContent>
|
|
292
|
-
</Tabs>`,
|
|
293
|
-
props: [
|
|
294
|
-
{ name: "value", type: "string", required: true, description: "The value of the currently selected tab" },
|
|
295
|
-
{ name: "onValueChange", type: "(value: string) => void", description: "Called when a different tab is selected" },
|
|
296
|
-
{ name: "children", type: "ReactNode", required: true, description: "Tab triggers and contents" }
|
|
297
|
-
],
|
|
298
|
-
component: showcasePreviewMap["tabs"]
|
|
299
|
-
},
|
|
300
|
-
toast: {
|
|
301
|
-
name: "Toast",
|
|
302
|
-
description: "A notification/toast component to display feedback messages over the UI.",
|
|
303
|
-
example: `<Button onClick={() => showToast.success("Saved successfully!")}>Show Toast</Button>
|
|
304
|
-
<Toast />`,
|
|
305
|
-
props: [
|
|
306
|
-
{ name: "children", type: "ReactNode", description: "Toast content (commonly used internally)" }
|
|
307
|
-
],
|
|
308
|
-
component: showcasePreviewMap["toast"]
|
|
309
|
-
},
|
|
310
|
-
modal: {
|
|
311
|
-
name: "Modal",
|
|
312
|
-
description: "A dialog/modal overlay component for displaying actions, forms, or confirmation content.",
|
|
313
|
-
example: `<Modal open={open} onOpenChange={setOpen}>
|
|
314
|
-
<ModalHeader>Modal Title</ModalHeader>
|
|
315
|
-
<ModalContent>Modal body</ModalContent>
|
|
316
|
-
<ModalFooter>
|
|
317
|
-
<Button onClick={() => setOpen(false)}>Close</Button>
|
|
318
|
-
</ModalFooter>
|
|
319
|
-
</Modal>`,
|
|
320
|
-
props: [
|
|
321
|
-
{ name: "open", type: "boolean", required: true, description: "Whether the modal is open" },
|
|
322
|
-
{ name: "onOpenChange", type: "(open: boolean) => void", required: true, description: "Called with new open state when modal is toggled" },
|
|
323
|
-
{ name: "children", type: "ReactNode", required: true, description: "Content of the modal dialog" }
|
|
324
|
-
],
|
|
325
|
-
component: showcasePreviewMap["modal"]
|
|
326
|
-
},
|
|
327
|
-
spinner: {
|
|
328
|
-
name: "Spinner",
|
|
329
|
-
description: "A loading spinner to indicate ongoing processing or loading state.",
|
|
330
|
-
example: `<Spinner size="md" />`,
|
|
331
|
-
props: [
|
|
332
|
-
{ name: "size", type: `"sm" | "md" | "lg"`, default: "md", description: "Spinner size" },
|
|
333
|
-
{ name: "color", type: "string", default: "primary", description: "Spinner color (optional)" },
|
|
334
|
-
{ name: "className", type: "string", description: "Custom CSS class for the spinner" }
|
|
335
|
-
],
|
|
336
|
-
component: showcasePreviewMap["spinner"]
|
|
337
|
-
},
|
|
338
|
-
skeleton: {
|
|
339
|
-
name: "Skeleton",
|
|
340
|
-
description: "A placeholder skeleton component for loading states. Use to display a placeholder UI while content loads.",
|
|
341
|
-
example: `<Skeleton className="h-6 w-32" />`,
|
|
342
|
-
props: [
|
|
343
|
-
{ name: "className", type: "string", description: "Custom class for size and style" }
|
|
344
|
-
],
|
|
345
|
-
component: showcasePreviewMap["skeleton"]
|
|
346
|
-
},
|
|
347
|
-
alert: {
|
|
348
|
-
name: "Alert",
|
|
349
|
-
description: "Display important messages and notifications to users.",
|
|
350
|
-
example: `<Alert variant="info">
|
|
351
|
-
<AlertTitle>Information</AlertTitle>
|
|
352
|
-
<AlertDescription>
|
|
353
|
-
This is an informational alert.
|
|
354
|
-
</AlertDescription>
|
|
355
|
-
</Alert>`,
|
|
356
|
-
props: [
|
|
357
|
-
{ name: "variant", type: "string", default: "default", description: "Alert type variant" },
|
|
358
|
-
],
|
|
359
|
-
component: (jsxs("div", { className: "space-y-4", children: [jsxs(Alert, { variant: "info", children: [jsx(AlertTitle, { children: "Information" }), jsx(AlertDescription, { children: "This is an informational alert message." })] }), jsxs(Alert, { variant: "success", children: [jsx(AlertTitle, { children: "Success" }), jsx(AlertDescription, { children: "Operation completed successfully!" })] }), jsxs(Alert, { variant: "warning", children: [jsx(AlertTitle, { children: "Warning" }), jsx(AlertDescription, { children: "Please review your input before proceeding." })] }), jsxs(Alert, { variant: "danger", children: [jsx(AlertTitle, { children: "Error" }), jsx(AlertDescription, { children: "Something went wrong. Please try again." })] })] }))
|
|
360
|
-
},
|
|
361
|
-
statscard: {
|
|
362
|
-
name: "StatsCard",
|
|
363
|
-
description: "Display key metrics and statistics with trend indicators.",
|
|
364
|
-
example: `<StatsCard
|
|
365
|
-
title="Total Users"
|
|
366
|
-
value="2,543"
|
|
367
|
-
trend={{
|
|
368
|
-
direction: "up",
|
|
369
|
-
value: "+12%",
|
|
370
|
-
label: "from last month"
|
|
371
|
-
}}
|
|
372
|
-
icon={<Users className="h-6 w-6" />}
|
|
373
|
-
/>`,
|
|
374
|
-
props: [
|
|
375
|
-
{ name: "title", type: "string", required: true, description: "Card title" },
|
|
376
|
-
{ name: "value", type: "string | number", required: true, description: "Main value to display" },
|
|
377
|
-
{ name: "trend", type: "object", description: "Trend information" },
|
|
378
|
-
{ name: "icon", type: "ReactNode", description: "Icon to display" },
|
|
379
|
-
],
|
|
380
|
-
component: (jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [jsx(StatsCard, { title: "Total Users", value: "2,543", trend: {
|
|
381
|
-
direction: "up",
|
|
382
|
-
value: "+12%",
|
|
383
|
-
label: "from last month"
|
|
384
|
-
}, icon: jsx(BarChart3, { className: "h-6 w-6 text-primary-600" }) }), jsx(StatsCard, { variant: "gradient", color: "success", title: "Revenue", value: "$45,231", trend: {
|
|
385
|
-
direction: "up",
|
|
386
|
-
value: "+8.2%",
|
|
387
|
-
label: "from last month"
|
|
388
|
-
}, icon: jsx(BarChart3, { className: "h-6 w-6" }) })] }))
|
|
389
|
-
},
|
|
390
|
-
"dashboard-layout": {
|
|
391
|
-
name: "DashboardLayout",
|
|
392
|
-
description: "Layout component for admin dashboards and analytics panels. Useful for wrapping dashboard structure with sidebars and content.",
|
|
393
|
-
example: `<DashboardLayout>
|
|
394
|
-
<Sidebar />
|
|
395
|
-
<main>
|
|
396
|
-
Dashboard content here
|
|
397
|
-
</main>
|
|
398
|
-
</DashboardLayout>`,
|
|
399
|
-
props: [
|
|
400
|
-
{ name: "children", type: "ReactNode", required: true, description: "Dashboard page content" }
|
|
401
|
-
],
|
|
402
|
-
component: showcasePreviewMap["dashboard-layout"]
|
|
403
|
-
},
|
|
404
|
-
datatable: {
|
|
405
|
-
name: "DataTable",
|
|
406
|
-
description: "A comprehensive table component with filtering, sorting, pagination, and row selection capabilities.",
|
|
407
|
-
example: `<DataTable
|
|
408
|
-
columns={columns}
|
|
409
|
-
dataSource={data}
|
|
410
|
-
rowKey="id"
|
|
411
|
-
pagination={{
|
|
412
|
-
current: 1,
|
|
413
|
-
pageSize: 10,
|
|
414
|
-
total: data.length,
|
|
415
|
-
}}
|
|
416
|
-
rowSelection={{
|
|
417
|
-
type: 'checkbox',
|
|
418
|
-
onChange: (keys, rows) => console.log('Selected:', keys, rows),
|
|
419
|
-
}}
|
|
420
|
-
/>`,
|
|
421
|
-
props: [
|
|
422
|
-
{ name: "columns", type: "Column[]", required: true, description: "Table column configuration" },
|
|
423
|
-
{ name: "dataSource", type: "T[]", required: true, description: "Data to display in the table" },
|
|
424
|
-
{ name: "rowKey", type: "string | function", default: "id", description: "Unique key for each row" },
|
|
425
|
-
{ name: "pagination", type: "PaginationConfig | false", description: "Pagination configuration" },
|
|
426
|
-
{ name: "rowSelection", type: "RowSelection", description: "Row selection configuration" },
|
|
427
|
-
{ name: "loading", type: "boolean", default: "false", description: "Loading state" },
|
|
428
|
-
{ name: "size", type: `"small" | "middle" | "large"`, default: "middle", description: "Table size" },
|
|
429
|
-
{ name: "bordered", type: "boolean", default: "false", description: "Show borders" },
|
|
430
|
-
],
|
|
431
|
-
component: jsx(DataTableShowcase, {})
|
|
432
|
-
},
|
|
433
|
-
"dashboard-grid": {
|
|
434
|
-
name: "DashboardGrid",
|
|
435
|
-
description: "Grid container for dashboard widgets.",
|
|
436
|
-
example: `<DashboardGrid>
|
|
437
|
-
<Widget />
|
|
438
|
-
<Widget />
|
|
439
|
-
</DashboardGrid>`,
|
|
440
|
-
props: [
|
|
441
|
-
{ name: "children", type: "ReactNode", required: true, description: "Widgets to show in the grid" },
|
|
442
|
-
],
|
|
443
|
-
component: showcasePreviewMap["dashboard-grid"]
|
|
444
|
-
},
|
|
445
|
-
"sidebar": {
|
|
446
|
-
name: "Sidebar",
|
|
447
|
-
description: "Navigation sidebar for layouts. Supports menu items and responsive display.",
|
|
448
|
-
example: `<Sidebar menuItems={menuItems} />`,
|
|
449
|
-
props: [
|
|
450
|
-
{ name: "menuItems", type: "Array", required: true, description: "Sidebar navigation items" },
|
|
451
|
-
],
|
|
452
|
-
component: showcasePreviewMap["sidebar"]
|
|
453
|
-
},
|
|
454
|
-
"navbar": {
|
|
455
|
-
name: "Navbar",
|
|
456
|
-
description: "Navigation bar for app layout. Add links, branding, user actions etc.",
|
|
457
|
-
example: `<Navbar>
|
|
458
|
-
<NavbarBrand>My App</NavbarBrand>
|
|
459
|
-
<NavbarLinks>
|
|
460
|
-
<a href="#">Home</a>
|
|
461
|
-
<a href="#">About</a>
|
|
462
|
-
</NavbarLinks>
|
|
463
|
-
</Navbar>`,
|
|
464
|
-
props: [
|
|
465
|
-
{ name: "children", type: "ReactNode", required: true, description: "Navbar content (branding, links, actions)" },
|
|
466
|
-
],
|
|
467
|
-
component: showcasePreviewMap["navbar"]
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
66
|
const ComponentShowcase = ({ className }) => {
|
|
471
67
|
const [selectedComponent, setSelectedComponent] = useState("button");
|
|
472
68
|
const [searchQuery, setSearchQuery] = useState("");
|
|
@@ -476,8 +72,8 @@ const ComponentShowcase = ({ className }) => {
|
|
|
476
72
|
const [darkMode, setDarkMode] = useState(false);
|
|
477
73
|
const [copiedCode, setCopiedCode] = useState(null);
|
|
478
74
|
const toggleCategory = (category) => {
|
|
479
|
-
setExpandedCategories(prev => prev.includes(category)
|
|
480
|
-
? prev.filter(c => c !== category)
|
|
75
|
+
setExpandedCategories((prev) => prev.includes(category)
|
|
76
|
+
? prev.filter((c) => c !== category)
|
|
481
77
|
: [...prev, category]);
|
|
482
78
|
};
|
|
483
79
|
const copyToClipboard = async (code) => {
|
|
@@ -492,7 +88,7 @@ const ComponentShowcase = ({ className }) => {
|
|
|
492
88
|
}
|
|
493
89
|
};
|
|
494
90
|
const filteredCategories = Object.entries(componentCategories).reduce((acc, [categoryName, categoryData]) => {
|
|
495
|
-
const filteredComponents = categoryData.components.filter(component => component.name.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
91
|
+
const filteredComponents = categoryData.components.filter((component) => component.name.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
496
92
|
if (filteredComponents.length > 0) {
|
|
497
93
|
acc[categoryName] = {
|
|
498
94
|
...categoryData,
|
|
@@ -504,16 +100,19 @@ const ComponentShowcase = ({ className }) => {
|
|
|
504
100
|
const currentDoc = componentDocs[selectedComponent];
|
|
505
101
|
const getViewportClass = () => {
|
|
506
102
|
switch (viewMode) {
|
|
507
|
-
case "tablet":
|
|
508
|
-
|
|
509
|
-
|
|
103
|
+
case "tablet":
|
|
104
|
+
return "max-w-2xl";
|
|
105
|
+
case "mobile":
|
|
106
|
+
return "max-w-sm";
|
|
107
|
+
default:
|
|
108
|
+
return "w-full";
|
|
510
109
|
}
|
|
511
110
|
};
|
|
512
111
|
return (jsxs("div", { className: cn("flex h-screen bg-gray-50", className), children: [jsx(Toast, {}), jsxs("div", { className: cn("bg-white border-r border-gray-200 transition-all duration-300 flex flex-col", sidebarCollapsed ? "w-16" : "w-80"), children: [jsxs("div", { className: "p-4 border-b border-gray-200", children: [!sidebarCollapsed && (jsxs("div", { className: "flex items-center justify-between mb-4", children: [jsxs("div", { className: "flex items-center space-x-2", children: [jsx("div", { className: "w-8 h-8 bg-primary-600 rounded-lg flex items-center justify-center", children: jsx(Palette, { className: "h-4 w-4 text-white" }) }), jsx("span", { className: "font-bold text-lg text-gray-900", children: "Beyond UI" })] }), jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSidebarCollapsed(true), children: jsx(ChevronRight, { className: "h-4 w-4" }) })] })), sidebarCollapsed && (jsx("div", { className: "flex justify-center", children: jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSidebarCollapsed(false), children: jsx(Palette, { className: "h-4 w-4" }) }) })), !sidebarCollapsed && (jsxs("div", { className: "relative", children: [jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { placeholder: "Search components...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "pl-10" })] }))] }), jsx("nav", { className: "flex-1 p-4 overflow-y-auto", children: Object.entries(filteredCategories).map(([categoryName, categoryData]) => (jsxs("div", { className: "mb-4", children: [jsxs("button", { onClick: () => !sidebarCollapsed && toggleCategory(categoryName), className: cn("flex items-center w-full p-2 text-sm font-medium rounded-lg transition-colors", "hover:bg-gray-100 text-gray-700", sidebarCollapsed ? "justify-center" : "justify-between"), children: [jsxs("div", { className: "flex items-center space-x-2", children: [categoryData.icon, !sidebarCollapsed && jsx("span", { children: categoryName })] }), !sidebarCollapsed && (jsx(ChevronDown, { className: cn("h-4 w-4 transition-transform", expandedCategories.includes(categoryName) && "rotate-180") }))] }), !sidebarCollapsed && expandedCategories.includes(categoryName) && (jsx("div", { className: "mt-2 ml-6 space-y-1", children: categoryData.components.map((component) => (jsx("button", { onClick: () => setSelectedComponent(component.id), className: cn("flex items-center w-full p-2 text-sm rounded-lg transition-colors", selectedComponent === component.id
|
|
513
112
|
? "bg-primary-50 text-primary-700 border-r-2 border-primary-600"
|
|
514
|
-
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900"), children: component.name }, component.id))) }))] }, categoryName))) })] }), jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", children: [jsx("header", { className: "bg-white border-b border-gray-200 p-4", children: jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center space-x-4", children: [jsx("h1", { className: "text-2xl font-bold text-gray-900", children: currentDoc?.name || "Component Showcase" }), currentDoc &&
|
|
515
|
-
|
|
516
|
-
|
|
113
|
+
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900"), children: component.name }, component.id))) }))] }, categoryName))) })] }), jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", children: [jsx("header", { className: "bg-white border-b border-gray-200 p-4", children: jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center space-x-4", children: [jsx("h1", { className: "text-2xl font-bold text-gray-900", children: currentDoc?.name || "Component Showcase" }), currentDoc && jsx(Badge, { variant: "outline", children: currentDoc.name })] }), jsxs("div", { className: "flex items-center space-x-2", children: [jsxs("div", { className: "flex items-center bg-gray-100 rounded-lg p-1", children: [jsx(Button, { variant: viewMode === "desktop" ? "primary" : "ghost", size: "sm", onClick: () => setViewMode("desktop"), children: jsx(Monitor, { className: "h-4 w-4" }) }), jsx(Button, { variant: viewMode === "tablet" ? "primary" : "ghost", size: "sm", onClick: () => setViewMode("tablet"), children: jsx(Tablet, { className: "h-4 w-4" }) }), jsx(Button, { variant: viewMode === "mobile" ? "primary" : "ghost", size: "sm", onClick: () => setViewMode("mobile"), children: jsx(Smartphone, { className: "h-4 w-4" }) })] }), jsx(Button, { variant: "ghost", size: "sm", onClick: () => setDarkMode(!darkMode), children: darkMode ? (jsx(Sun, { className: "h-4 w-4" })) : (jsx(Moon, { className: "h-4 w-4" })) })] })] }) }), jsx("main", { className: "flex-1 overflow-auto p-6", children: currentDoc ? (jsxs("div", { className: "max-w-6xl mx-auto space-y-8", children: [jsx("div", { children: jsx("p", { className: "text-lg text-gray-600", children: currentDoc.description }) }), jsxs("div", { children: [jsxs("div", { className: "flex gap-3 mb-4", children: [jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedComponent("button"), children: [jsx(Eye, { className: "h-4 w-4 mr-2" }), "Preview"] }), jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedComponent("button"), children: [jsx(Code, { className: "h-4 w-4 mr-2" }), "Code"] }), jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedComponent("button"), children: [jsx(Settings, { className: "h-4 w-4 mr-2" }), "Props"] })] }), jsxs("div", { children: [jsx("div", { className: "mt-6", children: jsx("div", { className: "bg-white rounded-lg shadow p-6", children: jsx("div", { className: cn("mx-auto transition-all duration-300", getViewportClass()), children: jsx("div", { className: cn(darkMode && "dark"), children: showcaseRegistry[selectedComponent]
|
|
114
|
+
? React.createElement(showcaseRegistry[selectedComponent])
|
|
115
|
+
: null }) }) }) }), jsx("div", { className: "mt-6", children: jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [jsxs("div", { className: "flex flex-row items-center justify-between", children: [jsx("h2", { className: "text-lg font-semibold mb-0", children: "Usage Example" }), jsxs(Button, { variant: "outline", size: "sm", onClick: () => copyToClipboard(currentDoc.example), children: [copiedCode === currentDoc.example ? (jsx(Check, { className: "h-4 w-4 mr-2" })) : (jsx(Copy, { className: "h-4 w-4 mr-2" })), "Copy"] })] }), jsx("pre", { className: "bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto", children: jsx("code", { children: currentDoc.example }) })] }) }), jsx("div", { className: "mt-6", children: jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [jsx("h2", { className: "text-lg font-semibold mb-4", children: "Component Props" }), jsx("div", { className: "overflow-x-auto", children: jsxs("table", { className: "w-full border-collapse", children: [jsx("thead", { children: jsxs("tr", { className: "border-b border-gray-200", children: [jsx("th", { className: "text-left p-3 font-medium text-gray-900", children: "Prop" }), jsx("th", { className: "text-left p-3 font-medium text-gray-900", children: "Type" }), jsx("th", { className: "text-left p-3 font-medium text-gray-900", children: "Default" }), jsx("th", { className: "text-left p-3 font-medium text-gray-900", children: "Description" })] }) }), jsx("tbody", { children: currentDoc.props?.map((prop, index) => (jsxs("tr", { className: "border-b border-gray-100", children: [jsxs("td", { className: "p-3", children: [jsx("code", { className: "bg-gray-100 px-2 py-1 rounded text-sm", children: prop.name }), "required" in prop && prop.required && (jsx(Badge, { variant: "danger", className: "ml-2 text-xs", children: "Required" }))] }), jsx("td", { className: "p-3 text-gray-600", children: prop.type }), jsx("td", { className: "p-3 text-gray-600", children: "default" in prop && prop.default ? (jsx("code", { className: "bg-gray-100 px-2 py-1 rounded text-sm", children: prop.default })) : null }), jsx("td", { className: "p-3 text-gray-600", children: prop.description })] }, index))) })] }) })] }) })] })] })] })) : (jsx("div", { className: "flex items-center justify-center h-full", children: jsxs("div", { className: "text-center", children: [jsx(Book, { className: "h-16 w-16 text-gray-400 mx-auto mb-4" }), jsx("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Select a Component" }), jsx("p", { className: "text-gray-600", children: "Choose a component from the sidebar to view its documentation and examples." })] }) })) })] })] }));
|
|
517
116
|
};
|
|
518
117
|
|
|
519
118
|
export { ComponentShowcase };
|