@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 { 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 { n as useVolumeProfile } from "../../../context-C5TW-k6u.js";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value gridlines keyed by tick value: a tick that survives a rescale glides to
|
|
3
|
+
* its new position, new ticks fade in where they belong, old ones fade out.
|
|
4
|
+
*/
|
|
5
|
+
export declare function XYGridLines({ ticks, position, axis, from, to, reduce }: {
|
|
6
|
+
ticks: readonly number[];
|
|
7
|
+
position: (value: number) => number;
|
|
8
|
+
/** `y` draws horizontal lines at y positions; `x` vertical lines at x positions. */
|
|
9
|
+
axis: "x" | "y";
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
reduce: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
export declare function XYTickLabels({ ticks, position, axis, format, reduce, offset }: {
|
|
15
|
+
ticks: readonly number[];
|
|
16
|
+
position: (value: number) => number;
|
|
17
|
+
/** `y` stacks labels in a left gutter; `x` lines them up under the plot. */
|
|
18
|
+
axis: "x" | "y";
|
|
19
|
+
format: (value: number) => string;
|
|
20
|
+
reduce: boolean;
|
|
21
|
+
/** Gutter width for `y`, or the top edge of the label row for `x`, in px. */
|
|
22
|
+
offset: number;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=axis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axis.d.ts","names":[],"sources":["../../../../src/components/charts/xy/axis.tsx"],"mappings":";;;;wBAagB,cACd,OACA,UACA,MACA,MACA,IACA;EAEA;EACA,WAAW;;EAEX;EACA;EACA;EACA;oBACD,IAAA;wBA0Be,eACd,OACA,UACA,MACA,QACA,QACA;EAEA;EACA,WAAW;;EAEX;EACA,SAAS;EACT;;EAEA;oBACD,IAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT, SPRING_LAYOUT } from "../../../lib/ease.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
+
// src/components/charts/xy/axis.tsx
|
|
6
|
+
const FADE = {
|
|
7
|
+
duration: .16,
|
|
8
|
+
ease: EASE_OUT
|
|
9
|
+
};
|
|
10
|
+
const EXIT = {
|
|
11
|
+
opacity: 0,
|
|
12
|
+
transition: {
|
|
13
|
+
duration: .1,
|
|
14
|
+
ease: EASE_OUT
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Value gridlines keyed by tick value: a tick that survives a rescale glides to
|
|
19
|
+
* its new position, new ticks fade in where they belong, old ones fade out.
|
|
20
|
+
*/
|
|
21
|
+
function XYGridLines({ ticks, position, axis, from, to, reduce }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
23
|
+
initial: false,
|
|
24
|
+
children: ticks.map((tick) => {
|
|
25
|
+
const at = { [axis]: position(tick) };
|
|
26
|
+
return /* @__PURE__ */ jsx(motion.line, {
|
|
27
|
+
...axis === "y" ? {
|
|
28
|
+
x1: from,
|
|
29
|
+
x2: to,
|
|
30
|
+
y1: 0,
|
|
31
|
+
y2: 0
|
|
32
|
+
} : {
|
|
33
|
+
y1: from,
|
|
34
|
+
y2: to,
|
|
35
|
+
x1: 0,
|
|
36
|
+
x2: 0
|
|
37
|
+
},
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
strokeOpacity: tick === 0 ? .3 : .12,
|
|
40
|
+
className: "text-muted-foreground",
|
|
41
|
+
initial: {
|
|
42
|
+
opacity: 0,
|
|
43
|
+
...at
|
|
44
|
+
},
|
|
45
|
+
animate: {
|
|
46
|
+
opacity: 1,
|
|
47
|
+
...at
|
|
48
|
+
},
|
|
49
|
+
exit: EXIT,
|
|
50
|
+
transition: {
|
|
51
|
+
opacity: FADE,
|
|
52
|
+
default: reduce ? { duration: 0 } : SPRING_LAYOUT
|
|
53
|
+
}
|
|
54
|
+
}, tick);
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function XYTickLabels({ ticks, position, axis, format, reduce, offset }) {
|
|
59
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
60
|
+
initial: false,
|
|
61
|
+
children: ticks.map((tick) => {
|
|
62
|
+
const at = { [axis]: position(tick) };
|
|
63
|
+
return /* @__PURE__ */ jsx(motion.span, {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: "text-muted-foreground pointer-events-none absolute top-0 left-0 font-mono text-[11px] whitespace-nowrap tabular-nums",
|
|
66
|
+
style: axis === "y" ? { width: offset - 8 } : { top: offset },
|
|
67
|
+
initial: {
|
|
68
|
+
opacity: 0,
|
|
69
|
+
...at
|
|
70
|
+
},
|
|
71
|
+
animate: {
|
|
72
|
+
opacity: 1,
|
|
73
|
+
...at
|
|
74
|
+
},
|
|
75
|
+
exit: EXIT,
|
|
76
|
+
transition: {
|
|
77
|
+
opacity: FADE,
|
|
78
|
+
default: reduce ? { duration: 0 } : SPRING_LAYOUT
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: axis === "y" ? "block -translate-y-1/2 text-right" : "block -translate-x-1/2",
|
|
82
|
+
children: format(tick)
|
|
83
|
+
})
|
|
84
|
+
}, tick);
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export { XYGridLines, XYTickLabels };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=axis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axis.js","names":[],"sources":["../../../../src/components/charts/xy/axis.tsx"],"sourcesContent":["\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../../lib/ease\";\n\nconst FADE = { duration: 0.16, ease: EASE_OUT } as const;\nconst EXIT = { opacity: 0, transition: { duration: 0.1, ease: EASE_OUT } } as const;\n\n/**\n * Value gridlines keyed by tick value: a tick that survives a rescale glides to\n * its new position, new ticks fade in where they belong, old ones fade out.\n */\nexport function XYGridLines({\n ticks,\n position,\n axis,\n from,\n to,\n reduce,\n}: {\n ticks: readonly number[];\n position: (value: number) => number;\n /** `y` draws horizontal lines at y positions; `x` vertical lines at x positions. */\n axis: \"x\" | \"y\";\n from: number;\n to: number;\n reduce: boolean;\n}) {\n return (\n <AnimatePresence initial={false}>\n {ticks.map((tick) => {\n const at = { [axis]: position(tick) };\n return (\n <motion.line\n key={tick}\n {...(axis === \"y\"\n ? { x1: from, x2: to, y1: 0, y2: 0 }\n : { y1: from, y2: to, x1: 0, x2: 0 })}\n // Border tokens are tuned for card edges and vanish as thin rules on a plot.\n stroke=\"currentColor\"\n strokeOpacity={tick === 0 ? 0.3 : 0.12}\n className=\"text-muted-foreground\"\n initial={{ opacity: 0, ...at }}\n animate={{ opacity: 1, ...at }}\n exit={EXIT}\n transition={{ opacity: FADE, default: reduce ? { duration: 0 } : SPRING_LAYOUT }}\n />\n );\n })}\n </AnimatePresence>\n );\n}\n\nexport function XYTickLabels({\n ticks,\n position,\n axis,\n format,\n reduce,\n offset,\n}: {\n ticks: readonly number[];\n position: (value: number) => number;\n /** `y` stacks labels in a left gutter; `x` lines them up under the plot. */\n axis: \"x\" | \"y\";\n format: (value: number) => string;\n reduce: boolean;\n /** Gutter width for `y`, or the top edge of the label row for `x`, in px. */\n offset: number;\n}) {\n return (\n <AnimatePresence initial={false}>\n {ticks.map((tick) => {\n const at = { [axis]: position(tick) };\n return (\n <motion.span\n key={tick}\n aria-hidden=\"true\"\n className=\"text-muted-foreground pointer-events-none absolute top-0 left-0 font-mono text-[11px] whitespace-nowrap tabular-nums\"\n style={axis === \"y\" ? { width: offset - 8 } : { top: offset }}\n initial={{ opacity: 0, ...at }}\n animate={{ opacity: 1, ...at }}\n exit={EXIT}\n transition={{ opacity: FADE, default: reduce ? { duration: 0 } : SPRING_LAYOUT }}\n >\n <span\n className={\n axis === \"y\" ? \"block -translate-y-1/2 text-right\" : \"block -translate-x-1/2\"\n }\n >\n {format(tick)}\n </span>\n </motion.span>\n );\n })}\n </AnimatePresence>\n );\n}\n"],"mappings":";;;;;AAMA,MAAM,OAAO;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9C,MAAM,OAAO;CAAE,SAAS;CAAG,YAAY;EAAE,UAAU;EAAK,MAAM;CAAS;AAAE;;;;;AAMzE,SAAgB,YAAY,EAC1B,OACA,UACA,MACA,MACA,IACA,UASC;CACD,OACE,oBAAC,iBAAD;EAAiB,SAAS;EACvB,UAAA,MAAM,KAAK,SAAS;GACnB,MAAM,KAAK,GAAG,OAAO,SAAS,IAAI,EAAE;GACpC,OACE,oBAAC,OAAO,MAAR;IAEE,GAAK,SAAS,MACV;KAAE,IAAI;KAAM,IAAI;KAAI,IAAI;KAAG,IAAI;IAAE,IACjC;KAAE,IAAI;KAAM,IAAI;KAAI,IAAI;KAAG,IAAI;IAAE;IAErC,QAAO;IACP,eAAe,SAAS,IAAI,KAAM;IAClC,WAAU;IACV,SAAS;KAAE,SAAS;KAAG,GAAG;IAAG;IAC7B,SAAS;KAAE,SAAS;KAAG,GAAG;IAAG;IAC7B,MAAM;IACN,YAAY;KAAE,SAAS;KAAM,SAAS,SAAS,EAAE,UAAU,EAAE,IAAI;IAAc;GAChF,GAZM,IAYN;EAEL,CAAC;CACc,CAAA;AAErB;AAEA,SAAgB,aAAa,EAC3B,OACA,UACA,MACA,QACA,QACA,UAUC;CACD,OACE,oBAAC,iBAAD;EAAiB,SAAS;EACvB,UAAA,MAAM,KAAK,SAAS;GACnB,MAAM,KAAK,GAAG,OAAO,SAAS,IAAI,EAAE;GACpC,OACE,oBAAC,OAAO,MAAR;IAEE,eAAY;IACZ,WAAU;IACV,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,EAAE,IAAI,EAAE,KAAK,OAAO;IAC5D,SAAS;KAAE,SAAS;KAAG,GAAG;IAAG;IAC7B,SAAS;KAAE,SAAS;KAAG,GAAG;IAAG;IAC7B,MAAM;IACN,YAAY;KAAE,SAAS;KAAM,SAAS,SAAS,EAAE,UAAU,EAAE,IAAI;IAAc;IAE/E,UAAA,oBAAC,QAAD;KACE,WACE,SAAS,MAAM,sCAAsC;KAGtD,UAAA,OAAO,IAAI;IACR,CAAA;GACK,GAhBN,IAgBM;EAEjB,CAAC;CACc,CAAA;AAErB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as XYRow } from "../../../model-CvWolJdo.js";
|
|
2
|
+
/** Every value stays readable by screen readers without a tab stop per mark. */
|
|
3
|
+
export declare function XYDataTable({ label, rows, categories, formatValue }: {
|
|
4
|
+
label: string;
|
|
5
|
+
rows: readonly XYRow[];
|
|
6
|
+
categories: readonly string[];
|
|
7
|
+
formatValue: (value: number) => string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","names":[],"sources":["../../../../src/components/charts/xy/data-table.tsx"],"mappings":";;wBAKgB,cACd,OACA,MACA,YACA;EAEA;EACA,eAAe;EACf;EACA,cAAc;oBACf,IAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/charts/xy/data-table.tsx
|
|
4
|
+
/** Every value stays readable by screen readers without a tab stop per mark. */
|
|
5
|
+
function XYDataTable({ label, rows, categories, formatValue }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: "sr-only",
|
|
8
|
+
children: /* @__PURE__ */ jsxs("table", { children: [
|
|
9
|
+
/* @__PURE__ */ jsxs("caption", { children: [label, " data"] }),
|
|
10
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
11
|
+
scope: "col",
|
|
12
|
+
children: "Category"
|
|
13
|
+
}), rows.map((row) => /* @__PURE__ */ jsx("th", {
|
|
14
|
+
scope: "col",
|
|
15
|
+
children: row.name
|
|
16
|
+
}, row.id))] }) }),
|
|
17
|
+
/* @__PURE__ */ jsx("tbody", { children: categories.map((category, i) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
18
|
+
scope: "row",
|
|
19
|
+
children: category
|
|
20
|
+
}), rows.map((row) => {
|
|
21
|
+
const value = row.values[i];
|
|
22
|
+
return /* @__PURE__ */ jsx("td", { children: value === null ? "No data" : formatValue(value) }, row.id);
|
|
23
|
+
})] }, category)) })
|
|
24
|
+
] })
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { XYDataTable };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=data-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.js","names":[],"sources":["../../../../src/components/charts/xy/data-table.tsx"],"sourcesContent":["\"use client\";\n\nimport type { XYRow } from \"./model\";\n\n/** Every value stays readable by screen readers without a tab stop per mark. */\nexport function XYDataTable({\n label,\n rows,\n categories,\n formatValue,\n}: {\n label: string;\n rows: readonly XYRow[];\n categories: readonly string[];\n formatValue: (value: number) => string;\n}) {\n return (\n <div className=\"sr-only\">\n <table>\n <caption>{label} data</caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n {rows.map((row) => (\n <th key={row.id} scope=\"col\">\n {row.name}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {categories.map((category, i) => (\n <tr key={category}>\n <th scope=\"row\">{category}</th>\n {rows.map((row) => {\n const value = row.values[i];\n return <td key={row.id}>{value === null ? \"No data\" : formatValue(value)}</td>;\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,YAAY,EAC1B,OACA,MACA,YACA,eAMC;CACD,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,qBAAC,SAAD,EAAA,UAAA;GACE,qBAAC,WAAD,EAAA,UAAA,CAAU,OAAM,OAAc,EAAA,CAAA;GAC9B,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD;IAAI,OAAM;IAAM,UAAA;GAAY,CAAA,GAC3B,KAAK,KAAK,QACT,oBAAC,MAAD;IAAiB,OAAM;IACpB,UAAA,IAAI;GACH,GAFK,IAAI,EAET,CACL,CACC,EAAA,CAAA,EACC,CAAA;GACP,oBAAC,SAAD,EAAA,UACG,WAAW,KAAK,UAAU,MACzB,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD;IAAI,OAAM;IAAO,UAAA;GAAa,CAAA,GAC7B,KAAK,KAAK,QAAQ;IACjB,MAAM,QAAQ,IAAI,OAAO;IACzB,OAAO,oBAAC,MAAD,EAAA,UAAkB,UAAU,OAAO,YAAY,YAAY,KAAK,EAAM,GAA7D,IAAI,EAAyD;GAC/E,CAAC,CACC,EAAA,GANK,QAML,CACL,EACI,CAAA;EACF,EAAA,CAAA;CACJ,CAAA;AAET"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
export interface XYInspectorProps {
|
|
3
|
+
count: number;
|
|
4
|
+
activeIndex: number;
|
|
5
|
+
onActive: (index: number) => void;
|
|
6
|
+
/** Accessible name of the slider. */
|
|
7
|
+
label: string;
|
|
8
|
+
valueText: (index: number) => string;
|
|
9
|
+
/** `point` snaps to the nearest sample (lines); `band` to the slot under the pointer (bars). */
|
|
10
|
+
mode: "point" | "band";
|
|
11
|
+
/** `vertical` reads categories top to bottom, for horizontal bars. */
|
|
12
|
+
orientation?: "horizontal" | "vertical";
|
|
13
|
+
open: boolean;
|
|
14
|
+
setOpen: (open: boolean) => void;
|
|
15
|
+
tooltipId?: string;
|
|
16
|
+
canHover: boolean;
|
|
17
|
+
/** Reports a touch drag starting and ending, so marks can track the finger 1:1. */
|
|
18
|
+
onTouchChange?: (touching: boolean) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One invisible native range over the plot: a single tab stop for keyboard and
|
|
24
|
+
* assistive technology, with pointer hit testing that matches the drawn marks.
|
|
25
|
+
*/
|
|
26
|
+
export declare function XYInspector({ count, activeIndex, onActive, label, valueText, mode, orientation, open, setOpen, tooltipId, canHover, onTouchChange, className, style }: XYInspectorProps): import("react").JSX.Element | null;
|
|
27
|
+
//# sourceMappingURL=inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector.d.ts","names":[],"sources":["../../../../src/components/charts/xy/inspector.tsx"],"mappings":";iBAMiB;EACf;EACA;EACA,WAAW;;EAEX;EACA,YAAY;;EAEZ;;EAEA;EACA;EACA,UAAU;EACV;EACA;;EAEA,iBAAiB;EACjB;EACA,QAAQ;;;;;;wBAOM,cACd,OACA,aACA,UACA,OACA,WACA,MACA,aACA,MACA,SACA,WACA,UACA,eACA,WACA,SACC,mCAAgB,IAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/charts/xy/inspector.tsx
|
|
6
|
+
/**
|
|
7
|
+
* One invisible native range over the plot: a single tab stop for keyboard and
|
|
8
|
+
* assistive technology, with pointer hit testing that matches the drawn marks.
|
|
9
|
+
*/
|
|
10
|
+
function XYInspector({ count, activeIndex, onActive, label, valueText, mode, orientation = "horizontal", open, setOpen, tooltipId, canHover, onTouchChange, className, style }) {
|
|
11
|
+
const pointerDriven = useRef(false);
|
|
12
|
+
const focused = useRef(false);
|
|
13
|
+
const mouseFocus = useRef(false);
|
|
14
|
+
const last = useRef(null);
|
|
15
|
+
const index = activeIndex >= 0 ? activeIndex : count - 1;
|
|
16
|
+
const vertical = orientation === "vertical";
|
|
17
|
+
const inspectPointer = (event) => {
|
|
18
|
+
const bounds = event.currentTarget.getBoundingClientRect();
|
|
19
|
+
const length = vertical ? bounds.height : bounds.width;
|
|
20
|
+
if (!length || !count) return;
|
|
21
|
+
const offset = vertical ? event.clientY - bounds.top : event.clientX - bounds.left;
|
|
22
|
+
const fraction = Math.min(1, Math.max(0, offset / length));
|
|
23
|
+
const next = mode === "point" ? Math.round(fraction * (count - 1)) : Math.min(count - 1, Math.floor(fraction * count));
|
|
24
|
+
onActive(next);
|
|
25
|
+
if (last.current !== next) setOpen(true);
|
|
26
|
+
last.current = next;
|
|
27
|
+
};
|
|
28
|
+
const step = (next) => {
|
|
29
|
+
onActive(Math.min(count - 1, Math.max(0, next)));
|
|
30
|
+
setOpen(true);
|
|
31
|
+
};
|
|
32
|
+
if (!count) return null;
|
|
33
|
+
return /* @__PURE__ */ jsx("input", {
|
|
34
|
+
type: "range",
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
"aria-orientation": orientation,
|
|
37
|
+
min: 0,
|
|
38
|
+
max: count - 1,
|
|
39
|
+
step: 1,
|
|
40
|
+
value: index,
|
|
41
|
+
"aria-valuetext": valueText(index),
|
|
42
|
+
"aria-describedby": open && activeIndex >= 0 ? tooltipId : void 0,
|
|
43
|
+
className: cn("absolute m-0 cursor-crosshair touch-pan-y opacity-0", className),
|
|
44
|
+
style,
|
|
45
|
+
onFocus: () => {
|
|
46
|
+
focused.current = true;
|
|
47
|
+
if (!pointerDriven.current) step(index);
|
|
48
|
+
},
|
|
49
|
+
onBlur: () => {
|
|
50
|
+
focused.current = false;
|
|
51
|
+
mouseFocus.current = false;
|
|
52
|
+
pointerDriven.current = false;
|
|
53
|
+
setOpen(false);
|
|
54
|
+
},
|
|
55
|
+
onPointerEnter: (event) => {
|
|
56
|
+
if (canHover && event.pointerType !== "touch") inspectPointer(event);
|
|
57
|
+
},
|
|
58
|
+
onPointerMove: (event) => {
|
|
59
|
+
if (event.pointerType === "touch" ? event.buttons === 1 : canHover || event.buttons === 1) inspectPointer(event);
|
|
60
|
+
},
|
|
61
|
+
onPointerLeave: (event) => {
|
|
62
|
+
last.current = null;
|
|
63
|
+
const mouse = event.pointerType !== "touch" && mouseFocus.current;
|
|
64
|
+
if (!focused.current || pointerDriven.current || mouse) setOpen(false);
|
|
65
|
+
},
|
|
66
|
+
onPointerDown: (event) => {
|
|
67
|
+
pointerDriven.current = true;
|
|
68
|
+
if (event.pointerType === "touch") onTouchChange?.(true);
|
|
69
|
+
else mouseFocus.current = true;
|
|
70
|
+
last.current = null;
|
|
71
|
+
inspectPointer(event);
|
|
72
|
+
},
|
|
73
|
+
onPointerUp: (event) => {
|
|
74
|
+
if (event.pointerType === "touch") onTouchChange?.(false);
|
|
75
|
+
},
|
|
76
|
+
onPointerCancel: (event) => {
|
|
77
|
+
pointerDriven.current = false;
|
|
78
|
+
if (event.pointerType === "touch") onTouchChange?.(false);
|
|
79
|
+
setOpen(false);
|
|
80
|
+
},
|
|
81
|
+
onClick: () => {
|
|
82
|
+
pointerDriven.current = false;
|
|
83
|
+
},
|
|
84
|
+
onKeyDown: (event) => {
|
|
85
|
+
pointerDriven.current = false;
|
|
86
|
+
mouseFocus.current = false;
|
|
87
|
+
if (event.key === "Escape") setOpen(false);
|
|
88
|
+
else if (vertical && (event.key === "ArrowUp" || event.key === "ArrowDown")) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
step(index + (event.key === "ArrowDown" ? 1 : -1));
|
|
91
|
+
} else if ([
|
|
92
|
+
"ArrowLeft",
|
|
93
|
+
"ArrowRight",
|
|
94
|
+
"ArrowUp",
|
|
95
|
+
"ArrowDown",
|
|
96
|
+
"Home",
|
|
97
|
+
"End",
|
|
98
|
+
"PageUp",
|
|
99
|
+
"PageDown"
|
|
100
|
+
].includes(event.key)) setOpen(true);
|
|
101
|
+
},
|
|
102
|
+
onChange: (event) => {
|
|
103
|
+
if (pointerDriven.current) return;
|
|
104
|
+
step(Number(event.target.value));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export { XYInspector };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=inspector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector.js","names":[],"sources":["../../../../src/components/charts/xy/inspector.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, type PointerEvent, useRef } from \"react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface XYInspectorProps {\n count: number;\n activeIndex: number;\n onActive: (index: number) => void;\n /** Accessible name of the slider. */\n label: string;\n valueText: (index: number) => string;\n /** `point` snaps to the nearest sample (lines); `band` to the slot under the pointer (bars). */\n mode: \"point\" | \"band\";\n /** `vertical` reads categories top to bottom, for horizontal bars. */\n orientation?: \"horizontal\" | \"vertical\";\n open: boolean;\n setOpen: (open: boolean) => void;\n tooltipId?: string;\n canHover: boolean;\n /** Reports a touch drag starting and ending, so marks can track the finger 1:1. */\n onTouchChange?: (touching: boolean) => void;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * One invisible native range over the plot: a single tab stop for keyboard and\n * assistive technology, with pointer hit testing that matches the drawn marks.\n */\nexport function XYInspector({\n count,\n activeIndex,\n onActive,\n label,\n valueText,\n mode,\n orientation = \"horizontal\",\n open,\n setOpen,\n tooltipId,\n canHover,\n onTouchChange,\n className,\n style,\n}: XYInspectorProps) {\n const pointerDriven = useRef(false);\n const focused = useRef(false);\n // Focus from a mouse click is incidental: it must not pin the tooltip open\n // once the pointer leaves. Focus from the keyboard (or keys pressed after a\n // click) is deliberate and keeps it open until blur or Escape.\n const mouseFocus = useRef(false);\n const last = useRef<number | null>(null);\n const index = activeIndex >= 0 ? activeIndex : count - 1;\n const vertical = orientation === \"vertical\";\n const inspectPointer = (event: PointerEvent<HTMLInputElement>) => {\n const bounds = event.currentTarget.getBoundingClientRect();\n const length = vertical ? bounds.height : bounds.width;\n if (!length || !count) return;\n const offset = vertical ? event.clientY - bounds.top : event.clientX - bounds.left;\n const fraction = Math.min(1, Math.max(0, offset / length));\n const next =\n mode === \"point\"\n ? Math.round(fraction * (count - 1))\n : Math.min(count - 1, Math.floor(fraction * count));\n onActive(next);\n if (last.current !== next) setOpen(true);\n last.current = next;\n };\n const step = (next: number) => {\n onActive(Math.min(count - 1, Math.max(0, next)));\n setOpen(true);\n };\n if (!count) return null;\n return (\n <input\n type=\"range\"\n aria-label={label}\n aria-orientation={orientation}\n min={0}\n max={count - 1}\n step={1}\n value={index}\n aria-valuetext={valueText(index)}\n aria-describedby={open && activeIndex >= 0 ? tooltipId : undefined}\n className={cn(\"absolute m-0 cursor-crosshair touch-pan-y opacity-0\", className)}\n style={style}\n onFocus={() => {\n focused.current = true;\n if (!pointerDriven.current) step(index);\n }}\n onBlur={() => {\n focused.current = false;\n mouseFocus.current = false;\n pointerDriven.current = false;\n setOpen(false);\n }}\n onPointerEnter={(event) => {\n if (canHover && event.pointerType !== \"touch\") inspectPointer(event);\n }}\n onPointerMove={(event) => {\n if (event.pointerType === \"touch\" ? event.buttons === 1 : canHover || event.buttons === 1)\n inspectPointer(event);\n }}\n onPointerLeave={(event) => {\n last.current = null;\n // Touch fires a leave after every tap; tap-to-inspect stays open.\n const mouse = event.pointerType !== \"touch\" && mouseFocus.current;\n if (!focused.current || pointerDriven.current || mouse) setOpen(false);\n }}\n onPointerDown={(event) => {\n pointerDriven.current = true;\n if (event.pointerType === \"touch\") onTouchChange?.(true);\n else mouseFocus.current = true;\n last.current = null;\n inspectPointer(event);\n }}\n onPointerUp={(event) => {\n if (event.pointerType === \"touch\") onTouchChange?.(false);\n }}\n onPointerCancel={(event) => {\n pointerDriven.current = false;\n if (event.pointerType === \"touch\") onTouchChange?.(false);\n setOpen(false);\n }}\n onClick={() => {\n // Native range changes finish before click. Release the pointer guard\n // so later assistive-technology changes are accepted.\n pointerDriven.current = false;\n }}\n onKeyDown={(event) => {\n pointerDriven.current = false;\n mouseFocus.current = false;\n if (event.key === \"Escape\") setOpen(false);\n else if (vertical && (event.key === \"ArrowUp\" || event.key === \"ArrowDown\")) {\n // Categories read top to bottom, so Down moves down the list.\n event.preventDefault();\n step(index + (event.key === \"ArrowDown\" ? 1 : -1));\n } else if (\n [\n \"ArrowLeft\",\n \"ArrowRight\",\n \"ArrowUp\",\n \"ArrowDown\",\n \"Home\",\n \"End\",\n \"PageUp\",\n \"PageDown\",\n ].includes(event.key)\n )\n setOpen(true);\n }}\n onChange={(event) => {\n // Native thumb travel differs from the drawn marks. Pointer hit testing\n // owns pointer gestures; the range owns keyboard and AT input.\n if (pointerDriven.current) return;\n step(Number(event.target.value));\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;;AA+BA,SAAgB,YAAY,EAC1B,OACA,aACA,UACA,OACA,WACA,MACA,cAAc,cACd,MACA,SACA,WACA,UACA,eACA,WACA,SACmB;CACnB,MAAM,gBAAgB,OAAO,KAAK;CAClC,MAAM,UAAU,OAAO,KAAK;CAI5B,MAAM,aAAa,OAAO,KAAK;CAC/B,MAAM,OAAO,OAAsB,IAAI;CACvC,MAAM,QAAQ,eAAe,IAAI,cAAc,QAAQ;CACvD,MAAM,WAAW,gBAAgB;CACjC,MAAM,kBAAkB,UAA0C;EAChE,MAAM,SAAS,MAAM,cAAc,sBAAsB;EACzD,MAAM,SAAS,WAAW,OAAO,SAAS,OAAO;EACjD,IAAI,CAAC,UAAU,CAAC,OAAO;EACvB,MAAM,SAAS,WAAW,MAAM,UAAU,OAAO,MAAM,MAAM,UAAU,OAAO;EAC9E,MAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,SAAS,MAAM,CAAC;EACzD,MAAM,OACJ,SAAS,UACL,KAAK,MAAM,YAAY,QAAQ,EAAE,IACjC,KAAK,IAAI,QAAQ,GAAG,KAAK,MAAM,WAAW,KAAK,CAAC;EACtD,SAAS,IAAI;EACb,IAAI,KAAK,YAAY,MAAM,QAAQ,IAAI;EACvC,KAAK,UAAU;CACjB;CACA,MAAM,QAAQ,SAAiB;EAC7B,SAAS,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC;EAC/C,QAAQ,IAAI;CACd;CACA,IAAI,CAAC,OAAO,OAAO;CACnB,OACE,oBAAC,SAAD;EACE,MAAK;EACL,cAAY;EACZ,oBAAkB;EAClB,KAAK;EACL,KAAK,QAAQ;EACb,MAAM;EACN,OAAO;EACP,kBAAgB,UAAU,KAAK;EAC/B,oBAAkB,QAAQ,eAAe,IAAI,YAAY,KAAA;EACzD,WAAW,GAAG,uDAAuD,SAAS;EACvE;EACP,eAAe;GACb,QAAQ,UAAU;GAClB,IAAI,CAAC,cAAc,SAAS,KAAK,KAAK;EACxC;EACA,cAAc;GACZ,QAAQ,UAAU;GAClB,WAAW,UAAU;GACrB,cAAc,UAAU;GACxB,QAAQ,KAAK;EACf;EACA,iBAAiB,UAAU;GACzB,IAAI,YAAY,MAAM,gBAAgB,SAAS,eAAe,KAAK;EACrE;EACA,gBAAgB,UAAU;GACxB,IAAI,MAAM,gBAAgB,UAAU,MAAM,YAAY,IAAI,YAAY,MAAM,YAAY,GACtF,eAAe,KAAK;EACxB;EACA,iBAAiB,UAAU;GACzB,KAAK,UAAU;GAEf,MAAM,QAAQ,MAAM,gBAAgB,WAAW,WAAW;GAC1D,IAAI,CAAC,QAAQ,WAAW,cAAc,WAAW,OAAO,QAAQ,KAAK;EACvE;EACA,gBAAgB,UAAU;GACxB,cAAc,UAAU;GACxB,IAAI,MAAM,gBAAgB,SAAS,gBAAgB,IAAI;QAClD,WAAW,UAAU;GAC1B,KAAK,UAAU;GACf,eAAe,KAAK;EACtB;EACA,cAAc,UAAU;GACtB,IAAI,MAAM,gBAAgB,SAAS,gBAAgB,KAAK;EAC1D;EACA,kBAAkB,UAAU;GAC1B,cAAc,UAAU;GACxB,IAAI,MAAM,gBAAgB,SAAS,gBAAgB,KAAK;GACxD,QAAQ,KAAK;EACf;EACA,eAAe;GAGb,cAAc,UAAU;EAC1B;EACA,YAAY,UAAU;GACpB,cAAc,UAAU;GACxB,WAAW,UAAU;GACrB,IAAI,MAAM,QAAQ,UAAU,QAAQ,KAAK;QACpC,IAAI,aAAa,MAAM,QAAQ,aAAa,MAAM,QAAQ,cAAc;IAE3E,MAAM,eAAe;IACrB,KAAK,SAAS,MAAM,QAAQ,cAAc,IAAI,GAAG;GACnD,OAAO,IACL;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAAC,CAAC,SAAS,MAAM,GAAG,GAEpB,QAAQ,IAAI;EAChB;EACA,WAAW,UAAU;GAGnB,IAAI,cAAc,SAAS;GAC3B,KAAK,OAAO,MAAM,OAAO,KAAK,CAAC;EACjC;CACD,CAAA;AAEL"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as XYRow } from "../../../model-CvWolJdo.js";
|
|
2
|
+
export interface XYLegendProps {
|
|
3
|
+
rows: readonly XYRow[];
|
|
4
|
+
hidden: readonly string[];
|
|
5
|
+
onToggle: (id: string) => void;
|
|
6
|
+
onHover: (id: string | null) => void;
|
|
7
|
+
canHover: boolean;
|
|
8
|
+
label: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Each entry is a toggle: pressed means the series is drawn. */
|
|
12
|
+
export declare function XYLegend({ rows, hidden, onToggle, onHover, canHover, label, className }: XYLegendProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","names":[],"sources":["../../../../src/components/charts/xy/legend.tsx"],"mappings":";iBAKiB;EACf,eAAe;EACf;EACA,WAAW;EACX,UAAU;EACV;EACA;EACA;;;wBAIc,WACd,MACA,QACA,UACA,SACA,UACA,OACA,aACC,gCAAa,IAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "@kumix/utils";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/charts/xy/legend.tsx
|
|
5
|
+
/** Each entry is a toggle: pressed means the series is drawn. */
|
|
6
|
+
function XYLegend({ rows, hidden, onToggle, onHover, canHover, label, className }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
8
|
+
"aria-label": label,
|
|
9
|
+
className: cn("flex flex-wrap items-center gap-x-1 gap-y-1 text-xs", className),
|
|
10
|
+
children: rows.map((row) => {
|
|
11
|
+
const shown = !hidden.includes(row.id);
|
|
12
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-pressed": shown,
|
|
15
|
+
onClick: () => onToggle(row.id),
|
|
16
|
+
onPointerEnter: () => {
|
|
17
|
+
if (canHover && shown) onHover(row.id);
|
|
18
|
+
},
|
|
19
|
+
onPointerLeave: () => onHover(null),
|
|
20
|
+
onFocus: () => {
|
|
21
|
+
if (shown) onHover(row.id);
|
|
22
|
+
},
|
|
23
|
+
onBlur: () => onHover(null),
|
|
24
|
+
className: cn("text-muted-foreground hover:text-foreground focus-visible:outline-ring flex min-h-9 items-center gap-2 rounded-md px-2 transition-[color,opacity] duration-150 focus-visible:outline-2 focus-visible:outline-offset-2", !shown && "opacity-50"),
|
|
25
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: cn("size-2.5 shrink-0 rounded-full border-2 transition-colors duration-150"),
|
|
28
|
+
style: {
|
|
29
|
+
borderColor: row.color,
|
|
30
|
+
backgroundColor: shown ? row.color : "transparent"
|
|
31
|
+
}
|
|
32
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: cn(!shown && "decoration-muted-foreground/60 line-through"),
|
|
34
|
+
children: row.name
|
|
35
|
+
})]
|
|
36
|
+
}) }, row.id);
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { XYLegend };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.js","names":[],"sources":["../../../../src/components/charts/xy/legend.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@kumix/utils\";\nimport type { XYRow } from \"./model\";\n\nexport interface XYLegendProps {\n rows: readonly XYRow[];\n hidden: readonly string[];\n onToggle: (id: string) => void;\n onHover: (id: string | null) => void;\n canHover: boolean;\n label: string;\n className?: string;\n}\n\n/** Each entry is a toggle: pressed means the series is drawn. */\nexport function XYLegend({\n rows,\n hidden,\n onToggle,\n onHover,\n canHover,\n label,\n className,\n}: XYLegendProps) {\n return (\n <ul\n aria-label={label}\n className={cn(\"flex flex-wrap items-center gap-x-1 gap-y-1 text-xs\", className)}\n >\n {rows.map((row) => {\n const shown = !hidden.includes(row.id);\n return (\n <li key={row.id}>\n <button\n type=\"button\"\n aria-pressed={shown}\n onClick={() => onToggle(row.id)}\n onPointerEnter={() => {\n if (canHover && shown) onHover(row.id);\n }}\n onPointerLeave={() => onHover(null)}\n onFocus={() => {\n if (shown) onHover(row.id);\n }}\n onBlur={() => onHover(null)}\n className={cn(\n \"text-muted-foreground hover:text-foreground focus-visible:outline-ring flex min-h-9 items-center gap-2 rounded-md px-2 transition-[color,opacity] duration-150 focus-visible:outline-2 focus-visible:outline-offset-2\",\n !shown && \"opacity-50\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"size-2.5 shrink-0 rounded-full border-2 transition-colors duration-150\",\n )}\n style={{\n borderColor: row.color,\n backgroundColor: shown ? row.color : \"transparent\",\n }}\n />\n <span className={cn(!shown && \"decoration-muted-foreground/60 line-through\")}>\n {row.name}\n </span>\n </button>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":";;;;;AAgBA,SAAgB,SAAS,EACvB,MACA,QACA,UACA,SACA,UACA,OACA,aACgB;CAChB,OACE,oBAAC,MAAD;EACE,cAAY;EACZ,WAAW,GAAG,uDAAuD,SAAS;EAE7E,UAAA,KAAK,KAAK,QAAQ;GACjB,MAAM,QAAQ,CAAC,OAAO,SAAS,IAAI,EAAE;GACrC,OACE,oBAAC,MAAD,EAAA,UACE,qBAAC,UAAD;IACE,MAAK;IACL,gBAAc;IACd,eAAe,SAAS,IAAI,EAAE;IAC9B,sBAAsB;KACpB,IAAI,YAAY,OAAO,QAAQ,IAAI,EAAE;IACvC;IACA,sBAAsB,QAAQ,IAAI;IAClC,eAAe;KACb,IAAI,OAAO,QAAQ,IAAI,EAAE;IAC3B;IACA,cAAc,QAAQ,IAAI;IAC1B,WAAW,GACT,yNACA,CAAC,SAAS,YACZ;IAfF,UAAA,CAiBE,oBAAC,QAAD;KACE,eAAY;KACZ,WAAW,GACT,wEACF;KACA,OAAO;MACL,aAAa,IAAI;MACjB,iBAAiB,QAAQ,IAAI,QAAQ;KACvC;IACD,CAAA,GACD,oBAAC,QAAD;KAAM,WAAW,GAAG,CAAC,SAAS,6CAA6C;KACxE,UAAA,IAAI;IACD,CAAA,CACA;GACN,CAAA,EAAA,GAhCK,IAAI,EAgCT;EAER,CAAC;CACC,CAAA;AAER"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { NumberTicker } from "../../motion/number-ticker.js";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { MotionConfig } from "motion/react";
|
|
6
|
+
// src/components/charts/xy/tooltip-content.tsx
|
|
7
|
+
function Value({ value, format }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(MotionConfig, {
|
|
9
|
+
transition: { type: "tween" },
|
|
10
|
+
children: /* @__PURE__ */ jsx(NumberTicker, {
|
|
11
|
+
value,
|
|
12
|
+
format: () => format(value),
|
|
13
|
+
startOnView: false,
|
|
14
|
+
duration: .2,
|
|
15
|
+
stagger: 0,
|
|
16
|
+
className: "whitespace-pre"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function XYTooltipContent({ title, rows, formatValue, total, compact = false, className }) {
|
|
21
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
22
|
+
className: cn("block max-w-full min-w-0", compact ? "min-w-36" : "w-56", className),
|
|
23
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: cn("block text-xs font-medium", compact ? "mb-1.5" : "mb-2"),
|
|
25
|
+
children: title
|
|
26
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
27
|
+
className: cn("grid", compact ? "gap-1" : "gap-1.5"),
|
|
28
|
+
children: [rows.map((row) => /* @__PURE__ */ jsxs("span", {
|
|
29
|
+
className: "flex items-center gap-2 text-[11px]",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
className: "h-2.5 w-1 shrink-0 rounded-full",
|
|
34
|
+
style: { backgroundColor: row.color }
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx("span", {
|
|
37
|
+
className: "text-muted-foreground min-w-0 flex-1 truncate pr-3",
|
|
38
|
+
children: row.name
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "shrink-0 font-mono tabular-nums",
|
|
42
|
+
children: row.value === null ? "No data" : /* @__PURE__ */ jsx(Value, {
|
|
43
|
+
value: row.value,
|
|
44
|
+
format: formatValue
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}, row.id)), total !== void 0 && total !== null ? /* @__PURE__ */ jsxs("span", {
|
|
49
|
+
className: "border-border mt-0.5 flex items-center gap-2 border-t pt-1.5 text-[11px]",
|
|
50
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "text-muted-foreground flex-1",
|
|
52
|
+
children: "Total"
|
|
53
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "font-mono font-medium tabular-nums",
|
|
55
|
+
children: /* @__PURE__ */ jsx(Value, {
|
|
56
|
+
value: total,
|
|
57
|
+
format: formatValue
|
|
58
|
+
})
|
|
59
|
+
})]
|
|
60
|
+
}) : null]
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { XYTooltipContent };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=tooltip-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-content.js","names":[],"sources":["../../../../src/components/charts/xy/tooltip-content.tsx"],"sourcesContent":["\"use client\";\n\nimport { MotionConfig } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { NumberTicker } from \"../../motion/number-ticker\";\n\nexport interface XYTooltipRow {\n id: string;\n name: string;\n color: string;\n value: number | null;\n}\n\nfunction Value({ value, format }: { value: number; format: (value: number) => string }) {\n return (\n // Keep the short digit tween when composed inside spring-based Tabs.\n <MotionConfig transition={{ type: \"tween\" }}>\n <NumberTicker\n value={value}\n // Keep the consumer's exact formatting, including fractions and units.\n format={() => format(value)}\n startOnView={false}\n duration={0.2}\n stagger={0}\n className=\"whitespace-pre\"\n />\n </MotionConfig>\n );\n}\n\nexport function XYTooltipContent({\n title,\n rows,\n formatValue,\n total,\n compact = false,\n className,\n}: {\n title: string;\n rows: readonly XYTooltipRow[];\n formatValue: (value: number) => string;\n total?: number | null;\n /** Size to the content instead of a fixed panel width, for pointer-following readouts. */\n compact?: boolean;\n className?: string;\n}) {\n return (\n <span className={cn(\"block max-w-full min-w-0\", compact ? \"min-w-36\" : \"w-56\", className)}>\n <span className={cn(\"block text-xs font-medium\", compact ? \"mb-1.5\" : \"mb-2\")}>{title}</span>\n <span className={cn(\"grid\", compact ? \"gap-1\" : \"gap-1.5\")}>\n {rows.map((row) => (\n <span key={row.id} className=\"flex items-center gap-2 text-[11px]\">\n <span\n aria-hidden=\"true\"\n className=\"h-2.5 w-1 shrink-0 rounded-full\"\n style={{ backgroundColor: row.color }}\n />\n <span className=\"text-muted-foreground min-w-0 flex-1 truncate pr-3\">{row.name}</span>\n <span className=\"shrink-0 font-mono tabular-nums\">\n {row.value === null ? \"No data\" : <Value value={row.value} format={formatValue} />}\n </span>\n </span>\n ))}\n {total !== undefined && total !== null ? (\n <span className=\"border-border mt-0.5 flex items-center gap-2 border-t pt-1.5 text-[11px]\">\n <span className=\"text-muted-foreground flex-1\">Total</span>\n <span className=\"font-mono font-medium tabular-nums\">\n <Value value={total} format={formatValue} />\n </span>\n </span>\n ) : null}\n </span>\n </span>\n );\n}\n"],"mappings":";;;;;;AAcA,SAAS,MAAM,EAAE,OAAO,UAAgE;CACtF,OAEE,oBAAC,cAAD;EAAc,YAAY,EAAE,MAAM,QAAQ;EACxC,UAAA,oBAAC,cAAD;GACS;GAEP,cAAc,OAAO,KAAK;GAC1B,aAAa;GACb,UAAU;GACV,SAAS;GACT,WAAU;EACX,CAAA;CACW,CAAA;AAElB;AAEA,SAAgB,iBAAiB,EAC/B,OACA,MACA,aACA,OACA,UAAU,OACV,aASC;CACD,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,4BAA4B,UAAU,aAAa,QAAQ,SAAS;EAAxF,UAAA,CACE,oBAAC,QAAD;GAAM,WAAW,GAAG,6BAA6B,UAAU,WAAW,MAAM;GAAI,UAAA;EAAY,CAAA,GAC5F,qBAAC,QAAD;GAAM,WAAW,GAAG,QAAQ,UAAU,UAAU,SAAS;GAAzD,UAAA,CACG,KAAK,KAAK,QACT,qBAAC,QAAD;IAAmB,WAAU;IAA7B,UAAA;KACE,oBAAC,QAAD;MACE,eAAY;MACZ,WAAU;MACV,OAAO,EAAE,iBAAiB,IAAI,MAAM;KACrC,CAAA;KACD,oBAAC,QAAD;MAAM,WAAU;MAAsD,UAAA,IAAI;KAAW,CAAA;KACrF,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,IAAI,UAAU,OAAO,YAAY,oBAAC,OAAD;OAAO,OAAO,IAAI;OAAO,QAAQ;MAAc,CAAA;KAC7E,CAAA;IACF;GAVK,GAAA,IAAI,EAUT,CACP,GACA,UAAU,KAAA,KAAa,UAAU,OAChC,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAA+B,UAAA;IAAW,CAAA,GAC1D,oBAAC,QAAD;KAAM,WAAU;KACd,UAAA,oBAAC,OAAD;MAAO,OAAO;MAAO,QAAQ;KAAc,CAAA;IACvC,CAAA,CACF;GACJ,CAAA,IAAA,IACA;EACF,CAAA,CAAA;;AAEV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
3
|
-
import { t as Tooltip } from "../../tooltip-CuHpilPN.js";
|
|
4
3
|
import { t as PresenceGate } from "../../presence-gate-DC7yL1Ls.js";
|
|
4
|
+
import { t as Tooltip } from "../../tooltip-CuHpilPN.js";
|
|
5
5
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { t as CopyMenu } from "../../../copy-menu-
|
|
2
|
+
export { t as CopyMenu } from "../../../copy-menu-LU54Aruj.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { SPRING_LAYOUT } from "../../../lib/ease.js";
|
|
3
|
-
import { t as Tooltip } from "../../../tooltip-CuHpilPN.js";
|
|
4
3
|
import { Switch } from "../switch.js";
|
|
4
|
+
import { t as Tooltip } from "../../../tooltip-CuHpilPN.js";
|
|
5
|
+
import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-LU54Aruj.js";
|
|
5
6
|
import { IconButton } from "./icon-button.js";
|
|
6
|
-
import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-CKW3jM1J.js";
|
|
7
7
|
import { TimeSelect } from "./time-select.js";
|
|
8
8
|
import { useRef, useState } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-CKW3jM1J.js";
|
|
3
2
|
import { DayRow } from "./day-row.js";
|
|
3
|
+
import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-LU54Aruj.js";
|
|
4
4
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
|
2
|
+
export interface AvatarGroupMember {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
/** Image URL. Without one, or if it fails to load, initials show. */
|
|
6
|
+
src?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SIZES: {
|
|
9
|
+
readonly sm: {
|
|
10
|
+
readonly box: "size-7 text-[10px]";
|
|
11
|
+
readonly px: 28;
|
|
12
|
+
};
|
|
13
|
+
readonly md: {
|
|
14
|
+
readonly box: "size-9 text-xs";
|
|
15
|
+
readonly px: 36;
|
|
16
|
+
};
|
|
17
|
+
readonly lg: {
|
|
18
|
+
readonly box: "size-11 text-sm";
|
|
19
|
+
readonly px: 44;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type AvatarSize = keyof typeof SIZES;
|
|
23
|
+
export interface AvatarProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
24
|
+
name: string;
|
|
25
|
+
src?: string;
|
|
26
|
+
size?: AvatarSize;
|
|
27
|
+
}
|
|
28
|
+
/** One avatar: the image, or initials when there is no image or it fails. */
|
|
29
|
+
export declare function Avatar({ name, src, size, className, ...props }: AvatarProps): import("react").JSX.Element;
|
|
30
|
+
export interface AvatarGroupProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
31
|
+
members: AvatarGroupMember[];
|
|
32
|
+
/** Avatars shown before the rest collapse into a +N count. */
|
|
33
|
+
max?: number;
|
|
34
|
+
size?: AvatarSize;
|
|
35
|
+
/** Whether every member is shown. Pair with `onExpandedChange`. */
|
|
36
|
+
expanded?: boolean;
|
|
37
|
+
defaultExpanded?: boolean;
|
|
38
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
39
|
+
/** Accessible name for the list, such as "Project members". */
|
|
40
|
+
label?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Overlapping avatars that fan apart on hover, lift the one under the pointer
|
|
44
|
+
* with its name, and expand from a +N count to show everyone.
|
|
45
|
+
*/
|
|
46
|
+
export declare function AvatarGroup({ members, max, size, expanded, defaultExpanded, onExpandedChange, label, className, ...props }: AvatarGroupProps): import("react").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=avatar-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-group.d.ts","names":[],"sources":["../../../src/components/motion/avatar-group.tsx"],"mappings":";iBAUiB;EACf;EACA;;EAEA;;cAGI;;;;;;;;;;;;;;KAMD,0BAA0B;iBASd,oBAAoB,KAAK;EACxC;EACA;EACA,OAAO;;;wBAIO,SAAS,MAAM,KAAK,MAAa,cAAc,SAAS,8BAAW,IAAA;iBA8BlE,yBAAyB,KAAK;EAC7C,SAAS;;EAET;EACA,OAAO;;EAEP;EACA;EACA,oBAAoB;;EAEpB;;;;;;wBAOc,cACd,SACA,KACA,MACA,UACA,iBACA,kBACA,OACA,cACG,SACF,mCAAgB,IAAA"}
|