@bearmenu/ui 0.1.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/dist/chunk-2CUFS5LF.js +80 -0
- package/dist/chunk-3GWWZKX7.js +33 -0
- package/dist/chunk-3VMDCCCX.js +10 -0
- package/dist/chunk-4AVS6CV4.js +89 -0
- package/dist/chunk-4JOV7FXW.js +17 -0
- package/dist/chunk-4KOMHDZD.js +89 -0
- package/dist/chunk-4UO73SKC.js +26 -0
- package/dist/chunk-7H54PTVH.js +116 -0
- package/dist/chunk-CW24PLDW.js +24 -0
- package/dist/chunk-EBAMCZDW.js +112 -0
- package/dist/chunk-ERMIA7NP.js +106 -0
- package/dist/chunk-ESO2EM3L.js +46 -0
- package/dist/chunk-EUHEIWHZ.js +32 -0
- package/dist/chunk-FEK5XGZW.js +8 -0
- package/dist/chunk-NKHH23YK.js +31 -0
- package/dist/chunk-R47NEOSI.js +78 -0
- package/dist/chunk-UXAYXRFN.js +69 -0
- package/dist/chunk-X6GATUI2.js +19 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +53 -0
- package/dist/components/alert-dialog.d.ts +23 -0
- package/dist/components/alert-dialog.js +98 -0
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.js +52 -0
- package/dist/components/aspect-ratio.d.ts +6 -0
- package/dist/components/aspect-ratio.js +2 -0
- package/dist/components/avatar.d.ts +8 -0
- package/dist/components/avatar.js +47 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.js +3 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +96 -0
- package/dist/components/button.d.ts +16 -0
- package/dist/components/button.js +4 -0
- package/dist/components/calendar.d.ts +11 -0
- package/dist/components/calendar.js +56 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +4 -0
- package/dist/components/carousel.d.ts +24 -0
- package/dist/components/carousel.js +198 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +25 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +26 -0
- package/dist/components/command.d.ts +84 -0
- package/dist/components/command.js +4 -0
- package/dist/components/currency-input.d.ts +17 -0
- package/dist/components/currency-input.js +121 -0
- package/dist/components/dialog.d.ts +22 -0
- package/dist/components/dialog.js +3 -0
- package/dist/components/drawer.d.ts +27 -0
- package/dist/components/drawer.js +85 -0
- package/dist/components/dropdown-menu.d.ts +28 -0
- package/dist/components/dropdown-menu.js +211 -0
- package/dist/components/empty-state.d.ts +22 -0
- package/dist/components/empty-state.js +81 -0
- package/dist/components/form.d.ts +28 -0
- package/dist/components/form.js +97 -0
- package/dist/components/haptic-button.d.ts +12 -0
- package/dist/components/haptic-button.js +17 -0
- package/dist/components/input-otp.d.ts +14 -0
- package/dist/components/input-otp.js +62 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +3 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.js +3 -0
- package/dist/components/lazy-markdown.d.ts +11 -0
- package/dist/components/lazy-markdown.js +13 -0
- package/dist/components/link-button.d.ts +30 -0
- package/dist/components/link-button.js +17 -0
- package/dist/components/markdown-renderer.d.ts +11 -0
- package/dist/components/markdown-renderer.js +10 -0
- package/dist/components/multi-select-combobox.d.ts +23 -0
- package/dist/components/multi-select-combobox.js +114 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.js +101 -0
- package/dist/components/popover.d.ts +8 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/progress.d.ts +6 -0
- package/dist/components/progress.js +30 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +30 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +120 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.js +44 -0
- package/dist/components/search-bar.d.ts +17 -0
- package/dist/components/search-bar.js +92 -0
- package/dist/components/searchable-select.d.ts +22 -0
- package/dist/components/searchable-select.js +104 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +129 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/sheet.d.ts +29 -0
- package/dist/components/sheet.js +96 -0
- package/dist/components/skeleton-card.d.ts +13 -0
- package/dist/components/skeleton-card.js +154 -0
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +3 -0
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/slider.js +24 -0
- package/dist/components/sliding-panels.d.ts +19 -0
- package/dist/components/sliding-panels.js +75 -0
- package/dist/components/sonner.d.ts +6 -0
- package/dist/components/sonner.js +23 -0
- package/dist/components/sticky-container.d.ts +44 -0
- package/dist/components/sticky-container.js +39 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +31 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +81 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +55 -0
- package/dist/components/text.d.ts +31 -0
- package/dist/components/text.js +3 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +23 -0
- package/dist/components/toast.d.ts +18 -0
- package/dist/components/toast.js +3 -0
- package/dist/components/toaster.d.ts +5 -0
- package/dist/components/toaster.js +25 -0
- package/dist/components/toggle-group.d.ts +12 -0
- package/dist/components/toggle-group.js +72 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +3 -0
- package/dist/components/tooltip.d.ts +9 -0
- package/dist/components/tooltip.js +26 -0
- package/dist/components/use-mobile.d.ts +3 -0
- package/dist/components/use-mobile.js +19 -0
- package/dist/components/use-toast.d.ts +42 -0
- package/dist/components/use-toast.js +2 -0
- package/dist/hooks/use-haptic.d.ts +22 -0
- package/dist/hooks/use-haptic.js +2 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-mounted-theme.d.ts +6 -0
- package/dist/hooks/use-mounted-theme.js +18 -0
- package/dist/hooks/use-sticky.d.ts +18 -0
- package/dist/hooks/use-sticky.js +2 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +2 -0
- package/package.json +203 -0
- package/src/components/accordion.tsx +57 -0
- package/src/components/alert-dialog.tsx +116 -0
- package/src/components/alert.tsx +57 -0
- package/src/components/aspect-ratio.tsx +9 -0
- package/src/components/avatar.tsx +49 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +102 -0
- package/src/components/button.tsx +94 -0
- package/src/components/calendar.tsx +60 -0
- package/src/components/card.tsx +67 -0
- package/src/components/carousel.tsx +230 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/collapsible.tsx +28 -0
- package/src/components/command.tsx +148 -0
- package/src/components/currency-input.tsx +158 -0
- package/src/components/dialog.tsx +103 -0
- package/src/components/drawer.tsx +99 -0
- package/src/components/dropdown-menu.tsx +228 -0
- package/src/components/empty-state.tsx +118 -0
- package/src/components/form.tsx +152 -0
- package/src/components/haptic-button.tsx +19 -0
- package/src/components/input-otp.tsx +70 -0
- package/src/components/input.tsx +23 -0
- package/src/components/label.tsx +20 -0
- package/src/components/lazy-markdown.tsx +20 -0
- package/src/components/link-button.tsx +40 -0
- package/src/components/markdown-renderer.tsx +20 -0
- package/src/components/multi-select-combobox.tsx +148 -0
- package/src/components/pagination.tsx +106 -0
- package/src/components/popover.tsx +30 -0
- package/src/components/progress.tsx +27 -0
- package/src/components/radio-group.tsx +37 -0
- package/src/components/rating.tsx +136 -0
- package/src/components/scroll-area.tsx +45 -0
- package/src/components/search-bar.tsx +113 -0
- package/src/components/searchable-select.tsx +134 -0
- package/src/components/select.tsx +152 -0
- package/src/components/separator.tsx +25 -0
- package/src/components/sheet.tsx +121 -0
- package/src/components/skeleton-card.tsx +282 -0
- package/src/components/skeleton.tsx +17 -0
- package/src/components/slider.tsx +24 -0
- package/src/components/sliding-panels.tsx +99 -0
- package/src/components/sonner.tsx +25 -0
- package/src/components/sticky-container.tsx +88 -0
- package/src/components/switch.tsx +28 -0
- package/src/components/table.tsx +90 -0
- package/src/components/tabs.tsx +72 -0
- package/src/components/text.test.tsx +192 -0
- package/src/components/text.tsx +114 -0
- package/src/components/textarea.tsx +22 -0
- package/src/components/toast.tsx +129 -0
- package/src/components/toaster.tsx +31 -0
- package/src/components/toggle-group.tsx +69 -0
- package/src/components/toggle.tsx +46 -0
- package/src/components/tooltip.tsx +29 -0
- package/src/components/use-mobile.tsx +19 -0
- package/src/components/use-toast.ts +180 -0
- package/src/globals.css +409 -0
- package/src/hooks/use-haptic.ts +118 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-mounted-theme.ts +20 -0
- package/src/hooks/use-sticky.ts +47 -0
- package/src/lib/utils.ts +6 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Check, ChevronsUpDown, X } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
import { Button } from "./button";
|
|
7
|
+
import {
|
|
8
|
+
Command,
|
|
9
|
+
CommandEmpty,
|
|
10
|
+
CommandGroup,
|
|
11
|
+
CommandInput,
|
|
12
|
+
CommandItem,
|
|
13
|
+
CommandList,
|
|
14
|
+
} from "./command";
|
|
15
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
16
|
+
|
|
17
|
+
export interface SelectOption {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface SearchableSelectProps {
|
|
24
|
+
options: SelectOption[];
|
|
25
|
+
value: string | undefined;
|
|
26
|
+
onValueChange: (value: string | undefined) => void;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
searchPlaceholder?: string;
|
|
29
|
+
emptyText?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
onSearchChange?: (search: string) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function SearchableSelect({
|
|
37
|
+
options,
|
|
38
|
+
value,
|
|
39
|
+
onValueChange,
|
|
40
|
+
placeholder = "Select...",
|
|
41
|
+
searchPlaceholder = "Search...",
|
|
42
|
+
emptyText = "No items found.",
|
|
43
|
+
className,
|
|
44
|
+
disabled = false,
|
|
45
|
+
loading = false,
|
|
46
|
+
onSearchChange,
|
|
47
|
+
}: SearchableSelectProps) {
|
|
48
|
+
const [open, setOpen] = React.useState(false);
|
|
49
|
+
|
|
50
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
51
|
+
|
|
52
|
+
// Fallback: if we have a value but no matching option, display the value itself
|
|
53
|
+
// This handles the case where the selected concept hasn't been fetched yet
|
|
54
|
+
const displayLabel = selectedOption?.label || (value ? value : undefined);
|
|
55
|
+
|
|
56
|
+
const handleSelect = (selectedValue: string) => {
|
|
57
|
+
onValueChange(selectedValue === value ? undefined : selectedValue);
|
|
58
|
+
setOpen(false);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleClear = (e: React.MouseEvent | React.KeyboardEvent) => {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
onValueChange(undefined);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
68
|
+
<PopoverTrigger asChild>
|
|
69
|
+
<Button
|
|
70
|
+
variant="outline"
|
|
71
|
+
role="combobox"
|
|
72
|
+
aria-expanded={open}
|
|
73
|
+
className={cn(
|
|
74
|
+
"w-full justify-between h-10",
|
|
75
|
+
!value && "text-muted-foreground",
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
>
|
|
80
|
+
<span className="truncate">{displayLabel || placeholder}</span>
|
|
81
|
+
<div className="flex items-center gap-1">
|
|
82
|
+
{value && (
|
|
83
|
+
<div
|
|
84
|
+
role="button"
|
|
85
|
+
tabIndex={0}
|
|
86
|
+
className="rounded-full p-0.5 hover:bg-accent cursor-pointer"
|
|
87
|
+
onClick={handleClear}
|
|
88
|
+
onKeyDown={(e) => {
|
|
89
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
handleClear(e);
|
|
92
|
+
}
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<X className="h-3 w-3" />
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
98
|
+
<ChevronsUpDown className="h-4 w-4 shrink-0 opacity-50" />
|
|
99
|
+
</div>
|
|
100
|
+
</Button>
|
|
101
|
+
</PopoverTrigger>
|
|
102
|
+
<PopoverContent className="w-full p-0" align="start">
|
|
103
|
+
<Command shouldFilter={!onSearchChange}>
|
|
104
|
+
<CommandInput placeholder={searchPlaceholder} onValueChange={onSearchChange} />
|
|
105
|
+
<CommandList>
|
|
106
|
+
<CommandEmpty>{loading ? "Loading..." : emptyText}</CommandEmpty>
|
|
107
|
+
<CommandGroup>
|
|
108
|
+
{options.map((option) => (
|
|
109
|
+
<CommandItem
|
|
110
|
+
key={option.value}
|
|
111
|
+
value={option.value}
|
|
112
|
+
onSelect={() => handleSelect(option.value)}
|
|
113
|
+
>
|
|
114
|
+
<Check
|
|
115
|
+
className={cn(
|
|
116
|
+
"mr-2 h-4 w-4",
|
|
117
|
+
value === option.value ? "opacity-100" : "opacity-0"
|
|
118
|
+
)}
|
|
119
|
+
/>
|
|
120
|
+
<div className="flex flex-col">
|
|
121
|
+
<span>{option.label}</span>
|
|
122
|
+
{option.description && (
|
|
123
|
+
<span className="text-xs text-muted-foreground">{option.description}</span>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
</CommandItem>
|
|
127
|
+
))}
|
|
128
|
+
</CommandGroup>
|
|
129
|
+
</CommandList>
|
|
130
|
+
</Command>
|
|
131
|
+
</PopoverContent>
|
|
132
|
+
</Popover>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
const Select = SelectPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
11
|
+
|
|
12
|
+
const SelectValue = SelectPrimitive.Value;
|
|
13
|
+
|
|
14
|
+
const SelectTrigger = React.forwardRef<
|
|
15
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
17
|
+
>(({ className, children, ...props }, ref) => (
|
|
18
|
+
<SelectPrimitive.Trigger
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
"flex h-11 w-full items-center justify-between rounded-xl bg-surface border border-border px-4 py-2 text-sm font-medium text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 hover:border-foreground/20 hover:text-foreground",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
<SelectPrimitive.Icon asChild>
|
|
28
|
+
<ChevronDown className="h-4 w-4" />
|
|
29
|
+
</SelectPrimitive.Icon>
|
|
30
|
+
</SelectPrimitive.Trigger>
|
|
31
|
+
));
|
|
32
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
33
|
+
|
|
34
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
35
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
36
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
37
|
+
>(({ className, ...props }, ref) => (
|
|
38
|
+
<SelectPrimitive.ScrollUpButton
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<ChevronUp className="h-4 w-4" />
|
|
44
|
+
</SelectPrimitive.ScrollUpButton>
|
|
45
|
+
));
|
|
46
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
47
|
+
|
|
48
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
49
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
50
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
51
|
+
>(({ className, ...props }, ref) => (
|
|
52
|
+
<SelectPrimitive.ScrollDownButton
|
|
53
|
+
ref={ref}
|
|
54
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
<ChevronDown className="h-4 w-4" />
|
|
58
|
+
</SelectPrimitive.ScrollDownButton>
|
|
59
|
+
));
|
|
60
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
61
|
+
|
|
62
|
+
const SelectContent = React.forwardRef<
|
|
63
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
65
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
66
|
+
<SelectPrimitive.Portal>
|
|
67
|
+
<SelectPrimitive.Content
|
|
68
|
+
ref={ref}
|
|
69
|
+
className={cn(
|
|
70
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-card text-popover-foreground shadow-lg 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",
|
|
71
|
+
position === "popper" &&
|
|
72
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
position={position}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
<SelectScrollUpButton />
|
|
79
|
+
<SelectPrimitive.Viewport
|
|
80
|
+
className={cn(
|
|
81
|
+
"p-1 flex flex-col gap-1",
|
|
82
|
+
position === "popper" &&
|
|
83
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
84
|
+
)}
|
|
85
|
+
>
|
|
86
|
+
{children}
|
|
87
|
+
</SelectPrimitive.Viewport>
|
|
88
|
+
<SelectScrollDownButton />
|
|
89
|
+
</SelectPrimitive.Content>
|
|
90
|
+
</SelectPrimitive.Portal>
|
|
91
|
+
));
|
|
92
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
93
|
+
|
|
94
|
+
const SelectLabel = React.forwardRef<
|
|
95
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
96
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
97
|
+
>(({ className, ...props }, ref) => (
|
|
98
|
+
<SelectPrimitive.Label
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
));
|
|
104
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
105
|
+
|
|
106
|
+
const SelectItem = React.forwardRef<
|
|
107
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
108
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
109
|
+
>(({ className, children, ...props }, ref) => (
|
|
110
|
+
<SelectPrimitive.Item
|
|
111
|
+
ref={ref}
|
|
112
|
+
className={cn(
|
|
113
|
+
"relative flex w-full cursor-default select-none items-center rounded-lg py-2 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:bg-primary/10 data-[state=checked]:text-primary data-[state=checked]:font-medium",
|
|
114
|
+
className
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
119
|
+
<SelectPrimitive.ItemIndicator>
|
|
120
|
+
<Check className="h-4 w-4" />
|
|
121
|
+
</SelectPrimitive.ItemIndicator>
|
|
122
|
+
</span>
|
|
123
|
+
|
|
124
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
125
|
+
</SelectPrimitive.Item>
|
|
126
|
+
));
|
|
127
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
128
|
+
|
|
129
|
+
const SelectSeparator = React.forwardRef<
|
|
130
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
131
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
132
|
+
>(({ className, ...props }, ref) => (
|
|
133
|
+
<SelectPrimitive.Separator
|
|
134
|
+
ref={ref}
|
|
135
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
));
|
|
139
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
Select,
|
|
143
|
+
SelectGroup,
|
|
144
|
+
SelectValue,
|
|
145
|
+
SelectTrigger,
|
|
146
|
+
SelectContent,
|
|
147
|
+
SelectLabel,
|
|
148
|
+
SelectItem,
|
|
149
|
+
SelectSeparator,
|
|
150
|
+
SelectScrollUpButton,
|
|
151
|
+
SelectScrollDownButton,
|
|
152
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
const Separator = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
10
|
+
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
11
|
+
<SeparatorPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
decorative={decorative}
|
|
14
|
+
orientation={orientation}
|
|
15
|
+
className={cn(
|
|
16
|
+
"shrink-0 bg-gradient-to-r from-transparent via-border to-transparent backdrop-blur-sm",
|
|
17
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
));
|
|
23
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
24
|
+
|
|
25
|
+
export { Separator };
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
const Sheet = SheetPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
12
|
+
|
|
13
|
+
const SheetClose = SheetPrimitive.Close;
|
|
14
|
+
|
|
15
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
16
|
+
|
|
17
|
+
const SheetOverlay = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<SheetPrimitive.Overlay
|
|
22
|
+
className={cn(
|
|
23
|
+
"fixed inset-0 z-[1000] bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
ref={ref}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
31
|
+
|
|
32
|
+
const sheetVariants = cva(
|
|
33
|
+
"fixed z-[1000] gap-4 glass bg-background p-6 shadow-2xl transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
side: {
|
|
37
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
38
|
+
bottom:
|
|
39
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom rounded-t-2xl",
|
|
40
|
+
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 rounded-r-2xl",
|
|
41
|
+
right:
|
|
42
|
+
"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 rounded-l-2xl",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
side: "right",
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
interface SheetContentProps
|
|
52
|
+
extends
|
|
53
|
+
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 ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
63
|
+
{children}
|
|
64
|
+
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-lg 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 glass-hover p-2">
|
|
65
|
+
<X className="h-4 w-4" />
|
|
66
|
+
<span className="sr-only">Close</span>
|
|
67
|
+
</SheetPrimitive.Close>
|
|
68
|
+
</SheetPrimitive.Content>
|
|
69
|
+
</SheetPortal>
|
|
70
|
+
));
|
|
71
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
72
|
+
|
|
73
|
+
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
75
|
+
);
|
|
76
|
+
SheetHeader.displayName = "SheetHeader";
|
|
77
|
+
|
|
78
|
+
const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
79
|
+
<div
|
|
80
|
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
SheetFooter.displayName = "SheetFooter";
|
|
85
|
+
|
|
86
|
+
const SheetTitle = React.forwardRef<
|
|
87
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
88
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
89
|
+
>(({ className, ...props }, ref) => (
|
|
90
|
+
<SheetPrimitive.Title
|
|
91
|
+
ref={ref}
|
|
92
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
));
|
|
96
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
97
|
+
|
|
98
|
+
const SheetDescription = React.forwardRef<
|
|
99
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
100
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
101
|
+
>(({ className, ...props }, ref) => (
|
|
102
|
+
<SheetPrimitive.Description
|
|
103
|
+
ref={ref}
|
|
104
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
));
|
|
108
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
Sheet,
|
|
112
|
+
SheetPortal,
|
|
113
|
+
SheetOverlay,
|
|
114
|
+
SheetTrigger,
|
|
115
|
+
SheetClose,
|
|
116
|
+
SheetContent,
|
|
117
|
+
SheetHeader,
|
|
118
|
+
SheetFooter,
|
|
119
|
+
SheetTitle,
|
|
120
|
+
SheetDescription,
|
|
121
|
+
};
|