@platned/ui 0.10.3 → 1.0.0
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 +42 -98
- package/dist/blocks-charts.cjs +459 -0
- package/dist/blocks-charts.cjs.map +1 -0
- package/dist/blocks-charts.d.cts +64 -0
- package/dist/blocks-charts.d.ts +64 -0
- package/dist/blocks-charts.js +440 -0
- package/dist/blocks-charts.js.map +1 -0
- package/dist/blocks.cjs +8007 -0
- package/dist/blocks.cjs.map +1 -0
- package/dist/blocks.d.cts +3082 -0
- package/dist/blocks.d.ts +3082 -0
- package/dist/blocks.js +8223 -0
- package/dist/blocks.js.map +1 -0
- package/dist/chart.cjs +226 -0
- package/dist/chart.cjs.map +1 -0
- package/dist/chart.d.ts +66 -0
- package/dist/chart.js +183 -0
- package/dist/chart.js.map +1 -0
- package/dist/chunk-2L5XAYNK.js +11 -0
- package/dist/chunk-2L5XAYNK.js.map +1 -0
- package/dist/chunk-327NSKZW.js +3176 -0
- package/dist/chunk-327NSKZW.js.map +1 -0
- package/dist/chunk-GJJWRZ4B.js +200 -0
- package/dist/chunk-GJJWRZ4B.js.map +1 -0
- package/dist/chunk-WGCAQEZ4.js +178 -0
- package/dist/chunk-WGCAQEZ4.js.map +1 -0
- package/dist/code-block-BgEiLXpO.d.ts +111 -0
- package/dist/code-block-highlight.cjs +489 -0
- package/dist/code-block-highlight.cjs.map +1 -0
- package/dist/code-block-highlight.d.ts +28 -0
- package/dist/code-block-highlight.js +120 -0
- package/dist/code-block-highlight.js.map +1 -0
- package/dist/data-table-Dec6t8NO.d.ts +729 -0
- package/dist/data-table.cjs +3506 -2219
- package/dist/data-table.cjs.map +1 -1
- package/dist/data-table.d.ts +2 -1
- package/dist/data-table.js +1396 -246
- package/dist/data-table.js.map +1 -1
- package/dist/index.cjs +8932 -11975
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2524 -5312
- package/dist/index.js +4681 -9560
- package/dist/index.js.map +1 -1
- package/dist/map.cjs +432 -0
- package/dist/map.cjs.map +1 -0
- package/dist/map.d.cts +294 -0
- package/dist/map.d.ts +294 -0
- package/dist/map.js +422 -0
- package/dist/map.js.map +1 -0
- package/dist/theme.css +1897 -0
- package/package.json +65 -24
- package/dist/chunk-OVIRTNT4.js +0 -2787
- package/dist/chunk-OVIRTNT4.js.map +0 -1
- package/dist/data-table-JX-vnL0F.d.ts +0 -464
- package/dist/sidebar.cjs +0 -108
- package/dist/sidebar.cjs.map +0 -1
- package/dist/sidebar.d.cts +0 -257
- package/dist/sidebar.d.ts +0 -257
- package/dist/sidebar.js +0 -70
- package/dist/sidebar.js.map +0 -1
- package/dist/styles.css +0 -1
- package/dist/tokens.css +0 -1
- package/tailwind-preset.cjs +0 -446
package/README.md
CHANGED
|
@@ -18,142 +18,86 @@ Peer dependencies:
|
|
|
18
18
|
|---|---|---|
|
|
19
19
|
| `react`, `react-dom` | `>=18` | yes |
|
|
20
20
|
| `lucide-react` | `>=1.0.0` | yes — components render Lucide glyphs |
|
|
21
|
+
| `tailwindcss` | `>=4.0.0` | yes — the app compiles the components' classes |
|
|
21
22
|
| `react-router-dom` | `>=6` | **optional** — only for the `./sidebar` entry point |
|
|
22
23
|
|
|
23
|
-
`radix-ui`, `@tanstack/react-table`, `clsx` and `
|
|
24
|
+
`radix-ui`, `@tanstack/react-table`, `clsx`, `tailwind-merge` and `tw-animate-css` are regular dependencies, not
|
|
24
25
|
peers. They are implementation details.
|
|
25
26
|
|
|
26
27
|
## Usage
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
The library is styled with **Tailwind CSS v4**, so your app runs Tailwind v4 too. Import the
|
|
30
|
+
theme once in your main stylesheet, after Tailwind:
|
|
29
31
|
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
+
```css
|
|
33
|
+
/* app.css */
|
|
34
|
+
@import 'tailwindcss';
|
|
35
|
+
@import '@platned/ui/theme.css';
|
|
32
36
|
```
|
|
33
37
|
|
|
38
|
+
The theme brings the design tokens (light and dark), maps them onto Tailwind's theme, adds the
|
|
39
|
+
Platned utilities, and points Tailwind at the built components (`@source`), so their classes are
|
|
40
|
+
generated into your one stylesheet: one preflight, one copy of every utility, no layer ordering
|
|
41
|
+
to manage. Load Roboto and Roboto Mono yourself (Google Fonts or Fontsource).
|
|
42
|
+
|
|
34
43
|
Then import components:
|
|
35
44
|
|
|
36
45
|
```tsx
|
|
37
46
|
import { Button, Input, Select, Modal, DataTable } from '@platned/ui'
|
|
38
47
|
```
|
|
39
48
|
|
|
49
|
+
Your own classes use the same names as the components: the theme roles (`bg-primary`,
|
|
50
|
+
`text-muted-foreground`, `border-border`, `ring-ring/50`) and Tailwind's stock type, spacing,
|
|
51
|
+
radius and shadow scales (`text-sm`, `p-4`, `rounded-md`, `shadow-xs`).
|
|
52
|
+
|
|
40
53
|
### Dark mode
|
|
41
54
|
|
|
42
55
|
Add the `dark` class to `<html>`. Every component follows, because the tokens are CSS custom
|
|
43
|
-
properties rather than compiled values.
|
|
56
|
+
properties rather than compiled values, and the theme's `dark:` variant uses the same class.
|
|
44
57
|
|
|
45
58
|
```ts
|
|
46
59
|
document.documentElement.classList.toggle('dark')
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
Consume the preset so your own utility classes resolve against the same tokens:
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
// tailwind.config.js
|
|
55
|
-
module.exports = {
|
|
56
|
-
presets: [require('@platned/ui/tailwind-preset')],
|
|
57
|
-
content: ['./src/**/*.{ts,tsx}'],
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Use the preset's unprefixed names — `bg-brand`, `text-default`, `border-default`. A class the
|
|
62
|
-
preset does not define silently produces no CSS.
|
|
62
|
+
### Blocks
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`content` and import only the tokens:
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
// tailwind.config.js (Tailwind v3)
|
|
71
|
-
module.exports = {
|
|
72
|
-
presets: [require('@platned/ui/tailwind-preset')],
|
|
73
|
-
content: ['./src/**/*.{ts,tsx}', './node_modules/@platned/ui/dist/**/*.js'],
|
|
74
|
-
}
|
|
75
|
-
```
|
|
64
|
+
Blocks are whole compositions that render from data: you pass the JSON and they choose the
|
|
65
|
+
components. They are their own entry point, so their heavier dependencies stay out of the main
|
|
66
|
+
bundle.
|
|
76
67
|
|
|
77
68
|
```tsx
|
|
78
|
-
import '@platned/ui/
|
|
79
|
-
```
|
|
69
|
+
import { AppShell, Form, StatCards } from '@platned/ui/blocks'
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### App sidebar
|
|
84
|
-
|
|
85
|
-
The collapsible nav rail is a separate entry point because it needs `react-router-dom`, which
|
|
86
|
-
is an optional peer — importing the main bundle never pulls it in. It takes its nav as data and
|
|
87
|
-
its brand and footer as slots.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
import { AppSidebar, SidebarUserCard } from '@platned/ui/sidebar'
|
|
91
|
-
|
|
92
|
-
const [collapsed, setCollapsed] = useState(false)
|
|
93
|
-
|
|
94
|
-
<AppSidebar
|
|
95
|
-
groups={[
|
|
96
|
-
{ items: [
|
|
97
|
-
{ to: '/dashboard', label: 'Dashboard', icon: <LayoutGridIcon />, end: true },
|
|
98
|
-
{ to: '/entities', label: 'Entities', icon: <LayersIcon />, indicator: true },
|
|
99
|
-
] },
|
|
100
|
-
{ title: 'Review', items: [
|
|
101
|
-
{ to: '/queue', label: 'Review queue', icon: <ClipboardListIcon /> },
|
|
102
|
-
] },
|
|
103
|
-
]}
|
|
104
|
-
collapsed={collapsed}
|
|
105
|
-
onToggle={() => setCollapsed(c => !c)}
|
|
106
|
-
brand={({ collapsed }) => (collapsed ? <Mark /> : <Logo />)}
|
|
107
|
-
footerNav={[{ to: '/settings', label: 'Settings', icon: <SettingsIcon /> }]}
|
|
108
|
-
footer={
|
|
109
|
-
<SidebarUserCard name={user.name} role={user.role} collapsed={collapsed} onLogout={signOut} />
|
|
110
|
-
}
|
|
111
|
-
/>
|
|
71
|
+
<StatCards stats={[{ label: 'Revenue', value: 48200, format: { type: 'currency' }, change: 12.5 }]} />
|
|
112
72
|
```
|
|
113
73
|
|
|
114
74
|
## Package entries
|
|
115
75
|
|
|
116
76
|
| Import | Contents |
|
|
117
77
|
|---|---|
|
|
118
|
-
| `@platned/ui` | Every
|
|
119
|
-
| `@platned/ui/
|
|
120
|
-
| `@platned/ui/
|
|
121
|
-
| `@platned/ui/
|
|
122
|
-
| `@platned/ui/
|
|
78
|
+
| `@platned/ui` | Every component |
|
|
79
|
+
| `@platned/ui/blocks` | The blocks: `AppShell`, `SettingsDialog`, `StatCards` / `StatCard`, `ListDetail`, `Form` |
|
|
80
|
+
| `@platned/ui/data-table` | `DataTable`, on its own so TanStack Table loads only where it is used |
|
|
81
|
+
| `@platned/ui/chart` | `ChartContainer` and its parts, over Recharts (an optional peer) |
|
|
82
|
+
| `@platned/ui/code-block-highlight` | Syntax highlighting for `CodeBlock`, over Shiki (an optional peer) |
|
|
83
|
+
| `@platned/ui/theme.css` | The theme for a Tailwind v4 app: tokens, theme mapping, utilities and `@source`. Import once after `@import 'tailwindcss'` |
|
|
123
84
|
|
|
124
85
|
## Components
|
|
125
86
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
**Forms & inputs** — `Button`, `IconButton`, `ButtonGroup`, `Input`, `Textarea`,
|
|
130
|
-
`PasswordInput`, `InputGroup`, `SearchInput`, `InputOTP`, `Select`, `Combobox`, `Command`,
|
|
131
|
-
`DatePicker`, `Calendar`, `Checkbox`, `Switch`, `Toggle`, `ToggleGroup`, `RadioGroup`,
|
|
132
|
-
`SegmentedControl`, `MultiSelectCard`, `Slider`, `Stepper`, `FileDropZone`, `Label`,
|
|
133
|
-
`Field` and parts, `ControlSizeProvider`
|
|
134
|
-
|
|
135
|
-
**Data display** — `Badge`, `StatusBadge`, `StatusDot`, `StatusChip`, `TagPill`, `CountBadge`,
|
|
136
|
-
`RoleBadge`, `UserStatusPill`, `TrailChip`, `CheckIndicator`, `EntityIconBadge`, `DataTable`
|
|
137
|
-
and cell parts, `Table` and parts, `ListRow`, `FileRow`, `ScoredRow`, `NumberedList`,
|
|
138
|
-
`IconTextRow`, `ChecklistRow`, `StepsList`, `DetailItem`, `DetailGrid`, `CheckedGroupList`,
|
|
139
|
-
`StatTile`, `StatNumber`, `ScoreValue`, `TileGrid`, `Avatar`, `AvatarGroup`, `AvatarBlock`
|
|
140
|
-
|
|
141
|
-
**Data visualisation** — `Sparkline`, `MiniBarChart`, `BarChart`, `DonutChart`, `RadialGauge`,
|
|
142
|
-
`ChartLegend`, `LegendDot`, `TrendLabel`
|
|
143
|
-
|
|
144
|
-
**Layout & containers** — `Card` and parts, `AspectRatio`, `ScrollArea`, `Carousel`,
|
|
145
|
-
`Resizable`, `Accordion`, `Collapsible`, `Separator`, `Kbd`, `Skeleton`, `Spinner`,
|
|
146
|
-
`WidgetHeader`, `WidgetTitle`, `WidgetFooter`
|
|
147
|
-
|
|
148
|
-
**Page chrome** — `PageHeading`, `PageToolbar`, `FilterBar`, `Tabs`, `EyebrowLabel`, `NavItem`,
|
|
149
|
-
`Breadcrumb`, `NavigationMenu`, `Pagination`
|
|
150
|
-
|
|
151
|
-
**Overlays** — `Modal`, `Drawer`, `ConfirmDialog`, `NoteConfirmModal`, `BlockedModal`,
|
|
152
|
-
`DropdownMenu`, `ContextMenu`, `Menubar`, `Popover`, `HoverCard`, `Tooltip`, `Portal`
|
|
87
|
+
One docs page per component, and every component is exported from the package root (the folder
|
|
88
|
+
layout is internal):
|
|
153
89
|
|
|
154
|
-
|
|
90
|
+
Accordion, Alert, Alert Dialog, Aspect Ratio, Attachment, Avatar, Badge, Breadcrumb, Bubble,
|
|
91
|
+
Button, Button Group, Calendar, Card, Carousel, Chart, Checkbox, Code Block, Collapsible,
|
|
92
|
+
Combobox, Command, Context Menu, Data Table, Date Picker, Dialog, Direction, Drawer, Dropdown
|
|
93
|
+
Menu, Empty, Field, Hover Card, Input, Input Group, Input OTP, Item, Kbd, Label, Marker, Menubar,
|
|
94
|
+
Message, Message Scroller, Native Select, Navigation Menu, Pagination, Popover, Progress,
|
|
95
|
+
Questionnaire, Radio Group, Resizable, Scroll Area, Select, Separator, Sheet, Sidebar, Skeleton,
|
|
96
|
+
Slider, Sonner, Spinner, Switch, Table, Tabs, Textarea, Toggle, Toggle Group, Tooltip, Trace,
|
|
97
|
+
Typography.
|
|
155
98
|
|
|
156
|
-
|
|
99
|
+
Two helpers come with them: `cn`, which joins class names and lets a `className` you pass win
|
|
100
|
+
over the component's own, and `PortalContainerProvider`, which sets where floating panels mount.
|
|
157
101
|
|
|
158
102
|
Icons are **not** re-exported. Import them from `lucide-react` at the call site.
|
|
159
103
|
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/blocks/charts.tsx
|
|
31
|
+
var charts_exports = {};
|
|
32
|
+
__export(charts_exports, {
|
|
33
|
+
CardChart: () => CardChart,
|
|
34
|
+
StatChart: () => StatChart
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(charts_exports);
|
|
37
|
+
|
|
38
|
+
// src/blocks/stat-chart.tsx
|
|
39
|
+
var import_react2 = require("react");
|
|
40
|
+
var import_recharts = require("recharts");
|
|
41
|
+
|
|
42
|
+
// src/components/charts/chart.tsx
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
var RechartsPrimitive = __toESM(require("recharts"), 1);
|
|
45
|
+
|
|
46
|
+
// src/lib/cn.ts
|
|
47
|
+
var import_clsx = require("clsx");
|
|
48
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
49
|
+
function cn(...inputs) {
|
|
50
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/components/charts/chart.tsx
|
|
54
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
|
+
var THEMES = { light: "", dark: ".dark" };
|
|
56
|
+
var INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
57
|
+
var ChartContext = (0, import_react.createContext)(null);
|
|
58
|
+
function useChart() {
|
|
59
|
+
const context = (0, import_react.useContext)(ChartContext);
|
|
60
|
+
if (!context) throw new Error("useChart must be used within a <ChartContainer />");
|
|
61
|
+
return context;
|
|
62
|
+
}
|
|
63
|
+
function ChartContainer({
|
|
64
|
+
id,
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
config,
|
|
68
|
+
initialDimension = INITIAL_DIMENSION,
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
71
|
+
const uniqueId = (0, import_react.useId)();
|
|
72
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "chart",
|
|
77
|
+
"data-chart": chartId,
|
|
78
|
+
className: cn(
|
|
79
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
80
|
+
className
|
|
81
|
+
),
|
|
82
|
+
...props,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartStyle, { id: chartId, config }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RechartsPrimitive.ResponsiveContainer, { initialDimension, children })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
) });
|
|
89
|
+
}
|
|
90
|
+
function ChartStyle({ id, config }) {
|
|
91
|
+
const colorConfig = Object.entries(config).filter(([, item]) => item.theme ?? item.color);
|
|
92
|
+
if (!colorConfig.length) return null;
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
"style",
|
|
95
|
+
{
|
|
96
|
+
dangerouslySetInnerHTML: {
|
|
97
|
+
__html: Object.entries(THEMES).map(
|
|
98
|
+
([theme, prefix]) => `
|
|
99
|
+
${prefix} [data-chart=${id}] {
|
|
100
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
101
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
102
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
103
|
+
}).join("\n")}
|
|
104
|
+
}
|
|
105
|
+
`
|
|
106
|
+
).join("\n")
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
112
|
+
function ChartTooltipContent({
|
|
113
|
+
active,
|
|
114
|
+
payload,
|
|
115
|
+
className,
|
|
116
|
+
indicator = "dot",
|
|
117
|
+
hideLabel = false,
|
|
118
|
+
hideIndicator = false,
|
|
119
|
+
label,
|
|
120
|
+
labelFormatter,
|
|
121
|
+
labelClassName,
|
|
122
|
+
formatter,
|
|
123
|
+
color,
|
|
124
|
+
nameKey,
|
|
125
|
+
labelKey
|
|
126
|
+
}) {
|
|
127
|
+
const { config } = useChart();
|
|
128
|
+
const tooltipLabel = (0, import_react.useMemo)(() => {
|
|
129
|
+
if (hideLabel || !payload?.length) return null;
|
|
130
|
+
const [item] = payload;
|
|
131
|
+
const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
|
|
132
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
133
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
134
|
+
if (labelFormatter) {
|
|
135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
|
|
136
|
+
}
|
|
137
|
+
if (!value) return null;
|
|
138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("font-medium", labelClassName), children: value });
|
|
139
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
140
|
+
if (!active || !payload?.length) return null;
|
|
141
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: cn(
|
|
146
|
+
"grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
children: [
|
|
150
|
+
!nestLabel ? tooltipLabel : null,
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
152
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
153
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
154
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: cn(
|
|
159
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
160
|
+
indicator === "dot" && "items-center"
|
|
161
|
+
),
|
|
162
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
163
|
+
itemConfig?.icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
167
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
168
|
+
"w-1": indicator === "line",
|
|
169
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
170
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
171
|
+
}),
|
|
172
|
+
style: { "--color-bg": indicatorColor, "--color-border": indicatorColor }
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"), children: [
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-1.5", children: [
|
|
177
|
+
nestLabel ? tooltipLabel : null,
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })
|
|
179
|
+
] }),
|
|
180
|
+
item.value != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
|
|
181
|
+
] })
|
|
182
|
+
] })
|
|
183
|
+
},
|
|
184
|
+
index
|
|
185
|
+
);
|
|
186
|
+
}) })
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
var ChartLegend = RechartsPrimitive.Legend;
|
|
192
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
|
|
193
|
+
const { config } = useChart();
|
|
194
|
+
if (!payload?.length) return null;
|
|
195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
196
|
+
const key = `${nameKey ?? item.dataKey ?? "value"}`;
|
|
197
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground", children: [
|
|
199
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(itemConfig.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-2 w-2 shrink-0 rounded-[2px]", style: { backgroundColor: item.color } }),
|
|
200
|
+
itemConfig?.label
|
|
201
|
+
] }, index);
|
|
202
|
+
}) });
|
|
203
|
+
}
|
|
204
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
205
|
+
if (typeof payload !== "object" || payload === null) return void 0;
|
|
206
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
207
|
+
let configLabelKey = key;
|
|
208
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
209
|
+
configLabelKey = payload[key];
|
|
210
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
211
|
+
configLabelKey = payloadPayload[key];
|
|
212
|
+
}
|
|
213
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/blocks/stat-chart.tsx
|
|
217
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
218
|
+
function StatChart({
|
|
219
|
+
kind,
|
|
220
|
+
points,
|
|
221
|
+
name,
|
|
222
|
+
colors = [],
|
|
223
|
+
formatValue,
|
|
224
|
+
centerLabel,
|
|
225
|
+
size = "default"
|
|
226
|
+
}) {
|
|
227
|
+
const gradient = (0, import_react2.useId)().replace(/:/g, "");
|
|
228
|
+
const config = { value: { label: name, color: "var(--chart-1)" } };
|
|
229
|
+
const tooltip = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
230
|
+
ChartTooltip,
|
|
231
|
+
{
|
|
232
|
+
cursor: false,
|
|
233
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
234
|
+
ChartTooltipContent,
|
|
235
|
+
{
|
|
236
|
+
hideIndicator: kind !== "donut",
|
|
237
|
+
formatter: (value, _name, item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "flex w-full justify-between gap-3", children: [
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-muted-foreground", children: String(item.payload?.label ?? "") }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-medium tabular-nums", children: formatValue ? formatValue(Number(value)) : String(value) })
|
|
240
|
+
] }),
|
|
241
|
+
hideLabel: true
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
if (kind === "donut") {
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartContainer, { config, className: "aspect-square h-24 w-24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_recharts.PieChart, { children: [
|
|
248
|
+
tooltip,
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Pie, { data: points, dataKey: "value", nameKey: "label", innerRadius: 30, outerRadius: 44, strokeWidth: 2, children: points.map((point, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Cell, { fill: colors[index] ?? `var(--chart-${index % 5 + 1})` }, point.label)) }),
|
|
250
|
+
centerLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
251
|
+
"text",
|
|
252
|
+
{
|
|
253
|
+
x: "50%",
|
|
254
|
+
y: "50%",
|
|
255
|
+
textAnchor: "middle",
|
|
256
|
+
dominantBaseline: "middle",
|
|
257
|
+
className: "fill-foreground text-sm font-semibold",
|
|
258
|
+
children: centerLabel
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] }) });
|
|
262
|
+
}
|
|
263
|
+
const margin = { top: 4, right: 0, bottom: 0, left: 0 };
|
|
264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartContainer, { config, className: size === "lg" ? "aspect-auto h-28 w-full" : "aspect-auto h-16 w-full", children: kind === "bar" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_recharts.BarChart, { data: points, margin, children: [
|
|
265
|
+
tooltip,
|
|
266
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.YAxis, { hide: true, domain: [0, "auto"] }),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Bar, { dataKey: "value", fill: "var(--color-value)", fillOpacity: 0.85, radius: 3, maxBarSize: 14 })
|
|
268
|
+
] }) : kind === "line" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_recharts.LineChart, { data: points, margin, children: [
|
|
269
|
+
tooltip,
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.YAxis, { hide: true, domain: ["dataMin", "dataMax"] }),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Line, { dataKey: "value", type: "monotone", stroke: "var(--color-value)", strokeWidth: 2, dot: false })
|
|
272
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_recharts.AreaChart, { data: points, margin, children: [
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id: gradient, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "5%", stopColor: "var(--color-value)", stopOpacity: 0.4 }),
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "95%", stopColor: "var(--color-value)", stopOpacity: 0.05 })
|
|
276
|
+
] }) }),
|
|
277
|
+
tooltip,
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.YAxis, { hide: true, domain: ["dataMin", "dataMax"] }),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
280
|
+
import_recharts.Area,
|
|
281
|
+
{
|
|
282
|
+
baseValue: "dataMin",
|
|
283
|
+
dataKey: "value",
|
|
284
|
+
type: "monotone",
|
|
285
|
+
stroke: "var(--color-value)",
|
|
286
|
+
strokeWidth: 2,
|
|
287
|
+
fill: `url(#${gradient})`
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] }) });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// src/blocks/card-chart.tsx
|
|
294
|
+
var import_react3 = require("react");
|
|
295
|
+
var import_recharts2 = require("recharts");
|
|
296
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
297
|
+
var CURVE = { smooth: "monotone", linear: "linear", step: "step" };
|
|
298
|
+
function CardChart({
|
|
299
|
+
kind,
|
|
300
|
+
rows,
|
|
301
|
+
series,
|
|
302
|
+
stacked = false,
|
|
303
|
+
horizontal = false,
|
|
304
|
+
curve = "smooth",
|
|
305
|
+
legend = false,
|
|
306
|
+
valueAxis = false,
|
|
307
|
+
formatValue,
|
|
308
|
+
center,
|
|
309
|
+
fill = false
|
|
310
|
+
}) {
|
|
311
|
+
const gradient = (0, import_react3.useId)().replace(/:/g, "");
|
|
312
|
+
const config = Object.fromEntries(series.map((s) => [s.key, { label: s.label, color: s.color }]));
|
|
313
|
+
const format = (value) => formatValue && typeof value === "number" ? formatValue(value) : String(value);
|
|
314
|
+
const size = fill ? "aspect-auto h-full min-h-40 w-full" : "aspect-auto h-60 w-full";
|
|
315
|
+
if (kind === "donut" || kind === "pie") {
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
317
|
+
ChartContainer,
|
|
318
|
+
{
|
|
319
|
+
config,
|
|
320
|
+
className: cn("mx-auto aspect-square", fill ? "h-full max-h-full min-h-40" : "max-h-60"),
|
|
321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_recharts2.PieChart, { children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
323
|
+
ChartTooltip,
|
|
324
|
+
{
|
|
325
|
+
cursor: false,
|
|
326
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, { hideLabel: true, nameKey: "key", formatter: tooltipRow(format, config) })
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
330
|
+
import_recharts2.Pie,
|
|
331
|
+
{
|
|
332
|
+
data: rows,
|
|
333
|
+
dataKey: "value",
|
|
334
|
+
nameKey: "key",
|
|
335
|
+
innerRadius: kind === "donut" ? "58%" : 0,
|
|
336
|
+
outerRadius: "88%",
|
|
337
|
+
strokeWidth: 2,
|
|
338
|
+
stroke: "var(--card)",
|
|
339
|
+
children: [
|
|
340
|
+
rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Cell, { fill: series[index]?.color }, String(row.key))),
|
|
341
|
+
kind === "donut" && center && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
342
|
+
import_recharts2.Label,
|
|
343
|
+
{
|
|
344
|
+
content: ({ viewBox }) => {
|
|
345
|
+
if (!viewBox || !("cx" in viewBox) || !("cy" in viewBox)) return null;
|
|
346
|
+
const cx = Number(viewBox.cx);
|
|
347
|
+
const cy = Number(viewBox.cy);
|
|
348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tspan", { x: cx, y: center.label ? cy - 6 : cy, className: "fill-foreground text-2xl font-semibold", children: center.value }),
|
|
350
|
+
center.label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tspan", { x: cx, y: cy + 16, className: "fill-muted-foreground text-xs", children: center.label })
|
|
351
|
+
] });
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
] })
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
const tooltip = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
363
|
+
ChartTooltip,
|
|
364
|
+
{
|
|
365
|
+
cursor: kind === "bar",
|
|
366
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, { indicator: kind === "bar" ? "dot" : "line", formatter: tooltipRow(format, config) })
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
const labelWidth = Math.min(160, Math.max(48, 12 + 7 * Math.max(0, ...rows.map((row) => String(row.x ?? "").length))));
|
|
370
|
+
const legendNode = legend ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegendContent, {}), className: "flex-wrap" }) : null;
|
|
371
|
+
const categoryAxis = horizontal ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.YAxis, { dataKey: "x", type: "category", tickLine: false, axisLine: false, tickMargin: 8, width: labelWidth }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.XAxis, { dataKey: "x", tickLine: false, axisLine: false, tickMargin: 8, minTickGap: 16, interval: "preserveStartEnd" });
|
|
372
|
+
const numberAxis = horizontal ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.XAxis, { type: "number", hide: !valueAxis, tickLine: false, axisLine: false, tickFormatter: format }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.YAxis, { hide: !valueAxis, tickLine: false, axisLine: false, tickMargin: 4, width: valueAxis ? 48 : 0, tickFormatter: format });
|
|
373
|
+
const margin = { top: 8, right: 8, bottom: 0, left: valueAxis || horizontal ? 0 : 8 };
|
|
374
|
+
if (kind === "bar") {
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartContainer, { config, className: size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_recharts2.BarChart, { data: rows, layout: horizontal ? "vertical" : "horizontal", margin, accessibilityLayer: true, children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: horizontal, horizontal: !horizontal }),
|
|
377
|
+
categoryAxis,
|
|
378
|
+
numberAxis,
|
|
379
|
+
tooltip,
|
|
380
|
+
series.map((s, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
381
|
+
import_recharts2.Bar,
|
|
382
|
+
{
|
|
383
|
+
dataKey: s.key,
|
|
384
|
+
fill: `var(--color-${s.key})`,
|
|
385
|
+
stackId: stacked ? "stack" : void 0,
|
|
386
|
+
radius: stacked ? index === series.length - 1 ? horizontal ? [0, 4, 4, 0] : [4, 4, 0, 0] : 0 : 4,
|
|
387
|
+
maxBarSize: 40
|
|
388
|
+
},
|
|
389
|
+
s.key
|
|
390
|
+
)),
|
|
391
|
+
legendNode
|
|
392
|
+
] }) });
|
|
393
|
+
}
|
|
394
|
+
if (kind === "line") {
|
|
395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartContainer, { config, className: size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_recharts2.LineChart, { data: rows, margin, accessibilityLayer: true, children: [
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false }),
|
|
397
|
+
categoryAxis,
|
|
398
|
+
numberAxis,
|
|
399
|
+
tooltip,
|
|
400
|
+
series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
401
|
+
import_recharts2.Line,
|
|
402
|
+
{
|
|
403
|
+
dataKey: s.key,
|
|
404
|
+
type: CURVE[curve],
|
|
405
|
+
stroke: `var(--color-${s.key})`,
|
|
406
|
+
strokeWidth: 2,
|
|
407
|
+
dot: false,
|
|
408
|
+
connectNulls: true
|
|
409
|
+
},
|
|
410
|
+
s.key
|
|
411
|
+
)),
|
|
412
|
+
legendNode
|
|
413
|
+
] }) });
|
|
414
|
+
}
|
|
415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartContainer, { config, className: size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_recharts2.AreaChart, { data: rows, margin, accessibilityLayer: true, children: [
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: `${gradient}-${s.key}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "5%", stopColor: `var(--color-${s.key})`, stopOpacity: 0.6 }),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "95%", stopColor: `var(--color-${s.key})`, stopOpacity: 0.05 })
|
|
419
|
+
] }, s.key)) }),
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false }),
|
|
421
|
+
categoryAxis,
|
|
422
|
+
numberAxis,
|
|
423
|
+
tooltip,
|
|
424
|
+
series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
425
|
+
import_recharts2.Area,
|
|
426
|
+
{
|
|
427
|
+
dataKey: s.key,
|
|
428
|
+
type: CURVE[curve],
|
|
429
|
+
stroke: `var(--color-${s.key})`,
|
|
430
|
+
strokeWidth: 2,
|
|
431
|
+
fill: `url(#${gradient}-${s.key})`,
|
|
432
|
+
stackId: stacked ? "stack" : void 0,
|
|
433
|
+
connectNulls: true
|
|
434
|
+
},
|
|
435
|
+
s.key
|
|
436
|
+
)),
|
|
437
|
+
legendNode
|
|
438
|
+
] }) });
|
|
439
|
+
}
|
|
440
|
+
function tooltipRow(format, config) {
|
|
441
|
+
return (value, name, item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "flex w-full items-center gap-2", children: [
|
|
442
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
443
|
+
"span",
|
|
444
|
+
{
|
|
445
|
+
"aria-hidden": true,
|
|
446
|
+
className: "size-2.5 shrink-0 rounded-[2px]",
|
|
447
|
+
style: { background: item.color ?? item.payload?.fill }
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-muted-foreground", children: config[String(name)]?.label ?? String(name) }),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ms-auto font-medium text-foreground tabular-nums", children: format(value) })
|
|
452
|
+
] });
|
|
453
|
+
}
|
|
454
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
455
|
+
0 && (module.exports = {
|
|
456
|
+
CardChart,
|
|
457
|
+
StatChart
|
|
458
|
+
});
|
|
459
|
+
//# sourceMappingURL=blocks-charts.cjs.map
|