@xemahq/ui-kernel 0.1.12 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/biome-host/errors.d.ts +2 -0
- package/dist/lib/biome-host/errors.d.ts.map +1 -0
- package/dist/lib/biome-host/errors.js +146 -0
- package/dist/lib/biome-host/errors.js.map +1 -0
- package/dist/lib/biome-host/host-bridge.d.ts +8 -0
- package/dist/lib/biome-host/host-bridge.d.ts.map +1 -1
- package/dist/lib/biome-host/host-bridge.js.map +1 -1
- package/dist/lib/biome-host/index.d.ts +4 -0
- package/dist/lib/biome-host/index.d.ts.map +1 -1
- package/dist/lib/biome-host/index.js +4 -0
- package/dist/lib/biome-host/index.js.map +1 -1
- package/dist/lib/biome-host/realtime-hooks.d.ts +5 -0
- package/dist/lib/biome-host/realtime-hooks.d.ts.map +1 -0
- package/dist/lib/biome-host/realtime-hooks.js +28 -0
- package/dist/lib/biome-host/realtime-hooks.js.map +1 -0
- package/dist/lib/biome-host/realtime-port.d.ts +30 -0
- package/dist/lib/biome-host/realtime-port.d.ts.map +1 -0
- package/dist/lib/biome-host/realtime-port.js +3 -0
- package/dist/lib/biome-host/realtime-port.js.map +1 -0
- package/dist/lib/biome-host/response-envelope.d.ts +3 -0
- package/dist/lib/biome-host/response-envelope.d.ts.map +1 -0
- package/dist/lib/biome-host/response-envelope.js +25 -0
- package/dist/lib/biome-host/response-envelope.js.map +1 -0
- package/dist/lib/capabilities/capability-provider.d.ts +15 -0
- package/dist/lib/capabilities/capability-provider.d.ts.map +1 -0
- package/dist/lib/capabilities/capability-provider.js +36 -0
- package/dist/lib/capabilities/capability-provider.js.map +1 -0
- package/dist/lib/capabilities/index.d.ts +4 -0
- package/dist/lib/capabilities/index.d.ts.map +1 -0
- package/dist/lib/capabilities/index.js +20 -0
- package/dist/lib/capabilities/index.js.map +1 -0
- package/dist/lib/capabilities/types.d.ts +18 -0
- package/dist/lib/capabilities/types.d.ts.map +1 -0
- package/dist/lib/capabilities/types.js +3 -0
- package/dist/lib/capabilities/types.js.map +1 -0
- package/dist/lib/capabilities/use-capability.d.ts +18 -0
- package/dist/lib/capabilities/use-capability.d.ts.map +1 -0
- package/dist/lib/capabilities/use-capability.js +21 -0
- package/dist/lib/capabilities/use-capability.js.map +1 -0
- package/dist/ui/chrome/AsyncBoundary.d.ts +22 -0
- package/dist/ui/chrome/AsyncBoundary.d.ts.map +1 -0
- package/dist/ui/chrome/AsyncBoundary.js +23 -0
- package/dist/ui/chrome/AsyncBoundary.js.map +1 -0
- package/dist/ui/chrome/EmptyState.d.ts +34 -0
- package/dist/ui/chrome/EmptyState.d.ts.map +1 -0
- package/dist/ui/chrome/EmptyState.js +27 -0
- package/dist/ui/chrome/EmptyState.js.map +1 -0
- package/dist/ui/chrome/ErrorCard.d.ts +11 -0
- package/dist/ui/chrome/ErrorCard.d.ts.map +1 -0
- package/dist/ui/chrome/ErrorCard.js +14 -0
- package/dist/ui/chrome/ErrorCard.js.map +1 -0
- package/dist/ui/chrome/LoadingState.d.ts +10 -0
- package/dist/ui/chrome/LoadingState.d.ts.map +1 -0
- package/dist/ui/chrome/LoadingState.js +17 -0
- package/dist/ui/chrome/LoadingState.js.map +1 -0
- package/dist/ui/chrome/PageHeader.d.ts +20 -0
- package/dist/ui/chrome/PageHeader.d.ts.map +1 -0
- package/dist/ui/chrome/PageHeader.js +26 -0
- package/dist/ui/chrome/PageHeader.js.map +1 -0
- package/dist/ui/chrome/StateCard.d.ts +24 -0
- package/dist/ui/chrome/StateCard.d.ts.map +1 -0
- package/dist/ui/chrome/StateCard.js +17 -0
- package/dist/ui/chrome/StateCard.js.map +1 -0
- package/dist/ui/cn.d.ts +3 -0
- package/dist/ui/cn.d.ts.map +1 -0
- package/dist/ui/cn.js +18 -0
- package/dist/ui/cn.js.map +1 -0
- package/dist/ui/index.d.ts +33 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +61 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/primitives/alert-dialog.d.ts +21 -0
- package/dist/ui/primitives/alert-dialog.d.ts.map +1 -0
- package/dist/ui/primitives/alert-dialog.js +72 -0
- package/dist/ui/primitives/alert-dialog.js.map +1 -0
- package/dist/ui/primitives/badge.d.ts +10 -0
- package/dist/ui/primitives/badge.d.ts.map +1 -0
- package/dist/ui/primitives/badge.js +60 -0
- package/dist/ui/primitives/badge.js.map +1 -0
- package/dist/ui/primitives/button.d.ts +12 -0
- package/dist/ui/primitives/button.d.ts.map +1 -0
- package/dist/ui/primitives/button.js +71 -0
- package/dist/ui/primitives/button.js.map +1 -0
- package/dist/ui/primitives/card.d.ts +9 -0
- package/dist/ui/primitives/card.d.ts.map +1 -0
- package/dist/ui/primitives/card.js +58 -0
- package/dist/ui/primitives/card.js.map +1 -0
- package/dist/ui/primitives/checkbox.d.ts +5 -0
- package/dist/ui/primitives/checkbox.d.ts.map +1 -0
- package/dist/ui/primitives/checkbox.js +45 -0
- package/dist/ui/primitives/checkbox.js.map +1 -0
- package/dist/ui/primitives/collapsible.d.ts +6 -0
- package/dist/ui/primitives/collapsible.d.ts.map +1 -0
- package/dist/ui/primitives/collapsible.js +44 -0
- package/dist/ui/primitives/collapsible.js.map +1 -0
- package/dist/ui/primitives/dialog.d.ts +22 -0
- package/dist/ui/primitives/dialog.d.ts.map +1 -0
- package/dist/ui/primitives/dialog.js +68 -0
- package/dist/ui/primitives/dialog.js.map +1 -0
- package/dist/ui/primitives/dropdown-menu.d.ts +28 -0
- package/dist/ui/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/ui/primitives/dropdown-menu.js +83 -0
- package/dist/ui/primitives/dropdown-menu.js.map +1 -0
- package/dist/ui/primitives/input.d.ts +4 -0
- package/dist/ui/primitives/input.d.ts.map +1 -0
- package/dist/ui/primitives/input.js +45 -0
- package/dist/ui/primitives/input.js.map +1 -0
- package/dist/ui/primitives/label.d.ts +6 -0
- package/dist/ui/primitives/label.d.ts.map +1 -0
- package/dist/ui/primitives/label.js +46 -0
- package/dist/ui/primitives/label.js.map +1 -0
- package/dist/ui/primitives/overflow-tabs.d.ts +18 -0
- package/dist/ui/primitives/overflow-tabs.d.ts.map +1 -0
- package/dist/ui/primitives/overflow-tabs.js +84 -0
- package/dist/ui/primitives/overflow-tabs.js.map +1 -0
- package/dist/ui/primitives/popover.d.ts +9 -0
- package/dist/ui/primitives/popover.d.ts.map +1 -0
- package/dist/ui/primitives/popover.js +48 -0
- package/dist/ui/primitives/popover.js.map +1 -0
- package/dist/ui/primitives/radio-group.d.ts +6 -0
- package/dist/ui/primitives/radio-group.d.ts.map +1 -0
- package/dist/ui/primitives/radio-group.js +52 -0
- package/dist/ui/primitives/radio-group.js.map +1 -0
- package/dist/ui/primitives/resizable.d.ts +12 -0
- package/dist/ui/primitives/resizable.d.ts.map +1 -0
- package/dist/ui/primitives/resizable.js +18 -0
- package/dist/ui/primitives/resizable.js.map +1 -0
- package/dist/ui/primitives/scroll-area.d.ts +6 -0
- package/dist/ui/primitives/scroll-area.d.ts.map +1 -0
- package/dist/ui/primitives/scroll-area.js +47 -0
- package/dist/ui/primitives/scroll-area.js.map +1 -0
- package/dist/ui/primitives/select.d.ts +14 -0
- package/dist/ui/primitives/select.d.ts.map +1 -0
- package/dist/ui/primitives/select.js +71 -0
- package/dist/ui/primitives/select.js.map +1 -0
- package/dist/ui/primitives/separator.d.ts +5 -0
- package/dist/ui/primitives/separator.d.ts.map +1 -0
- package/dist/ui/primitives/separator.js +44 -0
- package/dist/ui/primitives/separator.js.map +1 -0
- package/dist/ui/primitives/sheet.d.ts +26 -0
- package/dist/ui/primitives/sheet.d.ts.map +1 -0
- package/dist/ui/primitives/sheet.js +82 -0
- package/dist/ui/primitives/sheet.js.map +1 -0
- package/dist/ui/primitives/skeleton.d.ts +13 -0
- package/dist/ui/primitives/skeleton.d.ts.map +1 -0
- package/dist/ui/primitives/skeleton.js +29 -0
- package/dist/ui/primitives/skeleton.js.map +1 -0
- package/dist/ui/primitives/switch.d.ts +5 -0
- package/dist/ui/primitives/switch.d.ts.map +1 -0
- package/dist/ui/primitives/switch.js +44 -0
- package/dist/ui/primitives/switch.js.map +1 -0
- package/dist/ui/primitives/table.d.ts +11 -0
- package/dist/ui/primitives/table.d.ts.map +1 -0
- package/dist/ui/primitives/table.js +64 -0
- package/dist/ui/primitives/table.js.map +1 -0
- package/dist/ui/primitives/tabs.d.ts +8 -0
- package/dist/ui/primitives/tabs.d.ts.map +1 -0
- package/dist/ui/primitives/tabs.js +52 -0
- package/dist/ui/primitives/tabs.js.map +1 -0
- package/dist/ui/primitives/tag-multi-select.d.ts +19 -0
- package/dist/ui/primitives/tag-multi-select.d.ts.map +1 -0
- package/dist/ui/primitives/tag-multi-select.js +92 -0
- package/dist/ui/primitives/tag-multi-select.js.map +1 -0
- package/dist/ui/primitives/textarea.d.ts +5 -0
- package/dist/ui/primitives/textarea.d.ts.map +1 -0
- package/dist/ui/primitives/textarea.js +45 -0
- package/dist/ui/primitives/textarea.js.map +1 -0
- package/dist/ui/primitives/tooltip.d.ts +8 -0
- package/dist/ui/primitives/tooltip.d.ts.map +1 -0
- package/dist/ui/primitives/tooltip.js +50 -0
- package/dist/ui/primitives/tooltip.js.map +1 -0
- package/package.json +24 -1
- package/src/index.ts +1 -0
- package/src/lib/biome-host/errors.ts +220 -0
- package/src/lib/biome-host/host-bridge.ts +54 -0
- package/src/lib/biome-host/index.ts +4 -0
- package/src/lib/biome-host/realtime-hooks.ts +74 -0
- package/src/lib/biome-host/realtime-port.ts +109 -0
- package/src/lib/biome-host/response-envelope.ts +69 -0
- package/src/lib/capabilities/capability-provider.tsx +95 -0
- package/src/lib/capabilities/index.ts +16 -0
- package/src/lib/capabilities/types.ts +69 -0
- package/src/lib/capabilities/use-capability.ts +72 -0
- package/src/ui/chrome/AsyncBoundary.tsx +66 -0
- package/src/ui/chrome/EmptyState.tsx +184 -0
- package/src/ui/chrome/ErrorCard.tsx +63 -0
- package/src/ui/chrome/LoadingState.tsx +61 -0
- package/src/ui/chrome/PageHeader.tsx +137 -0
- package/src/ui/chrome/StateCard.tsx +150 -0
- package/src/ui/cn.ts +32 -0
- package/src/ui/index.ts +53 -0
- package/src/ui/primitives/alert-dialog.tsx +104 -0
- package/src/ui/primitives/badge.tsx +32 -0
- package/src/ui/primitives/button.tsx +47 -0
- package/src/ui/primitives/card.tsx +43 -0
- package/src/ui/primitives/checkbox.tsx +26 -0
- package/src/ui/primitives/collapsible.tsx +9 -0
- package/src/ui/primitives/dialog.tsx +103 -0
- package/src/ui/primitives/dropdown-menu.tsx +179 -0
- package/src/ui/primitives/input.tsx +22 -0
- package/src/ui/primitives/label.tsx +17 -0
- package/src/ui/primitives/overflow-tabs.tsx +281 -0
- package/src/ui/primitives/popover.tsx +33 -0
- package/src/ui/primitives/radio-group.tsx +36 -0
- package/src/ui/primitives/resizable.tsx +67 -0
- package/src/ui/primitives/scroll-area.tsx +38 -0
- package/src/ui/primitives/select.tsx +143 -0
- package/src/ui/primitives/separator.tsx +20 -0
- package/src/ui/primitives/sheet.tsx +107 -0
- package/src/ui/primitives/skeleton.tsx +99 -0
- package/src/ui/primitives/switch.tsx +27 -0
- package/src/ui/primitives/table.tsx +72 -0
- package/src/ui/primitives/tabs.tsx +53 -0
- package/src/ui/primitives/tag-multi-select.tsx +241 -0
- package/src/ui/primitives/textarea.tsx +21 -0
- package/src/ui/primitives/tooltip.tsx +30 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
2
|
+
import { Circle } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from '../cn';
|
|
6
|
+
|
|
7
|
+
const RadioGroup = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
10
|
+
>(({ className, ...props }, ref) => {
|
|
11
|
+
return <RadioGroupPrimitive.Root className={cn("grid gap-2", className)} {...props} ref={ref} />;
|
|
12
|
+
});
|
|
13
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
14
|
+
|
|
15
|
+
const RadioGroupItem = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
18
|
+
>(({ className, ...props }, ref) => {
|
|
19
|
+
return (
|
|
20
|
+
<RadioGroupPrimitive.Item
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
29
|
+
<Circle className="h-4 w-4 fill-current text-current" />
|
|
30
|
+
</RadioGroupPrimitive.Indicator>
|
|
31
|
+
</RadioGroupPrimitive.Item>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
35
|
+
|
|
36
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { GripVertical, GripHorizontal } from "lucide-react"
|
|
2
|
+
import { Group, Panel, Separator } from "react-resizable-panels"
|
|
3
|
+
|
|
4
|
+
import { cn } from '../cn'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper around react-resizable-panels v4.
|
|
8
|
+
*
|
|
9
|
+
* v4 API changes from v2/v3:
|
|
10
|
+
* - PanelGroup → Group
|
|
11
|
+
* - Panel (unchanged)
|
|
12
|
+
* - PanelResizeHandle → Separator
|
|
13
|
+
* - `direction` prop → `orientation` prop
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
type Direction = "horizontal" | "vertical"
|
|
17
|
+
|
|
18
|
+
const ResizablePanelGroup = ({
|
|
19
|
+
className,
|
|
20
|
+
direction,
|
|
21
|
+
...props
|
|
22
|
+
}: Omit<React.ComponentProps<typeof Group>, "orientation"> & {
|
|
23
|
+
direction?: Direction
|
|
24
|
+
}) => (
|
|
25
|
+
<Group
|
|
26
|
+
orientation={direction}
|
|
27
|
+
className={cn("flex h-full w-full", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const ResizablePanel = Panel
|
|
33
|
+
|
|
34
|
+
const ResizableHandle = ({
|
|
35
|
+
withHandle,
|
|
36
|
+
className,
|
|
37
|
+
direction,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof Separator> & {
|
|
40
|
+
withHandle?: boolean
|
|
41
|
+
direction?: Direction
|
|
42
|
+
}) => (
|
|
43
|
+
<Separator
|
|
44
|
+
className={cn(
|
|
45
|
+
"relative flex items-center justify-center bg-border/60 hover:bg-border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 transition-colors",
|
|
46
|
+
direction === "vertical"
|
|
47
|
+
? "h-px w-full cursor-row-resize after:absolute after:left-0 after:h-2 after:w-full after:-translate-y-1/2"
|
|
48
|
+
: "w-[3px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2",
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
{withHandle && (
|
|
54
|
+
<div className={cn(
|
|
55
|
+
"z-10 flex items-center justify-center rounded-sm border bg-border",
|
|
56
|
+
direction === "vertical" ? "w-4 h-3" : "h-4 w-3"
|
|
57
|
+
)}>
|
|
58
|
+
{direction === "vertical"
|
|
59
|
+
? <GripHorizontal className="h-4 w-4" />
|
|
60
|
+
: <GripVertical className="h-4 w-4" />
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</Separator>
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
|
|
6
|
+
const ScrollArea = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
9
|
+
>(({ className, children, ...props }, ref) => (
|
|
10
|
+
<ScrollAreaPrimitive.Root ref={ref} className={cn("relative overflow-hidden", className)} {...props}>
|
|
11
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
|
|
12
|
+
<ScrollBar />
|
|
13
|
+
<ScrollAreaPrimitive.Corner />
|
|
14
|
+
</ScrollAreaPrimitive.Root>
|
|
15
|
+
));
|
|
16
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
17
|
+
|
|
18
|
+
const ScrollBar = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
21
|
+
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
22
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
23
|
+
ref={ref}
|
|
24
|
+
orientation={orientation}
|
|
25
|
+
className={cn(
|
|
26
|
+
"flex touch-none select-none transition-colors",
|
|
27
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
28
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
34
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
35
|
+
));
|
|
36
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
37
|
+
|
|
38
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from '../cn';
|
|
6
|
+
|
|
7
|
+
const Select = SelectPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
10
|
+
|
|
11
|
+
const SelectValue = SelectPrimitive.Value;
|
|
12
|
+
|
|
13
|
+
const SelectTrigger = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
+
>(({ className, children, ...props }, ref) => (
|
|
17
|
+
<SelectPrimitive.Trigger
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-body-1 ring-offset-background placeholder:text-ink-3 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<SelectPrimitive.Icon asChild>
|
|
27
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
+
</SelectPrimitive.Icon>
|
|
29
|
+
</SelectPrimitive.Trigger>
|
|
30
|
+
));
|
|
31
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
+
|
|
33
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<SelectPrimitive.ScrollUpButton
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<ChevronUp className="h-4 w-4" />
|
|
43
|
+
</SelectPrimitive.ScrollUpButton>
|
|
44
|
+
));
|
|
45
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
46
|
+
|
|
47
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
48
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<SelectPrimitive.ScrollDownButton
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<ChevronDown className="h-4 w-4" />
|
|
57
|
+
</SelectPrimitive.ScrollDownButton>
|
|
58
|
+
));
|
|
59
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
60
|
+
|
|
61
|
+
const SelectContent = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
64
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
65
|
+
<SelectPrimitive.Portal>
|
|
66
|
+
<SelectPrimitive.Content
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn(
|
|
69
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",
|
|
70
|
+
position === "popper" &&
|
|
71
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
position={position}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<SelectScrollUpButton />
|
|
78
|
+
<SelectPrimitive.Viewport
|
|
79
|
+
className={cn(
|
|
80
|
+
"p-1",
|
|
81
|
+
position === "popper" &&
|
|
82
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
</SelectPrimitive.Viewport>
|
|
87
|
+
<SelectScrollDownButton />
|
|
88
|
+
</SelectPrimitive.Content>
|
|
89
|
+
</SelectPrimitive.Portal>
|
|
90
|
+
));
|
|
91
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
92
|
+
|
|
93
|
+
const SelectLabel = React.forwardRef<
|
|
94
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
95
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
96
|
+
>(({ className, ...props }, ref) => (
|
|
97
|
+
<SelectPrimitive.Label ref={ref} className={cn("py-1.5 pl-8 pr-2 text-body-1 font-semibold", className)} {...props} />
|
|
98
|
+
));
|
|
99
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
100
|
+
|
|
101
|
+
const SelectItem = React.forwardRef<
|
|
102
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
103
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
104
|
+
>(({ className, children, ...props }, ref) => (
|
|
105
|
+
<SelectPrimitive.Item
|
|
106
|
+
ref={ref}
|
|
107
|
+
className={cn(
|
|
108
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-body-1 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",
|
|
109
|
+
className,
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
<span className="absolute left-2 flex h-4 w-4 items-center justify-center">
|
|
114
|
+
<SelectPrimitive.ItemIndicator>
|
|
115
|
+
<Check className="h-4 w-4" />
|
|
116
|
+
</SelectPrimitive.ItemIndicator>
|
|
117
|
+
</span>
|
|
118
|
+
|
|
119
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
120
|
+
</SelectPrimitive.Item>
|
|
121
|
+
));
|
|
122
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
123
|
+
|
|
124
|
+
const SelectSeparator = React.forwardRef<
|
|
125
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
126
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
127
|
+
>(({ className, ...props }, ref) => (
|
|
128
|
+
<SelectPrimitive.Separator ref={ref} className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} />
|
|
129
|
+
));
|
|
130
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Select,
|
|
134
|
+
SelectGroup,
|
|
135
|
+
SelectValue,
|
|
136
|
+
SelectTrigger,
|
|
137
|
+
SelectContent,
|
|
138
|
+
SelectLabel,
|
|
139
|
+
SelectItem,
|
|
140
|
+
SelectSeparator,
|
|
141
|
+
SelectScrollUpButton,
|
|
142
|
+
SelectScrollDownButton,
|
|
143
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
10
|
+
<SeparatorPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
decorative={decorative}
|
|
13
|
+
orientation={orientation}
|
|
14
|
+
className={cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
));
|
|
18
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
19
|
+
|
|
20
|
+
export { Separator };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from '../cn';
|
|
7
|
+
|
|
8
|
+
const Sheet = SheetPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const SheetClose = SheetPrimitive.Close;
|
|
13
|
+
|
|
14
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
15
|
+
|
|
16
|
+
const SheetOverlay = React.forwardRef<
|
|
17
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<SheetPrimitive.Overlay
|
|
21
|
+
className={cn(
|
|
22
|
+
"modal-scrim fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
ref={ref}
|
|
27
|
+
/>
|
|
28
|
+
));
|
|
29
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
30
|
+
|
|
31
|
+
const sheetVariants = cva(
|
|
32
|
+
"modal-surface fixed z-50 gap-4 p-6 transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
side: {
|
|
36
|
+
top: "inset-x-0 top-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
37
|
+
bottom:
|
|
38
|
+
"inset-x-0 bottom-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
39
|
+
left: "inset-y-0 left-0 h-full w-3/4 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
40
|
+
right:
|
|
41
|
+
"inset-y-0 right-0 h-full w-3/4 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
side: "right",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
interface SheetContentProps
|
|
51
|
+
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
52
|
+
VariantProps<typeof sheetVariants> {}
|
|
53
|
+
|
|
54
|
+
const SheetContent = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(
|
|
55
|
+
({ side = "right", className, children, ...props }, ref) => (
|
|
56
|
+
<SheetPortal>
|
|
57
|
+
<SheetOverlay />
|
|
58
|
+
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
59
|
+
{children}
|
|
60
|
+
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm text-ink-3 ring-offset-background transition-colors hover:text-ink focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
|
|
61
|
+
<X className="h-4 w-4" />
|
|
62
|
+
<span className="sr-only">Close</span>
|
|
63
|
+
</SheetPrimitive.Close>
|
|
64
|
+
</SheetPrimitive.Content>
|
|
65
|
+
</SheetPortal>
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
69
|
+
|
|
70
|
+
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
72
|
+
);
|
|
73
|
+
SheetHeader.displayName = "SheetHeader";
|
|
74
|
+
|
|
75
|
+
const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
76
|
+
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
77
|
+
);
|
|
78
|
+
SheetFooter.displayName = "SheetFooter";
|
|
79
|
+
|
|
80
|
+
const SheetTitle = React.forwardRef<
|
|
81
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
82
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
83
|
+
>(({ className, ...props }, ref) => (
|
|
84
|
+
<SheetPrimitive.Title ref={ref} className={cn("text-subtitle font-semibold text-foreground", className)} {...props} />
|
|
85
|
+
));
|
|
86
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
87
|
+
|
|
88
|
+
const SheetDescription = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<SheetPrimitive.Description ref={ref} className={cn("text-body-1 text-ink-3", className)} {...props} />
|
|
93
|
+
));
|
|
94
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
Sheet,
|
|
98
|
+
SheetClose,
|
|
99
|
+
SheetContent,
|
|
100
|
+
SheetDescription,
|
|
101
|
+
SheetFooter,
|
|
102
|
+
SheetHeader,
|
|
103
|
+
SheetOverlay,
|
|
104
|
+
SheetPortal,
|
|
105
|
+
SheetTitle,
|
|
106
|
+
SheetTrigger,
|
|
107
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { cn } from '../cn';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Skeleton types for visual variety
|
|
5
|
+
*/
|
|
6
|
+
export type SkeletonVariant = "pulse" | "shimmer";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Skeleton color presets matching the theme
|
|
10
|
+
*/
|
|
11
|
+
export type SkeletonColor = "muted" | "paper" | "paper-elev" | "paper-sunk" | "ink" | "ink-2" | "ink-3";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Skeleton border radius options
|
|
15
|
+
*/
|
|
16
|
+
export type SkeletonRounded = "sm" | "md" | "lg" | "full" | "none";
|
|
17
|
+
|
|
18
|
+
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
/** Visual animation variant */
|
|
20
|
+
variant?: SkeletonVariant;
|
|
21
|
+
/** Background color */
|
|
22
|
+
color?: SkeletonColor;
|
|
23
|
+
/** Border radius */
|
|
24
|
+
rounded?: SkeletonRounded;
|
|
25
|
+
/** Height in pixels */
|
|
26
|
+
height?: number;
|
|
27
|
+
/** Width (CSS value or percentage) */
|
|
28
|
+
width?: string | number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Skeleton primitive for loading states.
|
|
33
|
+
*
|
|
34
|
+
* Usage:
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Basic usage (default: shimmer animation, muted color)
|
|
37
|
+
* <Skeleton />
|
|
38
|
+
*
|
|
39
|
+
* // Customized
|
|
40
|
+
* <Skeleton variant="pulse" color="paper-elev" rounded="lg" height={24} width="80%" />
|
|
41
|
+
*
|
|
42
|
+
* // Inline in a loading branch
|
|
43
|
+
* {isLoading && <Skeleton height={16} className="mb-2" />}
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function Skeleton({
|
|
47
|
+
className,
|
|
48
|
+
variant = "shimmer",
|
|
49
|
+
color = "muted",
|
|
50
|
+
rounded = "md",
|
|
51
|
+
height,
|
|
52
|
+
width,
|
|
53
|
+
...props
|
|
54
|
+
}: SkeletonProps) {
|
|
55
|
+
// Color mapping to tailwind classes
|
|
56
|
+
const colorMap: Record<SkeletonColor, string> = {
|
|
57
|
+
muted: "bg-muted",
|
|
58
|
+
paper: "bg-paper",
|
|
59
|
+
"paper-elev": "bg-paper-elev",
|
|
60
|
+
"paper-sunk": "bg-paper-sunk",
|
|
61
|
+
ink: "bg-ink",
|
|
62
|
+
"ink-2": "bg-ink-2",
|
|
63
|
+
"ink-3": "bg-ink-3",
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Rounded mapping to tailwind classes
|
|
67
|
+
const roundedMap: Record<SkeletonRounded, string> = {
|
|
68
|
+
sm: "rounded-sm",
|
|
69
|
+
md: "rounded-md",
|
|
70
|
+
lg: "rounded-lg",
|
|
71
|
+
full: "rounded-full",
|
|
72
|
+
none: "rounded-none",
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Base classes for all skeleton variants
|
|
76
|
+
const baseClasses = cn(colorMap[color], roundedMap[rounded]);
|
|
77
|
+
|
|
78
|
+
// Animation classes
|
|
79
|
+
const animationClasses =
|
|
80
|
+
variant === "pulse"
|
|
81
|
+
? "animate-pulse"
|
|
82
|
+
: "shimmer"; // CSS class handled via global styles
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
baseClasses,
|
|
88
|
+
animationClasses,
|
|
89
|
+
height && `h-[${height}px]`,
|
|
90
|
+
width && `w-[${width}]`,
|
|
91
|
+
className,
|
|
92
|
+
)}
|
|
93
|
+
style={{ animationDuration: variant === "shimmer" ? "2s" : undefined, ...props.style }}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { Skeleton };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
|
|
6
|
+
const Switch = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<SwitchPrimitives.Root
|
|
11
|
+
className={cn(
|
|
12
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
ref={ref}
|
|
17
|
+
>
|
|
18
|
+
<SwitchPrimitives.Thumb
|
|
19
|
+
className={cn(
|
|
20
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
21
|
+
)}
|
|
22
|
+
/>
|
|
23
|
+
</SwitchPrimitives.Root>
|
|
24
|
+
));
|
|
25
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
26
|
+
|
|
27
|
+
export { Switch };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from '../cn';
|
|
4
|
+
|
|
5
|
+
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
|
|
6
|
+
({ className, ...props }, ref) => (
|
|
7
|
+
<div className="relative w-full overflow-auto">
|
|
8
|
+
<table ref={ref} className={cn("w-full caption-bottom text-body-1", className)} {...props} />
|
|
9
|
+
</div>
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
Table.displayName = "Table";
|
|
13
|
+
|
|
14
|
+
const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
15
|
+
({ className, ...props }, ref) => <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />,
|
|
16
|
+
);
|
|
17
|
+
TableHeader.displayName = "TableHeader";
|
|
18
|
+
|
|
19
|
+
const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
20
|
+
({ className, ...props }, ref) => (
|
|
21
|
+
<tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
TableBody.displayName = "TableBody";
|
|
25
|
+
|
|
26
|
+
const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
27
|
+
({ className, ...props }, ref) => (
|
|
28
|
+
<tfoot ref={ref} className={cn("border-t bg-paper-elev/60 font-medium [&>tr]:last:border-b-0", className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
TableFooter.displayName = "TableFooter";
|
|
32
|
+
|
|
33
|
+
const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
|
|
34
|
+
({ className, ...props }, ref) => (
|
|
35
|
+
<tr
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn("border-b transition-colors data-[state=selected]:bg-muted hover:bg-paper-elev", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
TableRow.displayName = "TableRow";
|
|
43
|
+
|
|
44
|
+
const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(
|
|
45
|
+
({ className, ...props }, ref) => (
|
|
46
|
+
<th
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn(
|
|
49
|
+
"h-12 px-4 text-left align-middle font-medium text-ink-3 [&:has([role=checkbox])]:pr-0",
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
TableHead.displayName = "TableHead";
|
|
57
|
+
|
|
58
|
+
const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
|
|
59
|
+
({ className, ...props }, ref) => (
|
|
60
|
+
<td ref={ref} className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} />
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
TableCell.displayName = "TableCell";
|
|
64
|
+
|
|
65
|
+
const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
|
|
66
|
+
({ className, ...props }, ref) => (
|
|
67
|
+
<caption ref={ref} className={cn("mt-4 text-body-1 text-ink-3", className)} {...props} />
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
TableCaption.displayName = "TableCaption";
|
|
71
|
+
|
|
72
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const TabsList = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<TabsPrimitive.List
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn(
|
|
15
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-paper-elev/60 p-1 text-ink-3",
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
22
|
+
|
|
23
|
+
const TabsTrigger = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<TabsPrimitive.Trigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-body-1 font-medium text-ink-2 ring-offset-background transition-[background-color,color,border-color,box-shadow] hover:text-ink data-[state=active]:bg-paper-elev data-[state=active]:text-ink data-[state=active]:shadow-[var(--shadow-2)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
37
|
+
|
|
38
|
+
const TabsContent = React.forwardRef<
|
|
39
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
40
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<TabsPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
));
|
|
51
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
52
|
+
|
|
53
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|