@acronis-platform/ui-react 3.0.0 → 4.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/dist/components/ui/accordion-container/accordion-container.js +14 -14
- package/dist/components/ui/accordion-container/accordion-container.js.map +1 -1
- package/dist/components/ui/app-shell-chat/app-shell-chat.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +141 -139
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +295 -293
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/category-bar/category-bar.js +109 -93
- package/dist/components/ui/category-bar/category-bar.js.map +1 -1
- package/dist/components/ui/chart/chart-palette.js +113 -0
- package/dist/components/ui/chart/chart-palette.js.map +1 -0
- package/dist/components/ui/chart/chart.js +176 -129
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state-illustrations.js +310 -0
- package/dist/components/ui/chart-state/chart-state-illustrations.js.map +1 -0
- package/dist/components/ui/chart-state/chart-state.js +48 -34
- package/dist/components/ui/chart-state/chart-state.js.map +1 -1
- package/dist/components/ui/chart-widget/chart-widget.js +87 -0
- package/dist/components/ui/chart-widget/chart-widget.js.map +1 -0
- package/dist/components/ui/composed-chart/composed-chart.js +117 -115
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +166 -158
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/funnel-chart/funnel-chart.js +162 -161
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +94 -92
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/label/label.js +2 -9
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +143 -141
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +74 -185
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/page-content/page-content.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +201 -195
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +133 -131
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +297 -265
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +123 -101
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +76 -74
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/section/section.js +157 -31
- package/dist/components/ui/section/section.js.map +1 -1
- package/dist/components/ui/stepper/stepper.js +24 -24
- package/dist/components/ui/stepper/stepper.js.map +1 -1
- package/dist/components/ui/stepper-item/stepper-item.js +43 -24
- package/dist/components/ui/stepper-item/stepper-item.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +133 -124
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/components/ui/trend-indicator/trend-indicator.js +34 -69
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -1
- package/dist/components/ui/wizard/wizard.js +59 -0
- package/dist/components/ui/wizard/wizard.js.map +1 -0
- package/dist/hooks/use-wizard.js +75 -0
- package/dist/hooks/use-wizard.js.map +1 -0
- package/dist/index.js +502 -497
- package/dist/index.js.map +1 -1
- package/dist/llms/accordion-container.md +181 -0
- package/dist/llms/accordion.md +124 -0
- package/dist/llms/alert.md +225 -0
- package/dist/llms/app-shell-chat.md +415 -0
- package/dist/llms/area-chart.md +355 -0
- package/dist/llms/avatar.md +208 -0
- package/dist/llms/bar-chart.md +406 -0
- package/dist/llms/breadcrumb.md +326 -0
- package/dist/llms/button-group.md +298 -0
- package/dist/llms/button-icon-input.md +142 -0
- package/dist/llms/button-icon-menu.md +209 -0
- package/dist/llms/button-icon.md +128 -0
- package/dist/llms/button-menu.md +172 -0
- package/dist/llms/button.md +185 -0
- package/dist/llms/calendar-panel.md +733 -0
- package/dist/llms/calendar.md +188 -0
- package/dist/llms/card-filter.md +214 -0
- package/dist/llms/card-section.md +293 -0
- package/dist/llms/card.md +447 -0
- package/dist/llms/carousel-dialog.md +156 -0
- package/dist/llms/category-bar.md +193 -0
- package/dist/llms/chart-state.md +190 -0
- package/dist/llms/chart-widget.md +209 -0
- package/dist/llms/chart.md +182 -0
- package/dist/llms/checkbox.md +257 -0
- package/dist/llms/chip.md +195 -0
- package/dist/llms/combobox.md +164 -0
- package/dist/llms/composed-chart.md +508 -0
- package/dist/llms/confidence-cone.md +277 -0
- package/dist/llms/data-table.md +474 -0
- package/dist/llms/date-range-picker.md +272 -0
- package/dist/llms/description-list.md +131 -0
- package/dist/llms/dialog-footer-carousel.md +147 -0
- package/dist/llms/dialog-footer-default.md +142 -0
- package/dist/llms/dialog-root.md +246 -0
- package/dist/llms/dialog-welcome.md +223 -0
- package/dist/llms/dialog.md +403 -0
- package/dist/llms/dropdown-menu.md +193 -0
- package/dist/llms/empty-overlay.md +146 -0
- package/dist/llms/empty.md +156 -0
- package/dist/llms/field.md +185 -0
- package/dist/llms/filter-cards.md +157 -0
- package/dist/llms/filter-chips.md +323 -0
- package/dist/llms/filter-search.md +512 -0
- package/dist/llms/form.md +154 -0
- package/dist/llms/funnel-chart.md +333 -0
- package/dist/llms/grid.md +80 -0
- package/dist/llms/histogram.md +190 -0
- package/dist/llms/input-date-picker.md +203 -0
- package/dist/llms/input-otp.md +173 -0
- package/dist/llms/input-password.md +197 -0
- package/dist/llms/input-search.md +170 -0
- package/dist/llms/input-select.md +278 -0
- package/dist/llms/input-text-area.md +271 -0
- package/dist/llms/input-text.md +192 -0
- package/dist/llms/line-chart.md +369 -0
- package/dist/llms/link.md +209 -0
- package/dist/llms/loading.md +130 -0
- package/dist/llms/meter.md +177 -0
- package/dist/llms/metric.md +204 -0
- package/dist/llms/number-field.md +122 -0
- package/dist/llms/page-content.md +69 -0
- package/dist/llms/page-header.md +182 -0
- package/dist/llms/pagination.md +133 -0
- package/dist/llms/pie-chart.md +307 -0
- package/dist/llms/popover.md +252 -0
- package/dist/llms/progress-circle.md +126 -0
- package/dist/llms/progress.md +111 -0
- package/dist/llms/radar-chart.md +316 -0
- package/dist/llms/radial-bar-chart.md +319 -0
- package/dist/llms/radio.md +255 -0
- package/dist/llms/resizable.md +195 -0
- package/dist/llms/sankey-chart.md +208 -0
- package/dist/llms/scatter-chart.md +239 -0
- package/dist/llms/scroll-area.md +183 -0
- package/dist/llms/section.md +401 -0
- package/dist/llms/select.md +210 -0
- package/dist/llms/separator.md +87 -0
- package/dist/llms/sheet.md +202 -0
- package/dist/llms/sidebar-primary.md +360 -0
- package/dist/llms/sidebar-secondary.md +417 -0
- package/dist/llms/skeleton.md +81 -0
- package/dist/llms/slider.md +97 -0
- package/dist/llms/spinner.md +100 -0
- package/dist/llms/stack.md +80 -0
- package/dist/llms/stepper-item.md +309 -0
- package/dist/llms/stepper.md +251 -0
- package/dist/llms/switch.md +140 -0
- package/dist/llms/table.md +436 -0
- package/dist/llms/tabs.md +197 -0
- package/dist/llms/tag.md +139 -0
- package/dist/llms/timeline.md +361 -0
- package/dist/llms/timer.md +259 -0
- package/dist/llms/toast.md +241 -0
- package/dist/llms/toggle-group.md +121 -0
- package/dist/llms/toolbar.md +453 -0
- package/dist/llms/tooltip.md +164 -0
- package/dist/llms/treemap.md +254 -0
- package/dist/llms/trend-indicator.md +132 -0
- package/dist/llms/widget-placeholder.md +169 -0
- package/dist/llms/wizard.md +412 -0
- package/dist/llms.txt +142 -0
- package/dist/react.js +502 -497
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
- package/dist/src/components/ui/category-bar/category-bar.d.ts +10 -4
- package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +48 -0
- package/dist/src/components/ui/chart/__tests__/chart-palette.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-palette.d.ts +128 -0
- package/dist/src/components/ui/chart/chart.d.ts +66 -15
- package/dist/src/components/ui/chart/index.d.ts +4 -2
- package/dist/src/components/ui/chart-state/chart-state-illustrations.d.ts +6 -0
- package/dist/src/components/ui/chart-state/chart-state.d.ts +13 -2
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/chart-widget/chart-widget.d.ts +64 -0
- package/dist/src/components/ui/chart-widget/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +12 -7
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +10 -5
- package/dist/src/components/ui/empty-overlay/empty-overlay.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
- package/dist/src/components/ui/histogram/histogram.d.ts +10 -4
- package/dist/src/components/ui/label/index.d.ts +1 -1
- package/dist/src/components/ui/label/label.d.ts +1 -5
- package/dist/src/components/ui/line-chart/line-chart.d.ts +9 -4
- package/dist/src/components/ui/metric/metric.d.ts +13 -14
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +17 -8
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +10 -5
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +17 -6
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +10 -5
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +10 -5
- package/dist/src/components/ui/section/index.d.ts +1 -1
- package/dist/src/components/ui/section/section.d.ts +75 -6
- package/dist/src/components/ui/stepper-item/stepper-item.d.ts +6 -5
- package/dist/src/components/ui/tag/tag.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +11 -5
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +3 -7
- package/dist/src/components/ui/wizard/index.d.ts +1 -0
- package/dist/src/components/ui/wizard/wizard.d.ts +6 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-wizard.d.ts +80 -0
- package/dist/src/index.d.ts +2 -3
- package/dist/ui-react.css +1 -1
- package/package.json +9 -3
- package/dist/components/ui/app-shell/app-shell.js +0 -75
- package/dist/components/ui/app-shell/app-shell.js.map +0 -1
- package/dist/components/ui/auth-layout/auth-layout.js +0 -56
- package/dist/components/ui/auth-layout/auth-layout.js.map +0 -1
- package/dist/components/ui/collapsible/collapsible.js +0 -22
- package/dist/components/ui/collapsible/collapsible.js.map +0 -1
- package/dist/src/components/ui/app-shell/app-shell.d.ts +0 -8
- package/dist/src/components/ui/app-shell/index.d.ts +0 -1
- package/dist/src/components/ui/auth-layout/auth-layout.d.ts +0 -6
- package/dist/src/components/ui/auth-layout/index.d.ts +0 -1
- package/dist/src/components/ui/collapsible/collapsible.d.ts +0 -5
- package/dist/src/components/ui/collapsible/index.d.ts +0 -1
- package/dist/src/components/ui/label/label.docs.d.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-state.js","sources":["../../../../src/components/ui/chart-state/chart-state.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"chart-state.js","sources":["../../../../src/components/ui/chart-state/chart-state.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { CircleWarningIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { Spinner } from '../spinner';\nimport {\n CHART_STATE_ILLUSTRATIONS,\n type ChartStateVariant,\n} from './chart-state-illustrations';\n\n// A shared loading / empty / error placeholder for the chart types. A chart can\n// only render once recharts' `ResponsiveContainer` has data and real dimensions,\n// so every type needs the same \"there's nothing to plot yet\" surface — this is\n// that surface, dropped in place of the chart inside the same sized slot.\n//\n// Ported from the Figma InputSelect dropdown states (the reference the task\n// points at) and kept visually in step with the shipped `InputSelectStatus`\n// sibling: the empty / error states use the same 24px glyph + `text-sm` label\n// and the same `--ui-glyph-on-status-*` icon tokens. (Loading uses the shared\n// `Spinner` — brand blue, larger — not the sibling's inline gray ring.) No\n// `--ui-chart-*` tier exists yet, so it themes from existing semantic tokens\n// directly:\n// • label -> text-foreground (--ui-text-on-surface-primary)\n// • empty icon -> --ui-glyph-on-status-info\n// • error icon -> --ui-glyph-on-status-warning\n// • loading -> the shared Spinner (brand action blue)\n// The generic full-page `Empty` component is the larger, page-level sibling;\n// this one is compact and fills a chart slot.\n\nconst DEFAULT_MESSAGE: Record<ChartStateProps['state'], string> = {\n loading: 'Data is loading…',\n empty: 'No data found',\n error: 'Something went wrong',\n};\n\nexport interface ChartStateProps extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'children'\n> {\n /** Which placeholder to show. Drives the leading glyph and default label. */\n state: 'loading' | 'empty' | 'error';\n /**\n * Which chart the slot holds. `empty` then draws that type's silhouette\n * instead of the generic inbox glyph — the design defines one per chart type.\n * Ignored by `loading` and `error`, which share one treatment.\n */\n variant?: ChartStateVariant;\n /**\n * Text shown below the illustration or glyph. Defaults to `\"Data is\n * loading…\"` / `\"No data found\"` / `\"Something went wrong\"` based on\n * `state`. Pass a value to override for any state.\n */\n description?: React.ReactNode;\n /** Trailing action (e.g. a \"Try again\" button) — shown for `error` only. */\n action?: React.ReactNode;\n}\n\nconst ChartState = React.forwardRef<HTMLDivElement, ChartStateProps>(\n (\n { className, state, variant, description, action, ...props },\n ref\n ) => {\n const Illustration = variant\n ? CHART_STATE_ILLUSTRATIONS[variant]\n : undefined;\n const caption = description ?? DEFAULT_MESSAGE[state];\n\n return (\n <div\n ref={ref}\n className={cn(\n 'flex size-full min-h-32 flex-col items-center justify-center gap-2 text-center text-sm leading-6 text-foreground',\n className\n )}\n {...props}\n // The status/alert live-region contract is intrinsic to the state, so it\n // wins over any consumer-passed a11y prop (spread above). No `aria-busy`\n // here: this element IS the live region, and some AT defer announcing a\n // busy region's content until busy clears — but this placeholder is\n // unmounted (swapped for the chart) rather than un-busied, so a busy flag\n // would risk swallowing the \"Data is loading…\" announcement. A consumer\n // that wants a busy signal sets `aria-busy` on the chart-slot container.\n role={state === 'error' ? 'alert' : 'status'}\n aria-live={state === 'error' ? 'assertive' : 'polite'}\n >\n {/* aria-hidden: the root is already the loading live region (+ the label),\n so the Spinner's own role=\"status\"/sr-only would double-announce. */}\n {state === 'loading' && <Spinner size=\"lg\" aria-hidden />}\n {state === 'empty' && Illustration && (\n // The tone is set once here, and every path inside is `currentColor`,\n // so brand and theme overrides follow. Figma binds the artwork to\n // `components/Avatar/color/blue`; this is the semantic token with the\n // identical light/dark pair, and \"status off\" is what an empty widget\n // is — referencing Avatar's tier from a chart would be a coupling with\n // no meaning behind it.\n // Scales with the slot rather than sitting at the mockup's 147×92:\n // the silhouette is the whole point of a per-type empty state, so it\n // takes the room the card gives it, capped so it stays a thumbnail\n // in a wide widget instead of a poster.\n <Illustration className=\"max-h-full w-full max-w-[220px] shrink text-[var(--ui-background-status-off)]\" />\n )}\n {state === 'error' && (\n <CircleWarningIcon\n size={24}\n className=\"text-[var(--ui-glyph-on-status-warning)]\"\n />\n )}\n <p>{caption}</p>\n {state === 'error' && action}\n </div>\n );\n }\n);\nChartState.displayName = 'ChartState';\n\nexport { ChartState };\n"],"names":["DEFAULT_MESSAGE","ChartState","React","className","state","variant","description","action","props","ref","Illustration","CHART_STATE_ILLUSTRATIONS","caption","jsxs","cn","jsx","Spinner","CircleWarningIcon"],"mappings":";;;;;;AA+BA,MAAMA,IAA4D;AAAA,EAChE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AACT,GAwBMC,IAAaC,EAAM;AAAA,EACvB,CACE,EAAE,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,EAAA,GACrDC,MACG;AACH,UAAMC,IAAeL,IACjBM,EAA0BN,CAAO,IACjC,QACEO,IAAUN,KAAeN,EAAgBI,CAAK;AAEpD,WACE,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAJ;AAAA,QACA,WAAWK;AAAA,UACT;AAAA,UACAX;AAAA,QAAA;AAAA,QAED,GAAGK;AAAA,QAQJ,MAAMJ,MAAU,UAAU,UAAU;AAAA,QACpC,aAAWA,MAAU,UAAU,cAAc;AAAA,QAI5C,UAAA;AAAA,UAAAA,MAAU,aAAa,gBAAAW,EAACC,GAAA,EAAQ,MAAK,MAAK,eAAW,IAAC;AAAA,UACtDZ,MAAU,WAAWM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAWpB,gBAAAK,EAACL,GAAA,EAAa,WAAU,gFAAA,CAAgF;AAAA,UAEzGN,MAAU,WACT,gBAAAW;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,UAGd,gBAAAF,EAAC,OAAG,UAAAH,EAAA,CAAQ;AAAA,UACXR,MAAU,WAAWG;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG5B;AACF;AACAN,EAAW,cAAc;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as w from "react";
|
|
3
|
+
import { cn as t } from "../../../lib/utils.js";
|
|
4
|
+
import { Card as C, CardHeader as g, CardContent as u } from "../card/card.js";
|
|
5
|
+
import { ChartState as N } from "../chart-state/chart-state.js";
|
|
6
|
+
const _ = w.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
className: s,
|
|
9
|
+
variant: n,
|
|
10
|
+
header: e,
|
|
11
|
+
orientation: i = "vertical",
|
|
12
|
+
metric: o,
|
|
13
|
+
state: a,
|
|
14
|
+
stateDescription: c,
|
|
15
|
+
stateAction: m,
|
|
16
|
+
bodyClassName: f,
|
|
17
|
+
children: h,
|
|
18
|
+
...p
|
|
19
|
+
}, x) => {
|
|
20
|
+
const l = i === "horizontal";
|
|
21
|
+
return /* @__PURE__ */ d(
|
|
22
|
+
C,
|
|
23
|
+
{
|
|
24
|
+
ref: x,
|
|
25
|
+
hasError: a === "error",
|
|
26
|
+
"data-slot": "chart-widget",
|
|
27
|
+
"data-orientation": i,
|
|
28
|
+
className: t("flex h-full w-full flex-col", s),
|
|
29
|
+
...p,
|
|
30
|
+
children: [
|
|
31
|
+
e ? /* @__PURE__ */ r(g, { ...e }) : null,
|
|
32
|
+
/* @__PURE__ */ d(
|
|
33
|
+
u,
|
|
34
|
+
{
|
|
35
|
+
className: t(
|
|
36
|
+
"min-h-0 flex-1 gap-4 pt-4",
|
|
37
|
+
// In horizontal mode override the default flex-col with flex-row so
|
|
38
|
+
// the metric and the chart sit side by side, each taking half the body.
|
|
39
|
+
l && "flex-row items-stretch",
|
|
40
|
+
f
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
o ? /* @__PURE__ */ r(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: t(
|
|
47
|
+
// Vertical: takes natural height, full width.
|
|
48
|
+
// Horizontal: flex-[1_0_0] matches Figma — equal half-width,
|
|
49
|
+
// no shrink (flex: 1 0 0), min-w-0 allows text to truncate.
|
|
50
|
+
l ? "min-w-0 flex-[1_0_0]" : "shrink-0"
|
|
51
|
+
),
|
|
52
|
+
"data-slot": "chart-widget-metric",
|
|
53
|
+
children: o
|
|
54
|
+
}
|
|
55
|
+
) : null,
|
|
56
|
+
/* @__PURE__ */ r(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: t(
|
|
60
|
+
"min-h-0",
|
|
61
|
+
l ? "min-w-0 flex-[1_0_0]" : "flex-1"
|
|
62
|
+
),
|
|
63
|
+
"data-slot": "chart-widget-body",
|
|
64
|
+
children: a ? /* @__PURE__ */ r(
|
|
65
|
+
N,
|
|
66
|
+
{
|
|
67
|
+
state: a,
|
|
68
|
+
variant: n,
|
|
69
|
+
description: c,
|
|
70
|
+
action: m
|
|
71
|
+
}
|
|
72
|
+
) : h
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
_.displayName = "ChartWidget";
|
|
84
|
+
export {
|
|
85
|
+
_ as ChartWidget
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=chart-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-widget.js","sources":["../../../../src/components/ui/chart-widget/chart-widget.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useRender } from '@base-ui/react/use-render';\n\nimport { cn } from '@/lib/utils';\nimport { Card, CardContent, CardHeader, type CardHeaderProps } from '../card';\nimport {\n ChartState,\n type ChartStateProps,\n type ChartStateVariant,\n} from '../chart-state';\n\n// A dashboard chart widget: the Card every chart mockup is wrapped in, plus the\n// one thing a Card doesn't know about — what the body shows while there is no\n// plot to show.\n//\n// Deliberately thin. `CardHeader` already owns the whole header surface (title,\n// description, extras, actions, drag handle, switch, avatar, rename, collapse\n// trigger) and draws the divider under itself, so this re-declares none of it:\n// `header` is typed as `CardHeaderProps` and spread, which means a header\n// feature added to Card arrives here for free instead of drifting.\n//\n// It owns no size either. The Figma `size` axis (sm/md/lg) only changes the\n// WIDTH (288/592/896), and every set is `HUG` vertically. So the height comes\n// from the dashboard grid, and the widget just passes it down: the header takes\n// what it needs, and the plot fills whatever is left (`flex-1 min-h-0` all the\n// way down, so a chart given `size-full` occupies the rest of the card).\n//\n// Dropped into a parent with no definite height, `h-full` resolves to `auto` and\n// the card hugs its content instead — so a standalone widget still works, with\n// the chart bringing its own height.\n//\n// The per-type chart components stay card-less on purpose. They are the plot;\n// the card is composition. That keeps `<AreaChart>` usable inside a table cell,\n// a popover, or a `Metric`'s sparkline slot, where a card would be wrong.\n//\n// Figma: every chart set wraps the `Card` set (`10012:195993`) — ChartArea\n// `8174:22232`, ChartBar `8700:55606`, ChartDonut `8811:172438`, and so on.\n\nexport interface ChartWidgetProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'title'\n> {\n /**\n * Replace the rendered `<div>` with another element or component (Base UI\n * composition), forwarded to `Card`. This is how a dashboard gives each\n * widget a landmark role — `render={<section aria-label=\"Sessions\" />}` — the\n * one thing the widget can't infer for itself.\n */\n render?: useRender.RenderProp;\n /**\n * Which chart the widget holds. Only used while `state=\"empty\"`, to pick the\n * silhouette the design draws for that chart type — the widget itself needs\n * no size, so this carries nothing else.\n */\n variant?: ChartStateVariant;\n /**\n * The card header, forwarded verbatim to `CardHeader`. Everything that\n * component takes works here — `title`, `actions` (the ⋯ menu), `extras` (a\n * filter chip), `isDraggable`, `hasRename`, … Omit it for a header-less\n * widget.\n */\n header?: CardHeaderProps;\n /**\n * The readout beside or above the plot — typically a `Metric`.\n *\n * - `'vertical'` (default) — metric above the plot, full width. The metric\n * takes its natural height; the plot fills the rest of the card body.\n * - `'horizontal'` — metric and plot side by side, each `flex-1`. Use for\n * compact widgets (sm/288px) where vertical space is at a premium.\n *\n * Figma: vertical → `8174:22335`, horizontal → `8982:31681`.\n */\n orientation?: 'vertical' | 'horizontal';\n /**\n * The readout beside or above the plot — typically a `Metric`. Layout is\n * controlled by `orientation`.\n */\n metric?: React.ReactNode;\n /**\n * Show a placeholder instead of the plot, for a widget whose data isn't there\n * yet. `error` also gives the card its error border.\n */\n state?: ChartStateProps['state'];\n /**\n * Text below the placeholder illustration or glyph — defaults to\n * `\"Data is loading…\"` / `\"No data found\"` / `\"Something went wrong\"`.\n */\n stateDescription?: ChartStateProps['description'];\n /** Trailing action on the `error` placeholder — e.g. a \"Try again\" button. */\n stateAction?: ChartStateProps['action'];\n /**\n * Class for the card body. Rarely needed — the body already fills the card.\n * Use it where nothing above gives a height and the content can't either, e.g.\n * a placeholder-only widget outside a sized grid cell.\n */\n bodyClassName?: string;\n /** The chart. Replaced by the placeholder while `state` is set. */\n children?: React.ReactNode;\n}\n\nconst ChartWidget = React.forwardRef<HTMLDivElement, ChartWidgetProps>(\n (\n {\n className,\n variant,\n header,\n orientation = 'vertical',\n metric,\n state,\n stateDescription,\n stateAction,\n bodyClassName,\n children,\n ...props\n },\n ref\n ) => {\n const isHorizontal = orientation === 'horizontal';\n return (\n <Card\n ref={ref}\n // The error border belongs to Card, so a caller sets `state=\"error\"` once\n // rather than wiring the placeholder and the border separately.\n hasError={state === 'error'}\n data-slot=\"chart-widget\"\n data-orientation={orientation}\n // `h-full` + a flex column is what lets the plot fill the card: the grid\n // sizes this, the header is `shrink-0`, and the body takes the rest.\n className={cn('flex h-full w-full flex-col', className)}\n {...props}\n >\n {header ? <CardHeader {...header} /> : null}\n {/* `CardContent` brings `px-4 pb-4`; the design's body is padded on all\n four sides with a 16px gap between the metric row and the plot. */}\n <CardContent\n className={cn(\n 'min-h-0 flex-1 gap-4 pt-4',\n // In horizontal mode override the default flex-col with flex-row so\n // the metric and the chart sit side by side, each taking half the body.\n isHorizontal && 'flex-row items-stretch',\n bodyClassName\n )}\n >\n {metric ? (\n <div\n className={cn(\n // Vertical: takes natural height, full width.\n // Horizontal: flex-[1_0_0] matches Figma — equal half-width,\n // no shrink (flex: 1 0 0), min-w-0 allows text to truncate.\n isHorizontal ? 'min-w-0 flex-[1_0_0]' : 'shrink-0'\n )}\n data-slot=\"chart-widget-metric\"\n >\n {metric}\n </div>\n ) : null}\n {/* `min-h-0` matters: without it a flex child refuses to shrink below\n its content's height, so a chart would push the card past the height\n the grid gave it instead of fitting inside. */}\n <div\n className={cn(\n 'min-h-0',\n isHorizontal ? 'min-w-0 flex-[1_0_0]' : 'flex-1'\n )}\n data-slot=\"chart-widget-body\"\n >\n {state ? (\n <ChartState\n state={state}\n variant={variant}\n description={stateDescription}\n action={stateAction}\n />\n ) : (\n children\n )}\n </div>\n </CardContent>\n </Card>\n );\n }\n);\nChartWidget.displayName = 'ChartWidget';\n\nexport { ChartWidget };\n"],"names":["ChartWidget","React","className","variant","header","orientation","metric","state","stateDescription","stateAction","bodyClassName","children","props","ref","isHorizontal","jsxs","Card","cn","jsx","CardHeader","CardContent","ChartState"],"mappings":";;;;;AAsGA,MAAMA,IAAcC,EAAM;AAAA,EACxB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAeT,MAAgB;AACrC,WACE,gBAAAU;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAH;AAAA,QAGA,UAAUN,MAAU;AAAA,QACpB,aAAU;AAAA,QACV,oBAAkBF;AAAA,QAGlB,WAAWY,EAAG,+BAA+Bf,CAAS;AAAA,QACrD,GAAGU;AAAA,QAEH,UAAA;AAAA,UAAAR,IAAS,gBAAAc,EAACC,GAAA,EAAY,GAAGf,EAAA,CAAQ,IAAK;AAAA,UAGvC,gBAAAW;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,WAAWH;AAAA,gBACT;AAAA;AAAA;AAAA,gBAGAH,KAAgB;AAAA,gBAChBJ;AAAA,cAAA;AAAA,cAGD,UAAA;AAAA,gBAAAJ,IACC,gBAAAY;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAWD;AAAA;AAAA;AAAA;AAAA,sBAITH,IAAe,yBAAyB;AAAA,oBAAA;AAAA,oBAE1C,aAAU;AAAA,oBAET,UAAAR;AAAA,kBAAA;AAAA,gBAAA,IAED;AAAA,gBAIJ,gBAAAY;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAWD;AAAA,sBACT;AAAA,sBACAH,IAAe,yBAAyB;AAAA,oBAAA;AAAA,oBAE1C,aAAU;AAAA,oBAET,UAAAP,IACC,gBAAAW;AAAA,sBAACG;AAAA,sBAAA;AAAA,wBACC,OAAAd;AAAA,wBACA,SAAAJ;AAAA,wBACA,aAAaK;AAAA,wBACb,QAAQC;AAAA,sBAAA;AAAA,oBAAA,IAGVE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAEJ;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAX,EAAY,cAAc;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as o, jsxs as T, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { ComposedChart as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { resolveAnimation as
|
|
7
|
-
import { ChartLegendContent as ge, ChartContainer as
|
|
8
|
-
const
|
|
2
|
+
import * as gt from "react";
|
|
3
|
+
import { cva as At } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { ComposedChart as Ct, CartesianGrid as bt, Brush as Rt, XAxis as B, YAxis as z, LabelList as Lt, Bar as Dt, Area as It, Line as xt, ReferenceArea as Et, ReferenceLine as _t } from "recharts";
|
|
5
|
+
import { cn as St } from "../../../lib/utils.js";
|
|
6
|
+
import { resolveAnimation as Nt, resolveCategoryRange as he, resolveChartReferenceValue as Tt, CHART_LABEL_MARGIN as Bt, resolveBrushProps as zt, resolveRotatedTickAnchor as ve, resolveCartesianLabelPosition as Ot, CHART_LABEL_FONT_SIZE as wt, resolveLabelFillClass as Ft, toLabelFormatter as Vt, resolveReferenceLineProps as $t, resolveXAxisTitle as ue, resolveXAxisHeight as Mt, resolveAxisDomain as me, resolveYAxisTitle as ke } from "../chart/chart-format.js";
|
|
7
|
+
import { ChartLegendContent as ge, ChartContainer as Ht, ChartTooltip as Wt, ChartTooltipContent as Kt, ChartLegend as Xt } from "../chart/chart.js";
|
|
8
|
+
const Pt = At("", {
|
|
9
9
|
variants: {
|
|
10
10
|
orientation: {
|
|
11
11
|
vertical: "",
|
|
@@ -15,10 +15,11 @@ const Xt = gt("", {
|
|
|
15
15
|
defaultVariants: {
|
|
16
16
|
orientation: "vertical"
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
18
|
+
}), Gt = 100, Zt = 50, O = "secondary", jt = { top: 5, right: 5, bottom: 5, left: 5 }, Ut = 0.85, qt = { top: 16 }, Jt = gt.forwardRef(
|
|
19
19
|
({
|
|
20
20
|
className: Ae,
|
|
21
21
|
config: Ce,
|
|
22
|
+
palette: be,
|
|
22
23
|
data: y,
|
|
23
24
|
series: c,
|
|
24
25
|
xKey: d,
|
|
@@ -27,26 +28,26 @@ const Xt = gt("", {
|
|
|
27
28
|
orientation: g = "vertical",
|
|
28
29
|
xAxisLabel: w,
|
|
29
30
|
yAxisLabel: A,
|
|
30
|
-
xUnit:
|
|
31
|
-
yUnit:
|
|
31
|
+
xUnit: Re,
|
|
32
|
+
yUnit: Le,
|
|
32
33
|
curve: F = "monotone",
|
|
33
|
-
barRadius:
|
|
34
|
-
barSize:
|
|
35
|
-
barGap:
|
|
36
|
-
barCategoryGap:
|
|
37
|
-
showBackground:
|
|
38
|
-
backgroundFill:
|
|
39
|
-
showActiveBar:
|
|
40
|
-
fillOpacity:
|
|
34
|
+
barRadius: De = 4,
|
|
35
|
+
barSize: Ie,
|
|
36
|
+
barGap: xe,
|
|
37
|
+
barCategoryGap: Ee,
|
|
38
|
+
showBackground: _e = !1,
|
|
39
|
+
backgroundFill: Se = "var(--ui-background-surface-secondary)",
|
|
40
|
+
showActiveBar: Ne = !1,
|
|
41
|
+
fillOpacity: Te = 0.3,
|
|
41
42
|
strokeWidth: V,
|
|
42
|
-
showDots:
|
|
43
|
-
showActiveDots:
|
|
44
|
-
connectNulls:
|
|
43
|
+
showDots: Be = !1,
|
|
44
|
+
showActiveDots: ze,
|
|
45
|
+
connectNulls: Oe = !1,
|
|
45
46
|
margin: C,
|
|
46
|
-
showGrid:
|
|
47
|
-
showTooltip:
|
|
48
|
-
tooltipCursor:
|
|
49
|
-
showLegend:
|
|
47
|
+
showGrid: we = !0,
|
|
48
|
+
showTooltip: Fe = !0,
|
|
49
|
+
tooltipCursor: Ve = !0,
|
|
50
|
+
showLegend: $e = !0,
|
|
50
51
|
legendPosition: b = "bottom",
|
|
51
52
|
showXAxis: $ = !0,
|
|
52
53
|
showYAxis: M = !0,
|
|
@@ -55,67 +56,67 @@ const Xt = gt("", {
|
|
|
55
56
|
xAxisAngle: f,
|
|
56
57
|
xAxisInterval: H,
|
|
57
58
|
yAxisTickCount: W,
|
|
58
|
-
yAxisDomain:
|
|
59
|
+
yAxisDomain: Me,
|
|
59
60
|
yAxisOrientation: D,
|
|
60
61
|
showSecondaryYAxis: K = !0,
|
|
61
62
|
secondaryYAxisLabel: I,
|
|
62
63
|
secondaryYUnit: X,
|
|
63
64
|
secondaryYTickFormatter: P,
|
|
64
65
|
secondaryYAxisTickCount: G,
|
|
65
|
-
secondaryYAxisDomain:
|
|
66
|
-
gridDashed:
|
|
67
|
-
gridHorizontal:
|
|
68
|
-
gridVertical:
|
|
69
|
-
tooltipContent:
|
|
70
|
-
animate:
|
|
71
|
-
animationDuration:
|
|
72
|
-
animationBegin:
|
|
73
|
-
animationEasing:
|
|
66
|
+
secondaryYAxisDomain: He,
|
|
67
|
+
gridDashed: We,
|
|
68
|
+
gridHorizontal: Ke,
|
|
69
|
+
gridVertical: Xe,
|
|
70
|
+
tooltipContent: Pe,
|
|
71
|
+
animate: Ge,
|
|
72
|
+
animationDuration: Ze,
|
|
73
|
+
animationBegin: je,
|
|
74
|
+
animationEasing: Ue,
|
|
74
75
|
showLabels: Z = !1,
|
|
75
|
-
labelPosition:
|
|
76
|
-
labelFormatter:
|
|
77
|
-
showBrush:
|
|
78
|
-
brushHeight:
|
|
79
|
-
brushAriaLabel:
|
|
80
|
-
...
|
|
81
|
-
},
|
|
82
|
-
const x =
|
|
83
|
-
animate:
|
|
84
|
-
animationDuration:
|
|
85
|
-
animationBegin:
|
|
86
|
-
animationEasing:
|
|
87
|
-
}), r = g === "horizontal", j = ue(w), u = c.some((e) => e.yAxis === "secondary"),
|
|
76
|
+
labelPosition: qe,
|
|
77
|
+
labelFormatter: Je,
|
|
78
|
+
showBrush: Qe = !1,
|
|
79
|
+
brushHeight: Ye,
|
|
80
|
+
brushAriaLabel: et,
|
|
81
|
+
...tt
|
|
82
|
+
}, ot) => {
|
|
83
|
+
const x = Nt({
|
|
84
|
+
animate: Ge,
|
|
85
|
+
animationDuration: Ze,
|
|
86
|
+
animationBegin: je,
|
|
87
|
+
animationEasing: Ue
|
|
88
|
+
}), r = g === "horizontal", j = ue(w), u = c.some((e) => e.yAxis === "secondary"), at = c.some((e) => e.yAxis !== "secondary"), m = u && !at, U = D ?? "left", q = U === "left" ? "right" : "left", J = ke(
|
|
88
89
|
A,
|
|
89
90
|
r ? "left" : U
|
|
90
|
-
),
|
|
91
|
+
), rt = ke(
|
|
91
92
|
I,
|
|
92
93
|
q
|
|
93
|
-
),
|
|
94
|
+
), it = ue(
|
|
94
95
|
I,
|
|
95
96
|
"insideTop"
|
|
96
|
-
), Q = me(
|
|
97
|
+
), Q = me(Me), Y = me(He), E = (e) => {
|
|
97
98
|
const t = e === "secondary" ? O : void 0;
|
|
98
99
|
return r ? { xAxisId: t } : { yAxisId: t };
|
|
99
|
-
}, ee = m ? E("secondary") : {}, te =
|
|
100
|
+
}, ee = m ? E("secondary") : {}, te = Mt(w, f), nt = h ? Array.isArray(h) ? h : [h] : [], st = (v ? Array.isArray(v) ? v : [v] : []).map((e) => ({ area: e, range: he(e, y, d) })).filter(
|
|
100
101
|
(e) => e.range !== void 0
|
|
101
|
-
), oe = m ? "secondary" : "primary", ae = (e) => e.yAxis ?? "primary",
|
|
102
|
+
), oe = m ? "secondary" : "primary", ae = (e) => e.yAxis ?? "primary", lt = new Map(c.map((e) => [e.key, ae(e)])), ct = (e) => c.filter((t) => ae(t) === e).map((t) => t.key), re = new Set(
|
|
102
103
|
c.filter((e) => e.legendType === "none").map((e) => e.key)
|
|
103
104
|
), p = (e) => {
|
|
104
105
|
var t;
|
|
105
106
|
return ((t = y[e]) == null ? void 0 : t[d]) ?? void 0;
|
|
106
|
-
}, ie =
|
|
107
|
+
}, ie = nt.map((e) => {
|
|
107
108
|
const t = e.category !== void 0 ? he(
|
|
108
109
|
{ from: e.category, to: e.category },
|
|
109
110
|
y,
|
|
110
111
|
d
|
|
111
|
-
) : void 0, a = e.yAxis ?? (typeof e.average == "string" ?
|
|
112
|
+
) : void 0, a = e.yAxis ?? (typeof e.average == "string" ? lt.get(e.average) ?? oe : oe), i = Tt(e, y, ct(a)), n = t ? p(t[0]) : void 0;
|
|
112
113
|
return { line: e, lineAxis: a, position: i !== void 0 ? r ? { x: i } : { y: i } : n !== void 0 ? r ? { y: n } : { x: n } : void 0, isVerticalRule: i !== void 0 === r };
|
|
113
114
|
}).filter(
|
|
114
115
|
(e) => e.position !== void 0
|
|
115
|
-
), ne = Z ?
|
|
116
|
+
), ne = Z ? Bt : void 0, se = ie.some(
|
|
116
117
|
(e) => e.line.label && e.isVerticalRule
|
|
117
|
-
) ?
|
|
118
|
-
...C ?
|
|
118
|
+
) ? qt : void 0, dt = C || ne || se ? {
|
|
119
|
+
...C ? jt : {},
|
|
119
120
|
...se,
|
|
120
121
|
...ne,
|
|
121
122
|
...C
|
|
@@ -123,7 +124,7 @@ const Xt = gt("", {
|
|
|
123
124
|
c.forEach((e, t) => {
|
|
124
125
|
e.stackId && e.type !== "line" && le.set(`${e.type}-${e.stackId}`, t);
|
|
125
126
|
});
|
|
126
|
-
const
|
|
127
|
+
const yt = () => /* @__PURE__ */ T(pe, { children: [
|
|
127
128
|
/* @__PURE__ */ o(
|
|
128
129
|
B,
|
|
129
130
|
{
|
|
@@ -131,7 +132,7 @@ const Xt = gt("", {
|
|
|
131
132
|
hide: !$ || m,
|
|
132
133
|
tickLine: !1,
|
|
133
134
|
axisLine: !1,
|
|
134
|
-
unit:
|
|
135
|
+
unit: Re,
|
|
135
136
|
tickFormatter: R,
|
|
136
137
|
angle: f,
|
|
137
138
|
interval: H,
|
|
@@ -168,10 +169,10 @@ const Xt = gt("", {
|
|
|
168
169
|
tickFormatter: P,
|
|
169
170
|
tickCount: G,
|
|
170
171
|
domain: Y,
|
|
171
|
-
label:
|
|
172
|
+
label: it
|
|
172
173
|
}
|
|
173
174
|
)
|
|
174
|
-
] }),
|
|
175
|
+
] }), ft = () => /* @__PURE__ */ T(pe, { children: [
|
|
175
176
|
/* @__PURE__ */ o(
|
|
176
177
|
B,
|
|
177
178
|
{
|
|
@@ -197,7 +198,7 @@ const Xt = gt("", {
|
|
|
197
198
|
...D ? { orientation: D } : {},
|
|
198
199
|
tickLine: !1,
|
|
199
200
|
axisLine: !1,
|
|
200
|
-
unit:
|
|
201
|
+
unit: Le,
|
|
201
202
|
tickFormatter: L,
|
|
202
203
|
tickCount: W,
|
|
203
204
|
domain: Q,
|
|
@@ -219,10 +220,10 @@ const Xt = gt("", {
|
|
|
219
220
|
tickCount: G,
|
|
220
221
|
domain: Y,
|
|
221
222
|
width: I ? 72 : void 0,
|
|
222
|
-
label:
|
|
223
|
+
label: rt
|
|
223
224
|
}
|
|
224
225
|
)
|
|
225
|
-
] }),
|
|
226
|
+
] }), pt = re.size > 0 ? (e) => {
|
|
226
227
|
var t;
|
|
227
228
|
return /* @__PURE__ */ o(
|
|
228
229
|
ge,
|
|
@@ -233,27 +234,27 @@ const Xt = gt("", {
|
|
|
233
234
|
)
|
|
234
235
|
}
|
|
235
236
|
);
|
|
236
|
-
} : /* @__PURE__ */ o(ge, { verticalAlign: b }),
|
|
237
|
-
const a = e.color ?? `var(--color-${e.key})`, i =
|
|
238
|
-
labelPosition:
|
|
237
|
+
} : /* @__PURE__ */ o(ge, { verticalAlign: b }), ht = (e, t) => {
|
|
238
|
+
const a = e.color ?? `var(--color-${e.key})`, i = Gt + t, n = E(e.yAxis), s = e.stackId && e.type !== "line" ? `${e.type}-${e.stackId}` : void 0, ce = e.fillOpacity ?? Te, de = e.connectNulls ?? Oe, ye = e.showDots ?? Be, k = e.showActiveDots ?? ze, _ = e.legendType ? { legendType: e.legendType } : {}, fe = Ot({
|
|
239
|
+
labelPosition: qe,
|
|
239
240
|
isStacked: s !== void 0,
|
|
240
241
|
growingEnd: r ? "right" : "top"
|
|
241
242
|
}), S = Z ? /* @__PURE__ */ o(
|
|
242
|
-
|
|
243
|
+
Lt,
|
|
243
244
|
{
|
|
244
245
|
dataKey: e.key,
|
|
245
246
|
position: fe,
|
|
246
|
-
formatter:
|
|
247
|
-
className:
|
|
247
|
+
formatter: Vt(Je),
|
|
248
|
+
className: Ft(fe, {
|
|
248
249
|
translucentSeries: e.type === "area"
|
|
249
250
|
}),
|
|
250
|
-
fontSize:
|
|
251
|
+
fontSize: wt
|
|
251
252
|
}
|
|
252
253
|
) : null;
|
|
253
254
|
if (e.type === "bar") {
|
|
254
|
-
const l = e.barRadius ??
|
|
255
|
+
const l = e.barRadius ?? De, N = s === void 0 || le.get(s) === t, mt = e.showBackground ?? _e, kt = e.showActiveBar ?? Ne;
|
|
255
256
|
return /* @__PURE__ */ o(
|
|
256
|
-
|
|
257
|
+
Dt,
|
|
257
258
|
{
|
|
258
259
|
dataKey: e.key,
|
|
259
260
|
...n,
|
|
@@ -268,8 +269,8 @@ const Xt = gt("", {
|
|
|
268
269
|
strokeDasharray: e.strokeDasharray,
|
|
269
270
|
...e.strokeWidth !== void 0 ? { strokeWidth: e.strokeWidth } : {}
|
|
270
271
|
} : {},
|
|
271
|
-
...
|
|
272
|
-
...
|
|
272
|
+
...mt ? { background: { fill: Se } } : {},
|
|
273
|
+
...kt ? { activeBar: { fillOpacity: Ut } } : {},
|
|
273
274
|
..._,
|
|
274
275
|
...x,
|
|
275
276
|
children: S
|
|
@@ -280,7 +281,7 @@ const Xt = gt("", {
|
|
|
280
281
|
if (e.type === "area") {
|
|
281
282
|
const l = e.strokeWidth ?? V, N = l !== void 0 ? { strokeWidth: l } : {};
|
|
282
283
|
return /* @__PURE__ */ o(
|
|
283
|
-
|
|
284
|
+
It,
|
|
284
285
|
{
|
|
285
286
|
type: e.curve ?? F,
|
|
286
287
|
dataKey: e.key,
|
|
@@ -303,7 +304,7 @@ const Xt = gt("", {
|
|
|
303
304
|
);
|
|
304
305
|
}
|
|
305
306
|
return /* @__PURE__ */ o(
|
|
306
|
-
|
|
307
|
+
xt,
|
|
307
308
|
{
|
|
308
309
|
type: e.curve ?? F,
|
|
309
310
|
dataKey: e.key,
|
|
@@ -321,16 +322,16 @@ const Xt = gt("", {
|
|
|
321
322
|
},
|
|
322
323
|
e.key
|
|
323
324
|
);
|
|
324
|
-
},
|
|
325
|
+
}, vt = ({ area: e, range: t }, a) => {
|
|
325
326
|
const [i, n] = t;
|
|
326
327
|
return /* @__PURE__ */ o(
|
|
327
|
-
|
|
328
|
+
Et,
|
|
328
329
|
{
|
|
329
330
|
...ee,
|
|
330
331
|
...r ? { y1: p(i), y2: p(n) } : { x1: p(i), x2: p(n) },
|
|
331
332
|
fill: "var(--ui-background-surface-secondary)",
|
|
332
333
|
fillOpacity: 0.6,
|
|
333
|
-
zIndex:
|
|
334
|
+
zIndex: Zt,
|
|
334
335
|
ifOverflow: "extendDomain",
|
|
335
336
|
label: e.label ? {
|
|
336
337
|
value: e.label,
|
|
@@ -341,17 +342,17 @@ const Xt = gt("", {
|
|
|
341
342
|
},
|
|
342
343
|
`${e.label ?? "area"}-${a}`
|
|
343
344
|
);
|
|
344
|
-
},
|
|
345
|
+
}, ut = ({
|
|
345
346
|
line: e,
|
|
346
347
|
lineAxis: t,
|
|
347
348
|
position: a,
|
|
348
349
|
isVerticalRule: i
|
|
349
350
|
}, n) => /* @__PURE__ */ o(
|
|
350
|
-
|
|
351
|
+
_t,
|
|
351
352
|
{
|
|
352
353
|
...t === "secondary" && u ? E("secondary") : {},
|
|
353
354
|
...a,
|
|
354
|
-
|
|
355
|
+
...$t(
|
|
355
356
|
e.label,
|
|
356
357
|
e.labelPosition ?? (i ? "top" : "insideTopRight")
|
|
357
358
|
)
|
|
@@ -361,58 +362,59 @@ const Xt = gt("", {
|
|
|
361
362
|
return /* @__PURE__ */ o(
|
|
362
363
|
"div",
|
|
363
364
|
{
|
|
364
|
-
ref:
|
|
365
|
+
ref: ot,
|
|
365
366
|
"data-orientation": g,
|
|
366
|
-
className:
|
|
367
|
-
...
|
|
367
|
+
className: St(Pt({ orientation: g }), Ae),
|
|
368
|
+
...tt,
|
|
368
369
|
children: /* @__PURE__ */ o(
|
|
369
|
-
|
|
370
|
+
Ht,
|
|
370
371
|
{
|
|
371
372
|
config: Ce,
|
|
373
|
+
palette: be,
|
|
372
374
|
className: "size-full [&_.recharts-label]:fill-foreground",
|
|
373
375
|
children: /* @__PURE__ */ T(
|
|
374
|
-
|
|
376
|
+
Ct,
|
|
375
377
|
{
|
|
376
378
|
data: y,
|
|
377
379
|
layout: r ? "vertical" : "horizontal",
|
|
378
|
-
barSize:
|
|
379
|
-
barGap:
|
|
380
|
-
barCategoryGap:
|
|
381
|
-
margin:
|
|
380
|
+
barSize: Ie,
|
|
381
|
+
barGap: xe,
|
|
382
|
+
barCategoryGap: Ee,
|
|
383
|
+
margin: dt,
|
|
382
384
|
children: [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
+
we && /* @__PURE__ */ o(
|
|
386
|
+
bt,
|
|
385
387
|
{
|
|
386
388
|
...ee,
|
|
387
|
-
horizontal:
|
|
388
|
-
vertical:
|
|
389
|
-
strokeDasharray:
|
|
389
|
+
horizontal: Ke ?? !r,
|
|
390
|
+
vertical: Xe ?? r,
|
|
391
|
+
strokeDasharray: We ? "3 3" : void 0
|
|
390
392
|
}
|
|
391
393
|
),
|
|
392
|
-
r ?
|
|
393
|
-
|
|
394
|
-
|
|
394
|
+
r ? yt() : ft(),
|
|
395
|
+
Fe && /* @__PURE__ */ o(
|
|
396
|
+
Wt,
|
|
395
397
|
{
|
|
396
|
-
...
|
|
397
|
-
content:
|
|
398
|
+
...Ve ? {} : { cursor: !1 },
|
|
399
|
+
content: Pe ?? /* @__PURE__ */ o(Kt, {})
|
|
398
400
|
}
|
|
399
401
|
),
|
|
400
|
-
|
|
401
|
-
|
|
402
|
+
$e && /* @__PURE__ */ o(
|
|
403
|
+
Xt,
|
|
402
404
|
{
|
|
403
405
|
verticalAlign: b,
|
|
404
|
-
content:
|
|
406
|
+
content: pt
|
|
405
407
|
}
|
|
406
408
|
),
|
|
407
|
-
c.map(
|
|
408
|
-
|
|
409
|
-
ie.map(
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
c.map(ht),
|
|
410
|
+
st.map(vt),
|
|
411
|
+
ie.map(ut),
|
|
412
|
+
Qe && /* @__PURE__ */ o(
|
|
413
|
+
Rt,
|
|
412
414
|
{
|
|
413
415
|
dataKey: d,
|
|
414
416
|
tickFormatter: r ? L : R,
|
|
415
|
-
...
|
|
417
|
+
...zt({ brushHeight: Ye, brushAriaLabel: et })
|
|
416
418
|
}
|
|
417
419
|
)
|
|
418
420
|
]
|
|
@@ -424,9 +426,9 @@ const Xt = gt("", {
|
|
|
424
426
|
);
|
|
425
427
|
}
|
|
426
428
|
);
|
|
427
|
-
|
|
429
|
+
Jt.displayName = "ComposedChart";
|
|
428
430
|
export {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
+
Jt as ComposedChart,
|
|
432
|
+
Pt as composedChartVariants
|
|
431
433
|
};
|
|
432
434
|
//# sourceMappingURL=composed-chart.js.map
|