@siyahi/ui 0.1.9-next.1 → 0.1.9-next.2

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/README.md CHANGED
@@ -104,7 +104,11 @@ Every merge to `main` also attaches both tarballs to a GitHub release
104
104
  | Counts or amounts per period, one series or several | `BarChartCard`; `stacked` when the series add up to a total |
105
105
  | A running level, such as a portfolio's value against money put in | `AreaChartCard` |
106
106
  | Series compared point by point, such as a return against an index | `LineChartCard` |
107
- | Ranked counts or amounts by category (a name, a bar and a figure) | `BarList` |
107
+ | Samples in time with limits and events marked | `LineChartCard` with `xDomain`, `xTicks` and `referenceLines` |
108
+ | Long category names, such as sectors | `BarChartCard` with `horizontal` |
109
+ | A gain above zero and a loss below it | a series with `color` and `negativeColor` |
110
+ | Ranked counts or amounts by category (a name, a bar and a figure) | `BarList`; give two lists one `max` to share a scale |
111
+ | Where a budget sits, a split of a whole, or losses against gains | `DistributionBar` |
108
112
  | Headline figures with their change | `SectionCards`, with a `Delta` in each badge |
109
113
  | One instrument's price history | `PriceChart` |
110
114
  | Holdings sized by weight and coloured by change | `Treemap` |
@@ -117,6 +121,7 @@ Every merge to `main` also attaches both tarballs to a GitHub release
117
121
  | One part of a long page: rule, eyebrow, heading, lead, action | `PageSection`, with `PageSubheading` inside |
118
122
  | Label and value pairs, such as a record's fields | `DataList` and `DataListItem` |
119
123
  | A command or file to copy, wrapped or scrolling | `CodeBlock` with `CodeBlockCopyButton` |
124
+ | A labelled copy action, such as "Copy all" for a section | `CopyButton` |
120
125
  | A command, file or identifier inside prose | `InlineCode` |
121
126
  | A signed figure (a gain, a loss, a change) | `Delta` |
122
127
  | A time, with the viewer's own clock on hover | `LocalTime` |
@@ -125,7 +130,10 @@ The three chart cards take the rows, the field the x axis reads and the series,
125
130
  and own everything else: the card and its header action (a range or mode
126
131
  toggle), the axes, the dashed horizontal grid, Geist Mono ticks, a tooltip that
127
132
  names the hovered point and gives each series' formatted value, and the legend
128
- below. A page never puts Recharts axes, grids or tooltips together itself.
133
+ below. Props cover the rest: a footer, a placeholder while data loads,
134
+ reference lines, a numeric x axis, a fixed value axis, axis titles, a second
135
+ line under each tick, a picked category, sideways bars and straight segments.
136
+ A page never puts Recharts axes, grids or tooltips together itself.
129
137
 
130
138
  ```tsx
131
139
  <BarChartCard
@@ -17,7 +17,8 @@ file as copied; `packages/ui/registry.lock.json` lists them all and
17
17
  | Heatmaps: calendar, weekday by hour, status timeline | `src/components/registry/heatmap/*` | https://shadcn-heatmap.pages.dev/r/calendar-heatmap.json, https://shadcn-heatmap.pages.dev/r/weekday-heatmap.json, https://shadcn-heatmap.pages.dev/r/status-heatmap.json (source: https://github.com/rutopio/shadcn-heatmap) | MIT, Copyright (c) 2026 ChingRu |
18
18
  | niko-table data table on TanStack Table | `src/components/registry/niko-table/*` | https://niko-table.com/r/data-table.json, https://niko-table.com/r/data-table-core.json, https://niko-table.com/r/data-table-ui.json, https://niko-table.com/r/data-table-faceted-filter.json, https://niko-table.com/r/data-table-column-sort.json, https://niko-table.com/r/data-table-search-filter.json (source: https://github.com/Semkoo/niko-table-registry) | MIT, Copyright (c) 2025 Semir N.; original work Copyright (c) 2025 WebDevSimplified |
19
19
  | shadcn chart blocks `chart-bar-multiple`, `chart-area-stacked`, `chart-line-multiple` | `src/components/registry/charts/*` | https://ui.shadcn.com/r/styles/new-york-v4/chart-bar-multiple.json, https://ui.shadcn.com/r/styles/new-york-v4/chart-area-stacked.json, https://ui.shadcn.com/r/styles/new-york-v4/chart-line-multiple.json | MIT, Copyright (c) 2023 shadcn |
20
- | dashboardcn ranked list (`BarList`) | `src/components/registry/dashboardcn/bar-list.tsx` | https://dashboardcn.com/r/bar-list.json (source: https://github.com/NoahGdev/dashboardcn) | MIT, Copyright (c) 2026 dashboardcn contributors |
20
+ | dashboardcn ranked list (`BarList`) and stacked bar (`DistributionBar`) | `src/components/registry/dashboardcn/*` | https://dashboardcn.com/r/bar-list.json, https://dashboardcn.com/r/distribution-bar.json (source: https://github.com/NoahGdev/dashboardcn) | MIT, Copyright (c) 2026 dashboardcn contributors |
21
+ | MiniDev copy button (`CopyButton`) | `src/components/registry/minidev/copy-button.tsx` | https://ui.minidev.pro/r/copy-button.json (source: https://github.com/amankaushik481/minidev-ui) | MIT, Copyright (c) 2026 MiniDev |
21
22
 
22
23
  ## Runtime dependencies with attribution terms
23
24
 
@@ -1,9 +1,10 @@
1
- import { SeriesChartProps } from "../../../lib/chart-series.js";
1
+ import { ChartCurve, NumericXProps, SeriesChartProps } from "../../../lib/chart-series.js";
2
2
  //#region src/components/registry/charts/area-chart-card.d.ts
3
- export interface AreaChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K> {
3
+ export interface AreaChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K>, NumericXProps {
4
4
  /** Stack the series into a total instead of overlapping them. */
5
5
  stacked?: boolean;
6
+ curve?: ChartCurve;
6
7
  }
7
8
  /** Values over an ordered axis as filled areas: one series, or several overlapping or stacked. */
8
- export declare function AreaChartCard<T extends object, K extends keyof T>({ stacked, ...props }: AreaChartCardProps<T, K>): import("react").JSX.Element;
9
+ export declare function AreaChartCard<T extends object, K extends keyof T>({ stacked, curve, ...props }: AreaChartCardProps<T, K>): import("react").JSX.Element;
9
10
  //#endregion
@@ -4,13 +4,13 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { Area, AreaChart } from "recharts";
5
5
  //#region src/components/registry/charts/area-chart-card.tsx
6
6
  /** Values over an ordered axis as filled areas: one series, or several overlapping or stacked. */
