@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":"cascader-lib.js","names":[],"sources":["../../../../src/components/reui/cascader/cascader-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n CascaderCollapse,\n CascaderFlatNode,\n CascaderIndex,\n CascaderNode,\n CascaderPathSegment,\n CascaderSelectable,\n} from \"./cascader-types\";\n\n/** Root level key in `childrenOf`. NUL-prefixed so no real value collides. */\nexport const CASCADER_ROOT_KEY = \"\\u0000root\";\n\n/**\n * Paging pseudo-node prefix. Written as an escape sequence, not a raw 0x00\n * byte: a literal NUL makes this module read as binary and `grep -I` skips it.\n */\nexport const CASCADER_MORE_PREFIX = \"\\u0000more:\";\n\n/* -------------------------------------------------------------------------- */\n/* Scroll layout */\n/* -------------------------------------------------------------------------- */\n\n/**\n * The four scroll classes. In the lib because `cascader-columns.tsx` needs them\n * too and must not import `cascader.tsx`. Shell > bound > scrollport > rows.\n */\n\n/**\n * The bound. `min()` over an undefined custom property is an INVALID\n * declaration that drops the whole max-height, hence the `100vh` fallback: an\n * inline panel has no positioner, so no `--available-height`. `24rem` is the\n * default cap, so the common case sets no variable at all.\n */\nexport const CASCADER_LIST_HEIGHT_CLASS =\n \"max-h-[min(var(--available-height,100vh),var(--cascader-max-height,24rem))]\";\n\n/**\n * Each style's list padding: rows take it as `padding`, the scrollport as\n * `scroll-padding` floored at 4px so lyra's `0` does not strand a row.\n * Mirrored per style from `registry/styles/style-*.css`; keep them in step.\n */\nexport const CASCADER_LIST_PAD_CLASS = \"[--cascader-list-pad:4px]\";\n\n/** The scrollport: a `max-h-*` on the ScrollArea ROOT bounds nothing. */\nexport const CASCADER_SCROLL_CLASS =\n \"size-full min-h-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain **:data-[slot=scroll-area-viewport]:scroll-py-[max(var(--cascader-list-pad,4px),4px)]\";\n\n/** The rows' box; `data-empty:p-0` keeps an empty state from double inset. */\nexport const CASCADER_ROWS_CLASS = \"p-(--cascader-list-pad,4px) data-empty:p-0\";\n\n/* -------------------------------------------------------------------------- */\n/* Tab order */\n/* -------------------------------------------------------------------------- */\n\n/**\n * What counts as a keyboard stop. Base UI's ScrollArea viewport makes ITSELF\n * tabbable when content overflows (`hiddenState.x && hiddenState.y ? -1 : 0`),\n * an unnamed stop per level that `ui/scroll-area.tsx` will not let us suppress.\n */\nconst CASCADER_TAB_STOP_SELECTOR =\n 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\n\n/** The stop to step over: nothing here focuses the scrollport on purpose. */\nconst CASCADER_TAB_SKIP_SELECTOR = '[data-slot=\"scroll-area-viewport\"]';\n\n/** Out of the tab order whatever they contain; layout is never consulted. */\nconst CASCADER_TAB_HIDDEN_SELECTOR = \"[hidden],[inert],[aria-hidden='true']\";\n\n/** The panel's real keyboard stops, in DOM order. */\nfunction getCascaderTabStops(panel: HTMLElement): HTMLElement[] {\n const stops = Array.from(panel.querySelectorAll<HTMLElement>(CASCADER_TAB_STOP_SELECTOR));\n return stops.filter(\n (stop) =>\n // Option and trail rows are real `<button>`s with `tabindex=\"-1\"`.\n stop.getAttribute(\"tabindex\") !== \"-1\" &&\n !stop.matches(CASCADER_TAB_SKIP_SELECTOR) &&\n !stop.closest(CASCADER_TAB_HIDDEN_SELECTOR),\n );\n}\n\n/** The footer's own stops; an `aria-disabled` command still counts as one. */\nexport function getCascaderFooterStops(scope: HTMLElement): HTMLElement[] {\n const footer = scope.matches('[data-slot=\"cascader-footer\"]')\n ? scope\n : scope.querySelector<HTMLElement>('[data-slot=\"cascader-footer\"]');\n if (!footer) return [];\n return getCascaderTabStops(footer);\n}\n\n/** Where Tab lands, or `null` to let the browser out: focus is never trapped. */\nexport function getCascaderTabTarget(\n panel: HTMLElement,\n from: Element | null,\n backwards: boolean,\n): HTMLElement | null {\n const stops = getCascaderTabStops(panel);\n if (stops.length === 0 || !from) return null;\n\n const index = stops.indexOf(from as HTMLElement);\n if (index !== -1) return stops[index + (backwards ? -1 : 1)] ?? null;\n\n if (backwards) {\n for (let i = stops.length - 1; i >= 0; i -= 1) {\n const position = from.compareDocumentPosition(stops[i]);\n if (position & Node.DOCUMENT_POSITION_PRECEDING) return stops[i];\n }\n return null;\n }\n\n for (const stop of stops) {\n const position = from.compareDocumentPosition(stop);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) return stop;\n }\n return null;\n}\n\n/**\n * The writing direction at `element`. `DirectionProvider` may only vote yes:\n * unmounted it answers `\"ltr\"`, which would override a real `<html dir=\"rtl\">`.\n */\nexport function isCascaderRtl(element: Element, provided: string): boolean {\n if (provided === \"rtl\") return true;\n const explicit = element.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase();\n if (explicit === \"rtl\") return true;\n if (explicit === \"ltr\") return false;\n return element.ownerDocument?.defaultView?.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * The paging row as a REAL node, not a DOM-only row after the list: every index\n * Base UI hands out indexes the RENDERED array, so a DOM-only row shifts them.\n */\nexport function createCascaderMoreNode<T = unknown>(\n parentKey: string,\n loadedCount = 0,\n): CascaderNode<T> {\n return {\n value: `${CASCADER_MORE_PREFIX}${parentKey}`,\n // Empty on purpose: a typeahead letter must never reach the paging row.\n label: \"\",\n // Feeds the row's \"Loading more...\" wording, with no second prop to thread.\n count: loadedCount,\n };\n}\n\nexport function isCascaderMoreNode<T>(node: CascaderNode<T>): boolean {\n return node.value.startsWith(CASCADER_MORE_PREFIX);\n}\n\n/** The level key a paging pseudo-node belongs to, or `null` for a real node. */\nexport function getCascaderMoreParent<T>(node: CascaderNode<T>): string | null {\n if (!isCascaderMoreNode(node)) return null;\n return node.value.slice(CASCADER_MORE_PREFIX.length);\n}\n\n/** Either input shape into one index. Cycle-guarded depths; first wins. */\nexport function buildCascaderIndex<T = unknown>(\n items: readonly CascaderNode<T>[] | undefined,\n getParent?: (node: CascaderNode<T>) => string | null | undefined,\n): CascaderIndex<T> {\n const byValue = new Map<string, CascaderNode<T>>();\n const childrenOf = new Map<string, CascaderNode<T>[]>();\n const parentOf = new Map<string, string | null>();\n const depthOf = new Map<string, number>();\n const all: CascaderNode<T>[] = [];\n\n const push = (parentKey: string, node: CascaderNode<T>) => {\n const bucket = childrenOf.get(parentKey);\n if (bucket) {\n bucket.push(node);\n } else {\n childrenOf.set(parentKey, [node]);\n }\n };\n\n if (getParent) {\n for (const node of items ?? []) {\n // A nullish entry is a data bug: skip it like a duplicate, say so in dev.\n if (node == null) {\n if (process.env.NODE_ENV !== \"production\") {\n warnCascaderOnce(\n \"nullish-entry\",\n \"Ignored a null or undefined entry in `items` or `children`. Check the arrays you pass in.\",\n );\n }\n continue;\n }\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n all.push(node);\n }\n\n for (const node of all) {\n const rawParent = getParent(node);\n // An unknown parent makes the node a root rather than dropping the row.\n const parent = rawParent != null && byValue.has(rawParent) ? rawParent : null;\n parentOf.set(node.value, parent);\n push(parent ?? CASCADER_ROOT_KEY, node);\n }\n\n for (const node of all) {\n let depth = 0;\n let cursor = parentOf.get(node.value) ?? null;\n const seen = new Set<string>([node.value]);\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n depth += 1;\n cursor = parentOf.get(cursor) ?? null;\n }\n depthOf.set(node.value, depth);\n }\n } else {\n const walk = (\n nodes: readonly CascaderNode<T>[] | undefined,\n parent: string | null,\n depth: number,\n ) => {\n for (const node of nodes ?? []) {\n // Same degradation as the flat path above.\n if (node == null) {\n if (process.env.NODE_ENV !== \"production\") {\n warnCascaderOnce(\n \"nullish-entry\",\n \"Ignored a null or undefined entry in `items` or `children`. Check the arrays you pass in.\",\n );\n }\n continue;\n }\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n parentOf.set(node.value, parent);\n depthOf.set(node.value, depth);\n all.push(node);\n push(parent ?? CASCADER_ROOT_KEY, node);\n if (node.children?.length) walk(node.children, node.value, depth + 1);\n }\n };\n walk(items, null, 0);\n }\n\n return {\n byValue,\n childrenOf,\n parentOf,\n depthOf,\n roots: childrenOf.get(CASCADER_ROOT_KEY) ?? [],\n all,\n };\n}\n\n/**\n * Folds loaded pages into an index built from `items`, so a re-render with a\n * new `items` array keeps what the user drilled into. Static `items` wins;\n * `detached` is `byValue` ONLY, or deep search doubles it and `childrenOf` lies.\n */\nexport function mergeCascaderIndex<T = unknown>(\n base: CascaderIndex<T>,\n pages: ReadonlyMap<string, readonly CascaderNode<T>[]>,\n detached?: ReadonlyMap<string, CascaderNode<T>>,\n): CascaderIndex<T> {\n // Identity stability: every downstream `useMemo` is keyed on this index.\n if (pages.size === 0 && !detached?.size) return base;\n\n const byValue = new Map(base.byValue);\n const childrenOf = new Map(base.childrenOf);\n const parentOf = new Map(base.parentOf);\n const depthOf = new Map(base.depthOf);\n\n // Copy-on-write per bucket: only levels that got a page pay for a new array.\n const copied = new Set<string>();\n const append = (parentKey: string, node: CascaderNode<T>) => {\n let bucket = childrenOf.get(parentKey);\n if (!copied.has(parentKey)) {\n bucket = bucket ? bucket.slice() : [];\n childrenOf.set(parentKey, bucket);\n copied.add(parentKey);\n }\n bucket!.push(node);\n };\n\n const insert = (parentKey: string, nodes: readonly CascaderNode<T>[]) => {\n for (const node of nodes) {\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n parentOf.set(node.value, parentKey === CASCADER_ROOT_KEY ? null : parentKey);\n append(parentKey, node);\n if (node.children?.length) insert(node.value, node.children);\n }\n };\n\n for (const [parentKey, nodes] of pages) insert(parentKey, nodes);\n\n for (const value of byValue.keys()) {\n if (depthOf.has(value)) continue;\n let depth = 0;\n let cursor = parentOf.get(value) ?? null;\n const seen = new Set<string>([value]);\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n depth += 1;\n cursor = parentOf.get(cursor) ?? null;\n }\n depthOf.set(value, depth);\n }\n\n const roots = childrenOf.get(CASCADER_ROOT_KEY) ?? [];\n\n // Depth first over the MERGED tree, so `all` keeps document order.\n const all: CascaderNode<T>[] = [];\n const visited = new Set<string>();\n const walk = (nodes: readonly CascaderNode<T>[]) => {\n for (const node of nodes) {\n if (visited.has(node.value)) continue;\n visited.add(node.value);\n all.push(node);\n const children = childrenOf.get(node.value);\n if (children?.length) walk(children);\n }\n };\n walk(roots);\n\n // A page whose parent never arrived stays searchable rather than vanishing.\n for (const [value, node] of byValue) {\n if (visited.has(value)) continue;\n visited.add(value);\n all.push(node);\n }\n\n if (detached) {\n for (const [value, node] of detached) {\n if (byValue.has(value)) continue;\n byValue.set(value, node);\n }\n }\n\n return { byValue, childrenOf, parentOf, depthOf, roots, all };\n}\n\n/** Children of `parent`, or the root level when `parent` is nullish. */\nexport function getCascaderChildren<T>(\n index: CascaderIndex<T>,\n parent?: string | null,\n): CascaderNode<T>[] {\n return index.childrenOf.get(parent ?? CASCADER_ROOT_KEY) ?? [];\n}\n\n/** A branch has known children, or `hasChildren` for an unfetched level. */\nexport function isCascaderBranch<T>(index: CascaderIndex<T>, node: CascaderNode<T>): boolean {\n if (node.hasChildren) return true;\n return (index.childrenOf.get(node.value)?.length ?? 0) > 0;\n}\n\n/** Trailing count for the default row. Explicit `count` wins over the tree. */\nexport function getCascaderCount<T>(index: CascaderIndex<T>, node: CascaderNode<T>): number {\n if (typeof node.count === \"number\") return node.count;\n return index.childrenOf.get(node.value)?.length ?? 0;\n}\n\n/**\n * Whether a node is disabled: its own flag, or any ancestor's, since a disabled\n * branch keeps its whole subtree shut. The index's copy counts as its own, so a\n * server hit that omits the flag `items` sets is still caught. Ancestry is\n * `parentOf`: a detached hit the index has never placed answers for itself.\n */\nexport function isCascaderDisabled<T>(index: CascaderIndex<T>, node: CascaderNode<T>): boolean {\n if (node.disabled || index.byValue.get(node.value)?.disabled) return true;\n const seen = new Set<string>([node.value]);\n let cursor = index.parentOf.get(node.value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n if (index.byValue.get(cursor)?.disabled) return true;\n cursor = index.parentOf.get(cursor) ?? null;\n }\n return false;\n}\n\n/** Whether a node may be committed as a selection. */\nexport function isCascaderSelectable<T>(\n index: CascaderIndex<T>,\n node: CascaderNode<T>,\n selectable: CascaderSelectable<T>,\n): boolean {\n // Before the branches a consumer controls: `selectable=\"any\"` says yes to\n // every node, and committing the paging row would select a level's name.\n if (isCascaderMoreNode(node)) return false;\n // Rows render this answer and their presses, keys, `commit`, `navigate` and\n // `navigateAt` check it, so a search lists a disabled subtree none of them\n // opens. The raw setters (`pushLevel`, `setPath`, `toggleExpanded`,\n // `setSelection`) do not ask.\n if (isCascaderDisabled(index, node)) return false;\n if (typeof selectable === \"function\") return selectable(node);\n if (selectable === \"any\") return true;\n return !isCascaderBranch(index, node);\n}\n\n/** Ancestor chain for `value`, root first. Empty while async data loads. */\nexport function getCascaderPath<T>(\n index: CascaderIndex<T>,\n value: string | null | undefined,\n): CascaderNode<T>[] {\n if (value == null) return [];\n const chain: CascaderNode<T>[] = [];\n const seen = new Set<string>();\n let cursor: string | null | undefined = value;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n const node = index.byValue.get(cursor);\n if (!node) break;\n chain.push(node);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n return chain.reverse();\n}\n\n/**\n * `toLocaleLowerCase`, not `toLowerCase`: the invariant mapping turns Turkish\n * \"I\" into \"i\" not \"ı\", so \"ışık\" would never match \"IŞIK\". Both sides fold here.\n */\nexport function foldCascaderText(text: string): string {\n return text.toLocaleLowerCase();\n}\n\n/** Folds once so callers can hoist the cost out of a per-node loop. */\nexport function normalizeCascaderQuery(query: string): string {\n return foldCascaderText(query.trim());\n}\n\n/** Case-insensitive substring over label and keywords; pre-fold the query. */\nexport function matchesCascaderQuery<T>(node: CascaderNode<T>, normalized: string): boolean {\n if (!normalized) return true;\n // Coerced, not trusted: a label-less node is malformed data, not a crash.\n if (foldCascaderText(node.label ?? \"\").includes(normalized)) return true;\n if (node.keywords) {\n for (const keyword of node.keywords) {\n if (foldCascaderText(keyword).includes(normalized)) return true;\n }\n }\n return false;\n}\n\n/** Filters one level in place-order. Returns the input when the query is empty. */\nexport function filterCascaderLevel<T>(\n nodes: readonly CascaderNode<T>[],\n query: string,\n matches: (node: CascaderNode<T>, normalized: string) => boolean = matchesCascaderQuery,\n): CascaderNode<T>[] {\n const normalized = normalizeCascaderQuery(query);\n if (!normalized) return nodes as CascaderNode<T>[];\n return nodes.filter((node) => matches(node, normalized));\n}\n\n/** Searches every node, optionally under `within`, in one pass over `all`. */\nexport function searchCascaderDeep<T>(\n index: CascaderIndex<T>,\n query: string,\n options: {\n within?: string | null;\n limit?: number;\n matches?: (node: CascaderNode<T>, normalized: string) => boolean;\n } = {},\n): CascaderNode<T>[] {\n const normalized = normalizeCascaderQuery(query);\n if (!normalized) return [];\n\n const { within, limit = 200, matches = matchesCascaderQuery } = options;\n const results: CascaderNode<T>[] = [];\n\n // One memoised ancestry map per query. The provisional `false` written on the\n // way up doubles as the cycle guard; the trail is promoted once `within` hits.\n const ancestry = within == null ? null : new Map<string, boolean>();\n const isWithin = (node: CascaderNode<T>) => {\n if (within == null || !ancestry) return true;\n const trail: string[] = [];\n let answer = false;\n let cursor: string | null | undefined = index.parentOf.get(node.value);\n while (cursor != null) {\n if (cursor === within) {\n answer = true;\n break;\n }\n const cached = ancestry.get(cursor);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n ancestry.set(cursor, false);\n trail.push(cursor);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n if (answer) for (const value of trail) ancestry.set(value, true);\n return answer;\n };\n\n for (const node of index.all) {\n if (results.length >= limit) break;\n if (!matches(node, normalized)) continue;\n if (!isWithin(node)) continue;\n results.push(node);\n }\n\n return results;\n}\n\n/**\n * Flattens the tree into tree mode's visible rows. A `sentinels` paging row\n * COUNTS as a sibling in `aria-setsize`: it holds an index of its own.\n */\nexport function flattenCascaderTree<T>(\n index: CascaderIndex<T>,\n expanded: ReadonlySet<string>,\n sentinels?: ReadonlySet<string>,\n): CascaderFlatNode<T>[] {\n const rows: CascaderFlatNode<T>[] = [];\n\n const walk = (nodes: readonly CascaderNode<T>[], parentKey: string, depth: number) => {\n const sentinel = sentinels?.has(parentKey) ?? false;\n const setSize = nodes.length + (sentinel ? 1 : 0);\n for (let i = 0; i < nodes.length; i += 1) {\n const node = nodes[i];\n const branch = isCascaderBranch(index, node);\n const isExpanded = branch && expanded.has(node.value);\n rows.push({\n node,\n depth,\n branch,\n expanded: isExpanded,\n setSize,\n posInSet: i + 1,\n });\n if (isExpanded) {\n walk(index.childrenOf.get(node.value) ?? [], node.value, depth + 1);\n }\n }\n if (sentinel) {\n rows.push({\n node: createCascaderMoreNode<T>(parentKey, nodes.length),\n depth,\n branch: false,\n expanded: false,\n setSize,\n posInSet: setSize,\n });\n }\n };\n\n walk(index.roots, CASCADER_ROOT_KEY, 0);\n return rows;\n}\n\n/** Shortens a path; the ellipsis segment still carries the hidden nodes. */\nexport function collapseCascaderPath<T>(\n path: readonly CascaderNode<T>[],\n options: { maxSegments?: number; collapse?: CascaderCollapse } = {},\n): CascaderPathSegment<T>[] {\n const { maxSegments = 3, collapse = \"middle\" } = options;\n\n const asNodes = (nodes: readonly CascaderNode<T>[]): CascaderPathSegment<T>[] =>\n nodes.map((node) => ({ type: \"node\" as const, node }));\n\n if (collapse === \"none\" || maxSegments <= 0 || path.length <= maxSegments) {\n return asNodes(path);\n }\n\n if (collapse === \"start\") {\n const tail = path.slice(path.length - maxSegments);\n return [\n { type: \"ellipsis\", hidden: path.slice(0, path.length - maxSegments) },\n ...asNodes(tail),\n ];\n }\n\n // \"middle\": keep the root for orientation and as much of the tail as fits.\n const head = path.slice(0, 1);\n const tailCount = maxSegments - 1;\n const tail = path.slice(path.length - tailCount);\n const hidden = path.slice(1, path.length - tailCount);\n\n if (hidden.length === 0) return asNodes(path);\n\n return [...asNodes(head), { type: \"ellipsis\", hidden }, ...asNodes(tail)];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Cascade selection */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Every LOADED node under `value`, root first. Reaching an unfetched descendant\n * would mean a network request per level of the subtree on every selection.\n */\nexport function collectCascaderSubtree<T>(\n index: CascaderIndex<T>,\n value: string,\n): CascaderNode<T>[] {\n const root = index.byValue.get(value);\n if (!root) return [];\n\n const out: CascaderNode<T>[] = [];\n const seen = new Set<string>();\n const walk = (node: CascaderNode<T>) => {\n if (seen.has(node.value)) return;\n seen.add(node.value);\n out.push(node);\n const children = index.childrenOf.get(node.value);\n if (children) for (const child of children) walk(child);\n };\n walk(root);\n return out;\n}\n\n/**\n * Toggles `value` with its loaded subtree, then reconciles ancestors. One flat\n * array, no hidden \"checked\" state: a branch is in the selection exactly when\n * every selectable loaded child of it is, which keeps a row's checked state an\n * O(1) lookup. Nodes `isSelectable` rejects are skipped down AND ignored up,\n * the pressed node excepted.\n */\nexport function applyCascadeSelection<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n value: string,\n select: boolean,\n isSelectable: (node: CascaderNode<T>) => boolean = () => true,\n): string[] {\n const next = new Set(selected);\n const subtree = collectCascaderSubtree(index, value);\n\n // An unknown value still toggles itself, so an early async selection lands.\n if (subtree.length === 0) {\n if (select) next.add(value);\n else next.delete(value);\n }\n\n for (const node of subtree) {\n // The pressed node is exempt: it was committed, so it is selectable.\n if (node.value !== value && !isSelectable(node)) continue;\n if (select) next.add(node.value);\n else next.delete(node.value);\n }\n\n // Bottom up: a parent can only answer once its children have.\n const seen = new Set<string>([value]);\n let cursor = index.parentOf.get(value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n const parent = index.byValue.get(cursor);\n const children = index.childrenOf.get(cursor) ?? [];\n const selectable = children.filter((child) => isSelectable(child));\n const full =\n selectable.length > 0 &&\n selectable.every((child) => next.has(child.value)) &&\n // Never promote a node the consumer said may not be committed. Under\n // `selectable=\"leaf\"` no branch qualifies, hence the `cascade` warning.\n !!parent &&\n isSelectable(parent);\n if (full) next.add(cursor);\n else next.delete(cursor);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n\n return Array.from(next);\n}\n\n/**\n * How many selected nodes each value has BELOW it, itself excluded. Walks UP\n * from each selection: a per-row subtree scan would be quadratic and re-paid.\n */\nexport function getCascaderSelectedDescendants<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n): Map<string, number> {\n const counts = new Map<string, number>();\n\n for (const value of selected) {\n const seen = new Set<string>([value]);\n let cursor = index.parentOf.get(value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n counts.set(cursor, (counts.get(cursor) ?? 0) + 1);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n }\n\n return counts;\n}\n\n/** The PARTIALLY selected values, read off counts the caller already holds. */\nexport function getCascaderIndeterminateFrom(\n counts: ReadonlyMap<string, number>,\n selected: readonly string[],\n): Set<string> {\n const selectedSet = new Set(selected);\n const partial = new Set<string>();\n\n for (const [value, count] of counts) {\n if (count > 0 && !selectedSet.has(value)) partial.add(value);\n }\n\n return partial;\n}\n\n/** The one-call form; the root uses the two halves above and its own counts. */\nexport function getCascaderIndeterminate<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n): Set<string> {\n return getCascaderIndeterminateFrom(getCascaderSelectedDescendants(index, selected), selected);\n}\n\n/** How `getCascaderCheckedValues` condenses a full-closure selection. */\nexport type CascaderCheckedStrategy = \"all\" | \"parent\" | \"child\";\n\n/**\n * The cascade selection under a reporting strategy. DERIVED OUTPUT ONLY: the\n * STORED value stays the full closure, which keeps a checked state an O(1)\n * lookup. `\"all\"` is the closure; `\"parent\"` drops a value whose parent is\n * selected; `\"child\"` drops one with a selected child.\n */\nexport function getCascaderCheckedValues<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n strategy: CascaderCheckedStrategy,\n): readonly string[] {\n if (strategy === \"all\") return selected;\n\n const set = new Set(selected);\n if (strategy === \"parent\") {\n return selected.filter((value) => {\n const parent = index.parentOf.get(value);\n return parent == null || !set.has(parent);\n });\n }\n\n return selected.filter((value) => {\n const children = index.childrenOf.get(value);\n if (!children?.length) return true;\n return !children.some((child) => set.has(child.value));\n });\n}\n\n/** Values in `nodes` whose label collides, so the chip must show its path. */\nexport function findAmbiguousCascaderLabels<T>(nodes: readonly CascaderNode<T>[]): Set<string> {\n const firstByLabel = new Map<string, string>();\n const ambiguous = new Set<string>();\n\n for (const node of nodes) {\n const first = firstByLabel.get(node.label);\n if (first === undefined) {\n firstByLabel.set(node.label, node.value);\n continue;\n }\n ambiguous.add(node.value);\n ambiguous.add(first);\n }\n\n return ambiguous;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Development only */\n/* -------------------------------------------------------------------------- */\n\n/** Warnings already emitted. Module scoped, or they repeat once per render. */\nconst CASCADER_WARNED = new Set<string>();\n\n/** Warns once per `key`, never in production, never by throwing. */\nexport function warnCascaderOnce(key: string, message: string): void {\n if (process.env.NODE_ENV === \"production\") return;\n if (CASCADER_WARNED.has(key)) return;\n CASCADER_WARNED.add(key);\n console.warn(`[Cascader] ${message}`);\n}\n\n/** Empties the ledger. Tests only; a warning is meant to be seen once. */\nexport function resetCascaderWarnings(): void {\n CASCADER_WARNED.clear();\n}\n\n/** What a dev-time scan of the consumer's `items` found wrong with it. */\nexport interface CascaderDataIssues {\n /** Values appearing more than once. First wins, so a duplicate drops a row. */\n duplicates: string[];\n /** Values on a `getParent` cycle. Depth is clamped, so the tree reads wrong. */\n cycles: string[];\n}\n\n/** Dev-time scan, kept out of `buildCascaderIndex` so the build stays hot. */\nexport function findCascaderDataIssues<T>(\n items: readonly CascaderNode<T>[] | undefined,\n getParent?: (node: CascaderNode<T>) => string | null | undefined,\n): CascaderDataIssues {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n const flat: CascaderNode<T>[] = [];\n\n const visit = (nodes: readonly CascaderNode<T>[] | undefined) => {\n for (const node of nodes ?? []) {\n // The build skips a nullish entry, and this runs BEFORE its warning.\n if (node == null) continue;\n if (seen.has(node.value)) duplicates.add(node.value);\n else seen.add(node.value);\n flat.push(node);\n // Flat mode walks them too: BOTH `children` and `getParent` is a bug.\n if (node.children?.length) visit(node.children);\n }\n };\n visit(items);\n\n const cycles: string[] = [];\n if (getParent) {\n const parentOf = new Map<string, string | null>();\n for (const node of flat) {\n if (parentOf.has(node.value)) continue;\n const raw = getParent(node);\n parentOf.set(node.value, raw != null && seen.has(raw) ? raw : null);\n }\n for (const node of flat) {\n const walked = new Set<string>([node.value]);\n let cursor = parentOf.get(node.value) ?? null;\n while (cursor != null) {\n if (walked.has(cursor)) {\n cycles.push(node.value);\n break;\n }\n walked.add(cursor);\n cursor = parentOf.get(cursor) ?? null;\n }\n }\n }\n\n return { duplicates: Array.from(duplicates), cycles };\n}\n"],"mappings":";;;AAYA,MAAa,oBAAoB;;;;;AAMjC,MAAa,uBAAuB;;;;;;;;;;;AAiBpC,MAAa,6BACX;;;;;;AAOF,MAAa,0BAA0B;;AAGvC,MAAa,wBACX;;AAGF,MAAa,sBAAsB;;;;;;AAWnC,MAAM,6BACJ;;AAGF,MAAM,6BAA6B;;AAGnC,MAAM,+BAA+B;;AAGrC,SAAS,oBAAoB,OAAmC;CAE9D,OADc,MAAM,KAAK,MAAM,iBAA8B,0BAA0B,CAC5E,CAAC,CAAC,QACV,SAEC,KAAK,aAAa,UAAU,MAAM,QAClC,CAAC,KAAK,QAAQ,0BAA0B,KACxC,CAAC,KAAK,QAAQ,4BAA4B,CAC9C;AACF;;AAGA,SAAgB,uBAAuB,OAAmC;CACxE,MAAM,SAAS,MAAM,QAAQ,iCAA+B,IACxD,QACA,MAAM,cAA2B,iCAA+B;CACpE,IAAI,CAAC,QAAQ,OAAO,CAAC;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tD"}
|
|
1
|
+
{"version":3,"file":"cascader-lib.js","names":[],"sources":["../../../../src/components/reui/cascader/cascader-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n CascaderCollapse,\n CascaderFlatNode,\n CascaderIndex,\n CascaderNode,\n CascaderPathSegment,\n CascaderSelectable,\n} from \"./cascader-types\";\n\n/** Root level key in `childrenOf`. NUL-prefixed so no real value collides. */\nexport const CASCADER_ROOT_KEY = \"\\u0000root\";\n\n/**\n * Paging pseudo-node prefix. Written as an escape sequence, not a raw 0x00\n * byte: a literal NUL makes this module read as binary and `grep -I` skips it.\n */\nexport const CASCADER_MORE_PREFIX = \"\\u0000more:\";\n\n/* -------------------------------------------------------------------------- */\n/* Scroll layout */\n/* -------------------------------------------------------------------------- */\n\n/**\n * The four scroll classes. In the lib because `cascader-columns.tsx` needs them\n * too and must not import `cascader.tsx`. Shell > bound > scrollport > rows.\n */\n\n/**\n * The bound. `min()` over an undefined custom property is an INVALID\n * declaration that drops the whole max-height, hence the `100vh` fallback: an\n * inline panel has no positioner, so no `--available-height`. `24rem` is the\n * default cap, so the common case sets no variable at all.\n */\nexport const CASCADER_LIST_HEIGHT_CLASS =\n \"max-h-[min(var(--available-height,100vh),var(--cascader-max-height,24rem))]\";\n\n/**\n * Each style's list padding: rows take it as `padding`, the scrollport as\n * `scroll-padding` floored at 4px so lyra's `0` does not strand a row.\n * Mirrored per style from `registry/styles/style-*.css`; keep them in step.\n */\nexport const CASCADER_LIST_PAD_CLASS = \"[--cascader-list-pad:4px]\";\n\n/** The scrollport: a `max-h-*` on the ScrollArea ROOT bounds nothing. */\nexport const CASCADER_SCROLL_CLASS =\n \"size-full min-h-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain **:data-[slot=scroll-area-viewport]:scroll-py-[max(var(--cascader-list-pad,4px),4px)]\";\n\n/** The rows' box; `data-empty:p-0` keeps an empty state from double inset. */\nexport const CASCADER_ROWS_CLASS = \"p-(--cascader-list-pad,4px) data-empty:p-0\";\n\n/* -------------------------------------------------------------------------- */\n/* Tab order */\n/* -------------------------------------------------------------------------- */\n\n/**\n * What counts as a keyboard stop. Base UI's ScrollArea viewport makes ITSELF\n * tabbable when content overflows (`hiddenState.x && hiddenState.y ? -1 : 0`),\n * an unnamed stop per level that `ui/scroll-area.tsx` will not let us suppress.\n */\nconst CASCADER_TAB_STOP_SELECTOR =\n 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\n\n/** The stop to step over: nothing here focuses the scrollport on purpose. */\nconst CASCADER_TAB_SKIP_SELECTOR = '[data-slot=\"scroll-area-viewport\"]';\n\n/** Out of the tab order whatever they contain; layout is never consulted. */\nconst CASCADER_TAB_HIDDEN_SELECTOR = \"[hidden],[inert],[aria-hidden='true']\";\n\n/** The panel's real keyboard stops, in DOM order. */\nfunction getCascaderTabStops(panel: HTMLElement): HTMLElement[] {\n const stops = Array.from(panel.querySelectorAll<HTMLElement>(CASCADER_TAB_STOP_SELECTOR));\n return stops.filter(\n (stop) =>\n // Option and trail rows are real `<button>`s with `tabindex=\"-1\"`.\n stop.getAttribute(\"tabindex\") !== \"-1\" &&\n !stop.matches(CASCADER_TAB_SKIP_SELECTOR) &&\n !stop.closest(CASCADER_TAB_HIDDEN_SELECTOR),\n );\n}\n\n/** The footer's own stops; an `aria-disabled` command still counts as one. */\nexport function getCascaderFooterStops(scope: HTMLElement): HTMLElement[] {\n const footer = scope.matches('[data-slot=\"cascader-footer\"]')\n ? scope\n : scope.querySelector<HTMLElement>('[data-slot=\"cascader-footer\"]');\n if (!footer) return [];\n return getCascaderTabStops(footer);\n}\n\n/**\n * Hands focus to the panel's search field, or the popup without one. A Retry\n * button is replaced by the loading state as the retry starts, and a focused\n * node that unmounts drops focus to the body.\n */\nexport function focusCascaderHome(from: HTMLElement): void {\n const panel = from.closest<HTMLElement>('[data-slot=\"cascader-panel\"]');\n const home =\n panel?.querySelector<HTMLElement>('[data-slot=\"cascader-input\"]') ??\n from.closest<HTMLElement>('[data-slot=\"cascader-content\"]') ??\n panel;\n // An inline panel with no search field is the last home left: make it\n // focusable for this, never a tab stop.\n if (home && home === panel && !home.hasAttribute(\"tabindex\")) {\n home.setAttribute(\"tabindex\", \"-1\");\n }\n home?.focus();\n}\n\n/** Where Tab lands, or `null` to let the browser out: focus is never trapped. */\nexport function getCascaderTabTarget(\n panel: HTMLElement,\n from: Element | null,\n backwards: boolean,\n): HTMLElement | null {\n const stops = getCascaderTabStops(panel);\n if (stops.length === 0 || !from) return null;\n\n const index = stops.indexOf(from as HTMLElement);\n if (index !== -1) return stops[index + (backwards ? -1 : 1)] ?? null;\n\n if (backwards) {\n for (let i = stops.length - 1; i >= 0; i -= 1) {\n const position = from.compareDocumentPosition(stops[i]);\n if (position & Node.DOCUMENT_POSITION_PRECEDING) return stops[i];\n }\n return null;\n }\n\n for (const stop of stops) {\n const position = from.compareDocumentPosition(stop);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) return stop;\n }\n return null;\n}\n\n/**\n * The writing direction at `element`. `DirectionProvider` may only vote yes:\n * unmounted it answers `\"ltr\"`, which would override a real `<html dir=\"rtl\">`.\n */\nexport function isCascaderRtl(element: Element, provided: string): boolean {\n if (provided === \"rtl\") return true;\n const explicit = element.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase();\n if (explicit === \"rtl\") return true;\n if (explicit === \"ltr\") return false;\n return element.ownerDocument?.defaultView?.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * The paging row as a REAL node, not a DOM-only row after the list: every index\n * Base UI hands out indexes the RENDERED array, so a DOM-only row shifts them.\n */\nexport function createCascaderMoreNode<T = unknown>(\n parentKey: string,\n loadedCount = 0,\n): CascaderNode<T> {\n return {\n value: `${CASCADER_MORE_PREFIX}${parentKey}`,\n // Empty on purpose: a typeahead letter must never reach the paging row.\n label: \"\",\n // Feeds the row's \"Loading more...\" wording, with no second prop to thread.\n count: loadedCount,\n };\n}\n\nexport function isCascaderMoreNode<T>(node: CascaderNode<T>): boolean {\n return node.value.startsWith(CASCADER_MORE_PREFIX);\n}\n\n/** The level key a paging pseudo-node belongs to, or `null` for a real node. */\nexport function getCascaderMoreParent<T>(node: CascaderNode<T>): string | null {\n if (!isCascaderMoreNode(node)) return null;\n return node.value.slice(CASCADER_MORE_PREFIX.length);\n}\n\n/** Either input shape into one index. Cycle-guarded depths; first wins. */\nexport function buildCascaderIndex<T = unknown>(\n items: readonly CascaderNode<T>[] | undefined,\n getParent?: (node: CascaderNode<T>) => string | null | undefined,\n): CascaderIndex<T> {\n const byValue = new Map<string, CascaderNode<T>>();\n const childrenOf = new Map<string, CascaderNode<T>[]>();\n const parentOf = new Map<string, string | null>();\n const depthOf = new Map<string, number>();\n const all: CascaderNode<T>[] = [];\n\n const push = (parentKey: string, node: CascaderNode<T>) => {\n const bucket = childrenOf.get(parentKey);\n if (bucket) {\n bucket.push(node);\n } else {\n childrenOf.set(parentKey, [node]);\n }\n };\n\n if (getParent) {\n for (const node of items ?? []) {\n // A nullish entry is a data bug: skip it like a duplicate, say so in dev.\n if (node == null) {\n if (process.env.NODE_ENV !== \"production\") {\n warnCascaderOnce(\n \"nullish-entry\",\n \"Ignored a null or undefined entry in `items` or `children`. Check the arrays you pass in.\",\n );\n }\n continue;\n }\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n all.push(node);\n }\n\n for (const node of all) {\n const rawParent = getParent(node);\n // An unknown parent makes the node a root rather than dropping the row.\n const parent = rawParent != null && byValue.has(rawParent) ? rawParent : null;\n parentOf.set(node.value, parent);\n push(parent ?? CASCADER_ROOT_KEY, node);\n }\n\n for (const node of all) {\n let depth = 0;\n let cursor = parentOf.get(node.value) ?? null;\n const seen = new Set<string>([node.value]);\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n depth += 1;\n cursor = parentOf.get(cursor) ?? null;\n }\n depthOf.set(node.value, depth);\n }\n } else {\n const walk = (\n nodes: readonly CascaderNode<T>[] | undefined,\n parent: string | null,\n depth: number,\n ) => {\n for (const node of nodes ?? []) {\n // Same degradation as the flat path above.\n if (node == null) {\n if (process.env.NODE_ENV !== \"production\") {\n warnCascaderOnce(\n \"nullish-entry\",\n \"Ignored a null or undefined entry in `items` or `children`. Check the arrays you pass in.\",\n );\n }\n continue;\n }\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n parentOf.set(node.value, parent);\n depthOf.set(node.value, depth);\n all.push(node);\n push(parent ?? CASCADER_ROOT_KEY, node);\n if (node.children?.length) walk(node.children, node.value, depth + 1);\n }\n };\n walk(items, null, 0);\n }\n\n return {\n byValue,\n childrenOf,\n parentOf,\n depthOf,\n roots: childrenOf.get(CASCADER_ROOT_KEY) ?? [],\n all,\n };\n}\n\n/** One branch-flagged copy per node, so a re-merge keeps row identity. */\nconst BRANCH_COPIES = new WeakMap<object, object>();\n\nfunction asCascaderBranch<T>(node: CascaderNode<T>): CascaderNode<T> {\n if (node.hasChildren) return node;\n let copy = BRANCH_COPIES.get(node) as CascaderNode<T> | undefined;\n if (!copy) {\n copy = { ...node, hasChildren: true };\n BRANCH_COPIES.set(node, copy);\n }\n return copy;\n}\n\n/**\n * Folds loaded pages into an index built from `items`, so a re-render with a\n * new `items` array keeps what the user drilled into. Static `items` wins;\n * `detached` is `byValue` ONLY, or deep search doubles it and `childrenOf` lies.\n *\n * A resolved chain node in `links` that no page placed still gets its parent,\n * so the trigger keeps its path. While its parent's level is unloaded it is\n * searchable but no row; while that level has pages left (`paging`) it is\n * LISTED, last, and in `pinned`; once the level loaded completely without it\n * (moved, deleted) it is `hidden`: no row, hit or cascade child. A node some\n * link names as a parent reads as a branch, whatever chain wrote it last.\n */\nexport function mergeCascaderIndex<T = unknown>(\n base: CascaderIndex<T>,\n pages: ReadonlyMap<string, readonly CascaderNode<T>[]>,\n detached?: ReadonlyMap<string, CascaderNode<T>>,\n links?: ReadonlyMap<string, string>,\n paging?: ReadonlySet<string>,\n): CascaderIndex<T> {\n // Identity stability: every downstream `useMemo` is keyed on this index.\n if (pages.size === 0 && !detached?.size) return base;\n\n const byValue = new Map(base.byValue);\n const childrenOf = new Map(base.childrenOf);\n const parentOf = new Map(base.parentOf);\n const depthOf = new Map(base.depthOf);\n\n // Copy-on-write per bucket: only levels that got a page pay for a new array.\n const copied = new Set<string>();\n const append = (parentKey: string, node: CascaderNode<T>) => {\n let bucket = childrenOf.get(parentKey);\n if (!copied.has(parentKey)) {\n bucket = bucket ? bucket.slice() : [];\n childrenOf.set(parentKey, bucket);\n copied.add(parentKey);\n }\n bucket!.push(node);\n };\n\n const insert = (parentKey: string, nodes: readonly CascaderNode<T>[]) => {\n for (const node of nodes) {\n if (byValue.has(node.value)) continue;\n byValue.set(node.value, node);\n parentOf.set(node.value, parentKey === CASCADER_ROOT_KEY ? null : parentKey);\n append(parentKey, node);\n if (node.children?.length) insert(node.value, node.children);\n }\n };\n\n for (const [parentKey, nodes] of pages) insert(parentKey, nodes);\n\n const pinned = new Set<string>();\n const hidden = new Set<string>();\n const linkParents = new Set(links?.values());\n for (const [value, parentKey] of links ?? []) {\n const linked = detached?.get(value);\n if (!linked || byValue.has(value)) continue;\n const node = linkParents.has(value) ? asCascaderBranch(linked) : linked;\n byValue.set(value, node);\n parentOf.set(value, parentKey === CASCADER_ROOT_KEY ? null : parentKey);\n if (paging?.has(parentKey)) {\n append(parentKey, node);\n pinned.add(value);\n } else if (pages.has(parentKey) || base.childrenOf.has(parentKey)) {\n hidden.add(value);\n }\n }\n\n for (const value of byValue.keys()) {\n if (depthOf.has(value)) continue;\n let depth = 0;\n let cursor = parentOf.get(value) ?? null;\n const seen = new Set<string>([value]);\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n depth += 1;\n cursor = parentOf.get(cursor) ?? null;\n }\n depthOf.set(value, depth);\n }\n\n const roots = childrenOf.get(CASCADER_ROOT_KEY) ?? [];\n\n // Depth first over the MERGED tree, so `all` keeps document order.\n const all: CascaderNode<T>[] = [];\n const visited = new Set<string>();\n const walk = (nodes: readonly CascaderNode<T>[]) => {\n for (const node of nodes) {\n if (visited.has(node.value)) continue;\n visited.add(node.value);\n all.push(node);\n const children = childrenOf.get(node.value);\n if (children?.length) walk(children);\n }\n };\n walk(roots);\n\n // A page whose parent never arrived, or a linked node whose level has not\n // loaded, stays searchable rather than vanishing.\n for (const [value, node] of byValue) {\n if (visited.has(value) || hidden.has(value)) continue;\n visited.add(value);\n all.push(node);\n }\n\n if (detached) {\n for (const [value, node] of detached) {\n if (byValue.has(value)) continue;\n byValue.set(value, node);\n }\n }\n\n return { byValue, childrenOf, parentOf, depthOf, roots, all, pinned, hidden };\n}\n\n/** Per index, so a query does not rebuild it. */\nconst LISTED_VALUES = new WeakMap<object, ReadonlySet<string>>();\n\n/**\n * Values reachable from the roots through `childrenOf`: the nodes a level can\n * show. A tree query keeps only these, or a resolved node no level lists left\n * its ancestors expanded over nothing.\n */\nexport function getCascaderListedValues<T>(index: CascaderIndex<T>): ReadonlySet<string> {\n let listed = LISTED_VALUES.get(index);\n if (listed) return listed;\n const seen = new Set<string>();\n const walk = (nodes: readonly CascaderNode<T>[]) => {\n for (const node of nodes) {\n if (seen.has(node.value)) continue;\n seen.add(node.value);\n const children = index.childrenOf.get(node.value);\n if (children?.length) walk(children);\n }\n };\n walk(index.roots);\n listed = seen;\n LISTED_VALUES.set(index, listed);\n return listed;\n}\n\n/**\n * A level's rows plus its paging row, placed BEFORE the `pinned` rows, which\n * sit last: the first row a page appends then takes the paging row's index,\n * so the highlight Base UI keeps by index lands on it.\n */\nexport function withCascaderMoreRow<T>(\n rows: readonly CascaderNode<T>[],\n more: CascaderNode<T>,\n pinned?: ReadonlySet<string>,\n): CascaderNode<T>[] {\n const at = pinned?.size ? rows.findIndex((row) => pinned.has(row.value)) : -1;\n if (at === -1) return [...rows, more];\n return [...rows.slice(0, at), more, ...rows.slice(at)];\n}\n\n/** Children of `parent`, or the root level when `parent` is nullish. */\nexport function getCascaderChildren<T>(\n index: CascaderIndex<T>,\n parent?: string | null,\n): CascaderNode<T>[] {\n return index.childrenOf.get(parent ?? CASCADER_ROOT_KEY) ?? [];\n}\n\n/** A branch has known children, or `hasChildren` for an unfetched level. */\nexport function isCascaderBranch<T>(index: CascaderIndex<T>, node: CascaderNode<T>): boolean {\n if (node.hasChildren) return true;\n return (index.childrenOf.get(node.value)?.length ?? 0) > 0;\n}\n\n/** Trailing count for the default row. Explicit `count` wins over the tree. */\nexport function getCascaderCount<T>(index: CascaderIndex<T>, node: CascaderNode<T>): number {\n if (typeof node.count === \"number\") return node.count;\n return index.childrenOf.get(node.value)?.length ?? 0;\n}\n\n/**\n * Whether a node is disabled: its own flag, or any ancestor's, since a disabled\n * branch keeps its whole subtree shut. The index's copy counts as its own, so a\n * server hit that omits the flag `items` sets is still caught. Ancestry is\n * `parentOf`: a detached hit the index has never placed answers for itself.\n */\nexport function isCascaderDisabled<T>(index: CascaderIndex<T>, node: CascaderNode<T>): boolean {\n if (node.disabled || index.byValue.get(node.value)?.disabled) return true;\n const seen = new Set<string>([node.value]);\n let cursor = index.parentOf.get(node.value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n if (index.byValue.get(cursor)?.disabled) return true;\n cursor = index.parentOf.get(cursor) ?? null;\n }\n return false;\n}\n\n/** Whether a node may be committed as a selection. */\nexport function isCascaderSelectable<T>(\n index: CascaderIndex<T>,\n node: CascaderNode<T>,\n selectable: CascaderSelectable<T>,\n): boolean {\n // Before the branches a consumer controls: `selectable=\"any\"` says yes to\n // every node, and committing the paging row would select a level's name.\n if (isCascaderMoreNode(node)) return false;\n // Rows render this answer and their presses, keys, `commit`, `navigate` and\n // `navigateAt` check it, so a search lists a disabled subtree none of them\n // opens. The raw setters (`pushLevel`, `setPath`, `toggleExpanded`,\n // `setSelection`) do not ask.\n if (isCascaderDisabled(index, node)) return false;\n if (typeof selectable === \"function\") return selectable(node);\n if (selectable === \"any\") return true;\n return !isCascaderBranch(index, node);\n}\n\n/** Ancestor chain for `value`, root first. Empty while async data loads. */\nexport function getCascaderPath<T>(\n index: CascaderIndex<T>,\n value: string | null | undefined,\n): CascaderNode<T>[] {\n if (value == null) return [];\n const chain: CascaderNode<T>[] = [];\n const seen = new Set<string>();\n let cursor: string | null | undefined = value;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n const node = index.byValue.get(cursor);\n if (!node) break;\n chain.push(node);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n return chain.reverse();\n}\n\n/**\n * `toLocaleLowerCase`, not `toLowerCase`: the invariant mapping turns Turkish\n * \"I\" into \"i\" not \"ı\", so \"ışık\" would never match \"IŞIK\". Both sides fold here.\n */\nexport function foldCascaderText(text: string): string {\n return text.toLocaleLowerCase();\n}\n\n/** Folds once so callers can hoist the cost out of a per-node loop. */\nexport function normalizeCascaderQuery(query: string): string {\n return foldCascaderText(query.trim());\n}\n\n/** Case-insensitive substring over label and keywords; pre-fold the query. */\nexport function matchesCascaderQuery<T>(node: CascaderNode<T>, normalized: string): boolean {\n if (!normalized) return true;\n // Coerced, not trusted: a label-less node is malformed data, not a crash.\n if (foldCascaderText(node.label ?? \"\").includes(normalized)) return true;\n if (node.keywords) {\n for (const keyword of node.keywords) {\n if (foldCascaderText(keyword).includes(normalized)) return true;\n }\n }\n return false;\n}\n\n/** Filters one level in place-order. Returns the input when the query is empty. */\nexport function filterCascaderLevel<T>(\n nodes: readonly CascaderNode<T>[],\n query: string,\n matches: (node: CascaderNode<T>, normalized: string) => boolean = matchesCascaderQuery,\n): CascaderNode<T>[] {\n const normalized = normalizeCascaderQuery(query);\n if (!normalized) return nodes as CascaderNode<T>[];\n return nodes.filter((node) => matches(node, normalized));\n}\n\n/** Searches every node, optionally under `within`, in one pass over `all`. */\nexport function searchCascaderDeep<T>(\n index: CascaderIndex<T>,\n query: string,\n options: {\n within?: string | null;\n limit?: number;\n matches?: (node: CascaderNode<T>, normalized: string) => boolean;\n } = {},\n): CascaderNode<T>[] {\n const normalized = normalizeCascaderQuery(query);\n if (!normalized) return [];\n\n const { within, limit = 200, matches = matchesCascaderQuery } = options;\n const results: CascaderNode<T>[] = [];\n\n // One memoised ancestry map per query. The provisional `false` written on the\n // way up doubles as the cycle guard; the trail is promoted once `within` hits.\n const ancestry = within == null ? null : new Map<string, boolean>();\n const isWithin = (node: CascaderNode<T>) => {\n if (within == null || !ancestry) return true;\n const trail: string[] = [];\n let answer = false;\n let cursor: string | null | undefined = index.parentOf.get(node.value);\n while (cursor != null) {\n if (cursor === within) {\n answer = true;\n break;\n }\n const cached = ancestry.get(cursor);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n ancestry.set(cursor, false);\n trail.push(cursor);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n if (answer) for (const value of trail) ancestry.set(value, true);\n return answer;\n };\n\n for (const node of index.all) {\n if (results.length >= limit) break;\n if (!matches(node, normalized)) continue;\n if (!isWithin(node)) continue;\n results.push(node);\n }\n\n return results;\n}\n\n/**\n * Flattens the tree into tree mode's visible rows. A `sentinels` paging row\n * COUNTS as a sibling in `aria-setsize`: it holds an index of its own.\n */\nexport function flattenCascaderTree<T>(\n index: CascaderIndex<T>,\n expanded: ReadonlySet<string>,\n sentinels?: ReadonlySet<string>,\n): CascaderFlatNode<T>[] {\n const rows: CascaderFlatNode<T>[] = [];\n\n const walk = (nodes: readonly CascaderNode<T>[], parentKey: string, depth: number) => {\n const items = sentinels?.has(parentKey)\n ? withCascaderMoreRow(nodes, createCascaderMoreNode<T>(parentKey, nodes.length), index.pinned)\n : nodes;\n const setSize = items.length;\n for (let i = 0; i < items.length; i += 1) {\n const node = items[i];\n if (isCascaderMoreNode(node)) {\n rows.push({\n node,\n depth,\n branch: false,\n expanded: false,\n setSize,\n posInSet: i + 1,\n });\n continue;\n }\n const branch = isCascaderBranch(index, node);\n const isExpanded = branch && expanded.has(node.value);\n rows.push({\n node,\n depth,\n branch,\n expanded: isExpanded,\n setSize,\n posInSet: i + 1,\n });\n if (isExpanded) {\n walk(index.childrenOf.get(node.value) ?? [], node.value, depth + 1);\n }\n }\n };\n\n walk(index.roots, CASCADER_ROOT_KEY, 0);\n return rows;\n}\n\n/** Shortens a path; the ellipsis segment still carries the hidden nodes. */\nexport function collapseCascaderPath<T>(\n path: readonly CascaderNode<T>[],\n options: { maxSegments?: number; collapse?: CascaderCollapse } = {},\n): CascaderPathSegment<T>[] {\n const { maxSegments = 3, collapse = \"middle\" } = options;\n\n const asNodes = (nodes: readonly CascaderNode<T>[]): CascaderPathSegment<T>[] =>\n nodes.map((node) => ({ type: \"node\" as const, node }));\n\n if (collapse === \"none\" || maxSegments <= 0 || path.length <= maxSegments) {\n return asNodes(path);\n }\n\n if (collapse === \"start\") {\n const tail = path.slice(path.length - maxSegments);\n return [\n { type: \"ellipsis\", hidden: path.slice(0, path.length - maxSegments) },\n ...asNodes(tail),\n ];\n }\n\n // \"middle\": keep the root for orientation and as much of the tail as fits.\n const head = path.slice(0, 1);\n const tailCount = maxSegments - 1;\n const tail = path.slice(path.length - tailCount);\n const hidden = path.slice(1, path.length - tailCount);\n\n if (hidden.length === 0) return asNodes(path);\n\n return [...asNodes(head), { type: \"ellipsis\", hidden }, ...asNodes(tail)];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Cascade selection */\n/* -------------------------------------------------------------------------- */\n\n/** Per index, so a press does not rebuild it. */\nconst SELECTION_CHILDREN = new WeakMap<object, Map<string, unknown[]>>();\n\n/**\n * Children by parent, built from `parentOf`. Unlike `childrenOf` it also holds\n * a resolved chain node whose level has not loaded, which the selection walks\n * must see: unchecking an ancestor has to take it along. A `hidden` one is left\n * out, since its level loaded without it.\n */\nfunction getSelectionChildren<T>(index: CascaderIndex<T>): Map<string, CascaderNode<T>[]> {\n let map = SELECTION_CHILDREN.get(index) as Map<string, CascaderNode<T>[]> | undefined;\n if (map) return map;\n map = new Map();\n for (const [value, parent] of index.parentOf) {\n const node = index.byValue.get(value);\n if (!node || index.hidden?.has(value)) continue;\n const key = parent ?? CASCADER_ROOT_KEY;\n const bucket = map.get(key);\n if (bucket) bucket.push(node);\n else map.set(key, [node]);\n }\n SELECTION_CHILDREN.set(index, map);\n return map;\n}\n\n/**\n * Every KNOWN node under `value`, root first: loaded, or on a resolved chain.\n * Reaching an unfetched descendant would mean a network request per level of\n * the subtree on every selection.\n */\nexport function collectCascaderSubtree<T>(\n index: CascaderIndex<T>,\n value: string,\n): CascaderNode<T>[] {\n const root = index.byValue.get(value);\n if (!root) return [];\n\n const childrenOf = getSelectionChildren(index);\n const out: CascaderNode<T>[] = [];\n const seen = new Set<string>();\n const walk = (node: CascaderNode<T>) => {\n if (seen.has(node.value)) return;\n seen.add(node.value);\n out.push(node);\n const children = childrenOf.get(node.value);\n if (children) for (const child of children) walk(child);\n };\n walk(root);\n return out;\n}\n\n/**\n * Toggles `value` with its known subtree (loaded, or on a resolved chain), then\n * reconciles ancestors. One flat array, no hidden \"checked\" state: a branch is\n * in the selection exactly when every selectable known child of it is, which\n * keeps a row's checked state an O(1) lookup. Nodes `isSelectable` rejects are skipped down AND ignored up,\n * the pressed node excepted.\n */\nexport function applyCascadeSelection<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n value: string,\n select: boolean,\n isSelectable: (node: CascaderNode<T>) => boolean = () => true,\n): string[] {\n const next = new Set(selected);\n const subtree = collectCascaderSubtree(index, value);\n\n // An unknown value still toggles itself, so an early async selection lands.\n if (subtree.length === 0) {\n if (select) next.add(value);\n else next.delete(value);\n }\n\n for (const node of subtree) {\n // The pressed node is exempt: it was committed, so it is selectable.\n if (node.value !== value && !isSelectable(node)) continue;\n if (select) next.add(node.value);\n else next.delete(node.value);\n }\n\n // Bottom up: a parent can only answer once its children have.\n const seen = new Set<string>([value]);\n let cursor = index.parentOf.get(value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n const parent = index.byValue.get(cursor);\n const children = getSelectionChildren(index).get(cursor) ?? [];\n const selectable = children.filter((child) => isSelectable(child));\n const full =\n selectable.length > 0 &&\n selectable.every((child) => next.has(child.value)) &&\n // Never promote a node the consumer said may not be committed. Under\n // `selectable=\"leaf\"` no branch qualifies, hence the `cascade` warning.\n !!parent &&\n isSelectable(parent);\n if (full) next.add(cursor);\n else next.delete(cursor);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n\n return Array.from(next);\n}\n\n/**\n * How many selected nodes each value has BELOW it, itself excluded. Walks UP\n * from each selection: a per-row subtree scan would be quadratic and re-paid.\n */\nexport function getCascaderSelectedDescendants<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n): Map<string, number> {\n const counts = new Map<string, number>();\n\n for (const value of selected) {\n const seen = new Set<string>([value]);\n let cursor = index.parentOf.get(value) ?? null;\n while (cursor != null && !seen.has(cursor)) {\n seen.add(cursor);\n counts.set(cursor, (counts.get(cursor) ?? 0) + 1);\n cursor = index.parentOf.get(cursor) ?? null;\n }\n }\n\n return counts;\n}\n\n/** The PARTIALLY selected values, read off counts the caller already holds. */\nexport function getCascaderIndeterminateFrom(\n counts: ReadonlyMap<string, number>,\n selected: readonly string[],\n): Set<string> {\n const selectedSet = new Set(selected);\n const partial = new Set<string>();\n\n for (const [value, count] of counts) {\n if (count > 0 && !selectedSet.has(value)) partial.add(value);\n }\n\n return partial;\n}\n\n/** The one-call form; the root uses the two halves above and its own counts. */\nexport function getCascaderIndeterminate<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n): Set<string> {\n return getCascaderIndeterminateFrom(getCascaderSelectedDescendants(index, selected), selected);\n}\n\n/** How `getCascaderCheckedValues` condenses a full-closure selection. */\nexport type CascaderCheckedStrategy = \"all\" | \"parent\" | \"child\";\n\n/**\n * The cascade selection under a reporting strategy. DERIVED OUTPUT ONLY: the\n * STORED value stays the full closure, which keeps a checked state an O(1)\n * lookup. `\"all\"` is the closure; `\"parent\"` drops a value whose parent is\n * selected; `\"child\"` drops one with a selected child.\n */\nexport function getCascaderCheckedValues<T>(\n index: CascaderIndex<T>,\n selected: readonly string[],\n strategy: CascaderCheckedStrategy,\n): readonly string[] {\n if (strategy === \"all\") return selected;\n\n const set = new Set(selected);\n if (strategy === \"parent\") {\n return selected.filter((value) => {\n const parent = index.parentOf.get(value);\n return parent == null || !set.has(parent);\n });\n }\n\n // Parents of a selection, from `parentOf`: it holds the resolved chain\n // nodes no loaded level lists, which `childrenOf` misses.\n const withSelectedChild = new Set<string>();\n for (const value of selected) {\n if (index.hidden?.has(value)) continue;\n const parent = index.parentOf.get(value);\n if (parent != null) withSelectedChild.add(parent);\n }\n return selected.filter((value) => !withSelectedChild.has(value));\n}\n\n/** Values in `nodes` whose label collides, so the chip must show its path. */\nexport function findAmbiguousCascaderLabels<T>(nodes: readonly CascaderNode<T>[]): Set<string> {\n const firstByLabel = new Map<string, string>();\n const ambiguous = new Set<string>();\n\n for (const node of nodes) {\n const first = firstByLabel.get(node.label);\n if (first === undefined) {\n firstByLabel.set(node.label, node.value);\n continue;\n }\n ambiguous.add(node.value);\n ambiguous.add(first);\n }\n\n return ambiguous;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Development only */\n/* -------------------------------------------------------------------------- */\n\n/** Warnings already emitted. Module scoped, or they repeat once per render. */\nconst CASCADER_WARNED = new Set<string>();\n\n/** Warns once per `key`, never in production, never by throwing. */\nexport function warnCascaderOnce(key: string, message: string): void {\n if (process.env.NODE_ENV === \"production\") return;\n if (CASCADER_WARNED.has(key)) return;\n CASCADER_WARNED.add(key);\n console.warn(`[Cascader] ${message}`);\n}\n\n/** Empties the ledger. Tests only; a warning is meant to be seen once. */\nexport function resetCascaderWarnings(): void {\n CASCADER_WARNED.clear();\n}\n\n/** What a dev-time scan of the consumer's `items` found wrong with it. */\nexport interface CascaderDataIssues {\n /** Values appearing more than once. First wins, so a duplicate drops a row. */\n duplicates: string[];\n /** Values on a `getParent` cycle. Depth is clamped, so the tree reads wrong. */\n cycles: string[];\n}\n\n/** Dev-time scan, kept out of `buildCascaderIndex` so the build stays hot. */\nexport function findCascaderDataIssues<T>(\n items: readonly CascaderNode<T>[] | undefined,\n getParent?: (node: CascaderNode<T>) => string | null | undefined,\n): CascaderDataIssues {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n const flat: CascaderNode<T>[] = [];\n\n const visit = (nodes: readonly CascaderNode<T>[] | undefined) => {\n for (const node of nodes ?? []) {\n // The build skips a nullish entry, and this runs BEFORE its warning.\n if (node == null) continue;\n if (seen.has(node.value)) duplicates.add(node.value);\n else seen.add(node.value);\n flat.push(node);\n // Flat mode walks them too: BOTH `children` and `getParent` is a bug.\n if (node.children?.length) visit(node.children);\n }\n };\n visit(items);\n\n const cycles: string[] = [];\n if (getParent) {\n const parentOf = new Map<string, string | null>();\n for (const node of flat) {\n if (parentOf.has(node.value)) continue;\n const raw = getParent(node);\n parentOf.set(node.value, raw != null && seen.has(raw) ? raw : null);\n }\n for (const node of flat) {\n const walked = new Set<string>([node.value]);\n let cursor = parentOf.get(node.value) ?? null;\n while (cursor != null) {\n if (walked.has(cursor)) {\n cycles.push(node.value);\n break;\n }\n walked.add(cursor);\n cursor = parentOf.get(cursor) ?? null;\n }\n }\n }\n\n return { duplicates: Array.from(duplicates), cycles };\n}\n"],"mappings":";;;AAYA,MAAa,oBAAoB;;;;;AAMjC,MAAa,uBAAuB;;;;;;;;;;;AAiBpC,MAAa,6BACX;;;;;;AAOF,MAAa,0BAA0B;;AAGvC,MAAa,wBACX;;AAGF,MAAa,sBAAsB;;;;;;AAWnC,MAAM,6BACJ;;AAGF,MAAM,6BAA6B;;AAGnC,MAAM,+BAA+B;;AAGrC,SAAS,oBAAoB,OAAmC;CAE9D,OADc,MAAM,KAAK,MAAM,iBAA8B,0BAA0B,CAC5E,CAAC,CAAC,QACV,SAEC,KAAK,aAAa,UAAU,MAAM,QAClC,CAAC,KAAK,QAAQ,0BAA0B,KACxC,CAAC,KAAK,QAAQ,4BAA4B,CAC9C;AACF;;AAGA,SAAgB,uBAAuB,OAAmC;CACxE,MAAM,SAAS,MAAM,QAAQ,iCAA+B,IACxD,QACA,M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B,OAAO,KAAK,KAAK,KAAK;KACtB;IACF;IACA,OAAO,IAAI,MAAM;IACjB,SAAS,SAAS,IAAI,MAAM,KAAK;GACnC;EACF;CACF;CAEA,OAAO;EAAE,YAAY,MAAM,KAAK,UAAU;EAAG;CAAO;AACtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as CascaderCollapse, p as CascaderNode, v as CascaderValueDisplay } from "../../../cascader-types-
|
|
1
|
+
import { i as CascaderCollapse, p as CascaderNode, v as CascaderValueDisplay } from "../../../cascader-types-zhnUQ4sP.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
import { Combobox } from "@base-ui/react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as CascaderSelectable, a as CascaderFlatNode, c as CascaderLoadContext, d as CascaderLoadState, f as CascaderMode, g as CascaderSearchScope, h as CascaderSearchContext, i as CascaderCollapse, l as CascaderLoadReason, m as CascaderPathSegment, n as CascaderChangeDetails, o as CascaderIndex, p as CascaderNode, r as CascaderChangeReason, s as CascaderLabels, t as CascaderActionItem, u as CascaderLoadResult, v as CascaderValueDisplay } from "../../../cascader-types-
|
|
1
|
+
import { _ as CascaderSelectable, a as CascaderFlatNode, c as CascaderLoadContext, d as CascaderLoadState, f as CascaderMode, g as CascaderSearchScope, h as CascaderSearchContext, i as CascaderCollapse, l as CascaderLoadReason, m as CascaderPathSegment, n as CascaderChangeDetails, o as CascaderIndex, p as CascaderNode, r as CascaderChangeReason, s as CascaderLabels, t as CascaderActionItem, u as CascaderLoadResult, v as CascaderValueDisplay } from "../../../cascader-types-zhnUQ4sP.js";
|
|
2
2
|
export { CascaderActionItem, CascaderChangeDetails, CascaderChangeReason, CascaderCollapse, CascaderFlatNode, CascaderIndex, CascaderLabels, CascaderLoadContext, CascaderLoadReason, CascaderLoadResult, CascaderLoadState, CascaderMode, CascaderNode, CascaderPathSegment, CascaderSearchContext, CascaderSearchScope, CascaderSelectable, CascaderValueDisplay };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as CascaderSelectable, f as CascaderMode, g as CascaderSearchScope, n as CascaderChangeDetails, p as CascaderNode, s as CascaderLabels, t as CascaderActionItem } from "../../../cascader-types-
|
|
1
|
+
import { _ as CascaderSelectable, f as CascaderMode, g as CascaderSearchScope, n as CascaderChangeDetails, p as CascaderNode, s as CascaderLabels, t as CascaderActionItem } from "../../../cascader-types-zhnUQ4sP.js";
|
|
2
2
|
import { CascaderGetChildren, CascaderOnSearch, CascaderResolveValue } from "./cascader-async.js";
|
|
3
3
|
import { CascaderActionsContextValue, CascaderColumn, CascaderHighlight, CascaderHighlightStore, CascaderItemState, CascaderRenderContextValue, CascaderStateContextValue, createCascaderHighlightStore, useCascaderActions, useCascaderHighlight, useCascaderRender, useCascaderState } from "./cascader-context.js";
|
|
4
4
|
import { CascaderCheckedStrategy } from "./cascader-lib.js";
|
|
@@ -48,7 +48,9 @@ export interface CascaderBaseProps<T = unknown> {
|
|
|
48
48
|
/** Opt in to flat adjacency input by returning each node's parent value. */
|
|
49
49
|
getParent?: (node: CascaderNode<T>) => string | null | undefined;
|
|
50
50
|
/**
|
|
51
|
-
* Fetches one level on demand; `node` is `null` for the root
|
|
51
|
+
* Fetches one level on demand; `node` is `null` for the root, and only
|
|
52
|
+
* `{ value, label: value }` for a level on screen whose node has not loaded
|
|
53
|
+
* (a deep link, or a page-loaded level after a `loadKey` change). Return an
|
|
52
54
|
* array, or a `CascaderLoadResult` when the level pages. Pages cache apart
|
|
53
55
|
* from `items`; mark unfetched branches `hasChildren` or they read as leaves.
|
|
54
56
|
*/
|
|
@@ -63,8 +65,9 @@ export interface CascaderBaseProps<T = unknown> {
|
|
|
63
65
|
searchDebounce?: number;
|
|
64
66
|
/**
|
|
65
67
|
* Resolves a value the loader has never seen into its ancestor chain, root
|
|
66
|
-
* first, so the trigger can path a server-supplied selection.
|
|
67
|
-
* those levels loaded: opening one still
|
|
68
|
+
* first, so the trigger can path a server-supplied selection. Runs with the
|
|
69
|
+
* popup closed too. Does NOT mark those levels loaded: opening one still
|
|
70
|
+
* fetches, and lists the node after its rows while it has pages left.
|
|
68
71
|
*/
|
|
69
72
|
resolveValue?: CascaderResolveValue<T>;
|
|
70
73
|
/** Cache key. Changing it drops every page and aborts anything in flight. */
|
|
@@ -98,9 +101,10 @@ export interface CascaderBaseProps<T = unknown> {
|
|
|
98
101
|
/**
|
|
99
102
|
* Parent/child cascading. Multi-select only, off by default, and it needs
|
|
100
103
|
* committable branches (`selectable="any"` or a predicate). A commit selects
|
|
101
|
-
* or deselects every SELECTABLE node in the
|
|
102
|
-
* ancestors.
|
|
103
|
-
* into a request per level, so children
|
|
104
|
+
* or deselects every SELECTABLE node in the KNOWN subtree (loaded, or on a
|
|
105
|
+
* resolved chain) and reconciles ancestors. KNOWN is the semantic, not a
|
|
106
|
+
* hedge: a commit must not fan out into a request per level, so children
|
|
107
|
+
* arriving later arrive unchecked.
|
|
104
108
|
*/
|
|
105
109
|
cascade?: boolean;
|
|
106
110
|
mode?: CascaderMode;
|
|
@@ -138,7 +142,8 @@ export interface CascaderBaseProps<T = unknown> {
|
|
|
138
142
|
searchScope?: CascaderSearchScope;
|
|
139
143
|
/** Custom matcher, replacing label + keywords substring matching. */
|
|
140
144
|
filter?: (node: CascaderNode<T>, normalizedQuery: string) => boolean;
|
|
141
|
-
/** On open, navigate to the level holding the selection. Default true.
|
|
145
|
+
/** On open, navigate to the level holding the selection. Default true.
|
|
146
|
+
* Not in `mode="tree"`, which has no levels to navigate. */
|
|
142
147
|
revealSelected?: boolean;
|
|
143
148
|
maxHeight?: number | string;
|
|
144
149
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cascader.d.ts","names":["React","ComboboxPrimitive"],"sources":["../../../../src/components/reui/cascader/cascader.tsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"cascader.d.ts","names":["React","ComboboxPrimitive"],"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IAAA;YA2EX,qBAAqB,UAAU;;;;;;;;;;;;iBAalC,gBAAgB,cAAc,SAAS,qBAAkBA,QAAA,+BAAAA,QAAA;iBAwCjD,0BAA0B,KAAKC,SAAkB,KAAK;;;;EAIrE,QAAQD,QAAM;;EAEd;;;;;;;;;;;iBAYO,eAAe,WAAW,OAAO,WAAW,kBAAkB,SAAS,oBAAiBA,QAAA,IAAA;iBA+DhF,2BAA2BC,SAAkB,MAAM;;;;EAIlE;;;;;;iBAOO,gBACP,WACA,UAEA,iBACG,SACF,qBAAkBD,QAAA,IAAA;YAwDT,sBAAsBC,SAAkB,OAAO;;;;;;;iBAQlD,iBAAiB,WAAW,aAAa,SAAS,sBAAmBD,QAAA,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ScrollArea } from "../../ui/scroll-area.js";
|
|
3
3
|
import { CascaderActionsContext, CascaderHighlightContext, CascaderRenderContext, CascaderStateContext, createCascaderHighlightStore, useCascaderActions, useCascaderHighlight, useCascaderRender, useCascaderState } from "./cascader-context.js";
|
|
4
|
-
import { CASCADER_LIST_HEIGHT_CLASS, CASCADER_LIST_PAD_CLASS, CASCADER_ROOT_KEY, CASCADER_ROWS_CLASS, CASCADER_SCROLL_CLASS, applyCascadeSelection, buildCascaderIndex, collapseCascaderPath, createCascaderMoreNode, filterCascaderLevel, findAmbiguousCascaderLabels, findCascaderDataIssues, flattenCascaderTree, getCascaderCheckedValues, getCascaderChildren, getCascaderCount, getCascaderIndeterminateFrom, getCascaderPath, getCascaderSelectedDescendants, getCascaderTabTarget, isCascaderBranch, isCascaderDisabled, isCascaderMoreNode, isCascaderSelectable, matchesCascaderQuery, mergeCascaderIndex, normalizeCascaderQuery, searchCascaderDeep, warnCascaderOnce } from "./cascader-lib.js";
|
|
4
|
+
import { CASCADER_LIST_HEIGHT_CLASS, CASCADER_LIST_PAD_CLASS, CASCADER_ROOT_KEY, CASCADER_ROWS_CLASS, CASCADER_SCROLL_CLASS, applyCascadeSelection, buildCascaderIndex, collapseCascaderPath, createCascaderMoreNode, filterCascaderLevel, findAmbiguousCascaderLabels, findCascaderDataIssues, flattenCascaderTree, focusCascaderHome, getCascaderCheckedValues, getCascaderChildren, getCascaderCount, getCascaderIndeterminateFrom, getCascaderListedValues, getCascaderPath, getCascaderSelectedDescendants, getCascaderTabTarget, isCascaderBranch, isCascaderDisabled, isCascaderMoreNode, isCascaderSelectable, matchesCascaderQuery, mergeCascaderIndex, normalizeCascaderQuery, searchCascaderDeep, warnCascaderOnce, withCascaderMoreRow } from "./cascader-lib.js";
|
|
5
5
|
import { useCascaderLoadState, useCascaderLoader } from "./cascader-async.js";
|
|
6
6
|
import { resolveCascaderLabels } from "./cascader-i18n.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
@@ -239,10 +239,8 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
239
239
|
const { ensureLevel, retryLevel: retryLoaderLevel, invalidateLevel } = loader;
|
|
240
240
|
/**
|
|
241
241
|
* Whether pressing this branch has to FETCH first: in flight, failed, or
|
|
242
|
-
* never asked. `baseIndex`,
|
|
243
|
-
*
|
|
244
|
-
* shows children for levels never requested. Must agree with `ensureLevel`'s
|
|
245
|
-
* own guards or a press parks a navigation nothing will ever settle.
|
|
242
|
+
* never asked. `baseIndex`, as `ensureLevel` asks it: the two must agree or a
|
|
243
|
+
* press parks a navigation nothing will ever settle.
|
|
246
244
|
*/
|
|
247
245
|
const needsChildren = React$1.useCallback((node) => {
|
|
248
246
|
if (!loader.active) return false;
|
|
@@ -254,10 +252,15 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
254
252
|
loadStates,
|
|
255
253
|
baseIndex
|
|
256
254
|
]);
|
|
257
|
-
const
|
|
255
|
+
const pagingKey = JSON.stringify(Array.from(loadStates).filter(([, state]) => state.hasMore).map(([key]) => key));
|
|
256
|
+
const paging = React$1.useMemo(() => new Set(JSON.parse(pagingKey)), [pagingKey]);
|
|
257
|
+
const { pages, detached, links } = loader.store;
|
|
258
|
+
const index = React$1.useMemo(() => mergeCascaderIndex(baseIndex, pages, detached, links, paging), [
|
|
258
259
|
baseIndex,
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
pages,
|
|
261
|
+
detached,
|
|
262
|
+
links,
|
|
263
|
+
paging
|
|
261
264
|
]);
|
|
262
265
|
/** Whether a level needs the paging pseudo-row. A never-fetched level gets
|
|
263
266
|
* nothing; that is the empty state's job. Tree has no per-level empty state,
|
|
@@ -311,12 +314,13 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
311
314
|
const levelRendered = React$1.useMemo(() => {
|
|
312
315
|
if (deepResults) return deepResults;
|
|
313
316
|
if (!needsMoreRow(currentLevelKey, levelItems.length)) return levelItems;
|
|
314
|
-
return
|
|
317
|
+
return withCascaderMoreRow(levelItems, createCascaderMoreNode(currentLevelKey, levelItems.length), index.pinned);
|
|
315
318
|
}, [
|
|
316
319
|
deepResults,
|
|
317
320
|
levelItems,
|
|
318
321
|
currentLevelKey,
|
|
319
|
-
needsMoreRow
|
|
322
|
+
needsMoreRow,
|
|
323
|
+
index.pinned
|
|
320
324
|
]);
|
|
321
325
|
const columns = React$1.useMemo(() => {
|
|
322
326
|
if (mode !== "columns") return [];
|
|
@@ -330,7 +334,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
330
334
|
else {
|
|
331
335
|
const key = parentValue ?? "\0root";
|
|
332
336
|
const children = getCascaderChildren(index, parentValue);
|
|
333
|
-
columnItems = needsMoreRow(key, children.length) ?
|
|
337
|
+
columnItems = needsMoreRow(key, children.length) ? withCascaderMoreRow(children, createCascaderMoreNode(key, children.length), index.pinned) : children;
|
|
334
338
|
}
|
|
335
339
|
trail.push({
|
|
336
340
|
parent,
|
|
@@ -369,7 +373,9 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
369
373
|
const normalized = normalizeCascaderQuery(query);
|
|
370
374
|
if (!normalized) return rows;
|
|
371
375
|
const keep = /* @__PURE__ */ new Set();
|
|
376
|
+
const listed = getCascaderListedValues(index);
|
|
372
377
|
for (const node of index.all) {
|
|
378
|
+
if (!listed.has(node.value)) continue;
|
|
373
379
|
if (!(filter ? filter(node, normalized) : matchesCascaderQuery(node, normalized))) continue;
|
|
374
380
|
for (const ancestor of getCascaderPath(index, node.value)) keep.add(ancestor.value);
|
|
375
381
|
}
|
|
@@ -590,6 +596,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
590
596
|
query,
|
|
591
597
|
filter
|
|
592
598
|
]);
|
|
599
|
+
const hasRows = renderedItems.some((node) => !isCascaderMoreNode(node));
|
|
593
600
|
const announcementTarget = React$1.useMemo(() => {
|
|
594
601
|
if (!open && !inline) return {
|
|
595
602
|
text: "",
|
|
@@ -609,7 +616,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
609
616
|
if (pendingState?.error) text = labels.error;
|
|
610
617
|
else if (pendingNavigation) text = labels.loading;
|
|
611
618
|
else if (levelState?.error) text = labels.error;
|
|
612
|
-
else if (levelState?.loading) text = query.trim() ? labels.searchingAnnouncement :
|
|
619
|
+
else if (levelState?.loading) text = query.trim() ? labels.searchingAnnouncement : hasRows ? labels.loadingMore : labels.loading;
|
|
613
620
|
else if (query.trim()) {
|
|
614
621
|
text = announcedMatches === 0 ? labels.empty : labels.resultsAnnouncement(announcedMatches);
|
|
615
622
|
defer = true;
|
|
@@ -630,6 +637,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
630
637
|
query,
|
|
631
638
|
labels,
|
|
632
639
|
renderedItems.length,
|
|
640
|
+
hasRows,
|
|
633
641
|
announcedMatches,
|
|
634
642
|
currentParent,
|
|
635
643
|
path.length,
|
|
@@ -1009,7 +1017,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
1009
1017
|
if (revealSelected) {
|
|
1010
1018
|
setQuery("");
|
|
1011
1019
|
const first = toArray(value)[0];
|
|
1012
|
-
setPathWithReason(first ? getCascaderPath(index, first).slice(0, -1).map((node) => node.value) : [], "reveal");
|
|
1020
|
+
if (mode !== "tree") setPathWithReason(first ? getCascaderPath(index, first).slice(0, -1).map((node) => node.value) : [], "reveal");
|
|
1013
1021
|
}
|
|
1014
1022
|
}, [
|
|
1015
1023
|
setOpen,
|
|
@@ -1017,6 +1025,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
1017
1025
|
revealSelected,
|
|
1018
1026
|
value,
|
|
1019
1027
|
index,
|
|
1028
|
+
mode,
|
|
1020
1029
|
setPathWithReason,
|
|
1021
1030
|
hasOpenFlyout
|
|
1022
1031
|
]);
|
|
@@ -1028,7 +1037,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
1028
1037
|
* change or a highlight, which is what makes `React.memo` on `CascaderItem`
|
|
1029
1038
|
* hold while the user types. Destructured off `loader` so the memo depends
|
|
1030
1039
|
* on its `[]`-dep callbacks, not the object it republishes per load. */
|
|
1031
|
-
const { active: hasLoader, loadMore, retryLevel, prefetchNode } = loader;
|
|
1040
|
+
const { active: hasLoader, loadMore, retryLevel, retrySearch, prefetchNode } = loader;
|
|
1032
1041
|
const actionsValue = React$1.useMemo(() => ({
|
|
1033
1042
|
index,
|
|
1034
1043
|
mode,
|
|
@@ -1053,6 +1062,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
1053
1062
|
hasLoader,
|
|
1054
1063
|
loadMore,
|
|
1055
1064
|
retryLevel,
|
|
1065
|
+
retrySearch,
|
|
1056
1066
|
invalidateLevel,
|
|
1057
1067
|
getIndex,
|
|
1058
1068
|
getState,
|
|
@@ -1100,6 +1110,7 @@ function Cascader({ items, getParent, getChildren, onSearch, searchDebounce, res
|
|
|
1100
1110
|
hasLoader,
|
|
1101
1111
|
loadMore,
|
|
1102
1112
|
retryLevel,
|
|
1113
|
+
retrySearch,
|
|
1103
1114
|
invalidateLevel,
|
|
1104
1115
|
getIndex,
|
|
1105
1116
|
getState,
|
|
@@ -1444,7 +1455,7 @@ function CascaderList({ className, style, maxHeight: maxHeightProp, ...props })
|
|
|
1444
1455
|
* fetching level as of an empty one, so swapping siblings would announce "No
|
|
1445
1456
|
* results found." over every async level. Swap the CHILDREN. */
|
|
1446
1457
|
function CascaderEmpty({ className, children, skeletonRows, ...props }) {
|
|
1447
|
-
const { labels, retryLevel } = useCascaderActions();
|
|
1458
|
+
const { labels, retryLevel, retrySearch } = useCascaderActions();
|
|
1448
1459
|
const { query, path, searchState } = useCascaderState();
|
|
1449
1460
|
const levelKey = path.length ? path[path.length - 1] : CASCADER_ROOT_KEY;
|
|
1450
1461
|
const loadState = useCascaderLoadState(levelKey);
|
|
@@ -1456,7 +1467,11 @@ function CascaderEmpty({ className, children, skeletonRows, ...props }) {
|
|
|
1456
1467
|
children: [/* @__PURE__ */ jsx("span", { children: labels.error }), /* @__PURE__ */ jsx("button", {
|
|
1457
1468
|
type: "button",
|
|
1458
1469
|
"data-slot": "cascader-retry",
|
|
1459
|
-
onClick: () =>
|
|
1470
|
+
onClick: (event) => {
|
|
1471
|
+
focusCascaderHome(event.currentTarget);
|
|
1472
|
+
if (query.trim() && searchState?.error) retrySearch();
|
|
1473
|
+
else retryLevel(levelKey);
|
|
1474
|
+
},
|
|
1460
1475
|
className: "rounded-md px-2 py-0.5 font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
1461
1476
|
children: labels.retry
|
|
1462
1477
|
})]
|