@recanica/ui 0.0.0-stage → 0.2.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 +18 -0
- package/dist/components/nav-item.js +40 -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,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
5
|
+
import { Slider as SliderPrimitive } from "radix-ui";
|
|
6
|
+
function Slider({
|
|
7
|
+
className,
|
|
8
|
+
defaultValue,
|
|
9
|
+
value,
|
|
10
|
+
min = 0,
|
|
11
|
+
max = 100,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const _values = React.useMemo(
|
|
15
|
+
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
16
|
+
[value, defaultValue, min, max]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
SliderPrimitive.Root,
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "slider",
|
|
22
|
+
defaultValue,
|
|
23
|
+
value,
|
|
24
|
+
min,
|
|
25
|
+
max,
|
|
26
|
+
className: cn(
|
|
27
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
...props,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
SliderPrimitive.Track,
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "slider-track",
|
|
36
|
+
className: cn(
|
|
37
|
+
"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
38
|
+
),
|
|
39
|
+
children: /* @__PURE__ */ jsx(
|
|
40
|
+
SliderPrimitive.Range,
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "slider-range",
|
|
43
|
+
className: cn(
|
|
44
|
+
"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
51
|
+
SliderPrimitive.Thumb,
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "slider-thumb",
|
|
54
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
55
|
+
},
|
|
56
|
+
index
|
|
57
|
+
))
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
Slider
|
|
64
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
CircleCheckIcon,
|
|
5
|
+
InfoIcon,
|
|
6
|
+
Loader2Icon,
|
|
7
|
+
OctagonXIcon,
|
|
8
|
+
TriangleAlertIcon
|
|
9
|
+
} from "lucide-react";
|
|
10
|
+
import { useTheme } from "next-themes";
|
|
11
|
+
import { Toaster as Sonner } from "sonner";
|
|
12
|
+
const Toaster = ({ ...props }) => {
|
|
13
|
+
const { theme = "system" } = useTheme();
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Sonner,
|
|
16
|
+
{
|
|
17
|
+
theme,
|
|
18
|
+
className: "toaster group",
|
|
19
|
+
icons: {
|
|
20
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
21
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
22
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
23
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
24
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
25
|
+
},
|
|
26
|
+
style: {
|
|
27
|
+
"--normal-bg": "var(--popover)",
|
|
28
|
+
"--normal-text": "var(--popover-foreground)",
|
|
29
|
+
"--normal-border": "var(--border)",
|
|
30
|
+
"--border-radius": "var(--radius)"
|
|
31
|
+
},
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
Toaster
|
|
38
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
3
|
+
import { Loader2Icon } from "lucide-react";
|
|
4
|
+
function Spinner({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
Loader2Icon,
|
|
7
|
+
{
|
|
8
|
+
role: "status",
|
|
9
|
+
"aria-label": "Loading",
|
|
10
|
+
className: cn("size-4 animate-spin", className),
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Spinner
|
|
17
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Polar-style metric panels: several stats share one bordered container,
|
|
4
|
+
* split by hairline dividers.
|
|
5
|
+
*
|
|
6
|
+
* <StatGroup>
|
|
7
|
+
* <Stat>
|
|
8
|
+
* <StatHeader title="Revenue" href="/revenue" />
|
|
9
|
+
* <StatValue value="$48" caption="November" />
|
|
10
|
+
* <StatList><BarRow label="Nov" value="$48" percent={100} /></StatList>
|
|
11
|
+
* </Stat>
|
|
12
|
+
* </StatGroup>
|
|
13
|
+
*/
|
|
14
|
+
declare function StatGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function Stat({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
16
|
+
declare function StatHeader({ title, href, actionLabel, className, }: {
|
|
17
|
+
title: React.ReactNode;
|
|
18
|
+
href?: string;
|
|
19
|
+
actionLabel?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
declare function StatValue({ value, caption, className, }: {
|
|
23
|
+
value: React.ReactNode;
|
|
24
|
+
caption?: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare function StatList({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
28
|
+
/** One line in a StatList: primary text, muted secondary text, trailing meta. */
|
|
29
|
+
declare function StatRow({ primary, secondary, trailing, className, }: {
|
|
30
|
+
primary: React.ReactNode;
|
|
31
|
+
secondary?: React.ReactNode;
|
|
32
|
+
trailing?: React.ReactNode;
|
|
33
|
+
className?: string;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* Label, a thin progress track, and a value. The active row is highlighted.
|
|
37
|
+
* The label column fits the longest label up to 40% of the row, then truncates (full text on hover),
|
|
38
|
+
* so long names never run into the bar. Inside a StatList all rows share one label column.
|
|
39
|
+
*/
|
|
40
|
+
declare function BarRow({ label, value, percent, active, className, }: {
|
|
41
|
+
label: React.ReactNode;
|
|
42
|
+
value: React.ReactNode;
|
|
43
|
+
percent: number;
|
|
44
|
+
active?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
}): React.JSX.Element;
|
|
47
|
+
export { StatGroup, Stat, StatHeader, StatValue, StatList, StatRow, BarRow };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowRightIcon } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
function StatGroup({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "stat-group",
|
|
9
|
+
className: cn(
|
|
10
|
+
// Container-aware: each stat wants ≥17rem; they wrap to new rows when the *container* is narrow
|
|
11
|
+
// (not the viewport), and the last stat in a row grows to fill it. gap-px over bg-border = hairlines.
|
|
12
|
+
"flex flex-wrap gap-px overflow-hidden rounded-2xl border bg-border",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function Stat({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "stat", className: cn("@container flex min-w-0 flex-[1_1_17rem] flex-col gap-6 bg-card p-panel", className), ...props });
|
|
21
|
+
}
|
|
22
|
+
function StatHeader({
|
|
23
|
+
title,
|
|
24
|
+
href,
|
|
25
|
+
actionLabel = "View all",
|
|
26
|
+
className
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 text-sm", className), children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: title }),
|
|
30
|
+
href && /* @__PURE__ */ jsxs("a", { href, className: "-my-1 inline-flex shrink-0 items-center gap-1 py-1 whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground", children: [
|
|
31
|
+
actionLabel,
|
|
32
|
+
" ",
|
|
33
|
+
/* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-3.5" })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
function StatValue({
|
|
38
|
+
value,
|
|
39
|
+
caption,
|
|
40
|
+
className
|
|
41
|
+
}) {
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap items-baseline gap-x-3 gap-y-1", className), children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: "font-light whitespace-nowrap tabular-nums [font-size:min(var(--text-metric),calc(100cqi/(var(--stat-chars,6)*0.6)))] leading-none",
|
|
47
|
+
style: { "--stat-chars": typeof value === "string" || typeof value === "number" ? Math.max(6, String(value).length) : 6 },
|
|
48
|
+
children: value
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
caption && /* @__PURE__ */ jsx("span", { className: "text-sm whitespace-nowrap text-muted-foreground", children: caption })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function StatList({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
"data-slot": "stat-list",
|
|
59
|
+
className: cn(
|
|
60
|
+
"grid grid-cols-[fit-content(40%)_minmax(3rem,1fr)_auto] divide-y border-t",
|
|
61
|
+
"*:col-span-full [&>[data-slot=bar-row]]:grid-cols-subgrid",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function StatRow({
|
|
69
|
+
primary,
|
|
70
|
+
secondary,
|
|
71
|
+
trailing,
|
|
72
|
+
className
|
|
73
|
+
}) {
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 py-3 text-sm", className), children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col @[22rem]:flex-row @[22rem]:items-baseline @[22rem]:gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: primary }),
|
|
77
|
+
secondary && /* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: secondary })
|
|
78
|
+
] }),
|
|
79
|
+
trailing && /* @__PURE__ */ jsx("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground tabular-nums", children: trailing })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
function BarRow({
|
|
83
|
+
label,
|
|
84
|
+
value,
|
|
85
|
+
percent,
|
|
86
|
+
active,
|
|
87
|
+
className
|
|
88
|
+
}) {
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
"data-slot": "bar-row",
|
|
93
|
+
className: cn(
|
|
94
|
+
"grid grid-cols-[fit-content(40%)_minmax(3rem,1fr)_auto] items-center gap-x-4 py-3 text-sm",
|
|
95
|
+
!active && "text-muted-foreground",
|
|
96
|
+
className
|
|
97
|
+
),
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", title: typeof label === "string" ? label : void 0, children: label }),
|
|
100
|
+
/* @__PURE__ */ jsx("div", { className: "relative h-0.5 rounded-full bg-border", children: /* @__PURE__ */ jsx(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
className: cn("absolute inset-y-0 left-0 rounded-full", active ? "bg-foreground" : "bg-muted-foreground/40"),
|
|
104
|
+
style: { width: `${Math.max(0, Math.min(100, percent))}%` }
|
|
105
|
+
}
|
|
106
|
+
) }),
|
|
107
|
+
/* @__PURE__ */ jsx("span", { className: cn("whitespace-nowrap tabular-nums", active && "text-foreground"), children: value })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
BarRow,
|
|
114
|
+
Stat,
|
|
115
|
+
StatGroup,
|
|
116
|
+
StatHeader,
|
|
117
|
+
StatList,
|
|
118
|
+
StatRow,
|
|
119
|
+
StatValue
|
|
120
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* Surface — the one bordered box. Use it instead of hand-writing "rounded-2xl border p-…".
|
|
5
|
+
* Choices are fixed on purpose: tone (which layer) and inset (padding from the rhythm tokens).
|
|
6
|
+
* Need a header/body/footer structure? Use Card. Need something else? Change this part, not the page.
|
|
7
|
+
*/
|
|
8
|
+
declare const surfaceVariants: (props?: ({
|
|
9
|
+
size?: "default" | "sm" | null | undefined;
|
|
10
|
+
tone?: "card" | "muted" | "panel" | "plain" | null | undefined;
|
|
11
|
+
inset?: "default" | "lg" | "none" | "sm" | "tight" | null | undefined;
|
|
12
|
+
dashed?: boolean | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
type SurfaceProps<T extends React.ElementType> = {
|
|
15
|
+
as?: T;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & VariantProps<typeof surfaceVariants> & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
18
|
+
/** `as` renders the surface as another element (section, li, article, a link component…). */
|
|
19
|
+
declare function Surface<T extends React.ElementType = "div">({ as, className, size, tone, inset, dashed, ...props }: SurfaceProps<T>): React.JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* SurfaceGrid — cells separated by hairlines inside one bordered surface (stats, features, logos, details).
|
|
22
|
+
* The grid supplies the border, radius and dividers; give it the column classes (sm:grid-cols-3 …). Cells take the card background.
|
|
23
|
+
*/
|
|
24
|
+
declare function SurfaceGrid<T extends React.ElementType = "div">({ as, className, ...props }: {
|
|
25
|
+
as?: T;
|
|
26
|
+
className?: string;
|
|
27
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, "as" | "className">): React.JSX.Element;
|
|
28
|
+
export { Surface, SurfaceGrid, surfaceVariants };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
const surfaceVariants = cva("border", {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
default: "rounded-2xl",
|
|
8
|
+
sm: "rounded-xl"
|
|
9
|
+
},
|
|
10
|
+
tone: {
|
|
11
|
+
card: "bg-card text-card-foreground",
|
|
12
|
+
panel: "bg-panel",
|
|
13
|
+
plain: "",
|
|
14
|
+
muted: "bg-muted/40"
|
|
15
|
+
},
|
|
16
|
+
inset: {
|
|
17
|
+
none: "",
|
|
18
|
+
tight: "px-3 py-2",
|
|
19
|
+
sm: "p-(--spacing-inset-sm)",
|
|
20
|
+
default: "p-(--spacing-inset)",
|
|
21
|
+
lg: "p-(--spacing-panel)"
|
|
22
|
+
},
|
|
23
|
+
dashed: { true: "border-dashed", false: "" }
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { size: "default", tone: "card", inset: "default", dashed: false }
|
|
26
|
+
});
|
|
27
|
+
function Surface({ as, className, size, tone, inset, dashed, ...props }) {
|
|
28
|
+
const Tag = as ?? "div";
|
|
29
|
+
return /* @__PURE__ */ jsx(Tag, { "data-slot": "surface", className: cn(surfaceVariants({ size, tone, inset, dashed }), className), ...props });
|
|
30
|
+
}
|
|
31
|
+
function SurfaceGrid({ as, className, ...props }) {
|
|
32
|
+
const Tag = as ?? "div";
|
|
33
|
+
return /* @__PURE__ */ jsx(Tag, { "data-slot": "surface-grid", className: cn("grid gap-px overflow-hidden rounded-2xl border bg-border *:bg-card", className), ...props });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
Surface,
|
|
37
|
+
SurfaceGrid,
|
|
38
|
+
surfaceVariants
|
|
39
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
declare function Switch({ className, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
4
|
+
size?: "sm" | "default";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export { Switch };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
5
|
+
function Switch({
|
|
6
|
+
className,
|
|
7
|
+
size = "default",
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
SwitchPrimitive.Root,
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "switch",
|
|
14
|
+
"data-size": size,
|
|
15
|
+
className: cn(
|
|
16
|
+
"peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children: /* @__PURE__ */ jsx(
|
|
21
|
+
SwitchPrimitive.Thumb,
|
|
22
|
+
{
|
|
23
|
+
"data-slot": "switch-thumb",
|
|
24
|
+
className: cn(
|
|
25
|
+
"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
Switch
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
function Table({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "table-container",
|
|
9
|
+
className: "relative w-full overflow-x-auto",
|
|
10
|
+
children: /* @__PURE__ */ jsx(
|
|
11
|
+
"table",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "table",
|
|
14
|
+
className: cn("w-full caption-bottom text-sm [--table-edge:var(--spacing-inset)]", className),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function TableHeader({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"thead",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "table-header",
|
|
26
|
+
className: cn("[&_tr]:border-b", className),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function TableBody({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
"tbody",
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "table-body",
|
|
36
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function TableFooter({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"tfoot",
|
|
44
|
+
{
|
|
45
|
+
"data-slot": "table-footer",
|
|
46
|
+
className: cn(
|
|
47
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function TableRow({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
"tr",
|
|
57
|
+
{
|
|
58
|
+
"data-slot": "table-row",
|
|
59
|
+
className: cn(
|
|
60
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function TableHead({ className, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
"th",
|
|
70
|
+
{
|
|
71
|
+
"data-slot": "table-head",
|
|
72
|
+
className: cn(
|
|
73
|
+
"h-10 px-3 text-left align-middle font-normal whitespace-nowrap text-muted-foreground first:pl-(--table-edge) last:pr-(--table-edge) [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
74
|
+
className
|
|
75
|
+
),
|
|
76
|
+
...props
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function TableCell({ className, ...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
"td",
|
|
83
|
+
{
|
|
84
|
+
"data-slot": "table-cell",
|
|
85
|
+
className: cn(
|
|
86
|
+
"px-3 py-3 align-middle whitespace-nowrap first:pl-(--table-edge) last:pr-(--table-edge) [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function TableCaption({
|
|
94
|
+
className,
|
|
95
|
+
...props
|
|
96
|
+
}) {
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
"caption",
|
|
99
|
+
{
|
|
100
|
+
"data-slot": "table-caption",
|
|
101
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
102
|
+
...props
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
Table,
|
|
108
|
+
TableBody,
|
|
109
|
+
TableCaption,
|
|
110
|
+
TableCell,
|
|
111
|
+
TableFooter,
|
|
112
|
+
TableHead,
|
|
113
|
+
TableHeader,
|
|
114
|
+
TableRow
|
|
115
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare const tabsListVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "line" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
9
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
5
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
6
|
+
function Tabs({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
TabsPrimitive.Root,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "tabs",
|
|
15
|
+
"data-orientation": orientation,
|
|
16
|
+
orientation,
|
|
17
|
+
className: cn(
|
|
18
|
+
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const tabsListVariants = cva(
|
|
26
|
+
"group/tabs-list inline-flex w-fit max-w-full items-center justify-start gap-0.5 overflow-x-auto [scrollbar-width:none] [&>*]:shrink-0 rounded-full p-1 text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
default: "bg-muted",
|
|
31
|
+
line: "gap-1 bg-transparent"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "default"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
function TabsList({
|
|
40
|
+
className,
|
|
41
|
+
variant = "default",
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
TabsPrimitive.List,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "tabs-list",
|
|
48
|
+
"data-variant": variant,
|
|
49
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function TabsTrigger({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
TabsPrimitive.Trigger,
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "tabs-trigger",
|
|
62
|
+
className: cn(
|
|
63
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-full border border-transparent px-3 py-1 text-sm whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
64
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
|
|
65
|
+
"data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-input dark:data-[state=active]:text-foreground",
|
|
66
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function TabsContent({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
TabsPrimitive.Content,
|
|
79
|
+
{
|
|
80
|
+
"data-slot": "tabs-content",
|
|
81
|
+
className: cn("flex-1 outline-none", className),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
Tabs,
|
|
88
|
+
TabsContent,
|
|
89
|
+
TabsList,
|
|
90
|
+
TabsTrigger,
|
|
91
|
+
tabsListVariants
|
|
92
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@recanica/ui/lib/utils";
|
|
4
|
+
import { useFieldInvalid } from "@recanica/ui/components/field";
|
|
5
|
+
function Textarea({ className, ...props }) {
|
|
6
|
+
const invalid = useFieldInvalid();
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"textarea",
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "textarea",
|
|
11
|
+
"aria-invalid": props["aria-invalid"] ?? (invalid || void 0),
|
|
12
|
+
className: cn(
|
|
13
|
+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 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 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
Textarea
|
|
22
|
+
};
|