@siyahi/ui 0.1.9-next.33 → 0.1.9-next.35
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/DESIGN.md +21 -7
- package/README.md +5 -5
- package/agents/examples/app-sidebar.tsx +0 -2
- package/agents/examples/chart-panels-three.tsx +51 -0
- package/agents/examples/context-menu.tsx +14 -4
- package/agents/examples/overview-dashboard.tsx +2 -2
- package/agents/examples/{page-hero.tsx → page-header.tsx} +4 -4
- package/agents/examples/select.tsx +2 -1
- package/agents/manifest.json +16 -5
- package/dist/components/registry/charts/area-chart-card.js +1 -0
- package/dist/components/registry/charts/bar-chart-card.js +0 -2
- package/dist/components/registry/heatmap/calendar-heatmap.js +1 -1
- package/dist/components/registry/heatmap/status-heatmap.js +1 -1
- package/dist/components/registry/heatmap/weekday-heatmap.js +1 -1
- package/dist/components/registry/niko-table/core/data-table-error-boundary.js +1 -1
- package/dist/components/registry/niko-table/core/data-table-structure.js +6 -0
- package/dist/components/registry/niko-table/core/data-table.js +1 -1
- package/dist/components/registry/niko-table/filters/table-column-sort.js +2 -2
- package/dist/components/registry/niko-table/filters/table-faceted-filter.js +3 -3
- package/dist/components/registry/niko-table/lib/column-resize-handle.js +1 -1
- package/dist/components/registry/sidebar-07/nav-user.js +16 -19
- package/dist/components/siyahi/{page-hero.d.ts → page-header.d.ts} +3 -3
- package/dist/components/siyahi/{page-hero.js → page-header.js} +4 -4
- package/dist/components/siyahi/panel-grid.d.ts +5 -2
- package/dist/components/siyahi/panel-grid.js +1 -1
- package/dist/components/siyahi/range-position.js +1 -1
- package/dist/components/siyahi/scatter-chart.js +15 -2
- package/dist/components/siyahi/status-badge.js +1 -0
- package/dist/components/siyahi/target-rows.js +2 -2
- package/dist/components/siyahi/treemap.js +0 -3
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert-dialog.js +94 -0
- package/dist/components/ui/aspect-ratio.d.ts +6 -0
- package/dist/components/ui/aspect-ratio.js +13 -0
- package/dist/components/ui/attachment.d.ts +25 -0
- package/dist/components/ui/attachment.js +104 -0
- package/dist/components/ui/bubble.d.ts +18 -0
- package/dist/components/ui/bubble.js +73 -0
- package/dist/components/ui/button-group.d.ts +12 -0
- package/dist/components/ui/button-group.js +41 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/carousel.d.ts +30 -0
- package/dist/components/ui/carousel.js +131 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.js +20 -0
- package/dist/components/ui/combobox.d.ts +26 -0
- package/dist/components/ui/combobox.js +162 -0
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.js +1 -0
- package/dist/components/ui/drawer.d.ts +18 -0
- package/dist/components/ui/drawer.js +123 -0
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.js +59 -0
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.js +36 -0
- package/dist/components/ui/input-otp.d.ts +13 -0
- package/dist/components/ui/input-otp.js +46 -0
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.js +121 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.js +19 -0
- package/dist/components/ui/marker.d.ts +12 -0
- package/dist/components/ui/marker.js +43 -0
- package/dist/components/ui/menubar.d.ts +31 -0
- package/dist/components/ui/menubar.js +136 -0
- package/dist/components/ui/message-scroller.d.ts +12 -0
- package/dist/components/ui/message-scroller.js +60 -0
- package/dist/components/ui/message.d.ts +12 -0
- package/dist/components/ui/message.js +49 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +38 -0
- package/dist/components/ui/navigation-menu.d.ts +13 -0
- package/dist/components/ui/navigation-menu.js +82 -0
- package/dist/components/ui/pagination.d.ts +19 -0
- package/dist/components/ui/pagination.js +80 -0
- package/dist/components/ui/questionnaire.d.ts +21 -0
- package/dist/components/ui/questionnaire.js +170 -0
- package/dist/components/ui/radio-group.d.ts +7 -0
- package/dist/components/ui/radio-group.js +26 -0
- package/dist/components/ui/resizable.d.ts +9 -0
- package/dist/components/ui/resizable.js +28 -0
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.js +15 -0
- package/dist/components/ui/switch.d.ts +7 -0
- package/dist/components/ui/switch.js +19 -0
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.js +123 -0
- package/dist/components/ui/trace.d.ts +20 -0
- package/dist/components/ui/trace.js +75 -0
- package/dist/index.d.ts +32 -2
- package/dist/index.js +35 -5
- package/dist/lib/chart-frame.d.ts +37 -9
- package/dist/lib/chart-frame.js +60 -30
- package/dist/lib/chart-series.d.ts +3 -2
- package/dist/lib/ticks.d.ts +9 -0
- package/dist/lib/ticks.js +25 -3
- package/dist/lib/use-render-when-fonts-load.d.ts +11 -0
- package/dist/lib/use-render-when-fonts-load.js +49 -0
- package/package.json +5 -3
- package/styles/siyahi.css +224 -26
- package/agents/report-rules.json +0 -7
- package/report.css +0 -145
|
@@ -3,6 +3,7 @@ import { ChartContainer } from "../ui/chart.js";
|
|
|
3
3
|
import { LOG_BLOCKED, useAxisScale } from "./scale-toggle.js";
|
|
4
4
|
import { useLocale } from "./siyahi-provider.js";
|
|
5
5
|
import { fitsLog, ticksFor } from "../../lib/ticks.js";
|
|
6
|
+
import { fontLoads, useRenderWhenFontsLoad } from "../../lib/use-render-when-fonts-load.js";
|
|
6
7
|
import { corners, dotSizes, placeLabels, quadrantSplit } from "../../lib/scatter.js";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -43,6 +44,10 @@ function ScatterChartCard({ title, description, action, points, height, xLabel,
|
|
|
43
44
|
const formatY = useMemo(() => yFormatter ?? new Intl.NumberFormat(numberLocale).format, [yFormatter, numberLocale]);
|
|
44
45
|
const formatSize = useMemo(() => sizeFormatter ?? new Intl.NumberFormat(numberLocale).format, [sizeFormatter, numberLocale]);
|
|
45
46
|
const drawn = useMemo(() => points.filter((p) => p.y !== null && Number.isFinite(p.y) && Number.isFinite(p.x)), [points]);
|
|
47
|
+
useRenderWhenFontsLoad(() => {
|
|
48
|
+
const { measure } = labelType();
|
|
49
|
+
return [...labels > 0 ? drawn.map(({ name }) => name) : [], ...Object.values(quadrants?.labels ?? {})].map((name) => name ? measure(name) : 0).join();
|
|
50
|
+
});
|
|
46
51
|
const both = xScaleToggle && yScaleToggle;
|
|
47
52
|
const across = useAxisScale({
|
|
48
53
|
initial: xScale,
|
|
@@ -240,7 +245,7 @@ function PointTooltip({ active, payload, details }) {
|
|
|
240
245
|
const point = active ? payload?.[0]?.payload : void 0;
|
|
241
246
|
if (!point) return null;
|
|
242
247
|
return /* @__PURE__ */ jsxs("div", {
|
|
243
|
-
className: "grid min-w-32 gap-1.5
|
|
248
|
+
className: "grid min-w-32 gap-1.5 border border-border bg-background px-2.5 py-1.5 text-xs",
|
|
244
249
|
children: [/* @__PURE__ */ jsx("span", {
|
|
245
250
|
className: "font-medium",
|
|
246
251
|
children: point.name
|
|
@@ -297,8 +302,12 @@ function Dot({ cx, cy, payload, index, "data-recharts-item-id": itemId, selected
|
|
|
297
302
|
strokeWidth: RING
|
|
298
303
|
}), dot] });
|
|
299
304
|
}
|
|
300
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* A name's width in the labels' type, measured on a canvas once per font and name, and again after each font load:
|
|
307
|
+
* the font string is the same before and after Geist arrives, and a width measured before was the fallback's.
|
|
308
|
+
*/
|
|
301
309
|
const widths = /* @__PURE__ */ new Map();
|
|
310
|
+
let widthsAfter = 0;
|
|
302
311
|
let canvas;
|
|
303
312
|
/** The labels' type as the page sets it: text-xs is three quarters of the root size, which a reader may enlarge. */
|
|
304
313
|
function labelType() {
|
|
@@ -309,6 +318,10 @@ function labelType() {
|
|
|
309
318
|
const size = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) * .75;
|
|
310
319
|
const font = `500 ${size}px ${getComputedStyle(document.body).fontFamily}`;
|
|
311
320
|
canvas ??= document.createElement("canvas").getContext("2d");
|
|
321
|
+
if (fontLoads() !== widthsAfter) {
|
|
322
|
+
widths.clear();
|
|
323
|
+
widthsAfter = fontLoads();
|
|
324
|
+
}
|
|
312
325
|
const measure = (text) => {
|
|
313
326
|
const id = `${font}\n${text}`;
|
|
314
327
|
let width = widths.get(id);
|
|
@@ -16,6 +16,7 @@ function StatusBadge({ tone = "neutral", className, children, ...props }) {
|
|
|
16
16
|
...props,
|
|
17
17
|
children: [/* @__PURE__ */ jsx("span", {
|
|
18
18
|
"aria-hidden": "true",
|
|
19
|
+
"data-slot": "status-dot",
|
|
19
20
|
className: cn("size-1.5 rounded-full", TONES[tone].dot)
|
|
20
21
|
}), children]
|
|
21
22
|
});
|
|
@@ -37,7 +37,7 @@ function TargetRows({ rows, domain, valueFormatter, className }) {
|
|
|
37
37
|
/* @__PURE__ */ jsxs("div", {
|
|
38
38
|
className: "flex items-baseline justify-between gap-3",
|
|
39
39
|
children: [/* @__PURE__ */ jsx("span", {
|
|
40
|
-
className: "
|
|
40
|
+
className: "min-w-0 font-medium wrap-anywhere",
|
|
41
41
|
children: row.label
|
|
42
42
|
}), /* @__PURE__ */ jsx("span", {
|
|
43
43
|
className: "shrink-0 text-base font-semibold tabular-nums",
|
|
@@ -47,7 +47,7 @@ function TargetRows({ rows, domain, valueFormatter, className }) {
|
|
|
47
47
|
/* @__PURE__ */ jsxs("div", {
|
|
48
48
|
className: "flex justify-between gap-3 text-muted-foreground",
|
|
49
49
|
children: [/* @__PURE__ */ jsx("span", {
|
|
50
|
-
className: "
|
|
50
|
+
className: "min-w-0 wrap-anywhere",
|
|
51
51
|
children: row.detail
|
|
52
52
|
}), /* @__PURE__ */ jsxs("span", {
|
|
53
53
|
className: "shrink-0 tabular-nums",
|
|
@@ -108,7 +108,6 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
108
108
|
/* @__PURE__ */ jsx("rect", {
|
|
109
109
|
width: "100%",
|
|
110
110
|
height: "100%",
|
|
111
|
-
rx: 4,
|
|
112
111
|
style: { fill: heat(item.change, range) }
|
|
113
112
|
}),
|
|
114
113
|
key === selectedKey && /* @__PURE__ */ jsx("rect", {
|
|
@@ -116,7 +115,6 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
116
115
|
y: 1,
|
|
117
116
|
width: box.width - 2,
|
|
118
117
|
height: box.height - 2,
|
|
119
|
-
rx: 3,
|
|
120
118
|
fill: "none",
|
|
121
119
|
strokeWidth: 2,
|
|
122
120
|
className: "stroke-foreground"
|
|
@@ -150,7 +148,6 @@ function Swatch({ label, fill }) {
|
|
|
150
148
|
children: [/* @__PURE__ */ jsx("title", { children: label }), /* @__PURE__ */ jsx("rect", {
|
|
151
149
|
width: "100%",
|
|
152
150
|
height: "100%",
|
|
153
|
-
rx: 2,
|
|
154
151
|
style: { fill }
|
|
155
152
|
})]
|
|
156
153
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
4
|
+
//#region src/components/ui/alert-dialog.d.ts
|
|
5
|
+
declare function AlertDialog({ ...props }: AlertDialog$1.Root.Props): React$1.JSX.Element;
|
|
6
|
+
declare function AlertDialogTrigger({ ...props }: AlertDialog$1.Trigger.Props): React$1.JSX.Element;
|
|
7
|
+
declare function AlertDialogPortal({ ...props }: AlertDialog$1.Portal.Props): React$1.JSX.Element;
|
|
8
|
+
declare function AlertDialogOverlay({ className, ...props }: AlertDialog$1.Backdrop.Props): React$1.JSX.Element;
|
|
9
|
+
declare function AlertDialogContent({ className, size, ...props }: AlertDialog$1.Popup.Props & {
|
|
10
|
+
size?: "default" | "sm";
|
|
11
|
+
}): React$1.JSX.Element;
|
|
12
|
+
declare function AlertDialogHeader({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
13
|
+
declare function AlertDialogFooter({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
14
|
+
declare function AlertDialogMedia({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
15
|
+
declare function AlertDialogTitle({ className, ...props }: React$1.ComponentProps<typeof AlertDialog$1.Title>): React$1.JSX.Element;
|
|
16
|
+
declare function AlertDialogDescription({ className, ...props }: React$1.ComponentProps<typeof AlertDialog$1.Description>): React$1.JSX.Element;
|
|
17
|
+
declare function AlertDialogAction({ className, ...props }: React$1.ComponentProps<typeof Button>): React$1.JSX.Element;
|
|
18
|
+
declare function AlertDialogCancel({ className, variant, size, ...props }: AlertDialog$1.Close.Props & Pick<React$1.ComponentProps<typeof Button>, "variant" | "size">): React$1.JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
6
|
+
//#region src/components/ui/alert-dialog.tsx
|
|
7
|
+
function AlertDialog({ ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Root, {
|
|
9
|
+
"data-slot": "alert-dialog",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function AlertDialogTrigger({ ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
15
|
+
"data-slot": "alert-dialog-trigger",
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function AlertDialogPortal({ ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Portal, {
|
|
21
|
+
"data-slot": "alert-dialog-portal",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, {
|
|
27
|
+
"data-slot": "alert-dialog-overlay",
|
|
28
|
+
className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function AlertDialogContent({ className, size = "default", ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialog$1.Popup, {
|
|
34
|
+
"data-slot": "alert-dialog-content",
|
|
35
|
+
"data-size": size,
|
|
36
|
+
className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
37
|
+
...props
|
|
38
|
+
})] });
|
|
39
|
+
}
|
|
40
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "alert-dialog-header",
|
|
43
|
+
className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
"data-slot": "alert-dialog-footer",
|
|
50
|
+
className: cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", {
|
|
56
|
+
"data-slot": "alert-dialog-media",
|
|
57
|
+
className: cn("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6", className),
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
63
|
+
"data-slot": "alert-dialog-title",
|
|
64
|
+
className: cn("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className),
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
70
|
+
"data-slot": "alert-dialog-description",
|
|
71
|
+
className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function AlertDialogAction({ className, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
77
|
+
"data-slot": "alert-dialog-action",
|
|
78
|
+
className: cn(className),
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function AlertDialogCancel({ className, variant = "outline", size = "default", ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Close, {
|
|
84
|
+
"data-slot": "alert-dialog-cancel",
|
|
85
|
+
className: cn(className),
|
|
86
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
87
|
+
variant,
|
|
88
|
+
size
|
|
89
|
+
}),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/aspect-ratio.tsx
|
|
4
|
+
function AspectRatio({ ratio, className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
"data-slot": "aspect-ratio",
|
|
7
|
+
style: { "--ratio": ratio },
|
|
8
|
+
className: cn("relative aspect-(--ratio)", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
//#region src/components/ui/attachment.d.ts
|
|
6
|
+
declare const attachmentVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
8
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
11
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
12
|
+
}): React$1.JSX.Element;
|
|
13
|
+
declare const attachmentMediaVariants: (props?: ({
|
|
14
|
+
variant?: "icon" | "image" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
declare function AttachmentMedia({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): React$1.JSX.Element;
|
|
17
|
+
declare function AttachmentContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
18
|
+
declare function AttachmentTitle({ className, ...props }: React$1.ComponentProps<"span">): React$1.JSX.Element;
|
|
19
|
+
declare function AttachmentDescription({ className, ...props }: React$1.ComponentProps<"span">): React$1.JSX.Element;
|
|
20
|
+
declare function AttachmentActions({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
21
|
+
declare function AttachmentAction({ className, variant, size, ...props }: React$1.ComponentProps<typeof Button>): React$1.JSX.Element;
|
|
22
|
+
declare function AttachmentTrigger({ className, render, type, ...props }: useRender.ComponentProps<"button">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
23
|
+
declare function AttachmentGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
//#region src/components/ui/attachment.tsx
|
|
9
|
+
const attachmentVariants = cva("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", { variants: {
|
|
10
|
+
size: {
|
|
11
|
+
default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
|
|
12
|
+
sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
|
|
13
|
+
xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
|
|
14
|
+
},
|
|
15
|
+
orientation: {
|
|
16
|
+
horizontal: "min-w-40 items-center",
|
|
17
|
+
vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
|
|
18
|
+
}
|
|
19
|
+
} });
|
|
20
|
+
function Attachment({ className, state = "done", size = "default", orientation = "horizontal", ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
"data-slot": "attachment",
|
|
23
|
+
"data-state": state,
|
|
24
|
+
"data-size": size,
|
|
25
|
+
"data-orientation": orientation,
|
|
26
|
+
className: cn(attachmentVariants({
|
|
27
|
+
size,
|
|
28
|
+
orientation
|
|
29
|
+
}), className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const attachmentMediaVariants = cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
34
|
+
variants: { variant: {
|
|
35
|
+
icon: "",
|
|
36
|
+
image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
|
|
37
|
+
} },
|
|
38
|
+
defaultVariants: { variant: "icon" }
|
|
39
|
+
});
|
|
40
|
+
function AttachmentMedia({ className, variant = "icon", ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "attachment-media",
|
|
43
|
+
"data-variant": variant,
|
|
44
|
+
className: cn(attachmentMediaVariants({ variant }), className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function AttachmentContent({ className, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
"data-slot": "attachment-content",
|
|
51
|
+
className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function AttachmentTitle({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("span", {
|
|
57
|
+
"data-slot": "attachment-title",
|
|
58
|
+
className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function AttachmentDescription({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx("span", {
|
|
64
|
+
"data-slot": "attachment-description",
|
|
65
|
+
className: cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80", "max-w-full", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function AttachmentActions({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
"data-slot": "attachment-actions",
|
|
72
|
+
className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function AttachmentAction({ className, variant, size = "icon-xs", ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
78
|
+
"data-slot": "attachment-action",
|
|
79
|
+
variant: variant ?? "ghost",
|
|
80
|
+
size,
|
|
81
|
+
className: cn(className),
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function AttachmentTrigger({ className, render, type, ...props }) {
|
|
86
|
+
return useRender({
|
|
87
|
+
defaultTagName: "button",
|
|
88
|
+
props: mergeProps({
|
|
89
|
+
type: render ? type : type ?? "button",
|
|
90
|
+
className: cn("absolute inset-0 z-10 outline-none", className)
|
|
91
|
+
}, props),
|
|
92
|
+
render,
|
|
93
|
+
state: { slot: "attachment-trigger" }
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function AttachmentGroup({ className, ...props }) {
|
|
97
|
+
return /* @__PURE__ */ jsx("div", {
|
|
98
|
+
"data-slot": "attachment-group",
|
|
99
|
+
className: cn("flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start", className),
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/ui/bubble.d.ts
|
|
5
|
+
declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
|
+
declare const bubbleVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | "ghost" | "muted" | "outline" | "secondary" | "tinted" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
10
|
+
align?: "start" | "end";
|
|
11
|
+
}): React$1.JSX.Element;
|
|
12
|
+
declare function BubbleContent({ className, render, ...props }: useRender.ComponentProps<"div">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
13
|
+
declare function BubbleReactions({ side, align, className, ...props }: React$1.ComponentProps<"div"> & {
|
|
14
|
+
align?: "start" | "end";
|
|
15
|
+
side?: "top" | "bottom";
|
|
16
|
+
}): React$1.JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
//#region src/components/ui/bubble.tsx
|
|
8
|
+
function BubbleGroup({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
"data-slot": "bubble-group",
|
|
11
|
+
className: cn("flex min-w-0 flex-col gap-2", className),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const bubbleVariants = cva("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full", {
|
|
16
|
+
variants: { variant: {
|
|
17
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
18
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
19
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
20
|
+
tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
21
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
22
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
23
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"
|
|
24
|
+
} },
|
|
25
|
+
defaultVariants: { variant: "default" }
|
|
26
|
+
});
|
|
27
|
+
function Bubble({ variant = "default", align = "start", className, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"data-slot": "bubble",
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
"data-align": align,
|
|
32
|
+
className: cn(bubbleVariants({ variant }), className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function BubbleContent({ className, render, ...props }) {
|
|
37
|
+
return useRender({
|
|
38
|
+
defaultTagName: "div",
|
|
39
|
+
props: mergeProps({ className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className) }, props),
|
|
40
|
+
render,
|
|
41
|
+
state: { slot: "bubble-content" }
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const bubbleReactionsVariants = cva("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0", {
|
|
45
|
+
variants: {
|
|
46
|
+
side: {
|
|
47
|
+
top: "top-0 -translate-y-3/4",
|
|
48
|
+
bottom: "bottom-0 translate-y-3/4"
|
|
49
|
+
},
|
|
50
|
+
align: {
|
|
51
|
+
start: "left-3",
|
|
52
|
+
end: "right-3"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
side: "bottom",
|
|
57
|
+
align: "end"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function BubbleReactions({ side = "bottom", align = "end", className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx("div", {
|
|
62
|
+
"data-slot": "bubble-reactions",
|
|
63
|
+
"data-align": align,
|
|
64
|
+
"data-side": side,
|
|
65
|
+
className: cn(bubbleReactionsVariants({
|
|
66
|
+
side,
|
|
67
|
+
align
|
|
68
|
+
}), className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Separator } from "./separator.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/ui/button-group.d.ts
|
|
5
|
+
declare const buttonGroupVariants: (props?: ({
|
|
6
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
9
|
+
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
10
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Separator } from "./separator.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
//#region src/components/ui/button-group.tsx
|
|
8
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
9
|
+
variants: { orientation: {
|
|
10
|
+
horizontal: "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
11
|
+
vertical: "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { orientation: "horizontal" }
|
|
14
|
+
});
|
|
15
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
role: "group",
|
|
18
|
+
"data-slot": "button-group",
|
|
19
|
+
"data-orientation": orientation,
|
|
20
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function ButtonGroupText({ className, render, ...props }) {
|
|
25
|
+
return useRender({
|
|
26
|
+
defaultTagName: "div",
|
|
27
|
+
props: mergeProps({ className: cn("flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className) }, props),
|
|
28
|
+
render,
|
|
29
|
+
state: { slot: "button-group-text" }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
34
|
+
"data-slot": "button-group-separator",
|
|
35
|
+
orientation,
|
|
36
|
+
className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariantProps } from "class-variance-authority";
|
|
2
1
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/components/ui/button.d.ts
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
5
|
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "cn";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cva } from "class-variance-authority";
|
|
4
3
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
5
|
//#region src/components/ui/button.tsx
|
|
6
6
|
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
7
7
|
variants: {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
4
|
+
//#region src/components/ui/carousel.d.ts
|
|
5
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
6
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
7
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
8
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
9
|
+
type CarouselProps = {
|
|
10
|
+
opts?: CarouselOptions;
|
|
11
|
+
plugins?: CarouselPlugin;
|
|
12
|
+
orientation?: "horizontal" | "vertical";
|
|
13
|
+
setApi?: (api: CarouselApi) => void;
|
|
14
|
+
};
|
|
15
|
+
type CarouselContextProps = {
|
|
16
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
17
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
18
|
+
scrollPrev: () => void;
|
|
19
|
+
scrollNext: () => void;
|
|
20
|
+
canScrollPrev: boolean;
|
|
21
|
+
canScrollNext: boolean;
|
|
22
|
+
} & CarouselProps;
|
|
23
|
+
declare function useCarousel(): CarouselContextProps;
|
|
24
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React$1.ComponentProps<"div"> & CarouselProps): React$1.JSX.Element;
|
|
25
|
+
declare function CarouselContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
26
|
+
declare function CarouselItem({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
27
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React$1.ComponentProps<typeof Button>): React$1.JSX.Element;
|
|
28
|
+
declare function CarouselNext({ className, variant, size, ...props }: React$1.ComponentProps<typeof Button>): React$1.JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|