@kumix/ui 0.3.17 → 0.4.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 +30 -18
- package/dist/account-avatar-DILzuuvz.js +23 -0
- package/dist/account-avatar-DILzuuvz.js.map +1 -0
- package/dist/{cascader-types-BnH6wYD-.d.ts → cascader-types-DVT-znZ-.d.ts} +6 -3
- package/dist/cascader-types-DVT-znZ-.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/activity-row.js +1 -1
- package/dist/components/agents/agent-activity/index.js +1 -1
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/agents/ai-sidebar.js +1 -1
- package/dist/components/agents/approval-card/index.js +1 -1
- package/dist/components/agents/citations.js +1 -1
- package/dist/components/agents/code-block.js +1 -1
- package/dist/components/agents/file-diff.js +1 -1
- package/dist/components/agents/image-generation.js +1 -1
- package/dist/components/agents/message-bubble.js +1 -1
- package/dist/components/agents/prompt-input.js +1 -1
- package/dist/components/agents/streaming-response.js +1 -1
- package/dist/components/agents/todo-list.js +1 -1
- package/dist/components/agents/tool-approval.js +1 -1
- package/dist/components/agents/tool-result.js +1 -1
- package/dist/components/agents/voice-orb.d.ts +19 -0
- package/dist/components/agents/voice-orb.d.ts.map +1 -0
- package/dist/components/agents/voice-orb.js +389 -0
- package/dist/components/agents/voice-orb.js.map +1 -0
- package/dist/components/charts/bump-chart/context.d.ts +2 -0
- package/dist/components/charts/bump-chart/context.js +3 -0
- package/dist/components/charts/bump-chart/legend.d.ts +6 -0
- package/dist/components/charts/bump-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/bump-chart/legend.js +60 -0
- package/dist/components/charts/bump-chart/legend.js.map +1 -0
- package/dist/components/charts/bump-chart/plot.d.ts +6 -0
- package/dist/components/charts/bump-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/bump-chart/plot.js +3 -0
- package/dist/components/charts/bump-chart/point.d.ts +10 -0
- package/dist/components/charts/bump-chart/point.d.ts.map +1 -0
- package/dist/components/charts/bump-chart/point.js +124 -0
- package/dist/components/charts/bump-chart/point.js.map +1 -0
- package/dist/components/charts/bump-chart/series.d.ts +11 -0
- package/dist/components/charts/bump-chart/series.d.ts.map +1 -0
- package/dist/components/charts/bump-chart/series.js +101 -0
- package/dist/components/charts/bump-chart/series.js.map +1 -0
- package/dist/components/charts/bump-chart.d.ts +10 -0
- package/dist/components/charts/bump-chart.d.ts.map +1 -0
- package/dist/components/charts/bump-chart.js +23 -0
- package/dist/components/charts/bump-chart.js.map +1 -0
- package/dist/components/charts/composition-chart/context.d.ts +2 -0
- package/dist/components/charts/composition-chart/context.js +3 -0
- package/dist/components/charts/composition-chart/legend.d.ts +6 -0
- package/dist/components/charts/composition-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/composition-chart/legend.js +51 -0
- package/dist/components/charts/composition-chart/legend.js.map +1 -0
- package/dist/components/charts/composition-chart/plot.d.ts +6 -0
- package/dist/components/charts/composition-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/composition-chart/plot.js +174 -0
- package/dist/components/charts/composition-chart/plot.js.map +1 -0
- package/dist/components/charts/composition-chart/tooltip-content.d.ts +6 -0
- package/dist/components/charts/composition-chart/tooltip-content.d.ts.map +1 -0
- package/dist/components/charts/composition-chart/tooltip-content.js +63 -0
- package/dist/components/charts/composition-chart/tooltip-content.js.map +1 -0
- package/dist/components/charts/composition-chart.d.ts +9 -0
- package/dist/components/charts/composition-chart.d.ts.map +1 -0
- package/dist/components/charts/composition-chart.js +26 -0
- package/dist/components/charts/composition-chart.js.map +1 -0
- package/dist/components/charts/funnel-chart.d.ts +50 -0
- package/dist/components/charts/funnel-chart.d.ts.map +1 -0
- package/dist/components/charts/funnel-chart.js +216 -0
- package/dist/components/charts/funnel-chart.js.map +1 -0
- package/dist/components/charts/heat-calendar/grid.d.ts +8 -0
- package/dist/components/charts/heat-calendar/grid.d.ts.map +1 -0
- package/dist/components/charts/heat-calendar/grid.js +127 -0
- package/dist/components/charts/heat-calendar/grid.js.map +1 -0
- package/dist/components/charts/heat-calendar/legend.d.ts +6 -0
- package/dist/components/charts/heat-calendar/legend.d.ts.map +1 -0
- package/dist/components/charts/heat-calendar/legend.js +48 -0
- package/dist/components/charts/heat-calendar/legend.js.map +1 -0
- package/dist/components/charts/heat-calendar/tooltip.d.ts +2 -0
- package/dist/components/charts/heat-calendar/tooltip.js +50 -0
- package/dist/components/charts/heat-calendar/tooltip.js.map +1 -0
- package/dist/components/charts/heat-calendar.d.ts +9 -0
- package/dist/components/charts/heat-calendar.d.ts.map +1 -0
- package/dist/components/charts/heat-calendar.js +23 -0
- package/dist/components/charts/heat-calendar.js.map +1 -0
- package/dist/components/charts/liquidity-heatmap.d.ts +51 -0
- package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -0
- package/dist/components/charts/liquidity-heatmap.js +311 -0
- package/dist/components/charts/liquidity-heatmap.js.map +1 -0
- package/dist/components/charts/order-book/depth-row.d.ts +13 -0
- package/dist/components/charts/order-book/depth-row.d.ts.map +1 -0
- package/dist/components/charts/order-book/depth-row.js +99 -0
- package/dist/components/charts/order-book/depth-row.js.map +1 -0
- package/dist/components/charts/order-book.d.ts +57 -0
- package/dist/components/charts/order-book.d.ts.map +1 -0
- package/dist/components/charts/order-book.js +207 -0
- package/dist/components/charts/order-book.js.map +1 -0
- package/dist/components/charts/price-target-fan/header.d.ts +8 -0
- package/dist/components/charts/price-target-fan/header.d.ts.map +1 -0
- package/dist/components/charts/price-target-fan/header.js +43 -0
- package/dist/components/charts/price-target-fan/header.js.map +1 -0
- package/dist/components/charts/price-target-fan/plot.d.ts +16 -0
- package/dist/components/charts/price-target-fan/plot.d.ts.map +1 -0
- package/dist/components/charts/price-target-fan/plot.js +142 -0
- package/dist/components/charts/price-target-fan/plot.js.map +1 -0
- package/dist/components/charts/price-target-fan/series.d.ts +15 -0
- package/dist/components/charts/price-target-fan/series.d.ts.map +1 -0
- package/dist/components/charts/price-target-fan/series.js +238 -0
- package/dist/components/charts/price-target-fan/series.js.map +1 -0
- package/dist/components/charts/price-target-fan/tooltip.d.ts +2 -0
- package/dist/components/charts/price-target-fan/tooltip.js +58 -0
- package/dist/components/charts/price-target-fan/tooltip.js.map +1 -0
- package/dist/components/charts/price-target-fan.d.ts +10 -0
- package/dist/components/charts/price-target-fan.d.ts.map +1 -0
- package/dist/components/charts/price-target-fan.js +24 -0
- package/dist/components/charts/price-target-fan.js.map +1 -0
- package/dist/components/charts/returns-calendar/grid.d.ts +8 -0
- package/dist/components/charts/returns-calendar/grid.d.ts.map +1 -0
- package/dist/components/charts/returns-calendar/grid.js +176 -0
- package/dist/components/charts/returns-calendar/grid.js.map +1 -0
- package/dist/components/charts/returns-calendar/tooltip.d.ts +2 -0
- package/dist/components/charts/returns-calendar/tooltip.js +55 -0
- package/dist/components/charts/returns-calendar/tooltip.js.map +1 -0
- package/dist/components/charts/returns-calendar.d.ts +48 -0
- package/dist/components/charts/returns-calendar.d.ts.map +1 -0
- package/dist/components/charts/returns-calendar.js +22 -0
- package/dist/components/charts/returns-calendar.js.map +1 -0
- package/dist/components/charts/status-bar/legend.d.ts +8 -0
- package/dist/components/charts/status-bar/legend.d.ts.map +1 -0
- package/dist/components/charts/status-bar/legend.js +37 -0
- package/dist/components/charts/status-bar/legend.js.map +1 -0
- package/dist/components/charts/status-bar/plot.d.ts +12 -0
- package/dist/components/charts/status-bar/plot.d.ts.map +1 -0
- package/dist/components/charts/status-bar/plot.js +176 -0
- package/dist/components/charts/status-bar/plot.js.map +1 -0
- package/dist/components/charts/status-bar/tooltip.d.ts +2 -0
- package/dist/components/charts/status-bar/tooltip.js +49 -0
- package/dist/components/charts/status-bar/tooltip.js.map +1 -0
- package/dist/components/charts/status-bar.d.ts +9 -0
- package/dist/components/charts/status-bar.d.ts.map +1 -0
- package/dist/components/charts/status-bar.js +64 -0
- package/dist/components/charts/status-bar.js.map +1 -0
- package/dist/components/charts/treemap/legend.d.ts +8 -0
- package/dist/components/charts/treemap/legend.d.ts.map +1 -0
- package/dist/components/charts/treemap/legend.js +35 -0
- package/dist/components/charts/treemap/legend.js.map +1 -0
- package/dist/components/charts/treemap/plot.d.ts +13 -0
- package/dist/components/charts/treemap/plot.d.ts.map +1 -0
- package/dist/components/charts/treemap/plot.js +123 -0
- package/dist/components/charts/treemap/plot.js.map +1 -0
- package/dist/components/charts/treemap/tile.d.ts +10 -0
- package/dist/components/charts/treemap/tile.d.ts.map +1 -0
- package/dist/components/charts/treemap/tile.js +114 -0
- package/dist/components/charts/treemap/tile.js.map +1 -0
- package/dist/components/charts/treemap/tooltip.d.ts +11 -0
- package/dist/components/charts/treemap/tooltip.d.ts.map +1 -0
- package/dist/components/charts/treemap/tooltip.js +73 -0
- package/dist/components/charts/treemap/tooltip.js.map +1 -0
- package/dist/components/charts/treemap.d.ts +56 -0
- package/dist/components/charts/treemap.d.ts.map +1 -0
- package/dist/components/charts/treemap.js +71 -0
- package/dist/components/charts/treemap.js.map +1 -0
- package/dist/components/charts/volume-profile/plot.d.ts +12 -0
- package/dist/components/charts/volume-profile/plot.d.ts.map +1 -0
- package/dist/components/charts/volume-profile/plot.js +211 -0
- package/dist/components/charts/volume-profile/plot.js.map +1 -0
- package/dist/components/charts/volume-profile/summary.d.ts +6 -0
- package/dist/components/charts/volume-profile/summary.d.ts.map +1 -0
- package/dist/components/charts/volume-profile/summary.js +76 -0
- package/dist/components/charts/volume-profile/summary.js.map +1 -0
- package/dist/components/charts/volume-profile/tooltip.d.ts +2 -0
- package/dist/components/charts/volume-profile/tooltip.js +84 -0
- package/dist/components/charts/volume-profile/tooltip.js.map +1 -0
- package/dist/components/charts/volume-profile.d.ts +111 -0
- package/dist/components/charts/volume-profile.d.ts.map +1 -0
- package/dist/components/charts/volume-profile.js +82 -0
- package/dist/components/charts/volume-profile.js.map +1 -0
- package/dist/components/custom/confirm-dialog.js +1 -1
- package/dist/components/motion/adaptive-stepper.js +1 -1
- package/dist/components/motion/alert.d.ts +40 -0
- package/dist/components/motion/alert.d.ts.map +1 -0
- package/dist/components/motion/alert.js +247 -0
- package/dist/components/motion/alert.js.map +1 -0
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +1 -1
- package/dist/components/motion/arc-picker.d.ts +28 -0
- package/dist/components/motion/arc-picker.d.ts.map +1 -0
- package/dist/components/motion/arc-picker.js +569 -0
- package/dist/components/motion/arc-picker.js.map +1 -0
- package/dist/components/motion/aspect-ratio.d.ts +23 -0
- package/dist/components/motion/aspect-ratio.d.ts.map +1 -0
- package/dist/components/motion/aspect-ratio.js +61 -0
- package/dist/components/motion/aspect-ratio.js.map +1 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +2 -2
- package/dist/components/motion/attachment-upload.js.map +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/bloom-menu.js +1 -1
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/breadcrumb.d.ts +37 -0
- package/dist/components/motion/breadcrumb.d.ts.map +1 -0
- package/dist/components/motion/breadcrumb.js +259 -0
- package/dist/components/motion/breadcrumb.js.map +1 -0
- package/dist/components/motion/button/stateful.js +1 -1
- package/dist/components/motion/card-folder.js +1 -1
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/collapsible.d.ts +34 -0
- package/dist/components/motion/collapsible.d.ts.map +1 -0
- package/dist/components/motion/collapsible.js +237 -0
- package/dist/components/motion/collapsible.js.map +1 -0
- package/dist/components/motion/color-selector.d.ts +28 -0
- package/dist/components/motion/color-selector.d.ts.map +1 -0
- package/dist/components/motion/color-selector.js +97 -0
- package/dist/components/motion/color-selector.js.map +1 -0
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/command-palette.js +1 -1
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/date-range-picker.d.ts +107 -0
- package/dist/components/motion/date-range-picker.d.ts.map +1 -0
- package/dist/components/motion/date-range-picker.js +907 -0
- package/dist/components/motion/date-range-picker.js.map +1 -0
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/file-tree.js +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/knockout-bracket.d.ts +190 -0
- package/dist/components/motion/knockout-bracket.d.ts.map +1 -0
- package/dist/components/motion/knockout-bracket.js +952 -0
- package/dist/components/motion/knockout-bracket.js.map +1 -0
- package/dist/components/motion/knockout-wheel.d.ts +183 -0
- package/dist/components/motion/knockout-wheel.d.ts.map +1 -0
- package/dist/components/motion/knockout-wheel.js +1039 -0
- package/dist/components/motion/knockout-wheel.js.map +1 -0
- package/dist/components/motion/morphing-lightbox.d.ts +67 -0
- package/dist/components/motion/morphing-lightbox.d.ts.map +1 -0
- package/dist/components/motion/morphing-lightbox.js +499 -0
- package/dist/components/motion/morphing-lightbox.js.map +1 -0
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-search.js.map +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/multi-select/list.js +1 -1
- package/dist/components/motion/multi-select/trigger.js +1 -1
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/popover-morph.d.ts +5 -1
- package/dist/components/motion/popover-morph.d.ts.map +1 -1
- package/dist/components/motion/popover-morph.js +78 -27
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/prediction-market-card.d.ts +37 -0
- package/dist/components/motion/prediction-market-card.d.ts.map +1 -0
- package/dist/components/motion/prediction-market-card.js +216 -0
- package/dist/components/motion/prediction-market-card.js.map +1 -0
- package/dist/components/motion/prediction-market.d.ts +49 -0
- package/dist/components/motion/prediction-market.d.ts.map +1 -0
- package/dist/components/motion/prediction-market.js +440 -0
- package/dist/components/motion/prediction-market.js.map +1 -0
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/signup-form.js +1 -1
- package/dist/components/motion/sortable-list.d.ts +53 -0
- package/dist/components/motion/sortable-list.d.ts.map +1 -0
- package/dist/components/motion/sortable-list.js +254 -0
- package/dist/components/motion/sortable-list.js.map +1 -0
- package/dist/components/motion/sortable-stack.d.ts +2 -0
- package/dist/components/motion/sortable-stack.js +3 -0
- package/dist/components/motion/swap/controls.d.ts +22 -0
- package/dist/components/motion/swap/controls.d.ts.map +1 -0
- package/dist/components/motion/swap/controls.js +167 -0
- package/dist/components/motion/swap/controls.js.map +1 -0
- package/dist/components/motion/swap/field.d.ts +14 -0
- package/dist/components/motion/swap/field.d.ts.map +1 -0
- package/dist/components/motion/swap/field.js +107 -0
- package/dist/components/motion/swap/field.js.map +1 -0
- package/dist/components/motion/swap/quote-row.d.ts +13 -0
- package/dist/components/motion/swap/quote-row.d.ts.map +1 -0
- package/dist/components/motion/swap/quote-row.js +55 -0
- package/dist/components/motion/swap/quote-row.js.map +1 -0
- package/dist/components/motion/swap/token-badges.d.ts +19 -0
- package/dist/components/motion/swap/token-badges.d.ts.map +1 -0
- package/dist/components/motion/swap/token-badges.js +54 -0
- package/dist/components/motion/swap/token-badges.js.map +1 -0
- package/dist/components/motion/swap/token-picker.d.ts +14 -0
- package/dist/components/motion/swap/token-picker.d.ts.map +1 -0
- package/dist/components/motion/swap/token-picker.js +190 -0
- package/dist/components/motion/swap/token-picker.js.map +1 -0
- package/dist/components/motion/swap.d.ts +14 -0
- package/dist/components/motion/swap.d.ts.map +1 -0
- package/dist/components/motion/swap.js +378 -0
- package/dist/components/motion/swap.js.map +1 -0
- 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 +5 -9
- package/dist/components/motion/tabs.d.ts.map +1 -1
- package/dist/components/motion/tabs.js +14 -5
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/motion/tooltip/positioner.d.ts +33 -0
- package/dist/components/motion/tooltip/positioner.d.ts.map +1 -0
- package/dist/components/motion/tooltip/positioner.js +3 -0
- package/dist/components/motion/tooltip-surface.d.ts +5 -4
- package/dist/components/motion/tooltip-surface.d.ts.map +1 -1
- package/dist/components/motion/tooltip-surface.js +22 -73
- package/dist/components/motion/tooltip-surface.js.map +1 -1
- package/dist/components/motion/tooltip.d.ts +3 -1
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +54 -103
- package/dist/components/motion/tooltip.js.map +1 -1
- package/dist/components/motion/wallet-card/account-avatar.d.ts +8 -0
- package/dist/components/motion/wallet-card/account-avatar.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/account-avatar.js +3 -0
- package/dist/components/motion/wallet-card/account-switcher.d.ts +14 -0
- package/dist/components/motion/wallet-card/account-switcher.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/account-switcher.js +153 -0
- package/dist/components/motion/wallet-card/account-switcher.js.map +1 -0
- package/dist/components/motion/wallet-card/actions.d.ts +12 -0
- package/dist/components/motion/wallet-card/actions.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/actions.js +58 -0
- package/dist/components/motion/wallet-card/actions.js.map +1 -0
- package/dist/components/motion/wallet-card/balance-delta.d.ts +12 -0
- package/dist/components/motion/wallet-card/balance-delta.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/balance-delta.js +72 -0
- package/dist/components/motion/wallet-card/balance-delta.js.map +1 -0
- package/dist/components/motion/wallet-card/copy-button.d.ts +12 -0
- package/dist/components/motion/wallet-card/copy-button.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/copy-button.js +41 -0
- package/dist/components/motion/wallet-card/copy-button.js.map +1 -0
- package/dist/components/motion/wallet-card/index.d.ts +13 -0
- package/dist/components/motion/wallet-card/index.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/index.js +115 -0
- package/dist/components/motion/wallet-card/index.js.map +1 -0
- package/dist/components/motion/wallet-card/search-bar.d.ts +17 -0
- package/dist/components/motion/wallet-card/search-bar.d.ts.map +1 -0
- package/dist/components/motion/wallet-card/search-bar.js +156 -0
- package/dist/components/motion/wallet-card/search-bar.js.map +1 -0
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +3 -2
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +4 -4
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-context.d.ts +12 -4
- 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-footer.js +1 -1
- package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-item.d.ts +2 -2
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-item.js +23 -17
- package/dist/components/reui/cascader/cascader-item.js.map +1 -1
- package/dist/components/reui/cascader/cascader-lib.d.ts +8 -1
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-lib.js +19 -11
- 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-nav.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.js +6 -5
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
- package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
- package/dist/components/reui/cascader/cascader.d.ts +6 -2
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js +59 -21
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +3 -3
- 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.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +18 -14
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +2 -2
- 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 +85 -61
- 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 +7 -2
- 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 +68 -39
- 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 +7 -2
- 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 +90 -26
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
- 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.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +157 -38
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +16 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +81 -51
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.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 +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/filters/filters-advanced.js +2 -2
- 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-builder.js +1 -1
- package/dist/components/reui/filters/filters-chip.js +2 -2
- package/dist/components/reui/filters/filters-editors.js +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts +1 -1
- package/dist/components/reui/filters/filters.js +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/reui/kanban.d.ts.map +1 -1
- package/dist/components/reui/kanban.js +30 -1
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/signature-pad.d.ts +160 -0
- package/dist/components/reui/signature-pad.d.ts.map +1 -0
- package/dist/components/reui/signature-pad.js +764 -0
- package/dist/components/reui/signature-pad.js.map +1 -0
- package/dist/components/reui/time-picker.d.ts +202 -0
- package/dist/components/reui/time-picker.d.ts.map +1 -0
- package/dist/components/reui/time-picker.js +1002 -0
- package/dist/components/reui/time-picker.js.map +1 -0
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/questionnaire.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/constants-CsKm9sSk.js +30 -0
- package/dist/constants-CsKm9sSk.js.map +1 -0
- package/dist/context-3_vY1jbv.js +141 -0
- package/dist/context-3_vY1jbv.js.map +1 -0
- package/dist/context-BE60udRT.js +99 -0
- package/dist/context-BE60udRT.js.map +1 -0
- package/dist/context-BYXeJQnz.d.ts +150 -0
- package/dist/context-BYXeJQnz.d.ts.map +1 -0
- package/dist/context-Bc6VC1HA.js +181 -0
- package/dist/context-Bc6VC1HA.js.map +1 -0
- package/dist/context-BqjZ1Z_w.js +111 -0
- package/dist/context-BqjZ1Z_w.js.map +1 -0
- package/dist/context-CZfRKkcZ.js +204 -0
- package/dist/context-CZfRKkcZ.js.map +1 -0
- package/dist/context-Cn-00gfW.js +169 -0
- package/dist/context-Cn-00gfW.js.map +1 -0
- package/dist/context-Cnlo53sV.d.ts +92 -0
- package/dist/context-Cnlo53sV.d.ts.map +1 -0
- package/dist/context-Rl5VCYA8.js +257 -0
- package/dist/context-Rl5VCYA8.js.map +1 -0
- package/dist/context-sD8DQga-.js +122 -0
- package/dist/context-sD8DQga-.js.map +1 -0
- package/dist/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
- package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
- package/dist/ease-B82HVmio.d.ts +50 -0
- package/dist/ease-B82HVmio.d.ts.map +1 -0
- package/dist/hooks/use-modal-scope.d.ts +6 -0
- package/dist/hooks/use-modal-scope.d.ts.map +1 -0
- package/dist/hooks/use-modal-scope.js +83 -0
- package/dist/hooks/use-modal-scope.js.map +1 -0
- package/dist/lib/ease.d.ts +2 -49
- package/dist/model-DfeFradZ.d.ts +9 -0
- package/dist/model-DfeFradZ.d.ts.map +1 -0
- package/dist/model-DlbIqCZg.d.ts +41 -0
- package/dist/model-DlbIqCZg.d.ts.map +1 -0
- package/dist/plot-CdFTbMI_.js +131 -0
- package/dist/plot-CdFTbMI_.js.map +1 -0
- package/dist/positioner-3mCqiebN.js +204 -0
- package/dist/positioner-3mCqiebN.js.map +1 -0
- package/dist/tooltip-BarafYiU.d.ts +67 -0
- package/dist/tooltip-BarafYiU.d.ts.map +1 -0
- package/dist/tooltip-BqxVD6D-.d.ts +64 -0
- package/dist/tooltip-BqxVD6D-.d.ts.map +1 -0
- package/dist/tooltip-C01qUgsW.d.ts +133 -0
- package/dist/tooltip-C01qUgsW.d.ts.map +1 -0
- package/dist/tooltip-C6qUs7px.d.ts +36 -0
- package/dist/tooltip-C6qUs7px.d.ts.map +1 -0
- package/dist/tooltip-DQ4DXgeu.d.ts +94 -0
- package/dist/tooltip-DQ4DXgeu.d.ts.map +1 -0
- package/dist/types-B_6p3LXz.d.ts +36 -0
- package/dist/types-B_6p3LXz.d.ts.map +1 -0
- package/dist/types-D6e3gWOA.d.ts +22 -0
- package/dist/types-D6e3gWOA.d.ts.map +1 -0
- package/dist/use-geometry-CH0foIo7.d.ts +9 -0
- package/dist/use-geometry-CH0foIo7.d.ts.map +1 -0
- package/dist/utils-B3YXTsDI.js +26 -0
- package/dist/utils-B3YXTsDI.js.map +1 -0
- package/package.json +14 -9
- package/dist/cascader-types-BnH6wYD-.d.ts.map +0 -1
- package/dist/lib/ease.d.ts.map +0 -1
|
@@ -0,0 +1,907 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHoverCapable } from "../../hooks/use-hover-capable.js";
|
|
3
|
+
import { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
4
|
+
import { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from "./popover-morph.js";
|
|
5
|
+
import { createContext, useCallback, useContext, useId, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { cn } from "@kumix/utils";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AnimatePresence, motion, useIsPresent, useReducedMotion } from "motion/react";
|
|
9
|
+
import { ArrowRight, CalendarDays, ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
|
|
10
|
+
//#region src/components/motion/date-range-picker/context.ts
|
|
11
|
+
const DateRangePickerContext = createContext(null);
|
|
12
|
+
function useDateRangePickerContext(part) {
|
|
13
|
+
const context = useContext(DateRangePickerContext);
|
|
14
|
+
if (!context) throw new Error(`${part} must be used within DateRangePicker`);
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/components/motion/date-range-picker/date-utils.ts
|
|
19
|
+
const DAY = 864e5;
|
|
20
|
+
function parse(date) {
|
|
21
|
+
const time = Date.parse(`${date}T00:00:00Z`);
|
|
22
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || !Number.isFinite(time) || new Date(time).toISOString().slice(0, 10) !== date) throw new Error(`Invalid calendar date: ${date}. Use YYYY-MM-DD.`);
|
|
23
|
+
return time;
|
|
24
|
+
}
|
|
25
|
+
function iso(time) {
|
|
26
|
+
return new Date(time).toISOString().slice(0, 10);
|
|
27
|
+
}
|
|
28
|
+
function monthOf(date) {
|
|
29
|
+
return `${date.slice(0, 7)}-01`;
|
|
30
|
+
}
|
|
31
|
+
function shiftMonth(date, offset) {
|
|
32
|
+
const day = new Date(parse(date));
|
|
33
|
+
const month = new Date(parse(monthOf(date)));
|
|
34
|
+
month.setUTCMonth(month.getUTCMonth() + offset);
|
|
35
|
+
const end = new Date(month);
|
|
36
|
+
end.setUTCMonth(end.getUTCMonth() + 1);
|
|
37
|
+
end.setUTCDate(0);
|
|
38
|
+
month.setUTCDate(Math.min(day.getUTCDate(), end.getUTCDate()));
|
|
39
|
+
return iso(month.getTime());
|
|
40
|
+
}
|
|
41
|
+
function ordered(a, b) {
|
|
42
|
+
return a <= b ? {
|
|
43
|
+
from: a,
|
|
44
|
+
to: b
|
|
45
|
+
} : {
|
|
46
|
+
from: b,
|
|
47
|
+
to: a
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/components/motion/date-range-picker/use-date-range-picker.ts
|
|
52
|
+
function useDateRangePickerController({ value: controlledValue, defaultValue = null, onValueChange, defaultMonth, min, max, isDateDisabled, presets = [], locale = "en-US", label = "Choose a date range", disabled = false, autoFocus = false, showSummary = true, open: controlledOpen, defaultOpen = false, onOpenChange, closeOnSelect = false }) {
|
|
53
|
+
const [today] = useState(() => {
|
|
54
|
+
const now = /* @__PURE__ */ new Date();
|
|
55
|
+
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
|
56
|
+
});
|
|
57
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
58
|
+
const value = controlledValue === void 0 ? internalValue : controlledValue;
|
|
59
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
60
|
+
const open = controlledOpen === void 0 ? internalOpen : controlledOpen;
|
|
61
|
+
const trigger = useRef(null);
|
|
62
|
+
const content = useRef(null);
|
|
63
|
+
const setOpen = (next) => {
|
|
64
|
+
if (controlledOpen === void 0) setInternalOpen(next);
|
|
65
|
+
onOpenChange?.(next);
|
|
66
|
+
if (!next && content.current?.contains(document.activeElement)) trigger.current?.focus({ preventScroll: true });
|
|
67
|
+
};
|
|
68
|
+
useLayoutEffect(() => {
|
|
69
|
+
if (!open && content.current?.contains(document.activeElement)) trigger.current?.focus({ preventScroll: true });
|
|
70
|
+
}, [open]);
|
|
71
|
+
if (min) parse(min);
|
|
72
|
+
if (max) parse(max);
|
|
73
|
+
if (min && max && min > max) throw new Error("DateRangePicker min must not exceed max.");
|
|
74
|
+
if (defaultMonth) parse(defaultMonth);
|
|
75
|
+
if (value) {
|
|
76
|
+
parse(value.from);
|
|
77
|
+
if (value.to) {
|
|
78
|
+
parse(value.to);
|
|
79
|
+
if (value.to < value.from) throw new Error("DateRangePicker range must be ordered.");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const initial = defaultMonth ?? value?.from ?? (min && today < min ? min : max && today > max ? max : today);
|
|
83
|
+
const [requestedMonth, setMonth] = useState(() => monthOf(initial));
|
|
84
|
+
const month = min && requestedMonth < monthOf(min) ? monthOf(min) : max && requestedMonth > monthOf(max) ? monthOf(max) : requestedMonth;
|
|
85
|
+
if (requestedMonth !== month) setMonth(month);
|
|
86
|
+
const [cursor, setCursor] = useState(() => value?.from ?? initial);
|
|
87
|
+
const [preview, setPreview] = useState(null);
|
|
88
|
+
const [direction, setDirection] = useState(1);
|
|
89
|
+
const [announcement, setAnnouncement] = useState("");
|
|
90
|
+
const [view, setView] = useState("days");
|
|
91
|
+
const [requestedYearPage, setYearPage] = useState(() => Math.floor(Number(initial.slice(0, 4)) / 12) * 12);
|
|
92
|
+
const [focusChoices, setFocusChoices] = useState(false);
|
|
93
|
+
const monthTrigger = useRef(null);
|
|
94
|
+
const yearTrigger = useRef(null);
|
|
95
|
+
const returnToTrigger = useRef(null);
|
|
96
|
+
const grid = useRef(null);
|
|
97
|
+
const pendingFocus = useRef(autoFocus);
|
|
98
|
+
const heading = useId();
|
|
99
|
+
const help = useId();
|
|
100
|
+
const choicesId = useId();
|
|
101
|
+
const reduce = useReducedMotion() ?? false;
|
|
102
|
+
const canHover = useHoverCapable();
|
|
103
|
+
const monthFormat = new Intl.DateTimeFormat(locale, {
|
|
104
|
+
month: "long",
|
|
105
|
+
year: "numeric",
|
|
106
|
+
timeZone: "UTC"
|
|
107
|
+
});
|
|
108
|
+
const monthNameFormat = new Intl.DateTimeFormat(locale, {
|
|
109
|
+
month: "long",
|
|
110
|
+
timeZone: "UTC"
|
|
111
|
+
});
|
|
112
|
+
const dateFormat = new Intl.DateTimeFormat(locale, {
|
|
113
|
+
weekday: "long",
|
|
114
|
+
month: "long",
|
|
115
|
+
day: "numeric",
|
|
116
|
+
year: "numeric",
|
|
117
|
+
timeZone: "UTC"
|
|
118
|
+
});
|
|
119
|
+
const shortFormat = new Intl.DateTimeFormat(locale, {
|
|
120
|
+
month: "short",
|
|
121
|
+
day: "numeric",
|
|
122
|
+
year: "numeric",
|
|
123
|
+
timeZone: "UTC"
|
|
124
|
+
});
|
|
125
|
+
const unavailable = (date) => disabled || Boolean(min && date < min) || Boolean(max && date > max) || Boolean(isDateDisabled?.(date));
|
|
126
|
+
const rangeAvailable = (range) => {
|
|
127
|
+
const first = parse(range.from);
|
|
128
|
+
const last = parse(range.to ?? range.from);
|
|
129
|
+
if (last < first || unavailable(range.from) || unavailable(range.to ?? range.from)) return false;
|
|
130
|
+
if (isDateDisabled) {
|
|
131
|
+
for (let time = first + DAY; time < last; time += DAY) if (unavailable(iso(time))) return false;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
};
|
|
135
|
+
const lastDay = new Date(parse(month));
|
|
136
|
+
lastDay.setUTCMonth(lastDay.getUTCMonth() + 1);
|
|
137
|
+
lastDay.setUTCDate(0);
|
|
138
|
+
const daysInMonth = lastDay.getUTCDate();
|
|
139
|
+
const dates = Array.from({ length: daysInMonth }, (_, index) => iso(parse(month) + index * DAY));
|
|
140
|
+
const active = cursor && dates.includes(cursor) && !unavailable(cursor) ? cursor : dates.find((date) => !unavailable(date)) ?? null;
|
|
141
|
+
if (cursor !== null && cursor !== active) setCursor(active);
|
|
142
|
+
const shownRange = value && !value.to && preview && rangeAvailable(ordered(value.from, preview)) ? ordered(value.from, preview) : value;
|
|
143
|
+
const latest = useRef({
|
|
144
|
+
month,
|
|
145
|
+
active
|
|
146
|
+
});
|
|
147
|
+
useLayoutEffect(() => {
|
|
148
|
+
latest.current = {
|
|
149
|
+
month,
|
|
150
|
+
active
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
useLayoutEffect(() => {
|
|
154
|
+
if (returnToTrigger.current) {
|
|
155
|
+
const target = returnToTrigger.current;
|
|
156
|
+
returnToTrigger.current = null;
|
|
157
|
+
(target === "months" ? monthTrigger : yearTrigger).current?.focus({ preventScroll: true });
|
|
158
|
+
}
|
|
159
|
+
if (!pendingFocus.current) return;
|
|
160
|
+
pendingFocus.current = false;
|
|
161
|
+
(grid.current?.querySelector("button[tabindex=\"0\"]") ?? grid.current)?.focus({ preventScroll: true });
|
|
162
|
+
});
|
|
163
|
+
const change = (next) => {
|
|
164
|
+
if (disabled || next && !rangeAvailable(next)) return;
|
|
165
|
+
if (controlledValue === void 0) setInternalValue(next);
|
|
166
|
+
onValueChange?.(next);
|
|
167
|
+
setPreview(null);
|
|
168
|
+
if (next?.to && open && closeOnSelect) setOpen(false);
|
|
169
|
+
};
|
|
170
|
+
const select = (date) => {
|
|
171
|
+
if (unavailable(date)) return;
|
|
172
|
+
setCursor(date);
|
|
173
|
+
if (!value || value.to) {
|
|
174
|
+
change({ from: date });
|
|
175
|
+
setAnnouncement(`Start date ${dateFormat.format(parse(date))}. Choose an end date.`);
|
|
176
|
+
} else {
|
|
177
|
+
const next = ordered(value.from, date);
|
|
178
|
+
if (!rangeAvailable(next)) {
|
|
179
|
+
setAnnouncement("This range includes unavailable dates. Choose another end date.");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
change(next);
|
|
183
|
+
setAnnouncement(`${shortFormat.format(parse(next.from))} to ${shortFormat.format(parse(next.to))} selected.`);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const navigate = (offset, focus = false, target = latest.current.active ?? latest.current.month) => {
|
|
187
|
+
const next = shiftMonth(target, offset);
|
|
188
|
+
if (min && monthOf(next) < monthOf(min) || max && monthOf(next) > monthOf(max)) return;
|
|
189
|
+
latest.current = {
|
|
190
|
+
month: monthOf(next),
|
|
191
|
+
active: next
|
|
192
|
+
};
|
|
193
|
+
setDirection(offset > 0 ? 1 : -1);
|
|
194
|
+
setMonth(monthOf(next));
|
|
195
|
+
setCursor(next);
|
|
196
|
+
setPreview(null);
|
|
197
|
+
pendingFocus.current = focus;
|
|
198
|
+
};
|
|
199
|
+
const onKey = (event, date) => {
|
|
200
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
201
|
+
if (event.key === "PageUp" || event.key === "PageDown") {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
navigate((event.key === "PageUp" ? -1 : 1) * (event.shiftKey ? 12 : 1), true, date);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const base = latest.current.active ?? date;
|
|
207
|
+
const weekday = new Date(parse(base)).getUTCDay();
|
|
208
|
+
const offset = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : event.key === "ArrowUp" ? -7 : event.key === "ArrowDown" ? 7 : event.key === "Home" ? -weekday : event.key === "End" ? 6 - weekday : null;
|
|
209
|
+
if (offset === null) return;
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
let next = iso(parse(base) + offset * DAY);
|
|
212
|
+
if (event.key !== "Home" && event.key !== "End") {
|
|
213
|
+
const step = offset < 0 ? -1 : 1;
|
|
214
|
+
for (let attempts = 0; unavailable(next) && attempts < 366; attempts++) {
|
|
215
|
+
if (min && next < min || max && next > max) return;
|
|
216
|
+
next = iso(parse(next) + step * DAY);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (unavailable(next)) return;
|
|
220
|
+
const nextMonth = monthOf(next);
|
|
221
|
+
setDirection(nextMonth >= latest.current.month ? 1 : -1);
|
|
222
|
+
latest.current = {
|
|
223
|
+
month: nextMonth,
|
|
224
|
+
active: next
|
|
225
|
+
};
|
|
226
|
+
pendingFocus.current = true;
|
|
227
|
+
setMonth(nextMonth);
|
|
228
|
+
setCursor(next);
|
|
229
|
+
setPreview(value && !value.to ? next : null);
|
|
230
|
+
};
|
|
231
|
+
const leading = new Date(parse(month)).getUTCDay();
|
|
232
|
+
const cells = [...Array(leading).fill(null), ...dates];
|
|
233
|
+
while (cells.length < 42) cells.push(null);
|
|
234
|
+
const weeks = Array.from({ length: cells.length / 7 }, (_, index) => ({
|
|
235
|
+
start: iso(parse(month) + (index * 7 - leading) * DAY),
|
|
236
|
+
dates: cells.slice(index * 7, index * 7 + 7)
|
|
237
|
+
}));
|
|
238
|
+
const year = Number(month.slice(0, 4));
|
|
239
|
+
const monthIndex = Number(month.slice(5, 7)) - 1;
|
|
240
|
+
const minYear = min ? Number(min.slice(0, 4)) : 0;
|
|
241
|
+
const maxYear = max ? Number(max.slice(0, 4)) : 9999;
|
|
242
|
+
const firstYearPage = minYear;
|
|
243
|
+
const lastYearPage = Math.max(minYear, maxYear - 11);
|
|
244
|
+
const yearPage = Math.min(lastYearPage, Math.max(firstYearPage, requestedYearPage));
|
|
245
|
+
if (requestedYearPage !== yearPage) setYearPage(yearPage);
|
|
246
|
+
const yearPageEnd = Math.min(yearPage + 11, maxYear);
|
|
247
|
+
const previousDisabled = disabled || (view === "years" ? yearPage <= firstYearPage : view === "months" ? year <= minYear : year === 0 && monthIndex === 0 || Boolean(min && monthOf(shiftMonth(month, -1)) < monthOf(min)));
|
|
248
|
+
const nextDisabled = disabled || (view === "years" ? yearPage >= lastYearPage : view === "months" ? year >= maxYear : year === 9999 && monthIndex === 11 || Boolean(max && monthOf(shiftMonth(month, 1)) > monthOf(max)));
|
|
249
|
+
const closeChoices = () => {
|
|
250
|
+
returnToTrigger.current = view === "years" ? "years" : "months";
|
|
251
|
+
setView("days");
|
|
252
|
+
};
|
|
253
|
+
const openChoices = (next) => {
|
|
254
|
+
if (disabled) return;
|
|
255
|
+
if (view === next) {
|
|
256
|
+
closeChoices();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
setPreview(null);
|
|
260
|
+
setFocusChoices(true);
|
|
261
|
+
if (next === "years") setYearPage(Math.min(lastYearPage, Math.max(firstYearPage, minYear + Math.floor((year - minYear) / 12) * 12)));
|
|
262
|
+
setView(next);
|
|
263
|
+
};
|
|
264
|
+
const goToMonth = (next) => {
|
|
265
|
+
if (disabled) return;
|
|
266
|
+
const clamped = min && next < monthOf(min) ? monthOf(min) : max && next > monthOf(max) ? monthOf(max) : next;
|
|
267
|
+
setDirection(clamped >= month ? 1 : -1);
|
|
268
|
+
setMonth(clamped);
|
|
269
|
+
setCursor(clamped);
|
|
270
|
+
setPreview(null);
|
|
271
|
+
closeChoices();
|
|
272
|
+
};
|
|
273
|
+
const page = (step) => {
|
|
274
|
+
setFocusChoices(false);
|
|
275
|
+
if (view === "years") {
|
|
276
|
+
setDirection(step);
|
|
277
|
+
const next = Math.min(lastYearPage, Math.max(firstYearPage, yearPage + step * 12));
|
|
278
|
+
if (next === firstYearPage || next === lastYearPage) returnToTrigger.current = "years";
|
|
279
|
+
setYearPage((current) => Math.min(lastYearPage, Math.max(firstYearPage, current + step * 12)));
|
|
280
|
+
} else if (view === "months") {
|
|
281
|
+
const next = shiftMonth(month, step * 12);
|
|
282
|
+
const clamped = min && next < monthOf(min) ? monthOf(min) : max && next > monthOf(max) ? monthOf(max) : monthOf(next);
|
|
283
|
+
setDirection(step);
|
|
284
|
+
setMonth(clamped);
|
|
285
|
+
setCursor(clamped);
|
|
286
|
+
if (Number(clamped.slice(0, 4)) === minYear || Number(clamped.slice(0, 4)) === maxYear) returnToTrigger.current = "months";
|
|
287
|
+
} else {
|
|
288
|
+
const next = monthOf(shiftMonth(latest.current.active ?? month, step));
|
|
289
|
+
if (next === (min && monthOf(min)) || next === (max && monthOf(max))) returnToTrigger.current = "months";
|
|
290
|
+
navigate(step);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
const choices = view === "months" ? Array.from({ length: 12 }, (_, index) => {
|
|
294
|
+
const date = `${String(year).padStart(4, "0")}-${String(index + 1).padStart(2, "0")}-01`;
|
|
295
|
+
return {
|
|
296
|
+
id: date,
|
|
297
|
+
label: monthNameFormat.format(parse(date)),
|
|
298
|
+
disabled: disabled || Boolean(min && date < monthOf(min)) || Boolean(max && date > monthOf(max))
|
|
299
|
+
};
|
|
300
|
+
}) : Array.from({ length: Math.max(0, yearPageEnd - yearPage + 1) }, (_, index) => {
|
|
301
|
+
const choiceYear = yearPage + index;
|
|
302
|
+
return {
|
|
303
|
+
id: String(choiceYear),
|
|
304
|
+
label: String(choiceYear),
|
|
305
|
+
disabled: disabled || choiceYear < minYear || choiceYear > maxYear
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
const dayCount = value?.to ? Math.round((parse(value.to) - parse(value.from)) / DAY) + 1 : null;
|
|
309
|
+
const clear = () => {
|
|
310
|
+
if (disabled) return;
|
|
311
|
+
if (view === "days") pendingFocus.current = true;
|
|
312
|
+
else returnToTrigger.current = view;
|
|
313
|
+
change(null);
|
|
314
|
+
setAnnouncement("Date range cleared.");
|
|
315
|
+
};
|
|
316
|
+
const selectPreset = (range, name) => {
|
|
317
|
+
if (!rangeAvailable(range)) return;
|
|
318
|
+
if (view !== "days") closeChoices();
|
|
319
|
+
change(range);
|
|
320
|
+
setDirection(range.from >= month ? 1 : -1);
|
|
321
|
+
setMonth(monthOf(range.from));
|
|
322
|
+
setCursor(range.from);
|
|
323
|
+
setAnnouncement(`${name} selected.`);
|
|
324
|
+
};
|
|
325
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
326
|
+
if (wasOpen !== open) {
|
|
327
|
+
setWasOpen(open);
|
|
328
|
+
if (open) {
|
|
329
|
+
setMonth(monthOf(initial));
|
|
330
|
+
setCursor(value?.from ?? initial);
|
|
331
|
+
setPreview(null);
|
|
332
|
+
setView("days");
|
|
333
|
+
setFocusChoices(false);
|
|
334
|
+
setAnnouncement("");
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
value,
|
|
339
|
+
change,
|
|
340
|
+
open,
|
|
341
|
+
setOpen,
|
|
342
|
+
trigger,
|
|
343
|
+
content,
|
|
344
|
+
label,
|
|
345
|
+
locale,
|
|
346
|
+
disabled,
|
|
347
|
+
autoFocus,
|
|
348
|
+
showSummary,
|
|
349
|
+
presets,
|
|
350
|
+
today,
|
|
351
|
+
month,
|
|
352
|
+
view,
|
|
353
|
+
heading,
|
|
354
|
+
help,
|
|
355
|
+
choicesId,
|
|
356
|
+
monthTrigger,
|
|
357
|
+
yearTrigger,
|
|
358
|
+
monthFormat,
|
|
359
|
+
monthNameFormat,
|
|
360
|
+
shortFormat,
|
|
361
|
+
dateFormat,
|
|
362
|
+
year,
|
|
363
|
+
yearPage,
|
|
364
|
+
yearPageEnd,
|
|
365
|
+
previousDisabled,
|
|
366
|
+
nextDisabled,
|
|
367
|
+
openChoices,
|
|
368
|
+
page,
|
|
369
|
+
direction,
|
|
370
|
+
reduce,
|
|
371
|
+
choices,
|
|
372
|
+
focusChoices,
|
|
373
|
+
closeChoices,
|
|
374
|
+
goToMonth,
|
|
375
|
+
grid,
|
|
376
|
+
active,
|
|
377
|
+
weeks,
|
|
378
|
+
shownRange,
|
|
379
|
+
canHover,
|
|
380
|
+
unavailable,
|
|
381
|
+
setPreview,
|
|
382
|
+
select,
|
|
383
|
+
setCursor,
|
|
384
|
+
onKey,
|
|
385
|
+
dayCount,
|
|
386
|
+
clear,
|
|
387
|
+
rangeAvailable,
|
|
388
|
+
selectPreset,
|
|
389
|
+
announcement
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/components/motion/date-range-picker.tsx
|
|
394
|
+
const monthVariants = {
|
|
395
|
+
enter: ({ direction, reduce }) => ({
|
|
396
|
+
opacity: 0,
|
|
397
|
+
x: reduce ? 0 : direction * 12
|
|
398
|
+
}),
|
|
399
|
+
exit: ({ direction, reduce }) => ({
|
|
400
|
+
opacity: 0,
|
|
401
|
+
x: reduce ? 0 : direction * -8,
|
|
402
|
+
transition: {
|
|
403
|
+
duration: .12,
|
|
404
|
+
ease: EASE_OUT
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
};
|
|
408
|
+
const iconClass = "inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-30";
|
|
409
|
+
/** State shared by built-in parts and custom date range controls. */
|
|
410
|
+
function useDateRangePicker() {
|
|
411
|
+
const ctx = useDateRangePickerContext("useDateRangePicker");
|
|
412
|
+
return {
|
|
413
|
+
value: ctx.value,
|
|
414
|
+
setValue: ctx.change,
|
|
415
|
+
open: ctx.open,
|
|
416
|
+
setOpen: ctx.setOpen,
|
|
417
|
+
month: ctx.month,
|
|
418
|
+
view: ctx.view,
|
|
419
|
+
label: ctx.label,
|
|
420
|
+
locale: ctx.locale,
|
|
421
|
+
disabled: ctx.disabled,
|
|
422
|
+
selectDate: ctx.select,
|
|
423
|
+
clear: ctx.clear,
|
|
424
|
+
goToMonth: ctx.goToMonth,
|
|
425
|
+
previous: () => !ctx.previousDisabled && ctx.page(-1),
|
|
426
|
+
next: () => !ctx.nextDisabled && ctx.page(1),
|
|
427
|
+
previousDisabled: ctx.previousDisabled,
|
|
428
|
+
nextDisabled: ctx.nextDisabled,
|
|
429
|
+
chooseMonth: () => ctx.openChoices("months"),
|
|
430
|
+
chooseYear: () => ctx.openChoices("years")
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
/** Range state and popover root. Without children, renders the inline calendar. */
|
|
434
|
+
function DateRangePicker({ children, className, ...props }) {
|
|
435
|
+
const ctx = useDateRangePickerController(props);
|
|
436
|
+
return /* @__PURE__ */ jsx(DateRangePickerContext.Provider, {
|
|
437
|
+
value: ctx,
|
|
438
|
+
children: /* @__PURE__ */ jsx(MorphPopover, {
|
|
439
|
+
open: ctx.open,
|
|
440
|
+
onOpenChange: ctx.setOpen,
|
|
441
|
+
className: cn("max-w-full", children !== void 0 && className),
|
|
442
|
+
children: children === void 0 ? /* @__PURE__ */ jsx(DateRangePickerCalendar, { className }) : children
|
|
443
|
+
})
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
/** Calendar surface; arrange or omit its summary, header, grid and footer. */
|
|
447
|
+
function DateRangePickerCalendar({ children, className, showSummary, ...props }) {
|
|
448
|
+
const ctx = useDateRangePickerContext("DateRangePickerCalendar");
|
|
449
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
450
|
+
...props,
|
|
451
|
+
"aria-label": props["aria-label"] ?? ctx.label,
|
|
452
|
+
className: cn("w-80 max-w-full rounded-2xl border border-border bg-background p-3.5", className),
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ jsx("h3", {
|
|
455
|
+
id: ctx.heading,
|
|
456
|
+
"aria-live": "polite",
|
|
457
|
+
className: "sr-only",
|
|
458
|
+
children: ctx.monthFormat.format(parse(ctx.month))
|
|
459
|
+
}),
|
|
460
|
+
children === void 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
461
|
+
(showSummary ?? ctx.showSummary) && /* @__PURE__ */ jsx(DateRangePickerSummary, {}),
|
|
462
|
+
/* @__PURE__ */ jsx(DateRangePickerHeader, {}),
|
|
463
|
+
/* @__PURE__ */ jsx(DateRangePickerGrid, {}),
|
|
464
|
+
/* @__PURE__ */ jsx(DateRangePickerFooter, {})
|
|
465
|
+
] }) : children,
|
|
466
|
+
/* @__PURE__ */ jsx("p", {
|
|
467
|
+
id: ctx.help,
|
|
468
|
+
className: "sr-only",
|
|
469
|
+
children: "Use arrow keys to navigate dates, Home and End for the week, Page Up and Page Down for months, Shift with Page Up or Page Down for years. Enter or Space selects a date. Use the month and year buttons to jump directly. In the month or year choices, use arrow keys to move and Escape to return."
|
|
470
|
+
}),
|
|
471
|
+
/* @__PURE__ */ jsx("span", {
|
|
472
|
+
role: "status",
|
|
473
|
+
className: "sr-only",
|
|
474
|
+
children: ctx.announcement
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function DateRangePickerSummary({ className, ...props }) {
|
|
480
|
+
const { value, shortFormat } = useDateRangePickerContext("DateRangePickerSummary");
|
|
481
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
482
|
+
...props,
|
|
483
|
+
className: cn("mb-2.5 grid grid-cols-[1fr_auto_1fr] items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-2", className),
|
|
484
|
+
children: [
|
|
485
|
+
/* @__PURE__ */ jsxs("div", {
|
|
486
|
+
className: "min-w-0",
|
|
487
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
488
|
+
className: "mb-1 font-medium text-[10px] text-muted-foreground uppercase tracking-wider",
|
|
489
|
+
children: "Start date"
|
|
490
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
491
|
+
className: "font-medium text-[13px] tabular-nums",
|
|
492
|
+
children: value ? shortFormat.format(parse(value.from)) : "Select date"
|
|
493
|
+
})]
|
|
494
|
+
}),
|
|
495
|
+
/* @__PURE__ */ jsx(ArrowRight, {
|
|
496
|
+
size: 14,
|
|
497
|
+
className: "text-muted-foreground/60",
|
|
498
|
+
"aria-hidden": "true"
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ jsxs("div", {
|
|
501
|
+
className: "min-w-0",
|
|
502
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
503
|
+
className: "mb-1 font-medium text-[10px] text-muted-foreground uppercase tracking-wider",
|
|
504
|
+
children: "End date"
|
|
505
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
506
|
+
className: cn("font-medium text-[13px] tabular-nums", !value?.to && "text-muted-foreground"),
|
|
507
|
+
children: value?.to ? shortFormat.format(parse(value.to)) : "Select date"
|
|
508
|
+
})]
|
|
509
|
+
})
|
|
510
|
+
]
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
function DateRangePickerHeader({ className, ...props }) {
|
|
514
|
+
const { monthTrigger, yearTrigger, view, choicesId, disabled, openChoices, monthNameFormat, month, yearPage, yearPageEnd, year, previousDisabled, nextDisabled, page } = useDateRangePickerContext("DateRangePickerHeader");
|
|
515
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
516
|
+
...props,
|
|
517
|
+
className: cn("mb-2 flex items-center justify-between gap-1", className),
|
|
518
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
519
|
+
className: "flex min-w-0 items-center gap-0.5",
|
|
520
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
521
|
+
ref: monthTrigger,
|
|
522
|
+
type: "button",
|
|
523
|
+
"aria-label": "Choose month",
|
|
524
|
+
"aria-expanded": view === "months",
|
|
525
|
+
"aria-controls": view === "months" ? choicesId : void 0,
|
|
526
|
+
disabled,
|
|
527
|
+
onClick: () => openChoices("months"),
|
|
528
|
+
className: cn("inline-flex items-center gap-1.5 rounded-lg px-2 py-1.5 font-semibold text-[13px] transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40", view === "years" && "hidden"),
|
|
529
|
+
children: [monthNameFormat.format(parse(month)), /* @__PURE__ */ jsx(ChevronDown, {
|
|
530
|
+
size: 12,
|
|
531
|
+
"aria-hidden": "true",
|
|
532
|
+
className: cn("text-muted-foreground", view === "months" && "rotate-180")
|
|
533
|
+
})]
|
|
534
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
535
|
+
ref: yearTrigger,
|
|
536
|
+
type: "button",
|
|
537
|
+
"aria-label": "Choose year",
|
|
538
|
+
"aria-expanded": view === "years",
|
|
539
|
+
"aria-controls": view === "years" ? choicesId : void 0,
|
|
540
|
+
disabled,
|
|
541
|
+
onClick: () => openChoices("years"),
|
|
542
|
+
className: "inline-flex items-center gap-1.5 rounded-lg px-2 py-1.5 font-medium text-[13px] text-muted-foreground tabular-nums transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40",
|
|
543
|
+
children: [view === "years" ? `${yearPage}–${yearPageEnd}` : year, /* @__PURE__ */ jsx(ChevronDown, {
|
|
544
|
+
size: 12,
|
|
545
|
+
"aria-hidden": "true",
|
|
546
|
+
className: cn(view === "years" && "rotate-180")
|
|
547
|
+
})]
|
|
548
|
+
})]
|
|
549
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
550
|
+
className: "flex shrink-0 gap-0.5",
|
|
551
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
552
|
+
type: "button",
|
|
553
|
+
"aria-label": view === "years" ? "Previous years" : view === "months" ? "Previous year" : "Previous month",
|
|
554
|
+
disabled: previousDisabled,
|
|
555
|
+
className: iconClass,
|
|
556
|
+
onClick: () => page(-1),
|
|
557
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {
|
|
558
|
+
size: 16,
|
|
559
|
+
"aria-hidden": "true"
|
|
560
|
+
})
|
|
561
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
562
|
+
type: "button",
|
|
563
|
+
"aria-label": view === "years" ? "Next years" : view === "months" ? "Next year" : "Next month",
|
|
564
|
+
disabled: nextDisabled,
|
|
565
|
+
hidden: view === "years" && nextDisabled,
|
|
566
|
+
className: cn(iconClass, view === "years" && nextDisabled && "hidden"),
|
|
567
|
+
onClick: () => page(1),
|
|
568
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {
|
|
569
|
+
size: 16,
|
|
570
|
+
"aria-hidden": "true"
|
|
571
|
+
})
|
|
572
|
+
})]
|
|
573
|
+
})]
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
function DateRangePickerGrid({ className, onPointerLeave, ...props }) {
|
|
577
|
+
const { setPreview, view, month, yearPage, yearPageEnd, year, direction, reduce, choicesId, choices, focusChoices, closeChoices, goToMonth, grid, heading, help, active, locale, weeks, shownRange, value, canHover, unavailable, dateFormat, today, select, setCursor, onKey } = useDateRangePickerContext("DateRangePickerGrid");
|
|
578
|
+
return /* @__PURE__ */ jsx("div", {
|
|
579
|
+
...props,
|
|
580
|
+
className: cn("overflow-hidden", className),
|
|
581
|
+
onPointerLeave: (event) => {
|
|
582
|
+
onPointerLeave?.(event);
|
|
583
|
+
setPreview(null);
|
|
584
|
+
},
|
|
585
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
586
|
+
initial: false,
|
|
587
|
+
mode: "popLayout",
|
|
588
|
+
custom: {
|
|
589
|
+
direction,
|
|
590
|
+
reduce
|
|
591
|
+
},
|
|
592
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
593
|
+
custom: {
|
|
594
|
+
direction,
|
|
595
|
+
reduce
|
|
596
|
+
},
|
|
597
|
+
variants: monthVariants,
|
|
598
|
+
initial: "enter",
|
|
599
|
+
animate: {
|
|
600
|
+
opacity: 1,
|
|
601
|
+
x: 0
|
|
602
|
+
},
|
|
603
|
+
exit: "exit",
|
|
604
|
+
transition: {
|
|
605
|
+
duration: reduce ? .1 : .18,
|
|
606
|
+
ease: EASE_OUT
|
|
607
|
+
},
|
|
608
|
+
children: /* @__PURE__ */ jsx(CalendarPresence, { children: view !== "days" ? /* @__PURE__ */ jsx(CalendarChoices, {
|
|
609
|
+
id: choicesId,
|
|
610
|
+
label: view === "months" ? `Choose a month in ${year}` : `Choose a year from ${yearPage} to ${yearPageEnd}`,
|
|
611
|
+
choices,
|
|
612
|
+
selected: view === "months" ? month : String(year),
|
|
613
|
+
focusOnMount: focusChoices,
|
|
614
|
+
reduce,
|
|
615
|
+
onClose: closeChoices,
|
|
616
|
+
onSelect: (id) => goToMonth(view === "months" ? id : `${id.padStart(4, "0")}-${month.slice(5, 7)}-01`)
|
|
617
|
+
}) : /* @__PURE__ */ jsxs("table", {
|
|
618
|
+
ref: (node) => {
|
|
619
|
+
if (node) {
|
|
620
|
+
grid.current = node;
|
|
621
|
+
return () => {
|
|
622
|
+
if (grid.current === node) grid.current = null;
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
role: "grid",
|
|
627
|
+
"aria-labelledby": heading,
|
|
628
|
+
"aria-describedby": help,
|
|
629
|
+
tabIndex: active === null ? 0 : void 0,
|
|
630
|
+
className: "w-full table-fixed border-separate border-spacing-x-0 border-spacing-y-1 select-none",
|
|
631
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: Array.from({ length: 7 }, (_, index) => {
|
|
632
|
+
const day = new Intl.DateTimeFormat(locale, {
|
|
633
|
+
weekday: "long",
|
|
634
|
+
timeZone: "UTC"
|
|
635
|
+
}).format(Date.UTC(2026, 0, 4 + index));
|
|
636
|
+
return /* @__PURE__ */ jsx("th", {
|
|
637
|
+
scope: "col",
|
|
638
|
+
abbr: day,
|
|
639
|
+
className: "h-6 pb-1.5 text-center font-medium text-[11px] text-muted-foreground",
|
|
640
|
+
children: new Intl.DateTimeFormat(locale, {
|
|
641
|
+
weekday: "short",
|
|
642
|
+
timeZone: "UTC"
|
|
643
|
+
}).format(Date.UTC(2026, 0, 4 + index))
|
|
644
|
+
}, day);
|
|
645
|
+
}) }) }), /* @__PURE__ */ jsx("tbody", { children: weeks.map(({ start, dates: week }) => /* @__PURE__ */ jsx("tr", { children: week.map((date, dayIndex) => {
|
|
646
|
+
const inRange = Boolean(date && shownRange && date >= shownRange.from && date <= (shownRange.to ?? shownRange.from));
|
|
647
|
+
const endpoint = Boolean(date && value && (date === value.from || date === value.to));
|
|
648
|
+
return /* @__PURE__ */ jsxs("td", {
|
|
649
|
+
role: "gridcell",
|
|
650
|
+
"aria-selected": date ? Boolean(value && date >= value.from && date <= (value.to ?? value.from)) : void 0,
|
|
651
|
+
onPointerEnter: (event) => {
|
|
652
|
+
if (canHover && event.pointerType !== "touch" && date && !unavailable(date) && value && !value.to) setPreview(date);
|
|
653
|
+
},
|
|
654
|
+
className: cn("relative h-8 p-0 text-center", inRange && (dayIndex === 0 || date === shownRange?.from) && "rounded-l-full", inRange && (dayIndex === 6 || date === shownRange?.to || !shownRange?.to) && "rounded-r-full"),
|
|
655
|
+
children: [date && /* @__PURE__ */ jsx("span", {
|
|
656
|
+
"aria-hidden": "true",
|
|
657
|
+
className: cn("pointer-events-none absolute inset-y-0 rounded-[inherit] bg-foreground/8", inRange ? "opacity-100" : "opacity-0"),
|
|
658
|
+
style: {
|
|
659
|
+
left: endpoint && (date === shownRange?.from || !week[dayIndex - 1]) ? "50%" : 0,
|
|
660
|
+
right: endpoint && (date === (shownRange?.to ?? shownRange?.from) || !week[dayIndex + 1]) ? "50%" : 0
|
|
661
|
+
}
|
|
662
|
+
}), date && /* @__PURE__ */ jsx(motion.button, {
|
|
663
|
+
type: "button",
|
|
664
|
+
disabled: unavailable(date),
|
|
665
|
+
"aria-label": dateFormat.format(parse(date)),
|
|
666
|
+
"aria-current": date === today ? "date" : void 0,
|
|
667
|
+
tabIndex: date === active ? 0 : -1,
|
|
668
|
+
whileTap: reduce ? void 0 : { scale: .9 },
|
|
669
|
+
transition: SPRING_PRESS,
|
|
670
|
+
onClick: () => select(date),
|
|
671
|
+
onFocus: () => {
|
|
672
|
+
setCursor(date);
|
|
673
|
+
if (value && !value.to) setPreview(date);
|
|
674
|
+
},
|
|
675
|
+
onKeyDown: (event) => onKey(event, date),
|
|
676
|
+
className: cn("relative mx-auto flex h-8 w-full max-w-8 items-center justify-center rounded-full text-xs tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-30", endpoint ? "bg-foreground font-medium text-background" : canHover && !unavailable(date) && !inRange && "hover:bg-muted", date === today && !endpoint && "font-semibold after:absolute after:bottom-1 after:size-0.75 after:rounded-full after:bg-current"),
|
|
677
|
+
children: new Date(parse(date)).getUTCDate()
|
|
678
|
+
})]
|
|
679
|
+
}, date ?? `empty-${dayIndex}`);
|
|
680
|
+
}) }, start)) })]
|
|
681
|
+
}) })
|
|
682
|
+
}, view === "days" ? month : `${view}-${view === "years" ? yearPage : year}`)
|
|
683
|
+
})
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
function DateRangePickerSelection({ children, className, ...props }) {
|
|
687
|
+
const { value, dayCount } = useDateRangePickerContext("DateRangePickerSelection");
|
|
688
|
+
return /* @__PURE__ */ jsx("p", {
|
|
689
|
+
...props,
|
|
690
|
+
className: cn("text-muted-foreground text-xs", className),
|
|
691
|
+
children: children ?? (dayCount ? `${dayCount} ${dayCount === 1 ? "day" : "days"} selected` : value ? "Choose an end date" : "Choose a start date")
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
function DateRangePickerClear({ children = "Clear", className, onClick, disabled, ...props }) {
|
|
695
|
+
const ctx = useDateRangePickerContext("DateRangePickerClear");
|
|
696
|
+
return /* @__PURE__ */ jsx("button", {
|
|
697
|
+
...props,
|
|
698
|
+
type: "button",
|
|
699
|
+
"aria-label": props["aria-label"] ?? "Clear date range",
|
|
700
|
+
disabled: disabled || ctx.disabled || !ctx.value,
|
|
701
|
+
className: cn("rounded-md px-1.5 py-1 text-muted-foreground text-xs transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-30", className),
|
|
702
|
+
onClick: (event) => {
|
|
703
|
+
onClick?.(event);
|
|
704
|
+
if (!event.defaultPrevented) ctx.clear();
|
|
705
|
+
},
|
|
706
|
+
children
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
function DateRangePickerFooter({ children, className, ...props }) {
|
|
710
|
+
return /* @__PURE__ */ jsx("div", {
|
|
711
|
+
...props,
|
|
712
|
+
className: cn("mt-2.5 border-border border-t pt-2.5", className),
|
|
713
|
+
children: children === void 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
714
|
+
className: "flex items-center justify-between gap-2",
|
|
715
|
+
children: [/* @__PURE__ */ jsx(DateRangePickerSelection, {}), /* @__PURE__ */ jsx(DateRangePickerClear, {})]
|
|
716
|
+
}), /* @__PURE__ */ jsx(DateRangePickerPresets, {})] }) : children
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function DateRangePickerPresets({ children, className, ...props }) {
|
|
720
|
+
const ctx = useDateRangePickerContext("DateRangePickerPresets");
|
|
721
|
+
if (children === void 0 && ctx.presets.length === 0) return null;
|
|
722
|
+
return /* @__PURE__ */ jsx("div", {
|
|
723
|
+
...props,
|
|
724
|
+
className: cn("mt-2.5 flex flex-wrap justify-center gap-1.5", className),
|
|
725
|
+
children: children === void 0 ? ctx.presets.map((preset) => /* @__PURE__ */ jsx(DateRangePickerPreset, {
|
|
726
|
+
value: preset.value,
|
|
727
|
+
label: preset.label,
|
|
728
|
+
children: preset.label
|
|
729
|
+
}, preset.label)) : children
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
function DateRangePickerPreset({ value, label, children, className, disabled, onClick, ...props }) {
|
|
733
|
+
const ctx = useDateRangePickerContext("DateRangePickerPreset");
|
|
734
|
+
const selected = ctx.value?.from === value.from && ctx.value?.to === value.to;
|
|
735
|
+
return /* @__PURE__ */ jsx("button", {
|
|
736
|
+
...props,
|
|
737
|
+
type: "button",
|
|
738
|
+
"aria-label": label,
|
|
739
|
+
"aria-pressed": selected,
|
|
740
|
+
disabled: disabled || !ctx.rangeAvailable(value),
|
|
741
|
+
className: cn("rounded-lg px-3 py-1.5 font-medium text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40", selected ? "bg-foreground text-background" : "bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground", className),
|
|
742
|
+
onClick: (event) => {
|
|
743
|
+
onClick?.(event);
|
|
744
|
+
if (!event.defaultPrevented) ctx.selectPreset(value, label);
|
|
745
|
+
},
|
|
746
|
+
children: children ?? label
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
function DateRangePickerTrigger({ children, placeholder = "Select dates", className, disabled, ref, ...props }) {
|
|
750
|
+
const ctx = useDateRangePickerContext("DateRangePickerTrigger");
|
|
751
|
+
const mergedRef = useCallback((node) => {
|
|
752
|
+
ctx.trigger.current = node;
|
|
753
|
+
if (typeof ref === "function") ref(node);
|
|
754
|
+
else if (ref) ref.current = node;
|
|
755
|
+
}, [ctx.trigger, ref]);
|
|
756
|
+
const format = new Intl.DateTimeFormat(ctx.locale, {
|
|
757
|
+
month: "short",
|
|
758
|
+
day: "numeric",
|
|
759
|
+
timeZone: "UTC"
|
|
760
|
+
});
|
|
761
|
+
const sameYear = ctx.value?.to && ctx.value.from.slice(0, 4) === ctx.value.to.slice(0, 4);
|
|
762
|
+
const summary = ctx.value ? `${(sameYear ? format : ctx.shortFormat).format(parse(ctx.value.from))} – ${ctx.value.to ? ctx.shortFormat.format(parse(ctx.value.to)) : "Select end"}` : placeholder;
|
|
763
|
+
return /* @__PURE__ */ jsx(MorphPopoverTrigger, { children: /* @__PURE__ */ jsx(motion.button, {
|
|
764
|
+
...props,
|
|
765
|
+
ref: mergedRef,
|
|
766
|
+
layout: !ctx.reduce,
|
|
767
|
+
transition: { layout: SPRING_LAYOUT },
|
|
768
|
+
style: {
|
|
769
|
+
borderRadius: 12,
|
|
770
|
+
...props.style
|
|
771
|
+
},
|
|
772
|
+
type: "button",
|
|
773
|
+
disabled: disabled || ctx.disabled,
|
|
774
|
+
"aria-label": props["aria-label"] ?? `${ctx.label}: ${summary}`,
|
|
775
|
+
className: cn("inline-flex h-9 w-fit max-w-full items-center gap-2 rounded-xl border border-border bg-background px-3 font-medium text-[13px] text-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40", className),
|
|
776
|
+
children: children != null ? /* @__PURE__ */ jsx(motion.span, {
|
|
777
|
+
layout: ctx.reduce ? false : "position",
|
|
778
|
+
transition: { layout: SPRING_LAYOUT },
|
|
779
|
+
className: "inline-flex min-w-0 items-center gap-2",
|
|
780
|
+
children
|
|
781
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
782
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
783
|
+
layout: ctx.reduce ? false : "position",
|
|
784
|
+
transition: { layout: SPRING_LAYOUT },
|
|
785
|
+
className: "shrink-0 text-muted-foreground",
|
|
786
|
+
"aria-hidden": "true",
|
|
787
|
+
children: /* @__PURE__ */ jsx(CalendarDays, { size: 15 })
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
790
|
+
layout: ctx.reduce ? false : "position",
|
|
791
|
+
transition: { layout: SPRING_LAYOUT },
|
|
792
|
+
className: "min-w-0 truncate tabular-nums",
|
|
793
|
+
children: summary
|
|
794
|
+
}),
|
|
795
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
796
|
+
layout: ctx.reduce ? false : "position",
|
|
797
|
+
transition: { layout: SPRING_LAYOUT },
|
|
798
|
+
className: "shrink-0 text-muted-foreground",
|
|
799
|
+
"aria-hidden": "true",
|
|
800
|
+
children: /* @__PURE__ */ jsx(ChevronDown, {
|
|
801
|
+
size: 13,
|
|
802
|
+
className: cn(ctx.open && "rotate-180")
|
|
803
|
+
})
|
|
804
|
+
})
|
|
805
|
+
] })
|
|
806
|
+
}) });
|
|
807
|
+
}
|
|
808
|
+
function focusCalendarDate(content) {
|
|
809
|
+
const grid = Array.from(content?.querySelectorAll("[role=\"grid\"]") ?? []).find((element) => !element.closest("[inert]"));
|
|
810
|
+
(grid?.querySelector("button[tabindex=\"0\"]") ?? grid)?.focus({ preventScroll: true });
|
|
811
|
+
}
|
|
812
|
+
function DateRangePickerContent({ children, className, autoFocus = true, onOpenAutoFocus, ...props }) {
|
|
813
|
+
const ctx = useDateRangePickerContext("DateRangePickerContent");
|
|
814
|
+
useLayoutEffect(() => {
|
|
815
|
+
if (ctx.open && autoFocus) focusCalendarDate(ctx.content.current);
|
|
816
|
+
}, [
|
|
817
|
+
ctx.open,
|
|
818
|
+
ctx.content,
|
|
819
|
+
autoFocus
|
|
820
|
+
]);
|
|
821
|
+
return /* @__PURE__ */ jsx(MorphPopoverContent, {
|
|
822
|
+
align: "start",
|
|
823
|
+
radius: 16,
|
|
824
|
+
shadow: false,
|
|
825
|
+
...props,
|
|
826
|
+
className: cn("w-80 max-w-[calc(100vw-1.5rem)]", className),
|
|
827
|
+
onOpenAutoFocus: (content) => {
|
|
828
|
+
ctx.content.current = content;
|
|
829
|
+
if (autoFocus) focusCalendarDate(content);
|
|
830
|
+
onOpenAutoFocus?.(content);
|
|
831
|
+
},
|
|
832
|
+
children
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
/** Convenience composition of the root, trigger, content and calendar. */
|
|
836
|
+
function DateRangePickerDropdown({ placeholder, triggerClassName, calendarClassName, autoFocus = true, showSummary = false, ...props }) {
|
|
837
|
+
return /* @__PURE__ */ jsxs(DateRangePicker, {
|
|
838
|
+
...props,
|
|
839
|
+
autoFocus,
|
|
840
|
+
showSummary,
|
|
841
|
+
children: [/* @__PURE__ */ jsx(DateRangePickerTrigger, {
|
|
842
|
+
placeholder,
|
|
843
|
+
className: triggerClassName
|
|
844
|
+
}), /* @__PURE__ */ jsx(DateRangePickerContent, {
|
|
845
|
+
autoFocus,
|
|
846
|
+
children: /* @__PURE__ */ jsx(DateRangePickerCalendar, { className: cn("w-full rounded-none border-0", calendarClassName) })
|
|
847
|
+
})]
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function CalendarPresence({ children }) {
|
|
851
|
+
const present = useIsPresent();
|
|
852
|
+
return /* @__PURE__ */ jsx("div", {
|
|
853
|
+
inert: !present,
|
|
854
|
+
children
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function CalendarChoices({ id, label, choices, selected, focusOnMount, reduce, onClose, onSelect }) {
|
|
858
|
+
const enabled = choices.filter((choice) => !choice.disabled);
|
|
859
|
+
const [cursor, setCursor] = useState(selected);
|
|
860
|
+
const active = enabled.find((choice) => choice.id === cursor)?.id ?? enabled.find((choice) => choice.id === selected)?.id ?? enabled[0]?.id;
|
|
861
|
+
if (cursor !== null && cursor !== active) setCursor(active ?? null);
|
|
862
|
+
const root = useRef(null);
|
|
863
|
+
useLayoutEffect(() => {
|
|
864
|
+
if (focusOnMount) root.current?.querySelector("button[tabindex=\"0\"]")?.focus({ preventScroll: true });
|
|
865
|
+
}, [focusOnMount]);
|
|
866
|
+
const onKey = (event) => {
|
|
867
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
868
|
+
const buttons = Array.from(root.current?.querySelectorAll("button") ?? []);
|
|
869
|
+
const index = buttons.indexOf(event.currentTarget);
|
|
870
|
+
const offset = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : event.key === "ArrowUp" ? -3 : event.key === "ArrowDown" ? 3 : null;
|
|
871
|
+
let target = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : offset === null ? null : index + offset;
|
|
872
|
+
if (event.key === "Escape") {
|
|
873
|
+
event.preventDefault();
|
|
874
|
+
event.stopPropagation();
|
|
875
|
+
onClose();
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
if (target === null) return;
|
|
879
|
+
event.preventDefault();
|
|
880
|
+
const step = offset === null ? event.key === "Home" ? 1 : -1 : Math.sign(offset);
|
|
881
|
+
while (target >= 0 && target < buttons.length && buttons[target].disabled) target += step;
|
|
882
|
+
buttons[target]?.focus({ preventScroll: true });
|
|
883
|
+
};
|
|
884
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
885
|
+
ref: root,
|
|
886
|
+
id,
|
|
887
|
+
"aria-label": label,
|
|
888
|
+
className: "grid min-h-[15.25rem] grid-cols-3 content-start gap-2 border-0 p-0 pt-1",
|
|
889
|
+
children: choices.map((choice) => /* @__PURE__ */ jsx(motion.button, {
|
|
890
|
+
type: "button",
|
|
891
|
+
disabled: choice.disabled,
|
|
892
|
+
"aria-pressed": choice.id === selected,
|
|
893
|
+
tabIndex: choice.id === active ? 0 : -1,
|
|
894
|
+
onFocus: () => setCursor(choice.id),
|
|
895
|
+
onKeyDown: onKey,
|
|
896
|
+
onClick: () => onSelect(choice.id),
|
|
897
|
+
whileTap: reduce ? void 0 : { scale: .96 },
|
|
898
|
+
transition: SPRING_PRESS,
|
|
899
|
+
className: cn("flex h-13 items-center justify-center rounded-xl px-1 text-[13px] tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-25", choice.id === selected ? "bg-foreground font-medium text-background" : "bg-muted/40 hover:bg-muted"),
|
|
900
|
+
children: choice.label
|
|
901
|
+
}, choice.id))
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
//#endregion
|
|
905
|
+
export { DateRangePicker, DateRangePickerCalendar, DateRangePickerClear, DateRangePickerContent, DateRangePickerDropdown, DateRangePickerFooter, DateRangePickerGrid, DateRangePickerHeader, DateRangePickerPreset, DateRangePickerPresets, DateRangePickerSelection, DateRangePickerSummary, DateRangePickerTrigger, useDateRangePicker };
|
|
906
|
+
|
|
907
|
+
//# sourceMappingURL=date-range-picker.js.map
|