@siyahi/ui 0.1.8-next.4 → 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.
Files changed (47) hide show
  1. package/README.md +38 -18
  2. package/THIRD_PARTY_NOTICES.md +11 -10
  3. package/dist/components/registry/charts/area-chart-card.d.ts +4 -3
  4. package/dist/components/registry/charts/area-chart-card.js +2 -2
  5. package/dist/components/registry/charts/bar-chart-card.d.ts +7 -1
  6. package/dist/components/registry/charts/bar-chart-card.js +20 -5
  7. package/dist/components/registry/charts/line-chart-card.d.ts +5 -2
  8. package/dist/components/registry/charts/line-chart-card.js +2 -2
  9. package/dist/components/registry/dashboard-01/section-cards.d.ts +9 -2
  10. package/dist/components/registry/dashboard-01/section-cards.js +32 -21
  11. package/dist/components/registry/dashboardcn/bar-list.d.ts +3 -1
  12. package/dist/components/registry/dashboardcn/bar-list.js +2 -2
  13. package/dist/components/registry/dashboardcn/distribution-bar.d.ts +38 -0
  14. package/dist/components/registry/dashboardcn/distribution-bar.js +118 -0
  15. package/dist/components/registry/minidev/copy-button.d.ts +11 -0
  16. package/dist/components/registry/minidev/copy-button.js +34 -0
  17. package/dist/components/registry/niko-table/components/data-table-search-filter.d.ts +35 -0
  18. package/dist/components/registry/niko-table/components/data-table-search-filter.js +44 -0
  19. package/dist/components/registry/niko-table/filters/table-search-filter.d.ts +38 -0
  20. package/dist/components/registry/niko-table/filters/table-search-filter.js +103 -0
  21. package/dist/components/siyahi/data-list.d.ts +14 -0
  22. package/dist/components/siyahi/data-list.js +25 -0
  23. package/dist/components/siyahi/data-table-row-count.d.ts +11 -0
  24. package/dist/components/siyahi/data-table-row-count.js +18 -0
  25. package/dist/components/siyahi/data-table-sort-header.d.ts +15 -0
  26. package/dist/components/siyahi/data-table-sort-header.js +36 -0
  27. package/dist/components/siyahi/inline-code.d.ts +7 -0
  28. package/dist/components/siyahi/inline-code.js +11 -0
  29. package/dist/components/siyahi/page-section.d.ts +21 -0
  30. package/dist/components/siyahi/page-section.js +39 -0
  31. package/dist/components/siyahi/tone-progress.d.ts +15 -0
  32. package/dist/components/siyahi/tone-progress.js +18 -0
  33. package/dist/components/siyahi/treemap.d.ts +7 -0
  34. package/dist/components/siyahi/treemap.js +69 -2
  35. package/dist/components/ui/code-block.d.ts +28 -0
  36. package/dist/components/ui/code-block.js +122 -0
  37. package/dist/index.d.ts +19 -8
  38. package/dist/index.js +14 -3
  39. package/dist/lib/chart-frame.d.ts +10 -3
  40. package/dist/lib/chart-frame.js +161 -55
  41. package/dist/lib/chart-series.d.ts +55 -3
  42. package/dist/lib/format.d.ts +3 -0
  43. package/dist/lib/format.js +6 -1
  44. package/dist/lib/treemap.d.ts +4 -0
  45. package/dist/lib/treemap.js +9 -4
  46. package/package.json +1 -1
  47. package/registry.lock.json +32 -0