7
- function AreaChartCard({ stacked = false, ...props }) {
7
+ function AreaChartCard({ stacked = false, curve = "monotone", ...props }) {
8
8
  return /* @__PURE__ */ jsx(ChartFrame, {
9
9
  chart: AreaChart,
10
10
  ...props,
11
11
  children: props.series.map(({ key, color }) => /* @__PURE__ */ jsx(Area, {
12
12
  dataKey: key,
13
- type: "monotone",
13
+ type: curve,
14
14
  fill: color,
15
15
  fillOpacity: stacked ? .4 : .2,
16
16
  stroke: color,
@@ -3,7 +3,13 @@ import { SeriesChartProps } from "../../../lib/chart-series.js";
3
3
  export interface BarChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K> {
4
4
  /** Stack the series in one bar per point instead of side by side. */
5
5
  stacked?: boolean;
6
+ /** Bars run sideways, categories down the left: for long names, such as sectors. */
7
+ horizontal?: boolean;
8
+ /** The picked category's x value: its bars stay solid and the rest fade. */
9
+ selected?: T[K] | null;
10
+ /** Called with a clicked category's x value, or null when the picked one is clicked again. */
11
+ onSelect?: (value: T[K] | null) => void;
6
12
  }
7
13
  /** Values over an ordered axis as bars: one series, or several grouped or stacked. */
8
- export declare function BarChartCard<T extends object, K extends keyof T>({ stacked, ...props }: BarChartCardProps<T, K>): import("react").JSX.Element;
14
+ export declare function BarChartCard<T extends object, K extends keyof T>({ stacked, selected, onSelect, ...props }: BarChartCardProps<T, K>): import("react").JSX.Element;
9
15
  //#endregion
@@ -1,23 +1,38 @@
1
1
  "use client";
2
2
  import { ChartFrame } from "../../../lib/chart-frame.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { Bar, BarChart } from "recharts";
4
+ import { Bar, BarChart, Cell } from "recharts";
5
5
  //#region src/components/registry/charts/bar-chart-card.tsx
6
6
  /** Values over an ordered axis as bars: one series, or several grouped or stacked. */
7
- function BarChartCard({ stacked = false, ...props }) {
7
+ function BarChartCard({ stacked = false, selected = null, onSelect, ...props }) {
8
8
  return /* @__PURE__ */ jsx(ChartFrame, {
9
9
  chart: BarChart,
10
10
  ...props,
11
- children: props.series.map(({ key, color }, index) => /* @__PURE__ */ jsx(Bar, {
11
+ stackOffset: stacked ? "sign" : void 0,
12
+ children: props.series.map(({ key, color, negativeColor }, index) => /* @__PURE__ */ jsx(Bar, {
12
13
  dataKey: key,
13
14
  fill: color,
14
15
  stackId: stacked ? "stack" : void 0,
15
- radius: !stacked ? 2 : index === props.series.length - 1 ? [
16
+ radius: !stacked ? 2 : index === props.series.length - 1 ? props.horizontal ? [
17
+ 0,
18
+ 2,
19
+ 2,
20
+ 0
21
+ ] : [
16
22
  2,
17
23
  2,
18
24
  0,
19
25
  0
20
- ] : 0
26
+ ] : 0,
27
+ className: onSelect ? "cursor-pointer" : void 0,
28
+ onClick: onSelect && ((bar) => {
29
+ const value = bar.payload?.[props.xKey];
30
+ if (value !== void 0) onSelect(value === selected ? null : value);
31
+ }),
32
+ children: (negativeColor || selected !== null) && props.data.map((row, i) => /* @__PURE__ */ jsx(Cell, {
33
+ fill: negativeColor && Number(row[key]) < 0 ? negativeColor : color,
34
+ fillOpacity: selected === null || row[props.xKey] === selected ? 1 : .35
35
+ }, i))
21
36
  }, key))
22
37
  });
23
38
  }
@@ -1,5 +1,8 @@
1
- import { SeriesChartProps } from "../../../lib/chart-series.js";
1
+ import { ChartCurve, NumericXProps, SeriesChartProps } from "../../../lib/chart-series.js";
2
2
  //#region src/components/registry/charts/line-chart-card.d.ts
3
+ export interface LineChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K>, NumericXProps {
4
+ curve?: ChartCurve;
5
+ }
3
6
  /** Values over an ordered axis as lines: one series, or several to compare, such as a portfolio against its index. */
4
- export declare function LineChartCard<T extends object, K extends keyof T>(props: SeriesChartProps<T, K>): import("react").JSX.Element;
7
+ export declare function LineChartCard<T extends object, K extends keyof T>({ curve, ...props }: LineChartCardProps<T, K>): import("react").JSX.Element;
5
8
  //#endregion
@@ -4,13 +4,13 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { Line, LineChart } from "recharts";
5
5
  //#region src/components/registry/charts/line-chart-card.tsx
6
6
  /** Values over an ordered axis as lines: one series, or several to compare, such as a portfolio against its index. */
7
- function LineChartCard(props) {
7
+ function LineChartCard({ curve = "monotone", ...props }) {
8
8
  return /* @__PURE__ */ jsx(ChartFrame, {
9
9
  chart: LineChart,
10
10
  ...props,
11
11
  children: props.series.map(({ key, color }) => /* @__PURE__ */ jsx(Line, {
12
12
  dataKey: key,
13
- type: "monotone",
13
+ type: curve,
14
14
  stroke: color,
15
15
  strokeWidth: 2,
16
16
  dot: false
@@ -10,6 +10,8 @@ export interface SectionCard {
10
10
  headline?: React$1.ReactNode;
11
11
  /** Muted second footer line. */
12
12
  detail?: React$1.ReactNode;
13
+ /** In a picker, a tile that cannot be picked, such as one with nothing in it: faded, and its button disabled. */
14
+ disabled?: boolean;
13
15
  }
14
16
  export interface SectionCardsProps {
15
17
  items: SectionCard[];
@@ -18,12 +18,13 @@ function SectionCards({ items, selected, onSelect }) {
18
18
  children: /* @__PURE__ */ jsx("div", {
19
19
  className: cn("grid grid-cols-1 gap-4", COLUMNS[items.length] ?? COLUMNS[4]),
20
20
  children: items.map((item) => /* @__PURE__ */ jsxs(Card, {
21
- className: cn("@container/card", onSelect && "relative", item.label === selected && "ring-2 ring-primary!"),
21
+ className: cn("@container/card", onSelect && "relative", item.label === selected && "ring-2 ring-primary!", onSelect && item.disabled && "opacity-60"),
22
22
  children: [
23
23
  onSelect && /* @__PURE__ */ jsx("button", {
24
24
  type: "button",
25
25
  "aria-label": item.label,
26
26
  "aria-pressed": item.label === selected,
27
+ disabled: item.disabled,
27
28
  onClick: () => onSelect(item.label),
28
29
  className: "absolute inset-0 z-10 rounded-4xl outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset"
29
30
  }),
@@ -19,8 +19,10 @@ export interface BarListProps extends React$1.ComponentProps<"div"> {
19
19
  color?: string;
20
20
  /** Show each row's share of the total next to its value. */
21
21
  showPercentage?: boolean;
22
+ /** The value a full-width bar stands for. Give two lists the same max to draw them on one scale. Defaults to the largest value. */
23
+ max?: number;
22
24
  onItemClick?: (item: BarListItem) => void;
23
25
  }
24
- declare function BarList({ data, valueFormatter, sortOrder, color, showPercentage, onItemClick, className, ...props }: BarListProps): React$1.JSX.Element;
26
+ declare function BarList({ data, valueFormatter, sortOrder, color, showPercentage, max: scale, onItemClick, className, ...props }: BarListProps): React$1.JSX.Element;
25
27
  //#endregion
26
28
  export { BarList };
@@ -4,7 +4,7 @@ import { pct } from "../../../lib/format.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import * as React$1 from "react";
6
6
  //#region src/components/registry/dashboardcn/bar-list.tsx
7
- function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(--chart-1)", showPercentage = false, onItemClick, className, ...props }) {
7
+ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(--chart-1)", showPercentage = false, max: scale, onItemClick, className, ...props }) {
8
8
  const locale = useLocale();
9
9
  const format = valueFormatter ?? ((value) => new Intl.NumberFormat(locale.numberLocale, {
10
10
  notation: "compact",
@@ -15,7 +15,7 @@ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(
15
15
  const sorted = [...data].sort((a, b) => a.value - b.value);
16
16
  return sortOrder === "descending" ? sorted.reverse() : sorted;
17
17
  }, [data, sortOrder]);
18
- const max = Math.max(...items.map((item) => item.value), 0);
18
+ const max = scale ?? Math.max(...items.map((item) => item.value), 0);
19
19
  const total = items.reduce((sum, item) => sum + item.value, 0);
20
20
  return /* @__PURE__ */ jsx("div", {
21
21
  "data-slot": "bar-list",
@@ -0,0 +1,38 @@
1
+ import { ChartColor } from "../../../lib/chart-series.js";
2
+ import * as React$1 from "react";
3
+ //#region src/components/registry/dashboardcn/distribution-bar.d.ts
4
+ export interface DistributionSegment {
5
+ name: string;
6
+ value: number;
7
+ /** Defaults to chart-1 through chart-5 in order; var(--muted) for space that is free. */
8
+ color?: ChartColor | "var(--muted)";
9
+ /** Stable key when names can repeat. */
10
+ key?: string;
11
+ }
12
+ export interface DistributionMarker {
13
+ /** The value the line marks, on the bar's scale. */
14
+ at: number;
15
+ label?: string;
16
+ }
17
+ export interface DistributionBarProps extends Omit<React$1.ComponentProps<"div">, "onMouseLeave"> {
18
+ segments: DistributionSegment[];
19
+ valueFormatter?: (value: number) => string;
20
+ showLegend?: boolean;
21
+ /** Show absolute values in the legend in addition to the share. */
22
+ showValues?: boolean;
23
+ /** The value the bar's right end stands for. Defaults to the positive segments' total. */
24
+ max?: number;
25
+ /**
26
+ * The value the bar's left end stands for. Defaults to the negative segments' total, or 0 when there are none.
27
+ * Above zero, segments (which start at zero) fall off the bar.
28
+ */
29
+ min?: number;
30
+ markers?: DistributionMarker[];
31
+ /** The key (or name) of the one segment to keep solid; the rest fade. */
32
+ highlighted?: string | null;
33
+ /** Called with the segment under the pointer, and null when it leaves the bar. */
34
+ onHover?: (segment: DistributionSegment | null) => void;
35
+ }
36
+ declare function DistributionBar({ segments, valueFormatter, showLegend, showValues, max, min, markers, highlighted, onHover, className, "aria-label": ariaLabel, ...props }: DistributionBarProps): React$1.JSX.Element;
37
+ //#endregion
38
+ export { DistributionBar };
@@ -0,0 +1,118 @@
1
+ import { useLocale } from "../../siyahi/siyahi-provider.js";
2
+ import { cn } from "../../../lib/utils.js";
3
+ import { pct } from "../../../lib/format.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import "react";
6
+ //#region src/components/registry/dashboardcn/distribution-bar.tsx
7
+ const defaultColors = [
8
+ "var(--chart-1)",
9
+ "var(--chart-2)",
10
+ "var(--chart-3)",
11
+ "var(--chart-4)",
12
+ "var(--chart-5)"
13
+ ];
14
+ function DistributionBar({ segments, valueFormatter, showLegend = true, showValues = false, max, min, markers = [], highlighted = null, onHover, className, "aria-label": ariaLabel, ...props }) {
15
+ const locale = useLocale();
16
+ const format = valueFormatter ?? ((value) => new Intl.NumberFormat(locale.numberLocale, {
17
+ notation: "compact",
18
+ maximumFractionDigits: 1
19
+ }).format(value));
20
+ const total = segments.reduce((sum, segment) => sum + Math.abs(segment.value), 0);
21
+ const gains = segments.reduce((sum, segment) => sum + Math.max(segment.value, 0), 0);
22
+ const losses = segments.reduce((sum, segment) => sum + Math.min(segment.value, 0), 0);
23
+ const bottom = min ?? losses;
24
+ const top = max ?? gains;
25
+ const span = top - bottom || 1;
26
+ const position = (value) => (value - bottom) / span * 100;
27
+ const shown = markers.filter((marker) => marker.at >= bottom && marker.at <= top).map((marker, index) => ({
28
+ ...marker,
29
+ key: `${marker.at}:${marker.label ?? ""}:${index}`
30
+ }));
31
+ let above = 0;
32
+ let below = 0;
33
+ const resolved = segments.map((segment, index) => {
34
+ const key = segment.key ?? segment.name;
35
+ const size = Math.abs(segment.value);
36
+ const start = segment.value < 0 ? below -= size : (above += size) - size;
37
+ return {
38
+ ...segment,
39
+ key,
40
+ color: segment.color ?? defaultColors[index % defaultColors.length],
41
+ share: total > 0 ? size / total : 0,
42
+ left: position(start),
43
+ width: size / span * 100
44
+ };
45
+ });
46
+ const figure = (segment) => max === void 0 ? pct(segment.share, locale) : format(segment.value);
47
+ return /* @__PURE__ */ jsxs("div", {
48
+ "data-slot": "distribution-bar",
49
+ className: cn("flex flex-col gap-3", className),
50
+ ...props,
51
+ children: [/* @__PURE__ */ jsxs("div", {
52
+ className: "relative",
53
+ children: [
54
+ shown.some((m) => m.label) ? /* @__PURE__ */ jsx("div", {
55
+ className: "text-muted-foreground relative h-4 font-mono text-xs",
56
+ children: shown.map((marker) => marker.label ? /* @__PURE__ */ jsx("span", {
57
+ className: cn("absolute top-0 whitespace-nowrap", position(marker.at) <= 5 ? "translate-x-0" : position(marker.at) >= 95 ? "-translate-x-full" : "-translate-x-1/2"),
58
+ style: { left: `${position(marker.at)}%` },
59
+ children: marker.label
60
+ }, marker.key) : null)
61
+ }) : null,
62
+ /* @__PURE__ */ jsx("div", {
63
+ role: "img",
64
+ "aria-label": ariaLabel ?? resolved.map((segment) => `${segment.name} ${figure(segment)}`).join(", "),
65
+ className: "bg-muted relative h-2.5 w-full overflow-hidden rounded-full",
66
+ onMouseLeave: onHover ? () => onHover(null) : void 0,
67
+ children: resolved.map((segment) => segment.width > 0 ? /* @__PURE__ */ jsx("div", {
68
+ "data-slot": "distribution-segment",
69
+ className: "border-card absolute inset-y-0 border-x transition-[width,left,opacity] duration-300",
70
+ style: {
71
+ left: `${segment.left}%`,
72
+ width: `${segment.width}%`,
73
+ backgroundColor: segment.color,
74
+ opacity: highlighted === null || highlighted === segment.key ? 1 : .35
75
+ },
76
+ onMouseEnter: onHover ? () => onHover(segment) : void 0
77
+ }, segment.key) : null)
78
+ }),
79
+ shown.map((marker) => /* @__PURE__ */ jsx("div", {
80
+ "data-slot": "distribution-marker",
81
+ "aria-hidden": "true",
82
+ className: "bg-foreground absolute bottom-0 h-2.5 w-0.5 -translate-x-1/2",
83
+ style: { left: `${position(marker.at)}%` }
84
+ }, marker.key))
85
+ ]
86
+ }), showLegend ? /* @__PURE__ */ jsx("ul", {
87
+ className: "flex flex-wrap gap-x-4 gap-y-1.5 text-sm",
88
+ children: resolved.map((segment) => /* @__PURE__ */ jsxs("li", {
89
+ className: "flex items-center gap-2",
90
+ children: [
91
+ /* @__PURE__ */ jsx("span", {
92
+ "aria-hidden": "true",
93
+ className: "size-2.5 shrink-0 rounded-xs",
94
+ style: { backgroundColor: segment.color }
95
+ }),
96
+ /* @__PURE__ */ jsx("span", {
97
+ className: "text-muted-foreground",
98
+ children: segment.name
99
+ }),
100
+ /* @__PURE__ */ jsx("span", {
101
+ className: "font-medium tabular-nums",
102
+ children: figure(segment)
103
+ }),
104
+ showValues && max === void 0 ? /* @__PURE__ */ jsxs("span", {
105
+ className: "text-muted-foreground tabular-nums",
106
+ children: [
107
+ "(",
108
+ format(segment.value),
109
+ ")"
110
+ ]
111
+ }) : null
112
+ ]
113
+ }, segment.key))
114
+ }) : null]
115
+ });
116
+ }
117
+ //#endregion
118
+ export { DistributionBar };
@@ -0,0 +1,11 @@
1
+ import { buttonVariants } from "../../ui/button.js";
2
+ import * as React$1 from "react";
3
+ import { VariantProps } from "class-variance-authority";
4
+ //#region src/components/registry/minidev/copy-button.d.ts
5
+ declare function CopyButton({ value, className, variant, size, label, copiedLabel, ...props }: {
6
+ value: string;
7
+ label?: string;
8
+ copiedLabel?: string;
9
+ } & React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants>): React$1.JSX.Element;
10
+ //#endregion
11
+ export { CopyButton };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { Button } from "../../ui/button.js";
3
+ import { cn } from "../../../lib/utils.js";
4
+ import { CheckIcon, CopyIcon } from "lucide-react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import * as React$1 from "react";
7
+ import "class-variance-authority";
8
+ //#region src/components/registry/minidev/copy-button.tsx
9
+ function CopyButton({ value, className, variant = "outline", size = "sm", label = "Copy", copiedLabel = "Copied", ...props }) {
10
+ const [copied, setCopied] = React$1.useState(false);
11
+ React$1.useEffect(() => {
12
+ if (!copied) return;
13
+ const timeout = setTimeout(() => setCopied(false), 2e3);
14
+ return () => clearTimeout(timeout);
15
+ }, [copied]);
16
+ return /* @__PURE__ */ jsxs(Button, {
17
+ type: "button",
18
+ variant,
19
+ size,
20
+ "data-slot": "copy-button",
21
+ className: cn(className),
22
+ "aria-label": copied ? copiedLabel : label,
23
+ onClick: async () => {
24
+ try {
25
+ await navigator.clipboard.writeText(value);
26
+ setCopied(true);
27
+ } catch {}
28
+ },
29
+ ...props,
30
+ children: [copied ? /* @__PURE__ */ jsx(CheckIcon, { "data-icon": "inline-start" }) : /* @__PURE__ */ jsx(CopyIcon, { "data-icon": "inline-start" }), copied ? copiedLabel : label]
31
+ });
32
+ }
33
+ //#endregion
34
+ export { CopyButton };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,15 @@
1
- import { ChartColor, ChartSeries, ChartSeriesItem, SeriesChartProps } from "./lib/chart-series.js";
1
+ import { ChartColor, ChartCurve, ChartReferenceLine, ChartSeries, ChartSeriesItem, NumericXProps, SeriesChartProps } from "./lib/chart-series.js";
2
2
  import { AreaChartCard, AreaChartCardProps } from "./components/registry/charts/area-chart-card.js";
3
3
  import { BarChartCard, BarChartCardProps } from "./components/registry/charts/bar-chart-card.js";
4
- import { LineChartCard } from "./components/registry/charts/line-chart-card.js";
4
+ import { LineChartCard, LineChartCardProps } from "./components/registry/charts/line-chart-card.js";
5
5
  import { SectionCard, SectionCards, SectionCardsProps } from "./components/registry/dashboard-01/section-cards.js";
6
6
  import { BarList, BarListItem, BarListProps } from "./components/registry/dashboardcn/bar-list.js";
7
+ import { DistributionBar, DistributionBarProps, DistributionMarker, DistributionSegment } from "./components/registry/dashboardcn/distribution-bar.js";
7
8
  import { Activity, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBlockProps, CalendarHeatmapBody, CalendarHeatmapBodyProps, CalendarHeatmapFooter, CalendarHeatmapFooterProps, CalendarHeatmapLegend, CalendarHeatmapLegendProps, CalendarHeatmapProps, CalendarHeatmapStat, CalendarHeatmapStatProps, ColorConfig, Labels } from "./components/registry/heatmap/calendar-heatmap.js";
8
9
  import { StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue } from "./components/registry/heatmap/status-heatmap.js";
9
10
  import { ColorConfig as ColorConfig$1, WeekdayExtraColumnSpec, WeekdayExtraRowSpec, WeekdayHeatmap, WeekdayHeatmapBlock, WeekdayHeatmapBlockProps, WeekdayHeatmapBody, WeekdayHeatmapBodyProps, WeekdayHeatmapFooter, WeekdayHeatmapFooterProps, WeekdayHeatmapLabels, WeekdayHeatmapLegend, WeekdayHeatmapLegendProps, WeekdayHeatmapProps, WeekdayHeatmapStat, WeekdayHeatmapStatProps, WeekdayHour, WeekdayHourlyActivity, WeekdayIndex } from "./components/registry/heatmap/weekday-heatmap.js";
11
+ import { Button, buttonVariants } from "./components/ui/button.js";
12
+ import { CopyButton } from "./components/registry/minidev/copy-button.js";
10
13
  import { TableColumnActions, TableColumnActionsProps } from "./components/registry/niko-table/filters/table-column-actions.js";
11
14
  import { DataTableColumnActions } from "./components/registry/niko-table/components/data-table-column-actions.js";
12
15
  import { DataTableColumnFilter } from "./components/registry/niko-table/components/data-table-column-filter.js";
@@ -38,7 +41,6 @@ import { NavMain } from "./components/registry/sidebar-07/nav-main.js";
38
41
  import { NavProjects } from "./components/registry/sidebar-07/nav-projects.js";
39
42
  import { NavUser } from "./components/registry/sidebar-07/nav-user.js";
40
43
  import { TeamSwitcher } from "./components/registry/sidebar-07/team-switcher.js";
41
- import { Button, buttonVariants } from "./components/ui/button.js";
42
44
  import { Input } from "./components/ui/input.js";
43
45
  import { Separator } from "./components/ui/separator.js";
44
46
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip.js";
@@ -84,4 +86,4 @@ import { Toggle, toggleVariants } from "./components/ui/toggle.js";
84
86
  import { ToggleGroup, ToggleGroupItem } from "./components/ui/toggle-group.js";
85
87
  import { Formatters, TimeOptions, count, money, moneyCompact, pct, time, useFormat } from "./lib/format.js";
86
88
  import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, ReferenceLine, XAxis, YAxis } from "./lib/recharts.js";
87
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, Area, AreaChart, AreaChartCard, AreaChartCardProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, BarChartCard, BarChartCardProps, BarList, BarListItem, BarListProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBlockProps, CalendarHeatmapBody, CalendarHeatmapBodyProps, CalendarHeatmapFooter, CalendarHeatmapFooterProps, CalendarHeatmapLegend, CalendarHeatmapLegendProps, CalendarHeatmapProps, CalendarHeatmapStat, CalendarHeatmapStatProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, ChartColor, ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartSeries, ChartSeriesItem, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorConfig, ColumnResizeInfo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataList, DataListItem, DataListItemProps, DataTable, DataTableActions, DataTableBody, DataTableBodyProps, type DataTableCell, type DataTableColumn, DataTableColumnActions, type DataTableColumnDef, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, type DataTableColumns, DataTableConfig, DataTableContainerProps, DataTableContext, DataTableContextState, DataTableEmptyActions, DataTableEmptyActionsProps, DataTableEmptyBody, DataTableEmptyBodyProps, DataTableEmptyDescription, DataTableEmptyDescriptionProps, DataTableEmptyFilteredMessage, DataTableEmptyFilteredMessageProps, DataTableEmptyIcon, DataTableEmptyIconProps, DataTableEmptyMessage, DataTableEmptyMessageProps, DataTableEmptyState, DataTableEmptyStateProps, DataTableEmptyTitle, DataTableEmptyTitleProps, DataTableErrorBoundary, DataTableErrorBoundaryProps, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableGroupRowContextValue, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableGroupedRowsProps, DataTableHeader, type DataTableHeader$1 as DataTableHeaderCell, DataTableHeaderProps, type DataTableInstance, DataTableLoading, DataTableLoadingMore, DataTableLoadingMoreProps, DataTableLoadingProps, DataTableProvider, DataTableRoot, type DataTableRow, DataTableRowContextMenu, DataTableRowContextMenuProps, DataTableRowContextMenuSlot, DataTableRowContextMenuSlotProps, DataTableRowCount, DataTableRowCountProps, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSkeletonProps, DataTableSortHeader, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtendedColumnFilter, type ExtendedColumnSort, type FilterOperator, type FilterOperatorValues, type FilterVariant, type FilterVariantValues, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, Formatters, type GlobalFilter, GroupedBodyRow, GroupedBodyRowProps, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, Line, LineChart, LineChartCard, LocalTime, LocalTimeProps, NavMain, NavProjects, NavUser, type Option, PageSection, PageSectionProps, PageSubheading, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, SectionCards, SectionCardsProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SeriesChartProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, TableSearchFilterProps, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, TimeOptions, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, ToneProgressProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, TreemapLegend, TreemapLegendProps, TreemapProps, type ValueOf, type ColorConfig$1 as WeekdayColorConfig, type WeekdayExtraColumnSpec, type WeekdayExtraRowSpec, WeekdayHeatmap, WeekdayHeatmapBlock, type WeekdayHeatmapBlockProps, WeekdayHeatmapBody, type WeekdayHeatmapBodyProps, WeekdayHeatmapFooter, type WeekdayHeatmapFooterProps, type WeekdayHeatmapLabels, WeekdayHeatmapLegend, type WeekdayHeatmapLegendProps, type WeekdayHeatmapProps, WeekdayHeatmapStat, type WeekdayHeatmapStatProps, type WeekdayHour, type WeekdayHourlyActivity, type WeekdayIndex, XAxis, YAxis, badgeVariants, buttonVariants, count, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
89
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, Area, AreaChart, AreaChartCard, AreaChartCardProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, BarChartCard, BarChartCardProps, BarList, BarListItem, BarListProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBlockProps, CalendarHeatmapBody, CalendarHeatmapBodyProps, CalendarHeatmapFooter, CalendarHeatmapFooterProps, CalendarHeatmapLegend, CalendarHeatmapLegendProps, CalendarHeatmapProps, CalendarHeatmapStat, CalendarHeatmapStatProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, ChartColor, ChartConfig, ChartContainer, ChartCurve, ChartLegend, ChartLegendContent, ChartReferenceLine, ChartSeries, ChartSeriesItem, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorConfig, ColumnResizeInfo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataList, DataListItem, DataListItemProps, DataTable, DataTableActions, DataTableBody, DataTableBodyProps, type DataTableCell, type DataTableColumn, DataTableColumnActions, type DataTableColumnDef, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, type DataTableColumns, DataTableConfig, DataTableContainerProps, DataTableContext, DataTableContextState, DataTableEmptyActions, DataTableEmptyActionsProps, DataTableEmptyBody, DataTableEmptyBodyProps, DataTableEmptyDescription, DataTableEmptyDescriptionProps, DataTableEmptyFilteredMessage, DataTableEmptyFilteredMessageProps, DataTableEmptyIcon, DataTableEmptyIconProps, DataTableEmptyMessage, DataTableEmptyMessageProps, DataTableEmptyState, DataTableEmptyStateProps, DataTableEmptyTitle, DataTableEmptyTitleProps, DataTableErrorBoundary, DataTableErrorBoundaryProps, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableGroupRowContextValue, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableGroupedRowsProps, DataTableHeader, type DataTableHeader$1 as DataTableHeaderCell, DataTableHeaderProps, type DataTableInstance, DataTableLoading, DataTableLoadingMore, DataTableLoadingMoreProps, DataTableLoadingProps, DataTableProvider, DataTableRoot, type DataTableRow, DataTableRowContextMenu, DataTableRowContextMenuProps, DataTableRowContextMenuSlot, DataTableRowContextMenuSlotProps, DataTableRowCount, DataTableRowCountProps, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSkeletonProps, DataTableSortHeader, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DistributionBar, DistributionBarProps, DistributionMarker, DistributionSegment, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtendedColumnFilter, type ExtendedColumnSort, type FilterOperator, type FilterOperatorValues, type FilterVariant, type FilterVariantValues, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, Formatters, type GlobalFilter, GroupedBodyRow, GroupedBodyRowProps, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, Line, LineChart, LineChartCard, LineChartCardProps, LocalTime, LocalTimeProps, NavMain, NavProjects, NavUser, NumericXProps, type Option, PageSection, PageSectionProps, PageSubheading, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, SectionCards, SectionCardsProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SeriesChartProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, TableSearchFilterProps, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, TimeOptions, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, ToneProgressProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, TreemapLegend, TreemapLegendProps, TreemapProps, type ValueOf, type ColorConfig$1 as WeekdayColorConfig, type WeekdayExtraColumnSpec, type WeekdayExtraRowSpec, WeekdayHeatmap, WeekdayHeatmapBlock, type WeekdayHeatmapBlockProps, WeekdayHeatmapBody, type WeekdayHeatmapBodyProps, WeekdayHeatmapFooter, type WeekdayHeatmapFooterProps, type WeekdayHeatmapLabels, WeekdayHeatmapLegend, type WeekdayHeatmapLegendProps, type WeekdayHeatmapProps, WeekdayHeatmapStat, type WeekdayHeatmapStatProps, type WeekdayHour, type WeekdayHourlyActivity, type WeekdayIndex, XAxis, YAxis, badgeVariants, buttonVariants, count, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
package/dist/index.js CHANGED
@@ -38,9 +38,11 @@ import { LineChartCard } from "./components/registry/charts/line-chart-card.js";
38
38
  import { SectionCards } from "./components/registry/dashboard-01/section-cards.js";
39
39
  import { count, money, moneyCompact, pct, time, useFormat } from "./lib/format.js";
40
40
  import { BarList } from "./components/registry/dashboardcn/bar-list.js";
41
+ import { DistributionBar } from "./components/registry/dashboardcn/distribution-bar.js";
41
42
  import { CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBody, CalendarHeatmapFooter, CalendarHeatmapLegend, CalendarHeatmapStat } from "./components/registry/heatmap/calendar-heatmap.js";
42
43
  import { StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBody, StatusHeatmapFooter, StatusHeatmapLegend, StatusHeatmapStat } from "./components/registry/heatmap/status-heatmap.js";
43
44
  import { WeekdayHeatmap, WeekdayHeatmapBlock, WeekdayHeatmapBody, WeekdayHeatmapFooter, WeekdayHeatmapLegend, WeekdayHeatmapStat } from "./components/registry/heatmap/weekday-heatmap.js";
45
+ import { CopyButton } from "./components/registry/minidev/copy-button.js";
44
46
  import { TableColumnActions } from "./components/registry/niko-table/filters/table-column-actions.js";
45
47
  import { DataTableColumnHeader, DataTableColumnHeaderRoot, useColumnHeaderContext } from "./components/registry/niko-table/components/data-table-column-header.js";
46
48
  import { DataTableColumnActions } from "./components/registry/niko-table/components/data-table-column-actions.js";
@@ -81,4 +83,4 @@ import { PriceChart } from "./components/siyahi/price-chart.js";
81
83
  import { ToneProgress } from "./components/siyahi/tone-progress.js";
82
84
  import { Treemap, TreemapLegend } from "./components/siyahi/treemap.js";
83
85
  import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, ReferenceLine, XAxis, YAxis } from "./lib/recharts.js";
84
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, Area, AreaChart, AreaChartCard, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, BarChartCard, BarList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBody, CalendarHeatmapFooter, CalendarHeatmapLegend, CalendarHeatmapStat, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataList, DataListItem, DataTable, DataTableActions, DataTableBody, DataTableColumnActions, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, DataTableContext, DataTableEmptyActions, DataTableEmptyBody, DataTableEmptyDescription, DataTableEmptyFilteredMessage, DataTableEmptyIcon, DataTableEmptyMessage, DataTableEmptyState, DataTableEmptyTitle, DataTableErrorBoundary, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableHeader, DataTableLoading, DataTableLoadingMore, DataTableProvider, DataTableRoot, DataTableRowContextMenu, DataTableRowContextMenuSlot, DataTableRowCount, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSortHeader, DataTableToolbarSection, Delta, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, GroupedBodyRow, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Line, LineChart, LineChartCard, LocalTime, NavMain, NavProjects, NavUser, PageSection, PageSubheading, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollArea, ScrollBar, SectionCards, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiProvider, Skeleton, Slider, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBody, StatusHeatmapFooter, StatusHeatmapLegend, StatusHeatmapStat, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapLegend, WeekdayHeatmap, WeekdayHeatmapBlock, WeekdayHeatmapBody, WeekdayHeatmapFooter, WeekdayHeatmapLegend, WeekdayHeatmapStat, XAxis, YAxis, badgeVariants, buttonVariants, count, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
86
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, Area, AreaChart, AreaChartCard, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, BarChartCard, BarList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBody, CalendarHeatmapFooter, CalendarHeatmapLegend, CalendarHeatmapStat, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataList, DataListItem, DataTable, DataTableActions, DataTableBody, DataTableColumnActions, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, DataTableContext, DataTableEmptyActions, DataTableEmptyBody, DataTableEmptyDescription, DataTableEmptyFilteredMessage, DataTableEmptyIcon, DataTableEmptyMessage, DataTableEmptyState, DataTableEmptyTitle, DataTableErrorBoundary, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableHeader, DataTableLoading, DataTableLoadingMore, DataTableProvider, DataTableRoot, DataTableRowContextMenu, DataTableRowContextMenuSlot, DataTableRowCount, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSortHeader, DataTableToolbarSection, Delta, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DistributionBar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, GroupedBodyRow, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Line, LineChart, LineChartCard, LocalTime, NavMain, NavProjects, NavUser, PageSection, PageSubheading, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollArea, ScrollBar, SectionCards, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiProvider, Skeleton, Slider, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBody, StatusHeatmapFooter, StatusHeatmapLegend, StatusHeatmapStat, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapLegend, WeekdayHeatmap, WeekdayHeatmapBlock, WeekdayHeatmapBody, WeekdayHeatmapFooter, WeekdayHeatmapLegend, WeekdayHeatmapStat, XAxis, YAxis, badgeVariants, buttonVariants, count, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
@@ -1,11 +1,18 @@
1
- import { ChartSeries, SeriesChartProps } from "./chart-series.js";
1
+ import { ChartSeries, NumericXProps, SeriesChartProps } from "./chart-series.js";
2
2
  import { ReactNode } from "react";
3
3
  import { AreaChart, BarChart, LineChart } from "recharts";
4
4
  //#region src/lib/chart-frame.d.ts
5
- interface ChartFrameProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K> {
5
+ interface ChartFrameProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K>, NumericXProps {
6
6
  chart: typeof AreaChart | typeof BarChart | typeof LineChart;
7
7
  /** One Bar, Area or Line per series. */
8
8
  children: ReactNode;
9
+ /**
10
+ * Bars run sideways: the categories go down the left, where long names fit, and the value axis is hidden, as
11
+ * in shadcn's chart-bar-horizontal. x and y keep their meaning: x is the category, y the value.
12
+ */
13
+ horizontal?: boolean;
14
+ /** "sign" stacks negative values below zero and positive ones above, rather than on one running total. */
15
+ stackOffset?: "sign";
9
16
  }
10
17
  /** A tooltip row: the series' colour and label, then its value as the page formats it, or — when the row has none. */
11
18
  export declare function seriesRow<T>(series: ChartSeries<T>, formatValue: (value: number) => string): (value: unknown, _name: unknown, item: {
@@ -17,6 +24,6 @@ export declare function seriesRow<T>(series: ChartSeries<T>, formatValue: (value
17
24
  * that gave its category axis its own id (dash#88) got a plot split in two
18
25
  * and every tooltip headed with the series name instead of the category.
19
26
  */
20
- export declare function ChartFrame<T extends object, K extends keyof T>({ chart: Chart, children, title, description, action, data, xKey, series, xFormatter, valueFormatter, yTickFormatter, height }: ChartFrameProps<T, K>): import("react").JSX.Element;
27
+ export declare function ChartFrame<T extends object, K extends keyof T>({ chart: Chart, children, horizontal, stackOffset, title, description, action, data, xKey, series, xFormatter, xTooltipFormatter, valueFormatter, yTickFormatter, yDomain, yTicks, height, xTickDetail, xLabel, yLabel, referenceLines, placeholder, footer, xDomain, xTicks }: ChartFrameProps<T, K>): import("react").JSX.Element;
21
28
  //#endregion
22
29
  export {};
@@ -1,17 +1,21 @@
1
- import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "../components/ui/card.js";
1
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../components/ui/card.js";
2
2
  import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent } from "../components/ui/chart.js";
3
3
  import { useLocale } from "../components/siyahi/siyahi-provider.js";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { CartesianGrid, ReferenceLine, XAxis, YAxis } from "recharts";
6
6
  //#region src/lib/chart-frame.tsx
7
+ const AXIS_TITLE = "fill-muted-foreground text-xs";
8
+ const TICK = { className: "fill-muted-foreground font-mono" };
9
+ const NO_LINES = [];
7
10
  /** A tooltip row: the series' colour and label, then its value as the page formats it, or — when the row has none. */
8
11
  function seriesRow(series, formatValue) {
9
12
  return (value, _name, item) => {
10
13
  const entry = series.find(({ key }) => key === item.dataKey);
14
+ const color = entry?.negativeColor && Number(value) < 0 ? entry.negativeColor : entry?.color;
11
15
  return /* @__PURE__ */ jsxs(Fragment, { children: [
12
16
  /* @__PURE__ */ jsx("span", {
13
17
  className: "size-2.5 shrink-0 rounded-xs",
14
- style: { backgroundColor: entry?.color }
18
+ style: { backgroundColor: color }
15
19
  }),
16
20
  /* @__PURE__ */ jsx("span", {
17
21
  className: "text-muted-foreground",
@@ -24,13 +28,51 @@ function seriesRow(series, formatValue) {
24
28
  ] });
25
29
  };
26
30
  }
31
+ const CHAR_WIDTH = 6.6;
32
+ /** Squeezes a line into its column with SVG's own textLength when it would run into the next one. */
33
+ const fitTo = (text, room) => room > 0 && text.length * CHAR_WIDTH > room ? {
34
+ textLength: room,
35
+ lengthAdjust: "spacingAndGlyphs"
36
+ } : {};
37
+ /**
38
+ * An x tick with a second line from its row. Under a column the lines hang below the axis; beside a horizontal
39
+ * bar they straddle its middle. Both lines are set in Geist, not Mono: a name with a figure under it reads as a
40
+ * label, as in BarList, and sector names in Mono would take most of a phone's width.
41
+ */
42
+ function twoLineTick(data, xKey, xFormatter, detailOf, beside) {
43
+ return ({ x, y, width, visibleTicksCount, payload }) => {
44
+ const value = payload?.value;
45
+ const row = data.find((r) => r[xKey] === value);
46
+ const name = xFormatter(value);
47
+ const detail = row ? detailOf(row) : null;
48
+ const room = beside || !visibleTicksCount ? 0 : Number(width) / visibleTicksCount - 6;
49
+ return /* @__PURE__ */ jsxs("text", {
50
+ x,
51
+ y,
52
+ textAnchor: beside ? "end" : "middle",
53
+ className: "recharts-cartesian-axis-tick-value fill-muted-foreground",
54
+ children: [/* @__PURE__ */ jsx("tspan", {
55
+ x,
56
+ dy: beside ? -4 : 12,
57
+ ...fitTo(name, room),
58
+ children: name
59
+ }), detail !== null && /* @__PURE__ */ jsx("tspan", {
60
+ x,
61
+ dy: 15,
62
+ className: "tabular-nums",
63
+ ...fitTo(detail, room),
64
+ children: detail
65
+ })]
66
+ });
67
+ };
68
+ }
27
69
  /**
28
70
  * The card, axes, grid, tooltip and legend the three chart cards share. Both
29
71
  * axes keep Recharts' default ids: marks find their axes by id, and a page
30
72
  * that gave its category axis its own id (dash#88) got a plot split in two
31
73
  * and every tooltip headed with the series name instead of the category.
32
74
  */
33
- function ChartFrame({ chart: Chart, children, title, description, action, data, xKey, series, xFormatter = String, valueFormatter, yTickFormatter, height }) {
75
+ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, title, description, action, data, xKey, series, xFormatter = String, xTooltipFormatter = xFormatter, valueFormatter, yTickFormatter, yDomain, yTicks, height, xTickDetail, xLabel, yLabel, referenceLines = NO_LINES, placeholder, footer, xDomain, xTicks }) {
34
76
  const { numberLocale } = useLocale();
35
77
  const formatValue = valueFormatter ?? new Intl.NumberFormat(numberLocale).format;
36
78
  const config = Object.fromEntries(series.map(({ key, label, color }) => [key, {
@@ -38,59 +80,123 @@ function ChartFrame({ chart: Chart, children, title, description, action, data,
38
80
  color
39
81
  }]));
40
82
  const crossesZero = data.some((row) => series.some(({ key }) => Number(row[key]) < 0));
41
- return /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [
42
- /* @__PURE__ */ jsx(CardTitle, { children: title }),
43
- description && /* @__PURE__ */ jsx(CardDescription, { children: description }),
44
- action && /* @__PURE__ */ jsx(CardAction, { children: action })
45
- ] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(ChartContainer, {
46
- config,
47
- className: "aspect-auto w-full",
48
- style: { height },
49
- children: /* @__PURE__ */ jsxs(Chart, {
50
- data,
51
- margin: {
52
- left: 0,
53
- right: 8
54
- },
55
- children: [
56
- /* @__PURE__ */ jsx(CartesianGrid, {
57
- vertical: false,
58
- strokeDasharray: "3 3"
59
- }),
60
- /* @__PURE__ */ jsx(XAxis, {
61
- dataKey: xKey,
62
- tickLine: false,
63
- axisLine: false,
64
- tickMargin: 8,
65
- tickFormatter: (value) => xFormatter(value),
66
- tick: { className: "font-mono" }
67
- }),
68
- /* @__PURE__ */ jsx(YAxis, {
69
- tickLine: false,
70
- axisLine: false,
71
- width: "auto",
72
- tickFormatter: yTickFormatter ?? formatValue,
73
- tick: { className: "font-mono" }
74
- }),
75
- crossesZero && /* @__PURE__ */ jsx(ReferenceLine, {
76
- y: 0,
77
- stroke: "var(--border)"
78
- }),
79
- /* @__PURE__ */ jsx(ChartTooltip, { content: /* @__PURE__ */ jsx(ChartTooltipContent, {
80
- labelFormatter: (_, payload) => {
81
- const row = payload[0]?.payload;
82
- return row ? xFormatter(row[xKey]) : null;
83
- },
84
- formatter: seriesRow(series, formatValue)
85
- }) }),
86
- children,
87
- /* @__PURE__ */ jsx(ChartLegend, {
88
- content: /* @__PURE__ */ jsx(ChartLegendContent, {}),
89
- itemSorter: null
90
- })
91
- ]
83
+ return /* @__PURE__ */ jsxs(Card, { children: [
84
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
85
+ /* @__PURE__ */ jsx(CardTitle, { children: title }),
86
+ description && /* @__PURE__ */ jsx(CardDescription, { children: description }),
87
+ action && /* @__PURE__ */ jsx(CardAction, { children: action })
88
+ ] }),
89
+ /* @__PURE__ */ jsx(CardContent, { children: placeholder ? /* @__PURE__ */ jsx("div", {
90
+ "data-slot": "chart-placeholder",
91
+ className: "flex items-center justify-center",
92
+ style: { height },
93
+ children: placeholder
94
+ }) : /* @__PURE__ */ jsx(ChartContainer, {
95
+ config,
96
+ className: "aspect-auto w-full",
97
+ style: { height },
98
+ children: /* @__PURE__ */ jsxs(Chart, {
99
+ data,
100
+ layout: horizontal ? "vertical" : "horizontal",
101
+ stackOffset,
102
+ margin: {
103
+ left: 0,
104
+ right: 8
105
+ },
106
+ children: [
107
+ /* @__PURE__ */ jsx(CartesianGrid, {
108
+ vertical: horizontal,
109
+ horizontal: !horizontal,
110
+ strokeDasharray: "3 3"
111
+ }),
112
+ horizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
113
+ type: "number",
114
+ hide: true,
115
+ domain: yDomain,
116
+ ticks: yTicks
117
+ }), /* @__PURE__ */ jsx(YAxis, {
118
+ dataKey: xKey,
119
+ type: "category",
120
+ width: "auto",
121
+ tickLine: false,
122
+ axisLine: false,
123
+ tickMargin: 8,
124
+ tickFormatter: (value) => xFormatter(value),
125
+ tick: xTickDetail ? twoLineTick(data, xKey, xFormatter, xTickDetail, horizontal) : TICK,
126
+ interval: 0
127
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
128
+ dataKey: xKey,
129
+ type: xDomain ? "number" : "category",
130
+ domain: xDomain,
131
+ ticks: xTicks,
132
+ height: (xTickDetail ? 40 : 30) + (xLabel ? 18 : 0),
133
+ label: xLabel ? {
134
+ value: xLabel,
135
+ position: "insideBottom",
136
+ className: AXIS_TITLE
137
+ } : void 0,
138
+ tickLine: false,
139
+ axisLine: false,
140
+ tickMargin: 8,
141
+ tickFormatter: (value) => xFormatter(value),
142
+ tick: xTickDetail ? twoLineTick(data, xKey, xFormatter, xTickDetail, false) : TICK,
143
+ interval: xTickDetail ? 0 : void 0
144
+ }), /* @__PURE__ */ jsx(YAxis, {
145
+ tickLine: false,
146
+ axisLine: false,
147
+ width: "auto",
148
+ domain: yDomain,
149
+ ticks: yTicks,
150
+ label: yLabel ? {
151
+ value: yLabel,
152
+ angle: -90,
153
+ position: "insideLeft",
154
+ style: { textAnchor: "middle" },
155
+ className: AXIS_TITLE
156
+ } : void 0,
157
+ tickFormatter: (value) => (yTickFormatter ?? formatValue)(value),
158
+ tick: TICK
159
+ })] }),
160
+ crossesZero && (horizontal ? /* @__PURE__ */ jsx(ReferenceLine, {
161
+ x: 0,
162
+ stroke: "var(--border)"
163
+ }) : /* @__PURE__ */ jsx(ReferenceLine, {
164
+ y: 0,
165
+ stroke: "var(--border)"
166
+ })),
167
+ referenceLines.map(({ label, emphasis = "muted", labelPosition = "insideTopLeft", ...at }) => /* @__PURE__ */ jsx(ReferenceLine, {
168
+ ...horizontal ? {
169
+ x: at.y,
170
+ y: at.x
171
+ } : at,
172
+ stroke: emphasis === "strong" ? "var(--foreground)" : "var(--muted-foreground)",
173
+ strokeDasharray: at.y === void 0 ? void 0 : "4 4",
174
+ label: label === void 0 ? void 0 : {
175
+ value: label,
176
+ position: labelPosition,
177
+ className: "fill-muted-foreground text-xs"
178
+ }
179
+ }, `${at.x ?? ""}:${at.y ?? ""}:${label ?? ""}`)),
180
+ /* @__PURE__ */ jsx(ChartTooltip, { content: /* @__PURE__ */ jsx(ChartTooltipContent, {
181
+ labelFormatter: (_, payload) => {
182
+ const row = payload[0]?.payload;
183
+ return row ? xTooltipFormatter(row[xKey]) : null;
184
+ },
185
+ formatter: seriesRow(series, formatValue)
186
+ }) }),
187
+ children,
188
+ /* @__PURE__ */ jsx(ChartLegend, {
189
+ content: /* @__PURE__ */ jsx(ChartLegendContent, {}),
190
+ itemSorter: null
191
+ })
192
+ ]
193
+ })
194
+ }) }),
195
+ footer && /* @__PURE__ */ jsx(CardFooter, {
196
+ className: "flex-col items-start gap-2 text-sm",
197
+ children: footer
92
198
  })
93
- }) })] });
199
+ ] });
94
200
  }
95
201
  //#endregion
96
202
  export { ChartFrame, seriesRow };
@@ -1,7 +1,10 @@
1
1
  import { ReactNode } from "react";
2
2
  //#region src/lib/chart-series.d.ts
3
- /** The colours a series may take: the five chart slots, and muted for an "Other" past five. */
4
- export type ChartColor = "var(--chart-1)" | "var(--chart-2)" | "var(--chart-3)" | "var(--chart-4)" | "var(--chart-5)" | "var(--muted-foreground)";
3
+ /**
4
+ * The colours a series may take: the five chart slots, muted for an "Other" past five, and the two meaning
5
+ * colours for a gain and a loss.
6
+ */
7
+ export type ChartColor = "var(--chart-1)" | "var(--chart-2)" | "var(--chart-3)" | "var(--chart-4)" | "var(--chart-5)" | "var(--muted-foreground)" | "var(--positive)" | "var(--negative)";
5
8
  /** The fields of a row that hold numbers: the ones a series can plot. */
6
9
  type NumericKey<T> = { [K in keyof T]-?: T[K] extends number | null | undefined ? K : never; }[keyof T] & string;
7
10
  /** One series: the field it plots, its name in the legend and tooltip, and its colour. */
@@ -9,6 +12,8 @@ export interface ChartSeriesItem<T> {
9
12
  key: NumericKey<T>;
10
13
  label: string;
11
14
  color: ChartColor;
15
+ /** A bar below zero takes this colour instead, such as var(--negative) for a loss beside var(--positive). */
16
+ negativeColor?: ChartColor;
12
17
  }
13
18
  /**
14
19
  * The series in draw, stack and legend order; give the slots in order from
@@ -16,6 +21,23 @@ export interface ChartSeriesItem<T> {
16
21
  * number-like keys such as "2024" first whatever order the page wrote them in.
17
22
  */
18
23
  export type ChartSeries<T> = readonly ChartSeriesItem<T>[];
24
+ /**
25
+ * A labelled line across the plot: a level on the value axis (y), such as a limit, or a point on the x axis, such
26
+ * as an event. A level is dashed, an event solid.
27
+ */
28
+ export type ChartReferenceLine = ({
29
+ y: number;
30
+ x?: never;
31
+ } | {
32
+ x: number | string;
33
+ y?: never;
34
+ }) & {
35
+ label?: string;
36
+ /** "strong" draws it in the text colour, for the line that matters most; "muted" by default. */
37
+ emphasis?: "muted" | "strong";
38
+ /** Where the label sits against the line. Defaults to insideTopLeft. */
39
+ labelPosition?: "insideTopLeft" | "insideTopRight" | "insideBottomLeft" | "insideBottomRight";
40
+ };
19
41
  /** What BarChartCard, AreaChartCard and LineChartCard all take. */
20
42
  export interface SeriesChartProps<T extends object, K extends keyof T> {
21
43
  title: ReactNode;
@@ -27,14 +49,44 @@ export interface SeriesChartProps<T extends object, K extends keyof T> {
27
49
  /** The field the x axis reads: a month, an hour of day, a price bucket. One row per value; a repeated value is hidden behind the first. */
28
50
  xKey: K;
29
51
  series: ChartSeries<NoInfer<T>>;
30
- /** The x axis ticks and the tooltip's heading. Defaults to the value as text. */
52
+ /** The x axis ticks, and the tooltip's heading unless xTooltipFormatter is set. Defaults to the value as text. */
31
53
  xFormatter?: (value: T[K]) => string;
54
+ /** The tooltip's heading, when it should say more than a tick: "19:34:13 IST, 10 s average" against "19:34". */
55
+ xTooltipFormatter?: (value: T[K]) => string;
32
56
  /** A series' value in the tooltip, and the y axis unless yTickFormatter is set. Defaults to the locale's numbers. */
33
57
  valueFormatter?: (value: number) => string;
34
58
  /** The y axis, when its ticks should be shorter than the tooltip's figures: moneyCompact against money. */
35
59
  yTickFormatter?: (value: number) => string;
60
+ /** A fixed range for the value axis, such as [0, 100] for a percentage; by default it fits the data. */
61
+ yDomain?: [number, number];
62
+ /** Where the value axis puts its ticks, such as [0, 25, 50, 75, 100]. */
63
+ yTicks?: readonly number[];
36
64
  /** Height of the plot and legend, in pixels. */
37
65
  height: number;
66
+ /** A second line under each x tick, so a row's figure reads without a hover: "FY24" then "▲₹1.2L". */
67
+ xTickDetail?: (row: T) => string;
68
+ /** A title under the x axis, such as "Hour of day (IST)". Not drawn on sideways bars. */
69
+ xLabel?: string;
70
+ /** A title beside the value axis, read bottom to top, such as "Orders". Not drawn on sideways bars. */
71
+ yLabel?: string;
72
+ /** Limits and events to mark on the plot. A zero line draws by itself when a value goes below zero. */
73
+ referenceLines?: readonly ChartReferenceLine[];
74
+ /** Shown in the plot's place, at its height, while the data loads or after it failed to. */
75
+ placeholder?: ReactNode;
76
+ /** Lines under the chart, such as a caption or a takeaway, in the card's footer. */
77
+ footer?: ReactNode;
38
78
  }
79
+ /** A numeric x axis, for samples in time or any measure where a mark can sit between two rows. */
80
+ export interface NumericXProps {
81
+ /** The x axis runs over this range of the xKey field, which must hold numbers; without it the axis is one slot per row. */
82
+ xDomain?: [number, number];
83
+ /** Where the x axis puts its ticks, in the xKey field's units. */
84
+ xTicks?: readonly number[];
85
+ }
86
+ /**
87
+ * How a line or an area's edge joins its points: "linear" draws straight segments, as measured samples should
88
+ * be drawn; "monotone", the default, smooths between them without overshooting a point.
89
+ */
90
+ export type ChartCurve = "monotone" | "linear";
39
91
  //#endregion
40
92
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siyahi/ui",
3
- "version": "0.1.9-next.1",
3
+ "version": "0.1.9-next.2",
4
4
  "description": "Stock shadcn/ui on Base UI and Tailwind v4, a finance theme, a few compositions and formatters.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -41,6 +41,14 @@
41
41
  "copied": "2026-10-20",
42
42
  "sha256": "bc19cf1f5e486fa11273e7d7ed620eb7b82ba360f72e5a15e6bf488f992d16ce"
43
43
  },
44
+ {
45
+ "file": "src/components/registry/dashboardcn/distribution-bar.tsx",
46
+ "registry": "@dashboardcn/distribution-bar",
47
+ "origin": "https://dashboardcn.com/r/distribution-bar.json",
48
+ "licence": "MIT, Copyright (c) 2026 dashboardcn contributors, https://github.com/NoahGdev/dashboardcn/blob/main/LICENSE",
49
+ "copied": "2026-10-22",
50
+ "sha256": "9028368f1363732cef765dabad2eca3ba98b608f1e237123b09df701c41c8b5a"
51
+ },
44
52
  {
45
53
  "file": "src/components/registry/heatmap/calendar-heatmap.tsx",
46
54
  "registry": "@heatmap/calendar-heatmap",
@@ -65,6 +73,14 @@
65
73
  "copied": "2026-10-20",
66
74
  "sha256": "b7af6139e3764e1479880fb232988e758edb27ce4e4280d9e0349cbdf9b3d30c"
67
75
  },
76
+ {
77
+ "file": "src/components/registry/minidev/copy-button.tsx",
78
+ "registry": "@minidev/copy-button",
79
+ "origin": "https://ui.minidev.pro/r/copy-button.json",
80
+ "licence": "MIT, Copyright (c) 2026 MiniDev, https://github.com/amankaushik481/minidev-ui/blob/main/LICENSE",
81
+ "copied": "2026-10-22",
82
+ "sha256": "67f491ea6c947ebf3bf058423a373347badd49ad07861e022599ebdbb11cab44"
83
+ },
68
84
  {
69
85
  "file": "src/components/registry/niko-table/components/data-table-column-actions.tsx",
70
86
  "registry": "@niko-table/data-table",