@recanica/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +65 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.js +178 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/alert.js +66 -0
- package/dist/components/app-shell.d.ts +15 -0
- package/dist/components/app-shell.js +27 -0
- package/dist/components/aspect-ratio.d.ts +3 -0
- package/dist/components/aspect-ratio.js +11 -0
- package/dist/components/attachment.d.ts +24 -0
- package/dist/components/attachment.js +192 -0
- package/dist/components/avatar.d.ts +11 -0
- package/dist/components/avatar.js +104 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +63 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +103 -0
- package/dist/components/bubble.d.ts +17 -0
- package/dist/components/bubble.js +110 -0
- package/dist/components/button-group.d.ts +11 -0
- package/dist/components/button-group.js +76 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +59 -0
- package/dist/components/calendar.d.ts +8 -0
- package/dist/components/calendar.js +195 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.js +90 -0
- package/dist/components/carousel.d.ts +19 -0
- package/dist/components/carousel.js +199 -0
- package/dist/components/chart.d.ts +44 -0
- package/dist/components/chart.js +253 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/choice-card.d.ts +18 -0
- package/dist/components/choice-card.js +43 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/collapsible.js +35 -0
- package/dist/components/combobox.d.ts +24 -0
- package/dist/components/combobox.js +297 -0
- package/dist/components/command.d.ts +18 -0
- package/dist/components/command.js +177 -0
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.js +224 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +147 -0
- package/dist/components/direction.d.ts +7 -0
- package/dist/components/direction.js +15 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/drawer.js +129 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.js +232 -0
- package/dist/components/empty.d.ts +11 -0
- package/dist/components/empty.js +102 -0
- package/dist/components/field.d.ts +52 -0
- package/dist/components/field.js +261 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/form.js +126 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.js +39 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +160 -0
- package/dist/components/input-otp.d.ts +11 -0
- package/dist/components/input-otp.js +67 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item.d.ts +23 -0
- package/dist/components/item.js +187 -0
- package/dist/components/kbd.d.ts +3 -0
- package/dist/components/kbd.js +31 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +23 -0
- package/dist/components/layout.d.ts +34 -0
- package/dist/components/layout.js +46 -0
- package/dist/components/loader.d.ts +38 -0
- package/dist/components/loader.js +90 -0
- package/dist/components/marker.d.ts +11 -0
- package/dist/components/marker.js +66 -0
- package/dist/components/menubar.d.ts +26 -0
- package/dist/components/menubar.js +252 -0
- package/dist/components/message-scroller.d.ts +10 -0
- package/dist/components/message-scroller.js +118 -0
- package/dist/components/message.d.ts +10 -0
- package/dist/components/message.js +90 -0
- package/dist/components/native-select.d.ts +7 -0
- package/dist/components/native-select.js +71 -0
- package/dist/components/nav-item.d.ts +17 -0
- package/dist/components/nav-item.js +36 -0
- package/dist/components/navigation-menu.d.ts +14 -0
- package/dist/components/navigation-menu.js +170 -0
- package/dist/components/page.d.ts +80 -0
- package/dist/components/page.js +84 -0
- package/dist/components/pagination.d.ts +13 -0
- package/dist/components/pagination.js +122 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +81 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/progress.js +32 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +46 -0
- package/dist/components/resizable.d.ts +7 -0
- package/dist/components/resizable.js +47 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.js +61 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +179 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.js +27 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +128 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.js +650 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +15 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/slider.js +64 -0
- package/dist/components/sonner.d.ts +3 -0
- package/dist/components/sonner.js +38 -0
- package/dist/components/spinner.d.ts +2 -0
- package/dist/components/spinner.js +17 -0
- package/dist/components/stat.d.ts +47 -0
- package/dist/components/stat.js +120 -0
- package/dist/components/surface.d.ts +28 -0
- package/dist/components/surface.js +39 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +34 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +115 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +92 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +22 -0
- package/dist/components/toggle-group.d.ts +9 -0
- package/dist/components/toggle-group.js +69 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/web-section.d.ts +40 -0
- package/dist/components/web-section.js +72 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/package.json +79 -3
- package/README.md +0 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
MessageScroller as MessageScrollerPrimitive,
|
|
5
|
+
useMessageScroller,
|
|
6
|
+
useMessageScrollerScrollable,
|
|
7
|
+
useMessageScrollerVisibility
|
|
8
|
+
} from "@shadcn/react/message-scroller";
|
|
9
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
10
|
+
import { ArrowDownIcon } from "lucide-react";
|
|
11
|
+
import { Button } from "@recanica/ui/components/button";
|
|
12
|
+
function MessageScrollerProvider(props) {
|
|
13
|
+
return /* @__PURE__ */ jsx(MessageScrollerPrimitive.Provider, { ...props });
|
|
14
|
+
}
|
|
15
|
+
function MessageScroller({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
MessageScrollerPrimitive.Root,
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "message-scroller",
|
|
23
|
+
className: cn(
|
|
24
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function MessageScrollerViewport({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
MessageScrollerPrimitive.Viewport,
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "message-scroller-viewport",
|
|
39
|
+
className: cn(
|
|
40
|
+
"size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none data-pending-scroll:invisible",
|
|
41
|
+
className
|
|
42
|
+
),
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function MessageScrollerContent({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
MessageScrollerPrimitive.Content,
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "message-scroller-content",
|
|
55
|
+
className: cn("flex h-max min-h-full flex-col gap-8", className),
|
|
56
|
+
...props
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function MessageScrollerItem({
|
|
61
|
+
className,
|
|
62
|
+
scrollAnchor = false,
|
|
63
|
+
...props
|
|
64
|
+
}) {
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
MessageScrollerPrimitive.Item,
|
|
67
|
+
{
|
|
68
|
+
"data-slot": "message-scroller-item",
|
|
69
|
+
scrollAnchor,
|
|
70
|
+
className: cn(
|
|
71
|
+
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
72
|
+
className
|
|
73
|
+
),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function MessageScrollerButton({
|
|
79
|
+
direction = "end",
|
|
80
|
+
className,
|
|
81
|
+
children,
|
|
82
|
+
render,
|
|
83
|
+
variant = "secondary",
|
|
84
|
+
size = "icon-sm",
|
|
85
|
+
...props
|
|
86
|
+
}) {
|
|
87
|
+
return /* @__PURE__ */ jsx(
|
|
88
|
+
MessageScrollerPrimitive.Button,
|
|
89
|
+
{
|
|
90
|
+
"data-slot": "message-scroller-button",
|
|
91
|
+
"data-direction": direction,
|
|
92
|
+
"data-variant": variant,
|
|
93
|
+
"data-size": size,
|
|
94
|
+
direction,
|
|
95
|
+
className: cn(
|
|
96
|
+
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
render: render ?? /* @__PURE__ */ jsx(Button, { variant, size }),
|
|
100
|
+
...props,
|
|
101
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx(ArrowDownIcon, {}),
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: direction === "end" ? "Scroll to end" : "Scroll to start" })
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
MessageScroller,
|
|
110
|
+
MessageScrollerButton,
|
|
111
|
+
MessageScrollerContent,
|
|
112
|
+
MessageScrollerItem,
|
|
113
|
+
MessageScrollerProvider,
|
|
114
|
+
MessageScrollerViewport,
|
|
115
|
+
useMessageScroller,
|
|
116
|
+
useMessageScrollerScrollable,
|
|
117
|
+
useMessageScrollerVisibility
|
|
118
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function MessageGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function Message({ className, align, ...props }: React.ComponentProps<"div"> & {
|
|
4
|
+
align?: "start" | "end";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function MessageAvatar({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function MessageHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function MessageFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
export { MessageGroup, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
3
|
+
function MessageGroup({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
"data-slot": "message-group",
|
|
8
|
+
className: cn("flex min-w-0 flex-col gap-2", className),
|
|
9
|
+
...props
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
function Message({
|
|
14
|
+
className,
|
|
15
|
+
align = "start",
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "message",
|
|
22
|
+
"data-align": align,
|
|
23
|
+
className: cn(
|
|
24
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function MessageAvatar({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "message-avatar",
|
|
36
|
+
className: cn(
|
|
37
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function MessageContent({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
"data-slot": "message-content",
|
|
49
|
+
className: cn(
|
|
50
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function MessageHeader({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "message-header",
|
|
62
|
+
className: cn(
|
|
63
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
64
|
+
className
|
|
65
|
+
),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function MessageFooter({ className, ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
"data-slot": "message-footer",
|
|
75
|
+
className: cn(
|
|
76
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
...props
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
Message,
|
|
85
|
+
MessageAvatar,
|
|
86
|
+
MessageContent,
|
|
87
|
+
MessageFooter,
|
|
88
|
+
MessageGroup,
|
|
89
|
+
MessageHeader
|
|
90
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function NativeSelect({ className, size, ...props }: Omit<React.ComponentProps<"select">, "size"> & {
|
|
3
|
+
size?: "sm" | "default";
|
|
4
|
+
}): React.JSX.Element;
|
|
5
|
+
declare function NativeSelectOption({ className, ...props }: React.ComponentProps<"option">): React.JSX.Element;
|
|
6
|
+
declare function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<"optgroup">): React.JSX.Element;
|
|
7
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
3
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
4
|
+
function NativeSelect({
|
|
5
|
+
className,
|
|
6
|
+
size = "default",
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: "group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
13
|
+
"data-slot": "native-select-wrapper",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"select",
|
|
17
|
+
{
|
|
18
|
+
"data-slot": "native-select",
|
|
19
|
+
"data-size": size,
|
|
20
|
+
className: cn(
|
|
21
|
+
"h-9 w-full min-w-0 appearance-none rounded-md border border-input bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-8 data-[size=sm]:py-1 dark:bg-input/30 dark:hover:bg-input/50",
|
|
22
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
23
|
+
"group-data-[invalid=true]/field:border-destructive group-data-[invalid=true]/field:bg-destructive/[0.04] group-data-[invalid=true]/field:ring-[3px] group-data-[invalid=true]/field:ring-destructive/15 aria-invalid:bg-destructive/[0.04] aria-invalid:ring-[3px] aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
ChevronDownIcon,
|
|
31
|
+
{
|
|
32
|
+
className: "pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 text-muted-foreground opacity-50 select-none",
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
"data-slot": "native-select-icon"
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function NativeSelectOption({
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
"option",
|
|
47
|
+
{
|
|
48
|
+
"data-slot": "native-select-option",
|
|
49
|
+
className: cn("bg-[Canvas] text-[CanvasText]", className),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function NativeSelectOptGroup({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
"optgroup",
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "native-select-optgroup",
|
|
62
|
+
className: cn("bg-[Canvas] text-[CanvasText]", className),
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
NativeSelect,
|
|
69
|
+
NativeSelectOptGroup,
|
|
70
|
+
NativeSelectOption
|
|
71
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* NavItem — the one selectable row: sidebar and top-nav items, list/detail rows, inbox rows, option lists.
|
|
5
|
+
* `active` marks the current item (accent background + aria-current). `variant="tab"` is the icon-over-label bottom tab.
|
|
6
|
+
* Renders a <button> by default; pass `as={Link}` (or "a") for navigation.
|
|
7
|
+
*/
|
|
8
|
+
declare const navItemVariants: (props?: ({
|
|
9
|
+
variant?: "default" | "pill" | "sidebar" | "sub" | "tab" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
type NavItemProps<T extends React.ElementType> = {
|
|
12
|
+
as?: T;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
} & VariantProps<typeof navItemVariants> & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
16
|
+
declare function NavItem<T extends React.ElementType = "button">({ as, active, variant, className, ...props }: NavItemProps<T>): React.JSX.Element;
|
|
17
|
+
export { NavItem, navItemVariants };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
const navItemVariants = cva(
|
|
5
|
+
"flex w-full min-w-0 text-left text-sm transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "items-start gap-3 rounded-xl px-3 py-2.5 hover:bg-accent data-[active=true]:bg-accent data-[active=true]:text-foreground",
|
|
10
|
+
sidebar: "items-center gap-3 rounded-lg px-3 py-2 text-sidebar-foreground hover:text-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:text-foreground",
|
|
11
|
+
sub: "items-center py-1.5 text-sidebar-foreground hover:text-foreground data-[active=true]:text-foreground",
|
|
12
|
+
pill: "w-auto shrink-0 items-center rounded-full px-3 py-1.5 whitespace-nowrap text-muted-foreground hover:text-foreground data-[active=true]:bg-accent data-[active=true]:text-foreground",
|
|
13
|
+
tab: "flex-col items-center gap-1 py-2.5 text-xs text-muted-foreground data-[active=true]:text-foreground"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: { variant: "default" }
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
function NavItem({ as, active, variant, className, ...props }) {
|
|
20
|
+
const Tag = as ?? "button";
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Tag,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "nav-item",
|
|
25
|
+
"data-active": active || void 0,
|
|
26
|
+
"aria-current": active ? "page" : void 0,
|
|
27
|
+
...Tag === "button" ? { type: "button" } : {},
|
|
28
|
+
className: cn(navItemVariants({ variant }), className),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
NavItem,
|
|
35
|
+
navItemVariants
|
|
36
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui";
|
|
3
|
+
declare function NavigationMenu({ className, children, viewport, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
4
|
+
viewport?: boolean;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>): React.JSX.Element;
|
|
7
|
+
declare function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>): React.JSX.Element;
|
|
8
|
+
declare const navigationMenuTriggerStyle: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
declare function NavigationMenuTrigger({ className, children, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
declare function NavigationMenuViewport({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>): React.JSX.Element;
|
|
12
|
+
declare function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>): React.JSX.Element;
|
|
13
|
+
declare function NavigationMenuIndicator({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>): React.JSX.Element;
|
|
14
|
+
export { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuContent, NavigationMenuTrigger, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, navigationMenuTriggerStyle, };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui";
|
|
6
|
+
function NavigationMenu({
|
|
7
|
+
className,
|
|
8
|
+
children,
|
|
9
|
+
viewport = true,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
NavigationMenuPrimitive.Root,
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "navigation-menu",
|
|
16
|
+
"data-viewport": viewport,
|
|
17
|
+
className: cn(
|
|
18
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props,
|
|
22
|
+
children: [
|
|
23
|
+
children,
|
|
24
|
+
viewport && /* @__PURE__ */ jsx(NavigationMenuViewport, {})
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function NavigationMenuList({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
NavigationMenuPrimitive.List,
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "navigation-menu-list",
|
|
37
|
+
className: cn(
|
|
38
|
+
"group flex flex-1 list-none items-center justify-center gap-1",
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
...props
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function NavigationMenuItem({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
NavigationMenuPrimitive.Item,
|
|
51
|
+
{
|
|
52
|
+
"data-slot": "navigation-menu-item",
|
|
53
|
+
className: cn("relative", className),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const navigationMenuTriggerStyle = cva(
|
|
59
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent"
|
|
60
|
+
);
|
|
61
|
+
function NavigationMenuTrigger({
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
NavigationMenuPrimitive.Trigger,
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "navigation-menu-trigger",
|
|
70
|
+
className: cn(navigationMenuTriggerStyle(), "group", className),
|
|
71
|
+
...props,
|
|
72
|
+
children: [
|
|
73
|
+
children,
|
|
74
|
+
" ",
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
ChevronDownIcon,
|
|
77
|
+
{
|
|
78
|
+
className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function NavigationMenuContent({
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
NavigationMenuPrimitive.Content,
|
|
92
|
+
{
|
|
93
|
+
"data-slot": "navigation-menu-content",
|
|
94
|
+
className: cn(
|
|
95
|
+
"top-0 left-0 w-full p-2 pr-2.5 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out md:absolute md:w-auto",
|
|
96
|
+
"group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function NavigationMenuViewport({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: cn(
|
|
111
|
+
"absolute top-full left-0 isolate z-50 flex justify-center"
|
|
112
|
+
),
|
|
113
|
+
children: /* @__PURE__ */ jsx(
|
|
114
|
+
NavigationMenuPrimitive.Viewport,
|
|
115
|
+
{
|
|
116
|
+
"data-slot": "navigation-menu-viewport",
|
|
117
|
+
className: cn(
|
|
118
|
+
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
|
|
119
|
+
className
|
|
120
|
+
),
|
|
121
|
+
...props
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function NavigationMenuLink({
|
|
128
|
+
className,
|
|
129
|
+
...props
|
|
130
|
+
}) {
|
|
131
|
+
return /* @__PURE__ */ jsx(
|
|
132
|
+
NavigationMenuPrimitive.Link,
|
|
133
|
+
{
|
|
134
|
+
"data-slot": "navigation-menu-link",
|
|
135
|
+
className: cn(
|
|
136
|
+
"flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
137
|
+
className
|
|
138
|
+
),
|
|
139
|
+
...props
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function NavigationMenuIndicator({
|
|
144
|
+
className,
|
|
145
|
+
...props
|
|
146
|
+
}) {
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
NavigationMenuPrimitive.Indicator,
|
|
149
|
+
{
|
|
150
|
+
"data-slot": "navigation-menu-indicator",
|
|
151
|
+
className: cn(
|
|
152
|
+
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
|
|
153
|
+
className
|
|
154
|
+
),
|
|
155
|
+
...props,
|
|
156
|
+
children: /* @__PURE__ */ jsx("div", { className: "relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" })
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
NavigationMenu,
|
|
162
|
+
NavigationMenuContent,
|
|
163
|
+
NavigationMenuIndicator,
|
|
164
|
+
NavigationMenuItem,
|
|
165
|
+
NavigationMenuLink,
|
|
166
|
+
NavigationMenuList,
|
|
167
|
+
NavigationMenuTrigger,
|
|
168
|
+
NavigationMenuViewport,
|
|
169
|
+
navigationMenuTriggerStyle
|
|
170
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Page structure: the single source for visual rhythm and page layout.
|
|
4
|
+
* Pages compose these and never place their own spacing between blocks.
|
|
5
|
+
*
|
|
6
|
+
* Rhythm (tokens): inset · group (12) · flow (20, between blocks) · stack (40, between sections) · section (page bands).
|
|
7
|
+
*
|
|
8
|
+
* <Page width="reading">
|
|
9
|
+
* <PageHeader title="Invoices" description="…" actions={<Button>New invoice</Button>} />
|
|
10
|
+
* <Section title="Overdue" actions={…}>…</Section>
|
|
11
|
+
* <Section title="Paid">…</Section>
|
|
12
|
+
* </Page>
|
|
13
|
+
*/
|
|
14
|
+
declare const widths: {
|
|
15
|
+
readonly reading: "reading";
|
|
16
|
+
readonly content: "max-w-content";
|
|
17
|
+
readonly full: "";
|
|
18
|
+
};
|
|
19
|
+
/** Page column. `flow` owns the spacing between its blocks; width is decided once for the whole column. */
|
|
20
|
+
declare function Page({ width, className, ...props }: React.ComponentProps<"div"> & {
|
|
21
|
+
width?: keyof typeof widths;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
/** The one page header: optional back link and eyebrow, title, description, actions. Container-aware. */
|
|
24
|
+
declare function PageHeader({ eyebrow, title, description, actions, back, className, children, }: {
|
|
25
|
+
eyebrow?: React.ReactNode;
|
|
26
|
+
title: React.ReactNode;
|
|
27
|
+
description?: React.ReactNode;
|
|
28
|
+
actions?: React.ReactNode;
|
|
29
|
+
/** e.g. <a href="/invoices">← Invoices</a>, rendered above the title */
|
|
30
|
+
back?: React.ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
declare const headingSize: {
|
|
35
|
+
readonly title: "text-title";
|
|
36
|
+
readonly heading: "text-heading";
|
|
37
|
+
readonly sm: "text-lg";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The one heading style. `level` is the document outline (h1–h3); `size` is the visual step
|
|
41
|
+
* (title / heading / sm), defaulting from the level. With an `id` it becomes a link to itself.
|
|
42
|
+
*/
|
|
43
|
+
declare function Heading({ level, size, id, className, children }: {
|
|
44
|
+
level?: 1 | 2 | 3;
|
|
45
|
+
size?: keyof typeof headingSize;
|
|
46
|
+
id?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
}): React.JSX.Element;
|
|
50
|
+
/** A titled group of blocks. Owns its rhythm: group gap under the heading, flow gap between its blocks. */
|
|
51
|
+
declare function Section({ id, title, description, actions, level, className, children, }: {
|
|
52
|
+
id?: string;
|
|
53
|
+
title?: React.ReactNode;
|
|
54
|
+
description?: React.ReactNode;
|
|
55
|
+
actions?: React.ReactNode;
|
|
56
|
+
level?: 2 | 3;
|
|
57
|
+
className?: string;
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
}): React.JSX.Element;
|
|
60
|
+
declare const stackGaps: {
|
|
61
|
+
readonly group: "gap-(--spacing-group)";
|
|
62
|
+
readonly flow: "gap-(--spacing-flow)";
|
|
63
|
+
readonly stack: "gap-(--spacing-stack)";
|
|
64
|
+
};
|
|
65
|
+
/** Vertical rhythm for anything that isn't a page column: cards in a sidebar, fields in a form, blocks in a panel. */
|
|
66
|
+
declare function Stack({ gap, className, ...props }: React.ComponentProps<"div"> & {
|
|
67
|
+
gap?: keyof typeof stackGaps;
|
|
68
|
+
}): React.JSX.Element;
|
|
69
|
+
/**
|
|
70
|
+
* Reference table: a key column plus description columns.
|
|
71
|
+
* `keys` says what the key column holds, decided by the author, never guessed:
|
|
72
|
+
* "label" (default) → regular text that never wraps; "code" (token names, classes, commands) → mono, may break.
|
|
73
|
+
*/
|
|
74
|
+
declare function ReferenceTable({ head, rows, keys, className }: {
|
|
75
|
+
head: string[];
|
|
76
|
+
rows: React.ReactNode[][];
|
|
77
|
+
keys?: "label" | "code";
|
|
78
|
+
className?: string;
|
|
79
|
+
}): React.JSX.Element;
|
|
80
|
+
export { Page, PageHeader, Heading, Section, Stack, ReferenceTable };
|