@bison-lab/ui 0.10.0 → 0.10.1
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/dist/charts.d.mts +143 -0
- package/dist/charts.d.mts.map +1 -0
- package/dist/charts.mjs +272 -0
- package/dist/charts.mjs.map +1 -0
- package/dist/index.d.mts +15 -153
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -273
- package/dist/index.mjs.map +1 -1
- package/dist/utils-DPv8mMhD.mjs +11 -0
- package/dist/utils-DPv8mMhD.mjs.map +1 -0
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { t as cn } from "./utils-DPv8mMhD.mjs";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -10,12 +9,6 @@ import { ArrowDown, ArrowLeft, ArrowUp, ArrowUpDown, Camera, Check, ChevronDown,
|
|
|
10
9
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
11
10
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
12
11
|
import { Command as Command$1 } from "cmdk";
|
|
13
|
-
import { Area, AreaChart as AreaChart$1, Bar, BarChart as BarChart$1, CartesianGrid, Cell, Legend, Pie, PieChart, ResponsiveContainer, Tooltip as Tooltip$2, XAxis, YAxis } from "recharts";
|
|
14
|
-
//#region src/lib/utils.ts
|
|
15
|
-
function cn(...inputs) {
|
|
16
|
-
return twMerge(clsx(inputs));
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
12
|
//#region src/hooks/use-scroll-reveal.ts
|
|
20
13
|
/**
|
|
21
14
|
* Returns a ref and a boolean indicating whether the element is in view.
|
|
@@ -2083,270 +2076,6 @@ function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false,
|
|
|
2083
2076
|
});
|
|
2084
2077
|
}
|
|
2085
2078
|
//#endregion
|
|
2086
|
-
//#region src/lib/chart-utils.ts
|
|
2087
|
-
/**
|
|
2088
|
-
* Shared utilities for chart components.
|
|
2089
|
-
* Reads theme CSS custom properties to provide Recharts-compatible color strings.
|
|
2090
|
-
*/
|
|
2091
|
-
/** Default chart color tokens mapped to CSS custom properties */
|
|
2092
|
-
const chartColorTokens = [
|
|
2093
|
-
"--primary",
|
|
2094
|
-
"--secondary",
|
|
2095
|
-
"--brand-accent",
|
|
2096
|
-
"--highlight",
|
|
2097
|
-
"--destructive"
|
|
2098
|
-
];
|
|
2099
|
-
/**
|
|
2100
|
-
* Resolves a CSS custom property value to an `hsl(...)` string.
|
|
2101
|
-
* Falls back to the raw token name if resolution fails (e.g. SSR).
|
|
2102
|
-
*/
|
|
2103
|
-
function resolveHslToken(token, el) {
|
|
2104
|
-
if (typeof window === "undefined") return `hsl(var(${token}))`;
|
|
2105
|
-
const target = el ?? document.documentElement;
|
|
2106
|
-
const raw = getComputedStyle(target).getPropertyValue(token).trim();
|
|
2107
|
-
if (!raw) return `hsl(var(${token}))`;
|
|
2108
|
-
if (raw.startsWith("hsl")) return raw;
|
|
2109
|
-
return `hsl(${raw})`;
|
|
2110
|
-
}
|
|
2111
|
-
/**
|
|
2112
|
-
* Returns an array of resolved theme colors for chart series.
|
|
2113
|
-
* Consumers can override with explicit `colors` prop.
|
|
2114
|
-
*/
|
|
2115
|
-
function getThemeColors(el) {
|
|
2116
|
-
return chartColorTokens.map((token) => resolveHslToken(token, el));
|
|
2117
|
-
}
|
|
2118
|
-
/** Chart size presets (height in px) */
|
|
2119
|
-
const chartSizeMap = {
|
|
2120
|
-
sm: 200,
|
|
2121
|
-
md: 300,
|
|
2122
|
-
lg: 400
|
|
2123
|
-
};
|
|
2124
|
-
//#endregion
|
|
2125
|
-
//#region src/components/area-chart.tsx
|
|
2126
|
-
const AreaChart = React.forwardRef(({ className, data, index, categories, series, colors, size = "md", height, showGrid = true, showLegend = false, showTooltip = true, showYAxis = true, curveType = "monotone", stacked = false, ...props }, ref) => {
|
|
2127
|
-
const containerRef = React.useRef(null);
|
|
2128
|
-
const [themeColors, setThemeColors] = React.useState([]);
|
|
2129
|
-
React.useEffect(() => {
|
|
2130
|
-
const el = containerRef.current;
|
|
2131
|
-
setThemeColors(colors ?? getThemeColors(el));
|
|
2132
|
-
}, [colors]);
|
|
2133
|
-
const resolvedSeries = React.useMemo(() => {
|
|
2134
|
-
if (series) return series;
|
|
2135
|
-
return (categories ?? []).map((key) => ({
|
|
2136
|
-
dataKey: key,
|
|
2137
|
-
name: key
|
|
2138
|
-
}));
|
|
2139
|
-
}, [series, categories]);
|
|
2140
|
-
const chartHeight = height ?? chartSizeMap[size];
|
|
2141
|
-
const gridColor = themeColors.length > 0 ? void 0 : "hsl(var(--border-subtle))";
|
|
2142
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2143
|
-
ref: (node) => {
|
|
2144
|
-
containerRef.current = node;
|
|
2145
|
-
if (typeof ref === "function") ref(node);
|
|
2146
|
-
else if (ref) ref.current = node;
|
|
2147
|
-
},
|
|
2148
|
-
className: cn("w-full", className),
|
|
2149
|
-
...props,
|
|
2150
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
2151
|
-
width: "100%",
|
|
2152
|
-
height: chartHeight,
|
|
2153
|
-
children: /* @__PURE__ */ jsxs(AreaChart$1, {
|
|
2154
|
-
data,
|
|
2155
|
-
children: [
|
|
2156
|
-
showGrid && /* @__PURE__ */ jsx(CartesianGrid, {
|
|
2157
|
-
strokeDasharray: "3 3",
|
|
2158
|
-
stroke: gridColor,
|
|
2159
|
-
className: "stroke-border-subtle"
|
|
2160
|
-
}),
|
|
2161
|
-
/* @__PURE__ */ jsx(XAxis, {
|
|
2162
|
-
dataKey: index,
|
|
2163
|
-
tick: { fontSize: 12 },
|
|
2164
|
-
tickLine: false,
|
|
2165
|
-
axisLine: false,
|
|
2166
|
-
className: "[&_text]:fill-content-secondary"
|
|
2167
|
-
}),
|
|
2168
|
-
showYAxis && /* @__PURE__ */ jsx(YAxis, {
|
|
2169
|
-
tick: { fontSize: 12 },
|
|
2170
|
-
tickLine: false,
|
|
2171
|
-
axisLine: false,
|
|
2172
|
-
width: 40,
|
|
2173
|
-
className: "[&_text]:fill-content-secondary"
|
|
2174
|
-
}),
|
|
2175
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
2176
|
-
backgroundColor: "hsl(var(--popover))",
|
|
2177
|
-
border: "1px solid hsl(var(--border))",
|
|
2178
|
-
borderRadius: "var(--radius-md)",
|
|
2179
|
-
color: "hsl(var(--popover-foreground))",
|
|
2180
|
-
fontSize: 12
|
|
2181
|
-
} }),
|
|
2182
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {}),
|
|
2183
|
-
resolvedSeries.map((s, i) => {
|
|
2184
|
-
const color = s.color ?? themeColors[i % themeColors.length] ?? `hsl(var(--primary))`;
|
|
2185
|
-
return /* @__PURE__ */ jsx(Area, {
|
|
2186
|
-
type: curveType,
|
|
2187
|
-
dataKey: s.dataKey,
|
|
2188
|
-
name: s.name ?? s.dataKey,
|
|
2189
|
-
stroke: color,
|
|
2190
|
-
fill: color,
|
|
2191
|
-
fillOpacity: s.fillOpacity ?? .15,
|
|
2192
|
-
stackId: stacked ? "stack" : void 0
|
|
2193
|
-
}, s.dataKey);
|
|
2194
|
-
})
|
|
2195
|
-
]
|
|
2196
|
-
})
|
|
2197
|
-
})
|
|
2198
|
-
});
|
|
2199
|
-
});
|
|
2200
|
-
AreaChart.displayName = "AreaChart";
|
|
2201
|
-
//#endregion
|
|
2202
|
-
//#region src/components/bar-chart.tsx
|
|
2203
|
-
const BarChart = React.forwardRef(({ className, data, index, categories, series, colors, size = "md", height, showGrid = true, showLegend = false, showTooltip = true, showYAxis = true, stacked = false, horizontal = false, ...props }, ref) => {
|
|
2204
|
-
const containerRef = React.useRef(null);
|
|
2205
|
-
const [themeColors, setThemeColors] = React.useState([]);
|
|
2206
|
-
React.useEffect(() => {
|
|
2207
|
-
const el = containerRef.current;
|
|
2208
|
-
setThemeColors(colors ?? getThemeColors(el));
|
|
2209
|
-
}, [colors]);
|
|
2210
|
-
const resolvedSeries = React.useMemo(() => {
|
|
2211
|
-
if (series) return series;
|
|
2212
|
-
return (categories ?? []).map((key) => ({
|
|
2213
|
-
dataKey: key,
|
|
2214
|
-
name: key
|
|
2215
|
-
}));
|
|
2216
|
-
}, [series, categories]);
|
|
2217
|
-
const chartHeight = height ?? chartSizeMap[size];
|
|
2218
|
-
const layout = horizontal ? "vertical" : "horizontal";
|
|
2219
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2220
|
-
ref: (node) => {
|
|
2221
|
-
containerRef.current = node;
|
|
2222
|
-
if (typeof ref === "function") ref(node);
|
|
2223
|
-
else if (ref) ref.current = node;
|
|
2224
|
-
},
|
|
2225
|
-
className: cn("w-full", className),
|
|
2226
|
-
...props,
|
|
2227
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
2228
|
-
width: "100%",
|
|
2229
|
-
height: chartHeight,
|
|
2230
|
-
children: /* @__PURE__ */ jsxs(BarChart$1, {
|
|
2231
|
-
data,
|
|
2232
|
-
layout,
|
|
2233
|
-
children: [
|
|
2234
|
-
showGrid && /* @__PURE__ */ jsx(CartesianGrid, {
|
|
2235
|
-
strokeDasharray: "3 3",
|
|
2236
|
-
className: "stroke-border-subtle"
|
|
2237
|
-
}),
|
|
2238
|
-
horizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
|
|
2239
|
-
type: "number",
|
|
2240
|
-
tick: { fontSize: 12 },
|
|
2241
|
-
tickLine: false,
|
|
2242
|
-
axisLine: false,
|
|
2243
|
-
className: "[&_text]:fill-content-secondary"
|
|
2244
|
-
}), /* @__PURE__ */ jsx(YAxis, {
|
|
2245
|
-
dataKey: index,
|
|
2246
|
-
type: "category",
|
|
2247
|
-
tick: { fontSize: 12 },
|
|
2248
|
-
tickLine: false,
|
|
2249
|
-
axisLine: false,
|
|
2250
|
-
width: 80,
|
|
2251
|
-
className: "[&_text]:fill-content-secondary"
|
|
2252
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
|
|
2253
|
-
dataKey: index,
|
|
2254
|
-
tick: { fontSize: 12 },
|
|
2255
|
-
tickLine: false,
|
|
2256
|
-
axisLine: false,
|
|
2257
|
-
className: "[&_text]:fill-content-secondary"
|
|
2258
|
-
}), showYAxis && /* @__PURE__ */ jsx(YAxis, {
|
|
2259
|
-
tick: { fontSize: 12 },
|
|
2260
|
-
tickLine: false,
|
|
2261
|
-
axisLine: false,
|
|
2262
|
-
width: 40,
|
|
2263
|
-
className: "[&_text]:fill-content-secondary"
|
|
2264
|
-
})] }),
|
|
2265
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
2266
|
-
backgroundColor: "hsl(var(--popover))",
|
|
2267
|
-
border: "1px solid hsl(var(--border))",
|
|
2268
|
-
borderRadius: "var(--radius-md)",
|
|
2269
|
-
color: "hsl(var(--popover-foreground))",
|
|
2270
|
-
fontSize: 12
|
|
2271
|
-
} }),
|
|
2272
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {}),
|
|
2273
|
-
resolvedSeries.map((s, i) => {
|
|
2274
|
-
const color = s.color ?? themeColors[i % themeColors.length] ?? `hsl(var(--primary))`;
|
|
2275
|
-
return /* @__PURE__ */ jsx(Bar, {
|
|
2276
|
-
dataKey: s.dataKey,
|
|
2277
|
-
name: s.name ?? s.dataKey,
|
|
2278
|
-
fill: color,
|
|
2279
|
-
radius: s.radius ?? [
|
|
2280
|
-
4,
|
|
2281
|
-
4,
|
|
2282
|
-
0,
|
|
2283
|
-
0
|
|
2284
|
-
],
|
|
2285
|
-
stackId: stacked ? "stack" : void 0
|
|
2286
|
-
}, s.dataKey);
|
|
2287
|
-
})
|
|
2288
|
-
]
|
|
2289
|
-
})
|
|
2290
|
-
})
|
|
2291
|
-
});
|
|
2292
|
-
});
|
|
2293
|
-
BarChart.displayName = "BarChart";
|
|
2294
|
-
//#endregion
|
|
2295
|
-
//#region src/components/donut-chart.tsx
|
|
2296
|
-
const DonutChart = React.forwardRef(({ className, data, nameKey = "name", dataKey = "value", colors, size = "md", height, showLegend = false, showTooltip = true, showLabels = false, innerRadius = "60%", outerRadius = "80%", paddingAngle = 2, centerLabel, ...props }, ref) => {
|
|
2297
|
-
const containerRef = React.useRef(null);
|
|
2298
|
-
const [themeColors, setThemeColors] = React.useState([]);
|
|
2299
|
-
React.useEffect(() => {
|
|
2300
|
-
const el = containerRef.current;
|
|
2301
|
-
setThemeColors(colors ?? getThemeColors(el));
|
|
2302
|
-
}, [colors]);
|
|
2303
|
-
const chartHeight = height ?? chartSizeMap[size];
|
|
2304
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2305
|
-
ref: (node) => {
|
|
2306
|
-
containerRef.current = node;
|
|
2307
|
-
if (typeof ref === "function") ref(node);
|
|
2308
|
-
else if (ref) ref.current = node;
|
|
2309
|
-
},
|
|
2310
|
-
className: cn("relative w-full", className),
|
|
2311
|
-
...props,
|
|
2312
|
-
children: [centerLabel && /* @__PURE__ */ jsx("div", {
|
|
2313
|
-
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
2314
|
-
"aria-hidden": "true",
|
|
2315
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
2316
|
-
className: "text-center",
|
|
2317
|
-
children: centerLabel
|
|
2318
|
-
})
|
|
2319
|
-
}), /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
2320
|
-
width: "100%",
|
|
2321
|
-
height: chartHeight,
|
|
2322
|
-
children: /* @__PURE__ */ jsxs(PieChart, { children: [
|
|
2323
|
-
/* @__PURE__ */ jsx(Pie, {
|
|
2324
|
-
data,
|
|
2325
|
-
nameKey,
|
|
2326
|
-
dataKey,
|
|
2327
|
-
innerRadius,
|
|
2328
|
-
outerRadius,
|
|
2329
|
-
paddingAngle,
|
|
2330
|
-
label: showLabels,
|
|
2331
|
-
strokeWidth: 0,
|
|
2332
|
-
children: data.map((_, i) => {
|
|
2333
|
-
return /* @__PURE__ */ jsx(Cell, { fill: themeColors[i % themeColors.length] ?? `hsl(var(--primary))` }, i);
|
|
2334
|
-
})
|
|
2335
|
-
}),
|
|
2336
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
2337
|
-
backgroundColor: "hsl(var(--popover))",
|
|
2338
|
-
border: "1px solid hsl(var(--border))",
|
|
2339
|
-
borderRadius: "var(--radius-md)",
|
|
2340
|
-
color: "hsl(var(--popover-foreground))",
|
|
2341
|
-
fontSize: 12
|
|
2342
|
-
} }),
|
|
2343
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {})
|
|
2344
|
-
] })
|
|
2345
|
-
})]
|
|
2346
|
-
});
|
|
2347
|
-
});
|
|
2348
|
-
DonutChart.displayName = "DonutChart";
|
|
2349
|
-
//#endregion
|
|
2350
2079
|
//#region src/blocks/auth/social-providers.tsx
|
|
2351
2080
|
const providerConfig = {
|
|
2352
2081
|
google: {
|
|
@@ -3672,6 +3401,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
|
|
|
3672
3401
|
});
|
|
3673
3402
|
}
|
|
3674
3403
|
//#endregion
|
|
3675
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock,
|
|
3404
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, 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, DataTable, DataTableColumnHeader, DensityProvider, 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, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, badgeVariants, buttonVariants, cn, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
|
|
3676
3405
|
|
|
3677
3406
|
//# sourceMappingURL=index.mjs.map
|