@siyahi/ui 0.1.0-next.5 → 0.1.1-next.2
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/README.md +8 -17
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +1 -1
- package/dist/components/registry/sidebar-07/app-sidebar.js +3 -3
- package/dist/components/registry/sidebar-07/nav-main.d.ts +1 -0
- package/dist/components/registry/sidebar-07/nav-main.js +17 -2
- package/dist/components/siyahi/local-time.d.ts +3 -1
- package/dist/components/siyahi/local-time.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/lib/format.d.ts +6 -2
- package/dist/lib/format.js +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,24 +49,11 @@ and the Recharts pieces charts are built from. Add `lucide-react` only if your
|
|
|
49
49
|
own code imports icons. A Next.js app compiles the same stylesheet through
|
|
50
50
|
`@tailwindcss/postcss` instead of the Vite plugin.
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
### Also on GitHub releases
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
above:
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
npm install --allow-remote=root https://github.com/jatinbansal1998/siyahi/releases/download/v<version>/siyahi-ui-<version>.tgz
|
|
61
|
-
npm install --allow-remote=root --save-dev https://github.com/jatinbansal1998/siyahi/releases/download/v<version>/siyahi-tools-<version>.tgz
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
npm 12 refuses tarball URLs unless `allow-remote` permits them; put
|
|
65
|
-
`allow-remote=root` in the project's `.npmrc` so a later plain `npm install`
|
|
66
|
-
works too. The rolling `next` release always holds the newest build under fixed
|
|
67
|
-
names (`.../releases/download/next/siyahi-ui-next.tgz` and
|
|
68
|
-
`siyahi-tools-next.tgz`); its assets are replaced on every merge, so pin a
|
|
69
|
-
versioned URL in `package.json`.
|
|
54
|
+
Every merge to `main` also attaches both tarballs to a GitHub release
|
|
55
|
+
(`v<version>`, plus a rolling `next`). They are a fallback if npm is unreachable:
|
|
56
|
+
`npm install --allow-remote=root https://github.com/jatinbansal1998/siyahi/releases/download/v<version>/siyahi-ui-<version>.tgz`.
|
|
70
57
|
|
|
71
58
|
## What is in it
|
|
72
59
|
|
|
@@ -81,6 +68,9 @@ versioned URL in `package.json`.
|
|
|
81
68
|
in a tooltip) and `SiyahiProvider`.
|
|
82
69
|
- **Formatters**: `money`, `moneyCompact`, `pct` and `time`, or `useFormat()`
|
|
83
70
|
for the same bound to the provider's locale.
|
|
71
|
+
`useFormat().time(value, { withDate: true })` (or
|
|
72
|
+
`time(value, locale, { withDate: true })`) and `<LocalTime withDate>` write
|
|
73
|
+
the date first: `20 Oct 2026, 14:30 IST`.
|
|
84
74
|
- **`report.css`** for static HTML reports that do not use React: the theme as
|
|
85
75
|
plain CSS variables plus base body styles, with no network requests.
|
|
86
76
|
|
|
@@ -163,6 +153,7 @@ Development uses pnpm and [Vite+](https://viteplus.dev):
|
|
|
163
153
|
|
|
164
154
|
```sh
|
|
165
155
|
pnpm install
|
|
156
|
+
pnpm --filter @siyahi/tools exec playwright install chromium # once; the screenshot tests use it
|
|
166
157
|
pnpm check # format, lint, unused code, generated files, build, typecheck, tests
|
|
167
158
|
pnpm dev # the catalogue on localhost
|
|
168
159
|
```
|
|
@@ -14,5 +14,5 @@ export interface AppSidebarProps extends React$1.ComponentProps<typeof Sidebar>
|
|
|
14
14
|
projects?: React$1.ComponentProps<typeof NavProjects>["projects"];
|
|
15
15
|
user?: React$1.ComponentProps<typeof NavUser>["user"];
|
|
16
16
|
}
|
|
17
|
-
export declare function AppSidebar({ navMain, navLabel, header, teams, projects, user, ...props }: AppSidebarProps): React$1.JSX.Element;
|
|
17
|
+
export declare function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible, ...props }: AppSidebarProps): React$1.JSX.Element;
|
|
18
18
|
//#endregion
|
|
@@ -7,9 +7,9 @@ import { TeamSwitcher } from "./team-switcher.js";
|
|
|
7
7
|
import "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/registry/sidebar-07/app-sidebar.tsx
|
|
10
|
-
function AppSidebar({ navMain, navLabel, header, teams, projects, user, ...props }) {
|
|
10
|
+
function AppSidebar({ navMain, navLabel, header, teams, projects, user, collapsible = "icon", ...props }) {
|
|
11
11
|
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
12
|
-
collapsible
|
|
12
|
+
collapsible,
|
|
13
13
|
...props,
|
|
14
14
|
children: [
|
|
15
15
|
(header || teams) && /* @__PURE__ */ jsx(SidebarHeader, { children: header ?? (teams && /* @__PURE__ */ jsx(TeamSwitcher, { teams })) }),
|
|
@@ -18,7 +18,7 @@ function AppSidebar({ navMain, navLabel, header, teams, projects, user, ...props
|
|
|
18
18
|
label: navLabel
|
|
19
19
|
}), projects && /* @__PURE__ */ jsx(NavProjects, { projects })] }),
|
|
20
20
|
user && /* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(NavUser, { user }) }),
|
|
21
|
-
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
21
|
+
collapsible !== "none" && /* @__PURE__ */ jsx(SidebarRail, {})
|
|
22
22
|
]
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../ui/collapsible.js";
|
|
2
|
-
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "../../ui/sidebar.js";
|
|
2
|
+
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar } from "../../ui/sidebar.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { ChevronRightIcon } from "lucide-react";
|
|
5
5
|
//#region src/components/registry/sidebar-07/nav-main.tsx
|
|
6
6
|
function NavMain({ items, label = "Navigation" }) {
|
|
7
|
-
|
|
7
|
+
const { isMobile, setOpenMobile } = useSidebar();
|
|
8
|
+
const closeDrawer = () => {
|
|
9
|
+
if (isMobile) setOpenMobile(false);
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ jsxs(SidebarGroup, { children: [/* @__PURE__ */ jsx(SidebarGroupLabel, { children: label }), /* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item) => !item.items?.length ? /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
12
|
+
isActive: item.isActive,
|
|
13
|
+
tooltip: item.title,
|
|
14
|
+
render: /* @__PURE__ */ jsx("a", {
|
|
15
|
+
...item.linkProps,
|
|
16
|
+
href: item.url,
|
|
17
|
+
"aria-current": item.isActive ? "page" : void 0
|
|
18
|
+
}),
|
|
19
|
+
onClick: closeDrawer,
|
|
20
|
+
children: [item.icon, /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
21
|
+
}) }, item.title) : /* @__PURE__ */ jsxs(Collapsible, {
|
|
8
22
|
defaultOpen: item.isActive,
|
|
9
23
|
className: "group/collapsible",
|
|
10
24
|
render: /* @__PURE__ */ jsx(SidebarMenuItem, {}),
|
|
@@ -17,6 +31,7 @@ function NavMain({ items, label = "Navigation" }) {
|
|
|
17
31
|
]
|
|
18
32
|
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
19
33
|
render: /* @__PURE__ */ jsx("a", { href: subItem.url }),
|
|
34
|
+
onClick: closeDrawer,
|
|
20
35
|
children: /* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
21
36
|
}) }, subItem.title)) }) })]
|
|
22
37
|
}, item.title)) })] });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
//#region src/components/siyahi/local-time.d.ts
|
|
2
2
|
export interface LocalTimeProps {
|
|
3
3
|
value: Date | number | string;
|
|
4
|
+
/** Write the date, in the same zone, before the time: 20 Oct 2026, 14:30 IST. */
|
|
5
|
+
withDate?: boolean;
|
|
4
6
|
}
|
|
5
7
|
/** A time in the configured zone (14:30 IST), with the viewer's own clock in a tooltip. */
|
|
6
|
-
export declare function LocalTime({ value }: LocalTimeProps): import("react").JSX.Element;
|
|
8
|
+
export declare function LocalTime({ value, withDate }: LocalTimeProps): import("react").JSX.Element;
|
|
7
9
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { useFormat } from "../../lib/format.js";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/siyahi/local-time.tsx
|
|
5
5
|
/** A time in the configured zone (14:30 IST), with the viewer's own clock in a tooltip. */
|
|
6
|
-
function LocalTime({ value }) {
|
|
6
|
+
function LocalTime({ value, withDate = false }) {
|
|
7
7
|
const { time } = useFormat();
|
|
8
8
|
const date = new Date(value);
|
|
9
9
|
const viewer = new Intl.DateTimeFormat(void 0, {
|
|
@@ -15,7 +15,7 @@ function LocalTime({ value }) {
|
|
|
15
15
|
dateTime: date.toISOString(),
|
|
16
16
|
className: "tabular-nums"
|
|
17
17
|
}),
|
|
18
|
-
children: time(date)
|
|
18
|
+
children: time(date, { withDate })
|
|
19
19
|
}), /* @__PURE__ */ jsxs(TooltipContent, { children: ["Your time: ", viewer] })] });
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,6 @@ import { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants } from "./co
|
|
|
68
68
|
import { Textarea } from "./components/ui/textarea.js";
|
|
69
69
|
import { Toggle, toggleVariants } from "./components/ui/toggle.js";
|
|
70
70
|
import { ToggleGroup, ToggleGroupItem } from "./components/ui/toggle-group.js";
|
|
71
|
-
import { Formatters, money, moneyCompact, pct, time, useFormat } from "./lib/format.js";
|
|
71
|
+
import { Formatters, TimeOptions, money, moneyCompact, pct, time, useFormat } from "./lib/format.js";
|
|
72
72
|
import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, ReferenceLine, XAxis, YAxis } from "./lib/recharts.js";
|
|
73
|
-
export { ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, Area, AreaChart, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, 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, CartesianGrid, ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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, 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, DataTableRowMenuScope, DataTableSkeleton, DataTableSkeletonProps, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, 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, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, Line, LineChart, LocalTime, LocalTimeProps, NavMain, NavProjects, NavUser, type Option, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, 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, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, 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, XAxis, YAxis, badgeVariants, buttonVariants, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
|
|
73
|
+
export { ActiveCell, ActiveSelection, Activity, Alert, AlertAction, AlertDescription, AlertTitle, AppSidebar, AppSidebarProps, Area, AreaChart, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Bar, BarChart, 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, CartesianGrid, ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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, 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, DataTableRowMenuScope, DataTableSkeleton, DataTableSkeletonProps, DataTableToolbarSection, DataTableToolbarSectionProps, Delta, DeltaProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, 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, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type JoinOperator, type JoinOperatorValues, Labels, Line, LineChart, LocalTime, LocalTimeProps, NavMain, NavProjects, NavUser, type Option, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, PriceChart, PriceChartProps, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type QueryKeys, ReferenceLine, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, ScrollAlign, ScrollArea, ScrollBar, type ScrollEvent, ScrollRowIntoView, SectionCard, 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, SiyahiLocale, SiyahiProvider, SiyahiProviderProps, Skeleton, Slider, StatusActivity, StatusColorConfig, StatusHeatmap, StatusHeatmapBlock, StatusHeatmapBlockProps, StatusHeatmapBody, StatusHeatmapBodyProps, StatusHeatmapFooter, StatusHeatmapFooterProps, StatusHeatmapLabels, StatusHeatmapLegend, StatusHeatmapLegendProps, StatusHeatmapProps, StatusHeatmapStat, StatusHeatmapStatProps, StatusValue, Table, TableBody, TableCaption, TableCell, TableColumnActions, TableColumnActionsProps, TableColumnSortMenu, TableColumnSortOptions, TableColumnTitle, TableFacetedFilter, TableFacetedFilterContent, TableFacetedFilterProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TeamSwitcher, Textarea, TimeOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Treemap, TreemapItem, 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, XAxis, YAxis, badgeVariants, buttonVariants, defaultLocale, flashCellKey, money, moneyCompact, pct, resolveGroupedRowsSlot, resolveRowContextMenuRenderer, tabsListVariants, time, toggleVariants, useColumnHeaderContext, useColumnResizeInfo, useDataTable, useDataTableActiveCell, useDataTableActiveCellSetter, useDataTableGroupRow, useDataTableRow, useFormat, useLocale, useResolvedRowContextMenuRenderer, useSidebar, useTableFacetedFilter };
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -11,13 +11,17 @@ export declare function money(value: number, locale?: SiyahiLocale, fractionDigi
|
|
|
11
11
|
export declare function moneyCompact(value: number, locale?: SiyahiLocale): string;
|
|
12
12
|
/** A fraction as a percentage: 0.1234 is 12.3%. */
|
|
13
13
|
export declare function pct(value: number, locale?: SiyahiLocale, fractionDigits?: number): string;
|
|
14
|
+
export interface TimeOptions {
|
|
15
|
+
/** Write the date, in the same zone, before the time: 20 Oct 2026, 14:30 IST. */
|
|
16
|
+
withDate?: boolean;
|
|
17
|
+
}
|
|
14
18
|
/** A 24-hour time in the locale's zone, with the zone written: 14:30 IST. */
|
|
15
|
-
export declare function time(value: Date | number | string, locale?: SiyahiLocale): string;
|
|
19
|
+
export declare function time(value: Date | number | string, locale?: SiyahiLocale, { withDate }?: TimeOptions): string;
|
|
16
20
|
export interface Formatters {
|
|
17
21
|
money: (value: number, fractionDigits?: number) => string;
|
|
18
22
|
moneyCompact: (value: number) => string;
|
|
19
23
|
pct: (value: number, fractionDigits?: number) => string;
|
|
20
|
-
time: (value: Date | number | string) => string;
|
|
24
|
+
time: (value: Date | number | string, options?: TimeOptions) => string;
|
|
21
25
|
}
|
|
22
26
|
/** The formatters above, bound to the locale of the nearest `SiyahiProvider`. */
|
|
23
27
|
export declare function useFormat(): Formatters;
|
package/dist/lib/format.js
CHANGED
|
@@ -35,8 +35,14 @@ function pct(value, locale = defaultLocale, fractionDigits = 1) {
|
|
|
35
35
|
}).format(value);
|
|
36
36
|
}
|
|
37
37
|
/** A 24-hour time in the locale's zone, with the zone written: 14:30 IST. */
|
|
38
|
-
function time(value, locale = defaultLocale) {
|
|
38
|
+
function time(value, locale = defaultLocale, { withDate = false } = {}) {
|
|
39
|
+
const date = withDate ? {
|
|
40
|
+
day: "numeric",
|
|
41
|
+
month: "short",
|
|
42
|
+
year: "numeric"
|
|
43
|
+
} : {};
|
|
39
44
|
return new Intl.DateTimeFormat(locale.numberLocale, {
|
|
45
|
+
...date,
|
|
40
46
|
hour: "2-digit",
|
|
41
47
|
minute: "2-digit",
|
|
42
48
|
hourCycle: "h23",
|
|
@@ -51,7 +57,7 @@ function useFormat() {
|
|
|
51
57
|
money: (value, fractionDigits) => money(value, locale, fractionDigits),
|
|
52
58
|
moneyCompact: (value) => moneyCompact(value, locale),
|
|
53
59
|
pct: (value, fractionDigits) => pct(value, locale, fractionDigits),
|
|
54
|
-
time: (value) => time(value, locale)
|
|
60
|
+
time: (value, options) => time(value, locale, options)
|
|
55
61
|
}), [locale]);
|
|
56
62
|
}
|
|
57
63
|
//#endregion
|