@olympusoss/canvas 2.20.2 → 4.0.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/package.json +41 -177
- package/src/cn.ts +3 -0
- package/src/index.ts +12 -603
- package/src/theme.ts +41 -0
- package/src/tokens.ts +11 -0
- package/styles/base.css +17 -0
- package/styles/canvas.css +69 -52
- package/styles/components/alert.css +66 -0
- package/styles/components/app-shell.css +46 -0
- package/styles/components/avatar.css +15 -0
- package/styles/components/badge.css +83 -0
- package/styles/components/breadcrumb.css +35 -0
- package/styles/components/button-group.css +23 -0
- package/styles/components/button.css +107 -0
- package/styles/components/calendar.css +73 -0
- package/styles/components/card.css +58 -0
- package/styles/components/checkbox.css +55 -0
- package/styles/components/code-block.css +18 -0
- package/styles/components/combobox.css +75 -0
- package/styles/components/command.css +94 -0
- package/styles/components/data-table.css +142 -0
- package/styles/components/dialog.css +72 -0
- package/styles/components/dropdown.css +54 -0
- package/styles/components/empty-state.css +17 -0
- package/styles/components/field.css +27 -0
- package/styles/components/filter-panel.css +58 -0
- package/styles/components/form.css +27 -0
- package/styles/components/icon.css +8 -0
- package/styles/components/input-group.css +45 -0
- package/styles/components/input.css +56 -0
- package/styles/components/kbd.css +15 -0
- package/styles/components/page-header.css +52 -0
- package/styles/components/pagination.css +48 -0
- package/styles/components/popover.css +14 -0
- package/styles/components/radio.css +28 -0
- package/styles/components/row-menu.css +69 -0
- package/styles/components/section-card.css +49 -0
- package/styles/components/select.css +57 -0
- package/styles/components/separator.css +32 -0
- package/styles/components/sheet.css +70 -0
- package/styles/components/sidebar.css +146 -0
- package/styles/components/skeleton.css +32 -0
- package/styles/components/spinner.css +26 -0
- package/styles/components/stat-card.css +71 -0
- package/styles/components/stepper.css +63 -0
- package/styles/components/switch.css +45 -0
- package/styles/components/tabs.css +40 -0
- package/styles/components/textarea.css +31 -0
- package/styles/components/toast.css +95 -0
- package/styles/components/tooltip.css +53 -0
- package/styles/components/topbar.css +24 -0
- package/styles/components/typography.css +105 -0
- package/styles/patterns/backdrops.css +35 -0
- package/styles/patterns/density.css +66 -0
- package/styles/patterns/focus.css +38 -0
- package/styles/patterns/glass.css +85 -0
- package/styles/patterns/high-contrast.css +70 -0
- package/styles/patterns/reduced-motion.css +12 -0
- package/styles/patterns/scrollbar.css +10 -0
- package/styles/reset.css +89 -0
- package/styles/tokens/colors.css +106 -0
- package/styles/tokens/motion.css +33 -0
- package/styles/tokens/radius.css +10 -0
- package/styles/tokens/shadows.css +35 -0
- package/styles/tokens/spacing.css +19 -0
- package/styles/tokens/typography.css +6 -0
- package/styles/tokens/z-index.css +12 -0
- package/tsconfig.json +20 -21
- package/README.md +0 -60
- package/src/components/atoms/README.md +0 -11
- package/src/components/atoms/aspect-ratio.tsx +0 -32
- package/src/components/atoms/avatar.tsx +0 -98
- package/src/components/atoms/badge.tsx +0 -44
- package/src/components/atoms/brand-mark.tsx +0 -74
- package/src/components/atoms/button.tsx +0 -105
- package/src/components/atoms/checkbox.tsx +0 -63
- package/src/components/atoms/flex-box.tsx +0 -105
- package/src/components/atoms/icon.tsx +0 -34
- package/src/components/atoms/input.tsx +0 -92
- package/src/components/atoms/label.tsx +0 -41
- package/src/components/atoms/logo.tsx +0 -89
- package/src/components/atoms/progress.tsx +0 -55
- package/src/components/atoms/radio-group.tsx +0 -122
- package/src/components/atoms/scroll-area.tsx +0 -106
- package/src/components/atoms/section.tsx +0 -48
- package/src/components/atoms/separator.tsx +0 -45
- package/src/components/atoms/skeleton.tsx +0 -17
- package/src/components/atoms/slider.tsx +0 -93
- package/src/components/atoms/spinner.tsx +0 -47
- package/src/components/atoms/switch.tsx +0 -60
- package/src/components/atoms/textarea.tsx +0 -78
- package/src/components/atoms/toggle.tsx +0 -80
- package/src/components/charts/activity-heatmap.tsx +0 -186
- package/src/components/charts/axes.tsx +0 -21
- package/src/components/charts/chart-container.tsx +0 -254
- package/src/components/charts/chart-legend.tsx +0 -67
- package/src/components/charts/chart-tooltip.tsx +0 -161
- package/src/components/charts/chart-types.tsx +0 -49
- package/src/components/charts/containers.tsx +0 -11
- package/src/components/charts/data.tsx +0 -16
- package/src/components/charts/details.tsx +0 -25
- package/src/components/charts/dot-pulse.tsx +0 -61
- package/src/components/charts/gauge.tsx +0 -106
- package/src/components/charts/grids.tsx +0 -8
- package/src/components/charts/index.ts +0 -62
- package/src/components/charts/labeled-bar-list.tsx +0 -85
- package/src/components/charts/metric-breakdown.tsx +0 -316
- package/src/components/charts/references.tsx +0 -8
- package/src/components/charts/service-health-list.tsx +0 -85
- package/src/components/charts/sparkline-area.tsx +0 -80
- package/src/components/charts/sparkline.tsx +0 -52
- package/src/components/charts/stacked-bar.tsx +0 -104
- package/src/components/charts/text.tsx +0 -10
- package/src/components/charts/world-heat-map-inner.tsx +0 -317
- package/src/components/charts/world-heat-map.tsx +0 -184
- package/src/components/molecules/README.md +0 -12
- package/src/components/molecules/action-bar.tsx +0 -73
- package/src/components/molecules/activity-item.tsx +0 -74
- package/src/components/molecules/alert.tsx +0 -86
- package/src/components/molecules/animated-background.tsx +0 -92
- package/src/components/molecules/auth-shell.tsx +0 -95
- package/src/components/molecules/brand-lockup.tsx +0 -48
- package/src/components/molecules/breadcrumb.tsx +0 -157
- package/src/components/molecules/button-group.tsx +0 -104
- package/src/components/molecules/calendar.tsx +0 -217
- package/src/components/molecules/card.tsx +0 -102
- package/src/components/molecules/client-brand.tsx +0 -95
- package/src/components/molecules/code-block.tsx +0 -86
- package/src/components/molecules/countdown-button.tsx +0 -92
- package/src/components/molecules/empty-state.tsx +0 -56
- package/src/components/molecules/error-state.tsx +0 -42
- package/src/components/molecules/field-display.tsx +0 -35
- package/src/components/molecules/input-otp.tsx +0 -74
- package/src/components/molecules/launcher-card.tsx +0 -152
- package/src/components/molecules/loading-state.tsx +0 -36
- package/src/components/molecules/notification-item.tsx +0 -67
- package/src/components/molecules/notification-list.tsx +0 -45
- package/src/components/molecules/number-badge.tsx +0 -53
- package/src/components/molecules/or-separator.tsx +0 -38
- package/src/components/molecules/page-header.tsx +0 -88
- package/src/components/molecules/page-tabs.tsx +0 -94
- package/src/components/molecules/pagination.tsx +0 -150
- package/src/components/molecules/password-input.tsx +0 -83
- package/src/components/molecules/password-strength-meter.tsx +0 -104
- package/src/components/molecules/phone-input.tsx +0 -200
- package/src/components/molecules/search-bar.tsx +0 -64
- package/src/components/molecules/secret-field.tsx +0 -158
- package/src/components/molecules/section-card.tsx +0 -91
- package/src/components/molecules/social-buttons.tsx +0 -165
- package/src/components/molecules/stat-card.tsx +0 -100
- package/src/components/molecules/status-badge.tsx +0 -42
- package/src/components/molecules/stepper.tsx +0 -96
- package/src/components/molecules/table.tsx +0 -157
- package/src/components/molecules/terminal.tsx +0 -74
- package/src/components/molecules/toggle-group.tsx +0 -145
- package/src/components/molecules/tooltip.tsx +0 -155
- package/src/components/molecules/user-avatar-chip.tsx +0 -71
- package/src/components/organisms/README.md +0 -14
- package/src/components/organisms/accordion.tsx +0 -154
- package/src/components/organisms/alert-dialog.tsx +0 -277
- package/src/components/organisms/carousel.tsx +0 -244
- package/src/components/organisms/collapsible.tsx +0 -69
- package/src/components/organisms/command.tsx +0 -144
- package/src/components/organisms/context-menu.tsx +0 -339
- package/src/components/organisms/dashboard-grid.tsx +0 -369
- package/src/components/organisms/data-table.tsx +0 -330
- package/src/components/organisms/dialog.tsx +0 -312
- package/src/components/organisms/drawer.tsx +0 -123
- package/src/components/organisms/dropdown-menu.tsx +0 -440
- package/src/components/organisms/editors/code-editor.tsx +0 -144
- package/src/components/organisms/editors/index.ts +0 -4
- package/src/components/organisms/editors/markdown-editor.tsx +0 -153
- package/src/components/organisms/editors/markdown-renderer.ts +0 -27
- package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
- package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
- package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
- package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
- package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
- package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
- package/src/components/organisms/error-boundary.tsx +0 -61
- package/src/components/organisms/form.tsx +0 -174
- package/src/components/organisms/hover-card.tsx +0 -115
- package/src/components/organisms/menubar.tsx +0 -498
- package/src/components/organisms/navbar.tsx +0 -104
- package/src/components/organisms/navigation-menu.tsx +0 -235
- package/src/components/organisms/popover.tsx +0 -149
- package/src/components/organisms/resizable.tsx +0 -58
- package/src/components/organisms/schema-form.tsx +0 -232
- package/src/components/organisms/select.tsx +0 -309
- package/src/components/organisms/sheet.tsx +0 -265
- package/src/components/organisms/sidebar.tsx +0 -1040
- package/src/components/organisms/sonner.tsx +0 -96
- package/src/components/organisms/tabs.tsx +0 -133
- package/src/components/organisms/theme-provider.tsx +0 -101
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/lib/portal-container.tsx +0 -35
- package/src/lib/utils.ts +0 -6
- package/src/native.ts +0 -23
- package/src/tokens/colors.ts +0 -91
- package/src/tokens/index.ts +0 -3
- package/src/tokens/spacing.ts +0 -55
- package/src/tokens/typography.ts +0 -27
- package/styles/dashboard-grid.css +0 -47
- package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
- package/styles/glass.css +0 -175
- package/styles/leaflet.css +0 -13
- package/styles/tokens.css +0 -317
- package/tailwind.config.ts +0 -70
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
-
import type * as React from "react";
|
|
5
|
-
|
|
6
|
-
export interface CollapsibleProps extends React.ComponentProps<typeof CollapsiblePrimitive.Root> {
|
|
7
|
-
/** Controlled open state. Pair with `onOpenChange`. */
|
|
8
|
-
open?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Initial open state for uncontrolled usage.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
defaultOpen?: boolean;
|
|
14
|
-
/** Fires whenever the collapsible opens or closes. */
|
|
15
|
-
onOpenChange?: (open: boolean) => void;
|
|
16
|
-
/**
|
|
17
|
-
* Disable the trigger.
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
/** Trigger + Content. */
|
|
22
|
-
children?: React.ReactNode;
|
|
23
|
-
className?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Collapsible = CollapsiblePrimitive.Root as React.FC<CollapsibleProps>;
|
|
27
|
-
|
|
28
|
-
export interface CollapsibleTriggerProps
|
|
29
|
-
extends React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleTrigger> {
|
|
30
|
-
/**
|
|
31
|
-
* Render as a Radix Slot — wrap a custom button while keeping the
|
|
32
|
-
* collapsible's toggle behaviour.
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
asChild?: boolean;
|
|
36
|
-
/** The button (or slot) that opens/closes the content. */
|
|
37
|
-
children?: React.ReactNode;
|
|
38
|
-
className?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const CollapsibleTrigger =
|
|
42
|
-
CollapsiblePrimitive.CollapsibleTrigger as React.ForwardRefExoticComponent<
|
|
43
|
-
CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>
|
|
44
|
-
>;
|
|
45
|
-
|
|
46
|
-
export interface CollapsibleContentProps
|
|
47
|
-
extends React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent> {
|
|
48
|
-
/**
|
|
49
|
-
* Force the content to mount even when collapsed. Useful for measuring
|
|
50
|
-
* height for animations.
|
|
51
|
-
* @default false
|
|
52
|
-
*/
|
|
53
|
-
forceMount?: true;
|
|
54
|
-
/**
|
|
55
|
-
* Render as a Radix Slot.
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
asChild?: boolean;
|
|
59
|
-
/** Content shown when expanded. */
|
|
60
|
-
children?: React.ReactNode;
|
|
61
|
-
className?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const CollapsibleContent =
|
|
65
|
-
CollapsiblePrimitive.CollapsibleContent as React.ForwardRefExoticComponent<
|
|
66
|
-
CollapsibleContentProps & React.RefAttributes<HTMLDivElement>
|
|
67
|
-
>;
|
|
68
|
-
|
|
69
|
-
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { DialogProps } from "@radix-ui/react-dialog";
|
|
4
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
5
|
-
import { Search } from "lucide-react";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
import { Dialog, DialogContent } from "./dialog";
|
|
10
|
-
|
|
11
|
-
const Command = React.forwardRef<
|
|
12
|
-
React.ElementRef<typeof CommandPrimitive>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
14
|
-
>(({ className, ...props }, ref) => (
|
|
15
|
-
<CommandPrimitive
|
|
16
|
-
ref={ref}
|
|
17
|
-
data-slot="command"
|
|
18
|
-
className={cn(
|
|
19
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
20
|
-
className,
|
|
21
|
-
)}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
));
|
|
25
|
-
Command.displayName = CommandPrimitive.displayName;
|
|
26
|
-
|
|
27
|
-
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
28
|
-
return (
|
|
29
|
-
<Dialog {...props}>
|
|
30
|
-
<DialogContent className="overflow-hidden p-0">
|
|
31
|
-
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
32
|
-
{children}
|
|
33
|
-
</Command>
|
|
34
|
-
</DialogContent>
|
|
35
|
-
</Dialog>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const CommandInput = React.forwardRef<
|
|
40
|
-
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
41
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
42
|
-
>(({ className, ...props }, ref) => (
|
|
43
|
-
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
44
|
-
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
45
|
-
<CommandPrimitive.Input
|
|
46
|
-
ref={ref}
|
|
47
|
-
className={cn(
|
|
48
|
-
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
49
|
-
className,
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
));
|
|
55
|
-
|
|
56
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
57
|
-
|
|
58
|
-
const CommandList = React.forwardRef<
|
|
59
|
-
React.ElementRef<typeof CommandPrimitive.List>,
|
|
60
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
61
|
-
>(({ className, ...props }, ref) => (
|
|
62
|
-
<CommandPrimitive.List
|
|
63
|
-
ref={ref}
|
|
64
|
-
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
));
|
|
68
|
-
|
|
69
|
-
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
70
|
-
|
|
71
|
-
const CommandEmpty = React.forwardRef<
|
|
72
|
-
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
73
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
74
|
-
>((props, ref) => (
|
|
75
|
-
<CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
|
|
76
|
-
));
|
|
77
|
-
|
|
78
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
79
|
-
|
|
80
|
-
const CommandGroup = React.forwardRef<
|
|
81
|
-
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
82
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
83
|
-
>(({ className, ...props }, ref) => (
|
|
84
|
-
<CommandPrimitive.Group
|
|
85
|
-
ref={ref}
|
|
86
|
-
className={cn(
|
|
87
|
-
"overflow-hidden p-1 text-foreground [&_[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",
|
|
88
|
-
className,
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
));
|
|
93
|
-
|
|
94
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
95
|
-
|
|
96
|
-
const CommandSeparator = React.forwardRef<
|
|
97
|
-
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
98
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
99
|
-
>(({ className, ...props }, ref) => (
|
|
100
|
-
<CommandPrimitive.Separator
|
|
101
|
-
ref={ref}
|
|
102
|
-
className={cn("-mx-1 h-px bg-border", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
));
|
|
106
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
107
|
-
|
|
108
|
-
const CommandItem = React.forwardRef<
|
|
109
|
-
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
110
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
111
|
-
>(({ className, ...props }, ref) => (
|
|
112
|
-
<CommandPrimitive.Item
|
|
113
|
-
ref={ref}
|
|
114
|
-
className={cn(
|
|
115
|
-
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
116
|
-
className,
|
|
117
|
-
)}
|
|
118
|
-
{...props}
|
|
119
|
-
/>
|
|
120
|
-
));
|
|
121
|
-
|
|
122
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
123
|
-
|
|
124
|
-
const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
125
|
-
return (
|
|
126
|
-
<span
|
|
127
|
-
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
CommandShortcut.displayName = "CommandShortcut";
|
|
133
|
-
|
|
134
|
-
export {
|
|
135
|
-
Command,
|
|
136
|
-
CommandDialog,
|
|
137
|
-
CommandEmpty,
|
|
138
|
-
CommandGroup,
|
|
139
|
-
CommandInput,
|
|
140
|
-
CommandItem,
|
|
141
|
-
CommandList,
|
|
142
|
-
CommandSeparator,
|
|
143
|
-
CommandShortcut,
|
|
144
|
-
};
|
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
4
|
-
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
|
|
7
|
-
import { usePortalContainer } from "../../lib/portal-container";
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
|
|
10
|
-
export interface ContextMenuProps extends React.ComponentProps<typeof ContextMenuPrimitive.Root> {
|
|
11
|
-
/** Reading direction. */
|
|
12
|
-
dir?: "ltr" | "rtl";
|
|
13
|
-
/** Fires when the user opens or closes the menu via right-click / long-press. */
|
|
14
|
-
onOpenChange?: (open: boolean) => void;
|
|
15
|
-
/**
|
|
16
|
-
* When true, blocks focus from leaving the menu.
|
|
17
|
-
* @default true
|
|
18
|
-
*/
|
|
19
|
-
modal?: boolean;
|
|
20
|
-
/** Trigger + Content. */
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const ContextMenu = ContextMenuPrimitive.Root as React.FC<ContextMenuProps>;
|
|
25
|
-
|
|
26
|
-
export interface ContextMenuTriggerProps
|
|
27
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Trigger> {
|
|
28
|
-
/**
|
|
29
|
-
* Disable the right-click trigger.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
asChild?: boolean;
|
|
34
|
-
/** The element that opens the context menu on right-click / long-press. */
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
className?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger as React.ForwardRefExoticComponent<
|
|
40
|
-
ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>
|
|
41
|
-
>;
|
|
42
|
-
|
|
43
|
-
export interface ContextMenuGroupProps
|
|
44
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Group> {
|
|
45
|
-
children?: React.ReactNode;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group as React.ForwardRefExoticComponent<
|
|
49
|
-
ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>
|
|
50
|
-
>;
|
|
51
|
-
|
|
52
|
-
export interface ContextMenuPortalProps
|
|
53
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal> {
|
|
54
|
-
container?: HTMLElement | null;
|
|
55
|
-
forceMount?: true;
|
|
56
|
-
children?: React.ReactNode;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal as React.FC<ContextMenuPortalProps>;
|
|
60
|
-
|
|
61
|
-
export interface ContextMenuSubProps extends React.ComponentProps<typeof ContextMenuPrimitive.Sub> {
|
|
62
|
-
open?: boolean;
|
|
63
|
-
defaultOpen?: boolean;
|
|
64
|
-
onOpenChange?: (open: boolean) => void;
|
|
65
|
-
children?: React.ReactNode;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub as React.FC<ContextMenuSubProps>;
|
|
69
|
-
|
|
70
|
-
export interface ContextMenuRadioGroupProps
|
|
71
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioGroup> {
|
|
72
|
-
value?: string;
|
|
73
|
-
onValueChange?: (value: string) => void;
|
|
74
|
-
children?: React.ReactNode;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup as React.ForwardRefExoticComponent<
|
|
78
|
-
ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>
|
|
79
|
-
>;
|
|
80
|
-
|
|
81
|
-
export interface ContextMenuSubTriggerProps
|
|
82
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> {
|
|
83
|
-
/**
|
|
84
|
-
* Add left padding to align with sibling checkbox/radio items.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
inset?: boolean;
|
|
88
|
-
disabled?: boolean;
|
|
89
|
-
asChild?: boolean;
|
|
90
|
-
children?: React.ReactNode;
|
|
91
|
-
className?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const ContextMenuSubTrigger = React.forwardRef<
|
|
95
|
-
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
96
|
-
ContextMenuSubTriggerProps
|
|
97
|
-
>(({ className, inset, children, ...props }, ref) => (
|
|
98
|
-
<ContextMenuPrimitive.SubTrigger
|
|
99
|
-
ref={ref}
|
|
100
|
-
className={cn(
|
|
101
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
102
|
-
inset && "pl-8",
|
|
103
|
-
className,
|
|
104
|
-
)}
|
|
105
|
-
{...props}
|
|
106
|
-
>
|
|
107
|
-
{children}
|
|
108
|
-
<ChevronRight className="ml-auto h-4 w-4" />
|
|
109
|
-
</ContextMenuPrimitive.SubTrigger>
|
|
110
|
-
));
|
|
111
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
112
|
-
|
|
113
|
-
export interface ContextMenuSubContentProps
|
|
114
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> {
|
|
115
|
-
sideOffset?: number;
|
|
116
|
-
alignOffset?: number;
|
|
117
|
-
avoidCollisions?: boolean;
|
|
118
|
-
forceMount?: true;
|
|
119
|
-
asChild?: boolean;
|
|
120
|
-
children?: React.ReactNode;
|
|
121
|
-
className?: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const ContextMenuSubContent = React.forwardRef<
|
|
125
|
-
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
126
|
-
ContextMenuSubContentProps
|
|
127
|
-
>(({ className, ...props }, ref) => (
|
|
128
|
-
<ContextMenuPrimitive.SubContent
|
|
129
|
-
ref={ref}
|
|
130
|
-
data-slot="context-menu-sub-content"
|
|
131
|
-
className={cn(
|
|
132
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 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 origin-[var(--radix-context-menu-content-transform-origin)]",
|
|
133
|
-
className,
|
|
134
|
-
)}
|
|
135
|
-
{...props}
|
|
136
|
-
/>
|
|
137
|
-
));
|
|
138
|
-
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
139
|
-
|
|
140
|
-
export interface ContextMenuContentProps
|
|
141
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> {
|
|
142
|
-
/** Distance from the alignment edge (px). */
|
|
143
|
-
alignOffset?: number;
|
|
144
|
-
avoidCollisions?: boolean;
|
|
145
|
-
collisionPadding?: number | { top?: number; right?: number; bottom?: number; left?: number };
|
|
146
|
-
loop?: boolean;
|
|
147
|
-
forceMount?: true;
|
|
148
|
-
asChild?: boolean;
|
|
149
|
-
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
150
|
-
onPointerDownOutside?: (event: CustomEvent<{ originalEvent: PointerEvent }>) => void;
|
|
151
|
-
onInteractOutside?: (event: Event) => void;
|
|
152
|
-
children?: React.ReactNode;
|
|
153
|
-
className?: string;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const ContextMenuContent = React.forwardRef<
|
|
157
|
-
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
158
|
-
ContextMenuContentProps
|
|
159
|
-
>(({ className, ...props }, ref) => {
|
|
160
|
-
const container = usePortalContainer();
|
|
161
|
-
return (
|
|
162
|
-
<ContextMenuPrimitive.Portal container={container ?? undefined}>
|
|
163
|
-
<ContextMenuPrimitive.Content
|
|
164
|
-
ref={ref}
|
|
165
|
-
data-slot="context-menu-content"
|
|
166
|
-
className={cn(
|
|
167
|
-
"z-50 max-h-[var(--radix-context-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[var(--radix-context-menu-content-transform-origin)]",
|
|
168
|
-
className,
|
|
169
|
-
)}
|
|
170
|
-
{...props}
|
|
171
|
-
/>
|
|
172
|
-
</ContextMenuPrimitive.Portal>
|
|
173
|
-
);
|
|
174
|
-
});
|
|
175
|
-
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
176
|
-
|
|
177
|
-
export interface ContextMenuItemProps
|
|
178
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> {
|
|
179
|
-
/** Add left padding to align with checkbox/radio items. */
|
|
180
|
-
inset?: boolean;
|
|
181
|
-
disabled?: boolean;
|
|
182
|
-
onSelect?: (event: Event) => void;
|
|
183
|
-
asChild?: boolean;
|
|
184
|
-
children?: React.ReactNode;
|
|
185
|
-
className?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const ContextMenuItem = React.forwardRef<
|
|
189
|
-
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
190
|
-
ContextMenuItemProps
|
|
191
|
-
>(({ className, inset, ...props }, ref) => (
|
|
192
|
-
<ContextMenuPrimitive.Item
|
|
193
|
-
ref={ref}
|
|
194
|
-
className={cn(
|
|
195
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
196
|
-
inset && "pl-8",
|
|
197
|
-
className,
|
|
198
|
-
)}
|
|
199
|
-
{...props}
|
|
200
|
-
/>
|
|
201
|
-
));
|
|
202
|
-
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
203
|
-
|
|
204
|
-
export interface ContextMenuCheckboxItemProps
|
|
205
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem> {
|
|
206
|
-
checked?: boolean | "indeterminate";
|
|
207
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
208
|
-
disabled?: boolean;
|
|
209
|
-
onSelect?: (event: Event) => void;
|
|
210
|
-
asChild?: boolean;
|
|
211
|
-
children?: React.ReactNode;
|
|
212
|
-
className?: string;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const ContextMenuCheckboxItem = React.forwardRef<
|
|
216
|
-
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
217
|
-
ContextMenuCheckboxItemProps
|
|
218
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
219
|
-
<ContextMenuPrimitive.CheckboxItem
|
|
220
|
-
ref={ref}
|
|
221
|
-
className={cn(
|
|
222
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
223
|
-
className,
|
|
224
|
-
)}
|
|
225
|
-
checked={checked}
|
|
226
|
-
{...props}
|
|
227
|
-
>
|
|
228
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
229
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
230
|
-
<Check className="h-4 w-4" />
|
|
231
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
232
|
-
</span>
|
|
233
|
-
{children}
|
|
234
|
-
</ContextMenuPrimitive.CheckboxItem>
|
|
235
|
-
));
|
|
236
|
-
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
237
|
-
|
|
238
|
-
export interface ContextMenuRadioItemProps
|
|
239
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem> {
|
|
240
|
-
value: string;
|
|
241
|
-
disabled?: boolean;
|
|
242
|
-
onSelect?: (event: Event) => void;
|
|
243
|
-
asChild?: boolean;
|
|
244
|
-
children?: React.ReactNode;
|
|
245
|
-
className?: string;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const ContextMenuRadioItem = React.forwardRef<
|
|
249
|
-
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
250
|
-
ContextMenuRadioItemProps
|
|
251
|
-
>(({ className, children, ...props }, ref) => (
|
|
252
|
-
<ContextMenuPrimitive.RadioItem
|
|
253
|
-
ref={ref}
|
|
254
|
-
className={cn(
|
|
255
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
256
|
-
className,
|
|
257
|
-
)}
|
|
258
|
-
{...props}
|
|
259
|
-
>
|
|
260
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
261
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
262
|
-
<Circle className="h-4 w-4 fill-current" />
|
|
263
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
264
|
-
</span>
|
|
265
|
-
{children}
|
|
266
|
-
</ContextMenuPrimitive.RadioItem>
|
|
267
|
-
));
|
|
268
|
-
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
269
|
-
|
|
270
|
-
export interface ContextMenuLabelProps
|
|
271
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> {
|
|
272
|
-
inset?: boolean;
|
|
273
|
-
asChild?: boolean;
|
|
274
|
-
children?: React.ReactNode;
|
|
275
|
-
className?: string;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const ContextMenuLabel = React.forwardRef<
|
|
279
|
-
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
280
|
-
ContextMenuLabelProps
|
|
281
|
-
>(({ className, inset, ...props }, ref) => (
|
|
282
|
-
<ContextMenuPrimitive.Label
|
|
283
|
-
ref={ref}
|
|
284
|
-
className={cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-8", className)}
|
|
285
|
-
{...props}
|
|
286
|
-
/>
|
|
287
|
-
));
|
|
288
|
-
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
289
|
-
|
|
290
|
-
export interface ContextMenuSeparatorProps
|
|
291
|
-
extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator> {
|
|
292
|
-
asChild?: boolean;
|
|
293
|
-
className?: string;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const ContextMenuSeparator = React.forwardRef<
|
|
297
|
-
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
298
|
-
ContextMenuSeparatorProps
|
|
299
|
-
>(({ className, ...props }, ref) => (
|
|
300
|
-
<ContextMenuPrimitive.Separator
|
|
301
|
-
ref={ref}
|
|
302
|
-
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
303
|
-
{...props}
|
|
304
|
-
/>
|
|
305
|
-
));
|
|
306
|
-
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
307
|
-
|
|
308
|
-
export interface ContextMenuShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
309
|
-
children?: React.ReactNode;
|
|
310
|
-
className?: string;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const ContextMenuShortcut = ({ className, ...props }: ContextMenuShortcutProps) => {
|
|
314
|
-
return (
|
|
315
|
-
<span
|
|
316
|
-
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
317
|
-
{...props}
|
|
318
|
-
/>
|
|
319
|
-
);
|
|
320
|
-
};
|
|
321
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
322
|
-
|
|
323
|
-
export {
|
|
324
|
-
ContextMenu,
|
|
325
|
-
ContextMenuCheckboxItem,
|
|
326
|
-
ContextMenuContent,
|
|
327
|
-
ContextMenuGroup,
|
|
328
|
-
ContextMenuItem,
|
|
329
|
-
ContextMenuLabel,
|
|
330
|
-
ContextMenuPortal,
|
|
331
|
-
ContextMenuRadioGroup,
|
|
332
|
-
ContextMenuRadioItem,
|
|
333
|
-
ContextMenuSeparator,
|
|
334
|
-
ContextMenuShortcut,
|
|
335
|
-
ContextMenuSub,
|
|
336
|
-
ContextMenuSubContent,
|
|
337
|
-
ContextMenuSubTrigger,
|
|
338
|
-
ContextMenuTrigger,
|
|
339
|
-
};
|