@siyahi/ui 0.1.9-next.3 → 0.1.9-next.30
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 +170 -0
- package/README.md +94 -177
- package/THIRD_PARTY_NOTICES.md +11 -11
- package/agents/examples/accordion.tsx +39 -0
- package/agents/examples/alert.tsx +24 -0
- package/agents/examples/app-sidebar.tsx +40 -0
- package/agents/examples/avatar.tsx +24 -0
- package/agents/examples/badge.tsx +26 -0
- package/agents/examples/bar-list-labels.tsx +22 -0
- package/agents/examples/bar-list-sides.tsx +40 -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 +11 -0
- package/agents/examples/callout.tsx +33 -0
- package/agents/examples/card.tsx +36 -0
- package/agents/examples/change-bar.tsx +104 -0
- package/agents/examples/change-grid-money.tsx +36 -0
- package/agents/examples/change-grid.tsx +42 -0
- package/agents/examples/chart-area-log.tsx +45 -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-teams.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-forecast.tsx +36 -0
- package/agents/examples/chart-line-log.tsx +39 -0
- package/agents/examples/chart-line-quiet.tsx +114 -0
- package/agents/examples/chart-line-timeline.tsx +41 -0
- package/agents/examples/chart-line.tsx +57 -0
- package/agents/examples/chart-panels.tsx +94 -0
- package/agents/examples/code-block.tsx +40 -0
- package/agents/examples/collapsible.tsx +18 -0
- package/agents/examples/command.tsx +29 -0
- package/agents/examples/context-menu.tsx +17 -0
- package/agents/examples/copy-button.tsx +8 -0
- package/agents/examples/data-bar.tsx +108 -0
- package/agents/examples/data-table-compact.tsx +96 -0
- package/agents/examples/data-table-filters.tsx +103 -0
- package/agents/examples/data-table.tsx +99 -0
- package/agents/examples/delta.tsx +18 -0
- package/agents/examples/dialog.tsx +28 -0
- package/agents/examples/distribution-bar-budget.tsx +30 -0
- package/agents/examples/distribution-bar-tug.tsx +74 -0
- package/agents/examples/drawdown-chart.tsx +35 -0
- package/agents/examples/dropdown-menu.tsx +31 -0
- package/agents/examples/field.tsx +108 -0
- package/agents/examples/formatters.tsx +42 -0
- package/agents/examples/heatmap-calendar-signed.tsx +67 -0
- package/agents/examples/heatmap-calendar.tsx +62 -0
- package/agents/examples/heatmap-status.tsx +61 -0
- package/agents/examples/heatmap-weekday.tsx +72 -0
- package/agents/examples/histogram-chart.tsx +28 -0
- package/agents/examples/input-states.tsx +23 -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 +180 -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 +29 -0
- package/agents/examples/progress.tsx +10 -0
- package/agents/examples/range-position-table.tsx +101 -0
- package/agents/examples/range-position.tsx +55 -0
- package/agents/examples/scatter-chart-quadrants.tsx +63 -0
- package/agents/examples/scatter-chart-scales.tsx +46 -0
- package/agents/examples/scatter-chart.tsx +78 -0
- package/agents/examples/scroll-area.tsx +22 -0
- package/agents/examples/section-cards-select.tsx +28 -0
- package/agents/examples/section-cards-trend.tsx +32 -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/slope-chart-market.tsx +33 -0
- package/agents/examples/slope-chart.tsx +26 -0
- package/agents/examples/stale-blocks.tsx +56 -0
- package/agents/examples/surfaces.tsx +116 -0
- package/agents/examples/table.tsx +60 -0
- package/agents/examples/tabs.tsx +16 -0
- package/agents/examples/target-rows.tsx +74 -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 +93 -0
- package/agents/examples/waterfall-chart-stores.tsx +27 -0
- package/agents/examples/waterfall-chart.tsx +37 -0
- package/agents/manifest.json +1391 -0
- package/agents/report-rules.json +7 -0
- package/dist/components/registry/charts/area-chart-card.d.ts +7 -3
- package/dist/components/registry/charts/area-chart-card.js +56 -10
- package/dist/components/registry/charts/bar-chart-card.d.ts +1 -1
- package/dist/components/registry/charts/bar-chart-card.js +20 -22
- package/dist/components/registry/charts/line-chart-card.d.ts +3 -3
- package/dist/components/registry/charts/line-chart-card.js +44 -9
- package/dist/components/registry/dashboard-01/section-cards.d.ts +6 -0
- package/dist/components/registry/dashboard-01/section-cards.js +51 -35
- package/dist/components/registry/dashboardcn/bar-list.js +17 -10
- package/dist/components/registry/dashboardcn/distribution-bar.js +6 -4
- 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 +11 -3
- package/dist/components/registry/heatmap/calendar-heatmap.js +164 -45
- package/dist/components/registry/heatmap/status-heatmap.d.ts +5 -3
- package/dist/components/registry/heatmap/status-heatmap.js +115 -54
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +9 -3
- package/dist/components/registry/heatmap/weekday-heatmap.js +83 -53
- 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 +5 -5
- 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 +17 -0
- package/dist/components/siyahi/callout.js +34 -0
- package/dist/components/siyahi/change-bar.d.ts +21 -0
- package/dist/components/siyahi/change-bar.js +35 -0
- package/dist/components/siyahi/change-grid.d.ts +31 -0
- package/dist/components/siyahi/change-grid.js +74 -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/delta.d.ts +5 -1
- package/dist/components/siyahi/delta.js +14 -9
- package/dist/components/siyahi/drawdown-chart.d.ts +34 -0
- package/dist/components/siyahi/drawdown-chart.js +102 -0
- package/dist/components/siyahi/histogram-chart.d.ts +57 -0
- package/dist/components/siyahi/histogram-chart.js +134 -0
- package/dist/components/siyahi/page-hero.d.ts +23 -0
- package/dist/components/siyahi/page-hero.js +43 -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 +24 -0
- package/dist/components/siyahi/panel-grid.js +37 -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/scale-toggle.d.ts +32 -0
- package/dist/components/siyahi/scale-toggle.js +61 -0
- package/dist/components/siyahi/scatter-chart.d.ts +69 -0
- package/dist/components/siyahi/scatter-chart.js +395 -0
- package/dist/components/siyahi/siyahi-provider.d.ts +15 -2
- package/dist/components/siyahi/siyahi-provider.js +17 -4
- package/dist/components/siyahi/slope-chart.d.ts +35 -0
- package/dist/components/siyahi/slope-chart.js +159 -0
- package/dist/components/siyahi/stale-note.d.ts +9 -0
- package/dist/components/siyahi/stale-note.js +12 -0
- package/dist/components/siyahi/status-alert.d.ts +15 -0
- package/dist/components/siyahi/status-alert.js +29 -0
- package/dist/components/siyahi/status-badge.d.ts +15 -0
- package/dist/components/siyahi/status-badge.js +24 -0
- package/dist/components/siyahi/target-rows.d.ts +34 -0
- package/dist/components/siyahi/target-rows.js +97 -0
- package/dist/components/siyahi/tone-progress.d.ts +1 -1
- package/dist/components/siyahi/tone-progress.js +1 -1
- package/dist/components/siyahi/treemap.d.ts +8 -5
- package/dist/components/siyahi/treemap.js +80 -34
- package/dist/components/siyahi/waterfall-chart.d.ts +51 -0
- package/dist/components/siyahi/waterfall-chart.js +147 -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/field.d.ts +26 -0
- package/dist/components/ui/field.js +109 -0
- package/dist/components/ui/input-group.js +11 -11
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.js +13 -0
- 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 +35 -8
- package/dist/index.js +30 -4
- package/dist/lib/chart-frame.d.ts +51 -7
- package/dist/lib/chart-frame.js +390 -133
- package/dist/lib/chart-marks.d.ts +83 -0
- package/dist/lib/chart-marks.js +216 -0
- package/dist/lib/chart-series.d.ts +42 -10
- package/dist/lib/compact-columns.d.ts +19 -0
- package/dist/lib/compact-columns.js +55 -0
- package/dist/lib/fit-text.d.ts +6 -0
- package/dist/lib/fit-text.js +11 -0
- package/dist/lib/format.d.ts +8 -3
- package/dist/lib/format.js +55 -17
- package/dist/lib/heat.d.ts +7 -0
- package/dist/lib/heat.js +14 -0
- package/dist/lib/heatmap-navigation.d.ts +8 -0
- package/dist/lib/heatmap-navigation.js +49 -0
- package/dist/lib/scatter.d.ts +88 -0
- package/dist/lib/scatter.js +179 -0
- package/dist/lib/ticks.d.ts +27 -0
- package/dist/lib/ticks.js +67 -0
- package/dist/lib/tone.d.ts +36 -0
- package/dist/lib/tone.js +35 -0
- package/dist/lib/treemap.d.ts +0 -5
- package/dist/lib/treemap.js +1 -11
- package/dist/lib/use-element-width.d.ts +5 -0
- package/dist/lib/use-element-width.js +15 -0
- package/package.json +5 -1
- package/registry.lock.json +16 -0
- package/report.css +63 -47
- package/styles/siyahi.css +708 -55
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Badge } from "../../../ui/badge.js";
|
|
3
3
|
import { Button } from "../../../ui/button.js";
|
|
4
4
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "../../../ui/command.js";
|
|
5
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../../ui/popover.js";
|
|
6
5
|
import { Separator } from "../../../ui/separator.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../ui/popover.js";
|
|
7
7
|
import { cn } from "../../../../lib/utils.js";
|
|
8
8
|
import { FILTER_OPERATORS, FILTER_VARIANTS, JOIN_OPERATORS } from "../lib/constants.js";
|
|
9
9
|
import { Check, PlusCircle, XCircle } from "lucide-react";
|
|
@@ -149,7 +149,7 @@ function TableFacetedFilter({ column, title, options = [], multiple, onValueChan
|
|
|
149
149
|
] })
|
|
150
150
|
]
|
|
151
151
|
}) }), /* @__PURE__ */ jsx(PopoverContent, {
|
|
152
|
-
className: "w-52 p-0",
|
|
152
|
+
className: "w-max min-w-52 max-w-(--available-width) p-0",
|
|
153
153
|
align: "start",
|
|
154
154
|
children: /* @__PURE__ */ jsx(TableFacetedFilterContent, {
|
|
155
155
|
title,
|
|
@@ -177,16 +177,16 @@ function TableFacetedFilterContent({ title, options, selectedValues, onItemSelec
|
|
|
177
177
|
onSelect: () => onItemSelect(option, isSelected),
|
|
178
178
|
children: [
|
|
179
179
|
/* @__PURE__ */ jsx("div", {
|
|
180
|
-
className: cn("mr-2 flex size-4 items-center justify-center rounded-sm border border-primary", isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
|
|
180
|
+
className: cn("mr-2 flex size-4 shrink-0 items-center justify-center rounded-sm border border-primary", isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
|
|
181
181
|
children: /* @__PURE__ */ jsx(Check, { className: "size-4" })
|
|
182
182
|
}),
|
|
183
183
|
option.icon && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 size-4" }),
|
|
184
184
|
/* @__PURE__ */ jsx("span", {
|
|
185
|
-
className: "
|
|
185
|
+
className: "min-w-0 flex-1 whitespace-normal wrap-anywhere",
|
|
186
186
|
children: option.label
|
|
187
187
|
}),
|
|
188
188
|
option.count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
189
|
-
className: "ml-auto font-mono text-xs",
|
|
189
|
+
className: "ml-auto shrink-0 font-mono text-xs",
|
|
190
190
|
children: option.count
|
|
191
191
|
})
|
|
192
192
|
]
|
|
@@ -62,7 +62,7 @@ function TableSearchFilter({ table, className, placeholder = "Search...", label
|
|
|
62
62
|
]);
|
|
63
63
|
const hasValue = currentValue.length > 0;
|
|
64
64
|
return /* @__PURE__ */ jsxs("div", {
|
|
65
|
-
className: cn("relative flex flex-1 items-center", className),
|
|
65
|
+
className: cn("relative flex min-w-0 max-w-full flex-1 items-center", className),
|
|
66
66
|
role: "search",
|
|
67
67
|
children: [
|
|
68
68
|
/* @__PURE__ */ jsx(Search, {
|
|
@@ -26,7 +26,7 @@ import { ColumnSizingState, RowData } from "@tanstack/react-table";
|
|
|
26
26
|
* Returns the set of column ids to render widthless (empty when fill is off or
|
|
27
27
|
* no eligible column exists — the table then sizes to its columns as before).
|
|
28
28
|
*/
|
|
29
|
-
export declare function resolveFlexColumnIds<TData extends RowData>(table: DataTableInstance<TData
|
|
29
|
+
export declare function resolveFlexColumnIds<TData extends RowData>(table: DataTableInstance<TData>, pinningEnabled?: boolean): ReadonlySet<string>;
|
|
30
30
|
/**
|
|
31
31
|
* The width to render for a single column. Centralizes the flex + header-fit
|
|
32
32
|
* rules so the header, body cells, and the min-width lock all agree.
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
* Returns the set of column ids to render widthless (empty when fill is off or
|
|
25
25
|
* no eligible column exists — the table then sizes to its columns as before).
|
|
26
26
|
*/
|
|
27
|
-
function resolveFlexColumnIds(table) {
|
|
27
|
+
function resolveFlexColumnIds(table, pinningEnabled = true) {
|
|
28
28
|
const ids = /* @__PURE__ */ new Set();
|
|
29
29
|
if (!table.options.enableColumnResizing) return ids;
|
|
30
30
|
if (table.options.meta?.disableFlexFill) return ids;
|
|
31
31
|
const leafColumns = table.getVisibleLeafColumns();
|
|
32
32
|
const columnSizing = table.state.columnSizing;
|
|
33
33
|
let hasExplicit = false;
|
|
34
|
-
for (const column of leafColumns) if (column.columnDef.meta?.flex === true && !column.getIsPinned() && columnSizing[column.id] == null) {
|
|
34
|
+
for (const column of leafColumns) if (column.columnDef.meta?.flex === true && !(pinningEnabled && column.getIsPinned()) && columnSizing[column.id] == null) {
|
|
35
35
|
ids.add(column.id);
|
|
36
36
|
hasExplicit = true;
|
|
37
37
|
}
|
|
38
38
|
if (hasExplicit) return ids;
|
|
39
|
-
const auto = leafColumns.find((column) => column.getCanResize() && !column.getIsPinned() && column.columnDef.meta?.flex !== false && columnSizing[column.id] == null);
|
|
39
|
+
const auto = leafColumns.find((column) => column.getCanResize() && !(pinningEnabled && column.getIsPinned()) && column.columnDef.meta?.flex !== false && columnSizing[column.id] == null);
|
|
40
40
|
if (auto) ids.add(auto.id);
|
|
41
41
|
return ids;
|
|
42
42
|
}
|
|
@@ -2,5 +2,5 @@ import { DataTableFeatures } from "./data-table-features.js";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Column, RowData } from "@tanstack/react-table";
|
|
4
4
|
//#region src/components/registry/niko-table/lib/styles.d.ts
|
|
5
|
-
export declare const getCommonPinningStyles: <TData extends RowData>(column: Column<DataTableFeatures, TData>, isHeader?: boolean) => React.CSSProperties;
|
|
5
|
+
export declare const getCommonPinningStyles: <TData extends RowData>(column: Column<DataTableFeatures, TData>, isHeader?: boolean, pinningEnabled?: boolean) => React.CSSProperties;
|
|
6
6
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@tanstack/react-table";
|
|
2
2
|
//#region src/components/registry/niko-table/lib/styles.ts
|
|
3
|
-
const getCommonPinningStyles = (column, isHeader = false) => {
|
|
3
|
+
const getCommonPinningStyles = (column, isHeader = false, pinningEnabled = true) => {
|
|
4
4
|
const isPinned = column.getIsPinned();
|
|
5
|
-
if (!isPinned) return {};
|
|
5
|
+
if (!isPinned || !pinningEnabled) return {};
|
|
6
6
|
const isLeft = isPinned === "start";
|
|
7
7
|
const columnSize = column.getSize();
|
|
8
8
|
return {
|
|
@@ -17,7 +17,7 @@ const getCommonPinningStyles = (column, isHeader = false) => {
|
|
|
17
17
|
flexShrink: 0,
|
|
18
18
|
zIndex: isHeader ? 20 : 10,
|
|
19
19
|
backgroundColor: "var(--card)",
|
|
20
|
-
|
|
20
|
+
boxShadow: isLeft ? "inset -1px 0 0 0 var(--border)" : "inset 1px 0 0 0 var(--border)"
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
//#endregion
|
|
@@ -23,6 +23,15 @@ declare module "@tanstack/react-table" {
|
|
|
23
23
|
* `TableMeta.disableFlexFill`.
|
|
24
24
|
*/
|
|
25
25
|
flex?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Never hide this column to fit. Once any column sets it, a table whose
|
|
28
|
+
* columns do not fit its width hides the others, rightmost first, until
|
|
29
|
+
* they do, and `<DataTableCompactColumnsToggle />` shows them all again.
|
|
30
|
+
* Mark the few a reader needs to answer the table's question: the name and
|
|
31
|
+
* its result. Read `useDataTable().compactColumns?.hidden` in a cell to
|
|
32
|
+
* fold a hidden figure under a kept one.
|
|
33
|
+
*/
|
|
34
|
+
compact?: boolean;
|
|
26
35
|
variant?: FilterVariant;
|
|
27
36
|
options?: Option[];
|
|
28
37
|
range?: [number, number];
|
|
@@ -52,14 +52,14 @@ function TableRow({ className, ...props }) {
|
|
|
52
52
|
function TableHead({ className, ...props }) {
|
|
53
53
|
return /* @__PURE__ */ jsx("th", {
|
|
54
54
|
"data-slot": "table-head",
|
|
55
|
-
className: cn("h-
|
|
55
|
+
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-[2px]", className),
|
|
56
56
|
...props
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
function TableCell({ className, ...props }) {
|
|
60
60
|
return /* @__PURE__ */ jsx("td", {
|
|
61
61
|
"data-slot": "table-cell",
|
|
62
|
-
className: cn("p-
|
|
62
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-[2px]", className),
|
|
63
63
|
...props
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -14,5 +14,5 @@ export interface AppSidebarProps extends React$1.ComponentProps<typeof Sidebar>
|
|
|
14
14
|
projects?: React$1.ComponentProps<typeof NavProjects>["projects"];
|
|
15
15
|
user?: React$1.ComponentProps<typeof NavUser>["user"];
|
|
16
16
|
}
|
|
17
|
-
export declare function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible, ...props }: AppSidebarProps): React$1.JSX.Element;
|
|
17
|
+
export declare function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible, className, ...props }: AppSidebarProps): React$1.JSX.Element;
|
|
18
18
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarRail } from "../../ui/sidebar.js";
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
3
4
|
import { NavMain } from "./nav-main.js";
|
|
4
5
|
import { NavProjects } from "./nav-projects.js";
|
|
5
6
|
import { NavUser } from "./nav-user.js";
|
|
@@ -7,9 +8,10 @@ import { TeamSwitcher } from "./team-switcher.js";
|
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import "react";
|
|
9
10
|
//#region src/components/registry/sidebar-07/app-sidebar.tsx
|
|
10
|
-
function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible = "icon", ...props }) {
|
|
11
|
+
function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible = "icon", className, ...props }) {
|
|
11
12
|
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
12
13
|
collapsible,
|
|
14
|
+
className: cn(collapsible !== "none" && "h-auto", className),
|
|
13
15
|
...props,
|
|
14
16
|
children: [
|
|
15
17
|
(header || teams) && /* @__PURE__ */ jsx(SidebarHeader, { children: header ?? (teams && /* @__PURE__ */ jsx(TeamSwitcher, { teams })) }),
|
|
@@ -4,12 +4,13 @@ export declare function NavMain({ items, label }: {
|
|
|
4
4
|
items: {
|
|
5
5
|
title: string;
|
|
6
6
|
url: string;
|
|
7
|
-
icon
|
|
7
|
+
icon: React.ReactNode;
|
|
8
8
|
isActive?: boolean;
|
|
9
9
|
linkProps?: Omit<React.ComponentProps<"a">, "href">;
|
|
10
10
|
items?: {
|
|
11
11
|
title: string;
|
|
12
12
|
url: string;
|
|
13
|
+
isActive?: boolean;
|
|
13
14
|
}[];
|
|
14
15
|
}[];
|
|
15
16
|
}): import("react").JSX.Element;
|
|
@@ -2,9 +2,11 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../ui/co
|
|
|
2
2
|
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar } from "../../ui/sidebar.js";
|
|
3
3
|
import { ChevronRightIcon } from "lucide-react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
5
6
|
//#region src/components/registry/sidebar-07/nav-main.tsx
|
|
6
7
|
function NavMain({ items, label = "Navigation" }) {
|
|
7
8
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
9
|
+
const [expanded, setExpanded] = useState({});
|
|
8
10
|
const closeDrawer = () => {
|
|
9
11
|
if (isMobile) setOpenMobile(false);
|
|
10
12
|
};
|
|
@@ -19,18 +21,29 @@ function NavMain({ items, label = "Navigation" }) {
|
|
|
19
21
|
onClick: closeDrawer,
|
|
20
22
|
children: [item.icon, /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
21
23
|
}) }, item.title) : /* @__PURE__ */ jsxs(Collapsible, {
|
|
22
|
-
|
|
24
|
+
open: expanded[item.title] ?? !!item.isActive,
|
|
25
|
+
onOpenChange: (open) => setExpanded((previous) => ({
|
|
26
|
+
...previous,
|
|
27
|
+
[item.title]: open
|
|
28
|
+
})),
|
|
23
29
|
className: "group/collapsible",
|
|
24
30
|
render: /* @__PURE__ */ jsx(SidebarMenuItem, {}),
|
|
25
31
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
26
|
-
render: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
32
|
+
render: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
33
|
+
tooltip: item.title,
|
|
34
|
+
isActive: item.isActive && !item.items?.some((subItem) => subItem.isActive)
|
|
35
|
+
}),
|
|
27
36
|
children: [
|
|
28
37
|
item.icon,
|
|
29
38
|
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
30
39
|
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto transition-transform duration-200 group-data-open/collapsible:rotate-90" })
|
|
31
40
|
]
|
|
32
41
|
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
33
|
-
|
|
42
|
+
isActive: subItem.isActive,
|
|
43
|
+
render: /* @__PURE__ */ jsx("a", {
|
|
44
|
+
href: subItem.url,
|
|
45
|
+
"aria-current": subItem.isActive ? "page" : void 0
|
|
46
|
+
}),
|
|
34
47
|
onClick: closeDrawer,
|
|
35
48
|
children: /* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
36
49
|
}) }, subItem.title)) }) })]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Tone } from "../../lib/tone.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
//#region src/components/siyahi/callout.d.ts
|
|
4
|
+
export interface CalloutProps extends Omit<ComponentProps<"aside">, "title"> {
|
|
5
|
+
/** neutral for an aside, accent for a key point, warning for a caution, positive or negative for a gain or a loss. */
|
|
6
|
+
tone?: Tone;
|
|
7
|
+
/** A lucide icon, drawn in the tone's colour. */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A point set apart from the prose: a takeaway, a caveat, a definition. The whole box takes the tone, a faint wash
|
|
13
|
+
* inside a border of the same colour; never a single coloured edge. For a notice that interrupts, use StatusAlert
|
|
14
|
+
* instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Callout({ tone, icon, title, className, children, ...props }: CalloutProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TONES } from "../../lib/tone.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/siyahi/callout.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A point set apart from the prose: a takeaway, a caveat, a definition. The whole box takes the tone, a faint wash
|
|
7
|
+
* inside a border of the same colour; never a single coloured edge. For a notice that interrupts, use StatusAlert
|
|
8
|
+
* instead.
|
|
9
|
+
*/
|
|
10
|
+
function Callout({ tone = "neutral", icon, title, className, children, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
12
|
+
"data-slot": "callout",
|
|
13
|
+
"data-tone": tone,
|
|
14
|
+
className: cn("flex gap-3 rounded-lg border px-4 py-3 text-sm", TONES[tone].box, className),
|
|
15
|
+
...props,
|
|
16
|
+
children: [icon && /* @__PURE__ */ jsx("span", {
|
|
17
|
+
"data-slot": "callout-icon",
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
className: cn("mt-0.5 shrink-0 [&>svg]:size-4", TONES[tone].ink),
|
|
20
|
+
children: icon
|
|
21
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
23
|
+
children: [title && /* @__PURE__ */ jsx("p", {
|
|
24
|
+
className: "font-medium",
|
|
25
|
+
children: title
|
|
26
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: "text-pretty text-muted-foreground [&_strong]:text-foreground",
|
|
28
|
+
children
|
|
29
|
+
})]
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Callout };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DeltaProps } from "./delta.js";
|
|
2
|
+
//#region src/components/siyahi/change-bar.d.ts
|
|
3
|
+
export interface ChangeBarProps {
|
|
4
|
+
/** The signed change, as Delta takes it. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** The column's largest change by size: Math.max(...rows.map((row) => Math.abs(row.change))). */
|
|
7
|
+
max: number;
|
|
8
|
+
/**
|
|
9
|
+
* Draws the bar from a centre line, losses leftward and gains rightward. Pass it when the column holds both signs:
|
|
10
|
+
* rows.some((row) => row.change < 0) && rows.some((row) => row.change > 0).
|
|
11
|
+
*/
|
|
12
|
+
diverging?: boolean;
|
|
13
|
+
format?: DeltaProps["format"];
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A table cell's change as a Delta over a 3px bar whose length is the change's size against the column's largest, so
|
|
18
|
+
* the rows rank by eye. The bar is neutral because it shows size; the Delta above it carries the gain or loss colour.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ChangeBar({ value, max, diverging, format, className }: ChangeBarProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Delta } from "./delta.js";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/siyahi/change-bar.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A table cell's change as a Delta over a 3px bar whose length is the change's size against the column's largest, so
|
|
7
|
+
* the rows rank by eye. The bar is neutral because it shows size; the Delta above it carries the gain or loss colour.
|
|
8
|
+
*/
|
|
9
|
+
function ChangeBar({ value, max, diverging = false, format, className }) {
|
|
10
|
+
const share = max > 0 ? Math.min(1, Math.abs(value) / max) : 0;
|
|
11
|
+
const half = diverging ? 50 : 100;
|
|
12
|
+
const side = diverging && value < 0 ? "right" : "left";
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
"data-slot": "change-bar",
|
|
15
|
+
className: cn("flex w-full flex-col items-end gap-1.5", className),
|
|
16
|
+
children: [/* @__PURE__ */ jsx(Delta, {
|
|
17
|
+
value,
|
|
18
|
+
format,
|
|
19
|
+
className: "font-medium"
|
|
20
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: "relative h-0.75 w-full bg-muted",
|
|
23
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
24
|
+
"data-slot": "change-bar-fill",
|
|
25
|
+
className: "absolute inset-y-0 bg-foreground",
|
|
26
|
+
style: {
|
|
27
|
+
[side]: diverging ? "50%" : 0,
|
|
28
|
+
width: `${share * half}%`
|
|
29
|
+
}
|
|
30
|
+
}), diverging && /* @__PURE__ */ jsx("div", { className: "absolute -inset-y-1 left-1/2 w-px -translate-x-1/2 bg-muted-foreground" })]
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ChangeBar };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/components/siyahi/change-grid.d.ts
|
|
2
|
+
export interface ChangeGridRow {
|
|
3
|
+
label: string;
|
|
4
|
+
/** One figure per column, in column order; null where there is none, such as a month still to come. NaN counts as none. */
|
|
5
|
+
values: readonly (number | null)[];
|
|
6
|
+
/** The row's total as the page works it out: monthly returns compound rather than add. Leave it out for no total. */
|
|
7
|
+
total?: number | null;
|
|
8
|
+
/** Unique key when labels repeat. Defaults to `label`. */
|
|
9
|
+
key?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ChangeGridProps {
|
|
12
|
+
/** The column heads, such as the months of a financial year. */
|
|
13
|
+
columns: readonly string[];
|
|
14
|
+
rows: readonly ChangeGridRow[];
|
|
15
|
+
/** "pct" takes fractions, 0.025 for 2.5%; "money" takes amounts, written short in one unit. */
|
|
16
|
+
format?: "pct" | "money";
|
|
17
|
+
/** The change that takes the deepest tint, as a size. Defaults to the grid's largest, totals aside. */
|
|
18
|
+
range?: number;
|
|
19
|
+
/** Heads the total column, which draws when any row has a total. */
|
|
20
|
+
totalLabel?: string;
|
|
21
|
+
/** Names the table for a screen reader, such as "Monthly sales growth by year". */
|
|
22
|
+
label: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Signed changes laid out rows by columns, such as each month of each year, every cell tinted by its sign and size
|
|
27
|
+
* as a Treemap tile is and written with its sign, with an optional total per row. The figure is always written, so
|
|
28
|
+
* the tint only helps the eye find the large months.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ChangeGrid({ columns, rows, format, range, totalLabel, label, className }: ChangeGridProps): import("react").JSX.Element;
|
|
31
|
+
//#endregion
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../ui/table.js";
|
|
2
|
+
import { useFormat } from "../../lib/format.js";
|
|
3
|
+
import { heat } from "../../lib/heat.js";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/siyahi/change-grid.tsx
|
|
7
|
+
const MINUS = "−";
|
|
8
|
+
/** A figure the grid can draw: anything that is not a finite number, NaN included, is no figure at all. */
|
|
9
|
+
const known = (value) => value != null && Number.isFinite(value) ? value : null;
|
|
10
|
+
/**
|
|
11
|
+
* Signed changes laid out rows by columns, such as each month of each year, every cell tinted by its sign and size
|
|
12
|
+
* as a Treemap tile is and written with its sign, with an optional total per row. The figure is always written, so
|
|
13
|
+
* the tint only helps the eye find the large months.
|
|
14
|
+
*/
|
|
15
|
+
function ChangeGrid({ columns, rows, format = "pct", range, totalLabel = "Total", label, className }) {
|
|
16
|
+
const f = useFormat();
|
|
17
|
+
const sizes = rows.flatMap(({ values }) => values.flatMap((value) => known(value) ?? []).map(Math.abs));
|
|
18
|
+
const deepest = known(range) ?? Math.max(0, ...sizes);
|
|
19
|
+
const write = (value) => {
|
|
20
|
+
if (value === null) return "—";
|
|
21
|
+
const size = format === "money" ? f.moneyCompact(Math.abs(value), deepest) : f.pct(Math.abs(value));
|
|
22
|
+
return `${value > 0 ? "+" : value < 0 ? MINUS : ""}${size}`;
|
|
23
|
+
};
|
|
24
|
+
const totals = rows.some((row) => row.total !== void 0);
|
|
25
|
+
return /* @__PURE__ */ jsxs(Table, {
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
"data-slot": "change-grid",
|
|
28
|
+
className: cn("border-separate border-spacing-0.5", className),
|
|
29
|
+
children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, {
|
|
30
|
+
className: "hover:bg-transparent",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(TableHead, {
|
|
33
|
+
className: "sticky left-0 bg-card",
|
|
34
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "sr-only",
|
|
36
|
+
children: "Row"
|
|
37
|
+
})
|
|
38
|
+
}),
|
|
39
|
+
columns.map((column) => /* @__PURE__ */ jsx(TableHead, {
|
|
40
|
+
className: "text-right",
|
|
41
|
+
children: column
|
|
42
|
+
}, column)),
|
|
43
|
+
totals && /* @__PURE__ */ jsx(TableHead, {
|
|
44
|
+
className: "text-right",
|
|
45
|
+
children: totalLabel
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}) }), /* @__PURE__ */ jsx(TableBody, { children: rows.map((row) => /* @__PURE__ */ jsxs(TableRow, {
|
|
49
|
+
className: "border-0 hover:bg-transparent",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(TableHead, {
|
|
52
|
+
scope: "row",
|
|
53
|
+
className: "sticky left-0 bg-card font-medium",
|
|
54
|
+
children: row.label
|
|
55
|
+
}),
|
|
56
|
+
columns.map((column, index) => {
|
|
57
|
+
const value = known(row.values[index]);
|
|
58
|
+
return /* @__PURE__ */ jsx(TableCell, {
|
|
59
|
+
"data-slot": "change-grid-cell",
|
|
60
|
+
className: cn("rounded-sm text-right font-mono tabular-nums", value === null && "text-muted-foreground"),
|
|
61
|
+
style: { backgroundColor: heat(value, deepest) },
|
|
62
|
+
children: write(value)
|
|
63
|
+
}, column);
|
|
64
|
+
}),
|
|
65
|
+
totals && /* @__PURE__ */ jsx(TableCell, {
|
|
66
|
+
className: "text-right font-mono font-medium tabular-nums",
|
|
67
|
+
children: write(known(row.total))
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}, row.key ?? row.label)) })]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { ChangeGrid };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/siyahi/data-bar.d.ts
|
|
3
|
+
export interface DataBarProps {
|
|
4
|
+
value: number;
|
|
5
|
+
/** The value a full bar stands for, usually the column's largest: Math.max(...rows.map((row) => row.value)). */
|
|
6
|
+
max: number;
|
|
7
|
+
/** "sign" draws a gain in --positive and a loss in --negative; by default every bar is --chart-1. */
|
|
8
|
+
tone?: "chart" | "sign";
|
|
9
|
+
/** The figure, as the page formats it. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A table cell's figure behind a short bar whose length is the figure's share of max, so a column reads as a chart.
|
|
15
|
+
* The bar has a fixed width, so every row draws to the same scale, and sits on the figure's line, so the row
|
|
16
|
+
* keeps its height.
|
|
17
|
+
*/
|
|
18
|
+
export declare function DataBar({ value, max, tone, children, className }: DataBarProps): import("react").JSX.Element;
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/siyahi/data-bar.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A table cell's figure behind a short bar whose length is the figure's share of max, so a column reads as a chart.
|
|
6
|
+
* The bar has a fixed width, so every row draws to the same scale, and sits on the figure's line, so the row
|
|
7
|
+
* keeps its height.
|
|
8
|
+
*/
|
|
9
|
+
function DataBar({ value, max, tone = "chart", children, className }) {
|
|
10
|
+
const share = max > 0 ? Math.min(1, Math.abs(value) / max) : 0;
|
|
11
|
+
const fill = tone === "chart" ? "bg-chart-1" : value < 0 ? "bg-negative" : "bg-positive";
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
"data-slot": "data-bar",
|
|
14
|
+
className: cn("flex items-center gap-2", className),
|
|
15
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: "h-1.5 w-16 shrink-0 overflow-hidden bg-muted",
|
|
18
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: cn("h-full", fill),
|
|
20
|
+
style: { width: `${share * 100}%` }
|
|
21
|
+
})
|
|
22
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "tabular-nums",
|
|
24
|
+
children
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DataBar };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/siyahi/data-table-compact-columns-toggle.d.ts
|
|
2
|
+
/** Renders only while some columns are hidden to fit, or the reader has shown them all. */
|
|
3
|
+
export declare function DataTableCompactColumnsToggle(): import("react").JSX.Element | null;
|
|
4
|
+
//#endregion
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Button } from "../ui/button.js";
|
|
2
|
+
import { useDataTable } from "../registry/niko-table/core/data-table-context.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/siyahi/data-table-compact-columns-toggle.tsx
|
|
5
|
+
/** Renders only while some columns are hidden to fit, or the reader has shown them all. */
|
|
6
|
+
function DataTableCompactColumnsToggle() {
|
|
7
|
+
const { compactColumns } = useDataTable();
|
|
8
|
+
if (!compactColumns) return null;
|
|
9
|
+
const { collapsed, setCollapsed } = compactColumns;
|
|
10
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
11
|
+
variant: "outline",
|
|
12
|
+
size: "sm",
|
|
13
|
+
"aria-pressed": !collapsed,
|
|
14
|
+
onClick: () => setCollapsed(!collapsed),
|
|
15
|
+
children: collapsed ? `All columns (+${compactColumns.hidden.size})` : "Key columns"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DataTableCompactColumnsToggle };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/siyahi/data-table-footnote.d.ts
|
|
3
|
+
export interface DataTableFootnoteProps {
|
|
4
|
+
/** One sentence on how to read the table, such as what each bar measures. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A full-width last row, inside `DataTable` after its body, that explains the table's encoding. On a table wider than
|
|
9
|
+
* its card the note stays put at the card's width while the columns scroll under it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DataTableFootnote({ children }: DataTableFootnoteProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useDataTable } from "../registry/niko-table/core/data-table-context.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
//#region src/components/siyahi/data-table-footnote.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A full-width last row, inside `DataTable` after its body, that explains the table's encoding. On a table wider than
|
|
7
|
+
* its card the note stays put at the card's width while the columns scroll under it.
|
|
8
|
+
*/
|
|
9
|
+
function DataTableFootnote({ children }) {
|
|
10
|
+
const { table, scrollContainer } = useDataTable();
|
|
11
|
+
const [viewport, setViewport] = useState();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!scrollContainer) return;
|
|
14
|
+
const observer = new ResizeObserver(() => setViewport(scrollContainer.clientWidth));
|
|
15
|
+
observer.observe(scrollContainer);
|
|
16
|
+
return () => observer.disconnect();
|
|
17
|
+
}, [scrollContainer]);
|
|
18
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
19
|
+
"data-slot": "data-table-footnote",
|
|
20
|
+
children: /* @__PURE__ */ jsx("tr", {
|
|
21
|
+
className: "border-t",
|
|
22
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
23
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
24
|
+
className: "p-0",
|
|
25
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
26
|
+
className: "sticky left-0 px-2 py-3 text-sm whitespace-normal text-muted-foreground",
|
|
27
|
+
style: { maxWidth: viewport },
|
|
28
|
+
children
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { DataTableFootnote };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/components/siyahi/default-sidebar-open.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* SidebarProvider's `defaultOpen` for an app shell: the reader's last choice, which the provider keeps in the
|
|
4
|
+
* `sidebar_state` cookie, else open — except on a short landscape screen, a phone held sideways, where an open
|
|
5
|
+
* sidebar leaves no room for the page. There it starts as the icon rail.
|
|
6
|
+
*/
|
|
7
|
+
export declare function defaultSidebarOpen(): boolean;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/components/siyahi/default-sidebar-open.ts
|
|
2
|
+
/**
|
|
3
|
+
* SidebarProvider's `defaultOpen` for an app shell: the reader's last choice, which the provider keeps in the
|
|
4
|
+
* `sidebar_state` cookie, else open — except on a short landscape screen, a phone held sideways, where an open
|
|
5
|
+
* sidebar leaves no room for the page. There it starts as the icon rail.
|
|
6
|
+
*/
|
|
7
|
+
function defaultSidebarOpen() {
|
|
8
|
+
const saved = document.cookie.split("; ").find((entry) => entry.startsWith("sidebar_state="))?.slice(14);
|
|
9
|
+
if (saved !== void 0) return saved === "true";
|
|
10
|
+
return !matchMedia("(orientation: landscape) and (max-height: 30rem)").matches;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { defaultSidebarOpen };
|
|
@@ -5,6 +5,10 @@ export interface DeltaProps {
|
|
|
5
5
|
format?: "pct" | "money";
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A signed change: the figure in the surrounding text colour with its sign, and a trend icon in --positive or
|
|
10
|
+
* --negative. The sign and the icon's shape carry the direction, so colour is never the only cue, and a column of
|
|
11
|
+
* changes reads as figures rather than a wall of red and green.
|
|
12
|
+
*/
|
|
9
13
|
export declare function Delta({ value, format, className }: DeltaProps): import("react").JSX.Element;
|
|
10
14
|
//#endregion
|