@ifc-lite/viewer 1.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/LICENSE +373 -0
- package/components.json +22 -0
- package/dist/assets/arrow2_bg-BoXCojjR.wasm +0 -0
- package/dist/assets/geometry.worker-DpnHtNr3.ts +157 -0
- package/dist/assets/ifc_lite_wasm_bg-Cd3m3f2h.wasm +0 -0
- package/dist/assets/index-DKe9Oy-s.css +1 -0
- package/dist/assets/index-Dzz3WVwq.js +637 -0
- package/dist/ifc_lite_wasm_bg.wasm +0 -0
- package/dist/index.html +13 -0
- package/dist/web-ifc.wasm +0 -0
- package/index.html +12 -0
- package/package.json +52 -0
- package/postcss.config.js +6 -0
- package/public/ifc_lite_wasm_bg.wasm +0 -0
- package/public/web-ifc.wasm +0 -0
- package/src/App.tsx +13 -0
- package/src/components/Viewport.tsx +723 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/collapsible.tsx +11 -0
- package/src/components/ui/context-menu.tsx +174 -0
- package/src/components/ui/dropdown-menu.tsx +175 -0
- package/src/components/ui/input.tsx +49 -0
- package/src/components/ui/progress.tsx +26 -0
- package/src/components/ui/scroll-area.tsx +47 -0
- package/src/components/ui/separator.tsx +27 -0
- package/src/components/ui/tabs.tsx +56 -0
- package/src/components/ui/tooltip.tsx +31 -0
- package/src/components/viewer/AxisHelper.tsx +125 -0
- package/src/components/viewer/BoxSelectionOverlay.tsx +53 -0
- package/src/components/viewer/EntityContextMenu.tsx +220 -0
- package/src/components/viewer/HierarchyPanel.tsx +363 -0
- package/src/components/viewer/HoverTooltip.tsx +82 -0
- package/src/components/viewer/KeyboardShortcutsDialog.tsx +104 -0
- package/src/components/viewer/MainToolbar.tsx +441 -0
- package/src/components/viewer/PropertiesPanel.tsx +288 -0
- package/src/components/viewer/StatusBar.tsx +141 -0
- package/src/components/viewer/ToolOverlays.tsx +311 -0
- package/src/components/viewer/ViewCube.tsx +195 -0
- package/src/components/viewer/ViewerLayout.tsx +190 -0
- package/src/components/viewer/Viewport.tsx +1136 -0
- package/src/components/viewer/ViewportContainer.tsx +49 -0
- package/src/components/viewer/ViewportOverlays.tsx +185 -0
- package/src/hooks/useIfc.ts +168 -0
- package/src/hooks/useKeyboardShortcuts.ts +142 -0
- package/src/index.css +177 -0
- package/src/lib/utils.ts +45 -0
- package/src/main.tsx +18 -0
- package/src/store.ts +471 -0
- package/src/webgpu-types.d.ts +20 -0
- package/tailwind.config.js +72 -0
- package/tsconfig.json +16 -0
- package/vite.config.ts +45 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
8
|
+
import { cn } from '@/lib/utils';
|
|
9
|
+
|
|
10
|
+
const buttonVariants = cva(
|
|
11
|
+
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
16
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
17
|
+
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
19
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
20
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: 'h-9 px-4 py-2',
|
|
24
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
25
|
+
lg: 'h-10 rounded-md px-8',
|
|
26
|
+
icon: 'h-9 w-9',
|
|
27
|
+
'icon-sm': 'h-8 w-8',
|
|
28
|
+
'icon-xs': 'h-7 w-7',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: 'default',
|
|
33
|
+
size: 'default',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export interface ButtonProps
|
|
39
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
40
|
+
VariantProps<typeof buttonVariants> {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
45
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
46
|
+
const Comp = asChild ? Slot : 'button';
|
|
47
|
+
return (
|
|
48
|
+
<Comp
|
|
49
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
50
|
+
ref={ref}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
Button.displayName = 'Button';
|
|
57
|
+
|
|
58
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
6
|
+
|
|
7
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
8
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
10
|
+
|
|
11
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
7
|
+
import { Check, ChevronRight, Circle } from 'lucide-react';
|
|
8
|
+
import { cn } from '@/lib/utils';
|
|
9
|
+
|
|
10
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
11
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
12
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
13
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
14
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
15
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
16
|
+
|
|
17
|
+
const ContextMenuSubTrigger = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }
|
|
20
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
21
|
+
<ContextMenuPrimitive.SubTrigger
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
'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',
|
|
25
|
+
inset && 'pl-8',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
32
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
33
|
+
));
|
|
34
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
35
|
+
|
|
36
|
+
const ContextMenuSubContent = React.forwardRef<
|
|
37
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
38
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
39
|
+
>(({ className, ...props }, ref) => (
|
|
40
|
+
<ContextMenuPrimitive.SubContent
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn(
|
|
43
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md 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',
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
));
|
|
49
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
50
|
+
|
|
51
|
+
const ContextMenuContent = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
54
|
+
>(({ className, ...props }, ref) => (
|
|
55
|
+
<ContextMenuPrimitive.Portal>
|
|
56
|
+
<ContextMenuPrimitive.Content
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn(
|
|
59
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md 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',
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
</ContextMenuPrimitive.Portal>
|
|
65
|
+
));
|
|
66
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
67
|
+
|
|
68
|
+
const ContextMenuItem = React.forwardRef<
|
|
69
|
+
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
70
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & { inset?: boolean }
|
|
71
|
+
>(({ className, inset, ...props }, ref) => (
|
|
72
|
+
<ContextMenuPrimitive.Item
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn(
|
|
75
|
+
'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',
|
|
76
|
+
inset && 'pl-8',
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
));
|
|
82
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
83
|
+
|
|
84
|
+
const ContextMenuCheckboxItem = React.forwardRef<
|
|
85
|
+
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
87
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
88
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn(
|
|
91
|
+
'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',
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
checked={checked}
|
|
95
|
+
{...props}
|
|
96
|
+
>
|
|
97
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
98
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
99
|
+
<Check className="h-4 w-4" />
|
|
100
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
101
|
+
</span>
|
|
102
|
+
{children}
|
|
103
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
104
|
+
));
|
|
105
|
+
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
106
|
+
|
|
107
|
+
const ContextMenuRadioItem = React.forwardRef<
|
|
108
|
+
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
109
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
110
|
+
>(({ className, children, ...props }, ref) => (
|
|
111
|
+
<ContextMenuPrimitive.RadioItem
|
|
112
|
+
ref={ref}
|
|
113
|
+
className={cn(
|
|
114
|
+
'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',
|
|
115
|
+
className
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
120
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
121
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
122
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
123
|
+
</span>
|
|
124
|
+
{children}
|
|
125
|
+
</ContextMenuPrimitive.RadioItem>
|
|
126
|
+
));
|
|
127
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
128
|
+
|
|
129
|
+
const ContextMenuLabel = React.forwardRef<
|
|
130
|
+
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
131
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & { inset?: boolean }
|
|
132
|
+
>(({ className, inset, ...props }, ref) => (
|
|
133
|
+
<ContextMenuPrimitive.Label
|
|
134
|
+
ref={ref}
|
|
135
|
+
className={cn('px-2 py-1.5 text-sm font-semibold text-foreground', inset && 'pl-8', className)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
));
|
|
139
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
140
|
+
|
|
141
|
+
const ContextMenuSeparator = React.forwardRef<
|
|
142
|
+
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
143
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
144
|
+
>(({ className, ...props }, ref) => (
|
|
145
|
+
<ContextMenuPrimitive.Separator
|
|
146
|
+
ref={ref}
|
|
147
|
+
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
));
|
|
151
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
152
|
+
|
|
153
|
+
const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
154
|
+
return <span className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)} {...props} />;
|
|
155
|
+
};
|
|
156
|
+
ContextMenuShortcut.displayName = 'ContextMenuShortcut';
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
ContextMenu,
|
|
160
|
+
ContextMenuTrigger,
|
|
161
|
+
ContextMenuContent,
|
|
162
|
+
ContextMenuItem,
|
|
163
|
+
ContextMenuCheckboxItem,
|
|
164
|
+
ContextMenuRadioItem,
|
|
165
|
+
ContextMenuLabel,
|
|
166
|
+
ContextMenuSeparator,
|
|
167
|
+
ContextMenuShortcut,
|
|
168
|
+
ContextMenuGroup,
|
|
169
|
+
ContextMenuPortal,
|
|
170
|
+
ContextMenuSub,
|
|
171
|
+
ContextMenuSubContent,
|
|
172
|
+
ContextMenuSubTrigger,
|
|
173
|
+
ContextMenuRadioGroup,
|
|
174
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
7
|
+
import { Check, ChevronRight, Circle } from 'lucide-react';
|
|
8
|
+
import { cn } from '@/lib/utils';
|
|
9
|
+
|
|
10
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
12
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
13
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
14
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
15
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
16
|
+
|
|
17
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }
|
|
20
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
21
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',
|
|
25
|
+
inset && 'pl-8',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
32
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
33
|
+
));
|
|
34
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
35
|
+
|
|
36
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
37
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
38
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
39
|
+
>(({ className, ...props }, ref) => (
|
|
40
|
+
<DropdownMenuPrimitive.SubContent
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn(
|
|
43
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md 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',
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
));
|
|
49
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
50
|
+
|
|
51
|
+
const DropdownMenuContent = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
54
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
55
|
+
<DropdownMenuPrimitive.Portal>
|
|
56
|
+
<DropdownMenuPrimitive.Content
|
|
57
|
+
ref={ref}
|
|
58
|
+
sideOffset={sideOffset}
|
|
59
|
+
className={cn(
|
|
60
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md 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',
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
</DropdownMenuPrimitive.Portal>
|
|
66
|
+
));
|
|
67
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
68
|
+
|
|
69
|
+
const DropdownMenuItem = React.forwardRef<
|
|
70
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
|
|
72
|
+
>(({ className, inset, ...props }, ref) => (
|
|
73
|
+
<DropdownMenuPrimitive.Item
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
77
|
+
inset && 'pl-8',
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
));
|
|
83
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
84
|
+
|
|
85
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
86
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
87
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
88
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
89
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
90
|
+
ref={ref}
|
|
91
|
+
className={cn(
|
|
92
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 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',
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
checked={checked}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
99
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
100
|
+
<Check className="h-4 w-4" />
|
|
101
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
102
|
+
</span>
|
|
103
|
+
{children}
|
|
104
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
105
|
+
));
|
|
106
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
107
|
+
|
|
108
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
109
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
110
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
111
|
+
>(({ className, children, ...props }, ref) => (
|
|
112
|
+
<DropdownMenuPrimitive.RadioItem
|
|
113
|
+
ref={ref}
|
|
114
|
+
className={cn(
|
|
115
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 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',
|
|
116
|
+
className
|
|
117
|
+
)}
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
121
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
122
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
123
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
124
|
+
</span>
|
|
125
|
+
{children}
|
|
126
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
127
|
+
));
|
|
128
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
129
|
+
|
|
130
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
131
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
132
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
|
|
133
|
+
>(({ className, inset, ...props }, ref) => (
|
|
134
|
+
<DropdownMenuPrimitive.Label
|
|
135
|
+
ref={ref}
|
|
136
|
+
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
));
|
|
140
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
141
|
+
|
|
142
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
143
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
144
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
145
|
+
>(({ className, ...props }, ref) => (
|
|
146
|
+
<DropdownMenuPrimitive.Separator
|
|
147
|
+
ref={ref}
|
|
148
|
+
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
149
|
+
{...props}
|
|
150
|
+
/>
|
|
151
|
+
));
|
|
152
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
153
|
+
|
|
154
|
+
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
155
|
+
return <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />;
|
|
156
|
+
};
|
|
157
|
+
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
DropdownMenu,
|
|
161
|
+
DropdownMenuTrigger,
|
|
162
|
+
DropdownMenuContent,
|
|
163
|
+
DropdownMenuItem,
|
|
164
|
+
DropdownMenuCheckboxItem,
|
|
165
|
+
DropdownMenuRadioItem,
|
|
166
|
+
DropdownMenuLabel,
|
|
167
|
+
DropdownMenuSeparator,
|
|
168
|
+
DropdownMenuShortcut,
|
|
169
|
+
DropdownMenuGroup,
|
|
170
|
+
DropdownMenuPortal,
|
|
171
|
+
DropdownMenuSub,
|
|
172
|
+
DropdownMenuSubContent,
|
|
173
|
+
DropdownMenuSubTrigger,
|
|
174
|
+
DropdownMenuRadioGroup,
|
|
175
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
9
|
+
leftIcon?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
13
|
+
({ className, type, leftIcon, ...props }, ref) => {
|
|
14
|
+
if (leftIcon) {
|
|
15
|
+
return (
|
|
16
|
+
<div className="relative">
|
|
17
|
+
<div className="absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground">
|
|
18
|
+
{leftIcon}
|
|
19
|
+
</div>
|
|
20
|
+
<input
|
|
21
|
+
type={type}
|
|
22
|
+
className={cn(
|
|
23
|
+
'flex h-9 w-full rounded-md border border-input bg-transparent py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
24
|
+
'pl-8 pr-3',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
ref={ref}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<input
|
|
36
|
+
type={type}
|
|
37
|
+
className={cn(
|
|
38
|
+
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
ref={ref}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
Input.displayName = 'Input';
|
|
48
|
+
|
|
49
|
+
export { Input };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const Progress = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
12
|
+
>(({ className, value, ...props }, ref) => (
|
|
13
|
+
<ProgressPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn('relative h-2 w-full overflow-hidden rounded-full bg-primary/20', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<ProgressPrimitive.Indicator
|
|
19
|
+
className="h-full w-full flex-1 bg-primary transition-all"
|
|
20
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
21
|
+
/>
|
|
22
|
+
</ProgressPrimitive.Root>
|
|
23
|
+
));
|
|
24
|
+
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
25
|
+
|
|
26
|
+
export { Progress };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const ScrollArea = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
12
|
+
>(({ className, children, ...props }, ref) => (
|
|
13
|
+
<ScrollAreaPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn('relative overflow-hidden', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
19
|
+
{children}
|
|
20
|
+
</ScrollAreaPrimitive.Viewport>
|
|
21
|
+
<ScrollBar />
|
|
22
|
+
<ScrollAreaPrimitive.Corner />
|
|
23
|
+
</ScrollAreaPrimitive.Root>
|
|
24
|
+
));
|
|
25
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
26
|
+
|
|
27
|
+
const ScrollBar = React.forwardRef<
|
|
28
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
29
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
30
|
+
>(({ className, orientation = 'vertical', ...props }, ref) => (
|
|
31
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
32
|
+
ref={ref}
|
|
33
|
+
orientation={orientation}
|
|
34
|
+
className={cn(
|
|
35
|
+
'flex touch-none select-none transition-colors',
|
|
36
|
+
orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',
|
|
37
|
+
orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
43
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
44
|
+
));
|
|
45
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
46
|
+
|
|
47
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const Separator = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
12
|
+
>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
'shrink-0 bg-border',
|
|
19
|
+
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
26
|
+
|
|
27
|
+
export { Separator };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const Tabs = TabsPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const TabsList = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<TabsPrimitive.List
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
'inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
));
|
|
24
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
25
|
+
|
|
26
|
+
const TabsTrigger = React.forwardRef<
|
|
27
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<TabsPrimitive.Trigger
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn(
|
|
33
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow',
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
));
|
|
39
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
40
|
+
|
|
41
|
+
const TabsContent = React.forwardRef<
|
|
42
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
43
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
44
|
+
>(({ className, ...props }, ref) => (
|
|
45
|
+
<TabsPrimitive.Content
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn(
|
|
48
|
+
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
));
|
|
54
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
55
|
+
|
|
56
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
10
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
11
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
12
|
+
|
|
13
|
+
const TooltipContent = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
16
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
17
|
+
<TooltipPrimitive.Portal>
|
|
18
|
+
<TooltipPrimitive.Content
|
|
19
|
+
ref={ref}
|
|
20
|
+
sideOffset={sideOffset}
|
|
21
|
+
className={cn(
|
|
22
|
+
'z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</TooltipPrimitive.Portal>
|
|
28
|
+
));
|
|
29
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
30
|
+
|
|
31
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|