@kumix/ui 0.4.3 → 0.5.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 +15 -13
- package/dist/components/agents/agent-activity/index.js +1 -1
- package/dist/components/agents/approval-card/index.js +2 -3
- package/dist/components/agents/approval-card/index.js.map +1 -1
- package/dist/components/agents/prompt-input.js +1 -2
- package/dist/components/agents/prompt-input.js.map +1 -1
- package/dist/components/agents/todo-list.js +1 -1
- package/dist/components/agents/tool-result.js +1 -1
- package/dist/components/charts/bar-chart/context.d.ts +114 -0
- package/dist/components/charts/bar-chart/context.d.ts.map +1 -0
- package/dist/components/charts/bar-chart/context.js +60 -0
- package/dist/components/charts/bar-chart/context.js.map +1 -0
- package/dist/components/charts/bar-chart/legend.d.ts +6 -0
- package/dist/components/charts/bar-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/bar-chart/legend.js +21 -0
- package/dist/components/charts/bar-chart/legend.js.map +1 -0
- package/dist/components/charts/bar-chart/plot.d.ts +10 -0
- package/dist/components/charts/bar-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/bar-chart/plot.js +290 -0
- package/dist/components/charts/bar-chart/plot.js.map +1 -0
- package/dist/components/charts/bar-chart/tooltip.d.ts +20 -0
- package/dist/components/charts/bar-chart/tooltip.d.ts.map +1 -0
- package/dist/components/charts/bar-chart/tooltip.js +57 -0
- package/dist/components/charts/bar-chart/tooltip.js.map +1 -0
- package/dist/components/charts/bar-chart.d.ts +9 -0
- package/dist/components/charts/bar-chart.d.ts.map +1 -0
- package/dist/components/charts/bar-chart.js +51 -0
- package/dist/components/charts/bar-chart.js.map +1 -0
- package/dist/components/charts/bump-chart/plot.js +1 -1
- package/dist/components/charts/bump-chart/point.js +1 -1
- package/dist/components/charts/bump-chart.js +1 -1
- package/dist/components/charts/composition-chart/plot.js +5 -1
- package/dist/components/charts/composition-chart/plot.js.map +1 -1
- package/dist/components/charts/composition-chart/tooltip-content.js +1 -1
- package/dist/components/charts/donut-chart.d.ts +1 -1
- package/dist/components/charts/donut-chart.js +1 -1
- package/dist/components/charts/funnel-chart.js +1 -1
- package/dist/components/charts/heat-calendar/tooltip.js +1 -1
- package/dist/components/charts/line-chart/context.d.ts +154 -0
- package/dist/components/charts/line-chart/context.d.ts.map +1 -0
- package/dist/components/charts/line-chart/context.js +67 -0
- package/dist/components/charts/line-chart/context.js.map +1 -0
- package/dist/components/charts/line-chart/legend.d.ts +6 -0
- package/dist/components/charts/line-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/line-chart/legend.js +21 -0
- package/dist/components/charts/line-chart/legend.js.map +1 -0
- package/dist/components/charts/line-chart/plot.d.ts +12 -0
- package/dist/components/charts/line-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/line-chart/plot.js +604 -0
- package/dist/components/charts/line-chart/plot.js.map +1 -0
- package/dist/components/charts/line-chart/tooltip.d.ts +22 -0
- package/dist/components/charts/line-chart/tooltip.d.ts.map +1 -0
- package/dist/components/charts/line-chart/tooltip.js +108 -0
- package/dist/components/charts/line-chart/tooltip.js.map +1 -0
- package/dist/components/charts/line-chart.d.ts +10 -0
- package/dist/components/charts/line-chart.d.ts.map +1 -0
- package/dist/components/charts/line-chart.js +53 -0
- package/dist/components/charts/line-chart.js.map +1 -0
- package/dist/components/charts/liquidity-heatmap.js +1 -1
- package/dist/components/charts/price-target-fan.js +1 -1
- package/dist/components/charts/returns-calendar/tooltip.js +1 -1
- package/dist/components/charts/returns-calendar.d.ts.map +1 -1
- package/dist/components/charts/sankey-chart/context.d.ts +2 -0
- package/dist/components/charts/sankey-chart/context.js +2 -0
- package/dist/components/charts/sankey-chart/plot.d.ts +8 -0
- package/dist/components/charts/sankey-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/sankey-chart/plot.js +342 -0
- package/dist/components/charts/sankey-chart/plot.js.map +1 -0
- package/dist/components/charts/sankey-chart/tooltip.d.ts +10 -0
- package/dist/components/charts/sankey-chart/tooltip.d.ts.map +1 -0
- package/dist/components/charts/sankey-chart/tooltip.js +147 -0
- package/dist/components/charts/sankey-chart/tooltip.js.map +1 -0
- package/dist/components/charts/sankey-chart.d.ts +17 -0
- package/dist/components/charts/sankey-chart.d.ts.map +1 -0
- package/dist/components/charts/sankey-chart.js +76 -0
- package/dist/components/charts/sankey-chart.js.map +1 -0
- package/dist/components/charts/sparkline.d.ts +26 -0
- package/dist/components/charts/sparkline.d.ts.map +1 -0
- package/dist/components/charts/sparkline.js +197 -0
- package/dist/components/charts/sparkline.js.map +1 -0
- package/dist/components/charts/treemap/tooltip.js +1 -1
- package/dist/components/charts/treemap.d.ts.map +1 -1
- package/dist/components/charts/volume-profile/tooltip.js +1 -1
- package/dist/components/charts/xy/axis.d.ts +24 -0
- package/dist/components/charts/xy/axis.d.ts.map +1 -0
- package/dist/components/charts/xy/axis.js +90 -0
- package/dist/components/charts/xy/axis.js.map +1 -0
- package/dist/components/charts/xy/data-table.d.ts +9 -0
- package/dist/components/charts/xy/data-table.d.ts.map +1 -0
- package/dist/components/charts/xy/data-table.js +29 -0
- package/dist/components/charts/xy/data-table.js.map +1 -0
- package/dist/components/charts/xy/inspector.d.ts +27 -0
- package/dist/components/charts/xy/inspector.d.ts.map +1 -0
- package/dist/components/charts/xy/inspector.js +110 -0
- package/dist/components/charts/xy/inspector.js.map +1 -0
- package/dist/components/charts/xy/legend.d.ts +13 -0
- package/dist/components/charts/xy/legend.d.ts.map +1 -0
- package/dist/components/charts/xy/legend.js +42 -0
- package/dist/components/charts/xy/legend.js.map +1 -0
- package/dist/components/charts/xy/tooltip-content.d.ts +2 -0
- package/dist/components/charts/xy/tooltip-content.js +66 -0
- package/dist/components/charts/xy/tooltip-content.js.map +1 -0
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/avatar-group.d.ts +48 -0
- package/dist/components/motion/avatar-group.d.ts.map +1 -0
- package/dist/components/motion/avatar-group.js +196 -0
- package/dist/components/motion/avatar-group.js.map +1 -0
- package/dist/components/motion/bottom-sheet.js +1 -1
- package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +20 -34
- package/dist/components/motion/bouncy-accordion.js.map +1 -1
- package/dist/components/motion/breadcrumb.js +0 -3
- package/dist/components/motion/breadcrumb.js.map +1 -1
- package/dist/components/motion/button/magnetic.js +1 -1
- package/dist/components/motion/card-dealer.d.ts +36 -0
- package/dist/components/motion/card-dealer.d.ts.map +1 -0
- package/dist/components/motion/card-dealer.js +232 -0
- package/dist/components/motion/card-dealer.js.map +1 -0
- package/dist/components/motion/color-picker.js +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/crash/crash-balloon.d.ts +9 -0
- package/dist/components/motion/crash/crash-balloon.d.ts.map +1 -0
- package/dist/components/motion/crash/crash-balloon.js +829 -0
- package/dist/components/motion/crash/crash-balloon.js.map +1 -0
- package/dist/components/motion/crash/crash-parts.d.ts +59 -0
- package/dist/components/motion/crash/crash-parts.d.ts.map +1 -0
- package/dist/components/motion/crash/crash-parts.js +2 -0
- package/dist/components/motion/crash/crash-tower.d.ts +9 -0
- package/dist/components/motion/crash/crash-tower.d.ts.map +1 -0
- package/dist/components/motion/crash/crash-tower.js +370 -0
- package/dist/components/motion/crash/crash-tower.js.map +1 -0
- package/dist/components/motion/crash.d.ts +9 -0
- package/dist/components/motion/crash.d.ts.map +1 -0
- package/dist/components/motion/crash.js +590 -0
- package/dist/components/motion/crash.js.map +1 -0
- package/dist/components/motion/date-range-picker.js +1 -1
- package/dist/components/motion/feedback-widget.js +0 -1
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/hold-action-button.js +1 -1
- package/dist/components/motion/liquid.js +2 -2
- package/dist/components/motion/liquid.js.map +1 -1
- package/dist/components/motion/loader.js +5 -4
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/mines.d.ts +41 -0
- package/dist/components/motion/mines.d.ts.map +1 -0
- package/dist/components/motion/mines.js +762 -0
- package/dist/components/motion/mines.js.map +1 -0
- package/dist/components/motion/morphing-modal.js +6 -4
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/multi-select/index.js +1 -1
- package/dist/components/motion/pagination.d.ts +31 -0
- package/dist/components/motion/pagination.d.ts.map +1 -0
- package/dist/components/motion/pagination.js +193 -0
- package/dist/components/motion/pagination.js.map +1 -0
- package/dist/components/motion/plinko.d.ts +59 -0
- package/dist/components/motion/plinko.d.ts.map +1 -0
- package/dist/components/motion/plinko.js +385 -0
- package/dist/components/motion/plinko.js.map +1 -0
- package/dist/components/motion/popover-morph.d.ts +11 -2
- package/dist/components/motion/popover-morph.d.ts.map +1 -1
- package/dist/components/motion/popover-morph.js +98 -4
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/pull-to-refresh.js +1 -1
- package/dist/components/motion/range-slider-bubble.js +1 -1
- package/dist/components/motion/range-slider-fluid.js +1 -1
- package/dist/components/motion/range-slider-inline.js +1 -1
- package/dist/components/motion/range-slider-ruler.js +1 -1
- package/dist/components/motion/range-slider-wave.js +1 -1
- package/dist/components/motion/range-slider.js +1 -1
- package/dist/components/motion/signup-form.js +0 -1
- package/dist/components/motion/signup-form.js.map +1 -1
- package/dist/components/motion/slide-action-button.js +1 -1
- package/dist/components/motion/swap/field.js +1 -1
- package/dist/components/motion/swap/token-picker.js +1 -1
- package/dist/components/motion/swap.d.ts +1 -1
- package/dist/components/motion/swap.js +2 -2
- package/dist/components/motion/table/index.js +2 -2
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/tooltip.d.ts +2 -2
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/wallet-card/index.js +1 -2
- package/dist/components/motion/wallet-card/index.js.map +1 -1
- package/dist/components/motion/wheel-picker.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +1 -1
- package/dist/components/reui/cascader/cascader-footer.js +1 -1
- package/dist/components/reui/cascader/cascader-nav.js +1 -1
- package/dist/components/reui/cascader/cascader-virtual.js +1 -1
- package/dist/components/reui/cascader/cascader.d.ts +1 -1
- package/dist/components/reui/cascader/cascader.js +2 -2
- package/dist/components/reui/code-block/code-block.d.ts +2 -1
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -1
- package/dist/components/reui/date-selector.js +2 -2
- package/dist/components/reui/emoji-picker.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar.d.ts +1 -1
- package/dist/components/reui/filters/filters-advanced.js +4 -4
- package/dist/components/reui/filters/filters-builder.js +1 -1
- package/dist/components/reui/filters/filters-chip.js +2 -2
- package/dist/components/reui/filters/filters-context.d.ts +1 -1
- package/dist/components/reui/filters/filters-editors.js +3 -3
- package/dist/components/reui/filters/filters.d.ts +3 -3
- package/dist/components/reui/filters/filters.js +6 -6
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-dnd.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/gantt/gantt-view.js +3 -3
- package/dist/components/reui/gantt/gantt.d.ts +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/phone-input.js +2 -2
- package/dist/components/reui/tree.d.ts +1 -0
- package/dist/components/reui/tree.d.ts.map +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/context-CQbvWVnM.js +393 -0
- package/dist/context-CQbvWVnM.js.map +1 -0
- package/dist/context-tv-kneJV.d.ts +204 -0
- package/dist/context-tv-kneJV.d.ts.map +1 -0
- package/dist/{copy-menu-CKW3jM1J.js → copy-menu-LU54Aruj.js} +2 -2
- package/dist/{copy-menu-CKW3jM1J.js.map → copy-menu-LU54Aruj.js.map} +1 -1
- package/dist/crash-parts-CUv5gFYQ.js +1053 -0
- package/dist/crash-parts-CUv5gFYQ.js.map +1 -0
- package/dist/{ease-CHhXKlG3.d.ts → ease-DjhlGGZO.d.ts} +4 -2
- package/dist/ease-DjhlGGZO.d.ts.map +1 -0
- package/dist/hooks/use-highlighted-code.d.ts +1 -1
- package/dist/hooks/use-highlighted-code.d.ts.map +1 -1
- package/dist/hooks/use-modal-scope.js +2 -2
- package/dist/hooks/use-modal-scope.js.map +1 -1
- package/dist/lib/audio-context.d.ts +11 -0
- package/dist/lib/audio-context.d.ts.map +1 -0
- package/dist/lib/audio-context.js +37 -0
- package/dist/lib/audio-context.js.map +1 -0
- package/dist/lib/ease.d.ts +2 -2
- package/dist/lib/ease.js +8 -1
- package/dist/lib/ease.js.map +1 -1
- package/dist/lib/focusable.d.ts +2 -0
- package/dist/lib/focusable.d.ts.map +1 -0
- package/dist/lib/focusable.js +12 -0
- package/dist/lib/focusable.js.map +1 -0
- package/dist/lib/game-sounds.d.ts +18 -0
- package/dist/lib/game-sounds.d.ts.map +1 -0
- package/dist/lib/game-sounds.js +142 -0
- package/dist/lib/game-sounds.js.map +1 -0
- package/dist/lib/tick-sound.d.ts +4 -3
- package/dist/lib/tick-sound.d.ts.map +1 -1
- package/dist/lib/tick-sound.js +30 -37
- package/dist/lib/tick-sound.js.map +1 -1
- package/dist/model-CvWolJdo.d.ts +14 -0
- package/dist/model-CvWolJdo.d.ts.map +1 -0
- package/dist/path-VEfFUowr.d.ts +3 -0
- package/dist/path-VEfFUowr.d.ts.map +1 -0
- package/dist/{plot-DAKl-Lu1.js → plot-CTQFrQKi.js} +2 -2
- package/dist/{plot-DAKl-Lu1.js.map → plot-CTQFrQKi.js.map} +1 -1
- package/dist/scale-DSsaupNc.d.ts +7 -0
- package/dist/scale-DSsaupNc.d.ts.map +1 -0
- package/dist/tooltip-CNEYdIX3.d.ts.map +1 -1
- package/dist/tooltip-content-K0vPsEtI.d.ts +17 -0
- package/dist/tooltip-content-K0vPsEtI.d.ts.map +1 -0
- package/dist/use-crash-game-B3RHxFkm.d.ts +108 -0
- package/dist/use-crash-game-B3RHxFkm.d.ts.map +1 -0
- package/dist/use-inspection-CZhdpH8J.js +127 -0
- package/dist/use-inspection-CZhdpH8J.js.map +1 -0
- package/dist/use-points-C2jpElHh.js +118 -0
- package/dist/use-points-C2jpElHh.js.map +1 -0
- package/dist/use-width-CkKCh1b3.js +23 -0
- package/dist/use-width-CkKCh1b3.js.map +1 -0
- package/package.json +7 -7
- package/dist/ease-CHhXKlG3.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { n as useDonutChart, r as useDonutModel, t as DonutContext } from "../../context-3i2_6ly8.js";
|
|
3
2
|
import { DonutChartCenter } from "./donut-chart/center.js";
|
|
3
|
+
import { n as useDonutChart, r as useDonutModel, t as DonutContext } from "../../context-3i2_6ly8.js";
|
|
4
4
|
import { DonutChartLegend } from "./donut-chart/legend.js";
|
|
5
5
|
import { DonutChartPlot } from "./donut-chart/plot.js";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
|
-
import { t as Tooltip } from "../../tooltip-CuHpilPN.js";
|
|
4
3
|
import { NumberTicker } from "../motion/number-ticker.js";
|
|
4
|
+
import { t as Tooltip } from "../../tooltip-CuHpilPN.js";
|
|
5
5
|
import { createContext, useContext, useMemo } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as Tooltip } from "../../../tooltip-CuHpilPN.js";
|
|
3
2
|
import { NumberTicker } from "../../motion/number-ticker.js";
|
|
3
|
+
import { t as Tooltip } from "../../../tooltip-CuHpilPN.js";
|
|
4
4
|
import { c as fmtRange, n as useHeatCalendar, s as fmtDay } from "../../../context-i6Dwvi3T.js";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { n as XYSeries, t as XYRow } from "../../../model-CvWolJdo.js";
|
|
2
|
+
import { t as XYDomain } from "../../../scale-DSsaupNc.js";
|
|
3
|
+
import { t as XYCurve } from "../../../path-VEfFUowr.js";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
export interface LineChartProps extends Omit<ComponentProps<"section">, "children"> {
|
|
6
|
+
series: readonly XYSeries[];
|
|
7
|
+
/** Unique x-axis labels in display order. Values align with them by index. */
|
|
8
|
+
categories: readonly string[];
|
|
9
|
+
/** `area` fills each line down to zero with a fading gradient. */
|
|
10
|
+
variant?: "line" | "area";
|
|
11
|
+
curve?: XYCurve;
|
|
12
|
+
/** Fixed value-axis bounds. Defaults to rounded bounds around the visible series. */
|
|
13
|
+
domain?: readonly [number, number];
|
|
14
|
+
/** Inspected category, by label. */
|
|
15
|
+
activeId?: string | null;
|
|
16
|
+
defaultActiveId?: string | null;
|
|
17
|
+
onActiveChange?: (id: string | null) => void;
|
|
18
|
+
/** Series ids hidden through the legend. */
|
|
19
|
+
hiddenSeries?: readonly string[];
|
|
20
|
+
defaultHiddenSeries?: readonly string[];
|
|
21
|
+
onHiddenSeriesChange?: (ids: readonly string[]) => void;
|
|
22
|
+
formatValue?: (value: number) => string;
|
|
23
|
+
/** Axis tick labels. Defaults to compact notation (1.2K). */
|
|
24
|
+
formatTick?: (value: number) => string;
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* `loading` hides the lines behind a pulsing placeholder until your data
|
|
28
|
+
* arrives; switching to `ready` hands off to the draw-in. Keep one chart
|
|
29
|
+
* mounted across both states.
|
|
30
|
+
*/
|
|
31
|
+
status?: "ready" | "loading";
|
|
32
|
+
/** Shown over the placeholder while loading. An empty string hides it. */
|
|
33
|
+
loadingLabel?: string;
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare function useLineChartModel({ series, categories, variant, curve, domain: fixedDomain, activeId, defaultActiveId, onActiveChange, hiddenSeries, defaultHiddenSeries, onHiddenSeriesChange, formatValue, formatTick, label, status, loadingLabel }: Omit<LineChartProps, "children">): {
|
|
37
|
+
visibleRows: XYRow[];
|
|
38
|
+
hidden: readonly string[];
|
|
39
|
+
toggle: (id: string) => void;
|
|
40
|
+
highlight: string | null;
|
|
41
|
+
setHovered: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
42
|
+
domain: XYDomain;
|
|
43
|
+
variant: "area" | "line";
|
|
44
|
+
curve: XYCurve;
|
|
45
|
+
formatValue: (value: number) => string;
|
|
46
|
+
formatTick: (value: number) => string;
|
|
47
|
+
label: string;
|
|
48
|
+
status: "loading" | "ready";
|
|
49
|
+
loading: boolean;
|
|
50
|
+
loadingLabel: string;
|
|
51
|
+
overlay: HTMLDivElement | null;
|
|
52
|
+
setOverlay: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
|
|
53
|
+
geometry: {
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
};
|
|
57
|
+
setGeometry: import("react").Dispatch<import("react").SetStateAction<{
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
}>>;
|
|
61
|
+
reduce: boolean;
|
|
62
|
+
canHover: boolean;
|
|
63
|
+
activeId: string | null;
|
|
64
|
+
activeIndex: number;
|
|
65
|
+
setActive: (next: string | null) => void;
|
|
66
|
+
open: boolean;
|
|
67
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
68
|
+
touching: boolean;
|
|
69
|
+
setTouching: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
70
|
+
plotRef: import("react").RefObject<HTMLDivElement | null>;
|
|
71
|
+
tooltipId: string;
|
|
72
|
+
rows: XYRow[];
|
|
73
|
+
categories: string[];
|
|
74
|
+
};
|
|
75
|
+
export type LineChartModel = ReturnType<typeof useLineChartModel>;
|
|
76
|
+
export declare const LineChartContext: import("react").Context<{
|
|
77
|
+
visibleRows: XYRow[];
|
|
78
|
+
hidden: readonly string[];
|
|
79
|
+
toggle: (id: string) => void;
|
|
80
|
+
highlight: string | null;
|
|
81
|
+
setHovered: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
82
|
+
domain: XYDomain;
|
|
83
|
+
variant: "area" | "line";
|
|
84
|
+
curve: XYCurve;
|
|
85
|
+
formatValue: (value: number) => string;
|
|
86
|
+
formatTick: (value: number) => string;
|
|
87
|
+
label: string;
|
|
88
|
+
status: "loading" | "ready";
|
|
89
|
+
loading: boolean;
|
|
90
|
+
loadingLabel: string;
|
|
91
|
+
overlay: HTMLDivElement | null;
|
|
92
|
+
setOverlay: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
|
|
93
|
+
geometry: {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
setGeometry: import("react").Dispatch<import("react").SetStateAction<{
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
}>>;
|
|
101
|
+
reduce: boolean;
|
|
102
|
+
canHover: boolean;
|
|
103
|
+
activeId: string | null;
|
|
104
|
+
activeIndex: number;
|
|
105
|
+
setActive: (next: string | null) => void;
|
|
106
|
+
open: boolean;
|
|
107
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
108
|
+
touching: boolean;
|
|
109
|
+
setTouching: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
110
|
+
plotRef: import("react").RefObject<HTMLDivElement | null>;
|
|
111
|
+
tooltipId: string;
|
|
112
|
+
rows: XYRow[];
|
|
113
|
+
categories: string[];
|
|
114
|
+
} | null>;
|
|
115
|
+
export declare function useLineChart(): {
|
|
116
|
+
visibleRows: XYRow[];
|
|
117
|
+
hidden: readonly string[];
|
|
118
|
+
toggle: (id: string) => void;
|
|
119
|
+
highlight: string | null;
|
|
120
|
+
setHovered: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
121
|
+
domain: XYDomain;
|
|
122
|
+
variant: "area" | "line";
|
|
123
|
+
curve: XYCurve;
|
|
124
|
+
formatValue: (value: number) => string;
|
|
125
|
+
formatTick: (value: number) => string;
|
|
126
|
+
label: string;
|
|
127
|
+
status: "loading" | "ready";
|
|
128
|
+
loading: boolean;
|
|
129
|
+
loadingLabel: string;
|
|
130
|
+
overlay: HTMLDivElement | null;
|
|
131
|
+
setOverlay: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
|
|
132
|
+
geometry: {
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
};
|
|
136
|
+
setGeometry: import("react").Dispatch<import("react").SetStateAction<{
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
}>>;
|
|
140
|
+
reduce: boolean;
|
|
141
|
+
canHover: boolean;
|
|
142
|
+
activeId: string | null;
|
|
143
|
+
activeIndex: number;
|
|
144
|
+
setActive: (next: string | null) => void;
|
|
145
|
+
open: boolean;
|
|
146
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
147
|
+
touching: boolean;
|
|
148
|
+
setTouching: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
149
|
+
plotRef: import("react").RefObject<HTMLDivElement | null>;
|
|
150
|
+
tooltipId: string;
|
|
151
|
+
rows: XYRow[];
|
|
152
|
+
categories: string[];
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":["_$___xy_model0.XYRow"],"sources":["../../../../src/components/charts/line-chart/context.tsx"],"mappings":";;;;iBAkBiB,uBAAuB,KAAK;EAC3C,iBAAiB;;EAEjB;;EAEA;EACA,QAAQ;;EAER;;EAEA;EACA;EACA,kBAAkB;;EAElB;EACA;EACA,wBAAwB;EACxB,eAAe;;EAEf,cAAc;EACd;;;;;;EAMA;;EAEA;EACA,WAAW;;wBAOG,oBACd,QACA,YACA,SACA,OACA,QAAQ,aACR,UACA,iBACA,gBACA,cACA,qBACA,sBACA,aACA,YACA,OACA,QACA,gBACC,KAAK;E,aAALA;;EA6Bc,SAAA;;;;;;EAjEO,cAAA;EAED,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqFX,iBAAiB,kBAAkB;qBAElC,kCAAgB;E,aAAhBA;;EAxBI,SAAA;;;;;;EAjEO,cAAA;EAED,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyFP;E,aAAAA;;EA1BC,SAAA;;;;;;EAjEO,cAAA;EAED,aAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
|
|
3
|
+
import { a as normalizeXY, i as niceDomain, n as useInspection, t as useControllable } from "../../../use-inspection-CZhdpH8J.js";
|
|
4
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
5
|
+
import { useReducedMotion } from "motion/react";
|
|
6
|
+
// src/components/charts/line-chart/context.tsx
|
|
7
|
+
const number = new Intl.NumberFormat("en", { maximumFractionDigits: 2 });
|
|
8
|
+
const compact = new Intl.NumberFormat("en", {
|
|
9
|
+
notation: "compact",
|
|
10
|
+
maximumFractionDigits: 1
|
|
11
|
+
});
|
|
12
|
+
const NONE = [];
|
|
13
|
+
function useLineChartModel({ series, categories, variant = "line", curve = "monotone", domain: fixedDomain, activeId, defaultActiveId, onActiveChange, hiddenSeries, defaultHiddenSeries = NONE, onHiddenSeriesChange, formatValue = (value) => number.format(value), formatTick = (value) => compact.format(value), label = "Line chart", status = "ready", loadingLabel = "Loading data" }) {
|
|
14
|
+
const [overlay, setOverlay] = useState(null);
|
|
15
|
+
const [geometry, setGeometry] = useState({
|
|
16
|
+
width: 0,
|
|
17
|
+
height: 0
|
|
18
|
+
});
|
|
19
|
+
const data = useMemo(() => normalizeXY(series, categories), [series, categories]);
|
|
20
|
+
const [hidden, setHidden] = useControllable(hiddenSeries, defaultHiddenSeries, onHiddenSeriesChange);
|
|
21
|
+
const visibleRows = data.rows.filter((row) => !hidden.includes(row.id));
|
|
22
|
+
const [hovered, setHovered] = useState(null);
|
|
23
|
+
const highlight = visibleRows.some((row) => row.id === hovered) ? hovered : null;
|
|
24
|
+
const domain = niceDomain(visibleRows.flatMap((row) => row.values.filter((value) => value !== null)), {
|
|
25
|
+
includeZero: variant === "area",
|
|
26
|
+
fixed: fixedDomain
|
|
27
|
+
});
|
|
28
|
+
const inspection = useInspection({
|
|
29
|
+
ids: data.categories,
|
|
30
|
+
activeId,
|
|
31
|
+
defaultActiveId,
|
|
32
|
+
onActiveChange
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
...data,
|
|
36
|
+
...inspection,
|
|
37
|
+
visibleRows,
|
|
38
|
+
hidden,
|
|
39
|
+
toggle: (id) => setHidden(hidden.includes(id) ? hidden.filter((h) => h !== id) : [...hidden, id]),
|
|
40
|
+
highlight,
|
|
41
|
+
setHovered,
|
|
42
|
+
domain,
|
|
43
|
+
variant,
|
|
44
|
+
curve,
|
|
45
|
+
formatValue,
|
|
46
|
+
formatTick,
|
|
47
|
+
label,
|
|
48
|
+
status,
|
|
49
|
+
loading: status === "loading",
|
|
50
|
+
loadingLabel,
|
|
51
|
+
overlay,
|
|
52
|
+
setOverlay,
|
|
53
|
+
geometry,
|
|
54
|
+
setGeometry,
|
|
55
|
+
reduce: useReducedMotion() ?? false,
|
|
56
|
+
canHover: useHoverCapable()
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const LineChartContext = createContext(null);
|
|
60
|
+
function useLineChart() {
|
|
61
|
+
const context = useContext(LineChartContext);
|
|
62
|
+
if (!context) throw new Error("Line chart parts must be rendered inside LineChart.");
|
|
63
|
+
return context;
|
|
64
|
+
}
|
|
65
|
+
export { LineChartContext, useLineChart, useLineChartModel };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../../src/components/charts/line-chart/context.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { normalizeXY, type XYSeries } from \"../xy/model\";\nimport type { XYCurve } from \"../xy/path\";\nimport { niceDomain } from \"../xy/scale\";\nimport { useControllable, useInspection } from \"../xy/use-inspection\";\n\nexport interface LineChartProps extends Omit<ComponentProps<\"section\">, \"children\"> {\n series: readonly XYSeries[];\n /** Unique x-axis labels in display order. Values align with them by index. */\n categories: readonly string[];\n /** `area` fills each line down to zero with a fading gradient. */\n variant?: \"line\" | \"area\";\n curve?: XYCurve;\n /** Fixed value-axis bounds. Defaults to rounded bounds around the visible series. */\n domain?: readonly [number, number];\n /** Inspected category, by label. */\n activeId?: string | null;\n defaultActiveId?: string | null;\n onActiveChange?: (id: string | null) => void;\n /** Series ids hidden through the legend. */\n hiddenSeries?: readonly string[];\n defaultHiddenSeries?: readonly string[];\n onHiddenSeriesChange?: (ids: readonly string[]) => void;\n formatValue?: (value: number) => string;\n /** Axis tick labels. Defaults to compact notation (1.2K). */\n formatTick?: (value: number) => string;\n label?: string;\n /**\n * `loading` hides the lines behind a pulsing placeholder until your data\n * arrives; switching to `ready` hands off to the draw-in. Keep one chart\n * mounted across both states.\n */\n status?: \"ready\" | \"loading\";\n /** Shown over the placeholder while loading. An empty string hides it. */\n loadingLabel?: string;\n children?: ReactNode;\n}\n\nconst number = new Intl.NumberFormat(\"en\", { maximumFractionDigits: 2 });\nconst compact = new Intl.NumberFormat(\"en\", { notation: \"compact\", maximumFractionDigits: 1 });\nconst NONE: readonly string[] = [];\n\nexport function useLineChartModel({\n series,\n categories,\n variant = \"line\",\n curve = \"monotone\",\n domain: fixedDomain,\n activeId,\n defaultActiveId,\n onActiveChange,\n hiddenSeries,\n defaultHiddenSeries = NONE,\n onHiddenSeriesChange,\n formatValue = (value) => number.format(value),\n formatTick = (value) => compact.format(value),\n label = \"Line chart\",\n status = \"ready\",\n loadingLabel = \"Loading data\",\n}: Omit<LineChartProps, \"children\">) {\n // The plot area hosts the tooltip panel, and its measured size places it.\n const [overlay, setOverlay] = useState<HTMLDivElement | null>(null);\n const [geometry, setGeometry] = useState({ width: 0, height: 0 });\n const data = useMemo(() => normalizeXY(series, categories), [series, categories]);\n const [hidden, setHidden] = useControllable(\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n );\n const visibleRows = data.rows.filter((row) => !hidden.includes(row.id));\n const [hovered, setHovered] = useState<string | null>(null);\n const highlight = visibleRows.some((row) => row.id === hovered) ? hovered : null;\n // Hiding a series rescales the axis to what is left, and every mark springs there.\n const domain = niceDomain(\n visibleRows.flatMap((row) => row.values.filter((value): value is number => value !== null)),\n { includeZero: variant === \"area\", fixed: fixedDomain },\n );\n const inspection = useInspection({\n ids: data.categories,\n activeId,\n defaultActiveId,\n onActiveChange,\n });\n return {\n ...data,\n ...inspection,\n visibleRows,\n hidden,\n toggle: (id: string) =>\n setHidden(hidden.includes(id) ? hidden.filter((h) => h !== id) : [...hidden, id]),\n highlight,\n setHovered,\n domain,\n variant,\n curve,\n formatValue,\n formatTick,\n label,\n status,\n loading: status === \"loading\",\n loadingLabel,\n overlay,\n setOverlay,\n geometry,\n setGeometry,\n reduce: useReducedMotion() ?? false,\n canHover: useHoverCapable(),\n };\n}\n\nexport type LineChartModel = ReturnType<typeof useLineChartModel>;\n\nexport const LineChartContext = createContext<LineChartModel | null>(null);\n\nexport function useLineChart() {\n const context = useContext(LineChartContext);\n if (!context) throw new Error(\"Line chart parts must be rendered inside LineChart.\");\n return context;\n}\n"],"mappings":";;;;;;AAkDA,MAAM,SAAS,IAAI,KAAK,aAAa,MAAM,EAAE,uBAAuB,EAAE,CAAC;AACvE,MAAM,UAAU,IAAI,KAAK,aAAa,MAAM;CAAE,UAAU;CAAW,uBAAuB;AAAE,CAAC;AAC7F,MAAM,OAA0B,CAAC;AAEjC,SAAgB,kBAAkB,EAChC,QACA,YACA,UAAU,QACV,QAAQ,YACR,QAAQ,aACR,UACA,iBACA,gBACA,cACA,sBAAsB,MACtB,sBACA,eAAe,UAAU,OAAO,OAAO,KAAK,GAC5C,cAAc,UAAU,QAAQ,OAAO,KAAK,GAC5C,QAAQ,cACR,SAAS,SACT,eAAe,kBACoB;CAEnC,MAAM,CAAC,SAAS,cAAc,SAAgC,IAAI;CAClE,MAAM,CAAC,UAAU,eAAe,SAAS;EAAE,OAAO;EAAG,QAAQ;CAAE,CAAC;CAChE,MAAM,OAAO,cAAc,YAAY,QAAQ,UAAU,GAAG,CAAC,QAAQ,UAAU,CAAC;CAChF,MAAM,CAAC,QAAQ,aAAa,gBAC1B,cACA,qBACA,oBACF;CACA,MAAM,cAAc,KAAK,KAAK,QAAQ,QAAQ,CAAC,OAAO,SAAS,IAAI,EAAE,CAAC;CACtE,MAAM,CAAC,SAAS,cAAc,SAAwB,IAAI;CAC1D,MAAM,YAAY,YAAY,MAAM,QAAQ,IAAI,OAAO,OAAO,IAAI,UAAU;CAE5E,MAAM,SAAS,WACb,YAAY,SAAS,QAAQ,IAAI,OAAO,QAAQ,UAA2B,UAAU,IAAI,CAAC,GAC1F;EAAE,aAAa,YAAY;EAAQ,OAAO;CAAY,CACxD;CACA,MAAM,aAAa,cAAc;EAC/B,KAAK,KAAK;EACV;EACA;EACA;CACF,CAAC;CACD,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA,SAAS,OACP,UAAU,OAAO,SAAS,EAAE,IAAI,OAAO,QAAQ,MAAM,MAAM,EAAE,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC;EAClF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,WAAW;EACpB;EACA;EACA;EACA;EACA;EACA,QAAQ,iBAAiB,KAAK;EAC9B,UAAU,gBAAgB;CAC5B;AACF;AAIA,MAAa,mBAAmB,cAAqC,IAAI;AAEzE,SAAgB,eAAe;CAC7B,MAAM,UAAU,WAAW,gBAAgB;CAC3C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,OAAO;AACT"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface LineChartLegendProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
}
|
|
4
|
+
/** Toggle a series to hide it; the axis rescales to what is left. */
|
|
5
|
+
export declare function LineChartLegend({ className }: LineChartLegendProps): import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","names":[],"sources":["../../../../src/components/charts/line-chart/legend.tsx"],"mappings":"A,iBAKiB;EACf;;;wBAIc,kBAAkB,aAAa,uCAAoB,IAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { XYLegend } from "../xy/legend.js";
|
|
3
|
+
import { useLineChart } from "./context.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/charts/line-chart/legend.tsx
|
|
6
|
+
/** Toggle a series to hide it; the axis rescales to what is left. */
|
|
7
|
+
function LineChartLegend({ className }) {
|
|
8
|
+
const { rows, hidden, toggle, setHovered, canHover } = useLineChart();
|
|
9
|
+
return /* @__PURE__ */ jsx(XYLegend, {
|
|
10
|
+
rows,
|
|
11
|
+
hidden,
|
|
12
|
+
onToggle: toggle,
|
|
13
|
+
onHover: setHovered,
|
|
14
|
+
canHover,
|
|
15
|
+
label: "Series",
|
|
16
|
+
className
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { LineChartLegend };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.js","names":[],"sources":["../../../../src/components/charts/line-chart/legend.tsx"],"sourcesContent":["\"use client\";\n\nimport { XYLegend } from \"../xy/legend\";\nimport { useLineChart } from \"./context\";\n\nexport interface LineChartLegendProps {\n className?: string;\n}\n\n/** Toggle a series to hide it; the axis rescales to what is left. */\nexport function LineChartLegend({ className }: LineChartLegendProps) {\n const { rows, hidden, toggle, setHovered, canHover } = useLineChart();\n return (\n <XYLegend\n rows={rows}\n hidden={hidden}\n onToggle={toggle}\n onHover={setHovered}\n canHover={canHover}\n label=\"Series\"\n className={className}\n />\n );\n}\n"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,EAAE,aAAmC;CACnE,MAAM,EAAE,MAAM,QAAQ,QAAQ,YAAY,aAAa,aAAa;CACpE,OACE,oBAAC,UAAD;EACQ;EACE;EACR,UAAU;EACV,SAAS;EACC;EACV,OAAM;EACK;CACZ,CAAA;AAEL"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface LineChartPlotProps {
|
|
2
|
+
/** Plot height in px, excluding the category labels. */
|
|
3
|
+
height?: number;
|
|
4
|
+
/** Stroke width of each line, in px. */
|
|
5
|
+
strokeWidth?: number;
|
|
6
|
+
showGrid?: boolean;
|
|
7
|
+
/** Fade lines and fills out toward the left and right edges of the plot. */
|
|
8
|
+
fadeEdges?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function LineChartPlot({ height, strokeWidth, showGrid, fadeEdges, className }: LineChartPlotProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=plot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.d.ts","names":[],"sources":["../../../../src/components/charts/line-chart/plot.tsx"],"mappings":"A,iBAmDiB;;EAEf;;EAEA;EACA;;EAEA;EACA;;wBAGc,gBACd,QACA,aACA,UACA,WACA,aACC,qCAAkB,IAAA"}
|