@siyahi/ui 0.1.9-next.20 → 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 +3 -3
- package/agents/examples/alert.tsx +4 -6
- package/agents/examples/bar-list-sides.tsx +11 -3
- package/agents/examples/button-states.tsx +23 -0
- package/agents/examples/callout.tsx +33 -0
- package/agents/examples/change-bar.tsx +104 -0
- package/agents/examples/chart-area.tsx +5 -4
- package/agents/examples/chart-bar-flows.tsx +3 -2
- package/agents/examples/chart-bar-sectors.tsx +2 -0
- package/agents/examples/data-table-compact.tsx +95 -0
- package/agents/examples/heatmap-calendar.tsx +17 -7
- package/agents/examples/heatmap-status.tsx +17 -11
- package/agents/examples/heatmap-weekday.tsx +33 -11
- package/agents/examples/input-states.tsx +33 -0
- package/agents/examples/metric-strip.tsx +9 -3
- package/agents/examples/overview-dashboard.tsx +18 -0
- package/agents/examples/page-hero.tsx +38 -0
- package/agents/examples/range-position-table.tsx +101 -0
- package/agents/examples/range-position.tsx +53 -0
- package/agents/examples/section-cards-select.tsx +8 -5
- package/agents/examples/surfaces.tsx +3 -2
- package/agents/examples/target-rows.tsx +70 -0
- package/agents/examples/treemap.tsx +2 -1
- package/agents/manifest.json +153 -3
- 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 +11 -4
- package/dist/components/registry/charts/line-chart-card.js +2 -2
- package/dist/components/registry/dashboardcn/bar-list.js +11 -5
- package/dist/components/registry/dashboardcn/kpi-row-card.js +2 -2
- package/dist/components/registry/dashboardcn/sparkline.d.ts +5 -1
- package/dist/components/registry/dashboardcn/sparkline.js +40 -18
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +4 -2
- package/dist/components/registry/heatmap/calendar-heatmap.js +67 -33
- package/dist/components/registry/heatmap/status-heatmap.d.ts +5 -3
- package/dist/components/registry/heatmap/status-heatmap.js +30 -15
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +4 -2
- package/dist/components/registry/heatmap/weekday-heatmap.js +28 -12
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +16 -1
- package/dist/components/registry/niko-table/core/data-table-context.js +5 -20
- package/dist/components/registry/niko-table/core/data-table-root.js +39 -4
- package/dist/components/registry/niko-table/core/data-table-structure.js +2 -0
- package/dist/components/registry/niko-table/lib/styles.js +1 -1
- package/dist/components/registry/niko-table/types/index.d.ts +9 -0
- package/dist/components/registry/sidebar-07/nav-main.d.ts +1 -0
- package/dist/components/registry/sidebar-07/nav-main.js +9 -2
- 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-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-toc.d.ts +20 -0
- package/dist/components/siyahi/page-toc.js +76 -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 +1 -1
- package/dist/components/siyahi/siyahi-provider.js +1 -1
- 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 +33 -25
- package/dist/components/siyahi/warning-alert.d.ts +10 -0
- package/dist/components/siyahi/warning-alert.js +20 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +12 -1
- package/dist/lib/chart-frame.d.ts +12 -2
- package/dist/lib/chart-frame.js +51 -7
- package/dist/lib/chart-series.d.ts +5 -2
- 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 +24 -5
- 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 +2 -1
- package/report.css +26 -25
- package/styles/siyahi.css +159 -43
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { DataTableRowMenuScope, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenu
|
|
|
33
33
|
import { TableSearchFilter, TableSearchFilterProps } from "./components/registry/niko-table/filters/table-search-filter.js";
|
|
34
34
|
import { DataTableSearchFilter } from "./components/registry/niko-table/components/data-table-search-filter.js";
|
|
35
35
|
import { DataTableToolbarSection, DataTableToolbarSectionProps } from "./components/registry/niko-table/components/data-table-toolbar-section.js";
|
|
36
|
-
import { ActiveCell, ActiveSelection, ColumnResizeInfo, DataTableActions, DataTableContext, DataTableContextState, DataTableProvider, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, ScrollAlign, ScrollRowIntoView, flashCellKey, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter } from "./components/registry/niko-table/core/data-table-context.js";
|
|
36
|
+
import { ActiveCell, ActiveSelection, ColumnResizeInfo, CompactColumns, DataTableActions, DataTableContext, DataTableContextState, DataTableProvider, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, ScrollAlign, ScrollRowIntoView, flashCellKey, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter } from "./components/registry/niko-table/core/data-table-context.js";
|
|
37
37
|
import { DataTableErrorBoundary, DataTableErrorBoundaryProps } from "./components/registry/niko-table/core/data-table-error-boundary.js";
|
|
38
38
|
import { DataTableGroupedRowCells, GroupedBodyRow, GroupedBodyRowProps } from "./components/registry/niko-table/core/data-table-grouped-row.js";
|
|
39
39
|
import { DataTableConfig, DataTableRoot } from "./components/registry/niko-table/core/data-table-root.js";
|
|
@@ -49,23 +49,34 @@ import { Separator } from "./components/ui/separator.js";
|
|
|
49
49
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip.js";
|
|
50
50
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/ui/sidebar.js";
|
|
51
51
|
import { AppSidebar, AppSidebarProps } from "./components/registry/sidebar-07/app-sidebar.js";
|
|
52
|
+
import { Callout, CalloutProps } from "./components/siyahi/callout.js";
|
|
53
|
+
import { Delta, DeltaProps } from "./components/siyahi/delta.js";
|
|
54
|
+
import { ChangeBar, ChangeBarProps } from "./components/siyahi/change-bar.js";
|
|
52
55
|
import { DataBar, DataBarProps } from "./components/siyahi/data-bar.js";
|
|
53
56
|
import { DataList, DataListItem, DataListItemProps } from "./components/siyahi/data-list.js";
|
|
57
|
+
import { DataTableCompactColumnsToggle } from "./components/siyahi/data-table-compact-columns-toggle.js";
|
|
58
|
+
import { DataTableFootnote, DataTableFootnoteProps } from "./components/siyahi/data-table-footnote.js";
|
|
54
59
|
import { DataTableRowCount, DataTableRowCountProps } from "./components/siyahi/data-table-row-count.js";
|
|
55
60
|
import { DataTableSortHeader } from "./components/siyahi/data-table-sort-header.js";
|
|
56
|
-
import {
|
|
61
|
+
import { defaultSidebarOpen } from "./components/siyahi/default-sidebar-open.js";
|
|
57
62
|
import { InlineCode } from "./components/siyahi/inline-code.js";
|
|
58
63
|
import { LocalTime, LocalTimeProps } from "./components/siyahi/local-time.js";
|
|
64
|
+
import { PageHero, PageHeroProps } from "./components/siyahi/page-hero.js";
|
|
59
65
|
import { PageSection, PageSectionProps, PageSubheading } from "./components/siyahi/page-section.js";
|
|
66
|
+
import { PageToc, PageTocItem, PageTocProps } from "./components/siyahi/page-toc.js";
|
|
60
67
|
import { PanelGrid, PanelGridProps } from "./components/siyahi/panel-grid.js";
|
|
61
68
|
import { PriceChart, PriceChartProps } from "./components/siyahi/price-chart.js";
|
|
69
|
+
import { Quote, QuoteProps } from "./components/siyahi/quote.js";
|
|
70
|
+
import { RangePosition, RangePositionProps } from "./components/siyahi/range-position.js";
|
|
62
71
|
import { SiyahiLocale, defaultLocale } from "./lib/locale.js";
|
|
63
72
|
import { SiyahiProvider, SiyahiProviderProps, Surface, useLocale, useSurface } from "./components/siyahi/siyahi-provider.js";
|
|
73
|
+
import { TargetRow, TargetRows, TargetRowsProps, TargetStatus } from "./components/siyahi/target-rows.js";
|
|
64
74
|
import { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue } from "./components/ui/progress.js";
|
|
65
75
|
import { ToneProgress, ToneProgressProps } from "./components/siyahi/tone-progress.js";
|
|
66
76
|
import { Treemap, TreemapItem, TreemapLegend, TreemapLegendProps, TreemapProps } from "./components/siyahi/treemap.js";
|
|
67
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./components/ui/accordion.js";
|
|
68
77
|
import { Alert, AlertAction, AlertDescription, AlertTitle } from "./components/ui/alert.js";
|
|
78
|
+
import { WarningAlert } from "./components/siyahi/warning-alert.js";
|
|
79
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./components/ui/accordion.js";
|
|
69
80
|
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/ui/avatar.js";
|
|
70
81
|
import { Badge, badgeVariants } from "./components/ui/badge.js";
|
|
71
82
|
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/ui/breadcrumb.js";
|
|
@@ -89,4 +100,4 @@ import { Textarea } from "./components/ui/textarea.js";
|
|
|
89
100
|
import { Toggle, toggleVariants } from "./components/ui/toggle.js";
|
|
90
101
|
import { ToggleGroup, ToggleGroupItem } from "./components/ui/toggle-group.js";
|
|
91
102
|
import { Formatters, TimeOptions, count, money, moneyCompact, pct, time, useFormat } from "./lib/format.js";
|
|
92
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, AreaChartCard, AreaChartCardProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BarChartCard, BarChartCardProps, BarList, BarListItem, BarListProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBlockProps, CalendarHeatmapBody, CalendarHeatmapBodyProps, CalendarHeatmapFooter, CalendarHeatmapFooterProps, CalendarHeatmapLegend, CalendarHeatmapLegendProps, CalendarHeatmapProps, CalendarHeatmapStat, CalendarHeatmapStatProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartColor, ChartConfig, ChartContainer, ChartCurve, ChartLegend, ChartLegendContent, ChartReferenceLine, ChartSeries, ChartSeriesItem, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorConfig, ColumnResizeInfo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataBar, DataBarProps, DataList, DataListItem, DataListItemProps, DataTable, DataTableActions, DataTableBody, DataTableBodyProps, type DataTableCell, type DataTableColumn, DataTableColumnActions, type DataTableColumnDef, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, type DataTableColumns, DataTableConfig, DataTableContainerProps, DataTableContext, DataTableContextState, DataTableEmptyActions, DataTableEmptyActionsProps, DataTableEmptyBody, DataTableEmptyBodyProps, DataTableEmptyDescription, DataTableEmptyDescriptionProps, DataTableEmptyFilteredMessage, DataTableEmptyFilteredMessageProps, DataTableEmptyIcon, DataTableEmptyIconProps, DataTableEmptyMessage, DataTableEmptyMessageProps, DataTableEmptyState, DataTableEmptyStateProps, DataTableEmptyTitle, DataTableEmptyTitleProps, DataTableErrorBoundary, DataTableErrorBoundaryProps, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableGroupRowContextValue, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableGroupedRowsProps, DataTableHeader, type DataTableHeader$1 as DataTableHeaderCell, DataTableHeaderProps, type DataTableInstance, DataTableLoading, DataTableLoadingMore, DataTableLoadingMoreProps, DataTableLoadingProps, DataTableProvider, DataTableRoot, type DataTableRow, DataTableRowContextMenu, DataTableRowContextMenuProps, DataTableRowContextMenuSlot, DataTableRowContextMenuSlotProps, DataTableRowCount, DataTableRowCountProps, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSkeletonProps, DataTableSortHeader, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DistributionBar, DistributionBarProps, DistributionMarker, DistributionSegment, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtendedColumnFilter, type ExtendedColumnSort, type FilterOperator, type FilterOperatorValues, type FilterVariant, type FilterVariantValues, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, Formatters, type GlobalFilter, GroupedBodyRow, GroupedBodyRowProps, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, LineChartCard, LineChartCardProps, LocalTime, LocalTimeProps, MetricStrip, MetricStripItem, MetricStripProps, NavMain, NavProjects, NavUser, NumericXProps, type Option, PageSection, PageSectionProps, PageSubheading, PanelGrid, PanelGridProps, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, SectionCards, SectionCardsProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SeriesChartProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, Sparkline, SparklineProps, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Surface, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, TableSearchFilterProps, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, TimeOptions, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, ToneProgressProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, TreemapLegend, TreemapLegendProps, TreemapProps, type ValueOf, type ColorConfig$1 as WeekdayColorConfig, type WeekdayExtraColumnSpec, type WeekdayExtraRowSpec, WeekdayHeatmap, WeekdayHeatmapBlock, type WeekdayHeatmapBlockProps, WeekdayHeatmapBody, type WeekdayHeatmapBodyProps, WeekdayHeatmapFooter, type WeekdayHeatmapFooterProps, type WeekdayHeatmapLabels, WeekdayHeatmapLegend, type WeekdayHeatmapLegendProps, type WeekdayHeatmapProps, WeekdayHeatmapStat, type WeekdayHeatmapStatProps, type WeekdayHour, type WeekdayHourlyActivity, type WeekdayIndex, badgeVariants, buttonVariants, count, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useSurface, useTableFacetedFilter };
|
|
103
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, AreaChartCard, AreaChartCardProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BarChartCard, BarChartCardProps, BarList, BarListItem, BarListProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBlockProps, CalendarHeatmapBody, CalendarHeatmapBodyProps, CalendarHeatmapFooter, CalendarHeatmapFooterProps, CalendarHeatmapLegend, CalendarHeatmapLegendProps, CalendarHeatmapProps, CalendarHeatmapStat, CalendarHeatmapStatProps, Callout, CalloutProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChangeBar, ChangeBarProps, ChartColor, ChartConfig, ChartContainer, ChartCurve, ChartLegend, ChartLegendContent, ChartReferenceLine, ChartSeries, ChartSeriesItem, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorConfig, ColumnResizeInfo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CompactColumns, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataBar, DataBarProps, DataList, DataListItem, DataListItemProps, DataTable, DataTableActions, DataTableBody, DataTableBodyProps, type DataTableCell, type DataTableColumn, DataTableColumnActions, type DataTableColumnDef, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, type DataTableColumns, DataTableCompactColumnsToggle, DataTableConfig, DataTableContainerProps, DataTableContext, DataTableContextState, DataTableEmptyActions, DataTableEmptyActionsProps, DataTableEmptyBody, DataTableEmptyBodyProps, DataTableEmptyDescription, DataTableEmptyDescriptionProps, DataTableEmptyFilteredMessage, DataTableEmptyFilteredMessageProps, DataTableEmptyIcon, DataTableEmptyIconProps, DataTableEmptyMessage, DataTableEmptyMessageProps, DataTableEmptyState, DataTableEmptyStateProps, DataTableEmptyTitle, DataTableEmptyTitleProps, DataTableErrorBoundary, DataTableErrorBoundaryProps, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableFootnote, DataTableFootnoteProps, DataTableGroupRowContextValue, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableGroupedRowsProps, DataTableHeader, type DataTableHeader$1 as DataTableHeaderCell, DataTableHeaderProps, type DataTableInstance, DataTableLoading, DataTableLoadingMore, DataTableLoadingMoreProps, DataTableLoadingProps, DataTableProvider, DataTableRoot, type DataTableRow, DataTableRowContextMenu, DataTableRowContextMenuProps, DataTableRowContextMenuSlot, DataTableRowContextMenuSlotProps, DataTableRowCount, DataTableRowCountProps, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSkeletonProps, DataTableSortHeader, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DistributionBar, DistributionBarProps, DistributionMarker, DistributionSegment, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtendedColumnFilter, type ExtendedColumnSort, type FilterOperator, type FilterOperatorValues, type FilterVariant, type FilterVariantValues, FlashCellRef, FlashCells, FlashRows, FlashRowsOptions, Formatters, type GlobalFilter, GroupedBodyRow, GroupedBodyRowProps, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, LineChartCard, LineChartCardProps, LocalTime, LocalTimeProps, MetricStrip, MetricStripItem, MetricStripProps, NavMain, NavProjects, NavUser, NumericXProps, type Option, PageHero, PageHeroProps, PageSection, PageSectionProps, PageSubheading, PageToc, PageTocItem, PageTocProps, PanelGrid, PanelGridProps, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, Quote, QuoteProps, RangePosition, RangePositionProps, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, SectionCards, SectionCardsProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SeriesChartProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, Sparkline, SparklineProps, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Surface, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, TableSearchFilterProps, Tabs, TabsContent, TabsList, TabsTrigger, TargetRow, TargetRows, TargetRowsProps, TargetStatus, TeamSwitcher, Textarea, TimeOptions, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, ToneProgressProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, TreemapLegend, TreemapLegendProps, TreemapProps, type ValueOf, WarningAlert, type ColorConfig$1 as WeekdayColorConfig, type WeekdayExtraColumnSpec, type WeekdayExtraRowSpec, WeekdayHeatmap, WeekdayHeatmapBlock, type WeekdayHeatmapBlockProps, WeekdayHeatmapBody, type WeekdayHeatmapBodyProps, WeekdayHeatmapFooter, type WeekdayHeatmapFooterProps, type WeekdayHeatmapLabels, WeekdayHeatmapLegend, type WeekdayHeatmapLegendProps, type WeekdayHeatmapProps, WeekdayHeatmapStat, type WeekdayHeatmapStatProps, type WeekdayHour, type WeekdayHourlyActivity, type WeekdayIndex, badgeVariants, buttonVariants, count, defaultLocale, defaultSidebarOpen, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useSurface, useTableFacetedFilter };
|
package/dist/index.js
CHANGED
|
@@ -75,15 +75,26 @@ import { NavProjects } from "./components/registry/sidebar-07/nav-projects.js";
|
|
|
75
75
|
import { NavUser } from "./components/registry/sidebar-07/nav-user.js";
|
|
76
76
|
import { TeamSwitcher } from "./components/registry/sidebar-07/team-switcher.js";
|
|
77
77
|
import { AppSidebar } from "./components/registry/sidebar-07/app-sidebar.js";
|
|
78
|
+
import { Callout } from "./components/siyahi/callout.js";
|
|
79
|
+
import { ChangeBar } from "./components/siyahi/change-bar.js";
|
|
78
80
|
import { DataBar } from "./components/siyahi/data-bar.js";
|
|
79
81
|
import { DataList, DataListItem } from "./components/siyahi/data-list.js";
|
|
82
|
+
import { DataTableCompactColumnsToggle } from "./components/siyahi/data-table-compact-columns-toggle.js";
|
|
83
|
+
import { DataTableFootnote } from "./components/siyahi/data-table-footnote.js";
|
|
80
84
|
import { DataTableRowCount } from "./components/siyahi/data-table-row-count.js";
|
|
81
85
|
import { DataTableSortHeader } from "./components/siyahi/data-table-sort-header.js";
|
|
86
|
+
import { defaultSidebarOpen } from "./components/siyahi/default-sidebar-open.js";
|
|
82
87
|
import { InlineCode } from "./components/siyahi/inline-code.js";
|
|
83
88
|
import { LocalTime } from "./components/siyahi/local-time.js";
|
|
89
|
+
import { PageHero } from "./components/siyahi/page-hero.js";
|
|
84
90
|
import { PageSection, PageSubheading } from "./components/siyahi/page-section.js";
|
|
91
|
+
import { PageToc } from "./components/siyahi/page-toc.js";
|
|
85
92
|
import { PanelGrid } from "./components/siyahi/panel-grid.js";
|
|
86
93
|
import { PriceChart } from "./components/siyahi/price-chart.js";
|
|
94
|
+
import { Quote } from "./components/siyahi/quote.js";
|
|
95
|
+
import { RangePosition } from "./components/siyahi/range-position.js";
|
|
96
|
+
import { TargetRows } from "./components/siyahi/target-rows.js";
|
|
87
97
|
import { ToneProgress } from "./components/siyahi/tone-progress.js";
|
|
88
98
|
import { Treemap, TreemapLegend } from "./components/siyahi/treemap.js";
|
|
89
|
-
|
|
99
|
+
import { WarningAlert } from "./components/siyahi/warning-alert.js";
|
|
100
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AreaChartCard, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BarChartCard, BarList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, CalendarHeatmap, CalendarHeatmapBlock, CalendarHeatmapBody, CalendarHeatmapFooter, CalendarHeatmapLegend, CalendarHeatmapStat, Callout, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChangeBar, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataBar, DataList, DataListItem, DataTable, DataTableActions, DataTableBody, DataTableColumnActions, DataTableColumnFilter, DataTableColumnHeader, DataTableColumnHeaderRoot, DataTableColumnSortMenu, DataTableColumnSortOptions, DataTableColumnTitle, DataTableCompactColumnsToggle, DataTableContext, DataTableEmptyActions, DataTableEmptyBody, DataTableEmptyDescription, DataTableEmptyFilteredMessage, DataTableEmptyIcon, DataTableEmptyMessage, DataTableEmptyState, DataTableEmptyTitle, DataTableErrorBoundary, DataTableFacetedFilter, DataTableFacetedFilterContent, DataTableFootnote, DataTableGroupRowProvider, DataTableGroupedRowCells, DataTableGroupedRows, DataTableHeader, DataTableLoading, DataTableLoadingMore, DataTableProvider, DataTableRoot, DataTableRowContextMenu, DataTableRowContextMenuSlot, DataTableRowCount, DataTableRowMenuScope, DataTableSearchFilter, DataTableSkeleton, DataTableSortHeader, DataTableToolbarSection, Delta, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DistributionBar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, GroupedBodyRow, InlineCode, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, LineChartCard, LocalTime, MetricStrip, NavMain, NavProjects, NavUser, PageHero, PageSection, PageSubheading, PageToc, PanelGrid, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, Quote, RangePosition, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollArea, ScrollBar, SectionCards, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiyahiProvider, Skeleton, Slider, Sparkline, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBody, StatusHeatmapFooter, StatusHeatmapLegend, StatusHeatmapStat, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFooter, TableHead, TableHeader, TableRow, TableSearchFilter, Tabs, TabsContent, TabsList, TabsTrigger, TargetRows, TeamSwitcher, Textarea, Toggle, ToggleGroup, ToggleGroupItem, ToneProgress, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapLegend, WarningAlert, WeekdayHeatmap, WeekdayHeatmapBlock, WeekdayHeatmapBody, WeekdayHeatmapFooter, WeekdayHeatmapLegend, WeekdayHeatmapStat, badgeVariants, buttonVariants, count, defaultLocale, defaultSidebarOpen, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useSurface, useTableFacetedFilter };
|
|
@@ -9,8 +9,9 @@ interface ChartFrameProps<T extends object, K extends keyof T> extends Omit<Seri
|
|
|
9
9
|
/** One Bar, Area or Line per series. */
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
/**
|
|
12
|
-
* Bars run sideways: the categories go down the left, where long names fit,
|
|
13
|
-
*
|
|
12
|
+
* Bars run sideways: the categories go down the left, where long names fit, as in shadcn's
|
|
13
|
+
* chart-bar-horizontal. The value axis runs along the bottom when yTickFormatter is given, and is hidden
|
|
14
|
+
* otherwise. x and y keep their meaning: x is the category, y the value.
|
|
14
15
|
*/
|
|
15
16
|
horizontal?: boolean;
|
|
16
17
|
/** "sign" stacks negative values below zero and positive ones above, rather than on one running total. */
|
|
@@ -22,6 +23,15 @@ interface ChartFrameProps<T extends object, K extends keyof T> extends Omit<Seri
|
|
|
22
23
|
* zero, since each bar's own Cell follows its sign but the chip follows the Bar.
|
|
23
24
|
*/
|
|
24
25
|
export declare function seriesFill<T>(item: ChartSeriesItem<T>, data: readonly T[]): ChartColor;
|
|
26
|
+
/**
|
|
27
|
+
* A Line or Area's dots: one solid dot on the latest point, ringed in the card's colour so it stands clear of the
|
|
28
|
+
* grid, and none elsewhere. The eye lands on now, where a reader starts.
|
|
29
|
+
*/
|
|
30
|
+
export declare function endDot(color: ChartColor, count: number): ({ cx, cy, index }: {
|
|
31
|
+
cx?: number;
|
|
32
|
+
cy?: number;
|
|
33
|
+
index?: number;
|
|
34
|
+
}) => import("react").JSX.Element;
|
|
25
35
|
/** A tooltip row: the series' colour and label, then its value as the page formats it, or — when the row has none. */
|
|
26
36
|
export declare function seriesRow<T>(series: ChartSeries<T>, formatValue: (value: number) => string): (value: unknown, _name: unknown, item: {
|
|
27
37
|
dataKey?: unknown;
|
package/dist/lib/chart-frame.js
CHANGED
|
@@ -4,7 +4,7 @@ import { cn } from "./utils.js";
|
|
|
4
4
|
import { useLocale } from "../components/siyahi/siyahi-provider.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
|
-
import { CartesianGrid, ReferenceLine, Text, XAxis, YAxis, useChartWidth } from "recharts";
|
|
7
|
+
import { CartesianGrid, ReferenceLine, Text, XAxis, YAxis, useChartWidth, useXAxisTicks, useYAxisTicks } from "recharts";
|
|
8
8
|
//#region src/lib/chart-frame.tsx
|
|
9
9
|
const AXIS_TITLE = "fill-muted-foreground text-xs";
|
|
10
10
|
const TICK = { className: "fill-muted-foreground font-mono" };
|
|
@@ -17,6 +17,20 @@ function seriesFill(item, data) {
|
|
|
17
17
|
const values = data.map((row) => row[item.key]).filter((value) => Number.isFinite(value)).map(Number);
|
|
18
18
|
return item.negativeColor && values.length > 0 && values.every((value) => value < 0) ? item.negativeColor : item.color;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A Line or Area's dots: one solid dot on the latest point, ringed in the card's colour so it stands clear of the
|
|
22
|
+
* grid, and none elsewhere. The eye lands on now, where a reader starts.
|
|
23
|
+
*/
|
|
24
|
+
function endDot(color, count) {
|
|
25
|
+
return ({ cx, cy, index }) => index === count - 1 && cx !== void 0 && cy !== void 0 ? /* @__PURE__ */ jsx("circle", {
|
|
26
|
+
cx,
|
|
27
|
+
cy,
|
|
28
|
+
r: 4,
|
|
29
|
+
fill: color,
|
|
30
|
+
stroke: "var(--card)",
|
|
31
|
+
strokeWidth: 2
|
|
32
|
+
}, "end") : /* @__PURE__ */ jsx("g", {}, index);
|
|
33
|
+
}
|
|
20
34
|
/** A tooltip row: the series' colour and label, then its value as the page formats it, or — when the row has none. */
|
|
21
35
|
function seriesRow(series, formatValue) {
|
|
22
36
|
return (value, _name, item) => {
|
|
@@ -38,6 +52,21 @@ function seriesRow(series, formatValue) {
|
|
|
38
52
|
] });
|
|
39
53
|
};
|
|
40
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A value-axis tick formatted against the axis' largest tick, so every label shares one unit: ₹1.6L down to ₹0.4L,
|
|
57
|
+
* never ₹80,000 halfway up. Recharts' tickFormatter sees one value at a time; the axis' ticks come from its hooks.
|
|
58
|
+
* The rest of Recharts' tick props pass on as its own tick does, including the class it measures an auto width by.
|
|
59
|
+
*/
|
|
60
|
+
function ValueTick({ payload, axis, formatter, ...tick }) {
|
|
61
|
+
const xTicks = useXAxisTicks();
|
|
62
|
+
const yTicks = useYAxisTicks();
|
|
63
|
+
const value = Number(payload?.value);
|
|
64
|
+
const scale = Math.max(Math.abs(value), ...((axis === "x" ? xTicks : yTicks) ?? []).map((t) => Math.abs(Number(t.value))));
|
|
65
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
66
|
+
...tick,
|
|
67
|
+
children: formatter(value, scale)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
41
70
|
const GEIST_WIDTH = 6.6;
|
|
42
71
|
const MONO_WIDTH = 7.2;
|
|
43
72
|
/**
|
|
@@ -183,8 +212,9 @@ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, o
|
|
|
183
212
|
onClick,
|
|
184
213
|
throttledEvents: onClick ? [] : void 0,
|
|
185
214
|
margin: {
|
|
215
|
+
top: 12,
|
|
186
216
|
left: 0,
|
|
187
|
-
right: !horizontal && xTicks ? endRoom(xFormatter, xTicks) : 8
|
|
217
|
+
right: !horizontal && xTicks ? endRoom(xFormatter, xTicks) : horizontal && yTickFormatter ? 28 : 8
|
|
188
218
|
},
|
|
189
219
|
children: [
|
|
190
220
|
/* @__PURE__ */ jsx(CartesianGrid, {
|
|
@@ -194,9 +224,18 @@ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, o
|
|
|
194
224
|
}),
|
|
195
225
|
horizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
|
|
196
226
|
type: "number",
|
|
197
|
-
|
|
227
|
+
niceTicks: "snap125",
|
|
228
|
+
hide: !yTickFormatter,
|
|
198
229
|
domain: yDomain,
|
|
199
|
-
ticks: yTicks
|
|
230
|
+
ticks: yTicks,
|
|
231
|
+
tickLine: false,
|
|
232
|
+
axisLine: false,
|
|
233
|
+
tickMargin: 8,
|
|
234
|
+
tick: yTickFormatter ? /* @__PURE__ */ jsx(ValueTick, {
|
|
235
|
+
axis: "x",
|
|
236
|
+
formatter: yTickFormatter,
|
|
237
|
+
...TICK
|
|
238
|
+
}) : TICK
|
|
200
239
|
}), /* @__PURE__ */ jsx(HorizontalAxis, {
|
|
201
240
|
data,
|
|
202
241
|
xKey,
|
|
@@ -221,6 +260,7 @@ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, o
|
|
|
221
260
|
tick: xTickDetail || xTicks ? fittedTick(data, xKey, xFormatter, xTickDetail, false) : TICK,
|
|
222
261
|
interval: xTickDetail || xTicks ? 0 : void 0
|
|
223
262
|
}), /* @__PURE__ */ jsx(YAxis, {
|
|
263
|
+
niceTicks: "snap125",
|
|
224
264
|
tickLine: false,
|
|
225
265
|
axisLine: false,
|
|
226
266
|
width: "auto",
|
|
@@ -233,8 +273,12 @@ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, o
|
|
|
233
273
|
style: { textAnchor: "middle" },
|
|
234
274
|
className: AXIS_TITLE
|
|
235
275
|
} : void 0,
|
|
236
|
-
|
|
237
|
-
|
|
276
|
+
tick: yTickFormatter ? /* @__PURE__ */ jsx(ValueTick, {
|
|
277
|
+
axis: "y",
|
|
278
|
+
formatter: yTickFormatter,
|
|
279
|
+
...TICK
|
|
280
|
+
}) : TICK,
|
|
281
|
+
tickFormatter: yTickFormatter ? void 0 : (value) => formatValue(value)
|
|
238
282
|
})] }),
|
|
239
283
|
crossesZero && (horizontal ? /* @__PURE__ */ jsx(ReferenceLine, {
|
|
240
284
|
x: 0,
|
|
@@ -279,4 +323,4 @@ function ChartFrame({ chart: Chart, children, horizontal = false, stackOffset, o
|
|
|
279
323
|
] });
|
|
280
324
|
}
|
|
281
325
|
//#endregion
|
|
282
|
-
export { ChartFrame, seriesFill, seriesRow };
|
|
326
|
+
export { ChartFrame, endDot, seriesFill, seriesRow };
|
|
@@ -57,8 +57,11 @@ export interface SeriesChartProps<T extends object, K extends keyof T> {
|
|
|
57
57
|
xTooltipFormatter?: (value: T[K]) => string;
|
|
58
58
|
/** A series' value in the tooltip, and the y axis unless yTickFormatter is set. Defaults to the locale's numbers. */
|
|
59
59
|
valueFormatter?: (value: number) => string;
|
|
60
|
-
/**
|
|
61
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The y axis, when its ticks should be shorter than the tooltip's figures: moneyCompact against money. It gets the
|
|
62
|
+
* axis' largest tick as `scale`, so moneyCompact writes every tick in one unit.
|
|
63
|
+
*/
|
|
64
|
+
yTickFormatter?: (value: number, scale: number) => string;
|
|
62
65
|
/**
|
|
63
66
|
* A fixed range for the value axis, such as [0, 100] for a percentage. By default it fits the data; a bar
|
|
64
67
|
* chart's always reaches zero.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataTableColumnDef } from "../components/registry/niko-table/types/index.js";
|
|
2
|
+
import { ColumnVisibilityState, RowData } from "@tanstack/react-table";
|
|
3
|
+
//#region src/lib/compact-columns.d.ts
|
|
4
|
+
/** Reports the element's inner width whenever it changes. */
|
|
5
|
+
export declare function useTableWidth(element: HTMLElement | null, onChange: (width: number) => void): void;
|
|
6
|
+
/** Narrower than 40rem, the width a phone gives a table: freezing is suspended and toolbars fold. */
|
|
7
|
+
export declare function isCompactWidth(width: number): boolean;
|
|
8
|
+
export interface FittedColumns {
|
|
9
|
+
/** The caller's visibility with the columns that do not fit turned off. */
|
|
10
|
+
visibility: ColumnVisibilityState;
|
|
11
|
+
/** The columns turned off to fit; empty when everything fits. */
|
|
12
|
+
hidden: ReadonlySet<string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Which columns to hide so the table fits `width`: the rightmost columns without `meta.compact` go first. Null
|
|
16
|
+
* when no column sets `meta.compact`, so a table that never opted in keeps every column and scrolls.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fitColumns<TData extends RowData>(columns: DataTableColumnDef<TData>[], order: string[], visibility: ColumnVisibilityState, width: number): FittedColumns | null;
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region src/lib/compact-columns.ts
|
|
3
|
+
const DEFAULT_SIZE = 150;
|
|
4
|
+
/** Reports the element's inner width whenever it changes. */
|
|
5
|
+
function useTableWidth(element, onChange) {
|
|
6
|
+
React.useLayoutEffect(() => {
|
|
7
|
+
if (!element) return;
|
|
8
|
+
const measure = () => {
|
|
9
|
+
if (element.clientWidth > 0) onChange(element.clientWidth);
|
|
10
|
+
};
|
|
11
|
+
measure();
|
|
12
|
+
const observer = new ResizeObserver(measure);
|
|
13
|
+
observer.observe(element);
|
|
14
|
+
return () => observer.disconnect();
|
|
15
|
+
}, [element, onChange]);
|
|
16
|
+
}
|
|
17
|
+
/** Narrower than 40rem, the width a phone gives a table: freezing is suspended and toolbars fold. */
|
|
18
|
+
function isCompactWidth(width) {
|
|
19
|
+
if (width <= 0) return false;
|
|
20
|
+
return width < 40 * Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
21
|
+
}
|
|
22
|
+
function columnId(column) {
|
|
23
|
+
if (column.id) return column.id;
|
|
24
|
+
const key = column.accessorKey;
|
|
25
|
+
return typeof key === "string" ? key.replaceAll(".", "_") : void 0;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Which columns to hide so the table fits `width`: the rightmost columns without `meta.compact` go first. Null
|
|
29
|
+
* when no column sets `meta.compact`, so a table that never opted in keeps every column and scrolls.
|
|
30
|
+
*/
|
|
31
|
+
function fitColumns(columns, order, visibility, width) {
|
|
32
|
+
if (width <= 0 || !columns.some((column) => column.meta?.compact)) return null;
|
|
33
|
+
const byId = new Map(columns.flatMap((column) => {
|
|
34
|
+
const id = columnId(column);
|
|
35
|
+
return id ? [[id, column]] : [];
|
|
36
|
+
}));
|
|
37
|
+
const shown = [...order.filter((id) => byId.has(id)), ...[...byId.keys()].filter((id) => !order.includes(id))].filter((id) => visibility[id] !== false);
|
|
38
|
+
let total = shown.reduce((sum, id) => sum + (byId.get(id)?.size ?? DEFAULT_SIZE), 0);
|
|
39
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const id of shown.toReversed()) {
|
|
41
|
+
if (total <= width) break;
|
|
42
|
+
const column = byId.get(id);
|
|
43
|
+
if (column?.meta?.compact) continue;
|
|
44
|
+
hidden.add(id);
|
|
45
|
+
total -= column?.size ?? DEFAULT_SIZE;
|
|
46
|
+
}
|
|
47
|
+
const fitted = { ...visibility };
|
|
48
|
+
for (const id of hidden) fitted[id] = false;
|
|
49
|
+
return {
|
|
50
|
+
visibility: fitted,
|
|
51
|
+
hidden
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { fitColumns, isCompactWidth, useTableWidth };
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -7,8 +7,12 @@ export declare function money(value: number, locale?: SiyahiLocale, fractionDigi
|
|
|
7
7
|
* count in thousands up to a lakh, so in an Indian-region locale amounts under
|
|
8
8
|
* one lakh print in full (₹99,999), never as ₹99.9K. Signed figures belong in
|
|
9
9
|
* `Delta`, which adds the arrow.
|
|
10
|
+
*
|
|
11
|
+
* Give `scale`, the largest amount on the same axis, and every tick takes that
|
|
12
|
+
* amount's unit, to two decimals so close ticks stay apart: ₹1.5L, ₹0.75L,
|
|
13
|
+
* ₹0, rather than switching to ₹75,000 halfway up.
|
|
10
14
|
*/
|
|
11
|
-
export declare function moneyCompact(value: number, locale?: SiyahiLocale): string;
|
|
15
|
+
export declare function moneyCompact(value: number, locale?: SiyahiLocale, scale?: number): string;
|
|
12
16
|
/** A whole count with the locale's grouping: 1,53,110 in en-IN. */
|
|
13
17
|
export declare function count(value: number, locale?: SiyahiLocale): string;
|
|
14
18
|
/** A fraction as a percentage: 0.1234 is 12.3%. */
|
|
@@ -22,7 +26,8 @@ export declare function time(value: Date | number | string, locale?: SiyahiLocal
|
|
|
22
26
|
export interface Formatters {
|
|
23
27
|
count: (value: number) => string;
|
|
24
28
|
money: (value: number, fractionDigits?: number) => string;
|
|
25
|
-
|
|
29
|
+
/** Pass `scale` on an axis so every tick shares one unit; a chart's yTickFormatter gets it as its second argument. */
|
|
30
|
+
moneyCompact: (value: number, scale?: number) => string;
|
|
26
31
|
pct: (value: number, fractionDigits?: number) => string;
|
|
27
32
|
time: (value: Date | number | string, options?: TimeOptions) => string;
|
|
28
33
|
}
|
package/dist/lib/format.js
CHANGED
|
@@ -23,21 +23,40 @@ function money(value, locale = defaultLocale, fractionDigits = 0) {
|
|
|
23
23
|
maximumFractionDigits: fractionDigits
|
|
24
24
|
}).format(value);
|
|
25
25
|
}
|
|
26
|
+
const DIGITS = /* @__PURE__ */ new Set(["integer", "fraction"]);
|
|
27
|
+
const NUMBER = /* @__PURE__ */ new Set([
|
|
28
|
+
"integer",
|
|
29
|
+
"group",
|
|
30
|
+
"decimal",
|
|
31
|
+
"fraction"
|
|
32
|
+
]);
|
|
26
33
|
/**
|
|
27
34
|
* A short amount: ₹2.4L and ₹40Cr in en-IN, $2.4M in en-US. Indian readers
|
|
28
35
|
* count in thousands up to a lakh, so in an Indian-region locale amounts under
|
|
29
36
|
* one lakh print in full (₹99,999), never as ₹99.9K. Signed figures belong in
|
|
30
37
|
* `Delta`, which adds the arrow.
|
|
38
|
+
*
|
|
39
|
+
* Give `scale`, the largest amount on the same axis, and every tick takes that
|
|
40
|
+
* amount's unit, to two decimals so close ticks stay apart: ₹1.5L, ₹0.75L,
|
|
41
|
+
* ₹0, rather than switching to ₹75,000 halfway up.
|
|
31
42
|
*/
|
|
32
|
-
function moneyCompact(value, locale = defaultLocale) {
|
|
43
|
+
function moneyCompact(value, locale = defaultLocale, scale) {
|
|
33
44
|
if (!regions.has(locale.numberLocale)) regions.set(locale.numberLocale, new Intl.Locale(locale.numberLocale).region);
|
|
34
|
-
if (regions.get(locale.numberLocale) === "IN" && Math.abs(value) < 1e5) return money(value, locale);
|
|
35
|
-
|
|
45
|
+
if (regions.get(locale.numberLocale) === "IN" && (scale ?? Math.abs(value)) < 1e5) return money(value, locale);
|
|
46
|
+
const compact = numberFormat(locale.numberLocale, {
|
|
36
47
|
style: "currency",
|
|
37
48
|
currency: locale.currency,
|
|
38
49
|
notation: "compact",
|
|
39
50
|
maximumFractionDigits: 1
|
|
40
|
-
})
|
|
51
|
+
});
|
|
52
|
+
if (scale === void 0 || value === 0) return compact.format(value);
|
|
53
|
+
const parts = compact.formatToParts(Math.sign(value) * scale);
|
|
54
|
+
const shown = Number(parts.flatMap((part) => part.type === "decimal" ? "." : DIGITS.has(part.type) ? part.value : []).join(""));
|
|
55
|
+
const unit = 10 ** Math.round(Math.log10(scale / shown));
|
|
56
|
+
if (unit === 1) return compact.format(value);
|
|
57
|
+
const digits = numberFormat(locale.numberLocale, { maximumFractionDigits: 2 }).format(Math.abs(value) / unit);
|
|
58
|
+
const first = parts.findIndex((part) => part.type === "integer");
|
|
59
|
+
return parts.flatMap((part, index) => index === first ? digits : NUMBER.has(part.type) ? [] : part.value).join("");
|
|
41
60
|
}
|
|
42
61
|
/** A whole count with the locale's grouping: 1,53,110 in en-IN. */
|
|
43
62
|
function count(value, locale = defaultLocale) {
|
|
@@ -79,7 +98,7 @@ function useFormat() {
|
|
|
79
98
|
return useMemo(() => ({
|
|
80
99
|
count: (value) => count(value, locale),
|
|
81
100
|
money: (value, fractionDigits) => money(value, locale, fractionDigits),
|
|
82
|
-
moneyCompact: (value) => moneyCompact(value, locale),
|
|
101
|
+
moneyCompact: (value, scale) => moneyCompact(value, locale, scale),
|
|
83
102
|
pct: (value, fractionDigits) => pct(value, locale, fractionDigits),
|
|
84
103
|
time: (value, options) => time(value, locale, options)
|
|
85
104
|
}), [locale]);
|
package/dist/lib/treemap.js
CHANGED
|
@@ -35,7 +35,12 @@ const DEFAULT_RANGE = .05;
|
|
|
35
35
|
const HEAT_STEPS = 5;
|
|
36
36
|
/** The range the heat scale uses: one that is not a positive number falls back to ±5%. */
|
|
37
37
|
const heatRange = (range = DEFAULT_RANGE) => Number.isFinite(range) && range > 0 ? range : DEFAULT_RANGE;
|
|
38
|
-
const
|
|
38
|
+
const DARK_FLOOR = 25;
|
|
39
|
+
const heatFill = (side, step) => {
|
|
40
|
+
const mix = (share) => `color-mix(in oklab, var(--${side}) ${share}%, var(--card))`;
|
|
41
|
+
const dark = DARK_FLOOR + (step - 1) * 35 / 4;
|
|
42
|
+
return `light-dark(${mix(step * 12)}, ${mix(dark)})`;
|
|
43
|
+
};
|
|
39
44
|
function heat(change, range) {
|
|
40
45
|
if (!change) return "var(--muted)";
|
|
41
46
|
const step = Math.min(5, Math.ceil(Math.abs(change) / heatRange(range) * 5));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
//#region src/lib/use-element-width.d.ts
|
|
3
|
+
/** The element's content width, kept current as it resizes; 0 until it is first measured. */
|
|
4
|
+
export declare function useElementWidth<T extends Element>(): [RefObject<T | null>, number];
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
//#region src/lib/use-element-width.ts
|
|
3
|
+
/** The element's content width, kept current as it resizes; 0 until it is first measured. */
|
|
4
|
+
function useElementWidth() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [width, setWidth] = useState(0);
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
const observer = new ResizeObserver(([entry]) => setWidth(entry?.contentRect.width ?? 0));
|
|
9
|
+
if (ref.current) observer.observe(ref.current);
|
|
10
|
+
return () => observer.disconnect();
|
|
11
|
+
}, []);
|
|
12
|
+
return [ref, width];
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useElementWidth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siyahi/ui",
|
|
3
|
-
"version": "0.1.9-next.
|
|
3
|
+
"version": "0.1.9-next.21",
|
|
4
4
|
"description": "Stock shadcn/ui on Base UI and Tailwind v4, a finance theme, a few compositions and formatters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"base-ui",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"report.css",
|
|
26
26
|
"registry.lock.json",
|
|
27
27
|
"README.md",
|
|
28
|
+
"DESIGN.md",
|
|
28
29
|
"LICENSE",
|
|
29
30
|
"THIRD_PARTY_NOTICES.md"
|
|
30
31
|
],
|
package/report.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:root {
|
|
7
7
|
color-scheme: light dark;
|
|
8
8
|
--radius: 0.625rem;
|
|
9
|
-
--background: oklch(
|
|
9
|
+
--background: oklch(0.985 0 0);
|
|
10
10
|
--foreground: oklch(0.145 0 0);
|
|
11
11
|
--card: oklch(1 0 0);
|
|
12
12
|
--card-foreground: oklch(0.145 0 0);
|
|
@@ -23,68 +23,69 @@
|
|
|
23
23
|
--destructive: oklch(0.577 0.245 27.325);
|
|
24
24
|
--border: oklch(0.922 0 0);
|
|
25
25
|
--input: oklch(0.922 0 0);
|
|
26
|
-
--ring: oklch(0.
|
|
26
|
+
--ring: oklch(0.62 0.16 275);
|
|
27
27
|
--positive: oklch(0.527 0.154 150.069);
|
|
28
28
|
--positive-foreground: oklch(0.985 0 0);
|
|
29
29
|
--negative: oklch(0.577 0.245 27.325);
|
|
30
30
|
--negative-foreground: oklch(0.985 0 0);
|
|
31
31
|
--warning: oklch(0.555 0.163 48.998);
|
|
32
32
|
--warning-foreground: oklch(0.985 0 0);
|
|
33
|
-
--link: oklch(0.
|
|
34
|
-
--chart-1: oklch(0.
|
|
35
|
-
--chart-2: oklch(0.
|
|
36
|
-
--chart-3: oklch(0.
|
|
37
|
-
--chart-4: oklch(0.
|
|
38
|
-
--chart-5: oklch(0.
|
|
33
|
+
--link: oklch(0.51 0.2 275);
|
|
34
|
+
--chart-1: oklch(0.4 0.17 275);
|
|
35
|
+
--chart-2: oklch(0.66 0.13 70);
|
|
36
|
+
--chart-3: oklch(0.38 0.13 335);
|
|
37
|
+
--chart-4: oklch(0.66 0.11 235);
|
|
38
|
+
--chart-5: oklch(0.36 0.06 205);
|
|
39
39
|
--sidebar: oklch(0.985 0 0);
|
|
40
40
|
--sidebar-foreground: oklch(0.145 0 0);
|
|
41
41
|
--sidebar-primary: oklch(0.205 0 0);
|
|
42
42
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
43
43
|
--sidebar-accent: oklch(0.97 0 0);
|
|
44
|
-
--sidebar-accent-foreground: oklch(0.
|
|
44
|
+
--sidebar-accent-foreground: oklch(0.45 0.2 275);
|
|
45
45
|
--sidebar-border: oklch(0.922 0 0);
|
|
46
|
-
--sidebar-ring: oklch(0.
|
|
46
|
+
--sidebar-ring: oklch(0.62 0.16 275);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
@media (prefers-color-scheme: dark) {
|
|
50
50
|
:root {
|
|
51
|
-
--background: oklch(0.
|
|
51
|
+
--background: oklch(0.14 0 0);
|
|
52
52
|
--foreground: oklch(0.922 0 0);
|
|
53
|
-
--card: oklch(0.
|
|
53
|
+
--card: oklch(0.215 0 0);
|
|
54
54
|
--card-foreground: oklch(0.922 0 0);
|
|
55
|
-
--popover: oklch(0.
|
|
55
|
+
--popover: oklch(0.215 0 0);
|
|
56
56
|
--popover-foreground: oklch(0.922 0 0);
|
|
57
57
|
--primary: oklch(0.922 0 0);
|
|
58
58
|
--primary-foreground: oklch(0.205 0 0);
|
|
59
59
|
--secondary: oklch(0.269 0 0);
|
|
60
60
|
--secondary-foreground: oklch(0.922 0 0);
|
|
61
61
|
--muted: oklch(0.269 0 0);
|
|
62
|
-
--muted-foreground: oklch(0.
|
|
62
|
+
--muted-foreground: oklch(0.74 0 0);
|
|
63
63
|
--accent: oklch(0.269 0 0);
|
|
64
64
|
--accent-foreground: oklch(0.922 0 0);
|
|
65
65
|
--destructive: oklch(0.704 0.191 22.216);
|
|
66
66
|
--border: oklch(1 0 0 / 10%);
|
|
67
67
|
--input: oklch(1 0 0 / 15%);
|
|
68
|
-
--ring: oklch(0.
|
|
69
|
-
--positive: oklch(0.
|
|
68
|
+
--ring: oklch(0.6 0.14 275);
|
|
69
|
+
--positive: oklch(0.74 0.16 151.711);
|
|
70
70
|
--positive-foreground: oklch(0.145 0 0);
|
|
71
71
|
--negative: oklch(0.704 0.191 22.216);
|
|
72
72
|
--negative-foreground: oklch(0.145 0 0);
|
|
73
73
|
--warning: oklch(0.828 0.189 84.429);
|
|
74
74
|
--warning-foreground: oklch(0.145 0 0);
|
|
75
|
-
--link: oklch(0.
|
|
76
|
-
--chart-1: oklch(0.
|
|
77
|
-
--chart-2: oklch(0.
|
|
78
|
-
--chart-3: oklch(0.
|
|
79
|
-
--chart-4: oklch(0.
|
|
80
|
-
--chart-5: oklch(0.
|
|
75
|
+
--link: oklch(0.75 0.13 275);
|
|
76
|
+
--chart-1: oklch(0.58 0.2 275);
|
|
77
|
+
--chart-2: oklch(0.88 0.08 75);
|
|
78
|
+
--chart-3: oklch(0.58 0.16 335);
|
|
79
|
+
--chart-4: oklch(0.88 0.05 235);
|
|
80
|
+
--chart-5: oklch(0.56 0.08 205);
|
|
81
81
|
--sidebar: oklch(0.145 0 0);
|
|
82
82
|
--sidebar-foreground: oklch(0.922 0 0);
|
|
83
|
-
--sidebar-primary: oklch(0.
|
|
83
|
+
--sidebar-primary: oklch(0.922 0 0);
|
|
84
|
+
--sidebar-primary-foreground: oklch(0.205 0 0);
|
|
84
85
|
--sidebar-accent: oklch(0.269 0 0);
|
|
85
|
-
--sidebar-accent-foreground: oklch(0.
|
|
86
|
+
--sidebar-accent-foreground: oklch(0.8 0.1 275);
|
|
86
87
|
--sidebar-border: oklch(1 0 0 / 10%);
|
|
87
|
-
--sidebar-ring: oklch(0.
|
|
88
|
+
--sidebar-ring: oklch(0.6 0.14 275);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
|