@tanstack/cta-ui-base 0.15.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 +21 -0
- package/components.json +21 -0
- package/dist/app.d.ts +1 -0
- package/dist/app.js +10 -0
- package/dist/components/add-on-info-dialog.d.ts +5 -0
- package/dist/components/add-on-info-dialog.js +5 -0
- package/dist/components/background-animation.d.ts +1 -0
- package/dist/components/background-animation.js +144 -0
- package/dist/components/cta-provider.d.ts +3 -0
- package/dist/components/cta-provider.js +11 -0
- package/dist/components/cta-sidebar.d.ts +1 -0
- package/dist/components/cta-sidebar.js +15 -0
- package/dist/components/custom-add-on-dialog.d.ts +1 -0
- package/dist/components/custom-add-on-dialog.js +38 -0
- package/dist/components/file-navigator.d.ts +2 -0
- package/dist/components/file-navigator.js +86 -0
- package/dist/components/file-tree.d.ts +5 -0
- package/dist/components/file-tree.js +14 -0
- package/dist/components/file-viewer.d.ts +5 -0
- package/dist/components/file-viewer.js +40 -0
- package/dist/components/header.d.ts +1 -0
- package/dist/components/header.js +5 -0
- package/dist/components/icons/tailwind.d.ts +3 -0
- package/dist/components/icons/tailwind.js +5 -0
- package/dist/components/icons/tanstack.d.ts +3 -0
- package/dist/components/icons/tanstack.js +5 -0
- package/dist/components/icons/typescript.d.ts +3 -0
- package/dist/components/icons/typescript.js +5 -0
- package/dist/components/query-provider.d.ts +3 -0
- package/dist/components/query-provider.js +7 -0
- package/dist/components/sidebar-items/add-ons.d.ts +1 -0
- package/dist/components/sidebar-items/add-ons.js +27 -0
- package/dist/components/sidebar-items/mode-selector.d.ts +1 -0
- package/dist/components/sidebar-items/mode-selector.js +19 -0
- package/dist/components/sidebar-items/project-name.d.ts +1 -0
- package/dist/components/sidebar-items/project-name.js +12 -0
- package/dist/components/sidebar-items/run-add-ons.d.ts +1 -0
- package/dist/components/sidebar-items/run-add-ons.js +25 -0
- package/dist/components/sidebar-items/run-create-app.d.ts +1 -0
- package/dist/components/sidebar-items/run-create-app.js +28 -0
- package/dist/components/sidebar-items/sidebar-container.d.ts +3 -0
- package/dist/components/sidebar-items/sidebar-container.js +4 -0
- package/dist/components/sidebar-items/sidebar-group.d.ts +3 -0
- package/dist/components/sidebar-items/sidebar-group.js +4 -0
- package/dist/components/sidebar-items/starter.d.ts +1 -0
- package/dist/components/sidebar-items/starter.js +42 -0
- package/dist/components/sidebar-items/typescript-switch.d.ts +1 -0
- package/dist/components/sidebar-items/typescript-switch.js +18 -0
- package/dist/components/starters-carousel.d.ts +3 -0
- package/dist/components/starters-carousel.js +12 -0
- package/dist/components/startup-dialog.d.ts +1 -0
- package/dist/components/startup-dialog.js +30 -0
- package/dist/components/status-list.d.ts +5 -0
- package/dist/components/status-list.js +4 -0
- package/dist/components/toaster.d.ts +4 -0
- package/dist/components/toaster.js +15 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/carousel.d.ts +20 -0
- package/dist/components/ui/carousel.js +90 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +36 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +8 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +17 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sheet.js +40 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +12 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +17 -0
- package/dist/components/ui/toggle-group.d.ts +7 -0
- package/dist/components/ui/toggle-group.js +20 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.js +27 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tree-view.d.ts +25 -0
- package/dist/components/ui/tree-view.js +151 -0
- package/dist/file-classes.d.ts +8 -0
- package/dist/file-classes.js +41 -0
- package/dist/hooks/use-mounted.d.ts +1 -0
- package/dist/hooks/use-mounted.js +8 -0
- package/dist/hooks/use-preferred-reduced-motion.d.ts +5 -0
- package/dist/hooks/use-preferred-reduced-motion.js +20 -0
- package/dist/hooks/use-streaming-status.d.ts +6 -0
- package/dist/hooks/use-streaming-status.js +55 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/lib/api.d.ts +14 -0
- package/dist/lib/api.js +74 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/store/add-ons.d.ts +7 -0
- package/dist/store/add-ons.js +59 -0
- package/dist/store/project.d.ts +76 -0
- package/dist/store/project.js +269 -0
- package/package.json +50 -0
- package/src/app.tsx +28 -0
- package/src/components/add-on-info-dialog.tsx +39 -0
- package/src/components/background-animation.tsx +224 -0
- package/src/components/cta-provider.tsx +22 -0
- package/src/components/cta-sidebar.tsx +43 -0
- package/src/components/custom-add-on-dialog.tsx +79 -0
- package/src/components/file-navigator.tsx +207 -0
- package/src/components/file-tree.tsx +35 -0
- package/src/components/file-viewer.tsx +67 -0
- package/src/components/header.tsx +29 -0
- package/src/components/icons/tailwind.tsx +26 -0
- package/src/components/icons/tanstack.tsx +338 -0
- package/src/components/icons/typescript.tsx +23 -0
- package/src/components/query-provider.tsx +10 -0
- package/src/components/sidebar-items/add-ons.tsx +94 -0
- package/src/components/sidebar-items/mode-selector.tsx +56 -0
- package/src/components/sidebar-items/project-name.tsx +32 -0
- package/src/components/sidebar-items/run-add-ons.tsx +71 -0
- package/src/components/sidebar-items/run-create-app.tsx +82 -0
- package/src/components/sidebar-items/sidebar-container.tsx +11 -0
- package/src/components/sidebar-items/sidebar-group.tsx +11 -0
- package/src/components/sidebar-items/starter.tsx +123 -0
- package/src/components/sidebar-items/typescript-switch.tsx +58 -0
- package/src/components/starters-carousel.tsx +41 -0
- package/src/components/startup-dialog.tsx +72 -0
- package/src/components/status-list.tsx +22 -0
- package/src/components/toaster.tsx +29 -0
- package/src/components/ui/button.tsx +61 -0
- package/src/components/ui/carousel.tsx +239 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/dialog.tsx +138 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +22 -0
- package/src/components/ui/popover.tsx +46 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +137 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +24 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/tabs.tsx +64 -0
- package/src/components/ui/toggle-group.tsx +72 -0
- package/src/components/ui/toggle.tsx +49 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/components/ui/tree-view.tsx +497 -0
- package/src/file-classes.ts +54 -0
- package/src/hooks/use-mounted.ts +9 -0
- package/src/hooks/use-preferred-reduced-motion.ts +27 -0
- package/src/hooks/use-streaming-status.ts +70 -0
- package/src/index.ts +44 -0
- package/src/lib/api.ts +100 -0
- package/src/lib/utils.ts +8 -0
- package/src/store/add-ons.ts +81 -0
- package/src/store/project.ts +345 -0
- package/src/types.d.ts +109 -0
- package/tests/store/add-ons.test.ts +222 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ProjectName(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from '../ui/input';
|
|
3
|
+
import { setProjectName, useApplicationMode, useProjectName, } from '../../store/project';
|
|
4
|
+
import SidebarContainer from './sidebar-container';
|
|
5
|
+
export default function ProjectName() {
|
|
6
|
+
const name = useProjectName();
|
|
7
|
+
const mode = useApplicationMode();
|
|
8
|
+
if (mode !== 'setup') {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (_jsx(SidebarContainer, { children: _jsxs("div", { className: "flex flex-row gap-2 items-center", children: [_jsx("h3", { className: "font-medium whitespace-nowrap", children: "Project Name" }), _jsx(Input, { value: name, placeholder: "my-app", onChange: (e) => setProjectName(e.target.value), className: "w-full bg-gray-500/10 rounded-md px-2 py-1 min-w-[200px] text-sm" })] }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RunAddOns(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '../ui/dialog';
|
|
5
|
+
import { useAddOns, useApplicationMode } from '../../store/project';
|
|
6
|
+
import useStreamingStatus from '../../hooks/use-streaming-status';
|
|
7
|
+
import StatusList from '../status-list';
|
|
8
|
+
import { addToAppStreaming, shutdown } from '../../lib/api';
|
|
9
|
+
export default function RunAddOns() {
|
|
10
|
+
const { chosenAddOns } = useAddOns();
|
|
11
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
12
|
+
const { streamItems, monitorStream, finished } = useStreamingStatus();
|
|
13
|
+
const mode = useApplicationMode();
|
|
14
|
+
if (mode !== 'add') {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
async function onAddToApp() {
|
|
18
|
+
setIsRunning(true);
|
|
19
|
+
monitorStream(await addToAppStreaming(chosenAddOns));
|
|
20
|
+
}
|
|
21
|
+
return (_jsxs("div", { children: [_jsx(Dialog, { open: isRunning, children: _jsxs(DialogContent, { className: "sm:min-w-[425px] sm:max-w-fit", hideCloseButton: true, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Adding Add-Ons" }) }), _jsx(StatusList, { streamItems: streamItems, finished: finished }), _jsx(DialogFooter, { children: _jsx(Button, { variant: "default", onClick: async () => {
|
|
22
|
+
await shutdown();
|
|
23
|
+
window.close();
|
|
24
|
+
}, disabled: !finished, children: "Exit This Application" }) })] }) }), _jsx("div", { className: "flex flex-col gap-2", children: _jsx(Button, { variant: "default", onClick: onAddToApp, disabled: chosenAddOns.length === 0 || isRunning, className: "w-full", children: "Add These Add-Ons To Your App" }) })] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RunCreateApp(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { HammerIcon } from 'lucide-react';
|
|
4
|
+
import { Button } from '../ui/button';
|
|
5
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '../ui/dialog';
|
|
6
|
+
import useStreamingStatus from '../../hooks/use-streaming-status';
|
|
7
|
+
import { useAddOns, useApplicationMode, useProjectOptions, useProjectStarter, } from '../../store/project';
|
|
8
|
+
import StatusList from '../status-list';
|
|
9
|
+
import { createAppStreaming, shutdown } from '../../lib/api';
|
|
10
|
+
export default function RunCreateApp() {
|
|
11
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
12
|
+
const { streamItems, monitorStream, finished } = useStreamingStatus();
|
|
13
|
+
const mode = useApplicationMode();
|
|
14
|
+
const options = useProjectOptions();
|
|
15
|
+
const { chosenAddOns } = useAddOns();
|
|
16
|
+
const { projectStarter } = useProjectStarter();
|
|
17
|
+
if (mode !== 'setup') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
async function onAddToApp() {
|
|
21
|
+
setIsRunning(true);
|
|
22
|
+
monitorStream(await createAppStreaming(options, chosenAddOns, projectStarter));
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs("div", { children: [_jsx(Dialog, { open: isRunning, children: _jsxs(DialogContent, { className: "sm:min-w-[425px] sm:max-w-fit", hideCloseButton: true, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Creating Your Application" }) }), _jsx(StatusList, { streamItems: streamItems, finished: finished }), _jsx(DialogFooter, { children: _jsx(Button, { variant: "default", onClick: async () => {
|
|
25
|
+
await shutdown();
|
|
26
|
+
window.close();
|
|
27
|
+
}, disabled: !finished, children: "Exit This Application" }) })] }) }), _jsx("div", { className: "flex flex-col gap-2", children: _jsxs(Button, { variant: "default", onClick: onAddToApp, disabled: isRunning, className: "w-full", children: [_jsx(HammerIcon, { className: "w-4 h-4" }), "Build Your App"] }) })] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function SidebarContainer({ children, }) {
|
|
3
|
+
return (_jsx("div", { className: "block p-4 bg-gray-500/10 hover:bg-gray-500/20 rounded-lg transition-colors space-y-4 active @container sidebar-container", children: children }));
|
|
4
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Starter(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { FileBoxIcon, TrashIcon } from 'lucide-react';
|
|
4
|
+
import { toast } from 'sonner';
|
|
5
|
+
import { Button } from '../ui/button';
|
|
6
|
+
import { Input } from '../ui/input';
|
|
7
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '../ui/dialog';
|
|
8
|
+
import { setProjectStarter, useApplicationMode, useProjectStarter, useRegistry, } from '../../store/project';
|
|
9
|
+
import { loadRemoteStarter } from '../../lib/api';
|
|
10
|
+
import { StartersCarousel } from '../starters-carousel';
|
|
11
|
+
export default function Starter() {
|
|
12
|
+
const [url, setUrl] = useState('');
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const mode = useApplicationMode();
|
|
15
|
+
const { projectStarter } = useProjectStarter();
|
|
16
|
+
if (mode !== 'setup') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
async function onImport(registryUrl) {
|
|
20
|
+
const data = await loadRemoteStarter(registryUrl || url);
|
|
21
|
+
if ('error' in data) {
|
|
22
|
+
toast.error('Failed to load starter', {
|
|
23
|
+
description: data.error,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
setProjectStarter(data);
|
|
28
|
+
setOpen(false);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const registry = useRegistry();
|
|
32
|
+
return (_jsxs(_Fragment, { children: [projectStarter?.banner && (_jsx("div", { className: "flex justify-center mb-4", children: _jsx("div", { className: "p-2 bg-gray-300 rounded-lg shadow-xl shadow-gray-800", children: _jsx("img", { src: projectStarter.banner, alt: "Starter Banner", className: "w-40 max-w-full" }) }) })), projectStarter?.name && (_jsxs("div", { className: "text-md mb-4", children: [_jsx(Button, { variant: "outline", size: "sm", className: "mr-2", onClick: () => {
|
|
33
|
+
setProjectStarter(undefined);
|
|
34
|
+
}, children: _jsx(TrashIcon, { className: "w-4 h-4" }) }), _jsx("span", { className: "font-bold", children: "Starter: " }), projectStarter.name] })), _jsxs("div", { children: [_jsxs(Button, { variant: "secondary", className: "w-full", onClick: () => {
|
|
35
|
+
setUrl('');
|
|
36
|
+
setOpen(true);
|
|
37
|
+
}, children: [_jsx(FileBoxIcon, { className: "w-4 h-4" }), "Set Project Starter"] }), _jsx(Dialog, { modal: true, open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "sm:min-w-[425px] sm:max-w-fit", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Project Starter URL" }) }), registry?.starters && (_jsx("div", { children: _jsx(StartersCarousel, { onImport: (url) => onImport(url) }) })), _jsx("div", { children: _jsx(Input, { value: url, onChange: (e) => setUrl(e.target.value), placeholder: "https://github.com/myorg/myproject/starter.json", className: "min-w-lg w-full", onKeyDown: (e) => {
|
|
38
|
+
if (e.key === 'Enter') {
|
|
39
|
+
onImport();
|
|
40
|
+
}
|
|
41
|
+
} }) }), _jsx(DialogFooter, { children: _jsx(Button, { onClick: () => onImport(), children: "Load" }) })] }) })] })] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function TypescriptSwitch(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Label } from '../ui/label';
|
|
3
|
+
import { Switch } from '../ui/switch';
|
|
4
|
+
import Typescript from '../icons/typescript';
|
|
5
|
+
import Tailwind from '../icons/tailwind';
|
|
6
|
+
import { setTailwind, setTypeScript, useApplicationMode, useProjectOptions, useTailwindEditable, useTypeScriptEditable, } from '../../store/project';
|
|
7
|
+
import SidebarContainer from './sidebar-container';
|
|
8
|
+
export default function TypescriptSwitch() {
|
|
9
|
+
const typescript = useProjectOptions((state) => state.typescript);
|
|
10
|
+
const tailwind = useProjectOptions((state) => state.tailwind);
|
|
11
|
+
const mode = useApplicationMode();
|
|
12
|
+
const enableTailwind = useTailwindEditable();
|
|
13
|
+
const enableTypeScript = useTypeScriptEditable();
|
|
14
|
+
if (mode !== 'setup') {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(SidebarContainer, { children: _jsxs("div", { className: "flex", children: [_jsxs("div", { className: "w-1/2 flex flex-row items-center justify-center", children: [_jsx(Switch, { id: "typescript-switch", checked: typescript, onCheckedChange: (checked) => setTypeScript(checked), disabled: !enableTypeScript }), _jsxs(Label, { htmlFor: "typescript-switch", className: "ml-2", children: [_jsx(Typescript, { className: "w-5" }), "TypeScript"] })] }), _jsxs("div", { className: "w-1/2 flex flex-row items-center justify-center", children: [_jsx(Switch, { id: "tailwind-switch", checked: tailwind, onCheckedChange: (checked) => setTailwind(checked), disabled: !enableTailwind }), _jsxs(Label, { htmlFor: "tailwind-switch", className: "ml-2", children: [_jsx(Tailwind, { className: "w-5" }), "Tailwind"] })] })] }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRegistry } from '../store/project';
|
|
3
|
+
import { Carousel, CarouselContent, CarouselItem } from './ui/carousel';
|
|
4
|
+
export function StartersCarousel({ onImport, }) {
|
|
5
|
+
const registry = useRegistry();
|
|
6
|
+
if (!registry) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (_jsx("div", { children: _jsx(Carousel, { children: _jsx(CarouselContent, { children: registry.starters.map((starter) => (_jsx(CarouselItem, { className: "basis-1/3", children: _jsxs("div", { className: "p-2 flex flex-col items-center hover:cursor-pointer hover:bg-gray-700/50 hover:text-white rounded-lg", onClick: () => {
|
|
10
|
+
onImport(starter.url);
|
|
11
|
+
}, children: [_jsx("img", { src: starter.banner, alt: starter.name, className: "w-100 max-w-full" }), _jsx("div", { className: "text-md font-bold", children: starter.name })] }) }, starter.url))) }) }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function StartupDialog(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { toast } from 'sonner';
|
|
3
|
+
import { setProjectStarter, useApplicationMode, useRegistry, useStartupDialog, } from '../store/project';
|
|
4
|
+
import { loadRemoteStarter } from '../lib/api';
|
|
5
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from './ui/dialog';
|
|
6
|
+
import { StartersCarousel } from './starters-carousel';
|
|
7
|
+
import { Button } from './ui/button';
|
|
8
|
+
import { Switch } from './ui/switch';
|
|
9
|
+
import { Label } from './ui/label';
|
|
10
|
+
export default function StartupDialog() {
|
|
11
|
+
const mode = useApplicationMode();
|
|
12
|
+
const registry = useRegistry();
|
|
13
|
+
const { open, setOpen, dontShowAgain, setDontShowAgain } = useStartupDialog();
|
|
14
|
+
if (mode !== 'setup' || !registry || registry?.starters?.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
async function onImport(registryUrl) {
|
|
18
|
+
const data = await loadRemoteStarter(registryUrl);
|
|
19
|
+
if ('error' in data) {
|
|
20
|
+
toast.error('Failed to load starter', {
|
|
21
|
+
description: data.error,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
setProjectStarter(data);
|
|
26
|
+
setOpen(false);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(Dialog, { modal: true, open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "sm:min-w-[425px] sm:max-w-fit", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { className: "text-center text-2xl font-bold", children: "Would you like to use a starter project?" }) }), _jsx("div", { children: _jsx(StartersCarousel, { onImport: onImport }) }), _jsxs(DialogFooter, { className: "flex sm:justify-between w-full", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { id: "show-startup-dialog", checked: dontShowAgain, onCheckedChange: setDontShowAgain }), _jsx(Label, { htmlFor: "show-startup-dialog", children: "Don't show this again" })] }), _jsx(Button, { onClick: () => setOpen(false), children: "No, I want to start from scratch" })] })] }) }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export default function StatusList({ streamItems, finished, }) {
|
|
3
|
+
return (_jsx("div", { className: "flex flex-col gap-2", children: streamItems.map((item, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(item.icon, { className: `w-4 h-4 ${index === streamItems.length - 1 && !finished ? 'text-green-500 animate-spin' : ''}` }), item.message] }, item.id))) }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from 'next-themes';
|
|
3
|
+
import { Toaster as Sonner } from 'sonner';
|
|
4
|
+
const Toaster = ({ ...props }) => {
|
|
5
|
+
const { theme = 'system' } = useTheme();
|
|
6
|
+
return (_jsx(Sonner, { theme: theme, className: "toaster group", toastOptions: {
|
|
7
|
+
classNames: {
|
|
8
|
+
toast: 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
|
|
9
|
+
description: 'group-[.toast]:text-muted-foreground',
|
|
10
|
+
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
|
|
11
|
+
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',
|
|
12
|
+
},
|
|
13
|
+
}, ...props }));
|
|
14
|
+
};
|
|
15
|
+
export { Toaster };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
const buttonVariants = cva("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", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
10
|
+
destructive: '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',
|
|
11
|
+
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
12
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
13
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
14
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
18
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
19
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
20
|
+
icon: 'size-9',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: 'default',
|
|
25
|
+
size: 'default',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
29
|
+
const Comp = asChild ? Slot : 'button';
|
|
30
|
+
return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
31
|
+
}
|
|
32
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
3
|
+
import { Button } from './button';
|
|
4
|
+
import type { UseEmblaCarouselType } from 'embla-carousel-react';
|
|
5
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
6
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
7
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
8
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
9
|
+
type CarouselProps = {
|
|
10
|
+
opts?: CarouselOptions;
|
|
11
|
+
plugins?: CarouselPlugin;
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
setApi?: (api: CarouselApi) => void;
|
|
14
|
+
};
|
|
15
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<'div'> & CarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import { ArrowLeft, ArrowRight } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { Button } from './button';
|
|
7
|
+
const CarouselContext = React.createContext(null);
|
|
8
|
+
function useCarousel() {
|
|
9
|
+
const context = React.useContext(CarouselContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useCarousel must be used within a <Carousel />');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function Carousel({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }) {
|
|
16
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
17
|
+
...opts,
|
|
18
|
+
axis: orientation === 'horizontal' ? 'x' : 'y',
|
|
19
|
+
}, plugins);
|
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
21
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
22
|
+
const onSelect = React.useCallback((api) => {
|
|
23
|
+
if (!api)
|
|
24
|
+
return;
|
|
25
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
26
|
+
setCanScrollNext(api.canScrollNext());
|
|
27
|
+
}, []);
|
|
28
|
+
const scrollPrev = React.useCallback(() => {
|
|
29
|
+
api?.scrollPrev();
|
|
30
|
+
}, [api]);
|
|
31
|
+
const scrollNext = React.useCallback(() => {
|
|
32
|
+
api?.scrollNext();
|
|
33
|
+
}, [api]);
|
|
34
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
35
|
+
if (event.key === 'ArrowLeft') {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
scrollPrev();
|
|
38
|
+
}
|
|
39
|
+
else if (event.key === 'ArrowRight') {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
scrollNext();
|
|
42
|
+
}
|
|
43
|
+
}, [scrollPrev, scrollNext]);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
if (!api || !setApi)
|
|
46
|
+
return;
|
|
47
|
+
setApi(api);
|
|
48
|
+
}, [api, setApi]);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (!api)
|
|
51
|
+
return;
|
|
52
|
+
onSelect(api);
|
|
53
|
+
api.on('reInit', onSelect);
|
|
54
|
+
api.on('select', onSelect);
|
|
55
|
+
return () => {
|
|
56
|
+
api?.off('select', onSelect);
|
|
57
|
+
};
|
|
58
|
+
}, [api, onSelect]);
|
|
59
|
+
return (_jsx(CarouselContext.Provider, { value: {
|
|
60
|
+
carouselRef,
|
|
61
|
+
api: api,
|
|
62
|
+
opts,
|
|
63
|
+
orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
|
|
64
|
+
scrollPrev,
|
|
65
|
+
scrollNext,
|
|
66
|
+
canScrollPrev,
|
|
67
|
+
canScrollNext,
|
|
68
|
+
}, children: _jsx("div", { onKeyDownCapture: handleKeyDown, className: cn('relative', className), role: "region", "aria-roledescription": "carousel", "data-slot": "carousel", ...props, children: children }) }));
|
|
69
|
+
}
|
|
70
|
+
function CarouselContent({ className, ...props }) {
|
|
71
|
+
const { carouselRef, orientation } = useCarousel();
|
|
72
|
+
return (_jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: _jsx("div", { className: cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className), ...props }) }));
|
|
73
|
+
}
|
|
74
|
+
function CarouselItem({ className, ...props }) {
|
|
75
|
+
const { orientation } = useCarousel();
|
|
76
|
+
return (_jsx("div", { role: "group", "aria-roledescription": "slide", "data-slot": "carousel-item", className: cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className), ...props }));
|
|
77
|
+
}
|
|
78
|
+
function CarouselPrevious({ className, variant = 'outline', size = 'icon', ...props }) {
|
|
79
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
80
|
+
return (_jsxs(Button, { "data-slot": "carousel-previous", variant: variant, size: size, className: cn('absolute size-8 rounded-full', orientation === 'horizontal'
|
|
81
|
+
? 'top-1/2 -left-12 -translate-y-1/2'
|
|
82
|
+
: '-top-12 left-1/2 -translate-x-1/2 rotate-90', className), disabled: !canScrollPrev, onClick: scrollPrev, ...props, children: [_jsx(ArrowLeft, {}), _jsx("span", { className: "sr-only", children: "Previous slide" })] }));
|
|
83
|
+
}
|
|
84
|
+
function CarouselNext({ className, variant = 'outline', size = 'icon', ...props }) {
|
|
85
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
86
|
+
return (_jsxs(Button, { "data-slot": "carousel-next", variant: variant, size: size, className: cn('absolute size-8 rounded-full', orientation === 'horizontal'
|
|
87
|
+
? 'top-1/2 -right-12 -translate-y-1/2'
|
|
88
|
+
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90', className), disabled: !canScrollNext, onClick: scrollNext, ...props, children: [_jsx(ArrowRight, {}), _jsx("span", { className: "sr-only", children: "Next slide" })] }));
|
|
89
|
+
}
|
|
90
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
|
+
import { CheckIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
function Checkbox({ className, ...props }) {
|
|
7
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center text-current transition-none", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
|
|
8
|
+
}
|
|
9
|
+
export { Checkbox };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, hideCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
hideCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
import { XIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
function Dialog({ ...props }) {
|
|
7
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DialogTrigger({ ...props }) {
|
|
10
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DialogPortal({ ...props }) {
|
|
13
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
14
|
+
}
|
|
15
|
+
function DialogClose({ ...props }) {
|
|
16
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
17
|
+
}
|
|
18
|
+
function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function DialogContent({ className, children, hideCloseButton, ...props }) {
|
|
22
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg p-6 shadow-lg duration-200 sm:max-w-lg bg-opacity-70 backdrop-blur-md border-3 border-white/20', className), ...props, children: [children, !hideCloseButton && (_jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
23
|
+
}
|
|
24
|
+
function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-lg leading-none font-semibold', className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
function DropdownMenu({ ...props }) {
|
|
7
|
+
return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DropdownMenuPortal({ ...props }) {
|
|
10
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props }));
|
|
11
|
+
}
|
|
12
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
13
|
+
return (_jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props }));
|
|
14
|
+
}
|
|
15
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
16
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md', className), ...props }) }));
|
|
17
|
+
}
|
|
18
|
+
function DropdownMenuGroup({ ...props }) {
|
|
19
|
+
return (_jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props }));
|
|
20
|
+
}
|
|
21
|
+
function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
|
|
22
|
+
return (_jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
25
|
+
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked, ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), children] }));
|
|
26
|
+
}
|
|
27
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
28
|
+
return (_jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props }));
|
|
29
|
+
}
|
|
30
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
31
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] }));
|
|
32
|
+
}
|
|
33
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
34
|
+
return (_jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn('px-2 py-1.5 text-sm font-medium data-[inset]:pl-8', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
37
|
+
return (_jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn('bg-border -mx-1 my-1 h-px', className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
40
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className), ...props }));
|
|
41
|
+
}
|
|
42
|
+
function DropdownMenuSub({ ...props }) {
|
|
43
|
+
return _jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
44
|
+
}
|
|
45
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
46
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn('focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8', className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "ml-auto size-4" })] }));
|
|
47
|
+
}
|
|
48
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
49
|
+
return (_jsx(DropdownMenuPrimitive.SubContent, { "data-slot": "dropdown-menu-sub-content", className: cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg', className), ...props }));
|
|
50
|
+
}
|
|
51
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
function Input({ className, type, ...props }) {
|
|
5
|
+
return (_jsx("input", { type: type, "data-slot": "input", className: cn('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', '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', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
export { Input };
|