@@ -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 {};
@@ -9,6 +9,8 @@ export declare function money(value: number, locale?: SiyahiLocale, fractionDigi
9
9
  * `Delta`, which adds the arrow.
10
10
  */
11
11
  export declare function moneyCompact(value: number, locale?: SiyahiLocale): string;
12
+ /** A whole count with the locale's grouping: 1,53,110 in en-IN. */
13
+ export declare function count(value: number, locale?: SiyahiLocale): string;
12
14
  /** A fraction as a percentage: 0.1234 is 12.3%. */
13
15
  export declare function pct(value: number, locale?: SiyahiLocale, fractionDigits?: number): string;
14
16
  export interface TimeOptions {
@@ -18,6 +20,7 @@ export interface TimeOptions {
18
20
  /** A 24-hour time in the locale's zone, with the zone written: 14:30 IST. */
19
21
  export declare function time(value: Date | number | string, locale?: SiyahiLocale, { withDate }?: TimeOptions): string;
20
22
  export interface Formatters {
23
+ count: (value: number) => string;
21
24
  money: (value: number, fractionDigits?: number) => string;
22
25
  moneyCompact: (value: number) => string;
23
26
  pct: (value: number, fractionDigits?: number) => string;
@@ -26,6 +26,10 @@ function moneyCompact(value, locale = defaultLocale) {
26
26
  maximumFractionDigits: 1
27
27
  }).format(value);
28
28
  }
29
+ /** A whole count with the locale's grouping: 1,53,110 in en-IN. */
30
+ function count(value, locale = defaultLocale) {
31
+ return new Intl.NumberFormat(locale.numberLocale, { maximumFractionDigits: 0 }).format(value);
32
+ }
29
33
  /** A fraction as a percentage: 0.1234 is 12.3%. */
30
34
  function pct(value, locale = defaultLocale, fractionDigits = 1) {
31
35
  return new Intl.NumberFormat(locale.numberLocale, {
@@ -54,6 +58,7 @@ function time(value, locale = defaultLocale, { withDate = false } = {}) {
54
58
  function useFormat() {
55
59
  const locale = useLocale();
56
60
  return useMemo(() => ({
61
+ count: (value) => count(value, locale),
57
62
  money: (value, fractionDigits) => money(value, locale, fractionDigits),
58
63
  moneyCompact: (value) => moneyCompact(value, locale),
59
64
  pct: (value, fractionDigits) => pct(value, locale, fractionDigits),
@@ -61,4 +66,4 @@ function useFormat() {
61
66
  }), [locale]);
62
67
  }
63
68
  //#endregion
64
- export { money, moneyCompact, pct, time, useFormat };
69
+ export { count, money, moneyCompact, pct, time, useFormat };
@@ -18,6 +18,10 @@ export declare function layout<T extends {
18
18
  weight: number;
19
19
  group?: string;
20
20
  }>(items: T[], width: number, height: number): Layout<T>;
21
+ export declare const HEAT_STEPS = 5;
22
+ /** The range the heat scale uses: one that is not a positive number falls back to ±5%. */
23
+ export declare const heatRange: (range?: number) => number;
24
+ export declare const heatFill: (side: "positive" | "negative", step: number) => string;
21
25
  export declare function heat(change: number | null, range?: number): string;
22
26
  //#endregion
23
27
  export {};
@@ -31,10 +31,15 @@ function layout(items, width, height) {
31
31
  }])
32
32
  };
33
33
  }
34
- function heat(change, range = .05) {
34
+ const DEFAULT_RANGE = .05;
35
+ const HEAT_STEPS = 5;
36
+ /** The range the heat scale uses: one that is not a positive number falls back to ±5%. */
37
+ const heatRange = (range = DEFAULT_RANGE) => Number.isFinite(range) && range > 0 ? range : DEFAULT_RANGE;
38
+ const heatFill = (side, step) => `color-mix(in oklab, var(--${side}) ${step * 12}%, var(--card))`;
39
+ function heat(change, range) {
35
40
  if (!change) return "var(--muted)";
36
- const mix = Math.min(5, Math.ceil(Math.abs(change) / (Number.isFinite(range) && range > 0 ? range : .05) * 5)) * 12;
37
- return `color-mix(in oklab, var(${change > 0 ? "--positive" : "--negative"}) ${mix}%, var(--card))`;
41
+ const step = Math.min(5, Math.ceil(Math.abs(change) / heatRange(range) * 5));
42
+ return heatFill(change > 0 ? "positive" : "negative", step);
38
43
  }
39
44
  //#endregion
40
- export { heat, layout };
45
+ export { HEAT_STEPS, heat, heatFill, heatRange, layout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siyahi/ui",
3
- "version": "0.1.8-next.4",
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",
@@ -153,6 +169,14 @@
153
169
  "copied": "2026-10-20",
154
170
  "sha256": "8b0c9768a5f1b90d7b4e2bf467a32ca86a43d5d546653f3a64d7abea277aa68b"
155
171
  },
172
+ {
173
+ "file": "src/components/registry/niko-table/components/data-table-search-filter.tsx",
174
+ "registry": "@niko-table/data-table-search-filter",
175
+ "origin": "https://niko-table.com/r/data-table-search-filter.json",
176
+ "licence": "MIT, Copyright (c) 2025 Semir N., original work (c) 2025 WebDevSimplified, https://github.com/Semkoo/niko-table-registry/blob/main/LICENSE",
177
+ "copied": "2026-10-22",
178
+ "sha256": "5aeb91ef34ff0dd87a92f1ad7ebd4500e8733b8ae30ecf836eae78304a10fad0"
179
+ },
156
180
  {
157
181
  "file": "src/components/registry/niko-table/components/data-table-toolbar-section.tsx",
158
182
  "registry": "@niko-table/data-table",
@@ -257,6 +281,14 @@
257
281
  "copied": "2026-10-20",
258
282
  "sha256": "dba551593726fa342b8c61daf5e5b9c79125df391af8ed31504e7dfedf7a71ba"
259
283
  },
284
+ {
285
+ "file": "src/components/registry/niko-table/filters/table-search-filter.tsx",
286
+ "registry": "@niko-table/data-table-search-filter",
287
+ "origin": "https://niko-table.com/r/data-table-search-filter.json",
288
+ "licence": "MIT, Copyright (c) 2025 Semir N., original work (c) 2025 WebDevSimplified, https://github.com/Semkoo/niko-table-registry/blob/main/LICENSE",
289
+ "copied": "2026-10-22",
290
+ "sha256": "c672763c02894a579f6cc7cddbe5fc17149b1eef484f992b9a35441b4e3b1c42"
291
+ },
260
292
  {
261
293
  "file": "src/components/registry/niko-table/hooks/use-derived-column-title.ts",
262
294
  "registry": "@niko-table/data-table",