@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
package/dist/lib/format.js
CHANGED
|
@@ -2,37 +2,69 @@ import { defaultLocale } from "./locale.js";
|
|
|
2
2
|
import { useLocale } from "../components/siyahi/siyahi-provider.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
//#region src/lib/format.ts
|
|
5
|
+
const numbers = /* @__PURE__ */ new Map();
|
|
6
|
+
const clocks = /* @__PURE__ */ new Map();
|
|
7
|
+
const regions = /* @__PURE__ */ new Map();
|
|
8
|
+
function numberFormat(locale, options) {
|
|
9
|
+
const key = JSON.stringify([locale, options]);
|
|
10
|
+
let formatter = numbers.get(key);
|
|
11
|
+
if (!formatter) {
|
|
12
|
+
formatter = new Intl.NumberFormat(locale, options);
|
|
13
|
+
numbers.set(key, formatter);
|
|
14
|
+
}
|
|
15
|
+
return formatter;
|
|
16
|
+
}
|
|
5
17
|
/** An amount in the locale's currency, whole units by default: ₹1,53,110. Signed figures belong in `Delta`. */
|
|
6
18
|
function money(value, locale = defaultLocale, fractionDigits = 0) {
|
|
7
|
-
return
|
|
19
|
+
return numberFormat(locale.numberLocale, {
|
|
8
20
|
style: "currency",
|
|
9
21
|
currency: locale.currency,
|
|
10
22
|
minimumFractionDigits: fractionDigits,
|
|
11
23
|
maximumFractionDigits: fractionDigits
|
|
12
24
|
}).format(value);
|
|
13
25
|
}
|
|
26
|
+
const DIGITS = /* @__PURE__ */ new Set(["integer", "fraction"]);
|
|
27
|
+
const NUMBER = /* @__PURE__ */ new Set([
|
|
28
|
+
"integer",
|
|
29
|
+
"group",
|
|
30
|
+
"decimal",
|
|
31
|
+
"fraction"
|
|
32
|
+
]);
|
|
14
33
|
/**
|
|
15
34
|
* A short amount: ₹2.4L and ₹40Cr in en-IN, $2.4M in en-US. Indian readers
|
|
16
35
|
* count in thousands up to a lakh, so in an Indian-region locale amounts under
|
|
17
36
|
* one lakh print in full (₹99,999), never as ₹99.9K. Signed figures belong in
|
|
18
37
|
* `Delta`, which adds the arrow.
|
|
38
|
+
*
|
|
39
|
+
* Give `scale`, the largest amount on the same axis, and every tick takes that
|
|
40
|
+
* amount's unit, to two decimals so close ticks stay apart: ₹1.5L, ₹0.75L,
|
|
41
|
+
* ₹0, rather than switching to ₹75,000 halfway up.
|
|
19
42
|
*/
|
|
20
|
-
function moneyCompact(value, locale = defaultLocale) {
|
|
21
|
-
if (
|
|
22
|
-
|
|
43
|
+
function moneyCompact(value, locale = defaultLocale, scale) {
|
|
44
|
+
if (!regions.has(locale.numberLocale)) regions.set(locale.numberLocale, new Intl.Locale(locale.numberLocale).region);
|
|
45
|
+
if (regions.get(locale.numberLocale) === "IN" && (scale ?? Math.abs(value)) < 1e5) return money(value, locale);
|
|
46
|
+
const compact = numberFormat(locale.numberLocale, {
|
|
23
47
|
style: "currency",
|
|
24
48
|
currency: locale.currency,
|
|
25
49
|
notation: "compact",
|
|
26
50
|
maximumFractionDigits: 1
|
|
27
|
-
})
|
|
51
|
+
});
|
|
52
|
+
if (scale === void 0 || value === 0) return compact.format(value);
|
|
53
|
+
const parts = compact.formatToParts(Math.sign(value) * scale);
|
|
54
|
+
const shown = Number(parts.flatMap((part) => part.type === "decimal" ? "." : DIGITS.has(part.type) ? part.value : []).join(""));
|
|
55
|
+
const unit = 10 ** Math.round(Math.log10(scale / shown));
|
|
56
|
+
if (unit === 1) return compact.format(value);
|
|
57
|
+
const digits = numberFormat(locale.numberLocale, { maximumFractionDigits: 2 }).format(Math.abs(value) / unit);
|
|
58
|
+
const first = parts.findIndex((part) => part.type === "integer");
|
|
59
|
+
return parts.flatMap((part, index) => index === first ? digits : NUMBER.has(part.type) ? [] : part.value).join("");
|
|
28
60
|
}
|
|
29
61
|
/** A whole count with the locale's grouping: 1,53,110 in en-IN. */
|
|
30
62
|
function count(value, locale = defaultLocale) {
|
|
31
|
-
return
|
|
63
|
+
return numberFormat(locale.numberLocale, { maximumFractionDigits: 0 }).format(value);
|
|
32
64
|
}
|
|
33
65
|
/** A fraction as a percentage: 0.1234 is 12.3%. */
|
|
34
66
|
function pct(value, locale = defaultLocale, fractionDigits = 1) {
|
|
35
|
-
return
|
|
67
|
+
return numberFormat(locale.numberLocale, {
|
|
36
68
|
style: "percent",
|
|
37
69
|
minimumFractionDigits: fractionDigits,
|
|
38
70
|
maximumFractionDigits: fractionDigits
|
|
@@ -40,19 +72,25 @@ function pct(value, locale = defaultLocale, fractionDigits = 1) {
|
|
|
40
72
|
}
|
|
41
73
|
/** A 24-hour time in the locale's zone, with the zone written: 14:30 IST. */
|
|
42
74
|
function time(value, locale = defaultLocale, { withDate = false } = {}) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
...date,
|
|
75
|
+
const options = {
|
|
76
|
+
...withDate ? {
|
|
77
|
+
day: "numeric",
|
|
78
|
+
month: "short",
|
|
79
|
+
year: "numeric"
|
|
80
|
+
} : {},
|
|
50
81
|
hour: "2-digit",
|
|
51
82
|
minute: "2-digit",
|
|
52
83
|
hourCycle: "h23",
|
|
53
84
|
timeZone: locale.timeZone,
|
|
54
85
|
timeZoneName: "short"
|
|
55
|
-
}
|
|
86
|
+
};
|
|
87
|
+
const key = JSON.stringify([locale.numberLocale, options]);
|
|
88
|
+
let formatter = clocks.get(key);
|
|
89
|
+
if (!formatter) {
|
|
90
|
+
formatter = new Intl.DateTimeFormat(locale.numberLocale, options);
|
|
91
|
+
clocks.set(key, formatter);
|
|
92
|
+
}
|
|
93
|
+
return formatter.format(new Date(value));
|
|
56
94
|
}
|
|
57
95
|
/** The formatters above, bound to the locale of the nearest `SiyahiProvider`. */
|
|
58
96
|
function useFormat() {
|
|
@@ -60,7 +98,7 @@ function useFormat() {
|
|
|
60
98
|
return useMemo(() => ({
|
|
61
99
|
count: (value) => count(value, locale),
|
|
62
100
|
money: (value, fractionDigits) => money(value, locale, fractionDigits),
|
|
63
|
-
moneyCompact: (value) => moneyCompact(value, locale),
|
|
101
|
+
moneyCompact: (value, scale) => moneyCompact(value, locale, scale),
|
|
64
102
|
pct: (value, fractionDigits) => pct(value, locale, fractionDigits),
|
|
65
103
|
time: (value, options) => time(value, locale, options)
|
|
66
104
|
}), [locale]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KeyboardEventHandler, RefObject } from "react";
|
|
2
|
+
//#region src/lib/heatmap-navigation.d.ts
|
|
3
|
+
/** One tab stop per heatmap; arrows move between its actual drawn cells. */
|
|
4
|
+
export declare function useHeatmapNavigation(): {
|
|
5
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
6
|
+
onKeyDown: KeyboardEventHandler<HTMLDivElement>;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from "react";
|
|
2
|
+
//#region src/lib/heatmap-navigation.ts
|
|
3
|
+
/** One tab stop per heatmap; arrows move between its actual drawn cells. */
|
|
4
|
+
function useHeatmapNavigation() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const cells = () => [...ref.current?.querySelectorAll("rect[role=\"button\"]") ?? []];
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
const buttons = cells();
|
|
9
|
+
const active = buttons.find((cell) => cell === document.activeElement) ?? buttons[0];
|
|
10
|
+
for (const cell of buttons) cell.tabIndex = cell === active ? 0 : -1;
|
|
11
|
+
});
|
|
12
|
+
const onKeyDown = (event) => {
|
|
13
|
+
if (!(event.target instanceof SVGElement) || event.target.getAttribute("role") !== "button") return;
|
|
14
|
+
const buttons = cells();
|
|
15
|
+
let next;
|
|
16
|
+
if (event.key === "Home") next = buttons[0];
|
|
17
|
+
else if (event.key === "End") next = buttons.at(-1);
|
|
18
|
+
else if ([
|
|
19
|
+
"ArrowLeft",
|
|
20
|
+
"ArrowRight",
|
|
21
|
+
"ArrowUp",
|
|
22
|
+
"ArrowDown"
|
|
23
|
+
].includes(event.key)) {
|
|
24
|
+
const origin = event.target.getBoundingClientRect();
|
|
25
|
+
const horizontal = event.key === "ArrowLeft" || event.key === "ArrowRight";
|
|
26
|
+
const direction = event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 1;
|
|
27
|
+
let nearest = Infinity;
|
|
28
|
+
for (const cell of buttons) {
|
|
29
|
+
const box = cell.getBoundingClientRect();
|
|
30
|
+
const primary = (horizontal ? box.x - origin.x : box.y - origin.y) * direction;
|
|
31
|
+
const distance = primary + Math.abs(horizontal ? box.y - origin.y : box.x - origin.x) * 4;
|
|
32
|
+
if (primary > 1 && distance < nearest) {
|
|
33
|
+
nearest = distance;
|
|
34
|
+
next = cell;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} else return;
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
if (!next) return;
|
|
40
|
+
for (const cell of buttons) cell.tabIndex = cell === next ? 0 : -1;
|
|
41
|
+
next.focus();
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
ref,
|
|
45
|
+
onKeyDown
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { useHeatmapNavigation };
|
package/dist/lib/treemap.js
CHANGED
|
@@ -35,7 +35,12 @@ const DEFAULT_RANGE = .05;
|
|
|
35
35
|
const HEAT_STEPS = 5;
|
|
36
36
|
/** The range the heat scale uses: one that is not a positive number falls back to ±5%. */
|
|
37
37
|
const heatRange = (range = DEFAULT_RANGE) => Number.isFinite(range) && range > 0 ? range : DEFAULT_RANGE;
|
|
38
|
-
const
|
|
38
|
+
const DARK_FLOOR = 25;
|
|
39
|
+
const heatFill = (side, step) => {
|
|
40
|
+
const mix = (share) => `color-mix(in oklab, var(--${side}) ${share}%, var(--card))`;
|
|
41
|
+
const dark = DARK_FLOOR + (step - 1) * 35 / 4;
|
|
42
|
+
return `light-dark(${mix(step * 12)}, ${mix(dark)})`;
|
|
43
|
+
};
|
|
39
44
|
function heat(change, range) {
|
|
40
45
|
if (!change) return "var(--muted)";
|
|
41
46
|
const step = Math.min(5, Math.ceil(Math.abs(change) / heatRange(range) * 5));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
//#region src/lib/use-element-width.d.ts
|
|
3
|
+
/** The element's content width, kept current as it resizes; 0 until it is first measured. */
|
|
4
|
+
export declare function useElementWidth<T extends Element>(): [RefObject<T | null>, number];
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
//#region src/lib/use-element-width.ts
|
|
3
|
+
/** The element's content width, kept current as it resizes; 0 until it is first measured. */
|
|
4
|
+
function useElementWidth() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [width, setWidth] = useState(0);
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
const observer = new ResizeObserver(([entry]) => setWidth(entry?.contentRect.width ?? 0));
|
|
9
|
+
if (ref.current) observer.observe(ref.current);
|
|
10
|
+
return () => observer.disconnect();
|
|
11
|
+
}, []);
|
|
12
|
+
return [ref, width];
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useElementWidth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siyahi/ui",
|
|
3
|
-
"version": "0.1.9-next.
|
|
3
|
+
"version": "0.1.9-next.21",
|
|
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",
|
|
@@ -19,11 +19,13 @@
|
|
|
19
19
|
"directory": "packages/ui"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
+
"agents",
|
|
22
23
|
"dist",
|
|
23
24
|
"styles",
|
|
24
25
|
"report.css",
|
|
25
26
|
"registry.lock.json",
|
|
26
27
|
"README.md",
|
|
28
|
+
"DESIGN.md",
|
|
27
29
|
"LICENSE",
|
|
28
30
|
"THIRD_PARTY_NOTICES.md"
|
|
29
31
|
],
|
|
@@ -32,6 +34,7 @@
|
|
|
32
34
|
"**/*.css"
|
|
33
35
|
],
|
|
34
36
|
"exports": {
|
|
37
|
+
"./agents/*": "./agents/*",
|
|
35
38
|
".": {
|
|
36
39
|
"types": "./dist/index.d.ts",
|
|
37
40
|
"default": "./dist/index.js"
|
package/registry.lock.json
CHANGED
|
@@ -49,6 +49,22 @@
|
|
|
49
49
|
"copied": "2026-10-22",
|
|
50
50
|
"sha256": "9028368f1363732cef765dabad2eca3ba98b608f1e237123b09df701c41c8b5a"
|
|
51
51
|
},
|
|
52
|
+
{
|
|
53
|
+
"file": "src/components/registry/dashboardcn/kpi-row-card.tsx",
|
|
54
|
+
"registry": "@dashboardcn/kpi-row-card",
|
|
55
|
+
"origin": "https://dashboardcn.com/r/kpi-row-card.json",
|
|
56
|
+
"licence": "MIT, Copyright (c) 2026 dashboardcn contributors, https://github.com/NoahGdev/dashboardcn/blob/main/LICENSE",
|
|
57
|
+
"copied": "2026-10-26",
|
|
58
|
+
"sha256": "b49fa95b3efa19086b3df2e3a18f6a0d5a95204951448c5d93fc41c2bdb6326f"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"file": "src/components/registry/dashboardcn/sparkline.tsx",
|
|
62
|
+
"registry": "@dashboardcn/sparkline",
|
|
63
|
+
"origin": "https://dashboardcn.com/r/sparkline.json",
|
|
64
|
+
"licence": "MIT, Copyright (c) 2026 dashboardcn contributors, https://github.com/NoahGdev/dashboardcn/blob/main/LICENSE",
|
|
65
|
+
"copied": "2026-10-26",
|
|
66
|
+
"sha256": "54b43e63d866bcdf8071744df08e87f29385ba60d480ab9ee8aa1fac3eb33d5c"
|
|
67
|
+
},
|
|
52
68
|
{
|
|
53
69
|
"file": "src/components/registry/heatmap/calendar-heatmap.tsx",
|
|
54
70
|
"registry": "@heatmap/calendar-heatmap",
|
package/report.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:root {
|
|
7
7
|
color-scheme: light dark;
|
|
8
8
|
--radius: 0.625rem;
|
|
9
|
-
--background: oklch(
|
|
9
|
+
--background: oklch(0.985 0 0);
|
|
10
10
|
--foreground: oklch(0.145 0 0);
|
|
11
11
|
--card: oklch(1 0 0);
|
|
12
12
|
--card-foreground: oklch(0.145 0 0);
|
|
@@ -23,68 +23,69 @@
|
|
|
23
23
|
--destructive: oklch(0.577 0.245 27.325);
|
|
24
24
|
--border: oklch(0.922 0 0);
|
|
25
25
|
--input: oklch(0.922 0 0);
|
|
26
|
-
--ring: oklch(0.
|
|
26
|
+
--ring: oklch(0.62 0.16 275);
|
|
27
27
|
--positive: oklch(0.527 0.154 150.069);
|
|
28
28
|
--positive-foreground: oklch(0.985 0 0);
|
|
29
29
|
--negative: oklch(0.577 0.245 27.325);
|
|
30
30
|
--negative-foreground: oklch(0.985 0 0);
|
|
31
31
|
--warning: oklch(0.555 0.163 48.998);
|
|
32
32
|
--warning-foreground: oklch(0.985 0 0);
|
|
33
|
-
--link: oklch(0.
|
|
34
|
-
--chart-1: oklch(0.
|
|
35
|
-
--chart-2: oklch(0.
|
|
36
|
-
--chart-3: oklch(0.
|
|
37
|
-
--chart-4: oklch(0.
|
|
38
|
-
--chart-5: oklch(0.
|
|
33
|
+
--link: oklch(0.51 0.2 275);
|
|
34
|
+
--chart-1: oklch(0.4 0.17 275);
|
|
35
|
+
--chart-2: oklch(0.66 0.13 70);
|
|
36
|
+
--chart-3: oklch(0.38 0.13 335);
|
|
37
|
+
--chart-4: oklch(0.66 0.11 235);
|
|
38
|
+
--chart-5: oklch(0.36 0.06 205);
|
|
39
39
|
--sidebar: oklch(0.985 0 0);
|
|
40
40
|
--sidebar-foreground: oklch(0.145 0 0);
|
|
41
41
|
--sidebar-primary: oklch(0.205 0 0);
|
|
42
42
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
43
43
|
--sidebar-accent: oklch(0.97 0 0);
|
|
44
|
-
--sidebar-accent-foreground: oklch(0.
|
|
44
|
+
--sidebar-accent-foreground: oklch(0.45 0.2 275);
|
|
45
45
|
--sidebar-border: oklch(0.922 0 0);
|
|
46
|
-
--sidebar-ring: oklch(0.
|
|
46
|
+
--sidebar-ring: oklch(0.62 0.16 275);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
@media (prefers-color-scheme: dark) {
|
|
50
50
|
:root {
|
|
51
|
-
--background: oklch(0.
|
|
52
|
-
--foreground: oklch(0.
|
|
53
|
-
--card: oklch(0.
|
|
54
|
-
--card-foreground: oklch(0.
|
|
55
|
-
--popover: oklch(0.
|
|
56
|
-
--popover-foreground: oklch(0.
|
|
51
|
+
--background: oklch(0.14 0 0);
|
|
52
|
+
--foreground: oklch(0.922 0 0);
|
|
53
|
+
--card: oklch(0.215 0 0);
|
|
54
|
+
--card-foreground: oklch(0.922 0 0);
|
|
55
|
+
--popover: oklch(0.215 0 0);
|
|
56
|
+
--popover-foreground: oklch(0.922 0 0);
|
|
57
57
|
--primary: oklch(0.922 0 0);
|
|
58
58
|
--primary-foreground: oklch(0.205 0 0);
|
|
59
59
|
--secondary: oklch(0.269 0 0);
|
|
60
|
-
--secondary-foreground: oklch(0.
|
|
60
|
+
--secondary-foreground: oklch(0.922 0 0);
|
|
61
61
|
--muted: oklch(0.269 0 0);
|
|
62
|
-
--muted-foreground: oklch(0.
|
|
62
|
+
--muted-foreground: oklch(0.74 0 0);
|
|
63
63
|
--accent: oklch(0.269 0 0);
|
|
64
|
-
--accent-foreground: oklch(0.
|
|
64
|
+
--accent-foreground: oklch(0.922 0 0);
|
|
65
65
|
--destructive: oklch(0.704 0.191 22.216);
|
|
66
66
|
--border: oklch(1 0 0 / 10%);
|
|
67
67
|
--input: oklch(1 0 0 / 15%);
|
|
68
|
-
--ring: oklch(0.
|
|
69
|
-
--positive: oklch(0.
|
|
68
|
+
--ring: oklch(0.6 0.14 275);
|
|
69
|
+
--positive: oklch(0.74 0.16 151.711);
|
|
70
70
|
--positive-foreground: oklch(0.145 0 0);
|
|
71
71
|
--negative: oklch(0.704 0.191 22.216);
|
|
72
72
|
--negative-foreground: oklch(0.145 0 0);
|
|
73
73
|
--warning: oklch(0.828 0.189 84.429);
|
|
74
74
|
--warning-foreground: oklch(0.145 0 0);
|
|
75
|
-
--link: oklch(0.
|
|
76
|
-
--chart-1: oklch(0.
|
|
77
|
-
--chart-2: oklch(0.
|
|
78
|
-
--chart-3: oklch(0.
|
|
79
|
-
--chart-4: oklch(0.
|
|
80
|
-
--chart-5: oklch(0.
|
|
81
|
-
--sidebar: oklch(0.
|
|
82
|
-
--sidebar-foreground: oklch(0.
|
|
83
|
-
--sidebar-primary: oklch(0.
|
|
75
|
+
--link: oklch(0.75 0.13 275);
|
|
76
|
+
--chart-1: oklch(0.58 0.2 275);
|
|
77
|
+
--chart-2: oklch(0.88 0.08 75);
|
|
78
|
+
--chart-3: oklch(0.58 0.16 335);
|
|
79
|
+
--chart-4: oklch(0.88 0.05 235);
|
|
80
|
+
--chart-5: oklch(0.56 0.08 205);
|
|
81
|
+
--sidebar: oklch(0.145 0 0);
|
|
82
|
+
--sidebar-foreground: oklch(0.922 0 0);
|
|
83
|
+
--sidebar-primary: oklch(0.922 0 0);
|
|
84
|
+
--sidebar-primary-foreground: oklch(0.205 0 0);
|
|
84
85
|
--sidebar-accent: oklch(0.269 0 0);
|
|
85
|
-
--sidebar-accent-foreground: oklch(0.
|
|
86
|
+
--sidebar-accent-foreground: oklch(0.8 0.1 275);
|
|
86
87
|
--sidebar-border: oklch(1 0 0 / 10%);
|
|
87
|
-
--sidebar-ring: oklch(0.
|
|
88
|
+
--sidebar-ring: oklch(0.6 0.14 275);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
|