@kumix/ui 0.3.13 → 0.3.15
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 +12 -12
- package/dist/components/agents/agent-activity/activity-row.js +1 -1
- package/dist/components/agents/agent-activity/activity-row.js.map +1 -1
- package/dist/components/agents/agent-activity/index.js +1 -1
- package/dist/components/agents/agent-activity/index.js.map +1 -1
- package/dist/components/agents/agent-code.d.ts.map +1 -1
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/agents/agent-code.js.map +1 -1
- package/dist/components/agents/agent-disclosure.js +1 -1
- package/dist/components/agents/agent-disclosure.js.map +1 -1
- package/dist/components/agents/ai-sidebar.js +1 -1
- package/dist/components/agents/ai-sidebar.js.map +1 -1
- package/dist/components/agents/approval-card/index.js +1 -1
- package/dist/components/agents/approval-card/index.js.map +1 -1
- package/dist/components/agents/chat-app.js +1 -1
- package/dist/components/agents/chat-app.js.map +1 -1
- package/dist/components/agents/citations.js +1 -1
- package/dist/components/agents/citations.js.map +1 -1
- package/dist/components/agents/code-block.js +1 -1
- package/dist/components/agents/code-block.js.map +1 -1
- package/dist/components/agents/file-diff.js +1 -1
- package/dist/components/agents/file-diff.js.map +1 -1
- package/dist/components/agents/image-generation.js +1 -1
- package/dist/components/agents/image-generation.js.map +1 -1
- package/dist/components/agents/loading-states/agent-progress.js +1 -1
- package/dist/components/agents/loading-states/agent-progress.js.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.js +1 -1
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
- package/dist/components/agents/loading-states/thinking-shimmer.js +1 -1
- package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -1
- package/dist/components/agents/message-bubble.js +1 -1
- package/dist/components/agents/message-bubble.js.map +1 -1
- package/dist/components/agents/message-scroller.js +1 -1
- package/dist/components/agents/message-scroller.js.map +1 -1
- package/dist/components/agents/message.js +1 -1
- package/dist/components/agents/message.js.map +1 -1
- package/dist/components/agents/prompt-input.js +1 -1
- package/dist/components/agents/prompt-input.js.map +1 -1
- package/dist/components/agents/streaming-response.js +1 -1
- package/dist/components/agents/streaming-response.js.map +1 -1
- package/dist/components/agents/todo-list.js +1 -1
- package/dist/components/agents/todo-list.js.map +1 -1
- package/dist/components/agents/tool-approval.js +1 -1
- package/dist/components/agents/tool-approval.js.map +1 -1
- package/dist/components/agents/tool-result.js +1 -1
- package/dist/components/agents/tool-result.js.map +1 -1
- package/dist/components/motion/action-swap.js +1 -1
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/adaptive-stepper.js +1 -1
- package/dist/components/motion/adaptive-stepper.js.map +1 -1
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-badge.js.map +1 -1
- package/dist/components/motion/animated-number.js +1 -1
- package/dist/components/motion/animated-number.js.map +1 -1
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +5 -4
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/availability-scheduler/icon-button.js +1 -1
- package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -1
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/availability-scheduler/index.js.map +1 -1
- package/dist/components/motion/bloom-menu.js +1 -1
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bottom-sheet.js +1 -1
- 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 +1 -1
- package/dist/components/motion/bounce-sidebar.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/bouncy-accordion.js.map +1 -1
- package/dist/components/motion/button/base.js +1 -1
- package/dist/components/motion/button/base.js.map +1 -1
- package/dist/components/motion/button/metallic.js +1 -1
- package/dist/components/motion/button/metallic.js.map +1 -1
- package/dist/components/motion/card-folder.js +1 -1
- package/dist/components/motion/card-folder.js.map +1 -1
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/checkbox.js +1 -1
- package/dist/components/motion/checkbox.js.map +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/content.js.map +1 -1
- package/dist/components/motion/combobox/context.js +1 -1
- package/dist/components/motion/combobox/context.js.map +1 -1
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/list.js.map +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/combobox/trigger.js.map +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +3 -22
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/context-menu.js.map +1 -1
- package/dist/components/motion/cylinder-carousel.js +1 -1
- package/dist/components/motion/cylinder-carousel.js.map +1 -1
- package/dist/components/motion/digit-swap.js +1 -1
- package/dist/components/motion/digit-swap.js.map +1 -1
- package/dist/components/motion/dock.js +1 -1
- package/dist/components/motion/dock.js.map +1 -1
- package/dist/components/motion/drawer.js +1 -1
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/dynamic-island.js +1 -1
- package/dist/components/motion/dynamic-island.js.map +1 -1
- package/dist/components/motion/expandable-action-bar.js +1 -1
- package/dist/components/motion/expandable-action-bar.js.map +1 -1
- package/dist/components/motion/expandable-control.d.ts.map +1 -1
- package/dist/components/motion/expandable-control.js +1 -1
- package/dist/components/motion/expandable-control.js.map +1 -1
- package/dist/components/motion/expandable-tabs.js +1 -1
- package/dist/components/motion/expandable-tabs.js.map +1 -1
- package/dist/components/motion/expanding-arrow-button.js +1 -1
- package/dist/components/motion/expanding-arrow-button.js.map +1 -1
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/file-tree.js +1 -1
- package/dist/components/motion/file-tree.js.map +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/file-upload.js.map +1 -1
- package/dist/components/motion/hold-action-button.js +1 -1
- package/dist/components/motion/hold-action-button.js.map +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/infinite-masonry.js.map +1 -1
- package/dist/components/motion/input.d.ts.map +1 -1
- package/dist/components/motion/input.js +1 -1
- package/dist/components/motion/input.js.map +1 -1
- package/dist/components/motion/liquid.js +1 -1
- package/dist/components/motion/liquid.js.map +1 -1
- package/dist/components/motion/loader.js +1 -1
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/magnetic.js +1 -1
- package/dist/components/motion/magnetic.js.map +1 -1
- package/dist/components/motion/marquee.d.ts.map +1 -1
- package/dist/components/motion/marquee.js +1 -1
- package/dist/components/motion/marquee.js.map +1 -1
- package/dist/components/motion/morphing-modal.js +1 -1
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-search.js.map +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/morphing-tabs.js.map +1 -1
- package/dist/components/motion/multi-select/content.js +1 -1
- package/dist/components/motion/multi-select/content.js.map +1 -1
- package/dist/components/motion/multi-select/context.js +1 -1
- package/dist/components/motion/multi-select/context.js.map +1 -1
- package/dist/components/motion/multi-select/list.js +1 -1
- package/dist/components/motion/multi-select/list.js.map +1 -1
- package/dist/components/motion/multi-select/trigger.js +1 -1
- package/dist/components/motion/multi-select/trigger.js.map +1 -1
- package/dist/components/motion/not-found/magnetic.d.ts.map +1 -1
- package/dist/components/motion/not-found/magnetic.js +1 -1
- package/dist/components/motion/not-found/magnetic.js.map +1 -1
- package/dist/components/motion/not-found/shared.js +1 -1
- package/dist/components/motion/not-found/shared.js.map +1 -1
- package/dist/components/motion/not-found/spotlight.js +1 -1
- package/dist/components/motion/not-found/spotlight.js.map +1 -1
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/notification-stack.js.map +1 -1
- package/dist/components/motion/number-ticker.js +1 -1
- package/dist/components/motion/number-ticker.js.map +1 -1
- package/dist/components/motion/otp-input.js +1 -1
- package/dist/components/motion/otp-input.js.map +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/overflow-actions.js.map +1 -1
- package/dist/components/motion/parallax.d.ts.map +1 -1
- package/dist/components/motion/parallax.js +1 -1
- package/dist/components/motion/parallax.js.map +1 -1
- package/dist/components/motion/popover-morph.js +1 -1
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +1 -1
- package/dist/components/motion/popover.js.map +1 -1
- package/dist/components/motion/preview-rail.js +1 -1
- package/dist/components/motion/preview-rail.js.map +1 -1
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/motion/pull-to-refresh.js +1 -1
- package/dist/components/motion/pull-to-refresh.js.map +1 -1
- package/dist/components/motion/radio.js +1 -1
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/range-slider-bubble.js +1 -1
- package/dist/components/motion/range-slider-bubble.js.map +1 -1
- package/dist/components/motion/range-slider-fluid.js +1 -1
- package/dist/components/motion/range-slider-fluid.js.map +1 -1
- package/dist/components/motion/range-slider-inline.d.ts +18 -0
- package/dist/components/motion/range-slider-inline.d.ts.map +1 -0
- package/dist/components/motion/range-slider-inline.js +267 -0
- package/dist/components/motion/range-slider-inline.js.map +1 -0
- package/dist/components/motion/range-slider-ruler.js +1 -1
- package/dist/components/motion/range-slider-ruler.js.map +1 -1
- package/dist/components/motion/range-slider-wave.js +1 -1
- package/dist/components/motion/range-slider-wave.js.map +1 -1
- package/dist/components/motion/range-slider.d.ts.map +1 -1
- package/dist/components/motion/range-slider.js +27 -11
- package/dist/components/motion/range-slider.js.map +1 -1
- package/dist/components/motion/scroll-progress.js +1 -1
- package/dist/components/motion/scroll-progress.js.map +1 -1
- package/dist/components/motion/scroll-reveal.js +1 -1
- package/dist/components/motion/scroll-reveal.js.map +1 -1
- package/dist/components/motion/scroll-to.js +1 -1
- package/dist/components/motion/scroll-to.js.map +1 -1
- package/dist/components/motion/select-morph.d.ts.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select-morph.js.map +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/select.js.map +1 -1
- package/dist/components/motion/shader-background.d.ts.map +1 -1
- package/dist/components/motion/shader-background.js +1 -1
- package/dist/components/motion/shader-background.js.map +1 -1
- package/dist/components/motion/shared-layout-bg.js +1 -1
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/signup-form.js +1 -1
- package/dist/components/motion/signup-form.js.map +1 -1
- package/dist/components/motion/slide-action-button.js +1 -1
- package/dist/components/motion/slide-action-button.js.map +1 -1
- package/dist/components/motion/swipeable-list.js +1 -1
- package/dist/components/motion/swipeable-list.js.map +1 -1
- package/dist/components/motion/switch.d.ts.map +1 -1
- package/dist/components/motion/switch.js +1 -1
- package/dist/components/motion/switch.js.map +1 -1
- package/dist/components/motion/table/index.js +1 -1
- package/dist/components/motion/table/index.js.map +1 -1
- package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -1
- package/dist/components/motion/table/skeleton-rows.js +1 -1
- package/dist/components/motion/table/skeleton-rows.js.map +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/table/table-header.js.map +1 -1
- package/dist/components/motion/table/table-menu.js +1 -1
- package/dist/components/motion/table/table-menu.js.map +1 -1
- package/dist/components/motion/tabs.js +2 -2
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/text-reveal.js +1 -1
- package/dist/components/motion/text-reveal.js.map +1 -1
- package/dist/components/motion/text-scramble.d.ts.map +1 -1
- package/dist/components/motion/text-scramble.js +1 -1
- package/dist/components/motion/text-scramble.js.map +1 -1
- package/dist/components/motion/text-shimmer.js +1 -1
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/motion/theme-toggle.js.map +1 -1
- package/dist/components/motion/tilt-card.js +1 -1
- package/dist/components/motion/tilt-card.js.map +1 -1
- package/dist/components/motion/tooltip-surface.d.ts +12 -0
- package/dist/components/motion/tooltip-surface.d.ts.map +1 -0
- package/dist/components/motion/tooltip-surface.js +97 -0
- package/dist/components/motion/tooltip-surface.js.map +1 -0
- package/dist/components/motion/tooltip.d.ts +13 -3
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +75 -104
- package/dist/components/motion/tooltip.js.map +1 -1
- package/dist/components/motion/wheel-picker.js +1 -1
- package/dist/components/motion/wheel-picker.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.d.ts.map +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/alert.js.map +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js +2 -2
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/badge.d.ts.map +1 -1
- package/dist/components/reui/badge.js +1 -1
- package/dist/components/reui/badge.js.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +1 -1
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-footer.js +1 -1
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -1
- package/dist/components/reui/cascader/cascader-item.js +1 -1
- package/dist/components/reui/cascader/cascader-item.js.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.js +1 -1
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
- package/dist/components/reui/cascader/cascader.js +1 -1
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.js +1 -1
- package/dist/components/reui/code-block/code-block.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -1
- 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.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +1 -1
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +1 -1
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- 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.js +1 -1
- package/dist/components/reui/filters/filters-builder.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.js +1 -1
- package/dist/components/reui/filters/filters-chip.js.map +1 -1
- package/dist/components/reui/filters/filters-editors.js +1 -1
- package/dist/components/reui/filters/filters-editors.js.map +1 -1
- package/dist/components/reui/filters/filters.js +1 -1
- package/dist/components/reui/filters/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +6 -12
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js +10 -17
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/gantt/gantt.js +1 -1
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-stack.js +1 -1
- package/dist/components/reui/icon-stack.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/icon-tile.d.ts.map +1 -1
- package/dist/components/reui/icon-tile.js +1 -1
- 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 +3 -3
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js +4 -4
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/phone-input.js.map +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/reui/rating.d.ts.map +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/rating.js.map +1 -1
- package/dist/components/reui/sortable.d.ts.map +1 -1
- package/dist/components/reui/sortable.js +1 -1
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/reui/stepper.d.ts.map +1 -1
- package/dist/components/reui/stepper.js +1 -1
- package/dist/components/reui/stepper.js.map +1 -1
- package/dist/components/reui/timeline.d.ts.map +1 -1
- package/dist/components/reui/timeline.js +1 -1
- package/dist/components/reui/timeline.js.map +1 -1
- package/dist/components/reui/tree.d.ts.map +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/reui/tree.js.map +1 -1
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/attachment.js.map +1 -1
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts.map +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/bubble.js.map +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button-group.js.map +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card.js +1 -1
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/kbd.js +1 -1
- package/dist/components/ui/kbd.js.map +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.d.ts.map +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/marker.js.map +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/message-scroller.js.map +1 -1
- package/dist/components/ui/message.d.ts.map +1 -1
- package/dist/components/ui/message.js +1 -1
- package/dist/components/ui/message.js.map +1 -1
- package/dist/components/ui/native-select.d.ts.map +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/questionnaire.js +1 -1
- package/dist/components/ui/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +1 -1
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/toggle-group.js +1 -1
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +1 -1
- package/dist/hooks/use-dismiss.d.ts.map +1 -1
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/lib/command-search.d.ts +10 -0
- package/dist/lib/command-search.d.ts.map +1 -0
- package/dist/lib/command-search.js +52 -0
- package/dist/lib/command-search.js.map +1 -0
- package/package.json +10 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters-chip.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"cn\";\nimport {\n ArrowLeftRightIcon,\n ChevronRightIcon,\n CopyIcon,\n CornerDownRightIcon,\n EllipsisVerticalIcon,\n LayersIcon,\n SlidersHorizontalIcon,\n Trash2Icon,\n XIcon,\n} from \"lucide-react\";\n\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n} from \"./filters-context\";\nimport { FilterMenu, useFilterOptions, useFilterValueResolution } from \"./filters-editors\";\nimport {\n collapseFilterPath,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n formatFilterPath,\n getFilterField,\n getFilterFieldChain,\n} from \"./filters-lib\";\nimport {\n coerceFilterValue,\n getFilterArity,\n getFilterOperator,\n operatorTakesValue,\n visibleFilterOperators,\n} from \"./filters-operators\";\nimport { findFilterNode, isFilterGroup } from \"./filters-query\";\nimport type {\n FilterEditorProps,\n FilterField,\n FilterGroupNode,\n FilterOperator,\n FilterRule,\n} from \"./filters-types\";\n\n/** Which part of the chip a pointer or key is aimed at. No `field`: the chip's\n * attribute segment is display only, and only the builder re-picks one. */\ntype ChipSegment = \"operator\" | \"value\" | \"menu\";\n\n/** The ref half of `autoFocusProps`: a CALLBACK ref, the one shape an editor\n * can spread onto any element without a cast, and a no-op here. */\nconst noopAutoFocusRef: React.RefCallback<HTMLElement> = () => {};\n\nfunction defaultValueDisplay<V>(\n value: V | undefined,\n operator: FilterOperator | undefined,\n resolveOption: (value: string) => { label: string } | undefined,\n labels: ReturnType<typeof useFilterActions>[\"labels\"],\n // The field's own word for \"no value yet\", which a generic label cannot beat.\n fieldPlaceholder?: string,\n /** Whether the value is PICKED rather than typed: a select's search prompt\n * and \"enter text...\" both give way to `labels.selectPlaceholder`. */\n optionBacked?: boolean,\n): string {\n const emptyLabel = optionBacked\n ? labels.selectPlaceholder\n : (fieldPlaceholder ?? labels.valuePlaceholder);\n if (value === undefined || value === null || value === \"\") {\n return emptyLabel;\n }\n\n if (getFilterArity(operator) === \"range\" && Array.isArray(value)) {\n const [from, to] = value as unknown[];\n return labels.valueRange(String(from ?? \"\"), String(to ?? \"\"));\n }\n\n if (Array.isArray(value)) {\n const values = value as string[];\n if (values.length === 0) return emptyLabel;\n if (values.length === 1) {\n return resolveOption(values[0])?.label ?? String(values[0]);\n }\n return labels.valueCount(values.length);\n }\n\n if (typeof value === \"boolean\") return value ? \"True\" : \"False\";\n\n return resolveOption(String(value))?.label ?? String(value);\n}\n\n/** The same display with the option's own icon in front. A status filter reads\n * as its colour before its word, so dropping the swatch the picker showed\n * makes the chip harder to scan than the list it came from. */\nfunction valueWithIcon<V>(\n value: V | undefined,\n text: string,\n resolveOption: (value: string) => { icon?: React.ReactNode } | undefined,\n): React.ReactNode {\n const single =\n value === undefined || value === null || Array.isArray(value)\n ? Array.isArray(value) && value.length === 1\n ? String(value[0])\n : null\n : String(value);\n const icon = single ? resolveOption(single)?.icon : null;\n if (!icon) return text;\n return (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {text}\n </span>\n );\n}\n\n/** The glyph between two ancestors in a nested attribute path, a chevron\n * because the `pathSeparator` string read as loud as the names it parts.\n * DECORATIVE: `aria-hidden`, and the plain string is still what\n * `formatFilterPath` joins for the chip's accessible name and `title`. */\nfunction FilterPathSeparator() {\n return (\n <ChevronRightIcon\n aria-hidden=\"true\"\n data-slot=\"filter-path-separator\"\n className=\"mx-[3px] inline-block size-3 shrink-0 self-center align-[calc(0.3635em-0.375rem)] text-muted-foreground\"\n />\n );\n}\n\n/** The elided run of a collapsed path, with the FULL path behind it. THE\n * TOOLTIP IS NOT THE ACCESSIBLE ROUTE: it is hover and focus, so the segment\n * is `aria-hidden` and the whole path stays in the control's NAME. The host's\n * own `title` is dropped while collapsed (`pathCollapsed`) or both fire. */\nfunction FilterPathEllipsis({ full }: { full: string }) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n aria-hidden=\"true\"\n data-slot=\"filter-path-ellipsis\"\n /* A path SEGMENT with no air of its own: the chevron's margin\n is all that parts a name from the next, and this used to STACK\n an `mx` on it. Plain inline, no `vertical-align`: `middle` sat\n the dots 1.7px low and inline-block grew the run to 21.17px. */\n className=\"shrink-0 self-center text-muted-foreground\"\n >\n ...\n </span>\n }\n />\n <TooltipContent>{full}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** Everything a rule needs in order to be READ, in either chrome. */\nexport interface FilterRuleDisplay {\n pathText: string;\n pathLabel: React.ReactNode;\n /** Whether `pathLabel` shows fewer names than the path has, so the cell's\n * own `title` can step aside for the ellipsis segment's tooltip. */\n pathCollapsed: boolean;\n operatorLabel: string;\n valueLabel: React.ReactNode;\n /** The same value as PLAIN TEXT, for an accessible name. Never scraped from\n * the `renderValue` node: whatever text survives inside avatars and a count\n * badge announces \"plus one\" for two people. Kept separate from\n * `valueLabel`, not derived from it: a React node has no honest text to\n * read back. A field whose values do not stringify supplies `valueText`\n * itself, or the built-in fallback says \"[object Object]\" to exactly the\n * audience the visible display is hiding it from. */\n valueText: string;\n /** The same value with any collapsed COUNT spelled out. \"3 selected\" cannot\n * be recovered from, which is fine while the editor opens and not once\n * locked, so the control carries this as `title` and, locked, as its name. */\n valueFullText: string;\n valueEmpty: boolean;\n}\n\n/** How one rule reads, resolved once and shared by both chromes, so a consumer\n * `renderValue`, the field's own and the built-in cannot disagree. */\nexport function useFilterRuleDisplay<V, O>(\n rule: FilterRule<V>,\n field: FilterField<V, O> | undefined,\n operator: FilterOperator | undefined,\n): FilterRuleDisplay {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n // Lazily: a label needs no options until an editor actually opens.\n const optionsState = useFilterOptions<V, O>(field, false);\n\n const values =\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value];\n\n // Saved views: values the loader has never returned are resolved through the\n // field's own `resolveValues`, so a restored chip reads \"John Doe\", not an id.\n useFilterValueResolution(field, values);\n\n const pathText = formatFilterPath(actions.index, rule.path, actions.labels.pathSeparator);\n\n const chain = getFilterFieldChain(actions.index, rule.path);\n // The CASCADER's collapser, from the actions context rather than per host, so\n // a deep path reads the same on a chip and in a builder row.\n const segments = collapseFilterPath(chain, {\n maxSegments: actions.maxPathSegments,\n collapse: actions.pathCollapse,\n });\n const pathCollapsed = segments.some((segment) => segment.type === \"ellipsis\");\n const pathLabel = chain.length\n ? segments.map((segment, index) => (\n <React.Fragment\n /* Positional, because a field id is unique among its SIBLINGS only:\n\"Company > Team > Company\" is a legal path and its two ids collide. */\n key={segment.type === \"field\" ? `${index}:${segment.field.id}` : `${index}:ellipsis`}\n >\n {index > 0 ? <FilterPathSeparator /> : null}\n {segment.type === \"field\" ? (\n <span>{segment.field.label}</span>\n ) : (\n <FilterPathEllipsis full={pathText} />\n )}\n </React.Fragment>\n ))\n : pathText;\n\n const operatorLabel = operator\n ? rule.negated\n ? actions.labels.negated(operator.label)\n : operator.label\n : rule.operator || actions.labels.selectCondition;\n\n const valueEmpty =\n rule.value === undefined ||\n rule.value === null ||\n rule.value === (\"\" as unknown as V) ||\n values.length === 0;\n\n if (!field) {\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel: \"\",\n valueText: \"\",\n valueFullText: \"\",\n valueEmpty,\n };\n }\n\n const valueContext = {\n value: rule.value,\n values,\n field,\n operator: operator ?? { value: rule.operator, label: rule.operator },\n // Resolved, not empty: a custom display needs the option behind each value.\n options: values\n .map((entry) => optionsState.resolve(String(entry)))\n .filter(Boolean) as NonNullable<ReturnType<typeof optionsState.resolve>>[],\n labels: actions.labels,\n };\n\n // Computed even when a custom display replaces it: this is the string the\n // accessible name is built from. `field.valueText` overrides it.\n const valueText = field.valueText\n ? field.valueText(valueContext)\n : defaultValueDisplay(\n rule.value,\n operator,\n optionsState.resolve,\n actions.labels,\n field.placeholder,\n // Option-backed by the FIELD, not the operator: `is any of` is\n // multi-value on a plain text field too, and that one is typed into.\n field.type === \"select\" ||\n field.type === \"multiselect\" ||\n Boolean(field.options?.length) ||\n Boolean(field.loadOptions),\n );\n\n const valueLabel = render.renderValue\n ? render.renderValue(valueContext)\n : field.renderValue\n ? field.renderValue(valueContext)\n : valueWithIcon(rule.value, valueText, optionsState.resolve);\n\n // The list behind the count, or the same text again. Multi-value only: a\n // RANGE also stores an array but already spells both ends out (\"10 to 99\").\n const valueFullText =\n field.valueText ||\n !Array.isArray(rule.value) ||\n getFilterArity(operator) === \"range\" ||\n values.length < 2\n ? valueText\n : actions.labels.valueDetail(\n valueText,\n values.map((entry) => optionsState.resolve(String(entry))?.label ?? String(entry)),\n );\n\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n };\n}\n\ninterface FilterValueEditorProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator;\n /** Whether the surface holding it is showing. Gates the option service. */\n open: boolean;\n onClose: () => void;\n}\n\n/** The value editor - draft, option service, commit - with NO surface of its\n * own, so surface and wiring can be replaced independently. The draft lives\n * here, so a text filter dispatches once on commit, not once per keystroke. */\nfunction FilterValueEditor<V, O>({\n rule,\n field,\n operator,\n open,\n onClose,\n}: FilterValueEditorProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const [draft, setDraft] = React.useState<V | undefined>(rule.value);\n\n React.useEffect(() => {\n if (open) setDraft(rule.value);\n }, [open, rule.value]);\n\n const options = useFilterOptions<V, O>(field, open);\n // A LOOKUP, not a definition: every result is a module-level built-in or the\n // consumer's own component, so the editor is never remounted mid-edit.\n const editor = React.useMemo(\n () => actions.resolveEditor(field, operator),\n [actions, field, operator],\n );\n\n if (!editor) return null;\n\n const editorProps: FilterEditorProps<V, O> = {\n field,\n operator,\n value: draft,\n onValueChange: (next) => setDraft(next as V),\n host: \"amend\",\n autoFocusProps: {\n ref: noopAutoFocusRef,\n autoFocus: true,\n },\n commit: (next, commitOptions) => {\n actions.updateRule(rule.id, {\n value: (next === undefined ? draft : next) as V,\n });\n // A multi-select commits per toggle and asks to stay put; others dismiss.\n if (commitOptions?.close === false) return;\n onClose();\n },\n cancel: onClose,\n // The same as cancel, honestly: `back` means something only to a `create`\n // host.\n back: onClose,\n options,\n labels: actions.labels,\n };\n\n // `createElement` rather than JSX: the component comes out of a lookup, so\n // `<Editor />` trips `react-hooks/static-components`. The fragment keeps the\n // props object, which carries a ref, from looking like a ref read in render.\n return <>{React.createElement(editor, editorProps)}</>;\n}\n\n/** One step of the flow, released when the panel that owes it has LEFT THE\n * DOM: both popovers keep portal content mounted through the exit transition,\n * so this unmount IS that moment and nothing is timed. `onRelease` is used AS\n * the cleanup, so an unmemoized callback fires its step early. */\nfunction FilterStepHandoff({ onRelease }: { onRelease: () => void }) {\n React.useEffect(() => onRelease, [onRelease]);\n return null;\n}\n\n/** The value host: the editor in a popover anchored to the value segment, and\n * BOTH routes end here. The operator popover used to draw the editor itself,\n * so a handed-off panel sat a segment's width left of a second press. */\nexport interface FilterValuePopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator | undefined;\n /** The element that opens it, WITH its own children: a chip segment must be\n * a direct child of its `ButtonGroup` for the pill to fuse. */\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterValuePopover<V, O>({\n rule,\n field,\n operator,\n trigger,\n className,\n}: FilterValuePopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n\n // The last step of the flow as well as the amend route; by now the condition\n // menu has UNMOUNTED (see `FilterStepHandoff`). CONSUMED as it is honoured,\n // or Escape closes the editor and this effect reopens it in the same frame.\n // The `set` stays OUTSIDE the `locked` guard on purpose: a handoff nobody\n // spends sits armed until some later chip spends it, and a chip that opened\n // because a DIFFERENT chip was arrowed onto is worse than one that opened\n // nothing.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n // Nothing to open, but the trigger still renders so the value keeps its\n // place, and it wears the bar's state: that hangs on the TRIGGER below,\n // which this path never reaches, so the segment used to look live.\n if (!operator || !actions.resolveEditor(field, operator)) {\n return React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n disabled: actions.disabled,\n ...filterReadOnlyProps(actions),\n });\n }\n\n return (\n // REFUSES to open while locked rather than leaving it to the trigger: an\n // `aria-disabled` control that still opens an editor is one that lied.\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n {/* The trigger IS the segment, never a wrapper. `ButtonGroup` fuses\n DIRECT children only (`*:data-slot:rounded-r-none`,\n `[&>[data-slot]~[data-slot]]:border-l-0`), so a nested one keeps its\n own border and the chip reads as separate badges. */}\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent align=\"start\" className={cn(\"w-auto p-0\", className)}>\n <FilterValueEditor<V, O>\n rule={rule}\n field={field}\n operator={operator}\n open={open}\n onClose={() => {\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/* A chip's ATTRIBUTE is fixed once the chip exists: no field popover here. A\n new field invalidates the operator and the value, so \"amending\" threw both\n away. The builder keeps its picker, where a row reads as a form. */\n\n/** The condition menu, and the step after it. The list is the cascader run\n * flat: the old hand-rolled one marked the keyboard HIGHLIGHT with\n * `aria-selected` and had no Home, End or typeahead. It HANDS OFF to the\n * value popover once its own panel has left the DOM; advancing in place\n * anchored the editor to the CONDITION segment and doubled up in the row. */\nexport interface FilterOperatorPopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterOperatorPopover<V, O>({\n rule,\n field,\n trigger,\n className,\n}: FilterOperatorPopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"operator\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n /** Whether the close this panel is going through IS the step being handed\n * on. A ref, so it survives the render that closes the popover. Every OPEN\n * clears it, so an Escape or an outside press finds it already lowered and\n * spends nothing; `release` leaves it standing because one twin asks again\n * later: Radix reads it from `onCloseAutoFocus`, a macrotask after the\n * unmount. Clearing it in `release` would break that twin only. */\n const handoff = React.useRef(false);\n const operators = actions.resolveOperators(field);\n\n // Memoized because the array IS the menu's identity: the cascader rebuilds\n // its index per `items` identity, so a fresh array rebuilds it per keystroke.\n const items = React.useMemo(\n () =>\n visibleFilterOperators(operators).map((entry) => ({\n value: entry.value,\n label: entry.label,\n })),\n [operators],\n );\n\n // Opened by the root the moment the chip is created. CONSUMED here, or the\n // handoff re-opens the menu on the frame Escape closes it. Consumed even\n // while locked, for the reason on the value popover's copy.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n handoff.current = false;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n const close = () => {\n handoff.current = false;\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n };\n\n /** The parked step, spent on the frame this panel stops existing. Memoized\n * on nothing that changes, and load bearing: `FilterStepHandoff` uses this\n * AS its cleanup, so a new identity mid-flow fires the step too early. */\n const release = React.useCallback(() => {\n if (!handoff.current) return;\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: true });\n }, [focusStore, rule.id]);\n\n // The chip going away takes its step with it: React destroys a deleted\n // subtree top down, so this runs before the panel's own cleanup.\n React.useEffect(\n () => () => {\n handoff.current = false;\n },\n [],\n );\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n /* Escape, an outside press, a second press: none is the step being\n taken, so none may spend it. RETIRED ON OPEN, not on close, and that\n is a twin difference: in Radix an item choice dismisses through here\n too, so retiring on close wiped the request before the unmount. */\n if (next) handoff.current = false;\n setOpen(next);\n }}\n >\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent\n align=\"start\"\n /* Base UI restores focus to the trigger as this panel closes, which\n lands on the condition segment AFTER the value editor has opened and\n focused its input, so a keyboard user is dropped back a step and\n cannot reach the value at all. Suppressed only while the handoff is\n up; a function because Base UI resolves it at close time, which is\n when the ref is accurate. Radix runs the same guard through\n `onCloseAutoFocus`. */\n finalFocus={() => !handoff.current}\n /* `w-auto` with a FLOOR: a catalog sizes to its longest label, and a\n boolean field's \"is\" and \"is not\" would read as a scrap of paper. */\n className={cn(\"w-auto min-w-40 p-0\", className)}\n >\n {/* INSIDE the panel deliberately: only a child of the content is\n unmounted by the exit transition rather than by the close. */}\n <FilterStepHandoff onRelease={release} />\n <FilterMenu\n items={items}\n selected={rule.operator ? [rule.operator] : []}\n onSelectionChange={(values) => {\n const value = values[0];\n /* Deselecting the committed operator is a step back rather than a\n choice, so pressing the current row simply closes. */\n if (value === undefined) {\n close();\n return;\n }\n const chosen = getFilterOperator(operators, value);\n /* BUILDING versus AMENDING, the same fork the advanced row draws\n at its field step. A rule reaches this menu with no operator\n exactly once, while it is being added, and only then is the\n value the step after this one. Re-picking the condition on a\n rule that already has one is an edit of that one cell: it\n commits and closes, and the user opens the value themselves. */\n const building = !rule.operator;\n actions.updateRule(rule.id, {\n operator: value,\n /* The value moves with the operator: \"is\" to \"is any of\" would\n leave a bare string where every reader expects an array. */\n value: coerceFilterValue(\n rule.value,\n getFilterOperator(operators, rule.operator),\n chosen,\n ) as V,\n });\n if (building && operatorTakesValue(chosen)) {\n /* PARKED, not opened: `release` hands the row to its value\n surface once this panel has unmounted. */\n handoff.current = true;\n setOpen(false);\n return;\n }\n close();\n }}\n labels={actions.labels}\n ariaLabel={field.label}\n searchPlaceholder={actions.labels.searchOperators}\n /* No visible search field: a CLOSED enum of six to ten labels, all\n on screen. Still RENDERED, visually hidden, because it owns focus\n and `aria-activedescendant`: arrows, Home, End and typeahead. */\n searchable={false}\n /* Taller than a value list on purpose: the operator set is CLOSED, so\n all of it fits and the height buys the whole catalog. A value list\n is open ended and would only push its own footer off the screen. */\n maxHeight={320}\n /* Deliberately unpinned: one selected operator in a short list, so\nlifting it would lose the catalog's declared reading order. */\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The keyboard path to a CROSS-GROUP move: Alt+Arrow reorders within the\n * owning group only and Wrap creates a NEW group, so the drag layer's\n * cross-group move had no keyboard parity. Numbered in document order. */\nexport function FilterMoveToMenuItems({ nodeId }: { nodeId: string }) {\n const actions = useFilterActions();\n // A menu ITEM takes the native word: both twins already make `disabled`\n // roving-focusable and `aria-disabled`.\n const reorderable = useFilterReorderable();\n const locked = isFilterLocked(actions);\n // Read at render time: the menu's content mounts when the menu opens, so\n // this is the tree the user is looking at.\n const query = actions.getQuery();\n const found = findFilterNode(query, nodeId);\n if (!found?.parent) return null;\n\n const destinations: { id: string; label: string; size: number }[] = [];\n if (found.parent.id !== query.id) {\n destinations.push({\n id: query.id,\n label: actions.labels.moveToTopLevel,\n size: query.rules.length,\n });\n }\n\n let position = 0;\n // `inside` suppresses the PUSH and not the walk, so the numbering stays\n // document order rather than renumbering every group after this one. Counted\n // before the exclusions for the same reason: the current parent is not\n // offered but still holds its number, so the numbering is stable whichever\n // row's menu is open.\n const visit = (group: FilterGroupNode<unknown>, inside: boolean) => {\n for (const child of group.rules) {\n if (!isFilterGroup(child)) continue;\n position += 1;\n // Itself and everything under it: `moveFilterNodeTo` already refuses that\n // move - it would detach the subtree and leave a cycle - so offering it\n // would be a menu row that quietly does nothing.\n const within = inside || child.id === nodeId;\n if (!within && child.id !== found.parent!.id) {\n destinations.push({\n id: child.id,\n label: actions.labels.moveToGroup(position),\n size: child.rules.length,\n });\n }\n visit(child, within);\n }\n };\n visit(query, false);\n\n if (destinations.length === 0) return null;\n\n // The THIRD route into a move, gated on the same switch as the grip and\n // Alt+Arrow: ungated, a builder that draws no handle still reordered here.\n if (!reorderable) return null;\n\n return (\n <>\n {destinations.map((destination) => (\n <DropdownMenuItem\n key={destination.id}\n disabled={locked}\n onClick={() => actions.moveNodeTo(nodeId, destination.id, destination.size)}\n >\n {/* A bend into the destination: movement, not duplication or nesting. */}\n <CornerDownRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{destination.label}</span>\n </DropdownMenuItem>\n ))}\n </>\n );\n}\n\n/** The per-rule actions, without the trigger: the chip's kebab and a builder\n * row's kebab act on the same rule. `allowGrouping` is the CHROME's answer;\n * \"Convert to advanced filter\" is the CONSUMER's, and hides itself there. */\nexport function FilterRuleMenuItems({\n ruleId,\n /** Offer \"Wrap in condition group\". Off for the chip row, which cannot draw\n * a group; on in the builder, the only way to nest without dragging. */\n allowGrouping = false,\n}: {\n ruleId: string;\n allowGrouping?: boolean;\n}) {\n const actions = useFilterActions();\n // Gated here as well as at the trigger, because this is EXPORTED: a consumer\n // composing their own menu gets rows that say they are unavailable.\n const locked = isFilterLocked(actions);\n return (\n /* Every row leads with an icon. `IconPlaceholder` because the source ships\n under five icon sets; no size class, because each style already sizes an\n unsized svg in a menu row; `aria-hidden`, the label IS the name. */\n <>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(ruleId)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.negateRule(ruleId)}>\n {/* Two arrows swapping: negation flips to the declared inverse. */}\n <ArrowLeftRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.negate}</span>\n </DropdownMenuItem>\n {allowGrouping ? (\n <DropdownMenuItem disabled={locked} onClick={() => actions.wrapNodeInGroup(ruleId)}>\n {/* Layers: braces read as grouping in only three of the five sets. */}\n <LayersIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.wrapInGroup}</span>\n </DropdownMenuItem>\n ) : null}\n {allowGrouping ? <FilterMoveToMenuItems nodeId={ruleId} /> : null}\n {/* OPTIONAL, and gated on both halves of \"would this do anything\": the\n handler is the consumer's opt-in, and an already-advanced bar has\n nothing to convert. NOT gated on `locked`: it changes no query, is\n handed no mutator, and the shipped kebab will not open while locked. */}\n {actions.convertToAdvanced && actions.variant !== \"advanced\" ? (\n <DropdownMenuItem onClick={() => actions.convertToAdvanced?.()}>\n {/* Sliders: the one \"advanced settings\" glyph in all five sets. */}\n <SlidersHorizontalIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.convertToAdvanced}</span>\n </DropdownMenuItem>\n ) : null}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(ruleId)}\n >\n {/* No colour: the destructive variant already paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.remove}</span>\n </DropdownMenuItem>\n </>\n );\n}\n\nexport interface FilterChipProps<V = unknown> {\n rule: FilterRule<V>;\n index: number;\n}\n\n/** One filter, as a chip. Memoization means something here: the actions\n * context is stable, the focus store is subscribed to a boolean and the query\n * shares structure, so editing one filter of forty re-renders one chip. */\nfunction FilterChipImpl<V, O>({ rule, index }: FilterChipProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const focusStore = useFilterFocusStore();\n const focused = useFilterChipFocused(rule.id);\n const noFocus = useFilterFocusEmpty();\n const locked = isFilterLocked(actions);\n // THE CHIP'S HEIGHT, by way of the one button in it that has one:\n // `ButtonGroup` is `items-stretch` and no style gives a text segment a\n // height, so the kebab's rung is the pill's. The RADIUS survives because\n // every style whose `icon-sm` rounds differently re-pins it in a group.\n const sizes = filterControlSizes(actions);\n // The kebab is CONTROLLED so it can refuse to open: every mutating row\n // behind it is gated. That puts \"Convert to advanced filter\" out of reach\n // while locked; a consumer-composed menu still draws it.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Exactly one chip is in the tab order at a time. Before anything has been\n // focused that is the first chip, so Tab reaches the row in one press.\n const isTabStop = focused || (noFocus && index === 0);\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n if (!field) {\n // A rule pointing at a field the schema no longer has. Dropping it loses a\n // saved view's data; rendering nothing leaves an invisible condition still\n // filtering. It carries the SAME roving wiring as a real chip: `data-slot`\n // alone joined the arrow-key query with no `tabIndex` to land on.\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n data-unknown=\"\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(rule.path.join(actions.labels.pathSeparator))}\n data-focused={focused || undefined}\n data-rule-id={rule.id}\n data-index={index}\n tabIndex={isTabStop ? 0 : -1}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n >\n <ButtonGroupText className=\"bg-background text-muted-foreground dark:bg-input/30\">\n {rule.path.join(actions.labels.pathSeparator)}\n </ButtonGroupText>\n <Button\n variant=\"outline\"\n size={sizes.icon}\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.remove}\n /* It had no gate at all, so the one chip whose whole purpose is to be\n removed could be removed from a bar that refuses every other edit. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </ButtonGroup>\n );\n }\n\n if (render.renderChip) return <>{render.renderChip(rule)}</>;\n\n const focusSegment = (segment: ChipSegment) =>\n focusStore.set({ id: rule.id, segment, autoOpen: false });\n\n // A rule with no condition yet, KEPT rather than removed (see\n // `isFilterRuleComplete`), so it has to read as unfinished. Through WORDS:\n // the dashed outline it replaces degraded to an underline under sera.\n const incomplete = !rule.operator;\n\n // The same test the value segment renders under, so the name matches the\n // chip: `valueText` alone appended a placeholder to valueless conditions.\n const hasValue = Boolean(rule.operator) && operatorTakesValue(operator);\n\n // The value's spoken form in the chip's NAME: a name is not a prompt, so\n // \"Description contains enter text...\" becomes \"no value\".\n const valueName = valueEmpty && !field.valueText ? actions.labels.noValue : valueText;\n\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(\n `${pathText} ${operatorLabel}${hasValue ? ` ${valueName}` : \"\"}`.trim() +\n (incomplete ? `, ${actions.labels.incomplete}` : \"\"),\n )}\n data-focused={focused || undefined}\n data-incomplete={incomplete || undefined}\n data-rule-id={rule.id}\n tabIndex={isTabStop ? 0 : -1}\n className={cn(\n /* Sera is an underline style, so the boxed segments are normalised to\n its bottom-border-only look or the chip reads as a mix of both. */\n \"\",\n )}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n data-index={index}\n >\n {/* DISPLAY ONLY: a div, not a button, not a tab stop, no popover. The\n attribute is fixed for the life of the chip. */}\n <ButtonGroupText\n /* Dropped while the path is collapsed: the ellipsis inside carries the\n same sentence as a tooltip, and the two would stack. */\n title={pathCollapsed ? undefined : pathText}\n className=\"cursor-default gap-1.5 bg-background dark:bg-input/30\"\n >\n {field.icon}\n {/* Zero gap INSIDE the path, so the separator's own margin is the only\n air around a chevron; `gap-1.5` used to stack 6px a side on it. */}\n <span className=\"flex items-center\">{pathLabel}</span>\n </ButtonGroupText>\n\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n /* The operator is connective tissue between the field and the\n value, so it reads quieter than either - unless it is still\n the prompt \"Select condition\", the one thing to act on. */\n incomplete ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"operator\")}\n >\n {operatorLabel}\n </ButtonGroupText>\n }\n />\n\n {/* No condition, no value: `getFilterArity(undefined)` defaults to \"one\",\n so testing the operator alone renders a stray value segment. */}\n {hasValue ? (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n /* Named explicitly rather than by its contents: avatars or a\n \"+2\" badge, and \"plus two\" says nothing about two people. It\n grows to the whole list when the editor cannot be opened,\n since locked it must carry what a press no longer reveals. */\n aria-label={locked ? valueFullText : valueText}\n /* The pointer's route to the same thing, and only when there is\n more to say than the segment already says. */\n title={valueFullText === valueText ? undefined : valueFullText}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n valueEmpty && \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"value\")}\n >\n {valueLabel}\n </ButtonGroupText>\n }\n />\n ) : null}\n\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.icon}\n /* The same surface the three text segments force. Styles whose\n outline button is transparent in dark (sera, luma, rhea) left\n the kebab as a notch in an otherwise filled pill. */\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.chipMenu(field.label)}\n onPointerDown={() => focusSegment(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n {/* The SAME sizing the builder's menus use, from one constant: a menu\n that cuts \"Convert to group\" in one chrome is one defect twice. */}\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <FilterRuleMenuItems ruleId={rule.id} />\n </DropdownMenuContent>\n </DropdownMenu>\n </ButtonGroup>\n );\n}\n\nexport const FilterChip = React.memo(FilterChipImpl) as typeof FilterChipImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,MAAM,yBAAyD,CAAC;AAEhE,SAAS,oBACP,OACA,UACA,eACA,QAEA,kBAGA,cACQ;CACR,MAAM,aAAa,eACf,OAAO,oBACN,oBAAoB,OAAO;CAChC,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IACrD,OAAO;CAGT,IAAI,eAAe,QAAQ,MAAM,WAAW,MAAM,QAAQ,KAAK,GAAG;EAChE,MAAM,CAAC,MAAM,MAAM;EACnB,OAAO,OAAO,WAAW,OAAO,QAAQ,EAAE,GAAG,OAAO,MAAM,EAAE,CAAC;CAC/D;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,SAAS;EACf,IAAI,OAAO,WAAW,GAAG,OAAO;EAChC,IAAI,OAAO,WAAW,GACpB,OAAO,cAAc,OAAO,EAAE,CAAC,EAAE,SAAS,OAAO,OAAO,EAAE;EAE5D,OAAO,OAAO,WAAW,OAAO,MAAM;CACxC;CAEA,IAAI,OAAO,UAAU,WAAW,OAAO,QAAQ,SAAS;CAExD,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC,EAAE,SAAS,OAAO,KAAK;AAC5D;;;;AAKA,SAAS,cACP,OACA,MACA,eACiB;CACjB,MAAM,SACJ,UAAU,KAAA,KAAa,UAAU,QAAQ,MAAM,QAAQ,KAAK,IACxD,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,IACvC,OAAO,MAAM,EAAE,IACf,OACF,OAAO,KAAK;CAClB,MAAM,OAAO,SAAS,cAAc,MAAM,CAAC,EAAE,OAAO;CACpD,IAAI,CAAC,MAAM,OAAO;CAClB,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ip.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n ArrowLeftRightIcon,\n ChevronRightIcon,\n CopyIcon,\n CornerDownRightIcon,\n EllipsisVerticalIcon,\n LayersIcon,\n SlidersHorizontalIcon,\n Trash2Icon,\n XIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n} from \"./filters-context\";\nimport { FilterMenu, useFilterOptions, useFilterValueResolution } from \"./filters-editors\";\nimport {\n collapseFilterPath,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n formatFilterPath,\n getFilterField,\n getFilterFieldChain,\n} from \"./filters-lib\";\nimport {\n coerceFilterValue,\n getFilterArity,\n getFilterOperator,\n operatorTakesValue,\n visibleFilterOperators,\n} from \"./filters-operators\";\nimport { findFilterNode, isFilterGroup } from \"./filters-query\";\nimport type {\n FilterEditorProps,\n FilterField,\n FilterGroupNode,\n FilterOperator,\n FilterRule,\n} from \"./filters-types\";\n\n/** Which part of the chip a pointer or key is aimed at. No `field`: the chip's\n * attribute segment is display only, and only the builder re-picks one. */\ntype ChipSegment = \"operator\" | \"value\" | \"menu\";\n\n/** The ref half of `autoFocusProps`: a CALLBACK ref, the one shape an editor\n * can spread onto any element without a cast, and a no-op here. */\nconst noopAutoFocusRef: React.RefCallback<HTMLElement> = () => {};\n\nfunction defaultValueDisplay<V>(\n value: V | undefined,\n operator: FilterOperator | undefined,\n resolveOption: (value: string) => { label: string } | undefined,\n labels: ReturnType<typeof useFilterActions>[\"labels\"],\n // The field's own word for \"no value yet\", which a generic label cannot beat.\n fieldPlaceholder?: string,\n /** Whether the value is PICKED rather than typed: a select's search prompt\n * and \"enter text...\" both give way to `labels.selectPlaceholder`. */\n optionBacked?: boolean,\n): string {\n const emptyLabel = optionBacked\n ? labels.selectPlaceholder\n : (fieldPlaceholder ?? labels.valuePlaceholder);\n if (value === undefined || value === null || value === \"\") {\n return emptyLabel;\n }\n\n if (getFilterArity(operator) === \"range\" && Array.isArray(value)) {\n const [from, to] = value as unknown[];\n return labels.valueRange(String(from ?? \"\"), String(to ?? \"\"));\n }\n\n if (Array.isArray(value)) {\n const values = value as string[];\n if (values.length === 0) return emptyLabel;\n if (values.length === 1) {\n return resolveOption(values[0])?.label ?? String(values[0]);\n }\n return labels.valueCount(values.length);\n }\n\n if (typeof value === \"boolean\") return value ? \"True\" : \"False\";\n\n return resolveOption(String(value))?.label ?? String(value);\n}\n\n/** The same display with the option's own icon in front. A status filter reads\n * as its colour before its word, so dropping the swatch the picker showed\n * makes the chip harder to scan than the list it came from. */\nfunction valueWithIcon<V>(\n value: V | undefined,\n text: string,\n resolveOption: (value: string) => { icon?: React.ReactNode } | undefined,\n): React.ReactNode {\n const single =\n value === undefined || value === null || Array.isArray(value)\n ? Array.isArray(value) && value.length === 1\n ? String(value[0])\n : null\n : String(value);\n const icon = single ? resolveOption(single)?.icon : null;\n if (!icon) return text;\n return (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {text}\n </span>\n );\n}\n\n/** The glyph between two ancestors in a nested attribute path, a chevron\n * because the `pathSeparator` string read as loud as the names it parts.\n * DECORATIVE: `aria-hidden`, and the plain string is still what\n * `formatFilterPath` joins for the chip's accessible name and `title`. */\nfunction FilterPathSeparator() {\n return (\n <ChevronRightIcon\n aria-hidden=\"true\"\n data-slot=\"filter-path-separator\"\n className=\"mx-[3px] inline-block size-3 shrink-0 self-center align-[calc(0.3635em-0.375rem)] text-muted-foreground\"\n />\n );\n}\n\n/** The elided run of a collapsed path, with the FULL path behind it. THE\n * TOOLTIP IS NOT THE ACCESSIBLE ROUTE: it is hover and focus, so the segment\n * is `aria-hidden` and the whole path stays in the control's NAME. The host's\n * own `title` is dropped while collapsed (`pathCollapsed`) or both fire. */\nfunction FilterPathEllipsis({ full }: { full: string }) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n aria-hidden=\"true\"\n data-slot=\"filter-path-ellipsis\"\n /* A path SEGMENT with no air of its own: the chevron's margin\n is all that parts a name from the next, and this used to STACK\n an `mx` on it. Plain inline, no `vertical-align`: `middle` sat\n the dots 1.7px low and inline-block grew the run to 21.17px. */\n className=\"shrink-0 self-center text-muted-foreground\"\n >\n ...\n </span>\n }\n />\n <TooltipContent>{full}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** Everything a rule needs in order to be READ, in either chrome. */\nexport interface FilterRuleDisplay {\n pathText: string;\n pathLabel: React.ReactNode;\n /** Whether `pathLabel` shows fewer names than the path has, so the cell's\n * own `title` can step aside for the ellipsis segment's tooltip. */\n pathCollapsed: boolean;\n operatorLabel: string;\n valueLabel: React.ReactNode;\n /** The same value as PLAIN TEXT, for an accessible name. Never scraped from\n * the `renderValue` node: whatever text survives inside avatars and a count\n * badge announces \"plus one\" for two people. Kept separate from\n * `valueLabel`, not derived from it: a React node has no honest text to\n * read back. A field whose values do not stringify supplies `valueText`\n * itself, or the built-in fallback says \"[object Object]\" to exactly the\n * audience the visible display is hiding it from. */\n valueText: string;\n /** The same value with any collapsed COUNT spelled out. \"3 selected\" cannot\n * be recovered from, which is fine while the editor opens and not once\n * locked, so the control carries this as `title` and, locked, as its name. */\n valueFullText: string;\n valueEmpty: boolean;\n}\n\n/** How one rule reads, resolved once and shared by both chromes, so a consumer\n * `renderValue`, the field's own and the built-in cannot disagree. */\nexport function useFilterRuleDisplay<V, O>(\n rule: FilterRule<V>,\n field: FilterField<V, O> | undefined,\n operator: FilterOperator | undefined,\n): FilterRuleDisplay {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n // Lazily: a label needs no options until an editor actually opens.\n const optionsState = useFilterOptions<V, O>(field, false);\n\n const values =\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value];\n\n // Saved views: values the loader has never returned are resolved through the\n // field's own `resolveValues`, so a restored chip reads \"John Doe\", not an id.\n useFilterValueResolution(field, values);\n\n const pathText = formatFilterPath(actions.index, rule.path, actions.labels.pathSeparator);\n\n const chain = getFilterFieldChain(actions.index, rule.path);\n // The CASCADER's collapser, from the actions context rather than per host, so\n // a deep path reads the same on a chip and in a builder row.\n const segments = collapseFilterPath(chain, {\n maxSegments: actions.maxPathSegments,\n collapse: actions.pathCollapse,\n });\n const pathCollapsed = segments.some((segment) => segment.type === \"ellipsis\");\n const pathLabel = chain.length\n ? segments.map((segment, index) => (\n <React.Fragment\n /* Positional, because a field id is unique among its SIBLINGS only:\n\"Company > Team > Company\" is a legal path and its two ids collide. */\n key={segment.type === \"field\" ? `${index}:${segment.field.id}` : `${index}:ellipsis`}\n >\n {index > 0 ? <FilterPathSeparator /> : null}\n {segment.type === \"field\" ? (\n <span>{segment.field.label}</span>\n ) : (\n <FilterPathEllipsis full={pathText} />\n )}\n </React.Fragment>\n ))\n : pathText;\n\n const operatorLabel = operator\n ? rule.negated\n ? actions.labels.negated(operator.label)\n : operator.label\n : rule.operator || actions.labels.selectCondition;\n\n const valueEmpty =\n rule.value === undefined ||\n rule.value === null ||\n rule.value === (\"\" as unknown as V) ||\n values.length === 0;\n\n if (!field) {\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel: \"\",\n valueText: \"\",\n valueFullText: \"\",\n valueEmpty,\n };\n }\n\n const valueContext = {\n value: rule.value,\n values,\n field,\n operator: operator ?? { value: rule.operator, label: rule.operator },\n // Resolved, not empty: a custom display needs the option behind each value.\n options: values\n .map((entry) => optionsState.resolve(String(entry)))\n .filter(Boolean) as NonNullable<ReturnType<typeof optionsState.resolve>>[],\n labels: actions.labels,\n };\n\n // Computed even when a custom display replaces it: this is the string the\n // accessible name is built from. `field.valueText` overrides it.\n const valueText = field.valueText\n ? field.valueText(valueContext)\n : defaultValueDisplay(\n rule.value,\n operator,\n optionsState.resolve,\n actions.labels,\n field.placeholder,\n // Option-backed by the FIELD, not the operator: `is any of` is\n // multi-value on a plain text field too, and that one is typed into.\n field.type === \"select\" ||\n field.type === \"multiselect\" ||\n Boolean(field.options?.length) ||\n Boolean(field.loadOptions),\n );\n\n const valueLabel = render.renderValue\n ? render.renderValue(valueContext)\n : field.renderValue\n ? field.renderValue(valueContext)\n : valueWithIcon(rule.value, valueText, optionsState.resolve);\n\n // The list behind the count, or the same text again. Multi-value only: a\n // RANGE also stores an array but already spells both ends out (\"10 to 99\").\n const valueFullText =\n field.valueText ||\n !Array.isArray(rule.value) ||\n getFilterArity(operator) === \"range\" ||\n values.length < 2\n ? valueText\n : actions.labels.valueDetail(\n valueText,\n values.map((entry) => optionsState.resolve(String(entry))?.label ?? String(entry)),\n );\n\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n };\n}\n\ninterface FilterValueEditorProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator;\n /** Whether the surface holding it is showing. Gates the option service. */\n open: boolean;\n onClose: () => void;\n}\n\n/** The value editor - draft, option service, commit - with NO surface of its\n * own, so surface and wiring can be replaced independently. The draft lives\n * here, so a text filter dispatches once on commit, not once per keystroke. */\nfunction FilterValueEditor<V, O>({\n rule,\n field,\n operator,\n open,\n onClose,\n}: FilterValueEditorProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const [draft, setDraft] = React.useState<V | undefined>(rule.value);\n\n React.useEffect(() => {\n if (open) setDraft(rule.value);\n }, [open, rule.value]);\n\n const options = useFilterOptions<V, O>(field, open);\n // A LOOKUP, not a definition: every result is a module-level built-in or the\n // consumer's own component, so the editor is never remounted mid-edit.\n const editor = React.useMemo(\n () => actions.resolveEditor(field, operator),\n [actions, field, operator],\n );\n\n if (!editor) return null;\n\n const editorProps: FilterEditorProps<V, O> = {\n field,\n operator,\n value: draft,\n onValueChange: (next) => setDraft(next as V),\n host: \"amend\",\n autoFocusProps: {\n ref: noopAutoFocusRef,\n autoFocus: true,\n },\n commit: (next, commitOptions) => {\n actions.updateRule(rule.id, {\n value: (next === undefined ? draft : next) as V,\n });\n // A multi-select commits per toggle and asks to stay put; others dismiss.\n if (commitOptions?.close === false) return;\n onClose();\n },\n cancel: onClose,\n // The same as cancel, honestly: `back` means something only to a `create`\n // host.\n back: onClose,\n options,\n labels: actions.labels,\n };\n\n // `createElement` rather than JSX: the component comes out of a lookup, so\n // `<Editor />` trips `react-hooks/static-components`. The fragment keeps the\n // props object, which carries a ref, from looking like a ref read in render.\n return <>{React.createElement(editor, editorProps)}</>;\n}\n\n/** One step of the flow, released when the panel that owes it has LEFT THE\n * DOM: both popovers keep portal content mounted through the exit transition,\n * so this unmount IS that moment and nothing is timed. `onRelease` is used AS\n * the cleanup, so an unmemoized callback fires its step early. */\nfunction FilterStepHandoff({ onRelease }: { onRelease: () => void }) {\n React.useEffect(() => onRelease, [onRelease]);\n return null;\n}\n\n/** The value host: the editor in a popover anchored to the value segment, and\n * BOTH routes end here. The operator popover used to draw the editor itself,\n * so a handed-off panel sat a segment's width left of a second press. */\nexport interface FilterValuePopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator | undefined;\n /** The element that opens it, WITH its own children: a chip segment must be\n * a direct child of its `ButtonGroup` for the pill to fuse. */\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterValuePopover<V, O>({\n rule,\n field,\n operator,\n trigger,\n className,\n}: FilterValuePopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n\n // The last step of the flow as well as the amend route; by now the condition\n // menu has UNMOUNTED (see `FilterStepHandoff`). CONSUMED as it is honoured,\n // or Escape closes the editor and this effect reopens it in the same frame.\n // The `set` stays OUTSIDE the `locked` guard on purpose: a handoff nobody\n // spends sits armed until some later chip spends it, and a chip that opened\n // because a DIFFERENT chip was arrowed onto is worse than one that opened\n // nothing.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n // Nothing to open, but the trigger still renders so the value keeps its\n // place, and it wears the bar's state: that hangs on the TRIGGER below,\n // which this path never reaches, so the segment used to look live.\n if (!operator || !actions.resolveEditor(field, operator)) {\n return React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n disabled: actions.disabled,\n ...filterReadOnlyProps(actions),\n });\n }\n\n return (\n // REFUSES to open while locked rather than leaving it to the trigger: an\n // `aria-disabled` control that still opens an editor is one that lied.\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n {/* The trigger IS the segment, never a wrapper. `ButtonGroup` fuses\n DIRECT children only (`*:data-slot:rounded-r-none`,\n `[&>[data-slot]~[data-slot]]:border-l-0`), so a nested one keeps its\n own border and the chip reads as separate badges. */}\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent align=\"start\" className={cn(\"w-auto p-0\", className)}>\n <FilterValueEditor<V, O>\n rule={rule}\n field={field}\n operator={operator}\n open={open}\n onClose={() => {\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/* A chip's ATTRIBUTE is fixed once the chip exists: no field popover here. A\n new field invalidates the operator and the value, so \"amending\" threw both\n away. The builder keeps its picker, where a row reads as a form. */\n\n/** The condition menu, and the step after it. The list is the cascader run\n * flat: the old hand-rolled one marked the keyboard HIGHLIGHT with\n * `aria-selected` and had no Home, End or typeahead. It HANDS OFF to the\n * value popover once its own panel has left the DOM; advancing in place\n * anchored the editor to the CONDITION segment and doubled up in the row. */\nexport interface FilterOperatorPopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterOperatorPopover<V, O>({\n rule,\n field,\n trigger,\n className,\n}: FilterOperatorPopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"operator\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n /** Whether the close this panel is going through IS the step being handed\n * on. A ref, so it survives the render that closes the popover. Every OPEN\n * clears it, so an Escape or an outside press finds it already lowered and\n * spends nothing; `release` leaves it standing because one twin asks again\n * later: Radix reads it from `onCloseAutoFocus`, a macrotask after the\n * unmount. Clearing it in `release` would break that twin only. */\n const handoff = React.useRef(false);\n const operators = actions.resolveOperators(field);\n\n // Memoized because the array IS the menu's identity: the cascader rebuilds\n // its index per `items` identity, so a fresh array rebuilds it per keystroke.\n const items = React.useMemo(\n () =>\n visibleFilterOperators(operators).map((entry) => ({\n value: entry.value,\n label: entry.label,\n })),\n [operators],\n );\n\n // Opened by the root the moment the chip is created. CONSUMED here, or the\n // handoff re-opens the menu on the frame Escape closes it. Consumed even\n // while locked, for the reason on the value popover's copy.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n handoff.current = false;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n const close = () => {\n handoff.current = false;\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n };\n\n /** The parked step, spent on the frame this panel stops existing. Memoized\n * on nothing that changes, and load bearing: `FilterStepHandoff` uses this\n * AS its cleanup, so a new identity mid-flow fires the step too early. */\n const release = React.useCallback(() => {\n if (!handoff.current) return;\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: true });\n }, [focusStore, rule.id]);\n\n // The chip going away takes its step with it: React destroys a deleted\n // subtree top down, so this runs before the panel's own cleanup.\n React.useEffect(\n () => () => {\n handoff.current = false;\n },\n [],\n );\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n /* Escape, an outside press, a second press: none is the step being\n taken, so none may spend it. RETIRED ON OPEN, not on close, and that\n is a twin difference: in Radix an item choice dismisses through here\n too, so retiring on close wiped the request before the unmount. */\n if (next) handoff.current = false;\n setOpen(next);\n }}\n >\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent\n align=\"start\"\n /* Base UI restores focus to the trigger as this panel closes, which\n lands on the condition segment AFTER the value editor has opened and\n focused its input, so a keyboard user is dropped back a step and\n cannot reach the value at all. Suppressed only while the handoff is\n up; a function because Base UI resolves it at close time, which is\n when the ref is accurate. Radix runs the same guard through\n `onCloseAutoFocus`. */\n finalFocus={() => !handoff.current}\n /* `w-auto` with a FLOOR: a catalog sizes to its longest label, and a\n boolean field's \"is\" and \"is not\" would read as a scrap of paper. */\n className={cn(\"w-auto min-w-40 p-0\", className)}\n >\n {/* INSIDE the panel deliberately: only a child of the content is\n unmounted by the exit transition rather than by the close. */}\n <FilterStepHandoff onRelease={release} />\n <FilterMenu\n items={items}\n selected={rule.operator ? [rule.operator] : []}\n onSelectionChange={(values) => {\n const value = values[0];\n /* Deselecting the committed operator is a step back rather than a\n choice, so pressing the current row simply closes. */\n if (value === undefined) {\n close();\n return;\n }\n const chosen = getFilterOperator(operators, value);\n /* BUILDING versus AMENDING, the same fork the advanced row draws\n at its field step. A rule reaches this menu with no operator\n exactly once, while it is being added, and only then is the\n value the step after this one. Re-picking the condition on a\n rule that already has one is an edit of that one cell: it\n commits and closes, and the user opens the value themselves. */\n const building = !rule.operator;\n actions.updateRule(rule.id, {\n operator: value,\n /* The value moves with the operator: \"is\" to \"is any of\" would\n leave a bare string where every reader expects an array. */\n value: coerceFilterValue(\n rule.value,\n getFilterOperator(operators, rule.operator),\n chosen,\n ) as V,\n });\n if (building && operatorTakesValue(chosen)) {\n /* PARKED, not opened: `release` hands the row to its value\n surface once this panel has unmounted. */\n handoff.current = true;\n setOpen(false);\n return;\n }\n close();\n }}\n labels={actions.labels}\n ariaLabel={field.label}\n searchPlaceholder={actions.labels.searchOperators}\n /* No visible search field: a CLOSED enum of six to ten labels, all\n on screen. Still RENDERED, visually hidden, because it owns focus\n and `aria-activedescendant`: arrows, Home, End and typeahead. */\n searchable={false}\n /* Taller than a value list on purpose: the operator set is CLOSED, so\n all of it fits and the height buys the whole catalog. A value list\n is open ended and would only push its own footer off the screen. */\n maxHeight={320}\n /* Deliberately unpinned: one selected operator in a short list, so\nlifting it would lose the catalog's declared reading order. */\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The keyboard path to a CROSS-GROUP move: Alt+Arrow reorders within the\n * owning group only and Wrap creates a NEW group, so the drag layer's\n * cross-group move had no keyboard parity. Numbered in document order. */\nexport function FilterMoveToMenuItems({ nodeId }: { nodeId: string }) {\n const actions = useFilterActions();\n // A menu ITEM takes the native word: both twins already make `disabled`\n // roving-focusable and `aria-disabled`.\n const reorderable = useFilterReorderable();\n const locked = isFilterLocked(actions);\n // Read at render time: the menu's content mounts when the menu opens, so\n // this is the tree the user is looking at.\n const query = actions.getQuery();\n const found = findFilterNode(query, nodeId);\n if (!found?.parent) return null;\n\n const destinations: { id: string; label: string; size: number }[] = [];\n if (found.parent.id !== query.id) {\n destinations.push({\n id: query.id,\n label: actions.labels.moveToTopLevel,\n size: query.rules.length,\n });\n }\n\n let position = 0;\n // `inside` suppresses the PUSH and not the walk, so the numbering stays\n // document order rather than renumbering every group after this one. Counted\n // before the exclusions for the same reason: the current parent is not\n // offered but still holds its number, so the numbering is stable whichever\n // row's menu is open.\n const visit = (group: FilterGroupNode<unknown>, inside: boolean) => {\n for (const child of group.rules) {\n if (!isFilterGroup(child)) continue;\n position += 1;\n // Itself and everything under it: `moveFilterNodeTo` already refuses that\n // move - it would detach the subtree and leave a cycle - so offering it\n // would be a menu row that quietly does nothing.\n const within = inside || child.id === nodeId;\n if (!within && child.id !== found.parent!.id) {\n destinations.push({\n id: child.id,\n label: actions.labels.moveToGroup(position),\n size: child.rules.length,\n });\n }\n visit(child, within);\n }\n };\n visit(query, false);\n\n if (destinations.length === 0) return null;\n\n // The THIRD route into a move, gated on the same switch as the grip and\n // Alt+Arrow: ungated, a builder that draws no handle still reordered here.\n if (!reorderable) return null;\n\n return (\n <>\n {destinations.map((destination) => (\n <DropdownMenuItem\n key={destination.id}\n disabled={locked}\n onClick={() => actions.moveNodeTo(nodeId, destination.id, destination.size)}\n >\n {/* A bend into the destination: movement, not duplication or nesting. */}\n <CornerDownRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{destination.label}</span>\n </DropdownMenuItem>\n ))}\n </>\n );\n}\n\n/** The per-rule actions, without the trigger: the chip's kebab and a builder\n * row's kebab act on the same rule. `allowGrouping` is the CHROME's answer;\n * \"Convert to advanced filter\" is the CONSUMER's, and hides itself there. */\nexport function FilterRuleMenuItems({\n ruleId,\n /** Offer \"Wrap in condition group\". Off for the chip row, which cannot draw\n * a group; on in the builder, the only way to nest without dragging. */\n allowGrouping = false,\n}: {\n ruleId: string;\n allowGrouping?: boolean;\n}) {\n const actions = useFilterActions();\n // Gated here as well as at the trigger, because this is EXPORTED: a consumer\n // composing their own menu gets rows that say they are unavailable.\n const locked = isFilterLocked(actions);\n return (\n /* Every row leads with an icon. `IconPlaceholder` because the source ships\n under five icon sets; no size class, because each style already sizes an\n unsized svg in a menu row; `aria-hidden`, the label IS the name. */\n <>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(ruleId)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.negateRule(ruleId)}>\n {/* Two arrows swapping: negation flips to the declared inverse. */}\n <ArrowLeftRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.negate}</span>\n </DropdownMenuItem>\n {allowGrouping ? (\n <DropdownMenuItem disabled={locked} onClick={() => actions.wrapNodeInGroup(ruleId)}>\n {/* Layers: braces read as grouping in only three of the five sets. */}\n <LayersIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.wrapInGroup}</span>\n </DropdownMenuItem>\n ) : null}\n {allowGrouping ? <FilterMoveToMenuItems nodeId={ruleId} /> : null}\n {/* OPTIONAL, and gated on both halves of \"would this do anything\": the\n handler is the consumer's opt-in, and an already-advanced bar has\n nothing to convert. NOT gated on `locked`: it changes no query, is\n handed no mutator, and the shipped kebab will not open while locked. */}\n {actions.convertToAdvanced && actions.variant !== \"advanced\" ? (\n <DropdownMenuItem onClick={() => actions.convertToAdvanced?.()}>\n {/* Sliders: the one \"advanced settings\" glyph in all five sets. */}\n <SlidersHorizontalIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.convertToAdvanced}</span>\n </DropdownMenuItem>\n ) : null}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(ruleId)}\n >\n {/* No colour: the destructive variant already paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.remove}</span>\n </DropdownMenuItem>\n </>\n );\n}\n\nexport interface FilterChipProps<V = unknown> {\n rule: FilterRule<V>;\n index: number;\n}\n\n/** One filter, as a chip. Memoization means something here: the actions\n * context is stable, the focus store is subscribed to a boolean and the query\n * shares structure, so editing one filter of forty re-renders one chip. */\nfunction FilterChipImpl<V, O>({ rule, index }: FilterChipProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const focusStore = useFilterFocusStore();\n const focused = useFilterChipFocused(rule.id);\n const noFocus = useFilterFocusEmpty();\n const locked = isFilterLocked(actions);\n // THE CHIP'S HEIGHT, by way of the one button in it that has one:\n // `ButtonGroup` is `items-stretch` and no style gives a text segment a\n // height, so the kebab's rung is the pill's. The RADIUS survives because\n // every style whose `icon-sm` rounds differently re-pins it in a group.\n const sizes = filterControlSizes(actions);\n // The kebab is CONTROLLED so it can refuse to open: every mutating row\n // behind it is gated. That puts \"Convert to advanced filter\" out of reach\n // while locked; a consumer-composed menu still draws it.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Exactly one chip is in the tab order at a time. Before anything has been\n // focused that is the first chip, so Tab reaches the row in one press.\n const isTabStop = focused || (noFocus && index === 0);\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n if (!field) {\n // A rule pointing at a field the schema no longer has. Dropping it loses a\n // saved view's data; rendering nothing leaves an invisible condition still\n // filtering. It carries the SAME roving wiring as a real chip: `data-slot`\n // alone joined the arrow-key query with no `tabIndex` to land on.\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n data-unknown=\"\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(rule.path.join(actions.labels.pathSeparator))}\n data-focused={focused || undefined}\n data-rule-id={rule.id}\n data-index={index}\n tabIndex={isTabStop ? 0 : -1}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n >\n <ButtonGroupText className=\"bg-background text-muted-foreground dark:bg-input/30\">\n {rule.path.join(actions.labels.pathSeparator)}\n </ButtonGroupText>\n <Button\n variant=\"outline\"\n size={sizes.icon}\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.remove}\n /* It had no gate at all, so the one chip whose whole purpose is to be\n removed could be removed from a bar that refuses every other edit. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </ButtonGroup>\n );\n }\n\n if (render.renderChip) return <>{render.renderChip(rule)}</>;\n\n const focusSegment = (segment: ChipSegment) =>\n focusStore.set({ id: rule.id, segment, autoOpen: false });\n\n // A rule with no condition yet, KEPT rather than removed (see\n // `isFilterRuleComplete`), so it has to read as unfinished. Through WORDS:\n // the dashed outline it replaces degraded to an underline under sera.\n const incomplete = !rule.operator;\n\n // The same test the value segment renders under, so the name matches the\n // chip: `valueText` alone appended a placeholder to valueless conditions.\n const hasValue = Boolean(rule.operator) && operatorTakesValue(operator);\n\n // The value's spoken form in the chip's NAME: a name is not a prompt, so\n // \"Description contains enter text...\" becomes \"no value\".\n const valueName = valueEmpty && !field.valueText ? actions.labels.noValue : valueText;\n\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(\n `${pathText} ${operatorLabel}${hasValue ? ` ${valueName}` : \"\"}`.trim() +\n (incomplete ? `, ${actions.labels.incomplete}` : \"\"),\n )}\n data-focused={focused || undefined}\n data-incomplete={incomplete || undefined}\n data-rule-id={rule.id}\n tabIndex={isTabStop ? 0 : -1}\n className={cn(\n /* Sera is an underline style, so the boxed segments are normalised to\n its bottom-border-only look or the chip reads as a mix of both. */\n \"\",\n )}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n data-index={index}\n >\n {/* DISPLAY ONLY: a div, not a button, not a tab stop, no popover. The\n attribute is fixed for the life of the chip. */}\n <ButtonGroupText\n /* Dropped while the path is collapsed: the ellipsis inside carries the\n same sentence as a tooltip, and the two would stack. */\n title={pathCollapsed ? undefined : pathText}\n className=\"cursor-default gap-1.5 bg-background dark:bg-input/30\"\n >\n {field.icon}\n {/* Zero gap INSIDE the path, so the separator's own margin is the only\n air around a chevron; `gap-1.5` used to stack 6px a side on it. */}\n <span className=\"flex items-center\">{pathLabel}</span>\n </ButtonGroupText>\n\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n /* The operator is connective tissue between the field and the\n value, so it reads quieter than either - unless it is still\n the prompt \"Select condition\", the one thing to act on. */\n incomplete ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"operator\")}\n >\n {operatorLabel}\n </ButtonGroupText>\n }\n />\n\n {/* No condition, no value: `getFilterArity(undefined)` defaults to \"one\",\n so testing the operator alone renders a stray value segment. */}\n {hasValue ? (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n /* Named explicitly rather than by its contents: avatars or a\n \"+2\" badge, and \"plus two\" says nothing about two people. It\n grows to the whole list when the editor cannot be opened,\n since locked it must carry what a press no longer reveals. */\n aria-label={locked ? valueFullText : valueText}\n /* The pointer's route to the same thing, and only when there is\n more to say than the segment already says. */\n title={valueFullText === valueText ? undefined : valueFullText}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n valueEmpty && \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"value\")}\n >\n {valueLabel}\n </ButtonGroupText>\n }\n />\n ) : null}\n\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.icon}\n /* The same surface the three text segments force. Styles whose\n outline button is transparent in dark (sera, luma, rhea) left\n the kebab as a notch in an otherwise filled pill. */\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.chipMenu(field.label)}\n onPointerDown={() => focusSegment(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n {/* The SAME sizing the builder's menus use, from one constant: a menu\n that cuts \"Convert to group\" in one chrome is one defect twice. */}\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <FilterRuleMenuItems ruleId={rule.id} />\n </DropdownMenuContent>\n </DropdownMenu>\n </ButtonGroup>\n );\n}\n\nexport const FilterChip = React.memo(FilterChipImpl) as typeof FilterChipImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,MAAM,yBAAyD,CAAC;AAEhE,SAAS,oBACP,OACA,UACA,eACA,QAEA,kBAGA,cACQ;CACR,MAAM,aAAa,eACf,OAAO,oBACN,oBAAoB,OAAO;CAChC,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IACrD,OAAO;CAGT,IAAI,eAAe,QAAQ,MAAM,WAAW,MAAM,QAAQ,KAAK,GAAG;EAChE,MAAM,CAAC,MAAM,MAAM;EACnB,OAAO,OAAO,WAAW,OAAO,QAAQ,EAAE,GAAG,OAAO,MAAM,EAAE,CAAC;CAC/D;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,SAAS;EACf,IAAI,OAAO,WAAW,GAAG,OAAO;EAChC,IAAI,OAAO,WAAW,GACpB,OAAO,cAAc,OAAO,EAAE,CAAC,EAAE,SAAS,OAAO,OAAO,EAAE;EAE5D,OAAO,OAAO,WAAW,OAAO,MAAM;CACxC;CAEA,IAAI,OAAO,UAAU,WAAW,OAAO,QAAQ,SAAS;CAExD,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,OAAO,SAAS,MAAM,KAAK;MAC/C,qBAAqB,aAAa,MAAM;KACzC,CAAA;KAGH,UAAA,oBAAC,sBAAD,CAAuB,CAAA;IACJ,CAAA,GAGrB,oBAAC,qBAAD;KAAqB,OAAM;KAAM,WAAW,GAAG,mBAAmB,QAAQ,aAAa;KACrF,UAAA,oBAAC,qBAAD,EAAqB,QAAQ,KAAK,GAAK,CAAA;IACpB,CAAA,CACT;;EACH;;AAEjB;AAEA,MAAa,aAAaA,QAAM,KAAK,cAAc"}
|
|
@@ -10,7 +10,7 @@ import { Cascader, CascaderEmpty, CascaderList, CascaderPanel, CascaderStatus }
|
|
|
10
10
|
import { FilterActionsContext, filterControlSizes } from "./filters-context.js";
|
|
11
11
|
import { applyFilterExclusiveSelection, filterFilterOptions, joinFilterPath, normalizeFilterQuery, warnFilterOnce } from "./filters-lib.js";
|
|
12
12
|
import * as React$1 from "react";
|
|
13
|
-
import { cn } from "
|
|
13
|
+
import { cn } from "@kumix/utils";
|
|
14
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { CheckIcon, XIcon } from "lucide-react";
|
|
16
16
|
//#region src/components/reui/filters/filters-editors.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters-editors.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-editors.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"cn\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup } from \"../../ui/button-group\";\nimport { Input } from \"../../ui/input\";\nimport type { CascaderItemState, CascaderProps } from \"../cascader/cascader\";\nimport {\n Cascader,\n CascaderEmpty,\n CascaderList,\n CascaderPanel,\n CascaderStatus,\n} from \"../cascader/cascader\";\nimport { useCascaderActions, useCascaderHighlight } from \"../cascader/cascader-context\";\nimport { CascaderFooter } from \"../cascader/cascader-footer\";\nimport { CascaderItems } from \"../cascader/cascader-item\";\nimport { CascaderInput, CascaderNav } from \"../cascader/cascader-nav\";\nimport type { CascaderActionItem, CascaderNode } from \"../cascader/cascader-types\";\nimport {\n FilterActionsContext,\n type FilterResolutionStore,\n filterControlSizes,\n} from \"./filters-context\";\nimport {\n applyFilterExclusiveSelection,\n filterFilterOptions,\n joinFilterPath,\n normalizeFilterQuery,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport type {\n AnyFilterEditor,\n FilterEditorProps,\n FilterEditorRegistry,\n FilterField,\n FilterIndex,\n FilterLabels,\n FilterLoadResult,\n FilterOperator,\n FilterOption,\n FilterOptionsState,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* The options service */\n/* -------------------------------------------------------------------------- */\n\ninterface OptionsInternalState<O> {\n items: FilterOption<O>[];\n loading: boolean;\n error: boolean;\n hasMore: boolean;\n cursor?: string;\n}\n\nconst IDLE: OptionsInternalState<never> = {\n items: [],\n loading: false,\n error: false,\n hasMore: false,\n};\n\n/** Stable no-op subscription, for a hook running outside a `Filters` root. */\nconst emptySubscribe = () => () => {};\nconst zeroVersion = () => 0;\n\n/**\n * The joined path of a field, from the schema index. Keyed by PATH, not field\n * identity, so labels survive a schema rebuild; an unknown field uses its id.\n */\nfunction filterFieldKey<V, O>(\n field: FilterField<V, O> | undefined,\n index: FilterIndex | undefined,\n): string | null {\n if (!field) return null;\n if (index) {\n for (const entry of index.all) {\n if ((entry.field as unknown) === (field as unknown)) {\n return joinFilterPath(entry.path);\n }\n }\n }\n return `#${field.id}`;\n}\n\n/**\n * The shared option service every option-backed editor receives: debouncing,\n * aborting, cursor paging and value-to-label resolution. A deliberate fork of\n * the cascader's async machinery. Resolution is two-tier: a ref cache written\n * in an EFFECT, plus the root's `FilterResolutionStore`, without which a\n * `loadOptions`-only field showed its raw id once the menu closed.\n */\nexport function useFilterOptions<V, O>(\n field: FilterField<V, O> | undefined,\n enabled: boolean,\n debounceMs = 250,\n): FilterOptionsState<O> {\n const [query, setQueryState] = React.useState(\"\");\n const [state, setState] = React.useState<OptionsInternalState<O>>(\n IDLE as OptionsInternalState<O>,\n );\n\n const cache = React.useRef(new Map<string, FilterOption<O>>());\n const requestId = React.useRef(0);\n const abortRef = React.useRef<AbortController | null>(null);\n\n // Read directly, so this degrades outside a `Filters` root instead of throwing.\n const actionsContext = React.useContext(FilterActionsContext);\n const shared: FilterResolutionStore | null = actionsContext?.resolution ?? null;\n const sharedKey = filterFieldKey(field, actionsContext?.index);\n\n // Re-render when a label lands ANYWHERE under this root, not just here.\n React.useSyncExternalStore(\n shared ? shared.subscribe : emptySubscribe,\n shared ? shared.getVersion : zeroVersion,\n shared ? shared.getVersion : zeroVersion,\n );\n\n const staticOptions = field?.options;\n const loadOptions = field?.loadOptions;\n const isAsync = Boolean(loadOptions);\n\n // Seeded in an effect, not during render, so the render stays pure.\n React.useEffect(() => {\n if (!staticOptions) return;\n for (const option of staticOptions) cache.current.set(option.value, option);\n if (shared && sharedKey) shared.set(sharedKey, staticOptions);\n }, [staticOptions, shared, sharedKey]);\n\n React.useEffect(() => {\n for (const option of state.items) cache.current.set(option.value, option);\n if (shared && sharedKey && state.items.length) {\n shared.set(sharedKey, state.items);\n }\n }, [state.items, shared, sharedKey]);\n\n const run = React.useCallback(\n async (nextQuery: string, cursor: string | undefined, append: boolean) => {\n if (!loadOptions) return;\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n const id = ++requestId.current;\n\n setState((previous) => ({\n ...previous,\n loading: true,\n error: false,\n items: append ? previous.items : [],\n }));\n\n try {\n const result = await loadOptions(nextQuery, {\n signal: controller.signal,\n cursor,\n });\n // A superseded request must not write; the id, not the abort, decides.\n if (id !== requestId.current) return;\n\n const normalized: FilterLoadResult<O> = Array.isArray(result) ? { items: result } : result;\n\n setState((previous) => ({\n items: append ? [...previous.items, ...normalized.items] : normalized.items,\n loading: false,\n error: false,\n hasMore: normalized.hasMore ?? Boolean(normalized.nextCursor),\n cursor: normalized.nextCursor,\n }));\n } catch (error) {\n if (id !== requestId.current) return;\n if ((error as Error)?.name === \"AbortError\") return;\n setState((previous) => ({\n ...previous,\n loading: false,\n error: true,\n hasMore: false,\n }));\n }\n },\n [loadOptions],\n );\n\n React.useEffect(() => {\n if (!enabled || !isAsync) return;\n const timer = setTimeout(() => void run(query, undefined, false), debounceMs);\n return () => clearTimeout(timer);\n }, [enabled, isAsync, query, debounceMs, run]);\n\n React.useEffect(() => {\n return () => abortRef.current?.abort();\n }, []);\n\n const normalizedQuery = normalizeFilterQuery(query);\n\n // Async results are server-filtered; re-filtering hides what the label omits.\n const items = React.useMemo(() => {\n if (isAsync) return state.items;\n return filterFilterOptions(staticOptions ?? [], normalizedQuery);\n }, [isAsync, state.items, staticOptions, normalizedQuery]);\n\n const setQuery = React.useCallback((next: string) => setQueryState(next), []);\n\n const loadMore = React.useCallback(() => {\n if (!state.hasMore || state.loading) return;\n void run(query, state.cursor, true);\n }, [state.hasMore, state.loading, state.cursor, query, run]);\n\n const retry = React.useCallback(() => {\n void run(query, undefined, false);\n }, [query, run]);\n\n const resolve = React.useCallback(\n (value: string) => {\n // The ref cache cannot be the only tier: a ref write triggers no render,\n // so the chip would paint the raw value and never repaint. The shared\n // store holds other instances' pages and re-renders this one on a gain.\n const declared = staticOptions?.find((option) => option.value === value);\n if (declared) return declared;\n const fromShared = shared && sharedKey ? shared.get(sharedKey, value) : undefined;\n if (fromShared) return fromShared as FilterOption<O>;\n return cache.current.get(value);\n },\n [staticOptions, shared, sharedKey],\n );\n\n return {\n items,\n loading: state.loading,\n error: state.error,\n hasMore: state.hasMore,\n query,\n setQuery,\n loadMore,\n retry,\n resolve,\n };\n}\n\n/**\n * Resolves committed values no loaded page covered, through `resolveValues`: a\n * restored saved view holds ids the loader never returned. The claim set marks\n * an omitted id asked, so only a REJECTED resolve lets a later mount retry.\n */\nexport function useFilterValueResolution<V, O>(\n field: FilterField<V, O> | undefined,\n values: readonly unknown[],\n): void {\n const actionsContext = React.useContext(FilterActionsContext);\n const shared: FilterResolutionStore | null = actionsContext?.resolution ?? null;\n const sharedKey = filterFieldKey(field, actionsContext?.index);\n const resolveValues = field?.resolveValues;\n const staticOptions = field?.options;\n // Keyed by CONTENT; NUL cannot occur inside a real stored value.\n const valuesKey = values.map((entry) => String(entry)).join(\"\\u0000\");\n\n React.useEffect(() => {\n if (!resolveValues || !shared || !sharedKey || valuesKey === \"\") return;\n const missing = valuesKey.split(\"\\u0000\").filter((value) => {\n if (staticOptions?.some((option) => option.value === value)) return false;\n return shared.get(sharedKey, value) === undefined;\n });\n const wanted = shared.claim(sharedKey, missing);\n if (wanted.length === 0) return;\n\n // No unmount guard: the store outlives the component.\n void Promise.resolve(resolveValues(wanted)).then(\n (options) => shared.set(sharedKey, options),\n () => shared.release(sharedKey, wanted),\n );\n }, [resolveValues, shared, sharedKey, valuesKey, staticOptions]);\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared chrome */\n/* -------------------------------------------------------------------------- */\n\n/**\n * The panel every editor renders into. A plain flex column, NOT a combobox: an\n * editor inside a Base UI composite would inherit its `aria-activedescendant`\n * and arrow keys, which is hostile to a colour picker or a slider.\n */\nfunction EditorPanel({ children, className }: { children: React.ReactNode; className?: string }) {\n return (\n <div\n data-slot=\"filter-editor\"\n className={cn(\n \"flex w-full flex-col gap-2 p-2\",\n /* The list height cap as a VARIABLE, not the `maxHeight` prop, which\n becomes an inline style no consumer class can beat. 16rem is the\n 256px the menu has always used. */\n \"[--cascader-max-height:16rem]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nfunction EditorFooter({\n onCancel,\n onCommit,\n labels,\n host,\n}: Pick<FilterEditorProps, \"labels\" | \"host\"> & {\n onCancel: () => void;\n onCommit: () => void;\n}) {\n // The ONE ladder, not a hardcoded rung: `size=\"sm\"` here measured 4px short\n // of the bar's own controls at `size=\"default\"` in all eight styles.\n const actions = React.useContext(FilterActionsContext);\n const sizes = filterControlSizes({ size: actions?.size ?? \"default\" });\n\n // The create host advances on commit and has Back; amend must offer discard.\n if (host === \"create\") return null;\n return (\n <div className=\"flex items-center justify-end gap-1.5 pt-1\">\n <Button variant=\"ghost\" size={sizes.button} onClick={onCancel}>\n {labels.discard}\n </Button>\n <Button size={sizes.button} onClick={onCommit}>\n {labels.apply}\n </Button>\n </div>\n );\n}\n\n/**\n * `w-full` because `ButtonGroup` is `w-fit`, which collapses inside this\n * fixed-width panel. Sera is an underline style, so its direct children flatten\n * to one bottom-only edge - `border-b-input`, not transparent, since the\n * buttons are the trailing edge and the rule would stop mid-panel.\n */\nconst EDITOR_FIELD_GROUP = \"w-full\";\n\n/**\n * Confirm and cancel, an OUTLINE pair FUSED onto the field's trailing edge.\n * Returns a FRAGMENT: `ButtonGroup` fuses with selectors matching DIRECT\n * children only, so a wrapper div renders three separate boxes. `size=\"icon\"`\n * because every style's icon button at that size is exactly its input's height.\n */\nfunction EditorCommitButtons({\n onCancel,\n onCommit,\n labels,\n}: Pick<FilterEditorProps, \"labels\"> & {\n onCancel: () => void;\n onCommit: () => void;\n}) {\n return (\n <>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label={labels.apply}\n onClick={onCommit}\n >\n <CheckIcon aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label={labels.discard}\n onClick={onCancel}\n >\n <XIcon aria-hidden=\"true\" />\n </Button>\n </>\n );\n}\n\nfunction useCommitKeys(commit: () => void, cancel: () => void) {\n return React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n commit();\n return;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n // Stop here so a surrounding dialog does not also close.\n event.stopPropagation();\n cancel();\n }\n },\n [commit, cancel],\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Text / number */\n/* -------------------------------------------------------------------------- */\n\nexport function FilterTextEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n return (\n // A width, not shrink-to-fit: the popover is `w-auto`, so an unsized box\n // changes width between the hosts. `w-72` is measured - it holds about 23\n // characters in sera and 27 in nova; `w-64` held about eighteen, too short\n // for an email, and `w-80` was the widest control in a bar of compact\n // chips. Capped at the viewport because `w-80` is 320px and a 360px phone\n // has 40px to spare. A `w-*` on the field wins.\n <EditorPanel className={cn(\"w-72 min-w-0 max-w-[calc(100vw-2rem)]\", field.className)}>\n <ButtonGroup className={EDITOR_FIELD_GROUP}>\n <Input\n {...autoFocusProps}\n value={(value as string) ?? \"\"}\n placeholder={field.placeholder ?? labels.valuePlaceholder}\n aria-label={field.label}\n onChange={(event) => onValueChange(event.target.value as V)}\n onKeyDown={onKeyDown}\n />\n {/*\n A lone input still belongs in the group: the per-style sheets re-round\n the LAST child, so a group with nothing fused draws the bare field.\n */}\n {host === \"create\" ? null : (\n <EditorCommitButtons labels={labels} onCancel={cancel} onCommit={() => commit()} />\n )}\n </ButtonGroup>\n </EditorPanel>\n );\n}\n\nexport function FilterNumberEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n return (\n // Deliberately not the text editor's `w-72`: number values are short by\n // construction, and a wide box around \"42\" is the opposite defect.\n <EditorPanel className={cn(\"w-56 min-w-0\", field.className)}>\n <ButtonGroup className={EDITOR_FIELD_GROUP}>\n <Input\n {...autoFocusProps}\n type=\"number\"\n value={value === undefined || value === null ? \"\" : String(value)}\n placeholder={field.placeholder}\n aria-label={field.label}\n onChange={(event) => {\n const raw = event.target.value;\n onValueChange((raw === \"\" ? undefined : Number(raw)) as V);\n }}\n onKeyDown={onKeyDown}\n />\n {host === \"create\" ? null : (\n <EditorCommitButtons labels={labels} onCancel={cancel} onCommit={() => commit()} />\n )}\n </ButtonGroup>\n </EditorPanel>\n );\n}\n\nexport function FilterRangeEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const tuple = (Array.isArray(value) ? value : []) as unknown[];\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n\n const update = (index: 0 | 1, raw: string) => {\n const next = [tuple[0], tuple[1]];\n next[index] = raw === \"\" ? undefined : Number(raw);\n onValueChange(next as V);\n };\n\n return (\n <EditorPanel>\n <div className=\"flex items-center gap-1.5\">\n <Input\n {...autoFocusProps}\n type=\"number\"\n value={tuple[0] === undefined ? \"\" : String(tuple[0])}\n aria-label={labels.rangeFrom(field.label)}\n onChange={(event) => update(0, event.target.value)}\n onKeyDown={onKeyDown}\n />\n <span className=\"text-muted-foreground text-xs\">{labels.rangeSeparator}</span>\n <Input\n type=\"number\"\n value={tuple[1] === undefined ? \"\" : String(tuple[1])}\n aria-label={labels.rangeTo(field.label)}\n onChange={(event) => update(1, event.target.value)}\n onKeyDown={onKeyDown}\n />\n </div>\n <EditorFooter host={host} labels={labels} onCancel={cancel} onCommit={() => commit()} />\n </EditorPanel>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* The menu */\n/* -------------------------------------------------------------------------- */\n\n/** One row. The shape both the operator menu and the option editors hand over. */\nexport interface FilterListItem {\n value: string;\n label: string;\n icon?: React.ReactNode;\n description?: string;\n keywords?: string[];\n disabled?: boolean;\n /**\n * A None row, from `FilterOption.exclusive`. LAYOUT only: what a pick DOES is\n * `applyFilterExclusiveSelection`, in the option editor's handler. A consumer\n * composing `FilterMenu` into an editor of their own owns the same call.\n */\n exclusive?: boolean;\n}\n\n/**\n * Beyond the cascader's own fields: one divider flag, on the first row of a\n * group that is not the first, because grouping happens out here. A separator\n * NODE would join the option ring, and `[data-selected] + :not([data-selected])`\n * reads the LIVE selection, so unticking a pinned row drew a second line.\n */\ninterface FilterMenuMeta {\n divider?: boolean;\n /**\n * Carries `FilterListItem.exclusive` down to the row. The rule above it is\n * `aria-hidden`, so the row's accessible name is the only channel arriving\n * before the press, and `renderItem` receives the node and nothing else.\n *\n * `[data-slot=filter-menu-exclusive-hint]` is also the handle a consumer\n * styles the row through: the cascader's row element takes no attribute of\n * ours, so `:has([data-slot=filter-menu-exclusive-hint])` selects it.\n */\n exclusive?: boolean;\n}\n\n/** Joins a selection into one comparable key; NUL cannot occur in a value. */\nconst PIN_SEPARATOR = \"\\u0000\";\n\n/** A bound on a race: each attempt costs one task and stops on success. */\nconst MAX_PIN_RESTORE_ATTEMPTS = 4;\n\ninterface PendingPinRestore {\n /** The row the user was on when the rows moved. Tracked by VALUE, never index. */\n value: string;\n /** The index it sat at, which is the half of the signature Base UI keeps. */\n index: number;\n /** The order the rows landed in, so the target's new position is known. */\n order: string[];\n attempts: number;\n}\n\n/**\n * Carries the HIGHLIGHT across a live re-pin. Base UI holds it as an INDEX and\n * a keyed reorder MOVES the DOM node rather than remounting it, so the index\n * map only rebuilds when the `MutationObserver` fires: until then, ticking a\n * row moves the highlight down one. So this ARMS in the layout effect, where\n * the map still reads the OLD order, and fires on the signature (SAME index,\n * DIFFERENT row) from a TASK, re-trying because the store event and the re-sort\n * are unordered. A synthetic `mousemove`, since Base UI exposes no setter.\n */\nfunction FilterMenuPinKeeper({\n order,\n items,\n}: {\n order: string[];\n /** The data the order was derived from, by identity. */\n items: FilterListItem[];\n}) {\n const { baseId } = useCascaderActions();\n const highlight = useCascaderHighlight();\n const previousRef = React.useRef<{\n order: string[];\n items: FilterListItem[];\n } | null>(null);\n const pendingRef = React.useRef<PendingPinRestore | null>(null);\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // From the render: on the reordering commit a ref still holds the OLD row.\n const highlightedValue = highlight.value;\n const highlightedIndex = highlight.index;\n\n const stop = React.useCallback(() => {\n pendingRef.current = null;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }, []);\n\n const startRestore = React.useCallback(() => {\n const attempt = () => {\n timerRef.current = null;\n const pending = pendingRef.current;\n if (!pending) return;\n\n const target = pending.order.indexOf(pending.value);\n const rows = document\n .getElementById(`${baseId}-column-0`)\n ?.querySelectorAll<HTMLElement>('[data-slot=\"cascader-item\"]');\n // A WINDOWED list renders a subset, so row N is not order[N]. Leave it.\n if (target < 0 || !rows || rows.length !== pending.order.length) {\n stop();\n return;\n }\n\n rows[target]?.dispatchEvent(new MouseEvent(\"mousemove\", { bubbles: true }));\n\n pending.attempts += 1;\n if (pending.attempts >= MAX_PIN_RESTORE_ATTEMPTS) {\n stop();\n return;\n }\n timerRef.current = setTimeout(attempt, 0);\n };\n\n timerRef.current = setTimeout(attempt, 0);\n }, [baseId, stop]);\n\n // No dependency list: the arm must run on the commit that reorders the rows.\n React.useLayoutEffect(() => {\n const previous = previousRef.current;\n previousRef.current = { order, items };\n\n if (!previous || previous.order === order) return;\n // New DATA (a page, a query) is Base UI's to highlight; only a re-pin is ours.\n if (previous.items !== items) return;\n if (!highlightedValue) return;\n // Content, not identity: a re-pin can leave the rows in the same order.\n if (isSameOrder(previous.order, order)) return;\n\n pendingRef.current = {\n value: highlightedValue,\n index: highlightedIndex,\n order,\n attempts: 0,\n };\n });\n\n React.useEffect(() => {\n const pending = pendingRef.current;\n if (!pending) return;\n\n // Back where it belongs, or moved by the user: either way the arm is spent.\n if (highlightedValue === pending.value || highlightedIndex !== pending.index) {\n stop();\n return;\n }\n // Already chasing this one; a second chain would double every dispatch.\n if (pending.attempts > 0 || timerRef.current !== null) return;\n startRestore();\n }, [highlightedValue, highlightedIndex, startRestore, stop]);\n\n React.useEffect(() => stop, [stop]);\n\n return null;\n}\n\n/** Element-wise, because the arrays are rebuilt on every selection change. */\nfunction isSameOrder(a: string[], b: string[]) {\n if (a.length !== b.length) return false;\n for (let index = 0; index < a.length; index += 1) {\n if (a[index] !== b[index]) return false;\n }\n return true;\n}\n\nexport interface FilterMenuProps {\n items: FilterListItem[];\n /** Committed values. Drives the check mark and the pinned group. */\n selected: string[];\n multiple?: boolean;\n /** Receives the FULL next selection, so no caller re-derives it. */\n onSelectionChange: (values: string[]) => void;\n labels: FilterLabels;\n ariaLabel: string;\n searchPlaceholder?: string;\n /** Whether the search field is VISIBLE. It is always rendered regardless. */\n searchable?: boolean;\n /**\n * Viewport height before the list scrolls, in pixels. Omitted on purpose by\n * the option editors: it becomes an inline style a consumer's `className`\n * cannot outrank, so the panel publishes `--cascader-max-height` instead.\n */\n maxHeight?: number;\n /**\n * Pin selected rows above the rest, with a full-bleed rule between them. Off\n * by default; the option editors read `FilterField.pinSelected` per field.\n */\n pinSelected?: boolean;\n /**\n * Order INSIDE each group, plus WHEN the partition is taken. Declaration\n * order by default, so the partition is stable rather than a re-sort.\n */\n sortSelected?: \"none\" | \"label\" | \"snapshot\";\n /** The caller already filtered `items`, so the cascader must not re-filter. */\n preFiltered?: boolean;\n autoFocusProps?: FilterEditorProps[\"autoFocusProps\"];\n /** Controlled query. Pair it with `onQueryChange` to filter outside. */\n query?: string;\n onQueryChange?: (query: string) => void;\n state?: Pick<FilterOptionsState<unknown>, \"loading\" | \"error\" | \"hasMore\" | \"loadMore\" | \"retry\">;\n}\n\n/**\n * One accessible list, shared by the operator menu and every option editor. It\n * is the CASCADER configured flat, not a list this file implements, which\n * brings the typeahead, RTL handling and live region with it. Only the pinning\n * and the paging affordance stay out here.\n */\nexport function FilterMenu({\n items,\n selected,\n multiple = false,\n onSelectionChange,\n labels,\n ariaLabel,\n searchPlaceholder,\n searchable = true,\n maxHeight,\n pinSelected = false,\n sortSelected = \"none\",\n preFiltered = false,\n autoFocusProps,\n query,\n onQueryChange,\n state,\n}: FilterMenuProps) {\n /**\n * The pin set as a KEY, not an array: `selected` is a fresh array on most\n * renders, so a memo depending on it re-partitions every render.\n */\n const liveKey = pinSelected ? selected.join(PIN_SEPARATOR) : \"\";\n\n /**\n * The same set, frozen at OPEN, for `sortSelected: \"snapshot\"`. LIVE is the\n * default: \"your picks, then the rest\" is about the CURRENT selection, and\n * `FilterMenuPinKeeper` pays for rows moving under the pointer.\n */\n const [snapshotKey] = React.useState(() => liveKey);\n // `pinSelected` re-checked here, not just through `liveKey`: `snapshotKey` is\n // frozen at MOUNT, so a menu that lost the prop would keep partitioning.\n const pinnedKey = !pinSelected ? \"\" : sortSelected === \"snapshot\" ? snapshotKey : liveKey;\n\n // Uncontrolled unless the caller owns the query, as an option service does.\n const [ownQuery, setOwnQuery] = React.useState(\"\");\n const currentQuery = query ?? ownQuery;\n const setQuery = onQueryChange ?? setOwnQuery;\n\n /**\n * Memoized on the SELECTION, not the query: folding the query in re-sorted\n * 4,000 rows on every keystroke, for a one pixel rule.\n */\n const partitioned = React.useMemo(() => {\n const pinned = new Set(pinnedKey ? pinnedKey.split(PIN_SEPARATOR) : []);\n\n /*\n Exclusive rows come out BEFORE the pin partition; their position is fixed.\n Pinning is by SELECTION, so a ticked None row would lift itself above the\n very rule drawn to set it apart and drop back on untick. Grouping by ROLE\n means the pinned group counts ordinary picks only, which is also why\n picking None draws no pin rule: it clears every other pick.\n */\n const exclusive = items.filter((item) => item.exclusive);\n const values = exclusive.length ? items.filter((item) => !item.exclusive) : items;\n\n const chosen = pinned.size ? values.filter((item) => pinned.has(item.value)) : [];\n const rest = pinned.size ? values.filter((item) => !pinned.has(item.value)) : values;\n\n // The SCHEMA's order inside each group unless the field asks otherwise:\n // option order is usually semantic.\n const ordered =\n sortSelected === \"label\"\n ? [\n [...chosen].sort((a, b) => a.label.localeCompare(b.label)),\n [...rest].sort((a, b) => a.label.localeCompare(b.label)),\n [...exclusive].sort((a, b) => a.label.localeCompare(b.label)),\n ]\n : [chosen, rest, exclusive];\n\n const rows = [...ordered[0], ...ordered[1], ...ordered[2]];\n\n return {\n chosenCount: chosen.length,\n /** Index of the first exclusive row, or -1 when the list has none. */\n exclusiveAt: exclusive.length ? rows.length - exclusive.length : -1,\n // The render order alone, so a REORDER is an identity compare.\n order: rows.map((item) => item.value),\n nodes: rows.map<CascaderNode<FilterMenuMeta>>((item) => ({\n value: item.value,\n label: item.label,\n icon: item.icon,\n description: item.description,\n keywords: item.keywords,\n disabled: item.disabled,\n // Only exclusive rows carry `data`, so the ordinary 4,000 keep theirs.\n data: item.exclusive ? { exclusive: true } : undefined,\n })),\n };\n }, [items, pinnedKey, sortSelected]);\n\n // No rule under a query: \"your picks, then the rest\" is about the WHOLE list.\n const dividerAt = partitioned.chosenCount && !currentQuery.trim() ? partitioned.chosenCount : -1;\n\n // Survives a search, unlike the pin rule: it is a fact about the row.\n const exclusiveDividerAt = partitioned.exclusiveAt;\n\n const nodes = React.useMemo<CascaderNode<FilterMenuMeta>[]>(() => {\n const total = partitioned.nodes.length;\n // Only a boundary with rows on BOTH sides is one: a rule on row 0 would\n // be a line above the top of the list.\n const marks = [dividerAt, exclusiveDividerAt].filter((index) => index > 0 && index < total);\n if (marks.length === 0) return partitioned.nodes;\n // Rows rewritten, not rebuilt: copying 4,000 objects would undo the split.\n const next = partitioned.nodes.slice();\n for (const index of marks) {\n // MERGED, never replaced: the two boundaries usually fall on one row, and\n // overwriting `data` dropped the flag the accessible name is built from.\n next[index] = {\n ...next[index],\n data: { ...next[index].data, divider: true },\n };\n }\n return next;\n }, [partitioned, dividerAt, exclusiveDividerAt]);\n\n const renderItem = React.useCallback(\n (node: CascaderNode<FilterMenuMeta>, itemState: CascaderItemState<FilterMenuMeta>) => (\n <>\n {node.data?.divider ? (\n <span\n data-slot=\"filter-menu-divider\"\n aria-hidden=\"true\"\n /* Full bleed, over the per-style `--cascader-list-pad` the shell\n publishes: a rule stopping at the row's inset box reads as a gap.\n Centred in the 8px the row gives back above itself, not `top-0`. */\n className=\"absolute inset-x-[calc(var(--cascader-list-pad,4px)*-1)] -top-1 h-px bg-border\"\n />\n ) : null}\n\n {node.icon ? (\n <span\n data-slot=\"filter-menu-icon\"\n className=\"flex shrink-0 items-center justify-center text-muted-foreground\"\n >\n {node.icon}\n </span>\n ) : null}\n\n <span className=\"flex min-w-0 flex-1 flex-col items-start gap-0.5\">\n <span className=\"w-full truncate text-start\">{node.label}</span>\n {node.description ? (\n <span className=\"w-full truncate text-start text-muted-foreground text-xs\">\n {node.description}\n </span>\n ) : null}\n </span>\n\n {/*\n What the aria-hidden rule says, for the people it does not reach.\n Inside the option element so it joins the row's accessible NAME, not\n an `aria-describedby`: a description is announced late or not at all,\n and this has to arrive before the press. The cascader's `srDetails`\n cannot either: `renderItem` replaces the row body. Empty copy renders\n nothing, so `labels.exclusiveHint` of \"\" silences it.\n */}\n {node.data?.exclusive && labels.exclusiveHint ? (\n <span data-slot=\"filter-menu-exclusive-hint\" className=\"sr-only\">\n {`, ${labels.exclusiveHint}`}\n </span>\n ) : null}\n\n {/* A check mark in both modes, never the cascader's default box. */}\n {itemState.selected ? (\n <span\n data-slot=\"filter-menu-check\"\n /* The gutter every style already reserves, on the cascader's own\n logical inset. `end-*` rather than `right-2`, so RTL mirrors. */\n className=\"pointer-events-none absolute end-(--cascader-row-inset,8px)! flex size-4 items-center justify-center rtl:right-auto!\"\n >\n <CheckIcon className=\"text-foreground! **:text-foreground!\" />\n </span>\n ) : null}\n </>\n ),\n [labels.exclusiveHint],\n );\n\n const cascaderLabels = React.useMemo(\n () => ({\n search: searchPlaceholder ?? labels.searchOptions,\n empty: labels.empty,\n loading: labels.loading,\n loadingMore: labels.loadingMore,\n loadMore: labels.loadMore,\n error: labels.error,\n retry: labels.retry,\n // Named after the field, not the cascader's own \"Top level\" wording.\n rootLevel: ariaLabel,\n panelLabel: ariaLabel,\n // Run FLAT, so the default hint would teach branch keys that do not exist.\n keyboardHint: () => \"\",\n // From `FilterLabels`, so the menu ships no English of its own.\n resultsAnnouncement: labels.resultsAnnouncement,\n actionsLabel: labels.actionsLabel,\n }),\n [labels, ariaLabel, searchPlaceholder],\n );\n\n /**\n * Paging and retry in the pinned footer, never a row: a row would join the\n * option ring, where arrows land on it and a query filters it away mid-page.\n */\n const actions = React.useMemo<CascaderActionItem[]>(() => {\n if (state?.error) {\n return [{ value: \"retry\", label: labels.retry, onSelect: state.retry }];\n }\n if (state?.hasMore) {\n return [\n {\n value: \"load-more\",\n label: state.loading ? labels.loadingMore : labels.loadMore,\n disabled: state.loading,\n onSelect: state.loadMore,\n },\n ];\n }\n return [];\n }, [state, labels]);\n\n const shared = {\n // Inline and pinned open with a no-op handler, so the unconditional\n // `setOpen(false)` of a single-select commit cannot dismiss the popover.\n inline: true,\n open: true,\n onOpenChange: () => {},\n items: nodes,\n inputValue: currentQuery,\n onInputValueChange: setQuery,\n maxHeight,\n renderItem,\n labels: cascaderLabels,\n actions,\n // The option service is the ONE filter when it owns the query.\n ...(preFiltered ? { filter: () => true } : null),\n };\n\n const cascaderProps: CascaderProps<FilterMenuMeta> = multiple\n ? {\n ...shared,\n multiple: true,\n value: selected,\n onValueChange: (values: string[]) => onSelectionChange(values),\n }\n : {\n ...shared,\n value: selected[0] ?? \"\",\n onValueChange: (value: string) => onSelectionChange(value ? [value] : []),\n };\n\n return (\n <Cascader {...cascaderProps}>\n <CascaderPanel>\n {/*\n `searchable: false` hides the FIELD, never removes it: the input owns\n focus and `aria-activedescendant`, so a menu without one has no\n keyboard. The class goes on the nav so the strip's border goes too.\n */}\n <CascaderNav\n className={cn(\n /* The nav's divider is `border-border/60` and the group separator\n is a full-opacity `bg-border`; two strengths read as a mistake. */\n \"border-border\",\n !searchable && \"sr-only\",\n )}\n >\n <CascaderInput\n {...(autoFocusProps ?? {})}\n placeholder={searchPlaceholder ?? labels.searchOptions}\n aria-label={ariaLabel}\n />\n </CascaderNav>\n <CascaderEmpty>\n {state?.error ? labels.error : state?.loading ? labels.loading : labels.empty}\n </CascaderEmpty>\n {/*\n Plain rows, DELIBERATELY not `CascaderVirtualItems`: windowing stands\n `FilterMenuPinKeeper` down. The long lists are async and PAGE 25.\n */}\n <CascaderList\n /**\n * Real layout space around the group rule, which is absolutely\n * positioned and adds no height. `renderItem` cannot reach the row's\n * own box, and a spacer NODE would join the option ring.\n *\n * `:has()` is affordable here: scoped to this one list, a compound\n * whose descendant exists on at most ONE row, and these menus render\n * tens of rows rather than thousands.\n */\n className=\"[&>[data-slot=cascader-item]:has([data-slot=filter-menu-divider])]:mt-2\"\n >\n <CascaderItems />\n </CascaderList>\n <CascaderFooter />\n <CascaderStatus />\n {/*\n Last, so its layout effect reads the reordered DOM after every row has\n registered. Not mounted at all for a menu that cannot reorder.\n */}\n {pinSelected && sortSelected !== \"snapshot\" ? (\n <FilterMenuPinKeeper order={partitioned.order} items={items} />\n ) : null}\n </CascaderPanel>\n </Cascader>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Option based editors */\n/* -------------------------------------------------------------------------- */\n\nfunction OptionEditor<V, O>(props: FilterEditorProps<V, O> & { multiple: boolean }) {\n const { multiple, options, labels, autoFocusProps, commit, cancel, onValueChange, value, field } =\n props;\n\n const selected = React.useMemo(() => {\n if (value === undefined || value === null) return [];\n return (Array.isArray(value) ? value : [value]) as string[];\n }, [value]);\n\n const announce = React.useContext(FilterActionsContext)?.announce;\n\n return (\n /*\n A DELIBERATELY narrow default: 12rem holds around 22 characters at every\n style's row size. `field.className` lands LAST, so a consumer's `w-*` wins.\n */\n <EditorPanel className={cn(\"w-48 min-w-0 gap-0 p-0\", field.className)}>\n <FilterMenu\n items={options.items}\n selected={selected}\n multiple={multiple}\n onSelectionChange={(raw) => {\n /*\n The ONE place the None rule is applied: every route into a selection\n arrives here, so click and keyboard cannot disagree, and only the\n editor can ANSWER it - `options.resolve` sees the schema and every\n loaded page, where the menu holds only the rows on screen.\n */\n const values = applyFilterExclusiveSelection(raw, selected, (value) =>\n Boolean(options.resolve(value)?.exclusive),\n );\n\n /*\n Identity is the test: the rule hands back `raw` itself unless it\n intervened. Announced because nothing else reports it: focus never\n moved, and nobody is on the rows that lost their check marks.\n */\n if (values !== raw && announce) {\n const arrived = values.find((entry) => !selected.includes(entry));\n const cleared = raw.length - values.length;\n if (arrived !== undefined && cleared > 0) {\n announce(\n labels.exclusiveAnnouncement(options.resolve(arrived)?.label ?? arrived, cleared),\n );\n }\n } else if (values === raw && raw.length > 1) {\n /*\n The hole in the rule, made LOUD. An unresolvable value is treated\n as ordinary and cannot be told from an id whose label has not\n arrived, so this warns rather than acts. Needs a SEEN None row.\n */\n const hasNoneRow =\n options.items.some((item) => item.exclusive) ||\n Boolean(field.options?.some((option) => option.exclusive));\n const unresolved = hasNoneRow\n ? raw.find((entry) => options.resolve(entry) === undefined)\n : undefined;\n if (unresolved !== undefined) {\n warnFilterOnce(\n `exclusive-unresolved:${field.id}`,\n `field \"${field.id}\" has an exclusive option, but the value ` +\n `\"${unresolved}\" resolves to no option, so the None rule ` +\n `cannot tell whether it is the exclusive one and has left ` +\n `it in place. Declare the exclusive option in the field's ` +\n `\\`options\\` even when the rest of the list is async, or ` +\n `cover stored values with \\`resolveValues\\`.`,\n );\n }\n }\n\n if (!multiple) {\n const next = values[0];\n // Base UI deselects the committed row; an empty filter is no gain.\n if (next === undefined) {\n cancel();\n return;\n }\n onValueChange(next as V);\n commit(next as V);\n return;\n }\n onValueChange(values as V);\n // Every toggle commits with the popover open: several picks, one gesture.\n commit(values as V, { close: false });\n }}\n labels={labels}\n ariaLabel={field.label}\n searchable={field.searchable ?? true}\n // Not a composed `Search ${label}...`: hardcoded English no `labels`\n // override could reach, and lowercasing a label is locale-hostile.\n searchPlaceholder={field.placeholder}\n pinSelected={field.pinSelected ?? false}\n sortSelected={field.sortSelected}\n // `useFilterOptions` already applied the query, locally or server side.\n preFiltered\n query={options.query}\n onQueryChange={options.setQuery}\n state={options}\n autoFocusProps={autoFocusProps}\n />\n </EditorPanel>\n );\n}\n\nexport function FilterSelectEditor<V, O>(props: FilterEditorProps<V, O>) {\n return <OptionEditor {...props} multiple={false} />;\n}\n\nexport function FilterMultiSelectEditor<V, O>(props: FilterEditorProps<V, O>) {\n return <OptionEditor {...props} multiple />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Boolean */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Module level, so the menu's index is not rebuilt on every render. Not in\n * `FilterLabels`: the chip's own display spells the same two words out.\n */\nconst BOOLEAN_ITEMS: FilterListItem[] = [\n { value: \"true\", label: \"True\" },\n { value: \"false\", label: \"False\" },\n];\n\nexport function FilterBooleanEditor<V, O>({\n value,\n onValueChange,\n commit,\n labels,\n autoFocusProps,\n field,\n}: FilterEditorProps<V, O>) {\n return (\n // Two words, and `field.className` lands last so a consumer's `w-*` wins.\n <EditorPanel className={cn(\"w-40 min-w-0 gap-0 p-0\", field.className)}>\n <FilterMenu\n items={BOOLEAN_ITEMS}\n selected={value === true ? [\"true\"] : value === false ? [\"false\"] : []}\n onSelectionChange={(values) => {\n /* Deselecting the committed row leaves nothing to filter on, so it is\n a no-op rather than a commit of `false`. */\n if (values.length === 0) return;\n const next = (values[0] === \"true\") as V;\n onValueChange(next);\n commit(next);\n }}\n labels={labels}\n ariaLabel={field.label}\n /* Two rows: a search over them is more chrome than list, but the\n field is still rendered, hidden, because it owns the keyboard. */\n searchable={false}\n autoFocusProps={autoFocusProps}\n />\n </EditorPanel>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Resolution */\n/* -------------------------------------------------------------------------- */\n\nexport type {\n AnyFilterEditor,\n FilterEditorRegistry,\n} from \"./filters-types\";\n\nexport const DEFAULT_FILTER_EDITORS: FilterEditorRegistry = {\n text: FilterTextEditor,\n number: FilterNumberEditor,\n range: FilterRangeEditor,\n select: FilterSelectEditor,\n multiselect: FilterMultiSelectEditor,\n boolean: FilterBooleanEditor,\n};\n\n/**\n * Picks the editor for a (field, operator) pair: the field's own `editor`, then\n * the operator's ARITY, then the field's `type`. Arity outranks type because\n * \"between\" wants two boxes whatever the field said.\n */\nexport function resolveFilterEditor<V, O>(\n field: FilterField<V, O>,\n operator: FilterOperator | undefined,\n editors: FilterEditorRegistry,\n): AnyFilterEditor | undefined {\n if (typeof field.editor === \"function\") {\n // The one place a consumer's typed editor meets the erased registry.\n return field.editor as unknown as AnyFilterEditor;\n }\n if (typeof field.editor === \"string\") {\n const named = editors[field.editor];\n if (named) return named;\n }\n\n const arity = operator?.arity ?? \"one\";\n if (arity === \"none\") return undefined;\n if (arity === \"range\") return editors.range;\n if (arity === \"many\") {\n // An option-backed field gets checkboxes; anything else receives an array.\n if (field.options || field.loadOptions) return editors.multiselect;\n }\n\n return editors[field.type ?? \"text\"] ?? editors.text;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2DA,MAAM,OAAoC;CACxC,OAAO,CAAC;CACR,SAAS;CACT,OAAO;CACP,SAAS;AACX;;AAGA,MAAM,6BAA6B,CAAC;AACpC,MAAM,oBAAoB;;;;;AAM1B,SAAS,eACP,OACA,OACe;CACf,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,OACG;OAAA,MAAM,SAAS,MAAM,KACxB,IAAK,MAAM,UAAuB,OAChC,OAAO,eAAe,MAAM,IAAI;CAAA;CAItC,OAAO,IAAI,MAAM;AACnB;;;;;;;;AASA,SAAgB,iBACd,OACA,SACA,aAAa,KACU;CACvB,MAAM,CAAC,OAAO,iBAAiBA,QAAM,SAAS,EAAE;CAChD,MAAM,CAAC,OAAO,YAAYA,QAAM,SAC9B,IACF;CAEA,MAAM,QAAQA,QAAM,uBAAO,IAAI,IAA6B,CAAC;CAC7D,MAAM,YAAYA,QAAM,OAAO,CAAC;CAChC,MAAM,WAAWA,QAAM,OAA+B,IAAI;CAG1D,MAAM,iBAAiBA,QAAM,WAAW,oBAAoB;CAC5D,MAAM,SAAuC,gBAAgB,cAAc;CAC3E,MAAM,YAAY,eAAe,OAAO,gBAAgB,KAAK;CAG7D,QAAM,qBACJ,SAAS,OAAO,YAAY,gBAC5B,SAAS,OAAO,aAAa,aAC7B,SAAS,OAAO,aAAa,WAC/B;CAEA,MAAM,gBAAgB,OAAO;CAC7B,MAAM,cAAc,OAAO;CAC3B,MAAM,UAAU,QAAQ,WAAW;CAGnC,QAAM,gBAAgB;EACpB,IAAI,CAAC,eAAe;EACpB,KAAK,MAAM,UAAU,eAAe,MAAM,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,OAAO;AAAO,GAC/B;CAAE,OAAO;CAAS,OAAO;AAAQ,CACnC;AAEA,SAAgB,oBAA0B,EACxC,OACA,eACA,QACA,QACA,gBACA,SAC0B;CAC1B,OAEE,oBAAC,aAAD;EAAa,WAAW,GAAG,0BAA0B,MAAM,SAAS;EAClE,UAAA,oBAAC,YAAD;GACE,OAAO;GACP,UAAU,UAAU,OAAO,CAAC,MAAM,IAAI,UAAU,QAAQ,CAAC,OAAO,IAAI,CAAC;GACrE,oBAAoB,WAAW;IAG7B,IAAI,OAAO,WAAW,GAAG;IACzB,MAAM,OAAQ,OAAO,OAAO;IAC5B,cAAc,IAAI;IAClB,OAAO,IAAI;GACb;GACQ;GACR,WAAW,MAAM;GAGjB,YAAY;GACI;EACjB,CAAA;CACU,CAAA;AAEjB;AAWA,MAAa,yBAA+C;CAC1D,MAAM;CACN,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,aAAa;CACb,SAAS;AACX;;;;;;AAOA,SAAgB,oBACd,OACA,UACA,SAC6B;CAC7B,IAAI,OAAO,MAAM,WAAW,YAE1B,OAAO,MAAM;CAEf,IAAI,OAAO,MAAM,WAAW,UAAU;EACpC,MAAM,QAAQ,QAAQ,MAAM;EAC5B,IAAI,OAAO,OAAO;CACpB;CAEA,MAAM,QAAQ,UAAU,SAAS;CACjC,IAAI,UAAU,QAAQ,OAAO,KAAA;CAC7B,IAAI,UAAU,SAAS,OAAO,QAAQ;CACtC,IAAI,UAAU,QAER;MAAA,MAAM,WAAW,MAAM,aAAa,OAAO,QAAQ;CAAA;CAGzD,OAAO,QAAQ,MAAM,QAAQ,WAAW,QAAQ;AAClD"}
|
|
1
|
+
{"version":3,"file":"filters-editors.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-editors.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup } from \"../../ui/button-group\";\nimport { Input } from \"../../ui/input\";\nimport type { CascaderItemState, CascaderProps } from \"../cascader/cascader\";\nimport {\n Cascader,\n CascaderEmpty,\n CascaderList,\n CascaderPanel,\n CascaderStatus,\n} from \"../cascader/cascader\";\nimport { useCascaderActions, useCascaderHighlight } from \"../cascader/cascader-context\";\nimport { CascaderFooter } from \"../cascader/cascader-footer\";\nimport { CascaderItems } from \"../cascader/cascader-item\";\nimport { CascaderInput, CascaderNav } from \"../cascader/cascader-nav\";\nimport type { CascaderActionItem, CascaderNode } from \"../cascader/cascader-types\";\nimport {\n FilterActionsContext,\n type FilterResolutionStore,\n filterControlSizes,\n} from \"./filters-context\";\nimport {\n applyFilterExclusiveSelection,\n filterFilterOptions,\n joinFilterPath,\n normalizeFilterQuery,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport type {\n AnyFilterEditor,\n FilterEditorProps,\n FilterEditorRegistry,\n FilterField,\n FilterIndex,\n FilterLabels,\n FilterLoadResult,\n FilterOperator,\n FilterOption,\n FilterOptionsState,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* The options service */\n/* -------------------------------------------------------------------------- */\n\ninterface OptionsInternalState<O> {\n items: FilterOption<O>[];\n loading: boolean;\n error: boolean;\n hasMore: boolean;\n cursor?: string;\n}\n\nconst IDLE: OptionsInternalState<never> = {\n items: [],\n loading: false,\n error: false,\n hasMore: false,\n};\n\n/** Stable no-op subscription, for a hook running outside a `Filters` root. */\nconst emptySubscribe = () => () => {};\nconst zeroVersion = () => 0;\n\n/**\n * The joined path of a field, from the schema index. Keyed by PATH, not field\n * identity, so labels survive a schema rebuild; an unknown field uses its id.\n */\nfunction filterFieldKey<V, O>(\n field: FilterField<V, O> | undefined,\n index: FilterIndex | undefined,\n): string | null {\n if (!field) return null;\n if (index) {\n for (const entry of index.all) {\n if ((entry.field as unknown) === (field as unknown)) {\n return joinFilterPath(entry.path);\n }\n }\n }\n return `#${field.id}`;\n}\n\n/**\n * The shared option service every option-backed editor receives: debouncing,\n * aborting, cursor paging and value-to-label resolution. A deliberate fork of\n * the cascader's async machinery. Resolution is two-tier: a ref cache written\n * in an EFFECT, plus the root's `FilterResolutionStore`, without which a\n * `loadOptions`-only field showed its raw id once the menu closed.\n */\nexport function useFilterOptions<V, O>(\n field: FilterField<V, O> | undefined,\n enabled: boolean,\n debounceMs = 250,\n): FilterOptionsState<O> {\n const [query, setQueryState] = React.useState(\"\");\n const [state, setState] = React.useState<OptionsInternalState<O>>(\n IDLE as OptionsInternalState<O>,\n );\n\n const cache = React.useRef(new Map<string, FilterOption<O>>());\n const requestId = React.useRef(0);\n const abortRef = React.useRef<AbortController | null>(null);\n\n // Read directly, so this degrades outside a `Filters` root instead of throwing.\n const actionsContext = React.useContext(FilterActionsContext);\n const shared: FilterResolutionStore | null = actionsContext?.resolution ?? null;\n const sharedKey = filterFieldKey(field, actionsContext?.index);\n\n // Re-render when a label lands ANYWHERE under this root, not just here.\n React.useSyncExternalStore(\n shared ? shared.subscribe : emptySubscribe,\n shared ? shared.getVersion : zeroVersion,\n shared ? shared.getVersion : zeroVersion,\n );\n\n const staticOptions = field?.options;\n const loadOptions = field?.loadOptions;\n const isAsync = Boolean(loadOptions);\n\n // Seeded in an effect, not during render, so the render stays pure.\n React.useEffect(() => {\n if (!staticOptions) return;\n for (const option of staticOptions) cache.current.set(option.value, option);\n if (shared && sharedKey) shared.set(sharedKey, staticOptions);\n }, [staticOptions, shared, sharedKey]);\n\n React.useEffect(() => {\n for (const option of state.items) cache.current.set(option.value, option);\n if (shared && sharedKey && state.items.length) {\n shared.set(sharedKey, state.items);\n }\n }, [state.items, shared, sharedKey]);\n\n const run = React.useCallback(\n async (nextQuery: string, cursor: string | undefined, append: boolean) => {\n if (!loadOptions) return;\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n const id = ++requestId.current;\n\n setState((previous) => ({\n ...previous,\n loading: true,\n error: false,\n items: append ? previous.items : [],\n }));\n\n try {\n const result = await loadOptions(nextQuery, {\n signal: controller.signal,\n cursor,\n });\n // A superseded request must not write; the id, not the abort, decides.\n if (id !== requestId.current) return;\n\n const normalized: FilterLoadResult<O> = Array.isArray(result) ? { items: result } : result;\n\n setState((previous) => ({\n items: append ? [...previous.items, ...normalized.items] : normalized.items,\n loading: false,\n error: false,\n hasMore: normalized.hasMore ?? Boolean(normalized.nextCursor),\n cursor: normalized.nextCursor,\n }));\n } catch (error) {\n if (id !== requestId.current) return;\n if ((error as Error)?.name === \"AbortError\") return;\n setState((previous) => ({\n ...previous,\n loading: false,\n error: true,\n hasMore: false,\n }));\n }\n },\n [loadOptions],\n );\n\n React.useEffect(() => {\n if (!enabled || !isAsync) return;\n const timer = setTimeout(() => void run(query, undefined, false), debounceMs);\n return () => clearTimeout(timer);\n }, [enabled, isAsync, query, debounceMs, run]);\n\n React.useEffect(() => {\n return () => abortRef.current?.abort();\n }, []);\n\n const normalizedQuery = normalizeFilterQuery(query);\n\n // Async results are server-filtered; re-filtering hides what the label omits.\n const items = React.useMemo(() => {\n if (isAsync) return state.items;\n return filterFilterOptions(staticOptions ?? [], normalizedQuery);\n }, [isAsync, state.items, staticOptions, normalizedQuery]);\n\n const setQuery = React.useCallback((next: string) => setQueryState(next), []);\n\n const loadMore = React.useCallback(() => {\n if (!state.hasMore || state.loading) return;\n void run(query, state.cursor, true);\n }, [state.hasMore, state.loading, state.cursor, query, run]);\n\n const retry = React.useCallback(() => {\n void run(query, undefined, false);\n }, [query, run]);\n\n const resolve = React.useCallback(\n (value: string) => {\n // The ref cache cannot be the only tier: a ref write triggers no render,\n // so the chip would paint the raw value and never repaint. The shared\n // store holds other instances' pages and re-renders this one on a gain.\n const declared = staticOptions?.find((option) => option.value === value);\n if (declared) return declared;\n const fromShared = shared && sharedKey ? shared.get(sharedKey, value) : undefined;\n if (fromShared) return fromShared as FilterOption<O>;\n return cache.current.get(value);\n },\n [staticOptions, shared, sharedKey],\n );\n\n return {\n items,\n loading: state.loading,\n error: state.error,\n hasMore: state.hasMore,\n query,\n setQuery,\n loadMore,\n retry,\n resolve,\n };\n}\n\n/**\n * Resolves committed values no loaded page covered, through `resolveValues`: a\n * restored saved view holds ids the loader never returned. The claim set marks\n * an omitted id asked, so only a REJECTED resolve lets a later mount retry.\n */\nexport function useFilterValueResolution<V, O>(\n field: FilterField<V, O> | undefined,\n values: readonly unknown[],\n): void {\n const actionsContext = React.useContext(FilterActionsContext);\n const shared: FilterResolutionStore | null = actionsContext?.resolution ?? null;\n const sharedKey = filterFieldKey(field, actionsContext?.index);\n const resolveValues = field?.resolveValues;\n const staticOptions = field?.options;\n // Keyed by CONTENT; NUL cannot occur inside a real stored value.\n const valuesKey = values.map((entry) => String(entry)).join(\"\\u0000\");\n\n React.useEffect(() => {\n if (!resolveValues || !shared || !sharedKey || valuesKey === \"\") return;\n const missing = valuesKey.split(\"\\u0000\").filter((value) => {\n if (staticOptions?.some((option) => option.value === value)) return false;\n return shared.get(sharedKey, value) === undefined;\n });\n const wanted = shared.claim(sharedKey, missing);\n if (wanted.length === 0) return;\n\n // No unmount guard: the store outlives the component.\n void Promise.resolve(resolveValues(wanted)).then(\n (options) => shared.set(sharedKey, options),\n () => shared.release(sharedKey, wanted),\n );\n }, [resolveValues, shared, sharedKey, valuesKey, staticOptions]);\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared chrome */\n/* -------------------------------------------------------------------------- */\n\n/**\n * The panel every editor renders into. A plain flex column, NOT a combobox: an\n * editor inside a Base UI composite would inherit its `aria-activedescendant`\n * and arrow keys, which is hostile to a colour picker or a slider.\n */\nfunction EditorPanel({ children, className }: { children: React.ReactNode; className?: string }) {\n return (\n <div\n data-slot=\"filter-editor\"\n className={cn(\n \"flex w-full flex-col gap-2 p-2\",\n /* The list height cap as a VARIABLE, not the `maxHeight` prop, which\n becomes an inline style no consumer class can beat. 16rem is the\n 256px the menu has always used. */\n \"[--cascader-max-height:16rem]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nfunction EditorFooter({\n onCancel,\n onCommit,\n labels,\n host,\n}: Pick<FilterEditorProps, \"labels\" | \"host\"> & {\n onCancel: () => void;\n onCommit: () => void;\n}) {\n // The ONE ladder, not a hardcoded rung: `size=\"sm\"` here measured 4px short\n // of the bar's own controls at `size=\"default\"` in all eight styles.\n const actions = React.useContext(FilterActionsContext);\n const sizes = filterControlSizes({ size: actions?.size ?? \"default\" });\n\n // The create host advances on commit and has Back; amend must offer discard.\n if (host === \"create\") return null;\n return (\n <div className=\"flex items-center justify-end gap-1.5 pt-1\">\n <Button variant=\"ghost\" size={sizes.button} onClick={onCancel}>\n {labels.discard}\n </Button>\n <Button size={sizes.button} onClick={onCommit}>\n {labels.apply}\n </Button>\n </div>\n );\n}\n\n/**\n * `w-full` because `ButtonGroup` is `w-fit`, which collapses inside this\n * fixed-width panel. Sera is an underline style, so its direct children flatten\n * to one bottom-only edge - `border-b-input`, not transparent, since the\n * buttons are the trailing edge and the rule would stop mid-panel.\n */\nconst EDITOR_FIELD_GROUP = \"w-full\";\n\n/**\n * Confirm and cancel, an OUTLINE pair FUSED onto the field's trailing edge.\n * Returns a FRAGMENT: `ButtonGroup` fuses with selectors matching DIRECT\n * children only, so a wrapper div renders three separate boxes. `size=\"icon\"`\n * because every style's icon button at that size is exactly its input's height.\n */\nfunction EditorCommitButtons({\n onCancel,\n onCommit,\n labels,\n}: Pick<FilterEditorProps, \"labels\"> & {\n onCancel: () => void;\n onCommit: () => void;\n}) {\n return (\n <>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label={labels.apply}\n onClick={onCommit}\n >\n <CheckIcon aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label={labels.discard}\n onClick={onCancel}\n >\n <XIcon aria-hidden=\"true\" />\n </Button>\n </>\n );\n}\n\nfunction useCommitKeys(commit: () => void, cancel: () => void) {\n return React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n commit();\n return;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n // Stop here so a surrounding dialog does not also close.\n event.stopPropagation();\n cancel();\n }\n },\n [commit, cancel],\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Text / number */\n/* -------------------------------------------------------------------------- */\n\nexport function FilterTextEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n return (\n // A width, not shrink-to-fit: the popover is `w-auto`, so an unsized box\n // changes width between the hosts. `w-72` is measured - it holds about 23\n // characters in sera and 27 in nova; `w-64` held about eighteen, too short\n // for an email, and `w-80` was the widest control in a bar of compact\n // chips. Capped at the viewport because `w-80` is 320px and a 360px phone\n // has 40px to spare. A `w-*` on the field wins.\n <EditorPanel className={cn(\"w-72 min-w-0 max-w-[calc(100vw-2rem)]\", field.className)}>\n <ButtonGroup className={EDITOR_FIELD_GROUP}>\n <Input\n {...autoFocusProps}\n value={(value as string) ?? \"\"}\n placeholder={field.placeholder ?? labels.valuePlaceholder}\n aria-label={field.label}\n onChange={(event) => onValueChange(event.target.value as V)}\n onKeyDown={onKeyDown}\n />\n {/*\n A lone input still belongs in the group: the per-style sheets re-round\n the LAST child, so a group with nothing fused draws the bare field.\n */}\n {host === \"create\" ? null : (\n <EditorCommitButtons labels={labels} onCancel={cancel} onCommit={() => commit()} />\n )}\n </ButtonGroup>\n </EditorPanel>\n );\n}\n\nexport function FilterNumberEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n return (\n // Deliberately not the text editor's `w-72`: number values are short by\n // construction, and a wide box around \"42\" is the opposite defect.\n <EditorPanel className={cn(\"w-56 min-w-0\", field.className)}>\n <ButtonGroup className={EDITOR_FIELD_GROUP}>\n <Input\n {...autoFocusProps}\n type=\"number\"\n value={value === undefined || value === null ? \"\" : String(value)}\n placeholder={field.placeholder}\n aria-label={field.label}\n onChange={(event) => {\n const raw = event.target.value;\n onValueChange((raw === \"\" ? undefined : Number(raw)) as V);\n }}\n onKeyDown={onKeyDown}\n />\n {host === \"create\" ? null : (\n <EditorCommitButtons labels={labels} onCancel={cancel} onCommit={() => commit()} />\n )}\n </ButtonGroup>\n </EditorPanel>\n );\n}\n\nexport function FilterRangeEditor<V, O>({\n value,\n onValueChange,\n commit,\n cancel,\n autoFocusProps,\n labels,\n host,\n field,\n}: FilterEditorProps<V, O>) {\n const tuple = (Array.isArray(value) ? value : []) as unknown[];\n const onKeyDown = useCommitKeys(() => commit(), cancel);\n\n const update = (index: 0 | 1, raw: string) => {\n const next = [tuple[0], tuple[1]];\n next[index] = raw === \"\" ? undefined : Number(raw);\n onValueChange(next as V);\n };\n\n return (\n <EditorPanel>\n <div className=\"flex items-center gap-1.5\">\n <Input\n {...autoFocusProps}\n type=\"number\"\n value={tuple[0] === undefined ? \"\" : String(tuple[0])}\n aria-label={labels.rangeFrom(field.label)}\n onChange={(event) => update(0, event.target.value)}\n onKeyDown={onKeyDown}\n />\n <span className=\"text-muted-foreground text-xs\">{labels.rangeSeparator}</span>\n <Input\n type=\"number\"\n value={tuple[1] === undefined ? \"\" : String(tuple[1])}\n aria-label={labels.rangeTo(field.label)}\n onChange={(event) => update(1, event.target.value)}\n onKeyDown={onKeyDown}\n />\n </div>\n <EditorFooter host={host} labels={labels} onCancel={cancel} onCommit={() => commit()} />\n </EditorPanel>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* The menu */\n/* -------------------------------------------------------------------------- */\n\n/** One row. The shape both the operator menu and the option editors hand over. */\nexport interface FilterListItem {\n value: string;\n label: string;\n icon?: React.ReactNode;\n description?: string;\n keywords?: string[];\n disabled?: boolean;\n /**\n * A None row, from `FilterOption.exclusive`. LAYOUT only: what a pick DOES is\n * `applyFilterExclusiveSelection`, in the option editor's handler. A consumer\n * composing `FilterMenu` into an editor of their own owns the same call.\n */\n exclusive?: boolean;\n}\n\n/**\n * Beyond the cascader's own fields: one divider flag, on the first row of a\n * group that is not the first, because grouping happens out here. A separator\n * NODE would join the option ring, and `[data-selected] + :not([data-selected])`\n * reads the LIVE selection, so unticking a pinned row drew a second line.\n */\ninterface FilterMenuMeta {\n divider?: boolean;\n /**\n * Carries `FilterListItem.exclusive` down to the row. The rule above it is\n * `aria-hidden`, so the row's accessible name is the only channel arriving\n * before the press, and `renderItem` receives the node and nothing else.\n *\n * `[data-slot=filter-menu-exclusive-hint]` is also the handle a consumer\n * styles the row through: the cascader's row element takes no attribute of\n * ours, so `:has([data-slot=filter-menu-exclusive-hint])` selects it.\n */\n exclusive?: boolean;\n}\n\n/** Joins a selection into one comparable key; NUL cannot occur in a value. */\nconst PIN_SEPARATOR = \"\\u0000\";\n\n/** A bound on a race: each attempt costs one task and stops on success. */\nconst MAX_PIN_RESTORE_ATTEMPTS = 4;\n\ninterface PendingPinRestore {\n /** The row the user was on when the rows moved. Tracked by VALUE, never index. */\n value: string;\n /** The index it sat at, which is the half of the signature Base UI keeps. */\n index: number;\n /** The order the rows landed in, so the target's new position is known. */\n order: string[];\n attempts: number;\n}\n\n/**\n * Carries the HIGHLIGHT across a live re-pin. Base UI holds it as an INDEX and\n * a keyed reorder MOVES the DOM node rather than remounting it, so the index\n * map only rebuilds when the `MutationObserver` fires: until then, ticking a\n * row moves the highlight down one. So this ARMS in the layout effect, where\n * the map still reads the OLD order, and fires on the signature (SAME index,\n * DIFFERENT row) from a TASK, re-trying because the store event and the re-sort\n * are unordered. A synthetic `mousemove`, since Base UI exposes no setter.\n */\nfunction FilterMenuPinKeeper({\n order,\n items,\n}: {\n order: string[];\n /** The data the order was derived from, by identity. */\n items: FilterListItem[];\n}) {\n const { baseId } = useCascaderActions();\n const highlight = useCascaderHighlight();\n const previousRef = React.useRef<{\n order: string[];\n items: FilterListItem[];\n } | null>(null);\n const pendingRef = React.useRef<PendingPinRestore | null>(null);\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // From the render: on the reordering commit a ref still holds the OLD row.\n const highlightedValue = highlight.value;\n const highlightedIndex = highlight.index;\n\n const stop = React.useCallback(() => {\n pendingRef.current = null;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }, []);\n\n const startRestore = React.useCallback(() => {\n const attempt = () => {\n timerRef.current = null;\n const pending = pendingRef.current;\n if (!pending) return;\n\n const target = pending.order.indexOf(pending.value);\n const rows = document\n .getElementById(`${baseId}-column-0`)\n ?.querySelectorAll<HTMLElement>('[data-slot=\"cascader-item\"]');\n // A WINDOWED list renders a subset, so row N is not order[N]. Leave it.\n if (target < 0 || !rows || rows.length !== pending.order.length) {\n stop();\n return;\n }\n\n rows[target]?.dispatchEvent(new MouseEvent(\"mousemove\", { bubbles: true }));\n\n pending.attempts += 1;\n if (pending.attempts >= MAX_PIN_RESTORE_ATTEMPTS) {\n stop();\n return;\n }\n timerRef.current = setTimeout(attempt, 0);\n };\n\n timerRef.current = setTimeout(attempt, 0);\n }, [baseId, stop]);\n\n // No dependency list: the arm must run on the commit that reorders the rows.\n React.useLayoutEffect(() => {\n const previous = previousRef.current;\n previousRef.current = { order, items };\n\n if (!previous || previous.order === order) return;\n // New DATA (a page, a query) is Base UI's to highlight; only a re-pin is ours.\n if (previous.items !== items) return;\n if (!highlightedValue) return;\n // Content, not identity: a re-pin can leave the rows in the same order.\n if (isSameOrder(previous.order, order)) return;\n\n pendingRef.current = {\n value: highlightedValue,\n index: highlightedIndex,\n order,\n attempts: 0,\n };\n });\n\n React.useEffect(() => {\n const pending = pendingRef.current;\n if (!pending) return;\n\n // Back where it belongs, or moved by the user: either way the arm is spent.\n if (highlightedValue === pending.value || highlightedIndex !== pending.index) {\n stop();\n return;\n }\n // Already chasing this one; a second chain would double every dispatch.\n if (pending.attempts > 0 || timerRef.current !== null) return;\n startRestore();\n }, [highlightedValue, highlightedIndex, startRestore, stop]);\n\n React.useEffect(() => stop, [stop]);\n\n return null;\n}\n\n/** Element-wise, because the arrays are rebuilt on every selection change. */\nfunction isSameOrder(a: string[], b: string[]) {\n if (a.length !== b.length) return false;\n for (let index = 0; index < a.length; index += 1) {\n if (a[index] !== b[index]) return false;\n }\n return true;\n}\n\nexport interface FilterMenuProps {\n items: FilterListItem[];\n /** Committed values. Drives the check mark and the pinned group. */\n selected: string[];\n multiple?: boolean;\n /** Receives the FULL next selection, so no caller re-derives it. */\n onSelectionChange: (values: string[]) => void;\n labels: FilterLabels;\n ariaLabel: string;\n searchPlaceholder?: string;\n /** Whether the search field is VISIBLE. It is always rendered regardless. */\n searchable?: boolean;\n /**\n * Viewport height before the list scrolls, in pixels. Omitted on purpose by\n * the option editors: it becomes an inline style a consumer's `className`\n * cannot outrank, so the panel publishes `--cascader-max-height` instead.\n */\n maxHeight?: number;\n /**\n * Pin selected rows above the rest, with a full-bleed rule between them. Off\n * by default; the option editors read `FilterField.pinSelected` per field.\n */\n pinSelected?: boolean;\n /**\n * Order INSIDE each group, plus WHEN the partition is taken. Declaration\n * order by default, so the partition is stable rather than a re-sort.\n */\n sortSelected?: \"none\" | \"label\" | \"snapshot\";\n /** The caller already filtered `items`, so the cascader must not re-filter. */\n preFiltered?: boolean;\n autoFocusProps?: FilterEditorProps[\"autoFocusProps\"];\n /** Controlled query. Pair it with `onQueryChange` to filter outside. */\n query?: string;\n onQueryChange?: (query: string) => void;\n state?: Pick<FilterOptionsState<unknown>, \"loading\" | \"error\" | \"hasMore\" | \"loadMore\" | \"retry\">;\n}\n\n/**\n * One accessible list, shared by the operator menu and every option editor. It\n * is the CASCADER configured flat, not a list this file implements, which\n * brings the typeahead, RTL handling and live region with it. Only the pinning\n * and the paging affordance stay out here.\n */\nexport function FilterMenu({\n items,\n selected,\n multiple = false,\n onSelectionChange,\n labels,\n ariaLabel,\n searchPlaceholder,\n searchable = true,\n maxHeight,\n pinSelected = false,\n sortSelected = \"none\",\n preFiltered = false,\n autoFocusProps,\n query,\n onQueryChange,\n state,\n}: FilterMenuProps) {\n /**\n * The pin set as a KEY, not an array: `selected` is a fresh array on most\n * renders, so a memo depending on it re-partitions every render.\n */\n const liveKey = pinSelected ? selected.join(PIN_SEPARATOR) : \"\";\n\n /**\n * The same set, frozen at OPEN, for `sortSelected: \"snapshot\"`. LIVE is the\n * default: \"your picks, then the rest\" is about the CURRENT selection, and\n * `FilterMenuPinKeeper` pays for rows moving under the pointer.\n */\n const [snapshotKey] = React.useState(() => liveKey);\n // `pinSelected` re-checked here, not just through `liveKey`: `snapshotKey` is\n // frozen at MOUNT, so a menu that lost the prop would keep partitioning.\n const pinnedKey = !pinSelected ? \"\" : sortSelected === \"snapshot\" ? snapshotKey : liveKey;\n\n // Uncontrolled unless the caller owns the query, as an option service does.\n const [ownQuery, setOwnQuery] = React.useState(\"\");\n const currentQuery = query ?? ownQuery;\n const setQuery = onQueryChange ?? setOwnQuery;\n\n /**\n * Memoized on the SELECTION, not the query: folding the query in re-sorted\n * 4,000 rows on every keystroke, for a one pixel rule.\n */\n const partitioned = React.useMemo(() => {\n const pinned = new Set(pinnedKey ? pinnedKey.split(PIN_SEPARATOR) : []);\n\n /*\n Exclusive rows come out BEFORE the pin partition; their position is fixed.\n Pinning is by SELECTION, so a ticked None row would lift itself above the\n very rule drawn to set it apart and drop back on untick. Grouping by ROLE\n means the pinned group counts ordinary picks only, which is also why\n picking None draws no pin rule: it clears every other pick.\n */\n const exclusive = items.filter((item) => item.exclusive);\n const values = exclusive.length ? items.filter((item) => !item.exclusive) : items;\n\n const chosen = pinned.size ? values.filter((item) => pinned.has(item.value)) : [];\n const rest = pinned.size ? values.filter((item) => !pinned.has(item.value)) : values;\n\n // The SCHEMA's order inside each group unless the field asks otherwise:\n // option order is usually semantic.\n const ordered =\n sortSelected === \"label\"\n ? [\n [...chosen].sort((a, b) => a.label.localeCompare(b.label)),\n [...rest].sort((a, b) => a.label.localeCompare(b.label)),\n [...exclusive].sort((a, b) => a.label.localeCompare(b.label)),\n ]\n : [chosen, rest, exclusive];\n\n const rows = [...ordered[0], ...ordered[1], ...ordered[2]];\n\n return {\n chosenCount: chosen.length,\n /** Index of the first exclusive row, or -1 when the list has none. */\n exclusiveAt: exclusive.length ? rows.length - exclusive.length : -1,\n // The render order alone, so a REORDER is an identity compare.\n order: rows.map((item) => item.value),\n nodes: rows.map<CascaderNode<FilterMenuMeta>>((item) => ({\n value: item.value,\n label: item.label,\n icon: item.icon,\n description: item.description,\n keywords: item.keywords,\n disabled: item.disabled,\n // Only exclusive rows carry `data`, so the ordinary 4,000 keep theirs.\n data: item.exclusive ? { exclusive: true } : undefined,\n })),\n };\n }, [items, pinnedKey, sortSelected]);\n\n // No rule under a query: \"your picks, then the rest\" is about the WHOLE list.\n const dividerAt = partitioned.chosenCount && !currentQuery.trim() ? partitioned.chosenCount : -1;\n\n // Survives a search, unlike the pin rule: it is a fact about the row.\n const exclusiveDividerAt = partitioned.exclusiveAt;\n\n const nodes = React.useMemo<CascaderNode<FilterMenuMeta>[]>(() => {\n const total = partitioned.nodes.length;\n // Only a boundary with rows on BOTH sides is one: a rule on row 0 would\n // be a line above the top of the list.\n const marks = [dividerAt, exclusiveDividerAt].filter((index) => index > 0 && index < total);\n if (marks.length === 0) return partitioned.nodes;\n // Rows rewritten, not rebuilt: copying 4,000 objects would undo the split.\n const next = partitioned.nodes.slice();\n for (const index of marks) {\n // MERGED, never replaced: the two boundaries usually fall on one row, and\n // overwriting `data` dropped the flag the accessible name is built from.\n next[index] = {\n ...next[index],\n data: { ...next[index].data, divider: true },\n };\n }\n return next;\n }, [partitioned, dividerAt, exclusiveDividerAt]);\n\n const renderItem = React.useCallback(\n (node: CascaderNode<FilterMenuMeta>, itemState: CascaderItemState<FilterMenuMeta>) => (\n <>\n {node.data?.divider ? (\n <span\n data-slot=\"filter-menu-divider\"\n aria-hidden=\"true\"\n /* Full bleed, over the per-style `--cascader-list-pad` the shell\n publishes: a rule stopping at the row's inset box reads as a gap.\n Centred in the 8px the row gives back above itself, not `top-0`. */\n className=\"absolute inset-x-[calc(var(--cascader-list-pad,4px)*-1)] -top-1 h-px bg-border\"\n />\n ) : null}\n\n {node.icon ? (\n <span\n data-slot=\"filter-menu-icon\"\n className=\"flex shrink-0 items-center justify-center text-muted-foreground\"\n >\n {node.icon}\n </span>\n ) : null}\n\n <span className=\"flex min-w-0 flex-1 flex-col items-start gap-0.5\">\n <span className=\"w-full truncate text-start\">{node.label}</span>\n {node.description ? (\n <span className=\"w-full truncate text-start text-muted-foreground text-xs\">\n {node.description}\n </span>\n ) : null}\n </span>\n\n {/*\n What the aria-hidden rule says, for the people it does not reach.\n Inside the option element so it joins the row's accessible NAME, not\n an `aria-describedby`: a description is announced late or not at all,\n and this has to arrive before the press. The cascader's `srDetails`\n cannot either: `renderItem` replaces the row body. Empty copy renders\n nothing, so `labels.exclusiveHint` of \"\" silences it.\n */}\n {node.data?.exclusive && labels.exclusiveHint ? (\n <span data-slot=\"filter-menu-exclusive-hint\" className=\"sr-only\">\n {`, ${labels.exclusiveHint}`}\n </span>\n ) : null}\n\n {/* A check mark in both modes, never the cascader's default box. */}\n {itemState.selected ? (\n <span\n data-slot=\"filter-menu-check\"\n /* The gutter every style already reserves, on the cascader's own\n logical inset. `end-*` rather than `right-2`, so RTL mirrors. */\n className=\"pointer-events-none absolute end-(--cascader-row-inset,8px)! flex size-4 items-center justify-center rtl:right-auto!\"\n >\n <CheckIcon className=\"text-foreground! **:text-foreground!\" />\n </span>\n ) : null}\n </>\n ),\n [labels.exclusiveHint],\n );\n\n const cascaderLabels = React.useMemo(\n () => ({\n search: searchPlaceholder ?? labels.searchOptions,\n empty: labels.empty,\n loading: labels.loading,\n loadingMore: labels.loadingMore,\n loadMore: labels.loadMore,\n error: labels.error,\n retry: labels.retry,\n // Named after the field, not the cascader's own \"Top level\" wording.\n rootLevel: ariaLabel,\n panelLabel: ariaLabel,\n // Run FLAT, so the default hint would teach branch keys that do not exist.\n keyboardHint: () => \"\",\n // From `FilterLabels`, so the menu ships no English of its own.\n resultsAnnouncement: labels.resultsAnnouncement,\n actionsLabel: labels.actionsLabel,\n }),\n [labels, ariaLabel, searchPlaceholder],\n );\n\n /**\n * Paging and retry in the pinned footer, never a row: a row would join the\n * option ring, where arrows land on it and a query filters it away mid-page.\n */\n const actions = React.useMemo<CascaderActionItem[]>(() => {\n if (state?.error) {\n return [{ value: \"retry\", label: labels.retry, onSelect: state.retry }];\n }\n if (state?.hasMore) {\n return [\n {\n value: \"load-more\",\n label: state.loading ? labels.loadingMore : labels.loadMore,\n disabled: state.loading,\n onSelect: state.loadMore,\n },\n ];\n }\n return [];\n }, [state, labels]);\n\n const shared = {\n // Inline and pinned open with a no-op handler, so the unconditional\n // `setOpen(false)` of a single-select commit cannot dismiss the popover.\n inline: true,\n open: true,\n onOpenChange: () => {},\n items: nodes,\n inputValue: currentQuery,\n onInputValueChange: setQuery,\n maxHeight,\n renderItem,\n labels: cascaderLabels,\n actions,\n // The option service is the ONE filter when it owns the query.\n ...(preFiltered ? { filter: () => true } : null),\n };\n\n const cascaderProps: CascaderProps<FilterMenuMeta> = multiple\n ? {\n ...shared,\n multiple: true,\n value: selected,\n onValueChange: (values: string[]) => onSelectionChange(values),\n }\n : {\n ...shared,\n value: selected[0] ?? \"\",\n onValueChange: (value: string) => onSelectionChange(value ? [value] : []),\n };\n\n return (\n <Cascader {...cascaderProps}>\n <CascaderPanel>\n {/*\n `searchable: false` hides the FIELD, never removes it: the input owns\n focus and `aria-activedescendant`, so a menu without one has no\n keyboard. The class goes on the nav so the strip's border goes too.\n */}\n <CascaderNav\n className={cn(\n /* The nav's divider is `border-border/60` and the group separator\n is a full-opacity `bg-border`; two strengths read as a mistake. */\n \"border-border\",\n !searchable && \"sr-only\",\n )}\n >\n <CascaderInput\n {...(autoFocusProps ?? {})}\n placeholder={searchPlaceholder ?? labels.searchOptions}\n aria-label={ariaLabel}\n />\n </CascaderNav>\n <CascaderEmpty>\n {state?.error ? labels.error : state?.loading ? labels.loading : labels.empty}\n </CascaderEmpty>\n {/*\n Plain rows, DELIBERATELY not `CascaderVirtualItems`: windowing stands\n `FilterMenuPinKeeper` down. The long lists are async and PAGE 25.\n */}\n <CascaderList\n /**\n * Real layout space around the group rule, which is absolutely\n * positioned and adds no height. `renderItem` cannot reach the row's\n * own box, and a spacer NODE would join the option ring.\n *\n * `:has()` is affordable here: scoped to this one list, a compound\n * whose descendant exists on at most ONE row, and these menus render\n * tens of rows rather than thousands.\n */\n className=\"[&>[data-slot=cascader-item]:has([data-slot=filter-menu-divider])]:mt-2\"\n >\n <CascaderItems />\n </CascaderList>\n <CascaderFooter />\n <CascaderStatus />\n {/*\n Last, so its layout effect reads the reordered DOM after every row has\n registered. Not mounted at all for a menu that cannot reorder.\n */}\n {pinSelected && sortSelected !== \"snapshot\" ? (\n <FilterMenuPinKeeper order={partitioned.order} items={items} />\n ) : null}\n </CascaderPanel>\n </Cascader>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Option based editors */\n/* -------------------------------------------------------------------------- */\n\nfunction OptionEditor<V, O>(props: FilterEditorProps<V, O> & { multiple: boolean }) {\n const { multiple, options, labels, autoFocusProps, commit, cancel, onValueChange, value, field } =\n props;\n\n const selected = React.useMemo(() => {\n if (value === undefined || value === null) return [];\n return (Array.isArray(value) ? value : [value]) as string[];\n }, [value]);\n\n const announce = React.useContext(FilterActionsContext)?.announce;\n\n return (\n /*\n A DELIBERATELY narrow default: 12rem holds around 22 characters at every\n style's row size. `field.className` lands LAST, so a consumer's `w-*` wins.\n */\n <EditorPanel className={cn(\"w-48 min-w-0 gap-0 p-0\", field.className)}>\n <FilterMenu\n items={options.items}\n selected={selected}\n multiple={multiple}\n onSelectionChange={(raw) => {\n /*\n The ONE place the None rule is applied: every route into a selection\n arrives here, so click and keyboard cannot disagree, and only the\n editor can ANSWER it - `options.resolve` sees the schema and every\n loaded page, where the menu holds only the rows on screen.\n */\n const values = applyFilterExclusiveSelection(raw, selected, (value) =>\n Boolean(options.resolve(value)?.exclusive),\n );\n\n /*\n Identity is the test: the rule hands back `raw` itself unless it\n intervened. Announced because nothing else reports it: focus never\n moved, and nobody is on the rows that lost their check marks.\n */\n if (values !== raw && announce) {\n const arrived = values.find((entry) => !selected.includes(entry));\n const cleared = raw.length - values.length;\n if (arrived !== undefined && cleared > 0) {\n announce(\n labels.exclusiveAnnouncement(options.resolve(arrived)?.label ?? arrived, cleared),\n );\n }\n } else if (values === raw && raw.length > 1) {\n /*\n The hole in the rule, made LOUD. An unresolvable value is treated\n as ordinary and cannot be told from an id whose label has not\n arrived, so this warns rather than acts. Needs a SEEN None row.\n */\n const hasNoneRow =\n options.items.some((item) => item.exclusive) ||\n Boolean(field.options?.some((option) => option.exclusive));\n const unresolved = hasNoneRow\n ? raw.find((entry) => options.resolve(entry) === undefined)\n : undefined;\n if (unresolved !== undefined) {\n warnFilterOnce(\n `exclusive-unresolved:${field.id}`,\n `field \"${field.id}\" has an exclusive option, but the value ` +\n `\"${unresolved}\" resolves to no option, so the None rule ` +\n `cannot tell whether it is the exclusive one and has left ` +\n `it in place. Declare the exclusive option in the field's ` +\n `\\`options\\` even when the rest of the list is async, or ` +\n `cover stored values with \\`resolveValues\\`.`,\n );\n }\n }\n\n if (!multiple) {\n const next = values[0];\n // Base UI deselects the committed row; an empty filter is no gain.\n if (next === undefined) {\n cancel();\n return;\n }\n onValueChange(next as V);\n commit(next as V);\n return;\n }\n onValueChange(values as V);\n // Every toggle commits with the popover open: several picks, one gesture.\n commit(values as V, { close: false });\n }}\n labels={labels}\n ariaLabel={field.label}\n searchable={field.searchable ?? true}\n // Not a composed `Search ${label}...`: hardcoded English no `labels`\n // override could reach, and lowercasing a label is locale-hostile.\n searchPlaceholder={field.placeholder}\n pinSelected={field.pinSelected ?? false}\n sortSelected={field.sortSelected}\n // `useFilterOptions` already applied the query, locally or server side.\n preFiltered\n query={options.query}\n onQueryChange={options.setQuery}\n state={options}\n autoFocusProps={autoFocusProps}\n />\n </EditorPanel>\n );\n}\n\nexport function FilterSelectEditor<V, O>(props: FilterEditorProps<V, O>) {\n return <OptionEditor {...props} multiple={false} />;\n}\n\nexport function FilterMultiSelectEditor<V, O>(props: FilterEditorProps<V, O>) {\n return <OptionEditor {...props} multiple />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Boolean */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Module level, so the menu's index is not rebuilt on every render. Not in\n * `FilterLabels`: the chip's own display spells the same two words out.\n */\nconst BOOLEAN_ITEMS: FilterListItem[] = [\n { value: \"true\", label: \"True\" },\n { value: \"false\", label: \"False\" },\n];\n\nexport function FilterBooleanEditor<V, O>({\n value,\n onValueChange,\n commit,\n labels,\n autoFocusProps,\n field,\n}: FilterEditorProps<V, O>) {\n return (\n // Two words, and `field.className` lands last so a consumer's `w-*` wins.\n <EditorPanel className={cn(\"w-40 min-w-0 gap-0 p-0\", field.className)}>\n <FilterMenu\n items={BOOLEAN_ITEMS}\n selected={value === true ? [\"true\"] : value === false ? [\"false\"] : []}\n onSelectionChange={(values) => {\n /* Deselecting the committed row leaves nothing to filter on, so it is\n a no-op rather than a commit of `false`. */\n if (values.length === 0) return;\n const next = (values[0] === \"true\") as V;\n onValueChange(next);\n commit(next);\n }}\n labels={labels}\n ariaLabel={field.label}\n /* Two rows: a search over them is more chrome than list, but the\n field is still rendered, hidden, because it owns the keyboard. */\n searchable={false}\n autoFocusProps={autoFocusProps}\n />\n </EditorPanel>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Resolution */\n/* -------------------------------------------------------------------------- */\n\nexport type {\n AnyFilterEditor,\n FilterEditorRegistry,\n} from \"./filters-types\";\n\nexport const DEFAULT_FILTER_EDITORS: FilterEditorRegistry = {\n text: FilterTextEditor,\n number: FilterNumberEditor,\n range: FilterRangeEditor,\n select: FilterSelectEditor,\n multiselect: FilterMultiSelectEditor,\n boolean: FilterBooleanEditor,\n};\n\n/**\n * Picks the editor for a (field, operator) pair: the field's own `editor`, then\n * the operator's ARITY, then the field's `type`. Arity outranks type because\n * \"between\" wants two boxes whatever the field said.\n */\nexport function resolveFilterEditor<V, O>(\n field: FilterField<V, O>,\n operator: FilterOperator | undefined,\n editors: FilterEditorRegistry,\n): AnyFilterEditor | undefined {\n if (typeof field.editor === \"function\") {\n // The one place a consumer's typed editor meets the erased registry.\n return field.editor as unknown as AnyFilterEditor;\n }\n if (typeof field.editor === \"string\") {\n const named = editors[field.editor];\n if (named) return named;\n }\n\n const arity = operator?.arity ?? \"one\";\n if (arity === \"none\") return undefined;\n if (arity === \"range\") return editors.range;\n if (arity === \"many\") {\n // An option-backed field gets checkboxes; anything else receives an array.\n if (field.options || field.loadOptions) return editors.multiselect;\n }\n\n return editors[field.type ?? \"text\"] ?? editors.text;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2DA,MAAM,OAAoC;CACxC,OAAO,CAAC;CACR,SAAS;CACT,OAAO;CACP,SAAS;AACX;;AAGA,MAAM,6BAA6B,CAAC;AACpC,MAAM,oBAAoB;;;;;AAM1B,SAAS,eACP,OACA,OACe;CACf,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,OACG;OAAA,MAAM,SAAS,MAAM,KACxB,IAAK,MAAM,UAAuB,OAChC,OAAO,eAAe,MAAM,IAAI;CAAA;CAItC,OAAO,IAAI,MAAM;AACnB;;;;;;;;AASA,SAAgB,iBACd,OACA,SACA,aAAa,KACU;CACvB,MAAM,CAAC,OAAO,iBAAiBA,QAAM,SAAS,EAAE;CAChD,MAAM,CAAC,OAAO,YAAYA,QAAM,SAC9B,IACF;CAEA,MAAM,QAAQA,QAAM,uBAAO,IAAI,IAA6B,CAAC;CAC7D,MAAM,YAAYA,QAAM,OAAO,CAAC;CAChC,MAAM,WAAWA,QAAM,OAA+B,IAAI;CAG1D,MAAM,iBAAiBA,QAAM,WAAW,oBAAoB;CAC5D,MAAM,SAAuC,gBAAgB,cAAc;CAC3E,MAAM,YAAY,eAAe,OAAO,gBAAgB,KAAK;CAG7D,QAA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,MAAM,QAAQ,WAAW,QAAQ;AAClD"}
|
|
@@ -11,7 +11,7 @@ import { DEFAULT_FILTER_LABELS, resolveFilterLabels } from "./filters-i18n.js";
|
|
|
11
11
|
import { FilterAdvancedRow, FiltersAdvanced, FiltersAdvancedPanel } from "./filters-advanced.js";
|
|
12
12
|
import { filterDraftReducer, isFilterDraftCommittable } from "./filters-draft.js";
|
|
13
13
|
import * as React$1 from "react";
|
|
14
|
-
import { cn } from "
|
|
14
|
+
import { cn } from "@kumix/utils";
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { cva } from "class-variance-authority";
|
|
17
17
|
//#region src/components/reui/filters/filters.tsx
|