@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/DESIGN.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Siyahi design guidelines
|
|
2
|
+
|
|
3
|
+
These rules bind every page built on `@siyahi/ui`: The Book, Dash and any other
|
|
4
|
+
app. Agents must follow them when designing or changing UI; a reviewer treats a
|
|
5
|
+
breach as a defect. The catalogue (https://siyahi.jatinbansal.com) shows each
|
|
6
|
+
component; this file says how to use them.
|
|
7
|
+
|
|
8
|
+
## Colour
|
|
9
|
+
|
|
10
|
+
Colour is placed, not spread. A page is neutral greys plus colour that carries
|
|
11
|
+
a meaning:
|
|
12
|
+
|
|
13
|
+
- **Ink indigo** is the accent: links, focus rings, the selected sidebar item,
|
|
14
|
+
the first chart series and an `accent` `Callout`. Buttons, badges and toggles
|
|
15
|
+
stay monochrome.
|
|
16
|
+
- **Green and red** mean a gain and a loss, always with ▲ or ▼ (`Delta`).
|
|
17
|
+
**Amber** means caution. None of them decorates.
|
|
18
|
+
- **Emphasis tints the whole surface.** A caution is `WarningAlert`; a point set
|
|
19
|
+
apart is `Callout` (`neutral`, `accent`, `warning`, `positive`,
|
|
20
|
+
`negative`); a quotation is `Quote`. Each takes a faint wash of its colour
|
|
21
|
+
inside a 1px border of the same colour all round. Large marks follow the same
|
|
22
|
+
rule: gain and loss bars are a tint inside a full-colour edge, not solid
|
|
23
|
+
slabs.
|
|
24
|
+
- **Never a stripe down one side.** Do not mark a notice, card, row or quote
|
|
25
|
+
with a left (or any single-side) coloured border; tint the box or add an
|
|
26
|
+
icon. 1px neutral dividers between columns are separators, not accents, and
|
|
27
|
+
are fine.
|
|
28
|
+
- Categories (a broker, a sector, an asset class) stay neutral: outline badges,
|
|
29
|
+
never a hue each. Ordered buckets (largest 5, next 5, rest) use steps of one
|
|
30
|
+
colour, not separate hues.
|
package/README.md
CHANGED
|
@@ -2,20 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Siyahi
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
light and dark, a few finance components, locale-aware formatters, a lint that
|
|
10
|
-
keeps pages on the theme, and a catalogue site that is the documentation.
|
|
5
|
+
A design system for data-heavy React apps: [shadcn/ui](https://ui.shadcn.com)
|
|
6
|
+
on [Base UI](https://base-ui.com) and Tailwind CSS v4, with a shared theme,
|
|
7
|
+
charts, tables and locale-aware formatters. Components ship in `@siyahi/ui`;
|
|
8
|
+
checks and build helpers ship in `@siyahi/tools`.
|
|
11
9
|
|
|
12
|
-
**
|
|
10
|
+
**[Browse the catalogue](https://siyahi.jatinbansal.com)** for components and live examples.
|
|
11
|
+
|
|
12
|
+
## For agents
|
|
13
|
+
|
|
14
|
+
Install the public [Siyahi skill](https://github.com/jatinbansal1998/siyahi/blob/main/skills/siyahi/SKILL.md):
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx skills add jatinbansal1998/siyahi --skill siyahi --agent claude-code --agent codex
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Read the installed package's `agents/manifest.json` to select components and
|
|
21
|
+
recipes, then only the matching `agents/examples/*.tsx`. Exact prop types are in
|
|
22
|
+
`dist/index.d.ts`. The skill guides reuse and verification; page structure and
|
|
23
|
+
interactions remain yours. No other skill or local Siyahi checkout is required.
|
|
13
24
|
|
|
14
25
|
## Install
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
Releases use the `next` tag until 1.0. Siyahi needs React 19 and Tailwind CSS v4.
|
|
28
|
+
Compile its stylesheet with the Tailwind Vite plugin; a plain CSS import leaves
|
|
29
|
+
components unstyled.
|
|
19
30
|
|
|
20
31
|
```sh
|
|
21
32
|
npm install @siyahi/ui@next tailwindcss @tailwindcss/vite
|
|
@@ -23,7 +34,7 @@ npm install --save-dev @siyahi/tools@next
|
|
|
23
34
|
```
|
|
24
35
|
|
|
25
36
|
```ts
|
|
26
|
-
// vite.config.ts
|
|
37
|
+
// vite.config.ts: add to your existing plugins
|
|
27
38
|
import tailwindcss from "@tailwindcss/vite";
|
|
28
39
|
import { preloadFonts } from "@siyahi/tools/vite";
|
|
29
40
|
export default defineConfig({ plugins: [react(), tailwindcss(), preloadFonts()] });
|
|
@@ -45,198 +56,93 @@ createRoot(root).render(
|
|
|
45
56
|
);
|
|
46
57
|
```
|
|
47
58
|
|
|
48
|
-
`preloadFonts()`
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Geist swaps in. An app that renders its own HTML adds the tags itself, with
|
|
53
|
-
the hashed URLs of `geist-latin-wght-normal.woff2`,
|
|
54
|
-
`geist-latin-ext-wght-normal.woff2` and `geist-mono-latin-wght-normal.woff2`.
|
|
55
|
-
|
|
56
|
-
Everything comes from `@siyahi/ui`: the shadcn components, the registry
|
|
57
|
-
add-ons (chart cards, data table, heatmaps, stat tiles, sidebar) and Siyahi's
|
|
58
|
-
own components. Add `lucide-react` only if your
|
|
59
|
-
own code imports icons. A Next.js app compiles the same stylesheet through
|
|
60
|
-
`@tailwindcss/postcss` instead of the Vite plugin.
|
|
61
|
-
|
|
62
|
-
### Also on GitHub releases
|
|
63
|
-
|
|
64
|
-
Every merge to `main` also attaches both tarballs to a GitHub release
|
|
65
|
-
(`v<version>`, plus a rolling `next`). They are a fallback if npm is unreachable:
|
|
66
|
-
`npm install --allow-remote=root https://github.com/jatinbansal1998/siyahi/releases/download/v<version>/siyahi-ui-<version>.tgz`.
|
|
67
|
-
|
|
68
|
-
## What is in it
|
|
69
|
-
|
|
70
|
-
- **shadcn/ui components** in the `base-luma` style, installed with the shadcn
|
|
71
|
-
CLI and never edited.
|
|
72
|
-
- **Registry add-ons**, copied once with their origin and licence recorded:
|
|
73
|
-
bar, area and line chart cards from shadcn's chart blocks, a data table on
|
|
74
|
-
TanStack Table, calendar, weekday and status heatmaps, a ranked
|
|
75
|
-
bar list, the `SectionCards` stat tile and the `sidebar-07` app shell.
|
|
76
|
-
- **Siyahi components**: `Delta` (a signed figure with ▲ ▼), `PriceChart`
|
|
77
|
-
(TradingView Lightweight Charts in theme colours), `Treemap` (holdings heat
|
|
78
|
-
map; hover or tap a tile for its figures) with `TreemapLegend` (its colour
|
|
79
|
-
scale), `LocalTime` (a time in the configured zone with the viewer's own clock
|
|
80
|
-
in a tooltip), `ToneProgress` (Progress in a meaning colour), the page parts
|
|
81
|
-
`PageSection`, `PageSubheading`, `DataList` and `InlineCode`, the data table
|
|
82
|
-
parts `DataTableSortHeader` (sorts on one click) and `DataTableRowCount`
|
|
83
|
-
("12 of 48"), and `SiyahiProvider`.
|
|
84
|
-
- **Cards and badges as installed**: every `Card`, stat tiles included, keeps
|
|
85
|
-
luma's `rounded-4xl`, `shadow-md` and faint ring. A category (a sector, a
|
|
86
|
-
broker, a unit's kind) is an outline `Badge`: categories stay neutral, and
|
|
87
|
-
colour is left to the four meaning colours and the charts. On a narrow card
|
|
88
|
-
(header under 24rem, so any phone) a header action such as a toggle drops
|
|
89
|
-
under the title and description, left-aligned; a stat tile's badge stays
|
|
90
|
-
top right.
|
|
91
|
-
- **Formatters**: `count`, `money`, `moneyCompact`, `pct` and `time`, or `useFormat()`
|
|
92
|
-
for the same bound to the provider's locale.
|
|
93
|
-
`useFormat().time(value, { withDate: true })` (or
|
|
94
|
-
`time(value, locale, { withDate: true })`) and `<LocalTime withDate>` write
|
|
95
|
-
the date first: `20 Oct 2026, 14:30 IST`.
|
|
96
|
-
- **`report.css`** for static HTML reports that do not use React: the theme as
|
|
97
|
-
plain CSS variables plus base body styles, with no network requests.
|
|
98
|
-
|
|
99
|
-
## Which component
|
|
100
|
-
|
|
101
|
-
| Need | Component |
|
|
102
|
-
| ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
103
|
-
| Values over time or another ordered axis (months, hours, price buckets) | `BarChartCard`, `AreaChartCard` or `LineChartCard` |
|
|
104
|
-
| Counts or amounts per period, one series or several | `BarChartCard`; `stacked` when the series add up to a total |
|
|
105
|
-
| A running level, such as a portfolio's value against money put in | `AreaChartCard` |
|
|
106
|
-
| Series compared point by point, such as a return against an index | `LineChartCard` |
|
|
107
|
-
| Samples in time with limits and events marked | `LineChartCard` with `xDomain`, `xTicks` and `referenceLines` |
|
|
108
|
-
| Long category names, such as sectors | `BarChartCard` with `horizontal` |
|
|
109
|
-
| A gain above zero and a loss below it | a series with `color` and `negativeColor` |
|
|
110
|
-
| Ranked counts or amounts by category (a name, a bar and a figure) | `BarList`; give two lists one `max` to share a scale |
|
|
111
|
-
| Where a budget sits, a split of a whole, or losses against gains | `DistributionBar` |
|
|
112
|
-
| Headline figures with their change | `SectionCards`, with a `Delta` in each badge |
|
|
113
|
-
| One instrument's price history | `PriceChart` |
|
|
114
|
-
| Holdings sized by weight and coloured by change | `Treemap` |
|
|
115
|
-
| Activity by day, by weekday and hour, or a status over time | `CalendarHeatmap`, `WeekdayHeatmap`, `StatusHeatmap` |
|
|
116
|
-
| Rows to sort and filter | `DataTable`, inside a `Card` |
|
|
117
|
-
| A column that sorts on one click; a search and an "n of m" count | `DataTableSortHeader`; `DataTableSearchFilter`, `DataTableRowCount` |
|
|
118
|
-
| Stat tiles that pick a scope for the page | `SectionCards` with `selected` and `onSelect` |
|
|
119
|
-
| A share or a part of a whole, coloured as a gain or a loss | `ToneProgress` |
|
|
120
|
-
| The colour scale under a `Treemap` | `TreemapLegend`, with the map's `range` |
|
|
121
|
-
| One part of a long page: rule, eyebrow, heading, lead, action | `PageSection`, with `PageSubheading` inside |
|
|
122
|
-
| Label and value pairs, such as a record's fields | `DataList` and `DataListItem` |
|
|
123
|
-
| A command or file to copy, wrapped or scrolling | `CodeBlock` with `CodeBlockCopyButton` |
|
|
124
|
-
| A labelled copy action, such as "Copy all" for a section | `CopyButton` |
|
|
125
|
-
| A command, file or identifier inside prose | `InlineCode` |
|
|
126
|
-
| A signed figure (a gain, a loss, a change) | `Delta` |
|
|
127
|
-
| A time, with the viewer's own clock on hover | `LocalTime` |
|
|
128
|
-
|
|
129
|
-
The three chart cards take the rows, the field the x axis reads and the series,
|
|
130
|
-
and own everything else: the card and its header action (a range or mode
|
|
131
|
-
toggle), the axes, the dashed horizontal grid, Geist Mono ticks, a tooltip that
|
|
132
|
-
names the hovered point and gives each series' formatted value, and the legend
|
|
133
|
-
below. Props cover the rest: a footer, a placeholder while data loads,
|
|
134
|
-
reference lines, a numeric x axis, a fixed value axis, axis titles, a second
|
|
135
|
-
line under each tick, a picked category, sideways bars and straight segments.
|
|
136
|
-
A page never puts Recharts axes, grids or tooltips together itself.
|
|
59
|
+
`preloadFonts()` loads Geist and Geist Mono with the scripts. Add `lucide-react`
|
|
60
|
+
only when your own code imports icons. Next.js compiles the stylesheet through
|
|
61
|
+
`@tailwindcss/postcss` instead of the Vite plugin. Static HTML reports inline the
|
|
62
|
+
package's `report.css` and follow `agents/report-rules.json`.
|
|
137
63
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
title="Orders by hour"
|
|
141
|
-
data={[
|
|
142
|
-
{ hour: 9, orders: 42 },
|
|
143
|
-
{ hour: 10, orders: 31 },
|
|
144
|
-
]}
|
|
145
|
-
xKey="hour"
|
|
146
|
-
xFormatter={(hour) => `${String(hour).padStart(2, "0")}:00`}
|
|
147
|
-
series={[{ key: "orders", label: "Orders", color: "var(--chart-1)" }]}
|
|
148
|
-
height={256}
|
|
149
|
-
/>
|
|
150
|
-
```
|
|
64
|
+
If npm is unreachable, both package tarballs are attached to
|
|
65
|
+
[GitHub releases](https://github.com/jatinbansal1998/siyahi/releases).
|
|
151
66
|
|
|
152
67
|
## Locale
|
|
153
68
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
follows:
|
|
69
|
+
`useFormat()` provides `count`, `money`, `moneyCompact`, `pct` and `time`,
|
|
70
|
+
bound to the provider's locale. Defaults are Indian English, rupees and India
|
|
71
|
+
Standard Time: `₹1,53,110`, `₹2.4L`, `14:30 IST`. Use `Delta` for signed changes.
|
|
72
|
+
Override the locale for a whole app or a nested section:
|
|
159
73
|
|
|
160
74
|
```tsx
|
|
161
75
|
<SiyahiProvider locale={{ numberLocale: "en-US", currency: "USD", timeZone: "America/New_York" }}>
|
|
162
76
|
```
|
|
163
77
|
|
|
164
|
-
|
|
165
|
-
loss, a change) goes through `<Delta>`, which adds ▲ or ▼ and the meaning
|
|
166
|
-
colour. Time zone names come from the runtime's ICU data; a slim Node or
|
|
167
|
-
browser build may print `GMT+5:30` where a full one prints `IST`.
|
|
78
|
+
## Responsive behavior
|
|
168
79
|
|
|
169
|
-
|
|
80
|
+
Data tables suspend horizontal freezing below 40rem of their own available
|
|
81
|
+
space, including narrow panels on a laptop. Pinning preferences, search, sort,
|
|
82
|
+
selection and expansion stay intact. All columns remain reachable by scrolling;
|
|
83
|
+
the scrolling region also accepts keyboard focus. For page-specific compact
|
|
84
|
+
records, choose essential columns and keep every other field in accessible
|
|
85
|
+
details or an explicit full-table view.
|
|
170
86
|
|
|
171
|
-
The
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
87
|
+
The shipped `data-table-filters` recipe moves secondary filters into a `Sheet`
|
|
88
|
+
using `useDataTable().isCompact`. Configure filtering explicitly when its
|
|
89
|
+
controls render conditionally. Keep search and the active-filter count visible.
|
|
90
|
+
Use container queries for layout and pointer capability for touch targets;
|
|
91
|
+
a touch laptop needs the same reachable controls as a phone.
|
|
175
92
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
93
|
+
Ranked lists wrap long labels in narrow panels. Horizontal charts reserve space
|
|
94
|
+
for bars and wrap their category labels; exact axis ticks keep their normal
|
|
95
|
+
text size and scroll when necessary. Heatmap examples expose values on selection
|
|
96
|
+
and support one keyboard entry with arrow navigation. `WeekdayHeatmap` accepts
|
|
97
|
+
`hours` and `weekdays` to show a relevant domain without changing data labels.
|
|
180
98
|
|
|
181
|
-
|
|
182
|
-
`<html>` yourself as well, so scrollbars and form controls match.
|
|
99
|
+
## Surfaces
|
|
183
100
|
|
|
184
|
-
|
|
101
|
+
`SiyahiProvider` sets how data blocks sit on the page:
|
|
185
102
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
numeric font sizes, and chart configs with a per-scheme `theme` map (shadcn's
|
|
191
|
-
chart applies its dark half under a `.dark` class Siyahi never sets; name a
|
|
192
|
-
chart token with `color: "var(--chart-1)"` instead). Two of the rules are
|
|
193
|
-
[`@shadcn/lint`](https://github.com/shadcn-ui/lint)'s, scoped the same way.
|
|
103
|
+
- `surface="card"` (default, even outside a provider): each block is a card
|
|
104
|
+
lifted off a faintly tinted canvas.
|
|
105
|
+
- `surface="ruled"`: unboxed blocks; `PanelGrid` draws hairlines between them.
|
|
106
|
+
- `surface="open"`: no boxes or rules; card padding is removed.
|
|
194
107
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
108
|
+
Nest a provider to change one section. Stack `PageSection` blocks with
|
|
109
|
+
`flex flex-col gap-6`; use `PanelGrid` for blocks side by side. Categories use
|
|
110
|
+
neutral outline badges, leaving colour for meaning and chart series.
|
|
111
|
+
|
|
112
|
+
## Dark mode
|
|
113
|
+
|
|
114
|
+
The theme follows the device through `prefers-color-scheme`. For an app-owned
|
|
115
|
+
toggle, override the variant after the stylesheet import and set the `dark`
|
|
116
|
+
class on `<html>`:
|
|
198
117
|
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"settings": { "shadcn": { "ui": "@siyahi/ui", "themeImports": ["^@siyahi/ui/"] } },
|
|
203
|
-
"rules": {
|
|
204
|
-
"siyahi/no-color-literal": "error",
|
|
205
|
-
"siyahi/no-scheme-variant": "error",
|
|
206
|
-
"siyahi/no-numeric-font-size": "error",
|
|
207
|
-
"siyahi/no-chart-theme-map": "error",
|
|
208
|
-
"siyahi/no-raw-colors": "error",
|
|
209
|
-
"siyahi/no-arbitrary-values": "error"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
118
|
+
```css
|
|
119
|
+
@import "@siyahi/ui/styles.css";
|
|
120
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
212
121
|
```
|
|
213
122
|
|
|
214
|
-
|
|
215
|
-
pixels wide in both schemes, with layout checks), `siyahi-cls` (how far a page
|
|
216
|
-
moves after its first paint on a slow network) and `siyahi-contrast` (the
|
|
217
|
-
theme contrast check). See [packages/tools](packages/tools/README.md).
|
|
123
|
+
Set `color-scheme` on `<html>` as well so native controls match.
|
|
218
124
|
|
|
219
|
-
##
|
|
125
|
+
## Tools
|
|
220
126
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
| `assets/icon.svg` | The mark. |
|
|
127
|
+
`@siyahi/tools` provides theme lint rules, font preload, layout screenshots
|
|
128
|
+
(`siyahi-shots`), loading-shift checks (`siyahi-cls`) and contrast checks
|
|
129
|
+
(`siyahi-contrast`). See the
|
|
130
|
+
[tools guide](https://github.com/jatinbansal1998/siyahi/blob/main/packages/tools/README.md)
|
|
131
|
+
for configuration and commands.
|
|
227
132
|
|
|
228
|
-
Development
|
|
133
|
+
## Development
|
|
229
134
|
|
|
230
135
|
```sh
|
|
231
136
|
pnpm install
|
|
232
|
-
pnpm --filter @siyahi/tools exec playwright install chromium
|
|
233
|
-
pnpm check
|
|
234
|
-
pnpm dev
|
|
137
|
+
pnpm --filter @siyahi/tools exec playwright install chromium
|
|
138
|
+
pnpm check
|
|
139
|
+
pnpm dev
|
|
235
140
|
```
|
|
236
141
|
|
|
237
|
-
|
|
142
|
+
Read [CONTRIBUTING.md](https://github.com/jatinbansal1998/siyahi/blob/main/CONTRIBUTING.md)
|
|
143
|
+
before adding components. Source lives in `packages/ui`, `packages/tools` and
|
|
144
|
+
`apps/catalogue`; the catalogue is the visual documentation.
|
|
238
145
|
|
|
239
146
|
## Licence
|
|
240
147
|
|
|
241
|
-
MIT
|
|
242
|
-
notice; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
148
|
+
MIT. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -8,17 +8,17 @@ file as copied; `packages/ui/registry.lock.json` lists them all and
|
|
|
8
8
|
|
|
9
9
|
## Copied into `@siyahi/ui`
|
|
10
10
|
|
|
11
|
-
| What
|
|
12
|
-
|
|
|
13
|
-
| shadcn/ui core components (installed with `shadcn add`, never edited)
|
|
14
|
-
| shadcn `tailwind.css` (variants and utilities the components use)
|
|
15
|
-
| shadcn block `sidebar-07`
|
|
16
|
-
| shadcn block `dashboard-01`, `SectionCards` only
|
|
17
|
-
| Heatmaps: calendar, weekday by hour, status timeline
|
|
18
|
-
| niko-table data table on TanStack Table
|
|
19
|
-
| shadcn chart blocks `chart-bar-multiple`, `chart-area-stacked`, `chart-line-multiple`
|
|
20
|
-
| dashboardcn ranked list (`BarList`)
|
|
21
|
-
| MiniDev copy button (`CopyButton`)
|
|
11
|
+
| What | Where in the package | Origin | Licence |
|
|
12
|
+
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
13
|
+
| shadcn/ui core components (installed with `shadcn add`, never edited) | `src/components/ui/*`, `src/hooks/use-mobile.ts` | https://github.com/shadcn-ui/ui | MIT, Copyright (c) 2023 shadcn |
|
|
14
|
+
| shadcn `tailwind.css` (variants and utilities the components use) | `styles/shadcn.css` | https://github.com/shadcn-ui/ui/tree/main/packages/shadcn | MIT, Copyright (c) 2023 shadcn |
|
|
15
|
+
| shadcn block `sidebar-07` | `src/components/registry/sidebar-07/*` | https://ui.shadcn.com/r/styles/base-vega/sidebar-07.json | MIT, Copyright (c) 2023 shadcn |
|
|
16
|
+
| shadcn block `dashboard-01`, `SectionCards` only | `src/components/registry/dashboard-01/section-cards.tsx` | https://ui.shadcn.com/r/styles/base-vega/dashboard-01.json | MIT, Copyright (c) 2023 shadcn |
|
|
17
|
+
| Heatmaps: calendar, weekday by hour, status timeline | `src/components/registry/heatmap/*` | https://shadcn-heatmap.pages.dev/r/calendar-heatmap.json, https://shadcn-heatmap.pages.dev/r/weekday-heatmap.json, https://shadcn-heatmap.pages.dev/r/status-heatmap.json (source: https://github.com/rutopio/shadcn-heatmap) | MIT, Copyright (c) 2026 ChingRu |
|
|
18
|
+
| niko-table data table on TanStack Table | `src/components/registry/niko-table/*` | https://niko-table.com/r/data-table.json, https://niko-table.com/r/data-table-core.json, https://niko-table.com/r/data-table-ui.json, https://niko-table.com/r/data-table-faceted-filter.json, https://niko-table.com/r/data-table-column-sort.json, https://niko-table.com/r/data-table-search-filter.json (source: https://github.com/Semkoo/niko-table-registry) | MIT, Copyright (c) 2025 Semir N.; original work Copyright (c) 2025 WebDevSimplified |
|
|
19
|
+
| shadcn chart blocks `chart-bar-multiple`, `chart-area-stacked`, `chart-line-multiple` | `src/components/registry/charts/*` | https://ui.shadcn.com/r/styles/new-york-v4/chart-bar-multiple.json, https://ui.shadcn.com/r/styles/new-york-v4/chart-area-stacked.json, https://ui.shadcn.com/r/styles/new-york-v4/chart-line-multiple.json | MIT, Copyright (c) 2023 shadcn |
|
|
20
|
+
| dashboardcn ranked list (`BarList`), stacked bar (`DistributionBar`), `Sparkline` and `MetricStrip` | `src/components/registry/dashboardcn/*` | https://dashboardcn.com/r/bar-list.json, https://dashboardcn.com/r/distribution-bar.json, https://dashboardcn.com/r/sparkline.json, https://dashboardcn.com/r/kpi-row-card.json (source: https://github.com/NoahGdev/dashboardcn) | MIT, Copyright (c) 2026 dashboardcn contributors |
|
|
21
|
+
| MiniDev copy button (`CopyButton`) | `src/components/registry/minidev/copy-button.tsx` | https://ui.minidev.pro/r/copy-button.json (source: https://github.com/amankaushik481/minidev-ui) | MIT, Copyright (c) 2026 MiniDev |
|
|
22
22
|
|
|
23
23
|
## Runtime dependencies with attribution terms
|
|
24
24
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
const questions = [
|
|
4
|
+
[
|
|
5
|
+
"prices",
|
|
6
|
+
"When are prices updated?",
|
|
7
|
+
"At the exchange close each trading day, and every minute while markets are open.",
|
|
8
|
+
],
|
|
9
|
+
["lots", "How are lots matched?", "Sells are matched to the oldest buy first, as the tax rules require."],
|
|
10
|
+
["brokers", "Can I add a second broker?", "Yes. Each broker is its own account, and the totals add them up."],
|
|
11
|
+
] as const;
|
|
12
|
+
|
|
13
|
+
function Questions() {
|
|
14
|
+
return questions.map(([value, question, answer]) => (
|
|
15
|
+
<AccordionItem key={value} value={value}>
|
|
16
|
+
<AccordionTrigger>{question}</AccordionTrigger>
|
|
17
|
+
<AccordionContent>{answer}</AccordionContent>
|
|
18
|
+
</AccordionItem>
|
|
19
|
+
));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function AccordionExample() {
|
|
23
|
+
return (
|
|
24
|
+
<div className="grid gap-6 md:grid-cols-2">
|
|
25
|
+
<div className="flex flex-col gap-2">
|
|
26
|
+
<p className="text-sm text-muted-foreground">One open at a time</p>
|
|
27
|
+
<Accordion aria-label="One open at a time" defaultValue={["prices"]}>
|
|
28
|
+
<Questions />
|
|
29
|
+
</Accordion>
|
|
30
|
+
</div>
|
|
31
|
+
<div className="flex flex-col gap-2">
|
|
32
|
+
<p className="text-sm text-muted-foreground">Several open</p>
|
|
33
|
+
<Accordion aria-label="Several open" multiple defaultValue={["prices", "lots"]}>
|
|
34
|
+
<Questions />
|
|
35
|
+
</Accordion>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Alert, AlertDescription, AlertTitle, WarningAlert } from "@siyahi/ui";
|
|
2
|
+
import { CircleAlertIcon, InfoIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function AlertExample() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="flex flex-col gap-3">
|
|
7
|
+
<Alert>
|
|
8
|
+
<InfoIcon />
|
|
9
|
+
<AlertTitle>Prices are delayed</AlertTitle>
|
|
10
|
+
<AlertDescription>Quotes refresh every fifteen minutes during market hours.</AlertDescription>
|
|
11
|
+
</Alert>
|
|
12
|
+
<WarningAlert>
|
|
13
|
+
<AlertTitle>Two trades are unmatched</AlertTitle>
|
|
14
|
+
<AlertDescription>The contract notes list trades the ledger does not have yet.</AlertDescription>
|
|
15
|
+
</WarningAlert>
|
|
16
|
+
<Alert variant="destructive">
|
|
17
|
+
<CircleAlertIcon />
|
|
18
|
+
<AlertTitle>Import failed</AlertTitle>
|
|
19
|
+
<AlertDescription>The statement could not be read. Download it again and retry.</AlertDescription>
|
|
20
|
+
</Alert>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppSidebar, SidebarProvider } from "@siyahi/ui";
|
|
2
|
+
import {
|
|
3
|
+
BlocksIcon,
|
|
4
|
+
ChartAreaIcon,
|
|
5
|
+
CodeIcon,
|
|
6
|
+
FileTextIcon,
|
|
7
|
+
HouseIcon,
|
|
8
|
+
LayersIcon,
|
|
9
|
+
PaletteIcon,
|
|
10
|
+
SlidersHorizontalIcon,
|
|
11
|
+
} from "lucide-react";
|
|
12
|
+
|
|
13
|
+
// No `items` on a view, so each one is a plain link.
|
|
14
|
+
const views = [
|
|
15
|
+
{ title: "Overview", url: "#/overview", icon: <HouseIcon /> },
|
|
16
|
+
{ title: "Foundations", url: "#/foundations", icon: <PaletteIcon /> },
|
|
17
|
+
{ title: "Components", url: "#/components", icon: <LayersIcon /> },
|
|
18
|
+
{ title: "Inputs and overlays", url: "#/inputs", icon: <SlidersHorizontalIcon /> },
|
|
19
|
+
{ title: "Data", url: "#/data", icon: <ChartAreaIcon /> },
|
|
20
|
+
{ title: "Blocks", url: "#/blocks", icon: <BlocksIcon />, isActive: true },
|
|
21
|
+
{ title: "Reports", url: "#/reports", icon: <FileTextIcon /> },
|
|
22
|
+
// linkProps go onto the anchor: here a new tab, in an app often onMouseEnter to prefetch the view's data.
|
|
23
|
+
{
|
|
24
|
+
title: "Source",
|
|
25
|
+
url: "https://github.com/jatinbansal1998/siyahi",
|
|
26
|
+
icon: <CodeIcon />,
|
|
27
|
+
linkProps: { target: "_blank", rel: "noreferrer" },
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default function AppSidebarExample() {
|
|
32
|
+
return (
|
|
33
|
+
// In an app, AppSidebar sits fixed at the edge; collapsible="none" draws it in place here.
|
|
34
|
+
<SidebarProvider className="min-h-0">
|
|
35
|
+
<AppSidebar collapsible="none" navMain={views} navLabel="Views" className="rounded-lg border" />
|
|
36
|
+
</SidebarProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Avatar, AvatarFallback } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function AvatarExample() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex gap-2">
|
|
6
|
+
<Avatar>
|
|
7
|
+
<AvatarFallback>JB</AvatarFallback>
|
|
8
|
+
</Avatar>
|
|
9
|
+
<Avatar>
|
|
10
|
+
<AvatarFallback>HU</AvatarFallback>
|
|
11
|
+
</Avatar>
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Badge, Delta } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function BadgeExample() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
6
|
+
<Badge>Equity</Badge>
|
|
7
|
+
<Badge variant="secondary">Mutual fund</Badge>
|
|
8
|
+
<Badge variant="outline">Zerodha</Badge>
|
|
9
|
+
<Badge variant="destructive">Failed</Badge>
|
|
10
|
+
<Badge variant="outline">
|
|
11
|
+
<Delta value={0.042} />
|
|
12
|
+
</Badge>
|
|
13
|
+
<Badge variant="outline">
|
|
14
|
+
<Delta value={-0.013} />
|
|
15
|
+
</Badge>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
const sectors = [
|
|
4
|
+
{ name: "Information Technology and Services", value: 100 },
|
|
5
|
+
{ name: "Fast Moving Consumer Goods", value: 70 },
|
|
6
|
+
{ name: "Automobile and Auto Components", value: 50 },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export default function BarListLabelsExample() {
|
|
10
|
+
const { count } = useFormat();
|
|
11
|
+
return (
|
|
12
|
+
<Card>
|
|
13
|
+
<CardHeader>
|
|
14
|
+
<CardTitle>Orders by sector, ranked</CardTitle>
|
|
15
|
+
<CardDescription>Full labels and order counts stay readable in narrow panels</CardDescription>
|
|
16
|
+
</CardHeader>
|
|
17
|
+
<CardContent>
|
|
18
|
+
<BarList data={sectors} valueFormatter={count} />
|
|
19
|
+
</CardContent>
|
|
20
|
+
</Card>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// The biggest unrealised gains and losses; made-up figures.
|
|
4
|
+
const gains = [
|
|
5
|
+
{ name: "INFY", value: 84000 },
|
|
6
|
+
{ name: "TCS", value: 52000 },
|
|
7
|
+
{ name: "HDFCBANK", value: 31000 },
|
|
8
|
+
];
|
|
9
|
+
const losses = [
|
|
10
|
+
{ name: "ITC", value: 18400 },
|
|
11
|
+
{ name: "WIPRO", value: 7600 },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default function BarListSidesExample() {
|
|
15
|
+
const { money } = useFormat();
|
|
16
|
+
// One scale for both lists, so a small loss draws a short bar beside a large gain.
|
|
17
|
+
const max = Math.max(...[...gains, ...losses].map((row) => row.value));
|
|
18
|
+
return (
|
|
19
|
+
<Card>
|
|
20
|
+
<CardHeader>
|
|
21
|
+
<CardTitle>What drives the P&L</CardTitle>
|
|
22
|
+
<CardDescription>The biggest ₹ gains and losses, on one scale</CardDescription>
|
|
23
|
+
</CardHeader>
|
|
24
|
+
{/* Each list is a column of its own, headed and ruled off, with its figures at its own right edge, so a
|
|
25
|
+
gain's figure never reads as the label of the loss beside it. */}
|
|
26
|
+
<CardContent className="grid gap-6 md:grid-cols-2 md:gap-0 md:divide-x">
|
|
27
|
+
<div className="md:pr-6">
|
|
28
|
+
<h3 className="text-muted-foreground mb-2 text-xs font-medium">Gains</h3>
|
|
29
|
+
<BarList data={gains} max={max} color="var(--positive)" valueFormatter={(v) => money(v)} />
|
|
30
|
+
</div>
|
|
31
|
+
<div className="md:pl-6">
|
|
32
|
+
<h3 className="text-muted-foreground mb-2 text-xs font-medium">Losses</h3>
|
|
33
|
+
<BarList data={losses} max={max} color="var(--negative)" valueFormatter={(v) => money(v)} />
|
|
34
|
+
</div>
|
|
35
|
+
</CardContent>
|
|
36
|
+
</Card>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, Delta, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// detail is the loss as a share of what the holding cost.
|
|
4
|
+
const largestLosses = [
|
|
5
|
+
{ name: "ITC", value: 18400, detail: <Delta value={-0.062} /> },
|
|
6
|
+
{ name: "HDFCBANK", value: 12900, detail: <Delta value={-0.047} /> },
|
|
7
|
+
{ name: "WIPRO", value: 7600, detail: <Delta value={-0.072} /> },
|
|
8
|
+
{ name: "Asian Paints (India)", value: 4100, detail: <Delta value={-0.06} /> },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default function BarListExample() {
|
|
12
|
+
const { money } = useFormat();
|
|
13
|
+
return (
|
|
14
|
+
<Card>
|
|
15
|
+
<CardHeader>
|
|
16
|
+
<CardTitle>Needs attention</CardTitle>
|
|
17
|
+
<CardDescription>Largest unrealised losses</CardDescription>
|
|
18
|
+
</CardHeader>
|
|
19
|
+
<CardContent>
|
|
20
|
+
<BarList data={largestLosses} valueFormatter={(v) => money(v)} showPercentage />
|
|
21
|
+
</CardContent>
|
|
22
|
+
</Card>
|
|
23
|
+
);
|
|
24
|
+
}
|