create-lego-one 2.0.10 → 2.0.13
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/index.cjs +179 -0
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -3
- package/template/.cursor/rules/rules.mdc +639 -0
- package/template/.dockerignore +58 -0
- package/template/.env.example +18 -0
- package/template/.eslintignore +5 -0
- package/template/.eslintrc.js +28 -0
- package/template/.prettierignore +6 -0
- package/template/.prettierrc +11 -0
- package/template/CLAUDE.md +634 -0
- package/template/Dockerfile +67 -0
- package/template/PROMPT.md +457 -0
- package/template/README.md +325 -0
- package/template/docker-compose.yml +48 -0
- package/template/docker-entrypoint.sh +23 -0
- package/template/docs/checkpoints/.template.md +64 -0
- package/template/docs/checkpoints/framework/01-infrastructure-setup.md +132 -0
- package/template/docs/checkpoints/framework/02-pocketbase-setup.md +155 -0
- package/template/docs/checkpoints/framework/03-host-kernel.md +170 -0
- package/template/docs/checkpoints/framework/04-auth-system.md +163 -0
- package/template/docs/checkpoints/framework/phase-05-multitenancy-rbac.md +223 -0
- package/template/docs/checkpoints/framework/phase-06-ui-components.md +260 -0
- package/template/docs/checkpoints/framework/phase-07-communication-system.md +276 -0
- package/template/docs/checkpoints/framework/phase-08-plugin-system.md +91 -0
- package/template/docs/checkpoints/framework/phase-09-dashboard-plugin.md +111 -0
- package/template/docs/checkpoints/framework/phase-10-todo-plugin.md +169 -0
- package/template/docs/checkpoints/framework/phase-11-testing.md +264 -0
- package/template/docs/checkpoints/framework/phase-12-deployment.md +294 -0
- package/template/docs/checkpoints/framework/phase-13-documentation.md +312 -0
- package/template/docs/framework/plans/00-index.md +164 -0
- package/template/docs/framework/plans/01-infrastructure-setup.md +855 -0
- package/template/docs/framework/plans/02-pocketbase-setup.md +1374 -0
- package/template/docs/framework/plans/03-host-kernel.md +1518 -0
- package/template/docs/framework/plans/04-auth-system.md +1466 -0
- package/template/docs/framework/plans/05-multitenancy-rbac.md +1527 -0
- package/template/docs/framework/plans/06-ui-components.md +1478 -0
- package/template/docs/framework/plans/07-communication-system.md +1106 -0
- package/template/docs/framework/plans/08-plugin-system.md +1179 -0
- package/template/docs/framework/plans/09-dashboard-plugin.md +1137 -0
- package/template/docs/framework/plans/10-todo-plugin.md +1343 -0
- package/template/docs/framework/plans/11-testing.md +935 -0
- package/template/docs/framework/plans/12-deployment.md +896 -0
- package/template/docs/framework/prompts/0-boilerplate-modernjs.md +151 -0
- package/template/docs/framework/research/00-modernjs-audit.md +488 -0
- package/template/docs/framework/research/01-system-blueprint.md +721 -0
- package/template/docs/framework/research/02-data-migration-protocol.md +699 -0
- package/template/docs/framework/research/03-host-setup.md +714 -0
- package/template/docs/framework/research/04-plugin-architecture.md +645 -0
- package/template/docs/framework/research/05-slot-injection-pattern.md +671 -0
- package/template/docs/framework/research/06-cli-strategy.md +615 -0
- package/template/docs/framework/research/07-deployment.md +629 -0
- package/template/docs/framework/research/README.md +282 -0
- package/template/docs/framework/setup/00-index.md +210 -0
- package/template/docs/framework/setup/01-framework-structure.md +308 -0
- package/template/docs/framework/setup/02-development-workflow.md +405 -0
- package/template/docs/framework/setup/03-environment-setup.md +215 -0
- package/template/docs/framework/setup/04-kernel-architecture.md +499 -0
- package/template/docs/framework/setup/05-plugin-system.md +620 -0
- package/template/docs/framework/setup/06-communication-patterns.md +451 -0
- package/template/docs/framework/setup/07-plugin-development.md +582 -0
- package/template/docs/framework/setup/08-component-library.md +658 -0
- package/template/docs/framework/setup/09-data-integration.md +609 -0
- package/template/docs/framework/setup/10-auth-rbac.md +497 -0
- package/template/docs/framework/setup/11-hooks-api.md +393 -0
- package/template/docs/framework/setup/12-components-api.md +665 -0
- package/template/docs/framework/setup/13-deployment-guide.md +566 -0
- package/template/docs/framework/setup/README.md +548 -0
- package/template/host/e2e/auth.spec.ts +38 -0
- package/template/host/e2e/layout.spec.ts +38 -0
- package/template/host/modern.config.ts +19 -0
- package/template/host/package.json +71 -0
- package/template/host/playwright.config.ts +34 -0
- package/template/host/postcss.config.mjs +6 -0
- package/template/host/src/App.tsx +6 -0
- package/template/host/src/bootstrap.tsx +74 -0
- package/template/host/src/global.css +59 -0
- package/template/host/src/index.ts +2 -0
- package/template/host/src/kernel/__tests__/lib-utils.test.ts +32 -0
- package/template/host/src/kernel/__tests__/rbac-hooks.test.tsx +114 -0
- package/template/host/src/kernel/__tests__/rbac-utils.test.ts +108 -0
- package/template/host/src/kernel/auth/ProtectedRoute.tsx +41 -0
- package/template/host/src/kernel/auth/components/LoginForm.tsx +97 -0
- package/template/host/src/kernel/auth/components/LogoutButton.tsx +79 -0
- package/template/host/src/kernel/auth/hooks.ts +174 -0
- package/template/host/src/kernel/auth/index.ts +5 -0
- package/template/host/src/kernel/auth/schemas.ts +27 -0
- package/template/host/src/kernel/auth/service.ts +197 -0
- package/template/host/src/kernel/auth/types.ts +36 -0
- package/template/host/src/kernel/channels/ChannelBus.ts +181 -0
- package/template/host/src/kernel/channels/ChannelProvider.tsx +57 -0
- package/template/host/src/kernel/channels/events.ts +27 -0
- package/template/host/src/kernel/channels/hooks.ts +168 -0
- package/template/host/src/kernel/channels/index.ts +6 -0
- package/template/host/src/kernel/channels/integrations/ToastIntegration.tsx +60 -0
- package/template/host/src/kernel/channels/plugin-hooks.ts +72 -0
- package/template/host/src/kernel/channels/types.ts +112 -0
- package/template/host/src/kernel/components/__tests__/Badge.test.tsx +35 -0
- package/template/host/src/kernel/components/__tests__/Button.test.tsx +63 -0
- package/template/host/src/kernel/components/__tests__/Input.test.tsx +64 -0
- package/template/host/src/kernel/components/index.ts +32 -0
- package/template/host/src/kernel/components/ui/alert.tsx +58 -0
- package/template/host/src/kernel/components/ui/avatar.tsx +47 -0
- package/template/host/src/kernel/components/ui/badge.tsx +35 -0
- package/template/host/src/kernel/components/ui/button.tsx +50 -0
- package/template/host/src/kernel/components/ui/card.tsx +78 -0
- package/template/host/src/kernel/components/ui/dialog.tsx +116 -0
- package/template/host/src/kernel/components/ui/dropdown-menu.tsx +192 -0
- package/template/host/src/kernel/components/ui/index.ts +7 -0
- package/template/host/src/kernel/components/ui/input.tsx +24 -0
- package/template/host/src/kernel/components/ui/label.tsx +21 -0
- package/template/host/src/kernel/components/ui/popover.tsx +28 -0
- package/template/host/src/kernel/components/ui/progress.tsx +25 -0
- package/template/host/src/kernel/components/ui/scroll-area.tsx +45 -0
- package/template/host/src/kernel/components/ui/select.tsx +155 -0
- package/template/host/src/kernel/components/ui/separator.tsx +28 -0
- package/template/host/src/kernel/components/ui/skeleton.tsx +15 -0
- package/template/host/src/kernel/components/ui/switch.tsx +26 -0
- package/template/host/src/kernel/components/ui/table.tsx +116 -0
- package/template/host/src/kernel/components/ui/tabs.tsx +52 -0
- package/template/host/src/kernel/components/ui/toast.tsx +126 -0
- package/template/host/src/kernel/components/ui/toaster.tsx +34 -0
- package/template/host/src/kernel/components/ui/tooltip.tsx +27 -0
- package/template/host/src/kernel/components/ui/use-toast.ts +183 -0
- package/template/host/src/kernel/index.ts +48 -0
- package/template/host/src/kernel/lib/cn.ts +1 -0
- package/template/host/src/kernel/lib/utils.ts +36 -0
- package/template/host/src/kernel/plugins/Slot.tsx +41 -0
- package/template/host/src/kernel/plugins/SlotProvider.tsx +88 -0
- package/template/host/src/kernel/plugins/index.ts +23 -0
- package/template/host/src/kernel/plugins/loader.ts +122 -0
- package/template/host/src/kernel/plugins/schemas.ts +54 -0
- package/template/host/src/kernel/plugins/store.ts +185 -0
- package/template/host/src/kernel/plugins/types.ts +103 -0
- package/template/host/src/kernel/providers/PocketBaseProvider.tsx +70 -0
- package/template/host/src/kernel/providers/QueryProvider.tsx +28 -0
- package/template/host/src/kernel/providers/ThemeProvider.tsx +25 -0
- package/template/host/src/kernel/providers/index.ts +3 -0
- package/template/host/src/kernel/rbac/components/OrganizationSelector.tsx +69 -0
- package/template/host/src/kernel/rbac/components/PermissionGate.tsx +43 -0
- package/template/host/src/kernel/rbac/hooks.ts +379 -0
- package/template/host/src/kernel/rbac/index.ts +6 -0
- package/template/host/src/kernel/rbac/service.ts +504 -0
- package/template/host/src/kernel/rbac/types.ts +164 -0
- package/template/host/src/kernel/rbac/utils.ts +34 -0
- package/template/host/src/kernel/shared-state/bridge.ts +31 -0
- package/template/host/src/kernel/shared-state/index.ts +3 -0
- package/template/host/src/kernel/shared-state/store.ts +62 -0
- package/template/host/src/kernel/shared-state/types.ts +60 -0
- package/template/host/src/kernel/use-migrations.ts +72 -0
- package/template/host/src/layout/MobileMenu.tsx +61 -0
- package/template/host/src/layout/Shell.tsx +42 -0
- package/template/host/src/layout/Sidebar.tsx +178 -0
- package/template/host/src/layout/Topbar.tsx +50 -0
- package/template/host/src/layout/index.ts +4 -0
- package/template/host/src/lib/pocketbase/client.ts +38 -0
- package/template/host/src/lib/pocketbase/collections/audit_logs.ts +87 -0
- package/template/host/src/lib/pocketbase/collections/index.ts +19 -0
- package/template/host/src/lib/pocketbase/collections/organizations.ts +63 -0
- package/template/host/src/lib/pocketbase/collections/permissions.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/roles.ts +55 -0
- package/template/host/src/lib/pocketbase/collections/todos.ts +74 -0
- package/template/host/src/lib/pocketbase/collections/user_roles.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/users.ts +43 -0
- package/template/host/src/lib/pocketbase/index.ts +5 -0
- package/template/host/src/lib/pocketbase/migrations.ts +44 -0
- package/template/host/src/lib/pocketbase/seed/permissions.ts +8 -0
- package/template/host/src/lib/pocketbase/seed/roles.ts +22 -0
- package/template/host/src/lib/pocketbase/seed.ts +113 -0
- package/template/host/src/lib/pocketbase/types.ts +102 -0
- package/template/host/src/modern.runtime.ts +26 -0
- package/template/host/src/plugins.d.ts +9 -0
- package/template/host/src/providers/PocketBaseProvider.tsx +30 -0
- package/template/host/src/routes/_.tsx +6 -0
- package/template/host/src/routes/dashboard._.tsx +41 -0
- package/template/host/src/routes/index.tsx +93 -0
- package/template/host/src/routes/login.tsx +36 -0
- package/template/host/src/saas.config.ts +52 -0
- package/template/host/src/test/setup.ts +65 -0
- package/template/host/src/test/utils.tsx +69 -0
- package/template/host/src/test/vitest-globals.d.ts +19 -0
- package/template/host/src/vite-env.d.ts +16 -0
- package/template/host/tailwind.config.ts +77 -0
- package/template/host/tsconfig.json +19 -0
- package/template/host/vitest.config.ts +30 -0
- package/template/nginx.conf +72 -0
- package/template/package.json +44 -0
- package/template/packages/plugins/@lego/plugin-dashboard/modern.config.ts +19 -0
- package/template/packages/plugins/@lego/plugin-dashboard/package.json +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/App.tsx +27 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/ActivityFeed.tsx +63 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActionSlot.tsx +11 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActions.tsx +68 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/SidebarWidget.tsx +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/StatCard.tsx +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/global.css +24 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useChannelIntegration.ts +43 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useDashboardStats.ts +65 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/usePocketBase.ts +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useRecentActivity.ts +55 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/lib/utils.ts +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/pages/DashboardPage.tsx +105 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.config.ts +121 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.ts +18 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/vite-env.d.ts +32 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tailwind.config.ts +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tsconfig.json +18 -0
- package/template/packages/plugins/@lego/plugin-todo/modern.config.ts +18 -0
- package/template/packages/plugins/@lego/plugin-todo/package.json +41 -0
- package/template/packages/plugins/@lego/plugin-todo/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/App.tsx +12 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/SidebarWidget.tsx +16 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoDialog.tsx +55 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoFilters.tsx +79 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoForm.tsx +94 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoItem.tsx +121 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoList.tsx +41 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/index.ts +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/global.css +59 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useCreateTodo.ts +62 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useDeleteTodo.ts +46 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/usePocketBase.ts +38 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useTodos.ts +64 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useUpdateTodo.ts +35 -0
- package/template/packages/plugins/@lego/plugin-todo/src/index.tsx +5 -0
- package/template/packages/plugins/@lego/plugin-todo/src/lib/utils.ts +20 -0
- package/template/packages/plugins/@lego/plugin-todo/src/pages/TodoPage.tsx +89 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.config.ts +104 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.ts +13 -0
- package/template/packages/plugins/@lego/plugin-todo/src/schemas.ts +37 -0
- package/template/packages/plugins/@lego/plugin-todo/src/types.ts +42 -0
- package/template/packages/plugins/@lego/plugin-todo/src/vite-env.d.ts +31 -0
- package/template/packages/plugins/@lego/plugin-todo/tailwind.config.ts +51 -0
- package/template/packages/plugins/@lego/plugin-todo/tsconfig.json +18 -0
- package/template/pnpm-workspace.yaml +4 -0
- package/template/pocketbase/CHANGELOG.md +911 -0
- package/template/pocketbase/LICENSE.md +17 -0
- package/template/scripts/create-plugin.js +221 -0
- package/template/scripts/deploy.sh +56 -0
- package/template/tsconfig.base.json +26 -0
- package/template/tsconfig.json +8 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
const ScrollArea = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
8
|
+
>(({ className, children, ...props }, ref) => (
|
|
9
|
+
<ScrollAreaPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn('relative overflow-hidden', className)}
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
15
|
+
{children}
|
|
16
|
+
</ScrollAreaPrimitive.Viewport>
|
|
17
|
+
<ScrollBar />
|
|
18
|
+
<ScrollAreaPrimitive.Corner />
|
|
19
|
+
</ScrollAreaPrimitive.Root>
|
|
20
|
+
));
|
|
21
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
22
|
+
|
|
23
|
+
const ScrollBar = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
26
|
+
>(({ className, orientation = 'vertical', ...props }, ref) => (
|
|
27
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
28
|
+
ref={ref}
|
|
29
|
+
orientation={orientation}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex touch-none select-none transition-colors',
|
|
32
|
+
orientation === 'vertical' &&
|
|
33
|
+
'h-full w-2.5 border-l border-l-transparent p-[1px]',
|
|
34
|
+
orientation === 'horizontal' &&
|
|
35
|
+
'h-2.5 flex-col border-t border-t-transparent p-[1px]',
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
41
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
42
|
+
));
|
|
43
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
44
|
+
|
|
45
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Select = SelectPrimitive.Root;
|
|
7
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
8
|
+
const SelectValue = SelectPrimitive.Value;
|
|
9
|
+
|
|
10
|
+
const SelectTrigger = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
13
|
+
>(({ className, children, ...props }, ref) => (
|
|
14
|
+
<SelectPrimitive.Trigger
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={cn(
|
|
17
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
<SelectPrimitive.Icon asChild>
|
|
24
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
25
|
+
</SelectPrimitive.Icon>
|
|
26
|
+
</SelectPrimitive.Trigger>
|
|
27
|
+
));
|
|
28
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
29
|
+
|
|
30
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
31
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
33
|
+
>(({ className, ...props }, ref) => (
|
|
34
|
+
<SelectPrimitive.ScrollUpButton
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(
|
|
37
|
+
'flex cursor-default items-center justify-center py-1',
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<ChevronUp className="h-4 w-4" />
|
|
43
|
+
</SelectPrimitive.ScrollUpButton>
|
|
44
|
+
));
|
|
45
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
46
|
+
|
|
47
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
48
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<SelectPrimitive.ScrollDownButton
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn(
|
|
54
|
+
'flex cursor-default items-center justify-center py-1',
|
|
55
|
+
className
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<ChevronDown className="h-4 w-4" />
|
|
60
|
+
</SelectPrimitive.ScrollDownButton>
|
|
61
|
+
));
|
|
62
|
+
SelectScrollDownButton.displayName =
|
|
63
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
64
|
+
|
|
65
|
+
const SelectContent = React.forwardRef<
|
|
66
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
67
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
68
|
+
>(({ className, children, position = 'popper', ...props }, ref) => (
|
|
69
|
+
<SelectPrimitive.Portal>
|
|
70
|
+
<SelectPrimitive.Content
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={cn(
|
|
73
|
+
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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',
|
|
74
|
+
position === 'popper' &&
|
|
75
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
position={position}
|
|
79
|
+
{...props}
|
|
80
|
+
>
|
|
81
|
+
<SelectScrollUpButton />
|
|
82
|
+
<SelectPrimitive.Viewport
|
|
83
|
+
className={cn(
|
|
84
|
+
'p-1',
|
|
85
|
+
position === 'popper' &&
|
|
86
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
{children}
|
|
90
|
+
</SelectPrimitive.Viewport>
|
|
91
|
+
<SelectScrollDownButton />
|
|
92
|
+
</SelectPrimitive.Content>
|
|
93
|
+
</SelectPrimitive.Portal>
|
|
94
|
+
));
|
|
95
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
96
|
+
|
|
97
|
+
const SelectLabel = React.forwardRef<
|
|
98
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
99
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
100
|
+
>(({ className, ...props }, ref) => (
|
|
101
|
+
<SelectPrimitive.Label
|
|
102
|
+
ref={ref}
|
|
103
|
+
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
));
|
|
107
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
108
|
+
|
|
109
|
+
const SelectItem = React.forwardRef<
|
|
110
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
111
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
112
|
+
>(({ className, children, ...props }, ref) => (
|
|
113
|
+
<SelectPrimitive.Item
|
|
114
|
+
ref={ref}
|
|
115
|
+
className={cn(
|
|
116
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
117
|
+
className
|
|
118
|
+
)}
|
|
119
|
+
{...props}
|
|
120
|
+
>
|
|
121
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
122
|
+
<SelectPrimitive.ItemIndicator>
|
|
123
|
+
<Check className="h-4 w-4" />
|
|
124
|
+
</SelectPrimitive.ItemIndicator>
|
|
125
|
+
</span>
|
|
126
|
+
|
|
127
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
128
|
+
</SelectPrimitive.Item>
|
|
129
|
+
));
|
|
130
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
131
|
+
|
|
132
|
+
const SelectSeparator = React.forwardRef<
|
|
133
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
134
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
135
|
+
>(({ className, ...props }, ref) => (
|
|
136
|
+
<SelectPrimitive.Separator
|
|
137
|
+
ref={ref}
|
|
138
|
+
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
));
|
|
142
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
143
|
+
|
|
144
|
+
export {
|
|
145
|
+
Select,
|
|
146
|
+
SelectGroup,
|
|
147
|
+
SelectValue,
|
|
148
|
+
SelectTrigger,
|
|
149
|
+
SelectContent,
|
|
150
|
+
SelectLabel,
|
|
151
|
+
SelectItem,
|
|
152
|
+
SelectSeparator,
|
|
153
|
+
SelectScrollUpButton,
|
|
154
|
+
SelectScrollDownButton,
|
|
155
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
const Separator = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
8
|
+
>(
|
|
9
|
+
(
|
|
10
|
+
{ className, orientation = 'horizontal', decorative = true, ...props },
|
|
11
|
+
ref
|
|
12
|
+
) => (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
'shrink-0 bg-border',
|
|
19
|
+
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
27
|
+
|
|
28
|
+
export { Separator };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils';
|
|
2
|
+
|
|
3
|
+
function Skeleton({
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={cn('animate-pulse rounded-md bg-muted', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Skeleton };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
const Switch = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<SwitchPrimitives.Root
|
|
10
|
+
className={cn(
|
|
11
|
+
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
ref={ref}
|
|
16
|
+
>
|
|
17
|
+
<SwitchPrimitives.Thumb
|
|
18
|
+
className={cn(
|
|
19
|
+
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0'
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
</SwitchPrimitives.Root>
|
|
23
|
+
));
|
|
24
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
25
|
+
|
|
26
|
+
export { Switch };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
|
|
4
|
+
const Table = React.forwardRef<
|
|
5
|
+
HTMLTableElement,
|
|
6
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
7
|
+
>(({ className, ...props }, ref) => (
|
|
8
|
+
<div className="relative w-full overflow-auto">
|
|
9
|
+
<table
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
));
|
|
16
|
+
Table.displayName = 'Table';
|
|
17
|
+
|
|
18
|
+
const TableHeader = React.forwardRef<
|
|
19
|
+
HTMLTableSectionElement,
|
|
20
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
|
|
23
|
+
));
|
|
24
|
+
TableHeader.displayName = 'TableHeader';
|
|
25
|
+
|
|
26
|
+
const TableBody = React.forwardRef<
|
|
27
|
+
HTMLTableSectionElement,
|
|
28
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<tbody
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn('[&_tr:last-child]:border-0', className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
TableBody.displayName = 'TableBody';
|
|
37
|
+
|
|
38
|
+
const TableFooter = React.forwardRef<
|
|
39
|
+
HTMLTableSectionElement,
|
|
40
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<tfoot
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
'border-t bg-muted/50 font-medium [&>tr]:last:border-b-0',
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
));
|
|
51
|
+
TableFooter.displayName = 'TableFooter';
|
|
52
|
+
|
|
53
|
+
const TableRow = React.forwardRef<
|
|
54
|
+
HTMLTableRowElement,
|
|
55
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
56
|
+
>(({ className, ...props }, ref) => (
|
|
57
|
+
<tr
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(
|
|
60
|
+
'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
));
|
|
66
|
+
TableRow.displayName = 'TableRow';
|
|
67
|
+
|
|
68
|
+
const TableHead = React.forwardRef<
|
|
69
|
+
HTMLTableCellElement,
|
|
70
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
71
|
+
>(({ className, ...props }, ref) => (
|
|
72
|
+
<th
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn(
|
|
75
|
+
'h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
));
|
|
81
|
+
TableHead.displayName = 'TableHead';
|
|
82
|
+
|
|
83
|
+
const TableCell = React.forwardRef<
|
|
84
|
+
HTMLTableCellElement,
|
|
85
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
86
|
+
>(({ className, ...props }, ref) => (
|
|
87
|
+
<td
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
));
|
|
93
|
+
TableCell.displayName = 'TableCell';
|
|
94
|
+
|
|
95
|
+
const TableCaption = React.forwardRef<
|
|
96
|
+
HTMLTableCaptionElement,
|
|
97
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
98
|
+
>(({ className, ...props }, ref) => (
|
|
99
|
+
<caption
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn('mt-4 text-sm text-muted-foreground', className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
));
|
|
105
|
+
TableCaption.displayName = 'TableCaption';
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
Table,
|
|
109
|
+
TableHeader,
|
|
110
|
+
TableBody,
|
|
111
|
+
TableFooter,
|
|
112
|
+
TableHead,
|
|
113
|
+
TableRow,
|
|
114
|
+
TableCell,
|
|
115
|
+
TableCaption,
|
|
116
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
const Tabs = TabsPrimitive.Root;
|
|
6
|
+
|
|
7
|
+
const TabsList = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<TabsPrimitive.List
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
));
|
|
20
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
21
|
+
|
|
22
|
+
const TabsTrigger = React.forwardRef<
|
|
23
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<TabsPrimitive.Trigger
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn(
|
|
29
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
));
|
|
35
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
36
|
+
|
|
37
|
+
const TabsContent = React.forwardRef<
|
|
38
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<TabsPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
));
|
|
50
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
51
|
+
|
|
52
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
|
|
7
|
+
const ToastProvider = ToastPrimitives.Provider;
|
|
8
|
+
|
|
9
|
+
const ToastViewport = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof ToastPrimitives.Viewport>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<ToastPrimitives.Viewport
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
));
|
|
22
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
23
|
+
|
|
24
|
+
const toastVariants = cva(
|
|
25
|
+
'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
variant: {
|
|
29
|
+
default: 'border bg-background text-foreground',
|
|
30
|
+
destructive:
|
|
31
|
+
'destructive group border-destructive bg-destructive text-destructive-foreground',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: 'default',
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const Toast = React.forwardRef<
|
|
41
|
+
React.ElementRef<typeof ToastPrimitives.Root>,
|
|
42
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
43
|
+
VariantProps<typeof toastVariants>
|
|
44
|
+
>(({ className, variant, ...props }, ref) => {
|
|
45
|
+
return (
|
|
46
|
+
<ToastPrimitives.Root
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn(toastVariants({ variant }), className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
54
|
+
|
|
55
|
+
const ToastAction = React.forwardRef<
|
|
56
|
+
React.ElementRef<typeof ToastPrimitives.Action>,
|
|
57
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
|
|
58
|
+
>(({ className, ...props }, ref) => (
|
|
59
|
+
<ToastPrimitives.Action
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn(
|
|
62
|
+
'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive',
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
));
|
|
68
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
69
|
+
|
|
70
|
+
const ToastClose = React.forwardRef<
|
|
71
|
+
React.ElementRef<typeof ToastPrimitives.Close>,
|
|
72
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
|
|
73
|
+
>(({ className, ...props }, ref) => (
|
|
74
|
+
<ToastPrimitives.Close
|
|
75
|
+
ref={ref}
|
|
76
|
+
className={cn(
|
|
77
|
+
'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
toast-close=""
|
|
81
|
+
{...props}
|
|
82
|
+
>
|
|
83
|
+
<X className="h-4 w-4" />
|
|
84
|
+
</ToastPrimitives.Close>
|
|
85
|
+
));
|
|
86
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
87
|
+
|
|
88
|
+
const ToastTitle = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof ToastPrimitives.Title>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<ToastPrimitives.Title
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn('text-sm font-semibold', className)}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
));
|
|
98
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
99
|
+
|
|
100
|
+
const ToastDescription = React.forwardRef<
|
|
101
|
+
React.ElementRef<typeof ToastPrimitives.Description>,
|
|
102
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
|
|
103
|
+
>(({ className, ...props }, ref) => (
|
|
104
|
+
<ToastPrimitives.Description
|
|
105
|
+
ref={ref}
|
|
106
|
+
className={cn('text-sm opacity-90', className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
));
|
|
110
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
111
|
+
|
|
112
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
113
|
+
|
|
114
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
type ToastProps,
|
|
118
|
+
type ToastActionElement,
|
|
119
|
+
ToastProvider,
|
|
120
|
+
ToastViewport,
|
|
121
|
+
Toast,
|
|
122
|
+
ToastTitle,
|
|
123
|
+
ToastDescription,
|
|
124
|
+
ToastClose,
|
|
125
|
+
ToastAction,
|
|
126
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Toast,
|
|
3
|
+
ToastClose,
|
|
4
|
+
ToastDescription,
|
|
5
|
+
ToastProvider,
|
|
6
|
+
ToastTitle,
|
|
7
|
+
ToastViewport,
|
|
8
|
+
} from './toast';
|
|
9
|
+
import { useToast } from './use-toast';
|
|
10
|
+
import { cn } from '../../lib/utils';
|
|
11
|
+
|
|
12
|
+
export function Toaster() {
|
|
13
|
+
const { toasts } = useToast();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ToastProvider>
|
|
17
|
+
{toasts.map(function ({ id, title, description, action, ...props }) {
|
|
18
|
+
return (
|
|
19
|
+
<Toast key={id} {...props}>
|
|
20
|
+
<div className="grid gap-1">
|
|
21
|
+
{title && <ToastTitle>{title}</ToastTitle>}
|
|
22
|
+
{description && (
|
|
23
|
+
<ToastDescription>{description}</ToastDescription>
|
|
24
|
+
)}
|
|
25
|
+
</div>
|
|
26
|
+
{action}
|
|
27
|
+
<ToastClose />
|
|
28
|
+
</Toast>
|
|
29
|
+
);
|
|
30
|
+
})}
|
|
31
|
+
<ToastViewport />
|
|
32
|
+
</ToastProvider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
6
|
+
|
|
7
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
10
|
+
|
|
11
|
+
const TooltipContent = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
14
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
15
|
+
<TooltipPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
26
|
+
|
|
27
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|