@catalystsoftware/ui 1.0.2 → 1.0.5
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/data/tailwind.config.js +261 -3821
- package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
- package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
- package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
- package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
- package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
- package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
- package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
- package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
- package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
- package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
- package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
- package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
- package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
- package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
- package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
- package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
- package/dist/components/catalyst-ui/media/image.tsx +13 -0
- package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
- package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
- package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
- package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
- package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
- package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
- package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
- package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
- package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
- package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
- package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
- package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
- package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
- package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
- package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
- package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
- package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
- package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
- package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
- package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
- package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
- package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
- package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
- package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
- package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
- package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
- package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
- package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
- package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
- package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
- package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
- package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
- package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
- package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
- package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
- package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
- package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
- package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
- package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
- package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
- package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
- package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
- package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
- package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
- package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
- package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
- package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
- package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
- package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
- package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
- package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
- package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
- package/dist/components/catalyst-ui/utils/utils.ts +43 -0
- package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
- package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
- package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
- package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
- package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
- package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
- package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
- package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
- package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
- package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
- package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
- package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
- package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
- package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
- package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
- package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
- package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
- package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
- package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
- package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
- package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
- package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
- package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
- package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
- package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
- package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
- package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
- package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
- package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
- package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
- package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
- package/dist/data/bg-data.tsx +901 -0
- package/dist/data/buttons-data.tsx +2327 -0
- package/dist/data/charts-data.tsx +102 -0
- package/dist/data/chat-data.tsx +83 -0
- package/dist/data/code-data.tsx +1040 -0
- package/dist/data/comboboxes-data.tsx +1843 -0
- package/dist/data/command-data.tsx +1381 -0
- package/dist/data/core-data.tsx +15953 -0
- package/dist/data/crm-data.tsx +47 -0
- package/dist/data/data.tsx +159 -0
- package/dist/data/date-and-time-data.tsx +554 -0
- package/dist/data/dependencies.tsx +7 -0
- package/dist/data/ecommerce-data.tsx +1387 -0
- package/dist/data/forms-data.tsx +7890 -0
- package/dist/data/hooks-data.tsx +5487 -0
- package/dist/data/index.ts +34 -0
- package/dist/data/inputs-data.tsx +557 -0
- package/dist/data/interactive-data.tsx +5394 -0
- package/dist/data/lofi-data.tsx +18295 -0
- package/dist/data/marketing-data.tsx +2546 -0
- package/dist/data/media-data.tsx +1510 -0
- package/dist/data/motion-data.tsx +5801 -0
- package/dist/data/overlay-data.tsx +4136 -0
- package/dist/data/pdf-data.tsx +124 -0
- package/dist/data/pos-data.tsx +213 -0
- package/dist/data/postcss.config.js +6 -0
- package/dist/data/primitive-data.tsx +5170 -0
- package/dist/data/prompt-data.tsx +1226 -0
- package/dist/data/requiredLibs.ts +4 -0
- package/dist/data/sandbox-data.tsx +1 -0
- package/dist/data/sidebars-data.tsx +5421 -0
- package/dist/data/stacks-data.tsx +32 -0
- package/dist/data/table-data.tsx +706 -0
- package/dist/data/tailwind.config.js +270 -0
- package/dist/data/tailwind.config.ngin.js +3830 -0
- package/dist/data/tailwind.css +431 -0
- package/dist/data/tools-data.tsx +6910 -0
- package/dist/data/typography-data.tsx +2050 -0
- package/dist/data/utils-data.tsx +6500 -0
- package/dist/data/x-data.tsx +1171 -0
- package/dist/data.tsx +159 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -362
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
2
|
+
import { Search } from "lucide-react";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { cn } from "~/components/catalyst-ui";
|
|
5
|
+
import { Dialog, DialogContent } from "~/components/catalyst-ui";
|
|
6
|
+
import { Button } from "~/components/catalyst-ui";
|
|
7
|
+
import React from "react";
|
|
8
|
+
|
|
9
|
+
// @dev app/components/catalyst-ui/data/primitive-data.tsx:2631
|
|
10
|
+
const commandVariants = cva(
|
|
11
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-all",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: "bg-popover text-popover-foreground border border-border shadow-xs",
|
|
16
|
+
framer: "max-w-[640px] w-full p-2 bg-gray-900 rounded-2xl border border-gray-200 shadow-lg font-sans hover:shadow-xl",
|
|
17
|
+
linear: "max-w-[640px] w-full bg-gradient-to-br from-[#27282b] to-[#2d2e31] rounded-lg overflow-hidden p-0 font-sans shadow-lg hover:shadow-xl",
|
|
18
|
+
raycast: "max-w-[640px] w-full bg-gray-900 rounded-xl py-2 font-sans shadow-lg border border-gray-700 relative hover:shadow-xl",
|
|
19
|
+
vercel: "max-w-[640px] w-full p-2 bg-[rgba(22,22,22,0.7)] rounded-xl overflow-hidden font-sans border border-gray-200 shadow-lg transition-all duration-300 hover:shadow-xl",
|
|
20
|
+
search: "w-full rounded-2xl border shadow-2xl border-zinc-800 bg-zinc-900 hover:shadow-3xl",
|
|
21
|
+
elevated: "bg-surface-container-low text-primary shadow-md hover:shadow-lg active:shadow-sm",
|
|
22
|
+
filled: "bg-primary text-on-primary shadow-sm hover:shadow-md active:shadow-sm",
|
|
23
|
+
tonal: "bg-secondary-container text-on-secondary-container hover:shadow-sm active:shadow-none",
|
|
24
|
+
glass: "bg-background/20 backdrop-blur-md border border-border/50 text-foreground hover:bg-background/30 shadow-lg",
|
|
25
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
26
|
+
gradient: "bg-gradient-to-r from-primary to-primary/80 text-primary-foreground shadow-md hover:shadow-lg active:shadow-sm",
|
|
27
|
+
fumadocs: "w-full divide-y divide-border rounded-2xl border bg-popover/60 backdrop-blur-xl text-popover-foreground shadow-2xl shadow-black/40 overflow-hidden",
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default",
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const commandInputVariants = cva(
|
|
38
|
+
"flex items-center border-b px-3 transition-all",
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
variant: {
|
|
42
|
+
default: "",
|
|
43
|
+
framer: "h-12 gap-2 border-gray-200 mb-3 pb-2",
|
|
44
|
+
linear: "p-0 border-gray-200",
|
|
45
|
+
raycast: "border-0 px-4",
|
|
46
|
+
vercel: "border-gray-200 px-2 mb-4",
|
|
47
|
+
elevated: "border-primary/20",
|
|
48
|
+
filled: "border-on-primary/20",
|
|
49
|
+
tonal: "border-on-secondary-container/20",
|
|
50
|
+
glass: "border-border/30",
|
|
51
|
+
destructive: "border-destructive/20",
|
|
52
|
+
gradient: "border-primary-foreground/20",
|
|
53
|
+
fumadocs: "flex flex-row items-center gap-2 p-3 pb-2 border-0",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
variant: "default",
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const commandInputFieldVariants = cva(
|
|
63
|
+
"flex w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
64
|
+
{
|
|
65
|
+
variants: {
|
|
66
|
+
variant: {
|
|
67
|
+
default: "h-11",
|
|
68
|
+
framer: "h-auto text-base border-none font-sans bg-transparent text-gray-100 placeholder:text-gray-500 focus-visible:ring-blue-500",
|
|
69
|
+
linear: "h-auto text-lg p-5 border-none font-sans bg-transparent text-gray-100 placeholder:text-gray-500 rounded-none m-0 caret-[#6e5ed2] focus-visible:ring-[#6e5ed2]",
|
|
70
|
+
raycast: "h-auto text-[15px] py-2 px-4 border-none font-sans bg-transparent text-gray-100 placeholder:text-gray-500 focus-visible:ring-gray-400",
|
|
71
|
+
vercel: "h-auto text-[17px] py-2 px-2 pb-4 border-none font-sans bg-transparent text-gray-100 placeholder:text-gray-500 rounded-none focus-visible:ring-gray-400",
|
|
72
|
+
elevated: "text-primary placeholder:text-primary/60 focus-visible:ring-primary",
|
|
73
|
+
filled: "text-on-primary placeholder:text-on-primary/60 focus-visible:ring-on-primary",
|
|
74
|
+
tonal: "text-on-secondary-container placeholder:text-on-secondary-container/60 focus-visible:ring-on-secondary-container",
|
|
75
|
+
glass: "text-foreground placeholder:text-foreground/60 focus-visible:ring-border",
|
|
76
|
+
destructive: "text-white placeholder:text-white/60 focus-visible:ring-destructive",
|
|
77
|
+
gradient: "text-primary-foreground placeholder:text-primary-foreground/60 focus-visible:ring-primary-foreground",
|
|
78
|
+
fumadocs: "w-0 flex-1 bg-transparent text-lg placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
79
|
+
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
variant: "default",
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const commandListVariants = cva(
|
|
89
|
+
"overflow-y-auto overflow-x-hidden transition-all",
|
|
90
|
+
{
|
|
91
|
+
variants: {
|
|
92
|
+
variant: {
|
|
93
|
+
default: "h-full max-h-[700px]",
|
|
94
|
+
framer: "h-full",
|
|
95
|
+
linear: "min-h-[300px] max-h-[400px] overflow-auto overscroll-contain transition-[height] duration-100",
|
|
96
|
+
raycast: "px-2 h-[393px] overflow-auto overscroll-contain scroll-pb-10 transition-[height] duration-100 pb-10",
|
|
97
|
+
vercel: "min-h-[330px] max-h-[400px] overflow-auto overscroll-contain transition-[height] duration-100",
|
|
98
|
+
elevated: "max-h-[700px]",
|
|
99
|
+
filled: "max-h-[700px]",
|
|
100
|
+
tonal: "max-h-[700px]",
|
|
101
|
+
glass: "max-h-[700px] backdrop-blur-sm",
|
|
102
|
+
destructive: "max-h-[700px]",
|
|
103
|
+
gradient: "max-h-[700px]",
|
|
104
|
+
fumadocs: "w-full flex flex-col overflow-y-auto max-h-[460px] p-1",
|
|
105
|
+
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
defaultVariants: {
|
|
109
|
+
variant: "default",
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const commandItemVariants = cva(
|
|
115
|
+
"relative flex cursor-pointer select-none items-center px-2 py-1.5 text-sm outline-none transition-all rounded-md aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
116
|
+
{
|
|
117
|
+
variants: {
|
|
118
|
+
variant: {
|
|
119
|
+
default: "border-l-4 border-transparent hover:bg-accent/50 hover:border-primary aria-selected:border-primary",
|
|
120
|
+
framer: "rounded-xl text-sm gap-3 text-gray-100 p-2 mr-2 font-medium aria-selected:bg-blue-500 aria-selected:text-white data-[disabled=true]:text-gray-400 data-[disabled=true]:cursor-not-allowed mt-1 first:mt-0 hover:bg-gray-800",
|
|
121
|
+
linear: "h-12 text-sm gap-3 px-4 text-gray-100 select-none will-change-[background,color] aria-selected:bg-gray-800 aria-selected:after:content-[''] aria-selected:after:absolute aria-selected:after:left-0 aria-selected:after:z-[123] aria-selected:after:w-[3px] aria-selected:after:h-full aria-selected:after:bg-[#5f6ad2] active:bg-gray-700 data-[disabled=true]:text-gray-400 data-[disabled=true]:cursor-not-allowed mt-1 first:mt-0 hover:bg-gray-800/50",
|
|
122
|
+
raycast: "h-10 rounded-lg text-sm gap-2 px-2 text-gray-100 select-none will-change-[background,color] aria-selected:bg-gray-700 aria-selected:text-gray-100 active:bg-gray-700 data-[disabled=true]:text-gray-400 data-[disabled=true]:cursor-not-allowed first:mt-2 mt-1 hover:bg-gray-800",
|
|
123
|
+
vercel: "h-12 rounded-lg text-sm gap-2 px-4 text-gray-500 select-none will-change-[background,color] aria-selected:bg-gray-800/50 aria-selected:text-gray-100 active:bg-gray-700 data-[disabled=true]:text-gray-400 data-[disabled=true]:cursor-not-allowed mt-1 first:mt-0 hover:bg-gray-800/30",
|
|
124
|
+
elevated: "hover:bg-surface-container-high aria-selected:bg-surface-container-high focus-visible:ring-primary",
|
|
125
|
+
filled: "hover:bg-primary/80 aria-selected:bg-primary/80 focus-visible:ring-on-primary",
|
|
126
|
+
tonal: "hover:bg-secondary-container/80 aria-selected:bg-secondary-container/80 focus-visible:ring-on-secondary-container",
|
|
127
|
+
glass: "hover:bg-background/40 aria-selected:bg-background/40 focus-visible:ring-border",
|
|
128
|
+
destructive: "hover:bg-destructive/80 aria-selected:bg-destructive/80 focus-visible:ring-destructive",
|
|
129
|
+
gradient: "hover:bg-primary/60 aria-selected:bg-primary/60 focus-visible:ring-primary-foreground",
|
|
130
|
+
fumadocs: "relative flex select-none flex-row items-center gap-2 p-2 text-start text-sm rounded-lg font-medium bg-transparent aria-selected:bg-accent aria-selected:text-accent-foreground hover:bg-accent/50",
|
|
131
|
+
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
variant: "default",
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const commandGroupVariants = cva(
|
|
141
|
+
"overflow-hidden p-1 text-foreground transition-all [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
142
|
+
{
|
|
143
|
+
variants: {
|
|
144
|
+
variant: {
|
|
145
|
+
default: "",
|
|
146
|
+
framer: "[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-gray-500 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:mb-2",
|
|
147
|
+
linear: "[&_[cmdk-group-heading]]:select-none [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-gray-500 [&_[cmdk-group-heading]]:px-2",
|
|
148
|
+
raycast: "[&_[cmdk-group-heading]]:select-none [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-gray-500 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:flex [&_[cmdk-group-heading]]:items-center",
|
|
149
|
+
vercel: "[&_[cmdk-group-heading]]:select-none [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-gray-500 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:flex [&_[cmdk-group-heading]]:items-center [&_[cmdk-group-heading]]:mb-2 mt-2",
|
|
150
|
+
elevated: "[&_[cmdk-group-heading]]:text-primary/70",
|
|
151
|
+
filled: "[&_[cmdk-group-heading]]:text-on-primary/70",
|
|
152
|
+
tonal: "[&_[cmdk-group-heading]]:text-on-secondary-container/70",
|
|
153
|
+
glass: "[&_[cmdk-group-heading]]:text-foreground/70",
|
|
154
|
+
destructive: "[&_[cmdk-group-heading]]:text-white/70",
|
|
155
|
+
gradient: "[&_[cmdk-group-heading]]:text-primary-foreground/70",
|
|
156
|
+
fumadocs: "",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
defaultVariants: {
|
|
160
|
+
variant: "default",
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
interface CommandContextValue {
|
|
166
|
+
variant?: 'default' | 'framer' | 'linear' | 'raycast' | 'vercel' | "search" | "elevated" | "filled" | "tonal" | "glass" | "glass" | "destructive" | "gradient" | "fumadocs";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const CommandContext = React.createContext<CommandContextValue>({
|
|
170
|
+
variant: 'default',
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
interface CommandProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive> {
|
|
174
|
+
variant?: 'default' | 'framer' | 'linear' | 'raycast' | 'vercel' | "search" | "elevated" | "filled" | "tonal" | "glass" | "glass" | "destructive" | "gradient" | "fumadocs";
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const Command = React.forwardRef<
|
|
178
|
+
React.ElementRef<typeof CommandPrimitive>,
|
|
179
|
+
CommandProps
|
|
180
|
+
>(({ className, variant = 'default', ...props }, ref) => (
|
|
181
|
+
<CommandContext.Provider value={{ variant }}>
|
|
182
|
+
<CommandPrimitive
|
|
183
|
+
ref={ref}
|
|
184
|
+
className={cn(commandVariants({ variant }), className)}
|
|
185
|
+
{...props}
|
|
186
|
+
/>
|
|
187
|
+
</CommandContext.Provider>
|
|
188
|
+
));
|
|
189
|
+
Command.displayName = CommandPrimitive.displayName;
|
|
190
|
+
|
|
191
|
+
const CommandInput = React.forwardRef<
|
|
192
|
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
193
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
194
|
+
>(({ placeholder = 'Search...', className, ...props }, ref) => {
|
|
195
|
+
const { variant } = React.useContext(CommandContext);
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<div className={cn(commandInputVariants({ variant }))} cmdk-input-wrapper="">
|
|
199
|
+
<Search className={cn(
|
|
200
|
+
"shrink-0 opacity-50 ",
|
|
201
|
+
variant === 'framer' ? "w-5 h-5 text-gray-500" : "mr-2 h-4 w-4"
|
|
202
|
+
)} />
|
|
203
|
+
<CommandPrimitive.Input
|
|
204
|
+
ref={ref}
|
|
205
|
+
placeholder={placeholder}
|
|
206
|
+
className={cn("focus:outline-none outline-none focus:border-transparent ring-0 focus:ring-0", commandInputFieldVariants({ variant }), className)}
|
|
207
|
+
onFocus={(e) => e.target.style.boxShadow = 'none'}
|
|
208
|
+
{...props}
|
|
209
|
+
/>
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
214
|
+
|
|
215
|
+
const CommandList = React.forwardRef<
|
|
216
|
+
React.ElementRef<typeof CommandPrimitive.List>,
|
|
217
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> & { MHList?: string }
|
|
218
|
+
>(({ maxHeight = "max-h-[400px]", className, ...props }, ref) => {
|
|
219
|
+
const { variant } = React.useContext(CommandContext);
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<CommandPrimitive.List
|
|
223
|
+
ref={ref}
|
|
224
|
+
className={cn(commandListVariants({ variant }), maxHeight, className)}
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
230
|
+
|
|
231
|
+
const CommandEmpty = React.forwardRef<
|
|
232
|
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
233
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
234
|
+
>((props, ref) => {
|
|
235
|
+
const { variant } = React.useContext(CommandContext);
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<CommandPrimitive.Empty
|
|
239
|
+
ref={ref}
|
|
240
|
+
className={cn(
|
|
241
|
+
"text-center text-sm",
|
|
242
|
+
variant === 'framer' && "py-8 whitespace-pre-wrap text-gray-500",
|
|
243
|
+
variant === 'linear' && "text-sm flex items-center justify-center h-16 whitespace-pre-wrap text-gray-500",
|
|
244
|
+
variant === 'raycast' && "text-sm flex items-center justify-center h-16 whitespace-pre-wrap text-gray-500",
|
|
245
|
+
variant === 'vercel' && "text-sm flex items-center justify-center h-12 whitespace-pre-wrap text-gray-500"
|
|
246
|
+
)}
|
|
247
|
+
{...props}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
});
|
|
251
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
252
|
+
|
|
253
|
+
const CommandGroup = React.forwardRef<
|
|
254
|
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
255
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
256
|
+
>(({ className, ...props }, ref) => {
|
|
257
|
+
const { variant } = React.useContext(CommandContext);
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<CommandPrimitive.Group
|
|
261
|
+
ref={ref}
|
|
262
|
+
className={cn(commandGroupVariants({ variant }), className)}
|
|
263
|
+
{...props}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
268
|
+
|
|
269
|
+
const CommandItem = React.forwardRef<
|
|
270
|
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
271
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
272
|
+
>(({ className, ...props }, ref) => {
|
|
273
|
+
const { variant } = React.useContext(CommandContext);
|
|
274
|
+
|
|
275
|
+
return (
|
|
276
|
+
<CommandPrimitive.Item
|
|
277
|
+
ref={ref}
|
|
278
|
+
data-slot="command-item"
|
|
279
|
+
className={cn(commandItemVariants({ variant }), className)}
|
|
280
|
+
{...props}
|
|
281
|
+
/>
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
285
|
+
|
|
286
|
+
const CommandShortcut = ({
|
|
287
|
+
className,
|
|
288
|
+
...props
|
|
289
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
290
|
+
return (
|
|
291
|
+
<span
|
|
292
|
+
className={cn(
|
|
293
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
294
|
+
className
|
|
295
|
+
)}
|
|
296
|
+
{...props}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
};
|
|
300
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
301
|
+
|
|
302
|
+
const CommandSeparator = ({
|
|
303
|
+
className,
|
|
304
|
+
...props
|
|
305
|
+
}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>) => {
|
|
306
|
+
const { variant } = React.useContext(CommandContext);
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<CommandPrimitive.Separator
|
|
310
|
+
className={cn(
|
|
311
|
+
variant === 'framer' && "h-px w-full bg-gray-200 my-1",
|
|
312
|
+
variant === 'linear' && "h-px w-full bg-gray-200 my-1",
|
|
313
|
+
variant === 'raycast' && "h-px w-full bg-gray-200 my-1",
|
|
314
|
+
variant === 'vercel' && "h-px w-full bg-gray-200 my-1",
|
|
315
|
+
variant === 'default' && "-mx-1 h-px bg-border",
|
|
316
|
+
className
|
|
317
|
+
)}
|
|
318
|
+
{...props}
|
|
319
|
+
/>
|
|
320
|
+
);
|
|
321
|
+
};
|
|
322
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
323
|
+
|
|
324
|
+
const CommandDialogButton = ({ variant = 'outline', setOpen, buttonChildren, ...buttonProps }: any) => {
|
|
325
|
+
return (
|
|
326
|
+
<Button
|
|
327
|
+
onClick={() => setOpen(true)}
|
|
328
|
+
variant={variant}
|
|
329
|
+
{...buttonProps}
|
|
330
|
+
>
|
|
331
|
+
{buttonChildren}
|
|
332
|
+
</Button>
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const CommandDialog = ({ variant = 'default', buttonType = 'input', buttonChildren, children, ...props }: any) => {
|
|
337
|
+
const [open, setOpen] = React.useState(false);
|
|
338
|
+
|
|
339
|
+
React.useEffect(() => {
|
|
340
|
+
const down = (e: KeyboardEvent) => {
|
|
341
|
+
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
342
|
+
e.preventDefault();
|
|
343
|
+
setOpen((open) => !open);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
document.addEventListener("keydown", down);
|
|
347
|
+
return () => document.removeEventListener("keydown", down);
|
|
348
|
+
}, []);
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<>
|
|
352
|
+
<CommandDialogButton variant={variant} setOpen={setOpen} buttonChildren={buttonChildren} />
|
|
353
|
+
<Dialog open={open} onOpenChange={setOpen} {...props}>
|
|
354
|
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
|
355
|
+
<Command variant={variant}>
|
|
356
|
+
{children}
|
|
357
|
+
</Command>
|
|
358
|
+
</DialogContent>
|
|
359
|
+
</Dialog>
|
|
360
|
+
</>
|
|
361
|
+
);
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const CommandDialogCustom = ({ variant = 'default', children, ...props }: any) => {
|
|
365
|
+
return (
|
|
366
|
+
<Dialog {...props}>
|
|
367
|
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
|
368
|
+
<Command variant={variant}>
|
|
369
|
+
{children}
|
|
370
|
+
</Command>
|
|
371
|
+
</DialogContent>
|
|
372
|
+
</Dialog>
|
|
373
|
+
);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export {
|
|
377
|
+
Command,
|
|
378
|
+
CommandDialog,
|
|
379
|
+
CommandInput,
|
|
380
|
+
CommandList,
|
|
381
|
+
CommandEmpty,
|
|
382
|
+
CommandGroup,
|
|
383
|
+
CommandItem,
|
|
384
|
+
CommandShortcut,
|
|
385
|
+
CommandSeparator,
|
|
386
|
+
CommandDialogCustom,
|
|
387
|
+
commandVariants,
|
|
388
|
+
commandInputVariants,
|
|
389
|
+
commandInputFieldVariants,
|
|
390
|
+
commandListVariants,
|
|
391
|
+
commandItemVariants,
|
|
392
|
+
commandGroupVariants,
|
|
393
|
+
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
3
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
4
|
+
import { cn } from '~/components/catalyst-ui'
|
|
5
|
+
|
|
6
|
+
// @dev app/components/catalyst-ui/data/primitive-data.tsx:1769
|
|
7
|
+
|
|
8
|
+
function ContextMenu({
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
|
|
11
|
+
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function ContextMenuTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
|
|
17
|
+
return (
|
|
18
|
+
<ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ContextMenuGroup({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
|
|
25
|
+
return (
|
|
26
|
+
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function ContextMenuPortal({
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
|
|
33
|
+
return (
|
|
34
|
+
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ContextMenuSub({
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
|
|
41
|
+
return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ContextMenuRadioGroup({
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
|
|
47
|
+
return (
|
|
48
|
+
<ContextMenuPrimitive.RadioGroup
|
|
49
|
+
data-slot="context-menu-radio-group"
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function ContextMenuSubTrigger({
|
|
56
|
+
className,
|
|
57
|
+
inset,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
61
|
+
inset?: boolean
|
|
62
|
+
}) {
|
|
63
|
+
return (
|
|
64
|
+
<ContextMenuPrimitive.SubTrigger
|
|
65
|
+
data-slot="context-menu-sub-trigger"
|
|
66
|
+
data-inset={inset}
|
|
67
|
+
className={cn(
|
|
68
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
<ChevronRightIcon className="ml-auto" />
|
|
75
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function ContextMenuSubContent({
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
|
83
|
+
return (
|
|
84
|
+
<ContextMenuPrimitive.SubContent
|
|
85
|
+
data-slot="context-menu-sub-content"
|
|
86
|
+
className={cn(
|
|
87
|
+
"bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ContextMenuContent({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
|
99
|
+
return (
|
|
100
|
+
<ContextMenuPrimitive.Portal>
|
|
101
|
+
<ContextMenuPrimitive.Content
|
|
102
|
+
data-slot="context-menu-content"
|
|
103
|
+
className={cn(
|
|
104
|
+
"bg-popover text-popover-foreground 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 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
105
|
+
className
|
|
106
|
+
)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
</ContextMenuPrimitive.Portal>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function ContextMenuItem({
|
|
114
|
+
className,
|
|
115
|
+
inset,
|
|
116
|
+
variant = "default",
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
119
|
+
inset?: boolean
|
|
120
|
+
variant?: "default" | "destructive"
|
|
121
|
+
}) {
|
|
122
|
+
return (
|
|
123
|
+
<ContextMenuPrimitive.Item
|
|
124
|
+
data-slot="context-menu-item"
|
|
125
|
+
data-inset={inset}
|
|
126
|
+
data-variant={variant}
|
|
127
|
+
className={cn(
|
|
128
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function ContextMenuCheckboxItem({
|
|
137
|
+
className,
|
|
138
|
+
children,
|
|
139
|
+
checked,
|
|
140
|
+
...props
|
|
141
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
|
142
|
+
return (
|
|
143
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
144
|
+
data-slot="context-menu-checkbox-item"
|
|
145
|
+
className={cn(
|
|
146
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
147
|
+
className
|
|
148
|
+
)}
|
|
149
|
+
checked={checked}
|
|
150
|
+
{...props}
|
|
151
|
+
>
|
|
152
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
153
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
154
|
+
<CheckIcon className="size-4" />
|
|
155
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
156
|
+
</span>
|
|
157
|
+
{children}
|
|
158
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function ContextMenuRadioItem({
|
|
163
|
+
className,
|
|
164
|
+
children,
|
|
165
|
+
...props
|
|
166
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
|
167
|
+
return (
|
|
168
|
+
<ContextMenuPrimitive.RadioItem
|
|
169
|
+
data-slot="context-menu-radio-item"
|
|
170
|
+
className={cn(
|
|
171
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
172
|
+
className
|
|
173
|
+
)}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
177
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
178
|
+
<CircleIcon className="size-2 fill-current" />
|
|
179
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
180
|
+
</span>
|
|
181
|
+
{children}
|
|
182
|
+
</ContextMenuPrimitive.RadioItem>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function ContextMenuLabel({
|
|
187
|
+
className,
|
|
188
|
+
inset,
|
|
189
|
+
...props
|
|
190
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
191
|
+
inset?: boolean
|
|
192
|
+
}) {
|
|
193
|
+
return (
|
|
194
|
+
<ContextMenuPrimitive.Label
|
|
195
|
+
data-slot="context-menu-label"
|
|
196
|
+
data-inset={inset}
|
|
197
|
+
className={cn(
|
|
198
|
+
"text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
199
|
+
className
|
|
200
|
+
)}
|
|
201
|
+
{...props}
|
|
202
|
+
/>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function ContextMenuSeparator({
|
|
207
|
+
className,
|
|
208
|
+
...props
|
|
209
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
|
210
|
+
return (
|
|
211
|
+
<ContextMenuPrimitive.Separator
|
|
212
|
+
data-slot="context-menu-separator"
|
|
213
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
214
|
+
{...props}
|
|
215
|
+
/>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function ContextMenuShortcut({
|
|
220
|
+
className,
|
|
221
|
+
...props
|
|
222
|
+
}: React.ComponentProps<"span">) {
|
|
223
|
+
return (
|
|
224
|
+
<span
|
|
225
|
+
data-slot="context-menu-shortcut"
|
|
226
|
+
className={cn(
|
|
227
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
228
|
+
className
|
|
229
|
+
)}
|
|
230
|
+
{...props}
|
|
231
|
+
/>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup
|
|
236
|
+
}
|