@kumix/ui 0.3.12 → 0.3.13
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 +1 -1
- package/dist/components/agents/agent-activity/activity-row.js +2 -2
- package/dist/components/agents/agent-activity/activity-row.js.map +1 -1
- package/dist/components/agents/agent-activity/index.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/agents/ai-sidebar.js.map +1 -1
- package/dist/components/agents/approval-card/index.js +2 -2
- 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 +2 -2
- package/dist/components/agents/citations.js.map +1 -1
- package/dist/components/agents/code-block.js +2 -2
- package/dist/components/agents/code-block.js.map +1 -1
- package/dist/components/agents/file-diff.js +2 -2
- package/dist/components/agents/file-diff.js.map +1 -1
- package/dist/components/agents/image-generation.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/agents/prompt-input.js.map +1 -1
- package/dist/components/agents/streaming-response.js +2 -2
- package/dist/components/agents/streaming-response.js.map +1 -1
- package/dist/components/agents/todo-list.js +2 -2
- package/dist/components/agents/todo-list.js.map +1 -1
- package/dist/components/agents/tool-approval.js +2 -2
- package/dist/components/agents/tool-approval.js.map +1 -1
- package/dist/components/agents/tool-result.js +2 -2
- package/dist/components/agents/tool-result.js.map +1 -1
- package/dist/components/custom/confirm-dialog.js +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 +2 -2
- package/dist/components/motion/adaptive-stepper.js.map +1 -1
- package/dist/components/motion/animated-badge.js +2 -2
- 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 +2 -2
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +2 -2
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.js +2 -2
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/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 +2 -2
- package/dist/components/motion/availability-scheduler/index.js.map +1 -1
- package/dist/components/motion/bloom-menu.js +2 -2
- 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 +2 -2
- 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/button/stateful.js +1 -1
- package/dist/components/motion/card-folder.d.ts +30 -0
- package/dist/components/motion/card-folder.d.ts.map +1 -0
- package/dist/components/motion/card-folder.js +254 -0
- package/dist/components/motion/card-folder.js.map +1 -0
- package/dist/components/motion/center-morph-modal.js +2 -2
- 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 +2 -2
- package/dist/components/motion/combobox/list.js.map +1 -1
- package/dist/components/motion/combobox/trigger.js +2 -2
- package/dist/components/motion/combobox/trigger.js.map +1 -1
- package/dist/components/motion/command-palette.js +2 -2
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +2 -2
- 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.d.ts +23 -0
- package/dist/components/motion/digit-swap.d.ts.map +1 -0
- package/dist/components/motion/digit-swap.js +77 -0
- package/dist/components/motion/digit-swap.js.map +1 -0
- 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 +2 -2
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/file-tree.js +2 -2
- package/dist/components/motion/file-tree.js.map +1 -1
- package/dist/components/motion/file-upload.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/motion/morphing-search.js.map +1 -1
- package/dist/components/motion/morphing-tabs.js +2 -2
- 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 +2 -2
- package/dist/components/motion/multi-select/list.js.map +1 -1
- package/dist/components/motion/multi-select/trigger.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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-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.js +1 -1
- 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 +2 -2
- package/dist/components/motion/select-morph.js.map +1 -1
- package/dist/components/motion/select.js +2 -2
- 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 +2 -2
- 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/row-handle.js +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 +2 -2
- 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 +1 -1
- 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 +2 -2
- 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.js +1 -1
- 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 +2 -2
- package/dist/components/reui/alert.js.map +1 -1
- package/dist/components/reui/autocomplete.d.ts +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 +2 -2
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-footer.js +2 -2
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -1
- package/dist/components/reui/cascader/cascader-item.js +2 -2
- package/dist/components/reui/cascader/cascader-item.js.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.js +2 -2
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
- package/dist/components/reui/cascader/cascader.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +2 -2
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.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 +2 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +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 +2 -2
- 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 +2 -2
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -2
- 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 +2 -2
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- 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 +2 -2
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-builder.js +3 -3
- package/dist/components/reui/filters/filters-builder.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.js +2 -2
- package/dist/components/reui/filters/filters-chip.js.map +1 -1
- package/dist/components/reui/filters/filters-editors.js +3 -3
- package/dist/components/reui/filters/filters-editors.js.map +1 -1
- package/dist/components/reui/filters/filters.js +2 -2
- package/dist/components/reui/filters/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +2 -2
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js +2 -2
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +2 -2
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +2 -2
- 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.js +2 -2
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/phone-input.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/ui/bubble.js.map +1 -1
- package/dist/components/ui/button-group.js +2 -2
- 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 +2 -2
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +2 -2
- 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 +2 -2
- 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 +3 -3
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.js +2 -2
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.js +2 -2
- 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 +2 -2
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/field.js +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist/components/ui/item.js +2 -2
- 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.map +1 -1
- package/dist/components/ui/marker.js +2 -2
- package/dist/components/ui/marker.js.map +1 -1
- package/dist/components/ui/menubar.js +2 -2
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/message-scroller.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.js +2 -2
- 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 +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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.map +1 -1
- package/dist/components/ui/tabs.js +2 -2
- 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 +3 -3
- 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 +2 -2
- 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/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
- package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
- package/package.json +5 -3
|
@@ -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 { 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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AClE,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 { 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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CAAA;AAC5C;;;;;AAUA,MAAM,gBAAkC,CACtC;CAAE,OAAO;CAAQ,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"}
|
|
@@ -11,9 +11,9 @@ 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 "
|
|
15
|
-
import { cva } from "class-variance-authority";
|
|
14
|
+
import { cn } from "cn";
|
|
16
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { cva } from "class-variance-authority";
|
|
17
17
|
//#region src/components/reui/filters/filters.tsx
|
|
18
18
|
const filtersBarVariants = cva("flex flex-wrap items-center", {
|
|
19
19
|
variants: { size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAAe,eAAe,KAAA;CACpC,MAAM,CAAC,UAAU,eAAeA,QAAM,eAC9B,uBAAuB,kBAAqB,CACpD;CAEA,MAAM,QAAQ,eAAe,aAAa;CAC1C,MAAM,WAAWA,QAAM,OAAO,KAAK;CACnC,QAAM,gBAAgB;EACpB,SAAS,UAAU;CACrB,CAAC;CAYD,OAAO;EAAE;EAAO;EAAU,UAVTA,QAAM,aACpB,MAAsB,YAAuC;GAC5D,IAAI,SAAS,SAAS,SAAS;GAC/B,SAAS,UAAU;GACnB,IAAI,CAAC,cAAc,YAAY,IAAI;GACnC,WAAW,MAAM,OAAO;EAC1B,GAC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C,GAGzC,MAAM,WAAW,KAAK,SACtB,SACF;EAdF,UAAA;GAgBE,oBAAC,OAAD;IACE,MAAK;IACL,cAAY,QAAQ,OAAO;IAC3B,oBAAiB;IAGjB,GAAK,QAAQ,WAAW,EAAE,oBAAoB,QAAQ,OAAO,SAAS,IAAI;IAC1E,WAAW,GAAG,mBAAmB,EAAE,MAAM,MAAM,OAAO,CAAC,CAAC;IAC7C;IAEV,UAAA,MAAM,KAAK,MAAM,UAChB,oBAAC,YAAD;KAAgC;KAAa;IAAQ,GAApC,KAAK,EAA+B,CACtD;GACE,CAAA;GAEL,oBAAC,gBAAD,EAAyB,QAAU,CAAA;GAElC,aAAa,YAAY,IAGxB,oBAAC,QAAD;IACE,SAAQ;IAER,MAAM,MAAM;IACZ,WAAU;IAGV,UAAU,QAAQ;IAClB,GAAI,oBAAoB,OAAO;IAC/B,eAAe,QAAQ,WAAW;IAEjC,UAAA,QAAQ,OAAO;GACV,CAAA,IACN;GAKJ,oBAAC,OAAD;IAAK,aAAU;IAAS,MAAK;IAAS,WAAU;IAC9C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"cn\";\n\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAA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