itsi 0.2.16 → 0.2.17
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Cargo.lock +4 -2
- data/crates/itsi_acme/Cargo.toml +1 -1
- data/crates/itsi_scheduler/Cargo.toml +1 -1
- data/crates/itsi_server/Cargo.toml +3 -1
- data/crates/itsi_server/src/lib.rs +6 -1
- data/crates/itsi_server/src/ruby_types/itsi_body_proxy/mod.rs +2 -0
- data/crates/itsi_server/src/ruby_types/itsi_grpc_call.rs +4 -4
- data/crates/itsi_server/src/ruby_types/itsi_grpc_response_stream/mod.rs +14 -13
- data/crates/itsi_server/src/ruby_types/itsi_http_request.rs +64 -33
- data/crates/itsi_server/src/ruby_types/itsi_http_response.rs +151 -152
- data/crates/itsi_server/src/ruby_types/itsi_server/file_watcher.rs +6 -15
- data/crates/itsi_server/src/ruby_types/itsi_server/itsi_server_config.rs +26 -5
- data/crates/itsi_server/src/ruby_types/itsi_server.rs +1 -1
- data/crates/itsi_server/src/server/binds/listener.rs +45 -7
- data/crates/itsi_server/src/server/frame_stream.rs +142 -0
- data/crates/itsi_server/src/server/http_message_types.rs +142 -9
- data/crates/itsi_server/src/server/io_stream.rs +28 -5
- data/crates/itsi_server/src/server/lifecycle_event.rs +1 -1
- data/crates/itsi_server/src/server/middleware_stack/middlewares/auth_basic.rs +2 -3
- data/crates/itsi_server/src/server/middleware_stack/middlewares/compression.rs +8 -10
- data/crates/itsi_server/src/server/middleware_stack/middlewares/cors.rs +2 -3
- data/crates/itsi_server/src/server/middleware_stack/middlewares/csp.rs +3 -3
- data/crates/itsi_server/src/server/middleware_stack/middlewares/error_response/default_responses.rs +54 -56
- data/crates/itsi_server/src/server/middleware_stack/middlewares/error_response.rs +5 -7
- data/crates/itsi_server/src/server/middleware_stack/middlewares/etag.rs +5 -5
- data/crates/itsi_server/src/server/middleware_stack/middlewares/proxy.rs +7 -10
- data/crates/itsi_server/src/server/middleware_stack/middlewares/redirect.rs +2 -3
- data/crates/itsi_server/src/server/middleware_stack/middlewares/static_assets.rs +1 -2
- data/crates/itsi_server/src/server/middleware_stack/middlewares/static_response.rs +4 -6
- data/crates/itsi_server/src/server/mod.rs +1 -0
- data/crates/itsi_server/src/server/process_worker.rs +3 -4
- data/crates/itsi_server/src/server/serve_strategy/acceptor.rs +16 -12
- data/crates/itsi_server/src/server/serve_strategy/cluster_mode.rs +87 -31
- data/crates/itsi_server/src/server/serve_strategy/single_mode.rs +158 -142
- data/crates/itsi_server/src/server/signal.rs +37 -9
- data/crates/itsi_server/src/server/thread_worker.rs +84 -69
- data/crates/itsi_server/src/services/itsi_http_service.rs +43 -43
- data/crates/itsi_server/src/services/static_file_server.rs +28 -47
- data/docs/benchmark-dashboard/.gitignore +27 -0
- data/docs/benchmark-dashboard/app/api/benchmarks/route.ts +22 -0
- data/docs/benchmark-dashboard/app/globals.css +94 -0
- data/docs/benchmark-dashboard/app/layout.tsx +20 -0
- data/docs/benchmark-dashboard/app/page.tsx +252 -0
- data/docs/benchmark-dashboard/components/benchmark-dashboard.tsx +1663 -0
- data/docs/benchmark-dashboard/components/theme-provider.tsx +11 -0
- data/docs/benchmark-dashboard/components/ui/accordion.tsx +58 -0
- data/docs/benchmark-dashboard/components/ui/alert-dialog.tsx +141 -0
- data/docs/benchmark-dashboard/components/ui/alert.tsx +59 -0
- data/docs/benchmark-dashboard/components/ui/aspect-ratio.tsx +7 -0
- data/docs/benchmark-dashboard/components/ui/avatar.tsx +50 -0
- data/docs/benchmark-dashboard/components/ui/badge.tsx +36 -0
- data/docs/benchmark-dashboard/components/ui/breadcrumb.tsx +115 -0
- data/docs/benchmark-dashboard/components/ui/button.tsx +56 -0
- data/docs/benchmark-dashboard/components/ui/calendar.tsx +66 -0
- data/docs/benchmark-dashboard/components/ui/card.tsx +79 -0
- data/docs/benchmark-dashboard/components/ui/carousel.tsx +262 -0
- data/docs/benchmark-dashboard/components/ui/chart.tsx +365 -0
- data/docs/benchmark-dashboard/components/ui/checkbox.tsx +30 -0
- data/docs/benchmark-dashboard/components/ui/collapsible.tsx +11 -0
- data/docs/benchmark-dashboard/components/ui/command.tsx +153 -0
- data/docs/benchmark-dashboard/components/ui/context-menu.tsx +200 -0
- data/docs/benchmark-dashboard/components/ui/dialog.tsx +122 -0
- data/docs/benchmark-dashboard/components/ui/drawer.tsx +118 -0
- data/docs/benchmark-dashboard/components/ui/dropdown-menu.tsx +200 -0
- data/docs/benchmark-dashboard/components/ui/form.tsx +178 -0
- data/docs/benchmark-dashboard/components/ui/hover-card.tsx +29 -0
- data/docs/benchmark-dashboard/components/ui/input-otp.tsx +71 -0
- data/docs/benchmark-dashboard/components/ui/input.tsx +22 -0
- data/docs/benchmark-dashboard/components/ui/label.tsx +26 -0
- data/docs/benchmark-dashboard/components/ui/loading-spinner.tsx +12 -0
- data/docs/benchmark-dashboard/components/ui/menubar.tsx +236 -0
- data/docs/benchmark-dashboard/components/ui/navigation-menu.tsx +128 -0
- data/docs/benchmark-dashboard/components/ui/pagination.tsx +117 -0
- data/docs/benchmark-dashboard/components/ui/popover.tsx +31 -0
- data/docs/benchmark-dashboard/components/ui/progress.tsx +28 -0
- data/docs/benchmark-dashboard/components/ui/radio-group.tsx +44 -0
- data/docs/benchmark-dashboard/components/ui/resizable.tsx +45 -0
- data/docs/benchmark-dashboard/components/ui/scroll-area.tsx +48 -0
- data/docs/benchmark-dashboard/components/ui/select.tsx +160 -0
- data/docs/benchmark-dashboard/components/ui/separator.tsx +31 -0
- data/docs/benchmark-dashboard/components/ui/sheet.tsx +140 -0
- data/docs/benchmark-dashboard/components/ui/sidebar.tsx +763 -0
- data/docs/benchmark-dashboard/components/ui/skeleton.tsx +15 -0
- data/docs/benchmark-dashboard/components/ui/slider.tsx +28 -0
- data/docs/benchmark-dashboard/components/ui/sonner.tsx +31 -0
- data/docs/benchmark-dashboard/components/ui/switch.tsx +29 -0
- data/docs/benchmark-dashboard/components/ui/table.tsx +117 -0
- data/docs/benchmark-dashboard/components/ui/tabs.tsx +55 -0
- data/docs/benchmark-dashboard/components/ui/textarea.tsx +22 -0
- data/docs/benchmark-dashboard/components/ui/toast.tsx +129 -0
- data/docs/benchmark-dashboard/components/ui/toaster.tsx +35 -0
- data/docs/benchmark-dashboard/components/ui/toggle-group.tsx +61 -0
- data/docs/benchmark-dashboard/components/ui/toggle.tsx +45 -0
- data/docs/benchmark-dashboard/components/ui/tooltip.tsx +30 -0
- data/docs/benchmark-dashboard/components/ui/use-mobile.tsx +19 -0
- data/docs/benchmark-dashboard/components/ui/use-toast.ts +194 -0
- data/docs/benchmark-dashboard/components.json +21 -0
- data/docs/benchmark-dashboard/dist/benchmark-dashboard.css +1 -0
- data/docs/benchmark-dashboard/dist/benchmark-dashboard.iife.js +211 -0
- data/docs/benchmark-dashboard/dist/placeholder-logo.png +0 -0
- data/docs/benchmark-dashboard/dist/placeholder-logo.svg +1 -0
- data/docs/benchmark-dashboard/dist/placeholder-user.jpg +0 -0
- data/docs/benchmark-dashboard/dist/placeholder.jpg +0 -0
- data/docs/benchmark-dashboard/dist/placeholder.svg +1 -0
- data/docs/benchmark-dashboard/embed.tsx +13 -0
- data/docs/benchmark-dashboard/hooks/use-mobile.tsx +19 -0
- data/docs/benchmark-dashboard/hooks/use-toast.ts +194 -0
- data/docs/benchmark-dashboard/lib/benchmark-utils.ts +54 -0
- data/docs/benchmark-dashboard/lib/utils.ts +6 -0
- data/docs/benchmark-dashboard/next.config.mjs +14 -0
- data/docs/benchmark-dashboard/package-lock.json +5859 -0
- data/docs/benchmark-dashboard/package.json +72 -0
- data/docs/benchmark-dashboard/pnpm-lock.yaml +5 -0
- data/docs/benchmark-dashboard/postcss.config.mjs +8 -0
- data/docs/benchmark-dashboard/styles/globals.css +94 -0
- data/docs/benchmark-dashboard/tailwind.config.ts +96 -0
- data/docs/benchmark-dashboard/tsconfig.json +27 -0
- data/docs/benchmark-dashboard/vite.config.ts +24 -0
- data/docs/build.rb +52 -0
- data/docs/content/benchmarks/index.md +96 -0
- data/docs/content/getting_started/_index.md +76 -46
- data/docs/hugo.yaml +3 -0
- data/docs/static/results.json +1 -0
- data/docs/static/scripts/benchmark-dashboard.iife.js +211 -0
- data/docs/static/styles/benchmark-dashboard.css +1 -0
- data/gems/scheduler/Cargo.lock +1 -1
- data/gems/scheduler/lib/itsi/scheduler/version.rb +1 -1
- data/gems/server/Cargo.lock +3 -1
- data/gems/server/exe/itsi +6 -1
- data/gems/server/lib/itsi/http_request.rb +31 -39
- data/gems/server/lib/itsi/http_response.rb +5 -0
- data/gems/server/lib/itsi/rack_env_pool.rb +59 -0
- data/gems/server/lib/itsi/server/config/dsl.rb +5 -4
- data/gems/server/lib/itsi/server/config/middleware/proxy.rb +1 -1
- data/gems/server/lib/itsi/server/config/middleware/rackup_file.rb +2 -2
- data/gems/server/lib/itsi/server/config/options/auto_reload_config.rb +6 -2
- data/gems/server/lib/itsi/server/config/options/include.rb +5 -2
- data/gems/server/lib/itsi/server/config/options/pipeline_flush.md +16 -0
- data/gems/server/lib/itsi/server/config/options/pipeline_flush.rb +19 -0
- data/gems/server/lib/itsi/server/config/options/writev.md +25 -0
- data/gems/server/lib/itsi/server/config/options/writev.rb +19 -0
- data/gems/server/lib/itsi/server/config.rb +21 -8
- data/gems/server/lib/itsi/server/default_config/Itsi.rb +1 -4
- data/gems/server/lib/itsi/server/grpc/grpc_call.rb +2 -0
- data/gems/server/lib/itsi/server/grpc/grpc_interface.rb +2 -2
- data/gems/server/lib/itsi/server/rack/handler/itsi.rb +3 -1
- data/gems/server/lib/itsi/server/rack_interface.rb +17 -12
- data/gems/server/lib/itsi/server/scheduler_interface.rb +2 -0
- data/gems/server/lib/itsi/server/version.rb +1 -1
- data/gems/server/lib/itsi/server.rb +1 -0
- data/gems/server/lib/ruby_lsp/itsi/addon.rb +12 -13
- data/gems/server/test/helpers/test_helper.rb +12 -13
- data/gems/server/test/middleware/grpc/grpc.rb +13 -14
- data/gems/server/test/middleware/grpc/test_service_impl.rb +3 -3
- data/gems/server/test/middleware/proxy.rb +262 -268
- data/lib/itsi/version.rb +1 -1
- metadata +96 -6
- data/tasks.txt +0 -28
@@ -0,0 +1,160 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
5
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
6
|
+
|
7
|
+
import { cn } from "@/lib/utils"
|
8
|
+
|
9
|
+
const Select = SelectPrimitive.Root
|
10
|
+
|
11
|
+
const SelectGroup = SelectPrimitive.Group
|
12
|
+
|
13
|
+
const SelectValue = SelectPrimitive.Value
|
14
|
+
|
15
|
+
const SelectTrigger = React.forwardRef<
|
16
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
17
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
18
|
+
>(({ className, children, ...props }, ref) => (
|
19
|
+
<SelectPrimitive.Trigger
|
20
|
+
ref={ref}
|
21
|
+
className={cn(
|
22
|
+
"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",
|
23
|
+
className
|
24
|
+
)}
|
25
|
+
{...props}
|
26
|
+
>
|
27
|
+
{children}
|
28
|
+
<SelectPrimitive.Icon asChild>
|
29
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
30
|
+
</SelectPrimitive.Icon>
|
31
|
+
</SelectPrimitive.Trigger>
|
32
|
+
))
|
33
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
34
|
+
|
35
|
+
const SelectScrollUpButton = React.forwardRef<
|
36
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
37
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
38
|
+
>(({ className, ...props }, ref) => (
|
39
|
+
<SelectPrimitive.ScrollUpButton
|
40
|
+
ref={ref}
|
41
|
+
className={cn(
|
42
|
+
"flex cursor-default items-center justify-center py-1",
|
43
|
+
className
|
44
|
+
)}
|
45
|
+
{...props}
|
46
|
+
>
|
47
|
+
<ChevronUp className="h-4 w-4" />
|
48
|
+
</SelectPrimitive.ScrollUpButton>
|
49
|
+
))
|
50
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
51
|
+
|
52
|
+
const SelectScrollDownButton = React.forwardRef<
|
53
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
54
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
55
|
+
>(({ className, ...props }, ref) => (
|
56
|
+
<SelectPrimitive.ScrollDownButton
|
57
|
+
ref={ref}
|
58
|
+
className={cn(
|
59
|
+
"flex cursor-default items-center justify-center py-1",
|
60
|
+
className
|
61
|
+
)}
|
62
|
+
{...props}
|
63
|
+
>
|
64
|
+
<ChevronDown className="h-4 w-4" />
|
65
|
+
</SelectPrimitive.ScrollDownButton>
|
66
|
+
))
|
67
|
+
SelectScrollDownButton.displayName =
|
68
|
+
SelectPrimitive.ScrollDownButton.displayName
|
69
|
+
|
70
|
+
const SelectContent = React.forwardRef<
|
71
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
72
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
73
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
74
|
+
<SelectPrimitive.Portal>
|
75
|
+
<SelectPrimitive.Content
|
76
|
+
ref={ref}
|
77
|
+
className={cn(
|
78
|
+
"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",
|
79
|
+
position === "popper" &&
|
80
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
81
|
+
className
|
82
|
+
)}
|
83
|
+
position={position}
|
84
|
+
{...props}
|
85
|
+
>
|
86
|
+
<SelectScrollUpButton />
|
87
|
+
<SelectPrimitive.Viewport
|
88
|
+
className={cn(
|
89
|
+
"p-1",
|
90
|
+
position === "popper" &&
|
91
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
92
|
+
)}
|
93
|
+
>
|
94
|
+
{children}
|
95
|
+
</SelectPrimitive.Viewport>
|
96
|
+
<SelectScrollDownButton />
|
97
|
+
</SelectPrimitive.Content>
|
98
|
+
</SelectPrimitive.Portal>
|
99
|
+
))
|
100
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
101
|
+
|
102
|
+
const SelectLabel = React.forwardRef<
|
103
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
104
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
105
|
+
>(({ className, ...props }, ref) => (
|
106
|
+
<SelectPrimitive.Label
|
107
|
+
ref={ref}
|
108
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
109
|
+
{...props}
|
110
|
+
/>
|
111
|
+
))
|
112
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
113
|
+
|
114
|
+
const SelectItem = React.forwardRef<
|
115
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
116
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
117
|
+
>(({ className, children, ...props }, ref) => (
|
118
|
+
<SelectPrimitive.Item
|
119
|
+
ref={ref}
|
120
|
+
className={cn(
|
121
|
+
"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",
|
122
|
+
className
|
123
|
+
)}
|
124
|
+
{...props}
|
125
|
+
>
|
126
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
127
|
+
<SelectPrimitive.ItemIndicator>
|
128
|
+
<Check className="h-4 w-4" />
|
129
|
+
</SelectPrimitive.ItemIndicator>
|
130
|
+
</span>
|
131
|
+
|
132
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
133
|
+
</SelectPrimitive.Item>
|
134
|
+
))
|
135
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
136
|
+
|
137
|
+
const SelectSeparator = React.forwardRef<
|
138
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
139
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
140
|
+
>(({ className, ...props }, ref) => (
|
141
|
+
<SelectPrimitive.Separator
|
142
|
+
ref={ref}
|
143
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
144
|
+
{...props}
|
145
|
+
/>
|
146
|
+
))
|
147
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
148
|
+
|
149
|
+
export {
|
150
|
+
Select,
|
151
|
+
SelectGroup,
|
152
|
+
SelectValue,
|
153
|
+
SelectTrigger,
|
154
|
+
SelectContent,
|
155
|
+
SelectLabel,
|
156
|
+
SelectItem,
|
157
|
+
SelectSeparator,
|
158
|
+
SelectScrollUpButton,
|
159
|
+
SelectScrollDownButton,
|
160
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
5
|
+
|
6
|
+
import { cn } from "@/lib/utils"
|
7
|
+
|
8
|
+
const Separator = React.forwardRef<
|
9
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
10
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
11
|
+
>(
|
12
|
+
(
|
13
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
14
|
+
ref
|
15
|
+
) => (
|
16
|
+
<SeparatorPrimitive.Root
|
17
|
+
ref={ref}
|
18
|
+
decorative={decorative}
|
19
|
+
orientation={orientation}
|
20
|
+
className={cn(
|
21
|
+
"shrink-0 bg-border",
|
22
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
23
|
+
className
|
24
|
+
)}
|
25
|
+
{...props}
|
26
|
+
/>
|
27
|
+
)
|
28
|
+
)
|
29
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
30
|
+
|
31
|
+
export { Separator }
|
@@ -0,0 +1,140 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
6
|
+
import { X } from "lucide-react"
|
7
|
+
|
8
|
+
import { cn } from "@/lib/utils"
|
9
|
+
|
10
|
+
const Sheet = SheetPrimitive.Root
|
11
|
+
|
12
|
+
const SheetTrigger = SheetPrimitive.Trigger
|
13
|
+
|
14
|
+
const SheetClose = SheetPrimitive.Close
|
15
|
+
|
16
|
+
const SheetPortal = SheetPrimitive.Portal
|
17
|
+
|
18
|
+
const SheetOverlay = React.forwardRef<
|
19
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
20
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
21
|
+
>(({ className, ...props }, ref) => (
|
22
|
+
<SheetPrimitive.Overlay
|
23
|
+
className={cn(
|
24
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
25
|
+
className
|
26
|
+
)}
|
27
|
+
{...props}
|
28
|
+
ref={ref}
|
29
|
+
/>
|
30
|
+
))
|
31
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
|
32
|
+
|
33
|
+
const sheetVariants = cva(
|
34
|
+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
35
|
+
{
|
36
|
+
variants: {
|
37
|
+
side: {
|
38
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
39
|
+
bottom:
|
40
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
41
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
42
|
+
right:
|
43
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
44
|
+
},
|
45
|
+
},
|
46
|
+
defaultVariants: {
|
47
|
+
side: "right",
|
48
|
+
},
|
49
|
+
}
|
50
|
+
)
|
51
|
+
|
52
|
+
interface SheetContentProps
|
53
|
+
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
54
|
+
VariantProps<typeof sheetVariants> {}
|
55
|
+
|
56
|
+
const SheetContent = React.forwardRef<
|
57
|
+
React.ElementRef<typeof SheetPrimitive.Content>,
|
58
|
+
SheetContentProps
|
59
|
+
>(({ side = "right", className, children, ...props }, ref) => (
|
60
|
+
<SheetPortal>
|
61
|
+
<SheetOverlay />
|
62
|
+
<SheetPrimitive.Content
|
63
|
+
ref={ref}
|
64
|
+
className={cn(sheetVariants({ side }), className)}
|
65
|
+
{...props}
|
66
|
+
>
|
67
|
+
{children}
|
68
|
+
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
69
|
+
<X className="h-4 w-4" />
|
70
|
+
<span className="sr-only">Close</span>
|
71
|
+
</SheetPrimitive.Close>
|
72
|
+
</SheetPrimitive.Content>
|
73
|
+
</SheetPortal>
|
74
|
+
))
|
75
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName
|
76
|
+
|
77
|
+
const SheetHeader = ({
|
78
|
+
className,
|
79
|
+
...props
|
80
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
81
|
+
<div
|
82
|
+
className={cn(
|
83
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
84
|
+
className
|
85
|
+
)}
|
86
|
+
{...props}
|
87
|
+
/>
|
88
|
+
)
|
89
|
+
SheetHeader.displayName = "SheetHeader"
|
90
|
+
|
91
|
+
const SheetFooter = ({
|
92
|
+
className,
|
93
|
+
...props
|
94
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
95
|
+
<div
|
96
|
+
className={cn(
|
97
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
98
|
+
className
|
99
|
+
)}
|
100
|
+
{...props}
|
101
|
+
/>
|
102
|
+
)
|
103
|
+
SheetFooter.displayName = "SheetFooter"
|
104
|
+
|
105
|
+
const SheetTitle = React.forwardRef<
|
106
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
107
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
108
|
+
>(({ className, ...props }, ref) => (
|
109
|
+
<SheetPrimitive.Title
|
110
|
+
ref={ref}
|
111
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
112
|
+
{...props}
|
113
|
+
/>
|
114
|
+
))
|
115
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName
|
116
|
+
|
117
|
+
const SheetDescription = React.forwardRef<
|
118
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
119
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
120
|
+
>(({ className, ...props }, ref) => (
|
121
|
+
<SheetPrimitive.Description
|
122
|
+
ref={ref}
|
123
|
+
className={cn("text-sm text-muted-foreground", className)}
|
124
|
+
{...props}
|
125
|
+
/>
|
126
|
+
))
|
127
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName
|
128
|
+
|
129
|
+
export {
|
130
|
+
Sheet,
|
131
|
+
SheetPortal,
|
132
|
+
SheetOverlay,
|
133
|
+
SheetTrigger,
|
134
|
+
SheetClose,
|
135
|
+
SheetContent,
|
136
|
+
SheetHeader,
|
137
|
+
SheetFooter,
|
138
|
+
SheetTitle,
|
139
|
+
SheetDescription,
|
140
|
+
}
|