@siyahi/ui 0.1.9-next.2 → 0.1.9-next.21
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 +30 -0
- package/README.md +82 -176
- package/THIRD_PARTY_NOTICES.md +11 -11
- package/agents/examples/accordion.tsx +39 -0
- package/agents/examples/alert.tsx +23 -0
- package/agents/examples/app-sidebar.tsx +38 -0
- package/agents/examples/avatar.tsx +14 -0
- package/agents/examples/badge.tsx +18 -0
- package/agents/examples/bar-list-labels.tsx +22 -0
- package/agents/examples/bar-list-sides.tsx +38 -0
- package/agents/examples/bar-list.tsx +24 -0
- package/agents/examples/breadcrumb.tsx +28 -0
- package/agents/examples/button-states.tsx +23 -0
- package/agents/examples/button.tsx +21 -0
- package/agents/examples/calendar.tsx +15 -0
- package/agents/examples/callout.tsx +33 -0
- package/agents/examples/card.tsx +34 -0
- package/agents/examples/change-bar.tsx +104 -0
- package/agents/examples/chart-area.tsx +39 -0
- package/agents/examples/chart-bar-flows.tsx +32 -0
- package/agents/examples/chart-bar-hourly.tsx +28 -0
- package/agents/examples/chart-bar-losses.tsx +29 -0
- package/agents/examples/chart-bar-sectors.tsx +72 -0
- package/agents/examples/chart-bar-years.tsx +40 -0
- package/agents/examples/chart-bar.tsx +56 -0
- package/agents/examples/chart-category-ticks.tsx +50 -0
- package/agents/examples/chart-line-events.tsx +47 -0
- package/agents/examples/chart-line-timeline.tsx +41 -0
- package/agents/examples/chart-line.tsx +57 -0
- package/agents/examples/code-block.tsx +38 -0
- package/agents/examples/collapsible.tsx +16 -0
- package/agents/examples/command.tsx +27 -0
- package/agents/examples/context-menu.tsx +15 -0
- package/agents/examples/copy-button.tsx +8 -0
- package/agents/examples/data-bar.tsx +121 -0
- package/agents/examples/data-table-compact.tsx +95 -0
- package/agents/examples/data-table-filters.tsx +103 -0
- package/agents/examples/data-table.tsx +98 -0
- package/agents/examples/delta.tsx +13 -0
- package/agents/examples/dialog.tsx +28 -0
- package/agents/examples/distribution-bar-budget.tsx +30 -0
- package/agents/examples/distribution-bar-tug.tsx +72 -0
- package/agents/examples/dropdown-menu.tsx +31 -0
- package/agents/examples/formatters.tsx +42 -0
- package/agents/examples/heatmap-calendar.tsx +60 -0
- package/agents/examples/heatmap-status.tsx +57 -0
- package/agents/examples/heatmap-weekday.tsx +75 -0
- package/agents/examples/input-states.tsx +33 -0
- package/agents/examples/input.tsx +17 -0
- package/agents/examples/local-time.tsx +14 -0
- package/agents/examples/metric-strip.tsx +46 -0
- package/agents/examples/overview-dashboard.tsx +18 -0
- package/agents/examples/page-hero.tsx +38 -0
- package/agents/examples/page-section.tsx +52 -0
- package/agents/examples/popover.tsx +23 -0
- package/agents/examples/price-chart.tsx +32 -0
- package/agents/examples/progress-tone.tsx +28 -0
- package/agents/examples/progress.tsx +10 -0
- package/agents/examples/range-position-table.tsx +101 -0
- package/agents/examples/range-position.tsx +53 -0
- package/agents/examples/scroll-area.tsx +20 -0
- package/agents/examples/section-cards-select.tsx +30 -0
- package/agents/examples/section-cards-trend.tsx +30 -0
- package/agents/examples/section-cards.tsx +48 -0
- package/agents/examples/select.tsx +27 -0
- package/agents/examples/separator.tsx +13 -0
- package/agents/examples/sheet.tsx +15 -0
- package/agents/examples/skeleton.tsx +11 -0
- package/agents/examples/slider.tsx +5 -0
- package/agents/examples/surfaces.tsx +116 -0
- package/agents/examples/table.tsx +50 -0
- package/agents/examples/tabs.tsx +16 -0
- package/agents/examples/target-rows.tsx +70 -0
- package/agents/examples/toggle-group.tsx +12 -0
- package/agents/examples/toggle.tsx +11 -0
- package/agents/examples/tooltip.tsx +13 -0
- package/agents/examples/treemap.tsx +88 -0
- package/agents/manifest.json +1081 -0
- package/agents/report-rules.json +7 -0
- package/dist/components/registry/charts/area-chart-card.js +25 -7
- package/dist/components/registry/charts/bar-chart-card.d.ts +0 -1
- package/dist/components/registry/charts/bar-chart-card.js +40 -26
- package/dist/components/registry/charts/line-chart-card.js +2 -2
- package/dist/components/registry/dashboard-01/section-cards.d.ts +2 -0
- package/dist/components/registry/dashboard-01/section-cards.js +42 -35
- package/dist/components/registry/dashboardcn/bar-list.js +18 -11
- package/dist/components/registry/dashboardcn/distribution-bar.js +1 -1
- package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +29 -0
- package/dist/components/registry/dashboardcn/kpi-row-card.js +81 -0
- package/dist/components/registry/dashboardcn/sparkline.d.ts +22 -0
- package/dist/components/registry/dashboardcn/sparkline.js +117 -0
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +4 -2
- package/dist/components/registry/heatmap/calendar-heatmap.js +74 -33
- package/dist/components/registry/heatmap/status-heatmap.d.ts +5 -3
- package/dist/components/registry/heatmap/status-heatmap.js +37 -15
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +9 -3
- package/dist/components/registry/heatmap/weekday-heatmap.js +82 -47
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +18 -1
- package/dist/components/registry/niko-table/core/data-table-context.js +7 -1
- package/dist/components/registry/niko-table/core/data-table-grouped-row.js +3 -1
- package/dist/components/registry/niko-table/core/data-table-root.js +39 -4
- package/dist/components/registry/niko-table/core/data-table-structure.js +17 -12
- package/dist/components/registry/niko-table/core/data-table.d.ts +2 -2
- package/dist/components/registry/niko-table/core/data-table.js +5 -1
- package/dist/components/registry/niko-table/filters/table-faceted-filter.js +4 -4
- package/dist/components/registry/niko-table/filters/table-search-filter.js +1 -1
- package/dist/components/registry/niko-table/lib/flex-columns.d.ts +1 -1
- package/dist/components/registry/niko-table/lib/flex-columns.js +3 -3
- package/dist/components/registry/niko-table/lib/styles.d.ts +1 -1
- package/dist/components/registry/niko-table/lib/styles.js +3 -3
- package/dist/components/registry/niko-table/types/index.d.ts +9 -0
- package/dist/components/registry/niko-table/ui/table.js +2 -2
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +1 -1
- package/dist/components/registry/sidebar-07/app-sidebar.js +3 -1
- package/dist/components/registry/sidebar-07/nav-main.d.ts +2 -1
- package/dist/components/registry/sidebar-07/nav-main.js +16 -3
- package/dist/components/siyahi/callout.d.ts +24 -0
- package/dist/components/siyahi/callout.js +40 -0
- package/dist/components/siyahi/change-bar.d.ts +21 -0
- package/dist/components/siyahi/change-bar.js +35 -0
- package/dist/components/siyahi/data-bar.d.ts +19 -0
- package/dist/components/siyahi/data-bar.js +29 -0
- package/dist/components/siyahi/data-table-compact-columns-toggle.d.ts +4 -0
- package/dist/components/siyahi/data-table-compact-columns-toggle.js +19 -0
- package/dist/components/siyahi/data-table-footnote.d.ts +12 -0
- package/dist/components/siyahi/data-table-footnote.js +35 -0
- package/dist/components/siyahi/default-sidebar-open.d.ts +8 -0
- package/dist/components/siyahi/default-sidebar-open.js +13 -0
- package/dist/components/siyahi/page-hero.d.ts +25 -0
- package/dist/components/siyahi/page-hero.js +41 -0
- package/dist/components/siyahi/page-section.d.ts +4 -1
- package/dist/components/siyahi/page-section.js +6 -3
- package/dist/components/siyahi/page-toc.d.ts +20 -0
- package/dist/components/siyahi/page-toc.js +76 -0
- package/dist/components/siyahi/panel-grid.d.ts +22 -0
- package/dist/components/siyahi/panel-grid.js +34 -0
- package/dist/components/siyahi/quote.d.ts +12 -0
- package/dist/components/siyahi/quote.js +23 -0
- package/dist/components/siyahi/range-position.d.ts +24 -0
- package/dist/components/siyahi/range-position.js +105 -0
- package/dist/components/siyahi/siyahi-provider.d.ts +13 -2
- package/dist/components/siyahi/siyahi-provider.js +17 -4
- package/dist/components/siyahi/target-rows.d.ts +34 -0
- package/dist/components/siyahi/target-rows.js +97 -0
- package/dist/components/siyahi/treemap.d.ts +4 -1
- package/dist/components/siyahi/treemap.js +78 -28
- package/dist/components/siyahi/warning-alert.d.ts +10 -0
- package/dist/components/siyahi/warning-alert.js +20 -0
- package/dist/components/ui/accordion.js +5 -5
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +2 -2
- package/dist/components/ui/button.js +10 -10
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/card.js +4 -4
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/code-block.js +13 -12
- package/dist/components/ui/command.js +7 -6
- package/dist/components/ui/context-menu.js +7 -7
- package/dist/components/ui/dialog.js +5 -5
- package/dist/components/ui/dropdown-menu.js +8 -8
- package/dist/components/ui/input-group.js +11 -11
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/popover.js +3 -3
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/select.js +6 -6
- package/dist/components/ui/sheet.js +5 -5
- package/dist/components/ui/sidebar.js +17 -18
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +2 -2
- package/dist/components/ui/table.js +2 -2
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.js +4 -4
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/index.d.ts +21 -7
- package/dist/index.js +18 -4
- package/dist/lib/chart-frame.d.ts +25 -7
- package/dist/lib/chart-frame.js +251 -127
- package/dist/lib/chart-series.d.ts +12 -6
- package/dist/lib/compact-columns.d.ts +19 -0
- package/dist/lib/compact-columns.js +55 -0
- package/dist/lib/format.d.ts +7 -2
- package/dist/lib/format.js +54 -16
- package/dist/lib/heatmap-navigation.d.ts +8 -0
- package/dist/lib/heatmap-navigation.js +49 -0
- package/dist/lib/treemap.js +6 -1
- package/dist/lib/use-element-width.d.ts +5 -0
- package/dist/lib/use-element-width.js +15 -0
- package/package.json +4 -1
- package/registry.lock.json +16 -0
- package/report.css +33 -32
- package/styles/siyahi.css +221 -39
- package/dist/lib/recharts.d.ts +0 -2
- package/dist/lib/recharts.js +0 -1
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { useFormat } from "../../lib/format.js";
|
|
2
|
+
import { useElementWidth } from "../../lib/use-element-width.js";
|
|
2
3
|
import { heat, heatFill, heatRange, layout } from "../../lib/treemap.js";
|
|
3
4
|
import { cn } from "cn";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useEffect, useEffectEvent,
|
|
6
|
+
import { useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
6
7
|
//#region src/components/siyahi/treemap.tsx
|
|
7
8
|
/** Holdings heat map: area by weight, colour by signed change, optionally grouped; hand-drawn SVG. */
|
|
8
9
|
function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
9
|
-
const ref =
|
|
10
|
-
const [
|
|
10
|
+
const [ref, width] = useElementWidth();
|
|
11
|
+
const [focusedKey, setFocusedKey] = useState(null);
|
|
11
12
|
const selectedKey = selected ? selected.key ?? selected.name : null;
|
|
12
13
|
const { pct } = useFormat();
|
|
13
|
-
useLayoutEffect(() => {
|
|
14
|
-
const observer = new ResizeObserver(([entry]) => setWidth(entry?.contentRect.width ?? 0));
|
|
15
|
-
if (ref.current) observer.observe(ref.current);
|
|
16
|
-
return () => observer.disconnect();
|
|
17
|
-
}, []);
|
|
18
14
|
const clearOutside = useEffectEvent((event) => {
|
|
19
15
|
const tile = event.target instanceof Element ? event.target.closest("[data-slot=\"treemap-tile\"]") : null;
|
|
20
16
|
if (!ref.current?.contains(tile)) onSelect?.(null);
|
|
@@ -25,7 +21,12 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
25
21
|
document.addEventListener("pointerdown", onPointerDown);
|
|
26
22
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
27
23
|
}, [selectedKey]);
|
|
28
|
-
const { groups, tiles } = layout(items, width, height)
|
|
24
|
+
const { groups, tiles } = useMemo(() => layout(items, width, height), [
|
|
25
|
+
items,
|
|
26
|
+
width,
|
|
27
|
+
height
|
|
28
|
+
]);
|
|
29
|
+
const focusKey = tiles.some(({ item }) => (item.key ?? item.name) === focusedKey) ? focusedKey : tiles[0]?.item.key ?? tiles[0]?.item.name;
|
|
29
30
|
const change = (value) => value === null ? "—" : `${value > 0 ? "▲ " : value < 0 ? "▼ " : ""}${pct(Math.abs(value))}`;
|
|
30
31
|
return /* @__PURE__ */ jsx("div", {
|
|
31
32
|
ref,
|
|
@@ -34,32 +35,72 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
34
35
|
children: /* @__PURE__ */ jsxs("svg", {
|
|
35
36
|
width,
|
|
36
37
|
height,
|
|
37
|
-
role: "img",
|
|
38
|
+
role: onSelect ? "group" : "img",
|
|
38
39
|
"aria-label": "Treemap of holdings by weight and change",
|
|
39
40
|
className: "text-xs",
|
|
40
|
-
onPointerLeave: () => onHover?.(null),
|
|
41
|
+
onPointerLeave: (event) => event.pointerType === "mouse" && onHover?.(null),
|
|
41
42
|
children: [groups.map(({ group, ...box }) => /* @__PURE__ */ jsxs("svg", {
|
|
42
43
|
...box,
|
|
43
44
|
"data-slot": "treemap-group",
|
|
44
|
-
onPointerEnter: () => onHover?.(null),
|
|
45
|
-
children: [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
onPointerEnter: (event) => event.pointerType === "mouse" && onHover?.(null),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx("rect", {
|
|
48
|
+
width: "100%",
|
|
49
|
+
height: "100%",
|
|
50
|
+
fill: "none",
|
|
51
|
+
pointerEvents: "all"
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx("title", { children: group }),
|
|
54
|
+
textWidth(group) <= box.width - 4 && /* @__PURE__ */ jsx("text", {
|
|
55
|
+
x: 2,
|
|
56
|
+
y: 12,
|
|
57
|
+
className: "fill-muted-foreground font-medium",
|
|
58
|
+
children: group
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
}, group)), tiles.map(({ item, ...box }, index) => {
|
|
57
62
|
const key = item.key ?? item.name;
|
|
58
63
|
return /* @__PURE__ */ jsxs("svg", {
|
|
59
64
|
...box,
|
|
60
65
|
"data-slot": "treemap-tile",
|
|
61
66
|
"data-selected": key === selectedKey || void 0,
|
|
62
|
-
|
|
67
|
+
role: onSelect ? "button" : void 0,
|
|
68
|
+
tabIndex: onSelect ? key === focusKey ? 0 : -1 : void 0,
|
|
69
|
+
"aria-label": `${item.name}${item.group ? `, ${item.group}` : ""}, ${change(item.change)}`,
|
|
70
|
+
"aria-pressed": onSelect ? key === selectedKey : void 0,
|
|
71
|
+
onFocus: () => setFocusedKey(key),
|
|
72
|
+
onKeyDown: (event) => {
|
|
73
|
+
if (!onSelect) return;
|
|
74
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
onSelect(key === selectedKey ? null : item);
|
|
77
|
+
} else if (event.key === "Escape") onSelect(null);
|
|
78
|
+
else {
|
|
79
|
+
let next;
|
|
80
|
+
switch (event.key) {
|
|
81
|
+
case "Home":
|
|
82
|
+
next = 0;
|
|
83
|
+
break;
|
|
84
|
+
case "End":
|
|
85
|
+
next = tiles.length - 1;
|
|
86
|
+
break;
|
|
87
|
+
case "ArrowRight":
|
|
88
|
+
case "ArrowDown":
|
|
89
|
+
next = (index + 1) % tiles.length;
|
|
90
|
+
break;
|
|
91
|
+
case "ArrowLeft":
|
|
92
|
+
case "ArrowUp":
|
|
93
|
+
next = (index + tiles.length - 1) % tiles.length;
|
|
94
|
+
break;
|
|
95
|
+
default: return;
|
|
96
|
+
}
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
const target = tiles[next]?.item;
|
|
99
|
+
if (target) setFocusedKey(target.key ?? target.name);
|
|
100
|
+
ref.current?.querySelectorAll("[data-slot=\"treemap-tile\"]")[next]?.focus();
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onPointerEnter: (event) => event.pointerType === "mouse" && onHover?.(item),
|
|
63
104
|
onClick: () => onSelect?.(key === selectedKey ? null : item),
|
|
64
105
|
children: [
|
|
65
106
|
/* @__PURE__ */ jsx("rect", {
|
|
@@ -78,14 +119,14 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
78
119
|
strokeWidth: 2,
|
|
79
120
|
className: "stroke-foreground"
|
|
80
121
|
}),
|
|
81
|
-
box.width
|
|
122
|
+
box.width >= MIN_LABEL_WIDTH && box.height >= MIN_LABEL_HEIGHT && /* @__PURE__ */ jsxs("text", {
|
|
82
123
|
x: 8,
|
|
83
124
|
y: 18,
|
|
84
125
|
className: "fill-foreground",
|
|
85
126
|
children: [/* @__PURE__ */ jsx("tspan", {
|
|
86
127
|
className: "font-medium",
|
|
87
|
-
children: item.name
|
|
88
|
-
}), /* @__PURE__ */ jsx("tspan", {
|
|
128
|
+
children: fit(item.name, box.width - 16)
|
|
129
|
+
}), box.height >= TWO_LINE_HEIGHT && /* @__PURE__ */ jsx("tspan", {
|
|
89
130
|
x: 8,
|
|
90
131
|
dy: 16,
|
|
91
132
|
children: change(item.change)
|
|
@@ -97,6 +138,15 @@ function Treemap({ items, height, range, onHover, selected, onSelect }) {
|
|
|
97
138
|
})
|
|
98
139
|
});
|
|
99
140
|
}
|
|
141
|
+
const CHAR_PX = 6.6;
|
|
142
|
+
const textWidth = (text) => text.length * CHAR_PX;
|
|
143
|
+
function fit(text, width) {
|
|
144
|
+
const room = Math.floor(width / CHAR_PX);
|
|
145
|
+
return text.length <= room ? text : `${text.slice(0, Math.max(room - 1, 1)).trimEnd()}…`;
|
|
146
|
+
}
|
|
147
|
+
const MIN_LABEL_WIDTH = 56;
|
|
148
|
+
const MIN_LABEL_HEIGHT = 28;
|
|
149
|
+
const TWO_LINE_HEIGHT = 44;
|
|
100
150
|
function Swatch({ label, fill }) {
|
|
101
151
|
return /* @__PURE__ */ jsxs("svg", {
|
|
102
152
|
"data-slot": "treemap-legend-swatch",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Alert } from "../ui/alert.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
//#region src/components/siyahi/warning-alert.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* An Alert for a caution the reader must not miss, such as withdrawn results or incomplete data: the whole card
|
|
6
|
+
* takes a faint amber wash inside an amber border, with the warning triangle. Never mark a warning with a single
|
|
7
|
+
* coloured edge; the tint is the card. Put an AlertTitle and an AlertDescription inside.
|
|
8
|
+
*/
|
|
9
|
+
export declare function WarningAlert({ className, children, ...props }: ComponentProps<typeof Alert>): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Alert } from "../ui/alert.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { TriangleAlertIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/siyahi/warning-alert.tsx
|
|
6
|
+
/**
|
|
7
|
+
* An Alert for a caution the reader must not miss, such as withdrawn results or incomplete data: the whole card
|
|
8
|
+
* takes a faint amber wash inside an amber border, with the warning triangle. Never mark a warning with a single
|
|
9
|
+
* coloured edge; the tint is the card. Put an AlertTitle and an AlertDescription inside.
|
|
10
|
+
*/
|
|
11
|
+
function WarningAlert({ className, children, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(Alert, {
|
|
13
|
+
"data-tone": "warning",
|
|
14
|
+
className: cn("gap-x-3 border-warning/45 bg-warning/10 px-4 py-3 [&>svg]:text-warning!", className),
|
|
15
|
+
...props,
|
|
16
|
+
children: [/* @__PURE__ */ jsx(TriangleAlertIcon, {}), children]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { WarningAlert };
|
|
@@ -6,14 +6,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
function Accordion({ className, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
8
8
|
"data-slot": "accordion",
|
|
9
|
-
className: cn("flex w-full flex-col
|
|
9
|
+
className: cn("flex w-full flex-col", className),
|
|
10
10
|
...props
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function AccordionItem({ className, ...props }) {
|
|
14
14
|
return /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
15
15
|
"data-slot": "accordion-item",
|
|
16
|
-
className: cn("not-last:border-b
|
|
16
|
+
className: cn("not-last:border-b", className),
|
|
17
17
|
...props
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -22,7 +22,7 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
22
22
|
className: "flex",
|
|
23
23
|
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
|
|
24
24
|
"data-slot": "accordion-trigger",
|
|
25
|
-
className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between
|
|
25
|
+
className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground", className),
|
|
26
26
|
...props,
|
|
27
27
|
children: [
|
|
28
28
|
children,
|
|
@@ -41,10 +41,10 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
41
41
|
function AccordionContent({ className, children, ...props }) {
|
|
42
42
|
return /* @__PURE__ */ jsx(Accordion$1.Panel, {
|
|
43
43
|
"data-slot": "accordion-content",
|
|
44
|
-
className: "overflow-hidden
|
|
44
|
+
className: "overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",
|
|
45
45
|
...props,
|
|
46
46
|
children: /* @__PURE__ */ jsx("div", {
|
|
47
|
-
className: cn("h-(--accordion-panel-height) pt-0 pb-
|
|
47
|
+
className: cn("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className),
|
|
48
48
|
children
|
|
49
49
|
})
|
|
50
50
|
});
|
|
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
//#region src/components/ui/alert.tsx
|
|
6
|
-
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-
|
|
6
|
+
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
|
|
7
7
|
variants: { variant: {
|
|
8
8
|
default: "bg-card text-card-foreground",
|
|
9
9
|
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"
|
|
@@ -35,7 +35,7 @@ function AlertDescription({ className, ...props }) {
|
|
|
35
35
|
function AlertAction({ className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ jsx("div", {
|
|
37
37
|
"data-slot": "alert-action",
|
|
38
|
-
className: cn("absolute top-2
|
|
38
|
+
className: cn("absolute top-2 right-2", className),
|
|
39
39
|
...props
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -3,7 +3,7 @@ import { cva } from "class-variance-authority";
|
|
|
3
3
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
5
5
|
//#region src/components/ui/badge.tsx
|
|
6
|
-
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-
|
|
6
|
+
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
7
7
|
variants: { variant: {
|
|
8
8
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
9
9
|
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
@@ -16,14 +16,14 @@ function Breadcrumb({ className, ...props }) {
|
|
|
16
16
|
function BreadcrumbList({ className, ...props }) {
|
|
17
17
|
return /* @__PURE__ */ jsx("ol", {
|
|
18
18
|
"data-slot": "breadcrumb-list",
|
|
19
|
-
className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground
|
|
19
|
+
className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground", className),
|
|
20
20
|
...props
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
function BreadcrumbItem({ className, ...props }) {
|
|
24
24
|
return /* @__PURE__ */ jsx("li", {
|
|
25
25
|
"data-slot": "breadcrumb-item",
|
|
26
|
-
className: cn("inline-flex items-center gap-1
|
|
26
|
+
className: cn("inline-flex items-center gap-1", className),
|
|
27
27
|
...props
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -3,25 +3,25 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
5
5
|
//#region src/components/ui/button.tsx
|
|
6
|
-
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-
|
|
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: {
|
|
8
8
|
variant: {
|
|
9
9
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
10
|
-
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-
|
|
10
|
+
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
11
11
|
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
12
12
|
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
13
13
|
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
14
14
|
link: "text-primary underline-offset-4 hover:underline"
|
|
15
15
|
},
|
|
16
16
|
size: {
|
|
17
|
-
default: "h-
|
|
18
|
-
xs: "h-6 gap-1 px-2
|
|
19
|
-
sm: "h-
|
|
20
|
-
lg: "h-
|
|
21
|
-
icon: "size-
|
|
22
|
-
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
23
|
-
"icon-sm": "size-
|
|
24
|
-
"icon-lg": "size-
|
|
17
|
+
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
18
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
19
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
20
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
21
|
+
icon: "size-8",
|
|
22
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
23
|
+
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
24
|
+
"icon-lg": "size-9"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
defaultVariants: {
|
|
@@ -10,7 +10,7 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
10
10
|
const defaultClassNames = getDefaultClassNames();
|
|
11
11
|
return /* @__PURE__ */ jsx(DayPicker, {
|
|
12
12
|
showOutsideDays,
|
|
13
|
-
className: cn("group/calendar bg-background p-
|
|
13
|
+
className: cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
14
14
|
captionLayout,
|
|
15
15
|
locale,
|
|
16
16
|
formatters: {
|
|
@@ -6,21 +6,21 @@ function Card({ className, size = "default", ...props }) {
|
|
|
6
6
|
return /* @__PURE__ */ jsx("div", {
|
|
7
7
|
"data-slot": "card",
|
|
8
8
|
"data-size": size,
|
|
9
|
-
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-
|
|
9
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
10
10
|
...props
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function CardHeader({ className, ...props }) {
|
|
14
14
|
return /* @__PURE__ */ jsx("div", {
|
|
15
15
|
"data-slot": "card-header",
|
|
16
|
-
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1
|
|
16
|
+
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className),
|
|
17
17
|
...props
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function CardTitle({ className, ...props }) {
|
|
21
21
|
return /* @__PURE__ */ jsx("div", {
|
|
22
22
|
"data-slot": "card-title",
|
|
23
|
-
className: cn("font-heading text-base font-medium", className),
|
|
23
|
+
className: cn("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm", className),
|
|
24
24
|
...props
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -48,7 +48,7 @@ function CardContent({ className, ...props }) {
|
|
|
48
48
|
function CardFooter({ className, ...props }) {
|
|
49
49
|
return /* @__PURE__ */ jsx("div", {
|
|
50
50
|
"data-slot": "card-footer",
|
|
51
|
-
className: cn("flex items-center rounded-b-
|
|
51
|
+
className: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)", className),
|
|
52
52
|
...props
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -79,7 +79,7 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
|
|
|
79
79
|
if (!active || !payload?.length) return null;
|
|
80
80
|
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
81
81
|
return /* @__PURE__ */ jsxs("div", {
|
|
82
|
-
className: cn("grid min-w-32 items-start gap-1.5 rounded-
|
|
82
|
+
className: cn("grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
83
83
|
children: [!nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("div", {
|
|
84
84
|
className: "grid gap-1.5",
|
|
85
85
|
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { Button } from "./button.js";
|
|
2
3
|
import { cn } from "cn";
|
|
3
4
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
@@ -5,10 +6,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
6
|
import * as React$1 from "react";
|
|
6
7
|
import { cva } from "class-variance-authority";
|
|
7
8
|
//#region src/components/ui/code-block.tsx
|
|
8
|
-
const codeBlockVariants = cva("group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-
|
|
9
|
+
const codeBlockVariants = cva("group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs", {
|
|
9
10
|
variants: { variant: {
|
|
10
|
-
default: "
|
|
11
|
-
destructive: "
|
|
11
|
+
default: "border border-input text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30",
|
|
12
|
+
destructive: "border border-destructive/30 text-destructive dark:border-destructive/40"
|
|
12
13
|
} },
|
|
13
14
|
defaultVariants: { variant: "default" }
|
|
14
15
|
});
|
|
@@ -24,21 +25,21 @@ function CodeBlock({ className, variant = "default", size = "default", ...props
|
|
|
24
25
|
function CodeBlockHeader({ className, ...props }) {
|
|
25
26
|
return /* @__PURE__ */ jsx("div", {
|
|
26
27
|
"data-slot": "code-block-header",
|
|
27
|
-
className: cn("flex min-w-0 shrink-0 items-center gap-2 px-
|
|
28
|
+
className: cn("flex min-w-0 shrink-0 items-center gap-2 px-3 pt-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pt-2.5 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0", className),
|
|
28
29
|
...props
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
function CodeBlockTitle({ className, ...props }) {
|
|
32
33
|
return /* @__PURE__ */ jsx("div", {
|
|
33
34
|
"data-slot": "code-block-title",
|
|
34
|
-
className: cn("min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-
|
|
35
|
+
className: cn("min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-3.5 *:[svg]:me-1.5", className),
|
|
35
36
|
...props
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
function CodeBlockActions({ className, ...props }) {
|
|
39
40
|
return /* @__PURE__ */ jsx("div", {
|
|
40
41
|
"data-slot": "code-block-actions",
|
|
41
|
-
className: cn("-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1
|
|
42
|
+
className: cn("-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10", className),
|
|
42
43
|
...props
|
|
43
44
|
});
|
|
44
45
|
}
|
|
@@ -55,7 +56,7 @@ function CodeBlockCopyButton({ value, variant = "ghost", size = "icon-xs", class
|
|
|
55
56
|
variant,
|
|
56
57
|
size,
|
|
57
58
|
"aria-label": copied ? "Copied" : "Copy",
|
|
58
|
-
className: cn(
|
|
59
|
+
className: cn(className),
|
|
59
60
|
onClick: (event) => {
|
|
60
61
|
onClick?.(event);
|
|
61
62
|
navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {});
|
|
@@ -79,7 +80,7 @@ function CodeBlockContent({ className, children, style, wrap = false, lineNumber
|
|
|
79
80
|
counterReset: `line ${startLine - 1}`,
|
|
80
81
|
...style
|
|
81
82
|
},
|
|
82
|
-
className: cn("min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-
|
|
83
|
+
className: cn("min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap", className),
|
|
83
84
|
...props,
|
|
84
85
|
children: /* @__PURE__ */ jsx("code", {
|
|
85
86
|
"data-slot": "code-block-code",
|
|
@@ -88,12 +89,12 @@ function CodeBlockContent({ className, children, style, wrap = false, lineNumber
|
|
|
88
89
|
})
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
|
-
const codeBlockLineVariants = cva("relative -mx-
|
|
92
|
+
const codeBlockLineVariants = cva("relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']", {
|
|
92
93
|
variants: { variant: {
|
|
93
94
|
default: "",
|
|
94
|
-
added: "bg-
|
|
95
|
+
added: "bg-muted after:content-['+']",
|
|
95
96
|
removed: "bg-destructive/10 after:text-destructive after:content-['−']",
|
|
96
|
-
highlighted: "bg-
|
|
97
|
+
highlighted: "bg-muted"
|
|
97
98
|
} },
|
|
98
99
|
defaultVariants: { variant: "default" }
|
|
99
100
|
});
|
|
@@ -114,7 +115,7 @@ function CodeBlockLine({ className, variant = "default", children, ...props }) {
|
|
|
114
115
|
function CodeBlockFooter({ className, ...props }) {
|
|
115
116
|
return /* @__PURE__ */ jsx("div", {
|
|
116
117
|
"data-slot": "code-block-footer",
|
|
117
|
-
className: cn("flex min-w-0 shrink-0 items-center gap-2 px-
|
|
118
|
+
className: cn("flex min-w-0 shrink-0 items-center gap-2 px-3 pb-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pb-2.5", className),
|
|
118
119
|
...props
|
|
119
120
|
});
|
|
120
121
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.js";
|
|
2
3
|
import { InputGroup, InputGroupAddon } from "./input-group.js";
|
|
3
4
|
import { cn } from "cn";
|
|
@@ -9,7 +10,7 @@ import { Command as Command$1 } from "cmdk";
|
|
|
9
10
|
function Command({ className, ...props }) {
|
|
10
11
|
return /* @__PURE__ */ jsx(Command$1, {
|
|
11
12
|
"data-slot": "command",
|
|
12
|
-
className: cn("flex size-full flex-col overflow-hidden rounded-
|
|
13
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className),
|
|
13
14
|
...props
|
|
14
15
|
});
|
|
15
16
|
}
|
|
@@ -20,7 +21,7 @@ function CommandDialog({ title = "Command Palette", description = "Search for a
|
|
|
20
21
|
className: "sr-only",
|
|
21
22
|
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
22
23
|
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
23
|
-
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-
|
|
24
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
24
25
|
showCloseButton,
|
|
25
26
|
children
|
|
26
27
|
})]
|
|
@@ -31,7 +32,7 @@ function CommandInput({ className, ...props }) {
|
|
|
31
32
|
"data-slot": "command-input-wrapper",
|
|
32
33
|
className: "p-1 pb-0",
|
|
33
34
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
34
|
-
className: "h-
|
|
35
|
+
className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",
|
|
35
36
|
children: [/* @__PURE__ */ jsx(Command$1.Input, {
|
|
36
37
|
"data-slot": "command-input",
|
|
37
38
|
className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
@@ -57,21 +58,21 @@ function CommandEmpty({ className, ...props }) {
|
|
|
57
58
|
function CommandGroup({ className, ...props }) {
|
|
58
59
|
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
59
60
|
"data-slot": "command-group",
|
|
60
|
-
className: cn("overflow-hidden p-1
|
|
61
|
+
className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
|
|
61
62
|
...props
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
function CommandSeparator({ className, ...props }) {
|
|
65
66
|
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
66
67
|
"data-slot": "command-separator",
|
|
67
|
-
className: cn("
|
|
68
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
68
69
|
...props
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
function CommandItem({ className, children, ...props }) {
|
|
72
73
|
return /* @__PURE__ */ jsxs(Command$1.Item, {
|
|
73
74
|
"data-slot": "command-item",
|
|
74
|
-
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-
|
|
75
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", className),
|
|
75
76
|
...props,
|
|
76
77
|
children: [children, /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
77
78
|
});
|
|
@@ -32,7 +32,7 @@ function ContextMenuContent({ className, align = "start", alignOffset = 4, side
|
|
|
32
32
|
sideOffset,
|
|
33
33
|
children: /* @__PURE__ */ jsx(ContextMenu$1.Popup, {
|
|
34
34
|
"data-slot": "context-menu-content",
|
|
35
|
-
className: cn("z-50 max-h-(--available-height) min-w-
|
|
35
|
+
className: cn("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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),
|
|
36
36
|
...props
|
|
37
37
|
})
|
|
38
38
|
}) });
|
|
@@ -47,7 +47,7 @@ function ContextMenuLabel({ className, inset, ...props }) {
|
|
|
47
47
|
return /* @__PURE__ */ jsx(ContextMenu$1.GroupLabel, {
|
|
48
48
|
"data-slot": "context-menu-label",
|
|
49
49
|
"data-inset": inset,
|
|
50
|
-
className: cn("px-
|
|
50
|
+
className: cn("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className),
|
|
51
51
|
...props
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -56,7 +56,7 @@ function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
56
56
|
"data-slot": "context-menu-item",
|
|
57
57
|
"data-inset": inset,
|
|
58
58
|
"data-variant": variant,
|
|
59
|
-
className: cn("group/context-menu-item relative flex cursor-default items-center gap-
|
|
59
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
60
60
|
...props
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -70,7 +70,7 @@ function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
70
70
|
return /* @__PURE__ */ jsxs(ContextMenu$1.SubmenuTrigger, {
|
|
71
71
|
"data-slot": "context-menu-sub-trigger",
|
|
72
72
|
"data-inset": inset,
|
|
73
|
-
className: cn("flex cursor-default items-center rounded-
|
|
73
|
+
className: cn("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
74
74
|
...props,
|
|
75
75
|
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
76
76
|
});
|
|
@@ -87,7 +87,7 @@ function ContextMenuCheckboxItem({ className, children, checked, inset, ...props
|
|
|
87
87
|
return /* @__PURE__ */ jsxs(ContextMenu$1.CheckboxItem, {
|
|
88
88
|
"data-slot": "context-menu-checkbox-item",
|
|
89
89
|
"data-inset": inset,
|
|
90
|
-
className: cn("relative flex cursor-default items-center gap-
|
|
90
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
91
91
|
checked,
|
|
92
92
|
...props,
|
|
93
93
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -106,7 +106,7 @@ function ContextMenuRadioItem({ className, children, inset, ...props }) {
|
|
|
106
106
|
return /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
107
107
|
"data-slot": "context-menu-radio-item",
|
|
108
108
|
"data-inset": inset,
|
|
109
|
-
className: cn("relative flex cursor-default items-center gap-
|
|
109
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
110
110
|
...props,
|
|
111
111
|
children: [/* @__PURE__ */ jsx("span", {
|
|
112
112
|
className: "pointer-events-none absolute right-2",
|
|
@@ -117,7 +117,7 @@ function ContextMenuRadioItem({ className, children, inset, ...props }) {
|
|
|
117
117
|
function ContextMenuSeparator({ className, ...props }) {
|
|
118
118
|
return /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
119
119
|
"data-slot": "context-menu-separator",
|
|
120
|
-
className: cn("-mx-1
|
|
120
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
121
121
|
...props
|
|
122
122
|
});
|
|
123
123
|
}
|