@kumix/ui 0.4.0 → 0.4.2
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 +52 -45
- package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
- package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/agents/approval-card/index.d.ts +2 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -1
- package/dist/components/agents/approval-card/index.js +2 -0
- package/dist/components/agents/approval-card/index.js.map +1 -1
- package/dist/components/agents/citations.d.ts +14 -2
- package/dist/components/agents/citations.d.ts.map +1 -1
- package/dist/components/agents/citations.js +11 -7
- package/dist/components/agents/citations.js.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.js +3 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
- package/dist/components/charts/bump-chart/context.js +1 -2
- package/dist/components/charts/bump-chart/plot.js +1 -2
- package/dist/components/charts/bump-chart/point.js +1 -1
- package/dist/components/charts/bump-chart/series.d.ts +1 -0
- package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
- package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/context.js +69 -0
- package/dist/components/charts/candlestick-chart/context.js.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.js +56 -0
- package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.js +218 -0
- package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
- package/dist/components/charts/candlestick-chart.d.ts +18 -0
- package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart.js +34 -0
- package/dist/components/charts/candlestick-chart.js.map +1 -0
- package/dist/components/charts/composition-chart/context.js +1 -2
- package/dist/components/charts/composition-chart/plot.js +1 -1
- package/dist/components/charts/donut-chart/center.d.ts +16 -0
- package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/center.js +78 -0
- package/dist/components/charts/donut-chart/center.js.map +1 -0
- package/dist/components/charts/donut-chart/context.d.ts +68 -0
- package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/context.js +2 -0
- package/dist/components/charts/donut-chart/legend.d.ts +17 -0
- package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/legend.js +85 -0
- package/dist/components/charts/donut-chart/legend.js.map +1 -0
- package/dist/components/charts/donut-chart/plot.d.ts +10 -0
- package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/plot.js +108 -0
- package/dist/components/charts/donut-chart/plot.js.map +1 -0
- package/dist/components/charts/donut-chart.d.ts +22 -0
- package/dist/components/charts/donut-chart.d.ts.map +1 -0
- package/dist/components/charts/donut-chart.js +37 -0
- package/dist/components/charts/donut-chart.js.map +1 -0
- package/dist/components/charts/funnel-chart.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart.js +1 -2
- package/dist/components/charts/funnel-chart.js.map +1 -1
- package/dist/components/charts/heat-calendar/tooltip.js +1 -1
- package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
- package/dist/components/charts/liquidity-heatmap.js +1 -1
- package/dist/components/charts/order-book/depth-row.d.ts +8 -2
- package/dist/components/charts/order-book/depth-row.d.ts.map +1 -1
- package/dist/components/charts/order-book/depth-row.js +11 -3
- package/dist/components/charts/order-book/depth-row.js.map +1 -1
- package/dist/components/charts/order-book.d.ts +33 -1
- package/dist/components/charts/order-book.d.ts.map +1 -1
- package/dist/components/charts/order-book.js +92 -17
- package/dist/components/charts/order-book.js.map +1 -1
- package/dist/components/charts/price-target-fan/tooltip.js +1 -1
- package/dist/components/charts/returns-calendar/tooltip.js +1 -1
- package/dist/components/charts/status-bar/tooltip.js +1 -1
- 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/volume-profile.d.ts.map +1 -1
- package/dist/components/custom/confirm-dialog.d.ts +1 -0
- package/dist/components/custom/toast.d.ts +1 -0
- package/dist/components/motion/action-swap.d.ts +1 -1
- package/dist/components/motion/action-swap.d.ts.map +1 -1
- package/dist/components/motion/action-swap.js +46 -20
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/animated-badge.d.ts +1 -1
- package/dist/components/motion/animated-badge.d.ts.map +1 -1
- package/dist/components/motion/animated-badge.js +60 -101
- package/dist/components/motion/animated-badge.js.map +1 -1
- package/dist/components/motion/animated-sidebar.d.ts +1 -0
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-toast-stack.js +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +2 -3
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
- 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/bloom-menu.d.ts +1 -0
- package/dist/components/motion/bloom-menu.d.ts.map +1 -1
- package/dist/components/motion/bloom-menu.js +73 -8
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +6 -10
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
- package/dist/components/motion/bounce-sidebar.js +34 -42
- package/dist/components/motion/bounce-sidebar.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +35 -22
- package/dist/components/motion/bouncy-accordion.js.map +1 -1
- package/dist/components/motion/button/stateful.d.ts.map +1 -1
- package/dist/components/motion/button/stateful.js +3 -0
- package/dist/components/motion/button/stateful.js.map +1 -1
- package/dist/components/motion/card.d.ts +44 -0
- package/dist/components/motion/card.d.ts.map +1 -0
- package/dist/components/motion/card.js +122 -0
- package/dist/components/motion/card.js.map +1 -0
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/checkbox.d.ts +3 -1
- package/dist/components/motion/checkbox.d.ts.map +1 -1
- package/dist/components/motion/checkbox.js +18 -6
- package/dist/components/motion/checkbox.js.map +1 -1
- package/dist/components/motion/color-picker.d.ts +110 -0
- package/dist/components/motion/color-picker.d.ts.map +1 -0
- package/dist/components/motion/color-picker.js +1053 -0
- package/dist/components/motion/color-picker.js.map +1 -0
- package/dist/components/motion/color-selector.d.ts.map +1 -1
- package/dist/components/motion/color-selector.js +9 -2
- package/dist/components/motion/color-selector.js.map +1 -1
- package/dist/components/motion/combobox/content.d.ts +1 -0
- package/dist/components/motion/command-palette.js +3 -3
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.d.ts +1 -0
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/date-range-picker.d.ts.map +1 -1
- package/dist/components/motion/digit-swap.d.ts +9 -1
- package/dist/components/motion/digit-swap.d.ts.map +1 -1
- package/dist/components/motion/digit-swap.js +18 -7
- package/dist/components/motion/digit-swap.js.map +1 -1
- package/dist/components/motion/drawer.d.ts +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +10 -10
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
- package/dist/components/motion/expandable-control.d.ts +1 -0
- package/dist/components/motion/feedback-widget.js +4 -1
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/knockout-wheel.d.ts.map +1 -1
- package/dist/components/motion/knockout-wheel.js +1 -2
- package/dist/components/motion/knockout-wheel.js.map +1 -1
- package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
- package/dist/components/motion/morphing-lightbox.js +1 -1
- package/dist/components/motion/morphing-modal.d.ts +6 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +37 -5
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search-chips.d.ts +54 -0
- package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
- package/dist/components/motion/morphing-search-chips.js +599 -0
- package/dist/components/motion/morphing-search-chips.js.map +1 -0
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/multi-select/content.d.ts +1 -0
- package/dist/components/motion/not-found/shared.d.ts +1 -0
- package/dist/components/motion/number-ticker.d.ts +6 -1
- package/dist/components/motion/number-ticker.d.ts.map +1 -1
- package/dist/components/motion/number-ticker.js +19 -9
- package/dist/components/motion/number-ticker.js.map +1 -1
- package/dist/components/motion/otp-input.js +19 -11
- package/dist/components/motion/otp-input.js.map +1 -1
- package/dist/components/motion/parallax.js.map +1 -1
- package/dist/components/motion/popover-morph.d.ts +5 -3
- package/dist/components/motion/popover-morph.d.ts.map +1 -1
- package/dist/components/motion/popover-morph.js +47 -52
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.d.ts +1 -0
- package/dist/components/motion/popover.js +7 -1
- package/dist/components/motion/popover.js.map +1 -1
- package/dist/components/motion/prediction-market-card.js +2 -3
- package/dist/components/motion/prediction-market-card.js.map +1 -1
- package/dist/components/motion/prediction-market.js +1 -1
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/radio.d.ts +8 -2
- package/dist/components/motion/radio.d.ts.map +1 -1
- package/dist/components/motion/radio.js +70 -10
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/scroll-progress.d.ts +1 -0
- package/dist/components/motion/select-morph.d.ts +1 -1
- package/dist/components/motion/select-morph.d.ts.map +1 -1
- package/dist/components/motion/select-morph.js +89 -21
- package/dist/components/motion/select-morph.js.map +1 -1
- package/dist/components/motion/select.d.ts.map +1 -1
- package/dist/components/motion/select.js +153 -135
- package/dist/components/motion/select.js.map +1 -1
- package/dist/components/motion/shader-background.d.ts +4 -2
- package/dist/components/motion/shader-background.d.ts.map +1 -1
- package/dist/components/motion/shader-background.js +9 -3
- package/dist/components/motion/shader-background.js.map +1 -1
- package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
- package/dist/components/motion/shared-layout-bg.js +17 -3
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/sortable-list.d.ts +1 -0
- package/dist/components/motion/sortable-stack.js +1 -2
- package/dist/components/motion/swipeable-list.d.ts.map +1 -1
- package/dist/components/motion/swipeable-list.js +61 -4
- package/dist/components/motion/swipeable-list.js.map +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/tabs.d.ts +13 -3
- package/dist/components/motion/tabs.d.ts.map +1 -1
- package/dist/components/motion/tabs.js +248 -26
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/text-reveal.d.ts +1 -0
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/motion/tooltip/positioner.d.ts +8 -26
- package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
- package/dist/components/motion/tooltip/positioner.js +1 -2
- package/dist/components/motion/tooltip.d.ts +62 -20
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +1 -135
- package/dist/components/motion/wallet-card/account-avatar.js +1 -2
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js +61 -34
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +5 -2
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-context.js.map +1 -1
- package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-lib.js +145 -29
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
- package/dist/components/reui/cascader/cascader.d.ts +13 -8
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js +31 -16
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/reui/color-picker.d.ts +280 -0
- package/dist/components/reui/color-picker.d.ts.map +1 -0
- package/dist/components/reui/color-picker.js +2013 -0
- package/dist/components/reui/color-picker.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +50 -29
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +2 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +10 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +15 -10
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +54 -14
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +37 -42
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +174 -16
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +223 -89
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +55 -1
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +112 -22
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts +1 -0
- package/dist/components/reui/date-selector.d.ts.map +1 -1
- package/dist/components/reui/date-selector.js +22 -16
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/emoji-picker.d.ts +367 -0
- package/dist/components/reui/emoji-picker.d.ts.map +1 -0
- package/dist/components/reui/emoji-picker.js +1768 -0
- package/dist/components/reui/emoji-picker.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +4 -4
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +34 -31
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- package/dist/components/reui/file-type.d.ts +792 -0
- package/dist/components/reui/file-type.d.ts.map +1 -0
- package/dist/components/reui/file-type.js +1367 -0
- package/dist/components/reui/file-type.js.map +1 -0
- package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-builder.d.ts +1 -1
- package/dist/components/reui/filters/filters-chip.d.ts +5 -1
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-chip.js +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +4 -4
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +5 -2
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/icon-tile.js +8 -7
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/kanban.d.ts.map +1 -1
- package/dist/components/reui/kanban.js +1 -1
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/phone-input.js +30 -27
- package/dist/components/reui/phone-input.js.map +1 -1
- package/dist/components/reui/scrollspy.d.ts +1 -0
- package/dist/components/reui/time-picker.js +1 -1
- package/dist/components/reui/time-picker.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/code-block.d.ts +29 -0
- package/dist/components/ui/code-block.d.ts.map +1 -0
- package/dist/components/ui/code-block.js +124 -0
- package/dist/components/ui/code-block.js.map +1 -0
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/direction.js +1 -2
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/message-scroller.d.ts.map +1 -1
- package/dist/components/ui/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/trace.d.ts +21 -0
- package/dist/components/ui/trace.d.ts.map +1 -0
- package/dist/components/ui/trace.js +77 -0
- package/dist/components/ui/trace.js.map +1 -0
- package/dist/context-BYXeJQnz.d.ts.map +1 -1
- package/dist/context-tTdLKYNf.js +99 -0
- package/dist/context-tTdLKYNf.js.map +1 -0
- package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-DOg9Jh-U.js} +2 -2
- package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
- package/dist/hooks/use-focus-trap.d.ts +22 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.js +80 -0
- package/dist/hooks/use-focus-trap.js.map +1 -0
- package/dist/hooks/use-highlighted-code.d.ts +5 -0
- package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
- package/dist/hooks/use-highlighted-code.js +128 -0
- package/dist/hooks/use-highlighted-code.js.map +1 -0
- package/dist/hooks/use-hover-gesture.d.ts +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +1 -0
- package/dist/hooks/use-listbox.d.ts +29 -0
- package/dist/hooks/use-listbox.d.ts.map +1 -0
- package/dist/hooks/use-listbox.js +75 -0
- package/dist/hooks/use-listbox.js.map +1 -0
- package/dist/hooks/use-scroll-position.d.ts +1 -0
- package/dist/hooks/use-slider-input.d.ts +1 -0
- package/dist/hooks/use-viewport.d.ts +1 -0
- package/dist/lib/tick-sound.d.ts +1 -0
- package/dist/model-NSIg2p7a.d.ts +20 -0
- package/dist/model-NSIg2p7a.d.ts.map +1 -0
- package/dist/model-_mRyI6V9.d.ts +18 -0
- package/dist/model-_mRyI6V9.d.ts.map +1 -0
- package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
- package/dist/positioner-3r3cfkqT.js.map +1 -0
- package/dist/tooltip-Bam5KeYe.js +535 -0
- package/dist/tooltip-Bam5KeYe.js.map +1 -0
- package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
- package/dist/use-position-DOi1gVL0.d.ts +32 -0
- package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
- package/package.json +11 -11
- package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
- package/dist/components/motion/tooltip.js.map +0 -1
- package/dist/model-DfeFradZ.d.ts +0 -9
- package/dist/model-DfeFradZ.d.ts.map +0 -1
- package/dist/positioner-3mCqiebN.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning-text.js","names":[],"sources":["../../../../src/components/agents/loading-states/reasoning-text.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useState } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport {\n TEXT_SHIMMER_CLASS_NAME,\n TEXT_SHIMMER_KEYFRAMES,\n textShimmerStyle,\n} from \"../../../lib/text-shimmer\";\nimport { Loader } from \"../../motion/loader\";\nimport { TextScramble } from \"../../motion/text-scramble\";\n\nconst DEFAULT_PHRASES = [\n \"Thinking\",\n \"Reading the context\",\n \"Connecting the details\",\n \"Forming a response\",\n];\n\nconst CASCADE_STAGGER = 0.025;\n\nexport type ReasoningTextVariant = \"cascade\" | \"swap\" | \"scramble\";\n\nexport interface ReasoningTextProps {\n /** Phrases cycled through while the agent works. */\n phrases?: string[];\n /** Animation used when the active phrase changes. */\n variant?: ReasoningTextVariant;\n /** Milliseconds each phrase remains visible. */\n interval?: number;\n /** Seconds taken for one shimmer pass. */\n shimmerDuration?: number;\n /** Optional leading visual. Defaults to a terminal-style ASCII loader. */\n indicator?: ReactNode;\n className?: string;\n}\n\ntype PhraseProps = {\n phrase: string;\n reduce: boolean;\n shimmerDuration: number;\n};\n\nfunction CascadePhrase({ phrase, reduce, shimmerDuration }: PhraseProps) {\n const text = `${phrase}…`;\n\n if (reduce) {\n return (\n <span\n className={cn(\n \"col-start-1 row-start-1 inline-block justify-self-start whitespace-pre\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n >\n {text}\n </span>\n );\n }\n\n return (\n <AnimatePresence initial={false}>\n <motion.span\n key={phrase}\n className=\"col-start-1 row-start-1 inline-block justify-self-start whitespace-pre\"\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n >\n {text.split(\"\").map((character, characterIndex) => (\n <motion.span\n key={characterIndex}\n custom={characterIndex * CASCADE_STAGGER}\n variants={{\n initial: { opacity: 0, y: \"100%\" },\n animate: (delay: number) => ({\n opacity: 1,\n y: \"0%\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number) => ({\n opacity: 0,\n y: \"-100%\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n delay: delay * 0.45,\n },\n }),\n }}\n className={cn(\n \"inline-block whitespace-pre will-change-[opacity,transform]\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n >\n {character}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n );\n}\n\nfunction SwapPhrase({ phrase, reduce, shimmerDuration }: PhraseProps) {\n return (\n <AnimatePresence initial={false}>\n <motion.span\n key={phrase}\n className={cn(\n \"col-start-1 row-start-1 inline-block justify-self-start whitespace-nowrap will-change-[opacity,transform]\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 3 }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0 }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -3 }}\n transition={{\n duration: reduce ? 0.12 : 0.2,\n ease: EASE_OUT,\n }}\n >\n {phrase}…\n </motion.span>\n </AnimatePresence>\n );\n}\n\nfunction ScramblePhrase({ phrase, shimmerDuration }: PhraseProps) {\n const target = `${phrase}…`;\n\n return (\n <TextScramble\n text={target}\n className={cn(\n \"col-start-1 row-start-1 justify-self-start tabular-nums\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n />\n );\n}\n\nexport function ReasoningText({\n phrases = DEFAULT_PHRASES,\n variant = \"cascade\",\n interval = 1800,\n shimmerDuration = 2.2,\n indicator,\n className,\n}: ReasoningTextProps) {\n const reduce = useReducedMotion() ?? false;\n const [index, setIndex] = useState(0);\n const statusId = useId();\n const safePhrases = phrases.length > 0 ? phrases : DEFAULT_PHRASES;\n const phrase = safePhrases[index % safePhrases.length];\n const longestPhrase = safePhrases.reduce((longest, current) =>\n current.length > longest.length ? current : longest,\n );\n const phraseProps = { phrase, reduce, shimmerDuration };\n\n useEffect(() => {\n if (safePhrases.length < 2) return;\n\n const timer = window.setInterval(\n () => {\n setIndex((current) => (current + 1) % safePhrases.length);\n },\n Math.max(600, interval),\n );\n\n return () => window.clearInterval(timer);\n }, [interval, safePhrases.length]);\n\n return (\n <>\n <style>{TEXT_SHIMMER_KEYFRAMES}</style>\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-labelledby={statusId}\n className={cn(\n \"inline-flex items-center gap-2 font-medium text-muted-foreground text-sm\",\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className=\"inline-flex size-3 shrink-0 items-center justify-center\"\n >\n {indicator ?? <Loader variant=\"ascii-line\" size={14} speed={0.8} label=\"Reasoning\" />}\n </span>\n\n <span aria-hidden=\"true\" className=\"grid overflow-hidden text-left\">\n <span className=\"invisible col-start-1 row-start-1 whitespace-nowrap\">\n {longestPhrase}…\n </span>\n {variant === \"cascade\" ? (\n <CascadePhrase {...phraseProps} />\n ) : variant === \"scramble\" ? (\n <ScramblePhrase {...phraseProps} />\n ) : (\n <SwapPhrase {...phraseProps} />\n )}\n </span>\n\n <span id={statusId} className=\"sr-only\">\n {phrase}\n </span>\n </span>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAeA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;AACF;AAEA,MAAM,kBAAkB;AAwBxB,SAAS,cAAc,EAAE,QAAQ,QAAQ,mBAAgC;CACvE,MAAM,OAAO,GAAG,OAAO;CAEvB,IAAI,QACF,OACE,oBAAC,QAAD;EACE,WAAW,GACT,0EACA,uBACF;EACA,OAAO,iBAAiB,eAAe;EAEtC,UAAA;CACG,CAAA;CAIV,OACE,oBAAC,iBAAD;EAAiB,SAAS;EACxB,UAAA,oBAAC,OAAO,MAAR;GAEE,WAAU;GACV,SAAQ;GACR,SAAQ;GACR,MAAK;GAEJ,UAAA,KAAK,MAAM,EAAE,CAAC,CAAC,KAAK,WAAW,mBAC9B,oBAAC,OAAO,MAAR;IAEE,QAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"reasoning-text.js","names":[],"sources":["../../../../src/components/agents/loading-states/reasoning-text.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useState } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport {\n TEXT_SHIMMER_CLASS_NAME,\n TEXT_SHIMMER_KEYFRAMES,\n textShimmerStyle,\n} from \"../../../lib/text-shimmer\";\nimport { Loader } from \"../../motion/loader\";\nimport { TextScramble } from \"../../motion/text-scramble\";\n\nconst DEFAULT_PHRASES = [\n \"Thinking\",\n \"Reading the context\",\n \"Connecting the details\",\n \"Forming a response\",\n];\n\nconst CASCADE_STAGGER = 0.025;\n\nexport type ReasoningTextVariant = \"cascade\" | \"swap\" | \"scramble\";\n\nexport interface ReasoningTextProps {\n /** Phrases cycled through while the agent works. */\n phrases?: string[];\n /** Animation used when the active phrase changes. */\n variant?: ReasoningTextVariant;\n /** Milliseconds each phrase remains visible. */\n interval?: number;\n /** Seconds taken for one shimmer pass. */\n shimmerDuration?: number;\n /** Optional leading visual. Defaults to a terminal-style ASCII loader. */\n indicator?: ReactNode;\n className?: string;\n}\n\ntype PhraseProps = {\n phrase: string;\n reduce: boolean;\n shimmerDuration: number;\n};\n\nfunction CascadePhrase({ phrase, reduce, shimmerDuration }: PhraseProps) {\n const text = `${phrase}…`;\n\n if (reduce) {\n return (\n <span\n className={cn(\n \"col-start-1 row-start-1 inline-block justify-self-start whitespace-pre\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n >\n {text}\n </span>\n );\n }\n\n return (\n <AnimatePresence initial={false}>\n <motion.span\n key={phrase}\n className=\"col-start-1 row-start-1 inline-block justify-self-start whitespace-pre\"\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n >\n {text.split(\"\").map((character, characterIndex) => (\n <motion.span\n key={characterIndex}\n custom={characterIndex * CASCADE_STAGGER}\n // Own states: a phrase that cycles back re-enters mid-exit, and\n // only owned targets are restored.\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n variants={{\n initial: { opacity: 0, y: \"100%\" },\n animate: (delay: number) => ({\n opacity: 1,\n y: \"0%\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number) => ({\n opacity: 0,\n y: \"-100%\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n delay: delay * 0.45,\n },\n }),\n }}\n className={cn(\n \"inline-block whitespace-pre will-change-[opacity,transform]\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n >\n {character}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n );\n}\n\nfunction SwapPhrase({ phrase, reduce, shimmerDuration }: PhraseProps) {\n return (\n <AnimatePresence initial={false}>\n <motion.span\n key={phrase}\n className={cn(\n \"col-start-1 row-start-1 inline-block justify-self-start whitespace-nowrap will-change-[opacity,transform]\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 3 }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0 }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -3 }}\n transition={{\n duration: reduce ? 0.12 : 0.2,\n ease: EASE_OUT,\n }}\n >\n {phrase}…\n </motion.span>\n </AnimatePresence>\n );\n}\n\nfunction ScramblePhrase({ phrase, shimmerDuration }: PhraseProps) {\n const target = `${phrase}…`;\n\n return (\n <TextScramble\n text={target}\n className={cn(\n \"col-start-1 row-start-1 justify-self-start tabular-nums\",\n TEXT_SHIMMER_CLASS_NAME,\n )}\n style={textShimmerStyle(shimmerDuration)}\n />\n );\n}\n\nexport function ReasoningText({\n phrases = DEFAULT_PHRASES,\n variant = \"cascade\",\n interval = 1800,\n shimmerDuration = 2.2,\n indicator,\n className,\n}: ReasoningTextProps) {\n const reduce = useReducedMotion() ?? false;\n const [index, setIndex] = useState(0);\n const statusId = useId();\n const safePhrases = phrases.length > 0 ? phrases : DEFAULT_PHRASES;\n const phrase = safePhrases[index % safePhrases.length];\n const longestPhrase = safePhrases.reduce((longest, current) =>\n current.length > longest.length ? current : longest,\n );\n const phraseProps = { phrase, reduce, shimmerDuration };\n\n useEffect(() => {\n if (safePhrases.length < 2) return;\n\n const timer = window.setInterval(\n () => {\n setIndex((current) => (current + 1) % safePhrases.length);\n },\n Math.max(600, interval),\n );\n\n return () => window.clearInterval(timer);\n }, [interval, safePhrases.length]);\n\n return (\n <>\n <style>{TEXT_SHIMMER_KEYFRAMES}</style>\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-labelledby={statusId}\n className={cn(\n \"inline-flex items-center gap-2 font-medium text-muted-foreground text-sm\",\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className=\"inline-flex size-3 shrink-0 items-center justify-center\"\n >\n {indicator ?? <Loader variant=\"ascii-line\" size={14} speed={0.8} label=\"Reasoning\" />}\n </span>\n\n <span aria-hidden=\"true\" className=\"grid overflow-hidden text-left\">\n <span className=\"invisible col-start-1 row-start-1 whitespace-nowrap\">\n {longestPhrase}…\n </span>\n {variant === \"cascade\" ? (\n <CascadePhrase {...phraseProps} />\n ) : variant === \"scramble\" ? (\n <ScramblePhrase {...phraseProps} />\n ) : (\n <SwapPhrase {...phraseProps} />\n )}\n </span>\n\n <span id={statusId} className=\"sr-only\">\n {phrase}\n </span>\n </span>\n </>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
export { BumpChartContext, useBumpChart, useBumpChartModel };
|
|
2
|
+
export { t as BumpChartContext, n as useBumpChart, r as useBumpChartModel } from "../../../context-BqjZ1Z_w.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { EASE_OUT, SPRING_PRESS } from "../../../lib/ease.js";
|
|
3
3
|
import { i as PLOT, n as useBumpChart } from "../../../context-BqjZ1Z_w.js";
|
|
4
|
-
import { Tooltip } from "
|
|
4
|
+
import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { motion, useTransform } from "motion/react";
|
|
7
7
|
//#region src/components/charts/bump-chart/point.tsx
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/charts/candlestick-chart/context.d.ts
|
|
3
|
+
export type Candle = {
|
|
4
|
+
/** Stable id, such as the open timestamp. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Axis and readout label, such as "14:05". */
|
|
7
|
+
label: string;
|
|
8
|
+
open: number;
|
|
9
|
+
high: number;
|
|
10
|
+
low: number;
|
|
11
|
+
close: number;
|
|
12
|
+
volume: number;
|
|
13
|
+
};
|
|
14
|
+
export interface CandlestickChartProps {
|
|
15
|
+
candles: readonly Candle[];
|
|
16
|
+
/** Draws a dashed line and tag at this price, usually the last trade. */
|
|
17
|
+
lastPrice?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Controlled crosshair candle, by `id`, so it stays on the same candle as
|
|
20
|
+
* new ones arrive. Pair with `onActiveIdChange`.
|
|
21
|
+
*/
|
|
22
|
+
activeId?: string | null;
|
|
23
|
+
defaultActiveId?: string | null;
|
|
24
|
+
onActiveIdChange?: (id: string | null) => void;
|
|
25
|
+
formatPrice?: (value: number) => string;
|
|
26
|
+
formatVolume?: (value: number) => string;
|
|
27
|
+
/** Accessible name for the chart. */
|
|
28
|
+
label?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export declare function useCandlestickModel({ candles, lastPrice, activeId, defaultActiveId, onActiveIdChange, formatPrice, formatVolume, label }: CandlestickChartProps): {
|
|
33
|
+
candles: readonly Candle[];
|
|
34
|
+
lastPrice: number | undefined;
|
|
35
|
+
active: number | null;
|
|
36
|
+
setActive: (next: number | null) => void;
|
|
37
|
+
scale: {
|
|
38
|
+
min: number;
|
|
39
|
+
max: number;
|
|
40
|
+
volumeMax: number;
|
|
41
|
+
};
|
|
42
|
+
formatPrice: (value: number) => string;
|
|
43
|
+
formatVolume: (value: number) => string;
|
|
44
|
+
label: string;
|
|
45
|
+
reduce: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type CandlestickModel = ReturnType<typeof useCandlestickModel>;
|
|
48
|
+
export declare const CandlestickContext: import("react").Context<{
|
|
49
|
+
candles: readonly Candle[];
|
|
50
|
+
lastPrice: number | undefined;
|
|
51
|
+
active: number | null;
|
|
52
|
+
setActive: (next: number | null) => void;
|
|
53
|
+
scale: {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
volumeMax: number;
|
|
57
|
+
};
|
|
58
|
+
formatPrice: (value: number) => string;
|
|
59
|
+
formatVolume: (value: number) => string;
|
|
60
|
+
label: string;
|
|
61
|
+
reduce: boolean;
|
|
62
|
+
} | null>;
|
|
63
|
+
export declare function useCandlestickChart(): {
|
|
64
|
+
candles: readonly Candle[];
|
|
65
|
+
lastPrice: number | undefined;
|
|
66
|
+
active: number | null;
|
|
67
|
+
setActive: (next: number | null) => void;
|
|
68
|
+
scale: {
|
|
69
|
+
min: number;
|
|
70
|
+
max: number;
|
|
71
|
+
volumeMax: number;
|
|
72
|
+
};
|
|
73
|
+
formatPrice: (value: number) => string;
|
|
74
|
+
formatVolume: (value: number) => string;
|
|
75
|
+
label: string;
|
|
76
|
+
reduce: boolean;
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../../src/components/charts/candlestick-chart/context.tsx"],"mappings":";;YAcY;;EAEV;;EAEA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,kBAAkB;;EAElB;;;;;EAKA;EACA;EACA,oBAAoB;EACpB,eAAe;EACf,gBAAgB;;EAEhB;EACA;EACA,WAAW;;wBAUG,sBACd,SACA,WACA,UACA,iBACA,kBACA,aACA,cACA,SACC;;;;EAcoC,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA;;;;YAsEb,mBAAmB,kBAAkB;qBAEpC,oCAAkB;;;;EAnCQ,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA;;;;wBA0ET;;;;EArCuB,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useReducedMotion } from "motion/react";
|
|
4
|
+
//#region src/components/charts/candlestick-chart/context.tsx
|
|
5
|
+
const defaultPrice = (value) => value.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
6
|
+
const defaultVolume = (value) => new Intl.NumberFormat("en-US", {
|
|
7
|
+
notation: "compact",
|
|
8
|
+
maximumFractionDigits: 1
|
|
9
|
+
}).format(value);
|
|
10
|
+
function useCandlestickModel({ candles, lastPrice, activeId, defaultActiveId = null, onActiveIdChange, formatPrice = defaultPrice, formatVolume = defaultVolume, label = "Candlestick chart" }) {
|
|
11
|
+
const reduce = useReducedMotion() ?? false;
|
|
12
|
+
const [internalActive, setInternalActive] = useState(defaultActiveId);
|
|
13
|
+
const rawActive = activeId === void 0 ? internalActive : activeId;
|
|
14
|
+
const index = rawActive === null ? -1 : candles.findIndex((candle) => candle.id === rawActive);
|
|
15
|
+
const active = index >= 0 ? index : null;
|
|
16
|
+
const latest = useRef({
|
|
17
|
+
candles,
|
|
18
|
+
controlled: activeId !== void 0,
|
|
19
|
+
onActiveIdChange
|
|
20
|
+
});
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
latest.current = {
|
|
23
|
+
candles,
|
|
24
|
+
controlled: activeId !== void 0,
|
|
25
|
+
onActiveIdChange
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
candles,
|
|
30
|
+
lastPrice,
|
|
31
|
+
active,
|
|
32
|
+
setActive: useCallback((next) => {
|
|
33
|
+
const id = next === null ? null : latest.current.candles[next]?.id ?? null;
|
|
34
|
+
if (!latest.current.controlled) setInternalActive(id);
|
|
35
|
+
latest.current.onActiveIdChange?.(id);
|
|
36
|
+
}, []),
|
|
37
|
+
scale: useMemo(() => {
|
|
38
|
+
const lows = candles.map((candle) => candle.low);
|
|
39
|
+
const highs = candles.map((candle) => candle.high);
|
|
40
|
+
if (lastPrice !== void 0) {
|
|
41
|
+
lows.push(lastPrice);
|
|
42
|
+
highs.push(lastPrice);
|
|
43
|
+
}
|
|
44
|
+
const min = lows.length ? Math.min(...lows) : 0;
|
|
45
|
+
const max = highs.length ? Math.max(...highs) : 1;
|
|
46
|
+
const pad = Math.max((max - min) * .08, max * 5e-4, 1e-4);
|
|
47
|
+
const volumeMax = Math.max(1, ...candles.map((candle) => candle.volume));
|
|
48
|
+
return {
|
|
49
|
+
min: min - pad,
|
|
50
|
+
max: max + pad,
|
|
51
|
+
volumeMax
|
|
52
|
+
};
|
|
53
|
+
}, [candles, lastPrice]),
|
|
54
|
+
formatPrice,
|
|
55
|
+
formatVolume,
|
|
56
|
+
label,
|
|
57
|
+
reduce
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const CandlestickContext = createContext(null);
|
|
61
|
+
function useCandlestickChart() {
|
|
62
|
+
const model = useContext(CandlestickContext);
|
|
63
|
+
if (!model) throw new Error("CandlestickChart parts must be used inside <CandlestickChart>");
|
|
64
|
+
return model;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { CandlestickContext, useCandlestickChart, useCandlestickModel };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../../src/components/charts/candlestick-chart/context.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nexport type Candle = {\n /** Stable id, such as the open timestamp. */\n id: string;\n /** Axis and readout label, such as \"14:05\". */\n label: string;\n open: number;\n high: number;\n low: number;\n close: number;\n volume: number;\n};\n\nexport interface CandlestickChartProps {\n candles: readonly Candle[];\n /** Draws a dashed line and tag at this price, usually the last trade. */\n lastPrice?: number;\n /**\n * Controlled crosshair candle, by `id`, so it stays on the same candle as\n * new ones arrive. Pair with `onActiveIdChange`.\n */\n activeId?: string | null;\n defaultActiveId?: string | null;\n onActiveIdChange?: (id: string | null) => void;\n formatPrice?: (value: number) => string;\n formatVolume?: (value: number) => string;\n /** Accessible name for the chart. */\n label?: string;\n className?: string;\n children?: ReactNode;\n}\n\nconst defaultPrice = (value: number) => value.toLocaleString(\"en-US\", { maximumFractionDigits: 2 });\nconst defaultVolume = (value: number) =>\n new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n maximumFractionDigits: 1,\n }).format(value);\n\nexport function useCandlestickModel({\n candles,\n lastPrice,\n activeId,\n defaultActiveId = null,\n onActiveIdChange,\n formatPrice = defaultPrice,\n formatVolume = defaultVolume,\n label = \"Candlestick chart\",\n}: CandlestickChartProps) {\n const reduce = useReducedMotion() ?? false;\n const [internalActive, setInternalActive] = useState(defaultActiveId);\n const rawActive = activeId === undefined ? internalActive : activeId;\n // Resolve the crosshair during render by id; a candle that scrolled out of\n // the window clears it rather than landing on a neighbour.\n const index = rawActive === null ? -1 : candles.findIndex((candle) => candle.id === rawActive);\n const active = index >= 0 ? index : null;\n\n // Stable setter that reads the latest candles and callback from a ref.\n const latest = useRef({ candles, controlled: activeId !== undefined, onActiveIdChange });\n useLayoutEffect(() => {\n latest.current = { candles, controlled: activeId !== undefined, onActiveIdChange };\n });\n const setActive = useCallback((next: number | null) => {\n const id = next === null ? null : (latest.current.candles[next]?.id ?? null);\n if (!latest.current.controlled) setInternalActive(id);\n latest.current.onActiveIdChange?.(id);\n }, []);\n\n const scale = useMemo(() => {\n const lows = candles.map((candle) => candle.low);\n const highs = candles.map((candle) => candle.high);\n if (lastPrice !== undefined) {\n lows.push(lastPrice);\n highs.push(lastPrice);\n }\n const min = lows.length ? Math.min(...lows) : 0;\n const max = highs.length ? Math.max(...highs) : 1;\n const pad = Math.max((max - min) * 0.08, max * 0.0005, 0.0001);\n const volumeMax = Math.max(1, ...candles.map((candle) => candle.volume));\n return { min: min - pad, max: max + pad, volumeMax };\n }, [candles, lastPrice]);\n\n return {\n candles,\n lastPrice,\n active,\n setActive,\n scale,\n formatPrice,\n formatVolume,\n label,\n reduce,\n };\n}\n\nexport type CandlestickModel = ReturnType<typeof useCandlestickModel>;\n\nexport const CandlestickContext = createContext<CandlestickModel | null>(null);\n\nexport function useCandlestickChart() {\n const model = useContext(CandlestickContext);\n if (!model) throw new Error(\"CandlestickChart parts must be used inside <CandlestickChart>\");\n return model;\n}\n"],"mappings":";;;;AA6CA,MAAM,gBAAgB,UAAkB,MAAM,eAAe,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAClG,MAAM,iBAAiB,UACrB,IAAI,KAAK,aAAa,SAAS;CAC7B,UAAU;CACV,uBAAuB;AACzB,CAAC,CAAC,CAAC,OAAO,KAAK;AAEjB,SAAgB,oBAAoB,EAClC,SACA,WACA,UACA,kBAAkB,MAClB,kBACA,cAAc,cACd,eAAe,eACf,QAAQ,uBACgB;CACxB,MAAM,SAAS,iBAAiB,KAAK;CACrC,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,eAAe;CACpE,MAAM,YAAY,aAAa,KAAA,IAAY,iBAAiB;CAG5D,MAAM,QAAQ,cAAc,OAAO,KAAK,QAAQ,WAAW,WAAW,OAAO,OAAO,SAAS;CAC7F,MAAM,SAAS,SAAS,IAAI,QAAQ;CAGpC,MAAM,SAAS,OAAO;EAAE;EAAS,YAAY,aAAa,KAAA;EAAW;CAAiB,CAAC;CACvF,sBAAsB;EACpB,OAAO,UAAU;GAAE;GAAS,YAAY,aAAa,KAAA;GAAW;EAAiB;CACnF,CAAC;CAqBD,OAAO;EACL;EACA;EACA;EACA,WAxBgB,aAAa,SAAwB;GACrD,MAAM,KAAK,SAAS,OAAO,OAAQ,OAAO,QAAQ,QAAQ,KAAK,EAAE,MAAM;GACvE,IAAI,CAAC,OAAO,QAAQ,YAAY,kBAAkB,EAAE;GACpD,OAAO,QAAQ,mBAAmB,EAAE;EACtC,GAAG,CAAC,CAoBM;EACR,OAnBY,cAAc;GAC1B,MAAM,OAAO,QAAQ,KAAK,WAAW,OAAO,GAAG;GAC/C,MAAM,QAAQ,QAAQ,KAAK,WAAW,OAAO,IAAI;GACjD,IAAI,cAAc,KAAA,GAAW;IAC3B,KAAK,KAAK,SAAS;IACnB,MAAM,KAAK,SAAS;GACtB;GACA,MAAM,MAAM,KAAK,SAAS,KAAK,IAAI,GAAG,IAAI,IAAI;GAC9C,MAAM,MAAM,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI;GAChD,MAAM,MAAM,KAAK,KAAK,MAAM,OAAO,KAAM,MAAM,MAAQ,IAAM;GAC7D,MAAM,YAAY,KAAK,IAAI,GAAG,GAAG,QAAQ,KAAK,WAAW,OAAO,MAAM,CAAC;GACvE,OAAO;IAAE,KAAK,MAAM;IAAK,KAAK,MAAM;IAAK;GAAU;EACrD,GAAG,CAAC,SAAS,SAAS,CAOhB;EACJ;EACA;EACA;EACA;CACF;AACF;AAIA,MAAa,qBAAqB,cAAuC,IAAI;AAE7E,SAAgB,sBAAsB;CACpC,MAAM,QAAQ,WAAW,kBAAkB;CAC3C,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,+DAA+D;CAC3F,OAAO;AACT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Candle } from "./context.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/components/charts/candlestick-chart/legend.d.ts
|
|
4
|
+
export type CandlestickChartLegendProps = {
|
|
5
|
+
/** Custom readout. Receives the crosshair candle, or the latest one. */
|
|
6
|
+
children?: (candle: Candle, change: number) => ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
/** OHLC and volume readout that follows the crosshair. */
|
|
10
|
+
export declare function CandlestickChartLegend({ children, className }: CandlestickChartLegendProps): import("react").JSX.Element | null;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","names":[],"sources":["../../../../src/components/charts/candlestick-chart/legend.tsx"],"mappings":";;;YAOY;;EAEV,YAAY,QAAQ,QAAQ,mBAAmB;EAC/C;;;wBAIc,yBAAyB,UAAU,aAAa,8CAA2B,IAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCandlestickChart } from "./context.js";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/charts/candlestick-chart/legend.tsx
|
|
6
|
+
/** OHLC and volume readout that follows the crosshair. */
|
|
7
|
+
function CandlestickChartLegend({ children, className }) {
|
|
8
|
+
const { candles, active, formatPrice, formatVolume } = useCandlestickChart();
|
|
9
|
+
const candle = active !== null ? candles[active] : candles.at(-1);
|
|
10
|
+
if (!candle) return null;
|
|
11
|
+
const change = candle.open ? (candle.close - candle.open) / candle.open * 100 : 0;
|
|
12
|
+
if (children) return /* @__PURE__ */ jsx(Fragment, { children: children(candle, change) });
|
|
13
|
+
const tone = change >= 0 ? "text-emerald-600 dark:text-emerald-400" : "text-rose-600 dark:text-rose-400";
|
|
14
|
+
const items = [
|
|
15
|
+
["O", formatPrice(candle.open)],
|
|
16
|
+
["H", formatPrice(candle.high)],
|
|
17
|
+
["L", formatPrice(candle.low)],
|
|
18
|
+
["C", formatPrice(candle.close)],
|
|
19
|
+
["Vol", formatVolume(candle.volume)]
|
|
20
|
+
];
|
|
21
|
+
return /* @__PURE__ */ jsxs("dl", {
|
|
22
|
+
className: cn("flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-xs tabular-nums", className),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx("dt", {
|
|
25
|
+
className: "sr-only",
|
|
26
|
+
children: "Candle"
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsx("dd", {
|
|
29
|
+
className: "text-muted-foreground",
|
|
30
|
+
children: candle.label
|
|
31
|
+
}),
|
|
32
|
+
items.map(([term, value]) => /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "flex gap-1",
|
|
34
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
35
|
+
className: "text-muted-foreground",
|
|
36
|
+
children: term
|
|
37
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
38
|
+
className: term === "Vol" ? void 0 : tone,
|
|
39
|
+
children: value
|
|
40
|
+
})]
|
|
41
|
+
}, term)),
|
|
42
|
+
/* @__PURE__ */ jsxs("dd", {
|
|
43
|
+
className: tone,
|
|
44
|
+
children: [
|
|
45
|
+
change >= 0 ? "+" : "−",
|
|
46
|
+
Math.abs(change).toFixed(2),
|
|
47
|
+
"%"
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { CandlestickChartLegend };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.js","names":[],"sources":["../../../../src/components/charts/candlestick-chart/legend.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { type Candle, useCandlestickChart } from \"./context\";\n\nexport type CandlestickChartLegendProps = {\n /** Custom readout. Receives the crosshair candle, or the latest one. */\n children?: (candle: Candle, change: number) => ReactNode;\n className?: string;\n};\n\n/** OHLC and volume readout that follows the crosshair. */\nexport function CandlestickChartLegend({ children, className }: CandlestickChartLegendProps) {\n const { candles, active, formatPrice, formatVolume } = useCandlestickChart();\n const candle = active !== null ? candles[active] : candles.at(-1);\n if (!candle) return null;\n const change = candle.open ? ((candle.close - candle.open) / candle.open) * 100 : 0;\n if (children) return <>{children(candle, change)}</>;\n const tone =\n change >= 0 ? \"text-emerald-600 dark:text-emerald-400\" : \"text-rose-600 dark:text-rose-400\";\n const items: [string, string][] = [\n [\"O\", formatPrice(candle.open)],\n [\"H\", formatPrice(candle.high)],\n [\"L\", formatPrice(candle.low)],\n [\"C\", formatPrice(candle.close)],\n [\"Vol\", formatVolume(candle.volume)],\n ];\n return (\n <dl\n className={cn(\n \"flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-xs tabular-nums\",\n className,\n )}\n >\n <dt className=\"sr-only\">Candle</dt>\n <dd className=\"text-muted-foreground\">{candle.label}</dd>\n {items.map(([term, value]) => (\n <div key={term} className=\"flex gap-1\">\n <dt className=\"text-muted-foreground\">{term}</dt>\n <dd className={term === \"Vol\" ? undefined : tone}>{value}</dd>\n </div>\n ))}\n <dd className={tone}>\n {change >= 0 ? \"+\" : \"−\"}\n {Math.abs(change).toFixed(2)}%\n </dd>\n </dl>\n );\n}\n"],"mappings":";;;;;;AAcA,SAAgB,uBAAuB,EAAE,UAAU,aAA0C;CAC3F,MAAM,EAAE,SAAS,QAAQ,aAAa,iBAAiB,oBAAoB;CAC3E,MAAM,SAAS,WAAW,OAAO,QAAQ,UAAU,QAAQ,GAAG,EAAE;CAChE,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,SAAS,OAAO,QAAS,OAAO,QAAQ,OAAO,QAAQ,OAAO,OAAQ,MAAM;CAClF,IAAI,UAAU,OAAO,oBAAA,UAAA,EAAA,UAAG,SAAS,QAAQ,MAAM,EAAI,CAAA;CACnD,MAAM,OACJ,UAAU,IAAI,2CAA2C;CAC3D,MAAM,QAA4B;EAChC,CAAC,KAAK,YAAY,OAAO,IAAI,CAAC;EAC9B,CAAC,KAAK,YAAY,OAAO,IAAI,CAAC;EAC9B,CAAC,KAAK,YAAY,OAAO,GAAG,CAAC;EAC7B,CAAC,KAAK,YAAY,OAAO,KAAK,CAAC;EAC/B,CAAC,OAAO,aAAa,OAAO,MAAM,CAAC;CACrC;CACA,OACE,qBAAC,MAAD;EACE,WAAW,GACT,8EACA,SACF;EAJF,UAAA;GAME,oBAAC,MAAD;IAAI,WAAU;IAAU,UAAA;GAAU,CAAA;GAClC,oBAAC,MAAD;IAAI,WAAU;IAAyB,UAAA,OAAO;GAAU,CAAA;GACvD,MAAM,KAAK,CAAC,MAAM,WACjB,qBAAC,OAAD;IAAgB,WAAU;IAA1B,UAAA,CACE,oBAAC,MAAD;KAAI,WAAU;KAAyB,UAAA;IAAS,CAAA,GAChD,oBAAC,MAAD;KAAI,WAAW,SAAS,QAAQ,KAAA,IAAY;KAAO,UAAA;IAAU,CAAA,CAC1D;GAHK,GAAA,IAGL,CACN;GACD,qBAAC,MAAD;IAAI,WAAW;IAAf,UAAA;KACG,UAAU,IAAI,MAAM;KACpB,KAAK,IAAI,MAAM,CAAC,CAAC,QAAQ,CAAC;KAAE;IAC3B;;EACF;;AAER"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/charts/candlestick-chart/plot.d.ts
|
|
2
|
+
export type CandlestickChartPlotProps = {
|
|
3
|
+
/** Plot height in px. */
|
|
4
|
+
height?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function CandlestickChartPlot({ height, className }: CandlestickChartPlotProps): import("react").JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=plot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.d.ts","names":[],"sources":["../../../../src/components/charts/candlestick-chart/plot.tsx"],"mappings":";YAuBY;;EAEV;EACA;;wBAGc,uBAAuB,QAAc,aAAa,4CAAyB,IAAA"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT, SPRING_LAYOUT } from "../../../lib/ease.js";
|
|
3
|
+
import { useCandlestickChart } from "./context.js";
|
|
4
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "@kumix/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion } from "motion/react";
|
|
8
|
+
//#region src/components/charts/candlestick-chart/plot.tsx
|
|
9
|
+
/** Right gutter reserved for price labels, in px. */
|
|
10
|
+
const AXIS = 64;
|
|
11
|
+
const VOLUME_SHARE = .18;
|
|
12
|
+
const GAP = 8;
|
|
13
|
+
/** Scale from the shape's own top edge rather than its centre. */
|
|
14
|
+
const TOP_ORIGIN = {
|
|
15
|
+
originX: 0,
|
|
16
|
+
originY: 0
|
|
17
|
+
};
|
|
18
|
+
function CandlestickChartPlot({ height = 320, className }) {
|
|
19
|
+
const { candles, lastPrice, active, setActive, scale, formatPrice, label, reduce } = useCandlestickChart();
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const [width, setWidth] = useState(0);
|
|
22
|
+
const [pointerY, setPointerY] = useState(null);
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
const node = ref.current;
|
|
25
|
+
if (!node) return;
|
|
26
|
+
const update = () => setWidth(node.clientWidth);
|
|
27
|
+
update();
|
|
28
|
+
const observer = new ResizeObserver(update);
|
|
29
|
+
observer.observe(node);
|
|
30
|
+
return () => observer.disconnect();
|
|
31
|
+
}, []);
|
|
32
|
+
const plotWidth = Math.max(0, width - AXIS);
|
|
33
|
+
const priceHeight = height * .8200000000000001 - GAP;
|
|
34
|
+
const slot = candles.length ? plotWidth / candles.length : 0;
|
|
35
|
+
const body = Math.max(1, slot * .62);
|
|
36
|
+
const y = (price) => (scale.max - price) / (scale.max - scale.min || 1) * priceHeight;
|
|
37
|
+
const priceAt = (py) => scale.max - py / priceHeight * (scale.max - scale.min);
|
|
38
|
+
const ticks = Array.from({ length: 5 }, (_, i) => scale.max - (scale.max - scale.min) * (i + .5) / 5);
|
|
39
|
+
const spring = reduce ? { duration: 0 } : SPRING_LAYOUT;
|
|
40
|
+
const onPointerMove = (event) => {
|
|
41
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
42
|
+
const x = event.clientX - rect.left;
|
|
43
|
+
const py = event.clientY - rect.top;
|
|
44
|
+
if (x > plotWidth || !slot) return;
|
|
45
|
+
setActive(Math.min(candles.length - 1, Math.max(0, Math.floor(x / slot))));
|
|
46
|
+
setPointerY(py <= priceHeight ? py : null);
|
|
47
|
+
};
|
|
48
|
+
const onKeyDown = (event) => {
|
|
49
|
+
const current = active ?? candles.length - 1;
|
|
50
|
+
let next = current;
|
|
51
|
+
if (event.key === "ArrowLeft") next = Math.max(0, current - 1);
|
|
52
|
+
else if (event.key === "ArrowRight") next = Math.min(candles.length - 1, current + 1);
|
|
53
|
+
else if (event.key === "Home") next = 0;
|
|
54
|
+
else if (event.key === "End") next = candles.length - 1;
|
|
55
|
+
else if (event.key === "Escape") next = null;
|
|
56
|
+
else return;
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
setPointerY(null);
|
|
59
|
+
setActive(next);
|
|
60
|
+
};
|
|
61
|
+
const focus = active !== null ? candles[active] : candles.at(-1);
|
|
62
|
+
const crossX = active !== null ? active * slot + slot / 2 : null;
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
ref,
|
|
65
|
+
role: "slider",
|
|
66
|
+
tabIndex: 0,
|
|
67
|
+
"aria-label": label,
|
|
68
|
+
"aria-valuemin": 0,
|
|
69
|
+
"aria-valuemax": Math.max(0, candles.length - 1),
|
|
70
|
+
"aria-valuenow": active ?? Math.max(0, candles.length - 1),
|
|
71
|
+
"aria-valuetext": focus ? `${focus.label}: open ${formatPrice(focus.open)}, high ${formatPrice(focus.high)}, low ${formatPrice(focus.low)}, close ${formatPrice(focus.close)}` : void 0,
|
|
72
|
+
onPointerMove,
|
|
73
|
+
onPointerLeave: () => {
|
|
74
|
+
setActive(null);
|
|
75
|
+
setPointerY(null);
|
|
76
|
+
},
|
|
77
|
+
onKeyDown,
|
|
78
|
+
onBlur: () => setActive(null),
|
|
79
|
+
className: cn("relative w-full cursor-crosshair touch-pan-y select-none rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
|
|
80
|
+
style: { height },
|
|
81
|
+
children: [
|
|
82
|
+
width > 0 ? /* @__PURE__ */ jsxs("svg", {
|
|
83
|
+
width,
|
|
84
|
+
height,
|
|
85
|
+
className: "absolute inset-0 overflow-visible",
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
children: [
|
|
88
|
+
ticks.map((tick) => /* @__PURE__ */ jsx("line", {
|
|
89
|
+
x1: 0,
|
|
90
|
+
x2: plotWidth,
|
|
91
|
+
y1: y(tick),
|
|
92
|
+
y2: y(tick),
|
|
93
|
+
stroke: "var(--border)",
|
|
94
|
+
strokeDasharray: "2 6"
|
|
95
|
+
}, tick)),
|
|
96
|
+
candles.map((candle, index) => {
|
|
97
|
+
const up = candle.close >= candle.open;
|
|
98
|
+
const cx = index * slot + slot / 2;
|
|
99
|
+
const top = y(Math.max(candle.open, candle.close));
|
|
100
|
+
const bodyHeight = Math.max(1, Math.abs(y(candle.open) - y(candle.close)));
|
|
101
|
+
const wickTop = y(candle.high);
|
|
102
|
+
const wickHeight = Math.max(1, y(candle.low) - wickTop);
|
|
103
|
+
const volumeHeight = Math.max(.5, candle.volume / scale.volumeMax * height * VOLUME_SHARE);
|
|
104
|
+
const dimmed = active !== null && active !== index;
|
|
105
|
+
return /* @__PURE__ */ jsxs(motion.g, {
|
|
106
|
+
className: up ? "fill-emerald-500 stroke-emerald-500" : "fill-rose-500 stroke-rose-500",
|
|
107
|
+
initial: reduce ? false : { opacity: 0 },
|
|
108
|
+
animate: { opacity: dimmed ? .45 : 1 },
|
|
109
|
+
transition: {
|
|
110
|
+
duration: .3,
|
|
111
|
+
ease: EASE_OUT,
|
|
112
|
+
delay: reduce ? 0 : Math.min(index * .012, .6)
|
|
113
|
+
},
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx(motion.line, {
|
|
116
|
+
x1: cx,
|
|
117
|
+
x2: cx,
|
|
118
|
+
y1: 0,
|
|
119
|
+
y2: 1,
|
|
120
|
+
vectorEffect: "non-scaling-stroke",
|
|
121
|
+
strokeWidth: 1,
|
|
122
|
+
style: TOP_ORIGIN,
|
|
123
|
+
initial: false,
|
|
124
|
+
animate: {
|
|
125
|
+
y: wickTop,
|
|
126
|
+
scaleY: wickHeight
|
|
127
|
+
},
|
|
128
|
+
transition: spring
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ jsx(motion.rect, {
|
|
131
|
+
x: cx - body / 2,
|
|
132
|
+
y: 0,
|
|
133
|
+
width: body,
|
|
134
|
+
height: 1,
|
|
135
|
+
strokeWidth: 0,
|
|
136
|
+
style: TOP_ORIGIN,
|
|
137
|
+
initial: false,
|
|
138
|
+
animate: {
|
|
139
|
+
y: top,
|
|
140
|
+
scaleY: bodyHeight
|
|
141
|
+
},
|
|
142
|
+
transition: spring
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx(motion.rect, {
|
|
145
|
+
x: cx - body / 2,
|
|
146
|
+
y: 0,
|
|
147
|
+
width: body,
|
|
148
|
+
height: 1,
|
|
149
|
+
strokeWidth: 0,
|
|
150
|
+
opacity: .28,
|
|
151
|
+
style: TOP_ORIGIN,
|
|
152
|
+
initial: false,
|
|
153
|
+
animate: {
|
|
154
|
+
y: height - volumeHeight,
|
|
155
|
+
scaleY: volumeHeight
|
|
156
|
+
},
|
|
157
|
+
transition: spring
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}, candle.id);
|
|
161
|
+
}),
|
|
162
|
+
lastPrice !== void 0 ? /* @__PURE__ */ jsx(motion.line, {
|
|
163
|
+
x1: 0,
|
|
164
|
+
x2: plotWidth,
|
|
165
|
+
y1: 0,
|
|
166
|
+
y2: 0,
|
|
167
|
+
initial: false,
|
|
168
|
+
animate: { y: y(lastPrice) },
|
|
169
|
+
transition: spring,
|
|
170
|
+
stroke: "var(--foreground)",
|
|
171
|
+
strokeOpacity: .45,
|
|
172
|
+
strokeDasharray: "3 4"
|
|
173
|
+
}) : null,
|
|
174
|
+
crossX !== null ? /* @__PURE__ */ jsx("line", {
|
|
175
|
+
x1: crossX,
|
|
176
|
+
x2: crossX,
|
|
177
|
+
y1: 0,
|
|
178
|
+
y2: height,
|
|
179
|
+
stroke: "var(--foreground)",
|
|
180
|
+
strokeOpacity: .3
|
|
181
|
+
}) : null,
|
|
182
|
+
pointerY !== null ? /* @__PURE__ */ jsx("line", {
|
|
183
|
+
x1: 0,
|
|
184
|
+
x2: plotWidth,
|
|
185
|
+
y1: pointerY,
|
|
186
|
+
y2: pointerY,
|
|
187
|
+
stroke: "var(--foreground)",
|
|
188
|
+
strokeOpacity: .3
|
|
189
|
+
}) : null
|
|
190
|
+
]
|
|
191
|
+
}) : null,
|
|
192
|
+
width > 0 ? ticks.map((tick) => /* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: "pointer-events-none absolute right-0 -translate-y-1/2 pr-1 font-mono text-muted-foreground text-xs tabular-nums",
|
|
194
|
+
style: { top: y(tick) },
|
|
195
|
+
children: formatPrice(tick)
|
|
196
|
+
}, tick)) : null,
|
|
197
|
+
width > 0 && lastPrice !== void 0 ? /* @__PURE__ */ jsx(motion.div, {
|
|
198
|
+
className: "pointer-events-none absolute top-0 right-0",
|
|
199
|
+
initial: false,
|
|
200
|
+
animate: { y: y(lastPrice) },
|
|
201
|
+
transition: spring,
|
|
202
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
203
|
+
className: "block -translate-y-1/2 rounded-md bg-foreground px-1.5 py-0.5 font-mono text-background text-xs tabular-nums",
|
|
204
|
+
children: formatPrice(lastPrice)
|
|
205
|
+
})
|
|
206
|
+
}) : null,
|
|
207
|
+
width > 0 && pointerY !== null ? /* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "pointer-events-none absolute right-0 -translate-y-1/2 rounded-md bg-muted px-1.5 py-0.5 font-mono text-foreground text-xs tabular-nums",
|
|
209
|
+
style: { top: pointerY },
|
|
210
|
+
children: formatPrice(priceAt(pointerY))
|
|
211
|
+
}) : null
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { CandlestickChartPlot };
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=plot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.js","names":[],"sources":["../../../../src/components/charts/candlestick-chart/plot.tsx"],"sourcesContent":["\"use client\";\n\n/* Candles fade up 12ms apart on first draw. The live candle's body, wick, and\n * volume bar spring to new values as trades print, and the last-price line\n * follows. Pointer or arrow keys move a crosshair with a price tag on the\n * axis. Every moving shape is drawn at unit height and placed with\n * translateY and scaleY, so updates animate transforms only. Reduced motion:\n * no fade or spring; values update in place. */\n\nimport { type KeyboardEvent, type PointerEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport { motion, type Transition } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { useCandlestickChart } from \"./context\";\n\n/** Right gutter reserved for price labels, in px. */\nconst AXIS = 64;\nconst VOLUME_SHARE = 0.18;\nconst GAP = 8;\n/** Scale from the shape's own top edge rather than its centre. */\nconst TOP_ORIGIN = { originX: 0, originY: 0 } as const;\n\nexport type CandlestickChartPlotProps = {\n /** Plot height in px. */\n height?: number;\n className?: string;\n};\n\nexport function CandlestickChartPlot({ height = 320, className }: CandlestickChartPlotProps) {\n const { candles, lastPrice, active, setActive, scale, formatPrice, label, reduce } =\n useCandlestickChart();\n const ref = useRef<HTMLDivElement>(null);\n const [width, setWidth] = useState(0);\n const [pointerY, setPointerY] = useState<number | null>(null);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (!node) return;\n const update = () => setWidth(node.clientWidth);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(node);\n return () => observer.disconnect();\n }, []);\n\n const plotWidth = Math.max(0, width - AXIS);\n const priceHeight = height * (1 - VOLUME_SHARE) - GAP;\n const slot = candles.length ? plotWidth / candles.length : 0;\n const body = Math.max(1, slot * 0.62);\n const y = (price: number) => ((scale.max - price) / (scale.max - scale.min || 1)) * priceHeight;\n const priceAt = (py: number) => scale.max - (py / priceHeight) * (scale.max - scale.min);\n const ticks = Array.from(\n { length: 5 },\n (_, i) => scale.max - ((scale.max - scale.min) * (i + 0.5)) / 5,\n );\n const spring: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const py = event.clientY - rect.top;\n if (x > plotWidth || !slot) return;\n setActive(Math.min(candles.length - 1, Math.max(0, Math.floor(x / slot))));\n setPointerY(py <= priceHeight ? py : null);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n const current = active ?? candles.length - 1;\n let next: number | null = current;\n if (event.key === \"ArrowLeft\") next = Math.max(0, current - 1);\n else if (event.key === \"ArrowRight\") next = Math.min(candles.length - 1, current + 1);\n else if (event.key === \"Home\") next = 0;\n else if (event.key === \"End\") next = candles.length - 1;\n else if (event.key === \"Escape\") next = null;\n else return;\n event.preventDefault();\n setPointerY(null);\n setActive(next);\n };\n\n const focus = active !== null ? candles[active] : candles.at(-1);\n const crossX = active !== null ? active * slot + slot / 2 : null;\n\n return (\n <div\n ref={ref}\n role=\"slider\"\n tabIndex={0}\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={Math.max(0, candles.length - 1)}\n aria-valuenow={active ?? Math.max(0, candles.length - 1)}\n aria-valuetext={\n focus\n ? `${focus.label}: open ${formatPrice(focus.open)}, high ${formatPrice(focus.high)}, low ${formatPrice(focus.low)}, close ${formatPrice(focus.close)}`\n : undefined\n }\n onPointerMove={onPointerMove}\n onPointerLeave={() => {\n setActive(null);\n setPointerY(null);\n }}\n onKeyDown={onKeyDown}\n onBlur={() => setActive(null)}\n className={cn(\n \"relative w-full cursor-crosshair touch-pan-y select-none rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n style={{ height }}\n >\n {width > 0 ? (\n <svg\n width={width}\n height={height}\n className=\"absolute inset-0 overflow-visible\"\n aria-hidden=\"true\"\n >\n {ticks.map((tick) => (\n <line\n key={tick}\n x1={0}\n x2={plotWidth}\n y1={y(tick)}\n y2={y(tick)}\n stroke=\"var(--border)\"\n strokeDasharray=\"2 6\"\n />\n ))}\n {candles.map((candle, index) => {\n const up = candle.close >= candle.open;\n const cx = index * slot + slot / 2;\n const top = y(Math.max(candle.open, candle.close));\n const bodyHeight = Math.max(1, Math.abs(y(candle.open) - y(candle.close)));\n const wickTop = y(candle.high);\n const wickHeight = Math.max(1, y(candle.low) - wickTop);\n const volumeHeight = Math.max(\n 0.5,\n (candle.volume / scale.volumeMax) * height * VOLUME_SHARE,\n );\n const dimmed = active !== null && active !== index;\n return (\n <motion.g\n key={candle.id}\n className={\n up ? \"fill-emerald-500 stroke-emerald-500\" : \"fill-rose-500 stroke-rose-500\"\n }\n initial={reduce ? false : { opacity: 0 }}\n animate={{ opacity: dimmed ? 0.45 : 1 }}\n transition={{\n duration: 0.3,\n ease: EASE_OUT,\n delay: reduce ? 0 : Math.min(index * 0.012, 0.6),\n }}\n >\n <motion.line\n x1={cx}\n x2={cx}\n y1={0}\n y2={1}\n vectorEffect=\"non-scaling-stroke\"\n strokeWidth={1}\n style={TOP_ORIGIN}\n initial={false}\n animate={{ y: wickTop, scaleY: wickHeight }}\n transition={spring}\n />\n <motion.rect\n x={cx - body / 2}\n y={0}\n width={body}\n height={1}\n strokeWidth={0}\n style={TOP_ORIGIN}\n initial={false}\n animate={{ y: top, scaleY: bodyHeight }}\n transition={spring}\n />\n <motion.rect\n x={cx - body / 2}\n y={0}\n width={body}\n height={1}\n strokeWidth={0}\n opacity={0.28}\n style={TOP_ORIGIN}\n initial={false}\n animate={{ y: height - volumeHeight, scaleY: volumeHeight }}\n transition={spring}\n />\n </motion.g>\n );\n })}\n {lastPrice !== undefined ? (\n <motion.line\n x1={0}\n x2={plotWidth}\n y1={0}\n y2={0}\n initial={false}\n animate={{ y: y(lastPrice) }}\n transition={spring}\n stroke=\"var(--foreground)\"\n strokeOpacity={0.45}\n strokeDasharray=\"3 4\"\n />\n ) : null}\n {crossX !== null ? (\n <line\n x1={crossX}\n x2={crossX}\n y1={0}\n y2={height}\n stroke=\"var(--foreground)\"\n strokeOpacity={0.3}\n />\n ) : null}\n {pointerY !== null ? (\n <line\n x1={0}\n x2={plotWidth}\n y1={pointerY}\n y2={pointerY}\n stroke=\"var(--foreground)\"\n strokeOpacity={0.3}\n />\n ) : null}\n </svg>\n ) : null}\n\n {width > 0\n ? ticks.map((tick) => (\n <span\n key={tick}\n className=\"pointer-events-none absolute right-0 -translate-y-1/2 pr-1 font-mono text-muted-foreground text-xs tabular-nums\"\n style={{ top: y(tick) }}\n >\n {formatPrice(tick)}\n </span>\n ))\n : null}\n {width > 0 && lastPrice !== undefined ? (\n <motion.div\n className=\"pointer-events-none absolute top-0 right-0\"\n initial={false}\n animate={{ y: y(lastPrice) }}\n transition={spring}\n >\n <span className=\"block -translate-y-1/2 rounded-md bg-foreground px-1.5 py-0.5 font-mono text-background text-xs tabular-nums\">\n {formatPrice(lastPrice)}\n </span>\n </motion.div>\n ) : null}\n {width > 0 && pointerY !== null ? (\n <span\n className=\"pointer-events-none absolute right-0 -translate-y-1/2 rounded-md bg-muted px-1.5 py-0.5 font-mono text-foreground text-xs tabular-nums\"\n style={{ top: pointerY }}\n >\n {formatPrice(priceAt(pointerY))}\n </span>\n ) : null}\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Candle, CandlestickChartProps, useCandlestickChart } from "./candlestick-chart/context.js";
|
|
2
|
+
import { CandlestickChartLegend, CandlestickChartLegendProps } from "./candlestick-chart/legend.js";
|
|
3
|
+
import { CandlestickChartPlot, CandlestickChartPlotProps } from "./candlestick-chart/plot.js";
|
|
4
|
+
//#region src/components/charts/candlestick-chart.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* OHLC candles with volume, a last-price line, and a crosshair readout.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <CandlestickChart candles={candles} lastPrice={last} formatPrice={usd}>
|
|
10
|
+
* <CandlestickChartLegend />
|
|
11
|
+
* <CandlestickChartPlot height={360} />
|
|
12
|
+
* </CandlestickChart>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function CandlestickChart({ className, children, ...props }: CandlestickChartProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { type Candle, CandlestickChartLegend, type CandlestickChartLegendProps, CandlestickChartPlot, type CandlestickChartPlotProps, type CandlestickChartProps, useCandlestickChart };
|
|
18
|
+
//# sourceMappingURL=candlestick-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candlestick-chart.d.ts","names":[],"sources":["../../../src/components/charts/candlestick-chart.tsx"],"mappings":";;;;;;;;;;;;;;wBAqBgB,mBAAmB,WAAW,aAAa,SAAS,wCAAqB,IAAA"}
|