@octanejs/shadcn 0.0.1
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/README.md +43 -0
- package/package.json +63 -0
- package/src/hooks/use-mobile.ts +23 -0
- package/src/index.ts +263 -0
- package/src/lib/types.ts +10 -0
- package/src/lib/utils.ts +8 -0
- package/src/styles/theme.css +104 -0
- package/src/ui/accordion.tsrx +72 -0
- package/src/ui/alert-dialog.tsrx +161 -0
- package/src/ui/alert.tsrx +69 -0
- package/src/ui/aspect-ratio.tsrx +10 -0
- package/src/ui/avatar.tsrx +79 -0
- package/src/ui/badge.tsrx +50 -0
- package/src/ui/breadcrumb.tsrx +89 -0
- package/src/ui/button.tsrx +71 -0
- package/src/ui/card.tsrx +75 -0
- package/src/ui/checkbox.tsrx +31 -0
- package/src/ui/collapsible.tsrx +21 -0
- package/src/ui/context-menu.tsrx +179 -0
- package/src/ui/dialog.tsrx +133 -0
- package/src/ui/dropdown-menu.tsrx +189 -0
- package/src/ui/empty.tsrx +86 -0
- package/src/ui/field.tsrx +188 -0
- package/src/ui/hover-card.tsrx +48 -0
- package/src/ui/input.tsrx +18 -0
- package/src/ui/item.tsrx +171 -0
- package/src/ui/kbd.tsrx +26 -0
- package/src/ui/label.tsrx +21 -0
- package/src/ui/menubar.tsrx +198 -0
- package/src/ui/native-select.tsrx +55 -0
- package/src/ui/navigation-menu.tsrx +116 -0
- package/src/ui/pagination.tsrx +113 -0
- package/src/ui/popover.tsrx +73 -0
- package/src/ui/progress.tsrx +27 -0
- package/src/ui/radio-group.tsrx +37 -0
- package/src/ui/scroll-area.tsrx +43 -0
- package/src/ui/select.tsrx +165 -0
- package/src/ui/separator.tsrx +30 -0
- package/src/ui/sheet.tsrx +114 -0
- package/src/ui/sidebar.tsrx +661 -0
- package/src/ui/skeleton.tsrx +14 -0
- package/src/ui/slider.tsrx +69 -0
- package/src/ui/sonner.tsrx +45 -0
- package/src/ui/spinner.tsrx +23 -0
- package/src/ui/switch.tsrx +30 -0
- package/src/ui/table.tsrx +80 -0
- package/src/ui/tabs.tsrx +69 -0
- package/src/ui/textarea.tsrx +20 -0
- package/src/ui/toggle-group.tsrx +100 -0
- package/src/ui/toggle.tsrx +47 -0
- package/src/ui/tooltip.tsrx +65 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Sheet — maintainer-supplied default-Tailwind flavor, class strings verbatim.
|
|
2
|
+
// Octane adaptations: "use client" dropped, lucide-react → @octanejs/lucide,
|
|
3
|
+
// radix-ui Dialog → @octanejs/radix. SheetContent composes Portal > Overlay +
|
|
4
|
+
// Content with createElement (radix's Portal slots its child, so children must
|
|
5
|
+
// be real element descriptors); consumer children flow through the ordinary
|
|
6
|
+
// props.children channel.
|
|
7
|
+
import { createElement, type OctaneNode } from 'octane';
|
|
8
|
+
import { Dialog as SheetPrimitive } from '@octanejs/radix';
|
|
9
|
+
import { XIcon } from '@octanejs/lucide';
|
|
10
|
+
|
|
11
|
+
import { cn } from '../lib/utils';
|
|
12
|
+
import { Button } from './button.tsrx';
|
|
13
|
+
|
|
14
|
+
type Props = { className?: string; children?: OctaneNode } & Record<string, unknown>;
|
|
15
|
+
|
|
16
|
+
export function Sheet(props: Record<string, unknown>) @{
|
|
17
|
+
<SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function SheetTrigger(props: Record<string, unknown>) @{
|
|
21
|
+
<SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function SheetClose(props: Record<string, unknown>) @{
|
|
25
|
+
<SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function SheetPortal(props: Record<string, unknown>) @{
|
|
29
|
+
<SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function SheetOverlay({ className, ...props }: Props) @{
|
|
33
|
+
<SheetPrimitive.Overlay
|
|
34
|
+
data-slot="sheet-overlay"
|
|
35
|
+
className={cn(
|
|
36
|
+
'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
|
|
37
|
+
className,
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SheetContentProps extends Props {
|
|
44
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
45
|
+
showCloseButton?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function SheetContent({
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
side = 'right',
|
|
52
|
+
showCloseButton = true,
|
|
53
|
+
...props
|
|
54
|
+
}: SheetContentProps) {
|
|
55
|
+
return createElement(
|
|
56
|
+
SheetPrimitive.Portal,
|
|
57
|
+
{ 'data-slot': 'sheet-portal' },
|
|
58
|
+
createElement(SheetOverlay, { key: 'overlay' }),
|
|
59
|
+
createElement(
|
|
60
|
+
SheetPrimitive.Content,
|
|
61
|
+
{
|
|
62
|
+
key: 'content',
|
|
63
|
+
'data-slot': 'sheet-content',
|
|
64
|
+
'data-side': side,
|
|
65
|
+
className: cn(
|
|
66
|
+
'fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10',
|
|
67
|
+
className,
|
|
68
|
+
),
|
|
69
|
+
...props,
|
|
70
|
+
},
|
|
71
|
+
children,
|
|
72
|
+
showCloseButton
|
|
73
|
+
? createElement(
|
|
74
|
+
SheetPrimitive.Close,
|
|
75
|
+
{ key: 'close', 'data-slot': 'sheet-close', asChild: true },
|
|
76
|
+
createElement(
|
|
77
|
+
Button,
|
|
78
|
+
{ variant: 'ghost', className: 'absolute top-3 right-3', size: 'icon-sm' },
|
|
79
|
+
createElement(XIcon, { key: 'icon' }),
|
|
80
|
+
createElement('span', { key: 'sr', className: 'sr-only' }, 'Close'),
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
: null,
|
|
84
|
+
),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function SheetHeader({ className, ...props }: Props) @{
|
|
89
|
+
<div data-slot="sheet-header" className={cn('flex flex-col gap-0.5 p-4', className)} {...props} />
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function SheetFooter({ className, ...props }: Props) @{
|
|
93
|
+
<div
|
|
94
|
+
data-slot="sheet-footer"
|
|
95
|
+
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function SheetTitle({ className, ...props }: Props) @{
|
|
101
|
+
<SheetPrimitive.Title
|
|
102
|
+
data-slot="sheet-title"
|
|
103
|
+
className={cn('cn-font-heading text-base font-medium text-foreground', className)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function SheetDescription({ className, ...props }: Props) @{
|
|
109
|
+
<SheetPrimitive.Description
|
|
110
|
+
data-slot="sheet-description"
|
|
111
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
}
|