@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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AreaChartCard, BarChartCard, LineChartCard, PanelGrid, useFormat, type ChartSeries } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// Month-end growth of five funds; November and December are a forecast.
|
|
4
|
+
const growth = [
|
|
5
|
+
{ month: "May", nifty: 0, flexi: 0, gold: 0, debt: 0, small: 0 },
|
|
6
|
+
{ month: "Jun", nifty: 0.025, flexi: 0.018, gold: 0.041, debt: 0.006, small: 0.034 },
|
|
7
|
+
{ month: "Jul", nifty: 0.061, flexi: 0.049, gold: 0.072, debt: 0.013, small: 0.012 },
|
|
8
|
+
{ month: "Aug", nifty: 0.047, flexi: 0.058, gold: 0.118, debt: 0.02, small: -0.041 },
|
|
9
|
+
{ month: "Sep", nifty: 0.11, flexi: 0.094, gold: 0.153, debt: 0.027, small: -0.018 },
|
|
10
|
+
{ month: "Oct", nifty: 0.156, flexi: 0.141, gold: 0.196, debt: 0.034, small: -0.052 },
|
|
11
|
+
{ month: "Nov", nifty: 0.177, flexi: 0.166, gold: 0.221, debt: 0.043, small: -0.04 },
|
|
12
|
+
{ month: "Dec", nifty: 0.202, flexi: 0.189, gold: 0.245, debt: 0.052, small: -0.031 },
|
|
13
|
+
];
|
|
14
|
+
const funds: ChartSeries<(typeof growth)[number]> = [
|
|
15
|
+
{ key: "nifty", label: "Nifty 50", color: "var(--chart-1)" },
|
|
16
|
+
{ key: "flexi", label: "Flexi cap", color: "var(--chart-2)" },
|
|
17
|
+
{ key: "gold", label: "Gold", color: "var(--chart-3)" },
|
|
18
|
+
{ key: "debt", label: "Debt", color: "var(--chart-4)" },
|
|
19
|
+
{ key: "small", label: "Small cap", color: "var(--chart-5)" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const value = [
|
|
23
|
+
{ month: "May", equity: 2150000, debt: 600000, gold: 320000, intl: 390000, cash: 150000 },
|
|
24
|
+
{ month: "Jun", equity: 2230000, debt: 612000, gold: 334000, intl: 402000, cash: 160000 },
|
|
25
|
+
{ month: "Jul", equity: 2390000, debt: 625000, gold: 352000, intl: 421000, cash: 172000 },
|
|
26
|
+
{ month: "Aug", equity: 2310000, debt: 637000, gold: 371000, intl: 447000, cash: 185000 },
|
|
27
|
+
{ month: "Sep", equity: 2620000, debt: 648000, gold: 390000, intl: 462000, cash: 198000 },
|
|
28
|
+
{ month: "Oct", equity: 2800000, debt: 655000, gold: 410500, intl: 486300, cash: 212000 },
|
|
29
|
+
];
|
|
30
|
+
const added = [
|
|
31
|
+
{ quarter: "Q1", equity: 180000, debt: 60000, gold: 20000, intl: 40000, cash: 25000 },
|
|
32
|
+
{ quarter: "Q2", equity: 220000, debt: 40000, gold: 45000, intl: 35000, cash: 15000 },
|
|
33
|
+
{ quarter: "Q3", equity: 150000, debt: 80000, gold: 30000, intl: 55000, cash: 30000 },
|
|
34
|
+
{ quarter: "Q4", equity: 260000, debt: 50000, gold: 60000, intl: 70000, cash: 20000 },
|
|
35
|
+
];
|
|
36
|
+
const kinds = [
|
|
37
|
+
{ key: "equity", label: "Equity", color: "var(--chart-1)" },
|
|
38
|
+
{ key: "debt", label: "Debt", color: "var(--chart-2)" },
|
|
39
|
+
{ key: "gold", label: "Gold", color: "var(--chart-3)" },
|
|
40
|
+
{ key: "intl", label: "International", color: "var(--chart-4)" },
|
|
41
|
+
{ key: "cash", label: "Cash", color: "var(--chart-5)" },
|
|
42
|
+
] as const;
|
|
43
|
+
|
|
44
|
+
// Four charts in a PanelGrid: lines named at their ends, a forecast after today, overlapping areas as lines, and bars
|
|
45
|
+
// as tints inside full-colour edges, grouped and stacked.
|
|
46
|
+
export default function ChartPanelsExample() {
|
|
47
|
+
const { pct, money, moneyCompact } = useFormat();
|
|
48
|
+
return (
|
|
49
|
+
<PanelGrid>
|
|
50
|
+
<LineChartCard
|
|
51
|
+
title="Growth by fund"
|
|
52
|
+
description="Since May, month-end; November and December are a forecast"
|
|
53
|
+
data={growth}
|
|
54
|
+
xKey="month"
|
|
55
|
+
series={funds}
|
|
56
|
+
today="Oct"
|
|
57
|
+
forecastFrom="Oct"
|
|
58
|
+
valueFormatter={pct}
|
|
59
|
+
height={256}
|
|
60
|
+
/>
|
|
61
|
+
<AreaChartCard
|
|
62
|
+
title="Value by kind"
|
|
63
|
+
description="Month-end value of each kind of holding"
|
|
64
|
+
data={value}
|
|
65
|
+
xKey="month"
|
|
66
|
+
series={kinds}
|
|
67
|
+
valueFormatter={money}
|
|
68
|
+
yTickFormatter={moneyCompact}
|
|
69
|
+
height={256}
|
|
70
|
+
/>
|
|
71
|
+
<BarChartCard
|
|
72
|
+
title="Money added by kind and quarter"
|
|
73
|
+
description="Side by side"
|
|
74
|
+
data={added}
|
|
75
|
+
xKey="quarter"
|
|
76
|
+
series={kinds}
|
|
77
|
+
valueFormatter={money}
|
|
78
|
+
yTickFormatter={moneyCompact}
|
|
79
|
+
height={256}
|
|
80
|
+
/>
|
|
81
|
+
<BarChartCard
|
|
82
|
+
title="Money added by kind and quarter"
|
|
83
|
+
description="Stacked into the quarter's total"
|
|
84
|
+
data={added}
|
|
85
|
+
xKey="quarter"
|
|
86
|
+
series={kinds}
|
|
87
|
+
stacked
|
|
88
|
+
valueFormatter={money}
|
|
89
|
+
yTickFormatter={moneyCompact}
|
|
90
|
+
height={256}
|
|
91
|
+
/>
|
|
92
|
+
</PanelGrid>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CodeBlock,
|
|
3
|
+
CodeBlockActions,
|
|
4
|
+
CodeBlockContent,
|
|
5
|
+
CodeBlockCopyButton,
|
|
6
|
+
CodeBlockHeader,
|
|
7
|
+
CodeBlockTitle,
|
|
8
|
+
} from "@siyahi/ui";
|
|
9
|
+
|
|
10
|
+
const CHECK = "openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null";
|
|
11
|
+
|
|
12
|
+
const LOG = Array.from(
|
|
13
|
+
{ length: 24 },
|
|
14
|
+
(_, i) =>
|
|
15
|
+
`19:${String(33 + Math.floor(i / 4)).padStart(2, "0")}:${String((i * 15) % 60).padStart(2, "0")} memory.pressure some avg10=${(12 + i * 3.1).toFixed(2)}`,
|
|
16
|
+
).join("\n");
|
|
17
|
+
|
|
18
|
+
export default function CodeBlockExample() {
|
|
19
|
+
return (
|
|
20
|
+
<div className="flex flex-col gap-4">
|
|
21
|
+
<CodeBlock>
|
|
22
|
+
<CodeBlockHeader>
|
|
23
|
+
<CodeBlockTitle>Show the chain a server sends</CodeBlockTitle>
|
|
24
|
+
<CodeBlockActions>
|
|
25
|
+
<CodeBlockCopyButton value={CHECK} />
|
|
26
|
+
</CodeBlockActions>
|
|
27
|
+
</CodeBlockHeader>
|
|
28
|
+
<CodeBlockContent wrap>{CHECK}</CodeBlockContent>
|
|
29
|
+
</CodeBlock>
|
|
30
|
+
<CodeBlock size="sm">
|
|
31
|
+
<CodeBlockHeader>
|
|
32
|
+
<CodeBlockActions>
|
|
33
|
+
<CodeBlockCopyButton value={LOG} />
|
|
34
|
+
</CodeBlockActions>
|
|
35
|
+
</CodeBlockHeader>
|
|
36
|
+
<CodeBlockContent className="max-h-48">{LOG}</CodeBlockContent>
|
|
37
|
+
</CodeBlock>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from "@siyahi/ui";
|
|
2
|
+
import { ChevronsUpDownIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function CollapsibleExample() {
|
|
5
|
+
return (
|
|
6
|
+
<Collapsible className="flex max-w-sm flex-col gap-2">
|
|
7
|
+
<CollapsibleTrigger render={<Button variant="outline" className="w-fit" />}>
|
|
8
|
+
<ChevronsUpDownIcon />
|
|
9
|
+
How refunds are counted
|
|
10
|
+
</CollapsibleTrigger>
|
|
11
|
+
<CollapsibleContent>
|
|
12
|
+
<p className="text-muted-foreground">
|
|
13
|
+
A refund comes off the month the order was placed in, not the month it was paid.
|
|
14
|
+
</p>
|
|
15
|
+
</CollapsibleContent>
|
|
16
|
+
</Collapsible>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@siyahi/ui";
|
|
2
|
+
import { ChartLineIcon, PackageIcon, UsersIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function CommandExample() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="overflow-hidden rounded-lg border">
|
|
7
|
+
<Command>
|
|
8
|
+
<CommandInput placeholder="Jump to a page" />
|
|
9
|
+
<CommandList>
|
|
10
|
+
<CommandEmpty>No page matches.</CommandEmpty>
|
|
11
|
+
<CommandGroup heading="Pages">
|
|
12
|
+
<CommandItem>
|
|
13
|
+
<PackageIcon />
|
|
14
|
+
Orders
|
|
15
|
+
</CommandItem>
|
|
16
|
+
<CommandItem>
|
|
17
|
+
<ChartLineIcon />
|
|
18
|
+
Revenue
|
|
19
|
+
</CommandItem>
|
|
20
|
+
<CommandItem>
|
|
21
|
+
<UsersIcon />
|
|
22
|
+
Customers
|
|
23
|
+
</CommandItem>
|
|
24
|
+
</CommandGroup>
|
|
25
|
+
</CommandList>
|
|
26
|
+
</Command>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function ContextMenuExample() {
|
|
4
|
+
return (
|
|
5
|
+
<ContextMenu>
|
|
6
|
+
<ContextMenuTrigger className="w-full">
|
|
7
|
+
<div className="flex h-24 items-center justify-center rounded-lg border border-dashed text-muted-foreground">
|
|
8
|
+
Right-click or long-press here
|
|
9
|
+
</div>
|
|
10
|
+
</ContextMenuTrigger>
|
|
11
|
+
<ContextMenuContent>
|
|
12
|
+
<ContextMenuItem>Copy order number</ContextMenuItem>
|
|
13
|
+
<ContextMenuItem>Open order</ContextMenuItem>
|
|
14
|
+
</ContextMenuContent>
|
|
15
|
+
</ContextMenu>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CopyButton } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// Every command on a setup page, for a reader who wants them all at once.
|
|
4
|
+
const ALL = ["brew install node@24", "corepack enable", "pnpm install"].join("\n");
|
|
5
|
+
|
|
6
|
+
export default function CopyButtonExample() {
|
|
7
|
+
return <CopyButton value={ALL} label="Copy all" />;
|
|
8
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
DataBar,
|
|
8
|
+
DataTable,
|
|
9
|
+
DataTableBody,
|
|
10
|
+
DataTableHeader,
|
|
11
|
+
DataTableRoot,
|
|
12
|
+
DataTableSortHeader,
|
|
13
|
+
Sparkline,
|
|
14
|
+
useFormat,
|
|
15
|
+
type DataTableColumnDef,
|
|
16
|
+
} from "@siyahi/ui";
|
|
17
|
+
|
|
18
|
+
interface Store {
|
|
19
|
+
store: string;
|
|
20
|
+
/** This month's sales, and their change on last month, in rupees; made-up figures. */
|
|
21
|
+
sales: number;
|
|
22
|
+
change: number;
|
|
23
|
+
/** Orders on each of the last ten days, oldest first. */
|
|
24
|
+
daily: number[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const stores: Store[] = [
|
|
28
|
+
{ store: "Delhi", sales: 276000, change: -18400, daily: [478, 474, 470, 471, 466, 463, 465, 461, 459, 460] },
|
|
29
|
+
{ store: "Bengaluru", sales: 262500, change: 21300, daily: [312, 318, 326, 320, 331, 344, 339, 348, 352, 350] },
|
|
30
|
+
{ store: "Chennai", sales: 258000, change: 44100, daily: [250, 262, 258, 271, 266, 280, 284, 279, 288, 290] },
|
|
31
|
+
{ store: "Kolkata", sales: 255600, change: 12800, daily: [281, 282, 280, 283, 284, 283, 285, 284, 286, 284] },
|
|
32
|
+
{ store: "Mumbai", sales: 224400, change: 30900, daily: [220, 234, 229, 241, 252, 248, 260, 255, 266, 270] },
|
|
33
|
+
{ store: "Pune", sales: 166000, change: -2600, daily: [180, 172, 165, 170, 158, 150, 161, 155, 148, 150] },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
// Each bar is a share of its column's largest figure, so the rows draw to one scale.
|
|
37
|
+
const largestSales = Math.max(...stores.map((s) => s.sales));
|
|
38
|
+
const largestChange = Math.max(...stores.map((s) => Math.abs(s.change)));
|
|
39
|
+
|
|
40
|
+
function Money({ amount }: { amount: number }) {
|
|
41
|
+
return useFormat().money(amount);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const header = () => <DataTableSortHeader />;
|
|
45
|
+
|
|
46
|
+
const columns: DataTableColumnDef<Store>[] = [
|
|
47
|
+
{ accessorKey: "store", header, size: 120, meta: { label: "Store" } },
|
|
48
|
+
{
|
|
49
|
+
accessorKey: "sales",
|
|
50
|
+
header,
|
|
51
|
+
size: 170,
|
|
52
|
+
meta: { label: "Sales", variant: "number" },
|
|
53
|
+
cell: ({ row }) => (
|
|
54
|
+
<DataBar value={row.original.sales} max={largestSales}>
|
|
55
|
+
<Money amount={row.original.sales} />
|
|
56
|
+
</DataBar>
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
accessorKey: "change",
|
|
61
|
+
header,
|
|
62
|
+
size: 170,
|
|
63
|
+
meta: { label: "vs last month", variant: "number" },
|
|
64
|
+
cell: ({ row }) => (
|
|
65
|
+
<DataBar value={row.original.change} max={largestChange} tone="sign">
|
|
66
|
+
<Money amount={row.original.change} />
|
|
67
|
+
</DataBar>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "daily",
|
|
72
|
+
header: "10 days",
|
|
73
|
+
size: 110,
|
|
74
|
+
enableSorting: false,
|
|
75
|
+
cell: ({ row }) => {
|
|
76
|
+
const { daily } = row.original;
|
|
77
|
+
const rising = (daily.at(-1) ?? 0) >= (daily[0] ?? 0);
|
|
78
|
+
return (
|
|
79
|
+
<Sparkline
|
|
80
|
+
data={daily}
|
|
81
|
+
variant="line"
|
|
82
|
+
color={rising ? "var(--positive)" : "var(--negative)"}
|
|
83
|
+
animate={false}
|
|
84
|
+
className="h-5 w-20"
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
export default function DataBarExample() {
|
|
92
|
+
return (
|
|
93
|
+
<Card>
|
|
94
|
+
<CardHeader>
|
|
95
|
+
<CardTitle>Stores</CardTitle>
|
|
96
|
+
<CardDescription>Bars give each figure's size against the column's largest</CardDescription>
|
|
97
|
+
</CardHeader>
|
|
98
|
+
<CardContent>
|
|
99
|
+
<DataTableRoot data={stores} columns={columns} initialState={{ columnPinning: { start: ["store"], end: [] } }}>
|
|
100
|
+
<DataTable>
|
|
101
|
+
<DataTableHeader />
|
|
102
|
+
<DataTableBody />
|
|
103
|
+
</DataTable>
|
|
104
|
+
</DataTableRoot>
|
|
105
|
+
</CardContent>
|
|
106
|
+
</Card>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
DataTable,
|
|
8
|
+
DataTableBody,
|
|
9
|
+
DataTableCompactColumnsToggle,
|
|
10
|
+
DataTableHeader,
|
|
11
|
+
DataTableRoot,
|
|
12
|
+
DataTableRowCount,
|
|
13
|
+
DataTableSortHeader,
|
|
14
|
+
DataTableToolbarSection,
|
|
15
|
+
Delta,
|
|
16
|
+
useDataTable,
|
|
17
|
+
useFormat,
|
|
18
|
+
type DataTableColumnDef,
|
|
19
|
+
} from "@siyahi/ui";
|
|
20
|
+
|
|
21
|
+
interface Product {
|
|
22
|
+
product: string;
|
|
23
|
+
category: string;
|
|
24
|
+
/** Units sold and revenue this month; change is the revenue against last week. Made-up figures. */
|
|
25
|
+
units: number;
|
|
26
|
+
revenue: number;
|
|
27
|
+
change: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const products: Product[] = [
|
|
31
|
+
{ product: "Standing desk", category: "Furniture", units: 120, revenue: 224400, change: 0.018 },
|
|
32
|
+
{ product: "Office chair", category: "Seating", units: 150, revenue: 262500, change: -0.006 },
|
|
33
|
+
{ product: "Bookshelf", category: "Furniture", units: 40, revenue: 166000, change: 0.004 },
|
|
34
|
+
{ product: "Dinner set", category: "Kitchen, Dining & Tableware", units: 600, revenue: 276000, change: -0.012 },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const header = () => <DataTableSortHeader />;
|
|
38
|
+
|
|
39
|
+
// While the Week column is hidden to fit, the week's change rides under the revenue it belongs to.
|
|
40
|
+
function RevenueCell({ product }: { product: Product }) {
|
|
41
|
+
const format = useFormat();
|
|
42
|
+
const { compactColumns } = useDataTable<Product>();
|
|
43
|
+
if (!compactColumns?.hidden.has("change")) return format.money(product.revenue);
|
|
44
|
+
return (
|
|
45
|
+
<div className="flex flex-col items-end">
|
|
46
|
+
{format.money(product.revenue)}
|
|
47
|
+
<Delta value={product.change} />
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const columns: DataTableColumnDef<Product>[] = [
|
|
53
|
+
{ accessorKey: "product", header, size: 140, meta: { label: "Product", compact: true } },
|
|
54
|
+
{ accessorKey: "category", header, size: 120, meta: { label: "Category" } },
|
|
55
|
+
{ accessorKey: "units", header, size: 100, meta: { label: "Units", variant: "number" } },
|
|
56
|
+
{
|
|
57
|
+
accessorKey: "revenue",
|
|
58
|
+
header,
|
|
59
|
+
size: 140,
|
|
60
|
+
meta: { label: "Revenue", variant: "number", compact: true },
|
|
61
|
+
cell: ({ row }) => <RevenueCell product={row.original} />,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
accessorKey: "change",
|
|
65
|
+
header,
|
|
66
|
+
size: 110,
|
|
67
|
+
meta: { label: "Week", variant: "number" },
|
|
68
|
+
cell: ({ row }) => <Delta value={row.original.change} />,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export default function DataTableCompactExample() {
|
|
73
|
+
return (
|
|
74
|
+
<Card>
|
|
75
|
+
<CardHeader>
|
|
76
|
+
<CardTitle>Products on a phone</CardTitle>
|
|
77
|
+
<CardDescription>
|
|
78
|
+
Product and revenue are the key columns. When the columns do not fit, the others hide from the right, and the
|
|
79
|
+
week's change rides under the revenue once its column is gone; All columns brings back the rest
|
|
80
|
+
</CardDescription>
|
|
81
|
+
</CardHeader>
|
|
82
|
+
<CardContent>
|
|
83
|
+
<DataTableRoot data={products} columns={columns}>
|
|
84
|
+
<DataTableToolbarSection>
|
|
85
|
+
<DataTableCompactColumnsToggle />
|
|
86
|
+
<DataTableRowCount unit="products" />
|
|
87
|
+
</DataTableToolbarSection>
|
|
88
|
+
<DataTable aria-label="Products on a phone">
|
|
89
|
+
<DataTableHeader />
|
|
90
|
+
<DataTableBody />
|
|
91
|
+
</DataTable>
|
|
92
|
+
</DataTableRoot>
|
|
93
|
+
</CardContent>
|
|
94
|
+
</Card>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Card,
|
|
4
|
+
CardContent,
|
|
5
|
+
CardDescription,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
DataTable,
|
|
9
|
+
DataTableBody,
|
|
10
|
+
DataTableFacetedFilter,
|
|
11
|
+
DataTableHeader,
|
|
12
|
+
DataTableRoot,
|
|
13
|
+
DataTableRowCount,
|
|
14
|
+
DataTableSearchFilter,
|
|
15
|
+
DataTableSortHeader,
|
|
16
|
+
DataTableToolbarSection,
|
|
17
|
+
Sheet,
|
|
18
|
+
SheetClose,
|
|
19
|
+
SheetContent,
|
|
20
|
+
SheetDescription,
|
|
21
|
+
SheetFooter,
|
|
22
|
+
SheetHeader,
|
|
23
|
+
SheetTitle,
|
|
24
|
+
SheetTrigger,
|
|
25
|
+
useDataTable,
|
|
26
|
+
type DataTableColumnDef,
|
|
27
|
+
} from "@siyahi/ui";
|
|
28
|
+
|
|
29
|
+
interface Order {
|
|
30
|
+
order: string;
|
|
31
|
+
status: string;
|
|
32
|
+
warehouse: string;
|
|
33
|
+
}
|
|
34
|
+
const data: Order[] = [
|
|
35
|
+
{ order: "ORD-1042", status: "Out for delivery", warehouse: "Bhiwandi" },
|
|
36
|
+
{ order: "ORD-1043", status: "Packed", warehouse: "Hosur" },
|
|
37
|
+
{ order: "ORD-1044", status: "Out for delivery", warehouse: "Hosur" },
|
|
38
|
+
];
|
|
39
|
+
const header = () => <DataTableSortHeader />;
|
|
40
|
+
const columns: DataTableColumnDef<Order>[] = [
|
|
41
|
+
{ accessorKey: "order", header, size: 140, meta: { label: "Order" } },
|
|
42
|
+
{ accessorKey: "status", header, meta: { label: "Status" } },
|
|
43
|
+
{ accessorKey: "warehouse", header, meta: { label: "Warehouse" } },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
function Filters() {
|
|
47
|
+
const { table, isCompact } = useDataTable<Order>();
|
|
48
|
+
const active = table.state.columnFilters.length;
|
|
49
|
+
const controls = (
|
|
50
|
+
<div className="flex flex-wrap gap-2">
|
|
51
|
+
<DataTableFacetedFilter accessorKey="status" title="Status" />
|
|
52
|
+
<DataTableFacetedFilter accessorKey="warehouse" title="Warehouse" />
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
if (!isCompact) return controls;
|
|
56
|
+
return (
|
|
57
|
+
<Sheet>
|
|
58
|
+
<SheetTrigger render={<Button variant="outline" size="sm" />}>Filters{active ? ` (${active})` : ""}</SheetTrigger>
|
|
59
|
+
<SheetContent>
|
|
60
|
+
<SheetHeader>
|
|
61
|
+
<SheetTitle>Order filters</SheetTitle>
|
|
62
|
+
<SheetDescription>Selections stay applied when this panel closes.</SheetDescription>
|
|
63
|
+
</SheetHeader>
|
|
64
|
+
<div className="overflow-y-auto px-4">{controls}</div>
|
|
65
|
+
<SheetFooter>
|
|
66
|
+
<Button variant="outline" disabled={!active} onClick={() => table.resetColumnFilters()}>
|
|
67
|
+
Clear filters
|
|
68
|
+
</Button>
|
|
69
|
+
<SheetClose render={<Button />}>Done</SheetClose>
|
|
70
|
+
</SheetFooter>
|
|
71
|
+
</SheetContent>
|
|
72
|
+
</Sheet>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default function DataTableFiltersExample() {
|
|
77
|
+
return (
|
|
78
|
+
<Card>
|
|
79
|
+
<CardHeader>
|
|
80
|
+
<CardTitle>Orders with compact filters</CardTitle>
|
|
81
|
+
<CardDescription>Search stays visible; secondary filters move into a panel in narrow space.</CardDescription>
|
|
82
|
+
</CardHeader>
|
|
83
|
+
<CardContent>
|
|
84
|
+
{/* The closed filter panel is absent at first render, so configure its features explicitly. */}
|
|
85
|
+
<DataTableRoot data={data} columns={columns} config={{ enableFilters: true, enableSorting: true }}>
|
|
86
|
+
<DataTableToolbarSection>
|
|
87
|
+
<DataTableSearchFilter
|
|
88
|
+
label="Search compact example"
|
|
89
|
+
placeholder="Search orders…"
|
|
90
|
+
className="w-full flex-none sm:w-64"
|
|
91
|
+
/>
|
|
92
|
+
<Filters />
|
|
93
|
+
<DataTableRowCount unit="orders" />
|
|
94
|
+
</DataTableToolbarSection>
|
|
95
|
+
<DataTable aria-label="Orders with compact filters">
|
|
96
|
+
<DataTableHeader />
|
|
97
|
+
<DataTableBody />
|
|
98
|
+
</DataTable>
|
|
99
|
+
</DataTableRoot>
|
|
100
|
+
</CardContent>
|
|
101
|
+
</Card>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
DataTable,
|
|
8
|
+
DataTableBody,
|
|
9
|
+
DataTableFacetedFilter,
|
|
10
|
+
DataTableHeader,
|
|
11
|
+
DataTableRoot,
|
|
12
|
+
DataTableRowCount,
|
|
13
|
+
DataTableSearchFilter,
|
|
14
|
+
DataTableSortHeader,
|
|
15
|
+
DataTableToolbarSection,
|
|
16
|
+
Delta,
|
|
17
|
+
useFormat,
|
|
18
|
+
type DataTableColumnDef,
|
|
19
|
+
} from "@siyahi/ui";
|
|
20
|
+
|
|
21
|
+
interface Product {
|
|
22
|
+
product: string;
|
|
23
|
+
category: string;
|
|
24
|
+
/** Units sold and revenue this month; change is the revenue against last week. Made-up figures. */
|
|
25
|
+
units: number;
|
|
26
|
+
revenue: number;
|
|
27
|
+
change: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const products: Product[] = [
|
|
31
|
+
{ product: "Standing desk", category: "Furniture", units: 120, revenue: 224400, change: 0.018 },
|
|
32
|
+
{ product: "Office chair", category: "Seating", units: 150, revenue: 262500, change: -0.006 },
|
|
33
|
+
{ product: "Bookshelf", category: "Furniture", units: 40, revenue: 166000, change: 0.004 },
|
|
34
|
+
{ product: "Dinner set", category: "Kitchen, Dining & Tableware", units: 600, revenue: 276000, change: -0.012 },
|
|
35
|
+
{ product: "Kids chair", category: "Seating", units: 200, revenue: 258000, change: 0.022 },
|
|
36
|
+
{ product: "Desk lamp", category: "Lighting", units: 900, revenue: 255600, change: 0.009 },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// One click sorts largest (or Z) first; the title comes from meta.label.
|
|
40
|
+
const header = () => <DataTableSortHeader />;
|
|
41
|
+
|
|
42
|
+
function Money({ amount }: { amount: number }) {
|
|
43
|
+
return useFormat().money(amount);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const columns: DataTableColumnDef<Product>[] = [
|
|
47
|
+
{ accessorKey: "product", header, size: 140, meta: { label: "Product" } },
|
|
48
|
+
{ accessorKey: "category", header, size: 120, meta: { label: "Category" } },
|
|
49
|
+
{ accessorKey: "units", header, size: 100, meta: { label: "Units", variant: "number" } },
|
|
50
|
+
{
|
|
51
|
+
accessorKey: "revenue",
|
|
52
|
+
header,
|
|
53
|
+
size: 140,
|
|
54
|
+
meta: { label: "Revenue", variant: "number" },
|
|
55
|
+
cell: ({ row }) => <Money amount={row.original.revenue} />,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
accessorKey: "change",
|
|
59
|
+
header,
|
|
60
|
+
size: 110,
|
|
61
|
+
meta: { label: "Week", variant: "number" },
|
|
62
|
+
cell: ({ row }) => <Delta value={row.original.change} />,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export default function DataTableExample() {
|
|
67
|
+
return (
|
|
68
|
+
<Card>
|
|
69
|
+
<CardHeader>
|
|
70
|
+
<CardTitle>Products</CardTitle>
|
|
71
|
+
<CardDescription>
|
|
72
|
+
Search every column, filter by category, sort any column in one click; the product stays put when the table
|
|
73
|
+
scrolls in wide panels. In narrow panels every column scrolls, leaving room for the figures
|
|
74
|
+
</CardDescription>
|
|
75
|
+
</CardHeader>
|
|
76
|
+
<CardContent>
|
|
77
|
+
<DataTableRoot
|
|
78
|
+
data={products}
|
|
79
|
+
columns={columns}
|
|
80
|
+
initialState={{ columnPinning: { start: ["product"], end: [] } }}
|
|
81
|
+
>
|
|
82
|
+
<DataTableToolbarSection>
|
|
83
|
+
<DataTableSearchFilter
|
|
84
|
+
placeholder="Search products…"
|
|
85
|
+
label="Filter products"
|
|
86
|
+
className="flex-none sm:w-64"
|
|
87
|
+
/>
|
|
88
|
+
<DataTableFacetedFilter accessorKey="category" title="Category" />
|
|
89
|
+
<DataTableRowCount unit="products" />
|
|
90
|
+
</DataTableToolbarSection>
|
|
91
|
+
<DataTable aria-label="Products">
|
|
92
|
+
<DataTableHeader />
|
|
93
|
+
<DataTableBody />
|
|
94
|
+
</DataTable>
|
|
95
|
+
</DataTableRoot>
|
|
96
|
+
</CardContent>
|
|
97
|
+
</Card>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Delta } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function DeltaExample() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex flex-col gap-4">
|
|
6
|
+
<div className="flex flex-wrap items-center gap-6">
|
|
7
|
+
<Delta value={0.0234} />
|
|
8
|
+
<Delta value={-0.0108} />
|
|
9
|
+
<Delta value={0} />
|
|
10
|
+
<Delta value={18250} format="money" />
|
|
11
|
+
<Delta value={-4300} format="money" />
|
|
12
|
+
</div>
|
|
13
|
+
<p>
|
|
14
|
+
Revenue was <Delta value={0.031} /> on last month, and refunds <Delta value={-1200} format="money" />.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogClose,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogFooter,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
DialogTrigger,
|
|
11
|
+
} from "@siyahi/ui";
|
|
12
|
+
|
|
13
|
+
export default function DialogExample() {
|
|
14
|
+
return (
|
|
15
|
+
<Dialog>
|
|
16
|
+
<DialogTrigger render={<Button variant="outline" className="w-fit" />}>Show parcels</DialogTrigger>
|
|
17
|
+
<DialogContent>
|
|
18
|
+
<DialogHeader>
|
|
19
|
+
<DialogTitle>Parcels for this order</DialogTitle>
|
|
20
|
+
<DialogDescription>Each parcel this order was split into, earliest first.</DialogDescription>
|
|
21
|
+
</DialogHeader>
|
|
22
|
+
<DialogFooter>
|
|
23
|
+
<DialogClose render={<Button variant="outline" />}>Close</DialogClose>
|
|
24
|
+
</DialogFooter>
|
|
25
|
+
</DialogContent>
|
|
26
|
+
</Dialog>
|
|
27
|
+
);
|
|
28
|
+
}
|