@mostra/kit 0.0.0-stage → 0.19.0
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/README.md +43 -2
- package/css/kit.css +59 -0
- package/css/shadcn.css +638 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +60 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +112 -0
- package/dist/layout.js.map +1 -0
- package/dist/questionnaire.d.ts +100 -0
- package/dist/questionnaire.d.ts.map +1 -0
- package/dist/questionnaire.js +632 -0
- package/dist/questionnaire.js.map +1 -0
- package/package.json +120 -3
- package/registry/LICENSE.md +21 -0
- package/registry/base/accordion.json +19 -0
- package/registry/base/alert-dialog.json +21 -0
- package/registry/base/alert.json +18 -0
- package/registry/base/aspect-ratio.json +17 -0
- package/registry/base/attachment.json +22 -0
- package/registry/base/avatar.json +18 -0
- package/registry/base/badge.json +19 -0
- package/registry/base/breadcrumb.json +19 -0
- package/registry/base/bubble.json +19 -0
- package/registry/base/button-group.json +22 -0
- package/registry/base/button.json +19 -0
- package/registry/base/calendar.json +22 -0
- package/registry/base/card.json +17 -0
- package/registry/base/carousel.json +22 -0
- package/registry/base/chart.json +21 -0
- package/registry/base/checkbox.json +19 -0
- package/registry/base/code-block.json +23 -0
- package/registry/base/collapsible.json +17 -0
- package/registry/base/combobox.json +23 -0
- package/registry/base/command.json +23 -0
- package/registry/base/components/mostra/layout.tsx +221 -0
- package/registry/base/components/mostra/questionnaire.tsx +1005 -0
- package/registry/base/components/ui/accordion.tsx +71 -0
- package/registry/base/components/ui/alert-dialog.tsx +187 -0
- package/registry/base/components/ui/alert.tsx +75 -0
- package/registry/base/components/ui/aspect-ratio.tsx +22 -0
- package/registry/base/components/ui/attachment.tsx +207 -0
- package/registry/base/components/ui/avatar.tsx +108 -0
- package/registry/base/components/ui/badge.tsx +54 -0
- package/registry/base/components/ui/breadcrumb.tsx +124 -0
- package/registry/base/components/ui/bubble.tsx +127 -0
- package/registry/base/components/ui/button-group.tsx +87 -0
- package/registry/base/components/ui/button.tsx +57 -0
- package/registry/base/components/ui/calendar.tsx +221 -0
- package/registry/base/components/ui/card.tsx +102 -0
- package/registry/base/components/ui/carousel.tsx +242 -0
- package/registry/base/components/ui/chart.tsx +372 -0
- package/registry/base/components/ui/checkbox.tsx +28 -0
- package/registry/base/components/ui/code-block.tsx +249 -0
- package/registry/base/components/ui/collapsible.tsx +21 -0
- package/registry/base/components/ui/combobox.tsx +297 -0
- package/registry/base/components/ui/command.tsx +196 -0
- package/registry/base/components/ui/context-menu.tsx +270 -0
- package/registry/base/components/ui/dialog.tsx +160 -0
- package/registry/base/components/ui/direction.tsx +6 -0
- package/registry/base/components/ui/drawer.tsx +227 -0
- package/registry/base/components/ui/dropdown-menu.tsx +267 -0
- package/registry/base/components/ui/empty.tsx +103 -0
- package/registry/base/components/ui/field.tsx +238 -0
- package/registry/base/components/ui/hover-card.tsx +50 -0
- package/registry/base/components/ui/input-group.tsx +158 -0
- package/registry/base/components/ui/input-otp.tsx +86 -0
- package/registry/base/components/ui/input.tsx +19 -0
- package/registry/base/components/ui/item.tsx +201 -0
- package/registry/base/components/ui/kbd.tsx +26 -0
- package/registry/base/components/ui/label.tsx +19 -0
- package/registry/base/components/ui/marker.tsx +70 -0
- package/registry/base/components/ui/menubar.tsx +280 -0
- package/registry/base/components/ui/message-scroller.tsx +131 -0
- package/registry/base/components/ui/message.tsx +91 -0
- package/registry/base/components/ui/native-select.tsx +60 -0
- package/registry/base/components/ui/navigation-menu.tsx +167 -0
- package/registry/base/components/ui/pagination.tsx +130 -0
- package/registry/base/components/ui/popover.tsx +89 -0
- package/registry/base/components/ui/progress.tsx +82 -0
- package/registry/base/components/ui/questionnaire.tsx +324 -0
- package/registry/base/components/ui/radio-group.tsx +37 -0
- package/registry/base/components/ui/resizable.tsx +49 -0
- package/registry/base/components/ui/scroll-area.tsx +53 -0
- package/registry/base/components/ui/select.tsx +200 -0
- package/registry/base/components/ui/separator.tsx +24 -0
- package/registry/base/components/ui/sheet.tsx +138 -0
- package/registry/base/components/ui/sidebar.tsx +723 -0
- package/registry/base/components/ui/skeleton.tsx +13 -0
- package/registry/base/components/ui/slider.tsx +51 -0
- package/registry/base/components/ui/sonner.tsx +65 -0
- package/registry/base/components/ui/spinner.tsx +10 -0
- package/registry/base/components/ui/switch.tsx +31 -0
- package/registry/base/components/ui/table.tsx +116 -0
- package/registry/base/components/ui/tabs.tsx +85 -0
- package/registry/base/components/ui/textarea.tsx +17 -0
- package/registry/base/components/ui/toast.tsx +234 -0
- package/registry/base/components/ui/toggle-group.tsx +89 -0
- package/registry/base/components/ui/toggle.tsx +44 -0
- package/registry/base/components/ui/tooltip.tsx +65 -0
- package/registry/base/components/ui/trace.tsx +162 -0
- package/registry/base/context-menu.json +19 -0
- package/registry/base/dialog.json +22 -0
- package/registry/base/direction.json +17 -0
- package/registry/base/drawer.json +18 -0
- package/registry/base/dropdown-menu.json +19 -0
- package/registry/base/empty.json +18 -0
- package/registry/base/field.json +22 -0
- package/registry/base/hooks/use-highlighted-code.ts +75 -0
- package/registry/base/hooks/use-mobile.ts +19 -0
- package/registry/base/hover-card.json +18 -0
- package/registry/base/input-group.json +23 -0
- package/registry/base/input-otp.json +19 -0
- package/registry/base/input.json +18 -0
- package/registry/base/item.json +22 -0
- package/registry/base/kbd.json +17 -0
- package/registry/base/label.json +17 -0
- package/registry/base/lib/highlighter.tsx +124 -0
- package/registry/base/lib/utils.ts +1 -0
- package/registry/base/marker.json +19 -0
- package/registry/base/menubar.json +22 -0
- package/registry/base/message-scroller.json +22 -0
- package/registry/base/message.json +17 -0
- package/registry/base/mostra-layout.json +20 -0
- package/registry/base/mostra-questionnaire.json +22 -0
- package/registry/base/native-select.json +18 -0
- package/registry/base/navigation-menu.json +20 -0
- package/registry/base/pagination.json +21 -0
- package/registry/base/popover.json +18 -0
- package/registry/base/progress.json +18 -0
- package/registry/base/questionnaire.json +22 -0
- package/registry/base/radio-group.json +18 -0
- package/registry/base/registry.json +287 -0
- package/registry/base/resizable.json +18 -0
- package/registry/base/scroll-area.json +18 -0
- package/registry/base/select.json +19 -0
- package/registry/base/separator.json +18 -0
- package/registry/base/sheet.json +22 -0
- package/registry/base/sidebar.json +29 -0
- package/registry/base/skeleton.json +17 -0
- package/registry/base/slider.json +18 -0
- package/registry/base/sonner.json +18 -0
- package/registry/base/spinner.json +18 -0
- package/registry/base/switch.json +18 -0
- package/registry/base/table.json +17 -0
- package/registry/base/tabs.json +19 -0
- package/registry/base/textarea.json +17 -0
- package/registry/base/toast.json +22 -0
- package/registry/base/toggle-group.json +22 -0
- package/registry/base/toggle.json +19 -0
- package/registry/base/tooltip.json +18 -0
- package/registry/base/trace.json +21 -0
- package/registry/base/use-highlighted-code.json +21 -0
- package/registry/base/use-mobile.json +14 -0
- package/registry/base/utils.json +17 -0
- package/registry/radix/accordion.json +19 -0
- package/registry/radix/alert-dialog.json +21 -0
- package/registry/radix/alert.json +18 -0
- package/registry/radix/aspect-ratio.json +17 -0
- package/registry/radix/attachment.json +22 -0
- package/registry/radix/avatar.json +18 -0
- package/registry/radix/badge.json +19 -0
- package/registry/radix/breadcrumb.json +19 -0
- package/registry/radix/bubble.json +19 -0
- package/registry/radix/button-group.json +22 -0
- package/registry/radix/button.json +19 -0
- package/registry/radix/calendar.json +22 -0
- package/registry/radix/card.json +17 -0
- package/registry/radix/carousel.json +22 -0
- package/registry/radix/chart.json +18 -0
- package/registry/radix/checkbox.json +19 -0
- package/registry/radix/code-block.json +23 -0
- package/registry/radix/collapsible.json +17 -0
- package/registry/radix/combobox.json +23 -0
- package/registry/radix/command.json +23 -0
- package/registry/radix/components/mostra/layout.tsx +221 -0
- package/registry/radix/components/mostra/questionnaire.tsx +1005 -0
- package/registry/radix/components/ui/accordion.tsx +80 -0
- package/registry/radix/components/ui/alert-dialog.tsx +199 -0
- package/registry/radix/components/ui/alert.tsx +75 -0
- package/registry/radix/components/ui/aspect-ratio.tsx +11 -0
- package/registry/radix/components/ui/attachment.tsx +204 -0
- package/registry/radix/components/ui/avatar.tsx +111 -0
- package/registry/radix/components/ui/badge.tsx +51 -0
- package/registry/radix/components/ui/breadcrumb.tsx +121 -0
- package/registry/radix/components/ui/bubble.tsx +124 -0
- package/registry/radix/components/ui/button-group.tsx +83 -0
- package/registry/radix/components/ui/button.tsx +66 -0
- package/registry/radix/components/ui/calendar.tsx +222 -0
- package/registry/radix/components/ui/card.tsx +102 -0
- package/registry/radix/components/ui/carousel.tsx +242 -0
- package/registry/radix/components/ui/chart.tsx +372 -0
- package/registry/radix/components/ui/checkbox.tsx +32 -0
- package/registry/radix/components/ui/code-block.tsx +249 -0
- package/registry/radix/components/ui/collapsible.tsx +33 -0
- package/registry/radix/components/ui/combobox.tsx +299 -0
- package/registry/radix/components/ui/command.tsx +195 -0
- package/registry/radix/components/ui/context-menu.tsx +262 -0
- package/registry/radix/components/ui/dialog.tsx +168 -0
- package/registry/radix/components/ui/direction.tsx +22 -0
- package/registry/radix/components/ui/drawer.tsx +133 -0
- package/registry/radix/components/ui/dropdown-menu.tsx +268 -0
- package/registry/radix/components/ui/empty.tsx +103 -0
- package/registry/radix/components/ui/field.tsx +238 -0
- package/registry/radix/components/ui/hover-card.tsx +43 -0
- package/registry/radix/components/ui/input-group.tsx +156 -0
- package/registry/radix/components/ui/input-otp.tsx +86 -0
- package/registry/radix/components/ui/input.tsx +18 -0
- package/registry/radix/components/ui/item.tsx +196 -0
- package/registry/radix/components/ui/kbd.tsx +26 -0
- package/registry/radix/components/ui/label.tsx +23 -0
- package/registry/radix/components/ui/marker.tsx +68 -0
- package/registry/radix/components/ui/menubar.tsx +279 -0
- package/registry/radix/components/ui/message-scroller.tsx +131 -0
- package/registry/radix/components/ui/message.tsx +91 -0
- package/registry/radix/components/ui/native-select.tsx +60 -0
- package/registry/radix/components/ui/navigation-menu.tsx +163 -0
- package/registry/radix/components/ui/pagination.tsx +129 -0
- package/registry/radix/components/ui/popover.tsx +88 -0
- package/registry/radix/components/ui/progress.tsx +30 -0
- package/registry/radix/components/ui/questionnaire.tsx +324 -0
- package/registry/radix/components/ui/radio-group.tsx +43 -0
- package/registry/radix/components/ui/resizable.tsx +49 -0
- package/registry/radix/components/ui/scroll-area.tsx +54 -0
- package/registry/radix/components/ui/select.tsx +191 -0
- package/registry/radix/components/ui/separator.tsx +27 -0
- package/registry/radix/components/ui/sheet.tsx +147 -0
- package/registry/radix/components/ui/sidebar.tsx +702 -0
- package/registry/radix/components/ui/skeleton.tsx +13 -0
- package/registry/radix/components/ui/slider.tsx +62 -0
- package/registry/radix/components/ui/sonner.tsx +65 -0
- package/registry/radix/components/ui/spinner.tsx +10 -0
- package/registry/radix/components/ui/switch.tsx +32 -0
- package/registry/radix/components/ui/table.tsx +116 -0
- package/registry/radix/components/ui/tabs.tsx +129 -0
- package/registry/radix/components/ui/textarea.tsx +17 -0
- package/registry/radix/components/ui/toggle-group.tsx +89 -0
- package/registry/radix/components/ui/toggle.tsx +46 -0
- package/registry/radix/components/ui/tooltip.tsx +56 -0
- package/registry/radix/components/ui/trace.tsx +162 -0
- package/registry/radix/context-menu.json +19 -0
- package/registry/radix/dialog.json +22 -0
- package/registry/radix/direction.json +17 -0
- package/registry/radix/drawer.json +18 -0
- package/registry/radix/dropdown-menu.json +19 -0
- package/registry/radix/empty.json +18 -0
- package/registry/radix/field.json +22 -0
- package/registry/radix/hooks/use-highlighted-code.ts +75 -0
- package/registry/radix/hooks/use-mobile.ts +19 -0
- package/registry/radix/hover-card.json +18 -0
- package/registry/radix/input-group.json +23 -0
- package/registry/radix/input-otp.json +19 -0
- package/registry/radix/input.json +17 -0
- package/registry/radix/item.json +22 -0
- package/registry/radix/kbd.json +17 -0
- package/registry/radix/label.json +18 -0
- package/registry/radix/lib/highlighter.tsx +124 -0
- package/registry/radix/lib/utils.ts +1 -0
- package/registry/radix/marker.json +19 -0
- package/registry/radix/menubar.json +19 -0
- package/registry/radix/message-scroller.json +22 -0
- package/registry/radix/message.json +17 -0
- package/registry/radix/mostra-layout.json +20 -0
- package/registry/radix/mostra-questionnaire.json +22 -0
- package/registry/radix/native-select.json +18 -0
- package/registry/radix/navigation-menu.json +20 -0
- package/registry/radix/pagination.json +21 -0
- package/registry/radix/popover.json +18 -0
- package/registry/radix/progress.json +18 -0
- package/registry/radix/questionnaire.json +22 -0
- package/registry/radix/radio-group.json +18 -0
- package/registry/radix/registry.json +283 -0
- package/registry/radix/resizable.json +18 -0
- package/registry/radix/scroll-area.json +18 -0
- package/registry/radix/select.json +19 -0
- package/registry/radix/separator.json +18 -0
- package/registry/radix/sheet.json +22 -0
- package/registry/radix/sidebar.json +29 -0
- package/registry/radix/skeleton.json +17 -0
- package/registry/radix/slider.json +18 -0
- package/registry/radix/sonner.json +18 -0
- package/registry/radix/spinner.json +18 -0
- package/registry/radix/switch.json +18 -0
- package/registry/radix/table.json +17 -0
- package/registry/radix/tabs.json +19 -0
- package/registry/radix/textarea.json +17 -0
- package/registry/radix/toggle-group.json +22 -0
- package/registry/radix/toggle.json +19 -0
- package/registry/radix/tooltip.json +18 -0
- package/registry/radix/trace.json +21 -0
- package/registry/radix/use-highlighted-code.json +21 -0
- package/registry/radix/use-mobile.json +14 -0
- package/registry/radix/utils.json +17 -0
- package/src/index.ts +15 -0
- package/src/layout.tsx +221 -0
- package/src/questionnaire.tsx +1005 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "cn"
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="skeleton"
|
|
7
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton }
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Slider as SliderPrimitive } from "@base-ui/react/slider"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Slider({
|
|
5
|
+
className,
|
|
6
|
+
defaultValue,
|
|
7
|
+
value,
|
|
8
|
+
min = 0,
|
|
9
|
+
max = 100,
|
|
10
|
+
...props
|
|
11
|
+
}: SliderPrimitive.Root.Props) {
|
|
12
|
+
const _values = Array.isArray(value)
|
|
13
|
+
? value
|
|
14
|
+
: Array.isArray(defaultValue)
|
|
15
|
+
? defaultValue
|
|
16
|
+
: [min, max]
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<SliderPrimitive.Root
|
|
20
|
+
className={cn("data-horizontal:w-full data-vertical:h-full", className)}
|
|
21
|
+
data-slot="slider"
|
|
22
|
+
defaultValue={defaultValue}
|
|
23
|
+
value={value}
|
|
24
|
+
min={min}
|
|
25
|
+
max={max}
|
|
26
|
+
thumbAlignment="edge"
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
|
|
30
|
+
<SliderPrimitive.Track
|
|
31
|
+
data-slot="slider-track"
|
|
32
|
+
className="relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
|
|
33
|
+
>
|
|
34
|
+
<SliderPrimitive.Indicator
|
|
35
|
+
data-slot="slider-range"
|
|
36
|
+
className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
37
|
+
/>
|
|
38
|
+
</SliderPrimitive.Track>
|
|
39
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
40
|
+
<SliderPrimitive.Thumb
|
|
41
|
+
data-slot="slider-thumb"
|
|
42
|
+
key={index}
|
|
43
|
+
className="relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</SliderPrimitive.Control>
|
|
47
|
+
</SliderPrimitive.Root>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { Slider }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
|
4
|
+
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import * as React from "react"
|
|
7
|
+
|
|
8
|
+
/** The page's appearance as Mostra sets it on `<html data-appearance>`, else the device's. */
|
|
9
|
+
function useAppearance(): ToasterProps["theme"] {
|
|
10
|
+
const read = (): ToasterProps["theme"] => {
|
|
11
|
+
const value = typeof document === "undefined" ? undefined : document.documentElement.dataset["appearance"]
|
|
12
|
+
return value === "light" || value === "dark" ? value : "system"
|
|
13
|
+
}
|
|
14
|
+
const [appearance, setAppearance] = React.useState(read)
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
const observer = new MutationObserver(() => setAppearance(read()))
|
|
17
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-appearance"] })
|
|
18
|
+
return () => observer.disconnect()
|
|
19
|
+
}, [])
|
|
20
|
+
return appearance
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Toaster = ({ ...props }: ToasterProps) => {
|
|
24
|
+
const theme = useAppearance()
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Sonner
|
|
28
|
+
theme={theme}
|
|
29
|
+
className="toaster group"
|
|
30
|
+
icons={{
|
|
31
|
+
success: (
|
|
32
|
+
<CircleCheckIcon className="size-4" />
|
|
33
|
+
),
|
|
34
|
+
info: (
|
|
35
|
+
<InfoIcon className="size-4" />
|
|
36
|
+
),
|
|
37
|
+
warning: (
|
|
38
|
+
<TriangleAlertIcon className="size-4" />
|
|
39
|
+
),
|
|
40
|
+
error: (
|
|
41
|
+
<OctagonXIcon className="size-4" />
|
|
42
|
+
),
|
|
43
|
+
loading: (
|
|
44
|
+
<Loader2Icon className="size-4 animate-spin" />
|
|
45
|
+
),
|
|
46
|
+
}}
|
|
47
|
+
style={
|
|
48
|
+
{
|
|
49
|
+
"--normal-bg": "var(--popover)",
|
|
50
|
+
"--normal-text": "var(--popover-foreground)",
|
|
51
|
+
"--normal-border": "var(--border)",
|
|
52
|
+
"--border-radius": "var(--radius)",
|
|
53
|
+
} as React.CSSProperties
|
|
54
|
+
}
|
|
55
|
+
toastOptions={{
|
|
56
|
+
classNames: {
|
|
57
|
+
toast: "cn-toast",
|
|
58
|
+
},
|
|
59
|
+
}}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { Toaster }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cn } from "cn"
|
|
2
|
+
import { Loader2Icon } from "lucide-react"
|
|
3
|
+
|
|
4
|
+
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
|
5
|
+
return (
|
|
6
|
+
<Loader2Icon data-slot="spinner" role="status" aria-label="Loading" className={cn("size-4 animate-spin", className)} {...props} />
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Spinner }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
function Switch({
|
|
7
|
+
className,
|
|
8
|
+
size = "default",
|
|
9
|
+
...props
|
|
10
|
+
}: SwitchPrimitive.Root.Props & {
|
|
11
|
+
size?: "sm" | "default"
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<SwitchPrimitive.Root
|
|
15
|
+
data-slot="switch"
|
|
16
|
+
data-size={size}
|
|
17
|
+
className={cn(
|
|
18
|
+
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
<SwitchPrimitive.Thumb
|
|
24
|
+
data-slot="switch-thumb"
|
|
25
|
+
className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
26
|
+
/>
|
|
27
|
+
</SwitchPrimitive.Root>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Switch }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
data-slot="table-container"
|
|
10
|
+
tabIndex={0}
|
|
11
|
+
className="relative w-full overflow-x-auto"
|
|
12
|
+
>
|
|
13
|
+
<table
|
|
14
|
+
data-slot="table"
|
|
15
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
23
|
+
return (
|
|
24
|
+
<thead
|
|
25
|
+
data-slot="table-header"
|
|
26
|
+
className={cn("[&_tr]:border-b", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
|
33
|
+
return (
|
|
34
|
+
<tbody
|
|
35
|
+
data-slot="table-body"
|
|
36
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
43
|
+
return (
|
|
44
|
+
<tfoot
|
|
45
|
+
data-slot="table-footer"
|
|
46
|
+
className={cn(
|
|
47
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
56
|
+
return (
|
|
57
|
+
<tr
|
|
58
|
+
data-slot="table-row"
|
|
59
|
+
className={cn(
|
|
60
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
69
|
+
return (
|
|
70
|
+
<th
|
|
71
|
+
data-slot="table-head"
|
|
72
|
+
className={cn(
|
|
73
|
+
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
82
|
+
return (
|
|
83
|
+
<td
|
|
84
|
+
data-slot="table-cell"
|
|
85
|
+
className={cn(
|
|
86
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
87
|
+
className
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function TableCaption({
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: React.ComponentProps<"caption">) {
|
|
98
|
+
return (
|
|
99
|
+
<caption
|
|
100
|
+
data-slot="table-caption"
|
|
101
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
Table,
|
|
109
|
+
TableHeader,
|
|
110
|
+
TableBody,
|
|
111
|
+
TableFooter,
|
|
112
|
+
TableHead,
|
|
113
|
+
TableRow,
|
|
114
|
+
TableCell,
|
|
115
|
+
TableCaption,
|
|
116
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
|
|
7
|
+
function Tabs({ className, orientation = "horizontal", ...props }: TabsPrimitive.Root.Props) {
|
|
8
|
+
return (
|
|
9
|
+
<TabsPrimitive.Root
|
|
10
|
+
data-slot="tabs"
|
|
11
|
+
data-orientation={orientation}
|
|
12
|
+
className={cn("group/tabs flex gap-3 data-horizontal:flex-col", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const tabsListVariants = cva(
|
|
19
|
+
"group/tabs-list relative isolate inline-flex w-fit items-center text-muted-foreground group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col",
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
default:
|
|
24
|
+
"rounded-(--tabs-radius) bg-(--tabs-track-bg) p-(--tabs-track-pad) shadow-(--tabs-track-shadow)",
|
|
25
|
+
line: "gap-1 shadow-[inset_0_-1px_0_var(--border)]",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
function TabsList({
|
|
35
|
+
className,
|
|
36
|
+
variant = "default",
|
|
37
|
+
children,
|
|
38
|
+
...props
|
|
39
|
+
}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
|
|
40
|
+
return (
|
|
41
|
+
<TabsPrimitive.List
|
|
42
|
+
data-slot="tabs-list"
|
|
43
|
+
data-variant={variant}
|
|
44
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
<TabsPrimitive.Indicator
|
|
49
|
+
data-slot="tabs-indicator"
|
|
50
|
+
className={cn(
|
|
51
|
+
"absolute -z-10 transition-[left,top,width,height] duration-(--state-ms) ease-(--ease-out) motion-reduce:transition-none",
|
|
52
|
+
"top-[calc(var(--active-tab-top)+var(--active-tab-height)-var(--tabs-indicator-h))] left-(--active-tab-left) h-(--tabs-indicator-h) w-(--active-tab-width) [--tabs-indicator-h:calc(var(--tabs-indicator-fill)*var(--active-tab-height)+(1-var(--tabs-indicator-fill))*var(--tabs-indicator-line))]",
|
|
53
|
+
"rounded-(--tabs-indicator-radius) bg-(--tabs-indicator-bg) shadow-(--tabs-indicator-shadow)",
|
|
54
|
+
"group-data-[variant=line]/tabs-list:top-[calc(var(--active-tab-top)+var(--active-tab-height)-2px)] group-data-[variant=line]/tabs-list:h-0.5 group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:bg-foreground group-data-[variant=line]/tabs-list:shadow-none",
|
|
55
|
+
)}
|
|
56
|
+
/>
|
|
57
|
+
</TabsPrimitive.List>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
62
|
+
return (
|
|
63
|
+
<TabsPrimitive.Tab
|
|
64
|
+
data-slot="tabs-trigger"
|
|
65
|
+
className={cn(
|
|
66
|
+
"relative inline-flex h-(--control-h-sm) flex-1 items-center justify-center gap-1.5 rounded-(--tabs-indicator-radius) px-4 text-[0.9375rem] font-medium whitespace-nowrap text-muted-foreground transition-colors duration-(--state-ms) outline-none group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
67
|
+
"data-active:text-(--tabs-active-fg) group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:px-1 group-data-[variant=line]/tabs-list:data-active:text-foreground",
|
|
68
|
+
className,
|
|
69
|
+
)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
|
|
76
|
+
return (
|
|
77
|
+
<TabsPrimitive.Panel
|
|
78
|
+
data-slot="tabs-content"
|
|
79
|
+
className={cn("flex-1 text-sm outline-none", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
5
|
+
return (
|
|
6
|
+
<textarea
|
|
7
|
+
data-slot="textarea"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex field-sizing-content min-h-24 w-full rounded-control border border-input bg-(--field) px-3.5 py-2 text-base transition-[border-color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 shadow-control duration-(--state-ms)",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Textarea }
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Toast as ToastPrimitive } from "@base-ui/react/toast"
|
|
5
|
+
import { cn } from "cn"
|
|
6
|
+
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
import { XIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
|
9
|
+
|
|
10
|
+
const toast = ToastPrimitive.createToastManager()
|
|
11
|
+
|
|
12
|
+
function ToastProvider({ ...props }: ToastPrimitive.Provider.Props) {
|
|
13
|
+
return <ToastPrimitive.Provider {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ToastPortal({ ...props }: ToastPrimitive.Portal.Props) {
|
|
17
|
+
return <ToastPrimitive.Portal data-slot="toast-portal" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ToastViewport({ className, ...props }: ToastPrimitive.Viewport.Props) {
|
|
21
|
+
return (
|
|
22
|
+
<ToastPrimitive.Viewport
|
|
23
|
+
data-slot="toast-viewport"
|
|
24
|
+
className={cn(
|
|
25
|
+
"pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function Toast({ className, ...props }: ToastPrimitive.Root.Props) {
|
|
34
|
+
return (
|
|
35
|
+
<ToastPrimitive.Root
|
|
36
|
+
data-slot="toast"
|
|
37
|
+
className={cn(
|
|
38
|
+
"group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-popover bg-popover text-popover-foreground will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 shadow-popover",
|
|
39
|
+
"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]",
|
|
40
|
+
"h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]",
|
|
41
|
+
"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
42
|
+
"data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
|
|
43
|
+
"data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]",
|
|
44
|
+
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
|
|
45
|
+
"data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
46
|
+
"data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
|
|
47
|
+
"data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
48
|
+
"data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
49
|
+
"data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
50
|
+
"data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
|
|
51
|
+
"data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
52
|
+
"data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ToastContent({ className, ...props }: ToastPrimitive.Content.Props) {
|
|
61
|
+
return (
|
|
62
|
+
<ToastPrimitive.Content
|
|
63
|
+
data-slot="toast-content"
|
|
64
|
+
className={cn(
|
|
65
|
+
"flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function ToastTitle({ className, ...props }: ToastPrimitive.Title.Props) {
|
|
74
|
+
return (
|
|
75
|
+
<ToastPrimitive.Title
|
|
76
|
+
data-slot="toast-title"
|
|
77
|
+
className={cn("text-sm font-medium", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function ToastDescription({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: ToastPrimitive.Description.Props) {
|
|
87
|
+
return (
|
|
88
|
+
<ToastPrimitive.Description
|
|
89
|
+
data-slot="toast-description"
|
|
90
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function ToastAction({
|
|
97
|
+
className,
|
|
98
|
+
render = <Button variant="outline" size="sm" />,
|
|
99
|
+
...props
|
|
100
|
+
}: ToastPrimitive.Action.Props) {
|
|
101
|
+
return (
|
|
102
|
+
<ToastPrimitive.Action
|
|
103
|
+
data-slot="toast-action"
|
|
104
|
+
render={render}
|
|
105
|
+
className={cn("shrink-0", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function ToastClose({
|
|
112
|
+
className,
|
|
113
|
+
children,
|
|
114
|
+
render = <Button variant="ghost" size="icon-sm" />,
|
|
115
|
+
...props
|
|
116
|
+
}: ToastPrimitive.Close.Props) {
|
|
117
|
+
return (
|
|
118
|
+
<ToastPrimitive.Close
|
|
119
|
+
data-slot="toast-close"
|
|
120
|
+
aria-label="Close toast"
|
|
121
|
+
render={render}
|
|
122
|
+
className={cn(
|
|
123
|
+
"relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children ?? (
|
|
129
|
+
<XIcon aria-hidden="true" />
|
|
130
|
+
)}
|
|
131
|
+
</ToastPrimitive.Close>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function ToastIcon({ type }: { type: string | undefined }) {
|
|
136
|
+
let icon: React.ReactNode = null
|
|
137
|
+
|
|
138
|
+
if (type === "success") {
|
|
139
|
+
icon = (
|
|
140
|
+
<CircleCheckIcon aria-hidden="true" />
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (type === "info") {
|
|
145
|
+
icon = (
|
|
146
|
+
<InfoIcon aria-hidden="true" />
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (type === "warning") {
|
|
151
|
+
icon = (
|
|
152
|
+
<TriangleAlertIcon aria-hidden="true" />
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (type === "error") {
|
|
157
|
+
icon = (
|
|
158
|
+
<OctagonXIcon className="text-destructive" aria-hidden="true" />
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (type === "loading") {
|
|
163
|
+
icon = (
|
|
164
|
+
<Loader2Icon className="animate-spin" aria-hidden="true" />
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!icon) {
|
|
169
|
+
return null
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<span
|
|
174
|
+
data-slot="toast-icon"
|
|
175
|
+
className="shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4"
|
|
176
|
+
>
|
|
177
|
+
{icon}
|
|
178
|
+
</span>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function ToastList() {
|
|
183
|
+
const { toasts } = ToastPrimitive.useToastManager()
|
|
184
|
+
|
|
185
|
+
return toasts.map((toastItem) => (
|
|
186
|
+
<Toast key={toastItem.id} toast={toastItem}>
|
|
187
|
+
<ToastContent>
|
|
188
|
+
<ToastIcon type={toastItem.type} />
|
|
189
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
190
|
+
<ToastTitle />
|
|
191
|
+
<ToastDescription />
|
|
192
|
+
</div>
|
|
193
|
+
<ToastAction />
|
|
194
|
+
<ToastClose />
|
|
195
|
+
</ToastContent>
|
|
196
|
+
</Toast>
|
|
197
|
+
))
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function Toaster({
|
|
201
|
+
children,
|
|
202
|
+
toastManager = toast,
|
|
203
|
+
...props
|
|
204
|
+
}: ToastPrimitive.Provider.Props) {
|
|
205
|
+
return (
|
|
206
|
+
<ToastProvider toastManager={toastManager} {...props}>
|
|
207
|
+
{children}
|
|
208
|
+
<ToastPortal>
|
|
209
|
+
<ToastViewport>
|
|
210
|
+
<ToastList />
|
|
211
|
+
</ToastViewport>
|
|
212
|
+
</ToastPortal>
|
|
213
|
+
</ToastProvider>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const createToastManager = ToastPrimitive.createToastManager
|
|
218
|
+
const useToastManager = ToastPrimitive.useToastManager
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
Toaster,
|
|
222
|
+
Toast,
|
|
223
|
+
ToastAction,
|
|
224
|
+
ToastClose,
|
|
225
|
+
ToastContent,
|
|
226
|
+
ToastDescription,
|
|
227
|
+
ToastPortal,
|
|
228
|
+
ToastProvider,
|
|
229
|
+
ToastTitle,
|
|
230
|
+
ToastViewport,
|
|
231
|
+
createToastManager,
|
|
232
|
+
toast,
|
|
233
|
+
useToastManager,
|
|
234
|
+
}
|